vueless 0.0.200 → 0.0.202
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/composable.ui/index.js +3 -2
- package/package.json +2 -2
- package/service.storybook/index.js +1 -1
- package/ui.button/composables/attrs.composable.js +6 -2
- package/ui.button/configs/default.config.js +14 -2
- package/ui.button/index.stories.js +27 -3
- package/ui.button/index.vue +70 -27
- package/ui.button-link/composables/attrs.composable.js +64 -130
- package/ui.button-link/index.stories.js +2 -4
- package/ui.button-link/index.vue +29 -4
- package/ui.button-toggle/composables/attrs.composable.js +21 -33
- package/ui.button-toggle/configs/default.config.js +2 -2
- package/ui.button-toggle/index.vue +8 -2
- package/ui.button-toggle-item/composables/attrs.composable.js +50 -40
- package/ui.button-toggle-item/configs/default.config.js +1 -1
- package/ui.button-toggle-item/index.stories.js +2 -4
- package/ui.button-toggle-item/index.vue +11 -3
- package/ui.dropdown-badge/composables/attrs.composable.js +45 -45
- package/ui.dropdown-badge/configs/default.config.js +3 -3
- package/ui.dropdown-badge/index.stories.js +2 -4
- package/ui.dropdown-badge/index.vue +8 -2
- package/ui.dropdown-button/composables/attrs.composable.js +45 -45
- package/ui.dropdown-button/configs/default.config.js +3 -3
- package/ui.dropdown-button/index.stories.js +2 -4
- package/ui.dropdown-button/index.vue +8 -2
- package/ui.dropdown-item/index.vue +7 -1
- package/ui.dropdown-link/composables/attrs.composable.js +43 -45
- package/ui.dropdown-link/configs/default.config.js +3 -3
- package/ui.dropdown-link/index.stories.js +2 -4
- package/ui.dropdown-link/index.vue +8 -2
- package/ui.dropdown-list/composables/attrs.composable.js +43 -67
- package/ui.dropdown-list/configs/default.config.js +2 -2
- package/ui.dropdown-list/index.vue +19 -3
- package/ui.form-calendar/components/DayView.vue +4 -4
- package/ui.form-calendar/composables/attrs.composable.js +5 -4
- package/ui.form-input/composables/attrs.composable.js +31 -48
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-input/index.stories.js +32 -9
- package/ui.form-input/index.vue +92 -41
- package/ui.navigation-progress/components/StepperProgress.vue +87 -0
- package/ui.navigation-progress/composables/attrs.composable.js +33 -56
- package/ui.navigation-progress/configs/default.config.js +34 -1
- package/ui.navigation-progress/constants/index.js +5 -0
- package/ui.navigation-progress/index.stories.js +3 -0
- package/ui.navigation-progress/index.vue +55 -9
- package/ui.text-alert/composables/attrs.composable.js +23 -39
- package/ui.text-alert/configs/default.config.js +3 -3
- package/ui.text-alert/index.vue +19 -8
- package/ui.text-badge/composables/attrs.composable.js +25 -36
- package/ui.text-badge/index.stories.js +2 -4
- package/ui.text-badge/index.vue +22 -2
- package/ui.text-block/composables/attrs.composable.js +24 -20
- package/ui.text-block/index.vue +1 -1
- package/ui.text-empty/composables/attrs.composable.js +17 -27
- package/ui.text-empty/configs/default.config.js +1 -1
- package/ui.text-empty/index.stories.js +2 -4
- package/ui.text-empty/index.vue +1 -1
- package/ui.text-header/composables/attrs.composable.js +28 -22
- package/ui.text-header/index.stories.js +1 -1
- package/ui.text-header/index.vue +1 -1
- package/ui.text-money/composables/attrs.composable.js +21 -48
- package/ui.text-money/index.stories.js +2 -4
- package/web-types.json +326 -145
- package/ui.navigation-stepper/Docs.mdx +0 -16
- package/ui.navigation-stepper/composables/attrs.composable.js +0 -25
- package/ui.navigation-stepper/configs/default.config.js +0 -13
- package/ui.navigation-stepper/constants/index.js +0 -5
- package/ui.navigation-stepper/index.stories.js +0 -33
- package/ui.navigation-stepper/index.vue +0 -126
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg width="100%" height="100%" viewBox="0 0 40 40" v-bind="stepperSvgAttrs">
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="0%" v-bind="stepperGradientAttrs">
|
|
5
|
+
<stop offset="0%" :stop-color="stepperColor" />
|
|
6
|
+
<stop offset="100%" :stop-color="stepperColor" />
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
|
|
10
|
+
<circle
|
|
11
|
+
cx="20"
|
|
12
|
+
cy="20"
|
|
13
|
+
r="15.91549430918954"
|
|
14
|
+
fill="transparent"
|
|
15
|
+
stroke-width="4"
|
|
16
|
+
v-bind="stepperCircleAttrs"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<circle
|
|
20
|
+
cx="20"
|
|
21
|
+
cy="20"
|
|
22
|
+
r="15.91549430918954"
|
|
23
|
+
fill="transparent"
|
|
24
|
+
stroke="url(#gradient)"
|
|
25
|
+
stroke-width="4"
|
|
26
|
+
:stroke-dasharray="progressPercent"
|
|
27
|
+
stroke-dashoffset="0"
|
|
28
|
+
/>
|
|
29
|
+
<g v-bind="stepperCountAttrs">
|
|
30
|
+
<text y="45%" transform="translate(0, 2)">
|
|
31
|
+
<tspan x="50%" text-anchor="middle">{{ value }}</tspan>
|
|
32
|
+
</text>
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup>
|
|
38
|
+
import colors from "tailwindcss/colors";
|
|
39
|
+
import { computed } from "vue";
|
|
40
|
+
|
|
41
|
+
import { GRAY_COLORS } from "../../preset.tailwind/constants";
|
|
42
|
+
|
|
43
|
+
import { useAttrs } from "../composables/attrs.composable";
|
|
44
|
+
|
|
45
|
+
const props = defineProps({
|
|
46
|
+
progressPercent: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
value: {
|
|
52
|
+
type: Number,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
color: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
max: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: null,
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
config: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({}),
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
dataCy: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: "",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const { stepperCircleAttrs, stepperCountAttrs, stepperGradientAttrs, stepperSvgAttrs } =
|
|
78
|
+
useAttrs(props);
|
|
79
|
+
|
|
80
|
+
const stepperColor = computed(() => {
|
|
81
|
+
return colors[props.color]
|
|
82
|
+
? colors[props.color][500]
|
|
83
|
+
: GRAY_COLORS.includes(props.color)
|
|
84
|
+
? colors[props.color][900]
|
|
85
|
+
: colors.zinc[900];
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
@@ -5,72 +5,49 @@ import defaultConfig from "../configs/default.config";
|
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
7
|
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, getColor, setColor } = useUI(
|
|
9
|
-
|
|
8
|
+
const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
11
|
+
);
|
|
12
|
+
const attrs = {};
|
|
10
13
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: progress.variants,
|
|
14
|
-
compoundVariants: progress.compoundVariants,
|
|
15
|
-
});
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variants: indicator.variants,
|
|
20
|
-
compoundVariants: indicator.compoundVariants,
|
|
21
|
-
});
|
|
17
|
+
let classes = "";
|
|
18
|
+
let value = config.value[key];
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
variants: step.variants,
|
|
26
|
-
compoundVariants: step.compoundVariants,
|
|
27
|
-
});
|
|
20
|
+
const isVariants = value.variants || value.compoundVariants;
|
|
21
|
+
const excludeKeys = ["progress", "indicator", "step"];
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
cvaProgress({
|
|
32
|
-
size: props.size,
|
|
33
|
-
color: getColor(props.color),
|
|
34
|
-
}),
|
|
35
|
-
props.color,
|
|
36
|
-
),
|
|
37
|
-
);
|
|
23
|
+
if (isVariants && !excludeKeys.includes(key)) {
|
|
24
|
+
const getCVA = cva(value);
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
cvaIndicator({
|
|
42
|
-
size: props.size,
|
|
43
|
-
color: getColor(props.color),
|
|
44
|
-
}),
|
|
45
|
-
props.color,
|
|
46
|
-
),
|
|
47
|
-
);
|
|
26
|
+
classes = computed(() => getCVA({ ...props }));
|
|
27
|
+
}
|
|
48
28
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
color: getColor(props.color),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
),
|
|
57
|
-
);
|
|
29
|
+
if (isVariants && excludeKeys.includes(key)) {
|
|
30
|
+
const getCVA = cva(value);
|
|
31
|
+
|
|
32
|
+
classes = computed(() =>
|
|
33
|
+
setColor(getCVA({ ...props, color: getColor(props.color) }), props.color),
|
|
34
|
+
);
|
|
35
|
+
}
|
|
58
36
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const progressAttrs = getAttrs("progress", { classes: progressClasses });
|
|
62
|
-
const stepAttrsRaw = getAttrs("step", { classes: stepClasses });
|
|
37
|
+
if (key === "step") {
|
|
38
|
+
const stepAttrsRaw = getAttrs("step", { classes });
|
|
63
39
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
40
|
+
attrs[`${key}Attrs`] = computed(() => (classes) => ({
|
|
41
|
+
...stepAttrsRaw.value,
|
|
42
|
+
class: cx([stepAttrsRaw.value.class, classes]),
|
|
43
|
+
}));
|
|
44
|
+
} else {
|
|
45
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
68
48
|
|
|
69
49
|
return {
|
|
70
|
-
|
|
71
|
-
wrapperAttrs,
|
|
72
|
-
indicatorAttrs,
|
|
73
|
-
stepAttrs,
|
|
50
|
+
...attrs,
|
|
74
51
|
config,
|
|
75
52
|
};
|
|
76
53
|
}
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
wrapper:
|
|
2
|
+
wrapper: {
|
|
3
|
+
base: "",
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
progress: "w-full h-auto flex flex-col gap-1.5",
|
|
7
|
+
stepper: "flex items-center justify-between",
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
stepper: {
|
|
12
|
+
base: "",
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
"2xs": "h-8 w-8",
|
|
16
|
+
xs: "h-8 w-8",
|
|
17
|
+
sm: "h-10 w-10",
|
|
18
|
+
md: "h-12 w-12",
|
|
19
|
+
lg: "h-14 w-14",
|
|
20
|
+
xl: "h-16 w-16",
|
|
21
|
+
"2xl": "h-20 w-20",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
stepperCircle: "stroke-current text-gray-100",
|
|
26
|
+
stepperCount: "text-xl font-bold text-gray-900 translate-y-2 transform",
|
|
27
|
+
stepperGradient: "",
|
|
28
|
+
stepperSvg: "",
|
|
3
29
|
progress: {
|
|
4
30
|
base: `
|
|
5
31
|
text-{color}-500 w-full block appearance-none border-none overflow-hidden
|
|
@@ -35,6 +61,7 @@ export default /*tw*/ {
|
|
|
35
61
|
grayscale: "text-gray-900",
|
|
36
62
|
},
|
|
37
63
|
size: {
|
|
64
|
+
"2xs": "text-xs",
|
|
38
65
|
xs: "text-xs",
|
|
39
66
|
sm: "text-sm",
|
|
40
67
|
md: "text-md",
|
|
@@ -48,11 +75,16 @@ export default /*tw*/ {
|
|
|
48
75
|
step: {
|
|
49
76
|
base: "text-{color}-500 flex justify-end w-full transition",
|
|
50
77
|
variants: {
|
|
78
|
+
variant: {
|
|
79
|
+
progress: "justify-end",
|
|
80
|
+
stepper: "justify-start",
|
|
81
|
+
},
|
|
51
82
|
color: {
|
|
52
83
|
white: "text-gray-200",
|
|
53
84
|
grayscale: "text-gray-900",
|
|
54
85
|
},
|
|
55
86
|
size: {
|
|
87
|
+
"2xs": "text-xs",
|
|
56
88
|
xs: "text-xs",
|
|
57
89
|
sm: "text-sm",
|
|
58
90
|
md: "text-md",
|
|
@@ -65,6 +97,7 @@ export default /*tw*/ {
|
|
|
65
97
|
defaultVariants: {
|
|
66
98
|
color: "brand",
|
|
67
99
|
size: "md",
|
|
100
|
+
variant: "progress",
|
|
68
101
|
indicator: false,
|
|
69
102
|
},
|
|
70
103
|
safelist: (colors) => [{ pattern: `text-(${colors})-500` }],
|
|
@@ -129,6 +129,9 @@ const SizesTemplate = (args, { argTypes } = {}) => ({
|
|
|
129
129
|
export const Default = DefaultTemplate.bind({});
|
|
130
130
|
Default.args = {};
|
|
131
131
|
|
|
132
|
+
export const Variant = StepsTemplate.bind({});
|
|
133
|
+
Variant.args = { variant: "stepper" };
|
|
134
|
+
|
|
132
135
|
export const Indicator = DefaultTemplate.bind({});
|
|
133
136
|
Indicator.args = { indicator: true };
|
|
134
137
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-bind="wrapperAttrs">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
<template v-if="isVariant.progress">
|
|
4
|
+
<div v-if="indicator" v-bind="indicatorAttrs" :style="{ width: progressPercent }">
|
|
5
|
+
<slot name="indicator" :percent="progressPercent" :value="value" :max="realMax">
|
|
6
|
+
{{ progressPercent }}
|
|
7
|
+
</slot>
|
|
8
|
+
</div>
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
<progress v-bind="progressAttrs" :max="realMax" :value="value" />
|
|
11
|
+
</template>
|
|
10
12
|
|
|
11
13
|
<div v-if="isSteps" v-bind="stepAttrs(!value && config.firstStep)">
|
|
12
14
|
<template v-for="(step, index) in max" :key="index">
|
|
@@ -21,6 +23,16 @@
|
|
|
21
23
|
</slot>
|
|
22
24
|
</template>
|
|
23
25
|
</div>
|
|
26
|
+
|
|
27
|
+
<StepperProgress
|
|
28
|
+
v-if="isVariant.stepper"
|
|
29
|
+
v-bind="stepperAttrs"
|
|
30
|
+
:color="color"
|
|
31
|
+
:max="realMax"
|
|
32
|
+
:value="value"
|
|
33
|
+
:data-cy="dataCy"
|
|
34
|
+
:progress-percent="progressPercent"
|
|
35
|
+
/>
|
|
24
36
|
</div>
|
|
25
37
|
</template>
|
|
26
38
|
|
|
@@ -31,7 +43,9 @@ import UIService from "../service.ui";
|
|
|
31
43
|
import { useAttrs } from "./composables/attrs.composable";
|
|
32
44
|
|
|
33
45
|
import defaultConfig from "./configs/default.config";
|
|
34
|
-
import { UProgress } from "./constants";
|
|
46
|
+
import { UProgress, VARIANT } from "./constants";
|
|
47
|
+
|
|
48
|
+
import StepperProgress from "./components/StepperProgress.vue";
|
|
35
49
|
|
|
36
50
|
/* Should be a string for correct web-types gen */
|
|
37
51
|
defineOptions({ name: "UProgress", inheritAttrs: false });
|
|
@@ -72,6 +86,15 @@ const props = defineProps({
|
|
|
72
86
|
default: UIService.get(defaultConfig, UProgress).default.color,
|
|
73
87
|
},
|
|
74
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Progress variant.
|
|
91
|
+
* @values stepper, progress
|
|
92
|
+
*/
|
|
93
|
+
variant: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: UIService.get(defaultConfig, UProgress).default.variant,
|
|
96
|
+
},
|
|
97
|
+
|
|
75
98
|
/**
|
|
76
99
|
* Progress indicator visibility.
|
|
77
100
|
*/
|
|
@@ -79,9 +102,18 @@ const props = defineProps({
|
|
|
79
102
|
type: Boolean,
|
|
80
103
|
default: UIService.get(defaultConfig, UProgress).default.indicator,
|
|
81
104
|
},
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Sets data-cy attribute for automated testing.
|
|
108
|
+
*/
|
|
109
|
+
dataCy: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: "",
|
|
112
|
+
},
|
|
82
113
|
});
|
|
83
114
|
|
|
84
|
-
const { progressAttrs, wrapperAttrs, indicatorAttrs, stepAttrs, config } =
|
|
115
|
+
const { progressAttrs, wrapperAttrs, indicatorAttrs, stepAttrs, stepperAttrs, config } =
|
|
116
|
+
useAttrs(props);
|
|
85
117
|
|
|
86
118
|
const isSteps = computed(() => Array.isArray(props.max));
|
|
87
119
|
|
|
@@ -93,7 +125,21 @@ const realMax = computed(() => {
|
|
|
93
125
|
return Number(props.max);
|
|
94
126
|
});
|
|
95
127
|
|
|
96
|
-
const
|
|
128
|
+
const isVariant = computed(() => ({
|
|
129
|
+
stepper: props.variant === VARIANT.stepper,
|
|
130
|
+
progress: props.variant === VARIANT.progress,
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
const progressPercent = computed(() => {
|
|
134
|
+
const maxPercent = 100;
|
|
135
|
+
const currentPercent = (props.value / realMax.value) * maxPercent;
|
|
136
|
+
|
|
137
|
+
if (isVariant.value.progress) {
|
|
138
|
+
return `${currentPercent}%`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return `${currentPercent} ${maxPercent}`;
|
|
142
|
+
});
|
|
97
143
|
|
|
98
144
|
function isActiveStep(index) {
|
|
99
145
|
return index + 1 == props.value;
|
|
@@ -4,54 +4,38 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent, getColor, setColor } = useUI(
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, getColor, setColor, isSystemKey } = useUI(
|
|
9
9
|
defaultConfig,
|
|
10
10
|
() => props.config,
|
|
11
11
|
);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const cvaBody = cva({
|
|
21
|
-
base: body.base,
|
|
22
|
-
variants: body.variants,
|
|
23
|
-
compoundVariants: body.compoundVariants,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const wrapperClasses = computed(() =>
|
|
27
|
-
setColor(
|
|
28
|
-
cvaWrapper({
|
|
29
|
-
color: getColor(props.color),
|
|
30
|
-
bordered: props.bordered,
|
|
31
|
-
variant: props.variant,
|
|
32
|
-
}),
|
|
33
|
-
props.color,
|
|
34
|
-
),
|
|
35
|
-
);
|
|
12
|
+
const attrs = {};
|
|
13
|
+
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
16
|
+
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
36
19
|
|
|
37
|
-
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return setColor(
|
|
22
|
+
cva(value)({
|
|
23
|
+
...props,
|
|
24
|
+
color: getColor(props.color),
|
|
25
|
+
}),
|
|
26
|
+
props.color,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const titleAttrs = getAttrs("title");
|
|
42
|
-
const descriptionAttrs = getAttrs("description");
|
|
30
|
+
return "";
|
|
31
|
+
});
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
34
|
+
}
|
|
46
35
|
|
|
47
36
|
return {
|
|
37
|
+
...attrs,
|
|
48
38
|
config,
|
|
49
|
-
wrapperAttrs,
|
|
50
|
-
bodyAttrs,
|
|
51
|
-
buttonAttrs,
|
|
52
|
-
iconAttrs,
|
|
53
39
|
hasSlotContent,
|
|
54
|
-
titleAttrs,
|
|
55
|
-
descriptionAttrs,
|
|
56
40
|
};
|
|
57
41
|
}
|
|
@@ -17,7 +17,7 @@ export default /*tw*/ {
|
|
|
17
17
|
base: `
|
|
18
18
|
flex gap-2 items-baseline
|
|
19
19
|
font-normal leading-normal
|
|
20
|
-
[&_b]:font-bold [&
|
|
20
|
+
[&_b]:font-bold [&_i]:italic [&_em]:italic [&_p]:font-normal
|
|
21
21
|
[&_a:not([class])]:underline [&_a:not([class])]:underline-offset-4
|
|
22
22
|
[&_a:not([class]):hover]:no-underline [&_a:not([class])]:font-bold
|
|
23
23
|
[&_ul]:font-normal [&_ol]:font-normal
|
|
@@ -36,8 +36,8 @@ export default /*tw*/ {
|
|
|
36
36
|
},
|
|
37
37
|
title: "font-bold text-lg leading-tight",
|
|
38
38
|
description: "text-sm",
|
|
39
|
-
button: "",
|
|
40
|
-
icon: "",
|
|
39
|
+
button: "{UButton}",
|
|
40
|
+
icon: "{UIcon}",
|
|
41
41
|
iconName: "close",
|
|
42
42
|
defaultVariants: {
|
|
43
43
|
variant: "thirdary",
|
package/ui.text-alert/index.vue
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="isShownAlert" :data-cy="dataCy" v-bind="wrapperAttrs">
|
|
3
|
-
<!-- @slot Use it to add something above text. -->
|
|
3
|
+
<!-- @slot Use it to add something above the text. -->
|
|
4
4
|
<slot name="top" />
|
|
5
5
|
|
|
6
|
-
<!--
|
|
6
|
+
<!--
|
|
7
|
+
@slot Use it to add something instead of the title.
|
|
8
|
+
@binding {string} title
|
|
9
|
+
-->
|
|
7
10
|
<slot name="title" :title="title">
|
|
8
11
|
<div v-bind="titleAttrs" v-text="title" />
|
|
9
12
|
</slot>
|
|
10
13
|
|
|
11
|
-
<!--
|
|
14
|
+
<!--
|
|
15
|
+
@slot Use it to add something instead of the description.
|
|
16
|
+
@binding {string} description
|
|
17
|
+
-->
|
|
12
18
|
<slot name="description" :description="description">
|
|
13
19
|
<div v-bind="descriptionAttrs" v-text="description" />
|
|
14
20
|
</slot>
|
|
15
21
|
|
|
16
22
|
<div v-bind="bodyAttrs">
|
|
17
|
-
<!-- @slot Use it to add something before text. -->
|
|
23
|
+
<!-- @slot Use it to add something before the text. -->
|
|
18
24
|
<slot name="left" />
|
|
19
25
|
|
|
20
26
|
<!-- @slot Default slot. -->
|
|
@@ -40,11 +46,11 @@
|
|
|
40
46
|
/>
|
|
41
47
|
</UButton>
|
|
42
48
|
|
|
43
|
-
<!-- @slot Use it to add something after text. -->
|
|
49
|
+
<!-- @slot Use it to add something after the text. -->
|
|
44
50
|
<slot name="right" />
|
|
45
51
|
</div>
|
|
46
52
|
|
|
47
|
-
<!-- @slot Use it to add something under text. -->
|
|
53
|
+
<!-- @slot Use it to add something under the text. -->
|
|
48
54
|
<slot name="bottom" />
|
|
49
55
|
</div>
|
|
50
56
|
</template>
|
|
@@ -58,7 +64,7 @@ import UIService from "../service.ui";
|
|
|
58
64
|
|
|
59
65
|
import { UAlert } from "./constatns";
|
|
60
66
|
import defaultConfig from "./configs/default.config";
|
|
61
|
-
import
|
|
67
|
+
import useAttrs from "./composables/attrs.composable";
|
|
62
68
|
|
|
63
69
|
/* Should be a string for correct web-types gen */
|
|
64
70
|
defineOptions({ name: "UAlert" });
|
|
@@ -155,7 +161,12 @@ const props = defineProps({
|
|
|
155
161
|
},
|
|
156
162
|
});
|
|
157
163
|
|
|
158
|
-
const emit = defineEmits([
|
|
164
|
+
const emit = defineEmits([
|
|
165
|
+
/**
|
|
166
|
+
* Triggers when the alert is hidden.
|
|
167
|
+
*/
|
|
168
|
+
"hidden",
|
|
169
|
+
]);
|
|
159
170
|
|
|
160
171
|
const isShownAlert = ref(true);
|
|
161
172
|
|
|
@@ -4,49 +4,38 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent, getColor, setColor } = useUI(
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, getColor, setColor, isSystemKey } = useUI(
|
|
9
9
|
defaultConfig,
|
|
10
10
|
() => props.config,
|
|
11
11
|
);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const cvaWrapper = cva({
|
|
15
|
-
base: wrapper.base,
|
|
16
|
-
variants: wrapper.variants,
|
|
17
|
-
compoundVariants: wrapper.compoundVariants,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const cvaBody = cva({
|
|
21
|
-
base: body.base,
|
|
22
|
-
variants: body.variants,
|
|
23
|
-
compoundVariants: body.compoundVariants,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const wrapperClasses = computed(() =>
|
|
27
|
-
setColor(
|
|
28
|
-
cvaWrapper({
|
|
29
|
-
variant: props.variant,
|
|
30
|
-
size: props.size,
|
|
31
|
-
color: getColor(props.color),
|
|
32
|
-
weight: props.weight,
|
|
33
|
-
}),
|
|
34
|
-
props.color,
|
|
35
|
-
),
|
|
36
|
-
);
|
|
12
|
+
const attrs = {};
|
|
37
13
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
16
|
+
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
19
|
+
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return setColor(
|
|
22
|
+
cva(value)({
|
|
23
|
+
...props,
|
|
24
|
+
color: getColor(props.color),
|
|
25
|
+
}),
|
|
26
|
+
props.color,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return "";
|
|
31
|
+
});
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
34
|
+
}
|
|
46
35
|
|
|
47
36
|
return {
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
...attrs,
|
|
38
|
+
config,
|
|
50
39
|
hasSlotContent,
|
|
51
40
|
};
|
|
52
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UBadge from "../ui.text-badge";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -29,9 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
},
|
|
30
30
|
template: `
|
|
31
31
|
<UBadge v-bind="args">
|
|
32
|
-
|
|
33
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
34
|
-
</template>
|
|
32
|
+
${allSlotsFragment}
|
|
35
33
|
</UBadge>
|
|
36
34
|
`,
|
|
37
35
|
});
|
package/ui.text-badge/index.vue
CHANGED
|
@@ -32,7 +32,7 @@ import { ref } from "vue";
|
|
|
32
32
|
import UIService from "../service.ui";
|
|
33
33
|
|
|
34
34
|
import { UBadge } from "./constants";
|
|
35
|
-
import
|
|
35
|
+
import useAttrs from "./composables/attrs.composable";
|
|
36
36
|
import defaultConfig from "./configs/default.config";
|
|
37
37
|
|
|
38
38
|
/* Should be a string for correct web-types gen */
|
|
@@ -101,7 +101,27 @@ const props = defineProps({
|
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
const emit = defineEmits([
|
|
104
|
+
const emit = defineEmits([
|
|
105
|
+
/**
|
|
106
|
+
* Triggers when the badge is focused.
|
|
107
|
+
*/
|
|
108
|
+
"focus",
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Triggers when the badge is pressed.
|
|
112
|
+
*/
|
|
113
|
+
"keydown",
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Triggers when the badge loses focus.
|
|
117
|
+
*/
|
|
118
|
+
"blur",
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Triggers when the badge is clicked.
|
|
122
|
+
*/
|
|
123
|
+
"click",
|
|
124
|
+
]);
|
|
105
125
|
|
|
106
126
|
const { bodyAttrs, wrapperAttrs, hasSlotContent } = useAttrs(props);
|
|
107
127
|
|