@ringcentral/juno 2.26.0 → 2.26.2
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/Forms/Picker/DatePicker/DatePickerHeader.js +2 -2
- package/components/Forms/Picker/DatePicker/Year.js +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.js +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDay.js +3 -1
- package/components/Forms/Picker/DatePicker/styles/StyledYear.js +1 -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/Picker/styles/PickerBaseIconButton.js +1 -1
- package/components/Forms/Picker/styles/datePickerCustomFocusRingStyle.d.ts +5 -0
- package/components/Forms/Picker/styles/datePickerCustomFocusRingStyle.js +15 -0
- package/components/Forms/Picker/styles/index.d.ts +1 -0
- package/components/Forms/Picker/styles/index.js +1 -0
- package/es6/components/Forms/Picker/DatePicker/DatePickerHeader.js +2 -2
- package/es6/components/Forms/Picker/DatePicker/Year.js +1 -1
- package/es6/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.js +1 -1
- package/es6/components/Forms/Picker/DatePicker/styles/StyledDay.js +3 -1
- package/es6/components/Forms/Picker/DatePicker/styles/StyledYear.js +2 -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/Picker/styles/PickerBaseIconButton.js +1 -1
- package/es6/components/Forms/Picker/styles/datePickerCustomFocusRingStyle.js +13 -0
- package/es6/components/Forms/Picker/styles/index.js +1 -0
- package/es6/foundation/styles/focusVisible.js +5 -1
- package/foundation/styles/focusVisible.d.ts +1 -1
- package/foundation/styles/focusVisible.js +5 -1
- package/package.json +1 -1
|
@@ -37,8 +37,8 @@ var DatePickerHeader = react_1.memo(function (props) {
|
|
|
37
37
|
monthLabel,
|
|
38
38
|
react_1.default.createElement(SelectArrowDownIcon_1.SelectArrowDownIcon, null)),
|
|
39
39
|
react_1.default.createElement(styles_1.SwitchHeaderButtonWrapper, { size: size, gap: 3, view: view },
|
|
40
|
-
react_1.default.createElement(styles_1.SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disablePrevMonth, onClick: selectPreviousMonth, symbol: juno_icon_1.ArrowLeft2, "aria-label": previousMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-pre-month", className: classes.leftArrow }),
|
|
41
|
-
react_1.default.createElement(styles_1.SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disableNextMonth, onClick: selectNextMonth, symbol: juno_icon_1.ArrowRight, "aria-label": nextMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-next-month", className: classes.rightArrow })))));
|
|
40
|
+
react_1.default.createElement(styles_1.SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disablePrevMonth, onClick: selectPreviousMonth, symbol: juno_icon_1.ArrowLeft2, "aria-label": previousMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-pre-month", className: classes.leftArrow, focusVariant: "focusRing" }),
|
|
41
|
+
react_1.default.createElement(styles_1.SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disableNextMonth, onClick: selectNextMonth, symbol: juno_icon_1.ArrowRight, "aria-label": nextMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-next-month", className: classes.rightArrow, focusVariant: "focusRing" })))));
|
|
42
42
|
});
|
|
43
43
|
exports.DatePickerHeader = DatePickerHeader;
|
|
44
44
|
DatePickerHeader.defaultProps = {
|
|
@@ -16,7 +16,7 @@ var Year = react_1.memo(react_1.forwardRef(function (props, ref) {
|
|
|
16
16
|
});
|
|
17
17
|
var yearAriaLabel = getYearAriaLabel === null || getYearAriaLabel === void 0 ? void 0 : getYearAriaLabel("" + value, selected);
|
|
18
18
|
var handleClick = !disabled ? _handleClick : undefined;
|
|
19
|
-
return (react_1.default.createElement(styles_1.StyledYear, tslib_1.__assign({ radius: "round", onClick: handleClick, onKeyPress: handleClick, ref: ref, selected: selected, "aria-pressed": focused, "aria-label": yearAriaLabel, className: className, "data-test-automation-class": "date-picker-year", "data-test-automation-value": children }, rest),
|
|
19
|
+
return (react_1.default.createElement(styles_1.StyledYear, tslib_1.__assign({ radius: "round", onClick: handleClick, onKeyPress: handleClick, ref: ref, selected: selected, "aria-pressed": focused, size: "medium", "aria-label": yearAriaLabel, className: className, "data-test-automation-class": "date-picker-year", "data-test-automation-value": children }, rest),
|
|
20
20
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
21
21
|
// TODO: that <></> will fix when `RcIconButton` ready
|
|
22
22
|
children)));
|
|
@@ -7,7 +7,7 @@ var utils_1 = require("../../../../Buttons/IconButton/utils");
|
|
|
7
7
|
var Icon_1 = require("../../../../Icon");
|
|
8
8
|
var utils_2 = require("../utils");
|
|
9
9
|
var monthInactiveStyle = foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &,\n ", " {\n color: ", ";\n }\n"], ["\n &,\n ", " {\n color: ", ";\n }\n"])), Icon_1.RcIcon, foundation_1.focusVisibleColor);
|
|
10
|
-
var StyledCurrentMonth = foundation_1.styled.button(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"], ["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"])), foundation_1.flexCenterStyle, foundation_1.spacing(5), utils_2.textColor, foundation_1.typography('body2'), foundation_1.radius('sm'), foundation_1.spacing(1, 0, 1, 1), foundation_1.focusVisibleShadowStyle('
|
|
10
|
+
var StyledCurrentMonth = foundation_1.styled.button(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"], ["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"])), foundation_1.flexCenterStyle, foundation_1.spacing(5), utils_2.textColor, foundation_1.typography('body2'), foundation_1.radius('sm'), foundation_1.spacing(1, 0, 1, 1), foundation_1.focusVisibleShadowStyle('lg', undefined, undefined, 2), Icon_1.RcIcon, foundation_1.spacing(2), function (_a) {
|
|
11
11
|
var view = _a.view;
|
|
12
12
|
return (view === 'day' ? '0' : '180');
|
|
13
13
|
}, foundation_1.palette2('neutral', 'f04'), foundation_1.focusVisible, monthInactiveStyle, foundation_1.nonTouchHoverMedia, monthInactiveStyle);
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var foundation_1 = require("../../../../../foundation");
|
|
5
5
|
var utils_1 = require("../../../../Buttons/IconButton/utils");
|
|
6
|
+
var styles_1 = require("../../styles");
|
|
6
7
|
var utils_2 = require("../utils");
|
|
7
8
|
var CurrentDayStyle = foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), foundation_1.palette2('neutral', 'b04'));
|
|
8
9
|
exports.DayStyle = function (_a) {
|
|
9
10
|
var current = _a.current, size = _a.size, hidden = _a.hidden, selected = _a.selected;
|
|
10
|
-
|
|
11
|
+
var sizeValue = utils_2.RcDatePickerIconWidths[size];
|
|
12
|
+
return foundation_1.css(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n &.", " {\n width: ", ";\n height: ", ";\n margin: 0 2px;\n visibility: ", ";\n ", ";\n ", ";\n\n ", "\n }\n "], ["\n &.", " {\n width: ", ";\n height: ", ";\n margin: 0 2px;\n visibility: ", ";\n ", ";\n ", ";\n\n ", "\n }\n "])), utils_1.RcIconButtonClasses.root, sizeValue, sizeValue, hidden && 'hidden', foundation_1.typography('caption1'), current && !selected && CurrentDayStyle, styles_1.datePickerCustomFocusRingStyle);
|
|
11
13
|
};
|
|
12
14
|
var templateObject_1, templateObject_2;
|
|
@@ -4,5 +4,5 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var foundation_1 = require("../../../../../foundation");
|
|
5
5
|
var utils_1 = require("../../../../Buttons/IconButton/utils");
|
|
6
6
|
var styles_1 = require("../../styles");
|
|
7
|
-
exports.StyledYear = foundation_1.styled(styles_1.PickerBaseIconButton)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n }\n"], ["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n }\n"])), utils_1.RcIconButtonClasses.root, foundation_1.typography('body1'));
|
|
7
|
+
exports.StyledYear = foundation_1.styled(styles_1.PickerBaseIconButton)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n ", ";\n }\n"], ["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n ", ";\n }\n"])), utils_1.RcIconButtonClasses.root, foundation_1.typography('body1'), styles_1.datePickerCustomFocusRingStyle);
|
|
8
8
|
var templateObject_1;
|
|
@@ -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,
|
|
@@ -5,6 +5,6 @@ var react_1 = tslib_1.__importStar(require("react"));
|
|
|
5
5
|
var IconButton_1 = require("../../../Buttons/IconButton");
|
|
6
6
|
exports.PickerBaseIconButton = react_1.forwardRef(function (props, ref) {
|
|
7
7
|
var children = props.children, selected = props.selected, hidden = props.hidden, rest = tslib_1.__rest(props, ["children", "selected", "hidden"]);
|
|
8
|
-
return (react_1.default.createElement(IconButton_1.RcIconButton, tslib_1.__assign({ elevation: 0, activeElevation: 0, ref: ref, variant: selected ? 'contained' : 'round', color: selected ? 'interactive.b02' : 'neutral.f06', "data-hidden": hidden, size: "xsmall" }, rest), children));
|
|
8
|
+
return (react_1.default.createElement(IconButton_1.RcIconButton, tslib_1.__assign({ elevation: 0, activeElevation: 0, ref: ref, variant: selected ? 'contained' : 'round', color: selected ? 'interactive.b02' : 'neutral.f06', "data-hidden": hidden, size: "xsmall", focusVariant: "focusRing" }, rest), children));
|
|
9
9
|
});
|
|
10
10
|
exports.PickerBaseIconButton.displayName = 'PickerBaseIconButton';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RcThemedStyled, UnitMap } from '../../../../foundation';
|
|
2
|
+
import { RcDatePickerSize } from '../DatePicker';
|
|
3
|
+
import { PickerBaseIconButtonProps } from './PickerBaseIconButton';
|
|
4
|
+
export declare const RcPickerFocusInsetBorderSizes: UnitMap<RcDatePickerSize, number>;
|
|
5
|
+
export declare const datePickerCustomFocusRingStyle: RcThemedStyled<PickerBaseIconButtonProps, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var foundation_1 = require("../../../../foundation");
|
|
5
|
+
exports.RcPickerFocusInsetBorderSizes = {
|
|
6
|
+
small: 1,
|
|
7
|
+
medium: 2,
|
|
8
|
+
};
|
|
9
|
+
exports.datePickerCustomFocusRingStyle = function (_a) {
|
|
10
|
+
var size = _a.size, selected = _a.selected, _b = _a.radius, radius = _b === void 0 ? 'circle' : _b;
|
|
11
|
+
var focusInsetBorderSizes = exports.RcPickerFocusInsetBorderSizes[size];
|
|
12
|
+
return (selected && foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", " {\n ", "\n &:after {\n top: ", "px;\n right: ", "px;\n bottom: ", "px;\n left: ", "px;\n }\n &:before {\n background-color: unset !important;\n }\n }\n "], ["\n ", " {\n ",
|
|
13
|
+
"\n &:after {\n top: ", "px;\n right: ", "px;\n bottom: ", "px;\n left: ", "px;\n }\n &:before {\n background-color: unset !important;\n }\n }\n "])), foundation_1.focusVisible, foundation_1.shadowBorder(radius, foundation_1.palette2('neutral', 'b01'), true, focusInsetBorderSizes), focusInsetBorderSizes, focusInsetBorderSizes, focusInsetBorderSizes, focusInsetBorderSizes));
|
|
14
|
+
};
|
|
15
|
+
var templateObject_1;
|
|
@@ -4,3 +4,4 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./PickerBaseIconButton"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./StyledPickerTextField"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./StyledPopover"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./datePickerCustomFocusRingStyle"), exports);
|
|
@@ -34,8 +34,8 @@ var DatePickerHeader = memo(function (props) {
|
|
|
34
34
|
monthLabel,
|
|
35
35
|
React.createElement(SelectArrowDownIcon, null)),
|
|
36
36
|
React.createElement(SwitchHeaderButtonWrapper, { size: size, gap: 3, view: view },
|
|
37
|
-
React.createElement(SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disablePrevMonth, onClick: selectPreviousMonth, symbol: arrowLeftSvg, "aria-label": previousMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-pre-month", className: classes.leftArrow }),
|
|
38
|
-
React.createElement(SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disableNextMonth, onClick: selectNextMonth, symbol: arrowRightSvg, "aria-label": nextMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-next-month", className: classes.rightArrow })))));
|
|
37
|
+
React.createElement(SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disablePrevMonth, onClick: selectPreviousMonth, symbol: arrowLeftSvg, "aria-label": previousMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-pre-month", className: classes.leftArrow, focusVariant: "focusRing" }),
|
|
38
|
+
React.createElement(SwitchHeaderButton, { color: "neutral.f04", size: "small", disabled: disableNextMonth, onClick: selectNextMonth, symbol: arrowRightSvg, "aria-label": nextMonthAriaLabel, "data-picker-action": true, "data-test-automation-id": "date-picker-next-month", className: classes.rightArrow, focusVariant: "focusRing" })))));
|
|
39
39
|
});
|
|
40
40
|
DatePickerHeader.defaultProps = {
|
|
41
41
|
disablePrevMonth: false,
|
|
@@ -14,7 +14,7 @@ var Year = memo(forwardRef(function (props, ref) {
|
|
|
14
14
|
});
|
|
15
15
|
var yearAriaLabel = getYearAriaLabel === null || getYearAriaLabel === void 0 ? void 0 : getYearAriaLabel("" + value, selected);
|
|
16
16
|
var handleClick = !disabled ? _handleClick : undefined;
|
|
17
|
-
return (React.createElement(StyledYear, __assign({ radius: "round", onClick: handleClick, onKeyPress: handleClick, ref: ref, selected: selected, "aria-pressed": focused, "aria-label": yearAriaLabel, className: className, "data-test-automation-class": "date-picker-year", "data-test-automation-value": children }, rest),
|
|
17
|
+
return (React.createElement(StyledYear, __assign({ radius: "round", onClick: handleClick, onKeyPress: handleClick, ref: ref, selected: selected, "aria-pressed": focused, size: "medium", "aria-label": yearAriaLabel, className: className, "data-test-automation-class": "date-picker-year", "data-test-automation-value": children }, rest),
|
|
18
18
|
React.createElement(React.Fragment, null,
|
|
19
19
|
// TODO: that <></> will fix when `RcIconButton` ready
|
|
20
20
|
children)));
|
|
@@ -5,7 +5,7 @@ import { RcIconButtonClasses } from '../../../../Buttons/IconButton/utils';
|
|
|
5
5
|
import { RcIcon } from '../../../../Icon';
|
|
6
6
|
import { textColor } from '../utils';
|
|
7
7
|
var monthInactiveStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &,\n ", " {\n color: ", ";\n }\n"], ["\n &,\n ", " {\n color: ", ";\n }\n"])), RcIcon, focusVisibleColor);
|
|
8
|
-
var StyledCurrentMonth = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"], ["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"])), flexCenterStyle, spacing(5), textColor, typography('body2'), radius('sm'), spacing(1, 0, 1, 1), focusVisibleShadowStyle('
|
|
8
|
+
var StyledCurrentMonth = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"], ["\n background: none;\n border: none;\n cursor: pointer;\n outline: inherit;\n\n ", ";\n position: relative;\n cursor: pointer;\n margin-left: ", ";\n color: ", ";\n ", ";\n border-radius: ", ";\n\n padding: ", ";\n\n ", ";\n\n ", " {\n margin-left: ", ";\n transform: rotate(", "deg);\n color: ", ";\n }\n\n ", " {\n ", ";\n }\n\n ", " {\n &:hover {\n ", ";\n }\n }\n"])), flexCenterStyle, spacing(5), textColor, typography('body2'), radius('sm'), spacing(1, 0, 1, 1), focusVisibleShadowStyle('lg', undefined, undefined, 2), RcIcon, spacing(2), function (_a) {
|
|
9
9
|
var view = _a.view;
|
|
10
10
|
return (view === 'day' ? '0' : '180');
|
|
11
11
|
}, palette2('neutral', 'f04'), focusVisible, monthInactiveStyle, nonTouchHoverMedia, monthInactiveStyle);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { css, palette2, typography, } from '../../../../../foundation';
|
|
3
3
|
import { RcIconButtonClasses } from '../../../../Buttons/IconButton/utils';
|
|
4
|
+
import { datePickerCustomFocusRingStyle } from '../../styles';
|
|
4
5
|
import { RcDatePickerIconWidths } from '../utils';
|
|
5
6
|
var CurrentDayStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border: 1px solid ", ";\n"], ["\n border: 1px solid ", ";\n"])), palette2('neutral', 'b04'));
|
|
6
7
|
export var DayStyle = function (_a) {
|
|
7
8
|
var current = _a.current, size = _a.size, hidden = _a.hidden, selected = _a.selected;
|
|
8
|
-
|
|
9
|
+
var sizeValue = RcDatePickerIconWidths[size];
|
|
10
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &.", " {\n width: ", ";\n height: ", ";\n margin: 0 2px;\n visibility: ", ";\n ", ";\n ", ";\n\n ", "\n }\n "], ["\n &.", " {\n width: ", ";\n height: ", ";\n margin: 0 2px;\n visibility: ", ";\n ", ";\n ", ";\n\n ", "\n }\n "])), RcIconButtonClasses.root, sizeValue, sizeValue, hidden && 'hidden', typography('caption1'), current && !selected && CurrentDayStyle, datePickerCustomFocusRingStyle);
|
|
9
11
|
};
|
|
10
12
|
var templateObject_1, templateObject_2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { styled, typography } from '../../../../../foundation';
|
|
3
3
|
import { RcIconButtonClasses } from '../../../../Buttons/IconButton/utils';
|
|
4
|
-
import { PickerBaseIconButton } from '../../styles';
|
|
5
|
-
export var StyledYear = styled(PickerBaseIconButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n }\n"], ["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n }\n"])), RcIconButtonClasses.root, typography('body1'));
|
|
4
|
+
import { datePickerCustomFocusRingStyle, PickerBaseIconButton, } from '../../styles';
|
|
5
|
+
export var StyledYear = styled(PickerBaseIconButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n ", ";\n }\n"], ["\n &.", " {\n width: 56px;\n min-width: 56px;\n height: 28px;\n margin: 4px 0;\n ", ";\n ", ";\n }\n"])), RcIconButtonClasses.root, typography('body1'), datePickerCustomFocusRingStyle);
|
|
6
6
|
var templateObject_1;
|
|
@@ -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,
|
|
@@ -3,6 +3,6 @@ import React, { forwardRef } from 'react';
|
|
|
3
3
|
import { RcIconButton } from '../../../Buttons/IconButton';
|
|
4
4
|
export var PickerBaseIconButton = forwardRef(function (props, ref) {
|
|
5
5
|
var children = props.children, selected = props.selected, hidden = props.hidden, rest = __rest(props, ["children", "selected", "hidden"]);
|
|
6
|
-
return (React.createElement(RcIconButton, __assign({ elevation: 0, activeElevation: 0, ref: ref, variant: selected ? 'contained' : 'round', color: selected ? 'interactive.b02' : 'neutral.f06', "data-hidden": hidden, size: "xsmall" }, rest), children));
|
|
6
|
+
return (React.createElement(RcIconButton, __assign({ elevation: 0, activeElevation: 0, ref: ref, variant: selected ? 'contained' : 'round', color: selected ? 'interactive.b02' : 'neutral.f06', "data-hidden": hidden, size: "xsmall", focusVariant: "focusRing" }, rest), children));
|
|
7
7
|
});
|
|
8
8
|
PickerBaseIconButton.displayName = 'PickerBaseIconButton';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css, focusVisible, palette2, shadowBorder, } from '../../../../foundation';
|
|
3
|
+
export var RcPickerFocusInsetBorderSizes = {
|
|
4
|
+
small: 1,
|
|
5
|
+
medium: 2,
|
|
6
|
+
};
|
|
7
|
+
export var datePickerCustomFocusRingStyle = function (_a) {
|
|
8
|
+
var size = _a.size, selected = _a.selected, _b = _a.radius, radius = _b === void 0 ? 'circle' : _b;
|
|
9
|
+
var focusInsetBorderSizes = RcPickerFocusInsetBorderSizes[size];
|
|
10
|
+
return (selected && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n ", "\n &:after {\n top: ", "px;\n right: ", "px;\n bottom: ", "px;\n left: ", "px;\n }\n &:before {\n background-color: unset !important;\n }\n }\n "], ["\n ", " {\n ",
|
|
11
|
+
"\n &:after {\n top: ", "px;\n right: ", "px;\n bottom: ", "px;\n left: ", "px;\n }\n &:before {\n background-color: unset !important;\n }\n }\n "])), focusVisible, shadowBorder(radius, palette2('neutral', 'b01'), true, focusInsetBorderSizes), focusInsetBorderSizes, focusInsetBorderSizes, focusInsetBorderSizes, focusInsetBorderSizes));
|
|
12
|
+
};
|
|
13
|
+
var templateObject_1;
|
|
@@ -12,5 +12,9 @@ export var shadowBorder = function (r, color, inset, size) {
|
|
|
12
12
|
if (size === void 0) { size = 1; }
|
|
13
13
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: ", " 0 0 0 ", "px ", ";\n border-radius: ", ";\n pointer-events: none;\n }\n"], ["\n &:after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: ", " 0 0 0 ", "px ", ";\n border-radius: ", ";\n pointer-events: none;\n }\n"])), inset ? 'inset' : '', size, color, radius(r));
|
|
14
14
|
};
|
|
15
|
-
export var focusVisibleShadowStyle = function (r, color
|
|
15
|
+
export var focusVisibleShadowStyle = function (r, color, inset, size) {
|
|
16
|
+
if (inset === void 0) { inset = true; }
|
|
17
|
+
if (size === void 0) { size = 1; }
|
|
18
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", " {\n ", ";\n }\n"], ["\n ", " {\n ", ";\n }\n"])), focusVisible, shadowBorder(r, color, inset, size));
|
|
19
|
+
};
|
|
16
20
|
var templateObject_1, templateObject_2;
|
|
@@ -2,4 +2,4 @@ export declare const focusVisible = "&.focus-visible, &[data-focus-visible-added
|
|
|
2
2
|
export declare const focusWithin = "&:hover, &:focus-within";
|
|
3
3
|
export declare const focusVisibleColor: import("./newPalette").PaletteReturnType;
|
|
4
4
|
export declare const shadowBorder: (r?: "round" | "circle" | "sm" | "md" | "lg" | "xl" | "xxl" | "zero", color?: any, inset?: boolean, size?: number) => import("styled-components").FlattenInterpolation<any>[];
|
|
5
|
-
export declare const focusVisibleShadowStyle: (r?: "round" | "circle" | "sm" | "md" | "lg" | "xl" | "xxl" | "zero" | undefined, color?: any) => import("styled-components").FlattenInterpolation<any>[];
|
|
5
|
+
export declare const focusVisibleShadowStyle: (r?: "round" | "circle" | "sm" | "md" | "lg" | "xl" | "xxl" | "zero" | undefined, color?: any, inset?: boolean, size?: number) => import("styled-components").FlattenInterpolation<any>[];
|
|
@@ -14,5 +14,9 @@ exports.shadowBorder = function (r, color, inset, size) {
|
|
|
14
14
|
if (size === void 0) { size = 1; }
|
|
15
15
|
return styled_components_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &:after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: ", " 0 0 0 ", "px ", ";\n border-radius: ", ";\n pointer-events: none;\n }\n"], ["\n &:after {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n box-shadow: ", " 0 0 0 ", "px ", ";\n border-radius: ", ";\n pointer-events: none;\n }\n"])), inset ? 'inset' : '', size, color, radius_1.radius(r));
|
|
16
16
|
};
|
|
17
|
-
exports.focusVisibleShadowStyle = function (r, color
|
|
17
|
+
exports.focusVisibleShadowStyle = function (r, color, inset, size) {
|
|
18
|
+
if (inset === void 0) { inset = true; }
|
|
19
|
+
if (size === void 0) { size = 1; }
|
|
20
|
+
return styled_components_1.css(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n ", " {\n ", ";\n }\n"], ["\n ", " {\n ", ";\n }\n"])), exports.focusVisible, exports.shadowBorder(r, color, inset, size));
|
|
21
|
+
};
|
|
18
22
|
var templateObject_1, templateObject_2;
|