Skip to content

Commit 25b8c38

Browse files
committed
fix: merge conflict
2 parents 397b172 + 92648a7 commit 25b8c38

File tree

158 files changed

+5801
-3831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+5801
-3831
lines changed

.changeset/curly-roses-peel.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/grumpy-keys-listen.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing guidelines for `blade`
22

3-
## Development setup
3+
## Local Development Setup
44

55
These steps should get you up and started for local development setup. Please ensure you've NodeJS and Yarn installed on your machine before proceeding.
66

@@ -22,7 +22,16 @@ These steps should get you up and started for local development setup. Please en
2222
yarn start:web
2323
```
2424

25-
- That's it!
25+
- That's it! You can access storybook on http://localhost:9009
26+
27+
### Setting up React Native
28+
29+
If you're contributing to React Native parts, you can follow the following setup.
30+
31+
You can skip it if you're contributing to web only component. Our [Component Status Page in Documentation](https://blade.razorpay.com/?path=/docs/guides-component-status--docs) mentions which components are react native supported and which are web only
32+
33+
<details>
34+
<summary><h4>React Native Local Development Setup</h4></summary>
2635

2736
### Setting up iOS
2837

@@ -38,13 +47,13 @@ These steps should get you up and started for local development setup. Please en
3847

3948
- Install [Xcode](https://reactnative.dev/docs/environment-setup#xcode).
4049

41-
> **Note**
50+
> [!Note]
4251
>
4352
> Sometimes it can take a very long time for Xcode to install. Check [here](https://apple.stackexchange.com/questions/427640/mac-app-store-xcode-download-stuck-at-installing) for troubleshooting.
4453
4554
- Install an iOS 13 simulator in Xcode: Xcode > Preferences > Platforms.
4655

47-
> **Note**
56+
> [!Note]
4857
>
4958
> Sometimes this can get stuck or take a very long time. Check [here](https://stackoverflow.com/questions/29058229/download-xcode-simulator-directly) for troubleshooting.
5059
@@ -56,7 +65,7 @@ These steps should get you up and started for local development setup. Please en
5665

5766
- Install pods. This can be done by running `pod install` in the `ios/` directory for Intel machine. For M1, things might not work out of box.
5867

59-
> **Note**
68+
> [!Note]
6069
>
6170
> Follow the note [here](https://reactnative.dev/docs/environment-setup#cocoapods) if you're using M1
6271
@@ -70,9 +79,9 @@ These steps should get you up and started for local development setup. Please en
7079
>
7180
> You don't need to build the app everytime (only when you're changing native dependencies), once the app is built you can just start the storybook server and open the app directly on your simulator
7281
73-
- If the stars aligned correctly, the storybook app should get installed and up and running on the simulator. If not, please refer to the official [guide](https://reactnative.dev/docs/environment-setup) for any deviations.
82+
- If the stars aligned correctly, the storybook app should get installed and up and running on the simulator. If not, please refer to the official [guide](https://reactnative.dev/docs/environment-setup) for any deviations.
7483

75-
*The storybook can take some time to open after simulator starts. Don't worry, it will start after few minutes (hopefully 🤞).*
84+
_The storybook can take some time to open after simulator starts. Don't worry, it will start after few minutes (hopefully 🤞)._
7685

7786
### Setting up Android
7887

@@ -93,28 +102,99 @@ These steps should get you up and started for local development setup. Please en
93102
yarn start:android
94103
```
95104

96-
> **Note**
105+
> [!Note]
97106
>
98107
> If you already have `yarn start:ios` running, you might have to close it since `yarn start:android` will try to run react-native server on the same port and fail with port taken error.
99-
>
108+
>
100109
> If you want to run both, android and ios at the same time, you can use `yarn start:native` instead.
101110
102-
> **Note**
111+
> [!Note]
103112
>
104113
> Make sure `$ANDROID_SDK_ROOT` is added before running the above command, you can run `echo $ANDROID_SDK_ROOT` in same terminal to confirm. (You can run `source ~/.zshrc` or `source ~/.bash_profile` depending on where you added the variables)
105114
106115
- If the stars aligned correctly, the storybook app should get installed and up and running on the emulator 🎉
107116

108-
## Tips
117+
> [!TIP]
118+
>
119+
> You can use `yarn start:all` command to run storybooks on all platforms like web, android, and ios (better to not use it in development though to avoid stressing your laptop)
120+
121+
</details>
122+
123+
## Codebase Terminologies and Structure
109124

110-
- You can use `yarn start:all` command to run storybooks on all platforms like web, android, and ios (better to not use it in development though to avoid stressing your laptop)
125+
### Base Component Terminology in Code
111126

112-
## TypeScript Guide
127+
We have some base components defined internally such as BaseInput, BaseButton, BaseText which act as a base for multiple exposed components.
128+
129+
E.g.
130+
131+
- Heading, Display, Text all use BaseText internally
132+
- TextInput, PasswordInput, SelectInput all use BaseInput internally
133+
- Majority of our components use BaseBox internally which is a more flexible version of the exposed Box component.
134+
135+
### Cross Platform Guide
136+
137+
You will see files with `.web.tsx` or `.native.tsx` syntax. The `.web.tsx` files end up in web bundle and `.native.tsx` files end up in react native bundle. You can define common logic in normal `.tsx` files which can be imported in both web and native files.
138+
139+
#### Cross Platform TypeScript Guide
113140

114141
[Writing Cross-Platform TypeScript In Blade](./rfcs/writing-cross-platform-typescript.md)
115142

143+
## Testing Changes
144+
145+
### Unit Tests
146+
147+
We have unit tests which you can run by running following commands
148+
149+
```sh
150+
cd packages/blade
151+
yarn test:react # web tests
152+
yarn test:react-native # native tests
153+
```
154+
155+
### Visual Tests
156+
157+
We also have visual tests that run on every PR. So if your PR changes / breaks a certain component, the diff will show up on chromatic checks of PR
158+
159+
<img width="822" alt="image" src="https://github.com/user-attachments/assets/35f6dfd8-ba64-4bc8-a15d-39a3476b6ae8">
160+
161+
### Interaction Tests
162+
163+
We support writing interaction tests using playwright. You can check example interaction tests of toast at [Toast.test.stories.tsx](./packages/blade/src/components/Toast/__tests__/Toast.test.stories.tsx). You can run these tests by visiting the Interaction Tests section in blade documentation E.g. [Toast Stacking Interaction Test on Documentation](https://blade.razorpay.com/?path=/story/components-interaction-tests-toast--toast-stacking)
164+
165+
## Editor Setup
166+
167+
- Make sure you have [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) installed and setup on your VSCode. This will guide you and autofix errors to keep the code consistent with this project's guidelines
168+
- Make sure you have [VSCode MDX](https://marketplace.visualstudio.com/items?itemName=JounQin.vscode-mdx) installed on your VSCode. This will help you with linting the markdown files if you're modifying or adding any `mdx` files for documentation purpose.
169+
- After installing this plugin navigate to your settings and add `mdx` extension to your `eslint` config. Below is how your settings will look after configuring `mdx` to work with eslint
170+
```json
171+
// .vscode/settings.json
172+
{
173+
"editor.codeActionsOnSave": {
174+
"source.fixAll.eslint": true
175+
},
176+
"eslint.options": {
177+
"extensions": [".js", ".jsx", ".md", ".mdx", ".ts", ".tsx"]
178+
},
179+
"eslint.validate": [
180+
"markdown",
181+
"mdx",
182+
"javascript",
183+
"javascriptreact",
184+
"typescript",
185+
"typescriptreact"
186+
]
187+
}
188+
```
189+
116190
## Troubleshooting guidelines
117191

118192
- VSCode auto imports can sometimes mess things up due to import aliases and `.web` / `.native` extensions. If something is breaking weirdly after adding / importing a new module this might be related
119193
- Ensure you're not using any `.web`, `.native` files directly in respective imports in `.web` / `.native` modules. For example, if you end up importing a `.web` module accidentally in a `.native` module, you might see a blank component being rendered or module not found error
120194
- If you forget to import types inside a `.d.ts` file, sometimes TS won't complain and it can throw the typecheck logic in other modules off
195+
196+
- `Blade requires "FRAMEWORK" environment variable to be set. Valid values are "REACT" and "REACT_NATIVE". Instead, received: undefined`
197+
198+
**Issue:** This is an issue that happens mostly if you run `yarn android` directly. For some reason `FRAMEWORK` doesn't gets passed to React Native application
199+
200+
**Fix:** If you come across this issue then you first run `yarn start` and then run `yarn android`.

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ Blade is the Design System that powers [Razorpay](https://razorpay.com/).
2525
- [@razorpay/blade-old](https://github.com/razorpay/blade-old) (Deprecated, Private)
2626

2727
## ✨ Features
28-
- Cross-Platform (Works Natively on [React Web](https://blade.razorpay.com/?path=/docs/guides-installation--page#%EF%B8%8F-installation) and [React Native](https://blade.razorpay.com/?path=/docs/guides-installation--page#react-native-projects))
29-
- [White Labelling](https://blade.razorpay.com/?path=/docs/guides-theming-theme-playground--page)
30-
- [CSS Variables for non-React Projects](https://blade.razorpay.com/?path=/docs/tokens-css-variables--page)
28+
- Cross-Platform (Works Natively on [React Web and React Native](https://blade.razorpay.com/?path=/docs/guides-installation--docs))
29+
- [White Labelling](https://blade.razorpay.com/?path=/docs/guides-theming-theme-playground--docs)
3130
- [Accessible](https://github.com/razorpay/blade/blob/master/rfcs/2022-04-09-accessibility.md#manual-testing)
32-
- Documented [RFCs](https://github.com/razorpay/blade/tree/docs/make-docs-pretty/rfcs) and [API Decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Alert/_decisions/decisions.md)
31+
- Documented [RFCs](https://github.com/razorpay/blade/tree/master/rfcs) and [API Decisions](https://github.com/razorpay/blade/blob/master/packages/blade/src/components/Alert/_decisions/decisions.md)
3332

3433
## 📝 License
3534

packages/blade/.storybook/react/preview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const parameters = {
5050
method: 'alphabetical',
5151
order: [
5252
'Guides',
53-
['Intro', 'Installation', 'Local Development', 'How to use?'],
53+
['Intro', 'Installation', 'Contributing', 'How to use?'],
5454
'Tokens',
5555
[
5656
'Colors',
@@ -82,7 +82,7 @@ export const parameters = {
8282
console.log('----', context);
8383
const getThemeTokens = () => {
8484
if (context.store.globals.globals.brandColor) {
85-
return createTheme({ brandColor: context.store.globals.globals.brandColor });
85+
return createTheme({ brandColor: context.store.globals.globals.brandColor }).theme;
8686
}
8787
return bladeTheme;
8888
};
@@ -165,7 +165,7 @@ export const decorators = [
165165
toggleHiddenStoryStyle(context.globals.showInternalComponents);
166166
const getThemeTokens = () => {
167167
if (context.globals.brandColor) {
168-
return createTheme({ brandColor: context.globals.brandColor });
168+
return createTheme({ brandColor: context.globals.brandColor }).theme;
169169
}
170170
return bladeTheme;
171171
};

packages/blade/CHANGELOG.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,111 @@
11
# @razorpay/blade
22

3+
## 11.30.5
4+
5+
### Patch Changes
6+
7+
- 9d4f9b85: feat(blade): add height & styled props to carousel
8+
9+
## 11.30.4
10+
11+
### Patch Changes
12+
13+
- 68e0ec53: fix(blade): Table cell text truncation
14+
15+
## 11.30.3
16+
17+
### Patch Changes
18+
19+
- 98482ca9: fix(blade): interactive card cursor
20+
21+
## 11.30.2
22+
23+
### Patch Changes
24+
25+
- 2f8a5029: fix(BaseHeader): Handle word break on single word. Fixes for AccordionItemHeader, DropdownHeader, etc
26+
27+
## 11.30.1
28+
29+
### Patch Changes
30+
31+
- c050c1d9: fix: AccordionItemHeader to take full width
32+
33+
## 11.30.0
34+
35+
### Minor Changes
36+
37+
- 6e059a68: feat: fix datepicker range selection bug & add onApply handler
38+
39+
### Patch Changes
40+
41+
- 98770d68: fix(Input): required necessity indicator label break
42+
- 3c31990d: feat(Table): add `defaultSelectedIds` prop
43+
44+
## 11.29.0
45+
46+
### Minor Changes
47+
48+
- eaa75c64: feat(ActionList): add ActionListItemAvatar component for leading prop
49+
50+
### Patch Changes
51+
52+
- c6f8bc72: fix(blade): support overriding tooltip interactive wrapper display prop
53+
54+
## 11.28.2
55+
56+
### Patch Changes
57+
58+
- 12f30712: fix(input): change `wordBreak` behaviour of input hint text & fix alignment
59+
- 601cedc8: feat(StepItem): add `isDisabled` prop to StepItem
60+
61+
## 11.28.1
62+
63+
### Patch Changes
64+
65+
- 830c8744: fix(Table): table sticky column overlapping with relative cell
66+
67+
## 11.28.0
68+
69+
### Minor Changes
70+
71+
- 95f19f49: feat: expose link negative/positive colors
72+
73+
## 11.27.1
74+
75+
### Patch Changes
76+
77+
- 8ba3eab7: fix: datepicker necessityIndicator
78+
79+
## 11.27.0
80+
81+
### Minor Changes
82+
83+
- f036ef58: feat: add EqualsIcon
84+
85+
## 11.26.1
86+
87+
### Patch Changes
88+
89+
- 5d7317ca: fix: remove default `rel` values
90+
91+
> [!NOTE]
92+
>
93+
> While its non-ui-breaking change, you might want to add `rel="noopener noreferrer"` to your Button if that is what you're expecting. This PR removes the defaults in-order to not break analytics that relies on referrer.
94+
95+
- 4dcad016: fix: set min-width on Radio to avoid shrinking
96+
97+
## 11.26.0
98+
99+
### Minor Changes
100+
101+
- f26cf80d: chore: expose brand colors
102+
- 39742907: feat(TableEditableCell): refactor TableEditableCell and add TableEditableDropdownCell
103+
104+
### Patch Changes
105+
106+
- e13023de: fix: table footer background color
107+
- fb58be12: fix: Spinner colors
108+
3109
## 11.25.0
4110

5111
### Minor Changes
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Meta } from '@storybook/addon-docs';
2+
3+
<Meta title="Guides/Contributing" />
4+
5+
# 🤗 Contributing to Blade
6+
7+
Blade is an open-source project and we accept contributions from our other teams at Razorpay and also from outside of Razorpay. You can checkout the links below to help you get started with contribution
8+
9+
## 🧑🏻‍💻 Local Development and Guidelines
10+
11+
Check out [CONTRIBUTING.md](https://github.com/razorpay/blade/blob/master/CONTRIBUTING.md) for local installation, codebase terminologies, editor setup and more.
12+
13+
## 📄 License
14+
15+
Blade is MIT Licensed. You can read full license at [LICENSE](https://github.com/razorpay/blade/blob/master/LICENSE.md)
16+
17+
## 🏘️ Slack Channel (For Razorpay Employees)
18+
19+
Razorpay Employees can reach out on `#design-system` and tag `@designsystem` for anything related to contributing to Blade.

packages/blade/docs/guides/CreateTheme.stories.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{/* TODO: Rebranding - Rexpose Theming once we fix white-labeling */}
21
import { Meta } from '@storybook/addon-docs';
32
import {
43
Collapsible,
@@ -43,7 +42,7 @@ To make this possible, Blade allows you to customize the theme of the components
4342
```tsx
4443
import { createTheme } from '@razorpay/blade/tokens';
4544

46-
const customThemeTokens = createTheme({
45+
const { theme: customThemeTokens } = createTheme({
4746
brandColor: '#83003D', // 'rgba(131, 0, 61)', 'hsl(332, 100%, 26%)' are also valid values
4847
});
4948

@@ -70,11 +69,11 @@ Custom branded themes also contain support for light and dark color schemes. You
7069
export const ContrastDemo = () => {
7170
return (
7271
<div>
73-
<BladeProvider themeTokens={createTheme({ brandColor: '#83003D' })} colorScheme="light">
72+
<BladeProvider themeTokens={createTheme({ brandColor: '#83003D' }).theme} colorScheme="light">
7473
<Heading>Foreground on Button is Light based on the brand color</Heading>
7574
<Button icon={CreditCardIcon}>Pay Now</Button>
7675
</BladeProvider>
77-
<BladeProvider themeTokens={createTheme({ brandColor: '#5EDD55' })} colorScheme="light">
76+
<BladeProvider themeTokens={createTheme({ brandColor: '#5EDD55' }).theme} colorScheme="light">
7877
<Heading marginTop="spacing.6">
7978
Foreground on Button is Dark based on the brand color
8079
</Heading>

0 commit comments

Comments
 (0)