design-system-dashboard-devmunity 0.0.6 → 0.1.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/.editorconfig +1 -1
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +0 -0
- package/.vscode/settings.json +26 -21
- package/CHANGELOG.md +8 -0
- package/app/assets/css/themes/components/button.js +239 -0
- package/app/assets/css/themes/index.js +1 -0
- package/app/components/a/a-button-back.vue +33 -0
- package/app/components/b/card/b-card-header.vue +113 -0
- package/app/components/{a/a-card.vue → b/card/b-card.vue} +1 -1
- package/app/components/b/modal/b-modal.vue +169 -0
- package/app/pages/test.vue +51 -11
- package/commitlint.config.js +1 -0
- package/package.json +6 -2
- package/tsconfig.json +7 -6
- package/app/components/a/a-card.stories.ts +0 -112
- /package/app/components/{a/a-card-inner.vue → b/card/b-card-inner.vue} +0 -0
package/.editorconfig
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no -- commitlint --edit
|
|
File without changes
|
package/.vscode/settings.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
"files.associations": {
|
|
3
|
+
"*.css": "tailwindcss"
|
|
4
|
+
},
|
|
5
|
+
"editor.quickSuggestions": {
|
|
6
|
+
"strings": "on"
|
|
7
|
+
},
|
|
8
|
+
"tailwindCSS.classAttributes": [
|
|
9
|
+
"class",
|
|
10
|
+
"ui",
|
|
11
|
+
".*Styles*",
|
|
12
|
+
".*Styles: .*", // <-- This should fix your issue.
|
|
13
|
+
],
|
|
14
|
+
"tailwindCSS.experimental.classRegex": [
|
|
15
|
+
[
|
|
16
|
+
"ui:\\s*{([^)]*)\\s*}",
|
|
17
|
+
"(?:'|\"|`)([^']*)(?:'|\"|`)"
|
|
18
|
+
]
|
|
19
|
+
],
|
|
20
|
+
"editor.tabSize": 4,
|
|
21
|
+
"editor.stickyTabStops": true,
|
|
22
|
+
"references.preferredLocation": "view",
|
|
23
|
+
"conventionalCommits.scopes": [
|
|
24
|
+
"dev-infra",
|
|
25
|
+
"vscode-extension",
|
|
26
|
+
"components"
|
|
27
|
+
]
|
|
23
28
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [0.1.0](https://github.com/vicventum/design-system-dashboard-devmunity/compare/v0.0.6...v0.1.0) (2025-11-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **components:** :sparkles: Cambia estructura de componentes y agrega nuevo componente AButtonBack ([c3ad2e9](https://github.com/vicventum/design-system-dashboard-devmunity/commit/c3ad2e9fe85f0aa97049ecb6cb2667f6dd1f9c20))
|
|
7
|
+
* **components:** :sparkles: Crea componente BCardHeader ([7e3292f](https://github.com/vicventum/design-system-dashboard-devmunity/commit/7e3292fd60f94b2cc83941f14c6a1b0795d46961))
|
|
8
|
+
|
|
1
9
|
## [0.0.6](https://github.com/vicventum/design-system-dashboard-devmunity/compare/v0.0.5...v0.0.6) (2025-11-06)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
export default /*ui*/ {
|
|
2
|
+
slots: {
|
|
3
|
+
base: [
|
|
4
|
+
'rounded-md font-medium inline-flex items-center disabled:cursor-not-allowed aria-disabled:cursor-not-allowed disabled:opacity-75 aria-disabled:opacity-75',
|
|
5
|
+
'transition-colors',
|
|
6
|
+
],
|
|
7
|
+
label: 'truncate',
|
|
8
|
+
leadingIcon: 'shrink-0',
|
|
9
|
+
leadingAvatar: 'shrink-0',
|
|
10
|
+
leadingAvatarSize: '',
|
|
11
|
+
trailingIcon: 'shrink-0',
|
|
12
|
+
},
|
|
13
|
+
variants: {
|
|
14
|
+
fieldGroup: {
|
|
15
|
+
horizontal:
|
|
16
|
+
'not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]',
|
|
17
|
+
vertical:
|
|
18
|
+
'not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]',
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
primary: '',
|
|
22
|
+
secondary: '',
|
|
23
|
+
success: '',
|
|
24
|
+
info: '',
|
|
25
|
+
warning: '',
|
|
26
|
+
error: '',
|
|
27
|
+
neutral: '',
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
solid: '',
|
|
31
|
+
outline: '',
|
|
32
|
+
soft: '',
|
|
33
|
+
subtle: '',
|
|
34
|
+
ghost: '',
|
|
35
|
+
link: '',
|
|
36
|
+
icon: 'p-2 rounded-full inline-flex items-center justify-center bg-transparent',
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
xs: {
|
|
40
|
+
base: 'px-2 py-1 text-xs gap-1',
|
|
41
|
+
leadingIcon: 'size-4',
|
|
42
|
+
leadingAvatarSize: '3xs',
|
|
43
|
+
trailingIcon: 'size-4',
|
|
44
|
+
},
|
|
45
|
+
sm: {
|
|
46
|
+
base: 'px-2.5 py-1.5 text-xs gap-1.5',
|
|
47
|
+
leadingIcon: 'size-4',
|
|
48
|
+
leadingAvatarSize: '3xs',
|
|
49
|
+
trailingIcon: 'size-4',
|
|
50
|
+
},
|
|
51
|
+
md: {
|
|
52
|
+
base: 'px-2.5 py-1.5 text-sm gap-1.5',
|
|
53
|
+
leadingIcon: 'size-5',
|
|
54
|
+
leadingAvatarSize: '2xs',
|
|
55
|
+
trailingIcon: 'size-5',
|
|
56
|
+
},
|
|
57
|
+
lg: {
|
|
58
|
+
base: 'px-3 py-2 text-sm gap-2',
|
|
59
|
+
leadingIcon: 'size-5',
|
|
60
|
+
leadingAvatarSize: '2xs',
|
|
61
|
+
trailingIcon: 'size-5',
|
|
62
|
+
},
|
|
63
|
+
xl: {
|
|
64
|
+
base: 'px-3 py-2 text-base gap-2',
|
|
65
|
+
leadingIcon: 'size-6',
|
|
66
|
+
leadingAvatarSize: 'xs',
|
|
67
|
+
trailingIcon: 'size-6',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
block: {
|
|
71
|
+
true: {
|
|
72
|
+
base: 'w-full justify-center',
|
|
73
|
+
trailingIcon: 'ms-auto',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
square: {
|
|
77
|
+
true: '',
|
|
78
|
+
},
|
|
79
|
+
leading: {
|
|
80
|
+
true: '',
|
|
81
|
+
},
|
|
82
|
+
trailing: {
|
|
83
|
+
true: '',
|
|
84
|
+
},
|
|
85
|
+
loading: {
|
|
86
|
+
true: '',
|
|
87
|
+
},
|
|
88
|
+
active: {
|
|
89
|
+
true: {
|
|
90
|
+
base: '',
|
|
91
|
+
},
|
|
92
|
+
false: {
|
|
93
|
+
base: '',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
compoundVariants: [
|
|
98
|
+
{
|
|
99
|
+
color: 'primary',
|
|
100
|
+
variant: 'solid',
|
|
101
|
+
class: 'text-inverted bg-primary hover:bg-primary/75 active:bg-primary/75 disabled:bg-primary aria-disabled:bg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
color: 'primary',
|
|
105
|
+
variant: 'outline',
|
|
106
|
+
class: 'ring ring-inset ring-primary/50 text-primary hover:bg-primary/10 active:bg-primary/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-primary',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
color: 'primary',
|
|
110
|
+
variant: 'soft',
|
|
111
|
+
class: 'text-primary bg-primary/10 hover:bg-primary/15 active:bg-primary/15 focus:outline-none focus-visible:bg-primary/15 disabled:bg-primary/10 aria-disabled:bg-primary/10',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
color: 'primary',
|
|
115
|
+
variant: 'subtle',
|
|
116
|
+
class: 'text-primary ring ring-inset ring-primary/25 bg-primary/10 hover:bg-primary/15 active:bg-primary/15 disabled:bg-primary/10 aria-disabled:bg-primary/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
color: 'primary',
|
|
120
|
+
variant: 'ghost',
|
|
121
|
+
class: 'text-primary hover:bg-primary/10 active:bg-primary/10 focus:outline-none focus-visible:bg-primary/10 disabled:bg-transparent aria-disabled:bg-transparent dark:disabled:bg-transparent dark:aria-disabled:bg-transparent',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
color: 'primary',
|
|
125
|
+
variant: 'link',
|
|
126
|
+
class: 'text-primary hover:text-primary/75 active:text-primary/75 disabled:text-primary aria-disabled:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
color: 'neutral',
|
|
130
|
+
variant: 'solid',
|
|
131
|
+
class: 'text-inverted bg-inverted hover:bg-inverted/90 active:bg-inverted/90 disabled:bg-inverted aria-disabled:bg-inverted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-inverted',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
color: 'neutral',
|
|
135
|
+
variant: 'outline',
|
|
136
|
+
class: 'ring ring-inset ring-accented text-default bg-default hover:bg-elevated active:bg-elevated disabled:bg-default aria-disabled:bg-default focus:outline-none focus-visible:ring-2 focus-visible:ring-inverted',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
color: 'neutral',
|
|
140
|
+
variant: 'soft',
|
|
141
|
+
class: 'text-default bg-elevated hover:bg-accented/75 active:bg-accented/75 focus:outline-none focus-visible:bg-accented/75 disabled:bg-elevated aria-disabled:bg-elevated',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
color: 'neutral',
|
|
145
|
+
variant: 'subtle',
|
|
146
|
+
class: 'ring ring-inset ring-accented text-default bg-elevated hover:bg-accented/75 active:bg-accented/75 disabled:bg-elevated aria-disabled:bg-elevated focus:outline-none focus-visible:ring-2 focus-visible:ring-inverted',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
color: 'neutral',
|
|
150
|
+
variant: 'ghost',
|
|
151
|
+
class: 'text-default hover:bg-elevated active:bg-elevated focus:outline-none focus-visible:bg-elevated hover:disabled:bg-transparent dark:hover:disabled:bg-transparent hover:aria-disabled:bg-transparent dark:hover:aria-disabled:bg-transparent',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
color: 'neutral',
|
|
155
|
+
variant: 'link',
|
|
156
|
+
class: 'text-muted hover:text-default active:text-default disabled:text-muted aria-disabled:text-muted focus:outline-none focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-inverted',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
size: 'xs',
|
|
160
|
+
square: true,
|
|
161
|
+
class: 'p-1',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
size: 'sm',
|
|
165
|
+
square: true,
|
|
166
|
+
class: 'p-1.5',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
size: 'md',
|
|
170
|
+
square: true,
|
|
171
|
+
class: 'p-1.5',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
size: 'lg',
|
|
175
|
+
square: true,
|
|
176
|
+
class: 'p-2',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
size: 'xl',
|
|
180
|
+
square: true,
|
|
181
|
+
class: 'p-2',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
loading: true,
|
|
185
|
+
leading: true,
|
|
186
|
+
class: {
|
|
187
|
+
leadingIcon: 'animate-spin',
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
loading: true,
|
|
192
|
+
leading: false,
|
|
193
|
+
trailing: true,
|
|
194
|
+
class: {
|
|
195
|
+
trailingIcon: 'animate-spin',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
variant: 'icon',
|
|
200
|
+
color: 'neutral',
|
|
201
|
+
class: 'text-neutral-700 hover:bg-neutral-100 active:text-neutral/75 disabled:text-neutral aria-disabled:text-neutral focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-neutral',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
variant: 'icon',
|
|
205
|
+
color: 'primary',
|
|
206
|
+
class: 'text-primary hover:bg-primary-100 active:text-primary/75 disabled:text-primary aria-disabled:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
variant: 'icon',
|
|
210
|
+
color: 'secondary',
|
|
211
|
+
class: 'text-secondary hover:bg-secondary-100 active:text-secondary/75 disabled:text-secondary aria-disabled:text-secondary focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
variant: 'icon',
|
|
215
|
+
color: 'success',
|
|
216
|
+
class: 'text-success hover:bg-success-100 active:text-success/75 disabled:text-success aria-disabled:text-success focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-success',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
variant: 'icon',
|
|
220
|
+
color: 'info',
|
|
221
|
+
class: 'text-info hover:bg-info-100 active:text-info/75 disabled:text-info aria-disabled:text-info focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-info',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
variant: 'icon',
|
|
225
|
+
color: 'warning',
|
|
226
|
+
class: 'text-warning hover:bg-warning-100 active:text-warning/75 disabled:text-warning aria-disabled:text-warning focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-warning',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
variant: 'icon',
|
|
230
|
+
color: 'error',
|
|
231
|
+
class: 'text-error hover:bg-error-100 active:text-error/75 disabled:text-error aria-disabled:text-error focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-error',
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
defaultVariants: {
|
|
235
|
+
color: 'primary',
|
|
236
|
+
variant: 'solid',
|
|
237
|
+
size: 'md',
|
|
238
|
+
},
|
|
239
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
icon: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: 'heroicons:arrow-left-16-solid',
|
|
6
|
+
required: false,
|
|
7
|
+
},
|
|
8
|
+
to: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: '',
|
|
11
|
+
required: false,
|
|
12
|
+
},
|
|
13
|
+
isBackAction: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits(['on-click'])
|
|
21
|
+
const router = useRouter()
|
|
22
|
+
|
|
23
|
+
function handleClickLeftButtonIcon() {
|
|
24
|
+
emit('on-click')
|
|
25
|
+
if (props.isBackAction && !props.to && props.icon.includes('arrow-left')) {
|
|
26
|
+
router.back()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<UButton :to="to" :icon="icon" variant="icon" color="neutral" @click="handleClickLeftButtonIcon" />
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="jsx" setup>
|
|
2
|
+
import { twMerge } from 'tailwind-merge'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
required: false,
|
|
9
|
+
},
|
|
10
|
+
subtitle: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: '',
|
|
13
|
+
required: false,
|
|
14
|
+
},
|
|
15
|
+
hasBorder: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false,
|
|
18
|
+
required: false,
|
|
19
|
+
},
|
|
20
|
+
variant: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'main', // main, secondary
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
variantSubtitle: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'main',
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
hasLeftButtonIcon: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
required: false,
|
|
34
|
+
},
|
|
35
|
+
leftButtonIcon: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'heroicons:arrow-left-16-solid',
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
40
|
+
leftButtonIconTo: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '',
|
|
43
|
+
required: false,
|
|
44
|
+
},
|
|
45
|
+
classTitle: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: '',
|
|
48
|
+
required: false,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const emit = defineEmits(['on-click-left-button-icon'])
|
|
53
|
+
|
|
54
|
+
const headingTag = computed(() => {
|
|
55
|
+
const tags = {
|
|
56
|
+
main: 'h2',
|
|
57
|
+
secondary: 'h3',
|
|
58
|
+
}
|
|
59
|
+
return tags[props.variant] ?? tags.main
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
function handleClickLeftButtonIcon() {
|
|
63
|
+
emit('on-click-left-button-icon')
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<BCardInner
|
|
69
|
+
:class="[
|
|
70
|
+
'flex items-center justify-between',
|
|
71
|
+
{ 'bg-neutral-50': variant === 'secondary' },
|
|
72
|
+
{ 'border-y border-neutral-200': hasBorder && variant === 'secondary' },
|
|
73
|
+
]"
|
|
74
|
+
>
|
|
75
|
+
<div class="space-y-1">
|
|
76
|
+
<div class="flex items-center gap-x-3">
|
|
77
|
+
<AButtonBack
|
|
78
|
+
v-if="hasLeftButtonIcon"
|
|
79
|
+
:icon="leftButtonIcon"
|
|
80
|
+
:To="leftButtonIconTo"
|
|
81
|
+
:is-back-action="leftButtonIconTo"
|
|
82
|
+
@on-click="handleClickLeftButtonIcon"
|
|
83
|
+
/>
|
|
84
|
+
<Component
|
|
85
|
+
:is="headingTag"
|
|
86
|
+
:class="
|
|
87
|
+
twMerge([
|
|
88
|
+
'font-bold',
|
|
89
|
+
variant === 'main' && 'text-xl',
|
|
90
|
+
variant === 'secondary' && 'text-lg',
|
|
91
|
+
classTitle,
|
|
92
|
+
])
|
|
93
|
+
"
|
|
94
|
+
>
|
|
95
|
+
{{ title }}
|
|
96
|
+
</Component>
|
|
97
|
+
</div>
|
|
98
|
+
<p
|
|
99
|
+
v-if="subtitle"
|
|
100
|
+
class="text-sm font-medium"
|
|
101
|
+
:class="{
|
|
102
|
+
'text-neutral-400': variant === 'secondary',
|
|
103
|
+
}"
|
|
104
|
+
>
|
|
105
|
+
{{ subtitle }}
|
|
106
|
+
</p>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div v-if="$slots.actions" class="p-0">
|
|
110
|
+
<slot name="actions" />
|
|
111
|
+
</div>
|
|
112
|
+
</BCardInner>
|
|
113
|
+
</template>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { resolveComponent } from 'vue'
|
|
3
|
+
import { twMerge } from 'tailwind-merge'
|
|
4
|
+
|
|
5
|
+
const UForm = resolveComponent('UForm')
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
state: {
|
|
9
|
+
type: Object,
|
|
10
|
+
default: null,
|
|
11
|
+
required: false,
|
|
12
|
+
},
|
|
13
|
+
schema: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: null,
|
|
16
|
+
required: false,
|
|
17
|
+
},
|
|
18
|
+
title: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
text: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '',
|
|
26
|
+
required: false,
|
|
27
|
+
},
|
|
28
|
+
primaryButtonText: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'Guardar',
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
primaryButtonColor: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'color-primary',
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
secondaryButtonText: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'Cancelar',
|
|
41
|
+
required: false,
|
|
42
|
+
},
|
|
43
|
+
hasFooter: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true,
|
|
46
|
+
required: false,
|
|
47
|
+
},
|
|
48
|
+
width: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
required: false,
|
|
52
|
+
},
|
|
53
|
+
widthButtons: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'w-40',
|
|
56
|
+
required: false,
|
|
57
|
+
},
|
|
58
|
+
isPrimaryButtonDisabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
required: false,
|
|
62
|
+
},
|
|
63
|
+
isBlockButtons: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
classButton: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'form',
|
|
71
|
+
required: false,
|
|
72
|
+
},
|
|
73
|
+
hasBodyExpanded: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false,
|
|
76
|
+
required: false,
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const emit = defineEmits(['on-click-primary-button', 'on-click-secondary-button', 'on-submit'])
|
|
81
|
+
|
|
82
|
+
// Model
|
|
83
|
+
|
|
84
|
+
const isOpen = defineModel({
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false,
|
|
87
|
+
required: true,
|
|
88
|
+
})
|
|
89
|
+
const formRef = defineModel('formRef', {
|
|
90
|
+
type: Object,
|
|
91
|
+
default: () => {},
|
|
92
|
+
required: false,
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
// Data
|
|
96
|
+
|
|
97
|
+
const uiStyles = reactive({})
|
|
98
|
+
|
|
99
|
+
// Computed
|
|
100
|
+
|
|
101
|
+
const formProps = computed(() => {
|
|
102
|
+
// return props.data ? { ref: 'form', state: props.data, onSubmit: handleSubmit } : {}
|
|
103
|
+
return props.state ? { ref: 'formRef', state: props.state, schema: props.schema } : {}
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// Methods
|
|
107
|
+
|
|
108
|
+
function handleSubmit() {
|
|
109
|
+
emit('on-submit')
|
|
110
|
+
}
|
|
111
|
+
function handleClickPrimaryButton() {
|
|
112
|
+
emit('on-click-primary-button')
|
|
113
|
+
}
|
|
114
|
+
function handleClickSecondaryButton() {
|
|
115
|
+
isOpen.value = false
|
|
116
|
+
emit('on-click-secondary-button')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Watch
|
|
120
|
+
|
|
121
|
+
watch(
|
|
122
|
+
() => props.width,
|
|
123
|
+
(width) => {
|
|
124
|
+
if (!width) return null
|
|
125
|
+
|
|
126
|
+
Object.assign(uiStyles, { width: `${props.width}` })
|
|
127
|
+
},
|
|
128
|
+
{ immediate: true }
|
|
129
|
+
)
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<template>
|
|
133
|
+
<UModal v-model="isOpen" :ui="uiStyles">
|
|
134
|
+
<component :is="state ? UForm : 'section'" v-bind="formProps" @submit="handleSubmit">
|
|
135
|
+
<BCard :ui="{ footer: { padding: 'p-0 sm:p-0' } }" :has-body-expanded="hasBodyExpanded">
|
|
136
|
+
<template #header>
|
|
137
|
+
<slot v-if="$slots.header" name="header" />
|
|
138
|
+
<BCardHeader v-else :title="title" size="sm">
|
|
139
|
+
<template #actions>
|
|
140
|
+
<UButton icon="heroicons:x-mark" variant="icon" @click="isOpen = false" />
|
|
141
|
+
</template>
|
|
142
|
+
</BCardHeader>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<BCardInner v-if="text" class="p-6">
|
|
146
|
+
{{ text }}
|
|
147
|
+
</BCardInner>
|
|
148
|
+
<slot v-else />
|
|
149
|
+
|
|
150
|
+
<template v-if="hasFooter" #footer>
|
|
151
|
+
<slot v-if="$slots.footer" name="footer" />
|
|
152
|
+
<BCardInner v-else>
|
|
153
|
+
<ABlockActionButtons
|
|
154
|
+
:class="twMerge('flex justify-start gap-x-2', classButton)"
|
|
155
|
+
:primary-button-color="primaryButtonColor"
|
|
156
|
+
:primary-button-text="primaryButtonText"
|
|
157
|
+
:secondary-button-text="secondaryButtonText"
|
|
158
|
+
:width-buttons="widthButtons"
|
|
159
|
+
:is-block-buttons="isBlockButtons"
|
|
160
|
+
:is-primary-button-disabled="isPrimaryButtonDisabled"
|
|
161
|
+
@on-click-primary-button="handleClickPrimaryButton"
|
|
162
|
+
@on-click-secondary-button="handleClickSecondaryButton"
|
|
163
|
+
/>
|
|
164
|
+
</BCardInner>
|
|
165
|
+
</template>
|
|
166
|
+
</BCard>
|
|
167
|
+
</component>
|
|
168
|
+
</UModal>
|
|
169
|
+
</template>
|
package/app/pages/test.vue
CHANGED
|
@@ -2,18 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
<template>
|
|
4
4
|
<div class="h-screen">
|
|
5
|
-
<
|
|
6
|
-
<
|
|
5
|
+
<UContainer>
|
|
6
|
+
<BCardInner class="h-full">
|
|
7
|
+
<BCard :has-footer-divider="false">
|
|
8
|
+
<template #header>
|
|
9
|
+
<h1>Header</h1>
|
|
10
|
+
</template>
|
|
11
|
+
<p>Body</p>
|
|
12
|
+
<template #footer>
|
|
13
|
+
<p>Footer</p>
|
|
14
|
+
</template>
|
|
15
|
+
</BCard>
|
|
16
|
+
<UCard variant="ghost"> oli </UCard>
|
|
17
|
+
<AButtonBack icon="heroicons:arrow-left-16-solid" is-back-action />
|
|
18
|
+
</BCardInner>
|
|
19
|
+
|
|
20
|
+
<hr class="my-6" />
|
|
21
|
+
|
|
22
|
+
<BCard>
|
|
7
23
|
<template #header>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
24
|
+
<BCardHeader title="Crear una nueva actividad" subtitle="Subtitle" has-left-button-icon>
|
|
25
|
+
<template #actions>
|
|
26
|
+
<UButton label="Action" />
|
|
27
|
+
</template>
|
|
28
|
+
</BCardHeader>
|
|
13
29
|
</template>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
30
|
+
|
|
31
|
+
<BCardInner>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci eos perspiciatis
|
|
33
|
+
asperiores suscipit voluptate magni excepturi. Doloribus in fugit quam voluptatibus,
|
|
34
|
+
molestiae maxime illum explicabo ut corrupti, distinctio atque dolor.
|
|
35
|
+
</BCardInner>
|
|
36
|
+
|
|
37
|
+
<BCardHeader
|
|
38
|
+
title="Crear una nueva actividad"
|
|
39
|
+
subtitle="Subtitle"
|
|
40
|
+
variant="secondary"
|
|
41
|
+
variant-subtitle="secondary"
|
|
42
|
+
class="my-6"
|
|
43
|
+
class-title=""
|
|
44
|
+
has-border
|
|
45
|
+
>
|
|
46
|
+
<template #actions>
|
|
47
|
+
<UButton label="Action" />
|
|
48
|
+
</template>
|
|
49
|
+
</BCardHeader>
|
|
50
|
+
|
|
51
|
+
<BCardInner>
|
|
52
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci eos perspiciatis
|
|
53
|
+
asperiores suscipit voluptate magni excepturi. Doloribus in fugit quam voluptatibus,
|
|
54
|
+
molestiae maxime illum explicabo ut corrupti, distinctio atque dolor.
|
|
55
|
+
</BCardInner>
|
|
56
|
+
</BCard>
|
|
57
|
+
</UContainer>
|
|
18
58
|
</div>
|
|
19
59
|
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default { extends: ['@commitlint/config-conventional'] };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "design-system-dashboard-devmunity",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "nuxt build",
|
|
7
7
|
"dev": "nuxt dev",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"preview": "nuxt preview",
|
|
10
10
|
"storybook": "storybook dev -p 6006",
|
|
11
11
|
"build-storybook": "storybook build",
|
|
12
|
-
"commit": "cz"
|
|
12
|
+
"commit": "cz",
|
|
13
|
+
"prepare": "husky"
|
|
13
14
|
},
|
|
14
15
|
"release": {
|
|
15
16
|
"branches": [
|
|
@@ -49,6 +50,8 @@
|
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@chromatic-com/storybook": "1.3.3",
|
|
53
|
+
"@commitlint/cli": "^20.1.0",
|
|
54
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
52
55
|
"@nuxtjs/storybook": "8.3.5",
|
|
53
56
|
"@semantic-release/changelog": "^6.0.3",
|
|
54
57
|
"@semantic-release/git": "^10.0.1",
|
|
@@ -56,6 +59,7 @@
|
|
|
56
59
|
"@storybook/addon-links": "8.0.8",
|
|
57
60
|
"commitizen": "^4.3.1",
|
|
58
61
|
"cz-conventional-changelog": "^3.3.0",
|
|
62
|
+
"husky": "^9.1.7",
|
|
59
63
|
"prettier": "3.6.2",
|
|
60
64
|
"prettier-plugin-tailwindcss": "0.7.1",
|
|
61
65
|
"semantic-release": "^25.0.1",
|
package/tsconfig.json
CHANGED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import ACard from './a-card.vue'
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Components/ACard',
|
|
6
|
-
component: ACard,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
variant: {
|
|
10
|
-
control: 'select',
|
|
11
|
-
options: ['outline', 'solid', 'soft'],
|
|
12
|
-
},
|
|
13
|
-
as: {
|
|
14
|
-
control: 'text',
|
|
15
|
-
},
|
|
16
|
-
hasBodyExpanded: {
|
|
17
|
-
control: 'boolean',
|
|
18
|
-
},
|
|
19
|
-
hasFooterDivider: {
|
|
20
|
-
control: 'boolean',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
variant: 'outline',
|
|
25
|
-
as: 'div',
|
|
26
|
-
hasBodyExpanded: false,
|
|
27
|
-
hasFooterDivider: true,
|
|
28
|
-
},
|
|
29
|
-
} satisfies Meta<typeof ACard>
|
|
30
|
-
|
|
31
|
-
export default meta
|
|
32
|
-
type Story = StoryObj<typeof meta>
|
|
33
|
-
|
|
34
|
-
export const Default: Story = {
|
|
35
|
-
render: (args) => ({
|
|
36
|
-
components: { ACard },
|
|
37
|
-
setup() {
|
|
38
|
-
return { args }
|
|
39
|
-
},
|
|
40
|
-
template: `
|
|
41
|
-
<UButton>Button</UButton>
|
|
42
|
-
<ACard v-bind="args">
|
|
43
|
-
<template #header>
|
|
44
|
-
<div class="p-4">
|
|
45
|
-
<h3 class="text-lg font-semibold">Card Header</h3>
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
<div class="p-4">
|
|
49
|
-
<p>This is the card body content.</p>
|
|
50
|
-
</div>
|
|
51
|
-
<template #footer>
|
|
52
|
-
<div class="p-4">
|
|
53
|
-
<button class="px-4 py-2 bg-blue-500 text-white rounded">Action</button>
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
</ACard>
|
|
57
|
-
`,
|
|
58
|
-
}),
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const WithoutHeader: Story = {
|
|
62
|
-
render: (args) => ({
|
|
63
|
-
components: { ACard },
|
|
64
|
-
setup() {
|
|
65
|
-
return { args }
|
|
66
|
-
},
|
|
67
|
-
template: `
|
|
68
|
-
<ACard v-bind="args">
|
|
69
|
-
<div class="p-4">
|
|
70
|
-
<p>Card without header</p>
|
|
71
|
-
</div>
|
|
72
|
-
<template #footer>
|
|
73
|
-
<div class="p-4">
|
|
74
|
-
<button class="px-4 py-2 bg-blue-500 text-white rounded">Action</button>
|
|
75
|
-
</div>
|
|
76
|
-
</template>
|
|
77
|
-
</ACard>
|
|
78
|
-
`,
|
|
79
|
-
}),
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export const ExpandedBody: Story = {
|
|
83
|
-
args: {
|
|
84
|
-
hasBodyExpanded: true,
|
|
85
|
-
},
|
|
86
|
-
render: (args) => ({
|
|
87
|
-
components: { ACard },
|
|
88
|
-
setup() {
|
|
89
|
-
return { args }
|
|
90
|
-
},
|
|
91
|
-
template: `
|
|
92
|
-
<div style="height: 400px;">
|
|
93
|
-
<ACard v-bind="args">
|
|
94
|
-
<template #header>
|
|
95
|
-
<div class="p-4">
|
|
96
|
-
<h3 class="text-lg font-semibold">Expanded Card</h3>
|
|
97
|
-
</div>
|
|
98
|
-
</template>
|
|
99
|
-
<div class="p-4">
|
|
100
|
-
<p>This card has an expanded body that fills available space.</p>
|
|
101
|
-
<p class="mt-4">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
102
|
-
</div>
|
|
103
|
-
<template #footer>
|
|
104
|
-
<div class="p-4">
|
|
105
|
-
<button class="px-4 py-2 bg-blue-500 text-white rounded">Action</button>
|
|
106
|
-
</div>
|
|
107
|
-
</template>
|
|
108
|
-
</ACard>
|
|
109
|
-
</div>
|
|
110
|
-
`,
|
|
111
|
-
}),
|
|
112
|
-
}
|
|
File without changes
|