@cerberus-design/panda-preset
Version:
The official Panda-CSS preset for the omni-federal design system
112 lines (110 loc) • 2.38 kB
JavaScript
import {
focusStates,
formStates
} from "./chunk-4NPQKTHD.js";
// src/recipes/slots/toggle.ts
import { defineSlotRecipe } from "@pandacss/dev";
var toggleTransitions = {
_motionSafe: {
transitionProperty: "transform, color, box-shadow",
transitionDuration: "150ms",
transitionTimingFunction: "ease-in"
},
_checked: {
transform: "translateX(164%) scale(1)"
}
};
var SM_RADII = "full";
var LG_RADII = "0.75rem";
var toggle = defineSlotRecipe({
className: "toggle",
description: "The styles for the Toggle component",
slots: ["track", "container", "input", "thumb"],
base: {
track: {
// ...Combine with hstack
bgColor: "page.surface.300",
position: "relative",
_motionSafe: {
transitionProperty: "background-color",
transitionDuration: "150ms"
},
_checked: {
bgColor: "action.bg.initial",
_groupHover: {
bgColor: "action.bg.hover"
}
}
},
input: {
appearance: "none",
h: "full",
position: "absolute",
w: "full",
zIndex: "decorator",
...focusStates,
...formStates
},
thumb: {
// ...Combine with vstack
bgColor: "white",
color: "white",
transform: "translateX(12%) scale(0.85)",
_motionSafe: toggleTransitions._motionSafe,
_peerChecked: {
...toggleTransitions._checked,
color: "action.text.200"
},
_peerDisabled: {
opacity: "0.5"
},
_groupHover: {
boxShadow: "0px 0px 8px 0px rgba(22, 1, 38, 0.4)"
}
}
},
variants: {
size: {
sm: {
track: {
h: "1.5rem",
rounded: SM_RADII,
w: "3.25rem"
},
input: {
rounded: SM_RADII
},
thumb: {
h: "1rem",
rounded: SM_RADII,
w: "1rem",
_peerChecked: {
transform: "translateX(200%) scale(1)"
}
}
},
lg: {
track: {
h: "2.5rem",
rounded: LG_RADII,
w: "5rem"
},
input: {
rounded: LG_RADII
},
thumb: {
h: "1.75rem",
rounded: LG_RADII,
w: "1.75rem"
}
}
}
},
defaultVariants: {
size: "sm"
}
});
export {
toggle
};
//# sourceMappingURL=chunk-H66J5DTP.js.map