srcdev-nuxt-forms 2.3.0 → 2.4.0
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/components/forms/input-button/InputButtonCore.vue +1 -1
- package/components/forms/input-button/variants/InputButtonConfirm.vue +2 -14
- package/components/forms/input-button/variants/InputButtonSubmit.vue +2 -2
- package/components/forms/input-checkbox/MultipleCheckboxes.vue +3 -6
- package/components/forms/input-checkbox/SingleCheckbox.vue +7 -11
- package/components/forms/input-checkbox-radio/InputCheckboxRadioButton.vue +4 -4
- package/components/forms/input-checkbox-radio/InputCheckboxRadioCore.vue +6 -6
- package/components/forms/input-checkbox-radio/InputCheckboxRadioWithLabel.vue +3 -6
- package/components/forms/input-number/InputNumberCore.vue +4 -6
- package/components/forms/input-number/variants/InputNumberDefault.vue +4 -7
- package/components/forms/input-radio/MultipleRadiobuttons.vue +5 -8
- package/components/forms/input-range/InputRangeCore.vue +2 -2
- package/components/forms/input-range/variants/InputRangeDefault.vue +2 -5
- package/components/forms/input-range-fancy/InputRangeFancyCore.vue +3 -3
- package/components/forms/input-range-fancy/InputRangeFancyWithLabel.vue +3 -3
- package/components/forms/input-text/InputTextCore.vue +7 -8
- package/components/forms/input-text/variants/InputPasswordWithLabel.vue +5 -37
- package/components/forms/input-text/variants/InputTextAsNumberWithLabel.vue +8 -11
- package/components/forms/input-text/variants/InputTextWithLabel.vue +6 -9
- package/components/forms/input-textarea/InputTextareaCore.vue +3 -7
- package/components/forms/input-textarea/variants/InputTextareaWithLabel.vue +4 -7
- package/components/forms/toggle-switch/ToggleSwitchCore.vue +5 -5
- package/components/forms/toggle-switch/variants/ToggleSwitchWithLabel.vue +7 -10
- package/components/forms/toggle-switch/variants/ToggleSwitchWithLabelInline.vue +5 -7
- package/components/utils/dark-mode-switcher/DarkModeSwitcher.vue +2 -6
- package/package.json +4 -4
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<InputButtonCore
|
|
3
|
-
type="button"
|
|
4
|
-
:use-effect="useEffect"
|
|
5
|
-
:isPending="isPending"
|
|
6
|
-
:readonly
|
|
7
|
-
:effect="effect"
|
|
8
|
-
:data-testid="dataTestid"
|
|
9
|
-
:size
|
|
10
|
-
:weight
|
|
11
|
-
:button-text="buttonText"
|
|
12
|
-
:style-class-passthrough
|
|
13
|
-
:theme
|
|
14
|
-
>
|
|
2
|
+
<InputButtonCore type="button" :use-effect :isPending :readonly :effect :data-testid :size :weight :button-text :style-class-passthrough :theme>
|
|
15
3
|
<template #left>
|
|
16
4
|
<Icon name="material-symbols:check-circle-outline" class="icon" />
|
|
17
5
|
</template>
|
|
@@ -21,7 +9,7 @@
|
|
|
21
9
|
<script setup lang="ts">
|
|
22
10
|
import propValidators from '../../c12/prop-validators';
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
defineProps({
|
|
25
13
|
size: {
|
|
26
14
|
type: String as PropType<string>,
|
|
27
15
|
default: 'normal',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<InputButtonCore type="button" :use-effect
|
|
2
|
+
<InputButtonCore type="button" :use-effect :isPending :readonly :effect :data-testid :size :weight :button-text :style-class-passthrough :theme />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
6
|
import propValidators from '../../c12/prop-validators';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
defineProps({
|
|
9
9
|
size: {
|
|
10
10
|
type: String as PropType<string>,
|
|
11
11
|
default: 'normal',
|
|
@@ -62,15 +62,11 @@
|
|
|
62
62
|
import propValidators from '../c12/prop-validators';
|
|
63
63
|
import type { IOptionsConfig, IFormMultipleOptions } from '@/types/types.forms';
|
|
64
64
|
|
|
65
|
-
const { dataTestid,
|
|
65
|
+
const { dataTestid, name, legend, label, required, fieldHasError, placeholder, isButton, errorMessage, size, optionsLayout, equalCols, styleClassPassthrough, theme, direction } = defineProps({
|
|
66
66
|
dataTestid: {
|
|
67
67
|
type: String,
|
|
68
68
|
default: 'multiple-checkboxes',
|
|
69
69
|
},
|
|
70
|
-
id: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
74
70
|
name: {
|
|
75
71
|
type: String,
|
|
76
72
|
required: true,
|
|
@@ -153,9 +149,10 @@ const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleC
|
|
|
153
149
|
const modelValue = defineModel();
|
|
154
150
|
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
155
151
|
|
|
152
|
+
const id = useId();
|
|
156
153
|
const errorId = `${name}-error-message`;
|
|
157
154
|
const ariaDescribedby = computed(() => {
|
|
158
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` :
|
|
155
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
|
|
159
156
|
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
160
157
|
});
|
|
161
158
|
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
<div class="single-checkbox-items" :class="[optionsLayout]">
|
|
10
|
-
<InputCheckboxRadioWithLabel type="checkbox" :
|
|
10
|
+
<InputCheckboxRadioWithLabel type="checkbox" :name :required :label :fieldHasError v-model="modelValue" :trueValue :falseValue :size :theme :ariaDescribedby>
|
|
11
11
|
<template #checkedIcon>
|
|
12
12
|
<slot name="checkedIcon"></slot>
|
|
13
13
|
</template>
|
|
@@ -24,15 +24,11 @@
|
|
|
24
24
|
import propValidators from '../c12/prop-validators';
|
|
25
25
|
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const props = defineProps({
|
|
28
28
|
dataTestid: {
|
|
29
29
|
type: String,
|
|
30
30
|
default: 'multiple-radio-buttons',
|
|
31
31
|
},
|
|
32
|
-
id: {
|
|
33
|
-
type: String,
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
32
|
name: {
|
|
37
33
|
type: String,
|
|
38
34
|
required: true,
|
|
@@ -106,21 +102,21 @@ const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
|
106
102
|
const hasDescription = computed(() => slots.description !== undefined);
|
|
107
103
|
const hasLabelContent = computed(() => slots.labelContent !== undefined);
|
|
108
104
|
|
|
109
|
-
const { elementClasses
|
|
105
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
110
106
|
|
|
111
107
|
const modelValue = defineModel();
|
|
112
108
|
const fieldData = defineModel('fieldData') as Ref<IFormMultipleOptions>;
|
|
113
109
|
|
|
114
|
-
const inputErrorStyles = ref<string[]>(styleClassPassthrough);
|
|
110
|
+
const inputErrorStyles = ref<string[]>(props.styleClassPassthrough);
|
|
115
111
|
|
|
116
112
|
const errorId = `${name}-error-message`;
|
|
117
113
|
const ariaDescribedby = computed(() => {
|
|
118
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` :
|
|
119
|
-
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
114
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${name}-description` : undefined;
|
|
115
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
120
116
|
});
|
|
121
117
|
|
|
122
118
|
watchEffect(() => {
|
|
123
|
-
if (!hasDescription.value && fieldHasError) {
|
|
119
|
+
if (!hasDescription.value && props.fieldHasError) {
|
|
124
120
|
inputErrorStyles.value.push('mbs-12');
|
|
125
121
|
} else {
|
|
126
122
|
inputErrorStyles.value = inputErrorStyles.value.filter((style) => style !== 'mbs-12');
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import propValidators from '../c12/prop-validators';
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const props = defineProps({
|
|
24
24
|
type: {
|
|
25
25
|
type: String as PropType<'checkbox' | 'radio'>,
|
|
26
26
|
required: true,
|
|
@@ -93,15 +93,15 @@ const { type, id, name, label, required, fieldHasError, trueValue, falseValue, s
|
|
|
93
93
|
|
|
94
94
|
const slots = useSlots();
|
|
95
95
|
const hasLabelContent = computed(() => slots.labelContent !== undefined);
|
|
96
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
96
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
97
97
|
|
|
98
98
|
const modelValue = defineModel();
|
|
99
99
|
|
|
100
100
|
const formTheme = computed(() => {
|
|
101
|
-
return fieldHasError ? 'error' : theme;
|
|
101
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
const flexDirection = ref(direction);
|
|
104
|
+
const flexDirection = ref(props.direction);
|
|
105
105
|
</script>
|
|
106
106
|
|
|
107
107
|
<style lang="css">
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
27
|
import propValidators from '../c12/prop-validators';
|
|
28
|
-
const
|
|
28
|
+
const props = defineProps({
|
|
29
29
|
isButton: {
|
|
30
30
|
type: Boolean,
|
|
31
31
|
default: false,
|
|
@@ -86,10 +86,10 @@ const { isButton, type, id, name, required, trueValue, falseValue, multipleOptio
|
|
|
86
86
|
},
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
const { elementClasses
|
|
89
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
90
90
|
|
|
91
91
|
const formTheme = computed(() => {
|
|
92
|
-
return fieldHasError ? 'error' : theme;
|
|
92
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
const modelValue = defineModel<any>();
|
|
@@ -97,16 +97,16 @@ const modelValue = defineModel<any>();
|
|
|
97
97
|
const inputField = ref<HTMLInputElement | null>(null);
|
|
98
98
|
|
|
99
99
|
const defaultIcon = computed(() => {
|
|
100
|
-
return type === 'checkbox' ? 'material-symbols:check-small' : 'material-symbols:circle';
|
|
100
|
+
return props.type === 'checkbox' ? 'material-symbols:check-small' : 'material-symbols:circle';
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
const isArray = Array.isArray(modelValue.value);
|
|
104
104
|
|
|
105
105
|
const isChecked = computed(() => {
|
|
106
106
|
if (isArray) {
|
|
107
|
-
return modelValue.value.includes(trueValue);
|
|
107
|
+
return modelValue.value.includes(props.trueValue);
|
|
108
108
|
} else {
|
|
109
|
-
return modelValue.value === trueValue;
|
|
109
|
+
return modelValue.value === props.trueValue;
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
</script>
|
|
@@ -15,15 +15,11 @@
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import propValidators from '../c12/prop-validators';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const props = defineProps({
|
|
19
19
|
type: {
|
|
20
20
|
type: String as PropType<'checkbox' | 'radio'>,
|
|
21
21
|
required: true,
|
|
22
22
|
},
|
|
23
|
-
id: {
|
|
24
|
-
type: String,
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
23
|
name: {
|
|
28
24
|
type: String,
|
|
29
25
|
required: true,
|
|
@@ -81,9 +77,10 @@ const { type, id, name, label, required, fieldHasError, trueValue, falseValue, s
|
|
|
81
77
|
|
|
82
78
|
const slots = useSlots();
|
|
83
79
|
const hasLabelContent = computed(() => slots.labelContent !== undefined);
|
|
84
|
-
const { elementClasses
|
|
80
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
85
81
|
|
|
86
82
|
const modelValue = defineModel();
|
|
83
|
+
const id = useId();
|
|
87
84
|
</script>
|
|
88
85
|
|
|
89
86
|
<style lang="css">
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<script setup lang="ts">
|
|
30
30
|
import propValidators from '../c12/prop-validators';
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const props = defineProps({
|
|
33
33
|
id: {
|
|
34
34
|
type: String,
|
|
35
35
|
required: true,
|
|
@@ -94,15 +94,13 @@ const hasLeftContent = computed(() => slots.left !== undefined);
|
|
|
94
94
|
const hasRightContent = computed(() => slots.right !== undefined);
|
|
95
95
|
|
|
96
96
|
const formTheme = computed(() => {
|
|
97
|
-
return fieldHasError ? 'error' : theme;
|
|
97
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
const modelValue = defineModel<number | readonly number[]>();
|
|
101
101
|
|
|
102
|
-
const { elementClasses
|
|
103
|
-
const minLength = computed(() => `${max.toString().length +
|
|
104
|
-
|
|
105
|
-
// updateElementClasses(['number-1']);
|
|
102
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
103
|
+
const minLength = computed(() => `${props.max.toString().length + 1}em`);
|
|
106
104
|
</script>
|
|
107
105
|
|
|
108
106
|
<style lang="css">
|
|
@@ -44,11 +44,7 @@
|
|
|
44
44
|
<script setup lang="ts">
|
|
45
45
|
import propValidators from '../../c12/prop-validators';
|
|
46
46
|
|
|
47
|
-
const
|
|
48
|
-
id: {
|
|
49
|
-
type: String,
|
|
50
|
-
required: true,
|
|
51
|
-
},
|
|
47
|
+
const props = defineProps({
|
|
52
48
|
name: {
|
|
53
49
|
type: String,
|
|
54
50
|
required: true,
|
|
@@ -116,10 +112,11 @@ const slots = useSlots();
|
|
|
116
112
|
const hasDescription = computed(() => slots.description !== undefined);
|
|
117
113
|
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
118
114
|
const hasRightContent = computed(() => slots.right !== undefined);
|
|
119
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
115
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
120
116
|
|
|
117
|
+
const id = useId();
|
|
121
118
|
const formTheme = computed(() => {
|
|
122
|
-
return fieldHasError ? 'error' : theme;
|
|
119
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
123
120
|
});
|
|
124
121
|
|
|
125
122
|
const modelValue = defineModel<number | readonly number[]>();
|
|
@@ -62,15 +62,11 @@
|
|
|
62
62
|
import propValidators from '../c12/prop-validators';
|
|
63
63
|
import type { IFormMultipleOptions } from '@/types/types.forms';
|
|
64
64
|
|
|
65
|
-
const
|
|
65
|
+
const props = defineProps({
|
|
66
66
|
dataTestid: {
|
|
67
67
|
type: String,
|
|
68
68
|
default: 'multiple-radio-buttons',
|
|
69
69
|
},
|
|
70
|
-
id: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
74
70
|
name: {
|
|
75
71
|
type: String,
|
|
76
72
|
required: true,
|
|
@@ -147,12 +143,13 @@ const { dataTestid, id, name, legend, label, required, fieldHasError, placeholde
|
|
|
147
143
|
|
|
148
144
|
const slots = useSlots();
|
|
149
145
|
const hasDescriptionSlot = computed(() => slots.description !== undefined);
|
|
150
|
-
const { elementClasses
|
|
146
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
151
147
|
|
|
148
|
+
const id = useId();
|
|
152
149
|
const errorId = `${name}-error-message`;
|
|
153
150
|
const ariaDescribedby = computed(() => {
|
|
154
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` :
|
|
155
|
-
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
151
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
152
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
156
153
|
});
|
|
157
154
|
|
|
158
155
|
const modelValue = defineModel();
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<script setup lang="ts">
|
|
33
33
|
import propValidators from '../c12/prop-validators';
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const props = defineProps({
|
|
36
36
|
id: {
|
|
37
37
|
type: String,
|
|
38
38
|
required: true,
|
|
@@ -98,7 +98,7 @@ const hasLeftContent = computed(() => slots.left !== undefined);
|
|
|
98
98
|
const hasRightContent = computed(() => slots.right !== undefined);
|
|
99
99
|
|
|
100
100
|
const formTheme = computed(() => {
|
|
101
|
-
return fieldHasError ? 'error' : theme;
|
|
101
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
const modelValue = defineModel<number | readonly number[]>();
|
|
@@ -47,11 +47,7 @@
|
|
|
47
47
|
<script setup lang="ts">
|
|
48
48
|
import propValidators from '../../c12/prop-validators';
|
|
49
49
|
|
|
50
|
-
const {
|
|
51
|
-
id: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: true,
|
|
54
|
-
},
|
|
50
|
+
const { name, label, required, min, max, step, theme, size, weight, styleClassPassthrough, errorMessage, fieldHasError } = defineProps({
|
|
55
51
|
name: {
|
|
56
52
|
type: String,
|
|
57
53
|
required: true,
|
|
@@ -126,6 +122,7 @@ const hasLeftContent = computed(() => slots.left !== undefined);
|
|
|
126
122
|
const hasRightContent = computed(() => slots.right !== undefined);
|
|
127
123
|
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
128
124
|
|
|
125
|
+
const id = useId();
|
|
129
126
|
const formTheme = computed(() => {
|
|
130
127
|
return fieldHasError ? 'error' : theme;
|
|
131
128
|
});
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
24
|
import propValidators from '../c12/prop-validators';
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const props = defineProps({
|
|
27
27
|
id: {
|
|
28
28
|
type: String,
|
|
29
29
|
required: true,
|
|
@@ -115,10 +115,10 @@ const toolTipHighContainerStart = computed(() => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
const lowValue = computed(() => {
|
|
118
|
-
return Math.floor(Number(max) - Number(highValue.value));
|
|
118
|
+
return Math.floor(Number(props.max) - Number(highValue.value));
|
|
119
119
|
});
|
|
120
120
|
const highValue = computed(() => {
|
|
121
|
-
return Math.floor((Number(modelValue.value) / max) * 100);
|
|
121
|
+
return Math.floor((Number(modelValue.value) / props.max) * 100);
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
const update = () => {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<script setup lang="ts">
|
|
14
14
|
import propValidators from '../c12/prop-validators';
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const props = defineProps({
|
|
17
17
|
id: {
|
|
18
18
|
type: String,
|
|
19
19
|
required: true,
|
|
@@ -95,10 +95,10 @@ const { id, name, label, rangeLowLabel, rangeHighLabel, required, min, max, step
|
|
|
95
95
|
|
|
96
96
|
const slots = useSlots();
|
|
97
97
|
const hasDescription = computed(() => slots.description !== undefined);
|
|
98
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
98
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
99
99
|
|
|
100
100
|
const formTheme = computed(() => {
|
|
101
|
-
return fieldHasError ? 'error' : theme;
|
|
101
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
const modelValue = defineModel<number | readonly number[]>();
|
|
@@ -36,11 +36,10 @@
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
import propValidators from '../c12/prop-validators';
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
const { type, inputmode, maxlength, id, name, placeholder, required, fieldHasError, styleClassPassthrough, theme, ariaDescribedby, size } = defineProps({
|
|
39
|
+
const props = defineProps({
|
|
41
40
|
type: {
|
|
42
|
-
|
|
43
|
-
type: String,
|
|
41
|
+
type: String as PropType<'text' | 'email' | 'password' | 'number' | 'tel' | 'url'>,
|
|
42
|
+
// type: String,
|
|
44
43
|
default: 'text',
|
|
45
44
|
validator(value: string) {
|
|
46
45
|
return propValidators.inputTypesText.includes(value);
|
|
@@ -106,7 +105,7 @@ const hasLeftSlot = computed(() => slots.left !== undefined);
|
|
|
106
105
|
const hasRightSlot = computed(() => slots.right !== undefined);
|
|
107
106
|
|
|
108
107
|
const formTheme = computed(() => {
|
|
109
|
-
return fieldHasError ? 'error' : theme;
|
|
108
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
110
109
|
});
|
|
111
110
|
|
|
112
111
|
const modelValue = defineModel();
|
|
@@ -114,7 +113,7 @@ const isDirty = defineModel('isDirty');
|
|
|
114
113
|
const isActive = defineModel('isActive');
|
|
115
114
|
|
|
116
115
|
const inputPattern = computed(() => {
|
|
117
|
-
return inputmode === 'numeric' ? '[0-9]+' : undefined;
|
|
116
|
+
return props.inputmode === 'numeric' ? '[0-9]+' : undefined;
|
|
118
117
|
});
|
|
119
118
|
|
|
120
119
|
const updateFocus = (isFocused: boolean) => {
|
|
@@ -123,7 +122,7 @@ const updateFocus = (isFocused: boolean) => {
|
|
|
123
122
|
|
|
124
123
|
const inputField = ref<HTMLInputElement | null>(null);
|
|
125
124
|
|
|
126
|
-
const { elementClasses
|
|
125
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
127
126
|
|
|
128
127
|
// TODO: Move this to a utility function to allow removeEventListener on unmounted
|
|
129
128
|
// Leaving like this could lead to memory leaks
|
|
@@ -145,7 +144,7 @@ const validateInput = () => {
|
|
|
145
144
|
};
|
|
146
145
|
|
|
147
146
|
onMounted(() => {
|
|
148
|
-
if (inputmode === 'numeric') validateInput();
|
|
147
|
+
if (props.inputmode === 'numeric') validateInput();
|
|
149
148
|
});
|
|
150
149
|
</script>
|
|
151
150
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<InputTextWithLabel v-model="modelValue" :data-form-theme="formTheme" :type="inputType" :maxlength :
|
|
2
|
+
<InputTextWithLabel v-model="modelValue" :data-form-theme="formTheme" :type="inputType" :maxlength :name :placeholder :label :errorMessage :fieldHasError :required :styleClassPassthrough :theme>
|
|
3
3
|
<template #right>
|
|
4
4
|
<InputButtonCore
|
|
5
5
|
type="button"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
24
|
import propValidators from '../../c12/prop-validators';
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const props = defineProps({
|
|
27
27
|
type: {
|
|
28
28
|
type: String,
|
|
29
29
|
default: 'password',
|
|
@@ -32,10 +32,6 @@ const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasErr
|
|
|
32
32
|
type: Number,
|
|
33
33
|
default: 255,
|
|
34
34
|
},
|
|
35
|
-
id: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: true,
|
|
38
|
-
},
|
|
39
35
|
name: {
|
|
40
36
|
type: String,
|
|
41
37
|
required: true,
|
|
@@ -81,19 +77,19 @@ const { type, maxlength, id, name, placeholder, label, errorMessage, fieldHasErr
|
|
|
81
77
|
});
|
|
82
78
|
|
|
83
79
|
const formTheme = computed(() => {
|
|
84
|
-
return fieldHasError ? 'error' : theme;
|
|
80
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
85
81
|
});
|
|
86
82
|
|
|
87
83
|
const modelValue = defineModel();
|
|
88
84
|
|
|
89
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
85
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
90
86
|
|
|
91
87
|
const updateFocus = (name: string, isFocused: boolean) => {
|
|
92
88
|
// console.log('updateFocus', name, isFocused);
|
|
93
89
|
// modelValue.value.focusedField = isFocused ? name : '';
|
|
94
90
|
};
|
|
95
91
|
|
|
96
|
-
const inputType = ref(type);
|
|
92
|
+
const inputType = ref(props.type);
|
|
97
93
|
|
|
98
94
|
const displayPassword = ref(false);
|
|
99
95
|
const buttonText = computed(() => {
|
|
@@ -106,31 +102,3 @@ const toggleDisplayPassword = () => {
|
|
|
106
102
|
|
|
107
103
|
updateElementClasses(['has-right-button']);
|
|
108
104
|
</script>
|
|
109
|
-
|
|
110
|
-
<style lang="css">
|
|
111
|
-
/* .input-text-with-label {
|
|
112
|
-
&.has-left-button,
|
|
113
|
-
&.has-right-button {
|
|
114
|
-
.input-text-wrapper {
|
|
115
|
-
.slot {
|
|
116
|
-
.input-button-core {
|
|
117
|
-
border: initial;
|
|
118
|
-
border-radius: 0;
|
|
119
|
-
outline: initial;
|
|
120
|
-
box-shadow: unset;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.left-slot {
|
|
125
|
-
margin-inline-end: 0;
|
|
126
|
-
border-right: 2px solid var(--theme-btn-bg-hover);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.right-slot {
|
|
130
|
-
margin-inline-end: 0;
|
|
131
|
-
border-left: 2px solid var(--theme-btn-bg-hover);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
} */
|
|
136
|
-
</style>
|
|
@@ -56,21 +56,17 @@
|
|
|
56
56
|
</InputButtonCore>
|
|
57
57
|
</template>
|
|
58
58
|
</InputTextCore>
|
|
59
|
-
<InputError :errorMessage
|
|
59
|
+
<InputError :errorMessage :showError="fieldHasError" :id="errorId" :isDetached="true" />
|
|
60
60
|
</div>
|
|
61
61
|
</template>
|
|
62
62
|
|
|
63
63
|
<script setup lang="ts">
|
|
64
64
|
import propValidators from '../../c12/prop-validators';
|
|
65
|
-
const
|
|
65
|
+
const props = defineProps({
|
|
66
66
|
maxlength: {
|
|
67
67
|
type: Number,
|
|
68
68
|
default: 255,
|
|
69
69
|
},
|
|
70
|
-
id: {
|
|
71
|
-
type: String,
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
74
70
|
name: {
|
|
75
71
|
type: String,
|
|
76
72
|
required: true,
|
|
@@ -133,21 +129,22 @@ const hasLeftSlot = computed(() => slots.left !== undefined);
|
|
|
133
129
|
const hasRightSlot = computed(() => slots.right !== undefined);
|
|
134
130
|
|
|
135
131
|
const formTheme = computed(() => {
|
|
136
|
-
return fieldHasError ? 'error' : theme;
|
|
132
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
137
133
|
});
|
|
138
134
|
|
|
135
|
+
const id = useId();
|
|
139
136
|
const errorId = `${id}-error-message`;
|
|
140
137
|
const ariaDescribedby = computed(() => {
|
|
141
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` :
|
|
142
|
-
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
138
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
139
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
143
140
|
});
|
|
144
141
|
|
|
145
142
|
const modelValue = defineModel();
|
|
146
143
|
const isActive = ref<boolean>(false);
|
|
147
144
|
const isDirty = ref<boolean>(false);
|
|
148
145
|
|
|
149
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
150
|
-
const minLength = computed(() => `${max.toString().length +
|
|
146
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
147
|
+
const minLength = computed(() => `${props.max.toString().length + 1}em`);
|
|
151
148
|
|
|
152
149
|
const updateValue = (step: number, withinRangeLimit: boolean) => {
|
|
153
150
|
if (withinRangeLimit) {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
<script setup lang="ts">
|
|
40
40
|
import propValidators from '../../c12/prop-validators';
|
|
41
|
-
const
|
|
41
|
+
const props = defineProps({
|
|
42
42
|
maxlength: {
|
|
43
43
|
type: Number,
|
|
44
44
|
default: 255,
|
|
@@ -54,10 +54,6 @@ const { type, inputmode, maxlength, id, name, placeholder, label, errorMessage,
|
|
|
54
54
|
return propValidators.inputMode.includes(value);
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
|
-
id: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: true,
|
|
60
|
-
},
|
|
61
57
|
name: {
|
|
62
58
|
type: String,
|
|
63
59
|
required: true,
|
|
@@ -108,20 +104,21 @@ const hasLeftSlot = computed(() => slots.left !== undefined);
|
|
|
108
104
|
const hasRightSlot = computed(() => slots.right !== undefined);
|
|
109
105
|
|
|
110
106
|
const formTheme = computed(() => {
|
|
111
|
-
return fieldHasError ? 'error' : theme;
|
|
107
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
112
108
|
});
|
|
113
109
|
|
|
110
|
+
const id = useId();
|
|
114
111
|
const errorId = `${id}-error-message`;
|
|
115
112
|
const ariaDescribedby = computed(() => {
|
|
116
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` :
|
|
117
|
-
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
113
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
114
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
118
115
|
});
|
|
119
116
|
|
|
120
117
|
const modelValue = defineModel();
|
|
121
118
|
const isActive = ref<boolean>(false);
|
|
122
119
|
const isDirty = ref<boolean>(false);
|
|
123
120
|
|
|
124
|
-
const { elementClasses
|
|
121
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
125
122
|
|
|
126
123
|
const testDirty = () => {
|
|
127
124
|
const watchValue = modelValue.value ?? '';
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
34
|
import propValidators from '../c12/prop-validators';
|
|
35
|
-
const
|
|
35
|
+
const props = defineProps({
|
|
36
36
|
maxlength: {
|
|
37
37
|
type: Number,
|
|
38
38
|
default: 255,
|
|
@@ -82,7 +82,7 @@ const hasLeftSlot = computed(() => slots.left !== undefined);
|
|
|
82
82
|
const hasRightSlot = computed(() => slots.right !== undefined);
|
|
83
83
|
|
|
84
84
|
const formTheme = computed(() => {
|
|
85
|
-
return fieldHasError ? 'error' : theme;
|
|
85
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
const modelValue = defineModel<string | number | readonly string[] | null | undefined>();
|
|
@@ -95,11 +95,7 @@ const updateFocus = (isFocused: boolean) => {
|
|
|
95
95
|
|
|
96
96
|
const inputField = ref<HTMLInputElement | null>(null);
|
|
97
97
|
|
|
98
|
-
const { elementClasses
|
|
99
|
-
|
|
100
|
-
onMounted(() => {
|
|
101
|
-
updateElementClasses(['deep-bristol', 'deep-london', 'deep-bath']);
|
|
102
|
-
});
|
|
98
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
103
99
|
</script>
|
|
104
100
|
|
|
105
101
|
<style lang="css">
|
|
@@ -16,15 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
<script setup lang="ts">
|
|
18
18
|
import propValidators from '../../c12/prop-validators';
|
|
19
|
-
const
|
|
19
|
+
const props = defineProps({
|
|
20
20
|
maxlength: {
|
|
21
21
|
type: Number,
|
|
22
22
|
default: 255,
|
|
23
23
|
},
|
|
24
|
-
id: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
24
|
name: {
|
|
29
25
|
type: String,
|
|
30
26
|
required: true,
|
|
@@ -73,15 +69,16 @@ const slots = useSlots();
|
|
|
73
69
|
const hasLeftSlot = computed(() => slots.left !== undefined);
|
|
74
70
|
const hasRightSlot = computed(() => slots.right !== undefined);
|
|
75
71
|
|
|
72
|
+
const id = useId();
|
|
76
73
|
const formTheme = computed(() => {
|
|
77
|
-
return fieldHasError ? 'error' : theme;
|
|
74
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
78
75
|
});
|
|
79
76
|
|
|
80
77
|
const modelValue = defineModel<string | number | readonly string[] | null | undefined>();
|
|
81
78
|
const isActive = ref<boolean>(false);
|
|
82
79
|
const isDirty = ref<boolean>(false);
|
|
83
80
|
|
|
84
|
-
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
81
|
+
const { elementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
85
82
|
|
|
86
83
|
const testDirty = () => {
|
|
87
84
|
const watchValue = modelValue.value ?? '';
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import propValidators from '../c12/prop-validators';
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const props = defineProps({
|
|
24
24
|
id: {
|
|
25
25
|
type: String,
|
|
26
26
|
required: true,
|
|
@@ -78,16 +78,16 @@ const hasIconOnSlot = computed(() => slots.iconOn !== undefined);
|
|
|
78
78
|
const hasIconOffSlot = computed(() => slots.iconOff !== undefined);
|
|
79
79
|
|
|
80
80
|
const formTheme = computed(() => {
|
|
81
|
-
return fieldHasError ? 'error' : theme;
|
|
81
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
const modelValue = defineModel();
|
|
85
|
-
const { elementClasses
|
|
85
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
86
86
|
|
|
87
|
-
const inputId = computed(() => `toggle-sitch-${id}`);
|
|
87
|
+
const inputId = computed(() => `toggle-sitch-${props.id}`);
|
|
88
88
|
|
|
89
89
|
const toggleSwitchValue = () => {
|
|
90
|
-
modelValue.value = modelValue.value === trueValue ? falseValue : trueValue;
|
|
90
|
+
modelValue.value = modelValue.value === props.trueValue ? props.falseValue : props.trueValue;
|
|
91
91
|
};
|
|
92
92
|
</script>
|
|
93
93
|
|
|
@@ -13,18 +13,14 @@
|
|
|
13
13
|
<slot name="iconOff"></slot>
|
|
14
14
|
</template>
|
|
15
15
|
</ToggleSwitchCore>
|
|
16
|
-
<InputError :errorMessage
|
|
16
|
+
<InputError :errorMessage :showError="fieldHasError" :id="errorId" :isDetached="true" />
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
21
|
import propValidators from '../../c12/prop-validators';
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
id: {
|
|
25
|
-
type: String,
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
23
|
+
const props = defineProps({
|
|
28
24
|
name: {
|
|
29
25
|
type: String,
|
|
30
26
|
required: true,
|
|
@@ -84,17 +80,18 @@ const hasIconOnSlot = computed(() => slots.iconOn !== undefined);
|
|
|
84
80
|
const hasIconOffSlot = computed(() => slots.iconOff !== undefined);
|
|
85
81
|
|
|
86
82
|
const formTheme = computed(() => {
|
|
87
|
-
return fieldHasError ? 'error' : theme;
|
|
83
|
+
return props.fieldHasError ? 'error' : props.theme;
|
|
88
84
|
});
|
|
89
85
|
|
|
86
|
+
const id = useId();
|
|
90
87
|
const errorId = `${id}-error-message`;
|
|
91
88
|
const ariaDescribedby = computed(() => {
|
|
92
|
-
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` :
|
|
93
|
-
return fieldHasError ? errorId : ariaDescribedbyId;
|
|
89
|
+
const ariaDescribedbyId = hasDescriptionSlot.value ? `${id}-description` : undefined;
|
|
90
|
+
return props.fieldHasError ? errorId : ariaDescribedbyId;
|
|
94
91
|
});
|
|
95
92
|
|
|
96
93
|
const modelValue = defineModel();
|
|
97
|
-
const { elementClasses
|
|
94
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
98
95
|
</script>
|
|
99
96
|
|
|
100
97
|
<style lang="css">
|
|
@@ -16,11 +16,7 @@
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import propValidators from '../../c12/prop-validators';
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
id: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
19
|
+
const props = defineProps({
|
|
24
20
|
name: {
|
|
25
21
|
type: String,
|
|
26
22
|
required: true,
|
|
@@ -72,8 +68,10 @@ const slots = useSlots();
|
|
|
72
68
|
const hasIconOnSlot = computed(() => slots.iconOn !== undefined);
|
|
73
69
|
const hasIconOffSlot = computed(() => slots.iconOff !== undefined);
|
|
74
70
|
|
|
71
|
+
const id = useId();
|
|
72
|
+
|
|
75
73
|
const labelWeightClass = computed(() => {
|
|
76
|
-
switch (labelWeight) {
|
|
74
|
+
switch (props.labelWeight) {
|
|
77
75
|
case 'bold':
|
|
78
76
|
return 'body-normal-bold';
|
|
79
77
|
case 'semi-bold':
|
|
@@ -86,7 +84,7 @@ const labelWeightClass = computed(() => {
|
|
|
86
84
|
});
|
|
87
85
|
|
|
88
86
|
const modelValue = defineModel();
|
|
89
|
-
const { elementClasses } = useStyleClassPassthrough(styleClassPassthrough);
|
|
87
|
+
const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
|
|
90
88
|
</script>
|
|
91
89
|
|
|
92
90
|
<style lang="css">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ToggleSwitchWithLabelInline v-model="displayMode" :
|
|
2
|
+
<ToggleSwitchWithLabelInline v-model="displayMode" :name :label labelWeight="normal" :size trueValue="dark" falseValue="light" :style-class-passthrough>
|
|
3
3
|
<template #iconOn>
|
|
4
4
|
<Icon name="radix-icons:moon" class="icon" />
|
|
5
5
|
</template>
|
|
@@ -12,11 +12,7 @@
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
13
|
import propValidators from '../../forms/c12/prop-validators';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
id: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
15
|
+
defineProps({
|
|
20
16
|
name: {
|
|
21
17
|
type: String,
|
|
22
18
|
required: true,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "srcdev-nuxt-forms",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"main": "nuxt.config.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@nuxt/eslint-config": "0.7.5",
|
|
28
28
|
"@nuxt/icon": "1.10.3",
|
|
29
|
-
"@nuxt/test-utils": "3.15.
|
|
29
|
+
"@nuxt/test-utils": "3.15.4",
|
|
30
30
|
"@vue/test-utils": "2.4.6",
|
|
31
31
|
"eslint": "9.18.0",
|
|
32
|
-
"happy-dom": "
|
|
32
|
+
"happy-dom": "16.6.0",
|
|
33
33
|
"nuxt": "3.15.0",
|
|
34
34
|
"release-it": "18.1.1",
|
|
35
35
|
"typescript": "5.7.3",
|
|
36
|
-
"vitest": "
|
|
36
|
+
"vitest": "3.0.2",
|
|
37
37
|
"vue": "3.5.13"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|