Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@clds/common-definitions
Advanced tools
Common interfaces/types for other packages.
Install the package using Yarn:
pnpm install @clds/common-definitions
Interface for props of all UI components.
Interface for props of all form field components (requires implementation of mixed field control).
Interface for props of components that can be wrapped with styled() from styled-components.
Mixed control mode refers to how the component deals with specific state that is required by the component. There are two types of components:
useState()
call)useState()
call) is defined higher in the component hierarchy.Mixed control mode is about making the component to support both cases:
Design system components should expose useful API that supports both use cases at the same time.
For example, when creating <DropdownMenu items={...}/>
we don't want control the opened state, we just expect that the dropdown opens on click and closes when menu item is selected.
But there could be something special, like "in-app onboarding", when we want to open this menu programatically.
Then we need something like <DropdownMenu isOpened={stateWeControl} onOpenedChange={ourOwnLogic} items={...}/>
.
MixedControlProps
is a group of types that will help to create those props in the conventional way.
The goal is to support type-level API consistency of components.
We cover all naming conventions and forbid impossible state like having defaultValue and value at the same time. There are 3 main types:
ExplicitMixedControlProps
ImplicitMixedControlProps
ExplicitMixedControlProps
can be problematic, for example some props are additional, so forcing ie. <DropdownMenu defaultOpened={false}
seems an overkill since
for DropdownMenu defaultOpened should be just false and passing it explicitly isn't convenient.value
is also provided)ImplicitTraceableMixedControlProps
<DropdownMenu onFocusedIdChange={analytics.track('focused')} ... />
but please use it carefully to not encourage trying to use this prop as a source of truth.Import one of the interfaces and extend.
This library follows Semantic Versioning.
See LICENSE
FAQs
Common Design System TypeScript definitions
The npm package @clds/common-definitions receives a total of 454 weekly downloads. As such, @clds/common-definitions popularity was classified as not popular.
We found that @clds/common-definitions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.