routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+144
@@ -0,0 +1,144 @@
|
||||
import { Dt as mergeProps, Kn as ref, M as Fragment, Qn as toRef, W as createBaseVNode, ar as normalizeClass, cn as useId, et as createVNode, sr as normalizeStyle } from "./vue.runtime.esm-bundler-BvoXUmaf.js";
|
||||
import { l as propsFactory, n as genericComponent, tt as SUPPORTS_MATCH_MEDIA, w as filterInputAttrs } from "./defineComponent-DB6xIcDy.js";
|
||||
import { i as VScaleTransition } from "./transitions-DCQ3sjjZ.js";
|
||||
import { t as useRender } from "./useRender-fVtVsZgv.js";
|
||||
import { t as useProxiedModel } from "./proxiedModel-DSlSIQ0y.js";
|
||||
import { t as VDefaultsProvider } from "./VDefaultsProvider-C09t4-My.js";
|
||||
import { t as VIcon } from "./VIcon-1CJH_3Uo.js";
|
||||
import { r as useLoader, t as LoaderSlot } from "./loader-CV4sMFhE.js";
|
||||
import { t as VProgressCircular } from "./VProgressCircular-yKv2qs75.js";
|
||||
import { t as forwardRefs } from "./forwardRefs-CW3d8km7.js";
|
||||
import { a as useFocus, c as makeVSelectionControlProps, n as makeVInputProps, s as VSelectionControl, t as VInput } from "./VInput-BxI8SL-_.js";
|
||||
import "/Users/thackmaster/Development/routie2/frontend/node_modules/vuetify/lib/components/VSwitch/VSwitch.css";
|
||||
//#region node_modules/vuetify/lib/components/VSwitch/VSwitch.js
|
||||
var makeVSwitchProps = propsFactory({
|
||||
indeterminate: Boolean,
|
||||
inset: Boolean,
|
||||
flat: Boolean,
|
||||
loading: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
...makeVInputProps(),
|
||||
...makeVSelectionControlProps()
|
||||
}, "VSwitch");
|
||||
var VSwitch = genericComponent()({
|
||||
name: "VSwitch",
|
||||
inheritAttrs: false,
|
||||
props: makeVSwitchProps(),
|
||||
emits: {
|
||||
"update:focused": (focused) => true,
|
||||
"update:modelValue": (value) => true,
|
||||
"update:indeterminate": (value) => true
|
||||
},
|
||||
setup(props, { attrs, slots }) {
|
||||
const indeterminate = useProxiedModel(props, "indeterminate");
|
||||
const model = useProxiedModel(props, "modelValue");
|
||||
const { loaderClasses } = useLoader(props);
|
||||
const { isFocused, focus, blur } = useFocus(props);
|
||||
const control = ref();
|
||||
const inputRef = ref();
|
||||
const isForcedColorsModeActive = SUPPORTS_MATCH_MEDIA && window.matchMedia("(forced-colors: active)").matches;
|
||||
const loaderColor = toRef(() => {
|
||||
return typeof props.loading === "string" && props.loading !== "" ? props.loading : props.color;
|
||||
});
|
||||
const uid = useId();
|
||||
const id = toRef(() => props.id || `switch-${uid}`);
|
||||
function onChange() {
|
||||
if (indeterminate.value) indeterminate.value = false;
|
||||
}
|
||||
function onTrackClick(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
control.value?.input?.click();
|
||||
}
|
||||
useRender(() => {
|
||||
const [rootAttrs, controlAttrs] = filterInputAttrs(attrs);
|
||||
const inputProps = VInput.filterProps(props);
|
||||
const controlProps = VSelectionControl.filterProps(props);
|
||||
return createVNode(VInput, mergeProps({
|
||||
"ref": inputRef,
|
||||
"class": [
|
||||
"v-switch",
|
||||
{ "v-switch--flat": props.flat },
|
||||
{ "v-switch--inset": props.inset },
|
||||
{ "v-switch--indeterminate": indeterminate.value },
|
||||
loaderClasses.value,
|
||||
props.class
|
||||
]
|
||||
}, rootAttrs, inputProps, {
|
||||
"modelValue": model.value,
|
||||
"onUpdate:modelValue": ($event) => model.value = $event,
|
||||
"id": id.value,
|
||||
"focused": isFocused.value,
|
||||
"style": props.style
|
||||
}), {
|
||||
...slots,
|
||||
default: ({ id, messagesId, isDisabled, isReadonly, isValid }) => {
|
||||
const slotProps = {
|
||||
model,
|
||||
isValid
|
||||
};
|
||||
return createVNode(VSelectionControl, mergeProps({ "ref": control }, controlProps, {
|
||||
"modelValue": model.value,
|
||||
"onUpdate:modelValue": [($event) => model.value = $event, onChange],
|
||||
"id": id.value,
|
||||
"aria-describedby": messagesId.value,
|
||||
"type": "checkbox",
|
||||
"aria-checked": indeterminate.value ? "mixed" : void 0,
|
||||
"disabled": isDisabled.value,
|
||||
"readonly": isReadonly.value,
|
||||
"onFocus": focus,
|
||||
"onBlur": blur
|
||||
}, controlAttrs), {
|
||||
...slots,
|
||||
default: ({ backgroundColorClasses, backgroundColorStyles }) => createBaseVNode("div", {
|
||||
"class": normalizeClass(["v-switch__track", !isForcedColorsModeActive ? backgroundColorClasses.value : void 0]),
|
||||
"style": normalizeStyle(backgroundColorStyles.value),
|
||||
"onClick": onTrackClick
|
||||
}, [slots["track-true"] && createBaseVNode("div", {
|
||||
"key": "prepend",
|
||||
"class": "v-switch__track-true"
|
||||
}, [slots["track-true"](slotProps)]), slots["track-false"] && createBaseVNode("div", {
|
||||
"key": "append",
|
||||
"class": "v-switch__track-false"
|
||||
}, [slots["track-false"](slotProps)])]),
|
||||
input: ({ inputNode, icon, backgroundColorClasses, backgroundColorStyles }) => createBaseVNode(Fragment, null, [inputNode, createBaseVNode("div", {
|
||||
"class": normalizeClass([
|
||||
"v-switch__thumb",
|
||||
{ "v-switch__thumb--filled": icon || props.loading },
|
||||
props.inset || isForcedColorsModeActive ? void 0 : backgroundColorClasses.value
|
||||
]),
|
||||
"style": normalizeStyle(props.inset ? void 0 : backgroundColorStyles.value)
|
||||
}, [slots.thumb ? createVNode(VDefaultsProvider, { "defaults": { VIcon: {
|
||||
icon,
|
||||
size: "x-small"
|
||||
} } }, { default: () => [slots.thumb({
|
||||
...slotProps,
|
||||
icon
|
||||
})] }) : createVNode(VScaleTransition, null, { default: () => [!props.loading ? icon && createVNode(VIcon, {
|
||||
"key": String(icon),
|
||||
"icon": icon,
|
||||
"size": "x-small"
|
||||
}, null) : createVNode(LoaderSlot, {
|
||||
"name": "v-switch",
|
||||
"active": true,
|
||||
"color": isValid.value === false ? void 0 : loaderColor.value
|
||||
}, { default: (slotProps) => slots.loader ? slots.loader(slotProps) : createVNode(VProgressCircular, {
|
||||
"active": slotProps.isActive,
|
||||
"color": slotProps.color,
|
||||
"indeterminate": true,
|
||||
"size": "16",
|
||||
"width": "2"
|
||||
}, null) })] })])])
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
return forwardRefs({}, inputRef);
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
export { VSwitch };
|
||||
|
||||
//# sourceMappingURL=vuetify_components_VSwitch.js.map
|
||||
Reference in New Issue
Block a user