oolib 2.208.0 → 2.208.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/DateRangePicker/index.js +2 -2
- package/dist/components/GroupQuestionsInputSingle/index.js +2 -2
- package/dist/components/IFrameInput/index.js +1 -1
- package/dist/components/ImageInput/comps/Placeholder/index.js +1 -1
- package/dist/components/SimpleTable/index.js +2 -2
- package/dist/components/VideoInput/comps/EmbedLinkModal.js +1 -1
- package/dist/components/cards/ListProfile/index.js +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +25 -33
- package/dist/stories/Oolib/components/Modal.stories.js +2 -2
- package/dist/stories/Oolib/components/TagsInput.stories.js +1 -1
- package/dist/v2/components/DateRangePicker/index.js +1 -2
- package/dist/v2/components/Dropdowns/comps/SelectDropdown/styled.js +1 -1
- package/dist/v2/components/TabBar/index.js +3 -3
- package/dist/v2/components/TextInputs/index.js +0 -7
- package/dist/v2/components/TextInputs/index.styled.js +1 -1
- package/package.json +1 -1
- package/dist/components/BlockLabel/index.d.ts +0 -2
- package/dist/components/BlockLabel/index.js +0 -75
- package/dist/components/BlockLabel/index.styled.d.ts +0 -2
- package/dist/components/BlockLabel/index.styled.js +0 -14
- package/dist/components/Dropdowns/DropdownMulti/index.d.ts +0 -38
- package/dist/components/Dropdowns/DropdownMulti/index.js +0 -179
- package/dist/components/Dropdowns/DropdownSingle/index.d.ts +0 -40
- package/dist/components/Dropdowns/DropdownSingle/index.js +0 -163
- package/dist/components/Dropdowns/comps/Caret/index.d.ts +0 -6
- package/dist/components/Dropdowns/comps/Caret/index.js +0 -19
- package/dist/components/Dropdowns/comps/Caret/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/Caret/styled.js +0 -14
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.d.ts +0 -7
- package/dist/components/Dropdowns/comps/DisplayCompSingle/index.js +0 -39
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.d.ts +0 -4
- package/dist/components/Dropdowns/comps/NoOptionResultsComp/index.js +0 -15
- package/dist/components/Dropdowns/comps/OptionContent/index.d.ts +0 -8
- package/dist/components/Dropdowns/comps/OptionContent/index.js +0 -34
- package/dist/components/Dropdowns/comps/OptionsMulti/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsMulti/index.js +0 -159
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.d.ts +0 -14
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/index.js +0 -81
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/comps/OptionsAnimateWrapper/styled.js +0 -25
- package/dist/components/Dropdowns/comps/OptionsShell/index.d.ts +0 -2
- package/dist/components/Dropdowns/comps/OptionsShell/index.js +0 -101
- package/dist/components/Dropdowns/comps/OptionsShell/styled.d.ts +0 -5
- package/dist/components/Dropdowns/comps/OptionsShell/styled.js +0 -45
- package/dist/components/Dropdowns/comps/OptionsSingle/index.d.ts +0 -28
- package/dist/components/Dropdowns/comps/OptionsSingle/index.js +0 -105
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/OptionsSingle/styled.js +0 -61
- package/dist/components/Dropdowns/comps/SelectDropdown/index.d.ts +0 -13
- package/dist/components/Dropdowns/comps/SelectDropdown/index.js +0 -54
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.d.ts +0 -1
- package/dist/components/Dropdowns/comps/SelectDropdown/styled.js +0 -71
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.d.ts +0 -18
- package/dist/components/Dropdowns/comps/SelectTagsInput/index.js +0 -124
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.d.ts +0 -2
- package/dist/components/Dropdowns/comps/SelectTagsInput/styled.js +0 -54
- package/dist/components/Dropdowns/handlers/index.d.ts +0 -14
- package/dist/components/Dropdowns/handlers/index.js +0 -52
- package/dist/components/Dropdowns/styled.d.ts +0 -2
- package/dist/components/Dropdowns/styled.js +0 -49
- package/dist/components/Dropdowns/utils/genColor.d.ts +0 -4
- package/dist/components/Dropdowns/utils/genColor.js +0 -15
- package/dist/components/Dropdowns/utils/genIcon.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genIcon.js +0 -18
- package/dist/components/Dropdowns/utils/genLinkOrText.d.ts +0 -1
- package/dist/components/Dropdowns/utils/genLinkOrText.js +0 -48
- package/dist/components/Dropdowns/utils/genProfileImg.d.ts +0 -6
- package/dist/components/Dropdowns/utils/genProfileImg.js +0 -14
- package/dist/components/Dropdowns/utils/genTagComp.d.ts +0 -2
- package/dist/components/Dropdowns/utils/genTagComp.js +0 -27
- package/dist/components/Dropdowns/utils/generateOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/generateOptions.js +0 -20
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genMonthsArray.js +0 -40
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/genYearsArray.js +0 -11
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.d.ts +0 -4
- package/dist/components/Dropdowns/utils/getAllOptionsFns/getLanguagesArray.js +0 -62
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.d.ts +0 -1
- package/dist/components/Dropdowns/utils/getAllOptionsFns/index.js +0 -19
- package/dist/components/Dropdowns/utils/getValue.d.ts +0 -14
- package/dist/components/Dropdowns/utils/getValue.js +0 -32
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.d.ts +0 -0
- package/dist/components/Dropdowns/utils/isDynamicOtherOption.js +0 -0
- package/dist/components/Dropdowns/utils/keywordSearchOptions.d.ts +0 -6
- package/dist/components/Dropdowns/utils/keywordSearchOptions.js +0 -18
- package/dist/components/Dropdowns/utils/setDropdownSelectText.d.ts +0 -12
- package/dist/components/Dropdowns/utils/setDropdownSelectText.js +0 -19
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useCreateDropdownRefs.js +0 -15
- package/dist/components/Dropdowns/utils/useHideShowOptions.d.ts +0 -5
- package/dist/components/Dropdowns/utils/useHideShowOptions.js +0 -20
- package/dist/components/Dropdowns/utils/useKeyboardControl.d.ts +0 -12
- package/dist/components/Dropdowns/utils/useKeyboardControl.js +0 -73
- package/dist/components/Dropdowns/utils/useSearchString.d.ts +0 -4
- package/dist/components/Dropdowns/utils/useSearchString.js +0 -20
- package/dist/components/Dropdowns/utils/useSetYOrientation.d.ts +0 -9
- package/dist/components/Dropdowns/utils/useSetYOrientation.js +0 -46
- package/dist/components/Hints/contextApi.d.ts +0 -6
- package/dist/components/Hints/contextApi.js +0 -48
- package/dist/components/Hints/index.d.ts +0 -9
- package/dist/components/Hints/index.js +0 -127
- package/dist/components/Hints/styled.d.ts +0 -6
- package/dist/components/Hints/styled.js +0 -54
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/index.js +0 -30
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxButton/styled.js +0 -70
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.d.ts +0 -11
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/comps/CheckboxInput/index.js +0 -50
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.d.ts +0 -20
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/index.js +0 -124
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/CheckboxList/styled.js +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.d.ts +0 -18
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/index.js +0 -53
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.d.ts +0 -2
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/RadioInput/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.d.ts +0 -1
- package/dist/components/RadioAndCheckbox/comps/RadioList/comps/index.js +0 -6
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.d.ts +0 -17
- package/dist/components/RadioAndCheckbox/comps/RadioList/index.js +0 -109
- package/dist/components/RadioAndCheckbox/index.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/index.js +0 -14
- package/dist/components/RadioAndCheckbox/styled.d.ts +0 -5
- package/dist/components/RadioAndCheckbox/styled.js +0 -84
- package/dist/components/RadioAndCheckbox/utils.d.ts +0 -22
- package/dist/components/RadioAndCheckbox/utils.js +0 -49
- package/dist/components/Switches/index.d.ts +0 -21
- package/dist/components/Switches/index.js +0 -102
- package/dist/components/Switches/styled.d.ts +0 -5
- package/dist/components/Switches/styled.js +0 -63
- package/dist/components/TextInputs/index.d.ts +0 -24
- package/dist/components/TextInputs/index.js +0 -367
- package/dist/components/TextInputs/index.styled.d.ts +0 -3
- package/dist/components/TextInputs/index.styled.js +0 -77
- package/dist/components/cards/CardContent/index.d.ts +0 -11
- package/dist/components/cards/CardContent/index.js +0 -76
- package/dist/components/cards/CardContent/styled.d.ts +0 -7
- package/dist/components/cards/CardContent/styled.js +0 -63
- package/dist/components/cards/ListContent/index.d.ts +0 -12
- package/dist/components/cards/ListContent/index.js +0 -87
- package/dist/components/cards/ListContent/styled.d.ts +0 -7
- package/dist/components/cards/ListContent/styled.js +0 -26
- package/dist/stories/Oolib/components/BlockLabel.stories.d.ts +0 -71
- package/dist/stories/Oolib/components/BlockLabel.stories.js +0 -106
- package/dist/stories/Oolib/components/Checkbox.stories.d.ts +0 -248
- package/dist/stories/Oolib/components/Checkbox.stories.js +0 -249
- package/dist/stories/Oolib/components/Dropdowns.stories.d.ts +0 -127
- package/dist/stories/Oolib/components/Dropdowns.stories.js +0 -298
- package/dist/stories/Oolib/components/RadioButton.stories.d.ts +0 -260
- package/dist/stories/Oolib/components/RadioButton.stories.js +0 -264
- package/dist/stories/Oolib/components/Switches.stories.d.ts +0 -106
- package/dist/stories/Oolib/components/Switches.stories.js +0 -146
- package/dist/stories/Oolib/components/TextInputs.stories.d.ts +0 -124
- package/dist/stories/Oolib/components/TextInputs.stories.js +0 -188
|
@@ -1,367 +0,0 @@
|
|
|
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
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
-
var ownKeys = function(o) {
|
|
31
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
-
var ar = [];
|
|
33
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
-
return ar;
|
|
35
|
-
};
|
|
36
|
-
return ownKeys(o);
|
|
37
|
-
};
|
|
38
|
-
return function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
})();
|
|
46
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
48
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
50
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
51
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
52
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
56
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
58
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
59
|
-
function step(op) {
|
|
60
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
61
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
62
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
63
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
64
|
-
switch (op[0]) {
|
|
65
|
-
case 0: case 1: t = op; break;
|
|
66
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
67
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
68
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
69
|
-
default:
|
|
70
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
71
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
72
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
73
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
74
|
-
if (t[2]) _.ops.pop();
|
|
75
|
-
_.trys.pop(); continue;
|
|
76
|
-
}
|
|
77
|
-
op = body.call(thisArg, _);
|
|
78
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
79
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
83
|
-
var t = {};
|
|
84
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
85
|
-
t[p] = s[p];
|
|
86
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
87
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
88
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
89
|
-
t[p[i]] = s[p[i]];
|
|
90
|
-
}
|
|
91
|
-
return t;
|
|
92
|
-
};
|
|
93
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
94
|
-
exports.NumberInput = exports.URLInput = exports.PhoneInput = exports.EmailInput = exports.PasswordInput = exports.TextInput = void 0;
|
|
95
|
-
var react_1 = __importStar(require("react"));
|
|
96
|
-
var index_styled_1 = require("./index.styled");
|
|
97
|
-
var icons_1 = require("../../icons");
|
|
98
|
-
var BlockLabel_1 = require("../../v2/components/BlockLabel");
|
|
99
|
-
var Typo_1 = require("../Typo");
|
|
100
|
-
var Buttons_1 = require("../Buttons");
|
|
101
|
-
var _EXPORTS_1 = require("../../utils/_EXPORTS");
|
|
102
|
-
var LoadersAndProgress_1 = require("../LoadersAndProgress");
|
|
103
|
-
var OKELink_1 = require("../OKELink");
|
|
104
|
-
var utilsOolib_1 = require("../../utilsOolib");
|
|
105
|
-
var styled_components_1 = require("styled-components");
|
|
106
|
-
var DisplayIcon = function (_a) {
|
|
107
|
-
var icon = _a.icon, onClick = _a.onClick, size = _a.size;
|
|
108
|
-
var IconComp = icons_1.icons[icon];
|
|
109
|
-
return (react_1.default.createElement("div", { style: { cursor: onClick ? "pointer" : "", display: "flex" }, onMouseDown: onClick || null }, IconComp && react_1.default.createElement(IconComp, { size: size, weight: "bold" })));
|
|
110
|
-
};
|
|
111
|
-
var TextInput = function (props) {
|
|
112
|
-
var id = props.id, invert = props.invert, disabled = props.disabled, icon = props.icon, type = props.type, _a = props.placeholder, placeholder = _a === void 0 ? "Enter Text..." : _a, _b = props.value, value = _b === void 0 ? "" : _b, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, readOnly = props.readOnly, iconOnClick = props.iconOnClick, eyeIcon = props.eyeIcon, S = props.S, handleValidation = props.handleValidation, _c = props.validateOnMount, validateOnMount = _c === void 0 ? true : _c, // i think it makes sense to always run validation the minute the comp mounts, but we will see if this has sideeffects
|
|
113
|
-
actionBtn = props.actionBtn, clearBtn = props.clearBtn, className = props.className, maxLength = props.maxLength, DEPRECATED_maxNumLimiter = props.maxNumLimiter, forceFocus = props.forceFocus, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
|
|
114
|
-
_d = props.validateOnlyOnBlur, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
|
|
115
|
-
validateOnlyOnBlur = _d === void 0 ? false : _d, //for example, in the login form we want validation to only run, once the text input is blurred. else it can be irritating
|
|
116
|
-
_validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e, content = props.content, passValidationErrorToFormValidation = props.passValidationErrorToFormValidation, plugin = props.plugin;
|
|
117
|
-
var theme = (0, styled_components_1.useTheme)();
|
|
118
|
-
var _f = (0, react_1.useState)(_validationStatus), validationStatus = _f[0], setValidationStatus = _f[1];
|
|
119
|
-
(0, react_1.useEffect)(function () {
|
|
120
|
-
setValidationStatus(_validationStatus);
|
|
121
|
-
}, [_validationStatus]);
|
|
122
|
-
var composition = icon && !eyeIcon ? "icon+text" : "textOnly";
|
|
123
|
-
var size = S ? "S" : "M";
|
|
124
|
-
var actionBtnEnabaled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
|
|
125
|
-
var clearBtnEnabled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
|
|
126
|
-
var handleValidate = function (e, onBlur) { return __awaiter(void 0, void 0, void 0, function () {
|
|
127
|
-
var value, res, validationPlugin, pluginResponse;
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
switch (_a.label) {
|
|
130
|
-
case 0:
|
|
131
|
-
onBlur && onBlur(e);
|
|
132
|
-
value = e.target.value;
|
|
133
|
-
if (!value)
|
|
134
|
-
return [2 /*return*/];
|
|
135
|
-
if (type === "url")
|
|
136
|
-
setValidationStatus("loading");
|
|
137
|
-
if (!handleValidation) return [3 /*break*/, 2];
|
|
138
|
-
return [4 /*yield*/, handleValidation(value)];
|
|
139
|
-
case 1:
|
|
140
|
-
res = _a.sent();
|
|
141
|
-
setValidationStatus(res);
|
|
142
|
-
_a.label = 2;
|
|
143
|
-
case 2:
|
|
144
|
-
validationPlugin = ((plugin === null || plugin === void 0 ? void 0 : plugin.validation) &&
|
|
145
|
-
theme.pluginConfigs &&
|
|
146
|
-
theme.pluginConfigs.tplBlockPlugins[plugin.validation]);
|
|
147
|
-
if (!validationPlugin) return [3 /*break*/, 4];
|
|
148
|
-
setValidationStatus('loading');
|
|
149
|
-
return [4 /*yield*/, validationPlugin({
|
|
150
|
-
value: value,
|
|
151
|
-
content: content,
|
|
152
|
-
passValidationErrorToFormValidation: passValidationErrorToFormValidation,
|
|
153
|
-
})];
|
|
154
|
-
case 3:
|
|
155
|
-
pluginResponse = _a.sent();
|
|
156
|
-
//if plugin responds with undefined, it means it found no error. hence lets pass the 'success info' to passValidationErrorToFormValidation
|
|
157
|
-
if (!pluginResponse)
|
|
158
|
-
passValidationErrorToFormValidation('success');
|
|
159
|
-
setValidationStatus(pluginResponse);
|
|
160
|
-
_a.label = 4;
|
|
161
|
-
case 4: return [2 /*return*/];
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}); };
|
|
165
|
-
(0, react_1.useEffect)(function () {
|
|
166
|
-
if (validateOnMount) {
|
|
167
|
-
handleValidate({ target: { value: value } });
|
|
168
|
-
}
|
|
169
|
-
}, [validateOnMount]);
|
|
170
|
-
var handleOnChange = function (e) {
|
|
171
|
-
onChange(id, e.target.value);
|
|
172
|
-
if (!e.target.value)
|
|
173
|
-
setValidationStatus('');
|
|
174
|
-
if (!validateOnlyOnBlur) {
|
|
175
|
-
handleValidate(e);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
/**
|
|
179
|
-
* basically if an error has already been set then, run validation in realtime on change
|
|
180
|
-
*/
|
|
181
|
-
if (validationStatus) {
|
|
182
|
-
if (type === "url")
|
|
183
|
-
return setValidationStatus("");
|
|
184
|
-
handleValidate(e);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
var inputRef = (0, react_1.useRef)(null);
|
|
189
|
-
(0, react_1.useEffect)(function () {
|
|
190
|
-
forceFocus && inputRef.current && inputRef.current.focus();
|
|
191
|
-
}, [forceFocus]);
|
|
192
|
-
var localize = (0, utilsOolib_1.useLocale)();
|
|
193
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
194
|
-
react_1.default.createElement("div", { className: className },
|
|
195
|
-
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
196
|
-
readOnly ? (react_1.default.createElement(Typo_1.SANS_3, { invert: invert }, type === "url"
|
|
197
|
-
? react_1.default.createElement(OKELink_1.OKELink, { text: value, to: value })
|
|
198
|
-
: type === "password"
|
|
199
|
-
? "********" : value)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
200
|
-
react_1.default.createElement(index_styled_1.InputContainerStyled, { invert: invert, type: type, disabled: disabled, status: validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type, eyeIcon: eyeIcon, composition: composition, onClick: function () { return inputRef.current.focus(); } },
|
|
201
|
-
icon && (react_1.default.createElement(DisplayIcon, { icon: icon, size: S ? 15 : 20, onClick: iconOnClick || null })),
|
|
202
|
-
react_1.default.createElement(index_styled_1.InputStyled, { ref: inputRef, className: size === "S" ? "SANS_2" : "SANS_3", id: id, type: type, name: type, placeholder: localize(placeholder), value: value, onChange: handleOnChange, maxLength: maxLength || DEPRECATED_maxNumLimiter, onBlur: validateOnlyOnBlur
|
|
203
|
-
? function (e) { return handleValidate(e, onBlur); }
|
|
204
|
-
: onBlur, onFocus: onFocus, size: size, autoComplete: "off" }),
|
|
205
|
-
validationStatus === "loading" && (react_1.default.createElement("div", null,
|
|
206
|
-
react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true, invert: invert }))),
|
|
207
|
-
clearBtn && (react_1.default.createElement(Buttons_1.ButtonGhost, { M: true, value: clearBtn.text, invert: clearBtn.invert, onClick: function () { return onChange(props.id, ""); }, disabled: !clearBtnEnabled, style: { marginRight: actionBtn ? "-1rem" : "-2rem" } })),
|
|
208
|
-
actionBtn && (react_1.default.createElement(Buttons_1.ButtonPrimary, { M: true, value: actionBtn.text, invert: actionBtn.invert, onClick: actionBtnEnabaled && actionBtn.onClick, disabled: !actionBtnEnabaled, style: { marginRight: "-2rem" } }))),
|
|
209
|
-
(displayValidationMsg && (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.msg)) && (react_1.default.createElement(index_styled_1.MsgContainer, { invert: invert, status: validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type },
|
|
210
|
-
react_1.default.createElement(Typo_1.SANS_3, null,
|
|
211
|
-
validationStatus.msg,
|
|
212
|
-
validationStatus.link && (react_1.default.createElement(OKELink_1.OKELink, { style: { marginLeft: "1rem" }, to: validationStatus.link.to }, validationStatus.link.text))))))))));
|
|
213
|
-
};
|
|
214
|
-
exports.TextInput = TextInput;
|
|
215
|
-
//passValidationErrorToFormValidation is not being handled by PasswordInput, cuz i dont think we will need it here..
|
|
216
|
-
var PasswordInput = function (_a) {
|
|
217
|
-
var props = __rest(_a, []);
|
|
218
|
-
var _b = (0, react_1.useState)(false), showPassword = _b[0], setShowPassword = _b[1];
|
|
219
|
-
var icon = showPassword ? "Eye" : "EyeClosed";
|
|
220
|
-
var toggleShowPassword = function (e) {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
setShowPassword(function (prev) { return !prev; });
|
|
223
|
-
};
|
|
224
|
-
return (react_1.default.createElement(exports.TextInput, __assign({ placeholder: "Enter password...", type: showPassword ? "text" : "password", iconOnClick: toggleShowPassword, eyeIcon: true, icon: icon }, props)));
|
|
225
|
-
};
|
|
226
|
-
exports.PasswordInput = PasswordInput;
|
|
227
|
-
var EmailInput = function (_a) {
|
|
228
|
-
var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
|
|
229
|
-
var handleValidation = function (value) {
|
|
230
|
-
var regEx = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
231
|
-
var errorObj = regEx.test(value)
|
|
232
|
-
? ""
|
|
233
|
-
: { type: "error", msg: "Enter a valid email address" };
|
|
234
|
-
if (passValidationErrorToFormValidation) {
|
|
235
|
-
passValidationErrorToFormValidation((errorObj === null || errorObj === void 0 ? void 0 : errorObj.type) || "success");
|
|
236
|
-
}
|
|
237
|
-
return errorObj;
|
|
238
|
-
};
|
|
239
|
-
return (react_1.default.createElement(exports.TextInput, __assign({ type: "email", placeholder: "Enter email...", handleValidation: handleValidation }, props)));
|
|
240
|
-
};
|
|
241
|
-
exports.EmailInput = EmailInput;
|
|
242
|
-
var PhoneInput = function (_a) {
|
|
243
|
-
var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
|
|
244
|
-
var handleValidation = function (value) {
|
|
245
|
-
var errorObj;
|
|
246
|
-
if (isNaN(value)) {
|
|
247
|
-
errorObj = { type: "error", msg: "Enter a valid phone number" };
|
|
248
|
-
if (passValidationErrorToFormValidation)
|
|
249
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
250
|
-
return errorObj;
|
|
251
|
-
}
|
|
252
|
-
if (value.length < 9) {
|
|
253
|
-
errorObj = { type: "error", msg: "Enter a valid phone number" };
|
|
254
|
-
if (passValidationErrorToFormValidation)
|
|
255
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
256
|
-
return errorObj;
|
|
257
|
-
}
|
|
258
|
-
//else
|
|
259
|
-
if (passValidationErrorToFormValidation)
|
|
260
|
-
passValidationErrorToFormValidation("success");
|
|
261
|
-
};
|
|
262
|
-
return (react_1.default.createElement(exports.TextInput, __assign({ type: "tel", placeholder: "Enter Phone...", handleValidation: handleValidation, maxLength: 11 }, props)));
|
|
263
|
-
};
|
|
264
|
-
exports.PhoneInput = PhoneInput;
|
|
265
|
-
var URLInput = function (_a) {
|
|
266
|
-
var _b = _a.routesAreValidInputs, routesAreValidInputs = _b === void 0 ? false : _b, //if we want react route declarations to be considered as 'valid' then set this to true
|
|
267
|
-
validationPlugin = _a.validationPlugin, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, content = _a.content, props = __rest(_a, ["routesAreValidInputs", "validationPlugin", "passValidationErrorToFormValidation", "content"]);
|
|
268
|
-
var handleValidation = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
-
var pluginResponse, successObj, response, successObj, err_1, successObj, errorObj;
|
|
270
|
-
return __generator(this, function (_a) {
|
|
271
|
-
switch (_a.label) {
|
|
272
|
-
case 0:
|
|
273
|
-
if (!validationPlugin) return [3 /*break*/, 2];
|
|
274
|
-
return [4 /*yield*/, validationPlugin({
|
|
275
|
-
value: value,
|
|
276
|
-
content: content,
|
|
277
|
-
passValidationErrorToFormValidation: passValidationErrorToFormValidation,
|
|
278
|
-
})];
|
|
279
|
-
case 1:
|
|
280
|
-
pluginResponse = _a.sent();
|
|
281
|
-
if (pluginResponse)
|
|
282
|
-
return [2 /*return*/, pluginResponse];
|
|
283
|
-
_a.label = 2;
|
|
284
|
-
case 2:
|
|
285
|
-
//else
|
|
286
|
-
//if routesAreValidInputs, then first validate for a route
|
|
287
|
-
if (routesAreValidInputs && value.substring(0, 1) === "/") {
|
|
288
|
-
successObj = { type: "success", msg: "valid route" };
|
|
289
|
-
if (passValidationErrorToFormValidation)
|
|
290
|
-
passValidationErrorToFormValidation(successObj.type);
|
|
291
|
-
return [2 /*return*/, successObj];
|
|
292
|
-
}
|
|
293
|
-
//else validate for a url
|
|
294
|
-
if (!/^https?:\/\//i.test(value)) {
|
|
295
|
-
value = "https://" + value;
|
|
296
|
-
}
|
|
297
|
-
_a.label = 3;
|
|
298
|
-
case 3:
|
|
299
|
-
_a.trys.push([3, 5, , 6]);
|
|
300
|
-
return [4 /*yield*/, fetch(value)];
|
|
301
|
-
case 4:
|
|
302
|
-
response = _a.sent();
|
|
303
|
-
if (response.status !== 200)
|
|
304
|
-
throw new Error("");
|
|
305
|
-
successObj = { type: "success", msg: "valid url" };
|
|
306
|
-
if (passValidationErrorToFormValidation)
|
|
307
|
-
passValidationErrorToFormValidation(successObj.type);
|
|
308
|
-
return [2 /*return*/, successObj];
|
|
309
|
-
case 5:
|
|
310
|
-
err_1 = _a.sent();
|
|
311
|
-
if (/[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(value)) {
|
|
312
|
-
successObj = { type: "success", msg: "valid url" };
|
|
313
|
-
if (passValidationErrorToFormValidation)
|
|
314
|
-
passValidationErrorToFormValidation(successObj.type);
|
|
315
|
-
return [2 /*return*/, successObj];
|
|
316
|
-
}
|
|
317
|
-
errorObj = { type: "error", msg: "Enter a valid url..." };
|
|
318
|
-
if (passValidationErrorToFormValidation)
|
|
319
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
320
|
-
return [2 /*return*/, errorObj];
|
|
321
|
-
case 6: return [2 /*return*/];
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}); };
|
|
325
|
-
return (react_1.default.createElement(exports.TextInput, __assign({ type: "url", handleValidation: handleValidation, placeholder: "Enter a valid url..." }, props)));
|
|
326
|
-
};
|
|
327
|
-
exports.URLInput = URLInput;
|
|
328
|
-
var NumberInput = function (_a) {
|
|
329
|
-
var passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, props = __rest(_a, ["passValidationErrorToFormValidation"]);
|
|
330
|
-
var min = props.min, max = props.max;
|
|
331
|
-
var handleValidation = function (value) {
|
|
332
|
-
var errorObj;
|
|
333
|
-
if (isNaN(value)) {
|
|
334
|
-
errorObj = { type: "error", msg: "Enter a number" };
|
|
335
|
-
if (passValidationErrorToFormValidation)
|
|
336
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
337
|
-
return errorObj;
|
|
338
|
-
}
|
|
339
|
-
if (min && value < min) {
|
|
340
|
-
errorObj = {
|
|
341
|
-
type: "error",
|
|
342
|
-
msg: "Enter value greater than or equal to ".concat(min),
|
|
343
|
-
};
|
|
344
|
-
if (passValidationErrorToFormValidation)
|
|
345
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
346
|
-
return errorObj;
|
|
347
|
-
}
|
|
348
|
-
if (max && value > max) {
|
|
349
|
-
errorObj = {
|
|
350
|
-
type: "error",
|
|
351
|
-
msg: "Enter value less than or equal to ".concat(max),
|
|
352
|
-
};
|
|
353
|
-
if (passValidationErrorToFormValidation)
|
|
354
|
-
passValidationErrorToFormValidation(errorObj.type);
|
|
355
|
-
return errorObj;
|
|
356
|
-
}
|
|
357
|
-
//else
|
|
358
|
-
if (passValidationErrorToFormValidation)
|
|
359
|
-
passValidationErrorToFormValidation("success");
|
|
360
|
-
};
|
|
361
|
-
return (react_1.default.createElement(exports.TextInput
|
|
362
|
-
// type="number"
|
|
363
|
-
, __assign({
|
|
364
|
-
// type="number"
|
|
365
|
-
handleValidation: handleValidation, placeholder: "Enter Number..." }, props)));
|
|
366
|
-
};
|
|
367
|
-
exports.NumberInput = NumberInput;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export const MsgContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export const InputContainerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const InputStyled: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.InputStyled = exports.InputContainerStyled = exports.MsgContainer = void 0;
|
|
11
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var styled_components_2 = require("styled-components");
|
|
13
|
-
var themes_1 = require("../../themes");
|
|
14
|
-
var mixins_1 = require("../../themes/mixins");
|
|
15
|
-
var globalVariables_1 = require("../../globalStyles/globalVariables");
|
|
16
|
-
var greyColor10 = themes_1.colors.greyColor10, greyColor70 = themes_1.colors.greyColor70, greyColor5 = themes_1.colors.greyColor5, greyColor15 = themes_1.colors.greyColor15, greyColor80 = themes_1.colors.greyColor80, greyColor40 = themes_1.colors.greyColor40, greyColor100 = themes_1.colors.greyColor100, white = themes_1.colors.white, red = themes_1.colors.red, green = themes_1.colors.green, invertRed = themes_1.colors.invertRed, invertGreen = themes_1.colors.invertGreen;
|
|
17
|
-
var SIZES = {
|
|
18
|
-
S: "3rem",
|
|
19
|
-
M: "4rem",
|
|
20
|
-
};
|
|
21
|
-
var getColorValue = function (status, invert) {
|
|
22
|
-
switch (status) {
|
|
23
|
-
case 'error':
|
|
24
|
-
return invert ? invertRed : red;
|
|
25
|
-
case 'success':
|
|
26
|
-
return invert ? invertGreen : green;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.MsgContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 0.5rem;\n ", "\n"], ["\n margin-top: 0.5rem;\n ", "\n"])), function (_a) {
|
|
30
|
-
var status = _a.status, invert = _a.invert;
|
|
31
|
-
return status && (0, styled_components_2.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), getColorValue(status, invert));
|
|
32
|
-
});
|
|
33
|
-
exports.InputContainerStyled = styled_components_1.default.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n ", "\n ", ";\n\n position: relative;\n background-color: ", ";\n color: ", ";\n display: flex;\n align-items: center;\n gap: 1rem;\n ", "\n\n ", "\n ", "\n\n ", ";\n ", ";\n ", "\n"], ["\n ", "\n ", ";\n\n position: relative;\n background-color: ", ";\n color: ", ";\n display: flex;\n align-items: center;\n gap: 1rem;\n ", "\n\n ", "\n ", "\n\n ", ";\n ", ";\n ", "\n"
|
|
34
|
-
// export const DisplayOnlyComp = styled.div`
|
|
35
|
-
// ${({ size }) =>
|
|
36
|
-
// css`
|
|
37
|
-
// height: ${SIZES[size]};
|
|
38
|
-
// `}
|
|
39
|
-
// `
|
|
40
|
-
])), function (_a) {
|
|
41
|
-
var composition = _a.composition;
|
|
42
|
-
switch (composition) {
|
|
43
|
-
case 'icon+text':
|
|
44
|
-
return (0, styled_components_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 0 2rem 0 1.5rem;\n "], ["\n padding: 0 2rem 0 1.5rem;\n "])));
|
|
45
|
-
default:
|
|
46
|
-
return (0, styled_components_2.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), globalVariables_1.globalInputElemPadding);
|
|
47
|
-
}
|
|
48
|
-
}, function (_a) {
|
|
49
|
-
var eyeIcon = _a.eyeIcon;
|
|
50
|
-
return eyeIcon && (0, styled_components_2.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n flex-direction: row-reverse;\n "], ["\n flex-direction: row-reverse;\n "])));
|
|
51
|
-
}, function (_a) {
|
|
52
|
-
var invert = _a.invert;
|
|
53
|
-
return (invert ? greyColor80 : greyColor5);
|
|
54
|
-
}, function (_a) {
|
|
55
|
-
var invert = _a.invert;
|
|
56
|
-
return (invert ? white : greyColor100);
|
|
57
|
-
}, (0, mixins_1.transition)('background-color'), globalVariables_1.globalInputElemHover, globalVariables_1.globalInputElemFocused, function (_a) {
|
|
58
|
-
var disabled = _a.disabled;
|
|
59
|
-
return disabled && (0, styled_components_2.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n pointer-events: none;\n color: ", ";\n "], ["\n background-color: ", ";\n pointer-events: none;\n color: ", ";\n "])), greyColor15, greyColor40);
|
|
60
|
-
}, function (_a) {
|
|
61
|
-
var readOnly = _a.readOnly;
|
|
62
|
-
return readOnly && (0, styled_components_2.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "])));
|
|
63
|
-
}, function (_a) {
|
|
64
|
-
var status = _a.status, invert = _a.invert;
|
|
65
|
-
return status && (0, styled_components_2.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n ::after{\n content: none;\n }\n box-shadow: inset 0px -2px 0px ", ";;\n }\n "], ["\n ::after{\n content: none;\n }\n box-shadow: inset 0px -2px 0px ", ";;\n }\n "])), getColorValue(status, invert));
|
|
66
|
-
});
|
|
67
|
-
// export const DisplayOnlyComp = styled.div`
|
|
68
|
-
// ${({ size }) =>
|
|
69
|
-
// css`
|
|
70
|
-
// height: ${SIZES[size]};
|
|
71
|
-
// `}
|
|
72
|
-
// `
|
|
73
|
-
exports.InputStyled = styled_components_1.default.input(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n ", "\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 }\n"], ["\n ", "\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 }\n"])), function (_a) {
|
|
74
|
-
var size = _a.size;
|
|
75
|
-
return (0, styled_components_2.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), SIZES[size]);
|
|
76
|
-
}, greyColor40);
|
|
77
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export function CardContent({ id, data, config, to, onClick, openInNewTab, actions, highlight }: {
|
|
2
|
-
id: any;
|
|
3
|
-
data: any;
|
|
4
|
-
config: any;
|
|
5
|
-
to: any;
|
|
6
|
-
onClick: any;
|
|
7
|
-
openInNewTab: any;
|
|
8
|
-
actions: any;
|
|
9
|
-
highlight: any;
|
|
10
|
-
}): React.JSX.Element;
|
|
11
|
-
import React from "react";
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CardContent = void 0;
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var styled_components_1 = require("styled-components");
|
|
9
|
-
var injectHttps_1 = require("../../../utils/injectHttps");
|
|
10
|
-
var utilsOolib_1 = require("../../../utilsOolib");
|
|
11
|
-
var ActionMenu_1 = require("../../ActionMenu");
|
|
12
|
-
var Typo_1 = require("../../Typo");
|
|
13
|
-
var VideoInput_1 = __importDefault(require("../../VideoInput"));
|
|
14
|
-
var MetaBlock_1 = __importDefault(require("../../MetaBlock"));
|
|
15
|
-
var LineClampWrapper_1 = require("../comps/LineClampWrapper");
|
|
16
|
-
var styled_1 = require("../styled");
|
|
17
|
-
var decideLinkCompAndTarget_1 = require("../utils/decideLinkCompAndTarget");
|
|
18
|
-
var dontRenderIfBothOnClickAndTo_1 = require("../utils/dontRenderIfBothOnClickAndTo");
|
|
19
|
-
var parseCardConfig_1 = require("../utils/parseCardConfig");
|
|
20
|
-
var mediaDataExists_1 = require("../utils/mediaDataExists");
|
|
21
|
-
var styled_2 = require("./styled");
|
|
22
|
-
var CardPlaceholder_1 = require("../comps/CardPlaceholder");
|
|
23
|
-
var ImageInput_1 = require("../../ImageInput");
|
|
24
|
-
var icons_1 = require("../../../icons");
|
|
25
|
-
var Tags_1 = require("../../Tags");
|
|
26
|
-
var CrownSimple = icons_1.icons.CrownSimple;
|
|
27
|
-
var CardContent = function (_a) {
|
|
28
|
-
var id = _a.id, data = _a.data, config = _a.config, to = _a.to, onClick = _a.onClick, openInNewTab = _a.openInNewTab, actions = _a.actions, highlight = _a.highlight;
|
|
29
|
-
var theme = (0, styled_components_1.useTheme)();
|
|
30
|
-
var localize = (0, utilsOolib_1.useLocale)();
|
|
31
|
-
var parseSpecialSyntax = (theme || {}).parseSpecialSyntax;
|
|
32
|
-
var showEmbedSection = !!((config === null || config === void 0 ? void 0 : config.image) || (config === null || config === void 0 ? void 0 : config.video));
|
|
33
|
-
var _b = (0, parseCardConfig_1.parseCardConfig)({
|
|
34
|
-
config: config,
|
|
35
|
-
data: data,
|
|
36
|
-
parseSpecialSyntax: parseSpecialSyntax
|
|
37
|
-
}), cardLabel = _b.cardLabel, title = _b.title, video = _b.video, image = _b.image, metaBlock = _b.metaBlock, tagDisplay = _b.tagDisplay;
|
|
38
|
-
var dontRenderRes = (0, dontRenderIfBothOnClickAndTo_1.dontRenderIfBothOnClickAndTo)({ onClick: onClick, to: to });
|
|
39
|
-
if (dontRenderRes)
|
|
40
|
-
return dontRenderRes;
|
|
41
|
-
var _c = (0, decideLinkCompAndTarget_1.decideLinkCompAndTarget)({ to: to, openInNewTab: openInNewTab }), LinkComp = _c.LinkComp, target = _c.target, externalUrl = _c.externalUrl;
|
|
42
|
-
return (react_1.default.createElement(LinkComp, { target: target, href: (0, injectHttps_1.injectHttps)(to), to: to },
|
|
43
|
-
react_1.default.createElement(styled_2.StyledCardWrapper, { id: id, highlight: highlight, onClick: onClick ? function (e) { return onClick(e, data); } : undefined },
|
|
44
|
-
highlight && react_1.default.createElement(styled_2.StyledCrownWrapper, null,
|
|
45
|
-
react_1.default.createElement(styled_2.StyledCrown, null,
|
|
46
|
-
react_1.default.createElement(CrownSimple, { size: 24 }))),
|
|
47
|
-
react_1.default.createElement(styled_2.StyledUpperSection, { highlight: highlight },
|
|
48
|
-
react_1.default.createElement(styled_2.StyledContainer1, null,
|
|
49
|
-
cardLabel ? (react_1.default.createElement("div", { title: cardLabel, style: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
gap: "2rem",
|
|
52
|
-
justifyContent: "space-between",
|
|
53
|
-
} },
|
|
54
|
-
react_1.default.createElement(Typo_1.LABEL, { style: {
|
|
55
|
-
textOverflow: "ellipsis",
|
|
56
|
-
overflow: "hidden",
|
|
57
|
-
whiteSpace: "nowrap",
|
|
58
|
-
}, color: (0, utilsOolib_1.getPrimaryColorText)(theme === null || theme === void 0 ? void 0 : theme.colors) }, cardLabel),
|
|
59
|
-
react_1.default.createElement("div", { style: { marginTop: "-1rem", marginRight: "-1rem" } }, actions && react_1.default.createElement(ActionMenu_1.ActionMenu, { actions: actions })))) : null,
|
|
60
|
-
title ? (react_1.default.createElement("div", { style: { display: "flex", alignItems: "end", gap: ".5rem" } },
|
|
61
|
-
" ",
|
|
62
|
-
react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { noOfLines_M: 6, title: title },
|
|
63
|
-
react_1.default.createElement(styled_1.StyledTitle, { capitalize: true, className: "StyledTitle" },
|
|
64
|
-
react_1.default.createElement(styled_1.StyledTitleSpan, { className: "StyledTitleSpan" }, localize(title)))))) : null),
|
|
65
|
-
tagDisplay && react_1.default.createElement(Tags_1.TagDisplay, { display: tagDisplay, color: "green" }),
|
|
66
|
-
(metaBlock === null || metaBlock === void 0 ? void 0 : metaBlock.length) > 0 ? (react_1.default.createElement(MetaBlock_1.default, { data: data, config: metaBlock }) //show only two meta for cardContent
|
|
67
|
-
) : null),
|
|
68
|
-
showEmbedSection && (react_1.default.createElement(styled_2.StyledEmbedSection, null,
|
|
69
|
-
!(0, mediaDataExists_1.imageDataExists)(image) && !(0, mediaDataExists_1.videoDataExists)(video) &&
|
|
70
|
-
react_1.default.createElement(CardPlaceholder_1.CardPlaceholder, null),
|
|
71
|
-
(0, mediaDataExists_1.imageDataExists)(image) && (react_1.default.createElement("div", { style: { width: "100%" } }, react_1.default.createElement(ImageInput_1.ImageInput, { value: image, aspectRatio: "5/3", readOnly: true, defaultImageSpread: "cover", enableCaptions: false, disableImageBorder: true }))),
|
|
72
|
-
(0, mediaDataExists_1.videoDataExists)(video) && !(0, mediaDataExists_1.imageDataExists)(image) ? (react_1.default.createElement("div", { style: { width: "100%", position: 'relative' } },
|
|
73
|
-
react_1.default.createElement(VideoInput_1.default, { value: video, readOnly: true, light: true }),
|
|
74
|
-
react_1.default.createElement("div", { style: { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' } }))) : null)))));
|
|
75
|
-
};
|
|
76
|
-
exports.CardContent = CardContent;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export const StyledContainer1: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export const StyledMetaBlock: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export const StyledEmbedSection: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export const StyledCardWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export const StyledUpperSection: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
-
export const StyledCrownWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
-
export const StyledCrown: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.StyledCrown = exports.StyledCrownWrapper = exports.StyledUpperSection = exports.StyledCardWrapper = exports.StyledEmbedSection = exports.StyledMetaBlock = exports.StyledContainer1 = void 0;
|
|
41
|
-
var styled_components_1 = __importStar(require("styled-components"));
|
|
42
|
-
var colors_1 = require("../../../themes/colors");
|
|
43
|
-
var transitions_1 = require("../../../themes/mixins/transitions");
|
|
44
|
-
var styled_1 = require("../styled");
|
|
45
|
-
var greyColor5 = colors_1.colors.greyColor5, white = colors_1.colors.white, invertGreen = colors_1.colors.invertGreen;
|
|
46
|
-
var flexColumn = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
|
|
47
|
-
exports.StyledContainer1 = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n gap: 1rem;\n"], ["\n ", "\n gap: 1rem;\n"])), flexColumn);
|
|
48
|
-
exports.StyledMetaBlock = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n gap: 0.5em;\n"], ["\n display: flex;\n gap: 0.5em;\n"])));
|
|
49
|
-
exports.StyledEmbedSection = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n height: 100px;\n display: flex;\n align-items: center;\n overflow: hidden;\n width: 100%;\n"], ["\n height: 100px;\n display: flex;\n align-items: center;\n overflow: hidden;\n width: 100%;\n"])));
|
|
50
|
-
exports.StyledCardWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n height: 100%;\n border: 2px solid ", ";\n background-color: ", "; \n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n ", "\n\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n ", ";\n #CardPlaceholder {\n opacity: 1;\n }\n }\n"], ["\n height: 100%;\n border: 2px solid ", ";\n background-color: ", "; \n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n ", "\n\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n ", ";\n #CardPlaceholder {\n opacity: 1;\n }\n }\n"])), greyColor5, function (_a) {
|
|
51
|
-
var highlight = _a.highlight;
|
|
52
|
-
return highlight ? colors_1.colors.lightGreen : greyColor5;
|
|
53
|
-
}, (0, transitions_1.transition)("background-color"), white, styled_1.CSSTitleAnimationOnHover);
|
|
54
|
-
exports.StyledUpperSection = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n /* height: 100%; */\n flex-grow: 1;\n justify-content: space-between;\n padding: 2rem;\n ", "\n gap: ", ";\n padding-top: ", ";\n"], ["\n /* height: 100%; */\n flex-grow: 1;\n justify-content: space-between;\n padding: 2rem;\n ", "\n gap: ", ";\n padding-top: ", ";\n"])), flexColumn, function (_a) {
|
|
55
|
-
var highlight = _a.highlight;
|
|
56
|
-
return highlight ? '2rem' : '3rem';
|
|
57
|
-
}, function (_a) {
|
|
58
|
-
var highlight = _a.highlight;
|
|
59
|
-
return highlight ? "1rem" : "2rem";
|
|
60
|
-
});
|
|
61
|
-
exports.StyledCrownWrapper = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: 100%;\n display: flex; \n justify-content: flex-end\n"], ["\n width: 100%;\n display: flex; \n justify-content: flex-end\n"])));
|
|
62
|
-
exports.StyledCrown = styled_components_1.default.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: max-content;\n background-color: ", ";\n padding: 1rem;\n"], ["\n width: max-content;\n background-color: ", ";\n padding: 1rem;\n"])), invertGreen);
|
|
63
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function ListContent({ id, data, config, to, onClick, openInNewTab, actions, statusTag, variant, }: {
|
|
2
|
-
id: any;
|
|
3
|
-
data: any;
|
|
4
|
-
config: any;
|
|
5
|
-
to: any;
|
|
6
|
-
onClick: any;
|
|
7
|
-
openInNewTab: any;
|
|
8
|
-
actions: any;
|
|
9
|
-
statusTag: any;
|
|
10
|
-
variant?: string;
|
|
11
|
-
}): React.JSX.Element;
|
|
12
|
-
import React from "react";
|