sprintify-ui 0.0.145 → 0.0.147

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.
@@ -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,33 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ modelValue?: string | null | undefined;
3
+ collection?: string | undefined;
4
+ }>, {
5
+ modelValue: null;
6
+ collection: string;
7
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
+ modelValue?: string | null | undefined;
9
+ collection?: string | undefined;
10
+ }>, {
11
+ modelValue: null;
12
+ collection: string;
13
+ }>>> & {
14
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
15
+ }, {
16
+ modelValue: string | null;
17
+ collection: string;
18
+ }>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: import('vue').PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
29
+ type __VLS_WithDefaults<P, D> = {
30
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
31
+ default: D[K];
32
+ } : P[K];
33
+ };
@@ -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;
@@ -39,6 +39,7 @@ import BaseFileUploader from './BaseFileUploader.vue';
39
39
  import BaseForm from './BaseForm.vue';
40
40
  import BaseHasMany from './BaseHasMany.vue';
41
41
  import { Icon as BaseIcon } from '@iconify/vue';
42
+ import BaseIconPicker from './BaseIconPicker.vue';
42
43
  import BaseInput from './BaseInput.vue';
43
44
  import BaseInputLabel from './BaseInputLabel.vue';
44
45
  import BaseInputPercent from './BaseInputPercent.vue';
@@ -53,6 +54,7 @@ import BaseModalSide from './BaseModalSide.vue';
53
54
  import BaseNavbar from './BaseNavbar.vue';
54
55
  import BaseNavbarItem from './BaseNavbarItem.vue';
55
56
  import BaseNavbarItemContent from './BaseNavbarItemContent.vue';
57
+ import BaseNumber from './BaseNumber.vue';
56
58
  import BasePagination from './BasePagination.vue';
57
59
  import BasePanel from './BasePanel.vue';
58
60
  import BasePassword from './BasePassword.vue';
@@ -82,4 +84,4 @@ import BaseLayoutStacked from './BaseLayoutStacked.vue';
82
84
  import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
83
85
  import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
84
86
  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, };
87
+ 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, BaseIconPicker, 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.145",
3
+ "version": "0.0.147",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -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 (props.locale === 'fr') {
163
+ if (i18n.locale.value == 'fr') {
166
164
  return French;
167
165
  }
168
166
 
@@ -0,0 +1,22 @@
1
+ import BaseIconPicker from './BaseIconPicker.vue';
2
+ import ShowValue from '../../.storybook/components/ShowValue.vue';
3
+
4
+ export default {
5
+ title: 'Components/BaseIconPicker',
6
+ component: BaseIconPicker,
7
+ };
8
+
9
+ const Template = (args) => ({
10
+ components: { BaseIconPicker, ShowValue },
11
+ setup() {
12
+ const value = ref(null);
13
+ return { args, value };
14
+ },
15
+ template: `
16
+ <BaseIconPicker v-bind="args" v-model="value"></BaseIconPicker>
17
+ <ShowValue :value="value" />
18
+ `,
19
+ });
20
+
21
+ export const Demo = Template.bind({});
22
+ Demo.args = {};
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div class="w-full max-w-[268px] overflow-hidden rounded border bg-white">
3
+ <div class="flex w-full min-w-0 overflow-hidden px-3 pt-3">
4
+ <select
5
+ v-model="suffix"
6
+ class="max-w-[80px] shrink-0 rounded-l border-r-0 border-slate-300 text-xs focus:border-slate-300 focus:outline-none focus:ring-0"
7
+ @change="scrollTop"
8
+ >
9
+ <option v-for="(label, key) in suffixes" :key="key" :value="key">
10
+ {{ label }}
11
+ </option>
12
+ </select>
13
+
14
+ <input
15
+ v-model="keywords"
16
+ type="text"
17
+ :placeholder="$t('sui.autocomplete_placeholder')"
18
+ class="grow rounded-r border-slate-300 text-xs"
19
+ />
20
+ </div>
21
+
22
+ <div ref="drawer" class="h-44 overflow-y-auto py-2 px-3">
23
+ <ul class="flex flex-wrap">
24
+ <li v-for="icon in filteredIcons" :key="icon">
25
+ <button
26
+ type="button"
27
+ :class="[
28
+ modelValue == icon
29
+ ? 'bg-primary-600 text-white'
30
+ : 'bg-white text-slate-900 hover:bg-slate-200',
31
+ ]"
32
+ class="flex items-center justify-center rounded p-1"
33
+ @click="onClick(icon)"
34
+ >
35
+ <BaseIcon :icon="icon" />
36
+ </button>
37
+ </li>
38
+ </ul>
39
+ </div>
40
+ </div>
41
+ </template>
42
+
43
+ <script lang="ts" setup>
44
+ import { BaseIcon, config } from '..';
45
+
46
+ const props = withDefaults(
47
+ defineProps<{
48
+ modelValue?: string | null;
49
+ collection?: string;
50
+ }>(),
51
+ {
52
+ modelValue: null,
53
+ collection: 'heroicons',
54
+ }
55
+ );
56
+
57
+ const emit = defineEmits(['update:modelValue']);
58
+
59
+ function onClick(icon: string) {
60
+ emit('update:modelValue', icon);
61
+ }
62
+
63
+ const icons = ref<string[]>([]);
64
+ const suffixes = ref<Record<string, string>>({});
65
+ const suffix = ref<string | null>(null);
66
+ const otherSuffixValue = computed(() => {
67
+ return Object.keys(suffixes.value).filter((s) => {
68
+ return s !== suffix.value;
69
+ });
70
+ });
71
+
72
+ const drawer = ref<HTMLElement | null>(null);
73
+
74
+ const fullIcons = computed(() => {
75
+ return icons.value.map((icon) => {
76
+ return props.collection + ':' + icon;
77
+ });
78
+ });
79
+
80
+ const visibleIcons = computed(() => {
81
+ return fullIcons.value.filter((i) => {
82
+ const matchCurrent = i.endsWith(suffix.value ?? '');
83
+
84
+ if (!matchCurrent) {
85
+ return false;
86
+ }
87
+
88
+ const matches = otherSuffixValue.value.filter((s) => {
89
+ return i.endsWith(s);
90
+ });
91
+
92
+ const anotherMatchHasBiggerWeight = matches.some((m) => {
93
+ return m.length > (suffix.value ?? '').length;
94
+ });
95
+
96
+ if (anotherMatchHasBiggerWeight) {
97
+ return false;
98
+ }
99
+
100
+ return true;
101
+ });
102
+ });
103
+
104
+ const keywords = ref('');
105
+
106
+ const filteredIcons = computed(() => {
107
+ if (!keywords.value) {
108
+ return visibleIcons.value;
109
+ }
110
+
111
+ return visibleIcons.value.filter((i) => {
112
+ return i.toLocaleLowerCase().includes(keywords.value.toLowerCase());
113
+ });
114
+ });
115
+
116
+ function fetchIcons() {
117
+ config.http
118
+ .get('https://api.iconify.design/collection?prefix=' + props.collection)
119
+ .then((response) => {
120
+ icons.value = response.data.uncategorized;
121
+ suffixes.value = response.data.suffixes;
122
+ suffix.value = Object.keys(suffixes.value)[0] as string;
123
+ });
124
+ }
125
+
126
+ fetchIcons();
127
+
128
+ function scrollTop() {
129
+ if (drawer.value) {
130
+ drawer.value.scrollTop = 0;
131
+ }
132
+ }
133
+ </script>
@@ -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
- <input v-if="hasMask" ref="input" v-maska:[maskOptions] v-bind="bindings" />
23
- <input v-else ref="input" v-bind="bindings" />
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 hasMask = computed(() => {
139
- return !!props.mask;
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
- autocomplete: props.autocomplete ? 'on' : 'off',
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
- onInput: update,
164
- onFocus: (e: Event) => emit('focus', e),
165
- onBlur: (e: Event) => emit('blur', e),
192
+ onFocus: (e: Event) => {
193
+ emit('focus', e);
194
+ },
195
+ onBlur: (e: Event) => {
196
+ emit('blur', e);
197
+ },
166
198
  };
167
199
  });
168
200
 
@@ -19,7 +19,7 @@ const Template = (args) => ({
19
19
  BaseInputPercent,
20
20
  },
21
21
  setup() {
22
- const value = ref(null);
22
+ const value = ref(0.5);
23
23
  return { args, value };
24
24
  },
25
25
  template: `
@@ -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
+ });