@agility/plenum-ui 2.1.28 → 2.2.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/.storybook/preview.tsx +7 -6
- package/dist/index.d.ts +111 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/tailwind.css +65 -1
- package/dist/types/stories/atoms/Typography/Heading/Heading.d.ts +8 -0
- package/dist/types/stories/atoms/Typography/Heading/Heading.stories.d.ts +12 -0
- package/dist/types/stories/atoms/Typography/Heading/index.d.ts +3 -0
- package/dist/types/stories/atoms/Typography/Label/Label.d.ts +10 -0
- package/dist/types/stories/atoms/Typography/Label/Label.stories.d.ts +12 -0
- package/dist/types/stories/atoms/Typography/Label/index.d.ts +3 -0
- package/dist/types/stories/atoms/Typography/Paragraph/Paragraph.d.ts +10 -0
- package/dist/types/stories/atoms/Typography/Paragraph/Paragraph.stories.d.ts +11 -0
- package/dist/types/stories/atoms/Typography/Paragraph/index.d.ts +3 -0
- package/dist/types/stories/atoms/index.d.ts +5 -2
- package/dist/types/stories/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +4 -0
- package/package.json +1 -1
- package/stories/atoms/Typography/Heading/Heading.stories.ts +40 -0
- package/stories/atoms/Typography/Heading/Heading.tsx +26 -0
- package/stories/atoms/Typography/Heading/index.ts +3 -0
- package/stories/atoms/Typography/Label/Label.stories.ts +40 -0
- package/stories/atoms/Typography/Label/Label.tsx +25 -0
- package/stories/atoms/Typography/Label/index.ts +3 -0
- package/stories/atoms/Typography/Paragraph/Paragraph.stories.ts +36 -0
- package/stories/atoms/Typography/Paragraph/Paragraph.tsx +25 -0
- package/stories/atoms/Typography/Paragraph/index.ts +3 -0
- package/stories/atoms/index.ts +16 -8
- package/stories/index.ts +15 -3
- package/stories/molecules/inputs/TextInput/TextInput.tsx +59 -46
- package/tailwind.config.js +1 -1
package/dist/tailwind.css
CHANGED
|
@@ -67985,6 +67985,34 @@ select {
|
|
|
67985
67985
|
line-height: 3.75rem;
|
|
67986
67986
|
}
|
|
67987
67987
|
|
|
67988
|
+
.text-\[10px\] {
|
|
67989
|
+
font-size: 10px;
|
|
67990
|
+
}
|
|
67991
|
+
|
|
67992
|
+
.text-\[20px\] {
|
|
67993
|
+
font-size: 20px;
|
|
67994
|
+
}
|
|
67995
|
+
|
|
67996
|
+
.text-\[24px\] {
|
|
67997
|
+
font-size: 24px;
|
|
67998
|
+
}
|
|
67999
|
+
|
|
68000
|
+
.text-\[28px\] {
|
|
68001
|
+
font-size: 28px;
|
|
68002
|
+
}
|
|
68003
|
+
|
|
68004
|
+
.text-\[32px\] {
|
|
68005
|
+
font-size: 32px;
|
|
68006
|
+
}
|
|
68007
|
+
|
|
68008
|
+
.text-\[36px\] {
|
|
68009
|
+
font-size: 36px;
|
|
68010
|
+
}
|
|
68011
|
+
|
|
68012
|
+
.text-\[40px\] {
|
|
68013
|
+
font-size: 40px;
|
|
68014
|
+
}
|
|
68015
|
+
|
|
67988
68016
|
.text-base {
|
|
67989
68017
|
font-size: 1rem;
|
|
67990
68018
|
line-height: 1.5rem;
|
|
@@ -68031,7 +68059,7 @@ select {
|
|
|
68031
68059
|
}
|
|
68032
68060
|
|
|
68033
68061
|
.font-medium {
|
|
68034
|
-
font-weight:
|
|
68062
|
+
font-weight: 500;
|
|
68035
68063
|
}
|
|
68036
68064
|
|
|
68037
68065
|
.font-normal {
|
|
@@ -68058,10 +68086,46 @@ select {
|
|
|
68058
68086
|
line-height: 1.25rem;
|
|
68059
68087
|
}
|
|
68060
68088
|
|
|
68089
|
+
.leading-\[12px\] {
|
|
68090
|
+
line-height: 12px;
|
|
68091
|
+
}
|
|
68092
|
+
|
|
68093
|
+
.leading-\[14px\] {
|
|
68094
|
+
line-height: 14px;
|
|
68095
|
+
}
|
|
68096
|
+
|
|
68097
|
+
.leading-\[28px\] {
|
|
68098
|
+
line-height: 28px;
|
|
68099
|
+
}
|
|
68100
|
+
|
|
68101
|
+
.leading-\[32px\] {
|
|
68102
|
+
line-height: 32px;
|
|
68103
|
+
}
|
|
68104
|
+
|
|
68105
|
+
.leading-\[36px\] {
|
|
68106
|
+
line-height: 36px;
|
|
68107
|
+
}
|
|
68108
|
+
|
|
68109
|
+
.leading-\[40px\] {
|
|
68110
|
+
line-height: 40px;
|
|
68111
|
+
}
|
|
68112
|
+
|
|
68113
|
+
.leading-\[44px\] {
|
|
68114
|
+
line-height: 44px;
|
|
68115
|
+
}
|
|
68116
|
+
|
|
68117
|
+
.leading-\[48px\] {
|
|
68118
|
+
line-height: 48px;
|
|
68119
|
+
}
|
|
68120
|
+
|
|
68061
68121
|
.leading-none {
|
|
68062
68122
|
line-height: 1;
|
|
68063
68123
|
}
|
|
68064
68124
|
|
|
68125
|
+
.tracking-\[-0\.8px\] {
|
|
68126
|
+
letter-spacing: -0.8px;
|
|
68127
|
+
}
|
|
68128
|
+
|
|
68065
68129
|
.\!text-gray-500 {
|
|
68066
68130
|
--tw-text-opacity: 1 !important;
|
|
68067
68131
|
color: rgb(107 114 128 / var(--tw-text-opacity, 1)) !important;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
2
|
+
export interface HeadingProps {
|
|
3
|
+
level: HeadingLevel;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function Heading({ level, children, className }: HeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Heading from "./Heading";
|
|
3
|
+
declare const meta: Meta<typeof Heading>;
|
|
4
|
+
type Story = StoryObj<typeof Heading>;
|
|
5
|
+
export declare const Heading1: Story;
|
|
6
|
+
export declare const Heading2: Story;
|
|
7
|
+
export declare const Heading3: Story;
|
|
8
|
+
export declare const Heading4: Story;
|
|
9
|
+
export declare const Heading5: Story;
|
|
10
|
+
export declare const Heading6: Story;
|
|
11
|
+
export declare const HeadingWithCustomClassName: Story;
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type LabelAs = "span" | "p" | "label" | "strong" | "em";
|
|
2
|
+
type LabelSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
3
|
+
export interface LabelProps {
|
|
4
|
+
as?: LabelAs;
|
|
5
|
+
size?: LabelSize;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function Label({ as, size, children, className }: LabelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Label from "./Label";
|
|
3
|
+
declare const meta: Meta<typeof Label>;
|
|
4
|
+
type Story = StoryObj<typeof Label>;
|
|
5
|
+
export declare const DefaultLabel: Story;
|
|
6
|
+
export declare const ExtraLargeLabel: Story;
|
|
7
|
+
export declare const LargeLabel: Story;
|
|
8
|
+
export declare const MediumLabel: Story;
|
|
9
|
+
export declare const SmallLabel: Story;
|
|
10
|
+
export declare const ExtraSmallLabel: Story;
|
|
11
|
+
export declare const LabelWithCustomStyle: Story;
|
|
12
|
+
export default meta;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ParagraphAs = "span" | "p" | "label" | "strong" | "em";
|
|
2
|
+
type ParagraphSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
3
|
+
export interface ParagraphProps {
|
|
4
|
+
as?: ParagraphAs;
|
|
5
|
+
size?: ParagraphSize;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function Paragraph({ as, size, children, className }: ParagraphProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Paragraph from "./Paragraph";
|
|
3
|
+
declare const meta: Meta<typeof Paragraph>;
|
|
4
|
+
type Story = StoryObj<typeof Paragraph>;
|
|
5
|
+
export declare const DefaultParagraph: Story;
|
|
6
|
+
export declare const LargeParagraph: Story;
|
|
7
|
+
export declare const MediumParagraph: Story;
|
|
8
|
+
export declare const SmallParagraph: Story;
|
|
9
|
+
export declare const ExtraSmallParagraph: Story;
|
|
10
|
+
export declare const ParagraphWithCustomStyle: Story;
|
|
11
|
+
export default meta;
|
|
@@ -3,5 +3,8 @@ import Badge, { IBadgeProps } from "./badges";
|
|
|
3
3
|
import { Button, Capsule, BTNActionType, IButtonProps, ICapsuleProps } from "./buttons";
|
|
4
4
|
import { DynamicIcon, FAIconName, IDynamicIconProps, IIconWithShadowProps, IconName, IconWithShadow, UnifiedIconName, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName } from "./icons";
|
|
5
5
|
import { ILoaderProps, IRadialProgressProps, Loader, RadialProgress } from "./loaders";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { Heading, HeadingProps } from "./Typography/Heading";
|
|
7
|
+
import { Label, LabelProps } from "./Typography/Label";
|
|
8
|
+
import { Paragraph, ParagraphProps } from "./Typography/Paragraph";
|
|
9
|
+
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, HeadingProps, LabelProps, ParagraphProps, UnifiedIconName, IconName, FAIconName, BTNActionType };
|
|
10
|
+
export { Avatar, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, Heading, Label, Paragraph, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, UnifiedIconName, IconName, FAIconName, BTNActionType, Avatar, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName } from "./atoms";
|
|
1
|
+
import { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, UnifiedIconName, IconName, FAIconName, BTNActionType, Avatar, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName, Heading, HeadingProps, Label, LabelProps, Paragraph, ParagraphProps } from "./atoms";
|
|
2
2
|
import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput, ITextInputProps, ISimpleSelectOptions } from "./molecules";
|
|
3
3
|
import { IAnimatedLabelInputProps, AnimatedLabelTextArea, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect, ITextInputSelectProps, IAnimatedFormInputWithAddons, AnimatedFormInputWithAddons, DropdownWithMultiSelect, MultiSelectItemProps } from "./organisms";
|
|
4
|
-
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, ITextInputSelectProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, UnifiedIconName, IconName, FAIconName, BTNActionType, ITextInputProps, ISimpleSelectOptions, IAnimatedFormInputWithAddons, MultiSelectItemProps };
|
|
5
|
-
export { Avatar, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName, TextInput, TextInputSelect, AnimatedFormInputWithAddons, DropdownWithMultiSelect };
|
|
4
|
+
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, ITextInputSelectProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, UnifiedIconName, IconName, FAIconName, BTNActionType, ITextInputProps, ISimpleSelectOptions, IAnimatedFormInputWithAddons, MultiSelectItemProps, HeadingProps, LabelProps, ParagraphProps };
|
|
5
|
+
export { Avatar, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName, TextInput, TextInputSelect, AnimatedFormInputWithAddons, DropdownWithMultiSelect, Heading, Label, Paragraph };
|
|
@@ -34,6 +34,10 @@ export interface ITextInputProps {
|
|
|
34
34
|
/**Placeholder input text*/
|
|
35
35
|
placeholder?: string;
|
|
36
36
|
className?: string;
|
|
37
|
+
/** Callback on focus */
|
|
38
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
39
|
+
/** Callback on blur */
|
|
40
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
37
41
|
}
|
|
38
42
|
declare const _TextInput: React.ForwardRefExoticComponent<ITextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
39
43
|
export default _TextInput;
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Heading from "./Heading";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Heading> = {
|
|
5
|
+
title: "Design System/atoms/Typography/Heading",
|
|
6
|
+
component: Heading,
|
|
7
|
+
tags: ["autodocs"]
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof Heading>;
|
|
11
|
+
|
|
12
|
+
export const Heading1: Story = {
|
|
13
|
+
args: { level: 1, children: "Heading 1", className: "" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Heading2: Story = {
|
|
17
|
+
args: { level: 2, children: "Heading 2", className: "" }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Heading3: Story = {
|
|
21
|
+
args: { level: 3, children: "Heading 3", className: "" }
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Heading4: Story = {
|
|
25
|
+
args: { level: 4, children: "Heading 4", className: "" }
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Heading5: Story = {
|
|
29
|
+
args: { level: 5, children: "Heading 5", className: "" }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Heading6: Story = {
|
|
33
|
+
args: { level: 6, children: "Heading 6", className: "" }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const HeadingWithCustomClassName: Story = {
|
|
37
|
+
args: { level: 1, children: "Heading 1", className: "text-red-500" }
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as cn } from "classnames";
|
|
2
|
+
|
|
3
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
4
|
+
|
|
5
|
+
export interface HeadingProps {
|
|
6
|
+
level: HeadingLevel;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const headingStyles: Record<HeadingLevel, string> = {
|
|
12
|
+
1: "text-[40px] leading-[48px]",
|
|
13
|
+
2: "text-[36px] leading-[44px]",
|
|
14
|
+
3: "text-[32px] leading-[40px]",
|
|
15
|
+
4: "text-[28px] leading-[36px]",
|
|
16
|
+
5: "text-[24px] leading-[32px]",
|
|
17
|
+
6: "text-[20px] leading-[28px]"
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default function Heading({ level, children, className }: HeadingProps) {
|
|
21
|
+
const Tag = `h${level}` as const;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Tag className={cn("gray-900 font-medium tracking-[-0.8px]", headingStyles[level], className)}>{children}</Tag>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Label from "./Label";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Label> = {
|
|
5
|
+
title: "Design System/atoms/Typography/Label",
|
|
6
|
+
component: Label,
|
|
7
|
+
tags: ["autodocs"]
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof Label>;
|
|
11
|
+
|
|
12
|
+
export const DefaultLabel: Story = {
|
|
13
|
+
args: { children: "Default Label" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ExtraLargeLabel: Story = {
|
|
17
|
+
args: { children: "Extra Large Label", size: "xl" }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const LargeLabel: Story = {
|
|
21
|
+
args: { children: "Large Label", size: "lg" }
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const MediumLabel: Story = {
|
|
25
|
+
args: { children: "Medium Label", size: "md" }
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const SmallLabel: Story = {
|
|
29
|
+
args: { children: "Small Label", size: "sm" }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ExtraSmallLabel: Story = {
|
|
33
|
+
args: { children: "Extra Small Label", size: "xs" }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const LabelWithCustomStyle: Story = {
|
|
37
|
+
args: { children: "Label With Custom Style", className: "text-red-500" }
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as cn } from "classnames";
|
|
2
|
+
|
|
3
|
+
type LabelAs = "span" | "p" | "label" | "strong" | "em";
|
|
4
|
+
type LabelSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
5
|
+
|
|
6
|
+
export interface LabelProps {
|
|
7
|
+
as?: LabelAs;
|
|
8
|
+
size?: LabelSize;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const labelStyles: Record<LabelSize, string> = {
|
|
14
|
+
xl: "text-lg tracking[-0.36px]",
|
|
15
|
+
lg: "text-base tracking[-0.32px]",
|
|
16
|
+
md: "text-sm tracking[-0.28px]",
|
|
17
|
+
sm: "text-xs tracking[-0.24px]",
|
|
18
|
+
xs: "text-[10px] leading-[14px] tracking[-0.2px]"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default function Label({ as = "span", size = "md", children, className }: LabelProps) {
|
|
22
|
+
const Tag = as;
|
|
23
|
+
|
|
24
|
+
return <Tag className={cn("gray-900 font-normal", labelStyles[size], className)}>{children}</Tag>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Paragraph from "./Paragraph";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Paragraph> = {
|
|
5
|
+
title: "Design System/atoms/Typography/Paragraph",
|
|
6
|
+
component: Paragraph,
|
|
7
|
+
tags: ["autodocs"]
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof Paragraph>;
|
|
11
|
+
|
|
12
|
+
export const DefaultParagraph: Story = {
|
|
13
|
+
args: { children: "Default Paragraph" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const LargeParagraph: Story = {
|
|
17
|
+
args: { children: "Large Paragraph", size: "lg" }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const MediumParagraph: Story = {
|
|
21
|
+
args: { children: "Medium Paragraph", size: "md" }
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const SmallParagraph: Story = {
|
|
25
|
+
args: { children: "Small Paragraph", size: "sm" }
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const ExtraSmallParagraph: Story = {
|
|
29
|
+
args: { children: "Extra Small Paragraph", size: "xs" }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ParagraphWithCustomStyle: Story = {
|
|
33
|
+
args: { children: "Paragraph With Custom Style", className: "text-red-500" }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as cn } from "classnames";
|
|
2
|
+
|
|
3
|
+
type ParagraphAs = "span" | "p" | "label" | "strong" | "em";
|
|
4
|
+
type ParagraphSize = "xl" | "lg" | "md" | "sm" | "xs";
|
|
5
|
+
|
|
6
|
+
export interface ParagraphProps {
|
|
7
|
+
as?: ParagraphAs;
|
|
8
|
+
size?: ParagraphSize;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const paragraphStyles: Record<ParagraphSize, string> = {
|
|
14
|
+
xl: "text-lg",
|
|
15
|
+
lg: "text-base",
|
|
16
|
+
md: "text-sm",
|
|
17
|
+
sm: "text-xs",
|
|
18
|
+
xs: "text-[10px] leading-[12px]"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default function Paragraph({ as = "p", size = "md", children, className }: ParagraphProps) {
|
|
22
|
+
const Tag = as;
|
|
23
|
+
|
|
24
|
+
return <Tag className={cn("gray-900 font-normal", paragraphStyles[size], className)}>{children}</Tag>;
|
|
25
|
+
}
|
package/stories/atoms/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Avatar, { IAvatarProps } from "./Avatar"
|
|
2
|
-
import Badge, { IBadgeProps } from "./badges"
|
|
3
|
-
import { Button, Capsule, BTNActionType, IButtonProps, ICapsuleProps } from "./buttons"
|
|
1
|
+
import Avatar, { IAvatarProps } from "./Avatar";
|
|
2
|
+
import Badge, { IBadgeProps } from "./badges";
|
|
3
|
+
import { Button, Capsule, BTNActionType, IButtonProps, ICapsuleProps } from "./buttons";
|
|
4
4
|
import {
|
|
5
5
|
DynamicIcon,
|
|
6
6
|
FAIconName,
|
|
@@ -13,9 +13,11 @@ import {
|
|
|
13
13
|
isHeroIcon,
|
|
14
14
|
isTablerIcon,
|
|
15
15
|
isUnifiedIconName
|
|
16
|
-
} from "./icons"
|
|
17
|
-
import { ILoaderProps, IRadialProgressProps, Loader, RadialProgress } from "./loaders"
|
|
18
|
-
|
|
16
|
+
} from "./icons";
|
|
17
|
+
import { ILoaderProps, IRadialProgressProps, Loader, RadialProgress } from "./loaders";
|
|
18
|
+
import { Heading, HeadingProps } from "./Typography/Heading";
|
|
19
|
+
import { Label, LabelProps } from "./Typography/Label";
|
|
20
|
+
import { Paragraph, ParagraphProps } from "./Typography/Paragraph";
|
|
19
21
|
export type {
|
|
20
22
|
IAvatarProps,
|
|
21
23
|
IBadgeProps,
|
|
@@ -25,11 +27,14 @@ export type {
|
|
|
25
27
|
IIconWithShadowProps,
|
|
26
28
|
ILoaderProps,
|
|
27
29
|
IRadialProgressProps,
|
|
30
|
+
HeadingProps,
|
|
31
|
+
LabelProps,
|
|
32
|
+
ParagraphProps,
|
|
28
33
|
UnifiedIconName,
|
|
29
34
|
IconName,
|
|
30
35
|
FAIconName,
|
|
31
36
|
BTNActionType
|
|
32
|
-
}
|
|
37
|
+
};
|
|
33
38
|
export {
|
|
34
39
|
Avatar,
|
|
35
40
|
Badge,
|
|
@@ -39,8 +44,11 @@ export {
|
|
|
39
44
|
IconWithShadow,
|
|
40
45
|
Loader,
|
|
41
46
|
RadialProgress,
|
|
47
|
+
Heading,
|
|
48
|
+
Label,
|
|
49
|
+
Paragraph,
|
|
42
50
|
isFAIcon,
|
|
43
51
|
isHeroIcon,
|
|
44
52
|
isTablerIcon,
|
|
45
53
|
isUnifiedIconName
|
|
46
|
-
}
|
|
54
|
+
};
|
package/stories/index.ts
CHANGED
|
@@ -23,7 +23,13 @@ import {
|
|
|
23
23
|
isFAIcon,
|
|
24
24
|
isHeroIcon,
|
|
25
25
|
isTablerIcon,
|
|
26
|
-
isUnifiedIconName
|
|
26
|
+
isUnifiedIconName,
|
|
27
|
+
Heading,
|
|
28
|
+
HeadingProps,
|
|
29
|
+
Label,
|
|
30
|
+
LabelProps,
|
|
31
|
+
Paragraph,
|
|
32
|
+
ParagraphProps
|
|
27
33
|
} from "./atoms";
|
|
28
34
|
// Molecular Components, props, and type guards.
|
|
29
35
|
import {
|
|
@@ -107,7 +113,10 @@ export type {
|
|
|
107
113
|
ITextInputProps,
|
|
108
114
|
ISimpleSelectOptions,
|
|
109
115
|
IAnimatedFormInputWithAddons,
|
|
110
|
-
MultiSelectItemProps
|
|
116
|
+
MultiSelectItemProps,
|
|
117
|
+
HeadingProps,
|
|
118
|
+
LabelProps,
|
|
119
|
+
ParagraphProps
|
|
111
120
|
};
|
|
112
121
|
export {
|
|
113
122
|
Avatar,
|
|
@@ -140,5 +149,8 @@ export {
|
|
|
140
149
|
TextInput,
|
|
141
150
|
TextInputSelect,
|
|
142
151
|
AnimatedFormInputWithAddons,
|
|
143
|
-
DropdownWithMultiSelect
|
|
152
|
+
DropdownWithMultiSelect,
|
|
153
|
+
Heading,
|
|
154
|
+
Label,
|
|
155
|
+
Paragraph
|
|
144
156
|
};
|