mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
586fb46b10
The custom date-range picker switched to its two-column layout (date fields | calendar) based on the viewport width via Tailwind `sm:` (640px). But the popover is clamped to `100vw - 2rem` and anchored to its trigger with `align="end"`, so its actual available width is not the viewport width. On narrow windows the wide two-column layout could activate while the popover only had room for one column, pushing the calendar column off the right edge of the window where it was clipped and unusable (month header and 4 of 7 weekday columns cut off). Gate the two-column layout on the popover's own inline size via a CSS container query instead of the viewport, and let the popover width shrink to fit the viewport. When the popover is genuinely wide it shows two columns; when it is clamped narrow it stacks vertically so the calendar stays fully visible. The base stacked layout is the safe fallback for engines without container-query support. Closes #4669
227 lines
4.6 KiB
CSS
227 lines
4.6 KiB
CSS
@tailwind base;
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
|
|
@layer base {
|
|
:root {
|
|
--background: 0 0% 100%;
|
|
--foreground: 240 10% 3.9%;
|
|
--card: 0 0% 100%;
|
|
--card-foreground: 240 10% 3.9%;
|
|
--popover: 0 0% 100%;
|
|
--popover-foreground: 240 10% 3.9%;
|
|
|
|
--primary: 210 100% 56%;
|
|
--primary-foreground: 0 0% 100%;
|
|
|
|
--secondary: 240 4.8% 95.9%;
|
|
--secondary-foreground: 240 5.9% 10%;
|
|
|
|
--muted: 240 4.8% 95.9%;
|
|
--muted-foreground: 240 3.8% 46.1%;
|
|
--accent: 240 4.8% 95.9%;
|
|
--accent-foreground: 240 5.9% 10%;
|
|
|
|
--destructive: 0 84.2% 60.2%;
|
|
--destructive-foreground: 0 0% 98%;
|
|
|
|
--border: 240 5.9% 90%;
|
|
--input: 240 5.9% 90%;
|
|
--ring: 210 100% 56%;
|
|
|
|
--radius: 0.5rem;
|
|
}
|
|
|
|
.dark {
|
|
--background: 240 5% 12%;
|
|
--foreground: 0 0% 98%;
|
|
--card: 240 5% 16%;
|
|
--card-foreground: 0 0% 98%;
|
|
--popover: 240 5% 16%;
|
|
--popover-foreground: 0 0% 98%;
|
|
|
|
--primary: 210 100% 54%;
|
|
--primary-foreground: 0 0% 100%;
|
|
|
|
--secondary: 240 5% 18%;
|
|
--secondary-foreground: 0 0% 98%;
|
|
|
|
--muted: 240 5% 18%;
|
|
--muted-foreground: 240 5% 64.9%;
|
|
--accent: 240 5% 18%;
|
|
--accent-foreground: 0 0% 98%;
|
|
|
|
--destructive: 0 62.8% 30.6%;
|
|
--destructive-foreground: 0 0% 98%;
|
|
|
|
--border: 240 5% 24%;
|
|
--input: 240 5% 24%;
|
|
--ring: 210 100% 54%;
|
|
}
|
|
}
|
|
|
|
.glass {
|
|
background: rgba(255, 255, 255, 0.7);
|
|
backdrop-filter: blur(10px);
|
|
-webkit-backdrop-filter: blur(10px);
|
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.dark .glass {
|
|
background: rgba(255, 255, 255, 0.05);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.glass-card {
|
|
background: rgba(255, 255, 255, 0.8);
|
|
backdrop-filter: blur(20px);
|
|
-webkit-backdrop-filter: blur(20px);
|
|
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.dark .glass-card {
|
|
background: linear-gradient(
|
|
145deg,
|
|
rgba(255, 255, 255, 0.05) 0%,
|
|
rgba(255, 255, 255, 0.01) 100%
|
|
);
|
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
|
}
|
|
|
|
.glass-card-active {
|
|
background: rgba(59, 130, 246, 0.08);
|
|
border: 1px solid rgba(59, 130, 246, 0.4);
|
|
}
|
|
|
|
.dark .glass-card-active {
|
|
background: rgba(59, 130, 246, 0.12);
|
|
border: 1px solid rgba(59, 130, 246, 0.3);
|
|
}
|
|
|
|
.glass-header {
|
|
background: hsl(var(--background));
|
|
backdrop-filter: none;
|
|
-webkit-backdrop-filter: none;
|
|
border: none;
|
|
border-top: 2px solid hsl(var(--border));
|
|
}
|
|
|
|
.dark .glass-header {
|
|
background: hsl(var(--background));
|
|
border: none;
|
|
border-top: 2px solid hsl(var(--border));
|
|
}
|
|
|
|
[data-tauri-drag-region] {
|
|
-webkit-app-region: drag;
|
|
}
|
|
|
|
[data-tauri-no-drag],
|
|
[data-tauri-drag-region] .no-drag {
|
|
-webkit-app-region: no-drag;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
scrollbar-width: none;
|
|
-ms-overflow-style: none;
|
|
}
|
|
|
|
html {
|
|
@apply font-sans antialiased;
|
|
line-height: 1.5;
|
|
color-scheme: light;
|
|
overscroll-behavior: none;
|
|
}
|
|
|
|
body {
|
|
@apply m-0 p-0 text-sm;
|
|
background-color: hsl(var(--background));
|
|
color: hsl(var(--foreground));
|
|
}
|
|
|
|
html.dark {
|
|
color-scheme: dark;
|
|
}
|
|
|
|
::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
*:focus-visible {
|
|
@apply outline-2 outline-blue-500 outline-offset-2;
|
|
}
|
|
|
|
@layer utilities {
|
|
.scroll-overlay {
|
|
scrollbar-gutter: stable both-edges;
|
|
padding-right: 0.5rem;
|
|
margin-right: -0.5rem;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
.border-default {
|
|
border-width: 1px;
|
|
border-color: hsl(var(--border));
|
|
}
|
|
|
|
.border-active {
|
|
border-width: 2px;
|
|
}
|
|
|
|
.border-border-default {
|
|
border-color: hsl(var(--border));
|
|
}
|
|
|
|
.border-border-active {
|
|
border-color: hsl(var(--primary));
|
|
}
|
|
|
|
.border-border-hover {
|
|
border-color: hsl(var(--primary) / 0.4);
|
|
}
|
|
|
|
.border-border-dragging {
|
|
border-color: hsl(var(--primary) / 0.6);
|
|
}
|
|
}
|
|
|
|
input[type="password"]::-ms-reveal,
|
|
input[type="password"]::-ms-clear {
|
|
display: none;
|
|
}
|
|
|
|
/*
|
|
* Usage date-range picker popover.
|
|
*
|
|
* The two-column layout (date fields | calendar) must depend on how much
|
|
* width the popover itself actually has — not on the viewport. The popover is
|
|
* clamped to `100vw - 2rem` and anchored to its trigger, so a viewport-based
|
|
* breakpoint (e.g. Tailwind `sm:`) could enable the wide layout while the
|
|
* popover only had room for one column, pushing the calendar off-screen.
|
|
*
|
|
* A container query keys the layout to the popover's own inline size. The base
|
|
* (stacked) layout is the safe fallback when container queries are
|
|
* unsupported, keeping the calendar fully visible at any width.
|
|
*/
|
|
.usage-range-popover {
|
|
container-type: inline-size;
|
|
}
|
|
|
|
@container (min-width: 500px) {
|
|
.usage-range-layout {
|
|
flex-direction: row;
|
|
}
|
|
|
|
.usage-range-fields {
|
|
width: 250px;
|
|
flex: none;
|
|
}
|
|
|
|
.usage-range-calendar {
|
|
min-width: 0;
|
|
flex: 1 1 0%;
|
|
}
|
|
}
|