@ringcentral/juno 2.30.1 → 2.32.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.
Files changed (33) hide show
  1. package/components/Forms/Picker/TimePicker/TimePicker.d.ts +4 -1
  2. package/components/Forms/Picker/TimePicker/TimePicker.js +12 -5
  3. package/components/Forms/Picker/TimePicker/ToggleText.d.ts +16 -1
  4. package/components/Forms/Picker/TimePicker/ToggleText.js +2 -2
  5. package/components/Forms/Picker/TimePicker/types.d.ts +4 -0
  6. package/components/Forms/Picker/TimePicker/types.js +2 -0
  7. package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.d.ts +5 -1
  8. package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +2 -2
  9. package/components/Presence/Presence.js +7 -11
  10. package/components/Presence/styles/StyledDND.d.ts +13 -0
  11. package/components/Presence/styles/StyledDND.js +12 -0
  12. package/components/Presence/styles/StyledPresence.js +3 -3
  13. package/components/Presence/styles/index.d.ts +1 -0
  14. package/components/Presence/styles/index.js +1 -0
  15. package/components/Presence/utils/RcPresenceUtils.d.ts +1 -2
  16. package/components/Presence/utils/RcPresenceUtils.js +4 -16
  17. package/components/VirtualizedMenu/VirtualizedMenu.js +14 -3
  18. package/components/VirtualizedMenu/useNextFrame.d.ts +1 -0
  19. package/components/VirtualizedMenu/useNextFrame.js +22 -0
  20. package/es6/components/Forms/Picker/TimePicker/TimePicker.js +12 -5
  21. package/es6/components/Forms/Picker/TimePicker/ToggleText.js +2 -2
  22. package/es6/components/Forms/Picker/TimePicker/types.js +0 -0
  23. package/es6/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +2 -2
  24. package/es6/components/Presence/Presence.js +9 -13
  25. package/es6/components/Presence/styles/StyledDND.js +10 -0
  26. package/es6/components/Presence/styles/StyledPresence.js +4 -4
  27. package/es6/components/Presence/styles/index.js +1 -0
  28. package/es6/components/Presence/utils/RcPresenceUtils.js +4 -16
  29. package/es6/components/VirtualizedMenu/VirtualizedMenu.js +14 -3
  30. package/es6/components/VirtualizedMenu/useNextFrame.js +20 -0
  31. package/es6/foundation/styles/focusRing.js +2 -2
  32. package/foundation/styles/focusRing.js +2 -2
  33. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { CustomStyledComponentResult, RcBaseProps, RcBaseSize, RcClassesProps }
3
3
  import { PickerTextFieldProps } from '../utils';
4
4
  import { NumberPickerProps } from './NumberPicker';
5
5
  import { ToggleTextProps } from './ToggleText';
6
+ import { PeriodTexts } from './types';
6
7
  declare type RcTimePickerSize = RcBaseSize<'small' | 'medium'>;
7
8
  declare type RcClickFiledStyleProps = {
8
9
  /** Is 12 hours system */
@@ -13,6 +14,7 @@ declare type RcClickFiledStyleProps = {
13
14
  disabled?: boolean;
14
15
  };
15
16
  declare type PickNumberPickerProps = RcBaseProps<Partial<NumberPickerProps>, 'size' | 'onUpdateValue' | 'onClose' | 'onClick' | 'onKeyDown' | 'value' | 'min' | 'max' | 'isTwelveHourSystem' | 'source' | 'step'>;
17
+ declare type RcTimePickerPeriodTexts = Record<'input' | 'toggle', PeriodTexts>;
16
18
  declare type RcTimePickerProps<T = false> = {
17
19
  /** with two size: 'small' | 'medium', default with medium. */
18
20
  size?: RcTimePickerSize;
@@ -34,6 +36,7 @@ declare type RcTimePickerProps<T = false> = {
34
36
  MinutePickerProps?: PickNumberPickerProps;
35
37
  /** props for periodToggle component */
36
38
  PeriodToggleProps?: RcBaseProps<Partial<ToggleTextProps>, 'disabled' | 'isTwelveHourSystem' | 'size' | 'value' | 'onUpdateValue' | 'children'>;
39
+ periodTexts?: RcTimePickerPeriodTexts;
37
40
  /** picker will show default value when textfield is empty */
38
41
  defaultPickerValue?: T extends true ? Date : number;
39
42
  } & RcBaseProps<PickerTextFieldProps, 'onClick' | 'value' | 'children'> & RcClassesProps<'popover' | 'popoverPaper'>;
@@ -43,4 +46,4 @@ declare type RcTimePickerProps<T = false> = {
43
46
  */
44
47
  declare const ExportType: <T extends boolean = false>(props: RcTimePickerProps<T>) => JSX.Element & CustomStyledComponentResult<RcTimePickerProps<T>>;
45
48
  export { ExportType as RcTimePicker };
46
- export type { RcClickFiledStyleProps, RcTimePickerProps, RcTimePickerSize };
49
+ export type { RcClickFiledStyleProps, RcTimePickerProps, RcTimePickerSize, RcTimePickerPeriodTexts, };
@@ -13,22 +13,26 @@ var SelectionView_1 = require("./SelectionView");
13
13
  var styles_1 = require("./styles");
14
14
  var ToggleText_1 = require("./ToggleText");
15
15
  var utils_2 = require("./utils");
16
+ var defaultPeriodTexts = {
17
+ input: { AM: 'AM', PM: 'PM' },
18
+ toggle: { AM: 'AM', PM: 'PM' },
19
+ };
16
20
  var _RcTimePicker = react_1.forwardRef(function (inProps, ref) {
17
21
  var props = foundation_1.useThemeProps({ props: inProps, name: 'RcTimePicker' });
18
- var isTwelveHourSystem = props.isTwelveHourSystem, value = props.value, onChange = props.onChange, disabled = props.disabled, dateMode = props.dateMode, min = props.min, max = props.max, size = props.size, onKeyDown = props.onKeyDown, onClear = props.onClear, HourPickerProps = props.HourPickerProps, MinutePickerProps = props.MinutePickerProps, PeriodToggleProps = props.PeriodToggleProps, PopoverPropsProp = props.PopoverProps, InputPropsProp = props.InputProps, classes = props.classes, defaultPickerValue = props.defaultPickerValue, rest = tslib_1.__rest(props, ["isTwelveHourSystem", "value", "onChange", "disabled", "dateMode", "min", "max", "size", "onKeyDown", "onClear", "HourPickerProps", "MinutePickerProps", "PeriodToggleProps", "PopoverProps", "InputProps", "classes", "defaultPickerValue"]);
22
+ var isTwelveHourSystem = props.isTwelveHourSystem, value = props.value, onChange = props.onChange, disabled = props.disabled, dateMode = props.dateMode, min = props.min, max = props.max, size = props.size, onKeyDown = props.onKeyDown, onClear = props.onClear, HourPickerProps = props.HourPickerProps, MinutePickerProps = props.MinutePickerProps, PeriodToggleProps = props.PeriodToggleProps, PopoverPropsProp = props.PopoverProps, InputPropsProp = props.InputProps, classes = props.classes, defaultPickerValue = props.defaultPickerValue, _a = props.periodTexts, periodTexts = _a === void 0 ? defaultPeriodTexts : _a, rest = tslib_1.__rest(props, ["isTwelveHourSystem", "value", "onChange", "disabled", "dateMode", "min", "max", "size", "onKeyDown", "onClear", "HourPickerProps", "MinutePickerProps", "PeriodToggleProps", "PopoverProps", "InputProps", "classes", "defaultPickerValue", "periodTexts"]);
19
23
  var actionRef = react_1.useRef(null);
20
24
  var hourRef = react_1.useRef(null);
21
25
  var minuteRef = react_1.useRef(null);
22
26
  var periodRef = react_1.useRef(null);
23
27
  var textFiledValueRef = react_1.useRef('');
24
- var _a = tslib_1.__read(react_1.useState('none'), 2), selectionShowType = _a[0], setSelectionType = _a[1];
25
- var _b = (function () {
28
+ var _b = tslib_1.__read(react_1.useState('none'), 2), selectionShowType = _b[0], setSelectionType = _b[1];
29
+ var _c = (function () {
26
30
  if (value !== null)
27
31
  return { nowTime: value, isShowTextfieldValue: true };
28
32
  if (defaultPickerValue)
29
33
  return { nowTime: defaultPickerValue, isShowTextfieldValue: false };
30
34
  return { nowTime: null, isShowTextfieldValue: false };
31
- })(), nowTime = _b.nowTime, isShowTextfieldValue = _b.isShowTextfieldValue;
35
+ })(), nowTime = _c.nowTime, isShowTextfieldValue = _c.isShowTextfieldValue;
32
36
  var isHaveValue = nowTime !== null;
33
37
  var isDateMode = nowTime instanceof Date || dateMode;
34
38
  var currentTimestamp = utils_2.getTimestamp(nowTime);
@@ -195,6 +199,7 @@ var _RcTimePicker = react_1.forwardRef(function (inProps, ref) {
195
199
  hour: hour,
196
200
  minute: minute,
197
201
  period: currentPeriod,
202
+ periodTexts: periodTexts.input,
198
203
  }, isTwelveHourSystem);
199
204
  textFiledValueRef.current = formattedTime;
200
205
  }, [
@@ -203,6 +208,8 @@ var _RcTimePicker = react_1.forwardRef(function (inProps, ref) {
203
208
  currentTimestamp,
204
209
  isTwelveHourSystem,
205
210
  currentPeriod,
211
+ periodTexts.input.AM,
212
+ periodTexts.input.PM,
206
213
  ]);
207
214
  // * when no value, open menu use min as value
208
215
  var originalHourValue = isHaveValue
@@ -244,7 +251,7 @@ var _RcTimePicker = react_1.forwardRef(function (inProps, ref) {
244
251
  react_1.default.createElement(Box_1.RcBox, { textAlign: "center", width: "48px" }, ":"),
245
252
  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
253
  isTwelveHourSystem && (react_1.default.createElement("div", null,
247
- react_1.default.createElement(ToggleText_1.ToggleText, tslib_1.__assign({ ref: periodRef, size: size, disabled: toggleTextDisabled, onUpdateValue: onTogglePeriod, onInnerChange: handlePeriodInnerChange, onClose: closeMenu, value: periodValue }, PeriodToggleProps)))))) : (react_1.default.createElement(SelectionView_1.SelectionView, tslib_1.__assign({ size: size }, (isHourView ? boundary.hour : boundary.minute), { source: isHourView
254
+ react_1.default.createElement(ToggleText_1.ToggleText, tslib_1.__assign({ periodTexts: periodTexts.toggle, ref: periodRef, size: size, disabled: toggleTextDisabled, onUpdateValue: onTogglePeriod, onInnerChange: handlePeriodInnerChange, onClose: closeMenu, value: periodValue }, PeriodToggleProps)))))) : (react_1.default.createElement(SelectionView_1.SelectionView, tslib_1.__assign({ size: size }, (isHourView ? boundary.hour : boundary.minute), { source: isHourView
248
255
  ? isTwelveHourSystem
249
256
  ? utils_2.twelveHourSystemSource
250
257
  : utils_2.twentyFourHourSystemSource
@@ -12,6 +12,11 @@ declare type ToggleTextProps = {
12
12
  getScreenReaderLabel?: (value: string) => string;
13
13
  /** trigger when confirm value */
14
14
  onClose: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
15
+ /** custom text for 'AM' and 'PM' */
16
+ periodTexts: {
17
+ AM: string;
18
+ PM: string;
19
+ };
15
20
  } & RcClickFiledStyleProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'value'>;
16
21
  declare type ToggleTextRef = {
17
22
  value: TIME_SYSTEM_TEXT;
@@ -27,6 +32,11 @@ declare const ToggleText: import("styled-components").StyledComponentClass<{
27
32
  getScreenReaderLabel?: ((value: string) => string) | undefined;
28
33
  /** trigger when confirm value */
29
34
  onClose: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
35
+ /** custom text for 'AM' and 'PM' */
36
+ periodTexts: {
37
+ AM: string;
38
+ PM: string;
39
+ };
30
40
  } & RcClickFiledStyleProps & Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "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" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<ToggleTextRef>, import("../../../../foundation").RcTheme, Pick<{
31
41
  /** when user click th display text to change */
32
42
  onUpdateValue: (value: TIME_SYSTEM_TEXT) => void;
@@ -38,7 +48,12 @@ declare const ToggleText: import("styled-components").StyledComponentClass<{
38
48
  getScreenReaderLabel?: ((value: string) => string) | undefined;
39
49
  /** trigger when confirm value */
40
50
  onClose: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
41
- } & RcClickFiledStyleProps & Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "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" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<ToggleTextRef>, "ref" | "key" | "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "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" | "size" | "value" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "onClose" | "onUpdateValue" | "isTwelveHourSystem" | "onInnerChange" | "getScreenReaderLabel"> & {
51
+ /** custom text for 'AM' and 'PM' */
52
+ periodTexts: {
53
+ AM: string;
54
+ PM: string;
55
+ };
56
+ } & RcClickFiledStyleProps & Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "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" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & React.RefAttributes<ToggleTextRef>, "ref" | "key" | "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "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" | "size" | "value" | "disabled" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "onClose" | "onUpdateValue" | "isTwelveHourSystem" | "onInnerChange" | "getScreenReaderLabel" | "periodTexts"> & {
42
57
  theme?: import("../../../../foundation").RcTheme | undefined;
43
58
  }>;
44
59
  export { ToggleText };
@@ -9,7 +9,7 @@ var styles_1 = require("./styles");
9
9
  var utils_1 = require("./utils");
10
10
  var A11yUtils_1 = require("./utils/A11yUtils");
11
11
  var _ToggleText = react_1.memo(react_1.forwardRef(function (_a, ref) {
12
- var onUpdateValue = _a.onUpdateValue, onInnerChange = _a.onInnerChange, value = _a.value, size = _a.size, disabled = _a.disabled, getScreenReaderLabel = _a.getScreenReaderLabel, onClose = _a.onClose, rest = tslib_1.__rest(_a, ["onUpdateValue", "onInnerChange", "value", "size", "disabled", "getScreenReaderLabel", "onClose"]);
12
+ var onUpdateValue = _a.onUpdateValue, onInnerChange = _a.onInnerChange, value = _a.value, size = _a.size, disabled = _a.disabled, getScreenReaderLabel = _a.getScreenReaderLabel, onClose = _a.onClose, periodTexts = _a.periodTexts, rest = tslib_1.__rest(_a, ["onUpdateValue", "onInnerChange", "value", "size", "disabled", "getScreenReaderLabel", "onClose", "periodTexts"]);
13
13
  var _b = tslib_1.__read(foundation_1.useRefState(value), 2), innerValueRef = _b[0], setInnerValue = _b[1];
14
14
  foundation_1.useChange(function () {
15
15
  if (innerValueRef.current !== value) {
@@ -50,7 +50,7 @@ var _ToggleText = react_1.memo(react_1.forwardRef(function (_a, ref) {
50
50
  value: innerValue,
51
51
  }); }, [innerValue]);
52
52
  return (react_1.default.createElement(styles_1.StyledTimeIconButton, tslib_1.__assign({ wrapperSize: size, onClick: handleClick, onKeyDown: handleToggleKeyDown, disabled: disabled, color: "informative.f02", "aria-live": "assertive", "aria-label": label }, rest),
53
- react_1.default.createElement(react_1.default.Fragment, null, innerValue)));
53
+ react_1.default.createElement(react_1.default.Fragment, null, periodTexts[innerValue])));
54
54
  }));
55
55
  var ToggleText = foundation_1.styled(_ToggleText)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n margin-left: ", ";\n"], ["\n margin-left: ", ";\n"])), function (_a) {
56
56
  var size = _a.size;
@@ -0,0 +1,4 @@
1
+ export declare type PeriodTexts = {
2
+ AM: string;
3
+ PM: string;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,10 @@ declare type GetFormattedTimeOption = {
7
7
  hour: number;
8
8
  minute: number;
9
9
  period: TIME_SYSTEM_TEXT;
10
+ periodTexts: {
11
+ AM: string;
12
+ PM: string;
13
+ };
10
14
  };
11
15
  /**
12
16
  * get formatted time hh:mm
@@ -14,7 +18,7 @@ declare type GetFormattedTimeOption = {
14
18
  * @param isTwelveHourSystem boolean
15
19
  * @returns `hh:mm AM` or `hh:mm PM` or `hh:mm`
16
20
  */
17
- declare const getFormattedTime: ({ hour, minute, period }: GetFormattedTimeOption, isTwelveHourSystem?: boolean | undefined) => string;
21
+ declare const getFormattedTime: ({ hour, minute, period, periodTexts }: GetFormattedTimeOption, isTwelveHourSystem?: boolean | undefined) => string;
18
22
  declare const HALF_DAY_HOURS = 12;
19
23
  declare const HOUR_MINUTES = 60;
20
24
  declare const TIME_GAP = 15;
@@ -30,10 +30,10 @@ exports.pad = pad;
30
30
  * @returns `hh:mm AM` or `hh:mm PM` or `hh:mm`
31
31
  */
32
32
  var getFormattedTime = function (_a, isTwelveHourSystem) {
33
- var hour = _a.hour, minute = _a.minute, period = _a.period;
33
+ var hour = _a.hour, minute = _a.minute, period = _a.period, periodTexts = _a.periodTexts;
34
34
  var formattedHour = parseNumberToString(hour, isTwelveHourSystem);
35
35
  var formattedMinute = parseNumberToString(minute);
36
- var periodText = isTwelveHourSystem ? " " + period : '';
36
+ var periodText = isTwelveHourSystem ? " " + periodTexts[period] : '';
37
37
  return formattedHour + ":" + formattedMinute + periodText;
38
38
  };
39
39
  exports.getFormattedTime = getFormattedTime;
@@ -6,26 +6,22 @@ var foundation_1 = require("../../foundation");
6
6
  var Icon_1 = require("../Icon");
7
7
  var assets_1 = require("./assets");
8
8
  var styles_1 = require("./styles");
9
- var juno_icon_1 = require("@ringcentral/juno-icon");
10
9
  var _RcPresence = react_1.forwardRef(function (inProps, ref) {
11
10
  var props = foundation_1.useThemeProps({ props: inProps, name: 'RcPresence' });
12
- var type = props.type;
13
- var symbol = (function () {
11
+ var type = props.type, size = props.size;
12
+ var innerChildren = react_1.useMemo(function () {
14
13
  switch (type) {
15
14
  case 'DND':
16
- return juno_icon_1.PresenceDnd;
17
- case 'available':
18
- return juno_icon_1.PresenceAvailable;
15
+ return react_1.default.createElement(styles_1.StyledDND, { size: size });
19
16
  case 'attended':
20
- return assets_1.Attended;
17
+ return react_1.default.createElement(Icon_1.RcIcon, { symbol: assets_1.Attended, color: "neutral.f01", size: "inherit" });
21
18
  case 'unAttended':
22
- return assets_1.Unattended;
19
+ return (react_1.default.createElement(Icon_1.RcIcon, { symbol: assets_1.Unattended, color: "neutral.f01", size: "inherit" }));
23
20
  default:
24
21
  return null;
25
22
  }
26
- })();
27
- var symbolElm = symbol ? (react_1.default.createElement(Icon_1.RcIcon, { symbol: symbol, color: "neutral.f01", size: "inherit" })) : null;
28
- return (react_1.default.createElement(styles_1.StyledPresence, tslib_1.__assign({ ref: ref }, props), symbolElm));
23
+ }, [size, type]);
24
+ return (react_1.default.createElement(styles_1.StyledPresence, tslib_1.__assign({ ref: ref }, props), innerChildren));
29
25
  });
30
26
  /** @release */
31
27
  var RcPresence = foundation_1.styled(_RcPresence)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject([""], [""])));
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="styled-jsx" />
3
+ export declare const StyledDND: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
4
+ type?: "notReady" | "unavailable" | "available" | "onCall" | "DND" | "inMeeting" | "busy" | "offline" | "attended" | "unAttended" | undefined;
5
+ size?: "small" | "xxsmall" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
6
+ borderSize?: "small" | "xxsmall" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
7
+ color?: (string & Record<never, never>) | "action.grayDark" | "action.grayLight" | "action.primary" | "avatar.ash" | "avatar.blueberry" | "avatar.brass" | "avatar.global" | "avatar.gold" | "avatar.lake" | "avatar.oasis" | "avatar.pear" | "avatar.persimmon" | "avatar.sage" | "avatar.tomato" | "content.brand" | "danger.b01" | "danger.b02" | "danger.b03" | "danger.b04" | "danger.f01" | "danger.f02" | "danger.f11" | "dialHeader.avatarBg" | "dialHeader.avatarIcon" | "dialHeader.bg" | "dialHeader.focusBorder" | "dialHeader.icon" | "dialHeader.text" | "dialHeader.textHint" | "disabled.b01" | "disabled.f01" | "disabled.f02" | "header.bgLeft" | "header.bgOverlay" | "header.bgOverlayDisabled" | "header.bgRight" | "header.border" | "header.divider" | "header.fabBg" | "header.fabIcon" | "header.focusBorder" | "header.icon" | "header.iconDisabled" | "header.text" | "header.textHint" | "highContrast" | "highlight.b01" | "highlight.b02" | "highlight.b03" | "highlight.f01" | "highlight.f02" | "informative.b01" | "informative.f01" | "informative.f02" | "interactive.b01" | "interactive.b02" | "interactive.f01" | "label.black02" | "label.blue01" | "label.blue02" | "label.green01" | "label.green02" | "label.orange01" | "label.orange02" | "label.purple01" | "label.purple02" | "label.red01" | "label.red02" | "label.teal01" | "label.teal02" | "label.yellow01" | "label.yellow02" | "nav.b01" | "nav.b02" | "nav.bookmark" | "nav.ctlDefault" | "nav.ctlSelected" | "nav.f01" | "nav.f02" | "nav.f03" | "nav.f04" | "nav.iconDefault" | "nav.iconSelected" | "nav.line" | "nav.mention" | "nav.menuBg" | "nav.menuText" | "neutral.b01" | "neutral.b02" | "neutral.b03" | "neutral.b04" | "neutral.b05" | "neutral.b06" | "neutral.elevation" | "neutral.f01" | "neutral.f02" | "neutral.f03" | "neutral.f04" | "neutral.f05" | "neutral.f06" | "neutral.f07" | "neutral.f11" | "neutral.l01" | "neutral.l02" | "neutral.l03" | "neutral.l04" | "neutral.transparent" | "presence.available" | "presence.busy" | "presence.invisible" | "subAction" | "success.b01" | "success.b02" | "success.b03" | "success.b04" | "success.b05" | "success.f01" | "success.f02" | "success.f11" | "tab.default" | "tab.selected" | "umi.bg" | "umi.mentioned" | "umi.text" | "warning.b01" | "warning.b02" | "warning.b03" | "warning.f01" | "warning.f02" | "warning.f11" | string[] | import("../../../foundation/styles/newPalette").PaletteReturnType | undefined;
8
+ } & Pick<import("react").HTMLAttributes<HTMLDivElement>, "className" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "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">, import("../../../foundation").RcTheme, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
9
+ type?: "notReady" | "unavailable" | "available" | "onCall" | "DND" | "inMeeting" | "busy" | "offline" | "attended" | "unAttended" | undefined;
10
+ size?: "small" | "xxsmall" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
11
+ borderSize?: "small" | "xxsmall" | "xsmall" | "medium" | "large" | "xlarge" | undefined;
12
+ color?: (string & Record<never, never>) | "action.grayDark" | "action.grayLight" | "action.primary" | "avatar.ash" | "avatar.blueberry" | "avatar.brass" | "avatar.global" | "avatar.gold" | "avatar.lake" | "avatar.oasis" | "avatar.pear" | "avatar.persimmon" | "avatar.sage" | "avatar.tomato" | "content.brand" | "danger.b01" | "danger.b02" | "danger.b03" | "danger.b04" | "danger.f01" | "danger.f02" | "danger.f11" | "dialHeader.avatarBg" | "dialHeader.avatarIcon" | "dialHeader.bg" | "dialHeader.focusBorder" | "dialHeader.icon" | "dialHeader.text" | "dialHeader.textHint" | "disabled.b01" | "disabled.f01" | "disabled.f02" | "header.bgLeft" | "header.bgOverlay" | "header.bgOverlayDisabled" | "header.bgRight" | "header.border" | "header.divider" | "header.fabBg" | "header.fabIcon" | "header.focusBorder" | "header.icon" | "header.iconDisabled" | "header.text" | "header.textHint" | "highContrast" | "highlight.b01" | "highlight.b02" | "highlight.b03" | "highlight.f01" | "highlight.f02" | "informative.b01" | "informative.f01" | "informative.f02" | "interactive.b01" | "interactive.b02" | "interactive.f01" | "label.black02" | "label.blue01" | "label.blue02" | "label.green01" | "label.green02" | "label.orange01" | "label.orange02" | "label.purple01" | "label.purple02" | "label.red01" | "label.red02" | "label.teal01" | "label.teal02" | "label.yellow01" | "label.yellow02" | "nav.b01" | "nav.b02" | "nav.bookmark" | "nav.ctlDefault" | "nav.ctlSelected" | "nav.f01" | "nav.f02" | "nav.f03" | "nav.f04" | "nav.iconDefault" | "nav.iconSelected" | "nav.line" | "nav.mention" | "nav.menuBg" | "nav.menuText" | "neutral.b01" | "neutral.b02" | "neutral.b03" | "neutral.b04" | "neutral.b05" | "neutral.b06" | "neutral.elevation" | "neutral.f01" | "neutral.f02" | "neutral.f03" | "neutral.f04" | "neutral.f05" | "neutral.f06" | "neutral.f07" | "neutral.f11" | "neutral.l01" | "neutral.l02" | "neutral.l03" | "neutral.l04" | "neutral.transparent" | "presence.available" | "presence.busy" | "presence.invisible" | "subAction" | "success.b01" | "success.b02" | "success.b03" | "success.b04" | "success.b05" | "success.f01" | "success.f02" | "success.f11" | "tab.default" | "tab.selected" | "umi.bg" | "umi.mentioned" | "umi.text" | "warning.b01" | "warning.b02" | "warning.b03" | "warning.f01" | "warning.f02" | "warning.f11" | string[] | import("../../../foundation/styles/newPalette").PaletteReturnType | undefined;
13
+ } & Pick<import("react").HTMLAttributes<HTMLDivElement>, "className" | "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" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "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">>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var foundation_1 = require("../../../foundation");
5
+ var utils_1 = require("../utils");
6
+ exports.StyledDND = foundation_1.styled.div(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n ", ";\n background: ", ";\n"], ["\n ",
7
+ ";\n background: ", ";\n"])), function (_a) {
8
+ var size = _a.size;
9
+ var value = utils_1.RcPresenceInnerIconSizes[size];
10
+ return foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n "], ["\n width: ", "px;\n height: ", "px;\n "])), value[0], value[1]);
11
+ }, foundation_1.palette2('neutral', 'f01'));
12
+ var templateObject_1, templateObject_2;
@@ -13,9 +13,9 @@ exports.StyledPresence = foundation_1.styled(exports._StyledPresence)(templateOb
13
13
  ";\n"])), function (_a) {
14
14
  var size = _a.size, borderSize = _a.borderSize, type = _a.type, color = _a.color;
15
15
  var sizeValue = foundation_1.px(utils_1.RcPresenceSizes[size][0]);
16
- var initSizeMap = utils_1.RcPresenceIconSizes[size];
17
- var iconSizeValue = foundation_1.px(initSizeMap[0]);
18
- var scaleRate = initSizeMap[1];
16
+ var availableSize = utils_1.RcPresenceAvailableIconSizes[size];
17
+ var iconSizeValue = foundation_1.px(availableSize[0]);
18
+ var scaleRate = availableSize[1];
19
19
  return foundation_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ", ";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "], ["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ",
20
20
  ";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "])), sizeValue, sizeValue, utils_1.RcPresenceSizes[borderSize || size][1], foundation_1.palette2('neutral', 'l01'), color
21
21
  ? foundation_1.getParsePaletteColor(color)
@@ -1 +1,2 @@
1
+ export * from './StyledDND';
1
2
  export * from './StyledPresence';
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./StyledDND"), exports);
4
5
  tslib_1.__exportStar(require("./StyledPresence"), exports);
@@ -2,6 +2,5 @@ import { UnitMap } from '../../../foundation';
2
2
  import { RcPresenceSize, RcPresenceType } from '../Presence';
3
3
  export declare const RcPresenceSizes: UnitMap<RcPresenceSize, [number, number]>;
4
4
  export declare const RcPresenceInnerIconSizes: UnitMap<RcPresenceSize, [number, number]>;
5
- export declare const RcPresenceIconSizes: UnitMap<RcPresenceSize, [number, number | undefined]>;
6
- export declare const UnAvailableIconType: UnitMap<RcPresenceType, boolean>;
5
+ export declare const RcPresenceAvailableIconSizes: UnitMap<RcPresenceSize, [number, number | undefined]>;
7
6
  export declare const RcPresenceColors: UnitMap<RcPresenceType>;
@@ -6,9 +6,9 @@ exports.RcPresenceSizes = {
6
6
  xxsmall: [8, 1],
7
7
  xsmall: [8, 2],
8
8
  small: [10, 2],
9
- medium: [10, 2],
10
- large: [14, 2],
11
- xlarge: [18, 2],
9
+ medium: [10, 3],
10
+ large: [14, 3],
11
+ xlarge: [18, 3],
12
12
  };
13
13
  // width, height
14
14
  exports.RcPresenceInnerIconSizes = {
@@ -21,7 +21,7 @@ exports.RcPresenceInnerIconSizes = {
21
21
  };
22
22
  // use scale rate to make that be odd value
23
23
  // width, scaleRate
24
- exports.RcPresenceIconSizes = {
24
+ exports.RcPresenceAvailableIconSizes = {
25
25
  xxsmall: [10, 0.5],
26
26
  xsmall: [10, 0.5],
27
27
  small: [6, undefined],
@@ -29,18 +29,6 @@ exports.RcPresenceIconSizes = {
29
29
  large: [10, undefined],
30
30
  xlarge: [12, undefined],
31
31
  };
32
- exports.UnAvailableIconType = {
33
- notReady: true,
34
- unavailable: true,
35
- offline: true,
36
- available: false,
37
- onCall: false,
38
- DND: false,
39
- inMeeting: false,
40
- busy: false,
41
- attended: false,
42
- unAttended: false,
43
- };
44
32
  var presenceOn = foundation_1.palette2('presence', 'available');
45
33
  var presenceBusy = foundation_1.palette2('presence', 'busy');
46
34
  var presenceOff = foundation_1.palette2('presence', 'invisible');
@@ -9,12 +9,15 @@ var Transitions_1 = require("../Transitions");
9
9
  var styles_1 = require("./styles");
10
10
  var utils_1 = require("./utils");
11
11
  var VirtualizedMenuList_1 = require("./VirtualizedMenuList");
12
+ var useNextFrame_1 = require("./useNextFrame");
12
13
  var _RcVirtualizedMenu = react_1.forwardRef(function (inProps, ref) {
13
14
  var props = foundation_1.useThemeProps({ props: inProps, name: 'RcVirtualizedMenu' });
14
- var _a = props.autoFocus, autoFocus = _a === void 0 ? true : _a, children = props.children, classesProp = props.classes, _b = props.disableAutoFocusItem, disableAutoFocusItem = _b === void 0 ? false : _b, _c = props.MenuListProps, _d = _c === void 0 ? {} : _c, _e = _d.maxHeight, maxHeight = _e === void 0 ? 416 : _e, onKeyDown = _d.onKeyDown, MenuListProps = tslib_1.__rest(_d, ["maxHeight", "onKeyDown"]), onClose = props.onClose, open = props.open, TransitionPropsProp = props.TransitionProps, _f = props.PaperProps, PaperPropsProp = _f === void 0 ? {} : _f, PopoverClasses = props.PopoverClasses, _g = props.transitionDuration, transitionDuration = _g === void 0 ? 'auto' : _g, _h = props.variant, variant = _h === void 0 ? 'selectedMenu' : _h, rest = tslib_1.__rest(props, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "TransitionProps", "PaperProps", "PopoverClasses", "transitionDuration", "variant"]);
15
+ var _a = props.autoFocus, autoFocus = _a === void 0 ? true : _a, children = props.children, classesProp = props.classes, _b = props.disableAutoFocusItem, disableAutoFocusItem = _b === void 0 ? false : _b, _c = props.MenuListProps, _d = _c === void 0 ? {} : _c, _e = _d.maxHeight, maxHeight = _e === void 0 ? 416 : _e, onKeyDown = _d.onKeyDown, VirtuosoProps = _d.VirtuosoProps, MenuListProps = tslib_1.__rest(_d, ["maxHeight", "onKeyDown", "VirtuosoProps"]), onClose = props.onClose, open = props.open, TransitionPropsProp = props.TransitionProps, _f = props.PaperProps, PaperPropsProp = _f === void 0 ? {} : _f, PopoverClasses = props.PopoverClasses, _g = props.transitionDuration, transitionDuration = _g === void 0 ? 'auto' : _g, _h = props.variant, variant = _h === void 0 ? 'selectedMenu' : _h, _j = props.action, popoverActionProp = _j === void 0 ? null : _j, rest = tslib_1.__rest(props, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "TransitionProps", "PaperProps", "PopoverClasses", "transitionDuration", "variant", "action"]);
15
16
  var document = foundation_1.useRcPortalWindowContext().document;
16
17
  var popoverRef = react_1.useRef(null);
17
18
  var handleRef = foundation_1.useForkRef(ref, popoverRef);
19
+ var popoverAction = react_1.useRef(null);
20
+ var handlePopoverAction = foundation_1.useForkRef(popoverAction, popoverActionProp);
18
21
  var menuListActionRef = react_1.useRef(null);
19
22
  var classes = react_1.useMemo(function () { return foundation_1.combineClasses(utils_1.RcVirtualizedMenuClasses, classesProp); }, [classesProp]);
20
23
  var autoFocusItem = autoFocus && !disableAutoFocusItem && open;
@@ -51,10 +54,18 @@ var _RcVirtualizedMenu = react_1.forwardRef(function (inProps, ref) {
51
54
  }
52
55
  }
53
56
  });
54
- return (react_1.default.createElement(Popover_1.RcPopover, tslib_1.__assign({ ref: handleRef, container: document.body, classes: PopoverClasses, onClose: onClose, open: open,
57
+ var runInNextFrame = useNextFrame_1.useNextFrame();
58
+ return (react_1.default.createElement(Popover_1.RcPopover, tslib_1.__assign({ ref: handleRef, action: handlePopoverAction, container: document.body, classes: PopoverClasses, onClose: onClose, open: open,
55
59
  // FIXME: workaround for virtualized menu height incorrect issue
56
60
  TransitionComponent: Transitions_1.RcFade, transitionDuration: transitionDuration, PaperProps: PaperProps, TransitionProps: TransitionProps }, rest),
57
- react_1.default.createElement(VirtualizedMenuList_1.RcVirtualizedMenuList, tslib_1.__assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown }, MenuListProps, { className: clsx_1.default(classes.list, MenuListProps.className) }), children)));
61
+ react_1.default.createElement(VirtualizedMenuList_1.RcVirtualizedMenuList, tslib_1.__assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown, VirtuosoProps: tslib_1.__assign(tslib_1.__assign({}, VirtuosoProps), { totalListHeightChanged: function (height) {
62
+ var _a;
63
+ (_a = VirtuosoProps === null || VirtuosoProps === void 0 ? void 0 : VirtuosoProps.totalListHeightChanged) === null || _a === void 0 ? void 0 : _a.call(VirtuosoProps, height);
64
+ runInNextFrame(function () {
65
+ var _a;
66
+ (_a = popoverAction.current) === null || _a === void 0 ? void 0 : _a.updatePosition();
67
+ });
68
+ } }) }, MenuListProps, { className: clsx_1.default(classes.list, MenuListProps.className) }), children)));
58
69
  });
59
70
  var RcVirtualizedMenu = foundation_1.styled(_RcVirtualizedMenu)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), styles_1.VirtualizedMenuStyle);
60
71
  exports.RcVirtualizedMenu = RcVirtualizedMenu;
@@ -0,0 +1 @@
1
+ export declare const useNextFrame: () => (task: Function) => void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ exports.useNextFrame = function () {
5
+ var rafIdRef = react_1.useRef(null);
6
+ react_1.useLayoutEffect(function () {
7
+ if (rafIdRef.current !== null) {
8
+ cancelAnimationFrame(rafIdRef.current);
9
+ }
10
+ }, []);
11
+ return function (task) {
12
+ if (rafIdRef.current !== null) {
13
+ cancelAnimationFrame(rafIdRef.current);
14
+ }
15
+ rafIdRef.current = requestAnimationFrame(function () {
16
+ rafIdRef.current = requestAnimationFrame(function () {
17
+ rafIdRef.current = null;
18
+ task();
19
+ });
20
+ });
21
+ };
22
+ };
@@ -11,22 +11,26 @@ import { SelectionView } from './SelectionView';
11
11
  import { StyledPickerPopperWrap } from './styles';
12
12
  import { ToggleText } from './ToggleText';
13
13
  import { getFormattedTime, getHourAndMinute, getNumberPickerBoundary, getPeriod, getRangeBoundary, getRecoupHour, getTimestamp, getTimestampFromDate, HALF_DAY_HOURS, minuteSource, parseNumberToString, RcTimePickerClasses, TIME_GAP, twelveHourSystemSource, twentyFourHourSystemSource, } from './utils';
14
+ var defaultPeriodTexts = {
15
+ input: { AM: 'AM', PM: 'PM' },
16
+ toggle: { AM: 'AM', PM: 'PM' },
17
+ };
14
18
  var _RcTimePicker = forwardRef(function (inProps, ref) {
15
19
  var props = useThemeProps({ props: inProps, name: 'RcTimePicker' });
16
- var isTwelveHourSystem = props.isTwelveHourSystem, value = props.value, onChange = props.onChange, disabled = props.disabled, dateMode = props.dateMode, min = props.min, max = props.max, size = props.size, onKeyDown = props.onKeyDown, onClear = props.onClear, HourPickerProps = props.HourPickerProps, MinutePickerProps = props.MinutePickerProps, PeriodToggleProps = props.PeriodToggleProps, PopoverPropsProp = props.PopoverProps, InputPropsProp = props.InputProps, classes = props.classes, defaultPickerValue = props.defaultPickerValue, rest = __rest(props, ["isTwelveHourSystem", "value", "onChange", "disabled", "dateMode", "min", "max", "size", "onKeyDown", "onClear", "HourPickerProps", "MinutePickerProps", "PeriodToggleProps", "PopoverProps", "InputProps", "classes", "defaultPickerValue"]);
20
+ var isTwelveHourSystem = props.isTwelveHourSystem, value = props.value, onChange = props.onChange, disabled = props.disabled, dateMode = props.dateMode, min = props.min, max = props.max, size = props.size, onKeyDown = props.onKeyDown, onClear = props.onClear, HourPickerProps = props.HourPickerProps, MinutePickerProps = props.MinutePickerProps, PeriodToggleProps = props.PeriodToggleProps, PopoverPropsProp = props.PopoverProps, InputPropsProp = props.InputProps, classes = props.classes, defaultPickerValue = props.defaultPickerValue, _a = props.periodTexts, periodTexts = _a === void 0 ? defaultPeriodTexts : _a, rest = __rest(props, ["isTwelveHourSystem", "value", "onChange", "disabled", "dateMode", "min", "max", "size", "onKeyDown", "onClear", "HourPickerProps", "MinutePickerProps", "PeriodToggleProps", "PopoverProps", "InputProps", "classes", "defaultPickerValue", "periodTexts"]);
17
21
  var actionRef = useRef(null);
18
22
  var hourRef = useRef(null);
19
23
  var minuteRef = useRef(null);
20
24
  var periodRef = useRef(null);
21
25
  var textFiledValueRef = useRef('');
22
- var _a = __read(useState('none'), 2), selectionShowType = _a[0], setSelectionType = _a[1];
23
- var _b = (function () {
26
+ var _b = __read(useState('none'), 2), selectionShowType = _b[0], setSelectionType = _b[1];
27
+ var _c = (function () {
24
28
  if (value !== null)
25
29
  return { nowTime: value, isShowTextfieldValue: true };
26
30
  if (defaultPickerValue)
27
31
  return { nowTime: defaultPickerValue, isShowTextfieldValue: false };
28
32
  return { nowTime: null, isShowTextfieldValue: false };
29
- })(), nowTime = _b.nowTime, isShowTextfieldValue = _b.isShowTextfieldValue;
33
+ })(), nowTime = _c.nowTime, isShowTextfieldValue = _c.isShowTextfieldValue;
30
34
  var isHaveValue = nowTime !== null;
31
35
  var isDateMode = nowTime instanceof Date || dateMode;
32
36
  var currentTimestamp = getTimestamp(nowTime);
@@ -193,6 +197,7 @@ var _RcTimePicker = forwardRef(function (inProps, ref) {
193
197
  hour: hour,
194
198
  minute: minute,
195
199
  period: currentPeriod,
200
+ periodTexts: periodTexts.input,
196
201
  }, isTwelveHourSystem);
197
202
  textFiledValueRef.current = formattedTime;
198
203
  }, [
@@ -201,6 +206,8 @@ var _RcTimePicker = forwardRef(function (inProps, ref) {
201
206
  currentTimestamp,
202
207
  isTwelveHourSystem,
203
208
  currentPeriod,
209
+ periodTexts.input.AM,
210
+ periodTexts.input.PM,
204
211
  ]);
205
212
  // * when no value, open menu use min as value
206
213
  var originalHourValue = isHaveValue
@@ -242,7 +249,7 @@ var _RcTimePicker = forwardRef(function (inProps, ref) {
242
249
  React.createElement(RcBox, { textAlign: "center", width: "48px" }, ":"),
243
250
  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
251
  isTwelveHourSystem && (React.createElement("div", null,
245
- React.createElement(ToggleText, __assign({ ref: periodRef, size: size, disabled: toggleTextDisabled, onUpdateValue: onTogglePeriod, onInnerChange: handlePeriodInnerChange, onClose: closeMenu, value: periodValue }, PeriodToggleProps)))))) : (React.createElement(SelectionView, __assign({ size: size }, (isHourView ? boundary.hour : boundary.minute), { source: isHourView
252
+ React.createElement(ToggleText, __assign({ periodTexts: periodTexts.toggle, ref: periodRef, size: size, disabled: toggleTextDisabled, onUpdateValue: onTogglePeriod, onInnerChange: handlePeriodInnerChange, onClose: closeMenu, value: periodValue }, PeriodToggleProps)))))) : (React.createElement(SelectionView, __assign({ size: size }, (isHourView ? boundary.hour : boundary.minute), { source: isHourView
246
253
  ? isTwelveHourSystem
247
254
  ? twelveHourSystemSource
248
255
  : twentyFourHourSystemSource
@@ -7,7 +7,7 @@ import { StyledTimeIconButton } from './styles';
7
7
  import { RcTimePickerUtils } from './utils';
8
8
  import { isClick } from './utils/A11yUtils';
9
9
  var _ToggleText = memo(forwardRef(function (_a, ref) {
10
- var onUpdateValue = _a.onUpdateValue, onInnerChange = _a.onInnerChange, value = _a.value, size = _a.size, disabled = _a.disabled, getScreenReaderLabel = _a.getScreenReaderLabel, onClose = _a.onClose, rest = __rest(_a, ["onUpdateValue", "onInnerChange", "value", "size", "disabled", "getScreenReaderLabel", "onClose"]);
10
+ var onUpdateValue = _a.onUpdateValue, onInnerChange = _a.onInnerChange, value = _a.value, size = _a.size, disabled = _a.disabled, getScreenReaderLabel = _a.getScreenReaderLabel, onClose = _a.onClose, periodTexts = _a.periodTexts, rest = __rest(_a, ["onUpdateValue", "onInnerChange", "value", "size", "disabled", "getScreenReaderLabel", "onClose", "periodTexts"]);
11
11
  var _b = __read(useRefState(value), 2), innerValueRef = _b[0], setInnerValue = _b[1];
12
12
  useChange(function () {
13
13
  if (innerValueRef.current !== value) {
@@ -48,7 +48,7 @@ var _ToggleText = memo(forwardRef(function (_a, ref) {
48
48
  value: innerValue,
49
49
  }); }, [innerValue]);
50
50
  return (React.createElement(StyledTimeIconButton, __assign({ wrapperSize: size, onClick: handleClick, onKeyDown: handleToggleKeyDown, disabled: disabled, color: "informative.f02", "aria-live": "assertive", "aria-label": label }, rest),
51
- React.createElement(React.Fragment, null, innerValue)));
51
+ React.createElement(React.Fragment, null, periodTexts[innerValue])));
52
52
  }));
53
53
  var ToggleText = styled(_ToggleText)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left: ", ";\n"], ["\n margin-left: ", ";\n"])), function (_a) {
54
54
  var size = _a.size;
@@ -25,10 +25,10 @@ var pad = function (num, size) {
25
25
  * @returns `hh:mm AM` or `hh:mm PM` or `hh:mm`
26
26
  */
27
27
  var getFormattedTime = function (_a, isTwelveHourSystem) {
28
- var hour = _a.hour, minute = _a.minute, period = _a.period;
28
+ var hour = _a.hour, minute = _a.minute, period = _a.period, periodTexts = _a.periodTexts;
29
29
  var formattedHour = parseNumberToString(hour, isTwelveHourSystem);
30
30
  var formattedMinute = parseNumberToString(minute);
31
- var periodText = isTwelveHourSystem ? " " + period : '';
31
+ var periodText = isTwelveHourSystem ? " " + periodTexts[period] : '';
32
32
  return formattedHour + ":" + formattedMinute + periodText;
33
33
  };
34
34
  var HALF_DAY_HOURS = 12;
@@ -1,29 +1,25 @@
1
1
  import { __assign, __makeTemplateObject } from "tslib";
2
- import React, { forwardRef } from 'react';
2
+ import React, { forwardRef, useMemo } from 'react';
3
3
  import { styled, useThemeProps, } from '../../foundation';
4
4
  import { RcIcon } from '../Icon';
5
5
  import { Attended, Unattended } from './assets';
6
- import { StyledPresence } from './styles';
7
- import { PresenceAvailable, PresenceDnd } from '@ringcentral/juno-icon';
6
+ import { StyledDND, StyledPresence } from './styles';
8
7
  var _RcPresence = forwardRef(function (inProps, ref) {
9
8
  var props = useThemeProps({ props: inProps, name: 'RcPresence' });
10
- var type = props.type;
11
- var symbol = (function () {
9
+ var type = props.type, size = props.size;
10
+ var innerChildren = useMemo(function () {
12
11
  switch (type) {
13
12
  case 'DND':
14
- return PresenceDnd;
15
- case 'available':
16
- return PresenceAvailable;
13
+ return React.createElement(StyledDND, { size: size });
17
14
  case 'attended':
18
- return Attended;
15
+ return React.createElement(RcIcon, { symbol: Attended, color: "neutral.f01", size: "inherit" });
19
16
  case 'unAttended':
20
- return Unattended;
17
+ return (React.createElement(RcIcon, { symbol: Unattended, color: "neutral.f01", size: "inherit" }));
21
18
  default:
22
19
  return null;
23
20
  }
24
- })();
25
- var symbolElm = symbol ? (React.createElement(RcIcon, { symbol: symbol, color: "neutral.f01", size: "inherit" })) : null;
26
- return (React.createElement(StyledPresence, __assign({ ref: ref }, props), symbolElm));
21
+ }, [size, type]);
22
+ return (React.createElement(StyledPresence, __assign({ ref: ref }, props), innerChildren));
27
23
  });
28
24
  /** @release */
29
25
  var RcPresence = styled(_RcPresence)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
@@ -0,0 +1,10 @@
1
+ import { __makeTemplateObject } from "tslib";
2
+ import { css, palette2, styled } from '../../../foundation';
3
+ import { RcPresenceInnerIconSizes } from '../utils';
4
+ export var StyledDND = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n background: ", ";\n"], ["\n ",
5
+ ";\n background: ", ";\n"])), function (_a) {
6
+ var size = _a.size;
7
+ var value = RcPresenceInnerIconSizes[size];
8
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n "], ["\n width: ", "px;\n height: ", "px;\n "])), value[0], value[1]);
9
+ }, palette2('neutral', 'f01'));
10
+ var templateObject_1, templateObject_2;
@@ -2,7 +2,7 @@ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { css, getParsePaletteColor, palette2, px, styled, } from '../../../foundation';
4
4
  import { RcIcon } from '../../Icon';
5
- import { RcPresenceIconSizes, RcPresenceColors, RcPresenceSizes, } from '../utils';
5
+ import { RcPresenceAvailableIconSizes, RcPresenceColors, RcPresenceSizes, } from '../utils';
6
6
  export var _StyledPresence = forwardRef(function (_a, ref) {
7
7
  var color = _a.color, borderSize = _a.borderSize, type = _a.type, size = _a.size, rest = __rest(_a, ["color", "borderSize", "type", "size"]);
8
8
  return (React.createElement("div", __assign({ ref: ref }, rest)));
@@ -11,9 +11,9 @@ export var StyledPresence = styled(_StyledPresence)(templateObject_2 || (templat
11
11
  ";\n"])), function (_a) {
12
12
  var size = _a.size, borderSize = _a.borderSize, type = _a.type, color = _a.color;
13
13
  var sizeValue = px(RcPresenceSizes[size][0]);
14
- var initSizeMap = RcPresenceIconSizes[size];
15
- var iconSizeValue = px(initSizeMap[0]);
16
- var scaleRate = initSizeMap[1];
14
+ var availableSize = RcPresenceAvailableIconSizes[size];
15
+ var iconSizeValue = px(availableSize[0]);
16
+ var scaleRate = availableSize[1];
17
17
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ", ";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "], ["\n width: ", ";\n height: ", ";\n border: ", "px solid\n ", ";\n background: ",
18
18
  ";\n\n ", " {\n transform: ", ";\n\n svg {\n width: ", ";\n height: ", ";\n }\n }\n "])), sizeValue, sizeValue, RcPresenceSizes[borderSize || size][1], palette2('neutral', 'l01'), color
19
19
  ? getParsePaletteColor(color)
@@ -1 +1,2 @@
1
+ export * from './StyledDND';
1
2
  export * from './StyledPresence';
@@ -4,9 +4,9 @@ export var RcPresenceSizes = {
4
4
  xxsmall: [8, 1],
5
5
  xsmall: [8, 2],
6
6
  small: [10, 2],
7
- medium: [10, 2],
8
- large: [14, 2],
9
- xlarge: [18, 2],
7
+ medium: [10, 3],
8
+ large: [14, 3],
9
+ xlarge: [18, 3],
10
10
  };
11
11
  // width, height
12
12
  export var RcPresenceInnerIconSizes = {
@@ -19,7 +19,7 @@ export var RcPresenceInnerIconSizes = {
19
19
  };
20
20
  // use scale rate to make that be odd value
21
21
  // width, scaleRate
22
- export var RcPresenceIconSizes = {
22
+ export var RcPresenceAvailableIconSizes = {
23
23
  xxsmall: [10, 0.5],
24
24
  xsmall: [10, 0.5],
25
25
  small: [6, undefined],
@@ -27,18 +27,6 @@ export var RcPresenceIconSizes = {
27
27
  large: [10, undefined],
28
28
  xlarge: [12, undefined],
29
29
  };
30
- export var UnAvailableIconType = {
31
- notReady: true,
32
- unavailable: true,
33
- offline: true,
34
- available: false,
35
- onCall: false,
36
- DND: false,
37
- inMeeting: false,
38
- busy: false,
39
- attended: false,
40
- unAttended: false,
41
- };
42
30
  var presenceOn = palette2('presence', 'available');
43
31
  var presenceBusy = palette2('presence', 'busy');
44
32
  var presenceOff = palette2('presence', 'invisible');
@@ -7,12 +7,15 @@ import { RcFade } from '../Transitions';
7
7
  import { VirtualizedMenuStyle } from './styles';
8
8
  import { RcVirtualizedMenuClasses } from './utils';
9
9
  import { RcVirtualizedMenuList, } from './VirtualizedMenuList';
10
+ import { useNextFrame } from './useNextFrame';
10
11
  var _RcVirtualizedMenu = forwardRef(function (inProps, ref) {
11
12
  var props = useThemeProps({ props: inProps, name: 'RcVirtualizedMenu' });
12
- var _a = props.autoFocus, autoFocus = _a === void 0 ? true : _a, children = props.children, classesProp = props.classes, _b = props.disableAutoFocusItem, disableAutoFocusItem = _b === void 0 ? false : _b, _c = props.MenuListProps, _d = _c === void 0 ? {} : _c, _e = _d.maxHeight, maxHeight = _e === void 0 ? 416 : _e, onKeyDown = _d.onKeyDown, MenuListProps = __rest(_d, ["maxHeight", "onKeyDown"]), onClose = props.onClose, open = props.open, TransitionPropsProp = props.TransitionProps, _f = props.PaperProps, PaperPropsProp = _f === void 0 ? {} : _f, PopoverClasses = props.PopoverClasses, _g = props.transitionDuration, transitionDuration = _g === void 0 ? 'auto' : _g, _h = props.variant, variant = _h === void 0 ? 'selectedMenu' : _h, rest = __rest(props, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "TransitionProps", "PaperProps", "PopoverClasses", "transitionDuration", "variant"]);
13
+ var _a = props.autoFocus, autoFocus = _a === void 0 ? true : _a, children = props.children, classesProp = props.classes, _b = props.disableAutoFocusItem, disableAutoFocusItem = _b === void 0 ? false : _b, _c = props.MenuListProps, _d = _c === void 0 ? {} : _c, _e = _d.maxHeight, maxHeight = _e === void 0 ? 416 : _e, onKeyDown = _d.onKeyDown, VirtuosoProps = _d.VirtuosoProps, MenuListProps = __rest(_d, ["maxHeight", "onKeyDown", "VirtuosoProps"]), onClose = props.onClose, open = props.open, TransitionPropsProp = props.TransitionProps, _f = props.PaperProps, PaperPropsProp = _f === void 0 ? {} : _f, PopoverClasses = props.PopoverClasses, _g = props.transitionDuration, transitionDuration = _g === void 0 ? 'auto' : _g, _h = props.variant, variant = _h === void 0 ? 'selectedMenu' : _h, _j = props.action, popoverActionProp = _j === void 0 ? null : _j, rest = __rest(props, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "open", "TransitionProps", "PaperProps", "PopoverClasses", "transitionDuration", "variant", "action"]);
13
14
  var document = useRcPortalWindowContext().document;
14
15
  var popoverRef = useRef(null);
15
16
  var handleRef = useForkRef(ref, popoverRef);
17
+ var popoverAction = useRef(null);
18
+ var handlePopoverAction = useForkRef(popoverAction, popoverActionProp);
16
19
  var menuListActionRef = useRef(null);
17
20
  var classes = useMemo(function () { return combineClasses(RcVirtualizedMenuClasses, classesProp); }, [classesProp]);
18
21
  var autoFocusItem = autoFocus && !disableAutoFocusItem && open;
@@ -49,10 +52,18 @@ var _RcVirtualizedMenu = forwardRef(function (inProps, ref) {
49
52
  }
50
53
  }
51
54
  });
52
- return (React.createElement(RcPopover, __assign({ ref: handleRef, container: document.body, classes: PopoverClasses, onClose: onClose, open: open,
55
+ var runInNextFrame = useNextFrame();
56
+ return (React.createElement(RcPopover, __assign({ ref: handleRef, action: handlePopoverAction, container: document.body, classes: PopoverClasses, onClose: onClose, open: open,
53
57
  // FIXME: workaround for virtualized menu height incorrect issue
54
58
  TransitionComponent: RcFade, transitionDuration: transitionDuration, PaperProps: PaperProps, TransitionProps: TransitionProps }, rest),
55
- React.createElement(RcVirtualizedMenuList, __assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown }, MenuListProps, { className: clsx(classes.list, MenuListProps.className) }), children)));
59
+ React.createElement(RcVirtualizedMenuList, __assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown, VirtuosoProps: __assign(__assign({}, VirtuosoProps), { totalListHeightChanged: function (height) {
60
+ var _a;
61
+ (_a = VirtuosoProps === null || VirtuosoProps === void 0 ? void 0 : VirtuosoProps.totalListHeightChanged) === null || _a === void 0 ? void 0 : _a.call(VirtuosoProps, height);
62
+ runInNextFrame(function () {
63
+ var _a;
64
+ (_a = popoverAction.current) === null || _a === void 0 ? void 0 : _a.updatePosition();
65
+ });
66
+ } }) }, MenuListProps, { className: clsx(classes.list, MenuListProps.className) }), children)));
56
67
  });
57
68
  var RcVirtualizedMenu = styled(_RcVirtualizedMenu)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), VirtualizedMenuStyle);
58
69
  RcVirtualizedMenu.defaultProps = {
@@ -0,0 +1,20 @@
1
+ import { useRef, useLayoutEffect } from 'react';
2
+ export var useNextFrame = function () {
3
+ var rafIdRef = useRef(null);
4
+ useLayoutEffect(function () {
5
+ if (rafIdRef.current !== null) {
6
+ cancelAnimationFrame(rafIdRef.current);
7
+ }
8
+ }, []);
9
+ return function (task) {
10
+ if (rafIdRef.current !== null) {
11
+ cancelAnimationFrame(rafIdRef.current);
12
+ }
13
+ rafIdRef.current = requestAnimationFrame(function () {
14
+ rafIdRef.current = requestAnimationFrame(function () {
15
+ rafIdRef.current = null;
16
+ task();
17
+ });
18
+ });
19
+ };
20
+ };
@@ -13,9 +13,9 @@ export var focusRing = function (variant, options) {
13
13
  var _b = options.borderRadius, borderRadius = _b === void 0 ? 'zero' : _b, _c = options.borderWidth, borderWidth = _c === void 0 ? '0px' : _c;
14
14
  var isInset = variant === 'inset';
15
15
  var offset = focusRingOffsetMap[variant];
16
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "], ["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "])), offset, borderWidth, offset, radius(borderRadius), isInset ? 'inset' : '', palette2('interactive', 'b02'));
16
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "], ["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "])), offset, borderWidth, offset, radius(borderRadius), isInset ? 'inset' : '', palette2('interactive', 'f01'));
17
17
  }
18
18
  var _d = options.gapColor, gapColor = _d === void 0 ? 'neutral.b01' : _d;
19
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "], ["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "])), getParsePaletteColor(gapColor), palette2('interactive', 'b02'));
19
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "], ["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "])), getParsePaletteColor(gapColor), palette2('interactive', 'f01'));
20
20
  };
21
21
  var templateObject_1, templateObject_2;
@@ -15,9 +15,9 @@ exports.focusRing = function (variant, options) {
15
15
  var _b = options.borderRadius, borderRadius = _b === void 0 ? 'zero' : _b, _c = options.borderWidth, borderWidth = _c === void 0 ? '0px' : _c;
16
16
  var isInset = variant === 'inset';
17
17
  var offset = focusRingOffsetMap[variant];
18
- return styled_components_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "], ["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "])), offset, borderWidth, offset, radius_1.radius(borderRadius), isInset ? 'inset' : '', newPalette_1.palette2('interactive', 'b02'));
18
+ return styled_components_1.css(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "], ["\n &:after {\n pointer-events: none;\n content: '';\n position: absolute;\n inset: 0;\n\n margin: calc(-", " - ", ");\n border-radius: calc(", " + ", ");\n box-shadow: ", " 0 0 0 2px\n ", ";\n }\n "])), offset, borderWidth, offset, radius_1.radius(borderRadius), isInset ? 'inset' : '', newPalette_1.palette2('interactive', 'f01'));
19
19
  }
20
20
  var _d = options.gapColor, gapColor = _d === void 0 ? 'neutral.b01' : _d;
21
- return styled_components_1.css(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "], ["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "])), newPalette_1.getParsePaletteColor(gapColor), newPalette_1.palette2('interactive', 'b02'));
21
+ return styled_components_1.css(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "], ["\n box-shadow: 0 0 0 2px ", ",\n 0 0 0 4px ", ";\n "])), newPalette_1.getParsePaletteColor(gapColor), newPalette_1.palette2('interactive', 'f01'));
22
22
  };
23
23
  var templateObject_1, templateObject_2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ringcentral/juno",
3
- "version": "2.30.1",
3
+ "version": "2.32.0",
4
4
  "author": "RingCentral",
5
5
  "license": "MIT",
6
6
  "main": "./index.js",