@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","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","preventDefault","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","Object","assign","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":";;;;;;;;;;;;;;;;;;;;;;;;;0dAyHA,IAAMA,aAAa,CAAGC,eAAe,EAAE,GAAK,cAAc,CAK1D,IAAMC,UAAU,CAAG,SAAbA,UAAUA,CAAIC,IAAa,CAAA,CAAA,IAAAC,WAAA,CAAA,OAAA,CAAAA,WAAA,CAAeD,IAAI,EAAA,IAAA,CAAA,KAAA,CAAA,CAAJA,IAAI,CAAEE,KAAK,CAAC,EAAE,CAAC,GAAA,IAAA,CAAAD,WAAA,CAAIE,KAAK,CAAC,CAAC,CAAC,CA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AAA,CAE5BrG,KAAK,CACG,CACZ,CACDsH,IAAA,CAACpB,OAAO,CAAA,CAACyB,OAAO,CAAC,MAAM,CAACC,aAAa,CAAC,KAAK,CAAAvB,QAAA,CACxCnB,CAAAA,cAAc,EAAE,CAChBM,iBAAiB,EAAE,CACb,CAAA,CAAC,CACH,CAAA,CAAC,CAGVJ,GAAA,CAACc,OAAO,CAAA,CAACE,UAAU,CAAE+B,QAAQ,CAAC9F,qBAAqB,CAAG,GAAG,CAAG,CAAC,CAAE,CAAAgE,QAAA,CAC7DjB,GAAA,CAACgD,QAAQ,CAAA,CACPjB,IAAI,CAAEkB,WAAW,CAAC,CAAEvH,eAAe,CAAfA,eAAe,CAAEwH,WAAW,CAAEP,OAAO,CAACpI,QAAQ,CAAE,CAAC,CAAE,CACvEA,QAAQ,CAAEA,QAAS,CACnBD,SAAS,CAAEA,SAAU,CACrBmB,WAAW,CAAEA,WAAY,CACzB4B,UAAU,CAAEA,UAAW,CACvBC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BrB,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CACH,CAAA,CAAA,CAAC,CAEd,CAAC,CAEK,IAAAmG,QAAQ,CAAG3B,cAAK,CAACyC,UAAU,CAAoCjJ,SAAS;;;;"}
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 // 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","_inputRefs$index$curr","focus","_inputRefs$index2","_inputRefs$index2$cur","select","handleOnChange","_ref3","currentOtpIndex","trim","lastFilledIndex","Math","min","_value$trim","newValue","handleOnInput","_ref4","handleOnKeyDown","_ref5","key","event","preventDefault","getHiddenInput","_ref6","_jsx","hidden","id","readOnly","getOTPInputFields","inputs","_loop","_otpValue$index","_Array$from$index","currentValue","React","createRef","currentInputType","push","BaseBox","flex","marginLeft","children","BaseInput","Object","assign","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":";;;;;;;;;;;;;;;;;;;;;;;;;0dAyHA,IAAMA,aAAa,CAAGC,eAAe,EAAE,GAAK,cAAc,CAK1D,IAAMC,UAAU,CAAG,SAAbA,UAAUA,CAAIC,IAAa,CAAAC,CAAAA,IAAAA,WAAA,CAAAA,OAAAA,CAAAA,WAAA,CAAeD,IAAI,EAAJA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,IAAI,CAAEE,KAAK,CAAC,EAAE,CAAC,GAAAD,IAAAA,CAAAA,WAAA,CAAIE,KAAK,CAAC,CAAC,CAAC,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AAE,CAAC,OAAO,CACVH,QAAQ,CAAE/H,aAAc,CACxBmI,OAAO,CAAE7F,OAAQ,CACjBlB,IAAI,CAAEA,IAAK,CACXnB,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAAAoG,QAAA,CAE5BxG,KAAK,CACG,CACZ,CACDyH,IAAA,CAACpB,OAAO,CAAA,CAACyB,OAAO,CAAC,MAAM,CAACC,aAAa,CAAC,KAAK,CAAAvB,QAAA,CACxCnB,CAAAA,cAAc,EAAE,CAChBM,iBAAiB,EAAE,CACb,CAAA,CAAC,EACH,CAAC,CAGVJ,GAAA,CAACc,OAAO,CAAA,CAACE,UAAU,CAAE+B,QAAQ,CAACjG,qBAAqB,CAAG,GAAG,CAAG,CAAC,CAAE,CAAAmE,QAAA,CAC7DjB,GAAA,CAACgD,QAAQ,CACPjB,CAAAA,IAAI,CAAEkB,WAAW,CAAC,CAAE1H,eAAe,CAAfA,eAAe,CAAE2H,WAAW,CAAEP,OAAO,CAACvI,QAAQ,CAAE,CAAC,CAAE,CACvEA,QAAQ,CAAEA,QAAS,CACnBD,SAAS,CAAEA,SAAU,CACrBmB,WAAW,CAAEA,WAAY,CACzB4B,UAAU,CAAEA,UAAW,CACvBC,WAAW,CAAEA,WAAY,CACzBC,aAAa,CAAEA,aAAc,CAC7BrB,IAAI,CAAEA,IAAK,CACZ,CAAC,CACK,CAAC,CAAA,CAAA,CACH,CAAC,CAEd,CAAC,CAEK,IAAAsG,QAAQ,CAAG3B,cAAK,CAACyC,UAAU,CAAoCpJ,SAAS;;;;"}
@@ -1,10 +1,14 @@
1
- import '../Typography/index.js';
1
+ import React__default from 'react';
2
+ import { findNodeHandle, UIManager, View } from 'react-native';
3
+ import Animated, { useSharedValue, withTiming, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
4
+ import { useMemoizedStyles } from '../Box/BaseBox/useMemoizedStyles.native.js';
5
+ import '../../utils/index.js';
2
6
  import '../../utils/logger/index.js';
3
- import { jsx } from 'react/jsx-runtime';
4
- import { throwBladeError } from '../../utils/logger/logger.js';
5
- import { Text } from '../Typography/Text/Text.js';
7
+ import { jsx, Fragment } from 'react/jsx-runtime';
8
+ import useTheme from '../BladeProvider/useTheme.js';
9
+ import { logger } from '../../utils/logger/logger.js';
6
10
 
7
- var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Morph/Morph.native.tsx";var Morph=function Morph(_props){throwBladeError({message:'Morph is not yet implemented for native',moduleName:'Morph'});return jsx(Text,{children:"Morph Component is not available for Native mobile apps."});};
11
+ var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Morph/Morph.native.tsx";var liveLayouts=new Map();var pendingHandoffs=new Map();var handoffTimers=new Map();var HANDOFF_TTL_MS=1500;var measureNodeInWindow=function measureNodeInWindow(node,onMeasured){if(!node)return;var handle=findNodeHandle(node);if(handle!=null&&typeof UIManager.measureInWindow==='function'){UIManager.measureInWindow(handle,function(x,y,width,height){if(!(width>0&&height>0))return;onMeasured({x:x,y:y,width:width,height:height,ts:Date.now()});});return;}var measurable=node;if(typeof measurable.measure==='function'){measurable.measure(function(_x,_y,width,height,pageX,pageY){if(!(width>0&&height>0))return;onMeasured({x:pageX,y:pageY,width:width,height:height,ts:Date.now()});});}};var Morph=function Morph(_ref){var _ref2,_theme$motion$duratio;var children=_ref.children,layoutId=_ref.layoutId;var _useTheme=useTheme(),theme=_useTheme.theme;var measureRef=React__default.useRef(null);var lastKnownLayout=React__default.useRef(null);var incomingHandoff=React__default.useRef(null);var hasPlayedHandoff=React__default.useRef(false);var rafIdRef=React__default.useRef(null);var isValidChild=React__default.isValidElement(children);var childProps=(_ref2=children==null?void 0:children.props)!=null?_ref2:{};var rawBorderRadius=childProps.borderRadius;var rawBackgroundColor=childProps.backgroundColor;var cssProps=useMemoizedStyles({borderRadius:rawBorderRadius,backgroundColor:rawBackgroundColor,theme:theme});var toRadius=typeof cssProps.borderRadius==='number'?cssProps.borderRadius:undefined;var toColor=typeof cssProps.backgroundColor==='string'?cssProps.backgroundColor:undefined;var progress=useSharedValue(0);var fromRadius=useSharedValue(toRadius!=null?toRadius:0);var toRadiusSV=useSharedValue(toRadius!=null?toRadius:0);var fromColor=useSharedValue(toColor!=null?toColor:'transparent');var toColorSV=useSharedValue(toColor!=null?toColor:'transparent');var translateX=useSharedValue(0);var translateY=useSharedValue(0);var scaleX=useSharedValue(1);var scaleY=useSharedValue(1);var opacity=useSharedValue(0);var duration=(_theme$motion$duratio=theme.motion.duration.gentle)!=null?_theme$motion$duratio:theme.motion.duration.moderate;var easing=theme.motion.easing.standard;var timingConfig=React__default.useMemo(function(){return {duration:duration,easing:easing};},[duration,easing]);React__default.useLayoutEffect(function(){var prev=pendingHandoffs.get(layoutId);if(prev&&Date.now()-prev.ts<HANDOFF_TTL_MS){pendingHandoffs.delete(layoutId);var timer=handoffTimers.get(layoutId);if(timer){clearTimeout(timer);handoffTimers.delete(layoutId);}incomingHandoff.current=prev;if(__DEV__){logger({moduleName:'Morph',type:'log',message:`consumed handoff for "${layoutId}" from y=${Math.round(prev.y)}`});}}return function(){var _liveLayouts$get;var live=(_liveLayouts$get=liveLayouts.get(layoutId))!=null?_liveLayouts$get:lastKnownLayout.current;if(live){pendingHandoffs.set(layoutId,Object.assign({},live,{ts:Date.now()}));var existingTimer=handoffTimers.get(layoutId);if(existingTimer)clearTimeout(existingTimer);handoffTimers.set(layoutId,setTimeout(function(){pendingHandoffs.delete(layoutId);handoffTimers.delete(layoutId);},HANDOFF_TTL_MS));if(__DEV__){logger({moduleName:'Morph',type:'log',message:`stashed handoff for "${layoutId}" at y=${Math.round(live.y)}`});}}liveLayouts.delete(layoutId);};},[layoutId]);var playHandoffIfNeeded=React__default.useCallback(function(current){lastKnownLayout.current=current;liveLayouts.set(layoutId,current);if(hasPlayedHandoff.current)return;var prev=incomingHandoff.current;if(prev&&prev.width>0&&prev.height>0){var isSameElement=Math.abs(prev.width-current.width)<1&&Math.abs(prev.height-current.height)<1&&Math.abs(prev.x-current.x)<1&&Math.abs(prev.y-current.y)<1;if(isSameElement){incomingHandoff.current=null;hasPlayedHandoff.current=true;opacity.value=withTiming(1,{duration:theme.motion.duration.xquick,easing:easing});return;}hasPlayedHandoff.current=true;incomingHandoff.current=null;var startTX=prev.x+prev.width/2-(current.x+current.width/2);var startTY=prev.y+prev.height/2-(current.y+current.height/2);var startSX=Math.max(0.01,prev.width/current.width);var startSY=Math.max(0.01,prev.height/current.height);if(__DEV__){logger({moduleName:'Morph',type:'log',message:`FLIP "${layoutId}" Δy=${Math.round(startTY)} scale=${startSX.toFixed(2)}`});}translateX.value=startTX;translateY.value=startTY;scaleX.value=startSX;scaleY.value=startSY;opacity.value=1;rafIdRef.current=requestAnimationFrame(function(){rafIdRef.current=null;translateX.value=withTiming(0,timingConfig);translateY.value=withTiming(0,timingConfig);scaleX.value=withTiming(1,timingConfig);scaleY.value=withTiming(1,timingConfig);});return;}hasPlayedHandoff.current=true;opacity.value=withTiming(1,{duration:theme.motion.duration.xquick,easing:easing});},[layoutId,timingConfig,theme.motion.duration.xquick,easing]);React__default.useEffect(function(){fromRadius.value=toRadiusSV.value;toRadiusSV.value=toRadius!=null?toRadius:fromRadius.value;fromColor.value=toColorSV.value;toColorSV.value=toColor!=null?toColor:fromColor.value;progress.value=0;progress.value=withTiming(1,timingConfig);},[toColor,toRadius]);var onLayout=React__default.useCallback(function(_e){measureNodeInWindow(measureRef.current,playHandoffIfNeeded);},[playHandoffIfNeeded]);React__default.useEffect(function(){var ids=[32,100,250].map(function(ms){return setTimeout(function(){if(!hasPlayedHandoff.current){measureNodeInWindow(measureRef.current,playHandoffIfNeeded);}},ms);});var safetyNetId=setTimeout(function(){if(!hasPlayedHandoff.current){hasPlayedHandoff.current=true;opacity.value=withTiming(1,{duration:theme.motion.duration.xquick,easing:easing});if(__DEV__){logger({moduleName:'Morph',type:'warn',message:`safety-net timeout fired for "${layoutId}" revealing without FLIP`});}}},500);return function(){ids.forEach(clearTimeout);clearTimeout(safetyNetId);if(rafIdRef.current!==null){cancelAnimationFrame(rafIdRef.current);rafIdRef.current=null;}};},[playHandoffIfNeeded]);var animatedStyle=useAnimatedStyle(function(){var style={opacity:opacity.value,transform:[{translateX:translateX.value},{translateY:translateY.value},{scaleX:scaleX.value},{scaleY:scaleY.value}]};if(toColor!==undefined){style.backgroundColor=interpolateColor(progress.value,[0,1],[fromColor.value,toColorSV.value]);}if(toRadius!==undefined){style.borderRadius=fromRadius.value+(toRadiusSV.value-fromRadius.value)*progress.value;}return style;});if(!isValidChild){return jsx(Fragment,{children:children});}var child=React__default.cloneElement(children,{backgroundColor:undefined,borderRadius:undefined});return(jsx(View,{ref:measureRef,collapsable:false,onLayout:onLayout,style:{alignSelf:'center'},children:jsx(Animated.View,{style:animatedStyle,children:child})}));};
8
12
 
9
13
  export { Morph };
10
14
  //# sourceMappingURL=Morph.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Morph.native.js","sources":["../../../../../src/components/Morph/Morph.native.tsx"],"sourcesContent":["import type { MorphProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Morph = (_props: MorphProps): React.ReactElement => {\n throwBladeError({\n message: 'Morph is not yet implemented for native',\n moduleName: 'Morph',\n });\n\n return <Text>Morph Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Morph };\n"],"names":["Morph","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;sHAIM,IAAAA,KAAK,CAAG,SAARA,KAAKA,CAAIC,MAAkB,CAAyB,CACxDC,eAAe,CAAC,CACdC,OAAO,CAAE,yCAAyC,CAClDC,UAAU,CAAE,OACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E;;;;"}
1
+ {"version":3,"file":"Morph.native.js","sources":["../../../../../src/components/Morph/Morph.native.tsx"],"sourcesContent":["import React from 'react';\nimport { findNodeHandle, UIManager, View } from 'react-native';\nimport type { LayoutChangeEvent, ViewStyle } from 'react-native';\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withTiming,\n interpolateColor,\n} from 'react-native-reanimated';\nimport type { MorphProps } from './types';\nimport { useMemoizedStyles } from '~components/Box/BaseBox/useMemoizedStyles';\nimport type { BoxProps } from '~components/Box';\nimport type { Theme } from '~components/BladeProvider';\nimport { useTheme } from '~utils';\nimport { logger } from '~utils/logger';\n\ntype LayoutRect = {\n x: number;\n y: number;\n width: number;\n height: number;\n ts: number;\n};\n\n/**\n * Live window bounds for currently mounted Morphs (updated on every layout).\n * Copied into `pendingHandoffs` on unmount so the next Morph with the same\n * `layoutId` can FLIP from the previous element's position (e.g. card center → page top).\n */\nconst liveLayouts = new Map<string, LayoutRect>();\nconst pendingHandoffs = new Map<string, LayoutRect>();\n// Timers for self-expiring pendingHandoffs entries, keyed by layoutId.\nconst handoffTimers = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst HANDOFF_TTL_MS = 1500;\n\nconst measureNodeInWindow = (node: View | null, onMeasured: (rect: LayoutRect) => void): void => {\n if (!node) return;\n\n // Prefer UIManager + findNodeHandle — reliable for both View and host refs.\n const handle = findNodeHandle(node);\n if (handle != null && typeof UIManager.measureInWindow === 'function') {\n UIManager.measureInWindow(handle, (x, y, width, height) => {\n if (!(width > 0 && height > 0)) return;\n onMeasured({ x, y, width, height, ts: Date.now() });\n });\n return;\n }\n\n // Fallback: View.measure → pageX / pageY are window-relative.\n const measurable = node as View & {\n measure?: (\n cb: (x: number, y: number, w: number, h: number, pageX: number, pageY: number) => void,\n ) => void;\n };\n if (typeof measurable.measure === 'function') {\n measurable.measure((_x, _y, width, height, pageX, pageY) => {\n if (!(width > 0 && height > 0)) return;\n onMeasured({ x: pageX, y: pageY, width, height, ts: Date.now() });\n });\n }\n};\n\n/**\n * Morph (native) — approximates web framer `layout`/`layoutId` FLIP.\n *\n * MorphOnText: card heading (center) unmounts → page Display (top) mounts starting at the\n * card's window position, then animates to the top.\n */\nconst Morph = ({ children, layoutId }: MorphProps): React.ReactElement => {\n const { theme } = useTheme();\n const measureRef = React.useRef<View>(null);\n const lastKnownLayout = React.useRef<LayoutRect | null>(null);\n const incomingHandoff = React.useRef<LayoutRect | null>(null);\n const hasPlayedHandoff = React.useRef(false);\n const rafIdRef = React.useRef<number | null>(null);\n\n // Determine child validity before any hooks that depend on child props.\n // All hooks below MUST be called unconditionally (Rules of Hooks).\n const isValidChild = React.isValidElement(children);\n const childProps = (children?.props as Record<string, unknown>) ?? {};\n const rawBorderRadius = childProps.borderRadius;\n const rawBackgroundColor = childProps.backgroundColor;\n\n const cssProps = useMemoizedStyles(({\n borderRadius: rawBorderRadius,\n backgroundColor: rawBackgroundColor,\n theme,\n } as unknown) as BoxProps & { theme: Theme });\n\n const toRadius = typeof cssProps.borderRadius === 'number' ? cssProps.borderRadius : undefined;\n const toColor =\n typeof cssProps.backgroundColor === 'string' ? cssProps.backgroundColor : undefined;\n\n const progress = useSharedValue(0);\n const fromRadius = useSharedValue(toRadius ?? 0);\n const toRadiusSV = useSharedValue(toRadius ?? 0);\n const fromColor = useSharedValue(toColor ?? 'transparent');\n const toColorSV = useSharedValue(toColor ?? 'transparent');\n\n const translateX = useSharedValue(0);\n const translateY = useSharedValue(0);\n const scaleX = useSharedValue(1);\n const scaleY = useSharedValue(1);\n // Hidden until we know whether to FLIP from a previous layoutId instance.\n const opacity = useSharedValue(0);\n\n const duration = theme.motion.duration.gentle ?? theme.motion.duration.moderate;\n const easing = theme.motion.easing.standard;\n const timingConfig = React.useMemo(() => ({ duration, easing }), [duration, easing]);\n\n // Grab any pending handoff synchronously before paint of children that replace us.\n React.useLayoutEffect(() => {\n const prev = pendingHandoffs.get(layoutId);\n if (prev && Date.now() - prev.ts < HANDOFF_TTL_MS) {\n pendingHandoffs.delete(layoutId);\n // Clear any pending self-expiry timer since we consumed the entry.\n const timer = handoffTimers.get(layoutId);\n if (timer) {\n clearTimeout(timer);\n handoffTimers.delete(layoutId);\n }\n incomingHandoff.current = prev;\n if (__DEV__) {\n logger({\n moduleName: 'Morph',\n type: 'log',\n message: `consumed handoff for \"${layoutId}\" from y=${Math.round(prev.y)}`,\n });\n }\n }\n\n return () => {\n const live = liveLayouts.get(layoutId) ?? lastKnownLayout.current;\n if (live) {\n pendingHandoffs.set(layoutId, { ...live, ts: Date.now() });\n // Self-expiry: if no subsequent Morph with the same layoutId consumes this\n // entry within the TTL, clean it up to prevent unbounded Map growth.\n const existingTimer = handoffTimers.get(layoutId);\n if (existingTimer) clearTimeout(existingTimer);\n handoffTimers.set(\n layoutId,\n setTimeout(() => {\n pendingHandoffs.delete(layoutId);\n handoffTimers.delete(layoutId);\n }, HANDOFF_TTL_MS),\n );\n if (__DEV__) {\n logger({\n moduleName: 'Morph',\n type: 'log',\n message: `stashed handoff for \"${layoutId}\" at y=${Math.round(live.y)}`,\n });\n }\n }\n liveLayouts.delete(layoutId);\n };\n }, [layoutId]);\n\n const playHandoffIfNeeded = React.useCallback(\n (current: LayoutRect): void => {\n lastKnownLayout.current = current;\n liveLayouts.set(layoutId, current);\n\n if (hasPlayedHandoff.current) return;\n\n const prev = incomingHandoff.current;\n if (prev && prev.width > 0 && prev.height > 0) {\n // Strict Mode guard: in dev, React mounts → unmounts → remounts. The cleanup\n // stashes the live layout into pendingHandoffs, and the second mount consumes\n // it — causing a spurious self-FLIP. Skip if the incoming handoff dimensions\n // match the current element's dimensions (same element, not a true handoff).\n const isSameElement =\n Math.abs(prev.width - current.width) < 1 &&\n Math.abs(prev.height - current.height) < 1 &&\n Math.abs(prev.x - current.x) < 1 &&\n Math.abs(prev.y - current.y) < 1;\n if (isSameElement) {\n incomingHandoff.current = null;\n hasPlayedHandoff.current = true;\n opacity.value = withTiming(1, { duration: theme.motion.duration.xquick, easing });\n return;\n }\n\n hasPlayedHandoff.current = true;\n incomingHandoff.current = null;\n\n const startTX = prev.x + prev.width / 2 - (current.x + current.width / 2);\n const startTY = prev.y + prev.height / 2 - (current.y + current.height / 2);\n const startSX = Math.max(0.01, prev.width / current.width);\n const startSY = Math.max(0.01, prev.height / current.height);\n\n if (__DEV__) {\n logger({\n moduleName: 'Morph',\n type: 'log',\n message: `FLIP \"${layoutId}\" Δy=${Math.round(startTY)} scale=${startSX.toFixed(2)}`,\n });\n }\n\n // Pose at previous element (center of card) first…\n translateX.value = startTX;\n translateY.value = startTY;\n scaleX.value = startSX;\n scaleY.value = startSY;\n opacity.value = 1;\n\n // …then animate to natural layout (top).\n rafIdRef.current = requestAnimationFrame(() => {\n rafIdRef.current = null;\n translateX.value = withTiming(0, timingConfig);\n translateY.value = withTiming(0, timingConfig);\n scaleX.value = withTiming(1, timingConfig);\n scaleY.value = withTiming(1, timingConfig);\n });\n return;\n }\n\n // Cold mount — fade in at natural position.\n hasPlayedHandoff.current = true;\n opacity.value = withTiming(1, { duration: theme.motion.duration.xquick, easing });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [layoutId, timingConfig, theme.motion.duration.xquick, easing],\n );\n\n React.useEffect(() => {\n fromRadius.value = toRadiusSV.value;\n toRadiusSV.value = toRadius ?? fromRadius.value;\n fromColor.value = toColorSV.value;\n toColorSV.value = toColor ?? fromColor.value;\n progress.value = 0;\n progress.value = withTiming(1, timingConfig);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [toColor, toRadius]);\n\n const onLayout = React.useCallback(\n (_e: LayoutChangeEvent) => {\n measureNodeInWindow(measureRef.current, playHandoffIfNeeded);\n },\n [playHandoffIfNeeded],\n );\n\n // Retry measure — first onLayout can run before text has intrinsic size.\n React.useEffect(() => {\n const ids = [32, 100, 250].map((ms) =>\n setTimeout(() => {\n if (!hasPlayedHandoff.current) {\n measureNodeInWindow(measureRef.current, playHandoffIfNeeded);\n }\n }, ms),\n );\n // Safety-net: if all measurement attempts fail (off-screen, zero size, unresponsive\n // bridge), unconditionally reveal the element so it doesn't stay invisible forever.\n const safetyNetId = setTimeout(() => {\n if (!hasPlayedHandoff.current) {\n hasPlayedHandoff.current = true;\n opacity.value = withTiming(1, { duration: theme.motion.duration.xquick, easing });\n if (__DEV__) {\n logger({\n moduleName: 'Morph',\n type: 'warn',\n message: `safety-net timeout fired for \"${layoutId}\" — revealing without FLIP`,\n });\n }\n }\n }, 500);\n return () => {\n ids.forEach(clearTimeout);\n clearTimeout(safetyNetId);\n if (rafIdRef.current !== null) {\n cancelAnimationFrame(rafIdRef.current);\n rafIdRef.current = null;\n }\n };\n }, [playHandoffIfNeeded]);\n\n const animatedStyle = useAnimatedStyle(() => {\n const style: ViewStyle = {\n opacity: opacity.value,\n transform: [\n { translateX: translateX.value },\n { translateY: translateY.value },\n { scaleX: scaleX.value },\n { scaleY: scaleY.value },\n ],\n };\n if (toColor !== undefined) {\n style.backgroundColor = interpolateColor(\n progress.value,\n [0, 1],\n [fromColor.value, toColorSV.value],\n );\n }\n if (toRadius !== undefined) {\n style.borderRadius =\n fromRadius.value + (toRadiusSV.value - fromRadius.value) * progress.value;\n }\n return style;\n });\n\n // Guard: Morph expects a single React element child (e.g. <Box>) so it can read\n // borderRadius/backgroundColor from props and clone it. Strings, numbers, arrays,\n // fragments, or null are not valid — render them as-is without animation.\n // This early return is placed AFTER all hooks to satisfy the Rules of Hooks.\n if (!isValidChild) {\n return <>{children}</>;\n }\n\n const child = React.cloneElement(children, {\n backgroundColor: undefined,\n borderRadius: undefined,\n } as Partial<Record<string, undefined>> & React.Attributes);\n\n return (\n // Outer RN View owns measurement; inner Reanimated view owns the FLIP transform.\n <View ref={measureRef} collapsable={false} onLayout={onLayout} style={{ alignSelf: 'center' }}>\n <Animated.View style={animatedStyle}>{child}</Animated.View>\n </View>\n );\n};\n\nexport { Morph };\n"],"names":["liveLayouts","Map","pendingHandoffs","handoffTimers","HANDOFF_TTL_MS","measureNodeInWindow","node","onMeasured","handle","findNodeHandle","UIManager","measureInWindow","x","y","width","height","ts","Date","now","measurable","measure","_x","_y","pageX","pageY","Morph","_ref","_ref2","_theme$motion$duratio","children","layoutId","_useTheme","useTheme","theme","measureRef","React","useRef","lastKnownLayout","incomingHandoff","hasPlayedHandoff","rafIdRef","isValidChild","isValidElement","childProps","props","rawBorderRadius","borderRadius","rawBackgroundColor","backgroundColor","cssProps","useMemoizedStyles","toRadius","undefined","toColor","progress","useSharedValue","fromRadius","toRadiusSV","fromColor","toColorSV","translateX","translateY","scaleX","scaleY","opacity","duration","motion","gentle","moderate","easing","standard","timingConfig","useMemo","useLayoutEffect","prev","get","delete","timer","clearTimeout","current","__DEV__","logger","moduleName","type","message","Math","round","_liveLayouts$get","live","set","Object","assign","existingTimer","setTimeout","playHandoffIfNeeded","useCallback","isSameElement","abs","value","withTiming","xquick","startTX","startTY","startSX","max","startSY","toFixed","requestAnimationFrame","useEffect","onLayout","_e","ids","map","ms","safetyNetId","forEach","cancelAnimationFrame","animatedStyle","useAnimatedStyle","style","transform","interpolateColor","_jsx","_Fragment","child","cloneElement","View","ref","collapsable","alignSelf","Animated"],"mappings":";;;;;;;;;;sHA6BA,IAAMA,WAAW,CAAG,IAAIC,GAAG,EAAsB,CACjD,IAAMC,eAAe,CAAG,IAAID,GAAG,EAAsB,CAErD,IAAME,aAAa,CAAG,IAAIF,GAAG,EAAyC,CAEtE,IAAMG,cAAc,CAAG,IAAI,CAE3B,IAAMC,mBAAmB,CAAG,SAAtBA,mBAAmBA,CAAIC,IAAiB,CAAEC,UAAsC,CAAW,CAC/F,GAAI,CAACD,IAAI,CAAE,OAGX,IAAME,MAAM,CAAGC,cAAc,CAACH,IAAI,CAAC,CACnC,GAAIE,MAAM,EAAI,IAAI,EAAI,OAAOE,SAAS,CAACC,eAAe,GAAK,UAAU,CAAE,CACrED,SAAS,CAACC,eAAe,CAACH,MAAM,CAAE,SAACI,CAAC,CAAEC,CAAC,CAAEC,KAAK,CAAEC,MAAM,CAAK,CACzD,GAAI,EAAED,KAAK,CAAG,CAAC,EAAIC,MAAM,CAAG,CAAC,CAAC,CAAE,OAChCR,UAAU,CAAC,CAAEK,CAAC,CAADA,CA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 import 'react';
2
+ import '../BaseMotion/index.js';
3
+ import { msToSeconds } from '../../utils/msToSeconds.js';
4
+ import '../../utils/index.js';
3
5
  import { jsx } from 'react/jsx-runtime';
4
- import { throwBladeError } from '../../utils/logger/logger.js';
5
- import { Text } from '../Typography/Text/Text.js';
6
+ import useTheme from '../BladeProvider/useTheme.js';
7
+ import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
8
+ import { BaseMotionEntryExit } from '../BaseMotion/BaseMotion.native.js';
6
9
 
7
- var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Move/Move.native.tsx";var Move=function Move(_props){throwBladeError({message:'Move is not yet implemented for native',moduleName:'Move'});return jsx(Text,{children:"Move Component is not available for Native mobile apps."});};
10
+ var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Move/Move.native.tsx";var ENTRANCE_EASING=[0,0,0.2,1];var EXIT_EASING=[0.17,0,1,1];var Move=function Move(_ref){var children=_ref.children,_ref$type=_ref.type,type=_ref$type===void 0?'inout':_ref$type,isVisible=_ref.isVisible,motionTriggers=_ref.motionTriggers,shouldUnmountWhenHidden=_ref.shouldUnmountWhenHidden,delay=_ref.delay;var _useTheme=useTheme(),theme=_useTheme.theme;var enterDelay=typeof delay==='object'?delay.enter:delay;var exitDelay=typeof delay==='object'?delay.exit:delay;var movePx=makeSpace(theme.spacing[5]);var moveVariants={initial:{opacity:0,transform:`translateY(${movePx})`},animate:{opacity:1,transform:`translateY(${makeSpace(theme.spacing[0])})`,transition:Object.assign({},enterDelay?{delay:msToSeconds(theme.motion.delay[enterDelay])}:{},{duration:msToSeconds(theme.motion.duration.xmoderate),ease:[].concat(ENTRANCE_EASING)})},exit:{opacity:0,transform:`translateY(${movePx})`,transition:Object.assign({},exitDelay?{delay:msToSeconds(theme.motion.delay[exitDelay])}:{},{duration:msToSeconds(theme.motion.duration.quick),ease:[].concat(EXIT_EASING)})}};return jsx(BaseMotionEntryExit,{motionVariants:moveVariants,children:children,type:type,isVisible:isVisible,motionTriggers:motionTriggers,shouldUnmountWhenHidden:shouldUnmountWhenHidden});};
8
11
 
9
12
  export { Move };
10
13
  //# sourceMappingURL=Move.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Move.native.js","sources":["../../../../../src/components/Move/Move.native.tsx"],"sourcesContent":["import type { MoveProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Move = (_props: MoveProps): React.ReactElement => {\n throwBladeError({\n message: 'Move is not yet implemented for native',\n moduleName: 'Move',\n });\n\n return <Text>Move Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Move };\n"],"names":["Move","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;oHAIM,IAAAA,IAAI,CAAG,SAAPA,IAAIA,CAAIC,MAAiB,CAAyB,CACtDC,eAAe,CAAC,CACdC,OAAO,CAAE,wCAAwC,CACjDC,UAAU,CAAE,MACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,yDAAuD,CAAM,CAAC,CAC7E;;;;"}
1
+ {"version":3,"file":"Move.native.js","sources":["../../../../../src/components/Move/Move.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { MoveProps } from './types';\nimport { BaseMotionEntryExit } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { makeSpace, useTheme } from '~utils';\n\n// The native interpreter (`baseMotionInterpreter.native.ts` → `getTiming`) expects `ease` as a\n// [x1, y1, x2, y2] cubic-bezier array. On native, `theme.motion.easing.*` is an opaque\n// `EasingFactoryFn` (not a `cubic-bezier(...)` string), so `cssBezierToArray(castWebType(...))`\n// would crash. We mirror the token control points directly instead.\n// Keep in sync with tokens/global/motion.ts (easing.entrance / easing.exit).\nconst ENTRANCE_EASING = [0, 0, 0.2, 1] as const; // matches easing.entrance\nconst EXIT_EASING = [0.17, 0, 1, 1] as const; // matches easing.exit\n\n/**\n * ## Move\n *\n * Move is one of the motion presets that we expose from blade to help you make components appear / disappear with move\n *\n * ### Usage\n *\n * #### Move in on mount\n *\n * ```jsx\n * <Move>\n * <Card />\n * </Move>\n * ```\n *\n * #### Conditionally move based on state\n *\n * ```jsx\n * <Move isVisible={isVisibleState}>\n * <Card />\n * </Move>\n * ```\n */\nconst Move = ({\n children,\n type = 'inout',\n isVisible,\n motionTriggers,\n shouldUnmountWhenHidden,\n delay,\n}: MoveProps): React.ReactElement => {\n const { theme } = useTheme();\n const enterDelay = typeof delay === 'object' ? delay.enter : delay;\n const exitDelay = typeof delay === 'object' ? delay.exit : delay;\n\n const movePx = makeSpace(theme.spacing[5]);\n\n const moveVariants: MotionVariantsType = {\n initial: {\n opacity: 0,\n transform: `translateY(${movePx})`,\n },\n animate: {\n opacity: 1,\n transform: `translateY(${makeSpace(theme.spacing[0])})`,\n transition: {\n // We have to make sure we don't add delay prop because if we define it, it takes precedence in stagger.\n // Even setting `undefined` would break the stagger\n ...(enterDelay ? { delay: msToSeconds(theme.motion.delay[enterDelay]) } : {}),\n duration: msToSeconds(theme.motion.duration.xmoderate),\n ease: [...ENTRANCE_EASING],\n },\n },\n exit: {\n opacity: 0,\n transform: `translateY(${movePx})`,\n transition: {\n ...(exitDelay ? { delay: msToSeconds(theme.motion.delay[exitDelay]) } : {}),\n duration: msToSeconds(theme.motion.duration.quick),\n ease: [...EXIT_EASING],\n },\n },\n };\n\n return (\n <BaseMotionEntryExit\n motionVariants={moveVariants}\n children={children}\n type={type}\n isVisible={isVisible}\n motionTriggers={motionTriggers}\n shouldUnmountWhenHidden={shouldUnmountWhenHidden}\n />\n );\n};\n\nexport { Move };\n"],"names":["this","ENTRANCE_EASING","EXIT_EASING","Move","_ref","children","_ref$type","type","isVisible","motionTriggers","shouldUnmountWhenHidden","delay","_useTheme","useTheme","theme","enterDelay","enter","exitDelay","exit","movePx","makeSpace","spacing","moveVariants","initial","opacity","transform","animate","transition","Object","assign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,CAACN,KAAK,CAACO,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CACvDM,UAAU,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CAGJd,UAAU,CAAG,CAAEJ,KAAK,CAAEmB,WAAW,CAAChB,KAAK,CAACiB,MAAM,CAACpB,KAAK,CAACI,UAAU,CAAC,CAAE,CAAC,CAAG,EAAE,CAC5EiB,CAAAA,QAAQ,CAAEF,WAAW,CAAChB,KAAK,CAACiB,MAAM,CAACC,QAAQ,CAACC,SAAS,CAAC,CACtDC,IAAI,CAAA,EAAA,CAAAC,MAAA,CAAMlC,eAAe,CAAC,CAE9B,CAAA,CAAC,CACDiB,IAAI,CAAE,CACJM,OAAO,CAAE,CAAC,CACVC,SAAS,CAAE,CAAcN,WAAAA,EAAAA,MAAM,CAAG,CAAA,CAAA,CAClCQ,UAAU,CAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,CACJZ,SAAS,CAAG,CAAEN,KAAK,CAAEmB,WAAW,CAAChB,KAAK,CAACiB,MAAM,CAACpB,KAAK,CAACM,SAAS,CAAC,CAAE,CAAC,CAAG,EAAE,CAC1Ee,CAAAA,QAAQ,CAAEF,WAAW,CAAChB,KAAK,CAACiB,MAAM,CAACC,QAAQ,CAACI,KAAK,CAAC,CAClDF,IAAI,CAAA,EAAA,CAAAC,MAAA,CAAMjC,WAAW,CAAC,CAAA,CAE1B,CACF,CAAC,CAED,OACEmC,GAAA,CAACC,mBAAmB,EAClBC,cAAc,CAAEjB,YAAa,CAC7BjB,QAAQ,CAAEA,QAAS,CACnBE,IAAI,CAAEA,IAAK,CACXC,SAAS,CAAEA,SAAU,CACrBC,cAAc,CAAEA,cAAe,CAC/BC,uBAAuB,CAAEA,uBAAwB,CAClD,CAAC,CAEN;;;;"}
@@ -1,10 +1,12 @@
1
- import '../Typography/index.js';
2
- import '../../utils/logger/index.js';
1
+ import 'react';
2
+ import '../BaseMotion/index.js';
3
+ import { msToSeconds } from '../../utils/msToSeconds.js';
4
+ import '../../utils/index.js';
3
5
  import { jsx } from 'react/jsx-runtime';
4
- import { throwBladeError } from '../../utils/logger/logger.js';
5
- import { Text } from '../Typography/Text/Text.js';
6
+ import useTheme from '../BladeProvider/useTheme.js';
7
+ import { BaseMotionEnhancerBox } from '../BaseMotion/BaseMotion.native.js';
6
8
 
7
- var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Scale/Scale.native.tsx";var Scale=function Scale(_props){throwBladeError({message:'Scale is not yet implemented for native',moduleName:'Scale'});return jsx(Text,{children:"Scale Component is not available for Native mobile apps."});};
9
+ var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Scale/Scale.native.tsx";var STANDARD_EASING=[0.3,0,0.2,1];var Scale=function Scale(_ref){var children=_ref.children,isHighlighted=_ref.isHighlighted,_ref$type=_ref.type,type=_ref$type===void 0?'inout':_ref$type,_ref$variant=_ref.variant,variant=_ref$variant===void 0?'scale-up':_ref$variant,motionTriggers=_ref.motionTriggers;var isControlledHighlighted=typeof isHighlighted==='boolean';var defaultMotionTriggers=isControlledHighlighted?['mount']:['hover'];var _useTheme=useTheme(),theme=_useTheme.theme;var targetScale=variant==='scale-up'?1.05:0.98;var scaleVariants={initial:{scale:1},animate:{scale:targetScale,transition:{duration:msToSeconds(theme.motion.duration.moderate),ease:[].concat(STANDARD_EASING)}},exit:{scale:1}};return jsx(BaseMotionEnhancerBox,Object.assign({motionVariants:scaleVariants,type:type,motionTriggers:motionTriggers!=null?motionTriggers:defaultMotionTriggers},isControlledHighlighted?{animateVisibility:isHighlighted?'animate':'initial'}:{},{children:children}));};
8
10
 
9
11
  export { Scale };
10
12
  //# sourceMappingURL=Scale.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scale.native.js","sources":["../../../../../src/components/Scale/Scale.native.tsx"],"sourcesContent":["import type { ScaleProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Scale = (_props: ScaleProps): React.ReactElement => {\n throwBladeError({\n message: 'Scale is not yet implemented for native',\n moduleName: 'Scale',\n });\n\n return <Text>Scale Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Scale };\n"],"names":["Scale","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;sHAIM,IAAAA,KAAK,CAAG,SAARA,KAAKA,CAAIC,MAAkB,CAAyB,CACxDC,eAAe,CAAC,CACdC,OAAO,CAAE,yCAAyC,CAClDC,UAAU,CAAE,OACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E;;;;"}
1
+ {"version":3,"file":"Scale.native.js","sources":["../../../../../src/components/Scale/Scale.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { ScaleProps } from './types';\nimport { BaseMotionEnhancerBox } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { useTheme } from '~utils';\n\n/**\n * Bezier control points of the `standard` easing token (`cubic-bezier(0.3, 0, 0.2, 1)`).\n *\n * On native `theme.motion.easing.standard` is an `EasingFactoryFn` object (not a CSS string), so\n * `cssBezierToArray` would crash at runtime. The native interpreter expects a 4-number bezier\n * array, so we supply the token's numeric control points directly (matches the web-resolved value).\n */\nconst STANDARD_EASING = [0.3, 0, 0.2, 1] as const;\n\n/**\n * ## Scale\n *\n * Scale is one of the highlight presets that we expose from blade to help you scale up or scale down components based on interactions\n *\n * ### Usage\n *\n * #### Scale up on hover\n *\n * ```jsx\n * <Scale motionTriggers={['hover']}>\n * <Card />\n * </Scale>\n * ```\n *\n * #### Scale down on tap\n *\n * ```jsx\n * <Scale variant=\"scale-down\" motionTriggers={['tap']}>\n * <Card />\n * </Scale>\n * ```\n *\n * #### Conditionally scale\n *\n * ```jsx\n * <Scale isHighlighted={isHighlightedState}>\n * <MyComponent />\n * </Scale>\n * ```\n */\nconst Scale = ({\n children,\n isHighlighted,\n type = 'inout',\n variant = 'scale-up',\n motionTriggers,\n}: ScaleProps): React.ReactElement => {\n const isControlledHighlighted = typeof isHighlighted === 'boolean';\n const defaultMotionTriggers = isControlledHighlighted ? ['mount' as const] : ['hover' as const];\n const { theme } = useTheme();\n\n const targetScale = variant === 'scale-up' ? 1.05 : 0.98;\n\n const scaleVariants: MotionVariantsType = {\n initial: {\n scale: 1,\n },\n animate: {\n // Keep the target scale always defined. On native the interpreter re-animates only when the\n // resolved `targetName` changes (not when variant content changes), so the \"not highlighted\"\n // state is expressed via `animateVisibility: 'initial'` rather than an undefined scale.\n scale: targetScale,\n transition: {\n duration: msToSeconds(theme.motion.duration.moderate),\n ease: [...STANDARD_EASING],\n },\n },\n exit: {\n scale: 1,\n },\n };\n\n return (\n <BaseMotionEnhancerBox\n motionVariants={scaleVariants}\n type={type}\n motionTriggers={motionTriggers ?? defaultMotionTriggers}\n // Native fix: drive the target for the controlled path so toggling `isHighlighted`\n // flips `targetName` between 'animate'/'initial' and actually re-runs the animation.\n {...(isControlledHighlighted\n ? { animateVisibility: isHighlighted ? ('animate' as const) : ('initial' as const) }\n : {})}\n >\n {children}\n </BaseMotionEnhancerBox>\n );\n};\n\nexport { Scale };\n"],"names":["STANDARD_EASING","Scale","_ref","children","isHighlighted","_ref$type","type","_ref$variant","variant","motionTriggers","isControlledHighlighted","defaultMotionTriggers","_useTheme","useTheme","theme","targetScale","scaleVariants","initial","scale","animate","transition","duration","msToSeconds","motion","moderate","ease","concat","exit","_jsx","BaseMotionEnhancerBox","Object","assign","motionVariants","animateVisibility"],"mappings":";;;;;;;;sHAcA,IAAMA,eAAe,CAAG,CAAC,GAAG,CAAE,CAAC,CAAE,GAAG,CAAE,CAAC,CAAU,CAiC3C,IAAAC,KAAK,CAAG,SAARA,KAAKA,CAAAC,IAAA,CAM2B,CAAA,IALpCC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,aAAa,CAAAF,IAAA,CAAbE,aAAa,CAAAC,SA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+1,27 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
+ import React__default from 'react';
4
+ import { View } from 'react-native';
5
+ import { SegmentedControlContext } from './SegmentedControlContext.js';
6
+ import { containerHeight, containerBorderRadius, containerPadding, gap } from './segmentedControlTokens.js';
7
+ import { useControllableState } from '../../utils/useControllable.js';
8
+ import { useId } from '../../utils/useId.js';
9
+ import '../BladeProvider/index.js';
10
+ import '../../utils/metaAttribute/index.js';
11
+ import '../../utils/makeAnalyticsAttribute/index.js';
12
+ import '../Form/index.js';
13
+ import '../Box/BaseBox/index.js';
14
+ import getIn from '../../utils/lodashButBetter/get.js';
15
+ import { jsx, jsxs } from 'react/jsx-runtime';
16
+ import useTheme from '../BladeProvider/useTheme.js';
17
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
18
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
19
+ import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
20
+ import { BaseBox } from '../Box/BaseBox/BaseBox.native.js';
21
+ import { FormLabel } from '../Form/FormLabel.js';
22
+ import { FormHint } from '../Form/FormHint.js';
23
+
24
+ var _excluded=["children","defaultValue","value","onChange","size","isDisabled","name","label","accessibilityLabel","labelPosition","helpText","errorText","validationState","necessityIndicator","testID"];var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/SegmentedControl/SegmentedControl.native.tsx";var _SegmentedControl=function _SegmentedControl(_ref,ref){var children=_ref.children,defaultValue=_ref.defaultValue,value=_ref.value,_onChange=_ref.onChange,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$isDisabled=_ref.isDisabled,isDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,name=_ref.name,label=_ref.label,accessibilityLabel=_ref.accessibilityLabel,_ref$labelPosition=_ref.labelPosition,labelPosition=_ref$labelPosition===void 0?'top':_ref$labelPosition,helpText=_ref.helpText,errorText=_ref.errorText,_ref$validationState=_ref.validationState,validationState=_ref$validationState===void 0?'none':_ref$validationState,_ref$necessityIndicat=_ref.necessityIndicator,necessityIndicator=_ref$necessityIndicat===void 0?'none':_ref$necessityIndicat,testID=_ref.testID,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var _useControllableState=useControllableState({defaultValue:defaultValue,value:value,onChange:function onChange(val){_onChange==null?void 0:_onChange({name:name,value:val});}}),_useControllableState2=_slicedToArray(_useControllableState,2),selectedValue=_useControllableState2[0],setSelectedValue=_useControllableState2[1];var baseId=useId('segmented-control');var labelId=`${baseId}-label`;var totalItems=React__default.Children.count(children);var contextValue=React__default.useMemo(function(){return {selectedValue:selectedValue,setSelectedValue:setSelectedValue,size:size,isDisabled:isDisabled,name:name,baseId:baseId,totalItems:totalItems};},[selectedValue,setSelectedValue,size,isDisabled,name,baseId,totalItems]);var showError=validationState==='error'&&errorText;var showHelpText=!showError&&helpText;var accessibilityText=`${showError?errorText:''} ${showHelpText?helpText:''}`.trim();var willRenderHintText=Boolean(helpText)||validationState==='error'&&Boolean(errorText);var segmentedControlElement=jsx(View,Object.assign({ref:ref,style:{flexDirection:'row',alignItems:'center',alignSelf:'stretch',height:containerHeight[size],backgroundColor:theme.colors.interactive.background.gray.faded,borderRadius:theme.border.radius[containerBorderRadius[size]],padding:getIn(theme,containerPadding[size]),gap:getIn(theme,gap[size])},accessibilityRole:"radiogroup",accessibilityLabel:label||accessibilityLabel||name},metaAttribute({name:MetaConstants.SegmentedControl,testID:testID}),makeAnalyticsAttribute(rest),{children:children}));return jsx(SegmentedControlContext.Provider,{value:contextValue,children:jsxs(BaseBox,{display:"flex",flexDirection:labelPosition==='left'?'row':'column',alignItems:labelPosition==='left'?'center':undefined,children:[label?jsx(FormLabel,{as:"span",necessityIndicator:necessityIndicator,position:labelPosition,id:labelId,accessibilityText:accessibilityText&&`,${accessibilityText}`,size:size,children:label}):null,jsxs(BaseBox,{flex:1,children:[segmentedControlElement,willRenderHintText?jsx(FormHint,{size:size,type:validationState==='error'?'error':'help',errorText:errorText,helpText:helpText}):null]})]})});};var SegmentedControl=React__default.forwardRef(_SegmentedControl);
25
+
26
+ export { SegmentedControl };
27
+ //# sourceMappingURL=SegmentedControl.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControl.native.js","sources":["../../../../../src/components/SegmentedControl/SegmentedControl.native.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport type { SegmentedControlProps } from './types';\nimport { SegmentedControlContext } from './SegmentedControlContext';\nimport {\n containerPadding,\n containerBorderRadius,\n containerHeight,\n gap,\n} from './segmentedControlTokens';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { FormLabel, FormHint } from '~components/Form';\nimport BaseBox from '~components/Box/BaseBox';\nimport getIn from '~utils/lodashButBetter/get';\n\nconst _SegmentedControl = (\n {\n children,\n defaultValue,\n value,\n onChange,\n size = 'medium',\n isDisabled = 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<View>,\n): React.ReactElement => {\n const { theme } = useTheme();\n\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 labelId = `${baseId}-label`;\n const totalItems = React.Children.count(children);\n\n const contextValue = React.useMemo(\n () => ({\n selectedValue,\n setSelectedValue,\n size,\n isDisabled,\n name,\n baseId,\n totalItems,\n }),\n [selectedValue, setSelectedValue, size, isDisabled, name, baseId, totalItems],\n );\n\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `${showError ? errorText : ''} ${showHelpText ? helpText : ''}`.trim();\n const willRenderHintText =\n Boolean(helpText) || (validationState === 'error' && Boolean(errorText));\n\n const segmentedControlElement = (\n <View\n ref={ref}\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: 'stretch',\n height: containerHeight[size],\n backgroundColor: theme.colors.interactive.background.gray.faded,\n borderRadius: theme.border.radius[containerBorderRadius[size]],\n padding: getIn(theme, containerPadding[size]),\n gap: getIn(theme, gap[size]),\n }}\n accessibilityRole=\"radiogroup\"\n accessibilityLabel={label || accessibilityLabel || name}\n {...metaAttribute({ name: MetaConstants.SegmentedControl, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n </View>\n );\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <BaseBox\n display=\"flex\"\n flexDirection={labelPosition === 'left' ? 'row' : 'column'}\n alignItems={labelPosition === 'left' ? '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 <BaseBox flex={1}>\n {segmentedControlElement}\n {willRenderHintText ? (\n <FormHint\n size={size}\n type={validationState === 'error' ? 'error' : 'help'}\n errorText={errorText}\n helpText={helpText}\n />\n ) : null}\n </BaseBox>\n </BaseBox>\n </SegmentedControlContext.Provider>\n );\n};\n\nconst SegmentedControl = React.forwardRef(_SegmentedControl);\n\nexport { SegmentedControl };\n"],"names":["this","_SegmentedControl","_ref","ref","children","defaultValue","value","onChange","_ref$size","size","_ref$isDisabled","isDisabled","name","label","accessibilityLabel","_ref$labelPosition","labelPosition","helpText","errorText","_ref$validationState","validationState","_ref$necessityIndicat","necessityIndicator","testID","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","_useControllableState","useControllableState","val","_useControllableState2","_slicedToArray","selectedValue","setSelectedValue","baseId","useId","labelId","totalItems","React","Children","count","contextValue","useMemo","showError","showHelpText","accessibilityText","trim","willRenderHintText","Boolean","segmentedControlElement","_jsx","View","Object","assign","style","flexDirection","alignItems","alignSelf","height","containerHeight","backgroundColor","colors","interactive","background","gray","faded","borderRadius","border","radius","containerBorderRadius","padding","getIn","containerPadding","gap","accessibilityRole","metaAttribute","MetaConstants","SegmentedControl","makeAnalyticsAttribute","SegmentedControlContext","Provider","_jsxs","BaseBox","display","undefined","FormLabel","as","position","id","flex","FormHint","type","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,SAAA,CAAA,CAAA,UAAA,CAAA,cAAA,CAAA,OAAA,CAAA,UAAA,CAAA,MAAA,CAAA,YAAA,CAAA,MAAA,CAAA,OAAA,CAAA,oBAAA,CAAA,eAAA,CAAA,UAAA,CAAA,WAAA,CAAA,iBAAA,CAAA,oBAAA,CAAA,QAAA,CAAA,CAAA,IAAA,KAAA,CAAAA,SAAA,CAAA,YAAA,CAAA,0GAAA,CAmBA,IAAMC,iBAAiB,CAAG,SAApBA,iBAAiBA,CAAAC,IAAA,CAmBrBC,GAAoB,CACG,CAlBrB,IAAAC,QAAQ,CAAAF,IAAA,CAARE,QAAQ,CACRC,YAAY,CAAAH,IAAA,CAAZG,YAAY,CACZC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CACLC,SAAQ,CAAAL,IAAA,CAARK,QAAQ,CAAAC,SAAA,CAAAN,IAAA,CACRO,IAAI,CAAJA,IAAI,CAAAD,SAAA,GAAG,KAAA,CAAA,CAAA,QAAQ,CAAAA,SAAA,CAAAE,eAAA,CAAAR,IAAA,CACfS,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAG,KAAA,CAAA,CAAA,KAAK,CAAAA,eAAA,CAClBE,IAAI,CAAAV,IAAA,CAAJU,IAAI,CACJC,KAAK,CAAAX,IAAA,CAALW,KAAK,CACLC,kBAAkB,CAAAZ,IAAA,CAAlBY,kBAAkB,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AO,CAAG,MAAO,CACrDF,SAAS,CAAEA,SAAU,CACrBD,QAAQ,CAAEA,QAAS,CACpB,CAAC,CACA,IAAI,CACD,CAAA,CAAC,EACH,CAAC,CACsB,CAAC,CAEvC,CAAC,CAEK,IAAA+D,gBAAgB,CAAGvC,cAAK,CAACsD,UAAU,CAAC9F,iBAAiB;;;;"}
@@ -0,0 +1,8 @@
1
+ import React__default from 'react';
2
+ import '../../utils/logger/index.js';
3
+ import { throwBladeError } from '../../utils/logger/logger.js';
4
+
5
+ var SegmentedControlContext=React__default.createContext(null);var useSegmentedControlContext=function useSegmentedControlContext(){var context=React__default.useContext(SegmentedControlContext);if(!context){throwBladeError({moduleName:'SegmentedControl',message:'useSegmentedControlContext must be used within SegmentedControl'});}return context;};
6
+
7
+ export { SegmentedControlContext, useSegmentedControlContext };
8
+ //# 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":";;;;AAiBM,IAAAA,uBAAuB,CAAGC,cAAK,CAACC,aAAa,CAA+B,IAAI,EAEhF,IAAAC,0BAA0B,CAAG,SAA7BA,0BAA0BA,EAAoD,CAClF,IAAMC,OAAO,CAAGH,cAAK,CAACI,UAAU,CAACL,uBAAuB,CAAC,CAEzD,GAAI,CAACI,OAAO,CAAE,CACZE,eAAe,CAAC,CACdC,UAAU,CAAE,kBAAkB,CAC9BC,OAAO,CAAE,iEACX,CAAC,CAAC,CACJ,CAEA,OAAOJ,OAAO,CAChB;;;;"}
@@ -0,0 +1,18 @@
1
+ import 'react';
2
+ import { Pressable } from 'react-native';
3
+ import { useSegmentedControlContext } from './SegmentedControlContext.js';
4
+ import { itemHeight, paddingY, paddingX, itemBorderRadius, iconSizeMap, textSizeMap } from './segmentedControlTokens.js';
5
+ import '../Typography/index.js';
6
+ import '../BladeProvider/index.js';
7
+ import '../../utils/metaAttribute/index.js';
8
+ import getIn from '../../utils/lodashButBetter/get.js';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+ import useTheme from '../BladeProvider/useTheme.js';
11
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.native.js';
12
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
13
+ import { Text } from '../Typography/Text/Text.js';
14
+
15
+ var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/SegmentedControl/SegmentedControlItem.native.tsx";var SegmentedControlItem=function SegmentedControlItem(_ref){var children=_ref.children,value=_ref.value,Leading=_ref.leading,_ref$isDisabled=_ref.isDisabled,isItemDisabled=_ref$isDisabled===void 0?false:_ref$isDisabled,accessibilityLabel=_ref.accessibilityLabel,testID=_ref.testID;var _useSegmentedControlC=useSegmentedControlContext(),selectedValue=_useSegmentedControlC.selectedValue,setSelectedValue=_useSegmentedControlC.setSelectedValue,size=_useSegmentedControlC.size,isGroupDisabled=_useSegmentedControlC.isDisabled;var _useTheme=useTheme(),theme=_useTheme.theme;var isSelected=selectedValue===value;var isDisabled=isGroupDisabled||isItemDisabled;var textColor=isDisabled?'interactive.text.gray.disabled':isSelected?'interactive.text.gray.normal':'interactive.text.gray.muted';var iconColor=isDisabled?'interactive.icon.gray.disabled':isSelected?'interactive.icon.gray.normal':'interactive.icon.gray.muted';return jsxs(Pressable,Object.assign({onPress:function onPress(){if(!isDisabled){setSelectedValue(function(){return value;});}},disabled:isDisabled,accessibilityRole:"radio",accessibilityLabel:accessibilityLabel,accessibilityState:{selected:isSelected,disabled:isDisabled},style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',height:itemHeight[size],gap:theme.spacing[3],paddingVertical:getIn(theme,paddingY[size]),paddingHorizontal:getIn(theme,paddingX[size]),borderRadius:theme.border.radius[itemBorderRadius[size]],backgroundColor:isSelected?theme.colors.surface.background.gray.intense:'transparent'}},metaAttribute({name:MetaConstants.SegmentedControlItem,testID:testID}),{children:[Leading?jsx(Leading,{size:iconSizeMap[size],color:iconColor}):null,children?jsx(Text,{color:textColor,size:textSizeMap[size],weight:"medium",children:children}):null]}));};
16
+
17
+ export { SegmentedControlItem };
18
+ //# sourceMappingURL=SegmentedControlItem.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentedControlItem.native.js","sources":["../../../../../src/components/SegmentedControl/SegmentedControlItem.native.tsx"],"sourcesContent":["import React from 'react';\nimport { Pressable } from 'react-native';\nimport type { SegmentedControlItemProps } from './types';\nimport { useSegmentedControlContext } from './SegmentedControlContext';\nimport {\n paddingX,\n paddingY,\n textSizeMap,\n iconSizeMap,\n itemBorderRadius,\n itemHeight,\n} from './segmentedControlTokens';\nimport { Text } from '~components/Typography';\nimport { useTheme } from '~components/BladeProvider';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport getIn from '~utils/lodashButBetter/get';\n\nconst SegmentedControlItem = ({\n children,\n value,\n leading: Leading,\n isDisabled: isItemDisabled = false,\n accessibilityLabel,\n testID,\n}: SegmentedControlItemProps): React.ReactElement => {\n const {\n selectedValue,\n setSelectedValue,\n size,\n isDisabled: isGroupDisabled,\n } = useSegmentedControlContext();\n const { theme } = useTheme();\n\n const isSelected = selectedValue === value;\n const isDisabled = isGroupDisabled || isItemDisabled;\n\n const textColor = isDisabled\n ? 'interactive.text.gray.disabled'\n : isSelected\n ? 'interactive.text.gray.normal'\n : 'interactive.text.gray.muted';\n const iconColor = isDisabled\n ? 'interactive.icon.gray.disabled'\n : isSelected\n ? 'interactive.icon.gray.normal'\n : 'interactive.icon.gray.muted';\n\n return (\n <Pressable\n onPress={() => {\n if (!isDisabled) {\n setSelectedValue(() => value);\n }\n }}\n disabled={isDisabled}\n accessibilityRole=\"radio\"\n accessibilityLabel={accessibilityLabel}\n accessibilityState={{ selected: isSelected, disabled: isDisabled }}\n style={{\n flex: 1,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n height: itemHeight[size],\n gap: theme.spacing[3],\n paddingVertical: getIn(theme, paddingY[size]),\n paddingHorizontal: getIn(theme, paddingX[size]),\n borderRadius: theme.border.radius[itemBorderRadius[size]],\n backgroundColor: isSelected ? theme.colors.surface.background.gray.intense : 'transparent',\n }}\n {...metaAttribute({ name: MetaConstants.SegmentedControlItem, testID })}\n >\n {Leading ? <Leading size={iconSizeMap[size]} color={iconColor} /> : null}\n {children ? (\n <Text color={textColor} size={textSizeMap[size]} weight=\"medium\">\n {children}\n </Text>\n ) : null}\n </Pressable>\n );\n};\n\nexport { SegmentedControlItem };\n"],"names":["SegmentedControlItem","_ref","children","value","Leading","leading","_ref$isDisabled","isDisabled","isItemDisabled","accessibilityLabel","testID","_useSegmentedControlC","useSegmentedControlContext","selectedValue","setSelectedValue","size","isGroupDisabled","_useTheme","useTheme","theme","isSelected","textColor","iconColor","_jsxs","Pressable","Object","assign","onPress","disabled","accessibilityRole","accessibilityState","selected","style","flex","flexDirection","alignItems","justifyContent","height","itemHeight","gap","spacing","paddingVertical","getIn","paddingY","paddingHorizontal","paddingX","borderRadius","border","radius","itemBorderRadius","backgroundColor","colors","surface","background","gray","intense","metaAttribute","name","MetaConstants","_jsx","iconSizeMap","color","Text","textSizeMap","weight"],"mappings":";;;;;;;;;;;;;;gJAiBM,IAAAA,oBAAoB,CAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,CAO2B,CAAA,IANnDC,QAAQ,CAAAD,IAAA,CAARC,QAAQ,CACRC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACIC,OAAO,CAAAH,IAAA,CAAhBI,OAAO,CAAAC,eAAA,CAAAL,IAAA,CACPM,UAAU,CAAEC,cAAc,CAAAF,eAAA,UAAG,KAAK,CAAAA,eAAA,CAClCG,kBAAkB,CAAAR,IAAA,CAAlBQ,kBAAkB,CAClBC,MAAM,CAAAT,IAAA,CAANS,MAAM,CAEN,IAAAC,qBAAA,CAKIC,0BAA0B,EAAE,CAJ9BC,aAAa,CAAAF,qBAAA,CAAbE,aAAa,CACbC,gBAAgB,CAAAH,qBAAA,CAAhBG,gBAAgB,CAChBC,IAAI,CAAAJ,qBAAA,CAAJI,IAAI,CACQC,eAAe,CAAAL,qBAAA,CAA3BJ,UAAU,CAEZ,IAAAU,SAAA,CAAkBC,QAAQ,EAAE,CAApBC,KAAK,CAAAF,SAAA,CAALE,KAAK,CAEb,IAAMC,UAAU,CAAGP,aAAa,GAAKV,KAAK,CAC1C,IAAMI,UAAU,CAAGS,eAAe,EAAIR,cAAc,CAEpD,IAAMa,SAAS,CAAGd,UAAU,CACxB,gCAAgC,CAChCa,UAAU,CACV,8BAA8B,CAC9B,6BAA6B,CACjC,IAAME,SAAS,CAAGf,UAAU,CACxB,gCAAgC,CAChCa,UAAU,CACV,8BAA8B,CAC9B,6BAA6B,CAEjC,OACEG,IAAA,CAACC,SAAS,CAAAC,MAAA,CAAAC,MAAA,CACRC,CAAAA,OAAO,CAAE,SAATA,OAAOA,EAAQ,CACb,GAAI,CAACpB,UAAU,CAAE,CACfO,gBAAgB,CAAC,UAAA,CAAA,OAAMX,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MAAM,CAAC,QAAQ,CAAA9D,QAAA,CAC7DA,QAAQ,CACL,CAAC,CACL,IAAI,CAAA,CAAA,CACC,CAAC,CAEhB;;;;"}
@@ -0,0 +1,3 @@
1
+ export { SegmentedControl } from './SegmentedControl.native.js';
2
+ export { SegmentedControlItem } from './SegmentedControlItem.native.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,4 @@
1
+ var paddingY={small:'spacing.2',medium:'spacing.2',large:'spacing.3'};var paddingX={small:'spacing.3',medium:'spacing.3',large:'spacing.3'};var containerPadding={small:'spacing.2',medium:'spacing.2',large:'spacing.2'};var gap={small:'spacing.1',medium:'spacing.1',large:'spacing.1'};var containerBorderRadius={small:'small',medium:'small',large:'medium'};var itemBorderRadius={small:'xsmall',medium:'xsmall',large:'small'};var containerHeight={small:32,medium:36,large:48};var itemHeight={small:24,medium:28,large:40};var textSizeMap={small:'small',medium:'medium',large:'large'};var iconSizeMap={small:'medium',medium:'medium',large:'large'};
2
+
3
+ export { containerBorderRadius, containerHeight, containerPadding, gap, iconSizeMap, itemBorderRadius, itemHeight, paddingX, paddingY, textSizeMap };
4
+ //# sourceMappingURL=segmentedControlTokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmentedControlTokens.js","sources":["../../../../../src/components/SegmentedControl/segmentedControlTokens.ts"],"sourcesContent":["import type { SegmentedControlSize } from './types';\nimport type { DotNotationSpacingStringToken } from '~utils/types';\n\ntype SizeTokenMap = Record<SegmentedControlSize, DotNotationSpacingStringToken>;\n\nconst paddingY: SizeTokenMap = {\n small: 'spacing.2',\n medium: 'spacing.2',\n large: 'spacing.3',\n};\n\nconst paddingX: SizeTokenMap = {\n small: 'spacing.3',\n medium: 'spacing.3',\n large: 'spacing.3',\n};\n\nconst containerPadding: SizeTokenMap = {\n small: 'spacing.2',\n medium: 'spacing.2',\n large: 'spacing.2',\n};\n\nconst gap: SizeTokenMap = {\n small: 'spacing.1',\n medium: 'spacing.1',\n large: 'spacing.1',\n};\n\nconst containerBorderRadius: Record<SegmentedControlSize, 'small' | 'medium'> = {\n small: 'small',\n medium: 'small',\n large: 'medium',\n};\n\nconst itemBorderRadius: Record<SegmentedControlSize, 'xsmall' | 'small'> = {\n small: 'xsmall',\n medium: 'xsmall',\n large: 'small',\n};\n\nconst containerHeight: Record<SegmentedControlSize, number> = {\n small: 32,\n medium: 36,\n large: 48,\n};\n\nconst itemHeight: Record<SegmentedControlSize, number> = {\n small: 24,\n medium: 28,\n large: 40,\n};\n\nconst textSizeMap: Record<SegmentedControlSize, 'small' | 'medium' | 'large'> = {\n small: 'small',\n medium: 'medium',\n large: 'large',\n};\n\nconst iconSizeMap: Record<SegmentedControlSize, 'small' | 'medium' | 'large'> = {\n small: 'medium',\n medium: 'medium',\n large: 'large',\n};\n\nexport {\n paddingY,\n paddingX,\n containerPadding,\n containerBorderRadius,\n itemBorderRadius,\n containerHeight,\n itemHeight,\n gap,\n textSizeMap,\n iconSizeMap,\n};\n"],"names":["paddingY","small","medium","large","paddingX","containerPadding","gap","containerBorderRadius","itemBorderRadius","containerHeight","itemHeight","textSizeMap","iconSizeMap"],"mappings":"AAKM,IAAAA,QAAsB,CAAG,CAC7BC,KAAK,CAAE,WAAW,CAClBC,MAAM,CAAE,WAAW,CACnBC,KAAK,CAAE,WACT,EAEM,IAAAC,QAAsB,CAAG,CAC7BH,KAAK,CAAE,WAAW,CAClBC,MAAM,CAAE,WAAW,CACnBC,KAAK,CAAE,WACT,EAEM,IAAAE,gBAA8B,CAAG,CACrCJ,KAAK,CAAE,WAAW,CAClBC,MAAM,CAAE,WAAW,CACnBC,KAAK,CAAE,WACT,EAEM,IAAAG,GAAiB,CAAG,CACxBL,KAAK,CAAE,WAAW,CAClBC,MAAM,CAAE,WAAW,CACnBC,KAAK,CAAE,WACT,EAEM,IAAAI,qBAAuE,CAAG,CAC9EN,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,OAAO,CACfC,KAAK,CAAE,QACT,EAEM,IAAAK,gBAAkE,CAAG,CACzEP,KAAK,CAAE,QAAQ,CACfC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,EAEM,IAAAM,eAAqD,CAAG,CAC5DR,KAAK,CAAE,EAAE,CACTC,MAAM,CAAE,EAAE,CACVC,KAAK,CAAE,EACT,EAEM,IAAAO,UAAgD,CAAG,CACvDT,KAAK,CAAE,EAAE,CACTC,MAAM,CAAE,EAAE,CACVC,KAAK,CAAE,EACT,EAEM,IAAAQ,WAAuE,CAAG,CAC9EV,KAAK,CAAE,OAAO,CACdC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,EAEM,IAAAS,WAAuE,CAAG,CAC9EX,KAAK,CAAE,QAAQ,CACfC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT;;;;"}
@@ -1,10 +1,12 @@
1
- import '../Typography/index.js';
2
- import '../../utils/logger/index.js';
1
+ import React__default from 'react';
2
+ import '../BaseMotion/index.js';
3
+ import { msToSeconds } from '../../utils/msToSeconds.js';
4
+ import '../../utils/index.js';
3
5
  import { jsx } from 'react/jsx-runtime';
4
- import { throwBladeError } from '../../utils/logger/logger.js';
5
- import { Text } from '../Typography/Text/Text.js';
6
+ import useTheme from '../BladeProvider/useTheme.js';
7
+ import { BaseMotionEntryExit } from '../BaseMotion/BaseMotion.native.js';
6
8
 
7
- var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Slide/Slide.native.tsx";var Slide=function Slide(_props){throwBladeError({message:'Slide is not yet implemented for native',moduleName:'Slide'});return jsx(Text,{children:"Slide Component is not available for Native mobile apps."});};
9
+ var _this=undefined,_jsxFileName="/home/runner/work/blade/blade/packages/blade/src/components/Slide/Slide.native.tsx";var ENTRANCE_EASING=[0,0,0.2,1];var EXIT_EASING=[0.17,0,1,1];var EMPHASIZED_EASING=[0.5,0,0,1];var getFromTransform=function getFromTransform(direction,fromOffset){if(direction==='top'){return `translateY(-${fromOffset})`;}if(direction==='left'){return `translateX(-${fromOffset})`;}if(direction==='right'){return `translateX(${fromOffset})`;}return `translateY(${fromOffset})`;};var Slide=function Slide(_ref){var children=_ref.children,_ref$type=_ref.type,type=_ref$type===void 0?'inout':_ref$type,_ref$direction=_ref.direction,direction=_ref$direction===void 0?'bottom':_ref$direction,isVisible=_ref.isVisible,motionTriggers=_ref.motionTriggers,shouldUnmountWhenHidden=_ref.shouldUnmountWhenHidden,fromOffset=_ref.fromOffset,delay=_ref.delay;var _useTheme=useTheme(),theme=_useTheme.theme;var enterDirection=typeof direction==='object'?direction.enter:direction;var exitDirection=typeof direction==='object'?direction.exit:direction;var isEnterDirectionHorizontal=['left','right'].includes(enterDirection);var isExitDirectionHorizontal=['left','right'].includes(exitDirection);var defaultOffset=isEnterDirectionHorizontal?'100vw':'100vh';var enterTransform=getFromTransform(enterDirection,fromOffset!=null?fromOffset:defaultOffset);var exitTransform=getFromTransform(exitDirection,fromOffset!=null?fromOffset:defaultOffset);var zeroTarget=isEnterDirectionHorizontal?'translateX(0%)':'translateY(0%)';var enterDelay=typeof delay==='object'?delay.enter:delay;var exitDelay=typeof delay==='object'?delay.exit:delay;var slideVariants=React__default.useMemo(function(){return {initial:{opacity:0,transform:enterTransform},animate:{opacity:1,transform:zeroTarget,transition:Object.assign({},enterDelay?{delay:msToSeconds(theme.motion.delay[enterDelay])}:{},{duration:msToSeconds(isEnterDirectionHorizontal?theme.motion.duration.xmoderate:theme.motion.duration['2xgentle']),ease:isEnterDirectionHorizontal?ENTRANCE_EASING:EMPHASIZED_EASING})},exit:{opacity:0,transform:exitTransform,transition:Object.assign({},exitDelay?{delay:msToSeconds(theme.motion.delay[exitDelay])}:{},{duration:msToSeconds(isExitDirectionHorizontal?theme.motion.duration.moderate:theme.motion.duration.xgentle),ease:isExitDirectionHorizontal?EXIT_EASING:EMPHASIZED_EASING})}};},[enterTransform,exitTransform,zeroTarget,isEnterDirectionHorizontal,isExitDirectionHorizontal,enterDelay,exitDelay,theme.name]);return jsx(BaseMotionEntryExit,{motionVariants:slideVariants,type:type,isVisible:isVisible,motionTriggers:motionTriggers,shouldUnmountWhenHidden:shouldUnmountWhenHidden,children:children});};
8
10
 
9
11
  export { Slide };
10
12
  //# sourceMappingURL=Slide.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Slide.native.js","sources":["../../../../../src/components/Slide/Slide.native.tsx"],"sourcesContent":["import type { SlideProps } from './types';\nimport { Text } from '~components/Typography';\nimport { throwBladeError } from '~utils/logger';\n\nconst Slide = (_props: SlideProps): React.ReactElement => {\n throwBladeError({\n message: 'Slide is not yet implemented for native',\n moduleName: 'Slide',\n });\n\n return <Text>Slide Component is not available for Native mobile apps.</Text>;\n};\n\nexport { Slide };\n"],"names":["Slide","_props","throwBladeError","message","moduleName","_jsx","Text","children"],"mappings":";;;;;;sHAIM,IAAAA,KAAK,CAAG,SAARA,KAAKA,CAAIC,MAAkB,CAAyB,CACxDC,eAAe,CAAC,CACdC,OAAO,CAAE,yCAAyC,CAClDC,UAAU,CAAE,OACd,CAAC,CAAC,CAEF,OAAOC,GAAA,CAACC,IAAI,CAAA,CAAAC,QAAA,CAAC,0DAAwD,CAAM,CAAC,CAC9E;;;;"}
1
+ {"version":3,"file":"Slide.native.js","sources":["../../../../../src/components/Slide/Slide.native.tsx"],"sourcesContent":["import React from 'react';\nimport type { SlideProps } from './types';\nimport { BaseMotionEntryExit } from '~components/BaseMotion';\nimport type { MotionVariantsType } from '~components/BaseMotion';\nimport { msToSeconds } from '~utils/msToSeconds';\nimport { useTheme } from '~utils';\n\n/**\n * NATIVE easing control points, mirroring the theme easing tokens.\n *\n * On native, `theme.motion.easing.*` resolves to an `EasingFactoryFn` (a reanimated easing\n * function), not a `cubic-bezier(...)` string. `cssBezierToArray` (used on web) calls\n * `.indexOf('(')` on it and crashes, so we supply the bezier control points directly. The native\n * interpreter's `getTiming` builds `Easing.bezier(...)` from a 4-number array (else falls back to\n * `Easing.ease`).\n */\nconst ENTRANCE_EASING: [number, number, number, number] = [0, 0, 0.2, 1]; // theme.motion.easing.entrance\nconst EXIT_EASING: [number, number, number, number] = [0.17, 0, 1, 1]; // theme.motion.easing.exit\nconst EMPHASIZED_EASING: [number, number, number, number] = [0.5, 0, 0, 1]; // theme.motion.easing.emphasized\n\nconst getFromTransform = (\n direction: 'top' | 'right' | 'bottom' | 'left',\n fromOffset: NonNullable<SlideProps['fromOffset']>,\n): `translate${string}` => {\n if (direction === 'top') {\n return `translateY(-${fromOffset})`;\n }\n\n if (direction === 'left') {\n return `translateX(-${fromOffset})`;\n }\n\n if (direction === 'right') {\n return `translateX(${fromOffset})`;\n }\n\n return `translateY(${fromOffset})`;\n};\n\n/**\n * ## Slide\n *\n * Slide is one of the motion presets that we expose from blade to help you make components slide in from outside of viewport\n *\n * If you're looking for subtle movement on enter in the viewport itself, checkout `Move` preset instead.\n *\n * ### Usage\n *\n * #### Slide in on mount\n *\n * ```jsx\n * <Slide direction=\"bottom\">\n * <Card />\n * </Slide>\n * ```\n *\n * #### Conditionally slide based on state\n *\n * ```jsx\n * <Slide isVisible={isVisibleState}>\n * <Card />\n * </Slide>\n * ```\n *\n * ### Native limitations\n *\n * - Only the default `100vw` / `100vh` offsets slide on native (resolved via `Dimensions`).\n * A `%`-based `fromOffset` cannot be measured against the element size and degrades to no movement.\n * - `in-view` triggers degrade to `mount` (no scroll-driven in-view detection on native).\n */\nconst Slide = ({\n children,\n type = 'inout',\n direction = 'bottom',\n isVisible,\n motionTriggers,\n shouldUnmountWhenHidden,\n fromOffset,\n delay,\n}: SlideProps): React.ReactElement => {\n const { theme } = useTheme();\n\n const enterDirection = typeof direction === 'object' ? direction.enter : direction;\n const exitDirection = typeof direction === 'object' ? direction.exit : direction;\n const isEnterDirectionHorizontal = ['left', 'right'].includes(enterDirection);\n const isExitDirectionHorizontal = ['left', 'right'].includes(exitDirection);\n\n // vw/vh resolve via Dimensions in the native interpreter; `%` offsets degrade to no movement.\n const defaultOffset: NonNullable<SlideProps['fromOffset']> = isEnterDirectionHorizontal\n ? '100vw'\n : '100vh';\n\n const enterTransform = getFromTransform(enterDirection, fromOffset ?? defaultOffset);\n const exitTransform = getFromTransform(exitDirection, fromOffset ?? defaultOffset);\n // NATIVE: single-string zero target (not a keyframe array). The interpreter reads only the last\n // keyframe entry, so an array would collapse to `0` and lose the enter slide.\n const zeroTarget = isEnterDirectionHorizontal ? 'translateX(0%)' : 'translateY(0%)';\n\n const enterDelay = typeof delay === 'object' ? delay.enter : delay;\n const exitDelay = typeof delay === 'object' ? delay.exit : delay;\n\n const slideVariants: MotionVariantsType = React.useMemo(\n () => ({\n // NATIVE: the off-screen offset lives in `initial.transform` (Move-style) so the interpreter\n // interpolates from the offset → zero target on enter. Web keeps `initial` transform-less for\n // its `in-view` trigger, but native `in-view` degrades to mount so we're free to offset here.\n initial: {\n opacity: 0,\n transform: enterTransform,\n },\n animate: {\n opacity: 1,\n transform: zeroTarget,\n transition: {\n // We have to make sure we don't add delay prop because if we define it, it takes precedence in stagger.\n // Even setting `undefined` would break the stagger\n ...(enterDelay ? { delay: msToSeconds(theme.motion.delay[enterDelay]) } : {}),\n duration: msToSeconds(\n isEnterDirectionHorizontal\n ? theme.motion.duration.xmoderate\n : theme.motion.duration['2xgentle'],\n ),\n ease: isEnterDirectionHorizontal ? ENTRANCE_EASING : EMPHASIZED_EASING,\n },\n },\n exit: {\n opacity: 0,\n transform: exitTransform,\n // NATIVE: `transitionEnd` is a no-op in the interpreter; reset relies on the initial offset\n // / remount instead.\n transition: {\n ...(exitDelay ? { delay: msToSeconds(theme.motion.delay[exitDelay]) } : {}),\n duration: msToSeconds(\n isExitDirectionHorizontal\n ? theme.motion.duration.moderate\n : theme.motion.duration.xgentle,\n ),\n ease: isExitDirectionHorizontal ? EXIT_EASING : EMPHASIZED_EASING,\n },\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n enterTransform,\n exitTransform,\n zeroTarget,\n isEnterDirectionHorizontal,\n isExitDirectionHorizontal,\n enterDelay,\n exitDelay,\n theme.name,\n ],\n );\n\n // Pass `children` as a real JSX child (not the `children={...}` prop shorthand) so the native\n // `BaseMotionEntryExit` can read `children.props.ref`.\n return (\n <BaseMotionEntryExit\n motionVariants={slideVariants}\n type={type}\n isVisible={isVisible}\n motionTriggers={motionTriggers}\n shouldUnmountWhenHidden={shouldUnmountWhenHidden}\n >\n {children}\n </BaseMotionEntryExit>\n );\n};\n\nexport { Slide };\n"],"names":["this","ENTRANCE_EASING","EXIT_EASING","EMPHASIZED_EASING","getFromTransform","direction","fromOffset","Slide","_ref","children","_ref$type","type","_ref$direction","isVisible","motionTriggers","shouldUnmountWhenHidden","delay","_useTheme","useTheme","theme","enterDirection","enter","exitDirection","exit","isEnterDirectionHorizontal","includes","isExitDirectionHorizontal","defaultOffset","enterTransform","exitTransform","zeroTarget","enterDelay","exitDelay","slideVariants","React","useMemo","initial","opacity","transform","animate","transition","Object","assign","msToSeconds","motion","duration","xmoderate","ease","moderate","xgentle","name","_jsx","BaseMotionEntryExit","motionVariants"],"mappings":";;;;;;;;AAAA,IAAA,KAAA,CAAAA,SAAA,CAAA,YAAA,CAAA,oFAAA,CAgBA,IAAMC,eAAiD,CAAG,CAAC,CAAC,CAAE,CAAC,CAAE,GAAG,CAAE,CAAC,CAAC,CACxE,IAAMC,WAA6C,CAAG,CAAC,IAAI,CAAE,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC,CACrE,IAAMC,iBAAmD,CAAG,CAAC,GAAG,CAAE,CAAC,CAAE,CAAC,CAAE,CAAC,CAAC,CAE1E,IAAMC,gBAAgB,CAAG,SAAnBA,gBAAgBA,CACpBC,SAA8C,CAC9CC,UAAiD,CACxB,CACzB,GAAID,SAAS,GAAK,KAAK,CAAE,CACvB,OAAO,CAAeC,YAAAA,EAAAA,UAAU,CAAG,CAAA,CAAA,CACrC,CAEA,GAAID,SAAS,GAAK,MAAM,CAAE,CACxB,OA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AA,EAAA,CACJV,SAAS,CAAG,CAAEhB,KAAK,CAAE2B,WAAW,CAACxB,KAAK,CAACyB,MAAM,CAAC5B,KAAK,CAACgB,SAAS,CAAC,CAAE,CAAC,CAAG,EAAE,EAC1Ea,QAAQ,CAAEF,WAAW,CACnBjB,yBAAyB,CACrBP,KAAK,CAACyB,MAAM,CAACC,QAAQ,CAACG,QAAQ,CAC9B7B,KAAK,CAACyB,MAAM,CAACC,QAAQ,CAACI,OAC5B,CAAC,CACDF,IAAI,CAAErB,yBAAyB,CAAGxB,WAAW,CAAGC,iBAAiB,CAAA,CAErE,CACF,CAAC,CAAC,CAAA,CAEF,CACEyB,cAAc,CACdC,aAAa,CACbC,UAAU,CACVN,0BAA0B,CAC1BE,yBAAyB,CACzBK,UAAU,CACVC,SAAS,CACTb,KAAK,CAAC+B,IAAI,CAEd,CAAC,CAID,OACEC,GAAA,CAACC,mBAAmB,CAAA,CAClBC,cAAc,CAAEpB,aAAc,CAC9BtB,IAAI,CAAEA,IAAK,CACXE,SAAS,CAAEA,SAAU,CACrBC,cAAc,CAAEA,cAAe,CAC/BC,uBAAuB,CAAEA,uBAAwB,CAAAN,QAAA,CAEhDA,QAAQ,CACU,CAAC,CAE1B;;;;"}
@@ -1,6 +1,6 @@
1
1
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
2
2
 
3
- var DEFAULT_CDN_PATH='https://cdn.jsdelivr.net/npm/@razorpay/blade@latest/assets/spark';function preloadRazorSenseAssets(){return _preloadRazorSenseAssets.apply(this,arguments);}function _preloadRazorSenseAssets(){_preloadRazorSenseAssets=_asyncToGenerator(function*(){var _preset=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'default';var _assetsPath=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DEFAULT_CDN_PATH;});return _preloadRazorSenseAssets.apply(this,arguments);}function loadImage(_x){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(function*(_src){return Promise.reject(new Error('loadImage is not supported on native'));});return _loadImage.apply(this,arguments);}function loadVideo(_x2){return _loadVideo.apply(this,arguments);}function _loadVideo(){_loadVideo=_asyncToGenerator(function*(_src){return Promise.reject(new Error('loadVideo is not supported on native'));});return _loadVideo.apply(this,arguments);}function isSafari(){return false;}function bestGuessBrowserZoom(){return 1;}function getDefaultAssets(_assetsPath){return {};}function getPresetAssets(_preset,_assetsPath){return {};}function resolveConfig(_props,_assetsPath){return {};}
3
+ var DEFAULT_CDN_PATH='https://cdn.jsdelivr.net/npm/@razorpay/blade@latest/assets/spark';function preloadRazorSenseAssets(){return _preloadRazorSenseAssets.apply(this,arguments);}function _preloadRazorSenseAssets(){_preloadRazorSenseAssets=_asyncToGenerator(function*(){var _preset=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'default';var _assetsPath=arguments.length>1&&arguments[1]!==undefined?arguments[1]:DEFAULT_CDN_PATH;var _colorScheme=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'light';});return _preloadRazorSenseAssets.apply(this,arguments);}function loadImage(_x){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(function*(_src){return Promise.reject(new Error('loadImage is not supported on native'));});return _loadImage.apply(this,arguments);}function loadVideo(_x2){return _loadVideo.apply(this,arguments);}function _loadVideo(){_loadVideo=_asyncToGenerator(function*(_src){return Promise.reject(new Error('loadVideo is not supported on native'));});return _loadVideo.apply(this,arguments);}function isSafari(){return false;}function bestGuessBrowserZoom(){return 1;}function getDefaultAssets(_assetsPath){return {};}function getPresetAssets(_preset,_assetsPath){var _isDark=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return {};}function resolveConfig(_props,_assetsPath){var _isDark=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return {};}
4
4
 
5
5
  export { DEFAULT_CDN_PATH, bestGuessBrowserZoom, getDefaultAssets, getPresetAssets, isSafari, loadImage, loadVideo, preloadRazorSenseAssets, resolveConfig };
6
6
  //# sourceMappingURL=utils.native.js.map