fis-component 0.0.57 → 0.0.58

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.
@@ -10,7 +10,7 @@ export interface ComboboxOption {
10
10
  }[];
11
11
  }
12
12
  export type SingleSelect<T> = {
13
- multi?: boolean;
13
+ multi?: false;
14
14
  value: T;
15
15
  onChange: (value: T) => void;
16
16
  displayValue?: (value: ComboboxOption) => string;
@@ -1,7 +1,7 @@
1
1
  export interface MenuItem {
2
2
  label: string;
3
3
  description?: string;
4
- value: string;
4
+ value: string | number;
5
5
  }
6
6
  export interface MenuGroup {
7
7
  groupLabel?: string;
@@ -16,8 +16,8 @@ export interface MenuProps {
16
16
  multi?: boolean;
17
17
  searchValue?: string;
18
18
  onSearchChange?: (value: string) => void;
19
- selectedValues?: string[];
20
- onChangeSelected?: (values: string[]) => void;
19
+ selectedValues?: (string | number)[];
20
+ onChangeSelected?: (values: (string | number)[]) => void;
21
21
  loading?: boolean;
22
22
  noData?: boolean;
23
23
  noResult?: boolean;
@@ -2,6 +2,7 @@ import { Meta } from "@storybook/react";
2
2
  import { SelectProps } from "./types";
3
3
  type SingleSelectStoryProps = SelectProps<string>;
4
4
  type MultiSelectStoryProps = SelectProps<string>;
5
+ type NumberSelectStoryProps = SelectProps<number>;
5
6
  declare const _default: Meta<SingleSelectStoryProps>;
6
7
  export default _default;
7
8
  export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
@@ -11,3 +12,4 @@ export declare const WithValidation: import("@storybook/core/csf").AnnotatedStor
11
12
  export declare const Loading: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
12
13
  export declare const LargeSize: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
13
14
  export declare const Disabled: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, SingleSelectStoryProps>;
15
+ export declare const NumberType: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, NumberSelectStoryProps>;
@@ -1,3 +1,3 @@
1
1
  import { SelectProps } from "./types";
2
- declare const FISSelect: import("react").ForwardRefExoticComponent<SelectProps<string> & import("react").RefAttributes<HTMLInputElement>>;
2
+ declare const FISSelect: import("react").ForwardRefExoticComponent<SelectProps<string | number> & import("react").RefAttributes<HTMLInputElement>>;
3
3
  export default FISSelect;
@@ -1,7 +1,7 @@
1
1
  import { InputLabelProps } from "../Input/InputLabel";
2
2
  import { MenuProps } from "../MenuSelect/types";
3
3
  import { SelectFieldProps } from "../SelectItem";
4
- export interface SelectOption<T = string> {
4
+ export interface SelectOption<T = string | number> {
5
5
  groupLabel?: string;
6
6
  items: {
7
7
  label: string;
@@ -9,7 +9,7 @@ export interface SelectOption<T = string> {
9
9
  value: T;
10
10
  }[];
11
11
  }
12
- type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
12
+ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
13
13
  options: SelectOption<T>[];
14
14
  message?: string;
15
15
  disabled?: boolean;
@@ -19,17 +19,17 @@ type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" |
19
19
  renderOption?: (option: SelectOption<T>) => React.ReactNode;
20
20
  portal?: boolean;
21
21
  };
22
- export type SingleSelectProps<T> = BaseSelectProps<T> & {
22
+ export type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
23
23
  multi?: false;
24
24
  value: T;
25
25
  onChange: (value: T) => void;
26
26
  displayValue?: (value: SelectOption<T>) => string;
27
27
  };
28
- export type MultiSelectProps<T> = BaseSelectProps<T> & {
28
+ export type MultiSelectProps<T extends string | number> = BaseSelectProps<T> & {
29
29
  multi: true;
30
30
  value: T[];
31
31
  onChange: (value: T[]) => void;
32
32
  displayValue?: (value: SelectOption<T>[]) => string;
33
33
  };
34
- export type SelectProps<T> = SingleSelectProps<T> | MultiSelectProps<T>;
34
+ export type SelectProps<T extends string | number> = SingleSelectProps<T> | MultiSelectProps<T>;
35
35
  export {};
package/dist/index.d.ts CHANGED
@@ -3848,7 +3848,7 @@ declare const FISTooltip: FC<TooltipProps>;
3848
3848
  interface MenuItem {
3849
3849
  label: string;
3850
3850
  description?: string;
3851
- value: string;
3851
+ value: string | number;
3852
3852
  }
3853
3853
  interface MenuGroup {
3854
3854
  groupLabel?: string;
@@ -3863,8 +3863,8 @@ interface MenuProps {
3863
3863
  multi?: boolean;
3864
3864
  searchValue?: string;
3865
3865
  onSearchChange?: (value: string) => void;
3866
- selectedValues?: string[];
3867
- onChangeSelected?: (values: string[]) => void;
3866
+ selectedValues?: (string | number)[];
3867
+ onChangeSelected?: (values: (string | number)[]) => void;
3868
3868
  loading?: boolean;
3869
3869
  noData?: boolean;
3870
3870
  noResult?: boolean;
@@ -3993,7 +3993,7 @@ interface ComboboxOption {
3993
3993
  }[];
3994
3994
  }
3995
3995
  type SingleSelect<T> = {
3996
- multi?: boolean;
3996
+ multi?: false;
3997
3997
  value: T;
3998
3998
  onChange: (value: T) => void;
3999
3999
  displayValue?: (value: ComboboxOption) => string;
@@ -4220,7 +4220,7 @@ interface SelectFieldProps extends Omit<ComponentPropsWithoutRef<"input">, "onCl
4220
4220
  }
4221
4221
  declare const FISSelectItem: React$1.ForwardRefExoticComponent<SelectFieldProps & React$1.RefAttributes<HTMLInputElement>>;
4222
4222
 
4223
- interface SelectOption<T = string> {
4223
+ interface SelectOption<T = string | number> {
4224
4224
  groupLabel?: string;
4225
4225
  items: {
4226
4226
  label: string;
@@ -4228,7 +4228,7 @@ interface SelectOption<T = string> {
4228
4228
  value: T;
4229
4229
  }[];
4230
4230
  }
4231
- type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
4231
+ type BaseSelectProps<T extends string | number> = Partial<InputLabelProps> & Omit<MenuProps, "groups" | "multi" | "selectedValues" | "onChangeSelected" | "onClickMenu" | "size"> & Omit<SelectFieldProps, "value" | "onChange"> & {
4232
4232
  options: SelectOption<T>[];
4233
4233
  message?: string;
4234
4234
  disabled?: boolean;
@@ -4238,21 +4238,21 @@ type BaseSelectProps<T> = Partial<InputLabelProps> & Omit<MenuProps, "groups" |
4238
4238
  renderOption?: (option: SelectOption<T>) => React.ReactNode;
4239
4239
  portal?: boolean;
4240
4240
  };
4241
- type SingleSelectProps<T> = BaseSelectProps<T> & {
4241
+ type SingleSelectProps<T extends string | number> = BaseSelectProps<T> & {
4242
4242
  multi?: false;
4243
4243
  value: T;
4244
4244
  onChange: (value: T) => void;
4245
4245
  displayValue?: (value: SelectOption<T>) => string;
4246
4246
  };
4247
- type MultiSelectProps<T> = BaseSelectProps<T> & {
4247
+ type MultiSelectProps<T extends string | number> = BaseSelectProps<T> & {
4248
4248
  multi: true;
4249
4249
  value: T[];
4250
4250
  onChange: (value: T[]) => void;
4251
4251
  displayValue?: (value: SelectOption<T>[]) => string;
4252
4252
  };
4253
- type SelectProps<T> = SingleSelectProps<T> | MultiSelectProps<T>;
4253
+ type SelectProps<T extends string | number> = SingleSelectProps<T> | MultiSelectProps<T>;
4254
4254
 
4255
- declare const FISSelect: React$1.ForwardRefExoticComponent<SelectProps<string> & React$1.RefAttributes<HTMLInputElement>>;
4255
+ declare const FISSelect: React$1.ForwardRefExoticComponent<SelectProps<string | number> & React$1.RefAttributes<HTMLInputElement>>;
4256
4256
 
4257
4257
  type NotificationBaseProps = {
4258
4258
  title: string | React.ReactElement;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "homepage": "https://vietdiemtran.github.io/fis-component/",
3
3
  "name": "fis-component",
4
- "version": "0.0.57",
4
+ "version": "0.0.58",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",