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,93 @@
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 * as SelectPrimitive from "@radix-ui/react-select";
14
+ import { cn } from "../../lib/utils";
15
+ import { selectSize, selectShape, selectType, selectColor, itemSize, } from ".";
16
+ import LUIcon from "../Icons/LUIcon";
17
+ // Map select size to icon size
18
+ var iconSizeMap = {
19
+ lg: "md",
20
+ md: "sm",
21
+ sm: "xs",
22
+ };
23
+ function Select(_a) {
24
+ var onValueChange = _a.onValueChange, defaultValue = _a.defaultValue, props = __rest(_a, ["onValueChange", "defaultValue"]);
25
+ return (<SelectPrimitive.Root data-slot="select" onValueChange={onValueChange} defaultValue={defaultValue} {...props}/>);
26
+ }
27
+ function SelectGroup(_a) {
28
+ var props = __rest(_a, []);
29
+ return <SelectPrimitive.Group data-slot="select-group" {...props}/>;
30
+ }
31
+ function SelectValue(_a) {
32
+ var props = __rest(_a, []);
33
+ return <SelectPrimitive.Value data-slot="select-value" {...props}/>;
34
+ }
35
+ function SelectTrigger(_a) {
36
+ var className = _a.className, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.shape, shape = _c === void 0 ? "rectangular" : _c, _d = _a.variant, variant = _d === void 0 ? "fill" : _d, _e = _a.color, color = _e === void 0 ? "default" : _e, children = _a.children, disabled = _a.disabled, props = __rest(_a, ["className", "size", "shape", "variant", "color", "children", "disabled"]);
37
+ var iconSize = iconSizeMap[size] || "md";
38
+ var shapeClass = selectShape[shape];
39
+ var typeClass = selectType[variant];
40
+ // Use disabled color if disabled prop is true
41
+ var isDisabled = !!disabled;
42
+ var colorClass = isDisabled
43
+ ? selectColor[variant]["disabled"]
44
+ : selectColor[variant][color];
45
+ return (<SelectPrimitive.Trigger data-slot="select-trigger" data-size={size} data-shape={shape} data-type={variant} data-color={isDisabled ? "disabled" : color} className={cn("data-[placeholder]:text-gray-400 w-full !px-4 !py-3 [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-blue-200 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex items-center justify-between gap-2 !border border-gray-200 whitespace-nowrap !shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", typeClass, shapeClass, selectSize[size], colorClass, className)} disabled={isDisabled} {...props}>
46
+ {children}
47
+ <SelectPrimitive.Icon asChild>
48
+ <LUIcon icon="angle-down" size={iconSize} color="light-gray"/>
49
+ </SelectPrimitive.Icon>
50
+ </SelectPrimitive.Trigger>);
51
+ }
52
+ function SelectContent(_a) {
53
+ var className = _a.className, children = _a.children, _b = _a.position, position = _b === void 0 ? "popper" : _b, _c = _a.hidePortal, hidePortal = _c === void 0 ? false : _c, props = __rest(_a, ["className", "children", "position", "hidePortal"]);
54
+ var content = (<SelectPrimitive.Content data-slot="select-content" className={cn("!bg-white text-gray-900 !py-2 !px-2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto !rounded-sm shadow-lg", position === "popper" &&
55
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className)} position={position} {...props}>
56
+ <SelectScrollUpButton />
57
+ <SelectPrimitive.Viewport className={cn("p-1", position === "popper" &&
58
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1")}>
59
+ {children}
60
+ </SelectPrimitive.Viewport>
61
+ <SelectScrollDownButton />
62
+ </SelectPrimitive.Content>);
63
+ return hidePortal ? (content) : (<SelectPrimitive.Portal>{content}</SelectPrimitive.Portal>);
64
+ }
65
+ function SelectLabel(_a) {
66
+ var className = _a.className, _b = _a.size, size = _b === void 0 ? "md" : _b, props = __rest(_a, ["className", "size"]);
67
+ return (<SelectPrimitive.Label data-slot="select-label" className={cn("text-muted-foreground !px-2 !py-1.5", itemSize[size], className)} {...props}/>);
68
+ }
69
+ function SelectItem(_a) {
70
+ var className = _a.className, children = _a.children, _b = _a.size, size = _b === void 0 ? "md" : _b, props = __rest(_a, ["className", "children", "size"]);
71
+ return (<SelectPrimitive.Item data-slot="select-item" className={cn("text-gray-900 data-[disabled]:bg-gray-100 data-[disabled]:text-gray-300 [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 !rounded-sm py-1.5 pr-8 pl-2 outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 data-[state=checked]:bg-gray-50 hover:bg-gray-50", itemSize[size], className)} {...props}>
72
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
73
+ </SelectPrimitive.Item>);
74
+ }
75
+ function SelectSeparator(_a) {
76
+ var className = _a.className, props = __rest(_a, ["className"]);
77
+ return (<SelectPrimitive.Separator data-slot="select-separator" className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)} {...props}/>);
78
+ }
79
+ function SelectScrollUpButton(_a) {
80
+ var className = _a.className, _b = _a.size, size = _b === void 0 ? "md" : _b, props = __rest(_a, ["className", "size"]);
81
+ var iconSize = iconSizeMap[size] || "md";
82
+ return (<SelectPrimitive.ScrollUpButton data-slot="select-scroll-up-button" className={cn("flex cursor-default items-center justify-center py-1", className)} {...props}>
83
+ <LUIcon icon="angle-up" size={iconSize} color="light-gray"/>
84
+ </SelectPrimitive.ScrollUpButton>);
85
+ }
86
+ function SelectScrollDownButton(_a) {
87
+ var className = _a.className, _b = _a.size, size = _b === void 0 ? "md" : _b, props = __rest(_a, ["className", "size"]);
88
+ var iconSize = iconSizeMap[size] || "md";
89
+ return (<SelectPrimitive.ScrollDownButton data-slot="select-scroll-down-button" className={cn("flex cursor-default items-center justify-center py-1", className)} {...props}>
90
+ <LUIcon icon="angle-down" size={iconSize} color="light-gray"/>
91
+ </SelectPrimitive.ScrollDownButton>);
92
+ }
93
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
@@ -0,0 +1,41 @@
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
+ import { cn } from "../../lib/utils";
15
+ var LUIcon = function (_a) {
16
+ var _b;
17
+ 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"]);
18
+ var isPadded = variant === "padded";
19
+ var sizeClass = iconSize[size];
20
+ var shapeClass = shape === "rounded" ? IconShape.rounded : IconShape.square[size];
21
+ var paddingClass = iconBackground[size];
22
+ // Helper function to build the className string
23
+ var getClassNames = function () {
24
+ var baseClasses = "".concat(cn("overflow-visible", sizeClass, getAppliedColor(variant, color)));
25
+ if (isPadded) {
26
+ baseClasses = cn(baseClasses, paddingClass, shapeClass);
27
+ }
28
+ return cn(baseClasses, className);
29
+ };
30
+ return (<svg role="img" data-testid={"lu-icon"} className={getClassNames()} viewBox="0 0 32 32" fill="currentColor" {...props}>
31
+ <g clipPath="url(#clip0_9168_14965)">
32
+ <path data-testid="lu-path" d={(_b = iconList[icon]) !== null && _b !== void 0 ? _b : ""}/>
33
+ </g>
34
+ <defs>
35
+ <clipPath id="clip0_9168_14965">
36
+ <rect width="32" height="32"/>
37
+ </clipPath>
38
+ </defs>
39
+ </svg>);
40
+ };
41
+ export default LUIcon;
@@ -0,0 +1,308 @@
1
+ "use strict";
2
+ // import { render, screen } from "@testing-library/react";
3
+ // import LUIcon from "./LUIcon";
4
+ // import { iconList } from "../../utils/iconList";
5
+ // import {
6
+ // iconSize,
7
+ // iconBackground,
8
+ // IconShape,
9
+ // iconWithBgColor,
10
+ // iconColor,
11
+ // getAppliedColor,
12
+ // } from ".";
13
+ // import { IconProps } from "./type";
14
+ describe("Default test", function () {
15
+ it("should pass", function () {
16
+ expect(true).toBe(true);
17
+ });
18
+ });
19
+ // describe("LUIcon Component", () => {
20
+ // const validIcon = "chart-simple" as keyof typeof iconList;
21
+ // describe("Basic Rendering", () => {
22
+ // it("renders correctly when a valid icon is provided", () => {
23
+ // const props: IconProps = {
24
+ // size: "xs",
25
+ // icon: validIcon,
26
+ // };
27
+ // render(<LUIcon {...props} />);
28
+ // // Select the element
29
+ // const singleIconElement = screen.getByTestId("lu-icon");
30
+ // const computedClassName = iconSize[props.size as keyof typeof iconSize];
31
+ // expect(singleIconElement).toHaveClass(computedClassName);
32
+ // // Assert that the fill class is applied correctly on the <path>
33
+ // const pathElement = screen.getByTestId("lu-path");
34
+ // expect(pathElement).toBeInTheDocument();
35
+ // const selectedIcon = iconList[props.icon];
36
+ // expect(pathElement).toHaveAttribute("d", selectedIcon || "");
37
+ // });
38
+ // it("renders correctly when an invalid icon is provided", () => {
39
+ // const props = {
40
+ // size: "md" as const,
41
+ // icon: "non-existent-icon" as keyof typeof iconList, // Invalid icon
42
+ // };
43
+ // render(<LUIcon {...props} />);
44
+ // const svgElement = screen.getByTestId("lu-icon");
45
+ // expect(svgElement).toBeInTheDocument();
46
+ // const pathElement = screen.getByTestId("lu-path");
47
+ // expect(pathElement).toBeInTheDocument();
48
+ // // Since the icon does not exist, path should be an empty string
49
+ // expect(pathElement).toHaveAttribute("d", "");
50
+ // });
51
+ // it("renders correctly when selectedIcon is undefined", () => {
52
+ // const props = {
53
+ // size: "md" as const,
54
+ // icon: "" as keyof typeof iconList, // Empty string as icon key
55
+ // };
56
+ // render(<LUIcon {...props} />);
57
+ // const pathElement = screen.getByTestId("lu-path");
58
+ // expect(pathElement).toBeInTheDocument();
59
+ // expect(pathElement).toHaveAttribute("d", ""); // Expect empty path when selectedIcon is undefined
60
+ // });
61
+ // it("renders with default props when only icon is provided", () => {
62
+ // render(<LUIcon icon={validIcon} />);
63
+ // const iconElement = screen.getByTestId("lu-icon");
64
+ // expect(iconElement).toBeInTheDocument();
65
+ // expect(iconElement).toHaveClass(iconSize.md); // default size
66
+ // });
67
+ // it("has correct SVG attributes", () => {
68
+ // render(<LUIcon icon={validIcon} />);
69
+ // const iconElement = screen.getByTestId("lu-icon");
70
+ // expect(iconElement).toHaveAttribute("role", "img");
71
+ // expect(iconElement).toHaveAttribute("viewBox", "0 0 32 32");
72
+ // expect(iconElement).toHaveAttribute("fill", "currentColor");
73
+ // });
74
+ // });
75
+ // describe("Size Variations", () => {
76
+ // const sizes = Object.keys(iconSize) as Array<keyof typeof iconSize>;
77
+ // sizes.forEach((size) => {
78
+ // it(`renders correctly with size ${size}`, () => {
79
+ // render(<LUIcon icon={validIcon} size={size} />);
80
+ // const iconElement = screen.getByTestId("lu-icon");
81
+ // expect(iconElement).toHaveClass(iconSize[size]);
82
+ // });
83
+ // });
84
+ // });
85
+ // describe("Variant: Default", () => {
86
+ // it("renders default variant correctly", () => {
87
+ // render(<LUIcon icon={validIcon} variant="default" />);
88
+ // const iconElement = screen.getByTestId("lu-icon");
89
+ // expect(iconElement).toBeInTheDocument();
90
+ // // Should not have wrapper div in default variant
91
+ // expect(screen.queryByTestId("lu-icon-wrapper")).not.toBeInTheDocument();
92
+ // });
93
+ // it("applies custom className to SVG in default variant", () => {
94
+ // const customClass = "custom-test-class";
95
+ // render(
96
+ // <LUIcon icon={validIcon} variant="default" className={customClass} />,
97
+ // );
98
+ // const iconElement = screen.getByTestId("lu-icon");
99
+ // expect(iconElement).toHaveClass(customClass);
100
+ // });
101
+ // it("applies color classes correctly in default variant", () => {
102
+ // const colors = Object.keys(iconColor) as Array<keyof typeof iconColor>;
103
+ // colors.forEach((color) => {
104
+ // const { rerender } = render(
105
+ // <LUIcon icon={validIcon} variant="default" color={color} />,
106
+ // );
107
+ // const iconElement = screen.getByTestId("lu-icon");
108
+ // expect(iconElement).toHaveClass(iconColor[color]);
109
+ // rerender(<></>); // Clean up for next iteration
110
+ // });
111
+ // });
112
+ // it("does not apply color when color prop is undefined in default variant", () => {
113
+ // render(<LUIcon icon={validIcon} variant="default" />);
114
+ // const iconElement = screen.getByTestId("lu-icon");
115
+ // const classList = Array.from(iconElement.classList);
116
+ // // Should not have any color classes
117
+ // Object.values(iconColor).forEach((colorClass) => {
118
+ // expect(classList).not.toContain(colorClass);
119
+ // });
120
+ // });
121
+ // });
122
+ // describe("Variant: Padded", () => {
123
+ // it("renders padded variant correctly", () => {
124
+ // render(<LUIcon icon={validIcon} variant="padded" />);
125
+ // // Find wrapper by test-id
126
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
127
+ // expect(wrapperElement).toBeInTheDocument();
128
+ // expect(wrapperElement).toHaveClass(
129
+ // "inline-flex",
130
+ // "items-center",
131
+ // "justify-center",
132
+ // );
133
+ // const iconElement = screen.getByTestId("lu-icon");
134
+ // expect(iconElement).toBeInTheDocument();
135
+ // });
136
+ // it("applies padding classes correctly in padded variant", () => {
137
+ // const sizes = Object.keys(iconBackground) as Array<
138
+ // keyof typeof iconBackground
139
+ // >;
140
+ // sizes.forEach((size) => {
141
+ // const { rerender } = render(
142
+ // <LUIcon icon={validIcon} variant="padded" size={size} />,
143
+ // );
144
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
145
+ // expect(wrapperElement).toHaveClass(iconBackground[size]);
146
+ // rerender(<></>); // Clean up for next iteration
147
+ // });
148
+ // });
149
+ // it("applies custom className to wrapper in padded variant", () => {
150
+ // const customClass = "custom-wrapper-class";
151
+ // render(
152
+ // <LUIcon icon={validIcon} variant="padded" className={customClass} />,
153
+ // );
154
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
155
+ // expect(wrapperElement).toHaveClass(customClass);
156
+ // // SVG should not have the custom class in padded variant
157
+ // const iconElement = screen.getByTestId("lu-icon");
158
+ // expect(iconElement).not.toHaveClass(customClass);
159
+ // });
160
+ // it("applies background color classes correctly in padded variant", () => {
161
+ // const colors = Object.keys(iconWithBgColor) as Array<
162
+ // keyof typeof iconWithBgColor
163
+ // >;
164
+ // colors.forEach((color) => {
165
+ // const { rerender } = render(
166
+ // <LUIcon icon={validIcon} variant="padded" color={color} />,
167
+ // );
168
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
169
+ // expect(wrapperElement).toHaveClass(iconWithBgColor[color]);
170
+ // rerender(<></>); // Clean up for next iteration
171
+ // });
172
+ // });
173
+ // });
174
+ // describe("Shape Variations", () => {
175
+ // it("renders square shape correctly in padded variant", () => {
176
+ // const sizes = Object.keys(IconShape.square) as Array<
177
+ // keyof typeof IconShape.square
178
+ // >;
179
+ // sizes.forEach((size) => {
180
+ // const { rerender } = render(
181
+ // <LUIcon
182
+ // icon={validIcon}
183
+ // variant="padded"
184
+ // shape="square"
185
+ // size={size}
186
+ // />,
187
+ // );
188
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
189
+ // expect(wrapperElement).toHaveClass(IconShape.square[size]);
190
+ // rerender(<></>); // Clean up for next iteration
191
+ // });
192
+ // });
193
+ // it("renders rounded shape correctly in padded variant", () => {
194
+ // render(<LUIcon icon={validIcon} variant="padded" shape="rounded" />);
195
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
196
+ // expect(wrapperElement).toHaveClass(IconShape.rounded);
197
+ // });
198
+ // it("defaults to square shape when shape prop is not provided", () => {
199
+ // render(<LUIcon icon={validIcon} variant="padded" size="md" />);
200
+ // const wrapperElement = screen.getByTestId("lu-icon-wrapper");
201
+ // expect(wrapperElement).toHaveClass(IconShape.square.md);
202
+ // });
203
+ // it("shape prop has no effect in default variant", () => {
204
+ // render(<LUIcon icon={validIcon} variant="default" shape="rounded" />);
205
+ // // Should not have wrapper div in default variant
206
+ // expect(screen.queryByTestId("lu-icon-wrapper")).not.toBeInTheDocument();
207
+ // });
208
+ // });
209
+ // describe("HTML Attributes Forwarding", () => {
210
+ // it("forwards additional props to SVG element in default variant", () => {
211
+ // const testId = "custom-test-id";
212
+ // const ariaLabel = "Custom icon";
213
+ // render(
214
+ // <LUIcon
215
+ // icon={validIcon}
216
+ // variant="default"
217
+ // data-testid={testId}
218
+ // aria-label={ariaLabel}
219
+ // />,
220
+ // );
221
+ // const iconElement = screen.getByTestId(testId); // Use custom test id
222
+ // expect(iconElement).toHaveAttribute("data-testid", testId);
223
+ // expect(iconElement).toHaveAttribute("aria-label", ariaLabel);
224
+ // });
225
+ // it("forwards style prop correctly", () => {
226
+ // const customStyle = { opacity: 0.5 };
227
+ // render(<LUIcon icon={validIcon} style={customStyle} />);
228
+ // const iconElement = screen.getByTestId("lu-icon");
229
+ // expect(iconElement).toHaveStyle("opacity: 0.5");
230
+ // });
231
+ // });
232
+ // describe("Edge Cases", () => {
233
+ // it("handles empty icon gracefully", () => {
234
+ // // Empty string as icon key to test edge case
235
+ // render(<LUIcon icon={"" as keyof typeof iconList} />);
236
+ // const pathElement = screen.getByTestId("lu-path");
237
+ // expect(pathElement).toHaveAttribute("d", "");
238
+ // });
239
+ // it("handles undefined color gracefully", () => {
240
+ // render(<LUIcon icon={validIcon} color={undefined} />);
241
+ // const iconElement = screen.getByTestId("lu-icon");
242
+ // expect(iconElement).toBeInTheDocument();
243
+ // });
244
+ // it("combines multiple class names correctly", () => {
245
+ // const customClass = "custom-class another-class";
246
+ // render(
247
+ // <LUIcon
248
+ // icon={validIcon}
249
+ // size="lg"
250
+ // color="blue"
251
+ // className={customClass}
252
+ // />,
253
+ // );
254
+ // const iconElement = screen.getByTestId("lu-icon");
255
+ // expect(iconElement).toHaveClass(iconSize.lg);
256
+ // expect(iconElement).toHaveClass(iconColor.blue);
257
+ // expect(iconElement).toHaveClass("custom-class");
258
+ // expect(iconElement).toHaveClass("another-class");
259
+ // });
260
+ // });
261
+ // describe("Color Helper Function", () => {
262
+ // it("getAppliedColor returns correct class for padded variant", () => {
263
+ // const result = getAppliedColor("padded", "blue");
264
+ // expect(result).toBe(iconWithBgColor.blue);
265
+ // });
266
+ // it("getAppliedColor returns correct class for default variant", () => {
267
+ // const result = getAppliedColor("default", "blue");
268
+ // expect(result).toBe(iconColor.blue);
269
+ // });
270
+ // it("getAppliedColor returns empty string when color is undefined", () => {
271
+ // const result = getAppliedColor("default", undefined);
272
+ // expect(result).toBe("");
273
+ // });
274
+ // });
275
+ // describe("Integration Tests", () => {
276
+ // it("renders complex configuration correctly", () => {
277
+ // render(
278
+ // <LUIcon
279
+ // icon="info"
280
+ // size="2xl"
281
+ // variant="padded"
282
+ // shape="rounded"
283
+ // color="light-blue"
284
+ // className="test-complex"
285
+ // data-testid="complex-icon"
286
+ // />,
287
+ // );
288
+ // const wrapperElement = screen.getByTestId("complex-icon-wrapper");
289
+ // expect(wrapperElement).toHaveClass(iconBackground["2xl"]);
290
+ // expect(wrapperElement).toHaveClass(IconShape.rounded);
291
+ // expect(wrapperElement).toHaveClass(iconWithBgColor["light-blue"]);
292
+ // expect(wrapperElement).toHaveClass("test-complex");
293
+ // const iconElement = screen.getByTestId("complex-icon"); // Use custom test id
294
+ // expect(iconElement).toHaveClass(iconSize["2xl"]);
295
+ // expect(iconElement).toHaveAttribute("data-testid", "complex-icon");
296
+ // });
297
+ // it("handles all icon variants from iconList", () => {
298
+ // const iconKeys = Object.keys(iconList) as Array<keyof typeof iconList>;
299
+ // // Test first few icons to ensure they all render
300
+ // iconKeys.slice(0, 5).forEach((iconKey) => {
301
+ // const { rerender } = render(<LUIcon icon={iconKey} />);
302
+ // const pathElement = screen.getByTestId("lu-path");
303
+ // expect(pathElement).toHaveAttribute("d", iconList[iconKey]);
304
+ // rerender(<></>);
305
+ // });
306
+ // });
307
+ // });
308
+ // });
@@ -0,0 +1,67 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import LUIcon from "../LUIcon";
3
+ import { Input } from "../../../components/Input";
4
+ export var IconDropdown = function (_a) {
5
+ var value = _a.value, onChange = _a.onChange, options = _a.options;
6
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
7
+ var _c = useState(""), searchTerm = _c[0], setSearchTerm = _c[1];
8
+ var dropdownRef = useRef(null);
9
+ var filteredOptions = options.filter(function (option) {
10
+ return option.toLowerCase().includes(searchTerm.toLowerCase()) ||
11
+ option
12
+ .replace(/-/g, " ")
13
+ .toLowerCase()
14
+ .includes(searchTerm.toLowerCase());
15
+ });
16
+ useEffect(function () {
17
+ var handleClickOutside = function (event) {
18
+ if (dropdownRef.current &&
19
+ !dropdownRef.current.contains(event.target)) {
20
+ setIsOpen(false);
21
+ }
22
+ };
23
+ document.addEventListener("mousedown", handleClickOutside);
24
+ return function () { return document.removeEventListener("mousedown", handleClickOutside); };
25
+ }, []);
26
+ var handleSelect = function (option) {
27
+ onChange(option);
28
+ setIsOpen(false);
29
+ setSearchTerm("");
30
+ };
31
+ var formatLabel = function (iconKey) {
32
+ return iconKey.replace(/-/g, " ").replace(/\b\w/g, function (l) { return l.toUpperCase(); });
33
+ };
34
+ return (<div ref={dropdownRef} className="relative w-full">
35
+ {/* Dropdown trigger */}
36
+ <div onClick={function () { return setIsOpen(!isOpen); }} className="px-3 py-2 border border-gray-300 rounded bg-white cursor-pointer flex items-center justify-between min-h-9">
37
+ <div className="flex items-center gap-2">
38
+ {value && <LUIcon icon={value} size="xs"/>}
39
+ <span>{value ? formatLabel(value) : "Select an icon..."}</span>
40
+ </div>
41
+ <span className={"transition-transform duration-200 ".concat(isOpen ? "rotate-180" : "rotate-0")}>
42
+
43
+ </span>
44
+ </div>
45
+
46
+ {/* Dropdown menu */}
47
+ {isOpen && (<div className="absolute top-full left-0 right-0 bg-white border border-gray-300 rounded shadow-lg z-[1000] max-h-[300px] overflow-y-auto">
48
+ {/* Search input */}
49
+ <div className="p-2">
50
+ <Input type="text" placeholder="Search icons..." value={searchTerm} onChange={function (e) { return setSearchTerm(e.target.value); }} className="w-full px-2 py-1.5 border border-gray-300 rounded-sm text-sm" onClick={function (e) { return e.stopPropagation(); }}/>
51
+ </div>
52
+
53
+ {/* Options list */}
54
+ <div className="max-h-[200px] overflow-y-auto">
55
+ {filteredOptions.length === 0 ? (<div className="p-3 text-gray-600 italic">No icons found</div>) : (filteredOptions.map(function (option) { return (<div key={option} onClick={function () { return handleSelect(option); }} className={"px-3 py-2 cursor-pointer flex items-center gap-2 transition-colors duration-100 ".concat(value === option
56
+ ? "bg-blue-50 border-l-4 border-l-blue-600"
57
+ : "border-l-4 border-l-transparent hover:bg-gray-50")}>
58
+ <LUIcon icon={option} size="xs"/>
59
+ <span className="text-sm">{formatLabel(option)}</span>
60
+ <span className="text-xs text-gray-600 ml-auto">
61
+ {option}
62
+ </span>
63
+ </div>); }))}
64
+ </div>
65
+ </div>)}
66
+ </div>);
67
+ };
@@ -0,0 +1,77 @@
1
+ import React, { useState } from "react";
2
+ import { iconList } from "../../../utils/iconList";
3
+ import LUIcon from "../LUIcon";
4
+ import { Heading } from "../../../components/Typography/Heading/heading";
5
+ import { Body } from "../../../components/Typography/Body/body";
6
+ import { Input } from "../../../components/Input/input";
7
+ export var IconGallery = function () {
8
+ var _a = useState(""), searchTerm = _a[0], setSearchTerm = _a[1];
9
+ var _b = useState(""), selectedIcon = _b[0], setSelectedIcon = _b[1];
10
+ var filteredIcons = Object.keys(iconList)
11
+ .sort()
12
+ .filter(function (iconKey) {
13
+ return iconKey.toLowerCase().includes(searchTerm.toLowerCase()) ||
14
+ iconKey
15
+ .replace(/-/g, " ")
16
+ .toLowerCase()
17
+ .includes(searchTerm.toLowerCase());
18
+ });
19
+ var IconItem = function (_a) {
20
+ var iconKey = _a.iconKey;
21
+ return (<div key={iconKey} onClick={function () { return setSelectedIcon(iconKey); }} className={"flex items-center gap-2 p-2 border rounded cursor-pointer transition-all duration-200 ".concat(selectedIcon === iconKey
22
+ ? "border-blue-600 bg-blue-50 border-2"
23
+ : "border-gray-200 bg-white hover:bg-gray-50 hover:border-gray-300")}>
24
+ <LUIcon icon={iconKey} size="sm"/>
25
+ <span className="text-xs font-mono text-gray-700 break-all">
26
+ {iconKey}
27
+ </span>
28
+ </div>);
29
+ };
30
+ var IconPreview = function (_a) {
31
+ var iconKey = _a.iconKey;
32
+ return (<div className="mt-5 p-4 bg-gray-50 rounded-lg border border-gray-200">
33
+ <Heading variant="h4" className="mb-4">
34
+ Preview Selected Icon: {iconKey}
35
+ </Heading>
36
+ <div className="flex gap-4 items-center flex-wrap">
37
+ <div className="flex items-center gap-2">
38
+ <Body variant="body-sm-600">Default:</Body>
39
+ <LUIcon icon={iconKey} size="md"/>
40
+ </div>
41
+ <div className="flex items-center gap-2">
42
+ <Body variant="body-sm-600">Padded:</Body>
43
+ <LUIcon icon={iconKey} size="md" variant="padded" color="blue"/>
44
+ </div>
45
+ <div className="flex items-center gap-2">
46
+ <Body variant="body-sm-600">Large:</Body>
47
+ <LUIcon icon={iconKey} size="xl"/>
48
+ </div>
49
+ </div>
50
+ <div className="mt-3 font-mono text-sm">
51
+ <Body variant="body-sm-600">Usage:</Body>
52
+ <br />
53
+ <code className="bg-gray-100 p-1 rounded">{"<LUIcon icon=\"".concat(iconKey, "\" size=\"md\" />")}</code>
54
+ </div>
55
+ </div>);
56
+ };
57
+ return (<div className="p-5">
58
+ <Heading variant="h3" className="mb-5">
59
+ Icon Gallery - All Available Icons ({Object.keys(iconList).length}{" "}
60
+ total)
61
+ </Heading>
62
+
63
+ <div className="mb-5">
64
+ <Input type="text" placeholder="Search icons... (e.g., 'circle', 'info', 'qr')" value={searchTerm} onChange={function (e) { return setSearchTerm(e.target.value); }} className="w-full max-w-md" startIcon="magnifying-glass"/>
65
+ <Body variant="body-sm" className="mt-2 text-gray-600">
66
+ {filteredIcons.length} icons found
67
+ {selectedIcon && (<span className="ml-4 font-semibold">Selected: {selectedIcon}</span>)}
68
+ </Body>
69
+ </div>
70
+
71
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-3 max-h-[500px] overflow-y-auto border border-gray-200 p-4 rounded-lg">
72
+ {filteredIcons.map(function (iconKey) { return (<IconItem key={iconKey} iconKey={iconKey}/>); })}
73
+ </div>
74
+
75
+ {selectedIcon && <IconPreview iconKey={selectedIcon}/>}
76
+ </div>);
77
+ };