oolib 2.101.7 → 2.102.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.
@@ -31,7 +31,6 @@ var calcAspectRatio_1 = require("../../../ImageEditor/utils/calcAspectRatio");
31
31
  var themes_1 = require("../../../../../../themes");
32
32
  var icons_1 = require("../../../../../../icons");
33
33
  var Typo_1 = require("../../../../../Typo");
34
- var useSwipe_1 = require("../../../../../../utils/customHooks/useSwipe");
35
34
  var greyColor80 = themes_1.colors.greyColor80;
36
35
  var CaretLeft = icons_1.icons.CaretLeft, CaretRight = icons_1.icons.CaretRight;
37
36
  var SliderShell = function (_a) {
@@ -42,18 +41,8 @@ var SliderShell = function (_a) {
42
41
  (0, react_1.useEffect)(function () {
43
42
  setImageMinusCaptionHeight(wrapperRef.current.clientWidth / (0, calcAspectRatio_1.calcAspectRatio)(aspectRatio));
44
43
  }, []);
45
- var isTouchDevice = (0, react_1.useRef)('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
46
- var handleDragStart = (0, useSwipe_1.useSwipe)({
47
- isTouchDevice: isTouchDevice,
48
- onSlide: function (direction) {
49
- setActiveIdx(function (prevIdx) {
50
- return direction === 'right' ? (prevIdx < value.length - 1 ? prevIdx + 1 : 0) : (prevIdx > 0 ? prevIdx - 1 : value.length - 1);
51
- });
52
- },
53
- }).handleDragStart;
54
44
  return (react_1.default.createElement(styled_1.StyledFlexWrapper, { ref: wrapperRef },
55
- value.map(function (v, idx) { return (react_1.default.createElement(styled_1.StyledFlexItem, { key: (v === null || v === void 0 ? void 0 : v.publicUrl) || idx, marginLeft: idx === 0 && activeIdx * -100 + "%" },
56
- react_1.default.createElement("div", { onTouchStart: handleDragStart, onMouseDown: handleDragStart }, render(v, idx) /* explicitly called, cuz we want an error to throw if render prop aint passed thru */))); }),
45
+ value.map(function (v, idx) { return (react_1.default.createElement(styled_1.StyledFlexItem, { key: (v === null || v === void 0 ? void 0 : v.publicUrl) || idx, marginLeft: idx === 0 && activeIdx * -100 + "%" }, render(v, idx) /* explicitly called, cuz we want an error to throw if render prop aint passed thru */)); }),
57
46
  !isLoading && value.length > 1 && !imageUnderEdit && react_1.default.createElement(react_1.Fragment, null,
58
47
  react_1.default.createElement(styled_1.StyledCaretLeft, { onClick: function () {
59
48
  return setActiveIdx(activeIdx > 0 ? activeIdx - 1 : value.length - 1);
@@ -54,15 +54,26 @@ var makeArrayFromLength_1 = require("../../../../utils/makeArrayFromLength");
54
54
  var SingleImageInput_1 = require("../SingleImageInput");
55
55
  var GalleryThumbnails_1 = require("./comps/GalleryThumbnails");
56
56
  var SliderShell_1 = require("./comps/SliderShell");
57
+ var useSwipe_1 = require("../../../../utils/customHooks/useSwipe");
57
58
  var GallerySlider = function () {
58
59
  var _a = (0, ImageInputContext_1.useImageInputContext)(), value = _a.value, noOfImagesUploading = _a.noOfImagesUploading, invert = _a.invert;
59
60
  var _b = (0, react_1.useState)(0), activeIdx = _b[0], setActiveIdx = _b[1];
60
61
  (0, react_1.useEffect)(function () { return setActiveIdx(0); }, [value === null || value === void 0 ? void 0 : value.length]); // reset the activeidx with uploading new images(focus on the newly added Images)
61
62
  var uploadingPlaceholders = (0, makeArrayFromLength_1.makeArrayFromLength)(noOfImagesUploading).map(function (d) { return undefined; });
63
+ var isTouchDevice = (0, react_1.useRef)('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
64
+ var handleDragStart = (0, useSwipe_1.useSwipe)({
65
+ isTouchDevice: isTouchDevice,
66
+ onSlide: function (direction) {
67
+ setActiveIdx(function (prevIdx) {
68
+ return direction === 'right' ? (prevIdx < value.length - 1 ? prevIdx + 1 : 0) : (prevIdx > 0 ? prevIdx - 1 : value.length - 1);
69
+ });
70
+ },
71
+ }).handleDragStart;
62
72
  return (react_1.default.createElement(styled_1.StyledGallery, { invert: invert },
63
73
  react_1.default.createElement(GalleryThumbnails_1.GalleryThumbnails, { setActiveIdx: setActiveIdx, activeIdx: activeIdx }),
64
74
  (value === null || value === void 0 ? void 0 : value.length) > 0 ? (react_1.default.createElement(SliderShell_1.SliderShell, { value: __spreadArray(__spreadArray([], uploadingPlaceholders, true), value, true), activeIdx: activeIdx, setActiveIdx: setActiveIdx, render: function (v) { return (react_1.default.createElement(SingleImageInput_1.SingleImageInput, __assign({}, {
65
75
  value: v,
76
+ handleDragStart: handleDragStart,
66
77
  // key: v?.publicUrl || idx, //cuz this is done inside the SliderShell
67
78
  }))); } })) : (react_1.default.createElement(Placeholder_1.default, null))));
68
79
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * fiddle for dealing with rotation: https://jsfiddle.net/wunderbart/w1hw5kv1/
3
3
  */
4
- export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread, handleSingleImageDataChange, handleDeleteSingleImage, handleReplaceSingleImage, aspectRatio, invert, handleUpload, setImageUnderEdit, disableImageBorder, stretchToFullHeight, containerShape, omitEditorTools, enableCaptions, underEditImageData: _underEditImageData, setUnderEditImageData: _setUnderEditImageData, isInPopUp, isInRTE }: {
4
+ export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread, handleSingleImageDataChange, handleDeleteSingleImage, handleReplaceSingleImage, aspectRatio, invert, handleUpload, setImageUnderEdit, disableImageBorder, stretchToFullHeight, containerShape, omitEditorTools, enableCaptions, underEditImageData: _underEditImageData, setUnderEditImageData: _setUnderEditImageData, isInPopUp, isInRTE, handleDragStart }: {
5
5
  id: any;
6
6
  readOnly: any;
7
7
  value: any;
@@ -22,5 +22,6 @@ export function ImageEditor({ id, readOnly, value: imageData, defaultImageSpread
22
22
  setUnderEditImageData: any;
23
23
  isInPopUp: any;
24
24
  isInRTE: any;
25
+ handleDragStart: any;
25
26
  }, ...args: any[]): React.JSX.Element;
26
27
  import React from "react";
@@ -64,7 +64,7 @@ function ImageEditor(_a) {
64
64
  disableImageBorder = _a.disableImageBorder, stretchToFullHeight = _a.stretchToFullHeight, containerShape = _a.containerShape, omitEditorTools = _a.omitEditorTools, enableCaptions = _a.enableCaptions,
65
65
  //sent by parent ImageEditor to child (modal) ImageEditor
66
66
  _underEditImageData = _a.underEditImageData, //ImageEditor passes this to its recursive self when opening in popup
67
- _setUnderEditImageData = _a.setUnderEditImageData, isInPopUp = _a.isInPopUp, isInRTE = _a.isInRTE;
67
+ _setUnderEditImageData = _a.setUnderEditImageData, isInPopUp = _a.isInPopUp, isInRTE = _a.isInRTE, handleDragStart = _a.handleDragStart;
68
68
  var theme = (0, styled_components_1.useTheme)();
69
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
70
  //backwards compat
@@ -173,7 +173,7 @@ function ImageEditor(_a) {
173
173
  imageSpread: imageSpread,
174
174
  cropX: cropX,
175
175
  cropY: cropY,
176
- })),
176
+ }, { onTouchStart: handleDragStart && handleDragStart, onMouseDown: handleDragStart && handleDragStart })),
177
177
  underEditImageData !== undefined &&
178
178
  !omitEditorTools.includes("reposition") && (react_1.default.createElement(ImageReposManager_1.ImageReposManager, __assign({}, {
179
179
  fullWidthOrFullHeightImg: fullWidthOrFullHeightImg,
@@ -1,4 +1,5 @@
1
- export function SingleImageInput({ value, }: {
1
+ export function SingleImageInput({ value, handleDragStart }: {
2
2
  value: any;
3
+ handleDragStart: any;
3
4
  }): React.JSX.Element;
4
5
  import React from "react";
@@ -29,7 +29,8 @@ var Placeholder_1 = __importDefault(require("../Placeholder"));
29
29
  *
30
30
  */
31
31
  var SingleImageInput = function (_a) {
32
- var value = _a.value;
32
+ var value = _a.value, // this is a subset of ImageInput's value prop
33
+ handleDragStart = _a.handleDragStart;
33
34
  var _b = (0, ImageInputContext_1.useImageInputContext)(), id = _b.id, aspectRatio = _b.aspectRatio, onChange = _b.onChange, handleUpload = _b.handleUpload, publicUrlBeingReplaced = _b.publicUrlBeingReplaced, readOnly = _b.readOnly, enableCaptions = _b.enableCaptions, invert = _b.invert, containerShape = _b.containerShape, defaultImageSpread = _b.defaultImageSpread, handleSingleImageDataChange = _b.handleSingleImageDataChange, handleDeleteSingleImage = _b.handleDeleteSingleImage, handleReplaceSingleImage = _b.handleReplaceSingleImage, setImageUnderEdit = _b.setImageUnderEdit, stretchToFullHeight = _b.stretchToFullHeight, disableImageBorder = _b.disableImageBorder, omitEditorTools = _b.omitEditorTools, isInRTE = _b.isInRTE;
34
35
  //this helps for the ImageSlider, since ImageSlider uses SingleImageInput as child
35
36
  var isBeingReplaced = publicUrlBeingReplaced && publicUrlBeingReplaced === (value === null || value === void 0 ? void 0 : value.publicUrl);
@@ -51,7 +52,8 @@ var SingleImageInput = function (_a) {
51
52
  stretchToFullHeight: stretchToFullHeight,
52
53
  disableImageBorder: disableImageBorder,
53
54
  omitEditorTools: omitEditorTools,
54
- isInRTE: isInRTE
55
+ isInRTE: isInRTE,
56
+ handleDragStart: handleDragStart
55
57
  })));
56
58
  };
57
59
  exports.SingleImageInput = SingleImageInput;
@@ -61,3 +61,4 @@ export declare const USAFlag: (props: any) => React.JSX.Element;
61
61
  export declare const IndonesiaFlag: (props: any) => React.JSX.Element;
62
62
  export declare const ChileFlag: (props: any) => React.JSX.Element;
63
63
  export declare const PakistanFlag: (props: any) => React.JSX.Element;
64
+ export declare const SpainFlag: (props: any) => React.JSX.Element;
@@ -15,7 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.USAFlag = exports.UKFlag = exports.MalaysiaFlag = exports.ColombiaFlag = exports.BrazilFlag = exports.AudioEmbedIcon = exports.VideoEmbedIcon = exports.Attachment2 = exports.PDFIcon = exports.RichFormatToolOrderedList = exports.RichFormatToolUnorderedList = exports.RichFormatToolH2 = exports.RichFormatToolBlockquote = exports.LinkIcon = exports.UnderlineBtn = exports.ItalicBtn = exports.BoldBtn = exports.SettingsSM = exports.Close_S = exports.UploadImage = exports.KebabMenu = exports.Website_solid_SM = exports.Phone_solid_SM = exports.Mail_solid_SM = exports.Youtube_solid_SM = exports.Instagram_solid_SM = exports.Twitter_solid_SM = exports.Linkedin_solid_SM = exports.Facebook_solid_SM = exports.EditSM = exports.AddXS = exports.UploadSM = exports.Download = exports.Download__nofill = exports.Index = exports.Person14 = exports.Location14 = exports.ModalBulbIcon = exports.KenyaFlag = exports.NigeriaFlag = exports.IndiaFlag = exports.BadgeVetted = exports.BadgeMod = exports.BadgeSuperAdmin = exports.BadgeAdmin = exports.OkeGoogleIcon = exports.LetterH = exports.LanguageIcon = exports.MultipleImages = exports.IndexIcon = void 0;
18
- exports.PakistanFlag = exports.ChileFlag = exports.IndonesiaFlag = void 0;
18
+ exports.SpainFlag = exports.PakistanFlag = exports.ChileFlag = exports.IndonesiaFlag = void 0;
19
19
  var react_1 = __importDefault(require("react"));
20
20
  var themes_1 = require("../../themes");
21
21
  var DisplayIcon_1 = require("../../utils/comps/DisplayIcon");
@@ -410,3 +410,16 @@ var PakistanFlag = function (props) {
410
410
  react_1.default.createElement("path", { fill: "#fff", d: "M8.751-17.959l10.11 11.373L3.997-9.844l13.94-6.1-7.692 13.129z" })));
411
411
  };
412
412
  exports.PakistanFlag = PakistanFlag;
413
+ var SpainFlag = function (props) {
414
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "40", height: "40", viewBox: "0 0 36 36" },
415
+ react_1.default.createElement("path", { fill: "#C60A1D", d: "M36 27a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4h28a4 4 0 0 1 4 4z" }),
416
+ react_1.default.createElement("path", { fill: "#FFC400", d: "M0 12h36v12H0z" }),
417
+ react_1.default.createElement("path", { fill: "#EA596E", d: "M9 17v3a3 3 0 1 0 6 0v-3z" }),
418
+ react_1.default.createElement("path", { fill: "#F4A2B2", d: "M12 16h3v3h-3z" }),
419
+ react_1.default.createElement("path", { fill: "#DD2E44", d: "M9 16h3v3H9z" }),
420
+ react_1.default.createElement("ellipse", { cx: "12", cy: "14.5", fill: "#EA596E", rx: "3", ry: "1.5" }),
421
+ react_1.default.createElement("ellipse", { cx: "12", cy: "13.75", fill: "#FFAC33", rx: "3", ry: ".75" }),
422
+ react_1.default.createElement("path", { fill: "#99AAB5", d: "M7 16h1v7H7zm9 0h1v7h-1z" }),
423
+ react_1.default.createElement("path", { fill: "#66757F", d: "M6 22h3v1H6zm9 0h3v1h-3zm-8-7h1v1H7zm9 0h1v1h-1z" })));
424
+ };
425
+ exports.SpainFlag = SpainFlag;
@@ -162,6 +162,7 @@ export namespace icons {
162
162
  export { ColombiaFlag };
163
163
  export { ChileFlag };
164
164
  export { PakistanFlag };
165
+ export { SpainFlag };
165
166
  }
166
167
  import { PencilSimple } from "phosphor-react";
167
168
  import { PencilLine } from "phosphor-react";
@@ -326,3 +327,4 @@ import { BrazilFlag } from "./custom";
326
327
  import { ColombiaFlag } from "./custom";
327
328
  import { ChileFlag } from "./custom";
328
329
  import { PakistanFlag } from "./custom";
330
+ import { SpainFlag } from "./custom";
@@ -167,5 +167,6 @@ exports.icons = {
167
167
  BrazilFlag: custom_1.BrazilFlag,
168
168
  ColombiaFlag: custom_1.ColombiaFlag,
169
169
  ChileFlag: custom_1.ChileFlag,
170
- PakistanFlag: custom_1.PakistanFlag
170
+ PakistanFlag: custom_1.PakistanFlag,
171
+ SpainFlag: custom_1.SpainFlag
171
172
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.101.7",
3
+ "version": "2.102.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",