@synerise/ds-select 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.5.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-select@1.5.1...@synerise/ds-select@1.5.2) (2026-08-14)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-select
9
+
10
+ ## [1.5.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-select@1.5.0...@synerise/ds-select@1.5.1) (2026-08-13)
11
+
12
+ ### Bug Fixes
13
+
14
+ - honour Option children, optionLabelProp and optionFilterProp in select ([640a1c2](https://github.com/synerise/synerise-design/commit/640a1c27e677de165e195072a22bac891a065fac))
15
+
6
16
  # [1.5.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-select@1.4.0...@synerise/ds-select@1.5.0) (2026-08-11)
7
17
 
8
18
  ### Features
package/CLAUDE.md CHANGED
@@ -153,6 +153,12 @@ Class hooks are `ds-select-*` (`.ds-select`, `.ds-select-selection-item`, `.ds-s
153
153
  - **Option resolution** — `useSelectOptions` returns `resolvedOptions` (from `options` prop, else
154
154
  `getOptionsFromChildren(children)`) and `displayedOptions` (after client filtering and, in `tags`
155
155
  mode, a create-row prepended for the typed text). `filterOption={false}` disables local filtering.
156
+ - **Row vs selector display (antd parity)** — the dropdown row renders `option.children ?? label ??
157
+ value`, the selector renders the field named by `optionLabelProp` (`label`, `children`, `value`,
158
+ `title`, …) and falls back to `label`. So `<Option label={compact}>{rich}</Option>` shows `rich` in
159
+ the list and `compact` in the selector, while options-as-data (no children) uses `label` for both.
160
+ - **Filtering** — `defaultFilter` matches the field named by `optionFilterProp` (`title`, `children`,
161
+ `value`, …), else `label` then `children`; non-string fields (JSX nodes) fall back to the value.
156
162
  - **`Option.value` is optional** — falls back to the element's React `key` (antd parity); callbacks
157
163
  expose `option.key`.
158
164
  - **Keyboard nav is hand-rolled (not ds-dropdown's)** — Select is a *combobox*: focus stays on the
package/dist/Select.js CHANGED
@@ -174,10 +174,16 @@ const SelectInner = forwardRef((props, ref) => {
174
174
  const $size = size === "large" ? "large" : "default";
175
175
  const labelFor = (v) => {
176
176
  const option = findOption(resolvedOptions, v);
177
- if (option && optionLabelProp === "value") {
178
- return option.value;
177
+ if (!option) {
178
+ return v;
179
179
  }
180
- return option?.label ?? v;
180
+ if (optionLabelProp) {
181
+ const custom = option[optionLabelProp];
182
+ if (custom !== void 0) {
183
+ return custom;
184
+ }
185
+ }
186
+ return option.label ?? v;
181
187
  };
182
188
  const setOpen = (next) => {
183
189
  if (isDisabled) {
@@ -14,12 +14,12 @@ export type SelectOption = {
14
14
  value: RawValueType;
15
15
  /** antd-parity alias of `value`; some consumers read `option.key` in callbacks. */
16
16
  key?: RawValueType;
17
- /** Rendered content in the dropdown row (and the selector unless `optionLabelProp` picks another field). */
17
+ /** Selector display, and the dropdown row too unless `children` carries its own content. */
18
18
  label?: ReactNode;
19
19
  disabled?: boolean;
20
20
  /** Native `title` on the option (hover tooltip / accessible text), mirrors antd. */
21
21
  title?: ReactNode;
22
- /** antd parity: raw children of `<Select.Option>`; some consumers read `option.children`. */
22
+ /** Raw children of `<Select.Option>` the dropdown row content (antd parity). */
23
23
  children?: ReactNode;
24
24
  /** antd parity: forwarded to the rendered option row. */
25
25
  style?: CSSProperties;
@@ -25,7 +25,25 @@ const OptionList = ({
25
25
  }, children: loading ? /* @__PURE__ */ jsx(Loading, { className: "ds-select-loading", children: /* @__PURE__ */ jsx(Loader, { size: "M" }) }) : options.length === 0 ? /* @__PURE__ */ jsx(NotFound, { className: "ds-select-empty", children: notFoundContent }) : /* @__PURE__ */ jsx(ScrollList, { children: /* @__PURE__ */ jsx(Scrollbar, { absolute: true, maxHeight: Number(listHeight) || DEFAULT_LIST_HEIGHT, onScroll: onPopupScroll ? (event) => onPopupScroll(event) : void 0, children: /* @__PURE__ */ jsx(Inner, { role: "listbox", id: listboxId, "aria-multiselectable": isMultiple || void 0, children: options.map((option, index) => {
26
26
  const isSelected = selectedValues.includes(option.value);
27
27
  const optionAttrs = Object.fromEntries(Object.entries(option).filter(([key]) => key.startsWith("data-") || key.startsWith("aria-")));
28
- return /* @__PURE__ */ jsx(OptionItem, { id: optionDomId(index), role: "option", className: cx("ds-select-item-option", isSelected && "ds-select-item-option-selected", index === activeIndex && "ds-select-item-option-active"), selected: isSelected, "aria-selected": isSelected, "data-testid": "select-option", title: typeof option.title === "string" ? option.title : void 0, text: option.label ?? option.value, style: option.style, disabled: option.disabled, onMouseEnter: () => onOptionActivate(index), onClick: () => onOptionSelect(option), ...optionAttrs }, rowKey ? rowKey(option) : option.value);
28
+ return /* @__PURE__ */ jsx(
29
+ OptionItem,
30
+ {
31
+ id: optionDomId(index),
32
+ role: "option",
33
+ className: cx("ds-select-item-option", isSelected && "ds-select-item-option-selected", index === activeIndex && "ds-select-item-option-active"),
34
+ selected: isSelected,
35
+ "aria-selected": isSelected,
36
+ "data-testid": "select-option",
37
+ title: typeof option.title === "string" ? option.title : void 0,
38
+ text: option.children ?? option.label ?? option.value,
39
+ style: option.style,
40
+ disabled: option.disabled,
41
+ onMouseEnter: () => onOptionActivate(index),
42
+ onClick: () => onOptionSelect(option),
43
+ ...optionAttrs
44
+ },
45
+ rowKey ? rowKey(option) : option.value
46
+ );
29
47
  }) }) }) }) });
30
48
  export {
31
49
  OptionList
@@ -5,5 +5,5 @@ export declare const DEFAULT_LIST_HEIGHT = 256;
5
5
  export declare const cx: (...classes: (string | false | undefined)[]) => string;
6
6
  /** Normalise a `SelectValue` to an array of raw values. */
7
7
  export declare const toArray: (value: SelectValue) => RawValueType[];
8
- /** Built-in filter: case-insensitive substring on `optionFilterProp` (or label/value). */
8
+ /** Built-in filter: case-insensitive substring on `optionFilterProp` (or label/children/value). */
9
9
  export declare const defaultFilter: (optionFilterProp?: string) => FilterOptionFn;
@@ -7,7 +7,8 @@ const toArray = (value) => {
7
7
  return Array.isArray(value) ? value : [value];
8
8
  };
9
9
  const defaultFilter = (optionFilterProp) => (input, option) => {
10
- const haystack = optionFilterProp === "value" ? String(option.value) : typeof option.label === "string" ? option.label : String(option.value);
10
+ const candidates = optionFilterProp ? [option[optionFilterProp]] : [option.label, option.children];
11
+ const haystack = candidates.find((candidate) => typeof candidate === "string") ?? String(option.value);
11
12
  return haystack.toLowerCase().includes(input.toLowerCase());
12
13
  };
13
14
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-select",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Select UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -42,10 +42,10 @@
42
42
  ],
43
43
  "types": "dist/index.d.ts",
44
44
  "dependencies": {
45
- "@synerise/ds-dropdown": "^1.3.22",
45
+ "@synerise/ds-dropdown": "^1.3.23",
46
46
  "@synerise/ds-form-field": "^1.3.25",
47
47
  "@synerise/ds-icon": "^1.18.5",
48
- "@synerise/ds-list-item": "^1.6.3",
48
+ "@synerise/ds-list-item": "^1.6.4",
49
49
  "@synerise/ds-loader": "^1.0.18",
50
50
  "@synerise/ds-scrollbar": "^1.5.2",
51
51
  "@synerise/ds-tooltip": "^1.5.5",
@@ -58,5 +58,5 @@
58
58
  "styled-components": "^5.3.3",
59
59
  "vitest": "4"
60
60
  },
61
- "gitHead": "6df24ed12cd5f276d8eccde730591807982e3385"
61
+ "gitHead": "fbaec1b62812804ecab17db27553c2071c7bad49"
62
62
  }