sprintify-ui 0.2.14 → 0.2.16
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 +7381 -7222
- package/dist/types/src/components/BaseGantt.vue.d.ts +2 -1
- package/dist/types/src/components/BaseInput.vue.d.ts +6 -1
- package/dist/types/src/components/BaseInputPercent.vue.d.ts +6 -1
- package/dist/types/src/components/BasePassword.vue.d.ts +6 -1
- package/dist/types/src/components/BaseTextarea.vue.d.ts +6 -1
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +6 -1
- package/dist/types/src/components/BaseUniqueCode.vue.d.ts +33 -0
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/BaseGantt.stories.js +6 -2
- package/src/components/BaseGantt.vue +2 -0
- package/src/components/BaseInput.stories.js +17 -0
- package/src/components/BaseInput.vue +15 -0
- package/src/components/BaseInputPercent.stories.js +16 -0
- package/src/components/BaseInputPercent.vue +16 -0
- package/src/components/BasePassword.stories.js +17 -0
- package/src/components/BasePassword.vue +15 -0
- package/src/components/BaseTextarea.stories.js +16 -0
- package/src/components/BaseTextarea.vue +16 -0
- package/src/components/BaseTextareaAutoresize.stories.js +16 -0
- package/src/components/BaseTextareaAutoresize.vue +16 -0
- package/src/components/BaseUniqueCode.stories.js +36 -0
- package/src/components/BaseUniqueCode.vue +209 -0
- package/src/components/index.ts +2 -0
- package/src/lang/en.json +2 -1
- package/src/lang/fr.json +2 -1
|
@@ -16,7 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
16
16
|
type: import("vue").PropType<number>;
|
|
17
17
|
default: number;
|
|
18
18
|
};
|
|
19
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "item:click"[], "item:click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
19
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("item:click" | "row:click")[], "item:click" | "row:click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
20
|
maxHeight: {
|
|
21
21
|
type: import("vue").PropType<number>;
|
|
22
22
|
default: undefined;
|
|
@@ -35,6 +35,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
35
35
|
};
|
|
36
36
|
}>> & {
|
|
37
37
|
"onItem:click"?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
"onRow:click"?: ((...args: any[]) => any) | undefined;
|
|
38
39
|
}, {
|
|
39
40
|
maxHeight: number;
|
|
40
41
|
rowHeight: number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
declare function blur(): void;
|
|
2
4
|
declare const _default: import("vue").DefineComponent<{
|
|
3
5
|
modelValue: {
|
|
4
6
|
default: string;
|
|
@@ -71,7 +73,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
73
|
type: (ArrayConstructor | StringConstructor | FunctionConstructor)[];
|
|
72
74
|
default(): null;
|
|
73
75
|
};
|
|
74
|
-
}, {
|
|
76
|
+
}, {
|
|
77
|
+
focus: typeof focus;
|
|
78
|
+
blur: typeof blur;
|
|
79
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "focus" | "blur")[], "update:modelValue" | "focus" | "blur", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
75
80
|
modelValue: {
|
|
76
81
|
default: string;
|
|
77
82
|
type: PropType<string | number | null>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
declare function blur(): void;
|
|
2
4
|
declare const _default: import("vue").DefineComponent<{
|
|
3
5
|
/**
|
|
4
6
|
* The value of the input. Can be a number or null.
|
|
@@ -56,7 +58,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
56
58
|
default: undefined;
|
|
57
59
|
type: NumberConstructor;
|
|
58
60
|
};
|
|
59
|
-
}, {
|
|
61
|
+
}, {
|
|
62
|
+
focus: typeof focus;
|
|
63
|
+
blur: typeof blur;
|
|
64
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "focus" | "blur")[], "update:modelValue" | "focus" | "blur", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
60
65
|
/**
|
|
61
66
|
* The value of the input. Can be a number or null.
|
|
62
67
|
* 0.1 = 10%
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
declare function blur(): void;
|
|
2
4
|
declare const _default: import("vue").DefineComponent<{
|
|
3
5
|
modelValue: {
|
|
4
6
|
default: string;
|
|
@@ -24,7 +26,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
26
|
default: boolean;
|
|
25
27
|
type: BooleanConstructor;
|
|
26
28
|
};
|
|
27
|
-
}, {
|
|
29
|
+
}, {
|
|
30
|
+
focus: typeof focus;
|
|
31
|
+
blur: typeof blur;
|
|
32
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
33
|
modelValue: {
|
|
29
34
|
default: string;
|
|
30
35
|
type: PropType<string | null>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
declare function blur(): void;
|
|
2
4
|
declare const _default: import("vue").DefineComponent<{
|
|
3
5
|
modelValue: {
|
|
4
6
|
default: undefined;
|
|
@@ -40,7 +42,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
40
42
|
default: boolean;
|
|
41
43
|
type: BooleanConstructor;
|
|
42
44
|
};
|
|
43
|
-
}, {
|
|
45
|
+
}, {
|
|
46
|
+
focus: typeof focus;
|
|
47
|
+
blur: typeof blur;
|
|
48
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
49
|
modelValue: {
|
|
45
50
|
default: undefined;
|
|
46
51
|
type: PropType<string | null | undefined>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
declare function focus(): void;
|
|
3
|
+
declare function blur(): void;
|
|
2
4
|
declare const _default: import("vue").DefineComponent<{
|
|
3
5
|
modelValue: {
|
|
4
6
|
default: string;
|
|
@@ -44,7 +46,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
46
|
default: string;
|
|
45
47
|
type: PropType<string | string[]>;
|
|
46
48
|
};
|
|
47
|
-
}, {
|
|
49
|
+
}, {
|
|
50
|
+
focus: typeof focus;
|
|
51
|
+
blur: typeof blur;
|
|
52
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("input" | "submit" | "update:modelValue" | "focus")[], "input" | "submit" | "update:modelValue" | "focus", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
53
|
modelValue: {
|
|
49
54
|
default: string;
|
|
50
55
|
type: PropType<string | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
modelValue: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: PropType<string | number | null>;
|
|
6
|
+
};
|
|
7
|
+
numberOfCharacters: {
|
|
8
|
+
required: true;
|
|
9
|
+
type: NumberConstructor;
|
|
10
|
+
};
|
|
11
|
+
type: {
|
|
12
|
+
default: string;
|
|
13
|
+
type: PropType<"numeric" | "alphanumeric">;
|
|
14
|
+
};
|
|
15
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
modelValue: {
|
|
17
|
+
required: true;
|
|
18
|
+
type: PropType<string | number | null>;
|
|
19
|
+
};
|
|
20
|
+
numberOfCharacters: {
|
|
21
|
+
required: true;
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
};
|
|
24
|
+
type: {
|
|
25
|
+
default: string;
|
|
26
|
+
type: PropType<"numeric" | "alphanumeric">;
|
|
27
|
+
};
|
|
28
|
+
}>> & {
|
|
29
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
type: "numeric" | "alphanumeric";
|
|
32
|
+
}, {}>;
|
|
33
|
+
export default _default;
|
|
@@ -88,8 +88,9 @@ import BaseTextarea from './BaseTextarea.vue';
|
|
|
88
88
|
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
89
89
|
import BaseTimeline from './BaseTimeline.vue';
|
|
90
90
|
import BaseTimelineItem from './BaseTimelineItem.vue';
|
|
91
|
+
import BaseUniqueCode from './BaseUniqueCode.vue';
|
|
91
92
|
import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
92
93
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
93
94
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
94
95
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
95
|
-
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
96
|
+
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClickOutside, BaseClipboard, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseUniqueCode, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
@@ -18,6 +18,7 @@ declare const messages: {
|
|
|
18
18
|
and: string;
|
|
19
19
|
apply: string;
|
|
20
20
|
apply_filters: string;
|
|
21
|
+
authentication_code: string;
|
|
21
22
|
autocomplete_placeholder: string;
|
|
22
23
|
cancel: string;
|
|
23
24
|
city: string;
|
|
@@ -105,6 +106,7 @@ declare const messages: {
|
|
|
105
106
|
and: string;
|
|
106
107
|
apply: string;
|
|
107
108
|
apply_filters: string;
|
|
109
|
+
authentication_code: string;
|
|
108
110
|
autocomplete_placeholder: string;
|
|
109
111
|
cancel: string;
|
|
110
112
|
city: string;
|
package/package.json
CHANGED
|
@@ -59,11 +59,15 @@ const Template = (args) => ({
|
|
|
59
59
|
alert(`Item "${item.name}" clicked`);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
function onRowClick(item) {
|
|
63
|
+
alert(`Row "${item.name}" clicked`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return { args, onItemClick, onRowClick };
|
|
63
67
|
},
|
|
64
68
|
template: `
|
|
65
69
|
<BaseCard clipped>
|
|
66
|
-
<BaseGantt v-bind="args" @item:click="onItemClick">
|
|
70
|
+
<BaseGantt v-bind="args" @item:click="onItemClick" @row:click="onRowClick">
|
|
67
71
|
</BaseGantt>
|
|
68
72
|
</BaseCard>
|
|
69
73
|
`,
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
:style="{
|
|
35
35
|
height: `${props.rowHeight}px`,
|
|
36
36
|
}"
|
|
37
|
+
@click="$emit('row:click', row)"
|
|
37
38
|
>
|
|
38
39
|
<slot
|
|
39
40
|
name="sidebarItem"
|
|
@@ -250,6 +251,7 @@ const props = withDefaults(defineProps<{
|
|
|
250
251
|
|
|
251
252
|
defineEmits([
|
|
252
253
|
'item:click',
|
|
254
|
+
'row:click',
|
|
253
255
|
]);
|
|
254
256
|
|
|
255
257
|
// Config
|
|
@@ -149,3 +149,20 @@ export const Field = createFieldStory({
|
|
|
149
149
|
componentName: 'BaseInput',
|
|
150
150
|
label: 'Name',
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
const FocusTemplate = (args) => ({
|
|
155
|
+
components: { BaseInput },
|
|
156
|
+
setup() {
|
|
157
|
+
const value = ref(null);
|
|
158
|
+
const input = ref(null);
|
|
159
|
+
return { args, value, input };
|
|
160
|
+
},
|
|
161
|
+
template: `
|
|
162
|
+
<BaseInput ref="input" v-model="value" v-bind="args" class="w-full"></BaseInput>
|
|
163
|
+
|
|
164
|
+
<button @click="input.focus()" class="mt-4 underline">Focus</button>
|
|
165
|
+
`,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export const Focus = FocusTemplate.bind({});
|
|
@@ -156,6 +156,8 @@ const props = defineProps({
|
|
|
156
156
|
},
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
+
const input = ref<HTMLInputElement | null>(null);
|
|
160
|
+
|
|
159
161
|
const maskOptions = computed(() => {
|
|
160
162
|
if (props.mask) {
|
|
161
163
|
return {
|
|
@@ -246,4 +248,17 @@ const backgroundColor = computed(() => {
|
|
|
246
248
|
const textColor = computed(() => {
|
|
247
249
|
return hasErrorInternal.value ? 'text-red-800' : 'text-slate-600';
|
|
248
250
|
});
|
|
251
|
+
|
|
252
|
+
function focus() {
|
|
253
|
+
input.value?.focus();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function blur() {
|
|
257
|
+
input.value?.blur();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
defineExpose({
|
|
261
|
+
focus,
|
|
262
|
+
blur,
|
|
263
|
+
});
|
|
249
264
|
</script>
|
|
@@ -48,3 +48,19 @@ export const Field = createFieldStory({
|
|
|
48
48
|
componentName: 'BaseInputPercent',
|
|
49
49
|
label: 'Rebate',
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
const FocusTemplate = (args) => ({
|
|
53
|
+
components: { BaseInputPercent },
|
|
54
|
+
setup() {
|
|
55
|
+
const value = ref(null);
|
|
56
|
+
const input = ref(null);
|
|
57
|
+
return { args, value, input };
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
<BaseInputPercent ref="input" v-model="value" v-bind="args" class="w-full"></BaseInputPercent>
|
|
61
|
+
|
|
62
|
+
<button @click="input.focus()" class="mt-4 underline">Focus</button>
|
|
63
|
+
`,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const Focus = FocusTemplate.bind({});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<BaseInput
|
|
3
|
+
ref="input"
|
|
3
4
|
:model-value="value"
|
|
4
5
|
suffix="%"
|
|
5
6
|
type="number"
|
|
@@ -83,6 +84,8 @@ const props = defineProps({
|
|
|
83
84
|
|
|
84
85
|
const emit = defineEmits(['update:modelValue', 'focus', 'blur']);
|
|
85
86
|
|
|
87
|
+
const input = ref<HTMLInputElement | null>(null);
|
|
88
|
+
|
|
86
89
|
const stepNormalized = computed<number>(() => {
|
|
87
90
|
if (props.step === undefined) return 1;
|
|
88
91
|
if (props.step === 0) return 1;
|
|
@@ -120,4 +123,17 @@ function onUpdate(value: string | number | null) {
|
|
|
120
123
|
|
|
121
124
|
emit('update:modelValue', round(valueToNumber / 100, precision.value + 2));
|
|
122
125
|
}
|
|
126
|
+
|
|
127
|
+
function focus() {
|
|
128
|
+
input.value?.focus();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function blur() {
|
|
132
|
+
input.value?.blur();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
defineExpose({
|
|
136
|
+
focus,
|
|
137
|
+
blur,
|
|
138
|
+
});
|
|
123
139
|
</script>
|
|
@@ -39,3 +39,20 @@ export const Field = createFieldStory({
|
|
|
39
39
|
componentName: 'BasePassword',
|
|
40
40
|
label: 'Password',
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const FocusTemplate = (args) => ({
|
|
45
|
+
components: { BasePassword },
|
|
46
|
+
setup() {
|
|
47
|
+
const value = ref(null);
|
|
48
|
+
const input = ref(null);
|
|
49
|
+
return { args, value, input };
|
|
50
|
+
},
|
|
51
|
+
template: `
|
|
52
|
+
<BasePassword ref="input" v-model="value" v-bind="args" class="w-full"></BasePassword>
|
|
53
|
+
|
|
54
|
+
<button @click="input.focus()" class="mt-4 underline">Focus</button>
|
|
55
|
+
`,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const Focus = FocusTemplate.bind({});
|
|
@@ -73,6 +73,8 @@ const props = defineProps({
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
const input = ref<HTMLInputElement | null>(null);
|
|
77
|
+
|
|
76
78
|
const emit = defineEmits(['update:modelValue']);
|
|
77
79
|
|
|
78
80
|
const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
|
|
@@ -89,4 +91,17 @@ function onInput(event: any) {
|
|
|
89
91
|
const value = event.target.value + '';
|
|
90
92
|
emitUpdate(trim(value));
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
function focus() {
|
|
96
|
+
input.value?.focus();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function blur() {
|
|
100
|
+
input.value?.blur();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
defineExpose({
|
|
104
|
+
focus,
|
|
105
|
+
blur,
|
|
106
|
+
});
|
|
92
107
|
</script>
|
|
@@ -41,3 +41,19 @@ export const Field = createFieldStory({
|
|
|
41
41
|
componentName: 'BaseTextarea',
|
|
42
42
|
label: 'Biography',
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
const FocusTemplate = (args) => ({
|
|
46
|
+
components: { BaseTextarea },
|
|
47
|
+
setup() {
|
|
48
|
+
const value = ref(null);
|
|
49
|
+
const input = ref(null);
|
|
50
|
+
return { args, value, input };
|
|
51
|
+
},
|
|
52
|
+
template: `
|
|
53
|
+
<BaseTextarea ref="input" v-model="value" v-bind="args" class="w-full"></BaseTextarea>
|
|
54
|
+
|
|
55
|
+
<button @click="input.focus()" class="mt-4 underline">Focus</button>
|
|
56
|
+
`,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const Focus = FocusTemplate.bind({});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<textarea
|
|
3
|
+
ref="textareaRef"
|
|
3
4
|
:value="modelValue ?? undefined"
|
|
4
5
|
:type="type"
|
|
5
6
|
:name="nameInternal"
|
|
@@ -84,4 +85,19 @@ function transformInputValue(event: Event | null): string | null {
|
|
|
84
85
|
|
|
85
86
|
return '';
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
const textareaRef = ref<HTMLTextAreaElement | null>(null);
|
|
90
|
+
|
|
91
|
+
function focus() {
|
|
92
|
+
textareaRef.value?.focus();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function blur() {
|
|
96
|
+
textareaRef.value?.blur();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
defineExpose({
|
|
100
|
+
focus,
|
|
101
|
+
blur,
|
|
102
|
+
});
|
|
87
103
|
</script>
|
|
@@ -85,3 +85,19 @@ export const Field = createFieldStory({
|
|
|
85
85
|
componentName: 'BaseTextareaAutoresize',
|
|
86
86
|
label: 'Biography',
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
const FocusTemplate = (args) => ({
|
|
90
|
+
components: { BaseTextareaAutoresize },
|
|
91
|
+
setup() {
|
|
92
|
+
const value = ref(null);
|
|
93
|
+
const input = ref(null);
|
|
94
|
+
return { args, value, input };
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
<BaseTextareaAutoresize ref="input" v-model="value" v-bind="args" class="w-full"></BaseTextareaAutoresize>
|
|
98
|
+
|
|
99
|
+
<button @click="input.focus()" class="mt-4 underline">Focus</button>
|
|
100
|
+
`,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const Focus = FocusTemplate.bind({});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:style="{ maxHeight: maxHeight + 'px' }"
|
|
6
6
|
>
|
|
7
7
|
<textarea
|
|
8
|
+
ref="textareaRef"
|
|
8
9
|
:value="modelValue ?? ''"
|
|
9
10
|
:name="nameInternal"
|
|
10
11
|
:placeholder="placeholder"
|
|
@@ -95,6 +96,8 @@ const props = defineProps({
|
|
|
95
96
|
|
|
96
97
|
const emit = defineEmits(['update:modelValue', 'submit', 'focus', 'input']);
|
|
97
98
|
|
|
99
|
+
const textareaRef = ref<null | HTMLTextAreaElement>(null);
|
|
100
|
+
|
|
98
101
|
const { nameInternal, requiredInternal, hasErrorInternal } =
|
|
99
102
|
useField({
|
|
100
103
|
name: computed(() => props.name),
|
|
@@ -147,4 +150,17 @@ const textareaClasses = computed(() => {
|
|
|
147
150
|
props.twTextarea
|
|
148
151
|
);
|
|
149
152
|
});
|
|
153
|
+
|
|
154
|
+
function focus() {
|
|
155
|
+
textareaRef.value?.focus();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function blur() {
|
|
159
|
+
textareaRef.value?.blur();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
defineExpose({
|
|
163
|
+
focus,
|
|
164
|
+
blur,
|
|
165
|
+
});
|
|
150
166
|
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import BaseUniqueCode from './BaseUniqueCode.vue';
|
|
2
|
+
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/BaseUniqueCode',
|
|
6
|
+
component: BaseUniqueCode,
|
|
7
|
+
argTypes: {
|
|
8
|
+
type: {
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
options: ['numeric', 'alphanumeric'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => ({
|
|
16
|
+
components: { BaseUniqueCode, ShowValue },
|
|
17
|
+
setup() {
|
|
18
|
+
const value = ref('');
|
|
19
|
+
return { args, value };
|
|
20
|
+
},
|
|
21
|
+
template: `
|
|
22
|
+
<BaseUniqueCode v-model="value" v-bind="args" class="w-full"></BaseUniqueCode>
|
|
23
|
+
<ShowValue :value="value" />
|
|
24
|
+
`,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const Numeric = Template.bind({});
|
|
28
|
+
Numeric.args = {
|
|
29
|
+
numberOfCharacters: 4,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Alphanumeric = Template.bind({});
|
|
33
|
+
Alphanumeric.args = {
|
|
34
|
+
numberOfCharacters: 4,
|
|
35
|
+
type: 'text'
|
|
36
|
+
};
|