@saasmakers/ui 1.3.7 → 1.3.9
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.
|
@@ -50,6 +50,7 @@ export default {
|
|
|
50
50
|
] satisfies FieldSize[],
|
|
51
51
|
},
|
|
52
52
|
slugOnly: { control: 'boolean' },
|
|
53
|
+
trim: { control: 'boolean' },
|
|
53
54
|
type: {
|
|
54
55
|
control: 'select',
|
|
55
56
|
options: [
|
|
@@ -88,3 +89,12 @@ export const SlugOnly: StoryObj<typeof FieldInput> = {
|
|
|
88
89
|
slugOnly: true,
|
|
89
90
|
} satisfies Partial<FieldInput>,
|
|
90
91
|
}
|
|
92
|
+
|
|
93
|
+
export const Trim: StoryObj<typeof FieldInput> = {
|
|
94
|
+
args: {
|
|
95
|
+
label: 'First name',
|
|
96
|
+
modelValue: 'Julien ',
|
|
97
|
+
placeholder: 'Enter your first name',
|
|
98
|
+
trim: true,
|
|
99
|
+
} satisfies Partial<FieldInput>,
|
|
100
|
+
}
|
|
@@ -22,6 +22,7 @@ const props = withDefaults(defineProps<Omit<FieldInput, 'modelValue'>>(), {
|
|
|
22
22
|
required: false,
|
|
23
23
|
size: 'base',
|
|
24
24
|
slugOnly: false,
|
|
25
|
+
trim: false,
|
|
25
26
|
type: 'text',
|
|
26
27
|
uppercase: false,
|
|
27
28
|
validation: undefined,
|
|
@@ -66,7 +67,14 @@ function focus() {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
function trimModelValue() {
|
|
71
|
+
if (props.trim) {
|
|
72
|
+
modelValue.value = modelValue.value.toString().trim()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
function onFieldBlur(event: FocusEvent) {
|
|
77
|
+
trimModelValue()
|
|
70
78
|
emit('blur', event)
|
|
71
79
|
}
|
|
72
80
|
|
|
@@ -99,7 +107,8 @@ function onFieldKeyDown(event: KeyboardEvent) {
|
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
else if (event.key === 'Enter' && modelValue.value) {
|
|
102
|
-
|
|
110
|
+
trimModelValue()
|
|
111
|
+
emit('submit', event, (event.target as HTMLInputElement).value)
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
else if (props.type === 'number' && [
|
package/app/types/fields.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasmakers/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable Nuxt UI components for SaaS Makers projects",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,51 +17,50 @@
|
|
|
17
17
|
"public",
|
|
18
18
|
"uno.config.ts"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"dev": "storybook dev -p 3104 --no-open",
|
|
22
|
-
"lint": "eslint . --max-warnings=0",
|
|
23
|
-
"prepare": "nuxi prepare",
|
|
24
|
-
"typecheck": "nuxi typecheck"
|
|
25
|
-
},
|
|
26
20
|
"dependencies": {
|
|
27
|
-
"@capacitor/preferences": "
|
|
28
|
-
"@nuxt/icon": "
|
|
29
|
-
"@nuxt/scripts": "
|
|
30
|
-
"@nuxtjs/color-mode": "
|
|
31
|
-
"@nuxtjs/i18n": "
|
|
32
|
-
"@nuxtjs/plausible": "
|
|
33
|
-
"@nuxtjs/robots": "
|
|
34
|
-
"@nuxtjs/sitemap": "
|
|
35
|
-
"@nuxtjs/storybook": "
|
|
36
|
-
"@pinia/nuxt": "
|
|
37
|
-
"@unhead/vue": "
|
|
38
|
-
"@unocss/nuxt": "
|
|
39
|
-
"@unocss/reset": "
|
|
40
|
-
"@vuelidate/core": "
|
|
41
|
-
"@vuelidate/validators": "
|
|
42
|
-
"@vueuse/components": "
|
|
43
|
-
"@vueuse/core": "
|
|
44
|
-
"@vueuse/nuxt": "
|
|
45
|
-
"chartist": "
|
|
46
|
-
"floating-vue": "
|
|
47
|
-
"motion-v": "
|
|
48
|
-
"numbro": "
|
|
49
|
-
"snarkdown": "
|
|
50
|
-
"storybook": "
|
|
51
|
-
"unocss": "
|
|
52
|
-
"vue": "
|
|
53
|
-
"vue-router": "
|
|
21
|
+
"@capacitor/preferences": "8.0.0",
|
|
22
|
+
"@nuxt/icon": "2.1.1",
|
|
23
|
+
"@nuxt/scripts": "0.13.2",
|
|
24
|
+
"@nuxtjs/color-mode": "3.5.2",
|
|
25
|
+
"@nuxtjs/i18n": "10.2.1",
|
|
26
|
+
"@nuxtjs/plausible": "2.0.1",
|
|
27
|
+
"@nuxtjs/robots": "5.6.7",
|
|
28
|
+
"@nuxtjs/sitemap": "7.5.0",
|
|
29
|
+
"@nuxtjs/storybook": "9.0.1",
|
|
30
|
+
"@pinia/nuxt": "0.11.3",
|
|
31
|
+
"@unhead/vue": "2.0.19",
|
|
32
|
+
"@unocss/nuxt": "66.5.10",
|
|
33
|
+
"@unocss/reset": "66.5.10",
|
|
34
|
+
"@vuelidate/core": "2.0.3",
|
|
35
|
+
"@vuelidate/validators": "2.0.4",
|
|
36
|
+
"@vueuse/components": "14.1.0",
|
|
37
|
+
"@vueuse/core": "14.1.0",
|
|
38
|
+
"@vueuse/nuxt": "14.1.0",
|
|
39
|
+
"chartist": "1.5.0",
|
|
40
|
+
"floating-vue": "5.2.2",
|
|
41
|
+
"motion-v": "1.7.4",
|
|
42
|
+
"numbro": "2.5.0",
|
|
43
|
+
"snarkdown": "2.0.0",
|
|
44
|
+
"storybook": "9.0.5",
|
|
45
|
+
"unocss": "66.5.10",
|
|
46
|
+
"vue": "3.5.26",
|
|
47
|
+
"vue-router": "4.6.4"
|
|
54
48
|
},
|
|
55
49
|
"devDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
50
|
+
"nuxt": "4.2.2",
|
|
51
|
+
"typescript": "5.9.3",
|
|
52
|
+
"@saasmakers/shared": "0.2.5"
|
|
59
53
|
},
|
|
60
54
|
"peerDependencies": {
|
|
61
55
|
"@saasmakers/shared": "^0.2.0",
|
|
62
|
-
"nuxt": "
|
|
56
|
+
"nuxt": "4.2.2"
|
|
63
57
|
},
|
|
64
58
|
"publishConfig": {
|
|
65
59
|
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"dev": "storybook dev -p 3104 --no-open",
|
|
63
|
+
"lint": "eslint . --max-warnings=0",
|
|
64
|
+
"typecheck": "nuxi typecheck"
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
}
|