Files
2026-01-09 19:24:41 +00:00

334 lines
9.1 KiB
JavaScript

import {
VBtnToggleSymbol
} from "./chunk-5AQLTWWS.js";
import {
makeGroupItemProps,
useGroupItem
} from "./chunk-W6DJL42A.js";
import {
makePositionProps,
usePosition
} from "./chunk-HOEZWRBG.js";
import {
genOverlays,
makeVariantProps,
useVariant
} from "./chunk-ADXDXPPR.js";
import {
makeBorderProps,
useBorder
} from "./chunk-X7YBE6PF.js";
import {
makeElevationProps,
useElevation
} from "./chunk-YJD2PNP6.js";
import {
VProgressCircular
} from "./chunk-MH76ZJYE.js";
import {
makeLoaderProps,
useLoader
} from "./chunk-UXZ55AO7.js";
import {
makeLocationProps,
useLocation
} from "./chunk-KTTVT6V2.js";
import {
makeDensityProps,
useDensity
} from "./chunk-TM3MIDYC.js";
import {
VIcon
} from "./chunk-4XZHKYGH.js";
import {
makeSizeProps,
useSize
} from "./chunk-PIT7IT55.js";
import {
makeRoundedProps,
useRounded
} from "./chunk-AQK3CYVW.js";
import {
VDefaultsProvider
} from "./chunk-PAT7NP2Z.js";
import {
makeTagProps
} from "./chunk-2HZIACSB.js";
import {
IconValue
} from "./chunk-OJDZBU5D.js";
import {
makeRouterProps,
useLink
} from "./chunk-573D4TYC.js";
import {
ripple_default
} from "./chunk-DS4J67XG.js";
import {
makeDimensionProps,
useDimension
} from "./chunk-6EZKHCRW.js";
import {
makeThemeProps,
provideTheme
} from "./chunk-3DSR7NCB.js";
import {
genericComponent,
makeComponentProps,
propsFactory,
useRender
} from "./chunk-LZ5T2ERG.js";
import {
computed,
createBaseVNode,
createVNode,
mergeProps,
nextTick,
toDisplayString,
toRef,
watch,
withDirectives
} from "./chunk-2MKFL3BX.js";
// node_modules/vuetify/lib/components/VBtn/VBtn.js
import "/home/david/gitea_repo/personal_development/ServerManagerWebApp/frontend/node_modules/vuetify/lib/components/VBtn/VBtn.css";
// node_modules/vuetify/lib/composables/selectLink.js
function useSelectLink(link, select) {
watch(() => link.isActive?.value, (isActive) => {
if (link.isLink.value && isActive != null && select) {
nextTick(() => {
select(isActive);
});
}
}, {
immediate: true
});
}
// node_modules/vuetify/lib/components/VBtn/VBtn.js
var makeVBtnProps = propsFactory({
active: {
type: Boolean,
default: void 0
},
activeColor: String,
baseColor: String,
symbol: {
type: null,
default: VBtnToggleSymbol
},
flat: Boolean,
icon: [Boolean, String, Function, Object],
prependIcon: IconValue,
appendIcon: IconValue,
block: Boolean,
readonly: Boolean,
slim: Boolean,
stacked: Boolean,
spaced: String,
ripple: {
type: [Boolean, Object],
default: true
},
text: {
type: [String, Number, Boolean],
default: void 0
},
...makeBorderProps(),
...makeComponentProps(),
...makeDensityProps(),
...makeDimensionProps(),
...makeElevationProps(),
...makeGroupItemProps(),
...makeLoaderProps(),
...makeLocationProps(),
...makePositionProps(),
...makeRoundedProps(),
...makeRouterProps(),
...makeSizeProps(),
...makeTagProps({
tag: "button"
}),
...makeThemeProps(),
...makeVariantProps({
variant: "elevated"
})
}, "VBtn");
var VBtn = genericComponent()({
name: "VBtn",
props: makeVBtnProps(),
emits: {
"group:selected": (val) => true
},
setup(props, _ref) {
let {
attrs,
slots
} = _ref;
const {
themeClasses
} = provideTheme(props);
const {
borderClasses
} = useBorder(props);
const {
densityClasses
} = useDensity(props);
const {
dimensionStyles
} = useDimension(props);
const {
elevationClasses
} = useElevation(props);
const {
loaderClasses
} = useLoader(props);
const {
locationStyles
} = useLocation(props);
const {
positionClasses
} = usePosition(props);
const {
roundedClasses
} = useRounded(props);
const {
sizeClasses,
sizeStyles
} = useSize(props);
const group = useGroupItem(props, props.symbol, false);
const link = useLink(props, attrs);
const isActive = computed(() => {
if (props.active !== void 0) {
return props.active;
}
if (link.isRouterLink.value) {
return link.isActive?.value;
}
return group?.isSelected.value;
});
const color = toRef(() => isActive.value ? props.activeColor ?? props.color : props.color);
const variantProps = computed(() => {
const showColor = group?.isSelected.value && (!link.isLink.value || link.isActive?.value) || !group || link.isActive?.value;
return {
color: showColor ? color.value ?? props.baseColor : props.baseColor,
variant: props.variant
};
});
const {
colorClasses,
colorStyles,
variantClasses
} = useVariant(variantProps);
const isDisabled = computed(() => group?.disabled.value || props.disabled);
const isElevated = toRef(() => {
return props.variant === "elevated" && !(props.disabled || props.flat || props.border);
});
const valueAttr = computed(() => {
if (props.value === void 0 || typeof props.value === "symbol") return void 0;
return Object(props.value) === props.value ? JSON.stringify(props.value, null, 0) : props.value;
});
function onClick(e) {
if (isDisabled.value || link.isLink.value && (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0 || attrs.target === "_blank")) return;
if (link.isRouterLink.value) {
link.navigate?.(e);
} else {
group?.toggle();
}
}
useSelectLink(link, group?.select);
useRender(() => {
const Tag = link.isLink.value ? "a" : props.tag;
const hasPrepend = !!(props.prependIcon || slots.prepend);
const hasAppend = !!(props.appendIcon || slots.append);
const hasIcon = !!(props.icon && props.icon !== true);
return withDirectives(createVNode(Tag, mergeProps(link.linkProps, {
"type": Tag === "a" ? void 0 : "button",
"class": ["v-btn", group?.selectedClass.value, {
"v-btn--active": isActive.value,
"v-btn--block": props.block,
"v-btn--disabled": isDisabled.value,
"v-btn--elevated": isElevated.value,
"v-btn--flat": props.flat,
"v-btn--icon": !!props.icon,
"v-btn--loading": props.loading,
"v-btn--readonly": props.readonly,
"v-btn--slim": props.slim,
"v-btn--stacked": props.stacked
}, props.spaced ? ["v-btn--spaced", `v-btn--spaced-${props.spaced}`] : [], themeClasses.value, borderClasses.value, colorClasses.value, densityClasses.value, elevationClasses.value, loaderClasses.value, positionClasses.value, roundedClasses.value, sizeClasses.value, variantClasses.value, props.class],
"style": [colorStyles.value, dimensionStyles.value, locationStyles.value, sizeStyles.value, props.style],
"aria-busy": props.loading ? true : void 0,
"disabled": isDisabled.value && Tag !== "a" || void 0,
"tabindex": props.loading || props.readonly ? -1 : void 0,
"onClick": onClick,
"value": valueAttr.value
}), {
default: () => [genOverlays(true, "v-btn"), !props.icon && hasPrepend && createBaseVNode("span", {
"key": "prepend",
"class": "v-btn__prepend"
}, [!slots.prepend ? createVNode(VIcon, {
"key": "prepend-icon",
"icon": props.prependIcon
}, null) : createVNode(VDefaultsProvider, {
"key": "prepend-defaults",
"disabled": !props.prependIcon,
"defaults": {
VIcon: {
icon: props.prependIcon
}
}
}, slots.prepend)]), createBaseVNode("span", {
"class": "v-btn__content",
"data-no-activator": ""
}, [!slots.default && hasIcon ? createVNode(VIcon, {
"key": "content-icon",
"icon": props.icon
}, null) : createVNode(VDefaultsProvider, {
"key": "content-defaults",
"disabled": !hasIcon,
"defaults": {
VIcon: {
icon: props.icon
}
}
}, {
default: () => [slots.default?.() ?? toDisplayString(props.text)]
})]), !props.icon && hasAppend && createBaseVNode("span", {
"key": "append",
"class": "v-btn__append"
}, [!slots.append ? createVNode(VIcon, {
"key": "append-icon",
"icon": props.appendIcon
}, null) : createVNode(VDefaultsProvider, {
"key": "append-defaults",
"disabled": !props.appendIcon,
"defaults": {
VIcon: {
icon: props.appendIcon
}
}
}, slots.append)]), !!props.loading && createBaseVNode("span", {
"key": "loader",
"class": "v-btn__loader"
}, [slots.loader?.() ?? createVNode(VProgressCircular, {
"color": typeof props.loading === "boolean" ? void 0 : props.loading,
"indeterminate": true,
"width": "2"
}, null)])]
}), [[ripple_default, !isDisabled.value && props.ripple, "", {
center: !!props.icon
}]]);
});
return {
group
};
}
});
export {
makeVBtnProps,
VBtn
};
//# sourceMappingURL=chunk-UQALH6SL.js.map