Skip to content

Commit 6eb3ecf

Browse files
authored
Merge pull request #93 from helpwave/version-0.1.30
feat: change SingleSelectProperty and MultiSelectProperty to allow fo…
2 parents d518205 + 3916349 commit 6eb3ecf

4 files changed

Lines changed: 29 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.30] - 2025-10-03
9+
10+
### Changed
11+
- Changed `SingleSelectProperty` and `MultiSelectProperty` to accept a label
12+
813
## [0.1.29] - 2025-10-02
914

1015
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "git+https://github.com/helpwave/hightide.git"
88
},
99
"license": "MPL-2.0",
10-
"version": "0.1.29",
10+
"version": "0.1.30",
1111
"files": [
1212
"dist"
1313
],

src/components/properties/MultiSelectProperty.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ import type { FormTranslationType } from '../../localization/defaults/form'
88

99
type TranslationType = FormTranslationType
1010

11+
type SelectPropertyOption = {
12+
value: string,
13+
label?: string,
14+
}
15+
1116
export type MultiSelectPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'className'> & {
1217
values: string[],
13-
options: string[],
18+
options: SelectPropertyOption[],
1419
onValuesChanged?: (value: string[]) => void,
1520
}
1621

@@ -46,7 +51,11 @@ export const MultiSelectProperty = ({
4651
})
4752
}}
4853
>
49-
{options.map(value => (<SelectOption key={value} value={value}/>))}
54+
{options.map(option => (
55+
<SelectOption key={option.value} value={option.value}>
56+
{option.label ?? option.value}
57+
</SelectOption>
58+
))}
5059
</MultiSelectChipDisplay>
5160
)}
5261
/>

src/components/properties/SelectProperty.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ import type { FormTranslationType } from '../../localization/defaults/form'
88

99
type SingleSelectPropertyTranslation = FormTranslationType
1010

11-
export type SingleSelectPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'className'> & {
11+
type SelectPropertyOption = {
1212
value: string,
13-
options: string[],
13+
label?: string,
14+
}
15+
16+
export type SingleSelectPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'className'> & {
17+
value?: string,
18+
options: SelectPropertyOption[],
1419
onValueChanged?: (value: string) => void,
1520
onAddNew?: (value: string) => void,
1621
}
@@ -45,7 +50,11 @@ export const SingleSelectProperty = ({
4550
)
4651
}}
4752
>
48-
{options.map(value => (<SelectOption key={value} value={value}/>))}
53+
{options.map(option => (
54+
<SelectOption key={option.value} value={option.value}>
55+
{option.label ?? option.value}
56+
</SelectOption>
57+
))}
4958
</Select>
5059
)}
5160
/>

0 commit comments

Comments
 (0)