linkedunion-design-kit 1.7.3 → 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 (126) hide show
  1. package/dist/src/components/Button/Button.js +4 -4
  2. package/dist/src/components/Card/MultipleNews/MultiNews.stories.d.ts +7 -7
  3. package/dist/src/components/Card/MultipleNews/MultiNews.stories.js +6 -6
  4. package/dist/src/components/Card/PhotoGallery.css +11 -0
  5. package/dist/src/components/Card/{SinglePost.d.ts → SinglePost/SinglePost.d.ts} +1 -1
  6. package/dist/src/components/Card/SinglePost/SinglePost.js +10 -0
  7. package/dist/src/components/Card/{SinglePost.stories.js → SinglePost/SinglePost.stories.js} +1 -1
  8. package/dist/src/components/Card/card.js +1 -1
  9. package/dist/src/components/ImageUploader/imageUploader.js +1 -1
  10. package/dist/src/components/Label/Label.js +5 -5
  11. package/dist/src/components/Typography/Heading/heading.js +6 -6
  12. package/dist/src/components/ui/accordion.js +1 -1
  13. package/dist/src/components/ui/caption.js +1 -1
  14. package/dist/src/components/ui/switch.js +4 -4
  15. package/dist/src/components/ui/tabs.js +2 -2
  16. package/dist/src/utils/iconList.js +1 -1
  17. package/dist/styles/global.css +46 -30
  18. package/package.json +1 -1
  19. package/dist/app/layout.jsx +0 -13
  20. package/dist/app/page.jsx +0 -5
  21. package/dist/src/components/Accordion/Accordion.stories.jsx +0 -25
  22. package/dist/src/components/Avatar/Avatar.jsx +0 -17
  23. package/dist/src/components/Avatar/Avatar.stories.jsx +0 -31
  24. package/dist/src/components/Avatar/Avatar.test.jsx +0 -51
  25. package/dist/src/components/Button/Button.jsx +0 -93
  26. package/dist/src/components/Button/Button.stories.jsx +0 -248
  27. package/dist/src/components/Button/Button.test.jsx +0 -73
  28. package/dist/src/components/Button/IconButton.jsx +0 -70
  29. package/dist/src/components/Button/IconButton.stories.jsx +0 -53
  30. package/dist/src/components/Button/IconButton.test.jsx +0 -27
  31. package/dist/src/components/Card/ContactProfile.d.ts +0 -2
  32. package/dist/src/components/Card/ContactProfile.js +0 -35
  33. package/dist/src/components/Card/ContactProfile.jsx +0 -57
  34. package/dist/src/components/Card/ContactProfile.stories.d.ts +0 -9
  35. package/dist/src/components/Card/ContactProfile.stories.js +0 -52
  36. package/dist/src/components/Card/ContactProfile.stories.jsx +0 -52
  37. package/dist/src/components/Card/MultiNews.d.ts +0 -2
  38. package/dist/src/components/Card/MultiNews.js +0 -43
  39. package/dist/src/components/Card/MultiNews.jsx +0 -59
  40. package/dist/src/components/Card/MultiNews.stories.d.ts +0 -9
  41. package/dist/src/components/Card/MultiNews.stories.js +0 -52
  42. package/dist/src/components/Card/MultiNews.stories.jsx +0 -52
  43. package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +0 -60
  44. package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +0 -54
  45. package/dist/src/components/Card/PostByCategory.d.ts +0 -2
  46. package/dist/src/components/Card/PostByCategory.js +0 -38
  47. package/dist/src/components/Card/PostByCategory.stories.d.ts +0 -9
  48. package/dist/src/components/Card/PostByCategory.stories.js +0 -54
  49. package/dist/src/components/Card/SinglePost.js +0 -10
  50. package/dist/src/components/Card/SinglePost.jsx +0 -27
  51. package/dist/src/components/Card/SinglePost.stories.jsx +0 -46
  52. package/dist/src/components/Card/card.jsx +0 -31
  53. package/dist/src/components/Checkbox/checkbox.stories.jsx +0 -91
  54. package/dist/src/components/ColorPicker/ColorPicker.jsx +0 -65
  55. package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +0 -14
  56. package/dist/src/components/Colors/color.jsx +0 -5
  57. package/dist/src/components/Colors/color.stories.jsx +0 -20
  58. package/dist/src/components/Colors/color.test.jsx +0 -23
  59. package/dist/src/components/EditorTooltip/EditorTooltip.d.ts +0 -5
  60. package/dist/src/components/EditorTooltip/EditorTooltip.js +0 -8
  61. package/dist/src/components/EditorTooltip/EditorTooltip.stories.d.ts +0 -6
  62. package/dist/src/components/EditorTooltip/EditorTooltip.stories.js +0 -24
  63. package/dist/src/components/Icons/IconList.test.jsx +0 -57
  64. package/dist/src/components/Icons/IconView.jsx +0 -25
  65. package/dist/src/components/Icons/IconView.stories.jsx +0 -8
  66. package/dist/src/components/Icons/LUIcon.jsx +0 -37
  67. package/dist/src/components/Icons/LUIcon.stories.jsx +0 -63
  68. package/dist/src/components/Icons/SingleIcon.test.jsx +0 -56
  69. package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +0 -18
  70. package/dist/src/components/ImageUploader/imageUploader.jsx +0 -81
  71. package/dist/src/components/Images/LuImage.jsx +0 -19
  72. package/dist/src/components/Images/LuImage.stories.jsx +0 -154
  73. package/dist/src/components/Images/LuImage.test.jsx +0 -44
  74. package/dist/src/components/Input/Input.stories.jsx +0 -34
  75. package/dist/src/components/Label/Label.jsx +0 -32
  76. package/dist/src/components/Label/Label.stories.jsx +0 -30
  77. package/dist/src/components/Label/type.d.ts +0 -9
  78. package/dist/src/components/Label/type.js +0 -1
  79. package/dist/src/components/MediaCard/Card.jsx +0 -36
  80. package/dist/src/components/MediaCard/Card.stories.jsx +0 -56
  81. package/dist/src/components/MediaCard/Card.test.jsx +0 -27
  82. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.jsx +0 -22
  83. package/dist/src/components/MediaCard/ContactProfile/ContactProfile.test.jsx +0 -60
  84. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.jsx +0 -27
  85. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.test.jsx +0 -87
  86. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.jsx +0 -23
  87. package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.test.jsx +0 -87
  88. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.jsx +0 -24
  89. package/dist/src/components/MediaCard/PostByCategory/PostByCategory.test.jsx +0 -61
  90. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.jsx +0 -25
  91. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.jsx +0 -87
  92. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.jsx +0 -23
  93. package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.jsx +0 -87
  94. package/dist/src/components/MediaCard/VerticalCard/VerticalCard.jsx +0 -30
  95. package/dist/src/components/MediaCard/VerticalCard/VerticalCard.stories.jsx +0 -65
  96. package/dist/src/components/RadioButton/RadioButton.stories.jsx +0 -40
  97. package/dist/src/components/RadioButton/radio-button.jsx +0 -30
  98. package/dist/src/components/Switch/Switch.stories.jsx +0 -66
  99. package/dist/src/components/Tabs/Tabs.stories.jsx +0 -29
  100. package/dist/src/components/Title/Title.jsx +0 -8
  101. package/dist/src/components/Title/Title.stories.jsx +0 -37
  102. package/dist/src/components/Title/Title.test.jsx +0 -24
  103. package/dist/src/components/ToolTip/Tooltip.jsx +0 -18
  104. package/dist/src/components/ToolTip/Tooltip.stories.jsx +0 -25
  105. package/dist/src/components/Typography/Body/Body.stories.jsx +0 -34
  106. package/dist/src/components/Typography/Body/body.jsx +0 -52
  107. package/dist/src/components/Typography/Caption/Caption.stories.jsx +0 -24
  108. package/dist/src/components/Typography/Display/Display.stories.jsx +0 -24
  109. package/dist/src/components/Typography/Display/display.jsx +0 -39
  110. package/dist/src/components/Typography/Heading/Heading.stories.jsx +0 -24
  111. package/dist/src/components/Typography/Heading/heading.jsx +0 -60
  112. package/dist/src/components/ui/accordion.jsx +0 -39
  113. package/dist/src/components/ui/body.d.ts +0 -0
  114. package/dist/src/components/ui/body.js +0 -1
  115. package/dist/src/components/ui/caption.jsx +0 -25
  116. package/dist/src/components/ui/checkbox.jsx +0 -24
  117. package/dist/src/components/ui/input.jsx +0 -18
  118. package/dist/src/components/ui/label.d.ts +0 -12
  119. package/dist/src/components/ui/label.js +0 -41
  120. package/dist/src/components/ui/radio-button.d.ts +0 -3
  121. package/dist/src/components/ui/radio-button.js +0 -42
  122. package/dist/src/components/ui/switch.jsx +0 -61
  123. package/dist/src/components/ui/tabs.jsx +0 -32
  124. package/dist/src/components/ui/tooltip.jsx +0 -38
  125. package/dist/src/components/ui/typography.jsx +0 -56
  126. /package/dist/src/components/Card/{SinglePost.stories.d.ts → SinglePost/SinglePost.stories.d.ts} +0 -0
@@ -1,46 +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 { SinglePost } from "./SinglePost";
13
- import { Dummy_Image, Dummy_Para, Dummy_Subtitle, Dummy_Title, Dummy_Url, } from "../../utils/constants";
14
- var meta = {
15
- title: "Components/NewCard/SinglePost",
16
- component: SinglePost,
17
- parameters: {
18
- layout: "centered",
19
- },
20
- };
21
- export default meta;
22
- var baseCardArgs = {
23
- type: "singlePost",
24
- item: {
25
- image: Dummy_Image,
26
- title: Dummy_Title,
27
- description: Dummy_Para,
28
- subtitle: Dummy_Subtitle,
29
- },
30
- image: Dummy_Image,
31
- href: Dummy_Url,
32
- btnLabel: "View More",
33
- editor: {
34
- card: "",
35
- cardImage: "",
36
- cardTitle: "",
37
- cardText: "",
38
- cardBtn: "",
39
- },
40
- };
41
- export var SinglePostHorizontalLeft = {
42
- args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "left" }),
43
- };
44
- export var SinglePostHorizontalRight = {
45
- args: __assign(__assign({}, baseCardArgs), { orientation: "horizontal", mediaPosition: "right" }),
46
- };
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import { PostByCategory } from "./PostByCategory/PostByCategory";
3
- import { ContactProfile } from "./ContactProfile";
4
- import { MultiNews } from "./MultiNews";
5
- import { SinglePost } from "./SinglePost";
6
- import { Dummy_Url } from "../../utils/constants";
7
- var Card = function (_a) {
8
- var item = _a.item, image = _a.image, _b = _a.href, href = _b === void 0 ? Dummy_Url : _b, _c = _a.btnLabel, btnLabel = _c === void 0 ? "View More" : _c, editor = _a.editor, _d = _a.mediaPosition, mediaPosition = _d === void 0 ? "left" : _d, _e = _a.type, type = _e === void 0 ? "postByCategory" : _e, _f = _a.orientation, orientation = _f === void 0 ? "horizontal" : _f;
9
- var cardProps = {
10
- item: item,
11
- href: href,
12
- image: image,
13
- btnLabel: btnLabel,
14
- editor: editor,
15
- mediaPosition: mediaPosition,
16
- orientation: orientation,
17
- };
18
- // Using object approach for better performance and cleaner code
19
- var cardComponents = {
20
- postByCategory: PostByCategory,
21
- contactProfile: ContactProfile,
22
- multipleNews: MultiNews,
23
- singlePost: SinglePost,
24
- };
25
- return (<>
26
- {type && cardComponents[type]
27
- ? React.createElement(cardComponents[type], cardProps)
28
- : null}
29
- </>);
30
- };
31
- export default Card;
@@ -1,91 +0,0 @@
1
- import { Checkbox } from "../ui/checkbox";
2
- import { Label } from "../Label/Label";
3
- import { Button } from "../Button/Button";
4
- var meta = {
5
- title: "components/Checkbox",
6
- component: Checkbox,
7
- parameters: {
8
- layout: "centered",
9
- },
10
- tags: ["autodocs"],
11
- argTypes: {
12
- checked: { control: "boolean" },
13
- defaultChecked: { control: "boolean" },
14
- disabled: { control: "boolean" },
15
- onCheckedChange: { action: "checked changed" },
16
- },
17
- };
18
- export default meta;
19
- export var Default = {
20
- args: {
21
- id: "default",
22
- },
23
- render: function (args) { return (<div className="flex items-center space-x-2">
24
- <Checkbox {...args}/>
25
- <Label htmlFor="default" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
26
- Accept terms and conditions
27
- </Label>
28
- </div>); },
29
- };
30
- export var Checked = {
31
- args: {
32
- id: "checked",
33
- defaultChecked: true,
34
- },
35
- render: function (args) { return (<div className="flex items-center space-x-2">
36
- <Checkbox {...args}/>
37
- <Label htmlFor="checked" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
38
- Checked option
39
- </Label>
40
- </div>); },
41
- };
42
- export var Disabled = {
43
- args: {
44
- id: "disabled",
45
- disabled: true,
46
- },
47
- render: function (args) { return (<div className="flex items-center space-x-2">
48
- <Checkbox {...args}/>
49
- <Label htmlFor="disabled" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
50
- Disabled option
51
- </Label>
52
- </div>); },
53
- };
54
- export var DisabledChecked = {
55
- args: {
56
- id: "disabled-checked",
57
- disabled: true,
58
- defaultChecked: true,
59
- },
60
- render: function (args) { return (<div className="flex items-center space-x-2">
61
- <Checkbox {...args}/>
62
- <Label htmlFor="disabled-checked" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
63
- Disabled checked option
64
- </Label>
65
- </div>); },
66
- };
67
- export var Form = {
68
- render: function () { return (<div className="space-y-4">
69
- <h3 className="text-lg font-medium">Terms of Service</h3>
70
- <p className="text-sm text-muted-foreground">
71
- Please read and accept our terms of service to continue.
72
- </p>
73
- <form className="space-y-2">
74
- <div className="flex items-center space-x-2">
75
- <Checkbox id="terms1"/>
76
- <label htmlFor="terms1" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
77
- I accept the terms and conditions
78
- </label>
79
- </div>
80
- <div className="flex items-center space-x-2">
81
- <Checkbox id="terms2"/>
82
- <Label htmlFor="terms2" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
83
- I agree to receive marketing emails
84
- </Label>
85
- </div>
86
- <Button type="submit" className="mt-4 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700">
87
- Submit
88
- </Button>
89
- </form>
90
- </div>); },
91
- };
@@ -1,65 +0,0 @@
1
- "use client";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- import { useState, useEffect } from "react";
14
- import { Input } from "../ui/input";
15
- var useDebounce = function (value, delay) {
16
- var _a = useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
17
- useEffect(function () {
18
- var handler = setTimeout(function () {
19
- setDebouncedValue(value);
20
- }, delay);
21
- return function () {
22
- clearTimeout(handler);
23
- };
24
- }, [value, delay]);
25
- return debouncedValue;
26
- };
27
- var ColorPicker = function (_a) {
28
- var onChange = _a.onChange, _b = _a.value, value = _b === void 0 ? "#000000" : _b, props = __rest(_a, ["onChange", "value"]);
29
- var _c = useState(value), hexColor = _c[0], setHexColor = _c[1];
30
- var debouncedHexColor = useDebounce(hexColor, 200); // Use prop or default
31
- // Handle input changes (color picker or text field)
32
- var handleColorChange = function (newColor) {
33
- var formattedColor = newColor.startsWith("#") ? newColor : "#".concat(newColor);
34
- setHexColor(formattedColor); // Set the local state immediately
35
- };
36
- useEffect(function () {
37
- if (value !== hexColor) {
38
- setHexColor(value);
39
- }
40
- }, [value]);
41
- // Trigger onChange callback only when debounced value updates
42
- useEffect(function () {
43
- onChange(debouncedHexColor); // Trigger onChange with debounced value
44
- }, [debouncedHexColor]);
45
- // Handle hex input change
46
- var handleHexChange = function (e) {
47
- var inputValue = e.target.value;
48
- // Ensure it starts with #
49
- if (inputValue.length > 7) {
50
- inputValue = inputValue.slice(0, 7); // Limit the input to 7 characters
51
- }
52
- handleColorChange(inputValue);
53
- };
54
- // Handle color input change (from native color picker)
55
- var handleColorInputChange = function (e) {
56
- handleColorChange(e.target.value);
57
- };
58
- return (<div className="relative">
59
- <div className="size-9 left-1 top-1/2 -translate-y-1/2 absolute border rounded" style={{ backgroundColor: hexColor }}>
60
- <Input type="color" value={hexColor} onChange={handleColorInputChange} className="h-full w-full opacity-0 cursor-pointer" aria-label="Select color"/>
61
- </div>
62
- <Input type="text" value={hexColor} onChange={handleHexChange} maxLength={7} aria-label="Hex color input" {...props} className={"rounded border min-w-25 !ps-12 ".concat(props.className)}/>
63
- </div>);
64
- };
65
- export default ColorPicker;
@@ -1,14 +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 (e) {
12
- console.log("color -->", e);
13
- },
14
- };
@@ -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="blue-500"/>);
13
- var textElement = screen.getByText("blue-500");
14
- expect(textElement).toBeInTheDocument();
15
- expect(textElement).toHaveStyle({ color: colors["blue-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,5 +0,0 @@
1
- declare const EditorTooltip: ({ title, className, }: {
2
- title: string;
3
- className?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export default EditorTooltip;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip";
3
- import { IconButton } from "../Button/IconButton";
4
- var EditorTooltip = function (_a) {
5
- var title = _a.title, className = _a.className;
6
- return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: className, children: _jsx(IconButton, { icon: "question", size: "sm", shape: "rounded-full", color: "blue-light" }) }), _jsx(TooltipContent, { children: _jsx("div", { className: "text-base w-48 text-center font-medium", children: title }) })] }) }));
7
- };
8
- export default EditorTooltip;
@@ -1,6 +0,0 @@
1
- import { Meta } from "@storybook/react";
2
- declare const _default: Meta;
3
- export default _default;
4
- export declare const _EditorTooltip: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {
5
- title: string;
6
- }>;
@@ -1,24 +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 { jsx as _jsx } from "react/jsx-runtime";
13
- import EditorTooltip from "./EditorTooltip";
14
- import { Dummy_Para } from "../../utils/constants";
15
- export default {
16
- title: "Components/EditorTooltip",
17
- component: EditorTooltip,
18
- tags: ["autodocs"],
19
- };
20
- var Template = function (args) { return (_jsx(EditorTooltip, __assign({}, args))); };
21
- export var _EditorTooltip = Template.bind({});
22
- _EditorTooltip.args = {
23
- title: Dummy_Para,
24
- };
@@ -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-gray-100 rounded-lg p-4 shadow-md hover:bg-gray-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["gray-950"]}/>
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["gray-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,37 +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 { getAppliedColor, iconBackground, IconShape, iconSize } from ".";
14
- var LUIcon = function (_a) {
15
- var _b;
16
- var _c = _a.size, size = _c === void 0 ? "md" : _c, icon = _a.icon, _d = _a.variant, variant = _d === void 0 ? "default" : _d, _e = _a.shape, shape = _e === void 0 ? "square" : _e, className = _a.className, color = _a.color, props = __rest(_a, ["size", "icon", "variant", "shape", "className", "color"]);
17
- var selectedIcon = iconList.find(function (item) { return item.key === icon; });
18
- var paddingIcon = iconBackground[size];
19
- var colorClass = variant === "default" ? getAppliedColor(variant, color) : "";
20
- var svg = (<svg role="img" data-testid="lu-icon" className={"".concat(iconSize[size], " ").concat(variant !== "padded" ? className : "", " ").concat(colorClass)} viewBox="0 0 32 32" fill="currentColor" {...props}>
21
- <g clipPath="url(#clip0_9168_14965)">
22
- <path data-testid="lu-path" d={(_b = selectedIcon === null || selectedIcon === void 0 ? void 0 : selectedIcon.path) !== null && _b !== void 0 ? _b : ""}/>
23
- </g>
24
- <defs>
25
- <clipPath id="clip0_9168_14965">
26
- <rect width="32" height="32"/>
27
- </clipPath>
28
- </defs>
29
- </svg>);
30
- if (variant === "padded") {
31
- return (<div className={"inline-flex items-center justify-center ".concat(paddingIcon, " ").concat(shape === "rounded" ? IconShape.rounded : IconShape.square[size], " ").concat(className, " ").concat(getAppliedColor(variant, color))}>
32
- {svg}
33
- </div>);
34
- }
35
- return svg;
36
- };
37
- export default LUIcon;
@@ -1,63 +0,0 @@
1
- import { iconList } from "../../utils/iconList";
2
- import LUIcon from "./LUIcon";
3
- import { iconColor, IconShape, iconSize, iconWithBgColor } from ".";
4
- export default {
5
- title: "Components/Icon",
6
- component: LUIcon,
7
- tags: ["autodocs"],
8
- argTypes: {
9
- size: {
10
- control: { type: "select" },
11
- options: Object.keys(iconSize),
12
- description: "Size of the icon",
13
- },
14
- icon: {
15
- control: { type: "select" },
16
- options: iconList.map(function (icon) { return icon.key; }),
17
- description: "Icon to display",
18
- },
19
- variant: {
20
- control: { type: "select" },
21
- options: ["default", "padded"],
22
- description: "Type of the icon",
23
- },
24
- shape: {
25
- control: { type: "select" },
26
- options: Object.keys(IconShape),
27
- description: "Shape of the padded icon",
28
- if: { arg: "variant", eq: "padded" },
29
- },
30
- },
31
- };
32
- var Template = function (args) { return <LUIcon {...args}/>; };
33
- // Default Icon Story
34
- export var _DefaultIcon = Template.bind({});
35
- _DefaultIcon.args = {
36
- size: "md",
37
- icon: iconList[0].key,
38
- color: "blue",
39
- variant: "default",
40
- };
41
- _DefaultIcon.argTypes = {
42
- color: {
43
- control: { type: "select" },
44
- options: Object.keys(iconColor),
45
- description: "Text color (no background)",
46
- },
47
- };
48
- // Padded Icon Story
49
- export var _PaddedIcon = Template.bind({});
50
- _PaddedIcon.args = {
51
- size: "md",
52
- icon: iconList[0].key,
53
- variant: "padded",
54
- color: "blue",
55
- shape: "square",
56
- };
57
- _PaddedIcon.argTypes = {
58
- color: {
59
- control: { type: "select" },
60
- options: Object.keys(iconWithBgColor),
61
- description: "Background color for padded variant",
62
- },
63
- };
@@ -1,56 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import LUIcon from "./LUIcon";
3
- import { iconList } from "../../utils/iconList";
4
- import { iconSize } from ".";
5
- describe("LUIcon Component", function () {
6
- it("renders correctly when a valid icon is provided", function () {
7
- var props = {
8
- size: "xs",
9
- icon: iconList[0].key,
10
- };
11
- render(<LUIcon {...props}/>);
12
- // Select the element
13
- var singleIconElement = screen.getByTestId("lu-icon");
14
- var computedClassName = iconSize[props.size];
15
- expect(singleIconElement).toHaveClass(computedClassName);
16
- // Assert that the fill class is applied correctly on the <path>
17
- var pathElement = screen.getByTestId("lu-path");
18
- expect(pathElement).toBeInTheDocument();
19
- var selectedIcon = iconList.find(function (icon) { return icon.key === props.icon; });
20
- expect(pathElement).toHaveAttribute("d", (selectedIcon === null || selectedIcon === void 0 ? void 0 : selectedIcon.path) || "");
21
- });
22
- it("renders correctly when an invalid icon is provided", function () {
23
- var props = {
24
- size: "md",
25
- icon: "non-existent-icon", // Invalid icon
26
- };
27
- render(<LUIcon {...props}/>);
28
- var svgElement = screen.getByTestId("lu-icon");
29
- expect(svgElement).toBeInTheDocument();
30
- var pathElement = screen.getByTestId("lu-path");
31
- expect(pathElement).toBeInTheDocument();
32
- // Since the icon does not exist, path should be an empty string
33
- expect(pathElement).toHaveAttribute("d", "");
34
- });
35
- it("applies additional className correctly", function () {
36
- var props = {
37
- size: "lg",
38
- icon: iconList[0].key,
39
- className: "custom-class",
40
- };
41
- render(<LUIcon {...props}/>);
42
- var singleIconElement = screen.getByTestId("lu-icon");
43
- expect(singleIconElement).toHaveClass(iconSize[props.size] || "");
44
- expect(singleIconElement).toHaveClass("custom-class");
45
- });
46
- it("renders correctly when selectedIcon is undefined", function () {
47
- var props = {
48
- size: "md",
49
- icon: "", // Pass an empty string to ensure find() returns undefined
50
- };
51
- render(<LUIcon {...props}/>);
52
- var pathElement = screen.getByTestId("lu-path");
53
- expect(pathElement).toBeInTheDocument();
54
- expect(pathElement).toHaveAttribute("d", ""); // Expect empty path when selectedIcon is undefined
55
- });
56
- });
@@ -1,18 +0,0 @@
1
- import ImageUploader from "./imageUploader";
2
- var meta = {
3
- title: "Components/ImageUploader",
4
- component: ImageUploader,
5
- tags: ["autodocs"],
6
- argTypes: {
7
- onChange: { action: "changed" }, // For logging in the Storybook actions panel
8
- },
9
- };
10
- export default meta;
11
- export var Default = {
12
- args: {
13
- value: null,
14
- onChange: function (previewUrl, file) {
15
- console.log("Selected file:", file);
16
- },
17
- },
18
- };