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

@uiw/react-color-github

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.1.0 to 1.1.1

60

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

@@ -11,23 +9,14 @@ value: true

exports["default"] = exports.GithubPlacement = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _colorConvert = require("@uiw/color-convert");
var _reactColorSwatch = _interopRequireDefault(require("@uiw/react-color-swatch"));
var _Point = _interopRequireDefault(require("./Point"));
var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["prefixCls", "placement", "className", "style", "color", "colors", "rectProps", "onChange"],
_excluded2 = ["key"];
_excluded2 = ["key"];
var CORLER_HEX = ['#B80000', '#DB3E00', '#FCCB00', '#008B02', '#006B76', '#1273DE', '#004DCF', '#5300EB', '#EB9694', '#FAD0C3', '#FEF3BD', '#C1E1C5', '#BEDADC', '#C4DEF6', '#BED3F3', '#D4C4FB'];
var GithubPlacement;
exports.GithubPlacement = GithubPlacement;
(function (GithubPlacement) {

@@ -47,24 +36,21 @@ GithubPlacement["Left"] = "L";

})(GithubPlacement || (exports.GithubPlacement = GithubPlacement = {}));
var Github = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
var _props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'w-color-github' : _props$prefixCls,
_props$placement = props.placement,
placement = _props$placement === void 0 ? GithubPlacement.TopRight : _props$placement,
className = props.className,
style = props.style,
color = props.color,
_props$colors = props.colors,
colors = _props$colors === void 0 ? CORLER_HEX : _props$colors,
_props$rectProps = props.rectProps,
rectProps = _props$rectProps === void 0 ? {} : _props$rectProps,
onChange = props.onChange,
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
prefixCls = _props$prefixCls === void 0 ? 'w-color-github' : _props$prefixCls,
_props$placement = props.placement,
placement = _props$placement === void 0 ? GithubPlacement.TopRight : _props$placement,
className = props.className,
style = props.style,
color = props.color,
_props$colors = props.colors,
colors = _props$colors === void 0 ? CORLER_HEX : _props$colors,
_props$rectProps = props.rectProps,
rectProps = _props$rectProps === void 0 ? {} : _props$rectProps,
onChange = props.onChange,
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
var hsva = typeof color === 'string' && (0, _colorConvert.validHex)(color) ? (0, _colorConvert.hexToHsva)(color) : color;
var hex = color ? (0, _colorConvert.hsvaToHex)(hsva) : '';
var handleChange = function handleChange(hsv) {
return onChange && onChange((0, _colorConvert.color)(hsv));
};
var rStyle = {

@@ -76,3 +62,2 @@ borderStyle: 'solid',

var arrStyl = (0, _objectSpread2["default"])({}, rStyle);
if (/^T/.test(placement)) {

@@ -84,3 +69,2 @@ arrBrStyl.borderWidth = '0 8px 8px';

}
if (placement === GithubPlacement.TopRight) {

@@ -90,3 +74,2 @@ arrBrStyl.top = -8;

}
if (placement === GithubPlacement.Top) {

@@ -96,3 +79,2 @@ arrBrStyl.top = -8;

}
if (placement === GithubPlacement.TopLeft) {

@@ -102,3 +84,2 @@ arrBrStyl.top = -8;

}
if (/^B/.test(placement)) {

@@ -109,3 +90,2 @@ arrBrStyl.borderWidth = '8px 8px 0 ';

arrStyl.borderColor = '#fff transparent transparent';
if (placement === GithubPlacement.BottonRight) {

@@ -115,3 +95,2 @@ arrBrStyl.top = '100%';

}
if (placement === GithubPlacement.Botton) {

@@ -121,3 +100,2 @@ arrBrStyl.top = '100%';

}
if (placement === GithubPlacement.BottonLeft) {

@@ -128,3 +106,2 @@ arrBrStyl.top = '100%';

}
if (/^(B|T)/.test(placement)) {

@@ -137,3 +114,2 @@ if (placement === GithubPlacement.Top || placement === GithubPlacement.Botton) {

}
if (placement === GithubPlacement.TopRight || placement === GithubPlacement.BottonRight) {

@@ -143,3 +119,2 @@ arrBrStyl.right = 10;

}
if (placement === GithubPlacement.TopLeft || placement === GithubPlacement.BottonLeft) {

@@ -150,3 +125,2 @@ arrBrStyl.left = 7;

}
if (/^L/.test(placement)) {

@@ -160,3 +134,2 @@ arrBrStyl.borderWidth = '8px 8px 8px 0px';

}
if (/^R/.test(placement)) {

@@ -170,3 +143,2 @@ arrBrStyl.borderWidth = '8px 0px 8px 8px';

}
if (/^(L|R)/.test(placement)) {

@@ -177,3 +149,2 @@ if (placement === GithubPlacement.RightTop || placement === GithubPlacement.LeftTop) {

}
if (placement === GithubPlacement.Left || placement === GithubPlacement.Right) {

@@ -185,3 +156,2 @@ arrBrStyl.top = '50%';

}
if (placement === GithubPlacement.LeftBotton || placement === GithubPlacement.RightBotton) {

@@ -194,3 +164,2 @@ arrBrStyl.top = '100%';

}
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColorSwatch["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({

@@ -203,3 +172,3 @@ ref: ref,

var key = _ref.key,
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Point["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, {

@@ -238,3 +207,2 @@ rectProps: rectProps

});
Github.displayName = 'Github';

@@ -241,0 +209,0 @@ var _default = Github;

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

@@ -11,16 +9,12 @@ value: true

exports["default"] = Point;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _react = _interopRequireWildcard(require("react"));
var _jsxRuntime = require("react/jsx-runtime");
function Point(_ref) {
var style = _ref.style,
title = _ref.title,
checked = _ref.checked,
color = _ref.color,
onClick = _ref.onClick,
rectProps = _ref.rectProps;
title = _ref.title,
checked = _ref.checked,
color = _ref.color,
onClick = _ref.onClick,
rectProps = _ref.rectProps;
var btn = (0, _react.useRef)(null);

@@ -62,4 +56,3 @@ var handleMouseEnter = (0, _react.useCallback)(function () {

}
module.exports = exports.default;
//# sourceMappingURL=Point.js.map
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["prefixCls", "placement", "className", "style", "color", "colors", "rectProps", "onChange"],
_excluded2 = ["key"];
_excluded2 = ["key"];
import React, { Fragment } from 'react';

@@ -13,3 +13,2 @@ import { color as handleColor, validHex, hexToHsva, hsvaToHex } from '@uiw/color-convert';

export var GithubPlacement;
(function (GithubPlacement) {

@@ -29,21 +28,17 @@ GithubPlacement["Left"] = "L";

})(GithubPlacement || (GithubPlacement = {}));
var Github = /*#__PURE__*/React.forwardRef((props, ref) => {
var {
prefixCls = 'w-color-github',
placement = GithubPlacement.TopRight,
className,
style,
color,
colors = CORLER_HEX,
rectProps = {},
onChange
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
prefixCls = 'w-color-github',
placement = GithubPlacement.TopRight,
className,
style,
color,
colors = CORLER_HEX,
rectProps = {},
onChange
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
var hsva = typeof color === 'string' && validHex(color) ? hexToHsva(color) : color;
var hex = color ? hsvaToHex(hsva) : '';
var handleChange = hsv => onChange && onChange(handleColor(hsv));
var rStyle = {

@@ -53,7 +48,4 @@ borderStyle: 'solid',

};
var arrBrStyl = _extends({}, rStyle);
var arrStyl = _extends({}, rStyle);
if (/^T/.test(placement)) {

@@ -65,3 +57,2 @@ arrBrStyl.borderWidth = '0 8px 8px';

}
if (placement === GithubPlacement.TopRight) {

@@ -71,3 +62,2 @@ arrBrStyl.top = -8;

}
if (placement === GithubPlacement.Top) {

@@ -77,3 +67,2 @@ arrBrStyl.top = -8;

}
if (placement === GithubPlacement.TopLeft) {

@@ -83,3 +72,2 @@ arrBrStyl.top = -8;

}
if (/^B/.test(placement)) {

@@ -90,3 +78,2 @@ arrBrStyl.borderWidth = '8px 8px 0 ';

arrStyl.borderColor = '#fff transparent transparent';
if (placement === GithubPlacement.BottonRight) {

@@ -96,3 +83,2 @@ arrBrStyl.top = '100%';

}
if (placement === GithubPlacement.Botton) {

@@ -102,3 +88,2 @@ arrBrStyl.top = '100%';

}
if (placement === GithubPlacement.BottonLeft) {

@@ -109,3 +94,2 @@ arrBrStyl.top = '100%';

}
if (/^(B|T)/.test(placement)) {

@@ -118,3 +102,2 @@ if (placement === GithubPlacement.Top || placement === GithubPlacement.Botton) {

}
if (placement === GithubPlacement.TopRight || placement === GithubPlacement.BottonRight) {

@@ -124,3 +107,2 @@ arrBrStyl.right = 10;

}
if (placement === GithubPlacement.TopLeft || placement === GithubPlacement.BottonLeft) {

@@ -131,3 +113,2 @@ arrBrStyl.left = 7;

}
if (/^L/.test(placement)) {

@@ -141,3 +122,2 @@ arrBrStyl.borderWidth = '8px 8px 8px 0px';

}
if (/^R/.test(placement)) {

@@ -151,3 +131,2 @@ arrBrStyl.borderWidth = '8px 0px 8px 8px';

}
if (/^(L|R)/.test(placement)) {

@@ -158,3 +137,2 @@ if (placement === GithubPlacement.RightTop || placement === GithubPlacement.LeftTop) {

}
if (placement === GithubPlacement.Left || placement === GithubPlacement.Right) {

@@ -166,3 +144,2 @@ arrBrStyl.top = '50%';

}
if (placement === GithubPlacement.LeftBotton || placement === GithubPlacement.RightBotton) {

@@ -175,3 +152,2 @@ arrBrStyl.top = '100%';

}
return /*#__PURE__*/_jsx(Swatch, _extends({

@@ -184,6 +160,5 @@ ref: ref,

var {
key
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, _excluded2);
key
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, _excluded2);
return /*#__PURE__*/_jsx(Point, _extends({}, props, {

@@ -190,0 +165,0 @@ rectProps: rectProps

{
"name": "@uiw/react-color-github",
"version": "1.1.0",
"version": "1.1.1",
"description": "Color Github Picker",

@@ -38,6 +38,6 @@ "author": "Kenny Wong <wowohoo@qq.com>",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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