@proj-airi/ui 0.4.23
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/LICENSE +21 -0
- package/build.config.ts +11 -0
- package/dist/components/Animations/TransitionVertical.vue +95 -0
- package/dist/components/Animations/index.d.ts +1 -0
- package/dist/components/Animations/index.mjs +1 -0
- package/dist/components/Form/Checkbox/Checkbox.vue +26 -0
- package/dist/components/Form/Checkbox/index.d.ts +1 -0
- package/dist/components/Form/Checkbox/index.mjs +1 -0
- package/dist/components/Form/Field/FieldCheckbox.vue +24 -0
- package/dist/components/Form/Field/FieldInput.vue +34 -0
- package/dist/components/Form/Field/FieldKeyValues.vue +54 -0
- package/dist/components/Form/Field/FieldRange.vue +37 -0
- package/dist/components/Form/Field/index.d.ts +4 -0
- package/dist/components/Form/Field/index.mjs +4 -0
- package/dist/components/Form/Input/Input.vue +20 -0
- package/dist/components/Form/Input/InputFile.vue +65 -0
- package/dist/components/Form/Input/InputKeyValue.vue +17 -0
- package/dist/components/Form/Input/index.d.ts +3 -0
- package/dist/components/Form/Input/index.mjs +3 -0
- package/dist/components/Form/Radio/Radio.vue +103 -0
- package/dist/components/Form/Radio/index.d.ts +1 -0
- package/dist/components/Form/Radio/index.mjs +1 -0
- package/dist/components/Form/Range/Range.vue +313 -0
- package/dist/components/Form/Range/index.d.ts +1 -0
- package/dist/components/Form/Range/index.mjs +1 -0
- package/dist/components/Form/Textarea/Basic.vue +32 -0
- package/dist/components/Form/Textarea/Textarea.vue +14 -0
- package/dist/components/Form/Textarea/index.d.ts +2 -0
- package/dist/components/Form/Textarea/index.mjs +2 -0
- package/dist/components/Form/index.d.ts +6 -0
- package/dist/components/Form/index.mjs +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +46 -0
- package/src/components/Animations/TransitionVertical.vue +134 -0
- package/src/components/Animations/index.ts +1 -0
- package/src/components/Form/Checkbox/Checkbox.vue +27 -0
- package/src/components/Form/Checkbox/index.ts +1 -0
- package/src/components/Form/Field/FieldCheckbox.vue +26 -0
- package/src/components/Form/Field/FieldInput.vue +36 -0
- package/src/components/Form/Field/FieldKeyValues.vue +62 -0
- package/src/components/Form/Field/FieldRange.vue +39 -0
- package/src/components/Form/Field/index.ts +4 -0
- package/src/components/Form/Input/Input.vue +21 -0
- package/src/components/Form/Input/InputFile.vue +71 -0
- package/src/components/Form/Input/InputKeyValue.vue +19 -0
- package/src/components/Form/Input/index.ts +3 -0
- package/src/components/Form/Radio/Radio.vue +106 -0
- package/src/components/Form/Radio/index.ts +1 -0
- package/src/components/Form/Range/Range.vue +328 -0
- package/src/components/Form/Range/index.ts +1 -0
- package/src/components/Form/Textarea/Basic.vue +42 -0
- package/src/components/Form/Textarea/Textarea.vue +15 -0
- package/src/components/Form/Textarea/index.ts +2 -0
- package/src/components/Form/index.ts +6 -0
- package/src/index.ts +2 -0
- package/tsconfig.json +42 -0
- package/uno.config.ts +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-PRESENT Neko Ayaka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/build.config.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineBuildConfig } from 'unbuild'
|
|
2
|
+
|
|
3
|
+
export default defineBuildConfig({
|
|
4
|
+
entries: [
|
|
5
|
+
{ builder: 'mkdist', input: './src/', outDir: './dist/', pattern: '**/*.vue', loaders: ['vue'] },
|
|
6
|
+
{ builder: 'mkdist', input: './src/', outDir: './dist/', pattern: '**/*.ts', format: 'esm', loaders: ['js'] },
|
|
7
|
+
],
|
|
8
|
+
declaration: true,
|
|
9
|
+
sourcemap: true,
|
|
10
|
+
clean: true,
|
|
11
|
+
})
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
duration: { type: Number, required: false, default: 250 },
|
|
4
|
+
easingEnter: { type: String, required: false, default: "ease-in-out" },
|
|
5
|
+
easingLeave: { type: String, required: false, default: "ease-in-out" },
|
|
6
|
+
opacityClosed: { type: Number, required: false, default: 0 },
|
|
7
|
+
opacityOpened: { type: Number, required: false, default: 1 }
|
|
8
|
+
});
|
|
9
|
+
const closed = "0px";
|
|
10
|
+
function getElementStyle(element) {
|
|
11
|
+
return {
|
|
12
|
+
height: element.style.height,
|
|
13
|
+
width: element.style.width,
|
|
14
|
+
position: element.style.position,
|
|
15
|
+
visibility: element.style.visibility,
|
|
16
|
+
overflow: element.style.overflow,
|
|
17
|
+
paddingTop: element.style.paddingTop,
|
|
18
|
+
paddingBottom: element.style.paddingBottom,
|
|
19
|
+
borderTopWidth: element.style.borderTopWidth,
|
|
20
|
+
borderBottomWidth: element.style.borderBottomWidth,
|
|
21
|
+
marginTop: element.style.marginTop,
|
|
22
|
+
marginBottom: element.style.marginBottom
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function prepareElement(element, initialStyle) {
|
|
26
|
+
const { width } = getComputedStyle(element);
|
|
27
|
+
element.style.width = width;
|
|
28
|
+
element.style.position = "absolute";
|
|
29
|
+
element.style.visibility = "hidden";
|
|
30
|
+
element.style.height = "";
|
|
31
|
+
const { height } = getComputedStyle(element);
|
|
32
|
+
element.style.width = initialStyle.width;
|
|
33
|
+
element.style.position = initialStyle.position;
|
|
34
|
+
element.style.visibility = initialStyle.visibility;
|
|
35
|
+
element.style.height = closed;
|
|
36
|
+
element.style.overflow = "hidden";
|
|
37
|
+
return initialStyle.height && initialStyle.height !== closed ? initialStyle.height : height;
|
|
38
|
+
}
|
|
39
|
+
function animateTransition(element, initialStyle, done, keyframes, options) {
|
|
40
|
+
const animation = element.animate(keyframes, options);
|
|
41
|
+
element.style.height = initialStyle.height;
|
|
42
|
+
animation.onfinish = () => {
|
|
43
|
+
element.style.overflow = initialStyle.overflow;
|
|
44
|
+
done();
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function getEnterKeyframes(height, initialStyle) {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
height: closed,
|
|
51
|
+
opacity: props.opacityClosed,
|
|
52
|
+
paddingTop: closed,
|
|
53
|
+
paddingBottom: closed,
|
|
54
|
+
borderTopWidth: closed,
|
|
55
|
+
borderBottomWidth: closed,
|
|
56
|
+
marginTop: closed,
|
|
57
|
+
marginBottom: closed
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
height,
|
|
61
|
+
opacity: props.opacityOpened,
|
|
62
|
+
paddingTop: initialStyle.paddingTop,
|
|
63
|
+
paddingBottom: initialStyle.paddingBottom,
|
|
64
|
+
borderTopWidth: initialStyle.borderTopWidth,
|
|
65
|
+
borderBottomWidth: initialStyle.borderBottomWidth,
|
|
66
|
+
marginTop: initialStyle.marginTop,
|
|
67
|
+
marginBottom: initialStyle.marginBottom
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
function enterTransition(element, done) {
|
|
72
|
+
const HTMLElement = element;
|
|
73
|
+
const initialStyle = getElementStyle(HTMLElement);
|
|
74
|
+
const height = prepareElement(HTMLElement, initialStyle);
|
|
75
|
+
const keyframes = getEnterKeyframes(height, initialStyle);
|
|
76
|
+
const options = { duration: props.duration, easing: props.easingEnter };
|
|
77
|
+
animateTransition(HTMLElement, initialStyle, done, keyframes, options);
|
|
78
|
+
}
|
|
79
|
+
function leaveTransition(element, done) {
|
|
80
|
+
const HTMLElement = element;
|
|
81
|
+
const initialStyle = getElementStyle(HTMLElement);
|
|
82
|
+
const { height } = getComputedStyle(HTMLElement);
|
|
83
|
+
HTMLElement.style.height = height;
|
|
84
|
+
HTMLElement.style.overflow = "hidden";
|
|
85
|
+
const keyframes = getEnterKeyframes(height, initialStyle).reverse();
|
|
86
|
+
const options = { duration: props.duration, easing: props.easingLeave };
|
|
87
|
+
animateTransition(HTMLElement, initialStyle, done, keyframes, options);
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<Transition :css="false" @enter="enterTransition" @leave="leaveTransition">
|
|
93
|
+
<slot />
|
|
94
|
+
</Transition>
|
|
95
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TransitionVertical } from './TransitionVertical.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TransitionVertical } from "./TransitionVertical.vue";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { SwitchRoot, SwitchThumb } from "reka-ui";
|
|
3
|
+
const modelValue = defineModel({ type: Boolean, ...{ required: true } });
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<SwitchRoot
|
|
8
|
+
v-model="modelValue"
|
|
9
|
+
transition="background duration-250 ease-in-out"
|
|
10
|
+
outline="focus-within:none"
|
|
11
|
+
flex="~"
|
|
12
|
+
border="neutral-300 dark:neutral-700 data-[state=checked]:primary-200 data-[state=unchecked]:neutral-300 focus-within:neutral-800"
|
|
13
|
+
bg="data-[state=checked]:primary-400 data-[state=unchecked]:neutral-300 data-[state=checked]:dark:primary-400/80 dark:data-[state=unchecked]:neutral-800"
|
|
14
|
+
relative h-7 w="12.5" rounded-full
|
|
15
|
+
shadow="sm focus-within:shadow-neutral-800 focus-within:[0_0_0_1px] "
|
|
16
|
+
>
|
|
17
|
+
<SwitchThumb
|
|
18
|
+
my-auto size-6
|
|
19
|
+
flex items-center justify-center
|
|
20
|
+
translate-x="0.5 data-[state=checked]:full"
|
|
21
|
+
rounded-full bg-white text-xs shadow-xl
|
|
22
|
+
transition="transform duration-250 ease-in-out"
|
|
23
|
+
will-change-transform
|
|
24
|
+
/>
|
|
25
|
+
</SwitchRoot>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from "./Checkbox.vue";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Checkbox from "../Checkbox/Checkbox.vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
label: { type: String, required: false },
|
|
5
|
+
description: { type: String, required: false }
|
|
6
|
+
});
|
|
7
|
+
const modelValue = defineModel({ type: Boolean, ...{ required: true } });
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<label flex="~ col gap-4">
|
|
12
|
+
<div flex="~ row" items-center gap-2>
|
|
13
|
+
<div flex="1">
|
|
14
|
+
<div class="flex items-center gap-1 text-sm font-medium">
|
|
15
|
+
{{ props.label }}
|
|
16
|
+
</div>
|
|
17
|
+
<div class="text-xs text-neutral-500 dark:text-neutral-400">
|
|
18
|
+
{{ props.description }}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<Checkbox v-model="modelValue" />
|
|
22
|
+
</div>
|
|
23
|
+
</label>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Input from "../Input/Input.vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
label: { type: String, required: false },
|
|
5
|
+
description: { type: String, required: false },
|
|
6
|
+
placeholder: { type: String, required: false },
|
|
7
|
+
required: { type: Boolean, required: false },
|
|
8
|
+
type: { type: String, required: false },
|
|
9
|
+
inputClass: { type: String, required: false }
|
|
10
|
+
});
|
|
11
|
+
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div max-w-full>
|
|
16
|
+
<label flex="~ col gap-4">
|
|
17
|
+
<div>
|
|
18
|
+
<div class="flex items-center gap-1 text-sm font-medium">
|
|
19
|
+
{{ props.label }}
|
|
20
|
+
<span v-if="props.required !== false" class="text-red-500">*</span>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="text-xs text-neutral-500 dark:text-neutral-400" text-nowrap>
|
|
23
|
+
{{ props.description }}
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<Input
|
|
27
|
+
v-model="modelValue"
|
|
28
|
+
:type="props.type"
|
|
29
|
+
:placeholder="props.placeholder"
|
|
30
|
+
:class="props.inputClass"
|
|
31
|
+
/>
|
|
32
|
+
</label>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
|
+
import InputKeyValue from "../Input/InputKeyValue.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
label: { type: String, required: false },
|
|
6
|
+
description: { type: String, required: false },
|
|
7
|
+
name: { type: String, required: false },
|
|
8
|
+
keyPlaceholder: { type: String, required: false },
|
|
9
|
+
valuePlaceholder: { type: String, required: false },
|
|
10
|
+
required: { type: Boolean, required: false },
|
|
11
|
+
inputClass: { type: String, required: false }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["remove", "add"]);
|
|
14
|
+
const keyValues = defineModel({ type: Array, ...{ required: true } });
|
|
15
|
+
const inputKey = ref("");
|
|
16
|
+
const inputValue = ref("");
|
|
17
|
+
watch([inputKey, inputValue], () => {
|
|
18
|
+
emit("add", inputKey.value, inputValue.value);
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div max-w-full>
|
|
24
|
+
<label flex="~ col gap-2">
|
|
25
|
+
<div>
|
|
26
|
+
<div class="flex items-center gap-1 text-sm font-medium">
|
|
27
|
+
{{ props.label }}
|
|
28
|
+
<span v-if="props.required !== false" class="text-red-500">*</span>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="text-xs text-neutral-500 dark:text-neutral-400" text-nowrap>
|
|
31
|
+
{{ props.description }}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div v-auto-animate flex="~ col gap-2">
|
|
35
|
+
<div
|
|
36
|
+
v-for="(keyValue, index) in keyValues"
|
|
37
|
+
:key="index"
|
|
38
|
+
w-full flex items-center gap-2
|
|
39
|
+
>
|
|
40
|
+
<InputKeyValue
|
|
41
|
+
v-model:property-key="keyValue.key"
|
|
42
|
+
v-model:property-value="keyValue.value"
|
|
43
|
+
:key-placeholder="props.keyPlaceholder"
|
|
44
|
+
:value-placeholder="props.valuePlaceholder"
|
|
45
|
+
w-full
|
|
46
|
+
/>
|
|
47
|
+
<button @click="emit('remove', index)">
|
|
48
|
+
<div i-solar:minus-circle-line-duotone size="6" />
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</label>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Range from "../Range/Range.vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
min: { type: Number, required: false },
|
|
5
|
+
max: { type: Number, required: false },
|
|
6
|
+
step: { type: Number, required: false },
|
|
7
|
+
label: { type: String, required: false },
|
|
8
|
+
description: { type: String, required: false },
|
|
9
|
+
formatValue: { type: Function, required: false }
|
|
10
|
+
});
|
|
11
|
+
const modelValue = defineModel({ type: Number, ...{ required: true } });
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<label flex="~ col gap-4">
|
|
16
|
+
<div flex="~ row" items-center gap-2>
|
|
17
|
+
<div flex="1">
|
|
18
|
+
<div class="flex items-center gap-1 text-sm font-medium">
|
|
19
|
+
{{ label }}
|
|
20
|
+
</div>
|
|
21
|
+
<div class="text-xs text-neutral-500 dark:text-neutral-400">
|
|
22
|
+
{{ description }}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<span font-mono>{{ props.formatValue?.(modelValue) || modelValue }}</span>
|
|
26
|
+
</div>
|
|
27
|
+
<div flex="~ row" items-center gap-2>
|
|
28
|
+
<Range
|
|
29
|
+
v-model="modelValue"
|
|
30
|
+
:min="min || 0"
|
|
31
|
+
:max="max || 1"
|
|
32
|
+
:step="step || 0.01"
|
|
33
|
+
w-full
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</label>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
type: { type: String, required: false }
|
|
4
|
+
});
|
|
5
|
+
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<input
|
|
10
|
+
v-model="modelValue"
|
|
11
|
+
:type="props.type || 'text'"
|
|
12
|
+
border="focus:primary-300 dark:focus:primary-400/50 2 solid neutral-100 dark:neutral-900"
|
|
13
|
+
transition="all duration-200 ease-in-out"
|
|
14
|
+
text="disabled:neutral-400 dark:disabled:neutral-600"
|
|
15
|
+
cursor="disabled:not-allowed"
|
|
16
|
+
w-full rounded-lg px-2 py-1 text-nowrap text-sm outline-none
|
|
17
|
+
shadow="sm"
|
|
18
|
+
bg="neutral-50 dark:neutral-950 focus:neutral-50 dark:focus:neutral-900"
|
|
19
|
+
>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useDebounce } from "@vueuse/core";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
defineProps({
|
|
5
|
+
accept: { type: String, required: false },
|
|
6
|
+
multiple: { type: Boolean, required: false }
|
|
7
|
+
});
|
|
8
|
+
const files = defineModel({ type: Array, ...{ required: false, default: () => [] } });
|
|
9
|
+
const firstFile = ref();
|
|
10
|
+
const isDragging = ref(false);
|
|
11
|
+
const isDraggingDebounced = useDebounce(isDragging, 150);
|
|
12
|
+
function handleFileChange(e) {
|
|
13
|
+
const input = e.target;
|
|
14
|
+
if (input.files && input.files.length > 0) {
|
|
15
|
+
firstFile.value = input.files[0];
|
|
16
|
+
}
|
|
17
|
+
files.value = Array.from(input.files || []);
|
|
18
|
+
isDragging.value = false;
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<label
|
|
24
|
+
relative
|
|
25
|
+
class="min-h-[120px] flex flex-col cursor-pointer items-center justify-center rounded-xl p-6"
|
|
26
|
+
:class="[
|
|
27
|
+
isDraggingDebounced ? 'border-primary-400 dark:border-primary-600 hover:border-primary-300 dark:hover:border-primary-700' : 'border-neutral-200 dark:border-neutral-700 hover:border-primary-300 dark:hover:border-primary-700',
|
|
28
|
+
isDraggingDebounced ? 'bg-primary-50/5 dark:bg-primary-900/5' : 'bg-white/60 dark:bg-black/30 hover:bg-white/80 dark:hover:bg-black/40',
|
|
29
|
+
]"
|
|
30
|
+
border="dashed 2"
|
|
31
|
+
transition="all duration-300"
|
|
32
|
+
cursor-pointer opacity-95
|
|
33
|
+
hover="scale-100 opacity-100 shadow-md dark:shadow-lg"
|
|
34
|
+
@dragover="isDragging = true"
|
|
35
|
+
@dragleave="isDragging = false"
|
|
36
|
+
>
|
|
37
|
+
<input
|
|
38
|
+
type="file"
|
|
39
|
+
:accept="accept"
|
|
40
|
+
:multiple="multiple"
|
|
41
|
+
cursor-pointer
|
|
42
|
+
class="absolute inset-0 h-full w-full opacity-0"
|
|
43
|
+
@change="handleFileChange"
|
|
44
|
+
>
|
|
45
|
+
<slot :is-dragging="isDraggingDebounced" :first-file="firstFile" :files="files">
|
|
46
|
+
<div
|
|
47
|
+
class="flex flex-col items-center"
|
|
48
|
+
:class="[
|
|
49
|
+
isDraggingDebounced ? 'text-primary-500 dark:text-primary-400' : 'text-neutral-400 dark:text-neutral-500',
|
|
50
|
+
]"
|
|
51
|
+
>
|
|
52
|
+
<div i-solar:upload-square-line-duotone mb-2 text-5xl />
|
|
53
|
+
<p font-medium text="center lg">
|
|
54
|
+
Upload
|
|
55
|
+
</p>
|
|
56
|
+
<p v-if="isDraggingDebounced" text="center" text-sm>
|
|
57
|
+
Release to upload
|
|
58
|
+
</p>
|
|
59
|
+
<p v-else text="center" text-sm>
|
|
60
|
+
Click or drag and drop a file here
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
</slot>
|
|
64
|
+
</label>
|
|
65
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import Input from "./Input.vue";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
name: { type: String, required: false },
|
|
5
|
+
keyPlaceholder: { type: String, required: false },
|
|
6
|
+
valuePlaceholder: { type: String, required: false }
|
|
7
|
+
});
|
|
8
|
+
const key = defineModel("propertyKey", { type: String, ...{ required: true } });
|
|
9
|
+
const value = defineModel("propertyValue", { type: String, ...{ required: true } });
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div flex="~ gap-2">
|
|
14
|
+
<Input v-model="key" :placeholder="props.keyPlaceholder" class="w-1/2" />
|
|
15
|
+
<Input v-model="value" :placeholder="props.valuePlaceholder" class="w-1/2" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
id: { type: String, required: true },
|
|
4
|
+
name: { type: String, required: true },
|
|
5
|
+
value: { type: String, required: true },
|
|
6
|
+
title: { type: String, required: true },
|
|
7
|
+
deprecated: { type: Boolean, required: false, default: false }
|
|
8
|
+
});
|
|
9
|
+
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<label
|
|
14
|
+
:key="id"
|
|
15
|
+
class="form_radio relative flex cursor-pointer items-start rounded-xl p-3 pr-[20px]"
|
|
16
|
+
transition="all duration-200 ease-in-out"
|
|
17
|
+
border="2 solid"
|
|
18
|
+
:class="[
|
|
19
|
+
modelValue === value
|
|
20
|
+
? 'bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30'
|
|
21
|
+
: 'bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30',
|
|
22
|
+
modelValue === value
|
|
23
|
+
? 'form_radio-active'
|
|
24
|
+
: '',
|
|
25
|
+
deprecated ? 'opacity-60' : '',
|
|
26
|
+
]"
|
|
27
|
+
>
|
|
28
|
+
<input
|
|
29
|
+
v-model="modelValue"
|
|
30
|
+
:checked="modelValue === value"
|
|
31
|
+
type="radio"
|
|
32
|
+
:name="name"
|
|
33
|
+
:value="value"
|
|
34
|
+
class="absolute opacity-0"
|
|
35
|
+
>
|
|
36
|
+
<div class="relative mr-3 mt-0.5 flex-shrink-0">
|
|
37
|
+
<div
|
|
38
|
+
class="size-5 border-2 rounded-full transition-colors duration-200"
|
|
39
|
+
:class="[
|
|
40
|
+
modelValue === value
|
|
41
|
+
? 'border-primary-500 dark:border-primary-400'
|
|
42
|
+
: 'border-neutral-300 dark:border-neutral-600',
|
|
43
|
+
]"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
class="absolute left-1/2 top-1/2 size-3 rounded-full transition-opacity duration-200 -translate-x-1/2 -translate-y-1/2"
|
|
47
|
+
:class="[
|
|
48
|
+
modelValue === value
|
|
49
|
+
? 'opacity-100 bg-primary-500 dark:bg-primary-400'
|
|
50
|
+
: 'opacity-0',
|
|
51
|
+
]"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="w-full flex flex-col gap-2">
|
|
56
|
+
<div class="flex items-center">
|
|
57
|
+
<span
|
|
58
|
+
class="line-clamp-1 font-medium"
|
|
59
|
+
:class="[
|
|
60
|
+
modelValue === value
|
|
61
|
+
? 'text-neutral-700 dark:text-neutral-300'
|
|
62
|
+
: 'text-neutral-700 dark:text-neutral-400',
|
|
63
|
+
]"
|
|
64
|
+
>
|
|
65
|
+
{{ title }}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</label>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<style scoped>
|
|
73
|
+
.form_radio {
|
|
74
|
+
position: relative;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.form_radio::before {
|
|
79
|
+
--at-apply: 'bg-gradient-to-r from-primary-500/0 to-primary-500/0 dark:from-primary-400/0 dark:to-primary-400/0';
|
|
80
|
+
content: '';
|
|
81
|
+
position: absolute;
|
|
82
|
+
inset: 0;
|
|
83
|
+
z-index: 0;
|
|
84
|
+
width: 25%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
transition: all 0.35s ease-in-out;
|
|
87
|
+
mask-image: linear-gradient(120deg, white 100%);
|
|
88
|
+
opacity: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.form_radio:hover::before,
|
|
92
|
+
.form_radio._hover::before {
|
|
93
|
+
--at-apply: 'bg-gradient-to-r from-primary-500/20 via-primary-500/10 to-transparent dark:from-primary-400/20 dark:via-primary-400/10 dark:to-transparent';
|
|
94
|
+
width: 85%;
|
|
95
|
+
opacity: 1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.form_radio-active::before {
|
|
99
|
+
--at-apply: 'bg-gradient-to-r from-primary-500/20 via-primary-500/10 to-transparent dark:from-primary-400/20 dark:via-primary-400/10 dark:to-transparent';
|
|
100
|
+
width: 85%;
|
|
101
|
+
opacity: 0.5;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Radio } from './Radio.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Radio } from "./Radio.vue";
|