@razorpay/blade 10.7.0 → 10.8.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.
Files changed (30) hide show
  1. package/build/components/index.d.ts +3508 -4658
  2. package/build/components/index.development.web.js +2232 -2178
  3. package/build/components/index.development.web.js.map +1 -1
  4. package/build/components/index.native.d.ts +3081 -4228
  5. package/build/components/index.native.js +144 -122
  6. package/build/components/index.native.js.map +1 -1
  7. package/build/components/index.production.web.js +1767 -1706
  8. package/build/components/index.production.web.js.map +1 -1
  9. package/build/css/bankingThemeDarkDesktop.css +1 -1
  10. package/build/css/bankingThemeDarkMobile.css +1 -1
  11. package/build/css/bankingThemeLightDesktop.css +1 -1
  12. package/build/css/bankingThemeLightMobile.css +1 -1
  13. package/build/css/paymentThemeDarkDesktop.css +1 -1
  14. package/build/css/paymentThemeDarkMobile.css +1 -1
  15. package/build/css/paymentThemeLightDesktop.css +1 -1
  16. package/build/css/paymentThemeLightMobile.css +1 -1
  17. package/build/tokens/index.d.ts +190 -680
  18. package/build/tokens/index.development.web.js +127 -103
  19. package/build/tokens/index.development.web.js.map +1 -1
  20. package/build/tokens/index.native.d.ts +190 -680
  21. package/build/tokens/index.native.js +126 -102
  22. package/build/tokens/index.native.js.map +1 -1
  23. package/build/tokens/index.production.web.js +196 -113
  24. package/build/tokens/index.production.web.js.map +1 -1
  25. package/build/utils/index.d.ts +488 -593
  26. package/build/utils/index.development.web.js.map +1 -1
  27. package/build/utils/index.native.d.ts +488 -593
  28. package/build/utils/index.native.js.map +1 -1
  29. package/build/utils/index.production.web.js.map +1 -1
  30. package/package.json +12 -10
@@ -1,4 +1,4 @@
1
- declare type BorderRadius$1 = Readonly<{
1
+ declare type BorderRadius = Readonly<{
2
2
  /** none: 0(px/rem/pt) */
3
3
  none: 0;
4
4
  /** small: 2(px/rem/pt) */
@@ -12,7 +12,7 @@ declare type BorderRadius$1 = Readonly<{
12
12
  /** round: 50%(pt). This will turn the box element into a circle */
13
13
  round: '50%';
14
14
  }>;
15
- declare type BorderWidth$1 = Readonly<{
15
+ declare type BorderWidth = Readonly<{
16
16
  /** none: 0(px/rem/pt) */
17
17
  none: 0;
18
18
  /** thinner: 0.5(px/rem/pt) */
@@ -24,13 +24,13 @@ declare type BorderWidth$1 = Readonly<{
24
24
  /** thicker: 2(px/rem/pt) */
25
25
  thicker: 2;
26
26
  }>;
27
- declare type Border$1 = Readonly<{
28
- radius: BorderRadius$1;
29
- width: BorderWidth$1;
27
+ declare type Border = Readonly<{
28
+ radius: BorderRadius;
29
+ width: BorderWidth;
30
30
  }>;
31
- declare const border: Border$1;
31
+ declare const border: Border;
32
32
 
33
- declare type Breakpoints$1 = Readonly<{
33
+ declare type Breakpoints = Readonly<{
34
34
  /**
35
35
  * `base` is used for responsive styling following a **mobile first** approach. It starts from 0px till the next existing token
36
36
  *
@@ -99,7 +99,7 @@ declare type Breakpoints$1 = Readonly<{
99
99
  */
100
100
  xl: number;
101
101
  }>;
102
- declare const breakpoints: Breakpoints$1;
102
+ declare const breakpoints: Breakpoints;
103
103
 
104
104
  declare type ColorChromaticScale = Readonly<{
105
105
  50: string;
@@ -188,14 +188,14 @@ declare type Opacity = Readonly<{
188
188
  }>;
189
189
  declare const opacity: Opacity;
190
190
 
191
- declare type FontFamily$1 = {
191
+ declare type FontFamily = {
192
192
  /** Used for all type of textual content except code snippets */
193
193
  text: string;
194
194
  /** Used for code snippets */
195
195
  code: string;
196
196
  };
197
197
 
198
- declare type FontWeight$1 = {
198
+ declare type FontWeight = {
199
199
  regular: 400;
200
200
  bold: 700;
201
201
  };
@@ -205,7 +205,7 @@ declare type FontWeight$1 = {
205
205
  * so for example xl on mobile can be 32px and on desktop xl can be 34px,
206
206
  * similarly 2xl on mobile can be 34px but on desktop doesn’t necessarily mean 2xl will be more than xl(34px) it can be 32 as well since visually they make better hierarchy.
207
207
  */
208
- declare type FontSize$1 = {
208
+ declare type FontSize = {
209
209
  /** desktop: 9(px/rem/pt)
210
210
  *
211
211
  * mobile: 9(px/rem/pt)
@@ -297,11 +297,11 @@ declare type FontSize$1 = {
297
297
  */
298
298
  1600: number;
299
299
  };
300
- declare type Typography$1 = {
300
+ declare type Typography = {
301
301
  fonts: {
302
- family: FontFamily$1;
303
- size: FontSize$1;
304
- weight: FontWeight$1;
302
+ family: FontFamily;
303
+ size: FontSize;
304
+ weight: FontWeight;
305
305
  };
306
306
  lineHeights: {
307
307
  /** desktop: 0(px/rem/pt)
@@ -386,16 +386,16 @@ declare type Typography$1 = {
386
386
  1500: number;
387
387
  };
388
388
  };
389
- declare type TypographyPlatforms$1 = 'onDesktop' | 'onMobile';
390
- declare type TypographyWithPlatforms$1 = Record<TypographyPlatforms$1, Typography$1>;
391
- declare const typography: TypographyWithPlatforms$1;
389
+ declare type TypographyPlatforms = 'onDesktop' | 'onMobile';
390
+ declare type TypographyWithPlatforms = Record<TypographyPlatforms, Typography>;
391
+ declare const typography: TypographyWithPlatforms;
392
392
 
393
393
  /**
394
394
  * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
395
395
  *
396
396
  * {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
397
397
  */
398
- declare type Spacing$1 = Readonly<{
398
+ declare type Spacing = Readonly<{
399
399
  /** 0: 0(px/rem/pt) */
400
400
  0: 0;
401
401
  /** 1: 2(px/rem/pt) */
@@ -421,533 +421,198 @@ declare type Spacing$1 = Readonly<{
421
421
  /** 11: 56(px/rem/pt) */
422
422
  11: 56;
423
423
  }>;
424
- declare const spacing: Spacing$1;
424
+ declare const spacing: Spacing;
425
425
 
426
- type BorderRadius = Readonly<{
427
- /** none: 0(px/rem/pt) */
428
- none: 0;
429
- /** small: 2(px/rem/pt) */
430
- small: 2;
431
- /** medium: 4(px/rem/pt) */
432
- medium: 4;
433
- /** large: 8(px/rem/pt) */
434
- large: 8;
435
- /** max: 9999(px/rem/pt). This will round the left and right side of the box element */
436
- max: 9999;
437
- /** round: 50%(pt). This will turn the box element into a circle */
438
- round: '50%';
439
- }>;
440
-
441
- type BorderWidth = Readonly<{
442
- /** none: 0(px/rem/pt) */
443
- none: 0;
444
- /** thinner: 0.5(px/rem/pt) */
445
- thinner: 0.5;
446
- /** thin: 1(px/rem/pt) */
447
- thin: 1;
448
- /** thick: 1.5(px/rem/pt) */
449
- thick: 1.5;
450
- /** thicker: 2(px/rem/pt) */
451
- thicker: 2;
452
- }>;
453
-
454
- type Border = Readonly<{
455
- radius: BorderRadius;
456
- width: BorderWidth;
457
- }>;
458
-
459
- type Breakpoints = Readonly<{
460
- /**
461
- * `base` is used for responsive styling following a **mobile first** approach. It starts from 0px till the next existing token
462
- *
463
- * Think of this as styles without any media query.
464
- *
465
- * ### Example
466
- *
467
- * This code will set margin as `spacing.2` on "m" size screens and above. And as `spacing.1` on less than "m" size screens
468
- * ```jsx
469
- * <Box margin={{ base: 'spacing.1', m: 'spacing.2' }} />
470
- * ```
471
- *
472
- * This roughly translates into -
473
- *
474
- * ```
475
- * .Box {
476
- * margin: 'spacing.1';
477
- * }
478
- *
479
- * @media screen and (min-width: 768px) {
480
- * .Box {
481
- * margin: 'spacing.2';
482
- * }
483
- * }
484
- * ```
485
- */
486
- base: number;
487
- /**
488
- * `@media screen and (min-width: 320px)`
489
- *
490
- * Small Mobiles
491
- */
492
- xs: number;
493
- /**
494
- * `@media screen and (min-width: 480px)`
495
- *
496
- * Mobiles and Small Tablets
497
- */
498
- s: number;
499
- /**
500
- * `@media screen and (min-width: 768px)`
501
- *
502
- * Medium and Large Tablets.
503
- *
504
- * Dimensions with `m` and above can be treated as desktop in mobile-first approach (with min-width).
505
- * Hence this breakpoint can be used for desktop styling.
506
- *
507
- * E.g. next example will keep flexDirection `row` on mobiles and `column` on large tablets, desktop, and larger screens
508
- *
509
- * ```jsx
510
- * <Box display="flex" flexDirection={{ base: 'row', m: 'column' }} />
511
- * ```
512
- *
513
- */
514
- m: number;
515
- /**
516
- * `@media screen and (min-width: 1024px)`
517
- *
518
- * Desktop
519
- */
520
- l: number;
521
- /**
522
- * `@media screen and (min-width: 1200px)`
523
- *
524
- * HD Desktop
525
- */
526
- xl: number;
527
- }>;
528
-
529
- type FontFamily = {
530
- /** Used for all type of textual content except code snippets */
531
- text: string;
532
- /** Used for code snippets */
533
- code: string;
426
+ declare type ColorSchemeNames = 'dark' | 'light';
427
+ declare type ColorSchemeNamesInput = ColorSchemeNames | 'system';
428
+ declare type ColorSchemeModes = 'onDark' | 'onLight';
429
+ declare type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
430
+ declare type ColorContrastTypes = 'low' | 'high';
431
+ declare type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
432
+ declare type ColorContrast = {
433
+ [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
534
434
  };
535
-
536
- type FontWeight = {
537
- regular: 400;
538
- bold: 700;
435
+ declare type ActionStates = {
436
+ default: string;
437
+ hover: string;
438
+ focus: string;
439
+ active: string;
440
+ disabled: string;
441
+ };
442
+ declare type LinkActionStates = ActionStates & {
443
+ visited: string;
444
+ };
445
+ declare type ActionStatesWithContrast = {
446
+ default: ColorContrast;
447
+ hover: ColorContrast;
448
+ focus: ColorContrast;
449
+ active: ColorContrast;
450
+ disabled: ColorContrast;
451
+ };
452
+ declare type ActionVariants = {
453
+ primary: ActionStates;
454
+ secondary: ActionStates;
455
+ tertiary: ActionStates;
456
+ link: LinkActionStates;
457
+ };
458
+ declare type ActionVariantsWithContrast = {
459
+ primary: ActionStatesWithContrast;
460
+ secondary: ActionStatesWithContrast;
461
+ tertiary: ActionStatesWithContrast;
462
+ link: ActionStatesWithContrast;
463
+ };
464
+ declare type FeedbackActions = {
465
+ background: Pick<ActionVariantsWithContrast, 'primary'>;
466
+ border: Pick<ActionVariantsWithContrast, 'primary'>;
467
+ text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
468
+ icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
469
+ };
470
+ declare type Colors = {
471
+ brand: {
472
+ primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
473
+ secondary: Record<500, string>;
474
+ gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
475
+ };
476
+ feedback: {
477
+ background: Record<Feedback, ColorContrast>;
478
+ border: Record<Feedback, ColorContrast>;
479
+ text: Record<Feedback, ColorContrast>;
480
+ icon: Record<Feedback, ColorContrast>;
481
+ positive: {
482
+ action: FeedbackActions;
483
+ };
484
+ negative: {
485
+ action: FeedbackActions;
486
+ };
487
+ information: {
488
+ action: FeedbackActions;
489
+ };
490
+ notice: {
491
+ action: FeedbackActions;
492
+ };
493
+ neutral: {
494
+ action: FeedbackActions;
495
+ };
496
+ };
497
+ surface: {
498
+ background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
499
+ border: Record<'normal' | 'subtle', ColorContrast>;
500
+ text: Record<TextTypes, ColorContrast>;
501
+ action: {
502
+ icon: ActionStatesWithContrast;
503
+ };
504
+ };
505
+ overlay: Record<'background', string>;
506
+ action: {
507
+ background: Omit<ActionVariants, 'link'>;
508
+ border: Omit<ActionVariants, 'link'>;
509
+ text: ActionVariants;
510
+ icon: ActionVariants;
511
+ };
512
+ badge: {
513
+ background: {
514
+ blue: ColorContrast;
515
+ };
516
+ border: {
517
+ blue: ColorContrast;
518
+ };
519
+ text: {
520
+ blue: ColorContrast;
521
+ };
522
+ icon: {
523
+ blue: ColorContrast;
524
+ };
525
+ };
526
+ };
527
+ declare type ColorsWithModes = Record<ColorSchemeModes, Colors>;
528
+ declare type ThemeTokens = {
529
+ name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
530
+ border: Border;
531
+ breakpoints: Breakpoints;
532
+ colors: ColorsWithModes;
533
+ motion: Motion;
534
+ elevation: ElevationWithColorModes;
535
+ spacing: Spacing;
536
+ typography: TypographyWithPlatforms;
539
537
  };
540
538
 
541
- /**
542
- * For font size and line-heights we can’t say from xl to 2xl the value will necessary increase.
543
- * it might decrease or remain same because these are alias tokens and we need aliases for cross platform.
544
- * so for example xl on mobile can be 32px and on desktop xl can be 34px,
545
- * similarly 2xl on mobile can be 34px but on desktop doesn’t necessarily mean 2xl will be more than xl(34px) it can be 32 as well since visually they make better hierarchy.
546
- */
539
+ declare const paymentTheme: ThemeTokens;
540
+
541
+ declare const bankingTheme: ThemeTokens;
547
542
 
548
- type FontSize = {
549
- /** desktop: 9(px/rem/pt)
550
- *
551
- * mobile: 9(px/rem/pt)
552
- */
553
- 10: number;
554
- /** desktop: 10(px/rem/pt)
555
- *
556
- * mobile: 10(px/rem/pt)
557
- */
558
- 25: number;
559
- /** desktop: 11(px/rem/pt)
560
- *
561
- * mobile: 11(px/rem/pt)
562
- */
563
- 50: number;
564
- /** desktop: 12(px/rem/pt)
565
- *
566
- * mobile: 12(px/rem/pt)
567
- */
568
- 75: number;
569
- /** desktop: 14(px/rem/pt)
570
- *
571
- * mobile: 14(px/rem/pt)
572
- */
573
- 100: number;
574
- /** desktop: 16(px/rem/pt)
575
- *
576
- * mobile: 16(px/rem/pt)
577
- */
578
- 200: number;
579
- /** desktop: 18(px/rem/pt)
580
- *
581
- * mobile: 16(px/rem/pt)
582
- */
583
- 300: number;
584
- /** desktop: 20(px/rem/pt)
585
- *
586
- * mobile: 18(px/rem/pt)
587
- */
588
- 400: number;
589
- /** desktop: 22(px/rem/pt)
590
- *
591
- * mobile: 20(px/rem/pt)
592
- */
593
- 500: number;
594
- /** desktop: 24(px/rem/pt)
595
- *
596
- * mobile: 20(px/rem/pt)
597
- */
598
- 600: number;
599
- /** desktop: 28(px/rem/pt)
600
- *
601
- * mobile: 24(px/rem/pt)
602
- */
603
- 700: number;
604
- /** desktop: 32(px/rem/pt)
605
- *
606
- * mobile: 28(px/rem/pt)
607
- */
608
- 800: number;
609
- /** desktop: 36(px/rem/pt)
610
- *
611
- * mobile: 32(px/rem/pt)
612
- */
613
- 900: number;
614
- /** desktop: 40(px/rem/pt)
615
- *
616
- * mobile: 32(px/rem/pt)
617
- */
618
- 1000: number;
619
- /** desktop: 48(px/rem/pt)
620
- *
621
- * mobile: 40(px/rem/pt)
622
- */
623
- 1100: number;
624
- /** desktop: 56(px/rem/pt)
625
- *
626
- * mobile: 48(px/rem/pt)
627
- */
628
- 1200: number;
629
- /** desktop: 64(px/rem/pt)
630
- *
631
- * mobile: 56(px/rem/pt)
632
- */
633
- 1300: number;
634
- /** desktop: 88(px/rem/pt)
635
- *
636
- * mobile: 64(px/rem/pt)
637
- */
638
- 1600: number;
543
+ declare type DeepPartial<T> = {
544
+ [P in keyof T]?: T[P] extends Record<number | string, unknown> ? DeepPartial<T[P]> : T[P];
639
545
  };
640
546
 
641
- type Typography = {
642
- fonts: {
643
- family: FontFamily;
644
- size: FontSize;
645
- weight: FontWeight;
646
- };
647
- lineHeights: {
648
- /** desktop: 0(px/rem/pt)
649
- *
650
- * mobile: 0(px/rem/pt)
651
- */
652
- 0: number;
653
- /** desktop: 14(px/rem/pt)
654
- *
655
- * mobile: 14(px/rem/pt)
656
- */
657
- 25: number;
658
- /** desktop: 16(px/rem/pt)
659
- *
660
- * mobile: 16(px/rem/pt)
661
- */
662
- 50: number;
663
- /** desktop: 18(px/rem/pt)
664
- *
665
- * mobile: 18(px/rem/pt)
666
- */
667
- 75: number;
668
- /** desktop: 20(px/rem/pt)
669
- *
670
- * mobile: 20(px/rem/pt)
671
- */
672
- 100: number;
673
- /** desktop: 24(px/rem/pt)
674
- *
675
- * mobile: 20(px/rem/pt)
676
- */
677
- 200: number;
678
- /** desktop: 24(px/rem/pt)
679
- *
680
- * mobile: 24(px/rem/pt)
681
- */
682
- 300: number;
683
- /** desktop: 28(px/rem/pt)
684
- *
685
- * mobile: 24(px/rem/pt)
686
- */
687
- 400: number;
688
- /** desktop: 32(px/rem/pt)
689
- *
690
- * mobile: 28(px/rem/pt)
691
- */
692
- 500: number;
693
- /** desktop: 40(px/rem/pt)
694
- *
695
- * mobile: 32(px/rem/pt)
696
- */
697
- 600: number;
698
- /** desktop: 40(px/rem/pt)
699
- *
700
- * mobile: 40(px/rem/pt)
701
- */
702
- 700: number;
703
- /** desktop: 48(px/rem/pt)
704
- *
705
- * mobile: 40(px/rem/pt)
706
- */
707
- 800: number;
708
- /** desktop: 56(px/rem/pt)
709
- *
710
- * mobile: 48(px/rem/pt)
711
- */
712
- 900: number;
713
- /** desktop: 64(px/rem/pt)
714
- *
715
- * mobile: 56(px/rem/pt)
716
- */
717
- 1000: number;
718
- /** desktop: 72(px/rem/pt)
719
- *
720
- * mobile: 64(px/rem/pt)
547
+ declare type OverrideTheme = {
548
+ /**
549
+ * base tokens
721
550
  */
722
- 1100: number;
723
- /** desktop: 104(px/rem/pt)
724
- *
725
- * mobile: 72(px/rem/pt)
551
+ baseThemeTokens: ThemeTokens;
552
+ /**
553
+ * partial theme tokens
726
554
  */
727
- 1500: number;
728
- };
729
- // letterSpacings: {};
555
+ overrides: DeepPartial<ThemeTokens>;
730
556
  };
731
-
732
- type TypographyPlatforms = 'onDesktop' | 'onMobile';
733
-
734
- type TypographyWithPlatforms = Record<TypographyPlatforms, Typography>;
735
-
736
557
  /**
737
- * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
558
+ * @description
738
559
  *
739
- * {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
560
+ * `overrideTheme` merges the `baseThemeTokens` and `overrides` and returns a new ThemeTokens object,
561
+ * which you can pass into BladeProvider.
562
+ *
563
+ * @example
564
+ * ```tsx
565
+ * const customTheme = overrideTheme({
566
+ * baseThemeTokens: paymentTheme, // theme to override
567
+ * overrides: {
568
+ * colors: {
569
+ * onLight: {
570
+ * brand: {
571
+ * primary: {
572
+ * '500': 'hsla(222, 100%, 96%, 1)',
573
+ * },
574
+ * },
575
+ * },
576
+ * },
577
+ * },
578
+ * });
579
+ *
580
+ * <BladeProvider themeTokens={customTheme} />
581
+ * ```
740
582
  */
741
-
742
- type Spacing = Readonly<{
743
- /** 0: 0(px/rem/pt) */
744
- 0: 0;
745
- /** 1: 2(px/rem/pt) */
746
- 1: 2;
747
- /** 2: 4(px/rem/pt) */
748
- 2: 4;
749
- /** 3: 8(px/rem/pt) */
750
- 3: 8;
751
- /** 4: 12(px/rem/pt) */
752
- 4: 12;
753
- /** 5: 16(px/rem/pt) */
754
- 5: 16;
755
- /** 6: 20(px/rem/pt) */
756
- 6: 20;
757
- /** 7: 24(px/rem/pt) */
758
- 7: 24;
759
- /** 8: 32(px/rem/pt) */
760
- 8: 32;
761
- /** 9: 40(px/rem/pt) */
762
- 9: 40;
763
- /** 10: 48(px/rem/pt) */
764
- 10: 48;
765
- /** 11: 56(px/rem/pt) */
766
- 11: 56;
767
- }>;
768
-
769
- type ColorSchemeModes$1 = 'onDark' | 'onLight';
770
-
771
- /* eslint-disable no-console */
772
-
773
-
774
- type DeepPartial<T> = {
775
- [P in keyof T]?: T[P] extends Record<number | string, unknown> ? DeepPartial<T[P]> : T[P];
776
- };
777
-
778
- /* eslint-disable @typescript-eslint/no-explicit-any */
583
+ declare const overrideTheme: ({ baseThemeTokens, overrides }: OverrideTheme) => ThemeTokens;
779
584
 
780
585
  /**
781
586
  * Brands a type making them act as nominal
782
587
  * @see https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d
783
588
  */
784
- type Brand<Type, Name extends string> = Type & { __brand__?: Name };
785
-
786
- type NativeOrWebBrand = Brand<any, 'native' | 'web'>;
787
-
788
- /* eslint-disable @typescript-eslint/no-namespace */
789
-
790
-
791
- declare namespace Platform {
792
- export type Name = 'web';
793
- /**
794
- * Right now, the module resolution is set to resolve `.web` files,
795
- *
796
- * Thus Platform.Select<> type will return the `web` type
797
- */
798
- export type Select<Options extends { web: unknown; native: unknown }> = Brand<
799
- Options[Name],
800
- 'platform-web'
801
- >;
802
-
803
- export type CastNative<T extends NativeOrWebBrand | undefined> = Extract<
804
- T,
805
- { __brand__?: 'platform-native' | 'platform-all' }
806
- >;
807
-
808
- export type CastWeb<T extends NativeOrWebBrand | undefined> = Extract<
809
- T,
810
- { __brand__?: 'platform-web' | 'platform-all' }
811
- >;
812
- }
813
-
814
- type Duration$1 = {
815
- /** `70` milliseconds */
816
- '2xquick': 70;
817
- /** `150` milliseconds */
818
- xquick: 150;
819
- /** `200` milliseconds */
820
- quick: 200;
821
- /** `250` milliseconds */
822
- moderate: 250;
823
- /** `300` milliseconds */
824
- xmoderate: 300;
825
- /** `400` milliseconds */
826
- gentle: 400;
827
- /** `600` milliseconds */
828
- xgentle: 600;
829
- /** `900` milliseconds */
830
- '2xgentle': 900;
831
- };
832
-
833
- type Delay$1 = {
834
- /** `70` milliseconds */
835
- '2xshort': 70;
836
- /** `120` milliseconds */
837
- xshort: 120;
838
- /** `180` milliseconds */
839
- short: 180;
840
- /** `3000` milliseconds */
841
- long: 3000;
842
- /** `5000` milliseconds */
843
- xlong: 5000;
589
+ declare type Brand<Type, Name extends string> = Type & {
590
+ __brand__?: Name;
844
591
  };
592
+ declare type NativeOrWebBrand = Brand<any, 'native' | 'web'>;
845
593
 
846
- type EasingFactoryFn$1 = { factory: () => (value: number) => number }; // similar to EasingFactoryFn of `react-native-reanimated`
847
- type EasingType$1<Value extends string> = Platform.Select<{
848
- web: Value;
849
- native: EasingFactoryFn$1;
850
- }>;
851
-
852
- type Easing$1 = {
853
- /** Easings for all standard animations*/
854
- standard: {
855
- /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
856
- *
857
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
858
- attentive: EasingType$1<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
859
- /** `cubic-bezier(0.3, 0, 0.2, 1)`
860
- *
861
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
862
- effective: EasingType$1<'cubic-bezier(0.3, 0, 0.2, 1)'>;
863
- /** `cubic-bezier(0.5, 0, 0, 1)`
864
- *
865
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
866
- revealing: EasingType$1<'cubic-bezier(0.5, 0, 0, 1)'>;
867
- /** `cubic-bezier(1, 0.5, 0, 0.5)`
868
- *
869
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
870
- wary: EasingType$1<'cubic-bezier(1, 0.5, 0, 0.5)'>;
871
- };
872
- /** Easings for all entrance animations*/
873
- entrance: {
874
- /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
875
- *
876
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
877
- attentive: EasingType$1<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
878
- /** `cubic-bezier(0, 0, 0.2, 1)`
879
- *
880
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
881
- effective: EasingType$1<'cubic-bezier(0, 0, 0.2, 1)'>;
882
- /** `cubic-bezier(0, 0, 0, 1)`
883
- *
884
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
885
- revealing: EasingType$1<'cubic-bezier(0, 0, 0, 1)'>;
886
- };
887
- /** Easings for all exit animations*/
888
- exit: {
889
- /** `cubic-bezier(0.7, 0, 0.5, 1)`
890
- *
891
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
892
- attentive: EasingType$1<'cubic-bezier(0.7, 0, 0.5, 1)'>;
893
- /** `cubic-bezier(0.17, 0, 1, 1)`
894
- *
895
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
896
- effective: EasingType$1<'cubic-bezier(0.17, 0, 1, 1)'>;
897
- /** `cubic-bezier(0.5, 0, 1, 1)`
898
- *
899
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
900
- revealing: EasingType$1<'cubic-bezier(0.5, 0, 1, 1)'>;
901
- };
902
- };
903
-
904
- type Motion$1 = Readonly<{
905
- delay: Delay$1;
906
- duration: Duration$1;
907
- easing: Easing$1;
908
- }>;
909
-
910
- type ElevationLevels$1 = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
911
-
912
- type ElevationStyles$1 = Readonly<{
913
- elevation: number;
914
- shadowColor: string;
915
- shadowOpacity: number;
916
- shadowRadius: number;
917
- shadowOffset: {
918
- /**
919
- * x-axis
920
- */
921
- width: number;
594
+ declare namespace Platform {
595
+ type Name = 'web';
922
596
  /**
923
- * y-axis
924
- */
925
- height: number;
926
- };
927
- }>;
928
-
929
- type Elevation$1 = Record<
930
- ElevationLevels$1,
931
- Platform.Select<{
932
- web: string;
933
- native: ElevationStyles$1;
934
- }>
935
- >;
936
-
937
- type ElevationWithColorModes$1 = Record<ColorSchemeModes$1, Elevation$1>;
938
-
939
- /* eslint-disable @typescript-eslint/no-explicit-any */
940
-
597
+ * Right now, the module resolution is set to resolve `.web` files,
598
+ *
599
+ * Thus Platform.Select<> type will return the `web` type
600
+ */
601
+ type Select<Options extends {
602
+ web: unknown;
603
+ native: unknown;
604
+ }> = Brand<Options[Name], 'platform-web'>;
605
+ type CastNative<T extends NativeOrWebBrand | undefined> = Extract<T, {
606
+ __brand__?: 'platform-native' | 'platform-all';
607
+ }>;
608
+ type CastWeb<T extends NativeOrWebBrand | undefined> = Extract<T, {
609
+ __brand__?: 'platform-web' | 'platform-all';
610
+ }>;
611
+ }
941
612
 
942
- type DotNotationMotionStringToken<TokenType> = {
943
- [K in keyof TokenType]: `${Extract<K, string>}.${TokenType[K] extends Record<
944
- string,
945
- string | EasingFactoryFn$1
946
- >
947
- ? Extract<keyof TokenType[K], string | EasingFactoryFn$1>
948
- : DotNotationMotionStringToken<TokenType[K]>}`;
613
+ declare type DotNotationMotionStringToken<TokenType> = {
614
+ [K in keyof TokenType]: `${Extract<K, string>}.${TokenType[K] extends Record<string, string | EasingFactoryFn> ? Extract<keyof TokenType[K], string | EasingFactoryFn> : DotNotationMotionStringToken<TokenType[K]>}`;
949
615
  }[keyof TokenType];
950
-
951
616
  /**
952
617
  *
953
618
  * When combined with union, this type utility will give you autocomplete of union while still supporting any string value as input
@@ -964,7 +629,7 @@ type DotNotationMotionStringToken<TokenType> = {
964
629
  * Related TS Issue - https://github.com/microsoft/TypeScript/issues/29729
965
630
  *
966
631
  */
967
- type StringWithAutocomplete = string & Record<never, never>;
632
+ declare type StringWithAutocomplete = string & Record<never, never>;
968
633
 
969
634
  declare type Duration = {
970
635
  /** `70` milliseconds */
@@ -1143,119 +808,6 @@ declare const size: {
1143
808
  };
1144
809
  declare type Size = typeof size;
1145
810
 
1146
- declare type ColorSchemeNames = 'dark' | 'light';
1147
- declare type ColorSchemeNamesInput = ColorSchemeNames | 'system';
1148
- declare type ColorSchemeModes = 'onDark' | 'onLight';
1149
- declare type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
1150
- declare type ColorContrastTypes = 'low' | 'high';
1151
- declare type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
1152
- declare type ColorContrast = {
1153
- [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
1154
- };
1155
- declare type ActionStates = {
1156
- default: string;
1157
- hover: string;
1158
- focus: string;
1159
- active: string;
1160
- disabled: string;
1161
- };
1162
- declare type LinkActionStates = ActionStates & {
1163
- visited: string;
1164
- };
1165
- declare type ActionStatesWithContrast = {
1166
- default: ColorContrast;
1167
- hover: ColorContrast;
1168
- focus: ColorContrast;
1169
- active: ColorContrast;
1170
- disabled: ColorContrast;
1171
- };
1172
- declare type ActionVariants = {
1173
- primary: ActionStates;
1174
- secondary: ActionStates;
1175
- tertiary: ActionStates;
1176
- link: LinkActionStates;
1177
- };
1178
- declare type ActionVariantsWithContrast = {
1179
- primary: ActionStatesWithContrast;
1180
- secondary: ActionStatesWithContrast;
1181
- tertiary: ActionStatesWithContrast;
1182
- link: ActionStatesWithContrast;
1183
- };
1184
- declare type FeedbackActions = {
1185
- background: Pick<ActionVariantsWithContrast, 'primary'>;
1186
- border: Pick<ActionVariantsWithContrast, 'primary'>;
1187
- text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1188
- icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1189
- };
1190
- declare type Colors = {
1191
- brand: {
1192
- primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
1193
- secondary: Record<500, string>;
1194
- gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
1195
- };
1196
- feedback: {
1197
- background: Record<Feedback, ColorContrast>;
1198
- border: Record<Feedback, ColorContrast>;
1199
- text: Record<Feedback, ColorContrast>;
1200
- icon: Record<Feedback, ColorContrast>;
1201
- positive: {
1202
- action: FeedbackActions;
1203
- };
1204
- negative: {
1205
- action: FeedbackActions;
1206
- };
1207
- information: {
1208
- action: FeedbackActions;
1209
- };
1210
- notice: {
1211
- action: FeedbackActions;
1212
- };
1213
- neutral: {
1214
- action: FeedbackActions;
1215
- };
1216
- };
1217
- surface: {
1218
- background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
1219
- border: Record<'normal' | 'subtle', ColorContrast>;
1220
- text: Record<TextTypes, ColorContrast>;
1221
- action: {
1222
- icon: ActionStatesWithContrast;
1223
- };
1224
- };
1225
- overlay: Record<'background', string>;
1226
- action: {
1227
- background: Omit<ActionVariants, 'link'>;
1228
- border: Omit<ActionVariants, 'link'>;
1229
- text: ActionVariants;
1230
- icon: ActionVariants;
1231
- };
1232
- badge: {
1233
- background: {
1234
- blue: ColorContrast;
1235
- };
1236
- border: {
1237
- blue: ColorContrast;
1238
- };
1239
- text: {
1240
- blue: ColorContrast;
1241
- };
1242
- icon: {
1243
- blue: ColorContrast;
1244
- };
1245
- };
1246
- };
1247
- declare type ColorsWithModes = Record<ColorSchemeModes, Colors>;
1248
- declare type ThemeTokens = {
1249
- name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
1250
- border: Border;
1251
- breakpoints: Breakpoints;
1252
- colors: ColorsWithModes;
1253
- motion: Motion$1;
1254
- elevation: ElevationWithColorModes$1;
1255
- spacing: Spacing;
1256
- typography: TypographyWithPlatforms;
1257
- };
1258
-
1259
811
  declare type ElevationLevels = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
1260
812
  declare type ElevationStyles = Readonly<{
1261
813
  elevation: number;
@@ -1281,46 +833,4 @@ declare type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
1281
833
 
1282
834
  declare const elevation: ElevationWithColorModes;
1283
835
 
1284
- declare const paymentTheme: ThemeTokens;
1285
-
1286
- declare const bankingTheme: ThemeTokens;
1287
-
1288
- declare type OverrideTheme = {
1289
- /**
1290
- * base tokens
1291
- */
1292
- baseThemeTokens: ThemeTokens;
1293
- /**
1294
- * partial theme tokens
1295
- */
1296
- overrides: DeepPartial<ThemeTokens>;
1297
- };
1298
- /**
1299
- * @description
1300
- *
1301
- * `overrideTheme` merges the `baseThemeTokens` and `overrides` and returns a new ThemeTokens object,
1302
- * which you can pass into BladeProvider.
1303
- *
1304
- * @example
1305
- * ```tsx
1306
- * const customTheme = overrideTheme({
1307
- * baseThemeTokens: paymentTheme, // theme to override
1308
- * overrides: {
1309
- * colors: {
1310
- * onLight: {
1311
- * brand: {
1312
- * primary: {
1313
- * '500': 'hsla(222, 100%, 96%, 1)',
1314
- * },
1315
- * },
1316
- * },
1317
- * },
1318
- * },
1319
- * });
1320
- *
1321
- * <BladeProvider themeTokens={customTheme} />
1322
- * ```
1323
- */
1324
- declare const overrideTheme: ({ baseThemeTokens, overrides }: OverrideTheme) => ThemeTokens;
1325
-
1326
- export { Border$1 as Border, Breakpoints$1 as Breakpoints, Color, ColorSchemeNames, ColorSchemeNamesInput, ColorsWithModes, DelayString, DurationString, EasingFactoryFn, EasingString, Elevation, ElevationWithColorModes, FontFamily$1 as FontFamily, FontSize$1 as FontSize, Motion, Opacity, Size, Spacing$1 as Spacing, ThemeTokens, Typography$1 as Typography, TypographyPlatforms$1 as TypographyPlatforms, TypographyWithPlatforms$1 as TypographyWithPlatforms, bankingTheme, border, breakpoints, colors, elevation, motion, opacity, overrideTheme, paymentTheme, size, spacing, typography };
836
+ export { Border, Breakpoints, Color, ColorSchemeNames, ColorSchemeNamesInput, ColorsWithModes, DelayString, DurationString, EasingFactoryFn, EasingString, Elevation, ElevationWithColorModes, FontFamily, FontSize, Motion, Opacity, Size, Spacing, ThemeTokens, Typography, TypographyPlatforms, TypographyWithPlatforms, bankingTheme, border, breakpoints, colors, elevation, motion, opacity, overrideTheme, paymentTheme, size, spacing, typography };