@razorpay/blade 8.0.0 → 8.2.2

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/CHANGELOG.md DELETED
@@ -1,1642 +0,0 @@
1
- # @razorpay/blade
2
-
3
- ## 8.0.0
4
-
5
- ### Major Changes
6
-
7
- - 9917a5cd: feat(Dropdown): Controlled Dropdown and Button Trigger
8
-
9
- - Adds API to seamlessly build controlled dropdown
10
- - Add DropdownButton component to trigger dropdown using Button
11
- - Removes `isDefaultSelected` from `ActionListItem` _(see migration guide below)_
12
-
13
- > **Warning**
14
- >
15
- > **Breaking change** for consumers who -
16
- >
17
- > - Use `isDefaultSelected` on `ActionListItem` component
18
- > - Use `onChange` on `SelectInput` (under some scenarios. Check migration guide below)
19
- >
20
- > Rest of the consumers can safely upgrade without any migration
21
-
22
- ### Migration Guide
23
-
24
- #### `isDefaultSelected` Migration
25
-
26
- We have removed `isDefaultSelected` from `<ActionListItem />` component. [Check out API decision](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Dropdown/_decisions/controlled-dropdown.md) for reasoning
27
-
28
- If you were using it as a workaround for controlled selection,
29
-
30
- - We now have a first class controlled selection support with `value` and `onChange` prop on `SelectInput`.
31
-
32
- Checkout CodeSandbox Example for new API - https://codesandbox.io/s/blade-controlled-select-vxg30b
33
-
34
- If you were using `isDefaultSelected` for default selections, you can now use `defaultValue` on SelectInput
35
-
36
- - Remove `isDefaultSelected` and use `defaultValue` on SelectInput. You can pass array of values to `defaultValue` in case of multiselect
37
- ```diff
38
- <Dropdown>
39
- <SelectInput
40
- label="Select City"
41
- + defaultValue="mumbai"
42
- />
43
- <DropdownOverlay>
44
- <ActionListItem
45
- title="Mumbai"
46
- value="mumbai"
47
- - isDefaultSelected
48
- />
49
- <ActionListItem title="Bangalore" value="bangalore" />
50
- </DropdownOverlay>
51
- </Dropdown>
52
- ```
53
-
54
- #### `onChange` on SelectInput Migration
55
-
56
- As a part of [bug fix](https://github.com/razorpay/blade/issues/1102), `onChange` will now **NOT** be called on initial render
57
- like it previously did. This will only require migration if you were earlier relying on `onChange` to set initial value.
58
-
59
- If you were relying on `onChange` to set initial value, you can now move those values to your `useState`'s initial value.
60
-
61
- ```tsx
62
- const Example = (): JSX.Element => {
63
- const [cities, setCities] = React.useState();
64
- return (
65
- <>
66
- <Dropdown>
67
- <SelectInput label="Cities" onChange={({values}) => setCities(values) } />
68
- <DropdownOverlay>
69
- <ActionListItem title="Mumbai" value="mumbai" />
70
- <ActionListItem title="Pune" value="pune" />
71
- </DropdownOverlay>
72
- </Dropdown>
73
- <Text>{cities}</Text>
74
- {/*
75
- In earlier versions, value of `cities` would've been `['']`
76
- (because onChange would've been called initially to set array with empty string value)
77
-
78
- Now it will output undefined (anything you pass in your useState) as the onChange wouldn't be called on initial render
79
- */}
80
- <>
81
- )
82
- }
83
- ```
84
-
85
- ## 7.2.2
86
-
87
- ### Patch Changes
88
-
89
- - 2a6b8c89: chore: add meta attribute `data-component-from-blade='true'` to native components
90
-
91
- ## 7.2.1
92
-
93
- ### Patch Changes
94
-
95
- - 40a16da7: fix(blade): BottomSheet body dynamic height
96
- - e0f80522: feat(blade): added bottomsheet component ids
97
-
98
- ## 7.2.0
99
-
100
- ### Minor Changes
101
-
102
- - 1333e756: feat(blade): added bottomsheet component
103
-
104
- > For react-native consumers make sure to [go through the installation guide](https://blade.razorpay.com/?path=/docs/guides-installation--page#-add-blade-to-your-application) on how to setup the peer dependencies
105
-
106
- <details>
107
- <summary>⚠️ Migration guide from prerelease version</summary>
108
-
109
- Update the imports:
110
-
111
- ```diff
112
- import {
113
- - BottomSheet_PRE_RELEASE,
114
- + BottomSheet,
115
- BottomSheetHeader,
116
- BottomSheetBody,
117
- BottomSheetFooter
118
- } from "@razorpay/blade/components"
119
- ```
120
-
121
- Changed Header Footer API:
122
-
123
- **Header**
124
-
125
- Prop changes:
126
-
127
- - Removed prefix/suffix props and added new props
128
-
129
- ```diff
130
- - title: string;
131
- + title?: string;
132
- subtitle?: string;
133
- - prefix?: React.ReactNode;
134
- - suffix?: React.ReactNode;
135
- + leading?: React.ReactNode;
136
- + trailing?: React.ReactNode;
137
- + titleSuffix?: React.ReactNode;
138
- + showBackButton?: boolean;
139
- + onBackButtonClick?: () => void;
140
- + closeButtonRef: React.MutableRefObject<any>;
141
- ```
142
-
143
- **Footer**
144
-
145
- Footer component now accepts JSX content
146
-
147
- Before:
148
-
149
- ```jsx
150
- <BottomSheetFooter
151
- trailing={{
152
- primary: {
153
- text: 'Hello',
154
- onClick: () => {},
155
- },
156
- secondary: {
157
- text: 'World',
158
- onClick: () => {},
159
- },
160
- }}
161
- />
162
- ```
163
-
164
- After:
165
-
166
- ```jsx
167
- <BottomSheetFooter>
168
- <Button isFullWidth variant="secondary" onClick={() => {}}>
169
- Hello
170
- </Button>
171
- <Button isFullWidth marginTop="spacing.5" onClick={() => {}}>
172
- World
173
- </Button>
174
- </BottomSheetFooter>
175
- ```
176
-
177
- </details>
178
-
179
- ## 7.1.3
180
-
181
- ### Patch Changes
182
-
183
- - 73011827: fix(BottomSheet): ensure that the BottomSheet's lower snappoint will have a buffer
184
- - f2130469: fix(blade): bottomsheet isOpen state, simplify isOpen logic & glue code
185
-
186
- Previously if users did not changed the isOpen state to false inside `onDismiss` the bottomsheet's internal state will still remain "open", but the bottomsheet would visually be hidden and the backdrop will still remain, this fixes the bug so that internally we won't modify the bottomsheet's position instead we will just call the `onDismiss`. [Check the loom](https://www.loom.com/share/f24fcb51b245431fbf1a0aeb53cea287) video here for more info.
187
-
188
- - 24d2a0b0: fix(cardFooter): alignment issue
189
-
190
- ## 7.1.2
191
-
192
- ### Patch Changes
193
-
194
- - 69ef5042: fix(blade): BottomSheet unable to scroll content
195
-
196
- ## 7.1.1
197
-
198
- ### Patch Changes
199
-
200
- - 85737340: fix(SelectInput): dropdown without label takes up margin space
201
-
202
- A dropdown without any label will now correctly take no extra space for the margin
203
-
204
- ## 7.1.0
205
-
206
- ### Minor Changes
207
-
208
- - 85289118: feat(blade): BottomSheet prerelease
209
-
210
- > **Warning**
211
- >
212
- > The final `BottomSheet` API isn't final and subjected to change as we work on stabilizing the component.
213
-
214
- ## 7.0.4
215
-
216
- ### Patch Changes
217
-
218
- - e3d5321c: perf(blade): integrate SectionList in ActionList
219
-
220
- ## 7.0.3
221
-
222
- ### Patch Changes
223
-
224
- - 6f7ec83f: fix(Box): add correct prop types in react native Box
225
- - abc4c156: fix(colors): incorrect value of ashGrayLight.1200
226
-
227
- There was a typo earlier in the value of the token.
228
-
229
- - fce1c767: feat(TextInput): add note on `type="number"` attribute
230
- - c0701725: fix: remove internal BaseBox export (no change for consumers)
231
-
232
- ## 7.0.2
233
-
234
- ### Patch Changes
235
-
236
- - 71b4a85b: feat: add `htmlTitle` prop support for Link component on web
237
-
238
- ## 7.0.1
239
-
240
- ### Patch Changes
241
-
242
- - 0f6e2ad7: fix: ref breakage on react native
243
- - 9963a7be: feat(package.json): add "main" field to package.json
244
-
245
- ## 7.0.0
246
-
247
- ### Major Changes
248
-
249
- - 5248ea66: feat(Typography): streamline typography scale
250
-
251
- > **Warning**
252
- >
253
- > Breaking Change!
254
- > This is a breaking change for typography components and lineHeight scale
255
- >
256
- > We have written codemod to ease this process so please follow the [migration guide thoroughly](#breaking-changes)
257
-
258
- ### Component Changes:
259
-
260
- - Title:
261
- - Added `xlarge` size
262
- - Text:
263
- - Added `large` size
264
- - Link:
265
- - Added `large` size
266
- - Code:
267
- - Added `weight=bold`
268
-
269
- ### Breaking Changes:
270
-
271
- - Title:
272
- - Replace all `large` size variants to `xlarge`
273
-
274
- ```diff
275
- - <Title size="large">hello world</Title>
276
- + <Title size="xlarge">hello world</Title>
277
- ```
278
-
279
- ***
280
-
281
- ### Line-height scale changes
282
-
283
- New scale has been changed to use numbered values for more flexibility, to read more about the changes [check this doc](https://docs.google.com/document/d/16j8dIKuQF9GjDgkhkZwnokVGNeoK7R-7zzIXHCgvveA/edit).
284
-
285
- #### **Migration guide:**
286
-
287
- Replace old named tokens to corresponding numbered values:
288
-
289
- For example:
290
-
291
- ```diff
292
- - theme.typography.lineHeights.s
293
- + theme.typography.lineHeights[50]
294
- ```
295
-
296
- **Old vs New mappings:**
297
-
298
- | old | new |
299
- | --- | --- |
300
- | s | 50 |
301
- | m | 50 |
302
- | l | 100 |
303
- | xl | 200 |
304
- | 2xl | 300 |
305
- | 3xl | 400 |
306
- | 4xl | 600 |
307
- | 5xl | 700 |
308
- | 6xl | 800 |
309
-
310
- #### **Migrate with Codemod:**
311
-
312
- To change all instances of `theme.typography.lineHeights` to the new scale automatically use this codemod:
313
-
314
- **Step1:** Install this version of blade
315
-
316
- **Step2:** Run the codemod with the following command
317
-
318
- > Checkout [jscodeshift docs](https://github.com/facebook/jscodeshift) for further cli usage help.
319
-
320
- ```sh
321
- npx jscodeshift ./YOUR_DIR --extensions=tsx,ts,jsx,js -t ./node_modules/@razorpay/blade/codemods/migrate-typography/transformers/migrate-typography.ts --ignore-pattern="**/node_modules/**"
322
- ```
323
-
324
- > **Note**
325
- >
326
- > This codemod will cover 80% of the usecases, but it might miss certain edge cases, it is advised to thoroughly test & check the code to ensure nothing is missed.
327
-
328
- ## 6.7.0
329
-
330
- ### Minor Changes
331
-
332
- - 0c8e5f1b: feat: add `Amount` component
333
-
334
- ### Usage
335
-
336
- ```tsx
337
- <Amount value={10000} />
338
- ```
339
-
340
- ## 6.6.3
341
-
342
- ### Patch Changes
343
-
344
- - 0d7bb723: fix(blade): FileTextIcon alignment
345
- - b62358cb: perf: improve dropdown/actionlist performance
346
-
347
- ## 6.6.2
348
-
349
- ### Patch Changes
350
-
351
- - c7c66051: fix: ListItemLink alignment
352
-
353
- ## 6.6.1
354
-
355
- ### Patch Changes
356
-
357
- - fe89e6f6: fix: tree-shaking in blade components
358
- - 7817c9e3: feat(Box): add different types for `display` on react native
359
- - c6512ba0: fix(Alert, Card): set `box-sizing` as `border-box` for Alert and Card
360
-
361
- ## 6.6.0
362
-
363
- ### Minor Changes
364
-
365
- - 5863f939: feat(OTPInput): add `onFocus` & `onBlur` props
366
- - 75daaa3c: feat(theme): add `name` property in `theme` to watch on theme changes
367
-
368
- ### Patch Changes
369
-
370
- - 6a8524ab: feat(Link): add `hitSlop` support for native
371
-
372
- ## 6.5.2
373
-
374
- ### Patch Changes
375
-
376
- - 2700667f: fix(SelectInput): call user passed onBlur callback
377
- - 3855a583: fix(Card): CardHeader title alignment when subtitle is not present
378
-
379
- ## 6.5.1
380
-
381
- ### Patch Changes
382
-
383
- - 86cd05a6: chore(blade): update meta constant of Box
384
-
385
- ## 6.5.0
386
-
387
- ### Minor Changes
388
-
389
- - a4be1b06: feat(Layout Primitives): Add `Box` Component and Styled Props to Blade Components
390
-
391
- Documentation: https://blade.razorpay.com/?path=/docs/components-layout-primitives-box-layout-primitives-tutorial--page
392
-
393
- **Breakpoint Token Changes**
394
-
395
- `max` breakpoint is removed as it wasn't used and had same value as `xl`.
396
- Through our audit, we didn't find any usage of this token. If you happen to use this somewhere, you can rename `breakpoints.max` to `breakpoints.xl`
397
-
398
- - 2c7034b7: feat(Input): add onSubmit prop on BaseInput, TextInput, TextArea, & PasswordInput for react-native
399
-
400
- ## 6.4.0
401
-
402
- ### Minor Changes
403
-
404
- - 4145d553: feat: add `testID` prop to all components
405
- - a7826b0b: feat(Input): add `autoCapitalize` support to `BaseInput`, `TextInput` & `PasswordInput`
406
- - bdd74d7a: feat(Text): add `textAlign` prop
407
-
408
- ### Patch Changes
409
-
410
- - da4489b3: fix: lodash tree shaking to reduce effective bundle-size.
411
-
412
- ## 6.3.0
413
-
414
- ### Minor Changes
415
-
416
- - a2518742: feat(icons): add BulkPayoutsIcon
417
-
418
- ## 6.2.3
419
-
420
- ### Patch Changes
421
-
422
- - cbb1424b: fix: change import to default in package exports
423
-
424
- Jest does not support the "import" condition in exports. This was causing tests to fail for Blade consumers. Changed "import" to "default" which is supported by all tools. Since Blade is not exporting a dual package, we don't need the "import" condition.
425
-
426
- ## 6.2.2
427
-
428
- ### Patch Changes
429
-
430
- - 559d97d9: feat: support string array in children
431
-
432
- Users can now use dynamic variables inside children and don't have to wrap it around with string literals
433
-
434
- ```jsx
435
- <Button onClick={}>{someVariable} hello</Button>
436
- ```
437
-
438
- ## 6.2.1
439
-
440
- ### Patch Changes
441
-
442
- - 7016c215: fix(Dropdown): infinite render onChange, positioning in flex container
443
-
444
- ## 6.2.0
445
-
446
- ### Minor Changes
447
-
448
- - bb2f1561: feat(Dropdown): Add `Dropdown`, `Select`, `ActionList`.
449
-
450
- Check out [Dropdown Story](https://blade.razorpay.com/?path=/docs/components-dropdown-with-select) for usage
451
-
452
- ### Patch Changes
453
-
454
- - 505ca975: fix(checkbox): fixed screen reader styles
455
-
456
- Fixed a bug where if we have lots of checkboxes in a small overflowed container the browser is trying to jump to the hidden inputs which is causing unexpected jumps in the scroll.
457
-
458
- ## 6.1.0
459
-
460
- ### Minor Changes
461
-
462
- - aff735ba: feat: add `List`, `ListItem`, `ListItemLink` & `ListItemCode` components
463
-
464
- ## 6.0.5
465
-
466
- ### Patch Changes
467
-
468
- - 38e8e6d0: chore(OTPInput): add `autoCompleteSuggestionType` prop and disable password manager with `isMasked`
469
-
470
- We wanted to disable the password managers for OTPInput when `isMasked` is set. The straightforward way to do this is set autocomplete='off' (i.e autoCompleteSuggestionType='none'). The issue with autocomplete is that its not an enforcement but a suggestion to the browser to follow. Safari mostly adheres to it but Chrome and Firefox ignores it and shows the password managers anyway. We decided on a workaround to unset `type` on first render and set it to `password` once a value is entered. This way the password managers won't make any suggestions when the user is on an empty OTP input field.
471
-
472
- ## 6.0.4
473
-
474
- ### Patch Changes
475
-
476
- - 26ffc564: fix: add types field to package exports for ESM TypeScript projects
477
-
478
- ## 6.0.3
479
-
480
- ### Patch Changes
481
-
482
- - c95e814a: chore(blade): fix dependabot alerts
483
- - d2cfab2d: fix(blade): checkbox icon wrapper position
484
-
485
- Fixed a bug in checkbox where the checkbox icon was flaoting outside it's wrapper because we've added `position: absolute` in the FadeIn animation component but forgot to add `position: relative` in the parent wrapper.
486
-
487
- ## 6.0.2
488
-
489
- ### Patch Changes
490
-
491
- - ba5ec1ac: fix: mark react-native peerDependencies as optional
492
- - 4a178a79: fix(Alert): color of title and description
493
-
494
- - The color of title and description will look slightly subtle now to match the current designs.
495
- - Internally uses the `subtle` type correctly now to fix a discrepancy in color for title and description.
496
-
497
- ## 6.0.1
498
-
499
- ### Patch Changes
500
-
501
- - 62a98bb1: fix(blade): update BaseInput background color
502
-
503
- ## 6.0.0
504
-
505
- ### Major Changes
506
-
507
- - 980bc038: fix(Alert)!: fix typo in prop `isDismissible`
508
-
509
- > **Warning**
510
- >
511
- > Breaking change. Update prop `isDismissable` to `isDismissible`.
512
-
513
- ### Migration guide
514
-
515
- Find and replace:
516
-
517
- ```diff
518
- <Alert
519
- - isDismissable
520
- + isDismissible
521
- />
522
- ```
523
-
524
- - 5f7e4876: feat(blade): added all icons from figma
525
-
526
- **Breaking Changes:**
527
-
528
- - Renamed `RefreshLeft` icon to `Refresh`
529
-
530
- ### Minor Changes
531
-
532
- - 82d75b71: chore(blade): added new icons
533
- - 29238f1e: feat(blade): added ref support for input components
534
-
535
- ## 5.5.1
536
-
537
- ### Patch Changes
538
-
539
- - 735e370: fix(blade): update peerDependencies to support react v18
540
-
541
- ## 5.5.0
542
-
543
- ### Minor Changes
544
-
545
- - a094736: feat: expose `onFocus` on `TextInput` and `TextArea`
546
- - 2c2841a: added transaction icon
547
- - 46425d3: feat(blade): add ClockIcon
548
- - 1dd920e: feat(Icons): add BankIcon
549
- - 227be3d: added tag, shuffle, user, book, and settlements icons
550
- - e64d7cc: chore: design changes for Badge, Counter, Spinner
551
-
552
- ### Patch Changes
553
-
554
- - ba16503: fix(blade): TextInput clear button state on initial render
555
-
556
- ## 5.4.3
557
-
558
- ### Patch Changes
559
-
560
- - e6c3ea9: fix(blade): restrict childrens in Card component
561
-
562
- ## 5.4.2
563
-
564
- ### Patch Changes
565
-
566
- - da470b0: fix: remove `maxWidth` from Badge
567
-
568
- ## 5.4.1
569
-
570
- ### Patch Changes
571
-
572
- - 7eb6e4c: feat(Code): Use alpha 50 token in Code component's background
573
-
574
- ## 5.4.0
575
-
576
- ### Minor Changes
577
-
578
- - 5c8005f: feat: add `ProgressBar` component
579
-
580
- ## 5.3.0
581
-
582
- ### Minor Changes
583
-
584
- - 26baa81: feat(blade): added Card component
585
-
586
- ## 5.2.1
587
-
588
- ### Patch Changes
589
-
590
- - 9966931: chore: fix dom nesting in form label component
591
- - e660831: fix: change acceptable BaseInput `type` from `numeric` to `number`
592
-
593
- ## 5.2.0
594
-
595
- ### Minor Changes
596
-
597
- - d03de10: feat(Alert): update `isFullWidth` to make inline borderless alerts on desktop
598
-
599
- > **Warning**
600
- >
601
- > `isBorderless` prop is removed and its usage is now replaced by `isFullWidth`. The layout is updated to match the designs and is now centered on desktop resolutions.
602
-
603
- ### Steps for migration:
604
-
605
- ```diff
606
- <Alert
607
- - isBorderless
608
- + isFullWidth
609
- />
610
- ```
611
-
612
- ## 5.1.5
613
-
614
- ### Patch Changes
615
-
616
- - 756f4b4: feat: allow masked otp input
617
-
618
- `OTPInput` now supports an `isMasked` prop
619
-
620
- ## 5.1.4
621
-
622
- ### Patch Changes
623
-
624
- - 71f274e: fix(Checkbox): allow Checkbox to accept `childern` prop of type `React.ReactNode`
625
-
626
- ## 5.1.3
627
-
628
- ### Patch Changes
629
-
630
- - af9bdc9: fix(Alert): responsive design alignment
631
-
632
- ## 5.1.2
633
-
634
- ### Patch Changes
635
-
636
- - bd0b675: chore(blade): added blade component data attributes
637
-
638
- ## 5.1.1
639
-
640
- ### Patch Changes
641
-
642
- - 5a6b980: feat: add Mail icon
643
-
644
- ## 5.1.0
645
-
646
- ### Minor Changes
647
-
648
- - d4b981e: fix: show `Spinner` on `TextInput` when `isLoading=true`
649
- - Adds spinner when `isLoading: true` is passed to `TextInput`. This was a long pending TODO
650
- - Update Spinner sizes after the design was updated \* This doesn't need any code mod since there are 9 instances of spinner being used with default variant i.e medium
651
-
652
- ## 5.0.1
653
-
654
- ### Patch Changes
655
-
656
- - 96cf25f: feat: add new icons (lock, settings, file-text, users, slash)
657
-
658
- ## 5.0.0
659
-
660
- ### Major Changes
661
-
662
- - fc2a3bf:
663
-
664
- > **Warning**
665
- >
666
- > This is a breaking change for `Alert` component. The UI is updated to match the designs.
667
-
668
- feat(Alert): design revamp
669
-
670
- - `Alert` is updated to match the new designs
671
- - Bordered variant is now more compact and smaller in size
672
- - A new `neutral` intent is added. This is the new default if you haven't passed any `intent` explicitly.
673
-
674
- ### Migration guide for consumers
675
-
676
- - Earlier the default `intent` was `information`, this is now updated to `neutral`. If you were earlier using alerts without explicitly passing `intent` you should update that to continue using `information` as intent:
677
-
678
- ```diff
679
- <Alert
680
- + intent="information"
681
- />
682
- ```
683
-
684
- ### Patch Changes
685
-
686
- - bb170bb: fix: set input type='text' when type='search' passed
687
-
688
- ## 4.0.0
689
-
690
- ### Major Changes
691
-
692
- - d747de4: chore: Badge design changes
693
-
694
- - Adds a new small size
695
- - Bumps existing small & medium to medium & large respectively
696
- - Horizontal padding changes in the large size
697
-
698
- ### Migration Guide for Badge Consumers
699
-
700
- 1. For existing `small` size badge, bump the size from `small` to `medium`
701
-
702
- ```diff
703
- - <Badge size='small'>...</Badge>
704
- + <Badge size='medium'>...</Badge>
705
- ```
706
-
707
- 2. For existing `medium` size badge, bump the size from `medium` to `large`
708
-
709
- ```diff
710
- - <Badge size='medium'>...</Badge>
711
- + <Badge size='large'>...</Badge>
712
- ```
713
-
714
- 3. For existing badge with no `size` specified, add `size='large'` since default size is `medium`
715
- > Note: The horizontal padding is changed from `8px` to `12px` for the new `large` size which makes it visually bigger than the existing `medium` size
716
-
717
- ```diff
718
- - <Badge>...</Badge>
719
- + <Badge size='large'>...</Badge>
720
- ```
721
-
722
- ## 3.8.0
723
-
724
- ### Minor Changes
725
-
726
- - 32c1f05: feat(Counter): design changes
727
-
728
- - Added small variant in Counter
729
- - Fixed italic font
730
-
731
- ## 3.7.1
732
-
733
- ### Patch Changes
734
-
735
- - 03bb818: feat(tokens): add new tokens
736
- - updates color tokens of banking theme to match the designs
737
- - 002e0a2: feat(tokens): add new tokens
738
- - Updates tokens for payment theme to match the designs
739
- - 66f473e: fix: remove aria-hidden for checkbox and radio
740
-
741
- ## 3.7.0
742
-
743
- ### Minor Changes
744
-
745
- - 67e5059: feat(Indicator): add Indicator component
746
-
747
- ## 3.6.2
748
-
749
- ### Patch Changes
750
-
751
- - 63c950a: feat(IconButton): export IconButton
752
- - Adds a new `IconButton` component useful for making transparent icon only buttons
753
-
754
- ## 3.6.1
755
-
756
- ### Patch Changes
757
-
758
- - add9b3e: fix(Typography): inherit `text-align` property from parent in Typography components
759
-
760
- ## 3.6.0
761
-
762
- ### Minor Changes
763
-
764
- - 0f4df3a: feat(blade): added counter component
765
- - c5b28bc: feat(tokens): add new tokens to neutral palette
766
-
767
- ## 3.5.3
768
-
769
- ### Patch Changes
770
-
771
- - 92cfa80: fix(Alert): throw error if `secondaryAction` is defined without `primaryAction`
772
-
773
- ## 3.5.2
774
-
775
- ### Patch Changes
776
-
777
- - ffe9872: fix: `@babel-runtime` issues when importing in codesandbox and vite
778
-
779
- ## 3.5.1
780
-
781
- ### Patch Changes
782
-
783
- - dea879d: fix(IconButton): add `type="button"` to stop form submission
784
-
785
- ## 3.5.0
786
-
787
- ### Minor Changes
788
-
789
- - 8dc131d: feat(blade): added `small` variant in Checkbox/Radio
790
-
791
- ## 3.4.2
792
-
793
- ### Patch Changes
794
-
795
- - 48c36af: feat: add README to npm
796
-
797
- ## 3.4.1
798
-
799
- ### Patch Changes
800
-
801
- - 49894f2: feat: adding Link icon
802
-
803
- ## 3.4.0
804
-
805
- ### Minor Changes
806
-
807
- - 6429d93: feat(Link): add `size` prop and support for `small` size
808
-
809
- > **Note**
810
- >
811
- > Icons in links are slightly bumped up now to match the designs
812
-
813
- <img width="379" alt="image" src="https://user-images.githubusercontent.com/6682655/196698626-e73dcc07-3d35-49e1-8ead-95c5826f3c41.png">
814
-
815
- ## 3.3.0
816
-
817
- ### Minor Changes
818
-
819
- - 37c00c0: feat: publish `@razorpay/blade` package on NPM
820
-
821
- _No changes are required for consumer. We will be publishing on both, github package registry and npm._
822
-
823
- ## 3.2.0
824
-
825
- ### Minor Changes
826
-
827
- - f7e8941: added RotateCounterClockWiseIcon, TrendingUpIcon, TrendingDownIcon, ExternalLinkIcon, HelpCircleIcon
828
-
829
- ## 3.1.6
830
-
831
- ### Patch Changes
832
-
833
- - 66d3184: Update few tokens value which was typo on figma
834
-
835
- ## 3.1.5
836
-
837
- ### Patch Changes
838
-
839
- - a539fe5: feat(tokens): add new tokens
840
-
841
- ## 3.1.4
842
-
843
- ### Patch Changes
844
-
845
- - f0b901d: chore: remove border from Badge component
846
-
847
- ## 3.1.3
848
-
849
- ### Patch Changes
850
-
851
- - 2576ce3: fix(link): add type prop for button variant
852
-
853
- ## 3.1.2
854
-
855
- ### Patch Changes
856
-
857
- - ba0c74d: fix: use the correct maxWidth for OTPInput
858
-
859
- ## 3.1.1
860
-
861
- ### Patch Changes
862
-
863
- - aee7e57: feat(Icons): add MinusIcon
864
-
865
- ## 3.1.0
866
-
867
- ### Minor Changes
868
-
869
- - c3d9d2f: feat: add OTPInput component
870
-
871
- ## 3.0.0
872
-
873
- ### Major Changes
874
-
875
- - 3aebc58: feat(Typography): make `size` prop consistent for `Heading`, `Title`, and `Text`
876
-
877
- > **Warning**
878
- >
879
- > Breaking Change!
880
- > This is a breaking change for apps that are using `Title` or `Heading` component from blade. Rest of the apps can upgrade without any migrations.
881
-
882
- #### Migration
883
-
884
- _**Tip:** If you're using TypeScript, run `yarn tsc` and that should throw errors wherever a change is required._
885
-
886
- 1. **`<Title />`:** Rename `variant` prop to `size` in Title
887
-
888
- ```diff
889
- - <Title variant="small">Some Title</Title>
890
- + <Title size="small">Some Title</Title>
891
- ```
892
-
893
- 2. **`<Heading />`:** Rename `variant` prop to `size` if the value is `small`, `medium,` or `large`. No change is required on `variant="subheading"`.
894
-
895
- ```diff
896
- <Heading variant="subheading">Nothing changes here</Heading> // No change here
897
-
898
- - <Heading variant="medium">Medium Heading</Heading>
899
- + <Heading size="medium">Medium Heading</Heading>
900
- ```
901
-
902
- ##### Edge Cases
903
-
904
- Make sure to follow migration on new component if `Title` or `Heading` from blade is overriden with styled-components.
905
-
906
- ```diff
907
- const MyTitle = styled(Title)`
908
- // some styles
909
- `
910
-
911
- - <MyTitle variant="large" />
912
- + <MyTitle size="large" />
913
- ```
914
-
915
- - e16c154: feat(PasswordInput)!: rename from `PasswordField` to `PasswordInput`
916
-
917
- #### Migration
918
-
919
- > **Warning**
920
- >
921
- > Breaking change!
922
-
923
- Rename occurences of `PasswordField` to `PasswordInput`, no changes in the API.
924
-
925
- ```diff
926
- - PasswordField
927
- + PasswordInput
928
- ```
929
-
930
- ### Minor Changes
931
-
932
- - eeba339: feat(Code): add `<Code />` component :shipit:
933
-
934
- ## 2.5.1
935
-
936
- ### Patch Changes
937
-
938
- - 0ce8390: fix(BaseInput): use cursor not-allowed for disabled inputs
939
-
940
- ## 2.5.0
941
-
942
- ### Minor Changes
943
-
944
- - d0017cd: feat(PasswordField): add final export :tada:
945
- - adds a new `PasswordField` component
946
-
947
- ## 2.4.0
948
-
949
- ### Minor Changes
950
-
951
- - bf92637: feat(blade): Improve platform types with TS 4.7
952
-
953
- ### Added support for platform dependant types
954
-
955
- Migration Steps
956
-
957
- 1. Upgrade to TypeScript 4.7+
958
- 2. In `tsconfig.json` add `moduleSuffix: ['.web', '']` or `moduleSuffix: ['.native', '']` (depending on the platform)
959
-
960
- ```js
961
- {
962
- "compilerOptions": {
963
- // For react-native use `.native`
964
- // For web use `.web` extension
965
- "moduleSuffixes": [".web", ""]
966
- }
967
- }
968
- ```
969
-
970
- > **Note**:
971
- > if you are on <TS 4.7 or don't specify the `moduleSuffixes` blade will fallback to resolving `web` types
972
-
973
- ## 2.3.0
974
-
975
- ### Minor Changes
976
-
977
- - 887cd11: feat(blade): added TextArea component
978
-
979
- ## 2.2.2
980
-
981
- ### Patch Changes
982
-
983
- - a8c5c08: tests: add tests for `TextInput`
984
- fix: render clear button on mount when the `defaultValue` or `value` is passed
985
-
986
- ## 2.2.1
987
-
988
- ### Patch Changes
989
-
990
- - 4b6bfda: fix: update spinner easing
991
-
992
- ## 2.2.0
993
-
994
- ### Minor Changes
995
-
996
- - 7c272be: feat: add `Spinner` component
997
- - Also adds an internal `BaseSpinner` component
998
-
999
- ## 2.1.0
1000
-
1001
- ### Minor Changes
1002
-
1003
- - a6bf780: feat(TextInput): add TextInput Field
1004
-
1005
- ### This release publishes **`TextField`** Input
1006
-
1007
- #### [Figma Link](https://www.figma.com/file/jubmQL9Z8V7881ayUD95ps/Blade---Payment-Light?node-id=10953%3A210737)
1008
-
1009
- #### Capabilities
1010
-
1011
- - Support for various `type` of TextInput i.e `'text' | 'telephone' | 'email' | 'url' | 'numeric' | 'search'`
1012
- - Automatically decide `keyboardType`, `keyboardReturnKeyType`, `autoCompleteSuggestionType` based on `type` attribute alone
1013
-
1014
- ![image](https://user-images.githubusercontent.com/11384858/188391913-d45e40b4-1b92-4fab-8bf8-8d49891929f8.png)
1015
-
1016
- - Max characters to be accepted by the input field which will in turn also render a counter
1017
- ![image](https://user-images.githubusercontent.com/11384858/188390436-2854807d-5fb0-42de-8171-3ba61be4b9f6.png)
1018
-
1019
- - Clear the content of the input field with the help of a clear button
1020
- ![image](https://user-images.githubusercontent.com/11384858/188391183-8e262200-7424-4a80-a5fe-1c7166be26ce.png)
1021
-
1022
- - Attach `prefix` and `suffix` to the input field
1023
- - Fully Accessible
1024
-
1025
- ### Patch Changes
1026
-
1027
- - a8c7620: ## Internal changes
1028
-
1029
- tests(BaseInput): add web tests and fix onBlur
1030
-
1031
- - Adds `onBlur`
1032
-
1033
- - 1417e90: changed native text-input helptext color
1034
-
1035
- ## 2.0.0
1036
-
1037
- ### Major Changes
1038
-
1039
- - cc4355a: feat(blade): added 2px spacing token
1040
-
1041
- #### Breaking changes
1042
-
1043
- > **Note**
1044
- >
1045
- > This breaking change affects you only if you're using the tokens directly somewhere. If you're only using the components then nothing needs to be updated at your end.
1046
-
1047
- - Added 2px token, thus all spacing tokens have shifted by 1 step.
1048
-
1049
- #### Migration steps
1050
-
1051
- Shift every spacing token other than the first one (`0th` index) by +1
1052
-
1053
- ```diff
1054
- - <div style={{ margin: theme.spacing[1] }} />
1055
- + <div style={{ margin: theme.spacing[2] }} />
1056
- ```
1057
-
1058
- ### Patch Changes
1059
-
1060
- - a402ef1: feat(icons): add `RefreshLeft` icon
1061
-
1062
- ## 1.1.0
1063
-
1064
- ### Minor Changes
1065
-
1066
- - 5f1033c: feat: add `Alert` component :tada:
1067
-
1068
- ### Patch Changes
1069
-
1070
- - cd5f61f: feat(tokens): add new tokens
1071
- - e8d932a: feat: add `blue` variant to `Badge`
1072
- - acfd566: feat(icons): arrow up and arrow left
1073
-
1074
- ## 1.0.2
1075
-
1076
- ### Patch Changes
1077
-
1078
- - 771981c: fix(blade): radio & checkbox icon alignment
1079
-
1080
- ## 1.0.1
1081
-
1082
- ### Patch Changes
1083
-
1084
- - ef7f459: fix: font weight of `Link` component
1085
-
1086
- ## 1.0.0
1087
-
1088
- ### Major Changes
1089
-
1090
- - 51a6787: feat: add `Radio` & `RadioGroup` component
1091
-
1092
- ## ⚠️ Breaking change for `Checkbox`
1093
-
1094
- - We've renamed the `neccessityIndicator` prop to `necessityIndicator` to fix a spelling error
1095
-
1096
- - 65834be: fix: icon sizes for `Icon`, `IconButton`, `Button`, `Link` & `Spinner` components
1097
-
1098
- ## ⚠️ Breaking changes for `Icon`
1099
-
1100
- **❗️This version introduces a breaking change for the `Icon` component's `size` prop**
1101
-
1102
- Earlier, the `size` prop had the following size to pixel mapping:
1103
-
1104
- - **xxsmall:** 10px
1105
- - **xsmall**: 12px
1106
- - **small**: 16px
1107
- - **medium**: 20px
1108
- - **large**: 24px
1109
- - **xlarge**: 32px
1110
-
1111
- Now, the correct `size` prop will have the following size to pixel mapping:
1112
-
1113
- - **xsmall**: 8px
1114
- - **small**: 12px
1115
- - **medium**: 16px
1116
- - **large**: 20px
1117
- - **xlarge**: 24px
1118
- - **2xlarge**: 32px
1119
-
1120
- > ⚠️ `xxsmall` is not an accepted value anymore. Instead, we have a new acceptable value of `2xlarge`.
1121
-
1122
- ### Minor Changes
1123
-
1124
- - 61a17fe: feat: add `Badge` component
1125
-
1126
- ## 0.13.6
1127
-
1128
- ### Patch Changes
1129
-
1130
- - b365464: fix: button spinner layout
1131
- - f3abfbe: feat(Icons): add new icons
1132
-
1133
- ## 0.13.5
1134
-
1135
- ### Patch Changes
1136
-
1137
- - 7909d7c: fix(blade): Checkbox design changes
1138
-
1139
- ## 0.13.4
1140
-
1141
- ### Patch Changes
1142
-
1143
- - 2778973: chore: add appropriate types for onClick of Button & BaseButton
1144
-
1145
- ## 0.13.3
1146
-
1147
- ### Patch Changes
1148
-
1149
- - 3ea6d6c: fix(blade): fixes checkbox helptext and errortext alignment for individual checkboxes
1150
-
1151
- ## 0.13.2
1152
-
1153
- ### Patch Changes
1154
-
1155
- - 17b2c71: fix: button styling for native
1156
-
1157
- ## 0.13.1
1158
-
1159
- ### Patch Changes
1160
-
1161
- - 985f82a: refactor: use Box component on BaseButton
1162
-
1163
- ## 0.13.0
1164
-
1165
- ### Minor Changes
1166
-
1167
- - b8cc7df: feat: add checkbox component
1168
- - eb65c30: feat: add support for css theme variables
1169
- - f61675e: feat: add `Link` & `BaseLink` components
1170
-
1171
- ## 0.12.0
1172
-
1173
- ### Minor Changes
1174
-
1175
- - 381e9c7: fix(Blade): add `size` prop to Text component and update tokens
1176
-
1177
- This PR updates the typography tokens scale for mobile devices to create better visual hierarchy which we received as feedback from other teams as well.
1178
-
1179
- It also adds a new `size` prop to `Text` component for `variant='body'`
1180
-
1181
- ## 0.11.4
1182
-
1183
- ### Patch Changes
1184
-
1185
- - 66f9b24: feat(tokens): add new tokens
1186
-
1187
- ## 0.11.3
1188
-
1189
- ### Patch Changes
1190
-
1191
- - e0a2631: feat: add Download, Edit, History, Plus, Pause, & Trash icons
1192
-
1193
- ## 0.11.2
1194
-
1195
- ### Patch Changes
1196
-
1197
- - b2b86b4: fix: SkipNav export
1198
-
1199
- ## 0.11.1
1200
-
1201
- ### Patch Changes
1202
-
1203
- - 873676f: fix: button export to components
1204
-
1205
- ## 0.11.0
1206
-
1207
- ### Minor Changes
1208
-
1209
- - 5d022f4: feat: add `Button` component
1210
-
1211
- ### Patch Changes
1212
-
1213
- - cddd298: chore: update currency icons
1214
-
1215
- ## 0.10.1
1216
-
1217
- ### Patch Changes
1218
-
1219
- - 7b9baf7: fix(blade): broken gray color types in theme.d.ts file
1220
-
1221
- ## 0.10.0
1222
-
1223
- ### Minor Changes
1224
-
1225
- - a800a96: feat(blade): added makeAccessible function
1226
-
1227
- makeAccessible function is a compatibility layer between web & native for accessibility props
1228
- More [info in RFC](https://github.com/razorpay/blade/blob/master/rfcs/2022-04-09-accessibility.md#platform-specific-implementation--5)
1229
-
1230
- ### Patch Changes
1231
-
1232
- - a800a96: fix(blade): added aria hidden in icons
1233
-
1234
- ## 0.9.0
1235
-
1236
- ### Minor Changes
1237
-
1238
- - 0c3a951: feat(blade): Added SkipNav component
1239
-
1240
- Learn more about [Skip Navigations in Accessibility RFC](https://github.com/razorpay/blade/blob/master/rfcs/2022-04-09-accessibility.md#skip-navigations)
1241
-
1242
- - 5c750bb: feat(blade): add VisuallyHidden component
1243
-
1244
- This component is used specifically when you want to hide certain things visually for people who are not visually impaired but also want to make your content is accessible to visually impaired people via assistive technologies.
1245
-
1246
- You can play around with it on [Storybook](https://master--61c19ee8d3d282003ac1d81c.chromatic.com/?path=/docs/components-accessibility-visuallyhidden--visually-hidden)
1247
-
1248
- ## 0.8.0
1249
-
1250
- ### Minor Changes
1251
-
1252
- - 002fce2: fix: icon colors & remove `surface.action.icon.link.*` colors from `theme`
1253
-
1254
- ## Breaking Changes
1255
-
1256
- - Remove the following tokens from `paymentTheme` & `bankingTheme` theme of Blade:
1257
-
1258
- - `colors.surface.action.icon.link.default.lowContrast`
1259
- - `colors.surface.action.icon.link.default.highContrast`
1260
- - `colors.surface.action.icon.link.hover.lowContrast`
1261
- - `colors.surface.action.icon.link.hover.highContrast`
1262
- - `colors.surface.action.icon.link.focus.lowContrast`
1263
- - `colors.surface.action.icon.link.focus.highContrast`
1264
- - `colors.surface.action.icon.link.active.lowContrast`
1265
- - `colors.surface.action.icon.link.active.highContrast`
1266
- - `colors.surface.action.icon.link.disabled.lowContrast`
1267
- - `colors.surface.action.icon.link.disabled.highContrast`
1268
-
1269
- If you are using any of these tokens, they will no longer be available in your `theme`. Make sure you remove usage of these tokens from your codebase.
1270
-
1271
- ## Fixes
1272
-
1273
- 1. Fix incorrect Icon colors that were supported & suggested by TypeScript
1274
-
1275
- ## 0.7.2
1276
-
1277
- ### Patch Changes
1278
-
1279
- - 9f0bb83: feat: add Dollar, ChevronUp, ChevronDown, ChevronLeft, ChevronRight, Eye, EyeOff, Close icons
1280
-
1281
- ## 0.7.1
1282
-
1283
- ### Patch Changes
1284
-
1285
- - 25a7b89: fix(blade): add contrast prop to Typography components
1286
-
1287
- Add `contrast` prop to all the Typography components so that consumers can change the intent to grab the attention towards the text. The possible values for `contrast` are `high` or `low` and accordingly the color token will be used to set the color of the Typography components
1288
-
1289
- ## 0.7.0
1290
-
1291
- ### Minor Changes
1292
-
1293
- - 52efedb: fix(blade): set defaults for all typography components
1294
-
1295
- Make all the props optional to have a better DX and add default values for all the important props
1296
-
1297
- ## 0.6.0
1298
-
1299
- ### Minor Changes
1300
-
1301
- - e352eef: fix(blade): add `Heading` component
1302
-
1303
- ## 0.5.0
1304
-
1305
- ### Minor Changes
1306
-
1307
- - 75882a7: feat(Blade): add `Title`component
1308
-
1309
- The API for `Title` component can be found under [Typography/Text/\_decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Typography/_decisions/decisions.md)
1310
-
1311
- ## 0.4.0
1312
-
1313
- ### Minor Changes
1314
-
1315
- - 294173e: - Add the following components that would act as building blocks for our icons:
1316
- 1. `Svg`
1317
- 2. `Path`
1318
- 3. `Rect`
1319
- 4. `Defs`
1320
- 5. `ClipPath`
1321
- 6. `G`
1322
- - Add `CreditCardIcon` component
1323
- - Add `RupeeIcon` component
1324
-
1325
- ### Patch Changes
1326
-
1327
- - e76cd01: feat/add-text-component
1328
-
1329
- ## 0.3.0
1330
-
1331
- ### Minor Changes
1332
-
1333
- - a20b608: feat(blade): add motion tokens
1334
-
1335
- ### Motion tokens
1336
-
1337
- We have added tokens for
1338
-
1339
- 1. Delay
1340
- 2. Duration
1341
- 3. Easing
1342
-
1343
- You can find a detailed RFC for motion here: [View Formatted RFC](https://github.com/razorpay/blade/blob/rfc/2022-03-22-motion-rfc/rfcs/2022-03-22-motion-rfc.md)
1344
-
1345
- ## 0.2.0
1346
-
1347
- ### Minor Changes
1348
-
1349
- - 6885ac3: feat(blade): add BaseText component
1350
-
1351
- ## 0.1.6
1352
-
1353
- ### Patch Changes
1354
-
1355
- - 33e3930: feat(blade): add listener for toggling breakpoints
1356
-
1357
- **Updates**
1358
-
1359
- - Add `breakpoints` token to the themes.
1360
- - Out of the box responsiveness support for typography tokens.
1361
- - Publish `useBreakpoint` hook.
1362
- - Following breakpoints are supported as of today.
1363
- ```
1364
- /** max width: 320px */
1365
- xs: 320;
1366
- /** min width: 321px and max width: 480px */
1367
- s: 480;
1368
- /** min width: 481px and max width: 768px */
1369
- m: 768;
1370
- /** min width: 769 and max width: 1024px */
1371
- l: 1024;
1372
- /** min width: 1025 and max width: 1200px */
1373
- xl: 1200;
1374
- /** min width: 1201px */
1375
- max: 1201;
1376
- ```
1377
- - For web the typography scale will toggle between mobile and desktop
1378
- - `xs, s, m` are considered as mobile
1379
- - `l, xl, xl` are considered as desktop
1380
- - For react native we always default to mobile typography scale
1381
-
1382
- **What does it mean for me(as a developer)?**
1383
-
1384
- - If you’re already using Blade tokens then you can leverage this by just running `yarn upgrade @razorpay/blade@0.1.6` and that’s it you are set 🚀
1385
- - You can use the typography tokens as you were doing previously. Refer the [usage guideline here](https://61c19ee8d3d282003ac1d81c-jukcfyruls.chromatic.com/?path=/story/guides-usage--page&globals=measureEnabled:false#tokens)
1386
- - You can use these `breakpoints` as a base reference to build your next set of features by just following the [usage guidelines here](https://61c19ee8d3d282003ac1d81c-jukcfyruls.chromatic.com/?path=/story/tokens-breakpoints--page&globals=measureEnabled:false).
1387
-
1388
- This is our first step towards building responsive and adaptive applications. We’ll be publishing Typography Components next which will be built on top of these tokens and you can use them directly for your projects. Meanwhile, [read more about our responsive and adaptive strategy in this RFC](https://github.com/razorpay/blade/blob/master/rfcs/2022-02-11-responsive-and-adaptive-layout-strategy.md)
1389
-
1390
- ## 0.1.5
1391
-
1392
- ### Patch Changes
1393
-
1394
- - 04677a3: fix(blade): add lineheight tokens
1395
-
1396
- ## 0.1.4
1397
-
1398
- ### Patch Changes
1399
-
1400
- - f992f77: fix(blade): typo in exports field
1401
-
1402
- ## 0.1.3
1403
-
1404
- ### Patch Changes
1405
-
1406
- - d32dd9d: fix(blade): add overlay color token
1407
-
1408
- ## 0.1.2
1409
-
1410
- ### Patch Changes
1411
-
1412
- - 8cddfad: fix(blade): update desktop typography scale
1413
-
1414
- ## 0.1.1
1415
-
1416
- ### Patch Changes
1417
-
1418
- - 6c69a4d: fix(blade): update imports and exports
1419
-
1420
- ## 0.1.0
1421
-
1422
- ### Minor Changes
1423
-
1424
- - de4124f: ### ⚠️ **Breaking Change** ⚠️
1425
- This PR introduces a major breaking change on how we access tokens.
1426
-
1427
- ### Why did we want to change the way we access tokens?
1428
-
1429
- So, previously if you had to start consuming tokens from the new version of Blade you start with importing the theme provider:
1430
-
1431
- ```jsx
1432
- // App entry point
1433
- import { ThemeProvider } from '@razorpay/blade/components';
1434
- import { paymentTheme } from '@razorpay/blade/tokens';
1435
-
1436
- function App(): JSX.Element {
1437
- return (
1438
- <React.Fragment>
1439
- <GlobalStyle />
1440
- <ThemeProvider theme={paymentTheme}>
1441
- <Card />
1442
- </ThemeProvider>
1443
- </React.Fragment>
1444
- );
1445
- }
1446
-
1447
- export default App;
1448
- ```
1449
-
1450
- And then in one of our components, we'll use the `useTheme()` hook to get the theme and the mode like following 👇
1451
-
1452
- ```jsx
1453
- const StyledCard = styled.div(
1454
- ({ theme }: { theme: Theme }) => `
1455
- width: 368px;
1456
- background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1457
- border-radius: ${theme.border.radius.medium}px;
1458
- box-shadow: ${theme.shadows.offsetX.level[1]}px ${theme.shadows.offsetY.level[1]}px ${theme.shadows.blurRadius.level[1]}px ${theme.shadows.color.level[1].onLight}, ${theme.shadows.offsetX.level[1]}px ${theme.shadows.offsetY.level[1]}px ${theme.shadows.blurRadius.level[1]}px ${theme.shadows.color.level[1].onLight};
1459
- padding: ${theme.spacing[5]}px;
1460
- display: flex;
1461
- flex-direction: column;
1462
- `,
1463
- );
1464
-
1465
- const Card = (): React.ReactElement => {
1466
- const { theme } = useTheme();
1467
- return (
1468
- <React.Fragment>
1469
- <DisplayLarge theme={theme}>Cash Advance </DisplayLarge>
1470
- <StyledCard theme={theme}>
1471
- <AlertInformation theme={theme}>
1472
- The interest charged will be deposited back into your bank account within a day of
1473
- repayment.
1474
- </AlertInformation>
1475
- <Divider theme={theme} />
1476
- <CaptionRegular theme={theme}>
1477
- This amount will be deducted in 3 installments from your settlement balance between Feb
1478
- 18-20 on a daily basis.
1479
- </CaptionRegular>
1480
- </StyledCard>
1481
- </React.Fragment>
1482
- );
1483
- };
1484
- ```
1485
-
1486
- #### Problem with the existing implementation:
1487
-
1488
- So we pass the raw theme tokens which have everything light mode colors, dark mode colors. Different typography scales for desktop, mobile, etc. But as a consumer look at how do we access the tokens from the above file
1489
-
1490
- ```jsx
1491
-
1492
- const { theme } = useTheme();
1493
-
1494
- background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1495
- font-size: ${theme.typography.desktop.fonts.size[200]}px;
1496
- ```
1497
-
1498
- - Isn't it weird to explicitly write `onLight`/`onDark` by hand while accessing color tokens?
1499
- - Isn't it weird to explicitly write `desktop` to access the typography scale for desktop?
1500
- - How would you as a developer change things let's say if the user toggles the color mode?
1501
- - How would you as a developer change the typography scale if the user switches from desktop to mobile or vice-versa?
1502
-
1503
- You can't! Because we have **hardcoded** the object properties and which means we lost the power of dynamically changing these things based on the user's behavior which is incorrect.
1504
-
1505
- #### What is the root cause of this issue?
1506
-
1507
- The root cause is the mental model of how we store tokens and how do we consume them. Typically our tokens are nothing but our design decisions. So this means we need to store every decision in our token file, for eg: light mode colors, dark mode colors, typography scale for desktop, typography scale for mobile but when we consume them we want the system to take care of these things and give us single value for the modes and the platform.
1508
-
1509
- So we want something like this 👇
1510
-
1511
- ```diff
1512
-
1513
- const { theme } = useTheme();
1514
-
1515
- -background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1516
- +background-color: ${theme.colors.surface.background.level2.lowContrast};
1517
- -font-size: ${theme.typography.desktop.fonts.size[200]}px;
1518
- +font-size: ${theme.typography.fonts.size[200]}px;
1519
- ```
1520
-
1521
- Notice the removal of **`onLight`** and **`desktop`** keys from the theme object.
1522
-
1523
- So we want our system to behave in such a manner that:
1524
-
1525
- - We input the raw theme(which has color modes and platform types)
1526
- - It will output the flat theme which will have color mode and platform type selected, so we don't have to hardcode `onLight`/`onDark` or `desktop`/`mobile`.
1527
-
1528
- ### What is the solution?
1529
-
1530
- The system we spoke about is nothing but our `BladeProvider`(previously known as `ThemeProvider`). It'll accept the raw theme as a prop and then based on the device type and color mode pick those values from `themeTokens` and set it in the context as `theme`. We can then use `useTheme()` hook to get the theme from the context which will be flattened.
1531
-
1532
- This is how things will look after this change 👇
1533
-
1534
- ```diff
1535
- // App entry point
1536
- -import { ThemeProvider } from '@razorpay/blade/components';
1537
- +import { BladeProvider } from '@razorpay/blade/components';
1538
- import { paymentTheme } from '@razorpay/blade/tokens';
1539
-
1540
- function App(): JSX.Element {
1541
- return (
1542
- <React.Fragment>
1543
- <GlobalStyle />
1544
- - <ThemeProvider theme={paymentTheme}>
1545
- + <BladeProvider themeTokens={paymentTheme}>
1546
- <Card />
1547
- - </ThemeProvider>
1548
- + </BladeProvider>
1549
- </React.Fragment>
1550
- );
1551
- }
1552
-
1553
- export default App;
1554
-
1555
- // somewhere in the app
1556
- const { theme } = useTheme();
1557
-
1558
- -background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1559
- +background-color: ${theme.colors.surface.background.level2.lowContrast};
1560
- -font-size: ${theme.typography.desktop.fonts.size[200]}px;
1561
- +font-size: ${theme.typography.fonts.size[200]}px;
1562
- ```
1563
-
1564
- ### Migration guide for apps using the older version
1565
-
1566
- 1. Rename **ThemeProvider** to **BladeProvider**
1567
-
1568
- ```diff
1569
- -import { ThemeProvider } from '@razorpay/blade/components';
1570
- +import { BladeProvider } from '@razorpay/blade/components';
1571
- ```
1572
-
1573
- 2. Rename `theme` prop on provider to `themeTokens`
1574
-
1575
- ```diff
1576
- -<BladeProvider theme={paymentTheme}>
1577
- +<BladeProvider themeTokens={paymentTheme}>
1578
- ```
1579
-
1580
- 3. import `Theme` type to be imported from `@razorpay/blade/components` instead of `@razorpay/blade/tokens`
1581
-
1582
- ```diff
1583
- -import type { Theme } from '@razorpay/blade/tokens';
1584
- +import type { Theme } from '@razorpay/blade/components';
1585
- ```
1586
-
1587
- 4. Remove all the `onLight`/`onDark` keywords from the theme colors object
1588
-
1589
- ```diff
1590
- -background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1591
- +background-color: ${theme.colors.surface.background.level2.lowContrast};
1592
- ```
1593
-
1594
- 5. Remove all the `desktop`/`mobile` keywords from the theme typography object
1595
-
1596
- ```diff
1597
- -background-color: ${theme.colors.surface.background.level2.lowContrast.onLight};
1598
- +background-color: ${theme.colors.surface.background.level2.lowContrast};
1599
- ```
1600
-
1601
- ## 0.0.8
1602
-
1603
- ### Patch Changes
1604
-
1605
- - 7a09800: fix(blade): add description in token types
1606
-
1607
- ## 0.0.7
1608
-
1609
- ### Patch Changes
1610
-
1611
- - 1aa2961: fix(blade): export all the types of global tokens for consumers
1612
- - d8d8027: fix(blade): typo in color tokens
1613
-
1614
- ## 0.0.6
1615
-
1616
- ### Patch Changes
1617
-
1618
- - 8374dc1: build(blade): generate root `.d.ts`
1619
-
1620
- ## 0.0.5
1621
-
1622
- ### Patch Changes
1623
-
1624
- - 057cf66: build(blade): add re-exports to `.ts` instead of `.js`
1625
-
1626
- ## 0.0.4
1627
-
1628
- ### Patch Changes
1629
-
1630
- - efb59d9: feat(blade): add type generation scripts
1631
-
1632
- ## 0.0.3
1633
-
1634
- ### Patch Changes
1635
-
1636
- - f0b2b01: fix(blade): typo in exports field
1637
-
1638
- ## 0.0.2
1639
-
1640
- ### Patch Changes
1641
-
1642
- - 55ac5d3: feat(blade): add rollup to build blade