vueless 0.0.188 → 0.0.190
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/service.ui/index.js +18 -0
- package/ui.container-accordion/composables/attrs.composable.js +27 -50
- package/ui.container-accordion/index.stories.js +1 -1
- package/ui.form-select/composables/attrs.composable.js +99 -167
- package/ui.form-select/configs/default.config.js +2 -0
- package/web-types.json +1 -1
package/package.json
CHANGED
package/service.ui/index.js
CHANGED
|
@@ -212,6 +212,23 @@ export default class UIService {
|
|
|
212
212
|
setColor(classes, color) {
|
|
213
213
|
return classes?.replaceAll("{color}", color);
|
|
214
214
|
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
Check is config key not contains classes or CVA config object.
|
|
218
|
+
@param { String } key
|
|
219
|
+
@returns { Boolean }
|
|
220
|
+
*/
|
|
221
|
+
isSystemKey(key) {
|
|
222
|
+
return (
|
|
223
|
+
key === "i18n" ||
|
|
224
|
+
key === "strategy" ||
|
|
225
|
+
key === "safelist" ||
|
|
226
|
+
key === "safelistColors" ||
|
|
227
|
+
key === "defaultVariants" ||
|
|
228
|
+
key.includes("iconName") ||
|
|
229
|
+
key.includes("IconName")
|
|
230
|
+
);
|
|
231
|
+
}
|
|
215
232
|
}
|
|
216
233
|
|
|
217
234
|
export const {
|
|
@@ -222,6 +239,7 @@ export const {
|
|
|
222
239
|
setFavicon,
|
|
223
240
|
setBrandColor,
|
|
224
241
|
convertHexInRgb,
|
|
242
|
+
isSystemKey,
|
|
225
243
|
isMac,
|
|
226
244
|
isPWA,
|
|
227
245
|
isIOS,
|
|
@@ -1,60 +1,37 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import useUI from "../../composable.ui";
|
|
3
|
-
import { cva } from "../../service.ui";
|
|
4
|
-
|
|
3
|
+
import { cva, isSystemKey } from "../../service.ui";
|
|
5
4
|
import defaultConfig from "../configs/default.config";
|
|
6
5
|
|
|
6
|
+
const componentKeys = ["icon", "divider"];
|
|
7
|
+
|
|
7
8
|
export function useAttrs(props, { isOpened }) {
|
|
8
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const titleClasses = computed(() =>
|
|
32
|
-
cvaTitle({
|
|
33
|
-
size: props.size,
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const descriptionClasses = computed(() =>
|
|
38
|
-
cvaDescription({
|
|
39
|
-
size: props.size,
|
|
40
|
-
isOpened: isOpened.value,
|
|
41
|
-
}),
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const wrapperAttrs = getAttrs("wrapper", { classes: wrapperClasses });
|
|
45
|
-
const bodyAttrs = getAttrs("body");
|
|
46
|
-
const titleAttrs = getAttrs("title", { classes: titleClasses });
|
|
47
|
-
const descriptionAttrs = getAttrs("description", { classes: descriptionClasses });
|
|
48
|
-
const iconAttrs = getAttrs("icon", { isComponent: true });
|
|
49
|
-
const dividerAttrs = getAttrs("divider", { isComponent: true });
|
|
9
|
+
const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
10
|
+
const attrs = {};
|
|
11
|
+
|
|
12
|
+
for (const key in defaultConfig) {
|
|
13
|
+
if (isSystemKey(key)) continue;
|
|
14
|
+
|
|
15
|
+
let classes = "";
|
|
16
|
+
let value = config.value[key];
|
|
17
|
+
|
|
18
|
+
if (value.variants || value.compoundVariants) {
|
|
19
|
+
const getCVA = cva(value);
|
|
20
|
+
|
|
21
|
+
classes = computed(() =>
|
|
22
|
+
getCVA({
|
|
23
|
+
...props,
|
|
24
|
+
isOpened: isOpened.value,
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes, isComponent: componentKeys.includes(key) });
|
|
30
|
+
}
|
|
50
31
|
|
|
51
32
|
return {
|
|
33
|
+
...attrs,
|
|
52
34
|
config,
|
|
53
|
-
|
|
54
|
-
descriptionAttrs,
|
|
55
|
-
bodyAttrs,
|
|
56
|
-
titleAttrs,
|
|
57
|
-
iconAttrs,
|
|
58
|
-
dividerAttrs,
|
|
35
|
+
hasSlotContent,
|
|
59
36
|
};
|
|
60
37
|
}
|
|
@@ -21,11 +21,11 @@ const DefaultTemplate = (args) => ({
|
|
|
21
21
|
},
|
|
22
22
|
template: `
|
|
23
23
|
<UAccordion
|
|
24
|
-
v-bind="args"
|
|
25
24
|
name="Excellence"
|
|
26
25
|
title="Excellence by necessity"
|
|
27
26
|
description="As creators and maintainers of the technologies you are using,
|
|
28
27
|
our services are here to showcase the full power of our softwares."
|
|
28
|
+
v-bind="args"
|
|
29
29
|
/>
|
|
30
30
|
<UAccordion
|
|
31
31
|
v-bind="args"
|
|
@@ -1,184 +1,116 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
1
2
|
import useUI from "../../composable.ui";
|
|
2
|
-
import { cva, cx } from "../../service.ui";
|
|
3
|
-
|
|
3
|
+
import { cva, cx, isSystemKey } from "../../service.ui";
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
const componentKeys = ["dropdownList", "toggleIcon", "clearIcon", "removeItemIcon", "label"];
|
|
6
7
|
|
|
7
8
|
export default function useAttrs(props, { isTop, isOpen, selectedLabel: selectedLabelValue }) {
|
|
8
9
|
const { config, getAttrs, hasSlotContent } = useUI(defaultConfig, () => props.config);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const cvaWrapper = cva({
|
|
12
|
-
base: wrapper.base,
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaInnerWrapper = cva({
|
|
18
|
-
base: innerWrapper.base,
|
|
19
|
-
variants: innerWrapper.variants,
|
|
20
|
-
compoundVariants: innerWrapper.compoundVariants,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const cvaSearchInput = cva({
|
|
24
|
-
base: searchInput.base,
|
|
25
|
-
variants: searchInput.variants,
|
|
26
|
-
compoundVariants: searchInput.compoundVariants,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const cvaSelectedLabel = cva({
|
|
30
|
-
base: selectedLabel.base,
|
|
31
|
-
variants: selectedLabel.variants,
|
|
32
|
-
compoundVariants: selectedLabel.compoundVariants,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const cvaCaret = cva({
|
|
36
|
-
base: caret.base,
|
|
37
|
-
variants: caret.variants,
|
|
38
|
-
compoundVariants: caret.compoundVariants,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const cvaCaretClearText = cva({
|
|
42
|
-
base: caretClearText.base,
|
|
43
|
-
variants: caretClearText.variants,
|
|
44
|
-
compoundVariants: caretClearText.compoundVariants,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const wrapperClasses = computed(() =>
|
|
48
|
-
cvaWrapper({
|
|
49
|
-
size: props.size,
|
|
50
|
-
error: Boolean(props.error),
|
|
51
|
-
disabled: props.disabled,
|
|
52
|
-
labelAlign: props.labelAlign,
|
|
53
|
-
label: Boolean(props.label),
|
|
54
|
-
}),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const innerWrapperClasses = computed(() =>
|
|
58
|
-
cvaInnerWrapper({
|
|
59
|
-
multiple: props.multiple,
|
|
60
|
-
size: props.size,
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const searchInputClasses = computed(() =>
|
|
65
|
-
cvaSearchInput({
|
|
66
|
-
size: props.size,
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const selectedLabelClasses = computed(() =>
|
|
71
|
-
cvaSelectedLabel({
|
|
72
|
-
size: props.size,
|
|
73
|
-
disabled: props.disabled,
|
|
74
|
-
multiple: props.multiple,
|
|
75
|
-
}),
|
|
76
|
-
);
|
|
10
|
+
const attrs = {};
|
|
77
11
|
|
|
78
12
|
const caretClasses = computed(() =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
13
|
+
cva(config.value.caret)({
|
|
14
|
+
...props,
|
|
15
|
+
error: Boolean(props.error),
|
|
82
16
|
label: Boolean(props.label),
|
|
83
17
|
}),
|
|
84
18
|
);
|
|
85
19
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
20
|
+
for (const key in defaultConfig) {
|
|
21
|
+
if (isSystemKey(key)) continue;
|
|
22
|
+
|
|
23
|
+
let classes = "";
|
|
24
|
+
let value = config.value[key];
|
|
25
|
+
|
|
26
|
+
if (value.variants || value.compoundVariants) {
|
|
27
|
+
const getCVA = cva(value);
|
|
28
|
+
|
|
29
|
+
classes = computed(() =>
|
|
30
|
+
getCVA({
|
|
31
|
+
...props,
|
|
32
|
+
error: Boolean(props.error),
|
|
33
|
+
label: Boolean(props.label),
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes, isComponent: componentKeys.includes(key) });
|
|
39
|
+
|
|
40
|
+
if (key === "wrapper") {
|
|
41
|
+
const wrapperAttrs = attrs[`${key}Attrs`];
|
|
42
|
+
|
|
43
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
44
|
+
...wrapperAttrs.value,
|
|
45
|
+
class: cx([wrapperAttrs.value.class, isOpen.value && config.value.wrapperActive]),
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (key === "label") {
|
|
50
|
+
const labelAttrs = attrs[`${key}Attrs`];
|
|
51
|
+
|
|
52
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
53
|
+
...labelAttrs.value,
|
|
54
|
+
class: cx([
|
|
55
|
+
labelAttrs.value.class,
|
|
56
|
+
isOpen.value && config.value.labelWrapperActive,
|
|
57
|
+
isTop.value && config.value.labelWrapperTop,
|
|
58
|
+
]),
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (key === "caretToggle") {
|
|
63
|
+
const caretToggleAttrs = attrs[`${key}Attrs`];
|
|
64
|
+
|
|
65
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
66
|
+
...caretToggleAttrs.value,
|
|
67
|
+
class: cx([caretToggleAttrs.value.class, caretClasses.value]),
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (key === "caretClear") {
|
|
72
|
+
const caretClearAttrs = attrs[`${key}Attrs`];
|
|
73
|
+
|
|
74
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
75
|
+
...caretClearAttrs.value,
|
|
76
|
+
class: cx([caretClearAttrs.value.class, caretClasses.value]),
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (key === "beforeCaretSlot") {
|
|
81
|
+
const beforeCaretSlotAttrs = attrs[`${key}Attrs`];
|
|
82
|
+
|
|
83
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
84
|
+
...beforeCaretSlotAttrs.value,
|
|
85
|
+
class: cx([beforeCaretSlotAttrs.value.class, caretClasses.value]),
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (key === "afterCaretSlot") {
|
|
90
|
+
const afterCaretSlotAttrs = attrs[`${key}Attrs`];
|
|
91
|
+
|
|
92
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
93
|
+
...afterCaretSlotAttrs.value,
|
|
94
|
+
class: cx([afterCaretSlotAttrs.value.class, caretClasses.value]),
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (key === "search") {
|
|
99
|
+
const searchAttrs = attrs[`${key}Attrs`];
|
|
100
|
+
|
|
101
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
102
|
+
...searchAttrs.value,
|
|
103
|
+
class: cx([
|
|
104
|
+
searchAttrs.value.class,
|
|
105
|
+
Boolean(selectedLabelValue.value) && !isOpen.value && "w-0", // this is not configurable
|
|
106
|
+
]),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
160
110
|
|
|
161
111
|
return {
|
|
112
|
+
...attrs,
|
|
162
113
|
config,
|
|
163
114
|
hasSlotContent,
|
|
164
|
-
labelAttrs,
|
|
165
|
-
wrapperAttrs,
|
|
166
|
-
innerWrapperAttrs,
|
|
167
|
-
wrapperTopAttrs,
|
|
168
|
-
leftSlotAttrs,
|
|
169
|
-
beforeCaretSlotAttrs,
|
|
170
|
-
afterCaretSlotAttrs,
|
|
171
|
-
caretToggleAttrs,
|
|
172
|
-
caretClearAttrs,
|
|
173
|
-
caretClearTextAttrs,
|
|
174
|
-
caretRemoveItemAttrs,
|
|
175
|
-
searchAttrs,
|
|
176
|
-
searchInputAttrs,
|
|
177
|
-
selectedLabelsAttrs,
|
|
178
|
-
selectedLabelAttrs,
|
|
179
|
-
dropdownListAttrs,
|
|
180
|
-
toggleIconAttrs,
|
|
181
|
-
clearIconAttrs,
|
|
182
|
-
removeItemIconAttrs,
|
|
183
115
|
};
|
|
184
116
|
}
|
|
@@ -62,7 +62,9 @@ export default /*tw*/ {
|
|
|
62
62
|
removeItemIcon: "",
|
|
63
63
|
removeItemIconName: "close_small",
|
|
64
64
|
caretRemoveItem: "flex items-center",
|
|
65
|
+
caretClear: "",
|
|
65
66
|
caretClearText: {
|
|
67
|
+
// TODO: caretClearMultiple is better
|
|
66
68
|
base: "cursor-pointer flex items-center text-sm font-normal text-gray-400 hover:text-gray-500 transition",
|
|
67
69
|
compoundVariants: [
|
|
68
70
|
{ size: "sm", class: "text-sm" },
|