linkedunion-design-kit 1.7.4 → 1.7.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 (96) hide show
  1. package/dist/src/components/Card/PhotoGallery.css +11 -0
  2. package/dist/src/components/Label/Label.js +5 -5
  3. package/dist/src/components/Typography/Heading/heading.js +6 -6
  4. package/dist/src/components/ui/caption.js +1 -1
  5. package/dist/styles/global.css +0 -4
  6. package/package.json +1 -1
  7. package/dist/app/layout.jsx +0 -13
  8. package/dist/app/page.jsx +0 -5
  9. package/dist/src/components/Accordion/Accordion.stories.jsx +0 -25
  10. package/dist/src/components/Avatar/Avatar.jsx +0 -17
  11. package/dist/src/components/Avatar/Avatar.stories.jsx +0 -31
  12. package/dist/src/components/Avatar/Avatar.test.jsx +0 -51
  13. package/dist/src/components/Button/Button.jsx +0 -93
  14. package/dist/src/components/Button/Button.stories.jsx +0 -248
  15. package/dist/src/components/Button/Button.test.jsx +0 -73
  16. package/dist/src/components/Button/IconButton.jsx +0 -70
  17. package/dist/src/components/Button/IconButton.stories.jsx +0 -53
  18. package/dist/src/components/Button/IconButton.test.jsx +0 -27
  19. package/dist/src/components/Card/MultipleNews/MultiNews.jsx +0 -73
  20. package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +0 -52
  21. package/dist/src/components/Card/PhotoGallery.jsx +0 -17
  22. package/dist/src/components/Card/PhotoGallery.stories.jsx +0 -34
  23. package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +0 -60
  24. package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +0 -54
  25. package/dist/src/components/Card/SinglePost.d.ts +0 -2
  26. package/dist/src/components/Card/SinglePost.js +0 -10
  27. package/dist/src/components/Card/SinglePost.jsx +0 -27
  28. package/dist/src/components/Card/SinglePost.stories.d.ts +0 -7
  29. package/dist/src/components/Card/SinglePost.stories.js +0 -46
  30. package/dist/src/components/Card/SinglePost.stories.jsx +0 -46
  31. package/dist/src/components/Card/card.jsx +0 -33
  32. package/dist/src/components/Card/contactProfile/ContactProfile.jsx +0 -60
  33. package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +0 -52
  34. package/dist/src/components/Checkbox/checkbox.stories.jsx +0 -91
  35. package/dist/src/components/ColorPicker/ColorPicker.jsx +0 -65
  36. package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +0 -14
  37. package/dist/src/components/Colors/color.jsx +0 -5
  38. package/dist/src/components/Colors/color.stories.jsx +0 -20
  39. package/dist/src/components/Colors/color.test.jsx +0 -23
  40. package/dist/src/components/Icons/IconList.test.jsx +0 -57
  41. package/dist/src/components/Icons/IconView.jsx +0 -25
  42. package/dist/src/components/Icons/IconView.stories.jsx +0 -8
  43. package/dist/src/components/Icons/LUIcon.jsx +0 -37
  44. package/dist/src/components/Icons/LUIcon.stories.jsx +0 -63
  45. package/dist/src/components/Icons/SingleIcon.test.jsx +0 -56
  46. package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +0 -18
  47. package/dist/src/components/ImageUploader/imageUploader.jsx +0 -83
  48. package/dist/src/components/Images/LuImage.jsx +0 -19
  49. package/dist/src/components/Images/LuImage.stories.jsx +0 -154
  50. package/dist/src/components/Images/LuImage.test.jsx +0 -44
  51. package/dist/src/components/Input/Input.stories.jsx +0 -34
  52. package/dist/src/components/Label/Label.jsx +0 -32
  53. package/dist/src/components/Label/Label.stories.jsx +0 -30
  54. package/dist/src/components/MediaCard/Card.jsx +0 -36
  55. package/dist/src/components/MediaCard/Card.stories.jsx +0 -56
  56. package/dist/src/components/MediaCard/Card.test.jsx +0 -27
  57. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.jsx +0 -22
  58. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.jsx +0 -60
  59. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.jsx +0 -27
  60. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.jsx +0 -87
  61. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.jsx +0 -23
  62. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.jsx +0 -87
  63. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.jsx +0 -24
  64. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.jsx +0 -61
  65. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.jsx +0 -25
  66. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.jsx +0 -87
  67. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.jsx +0 -23
  68. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.jsx +0 -87
  69. package/dist/src/components/MediaCard/VerticalCard/VerticalCard.jsx +0 -30
  70. package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.jsx +0 -65
  71. package/dist/src/components/RadioButton/RadioButton.stories.jsx +0 -40
  72. package/dist/src/components/RadioButton/radio-button.jsx +0 -29
  73. package/dist/src/components/Slider/Slider.stories.jsx +0 -159
  74. package/dist/src/components/Slider/slider.jsx +0 -31
  75. package/dist/src/components/Switch/Switch.stories.jsx +0 -66
  76. package/dist/src/components/Tabs/Tabs.stories.jsx +0 -29
  77. package/dist/src/components/Title/Title.jsx +0 -8
  78. package/dist/src/components/Title/Title.stories.jsx +0 -37
  79. package/dist/src/components/Title/Title.test.jsx +0 -24
  80. package/dist/src/components/ToolTip/Tooltip.jsx +0 -18
  81. package/dist/src/components/ToolTip/Tooltip.stories.jsx +0 -25
  82. package/dist/src/components/Typography/Body/Body.stories.jsx +0 -34
  83. package/dist/src/components/Typography/Body/body.jsx +0 -52
  84. package/dist/src/components/Typography/Caption/Caption.stories.jsx +0 -24
  85. package/dist/src/components/Typography/Display/Display.stories.jsx +0 -24
  86. package/dist/src/components/Typography/Display/display.jsx +0 -39
  87. package/dist/src/components/Typography/Heading/Heading.stories.jsx +0 -24
  88. package/dist/src/components/Typography/Heading/heading.jsx +0 -60
  89. package/dist/src/components/ui/accordion.jsx +0 -39
  90. package/dist/src/components/ui/caption.jsx +0 -25
  91. package/dist/src/components/ui/checkbox.jsx +0 -24
  92. package/dist/src/components/ui/input.jsx +0 -18
  93. package/dist/src/components/ui/switch.jsx +0 -61
  94. package/dist/src/components/ui/tabs.jsx +0 -31
  95. package/dist/src/components/ui/tooltip.jsx +0 -38
  96. package/dist/src/components/ui/typography.jsx +0 -56
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { render, screen } from "@testing-library/react";
38
- import "@testing-library/jest-dom";
39
- import { ContactProfileTheme1 } from "./ContactProfileTheme1";
40
- import userEvent from "@testing-library/user-event";
41
- describe("ContactProfileTheme1 Component", function () {
42
- var mockProps = {
43
- id: 1,
44
- heading: "John Doe",
45
- body: "Software Engineer",
46
- image: "https://via.placeholder.com/150",
47
- btnLabel: "View Profile",
48
- href: "/profile",
49
- className: "custom-class",
50
- };
51
- it("Render the contact profile theme1 with correct body and heading text", function () {
52
- render(<ContactProfileTheme1 {...mockProps}/>);
53
- var headingElement = screen.getByText(mockProps.heading);
54
- var bodyElement = screen.getByText(mockProps.body);
55
- expect(headingElement).toBeInTheDocument();
56
- expect(bodyElement).toBeInTheDocument();
57
- });
58
- it("renders the button with correct label and icon", function () {
59
- render(<ContactProfileTheme1 {...mockProps}/>);
60
- var buttonElement = screen.getByRole("button", {
61
- name: mockProps.btnLabel,
62
- });
63
- expect(buttonElement).toBeInTheDocument();
64
- expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
65
- });
66
- it("renders the link with the correct href", function () {
67
- render(<ContactProfileTheme1 {...mockProps}/>);
68
- var linkElement = screen.getByRole("link");
69
- expect(linkElement).toHaveAttribute("href", mockProps.href);
70
- });
71
- it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
72
- var user, linkElement;
73
- return __generator(this, function (_a) {
74
- switch (_a.label) {
75
- case 0:
76
- render(<ContactProfileTheme1 {...mockProps}/>);
77
- user = userEvent.setup();
78
- linkElement = screen.getByRole("link");
79
- return [4 /*yield*/, user.click(linkElement)];
80
- case 1:
81
- _a.sent();
82
- expect(linkElement).toHaveAttribute("href", mockProps.href);
83
- return [2 /*return*/];
84
- }
85
- });
86
- }); });
87
- });
@@ -1,23 +0,0 @@
1
- import Link from "next/link";
2
- import LuImage from "../../../components/Images/LuImage";
3
- import { Button } from "../../../components/Button/Button";
4
- export var ContactProfileTheme2 = function (props) {
5
- return (<div data-testid="contact-profile-theme2" className={"p-8 card_bg_ContactProfile_".concat(props.id, " rounded-xl ").concat(props.className, " card_shadow_ContactProfile_").concat(props.id, " flex flex-col items-center")}>
6
- <div className="max-w-[160px] overflow-hidden aspect-square">
7
- <LuImage src={props.image} width={160} height={160} className="h-full object-cover rounded-full" alt="Contact Profile"/>
8
- </div>
9
- <div className={"flex flex-col items-center flex-grow m-5 text-center h-[100px]"}>
10
- <div className={"card_ContactProfile_title_color_".concat(props.id, " text-2xl font-semibold line-clamp-1 capitalize")}>
11
- {props.heading}
12
- </div>
13
- <p className={"text-base\tfont-extralight\tcard_ContactProfile_designation_color_".concat(props.id, " line-clamp-2")}>
14
- {props.body}
15
- </p>
16
- </div>
17
- <Link href={props.href} passHref className="w-full no-underline">
18
- <Button endIcon={"angle-right"} size="lg" className={"rounded justify-between w-full card_ContactProfile_btn_".concat(props.id)}>
19
- {props.btnLabel}
20
- </Button>
21
- </Link>
22
- </div>);
23
- };
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { render, screen } from "@testing-library/react";
38
- import "@testing-library/jest-dom";
39
- import { ContactProfileTheme2 } from "./ContactProfileTheme2";
40
- import userEvent from "@testing-library/user-event";
41
- describe("ContactProfileTheme1 Component", function () {
42
- var mockProps = {
43
- id: 1,
44
- heading: "John Doe",
45
- body: "Software Engineer",
46
- image: "https://via.placeholder.com/150",
47
- btnLabel: "View Profile",
48
- href: "/profile",
49
- className: "custom-class",
50
- };
51
- it("Render the contact profile theme1 with correct body and heading text", function () {
52
- render(<ContactProfileTheme2 {...mockProps}/>);
53
- var headingElement = screen.getByText(mockProps.heading);
54
- var bodyElement = screen.getByText(mockProps.body);
55
- expect(headingElement).toBeInTheDocument();
56
- expect(bodyElement).toBeInTheDocument();
57
- });
58
- it("renders the button with correct label and icon", function () {
59
- render(<ContactProfileTheme2 {...mockProps}/>);
60
- var buttonElement = screen.getByRole("button", {
61
- name: mockProps.btnLabel,
62
- });
63
- expect(buttonElement).toBeInTheDocument();
64
- expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
65
- });
66
- it("renders the link with the correct href", function () {
67
- render(<ContactProfileTheme2 {...mockProps}/>);
68
- var linkElement = screen.getByRole("link");
69
- expect(linkElement).toHaveAttribute("href", mockProps.href);
70
- });
71
- it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
72
- var user, linkElement;
73
- return __generator(this, function (_a) {
74
- switch (_a.label) {
75
- case 0:
76
- render(<ContactProfileTheme2 {...mockProps}/>);
77
- user = userEvent.setup();
78
- linkElement = screen.getByRole("link");
79
- return [4 /*yield*/, user.click(linkElement)];
80
- case 1:
81
- _a.sent();
82
- expect(linkElement).toHaveAttribute("href", mockProps.href);
83
- return [2 /*return*/];
84
- }
85
- });
86
- }); });
87
- });
@@ -1,24 +0,0 @@
1
- import { colors } from "../../../utils/colors";
2
- import { PostByCategoryTheme1 } from "./PostByCategoryTheme1";
3
- import { PostByCategoryTheme2 } from "./PostByCategoryTheme2";
4
- import { OrientationEnum } from "../../../utils/enums";
5
- export var PostByCategory = function (props) {
6
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7
- return (<div>
8
- {props.layout === OrientationEnum.horizontal ? (<PostByCategoryTheme1 {...props}/>) : (<PostByCategoryTheme2 {...props}/>)}
9
- <style jsx global>
10
- {"\n .card_PostByCategory_title_color_".concat(props.id, " {\n color: ").concat(((_a = props.cardStyle) === null || _a === void 0 ? void 0 : _a.card_title_color) || colors.black, ";\n }\n .card_PostByCategory_description_color_").concat(props.id, " {\n color: ").concat(((_b = props.cardStyle) === null || _b === void 0 ? void 0 : _b.card_description_color) ||
11
- colors["gray-500"], ";\n }\n .card_shadow_PostByCategory_").concat(props.id, " {\n box-shadow: ").concat(((_c = props.cardStyle) === null || _c === void 0 ? void 0 : _c.card_shadow_toggle) === 1
12
- ? "0px 4px 12px 0px ".concat(((_d = props.cardStyle) === null || _d === void 0 ? void 0 : _d.card_shadow_color) || "rgba(52, 52, 52, 0.15)") //TODO: change shadow color with our color theme
13
- : "0px 4px 12px 0px rgba(52, 52, 52, 0.15)", ";\n }\n .card_bg_PostByCategory_").concat(props.id, " {\n background-color: ").concat(((_e = props.cardStyle) === null || _e === void 0 ? void 0 : _e.card_background_color) ||
14
- colors.white, " !important;\n }\n .card_PostByCategory_btn_").concat(props.id, " {\n background-color: ").concat(((_f = props.cardStyle) === null || _f === void 0 ? void 0 : _f.card_button_background_color) ||
15
- colors["gray-50"], " !important;\n color: ").concat(((_g = props.cardStyle) === null || _g === void 0 ? void 0 : _g.card_button_text_color) ||
16
- colors["gray-950"], " !important;\n fill: ").concat(((_h = props.cardStyle) === null || _h === void 0 ? void 0 : _h.card_button_text_color) ||
17
- colors["gray-950"], " !important;\n }\n .card_PostByCategory_btn_").concat(props.id, ":hover {\n background-color: ").concat(((_j = props.cardStyle) === null || _j === void 0 ? void 0 : _j.card_button_background_color) ||
18
- colors["gray-50"], " !important;\n color: ").concat(((_k = props.cardStyle) === null || _k === void 0 ? void 0 : _k.card_button_text_color) ||
19
- colors["gray-950"], " !important;\n fill: ").concat(((_l = props.cardStyle) === null || _l === void 0 ? void 0 : _l.card_button_text_color) ||
20
- colors["gray-950"], " !important;\n }\n .card_PostByCategory_theme2_image_").concat(props === null || props === void 0 ? void 0 : props.id, " {\n border-color: ").concat(((_m = props.cardStyle) === null || _m === void 0 ? void 0 : _m.card_image_border_color) ||
21
- (colors === null || colors === void 0 ? void 0 : colors.black), " !important;\n border-radius: ").concat(((_o = props.cardStyle) === null || _o === void 0 ? void 0 : _o.card_image_border_radius) || "0", "%;\n border: ").concat(((_p = props.cardStyle) === null || _p === void 0 ? void 0 : _p.card_image_border) || "0", "px solid;\n }\n ")}
22
- </style>
23
- </div>);
24
- };
@@ -1,61 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { render, screen } from "@testing-library/react";
13
- import { PostByCategory } from "./PostByCategory";
14
- import { OrientationEnum } from "../../../utils/enums";
15
- import { Dummy_Url } from "../../../utils/constants";
16
- var mockProps = {
17
- id: 1,
18
- layout: OrientationEnum.horizontal,
19
- image: "/images/demo-image.jpg",
20
- cardStyle: {
21
- card_title_color: "#000000",
22
- card_description_color: "#666666",
23
- card_shadow_toggle: 1,
24
- card_shadow_color: "rgba(0,0,0,0.2)",
25
- card_background_color: "#ffffff",
26
- card_button_background_color: "#f5f5f5",
27
- card_button_text_color: "#333333",
28
- },
29
- href: Dummy_Url,
30
- };
31
- describe("PostByCategory Component", function () {
32
- it("renders PostByCategoryTheme1 when layout is horizontal", function () {
33
- render(<PostByCategory {...mockProps}/>);
34
- expect(screen.getByTestId("postByCategory-theme1")).toBeInTheDocument();
35
- });
36
- it("renders PostByCategoryTheme2 when layout is vertical", function () {
37
- render(<PostByCategory {...mockProps} layout={OrientationEnum.vertical}/>);
38
- expect(screen.getByTestId("postByCategory-theme2")).toBeInTheDocument();
39
- });
40
- it("applies correct styles based on id", function () {
41
- render(<PostByCategory {...mockProps}/>);
42
- var styles = document.styleSheets[document.styleSheets.length - 1].cssRules;
43
- expect(Array.from(styles).some(function (rule) {
44
- return rule.cssText.includes(".card_PostByCategory_title_color_1");
45
- })).toBeTruthy();
46
- expect(Array.from(styles).some(function (rule) {
47
- return rule.cssText.includes(".card_bg_PostByCategory_1");
48
- })).toBeTruthy();
49
- });
50
- it("applies default shadow when card_shadow_toggle is not 1", function () {
51
- render(<PostByCategory {...mockProps} cardStyle={__assign(__assign({}, mockProps.cardStyle), { card_shadow_toggle: 0 })}/>);
52
- var styles = document.styleSheets[document.styleSheets.length - 1].cssRules;
53
- expect(Array.from(styles).some(function (rule) {
54
- return rule.cssText.includes("box-shadow: 0px 4px 12px 0px rgba(52, 52, 52, 0.15)");
55
- })).toBeTruthy();
56
- });
57
- it("renders correctly when cardStyle is undefined", function () {
58
- render(<PostByCategory {...mockProps} cardStyle={undefined}/>);
59
- expect(screen.getByTestId("postByCategory-theme1")).toBeInTheDocument();
60
- });
61
- });
@@ -1,25 +0,0 @@
1
- import Link from "next/link";
2
- import LuImage from "../../../components/Images/LuImage";
3
- import { Button } from "../../../components/Button/Button";
4
- export var PostByCategoryTheme1 = function (props) {
5
- return (<div data-testid="postByCategory-theme1" className={"p-5 card_bg_PostByCategory_".concat(props.id, " rounded-xl ").concat(props.className, " card_shadow_PostByCategory_").concat(props.id, " flex gap-x-[20px] w-full")}>
6
- <div className={"max-w-[240px] overflow-hidden aspect-square max-xs:hidden"}>
7
- <LuImage src={props.image} width={240} height={240} className="rounded-lg w-full h-full object-cover" alt="Post By Category"/>
8
- </div>
9
- <div className="flex flex-1 flex-col">
10
- <div className={"flex flex-col justify-center flex-1 h-full"}>
11
- <div className={"card_PostByCategory_title_color_".concat(props.id, " text-2xl font-semibold capitalize line-clamp-1")}>
12
- {props.heading}
13
- </div>
14
- <p className={"card_PostByCategory_description_color_".concat(props.id, " text-base font-extralight line-clamp-2 max-xs:line-clamp-1 max-xs:mt-[7px]")}>
15
- {props.body}
16
- </p>
17
- </div>
18
- <Link href={props.href} passHref className="w-full no-underline">
19
- <Button endIcon={"angle-right"} size="lg" className={"rounded justify-between w-full max-xs:mt-2.5 card_PostByCategory_btn_".concat(props.id)}>
20
- {props.btnLabel}
21
- </Button>
22
- </Link>
23
- </div>
24
- </div>);
25
- };
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { render, screen } from "@testing-library/react";
38
- import "@testing-library/jest-dom";
39
- import { PostByCategoryTheme1 } from "./PostByCategoryTheme1";
40
- import userEvent from "@testing-library/user-event";
41
- describe("PostByCategoryTheme1 Component", function () {
42
- var mockProps = {
43
- id: 1,
44
- heading: "John Doe",
45
- body: "Software Engineer",
46
- image: "https://via.placeholder.com/150",
47
- btnLabel: "View Profile",
48
- href: "/profile",
49
- className: "custom-class",
50
- };
51
- it("Render the post by category theme1 with correct body and heading text", function () {
52
- render(<PostByCategoryTheme1 {...mockProps}/>);
53
- var headingElement = screen.getByText(mockProps.heading);
54
- var bodyElement = screen.getByText(mockProps.body);
55
- expect(headingElement).toBeInTheDocument();
56
- expect(bodyElement).toBeInTheDocument();
57
- });
58
- it("renders the button with correct label and icon", function () {
59
- render(<PostByCategoryTheme1 {...mockProps}/>);
60
- var buttonElement = screen.getByRole("button", {
61
- name: mockProps.btnLabel,
62
- });
63
- expect(buttonElement).toBeInTheDocument();
64
- expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
65
- });
66
- it("renders the link with the correct href", function () {
67
- render(<PostByCategoryTheme1 {...mockProps}/>);
68
- var linkElement = screen.getByRole("link");
69
- expect(linkElement).toHaveAttribute("href", mockProps.href);
70
- });
71
- it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
72
- var user, linkElement;
73
- return __generator(this, function (_a) {
74
- switch (_a.label) {
75
- case 0:
76
- render(<PostByCategoryTheme1 {...mockProps}/>);
77
- user = userEvent.setup();
78
- linkElement = screen.getByRole("link");
79
- return [4 /*yield*/, user.click(linkElement)];
80
- case 1:
81
- _a.sent();
82
- expect(linkElement).toHaveAttribute("href", mockProps.href);
83
- return [2 /*return*/];
84
- }
85
- });
86
- }); });
87
- });
@@ -1,23 +0,0 @@
1
- import Link from "next/link";
2
- import LuImage from "../../../components/Images/LuImage";
3
- import { Button } from "../../../components/Button/Button";
4
- export var PostByCategoryTheme2 = function (props) {
5
- return (<div data-testid="postByCategory-theme2" className={"p-8 card_bg_PostByCategory_".concat(props.id, " rounded-xl ").concat(props.className, " card_shadow_PostByCategory_").concat(props.id, " flex flex-col items-center w-full")}>
6
- <div className="w-full max-w-[240px] overflow-hidden aspect-square">
7
- <LuImage src={props.image} width={240} height={240} className={"w-full h-full object-cover card_PostByCategory_theme2_image_".concat(props === null || props === void 0 ? void 0 : props.id)} alt="Post By Category"/>
8
- </div>
9
- <div className={"flex flex-col items-center flex-grow m-5 text-center h-[100px]"}>
10
- <div className={"text-default card_PostByCategory_title_color_".concat(props.id, " text-2xl font-semibold capitalize line-clamp-1")}>
11
- {props.heading}
12
- </div>
13
- <p className={"card_PostByCategory_description_color_".concat(props.id, " text-base font-extralight line-clamp-2 max-xs:line-clamp-1 max-sm:mt-[7px]")}>
14
- {props.body}
15
- </p>
16
- </div>
17
- <Link href={props.href} passHref className="w-full no-underline">
18
- <Button endIcon={"angle-right"} size="lg" className={"rounded justify-between w-full card_PostByCategory_btn_".concat(props.id)}>
19
- {props.btnLabel}
20
- </Button>
21
- </Link>
22
- </div>);
23
- };
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import { render, screen } from "@testing-library/react";
38
- import "@testing-library/jest-dom";
39
- import { PostByCategoryTheme2 } from "./PostByCategoryTheme2";
40
- import userEvent from "@testing-library/user-event";
41
- describe("PostByCategoryTheme2 Component", function () {
42
- var mockProps = {
43
- id: 1,
44
- heading: "John Doe",
45
- body: "Software Engineer",
46
- image: "https://via.placeholder.com/150",
47
- btnLabel: "View Profile",
48
- href: "/profile",
49
- className: "custom-class",
50
- };
51
- it("Render the post by category theme2 with correct body and heading text", function () {
52
- render(<PostByCategoryTheme2 {...mockProps}/>);
53
- var headingElement = screen.getByText(mockProps.heading);
54
- var bodyElement = screen.getByText(mockProps.body);
55
- expect(headingElement).toBeInTheDocument();
56
- expect(bodyElement).toBeInTheDocument();
57
- });
58
- it("renders the button with correct label and icon", function () {
59
- render(<PostByCategoryTheme2 {...mockProps}/>);
60
- var buttonElement = screen.getByRole("button", {
61
- name: mockProps.btnLabel,
62
- });
63
- expect(buttonElement).toBeInTheDocument();
64
- expect(buttonElement).toHaveTextContent(mockProps.btnLabel);
65
- });
66
- it("renders the link with the correct href", function () {
67
- render(<PostByCategoryTheme2 {...mockProps}/>);
68
- var linkElement = screen.getByRole("link");
69
- expect(linkElement).toHaveAttribute("href", mockProps.href);
70
- });
71
- it("triggers navigation when the button is clicked", function () { return __awaiter(void 0, void 0, void 0, function () {
72
- var user, linkElement;
73
- return __generator(this, function (_a) {
74
- switch (_a.label) {
75
- case 0:
76
- render(<PostByCategoryTheme2 {...mockProps}/>);
77
- user = userEvent.setup();
78
- linkElement = screen.getByRole("link");
79
- return [4 /*yield*/, user.click(linkElement)];
80
- case 1:
81
- _a.sent();
82
- expect(linkElement).toHaveAttribute("href", mockProps.href);
83
- return [2 /*return*/];
84
- }
85
- });
86
- }); });
87
- });
@@ -1,30 +0,0 @@
1
- import LuImage from "../../../components/Images/LuImage";
2
- import Link from "next/link";
3
- import { getCardImageSrc } from "..";
4
- import { Heading } from "../../../components/Typography/Heading/heading";
5
- import { Body } from "../../../components/Typography/Body/body";
6
- import { Button } from "../../../components/Button/Button";
7
- var VerticalCard = function (_a) {
8
- var item = _a.item, footer_logo = _a.footer_logo, _b = _a.href, href = _b === void 0 ? "https://www.google.com/" : _b, _c = _a.btnLabel, btnLabel = _c === void 0 ? "View More" : _c, editor = _a.editor, _d = _a.mediaPosition, mediaPosition = _d === void 0 ? "top" : _d, _e = _a.mediaShape, mediaShape = _e === void 0 ? "square" : _e;
9
- var imageSrc = getCardImageSrc(item === null || item === void 0 ? void 0 : item.image, footer_logo);
10
- return (<div className={"p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[480px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
11
- <div className={"flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center ")}>
12
- <LuImage src={imageSrc} width={240} height={240} className={"w-full h-full ".concat(mediaShape === "square" ? "aspect-5/4 " : "aspect-square rounded-full max-w-[160px]", " object-cover ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>
13
- <div className="flex flex-col gap-1">
14
- <Heading variant="h5-700" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
15
- {" "}
16
- {item === null || item === void 0 ? void 0 : item.title}
17
- </Heading>
18
- <Body variant="body-md" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)}>
19
- {item === null || item === void 0 ? void 0 : item.description}
20
- </Body>
21
- </div>
22
- </div>
23
- <Link href={href} passHref>
24
- <Button endIcon={"angle-right"} size="md" shape="rounded-full" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn)}>
25
- {btnLabel}
26
- </Button>
27
- </Link>
28
- </div>);
29
- };
30
- export default VerticalCard;
@@ -1,65 +0,0 @@
1
- import VerticalCard from "./VerticalCard";
2
- import Card from "../../../components/Card/card";
3
- import { Dummy_Para, Dummy_Title } from "../../../utils/constants";
4
- export default {
5
- title: "Components/VerticalCard",
6
- component: VerticalCard,
7
- };
8
- var Template = function (args) { return <Card {...args}/>; };
9
- export var _VerticalCard = Template.bind({});
10
- _VerticalCard.args = {
11
- item: {
12
- image: "/images/demo-image.jpg",
13
- title: Dummy_Title,
14
- description: Dummy_Para,
15
- },
16
- type: "postByCategory",
17
- image: "/images/demo-image.jpg",
18
- href: "https://www.google.com/",
19
- btnLabel: "View More",
20
- editor: {
21
- card: "",
22
- cardImage: "",
23
- cardTitle: "",
24
- cardText: "",
25
- cardBtn: "",
26
- },
27
- orientation: "horizontal",
28
- };
29
- // _Card.args = {
30
- // type: SectionTypeEnum.postByCategoriesTheme,
31
- // image: "/images/demo-image.jpg",
32
- // heading: "Heading Text",
33
- // body: "The quick brown fox jumps over the lazy dog.",
34
- // layout: OrientationEnum.horizontal,
35
- // btnLabel: "View More",
36
- // href: "https://www.google.com/",
37
- // cardStyle: {
38
- // card_title_color: "",
39
- // card_description_color: "",
40
- // card_shadow_toggle: 0,
41
- // card_shadow_color: "",
42
- // card_background_color: "",
43
- // card_button_background_color: "",
44
- // card_button_text_color: "",
45
- // card_image_border_color: "",
46
- // card_image_border_radius: "",
47
- // card_image_border: "",
48
- // },
49
- // id: 1,
50
- // };
51
- // _Card.argTypes = {
52
- // layout: {
53
- // control: { type: "select" },
54
- // options: [OrientationEnum.horizontal, OrientationEnum.vertical],
55
- // },
56
- // type: {
57
- // control: {
58
- // type: "select",
59
- // labels: Object.fromEntries(
60
- // sectionTypeList.map((type) => [type.key, type.label]),
61
- // ),
62
- // },
63
- // options: sectionTypeList.map((type) => type.key),
64
- // },
65
- // };