fix(desktop): improve legacy WebView style compatibility
This commit is contained in:
30 files changed
+1802
-459
No files matched your search
@@ -36,7 +36,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
<template>
|
||||
<DialogPortal>
|
||||
<DialogOverlay :class="props.overlayClass" />
|
||||
<div :class="cn('fixed inset-0 z-50 grid place-items-center p-4 pointer-events-none', props.portalClass)">
|
||||
<div data-slot="dialog-positioner" :class="cn('fixed inset-0 z-50 grid place-items-center p-4 pointer-events-none', props.portalClass)">
|
||||
<DialogContent
|
||||
data-slot="dialog-content"
|
||||
v-bind="{ ...$attrs, ...forwarded }"
|
||||
|
||||
@@ -23,7 +23,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
<template>
|
||||
<DialogPortal>
|
||||
<DialogOverlay />
|
||||
<div class="fixed inset-0 z-50 grid place-items-center p-4 pointer-events-none">
|
||||
<div data-slot="dialog-positioner" class="fixed inset-0 z-50 grid place-items-center p-4 pointer-events-none">
|
||||
<DialogContent
|
||||
data-slot="dialog-content"
|
||||
:class="cn('relative z-50 grid max-h-[calc(var(--dbx-viewport-height)-6rem)] w-full max-w-lg my-8 gap-4 rounded-lg border border-border bg-background p-4 shadow-lg duration-200 md:w-full pointer-events-auto', props.class)"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, nextTick, ref } from "vue";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import Input from "@/components/ui/input/Input.vue";
|
||||
|
||||
const mountedApps: Array<ReturnType<typeof createApp>> = [];
|
||||
|
||||
async function mountInput(template: string) {
|
||||
const host = document.createElement("div");
|
||||
document.body.appendChild(host);
|
||||
const app = createApp({
|
||||
components: { Input },
|
||||
setup() {
|
||||
return { value: ref("1") };
|
||||
},
|
||||
template,
|
||||
});
|
||||
app.mount(host);
|
||||
mountedApps.push(app);
|
||||
await nextTick();
|
||||
return host;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const app of mountedApps.splice(0)) app.unmount();
|
||||
document.body.replaceChildren();
|
||||
});
|
||||
|
||||
describe("Input", () => {
|
||||
it("uses the plain input for non-number fields", async () => {
|
||||
const host = await mountInput('<Input v-model="value" />');
|
||||
|
||||
expect(host.querySelectorAll("input")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("keeps number fields as native inputs and preserves narrow layout classes", async () => {
|
||||
const host = await mountInput('<Input v-model="value" type="number" step="2" class="w-14" />');
|
||||
|
||||
expect(host.querySelectorAll("input")).toHaveLength(1);
|
||||
expect(host.querySelector("input")?.className).toContain("w-14");
|
||||
});
|
||||
});
|
||||
@@ -126,4 +126,28 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
.dark .dbx-switch[aria-checked="true"] .dbx-switch-thumb {
|
||||
background-color: var(--primary-foreground) !important;
|
||||
}
|
||||
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-state="unchecked"] .dbx-switch-thumb,
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-unchecked] .dbx-switch-thumb,
|
||||
html.dbx-legacy-webview.dark .dbx-switch[aria-checked="false"] .dbx-switch-thumb {
|
||||
background-color: rgb(215, 215, 219) !important;
|
||||
}
|
||||
|
||||
html.dbx-legacy-webview.dark .dbx-switch {
|
||||
border-color: rgba(180, 180, 190, 0.46) !important;
|
||||
background-color: rgba(110, 110, 114, 0.44) !important;
|
||||
}
|
||||
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-state="checked"],
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-checked],
|
||||
html.dbx-legacy-webview.dark .dbx-switch[aria-checked="true"] {
|
||||
border-color: rgb(208, 208, 214) !important;
|
||||
background-color: rgb(208, 208, 214) !important;
|
||||
}
|
||||
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-state="checked"] .dbx-switch-thumb,
|
||||
html.dbx-legacy-webview.dark .dbx-switch[data-checked] .dbx-switch-thumb,
|
||||
html.dbx-legacy-webview.dark .dbx-switch[aria-checked="true"] .dbx-switch-thumb {
|
||||
background-color: rgb(19, 20, 22) !important;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user