oolib 2.42.1 → 2.42.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.
@@ -16,5 +16,6 @@ export function BadgeSuperAdmin(props: any): any;
16
16
  export function BadgeMod(props: any): any;
17
17
  export function BadgeVetted(props: any): any;
18
18
  export function IndiaFlag(props: any): any;
19
+ export function NigeriaFlag(props: any): any;
19
20
  export function KenyaFlag(props: any): any;
20
21
  export function ModalBulbIcon(): any;
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ModalBulbIcon = exports.KenyaFlag = exports.IndiaFlag = exports.BadgeVetted = exports.BadgeMod = exports.BadgeSuperAdmin = exports.BadgeAdmin = exports.OkeGoogleIcon = exports.LetterH = exports.LanguageIcon = exports.IndexIcon = void 0;
17
+ exports.ModalBulbIcon = exports.KenyaFlag = exports.NigeriaFlag = exports.IndiaFlag = exports.BadgeVetted = exports.BadgeMod = exports.BadgeSuperAdmin = exports.BadgeAdmin = exports.OkeGoogleIcon = exports.LetterH = exports.LanguageIcon = exports.IndexIcon = void 0;
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var themes_1 = require("../../themes");
20
20
  var comps_1 = require("../../utils/comps");
@@ -91,6 +91,13 @@ var IndiaFlag = function (props) { return (react_1.default.createElement("svg",
91
91
  react_1.default.createElement("path", { fill: "#3D58DB", d: "M15 20a5 5 0 1010 0 5 5 0 00-10 0zm8.75 0a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" }),
92
92
  react_1.default.createElement("path", { fill: "#3D58DB", d: "M19.993 21.076l-.713 3.9.414-3.943-1.784 3.541 1.509-3.667-2.71 2.896 2.482-3.094-3.416 2.015 3.252-2.269-3.845.971 3.76-1.261-3.963-.151 3.963-.151-3.76-1.262 3.845.972-3.252-2.27 3.415 2.015-2.48-3.093 2.709 2.895-1.509-3.667 1.784 3.542-.414-3.944.713 3.9.714-3.9-.415 3.944 1.784-3.542-1.509 3.667 2.71-2.895-2.481 3.093 3.415-2.015-3.252 2.27 3.845-.972-3.76 1.262 3.963.15-3.963.152 3.76 1.261-3.845-.971 3.252 2.27-3.415-2.016 2.48 3.094-2.709-2.896 1.509 3.668-1.784-3.542.415 3.944-.714-3.901z" })))); };
93
93
  exports.IndiaFlag = IndiaFlag;
94
+ var NigeriaFlag = function (props) { return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: props.size || 30, height: props.size || 30, fill: "none", viewBox: "0 0 40 40" },
95
+ react_1.default.createElement("mask", { id: "mask0_863_1249", style: { maskType: "alpha" }, width: "40", height: "28", x: "0", y: "6", maskUnits: "userSpaceOnUse" },
96
+ react_1.default.createElement("path", { fill: "#fff", d: "M0 6H40V34H0z" })),
97
+ react_1.default.createElement("g", { fillRule: "evenodd", clipRule: "evenodd", mask: "url(#mask0_863_1249)" },
98
+ react_1.default.createElement("path", { fill: "#F7FCFF", d: "M4 6h32v28H4V6z" }),
99
+ react_1.default.createElement("path", { fill: "#093", d: "M26.25 6H35a5 5 0 015 5v18a5 5 0 01-5 5h-8.75V6zM0 11a5 5 0 015-5h8.75v28H5a5 5 0 01-5-5V11z" })))); };
100
+ exports.NigeriaFlag = NigeriaFlag;
94
101
  var KenyaFlag = function (props) { return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: props.size || 40, height: props.size || 40, fill: "none", viewBox: "0 0 40 40" },
95
102
  react_1.default.createElement("mask", { id: "mask0_4893_23143", style: { maskType: "alpha" }, width: "40", height: "28", x: "0", y: "6", maskUnits: "userSpaceOnUse" },
96
103
  react_1.default.createElement("path", { fill: "#fff", d: "M40 6H0v28h40V6z" })),
@@ -14,6 +14,7 @@ export namespace icons {
14
14
  export { UserCirclePlus };
15
15
  export { MapPinLine };
16
16
  export { WarningCircle };
17
+ export { HighlighterCircle };
17
18
  export { Paperclip };
18
19
  export { SpeakerHigh };
19
20
  export { ArrowLeft };
@@ -96,6 +97,7 @@ export namespace icons {
96
97
  export { BadgeVetted };
97
98
  export { IndiaFlag };
98
99
  export { KenyaFlag };
100
+ export { NigeriaFlag };
99
101
  export { LightbulbFilament };
100
102
  export { ModalBulbIcon };
101
103
  export { Keyboard };
@@ -116,6 +118,7 @@ import { User } from "phosphor-react";
116
118
  import { UserCirclePlus } from "phosphor-react";
117
119
  import { MapPinLine } from "phosphor-react";
118
120
  import { WarningCircle } from "phosphor-react";
121
+ import { HighlighterCircle } from "phosphor-react";
119
122
  import { Paperclip } from "phosphor-react";
120
123
  import { SpeakerHigh } from "phosphor-react";
121
124
  import { ArrowLeft } from "phosphor-react";
@@ -198,6 +201,7 @@ import { BadgeMod } from "./custom";
198
201
  import { BadgeVetted } from "./custom";
199
202
  import { IndiaFlag } from "./custom";
200
203
  import { KenyaFlag } from "./custom";
204
+ import { NigeriaFlag } from "./custom";
201
205
  import { LightbulbFilament } from "phosphor-react";
202
206
  import { ModalBulbIcon } from "./custom";
203
207
  import { Keyboard } from "phosphor-react";
@@ -19,6 +19,7 @@ exports.icons = {
19
19
  UserCirclePlus: phosphor_react_1.UserCirclePlus,
20
20
  MapPinLine: phosphor_react_1.MapPinLine,
21
21
  WarningCircle: phosphor_react_1.WarningCircle,
22
+ HighlighterCircle: phosphor_react_1.HighlighterCircle,
22
23
  Paperclip: phosphor_react_1.Paperclip,
23
24
  SpeakerHigh: phosphor_react_1.SpeakerHigh,
24
25
  ArrowLeft: phosphor_react_1.ArrowLeft,
@@ -102,6 +103,7 @@ exports.icons = {
102
103
  BadgeVetted: custom_1.BadgeVetted,
103
104
  IndiaFlag: custom_1.IndiaFlag,
104
105
  KenyaFlag: custom_1.KenyaFlag,
106
+ NigeriaFlag: custom_1.NigeriaFlag,
105
107
  LightbulbFilament: phosphor_react_1.LightbulbFilament,
106
108
  ModalBulbIcon: custom_1.ModalBulbIcon,
107
109
  Keyboard: phosphor_react_1.Keyboard,
@@ -6,48 +6,35 @@ var react_1 = require("react");
6
6
  * @summary The hook sets the initial state values of scrollX and scrollIsAtEnd,
7
7
  * and uses an effect to check whether the width of the scrollable element is less than or equal to its parent element's width.
8
8
  * If so, it sets scrollIsAtEnd to true.
9
- * @returns scrollContainerRef: reference to the scrollable element. You need to pass this reference to the ref attribute of your scrollable element in your component.
10
- * scrollX: The current scroll position in pixels, from the left side of the content.
11
- * scrollIsAtEnd: A boolean value that indicates whether the scroll bar is at the end of the content.
12
- * slide (shift: string): A function that shifts the scroll position by shifting pixels by direction (left/right) string provided.
13
- * checkScrollPosition: A function that updates the scrollX and scrollIsAtEnd values based on the current scroll position.
9
+ * @returns scrollContainerRef: useRef object that can be attached to the container element to enable scrolling
10
+ * scrollX: state variable that keeps track of the current horizontal scroll position of container
11
+ * slide (string): function that takes a string argument "left" or "right", and adjusts the scroll position of the container accordingly
12
+ * scrollIsAtEnd: state (boolean) variable that indicates whether the scroll position of the container is at the end of the scrollable content
13
+ * scrollIsAtStart: state variable that indicates whether the scroll position of the container is at the start of the scrollable content
14
14
  */
15
15
  var useScrollBar = function () {
16
16
  var _a = (0, react_1.useState)(0), scrollX = _a[0], setScrollX = _a[1];
17
17
  var _b = (0, react_1.useState)(false), scrollIsAtEnd = _b[0], setScrollIsAtEnd = _b[1];
18
18
  var scrollContainerRef = (0, react_1.useRef)(null);
19
19
  var slide = function (direction) {
20
- var _a = scrollContainerRef.current, scrollWidth = _a.scrollWidth, offsetWidth = _a.offsetWidth, scrollLeft = _a.scrollLeft;
21
- // const containerWidth = scrollContainerRef.current.parentNode.getBoundingClientRect().width;
20
+ var _a = scrollContainerRef.current, scrollWidth = _a.scrollWidth, offsetWidth = _a.offsetWidth;
22
21
  if (direction === "left") {
23
- var newScrollX = scrollX + Math.min(offsetWidth, Math.abs(scrollX)); //Math.max(, 0); // // ensures that the content is always visible within the scrollable element and no part of it is hidden.
24
- // if (scrollLeft === newScrollLeft) {
25
- // setScrollIsAtEnd(true);
26
- // }
22
+ var newScrollX = scrollX + Math.min(offsetWidth, Math.abs(scrollX));
23
+ //newScrollX = minimum value between offsetWidth (the width of container) and Math.abs(scrollX) (distance scrolled from the left edge of the container)
27
24
  setScrollX(newScrollX);
28
- // scrollContainerRef.current.scrollTo({
29
- // left: newScrollLeft,
30
- // behavior: "smooth"
31
- // });
32
25
  }
33
26
  else if (direction === "right") {
34
- var newScrollX = scrollX - Math.min(offsetWidth, scrollWidth - offsetWidth + scrollX); // // ensures that the content is always visible within the scrollable element and no part of it is hidden.
35
- // if (scrollLeft === newScrollLeft) {
36
- // setScrollIsAtEnd(true);
37
- // }
38
- console.log({
39
- offsetWidth: offsetWidth,
40
- remainingHidden: scrollWidth - offsetWidth + scrollX,
41
- scrollWidth: scrollWidth
42
- });
27
+ var newScrollX = scrollX - Math.min(offsetWidth, scrollWidth - offsetWidth + scrollX);
28
+ // calculate minimum value between offsetWidth (the width of the container) and
29
+ // scrollWidth - offsetWidth + scrollX (distance from left edge of container to right edge of scrollable content hidden from view).
30
+ // result subtracted from scrollX, which gives the new scroll position then used to set scrollX
43
31
  setScrollX(newScrollX);
44
- // scrollContainerRef.current.scrollTo({
45
- // left: newScrollLeft,
46
- // behavior: "smooth"
47
- // });
48
32
  }
49
33
  };
50
34
  (0, react_1.useEffect)(function () {
35
+ // update scrollIsAtEnd state variable everytime the scrollX state variable changes.
36
+ // checks if current scroll position plus the width of the container is equal to the width of the scrollable content,
37
+ // which indicates that the scroll position is at the end of the content. If scrollIsAtEnd is true and the scroll position changes, set scrollIsAtEnd to false.
51
38
  if (Math.abs(scrollX) + scrollContainerRef.current.offsetWidth === scrollContainerRef.current.scrollWidth) {
52
39
  setScrollIsAtEnd(true);
53
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.42.1",
3
+ "version": "2.42.3",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",