@ringcentral/juno 1.12.3-beta.5791-ea7a35ca → 1.12.3
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/components/Buttons/Button/Button.d.ts +2 -2
- package/components/Buttons/Button/styles/StyledButton.js +4 -2
- package/components/Card/Card/Card.d.ts +2 -2
- package/components/Chip/Chip.d.ts +10 -3
- package/components/Chip/Chip.js +5 -3
- package/components/Chip/styles/ChipStyle.js +5 -4
- package/components/Chip/utils/ChipUtils.d.ts +1 -1
- package/components/Chip/utils/ChipUtils.js +1 -1
- package/components/Dialer/DialTextField/DialTextField.d.ts +1 -1
- package/components/Downshift/Downshift.d.ts +20 -9
- package/components/Downshift/Downshift.js +15 -5
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +2 -2
- package/components/Downshift/SuggestionList/SuggestionList.js +12 -6
- package/components/Downshift/SuggestionList/utils/index.d.ts +1 -0
- package/components/Downshift/SuggestionList/utils/index.js +1 -0
- package/components/Downshift/SuggestionList/utils/useSuggestionList.d.ts +298 -0
- package/components/Downshift/SuggestionList/utils/useSuggestionList.js +239 -0
- package/components/Downshift/styles/StyledTextField.d.ts +1 -1
- package/components/Downshift/utils/DownshiftUtils.d.ts +12 -0
- package/components/Downshift/utils/DownshiftUtils.js +19 -1
- package/components/Downshift/utils/SelectItem.d.ts +19 -0
- package/components/Downshift/utils/useDownshift.d.ts +5 -2
- package/components/Downshift/utils/useDownshift.interface.d.ts +5 -0
- package/components/Downshift/utils/useDownshift.js +31 -13
- package/components/Downshift/utils/useDownshiftGroup.d.ts +7 -7
- package/components/Downshift/utils/useDownshiftGroup.js +45 -19
- package/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
- package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +1 -1
- package/components/Forms/Picker/styles/StyledPickerTextField.d.ts +1 -1
- package/components/Forms/Select/PlainSelect/PlainSelect.d.ts +1 -1
- package/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
- package/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
- package/components/Forms/Select/Select.d.ts +2 -2
- package/components/Forms/Select/Select.js +2 -2
- package/components/Forms/Select/styles/StyledSelect.js +22 -18
- package/components/Forms/TextField/TextField.d.ts +4 -2
- package/components/Forms/TextField/TextField.js +2 -2
- package/components/Forms/TextField/styles/OutlineTextFieldStyle.js +4 -2
- package/components/Forms/TextField/styles/TextFieldStyle.js +8 -4
- package/components/Forms/Textarea/Textarea.d.ts +1 -1
- package/components/Menu/SubMenu/SubMenu.js +1 -1
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +1 -1
- package/es6/components/Buttons/Button/styles/StyledButton.js +4 -2
- package/es6/components/Chip/Chip.js +6 -4
- package/es6/components/Chip/styles/ChipStyle.js +6 -5
- package/es6/components/Chip/utils/ChipUtils.js +1 -1
- package/es6/components/Downshift/Downshift.js +16 -7
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -7
- package/es6/components/Downshift/SuggestionList/utils/index.js +1 -0
- package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +237 -0
- package/es6/components/Downshift/utils/DownshiftUtils.js +19 -1
- package/es6/components/Downshift/utils/useDownshift.js +31 -13
- package/es6/components/Downshift/utils/useDownshiftGroup.js +46 -20
- package/es6/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
- package/es6/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +1 -1
- package/es6/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
- package/es6/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
- package/es6/components/Forms/Select/Select.js +2 -2
- package/es6/components/Forms/Select/styles/StyledSelect.js +24 -20
- package/es6/components/Forms/TextField/TextField.js +2 -2
- package/es6/components/Forms/TextField/styles/OutlineTextFieldStyle.js +5 -3
- package/es6/components/Forms/TextField/styles/TextFieldStyle.js +9 -5
- package/es6/components/Menu/SubMenu/SubMenu.js +1 -1
- package/es6/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
- package/es6/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
- package/foundation/hooks/useAnnouncer/useAnnouncer.d.ts +7 -0
- package/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
- package/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { RcDownshiftProps } from '../Downshift';
|
|
|
4
4
|
declare type StyledTextFieldProps = {
|
|
5
5
|
hasTags: boolean;
|
|
6
6
|
} & RcTextFieldProps & Pick<RcDownshiftProps, 'renderInput'>;
|
|
7
|
-
export declare const StyledTextField: import("styled-components").StyledComponentClass<Pick<StyledTextFieldProps, "key" | "className" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & React.RefAttributes<any>, import("../../../foundation").RcTheme, Pick<Pick<StyledTextFieldProps, "key" | "className" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & React.RefAttributes<any>, "ref" | "key" | "className" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & {
|
|
7
|
+
export declare const StyledTextField: import("styled-components").StyledComponentClass<Pick<StyledTextFieldProps, "key" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & React.RefAttributes<any>, import("../../../foundation").RcTheme, Pick<Pick<StyledTextFieldProps, "key" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & React.RefAttributes<any>, "ref" | "key" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "radius" | "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" | "children" | "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" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "label" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "disabled" | "focused" | "autoFocus" | "fullWidth" | "error" | "inputProps" | "inputRef" | "required" | "InputProps" | "autoComplete" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "multiline" | "rows" | "maxRows" | "minRows" | "align" | "gutterBottom" | "onClear" | "clearBtn" | "clearButtonProps" | "clearLabel" | "textVariant" | "autoSelect" | "focusOnMount" | "selectOnMount" | "autoFocusDelay" | "clearAriaLabel" | "validate" | "renderInput" | "hasTags"> & {
|
|
8
8
|
theme?: import("../../../foundation").RcTheme | undefined;
|
|
9
9
|
}>;
|
|
10
10
|
export {};
|
|
@@ -6,4 +6,16 @@ export declare const DEFAULT_KEY_TO_CHIPS: string[];
|
|
|
6
6
|
export declare const DEFAULT_LIMIT_CHIPS = 20;
|
|
7
7
|
export declare const DEFAULT_GET_OPTION_LABEL: (item: RcDownshiftSelectedItem) => string;
|
|
8
8
|
export declare const RcDownshiftDefaultRenderNoOptions: RcDownshiftProps['renderNoOptions'];
|
|
9
|
+
/**
|
|
10
|
+
* default downshift filter options method, use with `variant="tags"`
|
|
11
|
+
*
|
|
12
|
+
* - filter options by input value and selected items
|
|
13
|
+
*/
|
|
9
14
|
export declare const RcDownshiftDefaultFilterOptions: RcDownshiftProps['filterOptions'];
|
|
15
|
+
/**
|
|
16
|
+
* default downshift filter options method, use with `variant="autocomplete"`
|
|
17
|
+
*
|
|
18
|
+
* - when open menu and not change value, that will return whole options
|
|
19
|
+
* - only filter options by input value when have input value changed
|
|
20
|
+
*/
|
|
21
|
+
export declare const RcAutocompleteDefaultFilterOptions: RcDownshiftProps['filterOptions'];
|
|
@@ -11,14 +11,32 @@ exports.isItemCanSelected = function (item) {
|
|
|
11
11
|
exports.DEFAULT_KEY_TO_CHIPS = [';', ',', '\\n'];
|
|
12
12
|
exports.DEFAULT_LIMIT_CHIPS = 20;
|
|
13
13
|
exports.DEFAULT_GET_OPTION_LABEL = function (item) {
|
|
14
|
-
return item.label || '';
|
|
14
|
+
return (item === null || item === void 0 ? void 0 : item.label) || '';
|
|
15
15
|
};
|
|
16
16
|
exports.RcDownshiftDefaultRenderNoOptions = function (getNoOptionsProps) {
|
|
17
17
|
return (react_1.default.createElement(MenuItem_1.RcMenuItem, tslib_1.__assign({ component: "div" }, getNoOptionsProps()), "No Options"));
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* default downshift filter options method, use with `variant="tags"`
|
|
21
|
+
*
|
|
22
|
+
* - filter options by input value and selected items
|
|
23
|
+
*/
|
|
19
24
|
exports.RcDownshiftDefaultFilterOptions = function (options, _a) {
|
|
20
25
|
var inputValue = _a.inputValue, getOptionLabel = _a.getOptionLabel, selectedItems = _a.selectedItems;
|
|
21
26
|
return options.filter(function (item) {
|
|
22
27
|
return selectedItems.indexOf(item) < 0 && (getOptionLabel === null || getOptionLabel === void 0 ? void 0 : getOptionLabel(item).toLowerCase().startsWith((inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase()) || ''));
|
|
23
28
|
});
|
|
24
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* default downshift filter options method, use with `variant="autocomplete"`
|
|
32
|
+
*
|
|
33
|
+
* - when open menu and not change value, that will return whole options
|
|
34
|
+
* - only filter options by input value when have input value changed
|
|
35
|
+
*/
|
|
36
|
+
exports.RcAutocompleteDefaultFilterOptions = function (options, _a) {
|
|
37
|
+
var inputValue = _a.inputValue, getOptionLabel = _a.getOptionLabel, inputChanged = _a.inputChanged;
|
|
38
|
+
if (!inputChanged) {
|
|
39
|
+
return options;
|
|
40
|
+
}
|
|
41
|
+
return options.filter(function (item) { return getOptionLabel === null || getOptionLabel === void 0 ? void 0 : getOptionLabel(item).toLowerCase().startsWith((inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase()) || ''); });
|
|
42
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { RcIconButtonProps } from '../../Buttons/IconButton';
|
|
2
3
|
export declare type RcDownshiftSelectedItem = {
|
|
3
4
|
/** children item id */
|
|
@@ -28,6 +29,24 @@ export declare type RcDownshiftSelectedItem = {
|
|
|
28
29
|
/** @deprecated is that item error, should use `error` to replace that */
|
|
29
30
|
isError?: boolean;
|
|
30
31
|
};
|
|
32
|
+
export declare type RcDownshiftSelectedItemAdditionProps = {
|
|
33
|
+
/** that key of item */
|
|
34
|
+
key?: string;
|
|
35
|
+
/** role of that item */
|
|
36
|
+
role?: string;
|
|
37
|
+
/** when that item is group, that will get class with `classes.groupTitle` */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** current position of set */
|
|
40
|
+
'aria-posinset'?: number;
|
|
41
|
+
/** number of all options */
|
|
42
|
+
'aria-setsize'?: number;
|
|
43
|
+
/** binding event when click item */
|
|
44
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
45
|
+
/** stop propagation */
|
|
46
|
+
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
|
47
|
+
/** binding mouse over event */
|
|
48
|
+
onMouseOver?: React.MouseEventHandler<HTMLElement>;
|
|
49
|
+
};
|
|
31
50
|
export interface RcDownshiftGroupedOption<T = RcDownshiftSelectedItem> {
|
|
32
51
|
/** group key */
|
|
33
52
|
key: number;
|
|
@@ -16,8 +16,8 @@ declare type UseDownshiftParams = {
|
|
|
16
16
|
* set that will auto add item into options
|
|
17
17
|
*/
|
|
18
18
|
addNoOptionItem?: 'first' | 'last';
|
|
19
|
-
} & Pick<RcDownshiftProps<RcDownshiftSelectedItem>, 'open' | 'onOpen' | 'onClose' | 'multiple' | 'onChange' | 'value' | 'getOptionLabel' | 'filterOptions' | 'options' | 'freeSolo' | 'maxFreeSolo' | 'onMaxFreeSolo' | 'disableCloseOnSelect' | 'initialIsOpen' | 'keyToTags' | 'inputValue' | 'autoSelect' | 'onInputChange' | 'onKeyDown' | 'disabled' | 'openOnFocus' | 'onClear' | 'renderNoOptions' | 'autoHighlight' | 'getOptionDisabled' | 'required' | 'label' | 'disabledItemsHighlightable' | 'variant' | 'groupBy' | 'getExpandIconProps' | 'groupExpanded' | 'onGroupExpanded' | 'groupVariant'>;
|
|
20
|
-
export declare const useDownshift: ({ multiple: multipleProp, variant, label: labelProp, inputValue: inputValueProp, getOptionLabel, keyToTags, filterOptions, disabledItemsHighlightable, options, freeSolo, onInputChange: onInputChangeProp, maxFreeSolo, onMaxFreeSolo, openOnFocus, disableCloseOnSelect, initialIsOpen, autoSelect, inputContainerRef, inputRef, wrapperRef, onKeyDown: onKeyDownProp, onChange: onSelectChange, value: selectedItemsProp, disabled, renderNoOptions, onClear, autoHighlight, getOptionDisabled, addNoOptionItem, groupBy, onGroupExpanded, groupVariant, groupExpanded, getExpandIconProps, required, open: openProp, onOpen, onClose, }: UseDownshiftParams) => {
|
|
19
|
+
} & Pick<RcDownshiftProps<RcDownshiftSelectedItem>, 'open' | 'onOpen' | 'onClose' | 'multiple' | 'onChange' | 'value' | 'getOptionLabel' | 'filterOptions' | 'options' | 'freeSolo' | 'maxFreeSolo' | 'onMaxFreeSolo' | 'disableCloseOnSelect' | 'initialIsOpen' | 'keyToTags' | 'inputValue' | 'autoSelect' | 'onInputChange' | 'onKeyDown' | 'disabled' | 'openOnFocus' | 'onClear' | 'renderNoOptions' | 'autoHighlight' | 'getOptionDisabled' | 'required' | 'label' | 'disabledItemsHighlightable' | 'variant' | 'groupBy' | 'getExpandIconProps' | 'groupExpanded' | 'groupDefaultExpanded' | 'onGroupExpanded' | 'groupVariant' | 'focused'>;
|
|
20
|
+
export declare const useDownshift: ({ multiple: multipleProp, variant, label: labelProp, inputValue: inputValueProp, getOptionLabel, keyToTags, filterOptions, disabledItemsHighlightable, options, freeSolo, onInputChange: onInputChangeProp, maxFreeSolo, onMaxFreeSolo, openOnFocus, disableCloseOnSelect, initialIsOpen, autoSelect, inputContainerRef, inputRef, wrapperRef, onKeyDown: onKeyDownProp, onChange: onSelectChange, value: selectedItemsProp, disabled, renderNoOptions, onClear, autoHighlight, getOptionDisabled, addNoOptionItem, groupBy, onGroupExpanded, groupVariant, groupExpanded, groupDefaultExpanded, getExpandIconProps, required, open: openProp, onOpen, onClose, focused: focusedProp, }: UseDownshiftParams) => {
|
|
21
21
|
focusInput: () => void | undefined;
|
|
22
22
|
setIsTagsFocus: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
23
23
|
readOnly: boolean | undefined;
|
|
@@ -832,5 +832,8 @@ export declare const useDownshift: ({ multiple: multipleProp, variant, label: la
|
|
|
832
832
|
reset: (isFocus?: boolean | undefined) => void;
|
|
833
833
|
forceUpdate: () => void;
|
|
834
834
|
optionsGroupList: import("./SelectItem").RcDownshiftGroupedOption<RcDownshiftSelectedItem>[];
|
|
835
|
+
isFocused: boolean;
|
|
836
|
+
id: string;
|
|
837
|
+
inputChanged: boolean;
|
|
835
838
|
};
|
|
836
839
|
export {};
|
|
@@ -12,8 +12,13 @@ export declare type RcDownshiftGetSelectedItemProps<T> = {
|
|
|
12
12
|
[arbitrary: string]: any;
|
|
13
13
|
} & Omit<React.HTMLAttributes<HTMLElement>, 'children'>;
|
|
14
14
|
export declare type RcDownshiftFilterOptions<T> = (options: T[], state: {
|
|
15
|
+
/** current input value */
|
|
15
16
|
inputValue?: string;
|
|
17
|
+
/** is that input value have been changed or not */
|
|
18
|
+
inputChanged?: boolean;
|
|
19
|
+
/** get option label */
|
|
16
20
|
getOptionLabel: (option: T) => string;
|
|
21
|
+
/** current be selected item array */
|
|
17
22
|
selectedItems: T[];
|
|
18
23
|
}) => T[];
|
|
19
24
|
export declare type RcDownshiftHighlightChangeReason = 'keyboard' | 'mouse' | 'auto' | undefined;
|
|
@@ -17,32 +17,38 @@ function stringArrToRegExp(keyToTags) {
|
|
|
17
17
|
}
|
|
18
18
|
var componentName = 'RcDownshift';
|
|
19
19
|
exports.useDownshift = function (_a) {
|
|
20
|
-
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DownshiftUtils_1.DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DownshiftUtils_1.DEFAULT_KEY_TO_CHIPS : _c, filterOptions = _a.filterOptions, disabledItemsHighlightable = _a.disabledItemsHighlightable, options = _a.options, freeSolo = _a.freeSolo, onInputChangeProp = _a.onInputChange, maxFreeSolo = _a.maxFreeSolo, onMaxFreeSolo = _a.onMaxFreeSolo, openOnFocus = _a.openOnFocus, disableCloseOnSelect = _a.disableCloseOnSelect, initialIsOpen = _a.initialIsOpen, autoSelect = _a.autoSelect, inputContainerRef = _a.inputContainerRef, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, onKeyDownProp = _a.onKeyDown, onSelectChange = _a.onChange, _d = _a.value, selectedItemsProp = _d === void 0 ? [] : _d, disabled = _a.disabled, renderNoOptions = _a.renderNoOptions, onClear = _a.onClear, autoHighlight = _a.autoHighlight, getOptionDisabled = _a.getOptionDisabled, addNoOptionItem = _a.addNoOptionItem, groupBy = _a.groupBy, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, groupExpanded = _a.groupExpanded, getExpandIconProps = _a.getExpandIconProps, required = _a.required, openProp = _a.open, onOpen = _a.onOpen, onClose = _a.onClose;
|
|
20
|
+
var multipleProp = _a.multiple, variant = _a.variant, labelProp = _a.label, inputValueProp = _a.inputValue, _b = _a.getOptionLabel, getOptionLabel = _b === void 0 ? DownshiftUtils_1.DEFAULT_GET_OPTION_LABEL : _b, _c = _a.keyToTags, keyToTags = _c === void 0 ? DownshiftUtils_1.DEFAULT_KEY_TO_CHIPS : _c, filterOptions = _a.filterOptions, disabledItemsHighlightable = _a.disabledItemsHighlightable, options = _a.options, freeSolo = _a.freeSolo, onInputChangeProp = _a.onInputChange, maxFreeSolo = _a.maxFreeSolo, onMaxFreeSolo = _a.onMaxFreeSolo, openOnFocus = _a.openOnFocus, disableCloseOnSelect = _a.disableCloseOnSelect, initialIsOpen = _a.initialIsOpen, autoSelect = _a.autoSelect, inputContainerRef = _a.inputContainerRef, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, onKeyDownProp = _a.onKeyDown, onSelectChange = _a.onChange, _d = _a.value, selectedItemsProp = _d === void 0 ? [] : _d, disabled = _a.disabled, renderNoOptions = _a.renderNoOptions, onClear = _a.onClear, autoHighlight = _a.autoHighlight, getOptionDisabled = _a.getOptionDisabled, addNoOptionItem = _a.addNoOptionItem, groupBy = _a.groupBy, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, groupExpanded = _a.groupExpanded, groupDefaultExpanded = _a.groupDefaultExpanded, getExpandIconProps = _a.getExpandIconProps, required = _a.required, openProp = _a.open, onOpen = _a.onOpen, onClose = _a.onClose, focusedProp = _a.focused;
|
|
21
21
|
var isAutocomplete = variant === 'autocomplete';
|
|
22
22
|
// * when that is autocomplete, that will never be multiple
|
|
23
23
|
var multiple = isAutocomplete ? false : multipleProp;
|
|
24
24
|
var isSelectedFromAutocompleteRef = react_1.useRef(false);
|
|
25
|
+
var isInputValueChangedRef = react_1.useRef(false);
|
|
25
26
|
var _e = tslib_1.__read(utils_1.useControlled({
|
|
27
|
+
controlled: focusedProp,
|
|
28
|
+
default: false,
|
|
29
|
+
name: componentName,
|
|
30
|
+
}), 2), isFocused = _e[0], setIsFocused = _e[1];
|
|
31
|
+
var _f = tslib_1.__read(utils_1.useControlled({
|
|
26
32
|
controlled: openProp,
|
|
27
33
|
default: initialIsOpen || false,
|
|
28
34
|
name: componentName,
|
|
29
|
-
}), 2), isOpen =
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
35
|
+
}), 2), isOpen = _f[0], setIsOpen = _f[1];
|
|
36
|
+
var _g = tslib_1.__read(react_1.useState(false), 2), isTagsFocus = _g[0], setIsTagsFocus = _g[1];
|
|
37
|
+
var _h = tslib_1.__read(react_1.useState(0), 2), activeIndex = _h[0], setActiveIndex = _h[1];
|
|
38
|
+
var _j = tslib_1.__read(utils_1.useControlled({
|
|
33
39
|
controlled: inputValueProp,
|
|
34
40
|
default: '',
|
|
35
41
|
name: componentName,
|
|
36
|
-
}), 2), inputValue =
|
|
42
|
+
}), 2), inputValue = _j[0], setInputValue = _j[1];
|
|
37
43
|
var updateInputValue = function (newValue) {
|
|
38
44
|
onInputChangeProp === null || onInputChangeProp === void 0 ? void 0 : onInputChangeProp(newValue);
|
|
39
45
|
setInputValue(newValue);
|
|
40
46
|
};
|
|
41
|
-
var
|
|
47
|
+
var _k = tslib_1.__read(utils_1.useControlled({
|
|
42
48
|
controlled: selectedItemsProp,
|
|
43
49
|
default: [],
|
|
44
50
|
name: componentName,
|
|
45
|
-
}), 2), selectedItems =
|
|
51
|
+
}), 2), selectedItems = _k[0], setSelectedItems = _k[1];
|
|
46
52
|
var focusInput = function () { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
47
53
|
var downshiftId = foundation_1.useResultRef(function () { return uniqueId_1.default("downshift-"); }).current;
|
|
48
54
|
// * use -2 for us know that is init state, for recalculate defaultHighlightedIndex
|
|
@@ -57,7 +63,7 @@ exports.useDownshift = function (_a) {
|
|
|
57
63
|
? true
|
|
58
64
|
: undefined;
|
|
59
65
|
var forceUpdate = foundation_1.useForceUpdate();
|
|
60
|
-
var
|
|
66
|
+
var _l = foundation_1.useSleep(), sleep = _l.sleep, getSleeping = _l.getSleeping;
|
|
61
67
|
var filteredResult = react_1.useMemo(function () {
|
|
62
68
|
var getInputValueAsItem = function () {
|
|
63
69
|
var label = inputValue.trim() || '';
|
|
@@ -76,6 +82,7 @@ exports.useDownshift = function (_a) {
|
|
|
76
82
|
if (filterOptions) {
|
|
77
83
|
return filterOptions(items, {
|
|
78
84
|
inputValue: inputValue,
|
|
85
|
+
inputChanged: isInputValueChangedRef.current,
|
|
79
86
|
getOptionLabel: getOptionLabel,
|
|
80
87
|
selectedItems: selectedItems,
|
|
81
88
|
});
|
|
@@ -119,16 +126,19 @@ exports.useDownshift = function (_a) {
|
|
|
119
126
|
renderNoOptions,
|
|
120
127
|
selectedItems,
|
|
121
128
|
]);
|
|
122
|
-
var
|
|
129
|
+
var _m = useDownshiftGroup_1.useDownshiftGroup({
|
|
123
130
|
groupBy: groupBy,
|
|
124
131
|
options: options,
|
|
125
132
|
filteredResult: filteredResult,
|
|
126
133
|
getExpandIconProps: getExpandIconProps,
|
|
127
134
|
groupExpanded: groupExpanded,
|
|
135
|
+
groupDefaultExpanded: groupDefaultExpanded,
|
|
128
136
|
onGroupExpanded: onGroupExpanded,
|
|
137
|
+
// TODO: single release for that breaking change
|
|
138
|
+
// getOptionDisabled,
|
|
129
139
|
groupVariant: groupVariant,
|
|
130
140
|
id: downshiftId,
|
|
131
|
-
}), groupedResult =
|
|
141
|
+
}), groupedResult = _m.groupedResult, handleGroupExpandedChange = _m.handleGroupExpandedChange, optionsGroupList = _m.optionsGroupList;
|
|
132
142
|
var optionItems = groupBy ? groupedResult : filteredResult;
|
|
133
143
|
var freeSoloCount = react_1.useMemo(function () { return selectedItems.filter(function (x) { return x.freeSolo; }).length; }, [selectedItems]);
|
|
134
144
|
var handleSelectedItems = function (_selectedItems) {
|
|
@@ -170,6 +180,7 @@ exports.useDownshift = function (_a) {
|
|
|
170
180
|
});
|
|
171
181
|
var closeMenu = function (e, reason) {
|
|
172
182
|
keepHighlightedIndexRef.current = false;
|
|
183
|
+
isInputValueChangedRef.current = false;
|
|
173
184
|
// * set to default highlighted
|
|
174
185
|
setHighlightedIndex(DEFAULT_HIGHLIGHTED_INDEX, { reason: 'auto' });
|
|
175
186
|
if (isOpen) {
|
|
@@ -320,6 +331,7 @@ exports.useDownshift = function (_a) {
|
|
|
320
331
|
updateInputValue('');
|
|
321
332
|
}
|
|
322
333
|
isSelectedFromAutocompleteRef.current = false;
|
|
334
|
+
isInputValueChangedRef.current = false;
|
|
323
335
|
setActiveIndex(-1);
|
|
324
336
|
if (!disableCloseOnSelect) {
|
|
325
337
|
closeMenu(e, 'select-option');
|
|
@@ -344,7 +356,7 @@ exports.useDownshift = function (_a) {
|
|
|
344
356
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
345
357
|
},
|
|
346
358
|
}).onKeyFocusedIndexHandle;
|
|
347
|
-
var
|
|
359
|
+
var _o = foundation_1.useKeyboardMoveFocus({
|
|
348
360
|
options: optionItems,
|
|
349
361
|
focusedIndexRef: highlightedIndexRef,
|
|
350
362
|
infinite: true,
|
|
@@ -357,7 +369,7 @@ exports.useDownshift = function (_a) {
|
|
|
357
369
|
: function (child) {
|
|
358
370
|
return !getIsItemCanSelected(child);
|
|
359
371
|
},
|
|
360
|
-
}), onKeyFocusedIndexHandle =
|
|
372
|
+
}), onKeyFocusedIndexHandle = _o.onKeyFocusedIndexHandle, getNextFocusableOption = _o.getNextFocusableOption;
|
|
361
373
|
var keepHighlightedIndex = function () {
|
|
362
374
|
keepHighlightedIndexRef.current = true;
|
|
363
375
|
};
|
|
@@ -532,9 +544,11 @@ exports.useDownshift = function (_a) {
|
|
|
532
544
|
handleSelectedItems([]);
|
|
533
545
|
}
|
|
534
546
|
fromPasteString.current = '';
|
|
547
|
+
isInputValueChangedRef.current = true;
|
|
535
548
|
},
|
|
536
549
|
onFocus: function (e) {
|
|
537
550
|
var _a;
|
|
551
|
+
setIsFocused(true);
|
|
538
552
|
if (openOnFocus)
|
|
539
553
|
openMenu(e);
|
|
540
554
|
// * when autocomplete mode, always select all text when focus
|
|
@@ -548,6 +562,7 @@ exports.useDownshift = function (_a) {
|
|
|
548
562
|
}
|
|
549
563
|
},
|
|
550
564
|
onBlur: function (e) {
|
|
565
|
+
setIsFocused(false);
|
|
551
566
|
if (autoSelect && !stopAutoSelectRef.current) {
|
|
552
567
|
if (!freeSolo)
|
|
553
568
|
selectItemFn(optionItems[highlightedIndexRef.current], e);
|
|
@@ -798,6 +813,9 @@ exports.useDownshift = function (_a) {
|
|
|
798
813
|
reset: reset,
|
|
799
814
|
forceUpdate: forceUpdate,
|
|
800
815
|
optionsGroupList: optionsGroupList,
|
|
816
|
+
isFocused: isFocused,
|
|
817
|
+
id: downshiftId,
|
|
818
|
+
inputChanged: isInputValueChangedRef.current,
|
|
801
819
|
};
|
|
802
820
|
changeHighlightedIndexReason.current = undefined;
|
|
803
821
|
return resultObj;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { RcDownshiftProps } from '../Downshift';
|
|
2
2
|
import { RcDownshiftGroupedOption, RcDownshiftSelectedItem } from './SelectItem';
|
|
3
|
-
declare type UseDownshiftGroup = {
|
|
4
|
-
filteredResult:
|
|
3
|
+
declare type UseDownshiftGroup<T extends RcDownshiftSelectedItem = RcDownshiftSelectedItem> = {
|
|
4
|
+
filteredResult: T[];
|
|
5
5
|
id: string;
|
|
6
|
-
} & Pick<RcDownshiftProps
|
|
7
|
-
export declare const useDownshiftGroup: ({ groupBy, options, filteredResult, getExpandIconProps, groupExpanded, onGroupExpanded, groupVariant, id, }: UseDownshiftGroup) => {
|
|
8
|
-
optionsGroupList: RcDownshiftGroupedOption<
|
|
9
|
-
groupedResult:
|
|
6
|
+
} & Pick<RcDownshiftProps<T>, 'options' | 'groupBy' | 'getExpandIconProps' | 'onGroupExpanded' | 'groupExpanded' | 'groupDefaultExpanded' | 'groupVariant' | 'getOptionDisabled'>;
|
|
7
|
+
export declare const useDownshiftGroup: <T extends RcDownshiftSelectedItem = RcDownshiftSelectedItem>({ groupBy, options, filteredResult, getExpandIconProps, groupExpanded, groupDefaultExpanded, onGroupExpanded, groupVariant, getOptionDisabled, id, }: UseDownshiftGroup<T>) => {
|
|
8
|
+
optionsGroupList: RcDownshiftGroupedOption<T>[];
|
|
9
|
+
groupedResult: T[];
|
|
10
10
|
groupExpandedMap: Record<string, boolean>;
|
|
11
|
-
handleGroupExpandedChange: (
|
|
11
|
+
handleGroupExpandedChange: (groupName: string) => void;
|
|
12
12
|
};
|
|
13
13
|
export {};
|
|
@@ -4,32 +4,27 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var foundation_1 = require("../../../foundation");
|
|
6
6
|
exports.useDownshiftGroup = function (_a) {
|
|
7
|
-
var groupBy = _a.groupBy, options = _a.options, filteredResult = _a.filteredResult, getExpandIconProps = _a.getExpandIconProps, groupExpanded = _a.groupExpanded, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, id = _a.id;
|
|
7
|
+
var groupBy = _a.groupBy, options = _a.options, filteredResult = _a.filteredResult, getExpandIconProps = _a.getExpandIconProps, groupExpanded = _a.groupExpanded, groupDefaultExpanded = _a.groupDefaultExpanded, onGroupExpanded = _a.onGroupExpanded, groupVariant = _a.groupVariant, getOptionDisabled = _a.getOptionDisabled, id = _a.id;
|
|
8
8
|
var _b = tslib_1.__read(foundation_1.useRefState({}), 2), groupExpandedMapRef = _b[0], setGroupExpandedMap = _b[1];
|
|
9
9
|
var isTitleGroup = groupVariant === 'normal';
|
|
10
|
-
|
|
11
|
-
if (typeof groupExpanded === 'object') {
|
|
12
|
-
setGroupExpandedMap(groupExpanded, false);
|
|
13
|
-
}
|
|
14
|
-
}, function () { return groupExpanded; });
|
|
15
|
-
var handleGroupExpandedChange = function (key) {
|
|
10
|
+
var handleGroupExpandedChange = function (groupName) {
|
|
16
11
|
var _a;
|
|
17
12
|
var groupExpandedMap = groupExpandedMapRef.current;
|
|
18
13
|
if (typeof groupExpanded === 'boolean') {
|
|
19
14
|
return;
|
|
20
15
|
}
|
|
21
|
-
var toExpandedState = !groupExpandedMap[
|
|
22
|
-
var newExpandedMap = tslib_1.__assign(tslib_1.__assign({}, groupExpandedMap), (_a = {}, _a[
|
|
16
|
+
var toExpandedState = !groupExpandedMap[groupName];
|
|
17
|
+
var newExpandedMap = tslib_1.__assign(tslib_1.__assign({}, groupExpandedMap), (_a = {}, _a[groupName] = toExpandedState, _a));
|
|
23
18
|
setGroupExpandedMap(newExpandedMap);
|
|
24
19
|
if (onGroupExpanded) {
|
|
25
|
-
var group = optionsGroupList.find(function (x) { return x.group ===
|
|
20
|
+
var group = optionsGroupList.find(function (x) { return x.group === groupName; });
|
|
26
21
|
if (group) {
|
|
27
22
|
onGroupExpanded(tslib_1.__assign(tslib_1.__assign({}, foundation_1.omit(group, ['getExpandIconProps'])), { expanded: toExpandedState }), newExpandedMap);
|
|
28
23
|
}
|
|
29
24
|
}
|
|
30
25
|
};
|
|
31
|
-
var handleExpandIconClick = foundation_1.useEventCallback(function (e,
|
|
32
|
-
handleGroupExpandedChange(
|
|
26
|
+
var handleExpandIconClick = foundation_1.useEventCallback(function (e, groupName) {
|
|
27
|
+
handleGroupExpandedChange(groupName);
|
|
33
28
|
e.preventDefault();
|
|
34
29
|
e.stopPropagation();
|
|
35
30
|
});
|
|
@@ -39,7 +34,8 @@ exports.useDownshiftGroup = function (_a) {
|
|
|
39
34
|
// used to keep track of key and indexes in the result array
|
|
40
35
|
var indexBy_1 = new Map();
|
|
41
36
|
var warn_1 = false;
|
|
42
|
-
|
|
37
|
+
var afterGroupFn_1 = [];
|
|
38
|
+
var result = filteredResult.reduce(function (acc, option, index) {
|
|
43
39
|
var group = groupBy(option);
|
|
44
40
|
if (acc.length > 0 && acc[acc.length - 1].group === group) {
|
|
45
41
|
acc[acc.length - 1].options.push(tslib_1.__assign(tslib_1.__assign({}, option), { group: acc[acc.length - 1] }));
|
|
@@ -78,41 +74,71 @@ exports.useDownshiftGroup = function (_a) {
|
|
|
78
74
|
};
|
|
79
75
|
newGroup_1.options[0].group = newGroup_1;
|
|
80
76
|
if (isTitleGroup) {
|
|
81
|
-
|
|
77
|
+
var groupTitleOption_1 = {
|
|
82
78
|
id: id + "-" + group,
|
|
83
79
|
label: group,
|
|
84
80
|
disabled: true,
|
|
81
|
+
// * here cause by self Type reference
|
|
85
82
|
group: newGroup_1,
|
|
86
|
-
}
|
|
83
|
+
};
|
|
84
|
+
// push fn to array, do that after all options be add into group
|
|
85
|
+
if (getOptionDisabled) {
|
|
86
|
+
afterGroupFn_1.push(function () {
|
|
87
|
+
groupTitleOption_1.disabled =
|
|
88
|
+
getOptionDisabled(groupTitleOption_1);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
newGroup_1.options.unshift(groupTitleOption_1);
|
|
87
92
|
}
|
|
88
93
|
acc.push(newGroup_1);
|
|
89
94
|
}
|
|
90
95
|
return acc;
|
|
91
96
|
}, []);
|
|
97
|
+
afterGroupFn_1.forEach(function (fn) {
|
|
98
|
+
fn();
|
|
99
|
+
});
|
|
100
|
+
return result;
|
|
92
101
|
}
|
|
93
102
|
return [];
|
|
94
103
|
}, [
|
|
95
104
|
filteredResult,
|
|
96
105
|
getExpandIconProps,
|
|
106
|
+
getOptionDisabled,
|
|
97
107
|
groupBy,
|
|
98
108
|
handleExpandIconClick,
|
|
99
109
|
id,
|
|
100
110
|
isTitleGroup,
|
|
101
111
|
options,
|
|
102
112
|
]);
|
|
113
|
+
var initGroupExpandedState = function (expandedState) {
|
|
114
|
+
if (typeof expandedState === 'object') {
|
|
115
|
+
setGroupExpandedMap(expandedState, false);
|
|
116
|
+
}
|
|
117
|
+
else if (typeof expandedState === 'boolean') {
|
|
118
|
+
setGroupExpandedMap(optionsGroupList.reduce(function (prev, curr) {
|
|
119
|
+
prev[curr.group] = expandedState;
|
|
120
|
+
return prev;
|
|
121
|
+
}, {}), false);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
foundation_1.useDepsChange(function () {
|
|
125
|
+
initGroupExpandedState(groupDefaultExpanded);
|
|
126
|
+
}, []);
|
|
127
|
+
foundation_1.useDepsChange(function () {
|
|
128
|
+
initGroupExpandedState(groupExpanded);
|
|
129
|
+
}, [groupExpanded]);
|
|
103
130
|
var groupExpandedMap = groupExpandedMapRef.current;
|
|
104
131
|
// * speared logic with group, prevent calculate every time.
|
|
105
132
|
var groupedResult = react_1.useMemo(function () {
|
|
106
133
|
var addExpandedResult = Object.entries(groupExpandedMap).reduce(function (prev, _a) {
|
|
107
134
|
var _b = tslib_1.__read(_a, 2), key = _b[0], expended = _b[1];
|
|
108
135
|
var group = prev.find(function (x) { return x.group === key; });
|
|
109
|
-
if (group)
|
|
136
|
+
if (group)
|
|
110
137
|
group.expanded = expended;
|
|
111
|
-
}
|
|
112
138
|
return prev;
|
|
113
139
|
}, tslib_1.__spread(optionsGroupList));
|
|
114
140
|
return addExpandedResult.reduce(function (prev, curr) {
|
|
115
|
-
if (
|
|
141
|
+
if (curr.expanded) {
|
|
116
142
|
prev.push.apply(prev, tslib_1.__spread(curr.options));
|
|
117
143
|
}
|
|
118
144
|
else {
|
|
@@ -120,7 +146,7 @@ exports.useDownshiftGroup = function (_a) {
|
|
|
120
146
|
}
|
|
121
147
|
return prev;
|
|
122
148
|
}, []);
|
|
123
|
-
}, [groupExpandedMap, optionsGroupList
|
|
149
|
+
}, [groupExpandedMap, optionsGroupList]);
|
|
124
150
|
return {
|
|
125
151
|
optionsGroupList: optionsGroupList,
|
|
126
152
|
groupedResult: groupedResult,
|
|
@@ -107,9 +107,7 @@ var _NumberPicker = react_1.forwardRef(function (props, ref) {
|
|
|
107
107
|
react_1.default.createElement(StyledTimeIconButton_1.StyledTimeIconButton, { tabIndex: -1, size: iconSize, color: "neutral.f04", wrapperSize: size, disabled: increaseDisabled, onClick: function () {
|
|
108
108
|
onUpdateValue(increaseValue);
|
|
109
109
|
}, symbol: ArrowUp_1.default, "data-test-automation-id": automationId && automationId + "-prev-pagination", "aria-label": "Arrow Up" }),
|
|
110
|
-
react_1.default.createElement(StyledTimeIconButton_1.StyledTimeIconButton, { wrapperSize: size, tabIndex: -1, onClick: onClick,
|
|
111
|
-
// * when both disabled that icon can't click into selection view
|
|
112
|
-
disabled: increaseDisabled && decreaseDisabled, "data-test-automation-id": automationId && automationId + "-text" },
|
|
110
|
+
react_1.default.createElement(StyledTimeIconButton_1.StyledTimeIconButton, { wrapperSize: size, tabIndex: -1, onClick: onClick, "data-test-automation-id": automationId && automationId + "-text" },
|
|
113
111
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
114
112
|
// TODO: that <></> will fix when `RcIconButton` ready
|
|
115
113
|
showValue)),
|