linkedunion-design-kit 1.5.3 → 1.5.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 (96) hide show
  1. package/dist/index.d.ts +3 -1
  2. package/dist/index.js +3 -1
  3. package/dist/src/components/Avatar/Avatar.js +1 -1
  4. package/dist/src/components/Button/IconButton.d.ts +1 -1
  5. package/dist/src/components/Button/IconButton.js +24 -2
  6. package/dist/src/components/Button/index.js +1 -1
  7. package/dist/src/components/Button/type.d.ts +1 -3
  8. package/dist/src/components/EditorTooltip/EditorTooltip.d.ts +2 -1
  9. package/dist/src/components/EditorTooltip/EditorTooltip.js +2 -2
  10. package/dist/src/components/Input/Input.stories.d.ts +2 -2
  11. package/dist/src/components/Input/Input.stories.js +27 -11
  12. package/dist/src/components/Switch/Switch.stories.d.ts +1 -2
  13. package/dist/src/components/Switch/Switch.stories.js +36 -2
  14. package/dist/src/components/ui/button.d.ts +2 -2
  15. package/dist/src/components/ui/input.js +1 -1
  16. package/dist/src/components/ui/switch.js +2 -2
  17. package/dist/src/components/ui/typography.d.ts +1 -1
  18. package/dist/src/components/ui/typography.js +5 -5
  19. package/dist/src/utils/iconList.js +5 -0
  20. package/dist/styles/global.css +12 -1
  21. package/package.json +1 -1
  22. package/dist/app/layout.jsx +0 -13
  23. package/dist/app/page.jsx +0 -71
  24. package/dist/build/types/app/layout.d.ts +0 -12
  25. package/dist/build/types/app/layout.js +0 -22
  26. package/dist/build/types/app/page.d.ts +0 -12
  27. package/dist/build/types/app/page.js +0 -22
  28. package/dist/src/components/Accordion/Accordion.d.ts +0 -5
  29. package/dist/src/components/Accordion/Accordion.js +0 -7
  30. package/dist/src/components/Accordion/EditorAccordion.d.ts +0 -5
  31. package/dist/src/components/Accordion/EditorAccordion.js +0 -7
  32. package/dist/src/components/Accordion/EditorAccordion.stories.d.ts +0 -6
  33. package/dist/src/components/Accordion/EditorAccordion.stories.js +0 -33
  34. package/dist/src/components/Accordion/type.d.ts +0 -5
  35. package/dist/src/components/Accordion/type.js +0 -1
  36. package/dist/src/components/Avatar/Avatar.jsx +0 -17
  37. package/dist/src/components/Avatar/Avatar.stories.jsx +0 -31
  38. package/dist/src/components/Avatar/Avatar.test.jsx +0 -51
  39. package/dist/src/components/Button/Button.jsx +0 -10
  40. package/dist/src/components/Button/Button.stories.jsx +0 -44
  41. package/dist/src/components/Button/Button.test.jsx +0 -65
  42. package/dist/src/components/Button/IconButton.jsx +0 -9
  43. package/dist/src/components/Button/IconButton.stories.jsx +0 -41
  44. package/dist/src/components/Button/IconButton.test.jsx +0 -29
  45. package/dist/src/components/ColorPicker/ColorPicker.jsx +0 -34
  46. package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +0 -12
  47. package/dist/src/components/Colors/color.jsx +0 -5
  48. package/dist/src/components/Colors/color.stories.jsx +0 -20
  49. package/dist/src/components/Colors/color.test.jsx +0 -23
  50. package/dist/src/components/EditorTooltip/EditorTooltip.jsx +0 -18
  51. package/dist/src/components/EditorTooltip/EditorTooltip.stories.jsx +0 -12
  52. package/dist/src/components/EditorTooltip/type.d.ts +0 -3
  53. package/dist/src/components/EditorTooltip/type.js +0 -1
  54. package/dist/src/components/Icons/IconList.test.jsx +0 -57
  55. package/dist/src/components/Icons/IconView.jsx +0 -25
  56. package/dist/src/components/Icons/IconView.stories.jsx +0 -8
  57. package/dist/src/components/Icons/LUIcon.jsx +0 -31
  58. package/dist/src/components/Icons/LUIcon.stories.jsx +0 -32
  59. package/dist/src/components/Icons/SingleIcon.test.jsx +0 -55
  60. package/dist/src/components/Images/LuImage.jsx +0 -19
  61. package/dist/src/components/Images/LuImage.stories.jsx +0 -154
  62. package/dist/src/components/Images/LuImage.test.jsx +0 -44
  63. package/dist/src/components/Input/Input.jsx +0 -19
  64. package/dist/src/components/Input/Input.stories.jsx +0 -18
  65. package/dist/src/components/Label/Label.jsx +0 -19
  66. package/dist/src/components/Label/Label.stories.jsx +0 -24
  67. package/dist/src/components/Label/index.d.ts +0 -4
  68. package/dist/src/components/Label/index.js +0 -5
  69. package/dist/src/components/MediaCard/Card.jsx +0 -36
  70. package/dist/src/components/MediaCard/Card.stories.jsx +0 -56
  71. package/dist/src/components/MediaCard/Card.test.jsx +0 -27
  72. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.jsx +0 -22
  73. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.jsx +0 -60
  74. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.jsx +0 -28
  75. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.jsx +0 -87
  76. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.jsx +0 -24
  77. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.jsx +0 -87
  78. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.jsx +0 -24
  79. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.jsx +0 -61
  80. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.jsx +0 -26
  81. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.jsx +0 -87
  82. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.jsx +0 -24
  83. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.jsx +0 -87
  84. package/dist/src/components/Switch/Switch.jsx +0 -6
  85. package/dist/src/components/Switch/Switch.stories.jsx +0 -32
  86. package/dist/src/components/Title/Title.jsx +0 -8
  87. package/dist/src/components/Title/Title.stories.jsx +0 -37
  88. package/dist/src/components/Title/Title.test.jsx +0 -24
  89. package/dist/src/components/Typography/Typography.jsx +0 -19
  90. package/dist/src/components/Typography/Typography.stories.jsx +0 -25
  91. package/dist/src/components/ui/button.jsx +0 -43
  92. package/dist/src/components/ui/input.jsx +0 -18
  93. package/dist/src/components/ui/label.jsx +0 -30
  94. package/dist/src/components/ui/switch.jsx +0 -61
  95. package/dist/src/components/ui/tooltip.jsx +0 -38
  96. package/dist/src/components/ui/typography.jsx +0 -56
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import LUIcon from "../Icons/LUIcon";
2
- import Image from "next/image";
3
- import { avatarPadding, avatarShape, avatarSize } from ".";
4
- var Avatar = function (_a) {
5
- var image = _a.image, _b = _a.icon, icon = _b === void 0 ? "user" : _b, _c = _a.shape, shape = _c === void 0 ? "square" : _c, _d = _a.size, size = _d === void 0 ? "md" : _d, className = _a.className;
6
- var sizeClasses = avatarSize[size];
7
- var paddingClass = avatarPadding[size];
8
- return (<>
9
- {image ? (<div className={"relative overflow-hidden bg-primary-200 ".concat(avatarShape[shape], " ").concat(className, " ").concat(sizeClasses)} data-testid="lu-avatar">
10
- <Image src={image} alt="avatar" className={"object-cover w-full h-full"} width={0} height={0} sizes="100%" //Image takes 100% of the parent container
11
- />
12
- </div>) : (<div className={"bg-neutral-100 ".concat(paddingClass, " ").concat(shape, " ").concat(className, " ").concat(sizeClasses)} data-testid="lu-icon">
13
- <LUIcon data-testid="lu-icon" size={size} icon={icon} className={"text-neutral-1000 w-full h-full"}/>
14
- </div>)}
15
- </>);
16
- };
17
- export default Avatar;
@@ -1,31 +0,0 @@
1
- import Avatar from "./Avatar";
2
- import { avatarShape, avatarSize } from ".";
3
- export default {
4
- title: "Components/Avatar",
5
- component: Avatar,
6
- };
7
- var Template = function (args) { return <Avatar {...args}/>; };
8
- export var _Avatar = Template.bind({});
9
- _Avatar.args = {
10
- image: "/images/avatar.png",
11
- shape: "square",
12
- size: "md",
13
- className: "",
14
- icon: "user",
15
- };
16
- _Avatar.argTypes = {
17
- shape: {
18
- control: {
19
- type: "select",
20
- labels: Object.keys(avatarShape),
21
- },
22
- options: Object.keys(avatarShape),
23
- },
24
- size: {
25
- control: {
26
- type: "select",
27
- labels: Object.keys(avatarSize),
28
- },
29
- options: Object.keys(avatarSize),
30
- },
31
- };
@@ -1,51 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import Avatar from "./Avatar";
3
- jest.mock("../Icons/LUIcon", function () { return ({
4
- __esModule: true,
5
- default: jest.fn(function (_a) {
6
- var icon = _a.icon, className = _a.className;
7
- return (<div data-testid="mock-luIcon" className={className}>
8
- {icon || "user"}
9
- </div>);
10
- }),
11
- }); });
12
- // Mock Next.js Image component
13
- jest.mock("next/image", function () { return ({
14
- __esModule: true,
15
- default: function (_a) {
16
- var src = _a.src, alt = _a.alt;
17
- return (
18
- // eslint-disable-next-line @next/next/no-img-element
19
- <img src={src} alt={alt}/>);
20
- },
21
- }); });
22
- describe("Avatar Component", function () {
23
- it("renders image when image prop is provided", function () {
24
- render(<Avatar image="/images/avatar.png"/>);
25
- var avatarImage = screen.getByRole("img", { name: /avatar/i });
26
- expect(avatarImage).toBeInTheDocument();
27
- expect(avatarImage).toHaveAttribute("src", "/images/avatar.png");
28
- });
29
- });
30
- it("renders icon when no image is provided", function () {
31
- render(<Avatar />);
32
- var icon = screen.getByTestId("lu-icon");
33
- expect(icon).toBeInTheDocument();
34
- });
35
- it("applies shape and size class names correctly", function () {
36
- render(<Avatar image="/images/avatar.png" shape="square" size="lg"/>);
37
- var avatarWrapper = screen.getByTestId("lu-avatar");
38
- expect(avatarWrapper).toHaveClass("rounded-none");
39
- expect(avatarWrapper).toHaveClass("w-[42px]");
40
- expect(avatarWrapper).toHaveClass("h-[42px]");
41
- });
42
- it("applies additional class names", function () {
43
- render(<Avatar image="/images/avatar.png" className="custom-class"/>);
44
- var avatarWrapper = screen.getByTestId("lu-avatar");
45
- expect(avatarWrapper).toHaveClass("custom-class");
46
- });
47
- it("renders the correct icon when image is not provided", function () {
48
- render(<Avatar icon="user"/>);
49
- var icon = screen.getByTestId("lu-icon");
50
- expect(icon).toBeInTheDocument();
51
- });
@@ -1,10 +0,0 @@
1
- import { buttonShapes, buttonSizes, buttonColors } from "./index";
2
- var Button = function (_a) {
3
- var _b = _a.color, color = _b === void 0 ? "primary" : _b, startIcon = _a.startIcon, endIcon = _a.endIcon, onClick = _a.onClick, _c = _a.shape, shape = _c === void 0 ? "rounded-none" : _c, _d = _a.size, size = _d === void 0 ? "sm" : _d, className = _a.className, children = _a.children;
4
- return (<button className={"flex items-center ".concat(buttonShapes[shape], " ").concat(buttonColors[color], " ").concat(className, " ").concat(buttonSizes[size])} onClick={onClick}>
5
- {startIcon && <span data-testid="start-icon"> {startIcon} </span>}
6
- {children}
7
- {endIcon && <span data-testid="end-icon"> {endIcon} </span>}
8
- </button>);
9
- };
10
- export default Button;
@@ -1,44 +0,0 @@
1
- import { buttonShapes, buttonSizes, buttonColors } from ".";
2
- import Button from "./Button";
3
- export default {
4
- title: "Components/Button/Button",
5
- component: Button,
6
- tags: ["autodocs"],
7
- };
8
- var Template = function (args) { return <Button {...args}></Button>; };
9
- export var _Button = Template.bind({});
10
- _Button.args = {
11
- children: "Button Text",
12
- };
13
- _Button.argTypes = {
14
- color: {
15
- control: {
16
- type: "select",
17
- labels: Object.keys(buttonColors),
18
- },
19
- options: Object.keys(buttonColors),
20
- },
21
- startIcon: {
22
- control: false,
23
- description: "Start icon (React component)",
24
- },
25
- endIcon: {
26
- control: false,
27
- description: "End icon (React component)",
28
- },
29
- shape: {
30
- control: {
31
- type: "select",
32
- labels: Object.keys(buttonShapes),
33
- },
34
- options: Object.keys(buttonShapes),
35
- },
36
- size: {
37
- control: {
38
- type: "select",
39
- labels: Object.keys(buttonSizes),
40
- },
41
- options: Object.keys(buttonSizes),
42
- description: "Select the size of the button",
43
- },
44
- };
@@ -1,65 +0,0 @@
1
- import { fireEvent, render, screen } from "@testing-library/react";
2
- import Button from "./Button";
3
- import { buttonColors, buttonShapes, buttonSizes } from ".";
4
- import { Dummy_label } from "../../utils/constants";
5
- describe("Button Component", function () {
6
- it("renders default button component", function () {
7
- render(<Button>{Dummy_label}</Button>);
8
- var buttonElement = screen.getByRole("button", { name: Dummy_label });
9
- expect(buttonElement).toBeInTheDocument();
10
- expect(buttonElement).toHaveClass(buttonColors["primary"], buttonShapes["rounded-none"], buttonSizes["sm"]);
11
- });
12
- it("renders button with a custom label", function () {
13
- render(<Button>{Dummy_label}</Button>);
14
- expect(screen.getByRole("button", { name: Dummy_label })).toBeInTheDocument();
15
- });
16
- it("calls onClick handler when clicked", function () {
17
- var handleClick = jest.fn();
18
- render(<Button onClick={handleClick}>Click</Button>);
19
- fireEvent.click(screen.getByRole("button"));
20
- expect(handleClick).toHaveBeenCalledTimes(1);
21
- });
22
- it("renders startIcon when provided", function () {
23
- render(<Button startIcon={<span>*</span>}>{Dummy_label}</Button>);
24
- expect(screen.getByTestId("start-icon")).toBeInTheDocument();
25
- });
26
- it("renders endIcon when provided", function () {
27
- render(<Button endIcon={<span>*</span>}>{Dummy_label}</Button>);
28
- expect(screen.getByTestId("end-icon")).toBeInTheDocument();
29
- });
30
- it("applies correct color, shape, and size classes", function () {
31
- render(<Button color="primary" shape="rounded-lg" size="lg">
32
- {Dummy_label}
33
- </Button>);
34
- var buttonElement = screen.getByRole("button");
35
- expect(buttonElement).toHaveClass(buttonColors["primary"], buttonShapes["rounded-lg"], buttonSizes["lg"]);
36
- });
37
- it("applies additional className when provided", function () {
38
- render(<Button className="custom-class">{Dummy_label}</Button>);
39
- expect(screen.getByRole("button")).toHaveClass("custom-class");
40
- });
41
- it("renders without crashing when no props are provided", function () {
42
- render(<Button>{Dummy_label}</Button>);
43
- expect(screen.getByRole("button")).toBeInTheDocument();
44
- });
45
- it("renders button with both startIcon and endIcon", function () {
46
- render(<Button startIcon={<span>*</span>} endIcon={<span>*</span>}>
47
- {Dummy_label}
48
- </Button>);
49
- expect(screen.getByTestId("start-icon")).toBeInTheDocument();
50
- expect(screen.getByTestId("end-icon")).toBeInTheDocument();
51
- });
52
- it("does not render startIcon when not provided", function () {
53
- render(<Button>{Dummy_label}</Button>);
54
- expect(screen.queryByTestId("start-icon")).not.toBeInTheDocument();
55
- });
56
- it("does not render endIcon when not provided", function () {
57
- render(<Button>{Dummy_label}</Button>);
58
- expect(screen.queryByTestId("end-icon")).not.toBeInTheDocument();
59
- });
60
- it("renders correctly without a className prop", function () {
61
- render(<Button>{Dummy_label}</Button>);
62
- var buttonElement = screen.getByRole("button");
63
- expect(buttonElement).not.toHaveClass("custom-class");
64
- });
65
- });
@@ -1,9 +0,0 @@
1
- import { buttonColors, buttonShapes, iconButtonSize } from ".";
2
- import LUIcon from "../Icons/LUIcon";
3
- var IconButton = function (_a) {
4
- var _b = _a.color, color = _b === void 0 ? "primary" : _b, onClick = _a.onClick, _c = _a.shape, shape = _c === void 0 ? "rounded-none" : _c, _d = _a.size, size = _d === void 0 ? "sm" : _d, className = _a.className, _e = _a.icon, icon = _e === void 0 ? <LUIcon icon="chart-simple" size="xs"/> : _e;
5
- return (<button className={"flex items-center ".concat(buttonShapes[shape], " ").concat(buttonColors[color], " ").concat(className, " ").concat(iconButtonSize[size])} onClick={onClick}>
6
- {icon && icon}
7
- </button>);
8
- };
9
- export default IconButton;
@@ -1,41 +0,0 @@
1
- import { buttonColors, buttonShapes, iconButtonSize } from ".";
2
- import LUIcon from "../Icons/LUIcon";
3
- import IconButton from "./IconButton";
4
- export default {
5
- title: "Components/Button/IconButton",
6
- component: IconButton,
7
- tags: ["autodocs"],
8
- };
9
- var Template = function (args) { return (<IconButton icon={<LUIcon icon="chart-simple" size="xs"/>} {...args}/>); };
10
- export var _IconButton = Template.bind({});
11
- _IconButton.args = {
12
- icon: <LUIcon icon="chart-simple" size="xs"/>,
13
- };
14
- _IconButton.argTypes = {
15
- color: {
16
- control: {
17
- type: "select",
18
- labels: Object.keys(buttonColors),
19
- },
20
- options: Object.keys(buttonColors),
21
- },
22
- shape: {
23
- control: {
24
- type: "select",
25
- labels: Object.keys(buttonShapes),
26
- },
27
- options: Object.keys(buttonShapes),
28
- },
29
- size: {
30
- control: {
31
- type: "select",
32
- labels: Object.keys(iconButtonSize),
33
- },
34
- options: Object.keys(iconButtonSize),
35
- description: "Select the size of the button",
36
- },
37
- icon: {
38
- control: false,
39
- description: "Icon (React component)",
40
- },
41
- };
@@ -1,29 +0,0 @@
1
- import { fireEvent, render, screen } from "@testing-library/react";
2
- import { buttonColors, buttonShapes, iconButtonSize } from ".";
3
- import LUIcon from "../Icons/LUIcon";
4
- import IconButton from "./IconButton";
5
- describe("Icon Button Component", function () {
6
- it("renders icon button with required icon prop", function () {
7
- render(<IconButton icon={<LUIcon icon="chart-simple" size="xs"/>}/>);
8
- expect(screen.getByRole("button")).toBeInTheDocument();
9
- });
10
- it("calls onClick handler when clicked", function () {
11
- var handleClick = jest.fn();
12
- render(<IconButton onClick={handleClick} icon={<LUIcon icon="chart-simple" size="xs"/>}/>);
13
- fireEvent.click(screen.getByRole("button"));
14
- expect(handleClick).toHaveBeenCalledTimes(1);
15
- });
16
- it("applies correct color, shape, and size classes", function () {
17
- render(<IconButton color="primary" shape="rounded-lg" size="lg" icon={<LUIcon icon="chart-simple" size="xs"/>}/>);
18
- var buttonElement = screen.getByRole("button");
19
- expect(buttonElement).toHaveClass(buttonColors["primary"], buttonShapes["rounded-lg"], iconButtonSize["lg"]);
20
- });
21
- it("applies additional className when provided", function () {
22
- render(<IconButton className="custom-class" icon={<LUIcon icon="chart-simple" size="xs"/>}/>);
23
- expect(screen.getByRole("button")).toHaveClass("custom-class");
24
- });
25
- it("renders without crashing when all required props are provided", function () {
26
- render(<IconButton icon={<LUIcon icon="chart-simple" size="xs"/>}/>);
27
- expect(screen.getByRole("button")).toBeInTheDocument();
28
- });
29
- });
@@ -1,34 +0,0 @@
1
- import { useState } from "react";
2
- import { Input } from "../ui/input";
3
- var ColorPicker = function (_a) {
4
- var onChange = _a.onChange, _b = _a.value, value = _b === void 0 ? "#000000" : _b;
5
- var _c = useState(value), hexColor = _c[0], setHexColor = _c[1];
6
- // Handle input changes (color picker or text field)
7
- var handleColorChange = function (newColor) {
8
- setHexColor(newColor);
9
- onChange(newColor);
10
- };
11
- // Handle hex input change
12
- var handleHexChange = function (e) {
13
- var inputValue = e.target.value;
14
- // Ensure it starts with #
15
- var formattedValue = inputValue.startsWith("#")
16
- ? inputValue
17
- : "#".concat(inputValue);
18
- handleColorChange(formattedValue);
19
- };
20
- // Handle color input change (from native color picker)
21
- var handleColorInputChange = function (e) {
22
- handleColorChange(e.target.value);
23
- };
24
- return (<>
25
- <div className="flex">
26
- <div className="relative">
27
- <div className="size-9 shrink-0 rounded-l-sm" style={{ backgroundColor: hexColor }}/>
28
- <Input type="color" value={hexColor} onChange={handleColorInputChange} className="absolute inset-0 opacity-0 cursor-pointer rounded-r-sm" aria-label="Select color"/>
29
- </div>
30
- <Input id="color-picker" type="text" value={hexColor} onChange={handleHexChange} className="rounded-r-sm border min-w-25"/>
31
- </div>
32
- </>);
33
- };
34
- export default ColorPicker;
@@ -1,12 +0,0 @@
1
- import ColorPicker from "./ColorPicker";
2
- export default {
3
- title: "Components/ColorPicker",
4
- component: ColorPicker,
5
- tags: ["autodocs"],
6
- };
7
- var Template = function (args) { return (<ColorPicker {...args}/>); };
8
- export var _ColorPicker = Template.bind({});
9
- _ColorPicker.args = {
10
- value: "#000000", // Default color
11
- onChange: function () { },
12
- };
@@ -1,5 +0,0 @@
1
- import { colors } from "../../utils/colors";
2
- export var Color = function (_a) {
3
- var _b = _a.color, color = _b === void 0 ? "black" : _b;
4
- return <div style={{ color: colors[color] || colors.black }}>{color}</div>;
5
- };
@@ -1,20 +0,0 @@
1
- import { colors } from "../../utils/colors";
2
- import { Color } from "./color";
3
- export default {
4
- title: "Components/Color",
5
- component: Color,
6
- };
7
- var Template = function (args) { return (<Color {...args}/>); };
8
- export var _Color = Template.bind({});
9
- _Color.args = {
10
- color: "black", // Default color
11
- };
12
- _Color.argTypes = {
13
- color: {
14
- control: {
15
- type: "select",
16
- labels: Object.keys(colors),
17
- },
18
- options: Object.keys(colors),
19
- },
20
- };
@@ -1,23 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import { colors } from "../../utils/colors";
3
- import { Color } from "./color";
4
- describe("TextColor Component", function () {
5
- it("renders with default color (black)", function () {
6
- render(<Color />);
7
- var textElement = screen.getByText("black");
8
- expect(textElement).toBeInTheDocument();
9
- expect(textElement).toHaveStyle({ color: colors.black });
10
- });
11
- it("renders with a specified color", function () {
12
- render(<Color color="primary-500"/>);
13
- var textElement = screen.getByText("primary-500");
14
- expect(textElement).toBeInTheDocument();
15
- expect(textElement).toHaveStyle({ color: colors["primary-500"] });
16
- });
17
- it("handles invalid color gracefully", function () {
18
- render(<Color color={"invalid-color"}/>);
19
- var textElement = screen.getByText("invalid-color");
20
- expect(textElement).toBeInTheDocument();
21
- expect(textElement).toHaveStyle({ color: colors.black }); // It should default to black
22
- });
23
- });
@@ -1,18 +0,0 @@
1
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip";
2
- import IconButton from "../Button/IconButton";
3
- import LUIcon from "../Icons/LUIcon";
4
- import { Dummy_Para } from "../../utils/constants";
5
- var EditorTooltip = function (_a) {
6
- var _b = _a.title, title = _b === void 0 ? Dummy_Para : _b;
7
- return (<TooltipProvider>
8
- <Tooltip>
9
- <TooltipTrigger>
10
- <IconButton icon={<LUIcon icon="question" size="xxs"/>} size="xs" shape="rounded-full" color="primary-light"/>
11
- </TooltipTrigger>
12
- <TooltipContent>
13
- <p>{title}</p>
14
- </TooltipContent>
15
- </Tooltip>
16
- </TooltipProvider>);
17
- };
18
- export default EditorTooltip;
@@ -1,12 +0,0 @@
1
- import EditorTooltip from "./EditorTooltip";
2
- import { Dummy_Para } from "../../utils/constants";
3
- export default {
4
- title: "Components/EditorTooltip",
5
- component: EditorTooltip,
6
- tags: ["autodocs"],
7
- };
8
- var Template = function (args) { return (<EditorTooltip {...args}/>); };
9
- export var _EditorTooltip = Template.bind({});
10
- _EditorTooltip.args = {
11
- title: Dummy_Para,
12
- };
@@ -1,3 +0,0 @@
1
- export interface EditorTooltipInterface {
2
- title: string;
3
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,57 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import { IconView } from "./IconView";
3
- import { iconList } from "../../utils/iconList";
4
- // Mocking iconList for the tests
5
- jest.mock("../../utils/iconList", function () { return ({
6
- iconList: [
7
- { label: "Home", path: "M10 10 L20 20 L30 10 Z" },
8
- { label: "Search", path: "M15 15 L25 25 L35 15 Z" },
9
- ],
10
- }); });
11
- describe("IconView Component", function () {
12
- // Test: Check if the correct number of icons are rendered
13
- it("should render the correct number of icons", function () {
14
- render(<IconView />);
15
- var iconContainers = screen.getAllByTestId("single-icon");
16
- expect(iconContainers).toHaveLength(iconList.length); // Should match the length of iconList
17
- });
18
- // Test: Ensure each icon has a path with correct `d` attribute
19
- it("should render each icon with the correct path", function () {
20
- render(<IconView />);
21
- // Ensure the correct number of icon containers are rendered
22
- var iconContainers = screen.getAllByTestId("single-icon");
23
- iconContainers.forEach(function (_, index) {
24
- // const svgElement = screen.getByTestId(`single-icon-svg-${index}`);
25
- var pathElement = screen.getByTestId("icon-path-".concat(index));
26
- // Find the corresponding icon object
27
- var icon = iconList[index];
28
- // Check that the path matches the icon's path
29
- expect(pathElement).toHaveAttribute("d", icon.path);
30
- });
31
- });
32
- // Test: Ensure each icon has the correct label
33
- it("should render each icon with the correct label", function () {
34
- render(<IconView />);
35
- iconList.forEach(function (icon, index) {
36
- var labelElement = screen.getByTestId("icon-label-".concat(index));
37
- expect(labelElement).toHaveTextContent(icon.label); // Check label text content
38
- });
39
- });
40
- // Test: Ensure the grid structure is correct
41
- it("should render icons inside a grid structure", function () {
42
- render(<IconView />);
43
- var gridContainer = screen.getByTestId("icons-list");
44
- expect(gridContainer).toBeInTheDocument();
45
- expect(gridContainer).toHaveClass("grid");
46
- });
47
- // Test: Check hover behavior for icons (optional)
48
- it("should change background color on hover", function () {
49
- render(<IconView />);
50
- var iconContainers = screen.getAllByTestId("single-icon");
51
- var icon = iconContainers[0];
52
- // Simulate hover effect by adding the class for hover
53
- icon.classList.add("hover:bg-gray-200");
54
- // Check that the hover class is applied
55
- expect(icon).toHaveClass("hover:bg-gray-200");
56
- });
57
- });
@@ -1,25 +0,0 @@
1
- import { colors } from "../../utils/colors";
2
- import { iconList } from "../../utils/iconList";
3
- export var IconView = function () {
4
- return (<>
5
- <div className="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-6 gap-6" data-testid="icons-list">
6
- {iconList.map(function (icon, index) {
7
- return (<div key={index} className="flex flex-col items-center justify-center bg-neutral-100 rounded-lg p-4 shadow-md hover:bg-neutral-200" data-testid="single-icon">
8
- <svg width="25" height="25" viewBox="0 0 32 32" fill="none" className="mb-2" role="img">
9
- <g clipPath="url(#clip0_9168_14965)">
10
- <path data-testid={"icon-path-".concat(index)} d={icon === null || icon === void 0 ? void 0 : icon.path} fill={colors["neutral-1000"]}/>
11
- </g>
12
- <defs>
13
- <clipPath id="clip0_9168_14965">
14
- <rect width="32" height="32" fill="black"/>
15
- </clipPath>
16
- </defs>
17
- </svg>
18
- <p data-testid={"icon-label-".concat(index)} className={"text-xs font-normal ".concat(colors["neutral-600"], " text-center")}>
19
- {icon === null || icon === void 0 ? void 0 : icon.label}
20
- </p>
21
- </div>);
22
- })}
23
- </div>
24
- </>);
25
- };
@@ -1,8 +0,0 @@
1
- import { IconView } from "./IconView";
2
- export default {
3
- title: "Components/Icon",
4
- component: IconView,
5
- tags: ["!autodocs"],
6
- };
7
- var Template = function (args) { return <IconView {...args}/>; };
8
- export var _IconView = Template.bind({});
@@ -1,31 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { iconList } from "../../utils/iconList";
13
- import { iconSize } from ".";
14
- var LUIcon = function (_a) {
15
- var _b;
16
- var _c = _a.size, size = _c === void 0 ? "md" : _c, icon = _a.icon, className = _a.className, props = __rest(_a, ["size", "icon", "className"]);
17
- var selectedIcon = iconList.find(function (item) { return item.key === icon; });
18
- return (<>
19
- <svg role="img" data-testid="lu-icon" className={"".concat(iconSize[size], " ").concat(className)} viewBox="0 0 32 32" fill="currentColor" {...props}>
20
- <g clipPath="url(#clip0_9168_14965)">
21
- <path data-testid="lu-path" d={(_b = selectedIcon === null || selectedIcon === void 0 ? void 0 : selectedIcon.path) !== null && _b !== void 0 ? _b : ""} className={"icon"}/>
22
- </g>
23
- <defs>
24
- <clipPath id="clip0_9168_14965">
25
- <rect width="32" height="32" fill="black"/>
26
- </clipPath>
27
- </defs>
28
- </svg>
29
- </>);
30
- };
31
- export default LUIcon;
@@ -1,32 +0,0 @@
1
- import { iconList } from "../../utils/iconList";
2
- import LUIcon from "./LUIcon";
3
- import { iconSize } from ".";
4
- export default {
5
- title: "Components/Icon",
6
- component: LUIcon,
7
- tags: ["autodocs"],
8
- };
9
- var Template = function (args) { return (<LUIcon size="xxs" className="text-primary-500" {...args}/>); };
10
- export var Icon = Template.bind({});
11
- Icon.args = {
12
- size: "xxs",
13
- icon: iconList[0].key,
14
- };
15
- Icon.argTypes = {
16
- size: {
17
- control: {
18
- type: "select",
19
- labels: Object.keys(iconSize),
20
- },
21
- options: Object.keys(iconSize),
22
- defaultValue: "xxs",
23
- },
24
- icon: {
25
- control: {
26
- type: "select",
27
- labels: Object.fromEntries(iconList.map(function (icon) { return [icon.key, icon.label]; })),
28
- },
29
- options: iconList.map(function (icon) { return icon.key; }),
30
- defaultValue: iconList[0].key,
31
- },
32
- };