@etsoo/react 1.1.93 → 1.1.97

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.
@@ -0,0 +1,46 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ import { AutocompleteProps } from '@mui/material';
3
+ /**
4
+ * Autocomplete extended props
5
+ */
6
+ export interface AutocompleteExtendedProps<T extends Record<string, any>> extends Omit<AutocompleteProps<T, undefined, boolean, false>, 'renderInput'> {
7
+ /**
8
+ * Id field, default is id
9
+ */
10
+ idField?: string;
11
+ /**
12
+ * Id value
13
+ */
14
+ idValue?: DataTypes.IdType;
15
+ /**
16
+ * If `dense` or `normal`, will adjust vertical spacing of this and contained components.
17
+ * @default 'none'
18
+ */
19
+ inputMargin?: 'dense' | 'normal' | 'none';
20
+ /**
21
+ * If `true`, the label will indicate that the `input` is required.
22
+ * @default false
23
+ */
24
+ inputRequired?: boolean;
25
+ /**
26
+ * The variant to use.
27
+ * @default 'outlined'
28
+ */
29
+ inputVariant?: 'standard' | 'outlined' | 'filled';
30
+ /**
31
+ * Label of the field
32
+ */
33
+ label: string;
34
+ /**
35
+ * Name of the field
36
+ */
37
+ name: string;
38
+ /**
39
+ * Is the field read only?
40
+ */
41
+ readOnly?: boolean;
42
+ /**
43
+ * Is search field?
44
+ */
45
+ search?: boolean;
46
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,38 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { DataTypes } from '@etsoo/shared';
3
- import { AutocompleteProps, TextFieldProps } from '@mui/material';
2
+ import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
4
3
  /**
5
4
  * ComboBox props
6
5
  */
7
- export interface ComboBoxProps<T extends Record<string, any>> extends Omit<AutocompleteProps<T, undefined, boolean, false>, 'renderInput'> {
8
- /**
9
- * Id field, default is id
10
- */
11
- idField?: string;
12
- /**
13
- * Id value
14
- */
15
- idValue?: DataTypes.IdType;
16
- /**
17
- * Input props
18
- */
19
- inputProps?: TextFieldProps;
20
- /**
21
- * Label of the field
22
- */
23
- label: string;
24
- /**
25
- * Name of the field
26
- */
27
- name: string;
28
- /**
29
- * Is the field read only?
30
- */
31
- readOnly?: boolean;
32
- /**
33
- * Is search field?
34
- */
35
- search?: boolean;
6
+ export interface ComboBoxProps<T extends Record<string, any>> extends AutocompleteExtendedProps<T> {
36
7
  }
37
8
  /**
38
9
  * ComboBox
@@ -10,7 +10,7 @@ import { SearchField } from './SearchField';
10
10
  */
11
11
  export function ComboBox(props) {
12
12
  // Destruct
13
- const { search = false, idField = 'id', inputProps, idValue, defaultValue, label, name, options, disableClearable = true, readOnly = true, onChange, value, sx = { minWidth: '120px' }, ...rest } = props;
13
+ const { search = false, idField = 'id', idValue, inputMargin, inputRequired, inputVariant, defaultValue, label, name, options, disableClearable = true, readOnly = true, onChange, value, sx = { minWidth: '120px' }, ...rest } = props;
14
14
  // Value input ref
15
15
  const inputRef = React.createRef();
16
16
  // Local default value
@@ -50,5 +50,5 @@ export function ComboBox(props) {
50
50
  // Custom
51
51
  if (onChange != null)
52
52
  onChange(event, value, reason, details);
53
- }, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), ...inputProps, label: label })) : (React.createElement(InputField, { ...addReadOnly(params), ...inputProps, label: label })), options: options, ...rest })));
53
+ }, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })) : (React.createElement(InputField, { ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })), options: options, ...rest })));
54
54
  }
@@ -31,4 +31,55 @@ export interface TextFieldExMethods {
31
31
  */
32
32
  setError(error: React.ReactNode): void;
33
33
  }
34
- export declare const TextFieldEx: React.ForwardRefExoticComponent<Pick<TextFieldExProps, "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "name" | "type" | "id" | "onScroll" | "className" | "rows" | "hidden" | "color" | "size" | "disabled" | "error" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "margin" | "variant" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "onEnter" | "inputProps" | "inputRef" | "fullWidth" | "SelectProps" | "InputLabelProps" | "focused" | "hiddenLabel" | "InputProps" | "FormHelperTextProps" | "helperText" | "multiline" | "maxRows" | "minRows" | "showClear" | "showPassword"> & React.RefAttributes<TextFieldExMethods>>;
34
+ export declare const TextFieldEx: React.ForwardRefExoticComponent<(Pick<import("@mui/material").StandardTextFieldProps & {
35
+ /**
36
+ * On enter click
37
+ */
38
+ onEnter?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
39
+ /**
40
+ * Is the field read only?
41
+ */
42
+ readOnly?: boolean | undefined;
43
+ /**
44
+ * Show clear button
45
+ */
46
+ showClear?: boolean | undefined;
47
+ /**
48
+ * Show password button
49
+ */
50
+ showPassword?: boolean | undefined;
51
+ }, "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "name" | "type" | "id" | "onScroll" | "className" | "rows" | "hidden" | "color" | "size" | "disabled" | "error" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "margin" | "variant" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "onEnter" | "inputProps" | "inputRef" | "fullWidth" | "SelectProps" | "InputLabelProps" | "focused" | "hiddenLabel" | "InputProps" | "FormHelperTextProps" | "helperText" | "multiline" | "maxRows" | "minRows" | "showClear" | "showPassword"> | Pick<import("@mui/material").FilledTextFieldProps & {
52
+ /**
53
+ * On enter click
54
+ */
55
+ onEnter?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
56
+ /**
57
+ * Is the field read only?
58
+ */
59
+ readOnly?: boolean | undefined;
60
+ /**
61
+ * Show clear button
62
+ */
63
+ showClear?: boolean | undefined;
64
+ /**
65
+ * Show password button
66
+ */
67
+ showPassword?: boolean | undefined;
68
+ }, "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "name" | "type" | "id" | "onScroll" | "className" | "rows" | "hidden" | "color" | "size" | "disabled" | "error" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "margin" | "variant" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "onEnter" | "inputProps" | "inputRef" | "fullWidth" | "SelectProps" | "InputLabelProps" | "focused" | "hiddenLabel" | "InputProps" | "FormHelperTextProps" | "helperText" | "multiline" | "maxRows" | "minRows" | "showClear" | "showPassword"> | Pick<import("@mui/material").OutlinedTextFieldProps & {
69
+ /**
70
+ * On enter click
71
+ */
72
+ onEnter?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
73
+ /**
74
+ * Is the field read only?
75
+ */
76
+ readOnly?: boolean | undefined;
77
+ /**
78
+ * Show clear button
79
+ */
80
+ showClear?: boolean | undefined;
81
+ /**
82
+ * Show password button
83
+ */
84
+ showPassword?: boolean | undefined;
85
+ }, "children" | "label" | "slot" | "select" | "style" | "title" | "value" | "name" | "type" | "id" | "onScroll" | "className" | "rows" | "hidden" | "color" | "size" | "disabled" | "error" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "margin" | "variant" | "autoFocus" | "autoComplete" | "readOnly" | "required" | "onEnter" | "inputProps" | "inputRef" | "fullWidth" | "SelectProps" | "InputLabelProps" | "focused" | "hiddenLabel" | "InputProps" | "FormHelperTextProps" | "helperText" | "multiline" | "maxRows" | "minRows" | "showClear" | "showPassword">) & React.RefAttributes<TextFieldExMethods>>;
@@ -1,42 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { DataTypes } from '@etsoo/shared';
3
- import { AutocompleteProps, TextFieldProps } from '@mui/material';
3
+ import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
4
4
  /**
5
5
  * Tiplist props
6
6
  */
7
- export interface TiplistProps<T extends Record<string, any>> extends Omit<AutocompleteProps<T, undefined, boolean, false>, 'renderInput' | 'options' | 'open'> {
8
- /**
9
- * Id field, default is id
10
- */
11
- idField?: string;
12
- /**
13
- * Id value
14
- */
15
- idValue?: DataTypes.IdType;
16
- /**
17
- * Input props
18
- */
19
- inputProps?: TextFieldProps;
20
- /**
21
- * Label of the field
22
- */
23
- label: string;
7
+ export interface TiplistProps<T extends Record<string, any>> extends Omit<AutocompleteExtendedProps<T>, 'options' | 'open'> {
24
8
  /**
25
9
  * Load data callback
26
10
  */
27
11
  loadData: (keyword?: string, id?: DataTypes.IdType) => PromiseLike<T[] | null | undefined>;
28
- /**
29
- * Name of the field
30
- */
31
- name: string;
32
- /**
33
- * Is the field read only?
34
- */
35
- readOnly?: boolean;
36
- /**
37
- * Is search field?
38
- */
39
- search?: boolean;
40
12
  }
41
13
  /**
42
14
  * Tiplist
package/lib/mu/Tiplist.js CHANGED
@@ -10,7 +10,7 @@ import { SearchField } from './SearchField';
10
10
  */
11
11
  export function Tiplist(props) {
12
12
  // Destruct
13
- const { search = false, idField = 'id', idValue, inputProps, label, loadData, defaultValue, value, name, readOnly, onChange, sx = { minWidth: '150px' }, ...rest } = props;
13
+ const { search = false, idField = 'id', idValue, inputMargin, inputRequired, inputVariant, label, loadData, defaultValue, value, name, readOnly, onChange, sx = { minWidth: '150px' }, ...rest } = props;
14
14
  // Value input ref
15
15
  const inputRef = React.createRef();
16
16
  // Local value
@@ -149,5 +149,5 @@ export function Tiplist(props) {
149
149
  open: false,
150
150
  ...(!states.value && { options: [] })
151
151
  });
152
- }, loading: states.loading, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, readOnly: readOnly, ...addReadOnly(params), ...inputProps, label: label })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), ...inputProps, label: label })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], ...rest })));
152
+ }, loading: states.loading, sx: sx, renderInput: (params) => search ? (React.createElement(SearchField, { onChange: changeHandle, ...params, readOnly: readOnly, label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })) : (React.createElement(InputField, { onChange: changeHandle, ...addReadOnly(params), label: label, margin: inputMargin, variant: inputVariant, required: inputRequired })), isOptionEqualToValue: (option, value) => option[idField] === value[idField], ...rest })));
153
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.1.93",
3
+ "version": "1.1.97",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,16 +44,16 @@
44
44
  "@emotion/react": "^11.4.1",
45
45
  "@emotion/style": "^0.8.0",
46
46
  "@emotion/styled": "^11.3.0",
47
- "@etsoo/appscript": "^1.0.88",
47
+ "@etsoo/appscript": "^1.0.89",
48
48
  "@etsoo/notificationbase": "^1.0.78",
49
49
  "@etsoo/shared": "^1.0.41",
50
- "@mui/icons-material": "^5.0.0",
51
- "@mui/material": "^5.0.0",
50
+ "@mui/icons-material": "^5.0.1",
51
+ "@mui/material": "^5.0.1",
52
52
  "@reach/router": "^1.3.4",
53
53
  "@types/pica": "^5.1.3",
54
54
  "@types/pulltorefreshjs": "^0.1.5",
55
55
  "@types/reach__router": "^1.3.9",
56
- "@types/react": "^17.0.20",
56
+ "@types/react": "^17.0.24",
57
57
  "@types/react-avatar-editor": "^10.3.6",
58
58
  "@types/react-dom": "^17.0.9",
59
59
  "@types/react-window": "^1.8.5",
@@ -66,20 +66,20 @@
66
66
  "react-window": "^1.8.6"
67
67
  },
68
68
  "devDependencies": {
69
- "@babel/cli": "^7.15.4",
69
+ "@babel/cli": "^7.15.7",
70
70
  "@babel/core": "^7.15.5",
71
71
  "@babel/plugin-transform-runtime": "^7.15.0",
72
72
  "@babel/preset-env": "^7.15.6",
73
73
  "@babel/runtime-corejs3": "^7.15.4",
74
- "@types/jest": "^27.0.1",
74
+ "@types/jest": "^27.0.2",
75
75
  "@types/react-test-renderer": "^17.0.1",
76
- "@typescript-eslint/eslint-plugin": "^4.31.1",
77
- "@typescript-eslint/parser": "^4.31.1",
76
+ "@typescript-eslint/eslint-plugin": "^4.32.0",
77
+ "@typescript-eslint/parser": "^4.32.0",
78
78
  "eslint": "^7.32.0",
79
79
  "eslint-config-airbnb-base": "^14.2.1",
80
80
  "eslint-plugin-import": "^2.24.2",
81
- "eslint-plugin-react": "^7.25.1",
82
- "jest": "^27.2.0",
81
+ "eslint-plugin-react": "^7.26.0",
82
+ "jest": "^27.2.3",
83
83
  "react-test-renderer": "^17.0.2",
84
84
  "ts-jest": "^27.0.5",
85
85
  "typescript": "^4.4.3"
@@ -0,0 +1,59 @@
1
+ import { DataTypes } from '@etsoo/shared';
2
+ import { AutocompleteProps } from '@mui/material';
3
+
4
+ /**
5
+ * Autocomplete extended props
6
+ */
7
+ export interface AutocompleteExtendedProps<T extends Record<string, any>>
8
+ extends Omit<
9
+ AutocompleteProps<T, undefined, boolean, false>,
10
+ 'renderInput'
11
+ > {
12
+ /**
13
+ * Id field, default is id
14
+ */
15
+ idField?: string;
16
+
17
+ /**
18
+ * Id value
19
+ */
20
+ idValue?: DataTypes.IdType;
21
+
22
+ /**
23
+ * If `dense` or `normal`, will adjust vertical spacing of this and contained components.
24
+ * @default 'none'
25
+ */
26
+ inputMargin?: 'dense' | 'normal' | 'none';
27
+
28
+ /**
29
+ * If `true`, the label will indicate that the `input` is required.
30
+ * @default false
31
+ */
32
+ inputRequired?: boolean;
33
+
34
+ /**
35
+ * The variant to use.
36
+ * @default 'outlined'
37
+ */
38
+ inputVariant?: 'standard' | 'outlined' | 'filled';
39
+
40
+ /**
41
+ * Label of the field
42
+ */
43
+ label: string;
44
+
45
+ /**
46
+ * Name of the field
47
+ */
48
+ name: string;
49
+
50
+ /**
51
+ * Is the field read only?
52
+ */
53
+ readOnly?: boolean;
54
+
55
+ /**
56
+ * Is search field?
57
+ */
58
+ search?: boolean;
59
+ }
@@ -1,12 +1,7 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import {
3
- Autocomplete,
4
- AutocompleteProps,
5
- AutocompleteRenderInputParams,
6
- TextFieldProps
7
- } from '@mui/material';
1
+ import { Autocomplete, AutocompleteRenderInputParams } from '@mui/material';
8
2
  import React from 'react';
9
3
  import { Utils } from '../app/Utils';
4
+ import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
10
5
  import { InputField } from './InputField';
11
6
  import { SearchField } from './SearchField';
12
7
 
@@ -14,45 +9,7 @@ import { SearchField } from './SearchField';
14
9
  * ComboBox props
15
10
  */
16
11
  export interface ComboBoxProps<T extends Record<string, any>>
17
- extends Omit<
18
- AutocompleteProps<T, undefined, boolean, false>,
19
- 'renderInput'
20
- > {
21
- /**
22
- * Id field, default is id
23
- */
24
- idField?: string;
25
-
26
- /**
27
- * Id value
28
- */
29
- idValue?: DataTypes.IdType;
30
-
31
- /**
32
- * Input props
33
- */
34
- inputProps?: TextFieldProps;
35
-
36
- /**
37
- * Label of the field
38
- */
39
- label: string;
40
-
41
- /**
42
- * Name of the field
43
- */
44
- name: string;
45
-
46
- /**
47
- * Is the field read only?
48
- */
49
- readOnly?: boolean;
50
-
51
- /**
52
- * Is search field?
53
- */
54
- search?: boolean;
55
- }
12
+ extends AutocompleteExtendedProps<T> {}
56
13
 
57
14
  /**
58
15
  * ComboBox
@@ -66,8 +23,10 @@ export function ComboBox<T extends Record<string, any>>(
66
23
  const {
67
24
  search = false,
68
25
  idField = 'id',
69
- inputProps,
70
26
  idValue,
27
+ inputMargin,
28
+ inputRequired,
29
+ inputVariant,
71
30
  defaultValue,
72
31
  label,
73
32
  name,
@@ -149,14 +108,18 @@ export function ComboBox<T extends Record<string, any>>(
149
108
  search ? (
150
109
  <SearchField
151
110
  {...addReadOnly(params)}
152
- {...inputProps}
153
111
  label={label}
112
+ margin={inputMargin}
113
+ variant={inputVariant}
114
+ required={inputRequired}
154
115
  />
155
116
  ) : (
156
117
  <InputField
157
118
  {...addReadOnly(params)}
158
- {...inputProps}
159
119
  label={label}
120
+ margin={inputMargin}
121
+ variant={inputVariant}
122
+ required={inputRequired}
160
123
  />
161
124
  )
162
125
  }
@@ -1,12 +1,8 @@
1
1
  import { DataTypes } from '@etsoo/shared';
2
- import {
3
- Autocomplete,
4
- AutocompleteProps,
5
- AutocompleteRenderInputParams,
6
- TextFieldProps
7
- } from '@mui/material';
2
+ import { Autocomplete, AutocompleteRenderInputParams } from '@mui/material';
8
3
  import React from 'react';
9
4
  import { Utils } from '../app/Utils';
5
+ import { AutocompleteExtendedProps } from './AutocompleteExtendedProps';
10
6
  import { InputField } from './InputField';
11
7
  import { SearchField } from './SearchField';
12
8
 
@@ -14,30 +10,7 @@ import { SearchField } from './SearchField';
14
10
  * Tiplist props
15
11
  */
16
12
  export interface TiplistProps<T extends Record<string, any>>
17
- extends Omit<
18
- AutocompleteProps<T, undefined, boolean, false>,
19
- 'renderInput' | 'options' | 'open'
20
- > {
21
- /**
22
- * Id field, default is id
23
- */
24
- idField?: string;
25
-
26
- /**
27
- * Id value
28
- */
29
- idValue?: DataTypes.IdType;
30
-
31
- /**
32
- * Input props
33
- */
34
- inputProps?: TextFieldProps;
35
-
36
- /**
37
- * Label of the field
38
- */
39
- label: string;
40
-
13
+ extends Omit<AutocompleteExtendedProps<T>, 'options' | 'open'> {
41
14
  /**
42
15
  * Load data callback
43
16
  */
@@ -45,21 +18,6 @@ export interface TiplistProps<T extends Record<string, any>>
45
18
  keyword?: string,
46
19
  id?: DataTypes.IdType
47
20
  ) => PromiseLike<T[] | null | undefined>;
48
-
49
- /**
50
- * Name of the field
51
- */
52
- name: string;
53
-
54
- /**
55
- * Is the field read only?
56
- */
57
- readOnly?: boolean;
58
-
59
- /**
60
- * Is search field?
61
- */
62
- search?: boolean;
63
21
  }
64
22
 
65
23
  // Multiple states
@@ -81,7 +39,9 @@ export function Tiplist<T extends Record<string, any>>(props: TiplistProps<T>) {
81
39
  search = false,
82
40
  idField = 'id',
83
41
  idValue,
84
- inputProps,
42
+ inputMargin,
43
+ inputRequired,
44
+ inputVariant,
85
45
  label,
86
46
  loadData,
87
47
  defaultValue,
@@ -294,17 +254,21 @@ export function Tiplist<T extends Record<string, any>>(props: TiplistProps<T>) {
294
254
  search ? (
295
255
  <SearchField
296
256
  onChange={changeHandle}
257
+ {...params}
297
258
  readOnly={readOnly}
298
- {...addReadOnly(params)}
299
- {...inputProps}
300
259
  label={label}
260
+ margin={inputMargin}
261
+ variant={inputVariant}
262
+ required={inputRequired}
301
263
  />
302
264
  ) : (
303
265
  <InputField
304
266
  onChange={changeHandle}
305
267
  {...addReadOnly(params)}
306
- {...inputProps}
307
268
  label={label}
269
+ margin={inputMargin}
270
+ variant={inputVariant}
271
+ required={inputRequired}
308
272
  />
309
273
  )
310
274
  }