@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
1 lines • 5.73 kB
Source Map (JSON)
{"version":3,"file":"switch.style.cjs","names":["defineComponentSlotStyle","focusRingStyle"],"sources":["../../../../src/components/switch/switch.style.ts"],"sourcesContent":["import { defineComponentSlotStyle, focusRingStyle } from \"../../core\"\n\nexport const switchStyle = defineComponentSlotStyle({\n base: {\n label: {\n userSelect: \"none\",\n },\n root: {\n alignItems: \"center\",\n cursor: \"pointer\",\n display: \"inline-flex\",\n gap: \"2\",\n _readOnly: {\n layerStyle: \"readOnly\",\n pointerEvents: \"none\",\n },\n _disabled: {\n layerStyle: \"disabled\",\n },\n },\n thumb: {\n alignItems: \"center\",\n bg: \"white\",\n display: \"inline-flex\",\n justifyContent: \"center\",\n position: \"absolute\",\n rounded: \"inherit\",\n transitionDuration: \"fast\",\n transitionProperty: \"background, transform\",\n _checked: {\n transform: \"translateX(100%)\",\n },\n },\n track: {\n \"--focus-ring-color\": \"{colorScheme.outline}\",\n alignItems: \"center\",\n bg: \"bg.muted\",\n boxSizing: \"content-box\",\n display: \"inline-flex\",\n flexShrink: 0,\n position: \"relative\",\n rounded: \"full\",\n transitionDuration: \"fast\",\n transitionProperty: \"background\",\n _peerFocusVisible: {\n ...focusRingStyle.outline,\n },\n },\n },\n\n variants: {\n thin: {\n thumb: {\n boxShadow: \"2xl\",\n _checked: {\n bg: \"colorScheme.solid\",\n },\n },\n track: {\n \"--focus-ring-offset\": \"4px\",\n _checked: {\n bg: [\"colorScheme.muted\", \"colorScheme.subtle\"],\n },\n },\n },\n thick: {\n thumb: {\n _checked: {\n bg: \"colorScheme.contrast\",\n },\n },\n track: {\n p: \"1\",\n _checked: {\n bg: \"colorScheme.solid\",\n },\n },\n },\n },\n\n sizes: {\n sm: {\n label: { fontSize: \"sm\" },\n thumb: { boxSize: \"3\" },\n track: { w: \"6\" },\n },\n md: {\n label: { fontSize: \"md\" },\n thumb: { boxSize: \"4\" },\n track: { w: \"8\" },\n },\n lg: {\n label: { fontSize: \"lg\" },\n thumb: { boxSize: \"5\" },\n track: { w: \"10\" },\n },\n },\n\n props: {\n /**\n * Change switch label from right to left.\n *\n * @default false\n */\n reverse: {\n false: {\n root: { flexDirection: \"row\" },\n },\n true: {\n root: { flexDirection: \"row-reverse\" },\n },\n },\n /**\n * The shape of the switch.\n *\n * @default circle\n */\n shape: {\n circle: {\n track: { rounded: \"full\" },\n },\n rounded: {\n thumb: { rounded: \"l1\" },\n track: { rounded: \"l2\" },\n },\n square: {\n track: { rounded: \"0\" },\n },\n },\n },\n\n compounds: [\n {\n css: {\n track: { h: \"3\" },\n },\n size: \"sm\",\n variant: \"thick\",\n },\n {\n css: {\n track: { h: \"4\" },\n },\n size: \"md\",\n variant: \"thick\",\n },\n {\n css: {\n track: { h: \"5\" },\n },\n size: \"lg\",\n variant: \"thick\",\n },\n {\n css: {\n track: { h: \"2\" },\n },\n size: \"sm\",\n variant: \"thin\",\n },\n {\n css: {\n track: { h: \"3\" },\n },\n size: \"md\",\n variant: \"thin\",\n },\n {\n css: {\n track: { h: \"4\" },\n },\n size: \"lg\",\n variant: \"thin\",\n },\n ],\n\n defaultProps: {\n size: \"md\",\n variant: \"thick\",\n shape: \"circle\",\n },\n})\n\nexport type SwitchStyle = typeof switchStyle\n"],"mappings":";;;;AAEA,MAAa,cAAcA,wCAAyB;CAClD,MAAM;EACJ,OAAO,EACL,YAAY,QACb;EACD,MAAM;GACJ,YAAY;GACZ,QAAQ;GACR,SAAS;GACT,KAAK;GACL,WAAW;IACT,YAAY;IACZ,eAAe;IAChB;GACD,WAAW,EACT,YAAY,YACb;GACF;EACD,OAAO;GACL,YAAY;GACZ,IAAI;GACJ,SAAS;GACT,gBAAgB;GAChB,UAAU;GACV,SAAS;GACT,oBAAoB;GACpB,oBAAoB;GACpB,UAAU,EACR,WAAW,oBACZ;GACF;EACD,OAAO;GACL,sBAAsB;GACtB,YAAY;GACZ,IAAI;GACJ,WAAW;GACX,SAAS;G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