@agility/plenum-ui 2.0.0-rc1 → 2.0.0-rc10
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 +1 -1
- package/build.js +8 -0
- package/dist/index.d.ts +1117 -0
- package/dist/index.js +515 -155
- package/dist/index.js.map +4 -4
- package/dist/lib/tailwind.css +63535 -0
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +6 -4
- package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
- package/dist/types/stories/index.d.ts +4 -4
- package/dist/types/stories/molecules/index.d.ts +3 -3
- package/dist/types/stories/molecules/inputs/InputCounter/InputCounter.d.ts +10 -0
- package/dist/types/stories/molecules/inputs/InputCounter/index.d.ts +2 -0
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +3 -1
- package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +39 -0
- package/dist/types/stories/molecules/inputs/TextInput/index.d.ts +4 -0
- package/dist/types/stories/molecules/inputs/index.d.ts +5 -4
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -2
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +30 -21
- package/dist/types/stories/molecules/inputs/textArea/TextArea.stories.d.ts +4 -4
- package/dist/types/stories/molecules/inputs/textArea/index.d.ts +3 -3
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +2 -2
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +3 -7
- package/dist/types/stories/organisms/TextInputSelect/InputSelect.d.ts +16 -0
- package/dist/types/stories/organisms/TextInputSelect/TextInputSelect.d.ts +48 -0
- package/dist/types/stories/organisms/TextInputSelect/index.d.ts +3 -0
- package/dist/types/stories/organisms/index.d.ts +3 -2
- package/package.json +4 -3
- package/stories/Introduction.mdx +1 -1
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Button.tsx +25 -2
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +7 -0
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +7 -0
- package/stories/index.ts +18 -8
- package/stories/molecules/index.ts +22 -6
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -0
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -0
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -0
- package/stories/molecules/inputs/InputField/InputField.tsx +7 -1
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -0
- package/stories/molecules/inputs/TextInput/TextInput.tsx +162 -0
- package/stories/molecules/inputs/TextInput/index.tsx +5 -0
- package/stories/molecules/inputs/index.ts +18 -4
- package/stories/molecules/inputs/select/Select.tsx +1 -1
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +7 -5
- package/stories/molecules/inputs/textArea/TextArea.tsx +110 -49
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +3 -3
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +111 -80
- package/stories/organisms/DropdownComponent/dropdownItems.ts +8 -8
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -0
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -0
- package/stories/organisms/TextInputSelect/index.tsx +3 -0
- package/stories/organisms/index.ts +4 -2
|
@@ -7,6 +7,7 @@ export declare const Alternative: Story;
|
|
|
7
7
|
export declare const AlternativeTrailingIcon: Story;
|
|
8
8
|
export declare const AlternativeLeadingIcon: Story;
|
|
9
9
|
export declare const AlternativeExtraSmall: Story;
|
|
10
|
+
export declare const AlternativeSimpleIconName: Story;
|
|
10
11
|
export declare const AlternativeSmall: Story;
|
|
11
12
|
export declare const AlternativeMedium: Story;
|
|
12
13
|
export declare const AlternativeLarge: Story;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { HTMLAttributeAnchorTarget } from "react";
|
|
2
|
-
import { IDynamicIconProps } from "../../icons";
|
|
2
|
+
import { UnifiedIconName, IDynamicIconProps } from "../../icons";
|
|
3
3
|
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger";
|
|
4
4
|
export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
5
5
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
6
|
-
actionType
|
|
6
|
+
actionType?: BTNActionType;
|
|
7
7
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
8
8
|
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
9
|
/** The Button's text content. */
|
|
10
10
|
label: string;
|
|
11
11
|
/** The Icon to be displayed inside the button. */
|
|
12
|
-
icon?: IDynamicIconProps;
|
|
12
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
13
13
|
/** Does the button width grow to fill it's container? */
|
|
14
14
|
fullWidth?: boolean;
|
|
15
15
|
/** Optionally render as anchor tag */
|
|
@@ -25,9 +25,11 @@ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
|
25
25
|
/** Is the associated content loading? */
|
|
26
26
|
isLoading?: boolean;
|
|
27
27
|
className?: string;
|
|
28
|
+
iconObj?: React.ReactNode;
|
|
29
|
+
ref?: React.LegacyRef<HTMLButtonElement>;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Primary UI component for user interaction
|
|
31
33
|
*/
|
|
32
|
-
declare const Button: ({ actionType, size, label, icon, CustomSVGIcon, fullWidth, iconPosition, asLink, isLoading, className, ...props }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
declare const Button: ({ actionType, size, label, icon, iconObj, CustomSVGIcon, fullWidth, iconPosition, asLink, isLoading, className, ref, ...props }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
35
|
export default Button;
|
|
@@ -6,6 +6,7 @@ type Story = StoryObj<typeof Button>;
|
|
|
6
6
|
export declare const Danger: Story;
|
|
7
7
|
export declare const DangerTrailingIcon: Story;
|
|
8
8
|
export declare const DangerLeadingIcon: Story;
|
|
9
|
+
export declare const DangerSimpleIconName: Story;
|
|
9
10
|
export declare const DangerExtraSmall: Story;
|
|
10
11
|
export declare const DangerSmall: Story;
|
|
11
12
|
export declare const DangerMedium: Story;
|
|
@@ -5,6 +5,7 @@ export default meta;
|
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
6
|
export declare const Primary: Story;
|
|
7
7
|
export declare const PrimaryLeadingIcon: Story;
|
|
8
|
+
export declare const PrimarySimpleIconName: Story;
|
|
8
9
|
export declare const PrimaryTrailingIcon: Story;
|
|
9
10
|
export declare const PrimaryExtraSmall: Story;
|
|
10
11
|
export declare const PrimarySmall: Story;
|
|
@@ -6,6 +6,7 @@ type Story = StoryObj<typeof Button>;
|
|
|
6
6
|
export declare const Secondary: Story;
|
|
7
7
|
export declare const SecondaryTrailingIcon: Story;
|
|
8
8
|
export declare const SecondaryLeadingIcon: Story;
|
|
9
|
+
export declare const SecondarySimpleIconName: Story;
|
|
9
10
|
export declare const SecondaryExtraSmall: Story;
|
|
10
11
|
export declare const SecondarySmall: Story;
|
|
11
12
|
export declare const SecondaryMedium: Story;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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";
|
|
2
|
-
import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps,
|
|
3
|
-
import { IAnimatedLabelInputProps, IButtonDropdownProps, IDropdownClassnames, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons } from "./organisms";
|
|
4
|
-
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps,
|
|
5
|
-
export { Avatar, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select,
|
|
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
|
+
import { IAnimatedLabelInputProps, IButtonDropdownProps, IDropdownClassnames, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect, ITextInputSelectProps } 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, IButtonDropdownProps, IDropdownClassnames, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, UnifiedIconName, IconName, FAIconName, BTNActionType, ITextInputProps, ISimpleSelectOptions };
|
|
5
|
+
export { Avatar, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, Badge, Button, Capsule, DynamicIcon, IconWithShadow, Loader, RadialProgress, isFAIcon, isHeroIcon, isTablerIcon, isUnifiedIconName, TextInput, TextInputSelect };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps,
|
|
2
|
-
export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps,
|
|
3
|
-
export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select,
|
|
1
|
+
import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ISimpleSelectOptions, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, ITextInputProps, TextInput } from "./inputs";
|
|
2
|
+
export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ISimpleSelectOptions, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, ITextInputProps };
|
|
3
|
+
export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export interface IInputCounterProps {
|
|
3
|
+
/** Counter limit */
|
|
4
|
+
limit: number | undefined;
|
|
5
|
+
/** Counter current number */
|
|
6
|
+
current: number;
|
|
7
|
+
}
|
|
8
|
+
/** Primary UI component for user interaction */
|
|
9
|
+
declare const InputCounter: FC<IInputCounterProps>;
|
|
10
|
+
export default InputCounter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type AcceptedInputTypes = "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "submit" | "tel" | "text" | "url";
|
|
2
|
+
export type AcceptedInputTypes = "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "submit" | "tel" | "text" | "url" | "currency";
|
|
3
3
|
export interface IInputFieldProps extends React.ComponentPropsWithoutRef<"input"> {
|
|
4
4
|
/** Callback on change */
|
|
5
5
|
handleChange: (value: string) => void;
|
|
@@ -23,6 +23,8 @@ export interface IInputFieldProps extends React.ComponentPropsWithoutRef<"input"
|
|
|
23
23
|
required?: boolean;
|
|
24
24
|
/** use input psuedo classes for :valid and :invalid styles. on by default */
|
|
25
25
|
clientSideCheck?: boolean;
|
|
26
|
+
/**ref for input */
|
|
27
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
26
28
|
}
|
|
27
29
|
declare const InputField: React.FC<IInputFieldProps>;
|
|
28
30
|
export default InputField;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AcceptedInputTypes } from "../InputField";
|
|
3
|
+
export interface ITextInputProps {
|
|
4
|
+
/** Input type*/
|
|
5
|
+
type: AcceptedInputTypes;
|
|
6
|
+
/** Input ID */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** Input Name */
|
|
9
|
+
name?: string;
|
|
10
|
+
/** Label for the input */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Force the focus state on the input */
|
|
13
|
+
isFocused?: boolean;
|
|
14
|
+
/** Error state */
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
/** If field is required */
|
|
17
|
+
isRequired?: boolean;
|
|
18
|
+
/** Disabled state */
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/** Readonly state */
|
|
21
|
+
isReadonly?: boolean;
|
|
22
|
+
/** Set default value */
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/** Message shown under the text field */
|
|
25
|
+
message?: string;
|
|
26
|
+
/** Input character counter */
|
|
27
|
+
isShowCounter?: boolean;
|
|
28
|
+
/** Max length of input character */
|
|
29
|
+
maxLength?: number;
|
|
30
|
+
/** Callback on change */
|
|
31
|
+
onChange(value: string): void;
|
|
32
|
+
/** input value */
|
|
33
|
+
value: string;
|
|
34
|
+
/**Placeholder input text*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const _TextInput: React.ForwardRefExoticComponent<ITextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
39
|
+
export default _TextInput;
|
|
@@ -4,8 +4,9 @@ import InputField, { AcceptedInputTypes, IInputFieldProps } from "./InputField";
|
|
|
4
4
|
import InputLabel, { IInputLabelProps } from "./InputLabel";
|
|
5
5
|
import NestedInputButton, { INestedInputButtonProps } from "./NestedInputButton";
|
|
6
6
|
import Radio, { IRadioProps } from "./radio";
|
|
7
|
-
import Select, { ISelectProps } from "./select";
|
|
8
|
-
import
|
|
7
|
+
import Select, { ISelectProps, ISimpleSelectOptions } from "./select";
|
|
8
|
+
import Textarea, { ITextareaProps } from "./textArea";
|
|
9
|
+
import TextInput, { ITextInputProps } from "./TextInput";
|
|
9
10
|
import ToggleSwitch, { IToggleSwitchProps } from "./toggleSwitch";
|
|
10
|
-
export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps,
|
|
11
|
-
export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select,
|
|
11
|
+
export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ISimpleSelectOptions, ITextareaProps, ITextInputProps, IToggleSwitchProps, AcceptedInputTypes };
|
|
12
|
+
export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput };
|
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
export interface
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
isFocused?: boolean;
|
|
11
|
-
/** Error condition */
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
3
|
+
/** Input ID */
|
|
4
|
+
id?: string;
|
|
5
|
+
/** Input Name */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** Label for the input */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Error state */
|
|
12
10
|
isError?: boolean;
|
|
11
|
+
/** If field is required */
|
|
12
|
+
isRequired?: boolean;
|
|
13
13
|
/** Disabled state */
|
|
14
14
|
isDisabled?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
/** Set default value */
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
/** Message shown under the text field */
|
|
19
|
+
message?: string;
|
|
20
|
+
/** Input character counter */
|
|
21
|
+
isShowCounter?: boolean;
|
|
22
|
+
/** Max length of input character */
|
|
23
|
+
maxLength?: number;
|
|
24
|
+
/** Callback on change */
|
|
25
|
+
onChange?(value: string): void;
|
|
26
|
+
/** Number of rows */
|
|
27
|
+
rows?: number;
|
|
28
|
+
/** Number of cols */
|
|
29
|
+
cols?: number;
|
|
30
|
+
placeholder?: string;
|
|
23
31
|
className?: string;
|
|
32
|
+
ref?: React.LegacyRef<HTMLTextAreaElement>;
|
|
24
33
|
}
|
|
25
|
-
declare const
|
|
26
|
-
export default
|
|
34
|
+
declare const Textarea: React.FC<ITextareaProps>;
|
|
35
|
+
export default Textarea;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import
|
|
3
|
-
declare const meta: Meta<typeof
|
|
4
|
-
type Story = StoryObj<typeof
|
|
5
|
-
export declare const
|
|
2
|
+
import Textarea from "./TextArea";
|
|
3
|
+
declare const meta: Meta<typeof Textarea>;
|
|
4
|
+
type Story = StoryObj<typeof Textarea>;
|
|
5
|
+
export declare const DefaultTextarea: Story;
|
|
6
6
|
export default meta;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type {
|
|
3
|
-
export default
|
|
1
|
+
import TextArea, { ITextareaProps } from "./TextArea";
|
|
2
|
+
export type { ITextareaProps };
|
|
3
|
+
export default TextArea;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IInputFieldProps } from "@/stories/molecules/inputs/InputField";
|
|
3
|
-
import {
|
|
3
|
+
import { ITextareaProps } from "@/stories/molecules/inputs/textArea/TextArea";
|
|
4
4
|
interface ILabelProps extends React.ComponentPropsWithoutRef<"label"> {
|
|
5
5
|
display: string;
|
|
6
6
|
}
|
|
@@ -9,7 +9,7 @@ export interface IAnimatedLabelInputProps {
|
|
|
9
9
|
containerStyles?: string;
|
|
10
10
|
message?: string;
|
|
11
11
|
input?: IInputFieldProps;
|
|
12
|
-
textarea?:
|
|
12
|
+
textarea?: ITextareaProps;
|
|
13
13
|
required?: boolean;
|
|
14
14
|
isError?: boolean;
|
|
15
15
|
label: ILabelProps;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import React, { HTMLAttributes } from "react";
|
|
2
2
|
import { Placement } from "@floating-ui/react";
|
|
3
3
|
import { ClassNameWithAutocomplete } from "utils/types";
|
|
4
|
-
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
4
|
+
import { IDynamicIconProps, UnifiedIconName } from "@/stories/atoms/icons";
|
|
5
5
|
export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
|
|
6
|
-
icon?:
|
|
7
|
-
|
|
8
|
-
className?: ClassNameWithAutocomplete;
|
|
9
|
-
pos?: "trailing" | "leading";
|
|
10
|
-
outline?: boolean;
|
|
11
|
-
};
|
|
6
|
+
icon?: IDynamicIconProps | UnifiedIconName;
|
|
7
|
+
iconPosition?: "trailing" | "leading";
|
|
12
8
|
label: string;
|
|
13
9
|
onClick?(): void;
|
|
14
10
|
isEmphasized?: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export type SelectOptions = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export interface InputSelectProps {
|
|
7
|
+
align: "left" | "right";
|
|
8
|
+
/** Show the CTA without Background color and a border seperator */
|
|
9
|
+
inputOptions: SelectOptions[];
|
|
10
|
+
/** Onclick callback */
|
|
11
|
+
onSelectOption?(value: string): void;
|
|
12
|
+
className?: string;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Comment */
|
|
16
|
+
export declare const InputSelect: FC<InputSelectProps>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { AcceptedInputTypes } from "@/stories/molecules";
|
|
3
|
+
export type SelectOptions = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export interface ITextInputSelectProps {
|
|
8
|
+
/** Input type*/
|
|
9
|
+
type: AcceptedInputTypes;
|
|
10
|
+
/** Input ID */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Input Name */
|
|
13
|
+
name?: string;
|
|
14
|
+
/** Label for the input */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** placeholder for the input */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Force the focus state on the input */
|
|
19
|
+
isFocused?: boolean;
|
|
20
|
+
/** Error state */
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
/** If field is required */
|
|
23
|
+
isRequired?: boolean;
|
|
24
|
+
/** Disabled state */
|
|
25
|
+
isDisabled?: boolean;
|
|
26
|
+
/** Set default value */
|
|
27
|
+
defaultValue?: string;
|
|
28
|
+
/** Set value */
|
|
29
|
+
value: string;
|
|
30
|
+
/** Message shown under the text field */
|
|
31
|
+
message?: string;
|
|
32
|
+
/** Input character counter */
|
|
33
|
+
isShowCounter?: boolean;
|
|
34
|
+
/** Max length of input character */
|
|
35
|
+
maxLength?: number;
|
|
36
|
+
/** Select input location */
|
|
37
|
+
selectLocation?: "left" | "right";
|
|
38
|
+
/** Prefix */
|
|
39
|
+
prefix?: string;
|
|
40
|
+
/** List of options to show on the select field */
|
|
41
|
+
inputOptions?: SelectOptions[];
|
|
42
|
+
/** Callback on base input */
|
|
43
|
+
onChange?(value: string): void;
|
|
44
|
+
/** Callback on input select field */
|
|
45
|
+
onSelectOption?(value: string): void;
|
|
46
|
+
}
|
|
47
|
+
declare const TextInputSelect: FC<ITextInputSelectProps>;
|
|
48
|
+
export default TextInputSelect;
|
|
@@ -3,5 +3,6 @@ import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown";
|
|
|
3
3
|
import Dropdown, { IDropdownClassnames, IDropdownProps, IItemProp } from "./DropdownComponent";
|
|
4
4
|
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder";
|
|
5
5
|
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons";
|
|
6
|
-
|
|
7
|
-
export {
|
|
6
|
+
import TextInputSelect, { ITextInputSelectProps } from "./TextInputSelect";
|
|
7
|
+
export type { IAnimatedLabelInputProps, IButtonDropdownProps, IDropdownClassnames, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, ITextInputSelectProps };
|
|
8
|
+
export { AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agility/plenum-ui",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"storybook:tw": "tailwindcss -o ./lib/tailwind.css -w ",
|
|
18
18
|
"storybook": "npm-run-all -p \"storybook:*\" ",
|
|
19
19
|
"dev": "yarn storybook",
|
|
20
|
-
"build:tw": "tailwindcss -o ./lib/tailwind.css",
|
|
20
|
+
"build:tw": "tailwindcss -o ./dist/lib/tailwind.css",
|
|
21
21
|
"build:tsc": "yarn node build.js",
|
|
22
22
|
"prepare": "yarn build",
|
|
23
23
|
"build": "npm run clean && npm-run-all -s \"build:*\" ",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"eslint-config-next": "13.1.6",
|
|
54
54
|
"eslint-plugin-storybook": "^0.6.13",
|
|
55
55
|
"next": "13.1.6",
|
|
56
|
+
"npm-dts": "^1.3.12",
|
|
56
57
|
"npm-run-all": "^4.1.5",
|
|
57
58
|
"postcss": "^8.4.21",
|
|
58
59
|
"react": "18.2.0",
|
|
@@ -62,4 +63,4 @@
|
|
|
62
63
|
"tailwindcss": "^3.2.4",
|
|
63
64
|
"typescript": "^5.1.6"
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
|
+
}
|
package/stories/Introduction.mdx
CHANGED
|
@@ -143,7 +143,7 @@ In your app entry point (i.e. \`_app.tsx\`), import the \`globals.css\` file fro
|
|
|
143
143
|
|
|
144
144
|
```jsx
|
|
145
145
|
import "<RELATIVE_PATH>/globals.css";
|
|
146
|
-
import "@agility/plenum-ui/lib/tailwind.css";
|
|
146
|
+
import "@agility/plenum-ui/dist/lib/tailwind.css";
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
Make sure to add any additional styles before these two import statements to prevent overwriting the Plenum styling.
|
|
@@ -41,6 +41,13 @@ export const AlternativeExtraSmall: Story = {
|
|
|
41
41
|
size: "sm"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
export const AlternativeSimpleIconName: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
...Alternative.args,
|
|
47
|
+
icon: defaultIcon.icon,
|
|
48
|
+
iconPosition: "leading"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
44
51
|
export const AlternativeSmall: Story = {
|
|
45
52
|
args: {
|
|
46
53
|
...Alternative.args,
|
|
@@ -8,13 +8,13 @@ import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
|
|
|
8
8
|
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger"
|
|
9
9
|
export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
10
10
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
11
|
-
actionType
|
|
11
|
+
actionType?: BTNActionType
|
|
12
12
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
13
13
|
size?: "xs" | "sm" | "md" | "lg" | "xl"
|
|
14
14
|
/** The Button's text content. */
|
|
15
15
|
label: string
|
|
16
16
|
/** The Icon to be displayed inside the button. */
|
|
17
|
-
icon?: IDynamicIconProps
|
|
17
|
+
icon?: IDynamicIconProps | UnifiedIconName
|
|
18
18
|
/** Does the button width grow to fill it's container? */
|
|
19
19
|
fullWidth?: boolean
|
|
20
20
|
/** Optionally render as anchor tag */
|
|
@@ -30,6 +30,8 @@ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
|
30
30
|
/** Is the associated content loading? */
|
|
31
31
|
isLoading?: boolean
|
|
32
32
|
className?: string
|
|
33
|
+
iconObj?: React.ReactNode
|
|
34
|
+
ref?: React.LegacyRef<HTMLButtonElement>
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Primary UI component for user interaction
|
|
@@ -39,12 +41,14 @@ const Button = ({
|
|
|
39
41
|
size = "sm",
|
|
40
42
|
label,
|
|
41
43
|
icon,
|
|
44
|
+
iconObj,
|
|
42
45
|
CustomSVGIcon,
|
|
43
46
|
fullWidth = false,
|
|
44
47
|
iconPosition = "trailing",
|
|
45
48
|
asLink,
|
|
46
49
|
isLoading = false,
|
|
47
50
|
className,
|
|
51
|
+
ref,
|
|
48
52
|
...props
|
|
49
53
|
}: IButtonProps) => {
|
|
50
54
|
const iconStyles = cn(
|
|
@@ -88,6 +92,7 @@ const Button = ({
|
|
|
88
92
|
},
|
|
89
93
|
className ? className : ""
|
|
90
94
|
)}
|
|
95
|
+
ref={ref}
|
|
91
96
|
{...props}
|
|
92
97
|
>
|
|
93
98
|
{CustomSVGIcon &&
|
|
@@ -96,11 +101,20 @@ const Button = ({
|
|
|
96
101
|
) : (
|
|
97
102
|
<i>{CustomSVGIcon}</i>
|
|
98
103
|
))}
|
|
104
|
+
{iconObj &&
|
|
105
|
+
iconPosition === "leading" &&
|
|
106
|
+
(!isLoading ? (
|
|
107
|
+
<>{iconObj}</>
|
|
108
|
+
) : (
|
|
109
|
+
<div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
|
|
110
|
+
))}
|
|
99
111
|
|
|
100
112
|
{icon &&
|
|
101
113
|
iconPosition === "leading" &&
|
|
102
114
|
(isLoading ? (
|
|
103
115
|
<div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
|
|
116
|
+
) : typeof icon === "string" ? (
|
|
117
|
+
<DynamicIcon {...{ icon: icon, className: iconStyles }} />
|
|
104
118
|
) : (
|
|
105
119
|
<DynamicIcon {...{ ...icon, className: iconStyles }} />
|
|
106
120
|
))}
|
|
@@ -113,9 +127,18 @@ const Button = ({
|
|
|
113
127
|
iconPosition === "trailing" &&
|
|
114
128
|
(isLoading ? (
|
|
115
129
|
<div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
|
|
130
|
+
) : typeof icon === "string" ? (
|
|
131
|
+
<DynamicIcon {...{ icon: icon, className: iconStyles }} />
|
|
116
132
|
) : (
|
|
117
133
|
<DynamicIcon {...{ ...icon, className: iconStyles }} />
|
|
118
134
|
))}
|
|
135
|
+
{iconObj &&
|
|
136
|
+
iconPosition === "trailing" &&
|
|
137
|
+
(!isLoading ? (
|
|
138
|
+
<>{iconObj}</>
|
|
139
|
+
) : (
|
|
140
|
+
<div className={cn("h-4 rounded-full w-4 border-2 m-0 animate-spin", loaderColors, loaderSize)} />
|
|
141
|
+
))}
|
|
119
142
|
</button>
|
|
120
143
|
)
|
|
121
144
|
}
|
|
@@ -38,6 +38,13 @@ export const DangerLeadingIcon: Story = {
|
|
|
38
38
|
iconPosition: "leading"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
export const DangerSimpleIconName: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
...Danger.args,
|
|
44
|
+
icon: "TrashIcon",
|
|
45
|
+
iconPosition: "leading"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
41
48
|
export const DangerExtraSmall: Story = {
|
|
42
49
|
args: {
|
|
43
50
|
...Danger.args,
|
|
@@ -39,6 +39,13 @@ export const PrimaryLeadingIcon: Story = {
|
|
|
39
39
|
iconPosition: "leading"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
export const PrimarySimpleIconName: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
...Primary.args,
|
|
45
|
+
icon: "CheckIcon",
|
|
46
|
+
iconPosition: "leading"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
export const PrimaryTrailingIcon: Story = {
|
|
43
50
|
args: {
|
|
44
51
|
...PrimaryLeadingIcon.args,
|
|
@@ -41,6 +41,13 @@ export const SecondaryLeadingIcon: Story = {
|
|
|
41
41
|
iconPosition: "leading"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
export const SecondarySimpleIconName: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
...Secondary.args,
|
|
47
|
+
icon: "BellIcon",
|
|
48
|
+
iconPosition: "leading"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
44
51
|
export const SecondaryExtraSmall: Story = {
|
|
45
52
|
args: {
|
|
46
53
|
...Secondary.args,
|