oolib 2.177.1 → 2.177.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/stories/v2/components/RadioButton.stories.d.ts +4 -1
- package/dist/stories/v2/components/RadioButton.stories.js +3 -2
- package/dist/utils/comps/DisplayIcon/index.d.ts +3 -1
- package/dist/utils/comps/DisplayIcon/index.js +14 -2
- package/dist/v2/components/BlockLabel/index.js +17 -5
- package/dist/v2/components/BlockLabel/index.styled.js +1 -6
- package/dist/v2/components/Hints/comps/HintsButton.js +1 -1
- package/dist/v2/components/InlineAlert/index.js +2 -2
- package/dist/v2/components/RadioAndCheckbox/comps/CheckboxList/index.js +2 -1
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +3 -3
- package/dist/v2/components/RadioAndCheckbox/comps/RadioList/index.js +2 -1
- package/dist/v2/components/TextInputs/index.js +11 -7
- package/dist/v2/components/TextInputs/index.styled.js +2 -2
- package/package.json +1 -1
|
@@ -8,6 +8,8 @@ export namespace RadioList {
|
|
|
8
8
|
let size: string;
|
|
9
9
|
let listingStyle: string;
|
|
10
10
|
let optionsLimit: number;
|
|
11
|
+
let label: string;
|
|
12
|
+
let sublabel: string;
|
|
11
13
|
let option1: string;
|
|
12
14
|
let option2: string;
|
|
13
15
|
let option3: string;
|
|
@@ -170,7 +172,8 @@ export namespace RadioInput {
|
|
|
170
172
|
export { disabled_2 as disabled };
|
|
171
173
|
let invert_2: boolean;
|
|
172
174
|
export { invert_2 as invert };
|
|
173
|
-
|
|
175
|
+
let label_1: string;
|
|
176
|
+
export { label_1 as label };
|
|
174
177
|
}
|
|
175
178
|
export { args_1 as args };
|
|
176
179
|
export namespace argTypes_1 {
|
|
@@ -63,7 +63,7 @@ var RadioList = function (args) {
|
|
|
63
63
|
}
|
|
64
64
|
}, [args.markOptions, args.corrrectOption]);
|
|
65
65
|
return (React.createElement("div", { style: { backgroundColor: args.invert && greyColor100, padding: "4rem" } },
|
|
66
|
-
React.createElement(RadioAndCheckbox_1.RadioList, { options: options, readOnly: args.readOnly, value: chosenOption, onChange: function (id, val) { return setChosenOption(val); }, rightWrongResult: args.markOptions, label: args.label, listType: args.listingStyle, injectOtherOption: args.addOther, disabled: args.disabled, invert: args.invert, S: args.size == "S", commonIsCorrectDesc: args.feedbackMessage, optionsLimit: args.optionsLimit, saveValueAsString: args.saveValueAsString }),
|
|
66
|
+
React.createElement(RadioAndCheckbox_1.RadioList, { options: options, readOnly: args.readOnly, value: chosenOption, onChange: function (id, val) { return setChosenOption(val); }, rightWrongResult: args.markOptions, label: args.label, sublabel: args.sublabel, listType: args.listingStyle, injectOtherOption: args.addOther, disabled: args.disabled, invert: args.invert, S: args.size == "S", commonIsCorrectDesc: args.feedbackMessage, optionsLimit: args.optionsLimit, saveValueAsString: args.saveValueAsString }),
|
|
67
67
|
React.createElement("br", null),
|
|
68
68
|
" ",
|
|
69
69
|
React.createElement(Divider_1.Divider, null),
|
|
@@ -80,7 +80,8 @@ exports.RadioList.args = {
|
|
|
80
80
|
size: "Medium",
|
|
81
81
|
listingStyle: "horizontal",
|
|
82
82
|
optionsLimit: ops.length,
|
|
83
|
-
|
|
83
|
+
label: 'Please choose an option, this is a test.',
|
|
84
|
+
sublabel: 'Some supplimentary text to better explain the label',
|
|
84
85
|
option1: ops[0].display,
|
|
85
86
|
option2: ops[1].display,
|
|
86
87
|
option3: ops[2].display,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, MouseEvent } from "react";
|
|
1
|
+
import { FunctionComponent, MouseEvent, CSSProperties } from "react";
|
|
2
2
|
import { icons } from "../../../icons";
|
|
3
3
|
export interface DisplayIconProps {
|
|
4
4
|
icon: keyof typeof icons;
|
|
@@ -6,6 +6,7 @@ export interface DisplayIconProps {
|
|
|
6
6
|
color: string;
|
|
7
7
|
weight?: "bold" | "regular";
|
|
8
8
|
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
style?: CSSProperties;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* @component Renders an icon component with customizable size, color, weight, and click handler.
|
|
@@ -16,6 +17,7 @@ export interface DisplayIconProps {
|
|
|
16
17
|
* @prop {string} color: The color of the icon.
|
|
17
18
|
* @prop {'bold' | 'regular'} weight: The weight of the icon font. Defaults to "bold".
|
|
18
19
|
* @prop {function} onClick: Optional click handler for the icon.
|
|
20
|
+
* @prop {CSSProperties} style: Optional additional styles to apply to the container div.
|
|
19
21
|
* @return {ReactElement} The rendered icon component.
|
|
20
22
|
*/
|
|
21
23
|
declare const DisplayIcon: FunctionComponent<DisplayIconProps>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -16,11 +27,12 @@ var themes_1 = require("../../../v2/themes");
|
|
|
16
27
|
* @prop {string} color: The color of the icon.
|
|
17
28
|
* @prop {'bold' | 'regular'} weight: The weight of the icon font. Defaults to "bold".
|
|
18
29
|
* @prop {function} onClick: Optional click handler for the icon.
|
|
30
|
+
* @prop {CSSProperties} style: Optional additional styles to apply to the container div.
|
|
19
31
|
* @return {ReactElement} The rendered icon component.
|
|
20
32
|
*/
|
|
21
33
|
var DisplayIcon = function (_a) {
|
|
22
|
-
var icon = _a.icon, size = _a.size, _b = _a.color, color = _b === void 0 ? themes_1.colors.grey80 : _b, _c = _a.weight, weight = _c === void 0 ? "bold" : _c, onClick = _a.onClick;
|
|
34
|
+
var icon = _a.icon, size = _a.size, _b = _a.color, color = _b === void 0 ? themes_1.colors.grey80 : _b, _c = _a.weight, weight = _c === void 0 ? "bold" : _c, onClick = _a.onClick, _d = _a.style, style = _d === void 0 ? {} : _d;
|
|
23
35
|
var IconComp = icons_1.icons[icon];
|
|
24
|
-
return (react_1.default.createElement("div", { style: { cursor: onClick ? "pointer" : "default", display: "flex" }, onMouseDown: onClick || undefined }, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: weight })));
|
|
36
|
+
return (react_1.default.createElement("div", { style: __assign({ cursor: onClick ? "pointer" : "default", display: "flex" }, style), onMouseDown: onClick || undefined }, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: weight })));
|
|
25
37
|
};
|
|
26
38
|
exports.DisplayIcon = DisplayIcon;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -47,7 +58,8 @@ var Typo2_1 = require("../Typo2");
|
|
|
47
58
|
var colors_1 = require("../../themes/colors");
|
|
48
59
|
var grey40 = colors_1.colors.grey40, grey60 = colors_1.colors.grey60;
|
|
49
60
|
var BlockLabel = function (props) {
|
|
50
|
-
var label = props.label, sublabel = props.sublabel, inputOnlyLabel = props.inputOnlyLabel, invert = props.invert, isRequired = props.isRequired, readOnly = props.readOnly, className = props.className,
|
|
61
|
+
var label = props.label, sublabel = props.sublabel, inputOnlyLabel = props.inputOnlyLabel, invert = props.invert, isRequired = props.isRequired, readOnly = props.readOnly, className = props.className, _a = props.style, style = _a === void 0 ? {} : _a, marginBottom = props.marginBottom, // some comps like radiolist and checkboxlist need a bit more marginbottom, so they control it themselves
|
|
62
|
+
errorMsgs = props.errorMsgs, hints = props.hints, id = props.id, hintsTitle = props.hintsTitle, hintsBtnLabel = props.hintsBtnLabel, hintsSubtitle = props.hintsSubtitle, hideOptionalLabel = props.hideOptionalLabel, infoTooltip = props.infoTooltip, disabled = props.disabled, S = props.S;
|
|
51
63
|
var shouldCompRender = label ||
|
|
52
64
|
(!readOnly &&
|
|
53
65
|
(sublabel ||
|
|
@@ -61,15 +73,15 @@ var BlockLabel = function (props) {
|
|
|
61
73
|
var errType = (errorMsgs === null || errorMsgs === void 0 ? void 0 : errorMsgs.length) !== 1 //this first condition seems like a proper hack..
|
|
62
74
|
? "danger"
|
|
63
75
|
: errorMsgs[0].type || "danger";
|
|
64
|
-
return (shouldCompRender && (react_1.default.createElement(index_styled_1.StyledBlockLabel, { style: style, className: className, id: "tempBlocklabelOverride", sublabel: sublabel, S: S },
|
|
76
|
+
return (shouldCompRender && (react_1.default.createElement(index_styled_1.StyledBlockLabel, { style: __assign(__assign({}, style), { marginBottom: (marginBottom || (sublabel ? '0.6rem' : '0.4rem')) }), className: className, id: "tempBlocklabelOverride", sublabel: sublabel, S: S },
|
|
65
77
|
react_1.default.createElement("div", { style: { display: "flex", gap: "0.4rem" } },
|
|
66
|
-
(label || inputOnlyLabel) && (react_1.default.createElement(Typo2_1.
|
|
78
|
+
(label || inputOnlyLabel) && (react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { color: disabled ? colors_1.colors.grey40 : colors_1.colors.grey80, semibold: true }, label || inputOnlyLabel)),
|
|
67
79
|
!readOnly && (errorMsgs === null || errorMsgs === void 0 ? void 0 : errorMsgs.length) > 0 ? (react_1.default.createElement(InlineAlert_1.InlineAlert, { text: errText, type: errType, link: errLink, invert: invert })) : null,
|
|
68
|
-
optional && !hideOptionalLabel && (react_1.default.createElement(Typo2_1.
|
|
80
|
+
optional && !hideOptionalLabel && (react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { color: disabled ? colors_1.colors.grey20 : colors_1.colors.grey40 }, "(optional)")),
|
|
69
81
|
!readOnly && hints ? (react_1.default.createElement(Hints_1.default, { id: id, title: hintsTitle, btnlabel: hintsBtnLabel, subtitle: hintsSubtitle, hints: hints, disabled: disabled })) : null,
|
|
70
82
|
infoTooltip && (react_1.default.createElement(Tooltip_1.Tooltip, { text: infoTooltip.text || infoTooltip, position: infoTooltip.position || "right", invert: invert, debug: infoTooltip.debug, popOutOfOverflowHiddenParent: infoTooltip.popOutOfOverflowHiddenParent, presetTarget: "infoIcon" }))),
|
|
71
83
|
!readOnly &&
|
|
72
84
|
sublabel &&
|
|
73
|
-
(0, toArray_1.toArray)(sublabel).map(function (subL, i) { return (react_1.default.createElement(Typo2_1.
|
|
85
|
+
(0, toArray_1.toArray)(sublabel).map(function (subL, i) { return (react_1.default.createElement(Typo2_1.UI_CAPTION_DF, { key: i, color: disabled ? colors_1.colors.grey40 : grey60 }, subL)); }))));
|
|
74
86
|
};
|
|
75
87
|
exports.BlockLabel = BlockLabel;
|
|
@@ -9,11 +9,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StyledInfoTooltipbutton = exports.StyledBlockLabel = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
exports.StyledBlockLabel = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n
|
|
13
|
-
var sublabel = _a.sublabel, S = _a.S;
|
|
14
|
-
return S
|
|
15
|
-
? (sublabel ? '0.4rem' : '0.2rem')
|
|
16
|
-
: (sublabel ? '0.6rem' : '0.4rem');
|
|
17
|
-
});
|
|
12
|
+
exports.StyledBlockLabel = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n position: relative;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 0.2rem;\n position: relative;\n"])));
|
|
18
13
|
exports.StyledInfoTooltipbutton = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: none;\n background: none;\n outline: none;\n"], ["\n border: none;\n background: none;\n outline: none;\n"])));
|
|
19
14
|
var templateObject_1, templateObject_2;
|
|
@@ -18,7 +18,7 @@ var HintsButton = function (_a) {
|
|
|
18
18
|
var id = _a.id, btnLabel = _a.btnLabel, onClick = _a.onClick;
|
|
19
19
|
return (react_1.default.createElement(StyledButton, { onClick: function () { return onClick(id); } },
|
|
20
20
|
react_1.default.createElement(phosphor_react_1.Lightbulb, { size: 13, weight: "bold", style: { marginBottom: "0.2rem" } }),
|
|
21
|
-
react_1.default.createElement(Typo2_1.
|
|
21
|
+
react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, null, btnLabel)));
|
|
22
22
|
};
|
|
23
23
|
exports.HintsButton = HintsButton;
|
|
24
24
|
var StyledButton = styled_components_1.default.button(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: none;\n background: none;\n outline: none;\n cursor: pointer;\n padding: 0;\n margin: 0;\n border-radius: 0.4rem;\n\n display: flex;\n line-height: 100%;\n padding: 0.1rem 0.3rem 0rem 0.3rem;\n align-items: center;\n\n gap: 0.2rem;\n color: ", ";\n\n\n &:hover {\n background-color: ", ";\n /* color: ", "; */\n }\n\n &:active {\n background-color: ", ";\n color: white;\n }\n\n"], ["\n border: none;\n background: none;\n outline: none;\n cursor: pointer;\n padding: 0;\n margin: 0;\n border-radius: 0.4rem;\n\n display: flex;\n line-height: 100%;\n padding: 0.1rem 0.3rem 0rem 0.3rem;\n align-items: center;\n\n gap: 0.2rem;\n color: ", ";\n\n\n &:hover {\n background-color: ", ";\n /* color: ", "; */\n }\n\n &:active {\n background-color: ", ";\n color: white;\n }\n\n"])), hint, hintHover, white, hint);
|
|
@@ -44,8 +44,8 @@ var InlineAlert = function (_a) {
|
|
|
44
44
|
neutralInactive: { normal: grey70 },
|
|
45
45
|
};
|
|
46
46
|
return (react_1.default.createElement("h5", { style: __assign({ display: 'flex', alignItems: 'center' }, style) },
|
|
47
|
-
react_1.default.createElement("span", { className: '
|
|
48
|
-
link && (react_1.default.createElement("a", { className: '
|
|
47
|
+
react_1.default.createElement("span", { className: 'UI_BODY_SM_DF', style: { color: typeColor[type][invert ? 'invert' : 'normal'], marginBottom: '0.1rem' } }, localize(text)),
|
|
48
|
+
link && (react_1.default.createElement("a", { className: 'UI_BODY_SM_DF', style: {
|
|
49
49
|
// paddingLeft: '1rem',
|
|
50
50
|
textDecoration: 'underline',
|
|
51
51
|
color: invert ? white : black,
|
|
@@ -98,8 +98,9 @@ function CheckboxList(_a) {
|
|
|
98
98
|
onClick: handleCheckboxClick,
|
|
99
99
|
};
|
|
100
100
|
var OptionsContainer = optionsContainers[inputStyle];
|
|
101
|
+
var blocklabelProps = (0, _EXPORTS_1.getBlockLabelProps)(props);
|
|
101
102
|
return (react_1.default.createElement("div", { className: className, id: id },
|
|
102
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0
|
|
103
|
+
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, blocklabelProps, { marginBottom: (blocklabelProps === null || blocklabelProps === void 0 ? void 0 : blocklabelProps.sublabel) ? '1.4rem' : '1.2rem' })),
|
|
103
104
|
readOnly ? (react_1.default.createElement(styled_2.StyledDisplayTagsContainer, null, value === null || value === void 0 ? void 0 : value.map(function (selOp) { return react_1.default.createElement(Tags_1.TagDisplay, { key: selOp.value, invert: invert, display: selOp.display_desc || selOp.display }); }))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
104
105
|
react_1.default.createElement(OptionsContainer, { style: style, listType: listType, S: S }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
105
106
|
typicalOptions.map(function (option, idx) { return idx < optionsLimit && (react_1.default.createElement(CheckboxInput_1.CheckboxInput, __assign({}, InputCommonProps, { option: option, key: option.value }))); }),
|
|
@@ -7,12 +7,12 @@ exports.RadioInput = exports.RadioButton = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var themes_1 = require("../../../../../../themes");
|
|
9
9
|
var icons_1 = require("../../../../../../../icons");
|
|
10
|
-
var Typo_1 = require("../../../../../../../components/Typo");
|
|
11
10
|
var utils_1 = require("../../../../utils");
|
|
12
11
|
var styled_1 = require("../../../../styled");
|
|
13
12
|
var styled_2 = require("./styled");
|
|
14
13
|
var Typo2_1 = require("../../../../../Typo2");
|
|
15
|
-
var
|
|
14
|
+
var __1 = require("../../../../../../..");
|
|
15
|
+
var invertGreen = themes_1.colors.invertGreen, red = themes_1.colors.red, green = themes_1.colors.green, invertRed = themes_1.colors.invertRed;
|
|
16
16
|
var XCircle = icons_1.icons.XCircle, CheckCircle = icons_1.icons.CheckCircle;
|
|
17
17
|
var RadioButton = function (_a) {
|
|
18
18
|
var isSelected = _a.isSelected, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, S = _a.S, readOnly = _a.readOnly, className = _a.className;
|
|
@@ -46,6 +46,6 @@ var RadioInput = function (_a) {
|
|
|
46
46
|
: genRadioButton({ disabled: true }) //else rightWrongResult has come in, but this doesnt have to be marked right or wrong
|
|
47
47
|
: genRadioButton() // rightWrongResult as not come in. so gen normal radio button
|
|
48
48
|
,
|
|
49
|
-
react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { bold: rightWrongResult && isSelected, color: disabled
|
|
49
|
+
react_1.default.createElement(Typo2_1.UI_BODY_SM_DF, { bold: rightWrongResult && isSelected, color: disabled ? __1.colors2.grey40 : __1.colors2.grey80, invert: invert }, option.display)));
|
|
50
50
|
};
|
|
51
51
|
exports.RadioInput = RadioInput;
|
|
@@ -82,8 +82,9 @@ function RadioList(_a) {
|
|
|
82
82
|
rightWrongResult: rightWrongResult,
|
|
83
83
|
onClick: handleInputClick,
|
|
84
84
|
};
|
|
85
|
+
var blocklabelProps = (0, _EXPORTS_1.getBlockLabelProps)(props);
|
|
85
86
|
return (react_1.default.createElement("div", { id: id },
|
|
86
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0
|
|
87
|
+
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, blocklabelProps, { marginBottom: (blocklabelProps === null || blocklabelProps === void 0 ? void 0 : blocklabelProps.sublabel) ? '1.4rem' : '1.2rem' })),
|
|
87
88
|
readOnly ? ((value === null || value === void 0 ? void 0 : value.display) && react_1.default.createElement(Tags_1.TagDisplay, { display: value.display_desc || value.display, invert: invert }) //prioritzing display_desc since display of 'other' option is === other
|
|
88
89
|
) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
90
|
react_1.default.createElement(styled_1.StyledOptionsContainer, { listType: listType, S: S }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
@@ -105,6 +105,7 @@ var PhoneInput_1 = require("./derivedComps/PhoneInput");
|
|
|
105
105
|
Object.defineProperty(exports, "PhoneInput", { enumerable: true, get: function () { return PhoneInput_1.PhoneInput; } });
|
|
106
106
|
var icons_1 = require("../../../icons");
|
|
107
107
|
var Buttons_1 = require("../Buttons");
|
|
108
|
+
var mixins_1 = require("../../../themes/mixins");
|
|
108
109
|
var BadgeVetted = icons_1.icons.BadgeVetted;
|
|
109
110
|
function TextInput(_a) {
|
|
110
111
|
var _this = this;
|
|
@@ -119,9 +120,12 @@ function TextInput(_a) {
|
|
|
119
120
|
(0, react_1.useEffect)(function () {
|
|
120
121
|
setValidationStatus(_validationStatus);
|
|
121
122
|
}, [_validationStatus]);
|
|
123
|
+
var screenWidth = (0, _EXPORTS_1.useScreenWidth)();
|
|
122
124
|
var actionBtnEnabaled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
|
|
123
125
|
var clearBtnEnabled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
|
|
124
|
-
var size = S
|
|
126
|
+
var size = S
|
|
127
|
+
? (screenWidth >= (0, mixins_1.getBreakPoint)('md') ? "S" : "M") //wat this basically means is, a defined 'small' text input will dynamically become 'medium' when on mobile, which is in sync with the pattern of the rest of our components
|
|
128
|
+
: "M";
|
|
125
129
|
var handleValidate = function (e, onBlur) { return __awaiter(_this, void 0, void 0, function () {
|
|
126
130
|
var value, res, validationPlugin, pluginResponse;
|
|
127
131
|
return __generator(this, function (_a) {
|
|
@@ -193,14 +197,14 @@ function TextInput(_a) {
|
|
|
193
197
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
194
198
|
readOnly ? (react_1.default.createElement(Typo2_1.UI_BODY_SM, null, type === "password" ? "********" : value)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
195
199
|
react_1.default.createElement(index_styled_1.InputContainerStyled, { type: type, disabled: disabled, iconAfter: iconAfter, onClick: function () { return inputRef.current.focus(); }, size: size },
|
|
196
|
-
icon && (react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: icon, color: disabled ? themes_1.colors.grey40 : themes_1.colors.grey80, size:
|
|
197
|
-
react_1.default.createElement(index_styled_1.InputStyled, { ref: inputRef, className: "
|
|
198
|
-
validationStatus === "loading" && (react_1.default.createElement("div",
|
|
200
|
+
icon && (react_1.default.createElement(DisplayIcon_1.DisplayIcon, { icon: icon, color: disabled ? themes_1.colors.grey40 : themes_1.colors.grey80, size: screenWidth >= (0, mixins_1.getBreakPoint)('md') ? 16 : 18, onClick: !disabled ? iconOnClick || null : undefined, style: { zIndex: 1 } /** so that it stays ahead of the before element inside InputContainerStyled */ })),
|
|
201
|
+
react_1.default.createElement(index_styled_1.InputStyled, { ref: inputRef, className: "UI_BODY_SM_DF", id: id, type: type, name: type, disabled: disabled, placeholder: localize(placeholder), value: value, onChange: handleOnChange, maxLength: maxLength || DEPRECATED_maxNumLimiter, onBlur: validateOnlyOnBlur ? function (e) { return handleValidate(e, onBlur); } : onBlur, size: size, onFocus: onFocus, autoComplete: "off" }),
|
|
202
|
+
validationStatus === "loading" && (react_1.default.createElement("div", { style: { zIndex: 1 } /** so that it stays ahead of the before element inside InputContainerStyled */ },
|
|
199
203
|
react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true }))),
|
|
200
|
-
(validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success" && (react_1.default.createElement("div",
|
|
204
|
+
(validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success" && (react_1.default.createElement("div", { style: { zIndex: 1 } /** so that it stays ahead of the before element inside InputContainerStyled */ },
|
|
201
205
|
react_1.default.createElement(BadgeVetted, { size: 26 }))),
|
|
202
|
-
(clearBtn && clearBtnEnabled) && (react_1.default.createElement(Buttons_1.ButtonSecondaryCompact, { onClick: function () { return onChange(id, ""); }, value: (clearBtn === null || clearBtn === void 0 ? void 0 : clearBtn.text) || "Clear", disabled: !clearBtnEnabled, style: { marginRight: size === "S" ? '-0.4rem' : '-0.2rem' } })),
|
|
203
|
-
actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimaryCompact, { value: (actionBtn === null || actionBtn === void 0 ? void 0 : actionBtn.text) || "Action", onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: size === "S" ? '-0.4rem' : '-0.2rem' } }))),
|
|
206
|
+
(clearBtn && clearBtnEnabled) && (react_1.default.createElement(Buttons_1.ButtonSecondaryCompact, { onClick: function () { return onChange(id, ""); }, value: (clearBtn === null || clearBtn === void 0 ? void 0 : clearBtn.text) || "Clear", disabled: !clearBtnEnabled, style: { marginRight: size === "S" ? '-0.4rem' : '-0.2rem', zIndex: 1 } /** so that it stays ahead of the before element inside InputContainerStyled */ })),
|
|
207
|
+
actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimaryCompact, { value: (actionBtn === null || actionBtn === void 0 ? void 0 : actionBtn.text) || "Action", onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: size === "S" ? '-0.4rem' : '-0.2rem', zIndex: 1 } /** so that it stays ahead of the before element inside InputContainerStyled */ }))),
|
|
204
208
|
displayValidationMsg && (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.msg) && (react_1.default.createElement(index_styled_1.MsgContainerStyled, { status: validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type },
|
|
205
209
|
(validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "error" && (react_1.default.createElement(DisplayIcon_1.DisplayIcon, { size: 12, icon: "WarningDiamond", weight: "fill", color: themes_1.colors.error })),
|
|
206
210
|
react_1.default.createElement(Typo2_1.UI_HELPTEXT, null,
|
|
@@ -48,7 +48,7 @@ exports.MsgContainerStyled = styled_components_1.default.div(templateObject_2 ||
|
|
|
48
48
|
var status = _a.status;
|
|
49
49
|
return status && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), getColorValue(status));
|
|
50
50
|
});
|
|
51
|
-
exports.InputContainerStyled = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n ", ";\n\n position: relative;\n &::before {\n content: \"\";\n background-color: ", ";\n position: absolute;\n z-index:
|
|
51
|
+
exports.InputContainerStyled = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n ", ";\n\n position: relative;\n &::before {\n content: \"\";\n background-color: ", ";\n position: absolute;\n z-index: 0;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 6px;\n }\n\n color: ", ";\n display: flex;\n align-items: center;\n gap: 6px; // gap between icon and text\n\n ", "\n ", "\n\n ", ";\n ", ";\n"], ["\n ", "\n ", ";\n\n position: relative;\n &::before {\n content: \"\";\n background-color: ", ";\n position: absolute;\n z-index: 0;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 6px;\n }\n\n color: ", ";\n display: flex;\n align-items: center;\n gap: 6px; // gap between icon and text\n\n ", "\n ", "\n\n ", ";\n ", ";\n"])), globalStyles_1.globalInputElemPadding_v2, function (_a) {
|
|
52
52
|
var iconAfter = _a.iconAfter;
|
|
53
53
|
return iconAfter && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row-reverse;\n justify-content: space-between;\n "], ["\n flex-direction: row-reverse;\n justify-content: space-between;\n "])));
|
|
54
54
|
}, themes_1.colors.white, themes_1.colors.grey10, themes_1.colors.grey80, function (_a) {
|
|
@@ -64,7 +64,7 @@ exports.InputContainerStyled = styled_components_1.default.div(templateObject_6
|
|
|
64
64
|
var readOnly = _a.readOnly;
|
|
65
65
|
return readOnly && (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
66
66
|
});
|
|
67
|
-
exports.InputStyled = styled_components_1.default.input(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"], ["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"])), function (_a) {
|
|
67
|
+
exports.InputStyled = styled_components_1.default.input(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n z-index: 1; //so that it stays ahead of the before element behind it\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"], ["\n height: ", ";\n border: none;\n outline: none;\n flex-grow: 1;\n z-index: 1; //so that it stays ahead of the before element behind it\n background: transparent;\n color: inherit;\n\n &:-webkit-autofill {\n transition-delay: 9999s;\n }\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n"])), function (_a) {
|
|
68
68
|
var size = _a.size;
|
|
69
69
|
return size === "S" ? "36px" : "46px";
|
|
70
70
|
}, function (_a) {
|