oolib 2.137.0 → 2.138.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.
@@ -102,7 +102,6 @@ function AudioInput(_a) {
102
102
  react_1.default.createElement("input", { type: "file" // When user clicks on upload new video from action menu inputRef.current.click() this does not work for upload button. this approch deals with that issue.
103
103
  , accept: "audio/*", ref: inputRef, style: { display: "none" }, id: "AudioField", onChange: function (v) {
104
104
  handleUpload({ files: v.target.files });
105
- v.target.value = null;
106
105
  } })));
107
106
  }
108
107
  ;
@@ -57,10 +57,7 @@ var OptionsAnimateWrapper = function (_a) {
57
57
  });
58
58
  }, [options.length]);
59
59
  return (react_1.default.createElement(styled_1.StyledOptionsAnimateWrapper, { invert: invert, isOpen: showOptions, width: width, openHeight: openHeight, style: __assign(__assign(__assign({}, (lightboxStyle || {})), { zIndex: 100000 }), (fixPos
60
- ? __assign({ position: "fixed", top: "".concat(fixPos.y -
61
- (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px"), left: "".concat(fixPos.x, "px") }, (yOrientation === "top"
62
- ? { transform: "translateY(-100%)" }
63
- : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : { left: 0 })), (yOrientation === "bottom"
60
+ ? __assign({ position: "fixed", top: "".concat(fixPos.y - (yOrientation === "top" ? (selectCompRect === null || selectCompRect === void 0 ? void 0 : selectCompRect.height) || 0 : 0), "px"), left: "".concat(fixPos.x, "px") }, (yOrientation === "top" ? { transform: "translateY(-100%)" } : {})) : __assign(__assign({ position: "absolute" }, (optionsAnchor ? (_b = {}, _b[optionsAnchor] = 0, _b) : { left: 0 })), (yOrientation === "bottom"
64
61
  ? { bottom: 0, transform: "translateY(100%)" }
65
62
  : { top: 0, transform: "translateY(-100%)" })))) }, children));
66
63
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { FunctionComponent } from 'react';
2
2
  import { DisplayIconProps } from '../../utils/comps/DisplayIcon';
3
3
  import { icons } from '../../icons';
4
4
  export interface OKELinkProps {
@@ -18,4 +18,25 @@ export interface OKELinkProps {
18
18
  style?: React.CSSProperties;
19
19
  avatar?: any;
20
20
  }
21
- export declare const OKELink: React.FC<OKELinkProps>;
21
+ /**
22
+ * @component Renders a link component with customizable text, styling, and behavior.
23
+ *
24
+ * - The component props object containing the following properties:
25
+ * @prop {string} [to]: The URL to link to.
26
+ * @prop {string} [link]: An external URL to link to.
27
+ * @prop {(e: React.MouseEvent<HTMLSpanElement | HTMLAnchorElement>) => void} [onClick]: A callback function to execute when the link is clicked.
28
+ * @prop {keyof typeof icons} [icon]: An icon to display before the text.
29
+ * @prop {DisplayIconProps['weight']} [iconWeight]: The weight of the icon font. Defaults to "regular".
30
+ * @prop {keyof typeof icons} [iconAfter]: An icon to display after the text.
31
+ * @prop {string} [text]: The text to display in the link.
32
+ * @prop {React.ReactNode} [children]: The content to be rendered inside the link.
33
+ * @prop {boolean} [invertUnderline]: A boolean indicating whether to invert the underline style of the link. Defaults to false.
34
+ * @prop {string} [color]: A string indicating the color of the link. Defaults to the primary color of the theme.
35
+ * @prop {boolean} [invert]: A boolean indicating whether to invert the colors of the link. Defaults to false.
36
+ * @prop {boolean} [disabled]: A boolean indicating whether the link is disabled. Defaults to false.
37
+ * @prop {string} [className]: A string indicating the CSS class name to apply to the link.
38
+ * @prop {React.CSSProperties} [style]: Additional CSS styles to apply to the link.
39
+ * @prop {ProfileImageInputProps['value']} [avatar]: An avatar to display in the link.
40
+ * @return {ReactElement} The rendered link component.
41
+ */
42
+ export declare const OKELink: FunctionComponent<OKELinkProps>;
@@ -43,6 +43,27 @@ var injectHttps_1 = require("../../utils/injectHttps");
43
43
  var utilsOolib_1 = require("../../utilsOolib");
44
44
  var styled_1 = require("./styled");
45
45
  var ProfileImageInput_1 = require("../ImageInput/derivedComps/ProfileImageInput");
46
+ /**
47
+ * @component Renders a link component with customizable text, styling, and behavior.
48
+ *
49
+ * - The component props object containing the following properties:
50
+ * @prop {string} [to]: The URL to link to.
51
+ * @prop {string} [link]: An external URL to link to.
52
+ * @prop {(e: React.MouseEvent<HTMLSpanElement | HTMLAnchorElement>) => void} [onClick]: A callback function to execute when the link is clicked.
53
+ * @prop {keyof typeof icons} [icon]: An icon to display before the text.
54
+ * @prop {DisplayIconProps['weight']} [iconWeight]: The weight of the icon font. Defaults to "regular".
55
+ * @prop {keyof typeof icons} [iconAfter]: An icon to display after the text.
56
+ * @prop {string} [text]: The text to display in the link.
57
+ * @prop {React.ReactNode} [children]: The content to be rendered inside the link.
58
+ * @prop {boolean} [invertUnderline]: A boolean indicating whether to invert the underline style of the link. Defaults to false.
59
+ * @prop {string} [color]: A string indicating the color of the link. Defaults to the primary color of the theme.
60
+ * @prop {boolean} [invert]: A boolean indicating whether to invert the colors of the link. Defaults to false.
61
+ * @prop {boolean} [disabled]: A boolean indicating whether the link is disabled. Defaults to false.
62
+ * @prop {string} [className]: A string indicating the CSS class name to apply to the link.
63
+ * @prop {React.CSSProperties} [style]: Additional CSS styles to apply to the link.
64
+ * @prop {ProfileImageInputProps['value']} [avatar]: An avatar to display in the link.
65
+ * @return {ReactElement} The rendered link component.
66
+ */
46
67
  var OKELink = function (_a) {
47
68
  var _to = _a.to, link = _a.link, onClick = _a.onClick, icon = _a.icon, iconWeight = _a.iconWeight, iconAfter = _a.iconAfter, text = _a.text, children = _a.children, invertUnderline = _a.invertUnderline, color = _a.color, invert = _a.invert, disabled = _a.disabled, className = _a.className, style = _a.style, avatar = _a.avatar;
48
69
  var to = link || _to;
@@ -1,9 +1,15 @@
1
- export function genColor({ color, theme, invert, disabled }: {
2
- color: any;
3
- theme: any;
4
- invert: any;
5
- disabled: any;
6
- }): any;
7
- export const styledOKELinkCSS: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
8
- export const StyledLink: import("styled-components").StyledComponent<"a", any, {}, never>;
9
- export const StyledLinkText: import("styled-components").StyledComponent<"span", any, {}, never>;
1
+ import { OKFTheme } from "../../interfaces";
2
+ export interface ColorProps {
3
+ color?: string;
4
+ theme?: OKFTheme;
5
+ invert?: boolean;
6
+ disabled?: boolean;
7
+ }
8
+ export declare const genColor: ({ color, theme, invert, disabled }: ColorProps) => string;
9
+ interface StyledLinkProps extends ColorProps {
10
+ invertUnderline?: boolean;
11
+ }
12
+ export declare const styledOKELinkCSS: import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<StyledLinkProps, any>>;
13
+ export declare const StyledLink: import("styled-components").StyledComponent<"a", any, StyledLinkProps, never>;
14
+ export declare const StyledLinkText: import("styled-components").StyledComponent<"span", any, {}, never>;
15
+ export {};
@@ -43,8 +43,8 @@ var genColor = function (_a) {
43
43
  : (0, utilsOolib_1.getPrimaryColorText)(theme === null || theme === void 0 ? void 0 : theme.colors);
44
44
  };
45
45
  exports.genColor = genColor;
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: 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) {
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(["\n cursor: ", ";\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"], ["\n cursor: ", ";\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) {
@@ -60,6 +60,6 @@ exports.styledOKELinkCSS = (0, styled_components_1.css)(templateObject_1 || (tem
60
60
  var invertUnderline = _a.invertUnderline;
61
61
  return invertUnderline ? '100%' : 0;
62
62
  });
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 max-width: 100%;\n ", ";\n"], ["\n max-width: 100%;\n ", ";\n"])), mixins_1.ellipsis);
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 max-width: 100%;\n ", ";\n"], ["\n max-width: 100%;\n ", ";\n"])), mixins_1.ellipsis);
65
65
  var templateObject_1, templateObject_2, templateObject_3;
@@ -113,7 +113,6 @@ function PDFInput(_a) {
113
113
  react_1.default.createElement("input", { type: "file" // When user clicks on upload new video from action menu inputRef.current.click() this does not work for upload button. this approch deals with that issue.
114
114
  , accept: "application/pdf", ref: inputRef, style: { display: "none" }, id: "pdfField", onChange: function (v) {
115
115
  handleUpload({ files: v.target.files });
116
- v.target.value = null;
117
116
  } })));
118
117
  }
119
118
  exports.default = PDFInput;
@@ -137,7 +137,6 @@ function VideoInput(_a) {
137
137
  react_1.default.createElement("input", { type: "file" // When user clicks on upload new video from action menu inputRef.current.click() this does not work for upload button. this approch deals with that issue.
138
138
  , accept: "video/*", ref: inputRef, style: { display: "none" }, id: "videoField", onChange: function (v) {
139
139
  handleUpload({ files: v.target.files });
140
- v.target.value = null;
141
140
  } })));
142
141
  }
143
142
  exports.default = VideoInput;
@@ -1,6 +1,8 @@
1
1
  import { ReactNode } from "react";
2
2
  import { DefaultTheme } from "styled-components";
3
+ import { ColorsType } from "../themes/colors";
3
4
  export interface OKFTheme extends DefaultTheme {
4
5
  ENV?: string;
5
6
  localize?: (text: ReactNode) => ReactNode;
7
+ colors?: ColorsType;
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.137.0",
3
+ "version": "2.138.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +0,0 @@
1
- export default MovingCoachmark;
2
- declare function MovingCoachmark(props: any): React.JSX.Element;
3
- import React from 'react';
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- var react_1 = __importStar(require("react"));
27
- var Typo_1 = require("../../../Typo");
28
- var Buttons_1 = require("../../../Buttons");
29
- var styled_1 = require("./styled");
30
- var MovingCoachmark = function (props) {
31
- var observer = props.observer, targetElm = props.targetElm, handleNext = props.handleNext, handleSkip = props.handleSkip, headline = props.headline, text = props.text, position = props.position, arrow = props.arrow, image = props.image, rank = props.rank;
32
- var _a = (0, react_1.useState)(window.pageYOffset), pageYOffset = _a[0], setPageYOffset = _a[1];
33
- (0, react_1.useEffect)(function () {
34
- var updateScrollState = function (ev) {
35
- console.log("".concat(ev.type, "ed while coachmark in view !!"));
36
- setPageYOffset(window.pageYOffset);
37
- };
38
- var resizeTimerId;
39
- var updateResizeState = function (ev) {
40
- clearTimeout(resizeTimerId); // resize optimization bit
41
- resizeTimerId = setTimeout(function () {
42
- console.log("".concat(ev.type, "ed while coachmark in view !!"));
43
- setPageYOffset(window.pageYOffset);
44
- }, 500);
45
- };
46
- window.addEventListener('scroll', updateScrollState);
47
- window.addEventListener('resize', updateResizeState);
48
- return function () {
49
- window.removeEventListener('scroll', updateScrollState);
50
- window.removeEventListener('resize', updateResizeState);
51
- observer.unobserve(targetElm);
52
- };
53
- }, []);
54
- return (react_1.default.createElement(react_1.default.Fragment, null,
55
- arrow && position && position !== 'center' && (react_1.default.createElement(styled_1.StyledMarkArrow, { position: position, targetElm: targetElm, pageYOffset: pageYOffset, arrow: arrow })),
56
- react_1.default.createElement(styled_1.StyledCoachmark, { position: position, targetElm: targetElm, pageYOffset: pageYOffset },
57
- react_1.default.createElement("div", { style: { display: 'flex', gap: '1.5rem', marginBottom: '2rem' } },
58
- image && react_1.default.createElement("img", { src: image, alt: "instruction illustration", width: '60px' }),
59
- react_1.default.createElement("div", null,
60
- react_1.default.createElement("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
61
- react_1.default.createElement(Typo_1.SANS_3, { semibold: true }, headline),
62
- react_1.default.createElement(Typo_1.SANS_0, null, rank.order)),
63
- react_1.default.createElement(Typo_1.SANS_3, { style: { marginTop: '0.5rem' } }, text))),
64
- react_1.default.createElement("div", { style: { display: 'flex', justifyContent: 'flex-end' } },
65
- react_1.default.createElement(Buttons_1.ButtonGhost, { onClick: handleSkip }, "Skip"),
66
- react_1.default.createElement(Buttons_1.ButtonSecondary, { onClick: handleNext }, rank.isLast ? "Confirm" : "Next")))));
67
- };
68
- exports.default = MovingCoachmark;
@@ -1,2 +0,0 @@
1
- export const StyledCoachmark: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export const StyledMarkArrow: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.StyledMarkArrow = exports.StyledCoachmark = void 0;
11
- var styled_components_1 = __importDefault(require("styled-components"));
12
- var themes_1 = require("../../../../themes");
13
- var utils_1 = require("./utils");
14
- var white = themes_1.colors.white;
15
- var StyledCoachmark = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n padding: 2rem;\n max-width: 320px;\n border-radius: 6px;\n position: ", ";\n\n \n ", "\n \n"], ["\n background-color: ", ";\n padding: 2rem;\n max-width: 320px;\n border-radius: 6px;\n position: ", ";\n\n \n ", "\n \n"])), white, function (_a) {
16
- var position = _a.position;
17
- return !position || position === 'center' ? 'relative' : 'absolute';
18
- }, function (_a) {
19
- var position = _a.position, targetElm = _a.targetElm;
20
- if (position) {
21
- var targetElmCoords = targetElm.getBoundingClientRect();
22
- var positionArgs = position.split(' ');
23
- return (0, utils_1.positionMark)(targetElmCoords, positionArgs);
24
- }
25
- else
26
- return '';
27
- });
28
- exports.StyledCoachmark = StyledCoachmark;
29
- var arrowOrientation = {
30
- left: -90,
31
- right: 90,
32
- top: 0,
33
- bottom: 180
34
- };
35
- var StyledMarkArrow = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n border-width: 13px;\n border-style: solid;\n border-color: ", " transparent transparent transparent;\n transform: ", ";\n\n ", "\n\n"], ["\n position: absolute;\n border-width: 13px;\n border-style: solid;\n border-color: ", " transparent transparent transparent;\n transform: ", ";\n\n ", "\n\n"])), white, function (_a) {
36
- var position = _a.position;
37
- return "rotate(".concat(arrowOrientation[position.split(' ')[0]], "deg)");
38
- }, function (_a) {
39
- var position = _a.position, targetElm = _a.targetElm;
40
- var targetElmCoords = targetElm.getBoundingClientRect();
41
- var positionArgs = position.split(' ');
42
- return (0, utils_1.positionMark)(targetElmCoords, positionArgs, arrowOrientation[positionArgs[0]]);
43
- });
44
- exports.StyledMarkArrow = StyledMarkArrow;
45
- var templateObject_1, templateObject_2;
@@ -1 +0,0 @@
1
- export function positionMark(targetElmCoords: any, markPos: any, arrowDegree: any): import("styled-components").FlattenSimpleInterpolation;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.positionMark = void 0;
8
- var styled_components_1 = require("styled-components");
9
- var putInEmptySide = function (elmCoords, arrowDegree) {
10
- var leftSideSpace = elmCoords.left;
11
- var rightSideSpace = document.documentElement.clientWidth - elmCoords.right;
12
- //30px marginal factor (10% of the narrowset phone 'iphone SE')
13
- if (leftSideSpace > rightSideSpace + 30) {
14
- return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n right: ", "px; // 4 : start at the quarter of the element\n "], ["\n right: ", "px; // 4 : start at the quarter of the element\n "])), (document.documentElement.clientWidth - elmCoords.right) + elmCoords.width / 4);
15
- }
16
- else if (rightSideSpace > leftSideSpace + 30) {
17
- return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["left: ", "px;"], ["left: ", "px;"])), elmCoords.left + elmCoords.width / 4);
18
- }
19
- else {
20
- // the target is centered or not to the left nor right by that much
21
- return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n left: ", "px;\n transform: translateX(-50%) ", ";\n "], ["\n left: ", "px;\n transform: translateX(-50%) ", ";\n "])), elmCoords.left + elmCoords.width / 2, arrowDegree ? "rotate(".concat(arrowDegree, "deg)") : ''); //center the coachmark too
22
- }
23
- };
24
- var position2ndArg = function (elmCoords, pos) {
25
- switch (pos) {
26
- case 'left':
27
- return (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["left: ", "px;"], ["left: ", "px;"])), elmCoords.left);
28
- case 'right':
29
- return (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["right: ", "px;"], ["right: ", "px;"])), document.documentElement.clientWidth - elmCoords.right);
30
- case 'top':
31
- return (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["top: ", "px;"], ["top: ", "px;"])), elmCoords.top);
32
- case 'bottom':
33
- return (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["bottom: ", "px;"], ["bottom: ", "px;"])), document.documentElement.clientHeight - elmCoords.bottom);
34
- default:
35
- return;
36
- }
37
- };
38
- var positionMark = function (targetElmCoords, markPos, arrowDegree) {
39
- var possiblePoses = ['left', 'right', 'top', 'bottom'];
40
- var arrowSpace = arrowDegree !== undefined ? -13 : 10; //this function is called for arrow || coachmark, arrow width: 13px, leaving 10px space on the side for it
41
- var elmVerticalMiddle = targetElmCoords.top + targetElmCoords.height / 2 - 13; //-----------------------------↑
42
- var use2ndArg = markPos[1] && possiblePoses.includes(markPos[1]);
43
- switch (markPos[0]) {
44
- case 'left':
45
- return (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n right: ", "px;\n ", "\n "], ["\n right: ", "px;\n ", "\n "])), (document.documentElement.clientWidth - targetElmCoords.right) + targetElmCoords.width + arrowSpace, use2ndArg ? position2ndArg(targetElmCoords, markPos[1]) : "top: ".concat(elmVerticalMiddle, "px"));
46
- case 'right':
47
- return (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n left: ", "px;\n ", "\n "], ["\n left: ", "px;\n ", "\n "])), targetElmCoords.right + arrowSpace, use2ndArg ? position2ndArg(targetElmCoords, markPos[1]) : "top: ".concat(elmVerticalMiddle, "px"));
48
- case 'top':
49
- return (0, styled_components_1.css)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n bottom: ", "px;////////////////////// -100%???\n ", "\n "], ["\n bottom: ", "px;////////////////////// -100%???\n ", "\n "])), (document.documentElement.clientHeight - targetElmCoords.bottom) + targetElmCoords.height + arrowSpace, use2ndArg ? position2ndArg(targetElmCoords, markPos[1]) : putInEmptySide(targetElmCoords, arrowDegree));
50
- case 'bottom':
51
- return (0, styled_components_1.css)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n top: ", "px;\n ", "\n "], ["\n top: ", "px;\n ", "\n "])), targetElmCoords.bottom + arrowSpace, use2ndArg ? position2ndArg(targetElmCoords, markPos[1]) : putInEmptySide(targetElmCoords, arrowDegree));
52
- default:
53
- return (0, styled_components_1.css)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["position: relative"], ["position: relative"]))); // in case of a wrong position argument, re-center
54
- }
55
- };
56
- exports.positionMark = positionMark;
57
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12;
@@ -1,31 +0,0 @@
1
- export default coachingList;
2
- declare namespace coachingList {
3
- let H5PEmbed: ({
4
- element: string;
5
- mark: {
6
- headline: string;
7
- text: string;
8
- image: any;
9
- position?: undefined;
10
- arrow?: undefined;
11
- };
12
- } | {
13
- element: string;
14
- mark: {
15
- headline: string;
16
- text: string;
17
- image: any;
18
- position: string;
19
- arrow: boolean;
20
- };
21
- })[];
22
- let AnalysisDashboard: {
23
- element: string;
24
- mark: {
25
- headline: string;
26
- text: string;
27
- position: string;
28
- arrow: boolean;
29
- };
30
- }[];
31
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- // to be moved in the future .. being here is not optimal (oolib wise)
7
- // this file contain all coachmarks data for all comps using it
8
- var phone_tilt_png_1 = __importDefault(require("../../assets/images/phone-tilt.png"));
9
- var expand_arrows_png_1 = __importDefault(require("../../assets/images/expand-arrows.png"));
10
- var coachingList = {
11
- H5PEmbed: [
12
- {
13
- element: 'set inside comp',
14
- mark: {
15
- headline: "Rotate your device",
16
- text: "Enhance accesibility by rotating device to landscape mode",
17
- image: phone_tilt_png_1.default,
18
- }
19
- },
20
- {
21
- element: 'set inside comp',
22
- mark: {
23
- headline: "Expand screen",
24
- text: "Click on the expand button to access the presentation",
25
- image: expand_arrows_png_1.default,
26
- position: 'bottom right',
27
- arrow: true,
28
- }
29
- }
30
- ],
31
- AnalysisDashboard: [
32
- {
33
- element: 'set inside comp',
34
- mark: {
35
- headline: "Set Country",
36
- text: "Select All to see data across countries or select any one country to see it's data",
37
- position: "bottom",
38
- arrow: true
39
- }
40
- },
41
- {
42
- element: 'set inside comp',
43
- mark: {
44
- headline: "Set Research Areas",
45
- text: "Select the research area from here",
46
- position: "bottom",
47
- arrow: true
48
- }
49
- },
50
- {
51
- element: 'set inside comp',
52
- mark: {
53
- headline: "Set Participant Type ",
54
- text: "Select the participant type whose data you want to see",
55
- position: "bottom",
56
- arrow: true
57
- }
58
- }
59
- ]
60
- };
61
- exports.default = coachingList;
@@ -1,4 +0,0 @@
1
- export function Coachmark(props: any): React.JSX.Element;
2
- import { useCoachmark } from './utils';
3
- import React from 'react';
4
- export { useCoachmark };
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.useCoachmark = exports.Coachmark = void 0;
41
- var react_1 = __importStar(require("react"));
42
- var MovingCoachmark_1 = __importDefault(require("./comps/MovingCoachmark"));
43
- var styled_1 = require("./styled");
44
- var utils_1 = require("./utils");
45
- Object.defineProperty(exports, "useCoachmark", { enumerable: true, get: function () { return utils_1.useCoachmark; } });
46
- var Coachmark = function (props) {
47
- var _a = props.active, active = _a === void 0 ? true : _a, _b = props.observerThreshold, observerThreshold = _b === void 0 ? 0.6 : _b, currentMark = props.currentMark, handleSkip = props.handleSkip, handleNext = props.handleNext, rank = props.rank;
48
- var _c = (0, react_1.useState)(false), isElementInView = _c[0], setIsElementInView = _c[1];
49
- (0, react_1.useEffect)(function () {
50
- if ((currentMark === null || currentMark === void 0 ? void 0 : currentMark.element) instanceof Element) {
51
- if (currentMark.mark.position && currentMark.mark.position !== 'center') {
52
- if (isElementInView)
53
- currentMark.element.style.zIndex = 160;
54
- }
55
- return function () {
56
- if (currentMark.element)
57
- currentMark.element.style.zIndex = 'auto';
58
- };
59
- }
60
- });
61
- if (!currentMark || !active)
62
- return null;
63
- var element = currentMark.element, mark = currentMark.mark;
64
- var targetElm = element instanceof Element && element;
65
- if (!targetElm)
66
- return null;
67
- var observer = new IntersectionObserver(function (entries, observer) {
68
- setIsElementInView(entries[0].isIntersecting);
69
- }, { threshold: observerThreshold }); // if 60% of the element is covered, it is intersecting
70
- observer.observe(targetElm);
71
- return isElementInView && (react_1.default.createElement(styled_1.StyledOverlay, null,
72
- react_1.default.createElement(MovingCoachmark_1.default, __assign({ observer: observer, targetElm: targetElm, handleNext: handleNext, handleSkip: handleSkip, rank: rank }, mark))));
73
- };
74
- exports.Coachmark = Coachmark;
@@ -1 +0,0 @@
1
- export const StyledOverlay: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.StyledOverlay = void 0;
31
- var styled_components_1 = __importStar(require("styled-components"));
32
- var colors_1 = require("../../themes/colors");
33
- var black_opacity30 = colors_1.colors.black_opacity30;
34
- var fadeIn = (0, styled_components_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {opacity: 0}\n to {opacity: 1}\n"], ["\n from {opacity: 0}\n to {opacity: 1}\n"])));
35
- var StyledOverlay = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background-color: ", ";\n z-index: 150;\n animation: ", " 0.5s linear; \n display: grid;// centering the coachmark below by default, will have no\n place-items: center;// effect if a position (other than 'center') is passed in the tooltip pbject\n"], ["\n position: fixed;\n top: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background-color: ", ";\n z-index: 150;\n animation: ", " 0.5s linear; \n display: grid;// centering the coachmark below by default, will have no\n place-items: center;// effect if a position (other than 'center') is passed in the tooltip pbject\n"])), black_opacity30, fadeIn);
36
- exports.StyledOverlay = StyledOverlay;
37
- var templateObject_1, templateObject_2;
@@ -1,13 +0,0 @@
1
- export function useCoachmark({ coachmarks, compIdentifier }: {
2
- coachmarks: any;
3
- compIdentifier?: string;
4
- }): {
5
- activeMark: any;
6
- rank: {
7
- order: string;
8
- isLast: boolean;
9
- };
10
- removeCoachmark: () => void;
11
- showNextMark: (condition?: boolean) => void;
12
- useReliableRef: (idx: any, dep?: any) => (node: any) => void;
13
- };
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useCoachmark = void 0;
13
- var react_1 = require("react");
14
- var styled_components_1 = require("styled-components");
15
- var theme = (0, styled_components_1.useTheme)();
16
- var useCoachmark = function (_a) {
17
- var coachmarks = _a.coachmarks, _b = _a.compIdentifier, compIdentifier = _b === void 0 ? '' : _b;
18
- var _c = (0, react_1.useState)([]), elmsAttachedMarks = _c[0], setElmsAttachedMarks = _c[1];
19
- var _d = (0, react_1.useState)(0), activeMarkIdx = _d[0], setActiveMarkIdx = _d[1];
20
- var _e = (0, react_1.useState)(0), lastShownMark = _e[0], setLastShownMark = _e[1];
21
- var setElmToMark = function (node, idx) {
22
- if (idx instanceof Array) {
23
- idx.forEach(function (i) { return coachmarks[i].element = node; });
24
- }
25
- else {
26
- coachmarks[idx].element = node;
27
- }
28
- if (coachmarks.every(function (mark) { return mark.element instanceof Element; })) {
29
- setElmsAttachedMarks(__spreadArray([], coachmarks, true));
30
- }
31
- };
32
- var useReliableRef = function (idx, dep) {
33
- if (dep === void 0) { dep = null; }
34
- return (0, react_1.useCallback)(function (node) { return setElmToMark(node, idx); }, dep ? [dep] : []);
35
- };
36
- var showNextMark = function (condition) {
37
- if (condition === void 0) { condition = true; }
38
- if (condition) {
39
- if (activeMarkIdx + 1 === elmsAttachedMarks.length) {
40
- removeCoachmark();
41
- }
42
- else {
43
- setActiveMarkIdx((activeMarkIdx === -1 ? lastShownMark : activeMarkIdx) + 1); // in case the mark was hidden temporarily if the condition isn't met
44
- }
45
- }
46
- else {
47
- setLastShownMark(activeMarkIdx);
48
- setActiveMarkIdx(-1);
49
- }
50
- };
51
- var updateCoachmarkList = theme === null || theme === void 0 ? void 0 : theme.useUpdateCoachmarkChecklist();
52
- // const {_Branch} = useGetQueryData('platformConfigs');
53
- var removeCoachmark = function () {
54
- if (process.env.REACT_APP_ENV !== 'dev') {
55
- updateCoachmarkList.mutate({ property: compIdentifier, value: true });
56
- }
57
- setActiveMarkIdx(-1);
58
- };
59
- return {
60
- activeMark: elmsAttachedMarks[activeMarkIdx],
61
- rank: {
62
- order: "".concat(activeMarkIdx + 1, "/").concat(elmsAttachedMarks.length),
63
- isLast: activeMarkIdx === elmsAttachedMarks.length - 1
64
- },
65
- removeCoachmark: removeCoachmark,
66
- showNextMark: showNextMark,
67
- useReliableRef: useReliableRef
68
- };
69
- };
70
- exports.useCoachmark = useCoachmark;