linkedunion-design-kit 1.9.2 → 1.9.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 (142) hide show
  1. package/dist/app/layout.jsx +13 -0
  2. package/dist/app/page.jsx +25 -0
  3. package/dist/build/types/app/layout.d.ts +12 -0
  4. package/dist/build/types/app/layout.js +22 -0
  5. package/dist/build/types/app/page.d.ts +12 -0
  6. package/dist/build/types/app/page.js +22 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.js +4 -0
  9. package/dist/src/components/Accordion/Accordion.stories.jsx +33 -0
  10. package/dist/src/components/Accordion/accordion.jsx +59 -0
  11. package/dist/src/components/Alerts/Alert/alert.jsx +152 -0
  12. package/dist/src/components/Alerts/Alert/alert.stories.jsx +344 -0
  13. package/dist/src/components/Alerts/AlertDialog/alert-dialog.jsx +170 -0
  14. package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +552 -0
  15. package/dist/src/components/AppIcons/AndroidIcon.jsx +24 -0
  16. package/dist/src/components/AppIcons/AppIcon.jsx +29 -0
  17. package/dist/src/components/AppIcons/AppIcon.stories.jsx +223 -0
  18. package/dist/src/components/AppIcons/AppleIcon.jsx +31 -0
  19. package/dist/src/components/AppIcons/PlayStoreIcon.jsx +29 -0
  20. package/dist/src/components/Avatar/Avatar/Avatar.jsx +45 -0
  21. package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +95 -0
  22. package/dist/src/components/Avatar/Avatar/Avatar.test.jsx +9 -0
  23. package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +17 -0
  24. package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +32 -0
  25. package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.jsx +20 -0
  26. package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.jsx +50 -0
  27. package/dist/src/components/Badge/Badge.jsx +54 -0
  28. package/dist/src/components/Badge/Badge.stories.jsx +201 -0
  29. package/dist/src/components/Button/Button/Button.d.ts +7 -6
  30. package/dist/src/components/Button/Button/Button.js +32 -9
  31. package/dist/src/components/Button/Button/Button.jsx +101 -0
  32. package/dist/src/components/Button/Button/Button.stories.jsx +283 -0
  33. package/dist/src/components/Button/Button/Button.test.jsx +73 -0
  34. package/dist/src/components/Button/IconButton/IconButton.jsx +63 -0
  35. package/dist/src/components/Button/IconButton/IconButton.stories.jsx +128 -0
  36. package/dist/src/components/Button/IconButton/IconButton.test.jsx +28 -0
  37. package/dist/src/components/Button/index.js +3 -3
  38. package/dist/src/components/Card/MultipleNews/MultiNews.jsx +80 -0
  39. package/dist/src/components/Card/MultipleNews/MultiNews.stories.jsx +104 -0
  40. package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +60 -0
  41. package/dist/src/components/Card/PostByCategory/PostByCategory.stories.jsx +106 -0
  42. package/dist/src/components/Card/SinglePost/SinglePost.jsx +26 -0
  43. package/dist/src/components/Card/SinglePost/SinglePost.stories.jsx +68 -0
  44. package/dist/src/components/Card/card.jsx +36 -0
  45. package/dist/src/components/Card/contactProfile/ContactProfile.jsx +60 -0
  46. package/dist/src/components/Card/contactProfile/ContactProfile.stories.jsx +103 -0
  47. package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +41 -0
  48. package/dist/src/components/Card/photoAlbum/PhotoAlbum.stories.jsx +69 -0
  49. package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +17 -0
  50. package/dist/src/components/Card/photoGallery/PhotoGallery.stories.jsx +39 -0
  51. package/dist/src/components/Checkbox/checkbox.jsx +47 -0
  52. package/dist/src/components/Checkbox/checkbox.stories.jsx +113 -0
  53. package/dist/src/components/ColorPicker/ColorPicker.jsx +67 -0
  54. package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +138 -0
  55. package/dist/src/components/Colors/color.jsx +5 -0
  56. package/dist/src/components/Colors/color.stories.jsx +20 -0
  57. package/dist/src/components/Colors/color.test.jsx +23 -0
  58. package/dist/src/components/Dropdown/Combobox/Combobox.jsx +198 -0
  59. package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +289 -0
  60. package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +7 -0
  61. package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.jsx +102 -0
  62. package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +464 -0
  63. package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +19 -0
  64. package/dist/src/components/Dropdown/Select.stories.jsx +201 -0
  65. package/dist/src/components/Dropdown/select.jsx +93 -0
  66. package/dist/src/components/Icons/LUIcon.jsx +41 -0
  67. package/dist/src/components/Icons/LUIcon.test.jsx +308 -0
  68. package/dist/src/components/Icons/stories/IconDropdown.jsx +67 -0
  69. package/dist/src/components/Icons/stories/IconGallery.jsx +77 -0
  70. package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +86 -0
  71. package/dist/src/components/Icons/stories/LUIcon.stories.jsx +108 -0
  72. package/dist/src/components/ImageUploader/ImageUploader.stories.jsx +50 -0
  73. package/dist/src/components/ImageUploader/imageUploader.jsx +94 -0
  74. package/dist/src/components/Images/LuImage.jsx +19 -0
  75. package/dist/src/components/Images/LuImage.stories.jsx +154 -0
  76. package/dist/src/components/Images/LuImage.test.jsx +44 -0
  77. package/dist/src/components/Input/Input.stories.jsx +250 -0
  78. package/dist/src/components/Input/input.jsx +110 -0
  79. package/dist/src/components/Label/Label.jsx +32 -0
  80. package/dist/src/components/Label/Label.stories.jsx +30 -0
  81. package/dist/src/components/Pagination/pagination.d.ts +33 -0
  82. package/dist/src/components/Pagination/pagination.js +68 -0
  83. package/dist/src/components/Pagination/pagination.jsx +68 -0
  84. package/dist/src/components/Pagination/pagination.stories.d.ts +74 -0
  85. package/dist/src/components/Pagination/pagination.stories.js +168 -0
  86. package/dist/src/components/Pagination/pagination.stories.jsx +114 -0
  87. package/dist/src/components/RadioGroup/RadioGroup.stories.jsx +146 -0
  88. package/dist/src/components/RadioGroup/radio-group.jsx +49 -0
  89. package/dist/src/components/Skeleton/skeleton.d.ts +117 -0
  90. package/dist/src/components/Skeleton/skeleton.js +140 -0
  91. package/dist/src/components/Skeleton/skeleton.stories.d.ts +153 -0
  92. package/dist/src/components/Skeleton/skeleton.stories.js +404 -0
  93. package/dist/src/components/Slider/Slider.stories.jsx +159 -0
  94. package/dist/src/components/Slider/slider.jsx +31 -0
  95. package/dist/src/components/SweetAlert/SweetAlert.jsx +147 -0
  96. package/dist/src/components/SweetAlert/SweetAlert.stories.jsx +505 -0
  97. package/dist/src/components/Switch/Switch.stories.jsx +66 -0
  98. package/dist/src/components/Switch/switch.jsx +61 -0
  99. package/dist/src/components/Table/Table.d.ts +26 -0
  100. package/dist/src/components/Table/Table.js +186 -0
  101. package/dist/src/components/Table/Table.jsx +221 -0
  102. package/dist/src/components/Table/Table.stories.d.ts +51 -0
  103. package/dist/src/components/Table/Table.stories.js +408 -0
  104. package/dist/src/components/Table/Table.stories.jsx +652 -0
  105. package/dist/src/components/Table/index.d.ts +20 -0
  106. package/dist/src/components/Table/index.js +20 -0
  107. package/dist/src/components/Tabs/Tabs.stories.jsx +29 -0
  108. package/dist/src/components/Tabs/tabs.jsx +32 -0
  109. package/dist/src/components/Title/Title.jsx +8 -0
  110. package/dist/src/components/Title/Title.stories.jsx +37 -0
  111. package/dist/src/components/Title/Title.test.jsx +24 -0
  112. package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
  113. package/dist/src/components/ToolTip/Tooltip.stories.jsx +25 -0
  114. package/dist/src/components/Typography/Body/Body.stories.jsx +34 -0
  115. package/dist/src/components/Typography/Body/body.jsx +52 -0
  116. package/dist/src/components/Typography/Caption/Caption.stories.jsx +24 -0
  117. package/dist/src/components/Typography/Caption/caption.jsx +25 -0
  118. package/dist/src/components/Typography/Display/Display.stories.jsx +24 -0
  119. package/dist/src/components/Typography/Display/display.jsx +39 -0
  120. package/dist/src/components/Typography/Heading/Heading.stories.jsx +37 -0
  121. package/dist/src/components/Typography/Heading/heading.jsx +53 -0
  122. package/dist/src/components/ui/avatar.d.ts +3 -10
  123. package/dist/src/components/ui/avatar.js +12 -27
  124. package/dist/src/components/ui/avatar.jsx +27 -0
  125. package/dist/src/components/ui/button.d.ts +10 -0
  126. package/dist/src/components/ui/button.js +56 -0
  127. package/dist/src/components/ui/button.jsx +45 -0
  128. package/dist/src/components/ui/collapsible.d.ts +5 -0
  129. package/dist/src/components/ui/collapsible.js +5 -0
  130. package/dist/src/components/ui/collapsible.jsx +5 -0
  131. package/dist/src/components/ui/command.jsx +67 -0
  132. package/dist/src/components/ui/dialog.jsx +66 -0
  133. package/dist/src/components/ui/popover.jsx +33 -0
  134. package/dist/src/components/ui/tooltip.jsx +38 -0
  135. package/dist/src/components/ui/typography.jsx +56 -0
  136. package/dist/src/utils/colors.js +11 -11
  137. package/dist/src/utils/iconList.d.ts +4 -0
  138. package/dist/src/utils/iconList.js +4 -0
  139. package/dist/styles/global.css +209 -67
  140. package/package.json +1 -1
  141. package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +0 -17
  142. package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +0 -68
@@ -0,0 +1,283 @@
1
+ import { Button, variant } from "./Button";
2
+ import { buttonStyles } from "..";
3
+ var meta = {
4
+ title: "Components/Button",
5
+ component: Button,
6
+ tags: ["autodocs"],
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: "Button component with default variants: color: blue, size: md, shape: rounded-sm, variant: default",
11
+ },
12
+ },
13
+ controls: {
14
+ expanded: true,
15
+ sort: "requiredFirst",
16
+ hideNoControlsWarning: true,
17
+ exclude: [],
18
+ },
19
+ },
20
+ args: {
21
+ // Default values for all stories
22
+ color: "blue",
23
+ size: "md",
24
+ shape: "rounded-sm",
25
+ variant: "fill",
26
+ },
27
+ argTypes: {
28
+ color: {
29
+ control: {
30
+ type: "select",
31
+ },
32
+ options: Object.keys(buttonStyles.fillColor),
33
+ description: "The color and visual style of the button",
34
+ defaultValue: "blue",
35
+ table: {
36
+ defaultValue: { summary: "blue" },
37
+ },
38
+ },
39
+ size: {
40
+ control: {
41
+ type: "select",
42
+ },
43
+ options: Object.keys(buttonStyles.size),
44
+ description: "The size of the button",
45
+ defaultValue: "md",
46
+ table: {
47
+ defaultValue: { summary: "md" },
48
+ },
49
+ },
50
+ shape: {
51
+ control: {
52
+ type: "select",
53
+ },
54
+ options: Object.keys(buttonStyles.shape),
55
+ description: "The shape of the button",
56
+ defaultValue: "rounded-sm",
57
+ table: {
58
+ defaultValue: { summary: "rounded-sm" },
59
+ },
60
+ },
61
+ variant: {
62
+ control: {
63
+ type: "select",
64
+ },
65
+ options: Object.keys(variant),
66
+ description: "The variant of the button (default or link)",
67
+ defaultValue: "fill",
68
+ table: {
69
+ defaultValue: { summary: "fill" },
70
+ },
71
+ },
72
+ startIcon: {
73
+ control: "text",
74
+ description: "Icon to display at the start of the button",
75
+ },
76
+ endIcon: {
77
+ control: "text",
78
+ description: "Icon to display at the end of the button",
79
+ },
80
+ disabled: {
81
+ control: "boolean",
82
+ description: "Whether the button is disabled",
83
+ },
84
+ asChild: {
85
+ control: "boolean",
86
+ description: "Whether to render as a child component",
87
+ },
88
+ onClick: {
89
+ action: "clicked",
90
+ description: "Function called when button is clicked",
91
+ },
92
+ },
93
+ decorators: [
94
+ function (Story, context) {
95
+ var currentVariant = context.args.variant;
96
+ var isLink = currentVariant === "link";
97
+ var isOutline = currentVariant === "outline";
98
+ var isGhost = currentVariant === "ghost";
99
+ var isFill = currentVariant === "fill";
100
+ if (context.argTypes) {
101
+ // ✅ Update Link color and size options
102
+ if (context.argTypes.color) {
103
+ context.argTypes.color.options = isLink
104
+ ? Object.keys(buttonStyles.linkColor)
105
+ : isOutline
106
+ ? Object.keys(buttonStyles.outlineColor)
107
+ : isGhost
108
+ ? Object.keys(buttonStyles.ghostColor)
109
+ : isFill
110
+ ? Object.keys(buttonStyles.fillColor)
111
+ : undefined;
112
+ }
113
+ if (context.argTypes.size) {
114
+ context.argTypes.size.options = isLink
115
+ ? Object.keys(buttonStyles.linkSize)
116
+ : Object.keys(buttonStyles.size);
117
+ }
118
+ // ✅ Hide shape control if variant is link
119
+ if (context.argTypes.shape) {
120
+ context.argTypes.shape.table = context.argTypes.shape.table || {};
121
+ context.argTypes.shape.table.disable = isLink;
122
+ }
123
+ }
124
+ return <Story {...context}/>;
125
+ },
126
+ ],
127
+ };
128
+ export default meta;
129
+ // Display Default button with explicit default values
130
+ export var Default = {
131
+ args: {
132
+ children: "Button Text",
133
+ color: "blue",
134
+ size: "md",
135
+ shape: "rounded-sm",
136
+ variant: "fill",
137
+ onClick: function () {
138
+ alert("Button clicked!");
139
+ },
140
+ },
141
+ };
142
+ export var Blue = {
143
+ args: {
144
+ children: "Blue Button",
145
+ color: "blue",
146
+ size: "md",
147
+ },
148
+ };
149
+ export var Red = {
150
+ args: {
151
+ children: "Red Button",
152
+ color: "red",
153
+ size: "md",
154
+ },
155
+ };
156
+ export var Green = {
157
+ args: {
158
+ children: "Green Button",
159
+ color: "green",
160
+ size: "md",
161
+ },
162
+ };
163
+ export var Yellow = {
164
+ args: {
165
+ children: "Yellow Button",
166
+ color: "yellow",
167
+ size: "md",
168
+ },
169
+ };
170
+ export var Indigo = {
171
+ args: {
172
+ children: "Indigo Button",
173
+ color: "indigo",
174
+ size: "md",
175
+ },
176
+ };
177
+ export var Gray = {
178
+ args: {
179
+ children: "Gray Button",
180
+ color: "gray",
181
+ size: "md",
182
+ },
183
+ };
184
+ export var WithStartIcon = {
185
+ args: {
186
+ children: "Button with Start Icon",
187
+ startIcon: "arrow-right",
188
+ size: "md",
189
+ },
190
+ };
191
+ export var WithEndIcon = {
192
+ args: {
193
+ children: "Button with End Icon",
194
+ endIcon: "arrow-right",
195
+ size: "md",
196
+ },
197
+ };
198
+ export var WithBothIcons = {
199
+ args: {
200
+ children: "Button with Icons",
201
+ startIcon: "plus",
202
+ endIcon: "arrow-right",
203
+ size: "md",
204
+ },
205
+ };
206
+ export var Small = {
207
+ args: {
208
+ children: "Small Button",
209
+ size: "sm",
210
+ },
211
+ };
212
+ export var Medium = {
213
+ args: {
214
+ children: "Medium Button",
215
+ size: "md",
216
+ },
217
+ };
218
+ export var Large = {
219
+ args: {
220
+ children: "Large Button",
221
+ size: "lg",
222
+ },
223
+ };
224
+ export var ExtraLarge = {
225
+ args: {
226
+ children: "Extra Large Button",
227
+ size: "xl",
228
+ },
229
+ };
230
+ export var DefaultVariant = {
231
+ args: {
232
+ children: "Default Variant Button",
233
+ variant: "fill",
234
+ },
235
+ };
236
+ export var LinkVariant = {
237
+ args: {
238
+ children: "Link Style Button",
239
+ variant: "link",
240
+ color: "blue",
241
+ },
242
+ };
243
+ export var LinkVariantRed = {
244
+ args: {
245
+ children: "Red Link Button",
246
+ variant: "link",
247
+ color: "red",
248
+ },
249
+ };
250
+ export var LinkVariantGreen = {
251
+ args: {
252
+ children: "Green Link Button",
253
+ variant: "link",
254
+ color: "green",
255
+ },
256
+ };
257
+ export var RoundedSmall = {
258
+ args: {
259
+ children: "Rounded Small",
260
+ shape: "rounded-sm",
261
+ },
262
+ };
263
+ export var RoundedFull = {
264
+ args: {
265
+ children: "Rounded Full",
266
+ shape: "rounded-full",
267
+ },
268
+ };
269
+ export var Disabled = {
270
+ args: {
271
+ children: "Disabled Button",
272
+ disabled: true,
273
+ },
274
+ };
275
+ // Color variants
276
+ // Example of color with different button states
277
+ export var DisabledButton = {
278
+ args: {
279
+ children: "Disabled Button",
280
+ color: "blue",
281
+ disabled: true,
282
+ },
283
+ };
@@ -0,0 +1,73 @@
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
+ // });
@@ -0,0 +1,63 @@
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
+ import { buttonStyles } from "..";
18
+ export var variant = {
19
+ fill: "",
20
+ outline: "border bg-transparent",
21
+ ghost: "bg-transparent border-none",
22
+ };
23
+ 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-[3px] focus-visible:ring-blue-200 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
24
+ variants: {
25
+ color: buttonStyles.fillColor,
26
+ size: buttonStyles.iconButtonSize,
27
+ shape: buttonStyles.shape,
28
+ variant: variant,
29
+ },
30
+ defaultVariants: {
31
+ color: "blue",
32
+ size: "md",
33
+ shape: "rounded-sm",
34
+ variant: "fill",
35
+ },
36
+ });
37
+ function IconButton(_a) {
38
+ 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 ? "fill" : _c, _d = _a.asChild, asChild = _d === void 0 ? false : _d, icon = _a.icon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "icon"]);
39
+ var Comp = asChild ? Slot : "button";
40
+ // Map button size to appropriate icon sizes for the icon
41
+ var getIconSize = function () {
42
+ if (size === "xl" || size === "lg") {
43
+ return "xl";
44
+ }
45
+ else if (size === "md") {
46
+ return "lg";
47
+ }
48
+ else if (size === "sm") {
49
+ return "md";
50
+ }
51
+ };
52
+ // Apply appropriate text color for link variant
53
+ var extraClasses = variant === "outline" && color
54
+ ? buttonStyles.outlineColor[color]
55
+ : variant === "ghost" && color
56
+ ? buttonStyles.ghostColor[color]
57
+ : buttonStyles.fillColor[color];
58
+ var iconSize = getIconSize();
59
+ return (<Comp data-slot="button" className={cn(buttonVariants({ color: color, size: size, shape: shape, variant: variant, className: className }), extraClasses)} {...props}>
60
+ <LUIcon size={iconSize} data-testid="icon" icon={icon !== null && icon !== void 0 ? icon : "info"}/>
61
+ </Comp>);
62
+ }
63
+ export { IconButton, buttonVariants };
@@ -0,0 +1,128 @@
1
+ import { iconList } from "../../../utils/iconList";
2
+ import { IconButton, variant } from "./IconButton";
3
+ import { buttonStyles } from "..";
4
+ var meta = {
5
+ title: "Components/Button/IconButton",
6
+ component: IconButton,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: "Icon Button component with default variants: color: blue, size: md, shape: rounded-sm, variant: default",
12
+ },
13
+ },
14
+ controls: {
15
+ expanded: true,
16
+ sort: "requiredFirst",
17
+ hideNoControlsWarning: true,
18
+ exclude: [],
19
+ },
20
+ className: "",
21
+ },
22
+ args: {
23
+ // Default values for all stories
24
+ color: "blue",
25
+ size: "md",
26
+ shape: "rounded-sm",
27
+ variant: "fill",
28
+ icon: "chart-simple",
29
+ },
30
+ argTypes: {
31
+ color: {
32
+ control: {
33
+ type: "select",
34
+ labels: Object.keys(buttonStyles.fillColor),
35
+ },
36
+ options: Object.keys(buttonStyles.fillColor),
37
+ },
38
+ shape: {
39
+ control: {
40
+ type: "select",
41
+ labels: Object.keys(buttonStyles.shape),
42
+ },
43
+ options: Object.keys(buttonStyles.shape),
44
+ description: "Select the shape of the button",
45
+ table: {
46
+ defaultValue: { summary: "rounded-sm" },
47
+ type: { summary: "string" },
48
+ },
49
+ },
50
+ variant: {
51
+ control: {
52
+ type: "select",
53
+ },
54
+ options: Object.keys(variant),
55
+ description: "The variant of the button (default or link)",
56
+ defaultValue: "fill",
57
+ table: {
58
+ defaultValue: { summary: "fill" },
59
+ },
60
+ },
61
+ size: {
62
+ control: {
63
+ type: "select",
64
+ labels: Object.keys(buttonStyles.iconButtonSize),
65
+ },
66
+ options: Object.keys(buttonStyles.iconButtonSize),
67
+ description: "Select the size of the button",
68
+ table: {
69
+ defaultValue: { summary: "md" },
70
+ type: { summary: "string" },
71
+ },
72
+ },
73
+ icon: {
74
+ control: {
75
+ type: "select",
76
+ labels: Object.fromEntries(Object.keys(iconList).map(function (key) { return [key, key]; })),
77
+ },
78
+ options: Object.keys(iconList),
79
+ description: "Icon (React component)",
80
+ },
81
+ className: {
82
+ control: { type: "text" },
83
+ description: "Custom class name for the IconButton",
84
+ table: {
85
+ type: { summary: "string" },
86
+ defaultValue: { summary: "" },
87
+ },
88
+ },
89
+ onClick: {
90
+ action: "clicked",
91
+ description: "Function called when button is clicked",
92
+ },
93
+ },
94
+ decorators: [
95
+ function (Story, context) {
96
+ var currentVariant = context.args.variant;
97
+ var isOutline = currentVariant === "outline";
98
+ var isGhost = currentVariant === "ghost";
99
+ var isFill = currentVariant === "fill";
100
+ if (context.argTypes) {
101
+ // ✅ Update Link color and size options
102
+ if (context.argTypes.color) {
103
+ context.argTypes.color.options = isOutline
104
+ ? Object.keys(buttonStyles.outlineColor)
105
+ : isGhost
106
+ ? Object.keys(buttonStyles.ghostColor)
107
+ : isFill
108
+ ? Object.keys(buttonStyles.fillColor)
109
+ : Object.keys(buttonStyles.fillColor);
110
+ }
111
+ }
112
+ return <Story {...context}/>;
113
+ },
114
+ ],
115
+ };
116
+ export default meta;
117
+ // Display Default button with explicit default values
118
+ export var Default = {
119
+ args: {
120
+ color: "blue",
121
+ size: "md",
122
+ shape: "rounded-sm",
123
+ variant: "fill",
124
+ onClick: function () {
125
+ alert("Button clicked!");
126
+ },
127
+ },
128
+ };
@@ -0,0 +1,28 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { IconButton } from "./IconButton";
3
+ import { buttonStyles } from "..";
4
+ describe("Icon Button Component", function () {
5
+ it("renders icon button with required icon prop", function () {
6
+ render(<IconButton icon="chart-simple"/>);
7
+ expect(screen.getByRole("button")).toBeInTheDocument();
8
+ });
9
+ it("calls onClick handler when clicked", function () {
10
+ var handleClick = jest.fn();
11
+ render(<IconButton onClick={handleClick} icon="chart-simple"/>);
12
+ fireEvent.click(screen.getByRole("button"));
13
+ expect(handleClick).toHaveBeenCalledTimes(1);
14
+ });
15
+ it("applies correct color, shape, and size classes", function () {
16
+ render(<IconButton color="blue" shape="rounded-full" size="lg" icon="chart-simple"/>);
17
+ var buttonElement = screen.getByRole("button");
18
+ expect(buttonElement).toHaveClass(buttonStyles.fillColor["blue"], buttonStyles.shape["rounded-full"], buttonStyles.iconButtonSize["lg"]);
19
+ });
20
+ it("applies additional className when provided", function () {
21
+ render(<IconButton className="custom-class" icon="chart-simple"/>);
22
+ expect(screen.getByRole("button")).toHaveClass("custom-class");
23
+ });
24
+ it("renders without crashing when all required props are provided", function () {
25
+ render(<IconButton icon="chart-simple"/>);
26
+ expect(screen.getByRole("button")).toBeInTheDocument();
27
+ });
28
+ });
@@ -56,8 +56,8 @@ export var buttonStyles = {
56
56
  "light-red": "bg-red-100 text-red-600 hover:bg-red-700 hover:text-red-50 active:bg-red-800 active:text-red-50",
57
57
  indigo: "text-indigo-600 hover:bg-indigo-700 hover:text-indigo-50 active:bg-indigo-800 active:text-indigo-50",
58
58
  "light-indigo": "bg-indigo-100 text-indigo-600 hover:bg-indigo-700 hover:text-indigo-50 active:bg-indigo-800 active:text-indigo-50",
59
- gray: "bg-gray-100 text-gray-950 hover:bg-gray-100 hover:text-gray-950 active:bg-gray-300 active:text-gray-950",
60
- "light-gray": "text-gray-950 hover:bg-gray-100 hover:text-gray-950 active:bg-gray-300",
59
+ gray: "bg-gray-50 border-gray-200 text-gray-950 hover:bg-gray-100 hover:text-gray-950 active:bg-gray-300 active:text-gray-950",
60
+ "light-gray": "text-gray-900 border-gray-900 bg-gray-100 hover:text-gray-950 active:bg-gray-300 active:text-gray-950",
61
61
  disabled: "text-gray-300",
62
62
  },
63
63
  ghostColor: {
@@ -66,6 +66,6 @@ export var buttonStyles = {
66
66
  yellow: "text-yellow-500 hover:bg-yellow-600 hover:text-yellow-950 active:bg-yellow-500 active:text-yellow-950",
67
67
  red: "text-red-600 hover:bg-red-100 active:bg-red-600 active:text-red-50",
68
68
  indigo: "text-indigo-600 hover:bg-indigo-100 active:bg-indigo-600 active:text-indigo-50",
69
- gray: "text-gray-950 hover:bg-gray-50 active:bg-gray-950 active:text-gray-950",
69
+ gray: "text-gray-950 hover:bg-gray-50 active:bg-gray-950 active:text-gray-50",
70
70
  },
71
71
  };
@@ -0,0 +1,80 @@
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 LuImage from "../../Images/LuImage";
13
+ import Link from "next/link";
14
+ import { Button } from "../../Button/Button/Button";
15
+ import { Body } from "../../Typography/Body/body";
16
+ import { Heading } from "../../Typography/Heading/heading";
17
+ export var MultiNews = function (_a) {
18
+ 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;
19
+ // Use destructuring to create cleaner code
20
+ var modifiedItem = item;
21
+ var modifiedEditor = editor;
22
+ // Only swap for middle position
23
+ if (mediaPosition === "middle") {
24
+ // Swap for item
25
+ modifiedItem = __assign(__assign({}, item), { description: item === null || item === void 0 ? void 0 : item.short_description, short_description: item === null || item === void 0 ? void 0 : item.description });
26
+ // Swap for editor
27
+ modifiedEditor = __assign(__assign({}, editor), { cardText: editor === null || editor === void 0 ? void 0 : editor.shortDescription, shortDescription: editor === null || editor === void 0 ? void 0 : editor.cardText });
28
+ }
29
+ // Common card media component
30
+ var CardMedia = function (_a) {
31
+ var _b = _a.className, className = _b === void 0 ? "" : _b;
32
+ return (<LuImage src={image} width={240} height={240} className={" object-cover w-full ".concat(className, " ").concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.cardImage)} alt="Image"/>);
33
+ };
34
+ // Common content section
35
+ var CardContent = function (_a) {
36
+ var _b = _a.className, className = _b === void 0 ? "" : _b;
37
+ return (<div className={"flex flex-col !gap-1 ".concat(className)}>
38
+ <Heading variant="h4-600" className={"line-clamp-1 capitalize ".concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.cardTitle)}>
39
+ {modifiedItem === null || modifiedItem === void 0 ? void 0 : modifiedItem.title}
40
+ </Heading>
41
+ <Body variant="body-xl" className={"".concat(mediaPosition === "middle" ? "line-clamp-1" : "line-clamp-2 h-16", " ").concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.cardText)}>
42
+ {modifiedItem === null || modifiedItem === void 0 ? void 0 : modifiedItem.description}
43
+ </Body>
44
+ </div>);
45
+ };
46
+ // Common button component with conditional shape
47
+ var ActionButton = function (_a) {
48
+ var _b = _a.className, className = _b === void 0 ? "" : _b;
49
+ return (<Link href={href} passHref className={className}>
50
+ <Button endIcon={"angle-right"} size={mediaPosition === "middle" ? "xl" : "sm"} {...(mediaPosition === "middle" && { shape: "rounded-full" })} className={"".concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.cardBtn)}>
51
+ {btnLabel}
52
+ </Button>
53
+ </Link>);
54
+ };
55
+ // Optional subtitle component
56
+ var Subtitle = function () { return (<>
57
+ {mediaPosition === "middle" && (<Body variant="body-xl" className={"line-clamp-4 h-32 ".concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.shortDescription)} dangerouslySetInnerHTML={{
58
+ __html: modifiedItem.short_description || "",
59
+ }}/>)}
60
+ </>); };
61
+ // Horizontal layout
62
+ if (orientation === "horizontal") {
63
+ return (<div className={"!p-5 bg-white rounded-2xl flex ".concat(mediaPosition === "right" ? "flex-row-reverse" : "", " !gap-5 items-center shadow-lg ").concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.card)}>
64
+ <CardMedia className="max-w-48 aspect-square rounded-lg"/>
65
+ <div className="flex flex-col !gap-5 w-full">
66
+ <CardContent />
67
+ <ActionButton />
68
+ </div>
69
+ </div>);
70
+ }
71
+ // Vertical layout
72
+ return (<div className={"p-8 bg-white rounded-2xl flex flex-col !gap-5 max-w-md shadow-lg ".concat(modifiedEditor === null || modifiedEditor === void 0 ? void 0 : modifiedEditor.card)}>
73
+ <div className={"flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " !gap-4")}>
74
+ <Subtitle />
75
+ <CardMedia className="aspect-16/10"/>
76
+ <CardContent />
77
+ </div>
78
+ <ActionButton />
79
+ </div>);
80
+ };