@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,560 +1,458 @@
1
- import { Platform as Platform$2 } from 'react-native';
1
+ /// <reference types="react" />
2
+ import { Platform as Platform$1 } from 'react-native';
3
+ import * as React from 'react';
2
4
  import { MutableRefObject } from 'react';
3
5
 
4
- type BorderRadius = Readonly<{
5
- /** none: 0(px/rem/pt) */
6
- none: 0;
7
- /** small: 2(px/rem/pt) */
8
- small: 2;
9
- /** medium: 4(px/rem/pt) */
10
- medium: 4;
11
- /** large: 8(px/rem/pt) */
12
- large: 8;
13
- /** max: 9999(px/rem/pt). This will round the left and right side of the box element */
14
- max: 9999;
15
- /** round: 50%(pt). This will turn the box element into a circle */
16
- round: '50%';
6
+ declare type BorderRadius = Readonly<{
7
+ /** none: 0(px/rem/pt) */
8
+ none: 0;
9
+ /** small: 2(px/rem/pt) */
10
+ small: 2;
11
+ /** medium: 4(px/rem/pt) */
12
+ medium: 4;
13
+ /** large: 8(px/rem/pt) */
14
+ large: 8;
15
+ /** max: 9999(px/rem/pt). This will round the left and right side of the box element */
16
+ max: 9999;
17
+ /** round: 50%(pt). This will turn the box element into a circle */
18
+ round: '50%';
17
19
  }>;
18
-
19
- type BorderWidth = Readonly<{
20
- /** none: 0(px/rem/pt) */
21
- none: 0;
22
- /** thinner: 0.5(px/rem/pt) */
23
- thinner: 0.5;
24
- /** thin: 1(px/rem/pt) */
25
- thin: 1;
26
- /** thick: 1.5(px/rem/pt) */
27
- thick: 1.5;
28
- /** thicker: 2(px/rem/pt) */
29
- thicker: 2;
20
+ declare type BorderWidth = Readonly<{
21
+ /** none: 0(px/rem/pt) */
22
+ none: 0;
23
+ /** thinner: 0.5(px/rem/pt) */
24
+ thinner: 0.5;
25
+ /** thin: 1(px/rem/pt) */
26
+ thin: 1;
27
+ /** thick: 1.5(px/rem/pt) */
28
+ thick: 1.5;
29
+ /** thicker: 2(px/rem/pt) */
30
+ thicker: 2;
30
31
  }>;
31
-
32
- type Border = Readonly<{
33
- radius: BorderRadius;
34
- width: BorderWidth;
32
+ declare type Border = Readonly<{
33
+ radius: BorderRadius;
34
+ width: BorderWidth;
35
35
  }>;
36
36
 
37
- type Breakpoints = Readonly<{
38
- /**
39
- * `base` is used for responsive styling following a **mobile first** approach. It starts from 0px till the next existing token
40
- *
41
- * Think of this as styles without any media query.
42
- *
43
- * ### Example
44
- *
45
- * This code will set margin as `spacing.2` on "m" size screens and above. And as `spacing.1` on less than "m" size screens
46
- * ```jsx
47
- * <Box margin={{ base: 'spacing.1', m: 'spacing.2' }} />
48
- * ```
49
- *
50
- * This roughly translates into -
51
- *
52
- * ```
53
- * .Box {
54
- * margin: 'spacing.1';
55
- * }
56
- *
57
- * @media screen and (min-width: 768px) {
58
- * .Box {
59
- * margin: 'spacing.2';
60
- * }
61
- * }
62
- * ```
63
- */
64
- base: number;
65
- /**
66
- * `@media screen and (min-width: 320px)`
67
- *
68
- * Small Mobiles
69
- */
70
- xs: number;
71
- /**
72
- * `@media screen and (min-width: 480px)`
73
- *
74
- * Mobiles and Small Tablets
75
- */
76
- s: number;
77
- /**
78
- * `@media screen and (min-width: 768px)`
79
- *
80
- * Medium and Large Tablets.
81
- *
82
- * Dimensions with `m` and above can be treated as desktop in mobile-first approach (with min-width).
83
- * Hence this breakpoint can be used for desktop styling.
84
- *
85
- * E.g. next example will keep flexDirection `row` on mobiles and `column` on large tablets, desktop, and larger screens
86
- *
87
- * ```jsx
88
- * <Box display="flex" flexDirection={{ base: 'row', m: 'column' }} />
89
- * ```
90
- *
91
- */
92
- m: number;
93
- /**
94
- * `@media screen and (min-width: 1024px)`
95
- *
96
- * Desktop
97
- */
98
- l: number;
99
- /**
100
- * `@media screen and (min-width: 1200px)`
101
- *
102
- * HD Desktop
103
- */
104
- xl: number;
37
+ declare type Breakpoints = Readonly<{
38
+ /**
39
+ * `base` is used for responsive styling following a **mobile first** approach. It starts from 0px till the next existing token
40
+ *
41
+ * Think of this as styles without any media query.
42
+ *
43
+ * ### Example
44
+ *
45
+ * This code will set margin as `spacing.2` on "m" size screens and above. And as `spacing.1` on less than "m" size screens
46
+ * ```jsx
47
+ * <Box margin={{ base: 'spacing.1', m: 'spacing.2' }} />
48
+ * ```
49
+ *
50
+ * This roughly translates into -
51
+ *
52
+ * ```
53
+ * .Box {
54
+ * margin: 'spacing.1';
55
+ * }
56
+ *
57
+ * @media screen and (min-width: 768px) {
58
+ * .Box {
59
+ * margin: 'spacing.2';
60
+ * }
61
+ * }
62
+ * ```
63
+ */
64
+ base: number;
65
+ /**
66
+ * `@media screen and (min-width: 320px)`
67
+ *
68
+ * Small Mobiles
69
+ */
70
+ xs: number;
71
+ /**
72
+ * `@media screen and (min-width: 480px)`
73
+ *
74
+ * Mobiles and Small Tablets
75
+ */
76
+ s: number;
77
+ /**
78
+ * `@media screen and (min-width: 768px)`
79
+ *
80
+ * Medium and Large Tablets.
81
+ *
82
+ * Dimensions with `m` and above can be treated as desktop in mobile-first approach (with min-width).
83
+ * Hence this breakpoint can be used for desktop styling.
84
+ *
85
+ * E.g. next example will keep flexDirection `row` on mobiles and `column` on large tablets, desktop, and larger screens
86
+ *
87
+ * ```jsx
88
+ * <Box display="flex" flexDirection={{ base: 'row', m: 'column' }} />
89
+ * ```
90
+ *
91
+ */
92
+ m: number;
93
+ /**
94
+ * `@media screen and (min-width: 1024px)`
95
+ *
96
+ * Desktop
97
+ */
98
+ l: number;
99
+ /**
100
+ * `@media screen and (min-width: 1200px)`
101
+ *
102
+ * HD Desktop
103
+ */
104
+ xl: number;
105
105
  }>;
106
106
 
107
- type FontFamily = {
108
- /** Used for all type of textual content except code snippets */
109
- text: string;
110
- /** Used for code snippets */
111
- code: string;
107
+ declare type FontFamily = {
108
+ /** Used for all type of textual content except code snippets */
109
+ text: string;
110
+ /** Used for code snippets */
111
+ code: string;
112
112
  };
113
113
 
114
- type FontWeight = {
115
- regular: 400;
116
- bold: 700;
114
+ declare type FontWeight = {
115
+ regular: 400;
116
+ bold: 700;
117
117
  };
118
-
119
118
  /**
120
119
  * For font size and line-heights we can’t say from xl to 2xl the value will necessary increase.
121
120
  * it might decrease or remain same because these are alias tokens and we need aliases for cross platform.
122
121
  * so for example xl on mobile can be 32px and on desktop xl can be 34px,
123
122
  * 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.
124
123
  */
125
-
126
- type FontSize = {
127
- /** desktop: 9(px/rem/pt)
128
- *
129
- * mobile: 9(px/rem/pt)
130
- */
131
- 10: number;
132
- /** desktop: 10(px/rem/pt)
133
- *
134
- * mobile: 10(px/rem/pt)
135
- */
136
- 25: number;
137
- /** desktop: 11(px/rem/pt)
138
- *
139
- * mobile: 11(px/rem/pt)
140
- */
141
- 50: number;
142
- /** desktop: 12(px/rem/pt)
143
- *
144
- * mobile: 12(px/rem/pt)
145
- */
146
- 75: number;
147
- /** desktop: 14(px/rem/pt)
148
- *
149
- * mobile: 14(px/rem/pt)
150
- */
151
- 100: number;
152
- /** desktop: 16(px/rem/pt)
153
- *
154
- * mobile: 16(px/rem/pt)
155
- */
156
- 200: number;
157
- /** desktop: 18(px/rem/pt)
158
- *
159
- * mobile: 16(px/rem/pt)
160
- */
161
- 300: number;
162
- /** desktop: 20(px/rem/pt)
163
- *
164
- * mobile: 18(px/rem/pt)
165
- */
166
- 400: number;
167
- /** desktop: 22(px/rem/pt)
168
- *
169
- * mobile: 20(px/rem/pt)
170
- */
171
- 500: number;
172
- /** desktop: 24(px/rem/pt)
173
- *
174
- * mobile: 20(px/rem/pt)
175
- */
176
- 600: number;
177
- /** desktop: 28(px/rem/pt)
178
- *
179
- * mobile: 24(px/rem/pt)
180
- */
181
- 700: number;
182
- /** desktop: 32(px/rem/pt)
183
- *
184
- * mobile: 28(px/rem/pt)
185
- */
186
- 800: number;
187
- /** desktop: 36(px/rem/pt)
188
- *
189
- * mobile: 32(px/rem/pt)
190
- */
191
- 900: number;
192
- /** desktop: 40(px/rem/pt)
193
- *
194
- * mobile: 32(px/rem/pt)
195
- */
196
- 1000: number;
197
- /** desktop: 48(px/rem/pt)
198
- *
199
- * mobile: 40(px/rem/pt)
200
- */
201
- 1100: number;
202
- /** desktop: 56(px/rem/pt)
203
- *
204
- * mobile: 48(px/rem/pt)
205
- */
206
- 1200: number;
207
- /** desktop: 64(px/rem/pt)
208
- *
209
- * mobile: 56(px/rem/pt)
210
- */
211
- 1300: number;
212
- /** desktop: 88(px/rem/pt)
213
- *
214
- * mobile: 64(px/rem/pt)
215
- */
216
- 1600: number;
217
- };
218
-
219
- type Typography = {
220
- fonts: {
221
- family: FontFamily;
222
- size: FontSize;
223
- weight: FontWeight;
224
- };
225
- lineHeights: {
226
- /** desktop: 0(px/rem/pt)
227
- *
228
- * mobile: 0(px/rem/pt)
124
+ declare type FontSize = {
125
+ /** desktop: 9(px/rem/pt)
126
+ *
127
+ * mobile: 9(px/rem/pt)
128
+ */
129
+ 10: number;
130
+ /** desktop: 10(px/rem/pt)
131
+ *
132
+ * mobile: 10(px/rem/pt)
133
+ */
134
+ 25: number;
135
+ /** desktop: 11(px/rem/pt)
136
+ *
137
+ * mobile: 11(px/rem/pt)
229
138
  */
230
- 0: number;
139
+ 50: number;
140
+ /** desktop: 12(px/rem/pt)
141
+ *
142
+ * mobile: 12(px/rem/pt)
143
+ */
144
+ 75: number;
231
145
  /** desktop: 14(px/rem/pt)
232
146
  *
233
147
  * mobile: 14(px/rem/pt)
234
148
  */
235
- 25: number;
149
+ 100: number;
236
150
  /** desktop: 16(px/rem/pt)
237
151
  *
238
152
  * mobile: 16(px/rem/pt)
239
153
  */
240
- 50: number;
154
+ 200: number;
241
155
  /** desktop: 18(px/rem/pt)
242
156
  *
243
- * mobile: 18(px/rem/pt)
157
+ * mobile: 16(px/rem/pt)
244
158
  */
245
- 75: number;
159
+ 300: number;
246
160
  /** desktop: 20(px/rem/pt)
247
161
  *
248
- * mobile: 20(px/rem/pt)
162
+ * mobile: 18(px/rem/pt)
249
163
  */
250
- 100: number;
251
- /** desktop: 24(px/rem/pt)
164
+ 400: number;
165
+ /** desktop: 22(px/rem/pt)
252
166
  *
253
167
  * mobile: 20(px/rem/pt)
254
168
  */
255
- 200: number;
169
+ 500: number;
256
170
  /** desktop: 24(px/rem/pt)
257
171
  *
258
- * mobile: 24(px/rem/pt)
172
+ * mobile: 20(px/rem/pt)
259
173
  */
260
- 300: number;
174
+ 600: number;
261
175
  /** desktop: 28(px/rem/pt)
262
176
  *
263
177
  * mobile: 24(px/rem/pt)
264
178
  */
265
- 400: number;
179
+ 700: number;
266
180
  /** desktop: 32(px/rem/pt)
267
181
  *
268
182
  * mobile: 28(px/rem/pt)
269
183
  */
270
- 500: number;
271
- /** desktop: 40(px/rem/pt)
184
+ 800: number;
185
+ /** desktop: 36(px/rem/pt)
272
186
  *
273
187
  * mobile: 32(px/rem/pt)
274
188
  */
275
- 600: number;
189
+ 900: number;
276
190
  /** desktop: 40(px/rem/pt)
277
191
  *
278
- * mobile: 40(px/rem/pt)
192
+ * mobile: 32(px/rem/pt)
279
193
  */
280
- 700: number;
194
+ 1000: number;
281
195
  /** desktop: 48(px/rem/pt)
282
196
  *
283
197
  * mobile: 40(px/rem/pt)
284
198
  */
285
- 800: number;
199
+ 1100: number;
286
200
  /** desktop: 56(px/rem/pt)
287
201
  *
288
202
  * mobile: 48(px/rem/pt)
289
203
  */
290
- 900: number;
204
+ 1200: number;
291
205
  /** desktop: 64(px/rem/pt)
292
206
  *
293
207
  * mobile: 56(px/rem/pt)
294
208
  */
295
- 1000: number;
296
- /** desktop: 72(px/rem/pt)
209
+ 1300: number;
210
+ /** desktop: 88(px/rem/pt)
297
211
  *
298
212
  * mobile: 64(px/rem/pt)
299
213
  */
300
- 1100: number;
301
- /** desktop: 104(px/rem/pt)
302
- *
303
- * mobile: 72(px/rem/pt)
304
- */
305
- 1500: number;
306
- };
307
- // letterSpacings: {};
214
+ 1600: number;
308
215
  };
309
-
310
- type TypographyPlatforms = 'onDesktop' | 'onMobile';
311
-
312
- type TypographyWithPlatforms = Record<TypographyPlatforms, Typography>;
216
+ declare type Typography = {
217
+ fonts: {
218
+ family: FontFamily;
219
+ size: FontSize;
220
+ weight: FontWeight;
221
+ };
222
+ lineHeights: {
223
+ /** desktop: 0(px/rem/pt)
224
+ *
225
+ * mobile: 0(px/rem/pt)
226
+ */
227
+ 0: number;
228
+ /** desktop: 14(px/rem/pt)
229
+ *
230
+ * mobile: 14(px/rem/pt)
231
+ */
232
+ 25: number;
233
+ /** desktop: 16(px/rem/pt)
234
+ *
235
+ * mobile: 16(px/rem/pt)
236
+ */
237
+ 50: number;
238
+ /** desktop: 18(px/rem/pt)
239
+ *
240
+ * mobile: 18(px/rem/pt)
241
+ */
242
+ 75: number;
243
+ /** desktop: 20(px/rem/pt)
244
+ *
245
+ * mobile: 20(px/rem/pt)
246
+ */
247
+ 100: number;
248
+ /** desktop: 24(px/rem/pt)
249
+ *
250
+ * mobile: 20(px/rem/pt)
251
+ */
252
+ 200: number;
253
+ /** desktop: 24(px/rem/pt)
254
+ *
255
+ * mobile: 24(px/rem/pt)
256
+ */
257
+ 300: number;
258
+ /** desktop: 28(px/rem/pt)
259
+ *
260
+ * mobile: 24(px/rem/pt)
261
+ */
262
+ 400: number;
263
+ /** desktop: 32(px/rem/pt)
264
+ *
265
+ * mobile: 28(px/rem/pt)
266
+ */
267
+ 500: number;
268
+ /** desktop: 40(px/rem/pt)
269
+ *
270
+ * mobile: 32(px/rem/pt)
271
+ */
272
+ 600: number;
273
+ /** desktop: 40(px/rem/pt)
274
+ *
275
+ * mobile: 40(px/rem/pt)
276
+ */
277
+ 700: number;
278
+ /** desktop: 48(px/rem/pt)
279
+ *
280
+ * mobile: 40(px/rem/pt)
281
+ */
282
+ 800: number;
283
+ /** desktop: 56(px/rem/pt)
284
+ *
285
+ * mobile: 48(px/rem/pt)
286
+ */
287
+ 900: number;
288
+ /** desktop: 64(px/rem/pt)
289
+ *
290
+ * mobile: 56(px/rem/pt)
291
+ */
292
+ 1000: number;
293
+ /** desktop: 72(px/rem/pt)
294
+ *
295
+ * mobile: 64(px/rem/pt)
296
+ */
297
+ 1100: number;
298
+ /** desktop: 104(px/rem/pt)
299
+ *
300
+ * mobile: 72(px/rem/pt)
301
+ */
302
+ 1500: number;
303
+ };
304
+ };
305
+ declare type TypographyPlatforms = 'onDesktop' | 'onMobile';
306
+ declare type TypographyWithPlatforms = Record<TypographyPlatforms, Typography>;
313
307
 
314
308
  /**
315
309
  * When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
316
310
  *
317
311
  * {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
318
312
  */
319
-
320
- type Spacing = Readonly<{
321
- /** 0: 0(px/rem/pt) */
322
- 0: 0;
323
- /** 1: 2(px/rem/pt) */
324
- 1: 2;
325
- /** 2: 4(px/rem/pt) */
326
- 2: 4;
327
- /** 3: 8(px/rem/pt) */
328
- 3: 8;
329
- /** 4: 12(px/rem/pt) */
330
- 4: 12;
331
- /** 5: 16(px/rem/pt) */
332
- 5: 16;
333
- /** 6: 20(px/rem/pt) */
334
- 6: 20;
335
- /** 7: 24(px/rem/pt) */
336
- 7: 24;
337
- /** 8: 32(px/rem/pt) */
338
- 8: 32;
339
- /** 9: 40(px/rem/pt) */
340
- 9: 40;
341
- /** 10: 48(px/rem/pt) */
342
- 10: 48;
343
- /** 11: 56(px/rem/pt) */
344
- 11: 56;
313
+ declare type Spacing = Readonly<{
314
+ /** 0: 0(px/rem/pt) */
315
+ 0: 0;
316
+ /** 1: 2(px/rem/pt) */
317
+ 1: 2;
318
+ /** 2: 4(px/rem/pt) */
319
+ 2: 4;
320
+ /** 3: 8(px/rem/pt) */
321
+ 3: 8;
322
+ /** 4: 12(px/rem/pt) */
323
+ 4: 12;
324
+ /** 5: 16(px/rem/pt) */
325
+ 5: 16;
326
+ /** 6: 20(px/rem/pt) */
327
+ 6: 20;
328
+ /** 7: 24(px/rem/pt) */
329
+ 7: 24;
330
+ /** 8: 32(px/rem/pt) */
331
+ 8: 32;
332
+ /** 9: 40(px/rem/pt) */
333
+ 9: 40;
334
+ /** 10: 48(px/rem/pt) */
335
+ 10: 48;
336
+ /** 11: 56(px/rem/pt) */
337
+ 11: 56;
345
338
  }>;
346
339
 
347
- type UseColorScheme$1 = {
348
- colorScheme: ColorSchemeNames;
349
- setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;
350
- };
351
-
352
- /* eslint-disable @typescript-eslint/no-explicit-any */
353
-
354
- /**
355
- * Brands a type making them act as nominal
356
- * @see https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d
357
- */
358
- type Brand$1<Type, Name extends string> = Type & { __brand__?: Name };
359
-
360
- type NativeOrWebBrand$1 = Brand$1<any, 'native' | 'web'>;
361
-
362
- /* eslint-disable @typescript-eslint/no-namespace */
363
-
364
-
365
- declare namespace Platform$1 {
366
- export type Name = 'web';
367
- /**
368
- * Right now, the module resolution is set to resolve `.web` files,
369
- *
370
- * Thus Platform.Select<> type will return the `web` type
371
- */
372
- export type Select<Options extends { web: unknown; native: unknown }> = Brand$1<
373
- Options[Name],
374
- 'platform-web'
375
- >;
376
-
377
- export type CastNative<T extends NativeOrWebBrand$1 | undefined> = Extract<
378
- T,
379
- { __brand__?: 'platform-native' | 'platform-all' }
380
- >;
381
-
382
- export type CastWeb<T extends NativeOrWebBrand$1 | undefined> = Extract<
383
- T,
384
- { __brand__?: 'platform-web' | 'platform-all' }
385
- >;
386
- }
387
-
388
- type Theme = {
389
- name: ThemeTokens['name'];
390
- border: Border;
391
- breakpoints: Breakpoints;
392
- colors: Colors;
393
- spacing: Spacing;
394
- motion: Motion;
395
- elevation: Elevation;
396
- typography: Typography;
340
+ declare type Duration = {
341
+ /** `70` milliseconds */
342
+ '2xquick': 70;
343
+ /** `150` milliseconds */
344
+ xquick: 150;
345
+ /** `200` milliseconds */
346
+ quick: 200;
347
+ /** `250` milliseconds */
348
+ moderate: 250;
349
+ /** `300` milliseconds */
350
+ xmoderate: 300;
351
+ /** `400` milliseconds */
352
+ gentle: 400;
353
+ /** `600` milliseconds */
354
+ xgentle: 600;
355
+ /** `900` milliseconds */
356
+ '2xgentle': 900;
397
357
  };
398
-
399
- type ThemeContext = UseColorScheme$1 & {
400
- theme: Theme;
401
- platform: TypographyPlatforms;
358
+ declare type Delay = {
359
+ /** `70` milliseconds */
360
+ '2xshort': 70;
361
+ /** `120` milliseconds */
362
+ xshort: 120;
363
+ /** `180` milliseconds */
364
+ short: 180;
365
+ /** `3000` milliseconds */
366
+ long: 3000;
367
+ /** `5000` milliseconds */
368
+ xlong: 5000;
402
369
  };
403
-
404
- declare const ThemeContext = createContext<ThemeContext>({
405
- // @ts-expect-error set null
406
- theme: null,
407
- colorScheme: 'light',
408
- platform: 'onDesktop',
409
- setColorScheme: () => null,
410
- });
411
-
412
- declare const useTheme = (): ThemeContext => {
413
- const themeContext = useContext<ThemeContext>(ThemeContext);
414
- if (__DEV__) {
415
- if (!themeContext.theme) {
416
- throwBladeError({
417
- message: 'BladeProvider is missing theme',
418
- moduleName: 'BladeProvider',
419
- });
420
- }
421
- if (themeContext === undefined) {
422
- throwBladeError({
423
- message: 'useTheme must be used within BladeProvider',
424
- moduleName: 'BladeProvider',
425
- });
426
- }
427
- }
428
- return themeContext;
370
+ declare type EasingFactoryFn = {
371
+ factory: () => (value: number) => number;
429
372
  };
430
-
431
- type Duration = {
432
- /** `70` milliseconds */
433
- '2xquick': 70;
434
- /** `150` milliseconds */
435
- xquick: 150;
436
- /** `200` milliseconds */
437
- quick: 200;
438
- /** `250` milliseconds */
439
- moderate: 250;
440
- /** `300` milliseconds */
441
- xmoderate: 300;
442
- /** `400` milliseconds */
443
- gentle: 400;
444
- /** `600` milliseconds */
445
- xgentle: 600;
446
- /** `900` milliseconds */
447
- '2xgentle': 900;
448
- };
449
-
450
- type Delay = {
451
- /** `70` milliseconds */
452
- '2xshort': 70;
453
- /** `120` milliseconds */
454
- xshort: 120;
455
- /** `180` milliseconds */
456
- short: 180;
457
- /** `3000` milliseconds */
458
- long: 3000;
459
- /** `5000` milliseconds */
460
- xlong: 5000;
461
- };
462
-
463
- type EasingFactoryFn = { factory: () => (value: number) => number }; // similar to EasingFactoryFn of `react-native-reanimated`
464
- type EasingType<Value extends string> = Platform$1.Select<{
465
- web: Value;
466
- native: EasingFactoryFn;
373
+ declare type EasingType<Value extends string> = Platform.Select<{
374
+ web: Value;
375
+ native: EasingFactoryFn;
467
376
  }>;
468
-
469
- type Easing = {
470
- /** Easings for all standard animations*/
471
- standard: {
472
- /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
473
- *
474
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
475
- attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
476
- /** `cubic-bezier(0.3, 0, 0.2, 1)`
477
- *
478
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
479
- effective: EasingType<'cubic-bezier(0.3, 0, 0.2, 1)'>;
480
- /** `cubic-bezier(0.5, 0, 0, 1)`
481
- *
482
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
483
- revealing: EasingType<'cubic-bezier(0.5, 0, 0, 1)'>;
484
- /** `cubic-bezier(1, 0.5, 0, 0.5)`
485
- *
486
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
487
- wary: EasingType<'cubic-bezier(1, 0.5, 0, 0.5)'>;
488
- };
489
- /** Easings for all entrance animations*/
490
- entrance: {
491
- /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
492
- *
493
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
494
- attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
495
- /** `cubic-bezier(0, 0, 0.2, 1)`
496
- *
497
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
498
- effective: EasingType<'cubic-bezier(0, 0, 0.2, 1)'>;
499
- /** `cubic-bezier(0, 0, 0, 1)`
500
- *
501
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
502
- revealing: EasingType<'cubic-bezier(0, 0, 0, 1)'>;
503
- };
504
- /** Easings for all exit animations*/
505
- exit: {
506
- /** `cubic-bezier(0.7, 0, 0.5, 1)`
507
- *
508
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
509
- attentive: EasingType<'cubic-bezier(0.7, 0, 0.5, 1)'>;
510
- /** `cubic-bezier(0.17, 0, 1, 1)`
511
- *
512
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
513
- effective: EasingType<'cubic-bezier(0.17, 0, 1, 1)'>;
514
- /** `cubic-bezier(0.5, 0, 1, 1)`
515
- *
516
- * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
517
- revealing: EasingType<'cubic-bezier(0.5, 0, 1, 1)'>;
518
- };
377
+ declare type Easing = {
378
+ /** Easings for all standard animations*/
379
+ standard: {
380
+ /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
381
+ *
382
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
383
+ attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
384
+ /** `cubic-bezier(0.3, 0, 0.2, 1)`
385
+ *
386
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
387
+ effective: EasingType<'cubic-bezier(0.3, 0, 0.2, 1)'>;
388
+ /** `cubic-bezier(0.5, 0, 0, 1)`
389
+ *
390
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
391
+ revealing: EasingType<'cubic-bezier(0.5, 0, 0, 1)'>;
392
+ /** `cubic-bezier(1, 0.5, 0, 0.5)`
393
+ *
394
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
395
+ wary: EasingType<'cubic-bezier(1, 0.5, 0, 0.5)'>;
396
+ };
397
+ /** Easings for all entrance animations*/
398
+ entrance: {
399
+ /** `cubic-bezier(0.5, 0, 0.3, 1.5)`
400
+ *
401
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
402
+ attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
403
+ /** `cubic-bezier(0, 0, 0.2, 1)`
404
+ *
405
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
406
+ effective: EasingType<'cubic-bezier(0, 0, 0.2, 1)'>;
407
+ /** `cubic-bezier(0, 0, 0, 1)`
408
+ *
409
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
410
+ revealing: EasingType<'cubic-bezier(0, 0, 0, 1)'>;
411
+ };
412
+ /** Easings for all exit animations*/
413
+ exit: {
414
+ /** `cubic-bezier(0.7, 0, 0.5, 1)`
415
+ *
416
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
417
+ attentive: EasingType<'cubic-bezier(0.7, 0, 0.5, 1)'>;
418
+ /** `cubic-bezier(0.17, 0, 1, 1)`
419
+ *
420
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
421
+ effective: EasingType<'cubic-bezier(0.17, 0, 1, 1)'>;
422
+ /** `cubic-bezier(0.5, 0, 1, 1)`
423
+ *
424
+ * Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFactoryFn` for native */
425
+ revealing: EasingType<'cubic-bezier(0.5, 0, 1, 1)'>;
426
+ };
519
427
  };
520
-
521
- type Motion = Readonly<{
522
- delay: Delay;
523
- duration: Duration;
524
- easing: Easing;
428
+ declare type Motion = Readonly<{
429
+ delay: Delay;
430
+ duration: Duration;
431
+ easing: Easing;
525
432
  }>;
526
433
 
527
- type ElevationLevels = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
528
-
529
- type ElevationStyles = Readonly<{
530
- elevation: number;
531
- shadowColor: string;
532
- shadowOpacity: number;
533
- shadowRadius: number;
534
- shadowOffset: {
535
- /**
536
- * x-axis
537
- */
538
- width: number;
539
- /**
540
- * y-axis
541
- */
542
- height: number;
543
- };
434
+ declare type ElevationLevels = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
435
+ declare type ElevationStyles = Readonly<{
436
+ elevation: number;
437
+ shadowColor: string;
438
+ shadowOpacity: number;
439
+ shadowRadius: number;
440
+ shadowOffset: {
441
+ /**
442
+ * x-axis
443
+ */
444
+ width: number;
445
+ /**
446
+ * y-axis
447
+ */
448
+ height: number;
449
+ };
544
450
  }>;
545
-
546
- type Elevation = Record<
547
- ElevationLevels,
548
- Platform$1.Select<{
451
+ declare type Elevation = Record<ElevationLevels, Platform.Select<{
549
452
  web: string;
550
453
  native: ElevationStyles;
551
- }>
552
- >;
553
-
554
- type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
555
-
556
- /* eslint-disable @typescript-eslint/no-explicit-any */
557
-
454
+ }>>;
455
+ declare type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
558
456
 
559
457
  /**
560
458
  *
@@ -572,140 +470,119 @@ type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
572
470
  * Related TS Issue - https://github.com/microsoft/TypeScript/issues/29729
573
471
  *
574
472
  */
575
- type StringWithAutocomplete = string & Record<never, never>;
576
-
577
- type ColorSchemeNames = 'dark' | 'light';
578
- type ColorSchemeNamesInput = ColorSchemeNames | 'system';
579
-
580
- type ColorSchemeModes = 'onDark' | 'onLight';
581
-
582
- type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
583
-
584
- type ColorContrastTypes = 'low' | 'high';
585
-
586
- type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
587
-
588
- type ColorContrast = {
589
- [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
473
+ declare type StringWithAutocomplete = string & Record<never, never>;
474
+
475
+ declare type ColorSchemeNames = 'dark' | 'light';
476
+ declare type ColorSchemeNamesInput = ColorSchemeNames | 'system';
477
+ declare type ColorSchemeModes = 'onDark' | 'onLight';
478
+ declare type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
479
+ declare type ColorContrastTypes = 'low' | 'high';
480
+ declare type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
481
+ declare type ColorContrast = {
482
+ [K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
590
483
  };
591
-
592
- type ActionStates = {
593
- default: string;
594
- hover: string;
595
- focus: string;
596
- active: string;
597
- disabled: string;
484
+ declare type ActionStates = {
485
+ default: string;
486
+ hover: string;
487
+ focus: string;
488
+ active: string;
489
+ disabled: string;
598
490
  };
599
-
600
- type LinkActionStates = ActionStates & {
601
- visited: string;
491
+ declare type LinkActionStates = ActionStates & {
492
+ visited: string;
602
493
  };
603
-
604
- type ActionStatesWithContrast = {
605
- default: ColorContrast;
606
- hover: ColorContrast;
607
- focus: ColorContrast;
608
- active: ColorContrast;
609
- disabled: ColorContrast;
494
+ declare type ActionStatesWithContrast = {
495
+ default: ColorContrast;
496
+ hover: ColorContrast;
497
+ focus: ColorContrast;
498
+ active: ColorContrast;
499
+ disabled: ColorContrast;
610
500
  };
611
-
612
- type ActionVariants = {
613
- primary: ActionStates;
614
- secondary: ActionStates;
615
- tertiary: ActionStates;
616
- link: LinkActionStates;
501
+ declare type ActionVariants = {
502
+ primary: ActionStates;
503
+ secondary: ActionStates;
504
+ tertiary: ActionStates;
505
+ link: LinkActionStates;
617
506
  };
618
-
619
- type ActionVariantsWithContrast = {
620
- primary: ActionStatesWithContrast;
621
- secondary: ActionStatesWithContrast;
622
- tertiary: ActionStatesWithContrast;
623
- link: ActionStatesWithContrast;
507
+ declare type ActionVariantsWithContrast = {
508
+ primary: ActionStatesWithContrast;
509
+ secondary: ActionStatesWithContrast;
510
+ tertiary: ActionStatesWithContrast;
511
+ link: ActionStatesWithContrast;
624
512
  };
625
-
626
- // export type ActionProperties = {
627
- // background: ActionVariants;
628
- // border: ActionVariants;
629
- // text: ActionVariants;
630
- // icon: ActionVariants;
631
- // };
632
-
633
- type FeedbackActions = {
634
- background: Pick<ActionVariantsWithContrast, 'primary'>;
635
- border: Pick<ActionVariantsWithContrast, 'primary'>;
636
- text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
637
- icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
513
+ declare type FeedbackActions = {
514
+ background: Pick<ActionVariantsWithContrast, 'primary'>;
515
+ border: Pick<ActionVariantsWithContrast, 'primary'>;
516
+ text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
517
+ icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
638
518
  };
639
-
640
- type Colors = {
641
- brand: {
642
- primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
643
- secondary: Record<500, string>;
644
- gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
645
- };
646
- feedback: {
647
- background: Record<Feedback, ColorContrast>;
648
- border: Record<Feedback, ColorContrast>;
649
- text: Record<Feedback, ColorContrast>;
650
- icon: Record<Feedback, ColorContrast>;
651
- positive: {
652
- action: FeedbackActions;
519
+ declare type Colors = {
520
+ brand: {
521
+ primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
522
+ secondary: Record<500, string>;
523
+ gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
653
524
  };
654
- negative: {
655
- action: FeedbackActions;
525
+ feedback: {
526
+ background: Record<Feedback, ColorContrast>;
527
+ border: Record<Feedback, ColorContrast>;
528
+ text: Record<Feedback, ColorContrast>;
529
+ icon: Record<Feedback, ColorContrast>;
530
+ positive: {
531
+ action: FeedbackActions;
532
+ };
533
+ negative: {
534
+ action: FeedbackActions;
535
+ };
536
+ information: {
537
+ action: FeedbackActions;
538
+ };
539
+ notice: {
540
+ action: FeedbackActions;
541
+ };
542
+ neutral: {
543
+ action: FeedbackActions;
544
+ };
656
545
  };
657
- information: {
658
- action: FeedbackActions;
546
+ surface: {
547
+ background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
548
+ border: Record<'normal' | 'subtle', ColorContrast>;
549
+ text: Record<TextTypes, ColorContrast>;
550
+ action: {
551
+ icon: ActionStatesWithContrast;
552
+ };
659
553
  };
660
- notice: {
661
- action: FeedbackActions;
662
- };
663
- neutral: {
664
- action: FeedbackActions;
665
- };
666
- };
667
- surface: {
668
- background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
669
- border: Record<'normal' | 'subtle', ColorContrast>;
670
- text: Record<TextTypes, ColorContrast>;
554
+ overlay: Record<'background', string>;
671
555
  action: {
672
- icon: ActionStatesWithContrast;
673
- };
674
- };
675
- overlay: Record<'background', string>;
676
- action: {
677
- background: Omit<ActionVariants, 'link'>;
678
- border: Omit<ActionVariants, 'link'>;
679
- text: ActionVariants;
680
- icon: ActionVariants;
681
- };
682
- badge: {
683
- background: {
684
- blue: ColorContrast;
685
- };
686
- border: {
687
- blue: ColorContrast;
556
+ background: Omit<ActionVariants, 'link'>;
557
+ border: Omit<ActionVariants, 'link'>;
558
+ text: ActionVariants;
559
+ icon: ActionVariants;
688
560
  };
689
- text: {
690
- blue: ColorContrast;
561
+ badge: {
562
+ background: {
563
+ blue: ColorContrast;
564
+ };
565
+ border: {
566
+ blue: ColorContrast;
567
+ };
568
+ text: {
569
+ blue: ColorContrast;
570
+ };
571
+ icon: {
572
+ blue: ColorContrast;
573
+ };
691
574
  };
692
- icon: {
693
- blue: ColorContrast;
694
- };
695
- };
696
575
  };
697
-
698
- type ColorsWithModes = Record<ColorSchemeModes, Colors>;
699
-
700
- type ThemeTokens = {
701
- name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object
702
- border: Border;
703
- breakpoints: Breakpoints;
704
- colors: ColorsWithModes;
705
- motion: Motion;
706
- elevation: ElevationWithColorModes;
707
- spacing: Spacing;
708
- typography: TypographyWithPlatforms;
576
+ declare type ColorsWithModes = Record<ColorSchemeModes, Colors>;
577
+ declare type ThemeTokens = {
578
+ name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
579
+ border: Border;
580
+ breakpoints: Breakpoints;
581
+ colors: ColorsWithModes;
582
+ motion: Motion;
583
+ elevation: ElevationWithColorModes;
584
+ spacing: Spacing;
585
+ typography: TypographyWithPlatforms;
709
586
  };
710
587
 
711
588
  declare const getColorScheme: (colorScheme?: ColorSchemeNamesInput) => ColorSchemeNames;
@@ -745,7 +622,7 @@ declare function useInterval(callback: () => void, { delay, enable }: {
745
622
 
746
623
  declare const isReactNative: () => boolean;
747
624
 
748
- declare const getOS: () => typeof Platform$2.OS;
625
+ declare const getOS: () => typeof Platform$1.OS;
749
626
  declare const isAndroid: () => boolean;
750
627
 
751
628
  /**
@@ -814,7 +691,7 @@ declare const castNativeType: <T>(value: T) => Extract<T, {
814
691
  declare function makeBorderSize<T extends number>(size: T): `${T}px`;
815
692
  declare function makeBorderSize<T extends string>(size: T): T;
816
693
 
817
- declare type MakeMotionTime<Value extends number> = Platform$1.Select<{
694
+ declare type MakeMotionTime<Value extends number> = Platform.Select<{
818
695
  native: number;
819
696
  web: `${Value}ms`;
820
697
  }>;
@@ -842,4 +719,22 @@ declare const toTitleCase: (inputString: string) => string;
842
719
  */
843
720
  declare function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'];
844
721
 
722
+ declare type Theme = {
723
+ name: ThemeTokens['name'];
724
+ border: Border;
725
+ breakpoints: Breakpoints;
726
+ colors: Colors;
727
+ spacing: Spacing;
728
+ motion: Motion;
729
+ elevation: Elevation;
730
+ typography: Typography;
731
+ };
732
+
733
+ declare type ThemeContext = UseColorScheme & {
734
+ theme: Theme;
735
+ platform: TypographyPlatforms;
736
+ };
737
+ declare const ThemeContext: React.Context<ThemeContext>;
738
+ declare const useTheme: () => ThemeContext;
739
+
845
740
  export { MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, useInterval, usePrevious, useTheme };