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(DrawerList, Dropdown, Autocomplete, Field.Selection, Field.ArraySelection): disabled options #4154

Merged
merged 14 commits into from
Nov 19, 2024

Conversation

snorrekim
Copy link
Contributor

@snorrekim snorrekim commented Oct 18, 2024

  • Individual entries in DrawerList can now be disabled
  • Works with Dropdown, Autocomplete, Field.Selection, and Field.ArraySelection

Other changes:

  • selected_key prop deprecated and can be replaced by selectedKey
  • Updated types for DrawerList props
  • value also checks index if no selectedKey is a match
  • title overrides children in Field.Option used by Field.Selection and Field.ArraySelection

Copy link

vercel bot commented Oct 18, 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 19, 2024 11:31am

Copy link

codesandbox-ci bot commented Oct 18, 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.

@snorrekim
Copy link
Contributor Author

snorrekim commented Oct 22, 2024

Discussion conclusions:

  • DONE: add comment @deprecated to deprecated types
  • PARTIALLY DONE: since selected_key is deprecated, we should remove it from code and only transform it on the prop level. But this might be difficult if we export helper functions.
    • Just added deprecated warnings. There is too much complexity. But we should do a seperate PR on updating all selected_key documentation at least.
  • DONE: JSON stringified data should be considered "semi-deprecated". Reduce documentation to a footnote.
  • DONE: Check again why title should not override children
    • Edit: It's because the original Field.Option component prioritizes children Should we change that. The component isn't actually something that is supposed to be used o like that. It never actually render any html, it's just a prop repository.
  • Future suggestion: Record data could allow same item as array, instead of just content.

@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from 1311ee1 to ef84dd5 Compare October 22, 2024 12:07
@snorrekim snorrekim changed the title Feat/drawer list disabled options feat(DrawerList, Dropdown, Autocomplete, Field.Selection, FieldArraySelection): disabled options Oct 23, 2024
@snorrekim snorrekim changed the title feat(DrawerList, Dropdown, Autocomplete, Field.Selection, FieldArraySelection): disabled options feat(DrawerList, Dropdown, Autocomplete, Field.Selection, Field.ArraySelection): disabled options Oct 23, 2024
@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from 427012b to 1f47493 Compare October 24, 2024 15:33
@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from 1f47493 to 9f924ee Compare October 25, 2024 13:08
@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from 9f924ee to fe919c5 Compare November 4, 2024 11:14
@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from fe919c5 to b961525 Compare November 4, 2024 12:02
@snorrekim snorrekim force-pushed the feat/drawer-list-disabled-options branch from b961525 to 6c9cf09 Compare November 6, 2024 15:08
@snorrekim snorrekim marked this pull request as ready for review November 6, 2024 15:32
@snorrekim snorrekim marked this pull request as draft November 7, 2024 11:47
@snorrekim snorrekim marked this pull request as ready for review November 7, 2024 14:34
@tujoworker tujoworker requested a review from langz November 11, 2024 09:48
Copy link
Member

@tujoworker tujoworker left a comment

Choose a reason for hiding this comment

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

Very good work so far 👌

Copy link
Member

@tujoworker tujoworker left a comment

Choose a reason for hiding this comment

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

Very good improvements and good to have finally the disabled state 👏

@snorrekim snorrekim merged commit 8786d5d into main Nov 19, 2024
10 checks passed
@snorrekim snorrekim deleted the feat/drawer-list-disabled-options branch November 19, 2024 15:01
tujoworker pushed a commit that referenced this pull request Nov 22, 2024
## [10.57.0](v10.56.0...v10.57.0) (2024-11-22)

### 📝 Documentation

* **Field.Upload:** adds `asyncFileHandler` property ([#4288](#4288)) ([fb09758](fb09758))
* **Field.Upload:** adds asyncFileHandler property ([7ccdabd](7ccdabd))

### 🐛 Bug Fixes

* **Forms:** align Value.SummaryList when Value.* has no label ([#4311](#4311)) ([b6621c2](b6621c2))
* **Forms:** ensure fields inside composition share submit indicator ([#4309](#4309)) ([e726e20](e726e20))
* **Forms:** safeguard errorMessages to avoid infinite loops when not wrapped in useMemo ([#4305](#4305)) ([f14bacc](f14bacc))
* **Forms:** show indicator with async onBlurValidator call when `validateInitially` is used ([#4303](#4303)) ([c585491](c585491))
* **Icon:** ensure icon name is rendered as `data-testid` ([#4304](#4304)) ([235b823](235b823))

### ✨ Features

* **Card, Section:** add `outset` property for moderate layout breakout ([#4317](#4317)) ([6008d9a](6008d9a))
* **DrawerList, Dropdown, Autocomplete, Field.Selection, Field.ArraySelection:** disabled options ([#4154](#4154)) ([8786d5d](8786d5d))
* **Field.Upload:** adds support for async and sync fn in `fileHandler` ([#4294](#4294)) ([2cc816a](2cc816a))
* **Forms:** add `Form.Card` with different default appearance than Card (use `Form.Card` in forms instead of Card) ([#4318](#4318)) ([7bbc0ca](7bbc0ca))
* **Forms:** add `labelSrOnly` to Value.* components ([#4319](#4319)) ([46f68ae](46f68ae)), closes [#4311](#4311)
* **Forms:** deprecate `validator` in favor of `onChangeValidator` ([#4314](#4314)) ([5a06b2e](5a06b2e))
* **Typography:** add general `.dnb-t` helper classes and add typography props to Span ([#4235](#4235)) ([9dfe66d](9dfe66d))
@tujoworker
Copy link
Member

🎉 This PR is included in version 10.57.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

/** @deprecated use `DrawerListDataArrayObject` */
export type DrawerListDataObject = DrawerListDataArrayObject;
export type DrawerListDataArrayObject = {
[customProperty: string]: unknown;
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment as reference

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.

3 participants