analytica-frontend-lib 1.0.91 → 1.0.92

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 (298) hide show
  1. package/dist/Accordation/index.d.mts +12 -0
  2. package/dist/Accordation/index.d.ts +12 -1
  3. package/dist/Accordation/index.js +1 -0
  4. package/dist/Accordation/index.js.map +1 -0
  5. package/dist/Accordation/index.mjs +1 -0
  6. package/dist/Accordation/index.mjs.map +1 -0
  7. package/dist/Alert/index.d.mts +13 -0
  8. package/dist/Alert/index.d.ts +13 -1
  9. package/dist/Alert/index.js +1 -0
  10. package/dist/Alert/index.js.map +1 -0
  11. package/dist/Alert/index.mjs +1 -0
  12. package/dist/Alert/index.mjs.map +1 -0
  13. package/dist/AlertDialog/index.d.mts +36 -0
  14. package/dist/AlertDialog/index.d.ts +36 -1
  15. package/dist/AlertDialog/index.js +1 -0
  16. package/dist/AlertDialog/index.js.map +1 -0
  17. package/dist/AlertDialog/index.mjs +1 -0
  18. package/dist/AlertDialog/index.mjs.map +1 -0
  19. package/dist/Alternative/index.d.mts +81 -0
  20. package/dist/Alternative/index.d.ts +81 -1
  21. package/dist/Alternative/index.js +1 -0
  22. package/dist/Alternative/index.js.map +1 -0
  23. package/dist/Alternative/index.mjs +1 -0
  24. package/dist/Alternative/index.mjs.map +1 -0
  25. package/dist/Auth/AuthProvider/index.d.mts +3 -0
  26. package/dist/Auth/AuthProvider/index.d.ts +3 -1
  27. package/dist/Auth/AuthProvider/index.js +1 -0
  28. package/dist/Auth/AuthProvider/index.js.map +1 -0
  29. package/dist/Auth/AuthProvider/index.mjs +1 -0
  30. package/dist/Auth/AuthProvider/index.mjs.map +1 -0
  31. package/dist/Auth/ProtectedRoute/index.d.mts +3 -0
  32. package/dist/Auth/ProtectedRoute/index.d.ts +3 -1
  33. package/dist/Auth/ProtectedRoute/index.js +1 -0
  34. package/dist/Auth/ProtectedRoute/index.js.map +1 -0
  35. package/dist/Auth/ProtectedRoute/index.mjs +1 -0
  36. package/dist/Auth/ProtectedRoute/index.mjs.map +1 -0
  37. package/dist/Auth/PublicRoute/index.d.mts +3 -0
  38. package/dist/Auth/PublicRoute/index.d.ts +3 -1
  39. package/dist/Auth/PublicRoute/index.js +1 -0
  40. package/dist/Auth/PublicRoute/index.js.map +1 -0
  41. package/dist/Auth/PublicRoute/index.mjs +1 -0
  42. package/dist/Auth/PublicRoute/index.mjs.map +1 -0
  43. package/dist/Auth/getRootDomain/index.d.mts +3 -0
  44. package/dist/Auth/getRootDomain/index.d.ts +3 -1
  45. package/dist/Auth/getRootDomain/index.js +1 -0
  46. package/dist/Auth/getRootDomain/index.js.map +1 -0
  47. package/dist/Auth/getRootDomain/index.mjs +1 -0
  48. package/dist/Auth/getRootDomain/index.mjs.map +1 -0
  49. package/dist/Auth/index.d.mts +312 -0
  50. package/dist/Auth/index.d.ts +312 -1
  51. package/dist/Auth/index.js +1 -0
  52. package/dist/Auth/index.js.map +1 -0
  53. package/dist/Auth/index.mjs +1 -0
  54. package/dist/Auth/index.mjs.map +1 -0
  55. package/dist/Auth/useApiConfig/index.d.mts +43 -0
  56. package/dist/Auth/useApiConfig/index.d.ts +43 -1
  57. package/dist/Auth/useApiConfig/index.js +1 -0
  58. package/dist/Auth/useApiConfig/index.js.map +1 -0
  59. package/dist/Auth/useApiConfig/index.mjs +1 -0
  60. package/dist/Auth/useApiConfig/index.mjs.map +1 -0
  61. package/dist/Auth/useAuth/index.d.mts +3 -0
  62. package/dist/Auth/useAuth/index.d.ts +3 -1
  63. package/dist/Auth/useAuth/index.js +1 -0
  64. package/dist/Auth/useAuth/index.js.map +1 -0
  65. package/dist/Auth/useAuth/index.mjs +1 -0
  66. package/dist/Auth/useAuth/index.mjs.map +1 -0
  67. package/dist/Auth/useAuthGuard/index.d.mts +3 -0
  68. package/dist/Auth/useAuthGuard/index.d.ts +3 -1
  69. package/dist/Auth/useAuthGuard/index.js +1 -0
  70. package/dist/Auth/useAuthGuard/index.js.map +1 -0
  71. package/dist/Auth/useAuthGuard/index.mjs +1 -0
  72. package/dist/Auth/useAuthGuard/index.mjs.map +1 -0
  73. package/dist/Auth/useRouteAuth/index.d.mts +3 -0
  74. package/dist/Auth/useRouteAuth/index.d.ts +3 -1
  75. package/dist/Auth/useRouteAuth/index.js +1 -0
  76. package/dist/Auth/useRouteAuth/index.js.map +1 -0
  77. package/dist/Auth/useRouteAuth/index.mjs +1 -0
  78. package/dist/Auth/useRouteAuth/index.mjs.map +1 -0
  79. package/dist/Auth/useUrlAuthentication/index.d.mts +58 -0
  80. package/dist/Auth/useUrlAuthentication/index.d.ts +58 -1
  81. package/dist/Auth/useUrlAuthentication/index.js +1 -0
  82. package/dist/Auth/useUrlAuthentication/index.js.map +1 -0
  83. package/dist/Auth/useUrlAuthentication/index.mjs +1 -0
  84. package/dist/Auth/useUrlAuthentication/index.mjs.map +1 -0
  85. package/dist/Auth/withAuth/index.d.mts +3 -0
  86. package/dist/Auth/withAuth/index.d.ts +3 -1
  87. package/dist/Auth/withAuth/index.js +1 -0
  88. package/dist/Auth/withAuth/index.js.map +1 -0
  89. package/dist/Auth/withAuth/index.mjs +1 -0
  90. package/dist/Auth/withAuth/index.mjs.map +1 -0
  91. package/dist/Auth/zustandAuthAdapter/index.d.mts +75 -0
  92. package/dist/Auth/zustandAuthAdapter/index.d.ts +75 -1
  93. package/dist/Auth/zustandAuthAdapter/index.js +1 -0
  94. package/dist/Auth/zustandAuthAdapter/index.js.map +1 -0
  95. package/dist/Auth/zustandAuthAdapter/index.mjs +1 -0
  96. package/dist/Auth/zustandAuthAdapter/index.mjs.map +1 -0
  97. package/dist/Badge/index.d.mts +46 -0
  98. package/dist/Badge/index.d.ts +46 -1
  99. package/dist/Badge/index.js +1 -0
  100. package/dist/Badge/index.js.map +1 -0
  101. package/dist/Badge/index.mjs +1 -0
  102. package/dist/Badge/index.mjs.map +1 -0
  103. package/dist/Button/index.d.mts +45 -0
  104. package/dist/Button/index.d.ts +45 -1
  105. package/dist/Button/index.js +1 -0
  106. package/dist/Button/index.js.map +1 -0
  107. package/dist/Button/index.mjs +1 -0
  108. package/dist/Button/index.mjs.map +1 -0
  109. package/dist/Calendar/index.d.mts +60 -0
  110. package/dist/Calendar/index.d.ts +60 -1
  111. package/dist/Calendar/index.js +1 -0
  112. package/dist/Calendar/index.js.map +1 -0
  113. package/dist/Calendar/index.mjs +1 -0
  114. package/dist/Calendar/index.mjs.map +1 -0
  115. package/dist/Card/index.d.mts +150 -0
  116. package/dist/Card/index.d.ts +150 -1
  117. package/dist/Card/index.js +1 -0
  118. package/dist/Card/index.js.map +1 -0
  119. package/dist/Card/index.mjs +1 -0
  120. package/dist/Card/index.mjs.map +1 -0
  121. package/dist/CheckBox/index.d.mts +74 -0
  122. package/dist/CheckBox/index.d.ts +74 -1
  123. package/dist/CheckBox/index.js +1 -0
  124. package/dist/CheckBox/index.js.map +1 -0
  125. package/dist/CheckBox/index.mjs +1 -0
  126. package/dist/CheckBox/index.mjs.map +1 -0
  127. package/dist/Chips/index.d.mts +41 -0
  128. package/dist/Chips/index.d.ts +41 -1
  129. package/dist/Chips/index.js +1 -0
  130. package/dist/Chips/index.js.map +1 -0
  131. package/dist/Chips/index.mjs +1 -0
  132. package/dist/Chips/index.mjs.map +1 -0
  133. package/dist/Divider/index.d.mts +32 -0
  134. package/dist/Divider/index.d.ts +32 -1
  135. package/dist/Divider/index.js +1 -0
  136. package/dist/Divider/index.js.map +1 -0
  137. package/dist/Divider/index.mjs +1 -0
  138. package/dist/Divider/index.mjs.map +1 -0
  139. package/dist/DropdownMenu/index.d.mts +68 -0
  140. package/dist/DropdownMenu/index.d.ts +68 -1
  141. package/dist/DropdownMenu/index.js +1 -0
  142. package/dist/DropdownMenu/index.js.map +1 -0
  143. package/dist/DropdownMenu/index.mjs +1 -0
  144. package/dist/DropdownMenu/index.mjs.map +1 -0
  145. package/dist/IconButton/index.d.mts +76 -0
  146. package/dist/IconButton/index.d.ts +76 -1
  147. package/dist/IconButton/index.js +1 -0
  148. package/dist/IconButton/index.js.map +1 -0
  149. package/dist/IconButton/index.mjs +1 -0
  150. package/dist/IconButton/index.mjs.map +1 -0
  151. package/dist/IconRoundedButton/index.d.mts +34 -0
  152. package/dist/IconRoundedButton/index.d.ts +34 -1
  153. package/dist/IconRoundedButton/index.js +1 -0
  154. package/dist/IconRoundedButton/index.js.map +1 -0
  155. package/dist/IconRoundedButton/index.mjs +1 -0
  156. package/dist/IconRoundedButton/index.mjs.map +1 -0
  157. package/dist/Input/index.d.mts +27 -0
  158. package/dist/Input/index.d.ts +27 -1
  159. package/dist/Input/index.js +1 -0
  160. package/dist/Input/index.js.map +1 -0
  161. package/dist/Input/index.mjs +1 -0
  162. package/dist/Input/index.mjs.map +1 -0
  163. package/dist/Menu/index.d.mts +48 -0
  164. package/dist/Menu/index.d.ts +48 -1
  165. package/dist/Menu/index.js +1 -0
  166. package/dist/Menu/index.js.map +1 -0
  167. package/dist/Menu/index.mjs +1 -0
  168. package/dist/Menu/index.mjs.map +1 -0
  169. package/dist/Modal/index.d.mts +66 -0
  170. package/dist/Modal/index.d.ts +66 -1
  171. package/dist/Modal/index.js +1 -0
  172. package/dist/Modal/index.js.map +1 -0
  173. package/dist/Modal/index.mjs +1 -0
  174. package/dist/Modal/index.mjs.map +1 -0
  175. package/dist/MultipleChoice/index.d.mts +20 -0
  176. package/dist/MultipleChoice/index.d.ts +20 -1
  177. package/dist/MultipleChoice/index.js +1 -0
  178. package/dist/MultipleChoice/index.js.map +1 -0
  179. package/dist/MultipleChoice/index.mjs +1 -0
  180. package/dist/MultipleChoice/index.mjs.map +1 -0
  181. package/dist/NavButton/index.d.mts +57 -0
  182. package/dist/NavButton/index.d.ts +57 -1
  183. package/dist/NavButton/index.js +1 -0
  184. package/dist/NavButton/index.js.map +1 -0
  185. package/dist/NavButton/index.mjs +1 -0
  186. package/dist/NavButton/index.mjs.map +1 -0
  187. package/dist/NotFound/index.d.mts +58 -0
  188. package/dist/NotFound/index.d.ts +58 -1
  189. package/dist/NotFound/index.js +1 -0
  190. package/dist/NotFound/index.js.map +1 -0
  191. package/dist/NotFound/index.mjs +1 -0
  192. package/dist/NotFound/index.mjs.map +1 -0
  193. package/dist/ProgressBar/index.d.mts +95 -0
  194. package/dist/ProgressBar/index.d.ts +95 -1
  195. package/dist/ProgressBar/index.js +1 -0
  196. package/dist/ProgressBar/index.js.map +1 -0
  197. package/dist/ProgressBar/index.mjs +1 -0
  198. package/dist/ProgressBar/index.mjs.map +1 -0
  199. package/dist/ProgressCircle/index.d.mts +60 -0
  200. package/dist/ProgressCircle/index.d.ts +60 -1
  201. package/dist/ProgressCircle/index.js +1 -0
  202. package/dist/ProgressCircle/index.js.map +1 -0
  203. package/dist/ProgressCircle/index.mjs +1 -0
  204. package/dist/ProgressCircle/index.mjs.map +1 -0
  205. package/dist/Quiz/index.d.mts +57 -0
  206. package/dist/Quiz/index.d.ts +57 -1
  207. package/dist/Quiz/index.js +3 -2
  208. package/dist/Quiz/index.js.map +1 -0
  209. package/dist/Quiz/index.mjs +3 -2
  210. package/dist/Quiz/index.mjs.map +1 -0
  211. package/dist/Quiz/useQuizStore/index.d.mts +139 -0
  212. package/dist/Quiz/useQuizStore/index.d.ts +139 -1
  213. package/dist/Quiz/useQuizStore/index.js +1 -0
  214. package/dist/Quiz/useQuizStore/index.js.map +1 -0
  215. package/dist/Quiz/useQuizStore/index.mjs +1 -0
  216. package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
  217. package/dist/Radio/index.d.mts +203 -0
  218. package/dist/Radio/index.d.ts +203 -1
  219. package/dist/Radio/index.js +1 -0
  220. package/dist/Radio/index.js.map +1 -0
  221. package/dist/Radio/index.mjs +1 -0
  222. package/dist/Radio/index.mjs.map +1 -0
  223. package/dist/Select/index.d.mts +58 -0
  224. package/dist/Select/index.d.ts +58 -1
  225. package/dist/Select/index.js +1 -0
  226. package/dist/Select/index.js.map +1 -0
  227. package/dist/Select/index.mjs +1 -0
  228. package/dist/Select/index.mjs.map +1 -0
  229. package/dist/SelectionButton/index.d.mts +57 -0
  230. package/dist/SelectionButton/index.d.ts +57 -1
  231. package/dist/SelectionButton/index.js +1 -0
  232. package/dist/SelectionButton/index.js.map +1 -0
  233. package/dist/SelectionButton/index.mjs +1 -0
  234. package/dist/SelectionButton/index.mjs.map +1 -0
  235. package/dist/Skeleton/index.d.mts +40 -0
  236. package/dist/Skeleton/index.d.ts +40 -1
  237. package/dist/Skeleton/index.js +1 -0
  238. package/dist/Skeleton/index.js.map +1 -0
  239. package/dist/Skeleton/index.mjs +1 -0
  240. package/dist/Skeleton/index.mjs.map +1 -0
  241. package/dist/Stepper/index.d.mts +169 -0
  242. package/dist/Stepper/index.d.ts +169 -1
  243. package/dist/Stepper/index.js +1 -0
  244. package/dist/Stepper/index.js.map +1 -0
  245. package/dist/Stepper/index.mjs +1 -0
  246. package/dist/Stepper/index.mjs.map +1 -0
  247. package/dist/Table/index.d.mts +17 -0
  248. package/dist/Table/index.d.ts +17 -1
  249. package/dist/Table/index.js +1 -0
  250. package/dist/Table/index.js.map +1 -0
  251. package/dist/Table/index.mjs +1 -0
  252. package/dist/Table/index.mjs.map +1 -0
  253. package/dist/Text/index.d.mts +58 -0
  254. package/dist/Text/index.d.ts +58 -1
  255. package/dist/Text/index.js +1 -0
  256. package/dist/Text/index.js.map +1 -0
  257. package/dist/Text/index.mjs +1 -0
  258. package/dist/Text/index.mjs.map +1 -0
  259. package/dist/TextArea/index.d.mts +70 -0
  260. package/dist/TextArea/index.d.ts +70 -1
  261. package/dist/TextArea/index.js +1 -0
  262. package/dist/TextArea/index.js.map +1 -0
  263. package/dist/TextArea/index.mjs +1 -0
  264. package/dist/TextArea/index.mjs.map +1 -0
  265. package/dist/Toast/ToastStore/index.d.mts +19 -0
  266. package/dist/Toast/ToastStore/index.d.ts +19 -1
  267. package/dist/Toast/ToastStore/index.js +1 -0
  268. package/dist/Toast/ToastStore/index.js.map +1 -0
  269. package/dist/Toast/ToastStore/index.mjs +1 -0
  270. package/dist/Toast/ToastStore/index.mjs.map +1 -0
  271. package/dist/Toast/Toaster/index.d.mts +16 -0
  272. package/dist/Toast/Toaster/index.d.ts +16 -1
  273. package/dist/Toast/Toaster/index.js +1 -0
  274. package/dist/Toast/Toaster/index.js.map +1 -0
  275. package/dist/Toast/Toaster/index.mjs +1 -0
  276. package/dist/Toast/Toaster/index.mjs.map +1 -0
  277. package/dist/Toast/index.d.mts +17 -0
  278. package/dist/Toast/index.d.ts +17 -1
  279. package/dist/Toast/index.js +1 -0
  280. package/dist/Toast/index.js.map +1 -0
  281. package/dist/Toast/index.mjs +1 -0
  282. package/dist/Toast/index.mjs.map +1 -0
  283. package/dist/index.css +5 -4
  284. package/dist/index.css.map +1 -0
  285. package/dist/index.d.mts +42 -2142
  286. package/dist/index.d.ts +42 -2142
  287. package/dist/index.js +3 -23
  288. package/dist/index.js.map +1 -0
  289. package/dist/index.mjs +3 -20
  290. package/dist/index.mjs.map +1 -0
  291. package/dist/styles.css +5 -4
  292. package/dist/styles.css.map +1 -0
  293. package/dist/styles.d.mts +2 -0
  294. package/dist/styles.d.ts +2 -0
  295. package/package.json +4 -5
  296. package/dist/CheckBox/CheckboxList/index.d.ts +0 -1
  297. package/dist/CheckBox/CheckboxList/index.js +0 -429
  298. package/dist/CheckBox/CheckboxList/index.mjs +0 -415
@@ -0,0 +1,34 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, ButtonHTMLAttributes } from 'react';
3
+
4
+ /**
5
+ * IconRoundedButton component props interface
6
+ */
7
+ type IconRoundedButtonProps = {
8
+ /** Ícone a ser exibido no botão */
9
+ icon: ReactNode;
10
+ /** Additional CSS classes to apply */
11
+ className?: string;
12
+ } & ButtonHTMLAttributes<HTMLButtonElement>;
13
+ /**
14
+ * IconRoundedButton component for Analytica Ensino platforms
15
+ *
16
+ * Um botão redondo simples que exibe apenas um ícone.
17
+ * Ideal para ações como navegação, fechar, editar, etc.
18
+ *
19
+ * @param icon - O ícone a ser exibido no botão
20
+ * @param className - Classes CSS adicionais
21
+ * @param props - Todos os outros atributos HTML padrão de button
22
+ * @returns Um elemento button estilizado e redondo
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <IconRoundedButton
27
+ * icon={<ChevronRightIcon />}
28
+ * onClick={() => console.log('clicked')}
29
+ * />
30
+ * ```
31
+ */
32
+ declare const IconRoundedButton: ({ icon, className, disabled, ...props }: IconRoundedButtonProps) => react_jsx_runtime.JSX.Element;
33
+
34
+ export { IconRoundedButton as default };
@@ -1 +1,34 @@
1
- export * from '../index';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, ButtonHTMLAttributes } from 'react';
3
+
4
+ /**
5
+ * IconRoundedButton component props interface
6
+ */
7
+ type IconRoundedButtonProps = {
8
+ /** Ícone a ser exibido no botão */
9
+ icon: ReactNode;
10
+ /** Additional CSS classes to apply */
11
+ className?: string;
12
+ } & ButtonHTMLAttributes<HTMLButtonElement>;
13
+ /**
14
+ * IconRoundedButton component for Analytica Ensino platforms
15
+ *
16
+ * Um botão redondo simples que exibe apenas um ícone.
17
+ * Ideal para ações como navegação, fechar, editar, etc.
18
+ *
19
+ * @param icon - O ícone a ser exibido no botão
20
+ * @param className - Classes CSS adicionais
21
+ * @param props - Todos os outros atributos HTML padrão de button
22
+ * @returns Um elemento button estilizado e redondo
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * <IconRoundedButton
27
+ * icon={<ChevronRightIcon />}
28
+ * onClick={() => console.log('clicked')}
29
+ * />
30
+ * ```
31
+ */
32
+ declare const IconRoundedButton: ({ icon, className, disabled, ...props }: IconRoundedButtonProps) => react_jsx_runtime.JSX.Element;
33
+
34
+ export { IconRoundedButton as default };
@@ -72,3 +72,4 @@ var IconRoundedButton = ({
72
72
  );
73
73
  };
74
74
  var IconRoundedButton_default = IconRoundedButton;
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/IconRoundedButton/IconRoundedButton.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { ButtonHTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/utils';\n\n/**\n * IconRoundedButton component props interface\n */\ntype IconRoundedButtonProps = {\n /** Ícone a ser exibido no botão */\n icon: ReactNode;\n /** Additional CSS classes to apply */\n className?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * IconRoundedButton component for Analytica Ensino platforms\n *\n * Um botão redondo simples que exibe apenas um ícone.\n * Ideal para ações como navegação, fechar, editar, etc.\n *\n * @param icon - O ícone a ser exibido no botão\n * @param className - Classes CSS adicionais\n * @param props - Todos os outros atributos HTML padrão de button\n * @returns Um elemento button estilizado e redondo\n *\n * @example\n * ```tsx\n * <IconRoundedButton\n * icon={<ChevronRightIcon />}\n * onClick={() => console.log('clicked')}\n * />\n * ```\n */\nconst IconRoundedButton = ({\n icon,\n className = '',\n disabled,\n ...props\n}: IconRoundedButtonProps) => {\n const baseClasses = [\n 'inline-flex',\n 'items-center',\n 'justify-center',\n 'w-8',\n 'h-8',\n 'rounded-full',\n 'cursor-pointer',\n 'border',\n 'border-background-200',\n 'bg-background',\n 'text-text-950',\n 'hover:shadow-hard-shadow-1',\n 'focus-visible:outline-none',\n 'focus-visible:shadow-hard-shadow-1',\n 'focus-visible:ring-2',\n 'focus-visible:ring-indicator-info',\n 'focus-visible:ring-offset-0',\n 'disabled:opacity-50',\n 'disabled:cursor-not-allowed',\n ].join(' ');\n\n return (\n <button\n type=\"button\"\n className={cn(baseClasses, className)}\n disabled={disabled}\n {...props}\n >\n <span className=\"flex items-center justify-center w-5 h-5\">{icon}</span>\n </button>\n );\n};\n\nexport default IconRoundedButton;\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AD8DM;AAnCN,IAAM,oBAAoB,CAAC;AAAA,EACzB;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,MAA8B;AAC5B,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,GAAG;AAEV,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW,GAAG,aAAa,SAAS;AAAA,MACpC;AAAA,MACC,GAAG;AAAA,MAEJ,sDAAC,UAAK,WAAU,4CAA4C,gBAAK;AAAA;AAAA,EACnE;AAEJ;AAEA,IAAO,4BAAQ;","names":[]}
@@ -49,3 +49,4 @@ var IconRoundedButton_default = IconRoundedButton;
49
49
  export {
50
50
  IconRoundedButton_default as default
51
51
  };
52
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/utils.ts","../../src/components/IconRoundedButton/IconRoundedButton.tsx"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { ButtonHTMLAttributes, ReactNode } from 'react';\nimport { cn } from '../../utils/utils';\n\n/**\n * IconRoundedButton component props interface\n */\ntype IconRoundedButtonProps = {\n /** Ícone a ser exibido no botão */\n icon: ReactNode;\n /** Additional CSS classes to apply */\n className?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * IconRoundedButton component for Analytica Ensino platforms\n *\n * Um botão redondo simples que exibe apenas um ícone.\n * Ideal para ações como navegação, fechar, editar, etc.\n *\n * @param icon - O ícone a ser exibido no botão\n * @param className - Classes CSS adicionais\n * @param props - Todos os outros atributos HTML padrão de button\n * @returns Um elemento button estilizado e redondo\n *\n * @example\n * ```tsx\n * <IconRoundedButton\n * icon={<ChevronRightIcon />}\n * onClick={() => console.log('clicked')}\n * />\n * ```\n */\nconst IconRoundedButton = ({\n icon,\n className = '',\n disabled,\n ...props\n}: IconRoundedButtonProps) => {\n const baseClasses = [\n 'inline-flex',\n 'items-center',\n 'justify-center',\n 'w-8',\n 'h-8',\n 'rounded-full',\n 'cursor-pointer',\n 'border',\n 'border-background-200',\n 'bg-background',\n 'text-text-950',\n 'hover:shadow-hard-shadow-1',\n 'focus-visible:outline-none',\n 'focus-visible:shadow-hard-shadow-1',\n 'focus-visible:ring-2',\n 'focus-visible:ring-indicator-info',\n 'focus-visible:ring-offset-0',\n 'disabled:opacity-50',\n 'disabled:cursor-not-allowed',\n ].join(' ');\n\n return (\n <button\n type=\"button\"\n className={cn(baseClasses, className)}\n disabled={disabled}\n {...props}\n >\n <span className=\"flex items-center justify-center w-5 h-5\">{icon}</span>\n </button>\n );\n};\n\nexport default IconRoundedButton;\n"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AC8DM;AAnCN,IAAM,oBAAoB,CAAC;AAAA,EACzB;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,MAA8B;AAC5B,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,GAAG;AAEV,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW,GAAG,aAAa,SAAS;AAAA,MACpC;AAAA,MACC,GAAG;AAAA,MAEJ,8BAAC,UAAK,WAAU,4CAA4C,gBAAK;AAAA;AAAA,EACnE;AAEJ;AAEA,IAAO,4BAAQ;","names":[]}
@@ -0,0 +1,27 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, InputHTMLAttributes } from 'react';
3
+
4
+ declare const Input: react.ForwardRefExoticComponent<{
5
+ /** Label text displayed above the input */
6
+ label?: string;
7
+ /** Helper text displayed below the input */
8
+ helperText?: string;
9
+ /** Error message displayed below the input */
10
+ errorMessage?: string;
11
+ /** Size of the input */
12
+ size?: "small" | "medium" | "large" | "extra-large";
13
+ /** Visual variant of the input */
14
+ variant?: "outlined" | "underlined" | "rounded";
15
+ /** Current state of the input */
16
+ state?: "default" | "error" | "disabled" | "read-only";
17
+ /** Icon to display on the left side of the input */
18
+ iconLeft?: ReactNode;
19
+ /** Icon to display on the right side of the input */
20
+ iconRight?: ReactNode;
21
+ /** Additional CSS classes to apply to the input */
22
+ className?: string;
23
+ /** Additional CSS classes to apply to the container */
24
+ containerClassName?: string;
25
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & react.RefAttributes<HTMLInputElement>>;
26
+
27
+ export { Input as default };
@@ -1 +1,27 @@
1
- export * from '../index';
1
+ import * as react from 'react';
2
+ import { ReactNode, InputHTMLAttributes } from 'react';
3
+
4
+ declare const Input: react.ForwardRefExoticComponent<{
5
+ /** Label text displayed above the input */
6
+ label?: string;
7
+ /** Helper text displayed below the input */
8
+ helperText?: string;
9
+ /** Error message displayed below the input */
10
+ errorMessage?: string;
11
+ /** Size of the input */
12
+ size?: "small" | "medium" | "large" | "extra-large";
13
+ /** Visual variant of the input */
14
+ variant?: "outlined" | "underlined" | "rounded";
15
+ /** Current state of the input */
16
+ state?: "default" | "error" | "disabled" | "read-only";
17
+ /** Icon to display on the left side of the input */
18
+ iconLeft?: ReactNode;
19
+ /** Icon to display on the right side of the input */
20
+ iconRight?: ReactNode;
21
+ /** Additional CSS classes to apply to the input */
22
+ className?: string;
23
+ /** Additional CSS classes to apply to the container */
24
+ containerClassName?: string;
25
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & react.RefAttributes<HTMLInputElement>>;
26
+
27
+ export { Input as default };
@@ -184,3 +184,4 @@ var Input = (0, import_react.forwardRef)(
184
184
  }
185
185
  );
186
186
  var Input_default = Input;
187
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Input/Input.tsx"],"sourcesContent":["import { WarningCircle, Eye, EyeSlash } from 'phosphor-react';\nimport {\n InputHTMLAttributes,\n ReactNode,\n forwardRef,\n useState,\n useId,\n useMemo,\n} from 'react';\n\n/**\n * Lookup table for size classes\n */\nconst SIZE_CLASSES = {\n small: 'text-sm',\n medium: 'text-md',\n large: 'text-lg',\n 'extra-large': 'text-xl',\n} as const;\n\n/**\n * Lookup table for state classes\n */\nconst STATE_CLASSES = {\n default:\n 'border-border-300 placeholder:text-text-600 hover:border-border-400',\n error: 'border-2 border-indicator-error placeholder:text-text-600',\n disabled:\n 'border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40',\n 'read-only':\n 'border-transparent !text-text-600 cursor-default focus:outline-none bg-transparent',\n} as const;\n\n/**\n * Lookup table for variant classes\n */\nconst VARIANT_CLASSES = {\n outlined: 'border rounded-lg',\n underlined:\n 'border-0 border-b rounded-none bg-transparent focus:outline-none focus:border-primary-950 focus:border-b-2',\n rounded: 'border rounded-full',\n} as const;\n\n/**\n * Input component props interface\n */\ntype InputProps = {\n /** Label text displayed above the input */\n label?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Error message displayed below the input */\n errorMessage?: string;\n /** Size of the input */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /** Visual variant of the input */\n variant?: 'outlined' | 'underlined' | 'rounded';\n /** Current state of the input */\n state?: 'default' | 'error' | 'disabled' | 'read-only';\n /** Icon to display on the left side of the input */\n iconLeft?: ReactNode;\n /** Icon to display on the right side of the input */\n iconRight?: ReactNode;\n /** Additional CSS classes to apply to the input */\n className?: string;\n /** Additional CSS classes to apply to the container */\n containerClassName?: string;\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\n/**\n * Input component for Analytica Ensino platforms\n *\n * A flexible input component with multiple sizes, states, and support for icons.\n * Includes label, helper text, and error message functionality.\n * Features automatic password visibility toggle for password inputs.\n *\n * @param label - Optional label text displayed above the input\n * @param helperText - Optional helper text displayed below the input\n * @param errorMessage - Optional error message displayed below the input\n * @param size - The size variant (small, medium, large, extra-large)\n * @param variant - The visual variant (outlined, underlined, rounded)\n * @param state - The current state (default, error, disabled, read-only)\n * @param iconLeft - Optional icon displayed on the left side\n * @param iconRight - Optional icon displayed on the right side (overridden by password toggle for password inputs)\n * @param type - Input type (text, email, password, etc.) - password type automatically includes show/hide toggle\n * @param className - Additional CSS classes for the input\n * @param containerClassName - Additional CSS classes for the container\n * @param props - All other standard input HTML attributes\n * @returns A styled input element with optional label and helper text\n *\n * @example\n * ```tsx\n * // Basic input\n * <Input\n * label=\"Email\"\n * placeholder=\"Digite seu email\"\n * helperText=\"Usaremos apenas para contato\"\n * size=\"medium\"\n * variant=\"outlined\"\n * state=\"default\"\n * />\n *\n * // Password input with automatic toggle\n * <Input\n * label=\"Senha\"\n * type=\"password\"\n * placeholder=\"Digite sua senha\"\n * helperText=\"Clique no olho para mostrar/ocultar\"\n * />\n * ```\n */\n// Helper functions to reduce cognitive complexity\nconst getActualState = (\n disabled?: boolean,\n readOnly?: boolean,\n errorMessage?: string,\n state?: string\n): keyof typeof STATE_CLASSES => {\n if (disabled) return 'disabled';\n if (readOnly) return 'read-only';\n if (errorMessage) return 'error';\n return (state as keyof typeof STATE_CLASSES) || 'default';\n};\n\nconst getIconSize = (size: string) => {\n const iconSizeClasses = {\n small: 'w-4 h-4',\n medium: 'w-5 h-5',\n large: 'w-6 h-6',\n 'extra-large': 'w-7 h-7',\n };\n return (\n iconSizeClasses[size as keyof typeof iconSizeClasses] ||\n iconSizeClasses.medium\n );\n};\n\nconst getPasswordToggleConfig = (\n type?: string,\n disabled?: boolean,\n readOnly?: boolean,\n showPassword?: boolean,\n iconRight?: ReactNode\n) => {\n const isPasswordType = type === 'password';\n const shouldShowPasswordToggle = isPasswordType && !disabled && !readOnly;\n\n let actualIconRight = iconRight;\n let ariaLabel: string | undefined;\n\n if (shouldShowPasswordToggle) {\n actualIconRight = showPassword ? <EyeSlash /> : <Eye />;\n ariaLabel = showPassword ? 'Ocultar senha' : 'Mostrar senha';\n }\n\n return { shouldShowPasswordToggle, actualIconRight, ariaLabel };\n};\n\nconst getCombinedClasses = (\n actualState: keyof typeof STATE_CLASSES,\n variant: keyof typeof VARIANT_CLASSES\n) => {\n const stateClasses = STATE_CLASSES[actualState];\n const variantClasses = VARIANT_CLASSES[variant];\n\n // Special case: error state with underlined variant\n if (actualState === 'error' && variant === 'underlined') {\n return 'border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600';\n }\n\n // Special case: read-only state with underlined variant\n if (actualState === 'read-only' && variant === 'underlined') {\n return 'border-0 border-b-0 rounded-none bg-transparent focus:outline-none !text-text-900 cursor-default';\n }\n\n return `${stateClasses} ${variantClasses}`;\n};\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(\n (\n {\n label,\n helperText,\n errorMessage,\n size = 'medium',\n variant = 'outlined',\n state = 'default',\n iconLeft,\n iconRight,\n className = '',\n containerClassName = '',\n disabled,\n readOnly,\n id,\n type = 'text',\n ...props\n },\n ref\n ) => {\n // State for password visibility toggle\n const [showPassword, setShowPassword] = useState(false);\n const isPasswordType = type === 'password';\n const actualType = isPasswordType && showPassword ? 'text' : type;\n const actualState = getActualState(disabled, readOnly, errorMessage, state);\n\n // Get classes from lookup tables\n const sizeClasses = SIZE_CLASSES[size];\n const combinedClasses = useMemo(\n () => getCombinedClasses(actualState, variant),\n [actualState, variant]\n );\n const iconSize = getIconSize(size);\n\n const baseClasses = `bg-background w-full py-2 ${\n actualState === 'read-only' ? 'px-0' : 'px-3'\n } font-normal text-text-900 focus:outline-primary-950`;\n\n // Generate unique ID if not provided\n const generatedId = useId();\n const inputId = id ?? `input-${generatedId}`;\n\n // Handle password visibility toggle\n const togglePasswordVisibility = () => setShowPassword(!showPassword);\n\n // Get password toggle configuration\n const { shouldShowPasswordToggle, actualIconRight, ariaLabel } =\n getPasswordToggleConfig(\n type,\n disabled,\n readOnly,\n showPassword,\n iconRight\n );\n\n return (\n <div className={`${containerClassName}`}>\n {/* Label */}\n {label && (\n <label\n htmlFor={inputId}\n className={`block font-bold text-text-900 mb-1.5 ${sizeClasses}`}\n >\n {label}\n </label>\n )}\n\n {/* Input Container */}\n <div className=\"relative\">\n {/* Left Icon */}\n {iconLeft && (\n <div className=\"absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none\">\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center`}\n >\n {iconLeft}\n </span>\n </div>\n )}\n\n {/* Input Field */}\n <input\n ref={ref}\n id={inputId}\n type={actualType}\n className={`${baseClasses} ${sizeClasses} ${combinedClasses} ${\n iconLeft ? 'pl-10' : ''\n } ${actualIconRight ? 'pr-10' : ''} ${className}`}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={actualState === 'error' ? 'true' : undefined}\n {...props}\n />\n\n {/* Right Icon */}\n {actualIconRight &&\n (shouldShowPasswordToggle ? (\n <button\n type=\"button\"\n className=\"absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0\"\n onClick={togglePasswordVisibility}\n aria-label={ariaLabel}\n >\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`}\n >\n {actualIconRight}\n </span>\n </button>\n ) : (\n <div className=\"absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none\">\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center`}\n >\n {actualIconRight}\n </span>\n </div>\n ))}\n </div>\n\n {/* Helper Text or Error Message */}\n <div className=\"mt-1.5 gap-1.5\">\n {helperText && <p className=\"text-sm text-text-500\">{helperText}</p>}\n {errorMessage && (\n <p className=\"flex gap-1 items-center text-sm text-indicator-error\">\n <WarningCircle size={16} /> {errorMessage}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA6C;AAC7C,mBAOO;AA+I8B;AA1IrC,IAAM,eAAe;AAAA,EACnB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,eAAe;AACjB;AAKA,IAAM,gBAAgB;AAAA,EACpB,SACE;AAAA,EACF,OAAO;AAAA,EACP,UACE;AAAA,EACF,aACE;AACJ;AAKA,IAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,YACE;AAAA,EACF,SAAS;AACX;AAuEA,IAAM,iBAAiB,CACrB,UACA,UACA,cACA,UAC+B;AAC/B,MAAI,SAAU,QAAO;AACrB,MAAI,SAAU,QAAO;AACrB,MAAI,aAAc,QAAO;AACzB,SAAQ,SAAwC;AAClD;AAEA,IAAM,cAAc,CAAC,SAAiB;AACpC,QAAM,kBAAkB;AAAA,IACtB,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,eAAe;AAAA,EACjB;AACA,SACE,gBAAgB,IAAoC,KACpD,gBAAgB;AAEpB;AAEA,IAAM,0BAA0B,CAC9B,MACA,UACA,UACA,cACA,cACG;AACH,QAAM,iBAAiB,SAAS;AAChC,QAAM,2BAA2B,kBAAkB,CAAC,YAAY,CAAC;AAEjE,MAAI,kBAAkB;AACtB,MAAI;AAEJ,MAAI,0BAA0B;AAC5B,sBAAkB,eAAe,4CAAC,kCAAS,IAAK,4CAAC,6BAAI;AACrD,gBAAY,eAAe,kBA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export {
169
169
  Input_default as default
170
170
  };
171
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Input/Input.tsx"],"sourcesContent":["import { WarningCircle, Eye, EyeSlash } from 'phosphor-react';\nimport {\n InputHTMLAttributes,\n ReactNode,\n forwardRef,\n useState,\n useId,\n useMemo,\n} from 'react';\n\n/**\n * Lookup table for size classes\n */\nconst SIZE_CLASSES = {\n small: 'text-sm',\n medium: 'text-md',\n large: 'text-lg',\n 'extra-large': 'text-xl',\n} as const;\n\n/**\n * Lookup table for state classes\n */\nconst STATE_CLASSES = {\n default:\n 'border-border-300 placeholder:text-text-600 hover:border-border-400',\n error: 'border-2 border-indicator-error placeholder:text-text-600',\n disabled:\n 'border-border-300 placeholder:text-text-600 cursor-not-allowed opacity-40',\n 'read-only':\n 'border-transparent !text-text-600 cursor-default focus:outline-none bg-transparent',\n} as const;\n\n/**\n * Lookup table for variant classes\n */\nconst VARIANT_CLASSES = {\n outlined: 'border rounded-lg',\n underlined:\n 'border-0 border-b rounded-none bg-transparent focus:outline-none focus:border-primary-950 focus:border-b-2',\n rounded: 'border rounded-full',\n} as const;\n\n/**\n * Input component props interface\n */\ntype InputProps = {\n /** Label text displayed above the input */\n label?: string;\n /** Helper text displayed below the input */\n helperText?: string;\n /** Error message displayed below the input */\n errorMessage?: string;\n /** Size of the input */\n size?: 'small' | 'medium' | 'large' | 'extra-large';\n /** Visual variant of the input */\n variant?: 'outlined' | 'underlined' | 'rounded';\n /** Current state of the input */\n state?: 'default' | 'error' | 'disabled' | 'read-only';\n /** Icon to display on the left side of the input */\n iconLeft?: ReactNode;\n /** Icon to display on the right side of the input */\n iconRight?: ReactNode;\n /** Additional CSS classes to apply to the input */\n className?: string;\n /** Additional CSS classes to apply to the container */\n containerClassName?: string;\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'size'>;\n\n/**\n * Input component for Analytica Ensino platforms\n *\n * A flexible input component with multiple sizes, states, and support for icons.\n * Includes label, helper text, and error message functionality.\n * Features automatic password visibility toggle for password inputs.\n *\n * @param label - Optional label text displayed above the input\n * @param helperText - Optional helper text displayed below the input\n * @param errorMessage - Optional error message displayed below the input\n * @param size - The size variant (small, medium, large, extra-large)\n * @param variant - The visual variant (outlined, underlined, rounded)\n * @param state - The current state (default, error, disabled, read-only)\n * @param iconLeft - Optional icon displayed on the left side\n * @param iconRight - Optional icon displayed on the right side (overridden by password toggle for password inputs)\n * @param type - Input type (text, email, password, etc.) - password type automatically includes show/hide toggle\n * @param className - Additional CSS classes for the input\n * @param containerClassName - Additional CSS classes for the container\n * @param props - All other standard input HTML attributes\n * @returns A styled input element with optional label and helper text\n *\n * @example\n * ```tsx\n * // Basic input\n * <Input\n * label=\"Email\"\n * placeholder=\"Digite seu email\"\n * helperText=\"Usaremos apenas para contato\"\n * size=\"medium\"\n * variant=\"outlined\"\n * state=\"default\"\n * />\n *\n * // Password input with automatic toggle\n * <Input\n * label=\"Senha\"\n * type=\"password\"\n * placeholder=\"Digite sua senha\"\n * helperText=\"Clique no olho para mostrar/ocultar\"\n * />\n * ```\n */\n// Helper functions to reduce cognitive complexity\nconst getActualState = (\n disabled?: boolean,\n readOnly?: boolean,\n errorMessage?: string,\n state?: string\n): keyof typeof STATE_CLASSES => {\n if (disabled) return 'disabled';\n if (readOnly) return 'read-only';\n if (errorMessage) return 'error';\n return (state as keyof typeof STATE_CLASSES) || 'default';\n};\n\nconst getIconSize = (size: string) => {\n const iconSizeClasses = {\n small: 'w-4 h-4',\n medium: 'w-5 h-5',\n large: 'w-6 h-6',\n 'extra-large': 'w-7 h-7',\n };\n return (\n iconSizeClasses[size as keyof typeof iconSizeClasses] ||\n iconSizeClasses.medium\n );\n};\n\nconst getPasswordToggleConfig = (\n type?: string,\n disabled?: boolean,\n readOnly?: boolean,\n showPassword?: boolean,\n iconRight?: ReactNode\n) => {\n const isPasswordType = type === 'password';\n const shouldShowPasswordToggle = isPasswordType && !disabled && !readOnly;\n\n let actualIconRight = iconRight;\n let ariaLabel: string | undefined;\n\n if (shouldShowPasswordToggle) {\n actualIconRight = showPassword ? <EyeSlash /> : <Eye />;\n ariaLabel = showPassword ? 'Ocultar senha' : 'Mostrar senha';\n }\n\n return { shouldShowPasswordToggle, actualIconRight, ariaLabel };\n};\n\nconst getCombinedClasses = (\n actualState: keyof typeof STATE_CLASSES,\n variant: keyof typeof VARIANT_CLASSES\n) => {\n const stateClasses = STATE_CLASSES[actualState];\n const variantClasses = VARIANT_CLASSES[variant];\n\n // Special case: error state with underlined variant\n if (actualState === 'error' && variant === 'underlined') {\n return 'border-0 border-b-2 border-indicator-error rounded-none bg-transparent focus:outline-none focus:border-primary-950 placeholder:text-text-600';\n }\n\n // Special case: read-only state with underlined variant\n if (actualState === 'read-only' && variant === 'underlined') {\n return 'border-0 border-b-0 rounded-none bg-transparent focus:outline-none !text-text-900 cursor-default';\n }\n\n return `${stateClasses} ${variantClasses}`;\n};\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(\n (\n {\n label,\n helperText,\n errorMessage,\n size = 'medium',\n variant = 'outlined',\n state = 'default',\n iconLeft,\n iconRight,\n className = '',\n containerClassName = '',\n disabled,\n readOnly,\n id,\n type = 'text',\n ...props\n },\n ref\n ) => {\n // State for password visibility toggle\n const [showPassword, setShowPassword] = useState(false);\n const isPasswordType = type === 'password';\n const actualType = isPasswordType && showPassword ? 'text' : type;\n const actualState = getActualState(disabled, readOnly, errorMessage, state);\n\n // Get classes from lookup tables\n const sizeClasses = SIZE_CLASSES[size];\n const combinedClasses = useMemo(\n () => getCombinedClasses(actualState, variant),\n [actualState, variant]\n );\n const iconSize = getIconSize(size);\n\n const baseClasses = `bg-background w-full py-2 ${\n actualState === 'read-only' ? 'px-0' : 'px-3'\n } font-normal text-text-900 focus:outline-primary-950`;\n\n // Generate unique ID if not provided\n const generatedId = useId();\n const inputId = id ?? `input-${generatedId}`;\n\n // Handle password visibility toggle\n const togglePasswordVisibility = () => setShowPassword(!showPassword);\n\n // Get password toggle configuration\n const { shouldShowPasswordToggle, actualIconRight, ariaLabel } =\n getPasswordToggleConfig(\n type,\n disabled,\n readOnly,\n showPassword,\n iconRight\n );\n\n return (\n <div className={`${containerClassName}`}>\n {/* Label */}\n {label && (\n <label\n htmlFor={inputId}\n className={`block font-bold text-text-900 mb-1.5 ${sizeClasses}`}\n >\n {label}\n </label>\n )}\n\n {/* Input Container */}\n <div className=\"relative\">\n {/* Left Icon */}\n {iconLeft && (\n <div className=\"absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none\">\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center`}\n >\n {iconLeft}\n </span>\n </div>\n )}\n\n {/* Input Field */}\n <input\n ref={ref}\n id={inputId}\n type={actualType}\n className={`${baseClasses} ${sizeClasses} ${combinedClasses} ${\n iconLeft ? 'pl-10' : ''\n } ${actualIconRight ? 'pr-10' : ''} ${className}`}\n disabled={disabled}\n readOnly={readOnly}\n aria-invalid={actualState === 'error' ? 'true' : undefined}\n {...props}\n />\n\n {/* Right Icon */}\n {actualIconRight &&\n (shouldShowPasswordToggle ? (\n <button\n type=\"button\"\n className=\"absolute right-3 top-1/2 transform -translate-y-1/2 cursor-pointer border-0 bg-transparent p-0\"\n onClick={togglePasswordVisibility}\n aria-label={ariaLabel}\n >\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center hover:text-text-600 transition-colors`}\n >\n {actualIconRight}\n </span>\n </button>\n ) : (\n <div className=\"absolute right-3 top-1/2 transform -translate-y-1/2 pointer-events-none\">\n <span\n className={`${iconSize} text-text-400 flex items-center justify-center`}\n >\n {actualIconRight}\n </span>\n </div>\n ))}\n </div>\n\n {/* Helper Text or Error Message */}\n <div className=\"mt-1.5 gap-1.5\">\n {helperText && <p className=\"text-sm text-text-500\">{helperText}</p>}\n {errorMessage && (\n <p className=\"flex gap-1 items-center text-sm text-indicator-error\">\n <WarningCircle size={16} /> {errorMessage}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nexport default Input;\n"],"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A,YAErB;AAAA;AAAA,QACH,GACF;AAAA,QAIF;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,IAAI;AAAA,YACJ,MAAM;AAAA,YACN,WAAW,GAAG,WAAW,IAAI,WAAW,IAAI,eAAe,IACzD,WAAW,UAAU,EACvB,IAAI,kBAAkB,UAAU,EAAE,IAAI,SAAS;AAAA,YAC/C;AAAA,YACA;AAAA,YACA,gBAAc,gBAAgB,UAAU,SAAS;AAAA,YAChD,GAAG;AAAA;AAAA,QACN;AAAA,QAGC,oBACE,2BACC;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,YACT,cAAY;AAAA,YAEZ;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,GAAG,QAAQ;AAAA,gBAErB;AAAA;AAAA,YACH;AAAA;AAAA,QACF,IAEA,oBAAC,SAAI,WAAU,2EACb;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,QAAQ;AAAA,YAErB;AAAA;AAAA,QACH,GACF;AAAA,SAEN;AAAA,MAGA,qBAAC,SAAI,WAAU,kBACZ;AAAA,sBAAc,oBAAC,OAAE,WAAU,yBAAyB,sBAAW;AAAA,QAC/D,gBACC,qBAAC,OAAE,WAAU,wDACX;AAAA,8BAAC,iBAAc,MAAM,IAAI;AAAA,UAAE;AAAA,UAAE;AAAA,WAC/B;AAAA,SAEJ;AAAA,OACF;AAAA,EAEJ;AACF;AAEA,IAAO,gBAAQ;","names":[]}
@@ -0,0 +1,48 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { HTMLAttributes, ReactNode } from 'react';
4
+ import { StoreApi } from 'zustand';
5
+
6
+ type MenuVariant = 'menu' | 'menu2' | 'breadcrumb';
7
+ interface MenuStore {
8
+ value: string;
9
+ setValue: (value: string) => void;
10
+ onValueChange?: (value: string) => void;
11
+ }
12
+ type MenuStoreApi = StoreApi<MenuStore>;
13
+ declare const useMenuStore: (externalStore?: MenuStoreApi) => MenuStoreApi;
14
+ interface MenuProps extends HTMLAttributes<HTMLDivElement> {
15
+ children: ReactNode;
16
+ defaultValue: string;
17
+ value?: string;
18
+ variant?: MenuVariant;
19
+ onValueChange?: (value: string) => void;
20
+ }
21
+ declare const Menu: react.ForwardRefExoticComponent<MenuProps & react.RefAttributes<HTMLDivElement>>;
22
+ interface MenuContentProps extends HTMLAttributes<HTMLUListElement> {
23
+ children: ReactNode;
24
+ variant?: MenuVariant;
25
+ }
26
+ declare const MenuContent: react.ForwardRefExoticComponent<MenuContentProps & react.RefAttributes<HTMLUListElement>>;
27
+ interface MenuItemProps extends HTMLAttributes<HTMLLIElement> {
28
+ value: string;
29
+ disabled?: boolean;
30
+ store?: MenuStoreApi;
31
+ variant?: MenuVariant;
32
+ separator?: boolean;
33
+ }
34
+ declare const MenuItem: react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLLIElement>>;
35
+ declare const MenuItemIcon: ({ className, icon, ...props }: HTMLAttributes<HTMLSpanElement> & {
36
+ icon: ReactNode;
37
+ }) => react_jsx_runtime.JSX.Element;
38
+ declare const internalScroll: (container: HTMLUListElement | null, direction: "left" | "right") => void;
39
+ declare const internalCheckScroll: (container: HTMLUListElement | null, setShowLeftArrow: (v: boolean) => void, setShowRightArrow: (v: boolean) => void) => void;
40
+ interface MenuOverflowProps extends HTMLAttributes<HTMLDivElement> {
41
+ children: ReactNode;
42
+ defaultValue: string;
43
+ value?: string;
44
+ onValueChange?: (value: string) => void;
45
+ }
46
+ declare const MenuOverflow: ({ children, className, defaultValue, value, onValueChange, ...props }: MenuOverflowProps) => react_jsx_runtime.JSX.Element;
47
+
48
+ export { Menu, MenuContent, MenuItem, MenuItemIcon, MenuOverflow, Menu as default, internalCheckScroll, internalScroll, useMenuStore };
@@ -1 +1,48 @@
1
- export * from '../index';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { HTMLAttributes, ReactNode } from 'react';
4
+ import { StoreApi } from 'zustand';
5
+
6
+ type MenuVariant = 'menu' | 'menu2' | 'breadcrumb';
7
+ interface MenuStore {
8
+ value: string;
9
+ setValue: (value: string) => void;
10
+ onValueChange?: (value: string) => void;
11
+ }
12
+ type MenuStoreApi = StoreApi<MenuStore>;
13
+ declare const useMenuStore: (externalStore?: MenuStoreApi) => MenuStoreApi;
14
+ interface MenuProps extends HTMLAttributes<HTMLDivElement> {
15
+ children: ReactNode;
16
+ defaultValue: string;
17
+ value?: string;
18
+ variant?: MenuVariant;
19
+ onValueChange?: (value: string) => void;
20
+ }
21
+ declare const Menu: react.ForwardRefExoticComponent<MenuProps & react.RefAttributes<HTMLDivElement>>;
22
+ interface MenuContentProps extends HTMLAttributes<HTMLUListElement> {
23
+ children: ReactNode;
24
+ variant?: MenuVariant;
25
+ }
26
+ declare const MenuContent: react.ForwardRefExoticComponent<MenuContentProps & react.RefAttributes<HTMLUListElement>>;
27
+ interface MenuItemProps extends HTMLAttributes<HTMLLIElement> {
28
+ value: string;
29
+ disabled?: boolean;
30
+ store?: MenuStoreApi;
31
+ variant?: MenuVariant;
32
+ separator?: boolean;
33
+ }
34
+ declare const MenuItem: react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLLIElement>>;
35
+ declare const MenuItemIcon: ({ className, icon, ...props }: HTMLAttributes<HTMLSpanElement> & {
36
+ icon: ReactNode;
37
+ }) => react_jsx_runtime.JSX.Element;
38
+ declare const internalScroll: (container: HTMLUListElement | null, direction: "left" | "right") => void;
39
+ declare const internalCheckScroll: (container: HTMLUListElement | null, setShowLeftArrow: (v: boolean) => void, setShowRightArrow: (v: boolean) => void) => void;
40
+ interface MenuOverflowProps extends HTMLAttributes<HTMLDivElement> {
41
+ children: ReactNode;
42
+ defaultValue: string;
43
+ value?: string;
44
+ onValueChange?: (value: string) => void;
45
+ }
46
+ declare const MenuOverflow: ({ children, className, defaultValue, value, onValueChange, ...props }: MenuOverflowProps) => react_jsx_runtime.JSX.Element;
47
+
48
+ export { Menu, MenuContent, MenuItem, MenuItemIcon, MenuOverflow, Menu as default, internalCheckScroll, internalScroll, useMenuStore };
@@ -350,3 +350,4 @@ var Menu_default = Menu;
350
350
  internalScroll,
351
351
  useMenuStore
352
352
  });
353
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Menu/Menu.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { create, StoreApi, useStore } from 'zustand';\nimport {\n ReactNode,\n useEffect,\n useRef,\n forwardRef,\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n isValidElement,\n Children,\n cloneElement,\n useState,\n} from 'react';\nimport { CaretLeft, CaretRight } from 'phosphor-react';\nimport { cn } from '../../utils/utils';\n\ntype MenuVariant = 'menu' | 'menu2' | 'breadcrumb';\n\ninterface MenuStore {\n value: string;\n setValue: (value: string) => void;\n onValueChange?: (value: string) => void;\n}\n\ntype MenuStoreApi = StoreApi<MenuStore>;\n\nconst createMenuStore = (\n onValueChange?: (value: string) => void\n): MenuStoreApi =>\n create<MenuStore>((set) => ({\n value: '',\n setValue: (value) => {\n set({ value });\n onValueChange?.(value);\n },\n onValueChange,\n }));\n\nexport const useMenuStore = (externalStore?: MenuStoreApi) => {\n if (!externalStore) throw new Error('MenuItem must be inside Menu');\n return externalStore;\n};\n\ninterface MenuProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n defaultValue: string;\n value?: string;\n variant?: MenuVariant;\n onValueChange?: (value: string) => void;\n}\n\nconst VARIANT_CLASSES = {\n menu: 'bg-background shadow-soft-shadow-1 px-6',\n menu2: '',\n breadcrumb: '',\n};\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(\n (\n {\n className,\n children,\n defaultValue,\n value: propValue,\n variant = 'menu',\n onValueChange,\n ...props\n },\n ref\n ) => {\n const storeRef = useRef<MenuStoreApi>(null);\n storeRef.current ??= createMenuStore(onValueChange);\n const store = storeRef.current;\n const { setValue } = useStore(store, (s) => s);\n\n useEffect(() => {\n setValue(propValue ?? defaultValue);\n }, [defaultValue, propValue, setValue]);\n\n const baseClasses = 'w-full py-2 flex flex-row items-center justify-center';\n const variantClasses = VARIANT_CLASSES[variant];\n\n return (\n <div\n ref={ref}\n className={`\n ${baseClasses}\n ${variantClasses}\n ${className ?? ''}\n `}\n {...props}\n >\n {injectStore(children, store)}\n </div>\n );\n }\n);\nMenu.displayName = 'Menu';\n\ninterface MenuContentProps extends HTMLAttributes<HTMLUListElement> {\n children: ReactNode;\n variant?: MenuVariant;\n}\n\nconst MenuContent = forwardRef<HTMLUListElement, MenuContentProps>(\n ({ className, children, variant = 'menu', ...props }, ref) => {\n const baseClasses = 'w-full flex flex-row items-center gap-2';\n\n const variantClasses =\n variant === 'menu2' ? 'overflow-x-auto scroll-smooth' : '';\n\n return (\n <ul\n ref={ref}\n className={`\n ${baseClasses}\n ${variantClasses}\n ${variant == 'breadcrumb' ? 'flex-wrap' : ''}\n ${className ?? ''}\n `}\n style={\n variant === 'menu2'\n ? { scrollbarWidth: 'none', msOverflowStyle: 'none' }\n : undefined\n }\n {...props}\n >\n {children}\n </ul>\n );\n }\n);\nMenuContent.displayName = 'MenuContent';\n\ninterface MenuItemProps extends HTMLAttributes<HTMLLIElement> {\n value: string;\n disabled?: boolean;\n store?: MenuStoreApi;\n variant?: MenuVariant;\n separator?: boolean;\n}\n\nconst MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n (\n {\n className,\n children,\n value,\n disabled = false,\n store: externalStore,\n variant = 'menu',\n separator = false,\n ...props\n },\n ref\n ) => {\n const store = useMenuStore(externalStore);\n const { value: selectedValue, setValue } = useStore(store, (s) => s);\n\n const handleClick = (\n e: MouseEvent<HTMLLIElement> | KeyboardEvent<HTMLLIElement>\n ) => {\n if (!disabled) {\n setValue(value);\n }\n props.onClick?.(e as MouseEvent<HTMLLIElement>);\n };\n\n const commonProps = {\n role: 'menuitem',\n 'aria-disabled': disabled,\n ref,\n onClick: handleClick,\n onKeyDown: (e: KeyboardEvent<HTMLLIElement>) => {\n if (['Enter', ' '].includes(e.key)) handleClick(e);\n },\n tabIndex: disabled ? -1 : 0,\n onMouseDown: (e: MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n },\n ...props,\n };\n\n const variants: Record<string, ReactNode> = {\n menu: (\n <li\n data-variant=\"menu\"\n className={`\n w-full flex flex-col items-center justify-center gap-0.5 py-1 px-2 rounded-sm font-medium text-xs\n [&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text\n focus:outline-none focus:border-indicator-info focus:border-2\n ${selectedValue === value ? 'bg-primary-50 text-primary-950' : 'text-text-950'}\n ${className ?? ''}\n `}\n {...commonProps}\n >\n {children}\n </li>\n ),\n menu2: (\n <li\n data-variant=\"menu2\"\n className={`\n w-full flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg\n focus:outline-none focus:border-indicator-info focus:border-2 \n ${selectedValue === value ? '' : 'pb-4'}\n `}\n {...commonProps}\n >\n <span\n className={cn(\n 'flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold',\n className\n )}\n >\n {children}\n </span>\n {selectedValue === value && (\n <div className=\"h-1 w-full bg-primary-950 rounded-lg\" />\n )}\n </li>\n ),\n breadcrumb: (\n <li\n data-variant=\"breadcrumb\"\n className={`\n flex flex-row gap-2 items-center w-fit p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs\n focus:outline-none focus:border-indicator-info focus:border-2\n ${selectedValue === value ? 'text-text-950' : 'text-text-600'}\n ${className ?? ''}\n `}\n {...commonProps}\n >\n <span\n className={cn(\n 'border-b border-text-600 hover:border-primary-600 text-inherit text-xs',\n selectedValue === value\n ? 'border-b-0 font-bold'\n : 'border-b-primary-200'\n )}\n >\n {children}\n </span>\n\n {separator && (\n <CaretRight\n size={16}\n className=\"text-text-600\"\n data-testid=\"separator\"\n />\n )}\n </li>\n ),\n };\n\n return variants[variant] ?? variants['menu'];\n }\n);\nMenuItem.displayName = 'MenuItem';\n\nconst MenuItemIcon = ({\n className,\n icon,\n ...props\n}: HTMLAttributes<HTMLSpanElement> & { icon: ReactNode }) => (\n <span\n className={cn(\n 'bg-background-500 w-[21px] h-[21px] flex items-center justify-center [&>svg]:w-[17px] [&>svg]:h-[17px] rounded-sm',\n className\n )}\n {...props}\n >\n {icon}\n </span>\n);\n\nexport const internalScroll = (\n container: HTMLUListElement | null,\n direction: 'left' | 'right'\n) => {\n if (!container) return;\n container.scrollBy({\n left: direction === 'left' ? -150 : 150,\n behavior: 'smooth',\n });\n};\n\nexport const internalCheckScroll = (\n container: HTMLUListElement | null,\n setShowLeftArrow: (v: boolean) => void,\n setShowRightArrow: (v: boolean) => void\n) => {\n if (!container) return;\n const { scrollLeft, scrollWidth, clientWidth } = container;\n setShowLeftArrow(scrollLeft > 0);\n setShowRightArrow(scrollLeft + clientWidth < scrollWidth);\n};\n\ninterface MenuOverflowProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n defaultValue: string;\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst MenuOverflow = ({\n children,\n className,\n defaultValue,\n value,\n onValueChange,\n ...props\n}: MenuOverflowProps) => {\n const containerRef = useRef<HTMLUListElement>(null);\n const [showLeftArrow, setShowLeftArrow] = useState(false);\n const [showRightArrow, setShowRightArrow] = useState(false);\n\n useEffect(() => {\n const checkScroll = () =>\n internalCheckScroll(\n containerRef.current,\n setShowLeftArrow,\n setShowRightArrow\n );\n checkScroll();\n const container = containerRef.current;\n container?.addEventListener('scroll', checkScroll);\n window.addEventListener('resize', checkScroll);\n return () => {\n container?.removeEventListener('scroll', checkScroll);\n window.removeEventListener('resize', checkScroll);\n };\n }, []);\n\n return (\n <div\n data-testid=\"menu-overflow-wrapper\"\n className={cn('relative w-full overflow-hidden', className)}\n >\n {showLeftArrow && (\n <button\n onClick={() => internalScroll(containerRef.current, 'left')}\n className=\"absolute left-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer\"\n data-testid=\"scroll-left-button\"\n >\n <CaretLeft size={16} />\n <span className=\"sr-only\">Scroll left</span>\n </button>\n )}\n\n <Menu\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n value={value}\n variant=\"menu2\"\n {...props}\n >\n <MenuContent ref={containerRef} variant=\"menu2\">\n {children}\n </MenuContent>\n </Menu>\n\n {showRightArrow && (\n <button\n onClick={() => internalScroll(containerRef.current, 'right')}\n className=\"absolute right-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer\"\n data-testid=\"scroll-right-button\"\n >\n <CaretRight size={16} />\n <span className=\"sr-only\">Scroll right</span>\n </button>\n )}\n </div>\n );\n};\n\nconst injectStore = (children: ReactNode, store: MenuStoreApi): ReactNode =>\n Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n /* eslint-disable-next-line @typescript-eslint/no-explicit-any */\n const typedChild = child as ReactElement<any>;\n const shouldInject = typedChild.type === MenuItem;\n return cloneElement(typedChild, {\n ...(shouldInject ? { store } : {}),\n ...(typedChild.props.children\n ? { children: injectStore(typedChild.props.children, store) }\n : {}),\n });\n });\n\nexport default Menu;\nexport { Menu, MenuContent, MenuItem, MenuOverflow, MenuItemIcon };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA2C;AAC3C,mBAaO;AACP,4BAAsC;;;ACftC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADgFM;AAzDN,IAAM,kBAAkB,CACt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MAAM,eAAe,aAAa,SAAS,OAAO;AAAA,YAC3D,WAAU;AAAA,YACV,eAAY;AAAA,YAEZ;AAAA,0DAAC,oCAAW,MAAM,IAAI;AAAA,cACtB,4CAAC,UAAK,WAAU,WAAU,0BAAY;AAAA;AAAA;AAAA,QACxC;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAM,cAAc,CAAC,UAAqB,UACxC,sBAAS,IAAI,UAAU,CAAC,UAAU;AAChC,MAAI,KAAC,6BAAe,KAAK,EAAG,QAAO;AAEnC,QAAM,aAAa;AACnB,QAAM,eAAe,WAAW,SAAS;AACzC,aAAO,2BAAa,YAAY;AAAA,IAC9B,GAAI,eAAe,EAAE,MAAM,IAAI,CAAC;AAAA,IAChC,GAAI,WAAW,MAAM,WACjB,EAAE,UAAU,YAAY,WAAW,MAAM,UAAU,KAAK,EAAE,IAC1D,CAAC;AAAA,EACP,CAAC;AACH,CAAC;AAEH,IAAO,eAAQ;","names":[]}
@@ -326,3 +326,4 @@ export {
326
326
  internalScroll,
327
327
  useMenuStore
328
328
  };
329
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Menu/Menu.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { create, StoreApi, useStore } from 'zustand';\nimport {\n ReactNode,\n useEffect,\n useRef,\n forwardRef,\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n isValidElement,\n Children,\n cloneElement,\n useState,\n} from 'react';\nimport { CaretLeft, CaretRight } from 'phosphor-react';\nimport { cn } from '../../utils/utils';\n\ntype MenuVariant = 'menu' | 'menu2' | 'breadcrumb';\n\ninterface MenuStore {\n value: string;\n setValue: (value: string) => void;\n onValueChange?: (value: string) => void;\n}\n\ntype MenuStoreApi = StoreApi<MenuStore>;\n\nconst createMenuStore = (\n onValueChange?: (value: string) => void\n): MenuStoreApi =>\n create<MenuStore>((set) => ({\n value: '',\n setValue: (value) => {\n set({ value });\n onValueChange?.(value);\n },\n onValueChange,\n }));\n\nexport const useMenuStore = (externalStore?: MenuStoreApi) => {\n if (!externalStore) throw new Error('MenuItem must be inside Menu');\n return externalStore;\n};\n\ninterface MenuProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n defaultValue: string;\n value?: string;\n variant?: MenuVariant;\n onValueChange?: (value: string) => void;\n}\n\nconst VARIANT_CLASSES = {\n menu: 'bg-background shadow-soft-shadow-1 px-6',\n menu2: '',\n breadcrumb: '',\n};\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(\n (\n {\n className,\n children,\n defaultValue,\n value: propValue,\n variant = 'menu',\n onValueChange,\n ...props\n },\n ref\n ) => {\n const storeRef = useRef<MenuStoreApi>(null);\n storeRef.current ??= createMenuStore(onValueChange);\n const store = storeRef.current;\n const { setValue } = useStore(store, (s) => s);\n\n useEffect(() => {\n setValue(propValue ?? defaultValue);\n }, [defaultValue, propValue, setValue]);\n\n const baseClasses = 'w-full py-2 flex flex-row items-center justify-center';\n const variantClasses = VARIANT_CLASSES[variant];\n\n return (\n <div\n ref={ref}\n className={`\n ${baseClasses}\n ${variantClasses}\n ${className ?? ''}\n `}\n {...props}\n >\n {injectStore(children, store)}\n </div>\n );\n }\n);\nMenu.displayName = 'Menu';\n\ninterface MenuContentProps extends HTMLAttributes<HTMLUListElement> {\n children: ReactNode;\n variant?: MenuVariant;\n}\n\nconst MenuContent = forwardRef<HTMLUListElement, MenuContentProps>(\n ({ className, children, variant = 'menu', ...props }, ref) => {\n const baseClasses = 'w-full flex flex-row items-center gap-2';\n\n const variantClasses =\n variant === 'menu2' ? 'overflow-x-auto scroll-smooth' : '';\n\n return (\n <ul\n ref={ref}\n className={`\n ${baseClasses}\n ${variantClasses}\n ${variant == 'breadcrumb' ? 'flex-wrap' : ''}\n ${className ?? ''}\n `}\n style={\n variant === 'menu2'\n ? { scrollbarWidth: 'none', msOverflowStyle: 'none' }\n : undefined\n }\n {...props}\n >\n {children}\n </ul>\n );\n }\n);\nMenuContent.displayName = 'MenuContent';\n\ninterface MenuItemProps extends HTMLAttributes<HTMLLIElement> {\n value: string;\n disabled?: boolean;\n store?: MenuStoreApi;\n variant?: MenuVariant;\n separator?: boolean;\n}\n\nconst MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n (\n {\n className,\n children,\n value,\n disabled = false,\n store: externalStore,\n variant = 'menu',\n separator = false,\n ...props\n },\n ref\n ) => {\n const store = useMenuStore(externalStore);\n const { value: selectedValue, setValue } = useStore(store, (s) => s);\n\n const handleClick = (\n e: MouseEvent<HTMLLIElement> | KeyboardEvent<HTMLLIElement>\n ) => {\n if (!disabled) {\n setValue(value);\n }\n props.onClick?.(e as MouseEvent<HTMLLIElement>);\n };\n\n const commonProps = {\n role: 'menuitem',\n 'aria-disabled': disabled,\n ref,\n onClick: handleClick,\n onKeyDown: (e: KeyboardEvent<HTMLLIElement>) => {\n if (['Enter', ' '].includes(e.key)) handleClick(e);\n },\n tabIndex: disabled ? -1 : 0,\n onMouseDown: (e: MouseEvent<HTMLLIElement>) => {\n e.preventDefault();\n },\n ...props,\n };\n\n const variants: Record<string, ReactNode> = {\n menu: (\n <li\n data-variant=\"menu\"\n className={`\n w-full flex flex-col items-center justify-center gap-0.5 py-1 px-2 rounded-sm font-medium text-xs\n [&>svg]:size-6 cursor-pointer hover:bg-primary-600 hover:text-text\n focus:outline-none focus:border-indicator-info focus:border-2\n ${selectedValue === value ? 'bg-primary-50 text-primary-950' : 'text-text-950'}\n ${className ?? ''}\n `}\n {...commonProps}\n >\n {children}\n </li>\n ),\n menu2: (\n <li\n data-variant=\"menu2\"\n className={`\n w-full flex flex-col items-center px-2 pt-4 gap-3 cursor-pointer focus:rounded-sm justify-center hover:bg-background-100 rounded-lg\n focus:outline-none focus:border-indicator-info focus:border-2 \n ${selectedValue === value ? '' : 'pb-4'}\n `}\n {...commonProps}\n >\n <span\n className={cn(\n 'flex flex-row items-center gap-2 px-4 text-text-950 text-xs font-bold',\n className\n )}\n >\n {children}\n </span>\n {selectedValue === value && (\n <div className=\"h-1 w-full bg-primary-950 rounded-lg\" />\n )}\n </li>\n ),\n breadcrumb: (\n <li\n data-variant=\"breadcrumb\"\n className={`\n flex flex-row gap-2 items-center w-fit p-2 rounded-lg hover:text-primary-600 cursor-pointer font-bold text-xs\n focus:outline-none focus:border-indicator-info focus:border-2\n ${selectedValue === value ? 'text-text-950' : 'text-text-600'}\n ${className ?? ''}\n `}\n {...commonProps}\n >\n <span\n className={cn(\n 'border-b border-text-600 hover:border-primary-600 text-inherit text-xs',\n selectedValue === value\n ? 'border-b-0 font-bold'\n : 'border-b-primary-200'\n )}\n >\n {children}\n </span>\n\n {separator && (\n <CaretRight\n size={16}\n className=\"text-text-600\"\n data-testid=\"separator\"\n />\n )}\n </li>\n ),\n };\n\n return variants[variant] ?? variants['menu'];\n }\n);\nMenuItem.displayName = 'MenuItem';\n\nconst MenuItemIcon = ({\n className,\n icon,\n ...props\n}: HTMLAttributes<HTMLSpanElement> & { icon: ReactNode }) => (\n <span\n className={cn(\n 'bg-background-500 w-[21px] h-[21px] flex items-center justify-center [&>svg]:w-[17px] [&>svg]:h-[17px] rounded-sm',\n className\n )}\n {...props}\n >\n {icon}\n </span>\n);\n\nexport const internalScroll = (\n container: HTMLUListElement | null,\n direction: 'left' | 'right'\n) => {\n if (!container) return;\n container.scrollBy({\n left: direction === 'left' ? -150 : 150,\n behavior: 'smooth',\n });\n};\n\nexport const internalCheckScroll = (\n container: HTMLUListElement | null,\n setShowLeftArrow: (v: boolean) => void,\n setShowRightArrow: (v: boolean) => void\n) => {\n if (!container) return;\n const { scrollLeft, scrollWidth, clientWidth } = container;\n setShowLeftArrow(scrollLeft > 0);\n setShowRightArrow(scrollLeft + clientWidth < scrollWidth);\n};\n\ninterface MenuOverflowProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n defaultValue: string;\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst MenuOverflow = ({\n children,\n className,\n defaultValue,\n value,\n onValueChange,\n ...props\n}: MenuOverflowProps) => {\n const containerRef = useRef<HTMLUListElement>(null);\n const [showLeftArrow, setShowLeftArrow] = useState(false);\n const [showRightArrow, setShowRightArrow] = useState(false);\n\n useEffect(() => {\n const checkScroll = () =>\n internalCheckScroll(\n containerRef.current,\n setShowLeftArrow,\n setShowRightArrow\n );\n checkScroll();\n const container = containerRef.current;\n container?.addEventListener('scroll', checkScroll);\n window.addEventListener('resize', checkScroll);\n return () => {\n container?.removeEventListener('scroll', checkScroll);\n window.removeEventListener('resize', checkScroll);\n };\n }, []);\n\n return (\n <div\n data-testid=\"menu-overflow-wrapper\"\n className={cn('relative w-full overflow-hidden', className)}\n >\n {showLeftArrow && (\n <button\n onClick={() => internalScroll(containerRef.current, 'left')}\n className=\"absolute left-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer\"\n data-testid=\"scroll-left-button\"\n >\n <CaretLeft size={16} />\n <span className=\"sr-only\">Scroll left</span>\n </button>\n )}\n\n <Menu\n defaultValue={defaultValue}\n onValueChange={onValueChange}\n value={value}\n variant=\"menu2\"\n {...props}\n >\n <MenuContent ref={containerRef} variant=\"menu2\">\n {children}\n </MenuContent>\n </Menu>\n\n {showRightArrow && (\n <button\n onClick={() => internalScroll(containerRef.current, 'right')}\n className=\"absolute right-0 top-1/2 -translate-y-1/2 z-10 flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-md cursor-pointer\"\n data-testid=\"scroll-right-button\"\n >\n <CaretRight size={16} />\n <span className=\"sr-only\">Scroll right</span>\n </button>\n )}\n </div>\n );\n};\n\nconst injectStore = (children: ReactNode, store: MenuStoreApi): ReactNode =>\n Children.map(children, (child) => {\n if (!isValidElement(child)) return child;\n /* eslint-disable-next-line @typescript-eslint/no-explicit-any */\n const typedChild = child as ReactElement<any>;\n const shouldInject = typedChild.type === MenuItem;\n return cloneElement(typedChild, {\n ...(shouldInject ? { store } : {}),\n ...(typedChild.props.children\n ? { children: injectStore(typedChild.props.children, store) }\n : {}),\n });\n });\n\nexport default Menu;\nexport { Menu, MenuContent, MenuItem, MenuOverflow, MenuItemIcon };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";AAAA,SAAS,QAAkB,gBAAgB;AAC3C;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,kBAAkB;;;ACftC,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADgFM,cAqHE,YArHF;AAzDN,IAAM,kBAAkB,CACtB,kBAEA,OAAkB,CAAC,SAAS;AAAA,EAC1B,OAAO;AAAA,EACP,UAAU,CAAC,UAAU;AACnB,QAAI,EAAE,MAAM,CAAC;AACb,oBAAgB,KAAK;AAAA,EACvB;AAAA,EACA;AACF,EAAE;AAEG,IAAM,eAAe,CAAC,kBAAiC;AAC5D,MAAI,CAAC,cAAe,OAAM,IAAI,MAAM,8BAA8B;AAClE,SAAO;AACT;AAUA,IAAM,kBAAkB;AAAA,EACtB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AACd;AAEA,IAAM,OAAO;AAAA,EACX,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,WAAW,OAAqB,IAAI;AAC1C,aAAS,YAAY,gBAAgB,aAAa;AAClD,UAAM,QAAQ,SAAS;AACvB,UAAM,EAAE,SAAS,IAAI,SAAS,OAAO,CAAC,MAAM,CAAC;AAE7C,cAAU,MAAM;AACd,eAAS,aAAa,YAAY;AAAA,IACpC,GAAG,CAAC,cAAc,WA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eAAY;AAAA,MACZ,WAAW,GAAG,mCAAmC,SAAS;AAAA,MAEzD;AAAA,yBACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAS,MAAM,eAAe,aAAa,SAAS,MAAM;AAAA,YAC1D,WAAU;AAAA,YACV,eAAY;AAAA,YAEZ;AAAA,kCAAC,aAAU,MAAM,IAAI;AAAA,cACrB,oBAAC,UAAK,WAAU,WAAU,yBAAW;AAAA;AAAA;AAAA,QACvC;AAAA,QAGF;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAQ;AAAA,YACP,GAAG;AAAA,YAEJ,8BAAC,eAAY,KAAK,cAAc,SAAQ,SACrC,UACH;AAAA;AAAA,QACF;AAAA,QAEC,kBACC;AAAA,UAAC;AAAA;AAAA,YACC,SAAS,MAAM,eAAe,aAAa,SAAS,OAAO;AAAA,YAC3D,WAAU;AAAA,YACV,eAAY;AAAA,YAEZ;AAAA,kCAAC,cAAW,MAAM,IAAI;AAAA,cACtB,oBAAC,UAAK,WAAU,WAAU,0BAAY;AAAA;AAAA;AAAA,QACxC;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAM,cAAc,CAAC,UAAqB,UACxC,SAAS,IAAI,UAAU,CAAC,UAAU;AAChC,MAAI,CAAC,eAAe,KAAK,EAAG,QAAO;AAEnC,QAAM,aAAa;AACnB,QAAM,eAAe,WAAW,SAAS;AACzC,SAAO,aAAa,YAAY;AAAA,IAC9B,GAAI,eAAe,EAAE,MAAM,IAAI,CAAC;AAAA,IAChC,GAAI,WAAW,MAAM,WACjB,EAAE,UAAU,YAAY,WAAW,MAAM,UAAU,KAAK,EAAE,IAC1D,CAAC;AAAA,EACP,CAAC;AACH,CAAC;AAEH,IAAO,eAAQ;","names":[]}
@@ -0,0 +1,66 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Modal component props interface
6
+ */
7
+ type ModalProps = {
8
+ /** Whether the modal is open */
9
+ isOpen: boolean;
10
+ /** Function to close the modal */
11
+ onClose: () => void;
12
+ /** Modal title */
13
+ title: string;
14
+ /** Modal description/content */
15
+ children: ReactNode;
16
+ /** Size of the modal */
17
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
18
+ /** Additional CSS classes for the modal content */
19
+ className?: string;
20
+ /** Whether clicking the backdrop should close the modal */
21
+ closeOnBackdropClick?: boolean;
22
+ /** Whether pressing Escape should close the modal */
23
+ closeOnEscape?: boolean;
24
+ /** Footer content (typically buttons) */
25
+ footer?: ReactNode;
26
+ /** Hide the close button */
27
+ hideCloseButton?: boolean;
28
+ };
29
+ /**
30
+ * Modal component for Analytica Ensino platforms
31
+ *
32
+ * A flexible modal component with multiple size variants and customizable behavior.
33
+ *
34
+ * @param isOpen - Whether the modal is currently open
35
+ * @param onClose - Callback function called when the modal should be closed
36
+ * @param title - The title displayed at the top of the modal
37
+ * @param children - The main content of the modal
38
+ * @param size - The size variant (xs, sm, md, lg, xl)
39
+ * @param className - Additional CSS classes for the modal content
40
+ * @param closeOnBackdropClick - Whether clicking the backdrop closes the modal (default: true)
41
+ * @param closeOnEscape - Whether pressing Escape closes the modal (default: true)
42
+ * @param footer - Footer content, typically action buttons
43
+ * @param hideCloseButton - Whether to hide the X close button (default: false)
44
+ * @returns A modal overlay with content
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Modal
49
+ * isOpen={isModalOpen}
50
+ * onClose={() => setIsModalOpen(false)}
51
+ * title="Invite your team"
52
+ * size="md"
53
+ * footer={
54
+ * <div className="flex gap-3">
55
+ * <Button variant="outline" onClick={() => setIsModalOpen(false)}>Cancel</Button>
56
+ * <Button variant="solid" onClick={handleExplore}>Explore</Button>
57
+ * </div>
58
+ * }
59
+ * >
60
+ * Elevate user interactions with our versatile modals.
61
+ * </Modal>
62
+ * ```
63
+ */
64
+ declare const Modal: ({ isOpen, onClose, title, children, size, className, closeOnBackdropClick, closeOnEscape, footer, hideCloseButton, }: ModalProps) => react_jsx_runtime.JSX.Element | null;
65
+
66
+ export { Modal as default };
@@ -1 +1,66 @@
1
- export * from '../index';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Modal component props interface
6
+ */
7
+ type ModalProps = {
8
+ /** Whether the modal is open */
9
+ isOpen: boolean;
10
+ /** Function to close the modal */
11
+ onClose: () => void;
12
+ /** Modal title */
13
+ title: string;
14
+ /** Modal description/content */
15
+ children: ReactNode;
16
+ /** Size of the modal */
17
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
18
+ /** Additional CSS classes for the modal content */
19
+ className?: string;
20
+ /** Whether clicking the backdrop should close the modal */
21
+ closeOnBackdropClick?: boolean;
22
+ /** Whether pressing Escape should close the modal */
23
+ closeOnEscape?: boolean;
24
+ /** Footer content (typically buttons) */
25
+ footer?: ReactNode;
26
+ /** Hide the close button */
27
+ hideCloseButton?: boolean;
28
+ };
29
+ /**
30
+ * Modal component for Analytica Ensino platforms
31
+ *
32
+ * A flexible modal component with multiple size variants and customizable behavior.
33
+ *
34
+ * @param isOpen - Whether the modal is currently open
35
+ * @param onClose - Callback function called when the modal should be closed
36
+ * @param title - The title displayed at the top of the modal
37
+ * @param children - The main content of the modal
38
+ * @param size - The size variant (xs, sm, md, lg, xl)
39
+ * @param className - Additional CSS classes for the modal content
40
+ * @param closeOnBackdropClick - Whether clicking the backdrop closes the modal (default: true)
41
+ * @param closeOnEscape - Whether pressing Escape closes the modal (default: true)
42
+ * @param footer - Footer content, typically action buttons
43
+ * @param hideCloseButton - Whether to hide the X close button (default: false)
44
+ * @returns A modal overlay with content
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * <Modal
49
+ * isOpen={isModalOpen}
50
+ * onClose={() => setIsModalOpen(false)}
51
+ * title="Invite your team"
52
+ * size="md"
53
+ * footer={
54
+ * <div className="flex gap-3">
55
+ * <Button variant="outline" onClick={() => setIsModalOpen(false)}>Cancel</Button>
56
+ * <Button variant="solid" onClick={handleExplore}>Explore</Button>
57
+ * </div>
58
+ * }
59
+ * >
60
+ * Elevate user interactions with our versatile modals.
61
+ * </Modal>
62
+ * ```
63
+ */
64
+ declare const Modal: ({ isOpen, onClose, title, children, size, className, closeOnBackdropClick, closeOnEscape, footer, hideCloseButton, }: ModalProps) => react_jsx_runtime.JSX.Element | null;
65
+
66
+ export { Modal as default };
@@ -124,3 +124,4 @@ var Modal = ({
124
124
  );
125
125
  };
126
126
  var Modal_default = Modal;
127
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Modal/Modal.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { ReactNode, MouseEvent, useEffect, KeyboardEvent } from 'react';\nimport { X } from 'phosphor-react';\nimport { cn } from '../../utils/utils';\n\n/**\n * Lookup table for size classes\n */\nconst SIZE_CLASSES = {\n xs: 'max-w-[360px]',\n sm: 'max-w-[420px]',\n md: 'max-w-[510px]',\n lg: 'max-w-[640px]',\n xl: 'max-w-[970px]',\n} as const;\n\n/**\n * Modal component props interface\n */\ntype ModalProps = {\n /** Whether the modal is open */\n isOpen: boolean;\n /** Function to close the modal */\n onClose: () => void;\n /** Modal title */\n title: string;\n /** Modal description/content */\n children: ReactNode;\n /** Size of the modal */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n /** Additional CSS classes for the modal content */\n className?: string;\n /** Whether clicking the backdrop should close the modal */\n closeOnBackdropClick?: boolean;\n /** Whether pressing Escape should close the modal */\n closeOnEscape?: boolean;\n /** Footer content (typically buttons) */\n footer?: ReactNode;\n /** Hide the close button */\n hideCloseButton?: boolean;\n};\n\n/**\n * Modal component for Analytica Ensino platforms\n *\n * A flexible modal component with multiple size variants and customizable behavior.\n *\n * @param isOpen - Whether the modal is currently open\n * @param onClose - Callback function called when the modal should be closed\n * @param title - The title displayed at the top of the modal\n * @param children - The main content of the modal\n * @param size - The size variant (xs, sm, md, lg, xl)\n * @param className - Additional CSS classes for the modal content\n * @param closeOnBackdropClick - Whether clicking the backdrop closes the modal (default: true)\n * @param closeOnEscape - Whether pressing Escape closes the modal (default: true)\n * @param footer - Footer content, typically action buttons\n * @param hideCloseButton - Whether to hide the X close button (default: false)\n * @returns A modal overlay with content\n *\n * @example\n * ```tsx\n * <Modal\n * isOpen={isModalOpen}\n * onClose={() => setIsModalOpen(false)}\n * title=\"Invite your team\"\n * size=\"md\"\n * footer={\n * <div className=\"flex gap-3\">\n * <Button variant=\"outline\" onClick={() => setIsModalOpen(false)}>Cancel</Button>\n * <Button variant=\"solid\" onClick={handleExplore}>Explore</Button>\n * </div>\n * }\n * >\n * Elevate user interactions with our versatile modals.\n * </Modal>\n * ```\n */\nconst Modal = ({\n isOpen,\n onClose,\n title,\n children,\n size = 'md',\n className = '',\n closeOnBackdropClick = true,\n closeOnEscape = true,\n footer,\n hideCloseButton = false,\n}: ModalProps) => {\n // Handle escape key\n useEffect(() => {\n if (!isOpen || !closeOnEscape) return;\n\n const handleEscape = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }, [isOpen, closeOnEscape, onClose]);\n\n // Handle body scroll lock\n useEffect(() => {\n const originalOverflow = document.body.style.overflow;\n if (isOpen) {\n document.body.style.overflow = 'hidden';\n } else {\n document.body.style.overflow = originalOverflow;\n }\n\n return () => {\n document.body.style.overflow = originalOverflow;\n };\n }, [isOpen]);\n\n // Handle backdrop click\n const handleBackdropClick = (event: MouseEvent<HTMLDivElement>) => {\n if (closeOnBackdropClick && event.target === event.currentTarget) {\n onClose();\n }\n };\n\n // Handle backdrop keyboard interaction\n const handleBackdropKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (closeOnBackdropClick && (event.key === 'Enter' || event.key === ' ')) {\n onClose();\n }\n };\n\n if (!isOpen) return null;\n\n const sizeClasses = SIZE_CLASSES[size];\n const baseClasses =\n 'bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4';\n // Reset dialog default styles to prevent positioning issues\n const dialogResetClasses =\n 'p-0 m-0 border-none outline-none max-h-none static';\n const modalClasses = cn(\n baseClasses,\n sizeClasses,\n dialogResetClasses,\n className\n );\n\n return (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs\"\n onClick={handleBackdropClick}\n onKeyDown={handleBackdropKeyDown}\n role=\"button\"\n tabIndex={closeOnBackdropClick ? 0 : -1}\n aria-label=\"Fechar modal clicando no fundo\"\n >\n <dialog className={modalClasses} aria-labelledby=\"modal-title\" open>\n {/* Header */}\n <div className=\"flex items-center justify-between px-6 py-6\">\n <h2 id=\"modal-title\" className=\"text-lg font-semibold text-text-950\">\n {title}\n </h2>\n {!hideCloseButton && (\n <button\n onClick={onClose}\n className=\"p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2\"\n aria-label=\"Fechar modal\"\n >\n <X size={18} />\n </button>\n )}\n </div>\n\n {/* Content */}\n <div className=\"px-6 pb-6\">\n <div className=\"text-text-500 font-normal text-sm leading-6\">\n {children}\n </div>\n </div>\n\n {/* Footer */}\n {footer && (\n <div className=\"flex justify-end gap-3 px-6 pb-6\">{footer}</div>\n )}\n </dialog>\n </div>\n );\n};\n\nexport default Modal;\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgE;AAChE,4BAAkB;;;ACDlB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADuJQ;AArJR,IAAM,eAAe;AAA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ACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,SAAS;AAAA,MACT,WAAW;AAAA,MACX,MAAK;AAAA,MACL,UAAU,uBAAuB,IAAI;AAAA,MACrC,cAAW;AAAA,MAEX,uDAAC,YAAO,WAAW,cAAc,mBAAgB,eAAc,MAAI,MAEjE;AAAA,qDAAC,SAAI,WAAU,+CACb;AAAA,sDAAC,QAAG,IAAG,eAAc,WAAU,uCAC5B,iBACH;AAAA,UACC,CAAC,mBACA;AAAA,YAAC;AAAA;AAAA,cACC,SAAS;AAAA,cACT,WAAU;AAAA,cACV,cAAW;AAAA,cAEX,sDAAC,2BAAE,MAAM,IAAI;AAAA;AAAA,UACf;AAAA,WAEJ;AAAA,QAGA,4CAAC,SAAI,WAAU,aACb,sDAAC,SAAI,WAAU,+CACZ,UACH,GACF;AAAA,QAGC,UACC,4CAAC,SAAI,WAAU,oCAAoC,kBAAO;AAAA,SAE9D;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,gBAAQ;","names":[]}
@@ -103,3 +103,4 @@ var Modal_default = Modal;
103
103
  export {
104
104
  Modal_default as default
105
105
  };
106
+ //# sourceMappingURL=index.mjs.map