@razorpay/blade 12.110.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.
Files changed (444) hide show
  1. package/assets/spark/colorama-center-gradient-map-dark.jpg +0 -0
  2. package/assets/spark/colorama-gradient-map-dark.png +0 -0
  3. package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js +5 -5
  4. package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js.map +1 -1
  5. package/build/lib/native/components/AnimateInteractions/AnimateInteractionsProvider.js +6 -0
  6. package/build/lib/native/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -0
  7. package/build/lib/native/components/BaseMotion/BaseMotion.native.js +22 -0
  8. package/build/lib/native/components/BaseMotion/BaseMotion.native.js.map +1 -0
  9. package/build/lib/native/components/BaseMotion/baseMotionInterpreter.native.js +11 -0
  10. package/build/lib/native/components/BaseMotion/baseMotionInterpreter.native.js.map +1 -0
  11. package/build/lib/native/components/BaseMotion/baseMotionUtils.js +4 -0
  12. package/build/lib/native/components/BaseMotion/baseMotionUtils.js.map +1 -0
  13. package/build/lib/native/components/BaseMotion/index.js +3 -0
  14. package/build/lib/native/components/BaseMotion/index.js.map +1 -0
  15. package/build/lib/native/components/BaseMotion/types.js +2 -0
  16. package/build/lib/native/components/BaseMotion/types.js.map +1 -0
  17. package/build/lib/native/components/Button/BaseButton/BaseButton.js +3 -3
  18. package/build/lib/native/components/Button/BaseButton/BaseButton.js.map +1 -1
  19. package/build/lib/native/components/Button/BaseButton/buttonTokens.js +1 -1
  20. package/build/lib/native/components/Button/BaseButton/buttonTokens.js.map +1 -1
  21. package/build/lib/native/components/Charts/AreaChart/AreaChart.native.js +2 -1
  22. package/build/lib/native/components/Charts/AreaChart/AreaChart.native.js.map +1 -1
  23. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js +2 -2
  24. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js.map +1 -1
  25. package/build/lib/native/components/Charts/CommonChartComponents/index.js +1 -1
  26. package/build/lib/native/components/Charts/CommonChartComponents/tokens.js +2 -2
  27. package/build/lib/native/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  28. package/build/lib/native/components/Charts/LineChart/LineChart.native.js +4 -2
  29. package/build/lib/native/components/Charts/LineChart/LineChart.native.js.map +1 -1
  30. package/build/lib/native/components/Charts/utils/nullBridgeUtils.js +4 -0
  31. package/build/lib/native/components/Charts/utils/nullBridgeUtils.js.map +1 -0
  32. package/build/lib/native/components/Charts/utils/referenceBandUtils.js +6 -0
  33. package/build/lib/native/components/Charts/utils/referenceBandUtils.js.map +1 -0
  34. package/build/lib/native/components/CounterInput/CounterInput.native.js +3 -2
  35. package/build/lib/native/components/CounterInput/CounterInput.native.js.map +1 -1
  36. package/build/lib/native/components/CounterInput/token.js +2 -2
  37. package/build/lib/native/components/CounterInput/token.js.map +1 -1
  38. package/build/lib/native/components/DatePicker/Calendar.native.js +2 -2
  39. package/build/lib/native/components/DatePicker/Calendar.native.js.map +1 -1
  40. package/build/lib/native/components/DatePicker/utils.js +2 -2
  41. package/build/lib/native/components/DatePicker/utils.js.map +1 -1
  42. package/build/lib/native/components/Dropdown/Dropdown.js +1 -1
  43. package/build/lib/native/components/Dropdown/Dropdown.js.map +1 -1
  44. package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js +2 -1
  45. package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js.map +1 -1
  46. package/build/lib/native/components/Dropdown/dropdownUtils.js +1 -1
  47. package/build/lib/native/components/Dropdown/dropdownUtils.js.map +1 -1
  48. package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js +4 -0
  49. package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
  50. package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
  51. package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
  52. package/build/lib/native/components/Fade/Fade.native.js +7 -5
  53. package/build/lib/native/components/Fade/Fade.native.js.map +1 -1
  54. package/build/lib/native/components/FilterChip/BaseFilterChip.native.js +2 -2
  55. package/build/lib/native/components/FilterChip/BaseFilterChip.native.js.map +1 -1
  56. package/build/lib/native/components/FloatingActionButton/FloatingActionButton.js +14 -0
  57. package/build/lib/native/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
  58. package/build/lib/native/components/FloatingActionButton/FloatingActionButtonContainer.native.js +20 -0
  59. package/build/lib/native/components/FloatingActionButton/FloatingActionButtonContainer.native.js.map +1 -0
  60. package/build/lib/native/components/FloatingActionButton/index.js +2 -0
  61. package/build/lib/native/components/FloatingActionButton/index.js.map +1 -0
  62. package/build/lib/native/components/GenUI/GenUIContext.native.js +2 -2
  63. package/build/lib/native/components/GenUI/GenUIContext.native.js.map +1 -1
  64. package/build/lib/native/components/GenUI/index.js +1 -1
  65. package/build/lib/native/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +14 -0
  66. package/build/lib/native/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
  67. package/build/lib/native/components/Icons/BookmarkFilledIcon/index.js +2 -0
  68. package/build/lib/native/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
  69. package/build/lib/native/components/Icons/index.js +1 -0
  70. package/build/lib/native/components/Icons/index.js.map +1 -1
  71. package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +1 -1
  72. package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
  73. package/build/lib/native/components/Input/OTPInput/OTPInput.js +1 -1
  74. package/build/lib/native/components/Input/OTPInput/OTPInput.js.map +1 -1
  75. package/build/lib/native/components/Morph/Morph.native.js +9 -5
  76. package/build/lib/native/components/Morph/Morph.native.js.map +1 -1
  77. package/build/lib/native/components/Move/Move.native.js +8 -5
  78. package/build/lib/native/components/Move/Move.native.js.map +1 -1
  79. package/build/lib/native/components/Scale/Scale.native.js +7 -5
  80. package/build/lib/native/components/Scale/Scale.native.js.map +1 -1
  81. package/build/lib/native/components/SegmentedControl/SegmentedControl.native.js +27 -0
  82. package/build/lib/native/components/SegmentedControl/SegmentedControl.native.js.map +1 -0
  83. package/build/lib/native/components/SegmentedControl/SegmentedControlContext.js +8 -0
  84. package/build/lib/native/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
  85. package/build/lib/native/components/SegmentedControl/SegmentedControlItem.native.js +18 -0
  86. package/build/lib/native/components/SegmentedControl/SegmentedControlItem.native.js.map +1 -0
  87. package/build/lib/native/components/SegmentedControl/index.js +3 -0
  88. package/build/lib/native/components/SegmentedControl/index.js.map +1 -0
  89. package/build/lib/native/components/SegmentedControl/segmentedControlTokens.js +4 -0
  90. package/build/lib/native/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
  91. package/build/lib/native/components/Slide/Slide.native.js +7 -5
  92. package/build/lib/native/components/Slide/Slide.native.js.map +1 -1
  93. package/build/lib/native/components/Spark/RzpGlass/utils.native.js +1 -1
  94. package/build/lib/native/components/Spark/RzpGlass/utils.native.js.map +1 -1
  95. package/build/lib/native/components/Stagger/Stagger.native.js +10 -5
  96. package/build/lib/native/components/Stagger/Stagger.native.js.map +1 -1
  97. package/build/lib/native/components/Stagger/StaggerProvider.js +6 -0
  98. package/build/lib/native/components/Stagger/StaggerProvider.js.map +1 -0
  99. package/build/lib/native/components/TreeView/TreeView.native.js +4 -0
  100. package/build/lib/native/components/TreeView/TreeView.native.js.map +1 -0
  101. package/build/lib/native/components/TreeView/index.native.js +2 -0
  102. package/build/lib/native/components/TreeView/index.native.js.map +1 -0
  103. package/build/lib/native/components/index.js +10 -2
  104. package/build/lib/native/components/index.js.map +1 -1
  105. package/build/lib/native/tokens/global/colors.js +1 -1
  106. package/build/lib/native/tokens/global/colors.js.map +1 -1
  107. package/build/lib/native/tokens/index.js +1 -0
  108. package/build/lib/native/tokens/index.js.map +1 -1
  109. package/build/lib/native/tokens/theme/bladeNeutralTheme.js +15 -0
  110. package/build/lib/native/tokens/theme/bladeNeutralTheme.js.map +1 -0
  111. package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
  112. package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
  113. package/build/lib/native/tokens/theme/index.js +1 -0
  114. package/build/lib/native/tokens/theme/index.js.map +1 -1
  115. package/build/lib/native/tokens/theme/theme.js.map +1 -1
  116. package/build/lib/native/utils/componentZIndices.js +1 -1
  117. package/build/lib/native/utils/componentZIndices.js.map +1 -1
  118. package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
  119. package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
  120. package/build/lib/native/utils/msToSeconds.js +4 -0
  121. package/build/lib/native/utils/msToSeconds.js.map +1 -0
  122. package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js +1 -1
  123. package/build/lib/native/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
  124. package/build/lib/web/development/_virtual/flatten.js +1 -1
  125. package/build/lib/web/development/_virtual/flatten3.js +1 -1
  126. package/build/lib/web/development/components/AnimateInteractions/AnimateInteractions.web.js +1 -1
  127. package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js +2 -1
  128. package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -1
  129. package/build/lib/web/development/components/AnimateInteractions/{useFocusWithin.js → useFocusWithin.web.js} +1 -1
  130. package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.web.js.map +1 -0
  131. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js +124 -73
  132. package/build/lib/web/development/components/Button/BaseButton/BaseButton.js.map +1 -1
  133. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js +68 -2
  134. package/build/lib/web/development/components/Button/BaseButton/buttonTokens.js.map +1 -1
  135. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js +206 -18
  136. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  137. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +159 -43
  138. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  139. package/build/lib/web/development/components/Charts/CommonChartComponents/index.js +1 -1
  140. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +15 -2
  141. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  142. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +272 -15
  143. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -1
  144. package/build/lib/web/development/components/Charts/LineChart/useReferenceBand.js +195 -0
  145. package/build/lib/web/development/components/Charts/LineChart/useReferenceBand.js.map +1 -0
  146. package/build/lib/web/development/components/Charts/utils/nullBridgeUtils.js +175 -0
  147. package/build/lib/web/development/components/Charts/utils/nullBridgeUtils.js.map +1 -0
  148. package/build/lib/web/development/components/Charts/utils/referenceBandUtils.js +66 -0
  149. package/build/lib/web/development/components/Charts/utils/referenceBandUtils.js.map +1 -0
  150. package/build/lib/web/development/components/CounterInput/CounterInput.web.js +29 -5
  151. package/build/lib/web/development/components/CounterInput/CounterInput.web.js.map +1 -1
  152. package/build/lib/web/development/components/CounterInput/StyledCounterInput.js +20 -4
  153. package/build/lib/web/development/components/CounterInput/StyledCounterInput.js.map +1 -1
  154. package/build/lib/web/development/components/CounterInput/token.js +6 -1
  155. package/build/lib/web/development/components/CounterInput/token.js.map +1 -1
  156. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +28 -1
  157. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  158. package/build/lib/web/development/components/DatePicker/Calendar.web.js +9 -2
  159. package/build/lib/web/development/components/DatePicker/Calendar.web.js.map +1 -1
  160. package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +4 -1
  161. package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -1
  162. package/build/lib/web/development/components/DatePicker/utils.js +21 -1
  163. package/build/lib/web/development/components/DatePicker/utils.js.map +1 -1
  164. package/build/lib/web/development/components/Dropdown/Dropdown.js +4 -1
  165. package/build/lib/web/development/components/Dropdown/Dropdown.js.map +1 -1
  166. package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js +40 -5
  167. package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js.map +1 -1
  168. package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js +30 -32
  169. package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
  170. package/build/lib/web/development/components/Dropdown/dropdownUtils.js +28 -2
  171. package/build/lib/web/development/components/Dropdown/dropdownUtils.js.map +1 -1
  172. package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js +60 -0
  173. package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
  174. package/build/lib/web/development/components/Dropdown/useDropdown.js +91 -5
  175. package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
  176. package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +35 -11
  177. package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -1
  178. package/build/lib/web/development/components/FloatingActionButton/FloatingActionButton.js +126 -0
  179. package/build/lib/web/development/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
  180. package/build/lib/web/development/components/FloatingActionButton/FloatingActionButtonContainer.web.js +45 -0
  181. package/build/lib/web/development/components/FloatingActionButton/FloatingActionButtonContainer.web.js.map +1 -0
  182. package/build/lib/web/development/components/FloatingActionButton/index.js +2 -0
  183. package/build/lib/web/development/components/FloatingActionButton/index.js.map +1 -0
  184. package/build/lib/web/development/components/GenUI/GenUIComponents.web.js.map +1 -1
  185. package/build/lib/web/development/components/GenUI/GenUIContext.web.js +9 -1
  186. package/build/lib/web/development/components/GenUI/GenUIContext.web.js.map +1 -1
  187. package/build/lib/web/development/components/GenUI/GenUIProvider.web.js +17 -0
  188. package/build/lib/web/development/components/GenUI/GenUIProvider.web.js.map +1 -1
  189. package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js +31 -6
  190. package/build/lib/web/development/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
  191. package/build/lib/web/development/components/GenUI/index.js +1 -1
  192. package/build/lib/web/development/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +44 -0
  193. package/build/lib/web/development/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
  194. package/build/lib/web/development/components/Icons/BookmarkFilledIcon/index.js +2 -0
  195. package/build/lib/web/development/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
  196. package/build/lib/web/development/components/Icons/index.js +1 -0
  197. package/build/lib/web/development/components/Icons/index.js.map +1 -1
  198. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js +3 -0
  199. package/build/lib/web/development/components/Input/OTPInput/OTPInput.js.map +1 -1
  200. package/build/lib/web/development/components/PopupArrow/PopupArrow.web.js +7 -1
  201. package/build/lib/web/development/components/PopupArrow/PopupArrow.web.js.map +1 -1
  202. package/build/lib/web/development/components/RollingText/RollingText.web.js +27 -20
  203. package/build/lib/web/development/components/RollingText/RollingText.web.js.map +1 -1
  204. package/build/lib/web/development/components/SegmentedControl/SegmentedControl.web.js +196 -0
  205. package/build/lib/web/development/components/SegmentedControl/SegmentedControl.web.js.map +1 -0
  206. package/build/lib/web/development/components/SegmentedControl/SegmentedControlContext.js +18 -0
  207. package/build/lib/web/development/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
  208. package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js +109 -0
  209. package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js.map +1 -0
  210. package/build/lib/web/development/components/SegmentedControl/SegmentedControlItem.web.js +170 -0
  211. package/build/lib/web/development/components/SegmentedControl/SegmentedControlItem.web.js.map +1 -0
  212. package/build/lib/web/development/components/SegmentedControl/index.js +3 -0
  213. package/build/lib/web/development/components/SegmentedControl/index.js.map +1 -0
  214. package/build/lib/web/development/components/SegmentedControl/segmentedControlTokens.js +53 -0
  215. package/build/lib/web/development/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
  216. package/build/lib/web/development/components/Spark/RzpGlass/RzpGlass.js +16 -7
  217. package/build/lib/web/development/components/Spark/RzpGlass/RzpGlass.js.map +1 -1
  218. package/build/lib/web/development/components/Spark/RzpGlass/RzpGlassMount.js +24 -6
  219. package/build/lib/web/development/components/Spark/RzpGlass/RzpGlassMount.js.map +1 -1
  220. package/build/lib/web/development/components/Spark/RzpGlass/presets.js +30 -1
  221. package/build/lib/web/development/components/Spark/RzpGlass/presets.js.map +1 -1
  222. package/build/lib/web/development/components/Spark/RzpGlass/rzpGlassShader.js +1 -1
  223. package/build/lib/web/development/components/Spark/RzpGlass/rzpGlassShader.js.map +1 -1
  224. package/build/lib/web/development/components/Spark/RzpGlass/utils.js +26 -10
  225. package/build/lib/web/development/components/Spark/RzpGlass/utils.js.map +1 -1
  226. package/build/lib/web/development/components/SpotlightPopoverTour/Tour.web.js +31 -18
  227. package/build/lib/web/development/components/SpotlightPopoverTour/Tour.web.js.map +1 -1
  228. package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js +14 -3
  229. package/build/lib/web/development/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
  230. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js +23 -4
  231. package/build/lib/web/development/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  232. package/build/lib/web/development/components/SpotlightPopoverTour/utils.js +58 -1
  233. package/build/lib/web/development/components/SpotlightPopoverTour/utils.js.map +1 -1
  234. package/build/lib/web/development/components/Stagger/StaggerProvider.js.map +1 -1
  235. package/build/lib/web/development/components/TreeView/StyledTreeViewRow.web.js +41 -0
  236. package/build/lib/web/development/components/TreeView/StyledTreeViewRow.web.js.map +1 -0
  237. package/build/lib/web/development/components/TreeView/TreeView.web.js +696 -0
  238. package/build/lib/web/development/components/TreeView/TreeView.web.js.map +1 -0
  239. package/build/lib/web/development/components/TreeView/TreeViewAnimator.web.js +184 -0
  240. package/build/lib/web/development/components/TreeView/TreeViewAnimator.web.js.map +1 -0
  241. package/build/lib/web/development/components/TreeView/TreeViewChevron.web.js +73 -0
  242. package/build/lib/web/development/components/TreeView/TreeViewChevron.web.js.map +1 -0
  243. package/build/lib/web/development/components/TreeView/TreeViewItem.web.js +295 -0
  244. package/build/lib/web/development/components/TreeView/TreeViewItem.web.js.map +1 -0
  245. package/build/lib/web/development/components/TreeView/TreeViewLoadMore.web.js +173 -0
  246. package/build/lib/web/development/components/TreeView/TreeViewLoadMore.web.js.map +1 -0
  247. package/build/lib/web/development/components/TreeView/componentIds.js +8 -0
  248. package/build/lib/web/development/components/TreeView/componentIds.js.map +1 -0
  249. package/build/lib/web/development/components/TreeView/index.web.js +4 -0
  250. package/build/lib/web/development/components/TreeView/index.web.js.map +1 -0
  251. package/build/lib/web/development/components/TreeView/treeViewUtils.js +475 -0
  252. package/build/lib/web/development/components/TreeView/treeViewUtils.js.map +1 -0
  253. package/build/lib/web/development/components/TreeView/useTreeView.js +24 -0
  254. package/build/lib/web/development/components/TreeView/useTreeView.js.map +1 -0
  255. package/build/lib/web/development/components/index.js +12 -2
  256. package/build/lib/web/development/components/index.js.map +1 -1
  257. package/build/lib/web/development/node_modules/es-toolkit/dist/array/flatten.js +1 -1
  258. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/flatten.js +1 -1
  259. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/sortBy.js +2 -2
  260. package/build/lib/web/development/node_modules/es-toolkit/dist/compat/object/omit.js +2 -2
  261. package/build/lib/web/development/tokens/global/colors.js +2 -2
  262. package/build/lib/web/development/tokens/global/colors.js.map +1 -1
  263. package/build/lib/web/development/tokens/index.js +1 -0
  264. package/build/lib/web/development/tokens/index.js.map +1 -1
  265. package/build/lib/web/development/tokens/theme/bladeNeutralTheme.js +1439 -0
  266. package/build/lib/web/development/tokens/theme/bladeNeutralTheme.js.map +1 -0
  267. package/build/lib/web/development/tokens/theme/bladeTheme.js +48 -12
  268. package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
  269. package/build/lib/web/development/tokens/theme/index.js +1 -0
  270. package/build/lib/web/development/tokens/theme/index.js.map +1 -1
  271. package/build/lib/web/development/tokens/theme/theme.js.map +1 -1
  272. package/build/lib/web/development/utils/componentZIndices.js +2 -0
  273. package/build/lib/web/development/utils/componentZIndices.js.map +1 -1
  274. package/build/lib/web/development/utils/metaAttribute/metaConstants.js +7 -1
  275. package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
  276. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js +12 -4
  277. package/build/lib/web/development/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
  278. package/build/lib/web/development/utils/useTruncationTitle/useTruncationTitle.web.js +2 -2
  279. package/build/lib/web/development/utils/useTruncationTitle/useTruncationTitle.web.js.map +1 -1
  280. package/build/lib/web/production/_virtual/flatten.js +1 -1
  281. package/build/lib/web/production/_virtual/flatten3.js +1 -1
  282. package/build/lib/web/production/components/AnimateInteractions/AnimateInteractions.web.js +1 -1
  283. package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js +2 -1
  284. package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -1
  285. package/build/lib/web/production/components/AnimateInteractions/{useFocusWithin.js → useFocusWithin.web.js} +1 -1
  286. package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.web.js.map +1 -0
  287. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js +124 -73
  288. package/build/lib/web/production/components/Button/BaseButton/BaseButton.js.map +1 -1
  289. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js +68 -2
  290. package/build/lib/web/production/components/Button/BaseButton/buttonTokens.js.map +1 -1
  291. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js +206 -18
  292. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  293. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +159 -43
  294. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  295. package/build/lib/web/production/components/Charts/CommonChartComponents/index.js +1 -1
  296. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +15 -2
  297. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  298. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +272 -15
  299. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -1
  300. package/build/lib/web/production/components/Charts/LineChart/useReferenceBand.js +195 -0
  301. package/build/lib/web/production/components/Charts/LineChart/useReferenceBand.js.map +1 -0
  302. package/build/lib/web/production/components/Charts/utils/nullBridgeUtils.js +175 -0
  303. package/build/lib/web/production/components/Charts/utils/nullBridgeUtils.js.map +1 -0
  304. package/build/lib/web/production/components/Charts/utils/referenceBandUtils.js +66 -0
  305. package/build/lib/web/production/components/Charts/utils/referenceBandUtils.js.map +1 -0
  306. package/build/lib/web/production/components/CounterInput/CounterInput.web.js +29 -5
  307. package/build/lib/web/production/components/CounterInput/CounterInput.web.js.map +1 -1
  308. package/build/lib/web/production/components/CounterInput/StyledCounterInput.js +20 -4
  309. package/build/lib/web/production/components/CounterInput/StyledCounterInput.js.map +1 -1
  310. package/build/lib/web/production/components/CounterInput/token.js +6 -1
  311. package/build/lib/web/production/components/CounterInput/token.js.map +1 -1
  312. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +28 -1
  313. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  314. package/build/lib/web/production/components/DatePicker/Calendar.web.js +9 -2
  315. package/build/lib/web/production/components/DatePicker/Calendar.web.js.map +1 -1
  316. package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +4 -1
  317. package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -1
  318. package/build/lib/web/production/components/DatePicker/utils.js +21 -1
  319. package/build/lib/web/production/components/DatePicker/utils.js.map +1 -1
  320. package/build/lib/web/production/components/Dropdown/Dropdown.js +4 -1
  321. package/build/lib/web/production/components/Dropdown/Dropdown.js.map +1 -1
  322. package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js +40 -5
  323. package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js.map +1 -1
  324. package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js +30 -32
  325. package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
  326. package/build/lib/web/production/components/Dropdown/dropdownUtils.js +28 -2
  327. package/build/lib/web/production/components/Dropdown/dropdownUtils.js.map +1 -1
  328. package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js +60 -0
  329. package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
  330. package/build/lib/web/production/components/Dropdown/useDropdown.js +91 -5
  331. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  332. package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +35 -11
  333. package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -1
  334. package/build/lib/web/production/components/FloatingActionButton/FloatingActionButton.js +126 -0
  335. package/build/lib/web/production/components/FloatingActionButton/FloatingActionButton.js.map +1 -0
  336. package/build/lib/web/production/components/FloatingActionButton/FloatingActionButtonContainer.web.js +45 -0
  337. package/build/lib/web/production/components/FloatingActionButton/FloatingActionButtonContainer.web.js.map +1 -0
  338. package/build/lib/web/production/components/FloatingActionButton/index.js +2 -0
  339. package/build/lib/web/production/components/FloatingActionButton/index.js.map +1 -0
  340. package/build/lib/web/production/components/GenUI/GenUIComponents.web.js.map +1 -1
  341. package/build/lib/web/production/components/GenUI/GenUIContext.web.js +9 -1
  342. package/build/lib/web/production/components/GenUI/GenUIContext.web.js.map +1 -1
  343. package/build/lib/web/production/components/GenUI/GenUIProvider.web.js +17 -0
  344. package/build/lib/web/production/components/GenUI/GenUIProvider.web.js.map +1 -1
  345. package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js +31 -6
  346. package/build/lib/web/production/components/GenUI/GenUISchemaRenderer.web.js.map +1 -1
  347. package/build/lib/web/production/components/GenUI/index.js +1 -1
  348. package/build/lib/web/production/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js +44 -0
  349. package/build/lib/web/production/components/Icons/BookmarkFilledIcon/BookmarkFilledIcon.js.map +1 -0
  350. package/build/lib/web/production/components/Icons/BookmarkFilledIcon/index.js +2 -0
  351. package/build/lib/web/production/components/Icons/BookmarkFilledIcon/index.js.map +1 -0
  352. package/build/lib/web/production/components/Icons/index.js +1 -0
  353. package/build/lib/web/production/components/Icons/index.js.map +1 -1
  354. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js +3 -0
  355. package/build/lib/web/production/components/Input/OTPInput/OTPInput.js.map +1 -1
  356. package/build/lib/web/production/components/PopupArrow/PopupArrow.web.js +7 -1
  357. package/build/lib/web/production/components/PopupArrow/PopupArrow.web.js.map +1 -1
  358. package/build/lib/web/production/components/RollingText/RollingText.web.js +27 -20
  359. package/build/lib/web/production/components/RollingText/RollingText.web.js.map +1 -1
  360. package/build/lib/web/production/components/SegmentedControl/SegmentedControl.web.js +196 -0
  361. package/build/lib/web/production/components/SegmentedControl/SegmentedControl.web.js.map +1 -0
  362. package/build/lib/web/production/components/SegmentedControl/SegmentedControlContext.js +18 -0
  363. package/build/lib/web/production/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
  364. package/build/lib/web/production/components/SegmentedControl/SegmentedControlIndicator.web.js +109 -0
  365. package/build/lib/web/production/components/SegmentedControl/SegmentedControlIndicator.web.js.map +1 -0
  366. package/build/lib/web/production/components/SegmentedControl/SegmentedControlItem.web.js +170 -0
  367. package/build/lib/web/production/components/SegmentedControl/SegmentedControlItem.web.js.map +1 -0
  368. package/build/lib/web/production/components/SegmentedControl/index.js +3 -0
  369. package/build/lib/web/production/components/SegmentedControl/index.js.map +1 -0
  370. package/build/lib/web/production/components/SegmentedControl/segmentedControlTokens.js +53 -0
  371. package/build/lib/web/production/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
  372. package/build/lib/web/production/components/Spark/RzpGlass/RzpGlass.js +16 -7
  373. package/build/lib/web/production/components/Spark/RzpGlass/RzpGlass.js.map +1 -1
  374. package/build/lib/web/production/components/Spark/RzpGlass/RzpGlassMount.js +24 -6
  375. package/build/lib/web/production/components/Spark/RzpGlass/RzpGlassMount.js.map +1 -1
  376. package/build/lib/web/production/components/Spark/RzpGlass/presets.js +30 -1
  377. package/build/lib/web/production/components/Spark/RzpGlass/presets.js.map +1 -1
  378. package/build/lib/web/production/components/Spark/RzpGlass/rzpGlassShader.js +1 -1
  379. package/build/lib/web/production/components/Spark/RzpGlass/rzpGlassShader.js.map +1 -1
  380. package/build/lib/web/production/components/Spark/RzpGlass/utils.js +26 -10
  381. package/build/lib/web/production/components/Spark/RzpGlass/utils.js.map +1 -1
  382. package/build/lib/web/production/components/SpotlightPopoverTour/Tour.web.js +31 -18
  383. package/build/lib/web/production/components/SpotlightPopoverTour/Tour.web.js.map +1 -1
  384. package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js +14 -3
  385. package/build/lib/web/production/components/SpotlightPopoverTour/TourMask.web.js.map +1 -1
  386. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js +23 -4
  387. package/build/lib/web/production/components/SpotlightPopoverTour/TourPopover.web.js.map +1 -1
  388. package/build/lib/web/production/components/SpotlightPopoverTour/utils.js +58 -1
  389. package/build/lib/web/production/components/SpotlightPopoverTour/utils.js.map +1 -1
  390. package/build/lib/web/production/components/Stagger/StaggerProvider.js.map +1 -1
  391. package/build/lib/web/production/components/TreeView/StyledTreeViewRow.web.js +41 -0
  392. package/build/lib/web/production/components/TreeView/StyledTreeViewRow.web.js.map +1 -0
  393. package/build/lib/web/production/components/TreeView/TreeView.web.js +696 -0
  394. package/build/lib/web/production/components/TreeView/TreeView.web.js.map +1 -0
  395. package/build/lib/web/production/components/TreeView/TreeViewAnimator.web.js +184 -0
  396. package/build/lib/web/production/components/TreeView/TreeViewAnimator.web.js.map +1 -0
  397. package/build/lib/web/production/components/TreeView/TreeViewChevron.web.js +73 -0
  398. package/build/lib/web/production/components/TreeView/TreeViewChevron.web.js.map +1 -0
  399. package/build/lib/web/production/components/TreeView/TreeViewItem.web.js +295 -0
  400. package/build/lib/web/production/components/TreeView/TreeViewItem.web.js.map +1 -0
  401. package/build/lib/web/production/components/TreeView/TreeViewLoadMore.web.js +173 -0
  402. package/build/lib/web/production/components/TreeView/TreeViewLoadMore.web.js.map +1 -0
  403. package/build/lib/web/production/components/TreeView/componentIds.js +8 -0
  404. package/build/lib/web/production/components/TreeView/componentIds.js.map +1 -0
  405. package/build/lib/web/production/components/TreeView/index.web.js +4 -0
  406. package/build/lib/web/production/components/TreeView/index.web.js.map +1 -0
  407. package/build/lib/web/production/components/TreeView/treeViewUtils.js +475 -0
  408. package/build/lib/web/production/components/TreeView/treeViewUtils.js.map +1 -0
  409. package/build/lib/web/production/components/TreeView/useTreeView.js +24 -0
  410. package/build/lib/web/production/components/TreeView/useTreeView.js.map +1 -0
  411. package/build/lib/web/production/components/index.js +12 -2
  412. package/build/lib/web/production/components/index.js.map +1 -1
  413. package/build/lib/web/production/node_modules/es-toolkit/dist/array/flatten.js +1 -1
  414. package/build/lib/web/production/node_modules/es-toolkit/dist/compat/array/flatten.js +1 -1
  415. package/build/lib/web/production/node_modules/es-toolkit/dist/compat/array/sortBy.js +2 -2
  416. package/build/lib/web/production/node_modules/es-toolkit/dist/compat/object/omit.js +2 -2
  417. package/build/lib/web/production/tokens/global/colors.js +2 -2
  418. package/build/lib/web/production/tokens/global/colors.js.map +1 -1
  419. package/build/lib/web/production/tokens/index.js +1 -0
  420. package/build/lib/web/production/tokens/index.js.map +1 -1
  421. package/build/lib/web/production/tokens/theme/bladeNeutralTheme.js +1439 -0
  422. package/build/lib/web/production/tokens/theme/bladeNeutralTheme.js.map +1 -0
  423. package/build/lib/web/production/tokens/theme/bladeTheme.js +48 -12
  424. package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
  425. package/build/lib/web/production/tokens/theme/index.js +1 -0
  426. package/build/lib/web/production/tokens/theme/index.js.map +1 -1
  427. package/build/lib/web/production/tokens/theme/theme.js.map +1 -1
  428. package/build/lib/web/production/utils/componentZIndices.js +2 -0
  429. package/build/lib/web/production/utils/componentZIndices.js.map +1 -1
  430. package/build/lib/web/production/utils/metaAttribute/metaConstants.js +7 -1
  431. package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
  432. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js +12 -4
  433. package/build/lib/web/production/utils/useControlledDropdownInput/useControlledDropdownInput.js.map +1 -1
  434. package/build/lib/web/production/utils/useTruncationTitle/useTruncationTitle.web.js +2 -2
  435. package/build/lib/web/production/utils/useTruncationTitle/useTruncationTitle.web.js.map +1 -1
  436. package/build/types/components/index.d.ts +794 -25
  437. package/build/types/components/index.native.d.ts +872 -29
  438. package/build/types/tokens/index.d.ts +11 -4
  439. package/build/types/tokens/index.native.d.ts +11 -4
  440. package/build/types/utils/index.d.ts +8 -3
  441. package/build/types/utils/index.native.d.ts +8 -3
  442. package/package.json +2 -2
  443. package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.js.map +0 -1
  444. package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.js.map +0 -1
@@ -15,7 +15,7 @@ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
15
15
  import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
16
16
  import Link from '../Link/Link/Link.js';
17
17
 
18
- var _excluded = ["testID", "children", "showClearButton", "onClearButtonClick"];
18
+ var _excluded = ["testID", "children", "showClearButton", "onClearButtonClick", "onResetButtonClick", "clearButtonText", "resetButtonText"];
19
19
  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; }
20
20
  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; }
21
21
  var FilterChipGroup = function FilterChipGroup(_ref) {
@@ -24,6 +24,9 @@ var FilterChipGroup = function FilterChipGroup(_ref) {
24
24
  _ref$showClearButton = _ref.showClearButton,
25
25
  showClearButton = _ref$showClearButton === void 0 ? true : _ref$showClearButton,
26
26
  onClearButtonClick = _ref.onClearButtonClick,
27
+ onResetButtonClick = _ref.onResetButtonClick,
28
+ clearButtonText = _ref.clearButtonText,
29
+ resetButtonText = _ref.resetButtonText,
27
30
  rest = _objectWithoutProperties(_ref, _excluded);
28
31
  var _useState = useState([]),
29
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -36,14 +39,41 @@ var FilterChipGroup = function FilterChipGroup(_ref) {
36
39
  var _useListViewFilterCon = useListViewFilterContext(),
37
40
  selectedFiltersCount = _useListViewFilterCon.selectedFiltersCount,
38
41
  setListViewSelectedFilters = _useListViewFilterCon.setListViewSelectedFilters;
39
- var handleClearButtonClick = function handleClearButtonClick() {
40
- onClearButtonClick === null || onClearButtonClick === void 0 || onClearButtonClick();
42
+
43
+ // Shared bookkeeping reset: both actions clear the group's "has changes" tracking so the action
44
+ // link(s) hide after use (a lingering action with nothing to revert is confusing). They reappear
45
+ // on the next filter change.
46
+ var clearGroupBookkeeping = function clearGroupBookkeeping() {
41
47
  setListViewSelectedFilters({});
42
48
  setFilterChipGroupSelectedFilters([]);
49
+ };
50
+
51
+ // "Clear" empties every filter. Bumping the triggerer makes each child chip run its clear effect
52
+ // (fires onChange([]) and drops its selection).
53
+ var handleClearButtonClick = function handleClearButtonClick() {
54
+ onClearButtonClick === null || onClearButtonClick === void 0 || onClearButtonClick();
55
+ clearGroupBookkeeping();
43
56
  setClearFilterCallbackTriggerer(function (prev) {
44
57
  return prev + 1;
45
58
  });
46
59
  };
60
+
61
+ // "Reset" only fires the consumer callback and clears the group's bookkeeping. We intentionally
62
+ // do NOT bump the clear triggerer, so child chips keep their internal state and do not fire
63
+ // onChange([]) — the consumer restores each filter's default inside onResetButtonClick and those
64
+ // values are not stomped.
65
+ // TODO (FilterChip reset — Phase 2): support restoring defaults for UNCONTROLLED filters. That
66
+ // needs a `defaultValue` on FilterChipSelectInput and a reset path that restores it instead of
67
+ // emptying. See packages/blade/src/components/Dropdown/_decisions/filter-chip-reset.md
68
+ var handleResetButtonClick = function handleResetButtonClick() {
69
+ onResetButtonClick === null || onResetButtonClick === void 0 || onResetButtonClick();
70
+ clearGroupBookkeeping();
71
+ };
72
+ var hasSelectedFilters = filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0;
73
+ var selectedCount = Math.max(filterChipGroupSelectedFilters.length, selectedFiltersCount);
74
+ var isPlural = selectedCount > 1;
75
+ var clearActionText = clearButtonText !== null && clearButtonText !== void 0 ? clearButtonText : "Clear Filter".concat(isPlural ? 's' : '');
76
+ var resetActionText = resetButtonText !== null && resetButtonText !== void 0 ? resetButtonText : 'Reset';
47
77
  return /*#__PURE__*/jsx(FilterChipGroupProvider, {
48
78
  value: {
49
79
  filterChipGroupSelectedFilters: filterChipGroupSelectedFilters,
@@ -62,11 +92,16 @@ var FilterChipGroup = function FilterChipGroup(_ref) {
62
92
  width: "100%",
63
93
  gap: "spacing.3",
64
94
  flexWrap: "wrap",
65
- children: [children, showClearButton && (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? /*#__PURE__*/jsx(Link, {
95
+ children: [children, hasSelectedFilters && onResetButtonClick ? /*#__PURE__*/jsx(Link, {
96
+ size: "small",
97
+ color: "neutral",
98
+ onClick: handleResetButtonClick,
99
+ children: resetActionText
100
+ }) : null, hasSelectedFilters && showClearButton ? /*#__PURE__*/jsx(Link, {
66
101
  size: "small",
67
102
  color: "neutral",
68
103
  onClick: handleClearButtonClick,
69
- children: "Clear Filter".concat(filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : '')
104
+ children: clearActionText
70
105
  }) : null]
71
106
  }))
72
107
  });
@@ -1 +1 @@
1
- {"version":3,"file":"FilterChipGroup.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipGroup.web.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useListViewFilterContext } from '../ListView/ListViewFiltersContext.web';\nimport type { FilterChipGroupProps } from './types';\nimport { FilterChipGroupProvider } from './FilterChipGroupContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Link } from '~components/Link';\n\nconst FilterChipGroup = ({\n testID,\n children,\n showClearButton = true,\n onClearButtonClick,\n ...rest\n}: FilterChipGroupProps): React.ReactElement => {\n const [filterChipGroupSelectedFilters, setFilterChipGroupSelectedFilters] = useState<string[]>(\n [],\n );\n const [clearFilterCallbackTriggerer, setClearFilterCallbackTriggerer] = useState<number>(0);\n const { selectedFiltersCount, setListViewSelectedFilters } = useListViewFilterContext();\n const handleClearButtonClick = (): void => {\n onClearButtonClick?.();\n setListViewSelectedFilters({});\n setFilterChipGroupSelectedFilters([]);\n setClearFilterCallbackTriggerer((prev) => prev + 1);\n };\n return (\n <FilterChipGroupProvider\n value={{\n filterChipGroupSelectedFilters,\n setFilterChipGroupSelectedFilters,\n clearFilterCallbackTriggerer,\n setClearFilterCallbackTriggerer,\n }}\n >\n <BaseBox\n {...metaAttribute({ name: MetaConstants.FilterChipGroup, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n padding={['spacing.4', 'spacing.1']}\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n width=\"100%\"\n gap=\"spacing.3\"\n flexWrap=\"wrap\"\n >\n {children}\n {showClearButton &&\n (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? (\n <Link size=\"small\" color=\"neutral\" onClick={handleClearButtonClick}>{`Clear Filter${\n filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : ''\n }`}</Link>\n ) : null}\n </BaseBox>\n </FilterChipGroupProvider>\n );\n};\n\nexport { FilterChipGroup };\n"],"names":["FilterChipGroup","_ref","testID","children","_ref$showClearButton","showClearButton","onClearButtonClick","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","filterChipGroupSelectedFilters","setFilterChipGroupSelectedFilters","_useState3","_useState4","clearFilterCallbackTriggerer","setClearFilterCallbackTriggerer","_useListViewFilterCon","useListViewFilterContext","selectedFiltersCount","setListViewSelectedFilters","handleClearButtonClick","prev","_jsx","FilterChipGroupProvider","value","_jsxs","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","makeAnalyticsAttribute","display","padding","alignItems","justifyContent","width","gap","flexWrap","length","Link","size","color","onClick","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAM2B;AAAA,EAAA,IAL9CC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oBAAA,GAAAH,IAAA,CACRI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,oBAAA;IACtBE,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;AACfC,IAAAA,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,SAAA,GAA4EC,QAAQ,CACl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AAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;MAAEC,IAAI,EAAEC,aAAa,CAAClC,eAAe;AAAEE,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA,EAC9DiC,sBAAsB,CAAC5B,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC6B,MAAAA,OAAO,EAAC,MAAM;AACdC,MAAAA,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAE;AACpCC,MAAAA,UAAU,EAAC,QAAQ;AACnBC,MAAAA,cAAc,EAAC,YAAY;AAC3BC,MAAAA,KAAK,EAAC,MAAM;AACZC,MAAAA,GAAG,EAAC,WAAW;AACfC,MAAAA,QAAQ,EAAC,MAAM;AAAAvC,MAAAA,QAAA,GAEdA,QAAQ,EACRE,eAAe,KACfS,8BAA8B,CAAC6B,MAAM,GAAG,CAAC,IAAIrB,oBAAoB,GAAG,CAAC,CAAC,gBACrEI,GAAA,CAACkB,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,OAAO;AAACC,QAAAA,KAAK,EAAC,SAAS;AAACC,QAAAA,OAAO,EAAEvB,sBAAuB;AAAArB,QAAAA,QAAA,EAAA6C,cAAAA,CAAAA,MAAA,CACjElC,8BAA8B,CAAC6B,MAAM,GAAG,CAAC,IAAIrB,oBAAoB,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;OACzE,CAAC,GACR,IAAI,CAAA;KACD,CAAA,CAAA;AAAC,GACa,CAAC,CAAA;AAE9B;;;;"}
1
+ {"version":3,"file":"FilterChipGroup.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipGroup.web.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useListViewFilterContext } from '../ListView/ListViewFiltersContext.web';\nimport type { FilterChipGroupProps } from './types';\nimport { FilterChipGroupProvider } from './FilterChipGroupContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Link } from '~components/Link';\n\nconst FilterChipGroup = ({\n testID,\n children,\n showClearButton = true,\n onClearButtonClick,\n onResetButtonClick,\n clearButtonText,\n resetButtonText,\n ...rest\n}: FilterChipGroupProps): React.ReactElement => {\n const [filterChipGroupSelectedFilters, setFilterChipGroupSelectedFilters] = useState<string[]>(\n [],\n );\n const [clearFilterCallbackTriggerer, setClearFilterCallbackTriggerer] = useState<number>(0);\n const { selectedFiltersCount, setListViewSelectedFilters } = useListViewFilterContext();\n\n // Shared bookkeeping reset: both actions clear the group's \"has changes\" tracking so the action\n // link(s) hide after use (a lingering action with nothing to revert is confusing). They reappear\n // on the next filter change.\n const clearGroupBookkeeping = (): void => {\n setListViewSelectedFilters({});\n setFilterChipGroupSelectedFilters([]);\n };\n\n // \"Clear\" empties every filter. Bumping the triggerer makes each child chip run its clear effect\n // (fires onChange([]) and drops its selection).\n const handleClearButtonClick = (): void => {\n onClearButtonClick?.();\n clearGroupBookkeeping();\n setClearFilterCallbackTriggerer((prev) => prev + 1);\n };\n\n // \"Reset\" only fires the consumer callback and clears the group's bookkeeping. We intentionally\n // do NOT bump the clear triggerer, so child chips keep their internal state and do not fire\n // onChange([]) — the consumer restores each filter's default inside onResetButtonClick and those\n // values are not stomped.\n // TODO (FilterChip reset — Phase 2): support restoring defaults for UNCONTROLLED filters. That\n // needs a `defaultValue` on FilterChipSelectInput and a reset path that restores it instead of\n // emptying. See packages/blade/src/components/Dropdown/_decisions/filter-chip-reset.md\n const handleResetButtonClick = (): void => {\n onResetButtonClick?.();\n clearGroupBookkeeping();\n };\n\n const hasSelectedFilters = filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0;\n const selectedCount = Math.max(filterChipGroupSelectedFilters.length, selectedFiltersCount);\n const isPlural = selectedCount > 1;\n const clearActionText = clearButtonText ?? `Clear Filter${isPlural ? 's' : ''}`;\n const resetActionText = resetButtonText ?? 'Reset';\n return (\n <FilterChipGroupProvider\n value={{\n filterChipGroupSelectedFilters,\n setFilterChipGroupSelectedFilters,\n clearFilterCallbackTriggerer,\n setClearFilterCallbackTriggerer,\n }}\n >\n <BaseBox\n {...metaAttribute({ name: MetaConstants.FilterChipGroup, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n padding={['spacing.4', 'spacing.1']}\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n width=\"100%\"\n gap=\"spacing.3\"\n flexWrap=\"wrap\"\n >\n {children}\n {hasSelectedFilters && onResetButtonClick ? (\n <Link size=\"small\" color=\"neutral\" onClick={handleResetButtonClick}>\n {resetActionText}\n </Link>\n ) : null}\n {hasSelectedFilters && showClearButton ? (\n <Link size=\"small\" color=\"neutral\" onClick={handleClearButtonClick}>\n {clearActionText}\n </Link>\n ) : null}\n </BaseBox>\n </FilterChipGroupProvider>\n );\n};\n\nexport { FilterChipGroup };\n"],"names":["FilterChipGroup","_ref","testID","children","_ref$showClearButton","showClearButton","onClearButtonClick","onResetButtonClick","clearButtonText","resetButtonText","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","filterChipGroupSelectedFilters","setFilterChipGroupSelectedFilters","_useState3","_useState4","clearFilterCallbackTriggerer","setClearFilterCallbackTriggerer","_useListViewFilterCon","useListViewFilterContext","selectedFiltersCount","setListViewSelectedFilters","clearGroupBookkeeping","handleClearButtonClick","prev","handleResetButtonClick","hasSelectedFilters","length","selectedCount","Math","max","isPlural","clearActionText","concat","resetActionText","_jsx","FilterChipGroupProvider","value","_jsxs","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","makeAnalyticsAttribute","display","padding","alignItems","justifyContent","width","gap","flexWrap","Link","size","color","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAS2B;AAAA,EAAA,IAR9CC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oB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AAA;KACA;AAAAnB,IAAAA,QAAA,eAEFwC,IAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAAA,aAAA,CACFC,EAAAA,EAAAA,aAAa,CAAC;MAAEC,IAAI,EAAEC,aAAa,CAAChD,eAAe;AAAEE,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA,EAC9D+C,sBAAsB,CAACvC,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChCwC,MAAAA,OAAO,EAAC,MAAM;AACdC,MAAAA,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAE;AACpCC,MAAAA,UAAU,EAAC,QAAQ;AACnBC,MAAAA,cAAc,EAAC,YAAY;AAC3BC,MAAAA,KAAK,EAAC,MAAM;AACZC,MAAAA,GAAG,EAAC,WAAW;AACfC,MAAAA,QAAQ,EAAC,MAAM;MAAArD,QAAA,EAAA,CAEdA,QAAQ,EACR4B,kBAAkB,IAAIxB,kBAAkB,gBACvCiC,GAAA,CAACiB,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,OAAO;AAACC,QAAAA,KAAK,EAAC,SAAS;AAACC,QAAAA,OAAO,EAAE9B,sBAAuB;AAAA3B,QAAAA,QAAA,EAChEoC,eAAAA;OACG,CAAC,GACL,IAAI,EACPR,kBAAkB,IAAI1B,eAAe,gBACpCmC,GAAA,CAACiB,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAC,OAAO;AAACC,QAAAA,KAAK,EAAC,SAAS;AAACC,QAAAA,OAAO,EAAEhC,sBAAuB;AAAAzB,QAAAA,QAAA,EAChEkC,eAAAA;OACG,CAAC,GACL,IAAI,CAAA;KACD,CAAA,CAAA;AAAC,GACa,CAAC,CAAA;AAE9B;;;;"}
@@ -6,6 +6,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
6
6
  import React__default, { useEffect } from 'react';
7
7
  import { useDropdown } from './useDropdown.js';
8
8
  import { dropdownComponentIds } from './dropdownComponentIds.js';
9
+ import { getFilterChipDisplayValue } from './filterChipSelectInputUtils.js';
9
10
  import { useFilterChipGroupContext } from './FilterChipGroupContext.web.js';
10
11
  import '../../utils/assignWithoutSideEffects/index.js';
11
12
  import { BaseFilterChip } from '../FilterChip/BaseFilterChip.web.js';
@@ -16,13 +17,13 @@ import { useFirstRender } from '../../utils/useFirstRender.js';
16
17
  import { jsx } from 'react/jsx-runtime';
17
18
  import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
18
19
 
19
- var _excluded = ["onClick", "onBlur", "onKeyDown", "accessibilityLabel", "testID", "value", "onClearButtonClick", "label", "onChange", "name", "isDisabled"];
20
+ var _excluded = ["onClick", "onBlur", "onKeyDown", "accessibilityLabel", "testID", "value", "onClearButtonClick", "label", "onChange", "name", "isDisabled", "showClearButton"];
20
21
  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; }
21
22
  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; }
22
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
23
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); }
24
25
  var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
25
- var _options$find$title, _options$find;
26
+ var _treeViewControllerRe2;
26
27
  var idBase = useId('filter-chip-select-input');
27
28
  var _onClick = props.onClick,
28
29
  _onBlur = props.onBlur,
@@ -35,6 +36,8 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
35
36
  onChange = props.onChange,
36
37
  name = props.name,
37
38
  isDisabled = props.isDisabled,
39
+ _props$showClearButto = props.showClearButton,
40
+ showClearButton = _props$showClearButto === void 0 ? true : _props$showClearButto,
38
41
  rest = _objectWithoutProperties(props, _excluded);
39
42
  var _React$useState = React__default.useState([]),
40
43
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -55,10 +58,8 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
55
58
  isControlled = _useDropdown.isControlled,
56
59
  setSelectedIndices = _useDropdown.setSelectedIndices,
57
60
  controlledValueIndices = _useDropdown.controlledValueIndices,
58
- changeCallbackTriggerer = _useDropdown.changeCallbackTriggerer;
59
- var valueTitle = (_options$find$title = (_options$find = options.find(function (option) {
60
- return option.value === value;
61
- })) === null || _options$find === void 0 ? void 0 : _options$find.title) !== null && _options$find$title !== void 0 ? _options$find$title : value;
61
+ changeCallbackTriggerer = _useDropdown.changeCallbackTriggerer,
62
+ treeViewControllerRef = _useDropdown.treeViewControllerRef;
62
63
  var isUnControlled = options.length > 0 && props.value === undefined;
63
64
  // Currently we are having 2 context for selectedFilters. One is for FilterChipGroup and other is for ListView
64
65
  var _useListViewFilterCon = useListViewFilterContext(),
@@ -108,34 +109,20 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
108
109
  } else if (listViewSelectedFilters[label]) {
109
110
  var _savedIndices = listViewSelectedFilters[label];
110
111
  setSelectedIndices(_savedIndices);
111
- // Sync selected indices when controlled value changes or on first render with options loaded
112
- } else if (valueNotEmpty && !isValueAndSelectedIndicesSynced && options.length > 0) {
113
- var newSelectedIndices = typeof value === 'string' ? [options.findIndex(function (option) {
114
- return option.value === value;
115
- })] : options.map(function (option, index) {
116
- return value.includes(option.value) ? index : -1;
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;
117
119
  }).filter(function (index) {
118
120
  return index !== -1;
119
121
  });
120
122
  setSelectedIndices(newSelectedIndices);
121
123
  }
122
124
  // eslint-disable-next-line react-hooks/exhaustive-deps
123
- }, [isUnControlled, options]);
124
- var getTitleFromValue = function getTitleFromValue(value) {
125
- var option = options.find(function (option) {
126
- return option.value === value;
127
- });
128
- return option ? option.title : '';
129
- };
130
- var getUnControlledFilterChipValue = function getUnControlledFilterChipValue() {
131
- if (selectionType === 'single') {
132
- if (uncontrolledInputValue.length > 0) {
133
- return getTitleFromValue(uncontrolledInputValue[0]);
134
- }
135
- return '';
136
- }
137
- return uncontrolledInputValue;
138
- };
125
+ }, [isUnControlled, options, value]);
139
126
  var handleClearButtonClick = function handleClearButtonClick() {
140
127
  var _props$onClearButtonC, _props$onChange;
141
128
  (_props$onClearButtonC = props.onClearButtonClick) === null || _props$onClearButtonC === void 0 || _props$onClearButtonC.call(props, {
@@ -167,11 +154,15 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
167
154
  }, [clearFilterCallbackTriggerer]);
168
155
  useEffect(function () {
169
156
  if (!isFirstRender) {
170
- var _props$onChange2;
171
- (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, {
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({
172
161
  name: props.name || idBase,
173
162
  values: getValuesArrayFromIndices()
174
- });
163
+ }, selectedGroups ? {
164
+ selectedGroups: selectedGroups
165
+ } : {}));
175
166
  if (isUnControlled) {
176
167
  setUncontrolledInputValue(getValuesArrayFromIndices());
177
168
  }
@@ -218,8 +209,15 @@ var _FilterChipSelectInput = function _FilterChipSelectInput(props) {
218
209
  };
219
210
  return /*#__PURE__*/jsx(BaseFilterChip, _objectSpread(_objectSpread({
220
211
  label: label,
221
- value: valueTitle !== null && valueTitle !== void 0 ? valueTitle : getUnControlledFilterChipValue(),
212
+ value: getFilterChipDisplayValue({
213
+ value: props.value,
214
+ options: options,
215
+ selectionType: selectionType,
216
+ uncontrolledInputValue: uncontrolledInputValue,
217
+ displayOverride: (_treeViewControllerRe2 = treeViewControllerRef.current) === null || _treeViewControllerRe2 === void 0 ? void 0 : _treeViewControllerRe2.getDisplayOverride(selectedIndices)
218
+ }),
222
219
  onClearButtonClick: handleClearButtonClick,
220
+ showClearButton: showClearButton,
223
221
  selectionType: selectionType
224
222
  }, rest), {}, {
225
223
  ref: triggererRef,
@@ -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 { 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' | 'value' | 'label' | 'testID' | 'onClick' | 'selectionType' | 'onBlur'\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 ...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 valueTitle = options.find((option) => option.value === value)?.title ?? value;\n\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 getTitleFromValue = (value: string): string => {\n const option = options.find((option) => option.value === value);\n return option ? option.title : '';\n };\n\n const getUnControlledFilterChipValue = (): string | string[] => {\n if (selectionType === 'single') {\n if (uncontrolledInputValue.length > 0) {\n return getTitleFromValue(uncontrolledInputValue[0]);\n }\n return '';\n }\n return uncontrolledInputValue;\n };\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={valueTitle ?? getUnControlledFilterChipValue()}\n onClearButtonClick={handleClearButtonClick}\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","_options$find$title","_options$find","idBase","useId","onClick","onBlur","onKeyDown","accessibilityLabel","testID","value","onClearButtonClick","label","onChange","name","isDisabled","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","valueTitle","find","option","title","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","index","filter","getTitleFromValue","getUnControlledFilterChipValue","handleClearButtonClick","_props$onClearButtonC","_props$onChange","call","values","_","updatedFilters","_toPropertyKey","_props$onChange2","isValueEmpty","_objectSpread","_defineProperty","handleKeyDown","e","event","key","preventDefault","stopPropagation","_jsx","BaseFilterChip","ref","accessibilityProps","hasPopup","getActionListContainerRole","expanded","controls","activeD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ACZ;AACF/F,IAAAA,MAAM,EAAE,SAARA,MAAMA,CAAG+F,CAAC,EAAK;AACb/F,MAAAA,OAAM,aAANA,OAAM,KAAA,KAAA,CAAA,IAANA,OAAM,CAAG+F,CAAC,CAAC,CAAA;KACX;AACFtF,IAAAA,UAAU,EAAEA,UAAAA;AAAW,GAAA,CACxB,CAAC,CAAA;AAEN,CAAC,CAAA;AAED,IAAMoG,qBAAqB,gBAAGC,wBAAwB,CAACrH,sBAAsB,EAAE;AAC7EsH,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":";;;;;;;;;;;;;;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,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"],"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,CAAC,EAAE;AACxB,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;AACA,EAAA,OAAO0F,eAAe,CAACC,GAAG,CAAC,UAACC,aAAa,EAAA;AAAA,IAAA,IAAAC,qBAAA,CAAA;IAAA,OAAAA,CAAAA,qBAAA,GAAK/F,OAAO,CAAC8F,aAAa,CAAC,MAAA,IAAA,IAAAC,qBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAtBA,qBAAA,CAAwBT,KAAK,CAAA;AAAA,GAAA,CAAC,CAACU,IAAI,CAAC,IAAI,CAAC,CAAA;AACzF,EAAC;;AAED;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;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,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,IAAI,EAAE,MAAA;AACR,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,GAIjB;AAAA,EAAA,IAHVC,OAAiB,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;EAAA,IACtBG,MAAc,GAAAH,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA,CAAA;AAAA,EAAA,IACdE,OAAiB,GAAAJ,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAEtB,EAAA,OAAOD,OAAO,CAACI,MAAM,CAAC,UAACE,MAA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AAqB,GAAG,SAAxBA,qBAAqBA,CAChCL,eAAyB,EACzB7F,OAAoB,EACpBmG,eAAkD,EACvC;AACX,EAAA,IAAIA,eAAe,IAAIN,eAAe,CAAC3F,MAAM,GAAG,CAAC,EAAE;AACjD,IAAA,IAAIiG,eAAe,CAACC,KAAK,KAAK,CAAC,EAAE;MAC/B,OAAOD,eAAe,CAACE,KAAK,CAAA;AAC9B,KAAA;AACA,IAAA,OAAA,EAAA,CAAAzE,MAAA,CAAUuE,eAAe,CAACC,KAAK,EAAA,iBAAA,CAAA,CAAA;AACjC,GAAA;;AAEA;EACA,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;;;;"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Resolves an option's human-readable title from its value. Returns an empty string when the
3
+ * option isn't found so callers can decide on a fallback.
4
+ */
5
+ var getTitleFromValue = function getTitleFromValue(options, value) {
6
+ var option = options.find(function (currentOption) {
7
+ return currentOption.value === value;
8
+ });
9
+ return option ? option.title : '';
10
+ };
11
+ /**
12
+ * Resolves the value shown inside the filter chip as option title(s).
13
+ *
14
+ * Shared by the web and native `FilterChipSelectInput` implementations to keep the (non-trivial)
15
+ * controlled-vs-uncontrolled / string-vs-array branching in a single source of truth. In every
16
+ * branch we fall back to the raw value when the title can't be resolved (e.g. options loaded or
17
+ * changed after a selection) so the chip never renders an empty string.
18
+ */
19
+ var getFilterChipDisplayValue = function getFilterChipDisplayValue(_ref) {
20
+ var value = _ref.value,
21
+ options = _ref.options,
22
+ selectionType = _ref.selectionType,
23
+ uncontrolledInputValue = _ref.uncontrolledInputValue,
24
+ displayOverride = _ref.displayOverride;
25
+ var titleForValue = function titleForValue(selectionValue) {
26
+ return getTitleFromValue(options, selectionValue) || selectionValue;
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
+ }
41
+
42
+ // Uncontrolled: derive display value from the internally tracked selection.
43
+ if (value === undefined) {
44
+ if (selectionType === 'single') {
45
+ return uncontrolledInputValue.length > 0 ? titleForValue(uncontrolledInputValue[0]) : '';
46
+ }
47
+ // For multiple selection, hand the chip the option titles (not the raw values) so it can
48
+ // render the selected option name(s) instead of a bare count.
49
+ return uncontrolledInputValue.map(titleForValue);
50
+ }
51
+
52
+ // Controlled: consumer passes option value(s); map them to titles for display.
53
+ if (Array.isArray(value)) {
54
+ return value.map(titleForValue);
55
+ }
56
+ return titleForValue(value);
57
+ };
58
+
59
+ export { getFilterChipDisplayValue };
60
+ //# sourceMappingURL=filterChipSelectInputUtils.js.map
@@ -0,0 +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 * 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,UAAC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