oolib 2.21.3 → 2.22.0
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/ActionMenu/index.js +4 -0
- package/dist/components/Buttons/index.js +2 -2
- package/dist/components/LoadersAndProgress/{CircleLoader → LoaderCircle}/index.d.ts +1 -1
- package/dist/components/LoadersAndProgress/{CircleLoader → LoaderCircle}/index.js +3 -3
- package/dist/components/LoadersAndProgress/index.d.ts +1 -1
- package/dist/components/LoadersAndProgress/index.js +3 -3
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +2 -3
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +6 -13
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/styled.js +7 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +2 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +40 -29
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +2 -3
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +5 -5
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +14 -2
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +3 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +34 -24
- package/dist/components/RadioAndCheckbox/styled.d.ts +1 -0
- package/dist/components/RadioAndCheckbox/styled.js +16 -6
- package/dist/components/RadioAndCheckbox/utils.d.ts +9 -0
- package/dist/components/RadioAndCheckbox/utils.js +21 -1
- package/dist/components/TextInputs/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/utils/genValueFromDisplay.js +1 -1
- package/package.json +1 -1
|
@@ -61,6 +61,10 @@ var ActionMenu = function (_a) {
|
|
|
61
61
|
(0, react_1.useEffect)(function () {
|
|
62
62
|
setShowActionsInParent && setShowActionsInParent(showActions);
|
|
63
63
|
}, [showActions]);
|
|
64
|
+
//on unmount, setShowActionsInParent to false, obviously.
|
|
65
|
+
(0, react_1.useEffect)(function () {
|
|
66
|
+
return function () { return setShowActionsInParent(false); };
|
|
67
|
+
}, []);
|
|
64
68
|
return (react_1.default.createElement(styled_1.StyledActionMenu, { ref: actionMenuRef },
|
|
65
69
|
react_1.default.createElement(ButtonComp, { icon: icon, iconSize: iconSize, invert: invert, stopPropagation: true, onClick: function (e) {
|
|
66
70
|
setShowActions(!showActions);
|
|
@@ -42,9 +42,9 @@ var lodash_1 = require("lodash");
|
|
|
42
42
|
var Typo_1 = require("../Typo");
|
|
43
43
|
var icons_1 = require("../../icons");
|
|
44
44
|
var DisplayIcon = function (_a) {
|
|
45
|
-
var icon = _a.icon, size = _a.size;
|
|
45
|
+
var icon = _a.icon, size = _a.size, color = _a.color;
|
|
46
46
|
var IconComp = icons_1.icons[icon];
|
|
47
|
-
return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: size, weight: "bold" }));
|
|
47
|
+
return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: size, color: color, weight: "bold" }));
|
|
48
48
|
};
|
|
49
49
|
var ButtonStyledWrapper = function (_a) {
|
|
50
50
|
var props = _a.props, variant = _a.variant;
|
|
@@ -25,18 +25,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
28
|
+
exports.LoaderCircle = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
30
|
var styled_components_1 = require("styled-components");
|
|
31
31
|
var utils_1 = require("../utils");
|
|
32
32
|
var styled_1 = require("../styled");
|
|
33
|
-
function
|
|
33
|
+
function LoaderCircle(_a) {
|
|
34
34
|
var _b = _a.isBlock, isBlock = _b === void 0 ? true : _b, _c = _a.blockHeight, blockHeight = _c === void 0 ? '100%' : _c, L = _a.L, S = _a.S, M = _a.M, props = __rest(_a, ["isBlock", "blockHeight", "L", "S", "M"]);
|
|
35
35
|
var size = L ? 'L' : S ? 'S' : 'M'; //defaults to M if no L or S, so techinically, the M prop isnt really required..
|
|
36
36
|
var renderLoaderDiv = function () { return react_1.default.createElement(LoaderDiv, __assign({}, __assign(__assign({}, props), { isBlock: isBlock, size: size }))); };
|
|
37
37
|
return !isBlock ? (renderLoaderDiv()) : (react_1.default.createElement(styled_1.StyledLoaderOverlay, { blockHeight: blockHeight }, renderLoaderDiv()));
|
|
38
38
|
}
|
|
39
|
-
exports.
|
|
39
|
+
exports.LoaderCircle = LoaderCircle;
|
|
40
40
|
var LoaderDiv = function (_a) {
|
|
41
41
|
var size = _a.size, children = _a.children, _text = _a.text, debug = _a.debug, invert = _a.invert, isBlock = _a.isBlock;
|
|
42
42
|
var theme = (0, styled_components_1.useTheme)();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ProgressBar } from "./ProgressBar";
|
|
2
|
-
export {
|
|
2
|
+
export { LoaderCircle } from "./LoaderCircle";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LoaderCircle = exports.ProgressBar = void 0;
|
|
4
4
|
var ProgressBar_1 = require("./ProgressBar");
|
|
5
5
|
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return ProgressBar_1.ProgressBar; } });
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
6
|
+
var LoaderCircle_1 = require("./LoaderCircle");
|
|
7
|
+
Object.defineProperty(exports, "LoaderCircle", { enumerable: true, get: function () { return LoaderCircle_1.LoaderCircle; } });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export function CheckboxInput({ option,
|
|
1
|
+
export function CheckboxInput({ option, onClick, S, value, invert, disabled, rightWrongResult, }: {
|
|
2
2
|
option: any;
|
|
3
|
-
|
|
4
|
-
onChange: any;
|
|
3
|
+
onClick: any;
|
|
5
4
|
S: any;
|
|
6
5
|
value: any;
|
|
7
6
|
invert: any;
|
|
@@ -25,28 +25,21 @@ var styled_2 = require("./styled");
|
|
|
25
25
|
var Check = icons_1.icons.Check, CheckSquare = icons_1.icons.CheckSquare, XSquare = icons_1.icons.XSquare;
|
|
26
26
|
var white = themes_1.colors.white, green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
|
|
27
27
|
var CheckboxInput = function (_a) {
|
|
28
|
-
var option = _a.option,
|
|
29
|
-
var isSelected =
|
|
28
|
+
var option = _a.option, onClick = _a.onClick, S = _a.S, value = _a.value, invert = _a.invert, disabled = _a.disabled, rightWrongResult = _a.rightWrongResult;
|
|
29
|
+
var isSelected = value.find(function (selOp) { return selOp.value === option.value; });
|
|
30
30
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
31
|
-
var handleCheckboxClick = function () {
|
|
32
|
-
if (!rightWrongResult) { // no toggling if users are being informed of thier choices result
|
|
33
|
-
onChange(id, isSelected ?
|
|
34
|
-
value.filter(function (selOp) { return selOp.value !== option.value; })
|
|
35
|
-
: value.concat(option));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
31
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
39
|
-
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert }, { onClick:
|
|
32
|
+
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && onClick(option, isSelected); } }),
|
|
40
33
|
!rightWrongResult || markingCommand === undefined ?
|
|
41
|
-
react_1.default.createElement(styled_2.StyledCheckbox, __assign({ className: "btn" }, { isSelected: isSelected, disabled: disabled, invert: invert }), isSelected && react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16 }))
|
|
34
|
+
react_1.default.createElement(styled_2.StyledCheckbox, __assign({ className: "btn" }, { isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(Check, { weight: "bold", color: invert ? greyColor100 : white, size: 16 }))
|
|
42
35
|
:
|
|
43
36
|
["markCorrect", "revealCorrect"].includes(markingCommand) ?
|
|
44
|
-
react_1.default.createElement(CheckSquare, { size: 26, color: green, style: {
|
|
37
|
+
react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: green, style: {
|
|
45
38
|
margin: '-7px -2.8px -7px -3.2px',
|
|
46
39
|
flexShrink: 0
|
|
47
40
|
} })
|
|
48
41
|
: // then wrong
|
|
49
|
-
react_1.default.createElement(XSquare, { size: 26, color: red, style: {
|
|
42
|
+
react_1.default.createElement(XSquare, { size: S ? 21.5 : 26, color: red, style: {
|
|
50
43
|
margin: '-7px -2.8px -7px -3.2px',
|
|
51
44
|
flexShrink: 0
|
|
52
45
|
} }),
|
|
@@ -33,7 +33,13 @@ var utilsOolib_1 = require("../../../../../../utilsOolib");
|
|
|
33
33
|
var themes_1 = require("../../../../../../themes");
|
|
34
34
|
var mixins_1 = require("../../../../../../themes/mixins");
|
|
35
35
|
var none = themes_1.colors.none, greyColor40 = themes_1.colors.greyColor40;
|
|
36
|
-
exports.StyledCheckbox = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width:
|
|
36
|
+
exports.StyledCheckbox = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"], ["\n \n width: ", ";\n height: ", ";\n border: none;\n box-shadow: inset 0 0 0 2px ", ";\n border-radius: 2px;\n background-color: ", ";\n cursor: inherit;\n\n ", "\n\n\n ", "\n\n"])), function (_a) {
|
|
37
|
+
var S = _a.S;
|
|
38
|
+
return S ? '1.7rem' : '2rem';
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var S = _a.S;
|
|
41
|
+
return S ? '1.7rem' : '2rem';
|
|
42
|
+
}, function (_a) {
|
|
37
43
|
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
38
44
|
return disabled ?
|
|
39
45
|
greyColor40 : invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export function CheckboxList({ id, injectOtherOption, value, onChange, commonIsCorrectDesc, options, optionStyle, rightWrongResult, listType, invert, style, disabled, className, S, readOnly }: {
|
|
1
|
+
export function CheckboxList({ id, injectOtherOption, value: valueProp, onChange, commonIsCorrectDesc, options, saveValueAsString, optionStyle, rightWrongResult, listType, invert, style, disabled, className, S, readOnly }: {
|
|
2
2
|
id: any;
|
|
3
3
|
injectOtherOption?: boolean;
|
|
4
4
|
value?: any[];
|
|
5
5
|
onChange: any;
|
|
6
6
|
commonIsCorrectDesc: any;
|
|
7
7
|
options: any;
|
|
8
|
+
saveValueAsString: any;
|
|
8
9
|
optionStyle: any;
|
|
9
10
|
rightWrongResult: any;
|
|
10
11
|
listType: any;
|
|
@@ -17,46 +17,57 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.CheckboxList = void 0;
|
|
18
18
|
var react_1 = __importDefault(require("react"));
|
|
19
19
|
var BlockLabel_1 = require("../../../BlockLabel");
|
|
20
|
-
var
|
|
20
|
+
var Tags_1 = require("../../../Tags");
|
|
21
21
|
var TextInputs_1 = require("../../../TextInputs");
|
|
22
|
-
|
|
22
|
+
var _EXPORTS_1 = require("../../../../utils/_EXPORTS");
|
|
23
|
+
var utils_1 = require("../../utils");
|
|
23
24
|
var styled_1 = require("../../styled");
|
|
24
|
-
var styled_2 = require("./styled");
|
|
25
25
|
var comps_1 = require("./comps");
|
|
26
|
-
var
|
|
27
|
-
var
|
|
26
|
+
var styled_2 = require("./styled");
|
|
27
|
+
var convToString = function (value) { return value.map(function (v) { var _a; return (_a = v.display_desc) !== null && _a !== void 0 ? _a : v.value; }); };
|
|
28
28
|
function CheckboxList(_a) {
|
|
29
|
-
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, _c = _a.value,
|
|
29
|
+
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, _c = _a.value, valueProp = _c === void 0 ? [] : _c, onChange = _a.onChange, commonIsCorrectDesc = _a.commonIsCorrectDesc, options = _a.options, saveValueAsString = _a.saveValueAsString, optionStyle = _a.optionStyle, rightWrongResult = _a.rightWrongResult, listType = _a.listType, invert = _a.invert, style = _a.style, //where to attatch this
|
|
30
30
|
disabled = _a.disabled, className = _a.className, S = _a.S, readOnly = _a.readOnly;
|
|
31
31
|
var props = arguments[0];
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
var otherOpInSelectees = value.find(function (selectedOp) { return selectedOp.value === 'other'; });
|
|
32
|
+
var _d = (0, utils_1.genDisplayedOptions)({ injectOtherOption: injectOtherOption, options: options, valueProp: valueProp, saveValueAsString: saveValueAsString }), typicalOptions = _d.typicalOptions, otherOption = _d.otherOption;
|
|
33
|
+
var value = saveValueAsString ?
|
|
34
|
+
typicalOptions.concat(otherOption).filter(function (op) { var _a; return valueProp.includes((_a = op.display_desc) !== null && _a !== void 0 ? _a : op.value); })
|
|
35
|
+
: valueProp;
|
|
39
36
|
var handleTextInputChange = function (text) {
|
|
40
|
-
var newValue = value.map(function (selectedOp) { return (selectedOp ===
|
|
37
|
+
var newValue = value.map(function (selectedOp) { return (selectedOp.value === 'other' ? (0, utils_1.genOtherValueObject)(text) : selectedOp); });
|
|
38
|
+
if (saveValueAsString)
|
|
39
|
+
newValue = convToString(newValue);
|
|
41
40
|
onChange && onChange(id, newValue);
|
|
42
41
|
};
|
|
42
|
+
var handleCheckboxClick = function (option, isSelected) {
|
|
43
|
+
var newValue = isSelected
|
|
44
|
+
? value.filter(function (selOp) { return selOp.value !== option.value; })
|
|
45
|
+
: value.concat(option);
|
|
46
|
+
if (saveValueAsString)
|
|
47
|
+
newValue = convToString(newValue);
|
|
48
|
+
onChange(id, newValue);
|
|
49
|
+
};
|
|
50
|
+
var otherOpInSelectees = value.find(function (selectedOp) { return selectedOp.value === 'other'; });
|
|
51
|
+
var InputCommonProps = {
|
|
52
|
+
invert: invert,
|
|
53
|
+
value: value,
|
|
54
|
+
S: S,
|
|
55
|
+
disabled: disabled,
|
|
56
|
+
rightWrongResult: rightWrongResult,
|
|
57
|
+
onClick: handleCheckboxClick,
|
|
58
|
+
};
|
|
43
59
|
return (react_1.default.createElement("div", { className: className, id: id },
|
|
44
60
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
45
|
-
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(
|
|
46
|
-
|
|
47
|
-
option
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
rightWrongResult: rightWrongResult,
|
|
56
|
-
key: option.value
|
|
57
|
-
})); }),
|
|
58
|
-
injectOtherOption && otherOpInSelectees && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, { listType: listType },
|
|
59
|
-
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: otherOpInSelectees.display_desc || '', onChange: function (k, v) { return handleTextInputChange(v); } }, { disabled: disabled, invert: invert, S: S })))),
|
|
61
|
+
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,
|
|
62
|
+
react_1.default.createElement(styled_1.StyledOptionsContainer, { listType: listType }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
63
|
+
typicalOptions.map(function (option) {
|
|
64
|
+
return react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })));
|
|
65
|
+
}),
|
|
66
|
+
injectOtherOption && otherOption && ( //so other box and its textInput act as one entity in the flexbox
|
|
67
|
+
react_1.default.createElement(styled_1.StyledOtherOptionContainer, { listType: listType },
|
|
68
|
+
react_1.default.createElement(comps_1.CheckboxInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: otherOption }))),
|
|
69
|
+
otherOpInSelectees && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, __assign({}, { listType: listType, rightWrongResult: rightWrongResult }),
|
|
70
|
+
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: otherOpInSelectees.display_desc, onChange: function (k, v) { return handleTextInputChange(v); } }, { disabled: disabled, invert: invert, S: S }))))))),
|
|
60
71
|
rightWrongResult && commonIsCorrectDesc &&
|
|
61
72
|
react_1.default.createElement(styled_1.StyledCorrectMessage, null, commonIsCorrectDesc)))));
|
|
62
73
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export function RadioInput({
|
|
2
|
-
id: any;
|
|
1
|
+
export function RadioInput({ option, onClick, disabled, invert, value, S, rightWrongResult, }: {
|
|
3
2
|
option: any;
|
|
4
|
-
|
|
3
|
+
onClick: any;
|
|
5
4
|
disabled: any;
|
|
6
5
|
invert: any;
|
|
7
6
|
value: any;
|
|
@@ -25,21 +25,21 @@ var styled_2 = require("./styled");
|
|
|
25
25
|
var green = themes_1.colors.green, red = themes_1.colors.red, greyColor40 = themes_1.colors.greyColor40;
|
|
26
26
|
var XCircle = icons_1.icons.XCircle, CheckCircle = icons_1.icons.CheckCircle;
|
|
27
27
|
var RadioInput = function (_a) {
|
|
28
|
-
var
|
|
28
|
+
var option = _a.option, onClick = _a.onClick, disabled = _a.disabled, invert = _a.invert, value = _a.value, S = _a.S, rightWrongResult = _a.rightWrongResult;
|
|
29
29
|
var isSelected = option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
30
30
|
var markingCommand = (0, utils_1.getMarkingCommand)({ option: option, isSelected: isSelected }); // returns undefined if option isn't labeled as 'correct' nor selected
|
|
31
31
|
var SuitableTypo = S ? Typo_1.SANS_2 : Typo_1.SANS_3;
|
|
32
|
-
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert }, { onClick: function () { return !rightWrongResult &&
|
|
32
|
+
return (react_1.default.createElement(styled_1.StyledOption, __assign({}, { disabled: disabled, rightWrongResult: rightWrongResult, isSelected: isSelected, invert: invert, S: S }, { onClick: function () { return !rightWrongResult && onClick(option); } }),
|
|
33
33
|
!rightWrongResult || markingCommand === undefined ?
|
|
34
|
-
react_1.default.createElement(styled_2.StyledRadioInput, __assign({ className: 'btn' }, { isSelected: isSelected, disabled: disabled, invert: invert }), isSelected && react_1.default.createElement(styled_2.StyledRadioInputFill, { invert: invert }))
|
|
34
|
+
react_1.default.createElement(styled_2.StyledRadioInput, __assign({ className: 'btn' }, { isSelected: isSelected, disabled: disabled, invert: invert, S: S }), isSelected && react_1.default.createElement(styled_2.StyledRadioInputFill, { invert: invert, S: S }))
|
|
35
35
|
:
|
|
36
36
|
["markCorrect", "revealCorrect"].includes(markingCommand) ?
|
|
37
|
-
react_1.default.createElement(CheckCircle, { size: 24.5, color: green, style: {
|
|
37
|
+
react_1.default.createElement(CheckCircle, { size: S ? 21 : 24.5, color: green, style: {
|
|
38
38
|
margin: '-5px -1.5px -5px -3px',
|
|
39
39
|
flexShrink: 0
|
|
40
40
|
} })
|
|
41
41
|
: // then wrong
|
|
42
|
-
react_1.default.createElement(XCircle, { size: 24.5, color: red, style: {
|
|
42
|
+
react_1.default.createElement(XCircle, { size: S ? 21 : 24.5, color: red, style: {
|
|
43
43
|
margin: '-5px -1.5px -5px -3px',
|
|
44
44
|
flexShrink: 0
|
|
45
45
|
} }),
|
|
@@ -33,7 +33,13 @@ var themes_1 = require("../../../../../../themes");
|
|
|
33
33
|
var mixins_1 = require("../../../../../../themes/mixins");
|
|
34
34
|
var utilsOolib_1 = require("../../../../../../utilsOolib");
|
|
35
35
|
var none = themes_1.colors.none, white = themes_1.colors.white, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100;
|
|
36
|
-
exports.StyledRadioInput = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 50%;\n width:
|
|
36
|
+
exports.StyledRadioInput = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: 50%;\n width: ", ";\n height: ", ";\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n cursor: inherit;\n ", "\n\n ", "\n\n"], ["\n border-radius: 50%;\n width: ", ";\n height: ", ";\n border: 2px solid ", ";\n background-color: ", ";\n flex: 0 0 auto;\n cursor: inherit;\n ", "\n\n ", "\n\n"])), function (_a) {
|
|
37
|
+
var S = _a.S;
|
|
38
|
+
return S ? '1.7rem' : '2rem';
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var S = _a.S;
|
|
41
|
+
return S ? '1.7rem' : '2rem';
|
|
42
|
+
}, function (_a) {
|
|
37
43
|
var colors = _a.theme.colors, disabled = _a.disabled, invert = _a.invert;
|
|
38
44
|
return disabled ? greyColor40 :
|
|
39
45
|
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
@@ -45,7 +51,13 @@ exports.StyledRadioInput = styled_components_1.default.button(templateObject_2 |
|
|
|
45
51
|
invert ? (0, utilsOolib_1.getPrimaryColor40)(colors) : (0, utilsOolib_1.getPrimaryColor100)(colors);
|
|
46
52
|
});
|
|
47
53
|
});
|
|
48
|
-
exports.StyledRadioInputFill = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n
|
|
54
|
+
exports.StyledRadioInputFill = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width:", ";\n height:", ";\n border-radius: 50%;\n background-color: ", ";\n"], ["\n width:", ";\n height:", ";\n border-radius: 50%;\n background-color: ", ";\n"])), function (_a) {
|
|
55
|
+
var S = _a.S;
|
|
56
|
+
return S ? '0.7rem' : '0.8rem';
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var S = _a.S;
|
|
59
|
+
return S ? '0.7rem' : '0.8rem';
|
|
60
|
+
}, function (_a) {
|
|
49
61
|
var invert = _a.invert;
|
|
50
62
|
return invert ? greyColor100 : white;
|
|
51
63
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export function RadioList({ id, injectOtherOption, value, onChange, options, rightWrongResult, listType, disabled, invert, style, className, readOnly, S }: {
|
|
1
|
+
export function RadioList({ id, injectOtherOption, value: valueProp, onChange, saveValueAsString, options, commonIsCorrectDesc, rightWrongResult, listType, disabled, invert, style, className, readOnly, S }: {
|
|
2
2
|
id: any;
|
|
3
3
|
injectOtherOption?: boolean;
|
|
4
4
|
value: any;
|
|
5
5
|
onChange: any;
|
|
6
|
+
saveValueAsString: any;
|
|
6
7
|
options: any;
|
|
8
|
+
commonIsCorrectDesc: any;
|
|
7
9
|
rightWrongResult: any;
|
|
8
10
|
listType: any;
|
|
9
11
|
disabled: any;
|
|
@@ -24,38 +24,48 @@ var styled_1 = require("../../styled");
|
|
|
24
24
|
var utils_1 = require("../../utils");
|
|
25
25
|
var comps_1 = require("./comps");
|
|
26
26
|
function RadioList(_a) {
|
|
27
|
-
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b,
|
|
27
|
+
var id = _a.id, _b = _a.injectOtherOption, injectOtherOption = _b === void 0 ? false : _b, valueProp = _a.value, onChange = _a.onChange, saveValueAsString = _a.saveValueAsString, options = _a.options, commonIsCorrectDesc = _a.commonIsCorrectDesc, rightWrongResult = _a.rightWrongResult, listType = _a.listType, disabled = _a.disabled, invert = _a.invert, style = _a.style, className = _a.className, readOnly = _a.readOnly, S = _a.S;
|
|
28
28
|
var props = arguments[0];
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
var _c = (0, utils_1.genDisplayedOptions)({ injectOtherOption: injectOtherOption, options: options, valueProp: valueProp, saveValueAsString: saveValueAsString }), typicalOptions = _c.typicalOptions, otherOption = _c.otherOption;
|
|
30
|
+
var value = saveValueAsString ?
|
|
31
|
+
typicalOptions.concat(otherOption).find(function (op) { var _a; return ((_a = op.display_desc) !== null && _a !== void 0 ? _a : op.value) === valueProp; })
|
|
32
|
+
: valueProp;
|
|
33
|
+
var correctOp = options.find(function (op) { return op.isCorrect; }); //
|
|
34
|
+
var handleInputClick = function (option) {
|
|
35
|
+
var _a;
|
|
36
|
+
onChange(id, saveValueAsString ? ((_a = option.display_desc) !== null && _a !== void 0 ? _a : option.value) : option);
|
|
37
|
+
};
|
|
38
|
+
var handleTextInputChange = function (text) {
|
|
39
|
+
onChange(id, saveValueAsString ? text : (0, utils_1.genOtherValueObject)(text) //text === display_desc
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
var InputCommonProps = {
|
|
43
|
+
invert: invert,
|
|
44
|
+
value: value,
|
|
45
|
+
S: S,
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
rightWrongResult: rightWrongResult,
|
|
48
|
+
onClick: handleInputClick,
|
|
49
|
+
};
|
|
36
50
|
return (react_1.default.createElement("div", { className: className, id: id },
|
|
37
51
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
38
52
|
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
|
|
39
|
-
) : (react_1.default.createElement(
|
|
40
|
-
|
|
41
|
-
option
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
key: option.value
|
|
50
|
-
})); }),
|
|
51
|
-
injectOtherOption && (value === null || value === void 0 ? void 0 : value.value) === "other" && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, { listType: listType },
|
|
52
|
-
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: value.display_desc || '', onChange: function (k, v) { return onChange(id, (0, utils_1.genOtherValueObject)(v)); } }, { disabled: disabled, invert: invert, S: S })))),
|
|
53
|
+
) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
54
|
+
react_1.default.createElement(styled_1.StyledOptionsContainer, { listType: listType, style: style }, typicalOptions === null || typicalOptions === void 0 ? void 0 :
|
|
55
|
+
typicalOptions.map(function (option) {
|
|
56
|
+
return react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: option, key: option.value })));
|
|
57
|
+
}),
|
|
58
|
+
injectOtherOption && otherOption && ( //so other box and its textInput act as one entity in the flexbox
|
|
59
|
+
react_1.default.createElement(styled_1.StyledOtherOptionContainer, { listType: listType },
|
|
60
|
+
react_1.default.createElement(comps_1.RadioInput, __assign({}, __assign(__assign({}, InputCommonProps), { option: otherOption }))),
|
|
61
|
+
(value === null || value === void 0 ? void 0 : value.value) === "other" && (react_1.default.createElement(styled_1.StyledOtherTextInputWrapper, __assign({}, { listType: listType, rightWrongResult: rightWrongResult }),
|
|
62
|
+
react_1.default.createElement(TextInputs_1.TextInput, __assign({ placeholder: "Please Specify Here", value: value.display_desc, onChange: function (k, v) { return handleTextInputChange(v); } }, { disabled: disabled, invert: invert, S: S }))))))),
|
|
53
63
|
/*
|
|
54
64
|
the minute the results have come in, irrespective of user's answer
|
|
55
65
|
being right or wrong, we always show an explanation
|
|
56
66
|
against the right answer. provided that an explanation is provided.
|
|
57
67
|
*/
|
|
58
|
-
correctOp && rightWrongResult &&
|
|
59
|
-
react_1.default.createElement(styled_1.StyledCorrectMessage, null,
|
|
68
|
+
correctOp && rightWrongResult && commonIsCorrectDesc &&
|
|
69
|
+
react_1.default.createElement(styled_1.StyledCorrectMessage, null, commonIsCorrectDesc)))));
|
|
60
70
|
}
|
|
61
71
|
exports.RadioList = RadioList;
|
|
@@ -27,7 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
return result;
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.StyledCorrectMessage = exports.StyledOtherTextInputWrapper = exports.StyledOption = exports.StyledOptionsContainer = void 0;
|
|
30
|
+
exports.StyledCorrectMessage = exports.StyledOtherTextInputWrapper = exports.StyledOtherOptionContainer = exports.StyledOption = exports.StyledOptionsContainer = void 0;
|
|
31
31
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
32
|
var utilsOolib_1 = require("../../utilsOolib");
|
|
33
33
|
var Typo_1 = require("../Typo");
|
|
@@ -39,7 +39,10 @@ exports.StyledOptionsContainer = styled_components_1.default.div(templateObject_
|
|
|
39
39
|
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: column;\n gap: 1.5rem;\n align-items: initial;\n "], ["\n flex-direction: column;\n gap: 1.5rem;\n align-items: initial;\n "]))) :
|
|
40
40
|
'';
|
|
41
41
|
});
|
|
42
|
-
exports.StyledOption = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap:
|
|
42
|
+
exports.StyledOption = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", ";\n position: relative;\n cursor: ", ";\n \n\n &:hover .btn {\n ", "\n }\n\n"], ["\n display: flex;\n align-items: center;\n gap: ", ";\n position: relative;\n cursor: ", ";\n \n\n &:hover .btn {\n ", "\n }\n\n"])), function (_a) {
|
|
43
|
+
var S = _a.S;
|
|
44
|
+
return S ? '0.7rem' : '1rem';
|
|
45
|
+
}, function (_a) {
|
|
43
46
|
var rightWrongResult = _a.rightWrongResult, disabled = _a.disabled;
|
|
44
47
|
return disabled ? 'not-allowed' :
|
|
45
48
|
rightWrongResult ? 'initial' : 'pointer';
|
|
@@ -47,9 +50,16 @@ exports.StyledOption = styled_components_1.default.div(templateObject_4 || (temp
|
|
|
47
50
|
var isSelected = _a.isSelected, rightWrongResult = _a.rightWrongResult, disabled = _a.disabled, theme = _a.theme, invert = _a.invert;
|
|
48
51
|
return !isSelected && !rightWrongResult && !disabled && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), invert ? greyColor80 : (0, utilsOolib_1.getPrimaryColor10)(theme.colors));
|
|
49
52
|
});
|
|
50
|
-
exports.
|
|
53
|
+
exports.StyledOtherOptionContainer = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"], ["\n display: flex;\n gap: 1rem;\n flex-direction: ", ";\n"])), function (_a) {
|
|
54
|
+
var listType = _a.listType;
|
|
55
|
+
return listType == 'vertical' ? 'column' : 'row';
|
|
56
|
+
});
|
|
57
|
+
exports.StyledOtherTextInputWrapper = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n \n margin-right: 0.5rem;\n ", "\n\n ", ";\n \n ", "{ width: 28rem; }\n"], ["\n \n margin-right: 0.5rem;\n ", "\n\n ", ";\n \n ", "{ width: 28rem; }\n"])), function (_a) {
|
|
58
|
+
var rightWrongResult = _a.rightWrongResult;
|
|
59
|
+
return rightWrongResult && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["pointer-events: none;"], ["pointer-events: none;"])));
|
|
60
|
+
}, function (_a) {
|
|
51
61
|
var listType = _a.listType;
|
|
52
|
-
return listType === 'vertical' ? (0, styled_components_1.css)(
|
|
62
|
+
return listType === 'vertical' ? (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["margin-left: 2.5rem;"], ["margin-left: 2.5rem;"]))) : (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["width: 28rem"], ["width: 28rem"])));
|
|
53
63
|
}, (0, mixins_1.mediaQuery)('sm'));
|
|
54
|
-
exports.StyledCorrectMessage = (0, styled_components_1.default)(Typo_1.SANS_2)(
|
|
55
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
64
|
+
exports.StyledCorrectMessage = (0, styled_components_1.default)(Typo_1.SANS_2)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n color: ", ";\n padding-left: 3.3rem;\n padding-top: 1rem;\n"], ["\n color: ", ";\n padding-left: 3.3rem;\n padding-top: 1rem;\n"])), green);
|
|
65
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -8,3 +8,12 @@ export function genOtherValueObject(text: any): {
|
|
|
8
8
|
value_desc: any;
|
|
9
9
|
display: string;
|
|
10
10
|
};
|
|
11
|
+
export function genDisplayedOptions({ injectOtherOption, options, valueProp, saveValueAsString }: {
|
|
12
|
+
injectOtherOption: any;
|
|
13
|
+
options: any;
|
|
14
|
+
valueProp: any;
|
|
15
|
+
saveValueAsString: any;
|
|
16
|
+
}): {
|
|
17
|
+
typicalOptions: any;
|
|
18
|
+
otherOption: any;
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genOtherValueObject = exports.getMarkingCommand = void 0;
|
|
3
|
+
exports.genDisplayedOptions = exports.genOtherValueObject = exports.getMarkingCommand = void 0;
|
|
4
4
|
var genValueFromDisplay_1 = require("../../utils/genValueFromDisplay");
|
|
5
5
|
var getMarkingCommand = function (_a) {
|
|
6
6
|
var option = _a.option, isSelected = _a.isSelected;
|
|
@@ -23,3 +23,23 @@ var genOtherValueObject = function (text) {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
exports.genOtherValueObject = genOtherValueObject;
|
|
26
|
+
var genDisplayedOptions = function (_a) {
|
|
27
|
+
var injectOtherOption = _a.injectOtherOption, options = _a.options, valueProp = _a.valueProp, saveValueAsString = _a.saveValueAsString;
|
|
28
|
+
var otherOption = options.find(function (op) { return op.value === "other"; }); // if options has the other object already
|
|
29
|
+
if (otherOption)
|
|
30
|
+
return {
|
|
31
|
+
typicalOptions: options.filter(function (op) { return op.value !== 'other'; }),
|
|
32
|
+
otherOption: injectOtherOption ? otherOption : {}
|
|
33
|
+
};
|
|
34
|
+
var OtherValInValueProp = (valueProp instanceof Array ? valueProp : [valueProp]).find(function (v) {
|
|
35
|
+
return saveValueAsString ?
|
|
36
|
+
options.every(function (op) { return op.value !== v; })
|
|
37
|
+
: (v === null || v === void 0 ? void 0 : v.value) === 'other';
|
|
38
|
+
});
|
|
39
|
+
otherOption = saveValueAsString ?
|
|
40
|
+
{ value: "other", display: "Other", display_desc: (OtherValInValueProp || '') }
|
|
41
|
+
:
|
|
42
|
+
OtherValInValueProp || { value: "other", display: "Other", display_desc: '' };
|
|
43
|
+
return { typicalOptions: options, otherOption: otherOption };
|
|
44
|
+
};
|
|
45
|
+
exports.genDisplayedOptions = genDisplayedOptions;
|
|
@@ -137,7 +137,7 @@ var TextInput = function (props) {
|
|
|
137
137
|
icon && (react_1.default.createElement(DisplayIcon, { icon: icon, size: S ? 15 : 20, onClick: iconOnClick || null })),
|
|
138
138
|
react_1.default.createElement(index_styled_1.InputStyled, { className: size === 'S' ? 'SANS_2' : 'SANS_3', id: id, type: type, name: type, placeholder: placeholder, value: value, onChange: handleOnChange, maxLength: maxNumLimiter, onBlur: handleValidateOnBlur, onFocus: onFocus, size: size, autoComplete: 'off' }),
|
|
139
139
|
inputStatus === 'loading' && (react_1.default.createElement("div", null,
|
|
140
|
-
react_1.default.createElement(LoadersAndProgress_1.
|
|
140
|
+
react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true, invert: invert }))),
|
|
141
141
|
actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimary, { value: actionBtn.text, invert: actionBtn.invert, onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: '-2rem' } }))),
|
|
142
142
|
(inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.msg) && (react_1.default.createElement(index_styled_1.MsgContainer, { invert: invert, status: inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.type },
|
|
143
143
|
react_1.default.createElement(Typo_1.SANS_3, null, inputStatus.msg))))))));
|
package/dist/index.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export { Tooltip } from "./components/Tooltip";
|
|
|
23
23
|
export { ActionMenu } from "./components/ActionMenu";
|
|
24
24
|
export { PercentCompletedPie } from "./components/PercentCompletedPie";
|
|
25
25
|
export { Divider } from "./components/Divider";
|
|
26
|
-
export {
|
|
26
|
+
export { LoaderCircle, ProgressBar, LoaderCircle as Loader } from "./components/LoadersAndProgress";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Divider = exports.PercentCompletedPie = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.Loader = exports.ProgressBar = exports.
|
|
17
|
+
exports.Divider = exports.PercentCompletedPie = exports.ActionMenu = exports.Tooltip = exports.OKELink = exports.UserRoleBadge = exports.Section = exports.Loader = exports.ProgressBar = exports.LoaderCircle = exports.icons = exports.colors = exports.GlobalStyles = void 0;
|
|
18
18
|
//css and styling related ( styled-components )
|
|
19
19
|
var globalStyles_1 = require("./globalStyles");
|
|
20
20
|
Object.defineProperty(exports, "GlobalStyles", { enumerable: true, get: function () { return globalStyles_1.GlobalStyles; } });
|
|
@@ -27,10 +27,10 @@ Object.defineProperty(exports, "icons", { enumerable: true, get: function () { r
|
|
|
27
27
|
__exportStar(require("./components/Typo"), exports);
|
|
28
28
|
//components
|
|
29
29
|
var LoadersAndProgress_1 = require("./components/LoadersAndProgress");
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "LoaderCircle", { enumerable: true, get: function () { return LoadersAndProgress_1.LoaderCircle; } });
|
|
31
31
|
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return LoadersAndProgress_1.ProgressBar; } });
|
|
32
32
|
var LoadersAndProgress_2 = require("./components/LoadersAndProgress"); //backwards compat till shen verifies
|
|
33
|
-
Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return LoadersAndProgress_2.
|
|
33
|
+
Object.defineProperty(exports, "Loader", { enumerable: true, get: function () { return LoadersAndProgress_2.LoaderCircle; } });
|
|
34
34
|
__exportStar(require("./components/Buttons"), exports);
|
|
35
35
|
__exportStar(require("./components/Tags"), exports);
|
|
36
36
|
__exportStar(require("./components/Breadcrumbs"), exports);
|
|
@@ -5,7 +5,7 @@ var genValueFromDisplay = function (text) {
|
|
|
5
5
|
var value_desc = ( // genrating a value text abiding js conventions (camelCased)
|
|
6
6
|
text
|
|
7
7
|
.trim()
|
|
8
|
-
.replace(/[
|
|
8
|
+
.replace(/[-\.,\/\\_'":;]/g, '') // regex removes hyphens, dots, slashes, underscores, quotes, colons and semicolons
|
|
9
9
|
.split(' ')
|
|
10
10
|
.filter(Boolean)
|
|
11
11
|
.map(function (word, idx) { return word[0]["to".concat(idx === 0 ? 'Lower' : 'Upper', "Case")]() + word.slice(1); })
|