From 2378e50c4f8bcac9dbf0fda0420e0b9ab436e8c7 Mon Sep 17 00:00:00 2001 From: shaharzil Date: Wed, 10 Apr 2024 11:18:30 +0300 Subject: [PATCH 1/9] docs: change npm to yarn (#2054) --- packages/core/CONTRIBUTING.md | 10 +++++----- packages/core/README.md | 2 +- packages/core/TESTING_README.md | 2 +- packages/storybook-blocks/CONTRIBUTING.md | 8 ++++---- packages/storybook-blocks/README.md | 2 +- packages/style/README.md | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/core/CONTRIBUTING.md b/packages/core/CONTRIBUTING.md index 546aa8ec9b..bf75570de0 100644 --- a/packages/core/CONTRIBUTING.md +++ b/packages/core/CONTRIBUTING.md @@ -8,11 +8,11 @@ This library is open-sourced, and we encourage everyone to use and contribute in 1. Create a fork of this repository 2. Please use the correct node version it is listed in the `.nvmrc` file (you can use `nvm use` in order to switch to the right node version). -3. Install dependencies with `npm install` command +3. Install dependencies with `yarn install` command 4. Sync from upstream if needed -5. Run Storybook environment locally with `npm run storybook` command. -6. Make sure all components behave as expected by running all Jest tests locally with 'npm run test'. -7. If there are changes in some of the library snapshot tests, make sure all changes are intentional. If they are, update them with 'npm run test:update'. +5. Run Storybook environment locally with `yarn storybook` command. +6. Make sure all components behave as expected by running all Jest tests locally with 'yarn test'. +7. If there are changes in some of the library snapshot tests, make sure all changes are intentional. If they are, update them with 'yarn test:update'. 8. Commit to your local fork using [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages) 9. Create a PR with title based using [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages) For example: `feat: add new TextArea component` @@ -24,7 +24,7 @@ This library is open-sourced, and we encourage everyone to use and contribute in ### Creating new files in the library -Our code generator, Plop, is designed to simplify the creation of frequently used boilerplate code. To utilize it, execute the command `npm run plop`. If you want to learn more about Plop, you can find additional information [here](https://plopjs.com/). +Our code generator, Plop, is designed to simplify the creation of frequently used boilerplate code. To utilize it, execute the command `yarn plop`. If you want to learn more about Plop, you can find additional information [here](https://plopjs.com/). Currently, our Plop code generator supports the creation of the following: 1. Tests diff --git a/packages/core/README.md b/packages/core/README.md index 559a6997a4..f5de9dfa99 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -48,7 +48,7 @@ We are using storybook in order to develop the components independently of any c run this to build & run the storybook locally: ```bash -npm run storybook +yarn storybook ``` the storybook will be served on `http://localhost:7007` diff --git a/packages/core/TESTING_README.md b/packages/core/TESTING_README.md index 4a3d54fdc4..7a266a3705 100644 --- a/packages/core/TESTING_README.md +++ b/packages/core/TESTING_README.md @@ -62,7 +62,7 @@ describe("Tipseen tests", () => { ### Running Vibe tests **Snapshot and Behavior Tests:** -To run all snapshot and behavior tests locally, use the command: `npm run test`. +To run all snapshot and behavior tests locally, use the command: `yarn test`. **Local Storybook Interaction Tests:** To check interaction tests for a specific story in Storybook: diff --git a/packages/storybook-blocks/CONTRIBUTING.md b/packages/storybook-blocks/CONTRIBUTING.md index 29dbea92de..fd897bae5f 100644 --- a/packages/storybook-blocks/CONTRIBUTING.md +++ b/packages/storybook-blocks/CONTRIBUTING.md @@ -7,11 +7,11 @@ This library is open-sourced, and we encourage everyone to use and contribute in 1. Create a fork of this repository 2. Please use the correct node version it is listed in the `.nvmrc` file (you can use `nvm use` in order to switch to the right node version). -3. Install dependencies with `npm install` command +3. Install dependencies with `yarn install` command 4. Sync from upstream if needed -5. Run Storybook environment locally with `npm run storybook` command. -6. Make sure all components behave as expected by running all Jest tests locally with 'npm run test'. -7. If there are changes in some of the library snapshot tests, make sure all changes are intentional. If they are, update them with 'npm run test:update'. +5. Run Storybook environment locally with `yarn storybook` command. +6. Make sure all components behave as expected by running all Jest tests locally with 'yarn test'. +7. If there are changes in some of the library snapshot tests, make sure all changes are intentional. If they are, update them with 'yarn test:update'. 8. Commit to your local fork using [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages) 9. Create a PR with title based using [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages) For example: `docs: add story page` diff --git a/packages/storybook-blocks/README.md b/packages/storybook-blocks/README.md index 6baafd9322..0bad1254a9 100644 --- a/packages/storybook-blocks/README.md +++ b/packages/storybook-blocks/README.md @@ -84,7 +84,7 @@ Most of the components have a `className` prop that can be used to style them. T To run the storybook locally run this command: ``` -npm run storybook +yarn storybook ``` the storybook will hosted on http://localhost:6005 diff --git a/packages/style/README.md b/packages/style/README.md index d1cf3d1a96..ee6d333b93 100644 --- a/packages/style/README.md +++ b/packages/style/README.md @@ -50,7 +50,7 @@ We maintain a metadata file for each icon, it helps our icon library be more rea How to add a new icon? Add the icon in SVG format under the src/Icons folder (size 20x20) -then run `npm run generate-meta` and fill in the relevant information (you can add multiple icons and run the command once) +then run `yarn generate-meta` and fill in the relevant information (you can add multiple icons and run the command once) ### Icon colors From cc740bb612a50f2a78d167b7691ce59a44f1cb27 Mon Sep 17 00:00:00 2001 From: Tal Koren Date: Wed, 10 Apr 2024 13:41:54 +0300 Subject: [PATCH 2/9] docs: fix related components link (#2056) --- .../descriptions/dialog-description/dialog-description.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/storybook/components/related-components/descriptions/dialog-description/dialog-description.tsx b/packages/core/src/storybook/components/related-components/descriptions/dialog-description/dialog-description.tsx index c658a1ab56..3664c65d1e 100644 --- a/packages/core/src/storybook/components/related-components/descriptions/dialog-description/dialog-description.tsx +++ b/packages/core/src/storybook/components/related-components/descriptions/dialog-description/dialog-description.tsx @@ -43,7 +43,7 @@ export const DialogDescription = () => { ); From 7c35041363e880667899df8f033b117058be3a25 Mon Sep 17 00:00:00 2001 From: shaharzil Date: Wed, 10 Apr 2024 14:02:54 +0300 Subject: [PATCH 3/9] fix(DatePicker): added min width to buttons inside year picker (#2050) --- .../DatePicker/YearPicker/YearPicker.module.scss | 4 ++++ .../components/DatePicker/YearPicker/YearsList.tsx | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/DatePicker/YearPicker/YearPicker.module.scss b/packages/core/src/components/DatePicker/YearPicker/YearPicker.module.scss index 3c2818b722..5f9c0c7a4a 100644 --- a/packages/core/src/components/DatePicker/YearPicker/YearPicker.module.scss +++ b/packages/core/src/components/DatePicker/YearPicker/YearPicker.module.scss @@ -38,6 +38,10 @@ position: absolute; top: 55px; pointer-events: all; + + .pickerOption { + min-width: 66px; + } } :global(.CalendarYear--blocked) { diff --git a/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx b/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx index 342c30d9a6..84c2e1efc2 100644 --- a/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx +++ b/packages/core/src/components/DatePicker/YearPicker/YearsList.tsx @@ -1,4 +1,5 @@ import Button from "../../Button/Button"; +import styles from "./YearPicker.module.scss"; // eslint-disable-next-line @typescript-eslint/no-empty-function const NOOP = () => {}; @@ -19,7 +20,15 @@ const YearsList = ({ yearsItems, isYearBlocked, onSelect, selectedYear }: YearsL const kind = parseInt(selectedYear, 10) === currYear ? Button?.kinds?.PRIMARY : Button?.kinds?.TERTIARY; return ( - ); From d40b49efc63fe943a71bf9ba643b513cf5f66d97 Mon Sep 17 00:00:00 2001 From: chensara Date: Wed, 10 Apr 2024 15:28:01 +0300 Subject: [PATCH 4/9] feat: add autoFocus to RadioButton (#2057) --- .../components/RadioButton/RadioButton.tsx | 5 + .../radioButton-snapshot-tests.jest.tsx.snap | 26 ++++ .../radioButton-snapshot-tests.jest.tsx | 6 +- .../__tests__/radioButton-tests.jest.tsx | 119 ++++++++++-------- 4 files changed, 106 insertions(+), 50 deletions(-) diff --git a/packages/core/src/components/RadioButton/RadioButton.tsx b/packages/core/src/components/RadioButton/RadioButton.tsx index a845dd55bf..b4405ed854 100644 --- a/packages/core/src/components/RadioButton/RadioButton.tsx +++ b/packages/core/src/components/RadioButton/RadioButton.tsx @@ -27,6 +27,8 @@ export interface RadioButtonProps extends VibeComponentProps { value?: string; /** A string specifying a name for the input control. This name is submitted along with the control's value when the form data is submitted. */ name?: string; + /** is autoFocus */ + autoFocus?: boolean; /** is disabled */ disabled?: boolean; /** why the input is disabled */ @@ -64,6 +66,7 @@ const RadioButton: VibeComponent & object = forwa */ radioButtonClassName, disabled = false, + autoFocus, disabledReason, defaultChecked = false, children, @@ -80,6 +83,7 @@ const RadioButton: VibeComponent & object = forwa const inputRef = useRef(); const mergedRef = useMergeRef(ref, inputRef); const overrideClassName = backwardCompatibilityForProperties([className, componentClassName]); + const onChildClick = useCallback(() => { if (disabled || !retainChildClick) return; if (inputRef.current) { @@ -114,6 +118,7 @@ const RadioButton: VibeComponent & object = forwa type="radio" value={value} name={name} + autoFocus={autoFocus} disabled={disabled} {...checkedProps} onChange={onSelect} diff --git a/packages/core/src/components/RadioButton/__tests__/__snapshots__/radioButton-snapshot-tests.jest.tsx.snap b/packages/core/src/components/RadioButton/__tests__/__snapshots__/radioButton-snapshot-tests.jest.tsx.snap index afbe409e9c..44d8af9e62 100644 --- a/packages/core/src/components/RadioButton/__tests__/__snapshots__/radioButton-snapshot-tests.jest.tsx.snap +++ b/packages/core/src/components/RadioButton/__tests__/__snapshots__/radioButton-snapshot-tests.jest.tsx.snap @@ -1,5 +1,31 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`RadioButton renders correctly when autoFocus 1`] = ` + +`; + exports[`RadioButton renders correctly when checked 1`] = `