@konoma-development/vue-components 0.1.10 → 0.1.12
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.
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
<KonomaCheckbox
|
|
8
8
|
v-for="(option, i) in options"
|
|
9
9
|
:key="i"
|
|
10
|
-
|
|
11
|
-
:error="error"
|
|
12
|
-
v-bind="{ ...$attrs, ...childClasses }"
|
|
10
|
+
v-bind="{ ...props, ...childClasses }"
|
|
13
11
|
:value="values?.includes(option.value)"
|
|
14
12
|
@change=" (_, e) => $emit('change', option.value, e)"
|
|
15
13
|
>
|
|
@@ -32,7 +30,7 @@ import { positionClasses } from '../../types/form';
|
|
|
32
30
|
import { baseClasses } from '../defaults/checkboxList';
|
|
33
31
|
import KonomaCheckbox from './KonomaCheckbox.vue';
|
|
34
32
|
|
|
35
|
-
withDefaults(defineProps<FormFieldProps<DataType>>(), {
|
|
33
|
+
const props = withDefaults(defineProps<FormFieldProps<DataType>>(), {
|
|
36
34
|
labelClasses: baseClasses.labelClasses,
|
|
37
35
|
wrapperClasses: baseClasses.wrapperClasses,
|
|
38
36
|
classes: baseClasses.classes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<form @submit="submit">
|
|
2
|
+
<form ref="formRef" @submit="submit">
|
|
3
3
|
<slot />
|
|
4
4
|
</form>
|
|
5
5
|
</template>
|
|
@@ -17,9 +17,15 @@ const emit = defineEmits<{
|
|
|
17
17
|
(e: 'onSubmit'): void | Promise<void>
|
|
18
18
|
}>()
|
|
19
19
|
|
|
20
|
+
const formRef = useTemplateRef<HTMLFormElement>('formRef')
|
|
21
|
+
|
|
20
22
|
const errors = ref<Partial<Record<keyof DataType, string[]>>>({})
|
|
21
23
|
const submitAttempted = ref(false)
|
|
22
24
|
|
|
25
|
+
defineExpose({
|
|
26
|
+
formRef,
|
|
27
|
+
})
|
|
28
|
+
|
|
23
29
|
function validate() {
|
|
24
30
|
let invalid = false;
|
|
25
31
|
const newErrors: Record<keyof DataType, string[]> = {} as Record<keyof DataType, string[]>;
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
:is="resolvedComponent"
|
|
5
5
|
v-bind="props"
|
|
6
6
|
:error="errors && props.name ? errors[props.name as keyof typeof errors] : undefined"
|
|
7
|
-
v-on="emit"
|
|
8
7
|
@change="emit('change', $event)"
|
|
8
|
+
@icon-left-click="emit('iconLeftClick', $event)"
|
|
9
|
+
@icon-right-click="emit('iconRightClick', $event)"
|
|
10
|
+
@blur="emit('blur', $event)"
|
|
11
|
+
@focus="emit('focus', $event)"
|
|
12
|
+
@key-down="emit('keyDown', $event)"
|
|
13
|
+
@input="emit('input', $event)"
|
|
14
|
+
@click="emit('click', $event)"
|
|
9
15
|
>
|
|
10
16
|
<template #label>
|
|
11
17
|
<slot name="label" />
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
:name="iconLeftName"
|
|
33
33
|
:path="iconLeftPath"
|
|
34
34
|
:class="iconLeftClasses"
|
|
35
|
-
@click="$emit('iconLeftClick')"
|
|
35
|
+
@click="$emit('iconLeftClick', $event)"
|
|
36
36
|
/>
|
|
37
37
|
<div v-if="iconRightPath || iconRightName || textRight" :class="wrapperRightClasses">
|
|
38
38
|
<span v-if="textRight">{{ textRight }}</span>
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div class="flex flex-row items-center justify-center" @click="emit('click', $event)">
|
|
3
|
+
<svg v-if="path" :class="props.class">
|
|
4
|
+
<use :href="path" />
|
|
5
|
+
</svg>
|
|
6
|
+
<Icon v-else-if="name" :name="name" :class="props.class" />
|
|
7
|
+
</div>
|
|
6
8
|
</template>
|
|
7
9
|
|
|
8
10
|
<script lang="ts" setup>
|
|
9
|
-
defineProps<{
|
|
11
|
+
const props = defineProps<{
|
|
10
12
|
name?: string
|
|
11
13
|
path?: string
|
|
14
|
+
class?: string
|
|
12
15
|
}>()
|
|
13
16
|
|
|
14
|
-
defineEmits<{
|
|
17
|
+
const emit = defineEmits<{
|
|
15
18
|
(e: 'click', event: MouseEvent): void
|
|
16
19
|
}>()
|
|
17
20
|
</script>
|
package/package.json
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.12",
|
|
8
8
|
"packageManager": "yarn@4.14.1",
|
|
9
9
|
"main": "./nuxt.config.ts",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "nuxi dev .playground",
|
|
12
|
+
"prepare": "nuxi prepare",
|
|
12
13
|
"build": "nuxt build .playground",
|
|
13
14
|
"generate": "nuxt generate .playground",
|
|
14
15
|
"audit": "yarn npm audit --all --recursive --severity high",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"@iconify-json/carbon": "1.2.20",
|
|
29
30
|
"@nuxt/devtools": "3.2.4",
|
|
30
31
|
"@nuxt/eslint": "1.15.2",
|
|
31
|
-
"@nuxt/icon": "2.2.
|
|
32
|
+
"@nuxt/icon": "2.2.2",
|
|
32
33
|
"@nuxt/schema": "4.4.4",
|
|
33
34
|
"@nuxt/test-utils": "4.0.3",
|
|
34
35
|
"@pinia/nuxt": "0.11.3",
|
|
@@ -38,10 +39,10 @@
|
|
|
38
39
|
"@unocss/nuxt": "66.6.8",
|
|
39
40
|
"@unocss/reset": "66.6.8",
|
|
40
41
|
"@vitejs/plugin-vue": "6.0.6",
|
|
41
|
-
"@vueuse/nuxt": "14.
|
|
42
|
+
"@vueuse/nuxt": "14.3.0",
|
|
42
43
|
"babel-preset-vue": "2.0.2",
|
|
43
44
|
"changelogen": "0.6.2",
|
|
44
|
-
"eslint": "10.
|
|
45
|
+
"eslint": "10.3.0",
|
|
45
46
|
"floating-vue": "5.2.2",
|
|
46
47
|
"nuxt": "4.4.4",
|
|
47
48
|
"nuxt-headlessui": "1.2.2",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"unocss": "66.6.8",
|
|
52
53
|
"unocss-preset-scrollbar": "3.2.0",
|
|
53
54
|
"vite": "8.0.10",
|
|
54
|
-
"vue-tsc": "3.2.
|
|
55
|
+
"vue-tsc": "3.2.8",
|
|
55
56
|
"vue3-select-component": "0.16.2"
|
|
56
57
|
}
|
|
57
58
|
}
|
package/types/form.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { ClassValue } from 'vue';
|
|
2
|
-
|
|
3
1
|
type LabelPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
4
2
|
|
|
5
3
|
export interface FormDataType {
|
|
@@ -15,75 +13,74 @@ export interface Option {
|
|
|
15
13
|
|
|
16
14
|
/** Classes for the form components. Not all classes have effects in all components. Properties that start with 'class-' apply to the component in general, other properties apply to specific parts of the component */
|
|
17
15
|
export interface Classes {
|
|
18
|
-
class?:
|
|
16
|
+
class?: string
|
|
19
17
|
/** Base classes, usually assigned to the control */
|
|
20
|
-
classes?:
|
|
18
|
+
classes?: string
|
|
21
19
|
/** Base classes, assigned directly to the control. Might be needed in case of more complex nesting */
|
|
22
|
-
controlClasses?:
|
|
20
|
+
controlClasses?: string
|
|
23
21
|
/** Used for components that have specific styling when in neutral state */
|
|
24
|
-
classesNeutral?:
|
|
22
|
+
classesNeutral?: string
|
|
25
23
|
/** Used for components that have specific styling when empty */
|
|
26
|
-
classesEmpty?:
|
|
27
|
-
classesDisabled?:
|
|
24
|
+
classesEmpty?: string
|
|
25
|
+
classesDisabled?: string
|
|
28
26
|
/** Used for components that have specific styling when in error */
|
|
29
|
-
classesError?:
|
|
27
|
+
classesError?: string
|
|
30
28
|
/** Used for components that have specific styling when filled */
|
|
31
|
-
classesFilled?:
|
|
29
|
+
classesFilled?: string
|
|
32
30
|
/** Used for the label in components that have specific styling when empty */
|
|
33
|
-
labelClassesEmpty?:
|
|
31
|
+
labelClassesEmpty?: string
|
|
34
32
|
/** Used for the label in components that have specific styling when in error */
|
|
35
|
-
labelClassesError?:
|
|
33
|
+
labelClassesError?: string
|
|
36
34
|
/** Used for the label in components that have specific styling when filled */
|
|
37
|
-
labelClassesFilled?:
|
|
35
|
+
labelClassesFilled?: string
|
|
38
36
|
/** General classes for the label */
|
|
39
|
-
labelClasses?:
|
|
37
|
+
labelClasses?: string
|
|
40
38
|
/** Needed in case of nested label */
|
|
41
|
-
labelWrapperClasses?:
|
|
39
|
+
labelWrapperClasses?: string
|
|
42
40
|
/** Used for the icon in components that have specific styling when filled */
|
|
43
|
-
iconClassesFilled?:
|
|
41
|
+
iconClassesFilled?: string
|
|
44
42
|
/** General classes for the wrapper */
|
|
45
|
-
wrapperClasses?:
|
|
43
|
+
wrapperClasses?: string
|
|
46
44
|
/** General classes for the icon on the left */
|
|
47
|
-
iconLeftClasses?:
|
|
45
|
+
iconLeftClasses?: string
|
|
48
46
|
/** General classes for the icon on the right */
|
|
49
|
-
iconRightClasses?:
|
|
47
|
+
iconRightClasses?: string
|
|
50
48
|
/** General classes for the error message */
|
|
51
|
-
errorClasses?:
|
|
49
|
+
errorClasses?: string
|
|
52
50
|
/** Additional classes for the control when an icon is present on the left */
|
|
53
|
-
additionalClassesIconLeft?:
|
|
51
|
+
additionalClassesIconLeft?: string
|
|
54
52
|
/** Additional classes for the control when an icon is present on the right */
|
|
55
|
-
additionalClassesIconRight?:
|
|
53
|
+
additionalClassesIconRight?: string
|
|
56
54
|
/** General classes for hints placed within the component */
|
|
57
|
-
hintClasses?:
|
|
55
|
+
hintClasses?: string
|
|
58
56
|
/** General classes for the resize element */
|
|
59
|
-
resizeClasses?:
|
|
57
|
+
resizeClasses?: string
|
|
60
58
|
/** General classes for the icon within the resize element */
|
|
61
|
-
resizeIconClasses?:
|
|
59
|
+
resizeIconClasses?: string
|
|
62
60
|
/** Classes to be applied to all values for components with multiple possible values */
|
|
63
|
-
optionClasses?:
|
|
61
|
+
optionClasses?: string
|
|
64
62
|
/** Classes to be applied to the wrapper for elements on the left side */
|
|
65
|
-
wrapperLeftClasses?:
|
|
63
|
+
wrapperLeftClasses?: string
|
|
66
64
|
/** Classes to be applied to the wrapper for elements on the right side */
|
|
67
|
-
wrapperRightClasses?:
|
|
65
|
+
wrapperRightClasses?: string
|
|
68
66
|
// Properties for classes specific to the select component since it is effectively an Omnibox that is more complex than the other form components
|
|
69
|
-
focusClasses?:
|
|
70
|
-
optionFocusedClasses?:
|
|
71
|
-
optionSelectedClasses?:
|
|
72
|
-
valueClasses?:
|
|
73
|
-
placeholderClasses?:
|
|
74
|
-
indicatorClasses?:
|
|
75
|
-
valueContainerClasses?:
|
|
67
|
+
focusClasses?: string
|
|
68
|
+
optionFocusedClasses?: string
|
|
69
|
+
optionSelectedClasses?: string
|
|
70
|
+
valueClasses?: string
|
|
71
|
+
placeholderClasses?: string
|
|
72
|
+
indicatorClasses?: string
|
|
73
|
+
valueContainerClasses?: string
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
export interface FormFieldEmits {
|
|
79
|
-
(e: 'forgotPWAction', event: MouseEvent): void
|
|
80
77
|
(e: 'blur', event: FocusEvent): void
|
|
81
78
|
(e: 'focus', event: FocusEvent): void
|
|
82
79
|
(e: 'change', value: FormValue | FormValue[], event?: Event): void
|
|
83
80
|
(e: 'input', value: FormValue, event?: InputEvent): void
|
|
84
81
|
(e: 'click', event: MouseEvent): void
|
|
85
82
|
(e: 'iconRightClick', event: MouseEvent): void
|
|
86
|
-
(e: 'iconLeftClick'): void
|
|
83
|
+
(e: 'iconLeftClick', event: MouseEvent): void
|
|
87
84
|
(e: 'keyDown', event: KeyboardEvent): void
|
|
88
85
|
}
|
|
89
86
|
|