linkedunion-design-kit 1.4.6 → 1.4.8
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/README.md +20 -8
- package/dist/app/layout.d.ts +2 -2
- package/dist/app/layout.js +5 -5
- package/dist/app/page.js +2 -2
- package/dist/app/scripts.js +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +2 -5
- package/dist/components/Avatar/Avatar.stories.js +15 -6
- package/dist/components/Border/BorderRadius/BorderRadius.stories.js +8 -2
- package/dist/components/Border/BorderRadius/BorderRadiusTable.js +1 -1
- package/dist/components/Border/BorderRadius/BorderRadiusView.js +1 -1
- package/dist/components/Border/BorderWidth/BorderWidth.stories.js +8 -2
- package/dist/components/Border/BorderWidth/BorderWidthTable.js +1 -1
- package/dist/components/Border/BorderWidth/ViewBorderWidth.js +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +8 -2
- package/dist/components/Button/Button.stories.js +56 -22
- package/dist/components/Color/BackgroundColor/Color.js +1 -1
- package/dist/components/Color/BackgroundColor/Color.stories.js +25 -13
- package/dist/components/Color/BackgroundColor/index.d.ts +7 -0
- package/dist/components/Color/BackgroundColor/index.js +15 -0
- package/dist/components/Color/TextColor.d.ts +1 -1
- package/dist/components/Color/TextColor.js +2 -2
- package/dist/components/Color/TextColor.stories.js +4 -1
- package/dist/components/Icons/IconView.stories.js +1 -1
- package/dist/components/Icons/LUIcon.js +1 -1
- package/dist/components/Icons/LUIcon.stories.js +16 -7
- package/dist/components/Images/LuImage.d.ts +1 -1
- package/dist/components/Images/LuImage.js +2 -2
- package/dist/components/Images/LuImage.stories.js +7 -9
- package/dist/components/MediaCard/Card.d.ts +1 -1
- package/dist/components/MediaCard/Card.js +30 -17
- package/dist/components/MediaCard/Card.stories.js +21 -9
- package/dist/components/MediaCard/ContactProfile/ContactProfile.js +23 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme1.d.ts +2 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme1.js +9 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme2.d.ts +2 -0
- package/dist/components/MediaCard/ContactProfile/ContactProfileTheme2.js +9 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategory.js +23 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme1.d.ts +2 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme1.js +9 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme2.d.ts +2 -0
- package/dist/components/MediaCard/PostByCategory/PostByCategoryTheme2.js +9 -0
- package/dist/components/MediaCard/card.module.css +52 -0
- package/dist/components/Size/MinWidthHeight.d.ts +1 -1
- package/dist/components/Size/MinWidthHeight.stories.js +11 -5
- package/dist/components/Size/Size.js +1 -1
- package/dist/components/Size/Size.stories.js +6 -8
- package/dist/components/Size/WidthHeight.stories.js +10 -4
- package/dist/components/Spacing/Margin/Margin.js +1 -1
- package/dist/components/Spacing/Margin/MarginBottom.js +1 -1
- package/dist/components/Spacing/Margin/MarginLeft.js +1 -1
- package/dist/components/Spacing/Margin/MarginRight.js +1 -1
- package/dist/components/Spacing/Margin/MarginToken.js +3 -1
- package/dist/components/Spacing/Margin/MarginTop.js +1 -1
- package/dist/components/Spacing/Margin/MarginX.d.ts +1 -0
- package/dist/components/Spacing/Margin/MarginX.js +5 -0
- package/dist/components/Spacing/Margin/MarginY.d.ts +1 -0
- package/dist/components/Spacing/Margin/MarginY.js +5 -0
- package/dist/components/Spacing/Padding/Padding.js +1 -1
- package/dist/components/Spacing/Padding/PaddingBottom.js +1 -1
- package/dist/components/Spacing/Padding/PaddingLeft.js +1 -1
- package/dist/components/Spacing/Padding/PaddingRight.js +1 -1
- package/dist/components/Spacing/Padding/PaddingToken.js +3 -1
- package/dist/components/Spacing/Padding/PaddingTop.js +1 -1
- package/dist/components/Spacing/Padding/PaddingX.d.ts +1 -0
- package/dist/components/Spacing/Padding/PaddingX.js +5 -0
- package/dist/components/Spacing/Padding/PaddingY.d.ts +1 -0
- package/dist/components/Spacing/Padding/PaddingY.js +5 -0
- package/dist/components/Title/Title.d.ts +6 -0
- package/dist/components/Title/Title.js +7 -0
- package/dist/components/Title/Title.module.css +56 -0
- package/dist/components/Title/Title.stories.d.ts +5 -0
- package/dist/components/Title/Title.stories.js +49 -0
- package/dist/components/Title/Title.test.d.ts +1 -0
- package/dist/components/Title/Title.test.js +24 -0
- package/dist/components/Typography/Body/Body.d.ts +2 -0
- package/dist/components/{MediaCard/Card.jsx → Typography/Body/Body.js} +6 -10
- package/dist/components/Typography/Body/Body.stories.d.ts +6 -0
- package/dist/components/Typography/Body/Body.stories.js +68 -0
- package/dist/components/Typography/Body/body.test.d.ts +1 -0
- package/dist/components/Typography/Body/body.test.js +44 -0
- package/dist/components/Typography/Body/index.d.ts +14 -0
- package/dist/components/Typography/Body/index.js +50 -0
- package/dist/components/Typography/Body/type.d.ts +7 -0
- package/dist/components/Typography/Body/type.js +1 -0
- package/dist/components/Typography/Display/Display.d.ts +2 -0
- package/dist/components/Typography/Display/Display.js +29 -0
- package/dist/components/Typography/Display/Display.stories.d.ts +6 -0
- package/dist/components/Typography/Display/Display.stories.js +72 -0
- package/dist/components/Typography/Display/Display.test.d.ts +1 -0
- package/dist/components/Typography/Display/Display.test.js +44 -0
- package/dist/components/Typography/Display/index.d.ts +38 -0
- package/dist/components/Typography/Display/index.js +61 -0
- package/dist/components/Typography/Display/type.d.ts +8 -0
- package/dist/components/Typography/Display/type.js +1 -0
- package/dist/components/Typography/Headings/Heading.test.d.ts +1 -0
- package/dist/components/Typography/Headings/Heading.test.js +44 -0
- package/dist/components/Typography/Headings/Headings.d.ts +2 -2
- package/dist/components/Typography/Headings/Headings.js +27 -3
- package/dist/components/Typography/Headings/Headings.stories.d.ts +4 -2
- package/dist/components/Typography/Headings/Headings.stories.js +39 -8
- package/dist/components/Typography/Headings/index.d.ts +21 -0
- package/dist/components/Typography/Headings/index.js +68 -0
- package/dist/components/Typography/Headings/type.d.ts +6 -0
- package/dist/components/Typography/Headings/type.js +1 -0
- package/dist/components/Typography/Typography.css +3002 -0
- package/dist/components/Typography/Typography.d.ts +1 -1
- package/dist/components/Typography/Typography.js +1 -1
- package/dist/components/Typography/Typography.stories.js +36 -15
- package/dist/global/components/Table/Table.d.ts +14 -0
- package/dist/global/components/Table/Table.js +12 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.js +13 -10
- package/dist/styles/global.css +1151 -8030
- package/dist/tailwind.config.d.ts +1 -1
- package/dist/tailwind.config.js +85 -46
- package/dist/utils/colors.d.ts +7 -0
- package/dist/utils/colors.js +7 -0
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +2 -0
- package/dist/utils/enum.js +14 -14
- package/dist/utils/enums.d.ts +51 -0
- package/dist/utils/enums.js +56 -0
- package/dist/utils/iconList.js +479 -479
- package/dist/utils/index.d.ts +379 -472
- package/dist/utils/index.js +1383 -1527
- package/package.json +5 -2
- package/dist/app/layout.jsx +0 -13
- package/dist/app/page.jsx +0 -71
- package/dist/components/Avatar/Avatar.jsx +0 -15
- package/dist/components/Avatar/Avatar.stories.jsx +0 -25
- package/dist/components/Border/BorderRadius/BorderRadius.jsx +0 -12
- package/dist/components/Border/BorderRadius/BorderRadius.stories.jsx +0 -17
- package/dist/components/Border/BorderRadius/BorderRadiusTable.jsx +0 -61
- package/dist/components/Border/BorderRadius/BorderRadiusView.jsx +0 -8
- package/dist/components/Border/BorderWidth/BorderWidth.jsx +0 -12
- package/dist/components/Border/BorderWidth/BorderWidth.stories.jsx +0 -17
- package/dist/components/Border/BorderWidth/BorderWidthTable.jsx +0 -36
- package/dist/components/Border/BorderWidth/ViewBorderWidth.jsx +0 -8
- package/dist/components/Button/Button.jsx +0 -16
- package/dist/components/Button/Button.stories.jsx +0 -110
- package/dist/components/Color/BackgroundColor/Color.jsx +0 -16
- package/dist/components/Color/BackgroundColor/Color.stories.jsx +0 -76
- package/dist/components/Color/Color.d.ts +0 -2
- package/dist/components/Color/Color.js +0 -5
- package/dist/components/Color/Color.stories.d.ts +0 -10
- package/dist/components/Color/Color.stories.js +0 -88
- package/dist/components/Color/TextColor.jsx +0 -6
- package/dist/components/Color/TextColor.stories.jsx +0 -17
- package/dist/components/Icons/IconView.jsx +0 -23
- package/dist/components/Icons/IconView.stories.jsx +0 -8
- package/dist/components/Icons/LUIcon.jsx +0 -20
- package/dist/components/Icons/LUIcon.stories.jsx +0 -29
- package/dist/components/Images/LuImage.jsx +0 -7
- package/dist/components/Images/LuImage.stories.jsx +0 -39
- package/dist/components/MediaCard/Card.stories.jsx +0 -35
- package/dist/components/MediaCard/ContactProfile.js +0 -10
- package/dist/components/MediaCard/ContactProfile.jsx +0 -39
- package/dist/components/MediaCard/PostByCategory.js +0 -11
- package/dist/components/MediaCard/PostByCategory.jsx +0 -46
- package/dist/components/Navigation/TopNavigation/TopNavigation.d.ts +0 -2
- package/dist/components/Navigation/TopNavigation/TopNavigation.js +0 -8
- package/dist/components/Navigation/TopNavigation/TopNavigation.jsx +0 -45
- package/dist/components/Navigation/TopNavigation/TopNavigation.stories.d.ts +0 -4
- package/dist/components/Navigation/TopNavigation/TopNavigation.stories.js +0 -52
- package/dist/components/Navigation/TopNavigation/TopNavigation.stories.jsx +0 -40
- package/dist/components/Size/MinWidthHeight.jsx +0 -8
- package/dist/components/Size/MinWidthHeight.stories.jsx +0 -22
- package/dist/components/Size/Size.jsx +0 -6
- package/dist/components/Size/Size.stories.jsx +0 -22
- package/dist/components/Size/WidthHeight.jsx +0 -8
- package/dist/components/Size/WidthHeight.stories.jsx +0 -22
- package/dist/components/Spacing/Margin/Margin.jsx +0 -86
- package/dist/components/Spacing/Margin/MarginBottom.jsx +0 -86
- package/dist/components/Spacing/Margin/MarginLeft.jsx +0 -86
- package/dist/components/Spacing/Margin/MarginRight.jsx +0 -86
- package/dist/components/Spacing/Margin/MarginToken.jsx +0 -27
- package/dist/components/Spacing/Margin/MarginToken.stories.jsx +0 -7
- package/dist/components/Spacing/Margin/MarginTop.jsx +0 -87
- package/dist/components/Spacing/Padding/Padding.jsx +0 -87
- package/dist/components/Spacing/Padding/PaddingBottom.jsx +0 -86
- package/dist/components/Spacing/Padding/PaddingLeft.jsx +0 -86
- package/dist/components/Spacing/Padding/PaddingRight.jsx +0 -87
- package/dist/components/Spacing/Padding/PaddingToken.jsx +0 -27
- package/dist/components/Spacing/Padding/PaddingToken.stories.jsx +0 -7
- package/dist/components/Spacing/Padding/PaddingTop.jsx +0 -87
- package/dist/components/Typography/Headings/Headings.jsx +0 -6
- package/dist/components/Typography/Headings/Headings.stories.jsx +0 -19
- package/dist/components/Typography/Typography.jsx +0 -8
- package/dist/components/Typography/Typography.stories.jsx +0 -51
- /package/dist/components/MediaCard/{ContactProfile.d.ts → ContactProfile/ContactProfile.d.ts} +0 -0
- /package/dist/components/MediaCard/{PostByCategory.d.ts → PostByCategory/PostByCategory.d.ts} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Body } from "./Body";
|
|
14
|
+
import Table from "../../../global/components/Table/Table";
|
|
15
|
+
import { BODY_CLASSES, bodyTableHeaders, bodyTableRows } from ".";
|
|
16
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
17
|
+
export default {
|
|
18
|
+
title: "Components/Typography/Body",
|
|
19
|
+
component: Body,
|
|
20
|
+
parameters: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component: "A configurable body text component with design system-approved styling variants",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
body: {
|
|
29
|
+
description: "Typography variant class",
|
|
30
|
+
control: {
|
|
31
|
+
type: "select",
|
|
32
|
+
labels: BODY_CLASSES.reduce(function (acc, curr) {
|
|
33
|
+
var _a;
|
|
34
|
+
return (__assign(__assign({}, acc), (_a = {}, _a[curr] = curr, _a)));
|
|
35
|
+
}, {}),
|
|
36
|
+
},
|
|
37
|
+
options: BODY_CLASSES,
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: BODY_CLASSES.map(function (item) { return item; }).join(" | ") },
|
|
40
|
+
defaultValue: { summary: BODY_CLASSES[0] },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
label: {
|
|
44
|
+
description: "Text content",
|
|
45
|
+
control: "text",
|
|
46
|
+
table: {
|
|
47
|
+
type: { summary: "string" },
|
|
48
|
+
defaultValue: { summary: Dummy_Para },
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
className: {
|
|
52
|
+
description: "Additional CSS classes",
|
|
53
|
+
control: "text",
|
|
54
|
+
table: {
|
|
55
|
+
type: { summary: "string" },
|
|
56
|
+
defaultValue: { summary: "" },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
var Template = function (args) { return _jsx(Body, __assign({}, args)); };
|
|
62
|
+
export var _Body = Template.bind({});
|
|
63
|
+
_Body.args = {
|
|
64
|
+
label: Dummy_Para,
|
|
65
|
+
body: BODY_CLASSES[0],
|
|
66
|
+
className: "",
|
|
67
|
+
};
|
|
68
|
+
export var BodyTokens = function () { return (_jsx(Table, { headers: bodyTableHeaders, rows: bodyTableRows, "aria-label": "Body text variants comparison" })); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Body } from "./Body";
|
|
5
|
+
import { BODY_CLASSES } from "./";
|
|
6
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
7
|
+
describe("Body Component", function () {
|
|
8
|
+
it("renders with default props", function () {
|
|
9
|
+
render(_jsx(Body, {}));
|
|
10
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
11
|
+
expect(divElement).toBeInTheDocument();
|
|
12
|
+
expect(divElement).toHaveClass(BODY_CLASSES[0]);
|
|
13
|
+
});
|
|
14
|
+
describe("Body Component with different body classes", function () {
|
|
15
|
+
BODY_CLASSES.forEach(function (bodyClass) {
|
|
16
|
+
it("applies the correct class \"".concat(bodyClass, "\""), function () {
|
|
17
|
+
render(_jsx(Body, { body: bodyClass }));
|
|
18
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
19
|
+
expect(divElement).toHaveClass(bodyClass);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it("applies additional class names from className prop", function () {
|
|
24
|
+
var customClass = "custom-class another-class";
|
|
25
|
+
render(_jsx(Body, { className: customClass }));
|
|
26
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
27
|
+
expect(divElement).toHaveClass(BODY_CLASSES[0]);
|
|
28
|
+
expect(divElement).toHaveClass("custom-class");
|
|
29
|
+
expect(divElement).toHaveClass("another-class");
|
|
30
|
+
});
|
|
31
|
+
it("renders custom label when provided", function () {
|
|
32
|
+
var customLabel = "Custom Label Text";
|
|
33
|
+
render(_jsx(Body, { label: customLabel }));
|
|
34
|
+
var divElement = screen.getByText(customLabel);
|
|
35
|
+
expect(divElement).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
it("passes additional props to the root div", function () {
|
|
38
|
+
var testId = "body-component";
|
|
39
|
+
var ariaLabel = "Body Component";
|
|
40
|
+
render(_jsx(Body, { "data-testid": testId, "aria-label": ariaLabel }));
|
|
41
|
+
var divElement = screen.getByTestId(testId);
|
|
42
|
+
expect(divElement).toHaveAttribute("aria-label", ariaLabel);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FontFamily, FontSize, FontWeight, LineHeights, TextColor } from "../../../utils/enums";
|
|
2
|
+
export declare const BODY_CLASSES: readonly ["lu-body-1", "lu-body-2", "lu-body-3", "lu-body-4"];
|
|
3
|
+
export declare const bodyTableHeaders: {
|
|
4
|
+
title: string;
|
|
5
|
+
key: string;
|
|
6
|
+
}[];
|
|
7
|
+
export declare const bodyTableRows: {
|
|
8
|
+
alias: string;
|
|
9
|
+
fontFamily: FontFamily;
|
|
10
|
+
fontSize: FontSize;
|
|
11
|
+
fontWeight: FontWeight;
|
|
12
|
+
lineHeight: LineHeights;
|
|
13
|
+
color: TextColor;
|
|
14
|
+
}[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FontFamily, FontSize, FontWeight, LineHeights, TextColor, } from "../../../utils/enums";
|
|
2
|
+
export var BODY_CLASSES = [
|
|
3
|
+
"lu-body-1",
|
|
4
|
+
"lu-body-2",
|
|
5
|
+
"lu-body-3",
|
|
6
|
+
"lu-body-4",
|
|
7
|
+
];
|
|
8
|
+
export var bodyTableHeaders = [
|
|
9
|
+
{ title: "Alias Token Name", key: "alias" },
|
|
10
|
+
{ title: "Font Family", key: "fontFamily" },
|
|
11
|
+
{ title: "Font Size", key: "fontSize" },
|
|
12
|
+
{ title: "Font Weight", key: "fontWeight" },
|
|
13
|
+
{ title: "Line Height", key: "lineHeight" },
|
|
14
|
+
{ title: "Color", key: "color" },
|
|
15
|
+
];
|
|
16
|
+
// Define rows
|
|
17
|
+
export var bodyTableRows = [
|
|
18
|
+
{
|
|
19
|
+
alias: "lu-body-1",
|
|
20
|
+
fontFamily: FontFamily.Base,
|
|
21
|
+
fontSize: FontSize.XLarge,
|
|
22
|
+
fontWeight: FontWeight.Regular,
|
|
23
|
+
lineHeight: LineHeights.XS,
|
|
24
|
+
color: TextColor.Secondary,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
alias: "lu-body-2",
|
|
28
|
+
fontFamily: FontFamily.Base,
|
|
29
|
+
fontSize: FontSize.Large,
|
|
30
|
+
fontWeight: FontWeight.Regular,
|
|
31
|
+
lineHeight: LineHeights.XS,
|
|
32
|
+
color: TextColor.Secondary,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
alias: "lu-body-3",
|
|
36
|
+
fontFamily: FontFamily.Base,
|
|
37
|
+
fontSize: FontSize.Medium,
|
|
38
|
+
fontWeight: FontWeight.Regular,
|
|
39
|
+
lineHeight: LineHeights.XS,
|
|
40
|
+
color: TextColor.Secondary,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
alias: "lu-body-4 ",
|
|
44
|
+
fontFamily: FontFamily.Base,
|
|
45
|
+
fontSize: FontSize.Small,
|
|
46
|
+
fontWeight: FontWeight.Regular,
|
|
47
|
+
lineHeight: LineHeights.XS,
|
|
48
|
+
color: TextColor.Secondary,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
25
|
+
import { Display_Classes } from "./";
|
|
26
|
+
export var Display = function (_a) {
|
|
27
|
+
var _b = _a.display, display = _b === void 0 ? Display_Classes["lu-display-1"] : _b, _c = _a.label, label = _c === void 0 ? Dummy_Para : _c, _d = _a.className, className = _d === void 0 ? "" : _d, props = __rest(_a, ["display", "label", "className"]);
|
|
28
|
+
return (_jsx("div", __assign({}, props, { className: "".concat(display, " ").concat(className, " "), children: label })));
|
|
29
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import { DisplayProps } from "./type";
|
|
3
|
+
declare const _default: Meta<DisplayProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const _Display: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, DisplayProps>;
|
|
6
|
+
export declare const DisplayTokens: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Display } from "./Display";
|
|
14
|
+
import { Display_Classes, displayTableHeaders, displayTableRows } from ".";
|
|
15
|
+
import Table from "../../../global/components/Table/Table";
|
|
16
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
17
|
+
export default {
|
|
18
|
+
title: "Components/Typography/Display",
|
|
19
|
+
component: Display,
|
|
20
|
+
parameters: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component: "A configurable Display text component with design system-approved styling variants",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
display: {
|
|
29
|
+
description: "Typography variant class",
|
|
30
|
+
control: {
|
|
31
|
+
type: "select",
|
|
32
|
+
labels: Object.values(Display_Classes).reduce(function (acc, curr) {
|
|
33
|
+
var _a;
|
|
34
|
+
return (__assign(__assign({}, acc), (_a = {}, _a[curr] = curr, _a)));
|
|
35
|
+
}, {}),
|
|
36
|
+
},
|
|
37
|
+
options: Object.values(Display_Classes),
|
|
38
|
+
table: {
|
|
39
|
+
type: {
|
|
40
|
+
summary: Object.values(Display_Classes)
|
|
41
|
+
.map(function (item) { return item; })
|
|
42
|
+
.join(" | "),
|
|
43
|
+
},
|
|
44
|
+
defaultValue: { summary: Display_Classes["lu-display-1"] },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
label: {
|
|
48
|
+
description: "Text content",
|
|
49
|
+
control: "text",
|
|
50
|
+
table: {
|
|
51
|
+
type: { summary: "string" },
|
|
52
|
+
defaultValue: { summary: Dummy_Para },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
className: {
|
|
56
|
+
description: "Additional CSS classes",
|
|
57
|
+
control: "text",
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: "string" },
|
|
60
|
+
defaultValue: { summary: "" },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
var Template = function (args) { return _jsx(Display, __assign({}, args)); };
|
|
66
|
+
export var _Display = Template.bind({});
|
|
67
|
+
_Display.args = {
|
|
68
|
+
label: Dummy_Para,
|
|
69
|
+
display: Display_Classes["lu-display-1"],
|
|
70
|
+
className: "",
|
|
71
|
+
};
|
|
72
|
+
export var DisplayTokens = function () { return (_jsx(Table, { headers: displayTableHeaders, rows: displayTableRows, "aria-label": "Display text variants comparison" })); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
5
|
+
import { Display } from "./Display";
|
|
6
|
+
import { Display_Classes } from "./";
|
|
7
|
+
describe("Body Component", function () {
|
|
8
|
+
it("renders with default props", function () {
|
|
9
|
+
render(_jsx(Display, {}));
|
|
10
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
11
|
+
expect(divElement).toBeInTheDocument();
|
|
12
|
+
expect(divElement).toHaveClass(Display_Classes["lu-display-1"]);
|
|
13
|
+
});
|
|
14
|
+
describe("Body Component with different body classes", function () {
|
|
15
|
+
Object.values(Display_Classes).forEach(function (displayClass) {
|
|
16
|
+
it("applies the correct class \"".concat(displayClass, "\""), function () {
|
|
17
|
+
render(_jsx(Display, { display: displayClass }));
|
|
18
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
19
|
+
expect(divElement).toHaveClass(displayClass);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it("applies additional class names from className prop", function () {
|
|
24
|
+
var customClass = "custom-class another-class";
|
|
25
|
+
render(_jsx(Display, { className: customClass }));
|
|
26
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
27
|
+
expect(divElement).toHaveClass(Display_Classes["lu-display-1"]);
|
|
28
|
+
expect(divElement).toHaveClass("custom-class");
|
|
29
|
+
expect(divElement).toHaveClass("another-class");
|
|
30
|
+
});
|
|
31
|
+
it("renders custom label when provided", function () {
|
|
32
|
+
var customLabel = "Custom Label Text";
|
|
33
|
+
render(_jsx(Display, { label: customLabel }));
|
|
34
|
+
var divElement = screen.getByText(customLabel);
|
|
35
|
+
expect(divElement).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
it("passes additional props to the root div", function () {
|
|
38
|
+
var testId = "body-component";
|
|
39
|
+
var ariaLabel = "Body Component";
|
|
40
|
+
render(_jsx(Display, { "data-testid": testId, "aria-label": ariaLabel }));
|
|
41
|
+
var divElement = screen.getByTestId(testId);
|
|
42
|
+
expect(divElement).toHaveAttribute("aria-label", ariaLabel);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FontFamily, FontSize, FontWeight, LineHeights, TextColor } from ".././../../utils/enums";
|
|
2
|
+
export declare enum Display_Classes {
|
|
3
|
+
"lu-display-1" = "lu-display-1",
|
|
4
|
+
"lu-display-2" = "lu-display-2",
|
|
5
|
+
"lu-display-3" = "lu-display-3"
|
|
6
|
+
}
|
|
7
|
+
export declare const customDisplay: {
|
|
8
|
+
".lu-display-1": {
|
|
9
|
+
fontSize: string;
|
|
10
|
+
fontWeight: string;
|
|
11
|
+
lineHeight: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
".lu-display-2": {
|
|
15
|
+
fontSize: string;
|
|
16
|
+
fontWeight: string;
|
|
17
|
+
lineHeight: string;
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
".lu-display-3": {
|
|
21
|
+
fontSize: string;
|
|
22
|
+
fontWeight: string;
|
|
23
|
+
lineHeight: string;
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const displayTableHeaders: {
|
|
28
|
+
title: string;
|
|
29
|
+
key: string;
|
|
30
|
+
}[];
|
|
31
|
+
export declare const displayTableRows: {
|
|
32
|
+
alias: string;
|
|
33
|
+
fontFamily: FontFamily;
|
|
34
|
+
fontSize: FontSize;
|
|
35
|
+
fontWeight: FontWeight;
|
|
36
|
+
lineHeight: LineHeights;
|
|
37
|
+
color: TextColor;
|
|
38
|
+
}[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { FontFamily, FontSize, FontWeight, LineHeights, TextColor, } from ".././../../utils/enums";
|
|
2
|
+
export var Display_Classes;
|
|
3
|
+
(function (Display_Classes) {
|
|
4
|
+
Display_Classes["lu-display-1"] = "lu-display-1";
|
|
5
|
+
Display_Classes["lu-display-2"] = "lu-display-2";
|
|
6
|
+
Display_Classes["lu-display-3"] = "lu-display-3";
|
|
7
|
+
})(Display_Classes || (Display_Classes = {}));
|
|
8
|
+
export var customDisplay = {
|
|
9
|
+
".lu-display-1": {
|
|
10
|
+
fontSize: "var(--core-800)",
|
|
11
|
+
fontWeight: "700",
|
|
12
|
+
lineHeight: "1.5",
|
|
13
|
+
color: "var(--black)",
|
|
14
|
+
},
|
|
15
|
+
".lu-display-2": {
|
|
16
|
+
fontSize: "var(--core-600)",
|
|
17
|
+
fontWeight: "600",
|
|
18
|
+
lineHeight: "1.5",
|
|
19
|
+
color: "var(--black)",
|
|
20
|
+
},
|
|
21
|
+
".lu-display-3": {
|
|
22
|
+
fontSize: "var(--core-400)",
|
|
23
|
+
fontWeight: "500",
|
|
24
|
+
lineHeight: "1.5",
|
|
25
|
+
color: "var(--black)",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export var displayTableHeaders = [
|
|
29
|
+
{ title: "Alias Token Name", key: "alias" },
|
|
30
|
+
{ title: "Font Family", key: "fontFamily" },
|
|
31
|
+
{ title: "Font Size", key: "fontSize" },
|
|
32
|
+
{ title: "Font Weight", key: "fontWeight" },
|
|
33
|
+
{ title: "Line Height", key: "lineHeight" },
|
|
34
|
+
{ title: "Color", key: "color" },
|
|
35
|
+
];
|
|
36
|
+
export var displayTableRows = [
|
|
37
|
+
{
|
|
38
|
+
alias: "lu-display-1",
|
|
39
|
+
fontFamily: FontFamily.Base,
|
|
40
|
+
fontSize: FontSize.Huge,
|
|
41
|
+
fontWeight: FontWeight.Regular,
|
|
42
|
+
lineHeight: LineHeights.BASE,
|
|
43
|
+
color: TextColor.Default,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
alias: "lu-display-2 ",
|
|
47
|
+
fontFamily: FontFamily.Base,
|
|
48
|
+
fontSize: FontSize.SevenXLarge,
|
|
49
|
+
fontWeight: FontWeight.SemiBold,
|
|
50
|
+
lineHeight: LineHeights.BASE,
|
|
51
|
+
color: TextColor.Default,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
alias: "lu-display-3",
|
|
55
|
+
fontFamily: FontFamily.Base,
|
|
56
|
+
fontSize: FontSize.FourXLarge,
|
|
57
|
+
fontWeight: FontWeight.Medium,
|
|
58
|
+
lineHeight: LineHeights.BASE,
|
|
59
|
+
color: TextColor.Default,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
5
|
+
import { Heading } from "./Headings";
|
|
6
|
+
import { Heading_Classes } from "./";
|
|
7
|
+
describe("Heading Component", function () {
|
|
8
|
+
it("renders with default props", function () {
|
|
9
|
+
render(_jsx(Heading, {}));
|
|
10
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
11
|
+
expect(divElement).toBeInTheDocument();
|
|
12
|
+
expect(divElement).toHaveClass(Heading_Classes["lu-heading-h1"]);
|
|
13
|
+
});
|
|
14
|
+
describe("Heading Component with different body classes", function () {
|
|
15
|
+
Object.values(Heading_Classes).forEach(function (headingClass) {
|
|
16
|
+
it("applies the correct class \"".concat(headingClass, "\""), function () {
|
|
17
|
+
render(_jsx(Heading, { heading: headingClass }));
|
|
18
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
19
|
+
expect(divElement).toHaveClass(headingClass);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it("applies additional class names from className prop", function () {
|
|
24
|
+
var customClass = "custom-class another-class";
|
|
25
|
+
render(_jsx(Heading, { className: customClass }));
|
|
26
|
+
var divElement = screen.getByText(Dummy_Para);
|
|
27
|
+
expect(divElement).toHaveClass(Heading_Classes["lu-heading-h1"]);
|
|
28
|
+
expect(divElement).toHaveClass("custom-class");
|
|
29
|
+
expect(divElement).toHaveClass("another-class");
|
|
30
|
+
});
|
|
31
|
+
it("renders custom label when provided", function () {
|
|
32
|
+
var customLabel = "Custom Label Text";
|
|
33
|
+
render(_jsx(Heading, { label: customLabel }));
|
|
34
|
+
var divElement = screen.getByText(customLabel);
|
|
35
|
+
expect(divElement).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
it("passes additional props to the root div", function () {
|
|
38
|
+
var testId = "body-component";
|
|
39
|
+
var ariaLabel = "Body Component";
|
|
40
|
+
render(_jsx(Heading, { "data-testid": testId, "aria-label": ariaLabel }));
|
|
41
|
+
var divElement = screen.getByTestId(testId);
|
|
42
|
+
expect(divElement).toHaveAttribute("aria-label", ariaLabel);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HeadingProps } from "
|
|
2
|
-
export declare const Heading: ({ heading, label, className }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { HeadingProps } from "./type";
|
|
2
|
+
export declare const Heading: ({ heading, label, className, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
25
|
+
import { Heading_Classes } from "./";
|
|
2
26
|
export var Heading = function (_a) {
|
|
3
|
-
var _b = _a.heading, heading = _b === void 0 ?
|
|
4
|
-
return (_jsx(
|
|
27
|
+
var _b = _a.heading, heading = _b === void 0 ? Heading_Classes["lu-heading-h1"] : _b, _c = _a.label, label = _c === void 0 ? Dummy_Para : _c, _d = _a.className, className = _d === void 0 ? "" : _d, props = __rest(_a, ["heading", "label", "className"]);
|
|
28
|
+
return (_jsx("h1", __assign({}, props, { className: "".concat(heading, " ").concat(className), children: label })));
|
|
5
29
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Meta } from "@storybook/react";
|
|
2
|
-
|
|
2
|
+
import { HeadingProps } from "./type";
|
|
3
|
+
declare const _default: Meta<HeadingProps>;
|
|
3
4
|
export default _default;
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const _Heading: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, HeadingProps>;
|
|
6
|
+
export declare const HeadingTokens: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,20 +12,51 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Heading } from "./Headings";
|
|
14
14
|
import { headingsList } from "../../../utils";
|
|
15
|
+
import Table from "../../../global/components/Table/Table";
|
|
16
|
+
import { Heading_Classes, headingTableHeaders, headingTableRows } from "./";
|
|
17
|
+
import { Dummy_Para } from "../../../utils/constants";
|
|
15
18
|
export default {
|
|
16
|
-
title: "Components/Typography/
|
|
19
|
+
title: "Components/Typography/Heading",
|
|
17
20
|
component: Heading,
|
|
18
21
|
};
|
|
19
22
|
var Template = function (args) { return _jsx(Heading, __assign({}, args)); };
|
|
20
|
-
export var
|
|
21
|
-
|
|
22
|
-
label:
|
|
23
|
-
heading:
|
|
24
|
-
className:
|
|
23
|
+
export var _Heading = Template.bind({});
|
|
24
|
+
_Heading.args = {
|
|
25
|
+
label: Dummy_Para,
|
|
26
|
+
heading: Heading_Classes["lu-heading-h1"],
|
|
27
|
+
className: "",
|
|
25
28
|
};
|
|
26
|
-
|
|
29
|
+
_Heading.argTypes = {
|
|
27
30
|
heading: {
|
|
28
|
-
control: {
|
|
31
|
+
control: {
|
|
32
|
+
type: "select",
|
|
33
|
+
labels: Object.fromEntries(headingsList.map(function (heading) { return [heading.key, heading.label]; })),
|
|
34
|
+
},
|
|
29
35
|
options: headingsList.map(function (heading) { return heading.key; }),
|
|
36
|
+
table: {
|
|
37
|
+
type: {
|
|
38
|
+
summary: Object.values(Heading_Classes)
|
|
39
|
+
.map(function (item) { return item; })
|
|
40
|
+
.join(" | "),
|
|
41
|
+
},
|
|
42
|
+
defaultValue: { summary: Heading_Classes["lu-heading-h1"] },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
label: {
|
|
46
|
+
description: "Text content",
|
|
47
|
+
control: "text",
|
|
48
|
+
table: {
|
|
49
|
+
type: { summary: "string" },
|
|
50
|
+
defaultValue: { summary: Dummy_Para },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
className: {
|
|
54
|
+
description: "Additional CSS classes",
|
|
55
|
+
control: "text",
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: "string" },
|
|
58
|
+
defaultValue: { summary: "" },
|
|
59
|
+
},
|
|
30
60
|
},
|
|
31
61
|
};
|
|
62
|
+
export var HeadingTokens = function () { return (_jsx(Table, { tableClassName: "lu-mb-500", headers: headingTableHeaders, rows: headingTableRows, "aria-label": "Heading text variants comparison" })); };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FontFamily, FontSize, FontWeight, LineHeights, TextColor } from "../../../utils/enums";
|
|
2
|
+
export declare const headingTableHeaders: {
|
|
3
|
+
title: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare enum Heading_Classes {
|
|
7
|
+
"lu-heading-h1" = "lu-heading-h1",
|
|
8
|
+
"lu-heading-h2" = "lu-heading-h2",
|
|
9
|
+
"lu-heading-h3" = "lu-heading-h3",
|
|
10
|
+
"lu-heading-h4" = "lu-heading-h4",
|
|
11
|
+
"lu-heading-h5" = "lu-heading-h5",
|
|
12
|
+
"lu-heading-h6" = "lu-heading-h6"
|
|
13
|
+
}
|
|
14
|
+
export declare const headingTableRows: {
|
|
15
|
+
headingClass: Heading_Classes;
|
|
16
|
+
fontFamily: FontFamily;
|
|
17
|
+
fontSize: FontSize;
|
|
18
|
+
fontWeight: FontWeight;
|
|
19
|
+
lineHeight: LineHeights;
|
|
20
|
+
color: TextColor;
|
|
21
|
+
}[];
|