Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@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 604 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 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.