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

@uiw/react-color-editable-input

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-color-editable-input - npm Package Compare versions

Comparing version 0.0.1 to 0.0.10

3

lib/cjs/index.d.ts
import React from 'react';
export interface EditableInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
prefixCls?: string;
value?: string | number;
label?: string;
labelStyle?: React.CSSProperties;
inputStyle?: React.CSSProperties;
onChange?: (evn: React.ChangeEvent<HTMLInputElement>, value: string | number) => void;
}
declare const _default: React.ForwardRefExoticComponent<EditableInputProps & React.RefAttributes<HTMLInputElement>>;
export default _default;

@@ -5,2 +5,4 @@ "use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {

@@ -15,8 +17,18 @@ value: true

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _react = _interopRequireWildcard(require("react"));
var _excluded = ["prefixCls", "label", "className", "style", "labelStyle"];
var _excluded = ["prefixCls", "label", "value", "className", "style", "labelStyle", "inputStyle", "onChange"];
var validHex = function validHex(hex) {
return /^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
};
var getNumberValue = function getNumberValue(value) {
return Number(String(value).replace(/%/g, ''));
};
var _default = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {

@@ -26,6 +38,53 @@ var _props$prefixCls = props.prefixCls,

label = props.label,
initValue = props.value,
className = props.className,
style = props.style,
labelStyle = props.labelStyle,
inputStyle = props.inputStyle,
onChange = props.onChange,
other = (0, _objectWithoutProperties2.default)(props, _excluded);
var _useState = (0, _react.useState)(initValue),
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
value = _useState2[0],
setValue = _useState2[1];
var _useState3 = (0, _react.useState)(initValue),
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
valueProps = _useState4[0],
setValueProps = _useState4[1];
var isFocus = (0, _react.useRef)(false);
(0, _react.useEffect)(function () {
if (props.value !== value) {
setValueProps(props.value);
if (!isFocus.current) {
setValue(props.value);
}
}
}, [props.value]);
function handleChange(evn) {
var value = evn.target.value;
if (validHex(value)) {
onChange && onChange(evn, value);
}
var val = getNumberValue(value);
if (!isNaN(val)) {
onChange && onChange(evn, val);
}
setValue(value);
setValueProps(value);
}
function handleBlur() {
isFocus.current = false;
setValue(valueProps);
}
return /*#__PURE__*/_react.default.createElement("div", {

@@ -36,7 +95,16 @@ className: [prefixCls, className || ''].filter(Boolean).join(' '),

alignItems: 'center',
display: 'flex'
display: 'flex',
fontSize: 11
}, style)
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, other, {
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
ref: ref,
style: {
value: value,
onChange: handleChange,
onBlur: handleBlur,
autoComplete: "off",
onFocus: function onFocus() {
return isFocus.current = true;
}
}, other, {
style: (0, _objectSpread2.default)({
width: '100%',

@@ -47,13 +115,14 @@ paddingTop: 2,

paddingRight: 3,
fontSize: 11,
boxSizing: 'border-box',
border: 'none',
boxShadow: 'rgb(204 204 204) 0px 0px 0px 1px inset'
}
}, inputStyle)
})), /*#__PURE__*/_react.default.createElement("span", {
style: (0, _objectSpread2.default)({
fontSize: 11,
color: 'rgb(153, 153, 153)',
textTransform: 'capitalize'
}, labelStyle)
}, label));
}, labelStyle),
children: label
}));
});

@@ -63,2 +132,2 @@

module.exports = exports.default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmRleC50c3giXSwibmFtZXMiOlsiUmVhY3QiLCJmb3J3YXJkUmVmIiwicHJvcHMiLC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HV0RWxlbWVudCwgRWRpdGFibGVJbnB1dFByb3BzPigocHJvcHMsIHJlZikgPT4ge1xuICBjb25zdCB7IHByZWZpeENscyA9ICd3LWNvbG9yLWVkaXRhYmxlLWlucHV0JywgbGFiZWwsIGNsYXNzTmFtZSwgc3R5bGUsIGxhYmVsU3R5bGUsIC4uLm90aGVyIH0gPSBwcm9wcztcblxuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIGNsYXNzTmFtZT17W3ByZWZpeENscywgY2xhc3NOYW1lIHx8ICcnXS5maWx0ZXIoQm9vbGVhbikuam9pbignICcpfVxuICAgICAgc3R5bGU9e3tcbiAgICAgICAgcG9zaXRpb246ICdyZWxhdGl2ZScsXG4gICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxuICAgICAgICBkaXNwbGF5OiAnZmxleCcsXG4gICAgICAgIC4uLnN0eWxlXG4gICAgICB9fVxuICAgID5cbiAgICAgIDxpbnB1dFxuICAgICAgICB7Li4ub3RoZXJ9XG4gICAgICAgIHJlZj17cmVmfVxuICAgICAgICBzdHlsZT17e1xuICAgICAgICAgIHdpZHRoOiAnMTAwJScsXG4gICAgICAgICAgcGFkZGluZ1RvcDogMixcbiAgICAgICAgICBwYWRkaW5nQm90dG9tOiAyLFxuICAgICAgICAgIHBhZGRpbmdMZWZ0OiAzLFxuICAgICAgICAgIHBhZGRpbmdSaWdodDogMyxcbiAgICAgICAgICBib3hTaXppbmc6ICdib3JkZXItYm94JyxcbiAgICAgICAgICBib3JkZXI6ICdub25lJyxcbiAgICAgICAgICBib3hTaGFkb3c6ICdyZ2IoMjA0IDIwNCAyMDQpIDBweCAwcHggMHB4IDFweCBpbnNldCcsXG4gICAgICAgIH19XG4gICAgICAvPlxuICAgICAgPHNwYW5cbiAgICAgICAgc3R5bGU9e3tcbiAgICAgICAgICBmb250U2l6ZTogMTEsXG4gICAgICAgICAgY29sb3I6ICdyZ2IoMTUzLCAxNTMsIDE1MyknLFxuICAgICAgICAgIHRleHR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ICBwYWRkaW5nTGVmdDogMyxcbiAgICAgICAgICBwYWRkaW5nUmlnaHQ6IDMsXG4gICAgICAgICAgZm9udFNpemU6IDExLFxuICAgICAgICAgIGJveFNpemluZzogJ2JvcmRlci1ib3gnLFxuICAgICAgICAgIGJvcmRlcjogJ25vbmUnLFxuICAgICAgICAgIGJveFNoYWRvdzogJ3JnYigyMDQgMjA0IDIwNCkgMHB4IDBweCAwcHggMXB4IGluc2V0JyxcbiAgICAgICAgICAuLi5pbnB1dFN0eWxlLFxuICAgICAgICB9fVxuICAgICAgLz5cbiAgICAgIDxzcGFuXG4gICAgICAgIHN0eWxlPXt7XG4gICAgICAgICAgY29sb3I6ICdyZ2IoMTUzLCAxNTMsIDE1MyknLFxuICAgICAgICAgIHRleHRUcmFuc2Zvcm06ICdjYXBpdGFsaXplJyxcbiAgICAgICAgICAuLi5sYWJlbFN0eWxlLFxuICAgICAgICB9fVxuICAgICAgICBjaGlsZHJlbj17bGFiZWx9XG4gICAgICAvPlxuICAgIDwvZGl2PlxuICApO1xufSk7XG4iXX0=
import React from 'react';
export interface EditableInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
prefixCls?: string;
value?: string | number;
label?: string;
labelStyle?: React.CSSProperties;
inputStyle?: React.CSSProperties;
onChange?: (evn: React.ChangeEvent<HTMLInputElement>, value: string | number) => void;
}
declare const _default: React.ForwardRefExoticComponent<EditableInputProps & React.RefAttributes<HTMLInputElement>>;
export default _default;
import _extends from "@babel/runtime/helpers/extends";
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["prefixCls", "label", "className", "style", "labelStyle"];
var _excluded = ["prefixCls", "label", "value", "className", "style", "labelStyle", "inputStyle", "onChange"];
import React from 'react';
import { useRef, useEffect, useState } from 'react';
var validHex = function validHex(hex) {
return /^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
};
var getNumberValue = function getNumberValue(value) {
return Number(String(value).replace(/%/g, ''));
};
export default /*#__PURE__*/React.forwardRef(function (props, ref) {

@@ -10,7 +21,53 @@ var _props$prefixCls = props.prefixCls,

label = props.label,
initValue = props.value,
className = props.className,
style = props.style,
labelStyle = props.labelStyle,
inputStyle = props.inputStyle,
onChange = props.onChange,
other = _objectWithoutProperties(props, _excluded);
var _useState = useState(initValue),
_useState2 = _slicedToArray(_useState, 2),
value = _useState2[0],
setValue = _useState2[1];
var _useState3 = useState(initValue),
_useState4 = _slicedToArray(_useState3, 2),
valueProps = _useState4[0],
setValueProps = _useState4[1];
var isFocus = useRef(false);
useEffect(function () {
if (props.value !== value) {
setValueProps(props.value);
if (!isFocus.current) {
setValue(props.value);
}
}
}, [props.value]);
function handleChange(evn) {
var value = evn.target.value;
if (validHex(value)) {
onChange && onChange(evn, value);
}
var val = getNumberValue(value);
if (!isNaN(val)) {
onChange && onChange(evn, val);
}
setValue(value);
setValueProps(value);
}
function handleBlur() {
isFocus.current = false;
setValue(valueProps);
}
return /*#__PURE__*/React.createElement("div", {

@@ -21,7 +78,16 @@ className: [prefixCls, className || ''].filter(Boolean).join(' '),

alignItems: 'center',
display: 'flex'
display: 'flex',
fontSize: 11
}, style)
}, /*#__PURE__*/React.createElement("input", _extends({}, other, {
}, /*#__PURE__*/React.createElement("input", _extends({
ref: ref,
style: {
value: value,
onChange: handleChange,
onBlur: handleBlur,
autoComplete: "off",
onFocus: function onFocus() {
return isFocus.current = true;
}
}, other, {
style: _objectSpread({
width: '100%',

@@ -32,14 +98,15 @@ paddingTop: 2,

paddingRight: 3,
fontSize: 11,
boxSizing: 'border-box',
border: 'none',
boxShadow: 'rgb(204 204 204) 0px 0px 0px 1px inset'
}
}, inputStyle)
})), /*#__PURE__*/React.createElement("span", {
style: _objectSpread({
fontSize: 11,
color: 'rgb(153, 153, 153)',
textTransform: 'capitalize'
}, labelStyle)
}, label));
}, labelStyle),
children: label
}));
});
//# sour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QgMjA0IDIwNCkgMHB4IDBweCAwcHggMXB4IGluc2V0JyxcbiAgICAgICAgfX1cbiAgICAgIC8+XG4gICAgICA8c3BhblxuICAgICAgICBzdHlsZT17e1xuICAgICAgICAgIGZvbnRTaXplOiAxMSxcbiAgICAgICAgICBjb2xvcjogJ3JnYigxNTMsIDE1MywgMTUzKScsXG4gICAgICAgICAgdGV4dFRyYW5zZm9ybTogJ2NhcGl0YWxpemUnLFxuICAgICAgICAgIC4uLmxhYmVsU3R5bGUsXG4gICAgICAgIH19XG4gICAgICA+XG4gICAgICAgIHtsYWJlbH1cbiAgICAgIDwvc3Bhbj5cbiAgICA8L2Rpdj5cbiAgKTtcbn0pO1xuIl19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmRleC50c3giXSwibmFtZXMiOlsiUmVhY3QiLCJ1c2VSZWYiLCJ1c2VFZmZlY3QiLCJ1c2VTdGF0ZSIsInZhbGlkSGV4IiwiaGV4IiwidGVzdCIsImdldE51bWJlclZhbHVlIiwidmFsdWUiLCJOdW1iZXIiLCJTdHJpbmciLCJyZXBsYWNlIiwiZm9yd2FyZFJlZiIsInByb3BzIiwicmVmIiwicHJlZml4Q2xzIiwibGFiZWwiLCJpbml0VmFsdWUiLCJjbGFzc05hbWUiLCJzdHlsZSIsImxhYmVsU3R5bGUiLCJpbnB1dFN0eWxlIiwib25DaGFuZ2UiLCJvdGhlciIsInNldFZhbHVlIiwidmFsdWVQcm9wcyIsInNldFZhbHVlUHJvcHMiLCJpc0ZvY3VzIiwiY3VycmVudCIsImhhbmRsZUNoYW5nZSIsImV2biIsInRhcmdldCIsInZhbCIsImlzTmFOIiwiaGFuZGxlQmx1ciIsImZpbHRlciIsIkJvb2xlYW4iLCJqb2luIiwicG9zaXRpb24iLCJhbGlnbkl0ZW1zIiwiZGlzcGxheSIsImZvbnRTaXplIiwid2lkdGgiLCJwYWRkaW5nVG9wI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lxuICAgICAgPGlucHV0XG4gICAgICAgIHJlZj17cmVmfVxuICAgICAgICB2YWx1ZT17dmFsdWV9XG4gICAgICAgIG9uQ2hhbmdlPXtoYW5kbGVDaGFuZ2V9XG4gICAgICAgIG9uQmx1cj17aGFuZGxlQmx1cn1cbiAgICAgICAgYXV0b0NvbXBsZXRlPVwib2ZmXCJcbiAgICAgICAgb25Gb2N1cz17KCkgPT4gKGlzRm9jdXMuY3VycmVudCA9IHRydWUpfVxuICAgICAgICB7Li4ub3RoZXJ9XG4gICAgICAgIHN0eWxlPXt7XG4gICAgICAgICAgd2lkdGg6ICcxMDAlJyxcbiAgICAgICAgICBwYWRkaW5nVG9wOiAyLFxuICAgICAgICAgIHBhZGRpbmdCb3R0b206IDIsXG4gICAgICAgICAgcGFkZGluZ0xlZnQ6IDMsXG4gICAgICAgICAgcGFkZGluZ1JpZ2h0OiAzLFxuICAgICAgICAgIGZvbnRTaXplOiAxMSxcbiAgICAgICAgICBib3hTaXppbmc6ICdib3JkZXItYm94JyxcbiAgICAgICAgICBib3JkZXI6ICdub25lJyxcbiAgICAgICAgICBib3hTaGFkb3c6ICdyZ2IoMjA0IDIwNCAyMDQpIDBweCAwcHggMHB4IDFweCBpbnNldCcsXG4gICAgICAgICAgLi4uaW5wdXRTdHlsZSxcbiAgICAgICAgfX1cbiAgICAgIC8+XG4gICAgICA8c3BhblxuICAgICAgICBzdHlsZT17e1xuICAgICAgICAgIGNvbG9yOiAncmdiKDE1MywgMTUzLCAxNTMpJyxcbiAgICAgICAgICB0ZXh0VHJhbnNmb3JtOiAnY2FwaXRhbGl6ZScsXG4gICAgICAgICAgLi4ubGFiZWxTdHlsZSxcbiAgICAgICAgfX1cbiAgICAgICAgY2hpbGRyZW49e2xhYmVsfVxuICAgICAgLz5cbiAgICA8L2Rpdj5cbiAgKTtcbn0pO1xuIl19

5

package.json
{
"name": "@uiw/react-color-editable-input",
"version": "0.0.1",
"version": "0.0.10",
"description": "Color Editable Input",

@@ -31,4 +31,3 @@ "author": "Kenny Wong <wowohoo@qq.com>",

"dependencies": {
"@babel/runtime": "7.14.6",
"@uiw/color-convert": "^0.0.9"
"@babel/runtime": "7.14.6"
},

@@ -35,0 +34,0 @@ "devDependencies": {

@@ -58,4 +58,7 @@ React Color Editable Input

prefixCls?: string;
value?: string | number;
label?: string;
labelStyle?: React.CSSProperties;
inputStyle?: React.CSSProperties;
onChange?: (evn: React.ChangeEvent<HTMLInputElement>, value: string | number) => void;
}

@@ -62,0 +65,0 @@ ```

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