linkedunion-design-kit 1.6.2 → 1.6.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.
- package/dist/app/page.js +2 -3
- package/dist/index.d.ts +10 -5
- package/dist/index.js +10 -5
- package/dist/src/components/Button/Button.d.ts +45 -3
- package/dist/src/components/Button/Button.js +77 -6
- package/dist/src/components/Button/Button.stories.d.ts +124 -5
- package/dist/src/components/Button/Button.stories.js +236 -51
- package/dist/src/components/Button/Button.test.js +2 -54
- package/dist/src/components/Button/IconButton.d.ts +33 -3
- package/dist/src/components/Button/IconButton.js +54 -5
- package/dist/src/components/Button/IconButton.stories.js +24 -12
- package/dist/src/components/Button/IconButton.test.js +7 -9
- package/dist/src/components/Button/index.d.ts +0 -7
- package/dist/src/components/Button/index.js +8 -15
- package/dist/src/components/Button/type.d.ts +0 -22
- package/dist/src/components/Button/type.js +25 -1
- package/dist/src/components/Checkbox/checkbox.stories.js +2 -2
- package/dist/src/components/ColorPicker/ColorPicker.js +6 -1
- package/dist/src/components/EditorTooltip/EditorTooltip.js +2 -3
- package/dist/src/components/Icons/LUIcon.d.ts +1 -1
- package/dist/src/components/Icons/LUIcon.js +10 -4
- package/dist/src/components/Icons/LUIcon.stories.d.ts +3 -1
- package/dist/src/components/Icons/LUIcon.stories.js +51 -20
- package/dist/src/components/Icons/index.d.ts +64 -1
- package/dist/src/components/Icons/index.js +84 -14
- package/dist/src/components/Icons/type.d.ts +7 -3
- package/dist/src/components/ImageUploader/ImageUploader.stories.d.ts +1 -1
- package/dist/src/components/ImageUploader/ImageUploader.stories.js +1 -1
- package/dist/src/components/ImageUploader/imageUploader.d.ts +3 -0
- package/dist/src/components/ImageUploader/imageUploader.js +68 -0
- package/dist/src/components/Label/Label.d.ts +14 -3
- package/dist/src/components/Label/Label.js +19 -5
- package/dist/src/components/Label/Label.stories.d.ts +1 -2
- package/dist/src/components/Label/Label.stories.js +10 -4
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme1.js +2 -3
- package/dist/src/components/MediaCard/ContactProfile/ContactProfileTheme2.js +2 -3
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme1.js +2 -3
- package/dist/src/components/MediaCard/PostByCategory/PostByCategoryTheme2.js +2 -3
- package/dist/src/components/ToolTip/Tooltip.d.ts +3 -0
- package/dist/src/components/ToolTip/Tooltip.js +8 -0
- package/dist/src/components/ToolTip/Tooltip.stories.d.ts +5 -0
- package/dist/src/components/ToolTip/Tooltip.stories.js +37 -0
- package/dist/src/components/ToolTip/type.d.ts +5 -0
- package/dist/src/components/ToolTip/type.js +1 -0
- package/dist/src/components/Typography/Body/Body.stories.d.ts +4 -0
- package/dist/src/components/Typography/Body/Body.stories.js +46 -0
- package/dist/src/components/Typography/Body/body.d.ts +35 -0
- package/dist/src/components/Typography/Body/body.js +61 -0
- package/dist/src/components/Typography/Caption/Caption.stories.d.ts +4 -0
- package/dist/src/components/Typography/Caption/Caption.stories.js +36 -0
- package/dist/src/components/Typography/Display/Display.stories.d.ts +4 -0
- package/dist/src/components/Typography/Display/Display.stories.js +36 -0
- package/dist/src/components/Typography/Display/display.d.ts +15 -0
- package/dist/src/components/Typography/Display/display.js +48 -0
- package/dist/src/components/Typography/Heading/Heading.stories.d.ts +4 -0
- package/dist/src/components/Typography/Heading/Heading.stories.js +36 -0
- package/dist/src/components/Typography/Heading/heading.d.ts +36 -0
- package/dist/src/components/Typography/Heading/heading.js +69 -0
- package/dist/src/components/Typography/Heading.d.ts +3 -0
- package/dist/src/components/Typography/Heading.js +29 -0
- package/dist/src/components/Typography/Heading.stories.d.ts +5 -0
- package/dist/src/components/Typography/Heading.stories.js +37 -0
- package/dist/src/components/Typography/type.d.ts +3 -3
- package/dist/src/components/ui/body.d.ts +0 -0
- package/dist/src/components/ui/body.js +1 -0
- package/dist/src/components/ui/caption.d.ts +8 -0
- package/dist/src/components/ui/caption.js +34 -0
- package/dist/src/components/ui/display.d.ts +15 -0
- package/dist/src/components/ui/display.js +48 -0
- package/dist/src/components/ui/heading.d.ts +36 -0
- package/dist/src/components/ui/heading.js +69 -0
- package/dist/src/components/ui/imageUploader.js +3 -3
- package/dist/src/components/ui/switch.js +2 -2
- package/dist/src/components/ui/typography.d.ts +1 -1
- package/dist/styles/global.css +145 -964
- package/package.json +2 -1
|
@@ -1,62 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import Button from "./Button";
|
|
4
|
-
import { buttonColors, buttonShapes, buttonSizes } from ".";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
5
3
|
import { Dummy_label } from "../../utils/constants";
|
|
4
|
+
import { Button } from "./Button";
|
|
6
5
|
describe("Button Component", function () {
|
|
7
6
|
it("renders default button component", function () {
|
|
8
|
-
render(_jsx(Button, { children: Dummy_label }));
|
|
9
|
-
var buttonElement = screen.getByRole("button", { name: Dummy_label });
|
|
10
|
-
expect(buttonElement).toBeInTheDocument();
|
|
11
|
-
expect(buttonElement).toHaveClass(buttonColors["primary"], buttonShapes["rounded-none"], buttonSizes["sm"]);
|
|
12
|
-
});
|
|
13
|
-
it("renders button with a custom label", function () {
|
|
14
|
-
render(_jsx(Button, { children: Dummy_label }));
|
|
15
|
-
expect(screen.getByRole("button", { name: Dummy_label })).toBeInTheDocument();
|
|
16
|
-
});
|
|
17
|
-
it("calls onClick handler when clicked", function () {
|
|
18
|
-
var handleClick = jest.fn();
|
|
19
|
-
render(_jsx(Button, { onClick: handleClick, children: "Click" }));
|
|
20
|
-
fireEvent.click(screen.getByRole("button"));
|
|
21
|
-
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
22
|
-
});
|
|
23
|
-
it("renders startIcon when provided", function () {
|
|
24
|
-
render(_jsx(Button, { startIcon: _jsx("span", { children: "*" }), children: Dummy_label }));
|
|
25
|
-
expect(screen.getByTestId("start-icon")).toBeInTheDocument();
|
|
26
|
-
});
|
|
27
|
-
it("renders endIcon when provided", function () {
|
|
28
|
-
render(_jsx(Button, { endIcon: _jsx("span", { children: "*" }), children: Dummy_label }));
|
|
29
|
-
expect(screen.getByTestId("end-icon")).toBeInTheDocument();
|
|
30
|
-
});
|
|
31
|
-
it("applies correct color, shape, and size classes", function () {
|
|
32
|
-
render(_jsx(Button, { color: "primary", shape: "rounded-lg", size: "lg", children: Dummy_label }));
|
|
33
|
-
var buttonElement = screen.getByRole("button");
|
|
34
|
-
expect(buttonElement).toHaveClass(buttonColors["primary"], buttonShapes["rounded-lg"], buttonSizes["lg"]);
|
|
35
|
-
});
|
|
36
|
-
it("applies additional className when provided", function () {
|
|
37
|
-
render(_jsx(Button, { className: "custom-class", children: Dummy_label }));
|
|
38
|
-
expect(screen.getByRole("button")).toHaveClass("custom-class");
|
|
39
|
-
});
|
|
40
|
-
it("renders without crashing when no props are provided", function () {
|
|
41
7
|
render(_jsx(Button, { children: Dummy_label }));
|
|
42
8
|
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
43
9
|
});
|
|
44
|
-
it("renders button with both startIcon and endIcon", function () {
|
|
45
|
-
render(_jsx(Button, { startIcon: _jsx("span", { children: "*" }), endIcon: _jsx("span", { children: "*" }), children: Dummy_label }));
|
|
46
|
-
expect(screen.getByTestId("start-icon")).toBeInTheDocument();
|
|
47
|
-
expect(screen.getByTestId("end-icon")).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
it("does not render startIcon when not provided", function () {
|
|
50
|
-
render(_jsx(Button, { children: Dummy_label }));
|
|
51
|
-
expect(screen.queryByTestId("start-icon")).not.toBeInTheDocument();
|
|
52
|
-
});
|
|
53
|
-
it("does not render endIcon when not provided", function () {
|
|
54
|
-
render(_jsx(Button, { children: Dummy_label }));
|
|
55
|
-
expect(screen.queryByTestId("end-icon")).not.toBeInTheDocument();
|
|
56
|
-
});
|
|
57
|
-
it("renders correctly without a className prop", function () {
|
|
58
|
-
render(_jsx(Button, { children: Dummy_label }));
|
|
59
|
-
var buttonElement = screen.getByRole("button");
|
|
60
|
-
expect(buttonElement).not.toHaveClass("custom-class");
|
|
61
|
-
});
|
|
62
10
|
});
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
export declare const color: {
|
|
4
|
+
blue: string;
|
|
5
|
+
"blue-light": string;
|
|
6
|
+
red: string;
|
|
7
|
+
"red-light": string;
|
|
8
|
+
green: string;
|
|
9
|
+
yellow: string;
|
|
10
|
+
indigo: string;
|
|
11
|
+
gray: string;
|
|
12
|
+
"light-gray": string;
|
|
13
|
+
};
|
|
14
|
+
export declare const size: {
|
|
15
|
+
xl: string;
|
|
16
|
+
lg: string;
|
|
17
|
+
md: string;
|
|
18
|
+
sm: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const shape: {
|
|
21
|
+
"rounded-sm": string;
|
|
22
|
+
"rounded-full": string;
|
|
23
|
+
};
|
|
24
|
+
declare const buttonVariants: (props?: ({
|
|
25
|
+
color?: "blue" | "green" | "yellow" | "red" | "indigo" | "gray" | "blue-light" | "red-light" | "light-gray" | null | undefined;
|
|
26
|
+
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
27
|
+
shape?: "rounded-full" | "rounded-sm" | null | undefined;
|
|
28
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
29
|
+
declare function IconButton({ className, color, size, shape, asChild, icon, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
30
|
+
asChild?: boolean;
|
|
31
|
+
icon?: string;
|
|
32
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export { IconButton, buttonVariants };
|
|
@@ -21,10 +21,59 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import {
|
|
24
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
25
|
+
import { cva } from "class-variance-authority";
|
|
26
|
+
import { cn } from "../../lib/utils";
|
|
25
27
|
import LUIcon from "../Icons/LUIcon";
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
export var color = {
|
|
29
|
+
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",
|
|
30
|
+
"blue-light": "bg-blue-100 text-blue-600 hover:bg-blue-700 hover:text-blue-50 active:bg-blue-800 active:text-blue-50",
|
|
31
|
+
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",
|
|
32
|
+
"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",
|
|
33
|
+
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",
|
|
34
|
+
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",
|
|
35
|
+
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",
|
|
36
|
+
gray: "bg-gray-50 text-gray-950 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
|
|
37
|
+
"light-gray": "bg-gray-900 text-gray-50 hover:bg-gray-100 focus-visible:bg-gray-50 active:bg-gray-300",
|
|
29
38
|
};
|
|
30
|
-
export
|
|
39
|
+
export var size = {
|
|
40
|
+
xl: "!p-3.5",
|
|
41
|
+
lg: "!p-3",
|
|
42
|
+
md: "!p-2.5",
|
|
43
|
+
sm: "!p-2.5",
|
|
44
|
+
};
|
|
45
|
+
export var shape = {
|
|
46
|
+
"rounded-sm": "!rounded-sm",
|
|
47
|
+
"rounded-full": "!rounded-full",
|
|
48
|
+
};
|
|
49
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 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", {
|
|
50
|
+
variants: {
|
|
51
|
+
color: color,
|
|
52
|
+
size: size,
|
|
53
|
+
shape: shape,
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
color: "blue",
|
|
57
|
+
size: "md",
|
|
58
|
+
shape: "rounded-sm",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
function IconButton(_a) {
|
|
62
|
+
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"]);
|
|
63
|
+
var Comp = asChild ? Slot : "button";
|
|
64
|
+
// Map button size to appropriate icon sizes for the icon
|
|
65
|
+
var getIconSize = function () {
|
|
66
|
+
if (size === "xl" || size === "lg") {
|
|
67
|
+
return "xl";
|
|
68
|
+
}
|
|
69
|
+
else if (size === "md") {
|
|
70
|
+
return "lg";
|
|
71
|
+
}
|
|
72
|
+
else if (size === "sm") {
|
|
73
|
+
return "md";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var iconSize = getIconSize();
|
|
77
|
+
return (_jsx(Comp, __assign({ "data-slot": "button", className: cn(buttonVariants({ color: color, size: size, shape: shape, className: className })) }, props, { children: _jsx(LUIcon, { size: iconSize, "data-testid": "icon", icon: icon !== null && icon !== void 0 ? icon : "" }) })));
|
|
78
|
+
}
|
|
79
|
+
export { IconButton, buttonVariants };
|
|
@@ -10,44 +10,56 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import IconButton from "./IconButton";
|
|
13
|
+
import { color, IconButton, shape, size } from "./IconButton";
|
|
14
|
+
import { iconList } from "../../utils/iconList";
|
|
16
15
|
export default {
|
|
17
16
|
title: "Components/Button/IconButton",
|
|
18
17
|
component: IconButton,
|
|
19
18
|
tags: ["autodocs"],
|
|
20
19
|
};
|
|
21
|
-
var Template = function (args) { return (_jsx(IconButton, __assign({ icon:
|
|
20
|
+
var Template = function (args) { return (_jsx(IconButton, __assign({ icon: "chart-simple", size: "md" }, args))); };
|
|
22
21
|
export var _IconButton = Template.bind({});
|
|
23
22
|
_IconButton.args = {
|
|
24
|
-
icon:
|
|
23
|
+
icon: "chart-simple",
|
|
25
24
|
};
|
|
26
25
|
_IconButton.argTypes = {
|
|
27
26
|
color: {
|
|
28
27
|
control: {
|
|
29
28
|
type: "select",
|
|
30
|
-
labels: Object.keys(
|
|
29
|
+
labels: Object.keys(color),
|
|
31
30
|
},
|
|
32
|
-
options: Object.keys(
|
|
31
|
+
options: Object.keys(color),
|
|
33
32
|
},
|
|
34
33
|
shape: {
|
|
35
34
|
control: {
|
|
36
35
|
type: "select",
|
|
37
|
-
labels: Object.keys(
|
|
36
|
+
labels: Object.keys(shape),
|
|
37
|
+
},
|
|
38
|
+
options: Object.keys(shape),
|
|
39
|
+
description: "Select the shape of the button",
|
|
40
|
+
table: {
|
|
41
|
+
defaultValue: { summary: "rounded-sm" },
|
|
42
|
+
type: { summary: "string" },
|
|
38
43
|
},
|
|
39
|
-
options: Object.keys(buttonShapes),
|
|
40
44
|
},
|
|
41
45
|
size: {
|
|
42
46
|
control: {
|
|
43
47
|
type: "select",
|
|
44
|
-
labels: Object.keys(
|
|
48
|
+
labels: Object.keys(size),
|
|
45
49
|
},
|
|
46
|
-
options: Object.keys(
|
|
50
|
+
options: Object.keys(size),
|
|
47
51
|
description: "Select the size of the button",
|
|
52
|
+
table: {
|
|
53
|
+
defaultValue: { summary: "md" },
|
|
54
|
+
type: { summary: "string" },
|
|
55
|
+
},
|
|
48
56
|
},
|
|
49
57
|
icon: {
|
|
50
|
-
control:
|
|
58
|
+
control: {
|
|
59
|
+
type: "select",
|
|
60
|
+
labels: Object.fromEntries(iconList.map(function (icon) { return [icon.key, icon.label]; })),
|
|
61
|
+
},
|
|
62
|
+
options: iconList.map(function (icon) { return icon.key; }),
|
|
51
63
|
description: "Icon (React component)",
|
|
52
64
|
},
|
|
53
65
|
};
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
3
|
-
import {
|
|
4
|
-
import LUIcon from "../Icons/LUIcon";
|
|
5
|
-
import IconButton from "./IconButton";
|
|
3
|
+
import { color, IconButton, shape, size } from "./IconButton";
|
|
6
4
|
describe("Icon Button Component", function () {
|
|
7
5
|
it("renders icon button with required icon prop", function () {
|
|
8
|
-
render(_jsx(IconButton, { icon:
|
|
6
|
+
render(_jsx(IconButton, { icon: "chart-simple" }));
|
|
9
7
|
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
10
8
|
});
|
|
11
9
|
it("calls onClick handler when clicked", function () {
|
|
12
10
|
var handleClick = jest.fn();
|
|
13
|
-
render(_jsx(IconButton, { onClick: handleClick, icon:
|
|
11
|
+
render(_jsx(IconButton, { onClick: handleClick, icon: "chart-simple" }));
|
|
14
12
|
fireEvent.click(screen.getByRole("button"));
|
|
15
13
|
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
16
14
|
});
|
|
17
15
|
it("applies correct color, shape, and size classes", function () {
|
|
18
|
-
render(_jsx(IconButton, { color: "
|
|
16
|
+
render(_jsx(IconButton, { color: "blue", shape: "rounded-full", size: "lg", icon: "chart-simple" }));
|
|
19
17
|
var buttonElement = screen.getByRole("button");
|
|
20
|
-
expect(buttonElement).toHaveClass(
|
|
18
|
+
expect(buttonElement).toHaveClass(color["blue"], shape["rounded-full"], size["lg"]);
|
|
21
19
|
});
|
|
22
20
|
it("applies additional className when provided", function () {
|
|
23
|
-
render(_jsx(IconButton, { className: "custom-class", icon:
|
|
21
|
+
render(_jsx(IconButton, { className: "custom-class", icon: "chart-simple" }));
|
|
24
22
|
expect(screen.getByRole("button")).toHaveClass("custom-class");
|
|
25
23
|
});
|
|
26
24
|
it("renders without crashing when all required props are provided", function () {
|
|
27
|
-
render(_jsx(IconButton, { icon:
|
|
25
|
+
render(_jsx(IconButton, { icon: "chart-simple" }));
|
|
28
26
|
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
29
27
|
});
|
|
30
28
|
});
|
|
@@ -14,14 +14,7 @@ export declare const buttonColors: {
|
|
|
14
14
|
"gray-outline": string;
|
|
15
15
|
};
|
|
16
16
|
export declare const buttonShapes: {
|
|
17
|
-
"rounded-none": string;
|
|
18
|
-
"rounded-xs": string;
|
|
19
17
|
"rounded-sm": string;
|
|
20
|
-
"rounded-md": string;
|
|
21
|
-
"rounded-lg": string;
|
|
22
|
-
"rounded-xl": string;
|
|
23
|
-
"rounded-2xl": string;
|
|
24
|
-
"rounded-3xl": string;
|
|
25
18
|
"rounded-full": string;
|
|
26
19
|
};
|
|
27
20
|
export declare const buttonSizes: {
|
|
@@ -14,26 +14,19 @@ export var buttonColors = {
|
|
|
14
14
|
"gray-outline": "text-gray-50 border-2 border-gray-50 bg-white hover:border-gray-100 hover:text-gray-100 focus:border-gray-50 focus:text-gray-50 active:border-gray-300 active:text-gray-300",
|
|
15
15
|
};
|
|
16
16
|
export var buttonShapes = {
|
|
17
|
-
"rounded-
|
|
18
|
-
"rounded-xs": "rounded-sm",
|
|
19
|
-
"rounded-sm": "rounded",
|
|
20
|
-
"rounded-md": "rounded-md",
|
|
21
|
-
"rounded-lg": "rounded-lg",
|
|
22
|
-
"rounded-xl": "rounded-xl",
|
|
23
|
-
"rounded-2xl": "rounded-2xl",
|
|
24
|
-
"rounded-3xl": "rounded-3xl",
|
|
17
|
+
"rounded-sm": "!rounded-sm",
|
|
25
18
|
"rounded-full": "!rounded-full",
|
|
26
19
|
};
|
|
27
20
|
export var buttonSizes = {
|
|
28
|
-
sm: "py-2 px-3 text-
|
|
29
|
-
md: "py-2 px-
|
|
30
|
-
lg: "py-3 px-5 text-
|
|
31
|
-
xl: "py-
|
|
21
|
+
sm: "!py-2 !px-3 text-sm font-normal leading-5",
|
|
22
|
+
md: "!py-2.5 !px-5 text-sm font-normal leading-5",
|
|
23
|
+
lg: "!py-3 !px-5 text-base font-normal leading-normal",
|
|
24
|
+
xl: "!py-3.5 !px-6 text-base font-normal leading-normal",
|
|
32
25
|
};
|
|
33
26
|
export var iconButtonSize = {
|
|
34
27
|
xs: "!p-1",
|
|
35
|
-
sm: "p-2",
|
|
36
|
-
md: "p-2",
|
|
28
|
+
sm: "!p-2",
|
|
29
|
+
md: "!p-2",
|
|
37
30
|
lg: "!p-3",
|
|
38
|
-
xl: "p-5",
|
|
31
|
+
xl: "!p-5",
|
|
39
32
|
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { buttonShapes, buttonSizes, buttonColors, iconButtonSize } from ".";
|
|
3
|
-
type colors = keyof typeof buttonColors;
|
|
4
|
-
type buttonShapes = keyof typeof buttonShapes;
|
|
5
|
-
type buttonSizes = keyof typeof buttonSizes;
|
|
6
|
-
type iconButtonSize = keyof typeof iconButtonSize;
|
|
7
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
8
|
-
color?: colors;
|
|
9
|
-
size?: buttonSizes;
|
|
10
|
-
startIcon?: React.ReactNode;
|
|
11
|
-
endIcon?: React.ReactNode;
|
|
12
|
-
shape?: buttonShapes;
|
|
13
|
-
className?: string;
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
17
|
-
color?: colors;
|
|
18
|
-
size?: iconButtonSize;
|
|
19
|
-
shape?: buttonShapes;
|
|
20
|
-
icon: React.ReactNode;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// import React from "react";
|
|
3
|
+
// import { buttonShapes, buttonSizes, buttonColors, iconButtonSize } from ".";
|
|
4
|
+
// type colors = keyof typeof buttonColors;
|
|
5
|
+
// type buttonShapes = keyof typeof buttonShapes;
|
|
6
|
+
// type buttonSizes = keyof typeof buttonSizes;
|
|
7
|
+
// type iconButtonSize = keyof typeof iconButtonSize;
|
|
8
|
+
// export interface ButtonProps
|
|
9
|
+
// extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
// color?: colors;
|
|
11
|
+
// size?: buttonSizes;
|
|
12
|
+
// startIcon?: string;
|
|
13
|
+
// endIcon?: string;
|
|
14
|
+
// shape?: buttonShapes;
|
|
15
|
+
// variant?: "default" | "link";
|
|
16
|
+
// className?: string;
|
|
17
|
+
// children: React.ReactNode;
|
|
18
|
+
// }
|
|
19
|
+
// export interface IconButtonProps
|
|
20
|
+
// extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
21
|
+
// color?: colors;
|
|
22
|
+
// size?: iconButtonSize;
|
|
23
|
+
// shape?: buttonShapes;
|
|
24
|
+
// icon: React.ReactNode;
|
|
25
|
+
// }
|
|
@@ -11,8 +11,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Checkbox } from "../ui/checkbox";
|
|
14
|
-
import { Label } from "../
|
|
15
|
-
import Button from "../Button/Button";
|
|
14
|
+
import { Label } from "../Label/Label";
|
|
15
|
+
import { Button } from "../Button/Button";
|
|
16
16
|
var meta = {
|
|
17
17
|
title: "components/Checkbox",
|
|
18
18
|
component: Checkbox,
|
|
@@ -45,10 +45,15 @@ var ColorPicker = function (_a) {
|
|
|
45
45
|
var formattedColor = newColor.startsWith("#") ? newColor : "#".concat(newColor);
|
|
46
46
|
setHexColor(formattedColor); // Set the local state immediately
|
|
47
47
|
};
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
if (value !== hexColor) {
|
|
50
|
+
setHexColor(value);
|
|
51
|
+
}
|
|
52
|
+
}, [value]);
|
|
48
53
|
// Trigger onChange callback only when debounced value updates
|
|
49
54
|
useEffect(function () {
|
|
50
55
|
onChange(debouncedHexColor); // Trigger onChange with debounced value
|
|
51
|
-
}, [debouncedHexColor
|
|
56
|
+
}, [debouncedHexColor]);
|
|
52
57
|
// Handle hex input change
|
|
53
58
|
var handleHexChange = function (e) {
|
|
54
59
|
var inputValue = e.target.value;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../ui/tooltip";
|
|
3
|
-
import IconButton from "../Button/IconButton";
|
|
4
|
-
import LUIcon from "../Icons/LUIcon";
|
|
3
|
+
import { IconButton } from "../Button/IconButton";
|
|
5
4
|
var EditorTooltip = function (_a) {
|
|
6
5
|
var title = _a.title, className = _a.className;
|
|
7
|
-
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: className, children: _jsx(IconButton, { icon:
|
|
6
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: className, children: _jsx(IconButton, { icon: "question", size: "sm", shape: "rounded-full", color: "blue-light" }) }), _jsx(TooltipContent, { children: _jsx("div", { className: "text-base w-48 text-center font-medium", children: title }) })] }) }));
|
|
8
7
|
};
|
|
9
8
|
export default EditorTooltip;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IconProps } from "./type";
|
|
2
|
-
declare const LUIcon: ({ size, icon, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const LUIcon: ({ size, icon, variant, shape, className, color, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default LUIcon;
|
|
@@ -20,13 +20,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { iconList } from "../../utils/iconList";
|
|
25
|
-
import { iconSize } from ".";
|
|
25
|
+
import { getAppliedColor, iconBackground, IconShape, iconSize } from ".";
|
|
26
26
|
var LUIcon = function (_a) {
|
|
27
27
|
var _b;
|
|
28
|
-
var _c = _a.size, size = _c === void 0 ? "md" : _c, icon = _a.icon, className = _a.className, props = __rest(_a, ["size", "icon", "className"]);
|
|
28
|
+
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"]);
|
|
29
29
|
var selectedIcon = iconList.find(function (item) { return item.key === icon; });
|
|
30
|
-
|
|
30
|
+
var paddingIcon = iconBackground[size];
|
|
31
|
+
var colorClass = variant === "default" ? getAppliedColor(variant, color) : "";
|
|
32
|
+
var svg = (_jsxs("svg", __assign({ role: "img", "data-testid": "lu-icon", className: "".concat(iconSize[size], " ").concat(variant !== "padded" ? className : "", " ").concat(colorClass), viewBox: "0 0 32 32", fill: "currentColor" }, props, { children: [_jsx("g", { clipPath: "url(#clip0_9168_14965)", children: _jsx("path", { "data-testid": "lu-path", d: (_b = selectedIcon === null || selectedIcon === void 0 ? void 0 : selectedIcon.path) !== null && _b !== void 0 ? _b : "" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_9168_14965", children: _jsx("rect", { width: "32", height: "32" }) }) })] })));
|
|
33
|
+
if (variant === "padded") {
|
|
34
|
+
return (_jsx("div", { className: "inline-flex items-center justify-center ".concat(paddingIcon, " ").concat(shape === "rounded" ? IconShape.rounded : IconShape.square[size], " ").concat(className, " ").concat(getAppliedColor(variant, color)), children: svg }));
|
|
35
|
+
}
|
|
36
|
+
return svg;
|
|
31
37
|
};
|
|
32
38
|
export default LUIcon;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
|
+
import { IconProps } from "./type";
|
|
2
3
|
declare const _default: Meta;
|
|
3
4
|
export default _default;
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const _DefaultIcon: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IconProps>;
|
|
6
|
+
export declare const _PaddedIcon: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IconProps>;
|
|
@@ -12,33 +12,64 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { iconList } from "../../utils/iconList";
|
|
14
14
|
import LUIcon from "./LUIcon";
|
|
15
|
-
import { iconSize } from ".";
|
|
15
|
+
import { iconColor, IconShape, iconSize, iconWithBgColor } from ".";
|
|
16
16
|
export default {
|
|
17
17
|
title: "Components/Icon",
|
|
18
18
|
component: LUIcon,
|
|
19
19
|
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
size: {
|
|
22
|
+
control: { type: "select" },
|
|
23
|
+
options: Object.keys(iconSize),
|
|
24
|
+
description: "Size of the icon",
|
|
25
|
+
},
|
|
26
|
+
icon: {
|
|
27
|
+
control: { type: "select" },
|
|
28
|
+
options: iconList.map(function (icon) { return icon.key; }),
|
|
29
|
+
description: "Icon to display",
|
|
30
|
+
},
|
|
31
|
+
variant: {
|
|
32
|
+
control: { type: "select" },
|
|
33
|
+
options: ["default", "padded"],
|
|
34
|
+
description: "Type of the icon",
|
|
35
|
+
},
|
|
36
|
+
shape: {
|
|
37
|
+
control: { type: "select" },
|
|
38
|
+
options: Object.keys(IconShape),
|
|
39
|
+
description: "Shape of the padded icon",
|
|
40
|
+
if: { arg: "variant", eq: "padded" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
20
43
|
};
|
|
21
|
-
var Template = function (args) { return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
var Template = function (args) { return _jsx(LUIcon, __assign({}, args)); };
|
|
45
|
+
// Default Icon Story
|
|
46
|
+
export var _DefaultIcon = Template.bind({});
|
|
47
|
+
_DefaultIcon.args = {
|
|
48
|
+
size: "md",
|
|
25
49
|
icon: iconList[0].key,
|
|
50
|
+
color: "blue",
|
|
51
|
+
variant: "default",
|
|
26
52
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
control: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
options: Object.keys(iconSize),
|
|
34
|
-
defaultValue: "xxs",
|
|
53
|
+
_DefaultIcon.argTypes = {
|
|
54
|
+
color: {
|
|
55
|
+
control: { type: "select" },
|
|
56
|
+
options: Object.keys(iconColor),
|
|
57
|
+
description: "Text color (no background)",
|
|
35
58
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
};
|
|
60
|
+
// Padded Icon Story
|
|
61
|
+
export var _PaddedIcon = Template.bind({});
|
|
62
|
+
_PaddedIcon.args = {
|
|
63
|
+
size: "md",
|
|
64
|
+
icon: iconList[0].key,
|
|
65
|
+
variant: "padded",
|
|
66
|
+
color: "blue",
|
|
67
|
+
shape: "square",
|
|
68
|
+
};
|
|
69
|
+
_PaddedIcon.argTypes = {
|
|
70
|
+
color: {
|
|
71
|
+
control: { type: "select" },
|
|
72
|
+
options: Object.keys(iconWithBgColor),
|
|
73
|
+
description: "Background color for padded variant",
|
|
43
74
|
},
|
|
44
75
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const iconSize: {
|
|
2
|
-
xxs: string;
|
|
3
2
|
xs: string;
|
|
4
3
|
sm: string;
|
|
5
4
|
md: string;
|
|
@@ -14,3 +13,67 @@ export declare const iconSize: {
|
|
|
14
13
|
huge: string;
|
|
15
14
|
massive: string;
|
|
16
15
|
};
|
|
16
|
+
export declare const iconBackground: {
|
|
17
|
+
xs: string;
|
|
18
|
+
sm: string;
|
|
19
|
+
md: string;
|
|
20
|
+
lg: string;
|
|
21
|
+
xl: string;
|
|
22
|
+
"2xl": string;
|
|
23
|
+
"3xl": string;
|
|
24
|
+
"4xl": string;
|
|
25
|
+
"5xl": string;
|
|
26
|
+
"6xl": string;
|
|
27
|
+
"7xl": string;
|
|
28
|
+
huge: string;
|
|
29
|
+
massive: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const IconShape: {
|
|
32
|
+
square: {
|
|
33
|
+
xs: string;
|
|
34
|
+
sm: string;
|
|
35
|
+
md: string;
|
|
36
|
+
lg: string;
|
|
37
|
+
xl: string;
|
|
38
|
+
"2xl": string;
|
|
39
|
+
"3xl": string;
|
|
40
|
+
"4xl": string;
|
|
41
|
+
"5xl": string;
|
|
42
|
+
"6xl": string;
|
|
43
|
+
"7xl": string;
|
|
44
|
+
huge: string;
|
|
45
|
+
massive: string;
|
|
46
|
+
};
|
|
47
|
+
rounded: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const iconWithBgColor: {
|
|
50
|
+
blue: string;
|
|
51
|
+
"light-blue": string;
|
|
52
|
+
green: string;
|
|
53
|
+
"light-green": string;
|
|
54
|
+
yellow: string;
|
|
55
|
+
"light-yellow": string;
|
|
56
|
+
red: string;
|
|
57
|
+
"light-red": string;
|
|
58
|
+
indigo: string;
|
|
59
|
+
"light-indigo": string;
|
|
60
|
+
gray: string;
|
|
61
|
+
"dark-gray": string;
|
|
62
|
+
disabled: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const iconColor: {
|
|
65
|
+
blue: string;
|
|
66
|
+
"light-blue": string;
|
|
67
|
+
green: string;
|
|
68
|
+
"light-green": string;
|
|
69
|
+
yellow: string;
|
|
70
|
+
"light-yellow": string;
|
|
71
|
+
red: string;
|
|
72
|
+
"light-red": string;
|
|
73
|
+
indigo: string;
|
|
74
|
+
"light-indigo": string;
|
|
75
|
+
gray: string;
|
|
76
|
+
"dark-gray": string;
|
|
77
|
+
disabled: string;
|
|
78
|
+
};
|
|
79
|
+
export declare const getAppliedColor: (variant: string, color?: keyof typeof iconWithBgColor) => string;
|