@ringcentral/juno 2.20.3 → 2.21.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.
@@ -17,7 +17,7 @@ var _RcIconButton = react_1.memo(react_1.forwardRef(function (inProps, ref) {
17
17
  // eslint-disable-next-line react-hooks/rules-of-hooks
18
18
  foundation_1.useDeprecatedCheck(RcIconButton, props, IconButtonProps_1.rcIconButtonWarning);
19
19
  }
20
- var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, autoFocus = props.autoFocus, href = props.href, rest = tslib_1.__rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "autoFocus", "href"]);
20
+ var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, href = props.href, rest = tslib_1.__rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "href"]);
21
21
  var theme = foundation_1.useTheme();
22
22
  var isOutline = variant === 'outline';
23
23
  var isContained = variant === 'contained';
@@ -45,8 +45,6 @@ declare type RcIconButtonProps = RcIconButtonBaseProps & {
45
45
  as?: ElementType | keyof JSX.IntrinsicElements;
46
46
  } & RcIconButtonDeprecatedProps & RcBaseProps<RcIconProps, 'color' | 'children' | 'size'>;
47
47
  declare type RcIconButtonDeprecatedProps = {
48
- /** @deprecated don't have any logic below, now need anymore */
49
- autoFocus?: boolean;
50
48
  /**
51
49
  * @deprecated
52
50
  * enable tooltip even button is disabled. default with false
@@ -307,7 +307,7 @@ var _RcDownshift = react_1.memo(react_1.forwardRef(function (inProps, ref) {
307
307
  maxLength: maxLength, containerRef: inputContainerRef }, getInputAriaProps(TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.inputProps)),
308
308
  }, rest), { value: inputValue, clearBtn: false })),
309
309
  !helperText && screenReaderText && (react_1.default.createElement(VisuallyHidden_1.RcVisuallyHidden, { id: describedbyId }, screenReaderText)),
310
- react_1.default.createElement(styles_1.StyledPopper, tslib_1.__assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef,
310
+ react_1.default.createElement(styles_1.StyledPopper, tslib_1.__assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: utils_1.fixOffsetsModifer },
311
311
  // * view type in popper.js
312
312
  popperOptions: {
313
313
  onUpdate: function (e) {
@@ -0,0 +1,5 @@
1
+ export declare const fixOffsetsModifer: {
2
+ order: number;
3
+ enabled: boolean;
4
+ fn: (data: any) => any;
5
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ exports.fixOffsetsModifer = {
5
+ order: 890,
6
+ enabled: true,
7
+ fn: function (data) {
8
+ var e_1, _a;
9
+ try {
10
+ for (var _b = tslib_1.__values([
11
+ 'transform',
12
+ 'msTransform',
13
+ 'WebkitTransform',
14
+ 'MozTransform',
15
+ 'OTransform',
16
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
17
+ var property = _c.value;
18
+ var tranformValue = data.styles[property];
19
+ if (tranformValue) {
20
+ var matchValue = tranformValue.match(/translate3d\((\d+)px, (\d+)px, 0\)/);
21
+ if (matchValue) {
22
+ var dpr = window.devicePixelRatio;
23
+ var x = Math.round(Number(matchValue[1]) * dpr) / dpr;
24
+ var y = Math.round(Number(matchValue[2]) * dpr) / dpr;
25
+ data.styles.transform = "translate3d(" + x + "px, " + y + "px, 0)";
26
+ }
27
+ }
28
+ }
29
+ }
30
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
31
+ finally {
32
+ try {
33
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
34
+ }
35
+ finally { if (e_1) throw e_1.error; }
36
+ }
37
+ return data;
38
+ },
39
+ };
@@ -5,3 +5,4 @@ export * from './useDownshift';
5
5
  export * from './useDownshiftError';
6
6
  export * from './useDownshiftGroup';
7
7
  export * from './useDownshiftTag';
8
+ export * from './fixOffsetsModifer';
@@ -6,3 +6,4 @@ tslib_1.__exportStar(require("./useDownshift"), exports);
6
6
  tslib_1.__exportStar(require("./useDownshiftError"), exports);
7
7
  tslib_1.__exportStar(require("./useDownshiftGroup"), exports);
8
8
  tslib_1.__exportStar(require("./useDownshiftTag"), exports);
9
+ tslib_1.__exportStar(require("./fixOffsetsModifer"), exports);
@@ -187,10 +187,12 @@ exports.useDownshiftTag = function (_a) {
187
187
  }
188
188
  },
189
189
  onDelete: function (e) {
190
+ var _a;
190
191
  // * left button clicked
191
192
  if (e.button === 0) {
192
193
  removeTag(selectedItem);
193
194
  setFocused(false);
195
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
194
196
  }
195
197
  },
196
198
  }, restTagProps);
@@ -15,7 +15,7 @@ var _RcIconButton = memo(forwardRef(function (inProps, ref) {
15
15
  // eslint-disable-next-line react-hooks/rules-of-hooks
16
16
  useDeprecatedCheck(RcIconButton, props, rcIconButtonWarning);
17
17
  }
18
- var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, autoFocus = props.autoFocus, href = props.href, rest = __rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "autoFocus", "href"]);
18
+ var _b = props.buttonRef, buttonRef = _b === void 0 ? ref : _b, _c = props.IconProps, IconProps = _c === void 0 ? {} : _c, className = props.className, classesProp = props.classes, children = props.children, title = props.title, disabledFakeBorder = props.disabledFakeBorder, symbol = props.symbol, disabled = props.disabled, invisible = props.invisible, type = props.type, loading = props.loading, TouchRippleProps = props.TouchRippleProps, variant = props.variant, CircularProgressProps = props.CircularProgressProps, color = props.color, shouldPersistBg = props.shouldPersistBg, stretchIcon = props.stretchIcon, iconColor = props.iconColor, iconSize = props.iconSize, disableTouchRipple = props.disableTouchRipple, useColorWhenDisabled = props.useColorWhenDisabled, size = props.size, radius = props.radius, elevation = props.elevation, activeElevation = props.activeElevation, aRef = props.aRef, tooltipTitle = props.tooltipTitle, tooltipForceHide = props.tooltipForceHide, disableToolTip = props.disableToolTip, alwaysEnableTooltip = props.alwaysEnableTooltip, tooltipPlacement = props.tooltipPlacement, ariaLabel = props.ariaLabel, popperProps = props.popperProps, externalLink = props.externalLink, download = props.download, href = props.href, rest = __rest(props, ["buttonRef", "IconProps", "className", "classes", "children", "title", "disabledFakeBorder", "symbol", "disabled", "invisible", "type", "loading", "TouchRippleProps", "variant", "CircularProgressProps", "color", "shouldPersistBg", "stretchIcon", "iconColor", "iconSize", "disableTouchRipple", "useColorWhenDisabled", "size", "radius", "elevation", "activeElevation", "aRef", "tooltipTitle", "tooltipForceHide", "disableToolTip", "alwaysEnableTooltip", "tooltipPlacement", "ariaLabel", "popperProps", "externalLink", "download", "href"]);
19
19
  var theme = useTheme();
20
20
  var isOutline = variant === 'outline';
21
21
  var isContained = variant === 'contained';
@@ -9,7 +9,7 @@ import { ClearIconButton } from '../Forms/TextField/styles/ClearIconButton';
9
9
  import { RcVisuallyHidden } from '../VisuallyHidden';
10
10
  import { ArrowDownButton, DownshiftStyle, EndAdornment, RcDownshiftInput, StyledPopper, StyledTextField, } from './styles';
11
11
  import { RcSuggestionList } from './SuggestionList';
12
- import { DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, DEFAULT_LIMIT_CHIPS, RcDownshiftDefaultFilterOptions, RcDownshiftInputClasses, useDownshift, useDownshiftError, } from './utils';
12
+ import { DEFAULT_GET_OPTION_LABEL, DEFAULT_KEY_TO_CHIPS, DEFAULT_LIMIT_CHIPS, fixOffsetsModifer, RcDownshiftDefaultFilterOptions, RcDownshiftInputClasses, useDownshift, useDownshiftError, } from './utils';
13
13
  /**
14
14
  * default transition style for grow when not virtualize
15
15
  */
@@ -303,7 +303,7 @@ var _RcDownshift = memo(forwardRef(function (inProps, ref) {
303
303
  maxLength: maxLength, containerRef: inputContainerRef }, getInputAriaProps(TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.inputProps)),
304
304
  }, rest), { value: inputValue, clearBtn: false })),
305
305
  !helperText && screenReaderText && (React.createElement(RcVisuallyHidden, { id: describedbyId }, screenReaderText)),
306
- React.createElement(StyledPopper, __assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef,
306
+ React.createElement(StyledPopper, __assign({ open: open, position: position, component: PopperComponent, placement: "bottom-start", anchorEl: anchorElRef.current, "data-test-automation-id": "suggestions-list", popperRef: popperRef, modifiers: { fixOffsets: fixOffsetsModifer },
307
307
  // * view type in popper.js
308
308
  popperOptions: {
309
309
  onUpdate: function (e) {
@@ -0,0 +1,37 @@
1
+ import { __values } from "tslib";
2
+ export var fixOffsetsModifer = {
3
+ order: 890,
4
+ enabled: true,
5
+ fn: function (data) {
6
+ var e_1, _a;
7
+ try {
8
+ for (var _b = __values([
9
+ 'transform',
10
+ 'msTransform',
11
+ 'WebkitTransform',
12
+ 'MozTransform',
13
+ 'OTransform',
14
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
15
+ var property = _c.value;
16
+ var tranformValue = data.styles[property];
17
+ if (tranformValue) {
18
+ var matchValue = tranformValue.match(/translate3d\((\d+)px, (\d+)px, 0\)/);
19
+ if (matchValue) {
20
+ var dpr = window.devicePixelRatio;
21
+ var x = Math.round(Number(matchValue[1]) * dpr) / dpr;
22
+ var y = Math.round(Number(matchValue[2]) * dpr) / dpr;
23
+ data.styles.transform = "translate3d(" + x + "px, " + y + "px, 0)";
24
+ }
25
+ }
26
+ }
27
+ }
28
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
29
+ finally {
30
+ try {
31
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
32
+ }
33
+ finally { if (e_1) throw e_1.error; }
34
+ }
35
+ return data;
36
+ },
37
+ };
@@ -3,3 +3,4 @@ export * from './useDownshift';
3
3
  export * from './useDownshiftError';
4
4
  export * from './useDownshiftGroup';
5
5
  export * from './useDownshiftTag';
6
+ export * from './fixOffsetsModifer';
@@ -185,10 +185,12 @@ export var useDownshiftTag = function (_a) {
185
185
  }
186
186
  },
187
187
  onDelete: function (e) {
188
+ var _a;
188
189
  // * left button clicked
189
190
  if (e.button === 0) {
190
191
  removeTag(selectedItem);
191
192
  setFocused(false);
193
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
192
194
  }
193
195
  },
194
196
  }, restTagProps);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ringcentral/juno",
3
- "version": "2.20.3",
3
+ "version": "2.21.2",
4
4
  "author": "RingCentral",
5
5
  "license": "MIT",
6
6
  "main": "./index.js",