vueless 0.0.210 → 0.0.211
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/package.json +1 -1
- package/ui.container-group/configs/default.config.js +19 -1
- package/ui.container-group/index.vue +26 -1
- package/ui.container-row/configs/default.config.js +21 -3
- package/ui.container-row/index.vue +27 -2
- package/ui.data-list/composables/attrs.composable.js +39 -36
- package/ui.data-list/configs/default.config.js +6 -4
- package/ui.data-list/index.stories.js +2 -4
- package/ui.data-list/index.vue +34 -5
- package/ui.data-table/composables/attrs.composable.js +180 -245
- package/ui.data-table/configs/default.config.js +10 -10
- package/ui.data-table/index.vue +52 -12
- package/ui.form-checkbox/composables/attrs.composable.js +28 -43
- package/ui.form-checkbox/configs/default.config.js +2 -2
- package/ui.form-checkbox/index.stories.js +2 -4
- package/ui.form-checkbox/index.vue +16 -4
- package/ui.form-checkbox-group/composables/attrs.composable.js +24 -9
- package/ui.form-checkbox-group/configs/default.config.js +2 -2
- package/ui.form-checkbox-group/index.vue +8 -2
- package/ui.form-checkbox-multi-state/composables/attrs.composable.js +34 -12
- package/ui.form-checkbox-multi-state/configs/default.config.js +1 -1
- package/ui.form-checkbox-multi-state/index.vue +8 -2
- package/ui.form-input-file/composables/attrs.composable.js +19 -62
- package/ui.form-input-file/configs/default.config.js +7 -7
- package/ui.form-input-file/index.vue +15 -3
- package/ui.form-input-money/composables/attrs.composable.js +23 -4
- package/ui.form-input-money/configs/default.config.js +1 -1
- package/ui.form-input-money/index.stories.js +2 -4
- package/ui.form-input-number/composables/attrs.composable.js +22 -36
- package/ui.form-input-number/configs/default.config.js +4 -4
- package/ui.form-input-number/index.vue +8 -2
- package/ui.form-input-rating/composables/attrs.composable.js +10 -11
- package/ui.form-input-rating/index.vue +2 -2
- package/ui.form-input-search/composables/attrs.composable.js +26 -11
- package/ui.form-input-search/configs/default.config.js +4 -4
- package/ui.form-input-search/index.stories.js +2 -4
- package/ui.form-input-search/index.vue +21 -4
- package/ui.form-label/composables/attrs.composable.js +22 -49
- package/ui.form-label/index.vue +9 -2
- package/ui.form-radio/composables/attrs.composable.js +29 -22
- package/ui.form-radio/configs/default.config.js +1 -1
- package/ui.form-radio/index.stories.js +2 -4
- package/ui.form-radio/index.vue +8 -2
- package/ui.form-radio-group/composables/attrs.composable.js +20 -15
- package/ui.form-radio-group/configs/default.config.js +2 -1
- package/ui.form-radio-group/index.vue +8 -2
- package/ui.form-switch/composables/attrs.composable.js +25 -61
- package/ui.form-switch/configs/default.config.js +2 -2
- package/ui.form-switch/index.vue +8 -2
- package/ui.form-textarea/composables/attrs.composable.js +25 -36
- package/ui.form-textarea/configs/default.config.js +1 -1
- package/ui.form-textarea/index.stories.js +3 -5
- package/ui.form-textarea/index.vue +35 -4
- package/ui.navigation-pagination/composables/attrs.composable.js +41 -31
- package/ui.navigation-pagination/configs/default.config.js +2 -2
- package/ui.navigation-pagination/index.vue +22 -6
- package/ui.navigation-progress/components/StepperProgress.vue +1 -1
- package/ui.navigation-progress/composables/attrs.composable.js +19 -22
- package/ui.navigation-progress/index.vue +14 -1
- package/ui.navigation-tab/composables/attrs.composable.js +25 -20
- package/ui.navigation-tab/index.vue +1 -1
- package/ui.navigation-tabs/composables/attrs.composable.js +19 -13
- package/ui.navigation-tabs/configs/default.config.js +1 -1
- package/ui.navigation-tabs/index.vue +9 -2
- package/ui.text-file/configs/default.config.js +3 -0
- package/ui.text-file/index.vue +36 -25
- package/ui.text-files/index.vue +8 -0
- package/ui.text-header/configs/default.config.js +1 -0
- package/ui.text-header/index.stories.js +2 -2
- package/ui.text-header/index.vue +16 -12
- package/web-types.json +383 -62
|
@@ -56,7 +56,7 @@ import UIService from "../service.ui";
|
|
|
56
56
|
|
|
57
57
|
import defaultConfig from "./configs/default.config";
|
|
58
58
|
import { UInputNumber } from "./constants";
|
|
59
|
-
import
|
|
59
|
+
import useAttrs from "./composables/attrs.composable";
|
|
60
60
|
|
|
61
61
|
/* Should be a string for correct web-types gen */
|
|
62
62
|
defineOptions({ name: "UInputNumber", inheritAttrs: false });
|
|
@@ -128,7 +128,13 @@ const props = defineProps({
|
|
|
128
128
|
},
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
const emit = defineEmits([
|
|
131
|
+
const emit = defineEmits([
|
|
132
|
+
/**
|
|
133
|
+
* Triggers when the input value changes.
|
|
134
|
+
* @property {number} modelValue
|
|
135
|
+
*/
|
|
136
|
+
"update:modelValue",
|
|
137
|
+
]);
|
|
132
138
|
|
|
133
139
|
const {
|
|
134
140
|
config,
|
|
@@ -3,7 +3,7 @@ import useUI from "../../composable.ui";
|
|
|
3
3
|
import { cva } from "../../service.ui";
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
|
|
6
|
-
export function useAttrs(props) {
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
7
|
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
8
8
|
defaultConfig,
|
|
9
9
|
() => props.config,
|
|
@@ -13,18 +13,17 @@ export function useAttrs(props) {
|
|
|
13
13
|
for (const key in defaultConfig) {
|
|
14
14
|
if (isSystemKey(key)) continue;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const classes = computed(() => {
|
|
17
|
+
const value = config.value[key];
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
classes = computed(() =>
|
|
23
|
-
getCVA({
|
|
19
|
+
if (value.variants || value.compoundVariants) {
|
|
20
|
+
return cva(value)({
|
|
24
21
|
...props,
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return "";
|
|
26
|
+
});
|
|
28
27
|
|
|
29
28
|
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
30
29
|
}
|
|
@@ -58,7 +58,7 @@ import UIService from "../service.ui";
|
|
|
58
58
|
|
|
59
59
|
import { UInputRating } from "./constants";
|
|
60
60
|
import defaultConfig from "./configs/default.config";
|
|
61
|
-
import
|
|
61
|
+
import useAttrs from "./composables/attrs.composable";
|
|
62
62
|
|
|
63
63
|
/* Should be a string for correct web-types gen */
|
|
64
64
|
defineOptions({ name: "UInputRating", inheritAttrs: false });
|
|
@@ -165,7 +165,7 @@ const props = defineProps({
|
|
|
165
165
|
|
|
166
166
|
const emit = defineEmits([
|
|
167
167
|
/**
|
|
168
|
-
* Triggers when the rating
|
|
168
|
+
* Triggers when the rating value changes.
|
|
169
169
|
* @property {number} modelValue
|
|
170
170
|
*/
|
|
171
171
|
"update:modelValue",
|
|
@@ -1,21 +1,36 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../../composable.ui";
|
|
2
|
-
|
|
3
|
+
import { cva } from "../../service.ui";
|
|
3
4
|
import defaultConfig from "../configs/default.config";
|
|
4
5
|
|
|
5
|
-
export function useAttrs(props) {
|
|
6
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
8
|
+
defaultConfig,
|
|
9
|
+
() => props.config,
|
|
10
|
+
);
|
|
11
|
+
const attrs = {};
|
|
12
|
+
|
|
13
|
+
for (const key in defaultConfig) {
|
|
14
|
+
if (isSystemKey(key)) continue;
|
|
15
|
+
|
|
16
|
+
const classes = computed(() => {
|
|
17
|
+
const value = config.value[key];
|
|
18
|
+
|
|
19
|
+
if (value.variants || value.compoundVariants) {
|
|
20
|
+
return cva(value)({
|
|
21
|
+
...props,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return "";
|
|
26
|
+
});
|
|
7
27
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const closeIconAttrs = getAttrs("closeIcon", { isComponent: true });
|
|
11
|
-
const buttonAttrs = getAttrs("button", { isComponent: true });
|
|
28
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
29
|
+
}
|
|
12
30
|
|
|
13
31
|
return {
|
|
32
|
+
...attrs,
|
|
14
33
|
config,
|
|
15
|
-
inputAttrs,
|
|
16
|
-
searchIconAttrs,
|
|
17
|
-
closeIconAttrs,
|
|
18
|
-
buttonAttrs,
|
|
19
34
|
hasSlotContent,
|
|
20
35
|
};
|
|
21
36
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
input: {
|
|
3
3
|
wrapper: "relative flex items-center justify-between w-full rounded-lg bg-gray-900 bg-opacity-5",
|
|
4
|
-
input: "w-full",
|
|
4
|
+
input: "{UInput} w-full",
|
|
5
5
|
label: "w-full",
|
|
6
6
|
rightSlot: "pr-0",
|
|
7
7
|
leftSlot: "pl-0",
|
|
8
8
|
},
|
|
9
|
-
closeIcon: "flex h-full items-center mr-2",
|
|
9
|
+
closeIcon: "{UIcon} flex h-full items-center mr-2",
|
|
10
10
|
closeIconName: "close",
|
|
11
|
-
searchIcon: "mr-3",
|
|
11
|
+
searchIcon: "{UIcon} mr-3",
|
|
12
12
|
searchIconName: "search",
|
|
13
|
-
button: "rounded-l-none ml-1 !ring-0 outline outline-1 outline-gray-900",
|
|
13
|
+
button: "{UButton} rounded-l-none ml-1 !ring-0 outline outline-1 outline-gray-900",
|
|
14
14
|
defaultVariants: {
|
|
15
15
|
size: "md",
|
|
16
16
|
labelAlign: "topInside",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UInputSearch from "../ui.form-input-search";
|
|
4
4
|
import UButton from "../ui.button";
|
|
@@ -28,9 +28,7 @@ const DefaultTemplate = (args) => ({
|
|
|
28
28
|
},
|
|
29
29
|
template: `
|
|
30
30
|
<UInputSearch v-bind="args">
|
|
31
|
-
|
|
32
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
33
|
-
</template>
|
|
31
|
+
${allSlotsFragment}
|
|
34
32
|
</UInputSearch>
|
|
35
33
|
`,
|
|
36
34
|
});
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
@keyup.enter="onClickSearch"
|
|
17
17
|
>
|
|
18
18
|
<template #left>
|
|
19
|
-
<!-- @slot Use it to add something before text. -->
|
|
19
|
+
<!-- @slot Use it to add something before the text. -->
|
|
20
20
|
<slot name="left" />
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<template #right>
|
|
24
|
-
<!-- @slot Use it to add something
|
|
24
|
+
<!-- @slot Use it to add something after the text. -->
|
|
25
25
|
<slot name="right" />
|
|
26
26
|
|
|
27
27
|
<template v-if="!hasSlotContent($slots['right'])">
|
|
@@ -70,7 +70,7 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
70
70
|
|
|
71
71
|
import { UInputSearch } from "./constants";
|
|
72
72
|
import defaultConfig from "./configs/default.config";
|
|
73
|
-
import
|
|
73
|
+
import useAttrs from "./composables/attrs.composable";
|
|
74
74
|
|
|
75
75
|
/* Should be a string for correct web-types gen */
|
|
76
76
|
defineOptions({ name: "UInputSearch" });
|
|
@@ -176,7 +176,24 @@ const props = defineProps({
|
|
|
176
176
|
},
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
const emit = defineEmits([
|
|
179
|
+
const emit = defineEmits([
|
|
180
|
+
/**
|
|
181
|
+
* Triggers when the input value changes.
|
|
182
|
+
* @property {string} value
|
|
183
|
+
*/
|
|
184
|
+
"update:modelValue",
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Triggers when the input value is cleared.
|
|
188
|
+
*/
|
|
189
|
+
"clear",
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Triggers when the search button is clicked.
|
|
193
|
+
* @property {string} value
|
|
194
|
+
*/
|
|
195
|
+
"search",
|
|
196
|
+
]);
|
|
180
197
|
|
|
181
198
|
const localValue = ref("");
|
|
182
199
|
|
|
@@ -4,62 +4,35 @@ 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 } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaLabel = cva({
|
|
18
|
-
base: label.base,
|
|
19
|
-
variants: label.variants,
|
|
20
|
-
compoundVariants: label.compoundVariants,
|
|
21
|
-
});
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
11
|
+
);
|
|
12
|
+
const attrs = {};
|
|
22
13
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
variants: description.variants,
|
|
26
|
-
compoundVariants: description.compoundVariants,
|
|
27
|
-
});
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
size: props.size,
|
|
32
|
-
align: props.align,
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
error: Boolean(props.error),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
size: props.size,
|
|
48
|
-
error: Boolean(props.error),
|
|
49
|
-
align: props.align,
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
27
|
+
return "";
|
|
28
|
+
});
|
|
52
29
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const labelWrapperAttrs = getAttrs("labelWrapper");
|
|
56
|
-
const descriptionAttrs = getAttrs("description", { classes: descriptionClasses });
|
|
30
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
31
|
+
}
|
|
57
32
|
|
|
58
33
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
labelAttrs,
|
|
62
|
-
descriptionAttrs,
|
|
34
|
+
...attrs,
|
|
35
|
+
config,
|
|
63
36
|
hasSlotContent,
|
|
64
37
|
};
|
|
65
38
|
}
|
package/ui.form-label/index.vue
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
v-text="description"
|
|
26
26
|
/>
|
|
27
27
|
|
|
28
|
+
<!-- @slot Use it to add something to the label's footer -->
|
|
28
29
|
<slot name="footer" />
|
|
29
30
|
</div>
|
|
30
31
|
</div>
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
v-text="description"
|
|
51
52
|
/>
|
|
52
53
|
|
|
54
|
+
<!-- @slot Use it to add something to the label's footer -->
|
|
53
55
|
<slot name="footer" />
|
|
54
56
|
</div>
|
|
55
57
|
</template>
|
|
@@ -61,12 +63,17 @@ import UIService from "../service.ui";
|
|
|
61
63
|
|
|
62
64
|
import defaultConfig from "./configs/default.config";
|
|
63
65
|
import { ULabel, PLACEMENT } from "./constants";
|
|
64
|
-
import
|
|
66
|
+
import useAttrs from "./composables/attrs.composable";
|
|
65
67
|
|
|
66
68
|
/* Should be a string for correct web-types gen */
|
|
67
69
|
defineOptions({ name: "ULabel", inheritAttrs: false });
|
|
68
70
|
|
|
69
|
-
const emit = defineEmits([
|
|
71
|
+
const emit = defineEmits([
|
|
72
|
+
/**
|
|
73
|
+
* Triggers when the label is clicked.
|
|
74
|
+
*/
|
|
75
|
+
"click",
|
|
76
|
+
]);
|
|
70
77
|
|
|
71
78
|
const props = defineProps({
|
|
72
79
|
/**
|
|
@@ -4,31 +4,38 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
|
|
5
5
|
import defaultConfig from "../configs/default.config";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props, { radioColor, radioSize }) {
|
|
8
|
-
const { config, getAttrs, getColor, setColor } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const cvaRadio = cva({
|
|
12
|
-
base: radio.base,
|
|
13
|
-
variants: radio.variants,
|
|
14
|
-
compoundVariants: radio.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const radioClasses = computed(() =>
|
|
18
|
-
setColor(
|
|
19
|
-
cvaRadio({
|
|
20
|
-
color: getColor(radioColor.value),
|
|
21
|
-
size: radioSize.value,
|
|
22
|
-
}),
|
|
23
|
-
radioColor.value,
|
|
24
|
-
),
|
|
7
|
+
export default function useAttrs(props, { radioColor, radioSize }) {
|
|
8
|
+
const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
25
11
|
);
|
|
12
|
+
const attrs = {};
|
|
26
13
|
|
|
27
|
-
const
|
|
28
|
-
|
|
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(radioColor.value),
|
|
25
|
+
size: radioSize.value,
|
|
26
|
+
}),
|
|
27
|
+
radioColor.value,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return "";
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
35
|
+
}
|
|
29
36
|
|
|
30
37
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
...attrs,
|
|
39
|
+
config,
|
|
33
40
|
};
|
|
34
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 URadio from "../ui.form-radio";
|
|
4
4
|
import UBadge from "../ui.text-badge";
|
|
@@ -30,9 +30,7 @@ const DefaultTemplate = (args) => ({
|
|
|
30
30
|
},
|
|
31
31
|
template: `
|
|
32
32
|
<URadio v-bind="args">
|
|
33
|
-
|
|
34
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
35
|
-
</template>
|
|
33
|
+
${allSlotsFragment}
|
|
36
34
|
</URadio>
|
|
37
35
|
`,
|
|
38
36
|
});
|
package/ui.form-radio/index.vue
CHANGED
|
@@ -36,7 +36,7 @@ import ULabel from "../ui.form-label";
|
|
|
36
36
|
import UIService, { getRandomId } from "../service.ui";
|
|
37
37
|
|
|
38
38
|
import defaultConfig from "./configs/default.config";
|
|
39
|
-
import
|
|
39
|
+
import useAttrs from "./composables/attrs.composable";
|
|
40
40
|
import { URadio } from "./constants";
|
|
41
41
|
|
|
42
42
|
/* Should be a string for correct web-types gen */
|
|
@@ -158,7 +158,13 @@ const props = defineProps({
|
|
|
158
158
|
},
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
const emit = defineEmits([
|
|
161
|
+
const emit = defineEmits([
|
|
162
|
+
/**
|
|
163
|
+
* Triggers when the value attribute changes.
|
|
164
|
+
* @property {string} value
|
|
165
|
+
*/
|
|
166
|
+
"update:modelValue",
|
|
167
|
+
]);
|
|
162
168
|
|
|
163
169
|
const localValue = ref("");
|
|
164
170
|
const radioName = ref(null);
|
|
@@ -5,25 +5,30 @@ import useUI from "../../composable.ui";
|
|
|
5
5
|
|
|
6
6
|
import defaultConfig from "../configs/default.config";
|
|
7
7
|
|
|
8
|
-
export function useAttrs(props) {
|
|
9
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
10
|
-
const
|
|
8
|
+
export default function useAttrs(props) {
|
|
9
|
+
const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
|
|
10
|
+
const attrs = {};
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
variants: list.variants,
|
|
15
|
-
compoundVariants: list.compoundVariants,
|
|
16
|
-
});
|
|
12
|
+
for (const key in defaultConfig) {
|
|
13
|
+
if (isSystemKey(key)) continue;
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
const classes = computed(() => {
|
|
16
|
+
const value = config.value[key];
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (value.variants || value.compoundVariants) {
|
|
19
|
+
return cva(value)({
|
|
20
|
+
...props,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return "";
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
radioAttrs,
|
|
31
|
+
...attrs,
|
|
32
|
+
config,
|
|
28
33
|
};
|
|
29
34
|
}
|
|
@@ -36,7 +36,7 @@ import UIService from "../service.ui";
|
|
|
36
36
|
|
|
37
37
|
import defaultConfig from "./configs/default.config";
|
|
38
38
|
import { URadioGroup } from "./constants";
|
|
39
|
-
import
|
|
39
|
+
import useAttrs from "./composables/attrs.composable";
|
|
40
40
|
|
|
41
41
|
/* Should be a string for correct web-types gen */
|
|
42
42
|
defineOptions({ name: "URadioGroup", inheritAttrs: false });
|
|
@@ -133,7 +133,13 @@ const props = defineProps({
|
|
|
133
133
|
},
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
const emit = defineEmits([
|
|
136
|
+
const emit = defineEmits([
|
|
137
|
+
/**
|
|
138
|
+
* Triggers when the value attribute changes.
|
|
139
|
+
* @property {string} value
|
|
140
|
+
*/
|
|
141
|
+
"update:modelValue",
|
|
142
|
+
]);
|
|
137
143
|
|
|
138
144
|
const { labelAttrs, listAttrs, radioAttrs } = useAttrs(props);
|
|
139
145
|
|
|
@@ -4,74 +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, { checked }) {
|
|
8
|
-
const { config, getAttrs, getColor, setColor } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaCircle = cva({
|
|
18
|
-
base: circle.base,
|
|
19
|
-
variants: circle.variants,
|
|
20
|
-
compoundVariants: circle.compoundVariants,
|
|
21
|
-
});
|
|
7
|
+
export default function useAttrs(props, { checked }) {
|
|
8
|
+
const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
11
|
+
);
|
|
12
|
+
const attrs = {};
|
|
22
13
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
variants: toggleLabel.variants,
|
|
26
|
-
compoundVariants: toggleLabel.compoundVariants,
|
|
27
|
-
});
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
cvaWrapper({
|
|
32
|
-
size: props.size,
|
|
33
|
-
color: getColor(props.color),
|
|
34
|
-
disabled: props.disabled,
|
|
35
|
-
checked: Boolean(checked.value),
|
|
36
|
-
toggleLabel: props.toggleLabel,
|
|
37
|
-
}),
|
|
38
|
-
props.color,
|
|
39
|
-
),
|
|
40
|
-
);
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
41
19
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return setColor(
|
|
22
|
+
cva(value)({
|
|
23
|
+
...props,
|
|
24
|
+
color: getColor(props.color),
|
|
25
|
+
checked: Boolean(checked.value),
|
|
26
|
+
}),
|
|
27
|
+
props.color,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
48
30
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cvaToggleLabel({
|
|
52
|
-
size: props.size,
|
|
53
|
-
color: getColor(props.color),
|
|
54
|
-
toggleLabel: props.toggleLabel,
|
|
55
|
-
checked: Boolean(checked.value),
|
|
56
|
-
}),
|
|
57
|
-
props.color,
|
|
58
|
-
),
|
|
59
|
-
);
|
|
31
|
+
return "";
|
|
32
|
+
});
|
|
60
33
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const inputAttrs = getAttrs("input");
|
|
64
|
-
const circleAttrs = getAttrs("circle", { classes: circleClasses });
|
|
65
|
-
const iconAttrs = getAttrs("icon", { isComponent: true });
|
|
66
|
-
const toggleLabelAttrs = getAttrs("toggleLabel", { classes: toggleLabelClasses });
|
|
34
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
35
|
+
}
|
|
67
36
|
|
|
68
37
|
return {
|
|
38
|
+
...attrs,
|
|
69
39
|
config,
|
|
70
|
-
iconAttrs,
|
|
71
|
-
labelAttrs,
|
|
72
|
-
wrapperAttrs,
|
|
73
|
-
circleAttrs,
|
|
74
|
-
toggleLabelAttrs,
|
|
75
|
-
inputAttrs,
|
|
76
40
|
};
|
|
77
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
label: "flex items-start",
|
|
2
|
+
label: "{ULabel} flex items-start",
|
|
3
3
|
wrapper: {
|
|
4
4
|
base: `
|
|
5
5
|
transition duration-300
|
|
@@ -42,7 +42,7 @@ export default /*tw*/ {
|
|
|
42
42
|
{ checked: true, size: "lg", class: "ml-[calc(100%-1.5rem)]" },
|
|
43
43
|
],
|
|
44
44
|
},
|
|
45
|
-
icon: "",
|
|
45
|
+
icon: "{UIcon}",
|
|
46
46
|
selectedIconName: "check",
|
|
47
47
|
unselectedIconName: "close",
|
|
48
48
|
toggleLabel: {
|
package/ui.form-switch/index.vue
CHANGED
|
@@ -47,7 +47,7 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
47
47
|
|
|
48
48
|
import { USwitch } from "./constants";
|
|
49
49
|
import defaultConfig from "./configs/default.config";
|
|
50
|
-
import
|
|
50
|
+
import useAttrs from "./composables/attrs.composable";
|
|
51
51
|
import { useLocale } from "../composable.locale";
|
|
52
52
|
|
|
53
53
|
/* Should be a string for correct web-types gen */
|
|
@@ -154,7 +154,13 @@ const props = defineProps({
|
|
|
154
154
|
},
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
const emit = defineEmits([
|
|
157
|
+
const emit = defineEmits([
|
|
158
|
+
/**
|
|
159
|
+
* Triggers when switch value changes.
|
|
160
|
+
* @property {Boolean} value
|
|
161
|
+
*/
|
|
162
|
+
"update:modelValue",
|
|
163
|
+
]);
|
|
158
164
|
|
|
159
165
|
const { tm } = useLocale();
|
|
160
166
|
|