vueless 0.0.739 → 0.0.741
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/composables/useUI.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
STRATEGY_TYPE,
|
|
7
7
|
CVA_CONFIG_KEY,
|
|
8
8
|
SYSTEM_CONFIG_KEY,
|
|
9
|
-
|
|
9
|
+
DEFAULT_BASE_CLASSES,
|
|
10
10
|
EXTENDS_PATTERN_REG_EXP,
|
|
11
11
|
NESTED_COMPONENT_PATTERN_REG_EXP,
|
|
12
12
|
} from "../constants.js";
|
|
@@ -75,6 +75,9 @@ export default function useUI<T>(
|
|
|
75
75
|
const value = (config.value as ComponentConfigFull<T>)[key];
|
|
76
76
|
const color = (toValue(mutatedProps || {}).color || props.color) as BrandColors;
|
|
77
77
|
|
|
78
|
+
const isTopLevelKey = (topLevelClassKey || firstClassKey) === key;
|
|
79
|
+
const isNestedComponent = Boolean(getNestedComponent(value));
|
|
80
|
+
|
|
78
81
|
let classes = "";
|
|
79
82
|
|
|
80
83
|
if (typeof value === "object" && isCVA(value)) {
|
|
@@ -89,9 +92,15 @@ export default function useUI<T>(
|
|
|
89
92
|
classes = value;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
if (isTopLevelKey && !isNestedComponent) {
|
|
96
|
+
classes = cx([DEFAULT_BASE_CLASSES, vuelessConfig.baseClasses, classes]);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
classes = classes
|
|
100
|
+
.replaceAll(EXTENDS_PATTERN_REG_EXP, "")
|
|
101
|
+
.replace(NESTED_COMPONENT_PATTERN_REG_EXP, "");
|
|
93
102
|
|
|
94
|
-
return color && !
|
|
103
|
+
return color && !isNestedComponent ? setColor(classes, color) : classes;
|
|
95
104
|
});
|
|
96
105
|
}
|
|
97
106
|
|
|
@@ -116,7 +125,6 @@ export default function useUI<T>(
|
|
|
116
125
|
* Get an element attributes for a given key.
|
|
117
126
|
*/
|
|
118
127
|
function getAttrs(configKey: string, classes: ComputedRef<string>) {
|
|
119
|
-
const isTopLevelKey = (topLevelClassKey || firstClassKey) === configKey;
|
|
120
128
|
const vuelessAttrs = ref({} as KeyAttrs);
|
|
121
129
|
|
|
122
130
|
const attrs = useAttrs() as KeyAttrs;
|
|
@@ -136,6 +144,7 @@ export default function useUI<T>(
|
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
const isDev = isCSR && import.meta.env?.DEV;
|
|
147
|
+
const isTopLevelKey = (topLevelClassKey || firstClassKey) === configKey;
|
|
139
148
|
|
|
140
149
|
const extendsClasses = getExtendsClasses(configKey);
|
|
141
150
|
const extendsKeyConfig = getExtendsKeyConfig(configKey);
|
|
@@ -234,15 +243,6 @@ export default function useUI<T>(
|
|
|
234
243
|
return defaults;
|
|
235
244
|
}
|
|
236
245
|
|
|
237
|
-
// TODO: Injecting global base classes.
|
|
238
|
-
// if (isTopLevelKey) {
|
|
239
|
-
// vuelessAttrs.value.class = cx([
|
|
240
|
-
// DEFAULT_BASE_CLASSES,
|
|
241
|
-
// vuelessConfig.baseClasses,
|
|
242
|
-
// vuelessAttrs.value.class,
|
|
243
|
-
// ]);
|
|
244
|
-
// }
|
|
245
|
-
|
|
246
246
|
return vuelessAttrs;
|
|
247
247
|
}
|
|
248
248
|
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ defineOptions({ inheritAttrs: false });
|
|
|
15
15
|
|
|
16
16
|
const setUTabsSelectedItem = inject<SetUTabsSelectedItem>("setUTabsSelectedItem");
|
|
17
17
|
const getUTabsSelectedItem = inject("getUTabsSelectedItem");
|
|
18
|
+
const getUTabsScrollable = inject<UTabsProps["scrollable"]>("getUTabsScrollable");
|
|
18
19
|
const getUTabsSquare = inject<UTabsProps["square"]>("getUTabsSquare");
|
|
19
20
|
const getUTabsBlock = inject<UTabsProps["block"]>("getUTabsBlock");
|
|
20
21
|
const getUTabsSize = inject<UTabsProps["size"]>("getUTabsSize", "md");
|
|
@@ -26,6 +27,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
26
27
|
const size = computed(() => toValue(getUTabsSize));
|
|
27
28
|
const block = computed(() => toValue(getUTabsBlock));
|
|
28
29
|
const square = computed(() => toValue(getUTabsSquare));
|
|
30
|
+
const scrollable = computed(() => toValue(getUTabsScrollable));
|
|
29
31
|
const isActive = computed(() => toValue(getUTabsSelectedItem) === props.value && !props.disabled);
|
|
30
32
|
|
|
31
33
|
async function onClickSetValue() {
|
|
@@ -42,6 +44,7 @@ const mutatedProps = computed(() => ({
|
|
|
42
44
|
size: size.value,
|
|
43
45
|
block: block.value,
|
|
44
46
|
square: square.value,
|
|
47
|
+
scrollable: scrollable.value,
|
|
45
48
|
/* component state, not a props */
|
|
46
49
|
active: isActive.value,
|
|
47
50
|
}));
|
|
@@ -75,6 +75,7 @@ onUnmounted(() => {
|
|
|
75
75
|
provide("getUTabsSize", () => props.size);
|
|
76
76
|
provide("getUTabsBlock", () => props.block);
|
|
77
77
|
provide("getUTabsSquare", () => props.square);
|
|
78
|
+
provide("getUTabsScrollable", () => props.scrollable);
|
|
78
79
|
provide("getUTabsSelectedItem", () => selectedItem.value);
|
|
79
80
|
provide("setUTabsSelectedItem", (value: string) => (selectedItem.value = value));
|
|
80
81
|
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
|
-
wrapper:
|
|
3
|
-
|
|
4
|
-
base: "flex flex-nowrap border-b border-gray-200 dark:border-gray-700",
|
|
2
|
+
wrapper: {
|
|
3
|
+
base: "mb-6 flex gap-1",
|
|
5
4
|
variants: {
|
|
6
5
|
block: {
|
|
7
6
|
true: "w-full",
|
|
8
7
|
},
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
tabs: {
|
|
11
|
+
base: "flex border-b border-gray-200 dark:border-gray-700",
|
|
12
|
+
variants: {
|
|
9
13
|
scrollable: {
|
|
10
|
-
true: "overflow-hidden scroll-smooth",
|
|
14
|
+
true: "overflow-hidden flex-nowrap scroll-smooth",
|
|
15
|
+
},
|
|
16
|
+
block: {
|
|
17
|
+
true: "w-full",
|
|
11
18
|
},
|
|
12
19
|
},
|
|
13
20
|
},
|
package/utils/ui.ts
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
GRAYSCALE_COLOR,
|
|
11
11
|
ICON_NON_PROPS_DEFAULTS,
|
|
12
12
|
TAILWIND_MERGE_EXTENSION,
|
|
13
|
-
NESTED_COMPONENT_PATTERN_REG_EXP,
|
|
14
13
|
} from "../constants.js";
|
|
15
14
|
|
|
16
15
|
import type {
|
|
@@ -82,7 +81,7 @@ export const {
|
|
|
82
81
|
cva: classVarianceAuthority,
|
|
83
82
|
} = defineConfig({
|
|
84
83
|
hooks: {
|
|
85
|
-
onComplete: (classNames) => twMerge(classNames)
|
|
84
|
+
onComplete: (classNames) => twMerge(classNames),
|
|
86
85
|
},
|
|
87
86
|
});
|
|
88
87
|
|