@razorpay/blade 8.1.0 → 8.2.3

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.
@@ -24,6 +24,7 @@ declare type Border$1 = Readonly<{
24
24
  radius: BorderRadius$1;
25
25
  width: BorderWidth$1;
26
26
  }>;
27
+ declare const border: Border$1;
27
28
 
28
29
  declare type Breakpoints$1 = Readonly<{
29
30
  /**
@@ -94,6 +95,7 @@ declare type Breakpoints$1 = Readonly<{
94
95
  */
95
96
  xl: number;
96
97
  }>;
98
+ declare const breakpoints: Breakpoints$1;
97
99
 
98
100
  declare type ColorChromaticScale = Readonly<{
99
101
  50: string;
@@ -157,13 +159,6 @@ declare type Color = Readonly<{
157
159
  }>;
158
160
  declare const colors: Color;
159
161
 
160
- declare type FontFamily$1 = {
161
- /** Used for all type of textual content except code snippets */
162
- text: string;
163
- /** Used for code snippets */
164
- code: string;
165
- };
166
-
167
162
  declare type Opacity = Readonly<{
168
163
  /**0: 0 */
169
164
  0: number;
@@ -186,6 +181,14 @@ declare type Opacity = Readonly<{
186
181
  /**9: 1.0 */
187
182
  9: number;
188
183
  }>;
184
+ declare const opacity: Opacity;
185
+
186
+ declare type FontFamily$1 = {
187
+ /** Used for all type of textual content except code snippets */
188
+ text: string;
189
+ /** Used for code snippets */
190
+ code: string;
191
+ };
189
192
 
190
193
  declare type FontWeight$1 = {
191
194
  regular: 400;
@@ -338,6 +341,9 @@ declare type Typography$1 = {
338
341
  800: number;
339
342
  };
340
343
  };
344
+ declare type TypographyPlatforms$1 = 'onDesktop' | 'onMobile';
345
+ declare type TypographyWithPlatforms$1 = Record<TypographyPlatforms$1, Typography$1>;
346
+ declare const typography: TypographyWithPlatforms$1;
341
347
 
342
348
  /**
343
349
  * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
@@ -370,6 +376,7 @@ declare type Spacing$1 = Readonly<{
370
376
  /** 11: 56(px/rem/pt) */
371
377
  11: 56;
372
378
  }>;
379
+ declare const spacing: Spacing$1;
373
380
 
374
381
  type BorderRadius = Readonly<{
375
382
  /** none: 0(px/rem/pt) */
@@ -670,6 +677,8 @@ type Spacing = Readonly<{
670
677
  11: 56;
671
678
  }>;
672
679
 
680
+ type ColorSchemeModes$1 = 'onDark' | 'onLight';
681
+
673
682
  /* eslint-disable no-console */
674
683
 
675
684
 
@@ -809,6 +818,44 @@ type Motion$1 = Readonly<{
809
818
  easing: Easing$1;
810
819
  }>;
811
820
 
821
+ type ElevationLevels$1 = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
822
+
823
+ type ElevationStyles$1 = Readonly<{
824
+ elevation: number;
825
+ shadowColor: string;
826
+ shadowOpacity: number;
827
+ shadowRadius: number;
828
+ shadowOffset: {
829
+ /**
830
+ * x-axis
831
+ */
832
+ width: number;
833
+ /**
834
+ * y-axis
835
+ */
836
+ height: number;
837
+ };
838
+ }>;
839
+
840
+ type Elevation$1 = Record<
841
+ ElevationLevels$1,
842
+ Platform.Select<{
843
+ web: string;
844
+ native: ElevationStyles$1;
845
+ }>
846
+ >;
847
+
848
+ type ElevationWithColorModes$1 = Record<ColorSchemeModes$1, Elevation$1>;
849
+
850
+ type DotNotationMotionStringToken<TokenType> = {
851
+ [K in keyof TokenType]: `${Extract<K, string>}.${TokenType[K] extends Record<
852
+ string,
853
+ string | EasingFunctionFactory$1
854
+ >
855
+ ? Extract<keyof TokenType[K], string | EasingFunctionFactory$1>
856
+ : DotNotationMotionStringToken<TokenType[K]>}`;
857
+ }[keyof TokenType];
858
+
812
859
  /**
813
860
  *
814
861
  * When combined with union, this type utility will give you autocomplete of union while still supporting any string value as input
@@ -920,6 +967,10 @@ declare type Motion = Readonly<{
920
967
  duration: Duration;
921
968
  easing: Easing;
922
969
  }>;
970
+ declare type EasingString = `easing.${DotNotationMotionStringToken<Easing>}`;
971
+ declare type DurationString = `duration.${keyof Duration}`;
972
+ declare type DelayString = `delay.${keyof Delay}`;
973
+ declare const motion: Motion;
923
974
 
924
975
  /**
925
976
  * Size tokens are currently not exposed for users (therefore not available in theme)
@@ -976,162 +1027,143 @@ declare const size: {
976
1027
  };
977
1028
  declare type Size = typeof size;
978
1029
 
979
- type ColorSchemeNames = 'dark' | 'light';
980
- type ColorSchemeNamesInput = ColorSchemeNames | 'system';
981
-
982
- type ColorSchemeModes = 'onDark' | 'onLight';
983
-
984
- type ShadowLevels = 1 | 2 | 3 | 4 | 5;
985
-
986
- type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
987
-
988
- type ColorContrastTypes = 'low' | 'high';
989
-
990
- type Shadows = {
991
- offsetX: {
992
- level: Record<ShadowLevels, number>;
993
- };
994
- offsetY: {
995
- level: Record<ShadowLevels, number>;
996
- };
997
- blurRadius: {
998
- level: Record<ShadowLevels, number>;
999
- };
1000
- color: Record<
1001
- ColorSchemeModes,
1002
- {
1003
- level: Record<ShadowLevels, string>;
1004
- }
1005
- >;
1006
- androidElevation: {
1007
- level: Record<ShadowLevels, number>;
1008
- };
1009
- };
1010
-
1011
- type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
1012
-
1013
- type ColorContrast = {
1014
- [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
1030
+ declare type ColorSchemeNames = 'dark' | 'light';
1031
+ declare type ColorSchemeNamesInput = ColorSchemeNames | 'system';
1032
+ declare type ColorSchemeModes = 'onDark' | 'onLight';
1033
+ declare type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
1034
+ declare type ColorContrastTypes = 'low' | 'high';
1035
+ declare type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
1036
+ declare type ColorContrast = {
1037
+ [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
1015
1038
  };
1016
-
1017
- type ActionStates = {
1018
- default: string;
1019
- hover: string;
1020
- focus: string;
1021
- active: string;
1022
- disabled: string;
1039
+ declare type ActionStates = {
1040
+ default: string;
1041
+ hover: string;
1042
+ focus: string;
1043
+ active: string;
1044
+ disabled: string;
1023
1045
  };
1024
-
1025
- type LinkActionStates = ActionStates & {
1026
- visited: string;
1046
+ declare type LinkActionStates = ActionStates & {
1047
+ visited: string;
1027
1048
  };
1028
-
1029
- type ActionStatesWithContrast = {
1030
- default: ColorContrast;
1031
- hover: ColorContrast;
1032
- focus: ColorContrast;
1033
- active: ColorContrast;
1034
- disabled: ColorContrast;
1049
+ declare type ActionStatesWithContrast = {
1050
+ default: ColorContrast;
1051
+ hover: ColorContrast;
1052
+ focus: ColorContrast;
1053
+ active: ColorContrast;
1054
+ disabled: ColorContrast;
1035
1055
  };
1036
-
1037
- type ActionVariants = {
1038
- primary: ActionStates;
1039
- secondary: ActionStates;
1040
- tertiary: ActionStates;
1041
- link: LinkActionStates;
1056
+ declare type ActionVariants = {
1057
+ primary: ActionStates;
1058
+ secondary: ActionStates;
1059
+ tertiary: ActionStates;
1060
+ link: LinkActionStates;
1042
1061
  };
1043
-
1044
- type ActionVariantsWithContrast = {
1045
- primary: ActionStatesWithContrast;
1046
- secondary: ActionStatesWithContrast;
1047
- tertiary: ActionStatesWithContrast;
1048
- link: ActionStatesWithContrast;
1062
+ declare type ActionVariantsWithContrast = {
1063
+ primary: ActionStatesWithContrast;
1064
+ secondary: ActionStatesWithContrast;
1065
+ tertiary: ActionStatesWithContrast;
1066
+ link: ActionStatesWithContrast;
1049
1067
  };
1050
-
1051
- // export type ActionProperties = {
1052
- // background: ActionVariants;
1053
- // border: ActionVariants;
1054
- // text: ActionVariants;
1055
- // icon: ActionVariants;
1056
- // };
1057
-
1058
- type FeedbackActions = {
1059
- background: Pick<ActionVariantsWithContrast, 'primary'>;
1060
- border: Pick<ActionVariantsWithContrast, 'primary'>;
1061
- text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1062
- icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1068
+ declare type FeedbackActions = {
1069
+ background: Pick<ActionVariantsWithContrast, 'primary'>;
1070
+ border: Pick<ActionVariantsWithContrast, 'primary'>;
1071
+ text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1072
+ icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
1063
1073
  };
1064
-
1065
- type Colors = {
1066
- brand: {
1067
- primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
1068
- secondary: Record<500, string>;
1069
- gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
1070
- };
1071
- feedback: {
1072
- background: Record<Feedback, ColorContrast>;
1073
- border: Record<Feedback, ColorContrast>;
1074
- text: Record<Feedback, ColorContrast>;
1075
- icon: Record<Feedback, ColorContrast>;
1076
- positive: {
1077
- action: FeedbackActions;
1078
- };
1079
- negative: {
1080
- action: FeedbackActions;
1074
+ declare type Colors = {
1075
+ brand: {
1076
+ primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
1077
+ secondary: Record<500, string>;
1078
+ gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
1081
1079
  };
1082
- information: {
1083
- action: FeedbackActions;
1080
+ feedback: {
1081
+ background: Record<Feedback, ColorContrast>;
1082
+ border: Record<Feedback, ColorContrast>;
1083
+ text: Record<Feedback, ColorContrast>;
1084
+ icon: Record<Feedback, ColorContrast>;
1085
+ positive: {
1086
+ action: FeedbackActions;
1087
+ };
1088
+ negative: {
1089
+ action: FeedbackActions;
1090
+ };
1091
+ information: {
1092
+ action: FeedbackActions;
1093
+ };
1094
+ notice: {
1095
+ action: FeedbackActions;
1096
+ };
1097
+ neutral: {
1098
+ action: FeedbackActions;
1099
+ };
1084
1100
  };
1085
- notice: {
1086
- action: FeedbackActions;
1101
+ surface: {
1102
+ background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
1103
+ border: Record<'normal' | 'subtle', ColorContrast>;
1104
+ text: Record<TextTypes, ColorContrast>;
1105
+ action: {
1106
+ icon: ActionStatesWithContrast;
1107
+ };
1087
1108
  };
1088
- neutral: {
1089
- action: FeedbackActions;
1090
- };
1091
- };
1092
- surface: {
1093
- background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
1094
- border: Record<'normal' | 'subtle', ColorContrast>;
1095
- text: Record<TextTypes, ColorContrast>;
1109
+ overlay: Record<'background', string>;
1096
1110
  action: {
1097
- icon: ActionStatesWithContrast;
1098
- };
1099
- };
1100
- overlay: Record<'background', string>;
1101
- action: {
1102
- background: Omit<ActionVariants, 'link'>;
1103
- border: Omit<ActionVariants, 'link'>;
1104
- text: ActionVariants;
1105
- icon: ActionVariants;
1106
- };
1107
- badge: {
1108
- background: {
1109
- blue: ColorContrast;
1110
- };
1111
- border: {
1112
- blue: ColorContrast;
1113
- };
1114
- text: {
1115
- blue: ColorContrast;
1111
+ background: Omit<ActionVariants, 'link'>;
1112
+ border: Omit<ActionVariants, 'link'>;
1113
+ text: ActionVariants;
1114
+ icon: ActionVariants;
1116
1115
  };
1117
- icon: {
1118
- blue: ColorContrast;
1116
+ badge: {
1117
+ background: {
1118
+ blue: ColorContrast;
1119
+ };
1120
+ border: {
1121
+ blue: ColorContrast;
1122
+ };
1123
+ text: {
1124
+ blue: ColorContrast;
1125
+ };
1126
+ icon: {
1127
+ blue: ColorContrast;
1128
+ };
1119
1129
  };
1120
- };
1130
+ };
1131
+ declare type ColorsWithModes = Record<ColorSchemeModes, Colors>;
1132
+ declare type ThemeTokens = {
1133
+ name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
1134
+ border: Border;
1135
+ breakpoints: Breakpoints;
1136
+ colors: ColorsWithModes;
1137
+ motion: Motion$1;
1138
+ elevation: ElevationWithColorModes$1;
1139
+ spacing: Spacing;
1140
+ typography: TypographyWithPlatforms;
1121
1141
  };
1122
1142
 
1123
- type ColorsWithModes = Record<ColorSchemeModes, Colors>;
1143
+ declare type ElevationLevels = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
1144
+ declare type ElevationStyles = Readonly<{
1145
+ elevation: number;
1146
+ shadowColor: string;
1147
+ shadowOpacity: number;
1148
+ shadowRadius: number;
1149
+ shadowOffset: {
1150
+ /**
1151
+ * x-axis
1152
+ */
1153
+ width: number;
1154
+ /**
1155
+ * y-axis
1156
+ */
1157
+ height: number;
1158
+ };
1159
+ }>;
1160
+ declare type Elevation = Record<ElevationLevels, Platform.Select<{
1161
+ web: string;
1162
+ native: ElevationStyles;
1163
+ }>>;
1164
+ declare type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
1124
1165
 
1125
- type ThemeTokens = {
1126
- name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object
1127
- border: Border;
1128
- breakpoints: Breakpoints;
1129
- colors: ColorsWithModes;
1130
- motion: Motion$1;
1131
- spacing: Spacing;
1132
- shadows: Shadows;
1133
- typography: TypographyWithPlatforms;
1134
- };
1166
+ declare const elevation: ElevationWithColorModes;
1135
1167
 
1136
1168
  declare const paymentTheme: ThemeTokens;
1137
1169
 
@@ -1175,6 +1207,4 @@ declare type OverrideTheme = {
1175
1207
  */
1176
1208
  declare const overrideTheme: ({ baseThemeTokens, overrides }: OverrideTheme) => ThemeTokens;
1177
1209
 
1178
- declare const colorSchemeNamesInput: ColorSchemeNamesInput[];
1179
-
1180
- export { Border$1 as Border, Breakpoints$1 as Breakpoints, Color, ColorSchemeNames, ColorSchemeNamesInput, ColorsWithModes, FontFamily$1 as FontFamily, Motion, Opacity, Shadows, Size, Spacing$1 as Spacing, ThemeTokens, Typography$1 as Typography, bankingTheme, colorSchemeNamesInput, colors, overrideTheme, paymentTheme };
1210
+ export { Border$1 as Border, Breakpoints$1 as Breakpoints, Color, ColorSchemeNames, ColorSchemeNamesInput, ColorsWithModes, DelayString, DurationString, EasingFunctionFactory, 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 };