@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
@@ -1 +1 @@
1
- {"version":3,"file":"OTPInput.js","sources":["../../../../../../../src/components/Input/OTPInput/OTPInput.tsx"],"sourcesContent":["import React, { useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype OTPInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n labelSuffix,\n labelTrailing,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...rest\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n if (otpValue[currentOtpIndex]) {\n // Clear the value at the current index if value exists\n handleOnChange({ value: '', currentOtpIndex });\n } else {\n // Move focus to the previous input if the current input is empty\n // and clear the value at the new active (previous) index\n focusOnOtpByIndex(--currentOtpIndex);\n handleOnChange({ value: '', currentOtpIndex });\n }\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n {...makeAnalyticsAttribute(rest)}\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.OTPInput, testID })} {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel\n as=\"label\"\n position={labelPosition}\n htmlFor={inputId}\n size={size}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n >\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","labelSuffix","labelTrailing","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","focus","_inputRefs$index2","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","_objectSpread","concat","hideLabelText","textAlign","maxCharacters","formEvent","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","makeAnalyticsAttribute","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyHA,IAAMA,aAAa,GAAGC,eAAe,EAAE,KAAK,cAAc,CAAA;;AAE1D;AACA;AACA;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAa,EAAA;AAAA,EAAA,IAAAC,WAAA,CAAA;EAAA,OAAAA,CAAAA,WAAA,GAAeD,IAAI,KAAJA,IAAAA,IAAAA,IAAI,uBAAJA,IAAI,CAAEE,KAAK,CAAC,EAAE,CA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useEffect, useImperativeHandle, useState } from 'react';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getHintType } from '../BaseInput/BaseInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { FormInputOnEvent } from '~components/Form';\nimport { FormHint, FormLabel } from '~components/Form';\nimport { useFormId } from '~components/Form/useFormId';\nimport type { FormInputOnKeyDownEvent } from '~components/Form/FormTypes';\nimport BaseBox from '~components/Box/BaseBox';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { getPlatformType } from '~utils';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeSize } from '~utils/makeSize';\nimport type { DataAnalyticsAttribute } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype FormInputOnEventWithIndex = ({\n name,\n value,\n inputIndex,\n}: {\n name?: string;\n value?: string;\n inputIndex: number;\n}) => void;\n\nexport type OTPInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'name'\n | 'onChange'\n | 'value'\n | 'isDisabled'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'keyboardType'\n | 'placeholder'\n | 'testID'\n | 'size'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Determines the number of input fields to show for the OTP\n * @default 6\n */\n otpLength?: 4 | 6;\n /**\n * The callback function to be invoked when all the values of the OTPInput are filled\n */\n onOTPFilled?: FormInputOnEvent;\n /**\n * Masks input characters in all the fields\n */\n isMasked?: boolean;\n /**\n * Determines what autoComplete suggestion type to show. Defaults to `oneTimeCode`.\n *\n * It's not recommended to turn this off in favor of otp input practices.\n *\n *\n * Internally it'll render platform specific attributes:\n *\n * - web: `autocomplete`\n * - iOS: `textContentType`\n * - android: `autoComplete`\n *\n */\n autoCompleteSuggestionType?: Extract<\n BaseInputProps['autoCompleteSuggestionType'],\n 'none' | 'oneTimeCode'\n >;\n /**\n * The callback function to be invoked when one of the input fields gets focus\n */\n onFocus?: FormInputOnEventWithIndex;\n /**\n * The callback function to be invoked when one of the input fields is blurred\n */\n onBlur?: FormInputOnEventWithIndex;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype OTPInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype OTPInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype OTPInputProps = (OTPInputPropsWithA11yLabel | OTPInputPropsWithLabel) & OTPInputCommonProps;\n\nconst isReactNative = getPlatformType() === 'react-native';\n\n/**\n * Converts a string value of otp to array if passed otherwise returns an array of 6 empty strings\n */\nconst otpToArray = (code?: string): string[] => code?.split('') ?? Array(6).fill('');\n\n/**\n * OTPInput component can be used for accepting OTPs sent to users for authentication/verification purposes.\n *\n * ## Usage\n *\n * ```tsx\n * <OTPInput\n * label=\"Enter OTP\"\n * name=\"otpInput\"\n * onChange={({ name, value }): void => console.log({ name, value })}\n * onOTPFilled={({ name, value }): void => console.log({ name, value })}\n * />\n * ```\n */\nconst _OTPInput: React.ForwardRefRenderFunction<HTMLInputElement[], OTPInputProps> = (\n {\n autoFocus,\n errorText,\n helpText,\n isDisabled,\n keyboardReturnKeyType,\n keyboardType = 'decimal',\n label,\n accessibilityLabel,\n labelPosition,\n labelSuffix,\n labelTrailing,\n name,\n onChange,\n onFocus,\n onBlur,\n onOTPFilled,\n otpLength = 6,\n placeholder,\n successText,\n validationState,\n value: inputValue,\n isMasked,\n autoCompleteSuggestionType = 'oneTimeCode',\n testID,\n size = 'medium',\n ...rest\n },\n incomingRef,\n) => {\n const inputRefs: React.RefObject<HTMLInputElement>[] = [];\n const [otpValue, setOtpValue] = useState<string[]>(otpToArray(inputValue));\n const [inputType, setInputType] = useState<('password' | undefined)[]>([]);\n const isLabelLeftPositioned = labelPosition === 'left';\n const { inputId, helpTextId, errorTextId, successTextId } = useFormId('otp');\n\n useImperativeHandle(\n incomingRef,\n () => {\n return inputRefs.map((ref) => ref.current!);\n },\n [inputRefs],\n );\n\n useEffect(() => {\n // Effect for calling `onOTPFilled` callback\n if (inputValue && inputValue.length >= otpLength) {\n // callback for when the OTPInput is controlled and inputValue reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: inputValue.slice(0, otpLength), name });\n } else if (!inputValue && otpValue.join('').length >= otpLength) {\n // callback for when the OTPInput is uncontrolled and otpValue stored in state reaches the same or greater length as the otpLength\n onOTPFilled?.({ value: otpValue.slice(0, otpLength).join(''), name });\n }\n }, [otpValue, otpLength, name, inputValue, onOTPFilled]);\n\n useEffect(() => {\n /* We want to disable the password managers for OTPInput when isMasked is set.\n The issue with only setting autocomplete='off' is that its not an enforcement but a suggestion to the browser to follow.\n This workaround unsets type on first render and sets it to `password` only once a value is entered by the user.\n */\n otpValue.forEach((otp, index) => {\n // Set inputType as 'password' only when a value is entered when isMasked is set\n if (!isEmpty(otp) && !inputType[index] && isMasked) {\n const newInputType = Array.from(inputType);\n newInputType[index] = 'password';\n setInputType(newInputType);\n }\n // Cleanup the inputType array whenever the value is empty but inputType[index] is set\n if (isEmpty(otp) && inputType[index]) {\n const newInputType = Array.from(inputType);\n newInputType[index] = undefined;\n setInputType(newInputType);\n }\n });\n }, [otpValue, inputType, isMasked]);\n\n /**\n * Changes the value of the otp at a given index and updates the otpValue stored in state\n *\n * @param {{ value: string; index: number }} { value, index }\n * @returns {string} updated otpValue\n */\n const setOtpValueByIndex = ({ value, index }: { value: string; index: number }): string => {\n const newOtpValue = Array.from(otpValue);\n newOtpValue[index] = value;\n setOtpValue(newOtpValue);\n return newOtpValue.join('');\n };\n\n /**\n * Sets focus to the desired otp input by index\n *\n * @param {number} index the index of the otp input to be focused\n */\n const focusOnOtpByIndex = (index: number): void => {\n inputRefs[index]?.current?.focus();\n if (!isReactNative) {\n // React Native doesn't support imperatively selecting the value of input\n inputRefs[index]?.current?.select();\n }\n };\n\n const handleOnChange = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n if (value && value === ' ') {\n // React native doesn't support `event.preventDefault()` hence have to add this check to ensure that empty space is not allowed\n return;\n }\n if (inputValue && inputValue.length > 0) {\n // When OTPInput is controlled, set the otpValue as the consumer passed `inputValue` and append the value on current index based on user's input.\n // User's input will not reflect on the otp but will trigger `onChange` callback with the user's input appended so that the consumer can take appropriate action.\n const newOtpValue = Array.from(inputValue);\n newOtpValue[currentOtpIndex] = value ?? '';\n setOtpValue(newOtpValue);\n onChange?.({ name, value: newOtpValue.join('') });\n } else if (value && value.trim().length > 1) {\n // When the entered value is more that 1 character (when value is pasted), set the otpValue to the newly received value.\n // Could have used `onPaste` for web to achieve this but 1. React Native doesn't support onPaste and 2. Safari's autofill on web doesn't trigger onPaste\n setOtpValue(Array.from(value));\n onChange?.({ name, value: value.trim().slice(0, otpLength) });\n // Move focus to the last filled input box after paste\n const lastFilledIndex = Math.min(value.trim().length, otpLength) - 1;\n focusOnOtpByIndex(lastFilledIndex);\n } else if (otpValue[currentOtpIndex] !== value?.trim()) {\n // Set the value at the current index to the entered value\n // only as long as its not the same as the already existing value (this prevents `onChange` being triggered unnecessarily)\n const newValue = setOtpValueByIndex({\n value: value?.trim() ?? '',\n index: currentOtpIndex,\n });\n onChange?.({ name, value: newValue });\n }\n };\n\n const handleOnInput = ({\n value,\n currentOtpIndex,\n }: {\n value?: string;\n currentOtpIndex: number;\n }): void => {\n // Moves focus to next input whenever a value is entered in the current input\n if (value && value.trim().length === 1) {\n focusOnOtpByIndex(++currentOtpIndex);\n }\n };\n\n const handleOnKeyDown = ({\n key,\n code,\n event,\n currentOtpIndex,\n }: FormInputOnKeyDownEvent & { currentOtpIndex: number }): void => {\n if (key === 'Backspace' || code === 'Backspace' || code === 'Delete' || key === 'Delete') {\n event.preventDefault?.();\n if (otpValue[currentOtpIndex]) {\n // Clear the value at the current index if value exists\n handleOnChange({ value: '', currentOtpIndex });\n } else {\n // Move focus to the previous input if the current input is empty\n // and clear the value at the new active (previous) index\n focusOnOtpByIndex(--currentOtpIndex);\n handleOnChange({ value: '', currentOtpIndex });\n }\n } else if (key === 'ArrowLeft' || code === 'ArrowLeft') {\n event.preventDefault?.();\n focusOnOtpByIndex(--currentOtpIndex);\n } else if (key === 'ArrowRight' || code === 'ArrowRight') {\n event.preventDefault?.();\n focusOnOtpByIndex(++currentOtpIndex);\n } else if (key === ' ' || code === 'Space') {\n event.preventDefault?.();\n }\n };\n\n const getHiddenInput = (): React.ReactNode => {\n if (!isReactNative) {\n return (\n <input\n hidden={true}\n id={inputId}\n name={name}\n value={inputValue ?? otpValue.join('') ?? ''}\n readOnly\n />\n );\n }\n return null;\n };\n\n const getOTPInputFields = (): React.ReactNode => {\n const inputs = [];\n for (let index = 0; index < otpLength; index++) {\n const currentValue = inputValue ? otpToArray(inputValue)[index] || '' : otpValue[index] || '';\n const ref = React.createRef<HTMLInputElement>();\n // if an inputValue is passed (controlled) and isMasked is set, inputType will always be password\n let currentInputType: 'password' | undefined;\n if (isMasked) {\n // if inputValue is passed (controlled component) then the inputType will always be password\n currentInputType = inputValue ? 'password' : inputType[index];\n }\n inputRefs.push(ref);\n inputs.push(\n <BaseBox\n flex={1}\n marginLeft={index == 0 ? 'spacing.0' : 'spacing.3'}\n key={`${inputId}-${index}`}\n >\n <BaseInput\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus && index === 0}\n accessibilityLabel={`${index === 0 ? label || accessibilityLabel : ''} character ${\n index + 1\n }`}\n label={label}\n hideLabelText={true}\n id={`${inputId}-${index}`}\n textAlign=\"center\"\n ref={ref as never}\n name={name}\n value={currentValue}\n maxCharacters={otpValue[index]?.length > 0 ? 1 : undefined}\n onChange={(formEvent) => handleOnChange({ ...formEvent, currentOtpIndex: index })}\n onFocus={(formEvent) => onFocus?.({ ...formEvent, inputIndex: index })}\n onBlur={(formEvent) => onBlur?.({ ...formEvent, inputIndex: index })}\n onInput={(formEvent) => handleOnInput({ ...formEvent, currentOtpIndex: index })}\n onKeyDown={(keyboardEvent) =>\n handleOnKeyDown({ ...keyboardEvent, currentOtpIndex: index })\n }\n isDisabled={isDisabled}\n placeholder={Array.from(placeholder ?? '')[index] ?? ''}\n isRequired={true}\n autoCompleteSuggestionType={autoCompleteSuggestionType}\n keyboardType={keyboardType}\n keyboardReturnKeyType={keyboardReturnKeyType}\n validationState={validationState}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n hideFormHint={true}\n type={currentInputType}\n size={size}\n valueComponentType=\"heading\"\n {...makeAnalyticsAttribute(rest)}\n />\n </BaseBox>,\n );\n }\n return inputs;\n };\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.OTPInput, testID })} {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n position=\"relative\"\n >\n {Boolean(label) && (\n <FormLabel\n as=\"label\"\n position={labelPosition}\n htmlFor={inputId}\n size={size}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n >\n {label}\n </FormLabel>\n )}\n <BaseBox display=\"flex\" flexDirection=\"row\">\n {getHiddenInput()}\n {getOTPInputFields()}\n </BaseBox>\n </BaseBox>\n {/* the magic number 136 is basically max-width of label i.e 120 and then right margin i.e 16 which is the spacing between label and input field */}\n {/*Refer `BaseInput`'s implementation of FormHint which uses similar logic */}\n <BaseBox marginLeft={makeSize(isLabelLeftPositioned ? 136 : 0)}>\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n successText={successText}\n helpTextId={helpTextId}\n errorTextId={errorTextId}\n successTextId={successTextId}\n size={size}\n />\n </BaseBox>\n </BaseBox>\n );\n};\n\nconst OTPInput = React.forwardRef<HTMLInputElement[], OTPInputProps>(_OTPInput);\n\nexport type { OTPInputProps };\nexport { OTPInput };\n"],"names":["isReactNative","getPlatformType","otpToArray","code","_code$split","split","Array","fill","_OTPInput","_ref","incomingRef","autoFocus","errorText","helpText","isDisabled","keyboardReturnKeyType","_ref$keyboardType","keyboardType","label","accessibilityLabel","labelPosition","labelSuffix","labelTrailing","name","onChange","onFocus","onBlur","onOTPFilled","_ref$otpLength","otpLength","placeholder","successText","validationState","inputValue","value","isMasked","_ref$autoCompleteSugg","autoCompleteSuggestionType","testID","_ref$size","size","rest","_objectWithoutProperties","_excluded","inputRefs","_useState","useState","_useState2","_slicedToArray","otpValue","setOtpValue","_useState3","_useState4","inputType","setInputType","isLabelLeftPositioned","_useFormId","useFormId","inputId","helpTextId","errorTextId","successTextId","useImperativeHandle","map","ref","current","useEffect","length","slice","join","forEach","otp","index","isEmpty","newInputType","from","undefined","setOtpValueByIndex","_ref2","newOtpValue","focusOnOtpByIndex","_inputRefs$index","focus","_inputRefs$index2","select","handleOnChange","_ref3","currentOtpIndex","trim","lastFilledIndex","Math","min","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","_event$preventDefault","preventDefault","call","_event$preventDefault2","_event$preventDefault3","_event$preventDefault4","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","_objectSpread","concat","hideLabelText","textAlign","maxCharacters","formEvent","inputIndex","onInput","onKeyDown","keyboardEvent","isRequired","hideFormHint","type","valueComponentType","makeAnalyticsAttribute","_jsxs","metaAttribute","MetaConstants","OTPInput","getStyledProps","display","flexDirection","alignItems","position","Boolean","FormLabel","as","htmlFor","makeSize","FormHint","getHintType","hasHelpText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CAAA;AAAE,SAAC,CAAE;AACvEA,QAAAA,QAAQ,EAAEA,QAAS;AACnBD,QAAAA,SAAS,EAAEA,SAAU;AACrBmB,QAAAA,WAAW,EAAEA,WAAY;AACzB4B,QAAAA,UAAU,EAAEA,UAAW;AACvBC,QAAAA,WAAW,EAAEA,WAAY;AACzBC,QAAAA,aAAa,EAAEA,aAAc;AAC7BrB,QAAAA,IAAI,EAAEA,IAAAA;OACP,CAAA;AAAC,KACK,CAAC,CAAA;AAAA,GAAA,CACH,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMyG,QAAQ,gBAAG3B,cAAK,CAACyC,UAAU,CAAoCvJ,SAAS;;;;"}
@@ -24,7 +24,13 @@ var PopupArrow = /*#__PURE__*/React__default.forwardRef(function (_ref, arrowRef
24
24
  height: height,
25
25
  fill: fillColor,
26
26
  stroke: strokeColor,
27
- strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : 0,
27
+ strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : 0
28
+ /**
29
+ * `tipRadius` is a ratio, not a px value — FloatingArrow scales it against the arrow's
30
+ * own width/height, so the rounding grows much faster than the token number suggests.
31
+ * `xsmall` (4) visibly bows the arrow's edges; `2xsmall` (2) softens the tip while
32
+ * keeping the sides straight.
33
+ */,
28
34
  tipRadius: theme.border.radius['2xsmall'],
29
35
  style: _objectSpread({}, style)
30
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PopupArrow.web.js","sources":["../../../../../../src/components/PopupArrow/PopupArrow.web.tsx"],"sourcesContent":["import React from 'react';\nimport { FloatingArrow } from '@floating-ui/react';\nimport type { PopupArrowProps } from './types';\nimport { useTheme } from '~components/BladeProvider';\n\nconst PopupArrow = React.forwardRef<SVGSVGElement, PopupArrowProps>(\n ({ context, width, height, fillColor, strokeColor, strokeWidth, style }, arrowRef) => {\n const { theme } = useTheme();\n return (\n <FloatingArrow\n ref={arrowRef}\n context={context}\n width={width}\n height={height}\n fill={fillColor}\n stroke={strokeColor}\n strokeWidth={strokeWidth ?? 0}\n tipRadius={theme.border.radius['2xsmall']}\n style={{ ...style }}\n />\n );\n },\n);\n\nexport { PopupArrow };\n"],"names":["PopupArrow","React","forwardRef","_ref","arrowRef","context","width","height","fillColor","strokeColor","strokeWidth","style","_useTheme","useTheme","theme","_jsx","FloatingArrow","ref","fill","stroke","tipRadius","border","radius","_objectSpread"],"mappings":";;;;;;;;;AAKMA,IAAAA,UAAU,gBAAGC,cAAK,CAACC,UAAU,CACjC,UAAAC,IAAA,EAAyEC,QAAQ,EAAK;AAAA,EAAA,IAAnFC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAEC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAEC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAEC,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAEC,KAAK,GAAAR,IAAA,CAALQ,KAAK,CAAA;AACnE,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,oBACEC,GAAA,CAACC,aAAa,EAAA;AACZC,IAAAA,GAAG,EAAEb,QAAS;AACdC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,MAAM,EAAEA,MAAO;AACfW,IAAAA,IAAI,EAAEV,SAAU;AAChBW,IAAAA,MAAM,EAAEV,WAAY;AACpBC,IAAAA,WAAW,EAAEA,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAXA,KAAAA,CAAAA,GAAAA,WAAW,GAAI,CAAE;IAC9BU,SAAS,EAAEN,KAAK,CAACO,MAAM,CAACC,MAAM,CAAC,SAAS,CAAE;IAC1CX,KAAK,EAAAY,aAAA,CAAA,EAAA,EAAOZ,KAAK,CAAA;AAAG,GACrB,CAAC,CAAA;AAEN,CACF;;;;"}
1
+ {"version":3,"file":"PopupArrow.web.js","sources":["../../../../../../src/components/PopupArrow/PopupArrow.web.tsx"],"sourcesContent":["import React from 'react';\nimport { FloatingArrow } from '@floating-ui/react';\nimport type { PopupArrowProps } from './types';\nimport { useTheme } from '~components/BladeProvider';\n\nconst PopupArrow = React.forwardRef<SVGSVGElement, PopupArrowProps>(\n ({ context, width, height, fillColor, strokeColor, strokeWidth, style }, arrowRef) => {\n const { theme } = useTheme();\n return (\n <FloatingArrow\n ref={arrowRef}\n context={context}\n width={width}\n height={height}\n fill={fillColor}\n stroke={strokeColor}\n strokeWidth={strokeWidth ?? 0}\n /**\n * `tipRadius` is a ratio, not a px value — FloatingArrow scales it against the arrow's\n * own width/height, so the rounding grows much faster than the token number suggests.\n * `xsmall` (4) visibly bows the arrow's edges; `2xsmall` (2) softens the tip while\n * keeping the sides straight.\n */\n tipRadius={theme.border.radius['2xsmall']}\n style={{ ...style }}\n />\n );\n },\n);\n\nexport { PopupArrow };\n"],"names":["PopupArrow","React","forwardRef","_ref","arrowRef","context","width","height","fillColor","strokeColor","strokeWidth","style","_useTheme","useTheme","theme","_jsx","FloatingArrow","ref","fill","stroke","tipRadius","border","radius","_objectSpread"],"mappings":";;;;;;;;;AAKMA,IAAAA,UAAU,gBAAGC,cAAK,CAACC,UAAU,CACjC,UAAAC,IAAA,EAAyEC,QAAQ,EAAK;AAAA,EAAA,IAAnFC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;IAAEC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IAAEC,SAAS,GAAAL,IAAA,CAATK,SAAS;IAAEC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAEC,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAEC,KAAK,GAAAR,IAAA,CAALQ,KAAK,CAAA;AACnE,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,oBACEC,GAAA,CAACC,aAAa,EAAA;AACZC,IAAAA,GAAG,EAAEb,QAAS;AACdC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,MAAM,EAAEA,MAAO;AACfW,IAAAA,IAAI,EAAEV,SAAU;AAChBW,IAAAA,MAAM,EAAEV,WAAY;AACpBC,IAAAA,WAAW,EAAEA,WAAW,KAAA,IAAA,IAAXA,WAAW,KAAA,KAAA,CAAA,GAAXA,WAAW,GAAI,CAAA;AAC5B;AACR;AACA;AACA;AACA;AACA;IACQU,SAAS,EAAEN,KAAK,CAACO,MAAM,CAACC,MAAM,CAAC,SAAS,CAAE;IAC1CX,KAAK,EAAAY,aAAA,CAAA,EAAA,EAAOZ,KAAK,CAAA;AAAG,GACrB,CAAC,CAAA;AAEN,CACF;;;;"}
@@ -7,48 +7,53 @@ import { msToSeconds } from '../../utils/msToSeconds.js';
7
7
  import { cssBezierToArray } from '../../utils/cssBezierToArray.js';
8
8
  import '../BaseMotion/index.js';
9
9
  import '../Box/index.js';
10
- import { jsx, jsxs } from 'react/jsx-runtime';
10
+ import { jsx } from 'react/jsx-runtime';
11
11
  import useTheme from '../BladeProvider/useTheme.js';
12
12
  import { castWebType } from '../../utils/platform/castUtils.js';
13
13
  import { Box } from '../Box/Box.js';
14
14
  import { BaseMotionBox } from '../BaseMotion/BaseMotion.web.js';
15
15
 
16
- var ShimmerOverlay = function ShimmerOverlay() {
16
+ var ShimmerText = function ShimmerText(_ref) {
17
+ var children = _ref.children;
17
18
  var _useTheme = useTheme(),
18
19
  theme = _useTheme.theme;
19
- var shimmerColor = theme.colors.surface.text.staticWhite.muted;
20
+ var textColor = theme.colors.feedback.text.positive.intense;
21
+ // Lighter positive feedback token creates the sweeping glint; resolves per color scheme automatically.
22
+ var highlightColor = theme.colors.feedback.text.positive.subtle;
20
23
  var shimmerDuration = msToSeconds(theme.motion.duration['2xgentle']);
21
24
  var shimmerDelay = msToSeconds(theme.motion.delay.gentle);
22
25
  var shimmerEase = cssBezierToArray(castWebType(theme.motion.easing.standard));
23
26
  return /*#__PURE__*/jsx(m.span, {
24
- "aria-hidden": true,
25
27
  style: {
26
- position: 'absolute',
27
- inset: 0,
28
- background: "linear-gradient(90deg, transparent 0%, ".concat(shimmerColor, " 50%, transparent 100%)"),
29
- pointerEvents: 'none'
28
+ backgroundImage: "linear-gradient(90deg, ".concat(textColor, " 38%, ").concat(highlightColor, " 50%, ").concat(textColor, " 62%)"),
29
+ backgroundSize: '250% 100%',
30
+ WebkitBackgroundClip: 'text',
31
+ backgroundClip: 'text',
32
+ color: 'transparent',
33
+ WebkitTextFillColor: 'transparent'
30
34
  },
31
35
  initial: {
32
- x: '-100%'
36
+ backgroundPosition: '100% 0%'
33
37
  },
34
38
  animate: {
35
- x: '100%'
39
+ backgroundPosition: '0% 0%'
36
40
  },
37
41
  transition: {
38
42
  duration: shimmerDuration,
39
43
  ease: shimmerEase,
40
44
  repeat: Infinity,
41
45
  repeatDelay: shimmerDelay
42
- }
46
+ },
47
+ children: children
43
48
  });
44
49
  };
45
- var RollingText = function RollingText(_ref) {
46
- var texts = _ref.texts,
47
- children = _ref.children,
48
- onIndexChange = _ref.onIndexChange,
49
- cycleDurationProp = _ref.cycleDuration,
50
- _ref$showShimmer = _ref.showShimmer,
51
- showShimmer = _ref$showShimmer === void 0 ? true : _ref$showShimmer;
50
+ var RollingText = function RollingText(_ref2) {
51
+ var texts = _ref2.texts,
52
+ children = _ref2.children,
53
+ onIndexChange = _ref2.onIndexChange,
54
+ cycleDurationProp = _ref2.cycleDuration,
55
+ _ref2$showShimmer = _ref2.showShimmer,
56
+ showShimmer = _ref2$showShimmer === void 0 ? true : _ref2$showShimmer;
52
57
  var _useTheme2 = useTheme(),
53
58
  theme = _useTheme2.theme;
54
59
  var _React$useState = React__default.useState(0),
@@ -123,11 +128,13 @@ var RollingText = function RollingText(_ref) {
123
128
  initial: false,
124
129
  children: /*#__PURE__*/jsx(BaseMotionBox, {
125
130
  motionVariants: slideVariants,
126
- children: /*#__PURE__*/jsxs(Box, {
131
+ children: /*#__PURE__*/jsx(Box, {
127
132
  position: "relative",
128
133
  overflow: "hidden",
129
134
  whiteSpace: "nowrap",
130
- children: [renderContent(texts[currentIndex]), showShimmer && /*#__PURE__*/jsx(ShimmerOverlay, {})]
135
+ children: showShimmer && !children ? /*#__PURE__*/jsx(ShimmerText, {
136
+ children: renderContent(texts[currentIndex])
137
+ }) : renderContent(texts[currentIndex])
131
138
  })
132
139
  }, currentIndex)
133
140
  })
@@ -1 +1 @@
1
- {"version":3,"file":"RollingText.web.js","sources":["../../../../../../src/components/RollingText/RollingText.web.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatePresence, m } from 'framer-motion';\nimport { castWebType } from '~utils';\nimport { useTheme } from '~components/BladeProvider';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { cssBezierToArray } from '~utils/cssBezierToArray';\nimport { BaseMotionBox } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { Box } from '~components/Box';\n\nconst ShimmerOverlay = (): React.ReactElement => {\n const { theme } = useTheme();\n\n const shimmerColor = theme.colors.surface.text.staticWhite.muted;\n const shimmerDuration = msToSeconds(theme.motion.duration['2xgentle']);\n const shimmerDelay = msToSeconds(theme.motion.delay.gentle);\n const shimmerEase = cssBezierToArray(castWebType(theme.motion.easing.standard));\n\n return (\n <m.span\n aria-hidden\n style={{\n position: 'absolute',\n inset: 0,\n background: `linear-gradient(90deg, transparent 0%, ${shimmerColor} 50%, transparent 100%)`,\n pointerEvents: 'none',\n }}\n initial={{ x: '-100%' }}\n animate={{ x: '100%' }}\n transition={{\n duration: shimmerDuration,\n ease: shimmerEase,\n repeat: Infinity,\n repeatDelay: shimmerDelay,\n }}\n />\n );\n};\n\ntype RollingTextProps = {\n /** Array of strings to cycle through with a rolling animation */\n texts: string[];\n /** Custom render function for each text item */\n children?: (text: string) => React.ReactNode;\n /** Callback fired when the active index changes */\n onIndexChange?: (index: number) => void;\n /** Cycle interval in ms (defaults to theme.motion.delay.xlong) */\n cycleDuration?: number;\n /** Whether to show the shimmer overlay on each item (defaults to true) */\n showShimmer?: boolean;\n};\n\nconst RollingText = ({\n texts,\n children,\n onIndexChange,\n cycleDuration: cycleDurationProp,\n showShimmer = true,\n}: RollingTextProps): React.ReactElement => {\n const { theme } = useTheme();\n const [currentIndex, setCurrentIndex] = React.useState(0);\n\n const cycleDuration = cycleDurationProp ?? theme.motion.delay.xlong;\n const slideDuration = msToSeconds(theme.motion.duration.xmoderate);\n const slideEase = cssBezierToArray(castWebType(theme.motion.easing.emphasized));\n\n React.useEffect(() => {\n if (texts.length <= 1) {\n return undefined;\n }\n\n const id = setInterval(() => {\n setCurrentIndex((prev) => {\n const next = (prev + 1) % texts.length;\n onIndexChange?.(next);\n return next;\n });\n }, cycleDuration);\n\n return (): void => {\n clearInterval(id);\n };\n }, [texts.length, cycleDuration, onIndexChange]);\n\n const textsString = texts.join('\\0');\n React.useEffect(() => {\n setCurrentIndex(0);\n onIndexChange?.(0);\n // Reset only when the text contents change, not on every render (new array reference)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [textsString]);\n\n const renderContent = (text: string): React.ReactNode => {\n return children ? children(text) : text;\n };\n\n if (texts.length <= 1) {\n return <span>{renderContent(texts[0])}</span>;\n }\n\n const slideVariants: MotionVariantsType = {\n initial: { y: 16, opacity: 0, filter: 'blur(4px)' },\n animate: {\n y: 0,\n opacity: 1,\n filter: 'blur(0px)',\n transition: { duration: slideDuration, ease: slideEase },\n },\n exit: {\n y: -16,\n opacity: 0,\n filter: 'blur(4px)',\n position: 'absolute' as const,\n transition: { duration: slideDuration, ease: slideEase },\n },\n };\n\n return (\n <Box position=\"relative\" display=\"inline-flex\" overflow=\"hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <BaseMotionBox key={currentIndex} motionVariants={slideVariants}>\n <Box position=\"relative\" overflow=\"hidden\" whiteSpace=\"nowrap\">\n {renderContent(texts[currentIndex])}\n {showShimmer && <ShimmerOverlay />}\n </Box>\n </BaseMotionBox>\n </AnimatePresence>\n </Box>\n );\n};\n\nexport { RollingText };\nexport type { RollingTextProps };\n"],"names":["ShimmerOverlay","_useTheme","useTheme","theme","shimmerColor","colors","surface","text","staticWhite","muted","shimmerDuration","msToSeconds","motion","duration","shimmerDelay","delay","gentle","shimmerEase","cssBezierToArray","castWebType","easing","standard","_jsx","m","span","style","position","inset","background","concat","pointerEvents","initial","x","animate","transition","ease","repeat","Infinity","repeatDelay","RollingText","_ref","texts","children","onIndexChange","cycleDurationProp","cycleDuration","_ref$showShimmer","showShimmer","_useTheme2","_React$useState","React","useState","_React$useState2","_slicedToArray","currentIndex","setCurrentIndex","xlong","slideDuration","xmoderate","slideEase","emphasized","useEffect","length","undefined","id","setInterval","prev","next","clearInterval","textsString","join","renderContent","slideVariants","y","opacity","filter","exit","Box","display","overflow","AnimatePresence","mode","BaseMotionBox","motionVariants","_jsxs","whiteSpace"],"mappings":";;;;;;;;;;;;;;;AAUA,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,GAA6B;AAC/C,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AAEb,EAAA,IAAMC,YAAY,GAAGD,KAAK,CAACE,MAAM,CAACC,OAAO,CAACC,IAAI,CAACC,WAAW,CAACC,KAAK,CAAA;AAChE,EAAA,IAAMC,eAAe,GAAGC,WAAW,CAACR,KAAK,CAACS,MAAM,CAACC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;EACtE,IAAMC,YAAY,GAAGH,WAAW,CAACR,KAAK,CAACS,MAAM,CAACG,KAAK,CAACC,MAAM,CAAC,CAAA;AAC3D,EAAA,IAAMC,WAAW,GAAGC,gBAAgB,CAACC,WAAW,CAAChB,KAAK,CAACS,MAAM,CAACQ,MAAM,CAACC,QA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EAAE4C,aAAa;AAAEtB,QAAAA,IAAI,EAAEwB,SAAAA;AAAU,OAAA;AACzD,KAAA;GACD,CAAA;EAED,oBACErC,GAAA,CAACuD,GAAG,EAAA;AAACnD,IAAAA,QAAQ,EAAC,UAAU;AAACoD,IAAAA,OAAO,EAAC,aAAa;AAACC,IAAAA,QAAQ,EAAC,QAAQ;IAAArC,QAAA,eAC9DpB,GAAA,CAAC0D,eAAe,EAAA;AAACC,MAAAA,IAAI,EAAC,WAAW;AAAClD,MAAAA,OAAO,EAAE,KAAM;MAAAW,QAAA,eAC/CpB,GAAA,CAAC4D,aAAa,EAAA;AAAoBC,QAAAA,cAAc,EAAEX,aAAc;QAAA9B,QAAA,eAC9D0C,IAAA,CAACP,GAAG,EAAA;AAACnD,UAAAA,QAAQ,EAAC,UAAU;AAACqD,UAAAA,QAAQ,EAAC,QAAQ;AAACM,UAAAA,UAAU,EAAC,QAAQ;AAAA3C,UAAAA,QAAA,EAC3D6B,CAAAA,aAAa,CAAC9B,KAAK,CAACa,YAAY,CAAC,CAAC,EAClCP,WAAW,iBAAIzB,GAAA,CAACtB,cAAc,IAAE,CAAC,CAAA;SAC/B,CAAA;AAAC,OAAA,EAJYsD,YAKL,CAAA;KACA,CAAA;AAAC,GACf,CAAC,CAAA;AAEV;;;;"}
1
+ {"version":3,"file":"RollingText.web.js","sources":["../../../../../../src/components/RollingText/RollingText.web.tsx"],"sourcesContent":["import React from 'react';\nimport { AnimatePresence, m } from 'framer-motion';\nimport { castWebType } from '~utils';\nimport { useTheme } from '~components/BladeProvider';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { cssBezierToArray } from '~utils/cssBezierToArray';\nimport { BaseMotionBox } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { Box } from '~components/Box';\n\nconst ShimmerText = ({ children }: { children: React.ReactNode }): React.ReactElement => {\n const { theme } = useTheme();\n\n const textColor = theme.colors.feedback.text.positive.intense;\n // Lighter positive feedback token creates the sweeping glint; resolves per color scheme automatically.\n const highlightColor = theme.colors.feedback.text.positive.subtle;\n const shimmerDuration = msToSeconds(theme.motion.duration['2xgentle']);\n const shimmerDelay = msToSeconds(theme.motion.delay.gentle);\n const shimmerEase = cssBezierToArray(castWebType(theme.motion.easing.standard));\n\n return (\n <m.span\n style={{\n backgroundImage: `linear-gradient(90deg, ${textColor} 38%, ${highlightColor} 50%, ${textColor} 62%)`,\n backgroundSize: '250% 100%',\n WebkitBackgroundClip: 'text',\n backgroundClip: 'text',\n color: 'transparent',\n WebkitTextFillColor: 'transparent',\n }}\n initial={{ backgroundPosition: '100% 0%' }}\n animate={{ backgroundPosition: '0% 0%' }}\n transition={{\n duration: shimmerDuration,\n ease: shimmerEase,\n repeat: Infinity,\n repeatDelay: shimmerDelay,\n }}\n >\n {children}\n </m.span>\n );\n};\n\ntype RollingTextProps = {\n /** Array of strings to cycle through with a rolling animation */\n texts: string[];\n /** Custom render function for each text item */\n children?: (text: string) => React.ReactNode;\n /** Callback fired when the active index changes */\n onIndexChange?: (index: number) => void;\n /** Cycle interval in ms (defaults to theme.motion.delay.xlong) */\n cycleDuration?: number;\n /** Whether to show the shimmer overlay on each item (defaults to true) */\n showShimmer?: boolean;\n};\n\nconst RollingText = ({\n texts,\n children,\n onIndexChange,\n cycleDuration: cycleDurationProp,\n showShimmer = true,\n}: RollingTextProps): React.ReactElement => {\n const { theme } = useTheme();\n const [currentIndex, setCurrentIndex] = React.useState(0);\n\n const cycleDuration = cycleDurationProp ?? theme.motion.delay.xlong;\n const slideDuration = msToSeconds(theme.motion.duration.xmoderate);\n const slideEase = cssBezierToArray(castWebType(theme.motion.easing.emphasized));\n\n React.useEffect(() => {\n if (texts.length <= 1) {\n return undefined;\n }\n\n const id = setInterval(() => {\n setCurrentIndex((prev) => {\n const next = (prev + 1) % texts.length;\n onIndexChange?.(next);\n return next;\n });\n }, cycleDuration);\n\n return (): void => {\n clearInterval(id);\n };\n }, [texts.length, cycleDuration, onIndexChange]);\n\n const textsString = texts.join('\\0');\n React.useEffect(() => {\n setCurrentIndex(0);\n onIndexChange?.(0);\n // Reset only when the text contents change, not on every render (new array reference)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [textsString]);\n\n const renderContent = (text: string): React.ReactNode => {\n return children ? children(text) : text;\n };\n\n if (texts.length <= 1) {\n return <span>{renderContent(texts[0])}</span>;\n }\n\n const slideVariants: MotionVariantsType = {\n initial: { y: 16, opacity: 0, filter: 'blur(4px)' },\n animate: {\n y: 0,\n opacity: 1,\n filter: 'blur(0px)',\n transition: { duration: slideDuration, ease: slideEase },\n },\n exit: {\n y: -16,\n opacity: 0,\n filter: 'blur(4px)',\n position: 'absolute' as const,\n transition: { duration: slideDuration, ease: slideEase },\n },\n };\n\n return (\n <Box position=\"relative\" display=\"inline-flex\" overflow=\"hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <BaseMotionBox key={currentIndex} motionVariants={slideVariants}>\n <Box position=\"relative\" overflow=\"hidden\" whiteSpace=\"nowrap\">\n {showShimmer && !children ? (\n <ShimmerText>{renderContent(texts[currentIndex])}</ShimmerText>\n ) : (\n renderContent(texts[currentIndex])\n )}\n </Box>\n </BaseMotionBox>\n </AnimatePresence>\n </Box>\n );\n};\n\nexport { RollingText };\nexport type { RollingTextProps };\n"],"names":["ShimmerText","_ref","children","_useTheme","useTheme","theme","textColor","colors","feedback","text","positive","intense","highlightColor","subtle","shimmerDuration","msToSeconds","motion","duration","shimmerDelay","delay","gentle","shimmerEase","cssBezierToArray","castWebType","easing","standard","_jsx","m","span","style","backgroundImage","concat","backgroundSize","WebkitBackgroundClip","backgroundClip","color","WebkitTextFillColor","initial","backgroundPosition","animate","transition","ease","repeat","Infinity","repeatDelay","RollingText","_ref2","texts","onIndexChange","cycleDurationProp","cycleDuration","_ref2$showShimmer","showShimmer","_useTheme2","_React$useState","React","useState","_React$useState2","_slicedToArray","currentIndex","setCurrentIndex","xlong","slideDuration","xmoderate","slideEase","emphasized","useEffect","length","undefined","id","setInterval","prev","next","clearInterval","textsString","join","renderContent","slideVariants","y","opacity","filter","exit","position","Box","display","overflow","AnimatePresence","mode","BaseMotionBox","motionVariants","whiteSpace"],"mappings":";;;;;;;;;;;;;;;AAUA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAwE;AAAA,EAAA,IAAlEC,QAAQ,GAAAD,IAAA,CAARC,QAAQ,CAAA;AAC7B,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AAEb,EAAA,IAAMC,SAAS,GAAGD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAACC,OAAO,CAAA;AAC7D;AACA,EAAA,IAAMC,cAAc,GAAGP,KAAK,CAACE,MAAM,CAACC,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAACG,MAAM,CAAA;AACjE,EAAA,IAAMC,eAAe,GAAGC,WAAW,CAACV,KAAK,CAACW,MAAM,CAACC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAA;EACtE,IAAMC,YAAY,GAAGH,WAAW,CAACV,KAAK,CAACW,MAAM,CAACG,KAAK,CAACC,MAAM,CAAC,CAAA;AAC3D,EAAA,IAAMC,WAAW,GAAGC,gBAAgB,CAACC,WAAW,CAAClB,KAAK,CAACW,MAAM,CAACQ,MAAM,CAACC,QAAQ,CAAC,CAAC,CAAA;AAE/E,EAAA,oBACEC,GAAA,CAACC,CAAC,CAACC,IAAI,EAAA;AACLC,IAAAA,KAAK,EAAE;AACLC,MAAAA,eAAe,EAAAC,yBAAAA,CAAAA,MAAA,CAA4BzB,SAAS,EAAAyB,QAAAA,CAAAA,CAAAA,MAAA,CAASnB,cAAc,EAAAmB,QAAAA,CAAAA,CAAAA,MAAA,CAASzB,SAAS,EAAO,OAAA,CAAA;AACpG0B,MAAAA,cAAc,EAAE,WAAW;AAC3BC,MAAAA,oBAAoB,EAAE,MAAM;AAC5BC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EAAC,aAAa;AAACC,IAAAA,QAAQ,EAAC,QAAQ;IAAAnF,QAAA,eAC9DwB,GAAA,CAAC4D,eAAe,EAAA;AAACC,MAAAA,IAAI,EAAC,WAAW;AAAClD,MAAAA,OAAO,EAAE,KAAM;MAAAnC,QAAA,eAC/CwB,GAAA,CAAC8D,aAAa,EAAA;AAAoBC,QAAAA,cAAc,EAAEZ,aAAc;QAAA3E,QAAA,eAC9DwB,GAAA,CAACyD,GAAG,EAAA;AAACD,UAAAA,QAAQ,EAAC,UAAU;AAACG,UAAAA,QAAQ,EAAC,QAAQ;AAACK,UAAAA,UAAU,EAAC,QAAQ;UAAAxF,QAAA,EAC3DkD,WAAW,IAAI,CAAClD,QAAQ,gBACvBwB,GAAA,CAAC1B,WAAW,EAAA;AAAAE,YAAAA,QAAA,EAAE0E,aAAa,CAAC7B,KAAK,CAACY,YAAY,CAAC,CAAA;AAAC,WAAc,CAAC,GAE/DiB,aAAa,CAAC7B,KAAK,CAACY,YAAY,CAAC,CAAA;SAEhC,CAAA;AAAC,OAAA,EAPYA,YAQL,CAAA;KACA,CAAA;AAAC,GACf,CAAC,CAAA;AAEV;;;;"}
@@ -0,0 +1,196 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React__default from 'react';
5
+ import styled from 'styled-components';
6
+ import { SegmentedControlContext } from './SegmentedControlContext.js';
7
+ import { SegmentedControlIndicator } from './SegmentedControlIndicator.web.js';
8
+ import { containerHeight, gap, containerPadding, containerBorderRadius } from './segmentedControlTokens.js';
9
+ import { useControllableState } from '../../utils/useControllable.js';
10
+ import { useId } from '../../utils/useId.js';
11
+ import { useMergeRefs } from '../../utils/useMergeRefs.js';
12
+ import '../../utils/makeAccessible/index.js';
13
+ import '../../utils/metaAttribute/index.js';
14
+ import '../../utils/makeAnalyticsAttribute/index.js';
15
+ import '../Box/styledProps/index.js';
16
+ import '../../utils/index.js';
17
+ import getIn from '../../utils/lodashButBetter/get.js';
18
+ import '../Form/index.js';
19
+ import '../Box/BaseBox/index.js';
20
+ import '../BladeProvider/index.js';
21
+ import { formHintLeftLabelMarginLeft } from '../Input/BaseInput/baseInputTokens.js';
22
+ import '../../utils/makeSize/index.js';
23
+ import { getHintType } from '../Input/BaseInput/BaseInput.js';
24
+ import { jsxs, jsx } from 'react/jsx-runtime';
25
+ import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
26
+ import useTheme from '../BladeProvider/useTheme.js';
27
+ import { useBreakpoint } from '../../utils/useBreakpoint/useBreakpoint.js';
28
+ import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
29
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
30
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
31
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
32
+ import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
33
+ import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
34
+ import { FormLabel } from '../Form/FormLabel.js';
35
+ import { makeSize } from '../../utils/makeSize/makeSize.js';
36
+ import { FormHint } from '../Form/FormHint.js';
37
+
38
+ var _excluded = ["children", "defaultValue", "value", "onChange", "size", "isDisabled", "isRequired", "name", "label", "accessibilityLabel", "labelPosition", "helpText", "errorText", "validationState", "necessityIndicator", "testID"];
39
+ 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; }
40
+ 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; }
41
+ var StyledSegmentedControlContainer = /*#__PURE__*/styled.div.withConfig({
42
+ displayName: "SegmentedControlweb__StyledSegmentedControlContainer",
43
+ componentId: "ngewlz-0"
44
+ })(function (_ref) {
45
+ var theme = _ref.theme,
46
+ $size = _ref.$size;
47
+ return {
48
+ display: 'flex',
49
+ width: '100%',
50
+ height: makeSpace(containerHeight[$size]),
51
+ alignItems: 'center',
52
+ gap: makeSpace(getIn(theme, gap[$size])),
53
+ padding: makeSpace(getIn(theme, containerPadding[$size])),
54
+ backgroundColor: theme.colors.interactive.background.gray.faded,
55
+ borderRadius: makeSpace(theme.border.radius[containerBorderRadius[$size]]),
56
+ position: 'relative'
57
+ };
58
+ });
59
+ var _SegmentedControl = function _SegmentedControl(_ref2, ref) {
60
+ var children = _ref2.children,
61
+ defaultValue = _ref2.defaultValue,
62
+ value = _ref2.value,
63
+ _onChange = _ref2.onChange,
64
+ _ref2$size = _ref2.size,
65
+ size = _ref2$size === void 0 ? 'medium' : _ref2$size,
66
+ _ref2$isDisabled = _ref2.isDisabled,
67
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
68
+ _ref2$isRequired = _ref2.isRequired,
69
+ isRequired = _ref2$isRequired === void 0 ? false : _ref2$isRequired,
70
+ name = _ref2.name,
71
+ label = _ref2.label,
72
+ accessibilityLabel = _ref2.accessibilityLabel,
73
+ _ref2$labelPosition = _ref2.labelPosition,
74
+ labelPosition = _ref2$labelPosition === void 0 ? 'top' : _ref2$labelPosition,
75
+ helpText = _ref2.helpText,
76
+ errorText = _ref2.errorText,
77
+ _ref2$validationState = _ref2.validationState,
78
+ validationState = _ref2$validationState === void 0 ? 'none' : _ref2$validationState,
79
+ _ref2$necessityIndica = _ref2.necessityIndicator,
80
+ necessityIndicator = _ref2$necessityIndica === void 0 ? 'none' : _ref2$necessityIndica,
81
+ testID = _ref2.testID,
82
+ rest = _objectWithoutProperties(_ref2, _excluded);
83
+ var _useControllableState = useControllableState({
84
+ defaultValue: defaultValue,
85
+ value: value,
86
+ onChange: function onChange(val) {
87
+ _onChange === null || _onChange === void 0 || _onChange({
88
+ name: name,
89
+ value: val
90
+ });
91
+ }
92
+ }),
93
+ _useControllableState2 = _slicedToArray(_useControllableState, 2),
94
+ selectedValue = _useControllableState2[0],
95
+ setSelectedValue = _useControllableState2[1];
96
+ var baseId = useId('segmented-control');
97
+ var containerRef = React__default.useRef(null);
98
+ var mergedRef = useMergeRefs(containerRef, ref);
99
+ var itemRefs = React__default.useRef(new Map());
100
+ var labelId = "".concat(baseId, "-label");
101
+ var totalItems = React__default.Children.count(children);
102
+ var firstEnabledValue = React__default.useMemo(function () {
103
+ var first;
104
+ React__default.Children.forEach(children, function (child) {
105
+ if (first !== undefined) return;
106
+ if (/*#__PURE__*/React__default.isValidElement(child) && !child.props.isDisabled) {
107
+ first = child.props.value;
108
+ }
109
+ });
110
+ return first;
111
+ }, [children]);
112
+ var contextValue = React__default.useMemo(function () {
113
+ return {
114
+ selectedValue: selectedValue,
115
+ setSelectedValue: setSelectedValue,
116
+ size: size,
117
+ isDisabled: isDisabled,
118
+ name: name,
119
+ baseId: baseId,
120
+ totalItems: totalItems,
121
+ firstEnabledValue: firstEnabledValue,
122
+ itemRefs: itemRefs
123
+ };
124
+ }, [selectedValue, setSelectedValue, size, isDisabled, name, baseId, totalItems, firstEnabledValue]);
125
+ var _useTheme = useTheme(),
126
+ theme = _useTheme.theme;
127
+ var _useBreakpoint = useBreakpoint({
128
+ breakpoints: theme.breakpoints
129
+ }),
130
+ matchedDeviceType = _useBreakpoint.matchedDeviceType;
131
+ var isLabelLeftPositioned = labelPosition === 'left' && matchedDeviceType === 'desktop';
132
+ var willRenderHintText = Boolean(helpText) || validationState === 'error' && Boolean(errorText);
133
+ var showError = validationState === 'error' && errorText;
134
+ var showHelpText = !showError && helpText;
135
+ var accessibilityText = "".concat(showError ? errorText : '', " ").concat(showHelpText ? helpText : '').trim();
136
+ var ariaLabel = label ? undefined : accessibilityLabel || name;
137
+ var segmentedControlElement = /*#__PURE__*/jsxs(StyledSegmentedControlContainer, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
138
+ ref: mergedRef,
139
+ $size: size
140
+ }, makeAccessible({
141
+ role: 'radiogroup',
142
+ labelledBy: label ? labelId : undefined,
143
+ label: ariaLabel,
144
+ required: isRequired
145
+ })), metaAttribute({
146
+ name: MetaConstants.SegmentedControl,
147
+ testID: testID
148
+ })), makeAnalyticsAttribute(rest)), {}, {
149
+ children: [children, /*#__PURE__*/jsx(SegmentedControlIndicator, {
150
+ containerRef: containerRef
151
+ })]
152
+ }));
153
+ return /*#__PURE__*/jsx(SegmentedControlContext.Provider, {
154
+ value: contextValue,
155
+ children: /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread({
156
+ display: "flex",
157
+ flexDirection: "column",
158
+ width: "100%"
159
+ }, getStyledProps(rest)), {}, {
160
+ children: [/*#__PURE__*/jsxs(BaseBox, {
161
+ display: "flex",
162
+ flexDirection: isLabelLeftPositioned ? 'row' : 'column',
163
+ alignItems: isLabelLeftPositioned ? 'center' : undefined,
164
+ children: [label ? /*#__PURE__*/jsx(FormLabel, {
165
+ as: "span",
166
+ necessityIndicator: necessityIndicator,
167
+ position: labelPosition,
168
+ id: labelId,
169
+ accessibilityText: accessibilityText && ",".concat(accessibilityText),
170
+ size: size,
171
+ children: label
172
+ }) : null, /*#__PURE__*/jsx(BaseBox, {
173
+ display: "flex",
174
+ flexDirection: "column",
175
+ flex: "1",
176
+ children: segmentedControlElement
177
+ })]
178
+ }), willRenderHintText && /*#__PURE__*/jsx(BaseBox, {
179
+ marginLeft: makeSize(label && isLabelLeftPositioned ? formHintLeftLabelMarginLeft[size] : 0),
180
+ children: /*#__PURE__*/jsx(FormHint, {
181
+ type: getHintType({
182
+ validationState: validationState,
183
+ hasHelpText: Boolean(helpText)
184
+ }),
185
+ helpText: helpText,
186
+ errorText: errorText,
187
+ size: size
188
+ })
189
+ })]
190
+ }))
191
+ });
192
+ };
193
+ var SegmentedControl = /*#__PURE__*/React__default.forwardRef(_SegmentedControl);
194
+
195
+ export { SegmentedControl };
196
+ //# sourceMappingURL=SegmentedControl.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.web.js","sources":["../../../../../../src/components/SegmentedControl/SegmentedControl.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { SegmentedControlProps } from './types';\nimport { SegmentedControlContext } from './SegmentedControlContext';\nimport { SegmentedControlIndicator } from './SegmentedControlIndicator.web';\nimport {\n containerPadding,\n containerBorderRadius,\n containerHeight,\n gap,\n} from './segmentedControlTokens';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { makeSpace, useBreakpoint } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BladeElementRef } from '~utils/types';\nimport { FormLabel, FormHint } from '~components/Form';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { formHintLeftLabelMarginLeft } from '~components/Input/BaseInput/baseInputTokens';\nimport { makeSize } from '~utils/makeSize';\nimport { getHintType } from '~components/Input/BaseInput/BaseInput';\n\nconst StyledSegmentedControlContainer = styled.div<{\n $size: NonNullable<SegmentedControlProps['size']>;\n}>(({ theme, $size }) => ({\n display: 'flex',\n width: '100%',\n height: makeSpace(containerHeight[$size]),\n alignItems: 'center',\n gap: makeSpace(getIn(theme, gap[$size])),\n padding: makeSpace(getIn(theme, containerPadding[$size])),\n backgroundColor: theme.colors.interactive.background.gray.faded,\n borderRadius: makeSpace(theme.border.radius[containerBorderRadius[$size]]),\n position: 'relative',\n}));\n\nconst _SegmentedControl = (\n {\n children,\n defaultValue,\n value,\n onChange,\n size = 'medium',\n isDisabled = false,\n isRequired = false,\n name,\n label,\n accessibilityLabel,\n labelPosition = 'top',\n helpText,\n errorText,\n validationState = 'none',\n necessityIndicator = 'none',\n testID,\n ...rest\n }: SegmentedControlProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue,\n value,\n onChange: (val) => {\n onChange?.({ name, value: val });\n },\n });\n\n const baseId = useId('segmented-control');\n const containerRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(containerRef, ref as React.Ref<HTMLDivElement>);\n const itemRefs = React.useRef<Map<string, HTMLElement>>(new Map());\n const labelId = `${baseId}-label`;\n const totalItems = React.Children.count(children);\n\n const firstEnabledValue = React.useMemo(() => {\n let first: string | undefined;\n React.Children.forEach(children, (child) => {\n if (first !== undefined) return;\n if (React.isValidElement(child) && !child.props.isDisabled) {\n first = child.props.value;\n }\n });\n return first;\n }, [children]);\n\n const contextValue = React.useMemo(\n () => ({\n selectedValue,\n setSelectedValue,\n size,\n isDisabled,\n name,\n baseId,\n totalItems,\n firstEnabledValue,\n itemRefs,\n }),\n [\n selectedValue,\n setSelectedValue,\n size,\n isDisabled,\n name,\n baseId,\n totalItems,\n firstEnabledValue,\n ],\n );\n\n const { theme } = useTheme();\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const isLabelLeftPositioned = labelPosition === 'left' && matchedDeviceType === 'desktop';\n\n const willRenderHintText =\n Boolean(helpText) || (validationState === 'error' && Boolean(errorText));\n\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `${showError ? errorText : ''} ${showHelpText ? helpText : ''}`.trim();\n const ariaLabel = label ? undefined : accessibilityLabel || name;\n\n const segmentedControlElement = (\n <StyledSegmentedControlContainer\n ref={mergedRef}\n $size={size}\n {...makeAccessible({\n role: 'radiogroup',\n labelledBy: label ? labelId : undefined,\n label: ariaLabel,\n required: isRequired,\n })}\n {...metaAttribute({ name: MetaConstants.SegmentedControl, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n <SegmentedControlIndicator containerRef={containerRef} />\n </StyledSegmentedControlContainer>\n );\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\" {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={labelId}\n accessibilityText={accessibilityText && `,${accessibilityText}`}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n\n <BaseBox display=\"flex\" flexDirection=\"column\" flex=\"1\">\n {segmentedControlElement}\n </BaseBox>\n </BaseBox>\n\n {willRenderHintText && (\n <BaseBox\n marginLeft={makeSize(\n label && isLabelLeftPositioned ? formHintLeftLabelMarginLeft[size] : 0,\n )}\n >\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n size={size}\n />\n </BaseBox>\n )}\n </BaseBox>\n </SegmentedControlContext.Provider>\n );\n};\n\nconst SegmentedControl = React.forwardRef(_SegmentedControl);\n\nexport { SegmentedControl };\n"],"names":["StyledSegmentedControlContainer","styled","div","withConfig","displayName","componentId","_ref","theme","$size","display","width","height","makeSpace","containerHeight","alignItems","gap","getIn","padding","containerPadding","backgroundColor","colors","interactive","background","gray","faded","borderRadius","border","radius","containerBorderRadius","position","_SegmentedControl","_ref2","ref","children","defaultValue","value","onChange","_ref2$size","size","_ref2$isDisabled","isDisabled","_ref2$isRequired","isRequired","name","label","accessibilityLabel","_ref2$labelPosition","labelPosition","helpText","errorText","_ref2$validationState","validationState","_ref2$necessityIndica","necessityIndicator","testID","rest","_objectWithoutProperties","_excluded","_useControllableState","useControllableState","val","_useControllableState2","_slicedToArray","selectedValue","setSelectedValue","baseId","useId","containerRef","React","useRef","mergedRef","useMergeRefs","itemRefs","Map","labelId","concat","totalItems","Children","count","firstEnabledValue","useMemo","first","forEach","child","undefined","isValidElement","props","contextValue","_useTheme","useTheme","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","isLabelLeftPositioned","willRenderHintText","Boolean","showError","showHelpText","accessibilityText","trim","ariaLabel","segmentedControlElement","_jsxs","_objectSpread","makeAccessible","role","labelledBy","required","metaAttribute","MetaConstants","SegmentedControl","makeAnalyticsAttribute","_jsx","SegmentedControlIndicator","SegmentedControlContext","Provider","BaseBox","flexDirection","getStyledProps","FormLabel","as","id","flex","marginLeft","makeSize","formHintLeftLabelMarginLeft","FormHint","type","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAMA,+BAA+B,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,sDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAE/C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAAA,OAAQ;AACxBC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAEC,SAAS,CAACC,eAAe,CAACL,KAAK,CAAC,CAAC;AACzCM,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,GAAG,EAAEH,SAAS,CAACI,KAAK,CAACT,KAAK,EAAEQ,GAAG,CAACP,KAAK,CAAC,CAAC,CAAC;AACxCS,IAAAA,OAAO,EAAEL,SAAS,CAACI,KAAK,CAACT,KAAK,EAAEW,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,CAAAxB,MAAA,CAAQwB,iBAAiB,CAAG;AAChE7D,UAAAA,IAAI,EAAEA,IAAK;AAAAL,UAAAA,QAAA,EAEVW,KAAAA;AAAK,SACG,CAAC,GACV,IAAI,eAERqE,GAAA,CAACI,OAAO,EAAA;AAAC5G,UAAAA,OAAO,EAAC,MAAM;AAAC6G,UAAAA,aAAa,EAAC,QAAQ;AAACK,UAAAA,IAAI,EAAC,GAAG;AAAA1F,UAAAA,QAAA,EACpDqE,uBAAAA;AAAuB,SACjB,CAAC,CAAA;AAAA,OACH,CAAC,EAETP,kBAAkB,iBACjBkB,GAAA,CAACI,OAAO,EAAA;AACNO,QAAAA,UAAU,EAAEC,QAAQ,CAClBjF,KAAK,IAAIkD,qBAAqB,GAAGgC,2BAA2B,CAACxF,IAAI,CAAC,GAAG,CACvE,CAAE;QAAAL,QAAA,eAEFgF,GAAA,CAACc,QAAQ,EAAA;UACPC,IAAI,EAAEC,WAAW,CAAC;AAAE9E,YAAAA,eAAe,EAAfA,eAAe;YAAE+E,WAAW,EAAElC,OAAO,CAAChD,QAAQ,CAAA;AAAE,WAAC,CAAE;AACvEA,UAAAA,QAAQ,EAAEA,QAAS;AACnBC,UAAAA,SAAS,EAAEA,SAAU;AACrBX,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;AAAC,OACK,CACV,CAAA;KACM,CAAA,CAAA;AAAC,GACsB,CAAC,CAAA;AAEvC,CAAC,CAAA;AAED,IAAMyE,gBAAgB,gBAAG3C,cAAK,CAAC+D,UAAU,CAACrG,iBAAiB;;;;"}
@@ -0,0 +1,18 @@
1
+ import React__default from 'react';
2
+ import '../../utils/logger/index.js';
3
+ import { throwBladeError } from '../../utils/logger/logger.js';
4
+
5
+ var SegmentedControlContext = /*#__PURE__*/React__default.createContext(null);
6
+ var useSegmentedControlContext = function useSegmentedControlContext() {
7
+ var context = React__default.useContext(SegmentedControlContext);
8
+ if (!context) {
9
+ throwBladeError({
10
+ moduleName: 'SegmentedControl',
11
+ message: 'useSegmentedControlContext must be used within SegmentedControl'
12
+ });
13
+ }
14
+ return context;
15
+ };
16
+
17
+ export { SegmentedControlContext, useSegmentedControlContext };
18
+ //# sourceMappingURL=SegmentedControlContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControlContext.js","sources":["../../../../../../src/components/SegmentedControl/SegmentedControlContext.ts"],"sourcesContent":["import React from 'react';\nimport type { SegmentedControlSize } from './types';\nimport { throwBladeError } from '~utils/logger';\nimport type { ControllableStateSetter } from '~utils/useControllable';\n\ntype SegmentedControlContextProps = {\n selectedValue: string | undefined;\n setSelectedValue: ControllableStateSetter<string>;\n size: SegmentedControlSize;\n isDisabled: boolean;\n name?: string;\n baseId: string;\n totalItems: number;\n firstEnabledValue?: string;\n itemRefs?: React.MutableRefObject<Map<string, HTMLElement>>;\n} | null;\n\nconst SegmentedControlContext = React.createContext<SegmentedControlContextProps>(null);\n\nconst useSegmentedControlContext = (): NonNullable<SegmentedControlContextProps> => {\n const context = React.useContext(SegmentedControlContext);\n\n if (!context) {\n throwBladeError({\n moduleName: 'SegmentedControl',\n message: 'useSegmentedControlContext must be used within SegmentedControl',\n });\n }\n\n return context!;\n};\n\nexport { SegmentedControlContext, useSegmentedControlContext };\n"],"names":["SegmentedControlContext","React","createContext","useSegmentedControlContext","context","useContext","throwBladeError","moduleName","message"],"mappings":";;;;AAiBA,IAAMA,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAA+B,IAAI,EAAC;AAEvF,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,GAAoD;AAClF,EAAA,IAAMC,OAAO,GAAGH,cAAK,CAACI,UAAU,CAACL,uBAAuB,CAAC,CAAA;EAEzD,IAAI,CAACI,OAAO,EAAE;AACZE,IAAAA,eAAe,CAAC;AACdC,MAAAA,UAAU,EAAE,kBAAkB;AAC9BC,MAAAA,OAAO,EAAE,iEAAA;AACX,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,OAAOJ,OAAO,CAAA;AAChB;;;;"}