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
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
snapPoints: { type: Array, default: () => [50, 80] }
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['close'])
|
|
11
|
+
|
|
12
|
+
const yOffset = signal(0)
|
|
13
|
+
const isDragging = signal(false)
|
|
14
|
+
const currentSnap = signal(0)
|
|
15
|
+
let gestures = null
|
|
16
|
+
|
|
17
|
+
const sortedPoints = computed(() =>
|
|
18
|
+
[...props.snapPoints].sort((a, b) => a - b)
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
onMounted(() => {
|
|
22
|
+
const el = document.getElementById('n-bottom-sheet-content')
|
|
23
|
+
if (el) {
|
|
24
|
+
gestures = useGestures(el)
|
|
25
|
+
|
|
26
|
+
effect(() => {
|
|
27
|
+
if (gestures.isSwiping.value && gestures.swipeDirection.value === 'down') {
|
|
28
|
+
isDragging.value = true
|
|
29
|
+
yOffset.value = Math.max(0, gestures.deltaY.value)
|
|
30
|
+
} else if (!gestures.isPressed.value) {
|
|
31
|
+
if (isDragging.value) {
|
|
32
|
+
isDragging.value = false
|
|
33
|
+
const maxSnap = sortedPoints.value[sortedPoints.value.length - 1]
|
|
34
|
+
const threshold = window.innerHeight * (maxSnap / 100) * 0.3
|
|
35
|
+
if (yOffset.value > threshold) {
|
|
36
|
+
emit('close')
|
|
37
|
+
yOffset.value = 0
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
yOffset.value = 0
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
gestures?.destroy()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const translateY = computed(() => {
|
|
52
|
+
if (!props.show) return '100%'
|
|
53
|
+
const base = window.innerHeight * (1 - sortedPoints.value[currentSnap.value] / 100)
|
|
54
|
+
return `${base + yOffset.value}px`
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const overlayOpacity = computed(() => {
|
|
58
|
+
if (!props.show) return 0
|
|
59
|
+
const progress = 1 - (yOffset.value / (window.innerHeight * 0.5))
|
|
60
|
+
return Math.max(0, Math.min(1, progress))
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<Teleport to="body">
|
|
66
|
+
<div class="n-bottom-sheet-root" :class="{ 'is-active': show || isDragging.value }">
|
|
67
|
+
<div
|
|
68
|
+
class="n-bottom-sheet-overlay"
|
|
69
|
+
:style="{ opacity: overlayOpacity.value }"
|
|
70
|
+
@click="emit('close')"
|
|
71
|
+
></div>
|
|
72
|
+
<div
|
|
73
|
+
id="n-bottom-sheet-content"
|
|
74
|
+
class="n-bottom-sheet-container"
|
|
75
|
+
:style="{
|
|
76
|
+
transform: `translateY(${translateY.value})`,
|
|
77
|
+
transition: isDragging.value ? 'none' : 'transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)'
|
|
78
|
+
}"
|
|
79
|
+
>
|
|
80
|
+
<div class="n-bottom-sheet-handle"></div>
|
|
81
|
+
<div class="n-bottom-sheet-inner">
|
|
82
|
+
<slot />
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</Teleport>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<style scoped>
|
|
90
|
+
.n-bottom-sheet-root {
|
|
91
|
+
position: fixed;
|
|
92
|
+
top: 0;
|
|
93
|
+
left: 0;
|
|
94
|
+
width: 100vw;
|
|
95
|
+
height: 100vh;
|
|
96
|
+
z-index: var(--n-z-modal);
|
|
97
|
+
pointer-events: none;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: flex-end;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.n-bottom-sheet-root.is-active {
|
|
103
|
+
pointer-events: auto;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.n-bottom-sheet-overlay {
|
|
107
|
+
position: absolute;
|
|
108
|
+
top: 0;
|
|
109
|
+
left: 0;
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 100%;
|
|
112
|
+
background: var(--n-color-overlay);
|
|
113
|
+
backdrop-filter: blur(4px);
|
|
114
|
+
transition: opacity 0.3s ease;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.n-bottom-sheet-container {
|
|
118
|
+
position: relative;
|
|
119
|
+
width: 100%;
|
|
120
|
+
max-height: 90vh;
|
|
121
|
+
background: var(--n-color-surface);
|
|
122
|
+
border-top: 1px solid var(--n-color-border);
|
|
123
|
+
border-radius: var(--n-radius-2xl) var(--n-radius-2xl) 0 0;
|
|
124
|
+
box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.3);
|
|
125
|
+
padding-bottom: env(safe-area-inset-bottom, 20px);
|
|
126
|
+
touch-action: none;
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.n-bottom-sheet-handle {
|
|
132
|
+
width: 40px;
|
|
133
|
+
height: 4px;
|
|
134
|
+
background: var(--n-color-surface-hover);
|
|
135
|
+
border-radius: var(--n-radius-full);
|
|
136
|
+
margin: var(--n-space-3) auto;
|
|
137
|
+
flex-shrink: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.n-bottom-sheet-inner {
|
|
141
|
+
padding: var(--n-space-4) var(--n-space-8) var(--n-space-8);
|
|
142
|
+
overflow-y: auto;
|
|
143
|
+
flex: 1;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { signal, computed } from 'nexa-framework'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
variant: { type: String, default: 'primary' },
|
|
6
|
+
size: { type: String, default: 'md' },
|
|
7
|
+
type: { type: String, default: 'button' },
|
|
8
|
+
disabled: { type: Boolean, default: false },
|
|
9
|
+
loading: { type: Boolean, default: false },
|
|
10
|
+
block: { type: Boolean, default: false },
|
|
11
|
+
rounded: { type: Boolean, default: false },
|
|
12
|
+
loadingText: { type: String, default: '' }
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits(['click'])
|
|
16
|
+
|
|
17
|
+
const ripple = signal([])
|
|
18
|
+
|
|
19
|
+
const handleClick = (e) => {
|
|
20
|
+
if (props.disabled || props.loading) return
|
|
21
|
+
props.onClick?.(e)
|
|
22
|
+
emit('click', e)
|
|
23
|
+
const rect = e.currentTarget.getBoundingClientRect()
|
|
24
|
+
const x = e.clientX - rect.left
|
|
25
|
+
const y = e.clientY - rect.top
|
|
26
|
+
const id = Date.now()
|
|
27
|
+
ripple.value = [...ripple.value, { id, x, y }]
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
ripple.value = ripple.value.filter(r => r.id !== id)
|
|
30
|
+
}, 600)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const btnClass = computed(() => {
|
|
34
|
+
return [
|
|
35
|
+
'n-btn',
|
|
36
|
+
`n-btn-${props.variant}`,
|
|
37
|
+
`n-btn-${props.size}`,
|
|
38
|
+
props.loading ? 'is-loading' : '',
|
|
39
|
+
props.block ? 'is-block' : '',
|
|
40
|
+
props.rounded ? 'is-rounded' : ''
|
|
41
|
+
].join(' ')
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<button
|
|
47
|
+
:class="btnClass.value"
|
|
48
|
+
:type="type"
|
|
49
|
+
:disabled="disabled || loading"
|
|
50
|
+
@click="handleClick"
|
|
51
|
+
>
|
|
52
|
+
<span v-if="loading" class="n-btn-loader"></span>
|
|
53
|
+
<span v-if="loading && loadingText" class="n-btn-loading-text">{{ loadingText }}</span>
|
|
54
|
+
<span v-if="!loading || (loading && !loadingText)" class="n-btn-content">
|
|
55
|
+
<slot />
|
|
56
|
+
</span>
|
|
57
|
+
<span v-for="r in ripple.value" :key="r.id" class="n-btn-ripple" :style="{ left: r.x + 'px', top: r.y + 'px' }"></span>
|
|
58
|
+
</button>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<style scoped>
|
|
62
|
+
.n-btn {
|
|
63
|
+
position: relative;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
gap: var(--n-space-2);
|
|
68
|
+
font-family: var(--n-font-sans);
|
|
69
|
+
font-weight: var(--n-weight-semibold);
|
|
70
|
+
border-radius: var(--n-radius-md);
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
transition: all var(--n-transition-normal);
|
|
73
|
+
border: 1px solid transparent;
|
|
74
|
+
outline: none;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
user-select: none;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
text-decoration: none;
|
|
79
|
+
line-height: var(--n-leading-normal, 1.5);
|
|
80
|
+
min-width: fit-content;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.n-btn:focus-visible {
|
|
84
|
+
box-shadow: 0 0 0 3px var(--n-color-primary-light);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Sizes */
|
|
88
|
+
.n-btn-sm { padding: 0.5rem 1.25rem; font-size: var(--n-text-sm); gap: var(--n-space-1); border-radius: var(--n-radius-sm); min-height: 32px; }
|
|
89
|
+
.n-btn-md { padding: 0.65rem 1.75rem; font-size: var(--n-text-base); min-height: 40px; }
|
|
90
|
+
.n-btn-lg { padding: 0.85rem 2.5rem; font-size: var(--n-text-lg); border-radius: var(--n-radius-lg); min-height: 48px; }
|
|
91
|
+
|
|
92
|
+
/* Block */
|
|
93
|
+
.is-block { width: 100%; }
|
|
94
|
+
|
|
95
|
+
/* Rounded */
|
|
96
|
+
.is-rounded { border-radius: var(--n-radius-full); }
|
|
97
|
+
|
|
98
|
+
/* Variant: Primary */
|
|
99
|
+
.n-btn-primary {
|
|
100
|
+
background: linear-gradient(135deg, var(--n-color-primary) 0%, var(--n-color-primary-hover) 100%);
|
|
101
|
+
color: white;
|
|
102
|
+
box-shadow: var(--n-shadow-glow-primary);
|
|
103
|
+
}
|
|
104
|
+
.n-btn-primary:hover:not(:disabled) {
|
|
105
|
+
transform: translateY(-2px);
|
|
106
|
+
box-shadow: 0 8px 20px -3px var(--n-color-primary-glow);
|
|
107
|
+
}
|
|
108
|
+
.n-btn-primary:active:not(:disabled) {
|
|
109
|
+
transform: translateY(0) scale(0.97);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Variant: Secondary */
|
|
113
|
+
.n-btn-secondary {
|
|
114
|
+
background: var(--n-color-surface-alt);
|
|
115
|
+
color: var(--n-color-text);
|
|
116
|
+
border-color: var(--n-color-border);
|
|
117
|
+
}
|
|
118
|
+
.n-btn-secondary:hover:not(:disabled) {
|
|
119
|
+
background: var(--n-color-surface-hover);
|
|
120
|
+
border-color: var(--n-color-border-hover);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Variant: Success */
|
|
124
|
+
.n-btn-success {
|
|
125
|
+
background: linear-gradient(135deg, var(--n-color-success) 0%, var(--n-color-success-hover) 100%);
|
|
126
|
+
color: white;
|
|
127
|
+
box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.3);
|
|
128
|
+
}
|
|
129
|
+
.n-btn-success:hover:not(:disabled) {
|
|
130
|
+
transform: translateY(-2px);
|
|
131
|
+
box-shadow: 0 8px 20px -3px rgba(16, 185, 129, 0.4);
|
|
132
|
+
}
|
|
133
|
+
.n-btn-success:active:not(:disabled) {
|
|
134
|
+
transform: translateY(0) scale(0.97);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Variant: Warning */
|
|
138
|
+
.n-btn-warning {
|
|
139
|
+
background: linear-gradient(135deg, var(--n-color-warning) 0%, var(--n-color-warning-hover) 100%);
|
|
140
|
+
color: white;
|
|
141
|
+
box-shadow: 0 4px 12px -2px rgba(245, 158, 11, 0.3);
|
|
142
|
+
}
|
|
143
|
+
.n-btn-warning:hover:not(:disabled) {
|
|
144
|
+
transform: translateY(-2px);
|
|
145
|
+
box-shadow: 0 8px 20px -3px rgba(245, 158, 11, 0.4);
|
|
146
|
+
}
|
|
147
|
+
.n-btn-warning:active:not(:disabled) {
|
|
148
|
+
transform: translateY(0) scale(0.97);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* Variant: Info */
|
|
152
|
+
.n-btn-info {
|
|
153
|
+
background: linear-gradient(135deg, var(--n-color-info) 0%, var(--n-color-info-hover) 100%);
|
|
154
|
+
color: white;
|
|
155
|
+
box-shadow: 0 4px 12px -2px rgba(6, 182, 212, 0.3);
|
|
156
|
+
}
|
|
157
|
+
.n-btn-info:hover:not(:disabled) {
|
|
158
|
+
transform: translateY(-2px);
|
|
159
|
+
box-shadow: 0 8px 20px -3px rgba(6, 182, 212, 0.4);
|
|
160
|
+
}
|
|
161
|
+
.n-btn-info:active:not(:disabled) {
|
|
162
|
+
transform: translateY(0) scale(0.97);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Variant: Danger */
|
|
166
|
+
.n-btn-danger {
|
|
167
|
+
background: linear-gradient(135deg, var(--n-color-danger) 0%, var(--n-color-danger-hover) 100%);
|
|
168
|
+
color: white;
|
|
169
|
+
box-shadow: 0 4px 12px -2px rgba(239, 68, 68, 0.3);
|
|
170
|
+
}
|
|
171
|
+
.n-btn-danger:hover:not(:disabled) {
|
|
172
|
+
transform: translateY(-2px);
|
|
173
|
+
box-shadow: 0 8px 20px -3px rgba(220, 38, 38, 0.4);
|
|
174
|
+
}
|
|
175
|
+
.n-btn-danger:active:not(:disabled) {
|
|
176
|
+
transform: translateY(0) scale(0.97);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Variant: Ghost */
|
|
180
|
+
.n-btn-ghost {
|
|
181
|
+
background: transparent;
|
|
182
|
+
color: var(--n-color-text-secondary);
|
|
183
|
+
}
|
|
184
|
+
.n-btn-ghost:hover:not(:disabled) {
|
|
185
|
+
background: var(--n-color-glass);
|
|
186
|
+
color: var(--n-color-text);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Variant: Outline */
|
|
190
|
+
.n-btn-outline {
|
|
191
|
+
background: transparent;
|
|
192
|
+
color: var(--n-color-primary);
|
|
193
|
+
border-color: var(--n-color-primary);
|
|
194
|
+
}
|
|
195
|
+
.n-btn-outline:hover:not(:disabled) {
|
|
196
|
+
background: var(--n-color-primary-light);
|
|
197
|
+
border-color: var(--n-color-primary-hover);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Variant: Glass */
|
|
201
|
+
.n-btn-glass {
|
|
202
|
+
background: var(--n-color-glass);
|
|
203
|
+
backdrop-filter: blur(10px);
|
|
204
|
+
border-color: var(--n-color-glass-border);
|
|
205
|
+
color: var(--n-color-text);
|
|
206
|
+
}
|
|
207
|
+
.n-btn-glass:hover:not(:disabled) {
|
|
208
|
+
background: var(--n-color-glass-hover);
|
|
209
|
+
border-color: var(--n-color-border-hover);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* Disabled */
|
|
213
|
+
.n-btn:disabled {
|
|
214
|
+
opacity: 0.45;
|
|
215
|
+
cursor: not-allowed;
|
|
216
|
+
transform: none !important;
|
|
217
|
+
box-shadow: none !important;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Loader */
|
|
221
|
+
.n-btn-loader {
|
|
222
|
+
width: 1rem;
|
|
223
|
+
height: 1rem;
|
|
224
|
+
border: 2px solid currentColor;
|
|
225
|
+
border-right-color: transparent;
|
|
226
|
+
border-radius: var(--n-radius-full);
|
|
227
|
+
animation: n-spin 0.7s linear infinite;
|
|
228
|
+
flex-shrink: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.n-btn-lg .n-btn-loader {
|
|
232
|
+
width: 1.25rem;
|
|
233
|
+
height: 1.25rem;
|
|
234
|
+
border-width: 2.5px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.n-btn-sm .n-btn-loader {
|
|
238
|
+
width: 0.85rem;
|
|
239
|
+
height: 0.85rem;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.n-btn-loading-text {
|
|
243
|
+
opacity: 0.8;
|
|
244
|
+
font-weight: var(--n-weight-normal);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.n-btn-content {
|
|
248
|
+
display: inline-flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
gap: var(--n-space-2);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@keyframes n-spin {
|
|
254
|
+
from { transform: rotate(0deg); }
|
|
255
|
+
to { transform: rotate(360deg); }
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Ripple */
|
|
259
|
+
.n-btn-ripple {
|
|
260
|
+
position: absolute;
|
|
261
|
+
border-radius: var(--n-radius-full);
|
|
262
|
+
background: rgba(255, 255, 255, 0.35);
|
|
263
|
+
width: 20px;
|
|
264
|
+
height: 20px;
|
|
265
|
+
margin-left: -10px;
|
|
266
|
+
margin-top: -10px;
|
|
267
|
+
pointer-events: none;
|
|
268
|
+
animation: n-ripple 0.6s ease-out forwards;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
@keyframes n-ripple {
|
|
272
|
+
from { transform: scale(0); opacity: 1; }
|
|
273
|
+
to { transform: scale(8); opacity: 0; }
|
|
274
|
+
}
|
|
275
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
variant: { type: String, default: 'elevated' },
|
|
8
|
+
image: { type: String, default: '' }
|
|
9
|
+
})
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div :class="['n-card', `is-${variant}`, hoverable ? 'is-hoverable' : '']">
|
|
14
|
+
<img v-if="image" :src="image" class="n-card-image" />
|
|
15
|
+
<div v-if="title || $slots.header" class="n-card-header">
|
|
16
|
+
<slot name="header">
|
|
17
|
+
<h3 v-if="title" class="n-card-title">{{ title }}</h3>
|
|
18
|
+
<p v-if="subtitle" class="n-card-subtitle">{{ subtitle }}</p>
|
|
19
|
+
</slot>
|
|
20
|
+
</div>
|
|
21
|
+
<div :class="['n-card-body', padding ? 'has-padding' : '']">
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
<div v-if="$slots.footer" class="n-card-footer">
|
|
25
|
+
<slot name="footer" />
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<style scoped>
|
|
31
|
+
.n-card {
|
|
32
|
+
background: var(--n-color-surface);
|
|
33
|
+
border: 1px solid var(--n-color-border);
|
|
34
|
+
border-radius: var(--n-radius-xl);
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
transition: all var(--n-transition-normal);
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.is-elevated {
|
|
42
|
+
background: var(--n-color-surface-elevated);
|
|
43
|
+
box-shadow: var(--n-shadow-lg);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.is-outlined {
|
|
47
|
+
background: transparent;
|
|
48
|
+
border-color: var(--n-color-border);
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.is-flat {
|
|
53
|
+
background: var(--n-color-surface-alt);
|
|
54
|
+
border: none;
|
|
55
|
+
box-shadow: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.n-card.is-hoverable:hover {
|
|
59
|
+
transform: translateY(-4px);
|
|
60
|
+
border-color: var(--n-color-border-hover);
|
|
61
|
+
box-shadow: var(--n-shadow-xl);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.n-card-image {
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 200px;
|
|
67
|
+
object-fit: cover;
|
|
68
|
+
display: block;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.n-card-header {
|
|
72
|
+
padding: var(--n-space-6);
|
|
73
|
+
border-bottom: 1px solid var(--n-color-border);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.n-card-title {
|
|
77
|
+
margin: 0;
|
|
78
|
+
font-size: var(--n-text-xl);
|
|
79
|
+
font-weight: var(--n-weight-bold);
|
|
80
|
+
color: var(--n-color-text);
|
|
81
|
+
letter-spacing: var(--n-tracking-tight);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.n-card-subtitle {
|
|
85
|
+
margin: var(--n-space-1) 0 0 0;
|
|
86
|
+
font-size: var(--n-text-sm);
|
|
87
|
+
color: var(--n-color-text-secondary);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.n-card-body.has-padding {
|
|
91
|
+
padding: var(--n-space-6);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.n-card-footer {
|
|
95
|
+
padding: var(--n-space-4) var(--n-space-6);
|
|
96
|
+
background: rgba(0, 0, 0, 0.15);
|
|
97
|
+
border-top: 1px solid var(--n-color-border);
|
|
98
|
+
margin-top: auto;
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
modelValue: { type: Boolean, default: false },
|
|
4
|
+
label: { type: String, default: '' },
|
|
5
|
+
disabled: { type: Boolean, default: false },
|
|
6
|
+
indeterminate: { type: Boolean, default: false }
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['update:modelValue'])
|
|
10
|
+
|
|
11
|
+
const toggle = () => {
|
|
12
|
+
if (props.disabled) return
|
|
13
|
+
emit('update:modelValue', !props.modelValue)
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<label class="n-checkbox" :class="{ 'is-checked': modelValue && !indeterminate, 'is-indeterminate': indeterminate, 'is-disabled': disabled }">
|
|
19
|
+
<div class="n-checkbox-box" @click="toggle">
|
|
20
|
+
<span class="n-checkbox-icon">
|
|
21
|
+
{{ indeterminate ? '–' : '✓' }}
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<span v-if="label" class="n-checkbox-label">{{ label }}</span>
|
|
25
|
+
</label>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
.n-checkbox {
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: var(--n-space-3);
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
user-select: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.n-checkbox-box {
|
|
38
|
+
width: 20px;
|
|
39
|
+
height: 20px;
|
|
40
|
+
border: 2px solid var(--n-color-border);
|
|
41
|
+
border-radius: var(--n-radius-sm);
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
transition: all var(--n-transition-fast);
|
|
46
|
+
flex-shrink: 0;
|
|
47
|
+
background: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.is-checked .n-checkbox-box {
|
|
51
|
+
background: var(--n-color-primary);
|
|
52
|
+
border-color: var(--n-color-primary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.is-indeterminate .n-checkbox-box {
|
|
56
|
+
background: var(--n-color-primary);
|
|
57
|
+
border-color: var(--n-color-primary);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.n-checkbox-icon {
|
|
61
|
+
color: white;
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
font-weight: var(--n-weight-bold);
|
|
64
|
+
line-height: 1;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
transform: scale(0);
|
|
67
|
+
transition: all var(--n-transition-fast);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.is-checked .n-checkbox-icon,
|
|
71
|
+
.is-indeterminate .n-checkbox-icon {
|
|
72
|
+
opacity: 1;
|
|
73
|
+
transform: scale(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.n-checkbox-label {
|
|
77
|
+
font-size: var(--n-text-sm);
|
|
78
|
+
color: var(--n-color-text);
|
|
79
|
+
font-weight: var(--n-weight-medium);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.is-disabled {
|
|
83
|
+
opacity: 0.5;
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.n-checkbox:hover:not(.is-disabled) .n-checkbox-box {
|
|
88
|
+
border-color: var(--n-color-primary);
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'nexa-framework'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
modelValue: { type: Array, default: () => [] },
|
|
6
|
+
removable: { type: Boolean, default: false },
|
|
7
|
+
disabled: { type: Boolean, default: false }
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['update:modelValue', 'remove'])
|
|
11
|
+
|
|
12
|
+
const resolvedModel = computed(() => {
|
|
13
|
+
const v = props.modelValue
|
|
14
|
+
if (v && typeof v === 'object' && 'value' in v) return v.value
|
|
15
|
+
return v
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const normalize = (item) => {
|
|
19
|
+
if (item == null) return { label: '', value: item }
|
|
20
|
+
if (typeof item === 'string' || typeof item === 'number') return { label: String(item), value: item }
|
|
21
|
+
if (typeof item === 'object') {
|
|
22
|
+
const label = 'label' in item ? String(item.label) : String(item.value ?? '')
|
|
23
|
+
const value = 'value' in item ? item.value : label
|
|
24
|
+
return { label, value }
|
|
25
|
+
}
|
|
26
|
+
return { label: String(item), value: item }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const chips = computed(() => {
|
|
30
|
+
const v = resolvedModel.value
|
|
31
|
+
const list = Array.isArray(v) ? v : []
|
|
32
|
+
return list.map(normalize)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const removeAt = (index) => {
|
|
36
|
+
if (props.disabled) return
|
|
37
|
+
if (!props.removable) return
|
|
38
|
+
const v = resolvedModel.value
|
|
39
|
+
const current = Array.isArray(v) ? v : []
|
|
40
|
+
const next = current.filter((_v, i) => i !== index)
|
|
41
|
+
emit('update:modelValue', next)
|
|
42
|
+
emit('remove', { index })
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<div class="n-chips" :class="{ 'is-disabled': disabled }">
|
|
48
|
+
<div v-for="(chip, i) in chips.value" :key="String(chip.value) + ':' + i" class="n-chip">
|
|
49
|
+
<span class="n-chip-label">{{ chip.label }}</span>
|
|
50
|
+
<button v-if="removable" type="button" class="n-chip-remove" :disabled="disabled" aria-label="Remove" @click="removeAt(i)">✕</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.n-chips{display:flex;flex-wrap:wrap;gap:var(--n-space-2);align-items:center}.n-chip{display:inline-flex;align-items:center;gap:0.35rem;padding:0.25rem 0.5rem;border-radius:999px;background:var(--n-color-glass);border:1px solid var(--n-color-border);color:var(--n-color-text);font-size:var(--n-text-xs);line-height:1}.n-chip-remove{background:transparent;border:none;color:var(--n-color-text-muted);cursor:pointer;padding:0;border-radius:var(--n-radius-sm);line-height:1;display:flex;align-items:center}.n-chip-remove:hover:not(:disabled){color:var(--n-color-text)}.n-chip-remove:disabled{opacity:0.5;cursor:not-allowed}.is-disabled{opacity:0.6}
|
|
57
|
+
</style>
|