Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@component-driven/with-selector
Advanced tools
Preview components in specific pseudo-state like :hover, :focused, :active.
Readme
Allows previewing a wrapped component in a specific pseudo-state like hover, focused, active.
Please note, that it required the pseudo-styles to be present on your component. Doesn't work with default HTML elements without pseudo-styles overrides.
import styled from 'styled-components'
const Button = styled('button')`
padding: 10px;
margin-right: 5px;
border: 2px solid blue;
border-radius: 4px;
background: #efefef;
&:hover:enabled {
background: #ccc;
border-color: red;
}
&:focus {
outline: none;
border-color: orange;
}
&:active {
border-color: #333;
background: #888;
color: #fff;
&:not([aria-disabled='true']) {
background: cadetblue;
border-color: darkblue;
color: #f5f5f5;
}
}
&.custom-class {
background: green;
}
`
;<>
<Button>normal</Button>
<WithSelector selector=":hover:enabled">
<Button>hover</Button>
</WithSelector>
<WithSelector selector=":focus">
<Button>focus</Button>
</WithSelector>
<WithSelector selector=":active">
<Button>active</Button>
</WithSelector>
<WithSelector selector={`:active:not([aria-disabled="true"])`}>
<Button>active:not([aria-disabled="true"])</Button>
</WithSelector>
<WithSelector selector=".custom-class">
<Button>class-name</Button>
</WithSelector>
</>
import styled from 'styled-components'
const InputWrapper = styled('div')({
padding: 4,
border: '1px solid #ccc',
borderRadius: 3,
background: '#efefef',
'& > input': {
border: '1px solid green'
},
'> button': {
position: 'relative',
appearance: 'none',
'::after': {
position: 'absolute',
right: 0,
top: 0,
background: 'pink',
content: "''"
}
},
':focus-within': {
background: '#ccc',
input: {
outline: 'none',
borderColor: 'red'
},
button: {
marginLeft: 10,
borderColor: 'yellow',
'::after': {
content: "'focus'"
}
}
}
})
const Input = React.forwardRef((props, ref) => (
<InputWrapper {...props} ref={ref}>
<input type="text" />
<button>this is a nested button</button>
</InputWrapper>
))
;<>
<Input placeholder="Normal input" />
<WithSelector selector=":focus-within">
<Input placeholder="Normal input" />
</WithSelector>
</>
FAQs
Preview components in specific pseudo-state like :hover, :focused, :active.
The npm package @component-driven/with-selector receives a total of 1,208 weekly downloads. As such, @component-driven/with-selector popularity was classified as popular.
We found that @component-driven/with-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.