@harjs/react-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/assets/css/components/charts/gantt/styles.css +62 -0
- package/dist/assets/css/components/charts/pie/pie.css +90 -0
- package/dist/assets/css/components/data-display/calendar/styles.css +15 -0
- package/dist/assets/css/components/data-display/calendar/styles.week-view.css +144 -0
- package/dist/assets/css/components/data-display/card/statuses.css +377 -0
- package/dist/assets/css/components/data-display/card/styles.css +26 -0
- package/dist/assets/css/components/data-display/chip/chip.css +13 -0
- package/dist/assets/css/components/data-display/diagram/styles.css +125 -0
- package/dist/assets/css/components/data-display/divider/divider.css +8 -0
- package/dist/assets/css/components/data-display/dnd/animations.css +11 -0
- package/dist/assets/css/components/data-display/dnd/shadow.css +26 -0
- package/dist/assets/css/components/data-display/dnd/styles.css +72 -0
- package/dist/assets/css/components/data-display/grid-system/column/position.css +21 -0
- package/dist/assets/css/components/data-display/grid-system/column/styles.css +379 -0
- package/dist/assets/css/components/data-display/grid-system/row/styles.css +35 -0
- package/dist/assets/css/components/data-display/grid-system/styles.css +6 -0
- package/dist/assets/css/components/data-display/kanban-board/styles.css +371 -0
- package/dist/assets/css/components/data-display/paper/styles.css +49 -0
- package/dist/assets/css/components/data-display/syntax-highlighter/core/jsx.template.css +65 -0
- package/dist/assets/css/components/data-display/syntax-highlighter/syntax-highlighter.css +58 -0
- package/dist/assets/css/components/data-display/table/filter-popup.css +11 -0
- package/dist/assets/css/components/data-display/table/properties-popup.css +42 -0
- package/dist/assets/css/components/data-display/table/scroll.css +208 -0
- package/dist/assets/css/components/data-display/table/styles.css +867 -0
- package/dist/assets/css/components/data-display/tabs/tabs.css +245 -0
- package/dist/assets/css/components/data-display/typography/paragraph/align.css +13 -0
- package/dist/assets/css/components/data-display/typography/paragraph/color.css +51 -0
- package/dist/assets/css/components/data-display/typography/paragraph/core.css +6 -0
- package/dist/assets/css/components/data-display/typography/paragraph/size.css +13 -0
- package/dist/assets/css/components/data-display/typography/title/align.css +13 -0
- package/dist/assets/css/components/data-display/typography/title/color.css +0 -0
- package/dist/assets/css/components/data-display/typography/title/core.css +5 -0
- package/dist/assets/css/components/data-display/typography/title/size.css +41 -0
- package/dist/assets/css/components/data-display/typography/typography.css +11 -0
- package/dist/assets/css/components/feedback/alert/statuses.css +224 -0
- package/dist/assets/css/components/feedback/alert/styles.css +61 -0
- package/dist/assets/css/components/feedback/drawer/content.css +7 -0
- package/dist/assets/css/components/feedback/drawer/header.css +56 -0
- package/dist/assets/css/components/feedback/drawer/styles.css +85 -0
- package/dist/assets/css/components/feedback/loading/loading.css +54 -0
- package/dist/assets/css/components/feedback/modal/content.css +6 -0
- package/dist/assets/css/components/feedback/modal/footer.css +9 -0
- package/dist/assets/css/components/feedback/modal/header.css +56 -0
- package/dist/assets/css/components/feedback/modal/media-queries/medium.css +11 -0
- package/dist/assets/css/components/feedback/modal/media-queries/small.css +11 -0
- package/dist/assets/css/components/feedback/modal/media-queries/x-large.css +5 -0
- package/dist/assets/css/components/feedback/modal/styles.css +53 -0
- package/dist/assets/css/components/feedback/notification/notification.css +157 -0
- package/dist/assets/css/components/feedback/popover/styles.css +53 -0
- package/dist/assets/css/components/feedback/popup-confirm/styles.css +165 -0
- package/dist/assets/css/components/feedback/progress/animations.css +10 -0
- package/dist/assets/css/components/feedback/progress/progress.css +50 -0
- package/dist/assets/css/components/feedback/progress/statuses.css +188 -0
- package/dist/assets/css/components/feedback/tooltip/styles.css +60 -0
- package/dist/assets/css/components/form/button/core/icon.css +37 -0
- package/dist/assets/css/components/form/button/core/position.css +19 -0
- package/dist/assets/css/components/form/button/core/shape.css +13 -0
- package/dist/assets/css/components/form/button/core/size.css +14 -0
- package/dist/assets/css/components/form/button/styles.css +32 -0
- package/dist/assets/css/components/form/button-action/styles.css +24 -0
- package/dist/assets/css/components/form/button-group/styles.css +26 -0
- package/dist/assets/css/components/form/checkbox/checkbox.css +53 -0
- package/dist/assets/css/components/form/checkbox/core/border.css +252 -0
- package/dist/assets/css/components/form/date-picker/calendar/calendar.css +14 -0
- package/dist/assets/css/components/form/date-picker/calendar/content.css +62 -0
- package/dist/assets/css/components/form/date-picker/calendar/footer.css +10 -0
- package/dist/assets/css/components/form/date-picker/calendar/header.css +86 -0
- package/dist/assets/css/components/form/date-picker/clock/clock.css +14 -0
- package/dist/assets/css/components/form/date-picker/clock/content.css +48 -0
- package/dist/assets/css/components/form/date-picker/clock/footer.css +6 -0
- package/dist/assets/css/components/form/date-picker/clock/header.css +8 -0
- package/dist/assets/css/components/form/date-picker/date-picker.css +36 -0
- package/dist/assets/css/components/form/input/core/addon.css +11 -0
- package/dist/assets/css/components/form/input/core/border.css +114 -0
- package/dist/assets/css/components/form/input/core/button.css +34 -0
- package/dist/assets/css/components/form/input/core/icon.css +22 -0
- package/dist/assets/css/components/form/input/otp/styles.css +20 -0
- package/dist/assets/css/components/form/input/phone/styles.css +50 -0
- package/dist/assets/css/components/form/input/styles.css +120 -0
- package/dist/assets/css/components/form/radio/core/border.css +252 -0
- package/dist/assets/css/components/form/radio/radio.css +69 -0
- package/dist/assets/css/components/form/select/options.css +117 -0
- package/dist/assets/css/components/form/select/styles.css +184 -0
- package/dist/assets/css/components/form/switch/core/border.css +208 -0
- package/dist/assets/css/components/form/switch/styles.css +61 -0
- package/dist/assets/css/components/form/text-editor/styles.css +130 -0
- package/dist/assets/css/components/form/upload/dropzone.css +166 -0
- package/dist/assets/css/components/form/upload/list-and-gird.css +183 -0
- package/dist/assets/css/components/form/upload/styles.css +215 -0
- package/dist/assets/css/components/layout/layout.css +130 -0
- package/dist/assets/css/components/layout/media-queries/large.css +19 -0
- package/dist/assets/css/components/layout/media-queries/medium.css +19 -0
- package/dist/assets/css/components/layout/media-queries/small.css +19 -0
- package/dist/assets/css/components/layout/media-queries/x-large.css +19 -0
- package/dist/assets/css/components/layout/media-queries/x-small.css +3 -0
- package/dist/assets/css/components/layout/media-queries/xx-large.css +19 -0
- package/dist/assets/css/components/layout/media-queries/xxx-large.css +20 -0
- package/dist/assets/css/components/navigation/breadcrumb/styles.css +0 -0
- package/dist/assets/css/components/navigation/menu/core/open-or-close.css +12 -0
- package/dist/assets/css/components/navigation/menu/styles.css +163 -0
- package/dist/assets/css/components/navigation/menu/variant/horizontal.css +3 -0
- package/dist/assets/css/components/navigation/menu/variant/vertical.css +3 -0
- package/dist/assets/css/components/navigation/pagination/styles.css +169 -0
- package/dist/assets/css/components/navigation/steps/animation.css +8 -0
- package/dist/assets/css/components/navigation/steps/styles.css +146 -0
- package/dist/assets/css/core/animation.css +164 -0
- package/dist/assets/css/core/ar-core.css +192 -0
- package/dist/assets/css/core/color-palette.css +111 -0
- package/dist/assets/css/core/utils.css +16 -0
- package/dist/assets/css/core/variants/animation.css +164 -0
- package/dist/assets/css/core/variants/border.css +18 -0
- package/dist/assets/css/core/variants/borderless.css +362 -0
- package/dist/assets/css/core/variants/dashed.css +362 -0
- package/dist/assets/css/core/variants/filled.css +428 -0
- package/dist/assets/css/core/variants/outlined.css +439 -0
- package/dist/assets/css/core/variants/surface.css +252 -0
- package/dist/assets/fonts/JetBrainsMono-Bold.ttf +0 -0
- package/dist/assets/fonts/JetBrainsMono-Regular.ttf +0 -0
- package/dist/components/charts/gantt/IProps.d.ts +24 -0
- package/dist/components/charts/gantt/IProps.js +1 -0
- package/dist/components/charts/gantt/index.d.ts +5 -0
- package/dist/components/charts/gantt/index.js +308 -0
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/index.js +2 -0
- package/dist/components/charts/pie/IProps.d.ts +7 -0
- package/dist/components/charts/pie/IProps.js +1 -0
- package/dist/components/charts/pie/index.d.ts +5 -0
- package/dist/components/charts/pie/index.js +56 -0
- package/dist/components/data-display/calendar/Body.d.ts +23 -0
- package/dist/components/data-display/calendar/Body.js +14 -0
- package/dist/components/data-display/calendar/Header.d.ts +20 -0
- package/dist/components/data-display/calendar/Header.js +26 -0
- package/dist/components/data-display/calendar/IProps.d.ts +14 -0
- package/dist/components/data-display/calendar/IProps.js +1 -0
- package/dist/components/data-display/calendar/index.d.ts +8 -0
- package/dist/components/data-display/calendar/index.js +27 -0
- package/dist/components/data-display/calendar/views/Day.d.ts +3 -0
- package/dist/components/data-display/calendar/views/Day.js +5 -0
- package/dist/components/data-display/calendar/views/Month.d.ts +3 -0
- package/dist/components/data-display/calendar/views/Month.js +5 -0
- package/dist/components/data-display/calendar/views/Week.d.ts +19 -0
- package/dist/components/data-display/calendar/views/Week.js +173 -0
- package/dist/components/data-display/card/IProps.d.ts +10 -0
- package/dist/components/data-display/card/IProps.js +1 -0
- package/dist/components/data-display/card/index.d.ts +5 -0
- package/dist/components/data-display/card/index.js +14 -0
- package/dist/components/data-display/chip/IProps.d.ts +6 -0
- package/dist/components/data-display/chip/IProps.js +1 -0
- package/dist/components/data-display/chip/index.d.ts +5 -0
- package/dist/components/data-display/chip/index.js +17 -0
- package/dist/components/data-display/diagram/IProps.d.ts +6 -0
- package/dist/components/data-display/diagram/IProps.js +1 -0
- package/dist/components/data-display/diagram/index.d.ts +5 -0
- package/dist/components/data-display/diagram/index.js +298 -0
- package/dist/components/data-display/divider/IProps.d.ts +6 -0
- package/dist/components/data-display/divider/IProps.js +1 -0
- package/dist/components/data-display/divider/index.d.ts +5 -0
- package/dist/components/data-display/divider/index.js +5 -0
- package/dist/components/data-display/dnd/IProps.d.ts +12 -0
- package/dist/components/data-display/dnd/IProps.js +1 -0
- package/dist/components/data-display/dnd/index.d.ts +5 -0
- package/dist/components/data-display/dnd/index.js +125 -0
- package/dist/components/data-display/grid-system/box/Box.d.ts +6 -0
- package/dist/components/data-display/grid-system/box/Box.js +13 -0
- package/dist/components/data-display/grid-system/column/Column.d.ts +4 -0
- package/dist/components/data-display/grid-system/column/Column.js +21 -0
- package/dist/components/data-display/grid-system/column/IProps.d.ts +13 -0
- package/dist/components/data-display/grid-system/column/IProps.js +1 -0
- package/dist/components/data-display/grid-system/index.d.ts +10 -0
- package/dist/components/data-display/grid-system/index.js +11 -0
- package/dist/components/data-display/grid-system/row/IProps.d.ts +4 -0
- package/dist/components/data-display/grid-system/row/IProps.js +1 -0
- package/dist/components/data-display/grid-system/row/Row.d.ts +4 -0
- package/dist/components/data-display/grid-system/row/Row.js +6 -0
- package/dist/components/data-display/kanban-board/IProps.d.ts +31 -0
- package/dist/components/data-display/kanban-board/IProps.js +1 -0
- package/dist/components/data-display/kanban-board/filter/DateFilters.d.ts +25 -0
- package/dist/components/data-display/kanban-board/filter/DateFilters.js +55 -0
- package/dist/components/data-display/kanban-board/filter/SelectFilters.d.ts +27 -0
- package/dist/components/data-display/kanban-board/filter/SelectFilters.js +43 -0
- package/dist/components/data-display/kanban-board/filter/index.d.ts +36 -0
- package/dist/components/data-display/kanban-board/filter/index.js +47 -0
- package/dist/components/data-display/kanban-board/index.d.ts +5 -0
- package/dist/components/data-display/kanban-board/index.js +309 -0
- package/dist/components/data-display/paper/IProps.d.ts +6 -0
- package/dist/components/data-display/paper/IProps.js +1 -0
- package/dist/components/data-display/paper/index.d.ts +5 -0
- package/dist/components/data-display/paper/index.js +12 -0
- package/dist/components/data-display/syntax-highlighter/Import.d.ts +4 -0
- package/dist/components/data-display/syntax-highlighter/Import.js +5 -0
- package/dist/components/data-display/syntax-highlighter/classes/Compiler.d.ts +7 -0
- package/dist/components/data-display/syntax-highlighter/classes/Compiler.js +92 -0
- package/dist/components/data-display/syntax-highlighter/classes/Parser.d.ts +9 -0
- package/dist/components/data-display/syntax-highlighter/classes/Parser.js +99 -0
- package/dist/components/data-display/syntax-highlighter/index.d.ts +11 -0
- package/dist/components/data-display/syntax-highlighter/index.js +41 -0
- package/dist/components/data-display/table/FilterPopup.d.ts +20 -0
- package/dist/components/data-display/table/FilterPopup.js +54 -0
- package/dist/components/data-display/table/Helpers.d.ts +2 -0
- package/dist/components/data-display/table/Helpers.js +10 -0
- package/dist/components/data-display/table/IProps.d.ts +99 -0
- package/dist/components/data-display/table/IProps.js +1 -0
- package/dist/components/data-display/table/PropertiesPopup.d.ts +31 -0
- package/dist/components/data-display/table/PropertiesPopup.js +90 -0
- package/dist/components/data-display/table/THeadCell.d.ts +34 -0
- package/dist/components/data-display/table/THeadCell.js +67 -0
- package/dist/components/data-display/table/body/Editable.d.ts +12 -0
- package/dist/components/data-display/table/body/Editable.js +59 -0
- package/dist/components/data-display/table/body/TBody.d.ts +36 -0
- package/dist/components/data-display/table/body/TBody.js +184 -0
- package/dist/components/data-display/table/header/ActionButtons.d.ts +14 -0
- package/dist/components/data-display/table/header/ActionButtons.js +65 -0
- package/dist/components/data-display/table/header/Header.d.ts +15 -0
- package/dist/components/data-display/table/header/Header.js +10 -0
- package/dist/components/data-display/table/index.d.ts +7 -0
- package/dist/components/data-display/table/index.js +639 -0
- package/dist/components/data-display/tabs/IProps.d.ts +9 -0
- package/dist/components/data-display/tabs/IProps.js +1 -0
- package/dist/components/data-display/tabs/index.d.ts +5 -0
- package/dist/components/data-display/tabs/index.js +110 -0
- package/dist/components/data-display/tabs/skeleton.d.ts +4 -0
- package/dist/components/data-display/tabs/skeleton.js +14 -0
- package/dist/components/data-display/typography/index.d.ts +6 -0
- package/dist/components/data-display/typography/index.js +9 -0
- package/dist/components/data-display/typography/paragraph/IProps.d.ts +7 -0
- package/dist/components/data-display/typography/paragraph/IProps.js +1 -0
- package/dist/components/data-display/typography/paragraph/Paragraph.d.ts +4 -0
- package/dist/components/data-display/typography/paragraph/Paragraph.js +14 -0
- package/dist/components/data-display/typography/title/IProps.d.ts +7 -0
- package/dist/components/data-display/typography/title/IProps.js +1 -0
- package/dist/components/data-display/typography/title/Title.d.ts +4 -0
- package/dist/components/data-display/typography/title/Title.js +13 -0
- package/dist/components/feedback/alert/IProps.d.ts +11 -0
- package/dist/components/feedback/alert/IProps.js +1 -0
- package/dist/components/feedback/alert/index.d.ts +5 -0
- package/dist/components/feedback/alert/index.js +50 -0
- package/dist/components/feedback/drawer/IProps.d.ts +18 -0
- package/dist/components/feedback/drawer/IProps.js +1 -0
- package/dist/components/feedback/drawer/index.d.ts +5 -0
- package/dist/components/feedback/drawer/index.js +94 -0
- package/dist/components/feedback/loading/index.d.ts +4 -0
- package/dist/components/feedback/loading/index.js +7 -0
- package/dist/components/feedback/modal/IProps.d.ts +14 -0
- package/dist/components/feedback/modal/IProps.js +1 -0
- package/dist/components/feedback/modal/index.d.ts +5 -0
- package/dist/components/feedback/modal/index.js +91 -0
- package/dist/components/feedback/notification/IProps.d.ts +9 -0
- package/dist/components/feedback/notification/IProps.js +1 -0
- package/dist/components/feedback/notification/index.d.ts +5 -0
- package/dist/components/feedback/notification/index.js +96 -0
- package/dist/components/feedback/popover/IProps.d.ts +16 -0
- package/dist/components/feedback/popover/IProps.js +1 -0
- package/dist/components/feedback/popover/index.d.ts +5 -0
- package/dist/components/feedback/popover/index.js +91 -0
- package/dist/components/feedback/popup-confirm/IProps.d.ts +10 -0
- package/dist/components/feedback/popup-confirm/IProps.js +1 -0
- package/dist/components/feedback/popup-confirm/index.d.ts +5 -0
- package/dist/components/feedback/popup-confirm/index.js +98 -0
- package/dist/components/feedback/progress/IProps.d.ts +6 -0
- package/dist/components/feedback/progress/IProps.js +1 -0
- package/dist/components/feedback/progress/index.d.ts +5 -0
- package/dist/components/feedback/progress/index.js +26 -0
- package/dist/components/feedback/tooltip/IProps.d.ts +6 -0
- package/dist/components/feedback/tooltip/IProps.js +1 -0
- package/dist/components/feedback/tooltip/index.d.ts +5 -0
- package/dist/components/feedback/tooltip/index.js +129 -0
- package/dist/components/form/button/IProps.d.ts +10 -0
- package/dist/components/form/button/IProps.js +1 -0
- package/dist/components/form/button/index.d.ts +5 -0
- package/dist/components/form/button/index.js +41 -0
- package/dist/components/form/button-action/IProps.d.ts +8 -0
- package/dist/components/form/button-action/IProps.js +1 -0
- package/dist/components/form/button-action/index.d.ts +5 -0
- package/dist/components/form/button-action/index.js +68 -0
- package/dist/components/form/button-group/index.d.ts +7 -0
- package/dist/components/form/button-group/index.js +31 -0
- package/dist/components/form/checkbox/IProps.d.ts +5 -0
- package/dist/components/form/checkbox/IProps.js +1 -0
- package/dist/components/form/checkbox/index.d.ts +5 -0
- package/dist/components/form/checkbox/index.js +24 -0
- package/dist/components/form/date-picker/DATE.d.ts +12 -0
- package/dist/components/form/date-picker/DATE.js +27 -0
- package/dist/components/form/date-picker/Props.d.ts +10 -0
- package/dist/components/form/date-picker/Props.js +1 -0
- package/dist/components/form/date-picker/index.d.ts +5 -0
- package/dist/components/form/date-picker/index.js +365 -0
- package/dist/components/form/input/IProps.d.ts +12 -0
- package/dist/components/form/input/IProps.js +1 -0
- package/dist/components/form/input/decimal/Decimal.d.ts +4 -0
- package/dist/components/form/input/decimal/Decimal.js +54 -0
- package/dist/components/form/input/decimal/IProps.d.ts +8 -0
- package/dist/components/form/input/decimal/IProps.js +1 -0
- package/dist/components/form/input/formatted-decimal/FormattedDecimal.d.ts +4 -0
- package/dist/components/form/input/formatted-decimal/FormattedDecimal.js +73 -0
- package/dist/components/form/input/formatted-decimal/IProps.d.ts +12 -0
- package/dist/components/form/input/formatted-decimal/IProps.js +1 -0
- package/dist/components/form/input/index.d.ts +15 -0
- package/dist/components/form/input/index.js +152 -0
- package/dist/components/form/input/otp/IProps.d.ts +6 -0
- package/dist/components/form/input/otp/IProps.js +1 -0
- package/dist/components/form/input/otp/Otp.d.ts +7 -0
- package/dist/components/form/input/otp/Otp.js +122 -0
- package/dist/components/form/input/phone/IProps.d.ts +11 -0
- package/dist/components/form/input/phone/IProps.js +1 -0
- package/dist/components/form/input/phone/Phone.d.ts +4 -0
- package/dist/components/form/input/phone/Phone.js +41 -0
- package/dist/components/form/radio/IProps.d.ts +12 -0
- package/dist/components/form/radio/IProps.js +1 -0
- package/dist/components/form/radio/index.d.ts +5 -0
- package/dist/components/form/radio/index.js +38 -0
- package/dist/components/form/select/Props.d.ts +35 -0
- package/dist/components/form/select/Props.js +1 -0
- package/dist/components/form/select/index.d.ts +5 -0
- package/dist/components/form/select/index.js +312 -0
- package/dist/components/form/switch/IProps.d.ts +5 -0
- package/dist/components/form/switch/IProps.js +1 -0
- package/dist/components/form/switch/index.d.ts +5 -0
- package/dist/components/form/switch/index.js +36 -0
- package/dist/components/form/text-editor/IProps.d.ts +18 -0
- package/dist/components/form/text-editor/IProps.js +1 -0
- package/dist/components/form/text-editor/index.d.ts +5 -0
- package/dist/components/form/text-editor/index.js +300 -0
- package/dist/components/form/upload/Buttons.d.ts +8 -0
- package/dist/components/form/upload/Buttons.js +27 -0
- package/dist/components/form/upload/Dropzone.d.ts +10 -0
- package/dist/components/form/upload/Dropzone.js +55 -0
- package/dist/components/form/upload/List.d.ts +12 -0
- package/dist/components/form/upload/List.js +21 -0
- package/dist/components/form/upload/Props.d.ts +16 -0
- package/dist/components/form/upload/Props.js +1 -0
- package/dist/components/form/upload/index.d.ts +9 -0
- package/dist/components/form/upload/index.js +184 -0
- package/dist/components/icons/Compiler.d.ts +9 -0
- package/dist/components/icons/Compiler.js +156 -0
- package/dist/components/icons/index.d.ts +10 -0
- package/dist/components/icons/index.js +6 -0
- package/dist/components/layout/Footer.d.ts +3 -0
- package/dist/components/layout/Footer.js +8 -0
- package/dist/components/layout/Header.d.ts +4 -0
- package/dist/components/layout/Header.js +8 -0
- package/dist/components/layout/IProps.d.ts +20 -0
- package/dist/components/layout/IProps.js +1 -0
- package/dist/components/layout/LSider.d.ts +4 -0
- package/dist/components/layout/LSider.js +53 -0
- package/dist/components/layout/Main.d.ts +4 -0
- package/dist/components/layout/Main.js +4 -0
- package/dist/components/layout/RSider.d.ts +3 -0
- package/dist/components/layout/RSider.js +13 -0
- package/dist/components/layout/Section.d.ts +4 -0
- package/dist/components/layout/Section.js +10 -0
- package/dist/components/layout/index.d.ts +12 -0
- package/dist/components/layout/index.js +32 -0
- package/dist/components/navigation/breadcrumb/IProps.d.ts +3 -0
- package/dist/components/navigation/breadcrumb/IProps.js +1 -0
- package/dist/components/navigation/breadcrumb/index.d.ts +5 -0
- package/dist/components/navigation/breadcrumb/index.js +8 -0
- package/dist/components/navigation/menu/IProps.d.ts +14 -0
- package/dist/components/navigation/menu/IProps.js +1 -0
- package/dist/components/navigation/menu/index.d.ts +5 -0
- package/dist/components/navigation/menu/index.js +89 -0
- package/dist/components/navigation/pagination/IProps.d.ts +8 -0
- package/dist/components/navigation/pagination/IProps.js +1 -0
- package/dist/components/navigation/pagination/index.d.ts +5 -0
- package/dist/components/navigation/pagination/index.js +74 -0
- package/dist/components/navigation/steps/IProps.d.ts +16 -0
- package/dist/components/navigation/steps/IProps.js +1 -0
- package/dist/components/navigation/steps/index.d.ts +5 -0
- package/dist/components/navigation/steps/index.js +102 -0
- package/dist/libs/core/application/contexts/Config.d.ts +26 -0
- package/dist/libs/core/application/contexts/Config.js +20 -0
- package/dist/libs/core/application/contexts/Language.d.ts +7 -0
- package/dist/libs/core/application/contexts/Language.js +7 -0
- package/dist/libs/core/application/contexts/Loading.d.ts +11 -0
- package/dist/libs/core/application/contexts/Loading.js +13 -0
- package/dist/libs/core/application/contexts/Notification.d.ts +25 -0
- package/dist/libs/core/application/contexts/Notification.js +29 -0
- package/dist/libs/core/application/contexts/index.d.ts +5 -0
- package/dist/libs/core/application/contexts/index.js +5 -0
- package/dist/libs/core/application/hooks/index.d.ts +41 -0
- package/dist/libs/core/application/hooks/index.js +17 -0
- package/dist/libs/core/application/hooks/useNotification.d.ts +16 -0
- package/dist/libs/core/application/hooks/useNotification.js +23 -0
- package/dist/libs/core/application/hooks/useTranslation.d.ts +9 -0
- package/dist/libs/core/application/hooks/useTranslation.js +25 -0
- package/dist/libs/core/application/hooks/useValidation.d.ts +7 -0
- package/dist/libs/core/application/hooks/useValidation.js +151 -0
- package/dist/libs/core/application/locales/index.d.ts +4 -0
- package/dist/libs/core/application/locales/index.js +3 -0
- package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.d.ts +5 -0
- package/dist/libs/core/application/locales/kanban-board/IKanbanBoardLocale.js +1 -0
- package/dist/libs/core/application/locales/kanban-board/en.d.ts +3 -0
- package/dist/libs/core/application/locales/kanban-board/en.js +5 -0
- package/dist/libs/core/application/locales/kanban-board/tr.d.ts +3 -0
- package/dist/libs/core/application/locales/kanban-board/tr.js +5 -0
- package/dist/libs/core/application/locales/notification/INotificationLocale.d.ts +59 -0
- package/dist/libs/core/application/locales/notification/INotificationLocale.js +1 -0
- package/dist/libs/core/application/locales/notification/en.d.ts +3 -0
- package/dist/libs/core/application/locales/notification/en.js +85 -0
- package/dist/libs/core/application/locales/notification/tr.d.ts +3 -0
- package/dist/libs/core/application/locales/notification/tr.js +85 -0
- package/dist/libs/core/application/locales/table/ITableLocale.d.ts +18 -0
- package/dist/libs/core/application/locales/table/ITableLocale.js +1 -0
- package/dist/libs/core/application/locales/table/en.d.ts +3 -0
- package/dist/libs/core/application/locales/table/en.js +22 -0
- package/dist/libs/core/application/locales/table/tr.d.ts +3 -0
- package/dist/libs/core/application/locales/table/tr.js +22 -0
- package/dist/libs/infrastructure/shared/DATE.d.ts +74 -0
- package/dist/libs/infrastructure/shared/DATE.js +148 -0
- package/dist/libs/infrastructure/shared/Enums.d.ts +18 -0
- package/dist/libs/infrastructure/shared/Enums.js +21 -0
- package/dist/libs/infrastructure/shared/NUMBER.d.ts +8 -0
- package/dist/libs/infrastructure/shared/NUMBER.js +10 -0
- package/dist/libs/infrastructure/shared/PHONE.d.ts +8 -0
- package/dist/libs/infrastructure/shared/PHONE.js +126 -0
- package/dist/libs/infrastructure/shared/Utils.d.ts +20 -0
- package/dist/libs/infrastructure/shared/Utils.js +349 -0
- package/dist/libs/infrastructure/shared/_old_DATE.d.ts +28 -0
- package/dist/libs/infrastructure/shared/_old_DATE.js +68 -0
- package/dist/libs/infrastructure/types/IGlobalProps.d.ts +183 -0
- package/dist/libs/infrastructure/types/IGlobalProps.js +1 -0
- package/dist/libs/infrastructure/types/index.d.ts +155 -0
- package/dist/libs/infrastructure/types/index.js +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../assets/css/components/form/text-editor/styles.css";
|
|
3
|
+
import { ARIcon } from "../../icons";
|
|
4
|
+
import Button from "../button";
|
|
5
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
6
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
7
|
+
import ReactDOM from "react-dom";
|
|
8
|
+
import Tooltip from "../../feedback/tooltip";
|
|
9
|
+
const TextEditor = ({ color = "light", name, value, onChange, dynamicList, placeholder, height,
|
|
10
|
+
// multilang,
|
|
11
|
+
validation, disabled, }) => {
|
|
12
|
+
// refs
|
|
13
|
+
const _container = useRef(null);
|
|
14
|
+
const _label = useRef(null);
|
|
15
|
+
const _arIframe = useRef(null);
|
|
16
|
+
const _onChange = useRef(onChange);
|
|
17
|
+
const _onChangeTimeOut = useRef(null);
|
|
18
|
+
// refs -> Alias Panel
|
|
19
|
+
const _target = useRef(null);
|
|
20
|
+
const _arAliasPanel = useRef(null);
|
|
21
|
+
// states
|
|
22
|
+
const [iframe, setIframe] = useState(null);
|
|
23
|
+
const [iframeDocument, setIframeDocument] = useState(undefined);
|
|
24
|
+
// states -> Data
|
|
25
|
+
const [tagged, setTagged] = useState([]);
|
|
26
|
+
// states -> Alias Panel
|
|
27
|
+
const [atRect, setAtRect] = useState(null);
|
|
28
|
+
const [filtered, setFiltered] = useState(null);
|
|
29
|
+
// variables
|
|
30
|
+
const toolbarButtons = [
|
|
31
|
+
{ command: "bold", icon: "Bold", tooltip: `Bold (${Utils.GetOSShortCutIcons()} + B)` },
|
|
32
|
+
{ command: "italic", icon: "Italic", tooltip: `Italic (${Utils.GetOSShortCutIcons()} + I)` },
|
|
33
|
+
{ command: "underline", icon: "Underline", tooltip: `Underline (${Utils.GetOSShortCutIcons()} + U)` },
|
|
34
|
+
{ command: "insertUnorderedList", icon: "BulletList", tooltip: "Bulleted List" },
|
|
35
|
+
{ command: "insertOrderedList", icon: "NumberList", tooltip: "Numbered List" },
|
|
36
|
+
{ command: "justifyLeft", icon: "TextAlingLeft", tooltip: "Align Left" },
|
|
37
|
+
{ command: "justifyCenter", icon: "TextAlingCenter", tooltip: "Align Center" },
|
|
38
|
+
{ command: "justifyRight", icon: "TextAlingRight", tooltip: "Align Right" },
|
|
39
|
+
];
|
|
40
|
+
const _iframeClassName = [];
|
|
41
|
+
_iframeClassName.push(...Utils.GetClassName("outlined", undefined, !Utils.IsNullOrEmpty(validation?.text) ? "red" : color, { radius: "sm" }, undefined, undefined, undefined));
|
|
42
|
+
// methods
|
|
43
|
+
const execCommand = (command) => {
|
|
44
|
+
if (!_arIframe.current)
|
|
45
|
+
return;
|
|
46
|
+
const iframeDoc = _arIframe.current.contentDocument || _arIframe.current.contentWindow?.document;
|
|
47
|
+
if (iframeDoc)
|
|
48
|
+
iframeDoc.execCommand(command, true, undefined);
|
|
49
|
+
};
|
|
50
|
+
const handleFocus = () => _arIframe.current?.classList.add("focused");
|
|
51
|
+
const handleBlur = () => {
|
|
52
|
+
_arIframe.current?.classList.remove("focused");
|
|
53
|
+
// setAtRect(null);
|
|
54
|
+
};
|
|
55
|
+
const handleMouseDown = () => {
|
|
56
|
+
// Resizebar a tıklandığında iframe içerisinde bulunan window'un event listenerı olmadığı için orada resize çalışmayacaktır.
|
|
57
|
+
// Bu yüzden önüne bir duvar örüyoruz ve mevcut sayfanın window'unda işlem yapmaya devam ediyor.
|
|
58
|
+
const resizeItem = document.createElement("div");
|
|
59
|
+
resizeItem.classList.add("ar-text-editor--block-item");
|
|
60
|
+
_container.current?.appendChild(resizeItem);
|
|
61
|
+
window.addEventListener("mousemove", handleResize);
|
|
62
|
+
window.addEventListener("mouseup", () => {
|
|
63
|
+
resizeItem.remove();
|
|
64
|
+
window.removeEventListener("mousemove", handleResize);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const handleResize = (event) => {
|
|
68
|
+
if (_arIframe.current) {
|
|
69
|
+
const rect = _arIframe.current.getBoundingClientRect();
|
|
70
|
+
const height = (rect.height += event.movementY);
|
|
71
|
+
_arIframe.current.style.height = `${height}px`;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
// methods -> Alias Panel
|
|
75
|
+
const handleBackSpaceKeydown = (event) => {
|
|
76
|
+
const key = event.key;
|
|
77
|
+
if (key === "Backspace" || key === "Delete") {
|
|
78
|
+
const selection = _arIframe.current?.contentDocument?.getSelection();
|
|
79
|
+
if (!selection || selection.rangeCount === 0)
|
|
80
|
+
return;
|
|
81
|
+
const range = selection.getRangeAt(0);
|
|
82
|
+
// 1. Çoklu seçim varsa: clone edip span'ları bul.
|
|
83
|
+
const contents = range.cloneContents();
|
|
84
|
+
const multiSpans = contents.querySelectorAll("span[data-tag]");
|
|
85
|
+
if (multiSpans.length > 0) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
const tagsToRemove = [];
|
|
88
|
+
multiSpans.forEach((span) => {
|
|
89
|
+
const tag = span.getAttribute("data-tag");
|
|
90
|
+
if (tag)
|
|
91
|
+
tagsToRemove.push(tag);
|
|
92
|
+
});
|
|
93
|
+
// DOM'dan temizle
|
|
94
|
+
range.deleteContents();
|
|
95
|
+
// State'ten temizle
|
|
96
|
+
setTagged((prev) => prev.filter((x) => tagsToRemove.every((tag) => !JSON.stringify(x).includes(tag))));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// 2. Tekli seçim: caret bir span içindeyse sil
|
|
100
|
+
const node = selection.anchorNode;
|
|
101
|
+
const container = node?.parentElement;
|
|
102
|
+
if (container?.tagName === "SPAN" && container.dataset.tag) {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
const tag = container.dataset.tag;
|
|
105
|
+
// DOM'dan sil
|
|
106
|
+
container.remove();
|
|
107
|
+
// State'ten kaldır
|
|
108
|
+
setTagged((prev) => prev.filter((x) => !JSON.stringify(x).includes(tag ?? "")));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
// useEffects
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
// Iframe Document yüklendikten sonra çalışacaktır.
|
|
115
|
+
if (!iframeDocument)
|
|
116
|
+
return;
|
|
117
|
+
const selection = iframeDocument.getSelection();
|
|
118
|
+
let range = null;
|
|
119
|
+
// Eğer bir seçim (caret) varsa, konumunu kaydet
|
|
120
|
+
if (selection && selection.rangeCount > 0)
|
|
121
|
+
range = selection.getRangeAt(0);
|
|
122
|
+
// Eğer içeriği kendimiz değiştirmedikse ve gelen value farklıysa, içeriği güncelle
|
|
123
|
+
if (iframeDocument.body.innerHTML !== value) {
|
|
124
|
+
// iframeDocument.body.innerHTML = value || `<p>${placeholder ?? ""}</p>`;
|
|
125
|
+
iframeDocument.body.innerHTML = value ?? "";
|
|
126
|
+
}
|
|
127
|
+
// Cursor (caret) konumunu geri yükle
|
|
128
|
+
if (range) {
|
|
129
|
+
selection?.removeAllRanges();
|
|
130
|
+
selection?.addRange(range);
|
|
131
|
+
}
|
|
132
|
+
}, [value, iframeDocument]);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
// onChange değiştiğinde ref'i güncelle
|
|
135
|
+
_onChange.current = onChange;
|
|
136
|
+
}, [onChange]);
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
// Iframe yüklendikten sonra çalışacaktır.
|
|
139
|
+
if (!iframe)
|
|
140
|
+
return;
|
|
141
|
+
const _iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
|
|
142
|
+
if (!_iframeDocument)
|
|
143
|
+
return;
|
|
144
|
+
setIframeDocument(_iframeDocument);
|
|
145
|
+
if (!disabled)
|
|
146
|
+
_iframeDocument.designMode = "on";
|
|
147
|
+
// Herhangi bir değişikliği izlemek için MutationObserver kullan
|
|
148
|
+
const observer = new MutationObserver((mutationsList) => {
|
|
149
|
+
if (_onChangeTimeOut.current)
|
|
150
|
+
clearTimeout(_onChangeTimeOut.current);
|
|
151
|
+
_onChangeTimeOut.current = setTimeout(() => {
|
|
152
|
+
mutationsList.forEach((record) => {
|
|
153
|
+
const target = record.target;
|
|
154
|
+
_target.current = record.target;
|
|
155
|
+
if (dynamicList) {
|
|
156
|
+
if (target.nodeType === Node.TEXT_NODE) {
|
|
157
|
+
const text = target.textContent ?? "";
|
|
158
|
+
const atIndex = text.lastIndexOf(dynamicList?.triggerKey ?? "@");
|
|
159
|
+
if (atIndex !== -1) {
|
|
160
|
+
const afterAt = text.slice(atIndex + 1); // @ sonrası metin.
|
|
161
|
+
const hasWhitespace = /\s/.test(afterAt);
|
|
162
|
+
if (!hasWhitespace) {
|
|
163
|
+
const selection = _iframeDocument?.getSelection();
|
|
164
|
+
if (selection && selection.rangeCount > 0) {
|
|
165
|
+
const range = selection.getRangeAt(0).cloneRange();
|
|
166
|
+
const rect = range.getBoundingClientRect();
|
|
167
|
+
range.collapse(true);
|
|
168
|
+
setAtRect(rect);
|
|
169
|
+
setFiltered(afterAt);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Eğer @ yoksa ya da boşluk varsa paneli kapat.
|
|
175
|
+
setAtRect(null);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
_iframeDocument?.body.innerHTML === "<br>"
|
|
179
|
+
? _onChange.current(undefined)
|
|
180
|
+
: _onChange.current(_iframeDocument.body.innerHTML);
|
|
181
|
+
});
|
|
182
|
+
}, 500);
|
|
183
|
+
});
|
|
184
|
+
// Observer'ı body üzerinde başlat
|
|
185
|
+
observer.observe(_iframeDocument.body, { childList: true, subtree: true, characterData: true, attributes: true });
|
|
186
|
+
_iframeDocument.body.addEventListener("focus", handleFocus);
|
|
187
|
+
_iframeDocument.body.addEventListener("blur", handleBlur);
|
|
188
|
+
if (dynamicList) {
|
|
189
|
+
_iframeDocument.body.addEventListener("keydown", handleBackSpaceKeydown);
|
|
190
|
+
}
|
|
191
|
+
return () => {
|
|
192
|
+
observer.disconnect();
|
|
193
|
+
_iframeDocument.body.removeEventListener("focus", handleFocus);
|
|
194
|
+
_iframeDocument.body.removeEventListener("blur", handleBlur);
|
|
195
|
+
if (dynamicList) {
|
|
196
|
+
_iframeDocument.body.removeEventListener("keydown", handleBackSpaceKeydown);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}, [iframe]);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
dynamicList?.onTagged && dynamicList?.onTagged(tagged);
|
|
202
|
+
}, [tagged]);
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
if (!_arIframe.current)
|
|
205
|
+
return;
|
|
206
|
+
setIframe(_arIframe.current);
|
|
207
|
+
return () => {
|
|
208
|
+
if (iframeDocument) {
|
|
209
|
+
iframeDocument.body.removeEventListener("focus", handleFocus);
|
|
210
|
+
iframeDocument.body.removeEventListener("blur", handleBlur);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}, []);
|
|
214
|
+
return (React.createElement("div", { ref: _container, className: "ar-text-editor" },
|
|
215
|
+
placeholder && (React.createElement("label", { ref: _label, className: value ? "visible" : "hidden", style: { maxWidth: _arIframe.current?.getBoundingClientRect().width } },
|
|
216
|
+
validation && "* ",
|
|
217
|
+
placeholder)),
|
|
218
|
+
React.createElement("iframe", { ref: _arIframe, name: name, className: _iframeClassName.map((c) => c).join(" "), height: height, ...(value
|
|
219
|
+
? {
|
|
220
|
+
style: {
|
|
221
|
+
clipPath: `polygon(
|
|
222
|
+
-15px 0,
|
|
223
|
+
10px -5px,
|
|
224
|
+
10px 5px,
|
|
225
|
+
calc(${_label.current?.getBoundingClientRect().width}px + 7px) 5px,
|
|
226
|
+
calc(${_label.current?.getBoundingClientRect().width}px + 7px) -5px,
|
|
227
|
+
100% -70px,
|
|
228
|
+
calc(100% + 5px) calc(100% + 5px),
|
|
229
|
+
-5px calc(100% + 5px)
|
|
230
|
+
)`,
|
|
231
|
+
},
|
|
232
|
+
}
|
|
233
|
+
: {}) }),
|
|
234
|
+
React.createElement("div", { className: "toolbar" }, toolbarButtons.map(({ command, icon, tooltip }, index) => (React.createElement(Tooltip, { key: `${command}-${index}`, text: tooltip },
|
|
235
|
+
React.createElement(Button, { key: command, type: "button", variant: "borderless", color: "light", border: { radius: "none" }, icon: { element: React.createElement(ARIcon, { icon: icon }) }, onClick: () => execCommand(command) }))))),
|
|
236
|
+
React.createElement("div", { className: "resize", onMouseDown: handleMouseDown }),
|
|
237
|
+
validation?.text && React.createElement("span", { className: "validation" }, validation.text),
|
|
238
|
+
dynamicList &&
|
|
239
|
+
atRect &&
|
|
240
|
+
ReactDOM.createPortal(React.createElement("div", { ref: _arAliasPanel, className: "ar-alias-panel", style: {
|
|
241
|
+
top: (_arIframe.current?.getBoundingClientRect().top ?? 0) + atRect.top + 20,
|
|
242
|
+
left: (_arIframe.current?.getBoundingClientRect().left ?? 0) + atRect.left,
|
|
243
|
+
}, onClick: () => {
|
|
244
|
+
setAtRect(null);
|
|
245
|
+
} },
|
|
246
|
+
React.createElement("ul", null, dynamicList &&
|
|
247
|
+
dynamicList.render.items
|
|
248
|
+
// .filter((fItem) => !tagged.some((t: T) => JSON.stringify(fItem) === JSON.stringify(t)))
|
|
249
|
+
.filter((item) => {
|
|
250
|
+
const displayText = item[dynamicList.render.display] ?? "";
|
|
251
|
+
return displayText.toLowerCase().includes(filtered.toLowerCase());
|
|
252
|
+
})
|
|
253
|
+
.map((item, index) => (React.createElement("li", { key: index, onClick: (event) => {
|
|
254
|
+
event.stopPropagation();
|
|
255
|
+
const selection = iframeDocument?.getSelection();
|
|
256
|
+
const target = _target.current;
|
|
257
|
+
if (selection && selection.rangeCount > 0 && target && target.nodeType === Node.TEXT_NODE) {
|
|
258
|
+
const text = target.textContent ?? "";
|
|
259
|
+
const atIndex = text.lastIndexOf(dynamicList?.triggerKey ?? "@");
|
|
260
|
+
if (atIndex !== -1) {
|
|
261
|
+
const range = selection.getRangeAt(0).cloneRange();
|
|
262
|
+
range.setStart(target, atIndex);
|
|
263
|
+
range.setEnd(target, text.length);
|
|
264
|
+
range.deleteContents();
|
|
265
|
+
const itemText = item[dynamicList.render.display] ?? "";
|
|
266
|
+
const span = iframeDocument?.createElement("span");
|
|
267
|
+
const spaceNode = iframeDocument?.createTextNode(" \u200B");
|
|
268
|
+
if (span && spaceNode && iframeDocument) {
|
|
269
|
+
span.setAttribute("data-tag", `${itemText}`);
|
|
270
|
+
span.style.backgroundColor = "rgba(114, 15, 103, .1)";
|
|
271
|
+
span.style.padding = "0 5px";
|
|
272
|
+
span.style.borderRadius = "2px";
|
|
273
|
+
span.style.color = "#720f67";
|
|
274
|
+
span.style.fontWeight = "bold";
|
|
275
|
+
span.textContent = `@${itemText}`;
|
|
276
|
+
// Yeni bir wrapper fragment oluştur
|
|
277
|
+
const fragment = iframeDocument.createDocumentFragment();
|
|
278
|
+
fragment.appendChild(span);
|
|
279
|
+
fragment.appendChild(spaceNode); // görünmez boş node, ama yazılabilir
|
|
280
|
+
range.insertNode(fragment);
|
|
281
|
+
// Cursor'u spaceNode’un sonuna yerleştir
|
|
282
|
+
const newRange = iframeDocument.createRange();
|
|
283
|
+
newRange.setStart(spaceNode, spaceNode.length);
|
|
284
|
+
newRange.collapse(true);
|
|
285
|
+
selection.removeAllRanges();
|
|
286
|
+
selection.addRange(newRange);
|
|
287
|
+
// Focus zaten varsa sorun olmayacak
|
|
288
|
+
const activeEl = iframeDocument?.activeElement;
|
|
289
|
+
activeEl?.focus();
|
|
290
|
+
}
|
|
291
|
+
setAtRect(null);
|
|
292
|
+
setTagged((prev) => {
|
|
293
|
+
const exists = prev.some((i) => JSON.stringify(i) === JSON.stringify(item));
|
|
294
|
+
return exists ? prev : [...prev, item];
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
} }, item[dynamicList.render.display] ?? ""))))), document.body)));
|
|
299
|
+
};
|
|
300
|
+
export default TextEditor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface IProps {
|
|
3
|
+
selectedFile: File;
|
|
4
|
+
handleFileToBase64: (file: File) => Promise<string>;
|
|
5
|
+
handleFileRemove: (fileToRemove: File) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ selectedFile, handleFileToBase64, handleFileRemove }: IProps) => React.JSX.Element>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { ARIcon } from "../../icons";
|
|
3
|
+
import Button from "../button";
|
|
4
|
+
const Buttons = ({ selectedFile, handleFileToBase64, handleFileRemove }) => {
|
|
5
|
+
return (React.createElement("div", { className: "buttons" },
|
|
6
|
+
React.createElement("div", null,
|
|
7
|
+
React.createElement(Button, { variant: "borderless", color: "purple", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Download", fill: "currentColor" }) }, onClick: (e) => {
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
const url = window.URL.createObjectURL(selectedFile);
|
|
10
|
+
const a = document.createElement("a");
|
|
11
|
+
a.href = url;
|
|
12
|
+
a.download = selectedFile.name;
|
|
13
|
+
a.click();
|
|
14
|
+
window.URL.revokeObjectURL(url);
|
|
15
|
+
} }),
|
|
16
|
+
selectedFile.type.includes("image") && (React.createElement(Button, { variant: "borderless", color: "blue", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Eye-Fill", fill: "currentColor" }) }, onClick: async (e) => {
|
|
17
|
+
e.stopPropagation();
|
|
18
|
+
const base64 = await handleFileToBase64(selectedFile);
|
|
19
|
+
const newTab = window.open();
|
|
20
|
+
newTab?.document.write(`<img src="${base64}" title="${selectedFile.name}" alt="${selectedFile.name}" />`);
|
|
21
|
+
} })),
|
|
22
|
+
React.createElement(Button, { variant: "borderless", color: "red", type: "button", icon: { element: React.createElement(ARIcon, { icon: "Trash-Fill", fill: "currentColor" }) }, onClick: (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
handleFileRemove(selectedFile);
|
|
25
|
+
} }))));
|
|
26
|
+
};
|
|
27
|
+
export default memo(Buttons);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ValidationError } from ".";
|
|
3
|
+
interface IProps {
|
|
4
|
+
selectedFiles: File[];
|
|
5
|
+
validationErrors?: ValidationError[];
|
|
6
|
+
handleFileToBase64: (file: File) => Promise<string>;
|
|
7
|
+
handleFileRemove: (fileToRemove: File) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ selectedFiles, validationErrors, handleFileToBase64, handleFileRemove }: IProps) => React.JSX.Element | null>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { memo, useEffect, useState } from "react";
|
|
3
|
+
import { ARIcon } from "../../icons";
|
|
4
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
5
|
+
import Buttons from "./Buttons";
|
|
6
|
+
const Dropzone = ({ selectedFiles, validationErrors = [], handleFileToBase64, handleFileRemove }) => {
|
|
7
|
+
const [selectedFile, setSelectedFile] = useState(undefined);
|
|
8
|
+
const [selectedFileBase64, setSelectedFileBase64] = useState(undefined);
|
|
9
|
+
const [fileBase64Map, setFileBase64Map] = useState({});
|
|
10
|
+
// methods
|
|
11
|
+
const handleSelectFile = async (file) => {
|
|
12
|
+
setSelectedFile(file);
|
|
13
|
+
setSelectedFileBase64(fileBase64Map[file.name]);
|
|
14
|
+
};
|
|
15
|
+
const renderFileCard = (file) => {
|
|
16
|
+
const fileInfo = Utils.GetFileTypeInformation(file.type);
|
|
17
|
+
const message = validationErrors.find((v) => v.fileName === file.name)?.message;
|
|
18
|
+
const base64 = fileBase64Map[file.name];
|
|
19
|
+
return (React.createElement("div", { key: file.name, className: "item", style: { backgroundColor: fileInfo.color }, onMouseEnter: (e) => {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
handleSelectFile(file);
|
|
22
|
+
} },
|
|
23
|
+
message && (React.createElement("div", { className: "error" },
|
|
24
|
+
React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)" }),
|
|
25
|
+
React.createElement("span", null, message))),
|
|
26
|
+
React.createElement(Buttons, { selectedFile: file, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
|
|
27
|
+
file.type.includes("image") ? (React.createElement("img", { src: base64 })) : (React.createElement(ARIcon, { icon: fileInfo.icon ?? "Document", fill: "var(--white)", size: 32 }))));
|
|
28
|
+
};
|
|
29
|
+
// useEffects
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
(async () => {
|
|
32
|
+
const base64s = await Promise.all(selectedFiles.map((f) => handleFileToBase64(f)));
|
|
33
|
+
const newMap = selectedFiles.reduce((acc, file, index) => {
|
|
34
|
+
acc[file.name] = base64s[index];
|
|
35
|
+
return acc;
|
|
36
|
+
}, {});
|
|
37
|
+
setFileBase64Map(newMap);
|
|
38
|
+
setSelectedFile(selectedFiles[0]);
|
|
39
|
+
setSelectedFileBase64(newMap[selectedFiles[0]?.name]);
|
|
40
|
+
})();
|
|
41
|
+
}, [selectedFiles]);
|
|
42
|
+
return selectedFile ? (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement("div", { className: "preview" },
|
|
44
|
+
selectedFile.type.includes("image") ? (React.createElement("img", { src: selectedFileBase64, className: "selected-image" })) : ("Önizleme Yok."),
|
|
45
|
+
React.createElement(Buttons, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
|
|
46
|
+
React.createElement("div", { className: "informations" },
|
|
47
|
+
React.createElement("span", { className: "file-name" }, selectedFile.name),
|
|
48
|
+
React.createElement("div", null,
|
|
49
|
+
React.createElement("span", { className: "file-size" },
|
|
50
|
+
(selectedFile.size / 1024).toFixed(3),
|
|
51
|
+
React.createElement("span", { className: "size-type" }, "KB")),
|
|
52
|
+
React.createElement("span", { className: "file-type" }, Utils.GetFileTypeInformation(selectedFile.type).readableType)))),
|
|
53
|
+
selectedFiles.length > 1 && React.createElement("div", { className: "items" }, selectedFiles.map((file) => renderFileCard(file))))) : null;
|
|
54
|
+
};
|
|
55
|
+
export default memo(Dropzone);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ValidationError } from ".";
|
|
3
|
+
interface IProps {
|
|
4
|
+
type: "list" | "grid";
|
|
5
|
+
direction?: "row" | "column";
|
|
6
|
+
selectedFiles: File[];
|
|
7
|
+
validationErrors?: ValidationError[];
|
|
8
|
+
handleFileToBase64: (file: File) => Promise<string>;
|
|
9
|
+
handleFileRemove: (fileToRemove: File) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ type, direction, selectedFiles, validationErrors, handleFileToBase64, handleFileRemove, }: IProps) => React.JSX.Element>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import { ARIcon } from "../../icons";
|
|
3
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
4
|
+
import Buttons from "./Buttons";
|
|
5
|
+
const List = ({ type, direction = "row", selectedFiles, validationErrors = [], handleFileToBase64, handleFileRemove, }) => {
|
|
6
|
+
return (React.createElement("ul", { className: `${type} ${direction}` }, selectedFiles.map((selectedFile) => {
|
|
7
|
+
const message = validationErrors.find((v) => v.fileName === selectedFile.name)?.message;
|
|
8
|
+
return (React.createElement("li", { key: selectedFile.name },
|
|
9
|
+
message && (React.createElement("div", { className: "error" },
|
|
10
|
+
React.createElement(ARIcon, { icon: "ExclamationDiamond-Fill", fill: "var(--white)" }),
|
|
11
|
+
React.createElement("span", null, message))),
|
|
12
|
+
React.createElement(Buttons, { selectedFile: selectedFile, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
|
|
13
|
+
React.createElement("span", { className: "file-name" }, selectedFile.name),
|
|
14
|
+
React.createElement("div", null,
|
|
15
|
+
React.createElement("span", { className: "file-size" },
|
|
16
|
+
(selectedFile.size / 1024).toFixed(3),
|
|
17
|
+
React.createElement("span", { className: "size-type" }, "KB")),
|
|
18
|
+
React.createElement("span", { className: "file-type" }, Utils.GetFileTypeInformation(selectedFile.type).readableType))));
|
|
19
|
+
})));
|
|
20
|
+
};
|
|
21
|
+
export default memo(List);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MimeTypes } from "../../../libs/infrastructure/types";
|
|
2
|
+
import { IDisabledProps, ISizeProps, IValidationProps } from "../../../libs/infrastructure/types/IGlobalProps";
|
|
3
|
+
interface IMultiple {
|
|
4
|
+
files: File[];
|
|
5
|
+
onChange: (formData: FormData, files: File[], base64: string[], isInvalidFileExist: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
type Props = {
|
|
8
|
+
text: string;
|
|
9
|
+
allowedTypes?: MimeTypes[];
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
type?: "list" | "grid" | "dropzone";
|
|
12
|
+
direction?: "row" | "column";
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
} & IMultiple & ISizeProps & IValidationProps & IDisabledProps;
|
|
16
|
+
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Props from "./Props";
|
|
3
|
+
import "../../../assets/css/components/form/upload/styles.css";
|
|
4
|
+
export type ValidationError = {
|
|
5
|
+
fileName: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
declare const Upload: React.FC<Props>;
|
|
9
|
+
export default Upload;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import "../../../assets/css/components/form/upload/styles.css";
|
|
4
|
+
import { ARIcon } from "../../icons";
|
|
5
|
+
import Dropzone from "./Dropzone";
|
|
6
|
+
import Button from "../button";
|
|
7
|
+
import List from "./List";
|
|
8
|
+
import Utils from "../../../libs/infrastructure/shared/Utils";
|
|
9
|
+
const Upload = ({ text, files, onChange, allowedTypes, maxSize, type = "list", direction = "column", size, fullWidth, multiple, }) => {
|
|
10
|
+
// refs
|
|
11
|
+
const _input = useRef(null);
|
|
12
|
+
const _arUplaod = useRef(null);
|
|
13
|
+
// refs -> File Data
|
|
14
|
+
const _validationErrors = useRef([]);
|
|
15
|
+
// variables
|
|
16
|
+
const [className, setClassName] = useState(["button"]);
|
|
17
|
+
// states
|
|
18
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
19
|
+
const [validationErrors, setValidationErrors] = useState([]);
|
|
20
|
+
// methods
|
|
21
|
+
const handleFileChange = useCallback((files) => {
|
|
22
|
+
const _files = Array.from(files ?? []);
|
|
23
|
+
setSelectedFiles((prev) => {
|
|
24
|
+
if (!multiple)
|
|
25
|
+
return _files;
|
|
26
|
+
const previousFileNames = prev.map((f) => f.name);
|
|
27
|
+
const newFiles = _files.filter((f) => !previousFileNames.includes(f.name)) ?? [];
|
|
28
|
+
return [...prev, ...newFiles];
|
|
29
|
+
});
|
|
30
|
+
}, [multiple]);
|
|
31
|
+
const handleFileRemove = useCallback((fileToRemove) => {
|
|
32
|
+
setSelectedFiles((prev) => {
|
|
33
|
+
const newList = prev.filter((x) => x.name !== fileToRemove.name);
|
|
34
|
+
if (newList.length === 0)
|
|
35
|
+
setClassName((prev) => prev.filter((c) => c !== "has-file"));
|
|
36
|
+
return newList;
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
const validateFile = useCallback((file) => {
|
|
40
|
+
const newErrors = [];
|
|
41
|
+
if (allowedTypes) {
|
|
42
|
+
if (!allowedTypes.includes(file.type)) {
|
|
43
|
+
newErrors.push({ fileName: file.name, message: "Geçersiz dosya türü." });
|
|
44
|
+
_validationErrors.current.push(file.name);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (maxSize) {
|
|
48
|
+
const _maxSize = maxSize * 1024 * 1024; // MB
|
|
49
|
+
if (file.size > _maxSize) {
|
|
50
|
+
newErrors.push({ fileName: file.name, message: "Dosya boyutu çok büyük." });
|
|
51
|
+
_validationErrors.current.push(file.name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
setValidationErrors((prev) => [...prev, ...newErrors]);
|
|
55
|
+
}, [allowedTypes, maxSize]);
|
|
56
|
+
const handleFileToBase64 = useCallback((file) => {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
const reader = new FileReader();
|
|
59
|
+
reader.onload = () => {
|
|
60
|
+
if (reader.result && typeof reader.result === "string") {
|
|
61
|
+
resolve(reader.result);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
reject(new Error("Failed to read the file"));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
reader.onerror = reject;
|
|
68
|
+
reader.readAsDataURL(file);
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
71
|
+
const handleDrag = useCallback((e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
if (e.type === "dragenter" || e.type === "dragover") {
|
|
75
|
+
setClassName((prev) => {
|
|
76
|
+
const index = prev.findIndex((c) => c === "dragging");
|
|
77
|
+
if (index === -1)
|
|
78
|
+
return [...prev, "dragging"];
|
|
79
|
+
return prev;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
setClassName((prev) => prev.filter((c) => c !== "dragging"));
|
|
84
|
+
}
|
|
85
|
+
}, []);
|
|
86
|
+
const handleDrop = useCallback((e) => {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
const files = e.dataTransfer.files;
|
|
90
|
+
if (files && files.length > 0)
|
|
91
|
+
handleFileChange(files);
|
|
92
|
+
setClassName((prev) => prev.filter((c) => c !== "dragging"));
|
|
93
|
+
}, [handleFileChange]);
|
|
94
|
+
const renderUploadFile = (params) => {
|
|
95
|
+
return (React.createElement("div", { ref: _arUplaod, className: "ar-upload" },
|
|
96
|
+
React.createElement("input", { ref: _input, type: "file", onChange: (event) => handleFileChange(event.target.files), multiple: multiple }),
|
|
97
|
+
params.children));
|
|
98
|
+
};
|
|
99
|
+
// useEffects
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
let isMounted = true;
|
|
102
|
+
(async () => {
|
|
103
|
+
const dataTransfer = new DataTransfer();
|
|
104
|
+
const fileFormData = new FormData();
|
|
105
|
+
setValidationErrors([]);
|
|
106
|
+
_validationErrors.current = [];
|
|
107
|
+
if (_input.current) {
|
|
108
|
+
if (selectedFiles.length === 0) {
|
|
109
|
+
if (_input.current)
|
|
110
|
+
_input.current.files = dataTransfer.files;
|
|
111
|
+
onChange(fileFormData, [], [], false);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Seçilmiş olan dosyalar validasyona gönderiliyor.
|
|
115
|
+
selectedFiles.forEach((f) => validateFile(f));
|
|
116
|
+
const inValidFiles = Array.from(new Set(_validationErrors.current));
|
|
117
|
+
// Input içerisine dosyalar aktarılıyor.
|
|
118
|
+
selectedFiles.forEach((f) => dataTransfer.items.add(f));
|
|
119
|
+
_input.current.files = dataTransfer.files;
|
|
120
|
+
// Geçerli olan dosyalar alındı...
|
|
121
|
+
const validFiles = [...selectedFiles.filter((x) => !inValidFiles.includes(x.name))];
|
|
122
|
+
validFiles.forEach((f) => fileFormData.append("file", f));
|
|
123
|
+
// Geçerli olan dosyalar base64'e dönüştürülüyor...
|
|
124
|
+
const base64Array = await Promise.all(validFiles.map((validFile) => handleFileToBase64(validFile)));
|
|
125
|
+
if (isMounted) {
|
|
126
|
+
onChange(fileFormData, validFiles, base64Array, _validationErrors.current.length === 0);
|
|
127
|
+
}
|
|
128
|
+
// Eğer dosya varsa.
|
|
129
|
+
setClassName((prev) => {
|
|
130
|
+
const index = prev.findIndex((c) => c === "has-file");
|
|
131
|
+
if (index === -1)
|
|
132
|
+
return [...prev, "has-file"];
|
|
133
|
+
return prev;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
})();
|
|
137
|
+
return () => {
|
|
138
|
+
isMounted = false;
|
|
139
|
+
};
|
|
140
|
+
}, [selectedFiles]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (Utils.DeepEqual(files, selectedFiles))
|
|
143
|
+
return;
|
|
144
|
+
setSelectedFiles(files);
|
|
145
|
+
}, [files]);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (type === "dropzone")
|
|
148
|
+
setClassName((prev) => [...prev, "dropzone"]);
|
|
149
|
+
}, [type]);
|
|
150
|
+
switch (type) {
|
|
151
|
+
case "list":
|
|
152
|
+
case "grid":
|
|
153
|
+
return renderUploadFile({
|
|
154
|
+
children: (React.createElement(React.Fragment, null,
|
|
155
|
+
React.createElement(Button, { type: "button", variant: "outlined", color: "gray", icon: { element: React.createElement(ARIcon, { icon: "CloudUpload-Fill" }) }, onClick: () => {
|
|
156
|
+
if (_input.current)
|
|
157
|
+
_input.current.click();
|
|
158
|
+
}, fullWidth: fullWidth, size: size }, text && React.createElement("span", null, text)),
|
|
159
|
+
React.createElement(List, { type: type, direction: direction, selectedFiles: selectedFiles ?? [], validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }))),
|
|
160
|
+
});
|
|
161
|
+
case "dropzone":
|
|
162
|
+
return renderUploadFile({
|
|
163
|
+
children: (React.createElement("div", { className: "ar-upload-button" },
|
|
164
|
+
React.createElement("div", { className: className.map((c) => c).join(" "), onDragEnter: handleDrag, onDragLeave: handleDrag, onDragOver: handleDrag, onDrop: handleDrop, onClick: () => {
|
|
165
|
+
if (_input.current)
|
|
166
|
+
_input.current.click();
|
|
167
|
+
} },
|
|
168
|
+
React.createElement(Dropzone, { selectedFiles: selectedFiles ?? [], validationErrors: validationErrors, handleFileToBase64: handleFileToBase64, handleFileRemove: handleFileRemove }),
|
|
169
|
+
selectedFiles && selectedFiles.length === 0 && (React.createElement(React.Fragment, null,
|
|
170
|
+
React.createElement("div", { className: "upload" },
|
|
171
|
+
React.createElement(ARIcon, { icon: "CloudUpload-Fill", size: 32 }),
|
|
172
|
+
React.createElement("div", { className: "properies" },
|
|
173
|
+
allowedTypes && (React.createElement("div", { className: "allow-types" }, allowedTypes?.map((allowedType) => allowedType.split("/")[1].toLocaleUpperCase()).join(", "))),
|
|
174
|
+
maxSize && React.createElement("div", { className: "max-size" },
|
|
175
|
+
"up to ",
|
|
176
|
+
maxSize,
|
|
177
|
+
"MB"))),
|
|
178
|
+
text && React.createElement("span", null, text)))))),
|
|
179
|
+
});
|
|
180
|
+
default:
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
export default Upload;
|