@agilant/toga-blox 1.0.5

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 (138) hide show
  1. package/Dockerfile +9 -0
  2. package/README.md +69 -0
  3. package/assets/Logo.png +0 -0
  4. package/assets/compass-card-image-2.png +0 -0
  5. package/assets/compass-card-image-3.png +0 -0
  6. package/assets/compass-card-image-4.png +0 -0
  7. package/assets/compass-card-image.png +0 -0
  8. package/assets/compass-logo.png +0 -0
  9. package/assets/compass-tech-hero-bg.png +0 -0
  10. package/assets/contact-image.png +0 -0
  11. package/assets/green-laptop.png +0 -0
  12. package/assets/heroImage.png +0 -0
  13. package/assets/placeholder-no-image-available.png +0 -0
  14. package/assets/team.png +0 -0
  15. package/declarations.d.ts +4 -0
  16. package/docker-compose.yml +22 -0
  17. package/global.css +4 -0
  18. package/index.js +4 -0
  19. package/nodemon.json +5 -0
  20. package/package.json +70 -0
  21. package/postcss.config.js +6 -0
  22. package/src/components/Badge/Badge.stories.tsx +284 -0
  23. package/src/components/Badge/Badge.test.tsx +185 -0
  24. package/src/components/Badge/Badge.tsx +137 -0
  25. package/src/components/Badge/Badge.types.tsx +28 -0
  26. package/src/components/Badge/badgeClassNames.tsx +152 -0
  27. package/src/components/Badge/index.ts +2 -0
  28. package/src/components/Card/Card.stories.tsx +91 -0
  29. package/src/components/Card/Card.test.tsx +53 -0
  30. package/src/components/Card/Card.tsx +30 -0
  31. package/src/components/Card/Card.types.ts +11 -0
  32. package/src/components/Card/DUMMYPRODUCTDATA.json +670 -0
  33. package/src/components/Card/cardClassNames.ts +49 -0
  34. package/src/components/Card/index.ts +3 -0
  35. package/src/components/Card/templates/CompassCardTemplate.tsx +58 -0
  36. package/src/components/Card/templates/HorizontalCardTemplate.tsx +184 -0
  37. package/src/components/Card/templates/VerticalCardTemplate.tsx +154 -0
  38. package/src/components/Footer/ContactInfoItem.tsx +20 -0
  39. package/src/components/Footer/DUMMYFOOTERDATA.json +132 -0
  40. package/src/components/Footer/Footer.stories.tsx +292 -0
  41. package/src/components/Footer/Footer.test.tsx +90 -0
  42. package/src/components/Footer/Footer.tsx +159 -0
  43. package/src/components/Footer/Footer.types.tsx +61 -0
  44. package/src/components/Footer/footerClassNames.tsx +57 -0
  45. package/src/components/FormButton/FormButton.stories.tsx +199 -0
  46. package/src/components/FormButton/FormButton.test.tsx +73 -0
  47. package/src/components/FormButton/FormButton.tsx +116 -0
  48. package/src/components/FormButton/FormButton.types.ts +32 -0
  49. package/src/components/FormButton/formButtonClassNames.tsx +153 -0
  50. package/src/components/FormButton/index.ts +2 -0
  51. package/src/components/GenericList/DUMMYLISTDATA.json +560 -0
  52. package/src/components/GenericList/GenericList.stories.tsx +104 -0
  53. package/src/components/GenericList/GenericList.test.tsx +29 -0
  54. package/src/components/GenericList/GenericList.tsx +146 -0
  55. package/src/components/GenericList/genericListClassNames.tsx +8 -0
  56. package/src/components/GenericList/templates/DummyDataList.tsx +23 -0
  57. package/src/components/GenericList/templates/DynamicIconList.tsx +74 -0
  58. package/src/components/HamburgerButton/HamburgerButton.tsx +68 -0
  59. package/src/components/HamburgerButton/HamburgerButton.types.tsx +6 -0
  60. package/src/components/HamburgerButton/index.ts +2 -0
  61. package/src/components/Header/DUMMYICONDATA.json +136 -0
  62. package/src/components/Header/Header.stories.tsx +521 -0
  63. package/src/components/Header/Header.test.tsx +323 -0
  64. package/src/components/Header/Header.tsx +289 -0
  65. package/src/components/Header/Header.types.ts +52 -0
  66. package/src/components/Header/headerClassNames.tsx +50 -0
  67. package/src/components/Header/headerContext.tsx +125 -0
  68. package/src/components/Header/index.ts +2 -0
  69. package/src/components/Hero/Hero.stories.tsx +69 -0
  70. package/src/components/Hero/Hero.test.tsx +109 -0
  71. package/src/components/Hero/Hero.tsx +58 -0
  72. package/src/components/Hero/Hero.types.ts +9 -0
  73. package/src/components/Hero/index.ts +2 -0
  74. package/src/components/Icon/Icon.stories.tsx +227 -0
  75. package/src/components/Icon/Icon.test.tsx +53 -0
  76. package/src/components/Icon/Icon.tsx +208 -0
  77. package/src/components/Icon/Icon.types.ts +24 -0
  78. package/src/components/Icon/iconClassNames.ts +79 -0
  79. package/src/components/Icon/index.ts +2 -0
  80. package/src/components/Image/Image.stories.tsx +79 -0
  81. package/src/components/Image/Image.test.tsx +87 -0
  82. package/src/components/Image/Image.tsx +49 -0
  83. package/src/components/Image/Image.types.ts +11 -0
  84. package/src/components/Image/index.ts +2 -0
  85. package/src/components/Input/Input.stories.tsx +651 -0
  86. package/src/components/Input/Input.test.tsx +90 -0
  87. package/src/components/Input/Input.tsx +226 -0
  88. package/src/components/Input/Input.types.ts +52 -0
  89. package/src/components/Input/InputMemoTypes.tsx +32 -0
  90. package/src/components/Input/index.ts +2 -0
  91. package/src/components/Input/inputClassNames.tsx +169 -0
  92. package/src/components/MobileMenu/MobileMenu.tsx +41 -0
  93. package/src/components/MobileMenu/MobileMenu.types.tsx +30 -0
  94. package/src/components/MobileMenu/index.ts +2 -0
  95. package/src/components/Nav/DUMMYNAVDATA.json +234 -0
  96. package/src/components/Nav/Nav.stories.tsx +181 -0
  97. package/src/components/Nav/Nav.test.tsx +89 -0
  98. package/src/components/Nav/Nav.tsx +242 -0
  99. package/src/components/Nav/Nav.types.tsx +35 -0
  100. package/src/components/Nav/index.ts +2 -0
  101. package/src/components/Nav/navClassNames.tsx +192 -0
  102. package/src/components/Page/TableDataDummy.tsx +216 -0
  103. package/src/components/Page/ViewPageTemplate.stories.tsx +546 -0
  104. package/src/components/Page/ViewPageTemplate.test.tsx +361 -0
  105. package/src/components/Page/ViewPageTemplate.tsx +10 -0
  106. package/src/components/Page/ViewPageTemplate.types.ts +6 -0
  107. package/src/components/Page/index.ts +2 -0
  108. package/src/components/PageSection/PageSection.stories.tsx +114 -0
  109. package/src/components/PageSection/PageSection.tsx +12 -0
  110. package/src/components/PageSection/PageSection.types.ts +6 -0
  111. package/src/components/PageSection/PageSections.test.tsx +88 -0
  112. package/src/components/PageSection/index.ts +2 -0
  113. package/src/components/Text/Text.stories.tsx +60 -0
  114. package/src/components/Text/Text.test.tsx +52 -0
  115. package/src/components/Text/Text.tsx +80 -0
  116. package/src/components/Text/Text.types.ts +12 -0
  117. package/src/components/Text/index.ts +2 -0
  118. package/src/components/Toaster/Toaster.stories.tsx +122 -0
  119. package/src/components/Toaster/Toaster.test.tsx +61 -0
  120. package/src/components/Toaster/Toaster.tsx +80 -0
  121. package/src/components/Toaster/Toaster.types.ts +12 -0
  122. package/src/components/Toaster/index.ts +2 -0
  123. package/src/hoc/index.ts +2 -0
  124. package/src/hoc/styling/withStoryBook.tsx +19 -0
  125. package/src/main.css +3 -0
  126. package/src/setupTests.ts +1 -0
  127. package/src/userHoc/index.ts +1 -0
  128. package/src/userHoc/withMemo.tsx +20 -0
  129. package/src/utils/assertTagName.tsx +7 -0
  130. package/src/utils/generateAccordionItem.tsx +102 -0
  131. package/src/utils/generateFooterContacts.tsx +75 -0
  132. package/src/utils/generateNavMenu.tsx +54 -0
  133. package/src/utils/generateSocialList.tsx +34 -0
  134. package/src/utils/getFontAwesomeIcon.tsx +25 -0
  135. package/src/utils/inputValidation.tsx +26 -0
  136. package/tailwind.config.js +32 -0
  137. package/tsconfig.json +25 -0
  138. package/vite.config.ts +33 -0
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import Text from "../components/Text/Text";
3
+
4
+ type Link = {
5
+ link: string;
6
+ menuItem: string;
7
+ };
8
+
9
+ type NavItem = {
10
+ title: string;
11
+ links: Link[];
12
+ };
13
+
14
+ type NavItemProps = {
15
+ navDataList: NavItem[];
16
+ };
17
+
18
+ export const NavList: React.FC<NavItemProps> = ({ navDataList }) => {
19
+ return (
20
+ <>
21
+ {navDataList.map((item) => (
22
+ <div className="flex flex-col" key={item.title}>
23
+ <div data-testid={item.title}>
24
+ <Text
25
+ size={"md"}
26
+ color={"black"}
27
+ text={item.title}
28
+ fontFamily={""}
29
+ additionalClasses="font-bold uppercase mb-3"
30
+ />
31
+ </div>
32
+ <ul>
33
+ {item.links.map((link) => (
34
+ <li key={link.menuItem}>
35
+ <a
36
+ className="link link-hover my-3"
37
+ href={link.link}
38
+ data-testid={link.menuItem}
39
+ >
40
+ <Text
41
+ size={"sm"}
42
+ color={"black"}
43
+ text={link.menuItem}
44
+ fontFamily={""}
45
+ />
46
+ </a>
47
+ </li>
48
+ ))}
49
+ </ul>
50
+ </div>
51
+ ))}
52
+ </>
53
+ );
54
+ };
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+
3
+ type SocialListProps = {
4
+ socialDataList: {
5
+ type: string;
6
+ xmlns: string;
7
+ path: string;
8
+ ariaLabel: string;
9
+ href: string;
10
+ }[];
11
+ };
12
+
13
+ export const SocialList: React.FC<SocialListProps> = ({ socialDataList }) => {
14
+ return (
15
+ <>
16
+ {socialDataList.map((item) => (
17
+ <a href={item.href} key={item.href}>
18
+ <svg
19
+ xmlns={item.xmlns}
20
+ width="24"
21
+ height="24"
22
+ viewBox="0 0 24 24"
23
+ className="fill-current"
24
+ aria-label={item.ariaLabel}
25
+ data-testid={item.ariaLabel}
26
+ tabIndex={0}
27
+ >
28
+ <path d={item.path}></path>
29
+ </svg>
30
+ </a>
31
+ ))}
32
+ </>
33
+ );
34
+ };
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3
+ import * as Icons from "@fortawesome/free-solid-svg-icons";
4
+
5
+ export const getFontAwesomeIcon = (
6
+ iconName: string
7
+ ): React.ReactElement | null => {
8
+ try {
9
+ // Extract the required icon using bracket notation
10
+ const iconKey = `fa${iconName.charAt(0).toUpperCase()}${iconName.slice(
11
+ 1
12
+ )}`;
13
+ const icon = (Icons as any)[iconKey];
14
+
15
+ if (!icon) {
16
+ throw new Error(`Icon not found: ${iconName}`);
17
+ }
18
+
19
+ // Render the FontAwesomeIcon with the selected icon
20
+ return <FontAwesomeIcon icon={icon} />;
21
+ } catch (error) {
22
+ console.error(`Error loading Font Awesome icon: ${iconName}`, error);
23
+ return null;
24
+ }
25
+ };
@@ -0,0 +1,26 @@
1
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; // Basic email regex
2
+ const numberRegex = /^\d+$/; // Only digits
3
+ const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/; // Minimum eight characters, at least one letter and one number
4
+ const minCharactersRegex = /^.{3,}$/;
5
+
6
+ const validateInput = (
7
+ term: string | number,
8
+ regex: RegExp,
9
+ errorMessage: string
10
+ ) => {
11
+ term = term.toString();
12
+
13
+ if (!regex.test(term)) {
14
+ return errorMessage;
15
+ }
16
+
17
+ return "Success";
18
+ };
19
+
20
+ export {
21
+ validateInput,
22
+ emailRegex,
23
+ numberRegex,
24
+ passwordRegex,
25
+ minCharactersRegex,
26
+ };
@@ -0,0 +1,32 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+
3
+
4
+ module.exports = {
5
+ mode: "jit",
6
+ content: ["./src/**/*.{js,jsx,ts,tsx}"],
7
+
8
+ theme: {
9
+ extend: {
10
+ maxHeight: {
11
+ "view-page": "1000px",
12
+ },
13
+ fontSize: {
14
+ "3xl": "2.25rem",
15
+ xxs: ".6rem",
16
+ },
17
+ minWidth: {
18
+ navDropDown: "25em",
19
+ },
20
+ maxWidth: {
21
+ pageSectionMaxWidth: "1500px",
22
+ },
23
+ },
24
+ fontFamily: {
25
+ sans: ["ui-sans-serif"],
26
+ serif: ["ui-serif"],
27
+ mono: ["ui-monospace"],
28
+ },
29
+ },
30
+
31
+ plugins: [require("daisyui")],
32
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "target": "ESNext",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
7
+ "allowJs": false,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true, // Updated to true for better module compatibility
10
+ "allowSyntheticDefaultImports": true,
11
+ "strict": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "module": "ESNext",
14
+ "moduleResolution": "Node",
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true,
17
+ "noEmit": true,
18
+ "jsx": "react-jsx"
19
+ },
20
+ "include": [
21
+ "./src/**/*", // Ensure all source files are included
22
+ "./vite.config.ts" // Include your Vite configuration
23
+ ],
24
+ "types": ["vitest/globals"] // Explicitly include Vitest types
25
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ // If you have TypeScript path aliases, they should be specified in your tsconfig.json
5
+ // and this plugin will make Vite understand them.
6
+ import tsconfigPaths from "vite-tsconfig-paths";
7
+ // Include Vitest types
8
+ /// <reference types="vitest" />
9
+ export default defineConfig({
10
+ plugins: [react(), tsconfigPaths()],
11
+ server: {
12
+ host: true,
13
+ port: 6006,
14
+ },
15
+ // @ts-ignore
16
+ test: {
17
+ globals: true,
18
+ environment: "jsdom",
19
+ setupFiles: "./src/setupTests.ts",
20
+ // include: ["**/*.{test,spec}.{js,jsx,ts,tsx}"],
21
+ exclude: [
22
+ "./index,js",
23
+ "./node_modules/**",
24
+ "./**/*.stories.tsx",
25
+ "./**/postcss.config.js",
26
+ "./**/tailwind.config.js",
27
+ "",
28
+ ],
29
+ coverage: {
30
+ provider: "istanbul",
31
+ },
32
+ },
33
+ });