@mw-kit/mw-ui 1.7.28 → 1.7.29

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.
@@ -3,7 +3,7 @@ export interface SelectProps extends CommonProps {
3
3
  type: 'select';
4
4
  name?: string;
5
5
  setValue: (value: string, option: Option['data']) => void;
6
- onClear: (value: string) => void;
6
+ onClear?: (value: string) => void;
7
7
  value: string;
8
8
  }
9
9
  export declare type ContextInterface = CommonContext<SelectProps>;
@@ -10,7 +10,7 @@ export declare type SelectOptionLabelProps<T extends GenericObject = GenericObje
10
10
  mode?: 'placeholder';
11
11
  };
12
12
  export declare type SelectOptionLabelComponent<T extends GenericObject = GenericObject> = React.FunctionComponent<SelectOptionLabelProps<T>>;
13
- export declare type Option<T extends GenericObject = GenericObject> = Pick<MenuOption, 'onClick' | 'rules' | 'data' | 'disabled'> & {
13
+ export declare type Option<T extends GenericObject = GenericObject> = Pick<MenuOption<T>, 'onClick' | 'rules' | 'data' | 'disabled'> & {
14
14
  label: ReactNode | SelectOptionLabelComponent<T>;
15
15
  value: string;
16
16
  };
@@ -53,6 +53,6 @@ export interface useSelectReturn {
53
53
  maxHeight: string;
54
54
  };
55
55
  getContext: (base: BaseContext, children: JSX.Element) => JSX.Element;
56
- onClear: () => void;
56
+ onClear?: () => void;
57
57
  }
58
58
  export {};
@@ -3,7 +3,7 @@ import { PopupProps } from 'semantic-ui-react';
3
3
  import { Borders, ReactNode, GenericObject, SpacingOrZero, Spacings } from '../../interfaces';
4
4
  import { AbsoluteContainerProps } from '../AbsoluteContainer/interfaces';
5
5
  /** funcao que fara a validacao da regra, deve retornar true caso passe na validacao, e false ou o conteudo do popup caso contrario */
6
- declare type Rule = (index: number, data: GenericObject) => boolean | Omit<PopupProps, 'trigger'>;
6
+ declare type Rule<T extends GenericObject = GenericObject> = (index: number, data: T) => boolean | Omit<PopupProps, 'trigger'>;
7
7
  export declare type MenuOptionLabelProps<T extends GenericObject = GenericObject> = {
8
8
  delimiter?: boolean;
9
9
  keepOpen?: boolean;
@@ -16,7 +16,7 @@ export declare type OptionLabelComponent<T extends GenericObject = GenericObject
16
16
  export declare type Option<T extends GenericObject = GenericObject> = MenuOptionLabelProps<T> & {
17
17
  label: ReactNode | OptionLabelComponent<T>;
18
18
  onClick?: (index: number, option: Option, event: React.MouseEvent) => void;
19
- rules?: Rule[];
19
+ rules?: Rule<T>[];
20
20
  };
21
21
  export interface CommonProps extends Omit<AbsoluteContainerProps, 'children'> {
22
22
  bordered?: boolean;
package/dist/index.js CHANGED
@@ -14390,7 +14390,7 @@ var useSelect = function useSelect(props) {
14390
14390
 
14391
14391
  var selectedOption = getSelected(props.value, options);
14392
14392
  var inputContent = selectedOption ? getInputContent(props, selectedOption) : props.value;
14393
- return {
14393
+ var parsed = {
14394
14394
  parsedOptions: parsedOptions,
14395
14395
  options: [options, setOptions],
14396
14396
  inputContent: inputContent,
@@ -14407,11 +14407,13 @@ var useSelect = function useSelect(props) {
14407
14407
  options: options
14408
14408
  })
14409
14409
  }, children);
14410
- },
14411
- onClear: function onClear() {
14412
- return props.onClear('');
14413
14410
  }
14414
14411
  };
14412
+ var onClear = props.onClear;
14413
+ if (onClear) parsed.onClear = function () {
14414
+ return onClear('');
14415
+ };
14416
+ return parsed;
14415
14417
  };
14416
14418
 
14417
14419
  var Provider$1 = React__default.createContext({});