srcdev-nuxt-forms 0.0.22 → 0.1.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/.prettierrc +2 -1
- package/assets/styles/forms/themes/_error.css +12 -0
- package/assets/styles/forms/themes/_ghost.css +11 -0
- package/assets/styles/forms/themes/_primary.css +9 -1
- package/assets/styles/forms/themes/_secondary.css +11 -0
- package/assets/styles/forms/themes/_success.css +12 -0
- package/assets/styles/forms/themes/_tertiary.css +11 -0
- package/assets/styles/forms/themes/_warning.css +11 -0
- package/assets/styles/forms/themes/index.css +6 -0
- package/assets/styles/forms/variables/_theme.css +64 -1
- package/assets/styles/variables/colors/_orange.css +1 -1
- package/assets/styles/variables/colors/_red.css +1 -1
- package/components/forms/c12/prop-validators/index.ts +25 -0
- package/components/forms/c12/validation-patterns/en.json +1 -1
- package/components/forms/input-button/InputButtonCore.vue +367 -0
- package/components/forms/input-button/variants/InputButtonConfirm.vue +78 -0
- package/components/forms/input-button/variants/InputButtonSubmit.vue +74 -0
- package/components/forms/input-text/InputTextCore.vue +77 -59
- package/components/forms/input-text/variants/material/InputEmailMaterial.vue +72 -0
- package/components/forms/input-text/variants/material/InputPasswordMaterial.vue +88 -0
- package/components/forms/input-text/variants/material/InputTextMaterial.vue +75 -0
- package/components/forms/input-text/variants/material/InputTextMaterialCore.vue +258 -0
- package/components/forms/ui/FormField.vue +7 -2
- package/components/forms/ui/FormWrapper.vue +2 -2
- package/composables/useErrorMessages.ts +4 -4
- package/composables/useFormControl.ts +36 -16
- package/composables/useUpdateStyleClassPassthrough.ts +29 -0
- package/layouts/default.vue +33 -2
- package/nuxt.config.ts +4 -3
- package/package.json +3 -1
- package/pages/forms/examples/buttons/index.vue +154 -0
- package/pages/forms/examples/material/text-fields-compact.vue +136 -0
- package/pages/forms/examples/material/text-fields.vue +136 -0
- package/pages/index.vue +2 -70
- package/types/types.forms.ts +6 -11
- package/components/forms/input-text/InputTextField.vue +0 -22
- package/components/forms/input-text/variants/InputTextMaterial.vue +0 -159
package/.prettierrc
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-error: var(--red-7);
|
|
3
|
+
--theme-form-error: var(--red-8);
|
|
4
|
+
--theme-form-error-border: var(--red-2);
|
|
5
|
+
--theme-form-error-border-hover: var(--red-0);
|
|
6
|
+
--theme-form-error-outline: var(--red-9);
|
|
7
|
+
--theme-form-error-outline-hover: var(--red-9);
|
|
8
|
+
--theme-form-error-bg: var(--red-9);
|
|
9
|
+
--theme-form-error-bg-hover: var(--red-2);
|
|
10
|
+
--theme-form-error-color: var(--red-1);
|
|
11
|
+
--theme-form-error-color-hover: var(--red-9);
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-form-ghost: var(--gray-8);
|
|
3
|
+
--theme-form-ghost-border: transparent;
|
|
4
|
+
--theme-form-ghost-border-hover: var(--gray-0);
|
|
5
|
+
--theme-form-ghost-outline: transparent;
|
|
6
|
+
--theme-form-ghost-outline-hover: var(--gray-11);
|
|
7
|
+
--theme-form-ghost-bg: transparent;
|
|
8
|
+
--theme-form-ghost-bg-hover: var(--gray-2);
|
|
9
|
+
--theme-form-ghost-color: var(--gray-11);
|
|
10
|
+
--theme-form-ghost-color-hover: var(--gray-11);
|
|
11
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
:where(html) {
|
|
2
|
-
--
|
|
2
|
+
--theme-form-primary: var(--blue-8);
|
|
3
|
+
--theme-form-primary-border: var(--blue-2);
|
|
4
|
+
--theme-form-primary-border-hover: var(--blue-0);
|
|
5
|
+
--theme-form-primary-outline: var(--blue-11);
|
|
6
|
+
--theme-form-primary-outline-hover: var(--blue-11);
|
|
7
|
+
--theme-form-primary-bg: var(--blue-6);
|
|
8
|
+
--theme-form-primary-bg-hover: var(--blue-2);
|
|
9
|
+
--theme-form-primary-color: var(--blue-1);
|
|
10
|
+
--theme-form-primary-color-hover: var(--blue-11);
|
|
3
11
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-form-secondary: var(--gray-8);
|
|
3
|
+
--theme-form-secondary-border: var(--gray-2);
|
|
4
|
+
--theme-form-secondary-border-hover: var(--gray-0);
|
|
5
|
+
--theme-form-secondary-outline: var(--gray-8);
|
|
6
|
+
--theme-form-secondary-outline-hover: var(--gray-8);
|
|
7
|
+
--theme-form-secondary-bg: var(--gray-11);
|
|
8
|
+
--theme-form-secondary-bg-hover: var(--gray-2);
|
|
9
|
+
--theme-form-secondary-color: var(--gray-1);
|
|
10
|
+
--theme-form-secondary-color-hover: var(--gray-11);
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-success: var(--green-7);
|
|
3
|
+
--theme-form-success: var(--green-8);
|
|
4
|
+
--theme-form-success-border: var(--green-2);
|
|
5
|
+
--theme-form-success-border-hover: var(--green-0);
|
|
6
|
+
--theme-form-success-outline: var(--green-9);
|
|
7
|
+
--theme-form-success-outline-hover: var(--green-9);
|
|
8
|
+
--theme-form-success-bg: var(--green-9);
|
|
9
|
+
--theme-form-success-bg-hover: var(--green-2);
|
|
10
|
+
--theme-form-success-color: var(--green-1);
|
|
11
|
+
--theme-form-success-color-hover: var(--green-9);
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-form-tertiary: var(--gray-8);
|
|
3
|
+
--theme-form-tertiary-border: var(--gray-2);
|
|
4
|
+
--theme-form-tertiary-border-hover: var(--gray-2);
|
|
5
|
+
--theme-form-tertiary-outline: var(--gray-8);
|
|
6
|
+
--theme-form-tertiary-outline-hover: var(--gray-8);
|
|
7
|
+
--theme-form-tertiary-bg: var(--gray-1);
|
|
8
|
+
--theme-form-tertiary-bg-hover: var(--gray-11);
|
|
9
|
+
--theme-form-tertiary-color: var(--gray-9);
|
|
10
|
+
--theme-form-tertiary-color-hover: var(--gray-2);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:where(html) {
|
|
2
|
+
--theme-form-warning: var(--orange-8);
|
|
3
|
+
--theme-form-warning-border: var(--orange-2);
|
|
4
|
+
--theme-form-warning-border-hover: var(--orange-0);
|
|
5
|
+
--theme-form-warning-outline: var(--orange-11);
|
|
6
|
+
--theme-form-warning-outline-hover: var(--orange-11);
|
|
7
|
+
--theme-form-warning-bg: var(--orange-6);
|
|
8
|
+
--theme-form-warning-bg-hover: var(--orange-2);
|
|
9
|
+
--theme-form-warning-color: var(--orange-1);
|
|
10
|
+
--theme-form-warning-color-hover: var(--orange-11);
|
|
11
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
:
|
|
1
|
+
:where(html) {
|
|
2
|
+
--font-size: 16px;
|
|
3
|
+
--line-height: calc((var(--font-size) * 2) - 10px);
|
|
4
|
+
|
|
2
5
|
--input-border-radius: 4px;
|
|
3
6
|
--input-border-width-thin: 1px;
|
|
4
7
|
--input-border-width-default: 2px;
|
|
@@ -6,4 +9,64 @@
|
|
|
6
9
|
|
|
7
10
|
--font-family: futura-pt, Seravek, 'Gill Sans Nova', Ubuntu, Calibri,
|
|
8
11
|
'DejaVu Sans', source-sans-pro, sans-serif;
|
|
12
|
+
|
|
13
|
+
--theme-form-button-font-size-x-small: 14px;
|
|
14
|
+
--theme-form-button-font-size-small: 14px;
|
|
15
|
+
--theme-form-button-font-size-normal: 16px;
|
|
16
|
+
--theme-form-button-font-size-medium: 18px;
|
|
17
|
+
--theme-form-button-font-size-large: 20px;
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Button Padding
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
--theme-form-button-padding-block-x-small: 6px;
|
|
24
|
+
--theme-form-button-padding-block-small: 8px;
|
|
25
|
+
--theme-form-button-padding-block-normal: 10px;
|
|
26
|
+
--theme-form-button-padding-block-medium: 12px;
|
|
27
|
+
--theme-form-button-padding-block-large: 12px;
|
|
28
|
+
|
|
29
|
+
--theme-form-button-padding-inline-x-small: 12px;
|
|
30
|
+
--theme-form-button-padding-inline-small: 16px;
|
|
31
|
+
--theme-form-button-padding-inline-normal: 20px;
|
|
32
|
+
--theme-form-button-padding-inline-medium: 22px;
|
|
33
|
+
--theme-form-button-padding-inline-large: 24px;
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Button Icon Sizes and Gap
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
--theme-form-button-padding-inline-icon-only-x-small: 4px;
|
|
40
|
+
--theme-form-button-padding-inline-icon-only-small: 6px;
|
|
41
|
+
--theme-form-button-padding-inline-icon-only-normal: 8px;
|
|
42
|
+
--theme-form-button-padding-inline-icon-only-medium: 10px;
|
|
43
|
+
--theme-form-button-padding-inline-icon-only-large: 12px;
|
|
44
|
+
|
|
45
|
+
--theme-form-button-padding-block-icon-only-x-small: 4px;
|
|
46
|
+
--theme-form-button-padding-block-icon-only-small: 4px;
|
|
47
|
+
--theme-form-button-padding-block-icon-only-normal: 6px;
|
|
48
|
+
--theme-form-button-padding-block-icon-only-medium: 8px;
|
|
49
|
+
--theme-form-button-padding-block-icon-only-large: 10px;
|
|
50
|
+
|
|
51
|
+
--theme-form-button-icon-size-x-small: 18px;
|
|
52
|
+
--theme-form-button-icon-size-small: 18px;
|
|
53
|
+
--theme-form-button-icon-size-normal: 18px;
|
|
54
|
+
--theme-form-button-icon-size-medium: 20px;
|
|
55
|
+
--theme-form-button-icon-size-large: 22px;
|
|
56
|
+
|
|
57
|
+
--theme-form-button-icon-gap-x-small: var(
|
|
58
|
+
--theme-form-button-padding-inline-x-small
|
|
59
|
+
);
|
|
60
|
+
--theme-form-button-icon-gap-small: var(
|
|
61
|
+
--theme-form-button-padding-inline-small
|
|
62
|
+
);
|
|
63
|
+
--theme-form-button-icon-gap-normal: var(
|
|
64
|
+
--theme-form-button-padding-inline-normal
|
|
65
|
+
);
|
|
66
|
+
--theme-form-button-icon-gap-medium: var(
|
|
67
|
+
--theme-form-button-padding-inline-medium
|
|
68
|
+
);
|
|
69
|
+
--theme-form-button-icon-gap-large: var(
|
|
70
|
+
--theme-form-button-padding-inline-large
|
|
71
|
+
);
|
|
9
72
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const propValidators = {
|
|
2
|
+
size: ['x-small', 'small', 'normal', 'medium', 'large'],
|
|
3
|
+
weight: [
|
|
4
|
+
'wght-100',
|
|
5
|
+
'wght-200',
|
|
6
|
+
'wght-300',
|
|
7
|
+
'wght-400',
|
|
8
|
+
'wght-500',
|
|
9
|
+
'wght-600',
|
|
10
|
+
'wght-700',
|
|
11
|
+
'wght-800',
|
|
12
|
+
'wght-900',
|
|
13
|
+
],
|
|
14
|
+
theme: [
|
|
15
|
+
'primary',
|
|
16
|
+
'secondary',
|
|
17
|
+
'tertiary',
|
|
18
|
+
'ghost',
|
|
19
|
+
'error',
|
|
20
|
+
'success',
|
|
21
|
+
'warning',
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default propValidators;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"hint": "password"
|
|
25
25
|
},
|
|
26
26
|
"emailaddress": {
|
|
27
|
-
"pattern": "^(?!@)((?!([\\.]))([\\w\\.\\-\\+']{1,}))?((@)([\\w\\-]{
|
|
27
|
+
"pattern": "^(?!@)((?!([\\.]))([\\w\\.\\-\\+']{1,}))?((@)([\\w\\-]{1,})+((\\.)([\\w]{2,}))+)$",
|
|
28
28
|
"minlength": 7,
|
|
29
29
|
"maxlength": 255,
|
|
30
30
|
"hint": "you@your-email.com"
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
:type="type"
|
|
4
|
+
:readonly
|
|
5
|
+
:aria-disabled="readonly"
|
|
6
|
+
:data-test-id="dataTestId"
|
|
7
|
+
class="btn"
|
|
8
|
+
:class="[`btn-${type}`, `theme-${theme}`, size, effectClass, styleClassPassthrough, { 'icon-only': isIconOnly }]"
|
|
9
|
+
>
|
|
10
|
+
<span v-if="useEffect && effect == 'fancy'" class="fancy"></span>
|
|
11
|
+
<template v-if="hasLeftContent && !isIconOnly">
|
|
12
|
+
<span class="btn-icon left" :class="[size]">
|
|
13
|
+
<slot name="left"></slot>
|
|
14
|
+
</span>
|
|
15
|
+
</template>
|
|
16
|
+
<span class="btn-text" :class="[size, weight, { 'sr-only': isIconOnly }]">{{ buttonText }}</span>
|
|
17
|
+
<template v-if="hasRightContent && !isIconOnly">
|
|
18
|
+
<span class="btn-icon right">
|
|
19
|
+
<slot name="right"></slot>
|
|
20
|
+
</span>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-if="isIconOnly">
|
|
23
|
+
<span class="btn-icon icon-only" :class="[size]">
|
|
24
|
+
<slot name="iconOnly"></slot>
|
|
25
|
+
</span>
|
|
26
|
+
</template>
|
|
27
|
+
</button>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import propValidators from '../c12/prop-validators';
|
|
32
|
+
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
size: {
|
|
35
|
+
type: String as PropType<string>,
|
|
36
|
+
default: 'normal',
|
|
37
|
+
validator(value: string) {
|
|
38
|
+
return propValidators.size.includes(value);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
weight: {
|
|
42
|
+
type: String as PropType<string>,
|
|
43
|
+
default: 'wght-400',
|
|
44
|
+
validator(value: string) {
|
|
45
|
+
return propValidators.weight.includes(value);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
theme: {
|
|
49
|
+
type: String as PropType<string>,
|
|
50
|
+
default: 'primary',
|
|
51
|
+
validator(value: string) {
|
|
52
|
+
return propValidators.theme.includes(value);
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
type: {
|
|
56
|
+
type: String as PropType<'submit' | 'button' | 'reset'>,
|
|
57
|
+
default: 'submit',
|
|
58
|
+
validator(value: string) {
|
|
59
|
+
return ['button', 'cancel', 'reset', 'submit'].includes(value);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
buttonText: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
dataTestId: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '',
|
|
69
|
+
},
|
|
70
|
+
styleClassPassthrough: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
},
|
|
74
|
+
useEffect: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false,
|
|
77
|
+
},
|
|
78
|
+
effect: {
|
|
79
|
+
type: String as PropType<string>,
|
|
80
|
+
default: 'fancy',
|
|
81
|
+
validator(value: string) {
|
|
82
|
+
return ['fancy', 'pulse'].includes(value);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
isPending: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
readonly: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const type = toRef(() => props.type);
|
|
96
|
+
const effectClass = computed(() => {
|
|
97
|
+
if (props.useEffect) {
|
|
98
|
+
return props.effect === 'fancy' ? '' : props.effect;
|
|
99
|
+
} else {
|
|
100
|
+
return '';
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const slots = useSlots();
|
|
105
|
+
const hasLeftContent = computed(() => slots.left !== undefined);
|
|
106
|
+
const hasRightContent = computed(() => slots.right !== undefined);
|
|
107
|
+
const isIconOnly = computed(() => slots.iconOnly !== undefined);
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style lang="css">
|
|
111
|
+
.btn {
|
|
112
|
+
--_padding-block: var(--theme-form-button-padding-block-normal);
|
|
113
|
+
--_padding-inline: var(--theme-form-button-padding-inline-normal);
|
|
114
|
+
--_border-radius: 4px;
|
|
115
|
+
--_icon-gap: var(--theme-form-button-icon-gap-normal);
|
|
116
|
+
|
|
117
|
+
align-items: center;
|
|
118
|
+
display: flex;
|
|
119
|
+
gap: var(--_icon-gap);
|
|
120
|
+
justify-content: center;
|
|
121
|
+
border: none;
|
|
122
|
+
border-radius: var(--_border-radius);
|
|
123
|
+
|
|
124
|
+
font-family: var(--font-family);
|
|
125
|
+
|
|
126
|
+
padding-inline: var(--_padding-inline);
|
|
127
|
+
padding-block: var(--_padding-block);
|
|
128
|
+
|
|
129
|
+
transition: all 0.2s ease-in-out;
|
|
130
|
+
|
|
131
|
+
&:hover,
|
|
132
|
+
&:focus-visible {
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&[readonly] {
|
|
137
|
+
opacity: 0.5;
|
|
138
|
+
&:hover,
|
|
139
|
+
&:focus-visible {
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&.x-small {
|
|
145
|
+
&:not(.icon-only) {
|
|
146
|
+
--_padding-block: var(--theme-form-button-padding-block-x-small);
|
|
147
|
+
--_padding-inline: var(--theme-form-button-padding-inline-x-small);
|
|
148
|
+
--_icon-gap: var(--theme-form-button-icon-gap-x-small);
|
|
149
|
+
}
|
|
150
|
+
&.icon-only {
|
|
151
|
+
--_padding-block: var(--theme-form-button-padding-block-icon-only-x-small);
|
|
152
|
+
--_padding-inline: var(--theme-form-button-padding-inline-icon-only-x-small);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&.small {
|
|
157
|
+
&:not(.icon-only) {
|
|
158
|
+
--_padding-block: var(--theme-form-button-padding-block-x-small);
|
|
159
|
+
--_padding-inline: var(--theme-form-button-padding-inline-small);
|
|
160
|
+
--_icon-gap: var(--theme-form-button-icon-gap-small);
|
|
161
|
+
}
|
|
162
|
+
&.icon-only {
|
|
163
|
+
--_padding-block: var(--theme-form-button-padding-block-icon-only-small);
|
|
164
|
+
--_padding-inline: var(--theme-form-button-padding-inline-icon-only-small);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
&.normal {
|
|
168
|
+
&:not(.icon-only) {
|
|
169
|
+
--_padding-block: var(--theme-form-button-padding-block-x-small);
|
|
170
|
+
--_padding-inline: var(--theme-form-button-padding-inline-normal);
|
|
171
|
+
--_icon-gap: var(--theme-form-button-icon-gap-normal);
|
|
172
|
+
}
|
|
173
|
+
&.icon-only {
|
|
174
|
+
--_padding-block: var(--theme-form-button-padding-block-icon-only-normal);
|
|
175
|
+
--_padding-inline: var(--theme-form-button-padding-inline-icon-only-normal);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
&.medium {
|
|
179
|
+
&:not(.icon-only) {
|
|
180
|
+
--_padding-block: var(--theme-form-button-padding-block-x-small);
|
|
181
|
+
--_padding-inline: var(--theme-form-button-padding-inline-medium);
|
|
182
|
+
--_icon-gap: var(--theme-form-button-icon-gap-medium);
|
|
183
|
+
}
|
|
184
|
+
&.icon-only {
|
|
185
|
+
--_padding-block: var(--theme-form-button-padding-block-icon-only-medium);
|
|
186
|
+
--_padding-inline: var(--theme-form-button-padding-inline-icon-only-medium);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&.large {
|
|
191
|
+
&:not(.icon-only) {
|
|
192
|
+
--_padding-block: var(--theme-form-button-padding-block-x-small);
|
|
193
|
+
--_padding-inline: var(--theme-form-button-padding-inline-large);
|
|
194
|
+
--_icon-gap: var(--theme-form-button-icon-gap-large);
|
|
195
|
+
}
|
|
196
|
+
&.icon-only {
|
|
197
|
+
--_padding-block: var(--theme-form-button-padding-block-icon-only-large);
|
|
198
|
+
--_padding-inline: var(--theme-form-button-padding-inline-icon-only-large);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.btn-text {
|
|
203
|
+
&.small {
|
|
204
|
+
font-size: var(--theme-form-button-font-size-small);
|
|
205
|
+
}
|
|
206
|
+
&.normal {
|
|
207
|
+
font-size: var(--theme-form-button-font-size-normal);
|
|
208
|
+
}
|
|
209
|
+
&.medium {
|
|
210
|
+
font-size: var(--theme-form-button-font-size-medium);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&.large {
|
|
214
|
+
font-size: var(--theme-form-button-font-size-large);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&.sr-only {
|
|
218
|
+
position: absolute;
|
|
219
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
220
|
+
clip-path: inset(50%);
|
|
221
|
+
height: 1px;
|
|
222
|
+
width: 1px;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
white-space: nowrap;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.btn-icon {
|
|
229
|
+
display: flex;
|
|
230
|
+
.icon {
|
|
231
|
+
aspect-ratio: 1;
|
|
232
|
+
display: inline-block;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
&.x-small {
|
|
236
|
+
.icon {
|
|
237
|
+
height: var(--theme-form-button-icon-size-small);
|
|
238
|
+
width: var(--theme-form-button-icon-size-small);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
&.small {
|
|
242
|
+
.icon {
|
|
243
|
+
height: var(--theme-form-button-icon-size-small);
|
|
244
|
+
width: var(--theme-form-button-icon-size-small);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
&.normal {
|
|
248
|
+
.icon {
|
|
249
|
+
height: var(--theme-form-button-icon-size-normal);
|
|
250
|
+
width: var(--theme-form-button-icon-size-normal);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
&.medium {
|
|
254
|
+
.icon {
|
|
255
|
+
height: var(--theme-form-button-icon-size-medium);
|
|
256
|
+
width: var(--theme-form-button-icon-size-medium);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&.large {
|
|
261
|
+
.icon {
|
|
262
|
+
height: var(--theme-form-button-icon-size-large);
|
|
263
|
+
width: var(--theme-form-button-icon-size-large);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
--_border-width: var(--input-border-width-default);
|
|
269
|
+
|
|
270
|
+
/*
|
|
271
|
+
* Initial theme (primary)
|
|
272
|
+
**/
|
|
273
|
+
--_theme-form-border: var(--theme-form-primary-border);
|
|
274
|
+
--_theme-form-border-hover: var(--theme-form-primary-border-hover);
|
|
275
|
+
--_theme-form-outline: var(--theme-form-primary-outline);
|
|
276
|
+
--_theme-form-outline-hover: var(--theme-form-primary-outline-hover);
|
|
277
|
+
--_theme-form-bg: var(--theme-form-primary-bg);
|
|
278
|
+
--_theme-form-bg-hover: var(--theme-form-primary-bg-hover);
|
|
279
|
+
--_theme-form-color: var(--theme-form-primary-color);
|
|
280
|
+
--_theme-form-color-hover: var(--theme-form-primary-color-hover);
|
|
281
|
+
|
|
282
|
+
background-color: var(--_theme-form-bg);
|
|
283
|
+
border: var(--_border-width) solid var(--_theme-form-border);
|
|
284
|
+
color: var(--_theme-form-color);
|
|
285
|
+
outline: 1px solid var(--_theme-form-outline);
|
|
286
|
+
|
|
287
|
+
/*
|
|
288
|
+
* Themes (alternate)
|
|
289
|
+
**/
|
|
290
|
+
&.theme-secondary {
|
|
291
|
+
--_theme-form-border: var(--theme-form-secondary-border);
|
|
292
|
+
--_theme-form-border-hover: var(--theme-form-secondary-border-hover);
|
|
293
|
+
--_theme-form-outline: var(--theme-form-secondary-outline);
|
|
294
|
+
--_theme-form-outline-hover: var(--theme-form-secondary-outline-hover);
|
|
295
|
+
--_theme-form-bg: var(--theme-form-secondary-bg);
|
|
296
|
+
--_theme-form-bg-hover: var(--theme-form-secondary-bg-hover);
|
|
297
|
+
--_theme-form-color: var(--theme-form-secondary-color);
|
|
298
|
+
--_theme-form-color-hover: var(--theme-form-secondary-color-hover);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&.theme-tertiary {
|
|
302
|
+
--_theme-form-border: var(--theme-form-tertiary-border);
|
|
303
|
+
--_theme-form-border-hover: var(--theme-form-tertiary-border-hover);
|
|
304
|
+
--_theme-form-outline: var(--theme-form-tertiary-outline);
|
|
305
|
+
--_theme-form-outline-hover: var(--theme-form-tertiary-outline-hover);
|
|
306
|
+
--_theme-form-bg: var(--theme-form-tertiary-bg);
|
|
307
|
+
--_theme-form-bg-hover: var(--theme-form-tertiary-bg-hover);
|
|
308
|
+
--_theme-form-color: var(--theme-form-tertiary-color);
|
|
309
|
+
--_theme-form-color-hover: var(--theme-form-tertiary-color-hover);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&.theme-warning {
|
|
313
|
+
--_theme-form-border: var(--theme-form-warning-border);
|
|
314
|
+
--_theme-form-border-hover: var(--theme-form-warning-border-hover);
|
|
315
|
+
--_theme-form-outline: var(--theme-form-warning-outline);
|
|
316
|
+
--_theme-form-outline-hover: var(--theme-form-warning-outline-hover);
|
|
317
|
+
--_theme-form-bg: var(--theme-form-warning-bg);
|
|
318
|
+
--_theme-form-bg-hover: var(--theme-form-warning-bg-hover);
|
|
319
|
+
--_theme-form-color: var(--theme-form-warning-color);
|
|
320
|
+
--_theme-form-color-hover: var(--theme-form-warning-color-hover);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
&.theme-error {
|
|
324
|
+
--_theme-form-border: var(--theme-form-error-border);
|
|
325
|
+
--_theme-form-border-hover: var(--theme-form-error-border-hover);
|
|
326
|
+
--_theme-form-outline: var(--theme-form-error-outline);
|
|
327
|
+
--_theme-form-outline-hover: var(--theme-form-error-outline-hover);
|
|
328
|
+
--_theme-form-bg: var(--theme-form-error-bg);
|
|
329
|
+
--_theme-form-bg-hover: var(--theme-form-error-bg-hover);
|
|
330
|
+
--_theme-form-color: var(--theme-form-error-color);
|
|
331
|
+
--_theme-form-color-hover: var(--theme-form-error-color-hover);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
&.theme-success {
|
|
335
|
+
--_theme-form-border: var(--theme-form-success-border);
|
|
336
|
+
--_theme-form-border-hover: var(--theme-form-success-border-hover);
|
|
337
|
+
--_theme-form-outline: var(--theme-form-success-outline);
|
|
338
|
+
--_theme-form-outline-hover: var(--theme-form-success-outline-hover);
|
|
339
|
+
--_theme-form-bg: var(--theme-form-success-bg);
|
|
340
|
+
--_theme-form-bg-hover: var(--theme-form-success-bg-hover);
|
|
341
|
+
--_theme-form-color: var(--theme-form-success-color);
|
|
342
|
+
--_theme-form-color-hover: var(--theme-form-success-color-hover);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&.theme-ghost {
|
|
346
|
+
--_theme-form-border: var(--theme-form-ghost-border);
|
|
347
|
+
--_theme-form-border-hover: var(--theme-form-ghost-border-hover);
|
|
348
|
+
--_theme-form-outline: var(--theme-form-ghost-outline);
|
|
349
|
+
--_theme-form-outline-hover: var(--theme-form-ghost-outline-hover);
|
|
350
|
+
--_theme-form-bg: var(--theme-form-ghost-bg);
|
|
351
|
+
--_theme-form-bg-hover: var(--theme-form-ghost-bg-hover);
|
|
352
|
+
--_theme-form-color: var(--theme-form-ghost-color);
|
|
353
|
+
--_theme-form-color-hover: var(--theme-form-ghost-color-hover);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/*
|
|
357
|
+
* States
|
|
358
|
+
**/
|
|
359
|
+
&:hover,
|
|
360
|
+
&:focus-visible {
|
|
361
|
+
--_theme-form-color: var(--_theme-form-color-hover);
|
|
362
|
+
--_theme-form-bg: var(--_theme-form-bg-hover);
|
|
363
|
+
--_theme-form-border: var(--_theme-form-border-hover);
|
|
364
|
+
--_theme-form-outline: var(--_theme-form-outline-hover);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<InputButtonCore
|
|
3
|
+
type="submit"
|
|
4
|
+
:use-effect="useEffect"
|
|
5
|
+
:isPending="isPending"
|
|
6
|
+
:readonly
|
|
7
|
+
:effect="effect"
|
|
8
|
+
:data-test-id="dataTestId"
|
|
9
|
+
:size
|
|
10
|
+
:weight
|
|
11
|
+
:button-text="buttonText"
|
|
12
|
+
:style-class-passthrough="styleClassPassthrough"
|
|
13
|
+
:theme
|
|
14
|
+
>
|
|
15
|
+
<template #left>
|
|
16
|
+
<Icon name="material-symbols:check-circle-outline" class="icon" />
|
|
17
|
+
</template>
|
|
18
|
+
</InputButtonCore>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import propValidators from '../../c12/prop-validators';
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
size: {
|
|
26
|
+
type: String as PropType<string>,
|
|
27
|
+
default: 'normal',
|
|
28
|
+
validator(value: string) {
|
|
29
|
+
return propValidators.size.includes(value);
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
weight: {
|
|
33
|
+
type: String as PropType<string>,
|
|
34
|
+
default: 'wght-400',
|
|
35
|
+
validator(value: string) {
|
|
36
|
+
return propValidators.weight.includes(value);
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
theme: {
|
|
40
|
+
type: String as PropType<string>,
|
|
41
|
+
default: 'primary',
|
|
42
|
+
validator(value: string) {
|
|
43
|
+
return propValidators.theme.includes(value);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
useEffect: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false,
|
|
49
|
+
},
|
|
50
|
+
effect: {
|
|
51
|
+
type: String as PropType<string>,
|
|
52
|
+
default: 'fancy',
|
|
53
|
+
validator(value: string) {
|
|
54
|
+
return ['fancy', 'pulse'].includes(value);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
buttonText: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
dataTestId: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
65
|
+
styleClassPassthrough: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
},
|
|
69
|
+
isPending: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
73
|
+
readonly: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
</script>
|