oolib 2.96.1 → 2.98.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,6 +31,7 @@ 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");
34
35
  var greyColor80 = themes_1.colors.greyColor80;
35
36
  var CaretLeft = icons_1.icons.CaretLeft, CaretRight = icons_1.icons.CaretRight;
36
37
  var SliderShell = function (_a) {
@@ -41,7 +42,16 @@ var SliderShell = function (_a) {
41
42
  (0, react_1.useEffect)(function () {
42
43
  setImageMinusCaptionHeight(wrapperRef.current.clientWidth / (0, calcAspectRatio_1.calcAspectRatio)(aspectRatio));
43
44
  }, []);
44
- return (react_1.default.createElement(styled_1.StyledFlexWrapper, { ref: wrapperRef },
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
+ return (react_1.default.createElement(styled_1.StyledFlexWrapper, { ref: wrapperRef, onTouchStart: handleDragStart, onMouseDown: handleDragStart },
45
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 + "%" }, render(v, idx) /* explicitly called, cuz we want an error to throw if render prop aint passed thru */)); }),
46
56
  !isLoading && value.length > 1 && !imageUnderEdit && react_1.default.createElement(react_1.Fragment, null,
47
57
  react_1.default.createElement(styled_1.StyledCaretLeft, { onClick: function () {
@@ -59,3 +59,5 @@ export declare const MalaysiaFlag: (props: any) => React.JSX.Element;
59
59
  export declare const UKFlag: (props: any) => React.JSX.Element;
60
60
  export declare const USAFlag: (props: any) => React.JSX.Element;
61
61
  export declare const IndonesiaFlag: (props: any) => React.JSX.Element;
62
+ export declare const ChileFlag: (props: any) => React.JSX.Element;
63
+ export declare const PakistanFlag: (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.IndonesiaFlag = void 0;
18
+ 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");
@@ -394,3 +394,19 @@ var IndonesiaFlag = function (props) {
394
394
  react_1.default.createElement("path", { fill: "#EEE", d: "M36 27a4 4 0 01-4 4H4a4 4 0 01-4-4v-9h36v9z" })));
395
395
  };
396
396
  exports.IndonesiaFlag = IndonesiaFlag;
397
+ var ChileFlag = function (props) {
398
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 30, height: 30, fill: "none", viewBox: "-4 -4 24 16" },
399
+ react_1.default.createElement("path", { d: "M20 12H-4V-4h24z", fill: "#d52b1e" }),
400
+ react_1.default.createElement("path", { d: "M4 4h16v-8H-4z", fill: "#fff" }),
401
+ react_1.default.createElement("path", { d: "M4 4h-8v-8h8z", fill: "#0039a6" })));
402
+ };
403
+ exports.ChileFlag = ChileFlag;
404
+ var PakistanFlag = function (props) {
405
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 30, height: 30, fill: "none", viewBox: "-75 -40 120 80" },
406
+ react_1.default.createElement("path", { fill: "#fff", d: "M-75-40H45v80H-75z" }),
407
+ react_1.default.createElement("path", { fill: "#01411C", d: "M-45-40h90v80h-90z" }),
408
+ react_1.default.createElement("circle", { r: "24", fill: "#fff" }),
409
+ react_1.default.createElement("circle", { r: "22", cx: "-7", cy: "-40", fill: "#01411C", transform: "rotate(-41.634 45 -40)" }),
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
+ };
412
+ exports.PakistanFlag = PakistanFlag;
@@ -160,6 +160,8 @@ export namespace icons {
160
160
  export { MalaysiaFlag };
161
161
  export { BrazilFlag };
162
162
  export { ColombiaFlag };
163
+ export { ChileFlag };
164
+ export { PakistanFlag };
163
165
  }
164
166
  import { PencilSimple } from "phosphor-react";
165
167
  import { PencilLine } from "phosphor-react";
@@ -322,3 +324,5 @@ import { UKFlag } from "./custom";
322
324
  import { MalaysiaFlag } from "./custom";
323
325
  import { BrazilFlag } from "./custom";
324
326
  import { ColombiaFlag } from "./custom";
327
+ import { ChileFlag } from "./custom";
328
+ import { PakistanFlag } from "./custom";
@@ -165,5 +165,7 @@ exports.icons = {
165
165
  UKFlag: custom_1.UKFlag,
166
166
  MalaysiaFlag: custom_1.MalaysiaFlag,
167
167
  BrazilFlag: custom_1.BrazilFlag,
168
- ColombiaFlag: custom_1.ColombiaFlag
168
+ ColombiaFlag: custom_1.ColombiaFlag,
169
+ ChileFlag: custom_1.ChileFlag,
170
+ PakistanFlag: custom_1.PakistanFlag
169
171
  };
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ export { ModalConfirm } from "./components/Modals/ModalConfirm";
31
31
  export { ModalForms } from "./components/Modals/derivedComps/ModalForms";
32
32
  export { Modal } from "./components/Modals/Modal";
33
33
  export { ModalSmall } from "./components/Modals/derivedComps/ModalSmall";
34
- export { EmptyStates } from "./components/EmptyStates2";
34
+ export { EmptyStates } from "./components/EmptyStates";
35
35
  export { HomeCover } from "./components/HomeCover";
36
36
  export { PageScrollIndicator } from "./components/PageScrollIndicator";
37
37
  export { BarChart } from "./components/dataViz/comps/BarChart";
package/dist/index.js CHANGED
@@ -76,8 +76,8 @@ var Modal_1 = require("./components/Modals/Modal");
76
76
  Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return Modal_1.Modal; } });
77
77
  var ModalSmall_1 = require("./components/Modals/derivedComps/ModalSmall");
78
78
  Object.defineProperty(exports, "ModalSmall", { enumerable: true, get: function () { return ModalSmall_1.ModalSmall; } });
79
- var EmptyStates2_1 = require("./components/EmptyStates2");
80
- Object.defineProperty(exports, "EmptyStates", { enumerable: true, get: function () { return EmptyStates2_1.EmptyStates; } });
79
+ var EmptyStates_1 = require("./components/EmptyStates");
80
+ Object.defineProperty(exports, "EmptyStates", { enumerable: true, get: function () { return EmptyStates_1.EmptyStates; } });
81
81
  var HomeCover_1 = require("./components/HomeCover");
82
82
  Object.defineProperty(exports, "HomeCover", { enumerable: true, get: function () { return HomeCover_1.HomeCover; } });
83
83
  var PageScrollIndicator_1 = require("./components/PageScrollIndicator");
@@ -0,0 +1,6 @@
1
+ export function useSwipe({ isTouchDevice, onSlide }: {
2
+ isTouchDevice: any;
3
+ onSlide: any;
4
+ }): {
5
+ handleDragStart: (e: any) => void;
6
+ };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSwipe = void 0;
4
+ var react_1 = require("react");
5
+ // A custom hook for handling swipe gestures.
6
+ var useSwipe = function (_a) {
7
+ var isTouchDevice = _a.isTouchDevice, onSlide = _a.onSlide;
8
+ var isSliding = (0, react_1.useRef)(false); // A reference to track if sliding is happening or not.
9
+ var dragStartX = (0, react_1.useRef)(null); // A reference to track the start position of the drag.
10
+ var dragDistance = (0, react_1.useRef)(0); // A reference to track the distance of the drag.
11
+ //Handles the start of the drag gesture.
12
+ var handleDragStart = function (e) {
13
+ e.preventDefault();
14
+ // Set the initial drag start position
15
+ dragStartX.current = isTouchDevice.current ? e.touches[0].clientX : e.clientX;
16
+ // Reset the drag distance
17
+ dragDistance.current = 0;
18
+ // Set the sliding flag to false
19
+ isSliding.current = false;
20
+ // Add event listeners for touch or mouse move and end events
21
+ if (isTouchDevice.current) {
22
+ document.body.addEventListener('touchmove', handleDragMove, { passive: false });
23
+ document.body.addEventListener('touchend', handleDragEnd);
24
+ }
25
+ else {
26
+ document.body.addEventListener('mousemove', handleDragMove);
27
+ document.body.addEventListener('mouseup', handleDragEnd);
28
+ }
29
+ };
30
+ //Handles the move of the drag gesture.
31
+ var handleDragMove = function (e) {
32
+ // Get the clientX value based on the device type
33
+ var clientX = isTouchDevice.current ? e.touches[0].clientX : e.clientX;
34
+ // Calculate the drag distance
35
+ dragDistance.current = clientX - dragStartX.current;
36
+ // Check if sliding is happening
37
+ if (Math.abs(dragDistance.current) > 20 && !isSliding.current) {
38
+ // Determine the direction of the slide
39
+ var direction = dragDistance.current > 0 ? 'left' : 'right';
40
+ // Call the onSlide function with the direction
41
+ onSlide(direction);
42
+ // Reset the drag start position and distance
43
+ dragStartX.current = clientX;
44
+ dragDistance.current = 0;
45
+ // Set the sliding flag
46
+ isSliding.current = true;
47
+ }
48
+ };
49
+ // Handles the end of the drag gesture.
50
+ var handleDragEnd = function () {
51
+ // Remove event listeners based on device type
52
+ if (isTouchDevice.current) {
53
+ document.body.removeEventListener('touchmove', handleDragMove);
54
+ document.body.removeEventListener('touchend', handleDragEnd);
55
+ }
56
+ else {
57
+ document.body.removeEventListener('mousemove', handleDragMove);
58
+ document.body.removeEventListener('mouseup', handleDragEnd);
59
+ }
60
+ // Reset drag start coordinates, drag distance, and sliding flag
61
+ dragStartX.current = null;
62
+ dragDistance.current = 0;
63
+ isSliding.current = false;
64
+ };
65
+ return {
66
+ handleDragStart: handleDragStart,
67
+ };
68
+ };
69
+ exports.useSwipe = useSwipe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.96.1",
3
+ "version": "2.98.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",