@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.
- package/Dockerfile +9 -0
- package/README.md +69 -0
- package/assets/Logo.png +0 -0
- package/assets/compass-card-image-2.png +0 -0
- package/assets/compass-card-image-3.png +0 -0
- package/assets/compass-card-image-4.png +0 -0
- package/assets/compass-card-image.png +0 -0
- package/assets/compass-logo.png +0 -0
- package/assets/compass-tech-hero-bg.png +0 -0
- package/assets/contact-image.png +0 -0
- package/assets/green-laptop.png +0 -0
- package/assets/heroImage.png +0 -0
- package/assets/placeholder-no-image-available.png +0 -0
- package/assets/team.png +0 -0
- package/declarations.d.ts +4 -0
- package/docker-compose.yml +22 -0
- package/global.css +4 -0
- package/index.js +4 -0
- package/nodemon.json +5 -0
- package/package.json +70 -0
- package/postcss.config.js +6 -0
- package/src/components/Badge/Badge.stories.tsx +284 -0
- package/src/components/Badge/Badge.test.tsx +185 -0
- package/src/components/Badge/Badge.tsx +137 -0
- package/src/components/Badge/Badge.types.tsx +28 -0
- package/src/components/Badge/badgeClassNames.tsx +152 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +91 -0
- package/src/components/Card/Card.test.tsx +53 -0
- package/src/components/Card/Card.tsx +30 -0
- package/src/components/Card/Card.types.ts +11 -0
- package/src/components/Card/DUMMYPRODUCTDATA.json +670 -0
- package/src/components/Card/cardClassNames.ts +49 -0
- package/src/components/Card/index.ts +3 -0
- package/src/components/Card/templates/CompassCardTemplate.tsx +58 -0
- package/src/components/Card/templates/HorizontalCardTemplate.tsx +184 -0
- package/src/components/Card/templates/VerticalCardTemplate.tsx +154 -0
- package/src/components/Footer/ContactInfoItem.tsx +20 -0
- package/src/components/Footer/DUMMYFOOTERDATA.json +132 -0
- package/src/components/Footer/Footer.stories.tsx +292 -0
- package/src/components/Footer/Footer.test.tsx +90 -0
- package/src/components/Footer/Footer.tsx +159 -0
- package/src/components/Footer/Footer.types.tsx +61 -0
- package/src/components/Footer/footerClassNames.tsx +57 -0
- package/src/components/FormButton/FormButton.stories.tsx +199 -0
- package/src/components/FormButton/FormButton.test.tsx +73 -0
- package/src/components/FormButton/FormButton.tsx +116 -0
- package/src/components/FormButton/FormButton.types.ts +32 -0
- package/src/components/FormButton/formButtonClassNames.tsx +153 -0
- package/src/components/FormButton/index.ts +2 -0
- package/src/components/GenericList/DUMMYLISTDATA.json +560 -0
- package/src/components/GenericList/GenericList.stories.tsx +104 -0
- package/src/components/GenericList/GenericList.test.tsx +29 -0
- package/src/components/GenericList/GenericList.tsx +146 -0
- package/src/components/GenericList/genericListClassNames.tsx +8 -0
- package/src/components/GenericList/templates/DummyDataList.tsx +23 -0
- package/src/components/GenericList/templates/DynamicIconList.tsx +74 -0
- package/src/components/HamburgerButton/HamburgerButton.tsx +68 -0
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +6 -0
- package/src/components/HamburgerButton/index.ts +2 -0
- package/src/components/Header/DUMMYICONDATA.json +136 -0
- package/src/components/Header/Header.stories.tsx +521 -0
- package/src/components/Header/Header.test.tsx +323 -0
- package/src/components/Header/Header.tsx +289 -0
- package/src/components/Header/Header.types.ts +52 -0
- package/src/components/Header/headerClassNames.tsx +50 -0
- package/src/components/Header/headerContext.tsx +125 -0
- package/src/components/Header/index.ts +2 -0
- package/src/components/Hero/Hero.stories.tsx +69 -0
- package/src/components/Hero/Hero.test.tsx +109 -0
- package/src/components/Hero/Hero.tsx +58 -0
- package/src/components/Hero/Hero.types.ts +9 -0
- package/src/components/Hero/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +227 -0
- package/src/components/Icon/Icon.test.tsx +53 -0
- package/src/components/Icon/Icon.tsx +208 -0
- package/src/components/Icon/Icon.types.ts +24 -0
- package/src/components/Icon/iconClassNames.ts +79 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +79 -0
- package/src/components/Image/Image.test.tsx +87 -0
- package/src/components/Image/Image.tsx +49 -0
- package/src/components/Image/Image.types.ts +11 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +651 -0
- package/src/components/Input/Input.test.tsx +90 -0
- package/src/components/Input/Input.tsx +226 -0
- package/src/components/Input/Input.types.ts +52 -0
- package/src/components/Input/InputMemoTypes.tsx +32 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Input/inputClassNames.tsx +169 -0
- package/src/components/MobileMenu/MobileMenu.tsx +41 -0
- package/src/components/MobileMenu/MobileMenu.types.tsx +30 -0
- package/src/components/MobileMenu/index.ts +2 -0
- package/src/components/Nav/DUMMYNAVDATA.json +234 -0
- package/src/components/Nav/Nav.stories.tsx +181 -0
- package/src/components/Nav/Nav.test.tsx +89 -0
- package/src/components/Nav/Nav.tsx +242 -0
- package/src/components/Nav/Nav.types.tsx +35 -0
- package/src/components/Nav/index.ts +2 -0
- package/src/components/Nav/navClassNames.tsx +192 -0
- package/src/components/Page/TableDataDummy.tsx +216 -0
- package/src/components/Page/ViewPageTemplate.stories.tsx +546 -0
- package/src/components/Page/ViewPageTemplate.test.tsx +361 -0
- package/src/components/Page/ViewPageTemplate.tsx +10 -0
- package/src/components/Page/ViewPageTemplate.types.ts +6 -0
- package/src/components/Page/index.ts +2 -0
- package/src/components/PageSection/PageSection.stories.tsx +114 -0
- package/src/components/PageSection/PageSection.tsx +12 -0
- package/src/components/PageSection/PageSection.types.ts +6 -0
- package/src/components/PageSection/PageSections.test.tsx +88 -0
- package/src/components/PageSection/index.ts +2 -0
- package/src/components/Text/Text.stories.tsx +60 -0
- package/src/components/Text/Text.test.tsx +52 -0
- package/src/components/Text/Text.tsx +80 -0
- package/src/components/Text/Text.types.ts +12 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Toaster/Toaster.stories.tsx +122 -0
- package/src/components/Toaster/Toaster.test.tsx +61 -0
- package/src/components/Toaster/Toaster.tsx +80 -0
- package/src/components/Toaster/Toaster.types.ts +12 -0
- package/src/components/Toaster/index.ts +2 -0
- package/src/hoc/index.ts +2 -0
- package/src/hoc/styling/withStoryBook.tsx +19 -0
- package/src/main.css +3 -0
- package/src/setupTests.ts +1 -0
- package/src/userHoc/index.ts +1 -0
- package/src/userHoc/withMemo.tsx +20 -0
- package/src/utils/assertTagName.tsx +7 -0
- package/src/utils/generateAccordionItem.tsx +102 -0
- package/src/utils/generateFooterContacts.tsx +75 -0
- package/src/utils/generateNavMenu.tsx +54 -0
- package/src/utils/generateSocialList.tsx +34 -0
- package/src/utils/getFontAwesomeIcon.tsx +25 -0
- package/src/utils/inputValidation.tsx +26 -0
- package/tailwind.config.js +32 -0
- package/tsconfig.json +25 -0
- 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
|
+
});
|