Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arch-ui/badge

Package Overview
Dependencies
Maintainers
8
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arch-ui/badge - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

6

CHANGELOG.md
# @arch-ui/badge
## 0.0.16
### Patch Changes
- [`45b151b0`](https://github.com/keystonejs/keystone/commit/45b151b05de0583ba50364caeda8b5bb7a111385) [#2829](https://github.com/keystonejs/keystone/pull/2829) Thanks [@Vultraz](https://github.com/Vultraz)! - Converted React PureComponents to functional ones.
## 0.0.15

@@ -4,0 +10,0 @@

62

dist/badge.cjs.dev.js

@@ -9,3 +9,2 @@ 'use strict';

var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/objectWithoutProperties'));
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty'));
var React = require('react');

@@ -64,44 +63,29 @@ var React__default = _interopDefault(React);

}));
class Badge extends React.PureComponent {
constructor(...args) {
super(...args);
const Badge = React.memo((_ref) => {
let {
appearance = 'default',
max = 99,
value = 0,
variant = 'subtle'
} = _ref,
props = _objectWithoutProperties(_ref, ["appearance", "max", "value", "variant"]);
_defineProperty(this, "getValue", ({
value,
max
}) => {
if (value < 0) return '0';
if (max > 0 && value > max) return "".concat(max, "+");
return value;
});
}
const getValue = ({
value,
max
}) => {
if (value < 0) return '0';
if (max > 0 && value > max) return "".concat(max, "+");
return value;
};
render() {
const _this$props = this.props,
{
appearance,
max,
value,
variant
} = _this$props,
rest = _objectWithoutProperties(_this$props, ["appearance", "max", "value", "variant"]);
return React__default.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, rest), this.getValue({
value,
max
}));
}
}
_defineProperty(Badge, "defaultProps", {
appearance: 'default',
max: 99,
value: 0,
variant: 'subtle'
return React__default.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, props), getValue({
value,
max
}));
});
exports.Badge = Badge;

@@ -11,3 +11,3 @@ "use strict";

var _extends = _interopDefault(require("@babel/runtime/helpers/extends")), _objectWithoutProperties = _interopDefault(require("@babel/runtime/helpers/objectWithoutProperties")), _defineProperty = _interopDefault(require("@babel/runtime/helpers/defineProperty")), React = require("react"), React__default = _interopDefault(React), styled = _interopDefault(require("@emotion/styled")), theme = require("@arch-ui/theme");
var _extends = _interopDefault(require("@babel/runtime/helpers/extends")), _objectWithoutProperties = _interopDefault(require("@babel/runtime/helpers/objectWithoutProperties")), React = require("react"), React__default = _interopDefault(React), styled = _interopDefault(require("@emotion/styled")), theme = require("@arch-ui/theme");

@@ -54,25 +54,13 @@ const boldBackgroundColor = {

textAlign: "center"
}));
})), Badge = React.memo(_ref => {
let {appearance: appearance = "default", max: max = 99, value: value = 0, variant: variant = "subtle"} = _ref, props = _objectWithoutProperties(_ref, [ "appearance", "max", "value", "variant" ]);
return React__default.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, props), (({value: value, max: max}) => value < 0 ? "0" : max > 0 && value > max ? "".concat(max, "+") : value)({
value: value,
max: max
}));
});
class Badge extends React.PureComponent {
constructor(...args) {
super(...args), _defineProperty(this, "getValue", ({value: value, max: max}) => value < 0 ? "0" : max > 0 && value > max ? "".concat(max, "+") : value);
}
render() {
const _this$props = this.props, {appearance: appearance, max: max, value: value, variant: variant} = _this$props, rest = _objectWithoutProperties(_this$props, [ "appearance", "max", "value", "variant" ]);
return React__default.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, rest), this.getValue({
value: value,
max: max
}));
}
}
_defineProperty(Badge, "defaultProps", {
appearance: "default",
max: 99,
value: 0,
variant: "subtle"
}), exports.Badge = Badge;
exports.Badge = Badge;
import _extends from '@babel/runtime/helpers/esm/extends';
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import React, { PureComponent } from 'react';
import React, { memo } from 'react';
import styled from '@emotion/styled';

@@ -56,44 +55,29 @@ import { colors } from '@arch-ui/theme';

}));
class Badge extends PureComponent {
constructor(...args) {
super(...args);
const Badge = memo((_ref) => {
let {
appearance = 'default',
max = 99,
value = 0,
variant = 'subtle'
} = _ref,
props = _objectWithoutProperties(_ref, ["appearance", "max", "value", "variant"]);
_defineProperty(this, "getValue", ({
value,
max
}) => {
if (value < 0) return '0';
if (max > 0 && value > max) return "".concat(max, "+");
return value;
});
}
const getValue = ({
value,
max
}) => {
if (value < 0) return '0';
if (max > 0 && value > max) return "".concat(max, "+");
return value;
};
render() {
const _this$props = this.props,
{
appearance,
max,
value,
variant
} = _this$props,
rest = _objectWithoutProperties(_this$props, ["appearance", "max", "value", "variant"]);
return React.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, rest), this.getValue({
value,
max
}));
}
}
_defineProperty(Badge, "defaultProps", {
appearance: 'default',
max: 99,
value: 0,
variant: 'subtle'
return React.createElement(BadgeElement, _extends({
appearance: appearance,
variant: variant
}, props), getValue({
value,
max
}));
});
export { Badge };
{
"name": "@arch-ui/badge",
"description": "Badge Component used in @keystonejs Admin UI.",
"version": "0.0.15",
"version": "0.0.16",
"author": "Jed Watson",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -1,2 +0,2 @@

import React, { PureComponent } from 'react';
import React, { memo } from 'react';
import styled from '@emotion/styled';

@@ -55,23 +55,16 @@

export class Badge extends PureComponent {
static defaultProps = {
appearance: 'default',
max: 99,
value: 0,
variant: 'subtle',
};
getValue = ({ value, max }) => {
if (value < 0) return '0';
if (max > 0 && value > max) return `${max}+`;
return value;
};
render() {
const { appearance, max, value, variant, ...rest } = this.props;
export const Badge = memo(
({ appearance = 'default', max = 99, value = 0, variant = 'subtle', ...props }) => {
const getValue = ({ value, max }) => {
if (value < 0) return '0';
if (max > 0 && value > max) return `${max}+`;
return value;
};
return (
<BadgeElement appearance={appearance} variant={variant} {...rest}>
{this.getValue({ value, max })}
<BadgeElement appearance={appearance} variant={variant} {...props}>
{getValue({ value, max })}
</BadgeElement>
);
}
}
);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc