@saasmakers/ui 1.3.2 → 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.
|
@@ -76,7 +76,8 @@ function onOpenFilePicker() {
|
|
|
76
76
|
:class="{
|
|
77
77
|
'cursor-pointer': !disabled && !loading,
|
|
78
78
|
'field-disabled': disabled,
|
|
79
|
-
'pointer-events-none opacity-50': disabled
|
|
79
|
+
'pointer-events-none opacity-50': disabled,
|
|
80
|
+
'pointer-events-none': loading,
|
|
80
81
|
'hover:border-gray-300 focus:border-gray-400 dark:hover:border-gray-700 dark:focus:border-gray-600': border === 'full' && !disabled && !loading,
|
|
81
82
|
'bg-gray-100 dark:bg-gray-900': background === 'gray',
|
|
82
83
|
'bg-white dark:bg-gray-900': background === 'white',
|
|
@@ -96,11 +97,20 @@ function onOpenFilePicker() {
|
|
|
96
97
|
@keydown.space.prevent="onOpenFilePicker"
|
|
97
98
|
>
|
|
98
99
|
<div class="pointer-events-none min-w-0 flex flex-1 items-center gap-2">
|
|
99
|
-
<
|
|
100
|
+
<div
|
|
100
101
|
v-if="loading"
|
|
101
|
-
class="shrink-0"
|
|
102
|
-
:
|
|
103
|
-
|
|
102
|
+
class="flex shrink-0 items-center justify-center"
|
|
103
|
+
:class="{
|
|
104
|
+
'h-7 w-7': size === 'xs',
|
|
105
|
+
'h-8 w-8': size === 'sm',
|
|
106
|
+
'h-9 w-9': size === 'base',
|
|
107
|
+
'h-10 w-10': size === 'lg',
|
|
108
|
+
}"
|
|
109
|
+
>
|
|
110
|
+
<BaseSpinner
|
|
111
|
+
:size="size === 'xs' ? 'sm' : size === 'sm' ? 'base' : size === 'base' ? 'lg' : 'xl'"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
104
114
|
|
|
105
115
|
<BaseAvatar
|
|
106
116
|
v-else
|
|
@@ -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