independer-design-system 1.7.4 → 1.7.7
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/README.md +90 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/Button.vue +3 -3
- package/dist/runtime/components/Form/Combobox.d.vue.ts +36 -0
- package/dist/runtime/components/Form/Combobox.vue +134 -0
- package/dist/runtime/components/Form/Combobox.vue.d.ts +36 -0
- package/dist/runtime/components/Form/Fieldset.vue +1 -1
- package/dist/runtime/components/Form/RadioGroup.d.vue.ts +48 -0
- package/dist/runtime/components/Form/RadioGroup.vue +60 -0
- package/dist/runtime/components/Form/RadioGroup.vue.d.ts +48 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -44,10 +44,12 @@ By default, the module registers the following components:
|
|
|
44
44
|
- `IndFooter`
|
|
45
45
|
- `IndFormCheckbox`
|
|
46
46
|
- `IndFormCheckboxProduct`
|
|
47
|
+
- `IndFormCombobox`
|
|
47
48
|
- `IndFormFieldset`
|
|
48
49
|
- `IndFormInput`
|
|
49
50
|
- `IndFormLabel`
|
|
50
51
|
- `IndFormRadio`
|
|
52
|
+
- `IndFormRadioGroup`
|
|
51
53
|
- `IndFormRadioProduct`
|
|
52
54
|
- `IndFormRow`
|
|
53
55
|
- `IndFormSelect`
|
|
@@ -92,6 +94,91 @@ Run the local playground to see the base form components in context:
|
|
|
92
94
|
npm run dev
|
|
93
95
|
```
|
|
94
96
|
|
|
97
|
+
## Radio groups
|
|
98
|
+
|
|
99
|
+
`IndFormRadioGroup` accepts a shared `v-model`, a unique `name`, a `label`, and
|
|
100
|
+
options with unique string or boolean `value`s, `label`, and optional `id` and
|
|
101
|
+
`disabled` fields. The default slot can contain help text; `error` displays a
|
|
102
|
+
validation message. Changing the options does not change the model automatically.
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<template>
|
|
106
|
+
<IndFormRow>
|
|
107
|
+
<IndFormRadioGroup
|
|
108
|
+
v-model="energy.connectionType"
|
|
109
|
+
name="connectionType"
|
|
110
|
+
label="Wat heb je nodig?"
|
|
111
|
+
:options="connectionOptions"
|
|
112
|
+
>
|
|
113
|
+
<p v-if="!energy.connectionHasGas" class="text-grey-dark">
|
|
114
|
+
We zien dat er geen gasaansluiting is op jouw adres. Daarom selecteren we 'Alleen stroom' automatisch.
|
|
115
|
+
</p>
|
|
116
|
+
</IndFormRadioGroup>
|
|
117
|
+
</IndFormRow>
|
|
118
|
+
|
|
119
|
+
<IndFormRow>
|
|
120
|
+
<IndFormRadioGroup
|
|
121
|
+
v-model="energy.checkout.geslacht"
|
|
122
|
+
name="geslacht"
|
|
123
|
+
label="Geslacht"
|
|
124
|
+
:options="genderOptions"
|
|
125
|
+
:error="errors.geslacht"
|
|
126
|
+
/>
|
|
127
|
+
</IndFormRow>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<script setup>
|
|
131
|
+
const connectionOptions = computed(() => [
|
|
132
|
+
...(energy.connectionHasGas ? [{ value: 'ElektraEnGas', label: 'Stroom en gas' }] : []),
|
|
133
|
+
{ value: 'Elektra', label: 'Alleen stroom', disabled: !energy.connectionHasGas },
|
|
134
|
+
...(energy.connectionHasGas ? [{ value: 'Gas', label: 'Alleen gas' }] : []),
|
|
135
|
+
])
|
|
136
|
+
const genderOptions = [
|
|
137
|
+
{ value: 'man', label: 'Man' },
|
|
138
|
+
{ value: 'vrouw', label: 'Vrouw' },
|
|
139
|
+
]
|
|
140
|
+
</script>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Set `energy.connectionType` to `'Elektra'` in the application when there is no
|
|
144
|
+
gas connection.
|
|
145
|
+
|
|
146
|
+
## Searchable combobox
|
|
147
|
+
|
|
148
|
+
```vue
|
|
149
|
+
<template>
|
|
150
|
+
<IndFormCombobox
|
|
151
|
+
v-model="supplier"
|
|
152
|
+
name="supplier"
|
|
153
|
+
label="Van wie krijg je nu energie?"
|
|
154
|
+
:options="['Eneco', 'Essent', 'Vattenfall']"
|
|
155
|
+
button-label="Toon energieleveranciers"
|
|
156
|
+
empty-message="Geen leverancier gevonden."
|
|
157
|
+
:error="supplierError"
|
|
158
|
+
@update:model-value="selectSupplier"
|
|
159
|
+
/>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<script setup>
|
|
163
|
+
const supplier = ref(null)
|
|
164
|
+
const supplierError = ref('')
|
|
165
|
+
function selectSupplier(value) {
|
|
166
|
+
supplierError.value = value === null ? 'Kies een leverancier.' : ''
|
|
167
|
+
}
|
|
168
|
+
</script>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Options can be strings or `{ label, value }` objects with unique string/number
|
|
172
|
+
values. The model contains the selected value, not the option object. Filtering
|
|
173
|
+
is case-insensitive and uses the label. Clearing the input sets the model to
|
|
174
|
+
`null` by default; use `:nullable="false"` to prevent clearing the selection.
|
|
175
|
+
|
|
176
|
+
Use `disabled`, `placeholder`, `label-classes`, and `error` as with other form
|
|
177
|
+
components. `name` is required and provides the input ID and form field name.
|
|
178
|
+
Supply a visible `label` for accessibility. `leading-icon` defaults to the search
|
|
179
|
+
icon; set it to `""` to hide it. The component fills its container, so apply any
|
|
180
|
+
desired width to the component or its parent.
|
|
181
|
+
|
|
95
182
|
## Contribution
|
|
96
183
|
|
|
97
184
|
<details>
|
|
@@ -113,6 +200,9 @@ npm run dev
|
|
|
113
200
|
# Run ESLint
|
|
114
201
|
npm run lint
|
|
115
202
|
|
|
203
|
+
# Install Chromium for browser interaction tests (once)
|
|
204
|
+
npm exec playwright-core -- install chromium --only-shell
|
|
205
|
+
|
|
116
206
|
# Run Vitest
|
|
117
207
|
npm run test
|
|
118
208
|
npm run test:watch
|
package/dist/module.json
CHANGED
|
@@ -89,10 +89,10 @@ const classes = computed(() => {
|
|
|
89
89
|
"filled-yellow": "bg-yellow border-yellow text-yellow-1000 hover:bg-yellow-dark hover:border-yellow-dark active:bg-yellow-300 active:border-yellow-300 disabled:bg-grey-200 disabled:text-grey-500 disabled:border-grey-200 disabled:cursor-not-allowed",
|
|
90
90
|
"filled-purple": "bg-purple border-purple text-white hover:bg-purple-dark hover:border-purple-dark active:bg-purple-800 active:border-purple-800 disabled:bg-grey-200 disabled:text-grey-500 disabled:border-grey-200 disabled:cursor-not-allowed",
|
|
91
91
|
"wire-purple": "border-purple text-purple hover:text-purple hover:bg-purple-200 active:bg-purple/40 disabled:bg-transparent disabled:border-grey disabled:text-grey disabled:cursor-not-allowed",
|
|
92
|
-
"naked-purple": "border-transparent text-purple hover:bg-purple-200 active:bg-purple/40",
|
|
92
|
+
"naked-purple": "border-transparent text-purple hover:bg-purple-200 active:bg-purple/40 disabled:text-grey disabled:cursor-not-allowed",
|
|
93
93
|
"wire-white": "bg-transparent border-white text-white hover:bg-black/10 active:bg-black/30 ring-white focus-visible:border-white disabled:bg-transparent disabled:border-grey disabled:text-grey disabled:cursor-not-allowed",
|
|
94
|
-
"naked-white": "bg-transparent border-white text-white hover:bg-black/10 active:bg-black/30 ring-white focus-visible:border-white",
|
|
95
|
-
"link": "justify-start bg-transparent border-transparent text-purple hover:text-purple-dark active:text-purple-900"
|
|
94
|
+
"naked-white": "bg-transparent border-white text-white hover:bg-black/10 active:bg-black/30 ring-white focus-visible:border-white disabled:text-grey disabled:cursor-not-allowed",
|
|
95
|
+
"link": "justify-start bg-transparent border-transparent text-purple hover:text-purple-dark active:text-purple-900 disabled:text-grey disabled:cursor-not-allowed"
|
|
96
96
|
}[props.tone];
|
|
97
97
|
});
|
|
98
98
|
const sizeClasses = computed(() => {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type Value = string | number;
|
|
2
|
+
type Option = string | {
|
|
3
|
+
label: string;
|
|
4
|
+
value: Value;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
name: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
labelClasses?: string;
|
|
10
|
+
options: Option[];
|
|
11
|
+
modelValue?: Value | null;
|
|
12
|
+
nullable?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
leadingIcon?: string;
|
|
16
|
+
buttonLabel?: string;
|
|
17
|
+
emptyMessage?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
blur: (event: FocusEvent) => any;
|
|
22
|
+
focus: (event: FocusEvent) => any;
|
|
23
|
+
"update:modelValue": (value: Value | null) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
26
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((value: Value | null) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
modelValue: Value | null;
|
|
30
|
+
nullable: boolean;
|
|
31
|
+
leadingIcon: string;
|
|
32
|
+
buttonLabel: string;
|
|
33
|
+
emptyMessage: string;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Combobox
|
|
3
|
+
as="div"
|
|
4
|
+
:model-value="modelValue"
|
|
5
|
+
:name="name"
|
|
6
|
+
:nullable="nullable"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
@update:model-value="selectOption"
|
|
9
|
+
>
|
|
10
|
+
<ComboboxLabel
|
|
11
|
+
v-if="label"
|
|
12
|
+
class="block mb-1 font-semibold"
|
|
13
|
+
:class="labelClasses"
|
|
14
|
+
>
|
|
15
|
+
{{ label }}
|
|
16
|
+
</ComboboxLabel>
|
|
17
|
+
|
|
18
|
+
<div class="relative w-full">
|
|
19
|
+
<ComboboxInput
|
|
20
|
+
:id="name"
|
|
21
|
+
class="block h-12 py-[0.6875rem] px-3 pr-12 border rounded-lg w-full bg-white transition-all ease-out focus:border-purple focus:ring-1 focus:ring-purple outline-none appearance-none disabled:bg-grey-light disabled:cursor-not-allowed"
|
|
22
|
+
:class="{
|
|
23
|
+
'border-red-800': error,
|
|
24
|
+
'border-grey hover:border-grey-dark disabled:hover:border-grey': !error,
|
|
25
|
+
'pl-10': leadingIcon
|
|
26
|
+
}"
|
|
27
|
+
:display-value="displayValue"
|
|
28
|
+
:placeholder="placeholder"
|
|
29
|
+
:aria-invalid="!!error"
|
|
30
|
+
:aria-describedby="error ? `${name}-error` : void 0"
|
|
31
|
+
@change="updateQuery"
|
|
32
|
+
@blur="onBlur"
|
|
33
|
+
@focus="emit('focus', $event)"
|
|
34
|
+
/>
|
|
35
|
+
<ComboboxButton
|
|
36
|
+
class="absolute bottom-0 right-0 flex items-center p-3 disabled:cursor-not-allowed"
|
|
37
|
+
:aria-label="buttonLabel"
|
|
38
|
+
>
|
|
39
|
+
<Icon
|
|
40
|
+
name="eva:arrow-ios-downward-outline"
|
|
41
|
+
class="pointer-events-none text-purple"
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
/>
|
|
44
|
+
</ComboboxButton>
|
|
45
|
+
<Icon
|
|
46
|
+
v-if="leadingIcon"
|
|
47
|
+
:name="leadingIcon"
|
|
48
|
+
class="absolute bottom-3 left-3 pointer-events-none text-grey-dark"
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
/>
|
|
51
|
+
<ComboboxOptions class="absolute w-full max-h-44 mt-2 bg-white border border-grey rounded-lg shadow-overlay overflow-y-auto z-50">
|
|
52
|
+
<ComboboxOption
|
|
53
|
+
v-for="option in filteredOptions"
|
|
54
|
+
:key="option.value"
|
|
55
|
+
v-slot="{ active, selected }"
|
|
56
|
+
:value="option.value"
|
|
57
|
+
as="template"
|
|
58
|
+
>
|
|
59
|
+
<li
|
|
60
|
+
class="p-3 border-b border-grey-light cursor-pointer hover:bg-purple-light last:border-b-0 first:rounded-t-lg last:rounded-b-lg"
|
|
61
|
+
:class="{ 'bg-purple-light': active || selected }"
|
|
62
|
+
>
|
|
63
|
+
{{ option.label }}
|
|
64
|
+
</li>
|
|
65
|
+
</ComboboxOption>
|
|
66
|
+
<li
|
|
67
|
+
v-if="filteredOptions.length === 0"
|
|
68
|
+
role="presentation"
|
|
69
|
+
class="flex p-3 text-grey-dark"
|
|
70
|
+
>
|
|
71
|
+
{{ emptyMessage }}
|
|
72
|
+
</li>
|
|
73
|
+
</ComboboxOptions>
|
|
74
|
+
</div>
|
|
75
|
+
<p
|
|
76
|
+
v-if="error"
|
|
77
|
+
:id="`${name}-error`"
|
|
78
|
+
class="mt-1 text-red-800"
|
|
79
|
+
>
|
|
80
|
+
{{ error }}
|
|
81
|
+
</p>
|
|
82
|
+
</Combobox>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup>
|
|
86
|
+
import {
|
|
87
|
+
Combobox,
|
|
88
|
+
ComboboxButton,
|
|
89
|
+
ComboboxInput,
|
|
90
|
+
ComboboxLabel,
|
|
91
|
+
ComboboxOption,
|
|
92
|
+
ComboboxOptions
|
|
93
|
+
} from "@headlessui/vue";
|
|
94
|
+
import { computed, ref } from "vue";
|
|
95
|
+
const props = defineProps({
|
|
96
|
+
name: { type: String, required: true },
|
|
97
|
+
label: { type: String, required: false },
|
|
98
|
+
labelClasses: { type: String, required: false },
|
|
99
|
+
options: { type: Array, required: true },
|
|
100
|
+
modelValue: { type: [String, Number, null], required: false, default: null },
|
|
101
|
+
nullable: { type: Boolean, required: false, default: true },
|
|
102
|
+
disabled: { type: Boolean, required: false },
|
|
103
|
+
placeholder: { type: String, required: false },
|
|
104
|
+
leadingIcon: { type: String, required: false, default: "eva:search-outline" },
|
|
105
|
+
buttonLabel: { type: String, required: false, default: "Toon opties" },
|
|
106
|
+
emptyMessage: { type: String, required: false, default: "Geen resultaten gevonden." },
|
|
107
|
+
error: { type: String, required: false }
|
|
108
|
+
});
|
|
109
|
+
const emit = defineEmits(["update:modelValue", "blur", "focus"]);
|
|
110
|
+
const query = ref("");
|
|
111
|
+
const normalizedOptions = computed(() => props.options.map(
|
|
112
|
+
(option) => typeof option === "string" ? { label: option, value: option } : option
|
|
113
|
+
));
|
|
114
|
+
const filteredOptions = computed(() => {
|
|
115
|
+
const search = query.value.trim().toLocaleLowerCase();
|
|
116
|
+
return normalizedOptions.value.filter((option) => option.label.toLocaleLowerCase().includes(search));
|
|
117
|
+
});
|
|
118
|
+
function displayValue(value) {
|
|
119
|
+
return normalizedOptions.value.find((option) => option.value === value)?.label ?? "";
|
|
120
|
+
}
|
|
121
|
+
function updateQuery(event) {
|
|
122
|
+
if (event.target instanceof HTMLInputElement) {
|
|
123
|
+
query.value = event.target.value;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function selectOption(value) {
|
|
127
|
+
query.value = "";
|
|
128
|
+
emit("update:modelValue", value);
|
|
129
|
+
}
|
|
130
|
+
function onBlur(event) {
|
|
131
|
+
query.value = "";
|
|
132
|
+
emit("blur", event);
|
|
133
|
+
}
|
|
134
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type Value = string | number;
|
|
2
|
+
type Option = string | {
|
|
3
|
+
label: string;
|
|
4
|
+
value: Value;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
name: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
labelClasses?: string;
|
|
10
|
+
options: Option[];
|
|
11
|
+
modelValue?: Value | null;
|
|
12
|
+
nullable?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
leadingIcon?: string;
|
|
16
|
+
buttonLabel?: string;
|
|
17
|
+
emptyMessage?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
20
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
blur: (event: FocusEvent) => any;
|
|
22
|
+
focus: (event: FocusEvent) => any;
|
|
23
|
+
"update:modelValue": (value: Value | null) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
26
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((value: Value | null) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
modelValue: Value | null;
|
|
30
|
+
nullable: boolean;
|
|
31
|
+
leadingIcon: string;
|
|
32
|
+
buttonLabel: string;
|
|
33
|
+
emptyMessage: string;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<fieldset
|
|
3
3
|
ref="sectionRef"
|
|
4
|
-
class="card w-full shrink-0 grow-0 mb-4 p-4 bg-white rounded-xl tablet:p-6 transition-all shadow-raised scroll-mt-6
|
|
4
|
+
class="card w-full shrink-0 grow-0 mb-4 p-4 bg-white rounded-xl tablet:p-6 transition-all shadow-raised scroll-mt-6"
|
|
5
5
|
:class="classesCard"
|
|
6
6
|
>
|
|
7
7
|
<header
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
name: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
label: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
type: ArrayConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
modelValue: (StringConstructor | BooleanConstructor)[];
|
|
21
|
+
disabled: BooleanConstructor;
|
|
22
|
+
error: StringConstructor;
|
|
23
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
"update:modelValue": (...args: any[]) => void;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
name: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
label: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
options: {
|
|
35
|
+
type: ArrayConstructor;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
modelValue: (StringConstructor | BooleanConstructor)[];
|
|
39
|
+
disabled: BooleanConstructor;
|
|
40
|
+
error: StringConstructor;
|
|
41
|
+
}>> & Readonly<{
|
|
42
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
46
|
+
type __VLS_Slots = {
|
|
47
|
+
default?: ((props: {}) => any) | undefined;
|
|
48
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<fieldset
|
|
3
|
+
:disabled="disabled"
|
|
4
|
+
:aria-describedby="[$slots.default && `${groupId}-description`, error && `${groupId}-error`].filter(Boolean).join(' ') || undefined"
|
|
5
|
+
:aria-invalid="error ? 'true' : undefined"
|
|
6
|
+
>
|
|
7
|
+
<legend class="block mb-1 font-semibold">
|
|
8
|
+
{{ label }}
|
|
9
|
+
</legend>
|
|
10
|
+
|
|
11
|
+
<IndFormRadio
|
|
12
|
+
v-for="(option, index) in options"
|
|
13
|
+
:id="option.id || `${groupId}-option-${index}`"
|
|
14
|
+
:key="option.value"
|
|
15
|
+
:name="name"
|
|
16
|
+
:value="option.value"
|
|
17
|
+
:label="option.label"
|
|
18
|
+
:model-value="modelValue"
|
|
19
|
+
:disabled="disabled || option.disabled"
|
|
20
|
+
@update:model-value="emit('update:modelValue', option.value)"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
v-if="$slots.default"
|
|
25
|
+
:id="`${groupId}-description`"
|
|
26
|
+
>
|
|
27
|
+
<slot />
|
|
28
|
+
</div>
|
|
29
|
+
<p
|
|
30
|
+
v-if="error"
|
|
31
|
+
:id="`${groupId}-error`"
|
|
32
|
+
class="mt-1 text-red-800"
|
|
33
|
+
>
|
|
34
|
+
{{ error }}
|
|
35
|
+
</p>
|
|
36
|
+
</fieldset>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup>
|
|
40
|
+
import { useId } from "vue";
|
|
41
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
42
|
+
defineProps({
|
|
43
|
+
name: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
label: {
|
|
48
|
+
type: String,
|
|
49
|
+
required: true
|
|
50
|
+
},
|
|
51
|
+
options: {
|
|
52
|
+
type: Array,
|
|
53
|
+
required: true
|
|
54
|
+
},
|
|
55
|
+
modelValue: [String, Boolean],
|
|
56
|
+
disabled: Boolean,
|
|
57
|
+
error: String
|
|
58
|
+
});
|
|
59
|
+
const groupId = useId();
|
|
60
|
+
</script>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const _default: typeof __VLS_export;
|
|
2
|
+
export default _default;
|
|
3
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
4
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
5
|
+
$slots: S;
|
|
6
|
+
});
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
|
+
name: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
label: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
type: ArrayConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
modelValue: (StringConstructor | BooleanConstructor)[];
|
|
21
|
+
disabled: BooleanConstructor;
|
|
22
|
+
error: StringConstructor;
|
|
23
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
"update:modelValue": (...args: any[]) => void;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
name: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
label: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
options: {
|
|
35
|
+
type: ArrayConstructor;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
modelValue: (StringConstructor | BooleanConstructor)[];
|
|
39
|
+
disabled: BooleanConstructor;
|
|
40
|
+
error: StringConstructor;
|
|
41
|
+
}>> & Readonly<{
|
|
42
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
43
|
+
}>, {
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
46
|
+
type __VLS_Slots = {
|
|
47
|
+
default?: ((props: {}) => any) | undefined;
|
|
48
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "independer-design-system",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"description": "Vue 3 component library for the Independer Design System (DS2)",
|
|
5
5
|
"repository": "arjanvanrees/independer-design-system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"link": "npm link"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@headlessui/vue": "^1.7.23",
|
|
43
44
|
"@nuxt/icon": "^2.2.1",
|
|
44
45
|
"@nuxt/kit": "^4.3.1",
|
|
45
46
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"changelogen": "^0.6.2",
|
|
61
62
|
"eslint": "^10.0.2",
|
|
62
63
|
"nuxt": "^4.3.1",
|
|
64
|
+
"playwright-core": "^1.65.1",
|
|
63
65
|
"typescript": "~5.9.3",
|
|
64
66
|
"vitest": "^4.0.18",
|
|
65
67
|
"vue-tsc": "^3.2.5"
|