@sproutsocial/seeds-react-input 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.mjs → esm/index.js} +47 -52
- package/dist/index.js +47 -52
- package/package.json +2 -2
|
@@ -4,7 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
7
|
var __esm = (fn, res) => function __init() {
|
|
9
8
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
9
|
};
|
|
@@ -32,10 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
31
|
mod
|
|
33
32
|
));
|
|
34
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
-
var __publicField = (obj, key, value) => {
|
|
36
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
-
return value;
|
|
38
|
-
};
|
|
39
34
|
|
|
40
35
|
// ../../node_modules/polished/node_modules/@babel/runtime/helpers/esm/extends.js
|
|
41
36
|
function _extends() {
|
|
@@ -5099,45 +5094,6 @@ var isClearButton = (elem) => {
|
|
|
5099
5094
|
var Input = class extends React.Component {
|
|
5100
5095
|
constructor(props) {
|
|
5101
5096
|
super(props);
|
|
5102
|
-
// Define our own ref for use in handleClear.
|
|
5103
|
-
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
5104
|
-
__publicField(this, "inputRef", React.createRef());
|
|
5105
|
-
__publicField(this, "handleBlur", (e) => this.props.onBlur?.(e));
|
|
5106
|
-
__publicField(this, "handleClear", (e) => {
|
|
5107
|
-
const input = this.inputRef.current;
|
|
5108
|
-
if (input) {
|
|
5109
|
-
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
5110
|
-
window.HTMLInputElement.prototype,
|
|
5111
|
-
"value"
|
|
5112
|
-
)?.set;
|
|
5113
|
-
nativeInputValueSetter?.call(input, "");
|
|
5114
|
-
const inputEvent = new Event("input", {
|
|
5115
|
-
bubbles: true
|
|
5116
|
-
});
|
|
5117
|
-
input.dispatchEvent(inputEvent);
|
|
5118
|
-
this.props.onClear?.(e);
|
|
5119
|
-
setTimeout(() => {
|
|
5120
|
-
input.focus();
|
|
5121
|
-
}, 0);
|
|
5122
|
-
}
|
|
5123
|
-
});
|
|
5124
|
-
__publicField(this, "handleChange", (e) => {
|
|
5125
|
-
this.props.onChange?.(e, e.currentTarget.value);
|
|
5126
|
-
this.updateState(e.currentTarget.value);
|
|
5127
|
-
});
|
|
5128
|
-
__publicField(this, "handleFocus", (e) => this.props.onFocus?.(e));
|
|
5129
|
-
__publicField(this, "handleKeyDown", (e) => this.props.onKeyDown?.(e, e.currentTarget.value));
|
|
5130
|
-
__publicField(this, "handleKeyUp", (e) => this.props.onKeyUp?.(e, e.currentTarget.value));
|
|
5131
|
-
__publicField(this, "handlePaste", (e) => this.props.onPaste?.(e, e.currentTarget.value));
|
|
5132
|
-
__publicField(this, "updateState", (inputValue) => {
|
|
5133
|
-
const hasValue = inputValue !== "";
|
|
5134
|
-
const previousHasValue = this.state.hasValue;
|
|
5135
|
-
if (hasValue !== previousHasValue) {
|
|
5136
|
-
this.setState({
|
|
5137
|
-
hasValue
|
|
5138
|
-
});
|
|
5139
|
-
}
|
|
5140
|
-
});
|
|
5141
5097
|
this.state = {
|
|
5142
5098
|
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
5143
5099
|
// for both controlled and uncontrolled inputs.
|
|
@@ -5150,6 +5106,53 @@ var Input = class extends React.Component {
|
|
|
5150
5106
|
this.updateState(value || "");
|
|
5151
5107
|
}
|
|
5152
5108
|
}
|
|
5109
|
+
static defaultProps = {
|
|
5110
|
+
autoFocus: false,
|
|
5111
|
+
disabled: false,
|
|
5112
|
+
type: "text",
|
|
5113
|
+
size: "default",
|
|
5114
|
+
appearance: "primary"
|
|
5115
|
+
};
|
|
5116
|
+
static ClearButton = ClearButton;
|
|
5117
|
+
// Define our own ref for use in handleClear.
|
|
5118
|
+
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
5119
|
+
inputRef = React.createRef();
|
|
5120
|
+
handleBlur = (e) => this.props.onBlur?.(e);
|
|
5121
|
+
handleClear = (e) => {
|
|
5122
|
+
const input = this.inputRef.current;
|
|
5123
|
+
if (input) {
|
|
5124
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
5125
|
+
window.HTMLInputElement.prototype,
|
|
5126
|
+
"value"
|
|
5127
|
+
)?.set;
|
|
5128
|
+
nativeInputValueSetter?.call(input, "");
|
|
5129
|
+
const inputEvent = new Event("input", {
|
|
5130
|
+
bubbles: true
|
|
5131
|
+
});
|
|
5132
|
+
input.dispatchEvent(inputEvent);
|
|
5133
|
+
this.props.onClear?.(e);
|
|
5134
|
+
setTimeout(() => {
|
|
5135
|
+
input.focus();
|
|
5136
|
+
}, 0);
|
|
5137
|
+
}
|
|
5138
|
+
};
|
|
5139
|
+
handleChange = (e) => {
|
|
5140
|
+
this.props.onChange?.(e, e.currentTarget.value);
|
|
5141
|
+
this.updateState(e.currentTarget.value);
|
|
5142
|
+
};
|
|
5143
|
+
handleFocus = (e) => this.props.onFocus?.(e);
|
|
5144
|
+
handleKeyDown = (e) => this.props.onKeyDown?.(e, e.currentTarget.value);
|
|
5145
|
+
handleKeyUp = (e) => this.props.onKeyUp?.(e, e.currentTarget.value);
|
|
5146
|
+
handlePaste = (e) => this.props.onPaste?.(e, e.currentTarget.value);
|
|
5147
|
+
updateState = (inputValue) => {
|
|
5148
|
+
const hasValue = inputValue !== "";
|
|
5149
|
+
const previousHasValue = this.state.hasValue;
|
|
5150
|
+
if (hasValue !== previousHasValue) {
|
|
5151
|
+
this.setState({
|
|
5152
|
+
hasValue
|
|
5153
|
+
});
|
|
5154
|
+
}
|
|
5155
|
+
};
|
|
5153
5156
|
render() {
|
|
5154
5157
|
const {
|
|
5155
5158
|
autoComplete,
|
|
@@ -5254,14 +5257,6 @@ var Input = class extends React.Component {
|
|
|
5254
5257
|
);
|
|
5255
5258
|
}
|
|
5256
5259
|
};
|
|
5257
|
-
__publicField(Input, "defaultProps", {
|
|
5258
|
-
autoFocus: false,
|
|
5259
|
-
disabled: false,
|
|
5260
|
-
type: "text",
|
|
5261
|
-
size: "default",
|
|
5262
|
-
appearance: "primary"
|
|
5263
|
-
});
|
|
5264
|
-
__publicField(Input, "ClearButton", ClearButton);
|
|
5265
5260
|
var Input_default = Input;
|
|
5266
5261
|
|
|
5267
5262
|
// src/index.ts
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
8
|
var __esm = (fn, res) => function __init() {
|
|
10
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
10
|
};
|
|
@@ -33,10 +32,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
32
|
mod
|
|
34
33
|
));
|
|
35
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
-
var __publicField = (obj, key, value) => {
|
|
37
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
-
return value;
|
|
39
|
-
};
|
|
40
35
|
|
|
41
36
|
// ../../node_modules/polished/node_modules/@babel/runtime/helpers/esm/extends.js
|
|
42
37
|
function _extends() {
|
|
@@ -5108,45 +5103,6 @@ var isClearButton = (elem) => {
|
|
|
5108
5103
|
var Input = class extends React.Component {
|
|
5109
5104
|
constructor(props) {
|
|
5110
5105
|
super(props);
|
|
5111
|
-
// Define our own ref for use in handleClear.
|
|
5112
|
-
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
5113
|
-
__publicField(this, "inputRef", React.createRef());
|
|
5114
|
-
__publicField(this, "handleBlur", (e) => this.props.onBlur?.(e));
|
|
5115
|
-
__publicField(this, "handleClear", (e) => {
|
|
5116
|
-
const input = this.inputRef.current;
|
|
5117
|
-
if (input) {
|
|
5118
|
-
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
5119
|
-
window.HTMLInputElement.prototype,
|
|
5120
|
-
"value"
|
|
5121
|
-
)?.set;
|
|
5122
|
-
nativeInputValueSetter?.call(input, "");
|
|
5123
|
-
const inputEvent = new Event("input", {
|
|
5124
|
-
bubbles: true
|
|
5125
|
-
});
|
|
5126
|
-
input.dispatchEvent(inputEvent);
|
|
5127
|
-
this.props.onClear?.(e);
|
|
5128
|
-
setTimeout(() => {
|
|
5129
|
-
input.focus();
|
|
5130
|
-
}, 0);
|
|
5131
|
-
}
|
|
5132
|
-
});
|
|
5133
|
-
__publicField(this, "handleChange", (e) => {
|
|
5134
|
-
this.props.onChange?.(e, e.currentTarget.value);
|
|
5135
|
-
this.updateState(e.currentTarget.value);
|
|
5136
|
-
});
|
|
5137
|
-
__publicField(this, "handleFocus", (e) => this.props.onFocus?.(e));
|
|
5138
|
-
__publicField(this, "handleKeyDown", (e) => this.props.onKeyDown?.(e, e.currentTarget.value));
|
|
5139
|
-
__publicField(this, "handleKeyUp", (e) => this.props.onKeyUp?.(e, e.currentTarget.value));
|
|
5140
|
-
__publicField(this, "handlePaste", (e) => this.props.onPaste?.(e, e.currentTarget.value));
|
|
5141
|
-
__publicField(this, "updateState", (inputValue) => {
|
|
5142
|
-
const hasValue = inputValue !== "";
|
|
5143
|
-
const previousHasValue = this.state.hasValue;
|
|
5144
|
-
if (hasValue !== previousHasValue) {
|
|
5145
|
-
this.setState({
|
|
5146
|
-
hasValue
|
|
5147
|
-
});
|
|
5148
|
-
}
|
|
5149
|
-
});
|
|
5150
5106
|
this.state = {
|
|
5151
5107
|
// Tracking hasValue in state allows us to hide ClearButton when there is no value to clear
|
|
5152
5108
|
// for both controlled and uncontrolled inputs.
|
|
@@ -5159,6 +5115,53 @@ var Input = class extends React.Component {
|
|
|
5159
5115
|
this.updateState(value || "");
|
|
5160
5116
|
}
|
|
5161
5117
|
}
|
|
5118
|
+
static defaultProps = {
|
|
5119
|
+
autoFocus: false,
|
|
5120
|
+
disabled: false,
|
|
5121
|
+
type: "text",
|
|
5122
|
+
size: "default",
|
|
5123
|
+
appearance: "primary"
|
|
5124
|
+
};
|
|
5125
|
+
static ClearButton = ClearButton;
|
|
5126
|
+
// Define our own ref for use in handleClear.
|
|
5127
|
+
// We use mergeRefs to pass both this.inputRef and this.props.innerRef to input.
|
|
5128
|
+
inputRef = React.createRef();
|
|
5129
|
+
handleBlur = (e) => this.props.onBlur?.(e);
|
|
5130
|
+
handleClear = (e) => {
|
|
5131
|
+
const input = this.inputRef.current;
|
|
5132
|
+
if (input) {
|
|
5133
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
5134
|
+
window.HTMLInputElement.prototype,
|
|
5135
|
+
"value"
|
|
5136
|
+
)?.set;
|
|
5137
|
+
nativeInputValueSetter?.call(input, "");
|
|
5138
|
+
const inputEvent = new Event("input", {
|
|
5139
|
+
bubbles: true
|
|
5140
|
+
});
|
|
5141
|
+
input.dispatchEvent(inputEvent);
|
|
5142
|
+
this.props.onClear?.(e);
|
|
5143
|
+
setTimeout(() => {
|
|
5144
|
+
input.focus();
|
|
5145
|
+
}, 0);
|
|
5146
|
+
}
|
|
5147
|
+
};
|
|
5148
|
+
handleChange = (e) => {
|
|
5149
|
+
this.props.onChange?.(e, e.currentTarget.value);
|
|
5150
|
+
this.updateState(e.currentTarget.value);
|
|
5151
|
+
};
|
|
5152
|
+
handleFocus = (e) => this.props.onFocus?.(e);
|
|
5153
|
+
handleKeyDown = (e) => this.props.onKeyDown?.(e, e.currentTarget.value);
|
|
5154
|
+
handleKeyUp = (e) => this.props.onKeyUp?.(e, e.currentTarget.value);
|
|
5155
|
+
handlePaste = (e) => this.props.onPaste?.(e, e.currentTarget.value);
|
|
5156
|
+
updateState = (inputValue) => {
|
|
5157
|
+
const hasValue = inputValue !== "";
|
|
5158
|
+
const previousHasValue = this.state.hasValue;
|
|
5159
|
+
if (hasValue !== previousHasValue) {
|
|
5160
|
+
this.setState({
|
|
5161
|
+
hasValue
|
|
5162
|
+
});
|
|
5163
|
+
}
|
|
5164
|
+
};
|
|
5162
5165
|
render() {
|
|
5163
5166
|
const {
|
|
5164
5167
|
autoComplete,
|
|
@@ -5263,14 +5266,6 @@ var Input = class extends React.Component {
|
|
|
5263
5266
|
);
|
|
5264
5267
|
}
|
|
5265
5268
|
};
|
|
5266
|
-
__publicField(Input, "defaultProps", {
|
|
5267
|
-
autoFocus: false,
|
|
5268
|
-
disabled: false,
|
|
5269
|
-
type: "text",
|
|
5270
|
-
size: "default",
|
|
5271
|
-
appearance: "primary"
|
|
5272
|
-
});
|
|
5273
|
-
__publicField(Input, "ClearButton", ClearButton);
|
|
5274
5269
|
var Input_default = Input;
|
|
5275
5270
|
|
|
5276
5271
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-input",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Seeds Input",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"author": "Sprout Social, Inc.",
|
|
9
9
|
"license": "MIT",
|