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

Web Component Switch #26517

Merged

Conversation

brianchristopherbrady
Copy link
Contributor

πŸ“– Description

Adds the Switch web component.

πŸ‘©β€πŸ’» Reviewer Notes

βœ… Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

@brianchristopherbrady brianchristopherbrady requested a review from a team as a code owner January 26, 2023 19:11
@brianchristopherbrady brianchristopherbrady changed the title Web Component Switch Web Component Switch [draft] Jan 26, 2023
@fabricteam
Copy link
Collaborator

fabricteam commented Jan 26, 2023

πŸ“Š Bundle size report

πŸ€– This report was generated against 50615f48477ebf292bb017c36fc989045e4f48a4

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 26, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3cfd2a5:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Jan 26, 2023

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 1ad2597f744bf7c3e2eada7720eea793fcee660e (build)

@layershifter layershifter removed their assignment Jan 27, 2023
@brianchristopherbrady brianchristopherbrady changed the title Web Component Switch [draft] Web Component Switch Jan 30, 2023
@brianchristopherbrady brianchristopherbrady self-assigned this Jan 30, 2023
Comment on lines 131 to 134
:host([disabled]) .status-message,
:host([readonly]) .status-message {
cursor: pointer;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed with the latest version of the template - does the message still exist?

Comment on lines 7 to 8
export * from './text/index.js';
export * from './switch/index.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, these should technically be alphabetized

Comment on lines 130 to 137
:host([aria-checked='true']) .switch:hover {
background: ${colorCompoundBrandBackgroundHover};
border-color: ${colorCompoundBrandBackgroundHover};
}
:host([aria-checked='true']) .switch:active {
background: ${colorCompoundBrandBackgroundPressed};
border-color: ${colorCompoundBrandBackgroundPressed};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianchristopherbrady I think I found a slight change that needs to be made here...perhaps you can confirm locally. From what I can tell form the FUIR9 implementation the hover and active states should go darker even in the case that the label is hovered. With this, the change is going to be very slight.

  :host([aria-checked='true']:hover) .switch {
    background: ${colorCompoundBrandBackgroundHover};
    border-color: ${colorCompoundBrandBackgroundHover};
  }
  :host([aria-checked='true']:active) .switch {
    background: ${colorCompoundBrandBackgroundPressed};
    border-color: ${colorCompoundBrandBackgroundPressed};
  }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll also want to ensure that these do not apply when the component is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@brianchristopherbrady brianchristopherbrady merged commit 2de60ae into web-components-v3 Feb 24, 2023
@brianchristopherbrady brianchristopherbrady deleted the user/brianbrady/web-component-switch branch February 24, 2023 00:29
chrisdholt pushed a commit that referenced this pull request Apr 29, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 29, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit to radium-v/fluentui that referenced this pull request Apr 30, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request Apr 30, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 2, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 2, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 2, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 3, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 6, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 6, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 8, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
radium-v pushed a commit that referenced this pull request May 10, 2024
* switch init

* provides export path

* yarn change

* removes dead code

* adds table docs

* updates attribute to use attr syntax

* removes on/off text for label only

* addresses PR feedback

* updates label font-weight

* removes dead code

* updates styles

* adds required styles for switch

* Update change/@fluentui-web-components-a74d6518-0d94-4e22-bd9f-70ea63a066ab.json

Co-authored-by: Miroslav Stastny <[email protected]>

* removes unuses import

* api report

* removes dead code

* updates styles and story

* optimizes styles

* reverts api report

* removes unchecked checked message styles

* updates labelPosition type to include undefined

* updates helper import

* optimizes css

* cleans up styles

* optimizes styles

* uses design tokens

* removes dead import

* removes dead code

* removes required styling from label

* adds switch readme

* fixes docs

* fixes switch hover styles

* formats switch styles

* alphabetizes exports

---------

Co-authored-by: Miroslav Stastny <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants