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.
Files changed (114) hide show
  1. package/dist/NBadge.nexa +40 -0
  2. package/dist/NBottomSheet.nexa +124 -0
  3. package/dist/NButton.nexa +123 -0
  4. package/dist/NCard.nexa +74 -0
  5. package/dist/NInput.nexa +116 -0
  6. package/dist/NModal.nexa +165 -0
  7. package/dist/NSelect.nexa +169 -0
  8. package/dist/NToastContainer.nexa +86 -0
  9. package/dist/NTooltip.nexa +115 -0
  10. package/dist/components/NAlert.js +134 -0
  11. package/dist/components/NAlert.nexa +115 -0
  12. package/dist/components/NAutocomplete.js +94 -0
  13. package/dist/components/NAutocomplete.nexa +58 -0
  14. package/dist/components/NAvatar.js +75 -0
  15. package/dist/components/NAvatar.nexa +67 -0
  16. package/dist/components/NBadge.js +74 -0
  17. package/dist/components/NBadge.nexa +61 -0
  18. package/dist/components/NBottomSheet.js +149 -0
  19. package/dist/components/NBottomSheet.nexa +145 -0
  20. package/dist/components/NButton.js +284 -0
  21. package/dist/components/NButton.nexa +275 -0
  22. package/dist/components/NCard.js +117 -0
  23. package/dist/components/NCard.nexa +100 -0
  24. package/dist/components/NCheckbox.js +108 -0
  25. package/dist/components/NCheckbox.nexa +90 -0
  26. package/dist/components/NChips.js +72 -0
  27. package/dist/components/NChips.nexa +57 -0
  28. package/dist/components/NDataTable.js +252 -0
  29. package/dist/components/NDataTable.nexa +186 -0
  30. package/dist/components/NDatepicker.js +379 -0
  31. package/dist/components/NDatepicker.nexa +367 -0
  32. package/dist/components/NForm.js +132 -0
  33. package/dist/components/NForm.nexa +133 -0
  34. package/dist/components/NFormField.js +173 -0
  35. package/dist/components/NFormField.nexa +171 -0
  36. package/dist/components/NInput.js +311 -0
  37. package/dist/components/NInput.nexa +311 -0
  38. package/dist/components/NInputNumber.js +202 -0
  39. package/dist/components/NInputNumber.nexa +199 -0
  40. package/dist/components/NModal.js +221 -0
  41. package/dist/components/NModal.nexa +221 -0
  42. package/dist/components/NMultiSelect.js +156 -0
  43. package/dist/components/NMultiSelect.nexa +77 -0
  44. package/dist/components/NPaginator.js +117 -0
  45. package/dist/components/NPaginator.nexa +77 -0
  46. package/dist/components/NPassword.js +193 -0
  47. package/dist/components/NPassword.nexa +178 -0
  48. package/dist/components/NProgressBar.js +127 -0
  49. package/dist/components/NProgressBar.nexa +111 -0
  50. package/dist/components/NRadio.js +96 -0
  51. package/dist/components/NRadio.nexa +81 -0
  52. package/dist/components/NSelect.js +468 -0
  53. package/dist/components/NSelect.nexa +452 -0
  54. package/dist/components/NSkeleton.js +98 -0
  55. package/dist/components/NSkeleton.nexa +74 -0
  56. package/dist/components/NSwitch.js +92 -0
  57. package/dist/components/NSwitch.nexa +76 -0
  58. package/dist/components/NTabs.js +129 -0
  59. package/dist/components/NTabs.nexa +113 -0
  60. package/dist/components/NTag.js +108 -0
  61. package/dist/components/NTag.nexa +93 -0
  62. package/dist/components/NToastContainer.js +242 -0
  63. package/dist/components/NToastContainer.nexa +221 -0
  64. package/dist/components/NTooltip.js +163 -0
  65. package/dist/components/NTooltip.nexa +166 -0
  66. package/dist/components/NTreeMenu.js +151 -0
  67. package/dist/components/NTreeMenu.nexa +142 -0
  68. package/dist/index.d.ts +32 -0
  69. package/dist/index.js +34 -0
  70. package/dist/services/FloatingOverlay.d.ts +27 -0
  71. package/dist/services/FloatingOverlay.js +98 -0
  72. package/dist/services/FormValidation.d.ts +8 -0
  73. package/dist/services/FormValidation.js +46 -0
  74. package/dist/services/ToastService.d.ts +16 -0
  75. package/dist/services/ToastService.js +26 -0
  76. package/dist/styles/theme.d.ts +1 -0
  77. package/dist/styles/theme.js +144 -0
  78. package/package.json +32 -0
  79. package/src/components/NAlert.nexa +115 -0
  80. package/src/components/NAutocomplete.nexa +58 -0
  81. package/src/components/NAvatar.nexa +67 -0
  82. package/src/components/NBadge.nexa +61 -0
  83. package/src/components/NBottomSheet.nexa +145 -0
  84. package/src/components/NButton.nexa +275 -0
  85. package/src/components/NCard.nexa +100 -0
  86. package/src/components/NCheckbox.nexa +90 -0
  87. package/src/components/NChips.nexa +57 -0
  88. package/src/components/NDataTable.nexa +186 -0
  89. package/src/components/NDatepicker.nexa +367 -0
  90. package/src/components/NForm.nexa +133 -0
  91. package/src/components/NFormField.nexa +171 -0
  92. package/src/components/NInput.nexa +311 -0
  93. package/src/components/NInputNumber.nexa +199 -0
  94. package/src/components/NModal.nexa +221 -0
  95. package/src/components/NMultiSelect.nexa +77 -0
  96. package/src/components/NPaginator.nexa +77 -0
  97. package/src/components/NPassword.nexa +178 -0
  98. package/src/components/NProgressBar.nexa +111 -0
  99. package/src/components/NRadio.nexa +81 -0
  100. package/src/components/NSelect.nexa +452 -0
  101. package/src/components/NSkeleton.nexa +74 -0
  102. package/src/components/NSwitch.nexa +76 -0
  103. package/src/components/NTabs.nexa +113 -0
  104. package/src/components/NTag.nexa +93 -0
  105. package/src/components/NToastContainer.nexa +221 -0
  106. package/src/components/NTooltip.nexa +166 -0
  107. package/src/components/NTreeMenu.nexa +142 -0
  108. package/src/index.ts +36 -0
  109. package/src/services/FloatingOverlay.ts +133 -0
  110. package/src/services/FormValidation.ts +44 -0
  111. package/src/services/ToastService.ts +41 -0
  112. package/src/shims.d.ts +5 -0
  113. package/src/styles/theme.ts +146 -0
  114. package/src/styles/tokens.css +170 -0
@@ -0,0 +1,242 @@
1
+ import { useToast } from '../services/ToastService.js'
2
+ import { h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle, Teleport } from 'nexa-framework'
3
+
4
+ const _sfc_main = defineComponent({
5
+ __scopeId: 'data-v-8ac4158',
6
+ __hmrId: 'NToastContainer_nexa',
7
+ props: {
8
+ position: { type: String, default: 'top-right' }
9
+ },
10
+ setup(props, setupContext) {
11
+ const { emit, slots, slots: $slots } = setupContext
12
+ const { toasts, remove } = useToast()
13
+ const positionClass = `is-${props.position.replace('-', '-')}`
14
+ return { toasts, remove, positionClass, useToast, $slots }
15
+ }
16
+ })
17
+ // Injected render function
18
+ _sfc_main.render = function(ctx) {
19
+ const { toasts, remove, positionClass, useToast, $slots, position, Fragment: _ntc_Fragment, Teleport: _ntc_Teleport } = ctx
20
+ return h(_ntc_Teleport, { to: "body", "data-v-8ac4158": "" }, [
21
+ "\n ",
22
+ h('div', { class: ["n-toast-container", positionClass], "data-v-8ac4158": "" }, [
23
+ "\n ",
24
+ toasts.value.map((toast, index) =>
25
+ h('div', { class: ["n-toast", `is-${toast.type}`], key: toast.id, onClick: ($event) => { remove(toast.id) }, "data-v-8ac4158": "" }, [
26
+ "\n ",
27
+ h('div', { class: "n-toast-body", "data-v-8ac4158": "" }, [
28
+ "\n ",
29
+ h('span', { class: "n-toast-icon", "data-v-8ac4158": "" }, [
30
+ "\n ",
31
+ toast.type === 'success' ? '✓' : toast.type === 'error' ? '✕' : toast.type === 'warning' ? '⚡' : 'ℹ',
32
+ "\n "
33
+ ]),
34
+ "\n ",
35
+ h('span', { class: "n-toast-message", "data-v-8ac4158": "" }, [
36
+ toast.message
37
+ ]),
38
+ "\n ",
39
+ h('button', { class: "n-toast-dismiss", onClick: ($event) => { $event.stopPropagation(); (($event) => { remove(toast.id) })($event) }, "aria-label": "Dismiss", "data-v-8ac4158": "" }, [
40
+ "×"
41
+ ]),
42
+ "\n "
43
+ ]),
44
+ "\n ",
45
+ (toast.duration > 0) ? h('div', { class: "n-toast-progress", style: { animationDuration: toast.duration + 'ms' }, "data-v-8ac4158": "" }) : null
46
+ ])
47
+ ),
48
+ "\n "
49
+ ]),
50
+ "\n "
51
+ ])
52
+ }
53
+ _sfc_main.__scopeId = 'data-v-8ac4158'
54
+ _sfc_main.__hmrId = 'NToastContainer_nexa'
55
+
56
+ export default _sfc_main
57
+
58
+ const __style = `.n-toast-container[data-v-8ac4158]{
59
+ position: fixed;
60
+ z-index: var(--n-z-toast);
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: var(--n-space-3);
64
+ pointer-events: none;
65
+ padding: var(--n-space-4);
66
+ }
67
+
68
+ .is-top-right[data-v-8ac4158]{
69
+ top: 0;
70
+ right: 0;
71
+ align-items: flex-end;
72
+ }
73
+
74
+ .is-top-left[data-v-8ac4158]{
75
+ top: 0;
76
+ left: 0;
77
+ align-items: flex-start;
78
+ }
79
+
80
+ .is-bottom-right[data-v-8ac4158]{
81
+ bottom: 0;
82
+ right: 0;
83
+ align-items: flex-end;
84
+ flex-direction: column-reverse;
85
+ }
86
+
87
+ .is-bottom-left[data-v-8ac4158]{
88
+ bottom: 0;
89
+ left: 0;
90
+ align-items: flex-start;
91
+ flex-direction: column-reverse;
92
+ }
93
+
94
+ .is-top-center[data-v-8ac4158]{
95
+ top: 0;
96
+ left: 50%;
97
+ transform: translateX(-50%);
98
+ align-items: center;
99
+ }
100
+
101
+ .n-toast[data-v-8ac4158]{
102
+ pointer-events: auto;
103
+ min-width: 300px;
104
+ max-width: 420px;
105
+ background: var(--n-color-surface);
106
+ border: 1px solid var(--n-color-border);
107
+ border-radius: var(--n-radius-md);
108
+ overflow: hidden;
109
+ box-shadow: var(--n-shadow-lg);
110
+ cursor: pointer;
111
+ animation: n-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
112
+ transition: all var(--n-transition-fast);
113
+ }
114
+
115
+ .n-toast[data-v-8ac4158]:hover{
116
+ transform: scale(1.02);
117
+ background: var(--n-color-surface-alt);
118
+ }
119
+
120
+ @keyframes n-toast-in {
121
+ from[data-v-8ac4158]{
122
+ opacity: 0;
123
+ transform: translateX(30px) scale(0.95);
124
+ }
125
+ to[data-v-8ac4158]{
126
+ opacity: 1;
127
+ transform: translateX(0) scale(1);
128
+ }
129
+ }
130
+
131
+ .is-top-left .n-toast[data-v-8ac4158]{
132
+ animation-name: n-toast-in-left;
133
+ }
134
+
135
+ @keyframes n-toast-in-left {
136
+ from[data-v-8ac4158]{
137
+ opacity: 0;
138
+ transform: translateX(-30px) scale(0.95);
139
+ }
140
+ to[data-v-8ac4158]{
141
+ opacity: 1;
142
+ transform: translateX(0) scale(1);
143
+ }
144
+ }
145
+
146
+ .is-bottom-right .n-toast[data-v-8ac4158],
147
+ .is-bottom-left .n-toast[data-v-8ac4158]{
148
+ animation-name: n-toast-in-up;
149
+ }
150
+
151
+ @keyframes n-toast-in-up {
152
+ from[data-v-8ac4158]{
153
+ opacity: 0;
154
+ transform: translateY(20px) scale(0.95);
155
+ }
156
+ to[data-v-8ac4158]{
157
+ opacity: 1;
158
+ transform: translateY(0) scale(1);
159
+ }
160
+ }
161
+
162
+ .n-toast-body{
163
+ display: flex;
164
+ align-items: center;
165
+ gap: var(--n-space-3);
166
+ padding: var(--n-space-4) var(--n-space-5);
167
+ }
168
+
169
+ .n-toast-icon[data-v-8ac4158]{
170
+ width: 28px;
171
+ height: 28px;
172
+ border-radius: var(--n-radius-full);
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ font-size: var(--n-text-sm);
177
+ font-weight: var(--n-weight-extrabold);
178
+ flex-shrink: 0;
179
+ }
180
+
181
+ .is-success .n-toast-icon[data-v-8ac4158]{ background: var(--n-color-success); color: white; }
182
+ .is-error .n-toast-icon[data-v-8ac4158]{ background: var(--n-color-danger); color: white; }
183
+ .is-info .n-toast-icon[data-v-8ac4158]{ background: var(--n-color-primary); color: white; }
184
+ .is-warning .n-toast-icon[data-v-8ac4158]{ background: var(--n-color-warning); color: white; }
185
+
186
+ .n-toast-message[data-v-8ac4158]{
187
+ color: var(--n-color-text);
188
+ font-size: var(--n-text-sm);
189
+ font-weight: var(--n-weight-medium);
190
+ flex: 1;
191
+ line-height: var(--n-leading-normal);
192
+ }
193
+
194
+ .n-toast-dismiss[data-v-8ac4158]{
195
+ background: transparent;
196
+ border: none;
197
+ color: var(--n-color-text-muted);
198
+ font-size: var(--n-text-lg);
199
+ cursor: pointer;
200
+ padding: 0;
201
+ line-height: 1;
202
+ opacity: 0;
203
+ transition: opacity var(--n-transition-fast);
204
+ flex-shrink: 0;
205
+ }
206
+
207
+ .n-toast[data-v-8ac4158]:hover .n-toast-dismiss{
208
+ opacity: 1;
209
+ }
210
+
211
+ .n-toast-dismiss[data-v-8ac4158]:hover{
212
+ color: var(--n-color-text);
213
+ }
214
+
215
+ .n-toast-progress[data-v-8ac4158]{
216
+ height: 3px;
217
+ background: var(--n-color-border);
218
+ position: relative;
219
+ overflow: hidden;
220
+ }
221
+
222
+ .n-toast-progress[data-v-8ac4158]::after{
223
+ content: '';
224
+ position: absolute;
225
+ top: 0;
226
+ left: 0;
227
+ height: 100%;
228
+ width: 100%;
229
+ background: currentColor;
230
+ animation: n-toast-shrink linear forwards;
231
+ }
232
+
233
+ .is-success .n-toast-progress[data-v-8ac4158]::after{ background: var(--n-color-success); }
234
+ .is-error .n-toast-progress[data-v-8ac4158]::after{ background: var(--n-color-danger); }
235
+ .is-info .n-toast-progress[data-v-8ac4158]::after{ background: var(--n-color-primary); }
236
+ .is-warning .n-toast-progress[data-v-8ac4158]::after{ background: var(--n-color-warning); }
237
+
238
+ @keyframes n-toast-shrink {
239
+ from[data-v-8ac4158]{ transform: scaleX(1); }
240
+ to[data-v-8ac4158]{ transform: scaleX(0); }
241
+ }`
242
+ injectStyle('data-v-8ac4158', __style)
@@ -0,0 +1,221 @@
1
+ <script setup>
2
+ import { useToast } from '../services/ToastService.js'
3
+
4
+ const props = defineProps({
5
+ position: { type: String, default: 'top-right' }
6
+ })
7
+
8
+ const { toasts, remove } = useToast()
9
+
10
+ const positionClass = `is-${props.position.replace('-', '-')}`
11
+ </script>
12
+
13
+ <template>
14
+ <Teleport to="body">
15
+ <div class="n-toast-container" :class="positionClass">
16
+ <div
17
+ v-for="toast in toasts.value"
18
+ :key="toast.id"
19
+ class="n-toast"
20
+ :class="`is-${toast.type}`"
21
+ @click="remove(toast.id)"
22
+ >
23
+ <div class="n-toast-body">
24
+ <span class="n-toast-icon">
25
+ {{ toast.type === 'success' ? '✓' : toast.type === 'error' ? '✕' : toast.type === 'warning' ? '⚡' : 'ℹ' }}
26
+ </span>
27
+ <span class="n-toast-message">{{ toast.message }}</span>
28
+ <button class="n-toast-dismiss" @click.stop="remove(toast.id)" aria-label="Dismiss">&times;</button>
29
+ </div>
30
+ <div v-if="toast.duration > 0" class="n-toast-progress" :style="{ animationDuration: toast.duration + 'ms' }"></div>
31
+ </div>
32
+ </div>
33
+ </Teleport>
34
+ </template>
35
+
36
+ <style scoped>
37
+ .n-toast-container {
38
+ position: fixed;
39
+ z-index: var(--n-z-toast);
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: var(--n-space-3);
43
+ pointer-events: none;
44
+ padding: var(--n-space-4);
45
+ }
46
+
47
+ .is-top-right {
48
+ top: 0;
49
+ right: 0;
50
+ align-items: flex-end;
51
+ }
52
+
53
+ .is-top-left {
54
+ top: 0;
55
+ left: 0;
56
+ align-items: flex-start;
57
+ }
58
+
59
+ .is-bottom-right {
60
+ bottom: 0;
61
+ right: 0;
62
+ align-items: flex-end;
63
+ flex-direction: column-reverse;
64
+ }
65
+
66
+ .is-bottom-left {
67
+ bottom: 0;
68
+ left: 0;
69
+ align-items: flex-start;
70
+ flex-direction: column-reverse;
71
+ }
72
+
73
+ .is-top-center {
74
+ top: 0;
75
+ left: 50%;
76
+ transform: translateX(-50%);
77
+ align-items: center;
78
+ }
79
+
80
+ .n-toast {
81
+ pointer-events: auto;
82
+ min-width: 300px;
83
+ max-width: 420px;
84
+ background: var(--n-color-surface);
85
+ border: 1px solid var(--n-color-border);
86
+ border-radius: var(--n-radius-md);
87
+ overflow: hidden;
88
+ box-shadow: var(--n-shadow-lg);
89
+ cursor: pointer;
90
+ animation: n-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
91
+ transition: all var(--n-transition-fast);
92
+ }
93
+
94
+ .n-toast:hover {
95
+ transform: scale(1.02);
96
+ background: var(--n-color-surface-alt);
97
+ }
98
+
99
+ @keyframes n-toast-in {
100
+ from {
101
+ opacity: 0;
102
+ transform: translateX(30px) scale(0.95);
103
+ }
104
+ to {
105
+ opacity: 1;
106
+ transform: translateX(0) scale(1);
107
+ }
108
+ }
109
+
110
+ .is-top-left .n-toast {
111
+ animation-name: n-toast-in-left;
112
+ }
113
+
114
+ @keyframes n-toast-in-left {
115
+ from {
116
+ opacity: 0;
117
+ transform: translateX(-30px) scale(0.95);
118
+ }
119
+ to {
120
+ opacity: 1;
121
+ transform: translateX(0) scale(1);
122
+ }
123
+ }
124
+
125
+ .is-bottom-right .n-toast,
126
+ .is-bottom-left .n-toast {
127
+ animation-name: n-toast-in-up;
128
+ }
129
+
130
+ @keyframes n-toast-in-up {
131
+ from {
132
+ opacity: 0;
133
+ transform: translateY(20px) scale(0.95);
134
+ }
135
+ to {
136
+ opacity: 1;
137
+ transform: translateY(0) scale(1);
138
+ }
139
+ }
140
+
141
+ .n-toast-body {
142
+ display: flex;
143
+ align-items: center;
144
+ gap: var(--n-space-3);
145
+ padding: var(--n-space-4) var(--n-space-5);
146
+ }
147
+
148
+ .n-toast-icon {
149
+ width: 28px;
150
+ height: 28px;
151
+ border-radius: var(--n-radius-full);
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ font-size: var(--n-text-sm);
156
+ font-weight: var(--n-weight-extrabold);
157
+ flex-shrink: 0;
158
+ }
159
+
160
+ .is-success .n-toast-icon { background: var(--n-color-success); color: white; }
161
+ .is-error .n-toast-icon { background: var(--n-color-danger); color: white; }
162
+ .is-info .n-toast-icon { background: var(--n-color-primary); color: white; }
163
+ .is-warning .n-toast-icon { background: var(--n-color-warning); color: white; }
164
+
165
+ .n-toast-message {
166
+ color: var(--n-color-text);
167
+ font-size: var(--n-text-sm);
168
+ font-weight: var(--n-weight-medium);
169
+ flex: 1;
170
+ line-height: var(--n-leading-normal);
171
+ }
172
+
173
+ .n-toast-dismiss {
174
+ background: transparent;
175
+ border: none;
176
+ color: var(--n-color-text-muted);
177
+ font-size: var(--n-text-lg);
178
+ cursor: pointer;
179
+ padding: 0;
180
+ line-height: 1;
181
+ opacity: 0;
182
+ transition: opacity var(--n-transition-fast);
183
+ flex-shrink: 0;
184
+ }
185
+
186
+ .n-toast:hover .n-toast-dismiss {
187
+ opacity: 1;
188
+ }
189
+
190
+ .n-toast-dismiss:hover {
191
+ color: var(--n-color-text);
192
+ }
193
+
194
+ .n-toast-progress {
195
+ height: 3px;
196
+ background: var(--n-color-border);
197
+ position: relative;
198
+ overflow: hidden;
199
+ }
200
+
201
+ .n-toast-progress::after {
202
+ content: '';
203
+ position: absolute;
204
+ top: 0;
205
+ left: 0;
206
+ height: 100%;
207
+ width: 100%;
208
+ background: currentColor;
209
+ animation: n-toast-shrink linear forwards;
210
+ }
211
+
212
+ .is-success .n-toast-progress::after { background: var(--n-color-success); }
213
+ .is-error .n-toast-progress::after { background: var(--n-color-danger); }
214
+ .is-info .n-toast-progress::after { background: var(--n-color-primary); }
215
+ .is-warning .n-toast-progress::after { background: var(--n-color-warning); }
216
+
217
+ @keyframes n-toast-shrink {
218
+ from { transform: scaleX(1); }
219
+ to { transform: scaleX(0); }
220
+ }
221
+ </style>
@@ -0,0 +1,163 @@
1
+ import { signal, h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle, Teleport } from 'nexa-framework'
2
+ import { trackFloatingOverlay } from '../services/FloatingOverlay.js'
3
+
4
+ const _sfc_main = defineComponent({
5
+ __scopeId: 'data-v-522b965d',
6
+ __hmrId: 'NTooltip_nexa',
7
+ props: {
8
+ text: { type: String, default: '' },
9
+ position: { type: String, default: 'top' },
10
+ delay: { type: Number, default: 200 },
11
+ hideDelay: { type: Number, default: 100 }
12
+ },
13
+ setup(props, setupContext) {
14
+ const { emit, slots, slots: $slots } = setupContext
15
+ const isVisible = signal(false)
16
+ const instanceId = `n-tt-${Math.random().toString(16).slice(2)}`
17
+ const popupStyle = signal({})
18
+ const resolvedPlacement = signal('top')
19
+ const rootEl = signal(null)
20
+ let stopTracking = null
21
+ let showTimer = null
22
+ let hideTimer = null
23
+ const startTracking = () => {
24
+ if (stopTracking) stopTracking()
25
+ stopTracking = trackFloatingOverlay({
26
+ isOpen: () => isVisible.value,
27
+ getAnchor: () => rootEl.value,
28
+ getPopup: () => document.querySelector(`[data-tooltip-popup="${instanceId}"]`),
29
+ placement: props.position,
30
+ align: 'center',
31
+ matchWidth: false,
32
+ minWidth: 0,
33
+ gap: 8,
34
+ margin: 8,
35
+ zIndex: 1000,
36
+ onUpdate: (result) => {
37
+ popupStyle.value = result.style
38
+ resolvedPlacement.value = result.placement
39
+ },
40
+ })
41
+ }
42
+ const stop = () => {
43
+ if (stopTracking) {
44
+ stopTracking()
45
+ stopTracking = null
46
+ }
47
+ }
48
+ const show = (e) => {
49
+ clearTimeout(hideTimer)
50
+ const target = e?.currentTarget || e?.target
51
+ rootEl.value = target?.closest ? target.closest(`[data-tooltip-root="${instanceId}"]`) : null
52
+ showTimer = setTimeout(() => {
53
+ isVisible.value = true
54
+ requestAnimationFrame(() => startTracking())
55
+ }, props.delay)
56
+ }
57
+ const hide = () => {
58
+ clearTimeout(showTimer)
59
+ hideTimer = setTimeout(() => {
60
+ isVisible.value = false
61
+ stop()
62
+ }, props.hideDelay)
63
+ }
64
+ return { isVisible, instanceId, popupStyle, resolvedPlacement, rootEl, stopTracking, showTimer, hideTimer, startTracking, stop, show, hide, trackFloatingOverlay, $slots }
65
+ }
66
+ })
67
+ // Injected render function
68
+ _sfc_main.render = function(ctx) {
69
+ const { isVisible, instanceId, popupStyle, resolvedPlacement, rootEl, stopTracking, showTimer, hideTimer, startTracking, stop, show, hide, trackFloatingOverlay, $slots, text, position, delay, hideDelay, Fragment: _ntc_Fragment, Teleport: _ntc_Teleport } = ctx
70
+ return h('div', { class: "n-tooltip-wrapper", "data-tooltip-root": instanceId, onMouseenter: show, onMouseleave: hide, onFocusin: show, onFocusout: hide, "data-v-522b965d": "" }, [
71
+ "\n ",
72
+ ctx.$slots.default ? ctx.$slots.default() : null,
73
+ "\n ",
74
+ h(_ntc_Teleport, { to: "body", "data-v-522b965d": "" }, [
75
+ "\n ",
76
+ (isVisible.value) ? h('div', { class: ["n-tooltip", `is-${resolvedPlacement.value}`], role: "tooltip", "data-tooltip-popup": instanceId, style: popupStyle.value, "data-v-522b965d": "" }, [
77
+ "\n ",
78
+ text,
79
+ "\n "
80
+ ]) : null
81
+ ]),
82
+ "\n "
83
+ ])
84
+ }
85
+ _sfc_main.__scopeId = 'data-v-522b965d'
86
+ _sfc_main.__hmrId = 'NTooltip_nexa'
87
+
88
+ export default _sfc_main
89
+
90
+ const __style = `.n-tooltip-wrapper[data-v-522b965d]{
91
+ display: inline-block;
92
+ }
93
+
94
+ .n-tooltip[data-v-522b965d]{
95
+ background: var(--n-color-bg);
96
+ color: var(--n-color-text);
97
+ padding: var(--n-space-2) var(--n-space-3);
98
+ border-radius: var(--n-radius-sm);
99
+ font-size: var(--n-text-xs);
100
+ font-weight: var(--n-weight-medium);
101
+ white-space: nowrap;
102
+ z-index: var(--n-z-tooltip);
103
+ box-shadow: var(--n-shadow-lg);
104
+ border: 1px solid var(--n-color-border);
105
+ pointer-events: none;
106
+ animation: n-tooltip-in 0.2s ease-out;
107
+ }
108
+
109
+ @keyframes n-tooltip-in {
110
+ from[data-v-522b965d]{ opacity: 0; transform: scale(0.95); }
111
+ to[data-v-522b965d]{ opacity: 1; transform: scale(1); }
112
+ }
113
+
114
+ .is-top[data-v-522b965d]{
115
+ transform-origin: bottom center;
116
+ }
117
+
118
+ .is-bottom[data-v-522b965d]{
119
+ transform-origin: top center;
120
+ }
121
+
122
+ .is-left[data-v-522b965d]{
123
+ transform-origin: center right;
124
+ }
125
+
126
+ .is-right[data-v-522b965d]{
127
+ transform-origin: center left;
128
+ }
129
+
130
+ .n-tooltip[data-v-522b965d]::after{
131
+ content: '';
132
+ position: absolute;
133
+ border: 5px solid transparent;
134
+ }
135
+
136
+ .is-top[data-v-522b965d]::after{
137
+ top: 100%;
138
+ left: 50%;
139
+ transform: translateX(-50%);
140
+ border-top-color: var(--n-color-border);
141
+ }
142
+
143
+ .is-bottom[data-v-522b965d]::after{
144
+ bottom: 100%;
145
+ left: 50%;
146
+ transform: translateX(-50%);
147
+ border-bottom-color: var(--n-color-border);
148
+ }
149
+
150
+ .is-left[data-v-522b965d]::after{
151
+ left: 100%;
152
+ top: 50%;
153
+ transform: translateY(-50%);
154
+ border-left-color: var(--n-color-border);
155
+ }
156
+
157
+ .is-right[data-v-522b965d]::after{
158
+ right: 100%;
159
+ top: 50%;
160
+ transform: translateY(-50%);
161
+ border-right-color: var(--n-color-border);
162
+ }`
163
+ injectStyle('data-v-522b965d', __style)