Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Bip Bop - Fusion React Components Release #2478

Merged
merged 1 commit into from
Feb 24, 2025
Merged

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@equinor/[email protected]

Major Changes

  • eba9cf6: Changed implementation of the Stepper component from being uncontrolled to having a both an uncontrolled and controlled mode.

    • Required 'activeStepKey' prop removed. Replaced with 'initialStepKey' and 'stepKey' (both optional)
    • If 'stepKey' is set, then the component becomes controlled by that prop.
    • If 'stepKey' is set and 'initialStepKey' is set, then the initial step will be that prop, but otherwise be uncontrolled.
    • If none of these props are set then it will be uncontrolled, and default to the first step of the steps provided as the initial step.
    • Updated 'Stepper' README and Storybook with examples of usage.

    This is a breaking change since the 'activeStepKey' was required, and now needs to be either removed or replaced with one of the two new optional props.

    Migration guide:

    Uncontrolled usage:

    import { Stepper } from '@equinor/fusion-react-stepper';
    
    /** initialStepKey here is optional. If not set it defaults to the first step ('step1') */
    <Stepper initialStepKey="step1" onChange={(e, k) => console.log('active: ', e, ' keys: ', k)} props>
      <Step title="Title 1" stepKey="step1" props>
        Step content 1
      </Step>
      <Step title="Title 2" stepKey="step2" props>
        Step content 2
      </Step>
      <Step title="Title 3" stepKey="step3" props>
        Step content 3
      </Step>
    </Stepper>;

    Controlled usage:

    import { Stepper } from '@equinor/fusion-react-stepper';
    
    const [activeStep, setActiveStep] = useState<string>('step1');
    const onChangeStep = (stepKey: string, allSteps: StepKey[]) => {
      console.log('active: ', stepKey, ' keys: ', allSteps);
      if (activeStep !== stepKey) {
        setActiveStep(String(stepKey));
      }
    };
    
    return (
      <Stepper stepKey={activeStep} onChange={onChangeStep} props>
        <Step title="Title 1" stepKey="step1" props>
          Step content 1
        </Step>
        <Step title="Title 2" stepKey="step2" props>
          Step content 2
        </Step>
        <Step title="Title 3" stepKey="step3" props>
          Step content 3
        </Step>
      </Stepper>
    );

@equinor/[email protected]

Patch Changes

  • eba9cf6: Changed implementation of the Stepper component from being uncontrolled to having a both an uncontrolled and controlled mode.

    • Required 'activeStepKey' prop removed. Replaced with 'initialStepKey' and 'stepKey' (both optional)
    • If 'stepKey' is set, then the component becomes controlled by that prop.
    • If 'stepKey' is set and 'initialStepKey' is set, then the initial step will be that prop, but otherwise be uncontrolled.
    • If none of these props are set then it will be uncontrolled, and default to the first step of the steps provided as the initial step.
    • Updated 'Stepper' README and Storybook with examples of usage.

    This is a breaking change since the 'activeStepKey' was required, and now needs to be either removed or replaced with one of the two new optional props.

    Migration guide:

    Uncontrolled usage:

    import { Stepper } from '@equinor/fusion-react-stepper';
    
    /** initialStepKey here is optional. If not set it defaults to the first step ('step1') */
    <Stepper initialStepKey="step1" onChange={(e, k) => console.log('active: ', e, ' keys: ', k)} props>
      <Step title="Title 1" stepKey="step1" props>
        Step content 1
      </Step>
      <Step title="Title 2" stepKey="step2" props>
        Step content 2
      </Step>
      <Step title="Title 3" stepKey="step3" props>
        Step content 3
      </Step>
    </Stepper>;

    Controlled usage:

    import { Stepper } from '@equinor/fusion-react-stepper';
    
    const [activeStep, setActiveStep] = useState<string>('step1');
    const onChangeStep = (stepKey: string, allSteps: StepKey[]) => {
      console.log('active: ', stepKey, ' keys: ', allSteps);
      if (activeStep !== stepKey) {
        setActiveStep(String(stepKey));
      }
    };
    
    return (
      <Stepper stepKey={activeStep} onChange={onChangeStep} props>
        <Step title="Title 1" stepKey="step1" props>
          Step content 1
        </Step>
        <Step title="Title 2" stepKey="step2" props>
          Step content 2
        </Step>
        <Step title="Title 3" stepKey="step3" props>
          Step content 3
        </Step>
      </Stepper>
    );
  • Updated dependencies [eba9cf6]

@github-actions github-actions bot marked this pull request as draft February 24, 2025 11:08
@eikeland eikeland marked this pull request as ready for review February 24, 2025 11:17
@eikeland eikeland merged commit f995423 into main Feb 24, 2025
3 checks passed
@eikeland eikeland deleted the changeset-release/main branch February 24, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant