@razorpay/blade 8.15.2 → 9.0.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/components/index.d.ts +27 -17
- package/build/components/index.native.d.ts +27 -17
- package/build/components/index.native.js +10 -10
- package/build/components/index.native.js.map +1 -1
- package/build/components/index.web.js +56 -39
- package/build/components/index.web.js.map +1 -1
- package/build/css/bankingThemeDarkDesktop.css +1 -1
- package/build/css/bankingThemeDarkMobile.css +1 -1
- package/build/css/bankingThemeLightDesktop.css +1 -1
- package/build/css/bankingThemeLightMobile.css +1 -1
- package/build/css/paymentThemeDarkDesktop.css +1 -1
- package/build/css/paymentThemeDarkMobile.css +1 -1
- package/build/css/paymentThemeLightDesktop.css +1 -1
- package/build/css/paymentThemeLightMobile.css +1 -1
- package/build/utils/index.d.ts +549 -1
- package/build/utils/index.native.d.ts +549 -1
- package/build/utils/index.native.js +4 -2
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/index.web.js +26 -2
- package/build/utils/index.web.js.map +1 -1
- package/package.json +1 -1
package/build/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import { Platform as Platform$2 } from 'react-native';
|
|
2
2
|
import { MutableRefObject } from 'react';
|
|
3
3
|
|
|
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%';
|
|
17
|
+
}>;
|
|
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
|
+
}>;
|
|
29
|
+
|
|
30
|
+
type Border = Readonly<{
|
|
31
|
+
radius: BorderRadius;
|
|
32
|
+
width: BorderWidth;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
4
35
|
type Breakpoints = Readonly<{
|
|
5
36
|
/**
|
|
6
37
|
* `base` is used for responsive styling following a **mobile first** approach. It starts from 0px till the next existing token
|
|
@@ -71,6 +102,211 @@ type Breakpoints = Readonly<{
|
|
|
71
102
|
xl: number;
|
|
72
103
|
}>;
|
|
73
104
|
|
|
105
|
+
type FontFamily = {
|
|
106
|
+
/** Used for all type of textual content except code snippets */
|
|
107
|
+
text: string;
|
|
108
|
+
/** Used for code snippets */
|
|
109
|
+
code: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
type FontWeight = {
|
|
113
|
+
regular: 400;
|
|
114
|
+
bold: 700;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* For font size and line-heights we can’t say from xl to 2xl the value will necessary increase.
|
|
119
|
+
* it might decrease or remain same because these are alias tokens and we need aliases for cross platform.
|
|
120
|
+
* so for example xl on mobile can be 32px and on desktop xl can be 34px,
|
|
121
|
+
* 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.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
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)
|
|
138
|
+
*/
|
|
139
|
+
50: number;
|
|
140
|
+
/** desktop: 12(px/rem/pt)
|
|
141
|
+
*
|
|
142
|
+
* mobile: 12(px/rem/pt)
|
|
143
|
+
*/
|
|
144
|
+
75: number;
|
|
145
|
+
/** desktop: 14(px/rem/pt)
|
|
146
|
+
*
|
|
147
|
+
* mobile: 14(px/rem/pt)
|
|
148
|
+
*/
|
|
149
|
+
100: number;
|
|
150
|
+
/** desktop: 16(px/rem/pt)
|
|
151
|
+
*
|
|
152
|
+
* mobile: 16(px/rem/pt)
|
|
153
|
+
*/
|
|
154
|
+
200: number;
|
|
155
|
+
/** desktop: 18(px/rem/pt)
|
|
156
|
+
*
|
|
157
|
+
* mobile: 16(px/rem/pt)
|
|
158
|
+
*/
|
|
159
|
+
300: number;
|
|
160
|
+
/** desktop: 20(px/rem/pt)
|
|
161
|
+
*
|
|
162
|
+
* mobile: 18(px/rem/pt)
|
|
163
|
+
*/
|
|
164
|
+
400: number;
|
|
165
|
+
/** desktop: 22(px/rem/pt)
|
|
166
|
+
*
|
|
167
|
+
* mobile: 20(px/rem/pt)
|
|
168
|
+
*/
|
|
169
|
+
500: number;
|
|
170
|
+
/** desktop: 24(px/rem/pt)
|
|
171
|
+
*
|
|
172
|
+
* mobile: 20(px/rem/pt)
|
|
173
|
+
*/
|
|
174
|
+
600: number;
|
|
175
|
+
/** desktop: 28(px/rem/pt)
|
|
176
|
+
*
|
|
177
|
+
* mobile: 24(px/rem/pt)
|
|
178
|
+
*/
|
|
179
|
+
700: number;
|
|
180
|
+
/** desktop: 32(px/rem/pt)
|
|
181
|
+
*
|
|
182
|
+
* mobile: 28(px/rem/pt)
|
|
183
|
+
*/
|
|
184
|
+
800: number;
|
|
185
|
+
/** desktop: 36(px/rem/pt)
|
|
186
|
+
*
|
|
187
|
+
* mobile: 32(px/rem/pt)
|
|
188
|
+
*/
|
|
189
|
+
900: number;
|
|
190
|
+
/** desktop: 40(px/rem/pt)
|
|
191
|
+
*
|
|
192
|
+
* mobile: 32(px/rem/pt)
|
|
193
|
+
*/
|
|
194
|
+
1000: number;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
type Typography = {
|
|
198
|
+
fonts: {
|
|
199
|
+
family: FontFamily;
|
|
200
|
+
size: FontSize;
|
|
201
|
+
weight: FontWeight;
|
|
202
|
+
};
|
|
203
|
+
lineHeights: {
|
|
204
|
+
/** desktop: 0(px/rem/pt)
|
|
205
|
+
*
|
|
206
|
+
* mobile: 0(px/rem/pt)
|
|
207
|
+
*/
|
|
208
|
+
0: number;
|
|
209
|
+
/** desktop: 14(px/rem/pt)
|
|
210
|
+
*
|
|
211
|
+
* mobile: 14(px/rem/pt)
|
|
212
|
+
*/
|
|
213
|
+
25: number;
|
|
214
|
+
/** desktop: 16(px/rem/pt)
|
|
215
|
+
*
|
|
216
|
+
* mobile: 16(px/rem/pt)
|
|
217
|
+
*/
|
|
218
|
+
50: number;
|
|
219
|
+
/** desktop: 18(px/rem/pt)
|
|
220
|
+
*
|
|
221
|
+
* mobile: 18(px/rem/pt)
|
|
222
|
+
*/
|
|
223
|
+
75: number;
|
|
224
|
+
/** desktop: 20(px/rem/pt)
|
|
225
|
+
*
|
|
226
|
+
* mobile: 20(px/rem/pt)
|
|
227
|
+
*/
|
|
228
|
+
100: number;
|
|
229
|
+
/** desktop: 24(px/rem/pt)
|
|
230
|
+
*
|
|
231
|
+
* mobile: 20(px/rem/pt)
|
|
232
|
+
*/
|
|
233
|
+
200: number;
|
|
234
|
+
/** desktop: 24(px/rem/pt)
|
|
235
|
+
*
|
|
236
|
+
* mobile: 24(px/rem/pt)
|
|
237
|
+
*/
|
|
238
|
+
300: number;
|
|
239
|
+
/** desktop: 28(px/rem/pt)
|
|
240
|
+
*
|
|
241
|
+
* mobile: 24(px/rem/pt)
|
|
242
|
+
*/
|
|
243
|
+
400: number;
|
|
244
|
+
/** desktop: 32(px/rem/pt)
|
|
245
|
+
*
|
|
246
|
+
* mobile: 28(px/rem/pt)
|
|
247
|
+
*/
|
|
248
|
+
500: number;
|
|
249
|
+
/** desktop: 40(px/rem/pt)
|
|
250
|
+
*
|
|
251
|
+
* mobile: 32(px/rem/pt)
|
|
252
|
+
*/
|
|
253
|
+
600: number;
|
|
254
|
+
/** desktop: 40(px/rem/pt)
|
|
255
|
+
*
|
|
256
|
+
* mobile: 40(px/rem/pt)
|
|
257
|
+
*/
|
|
258
|
+
700: number;
|
|
259
|
+
/** desktop: 48(px/rem/pt)
|
|
260
|
+
*
|
|
261
|
+
* mobile: 40(px/rem/pt)
|
|
262
|
+
*/
|
|
263
|
+
800: number;
|
|
264
|
+
};
|
|
265
|
+
// letterSpacings: {};
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
type TypographyPlatforms = 'onDesktop' | 'onMobile';
|
|
269
|
+
|
|
270
|
+
type TypographyWithPlatforms = Record<TypographyPlatforms, Typography>;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* When any of the values are changed here, do change the jsdoc comments in BaseBox/types/spacingTypes.ts as well
|
|
274
|
+
*
|
|
275
|
+
* {@link ../../components/Box/BaseBox/types/spacingTypes.ts}
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
type Spacing = Readonly<{
|
|
279
|
+
/** 0: 0(px/rem/pt) */
|
|
280
|
+
0: 0;
|
|
281
|
+
/** 1: 2(px/rem/pt) */
|
|
282
|
+
1: 2;
|
|
283
|
+
/** 2: 4(px/rem/pt) */
|
|
284
|
+
2: 4;
|
|
285
|
+
/** 3: 8(px/rem/pt) */
|
|
286
|
+
3: 8;
|
|
287
|
+
/** 4: 12(px/rem/pt) */
|
|
288
|
+
4: 12;
|
|
289
|
+
/** 5: 16(px/rem/pt) */
|
|
290
|
+
5: 16;
|
|
291
|
+
/** 6: 20(px/rem/pt) */
|
|
292
|
+
6: 20;
|
|
293
|
+
/** 7: 24(px/rem/pt) */
|
|
294
|
+
7: 24;
|
|
295
|
+
/** 8: 32(px/rem/pt) */
|
|
296
|
+
8: 32;
|
|
297
|
+
/** 9: 40(px/rem/pt) */
|
|
298
|
+
9: 40;
|
|
299
|
+
/** 10: 48(px/rem/pt) */
|
|
300
|
+
10: 48;
|
|
301
|
+
/** 11: 56(px/rem/pt) */
|
|
302
|
+
11: 56;
|
|
303
|
+
}>;
|
|
304
|
+
|
|
305
|
+
type UseColorScheme$1 = {
|
|
306
|
+
colorScheme: ColorSchemeNames;
|
|
307
|
+
setColorScheme: (colorScheme: ColorSchemeNamesInput) => void;
|
|
308
|
+
};
|
|
309
|
+
|
|
74
310
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
75
311
|
|
|
76
312
|
/**
|
|
@@ -107,9 +343,321 @@ declare namespace Platform$1 {
|
|
|
107
343
|
>;
|
|
108
344
|
}
|
|
109
345
|
|
|
346
|
+
type Theme = {
|
|
347
|
+
name: ThemeTokens['name'];
|
|
348
|
+
border: Border;
|
|
349
|
+
breakpoints: Breakpoints;
|
|
350
|
+
colors: Colors;
|
|
351
|
+
spacing: Spacing;
|
|
352
|
+
motion: Motion;
|
|
353
|
+
elevation: Elevation;
|
|
354
|
+
typography: Typography;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
type ThemeContext = UseColorScheme$1 & {
|
|
358
|
+
theme: Theme;
|
|
359
|
+
platform: TypographyPlatforms;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
declare const ThemeContext = createContext<ThemeContext>({
|
|
363
|
+
// @ts-expect-error set null
|
|
364
|
+
theme: null,
|
|
365
|
+
colorScheme: 'light',
|
|
366
|
+
platform: 'onDesktop',
|
|
367
|
+
setColorScheme: () => null,
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
declare const useTheme = (): ThemeContext => {
|
|
371
|
+
const themeContext = useContext<ThemeContext>(ThemeContext);
|
|
372
|
+
if (!themeContext.theme) {
|
|
373
|
+
throw new Error(`[@razorpay/blade:BladeProvider]: BladeProvider is missing theme`);
|
|
374
|
+
}
|
|
375
|
+
if (themeContext === undefined) {
|
|
376
|
+
throw new Error(`[@razorpay/blade:BladeProvider]: useTheme must be used within BladeProvider`);
|
|
377
|
+
}
|
|
378
|
+
return themeContext;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
type Duration = {
|
|
382
|
+
/** `70` milliseconds */
|
|
383
|
+
'2xquick': 70;
|
|
384
|
+
/** `150` milliseconds */
|
|
385
|
+
xquick: 150;
|
|
386
|
+
/** `200` milliseconds */
|
|
387
|
+
quick: 200;
|
|
388
|
+
/** `250` milliseconds */
|
|
389
|
+
moderate: 250;
|
|
390
|
+
/** `300` milliseconds */
|
|
391
|
+
xmoderate: 300;
|
|
392
|
+
/** `400` milliseconds */
|
|
393
|
+
gentle: 400;
|
|
394
|
+
/** `600` milliseconds */
|
|
395
|
+
xgentle: 600;
|
|
396
|
+
/** `900` milliseconds */
|
|
397
|
+
'2xgentle': 900;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
type Delay = {
|
|
401
|
+
/** `70` milliseconds */
|
|
402
|
+
'2xshort': 70;
|
|
403
|
+
/** `120` milliseconds */
|
|
404
|
+
xshort: 120;
|
|
405
|
+
/** `180` milliseconds */
|
|
406
|
+
short: 180;
|
|
407
|
+
/** `3000` milliseconds */
|
|
408
|
+
long: 3000;
|
|
409
|
+
/** `5000` milliseconds */
|
|
410
|
+
xlong: 5000;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
type EasingFunctionFactory = { factory: () => (value: number) => number }; // similar to EasingFunctionFactory of `react-native-reanimated`
|
|
414
|
+
type EasingType<Value extends string> = Platform$1.Select<{
|
|
415
|
+
web: Value;
|
|
416
|
+
native: EasingFunctionFactory;
|
|
417
|
+
}>;
|
|
418
|
+
|
|
419
|
+
type Easing = {
|
|
420
|
+
/** Easings for all standard animations*/
|
|
421
|
+
standard: {
|
|
422
|
+
/** `cubic-bezier(0.5, 0, 0.3, 1.5)`
|
|
423
|
+
*
|
|
424
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
425
|
+
attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
|
|
426
|
+
/** `cubic-bezier(0.3, 0, 0.2, 1)`
|
|
427
|
+
*
|
|
428
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
429
|
+
effective: EasingType<'cubic-bezier(0.3, 0, 0.2, 1)'>;
|
|
430
|
+
/** `cubic-bezier(0.5, 0, 0, 1)`
|
|
431
|
+
*
|
|
432
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
433
|
+
revealing: EasingType<'cubic-bezier(0.5, 0, 0, 1)'>;
|
|
434
|
+
/** `cubic-bezier(1, 0.5, 0, 0.5)`
|
|
435
|
+
*
|
|
436
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
437
|
+
wary: EasingType<'cubic-bezier(1, 0.5, 0, 0.5)'>;
|
|
438
|
+
};
|
|
439
|
+
/** Easings for all entrance animations*/
|
|
440
|
+
entrance: {
|
|
441
|
+
/** `cubic-bezier(0.5, 0, 0.3, 1.5)`
|
|
442
|
+
*
|
|
443
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
444
|
+
attentive: EasingType<'cubic-bezier(0.5, 0, 0.3, 1.5)'>;
|
|
445
|
+
/** `cubic-bezier(0, 0, 0.2, 1)`
|
|
446
|
+
*
|
|
447
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
448
|
+
effective: EasingType<'cubic-bezier(0, 0, 0.2, 1)'>;
|
|
449
|
+
/** `cubic-bezier(0, 0, 0, 1)`
|
|
450
|
+
*
|
|
451
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
452
|
+
revealing: EasingType<'cubic-bezier(0, 0, 0, 1)'>;
|
|
453
|
+
};
|
|
454
|
+
/** Easings for all exit animations*/
|
|
455
|
+
exit: {
|
|
456
|
+
/** `cubic-bezier(0.7, 0, 0.5, 1)`
|
|
457
|
+
*
|
|
458
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
459
|
+
attentive: EasingType<'cubic-bezier(0.7, 0, 0.5, 1)'>;
|
|
460
|
+
/** `cubic-bezier(0.17, 0, 1, 1)`
|
|
461
|
+
*
|
|
462
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
463
|
+
effective: EasingType<'cubic-bezier(0.17, 0, 1, 1)'>;
|
|
464
|
+
/** `cubic-bezier(0.5, 0, 1, 1)`
|
|
465
|
+
*
|
|
466
|
+
* Returns a `string` of `"cubic-bezier(...)"` for web & react-native-reanimated's Easing Function of type `EasingFunctionFactory` for native */
|
|
467
|
+
revealing: EasingType<'cubic-bezier(0.5, 0, 1, 1)'>;
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
type Motion = Readonly<{
|
|
472
|
+
delay: Delay;
|
|
473
|
+
duration: Duration;
|
|
474
|
+
easing: Easing;
|
|
475
|
+
}>;
|
|
476
|
+
|
|
477
|
+
type ElevationLevels = 'none' | 'lowRaised' | 'midRaised' | 'highRaised';
|
|
478
|
+
|
|
479
|
+
type ElevationStyles = Readonly<{
|
|
480
|
+
elevation: number;
|
|
481
|
+
shadowColor: string;
|
|
482
|
+
shadowOpacity: number;
|
|
483
|
+
shadowRadius: number;
|
|
484
|
+
shadowOffset: {
|
|
485
|
+
/**
|
|
486
|
+
* x-axis
|
|
487
|
+
*/
|
|
488
|
+
width: number;
|
|
489
|
+
/**
|
|
490
|
+
* y-axis
|
|
491
|
+
*/
|
|
492
|
+
height: number;
|
|
493
|
+
};
|
|
494
|
+
}>;
|
|
495
|
+
|
|
496
|
+
type Elevation = Record<
|
|
497
|
+
ElevationLevels,
|
|
498
|
+
Platform$1.Select<{
|
|
499
|
+
web: string;
|
|
500
|
+
native: ElevationStyles;
|
|
501
|
+
}>
|
|
502
|
+
>;
|
|
503
|
+
|
|
504
|
+
type ElevationWithColorModes = Record<ColorSchemeModes, Elevation>;
|
|
505
|
+
|
|
506
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
*
|
|
511
|
+
* When combined with union, this type utility will give you autocomplete of union while still supporting any string value as input
|
|
512
|
+
*
|
|
513
|
+
* ### Usage
|
|
514
|
+
*
|
|
515
|
+
* ```ts
|
|
516
|
+
* type ThemeName = 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete;
|
|
517
|
+
* ```
|
|
518
|
+
*
|
|
519
|
+
* This will show paymentTheme and bankingTheme in autocomplete but also allow any other string as value.
|
|
520
|
+
*
|
|
521
|
+
* More details - https://github.com/razorpay/blade/pull/1031/commits/86b6ee0facf45e7556739efcbfa5396b11b1b3c9#r1121298293
|
|
522
|
+
* Related TS Issue - https://github.com/microsoft/TypeScript/issues/29729
|
|
523
|
+
*
|
|
524
|
+
*/
|
|
525
|
+
type StringWithAutocomplete = string & Record<never, never>;
|
|
526
|
+
|
|
110
527
|
type ColorSchemeNames = 'dark' | 'light';
|
|
111
528
|
type ColorSchemeNamesInput = ColorSchemeNames | 'system';
|
|
112
529
|
|
|
530
|
+
type ColorSchemeModes = 'onDark' | 'onLight';
|
|
531
|
+
|
|
532
|
+
type TextTypes = 'muted' | 'normal' | 'placeholder' | 'subdued' | 'subtle';
|
|
533
|
+
|
|
534
|
+
type ColorContrastTypes = 'low' | 'high';
|
|
535
|
+
|
|
536
|
+
type Feedback = 'information' | 'negative' | 'neutral' | 'notice' | 'positive';
|
|
537
|
+
|
|
538
|
+
type ColorContrast = {
|
|
539
|
+
[K in ColorContrastTypes as `${Extract<K, string>}Contrast`]: string;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
type ActionStates = {
|
|
543
|
+
default: string;
|
|
544
|
+
hover: string;
|
|
545
|
+
focus: string;
|
|
546
|
+
active: string;
|
|
547
|
+
disabled: string;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
type LinkActionStates = ActionStates & {
|
|
551
|
+
visited: string;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
type ActionStatesWithContrast = {
|
|
555
|
+
default: ColorContrast;
|
|
556
|
+
hover: ColorContrast;
|
|
557
|
+
focus: ColorContrast;
|
|
558
|
+
active: ColorContrast;
|
|
559
|
+
disabled: ColorContrast;
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
type ActionVariants = {
|
|
563
|
+
primary: ActionStates;
|
|
564
|
+
secondary: ActionStates;
|
|
565
|
+
tertiary: ActionStates;
|
|
566
|
+
link: LinkActionStates;
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
type ActionVariantsWithContrast = {
|
|
570
|
+
primary: ActionStatesWithContrast;
|
|
571
|
+
secondary: ActionStatesWithContrast;
|
|
572
|
+
tertiary: ActionStatesWithContrast;
|
|
573
|
+
link: ActionStatesWithContrast;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
// export type ActionProperties = {
|
|
577
|
+
// background: ActionVariants;
|
|
578
|
+
// border: ActionVariants;
|
|
579
|
+
// text: ActionVariants;
|
|
580
|
+
// icon: ActionVariants;
|
|
581
|
+
// };
|
|
582
|
+
|
|
583
|
+
type FeedbackActions = {
|
|
584
|
+
background: Pick<ActionVariantsWithContrast, 'primary'>;
|
|
585
|
+
border: Pick<ActionVariantsWithContrast, 'primary'>;
|
|
586
|
+
text: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
|
|
587
|
+
icon: Pick<ActionVariantsWithContrast, 'link' | 'primary'>;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
type Colors = {
|
|
591
|
+
brand: {
|
|
592
|
+
primary: Record<300 | 400 | 500 | 600 | 700 | 800, string>;
|
|
593
|
+
secondary: Record<500, string>;
|
|
594
|
+
gray: Record<200 | 300 | 400 | 500 | 600 | 700 | 'a50' | 'a100', ColorContrast>;
|
|
595
|
+
};
|
|
596
|
+
feedback: {
|
|
597
|
+
background: Record<Feedback, ColorContrast>;
|
|
598
|
+
border: Record<Feedback, ColorContrast>;
|
|
599
|
+
text: Record<Feedback, ColorContrast>;
|
|
600
|
+
icon: Record<Feedback, ColorContrast>;
|
|
601
|
+
positive: {
|
|
602
|
+
action: FeedbackActions;
|
|
603
|
+
};
|
|
604
|
+
negative: {
|
|
605
|
+
action: FeedbackActions;
|
|
606
|
+
};
|
|
607
|
+
information: {
|
|
608
|
+
action: FeedbackActions;
|
|
609
|
+
};
|
|
610
|
+
notice: {
|
|
611
|
+
action: FeedbackActions;
|
|
612
|
+
};
|
|
613
|
+
neutral: {
|
|
614
|
+
action: FeedbackActions;
|
|
615
|
+
};
|
|
616
|
+
};
|
|
617
|
+
surface: {
|
|
618
|
+
background: Record<'level1' | 'level2' | 'level3', ColorContrast>;
|
|
619
|
+
border: Record<'normal' | 'subtle', ColorContrast>;
|
|
620
|
+
text: Record<TextTypes, ColorContrast>;
|
|
621
|
+
action: {
|
|
622
|
+
icon: ActionStatesWithContrast;
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
overlay: Record<'background', string>;
|
|
626
|
+
action: {
|
|
627
|
+
background: Omit<ActionVariants, 'link'>;
|
|
628
|
+
border: Omit<ActionVariants, 'link'>;
|
|
629
|
+
text: ActionVariants;
|
|
630
|
+
icon: ActionVariants;
|
|
631
|
+
};
|
|
632
|
+
badge: {
|
|
633
|
+
background: {
|
|
634
|
+
blue: ColorContrast;
|
|
635
|
+
};
|
|
636
|
+
border: {
|
|
637
|
+
blue: ColorContrast;
|
|
638
|
+
};
|
|
639
|
+
text: {
|
|
640
|
+
blue: ColorContrast;
|
|
641
|
+
};
|
|
642
|
+
icon: {
|
|
643
|
+
blue: ColorContrast;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
type ColorsWithModes = Record<ColorSchemeModes, Colors>;
|
|
649
|
+
|
|
650
|
+
type ThemeTokens = {
|
|
651
|
+
name: 'paymentTheme' | 'bankingTheme' | StringWithAutocomplete; // Can be used to watch over state changes between theme without watching over entire theme object
|
|
652
|
+
border: Border;
|
|
653
|
+
breakpoints: Breakpoints;
|
|
654
|
+
colors: ColorsWithModes;
|
|
655
|
+
motion: Motion;
|
|
656
|
+
elevation: ElevationWithColorModes;
|
|
657
|
+
spacing: Spacing;
|
|
658
|
+
typography: TypographyWithPlatforms;
|
|
659
|
+
};
|
|
660
|
+
|
|
113
661
|
declare const getColorScheme: (colorScheme?: ColorSchemeNamesInput) => ColorSchemeNames;
|
|
114
662
|
|
|
115
663
|
declare const getMediaQuery: ({ min, max }: {
|
|
@@ -239,4 +787,4 @@ declare const toTitleCase: (inputString: string) => string;
|
|
|
239
787
|
*/
|
|
240
788
|
declare function usePrevious<T>(value: T): MutableRefObject<T | undefined>['current'];
|
|
241
789
|
|
|
242
|
-
export { MakeSize, Platform, PlatformTypes, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, usePrevious };
|
|
790
|
+
export { MakeSize, Platform, PlatformTypes, ThemeContext, UseColorScheme, castNativeType, castWebType, getColorScheme, getMediaQuery, getOS, getPlatformType, isAndroid, isReactNative, makeBorderSize, makeMotionTime, makeSize, makeSpace, makeTypographySize, toTitleCase, useBreakpoint, useColorScheme, usePrevious, useTheme };
|