@starasia/input 1.0.4 → 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/dist/types.d.ts CHANGED
@@ -1,20 +1,34 @@
1
- import { ReactNode } from "react";
1
+ import { ReactElement, ReactNode } from "react";
2
2
  export interface IconInputProps extends React.SVGProps<SVGSVGElement> {
3
3
  }
4
+ export type InputSize = "sm" | "md" | "lg" | "xl";
5
+ export type InputVariant = "standard" | "outline" | "flushed";
6
+ export type InputStatus = "default" | "error" | "success" | "disable";
7
+ export type InputLabelPosition = "outside-top" | "outside-left" | "inside";
4
8
  export interface IInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
5
- leftIcon?: React.ReactElement<IconInputProps>;
6
- rightIcon?: React.ReactElement<IconInputProps>;
9
+ size?: InputSize;
10
+ variant?: InputVariant;
11
+ status?: InputStatus;
12
+ label?: ReactNode;
13
+ labelPosition?: InputLabelPosition;
14
+ required?: boolean;
15
+ optional?: boolean;
16
+ description?: string;
17
+ helperText?: string;
18
+ errorText?: string;
19
+ leftIcon?: ReactElement<IconInputProps>;
20
+ rightIcon?: ReactElement<IconInputProps>;
7
21
  leftAddons?: ReactNode;
8
22
  rightAddons?: ReactNode;
9
23
  onClickLeftIcon?: () => void;
10
24
  onClickRightIcon?: () => void;
11
- size?: "sm" | "md" | "lg";
12
- status?: "error" | "warning" | "disable" | "default";
13
- inputUse?: "icon" | "addons";
14
- variant?: "outline" | "filled" | "flushed";
25
+ fullWidth?: boolean;
15
26
  highlightPlaceholder?: string;
16
27
  currency?: boolean;
17
- fullWidth?: boolean;
18
28
  options?: string[];
19
29
  onOptionChange?: (e: string) => void;
30
+ /** Show a × clear button when the field has a value. Default: true. */
31
+ clearable?: boolean;
32
+ /** Called after the user clicks the clear button. */
33
+ onClear?: () => void;
20
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starasia/input",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "description": "input component for starasia UI",
5
5
  "author": "Prawito Hudoro",
6
6
  "main": "dist/input.umd.js",