@saasmakers/ui 1.3.3 → 1.3.4
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.
|
@@ -99,7 +99,7 @@ function onOpenFilePicker() {
|
|
|
99
99
|
<div class="pointer-events-none min-w-0 flex flex-1 items-center gap-2">
|
|
100
100
|
<div
|
|
101
101
|
v-if="loading"
|
|
102
|
-
class="shrink-0
|
|
102
|
+
class="flex shrink-0 items-center justify-center"
|
|
103
103
|
:class="{
|
|
104
104
|
'h-7 w-7': size === 'xs',
|
|
105
105
|
'h-8 w-8': size === 'sm',
|
|
@@ -49,6 +49,7 @@ export default {
|
|
|
49
49
|
'lg',
|
|
50
50
|
] satisfies FieldSize[],
|
|
51
51
|
},
|
|
52
|
+
slugOnly: { control: 'boolean' },
|
|
52
53
|
type: {
|
|
53
54
|
control: 'select',
|
|
54
55
|
options: [
|
|
@@ -78,3 +79,12 @@ export const Default: StoryObj<typeof FieldInput> = {
|
|
|
78
79
|
placeholder: 'Enter text...',
|
|
79
80
|
} satisfies Partial<FieldInput>,
|
|
80
81
|
}
|
|
82
|
+
|
|
83
|
+
export const SlugOnly: StoryObj<typeof FieldInput> = {
|
|
84
|
+
args: {
|
|
85
|
+
label: 'Username',
|
|
86
|
+
modelValue: '',
|
|
87
|
+
placeholder: 'Enter your username',
|
|
88
|
+
slugOnly: true,
|
|
89
|
+
} satisfies Partial<FieldInput>,
|
|
90
|
+
}
|
|
@@ -21,6 +21,7 @@ const props = withDefaults(defineProps<Omit<FieldInput, 'modelValue'>>(), {
|
|
|
21
21
|
placeholder: '',
|
|
22
22
|
required: false,
|
|
23
23
|
size: 'base',
|
|
24
|
+
slugOnly: false,
|
|
24
25
|
type: 'text',
|
|
25
26
|
uppercase: false,
|
|
26
27
|
validation: undefined,
|
|
@@ -80,7 +81,10 @@ function onFieldInput(event: Event) {
|
|
|
80
81
|
value = props.max.toString()
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
if (props.
|
|
84
|
+
if (props.slugOnly) {
|
|
85
|
+
value = value.toString().toLowerCase().replace(/[^a-z0-9_-]/g, '')
|
|
86
|
+
}
|
|
87
|
+
else if (props.lowercaseOnly) {
|
|
84
88
|
value = value.toString().toLowerCase()
|
|
85
89
|
}
|
|
86
90
|
|
package/app/types/fields.d.ts
CHANGED