@uzum-tech/ui 2.0.0-beta.9 → 2.0.0
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/dist/index.js +240 -197
- package/dist/index.mjs +240 -197
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/_internal/icon/index.d.ts +2 -0
- package/es/_internal/icon/index.mjs +2 -1
- package/es/_internal/icon/src/UIcon.d.ts +126 -0
- package/es/_internal/icon/src/UIcon.mjs +131 -0
- package/es/_mixins/use-config.d.ts +2 -1
- package/es/_mixins/use-config.mjs +1 -0
- package/es/components.d.ts +113 -34
- package/es/config-provider/src/ConfigProvider.d.ts +4 -1
- package/es/config-provider/src/ConfigProvider.mjs +8 -0
- package/es/config-provider/src/interface.d.ts +1 -1
- package/es/config-provider/src/internal-interface.d.ts +8 -0
- package/es/icon/src/Icon.d.ts +2 -109
- package/es/icon/src/Icon.mjs +1 -93
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_internal/icon/index.d.ts +2 -0
- package/lib/_internal/icon/index.js +4 -1
- package/lib/_internal/icon/src/UIcon.d.ts +126 -0
- package/lib/_internal/icon/src/UIcon.js +108 -0
- package/lib/_mixins/use-config.d.ts +2 -1
- package/lib/_mixins/use-config.js +1 -0
- package/lib/components.d.ts +113 -34
- package/lib/config-provider/src/ConfigProvider.d.ts +4 -1
- package/lib/config-provider/src/ConfigProvider.js +8 -0
- package/lib/config-provider/src/interface.d.ts +1 -1
- package/lib/config-provider/src/internal-interface.d.ts +8 -0
- package/lib/icon/src/Icon.d.ts +2 -109
- package/lib/icon/src/Icon.js +3 -73
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -1
- package/web-types.json +11 -1
package/es/icon/src/Icon.d.ts
CHANGED
|
@@ -1,109 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type Depth = 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5' | undefined;
|
|
4
|
-
export declare const iconProps: {
|
|
5
|
-
readonly depth: PropType<Depth>;
|
|
6
|
-
readonly size: PropType<number | string>;
|
|
7
|
-
readonly color: StringConstructor;
|
|
8
|
-
readonly component: PropType<Component>;
|
|
9
|
-
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
10
|
-
readonly theme: PropType<import("../../_mixins").Theme<"Icon", {
|
|
11
|
-
color: string;
|
|
12
|
-
opacity1Depth: string;
|
|
13
|
-
opacity2Depth: string;
|
|
14
|
-
opacity3Depth: string;
|
|
15
|
-
opacity4Depth: string;
|
|
16
|
-
opacity5Depth: string;
|
|
17
|
-
}, any>>;
|
|
18
|
-
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
19
|
-
color: string;
|
|
20
|
-
opacity1Depth: string;
|
|
21
|
-
opacity2Depth: string;
|
|
22
|
-
opacity3Depth: string;
|
|
23
|
-
opacity4Depth: string;
|
|
24
|
-
opacity5Depth: string;
|
|
25
|
-
}, any>>>;
|
|
26
|
-
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
27
|
-
color: string;
|
|
28
|
-
opacity1Depth: string;
|
|
29
|
-
opacity2Depth: string;
|
|
30
|
-
opacity3Depth: string;
|
|
31
|
-
opacity4Depth: string;
|
|
32
|
-
opacity5Depth: string;
|
|
33
|
-
}, any>>>;
|
|
34
|
-
};
|
|
35
|
-
export type IconProps = ExtractPublicPropTypes<typeof iconProps>;
|
|
36
|
-
export declare const UIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
37
|
-
readonly depth: PropType<Depth>;
|
|
38
|
-
readonly size: PropType<number | string>;
|
|
39
|
-
readonly color: StringConstructor;
|
|
40
|
-
readonly component: PropType<Component>;
|
|
41
|
-
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
42
|
-
readonly theme: PropType<import("../../_mixins").Theme<"Icon", {
|
|
43
|
-
color: string;
|
|
44
|
-
opacity1Depth: string;
|
|
45
|
-
opacity2Depth: string;
|
|
46
|
-
opacity3Depth: string;
|
|
47
|
-
opacity4Depth: string;
|
|
48
|
-
opacity5Depth: string;
|
|
49
|
-
}, any>>;
|
|
50
|
-
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
51
|
-
color: string;
|
|
52
|
-
opacity1Depth: string;
|
|
53
|
-
opacity2Depth: string;
|
|
54
|
-
opacity3Depth: string;
|
|
55
|
-
opacity4Depth: string;
|
|
56
|
-
opacity5Depth: string;
|
|
57
|
-
}, any>>>;
|
|
58
|
-
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
59
|
-
color: string;
|
|
60
|
-
opacity1Depth: string;
|
|
61
|
-
opacity2Depth: string;
|
|
62
|
-
opacity3Depth: string;
|
|
63
|
-
opacity4Depth: string;
|
|
64
|
-
opacity5Depth: string;
|
|
65
|
-
}, any>>>;
|
|
66
|
-
}>, {
|
|
67
|
-
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
68
|
-
mergedStyle: import("vue").ComputedRef<{
|
|
69
|
-
fontSize: string | undefined;
|
|
70
|
-
color: string | undefined;
|
|
71
|
-
}>;
|
|
72
|
-
cssVars: import("vue").ComputedRef<{
|
|
73
|
-
'--u-bezier': string;
|
|
74
|
-
'--u-color': string;
|
|
75
|
-
'--u-opacity': string;
|
|
76
|
-
}> | undefined;
|
|
77
|
-
themeClass: import("vue").Ref<string, string> | undefined;
|
|
78
|
-
onRender: (() => void) | undefined;
|
|
79
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
|
-
readonly depth: PropType<Depth>;
|
|
81
|
-
readonly size: PropType<number | string>;
|
|
82
|
-
readonly color: StringConstructor;
|
|
83
|
-
readonly component: PropType<Component>;
|
|
84
|
-
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
85
|
-
readonly theme: PropType<import("../../_mixins").Theme<"Icon", {
|
|
86
|
-
color: string;
|
|
87
|
-
opacity1Depth: string;
|
|
88
|
-
opacity2Depth: string;
|
|
89
|
-
opacity3Depth: string;
|
|
90
|
-
opacity4Depth: string;
|
|
91
|
-
opacity5Depth: string;
|
|
92
|
-
}, any>>;
|
|
93
|
-
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
94
|
-
color: string;
|
|
95
|
-
opacity1Depth: string;
|
|
96
|
-
opacity2Depth: string;
|
|
97
|
-
opacity3Depth: string;
|
|
98
|
-
opacity4Depth: string;
|
|
99
|
-
opacity5Depth: string;
|
|
100
|
-
}, any>>>;
|
|
101
|
-
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Icon", {
|
|
102
|
-
color: string;
|
|
103
|
-
opacity1Depth: string;
|
|
104
|
-
opacity2Depth: string;
|
|
105
|
-
opacity3Depth: string;
|
|
106
|
-
opacity4Depth: string;
|
|
107
|
-
opacity5Depth: string;
|
|
108
|
-
}, any>>>;
|
|
109
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1
|
+
export { iconProps, UIcon } from '../../_internal/icon';
|
|
2
|
+
export type { Depth, GenericUIcon, IconNameOf, IconProps } from '../../_internal/icon';
|
package/es/icon/src/Icon.mjs
CHANGED
|
@@ -1,93 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { useConfig, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
3
|
-
import { formatLength, warn } from "../../_utils/index.mjs";
|
|
4
|
-
import { iconLight } from "../styles/index.mjs";
|
|
5
|
-
import style from "./styles/index.cssr.mjs";
|
|
6
|
-
export const iconProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
7
|
-
depth: [String, Number],
|
|
8
|
-
size: [Number, String],
|
|
9
|
-
color: String,
|
|
10
|
-
component: Object,
|
|
11
|
-
onClick: Function
|
|
12
|
-
});
|
|
13
|
-
export const UIcon = defineComponent({
|
|
14
|
-
_n_icon__: true,
|
|
15
|
-
name: 'Icon',
|
|
16
|
-
inheritAttrs: false,
|
|
17
|
-
props: iconProps,
|
|
18
|
-
setup(props) {
|
|
19
|
-
const {
|
|
20
|
-
mergedClsPrefixRef,
|
|
21
|
-
inlineThemeDisabled
|
|
22
|
-
} = useConfig(props);
|
|
23
|
-
const themeRef = useTheme('Icon', '-icon', style, iconLight, props, mergedClsPrefixRef);
|
|
24
|
-
const cssVarsRef = computed(() => {
|
|
25
|
-
const {
|
|
26
|
-
depth
|
|
27
|
-
} = props;
|
|
28
|
-
const {
|
|
29
|
-
common: {
|
|
30
|
-
cubicBezierEaseInOut
|
|
31
|
-
},
|
|
32
|
-
self
|
|
33
|
-
} = themeRef.value;
|
|
34
|
-
if (depth !== undefined) {
|
|
35
|
-
const {
|
|
36
|
-
color,
|
|
37
|
-
[`opacity${depth}Depth`]: opacity
|
|
38
|
-
} = self;
|
|
39
|
-
return {
|
|
40
|
-
'--u-bezier': cubicBezierEaseInOut,
|
|
41
|
-
'--u-color': color,
|
|
42
|
-
'--u-opacity': opacity
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
'--u-bezier': cubicBezierEaseInOut,
|
|
47
|
-
'--u-color': '',
|
|
48
|
-
'--u-opacity': ''
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
const themeClassHandle = inlineThemeDisabled ? useThemeClass('icon', computed(() => `${props.depth || 'd'}`), cssVarsRef, props) : undefined;
|
|
52
|
-
return {
|
|
53
|
-
mergedClsPrefix: mergedClsPrefixRef,
|
|
54
|
-
mergedStyle: computed(() => {
|
|
55
|
-
const {
|
|
56
|
-
size,
|
|
57
|
-
color
|
|
58
|
-
} = props;
|
|
59
|
-
return {
|
|
60
|
-
fontSize: formatLength(size),
|
|
61
|
-
color
|
|
62
|
-
};
|
|
63
|
-
}),
|
|
64
|
-
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
65
|
-
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
66
|
-
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
render() {
|
|
70
|
-
var _a;
|
|
71
|
-
const {
|
|
72
|
-
$parent,
|
|
73
|
-
depth,
|
|
74
|
-
mergedClsPrefix,
|
|
75
|
-
component,
|
|
76
|
-
onRender,
|
|
77
|
-
themeClass
|
|
78
|
-
} = this;
|
|
79
|
-
if ((_a = $parent === null || $parent === void 0 ? void 0 : $parent.$options) === null || _a === void 0 ? void 0 : _a._n_icon__) {
|
|
80
|
-
warn('icon', 'don\'t wrap `u-icon` inside `u-icon`');
|
|
81
|
-
}
|
|
82
|
-
onRender === null || onRender === void 0 ? void 0 : onRender();
|
|
83
|
-
return h('i', mergeProps(this.$attrs, {
|
|
84
|
-
role: 'img',
|
|
85
|
-
class: [`${mergedClsPrefix}-icon`, themeClass, {
|
|
86
|
-
[`${mergedClsPrefix}-icon--depth`]: depth,
|
|
87
|
-
[`${mergedClsPrefix}-icon--color-transition`]: depth !== undefined
|
|
88
|
-
}],
|
|
89
|
-
style: [this.cssVars, this.mergedStyle],
|
|
90
|
-
onClick: this.onClick
|
|
91
|
-
}), component ? h(component) : this.$slots);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
1
|
+
export { iconProps, UIcon } from "../../_internal/icon/index.mjs";
|
package/es/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.0.0
|
|
1
|
+
declare const _default: "2.0.0";
|
|
2
2
|
export default _default;
|
package/es/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '2.0.0
|
|
1
|
+
export default '2.0.0';
|
|
@@ -3,6 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UBaseIcon = void 0;
|
|
6
|
+
exports.UIcon = exports.iconProps = exports.UBaseIcon = void 0;
|
|
7
7
|
var Icon_1 = require("./src/Icon");
|
|
8
8
|
Object.defineProperty(exports, "UBaseIcon", { enumerable: true, get: function () { return __importDefault(Icon_1).default; } });
|
|
9
|
+
var UIcon_1 = require("./src/UIcon");
|
|
10
|
+
Object.defineProperty(exports, "iconProps", { enumerable: true, get: function () { return UIcon_1.iconProps; } });
|
|
11
|
+
Object.defineProperty(exports, "UIcon", { enumerable: true, get: function () { return UIcon_1.UIcon; } });
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { IconPackBase, IconPackRegistry } from '@uzum-tech/icons';
|
|
2
|
+
import type { Component, PropType, VNodeChild } from 'vue';
|
|
3
|
+
import type { ExtractPublicPropTypes } from '../../../_utils';
|
|
4
|
+
import type { IconPackName } from '../../../config-provider/src/internal-interface';
|
|
5
|
+
export type Depth = 1 | 2 | 3 | 4 | 5 | '1' | '2' | '3' | '4' | '5' | undefined;
|
|
6
|
+
export type IconNameOf<P extends IconPackName> = IconPackRegistry extends Record<P, infer Pack> ? Pack extends IconPackBase<infer Name> ? Name : string : string;
|
|
7
|
+
export declare const iconProps: {
|
|
8
|
+
readonly depth: PropType<Depth>;
|
|
9
|
+
readonly size: PropType<number | string>;
|
|
10
|
+
readonly color: StringConstructor;
|
|
11
|
+
readonly component: PropType<Component>;
|
|
12
|
+
readonly name: PropType<string>;
|
|
13
|
+
readonly pack: PropType<IconPackName>;
|
|
14
|
+
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
15
|
+
readonly theme: PropType<import("../../../_mixins").Theme<"Icon", {
|
|
16
|
+
color: string;
|
|
17
|
+
opacity1Depth: string;
|
|
18
|
+
opacity2Depth: string;
|
|
19
|
+
opacity3Depth: string;
|
|
20
|
+
opacity4Depth: string;
|
|
21
|
+
opacity5Depth: string;
|
|
22
|
+
}, any>>;
|
|
23
|
+
readonly themeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
24
|
+
color: string;
|
|
25
|
+
opacity1Depth: string;
|
|
26
|
+
opacity2Depth: string;
|
|
27
|
+
opacity3Depth: string;
|
|
28
|
+
opacity4Depth: string;
|
|
29
|
+
opacity5Depth: string;
|
|
30
|
+
}, any>>>;
|
|
31
|
+
readonly builtinThemeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
32
|
+
color: string;
|
|
33
|
+
opacity1Depth: string;
|
|
34
|
+
opacity2Depth: string;
|
|
35
|
+
opacity3Depth: string;
|
|
36
|
+
opacity4Depth: string;
|
|
37
|
+
opacity5Depth: string;
|
|
38
|
+
}, any>>>;
|
|
39
|
+
};
|
|
40
|
+
export type IconProps = ExtractPublicPropTypes<typeof iconProps>;
|
|
41
|
+
declare const UIconImpl: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
42
|
+
readonly depth: PropType<Depth>;
|
|
43
|
+
readonly size: PropType<number | string>;
|
|
44
|
+
readonly color: StringConstructor;
|
|
45
|
+
readonly component: PropType<Component>;
|
|
46
|
+
readonly name: PropType<string>;
|
|
47
|
+
readonly pack: PropType<IconPackName>;
|
|
48
|
+
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
49
|
+
readonly theme: PropType<import("../../../_mixins").Theme<"Icon", {
|
|
50
|
+
color: string;
|
|
51
|
+
opacity1Depth: string;
|
|
52
|
+
opacity2Depth: string;
|
|
53
|
+
opacity3Depth: string;
|
|
54
|
+
opacity4Depth: string;
|
|
55
|
+
opacity5Depth: string;
|
|
56
|
+
}, any>>;
|
|
57
|
+
readonly themeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
58
|
+
color: string;
|
|
59
|
+
opacity1Depth: string;
|
|
60
|
+
opacity2Depth: string;
|
|
61
|
+
opacity3Depth: string;
|
|
62
|
+
opacity4Depth: string;
|
|
63
|
+
opacity5Depth: string;
|
|
64
|
+
}, any>>>;
|
|
65
|
+
readonly builtinThemeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
66
|
+
color: string;
|
|
67
|
+
opacity1Depth: string;
|
|
68
|
+
opacity2Depth: string;
|
|
69
|
+
opacity3Depth: string;
|
|
70
|
+
opacity4Depth: string;
|
|
71
|
+
opacity5Depth: string;
|
|
72
|
+
}, any>>>;
|
|
73
|
+
}>, {
|
|
74
|
+
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
75
|
+
resolvedPackedIcon: import("vue").ComputedRef<VNodeChild>;
|
|
76
|
+
mergedStyle: import("vue").ComputedRef<{
|
|
77
|
+
fontSize: string | undefined;
|
|
78
|
+
color: string | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
cssVars: import("vue").ComputedRef<{
|
|
81
|
+
'--u-bezier': string;
|
|
82
|
+
'--u-color': string;
|
|
83
|
+
'--u-opacity': string;
|
|
84
|
+
}> | undefined;
|
|
85
|
+
themeClass: import("vue").Ref<string, string> | undefined;
|
|
86
|
+
onRender: (() => void) | undefined;
|
|
87
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
88
|
+
readonly depth: PropType<Depth>;
|
|
89
|
+
readonly size: PropType<number | string>;
|
|
90
|
+
readonly color: StringConstructor;
|
|
91
|
+
readonly component: PropType<Component>;
|
|
92
|
+
readonly name: PropType<string>;
|
|
93
|
+
readonly pack: PropType<IconPackName>;
|
|
94
|
+
readonly onClick: PropType<(e: MouseEvent) => void>;
|
|
95
|
+
readonly theme: PropType<import("../../../_mixins").Theme<"Icon", {
|
|
96
|
+
color: string;
|
|
97
|
+
opacity1Depth: string;
|
|
98
|
+
opacity2Depth: string;
|
|
99
|
+
opacity3Depth: string;
|
|
100
|
+
opacity4Depth: string;
|
|
101
|
+
opacity5Depth: string;
|
|
102
|
+
}, any>>;
|
|
103
|
+
readonly themeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
104
|
+
color: string;
|
|
105
|
+
opacity1Depth: string;
|
|
106
|
+
opacity2Depth: string;
|
|
107
|
+
opacity3Depth: string;
|
|
108
|
+
opacity4Depth: string;
|
|
109
|
+
opacity5Depth: string;
|
|
110
|
+
}, any>>>;
|
|
111
|
+
readonly builtinThemeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
112
|
+
color: string;
|
|
113
|
+
opacity1Depth: string;
|
|
114
|
+
opacity2Depth: string;
|
|
115
|
+
opacity3Depth: string;
|
|
116
|
+
opacity4Depth: string;
|
|
117
|
+
opacity5Depth: string;
|
|
118
|
+
}, any>>>;
|
|
119
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
120
|
+
type IconBaseProps = Omit<IconProps, 'name' | 'pack'>;
|
|
121
|
+
export type GenericUIcon = <P extends IconPackName = IconPackName>(props: IconBaseProps & {
|
|
122
|
+
pack?: P;
|
|
123
|
+
name?: IconNameOf<P>;
|
|
124
|
+
}) => any;
|
|
125
|
+
export declare const UIcon: typeof UIconImpl & GenericUIcon;
|
|
126
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UIcon = exports.iconProps = void 0;
|
|
7
|
+
const vue_1 = require("vue");
|
|
8
|
+
const _mixins_1 = require("../../../_mixins");
|
|
9
|
+
const _utils_1 = require("../../../_utils");
|
|
10
|
+
const index_cssr_1 = __importDefault(require("../../../icon/src/styles/index.cssr"));
|
|
11
|
+
const styles_1 = require("../../../icon/styles");
|
|
12
|
+
const Icon_1 = __importDefault(require("./Icon"));
|
|
13
|
+
exports.iconProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { depth: [String, Number], size: [Number, String], color: String, component: Object, name: String, pack: String, onClick: Function });
|
|
14
|
+
const UIconImpl = (0, vue_1.defineComponent)({
|
|
15
|
+
_n_icon__: true,
|
|
16
|
+
name: 'Icon',
|
|
17
|
+
props: exports.iconProps,
|
|
18
|
+
setup(props) {
|
|
19
|
+
const { mergedClsPrefixRef, mergedIconPacksRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
20
|
+
const themeRef = (0, _mixins_1.useTheme)('Icon', '-icon', index_cssr_1.default, styles_1.iconLight, props, mergedClsPrefixRef);
|
|
21
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
22
|
+
const { depth } = props;
|
|
23
|
+
const { common: { cubicBezierEaseInOut }, self } = themeRef.value;
|
|
24
|
+
if (depth !== undefined) {
|
|
25
|
+
const { color, [`opacity${depth}Depth`]: opacity } = self;
|
|
26
|
+
return {
|
|
27
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
28
|
+
'--u-color': color,
|
|
29
|
+
'--u-opacity': opacity
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
34
|
+
'--u-color': '',
|
|
35
|
+
'--u-opacity': ''
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const themeClassHandle = inlineThemeDisabled
|
|
39
|
+
? (0, _mixins_1.useThemeClass)('icon', (0, vue_1.computed)(() => `${props.depth || 'd'}`), cssVarsRef, props)
|
|
40
|
+
: undefined;
|
|
41
|
+
const resolvedPackedIconRef = (0, vue_1.computed)(() => {
|
|
42
|
+
const { name, pack } = props;
|
|
43
|
+
if (!name)
|
|
44
|
+
return null;
|
|
45
|
+
const config = mergedIconPacksRef === null || mergedIconPacksRef === void 0 ? void 0 : mergedIconPacksRef.value;
|
|
46
|
+
if (!config) {
|
|
47
|
+
(0, _utils_1.warn)('icon', 'no icon packs configured on `u-config-provider`');
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const targetName = pack !== null && pack !== void 0 ? pack : config.defaultPackName;
|
|
51
|
+
const target = config.packs.find(p => p.name === targetName);
|
|
52
|
+
if (!target) {
|
|
53
|
+
(0, _utils_1.warn)('icon', `icon pack "${targetName}" not found`);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
if (config.async) {
|
|
57
|
+
return target.renderAsyncIcon(name);
|
|
58
|
+
}
|
|
59
|
+
if (!('renderIcon' in target)) {
|
|
60
|
+
(0, _utils_1.warn)('icon', `pack "${target.name}" is async-only, set \`async: true\` on \`u-config-provider :icon-packs\``);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return target.renderIcon(name);
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
67
|
+
resolvedPackedIcon: resolvedPackedIconRef,
|
|
68
|
+
mergedStyle: (0, vue_1.computed)(() => {
|
|
69
|
+
const { size, color } = props;
|
|
70
|
+
return {
|
|
71
|
+
fontSize: (0, _utils_1.formatLength)(size),
|
|
72
|
+
color
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
76
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
77
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
render() {
|
|
81
|
+
var _a;
|
|
82
|
+
const { $parent, depth, mergedClsPrefix, component, onRender, themeClass, resolvedPackedIcon } = this;
|
|
83
|
+
if ((_a = $parent === null || $parent === void 0 ? void 0 : $parent.$options) === null || _a === void 0 ? void 0 : _a._n_icon__) {
|
|
84
|
+
(0, _utils_1.warn)('icon', 'don\'t wrap `u-icon` inside `u-icon`');
|
|
85
|
+
}
|
|
86
|
+
onRender === null || onRender === void 0 ? void 0 : onRender();
|
|
87
|
+
return (0, vue_1.h)(Icon_1.default, {
|
|
88
|
+
clsPrefix: mergedClsPrefix,
|
|
89
|
+
role: 'img',
|
|
90
|
+
class: [
|
|
91
|
+
`${mergedClsPrefix}-icon`,
|
|
92
|
+
themeClass,
|
|
93
|
+
{
|
|
94
|
+
[`${mergedClsPrefix}-icon--depth`]: depth,
|
|
95
|
+
[`${mergedClsPrefix}-icon--color-transition`]: depth !== undefined
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
style: [this.cssVars, this.mergedStyle],
|
|
99
|
+
onClick: this.onClick
|
|
100
|
+
}, {
|
|
101
|
+
default: () => {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
return resolvedPackedIcon !== null && resolvedPackedIcon !== void 0 ? resolvedPackedIcon : (component ? (0, vue_1.h)(component) : (_b = (_a = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
exports.UIcon = UIconImpl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
-
import type { Breakpoints, GlobalComponentConfig, RtlEnabledState } from '../config-provider/src/internal-interface';
|
|
2
|
+
import type { Breakpoints, GlobalComponentConfig, IconPacksConfig, RtlEnabledState } from '../config-provider/src/internal-interface';
|
|
3
3
|
type UseConfigProps = Readonly<{
|
|
4
4
|
bordered?: boolean;
|
|
5
5
|
[key: string]: unknown;
|
|
@@ -14,6 +14,7 @@ export default function useConfig(props?: UseConfigProps, options?: {
|
|
|
14
14
|
mergedClsPrefixRef: Ref<string>;
|
|
15
15
|
mergedBreakpointsRef: Ref<Breakpoints> | undefined;
|
|
16
16
|
mergedComponentPropsRef: Ref<GlobalComponentConfig | undefined> | undefined;
|
|
17
|
+
mergedIconPacksRef: Ref<IconPacksConfig | undefined> | undefined;
|
|
17
18
|
namespaceRef: ComputedRef<string | undefined>;
|
|
18
19
|
};
|
|
19
20
|
export declare function useMergedClsPrefix(): Ref<string>;
|
|
@@ -15,6 +15,7 @@ function useConfig(props = {}, options = {
|
|
|
15
15
|
inlineThemeDisabled: UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.inlineThemeDisabled,
|
|
16
16
|
mergedRtlRef: UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedRtlRef,
|
|
17
17
|
mergedComponentPropsRef: UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedComponentPropsRef,
|
|
18
|
+
mergedIconPacksRef: UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedIconPacksRef,
|
|
18
19
|
mergedBreakpointsRef: UConfigProvider === null || UConfigProvider === void 0 ? void 0 : UConfigProvider.mergedBreakpointsRef,
|
|
19
20
|
mergedBorderedRef: (0, vue_1.computed)(() => {
|
|
20
21
|
var _a, _b;
|