@razorpay/blade 12.111.0 → 12.119.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/spark/colorama-center-gradient-map-dark.jpg +0 -0
- package/assets/spark/colorama-gradient-map-dark.png +0 -0
- package/build/lib/native/components/Button/BaseButton/BaseButton.js +3 -3
- package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js +1 -1
- package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/native/components/Charts/AreaChart/AreaChart.native.js +2 -1
- package/build/lib/native/components/Charts/AreaChart/AreaChart.native.js.map +1 -1
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js +2 -2
- package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js.map +1 -1
- package/build/lib/native/components/Charts/CommonChartComponents/index.js +1 -1
- package/build/lib/native/components/Charts/CommonChartComponents/tokens.js +2 -2
- package/build/lib/native/components/Charts/CommonChartComponents/tokens.js.map +1 -1
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js +4 -2
- package/build/lib/native/components/Charts/LineChart/LineChart.native.js.map +1 -1
- package/build/lib/native/components/Charts/utils/nullBridgeUtils.js +4 -0
- package/build/lib/native/components/Charts/utils/nullBridgeUtils.js.map +1 -0
- package/build/lib/native/components/Charts/utils/referenceBandUtils.js +6 -0
- package/build/lib/native/components/Charts/utils/referenceBandUtils.js.map +1 -0
- package/build/lib/native/components/CounterInput/CounterInput.native.js +3 -2
- package/build/lib/native/components/CounterInput/CounterInput.native.js.map +1 -1
- package/build/lib/native/components/CounterInput/token.js +2 -2
- package/build/lib/native/components/CounterInput/token.js.map +1 -1
- package/build/lib/native/components/DatePicker/Calendar.native.js +2 -2
- package/build/lib/native/components/DatePicker/Calendar.native.js.map +1 -1
- package/build/lib/native/components/DatePicker/utils.js +2 -2
- package/build/lib/native/components/DatePicker/utils.js.map +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
- package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js +1 -1
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js.map +1 -1
- package/build/lib/native/components/Dropdown/dropdownUtils.js +1 -1
- package/build/lib/native/components/Dropdown/dropdownUtils.js.map +1 -1
- package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js +1 -1
- package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js.map +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
- package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/native/components/FloatingActionButton/FloatingActionButton.js +14 -0
- package/build/lib/native/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
- package/build/lib/native/components/FloatingActionButton/FloatingActionButtonContainer.native.js +20 -0
- package/build/lib/native/components/FloatingActionButton/FloatingActionButtonContainer.native.js.map +1 -0
- package/build/lib/native/components/FloatingActionButton/index.js +2 -0
- package/build/lib/native/components/FloatingActionButton/index.js.map +1 -0
- package/build/lib/native/components/GenUI/GenUIContext.native.js +2 -2
- package/build/lib/native/components/GenUI/GenUIContext.native.js.map +1 -1
- package/build/lib/native/components/GenUI/index.js +1 -1
- package/build/lib/native/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +14 -0
- package/build/lib/native/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
- package/build/lib/native/components/Icons/BookmarkFilledIcon/index.js +2 -0
- package/build/lib/native/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
- package/build/lib/native/components/Icons/index.js +1 -0
- package/build/lib/native/components/Icons/index.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
- package/build/lib/native/components/Input/OTPInput/OTPInput.js +1 -1
- package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/native/components/Spark/RzpGlass/utils.native.js +1 -1
- package/build/lib/native/components/Spark/RzpGlass/utils.native.js.map +1 -1
- package/build/lib/native/components/TreeView/TreeView.native.js +4 -0
- package/build/lib/native/components/TreeView/TreeView.native.js.map +1 -0
- package/build/lib/native/components/TreeView/index.native.js +2 -0
- package/build/lib/native/components/TreeView/index.native.js.map +1 -0
- package/build/lib/native/components/index.js +7 -2
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/tokens/global/colors.js +1 -1
- package/build/lib/native/tokens/global/colors.js.map +1 -1
- package/build/lib/native/tokens/index.js +1 -0
- package/build/lib/native/tokens/index.js.map +1 -1
- package/build/lib/native/tokens/theme/bladeNeutralTheme.js +15 -0
- package/build/lib/native/tokens/theme/bladeNeutralTheme.js.map +1 -0
- package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
- package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/native/tokens/theme/index.js +1 -0
- package/build/lib/native/tokens/theme/index.js.map +1 -1
- package/build/lib/native/tokens/theme/theme.js.map +1 -1
- package/build/lib/native/utils/componentZIndices.js +1 -1
- package/build/lib/native/utils/componentZIndices.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js +1 -1
- package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +124 -73
- package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +68 -2
- package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js +206 -18
- package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +159 -43
- package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
- package/build/lib/web/development/components/Charts/CommonChartComponents/index.js +1 -1
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +15 -2
- package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -1
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +272 -15
- package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -1
- package/build/lib/web/development/components/Charts/LineChart/useReferenceBand.js +195 -0
- package/build/lib/web/development/components/Charts/LineChart/useReferenceBand.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/nullBridgeUtils.js +175 -0
- package/build/lib/web/development/components/Charts/utils/nullBridgeUtils.js.map +1 -0
- package/build/lib/web/development/components/Charts/utils/referenceBandUtils.js +66 -0
- package/build/lib/web/development/components/Charts/utils/referenceBandUtils.js.map +1 -0
- package/build/lib/web/development/components/CounterInput/CounterInput.web.js +29 -5
- package/build/lib/web/development/components/CounterInput/CounterInput.web.js.map +1 -1
- package/build/lib/web/development/components/CounterInput/StyledCounterInput.js +20 -4
- package/build/lib/web/development/components/CounterInput/StyledCounterInput.js.map +1 -1
- package/build/lib/web/development/components/CounterInput/token.js +6 -1
- package/build/lib/web/development/components/CounterInput/token.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +20 -0
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/Calendar.web.js +9 -2
- package/build/lib/web/development/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/utils.js +21 -1
- package/build/lib/web/development/components/DatePicker/utils.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -1
- package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js +20 -12
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/dropdownUtils.js +28 -2
- package/build/lib/web/development/components/Dropdown/dropdownUtils.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js +15 -1
- package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/useDropdown.js +91 -5
- package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/development/components/FloatingActionButton/FloatingActionButton.js +126 -0
- package/build/lib/web/development/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
- package/build/lib/web/development/components/FloatingActionButton/FloatingActionButtonContainer.web.js +45 -0
- package/build/lib/web/development/components/FloatingActionButton/FloatingActionButtonContainer.web.js.map +1 -0
- package/build/lib/web/development/components/FloatingActionButton/index.js +2 -0
- package/build/lib/web/development/components/FloatingActionButton/index.js.map +1 -0
- package/build/lib/web/development/components/GenUI/GenUIComponents.web.js.map +1 -1
- package/build/lib/web/development/components/GenUI/GenUIContext.web.js +9 -1
- package/build/lib/web/development/components/GenUI/GenUIContext.web.js.map +1 -1
- package/build/lib/web/development/components/GenUI/GenUIProvider.web.js +17 -0
- package/build/lib/web/development/components/GenUI/GenUIProvider.web.js.map +1 -1
- package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js +31 -6
- package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
- package/build/lib/web/development/components/GenUI/index.js +1 -1
- package/build/lib/web/development/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +44 -0
- package/build/lib/web/development/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/BookmarkFilledIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +1 -0
- package/build/lib/web/development/components/Icons/index.js.map +1 -1
- package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +3 -0
- package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/web/development/components/PopupArrow/PopupArrow.web.js +7 -1
- package/build/lib/web/development/components/PopupArrow/PopupArrow.web.js.map +1 -1
- package/build/lib/web/development/components/RollingText/RollingText.web.js +27 -20
- package/build/lib/web/development/components/RollingText/RollingText.web.js.map +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/RzpGlass.js +16 -7
- package/build/lib/web/development/components/Spark/RzpGlass/RzpGlass.js.map +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/RzpGlassMount.js +24 -6
- package/build/lib/web/development/components/Spark/RzpGlass/RzpGlassMount.js.map +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/presets.js +30 -1
- package/build/lib/web/development/components/Spark/RzpGlass/presets.js.map +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/rzpGlassShader.js +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/rzpGlassShader.js.map +1 -1
- package/build/lib/web/development/components/Spark/RzpGlass/utils.js +26 -10
- package/build/lib/web/development/components/Spark/RzpGlass/utils.js.map +1 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/Tour.web.js +31 -18
- package/build/lib/web/development/components/SpotlightPopoverTour/Tour.web.js.map +1 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js +14 -3
- package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js +23 -4
- package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/utils.js +58 -1
- package/build/lib/web/development/components/SpotlightPopoverTour/utils.js.map +1 -1
- package/build/lib/web/development/components/TreeView/StyledTreeViewRow.web.js +41 -0
- package/build/lib/web/development/components/TreeView/StyledTreeViewRow.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/TreeView.web.js +696 -0
- package/build/lib/web/development/components/TreeView/TreeView.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/TreeViewAnimator.web.js +184 -0
- package/build/lib/web/development/components/TreeView/TreeViewAnimator.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/TreeViewChevron.web.js +73 -0
- package/build/lib/web/development/components/TreeView/TreeViewChevron.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/TreeViewItem.web.js +295 -0
- package/build/lib/web/development/components/TreeView/TreeViewItem.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/TreeViewLoadMore.web.js +173 -0
- package/build/lib/web/development/components/TreeView/TreeViewLoadMore.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/componentIds.js +8 -0
- package/build/lib/web/development/components/TreeView/componentIds.js.map +1 -0
- package/build/lib/web/development/components/TreeView/index.web.js +4 -0
- package/build/lib/web/development/components/TreeView/index.web.js.map +1 -0
- package/build/lib/web/development/components/TreeView/treeViewUtils.js +475 -0
- package/build/lib/web/development/components/TreeView/treeViewUtils.js.map +1 -0
- package/build/lib/web/development/components/TreeView/useTreeView.js +24 -0
- package/build/lib/web/development/components/TreeView/useTreeView.js.map +1 -0
- package/build/lib/web/development/components/index.js +9 -2
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/tokens/global/colors.js +2 -2
- package/build/lib/web/development/tokens/global/colors.js.map +1 -1
- package/build/lib/web/development/tokens/index.js +1 -0
- package/build/lib/web/development/tokens/index.js.map +1 -1
- package/build/lib/web/development/tokens/theme/bladeNeutralTheme.js +1439 -0
- package/build/lib/web/development/tokens/theme/bladeNeutralTheme.js.map +1 -0
- package/build/lib/web/development/tokens/theme/bladeTheme.js +48 -12
- package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/development/tokens/theme/index.js +1 -0
- package/build/lib/web/development/tokens/theme/index.js.map +1 -1
- package/build/lib/web/development/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/development/utils/componentZIndices.js +2 -0
- package/build/lib/web/development/utils/componentZIndices.js.map +1 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +4 -0
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js +12 -4
- package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
- package/build/lib/web/development/utils/useTruncationTitle/useTruncationTitle.web.js +2 -2
- package/build/lib/web/development/utils/useTruncationTitle/useTruncationTitle.web.js.map +1 -1
- package/build/lib/web/production/_virtual/flatten.js +1 -1
- package/build/lib/web/production/_virtual/flatten3.js +1 -1
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +124 -73
- package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +68 -2
- package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
- package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js +206 -18
- package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +159 -43
- package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
- package/build/lib/web/production/components/Charts/CommonChartComponents/index.js +1 -1
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +15 -2
- package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -1
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +272 -15
- package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -1
- package/build/lib/web/production/components/Charts/LineChart/useReferenceBand.js +195 -0
- package/build/lib/web/production/components/Charts/LineChart/useReferenceBand.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/nullBridgeUtils.js +175 -0
- package/build/lib/web/production/components/Charts/utils/nullBridgeUtils.js.map +1 -0
- package/build/lib/web/production/components/Charts/utils/referenceBandUtils.js +66 -0
- package/build/lib/web/production/components/Charts/utils/referenceBandUtils.js.map +1 -0
- package/build/lib/web/production/components/CounterInput/CounterInput.web.js +29 -5
- package/build/lib/web/production/components/CounterInput/CounterInput.web.js.map +1 -1
- package/build/lib/web/production/components/CounterInput/StyledCounterInput.js +20 -4
- package/build/lib/web/production/components/CounterInput/StyledCounterInput.js.map +1 -1
- package/build/lib/web/production/components/CounterInput/token.js +6 -1
- package/build/lib/web/production/components/CounterInput/token.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +20 -0
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/Calendar.web.js +9 -2
- package/build/lib/web/production/components/DatePicker/Calendar.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/utils.js +21 -1
- package/build/lib/web/production/components/DatePicker/utils.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
- package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js +20 -12
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/dropdownUtils.js +28 -2
- package/build/lib/web/production/components/Dropdown/dropdownUtils.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js +15 -1
- package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/useDropdown.js +91 -5
- package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
- package/build/lib/web/production/components/FloatingActionButton/FloatingActionButton.js +126 -0
- package/build/lib/web/production/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
- package/build/lib/web/production/components/FloatingActionButton/FloatingActionButtonContainer.web.js +45 -0
- package/build/lib/web/production/components/FloatingActionButton/FloatingActionButtonContainer.web.js.map +1 -0
- package/build/lib/web/production/components/FloatingActionButton/index.js +2 -0
- package/build/lib/web/production/components/FloatingActionButton/index.js.map +1 -0
- package/build/lib/web/production/components/GenUI/GenUIComponents.web.js.map +1 -1
- package/build/lib/web/production/components/GenUI/GenUIContext.web.js +9 -1
- package/build/lib/web/production/components/GenUI/GenUIContext.web.js.map +1 -1
- package/build/lib/web/production/components/GenUI/GenUIProvider.web.js +17 -0
- package/build/lib/web/production/components/GenUI/GenUIProvider.web.js.map +1 -1
- package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js +31 -6
- package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
- package/build/lib/web/production/components/GenUI/index.js +1 -1
- package/build/lib/web/production/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +44 -0
- package/build/lib/web/production/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/BookmarkFilledIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +1 -0
- package/build/lib/web/production/components/Icons/index.js.map +1 -1
- package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +3 -0
- package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
- package/build/lib/web/production/components/PopupArrow/PopupArrow.web.js +7 -1
- package/build/lib/web/production/components/PopupArrow/PopupArrow.web.js.map +1 -1
- package/build/lib/web/production/components/RollingText/RollingText.web.js +27 -20
- package/build/lib/web/production/components/RollingText/RollingText.web.js.map +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/RzpGlass.js +16 -7
- package/build/lib/web/production/components/Spark/RzpGlass/RzpGlass.js.map +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/RzpGlassMount.js +24 -6
- package/build/lib/web/production/components/Spark/RzpGlass/RzpGlassMount.js.map +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/presets.js +30 -1
- package/build/lib/web/production/components/Spark/RzpGlass/presets.js.map +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/rzpGlassShader.js +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/rzpGlassShader.js.map +1 -1
- package/build/lib/web/production/components/Spark/RzpGlass/utils.js +26 -10
- package/build/lib/web/production/components/Spark/RzpGlass/utils.js.map +1 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/Tour.web.js +31 -18
- package/build/lib/web/production/components/SpotlightPopoverTour/Tour.web.js.map +1 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js +14 -3
- package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js +23 -4
- package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/utils.js +58 -1
- package/build/lib/web/production/components/SpotlightPopoverTour/utils.js.map +1 -1
- package/build/lib/web/production/components/TreeView/StyledTreeViewRow.web.js +41 -0
- package/build/lib/web/production/components/TreeView/StyledTreeViewRow.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/TreeView.web.js +696 -0
- package/build/lib/web/production/components/TreeView/TreeView.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/TreeViewAnimator.web.js +184 -0
- package/build/lib/web/production/components/TreeView/TreeViewAnimator.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/TreeViewChevron.web.js +73 -0
- package/build/lib/web/production/components/TreeView/TreeViewChevron.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/TreeViewItem.web.js +295 -0
- package/build/lib/web/production/components/TreeView/TreeViewItem.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/TreeViewLoadMore.web.js +173 -0
- package/build/lib/web/production/components/TreeView/TreeViewLoadMore.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/componentIds.js +8 -0
- package/build/lib/web/production/components/TreeView/componentIds.js.map +1 -0
- package/build/lib/web/production/components/TreeView/index.web.js +4 -0
- package/build/lib/web/production/components/TreeView/index.web.js.map +1 -0
- package/build/lib/web/production/components/TreeView/treeViewUtils.js +475 -0
- package/build/lib/web/production/components/TreeView/treeViewUtils.js.map +1 -0
- package/build/lib/web/production/components/TreeView/useTreeView.js +24 -0
- package/build/lib/web/production/components/TreeView/useTreeView.js.map +1 -0
- package/build/lib/web/production/components/index.js +9 -2
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/node_modules/es-toolkit/dist/array/flatten.js +1 -1
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/array/flatten.js +1 -1
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/array/sortBy.js +2 -2
- package/build/lib/web/production/node_modules/es-toolkit/dist/compat/object/omit.js +2 -2
- package/build/lib/web/production/tokens/global/colors.js +2 -2
- package/build/lib/web/production/tokens/global/colors.js.map +1 -1
- package/build/lib/web/production/tokens/index.js +1 -0
- package/build/lib/web/production/tokens/index.js.map +1 -1
- package/build/lib/web/production/tokens/theme/bladeNeutralTheme.js +1439 -0
- package/build/lib/web/production/tokens/theme/bladeNeutralTheme.js.map +1 -0
- package/build/lib/web/production/tokens/theme/bladeTheme.js +48 -12
- package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
- package/build/lib/web/production/tokens/theme/index.js +1 -0
- package/build/lib/web/production/tokens/theme/index.js.map +1 -1
- package/build/lib/web/production/tokens/theme/theme.js.map +1 -1
- package/build/lib/web/production/utils/componentZIndices.js +2 -0
- package/build/lib/web/production/utils/componentZIndices.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +4 -0
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js +12 -4
- package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
- package/build/lib/web/production/utils/useTruncationTitle/useTruncationTitle.web.js +2 -2
- package/build/lib/web/production/utils/useTruncationTitle/useTruncationTitle.web.js.map +1 -1
- package/build/types/components/index.d.ts +557 -18
- package/build/types/components/index.native.d.ts +463 -16
- package/build/types/tokens/index.d.ts +11 -4
- package/build/types/tokens/index.native.d.ts +11 -4
- package/build/types/utils/index.d.ts +8 -3
- package/build/types/utils/index.native.d.ts +8 -3
- package/package.json +2 -2
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import React__default, { useMemo, isValidElement, useState, useLayoutEffect } from 'react';
|
|
3
|
+
import getIn from '../../../utils/lodashButBetter/get.js';
|
|
4
|
+
import '../../BladeProvider/index.js';
|
|
5
|
+
import '../../../utils/isValidAllowedChildren/index.js';
|
|
6
|
+
import { componentId, REFERENCE_BAND_DEFAULT_COLOR, REFERENCE_BAND_LOWER_CLASS, REFERENCE_BAND_UPPER_CLASS, REFERENCE_BAND_LAYER_CLASS, REFERENCE_BAND_FILL_OPACITY } from '../CommonChartComponents/tokens.js';
|
|
7
|
+
import { parsePathAnchors } from '../utils/nullBridgeUtils.js';
|
|
8
|
+
import { perLineBandClass, buildBandAreaPath } from '../utils/referenceBandUtils.js';
|
|
9
|
+
import { componentIds } from './componentIds.js';
|
|
10
|
+
import { jsx } from 'react/jsx-runtime';
|
|
11
|
+
import useTheme from '../../BladeProvider/useTheme.js';
|
|
12
|
+
import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
|
|
13
|
+
|
|
14
|
+
var geomsEqual = function geomsEqual(a, b) {
|
|
15
|
+
return a.length === b.length && a.every(function (item, index) {
|
|
16
|
+
var other = b[index];
|
|
17
|
+
return item.id === other.id && item.d === other.d && item.fillColor === other.fillColor;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Manages the web-only reference-band rendering pipeline for `ChartLineWrapper`. Collects every band
|
|
23
|
+
* source — the standalone `<ChartReferenceBand>` plus each `<ChartLine>` that declares a range — and,
|
|
24
|
+
* after Recharts lays out the invisible bound lines, reads their pixel anchors from the rendered SVG
|
|
25
|
+
* and fills the area between each pair (via `buildBandAreaPath`), recomputing on DOM/resize changes.
|
|
26
|
+
* Per-line bands are color-matched to their line via `dataColorMapping`. This mirrors the null-bridge
|
|
27
|
+
* approach because Recharts v3 doesn't expose axis scales to `<Customized>`.
|
|
28
|
+
*/
|
|
29
|
+
var useReferenceBand = function useReferenceBand(children, data, containerRef, dataColorMapping) {
|
|
30
|
+
var _useTheme = useTheme(),
|
|
31
|
+
theme = _useTheme.theme;
|
|
32
|
+
var bandSources = useMemo(function () {
|
|
33
|
+
var sources = [];
|
|
34
|
+
React__default.Children.forEach(children, function (child) {
|
|
35
|
+
if (! /*#__PURE__*/isValidElement(child)) return;
|
|
36
|
+
var id = getComponentId(child);
|
|
37
|
+
|
|
38
|
+
// Standalone <ChartReferenceBand> (single band not tied to a specific line).
|
|
39
|
+
if (id === componentId.chartReferenceBand) {
|
|
40
|
+
var _props$color, _props$name, _props$showLegend;
|
|
41
|
+
var props = child.props;
|
|
42
|
+
var colorToken = (_props$color = props.color) !== null && _props$color !== void 0 ? _props$color : REFERENCE_BAND_DEFAULT_COLOR;
|
|
43
|
+
sources.push({
|
|
44
|
+
id: 'standalone',
|
|
45
|
+
lowerClass: REFERENCE_BAND_LOWER_CLASS,
|
|
46
|
+
upperClass: REFERENCE_BAND_UPPER_CLASS,
|
|
47
|
+
name: (_props$name = props.name) !== null && _props$name !== void 0 ? _props$name : 'Reference band',
|
|
48
|
+
colorToken: colorToken,
|
|
49
|
+
fillColor: getIn(theme.colors, colorToken),
|
|
50
|
+
showLegend: (_props$showLegend = props.showLegend) !== null && _props$showLegend !== void 0 ? _props$showLegend : true
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Per-line band: a <ChartLine> that declares both range bounds.
|
|
56
|
+
if (id === componentIds.ChartLine) {
|
|
57
|
+
var _ref, _props$rangeColor, _dataColorMapping$dat, _props$rangeName, _ref2, _props$showRangeLegen;
|
|
58
|
+
var _props = child.props;
|
|
59
|
+
var dataKey = _props.dataKey;
|
|
60
|
+
if (!dataKey || !_props.rangeLowerDataKey || !_props.rangeUpperDataKey) return;
|
|
61
|
+
// Color-match to the line: explicit rangeColor wins, else the line's resolved color.
|
|
62
|
+
var _colorToken = (_ref = (_props$rangeColor = _props.rangeColor) !== null && _props$rangeColor !== void 0 ? _props$rangeColor : (_dataColorMapping$dat = dataColorMapping[dataKey]) === null || _dataColorMapping$dat === void 0 ? void 0 : _dataColorMapping$dat.colorToken) !== null && _ref !== void 0 ? _ref : REFERENCE_BAND_DEFAULT_COLOR;
|
|
63
|
+
sources.push({
|
|
64
|
+
id: dataKey,
|
|
65
|
+
lowerClass: perLineBandClass(dataKey, 'lower'),
|
|
66
|
+
upperClass: perLineBandClass(dataKey, 'upper'),
|
|
67
|
+
name: (_props$rangeName = _props.rangeName) !== null && _props$rangeName !== void 0 ? _props$rangeName : 'Industry range',
|
|
68
|
+
colorToken: _colorToken,
|
|
69
|
+
fillColor: getIn(theme.colors, _colorToken),
|
|
70
|
+
showLegend: (_ref2 = (_props$showRangeLegen = _props.showRangeLegend) !== null && _props$showRangeLegen !== void 0 ? _props$showRangeLegen : _props.showLegend) !== null && _ref2 !== void 0 ? _ref2 : true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return sources;
|
|
75
|
+
}, [children, theme, dataColorMapping]);
|
|
76
|
+
var hasReferenceBand = bandSources.length > 0;
|
|
77
|
+
var _useState = useState([]),
|
|
78
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
79
|
+
bandGeoms = _useState2[0],
|
|
80
|
+
setBandGeoms = _useState2[1];
|
|
81
|
+
|
|
82
|
+
// Stable key of the sources' identity so the effect re-runs when bands are added/removed/recolored.
|
|
83
|
+
var sourceSignature = useMemo(function () {
|
|
84
|
+
return bandSources.map(function (s) {
|
|
85
|
+
return "".concat(s.id, ":").concat(s.fillColor);
|
|
86
|
+
}).join('|');
|
|
87
|
+
}, [bandSources]);
|
|
88
|
+
useLayoutEffect(function () {
|
|
89
|
+
var container = containerRef.current;
|
|
90
|
+
if (!container || !hasReferenceBand) {
|
|
91
|
+
setBandGeoms(function (prev) {
|
|
92
|
+
return prev.length === 0 ? prev : [];
|
|
93
|
+
});
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
var computeBands = function computeBands() {
|
|
97
|
+
var surface = container.querySelector('svg.recharts-surface');
|
|
98
|
+
if (!surface) return;
|
|
99
|
+
var next = [];
|
|
100
|
+
bandSources.forEach(function (source) {
|
|
101
|
+
var _upperCurve$getAttrib, _lowerCurve$getAttrib;
|
|
102
|
+
var upperCurve = surface.querySelector(".".concat(source.upperClass, " .recharts-line-curve"));
|
|
103
|
+
var lowerCurve = surface.querySelector(".".concat(source.lowerClass, " .recharts-line-curve"));
|
|
104
|
+
if (!upperCurve || !lowerCurve) return;
|
|
105
|
+
var upperAnchors = parsePathAnchors((_upperCurve$getAttrib = upperCurve.getAttribute('d')) !== null && _upperCurve$getAttrib !== void 0 ? _upperCurve$getAttrib : '');
|
|
106
|
+
var lowerAnchors = parsePathAnchors((_lowerCurve$getAttrib = lowerCurve.getAttribute('d')) !== null && _lowerCurve$getAttrib !== void 0 ? _lowerCurve$getAttrib : '');
|
|
107
|
+
var d = buildBandAreaPath(upperAnchors, lowerAnchors);
|
|
108
|
+
if (!d) return;
|
|
109
|
+
next.push({
|
|
110
|
+
id: source.id,
|
|
111
|
+
d: d,
|
|
112
|
+
fillColor: source.fillColor
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
setBandGeoms(function (prev) {
|
|
116
|
+
return geomsEqual(prev, next) ? prev : next;
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
computeBands();
|
|
120
|
+
var cleanups = [];
|
|
121
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
122
|
+
var rafId = null;
|
|
123
|
+
var mutationObserver = new MutationObserver(function (mutations) {
|
|
124
|
+
// Ignore mutations from our own band layer to avoid a re-entrant loop.
|
|
125
|
+
var isBandMutation = mutations.some(function (m) {
|
|
126
|
+
return m.target instanceof Element && m.target.closest(".".concat(REFERENCE_BAND_LAYER_CLASS));
|
|
127
|
+
});
|
|
128
|
+
if (isBandMutation) return;
|
|
129
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
130
|
+
rafId = requestAnimationFrame(function () {
|
|
131
|
+
rafId = null;
|
|
132
|
+
computeBands();
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
mutationObserver.observe(container, {
|
|
136
|
+
childList: true,
|
|
137
|
+
subtree: true,
|
|
138
|
+
attributes: true,
|
|
139
|
+
attributeFilter: ['d']
|
|
140
|
+
});
|
|
141
|
+
cleanups.push(function () {
|
|
142
|
+
mutationObserver.disconnect();
|
|
143
|
+
if (rafId !== null) cancelAnimationFrame(rafId);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
147
|
+
var resizeObserver = new ResizeObserver(function () {
|
|
148
|
+
return computeBands();
|
|
149
|
+
});
|
|
150
|
+
resizeObserver.observe(container);
|
|
151
|
+
cleanups.push(function () {
|
|
152
|
+
return resizeObserver.disconnect();
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return function () {
|
|
156
|
+
return cleanups.forEach(function (cleanup) {
|
|
157
|
+
return cleanup();
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
+
}, [data, hasReferenceBand, sourceSignature]);
|
|
162
|
+
var renderReferenceBands = function renderReferenceBands() {
|
|
163
|
+
if (!hasReferenceBand || bandGeoms.length === 0) return null;
|
|
164
|
+
return /*#__PURE__*/jsx("g", {
|
|
165
|
+
className: REFERENCE_BAND_LAYER_CLASS,
|
|
166
|
+
children: bandGeoms.map(function (band) {
|
|
167
|
+
return /*#__PURE__*/jsx("path", {
|
|
168
|
+
d: band.d,
|
|
169
|
+
fill: band.fillColor,
|
|
170
|
+
fillOpacity: REFERENCE_BAND_FILL_OPACITY,
|
|
171
|
+
stroke: "none"
|
|
172
|
+
}, "reference-band-".concat(band.id));
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
var referenceBandLegendInfos = useMemo(function () {
|
|
177
|
+
return bandSources.filter(function (source) {
|
|
178
|
+
return source.showLegend;
|
|
179
|
+
}).map(function (source) {
|
|
180
|
+
return {
|
|
181
|
+
name: source.name,
|
|
182
|
+
color: source.colorToken,
|
|
183
|
+
fillOpacity: REFERENCE_BAND_FILL_OPACITY
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}, [bandSources]);
|
|
187
|
+
return {
|
|
188
|
+
hasReferenceBand: hasReferenceBand,
|
|
189
|
+
renderReferenceBands: renderReferenceBands,
|
|
190
|
+
referenceBandLegendInfos: referenceBandLegendInfos
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export { useReferenceBand };
|
|
195
|
+
//# sourceMappingURL=useReferenceBand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReferenceBand.js","sources":["../../../../../../../src/components/Charts/LineChart/useReferenceBand.tsx"],"sourcesContent":["import React, { useState, useMemo, useLayoutEffect, isValidElement } from 'react';\nimport getIn from '~utils/lodashButBetter/get';\nimport { useTheme } from '~components/BladeProvider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport type {\n ChartReferenceBandProps,\n ReferenceBandLegendInfo,\n DataColorMapping,\n} from '../CommonChartComponents/types';\nimport {\n componentId as commonComponentIds,\n REFERENCE_BAND_DEFAULT_COLOR,\n REFERENCE_BAND_FILL_OPACITY,\n REFERENCE_BAND_LOWER_CLASS,\n REFERENCE_BAND_UPPER_CLASS,\n REFERENCE_BAND_LAYER_CLASS,\n} from '../CommonChartComponents/tokens';\nimport { parsePathAnchors } from '../utils/nullBridgeUtils';\nimport { buildBandAreaPath, perLineBandClass } from '../utils/referenceBandUtils';\nimport { componentIds } from './componentIds';\nimport type { ChartLineProps } from './types';\n\ntype ChartData = { [key: string]: unknown };\n\n/**\n * A single band to be drawn — either the standalone `<ChartReferenceBand>` or one derived from a\n * `<ChartLine>` that declares `rangeLowerDataKey` / `rangeUpperDataKey`. `lowerClass` / `upperClass`\n * are the classNames of the invisible bound lines whose rendered geometry we read.\n */\ntype BandSource = {\n id: string;\n lowerClass: string;\n upperClass: string;\n name: string;\n colorToken: ReferenceBandLegendInfo['color'];\n fillColor: string;\n showLegend: boolean;\n};\n\ntype BandGeometry = {\n id: string;\n d: string;\n fillColor: string;\n};\n\ntype UseReferenceBandResult = {\n hasReferenceBand: boolean;\n renderReferenceBands: () => React.ReactElement | null;\n referenceBandLegendInfos: ReferenceBandLegendInfo[];\n};\n\nconst geomsEqual = (a: BandGeometry[], b: BandGeometry[]): boolean =>\n a.length === b.length &&\n a.every((item, index) => {\n const other = b[index];\n return item.id === other.id && item.d === other.d && item.fillColor === other.fillColor;\n });\n\n/**\n * Manages the web-only reference-band rendering pipeline for `ChartLineWrapper`. Collects every band\n * source — the standalone `<ChartReferenceBand>` plus each `<ChartLine>` that declares a range — and,\n * after Recharts lays out the invisible bound lines, reads their pixel anchors from the rendered SVG\n * and fills the area between each pair (via `buildBandAreaPath`), recomputing on DOM/resize changes.\n * Per-line bands are color-matched to their line via `dataColorMapping`. This mirrors the null-bridge\n * approach because Recharts v3 doesn't expose axis scales to `<Customized>`.\n */\nconst useReferenceBand = (\n children: React.ReactNode,\n data: ChartData[],\n containerRef: React.RefObject<HTMLDivElement | null>,\n dataColorMapping: DataColorMapping,\n): UseReferenceBandResult => {\n const { theme } = useTheme();\n\n const bandSources = useMemo<BandSource[]>(() => {\n const sources: BandSource[] = [];\n\n React.Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n const id = getComponentId(child);\n\n // Standalone <ChartReferenceBand> (single band not tied to a specific line).\n if (id === commonComponentIds.chartReferenceBand) {\n const props = child.props as ChartReferenceBandProps;\n const colorToken =\n props.color ?? (REFERENCE_BAND_DEFAULT_COLOR as ReferenceBandLegendInfo['color']);\n sources.push({\n id: 'standalone',\n lowerClass: REFERENCE_BAND_LOWER_CLASS,\n upperClass: REFERENCE_BAND_UPPER_CLASS,\n name: props.name ?? 'Reference band',\n colorToken,\n fillColor: getIn(theme.colors, colorToken),\n showLegend: props.showLegend ?? true,\n });\n return;\n }\n\n // Per-line band: a <ChartLine> that declares both range bounds.\n if (id === componentIds.ChartLine) {\n const props = child.props as ChartLineProps;\n const dataKey = props.dataKey as string;\n if (!dataKey || !props.rangeLowerDataKey || !props.rangeUpperDataKey) return;\n // Color-match to the line: explicit rangeColor wins, else the line's resolved color.\n const colorToken =\n props.rangeColor ??\n dataColorMapping[dataKey]?.colorToken ??\n (REFERENCE_BAND_DEFAULT_COLOR as ReferenceBandLegendInfo['color']);\n sources.push({\n id: dataKey,\n lowerClass: perLineBandClass(dataKey, 'lower'),\n upperClass: perLineBandClass(dataKey, 'upper'),\n name: props.rangeName ?? 'Industry range',\n colorToken,\n fillColor: getIn(theme.colors, colorToken),\n showLegend: props.showRangeLegend ?? props.showLegend ?? true,\n });\n }\n });\n\n return sources;\n }, [children, theme, dataColorMapping]);\n\n const hasReferenceBand = bandSources.length > 0;\n\n const [bandGeoms, setBandGeoms] = useState<BandGeometry[]>([]);\n\n // Stable key of the sources' identity so the effect re-runs when bands are added/removed/recolored.\n const sourceSignature = useMemo(\n () => bandSources.map((s) => `${s.id}:${s.fillColor}`).join('|'),\n [bandSources],\n );\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n if (!container || !hasReferenceBand) {\n setBandGeoms((prev) => (prev.length === 0 ? prev : []));\n return undefined;\n }\n\n const computeBands = (): void => {\n const surface = container.querySelector('svg.recharts-surface');\n if (!surface) return;\n const next: BandGeometry[] = [];\n bandSources.forEach((source) => {\n const upperCurve = surface.querySelector<SVGPathElement>(\n `.${source.upperClass} .recharts-line-curve`,\n );\n const lowerCurve = surface.querySelector<SVGPathElement>(\n `.${source.lowerClass} .recharts-line-curve`,\n );\n if (!upperCurve || !lowerCurve) return;\n const upperAnchors = parsePathAnchors(upperCurve.getAttribute('d') ?? '');\n const lowerAnchors = parsePathAnchors(lowerCurve.getAttribute('d') ?? '');\n const d = buildBandAreaPath(upperAnchors, lowerAnchors);\n if (!d) return;\n next.push({\n id: source.id,\n d,\n fillColor: source.fillColor,\n });\n });\n setBandGeoms((prev) => (geomsEqual(prev, next) ? prev : next));\n };\n\n computeBands();\n\n const cleanups: Array<() => void> = [];\n if (typeof MutationObserver !== 'undefined') {\n let rafId: number | null = null;\n const mutationObserver = new MutationObserver((mutations) => {\n // Ignore mutations from our own band layer to avoid a re-entrant loop.\n const isBandMutation = mutations.some(\n (m) => m.target instanceof Element && m.target.closest(`.${REFERENCE_BAND_LAYER_CLASS}`),\n );\n if (isBandMutation) return;\n if (rafId !== null) cancelAnimationFrame(rafId);\n rafId = requestAnimationFrame(() => {\n rafId = null;\n computeBands();\n });\n });\n mutationObserver.observe(container, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['d'],\n });\n cleanups.push(() => {\n mutationObserver.disconnect();\n if (rafId !== null) cancelAnimationFrame(rafId);\n });\n }\n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(() => computeBands());\n resizeObserver.observe(container);\n cleanups.push(() => resizeObserver.disconnect());\n }\n return () => cleanups.forEach((cleanup) => cleanup());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [data, hasReferenceBand, sourceSignature]);\n\n const renderReferenceBands = (): React.ReactElement | null => {\n if (!hasReferenceBand || bandGeoms.length === 0) return null;\n return (\n <g className={REFERENCE_BAND_LAYER_CLASS}>\n {bandGeoms.map((band) => (\n <path\n key={`reference-band-${band.id}`}\n d={band.d}\n fill={band.fillColor}\n fillOpacity={REFERENCE_BAND_FILL_OPACITY}\n stroke=\"none\"\n />\n ))}\n </g>\n );\n };\n\n const referenceBandLegendInfos = useMemo<ReferenceBandLegendInfo[]>(\n () =>\n bandSources\n .filter((source) => source.showLegend)\n .map((source) => ({\n name: source.name,\n color: source.colorToken,\n fillOpacity: REFERENCE_BAND_FILL_OPACITY,\n })),\n [bandSources],\n );\n\n return { hasReferenceBand, renderReferenceBands, referenceBandLegendInfos };\n};\n\nexport { useReferenceBand };\nexport type { UseReferenceBandResult, BandSource, BandGeometry };\n"],"names":["geomsEqual","a","b","length","every","item","index","other","id","d","fillColor","useReferenceBand","children","data","containerRef","dataColorMapping","_useTheme","useTheme","theme","bandSources","useMemo","sources","React","Children","forEach","child","isValidElement","getComponentId","commonComponentIds","chartReferenceBand","_props$color","_props$name","_props$showLegend","props","colorToken","color","REFERENCE_BAND_DEFAULT_COLOR","push","lowerClass","REFERENCE_BAND_LOWER_CLASS","upperClass","REFERENCE_BAND_UPPER_CLASS","name","getIn","colors","showLegend","componentIds","ChartLine","_ref","_props$rangeColor","_dataColorMapping$dat","_props$rangeName","_ref2","_props$showRangeLegen","dataKey","rangeLowerDataKey","rangeUpperDataKey","rangeColor","perLineBandClass","rangeName","showRangeLegend","hasReferenceBand","_useState","useState","_useState2","_slicedToArray","bandGeoms","setBandGeoms","sourceSignature","map","s","concat","join","useLayoutEffect","container","current","prev","undefined","computeBands","surface","querySelector","next","source","_upperCurve$getAttrib","_lowerCurve$getAttrib","upperCurve","lowerCurve","upperAnchors","parsePathAnchors","getAttribute","lowerAnchors","buildBandAreaPath","cleanups","MutationObserver","rafId","mutationObserver","mutations","isBandMutation","some","m","target","Element","closest","REFERENCE_BAND_LAYER_CLASS","cancelAnimationFrame","requestAnimationFrame","observe","childList","subtree","attributes","attributeFilter","disconnect","ResizeObserver","resizeObserver","cleanup","renderReferenceBands","_jsx","className","band","fill","fillOpacity","REFERENCE_BAND_FILL_OPACITY","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,CAACxC,IAAI;QACjBP,KAAK,EAAE+C,MAAM,CAAChD,UAAU;AACxBsF,QAAAA,WAAW,EAAEC,2BAAAA;OACd,CAAA;AAAA,KAAC,CAAC,CAAA;GACP,EAAA,CAACtG,WAAW,CACd,CAAC,CAAA;EAED,OAAO;AAAE0C,IAAAA,gBAAgB,EAAhBA,gBAAgB;AAAEsD,IAAAA,oBAAoB,EAApBA,oBAAoB;AAAEQ,IAAAA,wBAAwB,EAAxBA,wBAAAA;GAA0B,CAAA;AAC7E;;;;"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import _typeof from '@babel/runtime/helpers/typeof';
|
|
2
|
+
|
|
3
|
+
// A dataKey can be a string (possibly dot-nested, e.g. `metrics.sales`), a number,
|
|
4
|
+
// or a function — but the bridge utilities only handle the string/number form, which
|
|
5
|
+
// is what Recharts' path rendering uses. Keeping this local avoids coupling the shared
|
|
6
|
+
// utility to any specific chart component's types.
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Monotone cubic interpolation using a weighted-harmonic tangent formula
|
|
10
|
+
* (`3(dx₁+dx₂) / ((dx₁+2dx₂)/m₁ + (2dx₁+dx₂)/m₂)`). Given the defined points
|
|
11
|
+
* `(xs[i], ys[i])` (xs ascending), it returns the interpolated `y` at `xq`. Used to densely
|
|
12
|
+
* sample the null-bridge onto the real curve so the dashed bridge follows a monotone curve
|
|
13
|
+
* across the gap instead of a straight chord.
|
|
14
|
+
*
|
|
15
|
+
* **Note on curve parity:** this shares its formula with `buildMonotonePath` (native
|
|
16
|
+
* LineChart), so on native LineChart the bridge follows the same curve as the solid line.
|
|
17
|
+
* It is *not* pixel-identical to d3-shape's `curveMonotoneX` (Steffen `slope3`, which Recharts
|
|
18
|
+
* uses on web) nor to `buildMonotone` (native AreaChart, arithmetic-mean + Fritsch–Carlson
|
|
19
|
+
* clip). The bridge endpoints always coincide with the solid anchors, so junctions are
|
|
20
|
+
* continuous; only the interior curvature of the dashed span can differ slightly on web and
|
|
21
|
+
* native AreaChart. Unifying all renderers on d3 `curveMonotoneX` is tracked as a follow-up.
|
|
22
|
+
*/
|
|
23
|
+
var monotoneInterpolate = function monotoneInterpolate(xs, ys, xq) {
|
|
24
|
+
var n = xs.length;
|
|
25
|
+
if (n === 0) return 0;
|
|
26
|
+
if (n === 1) return ys[0];
|
|
27
|
+
var slope = [];
|
|
28
|
+
for (var i = 0; i < n - 1; i++) {
|
|
29
|
+
var dx = xs[i + 1] - xs[i];
|
|
30
|
+
slope[i] = dx === 0 ? 0 : (ys[i + 1] - ys[i]) / dx;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Tangents at each point — weighted-harmonic formula, matching buildMonotonePath (native
|
|
34
|
+
// LineChart) so the dashed bridge follows the same curve as the solid line on that renderer.
|
|
35
|
+
// (Close to, but not pixel-identical to, d3's curveMonotoneX / Recharts on web.)
|
|
36
|
+
var tangent = new Array(n);
|
|
37
|
+
tangent[0] = slope[0];
|
|
38
|
+
tangent[n - 1] = slope[n - 2];
|
|
39
|
+
for (var _i = 1; _i < n - 1; _i++) {
|
|
40
|
+
var m1 = slope[_i - 1];
|
|
41
|
+
var m2 = slope[_i];
|
|
42
|
+
if (m1 * m2 <= 0) {
|
|
43
|
+
tangent[_i] = 0;
|
|
44
|
+
} else {
|
|
45
|
+
var dx1 = xs[_i] - xs[_i - 1];
|
|
46
|
+
var dx2 = xs[_i + 1] - xs[_i];
|
|
47
|
+
var common = dx1 + dx2;
|
|
48
|
+
tangent[_i] = 3 * common / ((common + dx2) / m1 + (common + dx1) / m2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Locate the interval containing xq and evaluate the Hermite basis.
|
|
53
|
+
var k = 0;
|
|
54
|
+
while (k < n - 2 && xq > xs[k + 1]) k++;
|
|
55
|
+
var h = xs[k + 1] - xs[k];
|
|
56
|
+
var t = h === 0 ? 0 : (xq - xs[k]) / h;
|
|
57
|
+
var t2 = t * t;
|
|
58
|
+
var t3 = t2 * t;
|
|
59
|
+
var h00 = 2 * t3 - 3 * t2 + 1;
|
|
60
|
+
var h10 = t3 - 2 * t2 + t;
|
|
61
|
+
var h01 = -2 * t3 + 3 * t2;
|
|
62
|
+
var h11 = t3 - t2;
|
|
63
|
+
return h00 * ys[k] + h10 * h * tangent[k] + h01 * ys[k + 1] + h11 * h * tangent[k + 1];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Resolve a (possibly nested, e.g. `metrics.sales`) dataKey from a data row.
|
|
67
|
+
var resolveDataKeyValue = function resolveDataKeyValue(row, dataKey) {
|
|
68
|
+
var path = String(dataKey);
|
|
69
|
+
if (!path) return undefined;
|
|
70
|
+
return path.split('.').reduce(function (accumulator, key) {
|
|
71
|
+
if (accumulator && _typeof(accumulator) === 'object') {
|
|
72
|
+
return accumulator[key];
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}, row);
|
|
76
|
+
};
|
|
77
|
+
// Extract the indices + numeric values of the non-null points for a dataKey.
|
|
78
|
+
var getDefinedNumericPoints = function getDefinedNumericPoints(data, dataKey) {
|
|
79
|
+
var indices = [];
|
|
80
|
+
var values = [];
|
|
81
|
+
data.forEach(function (row, index) {
|
|
82
|
+
var raw = resolveDataKeyValue(row, dataKey);
|
|
83
|
+
var numeric = raw === null || raw === undefined ? null : Number(raw);
|
|
84
|
+
if (numeric !== null && !Number.isNaN(numeric)) {
|
|
85
|
+
indices.push(index);
|
|
86
|
+
values.push(numeric);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
indices: indices,
|
|
91
|
+
values: values
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Positions (into the defined-points array) of adjacent defined points that have at least one null
|
|
96
|
+
// point between them, i.e. an interior gap that a null-bridge should span.
|
|
97
|
+
var getInteriorGaps = function getInteriorGaps(indices) {
|
|
98
|
+
var gaps = [];
|
|
99
|
+
for (var i = 0; i < indices.length - 1; i++) {
|
|
100
|
+
if (indices[i + 1] - indices[i] > 1) {
|
|
101
|
+
gaps.push({
|
|
102
|
+
from: i,
|
|
103
|
+
to: i + 1
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return gaps;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Build a dashed null-bridge `d` path (dense polyline) across a single interior gap, sampling the
|
|
112
|
+
* monotone spline through the line's defined anchor points (in pixel space) so the bridge follows
|
|
113
|
+
* the same curve Recharts draws for a solid connect instead of a straight chord.
|
|
114
|
+
*/
|
|
115
|
+
var buildBridgePathData = function buildBridgePathData(anchors, from, to) {
|
|
116
|
+
var xs = anchors.map(function (point) {
|
|
117
|
+
return point.x;
|
|
118
|
+
});
|
|
119
|
+
var ys = anchors.map(function (point) {
|
|
120
|
+
return point.y;
|
|
121
|
+
});
|
|
122
|
+
var start = anchors[from];
|
|
123
|
+
var end = anchors[to];
|
|
124
|
+
var sampleCount = Math.max(2, Math.round(Math.abs(end.x - start.x) / 3));
|
|
125
|
+
var pathData = '';
|
|
126
|
+
for (var step = 0; step <= sampleCount; step++) {
|
|
127
|
+
var t = step / sampleCount;
|
|
128
|
+
var x = start.x + (end.x - start.x) * t;
|
|
129
|
+
var y = monotoneInterpolate(xs, ys, x);
|
|
130
|
+
pathData += "".concat(step === 0 ? 'M' : 'L').concat(x, ",").concat(y, " ");
|
|
131
|
+
}
|
|
132
|
+
return pathData.trim();
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Parse the anchor (data) points out of an SVG path `d` string as rendered by Recharts for a line.
|
|
136
|
+
* Handles `M`/`L` (linear) and `C` (monotone/natural cubic) commands — for a cubic the anchor is the
|
|
137
|
+
* final control pair. Restart commands (`M`, from a gapped/`connectNulls={false}` line) contribute
|
|
138
|
+
* their point too, so the result is the ordered list of the line's *defined* data points in pixel
|
|
139
|
+
* space. Used to derive the null-bridge geometry from Recharts' own computed coordinates.
|
|
140
|
+
*
|
|
141
|
+
* **Limitation:** This parser only handles `M`, `L`, and `C` SVG commands. For step-type curves
|
|
142
|
+
* (`type="step"`, `"stepBefore"`, `"stepAfter"`), d3-shape generates extra `L` commands for
|
|
143
|
+
* intermediate step points (e.g. `curveStepAfter` produces 2n-1 `L`/`M` commands for n defined
|
|
144
|
+
* data points). The anchor count will not match the defined data point count, so the
|
|
145
|
+
* `anchors.length !== indices.length` guard in the calling code will bail out and the dashed
|
|
146
|
+
* bridge will not render. `connectNullsStyle="dashed"` is therefore only supported for
|
|
147
|
+
* `type="monotone"` and `type="linear"`. For step-type lines, use `connectNullsStyle="solid"`
|
|
148
|
+
* (which uses Recharts' native `connectNulls` and is unaffected by this limitation).
|
|
149
|
+
*/
|
|
150
|
+
var parsePathAnchors = function parsePathAnchors(pathData) {
|
|
151
|
+
var anchors = [];
|
|
152
|
+
var commandPattern = /([MLC])([^MLC]*)/g;
|
|
153
|
+
var match = commandPattern.exec(pathData);
|
|
154
|
+
while (match !== null) {
|
|
155
|
+
var _match$2$match;
|
|
156
|
+
var command = match[1];
|
|
157
|
+
var numbers = ((_match$2$match = match[2].match(/-?[\d.]+(?:e-?\d+)?/g)) !== null && _match$2$match !== void 0 ? _match$2$match : []).map(Number);
|
|
158
|
+
if (command === 'M' || command === 'L') {
|
|
159
|
+
if (numbers.length >= 2) anchors.push({
|
|
160
|
+
x: numbers[0],
|
|
161
|
+
y: numbers[1]
|
|
162
|
+
});
|
|
163
|
+
} else if (command === 'C') {
|
|
164
|
+
if (numbers.length >= 6) anchors.push({
|
|
165
|
+
x: numbers[4],
|
|
166
|
+
y: numbers[5]
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
match = commandPattern.exec(pathData);
|
|
170
|
+
}
|
|
171
|
+
return anchors;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { buildBridgePathData, getDefinedNumericPoints, getInteriorGaps, monotoneInterpolate, parsePathAnchors, resolveDataKeyValue };
|
|
175
|
+
//# sourceMappingURL=nullBridgeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullBridgeUtils.js","sources":["../../../../../../../src/components/Charts/utils/nullBridgeUtils.ts"],"sourcesContent":["// A dataKey can be a string (possibly dot-nested, e.g. `metrics.sales`), a number,\n// or a function — but the bridge utilities only handle the string/number form, which\n// is what Recharts' path rendering uses. Keeping this local avoids coupling the shared\n// utility to any specific chart component's types.\ntype DataKey = string | number | ((row: Record<string, unknown>) => unknown);\n\n/**\n * Monotone cubic interpolation using a weighted-harmonic tangent formula\n * (`3(dx₁+dx₂) / ((dx₁+2dx₂)/m₁ + (2dx₁+dx₂)/m₂)`). Given the defined points\n * `(xs[i], ys[i])` (xs ascending), it returns the interpolated `y` at `xq`. Used to densely\n * sample the null-bridge onto the real curve so the dashed bridge follows a monotone curve\n * across the gap instead of a straight chord.\n *\n * **Note on curve parity:** this shares its formula with `buildMonotonePath` (native\n * LineChart), so on native LineChart the bridge follows the same curve as the solid line.\n * It is *not* pixel-identical to d3-shape's `curveMonotoneX` (Steffen `slope3`, which Recharts\n * uses on web) nor to `buildMonotone` (native AreaChart, arithmetic-mean + Fritsch–Carlson\n * clip). The bridge endpoints always coincide with the solid anchors, so junctions are\n * continuous; only the interior curvature of the dashed span can differ slightly on web and\n * native AreaChart. Unifying all renderers on d3 `curveMonotoneX` is tracked as a follow-up.\n */\nconst monotoneInterpolate = (xs: number[], ys: number[], xq: number): number => {\n const n = xs.length;\n if (n === 0) return 0;\n if (n === 1) return ys[0];\n\n const slope: number[] = [];\n for (let i = 0; i < n - 1; i++) {\n const dx = xs[i + 1] - xs[i];\n slope[i] = dx === 0 ? 0 : (ys[i + 1] - ys[i]) / dx;\n }\n\n // Tangents at each point — weighted-harmonic formula, matching buildMonotonePath (native\n // LineChart) so the dashed bridge follows the same curve as the solid line on that renderer.\n // (Close to, but not pixel-identical to, d3's curveMonotoneX / Recharts on web.)\n const tangent: number[] = new Array(n);\n tangent[0] = slope[0];\n tangent[n - 1] = slope[n - 2];\n for (let i = 1; i < n - 1; i++) {\n const m1 = slope[i - 1];\n const m2 = slope[i];\n if (m1 * m2 <= 0) {\n tangent[i] = 0;\n } else {\n const dx1 = xs[i] - xs[i - 1];\n const dx2 = xs[i + 1] - xs[i];\n const common = dx1 + dx2;\n tangent[i] = (3 * common) / ((common + dx2) / m1 + (common + dx1) / m2);\n }\n }\n\n // Locate the interval containing xq and evaluate the Hermite basis.\n let k = 0;\n while (k < n - 2 && xq > xs[k + 1]) k++;\n const h = xs[k + 1] - xs[k];\n const t = h === 0 ? 0 : (xq - xs[k]) / h;\n const t2 = t * t;\n const t3 = t2 * t;\n const h00 = 2 * t3 - 3 * t2 + 1;\n const h10 = t3 - 2 * t2 + t;\n const h01 = -2 * t3 + 3 * t2;\n const h11 = t3 - t2;\n\n return h00 * ys[k] + h10 * h * tangent[k] + h01 * ys[k + 1] + h11 * h * tangent[k + 1];\n};\n\n// Resolve a (possibly nested, e.g. `metrics.sales`) dataKey from a data row.\nconst resolveDataKeyValue = (row: Record<string, unknown>, dataKey: DataKey): unknown => {\n const path = String(dataKey);\n if (!path) return undefined;\n return path.split('.').reduce<unknown>((accumulator, key) => {\n if (accumulator && typeof accumulator === 'object') {\n return (accumulator as Record<string, unknown>)[key];\n }\n return undefined;\n }, row);\n};\n\ntype DefinedPoints = { indices: number[]; values: number[] };\n\n// Extract the indices + numeric values of the non-null points for a dataKey.\nconst getDefinedNumericPoints = (\n data: Array<Record<string, unknown>>,\n dataKey: DataKey,\n): DefinedPoints => {\n const indices: number[] = [];\n const values: number[] = [];\n data.forEach((row, index) => {\n const raw = resolveDataKeyValue(row, dataKey);\n const numeric = raw === null || raw === undefined ? null : Number(raw);\n if (numeric !== null && !Number.isNaN(numeric)) {\n indices.push(index);\n values.push(numeric);\n }\n });\n return { indices, values };\n};\n\n// Positions (into the defined-points array) of adjacent defined points that have at least one null\n// point between them, i.e. an interior gap that a null-bridge should span.\nconst getInteriorGaps = (indices: number[]): Array<{ from: number; to: number }> => {\n const gaps: Array<{ from: number; to: number }> = [];\n for (let i = 0; i < indices.length - 1; i++) {\n if (indices[i + 1] - indices[i] > 1) {\n gaps.push({ from: i, to: i + 1 });\n }\n }\n return gaps;\n};\n\n/**\n * Build a dashed null-bridge `d` path (dense polyline) across a single interior gap, sampling the\n * monotone spline through the line's defined anchor points (in pixel space) so the bridge follows\n * the same curve Recharts draws for a solid connect instead of a straight chord.\n */\nconst buildBridgePathData = (anchors: PixelPoint[], from: number, to: number): string => {\n const xs = anchors.map((point) => point.x);\n const ys = anchors.map((point) => point.y);\n const start = anchors[from];\n const end = anchors[to];\n const sampleCount = Math.max(2, Math.round(Math.abs(end.x - start.x) / 3));\n let pathData = '';\n for (let step = 0; step <= sampleCount; step++) {\n const t = step / sampleCount;\n const x = start.x + (end.x - start.x) * t;\n const y = monotoneInterpolate(xs, ys, x);\n pathData += `${step === 0 ? 'M' : 'L'}${x},${y} `;\n }\n return pathData.trim();\n};\n\ntype PixelPoint = { x: number; y: number };\n\n/**\n * Parse the anchor (data) points out of an SVG path `d` string as rendered by Recharts for a line.\n * Handles `M`/`L` (linear) and `C` (monotone/natural cubic) commands — for a cubic the anchor is the\n * final control pair. Restart commands (`M`, from a gapped/`connectNulls={false}` line) contribute\n * their point too, so the result is the ordered list of the line's *defined* data points in pixel\n * space. Used to derive the null-bridge geometry from Recharts' own computed coordinates.\n *\n * **Limitation:** This parser only handles `M`, `L`, and `C` SVG commands. For step-type curves\n * (`type=\"step\"`, `\"stepBefore\"`, `\"stepAfter\"`), d3-shape generates extra `L` commands for\n * intermediate step points (e.g. `curveStepAfter` produces 2n-1 `L`/`M` commands for n defined\n * data points). The anchor count will not match the defined data point count, so the\n * `anchors.length !== indices.length` guard in the calling code will bail out and the dashed\n * bridge will not render. `connectNullsStyle=\"dashed\"` is therefore only supported for\n * `type=\"monotone\"` and `type=\"linear\"`. For step-type lines, use `connectNullsStyle=\"solid\"`\n * (which uses Recharts' native `connectNulls` and is unaffected by this limitation).\n */\nconst parsePathAnchors = (pathData: string): PixelPoint[] => {\n const anchors: PixelPoint[] = [];\n const commandPattern = /([MLC])([^MLC]*)/g;\n let match: RegExpExecArray | null = commandPattern.exec(pathData);\n while (match !== null) {\n const command = match[1];\n const numbers = (match[2].match(/-?[\\d.]+(?:e-?\\d+)?/g) ?? []).map(Number);\n if (command === 'M' || command === 'L') {\n if (numbers.length >= 2) anchors.push({ x: numbers[0], y: numbers[1] });\n } else if (command === 'C') {\n if (numbers.length >= 6) anchors.push({ x: numbers[4], y: numbers[5] });\n }\n match = commandPattern.exec(pathData);\n }\n return anchors;\n};\n\nexport {\n monotoneInterpolate,\n resolveDataKeyValue,\n getDefinedNumericPoints,\n getInteriorGaps,\n parsePathAnchors,\n buildBridgePathData,\n};\nexport type { DefinedPoints, PixelPoint, DataKey };\n"],"names":["monotoneInterpolate","xs","ys","xq","n","length","slope","i","dx","tangent","Array","m1","m2","dx1","dx2","common","k","h","t","t2","t3","h00","h10","h01","h11","resolveDataKeyValue","row","dataKey","path","String","undefined","split","reduce","accumulator","key","_typeof","getDefinedNumericPoints","data","indices","values","forEach","index","raw","numeric","Number","isNaN","push","getInteriorGaps","gaps","from","to","buildBridgePathData","anchors","map","point","x","y","start","end","sampleCount","Math","max","round","abs","pathData","step","concat","trim","parsePathAnchors","commandPattern","match","exec","_match$2$match","command","numbers"],"mappings":";;AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACMA,IAAAA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,EAAY,EAAEC,EAAY,EAAEC,EAAU,EAAa;AAC9E,EAAA,IAAMC,CAAC,GAAGH,EAAE,CAACI,MAAM,CAAA;AACnB,EAAA,IAAID,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAA;EACrB,IAAIA,CAAC,KAAK,CAAC,EAAE,OAAOF,EAAE,CAAC,CAAC,CAAC,CAAA;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AAAA,IAAA,IAAAE,cAAA,CAAA;AACrB,IAAA,IAAMC,OAAO,GAAGH,KAAK,CAAC,CAAC,CAAC,CAAA;IACxB,IAAMI,OAAO,GAAG,CAAA,CAAAF,cAAA,GAACF,KAAK,CAAC,CAAC,CAAC,CAACA,KAAK,CAAC,sBAAsB,CAAC,MAAA,IAAA,IAAAE,cAAA,KAAA,KAAA,CAAA,GAAAA,cAAA,GAAI,EAAE,EAAEnB,GAAG,CAACT,MAAM,CAAC,CAAA;AAC1E,IAAA,IAAI6B,OAAO,KAAK,GAAG,IAAIA,OAAO,KAAK,GAAG,EAAE;MACtC,IAAIC,OAAO,CAACrE,MAAM,IAAI,CAAC,EAAE+C,OAAO,CAACN,IAAI,CAAC;AAAES,QAAAA,CAAC,EAAEmB,OAAO,CAAC,CAAC,CAAC;QAAElB,CAAC,EAAEkB,OAAO,CAAC,CAAC,CAAA;AAAE,OAAC,CAAC,CAAA;AACzE,KAAC,MAAM,IAAID,OAAO,KAAK,GAAG,EAAE;MAC1B,IAAIC,OAAO,CAACrE,MAAM,IAAI,CAAC,EAAE+C,OAAO,CAACN,IAAI,CAAC;AAAES,QAAAA,CAAC,EAAEmB,OAAO,CAAC,CAAC,CAAC;QAAElB,CAAC,EAAEkB,OAAO,CAAC,CAAC,CAAA;AAAE,OAAC,CAAC,CAAA;AACzE,KAAA;AACAJ,IAAAA,KAAK,GAAGD,cAAc,CAACE,IAAI,CAACP,QAAQ,CAAC,CAAA;AACvC,GAAA;AACA,EAAA,OAAOZ,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { monotoneInterpolate } from './nullBridgeUtils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a closed SVG `d` path for a reference band, given the upper and lower bound points in
|
|
5
|
+
* pixel space (both ordered left→right, x ascending). The top edge is sampled left→right and the
|
|
6
|
+
* bottom edge right→left along the monotone spline through each bound's anchors, so the band's
|
|
7
|
+
* edges follow the same curve the trend line does instead of straight chords, then closed with `Z`.
|
|
8
|
+
*
|
|
9
|
+
* Shared by web (anchors parsed from Recharts' rendered bound curves via `parsePathAnchors`) and
|
|
10
|
+
* native (points computed directly from the chart scales), so the band geometry matches on both.
|
|
11
|
+
*/
|
|
12
|
+
var buildBandAreaPath = function buildBandAreaPath(upper, lower) {
|
|
13
|
+
if (upper.length < 2 || lower.length < 2) return '';
|
|
14
|
+
var upperXs = upper.map(function (point) {
|
|
15
|
+
return point.x;
|
|
16
|
+
});
|
|
17
|
+
var upperYs = upper.map(function (point) {
|
|
18
|
+
return point.y;
|
|
19
|
+
});
|
|
20
|
+
var lowerXs = lower.map(function (point) {
|
|
21
|
+
return point.x;
|
|
22
|
+
});
|
|
23
|
+
var lowerYs = lower.map(function (point) {
|
|
24
|
+
return point.y;
|
|
25
|
+
});
|
|
26
|
+
var startX = upper[0].x;
|
|
27
|
+
var endX = upper[upper.length - 1].x;
|
|
28
|
+
var sampleCount = Math.max(2, Math.round(Math.abs(endX - startX) / 3));
|
|
29
|
+
var pathData = '';
|
|
30
|
+
// Top edge: left → right along the upper bound.
|
|
31
|
+
for (var step = 0; step <= sampleCount; step++) {
|
|
32
|
+
var t = step / sampleCount;
|
|
33
|
+
var x = startX + (endX - startX) * t;
|
|
34
|
+
var y = monotoneInterpolate(upperXs, upperYs, x);
|
|
35
|
+
pathData += "".concat(step === 0 ? 'M' : 'L').concat(x, ",").concat(y, " ");
|
|
36
|
+
}
|
|
37
|
+
// Bottom edge: right → left along the lower bound, then close.
|
|
38
|
+
for (var _step = sampleCount; _step >= 0; _step--) {
|
|
39
|
+
var _t = _step / sampleCount;
|
|
40
|
+
var _x = startX + (endX - startX) * _t;
|
|
41
|
+
var _y = monotoneInterpolate(lowerXs, lowerYs, _x);
|
|
42
|
+
pathData += "L".concat(_x, ",").concat(_y, " ");
|
|
43
|
+
}
|
|
44
|
+
pathData += 'Z';
|
|
45
|
+
return pathData.trim();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Sanitize a dataKey into a CSS-class-safe token (nested keys like `metrics.sales` contain dots,
|
|
50
|
+
* which are invalid in a single className). Shared by the ChartLine bound-line renderer and the
|
|
51
|
+
* reference-band hook so both derive the same className for a given line.
|
|
52
|
+
*/
|
|
53
|
+
var sanitizeBandKey = function sanitizeBandKey(dataKey) {
|
|
54
|
+
return dataKey.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* className applied to a per-line band's invisible lower/upper bound line, so the reference-band
|
|
59
|
+
* hook can locate the rendered curve in the SVG. Kept in sync between the renderer and the reader.
|
|
60
|
+
*/
|
|
61
|
+
var perLineBandClass = function perLineBandClass(dataKey, edge) {
|
|
62
|
+
return "blade-reference-band-".concat(sanitizeBandKey(dataKey), "-").concat(edge);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { buildBandAreaPath, perLineBandClass, sanitizeBandKey };
|
|
66
|
+
//# sourceMappingURL=referenceBandUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceBandUtils.js","sources":["../../../../../../../src/components/Charts/utils/referenceBandUtils.ts"],"sourcesContent":["import { monotoneInterpolate } from './nullBridgeUtils';\nimport type { PixelPoint } from './nullBridgeUtils';\n\n/**\n * Build a closed SVG `d` path for a reference band, given the upper and lower bound points in\n * pixel space (both ordered left→right, x ascending). The top edge is sampled left→right and the\n * bottom edge right→left along the monotone spline through each bound's anchors, so the band's\n * edges follow the same curve the trend line does instead of straight chords, then closed with `Z`.\n *\n * Shared by web (anchors parsed from Recharts' rendered bound curves via `parsePathAnchors`) and\n * native (points computed directly from the chart scales), so the band geometry matches on both.\n */\nconst buildBandAreaPath = (upper: PixelPoint[], lower: PixelPoint[]): string => {\n if (upper.length < 2 || lower.length < 2) return '';\n\n const upperXs = upper.map((point) => point.x);\n const upperYs = upper.map((point) => point.y);\n const lowerXs = lower.map((point) => point.x);\n const lowerYs = lower.map((point) => point.y);\n\n const startX = upper[0].x;\n const endX = upper[upper.length - 1].x;\n const sampleCount = Math.max(2, Math.round(Math.abs(endX - startX) / 3));\n\n let pathData = '';\n // Top edge: left → right along the upper bound.\n for (let step = 0; step <= sampleCount; step++) {\n const t = step / sampleCount;\n const x = startX + (endX - startX) * t;\n const y = monotoneInterpolate(upperXs, upperYs, x);\n pathData += `${step === 0 ? 'M' : 'L'}${x},${y} `;\n }\n // Bottom edge: right → left along the lower bound, then close.\n for (let step = sampleCount; step >= 0; step--) {\n const t = step / sampleCount;\n const x = startX + (endX - startX) * t;\n const y = monotoneInterpolate(lowerXs, lowerYs, x);\n pathData += `L${x},${y} `;\n }\n pathData += 'Z';\n return pathData.trim();\n};\n\n/**\n * Sanitize a dataKey into a CSS-class-safe token (nested keys like `metrics.sales` contain dots,\n * which are invalid in a single className). Shared by the ChartLine bound-line renderer and the\n * reference-band hook so both derive the same className for a given line.\n */\nconst sanitizeBandKey = (dataKey: string): string => dataKey.replace(/[^a-zA-Z0-9_-]/g, '-');\n\n/**\n * className applied to a per-line band's invisible lower/upper bound line, so the reference-band\n * hook can locate the rendered curve in the SVG. Kept in sync between the renderer and the reader.\n */\nconst perLineBandClass = (dataKey: string, edge: 'lower' | 'upper'): string =>\n `blade-reference-band-${sanitizeBandKey(dataKey)}-${edge}`;\n\nexport { buildBandAreaPath, sanitizeBandKey, perLineBandClass };\n"],"names":["buildBandAreaPath","upper","lower","length","upperXs","map","point","x","upperYs","y","lowerXs","lowerYs","startX","endX","sampleCount","Math","max","round","abs","pathData","step","t","monotoneInterpolate","concat","trim","sanitizeBandKey","dataKey","replace","perLineBandClass","edge"],"mappings":";;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACMA,IAAAA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAmB,EAAEC,KAAmB,EAAa;AAC9E,EAAA,IAAID,KAAK,CAACE,MAAM,GAAG,CAAC,IAAID,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Array';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import React__default, { useState, useRef, useEffect, useCallback } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
|
-
import { StyledCounterInput } from './StyledCounterInput.js';
|
|
7
|
-
import { COUNTER_INPUT_TOKEN, COUNTER_INPUT_ICON_SIZE_MAP } from './token.js';
|
|
6
|
+
import { StyledCounterInput, StyledNumberWrapper } from './StyledCounterInput.js';
|
|
7
|
+
import { COUNTER_INPUT_TOKEN, COUNTER_INPUT_SIZE_TO_TEXT_SIZE, COUNTER_INPUT_ICON_SIZE_MAP } from './token.js';
|
|
8
8
|
import { CounterInputProvider } from './CounterInputContext.js';
|
|
9
9
|
import '../Input/BaseInput/index.js';
|
|
10
|
+
import { baseInputCounterInputPaddingTokens } from '../Input/BaseInput/baseInputTokens.js';
|
|
10
11
|
import '../../utils/metaAttribute/index.js';
|
|
11
12
|
import '../Box/styledProps/index.js';
|
|
12
13
|
import '../../utils/assignWithoutSideEffects/index.js';
|
|
@@ -24,6 +25,7 @@ import '../ProgressBar/index.js';
|
|
|
24
25
|
import getIn from '../../utils/lodashButBetter/get.js';
|
|
25
26
|
import { mergeRefs } from '../../utils/useMergeRefs.js';
|
|
26
27
|
import '../../utils/getFocusRingStyles/index.js';
|
|
28
|
+
import { getTextProps } from '../Typography/Text/Text.js';
|
|
27
29
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
28
30
|
import { makeBorderSize } from '../../utils/makeBorderSize/makeBorderSize.js';
|
|
29
31
|
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
@@ -32,6 +34,7 @@ import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js
|
|
|
32
34
|
import { getFocusRingStyles } from '../../utils/getFocusRingStyles/getFocusRingStyles.web.js';
|
|
33
35
|
import useTheme from '../BladeProvider/useTheme.js';
|
|
34
36
|
import { useBreakpoint } from '../../utils/useBreakpoint/useBreakpoint.js';
|
|
37
|
+
import { makeTypographySize } from '../../utils/makeTypographySize/makeTypographySize.web.js';
|
|
35
38
|
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
36
39
|
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
37
40
|
import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
|
|
@@ -142,6 +145,22 @@ var _CounterInput = /*#__PURE__*/React__default.forwardRef(function (_ref8, ref)
|
|
|
142
145
|
var lastActionRef = useRef(null);
|
|
143
146
|
var previousValueRef = useRef(internalValue);
|
|
144
147
|
var containerRef = useRef(null);
|
|
148
|
+
var rawCounterValue = internalValue !== null && internalValue !== void 0 ? internalValue : min;
|
|
149
|
+
var counterValueDigitCount = Math.max(2, String(Math.abs(rawCounterValue)).length) + (rawCounterValue < 0 ? 1 : 0);
|
|
150
|
+
var _getTextProps = getTextProps({
|
|
151
|
+
variant: 'body',
|
|
152
|
+
size: COUNTER_INPUT_SIZE_TO_TEXT_SIZE[size],
|
|
153
|
+
weight: 'semibold'
|
|
154
|
+
}),
|
|
155
|
+
_getTextProps$fontSiz = _getTextProps.fontSize,
|
|
156
|
+
counterInputFontSizeToken = _getTextProps$fontSiz === void 0 ? 100 : _getTextProps$fontSiz;
|
|
157
|
+
var counterInputHorizontalPadding = theme.spacing[baseInputCounterInputPaddingTokens.left[size]] + theme.spacing[baseInputCounterInputPaddingTokens.right[size]];
|
|
158
|
+
var counterInputFieldWidth = "calc(".concat(counterValueDigitCount, "ch + ").concat(counterInputHorizontalPadding, "px)");
|
|
159
|
+
var counterInputTextStyle = {
|
|
160
|
+
fontFamily: theme.typography.fonts.family.text,
|
|
161
|
+
fontSize: makeTypographySize(theme.typography.fonts.size[counterInputFontSizeToken]),
|
|
162
|
+
fontWeight: theme.typography.fonts.weight.semibold
|
|
163
|
+
};
|
|
145
164
|
|
|
146
165
|
// Track Tab navigation to show focus ring only on keyboard navigation (not mouse clicks)
|
|
147
166
|
// Note: :focus-visible doesn't work for text inputs - shows ring on both Tab and click
|
|
@@ -251,7 +270,8 @@ var _CounterInput = /*#__PURE__*/React__default.forwardRef(function (_ref8, ref)
|
|
|
251
270
|
alignItems: "center",
|
|
252
271
|
flexDirection: "column",
|
|
253
272
|
backgroundColor: isLoading || isDisabled ? emphasisTokens.loadingOrDisabledBgColor : emphasisTokens.backgroundColor,
|
|
254
|
-
width: ""
|
|
273
|
+
width: "fit-content",
|
|
274
|
+
minWidth: "".concat(COUNTER_INPUT_TOKEN.width[size], "px"),
|
|
255
275
|
height: "".concat(COUNTER_INPUT_TOKEN.height[size], "px"),
|
|
256
276
|
borderRadius: COUNTER_INPUT_TOKEN.containerBorderRadius[size],
|
|
257
277
|
borderWidth: "thin",
|
|
@@ -276,8 +296,12 @@ var _CounterInput = /*#__PURE__*/React__default.forwardRef(function (_ref8, ref)
|
|
|
276
296
|
size: COUNTER_INPUT_ICON_SIZE_MAP[size],
|
|
277
297
|
color: "currentColor"
|
|
278
298
|
})
|
|
279
|
-
}), /*#__PURE__*/jsx(
|
|
280
|
-
className: animationClass,
|
|
299
|
+
}), /*#__PURE__*/jsx(StyledNumberWrapper, {
|
|
300
|
+
className: "__blade-counter-input-number-wrapper ".concat(animationClass).trim(),
|
|
301
|
+
$width: counterInputFieldWidth,
|
|
302
|
+
$fontFamily: counterInputTextStyle.fontFamily,
|
|
303
|
+
$fontSize: counterInputTextStyle.fontSize,
|
|
304
|
+
$fontWeight: counterInputTextStyle.fontWeight,
|
|
281
305
|
children: /*#__PURE__*/jsx(BaseInput, {
|
|
282
306
|
ref: ref,
|
|
283
307
|
id: inputId,
|