@pluralsight/headless-styles
Advanced tools
Comparing version 0.0.0-alpha-37b333 to 0.0.0-alpha-439bf5
@@ -5,14 +5,10 @@ import type { ButtonOptions, ButtonType } from './types'; | ||
styles: { | ||
hover: { | ||
'&:hover': { | ||
color: string; | ||
backgroundColor: string; | ||
}; | ||
active: { | ||
'&:active': { | ||
backgroundColor: string; | ||
outline: string; | ||
}; | ||
focus: { | ||
boxShadow: string; | ||
outline: number; | ||
}; | ||
fontSize: string; | ||
@@ -26,22 +22,23 @@ padding: string; | ||
cursor: string; | ||
fontFamily: string; | ||
textAlign: string; | ||
textDecoration: string; | ||
textTransform: string; | ||
transition: string; | ||
focusNotFocusVisible: { | ||
'&:focus': { | ||
outline: string; | ||
}; | ||
'&:focus:not(:focus-visible)': { | ||
boxShadow: string; | ||
outline: number; | ||
outline: string; | ||
}; | ||
} | { | ||
hover: { | ||
'&:hover': { | ||
color: string; | ||
backgroundColor: string; | ||
}; | ||
active: { | ||
'&:active': { | ||
backgroundColor: string; | ||
outline: string; | ||
}; | ||
focus: { | ||
boxShadow: string; | ||
outline: number; | ||
}; | ||
fontSize: string; | ||
@@ -55,8 +52,13 @@ padding: string; | ||
cursor: string; | ||
fontFamily: string; | ||
textAlign: string; | ||
textDecoration: string; | ||
textTransform: string; | ||
transition: string; | ||
focusNotFocusVisible: { | ||
'&:focus': { | ||
outline: string; | ||
}; | ||
'&:focus:not(:focus-visible)': { | ||
boxShadow: string; | ||
outline: number; | ||
outline: string; | ||
}; | ||
@@ -63,0 +65,0 @@ }; |
import { psBackground, psBackgroundActive, psBackgroundHover, psBackgroundWeak, psNeutralBackground, psNeutralBackgroundActive, psNeutralBackgroundHover, psNeutralText, psNeutralTextWeak, psText, psTextMedium, } from '@pluralsight/design-tokens'; | ||
import { getDefaultOptions } from './shared'; | ||
const buttonStyles = { | ||
appearance: 'none', | ||
borderRadius: '6px', | ||
backgroundColor: 'transparent', | ||
border: 'none', | ||
cursor: 'pointer', | ||
fontSize: '16px', | ||
padding: '10px 16px', | ||
textAlign: 'center', | ||
textDecoration: 'none', | ||
transition: 'background-color 250ms ease-in-out, color 250ms ease-in-out', | ||
active: { | ||
outline: 'none', | ||
const baseStyles = { | ||
js: { | ||
appearance: 'none', | ||
borderRadius: '6px', | ||
backgroundColor: 'transparent', | ||
border: 'none', | ||
cursor: 'pointer', | ||
fontFamily: 'PS TT Commons Roman, Gotham SSm A, Gotham SSm B, Arial,sans-serif', | ||
fontSize: '16px', | ||
padding: '10px 16px', | ||
textAlign: 'center', | ||
textDecoration: 'none', | ||
textTransform: 'none', | ||
transition: 'background-color 250ms ease-in-out, color 250ms ease-in-out', | ||
'&:active': { | ||
outline: 'none', | ||
}, | ||
'&:focus': { | ||
outline: `3px solid ${psBackgroundActive}`, | ||
}, | ||
'&:focus:not(:focus-visible)': { | ||
boxShadow: 'none', | ||
outline: 'none', | ||
}, | ||
}, | ||
focus: { | ||
outline: `3px solid ${psBackgroundActive}`, | ||
}, | ||
focusNotFocusVisible: { | ||
boxShadow: 'none', | ||
outline: 0, | ||
}, | ||
}; | ||
const baseCSSProps = ` | ||
css: ` | ||
appearance: none; | ||
@@ -31,4 +34,7 @@ background-color: transparent; | ||
cursor: pointer; | ||
font-family: 'PS TT Commons Roman', 'Gotham SSm A', 'Gotham SSm B', Arial, | ||
sans-serif; | ||
text-align: center; | ||
text-decoration: none; | ||
text-transform: none; | ||
transition: background-color 250ms ease-in-out, color 250ms ease-in-out; | ||
@@ -44,5 +50,6 @@ | ||
box-shadow: none; | ||
outline: 0; | ||
outline: none; | ||
} | ||
`; | ||
`, | ||
}; | ||
function getKindStyles(kind) { | ||
@@ -163,3 +170,3 @@ switch (kind) { | ||
&:active { | ||
background-color: ${psBackgroundActive}; | ||
background-color: ${psBackgroundActive} !important; | ||
} | ||
@@ -173,3 +180,3 @@ `, | ||
active: { | ||
backgroundColor: psBackgroundActive, | ||
backgroundColor: `${psBackgroundActive} !important`, | ||
}, | ||
@@ -186,3 +193,3 @@ }, | ||
&:active { | ||
background-color: ${psNeutralBackgroundActive}; | ||
background-color: ${psNeutralBackgroundActive} !important; | ||
} | ||
@@ -196,3 +203,3 @@ `, | ||
active: { | ||
backgroundColor: psNeutralBackgroundActive, | ||
backgroundColor: `${psNeutralBackgroundActive} !important`, | ||
}, | ||
@@ -209,3 +216,3 @@ }, | ||
&:active { | ||
background-color: ${psBackgroundActive}; | ||
background-color: ${psBackgroundActive} !important; | ||
} | ||
@@ -219,3 +226,3 @@ `, | ||
active: { | ||
backgroundColor: psBackgroundActive, | ||
backgroundColor: `${psBackgroundActive} !important`, | ||
}, | ||
@@ -233,3 +240,3 @@ }, | ||
cssProps: ` | ||
${baseCSSProps} | ||
${baseStyles.css.trim()} | ||
${kindStyles.css.trim()} | ||
@@ -241,5 +248,5 @@ ${sizeStyles.css.trim()} | ||
.replace(/^ {2,12}/gm, ''), | ||
styles: Object.assign(Object.assign(Object.assign(Object.assign({}, buttonStyles), kindStyles.js), sizeStyles.js), { hover: Object.assign({}, psuedoStyles.js.hover), active: Object.assign(Object.assign({}, buttonStyles.active), psuedoStyles.js.active), focus: Object.assign(Object.assign({}, buttonStyles.focus), buttonStyles.focusNotFocusVisible) }), | ||
styles: Object.assign(Object.assign(Object.assign(Object.assign({}, baseStyles.js), kindStyles.js), sizeStyles.js), { '&:hover': Object.assign({}, psuedoStyles.js.hover), '&:active': Object.assign(Object.assign({}, baseStyles.js['&:active']), psuedoStyles.js.active) }), | ||
type: 'button', | ||
}; | ||
} |
{ | ||
"name": "@pluralsight/headless-styles", | ||
"version": "0.0.0-alpha-37b333", | ||
"version": "0.0.0-alpha-439bf5", | ||
"description": "Headless styles for Pluralsight.", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14444
435