@ringcentral/juno 2.23.1 → 2.25.0-hotfix.0
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/Downshift/Downshift.js +2 -2
- package/components/Downshift/SuggestionList/utils/useSuggestionList.js +0 -3
- package/components/Downshift/utils/useDownshift.d.ts +3 -1
- package/components/Downshift/utils/useDownshift.js +23 -3
- package/components/Forms/Picker/DatePicker/Calendar.js +0 -1
- package/components/Forms/Picker/DatePicker/DatePickerHeader.js +5 -1
- package/components/Forms/Picker/TimePicker/NumberPicker.d.ts +13 -1
- package/components/Forms/Picker/TimePicker/NumberPicker.js +9 -2
- package/components/Forms/Picker/TimePicker/TimePicker.js +1 -1
- package/components/Forms/TextField/TextField.js +29 -43
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +6 -3
- package/es6/components/Downshift/Downshift.js +2 -2
- package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +0 -3
- package/es6/components/Downshift/utils/useDownshift.js +24 -4
- package/es6/components/Forms/Picker/DatePicker/Calendar.js +0 -1
- package/es6/components/Forms/Picker/DatePicker/DatePickerHeader.js +6 -2
- package/es6/components/Forms/Picker/TimePicker/NumberPicker.js +10 -3
- package/es6/components/Forms/Picker/TimePicker/TimePicker.js +1 -1
- package/es6/components/Forms/TextField/TextField.js +30 -44
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +6 -3
- package/package.json +1 -1
|
@@ -192,7 +192,7 @@ var _RcDownshift = react_1.memo(react_1.forwardRef(function (inProps, ref) {
|
|
|
192
192
|
onKeyDown: onKeyDownProp,
|
|
193
193
|
disabledItemsHighlightable: disabledItemsHighlightable,
|
|
194
194
|
onGroupExpanded: onGroupExpanded,
|
|
195
|
-
}), focusInput = _10.focusInput, optionItems = _10.optionItems, optionsGroupList = _10.optionsGroupList, selectedItems = _10.tags, highlightedIndex = _10.highlightedIndex, getToggleButtonProps = _10.getToggleButtonProps, getTagProps = _10.getTagProps, getTagListBoxProps = _10.getTagListBoxProps, getMenuProps = _10.getMenuProps, getPopperProps = _10.getPopperProps, getInputProps = _10.getInputProps, getInputAriaProps = _10.getInputAriaProps, getLabelProps = _10.getLabelProps, getItemProps = _10.getItemProps, isOpen = _10.isOpen, inputValue = _10.inputValue, activeIndex = _10.activeIndex, setActiveIndex = _10.setActiveIndex, setHighlightedIndex = _10.setHighlightedIndex, onInputChange = _10.onInputChange, keepHighlightedIndex = _10.keepHighlightedIndex, changeHighlightedIndexReason = _10.changeHighlightedIndexReason, closeMenu = _10.closeMenu, openMenu = _10.openMenu, reset = _10.reset, getClearButtonProps = _10.getClearButtonProps, noOptionItem = _10.noOptionItem, getNoOptionsProps = _10.getNoOptionsProps, isKeepHighlightedIndex = _10.isKeepHighlightedIndex, isDownshiftFocused = _10.focused, autoCompleteSelectedIndex = _10.autoCompleteSelectedIndex;
|
|
195
|
+
}), focusInput = _10.focusInput, optionItems = _10.optionItems, optionsGroupList = _10.optionsGroupList, selectedItems = _10.tags, highlightedIndex = _10.highlightedIndex, getToggleButtonProps = _10.getToggleButtonProps, getTagProps = _10.getTagProps, getTagListBoxProps = _10.getTagListBoxProps, getMenuProps = _10.getMenuProps, getPopperProps = _10.getPopperProps, getInputProps = _10.getInputProps, getInputAriaProps = _10.getInputAriaProps, getLabelProps = _10.getLabelProps, getItemProps = _10.getItemProps, isOpen = _10.isOpen, inputValue = _10.inputValue, activeIndex = _10.activeIndex, setActiveIndex = _10.setActiveIndex, setHighlightedIndex = _10.setHighlightedIndex, onInputChange = _10.onInputChange, keepHighlightedIndex = _10.keepHighlightedIndex, changeHighlightedIndexReason = _10.changeHighlightedIndexReason, closeMenu = _10.closeMenu, openMenu = _10.openMenu, reset = _10.reset, getClearButtonProps = _10.getClearButtonProps, noOptionItem = _10.noOptionItem, getNoOptionsProps = _10.getNoOptionsProps, isKeepHighlightedIndex = _10.isKeepHighlightedIndex, isDownshiftFocused = _10.focused, autoCompleteSelectedIndex = _10.autoCompleteSelectedIndex, popperElementRef = _10.popperElementRef;
|
|
196
196
|
var open = Boolean((isOpen || noOptionItem) && textFieldRef.current);
|
|
197
197
|
var _11 = getInputProps(), onBlur = _11.onBlur, InputProps = tslib_1.__rest(_11, ["onBlur"]);
|
|
198
198
|
var helperText = isNew
|
|
@@ -307,7 +307,7 @@ var _RcDownshift = react_1.memo(react_1.forwardRef(function (inProps, ref) {
|
|
|
307
307
|
maxLength: maxLength, containerRef: inputContainerRef }, getInputAriaProps(TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.inputProps)),
|
|
308
308
|
}, rest), { value: inputValue, clearBtn: false })),
|
|
309
309
|
!helperText && screenReaderText && (react_1.default.createElement(VisuallyHidden_1.RcVisuallyHidden, { id: describedbyId }, screenReaderText)),
|
|
310
|
-
react_1.default.createElement(styles_1.StyledPopper, tslib_1.__assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: utils_1.fixOffsetsModifer },
|
|
310
|
+
react_1.default.createElement(styles_1.StyledPopper, tslib_1.__assign({ ref: popperElementRef, open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: utils_1.fixOffsetsModifer },
|
|
311
311
|
// * view type in popper.js
|
|
312
312
|
popperOptions: {
|
|
313
313
|
onUpdate: function (e) {
|
|
@@ -118,9 +118,6 @@ exports.useSuggestionList = function (_a) {
|
|
|
118
118
|
var groupOrder = (currGroup === null || currGroup === void 0 ? void 0 : currGroup.order) || 0;
|
|
119
119
|
return foundation_1.combineProps(tslib_1.__assign({ id: currUniqueId + "-option-" + index, onClick: function (e) {
|
|
120
120
|
selectItem(e, item);
|
|
121
|
-
}, onMouseDown: function (e) {
|
|
122
|
-
e.preventDefault();
|
|
123
|
-
e.stopPropagation();
|
|
124
121
|
}, onMouseOver: function () {
|
|
125
122
|
if (highlightedIndexRef.current !== index &&
|
|
126
123
|
getIsItemCanSelected(item)) {
|
|
@@ -3,6 +3,7 @@ import { ChangeEvent, HTMLAttributes } from 'react';
|
|
|
3
3
|
import { RcIconButtonProps } from '../../Buttons/IconButton';
|
|
4
4
|
import { RcDownshiftProps } from '../Downshift';
|
|
5
5
|
import { RcDownshiftSelectedItem } from './SelectItem';
|
|
6
|
+
import { RcDownshiftGetItemPropsOptions } from './useDownshift.interface';
|
|
6
7
|
declare type UseDownshiftParams<T extends RcDownshiftSelectedItem = RcDownshiftSelectedItem> = {
|
|
7
8
|
/** that input ref you binding event */
|
|
8
9
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
@@ -292,7 +293,7 @@ export declare const useDownshift: <T extends RcDownshiftSelectedItem = RcDownsh
|
|
|
292
293
|
'aria-required': boolean;
|
|
293
294
|
'aria-disabled': boolean;
|
|
294
295
|
};
|
|
295
|
-
getItemProps: (
|
|
296
|
+
getItemProps: (props: RcDownshiftGetItemPropsOptions<T>) => {
|
|
296
297
|
isSelected?: boolean | undefined;
|
|
297
298
|
disabled?: boolean | undefined;
|
|
298
299
|
ref?: import("react").RefObject<any> | undefined;
|
|
@@ -577,5 +578,6 @@ export declare const useDownshift: <T extends RcDownshiftSelectedItem = RcDownsh
|
|
|
577
578
|
id: string;
|
|
578
579
|
inputChanged: boolean;
|
|
579
580
|
autoCompleteSelectedIndex: number;
|
|
581
|
+
popperElementRef: import("react").RefObject<HTMLDivElement>;
|
|
580
582
|
};
|
|
581
583
|
export {};
|
|
@@ -29,6 +29,7 @@ exports.useDownshift = function (_a) {
|
|
|
29
29
|
var stopAutoSelectRef = react_1.useRef(false);
|
|
30
30
|
var fromPasteString = react_1.useRef('');
|
|
31
31
|
var keepHighlightedIndexRef = react_1.useRef(false);
|
|
32
|
+
var popperElementRef = react_1.useRef(null);
|
|
32
33
|
var _g = foundation_1.useSleep(), sleep = _g.sleep, getSleeping = _g.getSleeping;
|
|
33
34
|
// * when that is autocomplete, that will never be multiple
|
|
34
35
|
var multiple = isAutocomplete ? false : multipleProp;
|
|
@@ -146,7 +147,20 @@ exports.useDownshift = function (_a) {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
},
|
|
149
|
-
}), inputValue = _j.inputValue, optionItems = _j.optionItems, optionsGroupList = _j.optionsGroupList, highlightedIndexRef = _j.highlightedIndexRef, changeHighlightedIndexReasonRef = _j.changeHighlightedIndexReasonRef, forceUpdate = _j.forceUpdate, selectItem = _j.selectItem, handleF10KeyDown = _j.handleF10KeyDown, onKeyFocusedIndexHandle = _j.onKeyFocusedIndexHandle, setHighlightedIndex = _j.setHighlightedIndex, updateInputValue = _j.updateInputValue, clearInput = _j.clearInput, getNextFocusableOption = _j.getNextFocusableOption,
|
|
150
|
+
}), inputValue = _j.inputValue, optionItems = _j.optionItems, optionsGroupList = _j.optionsGroupList, highlightedIndexRef = _j.highlightedIndexRef, changeHighlightedIndexReasonRef = _j.changeHighlightedIndexReasonRef, forceUpdate = _j.forceUpdate, selectItem = _j.selectItem, handleF10KeyDown = _j.handleF10KeyDown, onKeyFocusedIndexHandle = _j.onKeyFocusedIndexHandle, setHighlightedIndex = _j.setHighlightedIndex, updateInputValue = _j.updateInputValue, clearInput = _j.clearInput, getNextFocusableOption = _j.getNextFocusableOption, getSuggestionListItemProps = _j.getItemProps, focusInput = _j.focusInput, resetSuggestionList = _j.reset, getSuggestionListInputProps = _j.getInputProps, getSuggestionListInputAriaProps = _j.getInputAriaProps, getSuggestionListClearButtonProps = _j.getClearButtonProps, getLabelProps = _j.getLabelProps, getMenuProps = _j.getMenuProps;
|
|
151
|
+
var getItemProps = function (props) {
|
|
152
|
+
var onMouseDown = props.onMouseDown, onMouseUp = props.onMouseUp, rest = tslib_1.__rest(props, ["onMouseDown", "onMouseUp"]);
|
|
153
|
+
return getSuggestionListItemProps(tslib_1.__assign(tslib_1.__assign({}, rest), { onMouseDown: function (e) {
|
|
154
|
+
// `getPopperProps` will prevent change focus when mouse down popper
|
|
155
|
+
// but suggestion item is an exception.
|
|
156
|
+
// so we need stop propagation to make sure focus can be changed
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
|
|
159
|
+
}, onMouseUp: function (e) {
|
|
160
|
+
focusInput();
|
|
161
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(e);
|
|
162
|
+
} }));
|
|
163
|
+
};
|
|
150
164
|
var readOnly = !isAutocomplete && !multiple && tags.length >= 1 ? true : undefined;
|
|
151
165
|
var closeMenu = function (e, reason) {
|
|
152
166
|
keepHighlightedIndexRef.current = false;
|
|
@@ -282,8 +296,8 @@ exports.useDownshift = function (_a) {
|
|
|
282
296
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
283
297
|
}, []);
|
|
284
298
|
var getInputProps = function (props) {
|
|
285
|
-
var
|
|
286
|
-
return foundation_1.combineProps(tslib_1.__assign(tslib_1.__assign({},
|
|
299
|
+
var suggestionListInputProps = getSuggestionListInputProps(props);
|
|
300
|
+
return foundation_1.combineProps(tslib_1.__assign(tslib_1.__assign({}, suggestionListInputProps), { onPaste: function (e) {
|
|
287
301
|
var _a;
|
|
288
302
|
if (freeSolo) {
|
|
289
303
|
var clipboardData = e.clipboardData;
|
|
@@ -320,7 +334,12 @@ exports.useDownshift = function (_a) {
|
|
|
320
334
|
stopAutoSelectRef.current = false;
|
|
321
335
|
blurTags();
|
|
322
336
|
}, onBlur: function (e) {
|
|
337
|
+
var _a;
|
|
323
338
|
setInputFocused(false);
|
|
339
|
+
// mouse down suggestion item will change focus,
|
|
340
|
+
// but we don't want to close popper in this case
|
|
341
|
+
if ((_a = popperElementRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
|
|
342
|
+
return;
|
|
324
343
|
if (autoSelect && !stopAutoSelectRef.current) {
|
|
325
344
|
if (!freeSolo)
|
|
326
345
|
selectItem(e, optionItems[highlightedIndexRef.current]);
|
|
@@ -532,5 +551,6 @@ exports.useDownshift = function (_a) {
|
|
|
532
551
|
id: downshiftId,
|
|
533
552
|
inputChanged: isInputValueChangedRef.current,
|
|
534
553
|
autoCompleteSelectedIndex: autoCompleteSelectedIndexRef.current,
|
|
554
|
+
popperElementRef: popperElementRef,
|
|
535
555
|
};
|
|
536
556
|
};
|
|
@@ -162,7 +162,6 @@ var Calendar = react_1.forwardRef(function (_a, ref) {
|
|
|
162
162
|
}
|
|
163
163
|
}, [previousView, view, viewChange]);
|
|
164
164
|
react_1.useLayoutEffect(function () {
|
|
165
|
-
utils_2.focusDayElement();
|
|
166
165
|
calendarRef.current = document.querySelector("." + utils_2.RcDatePickerClasses.popover + " ." + utils_2.RcDatePickerClasses.popoverPaper);
|
|
167
166
|
var unsubscribe = utils_1.transitionendSubscriber(calendarRef.current, utils_2.onTransitionEnd);
|
|
168
167
|
return function () {
|
|
@@ -15,6 +15,10 @@ var DatePickerHeader = react_1.memo(function (props) {
|
|
|
15
15
|
var nextMonth = utils.getNextMonth(focusedDate);
|
|
16
16
|
var monthLabel = utils.getCalendarHeaderText(focusedDate);
|
|
17
17
|
var changeFromRef = react_1.useRef();
|
|
18
|
+
var headerRef = react_1.useRef(null);
|
|
19
|
+
react_1.useLayoutEffect(function () {
|
|
20
|
+
headerRef.current.focus();
|
|
21
|
+
}, []);
|
|
18
22
|
var selectNextMonth = function () {
|
|
19
23
|
onMonthChange(nextMonth, 'left');
|
|
20
24
|
changeFromRef.current = 'next';
|
|
@@ -33,7 +37,7 @@ var DatePickerHeader = react_1.memo(function (props) {
|
|
|
33
37
|
? nextMonthAriaLabel
|
|
34
38
|
: previousMonthAriaLabel)),
|
|
35
39
|
react_1.default.createElement(styles_1.SwitchHeaderWrapper, { size: size, className: classes.header },
|
|
36
|
-
react_1.default.createElement(styles_1.StyledCurrentMonth, { role: 'button', tabIndex: 0, view: view, onClick: onViewChange, "aria-label": monthYearAriaLabel, "aria-expanded": ariaExpanded, "data-test-automation-id": "date-picker-month-year", className: classes.select },
|
|
40
|
+
react_1.default.createElement(styles_1.StyledCurrentMonth, { role: 'button', tabIndex: 0, view: view, onClick: onViewChange, "aria-label": monthYearAriaLabel, "aria-expanded": ariaExpanded, "data-test-automation-id": "date-picker-month-year", className: classes.select, ref: headerRef },
|
|
37
41
|
monthLabel,
|
|
38
42
|
react_1.default.createElement(SelectArrowDownIcon_1.SelectArrowDownIcon, null)),
|
|
39
43
|
react_1.default.createElement(styles_1.SwitchHeaderButtonWrapper, { size: size, gap: 3, view: view },
|
|
@@ -30,6 +30,10 @@ declare type NumberPickerProps = {
|
|
|
30
30
|
step: number;
|
|
31
31
|
/** render value fn */
|
|
32
32
|
renderValue?: (value: number) => string;
|
|
33
|
+
/**
|
|
34
|
+
* If `true`, the `NumberPicker` element will be focused during the first mount.
|
|
35
|
+
*/
|
|
36
|
+
autoFocus?: boolean;
|
|
33
37
|
} & RcClickFiledStyleProps & RcBaseProps<HTMLAttributes<HTMLDivElement>, 'onClick' | 'onChange'>;
|
|
34
38
|
declare type NumberPickerRef = {
|
|
35
39
|
value: number;
|
|
@@ -60,6 +64,10 @@ declare const NumberPicker: import("styled-components").StyledComponentClass<{
|
|
|
60
64
|
step: number;
|
|
61
65
|
/** render value fn */
|
|
62
66
|
renderValue?: ((value: number) => string) | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* If `true`, the `NumberPicker` element will be focused during the first mount.
|
|
69
|
+
*/
|
|
70
|
+
autoFocus?: boolean | undefined;
|
|
63
71
|
} & RcClickFiledStyleProps & Pick<React.HTMLAttributes<HTMLDivElement>, "className" | "color" | "id" | "lang" | "style" | "role" | "tabIndex" | "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" | "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" | "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" | "slot" | "title" | "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"> & React.RefAttributes<NumberPickerRef>, import("../../../../foundation").RcTheme, Pick<{
|
|
64
72
|
/** min number */
|
|
65
73
|
min?: number | undefined;
|
|
@@ -85,7 +93,11 @@ declare const NumberPicker: import("styled-components").StyledComponentClass<{
|
|
|
85
93
|
step: number;
|
|
86
94
|
/** render value fn */
|
|
87
95
|
renderValue?: ((value: number) => string) | undefined;
|
|
88
|
-
|
|
96
|
+
/**
|
|
97
|
+
* If `true`, the `NumberPicker` element will be focused during the first mount.
|
|
98
|
+
*/
|
|
99
|
+
autoFocus?: boolean | undefined;
|
|
100
|
+
} & RcClickFiledStyleProps & Pick<React.HTMLAttributes<HTMLDivElement>, "className" | "color" | "id" | "lang" | "style" | "role" | "tabIndex" | "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" | "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" | "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" | "slot" | "title" | "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"> & React.RefAttributes<NumberPickerRef>, "ref" | "key" | "className" | "color" | "id" | "lang" | "max" | "min" | "style" | "role" | "tabIndex" | "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" | "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" | "step" | "slot" | "source" | "title" | "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" | "disabled" | "autoFocus" | "onClose" | "onUpdateValue" | "isTwelveHourSystem" | "onInnerChange" | "automationId" | "getScreenReaderLabel" | "renderValue"> & {
|
|
89
101
|
theme?: import("../../../../foundation").RcTheme | undefined;
|
|
90
102
|
}>;
|
|
91
103
|
export { NumberPicker };
|
|
@@ -9,10 +9,17 @@ var StyledNumberPicker_1 = require("./styles/StyledNumberPicker");
|
|
|
9
9
|
var StyledTimeIconButton_1 = require("./styles/StyledTimeIconButton");
|
|
10
10
|
var utils_1 = require("./utils");
|
|
11
11
|
var _NumberPicker = react_1.forwardRef(function (props, ref) {
|
|
12
|
-
var onClick = props.onClick, value = props.value, onUpdateValue = props.onUpdateValue, onKeyDown = props.onKeyDown, source = props.source, automationId = props.automationId, size = props.size, minProp = props.min, maxProp = props.max, onClose = props.onClose, step = props.step, onInnerChange = props.onInnerChange, renderValue = props.renderValue, getScreenReaderLabel = props.getScreenReaderLabel, rest = tslib_1.__rest(props, ["onClick", "value", "onUpdateValue", "onKeyDown", "source", "automationId", "size", "min", "max", "onClose", "step", "onInnerChange", "renderValue", "getScreenReaderLabel"]);
|
|
12
|
+
var onClick = props.onClick, value = props.value, onUpdateValue = props.onUpdateValue, onKeyDown = props.onKeyDown, source = props.source, automationId = props.automationId, size = props.size, minProp = props.min, maxProp = props.max, onClose = props.onClose, step = props.step, onInnerChange = props.onInnerChange, renderValue = props.renderValue, getScreenReaderLabel = props.getScreenReaderLabel, autoFocus = props.autoFocus, rest = tslib_1.__rest(props, ["onClick", "value", "onUpdateValue", "onKeyDown", "source", "automationId", "size", "min", "max", "onClose", "step", "onInnerChange", "renderValue", "getScreenReaderLabel", "autoFocus"]);
|
|
13
13
|
var forceUpdate = foundation_1.useForceUpdate();
|
|
14
14
|
var _a = tslib_1.__read(foundation_1.useRefState(value, forceUpdate), 2), innerValueRef = _a[0], setInnerValue = _a[1];
|
|
15
15
|
var rangeRef = react_1.useRef({ max: maxProp, min: minProp });
|
|
16
|
+
var pickerRef = react_1.useRef(null);
|
|
17
|
+
react_1.useLayoutEffect(function () {
|
|
18
|
+
if (autoFocus) {
|
|
19
|
+
pickerRef.current.focus();
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
+
}, []);
|
|
16
23
|
foundation_1.useDepsChange(function () {
|
|
17
24
|
rangeRef.current = { max: maxProp, min: minProp };
|
|
18
25
|
}, [maxProp, minProp]);
|
|
@@ -102,7 +109,7 @@ var _NumberPicker = react_1.forwardRef(function (props, ref) {
|
|
|
102
109
|
return 'large';
|
|
103
110
|
}
|
|
104
111
|
})();
|
|
105
|
-
return (react_1.default.createElement(StyledNumberPicker_1.StyledNumberPicker, tslib_1.__assign({ tabIndex: 0, onKeyDown: handleKeyDown, "aria-live": "assertive", "aria-label": label }, rest),
|
|
112
|
+
return (react_1.default.createElement(StyledNumberPicker_1.StyledNumberPicker, tslib_1.__assign({ tabIndex: 0, onKeyDown: handleKeyDown, "aria-live": "assertive", "aria-label": label, ref: pickerRef }, rest),
|
|
106
113
|
react_1.default.createElement(StyledTimeIconButton_1.StyledTimeIconButton, { tabIndex: -1, size: iconSize, color: "neutral.f04", wrapperSize: size, disabled: increaseDisabled, onClick: function () {
|
|
107
114
|
onUpdateValue(increaseValue);
|
|
108
115
|
}, symbol: juno_icon_1.ArrowUp, "data-test-automation-id": automationId && automationId + "-prev-pagination", "aria-label": "Arrow Up" }),
|
|
@@ -240,7 +240,7 @@ var _RcTimePicker = react_1.forwardRef(function (inProps, ref) {
|
|
|
240
240
|
react_1.default.createElement(styles_1.StyledPickerPopperWrap, { size: size }, selectionShowType === 'none' ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
241
241
|
react_1.default.createElement(NumberPicker_1.NumberPicker, tslib_1.__assign({ ref: hourRef, size: size, onInnerChange: handleHourInnerChange, onClick: setHourSelectionShow, onClose: closeMenu, value: hourValue }, boundary.hour, { onUpdateValue: handleHourChange, step: 1, source: isTwelveHourSystem
|
|
242
242
|
? utils_2.twelveHourSystemSource
|
|
243
|
-
: utils_2.twentyFourHourSystemSource, renderValue: renderHourValue, automationId: "time-picker-hour" }, HourPickerProps)),
|
|
243
|
+
: utils_2.twentyFourHourSystemSource, renderValue: renderHourValue, automationId: "time-picker-hour", autoFocus: true }, HourPickerProps)),
|
|
244
244
|
react_1.default.createElement(Box_1.RcBox, { textAlign: "center", width: "48px" }, ":"),
|
|
245
245
|
react_1.default.createElement(NumberPicker_1.NumberPicker, tslib_1.__assign({ ref: minuteRef, size: size }, boundary.minute, { onUpdateValue: handleMinuteChange, onClick: setMinuteSelectionShow, onClose: closeMenu, value: minuteValue, source: utils_2.minuteSource, step: utils_2.TIME_GAP, automationId: "time-picker-minute" }, MinutePickerProps)),
|
|
246
246
|
isTwelveHourSystem && (react_1.default.createElement("div", null,
|
|
@@ -44,7 +44,7 @@ var _RcTextField = react_1.forwardRef(function (inProps, ref) {
|
|
|
44
44
|
// TODO: remove when remove focusOnMount
|
|
45
45
|
autoFocusProp = _a === void 0 ? focusOnMount : _a, InputPropsProp = props.InputProps, error = props.error, helperText = props.helperText,
|
|
46
46
|
// no need assign to MuiTextField
|
|
47
|
-
defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear,
|
|
47
|
+
defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear, idProp = props.id,
|
|
48
48
|
// #region outline pick props
|
|
49
49
|
variant = props.variant, radius = props.radius, size = props.size, align = props.align, textVariant = props.textVariant, gutterBottom = props.gutterBottom, color = props.color,
|
|
50
50
|
// #endregion
|
|
@@ -68,7 +68,7 @@ var _RcTextField = react_1.forwardRef(function (inProps, ref) {
|
|
|
68
68
|
onChange === null || onChange === void 0 ? void 0 : onChange(fakeEvent);
|
|
69
69
|
setValidateMessage('');
|
|
70
70
|
});
|
|
71
|
-
var endAdornment =
|
|
71
|
+
var endAdornment = (function () {
|
|
72
72
|
var getCleanButton = function () {
|
|
73
73
|
var iconTitle = clearLabel || (clearButtonProps === null || clearButtonProps === void 0 ? void 0 : clearButtonProps.title);
|
|
74
74
|
var combineClearProps = foundation_1.combineProps({
|
|
@@ -89,48 +89,32 @@ var _RcTextField = react_1.forwardRef(function (inProps, ref) {
|
|
|
89
89
|
return InputPropsProp.endAdornment;
|
|
90
90
|
}
|
|
91
91
|
return clearBtn ? getCleanButton() : undefined;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
onFocus: function () {
|
|
107
|
-
if (validateMessage !== '') {
|
|
108
|
-
setValidateMessage('');
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
}, {
|
|
112
|
-
onBlur: onBlur,
|
|
113
|
-
onFocus: onFocus,
|
|
114
|
-
});
|
|
115
|
-
}, [onBlur, onFocus, runValidate, validateMessage]);
|
|
92
|
+
})();
|
|
93
|
+
var events = foundation_1.combineProps({
|
|
94
|
+
onBlur: function () {
|
|
95
|
+
runValidate();
|
|
96
|
+
},
|
|
97
|
+
onFocus: function () {
|
|
98
|
+
if (validateMessage !== '') {
|
|
99
|
+
setValidateMessage('');
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
}, {
|
|
103
|
+
onBlur: onBlur,
|
|
104
|
+
onFocus: onFocus,
|
|
105
|
+
});
|
|
116
106
|
var classes = react_1.useMemo(function () { return foundation_1.combineClasses(utils_1.RcTextFieldClasses, classesProp); }, [classesProp]);
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var FormHelperTextProps = react_1.useMemo(function () {
|
|
129
|
-
return foundation_1.combineProps({ classes: utils_1.RcTextFieldFormHelperTextClasses }, FormHelperTextPropsProp);
|
|
130
|
-
}, [FormHelperTextPropsProp]);
|
|
131
|
-
var InputLabelProps = react_1.useMemo(function () {
|
|
132
|
-
return foundation_1.combineProps({ classes: utils_1.RcTextFieldInputLabelClasses, shrink: true }, InputLabelPropsProp);
|
|
133
|
-
}, [InputLabelPropsProp]);
|
|
107
|
+
var additionClasses = {
|
|
108
|
+
outline: combineOutlineClasses,
|
|
109
|
+
borderLess: undefined,
|
|
110
|
+
standard: undefined,
|
|
111
|
+
}[variant];
|
|
112
|
+
var InputProps = foundation_1.combineProps({
|
|
113
|
+
classes: additionClasses || utils_1.RcTextFieldInputClasses,
|
|
114
|
+
disableUnderline: ['outline', 'borderLess', 'inline'].includes(variant),
|
|
115
|
+
}, tslib_1.__assign(tslib_1.__assign({}, InputPropsProp), { endAdornment: endAdornment }));
|
|
116
|
+
var FormHelperTextProps = foundation_1.combineProps({ classes: utils_1.RcTextFieldFormHelperTextClasses }, FormHelperTextPropsProp);
|
|
117
|
+
var InputLabelProps = foundation_1.combineProps({ classes: utils_1.RcTextFieldInputLabelClasses, shrink: true }, InputLabelPropsProp);
|
|
134
118
|
react_1.useLayoutEffect(function () {
|
|
135
119
|
var inputElm = innerRef.current;
|
|
136
120
|
var autoFocus = autoFocusProp || (InputPropsProp === null || InputPropsProp === void 0 ? void 0 : InputPropsProp.autoFocus);
|
|
@@ -158,6 +142,8 @@ var _RcTextField = react_1.forwardRef(function (inProps, ref) {
|
|
|
158
142
|
};
|
|
159
143
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
144
|
}, []);
|
|
145
|
+
// TODO: remove this after upgrade to Mui5
|
|
146
|
+
var id = foundation_1.useId(idProp);
|
|
161
147
|
react_1.useEffect(function () {
|
|
162
148
|
if (id)
|
|
163
149
|
formContext.set(id, { validate: function () { return runValidate(); } });
|
|
@@ -155,7 +155,7 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
155
155
|
size: value.size ? value.size[oriStr] : 0,
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
|
-
var limitSize =
|
|
158
|
+
var limitSize = tabsSizeRef.current[oriStr] - moreTabSizeRef.current[oriStr];
|
|
159
159
|
var _a = utils_1.computeChildBySize(labelArray, currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
|
|
160
160
|
computeGroupingInfo(tabsTabLabel, menuTabLabel);
|
|
161
161
|
var tabsTabChild = tabsTabLabel.map(function (key) {
|
|
@@ -189,7 +189,7 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
189
189
|
: computedStandardModeChild(tabRefsMap);
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
|
-
if (
|
|
192
|
+
if (tabsSizeRef.current.width !== 0 && tabsSizeRef.current.height !== 0) {
|
|
193
193
|
// computed: 1.resize 2. valueProp 3.moreMenuClick 4.children change
|
|
194
194
|
// not computed: visible tab change
|
|
195
195
|
if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0]) || '')) &&
|
|
@@ -197,7 +197,10 @@ var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
|
197
197
|
prevChildrenProp === childrenProp) {
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
// can't use tabsSize
|
|
201
|
+
// It is possible that the children prop render effect will execute before the sizeChange effect
|
|
202
|
+
// which get a old tabsSize value
|
|
203
|
+
computeTabChild(tabsSizeRef.current);
|
|
201
204
|
hasResizeRef.current = false;
|
|
202
205
|
}
|
|
203
206
|
}, [
|
|
@@ -188,7 +188,7 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
|
|
|
188
188
|
onKeyDown: onKeyDownProp,
|
|
189
189
|
disabledItemsHighlightable: disabledItemsHighlightable,
|
|
190
190
|
onGroupExpanded: onGroupExpanded,
|
|
191
|
-
}), focusInput = _10.focusInput, optionItems = _10.optionItems, optionsGroupList = _10.optionsGroupList, selectedItems = _10.tags, highlightedIndex = _10.highlightedIndex, getToggleButtonProps = _10.getToggleButtonProps, getTagProps = _10.getTagProps, getTagListBoxProps = _10.getTagListBoxProps, getMenuProps = _10.getMenuProps, getPopperProps = _10.getPopperProps, getInputProps = _10.getInputProps, getInputAriaProps = _10.getInputAriaProps, getLabelProps = _10.getLabelProps, getItemProps = _10.getItemProps, isOpen = _10.isOpen, inputValue = _10.inputValue, activeIndex = _10.activeIndex, setActiveIndex = _10.setActiveIndex, setHighlightedIndex = _10.setHighlightedIndex, onInputChange = _10.onInputChange, keepHighlightedIndex = _10.keepHighlightedIndex, changeHighlightedIndexReason = _10.changeHighlightedIndexReason, closeMenu = _10.closeMenu, openMenu = _10.openMenu, reset = _10.reset, getClearButtonProps = _10.getClearButtonProps, noOptionItem = _10.noOptionItem, getNoOptionsProps = _10.getNoOptionsProps, isKeepHighlightedIndex = _10.isKeepHighlightedIndex, isDownshiftFocused = _10.focused, autoCompleteSelectedIndex = _10.autoCompleteSelectedIndex;
|
|
191
|
+
}), focusInput = _10.focusInput, optionItems = _10.optionItems, optionsGroupList = _10.optionsGroupList, selectedItems = _10.tags, highlightedIndex = _10.highlightedIndex, getToggleButtonProps = _10.getToggleButtonProps, getTagProps = _10.getTagProps, getTagListBoxProps = _10.getTagListBoxProps, getMenuProps = _10.getMenuProps, getPopperProps = _10.getPopperProps, getInputProps = _10.getInputProps, getInputAriaProps = _10.getInputAriaProps, getLabelProps = _10.getLabelProps, getItemProps = _10.getItemProps, isOpen = _10.isOpen, inputValue = _10.inputValue, activeIndex = _10.activeIndex, setActiveIndex = _10.setActiveIndex, setHighlightedIndex = _10.setHighlightedIndex, onInputChange = _10.onInputChange, keepHighlightedIndex = _10.keepHighlightedIndex, changeHighlightedIndexReason = _10.changeHighlightedIndexReason, closeMenu = _10.closeMenu, openMenu = _10.openMenu, reset = _10.reset, getClearButtonProps = _10.getClearButtonProps, noOptionItem = _10.noOptionItem, getNoOptionsProps = _10.getNoOptionsProps, isKeepHighlightedIndex = _10.isKeepHighlightedIndex, isDownshiftFocused = _10.focused, autoCompleteSelectedIndex = _10.autoCompleteSelectedIndex, popperElementRef = _10.popperElementRef;
|
|
192
192
|
var open = Boolean((isOpen || noOptionItem) && textFieldRef.current);
|
|
193
193
|
var _11 = getInputProps(), onBlur = _11.onBlur, InputProps = __rest(_11, ["onBlur"]);
|
|
194
194
|
var helperText = isNew
|
|
@@ -303,7 +303,7 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
|
|
|
303
303
|
maxLength: maxLength, containerRef: inputContainerRef }, getInputAriaProps(TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.inputProps)),
|
|
304
304
|
}, rest), { value: inputValue, clearBtn: false })),
|
|
305
305
|
!helperText && screenReaderText && (React.createElement(RcVisuallyHidden, { id: describedbyId }, screenReaderText)),
|
|
306
|
-
React.createElement(StyledPopper, __assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: fixOffsetsModifer },
|
|
306
|
+
React.createElement(StyledPopper, __assign({ ref: popperElementRef, open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: fixOffsetsModifer },
|
|
307
307
|
// * view type in popper.js
|
|
308
308
|
popperOptions: {
|
|
309
309
|
onUpdate: function (e) {
|
|
@@ -116,9 +116,6 @@ export var useSuggestionList = function (_a) {
|
|
|
116
116
|
var groupOrder = (currGroup === null || currGroup === void 0 ? void 0 : currGroup.order) || 0;
|
|
117
117
|
return combineProps(__assign({ id: currUniqueId + "-option-" + index, onClick: function (e) {
|
|
118
118
|
selectItem(e, item);
|
|
119
|
-
}, onMouseDown: function (e) {
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
e.stopPropagation();
|
|
122
119
|
}, onMouseOver: function () {
|
|
123
120
|
if (highlightedIndexRef.current !== index &&
|
|
124
121
|
getIsItemCanSelected(item)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __read, __spread } from "tslib";
|
|
1
|
+
import { __assign, __awaiter, __generator, __read, __rest, __spread } from "tslib";
|
|
2
2
|
import { useCallback, useLayoutEffect, useMemo, useRef, } from 'react';
|
|
3
3
|
import { combineProps, getSelectionPosition, useChange, useControlled, useId, useSleep, } from '../../../foundation';
|
|
4
4
|
import { useSuggestionList } from '../SuggestionList/utils/useSuggestionList';
|
|
@@ -27,6 +27,7 @@ export var useDownshift = function (_a) {
|
|
|
27
27
|
var stopAutoSelectRef = useRef(false);
|
|
28
28
|
var fromPasteString = useRef('');
|
|
29
29
|
var keepHighlightedIndexRef = useRef(false);
|
|
30
|
+
var popperElementRef = useRef(null);
|
|
30
31
|
var _g = useSleep(), sleep = _g.sleep, getSleeping = _g.getSleeping;
|
|
31
32
|
// * when that is autocomplete, that will never be multiple
|
|
32
33
|
var multiple = isAutocomplete ? false : multipleProp;
|
|
@@ -144,7 +145,20 @@ export var useDownshift = function (_a) {
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
},
|
|
147
|
-
}), inputValue = _j.inputValue, optionItems = _j.optionItems, optionsGroupList = _j.optionsGroupList, highlightedIndexRef = _j.highlightedIndexRef, changeHighlightedIndexReasonRef = _j.changeHighlightedIndexReasonRef, forceUpdate = _j.forceUpdate, selectItem = _j.selectItem, handleF10KeyDown = _j.handleF10KeyDown, onKeyFocusedIndexHandle = _j.onKeyFocusedIndexHandle, setHighlightedIndex = _j.setHighlightedIndex, updateInputValue = _j.updateInputValue, clearInput = _j.clearInput, getNextFocusableOption = _j.getNextFocusableOption,
|
|
148
|
+
}), inputValue = _j.inputValue, optionItems = _j.optionItems, optionsGroupList = _j.optionsGroupList, highlightedIndexRef = _j.highlightedIndexRef, changeHighlightedIndexReasonRef = _j.changeHighlightedIndexReasonRef, forceUpdate = _j.forceUpdate, selectItem = _j.selectItem, handleF10KeyDown = _j.handleF10KeyDown, onKeyFocusedIndexHandle = _j.onKeyFocusedIndexHandle, setHighlightedIndex = _j.setHighlightedIndex, updateInputValue = _j.updateInputValue, clearInput = _j.clearInput, getNextFocusableOption = _j.getNextFocusableOption, getSuggestionListItemProps = _j.getItemProps, focusInput = _j.focusInput, resetSuggestionList = _j.reset, getSuggestionListInputProps = _j.getInputProps, getSuggestionListInputAriaProps = _j.getInputAriaProps, getSuggestionListClearButtonProps = _j.getClearButtonProps, getLabelProps = _j.getLabelProps, getMenuProps = _j.getMenuProps;
|
|
149
|
+
var getItemProps = function (props) {
|
|
150
|
+
var onMouseDown = props.onMouseDown, onMouseUp = props.onMouseUp, rest = __rest(props, ["onMouseDown", "onMouseUp"]);
|
|
151
|
+
return getSuggestionListItemProps(__assign(__assign({}, rest), { onMouseDown: function (e) {
|
|
152
|
+
// `getPopperProps` will prevent change focus when mouse down popper
|
|
153
|
+
// but suggestion item is an exception.
|
|
154
|
+
// so we need stop propagation to make sure focus can be changed
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
|
|
157
|
+
}, onMouseUp: function (e) {
|
|
158
|
+
focusInput();
|
|
159
|
+
onMouseUp === null || onMouseUp === void 0 ? void 0 : onMouseUp(e);
|
|
160
|
+
} }));
|
|
161
|
+
};
|
|
148
162
|
var readOnly = !isAutocomplete && !multiple && tags.length >= 1 ? true : undefined;
|
|
149
163
|
var closeMenu = function (e, reason) {
|
|
150
164
|
keepHighlightedIndexRef.current = false;
|
|
@@ -280,8 +294,8 @@ export var useDownshift = function (_a) {
|
|
|
280
294
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
281
295
|
}, []);
|
|
282
296
|
var getInputProps = function (props) {
|
|
283
|
-
var
|
|
284
|
-
return combineProps(__assign(__assign({},
|
|
297
|
+
var suggestionListInputProps = getSuggestionListInputProps(props);
|
|
298
|
+
return combineProps(__assign(__assign({}, suggestionListInputProps), { onPaste: function (e) {
|
|
285
299
|
var _a;
|
|
286
300
|
if (freeSolo) {
|
|
287
301
|
var clipboardData = e.clipboardData;
|
|
@@ -318,7 +332,12 @@ export var useDownshift = function (_a) {
|
|
|
318
332
|
stopAutoSelectRef.current = false;
|
|
319
333
|
blurTags();
|
|
320
334
|
}, onBlur: function (e) {
|
|
335
|
+
var _a;
|
|
321
336
|
setInputFocused(false);
|
|
337
|
+
// mouse down suggestion item will change focus,
|
|
338
|
+
// but we don't want to close popper in this case
|
|
339
|
+
if ((_a = popperElementRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget))
|
|
340
|
+
return;
|
|
322
341
|
if (autoSelect && !stopAutoSelectRef.current) {
|
|
323
342
|
if (!freeSolo)
|
|
324
343
|
selectItem(e, optionItems[highlightedIndexRef.current]);
|
|
@@ -530,5 +549,6 @@ export var useDownshift = function (_a) {
|
|
|
530
549
|
id: downshiftId,
|
|
531
550
|
inputChanged: isInputValueChangedRef.current,
|
|
532
551
|
autoCompleteSelectedIndex: autoCompleteSelectedIndexRef.current,
|
|
552
|
+
popperElementRef: popperElementRef,
|
|
533
553
|
};
|
|
534
554
|
};
|
|
@@ -160,7 +160,6 @@ var Calendar = forwardRef(function (_a, ref) {
|
|
|
160
160
|
}
|
|
161
161
|
}, [previousView, view, viewChange]);
|
|
162
162
|
useLayoutEffect(function () {
|
|
163
|
-
focusDayElement();
|
|
164
163
|
calendarRef.current = document.querySelector("." + RcDatePickerClasses.popover + " ." + RcDatePickerClasses.popoverPaper);
|
|
165
164
|
var unsubscribe = transitionendSubscriber(calendarRef.current, onTransitionEnd);
|
|
166
165
|
return function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { memo, useRef } from 'react';
|
|
1
|
+
import React, { memo, useRef, useLayoutEffect } from 'react';
|
|
2
2
|
import { useUtils as useMuiUtils } from '@material-ui/pickers';
|
|
3
3
|
import { ArrowLeft2 as arrowLeftSvg, ArrowRight as arrowRightSvg, } from '@ringcentral/juno-icon';
|
|
4
4
|
import { RcVisuallyHidden } from '../../../VisuallyHidden';
|
|
@@ -12,6 +12,10 @@ var DatePickerHeader = memo(function (props) {
|
|
|
12
12
|
var nextMonth = utils.getNextMonth(focusedDate);
|
|
13
13
|
var monthLabel = utils.getCalendarHeaderText(focusedDate);
|
|
14
14
|
var changeFromRef = useRef();
|
|
15
|
+
var headerRef = useRef(null);
|
|
16
|
+
useLayoutEffect(function () {
|
|
17
|
+
headerRef.current.focus();
|
|
18
|
+
}, []);
|
|
15
19
|
var selectNextMonth = function () {
|
|
16
20
|
onMonthChange(nextMonth, 'left');
|
|
17
21
|
changeFromRef.current = 'next';
|
|
@@ -30,7 +34,7 @@ var DatePickerHeader = memo(function (props) {
|
|
|
30
34
|
? nextMonthAriaLabel
|
|
31
35
|
: previousMonthAriaLabel)),
|
|
32
36
|
React.createElement(SwitchHeaderWrapper, { size: size, className: classes.header },
|
|
33
|
-
React.createElement(StyledCurrentMonth, { role: 'button', tabIndex: 0, view: view, onClick: onViewChange, "aria-label": monthYearAriaLabel, "aria-expanded": ariaExpanded, "data-test-automation-id": "date-picker-month-year", className: classes.select },
|
|
37
|
+
React.createElement(StyledCurrentMonth, { role: 'button', tabIndex: 0, view: view, onClick: onViewChange, "aria-label": monthYearAriaLabel, "aria-expanded": ariaExpanded, "data-test-automation-id": "date-picker-month-year", className: classes.select, ref: headerRef },
|
|
34
38
|
monthLabel,
|
|
35
39
|
React.createElement(SelectArrowDownIcon, null)),
|
|
36
40
|
React.createElement(SwitchHeaderButtonWrapper, { size: size, gap: 3, view: view },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef, } from 'react';
|
|
2
|
+
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef, useLayoutEffect, } from 'react';
|
|
3
3
|
import { runKeyHandler } from '@material-ui/pickers/_shared/hooks/useKeyDown';
|
|
4
4
|
import { ArrowDown as ArrowDownIcon, ArrowUp as ArrowUpIcon, } from '@ringcentral/juno-icon';
|
|
5
5
|
import { styled, useChange, useDepsChange, useEventCallback, useForceUpdate, useRefState, } from '../../../../foundation';
|
|
@@ -7,10 +7,17 @@ import { StyledNumberPicker } from './styles/StyledNumberPicker';
|
|
|
7
7
|
import { StyledTimeIconButton } from './styles/StyledTimeIconButton';
|
|
8
8
|
import { pad } from './utils';
|
|
9
9
|
var _NumberPicker = forwardRef(function (props, ref) {
|
|
10
|
-
var onClick = props.onClick, value = props.value, onUpdateValue = props.onUpdateValue, onKeyDown = props.onKeyDown, source = props.source, automationId = props.automationId, size = props.size, minProp = props.min, maxProp = props.max, onClose = props.onClose, step = props.step, onInnerChange = props.onInnerChange, renderValue = props.renderValue, getScreenReaderLabel = props.getScreenReaderLabel, rest = __rest(props, ["onClick", "value", "onUpdateValue", "onKeyDown", "source", "automationId", "size", "min", "max", "onClose", "step", "onInnerChange", "renderValue", "getScreenReaderLabel"]);
|
|
10
|
+
var onClick = props.onClick, value = props.value, onUpdateValue = props.onUpdateValue, onKeyDown = props.onKeyDown, source = props.source, automationId = props.automationId, size = props.size, minProp = props.min, maxProp = props.max, onClose = props.onClose, step = props.step, onInnerChange = props.onInnerChange, renderValue = props.renderValue, getScreenReaderLabel = props.getScreenReaderLabel, autoFocus = props.autoFocus, rest = __rest(props, ["onClick", "value", "onUpdateValue", "onKeyDown", "source", "automationId", "size", "min", "max", "onClose", "step", "onInnerChange", "renderValue", "getScreenReaderLabel", "autoFocus"]);
|
|
11
11
|
var forceUpdate = useForceUpdate();
|
|
12
12
|
var _a = __read(useRefState(value, forceUpdate), 2), innerValueRef = _a[0], setInnerValue = _a[1];
|
|
13
13
|
var rangeRef = useRef({ max: maxProp, min: minProp });
|
|
14
|
+
var pickerRef = useRef(null);
|
|
15
|
+
useLayoutEffect(function () {
|
|
16
|
+
if (autoFocus) {
|
|
17
|
+
pickerRef.current.focus();
|
|
18
|
+
}
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
}, []);
|
|
14
21
|
useDepsChange(function () {
|
|
15
22
|
rangeRef.current = { max: maxProp, min: minProp };
|
|
16
23
|
}, [maxProp, minProp]);
|
|
@@ -100,7 +107,7 @@ var _NumberPicker = forwardRef(function (props, ref) {
|
|
|
100
107
|
return 'large';
|
|
101
108
|
}
|
|
102
109
|
})();
|
|
103
|
-
return (React.createElement(StyledNumberPicker, __assign({ tabIndex: 0, onKeyDown: handleKeyDown, "aria-live": "assertive", "aria-label": label }, rest),
|
|
110
|
+
return (React.createElement(StyledNumberPicker, __assign({ tabIndex: 0, onKeyDown: handleKeyDown, "aria-live": "assertive", "aria-label": label, ref: pickerRef }, rest),
|
|
104
111
|
React.createElement(StyledTimeIconButton, { tabIndex: -1, size: iconSize, color: "neutral.f04", wrapperSize: size, disabled: increaseDisabled, onClick: function () {
|
|
105
112
|
onUpdateValue(increaseValue);
|
|
106
113
|
}, symbol: ArrowUpIcon, "data-test-automation-id": automationId && automationId + "-prev-pagination", "aria-label": "Arrow Up" }),
|
|
@@ -238,7 +238,7 @@ var _RcTimePicker = forwardRef(function (inProps, ref) {
|
|
|
238
238
|
React.createElement(StyledPickerPopperWrap, { size: size }, selectionShowType === 'none' ? (React.createElement(React.Fragment, null,
|
|
239
239
|
React.createElement(NumberPicker, __assign({ ref: hourRef, size: size, onInnerChange: handleHourInnerChange, onClick: setHourSelectionShow, onClose: closeMenu, value: hourValue }, boundary.hour, { onUpdateValue: handleHourChange, step: 1, source: isTwelveHourSystem
|
|
240
240
|
? twelveHourSystemSource
|
|
241
|
-
: twentyFourHourSystemSource, renderValue: renderHourValue, automationId: "time-picker-hour" }, HourPickerProps)),
|
|
241
|
+
: twentyFourHourSystemSource, renderValue: renderHourValue, automationId: "time-picker-hour", autoFocus: true }, HourPickerProps)),
|
|
242
242
|
React.createElement(RcBox, { textAlign: "center", width: "48px" }, ":"),
|
|
243
243
|
React.createElement(NumberPicker, __assign({ ref: minuteRef, size: size }, boundary.minute, { onUpdateValue: handleMinuteChange, onClick: setMinuteSelectionShow, onClose: closeMenu, value: minuteValue, source: minuteSource, step: TIME_GAP, automationId: "time-picker-minute" }, MinutePickerProps)),
|
|
244
244
|
isTwelveHourSystem && (React.createElement("div", null,
|
|
@@ -2,7 +2,7 @@ import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
|
2
2
|
import React, { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import MuiTextField from '@material-ui/core/TextField';
|
|
4
4
|
import { DeleteCircle } from '@ringcentral/juno-icon';
|
|
5
|
-
import { clearReactReferencesInNode, combineClasses, combineProps, styled, useControlled, useDeprecatedCheck, useEventCallback, useForkRef, useThemeProps, } from '../../../foundation';
|
|
5
|
+
import { clearReactReferencesInNode, combineClasses, combineProps, styled, useControlled, useDeprecatedCheck, useEventCallback, useForkRef, useThemeProps, useId, } from '../../../foundation';
|
|
6
6
|
import { useRcFormContext } from '../Form/Form/FormContext';
|
|
7
7
|
import { ClearIconButton, TextFieldStyle } from './styles';
|
|
8
8
|
import { RcOutlineTextFieldIconSizes, RcOutlineTextFieldInputClasses, RcTextFieldClasses, RcTextFieldFormHelperTextClasses, RcTextFieldInputClasses, RcTextFieldInputLabelClasses, } from './utils';
|
|
@@ -41,7 +41,7 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
41
41
|
// TODO: remove when remove focusOnMount
|
|
42
42
|
autoFocusProp = _a === void 0 ? focusOnMount : _a, InputPropsProp = props.InputProps, error = props.error, helperText = props.helperText,
|
|
43
43
|
// no need assign to MuiTextField
|
|
44
|
-
defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear,
|
|
44
|
+
defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear, idProp = props.id,
|
|
45
45
|
// #region outline pick props
|
|
46
46
|
variant = props.variant, radius = props.radius, size = props.size, align = props.align, textVariant = props.textVariant, gutterBottom = props.gutterBottom, color = props.color,
|
|
47
47
|
// #endregion
|
|
@@ -65,7 +65,7 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
65
65
|
onChange === null || onChange === void 0 ? void 0 : onChange(fakeEvent);
|
|
66
66
|
setValidateMessage('');
|
|
67
67
|
});
|
|
68
|
-
var endAdornment =
|
|
68
|
+
var endAdornment = (function () {
|
|
69
69
|
var getCleanButton = function () {
|
|
70
70
|
var iconTitle = clearLabel || (clearButtonProps === null || clearButtonProps === void 0 ? void 0 : clearButtonProps.title);
|
|
71
71
|
var combineClearProps = combineProps({
|
|
@@ -86,48 +86,32 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
86
86
|
return InputPropsProp.endAdornment;
|
|
87
87
|
}
|
|
88
88
|
return clearBtn ? getCleanButton() : undefined;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
onFocus: function () {
|
|
104
|
-
if (validateMessage !== '') {
|
|
105
|
-
setValidateMessage('');
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
}, {
|
|
109
|
-
onBlur: onBlur,
|
|
110
|
-
onFocus: onFocus,
|
|
111
|
-
});
|
|
112
|
-
}, [onBlur, onFocus, runValidate, validateMessage]);
|
|
89
|
+
})();
|
|
90
|
+
var events = combineProps({
|
|
91
|
+
onBlur: function () {
|
|
92
|
+
runValidate();
|
|
93
|
+
},
|
|
94
|
+
onFocus: function () {
|
|
95
|
+
if (validateMessage !== '') {
|
|
96
|
+
setValidateMessage('');
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
}, {
|
|
100
|
+
onBlur: onBlur,
|
|
101
|
+
onFocus: onFocus,
|
|
102
|
+
});
|
|
113
103
|
var classes = useMemo(function () { return combineClasses(RcTextFieldClasses, classesProp); }, [classesProp]);
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var FormHelperTextProps = useMemo(function () {
|
|
126
|
-
return combineProps({ classes: RcTextFieldFormHelperTextClasses }, FormHelperTextPropsProp);
|
|
127
|
-
}, [FormHelperTextPropsProp]);
|
|
128
|
-
var InputLabelProps = useMemo(function () {
|
|
129
|
-
return combineProps({ classes: RcTextFieldInputLabelClasses, shrink: true }, InputLabelPropsProp);
|
|
130
|
-
}, [InputLabelPropsProp]);
|
|
104
|
+
var additionClasses = {
|
|
105
|
+
outline: combineOutlineClasses,
|
|
106
|
+
borderLess: undefined,
|
|
107
|
+
standard: undefined,
|
|
108
|
+
}[variant];
|
|
109
|
+
var InputProps = combineProps({
|
|
110
|
+
classes: additionClasses || RcTextFieldInputClasses,
|
|
111
|
+
disableUnderline: ['outline', 'borderLess', 'inline'].includes(variant),
|
|
112
|
+
}, __assign(__assign({}, InputPropsProp), { endAdornment: endAdornment }));
|
|
113
|
+
var FormHelperTextProps = combineProps({ classes: RcTextFieldFormHelperTextClasses }, FormHelperTextPropsProp);
|
|
114
|
+
var InputLabelProps = combineProps({ classes: RcTextFieldInputLabelClasses, shrink: true }, InputLabelPropsProp);
|
|
131
115
|
useLayoutEffect(function () {
|
|
132
116
|
var inputElm = innerRef.current;
|
|
133
117
|
var autoFocus = autoFocusProp || (InputPropsProp === null || InputPropsProp === void 0 ? void 0 : InputPropsProp.autoFocus);
|
|
@@ -155,6 +139,8 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
155
139
|
};
|
|
156
140
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
157
141
|
}, []);
|
|
142
|
+
// TODO: remove this after upgrade to Mui5
|
|
143
|
+
var id = useId(idProp);
|
|
158
144
|
useEffect(function () {
|
|
159
145
|
if (id)
|
|
160
146
|
formContext.set(id, { validate: function () { return runValidate(); } });
|
|
@@ -153,7 +153,7 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
153
153
|
size: value.size ? value.size[oriStr] : 0,
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
|
-
var limitSize =
|
|
156
|
+
var limitSize = tabsSizeRef.current[oriStr] - moreTabSizeRef.current[oriStr];
|
|
157
157
|
var _a = computeChildBySize(labelArray, currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
|
|
158
158
|
computeGroupingInfo(tabsTabLabel, menuTabLabel);
|
|
159
159
|
var tabsTabChild = tabsTabLabel.map(function (key) {
|
|
@@ -187,7 +187,7 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
187
187
|
: computedStandardModeChild(tabRefsMap);
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
if (
|
|
190
|
+
if (tabsSizeRef.current.width !== 0 && tabsSizeRef.current.height !== 0) {
|
|
191
191
|
// computed: 1.resize 2. valueProp 3.moreMenuClick 4.children change
|
|
192
192
|
// not computed: visible tab change
|
|
193
193
|
if (((_a = groupingRef.current) === null || _a === void 0 ? void 0 : _a.tabs.includes((currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0]) || '')) &&
|
|
@@ -195,7 +195,10 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
195
195
|
prevChildrenProp === childrenProp) {
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
// can't use tabsSize
|
|
199
|
+
// It is possible that the children prop render effect will execute before the sizeChange effect
|
|
200
|
+
// which get a old tabsSize value
|
|
201
|
+
computeTabChild(tabsSizeRef.current);
|
|
199
202
|
hasResizeRef.current = false;
|
|
200
203
|
}
|
|
201
204
|
}, [
|