catchup-library-web 1.0.2 → 1.0.4

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.
Files changed (32) hide show
  1. package/dist/index.d.mts +305 -2
  2. package/dist/index.d.ts +305 -2
  3. package/dist/index.js +2768 -334
  4. package/dist/index.mjs +2657 -292
  5. package/package.json +1 -1
  6. package/src/components/boxes/SelectionBox.tsx +41 -0
  7. package/src/components/boxes/SelectionCheckbox.tsx +66 -0
  8. package/src/components/labels/ActivityTemplateLabel.tsx +15 -0
  9. package/src/components/labels/BrandLabel.tsx +19 -0
  10. package/src/components/labels/CoterieLabel.tsx +11 -0
  11. package/src/components/labels/GradeLabel.tsx +11 -0
  12. package/src/components/labels/OutcomeLabel.tsx +15 -0
  13. package/src/components/labels/PersonalLabel.tsx +23 -0
  14. package/src/components/labels/PublishingHouseLabel.tsx +23 -0
  15. package/src/components/modals/BaseModal.tsx +56 -0
  16. package/src/components/tabs/SelectionTab.tsx +45 -0
  17. package/src/index.ts +25 -0
  18. package/src/properties/BoxProperties.ts +12 -0
  19. package/src/properties/GroupProperties.ts +1 -1
  20. package/src/properties/LabelProperties.ts +33 -0
  21. package/src/properties/ModalProperties.ts +8 -0
  22. package/src/properties/TabProperties.ts +9 -0
  23. package/src/utilization/AuthorizationUtilization.ts +15 -0
  24. package/src/utilization/CategoryUtilization.ts +314 -0
  25. package/src/utilization/DateUtilization.ts +85 -0
  26. package/src/utilization/FunctionUtilization.ts +50 -0
  27. package/src/utilization/GamificationUtilization.ts +495 -0
  28. package/src/utilization/IndividualModelUtilization.ts +48 -0
  29. package/src/utilization/ManagementUtilization.ts +1201 -0
  30. package/src/utilization/NotificationUtilization.ts +59 -0
  31. package/src/utilization/ReportUtilization.ts +42 -0
  32. package/src/utilization/TokenUtilization.ts +39 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,41 @@
1
+ import { ISelectionBoxProps } from "../../properties/BoxProperties";
2
+
3
+ const SelectionBox = ({
4
+ optionList,
5
+ selectedId,
6
+ handleSelectOnClick,
7
+ }: ISelectionBoxProps) => {
8
+ return (
9
+ <div className="flex flex-row items-center gap-x-4 gap-y-2 flex-wrap text-center">
10
+ {optionList.map((option: any, index: number) => (
11
+ <div
12
+ key={index}
13
+ className={`${
14
+ option.id === selectedId
15
+ ? "border-catchup-blue-400"
16
+ : "border-catchup-gray-100 hover:border-catchup-blue-500"
17
+ } border-2 rounded-catchup-xlarge py-3 px-8 cursor-pointer duration-300 transition-all`}
18
+ onClick={() => {
19
+ handleSelectOnClick(option.id);
20
+ }}
21
+ >
22
+ <div
23
+ className={`flex flex-row items-center gap-x-1 ${
24
+ option.id === selectedId ? "opacity-100" : "opacity-50"
25
+ }`}
26
+ >
27
+ <div>{option.icon}</div>
28
+ <div className="flex-1 flex flex-col items-center">
29
+ <p>{option.text}</p>
30
+ {option.subText ? (
31
+ <p className="text-md">({option.subText})</p>
32
+ ) : null}
33
+ </div>
34
+ </div>
35
+ </div>
36
+ ))}
37
+ </div>
38
+ );
39
+ };
40
+
41
+ export default SelectionBox;
@@ -0,0 +1,66 @@
1
+ import { ISelectionCheckboxBoxProps } from "../../properties/BoxProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const SelectionCheckbox = ({
5
+ optionList,
6
+ selectedIdList,
7
+ handleSelectOnClick,
8
+ handleRemoveOnClick,
9
+ }: ISelectionCheckboxBoxProps) => {
10
+ return (
11
+ <div className="flex flex-row items-center gap-x-4 gap-y-2 flex-wrap text-center">
12
+ {optionList.map((option: any, index: number) => (
13
+ <div
14
+ key={index}
15
+ className={`${
16
+ selectedIdList.findIndex(
17
+ (selectedId: any) => selectedId === option.id
18
+ ) > -1
19
+ ? "border-catchup-blue-400"
20
+ : "border-catchup-gray-100 hover:border-catchup-blue-500"
21
+ } border-2 rounded-catchup-xlarge py-3 px-6 cursor-pointer duration-300 transition-all`}
22
+ onClick={() => {
23
+ if (
24
+ selectedIdList.findIndex(
25
+ (selectedId: any) => selectedId === option.id
26
+ ) === -1
27
+ ) {
28
+ handleSelectOnClick(option.id);
29
+ } else {
30
+ handleRemoveOnClick(option.id);
31
+ }
32
+ }}
33
+ >
34
+ <div
35
+ className={`flex flex-row items-center gap-x-1 ${
36
+ selectedIdList.findIndex(
37
+ (selectedId: any) => selectedId === option.id
38
+ ) > -1
39
+ ? "opacity-100"
40
+ : "opacity-50"
41
+ }`}
42
+ >
43
+ <div>
44
+ <BaseImage
45
+ src={
46
+ selectedIdList.findIndex(
47
+ (selectedId: any) => selectedId === option.id
48
+ ) > -1
49
+ ? "/icons/checkbox.png"
50
+ : "/icons/checkbox-empty.png"
51
+ }
52
+ alt="checkbox"
53
+ size="small"
54
+ />
55
+ </div>
56
+ <div className="flex-1">
57
+ <p>{option.text}</p>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ ))}
62
+ </div>
63
+ );
64
+ };
65
+
66
+ export default SelectionCheckbox;
@@ -0,0 +1,15 @@
1
+ import { IActivityTemplateLabelProps } from "../../properties/LabelProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const ActivityTemplateLabel = ({ title }: IActivityTemplateLabelProps) => {
5
+ return (
6
+ <div className="px-3 py-1 gap-x-3 border border-grade-label-border bg-grade-label text-grade-label-text rounded-catchup-3xlarge">
7
+ <div className="flex flex-row items-center gap-x-2">
8
+ <BaseImage src="/icons/activity.png" alt="label" size="xsmall" />
9
+ <p className="text-md">{title}</p>
10
+ </div>
11
+ </div>
12
+ );
13
+ };
14
+
15
+ export default ActivityTemplateLabel;
@@ -0,0 +1,19 @@
1
+ import { IBrandLabelProps } from "../../properties/LabelProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const BrandLabel = ({ title, icon, font }: IBrandLabelProps) => {
5
+ return (
6
+ <div className="px-3 py-1 gap-x-3 border border-brand-label-border bg-brand-label text-brand-label-text rounded-catchup-3xlarge">
7
+ <div className="flex flex-row items-center gap-x-2">
8
+ {icon ? (
9
+ icon
10
+ ) : (
11
+ <BaseImage src="/icons/brand-label.png" alt="label" size="xsmall" />
12
+ )}
13
+ <p className={font ? font : "text-sm"}>{title}</p>
14
+ </div>
15
+ </div>
16
+ );
17
+ };
18
+
19
+ export default BrandLabel;
@@ -0,0 +1,11 @@
1
+ import { ICoterieLabelProps } from "../../properties/LabelProperties";
2
+
3
+ const CoterieLabel = ({ title }: ICoterieLabelProps) => {
4
+ return (
5
+ <div className="px-3 py-1 gap-x-3 border border-brand-label-border bg-brand-label text-brand-label-text rounded-catchup-3xlarge">
6
+ <p className="text-md">{title}</p>
7
+ </div>
8
+ );
9
+ };
10
+
11
+ export default CoterieLabel;
@@ -0,0 +1,11 @@
1
+ import { IGradeLabelProps } from "../../properties/LabelProperties";
2
+
3
+ const GradeLabel = ({ title }: IGradeLabelProps) => {
4
+ return (
5
+ <div className="px-3 py-1 gap-x-3 border border-grade-label-border bg-grade-label text-grade-label-text rounded-catchup-3xlarge">
6
+ <p className="text-sm">{title}</p>
7
+ </div>
8
+ );
9
+ };
10
+
11
+ export default GradeLabel;
@@ -0,0 +1,15 @@
1
+ import { IOutcomeLabelProps } from "../../properties/LabelProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const OutcomeLabel = ({ title }: IOutcomeLabelProps) => {
5
+ return (
6
+ <div className="px-3 py-1 gap-x-3 border border-brand-label-border bg-brand-label text-brand-label-text rounded-catchup-3xlarge">
7
+ <div className="flex flex-row items-center gap-x-2">
8
+ <BaseImage src="/icons/category.png" alt="label" size="xsmall" />
9
+ <p className="text-md">{title}</p>
10
+ </div>
11
+ </div>
12
+ );
13
+ };
14
+
15
+ export default OutcomeLabel;
@@ -0,0 +1,23 @@
1
+ import { IPersonalLabelProps } from "../../properties/LabelProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const PersonalLabel = ({ title, icon, font }: IPersonalLabelProps) => {
5
+ return (
6
+ <div className="px-3 py-1 gap-x-3 border border-personal-label-border bg-personal-label text-personal-label-text rounded-catchup-3xlarge">
7
+ <div className="flex flex-row items-center gap-x-2">
8
+ {icon ? (
9
+ icon
10
+ ) : (
11
+ <BaseImage
12
+ src="/icons/personal-label.png"
13
+ alt="label"
14
+ size="xsmall"
15
+ />
16
+ )}
17
+ <p className={font ? font : "text-sm"}>{title}</p>
18
+ </div>
19
+ </div>
20
+ );
21
+ };
22
+
23
+ export default PersonalLabel;
@@ -0,0 +1,23 @@
1
+ import { IPublishingLabelProps } from "../../properties/LabelProperties";
2
+ import BaseImage from "../images/BaseImage";
3
+
4
+ const PublishingHouseLabel = ({ title, icon, font }: IPublishingLabelProps) => {
5
+ return (
6
+ <div className="px-3 py-1 gap-x-3 border border-publishing-house-label-border bg-publishing-house-label text-publishing-house-label-text rounded-catchup-3xlarge">
7
+ <div className="flex flex-row items-center gap-x-2">
8
+ {icon ? (
9
+ icon
10
+ ) : (
11
+ <BaseImage
12
+ src="/icons/publishing-house-label.png"
13
+ alt="label"
14
+ size="xsmall"
15
+ />
16
+ )}
17
+ <p className={font ? font : "text-sm"}>{title}</p>
18
+ </div>
19
+ </div>
20
+ );
21
+ };
22
+
23
+ export default PublishingHouseLabel;
@@ -0,0 +1,56 @@
1
+ import Modal from "react-modal";
2
+ import { IModalProps } from "../../properties/ModalProperties";
3
+
4
+ const BaseModal = ({
5
+ isOpen,
6
+ size,
7
+ onAfterOpen,
8
+ onRequestClose,
9
+ customSize,
10
+ children,
11
+ }: IModalProps) => {
12
+ return (
13
+ <Modal
14
+ isOpen={isOpen}
15
+ onAfterOpen={onAfterOpen}
16
+ onRequestClose={onRequestClose}
17
+ style={{
18
+ content: {
19
+ top: "50%",
20
+ left: "50%",
21
+ right: "auto",
22
+ bottom: "auto",
23
+ marginRight: "-50%",
24
+ transform: "translate(-50%, -50%)",
25
+ padding: 0,
26
+ borderRadius: 20,
27
+ background: "",
28
+ border: "",
29
+ maxHeight: "70%",
30
+ overflow: "auto",
31
+ zIndex: 20,
32
+ },
33
+ overlay: {
34
+ background: "rgba(0, 0, 0, 0.6)",
35
+ },
36
+ }}
37
+ contentLabel=""
38
+ >
39
+ {customSize ? (
40
+ <div className={`${customSize}`}>{children}</div>
41
+ ) : (
42
+ <div
43
+ className={`${
44
+ size === "small"
45
+ ? "w-[600px]"
46
+ : "w-[600px] lg:w-[900px] xl:w-[1200px] 2xl:w-[1500px]"
47
+ }`}
48
+ >
49
+ {children}
50
+ </div>
51
+ )}
52
+ </Modal>
53
+ );
54
+ };
55
+
56
+ export default BaseModal;
@@ -0,0 +1,45 @@
1
+ import { ISelectionTabProps } from "../../properties/TabProperties";
2
+
3
+ const SelectionTab = ({
4
+ optionList,
5
+ selectedId,
6
+ handleSelectOnClick,
7
+ selectedTextColor,
8
+ selectedBorderColor,
9
+ textColor,
10
+ borderColor,
11
+ }: ISelectionTabProps) => {
12
+ return (
13
+ <div className="flex flex-row items-center gap-x-4 gap-y-2 flex-wrap mb-5 text-lg text-center">
14
+ {optionList.map((option: any, index: number) => (
15
+ <div
16
+ key={index}
17
+ className={`${
18
+ selectedId === option.id
19
+ ? selectedTextColor
20
+ ? selectedTextColor
21
+ : "text-catchup-blue-500"
22
+ : textColor
23
+ ? textColor
24
+ : "text-catchup-gray-300"
25
+ } ${
26
+ selectedId === option.id
27
+ ? selectedBorderColor
28
+ ? selectedBorderColor
29
+ : "border-catchup-blue-500"
30
+ : borderColor
31
+ ? borderColor
32
+ : "border-catchup-gray-50"
33
+ } border-b-2 transition-all duration-300 p-3 cursor-pointer`}
34
+ onClick={() => {
35
+ handleSelectOnClick(option.id);
36
+ }}
37
+ >
38
+ {option.title}
39
+ </div>
40
+ ))}
41
+ </div>
42
+ );
43
+ };
44
+
45
+ export default SelectionTab;
package/src/index.ts CHANGED
@@ -9,6 +9,8 @@ export { default as BaseImage } from "./components/images/BaseImage";
9
9
 
10
10
  export { default as BaseLoading } from "./components/loading/BaseLoading";
11
11
 
12
+ export { default as BaseModal } from "./components/modals/BaseModal";
13
+
12
14
  export { default as DropdownActivityContent } from "./components/activities/DropdownActivityContent";
13
15
  export { default as FillInTheBlanksActivityContent } from "./components/activities/FillInTheBlanksActivityContent";
14
16
  export { default as GroupingActivityContent } from "./components/activities/GroupingActivityContent";
@@ -27,8 +29,31 @@ export { default as InputGroup } from "./components/groups/InputGroup";
27
29
 
28
30
  export { default as useScreenSize } from "./hooks/useScreenSize";
29
31
 
32
+ export { default as SelectionBox } from "./components/boxes/SelectionBox";
33
+ export { default as SelectionCheckbox } from "./components/boxes/SelectionCheckbox";
34
+
35
+ export { default as SelectionTab } from "./components/tabs/SelectionTab";
36
+
37
+ export { default as ActivityTemplateLabel } from "./components/labels/ActivityTemplateLabel";
38
+ export { default as BrandLabel } from "./components/labels/BrandLabel";
39
+ export { default as CoterieLabel } from "./components/labels/CoterieLabel";
40
+ export { default as GradeLabel } from "./components/labels/GradeLabel";
41
+ export { default as OutcomeLabel } from "./components/labels/OutcomeLabel";
42
+ export { default as PersonalLabel } from "./components/labels/PersonalLabel";
43
+ export { default as PublishingHouseLabel } from "./components/labels/PublishingHouseLabel";
44
+
30
45
  export { default as i18n } from "./language/i18n";
31
46
 
32
47
  export * from "./utilization/AppUtilization";
48
+ export * from "./utilization/AuthorizationUtilization";
33
49
  export * from "./utilization/CatchtivityUtilization";
50
+ export * from "./utilization/CategoryUtilization";
51
+ export * from "./utilization/DateUtilization";
52
+ export * from "./utilization/FunctionUtilization";
53
+ export * from "./utilization/GamificationUtilization";
54
+ export * from "./utilization/IndividualModelUtilization";
55
+ export * from "./utilization/ManagementUtilization";
56
+ export * from "./utilization/NotificationUtilization";
57
+ export * from "./utilization/ReportUtilization";
34
58
  export * from "./utilization/StorageUtilization";
59
+ export * from "./utilization/TokenUtilization";
@@ -0,0 +1,12 @@
1
+ export interface ISelectionBoxProps {
2
+ optionList: any;
3
+ selectedId: any;
4
+ handleSelectOnClick: (e: any) => void;
5
+ }
6
+
7
+ export interface ISelectionCheckboxBoxProps {
8
+ optionList: any;
9
+ selectedIdList: any;
10
+ handleSelectOnClick: (e: any) => void;
11
+ handleRemoveOnClick: (e: any) => void;
12
+ }
@@ -13,7 +13,7 @@ export interface IInputGroupProps {
13
13
  multiple?: boolean;
14
14
  accept?: string;
15
15
  theme?: string;
16
- useMinHeight: boolean;
16
+ useMinHeight?: boolean;
17
17
  disabled?: boolean;
18
18
  limit?: number;
19
19
  }
@@ -0,0 +1,33 @@
1
+ export interface IActivityTemplateLabelProps {
2
+ title: string;
3
+ }
4
+
5
+ export interface IBrandLabelProps {
6
+ title: string;
7
+ icon: any;
8
+ font: string;
9
+ }
10
+
11
+ export interface ICoterieLabelProps {
12
+ title: string;
13
+ }
14
+
15
+ export interface IGradeLabelProps {
16
+ title: string;
17
+ }
18
+
19
+ export interface IOutcomeLabelProps {
20
+ title: string;
21
+ }
22
+
23
+ export interface IPersonalLabelProps {
24
+ title: string;
25
+ icon: any;
26
+ font: string;
27
+ }
28
+
29
+ export interface IPublishingLabelProps {
30
+ title: string;
31
+ icon: any;
32
+ font: string;
33
+ }
@@ -0,0 +1,8 @@
1
+ export interface IModalProps {
2
+ isOpen: boolean;
3
+ size: string;
4
+ onAfterOpen: () => {};
5
+ onRequestClose: () => {};
6
+ customSize: string;
7
+ children: any;
8
+ }
@@ -0,0 +1,9 @@
1
+ export interface ISelectionTabProps {
2
+ optionList: any;
3
+ selectedId: any;
4
+ handleSelectOnClick: (e: any) => void;
5
+ textColor: string;
6
+ selectedTextColor: string;
7
+ borderColor: string;
8
+ selectedBorderColor: string;
9
+ }
@@ -0,0 +1,15 @@
1
+ export const parseJwt = (token: string) => {
2
+ var base64Url = token.split(".")[1];
3
+ var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
4
+ var jsonPayload = decodeURIComponent(
5
+ window
6
+ .atob(base64)
7
+ .split("")
8
+ .map(function (c) {
9
+ return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
10
+ })
11
+ .join("")
12
+ );
13
+
14
+ return JSON.parse(jsonPayload);
15
+ };