@finhay-pro/leaf-design-system 0.2.3 → 0.2.5

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 (722) hide show
  1. package/README.md +466 -182
  2. package/dist/accordion.css +142 -0
  3. package/dist/avatar.css +168 -0
  4. package/dist/badge.css +193 -0
  5. package/dist/breadcrumb.css +105 -0
  6. package/dist/button.css +221 -0
  7. package/dist/calendar.css +487 -0
  8. package/dist/carousel.css +165 -0
  9. package/dist/cdn/leaf-0.2.5.min.css +2 -0
  10. package/dist/cdn/leaf-0.2.5.min.js +177 -0
  11. package/dist/checkbox.css +140 -0
  12. package/dist/classes.css +7959 -0
  13. package/dist/color.css +260 -0
  14. package/dist/components/Accordion/Accordion.d.ts +43 -0
  15. package/dist/components/Accordion/Accordion.d.ts.map +1 -0
  16. package/dist/components/Accordion/Accordion.js +37 -0
  17. package/dist/components/Accordion/Accordion.js.map +1 -0
  18. package/dist/components/Accordion/index.d.ts +2 -0
  19. package/dist/components/Accordion/index.d.ts.map +1 -0
  20. package/dist/components/Accordion/index.js +2 -0
  21. package/dist/components/Accordion/index.js.map +1 -0
  22. package/dist/components/Avatar/Avatar.d.ts +32 -0
  23. package/dist/components/Avatar/Avatar.d.ts.map +1 -0
  24. package/dist/components/Avatar/Avatar.js +20 -0
  25. package/dist/components/Avatar/Avatar.js.map +1 -0
  26. package/dist/components/Avatar/index.d.ts +2 -0
  27. package/dist/components/Avatar/index.d.ts.map +1 -0
  28. package/dist/components/Avatar/index.js +2 -0
  29. package/dist/components/Avatar/index.js.map +1 -0
  30. package/dist/components/Badge/Badge.d.ts +44 -0
  31. package/dist/components/Badge/Badge.d.ts.map +1 -0
  32. package/dist/components/Badge/Badge.js +21 -0
  33. package/dist/components/Badge/Badge.js.map +1 -0
  34. package/dist/components/Badge/index.d.ts +2 -0
  35. package/dist/components/Badge/index.d.ts.map +1 -0
  36. package/dist/components/Badge/index.js +2 -0
  37. package/dist/components/Badge/index.js.map +1 -0
  38. package/dist/components/Breadcrumb/Breadcrumb.d.ts +33 -0
  39. package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
  40. package/dist/components/Breadcrumb/Breadcrumb.js +60 -0
  41. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
  42. package/dist/components/Breadcrumb/index.d.ts +2 -0
  43. package/dist/components/Breadcrumb/index.d.ts.map +1 -0
  44. package/dist/components/Breadcrumb/index.js +2 -0
  45. package/dist/components/Breadcrumb/index.js.map +1 -0
  46. package/dist/components/Button/Button.js +1 -1
  47. package/dist/components/Calendar/Calendar.js +1 -1
  48. package/dist/components/CalendarRange/CalendarRange.d.ts +41 -0
  49. package/dist/components/CalendarRange/CalendarRange.d.ts.map +1 -0
  50. package/dist/components/CalendarRange/CalendarRange.js +74 -0
  51. package/dist/components/CalendarRange/CalendarRange.js.map +1 -0
  52. package/dist/components/CalendarRange/index.d.ts +2 -0
  53. package/dist/components/CalendarRange/index.d.ts.map +1 -0
  54. package/dist/components/CalendarRange/index.js +2 -0
  55. package/dist/components/CalendarRange/index.js.map +1 -0
  56. package/dist/components/Carousel/Carousel.d.ts +23 -3
  57. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  58. package/dist/components/Carousel/Carousel.js +30 -8
  59. package/dist/components/Carousel/Carousel.js.map +1 -1
  60. package/dist/components/Date/Date.d.ts +1 -1
  61. package/dist/components/Date/Date.d.ts.map +1 -1
  62. package/dist/components/Date/Date.js +2 -2
  63. package/dist/components/Date/Date.js.map +1 -1
  64. package/dist/components/Dialog/Dialog.d.ts +36 -3
  65. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  66. package/dist/components/Dialog/Dialog.js +42 -7
  67. package/dist/components/Dialog/Dialog.js.map +1 -1
  68. package/dist/components/Dialog/Drawer.d.ts +18 -0
  69. package/dist/components/Dialog/Drawer.d.ts.map +1 -0
  70. package/dist/components/Dialog/Drawer.js +12 -0
  71. package/dist/components/Dialog/Drawer.js.map +1 -0
  72. package/dist/components/Dialog/index.d.ts +2 -1
  73. package/dist/components/Dialog/index.d.ts.map +1 -1
  74. package/dist/components/Dialog/index.js +2 -1
  75. package/dist/components/Dialog/index.js.map +1 -1
  76. package/dist/components/Dropdown/Dropdown.d.ts +15 -1
  77. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  78. package/dist/components/Dropdown/Dropdown.js +106 -20
  79. package/dist/components/Dropdown/Dropdown.js.map +1 -1
  80. package/dist/components/FileViewer/FileViewer.d.ts +3 -1
  81. package/dist/components/FileViewer/FileViewer.d.ts.map +1 -1
  82. package/dist/components/FileViewer/FileViewer.js +2 -1
  83. package/dist/components/FileViewer/FileViewer.js.map +1 -1
  84. package/dist/components/Form/DynamicForm.js +1 -1
  85. package/dist/components/Form/Form.js +1 -1
  86. package/dist/components/Input/Input.d.ts.map +1 -1
  87. package/dist/components/Input/Input.js +3 -1
  88. package/dist/components/Input/Input.js.map +1 -1
  89. package/dist/components/Input/InputDate.d.ts +6 -1
  90. package/dist/components/Input/InputDate.d.ts.map +1 -1
  91. package/dist/components/Input/InputDate.js +36 -11
  92. package/dist/components/Input/InputDate.js.map +1 -1
  93. package/dist/components/Input/InputDateRange.d.ts +43 -0
  94. package/dist/components/Input/InputDateRange.d.ts.map +1 -0
  95. package/dist/components/Input/InputDateRange.js +86 -0
  96. package/dist/components/Input/InputDateRange.js.map +1 -0
  97. package/dist/components/Input/InputNumber.d.ts +28 -0
  98. package/dist/components/Input/InputNumber.d.ts.map +1 -0
  99. package/dist/components/Input/InputNumber.js +58 -0
  100. package/dist/components/Input/InputNumber.js.map +1 -0
  101. package/dist/components/Input/InputOtp.d.ts.map +1 -1
  102. package/dist/components/Input/InputOtp.js +2 -2
  103. package/dist/components/Input/InputOtp.js.map +1 -1
  104. package/dist/components/Input/InputStepper.d.ts +3 -1
  105. package/dist/components/Input/InputStepper.d.ts.map +1 -1
  106. package/dist/components/Input/InputStepper.js +32 -5
  107. package/dist/components/Input/InputStepper.js.map +1 -1
  108. package/dist/components/Input/index.d.ts +2 -0
  109. package/dist/components/Input/index.d.ts.map +1 -1
  110. package/dist/components/Input/index.js +2 -0
  111. package/dist/components/Input/index.js.map +1 -1
  112. package/dist/components/Menu/Menu.d.ts +69 -0
  113. package/dist/components/Menu/Menu.d.ts.map +1 -0
  114. package/dist/components/Menu/Menu.js +140 -0
  115. package/dist/components/Menu/Menu.js.map +1 -0
  116. package/dist/components/Menu/index.d.ts +2 -0
  117. package/dist/components/Menu/index.d.ts.map +1 -0
  118. package/dist/components/Menu/index.js +2 -0
  119. package/dist/components/Menu/index.js.map +1 -0
  120. package/dist/components/MultiSelect/MultiSelect.d.ts +6 -1
  121. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  122. package/dist/components/MultiSelect/MultiSelect.js +42 -23
  123. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  124. package/dist/components/Number/Number.d.ts +4 -2
  125. package/dist/components/Number/Number.d.ts.map +1 -1
  126. package/dist/components/Number/Number.js +3 -1
  127. package/dist/components/Number/Number.js.map +1 -1
  128. package/dist/components/Pagination/Pagination.d.ts +35 -0
  129. package/dist/components/Pagination/Pagination.d.ts.map +1 -0
  130. package/dist/components/Pagination/Pagination.js +40 -0
  131. package/dist/components/Pagination/Pagination.js.map +1 -0
  132. package/dist/components/Pagination/index.d.ts +2 -0
  133. package/dist/components/Pagination/index.d.ts.map +1 -0
  134. package/dist/components/Pagination/index.js +2 -0
  135. package/dist/components/Pagination/index.js.map +1 -0
  136. package/dist/components/Popover/Popover.d.ts +51 -0
  137. package/dist/components/Popover/Popover.d.ts.map +1 -0
  138. package/dist/components/Popover/Popover.js +83 -0
  139. package/dist/components/Popover/Popover.js.map +1 -0
  140. package/dist/components/Popover/index.d.ts +2 -0
  141. package/dist/components/Popover/index.d.ts.map +1 -0
  142. package/dist/components/Popover/index.js +2 -0
  143. package/dist/components/Popover/index.js.map +1 -0
  144. package/dist/components/Progress/Progress.d.ts +30 -0
  145. package/dist/components/Progress/Progress.d.ts.map +1 -0
  146. package/dist/components/Progress/Progress.js +17 -0
  147. package/dist/components/Progress/Progress.js.map +1 -0
  148. package/dist/components/Progress/index.d.ts +2 -0
  149. package/dist/components/Progress/index.d.ts.map +1 -0
  150. package/dist/components/Progress/index.js +2 -0
  151. package/dist/components/Progress/index.js.map +1 -0
  152. package/dist/components/SafeHtml/SafeHtml.d.ts +326 -0
  153. package/dist/components/SafeHtml/SafeHtml.d.ts.map +1 -0
  154. package/dist/components/SafeHtml/SafeHtml.js +44 -0
  155. package/dist/components/SafeHtml/SafeHtml.js.map +1 -0
  156. package/dist/components/SafeHtml/index.d.ts +2 -0
  157. package/dist/components/SafeHtml/index.d.ts.map +1 -0
  158. package/dist/components/SafeHtml/index.js +2 -0
  159. package/dist/components/SafeHtml/index.js.map +1 -0
  160. package/dist/components/Sidebar/Sidebar.d.ts +50 -0
  161. package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
  162. package/dist/components/Sidebar/Sidebar.js +71 -0
  163. package/dist/components/Sidebar/Sidebar.js.map +1 -0
  164. package/dist/components/Sidebar/index.d.ts +2 -0
  165. package/dist/components/Sidebar/index.d.ts.map +1 -0
  166. package/dist/components/Sidebar/index.js +2 -0
  167. package/dist/components/Sidebar/index.js.map +1 -0
  168. package/dist/components/Slider/Slider.js +1 -4
  169. package/dist/components/Slider/Slider.js.map +1 -1
  170. package/dist/components/Spinner/Spinner.js +1 -1
  171. package/dist/components/Steps/Steps.d.ts +30 -0
  172. package/dist/components/Steps/Steps.d.ts.map +1 -0
  173. package/dist/components/Steps/Steps.js +26 -0
  174. package/dist/components/Steps/Steps.js.map +1 -0
  175. package/dist/components/Steps/index.d.ts +2 -0
  176. package/dist/components/Steps/index.d.ts.map +1 -0
  177. package/dist/components/Steps/index.js +2 -0
  178. package/dist/components/Steps/index.js.map +1 -0
  179. package/dist/components/Table/Table.d.ts +61 -3
  180. package/dist/components/Table/Table.d.ts.map +1 -1
  181. package/dist/components/Table/Table.js +176 -33
  182. package/dist/components/Table/Table.js.map +1 -1
  183. package/dist/components/Table/TableHeader.d.ts +8 -3
  184. package/dist/components/Table/TableHeader.d.ts.map +1 -1
  185. package/dist/components/Table/TableHeader.js +7 -5
  186. package/dist/components/Table/TableHeader.js.map +1 -1
  187. package/dist/components/Table/TableRow.d.ts +5 -1
  188. package/dist/components/Table/TableRow.d.ts.map +1 -1
  189. package/dist/components/Table/TableRow.js +2 -2
  190. package/dist/components/Table/TableRow.js.map +1 -1
  191. package/dist/components/Table/index.d.ts +1 -1
  192. package/dist/components/Table/index.d.ts.map +1 -1
  193. package/dist/components/Table/index.js +1 -1
  194. package/dist/components/Table/index.js.map +1 -1
  195. package/dist/components/Tabs/Tabs.d.ts +6 -1
  196. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  197. package/dist/components/Tabs/Tabs.js +2 -2
  198. package/dist/components/Tabs/Tabs.js.map +1 -1
  199. package/dist/components/Toast/Toast.d.ts +8 -4
  200. package/dist/components/Toast/Toast.d.ts.map +1 -1
  201. package/dist/components/Toast/Toast.js +15 -4
  202. package/dist/components/Toast/Toast.js.map +1 -1
  203. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  204. package/dist/components/Tooltip/Tooltip.js +5 -2
  205. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  206. package/dist/components/VirtualList/VirtualList.d.ts +39 -0
  207. package/dist/components/VirtualList/VirtualList.d.ts.map +1 -0
  208. package/dist/components/VirtualList/VirtualList.js +113 -0
  209. package/dist/components/VirtualList/VirtualList.js.map +1 -0
  210. package/dist/components/VirtualList/index.d.ts +2 -0
  211. package/dist/components/VirtualList/index.d.ts.map +1 -0
  212. package/dist/components/VirtualList/index.js +2 -0
  213. package/dist/components/VirtualList/index.js.map +1 -0
  214. package/dist/core/accordion.d.ts +15 -0
  215. package/dist/core/accordion.d.ts.map +1 -0
  216. package/dist/core/accordion.js +37 -0
  217. package/dist/core/accordion.js.map +1 -0
  218. package/dist/core/avatar.d.ts +4 -0
  219. package/dist/core/avatar.d.ts.map +1 -0
  220. package/dist/core/avatar.js +12 -0
  221. package/dist/core/avatar.js.map +1 -0
  222. package/dist/core/calendar.d.ts +1 -2
  223. package/dist/core/calendar.d.ts.map +1 -1
  224. package/dist/core/calendar.js +2 -10
  225. package/dist/core/calendar.js.map +1 -1
  226. package/dist/core/carousel.d.ts +8 -0
  227. package/dist/core/carousel.d.ts.map +1 -1
  228. package/dist/core/carousel.js +27 -0
  229. package/dist/core/carousel.js.map +1 -1
  230. package/dist/core/css-gradient.d.ts +21 -0
  231. package/dist/core/css-gradient.d.ts.map +1 -0
  232. package/dist/core/css-gradient.js +54 -0
  233. package/dist/core/css-gradient.js.map +1 -0
  234. package/dist/core/date-math.d.ts +39 -0
  235. package/dist/core/date-math.d.ts.map +1 -0
  236. package/dist/core/date-math.js +82 -0
  237. package/dist/core/date-math.js.map +1 -0
  238. package/dist/core/date-range.d.ts +44 -0
  239. package/dist/core/date-range.d.ts.map +1 -0
  240. package/dist/core/date-range.js +88 -0
  241. package/dist/core/date-range.js.map +1 -0
  242. package/dist/core/date.d.ts +23 -4
  243. package/dist/core/date.d.ts.map +1 -1
  244. package/dist/core/date.js +114 -4
  245. package/dist/core/date.js.map +1 -1
  246. package/dist/core/dialog.d.ts +43 -5
  247. package/dist/core/dialog.d.ts.map +1 -1
  248. package/dist/core/dialog.js +85 -8
  249. package/dist/core/dialog.js.map +1 -1
  250. package/dist/core/file/csv.d.ts +10 -0
  251. package/dist/core/file/csv.d.ts.map +1 -1
  252. package/dist/core/file/csv.js +26 -3
  253. package/dist/core/file/csv.js.map +1 -1
  254. package/dist/core/file/detect.js.map +1 -1
  255. package/dist/core/file/docx-render.js.map +1 -1
  256. package/dist/core/file/docx.js.map +1 -1
  257. package/dist/core/file/dom.d.ts +1 -1
  258. package/dist/core/file/dom.d.ts.map +1 -1
  259. package/dist/core/file/dom.js +3 -3
  260. package/dist/core/file/dom.js.map +1 -1
  261. package/dist/core/file/download.d.ts +5 -0
  262. package/dist/core/file/download.d.ts.map +1 -1
  263. package/dist/core/file/download.js +10 -3
  264. package/dist/core/file/download.js.map +1 -1
  265. package/dist/core/file/error.d.ts.map +1 -1
  266. package/dist/core/file/error.js.map +1 -1
  267. package/dist/core/file/source.d.ts +15 -1
  268. package/dist/core/file/source.d.ts.map +1 -1
  269. package/dist/core/file/source.js +99 -6
  270. package/dist/core/file/source.js.map +1 -1
  271. package/dist/core/file/text.js.map +1 -1
  272. package/dist/core/file/viewer.d.ts +2 -0
  273. package/dist/core/file/viewer.d.ts.map +1 -1
  274. package/dist/core/file/viewer.js +3 -2
  275. package/dist/core/file/viewer.js.map +1 -1
  276. package/dist/core/file/xlsx-format.js.map +1 -1
  277. package/dist/core/file/xlsx-write.js.map +1 -1
  278. package/dist/core/file/xlsx.d.ts.map +1 -1
  279. package/dist/core/file/xlsx.js +4 -3
  280. package/dist/core/file/xlsx.js.map +1 -1
  281. package/dist/core/file/xml.d.ts.map +1 -1
  282. package/dist/core/file/xml.js +5 -0
  283. package/dist/core/file/xml.js.map +1 -1
  284. package/dist/core/file/zip-write.js.map +1 -1
  285. package/dist/core/file/zip.js.map +1 -1
  286. package/dist/core/floating.d.ts +69 -0
  287. package/dist/core/floating.d.ts.map +1 -0
  288. package/dist/core/floating.js +185 -0
  289. package/dist/core/floating.js.map +1 -0
  290. package/dist/core/html/css.d.ts +32 -0
  291. package/dist/core/html/css.d.ts.map +1 -0
  292. package/dist/core/html/css.js +222 -0
  293. package/dist/core/html/css.js.map +1 -0
  294. package/dist/core/html/entities.d.ts +19 -0
  295. package/dist/core/html/entities.d.ts.map +1 -0
  296. package/dist/core/html/entities.js +167 -0
  297. package/dist/core/html/entities.js.map +1 -0
  298. package/dist/core/html/entity-data.d.ts +14 -0
  299. package/dist/core/html/entity-data.d.ts.map +1 -0
  300. package/dist/core/html/entity-data.js +14 -0
  301. package/dist/core/html/entity-data.js.map +1 -0
  302. package/dist/core/html/props.d.ts +9 -0
  303. package/dist/core/html/props.d.ts.map +1 -0
  304. package/dist/core/html/props.js +98 -0
  305. package/dist/core/html/props.js.map +1 -0
  306. package/dist/core/html/sanitize.d.ts +150 -0
  307. package/dist/core/html/sanitize.d.ts.map +1 -0
  308. package/dist/core/html/sanitize.js +800 -0
  309. package/dist/core/html/sanitize.js.map +1 -0
  310. package/dist/core/html/tokenizer.d.ts +33 -0
  311. package/dist/core/html/tokenizer.d.ts.map +1 -0
  312. package/dist/core/html/tokenizer.js +306 -0
  313. package/dist/core/html/tokenizer.js.map +1 -0
  314. package/dist/core/html/tree.d.ts +35 -0
  315. package/dist/core/html/tree.d.ts.map +1 -0
  316. package/dist/core/html/tree.js +253 -0
  317. package/dist/core/html/tree.js.map +1 -0
  318. package/dist/core/icons.d.ts +8 -3
  319. package/dist/core/icons.d.ts.map +1 -1
  320. package/dist/core/icons.js +20 -5
  321. package/dist/core/icons.js.map +1 -1
  322. package/dist/core/language.d.ts.map +1 -1
  323. package/dist/core/menu.d.ts +22 -0
  324. package/dist/core/menu.d.ts.map +1 -0
  325. package/dist/core/menu.js +69 -0
  326. package/dist/core/menu.js.map +1 -0
  327. package/dist/core/motion.d.ts +12 -0
  328. package/dist/core/motion.d.ts.map +1 -0
  329. package/dist/core/motion.js +17 -0
  330. package/dist/core/motion.js.map +1 -0
  331. package/dist/core/number-input.d.ts +29 -0
  332. package/dist/core/number-input.d.ts.map +1 -0
  333. package/dist/core/number-input.js +92 -0
  334. package/dist/core/number-input.js.map +1 -0
  335. package/dist/core/number.d.ts +14 -0
  336. package/dist/core/number.d.ts.map +1 -1
  337. package/dist/core/number.js +48 -2
  338. package/dist/core/number.js.map +1 -1
  339. package/dist/core/otp.d.ts +2 -0
  340. package/dist/core/otp.d.ts.map +1 -1
  341. package/dist/core/otp.js +4 -0
  342. package/dist/core/otp.js.map +1 -1
  343. package/dist/core/pacer.d.ts +63 -0
  344. package/dist/core/pacer.d.ts.map +1 -0
  345. package/dist/core/pacer.js +129 -0
  346. package/dist/core/pacer.js.map +1 -0
  347. package/dist/core/pagination.d.ts +44 -0
  348. package/dist/core/pagination.d.ts.map +1 -0
  349. package/dist/core/pagination.js +78 -0
  350. package/dist/core/pagination.js.map +1 -0
  351. package/dist/core/popover.d.ts +6 -0
  352. package/dist/core/popover.d.ts.map +1 -0
  353. package/dist/core/popover.js +6 -0
  354. package/dist/core/popover.js.map +1 -0
  355. package/dist/core/progress.d.ts +3 -0
  356. package/dist/core/progress.d.ts.map +1 -0
  357. package/dist/core/progress.js +8 -0
  358. package/dist/core/progress.js.map +1 -0
  359. package/dist/core/qr-code.d.ts +7 -0
  360. package/dist/core/qr-code.d.ts.map +1 -1
  361. package/dist/core/qr-code.js +15 -9
  362. package/dist/core/qr-code.js.map +1 -1
  363. package/dist/core/roving.d.ts +19 -0
  364. package/dist/core/roving.d.ts.map +1 -0
  365. package/dist/core/roving.js +54 -0
  366. package/dist/core/roving.js.map +1 -0
  367. package/dist/core/safe-url.d.ts +37 -0
  368. package/dist/core/safe-url.d.ts.map +1 -0
  369. package/dist/core/safe-url.js +68 -0
  370. package/dist/core/safe-url.js.map +1 -0
  371. package/dist/core/sheet.d.ts +19 -0
  372. package/dist/core/sheet.d.ts.map +1 -0
  373. package/dist/core/sheet.js +54 -0
  374. package/dist/core/sheet.js.map +1 -0
  375. package/dist/core/spinner.d.ts +2 -2
  376. package/dist/core/spinner.d.ts.map +1 -1
  377. package/dist/core/spinner.js +22 -4
  378. package/dist/core/spinner.js.map +1 -1
  379. package/dist/core/status.d.ts +20 -0
  380. package/dist/core/status.d.ts.map +1 -0
  381. package/dist/core/status.js +30 -0
  382. package/dist/core/status.js.map +1 -0
  383. package/dist/core/stepper.js.map +1 -1
  384. package/dist/core/table/attrs.d.ts +8 -2
  385. package/dist/core/table/attrs.d.ts.map +1 -1
  386. package/dist/core/table/attrs.js +12 -3
  387. package/dist/core/table/attrs.js.map +1 -1
  388. package/dist/core/table/columns.d.ts +17 -0
  389. package/dist/core/table/columns.d.ts.map +1 -1
  390. package/dist/core/table/columns.js.map +1 -1
  391. package/dist/core/table/features.d.ts +72 -0
  392. package/dist/core/table/features.d.ts.map +1 -0
  393. package/dist/core/table/features.js +198 -0
  394. package/dist/core/table/features.js.map +1 -0
  395. package/dist/core/table/index.d.ts +2 -0
  396. package/dist/core/table/index.d.ts.map +1 -1
  397. package/dist/core/table/index.js +2 -0
  398. package/dist/core/table/index.js.map +1 -1
  399. package/dist/core/table/reorder.d.ts +21 -0
  400. package/dist/core/table/reorder.d.ts.map +1 -0
  401. package/dist/core/table/reorder.js +70 -0
  402. package/dist/core/table/reorder.js.map +1 -0
  403. package/dist/core/table/virtual.d.ts +5 -18
  404. package/dist/core/table/virtual.d.ts.map +1 -1
  405. package/dist/core/table/virtual.js +4 -15
  406. package/dist/core/table/virtual.js.map +1 -1
  407. package/dist/core/tabs.d.ts.map +1 -1
  408. package/dist/core/tabs.js +2 -15
  409. package/dist/core/tabs.js.map +1 -1
  410. package/dist/core/toast.d.ts +15 -3
  411. package/dist/core/toast.d.ts.map +1 -1
  412. package/dist/core/toast.js +9 -6
  413. package/dist/core/toast.js.map +1 -1
  414. package/dist/core/tooltip.d.ts +8 -7
  415. package/dist/core/tooltip.d.ts.map +1 -1
  416. package/dist/core/tooltip.js +14 -119
  417. package/dist/core/tooltip.js.map +1 -1
  418. package/dist/core/upload.d.ts +1 -0
  419. package/dist/core/upload.d.ts.map +1 -1
  420. package/dist/core/upload.js +6 -0
  421. package/dist/core/upload.js.map +1 -1
  422. package/dist/core/virtual.d.ts +76 -0
  423. package/dist/core/virtual.d.ts.map +1 -0
  424. package/dist/core/virtual.js +214 -0
  425. package/dist/core/virtual.js.map +1 -0
  426. package/dist/date.css +19 -0
  427. package/dist/dialog.css +413 -0
  428. package/dist/dropdown.css +514 -0
  429. package/dist/empty.css +82 -0
  430. package/dist/file-viewer.css +519 -0
  431. package/dist/fn/async.d.ts +39 -0
  432. package/dist/fn/async.d.ts.map +1 -0
  433. package/dist/fn/async.js +91 -0
  434. package/dist/fn/async.js.map +1 -0
  435. package/dist/fn/clipboard.d.ts +6 -0
  436. package/dist/fn/clipboard.d.ts.map +1 -0
  437. package/dist/fn/clipboard.js +35 -0
  438. package/dist/fn/clipboard.js.map +1 -0
  439. package/dist/fn/cookie.d.ts +7 -0
  440. package/dist/fn/cookie.d.ts.map +1 -0
  441. package/dist/fn/cookie.js +22 -0
  442. package/dist/fn/cookie.js.map +1 -0
  443. package/dist/fn/error.d.ts +24 -0
  444. package/dist/fn/error.d.ts.map +1 -0
  445. package/dist/fn/error.js +50 -0
  446. package/dist/fn/error.js.map +1 -0
  447. package/dist/fn/html.d.ts +34 -0
  448. package/dist/fn/html.d.ts.map +1 -0
  449. package/dist/fn/html.js +60 -0
  450. package/dist/fn/html.js.map +1 -0
  451. package/dist/fn/index.d.ts +39 -0
  452. package/dist/fn/index.d.ts.map +1 -0
  453. package/dist/fn/index.js +40 -0
  454. package/dist/fn/index.js.map +1 -0
  455. package/dist/fn/jwt.d.ts +12 -0
  456. package/dist/fn/jwt.d.ts.map +1 -0
  457. package/dist/fn/jwt.js +42 -0
  458. package/dist/fn/jwt.js.map +1 -0
  459. package/dist/fn/locale.d.ts +20 -0
  460. package/dist/fn/locale.d.ts.map +1 -0
  461. package/dist/fn/locale.js +33 -0
  462. package/dist/fn/locale.js.map +1 -0
  463. package/dist/fn/query.d.ts +11 -0
  464. package/dist/fn/query.d.ts.map +1 -0
  465. package/dist/fn/query.js +41 -0
  466. package/dist/fn/query.js.map +1 -0
  467. package/dist/fn/sanitize.d.ts +15 -0
  468. package/dist/fn/sanitize.d.ts.map +1 -0
  469. package/dist/fn/sanitize.js +15 -0
  470. package/dist/fn/sanitize.js.map +1 -0
  471. package/dist/fn/storage.d.ts +13 -0
  472. package/dist/fn/storage.d.ts.map +1 -0
  473. package/dist/fn/storage.js +69 -0
  474. package/dist/fn/storage.js.map +1 -0
  475. package/dist/fn/string.d.ts +13 -0
  476. package/dist/fn/string.d.ts.map +1 -0
  477. package/dist/fn/string.js +30 -0
  478. package/dist/fn/string.js.map +1 -0
  479. package/dist/fn/url.d.ts +27 -0
  480. package/dist/fn/url.d.ts.map +1 -0
  481. package/dist/fn/url.js +71 -0
  482. package/dist/fn/url.js.map +1 -0
  483. package/dist/fn/version.d.ts +5 -0
  484. package/dist/fn/version.d.ts.map +1 -0
  485. package/dist/fn/version.js +23 -0
  486. package/dist/fn/version.js.map +1 -0
  487. package/dist/focus.css +18 -0
  488. package/dist/form.css +64 -0
  489. package/dist/hooks/index.d.ts +43 -0
  490. package/dist/hooks/index.d.ts.map +1 -0
  491. package/dist/hooks/index.js +43 -0
  492. package/dist/hooks/index.js.map +1 -0
  493. package/dist/hooks/useAsync.d.ts +17 -0
  494. package/dist/hooks/useAsync.d.ts.map +1 -0
  495. package/dist/hooks/useAsync.js +38 -0
  496. package/dist/hooks/useAsync.js.map +1 -0
  497. package/dist/hooks/useAsyncCallback.d.ts +26 -0
  498. package/dist/hooks/useAsyncCallback.d.ts.map +1 -0
  499. package/dist/hooks/useAsyncCallback.js +57 -0
  500. package/dist/hooks/useAsyncCallback.js.map +1 -0
  501. package/dist/hooks/useBatcher.d.ts +11 -0
  502. package/dist/hooks/useBatcher.d.ts.map +1 -0
  503. package/dist/hooks/useBatcher.js +16 -0
  504. package/dist/hooks/useBatcher.js.map +1 -0
  505. package/dist/hooks/useClickOutside.d.ts +12 -0
  506. package/dist/hooks/useClickOutside.d.ts.map +1 -0
  507. package/dist/hooks/useClickOutside.js +29 -0
  508. package/dist/hooks/useClickOutside.js.map +1 -0
  509. package/dist/hooks/useControllableState.d.ts +2 -0
  510. package/dist/hooks/useControllableState.d.ts.map +1 -0
  511. package/dist/hooks/useControllableState.js +3 -0
  512. package/dist/hooks/useControllableState.js.map +1 -0
  513. package/dist/hooks/useCopyToClipboard.d.ts +9 -0
  514. package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
  515. package/dist/hooks/useCopyToClipboard.js +23 -0
  516. package/dist/hooks/useCopyToClipboard.js.map +1 -0
  517. package/dist/hooks/useCountdown.d.ts +24 -0
  518. package/dist/hooks/useCountdown.d.ts.map +1 -0
  519. package/dist/hooks/useCountdown.js +59 -0
  520. package/dist/hooks/useCountdown.js.map +1 -0
  521. package/dist/hooks/useDebouncedCallback.d.ts +7 -0
  522. package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
  523. package/dist/hooks/useDebouncedCallback.js +15 -0
  524. package/dist/hooks/useDebouncedCallback.js.map +1 -0
  525. package/dist/hooks/useDebouncedValue.d.ts +4 -0
  526. package/dist/hooks/useDebouncedValue.d.ts.map +1 -0
  527. package/dist/hooks/useDebouncedValue.js +19 -0
  528. package/dist/hooks/useDebouncedValue.js.map +1 -0
  529. package/dist/hooks/useDisclosure.d.ts +21 -0
  530. package/dist/hooks/useDisclosure.d.ts.map +1 -0
  531. package/dist/hooks/useDisclosure.js +20 -0
  532. package/dist/hooks/useDisclosure.js.map +1 -0
  533. package/dist/hooks/useDocumentTitle.d.ts +8 -0
  534. package/dist/hooks/useDocumentTitle.d.ts.map +1 -0
  535. package/dist/hooks/useDocumentTitle.js +18 -0
  536. package/dist/hooks/useDocumentTitle.js.map +1 -0
  537. package/dist/hooks/useElementSize.d.ts +13 -0
  538. package/dist/hooks/useElementSize.d.ts.map +1 -0
  539. package/dist/hooks/useElementSize.js +28 -0
  540. package/dist/hooks/useElementSize.js.map +1 -0
  541. package/dist/hooks/useEventListener.d.ts +10 -0
  542. package/dist/hooks/useEventListener.d.ts.map +1 -0
  543. package/dist/hooks/useEventListener.js +30 -0
  544. package/dist/hooks/useEventListener.js.map +1 -0
  545. package/dist/hooks/useHotkeys.d.ts +24 -0
  546. package/dist/hooks/useHotkeys.d.ts.map +1 -0
  547. package/dist/hooks/useHotkeys.js +69 -0
  548. package/dist/hooks/useHotkeys.js.map +1 -0
  549. package/dist/hooks/useIdle.d.ts +16 -0
  550. package/dist/hooks/useIdle.d.ts.map +1 -0
  551. package/dist/hooks/useIdle.js +63 -0
  552. package/dist/hooks/useIdle.js.map +1 -0
  553. package/dist/hooks/useInView.d.ts +13 -0
  554. package/dist/hooks/useInView.d.ts.map +1 -0
  555. package/dist/hooks/useInView.js +32 -0
  556. package/dist/hooks/useInView.js.map +1 -0
  557. package/dist/hooks/useInfiniteScroll.d.ts +20 -0
  558. package/dist/hooks/useInfiniteScroll.d.ts.map +1 -0
  559. package/dist/hooks/useInfiniteScroll.js +38 -0
  560. package/dist/hooks/useInfiniteScroll.js.map +1 -0
  561. package/dist/hooks/useInterval.d.ts +3 -0
  562. package/dist/hooks/useInterval.d.ts.map +1 -0
  563. package/dist/hooks/useInterval.js +15 -0
  564. package/dist/hooks/useInterval.js.map +1 -0
  565. package/dist/hooks/useIsClient.d.ts +6 -0
  566. package/dist/hooks/useIsClient.d.ts.map +1 -0
  567. package/dist/hooks/useIsClient.js +11 -0
  568. package/dist/hooks/useIsClient.js.map +1 -0
  569. package/dist/hooks/useLatest.d.ts +7 -0
  570. package/dist/hooks/useLatest.d.ts.map +1 -0
  571. package/dist/hooks/useLatest.js +14 -0
  572. package/dist/hooks/useLatest.js.map +1 -0
  573. package/dist/hooks/useMediaQuery.d.ts +6 -0
  574. package/dist/hooks/useMediaQuery.d.ts.map +1 -0
  575. package/dist/hooks/useMediaQuery.js +20 -0
  576. package/dist/hooks/useMediaQuery.js.map +1 -0
  577. package/dist/hooks/useMergedRefs.d.ts +6 -0
  578. package/dist/hooks/useMergedRefs.d.ts.map +1 -0
  579. package/dist/hooks/useMergedRefs.js +9 -0
  580. package/dist/hooks/useMergedRefs.js.map +1 -0
  581. package/dist/hooks/useObjectUrl.d.ts +7 -0
  582. package/dist/hooks/useObjectUrl.d.ts.map +1 -0
  583. package/dist/hooks/useObjectUrl.js +21 -0
  584. package/dist/hooks/useObjectUrl.js.map +1 -0
  585. package/dist/hooks/useOnlineStatus.d.ts +3 -0
  586. package/dist/hooks/useOnlineStatus.d.ts.map +1 -0
  587. package/dist/hooks/useOnlineStatus.js +15 -0
  588. package/dist/hooks/useOnlineStatus.js.map +1 -0
  589. package/dist/hooks/usePageVisibility.d.ts +3 -0
  590. package/dist/hooks/usePageVisibility.d.ts.map +1 -0
  591. package/dist/hooks/usePageVisibility.js +11 -0
  592. package/dist/hooks/usePageVisibility.js.map +1 -0
  593. package/dist/hooks/usePolling.d.ts +17 -0
  594. package/dist/hooks/usePolling.d.ts.map +1 -0
  595. package/dist/hooks/usePolling.js +46 -0
  596. package/dist/hooks/usePolling.js.map +1 -0
  597. package/dist/hooks/usePrefersReducedMotion.d.ts +3 -0
  598. package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -0
  599. package/dist/hooks/usePrefersReducedMotion.js +7 -0
  600. package/dist/hooks/usePrefersReducedMotion.js.map +1 -0
  601. package/dist/hooks/usePresence.d.ts +2 -0
  602. package/dist/hooks/usePresence.d.ts.map +1 -0
  603. package/dist/hooks/usePresence.js +3 -0
  604. package/dist/hooks/usePresence.js.map +1 -0
  605. package/dist/hooks/usePrevious.d.ts +3 -0
  606. package/dist/hooks/usePrevious.d.ts.map +1 -0
  607. package/dist/hooks/usePrevious.js +15 -0
  608. package/dist/hooks/usePrevious.js.map +1 -0
  609. package/dist/hooks/useScroll.d.ts +22 -0
  610. package/dist/hooks/useScroll.d.ts.map +1 -0
  611. package/dist/hooks/useScroll.js +73 -0
  612. package/dist/hooks/useScroll.js.map +1 -0
  613. package/dist/hooks/useScrollLock.d.ts +6 -0
  614. package/dist/hooks/useScrollLock.d.ts.map +1 -0
  615. package/dist/hooks/useScrollLock.js +17 -0
  616. package/dist/hooks/useScrollLock.js.map +1 -0
  617. package/dist/hooks/useStorageState.d.ts +14 -0
  618. package/dist/hooks/useStorageState.d.ts.map +1 -0
  619. package/dist/hooks/useStorageState.js +62 -0
  620. package/dist/hooks/useStorageState.js.map +1 -0
  621. package/dist/hooks/useSyncedState.d.ts +6 -0
  622. package/dist/hooks/useSyncedState.d.ts.map +1 -0
  623. package/dist/hooks/useSyncedState.js +16 -0
  624. package/dist/hooks/useSyncedState.js.map +1 -0
  625. package/dist/hooks/useThrottledCallback.d.ts +4 -0
  626. package/dist/hooks/useThrottledCallback.d.ts.map +1 -0
  627. package/dist/hooks/useThrottledCallback.js +12 -0
  628. package/dist/hooks/useThrottledCallback.js.map +1 -0
  629. package/dist/hooks/useThrottledValue.d.ts +4 -0
  630. package/dist/hooks/useThrottledValue.d.ts.map +1 -0
  631. package/dist/hooks/useThrottledValue.js +19 -0
  632. package/dist/hooks/useThrottledValue.js.map +1 -0
  633. package/dist/hooks/useTimeout.d.ts +9 -0
  634. package/dist/hooks/useTimeout.d.ts.map +1 -0
  635. package/dist/hooks/useTimeout.js +23 -0
  636. package/dist/hooks/useTimeout.js.map +1 -0
  637. package/dist/hooks/useWindowSize.d.ts +12 -0
  638. package/dist/hooks/useWindowSize.d.ts.map +1 -0
  639. package/dist/hooks/useWindowSize.js +38 -0
  640. package/dist/hooks/useWindowSize.js.map +1 -0
  641. package/dist/index.d.ts +26 -6
  642. package/dist/index.d.ts.map +1 -1
  643. package/dist/index.js +26 -6
  644. package/dist/index.js.map +1 -1
  645. package/dist/input-date.css +99 -0
  646. package/dist/input-otp.css +76 -0
  647. package/dist/input-stepper.css +179 -0
  648. package/dist/input.css +231 -0
  649. package/dist/logo-assets.css +81 -0
  650. package/dist/logo.css +59 -0
  651. package/dist/menu.css +198 -0
  652. package/dist/multiselect.css +147 -0
  653. package/dist/number.css +53 -0
  654. package/dist/pagination.css +140 -0
  655. package/dist/popover.css +106 -0
  656. package/dist/progress.css +187 -0
  657. package/dist/qr-code.css +28 -0
  658. package/dist/radio.css +124 -0
  659. package/dist/server/crypto.d.ts +26 -0
  660. package/dist/server/crypto.d.ts.map +1 -0
  661. package/dist/server/crypto.js +50 -0
  662. package/dist/server/crypto.js.map +1 -0
  663. package/dist/server/index.d.ts +9 -0
  664. package/dist/server/index.d.ts.map +1 -0
  665. package/dist/server/index.js +9 -0
  666. package/dist/server/index.js.map +1 -0
  667. package/dist/server/rate-limit.d.ts +20 -0
  668. package/dist/server/rate-limit.d.ts.map +1 -0
  669. package/dist/server/rate-limit.js +42 -0
  670. package/dist/server/rate-limit.js.map +1 -0
  671. package/dist/server/request.d.ts +42 -0
  672. package/dist/server/request.d.ts.map +1 -0
  673. package/dist/server/request.js +94 -0
  674. package/dist/server/request.js.map +1 -0
  675. package/dist/server/response.d.ts +19 -0
  676. package/dist/server/response.d.ts.map +1 -0
  677. package/dist/server/response.js +44 -0
  678. package/dist/server/response.js.map +1 -0
  679. package/dist/sidebar.css +271 -0
  680. package/dist/skeleton.css +57 -0
  681. package/dist/skill/leaf-design-system-0.2.5.zip +0 -0
  682. package/dist/slider.css +312 -0
  683. package/dist/spinner.css +132 -0
  684. package/dist/steps.css +211 -0
  685. package/dist/{leaf.css → styles.css} +4665 -2163
  686. package/dist/table.css +435 -0
  687. package/dist/tabs.css +270 -0
  688. package/dist/textarea.css +28 -0
  689. package/dist/toast.css +272 -0
  690. package/dist/toggle.css +123 -0
  691. package/dist/tokens.css +264 -0
  692. package/dist/tooltip.css +259 -0
  693. package/dist/typography.css +150 -0
  694. package/dist/upload.css +326 -0
  695. package/dist/utils/RemixGlyph.d.ts +1 -1
  696. package/dist/utils/RemixGlyph.d.ts.map +1 -1
  697. package/dist/utils/RemixGlyph.js +1 -1
  698. package/dist/utils/RemixGlyph.js.map +1 -1
  699. package/dist/utils/useFloating.d.ts +11 -0
  700. package/dist/utils/useFloating.d.ts.map +1 -0
  701. package/dist/utils/useFloating.js +34 -0
  702. package/dist/utils/useFloating.js.map +1 -0
  703. package/dist/utils/useFloatingLayer.d.ts +40 -0
  704. package/dist/utils/useFloatingLayer.d.ts.map +1 -0
  705. package/dist/utils/useFloatingLayer.js +95 -0
  706. package/dist/utils/useFloatingLayer.js.map +1 -0
  707. package/dist/utils/usePresence.d.ts +9 -0
  708. package/dist/utils/usePresence.d.ts.map +1 -0
  709. package/dist/utils/usePresence.js +25 -0
  710. package/dist/utils/usePresence.js.map +1 -0
  711. package/dist/virtual-list.css +60 -0
  712. package/package.json +82 -21
  713. package/dist/cdn/leaf-0.2.3.min.css +0 -8
  714. package/dist/cdn/leaf-0.2.3.min.js +0 -204
  715. package/dist/engine/assets.json +0 -1
  716. package/dist/engine/chunk-X2H56OKG.js +0 -4854
  717. package/dist/engine/cli.js +0 -8
  718. package/dist/engine/postcss.d.ts +0 -3
  719. package/dist/engine/postcss.js +0 -7
  720. package/dist/engine/vite.d.ts +0 -3
  721. package/dist/engine/vite.js +0 -7
  722. package/dist/skill/leaf-design-system-0.2.3.zip +0 -0
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @finhay-pro/leaf-design-system
2
2
 
3
3
  Design system của Finhay: **2 bộ token — Color và Typography** (CSS variables trong
4
- [`@finhay/leaf-tokens`](../tokens)), **class typography / màu dùng sẵn**, **component** (React +
5
- HTML tĩnh dùng chung markup) và **utility layout** do engine CSS riêng của Leaf sinh ra (không
6
- dependency, không cần Tailwind). Màu và chữ luôn đọc từ token; spacing / radius / độ dày viền không
7
- phải token — component tự khai báo trong CSS của nó, app dùng utility px (`p-[16px]`,
8
- `rounded-xl`, `border-[0.5px]`).
4
+ [`@finhay/leaf-tokens`](../tokens)), **class typography / màu dùng sẵn** và **component** (React +
5
+ HTML tĩnh dùng chung markup). Màu và chữ luôn đọc từ token; spacing / radius / độ dày viền không
6
+ phải token của Leaf — component tự khai báo trong CSS của nó, app dùng Tailwind.
9
7
 
10
- | Loại project | Cách dùng |
11
- | -------------------------- | ---------------------------------------------------------------------------------------- |
12
- | Next.js / Vite (có bundle) | Plugin Leaf (PostCSS / Vite) + một dòng `@import` |
13
- | HTML tĩnh có bước build | CLI `leaf-css` sinh một file CSS |
14
- | Landing page (CDN) | 1 `<link>` + 1 `<script>` — script sinh utility từ class trên DOM ngay trong trình duyệt |
8
+ Leaf **không** có class layout / spacing / responsive. Phần đó luôn là **Tailwind CSS v4**, cho
9
+ cả 2 cách dùng:
15
10
 
16
- Xem [Cài đặt](#cài-đặt), [Utility layout](#utility-layout) và [HTML tĩnh (CDN)](#html-tĩnh-cdn).
11
+ | Loại project | Leaf cung cấp | Layout · spacing · responsive · hover |
12
+ | ------------------------------ | ------------------------------------------ | ------------------------------------------------------------------- |
13
+ | React / Next.js (có bundle) | Token + class typography / màu + component | **Tailwind CSS v4** (`@tailwindcss/postcss` / `vite`) |
14
+ | Landing page / HTML tĩnh (CDN) | Bản CDN (1 `<link>` + 1 `<script>`) | **Tailwind CSS v4** (CLI cho production, Browser CDN để dựng nhanh) |
15
+
16
+ Xem [Dùng với Next.js + Tailwind](#dùng-với-nextjs--tailwind) và [HTML tĩnh (CDN)](#html-tĩnh-cdn).
17
17
 
18
18
  ## Cài đặt
19
19
 
@@ -21,98 +21,166 @@ Xem [Cài đặt](#cài-đặt), [Utility layout](#utility-layout) và [HTML tĩ
21
21
  pnpm add @finhay-pro/leaf-design-system
22
22
  ```
23
23
 
24
- Khai báo plugin, rồi đặt **đúng một dòng** `@import` ở file CSS gốc. Plugin thay dòng đó bằng
25
- stylesheet đã tree-shake: token + reset + class typography / màu + CSS của component đang dùng
26
- (nhận diện qua named import từ package hoặc class `leaf-*` trong markup) + utility layout có trong
27
- source. Không còn file CSS lẻ nào khác để import.
24
+ ## Import CSS (bắt buộc, làm một lần ở entry của app)
25
+
26
+ Class chỉ đọc `var(--…)`, không tự khai báo giá trị — nên **luôn import `tokens.css` trước**, rồi
27
+ chọn phần class cần dùng.
28
+
29
+ | Import | Nội dung |
30
+ | -------------------------------------------------- | ---------------------------------------------------------------------------------------- |
31
+ | `@finhay-pro/leaf-design-system/tokens.css` | Chỉ token (primitive + semantic màu + typography), không class. |
32
+ | `@finhay-pro/leaf-design-system/typography.css` | Chỉ class typography. |
33
+ | `@finhay-pro/leaf-design-system/color.css` | Chỉ class color. |
34
+ | `@finhay-pro/leaf-design-system/button.css` | Style của component `Button`. |
35
+ | `@finhay-pro/leaf-design-system/tabs.css` | Style của component `Tabs`. |
36
+ | `@finhay-pro/leaf-design-system/dialog.css` | Style của component `Dialog`. |
37
+ | `@finhay-pro/leaf-design-system/logo.css` | Style của component `Logo`. |
38
+ | `@finhay-pro/leaf-design-system/logo-assets.css` | SVG data-URI cho Logo HTML tĩnh — không nằm trong `classes.css` / `styles.css`. |
39
+ | `@finhay-pro/leaf-design-system/skeleton.css` | Style của component `Skeleton`. |
40
+ | `@finhay-pro/leaf-design-system/empty.css` | Style của component `Empty`. |
41
+ | `@finhay-pro/leaf-design-system/qr-code.css` | Style của component `QrCode`. |
42
+ | `@finhay-pro/leaf-design-system/carousel.css` | Style của component `Carousel`. |
43
+ | `@finhay-pro/leaf-design-system/spinner.css` | Style của component `Spinner`. |
44
+ | `@finhay-pro/leaf-design-system/toggle.css` | Style của component `Toggle`. |
45
+ | `@finhay-pro/leaf-design-system/slider.css` | Style của component `Slider`. |
46
+ | `@finhay-pro/leaf-design-system/tooltip.css` | Style của component `Tooltip`. |
47
+ | `@finhay-pro/leaf-design-system/radio.css` | Style của component `Radio` / `RadioGroup`. |
48
+ | `@finhay-pro/leaf-design-system/checkbox.css` | Style của component `Checkbox`. |
49
+ | `@finhay-pro/leaf-design-system/input.css` | Style của component `Input` (field / inline, dùng chung cho `InputDate`). |
50
+ | `@finhay-pro/leaf-design-system/input-otp.css` | Style của component `InputOtp`. |
51
+ | `@finhay-pro/leaf-design-system/input-stepper.css` | Style của component `InputStepper`. |
52
+ | `@finhay-pro/leaf-design-system/calendar.css` | Style của component `Calendar` (cần kèm `button.css` + `color.css`). |
53
+ | `@finhay-pro/leaf-design-system/input-date.css` | Popover của `InputDate` (kèm `input.css` + `calendar.css` + `button.css` + `color.css`). |
54
+ | `@finhay-pro/leaf-design-system/toast.css` | Style của `Toaster` / `ToastContent`. |
55
+ | `@finhay-pro/leaf-design-system/dropdown.css` | Style của component `Dropdown`. |
56
+ | `@finhay-pro/leaf-design-system/file-viewer.css` | Style của `FileViewer` (kèm `button.css` + `spinner.css` + `empty.css`). |
57
+ | `@finhay-pro/leaf-design-system/number.css` | Style của `Number`. |
58
+ | `@finhay-pro/leaf-design-system/date.css` | Style của `Date`. |
59
+ | `@finhay-pro/leaf-design-system/focus.css` | Tắt outline khi focus bằng chuột cho component Leaf. |
60
+ | `@finhay-pro/leaf-design-system/textarea.css` | Style của `Textarea`. |
61
+ | `@finhay-pro/leaf-design-system/upload.css` | Style của `Upload`. |
62
+ | `@finhay-pro/leaf-design-system/multiselect.css` | Style của `MultiSelect` (kèm `dropdown.css`). |
63
+ | `@finhay-pro/leaf-design-system/form.css` | Layout của `Form`. |
64
+ | `@finhay-pro/leaf-design-system/table.css` | Style của `Table` (kèm `checkbox.css` khi `selectable`, `skeleton.css` khi loading). |
65
+ | `@finhay-pro/leaf-design-system/popover.css` | `Popover` + khung nổi `.leaf-floating`. |
66
+ | `@finhay-pro/leaf-design-system/menu.css` | `Menu` + khung nổi `.leaf-floating`. |
67
+ | `@finhay-pro/leaf-design-system/pagination.css` | `Pagination` (kèm `dropdown.css` khi có `pageSizeOptions`). |
68
+ | `@finhay-pro/leaf-design-system/virtual-list.css` | `VirtualList`. |
69
+ | `@finhay-pro/leaf-design-system/badge.css` | `Badge` / `Tag`. |
70
+ | `@finhay-pro/leaf-design-system/progress.css` | `Progress`. |
71
+ | `@finhay-pro/leaf-design-system/accordion.css` | `Accordion` / `Collapsible`. |
72
+ | `@finhay-pro/leaf-design-system/breadcrumb.css` | `Breadcrumb` (kèm `menu.css` khi `maxItems`). |
73
+ | `@finhay-pro/leaf-design-system/avatar.css` | `Avatar` / `AvatarGroup`. |
74
+ | `@finhay-pro/leaf-design-system/steps.css` | `Steps`. |
75
+ | `@finhay-pro/leaf-design-system/sidebar.css` | `Sidebar` (kèm `tooltip.css` khi thu gọn). |
76
+ | `@finhay-pro/leaf-design-system/classes.css` | Tất cả class + component, không token. |
77
+ | `@finhay-pro/leaf-design-system/styles.css` | Token + tất cả class + component. Một dòng là đủ. |
78
+
79
+ Import bằng CSS:
28
80
 
29
81
  ```css
30
- /* app/globals.css (Next.js) · src/index.css (Vite) */
31
- @import "@finhay-pro/leaf-design-system/css";
82
+ /* 1. Token — luôn đứng đầu */
83
+ @import "@finhay-pro/leaf-design-system/tokens.css";
84
+
85
+ /* 2. Class typography + màu */
86
+ @import "@finhay-pro/leaf-design-system/typography.css";
87
+ @import "@finhay-pro/leaf-design-system/color.css";
88
+
89
+ /* 3. Component nào dùng thì import cái đó */
90
+ @import "@finhay-pro/leaf-design-system/button.css";
91
+ @import "@finhay-pro/leaf-design-system/tabs.css";
92
+ @import "@finhay-pro/leaf-design-system/dialog.css";
93
+ @import "@finhay-pro/leaf-design-system/logo.css";
94
+ @import "@finhay-pro/leaf-design-system/skeleton.css";
95
+ @import "@finhay-pro/leaf-design-system/empty.css";
96
+ @import "@finhay-pro/leaf-design-system/qr-code.css";
97
+ @import "@finhay-pro/leaf-design-system/carousel.css";
98
+ @import "@finhay-pro/leaf-design-system/spinner.css";
99
+ @import "@finhay-pro/leaf-design-system/toggle.css";
100
+ @import "@finhay-pro/leaf-design-system/slider.css";
101
+ @import "@finhay-pro/leaf-design-system/tooltip.css";
102
+ @import "@finhay-pro/leaf-design-system/radio.css";
103
+ @import "@finhay-pro/leaf-design-system/checkbox.css";
104
+ @import "@finhay-pro/leaf-design-system/input.css";
105
+ @import "@finhay-pro/leaf-design-system/input-otp.css";
106
+ @import "@finhay-pro/leaf-design-system/input-stepper.css";
107
+ @import "@finhay-pro/leaf-design-system/calendar.css";
108
+ @import "@finhay-pro/leaf-design-system/input-date.css";
109
+ @import "@finhay-pro/leaf-design-system/toast.css";
110
+ @import "@finhay-pro/leaf-design-system/dropdown.css";
111
+ @import "@finhay-pro/leaf-design-system/file-viewer.css";
112
+ @import "@finhay-pro/leaf-design-system/number.css";
113
+ @import "@finhay-pro/leaf-design-system/date.css";
114
+ @import "@finhay-pro/leaf-design-system/focus.css";
115
+ @import "@finhay-pro/leaf-design-system/textarea.css";
116
+ @import "@finhay-pro/leaf-design-system/upload.css";
117
+ @import "@finhay-pro/leaf-design-system/multiselect.css";
118
+ @import "@finhay-pro/leaf-design-system/form.css";
119
+ @import "@finhay-pro/leaf-design-system/table.css";
120
+ @import "@finhay-pro/leaf-design-system/popover.css";
121
+ @import "@finhay-pro/leaf-design-system/menu.css";
122
+ @import "@finhay-pro/leaf-design-system/pagination.css";
123
+ @import "@finhay-pro/leaf-design-system/virtual-list.css";
124
+ @import "@finhay-pro/leaf-design-system/badge.css";
125
+ @import "@finhay-pro/leaf-design-system/progress.css";
126
+ @import "@finhay-pro/leaf-design-system/accordion.css";
127
+ @import "@finhay-pro/leaf-design-system/breadcrumb.css";
128
+ @import "@finhay-pro/leaf-design-system/avatar.css";
129
+ @import "@finhay-pro/leaf-design-system/steps.css";
130
+ @import "@finhay-pro/leaf-design-system/sidebar.css";
32
131
  ```
33
132
 
34
- Next.js — `postcss.config.mjs`:
133
+ Muốn gọn thì một dòng `@import "@finhay-pro/leaf-design-system/styles.css";` thay cho cả khối trên.
35
134
 
36
- ```js
37
- export default {
38
- plugins: { "@finhay-pro/leaf-design-system/postcss": {} },
39
- };
40
- ```
135
+ CSS của component **tự đủ** về layout (display, flex, gap, padding, radius, viền…): chỉ cần
136
+ `tokens.css` + `typography.css` + CSS của component là component hiển thị đúng. Riêng `Calendar`
137
+ gắn thêm class màu (`bg-secondary`, `border-tertiary`…) nên cần cả `color.css`. App đang giữ bộ màu
138
+ riêng có thể bỏ `color.css` (trừ khi dùng `Calendar`).
41
139
 
42
- Vite — `vite.config.ts` (file CSS chứa `@import` được import từ `src/main.tsx`):
140
+ ## Dùng với Next.js + Tailwind
43
141
 
44
- ```ts
45
- import leaf from "@finhay-pro/leaf-design-system/vite";
46
- import react from "@vitejs/plugin-react";
47
- import { defineConfig } from "vite";
142
+ Leaf lo token, typography, màu và component; Tailwind CSS v4 lo layout, spacing, radius, độ dày
143
+ viền, responsive và state (`hover:`, `md:`…). Cấu hình mẫu trong `globals.css` (site docs
144
+ `apps/docs` dùng đúng cấu hình này):
48
145
 
49
- export default defineConfig({ plugins: [react(), leaf()] });
50
- ```
51
-
52
- HTML tĩnh không bundler — file input chứa cùng dòng `@import`:
146
+ ```css
147
+ @layer theme, base, components, utilities;
53
148
 
54
- ```bash
55
- npx leaf-css -i src/input.css -o dist/leaf.css [--watch] [--minify]
56
- ```
149
+ /* Leaf trước Tailwind utilities → class Tailwind override được class màu Leaf khi cần */
150
+ @import "@finhay-pro/leaf-design-system/styles.css";
151
+ @import "tailwindcss";
57
152
 
58
- Engine tự quét source từ gốc project (CLI: thư mục chạy lệnh), bỏ qua file trong `.gitignore`.
59
- **Không có cấu hình**: `@theme`, `@utility`, `@variant`, `@custom-variant`, `@plugin`, `@config`,
60
- `@apply`, `@source`, `@import "tailwindcss"` trong CSS của app → build báo lỗi.
61
-
62
- ## Utility layout
63
-
64
- Cú pháp kiểu Tailwind v4, luật của Leaf (trang docs **Layout utilities** có đủ chi tiết):
65
-
66
- - **Đơn vị luôn là px.** `rem` / `em` trong giá trị tuỳ ý bị chặn.
67
- - **Không có thang số** cho padding, margin, gap, space, w / h / size, min / max, basis, inset /
68
- top / left…, translate, indent, scroll-m / p, border-spacing — chỉ nhận px tuỳ ý: `p-[16px]`,
69
- `gap-[24px]`, `-mt-[4px]`, `w-[300px]`, `max-w-[448px]`. Từ khoá vẫn dùng: `0`, `px`, `auto`,
70
- `full`, `screen`, `dvh` / `svh` / `lvh`, `min` / `max` / `fit`, phân số `w-1/2`.
71
- - **Thang có tên giữ lại (quy ra px):** `rounded-sm` (4px) / `md` (6) / `lg` (8) / `xl` (12) /
72
- `2xl` (16) / `full`, `border` / `border-2`, `shadow-*`, `blur-*`, `opacity-N`, `z-N`,
73
- `duration-N`, `grid-cols-N`, `order-N`, `line-clamp-N`, `aspect-*`.
74
- - **Breakpoint:** `xs:` ≤ 767px (max-width), `sm:` ≥ 768, `md:` ≥ 1024, `lg:` ≥ 1280, `xl:` ≥ 1600,
75
- `2xl:` ≥ 1920; kèm `max-sm:`…, `min-[640px]:`, `max-[..]:`, container query `@container` +
76
- `@sm:`….
77
- - **Variant:** `hover:` (`:hover` thuần), `focus:`, `focus-visible:`, `active:`, `disabled:`,
78
- `group-*`, `peer-*`, `has-*`, `not-*`, `in-*`, `aria-*`, `data-*`, `first:` / `last:` / `odd:` /
79
- `even:`, `before:` / `after:`, `placeholder:`, `*:`, selector tuỳ ý `[&>svg]:`, `!` important.
80
- Không có `dark:` / `light:` — theme đi theo token + `data-theme`.
81
- - **Chữ và màu chỉ từ class Leaf** (`display-*`, `heading-*`, `body-*`, `body-*-highlight`,
82
- `text-*`, `bg-*`, `border-*`). Không có `font-*`, `text-sm`, `leading-*`, `tracking-*`,
83
- `italic`, palette (`bg-red-500`, `text-white`), màu tuỳ ý (`bg-[#fff]`), cú pháp `(--biến)`,
84
- utility SVG `fill-*` / `stroke-*`. Class Leaf nhận variant và độ mờ: `md:heading-1`,
85
- `hover:bg-tertiary`, `bg-primary/50`, `placeholder:text-tertiary`. Utility khác cần màu nhận hậu
86
- tố Leaf: `ring-*` / `outline-*` / `divide-*` / `shadow-*` / `from-*` / `via-*` / `to-*` theo
87
- thang nền, `decoration-*` / `accent-*` / `caret-*` theo thang chữ.
88
-
89
- Class không hợp luật không sinh CSS; plugin / CLI in cảnh báo kèm gợi ý:
90
-
91
- ```text
92
- [leaf-css] `m-4`: Leaf không có thang số cho `m-*` — ghi giá trị px: `m-[16px]`
153
+ /* Màu và cỡ chữ chỉ lấy từ Leaf — tắt palette và thang font-size của Tailwind */
154
+ @theme {
155
+ --color-*: initial;
156
+ --text-*: initial;
157
+ }
93
158
  ```
94
159
 
95
160
  ```tsx
96
- import { Button } from "@finhay-pro/leaf-design-system";
161
+ import { Button } from "@finhay-pro/leaf-design-system/components";
97
162
 
98
- <section className="bg-secondary border-quaternary flex flex-col gap-[12px] rounded-xl border p-[16px] md:p-[24px]">
99
- <h3 className="heading-3 md:heading-2 text-primary">Tích luỹ</h3>
100
- <p className="body-4 text-secondary hover:text-highlight">Lợi nhuận 8.5%/năm</p>
163
+ <section className="bg-secondary border-quaternary flex flex-col gap-3 rounded-xl border p-4 md:p-6">
164
+ <h3 className="heading-3 text-primary">Tích luỹ</h3>
165
+ <p className="body-4 text-secondary hover:text-(color:--text-highlight)">Lợi nhuận 8.5%/năm</p>
101
166
  <div className="w-full md:w-auto">
102
167
  <Button width="100%">Đầu tư</Button>
103
168
  </div>
104
169
  </section>;
105
170
  ```
106
171
 
107
- Thang Figma quy ra utility:
172
+ - Class typography / màu Leaf giữ nguyên tên (`body-3`, `text-secondary`, `bg-secondary`,
173
+ `border-quaternary`…). Giá trị lẻ dùng token qua cú pháp biến của Tailwind:
174
+ `bg-(--base-tertiary)`, `text-(color:--text-highlight)`.
175
+ - Spacing / radius / độ dày viền dùng thang của Tailwind (base 4px). Thang px theo Figma:
108
176
 
109
- | Figma | px | Utility |
110
- | ----------------- | -------------------------------------------------------- | ----------------------------------------------------------- |
111
- | Spacing 2XS…7XL | 2 · 4 · 8 · 12 · 16 · 24 · 36 · 48 · 60 · 84 · 120 · 240 | `p-[2px]` … `p-[240px]` (`gap-[12px]`, `mt-[8px]`…) |
112
- | Radius S/M/L/Full | 4 · 8 · 12 · full | `rounded-sm` / `rounded-lg` / `rounded-xl` / `rounded-full` |
113
- | Border S/M/L/XL | 0.5 · 1 · 1.5 · 2 | `border-[0.5px]` / `border` / `border-[1.5px]` / `border-2` |
177
+ | Figma | px | Tailwind |
178
+ | ----------------- | -------------------------------------------------------- | ------------------------------------------------------------------------ |
179
+ | Spacing 2XS…7XL | 2 · 4 · 8 · 12 · 16 · 24 · 36 · 48 · 60 · 84 · 120 · 240 | `0.5` `1` `2` `3` `4` `6` `9` `12` `15` `21` `30` `60` (`p-4`, `gap-3`…) |
180
+ | Radius S/M/L/Full | 4 · 8 · 12 · full | `rounded-sm` / `rounded-lg` / `rounded-xl` / `rounded-full` |
181
+ | Border S/M/L/XL | 0.5 · 1 · 1.5 · 2 | `border-[0.5px]` / `border` / `border-[1.5px]` / `border-2` |
114
182
 
115
- - Component React **không nhận `className`**. Layout / spacing: bọc `div` dùng utility. Màu / chữ:
183
+ - Component React **không nhận `className`**. Layout / spacing: bọc `div` Tailwind. Màu / chữ:
116
184
  prop token (`color`, `background`, `typography`). Size: prop `width` / `height` nếu component
117
185
  có. HTML tĩnh gắn class Leaf (`text-*`, `bg-*`) trên markup `.leaf-*`.
118
186
 
@@ -162,8 +230,8 @@ truyền `className` vào component Leaf (dùng prop token / bọc `div`):
162
230
  ```tsx
163
231
  <h2 className="heading-2">Tài sản của bạn</h2>
164
232
 
165
- // Class typography lo cỡ chữ, color lo màu; khoảng cách là utility (`mt-[8px]`)
166
- <p className="body-3 text-secondary mt-[8px]">Lợi nhuận kỳ vọng 8.5%/năm</p>
233
+ // Class typography lo cỡ chữ, color lo màu; khoảng cách là của app (Tailwind `mt-2`)
234
+ <p className="body-3 text-secondary mt-2">Lợi nhuận kỳ vọng 8.5%/năm</p>
167
235
 
168
236
  // Gắn vào component của thư viện khác cũng chỉ là một chuỗi class
169
237
  <Link href="/tai-khoan" className="body-3-highlight">
@@ -188,8 +256,8 @@ viết thêm gì cho light mode.
188
256
  | System (đủ 3 bộ) | `text-*`, `bg-*`, `border-*` với `red`, `green`, `yellow`, `orange`, `blue`, `purple` (+ `-secondary`) |
189
257
 
190
258
  ```html
191
- <!-- Viền: class màu chỉ set border-color — độ dày / padding là utility -->
192
- <div class="bg-secondary border-quaternary rounded-xl border p-[16px]">
259
+ <!-- Viền: class màu chỉ set border-color — độ dày / padding / radius do Tailwind -->
260
+ <div class="bg-secondary border-quaternary rounded-xl border p-4">
193
261
  <h3 class="heading-3 text-primary">Tích luỹ</h3>
194
262
  <p class="body-4 text-secondary">Lợi nhuận kỳ vọng 8.5%/năm</p>
195
263
  <p class="body-4 text-red">Số dư không đủ</p>
@@ -211,7 +279,7 @@ pnpm add @remixicon/react
211
279
  ```
212
280
 
213
281
  ```tsx
214
- import { Button } from "@finhay-pro/leaf-design-system";
282
+ import { Button } from "@finhay-pro/leaf-design-system/components";
215
283
  import { RiAddLine, RiHomeLine } from "@remixicon/react";
216
284
 
217
285
  <RiHomeLine size={24} />
@@ -221,7 +289,12 @@ import { RiAddLine, RiHomeLine } from "@remixicon/react";
221
289
 
222
290
  ```html
223
291
  <!-- HTML tĩnh: font CSS của Remix, size theo font-size, màu theo color -->
224
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@4.9.1/fonts/remixicon.css" />
292
+ <link
293
+ rel="stylesheet"
294
+ href="https://cdn.jsdelivr.net/npm/remixicon@4.9.1/fonts/remixicon.css"
295
+ integrity="sha384-K8MyQheOpUlTMhpk/Rxz4Rtn4VxtjdRLpEhsT/cdBJZeu9Q+2PxLoSpvgvkSwrR2"
296
+ crossorigin="anonymous"
297
+ />
225
298
  <i class="ri-home-line text-secondary"></i>
226
299
  ```
227
300
 
@@ -230,45 +303,52 @@ Không dùng thư viện icon khác hay tự vẽ SVG icon. Icons by [Remix Icon
230
303
 
231
304
  ## Cần biết
232
305
 
306
+ - **CSP tối thiểu.** Component không cần `'unsafe-eval'` và không dùng HTML string nên hợp với
307
+ `require-trusted-types-for 'script'`. Cần thêm tuỳ tính năng dùng:
308
+ `style-src 'unsafe-inline'` (style động, runtime leaf.js) · File Viewer: `frame-src blob:`,
309
+ `img-src blob:`, `media-src blob:`, `connect-src <origin file>` · `<Empty image="">`,
310
+ `LanguageDropdown`: `img-src https://cdn1.finhay.com.vn`.
233
311
  - **Class typography chỉ set đúng 3 thuộc tính** (`font-size`, `line-height`, `font-weight`);
234
- **class color chỉ set đúng 1** (`color` / `background-color` / `border-color`). Font family nằm
235
- ngoài phạm vi — app tự set `body { font-family: var(--font-sans) }`. Reset tối thiểu
236
- (box-sizing, margin, list, form control) có sẵn trong `@layer base`.
237
- - Leaf **không** có token spacing / radius / độ dày viền — chỉ có token màu và typography; layout
238
- dùng utility px.
239
- - **Thứ tự layer cố định:** stylesheet sinh ra mở đầu bằng
240
- `@layer properties, theme, base, components, utilities;`. Typography và CSS component nằm trong
241
- `@layer components`; class màu và utility nằm trong `@layer utilities` (đè được CSS component, vd.
242
- `leaf-spinner text-highlight`). CSS không layer của app override được tất cả, không cần
243
- `!important`. Component không trông vào CSS reset: tự reset `button`, tự xử lý `[hidden]`.
312
+ **class color chỉ set đúng 1** (`color` / `background-color` / `border-color`). Font family,
313
+ letter spacing… nằm ngoài phạm vi — app tự setup ở tầng global
314
+ (`body { font-family: var(--font-sans) }`; CSS reset là preflight của Tailwind).
315
+ - **Leaf không có class layout / spacing / radius / border width / responsive.** Mọi app (React,
316
+ Next.js, HTML tĩnh) dùng Tailwind. Leaf cũng **không** có token spacing / radius / độ dày
317
+ viền — chỉ có token màu và typography.
318
+ - **Typography và CSS component nằm trong `@layer components`**; **class màu nằm trong
319
+ `@layer utilities`** (đè được CSS component, vd. `leaf-spinner text-highlight`). Utility của app
320
+ (Tailwind) và CSS không layer (CSS / SCSS module của app) đều override được, không cần
321
+ `!important`.
322
+ - **Mỗi file CSS mở đầu bằng `@layer theme, base, components, utilities;`** — trùng thứ tự layer của
323
+ Tailwind v4, nên import file theo thứ tự nào thì class màu vẫn đứng trên CSS component. Component
324
+ không trông vào CSS reset: tự reset `button`, tự xử lý `[hidden]`.
325
+ - **Class không có biến thể `hover:` / `focus:` / opacity** — nó là CSS thuần. Cần state thì dùng
326
+ Tailwind với token (`hover:text-(color:--text-highlight)`).
244
327
  - **Chỉ semantic token mới có class màu.** Primitive (`--neutral-500`, `--brand-300`…) là nguồn nội
245
- bộ, dùng thẳng trong UI là mất khả năng đổi theme.
246
- - **Tên class không có prefix.** App dùng Leaf cần cân nhắc kỹ nếu load kèm CSS framework khác
247
- (Bootstrap cũng định nghĩa `.display-1`–`.display-6`).
248
- - Typography token hiện chỉ có **bộ Desktop**. Display / heading lớn trên mobile: đặt class nhỏ
249
- làm mặc định rồi đổi theo breakpoint (`heading-2 md:display-3`).
328
+ bộ, dùng thẳng trong UI là mất khả năng đổi theme. Spacing / border-width / radius là thang kích
329
+ thước cố định, không đổi theo theme.
330
+ - **Tên class không có prefix.** Đây là những tên khá phổ thông, nên app dùng Leaf cần cân nhắc kỹ
331
+ nếu load kèm CSS framework khác (Bootstrap cũng định nghĩa `.display-1`–`.display-6`). Với
332
+ Tailwind v4: tắt palette (`--color-*: initial`) để `text-*` / `bg-*` / `border-*` chỉ còn class
333
+ màu của Leaf.
334
+ - Typography token hiện chỉ có **bộ Desktop**. Chưa có responsive type set, nên các style Display
335
+ cần app tự xử lý ở breakpoint nhỏ.
250
336
 
251
337
  ## Phát triển
252
338
 
253
339
  ```bash
254
- pnpm --filter @finhay-pro/leaf-design-system build # tsc → dist/ + gom CSS + engine + CDN + skill
255
- pnpm --filter @finhay-pro/leaf-design-system dev # gom CSS + engine + tsc --watch
340
+ pnpm --filter @finhay-pro/leaf-design-system build # tsc → dist/ + gom CSS + bản CDN
341
+ pnpm --filter @finhay-pro/leaf-design-system dev # gom CSS + tsc --watch
256
342
  pnpm --filter @finhay-pro/leaf-design-system typecheck
257
343
  ```
258
344
 
259
- - `scripts/build-css.mjs` — gom token + reset + class Leaf + CSS từng component thành
260
- `dist/engine/assets.json` (kèm bảng export → CSS component) và `dist/leaf.css` (đích của
261
- `@finhay-pro/leaf-design-system/css`; bản dự phòng không utility).
262
- - `scripts/build-engine.mjs` — bundle engine (`packages/css` = `@finhay/leaf-css`, chỉ `node:*`)
263
- thành `dist/engine/vite.js`, `postcss.js`, `cli.js` (bin `leaf-css`).
264
- - `scripts/build-cdn.mjs` — `dist/cdn/leaf-<version>.min.{css,js}`, minify bằng minifier của engine;
265
- JS = `window.Leaf` + runtime sinh utility từ class trên DOM.
266
-
267
- Không sửa file trong `dist`. Engine có test riêng ở `packages/css/test`.
345
+ CSS trong `dist` được sinh bởi `scripts/build-css.mjs` (mỗi `src/**/*.css` ra một file riêng, nội
346
+ tuyến token vào `tokens.css` / `styles.css`). Sau đó `scripts/build-cdn.mjs` sinh bản CDN
347
+ `dist/cdn/leaf-<version>.min.{css,js}`. Không sửa file trong `dist`.
268
348
 
269
349
  `build` ghi đè `dist` tại chỗ, **không xoá `dist` trước** (chỉ `prepublishOnly` mới `clean`):
270
350
  `turbo run dev` luôn build package trước docs, và nếu `dist` biến mất dù chỉ một lúc thì dev server
271
- của docs lỗi resolve `@finhay-pro/leaf-design-system/css`. Gặp lỗi đó: chạy lại `pnpm dev` (vẫn lỗi
351
+ của docs lỗi resolve `@finhay-pro/leaf-design-system/…css`. Gặp lỗi đó: chạy lại `pnpm dev` (vẫn lỗi
272
352
  thì xoá `apps/docs/node_modules/.vite`).
273
353
 
274
354
  **Mọi hình thức nằm trong CSS** và chỉ đọc attribute (`data-*`, `aria-*`, `:disabled`), kể cả
@@ -279,43 +359,69 @@ tĩnh viết cùng markup là ra cùng kết quả. Attribute thiếu → CSS l
279
359
  `<tên>.css` của component; markup chỉ gắn class `leaf-*` (+ class typography / màu khi cần). Phần tử
280
360
  nào CSS set `display` thì kèm rule `[hidden] { display: none }`.
281
361
 
362
+ Thêm bộ class mới (typography / màu): tạo `src/styles/<tên>.css` — script tự sinh `dist/<tên>.css`
363
+ và gom vào `classes.css` + `styles.css`; chỉ cần thêm một dòng `"./<tên>.css"` vào `exports` của
364
+ `package.json`.
282
365
  Thêm component React (khi thật sự cần state/behavior, không phải để bọc style): tạo
283
366
  `src/components/<Tên>/` (kèm `<tên>.css` nếu cần) rồi re-export trong `src/index.ts`. CSS của
284
- component được `build-css.mjs` tự gom vào `assets.json` và engine tự thêm khi app import component
285
- — không khai báo gì trong `exports`. Tên file CSS phải duy nhất trong cả `src/` (script báo lỗi nếu
286
- trùng).
367
+ component cũng ra `dist/<tên>.css` và được gom vào `classes.css` / `styles.css` — nhớ thêm dòng
368
+ `"./<tên>.css"` vào `exports`. Tên file CSS phải duy nhất trong cả `src/` (script báo lỗi nếu trùng).
287
369
  Component có hành vi (Button loading · Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode · Upload · Calendar · InputDate · MultiSelect · Form) cần thêm bản vanilla cho HTML
288
370
  tĩnh trong `src/vanilla/` và gắn vào `window.Leaf` qua `src/vanilla/index.ts`. `src/vanilla` chỉ
289
371
  vào bản CDN, không vào bản npm.
290
372
 
291
373
  ## Components
292
374
 
293
- | Export | Mô tả |
294
- | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
295
- | `Button` | Khung icon · label · icon — bật/tắt từng phần; `width` / `height`; `onClick` trả Promise → tự loading (spinner thay leading icon, khoá click), `loading` controlled |
296
- | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`); phím ← → Home End |
297
- | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `height` / `maxHeight` |
298
- | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
299
- | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
300
- | `Empty` | Trạng thái không có dữ liệu — `image` (string URL; không truyền = ẩn, `""` = CDN mặc định) · `size` sm/md · `description` (mặc định “Không có dữ liệu”) |
301
- | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
302
- | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
303
- | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
304
- | `Tooltip` | Hover/focus/Escape — `size`, `position`, `align`, `onOpenChange`; `trigger="click"`, `openDelay` / `closeDelay`, tự lật phía khi thiếu chỗ, `theme`; kèm `TooltipContent` |
305
- | `Radio` / `RadioGroup` | Radio đơn + nhóm — `value` / `defaultValue` / `onValueChange`, `name` cho form, `disabled`, `orientation` |
306
- | `Checkbox` | Checkbox — `checked` / `defaultChecked` / `onCheckedChange` (`checked="indeterminate"` cho trạng thái lưng chừng), `label`, `disabled`; input native nên đi thẳng vào `FormData` |
307
- | `Input` | Input dynamic — `variant` field/inline, `shape` default/pill, slot `label` · `leadingIcon` · `trailingIcon` · `action` · `message`, `invalid`, `revealPassword`; `as="button"` làm trigger |
308
- | `InputOtp` | Ô OTP — `length`, `mask`, dán cả mã, `onComplete`; `name` → input ẩn |
309
- | `InputStepper` | Nhập số với −/+ — `tone` buy/sell, `step` / `min` / `max` / `precision`, `locale`, `unit`; phím ↑ ↓, chốt khi blur/Enter |
310
- | `Calendar` | Lịch tháng (port từ vnsc) — chọn ngày / giờ / tháng (`showTime`, `timeOnly`, `monthOnly`), `minDate` / `maxDate` / `disablePast` / `disableFuture` / `disableDate`, luật giờ (`minHour` / `maxHour` / `minuteStep`…), `weekStartsOn`, `labels`; dùng độc lập được |
311
- | `InputDate` | `Input` trigger + popover `Calendar` — `value` chốt khi bấm "Chọn" (hoặc `confirmOnSelect`), `formatDisplay`, `align`, `monthOnly` (MM/YYYY); `name` → input ẩn ISO |
312
- | `Toaster` / `toast` | Toast success / error / warning — `toast.success(title, { description, duration })`, `duration: -1` không tự đóng, dừng khi hover / focus, `toast.dismiss(id)`; `<Toaster position closeLabel theme />` đặt một lần; kèm `ToastContent` |
313
- | `Dropdown` | Chọn một giá trị — `variant` list / radio, `trigger` field / text, `appearance` filled / outlined, `size` md / sm, `openOn` click / hover, `align`, `readOnly`, `maxHeight`; option `leading` / `disabled`; phím ↑ ↓ Home End + typeahead |
314
- | `FileViewer` | Xem file (PDF native, XLSX / CSV, DOCX, ảnh, video / audio, text) không thư viện ngoài — `source` URL (+`fetchInit`) / Blob / base64, toolbar, `ref`; kèm `FileViewerDialog` |
315
- | `LanguageDropdown` | Chọn ngôn ngữ Tiếng Việt / English kèm cờ (CDN Finhay) — danh sách ở `LEAF_LANGUAGES`, `value` kiểu `LeafLanguageCode`; mặc định `size="sm"`, `openOn="hover"`, `align="end"` |
316
-
317
- CSS của component không cần import riêng: plugin Leaf tự thêm CSS của component được import (kèm
318
- component nó dùng bên trong, vd. `InputDate` → `Input` + `Calendar` + `Button`).
375
+ | Export | Mô tả |
376
+ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
377
+ | `Button` | Khung icon · label · icon — bật/tắt từng phần; `width` / `height`; `onClick` trả Promise → tự loading (spinner thay leading icon, khoá click), `loading` controlled |
378
+ | `Tabs` | Tabs Items — `items[]` (`value` · `label: ReactNode` · `disabled`), `fit`; phím ← → Home End |
379
+ | `Dialog` | Panel + backdrop blur — `open` (controlled), `title` / `onBack` / `onClose(reason)`, `dismissible`, `closeLabel` / `backLabel`, `theme`, `maxWidth` / `height` / `maxHeight`, `backgroundGradient` |
380
+ | `Logo` | Wordmark FHSC · Finhay · FHC — `brand` / `mode` / `side` / `size` |
381
+ | `Skeleton` | Placeholder shimmer — `width` / `height` / `border` (radius), nền `--base-tertiary` |
382
+ | `Empty` | Trạng thái không có dữ liệu — `image` (string URL; không truyền = ẩn, `""` = CDN mặc định) · `size` sm/md · `description` (mặc định “Không có dữ liệu”) |
383
+ | `Spinner` | Indicator 8 nan — `animation` (`spin` · `fade` · `pulse` · `breathe`), `size` |
384
+ | `Toggle` | Công tắc On/Off — `size` md/sm, `checked`, `disabled` (Figma Active Off); `name` / `value` → input ẩn cho form |
385
+ | `Slider` | Kéo từng `step` trong `min`–`max` (mặc định 0–100, bước 1) · mốc `steps` · `labels`; `name` → input ẩn |
386
+ | `Tooltip` | Hover/focus/Escape — `size`, `position`, `align`, `onOpenChange`; `trigger="click"`, `openDelay` / `closeDelay`, tự lật phía khi thiếu chỗ, `theme`; kèm `TooltipContent` |
387
+ | `Radio` / `RadioGroup` | Radio đơn + nhóm — `value` / `defaultValue` / `onValueChange`, `name` cho form, `disabled`, `orientation` |
388
+ | `Checkbox` | Checkbox — `checked` / `defaultChecked` / `onCheckedChange` (`checked="indeterminate"` cho trạng thái lưng chừng), `label`, `disabled`; input native nên đi thẳng vào `FormData` |
389
+ | `Input` | Input dynamic — `variant` field/inline, `shape` default/pill, slot `label` · `leadingIcon` · `trailingIcon` · `action` · `message`, `invalid`, `revealPassword`; `as="button"` làm trigger |
390
+ | `InputOtp` | Ô OTP — `length`, `mask`, dán cả mã, `onComplete`; `name` → input ẩn |
391
+ | `InputStepper` | Nhập số với −/+ — `tone` buy/sell, `step` / `min` / `max` / `precision`, `locale`, `unit`; phím ↑ ↓, chốt khi blur/Enter |
392
+ | `Calendar` | Lịch tháng (port từ vnsc) — chọn ngày / giờ / tháng (`showTime`, `timeOnly`, `monthOnly`), `minDate` / `maxDate` / `disablePast` / `disableFuture` / `disableDate`, luật giờ (`minHour` / `maxHour` / `minuteStep`…), `weekStartsOn`, `labels`; dùng độc lập được |
393
+ | `InputDate` | `Input` trigger + popover `Calendar` — `value` chốt khi bấm "Chọn" (hoặc `confirmOnSelect`), `formatDisplay`, `align`, `monthOnly` (MM/YYYY); `name` → input ẩn ISO |
394
+ | `Toaster` / `toast` | Toast info / success / error / warning — `toast.success(title, { description, duration, action })`, `duration: -1` không tự đóng, dừng khi hover / focus, `toast.dismiss(id)`; `<Toaster position closeLabel theme />` đặt một lần; kèm `ToastContent` |
395
+ | `Popover` / `PopoverContent` | Panel nổi non-modal neo trigger (bộ lọc nhanh, chi tiết) — portal, tự lật, `openOn` click / hover |
396
+ | `Menu` / `MenuContent` | Menu hành động (nút “…”, context menu chuột phải / giữ lâu) — `items`, `onSelect`, bàn phím đầy đủ |
397
+ | `Drawer` | Side panel / bottom sheet (kéo xuống để đóng) — `Dialog` với `placement`; Dialog có thêm `mobileLayout` `fullscreen` / `sheet` |
398
+ | `Pagination` | Thanh phân trang — dải trang có “…”, trước / sau, `pageSizeOptions`, `variant="simple"` cho mobile; ghép `Table pageSize page` |
399
+ | `VirtualList` | Danh sách dài chỉ render vùng nhìn (JS thuần) — `itemHeight` hoặc đo thật, `scrollSource`, `onEndReached`, `loadingMore`; thay `@tanstack/react-virtual` |
400
+ | `InputDateRange` / `CalendarRange` | Chọn khoảng ngày từ – đến trong một panel — preset, `maxRangeDays`, popover portal |
401
+ | `InputNumber` | Ô số có phân cách nghìn khi gõ (giữ con trỏ), `decimals`, `allowNegative`, `min` / `max` khi blur; `InputStepper formatOnType` |
402
+ | `Badge` / `Tag` | Nhãn trạng thái (`status` dùng chung bảng màu Toast), badge số, chip xoá được |
403
+ | `Progress` | Thanh / vòng tiến độ, indeterminate — chỉ CSS |
404
+ | `Accordion` / `Collapsible` | Nhóm mục mở / đóng (single / multiple), bàn phím ↑ ↓ Home End |
405
+ | `Breadcrumb` | Đường dẫn phân cấp, `maxItems` dồn vào Menu "…", `renderLink` |
406
+ | `Avatar` / `AvatarGroup` | Ảnh / chữ cái đầu / icon, chấm trạng thái, nhóm +N |
407
+ | `Steps` | Các bước của luồng (complete / current / upcoming / error), quay lại bước đã xong, gọn trên mobile |
408
+ | `Sidebar` | Điều hướng trái của app: nhóm con, badge, thu gọn còn icon (Tooltip), `renderLink` |
409
+ | `Dropdown` | Chọn một giá trị — `variant` list / radio, `trigger` field / text, `appearance` filled / outlined, `size` md / sm, `openOn` click / hover, `align`, `readOnly`, `maxHeight`; option `leading` / `disabled`; phím ↑ ↓ Home End + typeahead |
410
+ | `FileViewer` | Xem file (PDF native, XLSX / CSV, DOCX, ảnh, video / audio, text) không thư viện ngoài — `source` URL (+`fetchInit`) / Blob / base64, toolbar, `ref`; kèm `FileViewerDialog` |
411
+ | `LanguageDropdown` | Chọn ngôn ngữ Tiếng Việt / English kèm cờ (CDN Finhay) — danh sách ở `LEAF_LANGUAGES`, `value` kiểu `LeafLanguageCode`; mặc định `size="sm"`, `openOn="hover"`, `align="end"` |
412
+
413
+ ```css
414
+ /* Ngoài tokens.css + typography.css, mỗi component cần CSS riêng của nó
415
+ (bảng đầy đủ ở mục Import CSS) — hoặc một dòng styles.css cho tất cả */
416
+ @import "@finhay-pro/leaf-design-system/button.css";
417
+ @import "@finhay-pro/leaf-design-system/tabs.css";
418
+ @import "@finhay-pro/leaf-design-system/dialog.css";
419
+ @import "@finhay-pro/leaf-design-system/toast.css";
420
+ @import "@finhay-pro/leaf-design-system/input.css";
421
+ @import "@finhay-pro/leaf-design-system/dropdown.css";
422
+ /* … skeleton / empty / spinner / toggle / slider / tooltip / radio / checkbox / input-otp /
423
+ input-stepper / calendar / input-date / logo */
424
+ ```
319
425
 
320
426
  ```tsx
321
427
  import {
@@ -341,7 +447,7 @@ import {
341
447
  LanguageDropdown,
342
448
  Toaster,
343
449
  toast,
344
- } from "@finhay-pro/leaf-design-system";
450
+ } from "@finhay-pro/leaf-design-system/components";
345
451
  import { RiAddLine, RiArrowRightLine } from "@remixicon/react";
346
452
 
347
453
  <Button priority="primary" size="md" leadingIcon={<RiAddLine />} trailingIcon={<RiArrowRightLine />}>
@@ -374,6 +480,54 @@ import { RiAddLine, RiArrowRightLine } from "@remixicon/react";
374
480
  toast.success("Đặt lệnh thành công", { description: "Mua 100 AAA" });
375
481
  ```
376
482
 
483
+ ## Hooks, utils & server (import riêng)
484
+
485
+ UI component, hook và hàm thuần là **ba import khác nhau** (thêm một entry cho server). Entry UI
486
+ không re-export hook / util; mỗi hook / hàm là một module riêng nên import gì tải nấy
487
+ (`test/build/tree-shaking.test.ts` bundle thử bằng esbuild: `debounce` ≈ 0,5 KB, `useDebouncedValue`
488
+ ≈ 1 KB, `jsonResponse` ≈ 0,2 KB — không kéo component).
489
+
490
+ | Import | Chứa | Môi trường |
491
+ | ------------------------------------------- | -------------------------------------------------------------------------------------- | ----------------------- |
492
+ | `@finhay-pro/leaf-design-system/components` | UI component (entry gốc `@finhay-pro/leaf-design-system` chỉ là alias tương thích) | client |
493
+ | `@finhay-pro/leaf-design-system/hooks` | 39 hook: gọi API, pacer, timer, DOM / trình duyệt, state | client (`"use client"`) |
494
+ | `@finhay-pro/leaf-design-system/utils` | hàm thuần: retry / timeout, pacer, chuỗi tiếng Việt, URL an toàn, sanitize, định dạng… | server + client |
495
+ | `@finhay-pro/leaf-design-system/server` | route handler: `jsonResponse`, `readBody`, `createRateLimiter`, `timingSafeEqual`… | server |
496
+
497
+ ```tsx
498
+ import { Button } from "@finhay-pro/leaf-design-system/components";
499
+ import { useDebouncedValue } from "@finhay-pro/leaf-design-system/hooks";
500
+ import { formatNumber, isSafeRelativePath } from "@finhay-pro/leaf-design-system/utils";
501
+ import { jsonResponse } from "@finhay-pro/leaf-design-system/server";
502
+ ```
503
+
504
+ - **Tiêu chí:** chỉ ship khái niệm mọi app đều cần (gọi API, hẹn giờ, event, layout, storage, an
505
+ toàn URL / HTML) với API ổn định khi logic app đổi. **Không** ship hàm kiểu lodash (`pick`,
506
+ `get`, `groupBy`, `clamp`, `cx`, id…) — dùng JS native (bảng đổi ở `references/utils.md`).
507
+ - **Peer React 19:** app còn React 18 (`vnsc-backoffice-ui`, `finhay-fe-nextjs`, `vnsc-webview`)
508
+ nâng React trước khi dùng các entry này.
509
+ - **Thay `@tanstack/react-pacer`:** `useDebouncer(fn, { wait }).maybeExecute()` →
510
+ `const run = useDebouncedCallback(fn, wait); run()`; `useThrottler` → `useThrottledCallback`;
511
+ `useBatcher` giữ tên. Hàm thuần `debounce` / `throttle` / `createBatcher` ở `/utils`.
512
+ - **Hàm định dạng** (`formatDate`, `formatNumber`, helper ngày, file…) nên import từ `/utils` (chạy
513
+ trong Server Component không đi qua entry UI). Entry chính vẫn giữ để không phá app đang dùng.
514
+ - **Import sâu (tuỳ chọn):** `@finhay-pro/leaf-design-system/hooks/useCountdown`,
515
+ `@finhay-pro/leaf-design-system/utils/url`. Next.js nên khai báo
516
+ `experimental.optimizePackageImports` cho cả ba entry.
517
+ - HTML không tin cậy (CMS, API): `sanitizeHtml` / `parseSafeHtml` / `createSanitizer` (`/utils`)
518
+ và `<SafeHtml>` (`/components`). Sanitizer thuần TS, không cần DOM — server và client ra cùng
519
+ kết quả, thay DOMPurify / isomorphic-dompurify / sanitize-html. Preset `SANITIZE_PRESETS.text |
520
+ inline | rich | embed`; khối `<style>` bài cũ qua `styleBlocks` / `sanitizeCss`; JSON-LD tách
521
+ bằng `jsonLd: "extract"`. Render bằng `<SafeHtml>`, không dùng prop HTML thô của React. Chuỗi
522
+ từ `sanitizeHtml` chỉ đặt trong ngữ cảnh flow (`div`…), không ghép vào `script` / `style` /
523
+ `textarea` / thuộc tính, không decode / sửa sau khi lọc.
524
+ - `decodeEntities` giải mã đúng spec HTML (2.231 entity, giống `he.decode`); kết quả là text.
525
+ - Bản CDN: `window.Leaf.utils` (`debounce`, `throttle`, `createBatcher`, `copyText`, `sanitizeHtml`,
526
+ `escapeHtml`, `normalizeSearch`, `includesText`, `isSafeHttpUrl`, `isSafeRelativePath`,
527
+ `storage.{get, set, remove, getJson, setJson}`).
528
+
529
+ Danh mục đầy đủ: docs nhóm **Function**, skill `references/hooks.md`, `references/utils.md`.
530
+
377
531
  ## Đọc & ghi file (không UI)
378
532
 
379
533
  Đọc / ghi Excel / CSV / text ngay trên trình duyệt, **không thư viện ngoài** (ZIP giải bằng
@@ -396,7 +550,11 @@ gửi header đăng nhập), `Blob` / `File`, `ArrayBuffer` / typed array, hoặ
396
550
  | `FileReadError` | Lỗi có `code`: `invalid-source` · `fetch-failed` · `too-large` · `corrupt` · `encrypted` · `unsupported` · `legacy-format` · `unsupported-browser` · `aborted` |
397
551
 
398
552
  ```ts
399
- import { readSpreadsheet, spreadsheetToCsv, FileReadError } from "@finhay-pro/leaf-design-system";
553
+ import {
554
+ readSpreadsheet,
555
+ spreadsheetToCsv,
556
+ FileReadError,
557
+ } from "@finhay-pro/leaf-design-system/utils";
400
558
 
401
559
  try {
402
560
  const { sheets } = await readSpreadsheet(file); // File từ <Upload> / <input type="file">
@@ -439,37 +597,80 @@ Mở tab mới / Tải xuống).
439
597
 
440
598
  ## HTML tĩnh (CDN)
441
599
 
442
- Cho landing page / trang dựng tay không có bundler: 1 `<link>` + 1 `<script>`. CSS gồm token +
443
- reset + class typography / color + CSS của mọi component. Script gồm hành vi Button loading · Tabs ·
444
- Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode ·
445
- Upload · Calendar · InputDate · MultiSelect · Form (`data-leaf-*` / `window.Leaf`) **và runtime sinh
446
- utility layout** từ class trên DOM (theo dõi DOM thay đổi) — trang dùng cùng utility như app
447
- (`flex`, `gap-[16px]`, `md:grid-cols-3`), không cần CSS riêng cho layout.
600
+ Cho landing page / trang dựng tay không có bundler: **Leaf CDN + Tailwind CSS v4**. 1 `<link>` +
601
+ 1 `<script>` là dùng được toàn bộ class typography, color và mọi component (CSS). Script chỉ cần
602
+ khi dùng hành vi Button loading · Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode · Upload · Calendar · InputDate · MultiSelect · Form (`data-leaf-*` / `window.Leaf`).
603
+ Layout, spacing, responsive, hover dùng Tailwind giống app React.
448
604
 
449
605
  ```html
450
- <link rel="stylesheet" href="https://<cdn>/leaf-0.2.3.min.css" />
451
- <script src="https://<cdn>/leaf-0.2.3.min.js" defer></script>
606
+ <link
607
+ rel="stylesheet"
608
+ href="https://<cdn>/leaf-0.2.5.min.css"
609
+ integrity="sha384-4Y2dKd+qWT/j/vzSqisWr24T93m2BiQ1qwNzq/NE1gr1x0jresCkMQnyOheVweVW"
610
+ crossorigin="anonymous"
611
+ />
612
+ <script
613
+ src="https://<cdn>/leaf-0.2.5.min.js"
614
+ integrity="sha384-3mvnC8gyvSnGroVSMa3oCnAhIgzJBdUeiOiUsDM0vfs+NIANZiLocfYAetDBPb4T"
615
+ crossorigin="anonymous"
616
+ defer
617
+ ></script>
452
618
  <!-- Icon: Remix Icon (xem mục Icon) -->
453
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@4.9.1/fonts/remixicon.css" />
619
+ <link
620
+ rel="stylesheet"
621
+ href="https://cdn.jsdelivr.net/npm/remixicon@4.9.1/fonts/remixicon.css"
622
+ integrity="sha384-K8MyQheOpUlTMhpk/Rxz4Rtn4VxtjdRLpEhsT/cdBJZeu9Q+2PxLoSpvgvkSwrR2"
623
+ crossorigin="anonymous"
624
+ />
454
625
 
455
- <style>
456
- body {
457
- font-family: var(--font-sans);
626
+ <!-- Tailwind — dựng nhanh: Browser CDN ghim version + integrity.
627
+ Production: thay script + style dưới bằng <link> tới CSS build bằng Tailwind CLI. -->
628
+ <script
629
+ src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.3.4/dist/index.global.js"
630
+ integrity="sha384-LhJn7QKq7hHz9EqN//RkaYS9p1ZU3MqAxjeV0JI95iQ5Gol1uz/cQQ+pesz0xum7"
631
+ crossorigin="anonymous"
632
+ ></script>
633
+ <style type="text/tailwindcss">
634
+ /* Màu và cỡ chữ chỉ lấy từ Leaf — tắt palette và thang font-size của Tailwind */
635
+ @theme {
636
+ --color-*: initial;
637
+ --text-*: initial;
458
638
  }
639
+ @custom-variant light (&:where([data-theme="light"], [data-theme="light"] *));
459
640
  </style>
460
641
 
461
- <body class="bg-primary">
462
- <section class="flex flex-col gap-[16px] px-[16px] py-[48px] sm:flex-row">
642
+ <body class="bg-primary text-primary font-(family-name:--font-sans)">
643
+ <section class="flex flex-col gap-4 px-4 py-12 md:flex-row md:items-center">
463
644
  <h1 class="display-3 text-primary">Finhay</h1>
464
645
  <button class="leaf-button" data-size="md">Mở tài khoản</button>
465
646
  </section>
466
647
  </body>
467
648
  ```
468
649
 
469
- | File | Nội dung |
470
- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
471
- | `leaf-<version>.min.css` | Đã minify: token + reset + typography + color + CSS của mọi component. |
472
- | `leaf-<version>.min.js` | Hành vi Button loading · Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode · Upload · Calendar · InputDate · MultiSelect · Form → `window.Leaf` + runtime utility layout. |
650
+ Production — build sẵn CSS của Tailwind bằng CLI rồi `<link>` sau link Leaf:
651
+
652
+ ```bash
653
+ npm i -D tailwindcss @tailwindcss/cli
654
+ npx @tailwindcss/cli -i ./src/tailwind.css -o ./assets/tailwind.css --minify # --watch khi dev
655
+ ```
656
+
657
+ ```css
658
+ /* src/tailwind.css */
659
+ @layer theme, base, components, utilities;
660
+ @import "tailwindcss";
661
+ @source "../**/*.html";
662
+
663
+ @theme {
664
+ --color-*: initial;
665
+ --text-*: initial;
666
+ }
667
+ @custom-variant light (&:where([data-theme="light"], [data-theme="light"] *));
668
+ ```
669
+
670
+ | File | Nội dung |
671
+ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
672
+ | `leaf-<version>.min.css` | `styles.css` đã minify: token + typography + color + CSS của mọi component. |
673
+ | `leaf-<version>.min.js` | Hành vi Button loading · Tabs · Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode · Upload · Calendar · InputDate · MultiSelect · Form → `window.Leaf`. Trang CSS-only có thể bỏ. |
473
674
 
474
675
  Bản CDN nằm trong package npm (`dist/cdn/`), nên jsDelivr phục vụ trực tiếp theo version:
475
676
  `https://cdn.jsdelivr.net/npm/@finhay-pro/leaf-design-system@<version>/dist/cdn/leaf-<version>.min.css`
@@ -550,8 +751,8 @@ thì đọc lại mỗi lần đặt vị trí). Bubble `pointer-events: none`
550
751
  Span rỗng `.leaf-logo` + `data-brand` / `data-mode` / `data-side` + `--leaf-logo-size`. CSS gắn
551
752
  SVG data-URI — không cần JS. Khác React, HTML tĩnh **không có mặc định**: wordmark phải đủ cả ba
552
753
  attribute, và span phải rỗng tuyệt đối (`:empty` — không có khoảng trắng bên trong), thiếu là ra ô
553
- trống. `data-mode` theo nền phía sau (`dark` = nền tối), không tự đổi theo `data-theme`. Bản CDN đã gộp sẵn data-URI; dùng qua npm thì plugin Leaf tự thêm data-URI khi thấy class
554
- `leaf-logo` trong markup (component React render `<img>` nên không cần).
754
+ trống. `data-mode` theo nền phía sau (`dark` = nền tối), không tự đổi theo `data-theme`. Bản CDN đã gộp sẵn data-URI; dùng qua npm thì import thêm
755
+ `logo-assets.css` (không nằm trong `classes.css` / `styles.css` vì component React không cần).
555
756
 
556
757
  ### Radio / Checkbox / Input
557
758
 
@@ -574,7 +775,7 @@ Có `input[type=hidden]` trong markup thì leaf.js ghi mã vào đó.
574
775
 
575
776
  ### Toast
576
777
 
577
- `Leaf.toast.success | error | warning(title, { description, duration, id })` (hoặc
778
+ `Leaf.toast.info | success | error | warning(title, { description, duration, id, action })` (hoặc
578
779
  `Leaf.toast.show({ status, title, … })`) trả id; `Leaf.toast.dismiss(id?)` đóng (không truyền → đóng
579
780
  hết); `Leaf.toast.configure({ position, closeLabel, label, theme })`. Vùng chứa
580
781
  `.leaf-toaster[data-leaf-toaster]` có sẵn trong trang thì dùng, không thì leaf.js tự tạo. Toast viết
@@ -621,20 +822,27 @@ overlay = `.leaf-spinner-overlay` (app tự `hidden`/mount).
621
822
 
622
823
  ### Cần biết
623
824
 
825
+ - **CSP tối thiểu.** Component không cần `'unsafe-eval'` và không dùng HTML string nên hợp với
826
+ `require-trusted-types-for 'script'`. Cần thêm tuỳ tính năng dùng:
827
+ `style-src 'unsafe-inline'` (style động, runtime leaf.js) · File Viewer: `frame-src blob:`,
828
+ `img-src blob:`, `media-src blob:`, `connect-src <origin file>` · `<Empty image="">`,
829
+ `LanguageDropdown`: `img-src https://cdn1.finhay.com.vn`.
624
830
  - **Link gắn theo version.** Mỗi bản phát hành là một link mới; trang cũ giữ link cũ nên không tự
625
831
  vỡ. Muốn lên bản mới thì đổi cả link CSS lẫn JS cùng một version, đọc [Changelog](#changelog)
626
832
  trước.
627
- - **Không kèm font.** Tự load Inter (Google Fonts hoặc self-host) và set
628
- `body { font-family: var(--font-sans) }`. Reset tối thiểu đã có trong `@layer base`.
629
- - **CSS của trang phải nằm trong `@layer` nếu đụng vào element của component.** Style component
630
- nằm trong `@layer components`, mà CSS không layer luôn thắng CSS có layer bất kể specificity —
631
- reset kiểu `* { padding: 0 }` hay `button { background: none }` đặt trần sẽ xoá padding / nền
632
- của `.leaf-button`. Bọc reset trong `@layer base { … }`, layout của page trong một layer riêng
633
- (vd. `@layer page`, khai báo sau `utilities` nếu muốn đè cả class màu).
634
- - **Utility layout cần `leaf.js`.** Runtime trong script sinh CSS cho `flex`, `gap-[16px]`,
635
- `md:grid-cols-3`… từ class trên trang; thiếu script thì chỉ còn token, class Leaf và CSS
636
- component. Luật utility giống bản npm (px, không thang số, chữ / màu chỉ từ class Leaf).
637
- - **Trình duyệt tối thiểu** (CSS dùng `@layer`): Chrome / Edge 99+, Safari 15.4+, Firefox 97+.
833
+ - **Không kèm font.** Tự load Inter (Google Fonts hoặc self-host) và set font cho body
834
+ (`font-(family-name:--font-sans)`). CSS reset là preflight của Tailwind (`@layer base`).
835
+ - **Layout dùng Tailwind** (`flex`, `gap-4`, `p-6`, `md:`…) — Leaf không có class layout / spacing
836
+ (`flex`, `gap-*`, `p-*` của Leaf đã bỏ từ 0.1.8). Không gắn utility lên phần tử con của component
837
+ (`.leaf-button__label`…); bọc component trong `div` để xếp layout.
838
+ - **Tailwind Browser CDN chỉ để dựng nhanh** — Tailwind không khuyến nghị cho production. Nếu dùng,
839
+ ghim version kèm `integrity` (không dùng link trôi `@tailwindcss/browser@4`); landing thật build
840
+ CSS bằng Tailwind CLI.
841
+ - **CSS tự viết của trang phải nằm trong `@layer`** (keyframes, background phức tạp…): CSS không
842
+ layer luôn thắng CSS có layer bất kể specificity — `* { padding: 0 }` hay
843
+ `button { background: none }` đặt trần sẽ xoá padding / nền của `.leaf-button`.
844
+ - **Trình duyệt tối thiểu**: Leaf (CSS dùng `@layer`) Chrome / Edge 99+, Safari 15.4+, Firefox 97+;
845
+ Tailwind v4 cần Chrome 111+, Safari 16.4+, Firefox 128+.
638
846
  - Dark là mặc định; `data-theme="light"` trên `<html>` để chuyển light.
639
847
  - z-index của lớp phủ đọc `--leaf-z-dropdown` (30) / `--leaf-z-dialog` (50) /
640
848
  `--leaf-z-spinner-overlay` (100) / `--leaf-z-tooltip` (110) / `--leaf-z-toast` (120) — override trên `:root` để chèn lớp của trang vào giữa.
@@ -652,6 +860,71 @@ overlay = `.leaf-spinner-overlay` (app tự `hidden`/mount).
652
860
 
653
861
  ## Changelog
654
862
 
863
+ ### 0.2.5
864
+
865
+ - **Sửa lỗi `Carousel`:** `slidesPerView` dạng số lấy bề rộng slide theo viewport (container query
866
+ `cqi`), không còn giãn vô hạn khi nội dung tự resize (ECharts, ảnh).
867
+ - **`Tabs`:** prop `fit` / `data-fit` — tab `title` / `functional` co theo nội dung.
868
+ - **`Table`:** `TableColumn.headerPrefix` đặt trước nhãn header (đối xứng `headerExtra`).
869
+ - **`Dialog` / `Drawer`:** prop `backgroundGradient` / `data-bg-gradient` — nền gradient phủ cả
870
+ panel; chỉ nhận `*-gradient(…)`, chặn `url(` và ký tự nguy hiểm.
871
+
872
+ Tương thích ngược với 0.2.4 — prop mới đều tuỳ chọn. Chi tiết: `CHANGELOG.md`.
873
+
874
+ ### 0.2.4
875
+
876
+ - **Hook / utils / server:** 3 entry mới `/hooks`, `/utils`, `/server` (xem "Hooks, utils & server"),
877
+ thay `@tanstack/react-pacer`, hook / helper tự viết; `window.Leaf.utils` cho bản CDN. Không có
878
+ hàm kiểu lodash (dùng JS native).
879
+
880
+ > ⚠️ **Breaking** — gỡ engine sinh utility layout của 0.2.3, quay lại **Leaf + Tailwind CSS v4**
881
+ > như 0.2.2. Component, token, class typography / màu không đổi. Xem **Nâng cấp từ 0.2.3** bên dưới.
882
+
883
+ **Gỡ engine CSS (`@finhay/leaf-css`)**
884
+
885
+ - Bỏ export `./css`, `./vite`, `./postcss`, bin `leaf-css` và `dist/engine`. Trả lại các file CSS
886
+ như 0.2.2: `styles.css` (token + mọi class), `tokens.css`, `classes.css`, `typography.css`,
887
+ `color.css`, CSS lẻ từng component (`button.css`, `table.css`…).
888
+ - Layout, spacing, sizing, responsive, state (`hover:`, `md:`…) dùng lại Tailwind CSS v4 với thang và
889
+ breakpoint mặc định của Tailwind. Leaf không còn tự thêm CSS reset — dùng preflight của Tailwind.
890
+ - `leaf-<ver>.min.js` chỉ còn hành vi component (`window.Leaf`), không sinh utility từ class trên
891
+ DOM. HTML tĩnh cũng dùng Tailwind cho layout: Tailwind CLI (production) hoặc Tailwind Browser
892
+ CDN ghim version + SRI (dựng nhanh) — xem mục **HTML tĩnh (CDN)**.
893
+
894
+ **Nâng cấp từ 0.2.3**
895
+
896
+ | 0.2.3 | Bản này |
897
+ | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
898
+ | `@import "@finhay-pro/leaf-design-system/css";` + plugin Vite / PostCSS | `@import "@finhay-pro/leaf-design-system/styles.css";` + `@import "tailwindcss";` + `@tailwindcss/vite` / `postcss` |
899
+ | `leaf()` trong `vite.config`, CLI `leaf-css` | `tailwindcss()` từ `@tailwindcss/vite`, CLI `@tailwindcss/cli` |
900
+ | `p-[16px]`, `gap-[24px]`, `w-[160px]`, `max-w-[448px]` | Giữ nguyên được (Tailwind nhận giá trị tuỳ ý) hoặc đổi sang thang: `p-4`, `gap-6`, `w-40`, `max-w-md` |
901
+ | `sm:` 768 · `md:` 1024 · `lg:` 1280 · `xl:` 1600 · `xs:` ≤ 767 | `md:` 768 · `lg:` 1024 · `xl:` 1280 · `2xl:` 1536 · `max-md:` ≤ 767 (đổi điểm gãy khi migrate) |
902
+ | `hover:bg-tertiary`, `bg-primary/50`, `md:heading-1` | `hover:bg-(--base-tertiary)`, `bg-(--base-primary)/50`; class typo Leaf không nhận variant |
903
+ | Token trong `@layer theme`, reset trong `@layer base` | Token như 0.2.2; reset = preflight Tailwind |
904
+
905
+ **Bảo mật — có thay đổi hành vi**
906
+
907
+ - `csvBlob` / `downloadCsv` với mảng dòng: mặc định thêm `'` trước chuỗi có thể chạy như công thức
908
+ khi mở bằng Excel / Sheets (`=`, `+`, `-`, `@`, tab, CR). Số và chuỗi dạng số giữ nguyên; tắt bằng
909
+ `formulaGuard: false`. `content` dạng text giữ nguyên, app tự chịu trách nhiệm.
910
+ - `readFileSource` / `FileViewer`: chỉ tải `http(s)`, `blob`, `data`. URL khác origin trang không nhận
911
+ `headers` / `credentials` của `fetchInit`, trừ khi origin nằm trong `allowedOrigins` (leaf.js:
912
+ `data-allowed-origins`). Có `allowedOrigins` thì URL và redirect ra ngoài danh sách bị từ chối.
913
+ **App gọi API khác origin kèm token phải khai báo `allowedOrigins`.**
914
+ - `maxSize` có hiệu lực cả khi server không gửi `Content-Length` (đọc theo stream, vượt là dừng).
915
+ - Thông báo lỗi tải file không còn chứa query string, hash, thông tin đăng nhập trong URL.
916
+ - Cột `__proto__` trong CSV / XLSX là dữ liệu thường, không đổi prototype của record.
917
+ - XML trong XLSX / DOCX có `DOCTYPE` bị từ chối (`corrupt`).
918
+ - leaf.js: `data-tooltip` chỉ nhận `<template>`, clone DOM thay vì `innerHTML`; phần tử khác bị bỏ qua.
919
+ - Snippet CDN trong docs và skill có `integrity` (SRI) + `crossorigin`.
920
+ - Thư viện không còn dùng `innerHTML` / `insertAdjacentHTML`, tương thích
921
+ `require-trusted-types-for 'script'`. Thêm mục CSP tối thiểu ở phần "Cần biết".
922
+ - `accept="image/*"` của Upload không còn nhận SVG; cần SVG thì khai báo rõ `.svg` hoặc
923
+ `image/svg+xml`. Backend vẫn phải tự kiểm tra file.
924
+ - `Input type="password"` tắt spellcheck, autocorrect, autocapitalize (kể cả khi đang hiện mật khẩu).
925
+ - `InputOtp` có `mask` (PIN) dùng `autocomplete="off"` thay vì `one-time-code`; leaf.js cũng đặt
926
+ `autocomplete` cho từng ô như React.
927
+
655
928
  ### 0.2.3
656
929
 
657
930
  > ⚠️ **Breaking** — Leaf tự sinh utility layout, không còn dùng Tailwind. Xem **Nâng cấp từ 0.2.2**
@@ -660,7 +933,7 @@ overlay = `.leaf-spinner-overlay` (app tự `hidden`/mount).
660
933
  **Engine CSS của Leaf thay Tailwind (không third party)**
661
934
 
662
935
  - Một dòng `@import "@finhay-pro/leaf-design-system/css";` + plugin `@finhay-pro/leaf-design-system/vite`
663
- hoặc `/postcss`; HTML tĩnh có build dùng CLI `npx leaf-css -i input.css -o leaf.css [--watch]
936
+ hoặc `/postcss`; HTML tĩnh có build dùng CLI `npx --no-install leaf-css -i input.css -o leaf.css [--watch]
664
937
  [--minify]`. Engine bundle trong `dist/engine`, chỉ import `node:*`; package không có
665
938
  `dependencies`.
666
939
  - Thứ tự output: token (`@layer theme`) + reset (`@layer base`) → **CSS của component đang dùng**
@@ -693,9 +966,19 @@ overlay = `.leaf-spinner-overlay` (app tự `hidden`/mount).
693
966
  - Rowspan / colspan (`span`, `mergeRows`), virtual theo hàng (`rowHeight`, `overscan`), realtime
694
967
  `column.flash` (một timer cho cả bảng, dòng memo), `bordered`, `striped`, `size`, loading, rỗng,
695
968
  `onRowClick`; ref `TableHandle` (`scrollToRow`, `scrollToTop`).
969
+ - Bảng quản trị: lọc (`filters`, `filterFn`, `manualFilter`), sort nhiều cột (`multiSort`,
970
+ Shift + click), phân trang (`pageSize` / `page`, `manualPagination` + `totalRows`, ghép
971
+ `<Pagination>`), chọn dòng (`selectable`, cột checkbox ghim trái), kéo đổi vị trí cột
972
+ (`reorderable`, Pointer + Alt ← →), `headerPrefix` / `headerExtra` (icon / nút lọc / menu
973
+ trước / sau nhãn header).
974
+ - Virtual / load thêm: `scrollSource` (`self` · `window` · `parent`), `onEndReached`,
975
+ `loadingMore` — thuật toán JS thuần trong `core/virtual.ts`.
696
976
  - leaf.js: `setOptions`, `setRows`, `update({ [rowId]: patch })` (gộp theo frame), `getSort` /
697
- `setSort`, `getColumnWidths` / `setColumnWidths`, `scrollToRow`, `destroy`; event
698
- `leaf:table-sort-change`, `leaf:table-resize`.
977
+ `setSort`, `getSortList` / `setSortList`, `getFilters` / `setFilters`, `getPage` / `setPage`,
978
+ `getSelectedRowIds` / `setSelectedRowIds`, `getColumnOrder` / `setColumnOrder`,
979
+ `getColumnWidths` / `setColumnWidths`, `scrollToRow`, `destroy`; event
980
+ `leaf:table-sort-change`, `leaf:table-resize`, `leaf:table-selection-change`,
981
+ `leaf:table-column-order-change`, `leaf:table-end-reached`.
699
982
  - Icon mới `arrow-up-line` / `arrow-down-line`; `bgColorToken` trong `utils/colorClass.ts`.
700
983
 
701
984
  **Bảo mật**
@@ -892,7 +1175,8 @@ formats, dropLabel, onReject }`.
892
1175
 
893
1176
  - Bỏ class layout / spacing / border width / radius khỏi Leaf: xoá `spacing.css`, `border.css`,
894
1177
  `flex.css`, `grid.css`, `sizing.css`, `overflow.css`, `position.css`, `text-layout.css` (cả
895
- export npm lẫn trong `classes.css` / `styles.css` / CDN). Next.js dùng Tailwind, landing page dùng CSS của page. Trang
1178
+ export npm lẫn trong `classes.css` / `styles.css` / CDN). Next.js dùng Tailwind (xem
1179
+ [Dùng với Next.js + Tailwind](#dùng-với-nextjs--tailwind)), landing page dùng CSS của page. Trang
896
1180
  dựng layout bằng các class này (`flex`, `gap-m`, `p-l`, `radius-l`…) phải giữ link CDN 0.1.7 hoặc
897
1181
  chuyển sang CSS riêng trước khi lên 0.1.8.
898
1182
  - Bỏ token `--spacing-*`, `--border-width-*`, `--radius-*` (file `spacing.css` / `border.css` của
@@ -916,7 +1200,7 @@ formats, dropLabel, onReject }`.
916
1200
 
917
1201
  **Mới**
918
1202
 
919
- - `Toaster` / `toast` / `ToastContent` — toast success · error · warning (port từ vnsc). Màu từ
1203
+ - `Toaster` / `toast` / `ToastContent` — toast info · success · error · warning + nút hành động (port từ vnsc). Màu từ
920
1204
  token có sẵn: nền `--system-green|red|yellow-secondary`, viền / icon / progress
921
1205
  `--text-highlight` · `--system-red` · `--system-yellow`. Toast gắn `data-theme="dark"` mặc định
922
1206
  (nền thang 800 ở cả hai theme). Tự đóng sau `duration` (mặc định 4000ms, `-1` không tự đóng), dừng