@ringcentral/juno 1.12.3-beta.5791-ea7a35ca → 1.12.4-beta.5841-601f173e

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 (107) hide show
  1. package/components/Buttons/Button/Button.d.ts +2 -2
  2. package/components/Buttons/Button/styles/StyledButton.js +4 -2
  3. package/components/Card/Card/Card.d.ts +2 -2
  4. package/components/Chip/Chip.d.ts +10 -3
  5. package/components/Chip/Chip.js +5 -3
  6. package/components/Chip/styles/ChipStyle.js +5 -4
  7. package/components/Chip/utils/ChipUtils.d.ts +1 -1
  8. package/components/Chip/utils/ChipUtils.js +1 -1
  9. package/components/Dialer/DialTextField/DialTextField.d.ts +1 -1
  10. package/components/Downshift/Downshift.d.ts +20 -9
  11. package/components/Downshift/Downshift.js +15 -5
  12. package/components/Downshift/SuggestionList/SuggestionList.d.ts +2 -2
  13. package/components/Downshift/SuggestionList/SuggestionList.js +12 -6
  14. package/components/Downshift/SuggestionList/utils/index.d.ts +1 -0
  15. package/components/Downshift/SuggestionList/utils/index.js +1 -0
  16. package/components/Downshift/SuggestionList/utils/useSuggestionList.d.ts +298 -0
  17. package/components/Downshift/SuggestionList/utils/useSuggestionList.js +239 -0
  18. package/components/Downshift/styles/StyledTextField.d.ts +1 -1
  19. package/components/Downshift/utils/DownshiftUtils.d.ts +12 -0
  20. package/components/Downshift/utils/DownshiftUtils.js +19 -1
  21. package/components/Downshift/utils/SelectItem.d.ts +19 -0
  22. package/components/Downshift/utils/useDownshift.d.ts +5 -2
  23. package/components/Downshift/utils/useDownshift.interface.d.ts +5 -0
  24. package/components/Downshift/utils/useDownshift.js +31 -13
  25. package/components/Downshift/utils/useDownshiftGroup.d.ts +7 -7
  26. package/components/Downshift/utils/useDownshiftGroup.js +45 -19
  27. package/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
  28. package/components/Forms/Picker/TimePicker/TimePicker.d.ts +13 -58
  29. package/components/Forms/Picker/TimePicker/TimePicker.js +15 -21
  30. package/components/Forms/Picker/TimePicker/index.d.ts +1 -0
  31. package/components/Forms/Picker/TimePicker/index.js +1 -0
  32. package/components/Forms/Picker/TimePicker/styles/StyledPickerPopperWrap.d.ts +8 -8
  33. package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.d.ts +24 -0
  34. package/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +25 -1
  35. package/components/Forms/Picker/styles/StyledPickerTextField.d.ts +1 -1
  36. package/components/Forms/Select/PlainSelect/PlainSelect.d.ts +1 -1
  37. package/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
  38. package/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
  39. package/components/Forms/Select/Select.d.ts +2 -2
  40. package/components/Forms/Select/Select.js +2 -2
  41. package/components/Forms/Select/styles/StyledSelect.js +22 -18
  42. package/components/Forms/TextField/TextField.d.ts +4 -2
  43. package/components/Forms/TextField/TextField.js +2 -2
  44. package/components/Forms/TextField/styles/OutlineTextFieldStyle.js +4 -2
  45. package/components/Forms/TextField/styles/TextFieldStyle.js +8 -4
  46. package/components/Forms/Textarea/Textarea.d.ts +1 -1
  47. package/components/Menu/SubMenu/SubMenu.js +1 -1
  48. package/components/Toast/Toast.d.ts +30 -0
  49. package/components/Toast/Toast.js +49 -0
  50. package/components/Toast/ToastContainer.d.ts +12 -0
  51. package/components/Toast/ToastContainer.js +17 -0
  52. package/components/Toast/index.d.ts +3 -0
  53. package/components/Toast/index.js +7 -0
  54. package/components/Toast/styles/ToastStyle.d.ts +4 -0
  55. package/components/Toast/styles/ToastStyle.js +12 -0
  56. package/components/Toast/styles/index.d.ts +1 -0
  57. package/components/Toast/styles/index.js +4 -0
  58. package/components/Toast/utils/ToastUtils.d.ts +1 -0
  59. package/components/Toast/utils/ToastUtils.js +3 -0
  60. package/components/Toast/utils/index.d.ts +1 -0
  61. package/components/Toast/utils/index.js +4 -0
  62. package/components/Virtuoso/utils/useHighlightScroll.d.ts +1 -1
  63. package/es6/components/Buttons/Button/styles/StyledButton.js +4 -2
  64. package/es6/components/Chip/Chip.js +6 -4
  65. package/es6/components/Chip/styles/ChipStyle.js +6 -5
  66. package/es6/components/Chip/utils/ChipUtils.js +1 -1
  67. package/es6/components/Downshift/Downshift.js +16 -7
  68. package/es6/components/Downshift/SuggestionList/SuggestionList.js +13 -7
  69. package/es6/components/Downshift/SuggestionList/utils/index.js +1 -0
  70. package/es6/components/Downshift/SuggestionList/utils/useSuggestionList.js +237 -0
  71. package/es6/components/Downshift/utils/DownshiftUtils.js +19 -1
  72. package/es6/components/Downshift/utils/useDownshift.js +31 -13
  73. package/es6/components/Downshift/utils/useDownshiftGroup.js +46 -20
  74. package/es6/components/Forms/Picker/TimePicker/NumberPicker.js +1 -3
  75. package/es6/components/Forms/Picker/TimePicker/TimePicker.js +15 -21
  76. package/es6/components/Forms/Picker/TimePicker/index.js +1 -0
  77. package/es6/components/Forms/Picker/TimePicker/utils/TimePickerHelper.js +25 -1
  78. package/es6/components/Forms/Select/PlainSelect/PlainSelect.js +5 -4
  79. package/es6/components/Forms/Select/PlainSelect/styles/StyledSelect.js +4 -3
  80. package/es6/components/Forms/Select/Select.js +2 -2
  81. package/es6/components/Forms/Select/styles/StyledSelect.js +24 -20
  82. package/es6/components/Forms/TextField/TextField.js +2 -2
  83. package/es6/components/Forms/TextField/styles/OutlineTextFieldStyle.js +5 -3
  84. package/es6/components/Forms/TextField/styles/TextFieldStyle.js +9 -5
  85. package/es6/components/Menu/SubMenu/SubMenu.js +1 -1
  86. package/es6/components/Toast/Toast.js +47 -0
  87. package/es6/components/Toast/ToastContainer.js +15 -0
  88. package/es6/components/Toast/index.js +3 -0
  89. package/es6/components/Toast/styles/ToastStyle.js +10 -0
  90. package/es6/components/Toast/styles/index.js +1 -0
  91. package/es6/components/Toast/utils/ToastUtils.js +1 -0
  92. package/es6/components/Toast/utils/index.js +1 -0
  93. package/es6/foundation/config.js +8 -5
  94. package/es6/foundation/contexts/PortalWindowContext.js +3 -1
  95. package/es6/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
  96. package/es6/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
  97. package/es6/foundation/theme/ThemeProvider.js +17 -4
  98. package/es6/foundation/theme/assets/zIndex.json +2 -1
  99. package/foundation/config.js +8 -5
  100. package/foundation/contexts/PortalWindowContext.js +3 -1
  101. package/foundation/hooks/useAnnouncer/useAnnouncer.d.ts +7 -0
  102. package/foundation/hooks/useAnnouncer/useAnnouncer.js +7 -0
  103. package/foundation/hooks/useKeyboardMoveFocus/useKeyboardMoveFocus.js +2 -1
  104. package/foundation/theme/ThemeProvider.d.ts +2 -0
  105. package/foundation/theme/ThemeProvider.js +15 -2
  106. package/foundation/theme/assets/zIndex.json +2 -1
  107. package/package.json +3 -3
@@ -1,14 +1,16 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
- import { css, fakeBorder, palette2, px, radius as radiusFn, spacing, typography, } from '../../../../foundation';
2
+ import { css, fakeBorder, getParsePaletteColor, palette2, px, radius as radiusFn, spacing, typography, } from '../../../../foundation';
3
3
  import { belowIconButtonSpacing, RcOutlineTextFieldFontStyles, RcOutlineTextFieldHeights, RcOutlineTextFieldInputClasses, RcOutlineTextFieldLabelMargins, RcOutlineTextFieldSpaces, RcTextFieldClasses, } from '../utils';
4
4
  export var OutlineTextFieldStyle = function (_a) {
5
- var radius = _a.radius, size = _a.size;
5
+ var radius = _a.radius, size = _a.size, colorProp = _a.color;
6
6
  var height = px(RcOutlineTextFieldHeights[size]);
7
7
  var _b = RcOutlineTextFieldSpaces[size], inside = _b.inside, outside = _b.outside, insideLeft = _b.insideLeft;
8
8
  var labelMargin = RcOutlineTextFieldLabelMargins[size];
9
9
  var typographyToken = RcOutlineTextFieldFontStyles[size];
10
10
  var currRadius = radiusFn(radius);
11
+ var borderColor = getParsePaletteColor(colorProp, palette2('neutral', 'l03'));
12
+ var focusBorderColor = getParsePaletteColor(colorProp, palette2('interactive', 'f01'));
11
13
  // `-webkit-tap-highlight-color` for cover background color, prevent color be cover by browser
12
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "], ["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "])), RcOutlineTextFieldInputClasses.input, typography(typographyToken), belowIconButtonSpacing(spacing(inside)), RcOutlineTextFieldInputClasses.input, spacing(insideLeft || inside), RcTextFieldClasses.root, RcOutlineTextFieldInputClasses.root, spacing(labelMargin), RcOutlineTextFieldInputClasses.root, height, height, palette2('neutral', 'b01'), spacing(outside), currRadius, currRadius, fakeBorder({ color: palette2('neutral', 'l03') }), RcOutlineTextFieldInputClasses.focused, RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b02'), RcOutlineTextFieldInputClasses.focused, fakeBorder({ color: palette2('interactive', 'f01') }), RcOutlineTextFieldInputClasses.error, fakeBorder({ color: palette2('danger', 'f02') }), RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b03'), fakeBorder({ color: palette2('disabled', 'f02') }));
14
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "], ["\n .", " {\n ", ";\n }\n\n ", ";\n\n * + .", " {\n margin-left: ", ";\n }\n\n &.", " {\n label + .", " {\n margin-top: ", ";\n }\n }\n\n .", " {\n -webkit-tap-highlight-color: transparent;\n height: ", ";\n min-height: ", ";\n background: ", ";\n padding: ", ";\n border-radius: ", ";\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n border-radius: ", ";\n transition: none;\n border-bottom: none !important;\n pointer-events: none;\n ", ";\n }\n\n &:not(.", "):not(.", "):hover {\n background: ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n &:before {\n ", ";\n }\n }\n\n .", " {\n background: ", ";\n &:before {\n ", ";\n }\n }\n "])), RcOutlineTextFieldInputClasses.input, typography(typographyToken), belowIconButtonSpacing(spacing(inside)), RcOutlineTextFieldInputClasses.input, spacing(insideLeft || inside), RcTextFieldClasses.root, RcOutlineTextFieldInputClasses.root, spacing(labelMargin), RcOutlineTextFieldInputClasses.root, height, height, palette2('neutral', 'b01'), spacing(outside), currRadius, currRadius, fakeBorder({ color: borderColor }), RcOutlineTextFieldInputClasses.focused, RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b02'), RcOutlineTextFieldInputClasses.focused, fakeBorder({ color: focusBorderColor }), RcOutlineTextFieldInputClasses.error, fakeBorder({ color: palette2('danger', 'f02') }), RcOutlineTextFieldInputClasses.disabled, palette2('neutral', 'b03'), fakeBorder({ color: palette2('disabled', 'f02') }));
13
15
  };
14
16
  var templateObject_1;
@@ -1,5 +1,5 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
- import { css, isFilled, nonTouchHoverMedia, palette2, px, spacing, typography, } from '../../../../foundation';
2
+ import { css, getParsePaletteColor, isFilled, nonTouchHoverMedia, palette2, px, spacing, typography, } from '../../../../foundation';
3
3
  import { RcIconButtonSizes } from '../../../Buttons/IconButton/utils';
4
4
  import { belowIconButtonSpacing, RcTextFieldClasses, RcTextFieldFormHelperTextClasses, RcTextFieldInputClasses, RcTextFieldInputLabelClasses, } from '../utils';
5
5
  import { ClearIconButton } from './ClearIconButton';
@@ -14,13 +14,17 @@ export var RcDefaultTextFieldWidth = '168px';
14
14
  var focusWithNotDisabled = "." + RcTextFieldInputClasses.root + ":hover:not(." + RcTextFieldInputClasses.disabled + ")";
15
15
  var TextFieldInputHoverFocusStyle = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", " {\n display: inline-flex;\n }\n"], ["\n ", " {\n display: inline-flex;\n }\n"])), ClearIconButton);
16
16
  export var clearBtnInactiveStyle = css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", " {\n ", " {\n ", "\n }\n }\n\n .", " {\n ", "\n }\n"], ["\n ", " {\n ", " {\n ", "\n }\n }\n\n .", " {\n ", "\n }\n"])), nonTouchHoverMedia, focusWithNotDisabled, TextFieldInputHoverFocusStyle, RcTextFieldInputClasses.focused, TextFieldInputHoverFocusStyle);
17
- export var TextFieldStyle = function (_a) {
18
- var value = _a.value, variant = _a.variant, fullWidth = _a.fullWidth, clearBtn = _a.clearBtn, size = _a.size, textVariant = _a.textVariant, gutterBottom = _a.gutterBottom, align = _a.align;
17
+ export var TextFieldStyle = function (props) {
18
+ var value = props.value, variant = props.variant, fullWidth = props.fullWidth, clearBtn = props.clearBtn, size = props.size, textVariant = props.textVariant, gutterBottom = props.gutterBottom, align = props.align, colorProp = props.color;
19
19
  var showClean = isFilled({ value: value });
20
+ var color = getParsePaletteColor(colorProp, palette2('interactive', 'f01'));
21
+ var labelRootColor = getParsePaletteColor(colorProp, idleColor);
22
+ var underlineColor = getParsePaletteColor(colorProp, palette2('neutral', 'f02'));
23
+ var underlineFocusColor = getParsePaletteColor(colorProp, palette2('neutral', 'f06'));
20
24
  return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n\n width: ", ";\n\n ", ";\n\n .", " {\n ", ";\n color: ", ";\n transform: scale(1);\n }\n\n .", " {\n color: ", ";\n }\n\n .", " {\n color: ", ";\n\n ", " {\n display: none;\n }\n }\n\n ", ";\n\n .", " {\n ", ";\n text-align: ", ";\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n\n ", ";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "], ["\n ", ";\n\n width: ", ";\n\n ",
21
25
  ";\n\n .", " {\n ", ";\n color: ", ";\n transform: scale(1);\n }\n\n .", " {\n color: ", ";\n }\n\n .", " {\n color: ", ";\n\n ", " {\n display: none;\n }\n }\n\n ", ";\n\n .", " {\n ", ";\n text-align: ", ";\n\n ::placeholder {\n color: ", ";\n opacity: 1;\n }\n\n ",
22
- ";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "])), belowIconButtonSpacing(spacing(3)), !fullWidth && RcDefaultTextFieldWidth, gutterBottom && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "], ["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "])), RcTextFieldClasses.root, spacing(4)), RcTextFieldInputLabelClasses.root, typography('caption2'), idleColor, RcTextFieldInputLabelClasses.focused, palette2('interactive', 'f01'), RcTextFieldInputClasses.root, textColor, ClearIconButton, showClean && clearBtnInactiveStyle, RcTextFieldInputClasses.input, typography(variant === 'borderLess' ? textVariant : 'subheading1'), align, placeholderColor, clearBtn &&
26
+ ";\n }\n\n .", " {\n &:before {\n border-bottom-color: ", ";\n }\n\n ", " {\n &:hover:not(.", ") {\n &:before {\n border-bottom-color: ", ";\n }\n }\n }\n\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n &:after {\n border-bottom-color: ", ";\n }\n }\n\n .", " {\n color: ", ";\n // * safari need that in disabled input\n -webkit-text-fill-color: ", ";\n ::placeholder {\n color: ", ";\n }\n &:before {\n border-bottom-style: solid;\n border-bottom-color: ", ";\n }\n &:after {\n border-bottom-style: none;\n }\n }\n\n .", " {\n ", ";\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n .", ",\n .", " {\n color: ", ";\n }\n\n /* clears the 'X' from Internet Explorer */\n input[type='search']::-ms-clear,\n input[type='search']::-ms-reveal {\n display: none;\n width: 0;\n height: 0;\n }\n\n /* clears the 'X' from Chrome */\n input[type='search']::-webkit-search-decoration,\n input[type='search']::-webkit-search-cancel-button,\n input[type='search']::-webkit-search-results-button,\n input[type='search']::-webkit-search-results-decoration {\n display: none;\n }\n\n ", "\n "])), belowIconButtonSpacing(spacing(3)), !fullWidth && RcDefaultTextFieldWidth, gutterBottom && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "], ["\n &.", " {\n margin: 0 0 ", " 0;\n }\n "])), RcTextFieldClasses.root, spacing(4)), RcTextFieldInputLabelClasses.root, typography('caption2'), labelRootColor, RcTextFieldInputLabelClasses.focused, color, RcTextFieldInputClasses.root, textColor, ClearIconButton, showClean && clearBtnInactiveStyle, RcTextFieldInputClasses.input, typography(variant === 'borderLess' ? textVariant : 'subheading1'), align, placeholderColor, clearBtn &&
23
27
  align &&
24
- align !== 'left' && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: calc(100% - ", ");\n "], ["\n width: calc(100% - ", ");\n "])), px(RcIconButtonSizes[size])), RcTextFieldInputClasses.underline, palette2('neutral', 'f02'), nonTouchHoverMedia, RcTextFieldInputClasses.disabled, palette2('neutral', 'f06'), palette2('interactive', 'f01'), RcTextFieldInputClasses.error, errorColor, RcTextFieldInputClasses.disabled, disabledColor, disabledColor, disabledColor, disabledColor, RcTextFieldFormHelperTextClasses.root, typography('caption1'), idleColor, RcTextFieldFormHelperTextClasses.error, RcTextFieldInputLabelClasses.error, errorTextColor, RcTextFieldFormHelperTextClasses.disabled, RcTextFieldInputLabelClasses.disabled, disabledColor, variant === 'outline' && OutlineTextFieldStyle);
28
+ align !== 'left' && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: calc(100% - ", ");\n "], ["\n width: calc(100% - ", ");\n "])), px(RcIconButtonSizes[size])), RcTextFieldInputClasses.underline, underlineColor, nonTouchHoverMedia, RcTextFieldInputClasses.disabled, underlineFocusColor, color, RcTextFieldInputClasses.error, errorColor, RcTextFieldInputClasses.disabled, disabledColor, disabledColor, disabledColor, disabledColor, RcTextFieldFormHelperTextClasses.root, typography('caption1'), idleColor, RcTextFieldFormHelperTextClasses.error, RcTextFieldInputLabelClasses.error, errorTextColor, RcTextFieldFormHelperTextClasses.disabled, RcTextFieldInputLabelClasses.disabled, disabledColor, variant === 'outline' && OutlineTextFieldStyle);
25
29
  };
26
30
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
@@ -178,7 +178,7 @@ var _RcSubMenu = forwardRef(function (inProps, ref) {
178
178
  title,
179
179
  React.createElement(StyledListItemSecondaryAction, null,
180
180
  React.createElement(RcIcon, { size: "medium", color: "neutral.f04", symbol: ArrowRight }))),
181
- React.createElement(RcPopper, __assign({ role: "menu", id: popperId, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body }, restPopperProps, { ref: popperRef, open: open, anchorEl: anchorEl, transition: true, placement: "right-start", modifiers: modifiers, onKeyDown: handlePopperKeyDown, onMouseLeave: handlePopperMouseLeave }), function (_a) {
181
+ React.createElement(RcPopper, __assign({ role: "menu", id: popperId, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body, placement: "right-start" }, restPopperProps, { ref: popperRef, open: open, anchorEl: anchorEl, transition: true, modifiers: modifiers, onKeyDown: handlePopperKeyDown, onMouseLeave: handlePopperMouseLeave }), function (_a) {
182
182
  var TransitionProps = _a.TransitionProps;
183
183
  return (React.createElement(StyledGrow, __assign({}, TransitionProps, { timeout: "auto" }),
184
184
  React.createElement(RcPaper, null,
@@ -0,0 +1,47 @@
1
+ import { __assign, __makeTemplateObject, __read, __rest, __spread } from "tslib";
2
+ import React, { forwardRef } from 'react';
3
+ import { styled } from '../../foundation';
4
+ import { Close as CloseIcon } from '../../icon';
5
+ import { RcPortal } from '../Portal';
6
+ import { RcSnackbar, RcSnackbarAction } from '../Snackbar';
7
+ import { ToastStyle } from './styles';
8
+ import { RC_TOAST_CONTAINER_ID } from './utils';
9
+ var _RcToast = forwardRef(function (_a, ref) {
10
+ var children = _a.children, _b = _a.container, containerProp = _b === void 0 ? RC_TOAST_CONTAINER_ID : _b, getWindow = _a.getWindow, onClose = _a.onClose, _c = _a.ContentProps, ContentPropsInput = _c === void 0 ? {} : _c, _d = _a.dismissButton, dismissButton = _d === void 0 ? false : _d, _e = _a.autoHideDuration, autoHideDuration = _e === void 0 ? 3000 : _e, rest = __rest(_a, ["children", "container", "getWindow", "onClose", "ContentProps", "dismissButton", "autoHideDuration"]);
11
+ var container = (function () {
12
+ var _a;
13
+ // mean containerProp is id
14
+ if (typeof containerProp === 'string') {
15
+ var targetWindow = (_a = getWindow === null || getWindow === void 0 ? void 0 : getWindow()) !== null && _a !== void 0 ? _a : window;
16
+ return targetWindow.document.getElementById(containerProp);
17
+ }
18
+ return containerProp;
19
+ })();
20
+ var action = (function () {
21
+ var originActions = React.Children.toArray(ContentPropsInput.action);
22
+ if (dismissButton) {
23
+ var closeAction = (React.createElement(RcSnackbarAction, { key: "dismiss-action", variant: "icon", "aria-label": "Dismiss", symbol: CloseIcon, onClick: function (e) { return handleClose(e, 'dismissButton'); } }));
24
+ return __spread(originActions, [closeAction]);
25
+ }
26
+ return originActions.length === 0 ? null : originActions;
27
+ })();
28
+ var messageAlign = (function () {
29
+ if (action === null || action === void 0 ? void 0 : action.length) {
30
+ return 'left';
31
+ }
32
+ return 'center';
33
+ })();
34
+ var ContentProps = __assign(__assign({}, ContentPropsInput), { action: action,
35
+ messageAlign: messageAlign });
36
+ var handleClose = function (e, reason) {
37
+ if (reason === 'clickaway')
38
+ return;
39
+ onClose(e, reason);
40
+ };
41
+ return (React.createElement(RcPortal, { container: container },
42
+ React.createElement(RcSnackbar, __assign({}, rest, { autoHideDuration: autoHideDuration, onClose: handleClose, ref: ref, ContentProps: ContentProps }), children)));
43
+ });
44
+ var RcToast = styled(_RcToast)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ToastStyle);
45
+ RcToast.displayName = 'RcToast';
46
+ export { RcToast };
47
+ var templateObject_1;
@@ -0,0 +1,15 @@
1
+ import { __assign, __makeTemplateObject, __rest } from "tslib";
2
+ import React, { forwardRef } from 'react';
3
+ import { styled } from '../../foundation';
4
+ import { RcPortal } from '../Portal';
5
+ import { ToastContainerStyle } from './styles';
6
+ import { RC_TOAST_CONTAINER_ID } from './utils';
7
+ var _RcToastContainer = forwardRef(function (props, ref) {
8
+ var _a = props.container, container = _a === void 0 ? document.body : _a, _b = props.id, id = _b === void 0 ? RC_TOAST_CONTAINER_ID : _b, rest = __rest(props, ["container", "id"]);
9
+ return (React.createElement(RcPortal, { container: container },
10
+ React.createElement("div", __assign({}, rest, { id: id, ref: ref }))));
11
+ });
12
+ var RcToastContainer = styled(_RcToastContainer)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), ToastContainerStyle);
13
+ RcToastContainer.displayName = 'RcToastContainer';
14
+ export { RcToastContainer };
15
+ var templateObject_1;
@@ -0,0 +1,3 @@
1
+ export * from './Toast';
2
+ export * from './ToastContainer';
3
+ export { ToastContainerStyle } from './styles';
@@ -0,0 +1,10 @@
1
+ import { __makeTemplateObject } from "tslib";
2
+ import { css, spacing, zIndex } from '../../../foundation';
3
+ import { RC_TOAST_CONTAINER_ID } from '../utils';
4
+ export var ToastStyle = function () {
5
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:last-of-type {\n margin-bottom: 0;\n }\n\n margin-bottom: ", ";\n\n ", "\n position: static;\n transform: none;\n "], ["\n &:last-of-type {\n margin-bottom: 0;\n }\n\n margin-bottom: ", ";\n\n ", /** clean snackbar style about anchorOrigin */ "\n position: static;\n transform: none;\n "])), spacing(3), '' /** clean snackbar style about anchorOrigin */);
6
+ };
7
+ export var ToastContainerStyle = function () {
8
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n #", " {\n padding-left: ", ";\n padding-right: ", ";\n\n position: fixed;\n top: ", ";\n left: 0;\n right: 0;\n\n z-index: ", ";\n box-sizing: border-box;\n pointer-events: none;\n }\n "], ["\n #", " {\n padding-left: ", ";\n padding-right: ", ";\n\n position: fixed;\n top: ", ";\n left: 0;\n right: 0;\n\n z-index: ", ";\n box-sizing: border-box;\n pointer-events: none;\n }\n "])), RC_TOAST_CONTAINER_ID, spacing(4), spacing(4), spacing(22), zIndex('toast'));
9
+ };
10
+ var templateObject_1, templateObject_2;
@@ -0,0 +1 @@
1
+ export * from './ToastStyle';
@@ -0,0 +1 @@
1
+ export var RC_TOAST_CONTAINER_ID = 'RC_TOAST_CONTAINER';
@@ -0,0 +1 @@
1
+ export * from './ToastUtils';
@@ -7,11 +7,14 @@ var RcConfig = /** @class */ (function () {
7
7
  this._WARNING_FUNCTION = function (message, options) {
8
8
  console[(options === null || options === void 0 ? void 0 : options.level) || 'warn'](message);
9
9
  };
10
- // * get value once when init
11
- this._WARNING_IGNORE =
12
- ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
13
- // * also provide user to set variable from window
14
- window.__JUNO__ = this;
10
+ if (typeof window !== 'undefined') {
11
+ // SSR support
12
+ // * get value once when init
13
+ this._WARNING_IGNORE =
14
+ ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
15
+ // * also provide user to set variable from window
16
+ window.__JUNO__ = this;
17
+ }
15
18
  }
16
19
  Object.defineProperty(RcConfig.prototype, "WARNING_IGNORE", {
17
20
  get: function () {
@@ -1,6 +1,8 @@
1
1
  import { createContext, useContext } from 'react';
2
2
  var RcPortalWindowContext = createContext({
3
- document: document,
3
+ document:
4
+ // directly access `document` will cause error in next.js
5
+ typeof globalThis !== 'undefined' ? globalThis.document : window.document,
4
6
  });
5
7
  var useRcPortalWindowContext = function () { return useContext(RcPortalWindowContext); };
6
8
  export { RcPortalWindowContext, useRcPortalWindowContext };
@@ -3,6 +3,13 @@ import { useId } from '../useId';
3
3
  export var visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
4
4
  /**
5
5
  * read announce when need read message.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const announce = useAnnouncer('simpleId');
10
+ *
11
+ * announce(`You click "Announce" button`);
12
+ * ```
6
13
  */
7
14
  export var useAnnouncer = function (id) {
8
15
  var _id = useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
@@ -56,7 +56,8 @@ export var useKeyboardMoveFocus = function (_a) {
56
56
  // * mean that item is disabled, use same direction find next
57
57
  else {
58
58
  // * find toIndex is same as current, mean that already find all
59
- if (toIndex === Math.max(focusedIndexRef.current, 0)) {
59
+ if (focusedIndexRef.current !== -1 &&
60
+ toIndex === Math.max(focusedIndexRef.current, 0)) {
60
61
  break;
61
62
  }
62
63
  currIndex = toIndex;
@@ -1,9 +1,10 @@
1
- import { __assign } from "tslib";
1
+ import { __assign, __rest } from "tslib";
2
2
  import 'focus-visible';
3
3
  import React from 'react';
4
- import { MuiThemeProvider, StylesProvider } from '@material-ui/core/styles';
4
+ import { MuiThemeProvider, StylesProvider, createGenerateClassName, } from '@material-ui/core/styles';
5
5
  import { ThemeProvider as StyledThemeProvider, useTheme, } from '../styled-components';
6
6
  import createTheme from './createTheme';
7
+ import { useResultRef } from '../hooks';
7
8
  /**
8
9
  * sub theme provider,
9
10
  * that will use when you want use multiple theme in one app
@@ -24,6 +25,18 @@ export var RcSubThemeProvider = function (_a) {
24
25
  * each app should always have one `RcThemeProvider` at root,
25
26
  * if you need multiple, use `RcSubThemeProvider` inside that `RcThemeProvider` */
26
27
  export var RcThemeProvider = function (props) {
27
- return (React.createElement(StylesProvider, { injectFirst: true },
28
- React.createElement(RcSubThemeProvider, __assign({}, props))));
28
+ var prefixGlobalClass = props.prefixGlobalClass, rest = __rest(props, ["prefixGlobalClass"]);
29
+ // cannot pass `generateClassName: undefine`
30
+ // otherwise global class will be random
31
+ var stylesProviderProps = useResultRef(function () {
32
+ return prefixGlobalClass
33
+ ? {
34
+ generateClassName: createGenerateClassName({
35
+ seed: prefixGlobalClass,
36
+ }),
37
+ }
38
+ : {};
39
+ });
40
+ return (React.createElement(StylesProvider, __assign({ injectFirst: true }, stylesProviderProps.current),
41
+ React.createElement(RcSubThemeProvider, __assign({}, rest))));
29
42
  };
@@ -5,5 +5,6 @@
5
5
  "modal": 1300,
6
6
  "snackbar": 1400,
7
7
  "speedDial": 1050,
8
- "tooltip": 1500
8
+ "tooltip": 1500,
9
+ "toast": 3000
9
10
  }
@@ -9,11 +9,14 @@ var RcConfig = /** @class */ (function () {
9
9
  this._WARNING_FUNCTION = function (message, options) {
10
10
  console[(options === null || options === void 0 ? void 0 : options.level) || 'warn'](message);
11
11
  };
12
- // * get value once when init
13
- this._WARNING_IGNORE =
14
- ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
15
- // * also provide user to set variable from window
16
- window.__JUNO__ = this;
12
+ if (typeof window !== 'undefined') {
13
+ // SSR support
14
+ // * get value once when init
15
+ this._WARNING_IGNORE =
16
+ ((_a = window === null || window === void 0 ? void 0 : window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem(JUNO_WARNING_IGNORE_KEY)) === 'true';
17
+ // * also provide user to set variable from window
18
+ window.__JUNO__ = this;
19
+ }
17
20
  }
18
21
  Object.defineProperty(RcConfig.prototype, "WARNING_IGNORE", {
19
22
  get: function () {
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var react_1 = require("react");
4
4
  var RcPortalWindowContext = react_1.createContext({
5
- document: document,
5
+ document:
6
+ // directly access `document` will cause error in next.js
7
+ typeof globalThis !== 'undefined' ? globalThis.document : window.document,
6
8
  });
7
9
  exports.RcPortalWindowContext = RcPortalWindowContext;
8
10
  var useRcPortalWindowContext = function () { return react_1.useContext(RcPortalWindowContext); };
@@ -1,5 +1,12 @@
1
1
  export declare const visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
2
2
  /**
3
3
  * read announce when need read message.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const announce = useAnnouncer('simpleId');
8
+ *
9
+ * announce(`You click "Announce" button`);
10
+ * ```
4
11
  */
5
12
  export declare const useAnnouncer: (id?: string | undefined) => (message?: string | undefined) => void;
@@ -5,6 +5,13 @@ var useId_1 = require("../useId");
5
5
  exports.visuallyHiddenStyles = "\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n";
6
6
  /**
7
7
  * read announce when need read message.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const announce = useAnnouncer('simpleId');
12
+ *
13
+ * announce(`You click "Announce" button`);
14
+ * ```
8
15
  */
9
16
  exports.useAnnouncer = function (id) {
10
17
  var _id = useId_1.useId(id ? "rc-announcer-" + id : 'rc-announcer', !id);
@@ -58,7 +58,8 @@ exports.useKeyboardMoveFocus = function (_a) {
58
58
  // * mean that item is disabled, use same direction find next
59
59
  else {
60
60
  // * find toIndex is same as current, mean that already find all
61
- if (toIndex === Math.max(focusedIndexRef.current, 0)) {
61
+ if (focusedIndexRef.current !== -1 &&
62
+ toIndex === Math.max(focusedIndexRef.current, 0)) {
62
63
  break;
63
64
  }
64
65
  currIndex = toIndex;
@@ -5,6 +5,8 @@ export declare type RcThemeProviderProps = {
5
5
  /** custom theme */
6
6
  theme?: RcThemeInput;
7
7
  children?: ReactNode;
8
+ /** prefix the mui global class */
9
+ prefixGlobalClass?: string;
8
10
  };
9
11
  /**
10
12
  * sub theme provider,
@@ -6,6 +6,7 @@ var react_1 = tslib_1.__importDefault(require("react"));
6
6
  var styles_1 = require("@material-ui/core/styles");
7
7
  var styled_components_1 = require("../styled-components");
8
8
  var createTheme_1 = tslib_1.__importDefault(require("./createTheme"));
9
+ var hooks_1 = require("../hooks");
9
10
  /**
10
11
  * sub theme provider,
11
12
  * that will use when you want use multiple theme in one app
@@ -26,6 +27,18 @@ exports.RcSubThemeProvider = function (_a) {
26
27
  * each app should always have one `RcThemeProvider` at root,
27
28
  * if you need multiple, use `RcSubThemeProvider` inside that `RcThemeProvider` */
28
29
  exports.RcThemeProvider = function (props) {
29
- return (react_1.default.createElement(styles_1.StylesProvider, { injectFirst: true },
30
- react_1.default.createElement(exports.RcSubThemeProvider, tslib_1.__assign({}, props))));
30
+ var prefixGlobalClass = props.prefixGlobalClass, rest = tslib_1.__rest(props, ["prefixGlobalClass"]);
31
+ // cannot pass `generateClassName: undefine`
32
+ // otherwise global class will be random
33
+ var stylesProviderProps = hooks_1.useResultRef(function () {
34
+ return prefixGlobalClass
35
+ ? {
36
+ generateClassName: styles_1.createGenerateClassName({
37
+ seed: prefixGlobalClass,
38
+ }),
39
+ }
40
+ : {};
41
+ });
42
+ return (react_1.default.createElement(styles_1.StylesProvider, tslib_1.__assign({ injectFirst: true }, stylesProviderProps.current),
43
+ react_1.default.createElement(exports.RcSubThemeProvider, tslib_1.__assign({}, rest))));
31
44
  };
@@ -5,5 +5,6 @@
5
5
  "modal": 1300,
6
6
  "snackbar": 1400,
7
7
  "speedDial": 1050,
8
- "tooltip": 1500
8
+ "tooltip": 1500,
9
+ "toast": 3000
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ringcentral/juno",
3
- "version": "1.12.3-beta.5791-ea7a35ca",
3
+ "version": "1.12.4-beta.5841-601f173e",
4
4
  "main": "./index.js",
5
5
  "module": "./es6/index.js",
6
6
  "author": "RingCentral",
@@ -29,8 +29,8 @@
29
29
  "react-beautiful-dnd": "^13.0.0",
30
30
  "react-virtuoso": "^1.9.3",
31
31
  "resize-observer-polyfill": "^1.5.1",
32
- "typeface-lato": "^0.0.75",
33
- "tslib": ">=2.0.0"
32
+ "tslib": ">=2.0.0",
33
+ "typeface-lato": "^0.0.75"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "moment": "^2.29.1",