@beequip/hexagon 0.18.0-1 → 0.18.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.
- package/dist/components/Input/CurrencyInput/index.d.ts +4 -4
- package/dist/components/Input/CurrencyInput/index.js +8 -8
- package/dist/components/Input/CurrencyInput/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +3 -3
- package/dist/components/Input/index.js +12 -12
- package/dist/components/Input/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface CurrencyInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onBlur'> {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface CurrencyInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onBlur'> {
|
|
3
3
|
value: number | undefined;
|
|
4
|
-
error?: string | ReactNode;
|
|
4
|
+
error?: string | React.ReactNode;
|
|
5
5
|
hook: string;
|
|
6
6
|
prefix?: string;
|
|
7
7
|
autoComplete?: string;
|
|
8
8
|
helpText?: string;
|
|
9
|
-
tooltip?: ReactNode;
|
|
9
|
+
tooltip?: React.ReactNode;
|
|
10
10
|
onChange: (value: number | '') => void;
|
|
11
11
|
onBlur: (value: number | '') => void;
|
|
12
12
|
}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CurrencyInput = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
5
|
+
var React = require("react");
|
|
6
6
|
var styles_1 = require("../styles");
|
|
7
7
|
var styles_2 = require("./styles");
|
|
8
8
|
var utilities_1 = require("./utilities");
|
|
9
9
|
var CurrencyInput = function (props) {
|
|
10
10
|
var valueFromProp = props.value, hook = props.hook, prefix = props.prefix, helpText = props.helpText, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, className = props.className, rest = tslib_1.__rest(props, ["value", "hook", "prefix", "helpText", "onChange", "onFocus", "onBlur", "className"]);
|
|
11
|
-
var _a = tslib_1.__read(
|
|
12
|
-
var _b = tslib_1.__read(
|
|
11
|
+
var _a = tslib_1.__read(React.useState(props.autoFocus || false), 2), isFocussed = _a[0], setIsFocussed = _a[1];
|
|
12
|
+
var _b = tslib_1.__read(React.useState(valueFromProp !== undefined && valueFromProp !== null
|
|
13
13
|
? (0, utilities_1.addFormatting)(valueFromProp)
|
|
14
14
|
: ''), 2), currentValue = _b[0], updateCurrentValue = _b[1];
|
|
15
15
|
var handleChange = function (event) {
|
|
@@ -45,19 +45,19 @@ var CurrencyInput = function (props) {
|
|
|
45
45
|
onBlur(valueAsInt);
|
|
46
46
|
return null;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
React.useEffect(function () {
|
|
49
49
|
if (valueFromProp && valueFromProp !== parseInt(currentValue, 10)) {
|
|
50
50
|
updateCurrentValue((0, utilities_1.addFormatting)(valueFromProp));
|
|
51
51
|
}
|
|
52
52
|
}, [valueFromProp, currentValue]);
|
|
53
|
-
return (
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
return (React.createElement(styles_2.StyledCurrencyInputWrapper, { isFocussed: isFocussed, disabled: props.disabled, error: props.error, className: className },
|
|
54
|
+
React.createElement(styles_1.StyledPreFix, null, prefix ? prefix : '€'),
|
|
55
|
+
React.createElement(styles_2.StyledCurrencyInput, tslib_1.__assign({ type: "text", value: currentValue, onChange: handleChange, onFocus: function (e) {
|
|
56
56
|
if (onFocus)
|
|
57
57
|
onFocus(e);
|
|
58
58
|
setIsFocussed(true);
|
|
59
59
|
}, onBlur: handleBlur, "data-hook": hook, inputMode: "decimal" }, rest)),
|
|
60
|
-
helpText &&
|
|
60
|
+
helpText && React.createElement(styles_1.StyledHelpText, null, helpText)));
|
|
61
61
|
};
|
|
62
62
|
exports.CurrencyInput = CurrencyInput;
|
|
63
63
|
exports.CurrencyInput.defaultProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Input/CurrencyInput/index.tsx"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Input/CurrencyInput/index.tsx"],"names":[],"mappings":";;;;AAAA,6BAA8B;AAC9B,oCAAwD;AACxD,mCAA0E;AAC1E,yCAIoB;AAkBb,IAAM,aAAa,GAAG,UAAC,KAAyB;IAE/C,IAAO,aAAa,GASpB,KAAK,MATe,EACpB,IAAI,GAQJ,KAAK,KARD,EACJ,MAAM,GAON,KAAK,OAPC,EACN,QAAQ,GAMR,KAAK,SANG,EACR,QAAQ,GAKR,KAAK,SALG,EACR,OAAO,GAIP,KAAK,QAJE,EACP,MAAM,GAGN,KAAK,OAHC,EACN,SAAS,GAET,KAAK,UAFI,EACN,IAAI,kBACP,KAAK,EAVH,qFAUL,CADU,CACF;IACH,IAAA,KAAA,eAA8B,KAAK,CAAC,QAAQ,CAC9C,KAAK,CAAC,SAAS,IAAI,KAAK,CAC3B,IAAA,EAFM,UAAU,QAAA,EAAE,aAAa,QAE/B,CAAA;IACK,IAAA,KAAA,eAAqC,KAAK,CAAC,QAAQ,CACrD,aAAa,KAAK,SAAS,IAAI,aAAa,KAAK,IAAI;QACjD,CAAC,CAAC,IAAA,yBAAa,EAAC,aAAa,CAAC;QAC9B,CAAC,CAAC,EAAE,CACX,IAAA,EAJM,YAAY,QAAA,EAAE,kBAAkB,QAItC,CAAA;IAED,IAAM,YAAY,GAAG,UAAC,KAA0C;QAE9C,IAAA,KAAK,GACf,KAAK,aADU,CACV;QAET,IAAM,aAAa,GAAG,KAAK,CAAA;QAE3B,IAAI,aAAa,KAAK,EAAE,IAAI,aAAa,KAAK,IAAI,EAAE;YAChD,kBAAkB,CAAC,EAAE,CAAC,CAAA;YACtB,QAAQ,CAAC,EAAE,CAAC,CAAA;YACZ,OAAO,KAAK,CAAA;SACf;QAED,IAA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CAA0B,IACvB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,SAAS;QAEpB,oBAAC,qBAAY,QAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAgB;QACpD,oBAAC,4BAAmB,qBAChB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,UAAA,CAAC;gBACN,IAAI,OAAO;oBAAE,OAAO,CAAC,CAAC,CAAC,CAAA;gBACvB,aAAa,CAAC,IAAI,CAAC,CAAA;YACvB,CAAC,EACD,MAAM,EAAE,UAAU,eACP,IAAI,EACf,SAAS,EAAC,SAAS,IACf,IAAI,EACV;QACD,QAAQ,IAAI,oBAAC,uBAAc,QAAE,QAAQ,CAAkB,CAC/B,CAChC,CAAA;AACL,CAAC,CAAA;AAtGY,QAAA,aAAa,iBAsGzB;AAED,qBAAa,CAAC,YAAY,GAAG;IACzB,YAAY,EAAE,KAAK;CACtB,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { Tooltip } from '../../theme/types';
|
|
3
|
-
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
hook?: string;
|
|
5
|
-
error?: string | ReactNode;
|
|
5
|
+
error?: string | React.ReactNode;
|
|
6
6
|
helpText?: string;
|
|
7
7
|
tooltip?: Tooltip;
|
|
8
8
|
postfix?: string;
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Input = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
5
|
+
var React = require("react");
|
|
6
6
|
var react_tooltip_1 = require("react-tooltip");
|
|
7
7
|
var InfoCircle_1 = require("../../assets/icons/InfoCircle");
|
|
8
8
|
var theme_1 = require("../../theme/theme");
|
|
9
9
|
var styles_1 = require("./styles");
|
|
10
|
-
exports.Input =
|
|
10
|
+
exports.Input = React.forwardRef(function (_a, ref) {
|
|
11
11
|
var hook = _a.hook, helpText = _a.helpText, tooltip = _a.tooltip, postfix = _a.postfix, prefix = _a.prefix, className = _a.className, onFocus = _a.onFocus, onBlur = _a.onBlur, props = tslib_1.__rest(_a, ["hook", "helpText", "tooltip", "postfix", "prefix", "className", "onFocus", "onBlur"]);
|
|
12
|
-
var _b = tslib_1.__read(
|
|
13
|
-
return (
|
|
14
|
-
prefix && (
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var _b = tslib_1.__read(React.useState(props.autoFocus || false), 2), isFocussed = _b[0], setIsFocussed = _b[1];
|
|
13
|
+
return (React.createElement(styles_1.StyledInputWrapper, { isFocussed: isFocussed, disabled: props.disabled, error: props.error, className: className },
|
|
14
|
+
prefix && (React.createElement(styles_1.StyledPreFix, { className: "hexagon-input-prefix" }, prefix)),
|
|
15
|
+
React.createElement(styles_1.StyledInputInner, null,
|
|
16
|
+
React.createElement(styles_1.StyledInput, tslib_1.__assign({ "data-hook": hook, prefix: prefix, postfix: postfix, ref: ref, onFocus: function (e) {
|
|
17
17
|
if (onFocus)
|
|
18
18
|
onFocus(e);
|
|
19
19
|
setIsFocussed(true);
|
|
@@ -22,11 +22,11 @@ exports.Input = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
22
22
|
onBlur(e);
|
|
23
23
|
setIsFocussed(false);
|
|
24
24
|
}, className: "hexagon-input" }, props)),
|
|
25
|
-
helpText &&
|
|
26
|
-
postfix && (
|
|
27
|
-
tooltip && (
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
helpText && React.createElement(styles_1.StyledHelpText, null, helpText)),
|
|
26
|
+
postfix && (React.createElement(styles_1.StyledPostFix, { className: "hexagon-input-postfix" }, postfix)),
|
|
27
|
+
tooltip && (React.createElement(styles_1.StyledTooltip, null,
|
|
28
|
+
React.createElement(react_tooltip_1.default, null),
|
|
29
|
+
React.createElement(InfoCircle_1.InfoCircle, { "data-background-color": theme_1.GREY1, "data-multiline": true, "data-place": tooltip.place, "data-tip": tooltip.content, "data-offset": "{'top': 10, 'left': 10}", width: 16, color: theme_1.PRIMARY })))));
|
|
30
30
|
});
|
|
31
31
|
exports.Input.defaultProps = {
|
|
32
32
|
autoComplete: 'off',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":";;;;AAAA,6BAA8B;AAC9B,+CAAwC;AACxC,4DAA0D;AAC1D,2CAAkD;AAElD,mCAQiB;AAYJ,QAAA,KAAK,GAAG,KAAK,CAAC,UAAU,CACjC,UACI,EAUC,EACD,GAAG;IAVC,IAAA,IAAI,UAAA,EACJ,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,OAAO,aAAA,EACP,MAAM,YAAA,EACN,SAAS,eAAA,EACT,OAAO,aAAA,EACP,MAAM,YAAA,EACH,KAAK,sBATZ,sFAUC,CADW;IAIN,IAAA,KAAA,eAA8B,KAAK,CAAC,QAAQ,CAC9C,KAAK,CAAC,SAAS,IAAI,KAAK,CAC3B,IAAA,EAFM,UAAU,QAAA,EAAE,aAAa,QAE/B,CAAA;IACD,OAAO,CACH,oBAAC,2BAAkB,IACf,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,SAAS;QAEnB,MAAM,IAAI,CACP,oBAAC,qBAAY,IAAC,SAAS,EAAC,sBAAsB,IACzC,MAAM,CACI,CAClB;QACD,oBAAC,yBAAgB;YACb,o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