@mw-kit/mw-ui 1.7.86 → 1.7.88

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.
@@ -11,8 +11,6 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
11
11
  icon?: {
12
12
  icon: IconProps;
13
13
  position?: 'left' | 'right';
14
- submit?: boolean;
15
- onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
16
14
  };
17
15
  clearable?: boolean | (() => void);
18
16
  setValue?: (value: string) => void;
@@ -27,6 +25,7 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
27
25
  paddingless?: boolean;
28
26
  inputWidth?: string;
29
27
  children?: React.ReactNode;
28
+ dirty?: (() => void) | string;
30
29
  }
31
30
  export interface StyledLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
32
31
  $readOnly?: boolean;
@@ -35,10 +34,8 @@ export interface StyledLabelProps extends React.LabelHTMLAttributes<HTMLLabelEle
35
34
  $viewMode?: boolean;
36
35
  $paddingless?: boolean;
37
36
  $loading?: boolean;
38
- $icon?: {
39
- width: string | number;
40
- position: 'left' | 'right';
41
- };
37
+ $iconPosition: Required<InputProps>['icon']['position'];
38
+ $iconWidths: (string | number)[];
42
39
  $width?: string;
43
40
  }
44
41
  export interface StyledInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'required'> {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { StyledInputProps, StyledLabelProps, StyledLabelTextProps } from './interfaces';
3
- export declare const IconContainer: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const IconContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
4
  export declare const ChildrenContainer: import("styled-components").StyledComponent<(props: import("../../../EllipsisContainer/types").EllipsisContainerProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
5
5
  export declare const Input: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, StyledInputProps, never>;
6
6
  export declare const InputContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
@@ -38,4 +38,5 @@ export interface Details {
38
38
  export interface IconProps {
39
39
  country: [Country, React.Dispatch<React.SetStateAction<Country>>];
40
40
  open: [boolean, React.Dispatch<React.SetStateAction<boolean>>];
41
+ disabled?: boolean;
41
42
  }
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import { useSelectReturn } from '../interfaces';
2
- import { SelectProps } from './interfaces';
3
- declare const useSelect: (props: SelectProps) => useSelectReturn;
3
+ import { Option, SelectProps } from './interfaces';
4
+ declare const useSelect: (props: SelectProps, [options, setOptions]: [Option[], React.Dispatch<React.SetStateAction<Option[]>>]) => useSelectReturn;
4
5
  export default useSelect;
@@ -5,6 +5,7 @@ export interface SelectProps extends CommonProps {
5
5
  setValue: (value: string, option: Option['data']) => void;
6
6
  onClear?: (value: '') => void;
7
7
  value: string | Pick<Option, 'value' | 'data' | 'label'>;
8
+ dirty?: (() => void) | Pick<Option, 'value' | 'data'>;
8
9
  }
9
10
  export declare type ContextInterface = CommonContext<SelectProps>;
10
11
  export * from '../interfaces';
@@ -1,4 +1,5 @@
1
+ import React from 'react';
1
2
  import { useSelectReturn } from '../interfaces';
2
- import { SelectProps } from './interfaces';
3
- declare const useSelectMultiple: (props: SelectProps) => useSelectReturn;
3
+ import { Option, SelectProps } from './interfaces';
4
+ declare const useSelectMultiple: (props: SelectProps, [options, setOptions]: [Option[], React.Dispatch<React.SetStateAction<Option[]>>]) => useSelectReturn;
4
5
  export default useSelectMultiple;
@@ -5,6 +5,7 @@ export interface SelectProps extends CommonProps {
5
5
  setValue: (value: string[], data: Option['data'][]) => void;
6
6
  value: (Pick<Option, 'value' | 'data'> | string)[];
7
7
  selectAll?: boolean;
8
+ dirty?: (() => void) | Pick<Option, 'value' | 'data'>[];
8
9
  }
9
10
  export interface ContextInterface extends CommonContext<SelectProps> {
10
11
  checked: [Pick<Option, 'value' | 'data'>[], React.Dispatch<React.SetStateAction<Pick<Option, 'value' | 'data'>[]>>];
@@ -18,8 +18,8 @@ interface LoaderReturn<T extends GenericObject = GenericObject> {
18
18
  options: Option<T>[];
19
19
  lastPage: boolean;
20
20
  }
21
- export declare type Loader<T extends GenericObject = GenericObject> = (search: string, page: number) => Promise<LoaderReturn<T> | Option<T>[]>;
22
- export interface CommonProps extends Omit<InputProps, 'type' | 'mask' | 'icon' | 'setValue' | 'value' | 'onChange' | 'children' | 'clearable'> {
21
+ export declare type Loader<T extends GenericObject = GenericObject> = (search: string, page: number) => Promise<LoaderReturn<T> | Option<T>[] | null>;
22
+ export interface CommonProps extends Omit<InputProps, 'type' | 'mask' | 'icon' | 'setValue' | 'value' | 'onChange' | 'children' | 'clearable' | 'dirty'> {
23
23
  onScrollEnd?: () => Promise<void>;
24
24
  position?: Position;
25
25
  search?: boolean;
@@ -27,9 +27,15 @@ export interface CommonProps extends Omit<InputProps, 'type' | 'mask' | 'icon' |
27
27
  x: number;
28
28
  y: number;
29
29
  };
30
+ /**
31
+ * async function to load options
32
+ *
33
+ * returning null will keep loading, until the loader be called again (useful when aborting requests)
34
+ */
30
35
  loader: Loader;
31
36
  maxHeight?: string;
32
37
  emptyContent?: ReactNode;
38
+ initialOptions?: Option[];
33
39
  }
34
40
  interface BaseContext {
35
41
  setOpen: React.Dispatch<React.SetStateAction<boolean>>;
@@ -53,5 +59,6 @@ export interface useSelectReturn {
53
59
  };
54
60
  getContext: (base: BaseContext, children: JSX.Element) => JSX.Element;
55
61
  onClear?: () => void;
62
+ dirty?: InputProps['dirty'];
56
63
  }
57
64
  export {};
@@ -1,13 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { SpacingOrZero, Spacings } from '../../interfaces';
3
- export declare type TabComponent<T = {}> = React.FunctionComponent<{
4
- data: T;
5
- }>;
6
- export declare type TabProvider<T = {}> = React.FunctionComponent<React.PropsWithChildren<{
7
- active: boolean;
8
- data: T;
9
- }>>;
10
- export declare type TabProps<T = {}> = {
3
+ declare type Tab<T = {}> = {
11
4
  /**
12
5
  * Define the tab label.
13
6
  */
@@ -16,7 +9,15 @@ export declare type TabProps<T = {}> = {
16
9
  * Define the tab data.
17
10
  */
18
11
  data: T;
19
- } & ({
12
+ };
13
+ export declare type TabComponent<T = {}> = React.FunctionComponent<{
14
+ data: T;
15
+ }>;
16
+ export declare type TabProvider<T = {}> = React.FunctionComponent<React.PropsWithChildren<{
17
+ active: boolean;
18
+ setTab: React.Dispatch<React.SetStateAction<Tab<T>>>;
19
+ } & Tab<T>>>;
20
+ export declare type TabProps<T = {}> = Tab<T> & ({
20
21
  /**
21
22
  * Specifies which component, will mount/unmount everytime the tab is ACTIVATED/INACTIVATED
22
23
  */
@@ -75,3 +76,4 @@ export interface StyledTabsProps {
75
76
  $active?: boolean;
76
77
  }
77
78
  export declare type TabsComponent = <T = {}>(props: React.PropsWithChildren<TabsProps<T>>) => JSX.Element;
79
+ export {};