All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.components.VIcon.VIcon.mjs Maven / Gradle / Ivy
import { createVNode as _createVNode } from "vue";
// Styles
import "./VIcon.css";
// Composables
import { useTextColor } from "../../composables/color.mjs";
import { makeComponentProps } from "../../composables/component.mjs";
import { IconValue, useIcon } from "../../composables/icons.mjs";
import { makeSizeProps, useSize } from "../../composables/size.mjs";
import { makeTagProps } from "../../composables/tag.mjs";
import { makeThemeProps, provideTheme } from "../../composables/theme.mjs"; // Utilities
import { computed, ref, Text, toRef } from 'vue';
import { convertToUnit, flattenFragments, genericComponent, propsFactory, useRender } from "../../util/index.mjs";
export const makeVIconProps = propsFactory({
color: String,
disabled: Boolean,
start: Boolean,
end: Boolean,
icon: IconValue,
...makeComponentProps(),
...makeSizeProps(),
...makeTagProps({
tag: 'i'
}),
...makeThemeProps()
}, 'VIcon');
export const VIcon = genericComponent()({
name: 'VIcon',
props: makeVIconProps(),
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const slotIcon = ref();
const {
themeClasses
} = provideTheme(props);
const {
iconData
} = useIcon(computed(() => slotIcon.value || props.icon));
const {
sizeClasses
} = useSize(props);
const {
textColorClasses,
textColorStyles
} = useTextColor(toRef(props, 'color'));
useRender(() => {
const slotValue = slots.default?.();
if (slotValue) {
slotIcon.value = flattenFragments(slotValue).filter(node => node.type === Text && node.children && typeof node.children === 'string')[0]?.children;
}
const hasClick = !!(attrs.onClick || attrs.onClickOnce);
return _createVNode(iconData.value.component, {
"tag": props.tag,
"icon": iconData.value.icon,
"class": ['v-icon', 'notranslate', themeClasses.value, sizeClasses.value, textColorClasses.value, {
'v-icon--clickable': hasClick,
'v-icon--disabled': props.disabled,
'v-icon--start': props.start,
'v-icon--end': props.end
}, props.class],
"style": [!sizeClasses.value ? {
fontSize: convertToUnit(props.size),
height: convertToUnit(props.size),
width: convertToUnit(props.size)
} : undefined, textColorStyles.value, props.style],
"role": hasClick ? 'button' : undefined,
"aria-hidden": !hasClick,
"tabindex": hasClick ? props.disabled ? -1 : 0 : undefined
}, {
default: () => [slotValue]
});
});
return {};
}
});
//# sourceMappingURL=VIcon.mjs.map