|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## [Unreleased] |
| 4 | + |
| 5 | +A focus on improving the ergonomics of `createOptions` to cover more use cases |
| 6 | +whilst maintaining a good level of opinionated sensible defaults. Check out the |
| 7 | +updated https://solid-select.com for examples of the new behaviour in action. |
| 8 | + |
| 9 | +### Added |
| 10 | + |
| 11 | +- Support passing a `ref` to `Select`. Useful for explicitly controlling focus |
| 12 | + on the control. Passed down to `input` rather than control/container as the |
| 13 | + input is the focusable element. |
| 14 | + |
| 15 | +- Add ability to customise filtering logic by passing a function as `filterable` |
| 16 | + parameter for `createOptions`. |
| 17 | + |
| 18 | +- Support custom formatting in `createOptions` by passing a `format` function as |
| 19 | + a new parameter. This can be used to control the created option labels as well |
| 20 | + as how the value is displayed when selected. |
| 21 | + |
| 22 | + As part of this, metadata is also passed to the `format` function to allow |
| 23 | + customising aspects that were previously hardcoded (such as the "Create" |
| 24 | + string when `creatable` is used or the highlighted elements from |
| 25 | + `filterable`). |
| 26 | + |
| 27 | + It is now possible to fully localise all text using this approach as well as |
| 28 | + mix highlighted text with other option elements (such as icons) for a richer |
| 29 | + filtering experience. |
| 30 | + |
| 31 | + A `defaultFormat` function is also exported for reuse / blending into custom |
| 32 | + logic. |
| 33 | + |
| 34 | +- Add control over how text is extracted from an option's value in |
| 35 | + `createOptions`. Pass a custom `extractText` function to handle the |
| 36 | + extraction. It's result will be stored on the option under the `text` |
| 37 | + parameter and then used for existence comparison as well as filtering |
| 38 | + comparison. |
| 39 | + |
| 40 | +- Support returning an array of options from `createable` in `createOptions` for |
| 41 | + cases where multiple options might be candidates for creation from a single |
| 42 | + input string. |
| 43 | + |
| 44 | +### Changed |
| 45 | + |
| 46 | +- Move to custom `createable` function in `createOptions` the decision on when |
| 47 | + to show a "create" option based on existing options. |
| 48 | + |
| 49 | + As a convenience, the `createable` function will be passed an `exists` boolean |
| 50 | + parameter (computed by checking the extracted text of each option against the |
| 51 | + current input string), but it will be up to the `createable` function what to |
| 52 | + do with this. In other words, the `createable` function will now _always_ be |
| 53 | + called on input value change, whereas previously it was only called if the |
| 54 | + exist check passed internally. The function is also passed the current options |
| 55 | + to be displayed if custom checks are desired. |
| 56 | + |
| 57 | + The `creatable` function can then return `undefined` (or an empty list) to |
| 58 | + prevent a "create" option being added. |
| 59 | + |
| 60 | + To avoid this being a backwards incompatible change that could cause |
| 61 | + unintended issues (duplicate values being created), solid-select will attempt |
| 62 | + to detect if the `createable` function passed has been updated to accept the |
| 63 | + new `exists` parameter. If it hasn't, then a warning is issued and the exist |
| 64 | + check internally will prevent calling the function. |
| 65 | + |
| 66 | +- Pass `disable` function on `createOptions` the keyed value rather than full |
| 67 | + object when a `key` parameter is also supplied. |
| 68 | + |
| 69 | +- Improve out-of-the-box styling so that `Select` renders nicer without |
| 70 | + customisation. For example, background colour of select and option list now |
| 71 | + defaults to white and children of select have sensible border and sizing |
| 72 | + defaults. |
| 73 | + |
| 74 | +- Support extracting `fuzzySort` target ("key") via function. Useful when a |
| 75 | + consumer wants to sort on a nested key directly rather than use the extracted |
| 76 | + text of an option. |
| 77 | + |
| 78 | +- Attempt to improve typings and make more explicit the differntiation between |
| 79 | + different similarly named types (e.g. the `Select` option and `createOptions` |
| 80 | + option). Some of these typing are not also exported for direct reuse. |
| 81 | + |
| 82 | +- Modernise tooling for library build and packaging. Notably use pnpm as default |
| 83 | + packagae manager, switch from rollup to tsup for builds, drop commonjs support |
| 84 | + and use plain CSS rather than unnecessarily generate `style.css` through the |
| 85 | + now sunsetted windicss tool. |
| 86 | + |
| 87 | +### Fixed |
| 88 | + |
| 89 | +- Fix some styling issues such as focus outlines not being properly applied and |
| 90 | + border radius being clipped by container. |
| 91 | + |
| 92 | +- Update typings to correctly represent the supported functionality of returning |
| 93 | + elements from a custom `format` function. Thanks to |
| 94 | + [LouisLuBrain](https://github.com/LouisLuBrain) for the fix. |
| 95 | + |
| 96 | +- Avoid Apple devices stealing focus through autocorrect suggestions by setting |
| 97 | + `autoCorrect` to `off` on `Input` component. Thanks to |
| 98 | + [MaAlkhalaf](https://github.com/MaAlkhalaf) for the fix. |
| 99 | + |
3 | 100 | ## [0.14.0] - 2023-04-09 |
4 | 101 |
|
5 | 102 | A major refactor to more clearly separate out the core and the builtin |
|
0 commit comments