sprintify-ui 0.0.144 → 0.0.146
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 +6573 -6368
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +0 -9
- package/dist/types/src/components/BaseNumber.vue.d.ts +116 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/index.d.ts +12 -4
- package/package.json +1 -1
- package/src/components/BaseDatePicker.stories.js +1 -1
- package/src/components/BaseDatePicker.vue +26 -25
- package/src/components/BaseInput.vue +49 -17
- package/src/components/BaseInputPercent.stories.js +1 -1
- package/src/components/BaseNumber.stories.js +50 -0
- package/src/components/BaseNumber.vue +280 -0
- package/src/components/index.ts +2 -0
- package/src/lang/en.json +4 -2
- package/src/lang/fr.json +4 -2
|
@@ -45,10 +45,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
45
|
default: string;
|
|
46
46
|
type: PropType<"time" | "multiple" | "single" | "range" | undefined>;
|
|
47
47
|
};
|
|
48
|
-
locale: {
|
|
49
|
-
default: string;
|
|
50
|
-
type: PropType<"en" | "fr" | undefined>;
|
|
51
|
-
};
|
|
52
48
|
noCalendar: {
|
|
53
49
|
default: boolean;
|
|
54
50
|
type: BooleanConstructor;
|
|
@@ -102,10 +98,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
102
98
|
default: string;
|
|
103
99
|
type: PropType<"time" | "multiple" | "single" | "range" | undefined>;
|
|
104
100
|
};
|
|
105
|
-
locale: {
|
|
106
|
-
default: string;
|
|
107
|
-
type: PropType<"en" | "fr" | undefined>;
|
|
108
|
-
};
|
|
109
101
|
noCalendar: {
|
|
110
102
|
default: boolean;
|
|
111
103
|
type: BooleanConstructor;
|
|
@@ -119,7 +111,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
119
111
|
}, {
|
|
120
112
|
required: boolean;
|
|
121
113
|
name: string;
|
|
122
|
-
locale: "en" | "fr" | undefined;
|
|
123
114
|
mode: "time" | "multiple" | "single" | "range" | undefined;
|
|
124
115
|
disabled: boolean;
|
|
125
116
|
modelValue: string | string[] | null | undefined;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
modelValue: {
|
|
4
|
+
default: undefined;
|
|
5
|
+
type: PropType<number | null>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The step of the input. Can be a number or null.
|
|
9
|
+
*/
|
|
10
|
+
step: {
|
|
11
|
+
default: number;
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
};
|
|
14
|
+
name: {
|
|
15
|
+
default: undefined;
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
};
|
|
18
|
+
placeholder: {
|
|
19
|
+
default: string;
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
};
|
|
22
|
+
disabled: {
|
|
23
|
+
default: boolean;
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
};
|
|
26
|
+
required: {
|
|
27
|
+
default: boolean;
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
};
|
|
30
|
+
min: {
|
|
31
|
+
default: undefined;
|
|
32
|
+
type: NumberConstructor;
|
|
33
|
+
};
|
|
34
|
+
max: {
|
|
35
|
+
default: undefined;
|
|
36
|
+
type: NumberConstructor;
|
|
37
|
+
};
|
|
38
|
+
hasError: {
|
|
39
|
+
default: boolean;
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
};
|
|
42
|
+
borderless: {
|
|
43
|
+
default: boolean;
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
};
|
|
46
|
+
rounded: {
|
|
47
|
+
default: string;
|
|
48
|
+
type: PropType<"left" | "right" | "none" | "full">;
|
|
49
|
+
};
|
|
50
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "blur" | "focus" | "keydown")[], "update:modelValue" | "blur" | "focus" | "keydown", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
modelValue: {
|
|
52
|
+
default: undefined;
|
|
53
|
+
type: PropType<number | null>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The step of the input. Can be a number or null.
|
|
57
|
+
*/
|
|
58
|
+
step: {
|
|
59
|
+
default: number;
|
|
60
|
+
type: NumberConstructor;
|
|
61
|
+
};
|
|
62
|
+
name: {
|
|
63
|
+
default: undefined;
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
};
|
|
66
|
+
placeholder: {
|
|
67
|
+
default: string;
|
|
68
|
+
type: StringConstructor;
|
|
69
|
+
};
|
|
70
|
+
disabled: {
|
|
71
|
+
default: boolean;
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
};
|
|
74
|
+
required: {
|
|
75
|
+
default: boolean;
|
|
76
|
+
type: BooleanConstructor;
|
|
77
|
+
};
|
|
78
|
+
min: {
|
|
79
|
+
default: undefined;
|
|
80
|
+
type: NumberConstructor;
|
|
81
|
+
};
|
|
82
|
+
max: {
|
|
83
|
+
default: undefined;
|
|
84
|
+
type: NumberConstructor;
|
|
85
|
+
};
|
|
86
|
+
hasError: {
|
|
87
|
+
default: boolean;
|
|
88
|
+
type: BooleanConstructor;
|
|
89
|
+
};
|
|
90
|
+
borderless: {
|
|
91
|
+
default: boolean;
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
};
|
|
94
|
+
rounded: {
|
|
95
|
+
default: string;
|
|
96
|
+
type: PropType<"left" | "right" | "none" | "full">;
|
|
97
|
+
};
|
|
98
|
+
}>> & {
|
|
99
|
+
onFocus?: ((...args: any[]) => any) | undefined;
|
|
100
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
101
|
+
onKeydown?: ((...args: any[]) => any) | undefined;
|
|
102
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
103
|
+
}, {
|
|
104
|
+
required: boolean;
|
|
105
|
+
name: string;
|
|
106
|
+
step: number;
|
|
107
|
+
disabled: boolean;
|
|
108
|
+
max: number;
|
|
109
|
+
min: number;
|
|
110
|
+
placeholder: string;
|
|
111
|
+
modelValue: number | null;
|
|
112
|
+
hasError: boolean;
|
|
113
|
+
rounded: "left" | "right" | "none" | "full";
|
|
114
|
+
borderless: boolean;
|
|
115
|
+
}>;
|
|
116
|
+
export default _default;
|
|
@@ -53,6 +53,7 @@ import BaseModalSide from './BaseModalSide.vue';
|
|
|
53
53
|
import BaseNavbar from './BaseNavbar.vue';
|
|
54
54
|
import BaseNavbarItem from './BaseNavbarItem.vue';
|
|
55
55
|
import BaseNavbarItemContent from './BaseNavbarItemContent.vue';
|
|
56
|
+
import BaseNumber from './BaseNumber.vue';
|
|
56
57
|
import BasePagination from './BasePagination.vue';
|
|
57
58
|
import BasePanel from './BasePanel.vue';
|
|
58
59
|
import BasePassword from './BasePassword.vue';
|
|
@@ -82,4 +83,4 @@ import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
|
82
83
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
83
84
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
84
85
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
85
|
-
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseColor, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFileUploader, BaseForm, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
86
|
+
export { BaseActionItem, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseColor, BaseContainer, BaseCounter, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFileUploader, BaseForm, BaseHasMany, BaseIcon, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNumber, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
@@ -29,6 +29,9 @@ declare const messages: {
|
|
|
29
29
|
file_must_be_of_type: string;
|
|
30
30
|
filters: string;
|
|
31
31
|
go_to_page: string;
|
|
32
|
+
invalid_value: string;
|
|
33
|
+
just_now: string;
|
|
34
|
+
maximum_x_decimal_places: string;
|
|
32
35
|
min_x_characters: string;
|
|
33
36
|
month: string;
|
|
34
37
|
next: string;
|
|
@@ -69,7 +72,6 @@ declare const messages: {
|
|
|
69
72
|
yes_delete: string;
|
|
70
73
|
you_can_upload_up_to_n_files: string;
|
|
71
74
|
you_cannot_select_more_than_x_items: string;
|
|
72
|
-
just_now: string;
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
fr: {
|
|
@@ -94,6 +96,9 @@ declare const messages: {
|
|
|
94
96
|
file_must_be_of_type: string;
|
|
95
97
|
filters: string;
|
|
96
98
|
go_to_page: string;
|
|
99
|
+
invalid_value: string;
|
|
100
|
+
just_now: string;
|
|
101
|
+
maximum_x_decimal_places: string;
|
|
97
102
|
min_x_characters: string;
|
|
98
103
|
month: string;
|
|
99
104
|
next: string;
|
|
@@ -134,7 +139,6 @@ declare const messages: {
|
|
|
134
139
|
yes_delete: string;
|
|
135
140
|
you_can_upload_up_to_n_files: string;
|
|
136
141
|
you_cannot_select_more_than_x_items: string;
|
|
137
|
-
just_now: string;
|
|
138
142
|
};
|
|
139
143
|
};
|
|
140
144
|
};
|
|
@@ -172,6 +176,9 @@ declare const config: {
|
|
|
172
176
|
file_must_be_of_type: string;
|
|
173
177
|
filters: string;
|
|
174
178
|
go_to_page: string;
|
|
179
|
+
invalid_value: string;
|
|
180
|
+
just_now: string;
|
|
181
|
+
maximum_x_decimal_places: string;
|
|
175
182
|
min_x_characters: string;
|
|
176
183
|
month: string;
|
|
177
184
|
next: string;
|
|
@@ -212,7 +219,6 @@ declare const config: {
|
|
|
212
219
|
yes_delete: string;
|
|
213
220
|
you_can_upload_up_to_n_files: string;
|
|
214
221
|
you_cannot_select_more_than_x_items: string;
|
|
215
|
-
just_now: string;
|
|
216
222
|
};
|
|
217
223
|
};
|
|
218
224
|
fr: {
|
|
@@ -237,6 +243,9 @@ declare const config: {
|
|
|
237
243
|
file_must_be_of_type: string;
|
|
238
244
|
filters: string;
|
|
239
245
|
go_to_page: string;
|
|
246
|
+
invalid_value: string;
|
|
247
|
+
just_now: string;
|
|
248
|
+
maximum_x_decimal_places: string;
|
|
240
249
|
min_x_characters: string;
|
|
241
250
|
month: string;
|
|
242
251
|
next: string;
|
|
@@ -277,7 +286,6 @@ declare const config: {
|
|
|
277
286
|
yes_delete: string;
|
|
278
287
|
you_can_upload_up_to_n_files: string;
|
|
279
288
|
you_cannot_select_more_than_x_items: string;
|
|
280
|
-
just_now: string;
|
|
281
289
|
};
|
|
282
290
|
};
|
|
283
291
|
}, {}, {}, string, true>;
|
package/package.json
CHANGED
|
@@ -94,10 +94,6 @@ const props = defineProps({
|
|
|
94
94
|
'single' | 'multiple' | 'range' | 'time' | undefined
|
|
95
95
|
>,
|
|
96
96
|
},
|
|
97
|
-
locale: {
|
|
98
|
-
default: 'en',
|
|
99
|
-
type: String as PropType<'en' | 'fr' | undefined>,
|
|
100
|
-
},
|
|
101
97
|
noCalendar: {
|
|
102
98
|
default: false,
|
|
103
99
|
type: Boolean,
|
|
@@ -110,6 +106,8 @@ const props = defineProps({
|
|
|
110
106
|
},
|
|
111
107
|
});
|
|
112
108
|
|
|
109
|
+
const i18n = useI18n();
|
|
110
|
+
|
|
113
111
|
const emit = defineEmits(['update:modelValue']);
|
|
114
112
|
|
|
115
113
|
const { hasErrorInternal, emitUpdate } = useField({
|
|
@@ -162,7 +160,7 @@ function parseDate(date: string): string {
|
|
|
162
160
|
}
|
|
163
161
|
|
|
164
162
|
const locale = computed(() => {
|
|
165
|
-
if (
|
|
163
|
+
if (i18n.locale.value == 'fr') {
|
|
166
164
|
return French;
|
|
167
165
|
}
|
|
168
166
|
|
|
@@ -190,15 +188,11 @@ const flatpickrConfig = computed(() => {
|
|
|
190
188
|
});
|
|
191
189
|
|
|
192
190
|
// Make sure the model value is always formatted on the parent component
|
|
193
|
-
|
|
194
|
-
(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
{ immediate: true }
|
|
201
|
-
);
|
|
191
|
+
onMounted(() => {
|
|
192
|
+
if (props.modelValue !== modelValueFormatted.value) {
|
|
193
|
+
emitUpdate(modelValueFormatted.value);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
202
196
|
|
|
203
197
|
/*
|
|
204
198
|
| Flatpickr does not seem to observe changes in the value attribute of the input.
|
|
@@ -206,20 +200,25 @@ watch(
|
|
|
206
200
|
| and manually react and apply the changes on the picker
|
|
207
201
|
*/
|
|
208
202
|
watch(
|
|
209
|
-
() =>
|
|
210
|
-
(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
203
|
+
() => modelValueFormatted.value,
|
|
204
|
+
() => {
|
|
205
|
+
setPickerDate();
|
|
206
|
+
},
|
|
207
|
+
{ immediate: true }
|
|
208
|
+
);
|
|
214
209
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
210
|
+
function setPickerDate() {
|
|
211
|
+
if (!picker) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
219
214
|
|
|
220
|
-
|
|
215
|
+
if (!modelValueFormatted.value) {
|
|
216
|
+
picker.clear();
|
|
217
|
+
return;
|
|
221
218
|
}
|
|
222
|
-
|
|
219
|
+
|
|
220
|
+
picker.setDate(modelValueFormatted.value, false);
|
|
221
|
+
}
|
|
223
222
|
|
|
224
223
|
/*
|
|
225
224
|
| If the props in flatpickrConfig are changed
|
|
@@ -283,6 +282,8 @@ function init() {
|
|
|
283
282
|
emitUpdate(listDate[0]);
|
|
284
283
|
},
|
|
285
284
|
});
|
|
285
|
+
|
|
286
|
+
setPickerDate();
|
|
286
287
|
}
|
|
287
288
|
|
|
288
289
|
function clear() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="inline-flex rounded border" :class="borderColor">
|
|
2
|
+
<div class="inline-flex rounded border" :class="[borderColor]">
|
|
3
3
|
<div
|
|
4
4
|
v-if="iconLeft"
|
|
5
5
|
class="flex shrink-0 items-center justify-center rounded-l border-r px-3 transition-colors"
|
|
@@ -19,8 +19,40 @@
|
|
|
19
19
|
>
|
|
20
20
|
{{ prefix }}
|
|
21
21
|
</div>
|
|
22
|
-
<
|
|
23
|
-
|
|
22
|
+
<BaseNumber
|
|
23
|
+
v-if="type == 'number'"
|
|
24
|
+
ref="input"
|
|
25
|
+
:model-value="modelValue"
|
|
26
|
+
borderless
|
|
27
|
+
:has-error="hasError"
|
|
28
|
+
:rounded="
|
|
29
|
+
emptyLeft && emptyRight
|
|
30
|
+
? 'full'
|
|
31
|
+
: emptyLeft
|
|
32
|
+
? 'left'
|
|
33
|
+
: emptyRight
|
|
34
|
+
? 'right'
|
|
35
|
+
: 'none'
|
|
36
|
+
"
|
|
37
|
+
class="grow"
|
|
38
|
+
v-bind="bindings"
|
|
39
|
+
@update:model-value="emitUpdate"
|
|
40
|
+
/>
|
|
41
|
+
<input
|
|
42
|
+
v-else
|
|
43
|
+
ref="input"
|
|
44
|
+
v-maska:[maskOptions]
|
|
45
|
+
v-bind="bindings"
|
|
46
|
+
:value="modelValue"
|
|
47
|
+
:type="type"
|
|
48
|
+
:autocomplete="autocomplete ? 'on' : 'off'"
|
|
49
|
+
:class="{
|
|
50
|
+
'rounded-l': emptyLeft,
|
|
51
|
+
'rounded-r': emptyRight,
|
|
52
|
+
'w-full border-none bg-white outline-none focus:z-[1] focus:ring-2 focus:ring-primary-600 focus:ring-offset-1 disabled:cursor-not-allowed disabled:text-slate-300': true,
|
|
53
|
+
}"
|
|
54
|
+
@input="update"
|
|
55
|
+
/>
|
|
24
56
|
<div
|
|
25
57
|
v-if="suffix"
|
|
26
58
|
class="flex shrink-0 items-center justify-center border-l px-4 transition-colors"
|
|
@@ -49,6 +81,7 @@ import { PropType } from 'vue';
|
|
|
49
81
|
import { BaseIcon } from '@/index';
|
|
50
82
|
import { useField } from '@/composables/field';
|
|
51
83
|
import { vMaska } from 'maska';
|
|
84
|
+
import BaseNumber from './BaseNumber.vue';
|
|
52
85
|
|
|
53
86
|
const props = defineProps({
|
|
54
87
|
modelValue: {
|
|
@@ -135,14 +168,16 @@ const maskOptions = computed(() => {
|
|
|
135
168
|
return undefined;
|
|
136
169
|
});
|
|
137
170
|
|
|
138
|
-
const
|
|
139
|
-
return
|
|
171
|
+
const emptyLeft = computed(() => {
|
|
172
|
+
return !props.iconLeft && !props.prefix;
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const emptyRight = computed(() => {
|
|
176
|
+
return !props.iconRight && !props.suffix;
|
|
140
177
|
});
|
|
141
178
|
|
|
142
179
|
const bindings = computed<any>(() => {
|
|
143
180
|
return {
|
|
144
|
-
value: props.modelValue,
|
|
145
|
-
type: props.type,
|
|
146
181
|
name: nameInternal.value,
|
|
147
182
|
step: props.step,
|
|
148
183
|
min: props.min,
|
|
@@ -150,19 +185,16 @@ const bindings = computed<any>(() => {
|
|
|
150
185
|
disabled: props.disabled,
|
|
151
186
|
placeholder: props.placeholder,
|
|
152
187
|
required: requiredInternal.value,
|
|
153
|
-
|
|
154
|
-
class: {
|
|
155
|
-
'rounded-l': !props.iconLeft && !props.prefix,
|
|
156
|
-
'rounded-r': !props.iconRight && !props.suffix,
|
|
157
|
-
'w-full border-none bg-white outline-none focus:z-[1] focus:ring-2 focus:ring-primary-600 focus:ring-offset-1 disabled:cursor-not-allowed disabled:text-slate-300':
|
|
158
|
-
true,
|
|
159
|
-
},
|
|
188
|
+
|
|
160
189
|
onKeydown: {
|
|
161
190
|
enter: onEnter,
|
|
162
191
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
192
|
+
onFocus: (e: Event) => {
|
|
193
|
+
emit('focus', e);
|
|
194
|
+
},
|
|
195
|
+
onBlur: (e: Event) => {
|
|
196
|
+
emit('blur', e);
|
|
197
|
+
},
|
|
166
198
|
};
|
|
167
199
|
});
|
|
168
200
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import BaseNumber from './BaseNumber.vue';
|
|
2
|
+
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
3
|
+
import { createFieldStory } from '@/../.storybook/utils';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Form/BaseNumber',
|
|
7
|
+
component: BaseNumber,
|
|
8
|
+
args: {
|
|
9
|
+
placeholder: 'Enter number',
|
|
10
|
+
step: 0.1,
|
|
11
|
+
min: 0,
|
|
12
|
+
max: 100,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template = (args) => ({
|
|
17
|
+
components: {
|
|
18
|
+
ShowValue,
|
|
19
|
+
BaseNumber,
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
const value = ref(12.1212);
|
|
23
|
+
return { args, value };
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<form @submit.prevent="" class="border-none">
|
|
27
|
+
<BaseNumber v-model="value" v-bind="args" class=""></BaseNumber>
|
|
28
|
+
</form>
|
|
29
|
+
<ShowValue :value="value" />
|
|
30
|
+
`,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Demo = Template.bind({});
|
|
34
|
+
Demo.args = {};
|
|
35
|
+
|
|
36
|
+
export const Disabled = Template.bind({});
|
|
37
|
+
Disabled.args = {
|
|
38
|
+
disabled: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Error = Template.bind({});
|
|
42
|
+
Error.args = {
|
|
43
|
+
hasError: true,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Field = createFieldStory({
|
|
47
|
+
component: BaseNumber,
|
|
48
|
+
componentName: 'BaseNumber',
|
|
49
|
+
label: 'Rebate',
|
|
50
|
+
});
|