@agility/plenum-ui 2.0.0-rc15 → 2.0.0-rc17

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.
@@ -1,7 +1,7 @@
1
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.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
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.DetailedHTMLProps<React.ButtonHTMLAt
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;
@@ -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*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.0.0-rc15",
3
+ "version": "2.0.0-rc17",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,13 +1,14 @@
1
1
  import Loader from "stories/atoms/loaders/Loader"
2
2
  import { default as cn } from "classnames"
3
- import React, { HTMLAttributeAnchorTarget } from "react"
3
+ import React, { HTMLAttributeAnchorTarget, forwardRef } from "react"
4
4
  import { DynamicIcon, UnifiedIconName, IDynamicIconProps } from "../../icons"
5
5
 
6
6
  // import Loader from "../loaders/loader/Loader"
7
7
 
8
8
  export type BTNActionType = "primary" | "secondary" | "alternative" | "danger"
9
+
9
10
  export interface IButtonProps
10
- extends React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
11
+ extends Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> {
11
12
  /** Is the button a Primary CTA, alternative or danger button? */
12
13
  actionType?: BTNActionType
13
14
  /** How lg should the button be? - Defaults to 'base'. */
@@ -32,12 +33,11 @@ export interface IButtonProps
32
33
  isLoading?: boolean
33
34
  className?: string
34
35
  iconObj?: React.ReactNode
35
- ref?: React.LegacyRef<HTMLButtonElement>
36
36
  }
37
37
  /**
38
38
  * Primary UI component for user interaction
39
39
  */
40
- const Button = ({
40
+ const _Button = ({
41
41
  actionType = "primary",
42
42
  size = "sm",
43
43
  label,
@@ -49,9 +49,10 @@ const Button = ({
49
49
  asLink,
50
50
  isLoading = false,
51
51
  className,
52
- ref,
53
52
  ...props
54
- }: IButtonProps) => {
53
+ }: IButtonProps,
54
+ ref: React.LegacyRef<HTMLButtonElement>
55
+ ) => {
55
56
  const iconStyles = cn(
56
57
  { "text-white h-5 w-5": actionType === "primary" || actionType === "danger" },
57
58
  { "text-purple-700 h-5 w-5 ": actionType === "secondary" },
@@ -144,4 +145,6 @@ const Button = ({
144
145
  )
145
146
  }
146
147
 
148
+ const Button = forwardRef<HTMLButtonElement, IButtonProps>(_Button)
149
+
147
150
  export default Button
@@ -32,7 +32,7 @@ export interface ITextInputProps {
32
32
  /** Max length of input character */
33
33
  maxLength?: number
34
34
  /** Callback on change */
35
- onChange(value: string): void
35
+ handleChange(value: string): void
36
36
  /** input value */
37
37
  value: string
38
38
  /**Placeholder input text*/
@@ -56,7 +56,7 @@ const TextInput = (
56
56
  message,
57
57
  isShowCounter,
58
58
  maxLength,
59
- onChange,
59
+ handleChange,
60
60
  placeholder,
61
61
  value: externalValue,
62
62
  className,
@@ -116,7 +116,10 @@ const TextInput = (
116
116
  <InputField
117
117
  onFocus={handleInputFocus}
118
118
  onBlur={handleInputBlur}
119
- handleChange={(v) => setValue(v)}
119
+ handleChange={(v: string) => {
120
+ setValue(v)
121
+ handleChange(v)
122
+ }}
120
123
  ref={ref}
121
124
  type={type}
122
125
  name={name}
@@ -37,7 +37,7 @@ const ToggleSwitch: React.FC<IToggleSwitchProps> = ({
37
37
 
38
38
  return (
39
39
  <Switch.Group as={"div"} className={"flex items-center gap-2"}>
40
- {label && label.xPosition === "left" && (
40
+ {label && (label.xPosition === "left" || !label?.xPosition) && (
41
41
  <Switch.Label className={label.className}>{label.text}</Switch.Label>
42
42
  )}
43
43
  <Switch