oolib 2.82.1 → 2.82.3

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.
@@ -66,7 +66,7 @@ function DropdownMulti(_a) {
66
66
  S = _a.S, disabled = _a.disabled, broadcastShowOptions = _a.broadcastShowOptions;
67
67
  var theme = (0, styled_components_1.useTheme)();
68
68
  var props = arguments[0];
69
- var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme });
69
+ var value = (0, getValue_1.getValue_MULTI)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
70
70
  //1 INIT REFS
71
71
  var _b = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _b.selectRef, dropdownRef = _b.dropdownRef;
72
72
  //2 INIT SHOW OPTIONS STATE
@@ -75,7 +75,7 @@ function DropdownSingle(_a) {
75
75
  ;
76
76
  var theme = (0, styled_components_1.useTheme)();
77
77
  var props = arguments[0];
78
- var value = (0, getValue_1.getValue_SINGLE)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme });
78
+ var value = (0, getValue_1.getValue_SINGLE)({ valueProp: valueProp, optionsFn: optionsFn, options: optionsProp, theme: theme, saveValueAsString: saveValueAsString });
79
79
  //1 INIT REFS
80
80
  var _b = (0, useCreateDropdownRefs_1.useCreateDropdownRefs)(), selectRef = _b.selectRef, dropdownRef = _b.dropdownRef;
81
81
  //2 INIT SHOW OPTIONS STATE
@@ -1,12 +1,14 @@
1
- export function getValue_SINGLE({ valueProp, optionsFn, options, theme }: {
1
+ export function getValue_SINGLE({ valueProp, optionsFn, options, theme, saveValueAsString }: {
2
2
  valueProp: any;
3
3
  optionsFn: any;
4
4
  options: any;
5
5
  theme: any;
6
+ saveValueAsString: any;
6
7
  }): any;
7
- export function getValue_MULTI({ valueProp, optionsFn, options, theme }: {
8
+ export function getValue_MULTI({ valueProp, optionsFn, options, theme, saveValueAsString }: {
8
9
  valueProp: any;
9
10
  optionsFn: any;
10
11
  options: any;
11
12
  theme: any;
13
+ saveValueAsString: any;
12
14
  }): any;
@@ -9,18 +9,20 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.getValue_MULTI = exports.getValue_SINGLE = void 0;
11
11
  var getAllOptionsFns_1 = require("./getAllOptionsFns");
12
+ // Note: - saveValueAsString can be misleading here, because the value could be a string, integer, boolean values
13
+ // maybe we can rename to saveValueOnly, or some better name
12
14
  var getValue_SINGLE = function (_a) {
13
15
  var _b;
14
- var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme;
15
- return !!valueProp === true && typeof valueProp === 'string'
16
+ var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
17
+ return saveValueAsString
16
18
  ? (optionsFn ? (_b = (0, getAllOptionsFns_1.getAllOptionsFns)(theme))[optionsFn.fn].apply(_b, (optionsFn.args || [])) : options).find(function (d) { return d.value === valueProp; })
17
19
  : valueProp;
18
20
  };
19
21
  exports.getValue_SINGLE = getValue_SINGLE;
20
22
  var getValue_MULTI = function (_a) {
21
- var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme;
22
- return !!valueProp === true && valueProp.every(function (v) { return typeof v === 'string'; })
23
- ? valueProp.map(function (vProp) {
23
+ var valueProp = _a.valueProp, optionsFn = _a.optionsFn, options = _a.options, theme = _a.theme, saveValueAsString = _a.saveValueAsString;
24
+ return saveValueAsString
25
+ ? valueProp === null || valueProp === void 0 ? void 0 : valueProp.map(function (vProp) {
24
26
  var _a;
25
27
  return (optionsFn ? (_a = (0, getAllOptionsFns_1.getAllOptionsFns)(theme))[optionsFn.fn].apply(_a, (optionsFn.args || [])) : options).find(function (d) { return d.value === vProp; });
26
28
  })
@@ -66,10 +66,12 @@ function ImageEditor(_a) {
66
66
  _underEditImageData = _a.underEditImageData, //ImageEditor passes this to its recursive self when opening in popup
67
67
  _setUnderEditImageData = _a.setUnderEditImageData, isInPopUp = _a.isInPopUp, isInRTE = _a.isInRTE;
68
68
  var theme = (0, styled_components_1.useTheme)();
69
- var _b = theme || {}, RichTextEditor = _b.RichTextEditor, _c = _b.richTextHasValue //we are just defaulting to false for oolib preview. Meaning, when previewing in oolib, since this function doesnt exist (as it has to be provided by okf-fe), we will always return false from it.
70
- , richTextHasValue = _c === void 0 ? function () { return false; } : _c //we are just defaulting to false for oolib preview. Meaning, when previewing in oolib, since this function doesnt exist (as it has to be provided by okf-fe), we will always return false from it.
71
- ; //temporarily passed thru from okf
72
- var _d = (0, react_1.useState)(_underEditImageData || undefined), underEditImageData = _d[0], setUnderEditImageData = _d[1];
69
+ var _b = theme || {}, LexicalTextEditor = _b.LexicalTextEditor, _c = _b.lexicalTextEditorHasValue, lexicalTextEditorHasValue = _c === void 0 ? function () { return false; } : _c, //we are just defaulting to false for oolib preview. Meaning, when previewing in oolib, since this function doesnt exist (as it has to be provided by okf-fe), we will always return false from it.
70
+ //backwards compat
71
+ _d = _b.richTextHasValue, //we are just defaulting to false for oolib preview. Meaning, when previewing in oolib, since this function doesnt exist (as it has to be provided by okf-fe), we will always return false from it.
72
+ //backwards compat
73
+ richTextHasValue = _d === void 0 ? function () { return false; } : _d; //temporarily passed thru from okf
74
+ var _e = (0, react_1.useState)(_underEditImageData || undefined), underEditImageData = _e[0], setUnderEditImageData = _e[1];
73
75
  //set state in parent imageeditor
74
76
  (0, react_1.useEffect)(function () {
75
77
  _setUnderEditImageData && _setUnderEditImageData(underEditImageData);
@@ -83,15 +85,15 @@ function ImageEditor(_a) {
83
85
  * underEditImageData is merged into imageData, only if the 'formattings'
84
86
  * are 'saved'
85
87
  */
86
- var _e = underEditImageData || imageData, publicUrl = _e.publicUrl, _f = _e.imageSpread, imageSpread = _f === void 0 ? defaultImageSpread : _f, _g = _e.imageRotate, imageRotate = _g === void 0 ? 0 : _g, _h = _e.cropX, cropX = _h === void 0 ? 0 : _h, _j = _e.cropY, cropY = _j === void 0 ? 0 : _j;
88
+ var _f = underEditImageData || imageData, publicUrl = _f.publicUrl, _g = _f.imageSpread, imageSpread = _g === void 0 ? defaultImageSpread : _g, _h = _f.imageRotate, imageRotate = _h === void 0 ? 0 : _h, _j = _f.cropX, cropX = _j === void 0 ? 0 : _j, _k = _f.cropY, cropY = _k === void 0 ? 0 : _k;
87
89
  /**
88
90
  * repos management
89
91
  */
90
92
  var wrapperRef = (0, react_1.useRef)(null);
91
93
  var renderedImageRef = (0, react_1.useRef)(null);
92
94
  var isFirstMount = (0, react_1.useRef)(true);
93
- var _k = (0, react_1.useState)(undefined), fullWidthOrFullHeightImg = _k[0], setFullWidthOrFullHeightImg = _k[1];
94
- var _l = (0, useReorientImage_1.useReorientImage)({
95
+ var _l = (0, react_1.useState)(undefined), fullWidthOrFullHeightImg = _l[0], setFullWidthOrFullHeightImg = _l[1];
96
+ var _m = (0, useReorientImage_1.useReorientImage)({
95
97
  imageRotate: imageRotate,
96
98
  setFullWidthOrFullHeightImg: setFullWidthOrFullHeightImg,
97
99
  setUnderEditImageData: setUnderEditImageData,
@@ -101,10 +103,10 @@ function ImageEditor(_a) {
101
103
  isFirstMount: isFirstMount,
102
104
  handleDeleteSingleImage: handleDeleteSingleImage,
103
105
  readOnly: readOnly
104
- }), reorientedImageTempUrl = _l.reorientedImageTempUrl, imageLazyLoading = _l.imageLazyLoading;
105
- var _m = (0, react_1.useState)(undefined), showDeleteImageModal = _m[0], setShowDeleteImageModal = _m[1];
106
+ }), reorientedImageTempUrl = _m.reorientedImageTempUrl, imageLazyLoading = _m.imageLazyLoading;
107
+ var _o = (0, react_1.useState)(undefined), showDeleteImageModal = _o[0], setShowDeleteImageModal = _o[1];
106
108
  var inputRef = (0, react_1.useRef)(null);
107
- var _o = (0, react_1.useState)(undefined), editorStyle = _o[0], setEditorStyle = _o[1]; //alt: modal
109
+ var _p = (0, react_1.useState)(undefined), editorStyle = _p[0], setEditorStyle = _p[1]; //alt: modal
108
110
  (0, react_1.useEffect)(function () { isFirstMount.current = false; }, []);
109
111
  var decideEditorStyle = function () {
110
112
  var _a = wrapperRef.current.getBoundingClientRect(), width = _a.width, height = _a.height;
@@ -196,7 +198,9 @@ function ImageEditor(_a) {
196
198
  handleUpload: handleUpload,
197
199
  isInRTE: isInRTE
198
200
  }))) : editorStyle === "toolbar" ? (genToolbarStyledEditor()) : (editorStyle === "modal" && genModalStyleEditor()))),
199
- enableCaptions && (readOnly && !richTextHasValue(imageData.caption)
201
+ enableCaptions && (readOnly &&
202
+ !lexicalTextEditorHasValue(imageData.caption) &&
203
+ !richTextHasValue(imageData.caption) //backwards compat cuz its possible caption data might be in draftjs shape
200
204
  ? null
201
205
  : react_1.default.createElement(react_1.Fragment, null,
202
206
  react_1.default.createElement(Divider_1.Divider, { invert: invert }),
@@ -204,12 +208,12 @@ function ImageEditor(_a) {
204
208
  borderRadius: "0.2rem",
205
209
  padding: readOnly ? "1rem" : "2rem",
206
210
  backgroundColor: readOnly ? "initial" : invert ? themes_1.colors.greyColor90 : themes_1.colors.greyColor5,
207
- } }, !RichTextEditor
211
+ } }, !LexicalTextEditor
208
212
  ? (0, renderRTEPlaceholderForOolibPreview_1.renderRTEPlaceholderForOolibPreview)({
209
213
  width: '100%',
210
214
  height: '30px'
211
215
  })
212
- : react_1.default.createElement(RichTextEditor, { variant: 'simple', disableNewline: true, invert: invert, placeholder: "type caption for image (optional)", readOnly: readOnly, charLimit: 100, typo: "SANS_3", placeholderColor: invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor40, value: imageData.caption, onChange: function (id, val) {
216
+ : react_1.default.createElement(LexicalTextEditor, { variant: 'simple', disableNewline: true, invert: invert, placeholder: "type caption for image (optional)", readOnly: readOnly, charLimit: 100, typo: "SANS_3", placeholderColor: invert ? themes_1.colors.greyColor70 : themes_1.colors.greyColor40, value: imageData.caption, onChange: function (id, val) {
213
217
  handleSingleImageDataChange({
214
218
  publicUrl: publicUrl,
215
219
  imageData: __assign(__assign({}, imageData), { caption: val }),
@@ -44,7 +44,7 @@ var genColor = function (_a) {
44
44
  };
45
45
  exports.genColor = genColor;
46
46
  //separated out this way so we can use it in LexicalTextEditor's StyledEditorWrapperLex
47
- exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: calc(100vw - 4rem); //the margin on mobile is 2rem each on both sides \n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"], ["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: calc(100vw - 4rem); //the margin on mobile is 2rem each on both sides \n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"])), function (_a) {
47
+ exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: 100%;\n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"], ["\ncursor: ", ";\n display: inline-flex;\n gap: 0.7rem;\n align-items: center;\n max-width: 100%;\n text-decoration: none;\n position: relative;\n color: ", ";\n\n &::after{\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n width: ", ";\n height: ", ";\n pointer-events: ", ";\n ", ";\n background-color: ", ";\n }\n\n &:hover{\n color: ", ";\n &::after{ width: ", "; }\n }\n"])), function (_a) {
48
48
  var disabled = _a.disabled;
49
49
  return !disabled ? 'pointer' : 'not-allowed';
50
50
  }, exports.genColor, function (_a) {
@@ -61,5 +61,5 @@ exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (tem
61
61
  return invertUnderline ? '100%' : 0;
62
62
  });
63
63
  exports.StyledLink = styled_components_1.default.a(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.styledOKELinkCSS);
64
- exports.StyledLinkText = styled_components_1.default.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n white-space: nowrap;\n /** might need some ellipsis stuff here. but it doesnt work with inline-flex. which is on StyledLink */ \n"], ["\n white-space: nowrap;\n /** might need some ellipsis stuff here. but it doesnt work with inline-flex. which is on StyledLink */ \n"])));
64
+ exports.StyledLinkText = styled_components_1.default.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n max-width: 100%;\n ", ";\n"], ["\n max-width: 100%;\n ", ";\n"])), mixins_1.ellipsis);
65
65
  var templateObject_1, templateObject_2, templateObject_3;
@@ -3,6 +3,7 @@ export namespace icons {
3
3
  export { PencilLine };
4
4
  export { Plus };
5
5
  export { Lightbulb };
6
+ export { Tag };
6
7
  export { UploadSimple };
7
8
  export { CaretLeft };
8
9
  export { CaretRight };
@@ -161,6 +162,7 @@ import { PencilSimple } from "phosphor-react";
161
162
  import { PencilLine } from "phosphor-react";
162
163
  import { Plus } from "phosphor-react";
163
164
  import { Lightbulb } from "phosphor-react";
165
+ import { Tag } from "phosphor-react";
164
166
  import { UploadSimple } from "phosphor-react";
165
167
  import { CaretLeft } from "phosphor-react";
166
168
  import { CaretRight } from "phosphor-react";
@@ -8,6 +8,7 @@ exports.icons = {
8
8
  PencilLine: phosphor_react_1.PencilLine,
9
9
  Plus: phosphor_react_1.Plus,
10
10
  Lightbulb: phosphor_react_1.Lightbulb,
11
+ Tag: phosphor_react_1.Tag,
11
12
  UploadSimple: phosphor_react_1.UploadSimple,
12
13
  CaretLeft: phosphor_react_1.CaretLeft,
13
14
  CaretRight: phosphor_react_1.CaretRight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.82.1",
3
+ "version": "2.82.3",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",