sprintify-ui 0.0.33 → 0.0.34
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/dist/sprintify-ui.es.js +1089 -1008
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +16 -16
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +226 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseButtonGroup.stories.js +5 -8
- package/src/components/BaseButtonGroup.vue +17 -17
- package/src/components/BaseRadioGroup.stories.js +88 -0
- package/src/components/BaseRadioGroup.vue +84 -0
- package/src/components/index.ts +2 -0
|
@@ -10,8 +10,8 @@ declare const _default: {
|
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
buttonType: "button" | "submit";
|
|
12
12
|
buttonClass: string;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
buttonSelectedClass: string;
|
|
14
|
+
buttonUnselectedClass: string;
|
|
15
15
|
spacing: string;
|
|
16
16
|
multiple: boolean;
|
|
17
17
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -35,11 +35,11 @@ declare const _default: {
|
|
|
35
35
|
default: string;
|
|
36
36
|
type: StringConstructor;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
buttonSelectedClass: {
|
|
39
39
|
default: string;
|
|
40
40
|
type: StringConstructor;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
buttonUnselectedClass: {
|
|
43
43
|
default: string;
|
|
44
44
|
type: StringConstructor;
|
|
45
45
|
};
|
|
@@ -65,7 +65,7 @@ declare const _default: {
|
|
|
65
65
|
};
|
|
66
66
|
}>> & {
|
|
67
67
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
68
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "modelValue" | "disabled" | "buttonType" | "buttonClass" | "
|
|
68
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "modelValue" | "disabled" | "buttonType" | "buttonClass" | "buttonSelectedClass" | "buttonUnselectedClass" | "spacing" | "multiple">;
|
|
69
69
|
$attrs: {
|
|
70
70
|
[x: string]: unknown;
|
|
71
71
|
};
|
|
@@ -100,11 +100,11 @@ declare const _default: {
|
|
|
100
100
|
default: string;
|
|
101
101
|
type: StringConstructor;
|
|
102
102
|
};
|
|
103
|
-
|
|
103
|
+
buttonSelectedClass: {
|
|
104
104
|
default: string;
|
|
105
105
|
type: StringConstructor;
|
|
106
106
|
};
|
|
107
|
-
|
|
107
|
+
buttonUnselectedClass: {
|
|
108
108
|
default: string;
|
|
109
109
|
type: StringConstructor;
|
|
110
110
|
};
|
|
@@ -136,8 +136,8 @@ declare const _default: {
|
|
|
136
136
|
disabled: boolean;
|
|
137
137
|
buttonType: "button" | "submit";
|
|
138
138
|
buttonClass: string;
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
buttonSelectedClass: string;
|
|
140
|
+
buttonUnselectedClass: string;
|
|
141
141
|
spacing: string;
|
|
142
142
|
multiple: boolean;
|
|
143
143
|
}, {}, string> & {
|
|
@@ -181,11 +181,11 @@ declare const _default: {
|
|
|
181
181
|
default: string;
|
|
182
182
|
type: StringConstructor;
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
buttonSelectedClass: {
|
|
185
185
|
default: string;
|
|
186
186
|
type: StringConstructor;
|
|
187
187
|
};
|
|
188
|
-
|
|
188
|
+
buttonUnselectedClass: {
|
|
189
189
|
default: string;
|
|
190
190
|
type: StringConstructor;
|
|
191
191
|
};
|
|
@@ -236,11 +236,11 @@ declare const _default: {
|
|
|
236
236
|
default: string;
|
|
237
237
|
type: StringConstructor;
|
|
238
238
|
};
|
|
239
|
-
|
|
239
|
+
buttonSelectedClass: {
|
|
240
240
|
default: string;
|
|
241
241
|
type: StringConstructor;
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
buttonUnselectedClass: {
|
|
244
244
|
default: string;
|
|
245
245
|
type: StringConstructor;
|
|
246
246
|
};
|
|
@@ -272,16 +272,16 @@ declare const _default: {
|
|
|
272
272
|
disabled: boolean;
|
|
273
273
|
buttonType: "button" | "submit";
|
|
274
274
|
buttonClass: string;
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
buttonSelectedClass: string;
|
|
276
|
+
buttonUnselectedClass: string;
|
|
277
277
|
spacing: string;
|
|
278
278
|
multiple: boolean;
|
|
279
279
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
280
280
|
$slots: {
|
|
281
281
|
option: (_: {
|
|
282
282
|
selected: boolean;
|
|
283
|
-
onSelect: (option: NormalizedOption) => void;
|
|
284
283
|
option: NormalizedOption;
|
|
284
|
+
disabled: boolean;
|
|
285
285
|
}) => any;
|
|
286
286
|
};
|
|
287
287
|
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { Option } from '@/types/types';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
$: import("vue").ComponentInternalInstance;
|
|
6
|
+
$data: {};
|
|
7
|
+
$props: Partial<{
|
|
8
|
+
required: boolean;
|
|
9
|
+
modelValue: Option | undefined;
|
|
10
|
+
inputClass: string;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
labelClass: string;
|
|
13
|
+
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
modelValue: {
|
|
15
|
+
default: undefined;
|
|
16
|
+
type: PropType<Option | undefined>;
|
|
17
|
+
};
|
|
18
|
+
name: {
|
|
19
|
+
required: true;
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
};
|
|
22
|
+
required: {
|
|
23
|
+
default: boolean;
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
};
|
|
26
|
+
disabled: {
|
|
27
|
+
default: boolean;
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
};
|
|
30
|
+
options: {
|
|
31
|
+
required: true;
|
|
32
|
+
type: PropType<Option[]>;
|
|
33
|
+
};
|
|
34
|
+
labelKey: {
|
|
35
|
+
required: true;
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
};
|
|
38
|
+
valueKey: {
|
|
39
|
+
required: true;
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
};
|
|
42
|
+
labelClass: {
|
|
43
|
+
default: string;
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
};
|
|
46
|
+
inputClass: {
|
|
47
|
+
default: string;
|
|
48
|
+
type: StringConstructor;
|
|
49
|
+
};
|
|
50
|
+
}>> & {
|
|
51
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
52
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "required" | "modelValue" | "inputClass" | "disabled" | "labelClass">;
|
|
53
|
+
$attrs: {
|
|
54
|
+
[x: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
$refs: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
$slots: Readonly<{
|
|
60
|
+
[name: string]: import("vue").Slot | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
63
|
+
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null;
|
|
64
|
+
$emit: (event: "update:modelValue", ...args: any[]) => void;
|
|
65
|
+
$el: any;
|
|
66
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
67
|
+
modelValue: {
|
|
68
|
+
default: undefined;
|
|
69
|
+
type: PropType<Option | undefined>;
|
|
70
|
+
};
|
|
71
|
+
name: {
|
|
72
|
+
required: true;
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
};
|
|
75
|
+
required: {
|
|
76
|
+
default: boolean;
|
|
77
|
+
type: BooleanConstructor;
|
|
78
|
+
};
|
|
79
|
+
disabled: {
|
|
80
|
+
default: boolean;
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
};
|
|
83
|
+
options: {
|
|
84
|
+
required: true;
|
|
85
|
+
type: PropType<Option[]>;
|
|
86
|
+
};
|
|
87
|
+
labelKey: {
|
|
88
|
+
required: true;
|
|
89
|
+
type: StringConstructor;
|
|
90
|
+
};
|
|
91
|
+
valueKey: {
|
|
92
|
+
required: true;
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
};
|
|
95
|
+
labelClass: {
|
|
96
|
+
default: string;
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
};
|
|
99
|
+
inputClass: {
|
|
100
|
+
default: string;
|
|
101
|
+
type: StringConstructor;
|
|
102
|
+
};
|
|
103
|
+
}>> & {
|
|
104
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
105
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], string, {
|
|
106
|
+
required: boolean;
|
|
107
|
+
modelValue: Option | undefined;
|
|
108
|
+
inputClass: string;
|
|
109
|
+
disabled: boolean;
|
|
110
|
+
labelClass: string;
|
|
111
|
+
}, {}, string> & {
|
|
112
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
113
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
114
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
115
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
116
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
117
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
118
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
119
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
120
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
121
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
122
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
123
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
124
|
+
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
125
|
+
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
126
|
+
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string>, {}> | null, info: string) => boolean | void)[]) | undefined;
|
|
127
|
+
};
|
|
128
|
+
$forceUpdate: () => void;
|
|
129
|
+
$nextTick: typeof import("vue").nextTick;
|
|
130
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
131
|
+
} & Readonly<import("vue").ExtractPropTypes<{
|
|
132
|
+
modelValue: {
|
|
133
|
+
default: undefined;
|
|
134
|
+
type: PropType<Option | undefined>;
|
|
135
|
+
};
|
|
136
|
+
name: {
|
|
137
|
+
required: true;
|
|
138
|
+
type: StringConstructor;
|
|
139
|
+
};
|
|
140
|
+
required: {
|
|
141
|
+
default: boolean;
|
|
142
|
+
type: BooleanConstructor;
|
|
143
|
+
};
|
|
144
|
+
disabled: {
|
|
145
|
+
default: boolean;
|
|
146
|
+
type: BooleanConstructor;
|
|
147
|
+
};
|
|
148
|
+
options: {
|
|
149
|
+
required: true;
|
|
150
|
+
type: PropType<Option[]>;
|
|
151
|
+
};
|
|
152
|
+
labelKey: {
|
|
153
|
+
required: true;
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
};
|
|
156
|
+
valueKey: {
|
|
157
|
+
required: true;
|
|
158
|
+
type: StringConstructor;
|
|
159
|
+
};
|
|
160
|
+
labelClass: {
|
|
161
|
+
default: string;
|
|
162
|
+
type: StringConstructor;
|
|
163
|
+
};
|
|
164
|
+
inputClass: {
|
|
165
|
+
default: string;
|
|
166
|
+
type: StringConstructor;
|
|
167
|
+
};
|
|
168
|
+
}>> & {
|
|
169
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
170
|
+
} & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {};
|
|
171
|
+
__isFragment?: undefined;
|
|
172
|
+
__isTeleport?: undefined;
|
|
173
|
+
__isSuspense?: undefined;
|
|
174
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
175
|
+
modelValue: {
|
|
176
|
+
default: undefined;
|
|
177
|
+
type: PropType<Option | undefined>;
|
|
178
|
+
};
|
|
179
|
+
name: {
|
|
180
|
+
required: true;
|
|
181
|
+
type: StringConstructor;
|
|
182
|
+
};
|
|
183
|
+
required: {
|
|
184
|
+
default: boolean;
|
|
185
|
+
type: BooleanConstructor;
|
|
186
|
+
};
|
|
187
|
+
disabled: {
|
|
188
|
+
default: boolean;
|
|
189
|
+
type: BooleanConstructor;
|
|
190
|
+
};
|
|
191
|
+
options: {
|
|
192
|
+
required: true;
|
|
193
|
+
type: PropType<Option[]>;
|
|
194
|
+
};
|
|
195
|
+
labelKey: {
|
|
196
|
+
required: true;
|
|
197
|
+
type: StringConstructor;
|
|
198
|
+
};
|
|
199
|
+
valueKey: {
|
|
200
|
+
required: true;
|
|
201
|
+
type: StringConstructor;
|
|
202
|
+
};
|
|
203
|
+
labelClass: {
|
|
204
|
+
default: string;
|
|
205
|
+
type: StringConstructor;
|
|
206
|
+
};
|
|
207
|
+
inputClass: {
|
|
208
|
+
default: string;
|
|
209
|
+
type: StringConstructor;
|
|
210
|
+
};
|
|
211
|
+
}>> & {
|
|
212
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
213
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", {
|
|
214
|
+
required: boolean;
|
|
215
|
+
modelValue: Option | undefined;
|
|
216
|
+
inputClass: string;
|
|
217
|
+
disabled: boolean;
|
|
218
|
+
labelClass: string;
|
|
219
|
+
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
220
|
+
$slots: {
|
|
221
|
+
option: (_: {
|
|
222
|
+
option: import("@/types/types").NormalizedOption;
|
|
223
|
+
}) => any;
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
export default _default;
|
|
@@ -46,6 +46,7 @@ import BasePagination from './BasePagination.vue';
|
|
|
46
46
|
import BasePanel from './BasePanel.vue';
|
|
47
47
|
import BasePassword from './BasePassword.vue';
|
|
48
48
|
import BaseProgressCircle from './BaseProgressCircle.vue';
|
|
49
|
+
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
49
50
|
import BaseReadMore from './BaseReadMore.vue';
|
|
50
51
|
import BaseSelect from './BaseSelect.vue';
|
|
51
52
|
import BaseSideNavigation from './BaseSideNavigation.vue';
|
|
@@ -65,4 +66,4 @@ import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
|
65
66
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
66
67
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
67
68
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
68
|
-
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseFilePicker, BaseFileUploader, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseReadMore, BaseSelect, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
69
|
+
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseFilePicker, BaseFileUploader, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseSelect, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
package/package.json
CHANGED
|
@@ -70,17 +70,14 @@ export const SlotOption = (args) => ({
|
|
|
70
70
|
v-bind="args"
|
|
71
71
|
v-model="value"
|
|
72
72
|
:options="options"
|
|
73
|
+
button-class="btn btn-xs"
|
|
74
|
+
button-selected-class="btn-black"
|
|
73
75
|
>
|
|
74
|
-
<template #option="{ option
|
|
75
|
-
<
|
|
76
|
-
class="btn btn-xs flex items-center space-x-1 font-semibold"
|
|
77
|
-
:class="[selected ? 'btn-black' : '']"
|
|
78
|
-
type="button"
|
|
79
|
-
@click="onSelect(option)"
|
|
80
|
-
>
|
|
76
|
+
<template #option="{ option }">
|
|
77
|
+
<div class="flex items-center space-x-1 font-semibold">
|
|
81
78
|
<div class="w-3 h-3 rounded" :style="{ backgroundColor: option.value }"></div>
|
|
82
79
|
<div>{{ option.label }}</div>
|
|
83
|
-
</
|
|
80
|
+
</div>
|
|
84
81
|
</template>
|
|
85
82
|
</BaseButtonGroup>
|
|
86
83
|
`,
|
|
@@ -5,24 +5,24 @@
|
|
|
5
5
|
:key="option.value"
|
|
6
6
|
:style="{ padding: spacing }"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
:
|
|
12
|
-
|
|
8
|
+
<button
|
|
9
|
+
:type="buttonType"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:class="[
|
|
12
|
+
buttonClass,
|
|
13
|
+
isSelected(option) ? buttonSelectedClass : buttonUnselectedClass,
|
|
14
|
+
]"
|
|
15
|
+
@click="onSelect(option)"
|
|
13
16
|
>
|
|
14
|
-
<
|
|
15
|
-
|
|
17
|
+
<slot
|
|
18
|
+
name="option"
|
|
19
|
+
:selected="isSelected(option)"
|
|
20
|
+
:option="option"
|
|
16
21
|
:disabled="disabled"
|
|
17
|
-
:class="[
|
|
18
|
-
buttonClass,
|
|
19
|
-
isSelected(option) ? buttonActiveClass : buttonInactiveClass,
|
|
20
|
-
]"
|
|
21
|
-
@click="onSelect(option)"
|
|
22
22
|
>
|
|
23
23
|
{{ option.label }}
|
|
24
|
-
</
|
|
25
|
-
</
|
|
24
|
+
</slot>
|
|
25
|
+
</button>
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
</template>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<script lang="ts" setup>
|
|
31
31
|
import { PropType } from 'vue';
|
|
32
32
|
import { NormalizedOption, Option } from '@/types/types';
|
|
33
|
-
import { cloneDeep, isArray
|
|
33
|
+
import { cloneDeep, isArray } from 'lodash';
|
|
34
34
|
import { useHasOptions } from '@/composables/hasOptions';
|
|
35
35
|
|
|
36
36
|
const props = defineProps({
|
|
@@ -56,11 +56,11 @@ const props = defineProps({
|
|
|
56
56
|
default: 'btn btn-sm',
|
|
57
57
|
type: String,
|
|
58
58
|
},
|
|
59
|
-
|
|
59
|
+
buttonSelectedClass: {
|
|
60
60
|
default: 'btn-primary',
|
|
61
61
|
type: String,
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
buttonUnselectedClass: {
|
|
64
64
|
default: '',
|
|
65
65
|
type: String,
|
|
66
66
|
},
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseRadioGroup',
|
|
5
|
+
component: BaseRadioGroup,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
args: {
|
|
8
|
+
name: 'character',
|
|
9
|
+
labelKey: 'label',
|
|
10
|
+
valueKey: 'value',
|
|
11
|
+
options: [
|
|
12
|
+
{ label: 'Dark Vader', value: 'dark_vader' },
|
|
13
|
+
{ label: 'Darth Maul', value: 'darth_maul' },
|
|
14
|
+
{ label: 'Dark Sidious', value: 'dark_sidious' },
|
|
15
|
+
{ label: 'Obi Wan Kenobi', value: 'obiwan' },
|
|
16
|
+
{ label: 'Anakin Skywalker', value: 'anakin' },
|
|
17
|
+
{ label: 'Mace Windu', value: 'windu' },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Template = (args) => ({
|
|
24
|
+
components: { BaseRadioGroup },
|
|
25
|
+
setup() {
|
|
26
|
+
const value = ref(null);
|
|
27
|
+
function onSubmit() {
|
|
28
|
+
alert('submit');
|
|
29
|
+
}
|
|
30
|
+
return { args, value, onSubmit };
|
|
31
|
+
},
|
|
32
|
+
template: `
|
|
33
|
+
<form @submit.prevent="onSubmit">
|
|
34
|
+
<BaseRadioGroup v-model="value" v-bind="args"></BaseRadioGroup>
|
|
35
|
+
<button type="submit" class="btn btn-primary mt-4">Submit</button>
|
|
36
|
+
<p class="mt-5 text-sm">Value: <span class="bg-slate-200 font-mono px-1 py-px rounded">{{ value ?? 'NULL' }}</span></p>
|
|
37
|
+
</form>
|
|
38
|
+
`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Demo = Template.bind({});
|
|
42
|
+
Demo.args = {};
|
|
43
|
+
|
|
44
|
+
export const Required = Template.bind({});
|
|
45
|
+
Required.args = {
|
|
46
|
+
required: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Disabled = Template.bind({});
|
|
50
|
+
Disabled.args = {
|
|
51
|
+
disabled: true,
|
|
52
|
+
modelValue: { label: 'Dark Maul', value: 'darth_maul' },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const SlotOption = (args) => ({
|
|
56
|
+
components: { BaseRadioGroup },
|
|
57
|
+
setup() {
|
|
58
|
+
const value = ref(null);
|
|
59
|
+
|
|
60
|
+
const options = [
|
|
61
|
+
{ label: 'Red', value: 'red' },
|
|
62
|
+
{ label: 'Blue', value: 'blue' },
|
|
63
|
+
{ label: 'Green', value: 'green' },
|
|
64
|
+
{ label: 'Black', value: 'black' },
|
|
65
|
+
{ label: 'Gray', value: 'gray' },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
return { value, options, args };
|
|
69
|
+
},
|
|
70
|
+
template: `
|
|
71
|
+
<BaseRadioGroup
|
|
72
|
+
v-bind="args"
|
|
73
|
+
v-model="value"
|
|
74
|
+
:options="options"
|
|
75
|
+
label-class="flex space-x-2 items-start"
|
|
76
|
+
>
|
|
77
|
+
<template #option="{ option }">
|
|
78
|
+
<div>
|
|
79
|
+
<div class="flex items-center space-x-1">
|
|
80
|
+
<div style="height: 10px; width: 10px; border-radius: 4px;" :style="{ backgroundColor: option.value }"></div>
|
|
81
|
+
<div class="leading-none font-medium text-sm">{{ option.label }}</div>
|
|
82
|
+
</div>
|
|
83
|
+
<p class="text-slate-500 text-xs leading-tight">{{ option.value }}</p>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
</BaseRadioGroup>
|
|
87
|
+
`,
|
|
88
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ul class="space-y-3">
|
|
4
|
+
<li v-for="option in normalizedOptions" :key="option.value">
|
|
5
|
+
<label
|
|
6
|
+
:for="name + '-' + option.value"
|
|
7
|
+
class="cursor-pointer"
|
|
8
|
+
:class="[labelClass, disabled ? 'cursor-not-allowed opacity-50' : '']"
|
|
9
|
+
>
|
|
10
|
+
<input
|
|
11
|
+
:id="name + '-' + option.value"
|
|
12
|
+
type="radio"
|
|
13
|
+
:name="name"
|
|
14
|
+
:checked="isSelected(option)"
|
|
15
|
+
:required="required"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
:value="option.value"
|
|
18
|
+
:class="inputClass"
|
|
19
|
+
@input="emit('update:modelValue', option.option)"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<slot name="option" :option="option">
|
|
23
|
+
<span class="text-sm">{{ option.label }}</span>
|
|
24
|
+
</slot>
|
|
25
|
+
</label>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { PropType } from 'vue';
|
|
33
|
+
import { Option } from '@/types/types';
|
|
34
|
+
import { useHasOptions } from '@/composables/hasOptions';
|
|
35
|
+
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
modelValue: {
|
|
38
|
+
default: undefined,
|
|
39
|
+
type: [Object, null] as PropType<Option | undefined>,
|
|
40
|
+
},
|
|
41
|
+
name: {
|
|
42
|
+
required: true,
|
|
43
|
+
type: String,
|
|
44
|
+
},
|
|
45
|
+
required: {
|
|
46
|
+
default: false,
|
|
47
|
+
type: Boolean,
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
default: false,
|
|
51
|
+
type: Boolean,
|
|
52
|
+
},
|
|
53
|
+
options: {
|
|
54
|
+
required: true,
|
|
55
|
+
type: Array as PropType<Option[]>,
|
|
56
|
+
},
|
|
57
|
+
labelKey: {
|
|
58
|
+
required: true,
|
|
59
|
+
type: String,
|
|
60
|
+
},
|
|
61
|
+
valueKey: {
|
|
62
|
+
required: true,
|
|
63
|
+
type: String,
|
|
64
|
+
},
|
|
65
|
+
labelClass: {
|
|
66
|
+
default: 'flex space-x-2',
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
inputClass: {
|
|
70
|
+
default: 'mt-0.5 border-slate-300',
|
|
71
|
+
type: String,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const emit = defineEmits(['update:modelValue']);
|
|
76
|
+
|
|
77
|
+
const { normalizedOptions, isSelected } = useHasOptions(
|
|
78
|
+
computed(() => props.modelValue),
|
|
79
|
+
computed(() => props.options),
|
|
80
|
+
computed(() => props.labelKey),
|
|
81
|
+
computed(() => props.valueKey),
|
|
82
|
+
computed(() => false)
|
|
83
|
+
);
|
|
84
|
+
</script>
|
package/src/components/index.ts
CHANGED
|
@@ -46,6 +46,7 @@ import BasePagination from './BasePagination.vue';
|
|
|
46
46
|
import BasePanel from './BasePanel.vue';
|
|
47
47
|
import BasePassword from './BasePassword.vue';
|
|
48
48
|
import BaseProgressCircle from './BaseProgressCircle.vue';
|
|
49
|
+
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
49
50
|
import BaseReadMore from './BaseReadMore.vue';
|
|
50
51
|
import BaseSelect from './BaseSelect.vue';
|
|
51
52
|
import BaseSideNavigation from './BaseSideNavigation.vue';
|
|
@@ -116,6 +117,7 @@ export {
|
|
|
116
117
|
BasePanel,
|
|
117
118
|
BasePassword,
|
|
118
119
|
BaseProgressCircle,
|
|
120
|
+
BaseRadioGroup,
|
|
119
121
|
BaseReadMore,
|
|
120
122
|
BaseSelect,
|
|
121
123
|
BaseSideNavigation,
|