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

components: Added indeterminate checkbox #2419

Merged
merged 5 commits into from
Apr 28, 2023

Conversation

dev-cj
Copy link
Contributor

@dev-cj dev-cj commented Apr 25, 2023

Checkbox path is sourced from Material Design (same as the other ones)

theme-ui2.mp4

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 25, 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 74f32e8:

Sandbox Source
next-theme-ui-example Configuration
gatsby-plugin-theme-ui-example Configuration

@vercel
Copy link

vercel bot commented Apr 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
theme-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2023 11:52am

@@ -76,7 +100,7 @@ export const Checkbox: ForwardRef<HTMLInputElement, CheckboxProps> =
}}
/>
<Box
as={CheckboxIcon}
as={(SVGProps) => CheckboxIcon({ isIndeterminate, ...SVGProps })}
Copy link
Member

Choose a reason for hiding this comment

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

This won't be a performance problem here, but we usually wouldn't want to create new components like this.

Could we use the :indeterminate pseudoclass for with general sibling combinator ~ to control what's displayed, just like we use :checked right now?

Copy link
Contributor Author

@dev-cj dev-cj Apr 26, 2023

Choose a reason for hiding this comment

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

I tried that first, but the attribute indeterminate on input cannot be set directly using HTML . And since none of the other components were performing side effects using hooks, I used this approach.

Copy link
Member

Choose a reason for hiding this comment

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

All right, so I suppose we have a few choices.

  1. We can either leave it as it is,
  2. Stop doing <Box as={CheckboxIcon}> and use <CheckboxIcon indeterminate={indeterminate} instead with the common props for all icons moved inside of CheckboxIcon
  3. Maybe even inline CheckboxIcon and see if we can gain something by removing this layer of abstraction
  4. or use a hook like you mentioned

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can go with the second option and use <CheckboxIcon indeterminate={indeterminate} as you said.

Copy link
Member

Choose a reason for hiding this comment

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

Nice! I like this approach. Sorry for being so annoying here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries,
Have made the changes.

Copy link
Member

@hasparus hasparus left a comment

Choose a reason for hiding this comment

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

Huge thanks for the PR! It's looking good, and I really appreciate the video.

I left some small comments.

@hasparus
Copy link
Member

Nice one @dev-cj! Feel free to just update the snapshot with jest -u. Your version of the snapshot is better — the previous one had a few duplicate properties.

@hasparus
Copy link
Member

Nice work! I'm merging to develop and will follow up in a stable release later today/this-weekend.

@hasparus hasparus merged commit 3223756 into system-ui:develop Apr 28, 2023
@hasparus hasparus added the prerelease This change is available in a prerelease. label Apr 29, 2023
@hasparus
Copy link
Member

🚀 PR was released in v0.15.8 🚀

@hasparus hasparus added released This issue/pull request has been released. and removed prerelease This change is available in a prerelease. labels Apr 29, 2023
@vkaragyaurov
Copy link

Hey, guys!

I was looking for the indeterminate state and found this PR. It says merged and released, but it doesn't seem present in the current version. I found no mentions of reverting it in the changelog, nor in the git history. After digging a bit more it looks like these changes were deleted by Merge branch 'develop' into stable. Any idea if this was intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants