nexa-ui-kit 0.6.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/NBadge.nexa +40 -0
- package/dist/NBottomSheet.nexa +124 -0
- package/dist/NButton.nexa +123 -0
- package/dist/NCard.nexa +74 -0
- package/dist/NInput.nexa +116 -0
- package/dist/NModal.nexa +165 -0
- package/dist/NSelect.nexa +169 -0
- package/dist/NToastContainer.nexa +86 -0
- package/dist/NTooltip.nexa +115 -0
- package/dist/components/NAlert.js +134 -0
- package/dist/components/NAlert.nexa +115 -0
- package/dist/components/NAutocomplete.js +94 -0
- package/dist/components/NAutocomplete.nexa +58 -0
- package/dist/components/NAvatar.js +75 -0
- package/dist/components/NAvatar.nexa +67 -0
- package/dist/components/NBadge.js +74 -0
- package/dist/components/NBadge.nexa +61 -0
- package/dist/components/NBottomSheet.js +149 -0
- package/dist/components/NBottomSheet.nexa +145 -0
- package/dist/components/NButton.js +284 -0
- package/dist/components/NButton.nexa +275 -0
- package/dist/components/NCard.js +117 -0
- package/dist/components/NCard.nexa +100 -0
- package/dist/components/NCheckbox.js +108 -0
- package/dist/components/NCheckbox.nexa +90 -0
- package/dist/components/NChips.js +72 -0
- package/dist/components/NChips.nexa +57 -0
- package/dist/components/NDataTable.js +252 -0
- package/dist/components/NDataTable.nexa +186 -0
- package/dist/components/NDatepicker.js +379 -0
- package/dist/components/NDatepicker.nexa +367 -0
- package/dist/components/NForm.js +132 -0
- package/dist/components/NForm.nexa +133 -0
- package/dist/components/NFormField.js +173 -0
- package/dist/components/NFormField.nexa +171 -0
- package/dist/components/NInput.js +311 -0
- package/dist/components/NInput.nexa +311 -0
- package/dist/components/NInputNumber.js +202 -0
- package/dist/components/NInputNumber.nexa +199 -0
- package/dist/components/NModal.js +221 -0
- package/dist/components/NModal.nexa +221 -0
- package/dist/components/NMultiSelect.js +156 -0
- package/dist/components/NMultiSelect.nexa +77 -0
- package/dist/components/NPaginator.js +117 -0
- package/dist/components/NPaginator.nexa +77 -0
- package/dist/components/NPassword.js +193 -0
- package/dist/components/NPassword.nexa +178 -0
- package/dist/components/NProgressBar.js +127 -0
- package/dist/components/NProgressBar.nexa +111 -0
- package/dist/components/NRadio.js +96 -0
- package/dist/components/NRadio.nexa +81 -0
- package/dist/components/NSelect.js +468 -0
- package/dist/components/NSelect.nexa +452 -0
- package/dist/components/NSkeleton.js +98 -0
- package/dist/components/NSkeleton.nexa +74 -0
- package/dist/components/NSwitch.js +92 -0
- package/dist/components/NSwitch.nexa +76 -0
- package/dist/components/NTabs.js +129 -0
- package/dist/components/NTabs.nexa +113 -0
- package/dist/components/NTag.js +108 -0
- package/dist/components/NTag.nexa +93 -0
- package/dist/components/NToastContainer.js +242 -0
- package/dist/components/NToastContainer.nexa +221 -0
- package/dist/components/NTooltip.js +163 -0
- package/dist/components/NTooltip.nexa +166 -0
- package/dist/components/NTreeMenu.js +151 -0
- package/dist/components/NTreeMenu.nexa +142 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +34 -0
- package/dist/services/FloatingOverlay.d.ts +27 -0
- package/dist/services/FloatingOverlay.js +98 -0
- package/dist/services/FormValidation.d.ts +8 -0
- package/dist/services/FormValidation.js +46 -0
- package/dist/services/ToastService.d.ts +16 -0
- package/dist/services/ToastService.js +26 -0
- package/dist/styles/theme.d.ts +1 -0
- package/dist/styles/theme.js +144 -0
- package/package.json +32 -0
- package/src/components/NAlert.nexa +115 -0
- package/src/components/NAutocomplete.nexa +58 -0
- package/src/components/NAvatar.nexa +67 -0
- package/src/components/NBadge.nexa +61 -0
- package/src/components/NBottomSheet.nexa +145 -0
- package/src/components/NButton.nexa +275 -0
- package/src/components/NCard.nexa +100 -0
- package/src/components/NCheckbox.nexa +90 -0
- package/src/components/NChips.nexa +57 -0
- package/src/components/NDataTable.nexa +186 -0
- package/src/components/NDatepicker.nexa +367 -0
- package/src/components/NForm.nexa +133 -0
- package/src/components/NFormField.nexa +171 -0
- package/src/components/NInput.nexa +311 -0
- package/src/components/NInputNumber.nexa +199 -0
- package/src/components/NModal.nexa +221 -0
- package/src/components/NMultiSelect.nexa +77 -0
- package/src/components/NPaginator.nexa +77 -0
- package/src/components/NPassword.nexa +178 -0
- package/src/components/NProgressBar.nexa +111 -0
- package/src/components/NRadio.nexa +81 -0
- package/src/components/NSelect.nexa +452 -0
- package/src/components/NSkeleton.nexa +74 -0
- package/src/components/NSwitch.nexa +76 -0
- package/src/components/NTabs.nexa +113 -0
- package/src/components/NTag.nexa +93 -0
- package/src/components/NToastContainer.nexa +221 -0
- package/src/components/NTooltip.nexa +166 -0
- package/src/components/NTreeMenu.nexa +142 -0
- package/src/index.ts +36 -0
- package/src/services/FloatingOverlay.ts +133 -0
- package/src/services/FormValidation.ts +44 -0
- package/src/services/ToastService.ts +41 -0
- package/src/shims.d.ts +5 -0
- package/src/styles/theme.ts +146 -0
- package/src/styles/tokens.css +170 -0
package/dist/NBadge.nexa
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
variant: { type: String, default: 'primary' },
|
|
4
|
+
size: { type: String, default: 'md' },
|
|
5
|
+
rounded: { type: Boolean, default: false }
|
|
6
|
+
})
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<span :class="['n-badge', `n-badge-${variant}`, `n-badge-${size}`, rounded ? 'is-rounded' : '']">
|
|
11
|
+
<slot />
|
|
12
|
+
</span>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
.n-badge {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
padding: 0.25rem 0.6rem;
|
|
21
|
+
font-size: 0.75rem;
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
border-radius: 6px;
|
|
24
|
+
line-height: 1;
|
|
25
|
+
font-family: 'Inter', sans-serif;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
letter-spacing: 0.05em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.n-badge-primary { background: #3b82f6; color: white; }
|
|
31
|
+
.n-badge-success { background: #10b981; color: white; }
|
|
32
|
+
.n-badge-danger { background: #ef4444; color: white; }
|
|
33
|
+
.n-badge-warning { background: #f59e0b; color: white; }
|
|
34
|
+
.n-badge-info { background: #06b6d4; color: white; }
|
|
35
|
+
|
|
36
|
+
.n-badge-sm { padding: 0.15rem 0.4rem; font-size: 0.65rem; }
|
|
37
|
+
.n-badge-lg { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
|
|
38
|
+
|
|
39
|
+
.is-rounded { border-radius: 9999px; }
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { signal, computed, effect, onMounted, onUnmounted } from 'nexa-framework'
|
|
3
|
+
import { useGestures } from 'nexa-mobile'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
show: { type: Boolean, default: false }
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['close'])
|
|
10
|
+
|
|
11
|
+
const yOffset = signal(0)
|
|
12
|
+
const isDragging = signal(false)
|
|
13
|
+
let gestures = null
|
|
14
|
+
|
|
15
|
+
onMounted(() => {
|
|
16
|
+
const el = document.getElementById('n-bottom-sheet-content')
|
|
17
|
+
if (el) {
|
|
18
|
+
gestures = useGestures(el)
|
|
19
|
+
|
|
20
|
+
effect(() => {
|
|
21
|
+
if (gestures.isSwiping.value && gestures.swipeDirection.value === 'down') {
|
|
22
|
+
isDragging.value = true
|
|
23
|
+
yOffset.value = Math.max(0, gestures.deltaY.value)
|
|
24
|
+
} else if (!gestures.isPressed.value && isDragging.value) {
|
|
25
|
+
if (yOffset.value > 100) {
|
|
26
|
+
emit('close')
|
|
27
|
+
}
|
|
28
|
+
isDragging.value = false
|
|
29
|
+
yOffset.value = 0
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
onUnmounted(() => {
|
|
36
|
+
gestures?.destroy()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const style = computed(() => ({
|
|
40
|
+
transform: `translateY(${props.show ? (yOffset.value + 'px') : '100%'})`,
|
|
41
|
+
transition: isDragging.value ? 'none' : 'transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
42
|
+
opacity: props.show || isDragging.value ? 1 : 0
|
|
43
|
+
}))
|
|
44
|
+
|
|
45
|
+
const overlayOpacity = computed(() => {
|
|
46
|
+
if (!props.show) return 0
|
|
47
|
+
return Math.max(0, 1 - (yOffset.value / 400))
|
|
48
|
+
})
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<Teleport to="body">
|
|
53
|
+
<div class="n-bottom-sheet-root" :class="{ 'is-active': show || isDragging.value }">
|
|
54
|
+
<div
|
|
55
|
+
class="n-bottom-sheet-overlay"
|
|
56
|
+
:style="{ opacity: overlayOpacity.value }"
|
|
57
|
+
@click="emit('close')"
|
|
58
|
+
></div>
|
|
59
|
+
|
|
60
|
+
<div
|
|
61
|
+
id="n-bottom-sheet-content"
|
|
62
|
+
class="n-bottom-sheet-container"
|
|
63
|
+
:style="style.value"
|
|
64
|
+
>
|
|
65
|
+
<div class="n-bottom-sheet-handle"></div>
|
|
66
|
+
<div class="n-bottom-sheet-inner">
|
|
67
|
+
<slot />
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</Teleport>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<style scoped>
|
|
75
|
+
.n-bottom-sheet-root {
|
|
76
|
+
position: fixed;
|
|
77
|
+
top: 0;
|
|
78
|
+
left: 0;
|
|
79
|
+
width: 100vw;
|
|
80
|
+
height: 100vh;
|
|
81
|
+
z-index: 2000;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: flex-end;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.n-bottom-sheet-root.is-active {
|
|
88
|
+
pointer-events: auto;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.n-bottom-sheet-overlay {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 0;
|
|
94
|
+
left: 0;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
background: rgba(2, 6, 17, 0.7);
|
|
98
|
+
backdrop-filter: blur(4px);
|
|
99
|
+
transition: opacity 0.3s ease;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.n-bottom-sheet-container {
|
|
103
|
+
position: relative;
|
|
104
|
+
width: 100%;
|
|
105
|
+
background: #0f172a;
|
|
106
|
+
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
107
|
+
border-radius: 24px 24px 0 0;
|
|
108
|
+
box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.3);
|
|
109
|
+
padding-bottom: env(safe-area-inset-bottom, 20px);
|
|
110
|
+
touch-action: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.n-bottom-sheet-handle {
|
|
114
|
+
width: 40px;
|
|
115
|
+
height: 4px;
|
|
116
|
+
background: #334155;
|
|
117
|
+
border-radius: 2px;
|
|
118
|
+
margin: 12px auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.n-bottom-sheet-inner {
|
|
122
|
+
padding: 1rem 2rem 2rem 2rem;
|
|
123
|
+
}
|
|
124
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'nexa-framework'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
variant: { type: String, default: 'primary' },
|
|
6
|
+
size: { type: String, default: 'md' },
|
|
7
|
+
disabled: { type: Boolean, default: false },
|
|
8
|
+
loading: { type: Boolean, default: false }
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const buttonClass = computed(() => {
|
|
12
|
+
return [
|
|
13
|
+
'n-btn',
|
|
14
|
+
`n-btn-${props.variant}`,
|
|
15
|
+
`n-btn-${props.size}`,
|
|
16
|
+
props.loading ? 'is-loading' : ''
|
|
17
|
+
].join(' ')
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<button :class="buttonClass" :disabled="disabled || loading">
|
|
23
|
+
<span v-if="loading" class="n-btn-loader"></span>
|
|
24
|
+
<slot />
|
|
25
|
+
</button>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
.n-btn {
|
|
30
|
+
position: relative;
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
font-family: 'Outfit', 'Inter', sans-serif;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
border-radius: 12px;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
outline: none;
|
|
42
|
+
white-space: nowrap;
|
|
43
|
+
user-select: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Variants */
|
|
47
|
+
.n-btn-primary {
|
|
48
|
+
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
|
49
|
+
color: white;
|
|
50
|
+
box-shadow: 0 4px 15px -3px rgba(37, 99, 235, 0.3);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.n-btn-primary:hover:not(:disabled) {
|
|
54
|
+
transform: translateY(-2px);
|
|
55
|
+
box-shadow: 0 8px 20px -3px rgba(37, 99, 235, 0.4);
|
|
56
|
+
filter: brightness(1.1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.n-btn-secondary {
|
|
60
|
+
background: #1e293b;
|
|
61
|
+
color: #f8fafc;
|
|
62
|
+
border-color: #334155;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.n-btn-secondary:hover:not(:disabled) {
|
|
66
|
+
background: #334155;
|
|
67
|
+
border-color: #475569;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.n-btn-danger {
|
|
71
|
+
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
|
72
|
+
color: white;
|
|
73
|
+
box-shadow: 0 4px 15px -3px rgba(220, 38, 38, 0.3);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.n-btn-danger:hover:not(:disabled) {
|
|
77
|
+
transform: translateY(-2px);
|
|
78
|
+
box-shadow: 0 8px 20px -3px rgba(220, 38, 38, 0.4);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.n-btn-glass {
|
|
82
|
+
background: rgba(255, 255, 255, 0.05);
|
|
83
|
+
backdrop-filter: blur(10px);
|
|
84
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
85
|
+
color: white;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.n-btn-glass:hover:not(:disabled) {
|
|
89
|
+
background: rgba(255, 255, 255, 0.1);
|
|
90
|
+
border-color: rgba(255, 255, 255, 0.2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Sizes */
|
|
94
|
+
.n-btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
|
|
95
|
+
.n-btn-md { padding: 0.75rem 1.5rem; font-size: 1rem; }
|
|
96
|
+
.n-btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }
|
|
97
|
+
|
|
98
|
+
/* States */
|
|
99
|
+
.n-btn:disabled {
|
|
100
|
+
opacity: 0.5;
|
|
101
|
+
cursor: not-allowed;
|
|
102
|
+
transform: none !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.n-btn:active:not(:disabled) {
|
|
106
|
+
transform: scale(0.96);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Loader */
|
|
110
|
+
.n-btn-loader {
|
|
111
|
+
width: 1.2rem;
|
|
112
|
+
height: 1.2rem;
|
|
113
|
+
border: 2px solid currentColor;
|
|
114
|
+
border-right-color: transparent;
|
|
115
|
+
border-radius: 50%;
|
|
116
|
+
animation: n-spin 0.8s linear infinite;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@keyframes n-spin {
|
|
120
|
+
from { transform: rotate(0deg); }
|
|
121
|
+
to { transform: rotate(360deg); }
|
|
122
|
+
}
|
|
123
|
+
</style>
|
package/dist/NCard.nexa
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
title: { type: String, default: '' },
|
|
4
|
+
subtitle: { type: String, default: '' },
|
|
5
|
+
padding: { type: Boolean, default: true },
|
|
6
|
+
hoverable: { type: Boolean, default: false }
|
|
7
|
+
})
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div :class="['n-card', hoverable ? 'is-hoverable' : '']">
|
|
12
|
+
<div v-if="title || $slots.header" class="n-card-header">
|
|
13
|
+
<slot name="header">
|
|
14
|
+
<h3 v-if="title" class="n-card-title">{{ title }}</h3>
|
|
15
|
+
<p v-if="subtitle" class="n-card-subtitle">{{ subtitle }}</p>
|
|
16
|
+
</slot>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div :class="['n-card-body', padding ? 'has-padding' : '']">
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div v-if="$slots.footer" class="n-card-footer">
|
|
24
|
+
<slot name="footer" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.n-card {
|
|
31
|
+
background: rgba(30, 41, 59, 0.7);
|
|
32
|
+
backdrop-filter: blur(12px);
|
|
33
|
+
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
34
|
+
border-radius: 20px;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
37
|
+
transition: all 0.3s ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.n-card.is-hoverable:hover {
|
|
41
|
+
transform: translateY(-4px);
|
|
42
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
43
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.n-card-header {
|
|
47
|
+
padding: 1.5rem;
|
|
48
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.n-card-title {
|
|
52
|
+
margin: 0;
|
|
53
|
+
font-size: 1.25rem;
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
color: #f8fafc;
|
|
56
|
+
letter-spacing: -0.025em;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.n-card-subtitle {
|
|
60
|
+
margin: 0.25rem 0 0 0;
|
|
61
|
+
font-size: 0.875rem;
|
|
62
|
+
color: #94a3b8;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.n-card-body.has-padding {
|
|
66
|
+
padding: 1.5rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.n-card-footer {
|
|
70
|
+
padding: 1rem 1.5rem;
|
|
71
|
+
background: rgba(15, 23, 42, 0.3);
|
|
72
|
+
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
package/dist/NInput.nexa
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
modelValue: { type: [String, Number], default: '' },
|
|
4
|
+
type: { type: String, default: 'text' },
|
|
5
|
+
placeholder: { type: String, default: '' },
|
|
6
|
+
label: { type: String, default: '' },
|
|
7
|
+
error: { type: String, default: '' },
|
|
8
|
+
disabled: { type: Boolean, default: false }
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits(['update:modelValue'])
|
|
12
|
+
|
|
13
|
+
const onInput = (e) => {
|
|
14
|
+
emit('update:modelValue', e.target.value)
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="n-input-group">
|
|
20
|
+
<label v-if="label" class="n-input-label">{{ label }}</label>
|
|
21
|
+
|
|
22
|
+
<div class="n-input-wrapper">
|
|
23
|
+
<input
|
|
24
|
+
:type="type"
|
|
25
|
+
:value="modelValue"
|
|
26
|
+
:placeholder="placeholder"
|
|
27
|
+
:disabled="disabled"
|
|
28
|
+
class="n-input"
|
|
29
|
+
:class="{ 'has-error': error }"
|
|
30
|
+
@input="onInput"
|
|
31
|
+
/>
|
|
32
|
+
<div class="n-input-focus-ring"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<span v-if="error" class="n-input-error-msg">{{ error }}</span>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
.n-input-group {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 0.5rem;
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.n-input-label {
|
|
48
|
+
font-size: 0.875rem;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: #94a3b8;
|
|
51
|
+
margin-left: 0.25rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.n-input-wrapper {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.n-input {
|
|
61
|
+
width: 100%;
|
|
62
|
+
background: #0f172a;
|
|
63
|
+
border: 1px solid #334155;
|
|
64
|
+
color: #f8fafc;
|
|
65
|
+
padding: 0.75rem 1rem;
|
|
66
|
+
border-radius: 12px;
|
|
67
|
+
font-family: inherit;
|
|
68
|
+
font-size: 1rem;
|
|
69
|
+
transition: all 0.3s ease;
|
|
70
|
+
outline: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.n-input::placeholder {
|
|
74
|
+
color: #475569;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.n-input-focus-ring {
|
|
78
|
+
position: absolute;
|
|
79
|
+
inset: -2px;
|
|
80
|
+
border-radius: 14px;
|
|
81
|
+
background: linear-gradient(135deg, #3b82f6, #a855f7);
|
|
82
|
+
opacity: 0;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
transition: opacity 0.3s ease;
|
|
85
|
+
z-index: -1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.n-input:focus ~ .n-input-focus-ring {
|
|
89
|
+
opacity: 0.4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.n-input:focus {
|
|
93
|
+
border-color: #3b82f6;
|
|
94
|
+
background: #1e293b;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.n-input.has-error {
|
|
98
|
+
border-color: #ef4444;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.n-input.has-error:focus ~ .n-input-focus-ring {
|
|
102
|
+
background: #ef4444;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.n-input-error-msg {
|
|
106
|
+
font-size: 0.75rem;
|
|
107
|
+
color: #ef4444;
|
|
108
|
+
margin-left: 0.25rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.n-input:disabled {
|
|
112
|
+
opacity: 0.5;
|
|
113
|
+
cursor: not-allowed;
|
|
114
|
+
background: #1e293b;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
package/dist/NModal.nexa
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { signal, effect, onMounted, onUnmounted } from 'nexa-framework'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
show: { type: Boolean, default: false },
|
|
6
|
+
title: { type: String, default: '' },
|
|
7
|
+
width: { type: String, default: '500px' }
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['close'])
|
|
11
|
+
|
|
12
|
+
const isVisible = signal(false)
|
|
13
|
+
|
|
14
|
+
effect(() => {
|
|
15
|
+
if (props.show) {
|
|
16
|
+
isVisible.value = true
|
|
17
|
+
document.body.style.overflow = 'hidden'
|
|
18
|
+
} else {
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
isVisible.value = false
|
|
21
|
+
document.body.style.overflow = ''
|
|
22
|
+
}, 300)
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const close = () => {
|
|
27
|
+
emit('close')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const handleEsc = (e) => {
|
|
31
|
+
if (e.key === 'Escape' && props.show) close()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onMounted(() => {
|
|
35
|
+
window.addEventListener('keydown', handleEsc)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
onUnmounted(() => {
|
|
39
|
+
window.removeEventListener('keydown', handleEsc)
|
|
40
|
+
document.body.style.overflow = ''
|
|
41
|
+
})
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<Teleport to="body">
|
|
46
|
+
<div v-if="isVisible.value" class="n-modal-root">
|
|
47
|
+
<div
|
|
48
|
+
class="n-modal-overlay"
|
|
49
|
+
:class="{ 'is-active': show }"
|
|
50
|
+
@click="close"
|
|
51
|
+
></div>
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
class="n-modal-container"
|
|
55
|
+
:class="{ 'is-active': show }"
|
|
56
|
+
:style="{ maxWidth: width }"
|
|
57
|
+
>
|
|
58
|
+
<header v-if="title" class="n-modal-header">
|
|
59
|
+
<h3>{{ title }}</h3>
|
|
60
|
+
<button class="n-modal-close" @click="close">×</button>
|
|
61
|
+
</header>
|
|
62
|
+
|
|
63
|
+
<div class="n-modal-content">
|
|
64
|
+
<slot />
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<footer v-if="$slots.footer" class="n-modal-footer">
|
|
68
|
+
<slot name="footer" />
|
|
69
|
+
</footer>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</Teleport>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<style scoped>
|
|
76
|
+
.n-modal-root {
|
|
77
|
+
position: fixed;
|
|
78
|
+
top: 0;
|
|
79
|
+
left: 0;
|
|
80
|
+
width: 100vw;
|
|
81
|
+
height: 100vh;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
z-index: 2000;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.n-modal-overlay {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
background: rgba(2, 6, 17, 0.7);
|
|
95
|
+
backdrop-filter: blur(8px);
|
|
96
|
+
opacity: 0;
|
|
97
|
+
transition: opacity 0.3s ease;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.n-modal-overlay.is-active {
|
|
101
|
+
opacity: 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.n-modal-container {
|
|
105
|
+
position: relative;
|
|
106
|
+
width: 90%;
|
|
107
|
+
background: #0f172a;
|
|
108
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
109
|
+
border-radius: 24px;
|
|
110
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
|
111
|
+
transform: scale(0.9) translateY(20px);
|
|
112
|
+
opacity: 0;
|
|
113
|
+
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.n-modal-container.is-active {
|
|
118
|
+
transform: scale(1) translateY(0);
|
|
119
|
+
opacity: 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.n-modal-header {
|
|
123
|
+
padding: 1.5rem 2rem;
|
|
124
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
125
|
+
display: flex;
|
|
126
|
+
justify-content: space-between;
|
|
127
|
+
align-items: center;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.n-modal-header h3 {
|
|
131
|
+
margin: 0;
|
|
132
|
+
font-size: 1.25rem;
|
|
133
|
+
font-weight: 700;
|
|
134
|
+
color: #f8fafc;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.n-modal-close {
|
|
138
|
+
background: transparent;
|
|
139
|
+
border: none;
|
|
140
|
+
color: #94a3b8;
|
|
141
|
+
font-size: 1.5rem;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
transition: color 0.2s;
|
|
144
|
+
padding: 0;
|
|
145
|
+
line-height: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.n-modal-close:hover {
|
|
149
|
+
color: #f8fafc;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.n-modal-content {
|
|
153
|
+
padding: 2rem;
|
|
154
|
+
color: #94a3b8;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.n-modal-footer {
|
|
158
|
+
padding: 1.25rem 2rem;
|
|
159
|
+
background: rgba(0, 0, 0, 0.2);
|
|
160
|
+
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
|
161
|
+
display: flex;
|
|
162
|
+
justify-content: flex-end;
|
|
163
|
+
gap: 1rem;
|
|
164
|
+
}
|
|
165
|
+
</style>
|