@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.
- package/README.md +466 -182
- package/dist/accordion.css +142 -0
- package/dist/avatar.css +168 -0
- package/dist/badge.css +193 -0
- package/dist/breadcrumb.css +105 -0
- package/dist/button.css +221 -0
- package/dist/calendar.css +487 -0
- package/dist/carousel.css +165 -0
- package/dist/cdn/leaf-0.2.5.min.css +2 -0
- package/dist/cdn/leaf-0.2.5.min.js +177 -0
- package/dist/checkbox.css +140 -0
- package/dist/classes.css +7959 -0
- package/dist/color.css +260 -0
- package/dist/components/Accordion/Accordion.d.ts +43 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +37 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.d.ts.map +1 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Accordion/index.js.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +32 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.js +20 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.d.ts.map +1 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Avatar/index.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +44 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +21 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +33 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +60 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/index.js +2 -0
- package/dist/components/Breadcrumb/index.js.map +1 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/CalendarRange/CalendarRange.d.ts +41 -0
- package/dist/components/CalendarRange/CalendarRange.d.ts.map +1 -0
- package/dist/components/CalendarRange/CalendarRange.js +74 -0
- package/dist/components/CalendarRange/CalendarRange.js.map +1 -0
- package/dist/components/CalendarRange/index.d.ts +2 -0
- package/dist/components/CalendarRange/index.d.ts.map +1 -0
- package/dist/components/CalendarRange/index.js +2 -0
- package/dist/components/CalendarRange/index.js.map +1 -0
- package/dist/components/Carousel/Carousel.d.ts +23 -3
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +30 -8
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/Date/Date.d.ts +1 -1
- package/dist/components/Date/Date.d.ts.map +1 -1
- package/dist/components/Date/Date.js +2 -2
- package/dist/components/Date/Date.js.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +36 -3
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +42 -7
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Drawer.d.ts +18 -0
- package/dist/components/Dialog/Drawer.d.ts.map +1 -0
- package/dist/components/Dialog/Drawer.js +12 -0
- package/dist/components/Dialog/Drawer.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +2 -1
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.js +2 -1
- package/dist/components/Dialog/index.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +15 -1
- package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +106 -20
- package/dist/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/FileViewer/FileViewer.d.ts +3 -1
- package/dist/components/FileViewer/FileViewer.d.ts.map +1 -1
- package/dist/components/FileViewer/FileViewer.js +2 -1
- package/dist/components/FileViewer/FileViewer.js.map +1 -1
- package/dist/components/Form/DynamicForm.js +1 -1
- package/dist/components/Form/Form.js +1 -1
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.js +3 -1
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/InputDate.d.ts +6 -1
- package/dist/components/Input/InputDate.d.ts.map +1 -1
- package/dist/components/Input/InputDate.js +36 -11
- package/dist/components/Input/InputDate.js.map +1 -1
- package/dist/components/Input/InputDateRange.d.ts +43 -0
- package/dist/components/Input/InputDateRange.d.ts.map +1 -0
- package/dist/components/Input/InputDateRange.js +86 -0
- package/dist/components/Input/InputDateRange.js.map +1 -0
- package/dist/components/Input/InputNumber.d.ts +28 -0
- package/dist/components/Input/InputNumber.d.ts.map +1 -0
- package/dist/components/Input/InputNumber.js +58 -0
- package/dist/components/Input/InputNumber.js.map +1 -0
- package/dist/components/Input/InputOtp.d.ts.map +1 -1
- package/dist/components/Input/InputOtp.js +2 -2
- package/dist/components/Input/InputOtp.js.map +1 -1
- package/dist/components/Input/InputStepper.d.ts +3 -1
- package/dist/components/Input/InputStepper.d.ts.map +1 -1
- package/dist/components/Input/InputStepper.js +32 -5
- package/dist/components/Input/InputStepper.js.map +1 -1
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +69 -0
- package/dist/components/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Menu/Menu.js +140 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.d.ts.map +1 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Menu/index.js.map +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +6 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +42 -23
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/Number/Number.d.ts +4 -2
- package/dist/components/Number/Number.d.ts.map +1 -1
- package/dist/components/Number/Number.js +3 -1
- package/dist/components/Number/Number.js.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +35 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.js +40 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Pagination/index.d.ts.map +1 -0
- package/dist/components/Pagination/index.js +2 -0
- package/dist/components/Pagination/index.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +51 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +83 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/Popover/index.js.map +1 -0
- package/dist/components/Progress/Progress.d.ts +30 -0
- package/dist/components/Progress/Progress.d.ts.map +1 -0
- package/dist/components/Progress/Progress.js +17 -0
- package/dist/components/Progress/Progress.js.map +1 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.d.ts.map +1 -0
- package/dist/components/Progress/index.js +2 -0
- package/dist/components/Progress/index.js.map +1 -0
- package/dist/components/SafeHtml/SafeHtml.d.ts +326 -0
- package/dist/components/SafeHtml/SafeHtml.d.ts.map +1 -0
- package/dist/components/SafeHtml/SafeHtml.js +44 -0
- package/dist/components/SafeHtml/SafeHtml.js.map +1 -0
- package/dist/components/SafeHtml/index.d.ts +2 -0
- package/dist/components/SafeHtml/index.d.ts.map +1 -0
- package/dist/components/SafeHtml/index.js +2 -0
- package/dist/components/SafeHtml/index.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +50 -0
- package/dist/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar/Sidebar.js +71 -0
- package/dist/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/components/Sidebar/index.d.ts +2 -0
- package/dist/components/Sidebar/index.d.ts.map +1 -0
- package/dist/components/Sidebar/index.js +2 -0
- package/dist/components/Sidebar/index.js.map +1 -0
- package/dist/components/Slider/Slider.js +1 -4
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/components/Steps/Steps.d.ts +30 -0
- package/dist/components/Steps/Steps.d.ts.map +1 -0
- package/dist/components/Steps/Steps.js +26 -0
- package/dist/components/Steps/Steps.js.map +1 -0
- package/dist/components/Steps/index.d.ts +2 -0
- package/dist/components/Steps/index.d.ts.map +1 -0
- package/dist/components/Steps/index.js +2 -0
- package/dist/components/Steps/index.js.map +1 -0
- package/dist/components/Table/Table.d.ts +61 -3
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.js +176 -33
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/TableHeader.d.ts +8 -3
- package/dist/components/Table/TableHeader.d.ts.map +1 -1
- package/dist/components/Table/TableHeader.js +7 -5
- package/dist/components/Table/TableHeader.js.map +1 -1
- package/dist/components/Table/TableRow.d.ts +5 -1
- package/dist/components/Table/TableRow.d.ts.map +1 -1
- package/dist/components/Table/TableRow.js +2 -2
- package/dist/components/Table/TableRow.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +6 -1
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Toast/Toast.d.ts +8 -4
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +15 -4
- package/dist/components/Toast/Toast.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +5 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +39 -0
- package/dist/components/VirtualList/VirtualList.d.ts.map +1 -0
- package/dist/components/VirtualList/VirtualList.js +113 -0
- package/dist/components/VirtualList/VirtualList.js.map +1 -0
- package/dist/components/VirtualList/index.d.ts +2 -0
- package/dist/components/VirtualList/index.d.ts.map +1 -0
- package/dist/components/VirtualList/index.js +2 -0
- package/dist/components/VirtualList/index.js.map +1 -0
- package/dist/core/accordion.d.ts +15 -0
- package/dist/core/accordion.d.ts.map +1 -0
- package/dist/core/accordion.js +37 -0
- package/dist/core/accordion.js.map +1 -0
- package/dist/core/avatar.d.ts +4 -0
- package/dist/core/avatar.d.ts.map +1 -0
- package/dist/core/avatar.js +12 -0
- package/dist/core/avatar.js.map +1 -0
- package/dist/core/calendar.d.ts +1 -2
- package/dist/core/calendar.d.ts.map +1 -1
- package/dist/core/calendar.js +2 -10
- package/dist/core/calendar.js.map +1 -1
- package/dist/core/carousel.d.ts +8 -0
- package/dist/core/carousel.d.ts.map +1 -1
- package/dist/core/carousel.js +27 -0
- package/dist/core/carousel.js.map +1 -1
- package/dist/core/css-gradient.d.ts +21 -0
- package/dist/core/css-gradient.d.ts.map +1 -0
- package/dist/core/css-gradient.js +54 -0
- package/dist/core/css-gradient.js.map +1 -0
- package/dist/core/date-math.d.ts +39 -0
- package/dist/core/date-math.d.ts.map +1 -0
- package/dist/core/date-math.js +82 -0
- package/dist/core/date-math.js.map +1 -0
- package/dist/core/date-range.d.ts +44 -0
- package/dist/core/date-range.d.ts.map +1 -0
- package/dist/core/date-range.js +88 -0
- package/dist/core/date-range.js.map +1 -0
- package/dist/core/date.d.ts +23 -4
- package/dist/core/date.d.ts.map +1 -1
- package/dist/core/date.js +114 -4
- package/dist/core/date.js.map +1 -1
- package/dist/core/dialog.d.ts +43 -5
- package/dist/core/dialog.d.ts.map +1 -1
- package/dist/core/dialog.js +85 -8
- package/dist/core/dialog.js.map +1 -1
- package/dist/core/file/csv.d.ts +10 -0
- package/dist/core/file/csv.d.ts.map +1 -1
- package/dist/core/file/csv.js +26 -3
- package/dist/core/file/csv.js.map +1 -1
- package/dist/core/file/detect.js.map +1 -1
- package/dist/core/file/docx-render.js.map +1 -1
- package/dist/core/file/docx.js.map +1 -1
- package/dist/core/file/dom.d.ts +1 -1
- package/dist/core/file/dom.d.ts.map +1 -1
- package/dist/core/file/dom.js +3 -3
- package/dist/core/file/dom.js.map +1 -1
- package/dist/core/file/download.d.ts +5 -0
- package/dist/core/file/download.d.ts.map +1 -1
- package/dist/core/file/download.js +10 -3
- package/dist/core/file/download.js.map +1 -1
- package/dist/core/file/error.d.ts.map +1 -1
- package/dist/core/file/error.js.map +1 -1
- package/dist/core/file/source.d.ts +15 -1
- package/dist/core/file/source.d.ts.map +1 -1
- package/dist/core/file/source.js +99 -6
- package/dist/core/file/source.js.map +1 -1
- package/dist/core/file/text.js.map +1 -1
- package/dist/core/file/viewer.d.ts +2 -0
- package/dist/core/file/viewer.d.ts.map +1 -1
- package/dist/core/file/viewer.js +3 -2
- package/dist/core/file/viewer.js.map +1 -1
- package/dist/core/file/xlsx-format.js.map +1 -1
- package/dist/core/file/xlsx-write.js.map +1 -1
- package/dist/core/file/xlsx.d.ts.map +1 -1
- package/dist/core/file/xlsx.js +4 -3
- package/dist/core/file/xlsx.js.map +1 -1
- package/dist/core/file/xml.d.ts.map +1 -1
- package/dist/core/file/xml.js +5 -0
- package/dist/core/file/xml.js.map +1 -1
- package/dist/core/file/zip-write.js.map +1 -1
- package/dist/core/file/zip.js.map +1 -1
- package/dist/core/floating.d.ts +69 -0
- package/dist/core/floating.d.ts.map +1 -0
- package/dist/core/floating.js +185 -0
- package/dist/core/floating.js.map +1 -0
- package/dist/core/html/css.d.ts +32 -0
- package/dist/core/html/css.d.ts.map +1 -0
- package/dist/core/html/css.js +222 -0
- package/dist/core/html/css.js.map +1 -0
- package/dist/core/html/entities.d.ts +19 -0
- package/dist/core/html/entities.d.ts.map +1 -0
- package/dist/core/html/entities.js +167 -0
- package/dist/core/html/entities.js.map +1 -0
- package/dist/core/html/entity-data.d.ts +14 -0
- package/dist/core/html/entity-data.d.ts.map +1 -0
- package/dist/core/html/entity-data.js +14 -0
- package/dist/core/html/entity-data.js.map +1 -0
- package/dist/core/html/props.d.ts +9 -0
- package/dist/core/html/props.d.ts.map +1 -0
- package/dist/core/html/props.js +98 -0
- package/dist/core/html/props.js.map +1 -0
- package/dist/core/html/sanitize.d.ts +150 -0
- package/dist/core/html/sanitize.d.ts.map +1 -0
- package/dist/core/html/sanitize.js +800 -0
- package/dist/core/html/sanitize.js.map +1 -0
- package/dist/core/html/tokenizer.d.ts +33 -0
- package/dist/core/html/tokenizer.d.ts.map +1 -0
- package/dist/core/html/tokenizer.js +306 -0
- package/dist/core/html/tokenizer.js.map +1 -0
- package/dist/core/html/tree.d.ts +35 -0
- package/dist/core/html/tree.d.ts.map +1 -0
- package/dist/core/html/tree.js +253 -0
- package/dist/core/html/tree.js.map +1 -0
- package/dist/core/icons.d.ts +8 -3
- package/dist/core/icons.d.ts.map +1 -1
- package/dist/core/icons.js +20 -5
- package/dist/core/icons.js.map +1 -1
- package/dist/core/language.d.ts.map +1 -1
- package/dist/core/menu.d.ts +22 -0
- package/dist/core/menu.d.ts.map +1 -0
- package/dist/core/menu.js +69 -0
- package/dist/core/menu.js.map +1 -0
- package/dist/core/motion.d.ts +12 -0
- package/dist/core/motion.d.ts.map +1 -0
- package/dist/core/motion.js +17 -0
- package/dist/core/motion.js.map +1 -0
- package/dist/core/number-input.d.ts +29 -0
- package/dist/core/number-input.d.ts.map +1 -0
- package/dist/core/number-input.js +92 -0
- package/dist/core/number-input.js.map +1 -0
- package/dist/core/number.d.ts +14 -0
- package/dist/core/number.d.ts.map +1 -1
- package/dist/core/number.js +48 -2
- package/dist/core/number.js.map +1 -1
- package/dist/core/otp.d.ts +2 -0
- package/dist/core/otp.d.ts.map +1 -1
- package/dist/core/otp.js +4 -0
- package/dist/core/otp.js.map +1 -1
- package/dist/core/pacer.d.ts +63 -0
- package/dist/core/pacer.d.ts.map +1 -0
- package/dist/core/pacer.js +129 -0
- package/dist/core/pacer.js.map +1 -0
- package/dist/core/pagination.d.ts +44 -0
- package/dist/core/pagination.d.ts.map +1 -0
- package/dist/core/pagination.js +78 -0
- package/dist/core/pagination.js.map +1 -0
- package/dist/core/popover.d.ts +6 -0
- package/dist/core/popover.d.ts.map +1 -0
- package/dist/core/popover.js +6 -0
- package/dist/core/popover.js.map +1 -0
- package/dist/core/progress.d.ts +3 -0
- package/dist/core/progress.d.ts.map +1 -0
- package/dist/core/progress.js +8 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/qr-code.d.ts +7 -0
- package/dist/core/qr-code.d.ts.map +1 -1
- package/dist/core/qr-code.js +15 -9
- package/dist/core/qr-code.js.map +1 -1
- package/dist/core/roving.d.ts +19 -0
- package/dist/core/roving.d.ts.map +1 -0
- package/dist/core/roving.js +54 -0
- package/dist/core/roving.js.map +1 -0
- package/dist/core/safe-url.d.ts +37 -0
- package/dist/core/safe-url.d.ts.map +1 -0
- package/dist/core/safe-url.js +68 -0
- package/dist/core/safe-url.js.map +1 -0
- package/dist/core/sheet.d.ts +19 -0
- package/dist/core/sheet.d.ts.map +1 -0
- package/dist/core/sheet.js +54 -0
- package/dist/core/sheet.js.map +1 -0
- package/dist/core/spinner.d.ts +2 -2
- package/dist/core/spinner.d.ts.map +1 -1
- package/dist/core/spinner.js +22 -4
- package/dist/core/spinner.js.map +1 -1
- package/dist/core/status.d.ts +20 -0
- package/dist/core/status.d.ts.map +1 -0
- package/dist/core/status.js +30 -0
- package/dist/core/status.js.map +1 -0
- package/dist/core/stepper.js.map +1 -1
- package/dist/core/table/attrs.d.ts +8 -2
- package/dist/core/table/attrs.d.ts.map +1 -1
- package/dist/core/table/attrs.js +12 -3
- package/dist/core/table/attrs.js.map +1 -1
- package/dist/core/table/columns.d.ts +17 -0
- package/dist/core/table/columns.d.ts.map +1 -1
- package/dist/core/table/columns.js.map +1 -1
- package/dist/core/table/features.d.ts +72 -0
- package/dist/core/table/features.d.ts.map +1 -0
- package/dist/core/table/features.js +198 -0
- package/dist/core/table/features.js.map +1 -0
- package/dist/core/table/index.d.ts +2 -0
- package/dist/core/table/index.d.ts.map +1 -1
- package/dist/core/table/index.js +2 -0
- package/dist/core/table/index.js.map +1 -1
- package/dist/core/table/reorder.d.ts +21 -0
- package/dist/core/table/reorder.d.ts.map +1 -0
- package/dist/core/table/reorder.js +70 -0
- package/dist/core/table/reorder.js.map +1 -0
- package/dist/core/table/virtual.d.ts +5 -18
- package/dist/core/table/virtual.d.ts.map +1 -1
- package/dist/core/table/virtual.js +4 -15
- package/dist/core/table/virtual.js.map +1 -1
- package/dist/core/tabs.d.ts.map +1 -1
- package/dist/core/tabs.js +2 -15
- package/dist/core/tabs.js.map +1 -1
- package/dist/core/toast.d.ts +15 -3
- package/dist/core/toast.d.ts.map +1 -1
- package/dist/core/toast.js +9 -6
- package/dist/core/toast.js.map +1 -1
- package/dist/core/tooltip.d.ts +8 -7
- package/dist/core/tooltip.d.ts.map +1 -1
- package/dist/core/tooltip.js +14 -119
- package/dist/core/tooltip.js.map +1 -1
- package/dist/core/upload.d.ts +1 -0
- package/dist/core/upload.d.ts.map +1 -1
- package/dist/core/upload.js +6 -0
- package/dist/core/upload.js.map +1 -1
- package/dist/core/virtual.d.ts +76 -0
- package/dist/core/virtual.d.ts.map +1 -0
- package/dist/core/virtual.js +214 -0
- package/dist/core/virtual.js.map +1 -0
- package/dist/date.css +19 -0
- package/dist/dialog.css +413 -0
- package/dist/dropdown.css +514 -0
- package/dist/empty.css +82 -0
- package/dist/file-viewer.css +519 -0
- package/dist/fn/async.d.ts +39 -0
- package/dist/fn/async.d.ts.map +1 -0
- package/dist/fn/async.js +91 -0
- package/dist/fn/async.js.map +1 -0
- package/dist/fn/clipboard.d.ts +6 -0
- package/dist/fn/clipboard.d.ts.map +1 -0
- package/dist/fn/clipboard.js +35 -0
- package/dist/fn/clipboard.js.map +1 -0
- package/dist/fn/cookie.d.ts +7 -0
- package/dist/fn/cookie.d.ts.map +1 -0
- package/dist/fn/cookie.js +22 -0
- package/dist/fn/cookie.js.map +1 -0
- package/dist/fn/error.d.ts +24 -0
- package/dist/fn/error.d.ts.map +1 -0
- package/dist/fn/error.js +50 -0
- package/dist/fn/error.js.map +1 -0
- package/dist/fn/html.d.ts +34 -0
- package/dist/fn/html.d.ts.map +1 -0
- package/dist/fn/html.js +60 -0
- package/dist/fn/html.js.map +1 -0
- package/dist/fn/index.d.ts +39 -0
- package/dist/fn/index.d.ts.map +1 -0
- package/dist/fn/index.js +40 -0
- package/dist/fn/index.js.map +1 -0
- package/dist/fn/jwt.d.ts +12 -0
- package/dist/fn/jwt.d.ts.map +1 -0
- package/dist/fn/jwt.js +42 -0
- package/dist/fn/jwt.js.map +1 -0
- package/dist/fn/locale.d.ts +20 -0
- package/dist/fn/locale.d.ts.map +1 -0
- package/dist/fn/locale.js +33 -0
- package/dist/fn/locale.js.map +1 -0
- package/dist/fn/query.d.ts +11 -0
- package/dist/fn/query.d.ts.map +1 -0
- package/dist/fn/query.js +41 -0
- package/dist/fn/query.js.map +1 -0
- package/dist/fn/sanitize.d.ts +15 -0
- package/dist/fn/sanitize.d.ts.map +1 -0
- package/dist/fn/sanitize.js +15 -0
- package/dist/fn/sanitize.js.map +1 -0
- package/dist/fn/storage.d.ts +13 -0
- package/dist/fn/storage.d.ts.map +1 -0
- package/dist/fn/storage.js +69 -0
- package/dist/fn/storage.js.map +1 -0
- package/dist/fn/string.d.ts +13 -0
- package/dist/fn/string.d.ts.map +1 -0
- package/dist/fn/string.js +30 -0
- package/dist/fn/string.js.map +1 -0
- package/dist/fn/url.d.ts +27 -0
- package/dist/fn/url.d.ts.map +1 -0
- package/dist/fn/url.js +71 -0
- package/dist/fn/url.js.map +1 -0
- package/dist/fn/version.d.ts +5 -0
- package/dist/fn/version.d.ts.map +1 -0
- package/dist/fn/version.js +23 -0
- package/dist/fn/version.js.map +1 -0
- package/dist/focus.css +18 -0
- package/dist/form.css +64 -0
- package/dist/hooks/index.d.ts +43 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +43 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAsync.d.ts +17 -0
- package/dist/hooks/useAsync.d.ts.map +1 -0
- package/dist/hooks/useAsync.js +38 -0
- package/dist/hooks/useAsync.js.map +1 -0
- package/dist/hooks/useAsyncCallback.d.ts +26 -0
- package/dist/hooks/useAsyncCallback.d.ts.map +1 -0
- package/dist/hooks/useAsyncCallback.js +57 -0
- package/dist/hooks/useAsyncCallback.js.map +1 -0
- package/dist/hooks/useBatcher.d.ts +11 -0
- package/dist/hooks/useBatcher.d.ts.map +1 -0
- package/dist/hooks/useBatcher.js +16 -0
- package/dist/hooks/useBatcher.js.map +1 -0
- package/dist/hooks/useClickOutside.d.ts +12 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.js +29 -0
- package/dist/hooks/useClickOutside.js.map +1 -0
- package/dist/hooks/useControllableState.d.ts +2 -0
- package/dist/hooks/useControllableState.d.ts.map +1 -0
- package/dist/hooks/useControllableState.js +3 -0
- package/dist/hooks/useControllableState.js.map +1 -0
- package/dist/hooks/useCopyToClipboard.d.ts +9 -0
- package/dist/hooks/useCopyToClipboard.d.ts.map +1 -0
- package/dist/hooks/useCopyToClipboard.js +23 -0
- package/dist/hooks/useCopyToClipboard.js.map +1 -0
- package/dist/hooks/useCountdown.d.ts +24 -0
- package/dist/hooks/useCountdown.d.ts.map +1 -0
- package/dist/hooks/useCountdown.js +59 -0
- package/dist/hooks/useCountdown.js.map +1 -0
- package/dist/hooks/useDebouncedCallback.d.ts +7 -0
- package/dist/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/hooks/useDebouncedCallback.js +15 -0
- package/dist/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/hooks/useDebouncedValue.d.ts +4 -0
- package/dist/hooks/useDebouncedValue.d.ts.map +1 -0
- package/dist/hooks/useDebouncedValue.js +19 -0
- package/dist/hooks/useDebouncedValue.js.map +1 -0
- package/dist/hooks/useDisclosure.d.ts +21 -0
- package/dist/hooks/useDisclosure.d.ts.map +1 -0
- package/dist/hooks/useDisclosure.js +20 -0
- package/dist/hooks/useDisclosure.js.map +1 -0
- package/dist/hooks/useDocumentTitle.d.ts +8 -0
- package/dist/hooks/useDocumentTitle.d.ts.map +1 -0
- package/dist/hooks/useDocumentTitle.js +18 -0
- package/dist/hooks/useDocumentTitle.js.map +1 -0
- package/dist/hooks/useElementSize.d.ts +13 -0
- package/dist/hooks/useElementSize.d.ts.map +1 -0
- package/dist/hooks/useElementSize.js +28 -0
- package/dist/hooks/useElementSize.js.map +1 -0
- package/dist/hooks/useEventListener.d.ts +10 -0
- package/dist/hooks/useEventListener.d.ts.map +1 -0
- package/dist/hooks/useEventListener.js +30 -0
- package/dist/hooks/useEventListener.js.map +1 -0
- package/dist/hooks/useHotkeys.d.ts +24 -0
- package/dist/hooks/useHotkeys.d.ts.map +1 -0
- package/dist/hooks/useHotkeys.js +69 -0
- package/dist/hooks/useHotkeys.js.map +1 -0
- package/dist/hooks/useIdle.d.ts +16 -0
- package/dist/hooks/useIdle.d.ts.map +1 -0
- package/dist/hooks/useIdle.js +63 -0
- package/dist/hooks/useIdle.js.map +1 -0
- package/dist/hooks/useInView.d.ts +13 -0
- package/dist/hooks/useInView.d.ts.map +1 -0
- package/dist/hooks/useInView.js +32 -0
- package/dist/hooks/useInView.js.map +1 -0
- package/dist/hooks/useInfiniteScroll.d.ts +20 -0
- package/dist/hooks/useInfiniteScroll.d.ts.map +1 -0
- package/dist/hooks/useInfiniteScroll.js +38 -0
- package/dist/hooks/useInfiniteScroll.js.map +1 -0
- package/dist/hooks/useInterval.d.ts +3 -0
- package/dist/hooks/useInterval.d.ts.map +1 -0
- package/dist/hooks/useInterval.js +15 -0
- package/dist/hooks/useInterval.js.map +1 -0
- package/dist/hooks/useIsClient.d.ts +6 -0
- package/dist/hooks/useIsClient.d.ts.map +1 -0
- package/dist/hooks/useIsClient.js +11 -0
- package/dist/hooks/useIsClient.js.map +1 -0
- package/dist/hooks/useLatest.d.ts +7 -0
- package/dist/hooks/useLatest.d.ts.map +1 -0
- package/dist/hooks/useLatest.js +14 -0
- package/dist/hooks/useLatest.js.map +1 -0
- package/dist/hooks/useMediaQuery.d.ts +6 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/hooks/useMediaQuery.js +20 -0
- package/dist/hooks/useMediaQuery.js.map +1 -0
- package/dist/hooks/useMergedRefs.d.ts +6 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +9 -0
- package/dist/hooks/useMergedRefs.js.map +1 -0
- package/dist/hooks/useObjectUrl.d.ts +7 -0
- package/dist/hooks/useObjectUrl.d.ts.map +1 -0
- package/dist/hooks/useObjectUrl.js +21 -0
- package/dist/hooks/useObjectUrl.js.map +1 -0
- package/dist/hooks/useOnlineStatus.d.ts +3 -0
- package/dist/hooks/useOnlineStatus.d.ts.map +1 -0
- package/dist/hooks/useOnlineStatus.js +15 -0
- package/dist/hooks/useOnlineStatus.js.map +1 -0
- package/dist/hooks/usePageVisibility.d.ts +3 -0
- package/dist/hooks/usePageVisibility.d.ts.map +1 -0
- package/dist/hooks/usePageVisibility.js +11 -0
- package/dist/hooks/usePageVisibility.js.map +1 -0
- package/dist/hooks/usePolling.d.ts +17 -0
- package/dist/hooks/usePolling.d.ts.map +1 -0
- package/dist/hooks/usePolling.js +46 -0
- package/dist/hooks/usePolling.js.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +3 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts.map +1 -0
- package/dist/hooks/usePrefersReducedMotion.js +7 -0
- package/dist/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/hooks/usePresence.d.ts +2 -0
- package/dist/hooks/usePresence.d.ts.map +1 -0
- package/dist/hooks/usePresence.js +3 -0
- package/dist/hooks/usePresence.js.map +1 -0
- package/dist/hooks/usePrevious.d.ts +3 -0
- package/dist/hooks/usePrevious.d.ts.map +1 -0
- package/dist/hooks/usePrevious.js +15 -0
- package/dist/hooks/usePrevious.js.map +1 -0
- package/dist/hooks/useScroll.d.ts +22 -0
- package/dist/hooks/useScroll.d.ts.map +1 -0
- package/dist/hooks/useScroll.js +73 -0
- package/dist/hooks/useScroll.js.map +1 -0
- package/dist/hooks/useScrollLock.d.ts +6 -0
- package/dist/hooks/useScrollLock.d.ts.map +1 -0
- package/dist/hooks/useScrollLock.js +17 -0
- package/dist/hooks/useScrollLock.js.map +1 -0
- package/dist/hooks/useStorageState.d.ts +14 -0
- package/dist/hooks/useStorageState.d.ts.map +1 -0
- package/dist/hooks/useStorageState.js +62 -0
- package/dist/hooks/useStorageState.js.map +1 -0
- package/dist/hooks/useSyncedState.d.ts +6 -0
- package/dist/hooks/useSyncedState.d.ts.map +1 -0
- package/dist/hooks/useSyncedState.js +16 -0
- package/dist/hooks/useSyncedState.js.map +1 -0
- package/dist/hooks/useThrottledCallback.d.ts +4 -0
- package/dist/hooks/useThrottledCallback.d.ts.map +1 -0
- package/dist/hooks/useThrottledCallback.js +12 -0
- package/dist/hooks/useThrottledCallback.js.map +1 -0
- package/dist/hooks/useThrottledValue.d.ts +4 -0
- package/dist/hooks/useThrottledValue.d.ts.map +1 -0
- package/dist/hooks/useThrottledValue.js +19 -0
- package/dist/hooks/useThrottledValue.js.map +1 -0
- package/dist/hooks/useTimeout.d.ts +9 -0
- package/dist/hooks/useTimeout.d.ts.map +1 -0
- package/dist/hooks/useTimeout.js +23 -0
- package/dist/hooks/useTimeout.js.map +1 -0
- package/dist/hooks/useWindowSize.d.ts +12 -0
- package/dist/hooks/useWindowSize.d.ts.map +1 -0
- package/dist/hooks/useWindowSize.js +38 -0
- package/dist/hooks/useWindowSize.js.map +1 -0
- package/dist/index.d.ts +26 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/input-date.css +99 -0
- package/dist/input-otp.css +76 -0
- package/dist/input-stepper.css +179 -0
- package/dist/input.css +231 -0
- package/dist/logo-assets.css +81 -0
- package/dist/logo.css +59 -0
- package/dist/menu.css +198 -0
- package/dist/multiselect.css +147 -0
- package/dist/number.css +53 -0
- package/dist/pagination.css +140 -0
- package/dist/popover.css +106 -0
- package/dist/progress.css +187 -0
- package/dist/qr-code.css +28 -0
- package/dist/radio.css +124 -0
- package/dist/server/crypto.d.ts +26 -0
- package/dist/server/crypto.d.ts.map +1 -0
- package/dist/server/crypto.js +50 -0
- package/dist/server/crypto.js.map +1 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/rate-limit.d.ts +20 -0
- package/dist/server/rate-limit.d.ts.map +1 -0
- package/dist/server/rate-limit.js +42 -0
- package/dist/server/rate-limit.js.map +1 -0
- package/dist/server/request.d.ts +42 -0
- package/dist/server/request.d.ts.map +1 -0
- package/dist/server/request.js +94 -0
- package/dist/server/request.js.map +1 -0
- package/dist/server/response.d.ts +19 -0
- package/dist/server/response.d.ts.map +1 -0
- package/dist/server/response.js +44 -0
- package/dist/server/response.js.map +1 -0
- package/dist/sidebar.css +271 -0
- package/dist/skeleton.css +57 -0
- package/dist/skill/leaf-design-system-0.2.5.zip +0 -0
- package/dist/slider.css +312 -0
- package/dist/spinner.css +132 -0
- package/dist/steps.css +211 -0
- package/dist/{leaf.css → styles.css} +4665 -2163
- package/dist/table.css +435 -0
- package/dist/tabs.css +270 -0
- package/dist/textarea.css +28 -0
- package/dist/toast.css +272 -0
- package/dist/toggle.css +123 -0
- package/dist/tokens.css +264 -0
- package/dist/tooltip.css +259 -0
- package/dist/typography.css +150 -0
- package/dist/upload.css +326 -0
- package/dist/utils/RemixGlyph.d.ts +1 -1
- package/dist/utils/RemixGlyph.d.ts.map +1 -1
- package/dist/utils/RemixGlyph.js +1 -1
- package/dist/utils/RemixGlyph.js.map +1 -1
- package/dist/utils/useFloating.d.ts +11 -0
- package/dist/utils/useFloating.d.ts.map +1 -0
- package/dist/utils/useFloating.js +34 -0
- package/dist/utils/useFloating.js.map +1 -0
- package/dist/utils/useFloatingLayer.d.ts +40 -0
- package/dist/utils/useFloatingLayer.d.ts.map +1 -0
- package/dist/utils/useFloatingLayer.js +95 -0
- package/dist/utils/useFloatingLayer.js.map +1 -0
- package/dist/utils/usePresence.d.ts +9 -0
- package/dist/utils/usePresence.d.ts.map +1 -0
- package/dist/utils/usePresence.js +25 -0
- package/dist/utils/usePresence.js.map +1 -0
- package/dist/virtual-list.css +60 -0
- package/package.json +82 -21
- package/dist/cdn/leaf-0.2.3.min.css +0 -8
- package/dist/cdn/leaf-0.2.3.min.js +0 -204
- package/dist/engine/assets.json +0 -1
- package/dist/engine/chunk-X2H56OKG.js +0 -4854
- package/dist/engine/cli.js +0 -8
- package/dist/engine/postcss.d.ts +0 -3
- package/dist/engine/postcss.js +0 -7
- package/dist/engine/vite.d.ts +0 -3
- package/dist/engine/vite.js +0 -7
- 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
|
|
5
|
-
HTML tĩnh dùng chung markup) và
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
/*
|
|
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
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
140
|
+
## Dùng với Next.js + Tailwind
|
|
43
141
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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-
|
|
99
|
-
<h3 className="heading-3
|
|
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
|
-
|
|
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 |
|
|
110
|
-
| ----------------- | -------------------------------------------------------- |
|
|
111
|
-
| Spacing 2XS…7XL | 2 · 4 · 8 · 12 · 16 · 24 · 36 · 48 · 60 · 84 · 120 · 240 | `
|
|
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`
|
|
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à
|
|
166
|
-
<p className="body-3 text-secondary mt-
|
|
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
|
|
192
|
-
<div class="bg-secondary border-quaternary rounded-xl border p-
|
|
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
|
|
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
|
|
235
|
-
ngoài phạm vi — app tự
|
|
236
|
-
(
|
|
237
|
-
- Leaf
|
|
238
|
-
dùng
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
`@layer
|
|
242
|
-
|
|
243
|
-
`!important`.
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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 +
|
|
255
|
-
pnpm --filter @finhay-pro/leaf-design-system dev # gom CSS +
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
|
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
|
|
285
|
-
|
|
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
|
|
294
|
-
|
|
|
295
|
-
| `Button`
|
|
296
|
-
| `Tabs`
|
|
297
|
-
| `Dialog`
|
|
298
|
-
| `Logo`
|
|
299
|
-
| `Skeleton`
|
|
300
|
-
| `Empty`
|
|
301
|
-
| `Spinner`
|
|
302
|
-
| `Toggle`
|
|
303
|
-
| `Slider`
|
|
304
|
-
| `Tooltip`
|
|
305
|
-
| `Radio` / `RadioGroup`
|
|
306
|
-
| `Checkbox`
|
|
307
|
-
| `Input`
|
|
308
|
-
| `InputOtp`
|
|
309
|
-
| `InputStepper`
|
|
310
|
-
| `Calendar`
|
|
311
|
-
| `InputDate`
|
|
312
|
-
| `Toaster` / `toast`
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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 {
|
|
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:
|
|
443
|
-
|
|
444
|
-
Toggle · Dialog · Slider · Tooltip · InputOtp · InputStepper · Toast · Dropdown · Carousel · QrCode ·
|
|
445
|
-
|
|
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
|
|
451
|
-
|
|
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
|
|
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
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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-
|
|
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
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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ì
|
|
554
|
-
`
|
|
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
|
-
`
|
|
629
|
-
- **
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
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`, `
|
|
698
|
-
`
|
|
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
|
|
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
|