@elliemae/ds-form-input-text 3.3.0-next.3 → 3.3.0-next.6
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/cjs/DSInputText.js +11 -35
- package/dist/cjs/DSInputText.js.map +1 -1
- package/dist/cjs/react-desc-prop-types.js +4 -19
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/esm/DSInputText.js +11 -37
- package/dist/esm/DSInputText.js.map +1 -1
- package/dist/esm/react-desc-prop-types.js +4 -21
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/package.json +7 -7
package/dist/cjs/DSInputText.js
CHANGED
|
@@ -3,34 +3,8 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
8
|
var __export = (target, all) => {
|
|
35
9
|
for (var name in all)
|
|
36
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -61,14 +35,13 @@ var import_data_test_ids = require("./exported-related/data-test-ids");
|
|
|
61
35
|
var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
62
36
|
var import_components = require("./styled/components");
|
|
63
37
|
const DSInputText = (props) => {
|
|
64
|
-
const
|
|
65
|
-
globalAttributes:
|
|
66
|
-
} = _a, _c = _b, { className } = _c, otherGlobalAttributes = __objRest(_c, ["className"]), {
|
|
38
|
+
const {
|
|
39
|
+
globalAttributes: { className, ...otherGlobalAttributes },
|
|
67
40
|
hasFocus,
|
|
68
41
|
handlers,
|
|
69
42
|
propsWithDefault,
|
|
70
43
|
xstyledProps
|
|
71
|
-
} =
|
|
44
|
+
} = (0, import_useInputText.useInputText)(props);
|
|
72
45
|
const { clearable, disabled, hasError, innerRef, placeholder, readOnly, inputSize, onClear, value } = propsWithDefault;
|
|
73
46
|
const inputRef = (0, import_react.useRef)(null);
|
|
74
47
|
const currentRef = innerRef ?? inputRef;
|
|
@@ -78,22 +51,25 @@ const DSInputText = (props) => {
|
|
|
78
51
|
console.log(currentRef, "currentRef");
|
|
79
52
|
currentRef?.current?.focus();
|
|
80
53
|
}, [onClear, currentRef]);
|
|
81
|
-
return /* @__PURE__ */ import_react.default.createElement(import_components.StyledInputWrapper,
|
|
54
|
+
return /* @__PURE__ */ import_react.default.createElement(import_components.StyledInputWrapper, {
|
|
82
55
|
className,
|
|
83
56
|
cols: shouldDisplayClearButton ? ["auto", "min-content"] : ["auto"],
|
|
84
57
|
isDisabled: disabled,
|
|
85
58
|
isReadOnly: readOnly,
|
|
86
59
|
hasError,
|
|
87
60
|
hasFocus,
|
|
88
|
-
inputSize
|
|
89
|
-
|
|
61
|
+
inputSize,
|
|
62
|
+
...xstyledProps
|
|
63
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_components.StyledInput, {
|
|
90
64
|
"data-testid": import_data_test_ids.DSInputTextDataTestIds.INPUT,
|
|
91
65
|
disabled,
|
|
92
66
|
placeholder,
|
|
93
67
|
readOnly,
|
|
94
68
|
ref: currentRef,
|
|
95
|
-
value
|
|
96
|
-
|
|
69
|
+
value,
|
|
70
|
+
...handlers,
|
|
71
|
+
...otherGlobalAttributes
|
|
72
|
+
}), shouldDisplayClearButton && /* @__PURE__ */ import_react.default.createElement(import_components.StyledClearButton, {
|
|
97
73
|
"aria-label": "Clear input value",
|
|
98
74
|
buttonType: "icon",
|
|
99
75
|
"data-testid": import_data_test_ids.DSInputTextDataTestIds.CLEAR_BUTTON,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSInputText.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useCallback, useRef } from 'react';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { DSIconColors } from '@elliemae/ds-icon';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useInputText } from './config/useInputText';\nimport { DSInputTextDataTestIds } from './exported-related/data-test-ids';\nimport { DSInputTextPropTypes, DSInputTextT } from './react-desc-prop-types';\nimport { StyledClearButton, StyledInput, StyledInputWrapper } from './styled/components';\n\nexport const DSInputText: React.ComponentType<DSInputTextT.Props> = (props) => {\n const {\n globalAttributes: { className, ...otherGlobalAttributes },\n hasFocus,\n handlers,\n propsWithDefault,\n xstyledProps,\n } = useInputText(props);\n\n const { clearable, disabled, hasError, innerRef, placeholder, readOnly, inputSize, onClear, value } =\n propsWithDefault;\n\n const inputRef = useRef(null);\n const currentRef = innerRef ?? inputRef;\n const shouldDisplayClearButton = clearable && value !== '';\n\n const handleClear = useCallback(() => {\n onClear();\n console.log(currentRef, 'currentRef');\n currentRef?.current?.focus();\n }, [onClear, currentRef]);\n\n return (\n <StyledInputWrapper\n className={className}\n cols={shouldDisplayClearButton ? ['auto', 'min-content'] : ['auto']}\n isDisabled={disabled}\n isReadOnly={readOnly}\n hasError={hasError}\n hasFocus={hasFocus}\n inputSize={inputSize}\n {...xstyledProps}\n >\n <StyledInput\n data-testid={DSInputTextDataTestIds.INPUT}\n disabled={disabled}\n placeholder={placeholder}\n readOnly={readOnly}\n ref={currentRef}\n value={value}\n {...handlers}\n {...otherGlobalAttributes}\n />\n {shouldDisplayClearButton && (\n <StyledClearButton\n aria-label=\"Clear input value\"\n buttonType=\"icon\"\n data-testid={DSInputTextDataTestIds.CLEAR_BUTTON}\n onClick={handleClear}\n >\n <CloseMedium color={DSIconColors.PRIMARY} />\n </StyledClearButton>\n )}\n </StyledInputWrapper>\n );\n};\n\nDSInputText.propTypes = DSInputTextPropTypes;\nDSInputText.displayName = 'DSInputText';\nexport const DSInputTextWithSchema = describe(DSInputText);\nDSInputTextWithSchema.propTypes = DSInputTextPropTypes;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2C;AAC3C,sBAA4B;AAC5B,qBAA6B;AAC7B,0BAAyB;AACzB,0BAA6B;AAC7B,2BAAuC;AACvC,mCAAmD;AACnD,wBAAmE;AAE5D,MAAM,cAAuD,CAAC,UAAU;AAC7E,QAAM;AAAA,IACJ,kBAAkB,EAAE,cAAc;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,sCAAa,KAAK;AAEtB,QAAM,EAAE,WAAW,UAAU,UAAU,UAAU,aAAa,UAAU,WAAW,SAAS,UAC1F;AAEF,QAAM,WAAW,yBAAO,IAAI;AAC5B,QAAM,aAAa,YAAY;AAC/B,QAAM,2BAA2B,aAAa,UAAU;AAExD,QAAM,cAAc,8BAAY,MAAM;AACpC,YAAQ;AACR,YAAQ,IAAI,YAAY,YAAY;AACpC,gBAAY,SAAS,MAAM;AAAA,EAC7B,GAAG,CAAC,SAAS,UAAU,CAAC;AAExB,SACE,mDAAC;AAAA,IACC;AAAA,IACA,MAAM,2BAA2B,CAAC,QAAQ,aAAa,IAAI,CAAC,MAAM;AAAA,IAClE,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACC,GAAG;AAAA,KAEJ,mDAAC;AAAA,IACC,eAAa,4CAAuB;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACC,GAAG;AAAA,IACH,GAAG;AAAA,GACN,GACC,4BACC,mDAAC;AAAA,IACC,cAAW;AAAA,IACX,YAAW;AAAA,IACX,eAAa,4CAAuB;AAAA,IACpC,SAAS;AAAA,KAET,mDAAC;AAAA,IAAY,OAAO,4BAAa;AAAA,GAAS,CAC5C,CAEJ;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AACnB,MAAM,wBAAwB,kCAAS,WAAW;AACzD,sBAAsB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -54,7 +37,9 @@ const defaultProps = {
|
|
|
54
37
|
inputSize: "m",
|
|
55
38
|
clearable: false
|
|
56
39
|
};
|
|
57
|
-
const DSInputTextPropTypes =
|
|
40
|
+
const DSInputTextPropTypes = {
|
|
41
|
+
...import_ds_utilities.globalAttributesPropTypes,
|
|
42
|
+
...import_ds_utilities.xstyledPropTypes,
|
|
58
43
|
value: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.string, import_ds_utilities.PropTypes.number, import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.string)]).description("Value of the input").defaultValue(""),
|
|
59
44
|
onValueChange: import_ds_utilities.PropTypes.func.description("Callback triggered when the value changes").defaultValue(() => null).signature("((newValue: string, e: React.ChangeEvent) => void)"),
|
|
60
45
|
placeholder: import_ds_utilities.PropTypes.string.description("Value of the placeholder").defaultValue(""),
|
|
@@ -65,5 +50,5 @@ const DSInputTextPropTypes = __spreadProps(__spreadValues(__spreadValues({}, imp
|
|
|
65
50
|
inputSize: import_ds_utilities.PropTypes.oneOf(["s", "m"]).description("Size of the input").defaultValue("m"),
|
|
66
51
|
clearable: import_ds_utilities.PropTypes.bool.description("Whether the input is clearable").defaultValue(false),
|
|
67
52
|
onClear: import_ds_utilities.PropTypes.func.description("Callback triggered when the clearable button is pressed").defaultValue(() => null).signature("(() => void)")
|
|
68
|
-
}
|
|
53
|
+
};
|
|
69
54
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { WeakValidationMap } from 'react';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n GlobalAttributesT,\n XstyledProps,\n} from '@elliemae/ds-utilities';\n\nexport declare namespace DSInputTextT {\n interface IProps {\n value?: string | number;\n onValueChange?: (nextValue: string | number, e: React.ChangeEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n placeholder?: string;\n innerRef?: React.RefObject<HTMLInputElement> | ((_ref: HTMLInputElement) => void);\n disabled?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n inputSize?: 's' | 'm';\n clearable?: boolean;\n }\n\n export interface Props extends IProps, Omit<GlobalAttributesT<HTMLInputElement>, keyof IProps>, XstyledProps {}\n}\n\nexport const defaultProps: DSInputTextT.Props = {\n onValueChange: () => null,\n onClear: () => null,\n placeholder: 'Hint Text',\n disabled: false,\n readOnly: false,\n hasError: false,\n inputSize: 'm',\n clearable: false,\n};\n\nexport const DSInputTextPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.string)])\n .description('Value of the input')\n .defaultValue(''),\n onValueChange: PropTypes.func\n .description('Callback triggered when the value changes')\n .defaultValue(() => null)\n .signature('((newValue: string, e: React.ChangeEvent) => void)'),\n placeholder: PropTypes.string.description('Value of the placeholder').defaultValue(''),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func.signature('((ref: HTMLInputElement) => void)')])\n .description('Reference to the input')\n .defaultValue(null),\n disabled: PropTypes.bool.description('Whether the input is disabled').defaultValue(false),\n readOnly: PropTypes.bool.description('Whether the input is readonly').defaultValue(false),\n hasError: PropTypes.bool.description('Whether the input has error').defaultValue(false),\n inputSize: PropTypes.oneOf(['s', 'm']).description('Size of the input').defaultValue('m'),\n clearable: PropTypes.bool.description('Whether the input is clearable').defaultValue(false),\n onClear: PropTypes.func\n .description('Callback triggered when the clearable button is pressed')\n .defaultValue(() => null)\n .signature('(() => void)'),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAMO;AAmBA,MAAM,eAAmC;AAAA,EAC9C,eAAe,MAAM;AAAA,EACrB,SAAS,MAAM;AAAA,EACf,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AACb;AAEO,MAAM,uBAAuB;AAAA,EAClC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,QAAQ,8BAAU,QAAQ,8BAAU,MAAM,CAAC,CAAC,EACjG,YAAY,oBAAoB,EAChC,aAAa,EAAE;AAAA,EAClB,eAAe,8BAAU,KACtB,YAAY,2CAA2C,EACvD,aAAa,MAAM,IAAI,EACvB,UAAU,oDAAoD;AAAA,EACjE,aAAa,8BAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,EAAE;AAAA,EACrF,UAAU,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,KAAK,UAAU,mCAAmC,CAAC,CAAC,EAC5G,YAAY,wBAAwB,EACpC,aAAa,IAAI;AAAA,EACpB,UAAU,8BAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,UAAU,8BAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,UAAU,8BAAU,KAAK,YAAY,6BAA6B,EAAE,aAAa,KAAK;AAAA,EACtF,WAAW,8BAAU,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,YAAY,mBAAmB,EAAE,aAAa,GAAG;AAAA,EACxF,WAAW,8BAAU,KAAK,YAAY,gCAAgC,EAAE,aAAa,KAAK;AAAA,EAC1F,SAAS,8BAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,MAAM,IAAI,EACvB,UAAU,cAAc;AAC7B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSInputText.js
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import React2, { useCallback, useRef } from "react";
|
|
32
4
|
import { CloseMedium } from "@elliemae/ds-icons";
|
|
@@ -37,14 +9,13 @@ import { DSInputTextDataTestIds } from "./exported-related/data-test-ids";
|
|
|
37
9
|
import { DSInputTextPropTypes } from "./react-desc-prop-types";
|
|
38
10
|
import { StyledClearButton, StyledInput, StyledInputWrapper } from "./styled/components";
|
|
39
11
|
const DSInputText = (props) => {
|
|
40
|
-
const
|
|
41
|
-
globalAttributes:
|
|
42
|
-
} = _a, _c = _b, { className } = _c, otherGlobalAttributes = __objRest(_c, ["className"]), {
|
|
12
|
+
const {
|
|
13
|
+
globalAttributes: { className, ...otherGlobalAttributes },
|
|
43
14
|
hasFocus,
|
|
44
15
|
handlers,
|
|
45
16
|
propsWithDefault,
|
|
46
17
|
xstyledProps
|
|
47
|
-
} =
|
|
18
|
+
} = useInputText(props);
|
|
48
19
|
const { clearable, disabled, hasError, innerRef, placeholder, readOnly, inputSize, onClear, value } = propsWithDefault;
|
|
49
20
|
const inputRef = useRef(null);
|
|
50
21
|
const currentRef = innerRef ?? inputRef;
|
|
@@ -54,22 +25,25 @@ const DSInputText = (props) => {
|
|
|
54
25
|
console.log(currentRef, "currentRef");
|
|
55
26
|
currentRef?.current?.focus();
|
|
56
27
|
}, [onClear, currentRef]);
|
|
57
|
-
return /* @__PURE__ */ React2.createElement(StyledInputWrapper,
|
|
28
|
+
return /* @__PURE__ */ React2.createElement(StyledInputWrapper, {
|
|
58
29
|
className,
|
|
59
30
|
cols: shouldDisplayClearButton ? ["auto", "min-content"] : ["auto"],
|
|
60
31
|
isDisabled: disabled,
|
|
61
32
|
isReadOnly: readOnly,
|
|
62
33
|
hasError,
|
|
63
34
|
hasFocus,
|
|
64
|
-
inputSize
|
|
65
|
-
|
|
35
|
+
inputSize,
|
|
36
|
+
...xstyledProps
|
|
37
|
+
}, /* @__PURE__ */ React2.createElement(StyledInput, {
|
|
66
38
|
"data-testid": DSInputTextDataTestIds.INPUT,
|
|
67
39
|
disabled,
|
|
68
40
|
placeholder,
|
|
69
41
|
readOnly,
|
|
70
42
|
ref: currentRef,
|
|
71
|
-
value
|
|
72
|
-
|
|
43
|
+
value,
|
|
44
|
+
...handlers,
|
|
45
|
+
...otherGlobalAttributes
|
|
46
|
+
}), shouldDisplayClearButton && /* @__PURE__ */ React2.createElement(StyledClearButton, {
|
|
73
47
|
"aria-label": "Clear input value",
|
|
74
48
|
buttonType: "icon",
|
|
75
49
|
"data-testid": DSInputTextDataTestIds.CLEAR_BUTTON,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSInputText.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useRef } from 'react';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { DSIconColors } from '@elliemae/ds-icon';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useInputText } from './config/useInputText';\nimport { DSInputTextDataTestIds } from './exported-related/data-test-ids';\nimport { DSInputTextPropTypes, DSInputTextT } from './react-desc-prop-types';\nimport { StyledClearButton, StyledInput, StyledInputWrapper } from './styled/components';\n\nexport const DSInputText: React.ComponentType<DSInputTextT.Props> = (props) => {\n const {\n globalAttributes: { className, ...otherGlobalAttributes },\n hasFocus,\n handlers,\n propsWithDefault,\n xstyledProps,\n } = useInputText(props);\n\n const { clearable, disabled, hasError, innerRef, placeholder, readOnly, inputSize, onClear, value } =\n propsWithDefault;\n\n const inputRef = useRef(null);\n const currentRef = innerRef ?? inputRef;\n const shouldDisplayClearButton = clearable && value !== '';\n\n const handleClear = useCallback(() => {\n onClear();\n console.log(currentRef, 'currentRef');\n currentRef?.current?.focus();\n }, [onClear, currentRef]);\n\n return (\n <StyledInputWrapper\n className={className}\n cols={shouldDisplayClearButton ? ['auto', 'min-content'] : ['auto']}\n isDisabled={disabled}\n isReadOnly={readOnly}\n hasError={hasError}\n hasFocus={hasFocus}\n inputSize={inputSize}\n {...xstyledProps}\n >\n <StyledInput\n data-testid={DSInputTextDataTestIds.INPUT}\n disabled={disabled}\n placeholder={placeholder}\n readOnly={readOnly}\n ref={currentRef}\n value={value}\n {...handlers}\n {...otherGlobalAttributes}\n />\n {shouldDisplayClearButton && (\n <StyledClearButton\n aria-label=\"Clear input value\"\n buttonType=\"icon\"\n data-testid={DSInputTextDataTestIds.CLEAR_BUTTON}\n onClick={handleClear}\n >\n <CloseMedium color={DSIconColors.PRIMARY} />\n </StyledClearButton>\n )}\n </StyledInputWrapper>\n );\n};\n\nDSInputText.propTypes = DSInputTextPropTypes;\nDSInputText.displayName = 'DSInputText';\nexport const DSInputTextWithSchema = describe(DSInputText);\nDSInputTextWithSchema.propTypes = DSInputTextPropTypes;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,cAAuD,CAAC,UAAU;AAC7E,QAAM;AAAA,IACJ,kBAAkB,EAAE,cAAc;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,aAAa,KAAK;AAEtB,QAAM,EAAE,WAAW,UAAU,UAAU,UAAU,aAAa,UAAU,WAAW,SAAS,UAC1F;AAEF,QAAM,WAAW,OAAO,IAAI;AAC5B,QAAM,aAAa,YAAY;AAC/B,QAAM,2BAA2B,aAAa,UAAU;AAExD,QAAM,cAAc,YAAY,MAAM;AACpC,YAAQ;AACR,YAAQ,IAAI,YAAY,YAAY;AACpC,gBAAY,SAAS,MAAM;AAAA,EAC7B,GAAG,CAAC,SAAS,UAAU,CAAC;AAExB,SACE,qCAAC;AAAA,IACC;AAAA,IACA,MAAM,2BAA2B,CAAC,QAAQ,aAAa,IAAI,CAAC,MAAM;AAAA,IAClE,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACC,GAAG;AAAA,KAEJ,qCAAC;AAAA,IACC,eAAa,uBAAuB;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACC,GAAG;AAAA,IACH,GAAG;AAAA,GACN,GACC,4BACC,qCAAC;AAAA,IACC,cAAW;AAAA,IACX,YAAW;AAAA,IACX,eAAa,uBAAuB;AAAA,IACpC,SAAS;AAAA,KAET,qCAAC;AAAA,IAAY,OAAO,aAAa;AAAA,GAAS,CAC5C,CAEJ;AAEJ;AAEA,YAAY,YAAY;AACxB,YAAY,cAAc;AACnB,MAAM,wBAAwB,SAAS,WAAW;AACzD,sBAAsB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import {
|
|
23
4
|
PropTypes,
|
|
@@ -34,7 +15,9 @@ const defaultProps = {
|
|
|
34
15
|
inputSize: "m",
|
|
35
16
|
clearable: false
|
|
36
17
|
};
|
|
37
|
-
const DSInputTextPropTypes =
|
|
18
|
+
const DSInputTextPropTypes = {
|
|
19
|
+
...globalAttributesPropTypes,
|
|
20
|
+
...xstyledPropTypes,
|
|
38
21
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.string)]).description("Value of the input").defaultValue(""),
|
|
39
22
|
onValueChange: PropTypes.func.description("Callback triggered when the value changes").defaultValue(() => null).signature("((newValue: string, e: React.ChangeEvent) => void)"),
|
|
40
23
|
placeholder: PropTypes.string.description("Value of the placeholder").defaultValue(""),
|
|
@@ -45,7 +28,7 @@ const DSInputTextPropTypes = __spreadProps(__spreadValues(__spreadValues({}, glo
|
|
|
45
28
|
inputSize: PropTypes.oneOf(["s", "m"]).description("Size of the input").defaultValue("m"),
|
|
46
29
|
clearable: PropTypes.bool.description("Whether the input is clearable").defaultValue(false),
|
|
47
30
|
onClear: PropTypes.func.description("Callback triggered when the clearable button is pressed").defaultValue(() => null).signature("(() => void)")
|
|
48
|
-
}
|
|
31
|
+
};
|
|
49
32
|
export {
|
|
50
33
|
DSInputTextPropTypes,
|
|
51
34
|
defaultProps
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { WeakValidationMap } from 'react';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n GlobalAttributesT,\n XstyledProps,\n} from '@elliemae/ds-utilities';\n\nexport declare namespace DSInputTextT {\n interface IProps {\n value?: string | number;\n onValueChange?: (nextValue: string | number, e: React.ChangeEvent<HTMLInputElement>) => void;\n onClear?: () => void;\n placeholder?: string;\n innerRef?: React.RefObject<HTMLInputElement> | ((_ref: HTMLInputElement) => void);\n disabled?: boolean;\n readOnly?: boolean;\n hasError?: boolean;\n inputSize?: 's' | 'm';\n clearable?: boolean;\n }\n\n export interface Props extends IProps, Omit<GlobalAttributesT<HTMLInputElement>, keyof IProps>, XstyledProps {}\n}\n\nexport const defaultProps: DSInputTextT.Props = {\n onValueChange: () => null,\n onClear: () => null,\n placeholder: 'Hint Text',\n disabled: false,\n readOnly: false,\n hasError: false,\n inputSize: 'm',\n clearable: false,\n};\n\nexport const DSInputTextPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.string)])\n .description('Value of the input')\n .defaultValue(''),\n onValueChange: PropTypes.func\n .description('Callback triggered when the value changes')\n .defaultValue(() => null)\n .signature('((newValue: string, e: React.ChangeEvent) => void)'),\n placeholder: PropTypes.string.description('Value of the placeholder').defaultValue(''),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func.signature('((ref: HTMLInputElement) => void)')])\n .description('Reference to the input')\n .defaultValue(null),\n disabled: PropTypes.bool.description('Whether the input is disabled').defaultValue(false),\n readOnly: PropTypes.bool.description('Whether the input is readonly').defaultValue(false),\n hasError: PropTypes.bool.description('Whether the input has error').defaultValue(false),\n inputSize: PropTypes.oneOf(['s', 'm']).description('Size of the input').defaultValue('m'),\n clearable: PropTypes.bool.description('Whether the input is clearable').defaultValue(false),\n onClear: PropTypes.func\n .description('Callback triggered when the clearable button is pressed')\n .defaultValue(() => null)\n .signature('(() => void)'),\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AAAA;AAAA;AAAA;AAAA;AAyBO,MAAM,eAAmC;AAAA,EAC9C,eAAe,MAAM;AAAA,EACrB,SAAS,MAAM;AAAA,EACf,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AACb;AAEO,MAAM,uBAAuB;AAAA,EAClC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,EACjG,YAAY,oBAAoB,EAChC,aAAa,EAAE;AAAA,EAClB,eAAe,UAAU,KACtB,YAAY,2CAA2C,EACvD,aAAa,MAAM,IAAI,EACvB,UAAU,oDAAoD;AAAA,EACjE,aAAa,UAAU,OAAO,YAAY,0BAA0B,EAAE,aAAa,EAAE;AAAA,EACrF,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,KAAK,UAAU,mCAAmC,CAAC,CAAC,EAC5G,YAAY,wBAAwB,EACpC,aAAa,IAAI;AAAA,EACpB,UAAU,UAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,UAAU,UAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,UAAU,UAAU,KAAK,YAAY,6BAA6B,EAAE,aAAa,KAAK;AAAA,EACtF,WAAW,UAAU,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,YAAY,mBAAmB,EAAE,aAAa,GAAG;AAAA,EACxF,WAAW,UAAU,KAAK,YAAY,gCAAgC,EAAE,aAAa,KAAK;AAAA,EAC1F,SAAS,UAAU,KAChB,YAAY,yDAAyD,EACrE,aAAa,MAAM,IAAI,EACvB,UAAU,cAAc;AAC7B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-input-text",
|
|
3
|
-
"version": "3.3.0-next.
|
|
3
|
+
"version": "3.3.0-next.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Input Text",
|
|
6
6
|
"files": [
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"indent": 4
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@elliemae/ds-button": "3.3.0-next.
|
|
39
|
-
"@elliemae/ds-grid": "3.3.0-next.
|
|
40
|
-
"@elliemae/ds-icon": "3.3.0-next.
|
|
41
|
-
"@elliemae/ds-icons": "3.3.0-next.
|
|
42
|
-
"@elliemae/ds-system": "3.3.0-next.
|
|
43
|
-
"@elliemae/ds-utilities": "3.3.0-next.
|
|
38
|
+
"@elliemae/ds-button": "3.3.0-next.6",
|
|
39
|
+
"@elliemae/ds-grid": "3.3.0-next.6",
|
|
40
|
+
"@elliemae/ds-icon": "3.3.0-next.6",
|
|
41
|
+
"@elliemae/ds-icons": "3.3.0-next.6",
|
|
42
|
+
"@elliemae/ds-system": "3.3.0-next.6",
|
|
43
|
+
"@elliemae/ds-utilities": "3.3.0-next.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@elliemae/pui-theme": "~2.6.0",
|