@wealthx/ui 1.0.0 → 1.0.1
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/.turbo/turbo-build.log +359 -14
- package/CHANGELOG.md +3 -7
- package/dist/accordion-details.d.mts +7 -0
- package/dist/accordion-details.d.ts +7 -0
- package/dist/accordion-details.js +62 -0
- package/dist/accordion-details.mjs +17 -0
- package/dist/accordion-summary.d.mts +7 -0
- package/dist/accordion-summary.d.ts +7 -0
- package/dist/accordion-summary.js +62 -0
- package/dist/accordion-summary.mjs +17 -0
- package/dist/accordion.d.mts +7 -0
- package/dist/accordion.d.ts +7 -0
- package/dist/accordion.js +62 -0
- package/dist/accordion.mjs +17 -0
- package/dist/alert.d.mts +7 -0
- package/dist/alert.d.ts +7 -0
- package/dist/alert.js +62 -0
- package/dist/alert.mjs +17 -0
- package/dist/app-bar.d.mts +7 -0
- package/dist/app-bar.d.ts +7 -0
- package/dist/app-bar.js +62 -0
- package/dist/app-bar.mjs +17 -0
- package/dist/autocomplete.d.mts +7 -0
- package/dist/autocomplete.d.ts +7 -0
- package/dist/autocomplete.js +62 -0
- package/dist/autocomplete.mjs +17 -0
- package/dist/avatar.d.mts +7 -0
- package/dist/avatar.d.ts +7 -0
- package/dist/avatar.js +62 -0
- package/dist/avatar.mjs +17 -0
- package/dist/backdrop.d.mts +7 -0
- package/dist/backdrop.d.ts +7 -0
- package/dist/backdrop.js +62 -0
- package/dist/backdrop.mjs +17 -0
- package/dist/badge.d.mts +7 -0
- package/dist/badge.d.ts +7 -0
- package/dist/badge.js +62 -0
- package/dist/badge.mjs +17 -0
- package/dist/bottom-navigation-action.d.mts +7 -0
- package/dist/bottom-navigation-action.d.ts +7 -0
- package/dist/bottom-navigation-action.js +62 -0
- package/dist/bottom-navigation-action.mjs +17 -0
- package/dist/bottom-navigation.d.mts +7 -0
- package/dist/bottom-navigation.d.ts +7 -0
- package/dist/bottom-navigation.js +62 -0
- package/dist/bottom-navigation.mjs +17 -0
- package/dist/box.d.mts +7 -0
- package/dist/box.d.ts +7 -0
- package/dist/box.js +62 -0
- package/dist/box.mjs +17 -0
- package/dist/breadcrumbs.d.mts +7 -0
- package/dist/breadcrumbs.d.ts +7 -0
- package/dist/breadcrumbs.js +62 -0
- package/dist/breadcrumbs.mjs +17 -0
- package/dist/button-group.d.mts +7 -0
- package/dist/button-group.d.ts +7 -0
- package/dist/button-group.js +62 -0
- package/dist/button-group.mjs +17 -0
- package/dist/button.d.mts +2 -4
- package/dist/button.d.ts +2 -4
- package/dist/button.js +6 -3
- package/dist/button.mjs +7 -4
- package/dist/card-actions.d.mts +7 -0
- package/dist/card-actions.d.ts +7 -0
- package/dist/card-actions.js +62 -0
- package/dist/card-actions.mjs +17 -0
- package/dist/card-content.d.mts +7 -0
- package/dist/card-content.d.ts +7 -0
- package/dist/card-content.js +62 -0
- package/dist/card-content.mjs +17 -0
- package/dist/card-header.d.mts +7 -0
- package/dist/card-header.d.ts +7 -0
- package/dist/card-header.js +62 -0
- package/dist/card-header.mjs +17 -0
- package/dist/card-media.d.mts +7 -0
- package/dist/card-media.d.ts +7 -0
- package/dist/card-media.js +62 -0
- package/dist/card-media.mjs +17 -0
- package/dist/card.d.mts +7 -0
- package/dist/card.d.ts +7 -0
- package/dist/card.js +62 -0
- package/dist/card.mjs +17 -0
- package/dist/charts/index.d.mts +260 -0
- package/dist/charts/index.d.ts +260 -0
- package/dist/charts/index.js +2514 -0
- package/dist/charts/index.mjs +2442 -0
- package/dist/checkbox.d.mts +9 -0
- package/dist/checkbox.d.ts +9 -0
- package/dist/checkbox.js +62 -0
- package/dist/checkbox.mjs +17 -0
- package/dist/chip.d.mts +7 -0
- package/dist/chip.d.ts +7 -0
- package/dist/chip.js +62 -0
- package/dist/chip.mjs +17 -0
- package/dist/chunk-2VVJGTUG.mjs +18 -0
- package/dist/chunk-3INC3CHA.mjs +702 -0
- package/dist/chunk-3LGY4LPH.mjs +671 -0
- package/dist/chunk-3ZAK7JKB.mjs +17 -0
- package/dist/chunk-4PT5CSRI.mjs +635 -0
- package/dist/chunk-4RSXKKJ3.mjs +677 -0
- package/dist/chunk-4YL3IDTL.mjs +712 -0
- package/dist/chunk-5PTI2A2O.mjs +635 -0
- package/dist/chunk-5QGN2CVX.mjs +738 -0
- package/dist/chunk-5WVSR7VI.mjs +30 -0
- package/dist/chunk-6XKA7TMO.mjs +654 -0
- package/dist/chunk-75AEPNQV.mjs +663 -0
- package/dist/chunk-7VN5YMMV.mjs +666 -0
- package/dist/chunk-7Y4J73GF.mjs +22 -0
- package/dist/chunk-A4GTTYXS.mjs +725 -0
- package/dist/chunk-A6UVH2MS.mjs +638 -0
- package/dist/chunk-AFUVAGQ7.mjs +717 -0
- package/dist/chunk-AU6MS36I.mjs +687 -0
- package/dist/chunk-AZ4T75GP.mjs +716 -0
- package/dist/chunk-B26DAG54.mjs +729 -0
- package/dist/chunk-B6MLUNDY.mjs +641 -0
- package/dist/chunk-BEP42F7C.mjs +704 -0
- package/dist/chunk-CDQYIC4L.mjs +638 -0
- package/dist/chunk-CJ5XEQAB.mjs +707 -0
- package/dist/chunk-CLRGEEBS.mjs +695 -0
- package/dist/chunk-EDDP4RXX.mjs +731 -0
- package/dist/chunk-EYFZ6Q2I.mjs +30 -0
- package/dist/chunk-EZEFJ62V.mjs +723 -0
- package/dist/chunk-F3Y22UH3.mjs +704 -0
- package/dist/chunk-FCUQVOXM.mjs +707 -0
- package/dist/chunk-FMFAYI6F.mjs +727 -0
- package/dist/chunk-FYHAFWVF.mjs +719 -0
- package/dist/chunk-G5LVCGAZ.mjs +715 -0
- package/dist/chunk-GC7M6Q7Q.mjs +712 -0
- package/dist/chunk-GJP3ZHQZ.mjs +712 -0
- package/dist/chunk-GTCMGRVH.mjs +576 -0
- package/dist/chunk-GXYSMEFL.mjs +704 -0
- package/dist/chunk-GYEEDPWP.mjs +646 -0
- package/dist/chunk-H5JOUGZ7.mjs +7 -0
- package/dist/chunk-HAXRNHML.mjs +17 -0
- package/dist/chunk-HGDOFGU4.mjs +717 -0
- package/dist/chunk-HR7CZZZU.mjs +34 -0
- package/dist/chunk-I5H76ESF.mjs +671 -0
- package/dist/chunk-IIBNCIGO.mjs +713 -0
- package/dist/chunk-INHKGMOA.mjs +705 -0
- package/dist/chunk-ISFJIOTZ.mjs +668 -0
- package/dist/chunk-IU4IZB74.mjs +729 -0
- package/dist/chunk-IXJXFW7K.mjs +712 -0
- package/dist/chunk-JUNAYNXW.mjs +667 -0
- package/dist/chunk-K2Z5MFPN.mjs +717 -0
- package/dist/chunk-KJDBWFV4.mjs +15 -0
- package/dist/chunk-KOR3RFXT.mjs +616 -0
- package/dist/chunk-KRCDJE37.mjs +616 -0
- package/dist/chunk-KX3KGQM5.mjs +704 -0
- package/dist/chunk-MJF7PMCN.mjs +713 -0
- package/dist/chunk-MSMSEKLJ.mjs +727 -0
- package/dist/chunk-MWVIJSXF.mjs +723 -0
- package/dist/chunk-MZ6NCHFH.mjs +712 -0
- package/dist/chunk-NHR5EVP5.mjs +34 -0
- package/dist/chunk-NLOG75HP.mjs +712 -0
- package/dist/chunk-NPIFU7NP.mjs +717 -0
- package/dist/chunk-NUTTLEFB.mjs +675 -0
- package/dist/chunk-P3F3JWWN.mjs +707 -0
- package/dist/chunk-PPGJLNI5.mjs +704 -0
- package/dist/chunk-PUPP26OX.mjs +707 -0
- package/dist/chunk-Q43USMAB.mjs +638 -0
- package/dist/chunk-QUYESF5V.mjs +706 -0
- package/dist/chunk-R4NJDEQL.mjs +686 -0
- package/dist/chunk-RE7K3H64.mjs +707 -0
- package/dist/chunk-RIDPXVXH.mjs +706 -0
- package/dist/chunk-RQIAE3MB.mjs +721 -0
- package/dist/chunk-RRYH5A6K.mjs +727 -0
- package/dist/chunk-RTUIKVKP.mjs +705 -0
- package/dist/chunk-RYZ2UYKN.mjs +707 -0
- package/dist/chunk-S37HUFPH.mjs +719 -0
- package/dist/chunk-S4TZORUT.mjs +708 -0
- package/dist/chunk-SOMFG24T.mjs +675 -0
- package/dist/chunk-SP3LL4DC.mjs +704 -0
- package/dist/chunk-TJZXXGH3.mjs +641 -0
- package/dist/chunk-TWFYWUDV.mjs +707 -0
- package/dist/chunk-U2JQUQ2B.mjs +712 -0
- package/dist/chunk-UCFJXIGR.mjs +671 -0
- package/dist/chunk-UFKECQBD.mjs +736 -0
- package/dist/chunk-UNZHSAWG.mjs +704 -0
- package/dist/chunk-UORPGX7S.mjs +637 -0
- package/dist/chunk-VA7BMOMQ.mjs +712 -0
- package/dist/chunk-VKJEODYN.mjs +705 -0
- package/dist/chunk-VST6TRHA.mjs +15 -0
- package/dist/chunk-VSTSMCNW.mjs +169 -0
- package/dist/chunk-W35RLK2G.mjs +714 -0
- package/dist/chunk-WLX3YEFG.mjs +713 -0
- package/dist/chunk-WUKYLWAZ.mjs +0 -0
- package/dist/chunk-XJFQ6VLH.mjs +676 -0
- package/dist/chunk-XUAVHHPE.mjs +715 -0
- package/dist/chunk-YHEJWFKH.mjs +711 -0
- package/dist/chunk-YJ5Q4Z6X.mjs +37 -0
- package/dist/chunk-YMWHUJU5.mjs +15 -0
- package/dist/chunk-YNFJJWV4.mjs +712 -0
- package/dist/chunk-YOEKQLSM.mjs +715 -0
- package/dist/chunk-ZIIKFFIL.mjs +21 -0
- package/dist/chunk-ZLBX4R5M.mjs +711 -0
- package/dist/container.d.mts +7 -0
- package/dist/container.d.ts +7 -0
- package/dist/container.js +62 -0
- package/dist/container.mjs +17 -0
- package/dist/dialog-actions.d.mts +7 -0
- package/dist/dialog-actions.d.ts +7 -0
- package/dist/dialog-actions.js +62 -0
- package/dist/dialog-actions.mjs +17 -0
- package/dist/dialog-content.d.mts +7 -0
- package/dist/dialog-content.d.ts +7 -0
- package/dist/dialog-content.js +62 -0
- package/dist/dialog-content.mjs +17 -0
- package/dist/dialog-title.d.mts +7 -0
- package/dist/dialog-title.d.ts +7 -0
- package/dist/dialog-title.js +62 -0
- package/dist/dialog-title.mjs +17 -0
- package/dist/dialog.d.mts +7 -0
- package/dist/dialog.d.ts +7 -0
- package/dist/dialog.js +62 -0
- package/dist/dialog.mjs +17 -0
- package/dist/divider.d.mts +7 -0
- package/dist/divider.d.ts +7 -0
- package/dist/divider.js +62 -0
- package/dist/divider.mjs +17 -0
- package/dist/drawer.d.mts +7 -0
- package/dist/drawer.d.ts +7 -0
- package/dist/drawer.js +62 -0
- package/dist/drawer.mjs +17 -0
- package/dist/fab.d.mts +7 -0
- package/dist/fab.d.ts +7 -0
- package/dist/fab.js +62 -0
- package/dist/fab.mjs +17 -0
- package/dist/form-control.d.mts +7 -0
- package/dist/form-control.d.ts +7 -0
- package/dist/form-control.js +62 -0
- package/dist/form-control.mjs +17 -0
- package/dist/grid.d.mts +7 -0
- package/dist/grid.d.ts +7 -0
- package/dist/grid.js +62 -0
- package/dist/grid.mjs +17 -0
- package/dist/icon-button.d.mts +7 -0
- package/dist/icon-button.d.ts +7 -0
- package/dist/icon-button.js +62 -0
- package/dist/icon-button.mjs +17 -0
- package/dist/image-list-item.d.mts +7 -0
- package/dist/image-list-item.d.ts +7 -0
- package/dist/image-list-item.js +62 -0
- package/dist/image-list-item.mjs +17 -0
- package/dist/image-list.d.mts +7 -0
- package/dist/image-list.d.ts +7 -0
- package/dist/image-list.js +62 -0
- package/dist/image-list.mjs +17 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +697 -0
- package/dist/index.mjs +61 -0
- package/dist/input-label.d.mts +7 -0
- package/dist/input-label.d.ts +7 -0
- package/dist/input-label.js +62 -0
- package/dist/input-label.mjs +17 -0
- package/dist/link.d.mts +7 -0
- package/dist/link.d.ts +7 -0
- package/dist/link.js +62 -0
- package/dist/link.mjs +17 -0
- package/dist/list-item-icon.d.mts +7 -0
- package/dist/list-item-icon.d.ts +7 -0
- package/dist/list-item-icon.js +62 -0
- package/dist/list-item-icon.mjs +17 -0
- package/dist/list-item-text.d.mts +7 -0
- package/dist/list-item-text.d.ts +7 -0
- package/dist/list-item-text.js +62 -0
- package/dist/list-item-text.mjs +17 -0
- package/dist/list-item.d.mts +7 -0
- package/dist/list-item.d.ts +7 -0
- package/dist/list-item.js +62 -0
- package/dist/list-item.mjs +17 -0
- package/dist/list.d.mts +7 -0
- package/dist/list.d.ts +7 -0
- package/dist/list.js +62 -0
- package/dist/list.mjs +17 -0
- package/dist/masonry.d.mts +7 -0
- package/dist/masonry.d.ts +7 -0
- package/dist/masonry.js +62 -0
- package/dist/masonry.mjs +17 -0
- package/dist/menu-item.d.mts +7 -0
- package/dist/menu-item.d.ts +7 -0
- package/dist/menu-item.js +62 -0
- package/dist/menu-item.mjs +17 -0
- package/dist/menu.d.mts +7 -0
- package/dist/menu.d.ts +7 -0
- package/dist/menu.js +62 -0
- package/dist/menu.mjs +17 -0
- package/dist/mui-augmentation-DKlyQ0kQ.d.mts +19 -0
- package/dist/mui-augmentation-DKlyQ0kQ.d.ts +19 -0
- package/dist/pagination.d.mts +7 -0
- package/dist/pagination.d.ts +7 -0
- package/dist/pagination.js +62 -0
- package/dist/pagination.mjs +17 -0
- package/dist/paper.d.mts +7 -0
- package/dist/paper.d.ts +7 -0
- package/dist/paper.js +62 -0
- package/dist/paper.mjs +17 -0
- package/dist/progress.d.mts +10 -0
- package/dist/progress.d.ts +10 -0
- package/dist/progress.js +71 -0
- package/dist/progress.mjs +25 -0
- package/dist/radio-group.d.mts +7 -0
- package/dist/radio-group.d.ts +7 -0
- package/dist/radio-group.js +62 -0
- package/dist/radio-group.mjs +17 -0
- package/dist/radio.d.mts +10 -0
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +62 -0
- package/dist/radio.mjs +18 -0
- package/dist/rating.d.mts +7 -0
- package/dist/rating.d.ts +7 -0
- package/dist/rating.js +62 -0
- package/dist/rating.mjs +17 -0
- package/dist/select.d.mts +7 -0
- package/dist/select.d.ts +7 -0
- package/dist/select.js +62 -0
- package/dist/select.mjs +17 -0
- package/dist/selection-button-group.d.mts +16 -0
- package/dist/selection-button-group.d.ts +16 -0
- package/dist/selection-button-group.js +109 -0
- package/dist/selection-button-group.mjs +42 -0
- package/dist/skeleton.d.mts +7 -0
- package/dist/skeleton.d.ts +7 -0
- package/dist/skeleton.js +62 -0
- package/dist/skeleton.mjs +17 -0
- package/dist/slider.d.mts +7 -0
- package/dist/slider.d.ts +7 -0
- package/dist/slider.js +62 -0
- package/dist/slider.mjs +17 -0
- package/dist/snackbar.d.mts +7 -0
- package/dist/snackbar.d.ts +7 -0
- package/dist/snackbar.js +62 -0
- package/dist/snackbar.mjs +17 -0
- package/dist/speed-dial-action.d.mts +7 -0
- package/dist/speed-dial-action.d.ts +7 -0
- package/dist/speed-dial-action.js +62 -0
- package/dist/speed-dial-action.mjs +17 -0
- package/dist/speed-dial.d.mts +7 -0
- package/dist/speed-dial.d.ts +7 -0
- package/dist/speed-dial.js +62 -0
- package/dist/speed-dial.mjs +17 -0
- package/dist/stack.d.mts +7 -0
- package/dist/stack.d.ts +7 -0
- package/dist/stack.js +62 -0
- package/dist/stack.mjs +17 -0
- package/dist/step-content.d.mts +7 -0
- package/dist/step-content.d.ts +7 -0
- package/dist/step-content.js +62 -0
- package/dist/step-content.mjs +17 -0
- package/dist/step-label.d.mts +7 -0
- package/dist/step-label.d.ts +7 -0
- package/dist/step-label.js +62 -0
- package/dist/step-label.mjs +17 -0
- package/dist/step.d.mts +7 -0
- package/dist/step.d.ts +7 -0
- package/dist/step.js +62 -0
- package/dist/step.mjs +17 -0
- package/dist/stepper.d.mts +7 -0
- package/dist/stepper.d.ts +7 -0
- package/dist/stepper.js +62 -0
- package/dist/stepper.mjs +17 -0
- package/dist/switch.d.mts +10 -0
- package/dist/switch.d.ts +10 -0
- package/dist/switch.js +62 -0
- package/dist/switch.mjs +18 -0
- package/dist/tab-context.d.mts +9 -0
- package/dist/tab-context.d.ts +9 -0
- package/dist/tab-context.js +59 -0
- package/dist/tab-context.mjs +14 -0
- package/dist/tab-list.d.mts +7 -0
- package/dist/tab-list.d.ts +7 -0
- package/dist/tab-list.js +62 -0
- package/dist/tab-list.mjs +17 -0
- package/dist/tab-panel.d.mts +7 -0
- package/dist/tab-panel.d.ts +7 -0
- package/dist/tab-panel.js +62 -0
- package/dist/tab-panel.mjs +17 -0
- package/dist/tab.d.mts +7 -0
- package/dist/tab.d.ts +7 -0
- package/dist/tab.js +62 -0
- package/dist/tab.mjs +17 -0
- package/dist/table-body.d.mts +7 -0
- package/dist/table-body.d.ts +7 -0
- package/dist/table-body.js +62 -0
- package/dist/table-body.mjs +17 -0
- package/dist/table-cell.d.mts +7 -0
- package/dist/table-cell.d.ts +7 -0
- package/dist/table-cell.js +62 -0
- package/dist/table-cell.mjs +17 -0
- package/dist/table-container.d.mts +7 -0
- package/dist/table-container.d.ts +7 -0
- package/dist/table-container.js +62 -0
- package/dist/table-container.mjs +17 -0
- package/dist/table-head.d.mts +7 -0
- package/dist/table-head.d.ts +7 -0
- package/dist/table-head.js +62 -0
- package/dist/table-head.mjs +17 -0
- package/dist/table-row.d.mts +7 -0
- package/dist/table-row.d.ts +7 -0
- package/dist/table-row.js +62 -0
- package/dist/table-row.mjs +17 -0
- package/dist/table.d.mts +7 -0
- package/dist/table.d.ts +7 -0
- package/dist/table.js +62 -0
- package/dist/table.mjs +17 -0
- package/dist/tabs.d.mts +7 -0
- package/dist/tabs.d.ts +7 -0
- package/dist/tabs.js +62 -0
- package/dist/tabs.mjs +17 -0
- package/dist/text-field.d.mts +8 -0
- package/dist/text-field.d.ts +8 -0
- package/dist/text-field.js +62 -0
- package/dist/text-field.mjs +17 -0
- package/dist/theme/index.d.mts +14 -5
- package/dist/theme/index.d.ts +14 -5
- package/dist/theme/index.js +128 -4
- package/dist/theme/index.mjs +33 -586
- package/dist/timeline-connector.d.mts +7 -0
- package/dist/timeline-connector.d.ts +7 -0
- package/dist/timeline-connector.js +62 -0
- package/dist/timeline-connector.mjs +17 -0
- package/dist/timeline-content.d.mts +7 -0
- package/dist/timeline-content.d.ts +7 -0
- package/dist/timeline-content.js +62 -0
- package/dist/timeline-content.mjs +17 -0
- package/dist/timeline-dot.d.mts +7 -0
- package/dist/timeline-dot.d.ts +7 -0
- package/dist/timeline-dot.js +62 -0
- package/dist/timeline-dot.mjs +17 -0
- package/dist/timeline-item.d.mts +7 -0
- package/dist/timeline-item.d.ts +7 -0
- package/dist/timeline-item.js +62 -0
- package/dist/timeline-item.mjs +17 -0
- package/dist/timeline-separator.d.mts +7 -0
- package/dist/timeline-separator.d.ts +7 -0
- package/dist/timeline-separator.js +62 -0
- package/dist/timeline-separator.mjs +17 -0
- package/dist/timeline.d.mts +7 -0
- package/dist/timeline.d.ts +7 -0
- package/dist/timeline.js +62 -0
- package/dist/timeline.mjs +17 -0
- package/dist/toggle-button-group.d.mts +14 -0
- package/dist/toggle-button-group.d.ts +14 -0
- package/dist/toggle-button-group.js +90 -0
- package/dist/toggle-button-group.mjs +32 -0
- package/dist/toggle-button.d.mts +8 -0
- package/dist/toggle-button.d.ts +8 -0
- package/dist/toggle-button.js +62 -0
- package/dist/toggle-button.mjs +8 -0
- package/dist/tooltip.d.mts +7 -0
- package/dist/tooltip.d.ts +7 -0
- package/dist/tooltip.js +62 -0
- package/dist/tooltip.mjs +17 -0
- package/dist/typography.d.mts +7 -0
- package/dist/typography.d.ts +7 -0
- package/dist/typography.js +62 -0
- package/dist/typography.mjs +17 -0
- package/package.json +439 -7
- package/src/accordion-details.tsx +14 -0
- package/src/accordion-summary.tsx +14 -0
- package/src/accordion.tsx +14 -0
- package/src/alert.tsx +12 -0
- package/src/app-bar.tsx +12 -0
- package/src/autocomplete.tsx +26 -0
- package/src/avatar.tsx +12 -0
- package/src/backdrop.tsx +14 -0
- package/src/badge.tsx +12 -0
- package/src/bottom-navigation-action.tsx +14 -0
- package/src/bottom-navigation.tsx +14 -0
- package/src/box.tsx +12 -0
- package/src/breadcrumbs.tsx +14 -0
- package/src/button-group.tsx +14 -0
- package/src/button.tsx +9 -4
- package/src/card-actions.tsx +14 -0
- package/src/card-content.tsx +14 -0
- package/src/card-header.tsx +14 -0
- package/src/card-media.tsx +14 -0
- package/src/card.tsx +12 -0
- package/src/charts/BackofficeSwitchableChart.tsx +325 -0
- package/src/charts/FrontendBarChart.tsx +134 -0
- package/src/charts/FrontendDoughnutChart.tsx +372 -0
- package/src/charts/FrontendIncomeExpenseHorizontalBarChart.tsx +138 -0
- package/src/charts/FrontendLiabilitiesChart.tsx +97 -0
- package/src/charts/FrontendLineChart.tsx +299 -0
- package/src/charts/FrontendLineChartMobile.tsx +383 -0
- package/src/charts/FrontendMixedChart.tsx +264 -0
- package/src/charts/FrontendPercentageBar.tsx +247 -0
- package/src/charts/FrontendScenarioLineChart.tsx +308 -0
- package/src/charts/FrontendStackedChart.tsx +184 -0
- package/src/charts/LoadingChartBackdrop.tsx +32 -0
- package/src/charts/chart-utils.ts +58 -0
- package/src/charts/index.ts +59 -0
- package/src/charts/mock-data.ts +153 -0
- package/src/checkbox.tsx +16 -0
- package/src/chip.tsx +12 -0
- package/src/container.tsx +14 -0
- package/src/dialog-actions.tsx +14 -0
- package/src/dialog-content.tsx +14 -0
- package/src/dialog-title.tsx +14 -0
- package/src/dialog.tsx +12 -0
- package/src/divider.tsx +12 -0
- package/src/drawer.tsx +12 -0
- package/src/fab.tsx +12 -0
- package/src/form-control.tsx +14 -0
- package/src/grid.tsx +12 -0
- package/src/icon-button.tsx +14 -0
- package/src/image-list-item.tsx +14 -0
- package/src/image-list.tsx +14 -0
- package/src/input-label.tsx +14 -0
- package/src/link.tsx +12 -0
- package/src/list-item-icon.tsx +14 -0
- package/src/list-item-text.tsx +14 -0
- package/src/list-item.tsx +14 -0
- package/src/list.tsx +12 -0
- package/src/masonry.tsx +14 -0
- package/src/menu-item.tsx +14 -0
- package/src/menu.tsx +12 -0
- package/src/mui-augmentation.ts +23 -0
- package/src/pagination.tsx +14 -0
- package/src/paper.tsx +12 -0
- package/src/progress.tsx +25 -0
- package/src/radio-group.tsx +14 -0
- package/src/radio.tsx +15 -0
- package/src/rating.tsx +12 -0
- package/src/select.tsx +12 -0
- package/src/selection-button-group.tsx +58 -0
- package/src/skeleton.tsx +14 -0
- package/src/slider.tsx +12 -0
- package/src/snackbar.tsx +14 -0
- package/src/speed-dial-action.tsx +14 -0
- package/src/speed-dial.tsx +14 -0
- package/src/stack.tsx +12 -0
- package/src/step-content.tsx +14 -0
- package/src/step-label.tsx +14 -0
- package/src/step.tsx +12 -0
- package/src/stepper.tsx +12 -0
- package/src/switch.tsx +15 -0
- package/src/tab-context.tsx +11 -0
- package/src/tab-list.tsx +14 -0
- package/src/tab-panel.tsx +14 -0
- package/src/tab.tsx +12 -0
- package/src/table-body.tsx +14 -0
- package/src/table-cell.tsx +14 -0
- package/src/table-container.tsx +14 -0
- package/src/table-head.tsx +14 -0
- package/src/table-row.tsx +14 -0
- package/src/table.tsx +12 -0
- package/src/tabs.tsx +12 -0
- package/src/text-field.tsx +14 -0
- package/src/theme/buildCssVariables.ts +6 -0
- package/src/theme/createDesignTheme.ts +118 -2
- package/src/theme/index.ts +1 -0
- package/src/theme/spacing.ts +23 -0
- package/src/timeline-connector.tsx +14 -0
- package/src/timeline-content.tsx +14 -0
- package/src/timeline-dot.tsx +14 -0
- package/src/timeline-item.tsx +14 -0
- package/src/timeline-separator.tsx +14 -0
- package/src/timeline.tsx +14 -0
- package/src/toggle-button-group.tsx +35 -0
- package/src/toggle-button.tsx +15 -0
- package/src/tooltip.tsx +14 -0
- package/src/typography.tsx +14 -0
- package/tsup.config.ts +89 -1
- package/README.md +0 -124
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import React, { useRef, useMemo } from "react";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { Typography, Box } from "@mui/material";
|
|
4
|
+
import {
|
|
5
|
+
Chart as ChartJS,
|
|
6
|
+
ArcElement,
|
|
7
|
+
DoughnutController,
|
|
8
|
+
Tooltip,
|
|
9
|
+
Legend,
|
|
10
|
+
} from "chart.js";
|
|
11
|
+
import { Chart } from "react-chartjs-2";
|
|
12
|
+
import { formatNumberWithDollar } from "./chart-utils";
|
|
13
|
+
|
|
14
|
+
ChartJS.register(ArcElement, DoughnutController, Tooltip, Legend);
|
|
15
|
+
|
|
16
|
+
export interface DoughnutChartDataItem {
|
|
17
|
+
data: number[];
|
|
18
|
+
title: string[];
|
|
19
|
+
colors?: string[];
|
|
20
|
+
icons?: React.ReactNode[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FrontendDoughnutChartProps {
|
|
24
|
+
title?: string;
|
|
25
|
+
data?: DoughnutChartDataItem;
|
|
26
|
+
textTop?: string;
|
|
27
|
+
textBottom?: string;
|
|
28
|
+
legendDisplay?: boolean;
|
|
29
|
+
customLegend?: boolean;
|
|
30
|
+
isBottomColor?: boolean;
|
|
31
|
+
bottomColor?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const getChartColorRange = (spectrum: string[], count: number): string[] => {
|
|
35
|
+
if (count <= 1) return [spectrum[0] || "#162029"];
|
|
36
|
+
const result: string[] = [];
|
|
37
|
+
for (let i = 0; i < count; i++) {
|
|
38
|
+
const ratio = i / (count - 1);
|
|
39
|
+
const fromIdx = Math.floor(ratio * (spectrum.length - 1));
|
|
40
|
+
const toIdx = Math.min(fromIdx + 1, spectrum.length - 1);
|
|
41
|
+
const localRatio =
|
|
42
|
+
ratio * (spectrum.length - 1) - fromIdx;
|
|
43
|
+
const from = spectrum[fromIdx]!;
|
|
44
|
+
const to = spectrum[toIdx]!;
|
|
45
|
+
result.push(interpolateColor(from, to, localRatio));
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const interpolateColor = (c1: string, c2: string, t: number): string => {
|
|
51
|
+
const parse = (hex: string) => {
|
|
52
|
+
const h = hex.replace("#", "");
|
|
53
|
+
return [
|
|
54
|
+
parseInt(h.substring(0, 2), 16),
|
|
55
|
+
parseInt(h.substring(2, 4), 16),
|
|
56
|
+
parseInt(h.substring(4, 6), 16),
|
|
57
|
+
];
|
|
58
|
+
};
|
|
59
|
+
const [r1, g1, b1] = parse(c1);
|
|
60
|
+
const [r2, g2, b2] = parse(c2);
|
|
61
|
+
const lerp = (a: number, b: number) => Math.round(a + (b - a) * t);
|
|
62
|
+
const toHex = (n: number) => n.toString(16).padStart(2, "0");
|
|
63
|
+
return `#${toHex(lerp(r1!, r2!))}${toHex(lerp(g1!, g2!))}${toHex(lerp(b1!, b2!))}`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const generateChartColor = (
|
|
67
|
+
dataLength: number,
|
|
68
|
+
providedColors: string[]
|
|
69
|
+
): string[] => {
|
|
70
|
+
if (providedColors.length > 0) return providedColors;
|
|
71
|
+
const spectrum = ["#162029", "#A1B9BD"];
|
|
72
|
+
return getChartColorRange(spectrum, dataLength);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const ChartContainer = styled("div")({
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
display: "flex",
|
|
78
|
+
flexDirection: "column",
|
|
79
|
+
width: "100%",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const ChartWrapper = styled("div")({
|
|
83
|
+
display: "flex",
|
|
84
|
+
alignItems: "center",
|
|
85
|
+
justifyContent: "center",
|
|
86
|
+
width: "100%",
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const ChartSize = styled("div")({
|
|
90
|
+
height: 160,
|
|
91
|
+
maxWidth: 160,
|
|
92
|
+
width: "100%",
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const LegendContainer = styled("div")<{ isCustom?: boolean }>(
|
|
96
|
+
({ isCustom }) => ({
|
|
97
|
+
display: "flex",
|
|
98
|
+
flexDirection: isCustom ? "column" : "row",
|
|
99
|
+
flexWrap: "wrap",
|
|
100
|
+
gap: 8,
|
|
101
|
+
marginTop: 16,
|
|
102
|
+
width: "100%",
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const LegendWrap = styled("div")({
|
|
107
|
+
display: "flex",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
gap: 8,
|
|
110
|
+
padding: "4px 0",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const LegendBox = styled("div")({
|
|
114
|
+
width: 12,
|
|
115
|
+
height: 12,
|
|
116
|
+
borderRadius: 2,
|
|
117
|
+
flexShrink: 0,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const LegendFont = styled("span")({
|
|
121
|
+
fontSize: 13,
|
|
122
|
+
lineHeight: 1.4,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const LegendFontBold = styled("span")({
|
|
126
|
+
fontSize: 13,
|
|
127
|
+
fontWeight: 600,
|
|
128
|
+
lineHeight: 1.4,
|
|
129
|
+
display: "flex",
|
|
130
|
+
alignItems: "center",
|
|
131
|
+
gap: 4,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const LegendBoxContainer = styled("div")({
|
|
135
|
+
display: "flex",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const buildDoughnutChartOption = (
|
|
140
|
+
textTop: string,
|
|
141
|
+
textBottom: string,
|
|
142
|
+
isBottomColor: boolean,
|
|
143
|
+
bottomColor: string
|
|
144
|
+
) => ({
|
|
145
|
+
cutout: "85%",
|
|
146
|
+
maintainAspectRatio: false,
|
|
147
|
+
responsive: true,
|
|
148
|
+
aspectRatio: 1,
|
|
149
|
+
elements: {
|
|
150
|
+
center: {
|
|
151
|
+
textNumber: textTop,
|
|
152
|
+
text: textBottom,
|
|
153
|
+
fontColor: "#656566",
|
|
154
|
+
topColor: "#131c24",
|
|
155
|
+
bottomColor: isBottomColor ? bottomColor || "#131c24" : "#131c24",
|
|
156
|
+
fontStyle: "normal",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
plugins: {
|
|
160
|
+
legend: { display: false },
|
|
161
|
+
tooltip: {
|
|
162
|
+
mode: "nearest" as const,
|
|
163
|
+
intersect: true,
|
|
164
|
+
callbacks: {
|
|
165
|
+
label: (tooltipItem: any) => {
|
|
166
|
+
const chartValue = tooltipItem.parsed;
|
|
167
|
+
return `${tooltipItem.label}: ${formatNumberWithDollar(chartValue)}`;
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
backgroundColor: "#fff",
|
|
171
|
+
titleFont: { family: "sans-serif", size: 14 },
|
|
172
|
+
titleColor: "#000",
|
|
173
|
+
bodyFont: { family: "sans-serif", weight: "bold" as const, size: 13 },
|
|
174
|
+
bodyColor: "#000",
|
|
175
|
+
displayColors: false,
|
|
176
|
+
borderColor: "#000",
|
|
177
|
+
borderWidth: 1,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
interaction: { intersect: false },
|
|
181
|
+
layout: { padding: {} },
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const drawTextInsideDoughnutPlugin = {
|
|
185
|
+
id: "doughnutCenterText",
|
|
186
|
+
beforeDraw: (chart: any) => {
|
|
187
|
+
if (chart.config.options.elements?.center) {
|
|
188
|
+
const { ctx } = chart;
|
|
189
|
+
ctx.restore();
|
|
190
|
+
const centerConfig = chart.config.options.elements.center;
|
|
191
|
+
const fontBold = "sans-serif";
|
|
192
|
+
const txt = centerConfig.textNumber;
|
|
193
|
+
const { text } = centerConfig;
|
|
194
|
+
const color = centerConfig.topColor;
|
|
195
|
+
const maxFontSize = centerConfig.maxFontSize || 12;
|
|
196
|
+
const sidePadding = centerConfig.sidePadding || 25;
|
|
197
|
+
const sidePaddingCalculated =
|
|
198
|
+
(sidePadding / 100) * (chart.innerRadius * 2);
|
|
199
|
+
|
|
200
|
+
ctx.font = `12px ${fontBold}`;
|
|
201
|
+
const stringWidth = ctx.measureText(txt).width;
|
|
202
|
+
const elementWidth = chart.innerRadius * 2 - sidePaddingCalculated;
|
|
203
|
+
const widthRatio = elementWidth / stringWidth;
|
|
204
|
+
const newFontSize = Math.floor(12 * widthRatio);
|
|
205
|
+
const elementHeight = chart.innerRadius * 2;
|
|
206
|
+
|
|
207
|
+
let fontSizeToUse = Math.min(newFontSize, elementHeight, maxFontSize);
|
|
208
|
+
let { minFontSize } = centerConfig;
|
|
209
|
+
const lineHeight = centerConfig.lineHeight || 12;
|
|
210
|
+
let wrapText = false;
|
|
211
|
+
if (minFontSize === undefined) minFontSize = 8;
|
|
212
|
+
if (minFontSize && fontSizeToUse < minFontSize) {
|
|
213
|
+
fontSizeToUse = minFontSize;
|
|
214
|
+
wrapText = true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
ctx.textAlign = "center";
|
|
218
|
+
ctx.textBaseline = "middle";
|
|
219
|
+
const centerX = (chart.chartArea.left + chart.chartArea.right) / 2;
|
|
220
|
+
let centerY = (chart.chartArea.top + chart.chartArea.bottom) / 2.2;
|
|
221
|
+
const centerYY = chart.chartArea.top + chart.chartArea.bottom / 1.65;
|
|
222
|
+
ctx.font = `${fontSizeToUse}px ${fontBold}`;
|
|
223
|
+
ctx.fillStyle = color;
|
|
224
|
+
|
|
225
|
+
if (!wrapText) {
|
|
226
|
+
ctx.fillText(txt, centerX, centerY);
|
|
227
|
+
const regularFont = "sans-serif";
|
|
228
|
+
ctx.fillStyle = centerConfig.bottomColor;
|
|
229
|
+
ctx.font = `${Math.min(fontSizeToUse * 0.5, 10)}px ${regularFont}`;
|
|
230
|
+
ctx.fillText(text, centerX, centerYY);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const words = txt.split(" ");
|
|
235
|
+
let line = "";
|
|
236
|
+
const lines: string[] = [];
|
|
237
|
+
for (let n = 0; n < words.length; n++) {
|
|
238
|
+
const testLine = `${line + words[n]} `;
|
|
239
|
+
const metrics = ctx.measureText(testLine);
|
|
240
|
+
const testWidth = metrics.width;
|
|
241
|
+
if (testWidth > elementWidth && n > 0) {
|
|
242
|
+
lines.push(line);
|
|
243
|
+
line = `${words[n]} `;
|
|
244
|
+
} else {
|
|
245
|
+
line = testLine;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
centerY -= (lines.length / 2) * lineHeight;
|
|
249
|
+
ctx.restore();
|
|
250
|
+
for (let n = 0; n < lines.length; n++) {
|
|
251
|
+
ctx.fillText(lines[n], centerX, centerY);
|
|
252
|
+
centerY += lineHeight;
|
|
253
|
+
}
|
|
254
|
+
ctx.fillText(line, centerX, centerY);
|
|
255
|
+
const regularFont = "sans-serif";
|
|
256
|
+
ctx.fillStyle = centerConfig.bottomColor;
|
|
257
|
+
centerY += lineHeight;
|
|
258
|
+
ctx.fillText(text, centerX, centerY);
|
|
259
|
+
ctx.save();
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const FrontendDoughnutChart: React.FC<FrontendDoughnutChartProps> = ({
|
|
265
|
+
title,
|
|
266
|
+
data,
|
|
267
|
+
textTop = " ",
|
|
268
|
+
textBottom = " ",
|
|
269
|
+
legendDisplay = true,
|
|
270
|
+
customLegend = false,
|
|
271
|
+
isBottomColor = false,
|
|
272
|
+
bottomColor = "#131c24",
|
|
273
|
+
}) => {
|
|
274
|
+
const chartRef = useRef(null);
|
|
275
|
+
|
|
276
|
+
const {
|
|
277
|
+
data: dChartData = [],
|
|
278
|
+
title: dChartTitle = [],
|
|
279
|
+
colors: dChartColor = [],
|
|
280
|
+
icons: dChartIcons = [],
|
|
281
|
+
} = data || {};
|
|
282
|
+
|
|
283
|
+
const chartColors = useMemo(
|
|
284
|
+
() => generateChartColor(dChartData.length, dChartColor),
|
|
285
|
+
[dChartData.length, dChartColor]
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const chartOptions = useMemo(
|
|
289
|
+
() => buildDoughnutChartOption(textTop, textBottom, isBottomColor, bottomColor),
|
|
290
|
+
[textTop, textBottom, isBottomColor, bottomColor]
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
const chartData = useMemo(() => {
|
|
294
|
+
if (!data || !dChartData.length) return { labels: [], datasets: [] };
|
|
295
|
+
return {
|
|
296
|
+
type: "doughnut" as const,
|
|
297
|
+
labels: dChartTitle,
|
|
298
|
+
datasets: [
|
|
299
|
+
{
|
|
300
|
+
data: dChartData,
|
|
301
|
+
backgroundColor: chartColors,
|
|
302
|
+
hoverBackgroundColor: chartColors,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
};
|
|
306
|
+
}, [data, dChartData, dChartTitle, chartColors]);
|
|
307
|
+
|
|
308
|
+
if (!data || !dChartData.length) {
|
|
309
|
+
return (
|
|
310
|
+
<ChartContainer>
|
|
311
|
+
{title && (
|
|
312
|
+
<Typography variant="subtitle2" color="text.secondary" mb={1}>
|
|
313
|
+
{title}
|
|
314
|
+
</Typography>
|
|
315
|
+
)}
|
|
316
|
+
<Box sx={{ color: "text.disabled", py: 4 }}>No data</Box>
|
|
317
|
+
</ChartContainer>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const generateLegend = () => {
|
|
322
|
+
if (customLegend) {
|
|
323
|
+
return dChartData.map((chartDataset, index) => (
|
|
324
|
+
<LegendWrap key={`${chartDataset}${index}`}>
|
|
325
|
+
<LegendFontBold>
|
|
326
|
+
<span>{dChartTitle[index] || ""}</span>
|
|
327
|
+
{dChartIcons?.[index] && <span>{dChartIcons[index]}</span>}
|
|
328
|
+
</LegendFontBold>
|
|
329
|
+
<LegendBoxContainer>
|
|
330
|
+
<LegendBox style={{ backgroundColor: chartColors[index] }} />
|
|
331
|
+
</LegendBoxContainer>
|
|
332
|
+
<LegendFont>{formatNumberWithDollar(chartDataset)}</LegendFont>
|
|
333
|
+
</LegendWrap>
|
|
334
|
+
));
|
|
335
|
+
}
|
|
336
|
+
return dChartData.map((_chartDataset, index) => (
|
|
337
|
+
<LegendWrap key={dChartTitle[index]}>
|
|
338
|
+
<LegendBox style={{ backgroundColor: chartColors[index] }} />
|
|
339
|
+
<LegendFont>{dChartTitle[index]}</LegendFont>
|
|
340
|
+
</LegendWrap>
|
|
341
|
+
));
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
return (
|
|
345
|
+
<ChartContainer>
|
|
346
|
+
{title && (
|
|
347
|
+
<Typography variant="subtitle2" color="text.secondary" mb={1}>
|
|
348
|
+
{title}
|
|
349
|
+
</Typography>
|
|
350
|
+
)}
|
|
351
|
+
<ChartWrapper>
|
|
352
|
+
<ChartSize>
|
|
353
|
+
<Chart
|
|
354
|
+
type="doughnut"
|
|
355
|
+
redraw
|
|
356
|
+
ref={chartRef}
|
|
357
|
+
data={chartData as any}
|
|
358
|
+
options={chartOptions as any}
|
|
359
|
+
plugins={[drawTextInsideDoughnutPlugin]}
|
|
360
|
+
/>
|
|
361
|
+
</ChartSize>
|
|
362
|
+
{legendDisplay && (
|
|
363
|
+
<LegendContainer isCustom={customLegend}>
|
|
364
|
+
{generateLegend()}
|
|
365
|
+
</LegendContainer>
|
|
366
|
+
)}
|
|
367
|
+
</ChartWrapper>
|
|
368
|
+
</ChartContainer>
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
FrontendDoughnutChart.displayName = "FrontendDoughnutChart";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import {
|
|
4
|
+
BarElement,
|
|
5
|
+
CategoryScale,
|
|
6
|
+
Chart as ChartJS,
|
|
7
|
+
Legend,
|
|
8
|
+
LinearScale,
|
|
9
|
+
Title,
|
|
10
|
+
Tooltip,
|
|
11
|
+
} from "chart.js";
|
|
12
|
+
import ChartDataLabels from "chartjs-plugin-datalabels";
|
|
13
|
+
import { Chart } from "react-chartjs-2";
|
|
14
|
+
import { formatNumberWithDollar } from "./chart-utils";
|
|
15
|
+
|
|
16
|
+
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
|
|
17
|
+
|
|
18
|
+
export interface FrontendIncomeExpenseHorizontalBarChartProps {
|
|
19
|
+
totalIncome: number;
|
|
20
|
+
totalExpense: number;
|
|
21
|
+
incomeColor?: string;
|
|
22
|
+
expenseColor?: string;
|
|
23
|
+
textColor?: string;
|
|
24
|
+
height?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ChartWrapper = styled("div")<{ chartHeight: number }>(
|
|
28
|
+
({ chartHeight }) => ({
|
|
29
|
+
position: "relative",
|
|
30
|
+
height: chartHeight,
|
|
31
|
+
width: "100%",
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const FrontendIncomeExpenseHorizontalBarChart: React.FC<
|
|
36
|
+
FrontendIncomeExpenseHorizontalBarChartProps
|
|
37
|
+
> = ({
|
|
38
|
+
totalIncome,
|
|
39
|
+
totalExpense,
|
|
40
|
+
incomeColor = "#39FD99",
|
|
41
|
+
expenseColor = "#162029",
|
|
42
|
+
textColor = "#040D13",
|
|
43
|
+
height = 160,
|
|
44
|
+
}) => {
|
|
45
|
+
const suggestedMax = Math.max(totalIncome, Math.abs(totalExpense)) * 1.25;
|
|
46
|
+
|
|
47
|
+
const options = useMemo(
|
|
48
|
+
() => ({
|
|
49
|
+
indexAxis: "y" as const,
|
|
50
|
+
responsive: true,
|
|
51
|
+
maintainAspectRatio: false,
|
|
52
|
+
plugins: {
|
|
53
|
+
datalabels: {
|
|
54
|
+
color: textColor,
|
|
55
|
+
textAlign: "left" as const,
|
|
56
|
+
},
|
|
57
|
+
legend: { display: false },
|
|
58
|
+
},
|
|
59
|
+
layout: {
|
|
60
|
+
padding: {
|
|
61
|
+
right: 120,
|
|
62
|
+
left: 0,
|
|
63
|
+
top: 10,
|
|
64
|
+
bottom: 10,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
scales: {
|
|
68
|
+
y: {
|
|
69
|
+
display: true,
|
|
70
|
+
grid: { display: false, drawBorder: false },
|
|
71
|
+
border: { display: false },
|
|
72
|
+
ticks: { display: false },
|
|
73
|
+
},
|
|
74
|
+
x: {
|
|
75
|
+
display: true,
|
|
76
|
+
grid: { display: false, drawBorder: false },
|
|
77
|
+
border: { display: false },
|
|
78
|
+
ticks: {
|
|
79
|
+
display: false,
|
|
80
|
+
},
|
|
81
|
+
suggestedMax,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
[totalIncome, totalExpense, textColor, suggestedMax]
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const chartData = useMemo(
|
|
89
|
+
() => ({
|
|
90
|
+
labels: ["Incoming", "Outgoing"],
|
|
91
|
+
datasets: [
|
|
92
|
+
{
|
|
93
|
+
barThickness: 40,
|
|
94
|
+
backgroundColor: [incomeColor, expenseColor],
|
|
95
|
+
data: [totalIncome, Math.abs(totalExpense)],
|
|
96
|
+
datalabels: {
|
|
97
|
+
labels: {
|
|
98
|
+
value: {
|
|
99
|
+
anchor: "end" as const,
|
|
100
|
+
align: "end" as const,
|
|
101
|
+
offset: 10,
|
|
102
|
+
clamp: false,
|
|
103
|
+
font: { weight: "bold" as const, size: 14 },
|
|
104
|
+
formatter(value: number) {
|
|
105
|
+
return [formatNumberWithDollar(value), ""];
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
name: {
|
|
109
|
+
anchor: "end" as const,
|
|
110
|
+
align: "end" as const,
|
|
111
|
+
offset: 10,
|
|
112
|
+
clamp: false,
|
|
113
|
+
formatter(_value: number, ctx: any) {
|
|
114
|
+
return ["", ctx.chart.data.labels[ctx.dataIndex]];
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
}),
|
|
122
|
+
[totalIncome, totalExpense, incomeColor, expenseColor]
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<ChartWrapper chartHeight={height}>
|
|
127
|
+
<Chart
|
|
128
|
+
type="bar"
|
|
129
|
+
plugins={[ChartDataLabels]}
|
|
130
|
+
options={options as any}
|
|
131
|
+
data={chartData as any}
|
|
132
|
+
/>
|
|
133
|
+
</ChartWrapper>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
FrontendIncomeExpenseHorizontalBarChart.displayName =
|
|
138
|
+
"FrontendIncomeExpenseHorizontalBarChart";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { Typography } from "@mui/material";
|
|
4
|
+
import { FrontendPercentageBar, type PercentageBarPart } from "./FrontendPercentageBar";
|
|
5
|
+
|
|
6
|
+
export interface LiabilitiesPart extends PercentageBarPart {
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface FrontendLiabilitiesChartProps {
|
|
11
|
+
defaultTitle?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
parts?: LiabilitiesPart[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const generateColorGradient = (baseColor: string, count: number): string[] => {
|
|
17
|
+
if (count <= 0) return [];
|
|
18
|
+
const hex = baseColor.replace("#", "");
|
|
19
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
20
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
21
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
22
|
+
|
|
23
|
+
return Array.from({ length: count }, (_, i) => {
|
|
24
|
+
const ratio = count > 1 ? i / (count - 1) : 0;
|
|
25
|
+
const nr = Math.round(r + (255 - r) * ratio);
|
|
26
|
+
const ng = Math.round(g + (255 - g) * ratio);
|
|
27
|
+
const nb = Math.round(b + (255 - b) * ratio);
|
|
28
|
+
return `#${nr.toString(16).padStart(2, "0")}${ng.toString(16).padStart(2, "0")}${nb.toString(16).padStart(2, "0")}`;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const Root = styled("div")({
|
|
33
|
+
width: "100%",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const LegendsContainer = styled("div")({
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexWrap: "wrap",
|
|
39
|
+
gap: 12,
|
|
40
|
+
marginTop: 8,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const LegendItem = styled("div")({
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
gap: 6,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const LegendColor = styled("div")<{ bgColor: string }>(({ bgColor }) => ({
|
|
50
|
+
width: 12,
|
|
51
|
+
height: 12,
|
|
52
|
+
borderRadius: 2,
|
|
53
|
+
backgroundColor: bgColor,
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
export const FrontendLiabilitiesChart: React.FC<FrontendLiabilitiesChartProps> = ({
|
|
58
|
+
defaultTitle,
|
|
59
|
+
color = "#131c24",
|
|
60
|
+
parts = [],
|
|
61
|
+
}) => {
|
|
62
|
+
const colors = useMemo(
|
|
63
|
+
() => generateColorGradient(color, parts.length),
|
|
64
|
+
[color, parts.length]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Root>
|
|
69
|
+
<FrontendPercentageBar
|
|
70
|
+
defaultTitle={defaultTitle}
|
|
71
|
+
chartColors={colors}
|
|
72
|
+
parts={parts}
|
|
73
|
+
showFullCategory
|
|
74
|
+
/>
|
|
75
|
+
{parts.length === 0 && (
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
height: 22,
|
|
79
|
+
backgroundColor: "#e9edf2",
|
|
80
|
+
borderRadius: 2,
|
|
81
|
+
marginTop: 8,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
<LegendsContainer>
|
|
86
|
+
{parts.map((part, index) => (
|
|
87
|
+
<LegendItem key={part.id || part.title}>
|
|
88
|
+
<LegendColor bgColor={colors[index] || "#ccc"} />
|
|
89
|
+
<Typography variant="body2">{part.title}</Typography>
|
|
90
|
+
</LegendItem>
|
|
91
|
+
))}
|
|
92
|
+
</LegendsContainer>
|
|
93
|
+
</Root>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
FrontendLiabilitiesChart.displayName = "FrontendLiabilitiesChart";
|