vuestic-ui
Version:
Vue 3 UI Framework
38 lines (37 loc) • 1.21 kB
JavaScript
import { computed } from "vue";
import { u as useColors } from "../../../composables/useColors.js";
const useToggleIconProps = {
dropdownIcon: {
type: [String, Object],
default: () => ({
open: "va-arrow-down",
close: "va-arrow-up"
}),
validator: (value) => {
if (typeof value === "string") {
return true;
}
return Object.entries(value).every(([prop, propValue]) => ["open", "close"].includes(prop) && typeof propValue === "string");
}
}
};
const useToggleIcon = (props, showDropdownContent) => {
const toggleIcon = computed(() => {
if (!props.dropdownIcon) {
return "";
}
if (typeof props.dropdownIcon === "string") {
return props.dropdownIcon;
}
return showDropdownContent.value ? props.dropdownIcon.close : props.dropdownIcon.open;
});
const { getHoverColor, getColor } = useColors();
const colorComputed = computed(() => getColor("secondary"));
const toggleIconColor = computed(() => props.readonly ? getHoverColor(colorComputed.value) : colorComputed.value);
return { toggleIcon, toggleIconColor };
};
export {
useToggleIcon as a,
useToggleIconProps as u
};
//# sourceMappingURL=useToggleIcon.js.map