
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@snack-uikit/toggles
Advanced tools
Компоненты, реализующие переключатели.
npm i @snack-uikit/toggles
Хук для элементов внутри группы переключателей.
value: string
Уникальное значение для элемента в группе
function ToggleCard(props: ToggleCardProps) {
const { isChecked, handleClick, multipleSelection } = useToggleGroup(props.id);
return (
<Card {...props} checked={isChecked} onClick={handleClick} multipleSelection={multipleSelection}/>
);
}
const [value, setValue] = useState<string | undefined>(undefined);
function ToggleCard(props: ToggleCardProps) {
const { isChecked, handleClick, multipleSelection } = useToggleGroup(id);
return (
<Card {...props} checked={isChecked} onClick={handleClick} multipleSelection={multipleSelection}/>
);
}
// ITEMS -some array with ToggleCardProps
// ...
return (
<ToggleGroup selectionMode='single' value={value} onChange={setValue}>
{ITEMS.map(props => (
<ToggleCard key={props.id} {...props} />
))}
</ToggleGroup>
);
// ...
return (
<>
{items.map(({ checked, setChecked, data }) =>
<CustomRadioButton
// повторяет нативное поведение радиогруппы: по клику можно выбрать, но нельзя снять выбор
onClick={() => setChecked(true)}
checked={checked}
data={data}
/>
)}
</>
);
name | type | default value | description |
---|---|---|---|
id | string | - | HTML-аттрибут id |
name | string | - | HTML-аттрибут name |
value | string | - | HTML-аттрибут value |
tabIndex | number | - | HTML-аттрибут tab-index |
autofocus | boolean | - | HTML-аттрибут autofocus |
checked | boolean | - | HTML-аттрибут checked |
defaultChecked | boolean | - | HTML-аттрибут checked по-умолчанию |
disabled | boolean | - | HTML-аттрибут disabled |
onChange | (checked: boolean) => void | - | Колбек смены значения |
onClick | MouseEventHandler<HTMLInputElement> | - | Колбек клика |
onBlur | FocusEventHandler<HTMLInputElement> | - | Колбек потери фокуса |
onFocus | FocusEventHandler<HTMLInputElement> | - | Колбек приобретения фокуса |
className | string | - | CSS-класс |
size | enum Size: "s" , "m" | m | Размер |
inputRef | RefObject<HTMLInputElement> | - | |
indeterminate | boolean | - | Состояние частичного выбора |
indeterminateDefault | boolean | - | Состояние частичного выбора по-умолчанию |
name | type | default value | description |
---|---|---|---|
id | string | - | HTML-аттрибут id |
name | string | - | HTML-аттрибут name |
value | string | - | HTML-аттрибут value |
tabIndex | number | - | HTML-аттрибут tab-index |
autofocus | boolean | - | HTML-аттрибут autofocus |
checked | boolean | - | HTML-аттрибут checked |
defaultChecked | boolean | - | HTML-аттрибут checked по-умолчанию |
disabled | boolean | - | HTML-аттрибут disabled |
onChange | (checked: boolean) => void | - | Колбек смены значения |
onClick | MouseEventHandler<HTMLInputElement> | - | Колбек клика |
onBlur | FocusEventHandler<HTMLInputElement> | - | Колбек потери фокуса |
onFocus | FocusEventHandler<HTMLInputElement> | - | Колбек приобретения фокуса |
className | string | - | CSS-класс |
size | enum Size: "s" , "m" | m | Размер |
inputRef | RefObject<HTMLInputElement> | - | |
showIcon | boolean | - | Показывать ли иконку в переключателе |
loading | boolean | - |
name | type | default value | description |
---|---|---|---|
id | string | - | HTML-аттрибут id |
name | string | - | HTML-аттрибут name |
value | string | - | HTML-аттрибут value |
tabIndex | number | - | HTML-аттрибут tab-index |
autofocus | boolean | - | HTML-аттрибут autofocus |
checked | boolean | - | HTML-аттрибут checked |
defaultChecked | boolean | - | HTML-аттрибут checked по-умолчанию |
disabled | boolean | - | HTML-аттрибут disabled |
onChange | (checked: boolean) => void | - | Колбек смены значения |
onClick | MouseEventHandler<HTMLInputElement> | - | Колбек клика |
onBlur | FocusEventHandler<HTMLInputElement> | - | Колбек потери фокуса |
onFocus | FocusEventHandler<HTMLInputElement> | - | Колбек приобретения фокуса |
className | string | - | CSS-класс |
size | enum Size: "s" , "m" | - | Размер |
inputRef | RefObject<HTMLInputElement> | - |
name | type | default value | description |
---|---|---|---|
id | string | - | HTML-аттрибут id |
name | string | - | HTML-аттрибут name |
value | string | - | HTML-аттрибут value |
tabIndex | number | - | HTML-аттрибут tab-index |
autofocus | boolean | - | HTML-аттрибут autofocus |
checked | boolean | - | HTML-аттрибут checked |
defaultChecked | boolean | - | HTML-аттрибут checked по-умолчанию |
disabled | boolean | - | HTML-аттрибут disabled |
onChange | (checked: boolean) => void | - | Колбек смены значения |
onClick | MouseEventHandler<HTMLInputElement> | - | Колбек клика |
onBlur | FocusEventHandler<HTMLInputElement> | - | Колбек потери фокуса |
onFocus | FocusEventHandler<HTMLInputElement> | - | Колбек приобретения фокуса |
className | string | - | CSS-класс |
size | enum Size: "s" , "m" | m | Размер |
inputRef | RefObject<HTMLInputElement> | - | |
icon | enum FavoriteIcon: "star" , "heart" | heart | Иконка |
onKeyUp | KeyboardEventHandler<HTMLDivElement> | - | Колбек нажатия клавиши клавиатуры |
name | type | default value | description |
---|---|---|---|
defaultValue | string | string[] | - | Начальное состояние |
value | string | string[] | - | Controlled состояние |
onChange | ((value: string) => void) | ((value: string[]) => void) | - | Controlled обработчик измения состояния |
selectionMode | "single" | "multiple" | single | Режим выбора |
name | type | default value | description |
---|---|---|---|
value* | string | - |
FAQs
Unknown package
The npm package @snack-uikit/toggles receives a total of 938 weekly downloads. As such, @snack-uikit/toggles popularity was classified as not popular.
We found that @snack-uikit/toggles demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.