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.
@commercetools-uikit/field-warnings
Advanced tools
Readme
The FieldWarnings
component allows the user to display field warnings.
yarn add @commercetools-uikit/field-warnings
npm --save install @commercetools-uikit/field-warnings
Additionally install the peer dependencies (if not present)
yarn add react react-intl
npm --save install react react-intl
import FieldWarnings from '../src/field-warnings';
const Example = () => (
// This example shows how to handle custom warnings on top of the
// predefined warnings of FieldWarnings which this component and other
// Field components use under the hood.
<FieldWarnings
warnings={{
customWarning: true,
defaultWarning: true,
}}
isVisible={true}
renderWarning={(key) => {
switch (key) {
case 'customWarning':
return 'The current password is weak, You may want to use a stronger password';
default:
// When null is returned then the default warning handling from
// renderDefaultWarning will kick in for that warning.
return null;
}
}}
renderDefaultWarning={(key) => {
switch (key) {
case 'defaultWarning':
return 'Always use a strong password';
default:
// When null is returned then the warning handling defined in
// FieldWarning itself will kick in
return null;
}
}}
/>
);
export default Example;
Props | Type | Required | Default | Description |
---|---|---|---|---|
id | string | ID of the warning field. | ||
warnings | Record | List of warnings. Only entries with truthy values will count as active warnings. | ||
isVisible | boolean | true when the warning messages should be rendered. Usually you'd pass in a touched state of fields. | ||
renderWarning | Function See signature. | Function which gets called with each warning key (from the warnings prop) and may render a warning message or return null to hand the warning handling off to renderDefaultWarning . | ||
renderDefaultWarning | Function See signature. | Function which gets called with each warning key (from the warnings prop) for which renderWarning returned null .
It may render a warning message or return null to hand the warning handling off to FieldWarning s built-in warning handling. |
renderWarning
(key: string, warning?: boolean) => ReactNode;
renderDefaultWarning
(key: string, warning?: boolean) => ReactNode;
FAQs
Renders warnings based on configuration.
The npm package @commercetools-uikit/field-warnings receives a total of 5,246 weekly downloads. As such, @commercetools-uikit/field-warnings popularity was classified as popular.
We found that @commercetools-uikit/field-warnings 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.
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.