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,93 +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 * as React from "react";
13
- import { Slot } from "@radix-ui/react-slot";
14
- import { cva } from "class-variance-authority";
15
- import { cn } from "../../lib/utils";
16
- import LUIcon from "../Icons/LUIcon";
17
- export var color = {
18
- blue: "bg-blue-600 text-white hover:bg-blue-700 focus-visible:ring-blue-300 active:bg-blue-800 disabled:bg-gray-100 disabled:text-gray-400",
19
- red: "bg-red-600 text-white hover:bg-red-700 focus-visible:ring-red-300 active:bg-red-800 disabled:bg-gray-100 disabled:text-gray-400",
20
- green: "bg-green-600 text-white hover:bg-green-700 focus-visible:ring-green-300 active:bg-green-800 disabled:bg-gray-100 disabled:text-gray-400",
21
- yellow: "bg-yellow-500 text-white hover:bg-yellow-600 focus-visible:ring-yellow-200 active:bg-yellow-700 disabled:bg-gray-100 disabled:text-gray-400",
22
- indigo: "bg-indigo-600 text-white hover:bg-indigo-700 focus-visible:ring-indigo-300 active:bg-indigo-800 disabled:bg-gray-100 disabled:text-gray-400",
23
- gray: "bg-gray-600 text-white hover:bg-gray-700 focus-visible:ring-gray-300 active:bg-gray-800 disabled:bg-gray-100 disabled:text-gray-400",
24
- };
25
- export var size = {
26
- xl: "!py-3.5 !px-6 text-base font-normal leading-normal",
27
- lg: "!py-3 !px-5 text-base font-normal leading-normal",
28
- md: "!py-2.5 !px-5 text-sm font-normal leading-5",
29
- sm: "!py-2 !px-3 text-sm font-normal leading-5",
30
- };
31
- export var shape = {
32
- "rounded-sm": "!rounded-sm",
33
- "rounded-full": "!rounded-full",
34
- };
35
- export var variant = {
36
- default: "",
37
- link: "bg-transparent hover:bg-transparent focus:bg-transparent active:bg-transparent !p-0 underline-offset-4 hover:underline",
38
- };
39
- // Link variant text colors based on the color prop
40
- export var linkColor = {
41
- blue: "text-blue-600 hover:text-blue-700",
42
- red: "text-red-600 hover:text-red-700",
43
- green: "text-green-600 hover:text-green-700",
44
- yellow: "text-yellow-500 hover:text-yellow-600",
45
- indigo: "text-indigo-600 hover:text-indigo-700",
46
- gray: "text-gray-600 hover:text-gray-700",
47
- };
48
- var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
49
- variants: {
50
- color: color,
51
- size: size,
52
- shape: shape,
53
- variant: variant,
54
- },
55
- defaultVariants: {
56
- color: "blue",
57
- size: "md",
58
- shape: "rounded-sm",
59
- variant: "default",
60
- },
61
- });
62
- function Button(_a) {
63
- var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, size = _a.size, shape = _a.shape, _c = _a.variant, variant = _c === void 0 ? "default" : _c, _d = _a.asChild, asChild = _d === void 0 ? false : _d, startIcon = _a.startIcon, endIcon = _a.endIcon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "startIcon", "endIcon"]);
64
- var Comp = asChild ? Slot : "button";
65
- // Map button size to appropriate icon sizes for start and end icons
66
- var getIconSizes = function () {
67
- if (size === "xl" || size === "lg" || size === "md") {
68
- return {
69
- startIcon: "md", // 16px (size-6) - matches iconSize.xl
70
- endIcon: "xs", // 12px (size-3.5)
71
- };
72
- }
73
- return {
74
- startIcon: "sm", // 14px (size-4)
75
- endIcon: "xs", // 12px (size-3.5)
76
- };
77
- };
78
- // Get icon sizes based on button size
79
- var iconSizes = getIconSizes();
80
- // Use the calculated sizes based on button size
81
- var startIconSizeValue = iconSizes.startIcon;
82
- var endIconSizeValue = iconSizes.endIcon;
83
- // Apply appropriate text color for link variant
84
- var extraClasses = variant === "link" && color
85
- ? linkColor[color]
86
- : "";
87
- return (<Comp data-slot="button" className={cn(buttonVariants({ variant: variant, color: color, size: size, shape: shape, className: className }), extraClasses)} {...props}>
88
- {startIcon && (<LUIcon size={startIconSizeValue} data-testid="start-icon" icon={startIcon}/>)}
89
- {props.children}
90
- {endIcon && (<LUIcon size={endIconSizeValue} data-testid="end-icon" icon={endIcon}/>)}
91
- </Comp>);
92
- }
93
- export { Button, buttonVariants };
@@ -1,248 +0,0 @@
1
- import { Button, size, color, shape, variant } from "./Button";
2
- var meta = {
3
- title: "Components/Button",
4
- component: Button,
5
- tags: ["autodocs"],
6
- parameters: {
7
- docs: {
8
- description: {
9
- component: "Button component with default variants: color: blue, size: md, shape: rounded-sm, variant: default",
10
- },
11
- },
12
- controls: {
13
- expanded: true,
14
- sort: "requiredFirst",
15
- hideNoControlsWarning: true,
16
- exclude: [],
17
- },
18
- },
19
- args: {
20
- // Default values for all stories
21
- color: "blue",
22
- size: "md",
23
- shape: "rounded-sm",
24
- variant: "default",
25
- },
26
- argTypes: {
27
- color: {
28
- control: {
29
- type: "select",
30
- },
31
- options: Object.keys(color),
32
- description: "The color and visual style of the button",
33
- defaultValue: "blue",
34
- table: {
35
- defaultValue: { summary: "blue" },
36
- },
37
- },
38
- size: {
39
- control: {
40
- type: "select",
41
- },
42
- options: Object.keys(size),
43
- description: "The size of the button",
44
- defaultValue: "md",
45
- table: {
46
- defaultValue: { summary: "md" },
47
- },
48
- },
49
- shape: {
50
- control: {
51
- type: "select",
52
- },
53
- options: Object.keys(shape),
54
- description: "The shape of the button",
55
- defaultValue: "rounded-sm",
56
- table: {
57
- defaultValue: { summary: "rounded-sm" },
58
- },
59
- },
60
- variant: {
61
- control: {
62
- type: "select",
63
- },
64
- options: Object.keys(variant),
65
- description: "The variant of the button (default or link)",
66
- defaultValue: "default",
67
- table: {
68
- defaultValue: { summary: "default" },
69
- },
70
- },
71
- startIcon: {
72
- control: "text",
73
- description: "Icon to display at the start of the button",
74
- },
75
- endIcon: {
76
- control: "text",
77
- description: "Icon to display at the end of the button",
78
- },
79
- disabled: {
80
- control: "boolean",
81
- description: "Whether the button is disabled",
82
- },
83
- asChild: {
84
- control: "boolean",
85
- description: "Whether to render as a child component",
86
- },
87
- onClick: {
88
- action: "clicked",
89
- description: "Function called when button is clicked",
90
- },
91
- },
92
- };
93
- export default meta;
94
- // Display Default button with explicit default values
95
- export var Default = {
96
- args: {
97
- children: "Button Text",
98
- color: "blue",
99
- size: "md",
100
- shape: "rounded-sm",
101
- variant: "default",
102
- onClick: function () {
103
- alert("Button clicked!");
104
- },
105
- },
106
- };
107
- export var Blue = {
108
- args: {
109
- children: "Blue Button",
110
- color: "blue",
111
- size: "md",
112
- },
113
- };
114
- export var Red = {
115
- args: {
116
- children: "Red Button",
117
- color: "red",
118
- size: "md",
119
- },
120
- };
121
- export var Green = {
122
- args: {
123
- children: "Green Button",
124
- color: "green",
125
- size: "md",
126
- },
127
- };
128
- export var Yellow = {
129
- args: {
130
- children: "Yellow Button",
131
- color: "yellow",
132
- size: "md",
133
- },
134
- };
135
- export var Indigo = {
136
- args: {
137
- children: "Indigo Button",
138
- color: "indigo",
139
- size: "md",
140
- },
141
- };
142
- export var Gray = {
143
- args: {
144
- children: "Gray Button",
145
- color: "gray",
146
- size: "md",
147
- },
148
- };
149
- export var WithStartIcon = {
150
- args: {
151
- children: "Button with Start Icon",
152
- startIcon: "arrow-right",
153
- size: "md",
154
- },
155
- };
156
- export var WithEndIcon = {
157
- args: {
158
- children: "Button with End Icon",
159
- endIcon: "arrow-right",
160
- size: "md",
161
- },
162
- };
163
- export var WithBothIcons = {
164
- args: {
165
- children: "Button with Icons",
166
- startIcon: "plus",
167
- endIcon: "arrow-right",
168
- size: "md",
169
- },
170
- };
171
- export var Small = {
172
- args: {
173
- children: "Small Button",
174
- size: "sm",
175
- },
176
- };
177
- export var Medium = {
178
- args: {
179
- children: "Medium Button",
180
- size: "md",
181
- },
182
- };
183
- export var Large = {
184
- args: {
185
- children: "Large Button",
186
- size: "lg",
187
- },
188
- };
189
- export var ExtraLarge = {
190
- args: {
191
- children: "Extra Large Button",
192
- size: "xl",
193
- },
194
- };
195
- export var DefaultVariant = {
196
- args: {
197
- children: "Default Variant Button",
198
- variant: "default",
199
- },
200
- };
201
- export var LinkVariant = {
202
- args: {
203
- children: "Link Style Button",
204
- variant: "link",
205
- color: "blue",
206
- },
207
- };
208
- export var LinkVariantRed = {
209
- args: {
210
- children: "Red Link Button",
211
- variant: "link",
212
- color: "red",
213
- },
214
- };
215
- export var LinkVariantGreen = {
216
- args: {
217
- children: "Green Link Button",
218
- variant: "link",
219
- color: "green",
220
- },
221
- };
222
- export var RoundedSmall = {
223
- args: {
224
- children: "Rounded Small",
225
- shape: "rounded-sm",
226
- },
227
- };
228
- export var RoundedFull = {
229
- args: {
230
- children: "Rounded Full",
231
- shape: "rounded-full",
232
- },
233
- };
234
- export var Disabled = {
235
- args: {
236
- children: "Disabled Button",
237
- disabled: true,
238
- },
239
- };
240
- // Color variants
241
- // Example of color with different button states
242
- export var DisabledButton = {
243
- args: {
244
- children: "Disabled Button",
245
- color: "blue",
246
- disabled: true,
247
- },
248
- };
@@ -1,73 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import { Dummy_label } from "../../utils/constants";
3
- import { Button } from "./Button";
4
- describe("Button Component", function () {
5
- it("renders default button component", function () {
6
- render(<Button>{Dummy_label}</Button>);
7
- expect(screen.getByRole("button")).toBeInTheDocument();
8
- });
9
- });
10
- // it("renders button with a custom label", () => {
11
- // render(<Button>{Dummy_label}</Button>);
12
- // expect(
13
- // screen.getByRole("button", { name: Dummy_label }),
14
- // ).toBeInTheDocument();
15
- // });
16
- // it("calls onClick handler when clicked", () => {
17
- // const 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", () => {
23
- // render(<Button startIcon={<span>*</span>}>{Dummy_label}</Button>);
24
- // expect(screen.getByTestId("start-icon")).toBeInTheDocument();
25
- // });
26
- // it("renders endIcon when provided", () => {
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", () => {
31
- // render(
32
- // <Button color="primary" shape="rounded-full" size="lg">
33
- // {Dummy_label}
34
- // </Button>,
35
- // );
36
- // const buttonElement = screen.getByRole("button");
37
- // expect(buttonElement).toHaveClass(
38
- // buttonColors["primary"],
39
- // buttonShapes["rounded-full"],
40
- // buttonSizes["lg"],
41
- // );
42
- // });
43
- // it("applies additional className when provided", () => {
44
- // render(<Button className="custom-class">{Dummy_label}</Button>);
45
- // expect(screen.getByRole("button")).toHaveClass("custom-class");
46
- // });
47
- // it("renders without crashing when no props are provided", () => {
48
- // render(<Button>{Dummy_label}</Button>);
49
- // expect(screen.getByRole("button")).toBeInTheDocument();
50
- // });
51
- // it("renders button with both startIcon and endIcon", () => {
52
- // render(
53
- // <Button startIcon={<span>*</span>} endIcon={<span>*</span>}>
54
- // {Dummy_label}
55
- // </Button>,
56
- // );
57
- // expect(screen.getByTestId("start-icon")).toBeInTheDocument();
58
- // expect(screen.getByTestId("end-icon")).toBeInTheDocument();
59
- // });
60
- // it("does not render startIcon when not provided", () => {
61
- // render(<Button>{Dummy_label}</Button>);
62
- // expect(screen.queryByTestId("start-icon")).not.toBeInTheDocument();
63
- // });
64
- // it("does not render endIcon when not provided", () => {
65
- // render(<Button>{Dummy_label}</Button>);
66
- // expect(screen.queryByTestId("end-icon")).not.toBeInTheDocument();
67
- // });
68
- // it("renders correctly without a className prop", () => {
69
- // render(<Button>{Dummy_label}</Button>);
70
- // const buttonElement = screen.getByRole("button");
71
- // expect(buttonElement).not.toHaveClass("custom-class");
72
- // });
73
- // });
@@ -1,70 +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 * as React from "react";
13
- import { Slot } from "@radix-ui/react-slot";
14
- import { cva } from "class-variance-authority";
15
- import { cn } from "../../lib/utils";
16
- import LUIcon from "../Icons/LUIcon";
17
- export var color = {
18
- blue: "bg-blue-600 text-white hover:bg-blue-700 focus-visible:ring-blue-300 active:bg-blue-800 disabled:bg-gray-100 disabled:text-gray-400",
19
- "blue-light": "bg-blue-100 text-blue-600 hover:bg-blue-700 hover:text-blue-50 active:bg-blue-800 active:text-blue-50",
20
- red: "bg-red-600 text-white hover:bg-red-700 focus-visible:ring-red-300 active:bg-red-800 disabled:bg-gray-100 disabled:text-gray-400",
21
- "red-light": "bg-red-100 text-red-600 hover:bg-red-700 hover:text-red-50 focus-visible:bg-red-600 focus-visible:text-red-50 active:bg-red-800 active:text-red-50",
22
- green: "bg-green-600 text-white hover:bg-green-700 focus-visible:ring-green-300 active:bg-green-800 disabled:bg-gray-100 disabled:text-gray-400",
23
- yellow: "bg-yellow-500 text-white hover:bg-yellow-600 focus-visible:ring-yellow-200 active:bg-yellow-700 disabled:bg-gray-100 disabled:text-gray-400",
24
- indigo: "bg-indigo-600 text-white hover:bg-indigo-700 focus-visible:ring-indigo-300 active:bg-indigo-800 disabled:bg-gray-100 disabled:text-gray-400",
25
- gray: "bg-gray-50 text-gray-950 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
26
- "light-gray": "bg-gray-900 text-gray-50 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
27
- };
28
- export var size = {
29
- xl: "!p-3.5",
30
- lg: "!p-3",
31
- md: "!p-2.5",
32
- sm: "!p-2.5",
33
- };
34
- export var shape = {
35
- "rounded-sm": "!rounded-sm",
36
- "rounded-full": "!rounded-full",
37
- };
38
- var buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
39
- variants: {
40
- color: color,
41
- size: size,
42
- shape: shape,
43
- },
44
- defaultVariants: {
45
- color: "blue",
46
- size: "md",
47
- shape: "rounded-sm",
48
- },
49
- });
50
- function IconButton(_a) {
51
- var className = _a.className, color = _a.color, size = _a.size, shape = _a.shape, _b = _a.asChild, asChild = _b === void 0 ? false : _b, icon = _a.icon, props = __rest(_a, ["className", "color", "size", "shape", "asChild", "icon"]);
52
- var Comp = asChild ? Slot : "button";
53
- // Map button size to appropriate icon sizes for the icon
54
- var getIconSize = function () {
55
- if (size === "xl" || size === "lg") {
56
- return "xl";
57
- }
58
- else if (size === "md") {
59
- return "lg";
60
- }
61
- else if (size === "sm") {
62
- return "md";
63
- }
64
- };
65
- var iconSize = getIconSize();
66
- return (<Comp data-slot="button" className={cn(buttonVariants({ color: color, size: size, shape: shape, className: className }))} {...props}>
67
- <LUIcon size={iconSize} data-testid="icon" icon={icon !== null && icon !== void 0 ? icon : ""}/>
68
- </Comp>);
69
- }
70
- export { IconButton, buttonVariants };
@@ -1,53 +0,0 @@
1
- import { color, IconButton, shape, size } from "./IconButton";
2
- import { iconList } from "../../utils/iconList";
3
- export default {
4
- title: "Components/Button/IconButton",
5
- component: IconButton,
6
- tags: ["autodocs"],
7
- };
8
- var Template = function (args) { return (<IconButton icon="chart-simple" size="md" {...args}/>); };
9
- export var _IconButton = Template.bind({});
10
- _IconButton.args = {
11
- icon: "chart-simple",
12
- };
13
- _IconButton.argTypes = {
14
- color: {
15
- control: {
16
- type: "select",
17
- labels: Object.keys(color),
18
- },
19
- options: Object.keys(color),
20
- },
21
- shape: {
22
- control: {
23
- type: "select",
24
- labels: Object.keys(shape),
25
- },
26
- options: Object.keys(shape),
27
- description: "Select the shape of the button",
28
- table: {
29
- defaultValue: { summary: "rounded-sm" },
30
- type: { summary: "string" },
31
- },
32
- },
33
- size: {
34
- control: {
35
- type: "select",
36
- labels: Object.keys(size),
37
- },
38
- options: Object.keys(size),
39
- description: "Select the size of the button",
40
- table: {
41
- defaultValue: { summary: "md" },
42
- type: { summary: "string" },
43
- },
44
- },
45
- icon: {
46
- control: {
47
- type: "select",
48
- labels: Object.fromEntries(iconList.map(function (icon) { return [icon.key, icon.label]; })),
49
- },
50
- options: iconList.map(function (icon) { return icon.key; }),
51
- description: "Icon (React component)",
52
- },
53
- };
@@ -1,27 +0,0 @@
1
- import { fireEvent, render, screen } from "@testing-library/react";
2
- import { color, IconButton, shape, size } from "./IconButton";
3
- describe("Icon Button Component", function () {
4
- it("renders icon button with required icon prop", function () {
5
- render(<IconButton icon="chart-simple"/>);
6
- expect(screen.getByRole("button")).toBeInTheDocument();
7
- });
8
- it("calls onClick handler when clicked", function () {
9
- var handleClick = jest.fn();
10
- render(<IconButton onClick={handleClick} icon="chart-simple"/>);
11
- fireEvent.click(screen.getByRole("button"));
12
- expect(handleClick).toHaveBeenCalledTimes(1);
13
- });
14
- it("applies correct color, shape, and size classes", function () {
15
- render(<IconButton color="blue" shape="rounded-full" size="lg" icon="chart-simple"/>);
16
- var buttonElement = screen.getByRole("button");
17
- expect(buttonElement).toHaveClass(color["blue"], shape["rounded-full"], size["lg"]);
18
- });
19
- it("applies additional className when provided", function () {
20
- render(<IconButton className="custom-class" icon="chart-simple"/>);
21
- expect(screen.getByRole("button")).toHaveClass("custom-class");
22
- });
23
- it("renders without crashing when all required props are provided", function () {
24
- render(<IconButton icon="chart-simple"/>);
25
- expect(screen.getByRole("button")).toBeInTheDocument();
26
- });
27
- });
@@ -1,2 +0,0 @@
1
- import { CardInterface } from "./type";
2
- export declare const ContactProfile: ({ item, image, href, btnLabel, editor, mediaPosition, orientation, }: CardInterface) => import("react/jsx-runtime").JSX.Element;
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import LuImage from "../Images/LuImage";
3
- import Link from "next/link";
4
- import { Heading } from "../Typography/Heading/heading";
5
- import { Body } from "../Typography/Body/body";
6
- import { Button } from "../Button/Button";
7
- export var ContactProfile = function (_a) {
8
- var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
9
- // Normalize mediaPosition based on orientation
10
- var normalizedMediaPosition = orientation === "horizontal"
11
- ? mediaPosition === "left" || mediaPosition === "right"
12
- ? mediaPosition
13
- : "right"
14
- : mediaPosition === "top" || mediaPosition === "bottom"
15
- ? mediaPosition
16
- : "top";
17
- // Common image component to avoid repetition
18
- var ProfileImage = function () { return (_jsx(LuImage, { src: image, width: 240, height: 240, className: "w-full h-full rounded-full max-w-[160px] aspect-square object-cover ".concat(editor === null || editor === void 0 ? void 0 : editor.cardImage), alt: "Image" })); };
19
- // Common content section (title and description)
20
- var ContentSection = function (_a) {
21
- var _b = _a.className, className = _b === void 0 ? "" : _b;
22
- return (_jsxs("div", { className: "flex flex-col gap-1 ".concat(className), children: [_jsx(Heading, { variant: "h5-700", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle), children: item === null || item === void 0 ? void 0 : item.title }), _jsx(Body, { variant: "body-md", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardText, " line-clamp-2"), children: item === null || item === void 0 ? void 0 : item.description })] }));
23
- };
24
- // Common button component
25
- var ActionButton = function (_a) {
26
- var _b = _a.className, className = _b === void 0 ? "" : _b;
27
- return (_jsx(Link, { href: href, passHref: true, className: className, children: _jsx(Button, { endIcon: "angle-right", size: "sm", className: "".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn), children: btnLabel }) }));
28
- };
29
- // Horizontal layout card
30
- if (orientation === "horizontal") {
31
- return (_jsxs("div", { className: "p-5 bg-white rounded-xl inline-flex ".concat(normalizedMediaPosition === "right" ? "flex-row-reverse" : "", " gap-10 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsx(ProfileImage, {}), _jsxs("div", { className: "flex flex-col gap-1 w-full", children: [_jsx(ContentSection, {}), _jsx(ActionButton, { className: "mt-5" })] })] }));
32
- }
33
- // Vertical layout card
34
- return (_jsxs("div", { className: "p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[365px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card), children: [_jsxs("div", { className: "flex ".concat(normalizedMediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center"), children: [_jsx(ProfileImage, {}), _jsx(ContentSection, {})] }), _jsx(ActionButton, {})] }));
35
- };
@@ -1,57 +0,0 @@
1
- import LuImage from "../Images/LuImage";
2
- import Link from "next/link";
3
- import { Heading } from "../Typography/Heading/heading";
4
- import { Body } from "../Typography/Body/body";
5
- import { Button } from "../Button/Button";
6
- export var ContactProfile = function (_a) {
7
- var item = _a.item, image = _a.image, _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 ? "right" : _d, orientation = _a.orientation;
8
- // Normalize mediaPosition based on orientation
9
- var normalizedMediaPosition = orientation === "horizontal"
10
- ? mediaPosition === "left" || mediaPosition === "right"
11
- ? mediaPosition
12
- : "right"
13
- : mediaPosition === "top" || mediaPosition === "bottom"
14
- ? mediaPosition
15
- : "top";
16
- // Common image component to avoid repetition
17
- var ProfileImage = function () { return (<LuImage src={image} width={240} height={240} className={"w-full h-full rounded-full max-w-[160px] aspect-square object-cover ".concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>); };
18
- // Common content section (title and description)
19
- var ContentSection = function (_a) {
20
- var _b = _a.className, className = _b === void 0 ? "" : _b;
21
- return (<div className={"flex flex-col gap-1 ".concat(className)}>
22
- <Heading variant="h5-700" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
23
- {item === null || item === void 0 ? void 0 : item.title}
24
- </Heading>
25
- <Body variant="body-md" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardText, " line-clamp-2")}>
26
- {item === null || item === void 0 ? void 0 : item.description}
27
- </Body>
28
- </div>);
29
- };
30
- // Common button component
31
- var ActionButton = function (_a) {
32
- var _b = _a.className, className = _b === void 0 ? "" : _b;
33
- return (<Link href={href} passHref className={className}>
34
- <Button endIcon={"angle-right"} size="sm" className={"".concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn)}>
35
- {btnLabel}
36
- </Button>
37
- </Link>);
38
- };
39
- // Horizontal layout card
40
- if (orientation === "horizontal") {
41
- return (<div className={"p-5 bg-white rounded-xl inline-flex ".concat(normalizedMediaPosition === "right" ? "flex-row-reverse" : "", " gap-10 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
42
- <ProfileImage />
43
- <div className="flex flex-col gap-1 w-full">
44
- <ContentSection />
45
- <ActionButton className="mt-5"/>
46
- </div>
47
- </div>);
48
- }
49
- // Vertical layout card
50
- return (<div className={"p-8 bg-white rounded-xl inline-flex flex-col gap-5 max-w-[365px] items-center shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
51
- <div className={"flex ".concat(normalizedMediaPosition === "top" ? "flex-col" : "flex-col-reverse", " items-center gap-5 text-center")}>
52
- <ProfileImage />
53
- <ContentSection />
54
- </div>
55
- <ActionButton />
56
- </div>);
57
- };