Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

feat: Pass all listeners to render function in CFlex, Stack #460

Merged

Conversation

simpletrontdip
Copy link
Contributor

@simpletrontdip simpletrontdip commented Jul 13, 2021

Description

It's quite common for container components like CFlex, CStack to receive custom listeners such as click, blur.
It will be especially helpful and more common to have them when rendering with custom component as prop.
It is more intuitive to have all listeners passed down by default.

As in #452, when rendering CStack as a form, we are unable to receive its onSubmit, then we have to create a wrapper outside CStack, this may break HTML structure and break our CSS selectors, which is not really ideal.

So here, we include all computedListeners into the render function, allow components to receive it.

Closes #452

How Has This Been Tested?

  • I have added some tests to make sure the handler gets called
  • Nothing will affect the current version
  • For the 2 tests file, I've added the describe phrase to make test results more readable

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@changeset-bot
Copy link

changeset-bot bot commented Jul 13, 2021

🦋 Changeset detected

Latest commit: af04f8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chakra-ui/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 13, 2021

@simpletrontdip is attempting to deploy a commit to the Chakra UI Team on Vercel.

A member of the Team first needs to authorize it.

@simpletrontdip simpletrontdip changed the title Pass all listeners to render function in CFlex, Stack feat: Pass all listeners to render function in CFlex, Stack Jul 13, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 13, 2021

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 af04f8b:

Sandbox Source
Chakra UI Vue (0.X) Starter Template Configuration
chakra-ui-nuxt-demo Configuration
optimistic-christian-eovxo Issue #452

@vercel
Copy link

vercel bot commented Jul 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

chakra-ui-vue – ./

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-vue/AJkhsY9w4xcTGQZaTGNH3gu8jJBG
✅ Preview: https://chakra-ui-vue-git-fork-simpletrontdip-stack-cu-4b1fcc-chakra-ui.vercel.app

[Deployment for af04f8b canceled]

Copy link
Collaborator

@codebender828 codebender828 left a comment

Choose a reason for hiding this comment

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

Thank you @simpletrontdip for this PR. It's a great example of what open source should be.

Everything looks solid otherwuse

Will add a changeset and then merge it. Thank you.

@codebender828 codebender828 linked an issue Jul 13, 2021 that may be closed by this pull request
@codebender828 codebender828 self-requested a review July 13, 2021 10:02
Copy link
Collaborator

@codebender828 codebender828 left a comment

Choose a reason for hiding this comment

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

I just noticed that there might be some old snapshots that were not removed in this PR. Not updating them will fail on CI.

You can run yarn run test:core -u tup update the snapshots and then push again. Everything should be fine after that.

@simpletrontdip
Copy link
Contributor Author

I've updated the snapshots, thanks ^^

@vercel vercel bot temporarily deployed to Preview – chakra-ui-vue July 14, 2021 11:43 Inactive
@codebender828 codebender828 merged commit 3a21a95 into chakra-ui:develop Jul 14, 2021
@simpletrontdip simpletrontdip deleted the stack-custom-listeners branch July 14, 2021 14:54
@codebender828
Copy link
Collaborator

@all-contributors please add @simpletrontdip for bugs, code and tests

@allcontributors
Copy link
Contributor

@codebender828

I've put up a pull request to add @simpletrontdip! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can not set @submit when use as="form"
2 participants