@bobbykim/mcl-forms 0.6.0 → 0.7.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/dist/index.d.ts +610 -0
- package/dist/mcl-forms.js +589 -0
- package/dist/mcl-forms.umd.cjs +2 -0
- package/package.json +29 -6
- package/CHANGELOG.md +0 -69
- package/index.d.ts +0 -10
- package/index.js +0 -10
- package/index.ts +0 -19
- package/lib/assets/CaretDown.vue +0 -14
- package/lib/assets/CaretDown.vue.d.ts +0 -2
- package/lib/common/InputHighlight.vue +0 -46
- package/lib/common/InputHighlight.vue.d.ts +0 -41
- package/lib/common/index.types.d.ts +0 -4
- package/lib/common/index.types.js +0 -1
- package/lib/common/index.types.ts +0 -5
- package/lib/mcl-form-group/MclFormGroup.vue +0 -48
- package/lib/mcl-form-group/MclFormGroup.vue.d.ts +0 -52
- package/lib/mcl-input-file/MclInputFile.vue +0 -151
- package/lib/mcl-input-file/MclInputFile.vue.d.ts +0 -93
- package/lib/mcl-input-radio/MclInputRadio.vue +0 -91
- package/lib/mcl-input-radio/MclInputRadio.vue.d.ts +0 -62
- package/lib/mcl-input-radio/index.types.d.ts +0 -1
- package/lib/mcl-input-radio/index.types.js +0 -1
- package/lib/mcl-input-radio/index.types.ts +0 -1
- package/lib/mcl-input-switch/MclInputSwitch.vue +0 -147
- package/lib/mcl-input-switch/MclInputSwitch.vue.d.ts +0 -59
- package/lib/mcl-input-switch/index.types.d.ts +0 -1
- package/lib/mcl-input-switch/index.types.js +0 -1
- package/lib/mcl-input-switch/index.types.ts +0 -1
- package/lib/mcl-input-text/MclInputText.vue +0 -113
- package/lib/mcl-input-text/MclInputText.vue.d.ts +0 -103
- package/lib/mcl-select/MclSelect.vue +0 -287
- package/lib/mcl-select/MclSelect.vue.d.ts +0 -108
- package/lib/mcl-select/index.types.d.ts +0 -5
- package/lib/mcl-select/index.types.js +0 -1
- package/lib/mcl-select/index.types.ts +0 -6
- package/lib/mcl-text-area/MclTextArea.vue +0 -100
- package/lib/mcl-text-area/MclTextArea.vue.d.ts +0 -88
- package/tsconfig.json +0 -5
- package/tsconfig.ts.json +0 -9
- package/tsconfig.vue.json +0 -9
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
import type { RadioSizeType } from './index.types'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
id: string
|
|
10
|
-
radioSize?: RadioSizeType
|
|
11
|
-
bgColor?: ColorPalette
|
|
12
|
-
checkedColor?: ColorPalette
|
|
13
|
-
displayShadow?: boolean
|
|
14
|
-
value?: string | number
|
|
15
|
-
checked?: boolean
|
|
16
|
-
}>(),
|
|
17
|
-
{
|
|
18
|
-
radioSize: 'md',
|
|
19
|
-
bgColor: 'success',
|
|
20
|
-
checkedColor: 'light-1',
|
|
21
|
-
displayShadow: false,
|
|
22
|
-
value: '',
|
|
23
|
-
checked: false,
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
const radioRef = ref<HTMLInputElement>()
|
|
28
|
-
const emit = defineEmits<{
|
|
29
|
-
(e: 'change', event: Event, value: string | number): void
|
|
30
|
-
}>()
|
|
31
|
-
|
|
32
|
-
const radioClick = () => {
|
|
33
|
-
radioRef.value?.click()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const getRadioSize = computed(() => {
|
|
37
|
-
const { radioSize } = props
|
|
38
|
-
if (radioSize === 'sm') {
|
|
39
|
-
return 'h-xs w-xs'
|
|
40
|
-
}
|
|
41
|
-
if (radioSize === 'lg') {
|
|
42
|
-
return 'h-md w-md'
|
|
43
|
-
}
|
|
44
|
-
return 'h-sm w-sm'
|
|
45
|
-
})
|
|
46
|
-
const checkedRadioSize = computed<string>(() => {
|
|
47
|
-
const { radioSize } = props
|
|
48
|
-
if (radioSize === 'sm') {
|
|
49
|
-
return 'peer-checked:before:h-2xs peer-checked:before:w-2xs'
|
|
50
|
-
}
|
|
51
|
-
if (radioSize === 'lg') {
|
|
52
|
-
return 'peer-checked:before:h-xs peer-checked:before:w-xs'
|
|
53
|
-
}
|
|
54
|
-
return 'peer-checked:before:h-[12px] peer-checked:before:w-[12px]'
|
|
55
|
-
})
|
|
56
|
-
const getColorClass = computed(() => {
|
|
57
|
-
const { bgColor, checkedColor, displayShadow } = props
|
|
58
|
-
const classArray: string[] = [
|
|
59
|
-
generateClass('BGCOLOR', bgColor),
|
|
60
|
-
generateClass('BEFOREBG', checkedColor),
|
|
61
|
-
]
|
|
62
|
-
if (displayShadow) {
|
|
63
|
-
classArray.push('drop-shadow-md')
|
|
64
|
-
}
|
|
65
|
-
return classArray.join(' ')
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
const handleChange = (e: Event) => {
|
|
69
|
-
const value = (e.target as HTMLInputElement).value
|
|
70
|
-
emit('change', e, value)
|
|
71
|
-
}
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
<div class="flex items-center">
|
|
76
|
-
<input
|
|
77
|
-
:id="id"
|
|
78
|
-
type="radio"
|
|
79
|
-
class="appearance-none peer"
|
|
80
|
-
ref="radioRef"
|
|
81
|
-
:value="value"
|
|
82
|
-
:checked="checked"
|
|
83
|
-
@change="handleChange"
|
|
84
|
-
/>
|
|
85
|
-
<span
|
|
86
|
-
class="rounded-full inline-block relative before:absolute before:rounded-full before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2"
|
|
87
|
-
:class="[getRadioSize, checkedRadioSize, getColorClass]"
|
|
88
|
-
@click="radioClick"
|
|
89
|
-
></span>
|
|
90
|
-
</div>
|
|
91
|
-
</template>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { RadioSizeType } from './index.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
id: string;
|
|
5
|
-
radioSize?: RadioSizeType | undefined;
|
|
6
|
-
bgColor?: ColorPalette | undefined;
|
|
7
|
-
checkedColor?: ColorPalette | undefined;
|
|
8
|
-
displayShadow?: boolean | undefined;
|
|
9
|
-
value?: string | number | undefined;
|
|
10
|
-
checked?: boolean | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
radioSize: string;
|
|
13
|
-
bgColor: string;
|
|
14
|
-
checkedColor: string;
|
|
15
|
-
displayShadow: boolean;
|
|
16
|
-
value: string;
|
|
17
|
-
checked: boolean;
|
|
18
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
-
change: (event: Event, value: string | number) => void;
|
|
20
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
21
|
-
id: string;
|
|
22
|
-
radioSize?: RadioSizeType | undefined;
|
|
23
|
-
bgColor?: ColorPalette | undefined;
|
|
24
|
-
checkedColor?: ColorPalette | undefined;
|
|
25
|
-
displayShadow?: boolean | undefined;
|
|
26
|
-
value?: string | number | undefined;
|
|
27
|
-
checked?: boolean | undefined;
|
|
28
|
-
}>, {
|
|
29
|
-
radioSize: string;
|
|
30
|
-
bgColor: string;
|
|
31
|
-
checkedColor: string;
|
|
32
|
-
displayShadow: boolean;
|
|
33
|
-
value: string;
|
|
34
|
-
checked: boolean;
|
|
35
|
-
}>>> & {
|
|
36
|
-
onChange?: ((event: Event, value: string | number) => any) | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
checked: boolean;
|
|
39
|
-
value: string | number;
|
|
40
|
-
bgColor: ColorPalette;
|
|
41
|
-
displayShadow: boolean;
|
|
42
|
-
radioSize: RadioSizeType;
|
|
43
|
-
checkedColor: ColorPalette;
|
|
44
|
-
}, {}>;
|
|
45
|
-
export default _default;
|
|
46
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
47
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
48
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
49
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
50
|
-
} : {
|
|
51
|
-
type: import('vue').PropType<T[K]>;
|
|
52
|
-
required: true;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
type __VLS_WithDefaults<P, D> = {
|
|
56
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
57
|
-
default: D[K];
|
|
58
|
-
}> : P[K];
|
|
59
|
-
};
|
|
60
|
-
type __VLS_Prettify<T> = {
|
|
61
|
-
[K in keyof T]: T[K];
|
|
62
|
-
} & {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type RadioSizeType = 'sm' | 'md' | 'lg';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type RadioSizeType = 'sm' | 'md' | 'lg'
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { ColorPalette } from '@bobbykim/manguito-theme'
|
|
3
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
4
|
-
import { computed, ref } from 'vue'
|
|
5
|
-
import type { ColorMap } from '../common/index.types'
|
|
6
|
-
import type { SwitchSizeType } from './index.types'
|
|
7
|
-
|
|
8
|
-
const props = withDefaults(
|
|
9
|
-
defineProps<{
|
|
10
|
-
id: string
|
|
11
|
-
sliderColor?: ColorPalette
|
|
12
|
-
onColor?: ColorPalette
|
|
13
|
-
offColor?: ColorPalette
|
|
14
|
-
switchSize?: SwitchSizeType
|
|
15
|
-
rounded?: boolean
|
|
16
|
-
modelValue?: boolean
|
|
17
|
-
}>(),
|
|
18
|
-
{
|
|
19
|
-
sliderColor: 'light-1',
|
|
20
|
-
onColor: 'success',
|
|
21
|
-
offColor: 'dark-1',
|
|
22
|
-
switchSize: 'md',
|
|
23
|
-
rounded: true,
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
const emit = defineEmits(['update:modelValue'])
|
|
28
|
-
const inputRef = ref<HTMLInputElement>()
|
|
29
|
-
|
|
30
|
-
const peerBgColor: ColorMap = {
|
|
31
|
-
primary: 'peer-checked/input:bg-primary',
|
|
32
|
-
secondary: 'peer-checked/input:bg-secondary',
|
|
33
|
-
success: 'peer-checked/input:bg-success',
|
|
34
|
-
info: 'peer-checked/input:bg-info',
|
|
35
|
-
warning: 'peer-checked/input:bg-warning',
|
|
36
|
-
danger: 'peer-checked/input:bg-danger',
|
|
37
|
-
'light-1': 'peer-checked/input:bg-light-1',
|
|
38
|
-
'light-2': 'peer-checked/input:bg-light-2',
|
|
39
|
-
'light-3': 'peer-checked/input:bg-light-3',
|
|
40
|
-
'light-4': 'peer-checked/input:bg-light-4',
|
|
41
|
-
'dark-1': 'peer-checked/input:bg-dark-1',
|
|
42
|
-
'dark-2': 'peer-checked/input:bg-dark-2',
|
|
43
|
-
'dark-3': 'peer-checked/input:bg-dark-3',
|
|
44
|
-
'dark-4': 'peer-checked/input:bg-dark-1',
|
|
45
|
-
transparent: 'peer-checked/input:bg-transparent',
|
|
46
|
-
black: 'peer-checked/input:bg-black',
|
|
47
|
-
white: 'peer-checked/input:bg-white',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const onSwitchClick = (): void => {
|
|
51
|
-
inputRef.value?.click()
|
|
52
|
-
}
|
|
53
|
-
const inputValue = computed({
|
|
54
|
-
get() {
|
|
55
|
-
return props.modelValue
|
|
56
|
-
},
|
|
57
|
-
set(value) {
|
|
58
|
-
emit('update:modelValue', value)
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
const switchSize = computed(() => {
|
|
63
|
-
/**
|
|
64
|
-
* @summary - handle value of variables determining the size of the switch
|
|
65
|
-
* @param {SwitchSizeType} switchSize - size of switch sm|md|lg
|
|
66
|
-
*/
|
|
67
|
-
if (props.switchSize === 'sm') {
|
|
68
|
-
return {
|
|
69
|
-
'--switch-width': '30px',
|
|
70
|
-
'--switch-height': '17px',
|
|
71
|
-
'--slider-size': '13px',
|
|
72
|
-
'--gutter-size': '2px',
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (props.switchSize === 'lg') {
|
|
76
|
-
return {
|
|
77
|
-
'--switch-width': '60px',
|
|
78
|
-
'--switch-height': '34px',
|
|
79
|
-
'--slider-size': '26px',
|
|
80
|
-
'--gutter-size': '4px',
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
'--switch-width': '45px',
|
|
85
|
-
'--switch-height': '25.5px',
|
|
86
|
-
'--slider-size': '19.5px',
|
|
87
|
-
'--gutter-size': '3px',
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
const switchClass = computed<string>(() => {
|
|
91
|
-
/**
|
|
92
|
-
* @summary - handle style classes based on input prop values
|
|
93
|
-
* @param {ColorPalette} sliderColor - color of slider button
|
|
94
|
-
* @param {ColorPalette} onColor - color of switch when model value returns true
|
|
95
|
-
* @param {ColorPalette} offColor - color of switch when model value returns false
|
|
96
|
-
* @param {Boolean} rounded - whether this component will have round corners or not
|
|
97
|
-
*/
|
|
98
|
-
const { sliderColor, onColor, offColor, rounded } = props
|
|
99
|
-
const classArray: string[] = [
|
|
100
|
-
generateClass('BGCOLOR', offColor),
|
|
101
|
-
generateClass('BEFOREBG', sliderColor),
|
|
102
|
-
peerBgColor[onColor],
|
|
103
|
-
]
|
|
104
|
-
if (rounded) {
|
|
105
|
-
classArray.push('rounded-full before:rounded-full')
|
|
106
|
-
}
|
|
107
|
-
return classArray.join(' ')
|
|
108
|
-
})
|
|
109
|
-
</script>
|
|
110
|
-
|
|
111
|
-
<template>
|
|
112
|
-
<div class="switch relative" :style="switchSize" @click="onSwitchClick">
|
|
113
|
-
<input
|
|
114
|
-
:id="id"
|
|
115
|
-
class="hidden peer/input"
|
|
116
|
-
v-model="inputValue"
|
|
117
|
-
ref="inputRef"
|
|
118
|
-
type="checkbox"
|
|
119
|
-
/>
|
|
120
|
-
<span
|
|
121
|
-
class="slider absolute inset-0 cursor-pointer transition-all duration-300 before:absolute before:transition-all before:duration-300"
|
|
122
|
-
:class="switchClass"
|
|
123
|
-
></span>
|
|
124
|
-
</div>
|
|
125
|
-
</template>
|
|
126
|
-
|
|
127
|
-
<style lang="scss" scoped>
|
|
128
|
-
/* The switch - the box around the slider */
|
|
129
|
-
.switch {
|
|
130
|
-
width: var(--switch-width);
|
|
131
|
-
height: var(--switch-height);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.slider:before {
|
|
135
|
-
content: '';
|
|
136
|
-
height: var(--slider-size);
|
|
137
|
-
width: var(--slider-size);
|
|
138
|
-
left: var(--gutter-size);
|
|
139
|
-
bottom: var(--gutter-size);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
input:checked + .slider:before {
|
|
143
|
-
-webkit-transform: translateX(var(--slider-size));
|
|
144
|
-
-ms-transform: translateX(var(--slider-size));
|
|
145
|
-
transform: translateX(var(--slider-size));
|
|
146
|
-
}
|
|
147
|
-
</style>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette } from '@bobbykim/manguito-theme';
|
|
2
|
-
import type { SwitchSizeType } from './index.types';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
id: string;
|
|
5
|
-
sliderColor?: ColorPalette | undefined;
|
|
6
|
-
onColor?: ColorPalette | undefined;
|
|
7
|
-
offColor?: ColorPalette | undefined;
|
|
8
|
-
switchSize?: SwitchSizeType | undefined;
|
|
9
|
-
rounded?: boolean | undefined;
|
|
10
|
-
modelValue?: boolean | undefined;
|
|
11
|
-
}>, {
|
|
12
|
-
sliderColor: string;
|
|
13
|
-
onColor: string;
|
|
14
|
-
offColor: string;
|
|
15
|
-
switchSize: string;
|
|
16
|
-
rounded: boolean;
|
|
17
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
"update:modelValue": (...args: any[]) => void;
|
|
19
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
20
|
-
id: string;
|
|
21
|
-
sliderColor?: ColorPalette | undefined;
|
|
22
|
-
onColor?: ColorPalette | undefined;
|
|
23
|
-
offColor?: ColorPalette | undefined;
|
|
24
|
-
switchSize?: SwitchSizeType | undefined;
|
|
25
|
-
rounded?: boolean | undefined;
|
|
26
|
-
modelValue?: boolean | undefined;
|
|
27
|
-
}>, {
|
|
28
|
-
sliderColor: string;
|
|
29
|
-
onColor: string;
|
|
30
|
-
offColor: string;
|
|
31
|
-
switchSize: string;
|
|
32
|
-
rounded: boolean;
|
|
33
|
-
}>>> & {
|
|
34
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
rounded: boolean;
|
|
37
|
-
sliderColor: ColorPalette;
|
|
38
|
-
onColor: ColorPalette;
|
|
39
|
-
offColor: ColorPalette;
|
|
40
|
-
switchSize: SwitchSizeType;
|
|
41
|
-
}, {}>;
|
|
42
|
-
export default _default;
|
|
43
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
44
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
45
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
46
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
47
|
-
} : {
|
|
48
|
-
type: import('vue').PropType<T[K]>;
|
|
49
|
-
required: true;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
type __VLS_WithDefaults<P, D> = {
|
|
53
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
54
|
-
default: D[K];
|
|
55
|
-
}> : P[K];
|
|
56
|
-
};
|
|
57
|
-
type __VLS_Prettify<T> = {
|
|
58
|
-
[K in keyof T]: T[K];
|
|
59
|
-
} & {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SwitchSizeType = 'sm' | 'md' | 'lg';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SwitchSizeType = 'sm' | 'md' | 'lg'
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import type { ColorPalette, InputType } from '@bobbykim/manguito-theme'
|
|
4
|
-
import generateClass from '@bobbykim/manguito-theme'
|
|
5
|
-
import InputHighlight from '../common/InputHighlight.vue'
|
|
6
|
-
|
|
7
|
-
const props = withDefaults(
|
|
8
|
-
defineProps<{
|
|
9
|
-
id: string
|
|
10
|
-
displayBorder?: boolean
|
|
11
|
-
borderColor?: ColorPalette
|
|
12
|
-
rounded?: boolean
|
|
13
|
-
displayHighlight?: boolean
|
|
14
|
-
highlightColor?: ColorPalette
|
|
15
|
-
textcolor?: ColorPalette
|
|
16
|
-
bgColor?: ColorPalette
|
|
17
|
-
placeholder?: string
|
|
18
|
-
type?: InputType
|
|
19
|
-
displayShadow?: boolean
|
|
20
|
-
required?: boolean
|
|
21
|
-
modelValue?: string
|
|
22
|
-
invalidFeedback?: string
|
|
23
|
-
minLength?: number
|
|
24
|
-
maxLength?: number
|
|
25
|
-
pattern?: string
|
|
26
|
-
}>(),
|
|
27
|
-
{
|
|
28
|
-
displayBorder: false,
|
|
29
|
-
borderColor: 'light-4',
|
|
30
|
-
rounded: false,
|
|
31
|
-
displayHighlight: true,
|
|
32
|
-
highlightColor: 'primary',
|
|
33
|
-
textcolor: 'black',
|
|
34
|
-
bgColor: 'light-1',
|
|
35
|
-
placeholder: '',
|
|
36
|
-
type: 'text',
|
|
37
|
-
displayShadow: true,
|
|
38
|
-
required: false,
|
|
39
|
-
}
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
const emit = defineEmits(['update:modelValue'])
|
|
43
|
-
const inputValue = computed({
|
|
44
|
-
get() {
|
|
45
|
-
return props.modelValue
|
|
46
|
-
},
|
|
47
|
-
set(value) {
|
|
48
|
-
emit('update:modelValue', value)
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const inputClass = computed(() => {
|
|
53
|
-
const {
|
|
54
|
-
bgColor,
|
|
55
|
-
displayBorder,
|
|
56
|
-
borderColor,
|
|
57
|
-
displayHighlight,
|
|
58
|
-
displayShadow,
|
|
59
|
-
rounded,
|
|
60
|
-
textcolor,
|
|
61
|
-
} = props
|
|
62
|
-
const classArray: string[] = [
|
|
63
|
-
generateClass('BGCOLOR', bgColor),
|
|
64
|
-
generateClass('TEXTCOLOR', textcolor),
|
|
65
|
-
]
|
|
66
|
-
if (displayBorder) {
|
|
67
|
-
classArray.push('border-2')
|
|
68
|
-
classArray.push(generateClass('BORDER', borderColor))
|
|
69
|
-
}
|
|
70
|
-
if (!displayHighlight) {
|
|
71
|
-
classArray.push(
|
|
72
|
-
'focus:ring-4 ring-offset-2 transition-all duration-300 ease-linear'
|
|
73
|
-
)
|
|
74
|
-
classArray.push(generateClass('FOCUSRING', borderColor))
|
|
75
|
-
}
|
|
76
|
-
if (displayShadow) {
|
|
77
|
-
classArray.push('shadow-md')
|
|
78
|
-
}
|
|
79
|
-
if (rounded) {
|
|
80
|
-
classArray.push('rounded-md')
|
|
81
|
-
}
|
|
82
|
-
return classArray.join(' ')
|
|
83
|
-
})
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<template>
|
|
87
|
-
<div>
|
|
88
|
-
<input
|
|
89
|
-
:id="id"
|
|
90
|
-
:type="type"
|
|
91
|
-
class="w-full p-2xs outline-none peer peer/validation"
|
|
92
|
-
:class="inputClass"
|
|
93
|
-
v-model="inputValue"
|
|
94
|
-
:placeholder="placeholder"
|
|
95
|
-
:required="required"
|
|
96
|
-
:minlength="minLength"
|
|
97
|
-
:maxlength="maxLength"
|
|
98
|
-
:pattern="pattern"
|
|
99
|
-
/>
|
|
100
|
-
<input-highlight
|
|
101
|
-
v-if="displayHighlight"
|
|
102
|
-
:color="highlightColor"
|
|
103
|
-
:rounded="rounded"
|
|
104
|
-
></input-highlight>
|
|
105
|
-
<div
|
|
106
|
-
class="peer-valid/validation:hidden peer-inavlid/validation:block ml-3xs"
|
|
107
|
-
>
|
|
108
|
-
<slot name="invalid-feedback">
|
|
109
|
-
<span class="text-xs text-danger">{{ invalidFeedback }}</span>
|
|
110
|
-
</slot>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</template>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { ColorPalette, InputType } from '@bobbykim/manguito-theme';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
-
id: string;
|
|
4
|
-
displayBorder?: boolean | undefined;
|
|
5
|
-
borderColor?: ColorPalette | undefined;
|
|
6
|
-
rounded?: boolean | undefined;
|
|
7
|
-
displayHighlight?: boolean | undefined;
|
|
8
|
-
highlightColor?: ColorPalette | undefined;
|
|
9
|
-
textcolor?: ColorPalette | undefined;
|
|
10
|
-
bgColor?: ColorPalette | undefined;
|
|
11
|
-
placeholder?: string | undefined;
|
|
12
|
-
type?: InputType | undefined;
|
|
13
|
-
displayShadow?: boolean | undefined;
|
|
14
|
-
required?: boolean | undefined;
|
|
15
|
-
modelValue?: string | undefined;
|
|
16
|
-
invalidFeedback?: string | undefined;
|
|
17
|
-
minLength?: number | undefined;
|
|
18
|
-
maxLength?: number | undefined;
|
|
19
|
-
pattern?: string | undefined;
|
|
20
|
-
}>, {
|
|
21
|
-
displayBorder: boolean;
|
|
22
|
-
borderColor: string;
|
|
23
|
-
rounded: boolean;
|
|
24
|
-
displayHighlight: boolean;
|
|
25
|
-
highlightColor: string;
|
|
26
|
-
textcolor: string;
|
|
27
|
-
bgColor: string;
|
|
28
|
-
placeholder: string;
|
|
29
|
-
type: string;
|
|
30
|
-
displayShadow: boolean;
|
|
31
|
-
required: boolean;
|
|
32
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
-
"update:modelValue": (...args: any[]) => void;
|
|
34
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
35
|
-
id: string;
|
|
36
|
-
displayBorder?: boolean | undefined;
|
|
37
|
-
borderColor?: ColorPalette | undefined;
|
|
38
|
-
rounded?: boolean | undefined;
|
|
39
|
-
displayHighlight?: boolean | undefined;
|
|
40
|
-
highlightColor?: ColorPalette | undefined;
|
|
41
|
-
textcolor?: ColorPalette | undefined;
|
|
42
|
-
bgColor?: ColorPalette | undefined;
|
|
43
|
-
placeholder?: string | undefined;
|
|
44
|
-
type?: InputType | undefined;
|
|
45
|
-
displayShadow?: boolean | undefined;
|
|
46
|
-
required?: boolean | undefined;
|
|
47
|
-
modelValue?: string | undefined;
|
|
48
|
-
invalidFeedback?: string | undefined;
|
|
49
|
-
minLength?: number | undefined;
|
|
50
|
-
maxLength?: number | undefined;
|
|
51
|
-
pattern?: string | undefined;
|
|
52
|
-
}>, {
|
|
53
|
-
displayBorder: boolean;
|
|
54
|
-
borderColor: string;
|
|
55
|
-
rounded: boolean;
|
|
56
|
-
displayHighlight: boolean;
|
|
57
|
-
highlightColor: string;
|
|
58
|
-
textcolor: string;
|
|
59
|
-
bgColor: string;
|
|
60
|
-
placeholder: string;
|
|
61
|
-
type: string;
|
|
62
|
-
displayShadow: boolean;
|
|
63
|
-
required: boolean;
|
|
64
|
-
}>>> & {
|
|
65
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
66
|
-
}, {
|
|
67
|
-
rounded: boolean;
|
|
68
|
-
type: InputType;
|
|
69
|
-
required: boolean;
|
|
70
|
-
placeholder: string;
|
|
71
|
-
displayBorder: boolean;
|
|
72
|
-
bgColor: ColorPalette;
|
|
73
|
-
borderColor: ColorPalette;
|
|
74
|
-
displayShadow: boolean;
|
|
75
|
-
displayHighlight: boolean;
|
|
76
|
-
highlightColor: ColorPalette;
|
|
77
|
-
textcolor: ColorPalette;
|
|
78
|
-
}, {}>, {
|
|
79
|
-
"invalid-feedback"?(_: {}): any;
|
|
80
|
-
}>;
|
|
81
|
-
export default _default;
|
|
82
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
83
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
84
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
85
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
86
|
-
} : {
|
|
87
|
-
type: import('vue').PropType<T[K]>;
|
|
88
|
-
required: true;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
type __VLS_WithDefaults<P, D> = {
|
|
92
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
93
|
-
default: D[K];
|
|
94
|
-
}> : P[K];
|
|
95
|
-
};
|
|
96
|
-
type __VLS_Prettify<T> = {
|
|
97
|
-
[K in keyof T]: T[K];
|
|
98
|
-
} & {};
|
|
99
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
100
|
-
new (): {
|
|
101
|
-
$slots: S;
|
|
102
|
-
};
|
|
103
|
-
};
|