@veracity/vui 2.0.1 → 2.0.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAgBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UA+HV,gBAAgB;WACf,iBAAiB;cACd,eAAe;CAC1B,CAAA;AAMD,eAAe,KAAK,CAAA"}
|
package/dist/cjs/input/input.js
CHANGED
|
@@ -61,8 +61,7 @@ exports.InputBase = core_1.styled.divBox `
|
|
|
61
61
|
width: 100%;
|
|
62
62
|
|
|
63
63
|
&[aria-disabled='true'] {
|
|
64
|
-
|
|
65
|
-
color: disabled.color;
|
|
64
|
+
opacity: 0.5;
|
|
66
65
|
cursor: not-allowed;
|
|
67
66
|
}
|
|
68
67
|
`;
|
|
@@ -75,7 +74,7 @@ exports.Input = (0, core_1.vui)((props, ref) => {
|
|
|
75
74
|
var _a, _b, _c, _d;
|
|
76
75
|
const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, errorText, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, helpText, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant } = props, rest = __rest(props, ["autoComplete", "autoFocus", "children", "className", "colorScheme", "defaultValue", "disabled", "errorText", "iconLeft", "iconRight", "id", "input", "inputProps", "inputRef", "isInvalid", "itemLeft", "itemRight", "helpText", "max", "maxLength", "min", "name", "onBlur", "onChange", "onFocus", "pattern", "placeholder", "readOnly", "required", "showCount", "size", "state", "stateMapping", "step", "type", "value", "variant"]);
|
|
77
76
|
const [count, setCount] = (0, react_1.useState)((0, helpers_1.getInitialCount)(props));
|
|
78
|
-
const [valueInternal, setValueInternal] = (0, react_1.useState)(defaultValue);
|
|
77
|
+
const [valueInternal, setValueInternal] = (0, react_1.useState)(defaultValue || '');
|
|
79
78
|
const states = Object.assign(Object.assign({}, consts_1.inputStateMapping), stateMapping);
|
|
80
79
|
const computedColorScheme = (0, utils_1.filterUndefined)({
|
|
81
80
|
colorScheme: (_a = colorScheme !== null && colorScheme !== void 0 ? colorScheme : (isInvalid ? consts_1.redColor : undefined)) !== null && _a !== void 0 ? _a : (_b = states[state]) === null || _b === void 0 ? void 0 : _b.colorScheme
|
|
@@ -95,7 +94,7 @@ exports.Input = (0, core_1.vui)((props, ref) => {
|
|
|
95
94
|
});
|
|
96
95
|
(0, react_1.useEffect)(() => {
|
|
97
96
|
var _a;
|
|
98
|
-
setValueInternal(value);
|
|
97
|
+
setValueInternal(value !== null && value !== void 0 ? value : '');
|
|
99
98
|
setCount(((_a = `${value}`) === null || _a === void 0 ? void 0 : _a.length) ? `${value}`.length : 0);
|
|
100
99
|
}, [value]);
|
|
101
100
|
return (react_1.default.createElement(context_1.InputProvider, { value: context },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/input/input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,YAAY,EAAE,MAAM,SAAS,CAAA;AAMnE,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,SAAS,+HAgBrB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK;UA+HV,gBAAgB;WACf,iBAAiB;cACd,eAAe;CAC1B,CAAA;AAMD,eAAe,KAAK,CAAA"}
|
package/dist/esm/input/input.js
CHANGED
|
@@ -21,8 +21,7 @@ export const InputBase = styled.divBox `
|
|
|
21
21
|
width: 100%;
|
|
22
22
|
|
|
23
23
|
&[aria-disabled='true'] {
|
|
24
|
-
|
|
25
|
-
color: disabled.color;
|
|
24
|
+
opacity: 0.5;
|
|
26
25
|
cursor: not-allowed;
|
|
27
26
|
}
|
|
28
27
|
`;
|
|
@@ -34,7 +33,7 @@ export const InputBase = styled.divBox `
|
|
|
34
33
|
export const Input = vui((props, ref) => {
|
|
35
34
|
const { autoComplete, autoFocus, children, className, colorScheme, defaultValue, disabled, errorText, iconLeft, iconRight, id, input, inputProps, inputRef, isInvalid, itemLeft, itemRight, helpText, max, maxLength, min, name, onBlur, onChange: onChangeProp, onFocus, pattern, placeholder, readOnly, required, showCount, size, state = '', stateMapping, step, type = 'text', value, variant, ...rest } = props;
|
|
36
35
|
const [count, setCount] = useState(getInitialCount(props));
|
|
37
|
-
const [valueInternal, setValueInternal] = useState(defaultValue);
|
|
36
|
+
const [valueInternal, setValueInternal] = useState(defaultValue || '');
|
|
38
37
|
const states = { ...inputStateMapping, ...stateMapping };
|
|
39
38
|
const computedColorScheme = filterUndefined({
|
|
40
39
|
colorScheme: colorScheme ?? (isInvalid ? redColor : undefined) ?? states[state]?.colorScheme
|
|
@@ -53,7 +52,7 @@ export const Input = vui((props, ref) => {
|
|
|
53
52
|
focusWithinRingColor: readOnly ? 'transparent' : undefined
|
|
54
53
|
});
|
|
55
54
|
useEffect(() => {
|
|
56
|
-
setValueInternal(value);
|
|
55
|
+
setValueInternal(value ?? '');
|
|
57
56
|
setCount(`${value}`?.length ? `${value}`.length : 0);
|
|
58
57
|
}, [value]);
|
|
59
58
|
return (React.createElement(InputProvider, { value: context },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
package/src/input/input.tsx
CHANGED
|
@@ -24,8 +24,7 @@ export const InputBase = styled.divBox`
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
|
|
26
26
|
&[aria-disabled='true'] {
|
|
27
|
-
|
|
28
|
-
color: disabled.color;
|
|
27
|
+
opacity: 0.5;
|
|
29
28
|
cursor: not-allowed;
|
|
30
29
|
}
|
|
31
30
|
`
|
|
@@ -78,7 +77,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
78
77
|
} = props
|
|
79
78
|
|
|
80
79
|
const [count, setCount] = useState(getInitialCount(props))
|
|
81
|
-
const [valueInternal, setValueInternal] = useState(defaultValue)
|
|
80
|
+
const [valueInternal, setValueInternal] = useState(defaultValue || '')
|
|
82
81
|
const states = { ...inputStateMapping, ...stateMapping }
|
|
83
82
|
const computedColorScheme = filterUndefined({
|
|
84
83
|
colorScheme: colorScheme ?? (isInvalid ? redColor : undefined) ?? states[state]?.colorScheme
|
|
@@ -105,7 +104,7 @@ export const Input = vui<'div', InputProps>((props, ref) => {
|
|
|
105
104
|
})
|
|
106
105
|
|
|
107
106
|
useEffect(() => {
|
|
108
|
-
setValueInternal(value)
|
|
107
|
+
setValueInternal(value ?? '')
|
|
109
108
|
setCount(`${value}`?.length ? `${value}`.length : 0)
|
|
110
109
|
}, [value])
|
|
111
110
|
|