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,117 @@
1
+ import { h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle } from 'nexa-framework'
2
+
3
+ const _sfc_main = defineComponent({
4
+ __scopeId: 'data-v-34850782',
5
+ __hmrId: 'NCard_nexa',
6
+ props: {
7
+ title: { type: String, default: '' },
8
+ subtitle: { type: String, default: '' },
9
+ padding: { type: Boolean, default: true },
10
+ hoverable: { type: Boolean, default: false },
11
+ variant: { type: String, default: 'elevated' },
12
+ image: { type: String, default: '' }
13
+ },
14
+ setup(props, setupContext) {
15
+ const { emit, slots, slots: $slots } = setupContext
16
+ return { $slots }
17
+ }
18
+ })
19
+ // Injected render function
20
+ _sfc_main.render = function(ctx) {
21
+ const { $slots, title, subtitle, padding, hoverable, variant, image, Fragment: _ntc_Fragment } = ctx
22
+ return h('div', { class: ['n-card', `is-${variant}`, hoverable ? 'is-hoverable' : ''], "data-v-34850782": "" }, [
23
+ "\n ",
24
+ (image) ? h('img', { class: "n-card-image", src: image, "data-v-34850782": "" }) : null,
25
+ (title || $slots.header) ? h('div', { class: "n-card-header", "data-v-34850782": "" }, [
26
+ "\n ",
27
+ ctx.$slots.header ? ctx.$slots.header() : null,
28
+ "\n "
29
+ ]) : null,
30
+ h('div', { class: ['n-card-body', padding ? 'has-padding' : ''], "data-v-34850782": "" }, [
31
+ "\n ",
32
+ ctx.$slots.default ? ctx.$slots.default() : null,
33
+ "\n "
34
+ ]),
35
+ "\n ",
36
+ ($slots.footer) ? h('div', { class: "n-card-footer", "data-v-34850782": "" }, [
37
+ "\n ",
38
+ ctx.$slots.footer ? ctx.$slots.footer() : null,
39
+ "\n "
40
+ ]) : null
41
+ ])
42
+ }
43
+ _sfc_main.__scopeId = 'data-v-34850782'
44
+ _sfc_main.__hmrId = 'NCard_nexa'
45
+
46
+ export default _sfc_main
47
+
48
+ const __style = `.n-card[data-v-34850782]{
49
+ background: var(--n-color-surface);
50
+ border: 1px solid var(--n-color-border);
51
+ border-radius: var(--n-radius-xl);
52
+ overflow: hidden;
53
+ transition: all var(--n-transition-normal);
54
+ display: flex;
55
+ flex-direction: column;
56
+ }
57
+
58
+ .is-elevated[data-v-34850782]{
59
+ background: var(--n-color-surface-elevated);
60
+ box-shadow: var(--n-shadow-lg);
61
+ }
62
+
63
+ .is-outlined[data-v-34850782]{
64
+ background: transparent;
65
+ border-color: var(--n-color-border);
66
+ box-shadow: none;
67
+ }
68
+
69
+ .is-flat[data-v-34850782]{
70
+ background: var(--n-color-surface-alt);
71
+ border: none;
72
+ box-shadow: none;
73
+ }
74
+
75
+ .n-card.is-hoverable[data-v-34850782]:hover{
76
+ transform: translateY(-4px);
77
+ border-color: var(--n-color-border-hover);
78
+ box-shadow: var(--n-shadow-xl);
79
+ }
80
+
81
+ .n-card-image[data-v-34850782]{
82
+ width: 100%;
83
+ height: 200px;
84
+ object-fit: cover;
85
+ display: block;
86
+ }
87
+
88
+ .n-card-header[data-v-34850782]{
89
+ padding: var(--n-space-6);
90
+ border-bottom: 1px solid var(--n-color-border);
91
+ }
92
+
93
+ .n-card-title[data-v-34850782]{
94
+ margin: 0;
95
+ font-size: var(--n-text-xl);
96
+ font-weight: var(--n-weight-bold);
97
+ color: var(--n-color-text);
98
+ letter-spacing: var(--n-tracking-tight);
99
+ }
100
+
101
+ .n-card-subtitle[data-v-34850782]{
102
+ margin: var(--n-space-1) 0 0 0;
103
+ font-size: var(--n-text-sm);
104
+ color: var(--n-color-text-secondary);
105
+ }
106
+
107
+ .n-card-body.has-padding{
108
+ padding: var(--n-space-6);
109
+ }
110
+
111
+ .n-card-footer[data-v-34850782]{
112
+ padding: var(--n-space-4) var(--n-space-6);
113
+ background: rgba(0, 0, 0, 0.15);
114
+ border-top: 1px solid var(--n-color-border);
115
+ margin-top: auto;
116
+ }`
117
+ injectStyle('data-v-34850782', __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,108 @@
1
+ import { h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle } from 'nexa-framework'
2
+
3
+ const _sfc_main = defineComponent({
4
+ __scopeId: 'data-v-761e94fe',
5
+ __hmrId: 'NCheckbox_nexa',
6
+ props: {
7
+ modelValue: { type: Boolean, default: false },
8
+ label: { type: String, default: '' },
9
+ disabled: { type: Boolean, default: false },
10
+ indeterminate: { type: Boolean, default: false }
11
+ },
12
+ emits: ['update:modelValue'],
13
+ setup(props, setupContext) {
14
+ const { emit, slots, slots: $slots } = setupContext
15
+ const toggle = () => {
16
+ if (props.disabled) return
17
+ emit('update:modelValue', !props.modelValue)
18
+ }
19
+ return { toggle, $slots, emit }
20
+ }
21
+ })
22
+ // Injected render function
23
+ _sfc_main.render = function(ctx) {
24
+ const { toggle, $slots, emit, modelValue, label, disabled, indeterminate, Fragment: _ntc_Fragment } = ctx
25
+ return h('label', { class: ["n-checkbox", { 'is-checked': modelValue && !indeterminate, 'is-indeterminate': indeterminate, 'is-disabled': disabled }], "data-v-761e94fe": "" }, [
26
+ "\n ",
27
+ h('div', { class: "n-checkbox-box", onClick: toggle, "data-v-761e94fe": "" }, [
28
+ "\n ",
29
+ h('span', { class: "n-checkbox-icon", "data-v-761e94fe": "" }, [
30
+ "\n ",
31
+ indeterminate ? '–' : '✓',
32
+ "\n "
33
+ ]),
34
+ "\n "
35
+ ]),
36
+ "\n ",
37
+ (label) ? h('span', { class: "n-checkbox-label", "data-v-761e94fe": "" }, [
38
+ label
39
+ ]) : null
40
+ ])
41
+ }
42
+ _sfc_main.__scopeId = 'data-v-761e94fe'
43
+ _sfc_main.__hmrId = 'NCheckbox_nexa'
44
+
45
+ export default _sfc_main
46
+
47
+ const __style = `.n-checkbox[data-v-761e94fe]{
48
+ display: inline-flex;
49
+ align-items: center;
50
+ gap: var(--n-space-3);
51
+ cursor: pointer;
52
+ user-select: none;
53
+ }
54
+
55
+ .n-checkbox-box[data-v-761e94fe]{
56
+ width: 20px;
57
+ height: 20px;
58
+ border: 2px solid var(--n-color-border);
59
+ border-radius: var(--n-radius-sm);
60
+ display: flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ transition: all var(--n-transition-fast);
64
+ flex-shrink: 0;
65
+ background: transparent;
66
+ }
67
+
68
+ .is-checked .n-checkbox-box[data-v-761e94fe]{
69
+ background: var(--n-color-primary);
70
+ border-color: var(--n-color-primary);
71
+ }
72
+
73
+ .is-indeterminate .n-checkbox-box[data-v-761e94fe]{
74
+ background: var(--n-color-primary);
75
+ border-color: var(--n-color-primary);
76
+ }
77
+
78
+ .n-checkbox-icon[data-v-761e94fe]{
79
+ color: white;
80
+ font-size: 12px;
81
+ font-weight: var(--n-weight-bold);
82
+ line-height: 1;
83
+ opacity: 0;
84
+ transform: scale(0);
85
+ transition: all var(--n-transition-fast);
86
+ }
87
+
88
+ .is-checked .n-checkbox-icon[data-v-761e94fe],
89
+ .is-indeterminate .n-checkbox-icon[data-v-761e94fe]{
90
+ opacity: 1;
91
+ transform: scale(1);
92
+ }
93
+
94
+ .n-checkbox-label[data-v-761e94fe]{
95
+ font-size: var(--n-text-sm);
96
+ color: var(--n-color-text);
97
+ font-weight: var(--n-weight-medium);
98
+ }
99
+
100
+ .is-disabled[data-v-761e94fe]{
101
+ opacity: 0.5;
102
+ cursor: not-allowed;
103
+ }
104
+
105
+ .n-checkbox[data-v-761e94fe]:hover:not(.is-disabled) .n-checkbox-box{
106
+ border-color: var(--n-color-primary);
107
+ }`
108
+ injectStyle('data-v-761e94fe', __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,72 @@
1
+ import { computed, h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle } from 'nexa-framework'
2
+
3
+ const _sfc_main = defineComponent({
4
+ __scopeId: 'data-v-606f06fb',
5
+ __hmrId: 'NChips_nexa',
6
+ props: {
7
+ modelValue: { type: Array, default: () => [] },
8
+ removable: { type: Boolean, default: false },
9
+ disabled: { type: Boolean, default: false }
10
+ },
11
+ emits: ['update:modelValue', 'remove'],
12
+ setup(props, setupContext) {
13
+ const { emit, slots, slots: $slots } = setupContext
14
+ const resolvedModel = computed(() => {
15
+ const v = props.modelValue
16
+ if (v && typeof v === 'object' && 'value' in v) return v.value
17
+ return v
18
+ })
19
+ const normalize = (item) => {
20
+ if (item == null) return { label: '', value: item }
21
+ if (typeof item === 'string' || typeof item === 'number') return { label: String(item), value: item }
22
+ if (typeof item === 'object') {
23
+ const label = 'label' in item ? String(item.label) : String(item.value ?? '')
24
+ const value = 'value' in item ? item.value : label
25
+ return { label, value }
26
+ }
27
+ return { label: String(item), value: item }
28
+ }
29
+ const chips = computed(() => {
30
+ const v = resolvedModel.value
31
+ const list = Array.isArray(v) ? v : []
32
+ return list.map(normalize)
33
+ })
34
+ const removeAt = (index) => {
35
+ if (props.disabled) return
36
+ if (!props.removable) return
37
+ const v = resolvedModel.value
38
+ const current = Array.isArray(v) ? v : []
39
+ const next = current.filter((_v, i) => i !== index)
40
+ emit('update:modelValue', next)
41
+ emit('remove', { index })
42
+ }
43
+ return { resolvedModel, normalize, chips, removeAt, $slots, emit }
44
+ }
45
+ })
46
+ // Injected render function
47
+ _sfc_main.render = function(ctx) {
48
+ const { resolvedModel, normalize, chips, removeAt, $slots, emit, modelValue, removable, disabled, Fragment: _ntc_Fragment } = ctx
49
+ return h('div', { class: ["n-chips", { 'is-disabled': disabled }], "data-v-606f06fb": "" }, [
50
+ "\n ",
51
+ chips.value.map((chip, i) =>
52
+ h('div', { class: "n-chip", key: String(chip.value) + ':' + i, "data-v-606f06fb": "" }, [
53
+ "\n ",
54
+ h('span', { class: "n-chip-label", "data-v-606f06fb": "" }, [
55
+ chip.label
56
+ ]),
57
+ "\n ",
58
+ (removable) ? h('button', { class: "n-chip-remove", type: "button", disabled: disabled, "aria-label": "Remove", onClick: ($event) => { removeAt(i) }, "data-v-606f06fb": "" }, [
59
+ "✕"
60
+ ]) : null
61
+ ])
62
+ ),
63
+ "\n "
64
+ ])
65
+ }
66
+ _sfc_main.__scopeId = 'data-v-606f06fb'
67
+ _sfc_main.__hmrId = 'NChips_nexa'
68
+
69
+ export default _sfc_main
70
+
71
+ const __style = `.n-chips[data-v-606f06fb]{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}`
72
+ injectStyle('data-v-606f06fb', __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>