@agility/plenum-ui 2.0.0-rc9 → 2.0.0
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 +104 -31
- package/build.js +30 -25
- package/dist/index.d.ts +101 -61
- package/dist/index.js +1 -6295
- package/dist/index.js.map +4 -4
- package/dist/{lib/tailwind.css → tailwind.css} +3729 -8120
- package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
- package/dist/types/stories/atoms/buttons/Button/Button.d.ts +3 -7
- 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/atoms/buttons/Capsule/Capsule.d.ts +1 -1
- package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +2 -2
- package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
- package/dist/types/stories/index.d.ts +4 -4
- package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +7 -7
- package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +1 -1
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +4 -2
- package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +5 -1
- package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +10 -7
- package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +5 -5
- package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
- package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
- package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
- package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +1 -0
- package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +24 -13
- package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
- package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
- package/dist/types/stories/organisms/index.d.ts +4 -3
- package/local.sh +100 -0
- package/package.json +36 -19
- package/rollup.config.mjs +42 -0
- package/stories/atoms/badges/Badge.tsx +1 -1
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +10 -0
- package/stories/atoms/buttons/Button/Button.tsx +111 -25
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +14 -2
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +14 -2
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +13 -1
- package/stories/atoms/buttons/Button/defaultArgs.ts +1 -1
- package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
- package/stories/atoms/icons/DynamicIcon.stories.ts +1 -1
- package/stories/atoms/icons/DynamicIcon.tsx +7 -7
- package/stories/atoms/icons/IconWithShadow.stories.ts +3 -3
- package/stories/atoms/icons/TablerIcon.tsx +1 -1
- package/stories/atoms/loaders/Loader.tsx +12 -6
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +0 -2
- package/stories/index.ts +8 -4
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +2 -2
- package/stories/molecules/inputs/InputField/InputField.tsx +31 -29
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +1 -1
- package/stories/molecules/inputs/TextInput/TextInput.tsx +12 -6
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +1 -1
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -2
- package/stories/molecules/inputs/combobox/ComboBox.tsx +126 -135
- package/stories/molecules/inputs/radio/Radio.stories.ts +2 -2
- package/stories/molecules/inputs/select/Select.tsx +10 -2
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +1 -1
- package/stories/molecules/inputs/textArea/TextArea.tsx +57 -27
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +15 -16
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +63 -57
- package/stories/molecules/tabs/index.tsx +2 -3
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +53 -37
- package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +59 -59
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +42 -30
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +26 -2
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +232 -180
- package/stories/organisms/DropdownComponent/dropdownItems.ts +30 -9
- package/stories/organisms/DropdownComponent/index.ts +2 -2
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +3 -3
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +1 -1
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
- package/stories/organisms/index.ts +12 -3
- package/tailwind.config.js +81 -37
- package/tsconfig.lib.json +13 -6
- package/watch.js +49 -0
- package/.yarnrc.yml +0 -1
- package/dist/types/stories/layouts/index.d.ts +0 -0
- package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
- package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
- package/stories/layouts/CardLayout/index.tsx +0 -3
- package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
- package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
- package/stories/layouts/ModalLayout/index.tsx +0 -3
- package/stories/layouts/index.ts +0 -0
- package/stories/organisms/DropdownComponent/Dropdown.test.tsx +0 -0
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Button>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
6
|
export declare const Alternative: Story;
|
|
7
|
+
export declare const AlternativeDisabled: Story;
|
|
7
8
|
export declare const AlternativeTrailingIcon: Story;
|
|
8
9
|
export declare const AlternativeLeadingIcon: Story;
|
|
9
10
|
export declare const AlternativeExtraSmall: Story;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HTMLAttributeAnchorTarget } from "react";
|
|
1
|
+
import React, { HTMLAttributeAnchorTarget } from "react";
|
|
2
2
|
import { UnifiedIconName, IDynamicIconProps } from "../../icons";
|
|
3
3
|
export type BTNActionType = "primary" | "secondary" | "alternative" | "danger";
|
|
4
|
-
export interface IButtonProps extends React.
|
|
4
|
+
export interface IButtonProps extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
|
|
5
5
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
6
6
|
actionType?: BTNActionType;
|
|
7
7
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
@@ -26,10 +26,6 @@ export interface IButtonProps extends React.ComponentPropsWithoutRef<"button"> {
|
|
|
26
26
|
isLoading?: boolean;
|
|
27
27
|
className?: string;
|
|
28
28
|
iconObj?: React.ReactNode;
|
|
29
|
-
ref?: React.LegacyRef<HTMLButtonElement>;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
* Primary UI component for user interaction
|
|
33
|
-
*/
|
|
34
|
-
declare const Button: ({ actionType, size, label, icon, iconObj, CustomSVGIcon, fullWidth, iconPosition, asLink, isLoading, className, ref, ...props }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
declare const Button: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
35
31
|
export default Button;
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Button>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
6
|
export declare const Danger: Story;
|
|
7
|
+
export declare const DangerDisabled: Story;
|
|
7
8
|
export declare const DangerTrailingIcon: Story;
|
|
8
9
|
export declare const DangerLeadingIcon: Story;
|
|
9
10
|
export declare const DangerSimpleIconName: Story;
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Button>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
6
|
export declare const Primary: Story;
|
|
7
|
+
export declare const PrimaryDisabled: Story;
|
|
7
8
|
export declare const PrimaryLeadingIcon: Story;
|
|
8
9
|
export declare const PrimarySimpleIconName: Story;
|
|
9
10
|
export declare const PrimaryTrailingIcon: Story;
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Button>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
6
|
export declare const Secondary: Story;
|
|
7
|
+
export declare const SecondaryDisabled: Story;
|
|
7
8
|
export declare const SecondaryTrailingIcon: Story;
|
|
8
9
|
export declare const SecondaryLeadingIcon: Story;
|
|
9
10
|
export declare const SecondarySimpleIconName: Story;
|
|
@@ -3,7 +3,7 @@ import { BTNActionType } from "../Button/Button";
|
|
|
3
3
|
/**
|
|
4
4
|
* Capsule Style Button
|
|
5
5
|
*/
|
|
6
|
-
export interface ICapsuleProps extends React.
|
|
6
|
+
export interface ICapsuleProps extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
7
7
|
/** Is the button a Primary CTA, alternative or danger button? */
|
|
8
8
|
actionType: BTNActionType;
|
|
9
9
|
/** How lg should the button be? - Defaults to 'base'. */
|
|
@@ -6,12 +6,12 @@ import { TablerIconName } from "./tablerIconNames";
|
|
|
6
6
|
import { ClassNameWithAutocomplete } from "@/utils/types";
|
|
7
7
|
export type IconName = keyof typeof SolidIcons | keyof typeof OutlineIcons;
|
|
8
8
|
export type FAIconName = keyof typeof FA;
|
|
9
|
-
export type UnifiedIconName =
|
|
9
|
+
export type UnifiedIconName = TablerIconName | IconName | FAIconName;
|
|
10
10
|
export declare function isHeroIcon(name: UnifiedIconName): name is keyof typeof SolidIcons | keyof typeof OutlineIcons;
|
|
11
11
|
export declare function isTablerIcon(name: UnifiedIconName): name is TablerIconName;
|
|
12
12
|
export declare function isFAIcon(name: UnifiedIconName): name is keyof typeof FA;
|
|
13
13
|
export declare function isUnifiedIconName(name: UnifiedIconName): name is UnifiedIconName;
|
|
14
|
-
export interface IDynamicIconProps extends React.
|
|
14
|
+
export interface IDynamicIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
15
15
|
icon: UnifiedIconName;
|
|
16
16
|
className?: ClassNameWithAutocomplete;
|
|
17
17
|
outline?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TablerIconName } from "./tablerIconNames";
|
|
3
3
|
import { ClassNameWithAutocomplete } from "@/utils/types";
|
|
4
|
-
export interface ITablerIconProps extends React.
|
|
4
|
+
export interface ITablerIconProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
5
5
|
icon: TablerIconName;
|
|
6
6
|
className?: ClassNameWithAutocomplete;
|
|
7
7
|
}
|
|
@@ -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, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput, ITextInputProps } from "./molecules";
|
|
3
|
-
import { IAnimatedLabelInputProps,
|
|
4
|
-
export type { IAvatarProps, IBadgeProps, IButtonProps, ICapsuleProps, ITextInputSelectProps, IDynamicIconProps, IIconWithShadowProps, ILoaderProps, IRadialProgressProps, ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, IAnimatedLabelInputProps,
|
|
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 };
|
|
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, AnimatedLabelTextArea, IAnimatedLabelTextAreaProps, IButtonDropdownProps, 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, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, UnifiedIconName, IconName, FAIconName, BTNActionType, ITextInputProps, ISimpleSelectOptions };
|
|
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 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type AcceptedInputTypes = "date" | "datetime-local" | "email" | "month" | "number" | "password" | "search" | "submit" | "tel" | "text" | "url" | "currency";
|
|
3
|
-
export interface IInputFieldProps extends React.
|
|
3
|
+
export interface IInputFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange"> {
|
|
4
4
|
/** Callback on change */
|
|
5
5
|
handleChange: (value: string) => void;
|
|
6
6
|
/** Input ID*/
|
|
7
|
-
id
|
|
7
|
+
id?: string;
|
|
8
8
|
/** Input Name */
|
|
9
|
-
name
|
|
9
|
+
name?: string;
|
|
10
10
|
/** Force the focus state on the input */
|
|
11
11
|
isFocused?: boolean;
|
|
12
12
|
/** Error condition */
|
|
@@ -23,8 +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
|
-
/**
|
|
27
|
-
|
|
26
|
+
/** Placeholder text */
|
|
27
|
+
placeholder?: string;
|
|
28
28
|
}
|
|
29
|
-
declare const
|
|
30
|
-
export default
|
|
29
|
+
declare const _InputField: React.ForwardRefExoticComponent<IInputFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
30
|
+
export default _InputField;
|
|
@@ -28,7 +28,7 @@ export interface ITextInputProps {
|
|
|
28
28
|
/** Max length of input character */
|
|
29
29
|
maxLength?: number;
|
|
30
30
|
/** Callback on change */
|
|
31
|
-
|
|
31
|
+
handleChange(value: string): void;
|
|
32
32
|
/** input value */
|
|
33
33
|
value: string;
|
|
34
34
|
/**Placeholder input text*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export
|
|
2
|
+
export interface ISimpleSelectOptions {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
export interface ISelectProps {
|
|
7
7
|
/** Label */
|
|
8
8
|
label?: string;
|
|
@@ -22,6 +22,8 @@ export interface ISelectProps {
|
|
|
22
22
|
isRequired?: boolean;
|
|
23
23
|
value?: string;
|
|
24
24
|
className?: string;
|
|
25
|
+
onFocus?: () => void;
|
|
26
|
+
onBlur?: () => void;
|
|
25
27
|
}
|
|
26
28
|
declare const Select: React.FC<ISelectProps>;
|
|
27
29
|
export default Select;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
3
|
+
display: string;
|
|
4
|
+
htmlFor?: string;
|
|
5
|
+
}
|
|
2
6
|
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
3
7
|
/** Input ID */
|
|
4
8
|
id?: string;
|
|
5
9
|
/** Input Name */
|
|
6
10
|
name?: string;
|
|
7
11
|
/** Label for the input */
|
|
8
|
-
label?:
|
|
12
|
+
label?: ILabelProps;
|
|
9
13
|
/** Error state */
|
|
10
14
|
isError?: boolean;
|
|
11
15
|
/** If field is required */
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IDynamicIconProps } from "@/stories/atoms";
|
|
3
|
+
interface ToggleSwitchLabel {
|
|
4
|
+
text: string | JSX.Element;
|
|
5
|
+
className?: string;
|
|
6
|
+
xPosition?: "left" | "right";
|
|
7
|
+
}
|
|
3
8
|
export interface IToggleSwitchProps {
|
|
4
9
|
isChecked: boolean;
|
|
5
10
|
onChange: (isChecked: boolean) => void;
|
|
6
|
-
label?:
|
|
7
|
-
|
|
8
|
-
className?: string;
|
|
9
|
-
xPosition?: "left" | "right";
|
|
10
|
-
};
|
|
11
|
-
screenReaderLabel: string;
|
|
11
|
+
label?: ToggleSwitchLabel;
|
|
12
|
+
screenReaderLabel?: string;
|
|
12
13
|
name: string;
|
|
13
14
|
id: string;
|
|
14
|
-
variant
|
|
15
|
+
variant?: "base" | "short";
|
|
15
16
|
withIcon?: IDynamicIconProps;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
groupClassName?: string;
|
|
16
19
|
}
|
|
17
20
|
declare const ToggleSwitch: React.FC<IToggleSwitchProps>;
|
|
18
21
|
export default ToggleSwitch;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IInputFieldProps } from "@/stories/molecules/inputs/InputField";
|
|
3
|
-
|
|
4
|
-
interface ILabelProps extends React.ComponentPropsWithoutRef<"label"> {
|
|
3
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
5
4
|
display: string;
|
|
6
5
|
}
|
|
7
|
-
export interface IAnimatedLabelInputProps {
|
|
6
|
+
export interface IAnimatedLabelInputProps extends Omit<IInputFieldProps, "handleChange"> {
|
|
8
7
|
id: string;
|
|
9
8
|
containerStyles?: string;
|
|
10
9
|
message?: string;
|
|
11
|
-
input?: IInputFieldProps;
|
|
12
|
-
textarea?: ITextareaProps;
|
|
13
10
|
required?: boolean;
|
|
14
11
|
isError?: boolean;
|
|
12
|
+
isShowCounter?: boolean;
|
|
13
|
+
maxLength?: number;
|
|
15
14
|
label: ILabelProps;
|
|
15
|
+
handleChange: (value: string) => void;
|
|
16
16
|
}
|
|
17
17
|
declare const AnimatedLabelInput: React.FC<IAnimatedLabelInputProps>;
|
|
18
18
|
export default AnimatedLabelInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ITextareaProps } from "@/stories/molecules/inputs/textArea";
|
|
3
|
+
export interface IAnimatedLabelTextAreaProps extends ITextareaProps {
|
|
4
|
+
id: string;
|
|
5
|
+
containerStyles?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
handleChange: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const AnimatedLabelTextArea: React.FC<IAnimatedLabelTextAreaProps>;
|
|
12
|
+
export default AnimatedLabelTextArea;
|
|
@@ -4,6 +4,7 @@ import { IDropdownProps } from "../DropdownComponent";
|
|
|
4
4
|
export interface IButtonDropdownProps {
|
|
5
5
|
button: IButtonProps;
|
|
6
6
|
dropDown: IDropdownProps;
|
|
7
|
+
hideDivider?: boolean;
|
|
7
8
|
placement?: IDropdownProps["placement"];
|
|
8
9
|
offsetOptions?: IDropdownProps["offsetOptions"];
|
|
9
10
|
}
|
|
@@ -1,36 +1,47 @@
|
|
|
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
|
|
5
|
-
export interface IItemProp
|
|
6
|
-
icon?: IDynamicIconProps
|
|
4
|
+
import { IDynamicIconProps } from "@/stories/atoms/icons";
|
|
5
|
+
export interface IItemProp {
|
|
6
|
+
icon?: IDynamicIconProps;
|
|
7
7
|
iconPosition?: "trailing" | "leading";
|
|
8
|
-
label: string;
|
|
8
|
+
label: string | JSX.Element;
|
|
9
9
|
onClick?(): void;
|
|
10
10
|
isEmphasized?: boolean;
|
|
11
11
|
key: React.Key;
|
|
12
|
-
|
|
13
|
-
export interface IDropdownClassnames {
|
|
14
|
-
groupClassname?: ClassNameWithAutocomplete;
|
|
15
|
-
itemsClassname?: ClassNameWithAutocomplete;
|
|
16
|
-
itemClassname?: ClassNameWithAutocomplete;
|
|
17
|
-
activeItemClassname?: ClassNameWithAutocomplete;
|
|
18
|
-
buttonClassname?: ClassNameWithAutocomplete;
|
|
12
|
+
iconObj?: JSX.Element;
|
|
19
13
|
}
|
|
20
14
|
export interface IDropdownProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
15
|
items: IItemProp[][];
|
|
22
16
|
label: string;
|
|
23
17
|
CustomDropdownTrigger?: React.ReactNode;
|
|
24
18
|
id: string;
|
|
25
|
-
|
|
19
|
+
groupClassname?: ClassNameWithAutocomplete;
|
|
20
|
+
itemsClassname?: ClassNameWithAutocomplete;
|
|
21
|
+
itemClassname?: ClassNameWithAutocomplete;
|
|
22
|
+
activeItemClassname?: ClassNameWithAutocomplete;
|
|
23
|
+
buttonClassname?: ClassNameWithAutocomplete;
|
|
24
|
+
iconClassname?: ClassNameWithAutocomplete;
|
|
25
|
+
iconSpacingClassname?: ClassNameWithAutocomplete;
|
|
26
26
|
placement?: Placement;
|
|
27
27
|
offsetOptions?: Partial<{
|
|
28
28
|
mainAxis: number;
|
|
29
29
|
crossAxis: number;
|
|
30
30
|
alignmentAxis: number | null;
|
|
31
31
|
}>;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
onFocus?: () => void;
|
|
34
|
+
onBlur?: () => void;
|
|
32
35
|
}
|
|
33
|
-
export declare const defaultClassNames:
|
|
36
|
+
export declare const defaultClassNames: {
|
|
37
|
+
groupClassname: string;
|
|
38
|
+
itemsClassname: string;
|
|
39
|
+
itemClassname: string;
|
|
40
|
+
activeItemClassname: string;
|
|
41
|
+
buttonClassname: string;
|
|
42
|
+
iconClassname: string;
|
|
43
|
+
iconSpacingClassname: string;
|
|
44
|
+
};
|
|
34
45
|
/** Comment */
|
|
35
46
|
declare const Dropdown: React.FC<IDropdownProps>;
|
|
36
47
|
export default Dropdown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Dropdown, { IItemProp,
|
|
2
|
-
export type { IItemProp,
|
|
1
|
+
import Dropdown, { IItemProp, IDropdownProps, defaultClassNames } from "./DropdownComponent";
|
|
2
|
+
export type { IItemProp, IDropdownProps };
|
|
3
3
|
export { defaultClassNames };
|
|
4
4
|
export default Dropdown;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput";
|
|
2
|
+
import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea";
|
|
2
3
|
import ButtonDropdown, { IButtonDropdownProps } from "./ButtonDropdown";
|
|
3
|
-
import Dropdown, {
|
|
4
|
+
import Dropdown, { IDropdownProps, IItemProp } from "./DropdownComponent";
|
|
4
5
|
import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder";
|
|
5
6
|
import FormInputWithAddons, { IFormInputWithAddonsProps } from "./FormInputWithAddons";
|
|
6
7
|
import TextInputSelect, { ITextInputSelectProps } from "./TextInputSelect";
|
|
7
|
-
export type { IAnimatedLabelInputProps,
|
|
8
|
-
export { AnimatedLabelInput, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect };
|
|
8
|
+
export type { IAnimatedLabelInputProps, IAnimatedLabelTextAreaProps, IButtonDropdownProps, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, ITextInputSelectProps };
|
|
9
|
+
export { AnimatedLabelInput, AnimatedLabelTextArea, ButtonDropdown, Dropdown, EmptySectionPlaceholder, FormInputWithAddons, TextInputSelect };
|
package/local.sh
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#! /usr/bin/bash
|
|
2
|
+
|
|
3
|
+
# ANSI escape codes for formatting
|
|
4
|
+
GREEN_BOLD='\033[1;32m'
|
|
5
|
+
ORANGE_BOLD='\033[1;33m'
|
|
6
|
+
RED_BOLD='\033[1;31m'
|
|
7
|
+
BLUE_BOLD='\033[1;34m'
|
|
8
|
+
RESET='\033[0m'
|
|
9
|
+
DIR="$PWD"
|
|
10
|
+
|
|
11
|
+
# The required yarn version to use this script
|
|
12
|
+
REQUIRED_YARN_VERSION="1.22.19"
|
|
13
|
+
|
|
14
|
+
# Get the installed Yarn version
|
|
15
|
+
INSTALLED_YARN_VERSION=$(yarn --version 2>/dev/null)
|
|
16
|
+
|
|
17
|
+
unlink_package() {
|
|
18
|
+
local package_name="${1:-@agility/plenum-ui}"
|
|
19
|
+
if [ -z "$1" ]; then
|
|
20
|
+
yarn unlink
|
|
21
|
+
else
|
|
22
|
+
cd "$DIR/node_modules/$package_name"
|
|
23
|
+
yarn unlink
|
|
24
|
+
fi
|
|
25
|
+
unlink_exit_code=$?
|
|
26
|
+
if [ $unlink_exit_code -ne 0 ]; then
|
|
27
|
+
echo -e "${ORANGE_BOLD}agility-cms-manager-app-react:warning${RESET} yarn unlink for '$package_name' encountered an error, but script will continue. \n"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
cd "$DIR"
|
|
31
|
+
echo -e "\n"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
link_package() {
|
|
35
|
+
local package_name="${1:-@agility/plenum-ui}"
|
|
36
|
+
if [ -z "$1" ]; then
|
|
37
|
+
yarn link
|
|
38
|
+
else
|
|
39
|
+
cd "$DIR/node_modules/$package_name"
|
|
40
|
+
yarn link
|
|
41
|
+
fi
|
|
42
|
+
unlink_exit_code=$?
|
|
43
|
+
if [ $unlink_exit_code -ne 0 ]; then
|
|
44
|
+
echo -e "${RED_BOLD}agility-cms-manager-app-react:error${RESET} yarn link for '$package_name' failed. Script cannot continue, exiting script."
|
|
45
|
+
exit 1
|
|
46
|
+
else
|
|
47
|
+
echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} yarn link for '$package_name' successful\n"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
cd "$DIR"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
check_yarn_version() {
|
|
54
|
+
# Check if Yarn is installed and compare the version
|
|
55
|
+
if [ -n "$INSTALLED_YARN_VERSION" ] && [ "$INSTALLED_YARN_VERSION" != "$REQUIRED_YARN_VERSION" ]; then
|
|
56
|
+
echo -e "${RED_BOLD}error${RESET} Yarn version $required_version is required, but found version $INSTALLED_YARN_VERSION."
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
echo -e "${BLUE_BOLD}info${RESET} Yarn version is $INSTALLED_YARN_VERSION. Proceeding with the script...\n"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
### START SCRIPT
|
|
64
|
+
|
|
65
|
+
check_yarn_version
|
|
66
|
+
|
|
67
|
+
echo -e "Starting @agility/plenum-ui local watch script \n"
|
|
68
|
+
echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} unlinking existing symlink"
|
|
69
|
+
yarn unlink
|
|
70
|
+
if [ $? -ne 0 ]; then
|
|
71
|
+
echo "yarn unlink for @agility/plenum-ui encountered an error, but script will continue. \n"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if [ ! -d "node_modules" ] || [ ! -d "node_modules/react" ] || [ ! -d "node_modules/react-dom" ]; then
|
|
75
|
+
echo -e "${ORANGE_BOLD}@agility/plenum-ui:warning${RESET} Could not find node_modules."
|
|
76
|
+
echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} installing dependencies...\n"
|
|
77
|
+
|
|
78
|
+
yarn install
|
|
79
|
+
|
|
80
|
+
if [ $? -eq 0 ]; then
|
|
81
|
+
echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} Finished installing dependencies"
|
|
82
|
+
else
|
|
83
|
+
echo -e "${RED_BOLD}@agility/plenum-ui:error${RESET} Couldn't install dependencies. Exiting script."
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} unlinking existing symlinks"
|
|
89
|
+
unlink_package react
|
|
90
|
+
unlink_package react-dom
|
|
91
|
+
unlink_package
|
|
92
|
+
|
|
93
|
+
echo -e "${BLUE_BOLD}@agility/plenum-ui:info${RESET} setting up symlinks...\n"
|
|
94
|
+
|
|
95
|
+
link_package react
|
|
96
|
+
link_package react-dom
|
|
97
|
+
link_package
|
|
98
|
+
|
|
99
|
+
echo -e "${GREEN_BOLD}@agility/plenum-ui:success${RESET} You can now run 'yarn start-cms:local' in agility-cms-manager-app-react\n"
|
|
100
|
+
yarn start:watch
|
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",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,19 +17,35 @@
|
|
|
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 ./dist/
|
|
20
|
+
"build:tw": "tailwindcss -o ./dist/tailwind.css",
|
|
21
21
|
"build:tsc": "yarn node build.js",
|
|
22
22
|
"prepare": "yarn build",
|
|
23
|
-
"build": "
|
|
23
|
+
"build": "yarn clean && npm-run-all -s \"build:*\" ",
|
|
24
24
|
"clean": "rimraf dist",
|
|
25
|
-
"create-component": "node scripts/create-component.js"
|
|
25
|
+
"create-component": "node scripts/create-component.js",
|
|
26
|
+
"start:local": "bash ./local.sh",
|
|
27
|
+
"start:watch": "yarn node watch.js"
|
|
26
28
|
},
|
|
27
|
-
"
|
|
29
|
+
"dependencies": {
|
|
28
30
|
"@floating-ui/react": "^0.25.0",
|
|
29
31
|
"@headlessui/react": "^1.7.10",
|
|
30
32
|
"@headlessui/tailwindcss": "^0.1.2",
|
|
31
33
|
"@heroicons/react": "^1.0.5",
|
|
32
34
|
"@next/font": "^13.4.12",
|
|
35
|
+
"@tabler/icons": "^2.26.0",
|
|
36
|
+
"@tabler/icons-react": "^2.27.0",
|
|
37
|
+
"@tailwindcss/forms": "^0.5.3",
|
|
38
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
39
|
+
"classnames": "^2.3.2",
|
|
40
|
+
"concurrently": "^7.6.0",
|
|
41
|
+
"next": "13.1.6",
|
|
42
|
+
"npm-dts": "^1.3.12",
|
|
43
|
+
"npm-run-all": "^4.1.5",
|
|
44
|
+
"postcss": "^8.4.21",
|
|
45
|
+
"tailwindcss": "^3.2.4",
|
|
46
|
+
"typescript": "^5.1.6"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
33
49
|
"@storybook/addon-designs": "^7.0.1",
|
|
34
50
|
"@storybook/addon-essentials": "^7.1.1",
|
|
35
51
|
"@storybook/addon-interactions": "^7.1.1",
|
|
@@ -40,27 +56,28 @@
|
|
|
40
56
|
"@storybook/react": "^7.1.1",
|
|
41
57
|
"@storybook/testing-library": "^0.2.0",
|
|
42
58
|
"@storybook/theming": "^7.1.1",
|
|
43
|
-
"@tabler/icons": "^2.26.0",
|
|
44
|
-
"@tabler/icons-react": "^2.27.0",
|
|
45
|
-
"@tailwindcss/forms": "^0.5.3",
|
|
46
|
-
"@tailwindcss/typography": "^0.5.9",
|
|
47
59
|
"@types/node": "18.11.18",
|
|
48
60
|
"autoprefixer": "^10.4.13",
|
|
49
|
-
"classnames": "^2.3.2",
|
|
50
|
-
"concurrently": "^7.6.0",
|
|
51
61
|
"esbuild": "^0.18.19",
|
|
52
62
|
"eslint": "8.32.0",
|
|
53
63
|
"eslint-config-next": "13.1.6",
|
|
54
64
|
"eslint-plugin-storybook": "^0.6.13",
|
|
55
|
-
"next": "13.1.6",
|
|
56
|
-
"npm-dts": "^1.3.12",
|
|
57
|
-
"npm-run-all": "^4.1.5",
|
|
58
|
-
"postcss": "^8.4.21",
|
|
59
65
|
"react": "18.2.0",
|
|
60
66
|
"react-dom": "18.2.0",
|
|
61
67
|
"react-icons": "^4.10.1",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
68
|
+
"rimraf": "^5.0.1",
|
|
69
|
+
"storybook": "^7.1.1"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@floating-ui/react": "^0.25.0",
|
|
73
|
+
"@headlessui/react": "^1.7.10",
|
|
74
|
+
"@headlessui/tailwindcss": "^0.1.2",
|
|
75
|
+
"@heroicons/react": "^1.0.5",
|
|
76
|
+
"@tabler/icons": "^2.26.0",
|
|
77
|
+
"@tabler/icons-react": "^2.27.0",
|
|
78
|
+
"classnames": "^2.3.2",
|
|
79
|
+
"react": "18.2.0",
|
|
80
|
+
"react-dom": "18.2.0",
|
|
81
|
+
"react-icons": "^4.10.1"
|
|
65
82
|
}
|
|
66
|
-
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
4
|
+
import typescript from '@rollup/plugin-typescript';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const config = [
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
input: 'stories/index.ts',
|
|
11
|
+
|
|
12
|
+
output: [
|
|
13
|
+
{
|
|
14
|
+
file: "lib/index.js",
|
|
15
|
+
format: 'cjs',
|
|
16
|
+
sourcemap: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
file: "lib/index.esm.js",
|
|
20
|
+
format: 'esm',
|
|
21
|
+
sourcemap: true
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
external: ["react", "react-dom"],
|
|
25
|
+
plugins: [
|
|
26
|
+
peerDepsExternal(),
|
|
27
|
+
resolve(),
|
|
28
|
+
commonjs(),
|
|
29
|
+
typescript({
|
|
30
|
+
tsconfig: "./tsconfig.lib.json",
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
input: "lib/esm/types/index.d.ts",
|
|
36
|
+
output: [{ file: "dist/index.d.ts", format: "esm" }],
|
|
37
|
+
plugins: [dts()],
|
|
38
|
+
external: ["react", "react-dom"],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
export default config;
|
|
@@ -117,7 +117,7 @@ const Badge: React.FC<IBadgeProps> = ({
|
|
|
117
117
|
className: `${removeButton?.className || ""} group outline-0 `
|
|
118
118
|
}}
|
|
119
119
|
>
|
|
120
|
-
<DynamicIcon {...{ icon: "
|
|
120
|
+
<DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
|
|
121
121
|
</button>
|
|
122
122
|
)}
|
|
123
123
|
</div>
|
|
@@ -22,6 +22,16 @@ export const Alternative: Story = {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
export const AlternativeDisabled: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
actionType: "alternative",
|
|
28
|
+
label: "Button",
|
|
29
|
+
disabled: true,
|
|
30
|
+
onClick: () => {
|
|
31
|
+
window.alert("Button clicked!")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
export const AlternativeTrailingIcon: Story = {
|
|
26
36
|
args: {
|
|
27
37
|
...Alternative.args,
|