sag_components 2.0.0-beta27 → 2.0.0-beta28
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/dist/App.js +56 -0
- package/dist/App.test.js +10 -0
- package/dist/Button.test.js +162 -0
- package/dist/LinkButton.test.js +150 -0
- package/dist/SingleBar.test.js +120 -0
- package/dist/index.esm.js +6300 -4636
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2365 -702
- package/dist/index.js.map +1 -1
- package/dist/setupTests.js +15 -0
- package/dist/stories/AttachedFile.stories.js +37 -0
- package/dist/stories/AutocompleteField.stories.js +25 -0
- package/dist/stories/BannerEventBox.stories.js +59 -0
- package/dist/stories/BannerEventBoxList.stories.js +39 -0
- package/dist/stories/BannerEventBoxTest.stories.js +27 -0
- package/dist/stories/BannersDropdown.stories.js +64 -0
- package/dist/stories/BarChart.stories.js +306 -0
- package/dist/stories/BarChartTwoRows.stories.js +259 -0
- package/dist/stories/BarChartWithAreaChart.stories.js +134 -0
- package/dist/stories/BarChartsByWeeks.stories.js +445 -0
- package/dist/stories/Benchmark.stories.js +147 -0
- package/dist/stories/Button.stories.js +255 -0
- package/dist/stories/CampaignDemoReport.stories.js +65 -0
- package/dist/stories/CampaignTool/Card.stories.js +92 -0
- package/dist/stories/CampaignTool/MultipleCard.stories.js +33 -0
- package/dist/stories/CampaignTool/PageFilterBar.stories.js +28 -0
- package/dist/stories/CampaignTool/Popup.stories.js +697 -0
- package/dist/stories/CampaignTool/PopupContent.stories.js +284 -0
- package/dist/stories/CampaignTool/Table.stories.js +104 -0
- package/dist/stories/CheckBox.stories.js +107 -0
- package/dist/stories/CheckBoxButton.stories.js +150 -0
- package/dist/stories/CollapseData.stories.js +125 -0
- package/dist/stories/CollapseHeader.stories.js +123 -0
- package/dist/stories/CollapseMenuItem.stories.js +134 -0
- package/dist/stories/Datepicker.stories.js +85 -0
- package/dist/stories/DialogOverlay.stories.js +39 -0
- package/dist/stories/DoublePanelDataRow.stories.js +116 -0
- package/dist/stories/DownloadProgress.stories.js +109 -0
- package/dist/stories/Dropdown.stories.js +318 -0
- package/dist/stories/DropdownMulti.stories.js +220 -0
- package/dist/stories/DropdownNew.stories.js +407 -0
- package/dist/stories/EventDetailsCard.stories.js +122 -0
- package/dist/stories/EventList.stories.js +84 -0
- package/dist/stories/EventListItem.stories.js +65 -0
- package/dist/stories/FilterButton.stories.js +90 -0
- package/dist/stories/FilterContainer.stories.js +22 -0
- package/dist/stories/FilterPanel.stories.js +967 -0
- package/dist/stories/FormattedValue.stories.js +183 -0
- package/dist/stories/Heatmap.stories.js +118 -0
- package/dist/stories/IconButton.stories.js +126 -0
- package/dist/stories/Input.stories.js +422 -0
- package/dist/stories/InputOld.stories.js +103 -0
- package/dist/stories/KpiFilter.stories.js +401 -0
- package/dist/stories/LinkButton.stories.js +171 -0
- package/dist/stories/LinnerDataBox.stories.js +79 -0
- package/dist/stories/ListBox.stories.js +132 -0
- package/dist/stories/MarketShareDescription.stories.js +196 -0
- package/dist/stories/MonthPicker.stories.js +142 -0
- package/dist/stories/NewInput.stories.js +37 -0
- package/dist/stories/NoDataFoundMessage.stories.js +66 -0
- package/dist/stories/OneColumnContainer.stories.js +119 -0
- package/dist/stories/PerformanceAnalytics.stories.js +263 -0
- package/dist/stories/PerformanceAnalyticsLegend.stories.js +99 -0
- package/dist/stories/PerformanceAnalyticsOneColumn.stories.js +236 -0
- package/dist/stories/PerformanceAnalyticsTotals.stories.js +109 -0
- package/dist/stories/PieChart.stories.js +215 -0
- package/dist/stories/PopupCharts.stories.js +1191 -0
- package/dist/stories/ProductsVariety.stories.js +90 -0
- package/dist/stories/ProgressBar.stories.js +71 -0
- package/dist/stories/QuarterPicker.stories.js +142 -0
- package/dist/stories/QuickFilter.stories.js +275 -0
- package/dist/stories/RangePicker.stories.js +140 -0
- package/dist/stories/ReportTable.stories.js +255 -0
- package/dist/stories/SagButton.stories.js +118 -0
- package/dist/stories/SagIconButton.stories.js +122 -0
- package/dist/stories/SagInput.stories.js +69 -0
- package/dist/stories/SalesAndROI.stories.js +166 -0
- package/dist/stories/SalesSplit.stories.js +122 -0
- package/dist/stories/SearchInput.stories.js +44 -0
- package/dist/stories/SegmentedButton.stories.js +181 -0
- package/dist/stories/Select.stories.js +201 -0
- package/dist/stories/SingleBarLineCharts.stories.js +310 -0
- package/dist/stories/TabMenu.stories.js +224 -0
- package/dist/stories/TextField.stories.js +160 -0
- package/dist/stories/TitleDescription.stories.js +116 -0
- package/dist/stories/TopToggleList.stories.js +52 -0
- package/dist/stories/TotalBenchmark.stories.js +135 -0
- package/dist/stories/TotalBenchmarkAreachart.stories.js +341 -0
- package/dist/stories/TotalBenchmarkArrows.stories.js +170 -0
- package/dist/stories/TotalBenchmarkBarchart.stories.js +183 -0
- package/dist/stories/TotalDoughnutChart.stories.js +301 -0
- package/dist/stories/TotalHorizontalCharts.stories.js +291 -0
- package/dist/stories/TwoBarCharts.stories.js +185 -0
- package/dist/stories/components/AttachedFile.js +60 -0
- package/dist/stories/components/AttachedFile.style.js +48 -0
- package/dist/stories/components/AutocompleteField.js +40 -0
- package/dist/stories/components/AutocompleteField.style.js +55 -0
- package/dist/stories/components/BannerEventBox.js +97 -0
- package/dist/stories/components/BannerEventBox.style.js +78 -0
- package/dist/stories/components/BannerEventBoxList.js +153 -0
- package/dist/stories/components/BannerEventBoxList.style.js +189 -0
- package/dist/stories/components/BannerEventBoxTest.js +42 -0
- package/dist/stories/components/BannerEventBoxTest.style.js +11 -0
- package/dist/stories/components/BannersDropdown.js +119 -0
- package/dist/stories/components/BannersDropdown.style.js +99 -0
- package/dist/stories/components/BarChart.js +258 -0
- package/dist/stories/components/BarChart.style.js +60 -0
- package/dist/stories/components/BarChartTwoRows.js +220 -0
- package/dist/stories/components/BarChartTwoRows.style.js +79 -0
- package/dist/stories/components/BarChartWithAreaChart.js +268 -0
- package/dist/stories/components/BarChartWithAreaChart.style.js +67 -0
- package/dist/stories/components/BarChartsByWeeks.js +306 -0
- package/dist/stories/components/BarChartsByWeeks.style.js +96 -0
- package/dist/stories/components/Benchmark.js +130 -0
- package/dist/stories/components/Benchmark.style.js +61 -0
- package/dist/stories/components/Button.js +255 -0
- package/dist/stories/components/Button.style.js +90 -0
- package/dist/stories/components/CampaignTool/CampaignDemoReport.js +48 -0
- package/dist/stories/components/CampaignTool/CampaignDemoReport.style.js +48 -0
- package/dist/stories/components/CampaignTool/Card.js +72 -0
- package/dist/stories/components/CampaignTool/Card.style.js +65 -0
- package/dist/stories/components/CampaignTool/FormInput.js +41 -0
- package/dist/stories/components/CampaignTool/FormSelect.js +42 -0
- package/dist/stories/components/CampaignTool/MultipleCard.js +26 -0
- package/dist/stories/components/CampaignTool/MultipleCard.style.js +13 -0
- package/dist/stories/components/CampaignTool/PageFilterBar.js +23 -0
- package/dist/stories/components/CampaignTool/PageFilterBar.style.js +22 -0
- package/dist/stories/components/CampaignTool/Popup.js +172 -0
- package/dist/stories/components/CampaignTool/Popup.style.js +122 -0
- package/dist/stories/components/CampaignTool/PopupContent.js +111 -0
- package/dist/stories/components/CampaignTool/PopupContent.style.js +74 -0
- package/dist/stories/components/CampaignTool/PopupFieldsRules.js +168 -0
- package/dist/stories/components/CampaignTool/Table.js +195 -0
- package/dist/stories/components/CampaignTool/Table.style.js +86 -0
- package/dist/stories/components/CheckBox.js +76 -0
- package/dist/stories/components/CheckBox.style.js +36 -0
- package/dist/stories/components/CheckBoxButton.js +69 -0
- package/dist/stories/components/CheckBoxButton.style.js +39 -0
- package/dist/stories/components/CodeEditor.js +43 -0
- package/dist/stories/components/CodeEditor.style.js +13 -0
- package/dist/stories/components/CollapseData.js +66 -0
- package/dist/stories/components/CollapseData.style.js +127 -0
- package/dist/stories/components/CollapseHeader.js +255 -0
- package/dist/stories/components/CollapseHeader.style.js +200 -0
- package/dist/stories/components/CollapseMenuItem.js +61 -0
- package/dist/stories/components/CollapseMenuItem.style.js +61 -0
- package/dist/stories/components/CommonFunctions.js +99 -0
- package/dist/stories/components/Datepicker.js +148 -0
- package/dist/stories/components/Datepicker.style.js +19 -0
- package/dist/stories/components/DialogOverlay.js +44 -0
- package/dist/stories/components/DialogOverlay.style.js +70 -0
- package/dist/stories/components/DoublePanelDataRow.js +70 -0
- package/dist/stories/components/DoublePanelDataRow.style.js +66 -0
- package/dist/stories/components/DownloadProgress.js +97 -0
- package/dist/stories/components/DownloadProgress.style.js +51 -0
- package/dist/stories/components/Dropdown.js +231 -0
- package/dist/stories/components/Dropdown.style.js +17 -0
- package/dist/stories/components/DropdownMulti.js +290 -0
- package/dist/stories/components/DropdownMulti.style.js +17 -0
- package/dist/stories/components/DropdownMultiNew.js +292 -0
- package/dist/stories/components/DropdownMultiNew.style.js +218 -0
- package/dist/stories/components/DropdownNew.js +98 -0
- package/dist/stories/components/DropdownNew.style.js +21 -0
- package/dist/stories/components/DropdownSingleNew.js +256 -0
- package/dist/stories/components/DropdownSingleNew.style.js +189 -0
- package/dist/stories/components/EventDetailsCard.js +142 -0
- package/dist/stories/components/EventDetailsCard.style.js +62 -0
- package/dist/stories/components/EventList.js +61 -0
- package/dist/stories/components/EventList.style.js +38 -0
- package/dist/stories/components/EventListItem.js +50 -0
- package/dist/stories/components/EventListItem.style.js +47 -0
- package/dist/stories/components/FilterButton.js +53 -0
- package/dist/stories/components/FilterButton.style.js +12 -0
- package/dist/stories/components/FilterContainer.js +29 -0
- package/dist/stories/components/FilterContainer.style.js +30 -0
- package/dist/stories/components/FilterPanel.js +614 -0
- package/dist/stories/components/FilterPanel.style.js +89 -0
- package/dist/stories/components/FormattedValue.js +69 -0
- package/dist/stories/components/FormattedValue.style.js +91 -0
- package/dist/stories/components/Heatmap.js +184 -0
- package/dist/stories/components/Heatmap.style.js +151 -0
- package/dist/stories/components/IconButton.js +147 -0
- package/dist/stories/components/IconButton.style.js +64 -0
- package/dist/stories/components/Input.js +186 -0
- package/dist/stories/components/Input.style.js +132 -0
- package/dist/stories/components/InputOld.js +93 -0
- package/dist/stories/components/InputOld.style.js +71 -0
- package/dist/stories/components/KpiFilter.js +345 -0
- package/dist/stories/components/KpiFilter.style.js +132 -0
- package/dist/stories/components/LinkButton.js +225 -0
- package/dist/stories/components/LinkButton.style.js +53 -0
- package/dist/stories/components/LinnerDataBox.js +54 -0
- package/dist/stories/components/LinnerDataBox.style.js +68 -0
- package/dist/stories/components/ListBox.js +82 -0
- package/dist/stories/components/ListBox.style.js +48 -0
- package/dist/stories/components/MarketShareDescription.js +109 -0
- package/dist/stories/components/MarketShareDescription.style.js +215 -0
- package/dist/stories/components/Modal.js +21 -0
- package/dist/stories/components/Modal.style.js +63 -0
- package/dist/stories/components/ModalTotalBenchmark.js +224 -0
- package/dist/stories/components/ModalTotalCost.js +139 -0
- package/dist/stories/components/MonthPicker.js +169 -0
- package/dist/stories/components/MonthPicker.style.js +105 -0
- package/dist/stories/components/MonthPopupPicker.js +206 -0
- package/dist/stories/components/NewInput.js +33 -0
- package/dist/stories/components/NewInput.style.js +13 -0
- package/dist/stories/components/NoDataFoundMessage.js +30 -0
- package/dist/stories/components/NoDataFoundMessage.style.js +39 -0
- package/dist/stories/components/OneColumnContainer.js +121 -0
- package/dist/stories/components/OneColumnContainer.style.js +107 -0
- package/dist/stories/components/PerformanceAnalytics.js +447 -0
- package/dist/stories/components/PerformanceAnalytics.style.js +144 -0
- package/dist/stories/components/PerformanceAnalyticsLegend.js +59 -0
- package/dist/stories/components/PerformanceAnalyticsLegend.style.js +63 -0
- package/dist/stories/components/PerformanceAnalyticsOneColumn.js +327 -0
- package/dist/stories/components/PerformanceAnalyticsOneColumn.style.js +116 -0
- package/dist/stories/components/PerformanceAnalyticsTotals.js +70 -0
- package/dist/stories/components/PerformanceAnalyticsTotals.style.js +89 -0
- package/dist/stories/components/PieChart.js +154 -0
- package/dist/stories/components/PieChart.style.js +154 -0
- package/dist/stories/components/PopupCharts.js +244 -0
- package/dist/stories/components/PopupCharts.style.js +108 -0
- package/dist/stories/components/ProductsVariety.js +94 -0
- package/dist/stories/components/ProductsVariety.style.js +86 -0
- package/dist/stories/components/ProgressBar.js +52 -0
- package/dist/stories/components/ProgressBar.style.js +24 -0
- package/dist/stories/components/QuarterPicker.js +168 -0
- package/dist/stories/components/QuarterPicker.style.js +104 -0
- package/dist/stories/components/QuarterPopupPicker.js +186 -0
- package/dist/stories/components/QuickFilter.js +78 -0
- package/dist/stories/components/QuickFilter.style.js +21 -0
- package/dist/stories/components/QuickFilterDropdownMultiSelection.js +299 -0
- package/dist/stories/components/QuickFilterDropdownMultiSelection.style.js +194 -0
- package/dist/stories/components/QuickFilterDropdownSingle.js +229 -0
- package/dist/stories/components/QuickFilterDropdownSingle.style.js +139 -0
- package/dist/stories/components/RangeDatePicker.js +231 -0
- package/dist/stories/components/RangePicker.js +179 -0
- package/dist/stories/components/RangePicker.style.js +109 -0
- package/dist/stories/components/ReportTable.js +420 -0
- package/dist/stories/components/ReportTable.style.js +306 -0
- package/dist/stories/components/SagButton.js +68 -0
- package/dist/stories/components/SagButton.style.js +47 -0
- package/dist/stories/components/SagIconButton.js +130 -0
- package/dist/stories/components/SagIconButton.style.js +30 -0
- package/dist/stories/components/SagInput.js +53 -0
- package/dist/stories/components/SagInput.style.js +41 -0
- package/dist/stories/components/SalesAndROI.js +89 -0
- package/dist/stories/components/SalesAndROI.style.js +111 -0
- package/dist/stories/components/SalesSplit.js +153 -0
- package/dist/stories/components/SalesSplit.style.js +150 -0
- package/dist/stories/components/SearchInput.js +39 -0
- package/dist/stories/components/SearchInput.style.js +37 -0
- package/dist/stories/components/SegmentedButton.js +124 -0
- package/dist/stories/components/SegmentedButton.style.js +100 -0
- package/dist/stories/components/Select.js +137 -0
- package/dist/stories/components/Select.style.js +104 -0
- package/dist/stories/components/SingleBarLineCharts.js +415 -0
- package/dist/stories/components/SingleBarLineCharts.style.js +101 -0
- package/dist/stories/components/TabMenu.js +241 -0
- package/dist/stories/components/TabMenu.style.js +120 -0
- package/dist/stories/components/TextField.js +209 -0
- package/dist/stories/components/TextField.style.js +18 -0
- package/dist/stories/components/TitleDescription.js +272 -0
- package/dist/stories/components/TitleDescription.style.js +222 -0
- package/dist/stories/components/Tooltip.js +44 -0
- package/dist/stories/components/Tooltip.style.js +103 -0
- package/dist/stories/components/TopToggleList.js +46 -0
- package/dist/stories/components/TopToggleList.style.js +51 -0
- package/dist/stories/components/TotalBenchmark.js +97 -0
- package/dist/stories/components/TotalBenchmark.style.js +79 -0
- package/dist/stories/components/TotalBenchmarkAreachart.js +342 -0
- package/dist/stories/components/TotalBenchmarkAreachart.style.js +171 -0
- package/dist/stories/components/TotalBenchmarkArrows.js +149 -0
- package/dist/stories/components/TotalBenchmarkArrows.style.js +108 -0
- package/dist/stories/components/TotalBenchmarkBarchart.js +165 -0
- package/dist/stories/components/TotalBenchmarkBarchart.style.js +77 -0
- package/dist/stories/components/TotalDoughnutChart.js +187 -0
- package/dist/stories/components/TotalDoughnutChart.style.js +178 -0
- package/dist/stories/components/TotalHorizontalCharts.js +236 -0
- package/dist/stories/components/TotalHorizontalCharts.style.js +93 -0
- package/dist/stories/components/TspanTooltip.js +33 -0
- package/dist/stories/components/TspanTooltip.style.js +105 -0
- package/dist/stories/components/TwoBarCharts.js +211 -0
- package/dist/stories/components/TwoBarCharts.style.js +60 -0
- package/dist/stories/components/icons/ArrowDownIcon.js +27 -0
- package/dist/stories/components/icons/ArrowDropDownIcon.js +27 -0
- package/dist/stories/components/icons/ArrowSelectIcon.js +28 -0
- package/dist/stories/components/icons/ArrowUpIcon.js +27 -0
- package/dist/stories/components/icons/AttachedIcon.js +27 -0
- package/dist/stories/components/icons/BellIcon.js +27 -0
- package/dist/stories/components/icons/ButtonArrowRight.js +27 -0
- package/dist/stories/components/icons/Calendar.js +20 -0
- package/dist/stories/components/icons/CalendarIcon.js +27 -0
- package/dist/stories/components/icons/CalendarInOpen.js +26 -0
- package/dist/stories/components/icons/CheckBoxButtonCheckedIcon.js +28 -0
- package/dist/stories/components/icons/CheckBoxCheckedIcon.js +28 -0
- package/dist/stories/components/icons/CheckBoxNotCheckedIcon.js +28 -0
- package/dist/stories/components/icons/ChervronLeftIcon.js +20 -0
- package/dist/stories/components/icons/ChervronRightIcon.js +20 -0
- package/dist/stories/components/icons/ChevronLeftIcon.js +29 -0
- package/dist/stories/components/icons/ChevronRightIcon.js +29 -0
- package/dist/stories/components/icons/ClockIcon.js +27 -0
- package/dist/stories/components/icons/CloseIcon.js +27 -0
- package/dist/stories/components/icons/CloseXIcon.js +27 -0
- package/dist/stories/components/icons/ComboBoxArrowDownIcon.js +28 -0
- package/dist/stories/components/icons/ComboBoxArrowUpIcon.js +28 -0
- package/dist/stories/components/icons/DocumentIcon.js +48 -0
- package/dist/stories/components/icons/DownloadIcon.js +27 -0
- package/dist/stories/components/icons/Duplicate.js +28 -0
- package/dist/stories/components/icons/ErrorIcon.js +28 -0
- package/dist/stories/components/icons/ExitIcon.js +28 -0
- package/dist/stories/components/icons/ExportIcon.js +28 -0
- package/dist/stories/components/icons/EyeIcon.js +28 -0
- package/dist/stories/components/icons/FileIcon.js +27 -0
- package/dist/stories/components/icons/FilterIcon.js +36 -0
- package/dist/stories/components/icons/FlyIcon.js +28 -0
- package/dist/stories/components/icons/FoodLionChartIcon.js +42 -0
- package/dist/stories/components/icons/FoodLionIcon.js +3076 -0
- package/dist/stories/components/icons/FoodLionNewIcon.js +39 -0
- package/dist/stories/components/icons/GiantFoodChartIcon.js +40 -0
- package/dist/stories/components/icons/GiantFoodIcon.js +1976 -0
- package/dist/stories/components/icons/GiantFoodIcon_new.js +42 -0
- package/dist/stories/components/icons/HannafordChartIcon.js +40 -0
- package/dist/stories/components/icons/HannafordIcon.js +5017 -0
- package/dist/stories/components/icons/HannafordIcon_new.js +41 -0
- package/dist/stories/components/icons/HannafordNewIcon.js +213 -0
- package/dist/stories/components/icons/InfoIcon.js +28 -0
- package/dist/stories/components/icons/LampIcon.js +30 -0
- package/dist/stories/components/icons/LegendLineIcon.js +29 -0
- package/dist/stories/components/icons/LegendUnionIcon.js +29 -0
- package/dist/stories/components/icons/MaintenanceIcon.js +28 -0
- package/dist/stories/components/icons/MenuItemClosedIcon.js +28 -0
- package/dist/stories/components/icons/MenuItemOpenIcon.js +28 -0
- package/dist/stories/components/icons/MenuItemRightIcon.js +28 -0
- package/dist/stories/components/icons/MenuItemUpIcon.js +28 -0
- package/dist/stories/components/icons/NoDataFoundIcon.js +86 -0
- package/dist/stories/components/icons/OptionsIcon.js +27 -0
- package/dist/stories/components/icons/ReselectIcon.js +27 -0
- package/dist/stories/components/icons/SearchIcon.js +27 -0
- package/dist/stories/components/icons/ShoppingCartIcon.js +45 -0
- package/dist/stories/components/icons/ShoutIcon.js +27 -0
- package/dist/stories/components/icons/Sort.js +13 -0
- package/dist/stories/components/icons/SortIcon.js +35 -0
- package/dist/stories/components/icons/SpotlightProductIcon.js +28 -0
- package/dist/stories/components/icons/StopAndShopChartIcon.js +42 -0
- package/dist/stories/components/icons/StopAndShopIcon.js +134 -0
- package/dist/stories/components/icons/StopAndShopNewIcon.js +41 -0
- package/dist/stories/components/icons/SucceededIcon.js +28 -0
- package/dist/stories/components/icons/TheGiantCompanyChartIcon.js +40 -0
- package/dist/stories/components/icons/TheGiantCompanyIcon.js +40 -0
- package/dist/stories/components/icons/TheGiantCompanyIcon_old.js +1831 -0
- package/dist/stories/components/icons/TheGiantCompanyNewIcon.js +39 -0
- package/dist/stories/utils/ComponentFactory.js +65 -0
- package/dist/stories/utils/IconsHandler.js +150 -0
- package/dist/stories/utils/IconsHandler.style.js +16 -0
- package/dist/stories/utils/regex/Email.regex.js +7 -0
- package/dist/stories/utils/regex/LatinWithSpaces.regex.js +7 -0
- package/dist/stories/utils/regex/OnlyEnglishLetters.regex.js +7 -0
- package/dist/stories/utils/regex/Phone.regex.js +7 -0
- package/dist/types/components/LinnerDataBox/LinnerDataBox.data.d.ts +23 -0
- package/dist/vite.config.js +15 -0
- package/package.json +4 -4
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.TotalDoughnutChart = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _recharts = require("recharts");
|
|
10
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
11
|
+
var _NoDataFoundMessage = require("./NoDataFoundMessage");
|
|
12
|
+
var _TotalDoughnutChart = require("./TotalDoughnutChart.style");
|
|
13
|
+
var _Benchmark = require("./Benchmark");
|
|
14
|
+
const TotalDoughnutChart = props => {
|
|
15
|
+
var _DoughnutChartContain, _DoughnutChartContain2;
|
|
16
|
+
const {
|
|
17
|
+
className,
|
|
18
|
+
title,
|
|
19
|
+
value,
|
|
20
|
+
addingBenchmark,
|
|
21
|
+
dotCut,
|
|
22
|
+
currencySign,
|
|
23
|
+
currencyType,
|
|
24
|
+
legendData,
|
|
25
|
+
itemsPercentagesValueAside,
|
|
26
|
+
itemsBoldedValues,
|
|
27
|
+
itemsValuesSeparateLine,
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
textcolor,
|
|
31
|
+
isPercent,
|
|
32
|
+
hideTitleAndValue,
|
|
33
|
+
noDataText,
|
|
34
|
+
textAfterValue
|
|
35
|
+
} = props;
|
|
36
|
+
const [DoughnutChartRadius, setDoughnutChartRadius] = (0, _react.useState)(0);
|
|
37
|
+
const [zoomResolution, setZoomResolution] = (0, _react.useState)(1);
|
|
38
|
+
const DoughnutChartContainerRef = (0, _react.useRef)();
|
|
39
|
+
const dotCutTrenty = row => {
|
|
40
|
+
if (!row || !row.value) return null;
|
|
41
|
+
let valueNew = 0;
|
|
42
|
+
if (row !== null && row !== void 0 && row.value && Math.abs(row.value) > 0 && row.value % 1 !== 0) {
|
|
43
|
+
var _row$value;
|
|
44
|
+
valueNew = row === null || row === void 0 ? void 0 : (_row$value = row.value) === null || _row$value === void 0 ? void 0 : _row$value.toFixed(2);
|
|
45
|
+
} else {
|
|
46
|
+
valueNew = row === null || row === void 0 ? void 0 : row.value;
|
|
47
|
+
}
|
|
48
|
+
return dotCut ? (0, _CommonFunctions.getFormattedValue)(valueNew) : (0, _CommonFunctions.getNumberWithCommas)(valueNew);
|
|
49
|
+
};
|
|
50
|
+
(0, _react.useEffect)(() => {
|
|
51
|
+
const handleResize = () => {
|
|
52
|
+
setZoomResolution(window.devicePixelRatio);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Add event listener for window resize to update zoom resolution
|
|
56
|
+
window.addEventListener('resize', handleResize);
|
|
57
|
+
|
|
58
|
+
// Initial update of zoom resolution
|
|
59
|
+
setZoomResolution(window.devicePixelRatio);
|
|
60
|
+
|
|
61
|
+
// Clean up the event listener when component unmounts
|
|
62
|
+
return () => {
|
|
63
|
+
window.removeEventListener('resize', handleResize);
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
(0, _react.useEffect)(() => {
|
|
67
|
+
const MIN_RADIUS = 45;
|
|
68
|
+
if (!DoughnutChartContainerRef) return;
|
|
69
|
+
const {
|
|
70
|
+
current
|
|
71
|
+
} = DoughnutChartContainerRef;
|
|
72
|
+
if (!current) return;
|
|
73
|
+
const DoughnutChartContainerWidth = current === null || current === void 0 ? void 0 : current.clientWidth;
|
|
74
|
+
const DoughnutChartContainerHeight = current === null || current === void 0 ? void 0 : current.clientHeight;
|
|
75
|
+
const resolutionFactor = zoomResolution && zoomResolution >= 1 ? zoomResolution : 1;
|
|
76
|
+
let radius = DoughnutChartContainerWidth > DoughnutChartContainerHeight ? DoughnutChartContainerHeight / 2 / resolutionFactor : DoughnutChartContainerWidth / 2 / resolutionFactor;
|
|
77
|
+
if (radius < MIN_RADIUS) {
|
|
78
|
+
radius = MIN_RADIUS;
|
|
79
|
+
}
|
|
80
|
+
setDoughnutChartRadius(radius);
|
|
81
|
+
}, [height, width, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain = DoughnutChartContainerRef.current) === null || _DoughnutChartContain === void 0 ? void 0 : _DoughnutChartContain.clientWidth, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain2 = DoughnutChartContainerRef.current) === null || _DoughnutChartContain2 === void 0 ? void 0 : _DoughnutChartContain2.clientHeight, zoomResolution]);
|
|
82
|
+
const displayLegendValue = row => /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendFormattedValue, {
|
|
83
|
+
style: {
|
|
84
|
+
fontWeight: itemsBoldedValues ? '700' : '500'
|
|
85
|
+
}
|
|
86
|
+
}, !isPercent && row.value && currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, row.value) : '', !isPercent && row.value !== undefined && row.value !== null ? dotCutTrenty(row) : !isPercent && 'No Data', !isPercent && row.value && dotCut ? (0, _CommonFunctions.getFormattedUnits)(row.value) : '', !isPercent && row.value && itemsPercentagesValueAside && /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
style: {
|
|
88
|
+
fontWeight: itemsBoldedValues ? '700' : '400'
|
|
89
|
+
}
|
|
90
|
+
}, ' (', `${Math.round(row.value / value * 100)}%)`), isPercent && row.value && `${row.value.toFixed(1)}%`);
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.ControlsContainer, {
|
|
92
|
+
className: className,
|
|
93
|
+
height: height,
|
|
94
|
+
width: width,
|
|
95
|
+
textcolor: textcolor
|
|
96
|
+
}, legendData.length === 0 || legendData.every(item => item.value === undefined || item.value === null) ? /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
97
|
+
className: "NoDataFoundMessage",
|
|
98
|
+
noDataText: noDataText
|
|
99
|
+
}) : /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.Controls, {
|
|
100
|
+
className: "Controls",
|
|
101
|
+
height: height,
|
|
102
|
+
width: width
|
|
103
|
+
}, !hideTitleAndValue && /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TitleAndValueContainer, {
|
|
104
|
+
className: "TitleAndValueContainer"
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.Title, {
|
|
106
|
+
className: "Title"
|
|
107
|
+
}, title), /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.CurrencySignAndFormattedValueContainer, {
|
|
108
|
+
className: "CurrencySignAndFormattedValueContainer"
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.FormattedValue, {
|
|
110
|
+
className: "FormattedValue",
|
|
111
|
+
width: width
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.CurrencySign, {
|
|
113
|
+
className: "CurrencySign"
|
|
114
|
+
}, currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, value) : ''), dotCut ? (0, _CommonFunctions.getFormattedValue)(value && Math.abs(value) > 0 && value % 1 !== 0 ? value === null || value === void 0 ? void 0 : value.toFixed(2) : value) : (0, _CommonFunctions.getNumberWithCommas)(value), dotCut ? (0, _CommonFunctions.getFormattedUnits)(value) : ''), textAfterValue ? /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TextAfterValue, {
|
|
115
|
+
className: "TextAfterValue"
|
|
116
|
+
}, textAfterValue) : '', addingBenchmark && /*#__PURE__*/_react.default.createElement(_Benchmark.Benchmark, null))), /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.DoughnutChartAndLegendContainer, null, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.DoughnutChartContainer, {
|
|
117
|
+
width: width,
|
|
118
|
+
height: height,
|
|
119
|
+
ref: DoughnutChartContainerRef
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, null, /*#__PURE__*/_react.default.createElement(_recharts.PieChart, null, /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
121
|
+
fill: "#8884d8",
|
|
122
|
+
dataKey: "value",
|
|
123
|
+
blendStroke: true,
|
|
124
|
+
startAngle: -270,
|
|
125
|
+
data: legendData,
|
|
126
|
+
outerRadius: DoughnutChartRadius - 4,
|
|
127
|
+
innerRadius: DoughnutChartRadius - DoughnutChartRadius / 3
|
|
128
|
+
}, legendData.map(row => /*#__PURE__*/_react.default.createElement(_recharts.Cell, {
|
|
129
|
+
key: `cell-${row.name}`,
|
|
130
|
+
fill: row.color
|
|
131
|
+
}))), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
132
|
+
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, {
|
|
133
|
+
value: value,
|
|
134
|
+
isPercent: isPercent
|
|
135
|
+
})
|
|
136
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null)))), /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendContainer, null, legendData.map(row => /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendControlsContainer, {
|
|
137
|
+
key: row.name
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendColorRectangle, {
|
|
139
|
+
color: row.color
|
|
140
|
+
}), /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendTitleAndFormatedValueContainer, null, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendTitle, {
|
|
141
|
+
style: {
|
|
142
|
+
flexDirection: itemsValuesSeparateLine ? 'column' : 'row',
|
|
143
|
+
alignItems: itemsValuesSeparateLine ? 'baseline' : 'center'
|
|
144
|
+
}
|
|
145
|
+
}, row.name, displayLegendValue(row)))))))));
|
|
146
|
+
};
|
|
147
|
+
exports.TotalDoughnutChart = TotalDoughnutChart;
|
|
148
|
+
var _default = exports.default = TotalDoughnutChart;
|
|
149
|
+
TotalDoughnutChart.defaultProps = {
|
|
150
|
+
className: '',
|
|
151
|
+
title: '',
|
|
152
|
+
value: 0,
|
|
153
|
+
addingBenchmark: false,
|
|
154
|
+
dotCut: false,
|
|
155
|
+
currencySign: false,
|
|
156
|
+
currencyType: 'USD',
|
|
157
|
+
legendData: [],
|
|
158
|
+
itemsPercentagesValueAside: true,
|
|
159
|
+
itemsBoldedValues: true,
|
|
160
|
+
itemsValuesSeparateLine: true,
|
|
161
|
+
width: '100%',
|
|
162
|
+
height: '100%',
|
|
163
|
+
textcolor: '#212121',
|
|
164
|
+
isPercent: false,
|
|
165
|
+
hideTitleAndValue: false,
|
|
166
|
+
noDataText: 'No Data',
|
|
167
|
+
textAfterValue: ''
|
|
168
|
+
};
|
|
169
|
+
function CustomTooltip(_ref) {
|
|
170
|
+
let {
|
|
171
|
+
active,
|
|
172
|
+
payload,
|
|
173
|
+
value,
|
|
174
|
+
isPercent = false
|
|
175
|
+
} = _ref;
|
|
176
|
+
if (active && payload && payload.length) {
|
|
177
|
+
// eslint-disable-next-line no-nested-ternary
|
|
178
|
+
const percent = value && value !== 0 && !isPercent ? (payload[0].value / value * 100).toFixed(1) : value && isPercent ? payload[0].value.toFixed(1) : 0;
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TooltipLabel, null, `${payload[0].name} ${percent}%`));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
CustomTooltip.defaultProps = {
|
|
183
|
+
active: '',
|
|
184
|
+
payload: '',
|
|
185
|
+
value: '',
|
|
186
|
+
isPercent: false
|
|
187
|
+
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TooltipLabel = exports.TooltipDiv = exports.TitleAndValueContainer = exports.Title = exports.TextAfterValue = exports.LegendTitleAndFormatedValueContainer = exports.LegendTitle = exports.LegendFormattedValue = exports.LegendFormatedValueContainer = exports.LegendControlsContainer = exports.LegendContainer = exports.LegendColorRectangle = exports.FormattedValue = exports.DoughnutChartContainer = exports.DoughnutChartAndLegendContainer = exports.CurrencySignAndFormattedValueContainer = exports.CurrencySign = exports.ControlsContainer = exports.Controls = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
const scrollableStyles = `
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
|
|
12
|
+
&::-webkit-scrollbar {
|
|
13
|
+
width: 8px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&::-webkit-scrollbar-track {
|
|
17
|
+
background: #E8E8E8;
|
|
18
|
+
border-radius: 5px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&::-webkit-scrollbar-thumb {
|
|
22
|
+
background: #D0D0D0;
|
|
23
|
+
border-radius: 5px;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
|
|
27
|
+
position: relative;
|
|
28
|
+
font-family: "Poppins", sans-serif;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-size: ${props => props.rootFont};
|
|
31
|
+
color: ${props => props.textColor};
|
|
32
|
+
width: ${props => props.width};
|
|
33
|
+
height: ${props => props.height};
|
|
34
|
+
border-radius: 12px;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
@media (max-width: 1536px) {
|
|
38
|
+
${scrollableStyles}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
> * {
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const Controls = exports.Controls = _styledComponents.default.div`
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
background: white;
|
|
51
|
+
border-radius: 12px;
|
|
52
|
+
`;
|
|
53
|
+
const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div`
|
|
54
|
+
display: flex;
|
|
55
|
+
background: white;
|
|
56
|
+
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.2);
|
|
57
|
+
border-radius: 5px;
|
|
58
|
+
padding: 6px 10px;
|
|
59
|
+
margin: 0;
|
|
60
|
+
`;
|
|
61
|
+
const TooltipLabel = exports.TooltipLabel = _styledComponents.default.p`
|
|
62
|
+
color: #212121;
|
|
63
|
+
font-family: "Poppins", sans-serif;
|
|
64
|
+
font-size: 12px;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
font-style: normal;
|
|
67
|
+
width: max-content; // fit-content;
|
|
68
|
+
line-height: normal;
|
|
69
|
+
margin: 0;
|
|
70
|
+
`;
|
|
71
|
+
const TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div`
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
padding: 0 20px;
|
|
75
|
+
`;
|
|
76
|
+
const Title = exports.Title = _styledComponents.default.h4`
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
font-size: 1rem;
|
|
79
|
+
margin: 0;
|
|
80
|
+
@media (max-width: 1536px) {
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
}
|
|
83
|
+
@media (max-width: 1366px) {
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
const CurrencySignAndFormattedValueContainer = exports.CurrencySignAndFormattedValueContainer = _styledComponents.default.div`
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 5px;
|
|
91
|
+
align-items: baseline;
|
|
92
|
+
`;
|
|
93
|
+
const CurrencySign = exports.CurrencySign = _styledComponents.default.span`
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
font-size: 16px;
|
|
96
|
+
@media (max-width: 1536px) {
|
|
97
|
+
font-size: 14px;
|
|
98
|
+
}
|
|
99
|
+
@media (max-width: 1366px) {
|
|
100
|
+
font-size: 11px;
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
const FormattedValue = exports.FormattedValue = _styledComponents.default.div`
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
font-size: 40px;
|
|
106
|
+
@media (max-width: 1536px) {
|
|
107
|
+
font-size: 24px;
|
|
108
|
+
}
|
|
109
|
+
@media (max-width: 1366px) {
|
|
110
|
+
font-size: 20px;
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
const TextAfterValue = exports.TextAfterValue = _styledComponents.default.div`
|
|
114
|
+
font-weight: 400;
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
@media (max-width: 1536px) {
|
|
117
|
+
font-size: 11px;
|
|
118
|
+
}
|
|
119
|
+
@media (max-width: 1366px) {
|
|
120
|
+
font-size: 10px;
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
const DoughnutChartAndLegendContainer = exports.DoughnutChartAndLegendContainer = _styledComponents.default.div`
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
margin-top: auto;
|
|
127
|
+
padding: 0 20px ;
|
|
128
|
+
margin-bottom: 20px;
|
|
129
|
+
`;
|
|
130
|
+
const DoughnutChartContainer = exports.DoughnutChartContainer = _styledComponents.default.div`
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
min-width: 90px;
|
|
134
|
+
min-height: 90px;
|
|
135
|
+
`;
|
|
136
|
+
const LegendContainer = exports.LegendContainer = _styledComponents.default.div`
|
|
137
|
+
padding-left: 10px;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
justify-content: space-evenly;
|
|
141
|
+
`;
|
|
142
|
+
const LegendControlsContainer = exports.LegendControlsContainer = _styledComponents.default.div`
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 0.5rem;
|
|
145
|
+
align-items: center;
|
|
146
|
+
margin-bottom: 0.375rem;
|
|
147
|
+
`;
|
|
148
|
+
const LegendTitleAndFormatedValueContainer = exports.LegendTitleAndFormatedValueContainer = _styledComponents.default.div`
|
|
149
|
+
flex-grow: 1;
|
|
150
|
+
`;
|
|
151
|
+
const LegendFormatedValueContainer = exports.LegendFormatedValueContainer = _styledComponents.default.div`
|
|
152
|
+
font-size: 0.875rem;
|
|
153
|
+
`;
|
|
154
|
+
const LegendColorRectangle = exports.LegendColorRectangle = _styledComponents.default.div`
|
|
155
|
+
width: 0.875rem;
|
|
156
|
+
min-width: 0.875rem;
|
|
157
|
+
height: 0.875rem;
|
|
158
|
+
border-radius: 2px;
|
|
159
|
+
background: ${props => props.color};
|
|
160
|
+
`;
|
|
161
|
+
const LegendTitle = exports.LegendTitle = _styledComponents.default.h5`
|
|
162
|
+
font-weight: 400;
|
|
163
|
+
font-size: 16px;
|
|
164
|
+
gap: 5px;
|
|
165
|
+
margin: 0;
|
|
166
|
+
display: flex;
|
|
167
|
+
justify-content: space-between;
|
|
168
|
+
@media (max-width: 1536px) {
|
|
169
|
+
font-size: 11px;
|
|
170
|
+
}
|
|
171
|
+
@media (max-width: 1366px) {
|
|
172
|
+
font-size: 10px;
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
175
|
+
const LegendFormattedValue = exports.LegendFormattedValue = _styledComponents.default.span`
|
|
176
|
+
font-weight: 500;
|
|
177
|
+
white-space: nowrap;
|
|
178
|
+
`;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.TotalHorizontalCharts = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _recharts = require("recharts");
|
|
11
|
+
var _TspanTooltip = _interopRequireDefault(require("./TspanTooltip"));
|
|
12
|
+
var _NoDataFoundMessage = require("./NoDataFoundMessage");
|
|
13
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
14
|
+
var _TotalHorizontalCharts = require("./TotalHorizontalCharts.style");
|
|
15
|
+
/* eslint-disable no-unused-vars */
|
|
16
|
+
/* eslint-disable react/prop-types */
|
|
17
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
18
|
+
/* eslint-disable no-shadow */
|
|
19
|
+
/* eslint-disable react/destructuring-assignment */
|
|
20
|
+
|
|
21
|
+
const TotalHorizontalCharts = props => {
|
|
22
|
+
const {
|
|
23
|
+
title,
|
|
24
|
+
value,
|
|
25
|
+
dotCut,
|
|
26
|
+
currencySign,
|
|
27
|
+
currencyType,
|
|
28
|
+
chartsData,
|
|
29
|
+
showScrollerBarsCount,
|
|
30
|
+
labelFontSize,
|
|
31
|
+
labelLimitedLetters,
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
rightGap,
|
|
35
|
+
textColor,
|
|
36
|
+
noDataText,
|
|
37
|
+
showPercentAsideValue,
|
|
38
|
+
isDollar,
|
|
39
|
+
isPercentage,
|
|
40
|
+
showDollarSign,
|
|
41
|
+
className,
|
|
42
|
+
hideTotalValue,
|
|
43
|
+
hideTitle
|
|
44
|
+
} = props;
|
|
45
|
+
const barBackgrounds = chartsData.map(bg => bg.color);
|
|
46
|
+
const topHeader = (0, _react.useRef)();
|
|
47
|
+
const wrapper = (0, _react.useRef)();
|
|
48
|
+
const BAR_HEIGHT = 40; // Height of each bar including padding
|
|
49
|
+
const CHART_PADDING = 40; // Total padding for chart (top + bottom)
|
|
50
|
+
|
|
51
|
+
// Inside the TotalHorizontalCharts component
|
|
52
|
+
const calculateChartHeight = () => {
|
|
53
|
+
if (!(chartsData !== null && chartsData !== void 0 && chartsData.length)) return 0;
|
|
54
|
+
if (chartsData.length > showScrollerBarsCount) {
|
|
55
|
+
return chartsData.length * BAR_HEIGHT + CHART_PADDING;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Calculate height to show only specified number of bars
|
|
59
|
+
const visibleBarsHeight = showScrollerBarsCount * BAR_HEIGHT;
|
|
60
|
+
|
|
61
|
+
// Use the smaller value between:
|
|
62
|
+
// 1. Height needed for all bars
|
|
63
|
+
// 2. Height needed for specified number of bars
|
|
64
|
+
return Math.min(chartsData.length * BAR_HEIGHT + CHART_PADDING, visibleBarsHeight + CHART_PADDING);
|
|
65
|
+
};
|
|
66
|
+
const [showLegendTooltip, setShowLegendTooltip] = (0, _react.useState)(false);
|
|
67
|
+
const [tooltipText, setTooltipText] = (0, _react.useState)({
|
|
68
|
+
content: '',
|
|
69
|
+
clientX: 0,
|
|
70
|
+
clientY: 0
|
|
71
|
+
});
|
|
72
|
+
const CustomizedLabel = props => showPercentAsideValue ? /*#__PURE__*/_react.default.createElement("text", {
|
|
73
|
+
x: props.x + (props.width <= 0 ? -12 : props.width) + 56,
|
|
74
|
+
y: props.y + 4,
|
|
75
|
+
dy: props.height / 2,
|
|
76
|
+
dx: -8,
|
|
77
|
+
fill: props.stroke,
|
|
78
|
+
fontSize: 12,
|
|
79
|
+
fontWeight: 500,
|
|
80
|
+
textAnchor: "middle"
|
|
81
|
+
}, ''.concat((0, _CommonFunctions.getFormattedValue)(props.value), (0, _CommonFunctions.getFormattedUnits)(props.value)), /*#__PURE__*/_react.default.createElement("tspan", {
|
|
82
|
+
fontWeight: 400
|
|
83
|
+
}, ` (${(props.value / value * 100).toFixed(0)}%)`)) : /*#__PURE__*/_react.default.createElement("text", {
|
|
84
|
+
x: props.x + (props.width <= 0 ? -12 : props.width) + 40,
|
|
85
|
+
y: props.y + 4,
|
|
86
|
+
dy: props.height / 2,
|
|
87
|
+
dx: -8,
|
|
88
|
+
fill: props.stroke,
|
|
89
|
+
fontSize: 12,
|
|
90
|
+
fontWeight: 400,
|
|
91
|
+
textAnchor: "middle"
|
|
92
|
+
}, !isDollar ? ''.concat((0, _CommonFunctions.getFormattedValue)(props.value), isPercentage ? '%' : (0, _CommonFunctions.getFormattedUnits)(props.value)) : ''.concat(showDollarSign ? '$' : '', (0, _CommonFunctions.getFormattedValue)(props.value), (0, _CommonFunctions.getFormattedUnits)(props.value)));
|
|
93
|
+
const CustomizedTickBarChart = props => {
|
|
94
|
+
const {
|
|
95
|
+
x,
|
|
96
|
+
y,
|
|
97
|
+
height,
|
|
98
|
+
payload,
|
|
99
|
+
fill,
|
|
100
|
+
orientation,
|
|
101
|
+
stroke
|
|
102
|
+
} = props;
|
|
103
|
+
const handleMouseEnter = content => {
|
|
104
|
+
setTooltipText(prevState => ({
|
|
105
|
+
...prevState,
|
|
106
|
+
content: content !== prevState.content ? content : prevState.content,
|
|
107
|
+
clientX: x / 1.2,
|
|
108
|
+
clientY: y - 20
|
|
109
|
+
}));
|
|
110
|
+
setShowLegendTooltip(true);
|
|
111
|
+
};
|
|
112
|
+
const handleMouseLeave = () => {
|
|
113
|
+
if (showLegendTooltip === false) return;
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
setShowLegendTooltip(false);
|
|
116
|
+
}, 1200);
|
|
117
|
+
};
|
|
118
|
+
if (chartsData && chartsData.length > 0 && payload) {
|
|
119
|
+
const chartsDataLabel = chartsData.filter(item => item.name === payload.value);
|
|
120
|
+
if (chartsDataLabel && chartsDataLabel.length > 0) {
|
|
121
|
+
return /*#__PURE__*/_react.default.createElement("g", {
|
|
122
|
+
onMouseEnter: () => handleMouseEnter(payload.value),
|
|
123
|
+
onMouseLeave: handleMouseLeave
|
|
124
|
+
}, /*#__PURE__*/_react.default.createElement("text", {
|
|
125
|
+
style: {
|
|
126
|
+
whiteSpace: 'nowrap'
|
|
127
|
+
},
|
|
128
|
+
height: height,
|
|
129
|
+
x: 20,
|
|
130
|
+
y: y,
|
|
131
|
+
fontSize: labelFontSize,
|
|
132
|
+
orientation: orientation,
|
|
133
|
+
stroke: stroke,
|
|
134
|
+
textAnchor: "start"
|
|
135
|
+
// verticalAnchor="middle"
|
|
136
|
+
,
|
|
137
|
+
fill: fill
|
|
138
|
+
}, payload.value.length > labelLimitedLetters - 1 ? `${payload.value.slice(0, labelLimitedLetters)}...` : payload.value));
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
};
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(_TotalHorizontalCharts.ControlsContainer, {
|
|
145
|
+
ref: wrapper,
|
|
146
|
+
height: height,
|
|
147
|
+
width: width,
|
|
148
|
+
textColor: textColor,
|
|
149
|
+
scroller: chartsData.length > showScrollerBarsCount ? 'auto' : 'hidden',
|
|
150
|
+
className: className
|
|
151
|
+
}, (chartsData === null || chartsData === void 0 ? void 0 : chartsData.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hideTitle || !hideTotalValue ? /*#__PURE__*/_react.default.createElement(_TotalHorizontalCharts.CardHeader, {
|
|
152
|
+
ref: topHeader,
|
|
153
|
+
className: "CardHeader"
|
|
154
|
+
}, !hideTitle ? /*#__PURE__*/_react.default.createElement(_TotalHorizontalCharts.Title, null, title) : '', !hideTotalValue ? /*#__PURE__*/_react.default.createElement(_TotalHorizontalCharts.TotalValue, {
|
|
155
|
+
className: "TotalValue"
|
|
156
|
+
}, currencySign && /*#__PURE__*/_react.default.createElement(_TotalHorizontalCharts.CurrencySign, {
|
|
157
|
+
className: "CurrencySign"
|
|
158
|
+
}, (0, _CommonFunctions.getCurrencySign)(currencyType, value)), dotCut ? (0, _CommonFunctions.getFormattedValue)(value && Math.abs(value) > 0 && value % 1 !== 0 ? value === null || value === void 0 ? void 0 : value.toFixed(2) : value) : (0, _CommonFunctions.getNumberWithCommas)(value), dotCut ? (0, _CommonFunctions.getFormattedUnits)(value) : '') : '') : '', /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
159
|
+
width: "100%",
|
|
160
|
+
height: calculateChartHeight()
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
162
|
+
layout: "vertical",
|
|
163
|
+
data: chartsData,
|
|
164
|
+
margin: {
|
|
165
|
+
top: 10,
|
|
166
|
+
right: 20,
|
|
167
|
+
bottom: 20,
|
|
168
|
+
left: 10
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
|
|
171
|
+
type: "number",
|
|
172
|
+
domain: [0, dataMax => dataMax * rightGap]
|
|
173
|
+
// allowDataOverflow={false}
|
|
174
|
+
,
|
|
175
|
+
hide: true
|
|
176
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
|
|
177
|
+
dataKey: "name",
|
|
178
|
+
type: "category",
|
|
179
|
+
width: labelLimitedLetters * 10,
|
|
180
|
+
tickLine: false,
|
|
181
|
+
axisLine: false,
|
|
182
|
+
interval: 0,
|
|
183
|
+
allowDataOverflow: true,
|
|
184
|
+
tick: CustomizedTickBarChart
|
|
185
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
186
|
+
dataKey: "value",
|
|
187
|
+
barSize: 20,
|
|
188
|
+
fill: "#8884d8",
|
|
189
|
+
barCategoryGap: 10,
|
|
190
|
+
barGap: 5
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.LabelList, {
|
|
192
|
+
dataKey: "value",
|
|
193
|
+
content: CustomizedLabel
|
|
194
|
+
}), chartsData.map((entry, index) =>
|
|
195
|
+
/*#__PURE__*/
|
|
196
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
197
|
+
_react.default.createElement(_recharts.Cell, {
|
|
198
|
+
key: `cell-${index}`,
|
|
199
|
+
fill: barBackgrounds[index % 20]
|
|
200
|
+
}))), showLegendTooltip && /*#__PURE__*/_react.default.createElement(_TspanTooltip.default, {
|
|
201
|
+
direction: "top",
|
|
202
|
+
content: tooltipText.content,
|
|
203
|
+
top: tooltipText.clientY,
|
|
204
|
+
left: tooltipText.clientX,
|
|
205
|
+
style: {
|
|
206
|
+
pointerEvents: 'none'
|
|
207
|
+
}
|
|
208
|
+
})))) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
209
|
+
noDataText: noDataText
|
|
210
|
+
}));
|
|
211
|
+
};
|
|
212
|
+
exports.TotalHorizontalCharts = TotalHorizontalCharts;
|
|
213
|
+
var _default = exports.default = TotalHorizontalCharts;
|
|
214
|
+
TotalHorizontalCharts.defaultProps = {
|
|
215
|
+
className: '',
|
|
216
|
+
title: 'SALES',
|
|
217
|
+
value: 0,
|
|
218
|
+
dotCut: false,
|
|
219
|
+
currencySign: false,
|
|
220
|
+
currencyType: 'USD',
|
|
221
|
+
chartsData: [],
|
|
222
|
+
showScrollerBarsCount: 7,
|
|
223
|
+
showPercentAsideValue: false,
|
|
224
|
+
labelFontSize: 10,
|
|
225
|
+
labelLimitedLetters: 12,
|
|
226
|
+
width: '100%',
|
|
227
|
+
height: '100%',
|
|
228
|
+
rightGap: 1,
|
|
229
|
+
textColor: '#212121',
|
|
230
|
+
noDataText: 'No Data',
|
|
231
|
+
isDollar: true,
|
|
232
|
+
isPercentage: false,
|
|
233
|
+
showDollarSign: true,
|
|
234
|
+
hideTotalValue: false,
|
|
235
|
+
hideTitle: false
|
|
236
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TotalValue = exports.Title = exports.CurrencySign = exports.ControlsContainer = exports.ChartWrapper = exports.CardHeader = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
|
|
10
|
+
font-family: "Poppins", sans-serif;
|
|
11
|
+
background-color: white;
|
|
12
|
+
color: ${props => props.textColor};
|
|
13
|
+
width: ${props => props.width};
|
|
14
|
+
height: ${props => props.height};
|
|
15
|
+
/* display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
overflow: hidden; */
|
|
18
|
+
overflow-y: ${props => props.scroller};
|
|
19
|
+
|
|
20
|
+
&::-webkit-scrollbar {
|
|
21
|
+
width: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&::-webkit-scrollbar-track {
|
|
25
|
+
background: #E8E8E8;
|
|
26
|
+
border-radius: 5px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&::-webkit-scrollbar-thumb {
|
|
30
|
+
background: #D0D0D0;
|
|
31
|
+
border-radius: 5px;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const ChartWrapper = exports.ChartWrapper = _styledComponents.default.div`
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
height: 100%;
|
|
37
|
+
|
|
38
|
+
&::-webkit-scrollbar {
|
|
39
|
+
width: 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&::-webkit-scrollbar-track {
|
|
43
|
+
background: #E8E8E8;
|
|
44
|
+
border-radius: 5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&::-webkit-scrollbar-thumb {
|
|
48
|
+
background: #D0D0D0;
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const CardHeader = exports.CardHeader = _styledComponents.default.div`
|
|
53
|
+
padding: 16px;
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: 0;
|
|
56
|
+
z-index: 10;
|
|
57
|
+
background-color: white;
|
|
58
|
+
`;
|
|
59
|
+
const TotalValue = exports.TotalValue = _styledComponents.default.div`
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
font-size: 40px;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: baseline;
|
|
64
|
+
line-height: 1;
|
|
65
|
+
@media (max-width: 1536px) {
|
|
66
|
+
font-size: 24px;
|
|
67
|
+
}
|
|
68
|
+
@media (max-width: 1366px) {
|
|
69
|
+
font-size: 20px;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
const Title = exports.Title = _styledComponents.default.h4`
|
|
73
|
+
font-size: 18px;
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
line-height: 1;
|
|
76
|
+
margin: 0 0 8px;
|
|
77
|
+
@media (max-width: 1536px) {
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
}
|
|
80
|
+
@media (max-width: 1366px) {
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const CurrencySign = exports.CurrencySign = _styledComponents.default.span`
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
font-size: 16px;
|
|
87
|
+
@media (max-width: 1536px) {
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
}
|
|
90
|
+
@media (max-width: 1366px) {
|
|
91
|
+
font-size: 11px;
|
|
92
|
+
}
|
|
93
|
+
`;
|