vueless 0.0.595 → 0.0.597
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 +55 -37
- package/package.json +1 -1
- package/types.ts +3 -2
- package/ui.button/UButton.vue +10 -68
- package/ui.button/config.ts +28 -4
- package/ui.button/constants.ts +1 -1
- package/ui.button/storybook/stories.ts +2 -0
- package/ui.button/types.ts +0 -3
- package/ui.dropdown-button/UDropdownButton.vue +2 -6
- package/ui.dropdown-button/constants.ts +0 -4
- package/ui.form-date-picker-range/UDatePickerRange.vue +2 -2
- package/ui.image-icon/config.ts +1 -0
- package/ui.image-icon/types.ts +1 -0
- package/ui.loader/config.ts +1 -0
- package/ui.loader/types.ts +1 -0
- package/ui.text-alert/UAlert.vue +3 -14
- package/ui.text-badge/UBadge.vue +6 -19
- package/web-types.json +4 -41
package/composables/useUI.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ref, watch, watchEffect, getCurrentInstance, toValue, useAttrs, computed } from "vue";
|
|
2
|
+
import { merge } from "lodash-es";
|
|
2
3
|
|
|
3
4
|
import { cx, cva, setColor, getColor, vuelessConfig, getMergedConfig } from "../utils/ui.ts";
|
|
4
5
|
import { isCSR } from "../utils/helper.ts";
|
|
@@ -14,6 +15,7 @@ import type { Ref, ComputedRef } from "vue";
|
|
|
14
15
|
import type {
|
|
15
16
|
CVA,
|
|
16
17
|
UseUI,
|
|
18
|
+
Defaults,
|
|
17
19
|
KeyAttrs,
|
|
18
20
|
KeysAttrs,
|
|
19
21
|
Strategies,
|
|
@@ -22,7 +24,7 @@ import type {
|
|
|
22
24
|
UnknownObject,
|
|
23
25
|
ComponentNames,
|
|
24
26
|
ComponentConfig,
|
|
25
|
-
|
|
27
|
+
NestedComponent,
|
|
26
28
|
VuelessComponentInstance,
|
|
27
29
|
} from "../types.ts";
|
|
28
30
|
|
|
@@ -44,7 +46,7 @@ export default function useUI<T>(
|
|
|
44
46
|
? (parent?.type.__name as ComponentNames)
|
|
45
47
|
: (type.__name as ComponentNames);
|
|
46
48
|
|
|
47
|
-
const globalConfig = vuelessConfig?.component?.[componentName] || {}
|
|
49
|
+
const globalConfig = (vuelessConfig?.component?.[componentName] || {}) as ComponentConfig<T>;
|
|
48
50
|
|
|
49
51
|
const vuelessStrategy = Object.values(STRATEGY_TYPE).includes(vuelessConfig.strategy || "")
|
|
50
52
|
? (vuelessConfig.strategy as Strategies)
|
|
@@ -107,31 +109,6 @@ export default function useUI<T>(
|
|
|
107
109
|
if (isSystemKey(key)) continue;
|
|
108
110
|
|
|
109
111
|
keysAttrs[`${key}Attrs`] = getAttrs(key, getClasses(key, mutatedProps));
|
|
110
|
-
|
|
111
|
-
const baseClasses = getBaseClasses(config.value[key]);
|
|
112
|
-
const extendsKeys = getExtendsKeys(baseClasses);
|
|
113
|
-
|
|
114
|
-
if (extendsKeys.length) {
|
|
115
|
-
const keyAttrs = keysAttrs[`${key}Attrs`];
|
|
116
|
-
|
|
117
|
-
keysAttrs[`${key}Attrs`] = computed(() => {
|
|
118
|
-
const extendsClasses = extendsKeys.map((key) => toValue(getClasses(key, mutatedProps)));
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
...keyAttrs.value,
|
|
122
|
-
class: cx([
|
|
123
|
-
...extendsClasses,
|
|
124
|
-
keyAttrs.value.class?.replaceAll(EXTENDS_PATTERN_REG_EXP, ""),
|
|
125
|
-
]),
|
|
126
|
-
// TODO: Add ability to merge array of keys
|
|
127
|
-
config: getMergedConfig({
|
|
128
|
-
defaultConfig: config.value[extendsKeys[0]],
|
|
129
|
-
globalConfig: keyAttrs.value.config,
|
|
130
|
-
propsConfig: propsConfig[extendsKeys[0]],
|
|
131
|
-
}),
|
|
132
|
-
};
|
|
133
|
-
}) as ComputedRef<KeyAttrsWithConfig<T>>;
|
|
134
|
-
}
|
|
135
112
|
}
|
|
136
113
|
|
|
137
114
|
return keysAttrs;
|
|
@@ -168,24 +145,65 @@ export default function useUI<T>(
|
|
|
168
145
|
}
|
|
169
146
|
|
|
170
147
|
function updateVuelessAttrs() {
|
|
171
|
-
|
|
148
|
+
let configAttr: NestedComponent = {};
|
|
149
|
+
let extendsConfigAttr: NestedComponent = {};
|
|
150
|
+
let extendsClasses: string[] = [];
|
|
172
151
|
|
|
173
|
-
|
|
174
|
-
|
|
152
|
+
const baseClasses = getBaseClasses(config.value[configKey]);
|
|
153
|
+
const extendsKeys = getExtendsKeys(baseClasses);
|
|
175
154
|
|
|
176
|
-
if (typeof
|
|
177
|
-
configAttr =
|
|
178
|
-
|
|
155
|
+
if (typeof config.value[configKey] === "object") {
|
|
156
|
+
configAttr = config.value[configKey] as NestedComponent;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (extendsKeys.length) {
|
|
160
|
+
extendsClasses = extendsKeys.map((key) => toValue(getClasses(key, mutatedProps)));
|
|
161
|
+
extendsConfigAttr = getExtendsConfig(extendsKeys);
|
|
179
162
|
}
|
|
180
163
|
|
|
181
164
|
vuelessAttrs.value = {
|
|
182
165
|
...commonAttrs,
|
|
183
|
-
class: toValue(classes),
|
|
184
|
-
config: configAttr,
|
|
185
|
-
...
|
|
166
|
+
class: cx([...extendsClasses, toValue(classes).replaceAll(EXTENDS_PATTERN_REG_EXP, "")]),
|
|
167
|
+
config: merge(configAttr, extendsConfigAttr),
|
|
168
|
+
...getDefaults({
|
|
169
|
+
...(configAttr.defaults || {}),
|
|
170
|
+
...(extendsConfigAttr.defaults || {}),
|
|
171
|
+
}),
|
|
186
172
|
};
|
|
187
173
|
}
|
|
188
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Merge extends nested component configs.
|
|
177
|
+
* TODO: Add ability to merge multiple keys in one (now works for merging only 1 first key).
|
|
178
|
+
*/
|
|
179
|
+
function getExtendsConfig(extendsKeys: string[]) {
|
|
180
|
+
const [firstKey] = extendsKeys;
|
|
181
|
+
|
|
182
|
+
return getMergedConfig({
|
|
183
|
+
defaultConfig: config.value[firstKey],
|
|
184
|
+
globalConfig: globalConfig[firstKey],
|
|
185
|
+
propsConfig: propsConfig[firstKey],
|
|
186
|
+
}) as NestedComponent;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Conditionally set props default value for nested components based on parent component prop value.
|
|
191
|
+
* For example, set icon size for the nested component based on the size of the parent component.
|
|
192
|
+
* Use an object where key = parent component prop value, value = nested component prop value.
|
|
193
|
+
* */
|
|
194
|
+
function getDefaults(defaultAttrs: NestedComponent["defaults"]) {
|
|
195
|
+
const defaults: Defaults = {};
|
|
196
|
+
|
|
197
|
+
for (const key in defaultAttrs) {
|
|
198
|
+
defaults[key] =
|
|
199
|
+
typeof defaultAttrs[key] === "object"
|
|
200
|
+
? defaultAttrs[key][String(props[key])]
|
|
201
|
+
: defaultAttrs[key];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return defaults;
|
|
205
|
+
}
|
|
206
|
+
|
|
189
207
|
return vuelessAttrs;
|
|
190
208
|
}
|
|
191
209
|
|
|
@@ -195,7 +213,7 @@ export default function useUI<T>(
|
|
|
195
213
|
/**
|
|
196
214
|
* Return base classes.
|
|
197
215
|
*/
|
|
198
|
-
function getBaseClasses(value: string | CVA) {
|
|
216
|
+
function getBaseClasses(value: string | CVA | undefined) {
|
|
199
217
|
return typeof value === "object" ? value.base || "" : value || "";
|
|
200
218
|
}
|
|
201
219
|
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -241,12 +241,13 @@ export type ComponentConfig<T> = Partial<{
|
|
|
241
241
|
NestedComponent;
|
|
242
242
|
|
|
243
243
|
export interface NestedComponent {
|
|
244
|
-
|
|
244
|
+
defaults?: Record<string, string | UnknownObject>;
|
|
245
|
+
[key: string]: Record<string, string | UnknownObject> | string | undefined;
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
export type Defaults = {
|
|
248
249
|
color?: string;
|
|
249
|
-
[key: string]: unknown;
|
|
250
|
+
[key: string]: unknown | UnknownObject;
|
|
250
251
|
};
|
|
251
252
|
|
|
252
253
|
export interface Transition {
|
package/ui.button/UButton.vue
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { computed, ref, watchEffect, useId, watch, useSlots } from "vue";
|
|
3
3
|
|
|
4
4
|
import useUI from "../composables/useUI.ts";
|
|
5
|
-
import { useDarkMode } from "../composables/useDarkMode.ts";
|
|
6
5
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
7
6
|
import { getDefaults } from "../utils/ui.ts";
|
|
8
7
|
|
|
@@ -10,57 +9,24 @@ import ULoader from "../ui.loader/ULoader.vue";
|
|
|
10
9
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
11
10
|
|
|
12
11
|
import defaultConfig from "./config.ts";
|
|
13
|
-
import {
|
|
12
|
+
import { COMPONENT_NAME } from "./constants.ts";
|
|
14
13
|
|
|
15
|
-
import type { Props,
|
|
14
|
+
import type { Props, Config } from "./types.ts";
|
|
16
15
|
|
|
17
16
|
defineOptions({ inheritAttrs: false });
|
|
18
17
|
|
|
19
18
|
const props = withDefaults(defineProps<Props>(), {
|
|
20
|
-
...getDefaults<Props, Config>(defaultConfig,
|
|
19
|
+
...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
|
|
21
20
|
label: "",
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
const slots = useSlots();
|
|
25
24
|
const elementId = props.id || useId();
|
|
26
|
-
const { isDarkMode } = useDarkMode();
|
|
27
25
|
|
|
28
26
|
const buttonRef = ref<HTMLElement | null>(null);
|
|
29
27
|
const buttonStyle = ref({});
|
|
30
28
|
const buttonWidth = ref(0);
|
|
31
29
|
|
|
32
|
-
const loaderSize = computed(() => {
|
|
33
|
-
const sizes = {
|
|
34
|
-
"2xs": "sm",
|
|
35
|
-
xs: "sm",
|
|
36
|
-
sm: "md",
|
|
37
|
-
md: "md",
|
|
38
|
-
lg: "lg",
|
|
39
|
-
xl: "lg",
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return sizes[props.size] as LoaderSize;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const iconSize = computed(() => {
|
|
46
|
-
const sizes = {
|
|
47
|
-
"2xs": "2xs",
|
|
48
|
-
xs: "xs",
|
|
49
|
-
sm: "sm",
|
|
50
|
-
md: "sm",
|
|
51
|
-
lg: "sm",
|
|
52
|
-
xl: "sm",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return sizes[props.size] as IconSize;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const iconColor = computed(() => {
|
|
59
|
-
const primaryColor = isDarkMode.value ? "black" : "white";
|
|
60
|
-
|
|
61
|
-
return props.variant === "primary" ? primaryColor : props.color;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
30
|
watch(
|
|
65
31
|
() => props.loading,
|
|
66
32
|
(newValue, oldValue) => {
|
|
@@ -119,7 +85,7 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
|
|
|
119
85
|
:data-test="dataTest"
|
|
120
86
|
>
|
|
121
87
|
<template v-if="loading">
|
|
122
|
-
<ULoader :loading="loading"
|
|
88
|
+
<ULoader :loading="loading" color="inherit" v-bind="loaderAttrs" />
|
|
123
89
|
</template>
|
|
124
90
|
|
|
125
91
|
<template v-else>
|
|
@@ -127,17 +93,9 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
|
|
|
127
93
|
@slot Use it to add something before the label.
|
|
128
94
|
@binding {string} icon-name
|
|
129
95
|
@binding {string} icon-size
|
|
130
|
-
@binding {string} icon-color
|
|
131
96
|
-->
|
|
132
|
-
<slot name="left" :icon-name="leftIcon"
|
|
133
|
-
<UIcon
|
|
134
|
-
v-if="leftIcon"
|
|
135
|
-
internal
|
|
136
|
-
:name="leftIcon"
|
|
137
|
-
:size="iconSize"
|
|
138
|
-
:color="iconColor"
|
|
139
|
-
v-bind="leftIconAttrs"
|
|
140
|
-
/>
|
|
97
|
+
<slot name="left" :icon-name="leftIcon">
|
|
98
|
+
<UIcon v-if="leftIcon" internal color="inherit" :name="leftIcon" v-bind="leftIconAttrs" />
|
|
141
99
|
</slot>
|
|
142
100
|
|
|
143
101
|
<!--
|
|
@@ -145,23 +103,9 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
|
|
|
145
103
|
@binding {string} label
|
|
146
104
|
@binding {string} icon-name
|
|
147
105
|
@binding {string} icon-size
|
|
148
|
-
@binding {string} icon-color
|
|
149
106
|
-->
|
|
150
|
-
<slot
|
|
151
|
-
name="
|
|
152
|
-
:label="label"
|
|
153
|
-
:icon-name="icon"
|
|
154
|
-
:icon-size="iconSize"
|
|
155
|
-
:icon-color="iconColor"
|
|
156
|
-
>
|
|
157
|
-
<UIcon
|
|
158
|
-
v-if="icon"
|
|
159
|
-
internal
|
|
160
|
-
:name="icon"
|
|
161
|
-
:size="iconSize"
|
|
162
|
-
:color="iconColor"
|
|
163
|
-
v-bind="centerIconAttrs"
|
|
164
|
-
/>
|
|
107
|
+
<slot name="default" :label="label" :icon-name="icon">
|
|
108
|
+
<UIcon v-if="icon" internal color="inherit" :name="icon" v-bind="centerIconAttrs" />
|
|
165
109
|
<template v-else>
|
|
166
110
|
{{ label }}
|
|
167
111
|
</template>
|
|
@@ -171,15 +115,13 @@ const { buttonAttrs, loaderAttrs, leftIconAttrs, rightIconAttrs, centerIconAttrs
|
|
|
171
115
|
@slot Use it to add something after the label.
|
|
172
116
|
@binding {string} icon-name
|
|
173
117
|
@binding {string} icon-size
|
|
174
|
-
@binding {string} icon-color
|
|
175
118
|
-->
|
|
176
|
-
<slot name="right" :icon-name="rightIcon"
|
|
119
|
+
<slot name="right" :icon-name="rightIcon">
|
|
177
120
|
<UIcon
|
|
178
121
|
v-if="rightIcon"
|
|
179
122
|
internal
|
|
123
|
+
color="inherit"
|
|
180
124
|
:name="rightIcon"
|
|
181
|
-
:size="iconSize"
|
|
182
|
-
:color="iconColor"
|
|
183
125
|
v-bind="rightIconAttrs"
|
|
184
126
|
/>
|
|
185
127
|
</slot>
|
package/ui.button/config.ts
CHANGED
|
@@ -149,10 +149,34 @@ export default /*tw*/ {
|
|
|
149
149
|
{ square: true, size: "xl", class: "p-3.5" },
|
|
150
150
|
],
|
|
151
151
|
},
|
|
152
|
-
loader:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
loader: {
|
|
153
|
+
base: "{ULoader}",
|
|
154
|
+
defaults: {
|
|
155
|
+
size: {
|
|
156
|
+
"2xs": "sm",
|
|
157
|
+
xs: "sm",
|
|
158
|
+
sm: "md",
|
|
159
|
+
md: "md",
|
|
160
|
+
lg: "lg",
|
|
161
|
+
xl: "lg",
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
leftIcon: "{UIcon} {>centerIcon}",
|
|
166
|
+
rightIcon: "{UIcon} {>centerIcon}",
|
|
167
|
+
centerIcon: {
|
|
168
|
+
base: "{UIcon}",
|
|
169
|
+
defaults: {
|
|
170
|
+
size: {
|
|
171
|
+
"2xs": "2xs",
|
|
172
|
+
xs: "xs",
|
|
173
|
+
sm: "sm",
|
|
174
|
+
md: "sm",
|
|
175
|
+
lg: "sm",
|
|
176
|
+
xl: "sm",
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
156
180
|
defaults: {
|
|
157
181
|
color: "brand",
|
|
158
182
|
variant: "primary",
|
package/ui.button/constants.ts
CHANGED
|
@@ -172,10 +172,12 @@ export const IconProps: StoryFn<UButtonArgs> = (args) => ({
|
|
|
172
172
|
template: `
|
|
173
173
|
<URow no-mobile>
|
|
174
174
|
<UButton
|
|
175
|
+
v-bind="args"
|
|
175
176
|
left-icon="download"
|
|
176
177
|
label="Download"
|
|
177
178
|
/>
|
|
178
179
|
<UButton
|
|
180
|
+
v-bind="args"
|
|
179
181
|
right-icon="menu"
|
|
180
182
|
label="Menu"
|
|
181
183
|
/>
|
package/ui.button/types.ts
CHANGED
|
@@ -11,7 +11,7 @@ import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
|
|
|
11
11
|
import { vClickOutside } from "../directives";
|
|
12
12
|
|
|
13
13
|
import defaultConfig from "./config.ts";
|
|
14
|
-
import { UDropdownButton
|
|
14
|
+
import { UDropdownButton } from "./constants.ts";
|
|
15
15
|
|
|
16
16
|
import type { Props, IconSize, DropdownSize, Config } from "./types.ts";
|
|
17
17
|
import type { Option } from "../ui.dropdown-list/types.ts";
|
|
@@ -41,10 +41,6 @@ const dropdownListRef = useTemplateRef<UDropdownListRef>("dropdown-list");
|
|
|
41
41
|
|
|
42
42
|
const elementId = props.id || useId();
|
|
43
43
|
|
|
44
|
-
const iconColor = computed(() => {
|
|
45
|
-
return props.variant === BUTTON_VARIANT.primary ? "white" : props.color;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
44
|
const iconSize = computed(() => {
|
|
49
45
|
const sizes = {
|
|
50
46
|
"2xs": "xs",
|
|
@@ -146,8 +142,8 @@ const { config, dropdownButtonAttrs, dropdownListAttrs, dropdownIconAttrs, wrapp
|
|
|
146
142
|
<UIcon
|
|
147
143
|
v-if="!noIcon"
|
|
148
144
|
internal
|
|
145
|
+
color="inherit"
|
|
149
146
|
:size="iconSize"
|
|
150
|
-
:color="iconColor"
|
|
151
147
|
:name="config.defaults.dropdownIcon"
|
|
152
148
|
v-bind="dropdownIconAttrs"
|
|
153
149
|
:data-test="`${dataTest}-dropdown`"
|
|
@@ -92,8 +92,8 @@ type UButtonRef = InstanceType<typeof UButton>;
|
|
|
92
92
|
type UInputRef = InstanceType<typeof UInput>;
|
|
93
93
|
|
|
94
94
|
const isShownMenu = ref(false);
|
|
95
|
-
const wrapperRef = useTemplateRef("wrapper");
|
|
96
|
-
const menuRef = useTemplateRef("menu");
|
|
95
|
+
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
96
|
+
const menuRef = useTemplateRef<HTMLDivElement>("menu");
|
|
97
97
|
const buttonRef = useTemplateRef<UButtonRef>("button");
|
|
98
98
|
const buttonPrevRef = useTemplateRef<UButtonRef>("button-prev");
|
|
99
99
|
const buttonNextRef = useTemplateRef<UButtonRef>("button-next");
|
package/ui.image-icon/config.ts
CHANGED
package/ui.image-icon/types.ts
CHANGED
package/ui.loader/config.ts
CHANGED
package/ui.loader/types.ts
CHANGED
package/ui.text-alert/UAlert.vue
CHANGED
|
@@ -69,12 +69,6 @@ const closeButtonColor = computed(() => {
|
|
|
69
69
|
return props.color;
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
const iconColor = computed(() => {
|
|
73
|
-
if (props.color === "white") return "gray";
|
|
74
|
-
|
|
75
|
-
return props.variant === "primary" ? "white" : props.color;
|
|
76
|
-
});
|
|
77
|
-
|
|
78
72
|
/**
|
|
79
73
|
* Get element / nested component attributes for each config token ✨
|
|
80
74
|
* Applies: `class`, `config`, redefined default `props` and dev `vl-...` attributes.
|
|
@@ -146,19 +140,14 @@ const {
|
|
|
146
140
|
>
|
|
147
141
|
<!--
|
|
148
142
|
@slot Use it to add something instead of the close button.
|
|
143
|
+
@binding {string} icon-name
|
|
149
144
|
@binding {string} icon-size
|
|
150
|
-
@binding {string} icon-color
|
|
151
145
|
-->
|
|
152
|
-
<slot
|
|
153
|
-
name="close"
|
|
154
|
-
:icon-name="config.defaults.closeIcon"
|
|
155
|
-
:icon-size="closeIconSize"
|
|
156
|
-
:icon-color="iconColor"
|
|
157
|
-
>
|
|
146
|
+
<slot name="close" :icon-name="config.defaults.closeIcon" :icon-size="closeIconSize">
|
|
158
147
|
<UIcon
|
|
159
148
|
internal
|
|
149
|
+
color="inherit"
|
|
160
150
|
:size="closeIconSize"
|
|
161
|
-
:color="iconColor"
|
|
162
151
|
:name="config.defaults.closeIcon"
|
|
163
152
|
v-bind="closeIconAttrs"
|
|
164
153
|
:data-test="`${dataTest}-button`"
|
package/ui.text-badge/UBadge.vue
CHANGED
|
@@ -55,10 +55,6 @@ const iconSize = computed(() => {
|
|
|
55
55
|
return sizes[props.size] as IconSize;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
const iconColor = computed(() => {
|
|
59
|
-
return props.variant === "primary" ? "white" : props.color;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
58
|
function onFocus() {
|
|
63
59
|
emit("focus");
|
|
64
60
|
}
|
|
@@ -115,15 +111,14 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
|
|
|
115
111
|
@slot Use it to add icon before the text.
|
|
116
112
|
@binding {string} icon-name
|
|
117
113
|
@binding {string} icon-size
|
|
118
|
-
@binding {string} icon-color
|
|
119
114
|
-->
|
|
120
|
-
<slot name="left" :icon-name="leftIcon" :icon-size="iconSize"
|
|
115
|
+
<slot name="left" :icon-name="leftIcon" :icon-size="iconSize">
|
|
121
116
|
<UIcon
|
|
122
117
|
v-if="leftIcon"
|
|
123
118
|
internal
|
|
124
119
|
:name="leftIcon"
|
|
125
120
|
:size="iconSize"
|
|
126
|
-
|
|
121
|
+
color="inherit"
|
|
127
122
|
v-bind="leftIconAttrs"
|
|
128
123
|
/>
|
|
129
124
|
</slot>
|
|
@@ -133,21 +128,14 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
|
|
|
133
128
|
@binding {string} label
|
|
134
129
|
@binding {string} icon-name
|
|
135
130
|
@binding {string} icon-size
|
|
136
|
-
@binding {string} icon-color
|
|
137
131
|
-->
|
|
138
|
-
<slot
|
|
139
|
-
name="default"
|
|
140
|
-
:label="label"
|
|
141
|
-
:icon-name="icon"
|
|
142
|
-
:icon-size="iconSize"
|
|
143
|
-
:icon-color="iconColor"
|
|
144
|
-
>
|
|
132
|
+
<slot name="default" :label="label" :icon-name="icon" :icon-size="iconSize">
|
|
145
133
|
<UIcon
|
|
146
134
|
v-if="icon"
|
|
147
135
|
internal
|
|
148
136
|
:name="icon"
|
|
149
137
|
:size="iconSize"
|
|
150
|
-
|
|
138
|
+
color="inherit"
|
|
151
139
|
v-bind="centerIconAttrs"
|
|
152
140
|
/>
|
|
153
141
|
<template v-else>
|
|
@@ -159,14 +147,13 @@ const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs }
|
|
|
159
147
|
@slot Use it to add icon after the text.
|
|
160
148
|
@binding {string} icon-name
|
|
161
149
|
@binding {string} icon-size
|
|
162
|
-
@binding {string} icon-color
|
|
163
150
|
-->
|
|
164
|
-
<slot name="right" :icon-name="rightIcon" :icon-size="iconSize"
|
|
151
|
+
<slot name="right" :icon-name="rightIcon" :icon-size="iconSize">
|
|
165
152
|
<UIcon
|
|
166
153
|
v-if="rightIcon"
|
|
167
154
|
:name="rightIcon"
|
|
168
155
|
:size="iconSize"
|
|
169
|
-
|
|
156
|
+
color="inherit"
|
|
170
157
|
internal
|
|
171
158
|
v-bind="rightIconAttrs"
|
|
172
159
|
/>
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.597",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -310,15 +310,12 @@
|
|
|
310
310
|
"description": "Use it to add something instead of the close button.",
|
|
311
311
|
"bindings": [
|
|
312
312
|
{
|
|
313
|
+
"type": "string",
|
|
313
314
|
"name": "icon-name"
|
|
314
315
|
},
|
|
315
316
|
{
|
|
316
317
|
"type": "string",
|
|
317
318
|
"name": "icon-size"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"type": "string",
|
|
321
|
-
"name": "icon-color"
|
|
322
319
|
}
|
|
323
320
|
]
|
|
324
321
|
},
|
|
@@ -688,10 +685,6 @@
|
|
|
688
685
|
{
|
|
689
686
|
"type": "string",
|
|
690
687
|
"name": "icon-size"
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
"type": "string",
|
|
694
|
-
"name": "icon-color"
|
|
695
688
|
}
|
|
696
689
|
]
|
|
697
690
|
},
|
|
@@ -711,10 +704,6 @@
|
|
|
711
704
|
{
|
|
712
705
|
"type": "string",
|
|
713
706
|
"name": "icon-size"
|
|
714
|
-
},
|
|
715
|
-
{
|
|
716
|
-
"type": "string",
|
|
717
|
-
"name": "icon-color"
|
|
718
707
|
}
|
|
719
708
|
]
|
|
720
709
|
},
|
|
@@ -730,10 +719,6 @@
|
|
|
730
719
|
{
|
|
731
720
|
"type": "string",
|
|
732
721
|
"name": "icon-size"
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
"type": "string",
|
|
736
|
-
"name": "icon-color"
|
|
737
722
|
}
|
|
738
723
|
]
|
|
739
724
|
}
|
|
@@ -995,14 +980,6 @@
|
|
|
995
980
|
{
|
|
996
981
|
"type": "string",
|
|
997
982
|
"name": "icon-name"
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
"type": "string",
|
|
1001
|
-
"name": "icon-size"
|
|
1002
|
-
},
|
|
1003
|
-
{
|
|
1004
|
-
"type": "string",
|
|
1005
|
-
"name": "icon-color"
|
|
1006
983
|
}
|
|
1007
984
|
]
|
|
1008
985
|
},
|
|
@@ -1018,14 +995,6 @@
|
|
|
1018
995
|
{
|
|
1019
996
|
"type": "string",
|
|
1020
997
|
"name": "icon-name"
|
|
1021
|
-
},
|
|
1022
|
-
{
|
|
1023
|
-
"type": "string",
|
|
1024
|
-
"name": "icon-size"
|
|
1025
|
-
},
|
|
1026
|
-
{
|
|
1027
|
-
"type": "string",
|
|
1028
|
-
"name": "icon-color"
|
|
1029
998
|
}
|
|
1030
999
|
]
|
|
1031
1000
|
},
|
|
@@ -1037,14 +1006,6 @@
|
|
|
1037
1006
|
{
|
|
1038
1007
|
"type": "string",
|
|
1039
1008
|
"name": "icon-name"
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
"type": "string",
|
|
1043
|
-
"name": "icon-size"
|
|
1044
|
-
},
|
|
1045
|
-
{
|
|
1046
|
-
"type": "string",
|
|
1047
|
-
"name": "icon-color"
|
|
1048
1009
|
}
|
|
1049
1010
|
]
|
|
1050
1011
|
}
|
|
@@ -5600,6 +5561,7 @@
|
|
|
5600
5561
|
"gray",
|
|
5601
5562
|
"black",
|
|
5602
5563
|
"white",
|
|
5564
|
+
"inherit",
|
|
5603
5565
|
"brand"
|
|
5604
5566
|
],
|
|
5605
5567
|
"value": {
|
|
@@ -7670,6 +7632,7 @@
|
|
|
7670
7632
|
"gray",
|
|
7671
7633
|
"black",
|
|
7672
7634
|
"white",
|
|
7635
|
+
"inherit",
|
|
7673
7636
|
"brand"
|
|
7674
7637
|
],
|
|
7675
7638
|
"value": {
|