sag_components 2.0.0-beta26 → 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 +4257 -4248
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +323 -314
- 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 +3 -3
|
@@ -0,0 +1,306 @@
|
|
|
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.BarChartsByWeeks = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _recharts = require("recharts");
|
|
11
|
+
var _FormattedValue = require("./FormattedValue");
|
|
12
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
13
|
+
var _BarChartsByWeeks = require("./BarChartsByWeeks.style");
|
|
14
|
+
var _PerformanceAnalyticsLegend = _interopRequireDefault(require("./PerformanceAnalyticsLegend"));
|
|
15
|
+
/* eslint-disable no-nested-ternary */
|
|
16
|
+
|
|
17
|
+
const ICON_TYPE_SQUARE = 'Square';
|
|
18
|
+
const ICON_TYPE_LEGEND_LINE_ICON = 'LegendLineIcon';
|
|
19
|
+
const BarChartsByWeeks = props => {
|
|
20
|
+
const {
|
|
21
|
+
className,
|
|
22
|
+
title,
|
|
23
|
+
showHeaderTopValue,
|
|
24
|
+
headerValueTopTitle,
|
|
25
|
+
headerValueBottomTitle,
|
|
26
|
+
headerValue,
|
|
27
|
+
HeaderValueCurrencyType,
|
|
28
|
+
HeaderValueIsPercent,
|
|
29
|
+
barChartData,
|
|
30
|
+
isTitleOriganal,
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
barChartColor,
|
|
34
|
+
barChartSecondColor,
|
|
35
|
+
xselectedColor,
|
|
36
|
+
tooltipTitle,
|
|
37
|
+
tooltipSecondTitle,
|
|
38
|
+
startWeekRange = 0,
|
|
39
|
+
endWeekRange = 0,
|
|
40
|
+
yAxisCounter,
|
|
41
|
+
isPercentValue,
|
|
42
|
+
interval,
|
|
43
|
+
showTitle,
|
|
44
|
+
showLegend,
|
|
45
|
+
legendData,
|
|
46
|
+
showTwoBars,
|
|
47
|
+
setLimitHeight,
|
|
48
|
+
setLimitLow
|
|
49
|
+
} = props;
|
|
50
|
+
|
|
51
|
+
// const [BarChartContainerWidth, setBarChartContainerWidth] = useState(0);
|
|
52
|
+
// const [BarChartContainerHeight, setBarChartContainerHeight] = useState(0);
|
|
53
|
+
|
|
54
|
+
const controlsContainerRef = (0, _react.useRef)();
|
|
55
|
+
|
|
56
|
+
// useEffect(() => {
|
|
57
|
+
// const { offsetWidth } = controlsContainerRef.current;
|
|
58
|
+
// setBarChartContainerWidth(offsetWidth - 20);
|
|
59
|
+
// }, [width]);
|
|
60
|
+
|
|
61
|
+
// useEffect(() => {
|
|
62
|
+
// const { offsetHeight } = controlsContainerRef.current;
|
|
63
|
+
// setBarChartContainerHeight(offsetHeight - 40);
|
|
64
|
+
// }, [height]);
|
|
65
|
+
|
|
66
|
+
const displayFormattedValue = value => {
|
|
67
|
+
if (!value) return '';
|
|
68
|
+
let formattedValue = '';
|
|
69
|
+
formattedValue = isPercentValue ? ''.concat('', value.toFixed(1), '%') : ''.concat('', (0, _CommonFunctions.getFormattedValue)(value), (0, _CommonFunctions.getFormattedUnits)(value));
|
|
70
|
+
return formattedValue;
|
|
71
|
+
};
|
|
72
|
+
const formmatedData = barChartData === null || barChartData === void 0 ? void 0 : barChartData.map(item => {
|
|
73
|
+
if (setLimitHeight && item.value > setLimitHeight) {
|
|
74
|
+
return {
|
|
75
|
+
title: item.title,
|
|
76
|
+
value: setLimitHeight,
|
|
77
|
+
secondValue: item.secondValue
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (setLimitLow && item.value < setLimitLow) {
|
|
81
|
+
return {
|
|
82
|
+
title: item.title,
|
|
83
|
+
value: setLimitLow,
|
|
84
|
+
secondValue: item.secondValue
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
title: item.title,
|
|
89
|
+
value: item.value,
|
|
90
|
+
secondValue: item.secondValue
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
95
|
+
const CustomTooltip = tooltipData => {
|
|
96
|
+
var _payload$0$payload, _payload$0$payload2, _payload$0$payload3, _payload$0$payload4;
|
|
97
|
+
const {
|
|
98
|
+
active,
|
|
99
|
+
payload,
|
|
100
|
+
label
|
|
101
|
+
} = tooltipData;
|
|
102
|
+
if (!active || !payload || (payload === null || payload === void 0 ? void 0 : payload.length) === 0) return null;
|
|
103
|
+
const week = isTitleOriganal ? label : label && (label === null || label === void 0 ? void 0 : label.toString().length) === 6 ? label.toString().substring(4, 6) : 0;
|
|
104
|
+
let currentTooltipValue = 0;
|
|
105
|
+
let currentTooltipSecondValue = 0;
|
|
106
|
+
if ((_payload$0$payload = payload[0].payload) !== null && _payload$0$payload !== void 0 && _payload$0$payload.value) currentTooltipValue = (_payload$0$payload2 = payload[0].payload) === null || _payload$0$payload2 === void 0 ? void 0 : _payload$0$payload2.value;
|
|
107
|
+
if ((_payload$0$payload3 = payload[0].payload) !== null && _payload$0$payload3 !== void 0 && _payload$0$payload3.secondValue) currentTooltipSecondValue = (_payload$0$payload4 = payload[0].payload) === null || _payload$0$payload4 === void 0 ? void 0 : _payload$0$payload4.secondValue;
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipTitle, null, `${isTitleOriganal ? '' : 'Week: '}${week}`), /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipLabel, null, `${tooltipTitle}
|
|
109
|
+
${displayFormattedValue(currentTooltipValue)}
|
|
110
|
+
`), currentTooltipSecondValue ? /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipLabel, null, `${tooltipSecondTitle}
|
|
111
|
+
${displayFormattedValue(currentTooltipSecondValue)}
|
|
112
|
+
`) : '');
|
|
113
|
+
};
|
|
114
|
+
const getWeek = () => {
|
|
115
|
+
if (!barChartData || (barChartData === null || barChartData === void 0 ? void 0 : barChartData.length) === 0) return null;
|
|
116
|
+
const newFormattedData = barChartData === null || barChartData === void 0 ? void 0 : barChartData.map(item => {
|
|
117
|
+
var _item$title;
|
|
118
|
+
return {
|
|
119
|
+
...item,
|
|
120
|
+
titleWeek: item.title && isTitleOriganal ? item.title : ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.toString().length) === 6 ? item.title.toString().substring(4, 6) : 0
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return newFormattedData;
|
|
124
|
+
};
|
|
125
|
+
const displayEventWeeksElements = () => {
|
|
126
|
+
var _getWeek;
|
|
127
|
+
if (!barChartData || barChartData.length === 0) return '';
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElementsContainer, null, (_getWeek = getWeek()) === null || _getWeek === void 0 ? void 0 : _getWeek.map(item => {
|
|
129
|
+
var _item$title2, _item$title3;
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElement, {
|
|
131
|
+
color: item.title >= startWeekRange && item.title <= endWeekRange ? xselectedColor : '',
|
|
132
|
+
textColor: item.title >= startWeekRange && item.title <= endWeekRange ? '#212121' : '#B1B1B1',
|
|
133
|
+
fontWeight: item.title >= startWeekRange && item.title <= endWeekRange ? 600 : 400,
|
|
134
|
+
borderLeftRadius: startWeekRange && (item === null || item === void 0 ? void 0 : (_item$title2 = item.title) === null || _item$title2 === void 0 ? void 0 : _item$title2.toString()) === (startWeekRange === null || startWeekRange === void 0 ? void 0 : startWeekRange.toString()) ? '12px' : '0px',
|
|
135
|
+
borderRightRadius: endWeekRange && (item === null || item === void 0 ? void 0 : (_item$title3 = item.title) === null || _item$title3 === void 0 ? void 0 : _item$title3.toString()) === (endWeekRange === null || endWeekRange === void 0 ? void 0 : endWeekRange.toString()) ? '12px' : '0px'
|
|
136
|
+
}, item.titleWeek);
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
const displayEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendMainContainer, {
|
|
140
|
+
className: "EventWeeksLegendMainContainer"
|
|
141
|
+
}, displayEventWeeksElements());
|
|
142
|
+
const getControlsHeight = () => {
|
|
143
|
+
if (!(controlsContainerRef !== null && controlsContainerRef !== void 0 && controlsContainerRef.current)) return '100%';
|
|
144
|
+
const {
|
|
145
|
+
offsetHeight
|
|
146
|
+
} = controlsContainerRef.current;
|
|
147
|
+
let newHeight = offsetHeight - 20;
|
|
148
|
+
if (title) {
|
|
149
|
+
newHeight -= 20;
|
|
150
|
+
}
|
|
151
|
+
if (headerValueTopTitle) {
|
|
152
|
+
newHeight -= 16;
|
|
153
|
+
}
|
|
154
|
+
if (headerValueBottomTitle) {
|
|
155
|
+
newHeight -= 16;
|
|
156
|
+
}
|
|
157
|
+
if (headerValue) {
|
|
158
|
+
newHeight -= 42;
|
|
159
|
+
}
|
|
160
|
+
if (showLegend) {
|
|
161
|
+
newHeight -= 34;
|
|
162
|
+
}
|
|
163
|
+
return `${newHeight}px`;
|
|
164
|
+
};
|
|
165
|
+
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.ControlsContainer, {
|
|
166
|
+
className: className,
|
|
167
|
+
height: height,
|
|
168
|
+
width: width,
|
|
169
|
+
ref: controlsContainerRef
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Controls, {
|
|
171
|
+
height: getControlsHeight()
|
|
172
|
+
}, showTitle && /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TitleAndValueContainer, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Title, null, title), /*#__PURE__*/_react.default.createElement(_FormattedValue.FormattedValue, {
|
|
173
|
+
title: headerValueTopTitle,
|
|
174
|
+
subtitle: headerValueBottomTitle,
|
|
175
|
+
showTopValue: showHeaderTopValue,
|
|
176
|
+
value: headerValue,
|
|
177
|
+
currencyType: HeaderValueCurrencyType,
|
|
178
|
+
isPercent: HeaderValueIsPercent,
|
|
179
|
+
dotCut: true
|
|
180
|
+
})), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
181
|
+
width: "100%",
|
|
182
|
+
height: "100%"
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
184
|
+
width: width,
|
|
185
|
+
height: height,
|
|
186
|
+
data: formmatedData,
|
|
187
|
+
margin: {
|
|
188
|
+
top: 20,
|
|
189
|
+
right: 0,
|
|
190
|
+
bottom: 0,
|
|
191
|
+
left: -5
|
|
192
|
+
}
|
|
193
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
|
|
194
|
+
strokeDasharray: "3 3",
|
|
195
|
+
vertical: false
|
|
196
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
|
|
197
|
+
dataKey: "title",
|
|
198
|
+
tick: false,
|
|
199
|
+
tickLine: false
|
|
200
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
|
|
201
|
+
tickCount: yAxisCounter,
|
|
202
|
+
interval: interval || 'preserveEnd',
|
|
203
|
+
domain: [0, 'auto'],
|
|
204
|
+
tick: {
|
|
205
|
+
fill: '#B1B1B1'
|
|
206
|
+
},
|
|
207
|
+
axisLine: false,
|
|
208
|
+
fontWeight: 400,
|
|
209
|
+
fontSize: "12px",
|
|
210
|
+
tickLine: false,
|
|
211
|
+
tickFormatter: value => `${displayFormattedValue(value)}`
|
|
212
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
213
|
+
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
214
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), !showTwoBars ? /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
215
|
+
dataKey: "value",
|
|
216
|
+
name: "title",
|
|
217
|
+
maxBarSize: 30,
|
|
218
|
+
radius: [4, 4, 0, 0],
|
|
219
|
+
fill: barChartColor
|
|
220
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
221
|
+
dataKey: "value",
|
|
222
|
+
name: "title",
|
|
223
|
+
maxBarSize: 30,
|
|
224
|
+
stackId: "a",
|
|
225
|
+
fill: barChartColor
|
|
226
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
227
|
+
dataKey: "secondValue",
|
|
228
|
+
name: "title",
|
|
229
|
+
maxBarSize: 30,
|
|
230
|
+
radius: [4, 4, 0, 0],
|
|
231
|
+
stackId: "a",
|
|
232
|
+
fill: barChartSecondColor
|
|
233
|
+
})))), displayEventWeeksLegendData(), showLegend && /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.LegendWrapper, null, /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsLegend.default, {
|
|
234
|
+
legendData: legendData
|
|
235
|
+
}))));
|
|
236
|
+
};
|
|
237
|
+
exports.BarChartsByWeeks = BarChartsByWeeks;
|
|
238
|
+
var _default = exports.default = BarChartsByWeeks;
|
|
239
|
+
BarChartsByWeeks.defaultProps = {
|
|
240
|
+
className: '',
|
|
241
|
+
title: '',
|
|
242
|
+
showHeaderTopValue: true,
|
|
243
|
+
headerValueTopTitle: '',
|
|
244
|
+
headerValueBottomTitle: '',
|
|
245
|
+
headerValue: 0,
|
|
246
|
+
HeaderValueCurrencyType: '',
|
|
247
|
+
HeaderValueIsPercent: false,
|
|
248
|
+
barChartData: [{
|
|
249
|
+
title: '202320',
|
|
250
|
+
value: 542366
|
|
251
|
+
}, {
|
|
252
|
+
title: '202321',
|
|
253
|
+
value: 699511
|
|
254
|
+
}, {
|
|
255
|
+
title: '202322',
|
|
256
|
+
value: 403092
|
|
257
|
+
}, {
|
|
258
|
+
title: '202323',
|
|
259
|
+
value: 396184
|
|
260
|
+
}, {
|
|
261
|
+
title: '202324',
|
|
262
|
+
value: 415317
|
|
263
|
+
}, {
|
|
264
|
+
title: '202325',
|
|
265
|
+
value: 568376
|
|
266
|
+
}, {
|
|
267
|
+
title: '202326',
|
|
268
|
+
value: 1078121
|
|
269
|
+
}, {
|
|
270
|
+
title: '202327',
|
|
271
|
+
value: 347930
|
|
272
|
+
}, {
|
|
273
|
+
title: '202328',
|
|
274
|
+
value: 346258
|
|
275
|
+
}, {
|
|
276
|
+
title: '202329',
|
|
277
|
+
value: 350184
|
|
278
|
+
}],
|
|
279
|
+
width: '100%',
|
|
280
|
+
height: '100%',
|
|
281
|
+
barChartColor: '#BD9EFF',
|
|
282
|
+
barChartSecondColor: '#42977A',
|
|
283
|
+
xselectedColor: '#42977A',
|
|
284
|
+
tooltipTitle: 'Sales',
|
|
285
|
+
tooltipSecondTitle: 'Sales 2',
|
|
286
|
+
startWeekRange: 0,
|
|
287
|
+
endWeekRange: 0,
|
|
288
|
+
yAxisCounter: 10,
|
|
289
|
+
isPercentValue: false,
|
|
290
|
+
interval: 'preserveEnd',
|
|
291
|
+
showTitle: true,
|
|
292
|
+
showLegend: true,
|
|
293
|
+
isTitleOriganal: false,
|
|
294
|
+
legendData: [{
|
|
295
|
+
title: 'Sales',
|
|
296
|
+
iconType: ICON_TYPE_SQUARE,
|
|
297
|
+
iconColor: '#90CE9C'
|
|
298
|
+
}, {
|
|
299
|
+
title: 'Category Average',
|
|
300
|
+
iconType: ICON_TYPE_LEGEND_LINE_ICON,
|
|
301
|
+
iconColor: '#C906FD'
|
|
302
|
+
}],
|
|
303
|
+
showTwoBars: false,
|
|
304
|
+
setLimitHeight: null,
|
|
305
|
+
setLimitLow: null
|
|
306
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TooltipTitle = exports.TooltipLabel = exports.TooltipDiv = exports.TitleAndValueContainer = exports.Title = exports.LegendWrapper = exports.EventWeeksLegendMainContainer = exports.EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElement = exports.ControlsContainer = exports.Controls = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
|
|
10
|
+
position: relative;
|
|
11
|
+
font-family: "Poppins", sans-serif;
|
|
12
|
+
color: #212121;
|
|
13
|
+
width: ${props => props.width};
|
|
14
|
+
height: ${props => props.height};
|
|
15
|
+
min-width: 250px;
|
|
16
|
+
`;
|
|
17
|
+
const Controls = exports.Controls = _styledComponents.default.div`
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
background: white;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
`;
|
|
24
|
+
const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div`
|
|
25
|
+
border-radius: 5px;
|
|
26
|
+
padding: 8px 12px;
|
|
27
|
+
background: white;
|
|
28
|
+
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.2);
|
|
29
|
+
margin: 0;
|
|
30
|
+
`;
|
|
31
|
+
const TooltipLabel = exports.TooltipLabel = _styledComponents.default.div`
|
|
32
|
+
color: #212121;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
font-weight: 400;
|
|
35
|
+
width: fit-content;
|
|
36
|
+
`;
|
|
37
|
+
const TooltipTitle = exports.TooltipTitle = _styledComponents.default.div`
|
|
38
|
+
color: #212121;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
`;
|
|
42
|
+
const TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div`
|
|
43
|
+
padding: 0 1rem;
|
|
44
|
+
`;
|
|
45
|
+
const Title = exports.Title = _styledComponents.default.h5`
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
font-size: 18px;
|
|
48
|
+
line-height: 20px;
|
|
49
|
+
margin: 0;
|
|
50
|
+
@media (max-width: 1536px) {
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
}
|
|
53
|
+
@media (max-width: 1366px) {
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const EventWeeksLegendMainContainer = exports.EventWeeksLegendMainContainer = _styledComponents.default.div`
|
|
58
|
+
display: flex;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
margin: 2px 0 0 0;
|
|
62
|
+
padding-left: 55px;
|
|
63
|
+
align-items: center;
|
|
64
|
+
`;
|
|
65
|
+
const EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElementsContainer = _styledComponents.default.div`
|
|
66
|
+
display: flex;
|
|
67
|
+
margin: 0px;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: space-around;
|
|
70
|
+
width: 100%;
|
|
71
|
+
`;
|
|
72
|
+
const EventWeeksLegendDataElement = exports.EventWeeksLegendDataElement = _styledComponents.default.h4`
|
|
73
|
+
display: flex;
|
|
74
|
+
font-weight: ${props => props.fontWeight};
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
line-height: 15px;
|
|
77
|
+
margin: 0;
|
|
78
|
+
width: 100%;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-content: center;
|
|
81
|
+
color: ${props => props.textColor};
|
|
82
|
+
border-top-left-radius: ${props => props.borderLeftRadius};
|
|
83
|
+
border-bottom-left-radius: ${props => props.borderLeftRadius};
|
|
84
|
+
border-top-right-radius: ${props => props.borderRightRadius};
|
|
85
|
+
border-bottom-right-radius: ${props => props.borderRightRadius};
|
|
86
|
+
background: ${props => props.color};
|
|
87
|
+
@media (max-width: 1536px) {
|
|
88
|
+
font-size: 11px;
|
|
89
|
+
}
|
|
90
|
+
@media (max-width: 1366px) {
|
|
91
|
+
font-size: 10px;
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
const LegendWrapper = exports.LegendWrapper = _styledComponents.default.div`
|
|
95
|
+
padding-top: 15px;
|
|
96
|
+
`;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Benchmark = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Benchmark = require("./Benchmark.style");
|
|
10
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
11
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
12
|
+
/* Benchmark */
|
|
13
|
+
const Benchmark = props => {
|
|
14
|
+
const {
|
|
15
|
+
totalValue,
|
|
16
|
+
currentValue,
|
|
17
|
+
benchmarkValue,
|
|
18
|
+
width,
|
|
19
|
+
height,
|
|
20
|
+
color,
|
|
21
|
+
linearGradientColor,
|
|
22
|
+
underAvarageColor,
|
|
23
|
+
linearGradientUnderAvarageColor,
|
|
24
|
+
backgroundColor,
|
|
25
|
+
tooltipLabel,
|
|
26
|
+
tooltipDirection
|
|
27
|
+
} = props;
|
|
28
|
+
const getCurrentValueRectangleWidth = () => {
|
|
29
|
+
if (!totalValue) return 0;
|
|
30
|
+
if (currentValue > totalValue) return width;
|
|
31
|
+
return currentValue / totalValue * width;
|
|
32
|
+
};
|
|
33
|
+
const getUnderAvarageColor = () => {
|
|
34
|
+
if (!totalValue) return backgroundColor;
|
|
35
|
+
if (currentValue > totalValue) return color;
|
|
36
|
+
let benchmarkCurrentValue;
|
|
37
|
+
if (!benchmarkValue) {
|
|
38
|
+
benchmarkCurrentValue = 0.5;
|
|
39
|
+
} else if (benchmarkValue > totalValue) {
|
|
40
|
+
benchmarkCurrentValue = 1;
|
|
41
|
+
} else {
|
|
42
|
+
benchmarkCurrentValue = benchmarkValue / totalValue;
|
|
43
|
+
}
|
|
44
|
+
if (currentValue === benchmarkValue) {
|
|
45
|
+
return color;
|
|
46
|
+
}
|
|
47
|
+
if (currentValue / totalValue <= benchmarkCurrentValue) {
|
|
48
|
+
return underAvarageColor;
|
|
49
|
+
}
|
|
50
|
+
return color;
|
|
51
|
+
};
|
|
52
|
+
const getUnderAvaragelinearGradientColor = () => {
|
|
53
|
+
if (!totalValue) return backgroundColor;
|
|
54
|
+
if (currentValue > totalValue) return linearGradientColor;
|
|
55
|
+
let benchmarkCurrentValue;
|
|
56
|
+
if (!benchmarkValue) {
|
|
57
|
+
benchmarkCurrentValue = 0.5;
|
|
58
|
+
} else if (benchmarkValue > totalValue) {
|
|
59
|
+
benchmarkCurrentValue = 1;
|
|
60
|
+
} else {
|
|
61
|
+
benchmarkCurrentValue = benchmarkValue / totalValue;
|
|
62
|
+
}
|
|
63
|
+
if (currentValue === benchmarkValue) {
|
|
64
|
+
return linearGradientColor;
|
|
65
|
+
}
|
|
66
|
+
if (currentValue / totalValue <= benchmarkCurrentValue) {
|
|
67
|
+
return linearGradientUnderAvarageColor;
|
|
68
|
+
}
|
|
69
|
+
return linearGradientColor;
|
|
70
|
+
};
|
|
71
|
+
const getBenchmarkLeft = () => {
|
|
72
|
+
if (!benchmarkValue) {
|
|
73
|
+
return width / 2;
|
|
74
|
+
}
|
|
75
|
+
if (benchmarkValue > totalValue) {
|
|
76
|
+
return width;
|
|
77
|
+
}
|
|
78
|
+
return width * (benchmarkValue / totalValue);
|
|
79
|
+
};
|
|
80
|
+
const getTooltipText = () => {
|
|
81
|
+
var _getFormattedValue, _getFormattedUnits;
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement("h4", null, tooltipLabel, tooltipLabel ? ': ' : '', (_getFormattedValue = (0, _CommonFunctions.getFormattedValue)(benchmarkValue)) === null || _getFormattedValue === void 0 ? void 0 : _getFormattedValue.toString(), (_getFormattedUnits = (0, _CommonFunctions.getFormattedUnits)(benchmarkValue)) === null || _getFormattedUnits === void 0 ? void 0 : _getFormattedUnits.toString());
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_Benchmark.ControlsContainer, {
|
|
85
|
+
id: "ControlsContainer",
|
|
86
|
+
height: height,
|
|
87
|
+
width: width
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
89
|
+
id: "Tooltip",
|
|
90
|
+
content: getTooltipText(),
|
|
91
|
+
direction: tooltipDirection
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_Benchmark.Controls, {
|
|
93
|
+
id: "ControlsBenchmark",
|
|
94
|
+
height: height,
|
|
95
|
+
width: width
|
|
96
|
+
}, /*#__PURE__*/_react.default.createElement(_Benchmark.BackgroundValueRectangle, {
|
|
97
|
+
id: "BackgroundValueRectangle",
|
|
98
|
+
height: height,
|
|
99
|
+
width: width,
|
|
100
|
+
color: backgroundColor
|
|
101
|
+
}), /*#__PURE__*/_react.default.createElement(_Benchmark.CurrentValueRectangle, {
|
|
102
|
+
id: "CurrentValueRectangle",
|
|
103
|
+
height: height,
|
|
104
|
+
width: getCurrentValueRectangleWidth(),
|
|
105
|
+
color: getUnderAvarageColor(),
|
|
106
|
+
lineargradientcolor: getUnderAvaragelinearGradientColor()
|
|
107
|
+
}), /*#__PURE__*/_react.default.createElement(_Benchmark.AvarageDelimiter, {
|
|
108
|
+
id: "AvarageDelimiter",
|
|
109
|
+
height: height + 4,
|
|
110
|
+
width: 0,
|
|
111
|
+
top: -2,
|
|
112
|
+
left: getBenchmarkLeft()
|
|
113
|
+
}))));
|
|
114
|
+
};
|
|
115
|
+
exports.Benchmark = Benchmark;
|
|
116
|
+
var _default = exports.default = Benchmark;
|
|
117
|
+
Benchmark.defaultProps = {
|
|
118
|
+
totalValue: 100,
|
|
119
|
+
currentValue: 60,
|
|
120
|
+
benchmarkValue: 500,
|
|
121
|
+
width: 100,
|
|
122
|
+
height: 12,
|
|
123
|
+
color: '#79DB95',
|
|
124
|
+
linearGradientColor: '#C3EFD0',
|
|
125
|
+
underAvarageColor: '#FD5959',
|
|
126
|
+
linearGradientUnderAvarageColor: '#FDB1B1',
|
|
127
|
+
backgroundColor: '#F2F2F2',
|
|
128
|
+
tooltipLabel: 'Benchmark',
|
|
129
|
+
tooltipDirection: 'bottom'
|
|
130
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CurrentValueRectangle = exports.ControlsContainer = exports.Controls = exports.BackgroundValueRectangle = exports.AvarageDelimiter = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
position: relative;
|
|
12
|
+
margin: 0px 0 0px;
|
|
13
|
+
font-family: "Poppins", sans-serif;
|
|
14
|
+
font-style: normal;
|
|
15
|
+
width: ${props => props.width.toString().concat('', 'px')};
|
|
16
|
+
height: ${props => props.height.toString().concat('', 'px')};
|
|
17
|
+
//box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
18
|
+
border-radius: 100px;
|
|
19
|
+
//border: 1px solid red;
|
|
20
|
+
align-items: center;
|
|
21
|
+
`;
|
|
22
|
+
const Controls = exports.Controls = _styledComponents.default.div`
|
|
23
|
+
position: relative;
|
|
24
|
+
border-radius: 100px;
|
|
25
|
+
width: ${props => props.width.toString().concat('', 'px')};
|
|
26
|
+
height: ${props => props.height.toString().concat('', 'px')};
|
|
27
|
+
//background: #ffffff;
|
|
28
|
+
//border: 1px solid blue;
|
|
29
|
+
`;
|
|
30
|
+
const BackgroundValueRectangle = exports.BackgroundValueRectangle = _styledComponents.default.div`
|
|
31
|
+
position: absolute;
|
|
32
|
+
width: ${props => props.width.toString().concat('', 'px')};
|
|
33
|
+
height: ${props => props.height.toString().concat('', 'px')};
|
|
34
|
+
top: 0px;
|
|
35
|
+
left: 0px;
|
|
36
|
+
border-radius: 100px;
|
|
37
|
+
background: ${props => props.color};
|
|
38
|
+
//border: 1px solid orange;
|
|
39
|
+
`;
|
|
40
|
+
const CurrentValueRectangle = exports.CurrentValueRectangle = _styledComponents.default.div`
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: ${props => props.width.toString().concat('', 'px')};
|
|
43
|
+
height: ${props => props.height.toString().concat('', 'px')};
|
|
44
|
+
top: 0px;
|
|
45
|
+
left: 0px;
|
|
46
|
+
border-radius: 100px;
|
|
47
|
+
background: linear-gradient(
|
|
48
|
+
90deg,
|
|
49
|
+
${props => props.lineargradientcolor} 0%,
|
|
50
|
+
${props => props.color} 100%
|
|
51
|
+
);
|
|
52
|
+
//border: 1px solid green;
|
|
53
|
+
`;
|
|
54
|
+
const AvarageDelimiter = exports.AvarageDelimiter = _styledComponents.default.div`
|
|
55
|
+
position: absolute;
|
|
56
|
+
height: ${props => props.height.toString().concat('', 'px')};
|
|
57
|
+
width: ${props => props.width.toString().concat('', 'px')};
|
|
58
|
+
top: ${props => props.top.toString().concat('', 'px')};
|
|
59
|
+
left: ${props => props.left.toString().concat('', 'px')};
|
|
60
|
+
border: 1px solid #212121;
|
|
61
|
+
`;
|