New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-edit-text

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-edit-text - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

76

dist/index.js
var classnames = require('classnames');
var React = require('react');
var jsxRuntime = require('react/jsx-runtime');
var PropTypes = require('prop-types');

@@ -64,3 +65,3 @@

return h("input", _extends({
return /*#__PURE__*/jsxRuntime.jsx("input", _extends({
id: id,

@@ -80,8 +81,9 @@ className: classnames__default["default"](styles.shared, inputClassName, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),

var EditIcon = function EditIcon() {
return h("svg", {
return /*#__PURE__*/jsxRuntime.jsx("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 512 512"
}, h("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
}));
viewBox: "0 0 512 512",
children: /*#__PURE__*/jsxRuntime.jsx("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
})
});
};

@@ -134,3 +136,3 @@

showEditButton: false,
editButtonContent: h(EditIcon, null),
editButtonContent: /*#__PURE__*/jsxRuntime.jsx(EditIcon, {}),
editButtonProps: {}

@@ -260,16 +262,19 @@ });

return h("div", {
className: classnames__default["default"](styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames))
}, h("div", {
id: id,
className: classnames__default["default"](styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component"
}, formatDisplayText(savedText) || placeholder), showEditButton && !readonly && h("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton
}), editButtonContent));
return /*#__PURE__*/jsxRuntime.jsxs("div", {
className: classnames__default["default"](styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
id: id,
className: classnames__default["default"](styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component",
children: formatDisplayText(savedText) || placeholder
}), showEditButton && !readonly && /*#__PURE__*/jsxRuntime.jsx("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton,
children: editButtonContent
}))]
});
};

@@ -293,3 +298,3 @@

}, _sharedProps['aria-label'] = 'input component', _sharedProps);
return controlled ? h(Input, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, sharedProps, {
value: value,

@@ -302,3 +307,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Input, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -328,3 +333,3 @@ inputClassName: inputClassName

return h("textarea", _extends({
return /*#__PURE__*/jsxRuntime.jsx("textarea", _extends({
id: id,

@@ -448,3 +453,3 @@ className: classnames__default["default"](styles.shared, inputClassName),

var textLines = splitLines(formatDisplayText(savedText));
return h("div", {
return /*#__PURE__*/jsxRuntime.jsx("div", {
id: id,

@@ -456,8 +461,13 @@ className: classnames__default["default"](styles.shared, styles.textareaView, (_classnames = {}, _classnames[styles.placeholder] = placeholder && !savedText, _classnames[styles.readonly] = readonly, _classnames), className),

}),
"aria-label": "display component"
}, textLines.length > 0 ? textLines.map(function (text, index) {
return h(React__default["default"].Fragment, {
key: index
}, h("span", null, text), h("br", null));
}) : h("span", null, placeholder));
"aria-label": "display component",
children: textLines.length > 0 ? textLines.map(function (text, index) {
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
children: text
}), /*#__PURE__*/jsxRuntime.jsx("br", {})]
}, index);
}) : /*#__PURE__*/jsxRuntime.jsx("span", {
children: placeholder
})
});
};

@@ -479,3 +489,3 @@

}, _sharedProps['aria-label'] = 'textarea component', _sharedProps);
return controlled ? h(Textarea, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsxRuntime.jsx(Textarea, _extends({}, sharedProps, {
value: value,

@@ -488,3 +498,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Textarea, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsxRuntime.jsx(Textarea, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -491,0 +501,0 @@ inputClassName: inputClassName

import classnames from 'classnames';
import React from 'react';
import { jsx, jsxs } from 'react/jsx-runtime';
import PropTypes from 'prop-types';

@@ -58,3 +59,3 @@

return h("input", _extends({
return /*#__PURE__*/jsx("input", _extends({
id: id,

@@ -74,8 +75,9 @@ className: classnames(styles.shared, inputClassName, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),

var EditIcon = function EditIcon() {
return h("svg", {
return /*#__PURE__*/jsx("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 512 512"
}, h("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
}));
viewBox: "0 0 512 512",
children: /*#__PURE__*/jsx("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
})
});
};

@@ -128,3 +130,3 @@

showEditButton: false,
editButtonContent: h(EditIcon, null),
editButtonContent: /*#__PURE__*/jsx(EditIcon, {}),
editButtonProps: {}

@@ -254,16 +256,19 @@ });

return h("div", {
className: classnames(styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames))
}, h("div", {
id: id,
className: classnames(styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component"
}, formatDisplayText(savedText) || placeholder), showEditButton && !readonly && h("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton
}), editButtonContent));
return /*#__PURE__*/jsxs("div", {
className: classnames(styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),
children: [/*#__PURE__*/jsx("div", {
id: id,
className: classnames(styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component",
children: formatDisplayText(savedText) || placeholder
}), showEditButton && !readonly && /*#__PURE__*/jsx("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton,
children: editButtonContent
}))]
});
};

@@ -287,3 +292,3 @@

}, _sharedProps['aria-label'] = 'input component', _sharedProps);
return controlled ? h(Input, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsx(Input, _extends({}, sharedProps, {
value: value,

@@ -296,3 +301,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Input, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsx(Input, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -322,3 +327,3 @@ inputClassName: inputClassName

return h("textarea", _extends({
return /*#__PURE__*/jsx("textarea", _extends({
id: id,

@@ -442,3 +447,3 @@ className: classnames(styles.shared, inputClassName),

var textLines = splitLines(formatDisplayText(savedText));
return h("div", {
return /*#__PURE__*/jsx("div", {
id: id,

@@ -450,8 +455,13 @@ className: classnames(styles.shared, styles.textareaView, (_classnames = {}, _classnames[styles.placeholder] = placeholder && !savedText, _classnames[styles.readonly] = readonly, _classnames), className),

}),
"aria-label": "display component"
}, textLines.length > 0 ? textLines.map(function (text, index) {
return h(React.Fragment, {
key: index
}, h("span", null, text), h("br", null));
}) : h("span", null, placeholder));
"aria-label": "display component",
children: textLines.length > 0 ? textLines.map(function (text, index) {
return /*#__PURE__*/jsxs(React.Fragment, {
children: [/*#__PURE__*/jsx("span", {
children: text
}), /*#__PURE__*/jsx("br", {})]
}, index);
}) : /*#__PURE__*/jsx("span", {
children: placeholder
})
});
};

@@ -473,3 +483,3 @@

}, _sharedProps['aria-label'] = 'textarea component', _sharedProps);
return controlled ? h(Textarea, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsx(Textarea, _extends({}, sharedProps, {
value: value,

@@ -482,3 +492,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Textarea, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsx(Textarea, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -485,0 +495,0 @@ inputClassName: inputClassName

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('classnames'), require('react'), require('prop-types')) :
typeof define === 'function' && define.amd ? define(['exports', 'classnames', 'react', 'prop-types'], factory) :
(global = global || self, factory(global.reactEditText = {}, global.classnames, global.react, global.propTypes));
})(this, (function (exports, classnames, React, PropTypes) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('classnames'), require('react'), require('react/jsx-runtime'), require('prop-types')) :
typeof define === 'function' && define.amd ? define(['exports', 'classnames', 'react', 'react/jsx-runtime', 'prop-types'], factory) :
(global = global || self, factory(global.reactEditText = {}, global.classnames, global.react, global.jsxRuntime, global.propTypes));
})(this, (function (exports, classnames, React, jsxRuntime, PropTypes) {
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

@@ -65,3 +65,3 @@

return h("input", _extends({
return /*#__PURE__*/jsxRuntime.jsx("input", _extends({
id: id,

@@ -81,8 +81,9 @@ className: classnames__default["default"](styles.shared, inputClassName, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),

var EditIcon = function EditIcon() {
return h("svg", {
return /*#__PURE__*/jsxRuntime.jsx("svg", {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 512 512"
}, h("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
}));
viewBox: "0 0 512 512",
children: /*#__PURE__*/jsxRuntime.jsx("path", {
d: "M421.7 220.3L188.5 453.4L154.6 419.5L158.1 416H112C103.2 416 96 408.8 96 400V353.9L92.51 357.4C87.78 362.2 84.31 368 82.42 374.4L59.44 452.6L137.6 429.6C143.1 427.7 149.8 424.2 154.6 419.5L188.5 453.4C178.1 463.8 165.2 471.5 151.1 475.6L30.77 511C22.35 513.5 13.24 511.2 7.03 504.1C.8198 498.8-1.502 489.7 .976 481.2L36.37 360.9C40.53 346.8 48.16 333.9 58.57 323.5L291.7 90.34L421.7 220.3zM492.7 58.75C517.7 83.74 517.7 124.3 492.7 149.3L444.3 197.7L314.3 67.72L362.7 19.32C387.7-5.678 428.3-5.678 453.3 19.32L492.7 58.75z"
})
});
};

@@ -135,3 +136,3 @@

showEditButton: false,
editButtonContent: h(EditIcon, null),
editButtonContent: /*#__PURE__*/jsxRuntime.jsx(EditIcon, {}),
editButtonProps: {}

@@ -261,16 +262,19 @@ });

return h("div", {
className: classnames__default["default"](styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames))
}, h("div", {
id: id,
className: classnames__default["default"](styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component"
}, formatDisplayText(savedText) || placeholder), showEditButton && !readonly && h("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton
}), editButtonContent));
return /*#__PURE__*/jsxRuntime.jsxs("div", {
className: classnames__default["default"](styles.displayContainer, (_classnames = {}, _classnames[styles.inline] = inline, _classnames)),
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
id: id,
className: classnames__default["default"](styles.label, styles.shared, (_classnames2 = {}, _classnames2[styles.placeholder] = placeholder && !savedText, _classnames2[styles.inline] = inline, _classnames2[styles.readonly] = readonly || showEditButton, _classnames2), className),
onClick: handleClickDisplay,
style: style,
"aria-label": "display component",
children: formatDisplayText(savedText) || placeholder
}), showEditButton && !readonly && /*#__PURE__*/jsxRuntime.jsx("button", _extends({
type: "button",
className: styles.editButton
}, editButtonProps, {
onClick: handleClickEditButton,
children: editButtonContent
}))]
});
};

@@ -294,3 +298,3 @@

}, _sharedProps['aria-label'] = 'input component', _sharedProps);
return controlled ? h(Input, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, sharedProps, {
value: value,

@@ -303,3 +307,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Input, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsxRuntime.jsx(Input, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -329,3 +333,3 @@ inputClassName: inputClassName

return h("textarea", _extends({
return /*#__PURE__*/jsxRuntime.jsx("textarea", _extends({
id: id,

@@ -449,3 +453,3 @@ className: classnames__default["default"](styles.shared, inputClassName),

var textLines = splitLines(formatDisplayText(savedText));
return h("div", {
return /*#__PURE__*/jsxRuntime.jsx("div", {
id: id,

@@ -457,8 +461,13 @@ className: classnames__default["default"](styles.shared, styles.textareaView, (_classnames = {}, _classnames[styles.placeholder] = placeholder && !savedText, _classnames[styles.readonly] = readonly, _classnames), className),

}),
"aria-label": "display component"
}, textLines.length > 0 ? textLines.map(function (text, index) {
return h(React__default["default"].Fragment, {
key: index
}, h("span", null, text), h("br", null));
}) : h("span", null, placeholder));
"aria-label": "display component",
children: textLines.length > 0 ? textLines.map(function (text, index) {
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
children: text
}), /*#__PURE__*/jsxRuntime.jsx("br", {})]
}, index);
}) : /*#__PURE__*/jsxRuntime.jsx("span", {
children: placeholder
})
});
};

@@ -480,3 +489,3 @@

}, _sharedProps['aria-label'] = 'textarea component', _sharedProps);
return controlled ? h(Textarea, _extends({}, sharedProps, {
return controlled ? /*#__PURE__*/jsxRuntime.jsx(Textarea, _extends({}, sharedProps, {
value: value,

@@ -489,3 +498,3 @@ onChange: function onChange(e) {

inputClassName: inputClassName
})) : h(Textarea, _extends({}, sharedProps, {
})) : /*#__PURE__*/jsxRuntime.jsx(Textarea, _extends({}, sharedProps, {
defaultValue: savedText,

@@ -492,0 +501,0 @@ inputClassName: inputClassName

{
"name": "react-edit-text",
"version": "5.0.1",
"version": "5.0.2",
"description": "Simple editable text component for React",
"author": "Brian Min <bymi15@yahoo.com> (https://github.com/bymi15)",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.modern.js",
"unpkg": "./dist/index.umd.js",
"exports": {
"require": "./dist/index.js",
"default": "./dist/index.modern.js"
},
"source": "./src/index.js",
"main": "dist/index.js",
"module": "dist/index.modern.js",
"source": "src/index.js",
"engines": {

@@ -19,4 +14,4 @@ "node": ">=16 || ^14.17"

"scripts": {
"build": "microbundle --no-compress",
"start": "microbundle watch --no-compress",
"build": "microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
"start": "microbundle watch --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
"prepare": "run-s build",

@@ -61,6 +56,7 @@ "test": "run-s test:unit test:lint test:build",

"cross-env": "^7.0.2",
"eslint": "^8.17.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.30.0",
"gh-pages": "^2.2.0",
"gh-pages": "^4.0.0",
"microbundle": "^0.15.0",

@@ -71,3 +67,3 @@ "npm-run-all": "^4.1.5",

"react-dom": "^17.0.2",
"react-scripts": "5.0.1",
"react-scripts": "^5.0.1",
"semantic-release": "^19.0.2"

@@ -74,0 +70,0 @@ },

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

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