You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Drop usage of `nanoid`
* Drop Less.js support
* Update style format dependencies
* Add `getOptionLabel` and `getOptionValue` props
Resolves#208.
* Update links to latest React docs
* Update options document
* Organize links
* Mention the loss of `id` on some children
* Split `simpleValue={false}` into its own wrapper component
Having both `simpleValue={true}` and simplevalue={false}` mixed into the core component logic made things messy and unwiedly. By separating concerns, the primary component becomes simpler and easier to maintain.
* Fix lint error
* Make default filter utilize `getOptionLabel`
* Minor rearrangement
* Merge missing keys in `icons` and `lang` with default
* Split `filterPlaceholder` by control key
* Add async search example
This takes a lot of inspiration from #155 by @saltovo.
Co-Authored-By: saltovo <46911969+saltovo@users.noreply.github.com>
* Remove unnecessary state derivation
* Remove extra lines
* Prevent race conditions in `LazyFilterExample`
* Add padding on no options text
* Convert main component into function
* Fix linting error
* Favor selected/available over right/left
Left/right are can be incorrect in certain arrangements. Consistent use of "available" and "selected" is unambiguous and precise, if wordy.
This is unfortunately a major backwards compatibility breakage, but is necesary to make the underyling code and markup more precise and semantic.
* Add migration guide
* Simplify button positioning
* Simplify filter component
* Simplify Action component
* Simplify `showHeaderLabels` logic
* Add additional breaking change to CHANGELOG
* Add more contrast and visibility of text
* Make CHANGELOG language cleaner
* Drop support for React before v16.8
Hooks did not exist before this version.
* Fix bug when double-clicking optgroups
* Make positive changes more prominent
* Remove no longer necessary Unicode escaping
* Default to `'fa6'` for `iconsClass`
Also update CDN links to latest version.
* Put breaking changes first
* Fix matrix resolution
* Drop usage of depreacted `defaultProps`
This necessitated some clever workarounds to share default property values between the main component and `ObjectValueWrapper`. In the end, we have added back in the `simpleValue` property, thus reducing BC breakage.
Resolves#248.
* Improve accessibility of required error
* Conform changelog to a more standardized format
* Fix `required` test
* Change filter input to `type="search"`
Resolves#247.
* Fix example buttons on smaller widths
* Update dependencies
* Slightly improve descriptions and names
* Prefer order over index
* Extract `mergeRefs` into its own function
* Make `userSelections` return label, value, and index
Resolves#230.
* Update dependencies
* Release v6.0
---------
Co-authored-by: saltovo <46911969+saltovo@users.noreply.github.com>
_This new version includes a variety of breaking changes. Please review them before upgrading._
6
+
7
+
### Added
8
+
9
+
* Add `getOptionLabel` and `getOptionValue` properties to allow for custom keys beyond `label` and `value` (#208)
10
+
* Add `LazyFilterExample.jsx` to demonstrate lazy loading for the `options` property by user search
11
+
12
+
### Changed
13
+
14
+
***Breaking:**`onChange` property: the second argument now returns objects with `label`, `index`, and `value`, instead of just values (#230)
15
+
***Breaking:**`icons` property:
16
+
* Will now merge any missing keys with the default icons
17
+
* Rename `moveLeft`, `moveAllLeft`, `moveRight`, and `moveAllRight` to `moveToAvailable`, `moveAllToAvailable`, `moveToSelected`, and `moveAllToSelected`
18
+
***Breaking:**`iconsClass` property: now defaults to `'fa6'`
19
+
***Breaking:**`id` property: no longer defaults to a random UUID when null and no longer used for some child components
20
+
***Breaking:**`lang` property:
21
+
* Will now merge any missing keys with the default language
22
+
* Rename `moveLeft`, `moveAllLeft`, `moveRight`, and `moveAllRight` to `moveToAvailable`, `moveAllToAvailable`, `moveToSelected`, and `moveAllToSelected`
23
+
* Split `filterPlaceholder` into `availableFilterPlaceholder` and `selectedFilterPlaceholder`
24
+
***Breaking:**`options` property: no longer has PropTypes validation for `label` and `value` (#208)
25
+
***Breaking:** Rename `*-right` and `*-left` classes to `*-to-selected` and `*-to-available`
26
+
* Improve accessibility of required error
27
+
* Change filter input to `type="search"` (#247)
28
+
29
+
### Removed
30
+
31
+
***Breaking:** Drop support for Less.js styles
32
+
***Breaking:** Drop support for React before v16.8
33
+
***Breaking:** Remove `rdl-sr-only` class
34
+
* Drop usage of deprecated `defaultProps` (#248)
35
+
36
+
### Fixed
37
+
38
+
* Fix positioning of action buttons relative to the list boxes
39
+
* Prevent situation where double-clicking an `optgroup` moved any selected options under it
40
+
41
+
### `icons` and `lang` Migration Guide
42
+
43
+
The keys `moveLeft`, `moveAllLeft`, `moveRight`, and `moveAllRight` are now `moveToAvailable`, `moveAllToAvailable`, `moveToSelected`, and `moveAllToSelected` in all instances. Refer to the table below to rename any affected `icons` or `lang` keys:
The `DualListBox` is a [controlled] component, so you have to update the `selected` property in conjunction with the `onChange` handler if you want the selected values to change.
44
+
The `DualListBox` is a [controlled][react-controlled] component, so you have to update the `selected` property in conjunction with the `onChange` handler if you want the selected values to change.
| `options` | array | **Required**. Specifies the list of options that may exist on either side of the dual list box. | |
247
-
| `onChange` | function | **Required**. The handler called when options are moved to either side: `function(selected, selection, controlKey) {}`. | |
247
+
| `onChange` | function | **Required**. The handler called when the selected options change: `function(selected, selection, controlKey) {}`. | |
248
248
| `alignActions` | string | A value specifying whether to align the action buttons to the `'top'` or `'middle'`. | `middle` |
249
249
| `allowDuplicates` | bool | If true, duplicate options will be allowed in the selected list box. | `false` |
250
250
| `available` | array | A subset of the `options` array to optionally filter the available list box. | `undefined` |
251
-
| `availableRef` | function | A React function [ref] to the "available" list box. | `null` |
251
+
| `availableRef` | function | A React function [ref][react-ref] to the "available" list box. | `null` |
252
252
| `canFilter` | bool | If true, search boxes will appear above both list boxes, allowing the user to filter the results. | `false` |
253
253
| `className` | string | An optional `className` to apply to the root node. | `null` |
254
254
| `disabled` | bool | If true, both "available" and "selected" list boxes will be disabled. | `false` |
255
255
| `filter` | object | A key-value map of `{ available: [value], selected: [value] }` to control the filter values (defaults to uncontrolled). | `null` |
256
256
| `filterCallback` | function | The filter function to run on a given option and input string: `function(option, filterInput) {}`. See **Filtering**. | `() => { ... }` |
257
+
| `getOptionLabel` | function | The function to resolve the **label** from an option. Defaults to `option=>option.label`. | `() => { ... }` |
258
+
| `getOptionValue` | function | The function to resolve the **value** from an option. Defaults to `option=>option.value`. | `() => { ... }` |
257
259
| `htmlDir` | string | The [directionality][mdn-directionality] of the component's elements. Set to `'rtl'` if using a right-to-left language. | `'ltr'` |
258
260
| `icons` | object | A key-value pairing of action icons and their React nodes. See **Changing the Default Icons** for further info. | `{ ... }` |
259
-
| `iconsClass` | string | A value specifying which overarching icon class to use. Built-in support for `fa5`, `fa6`, and `native` icons. | `'fa5'` |
261
+
| `iconsClass` | string | A value specifying which overarching icon class to use. Built-in support for `fa5`, `fa6`, and `native` icons. | `'fa6'` |
260
262
| `id` | string | An HTML ID prefix for the various sub elements. | `null` |
261
263
| `lang` | object | A key-value pairing of localized text. See [`src/js/lang/default.js`][lang-file] for a list of keys. | `{ ... }` |
262
264
| `moveKeys` | array | A list of [keyboard keys][mdn-key] that will trigger a toggle of the highlighted options. | `['', 'Enter']` |
| `preserveSelectOrder` | bool | If true, the order in which the available options are selected are preserved when the items are moved to the right. | `false` |
266
268
| `required` | bool | If true, this component will require `selected` to be non-empty to pass a form validation | `false` |
267
269
| `selected` | array | A list of the selected options appearing in the rightmost list box. | `[]` |
268
-
| `selectedRef` | function | A React function [ref] to the "selected" list box. | `null` |
269
-
| `simpleValue` | bool | If true, the `selected` value passed in `onChange` is an array of string values. Otherwise, it is an array of options. | `true` |
270
+
| `selectedRef` | function | A React function [ref][react-ref] to the "selected" list box. | `null` |
270
271
| `showHeaderLabels` | bool | If true, labels above both the available and selected list boxes will appear. These labels derive from `lang`. | `false` |
271
272
| `showNoOptionsText` | bool | If true, text will appear in place of the available/selected list boxes when no options are present. | `false` |
272
273
| `showOrderButtons` | bool | If true, a set of up/down buttons will appear near the selected list box to allow the user to re-arrange the items. | `false` |
274
+
| `simpleValue` | bool | If true, the `selected` value passed in `onChange` is an array of string values. Otherwise, it is an array of options. | `true` |
0 commit comments