@razorpay/blade 11.34.1 → 11.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Card/Card.js.map +1 -1
- package/build/lib/native/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +12 -0
- package/build/lib/native/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/native/components/Icons/BillMeIcon/BillMeIcon.js +12 -0
- package/build/lib/native/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/native/components/Icons/NoSignalIcon/NoSignalIcon.js +12 -0
- package/build/lib/native/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal1BarIcon/Signal1BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal2BarIcon/Signal2BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal3BarIcon/Signal3BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/Signal4BarIcon/Signal4BarIcon.js +12 -0
- package/build/lib/native/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/native/components/Icons/SignalIcon/SignalIcon.js +12 -0
- package/build/lib/native/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/native/components/Icons/SimCardIcon/SimCardIcon.js +12 -0
- package/build/lib/native/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/native/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/native/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/native/components/Icons/UpiIcon/UpiIcon.js +12 -0
- package/build/lib/native/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/native/components/Icons/YoutubeIcon/YoutubeIcon.js +12 -0
- package/build/lib/native/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/index.js +15 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/useCallbackRef.js +6 -0
- package/build/lib/native/utils/useCallbackRef.js.map +1 -0
- package/build/lib/native/utils/useControllable.js +2 -1
- package/build/lib/native/utils/useControllable.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Card/Card.js.map +1 -1
- package/build/lib/web/development/components/Carousel/Carousel.web.js +65 -57
- package/build/lib/web/development/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +57 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery100PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +45 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery20PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +48 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery40PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +51 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery60PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +54 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Battery80PercentIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/BillMeIcon.js +51 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/BillMeIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/NoSignalIcon.js +37 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/NoSignalIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/Signal1BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal1BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/Signal2BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal2BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/Signal3BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal3BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/Signal4BarIcon.js +37 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/Signal4BarIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/SignalIcon/SignalIcon.js +37 -0
- package/build/lib/web/development/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/SignalIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/SignalIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/SimCardIcon.js +57 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/SimCardIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/web/development/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/web/development/components/Icons/UpiIcon/UpiIcon.js +39 -0
- package/build/lib/web/development/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/UpiIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/UpiIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/YoutubeIcon.js +44 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/index.js +2 -0
- package/build/lib/web/development/components/Icons/YoutubeIcon/index.js.map +1 -0
- package/build/lib/web/development/components/Icons/index.js +15 -0
- package/build/lib/web/development/components/Icons/index.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/development/components/index.js +15 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/utils/useCallbackRef.js +31 -0
- package/build/lib/web/development/utils/useCallbackRef.js.map +1 -0
- package/build/lib/web/development/utils/useControllable.js +13 -5
- package/build/lib/web/development/utils/useControllable.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Card/Card.js.map +1 -1
- package/build/lib/web/production/components/Carousel/Carousel.web.js +65 -57
- package/build/lib/web/production/components/Carousel/Carousel.web.js.map +1 -1
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js +57 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/Battery100PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery100PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js +45 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/Battery20PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery20PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js +48 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/Battery40PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery40PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js +51 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/Battery60PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery60PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js +54 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/Battery80PercentIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Battery80PercentIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/BillMeIcon.js +51 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/BillMeIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/BillMeIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/NoSignalIcon.js +37 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/NoSignalIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/NoSignalIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/Signal1BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/Signal1BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal1BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/Signal2BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/Signal2BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal2BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/Signal3BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/Signal3BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal3BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/Signal4BarIcon.js +37 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/Signal4BarIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/Signal4BarIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/SignalIcon/SignalIcon.js +37 -0
- package/build/lib/web/production/components/Icons/SignalIcon/SignalIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/SignalIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/SignalIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/SimCardIcon.js +57 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/SimCardIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/SimCardIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/TwitterIcon/TwitterIcon.js +1 -1
- package/build/lib/web/production/components/Icons/TwitterIcon/TwitterIcon.js.map +1 -1
- package/build/lib/web/production/components/Icons/UpiIcon/UpiIcon.js +39 -0
- package/build/lib/web/production/components/Icons/UpiIcon/UpiIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/UpiIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/UpiIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/YoutubeIcon.js +44 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/YoutubeIcon.js.map +1 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/index.js +2 -0
- package/build/lib/web/production/components/Icons/YoutubeIcon/index.js.map +1 -0
- package/build/lib/web/production/components/Icons/index.js +15 -0
- package/build/lib/web/production/components/Icons/index.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/Modal/ModalBody.web.js.map +1 -1
- package/build/lib/web/production/components/index.js +15 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/useCallbackRef.js +31 -0
- package/build/lib/web/production/utils/useCallbackRef.js.map +1 -0
- package/build/lib/web/production/utils/useControllable.js +13 -5
- package/build/lib/web/production/utils/useControllable.js.map +1 -1
- package/build/types/components/index.d.ts +64 -23
- package/build/types/components/index.native.d.ts +62 -21
- package/codemods/aicodemod/README.md +26 -0
- package/codemods/aicodemod/bin.mjs +128 -0
- package/codemods/aicodemod/knowledge/Table.md +596 -0
- package/codemods/aicodemod/knowledge/presets/dashboard/table-pattern-1.md +319 -0
- package/package.json +4 -2
|
@@ -141,12 +141,18 @@ export { default as BankIcon } from './Icons/BankIcon/BankIcon.js';
|
|
|
141
141
|
export { default as BarChartAltIcon } from './Icons/BarChartAltIcon/BarChartAltIcon.js';
|
|
142
142
|
export { default as BarChartIcon } from './Icons/BarChartIcon/BarChartIcon.js';
|
|
143
143
|
export { default as BarCodeIcon } from './Icons/BarCodeIcon/BarCodeIcon.js';
|
|
144
|
+
export { default as Battery100PercentIcon } from './Icons/Battery100PercentIcon/Battery100PercentIcon.js';
|
|
145
|
+
export { default as Battery20PercentIcon } from './Icons/Battery20PercentIcon/Battery20PercentIcon.js';
|
|
146
|
+
export { default as Battery40PercentIcon } from './Icons/Battery40PercentIcon/Battery40PercentIcon.js';
|
|
147
|
+
export { default as Battery60PercentIcon } from './Icons/Battery60PercentIcon/Battery60PercentIcon.js';
|
|
148
|
+
export { default as Battery80PercentIcon } from './Icons/Battery80PercentIcon/Battery80PercentIcon.js';
|
|
144
149
|
export { default as BatteryChargingIcon } from './Icons/BatteryChargingIcon/BatteryChargingIcon.js';
|
|
145
150
|
export { default as BatteryIcon } from './Icons/BatteryIcon/BatteryIcon.js';
|
|
146
151
|
export { default as BellIcon } from './Icons/BellIcon/BellIcon.js';
|
|
147
152
|
export { default as BellOffIcon } from './Icons/BellOffIcon/BellOffIcon.js';
|
|
148
153
|
export { default as BfsiIcon } from './Icons/BfsiIcon/BfsiIcon.js';
|
|
149
154
|
export { default as BillIcon } from './Icons/BillIcon/BillIcon.js';
|
|
155
|
+
export { default as BillMeIcon } from './Icons/BillMeIcon/BillMeIcon.js';
|
|
150
156
|
export { default as BluetoothIcon } from './Icons/BluetoothIcon/BluetoothIcon.js';
|
|
151
157
|
export { default as BoldIcon } from './Icons/BoldIcon/BoldIcon.js';
|
|
152
158
|
export { default as BookIcon } from './Icons/BookIcon/BookIcon.js';
|
|
@@ -310,6 +316,7 @@ export { default as MoveIcon } from './Icons/MoveIcon/MoveIcon.js';
|
|
|
310
316
|
export { default as MusicIcon } from './Icons/MusicIcon/MusicIcon.js';
|
|
311
317
|
export { default as MyAccountIcon } from './Icons/MyAccountIcon/MyAccountIcon.js';
|
|
312
318
|
export { default as NavigationIcon } from './Icons/NavigationIcon/NavigationIcon.js';
|
|
319
|
+
export { default as NoSignalIcon } from './Icons/NoSignalIcon/NoSignalIcon.js';
|
|
313
320
|
export { default as OctagonIcon } from './Icons/OctagonIcon/OctagonIcon.js';
|
|
314
321
|
export { default as OffersIcon } from './Icons/OffersIcon/OffersIcon.js';
|
|
315
322
|
export { default as OptimizerIcon } from './Icons/OptimizerIcon/OptimizerIcon.js';
|
|
@@ -378,6 +385,12 @@ export { default as ShoppingBagIcon } from './Icons/ShoppingBagIcon/ShoppingBagI
|
|
|
378
385
|
export { default as ShoppingCartIcon } from './Icons/ShoppingCartIcon/ShoppingCartIcon.js';
|
|
379
386
|
export { default as ShuffleIcon } from './Icons/ShuffleIcon/ShuffleIcon.js';
|
|
380
387
|
export { default as SidebarIcon } from './Icons/SidebarIcon/SidebarIcon.js';
|
|
388
|
+
export { default as Signal1BarIcon } from './Icons/Signal1BarIcon/Signal1BarIcon.js';
|
|
389
|
+
export { default as Signal2BarIcon } from './Icons/Signal2BarIcon/Signal2BarIcon.js';
|
|
390
|
+
export { default as Signal3BarIcon } from './Icons/Signal3BarIcon/Signal3BarIcon.js';
|
|
391
|
+
export { default as Signal4BarIcon } from './Icons/Signal4BarIcon/Signal4BarIcon.js';
|
|
392
|
+
export { default as SignalIcon } from './Icons/SignalIcon/SignalIcon.js';
|
|
393
|
+
export { default as SimCardIcon } from './Icons/SimCardIcon/SimCardIcon.js';
|
|
381
394
|
export { default as SkipBackIcon } from './Icons/SkipBackIcon/SkipBackIcon.js';
|
|
382
395
|
export { default as SkipForwardIcon } from './Icons/SkipForwardIcon/SkipForwardIcon.js';
|
|
383
396
|
export { default as SlackIcon } from './Icons/SlackIcon/SlackIcon.js';
|
|
@@ -424,6 +437,7 @@ export { default as UmbrellaIcon } from './Icons/UmbrellaIcon/UmbrellaIcon.js';
|
|
|
424
437
|
export { default as UnderlineIcon } from './Icons/UnderlineIcon/UnderlineIcon.js';
|
|
425
438
|
export { default as UnlockIcon } from './Icons/UnlockIcon/UnlockIcon.js';
|
|
426
439
|
export { default as UpiAutopayIcon } from './Icons/UpiAutopayIcon/UpiAutopayIcon.js';
|
|
440
|
+
export { default as UpiIcon } from './Icons/UpiIcon/UpiIcon.js';
|
|
427
441
|
export { default as UploadCloudIcon } from './Icons/UploadCloudIcon/UploadCloudIcon.js';
|
|
428
442
|
export { default as UploadIcon } from './Icons/UploadIcon/UploadIcon.js';
|
|
429
443
|
export { default as UserCheckIcon } from './Icons/UserCheckIcon/UserCheckIcon.js';
|
|
@@ -448,6 +462,7 @@ export { default as WifiOffIcon } from './Icons/WifiOffIcon/WifiOffIcon.js';
|
|
|
448
462
|
export { default as WindIcon } from './Icons/WindIcon/WindIcon.js';
|
|
449
463
|
export { default as XCircleIcon } from './Icons/XCircleIcon/XCircleIcon.js';
|
|
450
464
|
export { default as XSquareIcon } from './Icons/XSquareIcon/XSquareIcon.js';
|
|
465
|
+
export { default as YoutubeIcon } from './Icons/YoutubeIcon/YoutubeIcon.js';
|
|
451
466
|
export { default as ZapIcon } from './Icons/ZapIcon/ZapIcon.js';
|
|
452
467
|
export { default as ZoomInIcon } from './Icons/ZoomInIcon/ZoomInIcon.js';
|
|
453
468
|
export { default as ZoomOutIcon } from './Icons/ZoomOutIcon/ZoomOutIcon.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useRef, useInsertionEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This hook is user-land implementation of the experimental `useEffectEvent` hook.
|
|
7
|
+
* React docs: https://react.dev/learn/separating-events-from-effects#declaring-an-effect-event
|
|
8
|
+
*
|
|
9
|
+
* This hook is useful when you want to use a callback function inside a useEffect while keeping it "fresh" but you don't want to add it to the dependency array.
|
|
10
|
+
*/
|
|
11
|
+
function useCallbackRef(callback) {
|
|
12
|
+
var deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
13
|
+
var callbackRef = useRef(function () {
|
|
14
|
+
throw new Error('Cannot call an event handler while rendering.');
|
|
15
|
+
});
|
|
16
|
+
useInsertionEffect(function () {
|
|
17
|
+
callbackRef.current = callback;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
return useCallback(function () {
|
|
22
|
+
var _callbackRef$current;
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call.apply(_callbackRef$current, [callbackRef].concat(args));
|
|
27
|
+
}, deps);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { useCallbackRef };
|
|
31
|
+
//# sourceMappingURL=useCallbackRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCallbackRef.js","sources":["../../../../../src/utils/useCallbackRef.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { useCallback, useInsertionEffect, useRef } from 'react';\n\n/**\n * This hook is user-land implementation of the experimental `useEffectEvent` hook.\n * React docs: https://react.dev/learn/separating-events-from-effects#declaring-an-effect-event\n *\n * This hook is useful when you want to use a callback function inside a useEffect while keeping it \"fresh\" but you don't want to add it to the dependency array.\n */\nfunction useCallbackRef<Args extends unknown[], Return>(\n callback: ((...args: Args) => Return) | undefined,\n deps: React.DependencyList = [],\n) {\n const callbackRef = useRef<typeof callback>(() => {\n throw new Error('Cannot call an event handler while rendering.');\n });\n\n useInsertionEffect(() => {\n callbackRef.current = callback;\n });\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useCallback((...args: Args) => callbackRef.current?.(...args), deps);\n}\n\nexport { useCallbackRef };\n"],"names":["useCallbackRef","callback","deps","arguments","length","undefined","callbackRef","useRef","Error","useInsertionEffect","current","useCallback","_callbackRef$current","_len","args","Array","_key","call","apply","concat"],"mappings":";;AAAA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAcA,CACrBC,QAAiD,EAEjD;AAAA,EAAA,IADAC,IAA0B,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAE/B,EAAA,IAAMG,WAAW,GAAGC,MAAM,CAAkB,YAAM;AAChD,IAAA,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC,CAAA;AAClE,GAAC,CAAC,CAAA;AAEFC,EAAAA,kBAAkB,CAAC,YAAM;IACvBH,WAAW,CAACI,OAAO,GAAGT,QAAQ,CAAA;AAChC,GAAC,CAAC,CAAA;;AAEF;AACA,EAAA,OAAOU,WAAW,CAAC,YAAA;AAAA,IAAA,IAAAC,oBAAA,CAAA;AAAA,IAAA,KAAA,IAAAC,IAAA,GAAAV,SAAA,CAAAC,MAAA,EAAIU,IAAI,GAAAC,IAAAA,KAAA,CAAAF,IAAA,GAAAG,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA,EAAA,EAAA;AAAJF,MAAAA,IAAI,CAAAE,IAAA,CAAAb,GAAAA,SAAA,CAAAa,IAAA,CAAA,CAAA;AAAA,KAAA;IAAA,OAAAJ,CAAAA,oBAAA,GAAWN,WAAW,CAACI,OAAO,MAAAE,IAAAA,IAAAA,oBAAA,uBAAnBA,oBAAA,CAAAK,IAAA,CAAAC,KAAA,CAAAN,oBAAA,EAAA,CAAAN,WAAW,CAAAa,CAAAA,MAAA,CAAcL,IAAI,CAAC,CAAA,CAAA;AAAA,GAAA,EAAEZ,IAAI,CAAC,CAAA;AAC7E;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { useCallbackRef } from './useCallbackRef.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* React hook for using controlling component state.
|
|
@@ -14,7 +15,13 @@ import * as React from 'react';
|
|
|
14
15
|
function useControllableState(props) {
|
|
15
16
|
var valueProp = props.value,
|
|
16
17
|
defaultValue = props.defaultValue,
|
|
17
|
-
onChange = props.onChange
|
|
18
|
+
onChange = props.onChange,
|
|
19
|
+
_props$shouldUpdate = props.shouldUpdate,
|
|
20
|
+
shouldUpdate = _props$shouldUpdate === void 0 ? function (prev, next) {
|
|
21
|
+
return prev !== next;
|
|
22
|
+
} : _props$shouldUpdate;
|
|
23
|
+
var onChangeProp = useCallbackRef(onChange);
|
|
24
|
+
var shouldUpdateProp = useCallbackRef(shouldUpdate);
|
|
18
25
|
var _React$useState = React.useState(defaultValue),
|
|
19
26
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
20
27
|
valueState = _React$useState2[0],
|
|
@@ -22,14 +29,15 @@ function useControllableState(props) {
|
|
|
22
29
|
var _React$useRef = React.useRef(valueProp !== undefined),
|
|
23
30
|
isControlled = _React$useRef.current;
|
|
24
31
|
var value = isControlled && typeof valueProp !== 'undefined' ? valueProp : valueState;
|
|
25
|
-
var updateValue =
|
|
32
|
+
var updateValue = useCallbackRef(function (next) {
|
|
26
33
|
var skipUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
27
34
|
var nextValue = next(value);
|
|
28
35
|
if (!isControlled) setValue(nextValue);
|
|
29
|
-
// We don't want to call onChange if skipUpdate is true
|
|
36
|
+
// We don't want to call onChange if skipUpdate is true or if the value is not changed
|
|
37
|
+
if (!shouldUpdateProp(value, nextValue)) return;
|
|
30
38
|
if (skipUpdate) return;
|
|
31
|
-
|
|
32
|
-
}, [
|
|
39
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(nextValue);
|
|
40
|
+
}, [isControlled, onChangeProp, value, shouldUpdateProp]);
|
|
33
41
|
return [value, updateValue];
|
|
34
42
|
}
|
|
35
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useControllable.js","sources":["../../../../../src/utils/useControllable.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\ntype ControllableStateSetter<T> = (\n /**\n * Sets the state to the given value\n */\n next: (prevState: T) => T,\n /**\n * If `true`, `onChange` won't be called\n */\n skipUpdate?: boolean,\n) => void;\n\ntype UseControllableStateProps<T> = {\n /**\n * The value to used in controlled mode\n */\n value?: T;\n /**\n * The initial value to be used, in uncontrolled mode\n */\n defaultValue?: T | (() => T);\n /**\n * The callback fired when the value changes\n */\n onChange?: (value: T) => void;\n};\n\n/**\n * React hook for using controlling component state.\n *\n * It automatically handles controlled and uncontrolled state,\n * while internally giving us the state value so that we can react to the changes.\n *\n * @example\n * In checkbox we want to internally track the checked state to be able to render the correct Icon\n * but also want to provide controlled and uncontrolled behavior to user\n */\
|
|
1
|
+
{"version":3,"file":"useControllable.js","sources":["../../../../../src/utils/useControllable.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { useCallbackRef } from './useCallbackRef';\n\ntype ControllableStateSetter<T> = (\n /**\n * Sets the state to the given value\n */\n next: (prevState: T) => T,\n /**\n * If `true`, `onChange` won't be called\n */\n skipUpdate?: boolean,\n) => void;\n\ntype UseControllableStateProps<T> = {\n /**\n * The value to used in controlled mode\n */\n value?: T;\n /**\n * The initial value to be used, in uncontrolled mode\n */\n defaultValue?: T | (() => T);\n /**\n * The callback fired when the value changes\n */\n onChange?: (value: T) => void;\n shouldUpdate?: (prev: T, next: T) => boolean;\n};\n\n/**\n * React hook for using controlling component state.\n *\n * It automatically handles controlled and uncontrolled state,\n * while internally giving us the state value so that we can react to the changes.\n *\n * @example\n * In checkbox we want to internally track the checked state to be able to render the correct Icon\n * but also want to provide controlled and uncontrolled behavior to user\n */\nfunction useControllableState<T>(props: UseControllableStateProps<T>) {\n const {\n value: valueProp,\n defaultValue,\n onChange,\n shouldUpdate = (prev, next) => prev !== next,\n } = props;\n\n const onChangeProp = useCallbackRef(onChange);\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\n\n const [valueState, setValue] = React.useState(defaultValue as T);\n const { current: isControlled } = React.useRef(valueProp !== undefined);\n const value = isControlled && typeof valueProp !== 'undefined' ? valueProp : valueState;\n\n const updateValue: ControllableStateSetter<T> = useCallbackRef(\n (next, skipUpdate = false) => {\n const nextValue = next(value);\n if (!isControlled) setValue(nextValue);\n // We don't want to call onChange if skipUpdate is true or if the value is not changed\n if (!shouldUpdateProp(value, nextValue)) return;\n if (skipUpdate) return;\n onChangeProp?.(nextValue);\n },\n [isControlled, onChangeProp, value, shouldUpdateProp],\n );\n\n return [value, updateValue] as [T, ControllableStateSetter<T>];\n}\n\nexport { useControllableState };\nexport type { ControllableStateSetter };\n"],"names":["useControllableState","props","valueProp","value","defaultValue","onChange","_props$shouldUpdate","shouldUpdate","prev","next","onChangeProp","useCallbackRef","shouldUpdateProp","_React$useState","React","useState","_React$useState2","_slicedToArray","valueState","setValue","_React$useRef","useRef","undefined","isControlled","current","updateValue","skipUpdate","arguments","length","nextValue"],"mappings":";;;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoBA,CAAIC,KAAmC,EAAE;AACpE,EAAA,IACSC,SAAS,GAIdD,KAAK,CAJPE,KAAK;IACLC,YAAY,GAGVH,KAAK,CAHPG,YAAY;IACZC,QAAQ,GAENJ,KAAK,CAFPI,QAAQ;IAAAC,mBAAA,GAENL,KAAK,CADPM,YAAY;AAAZA,IAAAA,YAAY,GAAAD,mBAAA,KAAA,KAAA,CAAA,GAAG,UAACE,IAAI,EAAEC,IAAI,EAAA;MAAA,OAAKD,IAAI,KAAKC,IAAI,CAAA;AAAA,KAAA,GAAAH,mBAAA,CAAA;AAG9C,EAAA,IAAMI,YAAY,GAAGC,cAAc,CAACN,QAAQ,CAAC,CAAA;AAC7C,EAAA,IAAMO,gBAAgB,GAAGD,cAAc,CAACJ,YAAY,CAAC,CAAA;AAErD,EAAA,IAAAM,eAAA,GAA+BC,KAAK,CAACC,QAAQ,CAACX,YAAiB,CAAC;IAAAY,gBAAA,GAAAC,cAAA,CAAAJ,eAAA,EAAA,CAAA,CAAA;AAAzDK,IAAAA,UAAU,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,QAAQ,GAAAH,gBAAA,CAAA,CAAA,CAAA,CAAA;EAC3B,IAAAI,aAAA,GAAkCN,KAAK,CAACO,MAAM,CAACnB,SAAS,KAAKoB,SAAS,CAAC;IAAtDC,YAAY,GAAAH,aAAA,CAArBI,OAAO,CAAA;EACf,IAAMrB,KAAK,GAAGoB,YAAY,IAAI,OAAOrB,SAAS,KAAK,WAAW,GAAGA,SAAS,GAAGgB,UAAU,CAAA;AAEvF,EAAA,IAAMO,WAAuC,GAAGd,cAAc,CAC5D,UAACF,IAAI,EAAyB;AAAA,IAAA,IAAvBiB,UAAU,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAL,SAAA,GAAAK,SAAA,CAAA,CAAA,CAAA,GAAG,KAAK,CAAA;AACvB,IAAA,IAAME,SAAS,GAAGpB,IAAI,CAACN,KAAK,CAAC,CAAA;AAC7B,IAAA,IAAI,CAACoB,YAAY,EAAEJ,QAAQ,CAACU,SAAS,CAAC,CAAA;AACtC;AACA,IAAA,IAAI,CAACjB,gBAAgB,CAACT,KAAK,EAAE0B,SAAS,CAAC,EAAE,OAAA;AACzC,IAAA,IAAIH,UAAU,EAAE,OAAA;AAChBhB,IAAAA,YAAY,aAAZA,YAAY,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAZA,YAAY,CAAGmB,SAAS,CAAC,CAAA;GAC1B,EACD,CAACN,YAAY,EAAEb,YAAY,EAAEP,KAAK,EAAES,gBAAgB,CACtD,CAAC,CAAA;AAED,EAAA,OAAO,CAACT,KAAK,EAAEsB,WAAW,CAAC,CAAA;AAC7B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propsTypes.js","sources":["../../../../../../../../src/components/Box/BaseBox/types/propsTypes.ts"],"sourcesContent":["import type { View } from 'react-native';\nimport type { CSSObject } from 'styled-components';\nimport type { MarginProps, PaddingProps, SpacingValueType } from './spacingTypes';\nimport type { MakeObjectResponsive } from './responsiveTypes';\nimport type { Theme } from '~components/BladeProvider';\nimport type { Border, Elevation } from '~tokens/global';\nimport type { PickCSSByPlatform, TestID } from '~utils/types';\nimport type { Platform } from '~utils';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\ntype LayoutProps = MakeObjectResponsive<\n {\n height: SpacingValueType;\n minHeight: SpacingValueType;\n maxHeight: SpacingValueType;\n width: SpacingValueType;\n minWidth: SpacingValueType;\n maxWidth: SpacingValueType;\n } & PickCSSByPlatform<\n 'display' | 'overflow' | 'overflowX' | 'overflowY' | 'textAlign' | 'whiteSpace'\n >\n>;\n\ntype FlexboxProps = MakeObjectResponsive<\n {\n /**\n * This uses the native gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=gap\n */\n gap: SpacingValueType;\n /**\n * This uses the native row-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=row-gap\n */\n rowGap: SpacingValueType;\n /**\n * This uses the native column-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=column-gap\n */\n columnGap: SpacingValueType;\n /**\n * The **`flex`** CSS shorthand property sets how a flex _item_ will grow or shrink to fit the space available in its flex container.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/flex\n */\n flex: string | number;\n } & PickCSSByPlatform<\n | 'flexWrap'\n | 'flexDirection'\n | 'flexGrow'\n | 'flexShrink'\n | 'flexBasis'\n | 'alignItems'\n | 'alignContent'\n | 'alignSelf'\n | 'justifyItems'\n | 'justifyContent'\n | 'justifySelf'\n | 'placeSelf'\n | 'placeItems'\n | 'order'\n >\n>;\n\ntype PositionProps = MakeObjectResponsive<\n {\n top: SpacingValueType;\n right: SpacingValueType;\n bottom: SpacingValueType;\n left: SpacingValueType;\n } & PickCSSByPlatform<'position' | 'zIndex'>\n>;\n\ntype GridProps = MakeObjectResponsive<\n PickCSSByPlatform<\n | 'grid'\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n | 'gridAutoFlow'\n | 'gridAutoRows'\n | 'gridAutoColumns'\n | 'gridTemplate'\n | 'gridTemplateAreas'\n | 'gridTemplateColumns'\n | 'gridTemplateRows'\n >\n>;\n\ntype ColorObjects = 'feedback' | 'surface' | 'interactive';\ntype BackgroundOnlyColorObjects = 'popup' | 'overlay';\ntype BackgroundColorString<\n T extends ColorObjects | BackgroundOnlyColorObjects\n> = `${T}.background.${DotNotationToken<Theme['colors'][T]['background']>}`;\ntype BorderColorString<T extends ColorObjects> = `${T}.border.${DotNotationToken<\n Theme['colors'][T]['border']\n>}`;\n\n// Created this as an array so I can reuse it for runtime validation\nconst validBoxAsValues = [\n 'div',\n 'section',\n 'footer',\n 'header',\n 'main',\n 'aside',\n 'nav',\n 'span',\n 'label',\n] as const;\n\ntype BoxAsType = typeof validBoxAsValues[number];\n\n// Visual props that are common for both Box and BaseBox\ntype CommonBoxVisualProps = MakeObjectResponsive<\n {\n borderRadius: keyof Border['radius'];\n borderWidth: keyof Border['width'];\n borderColor: BorderColorString<'surface'>;\n borderTopWidth: keyof Border['width'];\n borderTopColor: BorderColorString<'surface'>;\n borderRightWidth: keyof Border['width'];\n borderRightColor: BorderColorString<'surface'>;\n borderBottomWidth: keyof Border['width'];\n borderBottomColor: BorderColorString<'surface'>;\n borderLeftWidth: keyof Border['width'];\n borderLeftColor: BorderColorString<'surface'>;\n borderTopLeftRadius: keyof Border['radius'];\n borderTopRightRadius: keyof Border['radius'];\n borderBottomRightRadius: keyof Border['radius'];\n borderBottomLeftRadius: keyof Border['radius'];\n } & PickCSSByPlatform<\n | 'backgroundImage'\n | 'backgroundSize'\n | 'backgroundPosition'\n | 'backgroundOrigin'\n | 'backgroundRepeat'\n | 'pointerEvents'\n | 'opacity'\n | 'visibility'\n | 'transform'\n | 'transformOrigin'\n | 'clipPath'\n | 'borderStyle'\n | 'borderTopStyle'\n | 'borderBottomStyle'\n | 'borderLeftStyle'\n | 'borderRightStyle'\n > & {\n /**\n * Sets the elevation for Box\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--page\n */\n elevation?: keyof Elevation;\n }\n>;\n\n// Visual props that are specific BaseBox\n// This is used to ensure some of the more flexible BaseBox props are not passed to Box\ntype BaseBoxVisualProps = MakeObjectResponsive<\n {\n backgroundColor:\n | BackgroundColorString<'feedback'>\n | BackgroundColorString<'surface'>\n | BackgroundColorString<'interactive'>\n | BackgroundColorString<'overlay'>\n | BackgroundColorString<'popup'>\n | 'transparent'\n | (string & Record<never, never>);\n lineHeight: SpacingValueType;\n touchAction: CSSObject['touchAction'];\n userSelect: CSSObject['userSelect'];\n } & PickCSSByPlatform<\n | 'border'\n | 'borderLeft'\n | 'borderRight'\n | 'borderTop'\n | 'borderBottom'\n | 'opacity'\n | 'pointerEvents'\n | 'cursor'\n >\n>;\n\n// Visual props that are specific to Box\ntype BoxVisualProps = MakeObjectResponsive<{\n backgroundColor: BackgroundColorString<'surface'> | 'transparent';\n}> & {\n // Intentionally keeping this outside of MakeObjectResponsive since we only want as to be string and not responsive object\n // styled-components do not support passing `as` prop as an object\n as: BoxAsType;\n};\n\ntype StyledPropsBlade = Partial<\n Omit<\n MarginProps &\n Pick<FlexboxProps, 'alignSelf' | 'justifySelf' | 'placeSelf' | 'order'> &\n PositionProps &\n Pick<\n GridProps,\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n > &\n Pick<LayoutProps, 'display'> &\n Pick<CommonBoxVisualProps, 'visibility'>,\n '__brand__'\n >\n>;\n\ntype BoxCallbackProps = Omit<\n Platform.Select<{\n web: {\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseOver: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseEnter: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseLeave: React.MouseEventHandler<HTMLElement>;\n onScroll: React.UIEventHandler<HTMLElement>;\n };\n native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;\n }>,\n '__brand__'\n>;\n\ntype BoxDragAndDropProps = Omit<\n Platform.Select<{\n web: {\n draggable: boolean;\n onDragStart: React.DragEventHandler<HTMLElement>;\n onDragEnter: React.DragEventHandler<HTMLElement>;\n onDragLeave: React.DragEventHandler<HTMLElement>;\n onDragOver: React.DragEventHandler<HTMLElement>;\n onDragEnd: React.DragEventHandler<HTMLElement>;\n onDrop: React.DragEventHandler<HTMLElement>;\n };\n native: Record<\n | 'draggable'\n | 'onDragStart'\n | 'onDragEnter'\n | 'onDragLeave'\n | 'onDragOver'\n | 'onDragEnd'\n | 'onDrop',\n undefined\n >;\n }>,\n '__brand__'\n>;\n\ntype BoxProps = Partial<\n PaddingProps &\n MarginProps &\n LayoutProps &\n FlexboxProps &\n PositionProps &\n GridProps &\n BoxCallbackProps &\n BoxDragAndDropProps &\n CommonBoxVisualProps &\n BoxVisualProps & {\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n id?: string;\n } & TestID\n>;\n\n// Visual props have different types for BaseBox and Box. BaseBox has more flexible types and more props exposed.\n// So first we Omit Visual props of Box\n// Then we append BaseBoxVisualProps and some other props for styled-components like class and id\ntype BaseBoxProps = Omit<BoxProps, keyof BoxVisualProps> &\n Partial<\n BaseBoxVisualProps & {\n className?: string;\n id?: string;\n tabIndex?: number;\n }\n > &\n BladeCommonEvents;\n\n// ref prop type\ntype BoxRefType = Platform.Select<{\n web: Omit<HTMLElement, 'style'>;\n native: View;\n}>;\n\nexport type { BaseBoxProps, BoxProps, BoxRefType, StyledPropsBlade, FlexboxProps };\nexport { validBoxAsValues };\n"],"names":["validBoxAsValues"],"mappings":"AA6GA;AACMA,IAAAA,gBAAgB,GAAG,CACvB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO;;;;"}
|
|
1
|
+
{"version":3,"file":"propsTypes.js","sources":["../../../../../../../../src/components/Box/BaseBox/types/propsTypes.ts"],"sourcesContent":["import type { View } from 'react-native';\nimport type { CSSObject } from 'styled-components';\nimport type { MarginProps, PaddingProps, SpacingValueType } from './spacingTypes';\nimport type { MakeObjectResponsive } from './responsiveTypes';\nimport type { Theme } from '~components/BladeProvider';\nimport type { Border, Elevation } from '~tokens/global';\nimport type { PickCSSByPlatform, TestID } from '~utils/types';\nimport type { Platform } from '~utils';\nimport type { BladeCommonEvents } from '~components/types';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\ntype LayoutProps = MakeObjectResponsive<\n {\n height: SpacingValueType;\n minHeight: SpacingValueType;\n maxHeight: SpacingValueType;\n width: SpacingValueType;\n minWidth: SpacingValueType;\n maxWidth: SpacingValueType;\n } & PickCSSByPlatform<\n 'display' | 'overflow' | 'overflowX' | 'overflowY' | 'textAlign' | 'whiteSpace'\n >\n>;\n\ntype FlexboxProps = MakeObjectResponsive<\n {\n /**\n * This uses the native gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=gap\n */\n gap: SpacingValueType;\n /**\n * This uses the native row-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=row-gap\n */\n rowGap: SpacingValueType;\n /**\n * This uses the native column-gap property which might not work on older browsers.\n * If you want to support older browsers, you might want to use `margin` instead.\n *\n * @see https://caniuse.com/?search=column-gap\n */\n columnGap: SpacingValueType;\n /**\n * The **`flex`** CSS shorthand property sets how a flex _item_ will grow or shrink to fit the space available in its flex container.\n *\n * @see https://developer.mozilla.org/docs/Web/CSS/flex\n */\n flex: string | number;\n } & PickCSSByPlatform<\n | 'flexWrap'\n | 'flexDirection'\n | 'flexGrow'\n | 'flexShrink'\n | 'flexBasis'\n | 'alignItems'\n | 'alignContent'\n | 'alignSelf'\n | 'justifyItems'\n | 'justifyContent'\n | 'justifySelf'\n | 'placeSelf'\n | 'placeItems'\n | 'order'\n >\n>;\n\ntype PositionProps = MakeObjectResponsive<\n {\n top: SpacingValueType;\n right: SpacingValueType;\n bottom: SpacingValueType;\n left: SpacingValueType;\n } & PickCSSByPlatform<'position' | 'zIndex'>\n>;\n\ntype GridProps = MakeObjectResponsive<\n PickCSSByPlatform<\n | 'grid'\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n | 'gridAutoFlow'\n | 'gridAutoRows'\n | 'gridAutoColumns'\n | 'gridTemplate'\n | 'gridTemplateAreas'\n | 'gridTemplateColumns'\n | 'gridTemplateRows'\n >\n>;\n\ntype ColorObjects = 'feedback' | 'surface' | 'interactive';\ntype BackgroundOnlyColorObjects = 'popup' | 'overlay';\ntype BackgroundColorString<\n T extends ColorObjects | BackgroundOnlyColorObjects\n> = `${T}.background.${DotNotationToken<Theme['colors'][T]['background']>}`;\ntype BorderColorString<T extends ColorObjects> = `${T}.border.${DotNotationToken<\n Theme['colors'][T]['border']\n>}`;\n\n// Created this as an array so I can reuse it for runtime validation\nconst validBoxAsValues = [\n 'div',\n 'section',\n 'footer',\n 'header',\n 'main',\n 'aside',\n 'nav',\n 'span',\n 'label',\n] as const;\n\ntype BoxAsType = typeof validBoxAsValues[number];\n\n// Visual props that are common for both Box and BaseBox\ntype CommonBoxVisualProps = MakeObjectResponsive<\n {\n borderRadius: keyof Border['radius'];\n borderWidth: keyof Border['width'];\n borderColor: BorderColorString<'surface'>;\n borderTopWidth: keyof Border['width'];\n borderTopColor: BorderColorString<'surface'>;\n borderRightWidth: keyof Border['width'];\n borderRightColor: BorderColorString<'surface'>;\n borderBottomWidth: keyof Border['width'];\n borderBottomColor: BorderColorString<'surface'>;\n borderLeftWidth: keyof Border['width'];\n borderLeftColor: BorderColorString<'surface'>;\n borderTopLeftRadius: keyof Border['radius'];\n borderTopRightRadius: keyof Border['radius'];\n borderBottomRightRadius: keyof Border['radius'];\n borderBottomLeftRadius: keyof Border['radius'];\n } & PickCSSByPlatform<\n | 'backgroundImage'\n | 'backgroundSize'\n | 'backgroundPosition'\n | 'backgroundOrigin'\n | 'backgroundRepeat'\n | 'pointerEvents'\n | 'opacity'\n | 'visibility'\n | 'transform'\n | 'transformOrigin'\n | 'clipPath'\n | 'borderStyle'\n | 'borderTopStyle'\n | 'borderBottomStyle'\n | 'borderLeftStyle'\n | 'borderRightStyle'\n > & {\n /**\n * Sets the elevation for Box\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n }\n>;\n\n// Visual props that are specific BaseBox\n// This is used to ensure some of the more flexible BaseBox props are not passed to Box\ntype BaseBoxVisualProps = MakeObjectResponsive<\n {\n backgroundColor:\n | BackgroundColorString<'feedback'>\n | BackgroundColorString<'surface'>\n | BackgroundColorString<'interactive'>\n | BackgroundColorString<'overlay'>\n | BackgroundColorString<'popup'>\n | 'transparent'\n | (string & Record<never, never>);\n lineHeight: SpacingValueType;\n touchAction: CSSObject['touchAction'];\n userSelect: CSSObject['userSelect'];\n } & PickCSSByPlatform<\n | 'border'\n | 'borderLeft'\n | 'borderRight'\n | 'borderTop'\n | 'borderBottom'\n | 'opacity'\n | 'pointerEvents'\n | 'cursor'\n >\n>;\n\n// Visual props that are specific to Box\ntype BoxVisualProps = MakeObjectResponsive<{\n backgroundColor: BackgroundColorString<'surface'> | 'transparent';\n}> & {\n // Intentionally keeping this outside of MakeObjectResponsive since we only want as to be string and not responsive object\n // styled-components do not support passing `as` prop as an object\n as: BoxAsType;\n};\n\ntype StyledPropsBlade = Partial<\n Omit<\n MarginProps &\n Pick<FlexboxProps, 'alignSelf' | 'justifySelf' | 'placeSelf' | 'order'> &\n PositionProps &\n Pick<\n GridProps,\n | 'gridColumn'\n | 'gridRow'\n | 'gridRowStart'\n | 'gridRowEnd'\n | 'gridColumnStart'\n | 'gridColumnEnd'\n | 'gridArea'\n > &\n Pick<LayoutProps, 'display'> &\n Pick<CommonBoxVisualProps, 'visibility'>,\n '__brand__'\n >\n>;\n\ntype BoxCallbackProps = Omit<\n Platform.Select<{\n web: {\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseOver: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseEnter: React.MouseEventHandler<HTMLElement>;\n /**\n * **Warning**\n *\n * Make sure to not use Box when you want to create a trigger that performs action on hover.\n * You would probably want to render it as `button` using `styled.button` instead.\n *\n * Use this for hoverable containers in cases like custom menus.\n */\n onMouseLeave: React.MouseEventHandler<HTMLElement>;\n onScroll: React.UIEventHandler<HTMLElement>;\n };\n native: Record<'onMouseOver' | 'onMouseEnter' | 'onMouseLeave' | 'onScroll', undefined>;\n }>,\n '__brand__'\n>;\n\ntype BoxDragAndDropProps = Omit<\n Platform.Select<{\n web: {\n draggable: boolean;\n onDragStart: React.DragEventHandler<HTMLElement>;\n onDragEnter: React.DragEventHandler<HTMLElement>;\n onDragLeave: React.DragEventHandler<HTMLElement>;\n onDragOver: React.DragEventHandler<HTMLElement>;\n onDragEnd: React.DragEventHandler<HTMLElement>;\n onDrop: React.DragEventHandler<HTMLElement>;\n };\n native: Record<\n | 'draggable'\n | 'onDragStart'\n | 'onDragEnter'\n | 'onDragLeave'\n | 'onDragOver'\n | 'onDragEnd'\n | 'onDrop',\n undefined\n >;\n }>,\n '__brand__'\n>;\n\ntype BoxProps = Partial<\n PaddingProps &\n MarginProps &\n LayoutProps &\n FlexboxProps &\n PositionProps &\n GridProps &\n BoxCallbackProps &\n BoxDragAndDropProps &\n CommonBoxVisualProps &\n BoxVisualProps & {\n children?: React.ReactNode | React.ReactNode[];\n tabIndex?: number;\n id?: string;\n } & TestID\n>;\n\n// Visual props have different types for BaseBox and Box. BaseBox has more flexible types and more props exposed.\n// So first we Omit Visual props of Box\n// Then we append BaseBoxVisualProps and some other props for styled-components like class and id\ntype BaseBoxProps = Omit<BoxProps, keyof BoxVisualProps> &\n Partial<\n BaseBoxVisualProps & {\n className?: string;\n id?: string;\n tabIndex?: number;\n }\n > &\n BladeCommonEvents;\n\n// ref prop type\ntype BoxRefType = Platform.Select<{\n web: Omit<HTMLElement, 'style'>;\n native: View;\n}>;\n\nexport type { BaseBoxProps, BoxProps, BoxRefType, StyledPropsBlade, FlexboxProps };\nexport { validBoxAsValues };\n"],"names":["validBoxAsValues"],"mappings":"AA6GA;AACMA,IAAAA,gBAAgB,GAAG,CACvB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,MAAM,EACN,OAAO;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--page\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--page\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * @default false\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n StyledPropsBlade;\n\nconst Card = ({\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n ...styledProps\n}: CardProps): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <CardProvider>\n <CardRoot\n as={as}\n display={'block' as never}\n borderRadius=\"medium\"\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(styledProps)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID;\n\nconst _CardBody = ({ height, children, testID }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.CardBody, testID })} height={height}>\n {children}\n </BaseBox>\n );\n};\n\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","Card","_ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","onFocus","onBlur","defaultRel","undefined","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","getStyledProps","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","useVerifyInsideCard","BaseBox","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,eAAe,EAAE,iBAAiB;AAClCC,EAAAA,gBAAgB,EAAE,kBAAkB;AACpCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,s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
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../../../src/components/Card/Card.tsx"],"sourcesContent":["import React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { CardSurface } from './CardSurface';\nimport { CardProvider, useVerifyInsideCard } from './CardContext';\nimport { LinkOverlay } from './LinkOverlay';\nimport { CardRoot } from './CardRoot';\nimport type { CardSpacingValueType, LinkOverlayProps } from './types';\nimport { CARD_LINK_OVERLAY_ID } from './constants';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type { TestID } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport type { Elevation } from '~tokens/global';\nimport type { BoxProps } from '~components/Box';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { useVerifyAllowedChildren } from '~utils/useVerifyAllowedChildren/useVerifyAllowedChildren';\nimport type { Platform } from '~utils';\nimport { isReactNative } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport type { DotNotationToken } from '~utils/lodashButBetter/get';\n\nexport const ComponentIds = {\n CardHeader: 'CardHeader',\n CardHeaderTrailing: 'CardHeaderTrailing',\n CardHeaderLeading: 'CardHeaderLeading',\n CardFooter: 'CardFooter',\n CardFooterTrailing: 'CardFooterTrailing',\n CardFooterLeading: 'CardFooterLeading',\n CardBody: 'CardBody',\n CardHeaderIcon: 'CardHeaderIcon',\n CardHeaderCounter: 'CardHeaderCounter',\n CardHeaderBadge: 'CardHeaderBadge',\n CardHeaderAmount: 'CardHeaderAmount',\n CardHeaderText: 'CardHeaderText',\n CardHeaderLink: 'CardHeaderLink',\n CardHeaderIconButton: 'CardHeaderIconButton',\n};\n\ntype CardSurfaceBackgroundColors = `surface.background.gray.${DotNotationToken<\n Theme['colors']['surface']['background']['gray']\n>}`;\n\nexport type CardProps = {\n /**\n * Card contents\n */\n children: React.ReactNode;\n /**\n * Sets the background color of the Card\n *\n * @default `surface.background.gray.intense`\n */\n backgroundColor?: CardSurfaceBackgroundColors;\n /**\n * Sets the border radius of the Card\n *\n * @default `medium`\n */\n borderRadius?: Extract<BoxProps['borderRadius'], 'medium' | 'large' | 'xlarge'>;\n /**\n * Sets the elevation for Cards\n *\n * eg: `theme.elevation.midRaised`\n *\n * @default `theme.elevation.lowRaised`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-elevation--docs\n */\n elevation?: keyof Elevation;\n /**\n * Sets the padding equally on all sides. Only few `spacing` tokens are allowed deliberately\n * @default `spacing.7`\n *\n * **Links:**\n * - Docs: https://blade.razorpay.com/?path=/docs/tokens-spacing--docs\n */\n padding?: CardSpacingValueType;\n /**\n * Sets the width of the card\n */\n width?: BoxProps['width'];\n /**\n * Sets the height of the card\n */\n height?: BoxProps['height'];\n /**\n * Sets minimum height of the card\n */\n minHeight?: BoxProps['minHeight'];\n /**\n * Sets minimum width of the card\n */\n minWidth?: BoxProps['minWidth'];\n /**\n * If `true`, the card will be in selected state\n * Card will have a primary color border around it.\n *\n * @default false\n */\n\n isSelected?: boolean;\n /**\n * Makes the Card linkable by setting the `href` prop\n *\n * @default undefined\n */\n href?: string;\n /**\n * Sets the `target` attribute for the linkable card\n */\n target?: string;\n /**\n * Sets the `rel` attribute for the linkable card\n */\n rel?: string;\n /**\n * Sets the accessibility label for the card\n * This is useful when the card has an `href` or `onClick` prop\n * Setting this will announce the label when the card is focused\n */\n accessibilityLabel?: string;\n /**\n * If `true`, the card will scale up on hover\n *\n * On mobile devices it will scale down on press\n *\n * @default false\n */\n shouldScaleOnHover?: boolean;\n /**\n * Callback triggered when the card is hovered\n */\n onHover?: () => void;\n /**\n * Callback triggered when the card is clicked\n */\n onClick?: (\n event: Platform.Select<{\n web: React.MouseEvent;\n native: GestureResponderEvent;\n }>,\n ) => void;\n /**\n * Sets the HTML element for the Card\n *\n * When `as` is set to `label`, the card will be rendered as a label element\n * This can be used to create a custom checkbox or radio button using the card\n *\n * @default undefined\n */\n as?: 'label';\n} & TestID &\n StyledPropsBlade;\n\nconst Card = ({\n children,\n backgroundColor = 'surface.background.gray.intense',\n borderRadius = 'medium',\n elevation = 'lowRaised',\n testID,\n padding = 'spacing.7',\n width,\n height,\n minHeight,\n minWidth,\n onClick,\n isSelected = false,\n accessibilityLabel,\n shouldScaleOnHover = false,\n onHover,\n href,\n target,\n rel,\n as,\n ...styledProps\n}: CardProps): React.ReactElement => {\n const [isFocused, setIsFocused] = React.useState(false);\n\n useVerifyAllowedChildren({\n children,\n componentName: 'Card',\n allowedComponents: [ComponentIds.CardHeader, ComponentIds.CardBody, ComponentIds.CardFooter],\n });\n\n const linkOverlayProps: LinkOverlayProps = {\n ...metaAttribute({ name: CARD_LINK_OVERLAY_ID }),\n ...makeAccessible({ label: accessibilityLabel, pressed: isSelected }),\n onFocus: () => {\n setIsFocused(true);\n },\n onBlur: () => {\n setIsFocused(false);\n },\n };\n const defaultRel = target && target === '_blank' ? 'noreferrer noopener' : undefined;\n\n return (\n <CardProvider>\n <CardRoot\n as={as}\n display={'block' as never}\n borderRadius=\"medium\"\n onMouseEnter={onHover as never}\n shouldScaleOnHover={shouldScaleOnHover}\n isSelected={isSelected}\n isFocused={isFocused}\n // on react native we need to pass onClick to root, because we don't need the LinkOverlay in RN\n onClick={isReactNative() ? onClick : undefined}\n width={width}\n height={height}\n minHeight={minHeight}\n minWidth={minWidth}\n href={href}\n accessibilityLabel={accessibilityLabel}\n {...metaAttribute({ name: MetaConstants.Card, testID })}\n {...getStyledProps(styledProps)}\n >\n <CardSurface\n height={height}\n minHeight={minHeight}\n padding={padding}\n borderRadius={borderRadius}\n elevation={elevation}\n textAlign={'left' as never}\n backgroundColor={backgroundColor}\n >\n {href ? (\n <LinkOverlay\n onClick={onClick}\n href={href}\n target={target}\n rel={rel ?? defaultRel}\n {...linkOverlayProps}\n />\n ) : null}\n {!href && onClick ? (\n <LinkOverlay as=\"button\" onClick={onClick} {...linkOverlayProps} />\n ) : null}\n {children}\n </CardSurface>\n </CardRoot>\n </CardProvider>\n );\n};\n\ntype CardBodyProps = {\n children: React.ReactNode;\n height?: BoxProps['height'];\n} & TestID;\n\nconst _CardBody = ({ height, children, testID }: CardBodyProps): React.ReactElement => {\n useVerifyInsideCard('CardBody');\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.CardBody, testID })} height={height}>\n {children}\n </BaseBox>\n );\n};\n\nconst CardBody = assignWithoutSideEffects(_CardBody, { componentId: ComponentIds.CardBody });\n\nexport { Card, CardBody };\n"],"names":["ComponentIds","CardHeader","CardHeaderTrailing","CardHeaderLeading","CardFooter","CardFooterTrailing","CardFooterLeading","CardBody","CardHeaderIcon","CardHeaderCounter","CardHeaderBadge","CardHeaderAmount","CardHeaderText","CardHeaderLink","CardHeaderIconButton","Card","_ref","children","_ref$backgroundColor","backgroundColor","_ref$borderRadius","borderRadius","_ref$elevation","elevation","testID","_ref$padding","padding","width","height","minHeight","minWidth","onClick","_ref$isSelected","isSelected","accessibilityLabel","_ref$shouldScaleOnHov","shouldScaleOnHover","onHover","href","target","rel","as","styledProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","isFocused","setIsFocused","useVerifyAllowedChildren","componentName","allowedComponents","linkOverlayProps","_objectSpread","metaAttribute","name","CARD_LINK_OVERLAY_ID","makeAccessible","label","pressed","onFocus","onBlur","defaultRel","undefined","_jsx","CardProvider","CardRoot","display","onMouseEnter","isReactNative","MetaConstants","getStyledProps","_jsxs","CardSurface","textAlign","LinkOverlay","_CardBody","_ref2","useVerifyInsideCard","BaseBox","assignWithoutSideEffects","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,kBAAkB,EAAE,oBAAoB;AACxCC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,UAAU,EAA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CAAC;IAAEC,IAAI,EAAEe,aAAa,CAAClE,QAAQ;AAAEiB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAEI,IAAAA,MAAM,EAAEA,MAAO;AAAAX,IAAAA,QAAA,EAClFA,QAAAA;AAAQ,GAAA,CACF,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMV,QAAQ,gBAAG4E,wBAAwB,CAACJ,SAAS,EAAE;EAAEK,WAAW,EAAEpF,YAAY,CAACO,QAAAA;AAAS,CAAC;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
import React__default from 'react';
|
|
@@ -20,8 +19,10 @@ import '../../utils/makeAccessible/index.js';
|
|
|
20
19
|
import '../../utils/metaAttribute/index.js';
|
|
21
20
|
import { useVerifyAllowedChildren } from '../../utils/useVerifyAllowedChildren/useVerifyAllowedChildren.js';
|
|
22
21
|
import '../BladeProvider/index.js';
|
|
23
|
-
import { useFirstRender } from '../../utils/useFirstRender.js';
|
|
24
22
|
import '../Box/styledProps/index.js';
|
|
23
|
+
import { useControllableState } from '../../utils/useControllable.js';
|
|
24
|
+
import { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect.js';
|
|
25
|
+
import { useDidUpdate } from '../../utils/useDidUpdate.js';
|
|
25
26
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
26
27
|
import { Box } from '../Box/Box.js';
|
|
27
28
|
import { NavigationButton } from './NavigationButton/NavigationButton.js';
|
|
@@ -29,14 +30,13 @@ import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
|
29
30
|
import { castWebType } from '../../utils/platform/castUtils.js';
|
|
30
31
|
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
31
32
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
32
|
-
import { usePrevious } from '../../utils/usePrevious/usePrevious.js';
|
|
33
33
|
import useTheme from '../BladeProvider/useTheme.js';
|
|
34
34
|
import { useInterval } from '../../utils/useInterval.js';
|
|
35
35
|
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
36
36
|
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
37
37
|
import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
|
|
38
38
|
|
|
39
|
-
var _excluded = ["autoPlay", "visibleItems", "showIndicators", "navigationButtonPosition", "children", "shouldAddStartEndSpacing", "carouselItemWidth", "scrollOverlayColor", "accessibilityLabel", "onChange", "indicatorVariant", "navigationButtonVariant", "carouselItemAlignment", "height"];
|
|
39
|
+
var _excluded = ["autoPlay", "visibleItems", "showIndicators", "navigationButtonPosition", "children", "shouldAddStartEndSpacing", "carouselItemWidth", "scrollOverlayColor", "accessibilityLabel", "onChange", "indicatorVariant", "navigationButtonVariant", "carouselItemAlignment", "height", "defaultActiveSlide", "activeSlide"];
|
|
40
40
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
41
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
42
42
|
var Controls = function Controls(_ref) {
|
|
@@ -191,24 +191,6 @@ var CarouselBody = /*#__PURE__*/React__default.forwardRef(function (_ref3, ref)
|
|
|
191
191
|
})
|
|
192
192
|
}));
|
|
193
193
|
});
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* A custom hook which syncs an effect with a state
|
|
197
|
-
* While ignoring the first render & only running the effect when the state changes
|
|
198
|
-
*/
|
|
199
|
-
function useSyncUpdateEffect(effect, stateToSyncWith, deps) {
|
|
200
|
-
var isFirst = useFirstRender();
|
|
201
|
-
var prevState = usePrevious(stateToSyncWith);
|
|
202
|
-
React__default.useEffect(function () {
|
|
203
|
-
if (!isFirst) {
|
|
204
|
-
// if the state is the same as the previous state
|
|
205
|
-
// we don't want to run the effect
|
|
206
|
-
if (prevState === stateToSyncWith) return;
|
|
207
|
-
return effect();
|
|
208
|
-
}
|
|
209
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
210
|
-
}, [stateToSyncWith].concat(_toConsumableArray(deps)));
|
|
211
|
-
}
|
|
212
194
|
var Carousel = function Carousel(_ref4) {
|
|
213
195
|
var autoPlay = _ref4.autoPlay,
|
|
214
196
|
_ref4$visibleItems = _ref4.visibleItems,
|
|
@@ -223,7 +205,7 @@ var Carousel = function Carousel(_ref4) {
|
|
|
223
205
|
carouselItemWidth = _ref4.carouselItemWidth,
|
|
224
206
|
scrollOverlayColor = _ref4.scrollOverlayColor,
|
|
225
207
|
accessibilityLabel = _ref4.accessibilityLabel,
|
|
226
|
-
|
|
208
|
+
_onChange = _ref4.onChange,
|
|
227
209
|
_ref4$indicatorVarian = _ref4.indicatorVariant,
|
|
228
210
|
indicatorVariant = _ref4$indicatorVarian === void 0 ? 'gray' : _ref4$indicatorVarian,
|
|
229
211
|
_ref4$navigationButto2 = _ref4.navigationButtonVariant,
|
|
@@ -231,43 +213,52 @@ var Carousel = function Carousel(_ref4) {
|
|
|
231
213
|
_ref4$carouselItemAli = _ref4.carouselItemAlignment,
|
|
232
214
|
carouselItemAlignment = _ref4$carouselItemAli === void 0 ? 'start' : _ref4$carouselItemAli,
|
|
233
215
|
height = _ref4.height,
|
|
216
|
+
defaultActiveSlide = _ref4.defaultActiveSlide,
|
|
217
|
+
activeSlideProp = _ref4.activeSlide,
|
|
234
218
|
props = _objectWithoutProperties(_ref4, _excluded);
|
|
235
219
|
var _useTheme = useTheme(),
|
|
236
220
|
platform = _useTheme.platform;
|
|
237
221
|
var _React$useState = React__default.useState(0),
|
|
238
222
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
var
|
|
223
|
+
activeIndicator = _React$useState2[0],
|
|
224
|
+
setActiveIndicator = _React$useState2[1];
|
|
225
|
+
var _useControllableState = useControllableState({
|
|
226
|
+
defaultValue: defaultActiveSlide !== null && defaultActiveSlide !== void 0 ? defaultActiveSlide : 0,
|
|
227
|
+
value: activeSlideProp,
|
|
228
|
+
onChange: function onChange(value) {
|
|
229
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(value);
|
|
230
|
+
}
|
|
231
|
+
}),
|
|
232
|
+
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
|
233
|
+
activeSlide = _useControllableState2[0],
|
|
234
|
+
setActiveSlide = _useControllableState2[1];
|
|
235
|
+
var _React$useState3 = React__default.useState(false),
|
|
242
236
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
var _React$useState5 = React__default.useState(
|
|
237
|
+
shouldPauseAutoplay = _React$useState4[0],
|
|
238
|
+
setShouldPauseAutoplay = _React$useState4[1];
|
|
239
|
+
var _React$useState5 = React__default.useState(0),
|
|
246
240
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
var _React$useState7 = React__default.useState(0),
|
|
250
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
251
|
-
startEndMargin = _React$useState8[0],
|
|
252
|
-
setStartEndMargin = _React$useState8[1];
|
|
241
|
+
startEndMargin = _React$useState6[0],
|
|
242
|
+
setStartEndMargin = _React$useState6[1];
|
|
253
243
|
var containerRef = React__default.useRef(null);
|
|
254
244
|
var isMobile = platform === 'onMobile';
|
|
255
|
-
var id = useId(
|
|
245
|
+
var id = useId();
|
|
246
|
+
var carouselId = "carousel-".concat(id);
|
|
256
247
|
useVerifyAllowedChildren({
|
|
257
248
|
componentName: 'Carousel',
|
|
258
249
|
allowedComponents: [componentIds.CarouselItem],
|
|
259
250
|
children: children
|
|
260
251
|
});
|
|
261
|
-
var _React$
|
|
252
|
+
var _React$useState7 = React__default.useState(
|
|
262
253
|
// on mobile we do not want to render the overlay
|
|
263
254
|
isMobile ? true : !shouldAddStartEndSpacing),
|
|
255
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
256
|
+
isScrollAtStart = _React$useState8[0],
|
|
257
|
+
setScrollStart = _React$useState8[1];
|
|
258
|
+
var _React$useState9 = React__default.useState(isMobile),
|
|
264
259
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var _React$useState11 = React__default.useState(isMobile),
|
|
268
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
269
|
-
isScrollAtEnd = _React$useState12[0],
|
|
270
|
-
setScrollEnd = _React$useState12[1];
|
|
260
|
+
isScrollAtEnd = _React$useState10[0],
|
|
261
|
+
setScrollEnd = _React$useState10[1];
|
|
271
262
|
var isResponsive = visibleItems === 'autofit';
|
|
272
263
|
var _visibleItems = visibleItems;
|
|
273
264
|
if (isMobile) {
|
|
@@ -296,31 +287,36 @@ var Carousel = function Carousel(_ref4) {
|
|
|
296
287
|
|
|
297
288
|
// calculate the start/end margin so that we can
|
|
298
289
|
// deduct that margin when scrolling to a carousel item with goToSlideIndex
|
|
299
|
-
|
|
290
|
+
useIsomorphicLayoutEffect(function () {
|
|
300
291
|
var _carouselItem$getBoun, _containerRef$current;
|
|
301
292
|
// Do not calculate if not needed
|
|
302
293
|
if (!isResponsive && !shouldAddStartEndSpacing) return;
|
|
303
294
|
if (!containerRef.current) return;
|
|
304
|
-
var carouselItemId = getCarouselItemId(
|
|
295
|
+
var carouselItemId = getCarouselItemId(carouselId, 0);
|
|
305
296
|
var carouselItem = containerRef.current.querySelector(carouselItemId);
|
|
306
297
|
if (!carouselItem) return;
|
|
307
298
|
var carouselItemLeft = (_carouselItem$getBoun = carouselItem.getBoundingClientRect().left) !== null && _carouselItem$getBoun !== void 0 ? _carouselItem$getBoun : 0;
|
|
308
299
|
var carouselContainerLeft = (_containerRef$current = containerRef.current.getBoundingClientRect().left) !== null && _containerRef$current !== void 0 ? _containerRef$current : 0;
|
|
309
300
|
setStartEndMargin(carouselItemLeft - carouselContainerLeft);
|
|
310
|
-
}, [
|
|
311
|
-
var
|
|
301
|
+
}, [carouselId, isResponsive, shouldAddStartEndSpacing]);
|
|
302
|
+
var scrollToSlide = function scrollToSlide(slideIndex) {
|
|
312
303
|
var _ref5;
|
|
304
|
+
var shouldAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
313
305
|
if (!containerRef.current) return;
|
|
314
|
-
var carouselItemId = getCarouselItemId(
|
|
306
|
+
var carouselItemId = getCarouselItemId(carouselId, slideIndex * _visibleItems);
|
|
315
307
|
var carouselItem = containerRef.current.querySelector(carouselItemId);
|
|
316
308
|
if (!carouselItem) return;
|
|
317
309
|
var carouselItemLeft = (_ref5 = carouselItem.getBoundingClientRect().left - containerRef.current.getBoundingClientRect().left) !== null && _ref5 !== void 0 ? _ref5 : 0;
|
|
318
310
|
var left = containerRef.current.scrollLeft + carouselItemLeft;
|
|
319
311
|
containerRef.current.scroll({
|
|
320
312
|
left: left - startEndMargin,
|
|
321
|
-
behavior: 'smooth'
|
|
313
|
+
behavior: shouldAnimate ? 'smooth' : 'auto'
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
var goToSlideIndex = function goToSlideIndex(slideIndex) {
|
|
317
|
+
setActiveSlide(function () {
|
|
318
|
+
return slideIndex;
|
|
322
319
|
});
|
|
323
|
-
setActiveSlide(slideIndex);
|
|
324
320
|
setActiveIndicator(slideIndex);
|
|
325
321
|
};
|
|
326
322
|
var goToNextSlide = function goToNextSlide() {
|
|
@@ -394,13 +390,16 @@ var Carousel = function Carousel(_ref4) {
|
|
|
394
390
|
}
|
|
395
391
|
var slideIndex = Number(carouselItem === null || carouselItem === void 0 ? void 0 : carouselItem.getAttribute('data-slide-index'));
|
|
396
392
|
var goTo = Math.ceil(slideIndex / _visibleItems);
|
|
393
|
+
setActiveSlide(function () {
|
|
394
|
+
return goTo;
|
|
395
|
+
});
|
|
397
396
|
setActiveIndicator(goTo);
|
|
398
|
-
setActiveSlide(goTo);
|
|
399
397
|
}, 50);
|
|
400
398
|
carouselContainer.addEventListener('scroll', handleScroll);
|
|
401
399
|
return function () {
|
|
402
400
|
carouselContainer === null || carouselContainer === void 0 ? void 0 : carouselContainer.removeEventListener('scroll', handleScroll);
|
|
403
401
|
};
|
|
402
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
404
403
|
}, [_visibleItems, isMobile, isResponsive, shouldAddStartEndSpacing]);
|
|
405
404
|
|
|
406
405
|
// auto play
|
|
@@ -411,6 +410,18 @@ var Carousel = function Carousel(_ref4) {
|
|
|
411
410
|
// only enable if autoplay is true & user's intent isn't to interact with carousel
|
|
412
411
|
enable: autoPlay && !shouldPauseAutoplay
|
|
413
412
|
});
|
|
413
|
+
|
|
414
|
+
// set initial active slide on mount
|
|
415
|
+
useIsomorphicLayoutEffect(function () {
|
|
416
|
+
if (!id) return;
|
|
417
|
+
goToSlideIndex(activeSlide);
|
|
418
|
+
scrollToSlide(activeSlide, false);
|
|
419
|
+
}, [id]);
|
|
420
|
+
|
|
421
|
+
// Scroll the carousel to the active slide
|
|
422
|
+
useDidUpdate(function () {
|
|
423
|
+
scrollToSlide(activeSlide);
|
|
424
|
+
}, [activeSlide]);
|
|
414
425
|
var carouselContext = React__default.useMemo(function () {
|
|
415
426
|
return {
|
|
416
427
|
isResponsive: isResponsive,
|
|
@@ -418,16 +429,13 @@ var Carousel = function Carousel(_ref4) {
|
|
|
418
429
|
carouselItemWidth: carouselItemWidth,
|
|
419
430
|
carouselContainerRef: containerRef,
|
|
420
431
|
setActiveIndicator: setActiveIndicator,
|
|
421
|
-
carouselId:
|
|
432
|
+
carouselId: carouselId,
|
|
422
433
|
totalNumberOfSlides: totalNumberOfSlides,
|
|
423
434
|
activeSlide: activeSlide,
|
|
424
435
|
startEndMargin: startEndMargin,
|
|
425
436
|
shouldAddStartEndSpacing: shouldAddStartEndSpacing
|
|
426
437
|
};
|
|
427
|
-
}, [
|
|
428
|
-
useSyncUpdateEffect(function () {
|
|
429
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(activeSlide);
|
|
430
|
-
}, activeSlide, [onChange]);
|
|
438
|
+
}, [carouselId, startEndMargin, isResponsive, _visibleItems, carouselItemWidth, totalNumberOfSlides, activeSlide, shouldAddStartEndSpacing]);
|
|
431
439
|
return /*#__PURE__*/jsx(CarouselContext.Provider, {
|
|
432
440
|
value: carouselContext,
|
|
433
441
|
children: /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
|
|
@@ -485,7 +493,7 @@ var Carousel = function Carousel(_ref4) {
|
|
|
485
493
|
variant: navigationButtonVariant,
|
|
486
494
|
onClick: goToPreviousSlide
|
|
487
495
|
}) : null, /*#__PURE__*/jsx(CarouselBody, {
|
|
488
|
-
idPrefix:
|
|
496
|
+
idPrefix: carouselId,
|
|
489
497
|
startEndMargin: startEndMargin,
|
|
490
498
|
totalSlides: totalNumberOfSlides,
|
|
491
499
|
shouldAddStartEndSpacing: shouldAddStartEndSpacing,
|