@dfx.swiss/react-components 1.3.0-beta.7 → 1.3.0-beta.9
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.
|
@@ -15,6 +15,7 @@ interface StyledInputProps extends ControlProps {
|
|
|
15
15
|
small?: boolean;
|
|
16
16
|
smallLabel?: boolean;
|
|
17
17
|
autocomplete?: string;
|
|
18
|
+
multiLine?: boolean;
|
|
18
19
|
}
|
|
19
20
|
declare const StyledInput: import("react").ForwardRefExoticComponent<StyledInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
20
21
|
export default StyledInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledInput.d.ts","sourceRoot":"","sources":["../../../src/stories/form/StyledInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,sBAAsB,
|
|
1
|
+
{"version":3,"file":"StyledInput.d.ts","sourceRoot":"","sources":["../../../src/stories/form/StyledInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,sBAAsB,EAAa,MAAM,OAAO,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,UAAU,gBAAiB,SAAQ,YAAY;IAC7C,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAMD,QAAA,MAAM,WAAW,+GAsHhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -30,7 +30,7 @@ function getMargin(affix) {
|
|
|
30
30
|
return 12 + ((_a = affix === null || affix === void 0 ? void 0 : affix.length) !== null && _a !== void 0 ? _a : 0) * 14;
|
|
31
31
|
}
|
|
32
32
|
var StyledInput = forwardRef(function (_a, ref) {
|
|
33
|
-
var control = _a.control, name = _a.name, autocomplete = _a.autocomplete, label = _a.label, rules = _a.rules, _b = _a.disabled, disabled = _b === void 0 ? false : _b, error = _a.error, _c = _a.type, type = _c === void 0 ? 'text' : _c, placeholder = _a.placeholder, prefix = _a.prefix, buttonLabel = _a.buttonLabel, buttonClick = _a.buttonClick, _d = _a.forceError, forceError = _d === void 0 ? false : _d, forceErrorMessage = _a.forceErrorMessage, _e = _a.hideLabel, hideLabel = _e === void 0 ? false : _e, _f = _a.darkTheme, darkTheme = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, _h = _a.full, full = _h === void 0 ? false : _h, _j = _a.small, small = _j === void 0 ? false : _j, _k = _a.smallLabel, smallLabel = _k === void 0 ? false : _k, props = __rest(_a, ["control", "name", "autocomplete", "label", "rules", "disabled", "error", "type", "placeholder", "prefix", "buttonLabel", "buttonClick", "forceError", "forceErrorMessage", "hideLabel", "darkTheme", "loading", "full", "small", "smallLabel"]);
|
|
33
|
+
var control = _a.control, name = _a.name, autocomplete = _a.autocomplete, label = _a.label, rules = _a.rules, _b = _a.disabled, disabled = _b === void 0 ? false : _b, error = _a.error, _c = _a.type, type = _c === void 0 ? 'text' : _c, placeholder = _a.placeholder, prefix = _a.prefix, buttonLabel = _a.buttonLabel, buttonClick = _a.buttonClick, _d = _a.forceError, forceError = _d === void 0 ? false : _d, forceErrorMessage = _a.forceErrorMessage, _e = _a.hideLabel, hideLabel = _e === void 0 ? false : _e, _f = _a.darkTheme, darkTheme = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, _h = _a.full, full = _h === void 0 ? false : _h, _j = _a.small, small = _j === void 0 ? false : _j, _k = _a.smallLabel, smallLabel = _k === void 0 ? false : _k, multiLine = _a.multiLine, props = __rest(_a, ["control", "name", "autocomplete", "label", "rules", "disabled", "error", "type", "placeholder", "prefix", "buttonLabel", "buttonClick", "forceError", "forceErrorMessage", "hideLabel", "darkTheme", "loading", "full", "small", "smallLabel", "multiLine"]);
|
|
34
34
|
var textColor = darkTheme ? 'text-white' : 'text-dfxBlue-800';
|
|
35
35
|
var backgroundColor = darkTheme ? 'bg-white bg-opacity-5' : 'bg-white';
|
|
36
36
|
var placeholderColor = darkTheme ? 'placeholder:text-dfxGray-800' : 'placeholder:text-dfxGray-600';
|
|
@@ -41,8 +41,9 @@ var StyledInput = forwardRef(function (_a, ref) {
|
|
|
41
41
|
var textOrErrorColor = error || forceError ? 'text-dfxRed-100' : textColor;
|
|
42
42
|
return (_jsx(Controller, { control: control, render: function (_a) {
|
|
43
43
|
var _b = _a.field, onChange = _b.onChange, onBlur = _b.onBlur, value = _b.value;
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
var inputProps = __assign({ className: "text-base font-normal rounded-md p-4 ".concat(small ? 'w-24' : 'w-full', " ") +
|
|
45
|
+
[textOrErrorColor, backgroundColor, placeholderColor, borderColor, outlineColor].join(' '), style: { paddingLeft: paddingLeft, paddingRight: paddingRight }, type: type, name: autocomplete !== null && autocomplete !== void 0 ? autocomplete : name, inputMode: type === 'number' ? 'decimal' : undefined, onBlur: onBlur, onChange: function (value) { return onChange(value.target.value); }, placeholder: placeholder, value: value !== null && value !== void 0 ? value : '', disabled: disabled, ref: ref, onWheel: function (e) { return type === 'number' && e.currentTarget.blur(); } }, props);
|
|
46
|
+
return (_jsxs(StyledVerticalStack, __assign({ gap: 1, full: full }, { children: [label && (_jsx("label", __assign({ hidden: hideLabel, className: "text-start ".concat(smallLabel ? 'text-sm' : 'text-base', " font-semibold pl-3 pl- ") + [textColor].join(' ') }, { children: label }))), _jsxs("div", __assign({ className: "relative" }, { children: [prefix && (_jsx("div", __assign({ className: "text-dfxGray-800 absolute ".concat(prefix.length > 0 ? 'left-3' : '', " flex justify-center items-center h-[3.6rem]") }, { children: _jsx("p", { children: prefix }) }))), loading && (_jsx("div", __assign({ className: "absolute right-3 h-w-8 flex justify-center items-center h-[3.6rem]" }, { children: _jsx(StyledLoadingSpinner, {}) }))), buttonLabel && !loading && (_jsx("div", __assign({ className: "text-dfxRed-100 absolute ".concat(buttonLabel.length > 0 ? 'right-3' : '', " flex justify-center items-center h-[3.6rem]") }, { children: _jsx("button", __assign({ type: "button", onClick: buttonClick }, { children: buttonLabel })) }))), multiLine ? (_jsx("textarea", __assign({}, inputProps))) : (_jsx("input", __assign({}, inputProps)))] })), (forceErrorMessage || error) && (_jsx("p", __assign({ className: "text-start text-sm text-dfxRed-100 pl-3" }, { children: forceErrorMessage !== null && forceErrorMessage !== void 0 ? forceErrorMessage : error === null || error === void 0 ? void 0 : error.message })))] })));
|
|
46
47
|
}, name: name, rules: rules }));
|
|
47
48
|
});
|
|
48
49
|
export default StyledInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledInput.js","sourceRoot":"","sources":["../../../src/stories/form/StyledInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"StyledInput.js","sourceRoot":"","sources":["../../../src/stories/form/StyledInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAqC,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,mBAAmB,MAAM,uCAAuC,CAAC;AAExE,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAoB3D,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I,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,GACZ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@dfx.swiss/react-components",
|
|
4
|
-
"version": "1.3.0-beta.
|
|
4
|
+
"version": "1.3.0-beta.9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"tailwindcss": "^3.2.4",
|
|
89
89
|
"webpack": "^5.75.0"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "e2dc528aa1af4e942fc7b881ee6944099030eed6"
|
|
92
92
|
}
|