oolib 2.42.1 → 2.42.2
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" })),
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export namespace icons {
|
|
|
96
96
|
export { BadgeVetted };
|
|
97
97
|
export { IndiaFlag };
|
|
98
98
|
export { KenyaFlag };
|
|
99
|
+
export { NigeriaFlag };
|
|
99
100
|
export { LightbulbFilament };
|
|
100
101
|
export { ModalBulbIcon };
|
|
101
102
|
export { Keyboard };
|
|
@@ -198,6 +199,7 @@ import { BadgeMod } from "./custom";
|
|
|
198
199
|
import { BadgeVetted } from "./custom";
|
|
199
200
|
import { IndiaFlag } from "./custom";
|
|
200
201
|
import { KenyaFlag } from "./custom";
|
|
202
|
+
import { NigeriaFlag } from "./custom";
|
|
201
203
|
import { LightbulbFilament } from "phosphor-react";
|
|
202
204
|
import { ModalBulbIcon } from "./custom";
|
|
203
205
|
import { Keyboard } from "phosphor-react";
|
package/dist/icons/index.js
CHANGED
|
@@ -102,6 +102,7 @@ exports.icons = {
|
|
|
102
102
|
BadgeVetted: custom_1.BadgeVetted,
|
|
103
103
|
IndiaFlag: custom_1.IndiaFlag,
|
|
104
104
|
KenyaFlag: custom_1.KenyaFlag,
|
|
105
|
+
NigeriaFlag: custom_1.NigeriaFlag,
|
|
105
106
|
LightbulbFilament: phosphor_react_1.LightbulbFilament,
|
|
106
107
|
ModalBulbIcon: custom_1.ModalBulbIcon,
|
|
107
108
|
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:
|
|
10
|
-
* scrollX:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
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));
|
|
24
|
-
//
|
|
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);
|
|
35
|
-
//
|
|
36
|
-
//
|
|
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
|
}
|