Skip to content

Commit 5fa0972

Browse files
authored
refactor(Options): Merge pull request #31 from DanielleHuisman/fix/option-defaults
Remove defaults for optionLabel and optionValue props BREAKING CHANGE: OptionLabel or OptionValue has to be set
2 parents dc9010b + dd8d4ec commit 5fa0972

File tree

9 files changed

+32
-8
lines changed

9 files changed

+32
-8
lines changed

src/formkit/PrimeDropdown.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
3131
:aria-label="attrs.ariaLabel"
3232
:aria-labelledby="attrs.ariaLabelledby"
3333
:options="attrs.options"
34-
:option-label="attrs.optionLabel ?? 'label'"
35-
:option-value="attrs.optionValue ?? 'value'"
34+
:option-label="attrs.optionLabel"
35+
:option-value="attrs.optionValue"
3636
:option-disabled="attrs.optionDisabled"
3737
:option-group-label="attrs.optionGroupLabel"
3838
:option-group-children="attrs.optionGroupChildren"

src/formkit/PrimeListbox.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
2626
:aria-label="attrs.ariaLabel"
2727
:aria-labelledby="attrs.ariaLabelledby"
2828
:options="attrs?.options"
29-
:option-label="attrs.optionLabel ?? 'label'"
30-
:option-value="attrs.optionValue ?? 'value'"
29+
:option-label="attrs.optionLabel"
30+
:option-value="attrs.optionValue"
3131
:multiple="attrs.multiple ?? false"
3232
:filter="attrs.filter ?? false"
3333
:filter-icon="attrs.filterIcon"

src/formkit/PrimeMultiSelect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
2727
:aria-labelledby="attrs.ariaLabelledby"
2828
:placeholder="attrs.placeholder"
2929
:options="attrs.options"
30-
:option-label="attrs.optionLabel ?? 'label'"
31-
:option-value="attrs.optionValue ?? 'value'"
30+
:option-label="attrs.optionLabel"
31+
:option-value="attrs.optionValue"
3232
:option-disabled="attrs.optionDisabled"
3333
:option-group-label="attrs.optionGroupLabel"
3434
:option-group-children="attrs.optionGroupChildren"

src/formkit/PrimeSelectButton.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
2626
:aria-label="attrs.ariaLabel"
2727
:aria-labelledby="attrs.ariaLabelledby"
2828
:options="attrs.options"
29-
:option-label="attrs.optionLabel ?? 'label'"
30-
:option-value="attrs.optionValue ?? 'value'"
29+
:option-label="attrs.optionLabel"
30+
:option-value="attrs.optionValue"
3131
:option-disabled="attrs.optionDisabled"
3232
:multiple="attrs.multiple ?? false"
3333
:unselectable="attrs.unselectable ?? true"

src/pages/demo/Dropdown.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const schema
1616
name: 'cookie_notice',
1717
label: 'Cookie notice Dropdown',
1818
value: 'hourly',
19+
optionLabel: 'label',
20+
optionValue: 'value',
1921
options,
2022
help: 'Cookie notice frequency ?',
2123
},
@@ -26,6 +28,8 @@ const schema
2628
value: 'hourly',
2729
style: 'background:gray;',
2830
class: 'customClass',
31+
optionLabel: 'label',
32+
optionValue: 'value',
2933
options: [
3034
{ label: 'Every page load', value: 'refresh' },
3135
{ label: 'Every hour', value: 'hourly' },
@@ -40,6 +44,8 @@ const schema
4044
showClear: true,
4145
filter: true,
4246
placeholder: 'Please select',
47+
optionLabel: 'label',
48+
optionValue: 'value',
4349
options,
4450
validation: 'required',
4551
},

src/pages/demo/Listbox.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const schema
1616
name: 'cookie_notice',
1717
label: 'Cookie notice Dropdown',
1818
value: 'hourly',
19+
optionLabel: 'label',
20+
optionValue: 'value',
1921
options,
2022
help: 'Cookie notice frequency ?',
2123
},
@@ -26,6 +28,8 @@ const schema
2628
value: 'hourly',
2729
style: 'background:gray;',
2830
class: 'customClass',
31+
optionLabel: 'label',
32+
optionValue: 'value',
2933
options: [
3034
{ label: 'Every page load', value: 'refresh' },
3135
{ label: 'Every hour', value: 'hourly' },
@@ -40,6 +44,8 @@ const schema
4044
multiple: true,
4145
filter: true,
4246
placeholder: 'Please select',
47+
optionLabel: 'label',
48+
optionValue: 'value',
4349
options,
4450
validation: 'required',
4551
},

src/pages/demo/MultiSelect.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const schema
1515
$formkit: 'primeMultiSelect',
1616
name: 'cookie_notice',
1717
label: 'Cookie notice MultiSelect',
18+
optionLabel: 'label',
19+
optionValue: 'value',
1820
options,
1921
help: 'Cookie notice frequency ?',
2022
},
@@ -24,6 +26,8 @@ const schema
2426
label: 'Styled',
2527
style: 'background:gray;',
2628
class: 'customClass',
29+
optionLabel: 'label',
30+
optionValue: 'value',
2731
options: [
2832
{ label: 'Every page load', value: 'refresh' },
2933
{ label: 'Every hour', value: 'hourly' },
@@ -37,6 +41,8 @@ const schema
3741
label: 'With Multiple Select and Filter',
3842
filter: true,
3943
placeholder: 'Please select',
44+
optionLabel: 'label',
45+
optionValue: 'value',
4046
options,
4147
validation: 'required',
4248
},

src/pages/demo/RadioButton.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const schema
1111
name: 'basic',
1212
options_class: 'mt-1 flex flex-col space-y-2',
1313
option_class: 'flex space-x-2',
14+
optionLabel: 'label',
15+
optionValue: 'value',
1416
options: [
1517
{ label: 'Every page load', value: 'refresh' },
1618
{ label: 'Every hour', value: 'hourly' },

src/pages/demo/SelectButton.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ const schema
2222
label: 'SelectButton',
2323
name: 'selectButton',
2424
options: selectOptions,
25+
optionLabel: 'label',
26+
optionValue: 'value',
2527
value: 'MAYBE',
2628
unselectable: false,
2729
},
2830
{
2931
$formkit: 'primeSelectButton',
3032
label: 'Contact options',
3133
name: 'selectButtonMultiple',
34+
optionLabel: 'label',
35+
optionValue: 'value',
3236
options: selectOptions2,
3337
multiple: true,
3438
},

0 commit comments

Comments
 (0)