-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unused function * Support for complex options, using objects with label and value instead of strings * Better typing for isTextInSelectedOptions value (boolean instead of truthy/falsy) * Stricter value type: Only accept string values. This will work better with the allowNewValues prop, and simplify returning a value from onToggleSelected. * More JSDoc * Add test for complex options with label and value * Add example for complex options on the aksel-website * yarn.lock * Remove other properties than label and value from Combobox options in Storybook-examples, as we have limited the format for now * Array.includes does not work with objects, so should use isInList utility function. Fixes missing checkmark for selected items in FilteredOptions. * Add changeset * Remove navds-dependencies in playroom that break playwright tests. These are outdated/unsynced, and will be inherited from parent package.json instead. * Do not try to remove an undefined option * "it" is from jest. Use "test" instead. * Update @navikt/core/react/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx Co-authored-by: Halvor Haugan <[email protected]> * Update @navikt/core/react/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx Co-authored-by: Halvor Haugan <[email protected]> * Update @navikt/core/react/src/form/combobox/Input/Input.tsx Co-authored-by: Halvor Haugan <[email protected]> * Update @navikt/core/react/src/form/combobox/types.ts Co-authored-by: Halvor Haugan <[email protected]> * Raise change level to minor, to signal the new feature * Spread props instead of adding them separately * JSDoc @returns doesn't do anything without a value specified, and neither of these return a value * Options are used for multiple features, so will just skip specifying them * Doesn't need a guaranteed unique ID for storybook examples. Use hard-coded instead. * selectedOptions is a list of strings anyhow, so should just use the value * More realistic example for complex options, where the option label is larger, and the SelectedOptions label uses a short code (the value) Also made the isInList function better, by checking both label and value when checking ComboboxOptions. Pass just the value or just the label if you only want to check either of them. * Add tests for mapToComboboxOptionArray (renamed from mapFromStringArrayToComboboxOptionArray) * Add test for toComboboxOption and use this function in mapToComboboxOptionArray * Update combobox unit test for complex options to use a more realistic example * Don't say anything about what might be added in the future. That doesn't belong in the documentation * Oppdater beskrivelsen for complex options-eksempelet (var kopiert fra annet eksempel) * Fix Storybook example bug where de-selecting a value selected it an extra time * Fix example * Remove listing options because it breaks with allowNewValues * Revert earlier change that always showed selected values in FilteredOptions, even if it didn't match the search text. This broke autocomplete. * Remove unneccessary optional check * yarn.lock * Don't need to use toLocaleLowerCase --------- Co-authored-by: Ken <[email protected]> Co-authored-by: Halvor Haugan <[email protected]>
- Loading branch information
1 parent
aebba20
commit 2ea2a91
Showing
15 changed files
with
393 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@navikt/ds-react": minor | ||
--- | ||
|
||
Allow Combobox options as objects to support separate display text and value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.