@agility/plenum-ui 2.0.0-rc8 → 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.
Files changed (95) hide show
  1. package/README.md +104 -31
  2. package/build.js +30 -25
  3. package/dist/index.d.ts +105 -65
  4. package/dist/index.js +1 -6295
  5. package/dist/index.js.map +4 -4
  6. package/dist/{lib/tailwind.css → tailwind.css} +3729 -8120
  7. package/dist/types/stories/atoms/buttons/Button/Alternative/Alternative.stories.d.ts +1 -0
  8. package/dist/types/stories/atoms/buttons/Button/Button.d.ts +3 -7
  9. package/dist/types/stories/atoms/buttons/Button/Danger/Danger.stories.d.ts +1 -0
  10. package/dist/types/stories/atoms/buttons/Button/Primary/Primary.stories.d.ts +1 -0
  11. package/dist/types/stories/atoms/buttons/Button/Secondary/Secondary.stories.d.ts +1 -0
  12. package/dist/types/stories/atoms/buttons/Capsule/Capsule.d.ts +1 -1
  13. package/dist/types/stories/atoms/icons/DynamicIcon.d.ts +2 -2
  14. package/dist/types/stories/atoms/icons/TablerIcon.d.ts +1 -1
  15. package/dist/types/stories/index.d.ts +4 -4
  16. package/dist/types/stories/molecules/index.d.ts +2 -2
  17. package/dist/types/stories/molecules/inputs/InputField/InputField.d.ts +7 -7
  18. package/dist/types/stories/molecules/inputs/TextInput/TextInput.d.ts +1 -1
  19. package/dist/types/stories/molecules/inputs/index.d.ts +2 -2
  20. package/dist/types/stories/molecules/inputs/select/Select.d.ts +4 -2
  21. package/dist/types/stories/molecules/inputs/textArea/TextArea.d.ts +5 -1
  22. package/dist/types/stories/molecules/inputs/toggleSwitch/ToggleSwitch.d.ts +10 -7
  23. package/dist/types/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.d.ts +5 -5
  24. package/dist/types/stories/organisms/AnimatedLabelInput/index.d.ts +1 -1
  25. package/dist/types/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.d.ts +12 -0
  26. package/dist/types/stories/organisms/AnimatedLabelTextArea/index.d.ts +3 -0
  27. package/dist/types/stories/organisms/ButtonDropdown/ButtonDropdown.d.ts +1 -0
  28. package/dist/types/stories/organisms/DropdownComponent/DropdownComponent.d.ts +24 -13
  29. package/dist/types/stories/organisms/DropdownComponent/index.d.ts +2 -2
  30. package/dist/types/stories/organisms/EmptySectionPlaceholder/index.d.ts +1 -1
  31. package/dist/types/stories/organisms/index.d.ts +4 -3
  32. package/local.sh +100 -0
  33. package/package.json +36 -19
  34. package/rollup.config.mjs +42 -0
  35. package/stories/atoms/badges/Badge.tsx +1 -1
  36. package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +10 -0
  37. package/stories/atoms/buttons/Button/Button.tsx +111 -25
  38. package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +14 -2
  39. package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +14 -2
  40. package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +13 -1
  41. package/stories/atoms/buttons/Button/defaultArgs.ts +1 -1
  42. package/stories/atoms/buttons/Capsule/Capsule.tsx +2 -1
  43. package/stories/atoms/icons/DynamicIcon.stories.ts +1 -1
  44. package/stories/atoms/icons/DynamicIcon.tsx +7 -7
  45. package/stories/atoms/icons/IconWithShadow.stories.ts +3 -3
  46. package/stories/atoms/icons/TablerIcon.tsx +1 -1
  47. package/stories/atoms/loaders/Loader.tsx +12 -6
  48. package/stories/atoms/loaders/NProgress/RadialProgress.tsx +0 -2
  49. package/stories/index.ts +8 -4
  50. package/stories/molecules/index.ts +2 -0
  51. package/stories/molecules/inputs/InputCounter/InputCounter.tsx +2 -2
  52. package/stories/molecules/inputs/InputField/InputField.tsx +31 -29
  53. package/stories/molecules/inputs/InputLabel/InputLabel.tsx +1 -1
  54. package/stories/molecules/inputs/TextInput/TextInput.tsx +12 -6
  55. package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +1 -1
  56. package/stories/molecules/inputs/checkbox/Checkbox.tsx +1 -2
  57. package/stories/molecules/inputs/combobox/ComboBox.tsx +126 -135
  58. package/stories/molecules/inputs/index.ts +2 -1
  59. package/stories/molecules/inputs/radio/Radio.stories.ts +2 -2
  60. package/stories/molecules/inputs/select/Select.tsx +10 -2
  61. package/stories/molecules/inputs/textArea/TextArea.stories.ts +1 -1
  62. package/stories/molecules/inputs/textArea/TextArea.tsx +57 -27
  63. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +15 -16
  64. package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +63 -57
  65. package/stories/molecules/tabs/index.tsx +2 -3
  66. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +10 -1
  67. package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +53 -37
  68. package/stories/organisms/AnimatedLabelInput/index.tsx +1 -1
  69. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -0
  70. package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -0
  71. package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -0
  72. package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +59 -59
  73. package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +42 -30
  74. package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +26 -2
  75. package/stories/organisms/DropdownComponent/DropdownComponent.tsx +232 -180
  76. package/stories/organisms/DropdownComponent/dropdownItems.ts +30 -9
  77. package/stories/organisms/DropdownComponent/index.ts +2 -2
  78. package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +3 -3
  79. package/stories/organisms/EmptySectionPlaceholder/index.tsx +2 -1
  80. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +1 -1
  81. package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +7 -2
  82. package/stories/organisms/index.ts +12 -3
  83. package/tailwind.config.js +81 -37
  84. package/tsconfig.lib.json +13 -6
  85. package/watch.js +49 -0
  86. package/.yarnrc.yml +0 -1
  87. package/dist/types/stories/layouts/index.d.ts +0 -0
  88. package/stories/layouts/CardLayout/CardLayout.stories.tsx +0 -18
  89. package/stories/layouts/CardLayout/CardLayout.tsx +0 -22
  90. package/stories/layouts/CardLayout/index.tsx +0 -3
  91. package/stories/layouts/ModalLayout/ModalLayout.stories.tsx +0 -18
  92. package/stories/layouts/ModalLayout/ModalLayout.tsx +0 -22
  93. package/stories/layouts/ModalLayout/index.tsx +0 -3
  94. package/stories/layouts/index.ts +0 -0
  95. 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.ComponentPropsWithoutRef<"button"> {
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.ComponentPropsWithoutRef<"button"> {
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 = IconName | TablerIconName | FAIconName;
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.ComponentProps<"i"> {
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.ComponentProps<"i"> {
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, 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 };
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,3 +1,3 @@
1
- import { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, 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, ITextareaProps, IToggleSwitchProps, AcceptedInputTypes, ITextInputProps };
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
3
  export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput };
@@ -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.ComponentPropsWithoutRef<"input"> {
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: string;
7
+ id?: string;
8
8
  /** Input Name */
9
- name: string;
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
- /**ref for input */
27
- ref?: React.Ref<HTMLInputElement>;
26
+ /** Placeholder text */
27
+ placeholder?: string;
28
28
  }
29
- declare const InputField: React.FC<IInputFieldProps>;
30
- export default InputField;
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
- onChange(value: string): void;
31
+ handleChange(value: string): void;
32
32
  /** input value */
33
33
  value: string;
34
34
  /**Placeholder input text*/
@@ -4,9 +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";
7
+ import Select, { ISelectProps, ISimpleSelectOptions } from "./select";
8
8
  import Textarea, { ITextareaProps } from "./textArea";
9
9
  import TextInput, { ITextInputProps } from "./TextInput";
10
10
  import ToggleSwitch, { IToggleSwitchProps } from "./toggleSwitch";
11
- export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ITextareaProps, ITextInputProps, IToggleSwitchProps, AcceptedInputTypes };
11
+ export type { ICheckboxProps, IComboboxProps, IInputFieldProps, IInputLabelProps, INestedInputButtonProps, IRadioProps, ISelectProps, ISimpleSelectOptions, ITextareaProps, ITextInputProps, IToggleSwitchProps, AcceptedInputTypes };
12
12
  export { Checkbox, Combobox, InputField, InputLabel, NestedInputButton, Radio, Select, Textarea, ToggleSwitch, TextInput };
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- export type ISimpleSelectOptions = {
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?: string;
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
- text: string | JSX.Element;
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: "base" | "short";
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
- import { ITextareaProps } from "@/stories/molecules/inputs/textArea/TextArea";
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;
@@ -1,3 +1,3 @@
1
1
  import AnimatedLabelInput, { IAnimatedLabelInputProps } from "./AnimatedLabelInput";
2
- export default AnimatedLabelInput;
3
2
  export type { IAnimatedLabelInputProps };
3
+ 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;
@@ -0,0 +1,3 @@
1
+ import AnimatedLabelTextArea, { IAnimatedLabelTextAreaProps } from "./AnimatedLabelTextArea";
2
+ export type { IAnimatedLabelTextAreaProps };
3
+ 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, UnifiedIconName } from "@/stories/atoms/icons";
5
- export interface IItemProp extends HTMLAttributes<HTMLButtonElement> {
6
- icon?: IDynamicIconProps | UnifiedIconName;
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
- classNames?: IDropdownClassnames;
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: IDropdownClassnames;
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, IDropdownClassnames, IDropdownProps, defaultClassNames } from "./DropdownComponent";
2
- export type { IItemProp, IDropdownClassnames, IDropdownProps };
1
+ import Dropdown, { IItemProp, IDropdownProps, defaultClassNames } from "./DropdownComponent";
2
+ export type { IItemProp, IDropdownProps };
3
3
  export { defaultClassNames };
4
4
  export default Dropdown;
@@ -1,3 +1,3 @@
1
1
  import EmptySectionPlaceholder, { IEmptySectionPlaceholderProps } from "./EmptySectionPlaceholder";
2
- export default EmptySectionPlaceholder;
3
2
  export type { IEmptySectionPlaceholderProps };
3
+ export default EmptySectionPlaceholder;
@@ -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, { IDropdownClassnames, IDropdownProps, IItemProp } from "./DropdownComponent";
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, IButtonDropdownProps, IDropdownClassnames, IDropdownProps, IEmptySectionPlaceholderProps, IItemProp, IFormInputWithAddonsProps, ITextInputSelectProps };
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-rc8",
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/lib/tailwind.css",
20
+ "build:tw": "tailwindcss -o ./dist/tailwind.css",
21
21
  "build:tsc": "yarn node build.js",
22
22
  "prepare": "yarn build",
23
- "build": "npm run clean && npm-run-all -s \"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
- "devDependencies": {
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
- "storybook": "^7.1.1",
63
- "tailwindcss": "^3.2.4",
64
- "typescript": "^5.1.6"
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: "XIcon", className: removeButtonStyles }} />
120
+ <DynamicIcon {...{ icon: "IconX", className: removeButtonStyles }} />
121
121
  </button>
122
122
  )}
123
123
  </div>