@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
|
@@ -23,6 +23,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
24
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
25
|
var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
|
|
26
|
+
var _treeViewControllerRe2;
|
|
26
27
|
var idBase = useId('filter-chip-select-input');
|
|
27
28
|
var _onClick = props.onClick,
|
|
28
29
|
_onBlur = props.onBlur,
|
|
@@ -57,7 +58,8 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
|
|
|
57
58
|
isControlled = _useDropdown.isControlled,
|
|
58
59
|
setSelectedIndices = _useDropdown.setSelectedIndices,
|
|
59
60
|
controlledValueIndices = _useDropdown.controlledValueIndices,
|
|
60
|
-
changeCallbackTriggerer = _useDropdown.changeCallbackTriggerer
|
|
61
|
+
changeCallbackTriggerer = _useDropdown.changeCallbackTriggerer,
|
|
62
|
+
treeViewControllerRef = _useDropdown.treeViewControllerRef;
|
|
61
63
|
var isUnControlled = options.length > 0 && props.value === undefined;
|
|
62
64
|
// Currently we are having 2 context for selectedFilters. One is for FilterChipGroup and other is for ListView
|
|
63
65
|
var _useListViewFilterCon = useListViewFilterContext(),
|
|
@@ -107,19 +109,20 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
|
|
|
107
109
|
} else if (listViewSelectedFilters[label]) {
|
|
108
110
|
var _savedIndices = listViewSelectedFilters[label];
|
|
109
111
|
setSelectedIndices(_savedIndices);
|
|
110
|
-
// Sync selected indices when controlled value changes or on first render with options loaded
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
// Sync selected indices when controlled value changes or on first render with options loaded.
|
|
113
|
+
// An emptied value clears the selection too, so consumers can reset from outside the chip
|
|
114
|
+
// (e.g. a Clear button in the dropdown footer)
|
|
115
|
+
} else if (!isValueAndSelectedIndicesSynced && options.length > 0) {
|
|
116
|
+
var newSelectedIndices = !valueNotEmpty ? [] : options.map(function (option, index) {
|
|
117
|
+
var isSelected = typeof value === 'string' ? option.value === value : Array.isArray(value) && value.includes(option.value);
|
|
118
|
+
return isSelected ? index : -1;
|
|
116
119
|
}).filter(function (index) {
|
|
117
120
|
return index !== -1;
|
|
118
121
|
});
|
|
119
122
|
setSelectedIndices(newSelectedIndices);
|
|
120
123
|
}
|
|
121
124
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
-
}, [isUnControlled, options]);
|
|
125
|
+
}, [isUnControlled, options, value]);
|
|
123
126
|
var handleClearButtonClick = function handleClearButtonClick() {
|
|
124
127
|
var _props$onClearButtonC, _props$onChange;
|
|
125
128
|
(_props$onClearButtonC = props.onClearButtonClick) === null || _props$onClearButtonC === void 0 || _props$onClearButtonC.call(props, {
|
|
@@ -151,11 +154,15 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
|
|
|
151
154
|
}, [clearFilterCallbackTriggerer]);
|
|
152
155
|
useEffect(function () {
|
|
153
156
|
if (!isFirstRender) {
|
|
154
|
-
var _props$onChange2;
|
|
155
|
-
|
|
157
|
+
var _treeViewControllerRe, _props$onChange2;
|
|
158
|
+
// §6.5: additive - only present when overlay content is a TreeView
|
|
159
|
+
var selectedGroups = (_treeViewControllerRe = treeViewControllerRef.current) === null || _treeViewControllerRe === void 0 ? void 0 : _treeViewControllerRe.getSelectedGroups(isControlled ? controlledValueIndices : selectedIndices);
|
|
160
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, _objectSpread({
|
|
156
161
|
name: props.name || idBase,
|
|
157
162
|
values: getValuesArrayFromIndices()
|
|
158
|
-
}
|
|
163
|
+
}, selectedGroups ? {
|
|
164
|
+
selectedGroups: selectedGroups
|
|
165
|
+
} : {}));
|
|
159
166
|
if (isUnControlled) {
|
|
160
167
|
setUncontrolledInputValue(getValuesArrayFromIndices());
|
|
161
168
|
}
|
|
@@ -206,7 +213,8 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
|
|
|
206
213
|
value: props.value,
|
|
207
214
|
options: options,
|
|
208
215
|
selectionType: selectionType,
|
|
209
|
-
uncontrolledInputValue: uncontrolledInputValue
|
|
216
|
+
uncontrolledInputValue: uncontrolledInputValue,
|
|
217
|
+
displayOverride: (_treeViewControllerRe2 = treeViewControllerRef.current) === null || _treeViewControllerRe2 === void 0 ? void 0 : _treeViewControllerRe2.getDisplayOverride(selectedIndices)
|
|
210
218
|
}),
|
|
211
219
|
onClearButtonClick: handleClearButtonClick,
|
|
212
220
|
showClearButton: showClearButton,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterChipSelectInput.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipSelectInput.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React, { useEffect } from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { getFilterChipDisplayValue } from './filterChipSelectInputUtils';\nimport { useFilterChipGroupContext } from './FilterChipGroupContext.web';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { BaseFilterChip } from '~components/FilterChip/BaseFilterChip';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseFilterChipProps } from '~components/FilterChip/types';\nimport { useId } from '~utils/useId';\nimport { useListViewFilterContext } from '~components/ListView/ListViewFiltersContext.web';\nimport { useFirstRender } from '~utils/useFirstRender';\n\ntype FilterChipSelectInputProps = Pick<\n BaseFilterChipProps,\n | 'onKeyDown'\n | 'value'\n | 'label'\n | 'testID'\n | 'onClick'\n | 'selectionType'\n | 'onBlur'\n | 'showClearButton'\n> & {\n accessibilityLabel?: string;\n onChange?: (props: { name: string; values: string[] }) => void;\n name?: string;\n onClearButtonClick?: (props: { name: string; values: string[] }) => void;\n isDisabled?: boolean;\n} & DataAnalyticsAttribute;\n\nconst _FilterChipSelectInput = (props: FilterChipSelectInputProps): React.ReactElement => {\n const idBase = useId('filter-chip-select-input');\n const {\n onClick,\n onBlur,\n onKeyDown,\n accessibilityLabel,\n testID,\n value,\n onClearButtonClick,\n label,\n onChange,\n name,\n isDisabled,\n showClearButton = true,\n ...rest\n } = props;\n const [uncontrolledInputValue, setUncontrolledInputValue] = React.useState<string[]>([]);\n const isFirstRender = useFirstRender();\n\n const {\n options,\n selectedIndices,\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n selectionType,\n isControlled,\n setSelectedIndices,\n controlledValueIndices,\n changeCallbackTriggerer,\n } = useDropdown();\n const isUnControlled = options.length > 0 && props.value === undefined;\n // Currently we are having 2 context for selectedFilters. One is for FilterChipGroup and other is for ListView\n const { listViewSelectedFilters, setListViewSelectedFilters } = useListViewFilterContext();\n const {\n clearFilterCallbackTriggerer,\n setFilterChipGroupSelectedFilters,\n } = useFilterChipGroupContext();\n\n const getValuesArrayFromIndices = (): string[] => {\n let indices: number[] = [];\n if (isControlled) {\n indices = controlledValueIndices;\n } else {\n indices = selectedIndices;\n }\n\n return indices.map((selectionIndex) => options[selectionIndex].value);\n };\n\n useEffect(() => {\n const valueNotEmpty =\n (typeof value === 'string' && value.trim() !== '') ||\n (Array.isArray(value) && value.length > 0);\n\n // Compare actual selected values (not just lengths) to detect controlled value changes\n const currentSelectedValues = selectedIndices.map((i) => options[i]?.value);\n const isSingleValueSynced =\n typeof value === 'string' &&\n currentSelectedValues.length === 1 &&\n currentSelectedValues[0] === value;\n\n const isMultiValueSynced =\n Array.isArray(value) &&\n value.length === currentSelectedValues.length &&\n value.every((v) => currentSelectedValues.includes(v));\n\n const isValueAndSelectedIndicesSynced = isSingleValueSynced || isMultiValueSynced;\n\n if (isUnControlled) {\n if (listViewSelectedFilters[label]) {\n const savedIndices = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(savedIndices);\n const inputValue = savedIndices.map((selectionIndex) => options[selectionIndex].value);\n setUncontrolledInputValue(inputValue);\n setFilterChipGroupSelectedFilters((prev) =>\n prev.includes(label) ? prev : [...prev, label],\n );\n } else {\n setSelectedIndices([]);\n }\n } else if (listViewSelectedFilters[label]) {\n const savedIndices = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(savedIndices);\n // Sync selected indices when controlled value changes or on first render with options loaded\n } else if (valueNotEmpty && !isValueAndSelectedIndicesSynced && options.length > 0) {\n const newSelectedIndices =\n typeof value === 'string'\n ? [options.findIndex((option) => option.value === value)]\n : options\n .map((option, index) => (value.includes(option.value) ? index : -1))\n .filter((index) => index !== -1);\n setSelectedIndices(newSelectedIndices);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isUnControlled, options]);\n\n const handleClearButtonClick = (): void => {\n props.onClearButtonClick?.({ name: name ?? idBase, values: getValuesArrayFromIndices() });\n props.onChange?.({ name: name ?? idBase, values: [] });\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n setUncontrolledInputValue([]);\n setSelectedIndices([]);\n };\n\n useEffect(() => {\n if (clearFilterCallbackTriggerer) {\n handleClearButtonClick();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clearFilterCallbackTriggerer]);\n\n useEffect(() => {\n if (!isFirstRender) {\n props.onChange?.({\n name: props.name || idBase,\n values: getValuesArrayFromIndices(),\n });\n if (isUnControlled) {\n setUncontrolledInputValue(getValuesArrayFromIndices());\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n useEffect(() => {\n const isValueEmpty = selectedIndices.length === 0;\n if (!isFirstRender && !isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => (prev.includes(label) ? prev : [...prev, label]));\n setListViewSelectedFilters((prev) => ({\n ...prev,\n [label]: selectedIndices as number[],\n }));\n } else if (!isFirstRender && isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n\n const handleKeyDown = (e: React.KeyboardEvent<Element>): void => {\n onKeyDown?.(e);\n onTriggerKeydown?.({ event: e as React.KeyboardEvent<HTMLInputElement> });\n\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n }\n\n if ((e.key === 'Enter' || e.key === ' ') && !isOpen) {\n e.preventDefault();\n e.stopPropagation();\n onTriggerClick();\n }\n };\n return (\n <BaseFilterChip\n label={label}\n value={getFilterChipDisplayValue({\n value: props.value,\n options,\n selectionType,\n uncontrolledInputValue,\n })}\n onClearButtonClick={handleClearButtonClick}\n showClearButton={showClearButton}\n selectionType={selectionType}\n {...rest}\n ref={triggererRef as any}\n onKeyDown={handleKeyDown}\n accessibilityProps={{\n label: accessibilityLabel ?? label,\n hasPopup: getActionListContainerRole(hasFooterAction, 'FilterChipSelectInput'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n onClick?.(e);\n }}\n onBlur={(e) => {\n onBlur?.(e);\n }}\n isDisabled={isDisabled}\n />\n );\n};\n\nconst FilterChipSelectInput = assignWithoutSideEffects(_FilterChipSelectInput, {\n componentId: dropdownComponentIds.triggers.FilterChipSelectInput,\n});\n\nexport { FilterChipSelectInput };\n"],"names":["_FilterChipSelectInput","props","idBase","useId","onClick","onBlur","onKeyDown","accessibilityLabel","testID","value","onClearButtonClick","label","onChange","name","isDisabled","_props$showClearButto","showClearButton","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","uncontrolledInputValue","setUncontrolledInputValue","isFirstRender","useFirstRender","_useDropdown","useDropdown","options","selectedIndices","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","selectionType","isControlled","setSelectedIndices","controlledValueIndices","changeCallbackTriggerer","isUnControlled","length","undefined","_useListViewFilterCon","useListViewFilterContext","listViewSelectedFilters","setListViewSelectedFilters","_useFilterChipGroupCo","useFilterChipGroupContext","clearFilterCallbackTriggerer","setFilterChipGroupSelectedFilters","getValuesArrayFromIndices","indices","map","selectionIndex","useEffect","valueNotEmpty","trim","Array","isArray","currentSelectedValues","i","_options$i","isSingleValueSynced","isMultiValueSynced","every","v","includes","isValueAndSelectedIndicesSynced","savedIndices","inputValue","prev","concat","_toConsumableArray","newSelectedIndices","findIndex","option","index","filter","handleClearButtonClick","_props$onClearButtonC","_props$onChange","call","values","_","updatedFilters","_toPropertyKey","_props$onChange2","isValueEmpty","_objectSpread","_defineProperty","handleKeyDown","e","event","key","preventDefault","stopPropagation","_jsx","BaseFilterChip","getFilterChipDisplayValue","ref","accessibilityProps","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","FilterChipSelectInput","assignWithoutSideEffects","componentId","d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Q,EAAAjC,EAAAA,CAAAA,MAAA,CAAK1C,cAAc,EAAa,aAAA,CAAA;AACxC4E,MAAAA,gBAAgB,EAAE1E,WAAW,IAAI,CAAC,GAAAwC,EAAAA,CAAAA,MAAA,CAAM1C,cAAc,EAAA0C,GAAAA,CAAAA,CAAAA,MAAA,CAAIxC,WAAW,CAAKU,GAAAA,SAAAA;KAC1E;AACF3C,IAAAA,OAAO,EAAE,SAATA,OAAOA,CAAG6F,CAAC,EAAK;AACdhE,MAAAA,cAAc,EAAE,CAAA;AAChB7B,MAAAA,QAAO,aAAPA,QAAO,KAAA,KAAA,CAAA,IAAPA,QAAO,CAAG6F,CAAC,CAAC,CAAA;KACZ;AACF5F,IAAAA,MAAM,EAAE,SAARA,MAAMA,CAAG4F,CAAC,EAAK;AACb5F,MAAAA,OAAM,aAANA,OAAM,KAAA,KAAA,CAAA,IAANA,OAAM,CAAG4F,CAAC,CAAC,CAAA;KACX;AACFnF,IAAAA,UAAU,EAAEA,UAAAA;AAAW,GAAA,CACxB,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAMkG,qBAAqB,gBAAGC,wBAAwB,CAACjH,sBAAsB,EAAE;AAC7EkH,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACJ,qBAAAA;AAC7C,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"FilterChipSelectInput.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipSelectInput.web.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n\nimport React, { useEffect } from 'react';\nimport { useDropdown } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport { getFilterChipDisplayValue } from './filterChipSelectInputUtils';\nimport { useFilterChipGroupContext } from './FilterChipGroupContext.web';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { BaseFilterChip } from '~components/FilterChip/BaseFilterChip';\nimport { getActionListContainerRole } from '~components/ActionList/getA11yRoles';\nimport type { BaseFilterChipProps } from '~components/FilterChip/types';\nimport { useId } from '~utils/useId';\nimport { useListViewFilterContext } from '~components/ListView/ListViewFiltersContext.web';\nimport { useFirstRender } from '~utils/useFirstRender';\n\ntype FilterChipSelectInputProps = Pick<\n BaseFilterChipProps,\n | 'onKeyDown'\n | 'value'\n | 'label'\n | 'testID'\n | 'onClick'\n | 'selectionType'\n | 'onBlur'\n | 'showClearButton'\n> & {\n accessibilityLabel?: string;\n /**\n * `selectedGroups` is only present when the Dropdown overlay content is a TreeView -\n * it contains the values of the topmost fully-selected branches\n */\n onChange?: (props: { name: string; values: string[]; selectedGroups?: string[] }) => void;\n name?: string;\n onClearButtonClick?: (props: { name: string; values: string[] }) => void;\n isDisabled?: boolean;\n} & DataAnalyticsAttribute;\n\nconst _FilterChipSelectInput = (props: FilterChipSelectInputProps): React.ReactElement => {\n const idBase = useId('filter-chip-select-input');\n const {\n onClick,\n onBlur,\n onKeyDown,\n accessibilityLabel,\n testID,\n value,\n onClearButtonClick,\n label,\n onChange,\n name,\n isDisabled,\n showClearButton = true,\n ...rest\n } = props;\n const [uncontrolledInputValue, setUncontrolledInputValue] = React.useState<string[]>([]);\n const isFirstRender = useFirstRender();\n\n const {\n options,\n selectedIndices,\n onTriggerClick,\n onTriggerKeydown,\n dropdownBaseId,\n isOpen,\n activeIndex,\n hasFooterAction,\n triggererRef,\n selectionType,\n isControlled,\n setSelectedIndices,\n controlledValueIndices,\n changeCallbackTriggerer,\n treeViewControllerRef,\n } = useDropdown();\n const isUnControlled = options.length > 0 && props.value === undefined;\n // Currently we are having 2 context for selectedFilters. One is for FilterChipGroup and other is for ListView\n const { listViewSelectedFilters, setListViewSelectedFilters } = useListViewFilterContext();\n const {\n clearFilterCallbackTriggerer,\n setFilterChipGroupSelectedFilters,\n } = useFilterChipGroupContext();\n\n const getValuesArrayFromIndices = (): string[] => {\n let indices: number[] = [];\n if (isControlled) {\n indices = controlledValueIndices;\n } else {\n indices = selectedIndices;\n }\n\n return indices.map((selectionIndex) => options[selectionIndex].value);\n };\n\n useEffect(() => {\n const valueNotEmpty =\n (typeof value === 'string' && value.trim() !== '') ||\n (Array.isArray(value) && value.length > 0);\n\n // Compare actual selected values (not just lengths) to detect controlled value changes\n const currentSelectedValues = selectedIndices.map((i) => options[i]?.value);\n const isSingleValueSynced =\n typeof value === 'string' &&\n currentSelectedValues.length === 1 &&\n currentSelectedValues[0] === value;\n\n const isMultiValueSynced =\n Array.isArray(value) &&\n value.length === currentSelectedValues.length &&\n value.every((v) => currentSelectedValues.includes(v));\n\n const isValueAndSelectedIndicesSynced = isSingleValueSynced || isMultiValueSynced;\n\n if (isUnControlled) {\n if (listViewSelectedFilters[label]) {\n const savedIndices = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(savedIndices);\n const inputValue = savedIndices.map((selectionIndex) => options[selectionIndex].value);\n setUncontrolledInputValue(inputValue);\n setFilterChipGroupSelectedFilters((prev) =>\n prev.includes(label) ? prev : [...prev, label],\n );\n } else {\n setSelectedIndices([]);\n }\n } else if (listViewSelectedFilters[label]) {\n const savedIndices = (listViewSelectedFilters[label] as unknown) as number[];\n setSelectedIndices(savedIndices);\n // Sync selected indices when controlled value changes or on first render with options loaded.\n // An emptied value clears the selection too, so consumers can reset from outside the chip\n // (e.g. a Clear button in the dropdown footer)\n } else if (!isValueAndSelectedIndicesSynced && options.length > 0) {\n const newSelectedIndices = !valueNotEmpty\n ? []\n : options\n .map((option, index) => {\n const isSelected =\n typeof value === 'string'\n ? option.value === value\n : Array.isArray(value) && value.includes(option.value);\n return isSelected ? index : -1;\n })\n .filter((index) => index !== -1);\n setSelectedIndices(newSelectedIndices);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isUnControlled, options, value]);\n\n const handleClearButtonClick = (): void => {\n props.onClearButtonClick?.({ name: name ?? idBase, values: getValuesArrayFromIndices() });\n props.onChange?.({ name: name ?? idBase, values: [] });\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n setUncontrolledInputValue([]);\n setSelectedIndices([]);\n };\n\n useEffect(() => {\n if (clearFilterCallbackTriggerer) {\n handleClearButtonClick();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clearFilterCallbackTriggerer]);\n\n useEffect(() => {\n if (!isFirstRender) {\n // §6.5: additive - only present when overlay content is a TreeView\n const selectedGroups = treeViewControllerRef.current?.getSelectedGroups(\n isControlled ? controlledValueIndices : selectedIndices,\n );\n props.onChange?.({\n name: props.name || idBase,\n values: getValuesArrayFromIndices(),\n ...(selectedGroups ? { selectedGroups } : {}),\n });\n if (isUnControlled) {\n setUncontrolledInputValue(getValuesArrayFromIndices());\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n useEffect(() => {\n const isValueEmpty = selectedIndices.length === 0;\n if (!isFirstRender && !isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => (prev.includes(label) ? prev : [...prev, label]));\n setListViewSelectedFilters((prev) => ({\n ...prev,\n [label]: selectedIndices as number[],\n }));\n } else if (!isFirstRender && isValueEmpty) {\n setFilterChipGroupSelectedFilters((prev) => prev.filter((filter) => filter !== label));\n setListViewSelectedFilters((prev) => {\n const { [label]: _, ...updatedFilters } = prev;\n return updatedFilters;\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [changeCallbackTriggerer]);\n\n const handleKeyDown = (e: React.KeyboardEvent<Element>): void => {\n onKeyDown?.(e);\n onTriggerKeydown?.({ event: e as React.KeyboardEvent<HTMLInputElement> });\n\n if (e.key === 'Escape') {\n e.preventDefault();\n e.stopPropagation();\n }\n\n if ((e.key === 'Enter' || e.key === ' ') && !isOpen) {\n e.preventDefault();\n e.stopPropagation();\n onTriggerClick();\n }\n };\n return (\n <BaseFilterChip\n label={label}\n value={getFilterChipDisplayValue({\n value: props.value,\n options,\n selectionType,\n uncontrolledInputValue,\n displayOverride: treeViewControllerRef.current?.getDisplayOverride(selectedIndices),\n })}\n onClearButtonClick={handleClearButtonClick}\n showClearButton={showClearButton}\n selectionType={selectionType}\n {...rest}\n ref={triggererRef as any}\n onKeyDown={handleKeyDown}\n accessibilityProps={{\n label: accessibilityLabel ?? label,\n hasPopup: getActionListContainerRole(hasFooterAction, 'FilterChipSelectInput'),\n expanded: isOpen,\n controls: `${dropdownBaseId}-actionlist`,\n activeDescendant: activeIndex >= 0 ? `${dropdownBaseId}-${activeIndex}` : undefined,\n }}\n onClick={(e) => {\n onTriggerClick();\n onClick?.(e);\n }}\n onBlur={(e) => {\n onBlur?.(e);\n }}\n isDisabled={isDisabled}\n />\n );\n};\n\nconst FilterChipSelectInput = assignWithoutSideEffects(_FilterChipSelectInput, {\n componentId: dropdownComponentIds.triggers.FilterChipSelectInput,\n});\n\nexport { FilterChipSelectInput };\n"],"names":["_FilterChipSelectInput","props","_treeViewControllerRe2","idBase","useId","onClick","onBlur","onKeyDown","accessibilityLabel","testID","value","onClearButtonClick","label","onChange","name","isDisabled","_props$showClearButto","showClearButton","rest","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","uncontrolledInputValue","setUncontrolledInputValue","isFirstRender","useFirstRender","_useDropdown","useDropdown","options","selectedIndices","onTriggerClick","onTriggerKeydown","dropdownBaseId","isOpen","activeIndex","hasFooterAction","triggererRef","selectionType","isControlled","setSelectedIndices","controlledValueIndices","changeCallbackTriggerer","treeViewControllerRef","isUnControlled","length","undefined","_useListViewFilterCon","useListViewFilterContext","listViewSelectedFilters","setListViewSelectedFilters","_useFilterChipGroupCo","useFilterChipGroupContext","clearFilterCallbackTriggerer","setFilterChipGroupSelectedFilters","getValuesArrayFromIndices","indices","map","selectionIndex","useEffect","valueNotEmpty","trim","Array","isArray","currentSelectedValues","i","_options$i","isSingleValueSynced","isMultiValueSynced","every","v","includes","isValueAndSelectedIndicesSynced","savedIndices","inputValue","prev","concat","_toConsumableArray","newSelectedIndices","option","index","isSelected","filter","handleClearButtonClick","_props$onClearButtonC","_props$onChange","call","values","_","updatedFilters","_toPropertyKey","_treeViewControllerRe","_props$onChange2","selectedGroups","current","getSelectedGroups","_objectSpread","isValueEmpty","_defineProperty","handleKeyDown","e","event","key","preventDefault","stopPropagation","_jsx","BaseFilterChip","getFilterChipDisplayValue","displayOverride","getDisplayOverride","ref","accessibilityProps","hasPopup","getActionListContainerRole","expanded","controls","activeDescendant","FilterChipSelectInput","assignWithoutSideEffects","componentId","dropdownComponentIds","triggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,KAAiC,EAAyB;AAAA,EAAA,IAAAC,sBAAA,CAAA;AACxF,EAAA,IAAMC,MAAM,GAAGC,KAAK,CAAC,0BAA0B,CAAC,CAAA;AAChD,EAAA,IACEC,QAAO,GAaLJ,KAAK,CAbPI,OAAO;IACPC,OAAM,GAYJL,KAAK,CAZPK,MAAM;IACNC,SAAS,GAWPN,KAAK,CAXPM,SAAS;IACTC,kBAAkB,GAUhBP,KAAK,CAVPO,kBAAkB;IAClBC,MAAM,GASJR,KAAK,CATPQ,MAAM;IACNC,KAAK,GAQHT,KAAK,CARPS,KAAK;IACLC,kBAAkB,GAOhBV,KAAK,CAPPU,kBAAkB;IAClBC,KAAK,GAMHX,KAAK,CANPW,KAAK;IACLC,QAAQ,GAKNZ,KAAK,CALPY,QAAQ;IACRC,IAAI,GAIFb,KAAK,CAJPa,IAAI;IACJC,UAAU,GAGRd,KAAK,CAHPc,UAAU;IAAAC,qBAAA,GAGRf,KAAK,CAFPgB,eAAe;AAAfA,IAAAA,eAAe,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,qBAAA;AACnBE,IAAAA,IAAI,GAAAC,wBAAA,CACLlB,KAAK,EA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AA;KAC1E;AACF5C,IAAAA,OAAO,EAAE,SAATA,OAAOA,CAAGkG,CAAC,EAAK;AACdrE,MAAAA,cAAc,EAAE,CAAA;AAChB7B,MAAAA,QAAO,aAAPA,QAAO,KAAA,KAAA,CAAA,IAAPA,QAAO,CAAGkG,CAAC,CAAC,CAAA;KACZ;AACFjG,IAAAA,MAAM,EAAE,SAARA,MAAMA,CAAGiG,CAAC,EAAK;AACbjG,MAAAA,OAAM,aAANA,OAAM,KAAA,KAAA,CAAA,IAANA,OAAM,CAAGiG,CAAC,CAAC,CAAA;KACX;AACFxF,IAAAA,UAAU,EAAEA,UAAAA;AAAW,GAAA,CACxB,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAMyG,qBAAqB,gBAAGC,wBAAwB,CAACzH,sBAAsB,EAAE;AAC7E0H,EAAAA,WAAW,EAAEC,oBAAoB,CAACC,QAAQ,CAACJ,qBAAAA;AAC7C,CAAC;;;;"}
|
|
@@ -5,6 +5,9 @@ import { dropdownComponentIds } from './dropdownComponentIds.js';
|
|
|
5
5
|
var SelectActions = {
|
|
6
6
|
Close: 'Close',
|
|
7
7
|
CloseSelect: 'CloseSelect',
|
|
8
|
+
// Expand / Collapse are only acted upon when overlay content is a TreeView (see performAction)
|
|
9
|
+
Expand: 'Expand',
|
|
10
|
+
Collapse: 'Collapse',
|
|
8
11
|
First: 'First',
|
|
9
12
|
Last: 'Last',
|
|
10
13
|
Next: 'Next',
|
|
@@ -73,6 +76,11 @@ function getActionFromKey(e, isOpen, dropdownTriggerer) {
|
|
|
73
76
|
return SelectActions.Next;
|
|
74
77
|
} else if (key === 'ArrowUp') {
|
|
75
78
|
return SelectActions.Previous;
|
|
79
|
+
} else if (key === 'ArrowRight' && !altKey) {
|
|
80
|
+
// acted upon only when overlay content is a TreeView (no-op otherwise, see performAction)
|
|
81
|
+
return SelectActions.Expand;
|
|
82
|
+
} else if (key === 'ArrowLeft' && !altKey) {
|
|
83
|
+
return SelectActions.Collapse;
|
|
76
84
|
} else if (key === 'PageUp') {
|
|
77
85
|
return SelectActions.PageUp;
|
|
78
86
|
} else if (key === 'PageDown') {
|
|
@@ -194,8 +202,16 @@ var performAction = function performAction(action, payload, actions) {
|
|
|
194
202
|
return true;
|
|
195
203
|
case SelectActions.CloseSelect:
|
|
196
204
|
event.preventDefault();
|
|
197
|
-
actions.selectCurrentOption();
|
|
205
|
+
actions.selectCurrentOption(event);
|
|
198
206
|
return true;
|
|
207
|
+
case SelectActions.Expand:
|
|
208
|
+
case SelectActions.Collapse:
|
|
209
|
+
if (actions.onTreeExpandCollapse) {
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
actions.onTreeExpandCollapse(action);
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
return false;
|
|
199
215
|
case SelectActions.Close:
|
|
200
216
|
event.preventDefault();
|
|
201
217
|
actions.close();
|
|
@@ -256,8 +272,18 @@ var makeInputValue = function makeInputValue(selectedIndices, options) {
|
|
|
256
272
|
|
|
257
273
|
/**
|
|
258
274
|
* Value that is displayed inside the select field
|
|
275
|
+
*
|
|
276
|
+
* `displayOverride` is published by TreeView (D5: smallest describing set - a fully
|
|
277
|
+
* selected branch counts as 1). Absent for every other overlay content
|
|
259
278
|
*/
|
|
260
|
-
var makeInputDisplayValue = function makeInputDisplayValue(selectedIndices, options) {
|
|
279
|
+
var makeInputDisplayValue = function makeInputDisplayValue(selectedIndices, options, displayOverride) {
|
|
280
|
+
if (displayOverride && selectedIndices.length > 0) {
|
|
281
|
+
if (displayOverride.count === 1) {
|
|
282
|
+
return displayOverride.label;
|
|
283
|
+
}
|
|
284
|
+
return "".concat(displayOverride.count, " items selected");
|
|
285
|
+
}
|
|
286
|
+
|
|
261
287
|
// When no item is selected or no item is present
|
|
262
288
|
if (options.length === 0 || selectedIndices.length === 0) {
|
|
263
289
|
return '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdownUtils.js","sources":["../../../../../../src/components/Dropdown/dropdownUtils.ts"],"sourcesContent":["/*\n * This content is licensed according to the W3C Software License at\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n *\n * This software or document includes material copied from or derived from\n * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html.\n * Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang)\n */\n\nimport type { DropdownContextType, OptionsType } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { SpacingValueType } from '~components/Box/BaseBox';\n\nexport type SelectActionsType =\n | 'Close'\n | 'CloseSelect'\n | 'First'\n | 'Last'\n | 'Next'\n | 'Open'\n | 'PageDown'\n | 'PageUp'\n | 'Previous'\n | 'Select'\n | 'Type';\n\n// Save a list of named combobox actions, for future readability\nconst SelectActions: Record<SelectActionsType, SelectActionsType> = {\n Close: 'Close',\n CloseSelect: 'CloseSelect',\n First: 'First',\n Last: 'Last',\n Next: 'Next',\n Open: 'Open',\n PageDown: 'PageDown',\n PageUp: 'PageUp',\n Previous: 'Previous',\n Select: 'Select',\n Type: 'Type',\n};\n\n/**\n * Filter an array of options against an input string\n * returns an array of options that begin with the filter string, case-independent\n *\n */\nexport function filterOptions(\n options: string[] = [],\n filter: string,\n exclude: string[] = [],\n): string[] {\n return options.filter((option) => {\n const matches = String(option).toLowerCase().startsWith(filter.toLowerCase());\n return matches && !exclude.includes(option);\n });\n}\n\n/**\n * Map a keypress to action\n */\nexport function getActionFromKey(\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n isOpen: boolean,\n dropdownTriggerer: DropdownContextType['dropdownTriggerer'],\n): SelectActionsType | undefined {\n if (!e) {\n return undefined;\n }\n\n const { altKey, ctrlKey, metaKey } = e;\n let key = '';\n if ('key' in e) {\n key = e.key;\n }\n const openKeys = ['ArrowDown', 'ArrowUp', 'Enter', ' ']; // all keys that will do the default open action\n if (!key) return undefined;\n // handle opening when closed\n if (!isOpen && key && openKeys.includes(key)) {\n return SelectActions.Open;\n }\n\n // home and end move the selected option when open or closed\n if (key === 'Home') {\n return SelectActions.First;\n }\n if (key === 'End') {\n return SelectActions.Last;\n }\n\n // handle typing characters when open or closed\n if (\n key === 'Backspace' ||\n key === 'Clear' ||\n (key.length === 1 && key !== ' ' && !altKey && !ctrlKey && !metaKey)\n ) {\n return SelectActions.Type;\n }\n\n // handle keys when open\n if (isOpen) {\n if (key === 'ArrowUp' && altKey) {\n return SelectActions.CloseSelect;\n } else if (key === 'ArrowDown' && !altKey) {\n return SelectActions.Next;\n } else if (key === 'ArrowUp') {\n return SelectActions.Previous;\n } else if (key === 'PageUp') {\n return SelectActions.PageUp;\n } else if (key === 'PageDown') {\n return SelectActions.PageDown;\n } else if (key === 'Escape') {\n return SelectActions.Close;\n } else if (\n key === 'Enter' ||\n // we ignore the spacebar select in autocomplete since hitting spacebar might be expected while typing\n (dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete &&\n dropdownTriggerer !== dropdownComponentIds.triggers.SearchInput &&\n key === ' ')\n ) {\n return SelectActions.CloseSelect;\n }\n }\n\n return undefined;\n}\n\n/**\n * Return the index of an option from an array of options, based on a search string\n *\n * if the filter is multiple iterations of the same letter (e.g \"aaa\"), then cycle through first-letter matches\n **/\nexport function getIndexByLetter(options: string[], filter: string, startIndex = 0): number {\n const orderedOptions = [...options.slice(startIndex), ...options.slice(0, startIndex)];\n const firstMatch = filterOptions(orderedOptions, filter)[0];\n const allSameLetter = (array: string[]): boolean => array.every((letter) => letter === array[0]);\n\n // first check if there is an exact match for the typed string\n if (firstMatch) {\n return options.indexOf(firstMatch);\n }\n\n // if the same letter is being repeated, cycle through first-letter matches\n else if (allSameLetter(filter.split(''))) {\n const matches = filterOptions(orderedOptions, filter[0]);\n return options.indexOf(matches[0]);\n }\n\n // if no matches, return -1\n else {\n return -1;\n }\n}\n\n/**\n * This functions makes sure the optionsIndex is not going out of possible options\n */\nexport function getUpdatedIndex({\n currentIndex,\n maxIndex,\n actionType,\n}: {\n currentIndex: number;\n maxIndex: number;\n actionType: SelectActionsType;\n}): number {\n // On PageUP or PageDown, we jump focus by 10 items or to the first or last element\n // Details: https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html#:~:text=PageUp,to%20last%20option).\n const pageSize = 10;\n\n switch (actionType) {\n case SelectActions.First:\n return 0;\n case SelectActions.Last:\n return maxIndex;\n case SelectActions.Previous:\n return Math.max(0, currentIndex - 1);\n case SelectActions.Next:\n return Math.min(maxIndex, currentIndex + 1);\n case SelectActions.PageUp:\n return Math.max(0, currentIndex - pageSize);\n case SelectActions.PageDown:\n return Math.min(maxIndex, currentIndex + pageSize);\n default:\n return currentIndex;\n }\n}\n\n/**\n * Checks if the given HTML element is visible on screen\n */\nexport function isElementVisibleOnScreen(element: HTMLElement): boolean {\n const bounding = element.getBoundingClientRect();\n\n return (\n bounding.top >= 0 &&\n bounding.left >= 0 &&\n bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n bounding.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n}\n\n/**\n * Checks if element is visible inside the given container\n */\nfunction isElementVisible(container: HTMLElement, element: HTMLElement): boolean {\n const containerRect = container.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n const isVerticalVisible =\n elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;\n\n return isVerticalVisible;\n}\n\n/**\n * Checks if the dropdown is scrollable\n */\nexport function isScrollable(element: HTMLElement): boolean {\n return element && element.clientHeight < element.scrollHeight;\n}\n\ntype ActionsType = {\n setIsOpen: DropdownContextType['setIsOpen'];\n close: DropdownContextType['close'];\n selectCurrentOption: () => void;\n onOptionChange: (action: SelectActionsType) => void;\n onComboType: (letter: string, action: SelectActionsType) => void;\n};\n/**\n * Performs the action when actionType is passed\n *\n * This function handles all the keydown actions.\n */\nexport const performAction = (\n action: SelectActionsType,\n payload: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n },\n actions: ActionsType,\n): boolean => {\n const { event } = payload;\n\n switch (action) {\n case SelectActions.Last:\n // @ts-expect-error: intentional fallthrough, ignoring the warning\n case SelectActions.First:\n actions.setIsOpen(true);\n // intentional fallthrough\n case SelectActions.Next:\n case SelectActions.Previous:\n case SelectActions.PageUp:\n case SelectActions.PageDown:\n event.preventDefault();\n actions.onOptionChange(action);\n return true;\n case SelectActions.CloseSelect:\n event.preventDefault();\n actions.selectCurrentOption();\n return true;\n case SelectActions.Close:\n event.preventDefault();\n actions.close();\n return true;\n case SelectActions.Type:\n actions.onComboType(event.key, action);\n return true;\n case SelectActions.Open:\n event.preventDefault();\n actions.setIsOpen(true);\n return true;\n\n default:\n break;\n }\n\n return false;\n};\n\n/**\n * When options list is large, it can have a scrollbar.\n *\n * This function ensures the active option is always in the viewport\n */\nexport const ensureScrollVisiblity = (\n newActiveIndex: number,\n containerElement: HTMLElement | null,\n options: string[],\n): void => {\n // ensure the new option is in view\n if (containerElement) {\n if (isScrollable(containerElement)) {\n const optionEl = containerElement.querySelectorAll<HTMLElement>(\n '[role=\"option\"], [role=\"menuitem\"]',\n );\n // Making sure its the same element as the one from options state\n if (\n newActiveIndex >= 0 &&\n optionEl[newActiveIndex].dataset.value === options[newActiveIndex]\n ) {\n const activeElement = optionEl[newActiveIndex];\n\n if (!isElementVisible(containerElement, activeElement)) {\n activeElement.scrollIntoView({ inline: 'nearest' });\n }\n\n if (!isElementVisibleOnScreen(optionEl[newActiveIndex])) {\n activeElement.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n }\n};\n\n/**\n * value that is set in the actual form input\n */\nexport const makeInputValue = (selectedIndices: number[], options: OptionsType): string => {\n if (options.length === 0) {\n return '';\n }\n return selectedIndices.map((selectedIndex) => options[selectedIndex]?.value).join(', ');\n};\n\n/**\n * Value that is displayed inside the select field\n */\nexport const makeInputDisplayValue = (selectedIndices: number[], options: OptionsType): string => {\n // When no item is selected or no item is present\n if (options.length === 0 || selectedIndices.length === 0) {\n return '';\n }\n\n // When one item is selected, we display that item's title in input\n if (selectedIndices.length === 1) {\n return options[selectedIndices[0]]?.title;\n }\n\n // When more than one item is selected, we display the count of items\n return `${selectedIndices.length} items selected`;\n};\n\nexport type DropdownPosition = {\n top?: SpacingValueType;\n bottom?: SpacingValueType;\n left?: SpacingValueType;\n right?: SpacingValueType;\n};\n"],"names":["SelectActions","Close","CloseSelect","First","Last","Next","Open","PageDown","PageUp","Previous","Select","Type","filterOptions","options","arguments","length","undefined","filter","exclude","option","matches","String","toLowerCase","startsWith","includes","getActionFromKey","e","isOpen","dropdownTriggerer","altKey","ctrlKey","metaKey","key","openKeys","dropdownComponentIds","triggers","AutoComplete","SearchInput","getIndexByLetter","startIndex","orderedOptions","concat","_toConsumableArray","slice","firstMatch","allSameLetter","array","every","letter","indexOf","split","getUpdatedIndex","_ref","currentIndex","maxIndex","actionType","pageSize","Math","max","min","isElementVisibleOnScreen","element","bounding","getBoundingClientRect","top","left","bottom","window","innerHeight","document","documentElement","clientHeight","right","innerWidth","clientWidth","isElementVisible","container","containerRect","elementRect","isVerticalVisible","isScrollable","scrollHeight","performAction","action","payload","actions","event","setIsOpen","preventDefault","onOptionChange","selectCurrentOption","close","onComboType","ensureScrollVisiblity","newActiveIndex","containerElement","optionEl","querySelectorAll","dataset","value","activeElement","scrollIntoView","inline","behavior","makeInputValue","selectedIndices","map","selectedIndex","_options$selectedInde","join","makeInputDisplayValue","_options$selectedIndi","title"],"mappings":";;;AA0BA;AACA,IAAMA,aAA2D,GAAG;AAClEC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,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;AACA;AACA;AACO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIL,eAAyB,EAAE5F,OAAoB,EAAa;AAChG;EACA,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,IAAI0F,eAAe,CAAC1F,MAAM,KAAK,CAAC,EAAE;AACxD,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;;AAEA;AACA,EAAA,IAAI0F,eAAe,CAAC1F,MAAM,KAAK,CAAC,EAAE;AAAA,IAAA,IAAAgG,qBAAA,CAAA;AAChC,IAAA,OAAA,CAAAA,qBAAA,GAAOlG,OAAO,CAAC4F,eAAe,CAAC,CAAC,CAAC,CAAC,MAAAM,IAAAA,IAAAA,qBAAA,KAA3BA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAA6BC,KAAK,CAAA;AAC3C,GAAA;;AAEA;AACA,EAAA,OAAA,EAAA,CAAAvE,MAAA,CAAUgE,eAAe,CAAC1F,MAAM,EAAA,iBAAA,CAAA,CAAA;AAClC;;;;"}
|
|
1
|
+
{"version":3,"file":"dropdownUtils.js","sources":["../../../../../../src/components/Dropdown/dropdownUtils.ts"],"sourcesContent":["/*\n * This content is licensed according to the W3C Software License at\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n *\n * This software or document includes material copied from or derived from\n * https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html.\n * Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang)\n */\n\nimport type { DropdownContextType, OptionsType } from './useDropdown';\nimport { dropdownComponentIds } from './dropdownComponentIds';\nimport type { SpacingValueType } from '~components/Box/BaseBox';\n\nexport type SelectActionsType =\n | 'Close'\n | 'CloseSelect'\n | 'Expand'\n | 'Collapse'\n | 'First'\n | 'Last'\n | 'Next'\n | 'Open'\n | 'PageDown'\n | 'PageUp'\n | 'Previous'\n | 'Select'\n | 'Type';\n\n// Save a list of named combobox actions, for future readability\nconst SelectActions: Record<SelectActionsType, SelectActionsType> = {\n Close: 'Close',\n CloseSelect: 'CloseSelect',\n // Expand / Collapse are only acted upon when overlay content is a TreeView (see performAction)\n Expand: 'Expand',\n Collapse: 'Collapse',\n First: 'First',\n Last: 'Last',\n Next: 'Next',\n Open: 'Open',\n PageDown: 'PageDown',\n PageUp: 'PageUp',\n Previous: 'Previous',\n Select: 'Select',\n Type: 'Type',\n};\n\n/**\n * Filter an array of options against an input string\n * returns an array of options that begin with the filter string, case-independent\n *\n */\nexport function filterOptions(\n options: string[] = [],\n filter: string,\n exclude: string[] = [],\n): string[] {\n return options.filter((option) => {\n const matches = String(option).toLowerCase().startsWith(filter.toLowerCase());\n return matches && !exclude.includes(option);\n });\n}\n\n/**\n * Map a keypress to action\n */\nexport function getActionFromKey(\n e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n isOpen: boolean,\n dropdownTriggerer: DropdownContextType['dropdownTriggerer'],\n): SelectActionsType | undefined {\n if (!e) {\n return undefined;\n }\n\n const { altKey, ctrlKey, metaKey } = e;\n let key = '';\n if ('key' in e) {\n key = e.key;\n }\n const openKeys = ['ArrowDown', 'ArrowUp', 'Enter', ' ']; // all keys that will do the default open action\n if (!key) return undefined;\n // handle opening when closed\n if (!isOpen && key && openKeys.includes(key)) {\n return SelectActions.Open;\n }\n\n // home and end move the selected option when open or closed\n if (key === 'Home') {\n return SelectActions.First;\n }\n if (key === 'End') {\n return SelectActions.Last;\n }\n\n // handle typing characters when open or closed\n if (\n key === 'Backspace' ||\n key === 'Clear' ||\n (key.length === 1 && key !== ' ' && !altKey && !ctrlKey && !metaKey)\n ) {\n return SelectActions.Type;\n }\n\n // handle keys when open\n if (isOpen) {\n if (key === 'ArrowUp' && altKey) {\n return SelectActions.CloseSelect;\n } else if (key === 'ArrowDown' && !altKey) {\n return SelectActions.Next;\n } else if (key === 'ArrowUp') {\n return SelectActions.Previous;\n } else if (key === 'ArrowRight' && !altKey) {\n // acted upon only when overlay content is a TreeView (no-op otherwise, see performAction)\n return SelectActions.Expand;\n } else if (key === 'ArrowLeft' && !altKey) {\n return SelectActions.Collapse;\n } else if (key === 'PageUp') {\n return SelectActions.PageUp;\n } else if (key === 'PageDown') {\n return SelectActions.PageDown;\n } else if (key === 'Escape') {\n return SelectActions.Close;\n } else if (\n key === 'Enter' ||\n // we ignore the spacebar select in autocomplete since hitting spacebar might be expected while typing\n (dropdownTriggerer !== dropdownComponentIds.triggers.AutoComplete &&\n dropdownTriggerer !== dropdownComponentIds.triggers.SearchInput &&\n key === ' ')\n ) {\n return SelectActions.CloseSelect;\n }\n }\n\n return undefined;\n}\n\n/**\n * Return the index of an option from an array of options, based on a search string\n *\n * if the filter is multiple iterations of the same letter (e.g \"aaa\"), then cycle through first-letter matches\n **/\nexport function getIndexByLetter(options: string[], filter: string, startIndex = 0): number {\n const orderedOptions = [...options.slice(startIndex), ...options.slice(0, startIndex)];\n const firstMatch = filterOptions(orderedOptions, filter)[0];\n const allSameLetter = (array: string[]): boolean => array.every((letter) => letter === array[0]);\n\n // first check if there is an exact match for the typed string\n if (firstMatch) {\n return options.indexOf(firstMatch);\n }\n\n // if the same letter is being repeated, cycle through first-letter matches\n else if (allSameLetter(filter.split(''))) {\n const matches = filterOptions(orderedOptions, filter[0]);\n return options.indexOf(matches[0]);\n }\n\n // if no matches, return -1\n else {\n return -1;\n }\n}\n\n/**\n * This functions makes sure the optionsIndex is not going out of possible options\n */\nexport function getUpdatedIndex({\n currentIndex,\n maxIndex,\n actionType,\n}: {\n currentIndex: number;\n maxIndex: number;\n actionType: SelectActionsType;\n}): number {\n // On PageUP or PageDown, we jump focus by 10 items or to the first or last element\n // Details: https://www.w3.org/WAI/ARIA/apg/example-index/combobox/combobox-select-only.html#:~:text=PageUp,to%20last%20option).\n const pageSize = 10;\n\n switch (actionType) {\n case SelectActions.First:\n return 0;\n case SelectActions.Last:\n return maxIndex;\n case SelectActions.Previous:\n return Math.max(0, currentIndex - 1);\n case SelectActions.Next:\n return Math.min(maxIndex, currentIndex + 1);\n case SelectActions.PageUp:\n return Math.max(0, currentIndex - pageSize);\n case SelectActions.PageDown:\n return Math.min(maxIndex, currentIndex + pageSize);\n default:\n return currentIndex;\n }\n}\n\n/**\n * Checks if the given HTML element is visible on screen\n */\nexport function isElementVisibleOnScreen(element: HTMLElement): boolean {\n const bounding = element.getBoundingClientRect();\n\n return (\n bounding.top >= 0 &&\n bounding.left >= 0 &&\n bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n bounding.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n}\n\n/**\n * Checks if element is visible inside the given container\n */\nfunction isElementVisible(container: HTMLElement, element: HTMLElement): boolean {\n const containerRect = container.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n const isVerticalVisible =\n elementRect.top >= containerRect.top && elementRect.bottom <= containerRect.bottom;\n\n return isVerticalVisible;\n}\n\n/**\n * Checks if the dropdown is scrollable\n */\nexport function isScrollable(element: HTMLElement): boolean {\n return element && element.clientHeight < element.scrollHeight;\n}\n\ntype ActionsType = {\n setIsOpen: DropdownContextType['setIsOpen'];\n close: DropdownContextType['close'];\n selectCurrentOption: (event?: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>) => void;\n onOptionChange: (action: SelectActionsType) => void;\n onComboType: (letter: string, action: SelectActionsType) => void;\n /**\n * Present only when overlay content is a TreeView. When absent, Expand / Collapse\n * actions are ignored without preventing default (ArrowLeft / ArrowRight keep their\n * existing behaviour for ActionList, AutoComplete, and other content)\n */\n onTreeExpandCollapse?: (action: SelectActionsType) => void;\n};\n/**\n * Performs the action when actionType is passed\n *\n * This function handles all the keydown actions.\n */\nexport const performAction = (\n action: SelectActionsType,\n payload: {\n event: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>;\n },\n actions: ActionsType,\n): boolean => {\n const { event } = payload;\n\n switch (action) {\n case SelectActions.Last:\n // @ts-expect-error: intentional fallthrough, ignoring the warning\n case SelectActions.First:\n actions.setIsOpen(true);\n // intentional fallthrough\n case SelectActions.Next:\n case SelectActions.Previous:\n case SelectActions.PageUp:\n case SelectActions.PageDown:\n event.preventDefault();\n actions.onOptionChange(action);\n return true;\n case SelectActions.CloseSelect:\n event.preventDefault();\n actions.selectCurrentOption(event);\n return true;\n case SelectActions.Expand:\n case SelectActions.Collapse:\n if (actions.onTreeExpandCollapse) {\n event.preventDefault();\n actions.onTreeExpandCollapse(action);\n return true;\n }\n return false;\n case SelectActions.Close:\n event.preventDefault();\n actions.close();\n return true;\n case SelectActions.Type:\n actions.onComboType(event.key, action);\n return true;\n case SelectActions.Open:\n event.preventDefault();\n actions.setIsOpen(true);\n return true;\n\n default:\n break;\n }\n\n return false;\n};\n\n/**\n * When options list is large, it can have a scrollbar.\n *\n * This function ensures the active option is always in the viewport\n */\nexport const ensureScrollVisiblity = (\n newActiveIndex: number,\n containerElement: HTMLElement | null,\n options: string[],\n): void => {\n // ensure the new option is in view\n if (containerElement) {\n if (isScrollable(containerElement)) {\n const optionEl = containerElement.querySelectorAll<HTMLElement>(\n '[role=\"option\"], [role=\"menuitem\"]',\n );\n // Making sure its the same element as the one from options state\n if (\n newActiveIndex >= 0 &&\n optionEl[newActiveIndex].dataset.value === options[newActiveIndex]\n ) {\n const activeElement = optionEl[newActiveIndex];\n\n if (!isElementVisible(containerElement, activeElement)) {\n activeElement.scrollIntoView({ inline: 'nearest' });\n }\n\n if (!isElementVisibleOnScreen(optionEl[newActiveIndex])) {\n activeElement.scrollIntoView({ behavior: 'smooth' });\n }\n }\n }\n }\n};\n\n/**\n * value that is set in the actual form input\n */\nexport const makeInputValue = (selectedIndices: number[], options: OptionsType): string => {\n if (options.length === 0) {\n return '';\n }\n return selectedIndices.map((selectedIndex) => options[selectedIndex]?.value).join(', ');\n};\n\n/**\n * Value that is displayed inside the select field\n *\n * `displayOverride` is published by TreeView (D5: smallest describing set - a fully\n * selected branch counts as 1). Absent for every other overlay content\n */\nexport const makeInputDisplayValue = (\n selectedIndices: number[],\n options: OptionsType,\n displayOverride?: { label: string; count: number },\n): string => {\n if (displayOverride && selectedIndices.length > 0) {\n if (displayOverride.count === 1) {\n return displayOverride.label;\n }\n return `${displayOverride.count} items selected`;\n }\n\n // When no item is selected or no item is present\n if (options.length === 0 || selectedIndices.length === 0) {\n return '';\n }\n\n // When one item is selected, we display that item's title in input\n if (selectedIndices.length === 1) {\n return options[selectedIndices[0]]?.title;\n }\n\n // When more than one item is selected, we display the count of items\n return `${selectedIndices.length} items selected`;\n};\n\nexport type DropdownPosition = {\n top?: SpacingValueType;\n bottom?: SpacingValueType;\n left?: SpacingValueType;\n right?: SpacingValueType;\n};\n"],"names":["SelectActions","Close","CloseSelect","Expand","Collapse","First","Last","Next","Open","PageDown","PageUp","Previous","Select","Type","filterOptions","options","arguments","length","undefined","filter","exclude","option","matches","String","toLowerCase","startsWith","includes","getActionFromKey","e","isOpen","dropdownTriggerer","altKey","ctrlKey","metaKey","key","openKeys","dropdownComponentIds","triggers","AutoComplete","SearchInput","getIndexByLetter","startIndex","orderedOptions","concat","_toConsumableArray","slice","firstMatch","allSameLetter","array","every","letter","indexOf","split","getUpdatedIndex","_ref","currentIndex","maxIndex","actionType","pageSize","Math","max","min","isElementVisibleOnScreen","element","bounding","getBoundingClientRect","top","left","bottom","window","innerHeight","document","documentElement","clientHeight","right","innerWidth","clientWidth","isElementVisible","container","containerRect","elementRect","isVerticalVisible","isScrollable","scrollHeight","performAction","action","payload","actions","event","setIsOpen","preventDefault","onOptionChange","selectCurrentOption","onTreeExpandCollapse","close","onComboType","ensureScrollVisiblity","newActiveIndex","containerElement","optionEl","querySelectorAll","dataset","value","activeElement","scrollIntoView","inline","behavior","makeInputValue","selectedIndices","map","selectedIndex","_options$selectedInde","join","makeInputDisplayValue","displayOverride","count","label","_options$selectedIndi","title"],"mappings":";;;AA4BA;AACA,IAAMA,aAA2D,GAAG;AAClEC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,WAAW,EAAE,aAAa;AAC1B;AACAC,EAAAA,MAAM,EAAE,QAAQ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IAAIpG,OAAO,CAACE,MAAM,KAAK,CAAC,IAAI2F,eAAe,CAAC3F,MAAM,KAAK,CAAC,EAAE;AACxD,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;;AAEA;AACA,EAAA,IAAI2F,eAAe,CAAC3F,MAAM,KAAK,CAAC,EAAE;AAAA,IAAA,IAAAoG,qBAAA,CAAA;AAChC,IAAA,OAAA,CAAAA,qBAAA,GAAOtG,OAAO,CAAC6F,eAAe,CAAC,CAAC,CAAC,CAAC,MAAAS,IAAAA,IAAAA,qBAAA,KAA3BA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,qBAAA,CAA6BC,KAAK,CAAA;AAC3C,GAAA;;AAEA;AACA,EAAA,OAAA,EAAA,CAAA3E,MAAA,CAAUiE,eAAe,CAAC3F,MAAM,EAAA,iBAAA,CAAA,CAAA;AAClC;;;;"}
|
|
@@ -20,10 +20,24 @@ var getFilterChipDisplayValue = function getFilterChipDisplayValue(_ref) {
|
|
|
20
20
|
var value = _ref.value,
|
|
21
21
|
options = _ref.options,
|
|
22
22
|
selectionType = _ref.selectionType,
|
|
23
|
-
uncontrolledInputValue = _ref.uncontrolledInputValue
|
|
23
|
+
uncontrolledInputValue = _ref.uncontrolledInputValue,
|
|
24
|
+
displayOverride = _ref.displayOverride;
|
|
24
25
|
var titleForValue = function titleForValue(selectionValue) {
|
|
25
26
|
return getTitleFromValue(options, selectionValue) || selectionValue;
|
|
26
27
|
};
|
|
28
|
+
if (displayOverride) {
|
|
29
|
+
if (selectionType === 'single') {
|
|
30
|
+
return displayOverride.label;
|
|
31
|
+
}
|
|
32
|
+
// BaseFilterChip renders the single name at length 1 and a Counter of the array
|
|
33
|
+
// length at 2+, so we synthesize an array of the override's count (only the first
|
|
34
|
+
// entry is ever rendered as text)
|
|
35
|
+
return Array.from({
|
|
36
|
+
length: displayOverride.count
|
|
37
|
+
}, function (_, index) {
|
|
38
|
+
return index === 0 ? displayOverride.label : '';
|
|
39
|
+
});
|
|
40
|
+
}
|
|
27
41
|
|
|
28
42
|
// Uncontrolled: derive display value from the internally tracked selection.
|
|
29
43
|
if (value === undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterChipSelectInputUtils.js","sources":["../../../../../../src/components/Dropdown/filterChipSelectInputUtils.ts"],"sourcesContent":["import type { OptionsType } from './useDropdown';\nimport type { BaseFilterChipProps } from '~components/FilterChip/types';\n\n/**\n * Resolves an option's human-readable title from its value. Returns an empty string when the\n * option isn't found so callers can decide on a fallback.\n */\nconst getTitleFromValue = (options: OptionsType, value: string): string => {\n const option = options.find((currentOption) => currentOption.value === value);\n return option ? option.title : '';\n};\n\ntype GetFilterChipDisplayValueParams = {\n /** Controlled value from props (option value or values). `undefined` when uncontrolled. */\n value: BaseFilterChipProps['value'];\n /** All options currently registered in the dropdown. */\n options: OptionsType;\n selectionType: BaseFilterChipProps['selectionType'];\n /** Internally tracked selection used in the uncontrolled case. */\n uncontrolledInputValue: string[];\n};\n\n/**\n * Resolves the value shown inside the filter chip as option title(s).\n *\n * Shared by the web and native `FilterChipSelectInput` implementations to keep the (non-trivial)\n * controlled-vs-uncontrolled / string-vs-array branching in a single source of truth. In every\n * branch we fall back to the raw value when the title can't be resolved (e.g. options loaded or\n * changed after a selection) so the chip never renders an empty string.\n */\nconst getFilterChipDisplayValue = ({\n value,\n options,\n selectionType,\n uncontrolledInputValue,\n}: GetFilterChipDisplayValueParams): string | string[] => {\n const titleForValue = (selectionValue: string): string =>\n getTitleFromValue(options, selectionValue) || selectionValue;\n\n // Uncontrolled: derive display value from the internally tracked selection.\n if (value === undefined) {\n if (selectionType === 'single') {\n return uncontrolledInputValue.length > 0 ? titleForValue(uncontrolledInputValue[0]) : '';\n }\n // For multiple selection, hand the chip the option titles (not the raw values) so it can\n // render the selected option name(s) instead of a bare count.\n return uncontrolledInputValue.map(titleForValue);\n }\n\n // Controlled: consumer passes option value(s); map them to titles for display.\n if (Array.isArray(value)) {\n return value.map(titleForValue);\n }\n return titleForValue(value);\n};\n\nexport { getFilterChipDisplayValue };\n"],"names":["getTitleFromValue","options","value","option","find","currentOption","title","getFilterChipDisplayValue","_ref","selectionType","uncontrolledInputValue","titleForValue","selectionValue","
|
|
1
|
+
{"version":3,"file":"filterChipSelectInputUtils.js","sources":["../../../../../../src/components/Dropdown/filterChipSelectInputUtils.ts"],"sourcesContent":["import type { OptionsType } from './useDropdown';\nimport type { BaseFilterChipProps } from '~components/FilterChip/types';\n\n/**\n * Resolves an option's human-readable title from its value. Returns an empty string when the\n * option isn't found so callers can decide on a fallback.\n */\nconst getTitleFromValue = (options: OptionsType, value: string): string => {\n const option = options.find((currentOption) => currentOption.value === value);\n return option ? option.title : '';\n};\n\ntype GetFilterChipDisplayValueParams = {\n /** Controlled value from props (option value or values). `undefined` when uncontrolled. */\n value: BaseFilterChipProps['value'];\n /** All options currently registered in the dropdown. */\n options: OptionsType;\n selectionType: BaseFilterChipProps['selectionType'];\n /** Internally tracked selection used in the uncontrolled case. */\n uncontrolledInputValue: string[];\n /**\n * Published by TreeView (D5): smallest describing set of the current selection where a\n * fully-selected branch counts as 1. Absent for every other overlay content\n */\n displayOverride?: { label: string; count: number };\n};\n\n/**\n * Resolves the value shown inside the filter chip as option title(s).\n *\n * Shared by the web and native `FilterChipSelectInput` implementations to keep the (non-trivial)\n * controlled-vs-uncontrolled / string-vs-array branching in a single source of truth. In every\n * branch we fall back to the raw value when the title can't be resolved (e.g. options loaded or\n * changed after a selection) so the chip never renders an empty string.\n */\nconst getFilterChipDisplayValue = ({\n value,\n options,\n selectionType,\n uncontrolledInputValue,\n displayOverride,\n}: GetFilterChipDisplayValueParams): string | string[] => {\n const titleForValue = (selectionValue: string): string =>\n getTitleFromValue(options, selectionValue) || selectionValue;\n\n if (displayOverride) {\n if (selectionType === 'single') {\n return displayOverride.label;\n }\n // BaseFilterChip renders the single name at length 1 and a Counter of the array\n // length at 2+, so we synthesize an array of the override's count (only the first\n // entry is ever rendered as text)\n return Array.from({ length: displayOverride.count }, (_, index) =>\n index === 0 ? displayOverride.label : '',\n );\n }\n\n // Uncontrolled: derive display value from the internally tracked selection.\n if (value === undefined) {\n if (selectionType === 'single') {\n return uncontrolledInputValue.length > 0 ? titleForValue(uncontrolledInputValue[0]) : '';\n }\n // For multiple selection, hand the chip the option titles (not the raw values) so it can\n // render the selected option name(s) instead of a bare count.\n return uncontrolledInputValue.map(titleForValue);\n }\n\n // Controlled: consumer passes option value(s); map them to titles for display.\n if (Array.isArray(value)) {\n return value.map(titleForValue);\n }\n return titleForValue(value);\n};\n\nexport { getFilterChipDisplayValue };\n"],"names":["getTitleFromValue","options","value","option","find","currentOption","title","getFilterChipDisplayValue","_ref","selectionType","uncontrolledInputValue","displayOverride","titleForValue","selectionValue","label","Array","from","length","count","_","index","undefined","map","isArray"],"mappings":"AAGA;AACA;AACA;AACA;AACA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,OAAoB,EAAEC,KAAa,EAAa;AACzE,EAAA,IAAMC,MAAM,GAAGF,OAAO,CAACG,IAAI,CAAC,UAACC,aAAa,EAAA;AAAA,IAAA,OAAKA,aAAa,CAACH,KAAK,KAAKA,KAAK,CAAA;GAAC,CAAA,CAAA;AAC7E,EAAA,OAAOC,MAAM,GAAGA,MAAM,CAACG,KAAK,GAAG,EAAE,CAAA;AACnC,CAAC,CAAA;AAiBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA,EAM2B;AAAA,EAAA,IALxDN,KAAK,GAAAM,IAAA,CAALN,KAAK;IACLD,OAAO,GAAAO,IAAA,CAAPP,OAAO;IACPQ,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,eAAe,GAAAH,IAAA,CAAfG,eAAe,CAAA;AAEf,EAAA,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,cAAsB,EAAA;AAAA,IAAA,OAC3Cb,iBAAiB,CAACC,OAAO,EAAEY,cAAc,CAAC,IAAIA,cAAc,CAAA;AAAA,GAAA,CAAA;AAE9D,EAAA,IAAIF,eAAe,EAAE;IACnB,IAAIF,aAAa,KAAK,QAAQ,EAAE;MAC9B,OAAOE,eAAe,CAACG,KAAK,CAAA;AAC9B,KAAA;AACA;AACA;AACA;IACA,OAAOC,KAAK,CAACC,IAAI,CAAC;MAAEC,MAAM,EAAEN,eAAe,CAACO,KAAAA;AAAM,KAAC,EAAE,UAACC,CAAC,EAAEC,KAAK,EAAA;MAAA,OAC5DA,KAAK,KAAK,CAAC,GAAGT,eAAe,CAACG,KAAK,GAAG,EAAE,CAAA;AAAA,KAC1C,CAAC,CAAA;AACH,GAAA;;AAEA;EACA,IAAIZ,KAAK,KAAKmB,SAAS,EAAE;IACvB,IAAIZ,aAAa,KAAK,QAAQ,EAAE;AAC9B,MAAA,OAAOC,sBAAsB,CAACO,MAAM,GAAG,CAAC,GAAGL,aAAa,CAACF,sBAAsB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;AAC1F,KAAA;AACA;AACA;AACA,IAAA,OAAOA,sBAAsB,CAACY,GAAG,CAACV,aAAa,CAAC,CAAA;AAClD,GAAA;;AAEA;AACA,EAAA,IAAIG,KAAK,CAACQ,OAAO,CAACrB,KAAK,CAAC,EAAE;AACxB,IAAA,OAAOA,KAAK,CAACoB,GAAG,CAACV,aAAa,CAAC,CAAA;AACjC,GAAA;EACA,OAAOA,aAAa,CAACV,KAAK,CAAC,CAAA;AAC7B;;;;"}
|
|
@@ -13,9 +13,20 @@ import { isReactNative } from '../../utils/platform/isReactNative.js';
|
|
|
13
13
|
var _excluded = ["isOpen", "setIsOpen", "close", "selectedIndices", "setSelectedIndices", "activeIndex", "setActiveIndex", "activeTagIndex", "setActiveTagIndex", "visibleTagsCountRef", "isKeydownPressed", "setIsKeydownPressed", "options", "selectionType", "changeCallbackTriggerer", "setChangeCallbackTriggerer", "isControlled", "setControlledValueIndices", "filteredValues", "dropdownTriggerer"];
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
17
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
18
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
19
|
|
|
17
20
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
18
21
|
var noop = function noop() {};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Controller published by TreeView when it is rendered as Dropdown overlay content.
|
|
25
|
+
*
|
|
26
|
+
* All tree-specific behaviour inside Dropdown is gated on this being present, so
|
|
27
|
+
* ActionList (and any other overlay content) paths stay behaviourally identical
|
|
28
|
+
*/
|
|
29
|
+
|
|
19
30
|
var DropdownContext = /*#__PURE__*/React__default.createContext({
|
|
20
31
|
isOpen: false,
|
|
21
32
|
setIsOpen: noop,
|
|
@@ -62,6 +73,9 @@ var DropdownContext = /*#__PURE__*/React__default.createContext({
|
|
|
62
73
|
},
|
|
63
74
|
triggererWrapperRef: {
|
|
64
75
|
current: null
|
|
76
|
+
},
|
|
77
|
+
treeViewControllerRef: {
|
|
78
|
+
current: null
|
|
65
79
|
}
|
|
66
80
|
});
|
|
67
81
|
var searchTimeout;
|
|
@@ -73,6 +87,7 @@ var searchString = '';
|
|
|
73
87
|
*
|
|
74
88
|
*/
|
|
75
89
|
var useDropdown = function useDropdown() {
|
|
90
|
+
var _rest$treeViewControl6;
|
|
76
91
|
var _React$useContext = React__default.useContext(DropdownContext),
|
|
77
92
|
isOpen = _React$useContext.isOpen,
|
|
78
93
|
setIsOpen = _React$useContext.setIsOpen,
|
|
@@ -149,6 +164,44 @@ var useDropdown = function useDropdown() {
|
|
|
149
164
|
return isSelected;
|
|
150
165
|
};
|
|
151
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Marks multiple indices as selected / deselected in a single state update and
|
|
169
|
+
* bumps the change callback triggerer exactly once.
|
|
170
|
+
*
|
|
171
|
+
* Used by TreeView for branch cascade toggles (one branch toggle mutates many leaf
|
|
172
|
+
* indices but must fire a single `onChange`). Routes through the same controlled /
|
|
173
|
+
* uncontrolled fork as `selectOption`. ActionList does not use this
|
|
174
|
+
*/
|
|
175
|
+
var selectOptionsBatch = function selectOptionsBatch(indices, action) {
|
|
176
|
+
if (indices.length === 0) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
var updatedIndices;
|
|
180
|
+
if (action === 'select') {
|
|
181
|
+
updatedIndices = _toConsumableArray(selectedIndices);
|
|
182
|
+
var _iterator = _createForOfIteratorHelper(indices),
|
|
183
|
+
_step;
|
|
184
|
+
try {
|
|
185
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
186
|
+
var _index = _step.value;
|
|
187
|
+
if (_index >= 0 && _index <= options.length - 1 && !updatedIndices.includes(_index)) {
|
|
188
|
+
updatedIndices.push(_index);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
} catch (err) {
|
|
192
|
+
_iterator.e(err);
|
|
193
|
+
} finally {
|
|
194
|
+
_iterator.f();
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
updatedIndices = selectedIndices.filter(function (selectedIndex) {
|
|
198
|
+
return !indices.includes(selectedIndex);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
setIndices(updatedIndices);
|
|
202
|
+
setChangeCallbackTriggerer(changeCallbackTriggerer + 1);
|
|
203
|
+
};
|
|
204
|
+
|
|
152
205
|
/**
|
|
153
206
|
* Click listener for combobox (or any triggerer of the dropdown)
|
|
154
207
|
*/
|
|
@@ -164,11 +217,23 @@ var useDropdown = function useDropdown() {
|
|
|
164
217
|
* Function that we call when we want to move focus from one option to other
|
|
165
218
|
*/
|
|
166
219
|
var onOptionChange = function onOptionChange(actionType, index) {
|
|
220
|
+
var _rest$treeViewControl;
|
|
167
221
|
setActiveTagIndex(-1);
|
|
168
222
|
var newIndex = index !== null && index !== void 0 ? index : activeIndex;
|
|
169
223
|
var updatedIndex;
|
|
170
224
|
var hasAutoComplete = rest.hasAutoCompleteInHeader || dropdownTriggerer === dropdownComponentIds.triggers.AutoComplete;
|
|
171
|
-
|
|
225
|
+
var treeViewController = (_rest$treeViewControl = rest.treeViewControllerRef) === null || _rest$treeViewControl === void 0 ? void 0 : _rest$treeViewControl.current;
|
|
226
|
+
if (treeViewController) {
|
|
227
|
+
var _visibleIndexes$getUp;
|
|
228
|
+
// When overlay content is a TreeView, traversal skips rows hidden under collapsed
|
|
229
|
+
// branches (indices stay stable across expand / collapse, only traversal changes)
|
|
230
|
+
var visibleIndexes = treeViewController.getVisibleOptionIndices();
|
|
231
|
+
updatedIndex = (_visibleIndexes$getUp = visibleIndexes[getUpdatedIndex({
|
|
232
|
+
currentIndex: visibleIndexes.indexOf(newIndex),
|
|
233
|
+
maxIndex: visibleIndexes.length - 1,
|
|
234
|
+
actionType: actionType
|
|
235
|
+
})]) !== null && _visibleIndexes$getUp !== void 0 ? _visibleIndexes$getUp : newIndex;
|
|
236
|
+
} else if (hasAutoComplete && filteredValues.length > 0) {
|
|
172
237
|
// When its autocomplete, we don't loop over all options. We only loop on filtered options
|
|
173
238
|
|
|
174
239
|
var filteredIndexes = filteredValues.map(function (filteredValue) {
|
|
@@ -274,23 +339,43 @@ var useDropdown = function useDropdown() {
|
|
|
274
339
|
}
|
|
275
340
|
var actionType = getActionFromKey(e.event, isOpen, dropdownTriggerer);
|
|
276
341
|
if (actionType) {
|
|
342
|
+
var _rest$treeViewControl3;
|
|
277
343
|
performAction(actionType, e, {
|
|
278
344
|
setIsOpen: setIsOpen,
|
|
279
345
|
close: close,
|
|
280
346
|
onOptionChange: onOptionChange,
|
|
281
347
|
onComboType: onComboType,
|
|
282
|
-
selectCurrentOption: function selectCurrentOption() {
|
|
283
|
-
var _options$activeIndex$, _options$activeIndex;
|
|
348
|
+
selectCurrentOption: function selectCurrentOption(event) {
|
|
349
|
+
var _rest$treeViewControl2, _options$activeIndex$, _options$activeIndex;
|
|
284
350
|
if (activeIndex < 0) {
|
|
285
351
|
return;
|
|
286
352
|
}
|
|
353
|
+
|
|
354
|
+
// TreeView handles branch cascade toggles and load-more rows itself
|
|
355
|
+
var treeViewController = (_rest$treeViewControl2 = rest.treeViewControllerRef) === null || _rest$treeViewControl2 === void 0 ? void 0 : _rest$treeViewControl2.current;
|
|
356
|
+
if (treeViewController !== null && treeViewController !== void 0 && treeViewController.handleOptionSelect(activeIndex, {
|
|
357
|
+
key: event === null || event === void 0 ? void 0 : event.key
|
|
358
|
+
})) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
287
361
|
var isSelected = selectOption(activeIndex);
|
|
288
362
|
if (rest.hasFooterAction && !isReactNative()) {
|
|
289
363
|
var _rest$triggererRef$cu2;
|
|
290
364
|
(_rest$triggererRef$cu2 = rest.triggererRef.current) === null || _rest$triggererRef$cu2 === void 0 || _rest$triggererRef$cu2.focus();
|
|
291
365
|
}
|
|
292
366
|
(_options$activeIndex$ = (_options$activeIndex = options[activeIndex]).onClickTrigger) === null || _options$activeIndex$ === void 0 || _options$activeIndex$.call(_options$activeIndex, isSelected);
|
|
293
|
-
}
|
|
367
|
+
},
|
|
368
|
+
// present only when overlay content is a TreeView; undefined keeps
|
|
369
|
+
// ArrowLeft / ArrowRight behaviour unchanged for every other content
|
|
370
|
+
onTreeExpandCollapse: (_rest$treeViewControl3 = rest.treeViewControllerRef) !== null && _rest$treeViewControl3 !== void 0 && _rest$treeViewControl3.current ? function (action) {
|
|
371
|
+
if (action === 'Expand') {
|
|
372
|
+
var _rest$treeViewControl4;
|
|
373
|
+
(_rest$treeViewControl4 = rest.treeViewControllerRef.current) === null || _rest$treeViewControl4 === void 0 || _rest$treeViewControl4.onArrowRightKeydown(activeIndex);
|
|
374
|
+
} else {
|
|
375
|
+
var _rest$treeViewControl5;
|
|
376
|
+
(_rest$treeViewControl5 = rest.treeViewControllerRef.current) === null || _rest$treeViewControl5 === void 0 || _rest$treeViewControl5.onArrowLeftKeydown(activeIndex);
|
|
377
|
+
}
|
|
378
|
+
} : undefined
|
|
294
379
|
});
|
|
295
380
|
}
|
|
296
381
|
};
|
|
@@ -302,6 +387,7 @@ var useDropdown = function useDropdown() {
|
|
|
302
387
|
setSelectedIndices: setSelectedIndices,
|
|
303
388
|
filteredValues: filteredValues,
|
|
304
389
|
removeOption: removeOption,
|
|
390
|
+
selectOptionsBatch: selectOptionsBatch,
|
|
305
391
|
setControlledValueIndices: setControlledValueIndices,
|
|
306
392
|
onTriggerClick: onTriggerClick,
|
|
307
393
|
onTriggerKeydown: onTriggerKeydown,
|
|
@@ -318,7 +404,7 @@ var useDropdown = function useDropdown() {
|
|
|
318
404
|
isControlled: isControlled,
|
|
319
405
|
options: options,
|
|
320
406
|
value: makeInputValue(selectedIndices, options),
|
|
321
|
-
displayValue: makeInputDisplayValue(selectedIndices, options),
|
|
407
|
+
displayValue: makeInputDisplayValue(selectedIndices, options, (_rest$treeViewControl6 = rest.treeViewControllerRef) === null || _rest$treeViewControl6 === void 0 || (_rest$treeViewControl6 = _rest$treeViewControl6.current) === null || _rest$treeViewControl6 === void 0 ? void 0 : _rest$treeViewControl6.getDisplayOverride(selectedIndices)),
|
|
322
408
|
selectionType: selectionType,
|
|
323
409
|
dropdownTriggerer: dropdownTriggerer
|
|
324
410
|
}, rest);
|