carbon-react 104.58.8 → 105.0.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.
Files changed (64) hide show
  1. package/esm/__internal__/popover/popover.component.d.ts +1 -1
  2. package/esm/__internal__/popover/popover.component.js +15 -5
  3. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +2 -1
  4. package/esm/components/menu/menu.component.js +2 -1
  5. package/esm/components/menu/menu.context.d.ts +1 -0
  6. package/esm/components/menu/menu.context.js +2 -1
  7. package/esm/components/menu/menu.d.ts +1 -0
  8. package/esm/components/modal/modal.component.js +2 -1
  9. package/esm/components/select/__internal__/select-text/select-text.component.d.ts +1 -5
  10. package/esm/components/select/__internal__/select-text/select-text.component.js +4 -28
  11. package/esm/components/select/select-textbox/select-textbox.component.js +5 -2
  12. package/esm/components/vertical-divider/index.d.ts +1 -2
  13. package/esm/components/vertical-divider/vertical-divider.component.d.ts +11 -9
  14. package/esm/components/vertical-divider/vertical-divider.component.js +1410 -25
  15. package/esm/components/vertical-divider/vertical-divider.style.d.ts +4 -2
  16. package/esm/components/vertical-divider/vertical-divider.style.js +1 -1
  17. package/lib/__internal__/popover/popover.component.d.ts +1 -1
  18. package/lib/__internal__/popover/popover.component.js +15 -4
  19. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +2 -1
  20. package/lib/components/menu/menu.component.js +2 -1
  21. package/lib/components/menu/menu.context.d.ts +1 -0
  22. package/lib/components/menu/menu.context.js +2 -1
  23. package/lib/components/menu/menu.d.ts +1 -0
  24. package/lib/components/modal/modal.component.js +2 -1
  25. package/lib/components/select/__internal__/select-text/select-text.component.d.ts +1 -5
  26. package/lib/components/select/__internal__/select-text/select-text.component.js +4 -33
  27. package/lib/components/select/select-textbox/select-textbox.component.js +5 -2
  28. package/lib/components/vertical-divider/index.d.ts +1 -2
  29. package/lib/components/vertical-divider/vertical-divider.component.d.ts +11 -9
  30. package/lib/components/vertical-divider/vertical-divider.component.js +1459 -28
  31. package/lib/components/vertical-divider/vertical-divider.style.d.ts +4 -2
  32. package/lib/components/vertical-divider/vertical-divider.style.js +1 -1
  33. package/package.json +1 -1
  34. package/esm/components/row/column/column.component.d.ts +0 -30
  35. package/esm/components/row/column/column.component.js +0 -72
  36. package/esm/components/row/column/column.d.ts +0 -22
  37. package/esm/components/row/column/column.style.d.ts +0 -2
  38. package/esm/components/row/column/column.style.js +0 -32
  39. package/esm/components/row/index.d.ts +0 -2
  40. package/esm/components/row/index.js +0 -2
  41. package/esm/components/row/row.component.d.ts +0 -24
  42. package/esm/components/row/row.component.js +0 -59
  43. package/esm/components/row/row.config.d.ts +0 -11
  44. package/esm/components/row/row.config.js +0 -12
  45. package/esm/components/row/row.d.ts +0 -27
  46. package/esm/components/row/row.style.d.ts +0 -2
  47. package/esm/components/row/row.style.js +0 -53
  48. package/esm/components/vertical-divider/vertical-divider.d.ts +0 -113
  49. package/lib/components/row/column/column.component.d.ts +0 -30
  50. package/lib/components/row/column/column.component.js +0 -87
  51. package/lib/components/row/column/column.d.ts +0 -22
  52. package/lib/components/row/column/column.style.d.ts +0 -2
  53. package/lib/components/row/column/column.style.js +0 -45
  54. package/lib/components/row/index.d.ts +0 -2
  55. package/lib/components/row/index.js +0 -23
  56. package/lib/components/row/package.json +0 -6
  57. package/lib/components/row/row.component.d.ts +0 -24
  58. package/lib/components/row/row.component.js +0 -73
  59. package/lib/components/row/row.config.d.ts +0 -11
  60. package/lib/components/row/row.config.js +0 -20
  61. package/lib/components/row/row.d.ts +0 -27
  62. package/lib/components/row/row.style.d.ts +0 -2
  63. package/lib/components/row/row.style.js +0 -71
  64. package/lib/components/vertical-divider/vertical-divider.d.ts +0 -113
@@ -16,7 +16,7 @@ declare namespace Popover {
16
16
  const modifiers: PropTypes.Requireable<any[]>;
17
17
  const onFirstUpdate: PropTypes.Requireable<(...args: any[]) => any>;
18
18
  const disablePortal: PropTypes.Requireable<boolean>;
19
- const reference: PropTypes.Requireable<PropTypes.InferProps<{
19
+ const reference: PropTypes.Validator<PropTypes.InferProps<{
20
20
  current: PropTypes.Requireable<any>;
21
21
  }>>;
22
22
  }
@@ -1,10 +1,11 @@
1
- import React, { useEffect, useLayoutEffect, useRef } from "react";
1
+ import React, { useContext, useEffect, useLayoutEffect, useRef } from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import PropTypes from "prop-types";
4
4
  import { createPopper } from "@popperjs/core";
5
5
  import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
6
6
  import StyledBackdrop from "./popover.style";
7
7
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
8
+ import { ModalContext } from "../../components/modal/modal.component";
8
9
 
9
10
  const Popover = ({
10
11
  children,
@@ -16,10 +17,18 @@ const Popover = ({
16
17
  disableBackgroundUI
17
18
  }) => {
18
19
  const elementDOM = useRef();
20
+ const {
21
+ isInModal
22
+ } = useContext(ModalContext);
23
+ let mountNode = document.body;
24
+
25
+ if (isInModal && reference.current) {
26
+ mountNode = reference.current.closest("[role='dialog']");
27
+ }
19
28
 
20
29
  if (!elementDOM.current && !disablePortal) {
21
30
  elementDOM.current = document.createElement("div");
22
- document.body.appendChild(elementDOM.current);
31
+ mountNode.appendChild(elementDOM.current);
23
32
  }
24
33
 
25
34
  const popperInstance = useRef();
@@ -68,10 +77,11 @@ const Popover = ({
68
77
  useEffect(() => {
69
78
  return () => {
70
79
  if (!disablePortal) {
71
- document.body.removeChild(elementDOM.current);
80
+ mountNode.removeChild(elementDOM.current);
81
+ elementDOM.current = null;
72
82
  }
73
83
  };
74
- }, [disablePortal]);
84
+ }, [disablePortal, mountNode]);
75
85
 
76
86
  if (disableBackgroundUI) {
77
87
  content = /*#__PURE__*/React.createElement(StyledBackdrop, null, content);
@@ -102,6 +112,6 @@ Popover.propTypes = {
102
112
  // Reference element, children will be positioned in relation to this element - should be a ref
103
113
  reference: PropTypes.shape({
104
114
  current: PropTypes.any
105
- })
115
+ }).isRequired
106
116
  };
107
117
  export default Popover;
@@ -98,7 +98,8 @@ const MenuFullscreen = ({
98
98
  }, React.Children.map(children, (child, index) => /*#__PURE__*/React.createElement(MenuContext.Provider, {
99
99
  value: {
100
100
  inFullscreenView: true,
101
- menuType
101
+ menuType,
102
+ inMenu: true
102
103
  }
103
104
  }, child, index < React.Children.count(children) - 1 && /*#__PURE__*/React.createElement(MenuDivider, null)))))))));
104
105
  };
@@ -43,7 +43,8 @@ const Menu = ({
43
43
  value: {
44
44
  menuType,
45
45
  handleKeyDown: ev => handleKeyDown(ev, index),
46
- isFocused
46
+ isFocused,
47
+ inMenu: true
47
48
  }
48
49
  }, child);
49
50
  }));
@@ -1,5 +1,6 @@
1
1
  declare var _default: React.Context<{
2
2
  menuType: string;
3
+ inMenu: boolean;
3
4
  }>;
4
5
  export default _default;
5
6
  import React from "react";
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
2
  export default /*#__PURE__*/React.createContext({
3
- menuType: "light"
3
+ menuType: "light",
4
+ inMenu: false
4
5
  });
@@ -8,6 +8,7 @@ interface MenuContextProps {
8
8
  handleKeyDown: (ev, submenuOpen) => void;
9
9
  isFocused: boolean;
10
10
  openSubmenu: boolean;
11
+ inMenu: boolean;
11
12
  }
12
13
 
13
14
  export interface MenuProps extends LayoutProps, FlexBoxProps {
@@ -140,7 +140,8 @@ const Modal = ({
140
140
  }, /*#__PURE__*/React.createElement(ModalContext.Provider, {
141
141
  value: {
142
142
  isAnimationComplete,
143
- triggerRefocusFlag
143
+ triggerRefocusFlag,
144
+ isInModal: true
144
145
  }
145
146
  }, content)))));
146
147
  };
@@ -1,11 +1,9 @@
1
1
  export default SelectText;
2
- declare function SelectText({ disabled, formattedValue, onClick, onKeyDown, onFocus, onBlur, onMouseDown, placeholder, readOnly, textId, transparent, }: {
2
+ declare function SelectText({ disabled, formattedValue, onClick, onKeyDown, onMouseDown, placeholder, readOnly, textId, transparent, }: {
3
3
  disabled: any;
4
4
  formattedValue?: string | undefined;
5
5
  onClick: any;
6
6
  onKeyDown: any;
7
- onFocus: any;
8
- onBlur: any;
9
7
  onMouseDown: any;
10
8
  placeholder: any;
11
9
  readOnly: any;
@@ -16,9 +14,7 @@ declare namespace SelectText {
16
14
  namespace propTypes {
17
15
  const disabled: PropTypes.Requireable<boolean>;
18
16
  const formattedValue: PropTypes.Requireable<string>;
19
- const onBlur: PropTypes.Requireable<(...args: any[]) => any>;
20
17
  const onClick: PropTypes.Requireable<(...args: any[]) => any>;
21
- const onFocus: PropTypes.Requireable<(...args: any[]) => any>;
22
18
  const onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
23
19
  const onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
24
20
  const placeholder: PropTypes.Requireable<string>;
@@ -1,38 +1,22 @@
1
- import React, { useContext } from "react";
1
+ import React from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import StyledSelectText from "./select-text.style";
4
- import { InputContext } from "../../../../__internal__/input-behaviour";
5
4
 
6
5
  const SelectText = ({
7
6
  disabled,
8
7
  formattedValue = "",
9
8
  onClick,
10
9
  onKeyDown,
11
- onFocus,
12
- onBlur,
13
10
  onMouseDown,
14
11
  placeholder,
15
12
  readOnly,
16
13
  textId,
17
14
  transparent
18
15
  }) => {
19
- const inputContext = useContext(InputContext);
20
16
  const hasPlaceholder = !disabled && !readOnly && !formattedValue;
21
17
 
22
- function handleFocus(event) {
23
- inputContext.onFocus(event);
24
-
25
- if (onFocus) {
26
- onFocus(event);
27
- }
28
- }
29
-
30
- function handleBlur(event) {
31
- inputContext.onBlur(event);
32
-
33
- if (onBlur) {
34
- onBlur(event);
35
- }
18
+ function handleClick(event) {
19
+ onClick(event);
36
20
  }
37
21
 
38
22
  return /*#__PURE__*/React.createElement(StyledSelectText, {
@@ -41,9 +25,7 @@ const SelectText = ({
41
25
  disabled: disabled,
42
26
  hasPlaceholder: hasPlaceholder,
43
27
  id: textId,
44
- onBlur: handleBlur,
45
- onClick: onClick,
46
- onFocus: handleFocus,
28
+ onClick: handleClick,
47
29
  onKeyDown: onKeyDown,
48
30
  onMouseDown: onMouseDown,
49
31
  readOnly: readOnly,
@@ -60,15 +42,9 @@ SelectText.propTypes = {
60
42
  /** Value to be displayed */
61
43
  formattedValue: PropTypes.string,
62
44
 
63
- /** Callback function for when the Select Textbox loses it's focus. */
64
- onBlur: PropTypes.func,
65
-
66
45
  /** Callback function for when the component is clicked. */
67
46
  onClick: PropTypes.func,
68
47
 
69
- /** Callback function for when the Select Textbox is focused. */
70
- onFocus: PropTypes.func,
71
-
72
48
  /** Callback function for when the key is pressed when focused on Select Text. */
73
49
  onKeyDown: PropTypes.func,
74
50
 
@@ -150,8 +150,11 @@ const SelectTextbox = ({
150
150
  textId: textId.current,
151
151
  transparent: transparent,
152
152
  onKeyDown: handleSelectTextKeydown,
153
- placeholder: placeholder || l.select.placeholder()
154
- }, getTextboxProps()));
153
+ placeholder: placeholder || l.select.placeholder(),
154
+ onClick: handleTextboxClick,
155
+ disabled: disabled,
156
+ readOnly: readOnly
157
+ }, restProps));
155
158
  }
156
159
 
157
160
  function handleSelectTextKeydown(event) {
@@ -1,2 +1 @@
1
- export { default } from "./vertical-divider";
2
- export * from "./vertical-divider";
1
+ export { default } from "./vertical-divider.component";
@@ -1,10 +1,12 @@
1
- export default VerticalDivider;
2
- declare function VerticalDivider({ h, displayInline, tint, ...props }: {
3
- [x: string]: any;
4
- h: any;
5
- displayInline?: boolean | undefined;
6
- tint?: number | undefined;
7
- }): JSX.Element;
8
- declare namespace VerticalDivider {
9
- const propTypes: any;
1
+ /// <reference types="react" />
2
+ import { SpaceProps } from "styled-system";
3
+ declare type TintRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
4
+ export interface VerticalDividerPropTypes extends SpaceProps {
5
+ h?: number | string;
6
+ height?: number | string;
7
+ displayInline?: boolean;
8
+ /** the supported rage is 1-100 */
9
+ tint?: TintRange;
10
10
  }
11
+ declare const VerticalDivider: ({ h, height, displayInline, tint, ...props }: VerticalDividerPropTypes) => JSX.Element;
12
+ export default VerticalDivider;