oolib 2.98.0 → 2.99.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.
@@ -102,8 +102,8 @@ var TextInput = function (props) {
102
102
  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
103
103
  _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
104
104
  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
105
- _validationStatus = props.validationStatus;
106
- var _e = (0, react_1.useState)(_validationStatus), validationStatus = _e[0], setValidationStatus = _e[1];
105
+ _validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e;
106
+ var _f = (0, react_1.useState)(_validationStatus), validationStatus = _f[0], setValidationStatus = _f[1];
107
107
  (0, react_1.useEffect)(function () {
108
108
  setValidationStatus(_validationStatus);
109
109
  }, [_validationStatus]);
@@ -173,7 +173,7 @@ var TextInput = function (props) {
173
173
  react_1.default.createElement(LoadersAndProgress_1.LoaderCircle, { S: true, invert: invert }))),
174
174
  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" } })),
175
175
  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" } }))),
176
- (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 },
176
+ (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 },
177
177
  react_1.default.createElement(Typo_1.SANS_3, null,
178
178
  validationStatus.msg,
179
179
  validationStatus.link && (react_1.default.createElement(OKELink_1.OKELink, { style: { marginLeft: "1rem" }, to: validationStatus.link.to }, validationStatus.link.text))))))))));
@@ -34,15 +34,23 @@ var EmbedLinkModal = function (_a) {
34
34
  var _b;
35
35
  var id = _a.id, setShowEmbedLinkModal = _a.setShowEmbedLinkModal, value = _a.value, createVideoPreview = _a.createVideoPreview, canPlay = _a.canPlay, onChange = _a.onChange, invert = _a.invert;
36
36
  var _c = (0, react_1.useState)(value), localValue = _c[0], setLocalValue = _c[1];
37
+ var _d = (0, react_1.useState)(false), isValidURl = _d[0], setIsValidUrl = _d[1];
37
38
  return (react_1.default.createElement(Modal_1.Modal, { title: "Add URL Embed", subTitle: "Paste the link of the video you want to share. ",
38
39
  // invert={invert}
39
40
  desktopWidth: "50vw", fitToContentHeight: true, onClose: function () {
40
41
  setShowEmbedLinkModal(false);
41
42
  } },
42
43
  react_1.default.createElement("div", { style: { padding: '2rem' } },
43
- react_1.default.createElement(TextInputs_1.TextInput, { icon: "LinkSimple", onChange: function (k, v) { return setLocalValue(v ? [{ publicUrl: v }] : undefined); }, value: localValue && ((_b = localValue[0]) === null || _b === void 0 ? void 0 : _b.publicUrl), placeholder: "Paste a url here", clearBtn: { text: 'clear' } }),
44
- localValue && react_1.default.createElement(Paddings_1.PaddingBottom20, null),
45
- createVideoPreview({ value: localValue }),
44
+ react_1.default.createElement(TextInputs_1.URLInput, { icon: "LinkSimple", onChange: function (k, v) { return setLocalValue(v ? [{ publicUrl: v }] : undefined); }, value: localValue && ((_b = localValue[0]) === null || _b === void 0 ? void 0 : _b.publicUrl), placeholder: "Paste a url here", clearBtn: { text: 'clear' }, displayValidationMsg: false, passValidationErrorToFormValidation: function (status) {
45
+ if (status === "error") {
46
+ setIsValidUrl(false);
47
+ }
48
+ else {
49
+ setIsValidUrl(true);
50
+ }
51
+ } }),
52
+ (localValue && isValidURl) && react_1.default.createElement(Paddings_1.PaddingBottom20, null),
53
+ isValidURl && createVideoPreview({ value: localValue }),
46
54
  react_1.default.createElement(styled_1.StyledModalActionButtons, null,
47
55
  react_1.default.createElement(Buttons_1.ButtonPrimary, { value: "Embed", disabled: !canPlay(localValue) || !localValue,
48
56
  // invert={invert}
@@ -88,6 +88,7 @@ function VideoInput(_a) {
88
88
  onError: function (err) {
89
89
  var _a;
90
90
  SET_ALERT_BANNER(((_a = err.response) === null || _a === void 0 ? void 0 : _a.data.errors[0].msg) || err.message, "red", 3500);
91
+ onChange(undefined);
91
92
  },
92
93
  });
93
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.98.0",
3
+ "version": "2.99.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",