Socket
Socket
Sign inDemoInstall

@uiw/react-color-swatch

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-color-swatch - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

43

cjs/index.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
Object.defineProperty(exports, "__esModule", {

@@ -9,32 +8,24 @@ value: true

exports["default"] = void 0;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _colorConvert = require("@uiw/color-convert");
var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["prefixCls", "className", "color", "colors", "style", "rectProps", "onChange", "addonAfter", "addonBefore", "rectRender"];
var Swatch = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
var _props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'w-color-swatch' : _props$prefixCls,
className = props.className,
color = props.color,
_props$colors = props.colors,
colors = _props$colors === void 0 ? [] : _props$colors,
style = props.style,
_props$rectProps = props.rectProps,
rectProps = _props$rectProps === void 0 ? {} : _props$rectProps,
onChange = props.onChange,
addonAfter = props.addonAfter,
addonBefore = props.addonBefore,
rectRender = props.rectRender,
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
prefixCls = _props$prefixCls === void 0 ? 'w-color-swatch' : _props$prefixCls,
className = props.className,
color = props.color,
_props$colors = props.colors,
colors = _props$colors === void 0 ? [] : _props$colors,
style = props.style,
_props$rectProps = props.rectProps,
rectProps = _props$rectProps === void 0 ? {} : _props$rectProps,
onChange = props.onChange,
addonAfter = props.addonAfter,
addonBefore = props.addonBefore,
rectRender = props.rectRender,
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
var rectStyle = (0, _objectSpread2["default"])({

@@ -51,7 +42,5 @@ background: 'rgb(144, 19, 254)',

}, rectProps.style);
var handleClick = function handleClick(hex) {
onChange && onChange((0, _colorConvert.hexToHsva)(hex));
};
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({

@@ -69,3 +58,2 @@ ref: ref

var background = '';
if (typeof item === 'string') {

@@ -75,3 +63,2 @@ title = item;

}
if ((0, _typeof2["default"])(item) === 'object' && item.color) {

@@ -81,5 +68,3 @@ title = item.title || item.color;

}
var checked = color && color.toLocaleLowerCase() === background.toLocaleLowerCase();
if (rectRender) {

@@ -99,3 +84,2 @@ return rectRender({

}
var child = rectProps.children && /*#__PURE__*/_react["default"].isValidElement(rectProps.children) ? /*#__PURE__*/_react["default"].cloneElement(rectProps.children, {

@@ -120,3 +104,2 @@ color: background,

});
Swatch.displayName = 'Swatch';

@@ -123,0 +106,0 @@ var _default = Swatch;

@@ -10,15 +10,14 @@ import _extends from "@babel/runtime/helpers/extends";

var {
prefixCls = 'w-color-swatch',
className,
color,
colors = [],
style,
rectProps = {},
onChange,
addonAfter,
addonBefore,
rectRender
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
prefixCls = 'w-color-swatch',
className,
color,
colors = [],
style,
rectProps = {},
onChange,
addonAfter,
addonBefore,
rectRender
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
var rectStyle = _extends({

@@ -35,7 +34,5 @@ background: 'rgb(144, 19, 254)',

}, rectProps.style);
var handleClick = hex => {
onChange && onChange(hexToHsva(hex));
};
return /*#__PURE__*/_jsxs("div", _extends({

@@ -53,3 +50,2 @@ ref: ref

var background = '';
if (typeof item === 'string') {

@@ -59,3 +55,2 @@ title = item;

}
if (typeof item === 'object' && item.color) {

@@ -65,5 +60,3 @@ title = item.title || item.color;

}
var checked = color && color.toLocaleLowerCase() === background.toLocaleLowerCase();
if (rectRender) {

@@ -81,3 +74,2 @@ return rectRender({

}
var child = rectProps.children && /*#__PURE__*/React.isValidElement(rectProps.children) ? /*#__PURE__*/React.cloneElement(rectProps.children, {

@@ -84,0 +76,0 @@ color: background,

{
"name": "@uiw/react-color-swatch",
"version": "1.1.0",
"version": "1.1.1",
"description": "Color swatch component for React.",

@@ -37,5 +37,5 @@ "homepage": "https://uiwjs.github.io/react-color/#/swatch",

"dependencies": {
"@babel/runtime": "~7.18.0",
"@uiw/color-convert": "1.1.0"
"@babel/runtime": "~7.19.0",
"@uiw/color-convert": "1.1.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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