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

feat(Forms): introduce decoupleForm prop to Form.Handler #4332

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Nov 24, 2024

This change allows devs to use the data context in a more flexible way:

Before:

<App>
  <AppRelatedThings>
    <Form.Handler> 👈 Data context, form element and status message
      ...
    </Form.Handler>
  </AppRelatedThings>
</App>

After:

<App>
  <Form.Handler decoupleForm> 👈 Data context
    <AppRelatedThings>
      <Form.Element> 👈 form element and status message
        ...
      </Form.Element>
    </AppRelatedThings>
  </Form.Handler>
</App>
  • Add docs

Copy link

vercel bot commented Nov 24, 2024

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

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 25, 2024 0:11am

Copy link

codesandbox-ci bot commented Nov 24, 2024

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.

@langz
Copy link
Contributor

langz commented Nov 24, 2024

Is the word Element important in decoupleFormElement? Or could it just be decoupleForm?

Or detach? detachForm?
disconnect? DisconnectForm?

these are just suggestions

@tujoworker tujoworker force-pushed the feat/forms-nested-context branch from 7aa9142 to 290fdb5 Compare November 25, 2024 08:32
@tujoworker
Copy link
Member Author

tujoworker commented Nov 25, 2024

Is the word Element important in decoupleFormElement?

Since it's the element that detaches, I think it's good to have it. I struggle to come up with something better too. I also thought if we never decouple it from the Form.Handler, but introduce Form.Provider so it can be used with Form.Element, instead of a property. Maybe this approach is easier to communicate?

If so, a dev would could go from:

<App>
  <AppRelatedThings>
    <Form.Handler> 👈 Data context, form element and status message
      ...
    </Form.Handler>
  </AppRelatedThings>
</App>

After:

<App>
  <Form.Provider> 👈 Data context
    <AppRelatedThings>
      <Form.Element> 👈 form element and status message
        ...
      </Form.Element>
    </AppRelatedThings>
  </Form.Provider>
</App>

But then we need to have its own docs for Form.Provider, which is then basically a "copy" of Form.Handler.

@tujoworker tujoworker marked this pull request as ready for review November 25, 2024 08:54
@tujoworker tujoworker requested a review from langz November 25, 2024 08:54
@tujoworker tujoworker force-pushed the feat/forms-nested-context branch from 290fdb5 to 04e40b9 Compare November 25, 2024 11:49
@tujoworker tujoworker force-pushed the feat/forms-nested-context branch from 04e40b9 to 333f939 Compare November 25, 2024 11:51
@tujoworker tujoworker changed the title feat(Forms): introduce decoupleFormElement prop to Form.Handler feat(Forms): introduce decoupleForm prop to Form.Handler Nov 25, 2024
@tujoworker tujoworker merged commit 0b02b6e into main Nov 25, 2024
10 checks passed
@tujoworker tujoworker deleted the feat/forms-nested-context branch November 25, 2024 13:25
tujoworker added a commit that referenced this pull request Nov 25, 2024
tujoworker added a commit that referenced this pull request Nov 25, 2024
tujoworker added a commit that referenced this pull request Nov 25, 2024
tujoworker pushed a commit that referenced this pull request Nov 29, 2024
## [10.58.0](v10.57.1...v10.58.0) (2024-11-29)

### ✨ Features

* **Forms:** add `showConfirmDialog` to Iterate.RemoveButton ([#4330](#4330)) ([76bddf0](76bddf0))
* **Forms:** add `variant="filled"` and `toolbarVariant="custom"` to Iterate.EditContainer and Iterate.ViewContainer ([#4329](#4329)) ([b2b9eef](b2b9eef))
* **Forms:** add support for using a function references instead of a string based id ([#4331](#4331)) ([a6e3bc3](a6e3bc3))
* **Forms:** enhance typing and add docs on how to deal with TypeScript types ([#4343](#4343)) ([10b199b](10b199b))
* **Forms:** introduce `decoupleForm` prop to Form.Handler ([#4332](#4332)) ([0b02b6e](0b02b6e))

### 🐛 Bug Fixes

* **DatePicker:** make sure the picker and input only reacts to the props that have changed ([#4342](#4342)) ([4cd52a3](4cd52a3))
* **Forms.Card:** remove outline when variant="basic" on Section containers when used in Wizard ([#4336](#4336)) ([ebad212](ebad212))
* **forms:** add `sessionStorageId` support to Field.Upload with empty file list rendering ([#4339](#4339)) ([d02a0af](d02a0af))
* **NumberFormat:** improve regex for parsing phone numbers with country codes ([#4340](#4340)) ([96613ed](96613ed)), closes [#4337](#4337)
@tujoworker
Copy link
Member Author

🎉 This PR is included in version 10.58.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants