linkedunion-design-kit 1.5.0 → 1.5.2
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/.next/types/app/page.js +17 -7
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +1 -1
- package/dist/components/Avatar/Avatar.stories.js +4 -4
- package/dist/components/Avatar/Avatar.test.d.ts +1 -0
- package/dist/components/Avatar/Avatar.test.js +54 -0
- package/dist/components/Border/BorderRadius/BorderRadius.stories.d.ts +1 -1
- package/dist/components/Border/BorderRadius/BorderRadius.stories.js +4 -4
- package/dist/components/Border/BorderRadius/BorderRadius.test.d.ts +1 -0
- package/dist/components/Border/BorderRadius/BorderRadius.test.js +25 -0
- package/dist/components/Border/BorderWidth/BorderWidth.stories.d.ts +1 -1
- package/dist/components/Border/BorderWidth/BorderWidth.stories.js +4 -4
- package/dist/components/Border/BorderWidth/BorderWidth.test.d.ts +1 -0
- package/dist/components/Border/BorderWidth/BorderWidth.test.js +25 -0
- package/dist/components/Button/Button.js +5 -5
- package/dist/components/Button/Button.stories.d.ts +1 -1
- package/dist/components/Button/Button.stories.js +8 -8
- package/dist/components/Button/Button.test.d.ts +1 -0
- package/dist/components/Button/Button.test.js +54 -0
- package/dist/components/Button/index.js +0 -1
- package/dist/components/Color/BackgroundColor/BackgroundColor.js +7 -3
- package/dist/components/Color/BackgroundColor/BackgroundColor.stories.d.ts +6 -6
- package/dist/components/Color/BackgroundColor/BackgroundColor.stories.js +33 -30
- package/dist/components/Color/BackgroundColor/BackgroundColor.test.d.ts +1 -0
- package/dist/components/Color/BackgroundColor/BackgroundColor.test.js +17 -0
- package/dist/components/Color/Color.test.d.ts +1 -0
- package/dist/components/Color/Color.test.js +38 -0
- package/dist/components/Color/TextColor/TextColor.js +7 -3
- package/dist/components/Color/TextColor/TextColor.stories.d.ts +1 -1
- package/dist/components/Color/TextColor/TextColor.stories.js +14 -11
- package/dist/components/Color/TextColor/TextColor.test.d.ts +1 -0
- package/dist/components/Color/TextColor/TextColor.test.js +43 -0
- package/dist/components/Icons/IconList.test.d.ts +1 -0
- package/dist/components/Icons/IconList.test.js +60 -0
- package/dist/components/Icons/IconView.js +1 -1
- package/dist/components/Icons/IconView.stories.d.ts +1 -1
- package/dist/components/Icons/IconView.stories.js +2 -2
- package/dist/components/Icons/LUIcon.js +1 -1
- package/dist/components/Icons/LUIcon.stories.d.ts +1 -1
- package/dist/components/Icons/LUIcon.stories.js +4 -4
- package/dist/components/Icons/SingleIcon.test.d.ts +1 -0
- package/dist/components/Icons/SingleIcon.test.js +53 -0
- package/dist/components/Images/LuImage.js +1 -1
- package/dist/components/Images/LuImage.stories.d.ts +1 -1
- package/dist/components/Images/LuImage.stories.js +11 -10
- package/dist/components/Images/LuImage.test.d.ts +1 -0
- package/dist/components/Images/LuImage.test.js +68 -0
- package/dist/components/MediaCard/Card.js +3 -3
- package/dist/components/MediaCard/Card.stories.d.ts +1 -1
- package/dist/components/MediaCard/Card.stories.js +4 -4
- package/dist/components/MediaCard/Card.test.d.ts +1 -0
- package/dist/components/MediaCard/Card.test.js +33 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfile.test.d.ts +1 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfile.test.js +57 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme1.js +1 -1
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme1.test.d.ts +1 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme1.test.js +122 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme2.js +1 -1
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme2.test.d.ts +1 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme2.test.js +122 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategory.js +1 -1
- package/dist/components/MediaCard/PostByCategory/PostByCategory.test.d.ts +1 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategory.test.js +57 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme1.js +1 -1
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.d.ts +1 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme1.test.js +122 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme2.js +1 -1
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.d.ts +1 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme2.test.js +122 -0
- package/dist/components/MediaCard/index.js +0 -1
- package/dist/components/Size/MinWidthHeight.d.ts +1 -1
- package/dist/components/Size/MinWidthHeight.stories.d.ts +1 -1
- package/dist/components/Size/MinWidthHeight.stories.js +4 -4
- package/dist/components/Size/MinWidthHeight.test.d.ts +1 -0
- package/dist/components/Size/MinWidthHeight.test.js +34 -0
- package/dist/components/Size/Size.d.ts +3 -2
- package/dist/components/Size/Size.js +5 -3
- package/dist/components/Size/Size.stories.d.ts +3 -2
- package/dist/components/Size/Size.stories.js +3 -6
- package/dist/components/Size/Size.test.d.ts +1 -0
- package/dist/components/Size/Size.test.js +73 -0
- package/dist/components/Size/WidthAndHeight.test.d.ts +1 -0
- package/dist/components/Size/WidthAndHeight.test.js +34 -0
- package/dist/components/Size/WidthHeight.stories.d.ts +1 -1
- package/dist/components/Size/WidthHeight.stories.js +4 -4
- package/dist/components/Spacing/Margin/MarginToken.stories.d.ts +1 -1
- package/dist/components/Spacing/Margin/MarginToken.stories.js +2 -2
- package/dist/components/Spacing/Margin/MarginToken.test.d.ts +1 -0
- package/dist/components/Spacing/Margin/MarginToken.test.js +22 -0
- package/dist/components/Spacing/Padding/PaddingToken.stories.d.ts +1 -1
- package/dist/components/Spacing/Padding/PaddingToken.stories.js +2 -2
- package/dist/components/Spacing/Padding/PaddingToken.test.d.ts +1 -0
- package/dist/components/Spacing/Padding/PaddingToken.test.js +22 -0
- package/dist/components/Title/Title.d.ts +1 -1
- package/dist/components/Title/Title.stories.d.ts +1 -1
- package/dist/components/Title/Title.test.js +7 -6
- package/dist/components/Typography/Body/Body.stories.d.ts +1 -1
- package/dist/components/Typography/Body/body.test.js +24 -19
- package/dist/components/Typography/Display/Display.stories.d.ts +1 -1
- package/dist/components/Typography/Display/Display.test.js +24 -19
- package/dist/components/Typography/Headings/Headings.stories.d.ts +1 -1
- package/dist/components/Typography/Typography.css +16 -2
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/Typography.stories.d.ts +1 -1
- package/dist/components/Typography/Typography.test.d.ts +1 -0
- package/dist/components/Typography/Typography.test.js +42 -0
- package/dist/global/components/Table/Table.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/jest.config.d.ts +1 -0
- package/dist/jest.config.js +33 -0
- package/dist/jest.setup.d.ts +4 -0
- package/dist/jest.setup.js +35 -0
- package/dist/styles/global.css +16 -2
- package/dist/tailwind.config.js +14 -15
- package/dist/utils/iconList.js +8 -8
- package/dist/utils/index.d.ts +8 -8
- package/dist/utils/index.js +15 -19
- package/package.json +40 -14
- package/dist/components/Color/BackgroundColor/Color.d.ts +0 -2
- package/dist/components/Color/BackgroundColor/Color.js +0 -9
- package/dist/components/Color/BackgroundColor/Color.stories.d.ts +0 -10
- package/dist/components/Color/BackgroundColor/Color.stories.js +0 -103
- package/dist/components/Color/TextColor.d.ts +0 -3
- package/dist/components/Color/TextColor.js +0 -9
- package/dist/components/Color/TextColor.stories.d.ts +0 -6
- package/dist/components/Color/TextColor.stories.js +0 -35
- package/dist/components/Images/index.d.ts +0 -4
- package/dist/components/Images/index.js +0 -6
- package/dist/utils/enum.d.ts +0 -25
- package/dist/utils/enum.js +0 -25
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
// File: /Users/avialdosolutions/linkedunion-design-kit/linkedunion-design-kit/app/page.tsx
|
|
27
37
|
var entry = __importStar(require("../../../app/page.js"));
|
|
@@ -10,6 +10,6 @@ var utils_1 = require("../../utils");
|
|
|
10
10
|
var Avatar = function (_a) {
|
|
11
11
|
var image = _a.image, _b = _a.icon, icon = _b === void 0 ? "user" : _b, shape = _a.shape, size = _a.size, className = _a.className;
|
|
12
12
|
var defaultIcon = iconList_1.iconList.find(function (item) { return item.key === (icon || "user"); });
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "".concat(image ? "lu-bg-primary-200" : "lu-bg-gray-100", " flex items-center justify-center ").concat(shape, " overflow-hidden ").concat(className), style: (0, utils_1.
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "".concat(image ? "lu-bg-primary-200" : "lu-bg-gray-100", " flex items-center justify-center ").concat(shape, " overflow-hidden ").concat(className), style: (0, utils_1.avatarBackgroundSize)(size), "data-testid": "lu-avatar", children: image ? ((0, jsx_runtime_1.jsx)("img", { src: image, alt: "image", className: "w-full h-full object-cover" })) : ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: size, icon: defaultIcon === null || defaultIcon === void 0 ? void 0 : defaultIcon.key, fill: "lu-neutral-icon-dark", className: "" })) }) }));
|
|
14
14
|
};
|
|
15
15
|
exports.default = Avatar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const _Avatar: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react").Args>;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports._Avatar = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var utils_1 = require("../../utils");
|
|
20
20
|
var Avatar_1 = __importDefault(require("./Avatar"));
|
|
@@ -23,15 +23,15 @@ exports.default = {
|
|
|
23
23
|
component: Avatar_1.default,
|
|
24
24
|
};
|
|
25
25
|
var Template = function (args) { return (0, jsx_runtime_1.jsx)(Avatar_1.default, __assign({}, args)); };
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
26
|
+
exports._Avatar = Template.bind({});
|
|
27
|
+
exports._Avatar.args = {
|
|
28
28
|
image: "/images/avatar.png",
|
|
29
29
|
shape: "square",
|
|
30
30
|
size: "lu-avatar-massive",
|
|
31
31
|
className: "",
|
|
32
32
|
icon: "user",
|
|
33
33
|
};
|
|
34
|
-
exports.
|
|
34
|
+
exports._Avatar.argTypes = {
|
|
35
35
|
shape: {
|
|
36
36
|
control: {
|
|
37
37
|
type: "select",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
var react_1 = require("@testing-library/react");
|
|
8
|
+
var Avatar_1 = __importDefault(require("./Avatar"));
|
|
9
|
+
jest.mock("../Icons/LUIcon", function () { return ({
|
|
10
|
+
__esModule: true,
|
|
11
|
+
default: jest.fn(function () { return (0, jsx_runtime_1.jsx)("div", { "data-testid": "mock-luIcon", children: "user" }); }),
|
|
12
|
+
}); });
|
|
13
|
+
describe("Avatar Component", function () {
|
|
14
|
+
it("renders an image when image prop is provided", function () {
|
|
15
|
+
var testImage = "/images/avatar.png";
|
|
16
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, { image: testImage }));
|
|
17
|
+
var img = react_1.screen.getByRole("img");
|
|
18
|
+
expect(img).toHaveAttribute("src", testImage);
|
|
19
|
+
expect(img).toHaveAttribute("alt", "image");
|
|
20
|
+
});
|
|
21
|
+
it("renders default icon when no image is provided", function () {
|
|
22
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, {}));
|
|
23
|
+
var iconDiv = react_1.screen.getByTestId("mock-luIcon");
|
|
24
|
+
expect(iconDiv.textContent).toBe("user");
|
|
25
|
+
});
|
|
26
|
+
it("renders with default icon when no icon prop is provided and no image is present", function () {
|
|
27
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, {}));
|
|
28
|
+
var icon = react_1.screen.getByTestId("mock-luIcon");
|
|
29
|
+
expect(icon.textContent).toBe("user");
|
|
30
|
+
});
|
|
31
|
+
it("renders default icon when provided icon does not exist in the list", function () {
|
|
32
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, { icon: "" }));
|
|
33
|
+
var icon = react_1.screen.getByTestId("mock-luIcon");
|
|
34
|
+
expect(icon.textContent).toBe("user"); // Assuming 'user' is the fallback when the icon is not found
|
|
35
|
+
});
|
|
36
|
+
it("renders default icon when no icon and no image are provided", function () {
|
|
37
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, {}));
|
|
38
|
+
var icon = react_1.screen.getByTestId("mock-luIcon");
|
|
39
|
+
expect(icon).toBeInTheDocument(); // Ensure the icon is in the document
|
|
40
|
+
expect(icon.textContent).toBe("user"); // Check that the default icon is 'user'
|
|
41
|
+
});
|
|
42
|
+
it("applies both shape and size props to class when provided", function () {
|
|
43
|
+
var shape = "square";
|
|
44
|
+
var size = "lu-avatar-massive";
|
|
45
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Avatar_1.default, { shape: shape, size: size }));
|
|
46
|
+
var avatarDiv = react_1.screen.getByTestId("lu-avatar");
|
|
47
|
+
// Check if the shape is part of the class
|
|
48
|
+
expect(avatarDiv.className).toContain(shape);
|
|
49
|
+
// Check for the correct style application
|
|
50
|
+
var styles = window.getComputedStyle(avatarDiv);
|
|
51
|
+
expect(styles.width).toBe("200px");
|
|
52
|
+
expect(styles.height).toBe("200px");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const _BorderRadius: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react").Args>;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports._BorderRadius = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var BorderRadius_1 = require("./BorderRadius");
|
|
17
17
|
var utils_1 = require("../../../utils");
|
|
@@ -20,11 +20,11 @@ exports.default = {
|
|
|
20
20
|
component: BorderRadius_1.BorderRadius,
|
|
21
21
|
};
|
|
22
22
|
var Template = function (args) { return (0, jsx_runtime_1.jsx)(BorderRadius_1.BorderRadius, __assign({}, args)); };
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
23
|
+
exports._BorderRadius = Template.bind({});
|
|
24
|
+
exports._BorderRadius.args = {
|
|
25
25
|
borderRadius: "lu-border-rounded-xs",
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
27
|
+
exports._BorderRadius.argTypes = {
|
|
28
28
|
borderRadius: {
|
|
29
29
|
control: {
|
|
30
30
|
type: "select",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var react_1 = require("@testing-library/react");
|
|
5
|
+
var BorderRadius_1 = require("./BorderRadius");
|
|
6
|
+
describe("BorderRadius Component", function () {
|
|
7
|
+
it("renders BorderRadius component with table and border radius view", function () {
|
|
8
|
+
var borderRadius = "lu-border-rounded-xs"; // Example border radius token
|
|
9
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(BorderRadius_1.BorderRadius, { borderRadius: borderRadius }));
|
|
10
|
+
// Check if the main title 'Border Radius' is displayed
|
|
11
|
+
expect(react_1.screen.getByText("Border Radius")).toBeInTheDocument();
|
|
12
|
+
// Verify the BorderRadiusTable renders correctly
|
|
13
|
+
expect(react_1.screen.getByText("Alias Token Name")).toBeInTheDocument();
|
|
14
|
+
expect(react_1.screen.getByText("Base unit Multiplier of 8")).toBeInTheDocument();
|
|
15
|
+
expect(react_1.screen.getByText("Value(PX)(REM)")).toBeInTheDocument();
|
|
16
|
+
// Verify the 'lu-border-rounded-md' row data is in the table
|
|
17
|
+
expect(react_1.screen.getByText("lu-border-rounded-md")).toBeInTheDocument();
|
|
18
|
+
expect(react_1.screen.getByText("0.75x")).toBeInTheDocument();
|
|
19
|
+
expect(react_1.screen.getByText("6px = 0.375rem")).toBeInTheDocument();
|
|
20
|
+
// Check if BorderRadiusView is rendered with the correct border radius class
|
|
21
|
+
var borderRadiusElement = react_1.screen.getByTestId("border-radius");
|
|
22
|
+
expect(borderRadiusElement).toHaveClass("lu-border-rounded-xs");
|
|
23
|
+
expect(borderRadiusElement).toHaveClass("border-primary-600");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const _BorderWidth: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react").Args>;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports._BorderWidth = void 0;
|
|
15
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
var BorderWidth_1 = require("./BorderWidth");
|
|
17
17
|
var utils_1 = require("../../../utils");
|
|
@@ -20,11 +20,11 @@ exports.default = {
|
|
|
20
20
|
component: BorderWidth_1.BorderWidth,
|
|
21
21
|
};
|
|
22
22
|
var Template = function (args) { return (0, jsx_runtime_1.jsx)(BorderWidth_1.BorderWidth, __assign({}, args)); };
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
23
|
+
exports._BorderWidth = Template.bind({});
|
|
24
|
+
exports._BorderWidth.args = {
|
|
25
25
|
border: "lu-border-width-125",
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
27
|
+
exports._BorderWidth.argTypes = {
|
|
28
28
|
border: {
|
|
29
29
|
control: {
|
|
30
30
|
type: "select",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var react_1 = require("@testing-library/react");
|
|
5
|
+
var BorderWidth_1 = require("./BorderWidth");
|
|
6
|
+
describe("BorderWidth Component", function () {
|
|
7
|
+
it("renders BorderWidth component with table and border width view", function () {
|
|
8
|
+
var border = "lu-border-width-125";
|
|
9
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(BorderWidth_1.BorderWidth, { border: border }));
|
|
10
|
+
// Check if the main title 'Border Width' is displayed
|
|
11
|
+
expect(react_1.screen.getByText("Border Width")).toBeInTheDocument();
|
|
12
|
+
// Verify the Border Radius Table renders correctly
|
|
13
|
+
expect(react_1.screen.getByText("Alias Token Name")).toBeInTheDocument();
|
|
14
|
+
expect(react_1.screen.getByText("Base unit Multiplier of 8")).toBeInTheDocument();
|
|
15
|
+
expect(react_1.screen.getByText("Value(PX)(REM)")).toBeInTheDocument();
|
|
16
|
+
// Verify the 'lu-border-width-125' row data is in the table
|
|
17
|
+
expect(react_1.screen.getByText("lu-border-width-100")).toBeInTheDocument();
|
|
18
|
+
expect(react_1.screen.getByText("1x")).toBeInTheDocument();
|
|
19
|
+
expect(react_1.screen.getByText("8px = 0.5rem")).toBeInTheDocument();
|
|
20
|
+
// Check if BorderRadiusView is rendered with the correct border width class
|
|
21
|
+
var borderRadiusElement = react_1.screen.getByTestId("border-width");
|
|
22
|
+
expect(borderRadiusElement).toHaveClass("lu-border-width-125");
|
|
23
|
+
expect(borderRadiusElement).toHaveClass("border-primary-600");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -7,14 +7,14 @@ exports.Button = void 0;
|
|
|
7
7
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
var LUIcon_1 = __importDefault(require("../Icons/LUIcon"));
|
|
9
9
|
var enums_1 = require("../../utils/enums");
|
|
10
|
-
var
|
|
10
|
+
var index_1 = require("./index");
|
|
11
11
|
var Button = function (_a) {
|
|
12
|
-
var _b = _a.contentType, contentType = _b === void 0 ? enums_1.ContentType.text_with_icon : _b, _c = _a.variant, variant = _c === void 0 ? "lu-btn-primary" : _c, _d = _a.label, label = _d === void 0 ? "Button Text" : _d, iconLeft = _a.iconLeft, iconRight = _a.iconRight, onClick = _a.onClick, shape = _a.shape, _e = _a.size, size = _e === void 0 ? "lu-btn-md" : _e, leftIconSize = _a.leftIconSize, rightIconSize = _a.rightIconSize, className = _a.className, icon = _a.icon, iconSize = _a.iconSize,
|
|
13
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("button", { className: "flex items-center ".concat(shape, " ").concat(type ===
|
|
12
|
+
var _b = _a.contentType, contentType = _b === void 0 ? enums_1.ContentType.text_with_icon : _b, _c = _a.variant, variant = _c === void 0 ? "lu-btn-primary" : _c, _d = _a.label, label = _d === void 0 ? "Button Text" : _d, iconLeft = _a.iconLeft, iconRight = _a.iconRight, onClick = _a.onClick, shape = _a.shape, _e = _a.size, size = _e === void 0 ? "lu-btn-md" : _e, leftIconSize = _a.leftIconSize, rightIconSize = _a.rightIconSize, className = _a.className, icon = _a.icon, iconSize = _a.iconSize, _f = _a.type, type = _f === void 0 ? index_1.ButtonType === null || index_1.ButtonType === void 0 ? void 0 : index_1.ButtonType.fill : _f;
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("button", { className: "flex items-center ".concat(shape, " ").concat(type === index_1.ButtonType.outline ? "outline-button ".concat(variant) : variant, " ").concat(className, " ").concat(contentType === enums_1.ContentType.icon_only ? "icon-only ".concat(size) : size), onClick: onClick, children: [contentType === enums_1.ContentType.none && label, contentType === enums_1.ContentType.icon_only && icon && ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: iconSize, icon: icon, fill: type === index_1.ButtonType.outline
|
|
14
14
|
? "outline-button ".concat(variant)
|
|
15
|
-
: variant })), contentType === enums_1.ContentType.text_with_icon && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [iconLeft && iconLeft !== "none" && ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: leftIconSize, icon: iconLeft, fill: type ===
|
|
15
|
+
: variant })), contentType === enums_1.ContentType.text_with_icon && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [iconLeft && iconLeft !== "none" && ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: leftIconSize, icon: iconLeft, fill: type === index_1.ButtonType.outline
|
|
16
16
|
? "outline-button ".concat(variant)
|
|
17
|
-
: variant, className: "lu-mr-100" })), label, iconRight && iconRight !== "none" && ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: rightIconSize, icon: iconRight, fill: type ===
|
|
17
|
+
: variant, className: "lu-mr-100" })), label, iconRight && iconRight !== "none" && ((0, jsx_runtime_1.jsx)(LUIcon_1.default, { size: rightIconSize, icon: iconRight, fill: type === index_1.ButtonType.outline
|
|
18
18
|
? "outline-button ".concat(variant)
|
|
19
19
|
: variant, className: "lu-ml-100" }))] }))] }) }));
|
|
20
20
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const _Button: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react").Args>;
|
|
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
23
|
+
exports._Button = void 0;
|
|
24
24
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
25
|
var Button_1 = require("./Button");
|
|
26
26
|
var utils_1 = require("../../utils");
|
|
@@ -33,8 +33,8 @@ exports.default = {
|
|
|
33
33
|
tags: ["autodocs"],
|
|
34
34
|
};
|
|
35
35
|
var Template = function (args) { return (0, jsx_runtime_1.jsx)(Button_1.Button, __assign({}, args)); };
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
36
|
+
exports._Button = Template.bind({});
|
|
37
|
+
exports._Button.args = {
|
|
38
38
|
contentType: enums_1.ContentType.none,
|
|
39
39
|
variant: "lu-btn-primary",
|
|
40
40
|
label: "Button Text",
|
|
@@ -48,7 +48,7 @@ exports.button.args = {
|
|
|
48
48
|
type: _1.ButtonType.fill,
|
|
49
49
|
className: "",
|
|
50
50
|
};
|
|
51
|
-
exports.
|
|
51
|
+
exports._Button.argTypes = {
|
|
52
52
|
contentType: {
|
|
53
53
|
control: { type: "select" },
|
|
54
54
|
options: [
|
|
@@ -99,9 +99,9 @@ exports.button.argTypes = {
|
|
|
99
99
|
size: {
|
|
100
100
|
control: {
|
|
101
101
|
type: "select",
|
|
102
|
-
labels: Object.fromEntries(utils_1.
|
|
102
|
+
labels: Object.fromEntries(utils_1.buttonSizeList.map(function (size) { return [size.key, size.label]; })),
|
|
103
103
|
},
|
|
104
|
-
options: utils_1.
|
|
104
|
+
options: utils_1.buttonSizeList.map(function (size) { return size.key; }),
|
|
105
105
|
description: "Select the size of the button",
|
|
106
106
|
update: function (args) {
|
|
107
107
|
var isIconOnly = args.contentType === enums_1.ContentType.icon_only;
|
|
@@ -109,10 +109,10 @@ exports.button.argTypes = {
|
|
|
109
109
|
return {
|
|
110
110
|
options: isIconOnly
|
|
111
111
|
? utils_1.buttonWithIconList.map(function (size) { return size.key; })
|
|
112
|
-
: utils_1.
|
|
112
|
+
: utils_1.buttonSizeList.map(function (size) { return size.key; }),
|
|
113
113
|
control: {
|
|
114
114
|
type: "select",
|
|
115
|
-
labels: Object.fromEntries((isIconOnly ? utils_1.buttonWithIconList : utils_1.
|
|
115
|
+
labels: Object.fromEntries((isIconOnly ? utils_1.buttonWithIconList : utils_1.buttonSizeList).map(function (size) { return [
|
|
116
116
|
size.key,
|
|
117
117
|
size.label,
|
|
118
118
|
]; })),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var Button_1 = require("./Button");
|
|
5
|
+
var react_1 = require("@testing-library/react");
|
|
6
|
+
require("@testing-library/jest-dom");
|
|
7
|
+
var enums_1 = require("../../utils/enums");
|
|
8
|
+
var index_1 = require("./index");
|
|
9
|
+
describe("Button Component", function () {
|
|
10
|
+
it("renders with default props", function () {
|
|
11
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, {}));
|
|
12
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Button Text" });
|
|
13
|
+
expect(buttonElement).toBeInTheDocument();
|
|
14
|
+
expect(buttonElement).toHaveClass("lu-btn-primary");
|
|
15
|
+
expect(buttonElement).toHaveClass("lu-btn-md");
|
|
16
|
+
});
|
|
17
|
+
it("renders with a custom label", function () {
|
|
18
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { label: "Custom Button" }));
|
|
19
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Custom Button" });
|
|
20
|
+
expect(buttonElement).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
it("applies additional class names", function () {
|
|
23
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { className: "custom-class another-class" }));
|
|
24
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Button Text" });
|
|
25
|
+
expect(buttonElement).toHaveClass("custom-class");
|
|
26
|
+
expect(buttonElement).toHaveClass("another-class");
|
|
27
|
+
});
|
|
28
|
+
it("triggers the onClick function when clicked", function () {
|
|
29
|
+
var handleClick = jest.fn();
|
|
30
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleClick }));
|
|
31
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Button Text" });
|
|
32
|
+
react_1.fireEvent.click(buttonElement);
|
|
33
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
34
|
+
});
|
|
35
|
+
it("renders an icon-only button", function () {
|
|
36
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { contentType: enums_1.ContentType.icon_only, icon: "star-icon" }));
|
|
37
|
+
var buttonElement = react_1.screen.getByRole("button");
|
|
38
|
+
expect(buttonElement).toBeInTheDocument();
|
|
39
|
+
expect(buttonElement).toHaveTextContent(""); // Ensure it's icon-only
|
|
40
|
+
});
|
|
41
|
+
it("renders a button with left and right icons", function () {
|
|
42
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { contentType: enums_1.ContentType.text_with_icon, label: "Button", iconLeft: "left-icon", iconRight: "right-icon" }));
|
|
43
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Button" });
|
|
44
|
+
expect(buttonElement).toBeInTheDocument();
|
|
45
|
+
// Using test ID instead of role="img"
|
|
46
|
+
var icons = react_1.screen.getAllByTestId("lu-icon");
|
|
47
|
+
expect(icons.length).toBeGreaterThanOrEqual(2);
|
|
48
|
+
});
|
|
49
|
+
it("renders an outlined button", function () {
|
|
50
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Button_1.Button, { type: index_1.ButtonType.outline }));
|
|
51
|
+
var buttonElement = react_1.screen.getByRole("button", { name: "Button Text" });
|
|
52
|
+
expect(buttonElement).toHaveClass("outline-button");
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackgroundColor = void 0;
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var BackgroundColor = function (_a) {
|
|
3
6
|
var label = _a.label, color = _a.color;
|
|
4
|
-
return (
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "lu-font-size-large lu-font-weight-bold lu-mb-200", children: label }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "w-10 h-10 rounded ".concat(color), "data-testid": "color-box" }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("p", { className: "lu-font-weight-semibold", children: color === null || color === void 0 ? void 0 : color.replace("bg-", "") }), (0, jsx_runtime_1.jsx)("code", { className: "lu-font-size-small", children: color })] })] })] }));
|
|
5
8
|
};
|
|
9
|
+
exports.BackgroundColor = BackgroundColor;
|
|
@@ -2,9 +2,9 @@ import { Meta } from "@storybook/react";
|
|
|
2
2
|
import { ColorProps } from "@/types/interface";
|
|
3
3
|
declare const _default: Meta;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const Primary: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
6
|
-
export declare const Gray: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
7
|
-
export declare const Success: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
8
|
-
export declare const Warning: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
9
|
-
export declare const Danger: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
10
|
-
export declare const Info: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
5
|
+
export declare const Primary: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
6
|
+
export declare const Gray: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
7
|
+
export declare const Success: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
8
|
+
export declare const Warning: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
9
|
+
export declare const Danger: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
10
|
+
export declare const Info: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, ColorProps>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -9,92 +10,94 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
10
|
};
|
|
10
11
|
return __assign.apply(this, arguments);
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Info = exports.Danger = exports.Warning = exports.Success = exports.Gray = exports.Primary = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var BackgroundColor_1 = require("../../../components/Color/BackgroundColor/BackgroundColor");
|
|
17
|
+
var index_1 = require("./index");
|
|
18
|
+
exports.default = {
|
|
16
19
|
title: "Components/Color/BackgroundColor",
|
|
17
|
-
component: BackgroundColor,
|
|
20
|
+
component: BackgroundColor_1.BackgroundColor,
|
|
18
21
|
argTypes: {
|
|
19
22
|
label: { control: "text" },
|
|
20
23
|
},
|
|
21
24
|
};
|
|
22
|
-
var Template = function (args) { return
|
|
23
|
-
|
|
24
|
-
Primary.args = {
|
|
25
|
+
var Template = function (args) { return (0, jsx_runtime_1.jsx)(BackgroundColor_1.BackgroundColor, __assign({}, args)); };
|
|
26
|
+
exports.Primary = Template.bind({});
|
|
27
|
+
exports.Primary.args = {
|
|
25
28
|
label: "Primary",
|
|
26
29
|
color: "lu-bg-primary-500", // Default color
|
|
27
30
|
};
|
|
28
|
-
Primary.argTypes = {
|
|
31
|
+
exports.Primary.argTypes = {
|
|
29
32
|
color: {
|
|
30
33
|
control: { type: "select" },
|
|
31
|
-
options: Object.keys(customBackgroundColor)
|
|
34
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
32
35
|
.filter(function (key) { return key.startsWith(".lu-bg-primary-"); })
|
|
33
36
|
.map(function (key) { return key.slice(1); }),
|
|
34
37
|
},
|
|
35
38
|
};
|
|
36
|
-
|
|
37
|
-
Gray.argTypes = {
|
|
39
|
+
exports.Gray = Template.bind({});
|
|
40
|
+
exports.Gray.argTypes = {
|
|
38
41
|
color: {
|
|
39
42
|
control: { type: "select" },
|
|
40
|
-
options: Object.keys(customBackgroundColor)
|
|
43
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
41
44
|
.filter(function (key) { return key.startsWith(".lu-bg-neutral-"); })
|
|
42
45
|
.map(function (key) { return key.slice(1); }),
|
|
43
46
|
},
|
|
44
47
|
};
|
|
45
|
-
Gray.args = {
|
|
48
|
+
exports.Gray.args = {
|
|
46
49
|
label: "Gray",
|
|
47
50
|
color: "lu-bg-neutral-500",
|
|
48
51
|
};
|
|
49
|
-
|
|
50
|
-
Success.argTypes = {
|
|
52
|
+
exports.Success = Template.bind({});
|
|
53
|
+
exports.Success.argTypes = {
|
|
51
54
|
color: {
|
|
52
55
|
control: { type: "select" },
|
|
53
|
-
options: Object.keys(customBackgroundColor)
|
|
56
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
54
57
|
.filter(function (key) { return key.startsWith(".lu-bg-success-"); })
|
|
55
58
|
.map(function (key) { return key.slice(1); }),
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
|
-
Success.args = {
|
|
61
|
+
exports.Success.args = {
|
|
59
62
|
label: "Success",
|
|
60
63
|
color: "lu-bg-success-500",
|
|
61
64
|
};
|
|
62
|
-
|
|
63
|
-
Warning.argTypes = {
|
|
65
|
+
exports.Warning = Template.bind({});
|
|
66
|
+
exports.Warning.argTypes = {
|
|
64
67
|
color: {
|
|
65
68
|
control: { type: "select" },
|
|
66
|
-
options: Object.keys(customBackgroundColor)
|
|
69
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
67
70
|
.filter(function (key) { return key.startsWith(".lu-bg-warning-"); })
|
|
68
71
|
.map(function (key) { return key.slice(1); }),
|
|
69
72
|
},
|
|
70
73
|
};
|
|
71
|
-
Warning.args = {
|
|
74
|
+
exports.Warning.args = {
|
|
72
75
|
label: "Warning",
|
|
73
76
|
color: "lu-bg-warning-500",
|
|
74
77
|
};
|
|
75
|
-
|
|
76
|
-
Danger.argTypes = {
|
|
78
|
+
exports.Danger = Template.bind({});
|
|
79
|
+
exports.Danger.argTypes = {
|
|
77
80
|
color: {
|
|
78
81
|
control: { type: "select" },
|
|
79
|
-
options: Object.keys(customBackgroundColor)
|
|
82
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
80
83
|
.filter(function (key) { return key.startsWith(".lu-bg-danger-"); })
|
|
81
84
|
.map(function (key) { return key.slice(1); }),
|
|
82
85
|
},
|
|
83
86
|
};
|
|
84
|
-
Danger.args = {
|
|
87
|
+
exports.Danger.args = {
|
|
85
88
|
label: "Danger",
|
|
86
89
|
color: "lu-bg-danger-500",
|
|
87
90
|
};
|
|
88
|
-
|
|
89
|
-
Info.argTypes = {
|
|
91
|
+
exports.Info = Template.bind({});
|
|
92
|
+
exports.Info.argTypes = {
|
|
90
93
|
color: {
|
|
91
94
|
control: { type: "select" },
|
|
92
|
-
options: Object.keys(customBackgroundColor)
|
|
95
|
+
options: Object.keys(index_1.customBackgroundColor)
|
|
93
96
|
.filter(function (key) { return key.startsWith(".lu-bg-info-"); })
|
|
94
97
|
.map(function (key) { return key.slice(1); }),
|
|
95
98
|
},
|
|
96
99
|
};
|
|
97
|
-
Info.args = {
|
|
100
|
+
exports.Info.args = {
|
|
98
101
|
label: "Info",
|
|
99
102
|
color: "lu-bg-info-500",
|
|
100
103
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
var react_1 = require("@testing-library/react");
|
|
5
|
+
var BackgroundColor_1 = require("./BackgroundColor");
|
|
6
|
+
describe("Color Component", function () {
|
|
7
|
+
it("renders the color component with a label", function () {
|
|
8
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(BackgroundColor_1.BackgroundColor, { label: "Primary", color: "lu-bg-primary-500" }));
|
|
9
|
+
var labelElement = react_1.screen.getByText("Primary");
|
|
10
|
+
expect(labelElement).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
it("applies the correct background color", function () {
|
|
13
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(BackgroundColor_1.BackgroundColor, { label: "Success", color: "lu-bg-success-500" }));
|
|
14
|
+
var colorBox = react_1.screen.getByTestId("color-box");
|
|
15
|
+
expect(colorBox).toHaveClass("lu-bg-success-500");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|