carbon-react 128.1.2 → 128.3.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 (112) hide show
  1. package/esm/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
  2. package/esm/__internal__/checkable-input/checkable-input.component.js +4 -2
  3. package/esm/__internal__/fieldset/fieldset.style.js +7 -6
  4. package/esm/__internal__/form-field/form-field.component.d.ts +1 -1
  5. package/esm/__internal__/form-field/form-field.component.js +1 -0
  6. package/esm/__internal__/label/label.style.js +6 -5
  7. package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +2 -0
  8. package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +5 -2
  9. package/esm/components/checkbox/checkbox.component.js +3 -0
  10. package/esm/components/date-range/date-range.component.d.ts +5 -1
  11. package/esm/components/date-range/date-range.component.js +5 -1
  12. package/esm/components/decimal/decimal.component.d.ts +0 -2
  13. package/esm/components/decimal/decimal.component.js +1 -2
  14. package/esm/components/fieldset/fieldset.component.d.ts +8 -3
  15. package/esm/components/fieldset/fieldset.component.js +16 -2
  16. package/esm/components/fieldset/fieldset.style.d.ts +4 -0
  17. package/esm/components/fieldset/fieldset.style.js +29 -2
  18. package/esm/components/file-input/file-input.component.d.ts +4 -0
  19. package/esm/components/file-input/file-input.component.js +3 -0
  20. package/esm/components/form/index.d.ts +1 -0
  21. package/esm/components/form/index.js +2 -1
  22. package/esm/components/form/required-fields-indicator/index.d.ts +1 -0
  23. package/esm/components/form/required-fields-indicator/index.js +1 -0
  24. package/esm/components/form/required-fields-indicator/required-fields-indicator.component.d.ts +7 -0
  25. package/esm/components/form/required-fields-indicator/required-fields-indicator.component.js +20 -0
  26. package/esm/components/inline-inputs/inline-inputs.component.d.ts +3 -1
  27. package/esm/components/inline-inputs/inline-inputs.component.js +13 -3
  28. package/esm/components/menu/menu-full-screen/menu-full-screen.component.d.ts +8 -4
  29. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +70 -43
  30. package/esm/components/menu/menu-full-screen/menu-full-screen.style.d.ts +10 -6
  31. package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +43 -20
  32. package/esm/components/numeral-date/numeral-date.component.d.ts +3 -1
  33. package/esm/components/numeral-date/numeral-date.component.js +4 -3
  34. package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -0
  35. package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +5 -3
  36. package/esm/components/radio-button/radio-button.component.d.ts +1 -2
  37. package/esm/components/radio-button/radio-button.component.js +1 -3
  38. package/esm/components/select/filterable-select/filterable-select.component.d.ts +4 -0
  39. package/esm/components/select/filterable-select/filterable-select.component.js +5 -0
  40. package/esm/components/select/multi-select/multi-select.component.d.ts +2 -0
  41. package/esm/components/select/multi-select/multi-select.component.js +5 -0
  42. package/esm/components/select/select-textbox/select-textbox.component.d.ts +2 -0
  43. package/esm/components/select/select-textbox/select-textbox.component.js +3 -0
  44. package/esm/components/select/simple-select/simple-select.component.d.ts +4 -0
  45. package/esm/components/select/simple-select/simple-select.component.js +6 -0
  46. package/esm/components/switch/switch.component.js +1 -0
  47. package/esm/components/text-editor/text-editor.component.d.ts +3 -1
  48. package/esm/components/text-editor/text-editor.component.js +16 -2
  49. package/esm/components/textarea/textarea.component.d.ts +2 -2
  50. package/esm/components/textarea/textarea.component.js +7 -2
  51. package/esm/components/textbox/textbox.component.d.ts +2 -2
  52. package/esm/components/tile-select/tile-select.style.d.ts +1 -1
  53. package/esm/locales/__internal__/es-es.js +5 -0
  54. package/esm/locales/en-gb.js +5 -0
  55. package/esm/locales/locale.d.ts +5 -0
  56. package/lib/__internal__/checkable-input/checkable-input.component.d.ts +2 -0
  57. package/lib/__internal__/checkable-input/checkable-input.component.js +4 -2
  58. package/lib/__internal__/fieldset/fieldset.style.js +7 -6
  59. package/lib/__internal__/form-field/form-field.component.d.ts +1 -1
  60. package/lib/__internal__/form-field/form-field.component.js +1 -0
  61. package/lib/__internal__/label/label.style.js +6 -5
  62. package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +2 -0
  63. package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +5 -2
  64. package/lib/components/checkbox/checkbox.component.js +3 -0
  65. package/lib/components/date-range/date-range.component.d.ts +5 -1
  66. package/lib/components/date-range/date-range.component.js +5 -1
  67. package/lib/components/decimal/decimal.component.d.ts +0 -2
  68. package/lib/components/decimal/decimal.component.js +1 -2
  69. package/lib/components/fieldset/fieldset.component.d.ts +8 -3
  70. package/lib/components/fieldset/fieldset.component.js +18 -2
  71. package/lib/components/fieldset/fieldset.style.d.ts +4 -0
  72. package/lib/components/fieldset/fieldset.style.js +31 -2
  73. package/lib/components/file-input/file-input.component.d.ts +4 -0
  74. package/lib/components/file-input/file-input.component.js +3 -0
  75. package/lib/components/form/index.d.ts +1 -0
  76. package/lib/components/form/index.js +7 -0
  77. package/lib/components/form/required-fields-indicator/index.d.ts +1 -0
  78. package/lib/components/form/required-fields-indicator/index.js +13 -0
  79. package/lib/components/form/required-fields-indicator/package.json +6 -0
  80. package/lib/components/form/required-fields-indicator/required-fields-indicator.component.d.ts +7 -0
  81. package/lib/components/form/required-fields-indicator/required-fields-indicator.component.js +28 -0
  82. package/lib/components/inline-inputs/inline-inputs.component.d.ts +3 -1
  83. package/lib/components/inline-inputs/inline-inputs.component.js +14 -4
  84. package/lib/components/menu/menu-full-screen/menu-full-screen.component.d.ts +8 -4
  85. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +68 -41
  86. package/lib/components/menu/menu-full-screen/menu-full-screen.style.d.ts +10 -6
  87. package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +43 -20
  88. package/lib/components/numeral-date/numeral-date.component.d.ts +3 -1
  89. package/lib/components/numeral-date/numeral-date.component.js +4 -3
  90. package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -0
  91. package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +5 -3
  92. package/lib/components/radio-button/radio-button.component.d.ts +1 -2
  93. package/lib/components/radio-button/radio-button.component.js +1 -3
  94. package/lib/components/select/filterable-select/filterable-select.component.d.ts +4 -0
  95. package/lib/components/select/filterable-select/filterable-select.component.js +5 -0
  96. package/lib/components/select/multi-select/multi-select.component.d.ts +2 -0
  97. package/lib/components/select/multi-select/multi-select.component.js +5 -0
  98. package/lib/components/select/select-textbox/select-textbox.component.d.ts +2 -0
  99. package/lib/components/select/select-textbox/select-textbox.component.js +3 -0
  100. package/lib/components/select/simple-select/simple-select.component.d.ts +4 -0
  101. package/lib/components/select/simple-select/simple-select.component.js +6 -0
  102. package/lib/components/switch/switch.component.js +1 -0
  103. package/lib/components/text-editor/text-editor.component.d.ts +3 -1
  104. package/lib/components/text-editor/text-editor.component.js +16 -2
  105. package/lib/components/textarea/textarea.component.d.ts +2 -2
  106. package/lib/components/textarea/textarea.component.js +7 -2
  107. package/lib/components/textbox/textbox.component.d.ts +2 -2
  108. package/lib/components/tile-select/tile-select.style.d.ts +1 -1
  109. package/lib/locales/__internal__/es-es.js +5 -0
  110. package/lib/locales/en-gb.js +5 -0
  111. package/lib/locales/locale.d.ts +5 -0
  112. package/package.json +1 -1
@@ -21,9 +21,11 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
21
21
  labelId?: string;
22
22
  /** Flag to configure component as mandatory. */
23
23
  required?: boolean;
24
+ /** Flag to configure component as optional. */
25
+ isOptional?: boolean;
24
26
  }
25
27
  declare const InlineInputs: {
26
- ({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): React.JSX.Element;
28
+ ({ adaptiveLabelBreakpoint, label, labelAlign, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, isOptional, ...rest }: InlineInputsProps): React.JSX.Element;
27
29
  displayName: string;
28
30
  };
29
31
  export default InlineInputs;
@@ -4,16 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _label = _interopRequireDefault(require("../../__internal__/label"));
10
10
  var _inlineInputs = _interopRequireWildcard(require("./inline-inputs.style"));
11
11
  var _formSpacingProvider = _interopRequireDefault(require("../../__internal__/form-spacing-provider"));
12
12
  var _useIsAboveBreakpoint = _interopRequireDefault(require("../../hooks/__internal__/useIsAboveBreakpoint"));
13
13
  var _useFormSpacing = _interopRequireDefault(require("../../hooks/__internal__/useFormSpacing"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
18
  const columnWrapper = (children, gutter) => {
19
19
  return _react.default.Children.map(children, input => {
@@ -36,9 +36,11 @@ const InlineInputs = ({
36
36
  labelInline = true,
37
37
  labelWidth,
38
38
  required,
39
+ isOptional,
39
40
  ...rest
40
41
  }) => {
41
42
  const largeScreen = (0, _useIsAboveBreakpoint.default)(adaptiveLabelBreakpoint);
43
+ const ref = (0, _react.useRef)(null);
42
44
  let inlineLabel = labelInline;
43
45
  if (adaptiveLabelBreakpoint) {
44
46
  inlineLabel = largeScreen;
@@ -50,16 +52,24 @@ const InlineInputs = ({
50
52
  labelId: labelId,
51
53
  inline: inlineLabel,
52
54
  htmlFor: htmlFor,
53
- isRequired: required
55
+ isRequired: required,
56
+ optional: isOptional
54
57
  }, label);
55
58
  }
56
59
  const marginProps = (0, _useFormSpacing.default)(rest);
60
+ (0, _react.useEffect)(() => {
61
+ if (required) {
62
+ const elements = Array.from(ref.current?.querySelectorAll("input") || /* istanbul ignore next */[]);
63
+ elements.forEach(el => el.setAttribute("required", ""));
64
+ }
65
+ }, [required]);
57
66
  return /*#__PURE__*/_react.default.createElement(_inlineInputs.default, _extends({
58
67
  gutter: gutter,
59
68
  "data-component": "inline-inputs",
60
69
  className: className,
61
70
  labelWidth: labelWidth,
62
- labelInline: inlineLabel
71
+ labelInline: inlineLabel,
72
+ ref: ref
63
73
  }, marginProps), renderLabel(), /*#__PURE__*/_react.default.createElement(_inlineInputs.StyledContentContainer, {
64
74
  gutter: gutter,
65
75
  "data-element": "inline-inputs-container",
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
- import { TagProps } from "../../../__internal__/utils/helpers/tags";
3
- export interface MenuFullscreenProps extends TagProps {
2
+ import type { TagProps } from "../../../__internal__/utils/helpers/tags";
3
+ export interface MenuFullscreenProps extends Omit<TagProps, "data-component"> {
4
+ /** Accessible name that conveys the purpose of the menu */
5
+ "aria-label"?: string;
4
6
  /** The child elements to render */
5
7
  children?: React.ReactNode;
6
8
  /** Sets whether the component is open or closed */
@@ -8,7 +10,9 @@ export interface MenuFullscreenProps extends TagProps {
8
10
  /** The start position for the component to open from */
9
11
  startPosition?: "left" | "right";
10
12
  /** A callback to be called when the close icon is clicked or enter is pressed when focused */
11
- onClose: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
13
+ onClose: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement> | KeyboardEvent) => void;
14
+ /** Manually override the internal modal stacking order to set this as top */
15
+ topModalOverride?: boolean;
12
16
  }
13
- export declare const MenuFullscreen: ({ children, isOpen, startPosition, onClose, ...rest }: MenuFullscreenProps) => React.JSX.Element;
17
+ export declare const MenuFullscreen: ({ "aria-label": ariaLabel, "data-element": dataElement, "data-role": dataRole, children, isOpen, onClose, startPosition, topModalOverride, }: MenuFullscreenProps) => React.JSX.Element;
14
18
  export default MenuFullscreen;
@@ -6,52 +6,57 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.MenuFullscreen = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _reactTransitionGroup = require("react-transition-group");
9
10
  var _menuFullScreen = require("./menu-full-screen.style");
10
11
  var _menu = require("../menu.style");
11
12
  var _menu2 = _interopRequireDefault(require("../menu.context"));
12
- var _focusTrap = _interopRequireDefault(require("../../../__internal__/focus-trap"));
13
13
  var _events = _interopRequireDefault(require("../../../__internal__/utils/helpers/events"));
14
14
  var _box = _interopRequireDefault(require("../../box"));
15
15
  var _iconButton = _interopRequireDefault(require("../../icon-button"));
16
16
  var _icon = _interopRequireDefault(require("../../icon"));
17
17
  var _portal = _interopRequireDefault(require("../../portal"));
18
+ var _focusTrap = _interopRequireDefault(require("../../../__internal__/focus-trap"));
18
19
  var _menuDivider = _interopRequireDefault(require("../menu-divider/menu-divider.component"));
19
- var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags"));
20
+ var _useLocale = _interopRequireDefault(require("../../../hooks/__internal__/useLocale"));
21
+ var _useModalAria = _interopRequireDefault(require("../../../hooks/__internal__/useModalAria"));
22
+ var _useModalManager = _interopRequireDefault(require("../../../hooks/__internal__/useModalManager"));
20
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
24
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
25
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
24
26
  const MenuFullscreen = ({
27
+ "aria-label": ariaLabel = "Fullscreen menu",
28
+ "data-element": dataElement,
29
+ "data-role": dataRole,
25
30
  children,
26
- isOpen,
27
- startPosition = "left",
31
+ isOpen = false,
28
32
  onClose,
29
- ...rest
33
+ startPosition = "left",
34
+ topModalOverride
30
35
  }) => {
31
- const menuWrapperRef = (0, _react.useRef)(null);
32
- const menuContentRef = (0, _react.useRef)(null);
36
+ const menuRef = (0, _react.useRef)(null);
37
+ const modalRef = (0, _react.useRef)(null);
38
+ const contentRef = (0, _react.useRef)(null);
39
+ const isTopModal = (0, _useModalAria.default)(modalRef);
33
40
  const {
34
41
  menuType
35
42
  } = (0, _react.useContext)(_menu2.default);
36
43
  const isDarkVariant = ["dark", "black"].includes(menuType);
37
- const handleKeyDown = ev => {
38
- /* istanbul ignore else */
39
- if (_events.default.isEscKey(ev)) {
40
- onClose(ev);
41
- }
42
- if (_events.default.isTabKey(ev) && !_events.default.isShiftKey(ev)) {
43
- const search = menuWrapperRef.current?.querySelector('[data-component="search"');
44
- const searchInput = search?.querySelector("input");
45
- const searchButton = search?.querySelector("button");
44
+ const transitionDuration = 200;
45
+ const locale = (0, _useLocale.default)();
46
46
 
47
- // if there is no value in the search input the button disappears when the input blurs
48
- // this means we need to programatically set focus to the next menu item
49
- if (searchButton && searchInput && !searchInput.value && searchInput === document.activeElement) {
50
- ev.preventDefault();
51
- const elements = Array.from(menuWrapperRef.current?.querySelectorAll("a, input, button"));
52
- const index = elements.indexOf(searchInput);
53
- elements[index + 2]?.focus();
54
- }
47
+ // TODO: Remove this temporary event handler as part of FE-6078
48
+ const handleFocusedSearchButton = ev => {
49
+ const search = modalRef.current?.querySelector('[data-component="search"]');
50
+ const searchInput = search?.querySelector("input");
51
+ const searchButton = search?.querySelector("button");
52
+
53
+ // if there is no value in the search input the button disappears when the input blurs
54
+ // this means we need to programmatically set focus to the next menu item
55
+ if (searchButton && searchInput && !searchInput.value && searchInput === document.activeElement) {
56
+ ev.preventDefault();
57
+ const elements = Array.from(modalRef.current?.querySelectorAll("a, input, button"));
58
+ const index = elements.indexOf(searchInput);
59
+ elements[index + 2]?.focus();
55
60
  }
56
61
  };
57
62
  const flattenedChildren = _react.default.Children.toArray(children);
@@ -61,23 +66,45 @@ const MenuFullscreen = ({
61
66
  }
62
67
  return child;
63
68
  }));
64
- return /*#__PURE__*/_react.default.createElement("li", {
65
- "aria-label": "menu-fullscreen"
66
- }, /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
67
- wrapperRef: menuWrapperRef,
68
- isOpen: isOpen
69
- }, /*#__PURE__*/_react.default.createElement(_menuFullScreen.StyledMenuFullscreen, _extends({
70
- ref: menuWrapperRef,
71
- isOpen: isOpen,
72
- menuType: menuType,
69
+ const closeModal = (0, _react.useCallback)(ev => {
70
+ if (onClose && _events.default.isEscKey(ev)) {
71
+ ev.stopImmediatePropagation();
72
+ onClose(ev);
73
+ }
74
+ }, [onClose]);
75
+ (0, _useModalManager.default)({
76
+ open: isOpen,
77
+ closeModal,
78
+ modalRef: menuRef,
79
+ topModalOverride
80
+ });
81
+ return /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.CSSTransition, {
82
+ nodeRef: menuRef,
83
+ in: isOpen,
84
+ timeout: transitionDuration,
85
+ unmountOnExit: true
86
+ }, /*#__PURE__*/_react.default.createElement(_menuFullScreen.StyledMenuFullscreen, {
87
+ ref: menuRef,
73
88
  startPosition: startPosition,
74
- onKeyDown: handleKeyDown
75
- }, rest, (0, _tags.default)("menu-fullscreen", rest)), /*#__PURE__*/_react.default.createElement(_menuFullScreen.StyledMenuFullscreenHeader, {
76
- isOpen: isOpen,
89
+ transitionDuration: transitionDuration
90
+ }, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
91
+ wrapperRef: modalRef,
92
+ isOpen: isOpen
93
+ }, /*#__PURE__*/_react.default.createElement(_menuFullScreen.StyledMenuModal, {
94
+ "aria-label": ariaLabel,
95
+ "aria-modal": isTopModal ? true : undefined,
96
+ "data-component": "menu-fullscreen",
97
+ "data-element": dataElement,
98
+ "data-role": dataRole,
77
99
  menuType: menuType,
78
- startPosition: startPosition
100
+ onKeyDown: ev => _events.default.isTabKey(ev) && !_events.default.isShiftKey(ev) && handleFocusedSearchButton(ev),
101
+ ref: modalRef,
102
+ role: "dialog",
103
+ tabIndex: -1
104
+ }, /*#__PURE__*/_react.default.createElement(_menuFullScreen.StyledMenuFullscreenHeader, {
105
+ menuType: menuType
79
106
  }, /*#__PURE__*/_react.default.createElement(_iconButton.default, {
80
- "aria-label": "menu fullscreen close button",
107
+ "aria-label": locale.menuFullscreen.ariaLabels.closeButton(),
81
108
  onClick: onClose,
82
109
  "data-element": "close"
83
110
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
@@ -91,7 +118,7 @@ const MenuFullscreen = ({
91
118
  }, /*#__PURE__*/_react.default.createElement(_menu.StyledMenuWrapper, {
92
119
  "data-component": "menu",
93
120
  menuType: menuType,
94
- ref: menuContentRef,
121
+ ref: contentRef,
95
122
  display: "flex",
96
123
  flexDirection: "column",
97
124
  role: "list",
@@ -104,7 +131,7 @@ const MenuFullscreen = ({
104
131
  openSubmenuId: null,
105
132
  setOpenSubmenuId: /* istanbul ignore next */() => {}
106
133
  }
107
- }, childArray)))))));
134
+ }, childArray)))))))));
108
135
  };
109
136
  exports.MenuFullscreen = MenuFullscreen;
110
137
  var _default = exports.default = MenuFullscreen;
@@ -1,8 +1,12 @@
1
- import { MenuFullscreenProps } from "./menu-full-screen.component";
2
1
  import { MenuType } from "../menu.context";
3
- interface StyledMenuFullScreenProps extends Pick<MenuFullscreenProps, "isOpen" | "startPosition"> {
2
+ declare const StyledMenuFullscreen: import("styled-components").StyledComponent<"div", any, {
3
+ transitionDuration: number;
4
+ startPosition: "left" | "right";
5
+ }, never>;
6
+ declare const StyledMenuModal: import("styled-components").StyledComponent<"div", any, {
4
7
  menuType: MenuType;
5
- }
6
- declare const StyledMenuFullscreen: import("styled-components").StyledComponent<"div", any, StyledMenuFullScreenProps, never>;
7
- declare const StyledMenuFullscreenHeader: import("styled-components").StyledComponent<"div", any, StyledMenuFullScreenProps, never>;
8
- export { StyledMenuFullscreen, StyledMenuFullscreenHeader };
8
+ }, never>;
9
+ declare const StyledMenuFullscreenHeader: import("styled-components").StyledComponent<"div", any, {
10
+ menuType: MenuType;
11
+ }, never>;
12
+ export { StyledMenuModal, StyledMenuFullscreen, StyledMenuFullscreenHeader };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledMenuFullscreenHeader = exports.StyledMenuFullscreen = void 0;
6
+ exports.StyledMenuModal = exports.StyledMenuFullscreenHeader = exports.StyledMenuFullscreen = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _themes = require("../../../style/themes");
9
9
  var _iconButton = _interopRequireDefault(require("../../icon-button/icon-button.style"));
@@ -17,15 +17,50 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
19
  const oldFocusStyling = `
20
- outline: solid 3px var(--colorsSemanticFocus500);
21
- box-shadow: none;
20
+ outline: solid 3px var(--colorsSemanticFocus500);
21
+ box-shadow: none;
22
22
  `;
23
23
  const StyledMenuFullscreen = exports.StyledMenuFullscreen = _styledComponents.default.div`
24
24
  position: fixed;
25
25
  top: 0;
26
26
  bottom: 0;
27
+
28
+ ${({
29
+ theme
30
+ }) => (0, _styledComponents.css)`
31
+ z-index: ${theme.zIndex.fullScreenModal};
32
+ `}
33
+
34
+ ${({
35
+ startPosition,
36
+ transitionDuration
37
+ }) => (0, _styledComponents.css)`
38
+ &.enter {
39
+ visibility: hidden;
40
+ ${startPosition}: -100%;
41
+ }
42
+
43
+ &.enter-active {
44
+ visibility: visible;
45
+ ${startPosition}: 0;
46
+ transition: all ${transitionDuration}ms ease;
47
+ }
48
+
49
+ &.exit {
50
+ visibility: visible;
51
+ ${startPosition}: 0;
52
+ }
53
+
54
+ &.exit-active {
55
+ visibility: hidden;
56
+ ${startPosition}: -100%;
57
+ transition: all ${transitionDuration}ms ease;
58
+ }
59
+ `}
60
+ `;
61
+ const StyledMenuModal = exports.StyledMenuModal = _styledComponents.default.div`
27
62
  height: 100vh;
28
- width: 100%;
63
+ width: 100vw;
29
64
  outline: none;
30
65
 
31
66
  a,
@@ -35,13 +70,10 @@ const StyledMenuFullscreen = exports.StyledMenuFullscreen = _styledComponents.de
35
70
  }
36
71
 
37
72
  ${({
38
- isOpen,
39
73
  menuType,
40
- startPosition,
41
74
  theme
42
75
  }) => (0, _styledComponents.css)`
43
76
  background-color: ${_menu.default[menuType].background};
44
- z-index: ${theme.zIndex.fullScreenModal};
45
77
 
46
78
  && {
47
79
  ${menuType === "dark" && (0, _styledComponents.css)`
@@ -64,7 +96,7 @@ const StyledMenuFullscreen = exports.StyledMenuFullscreen = _styledComponents.de
64
96
  }
65
97
  `}
66
98
 
67
- ${_search.default} {
99
+ ${_search.default} {
68
100
  ${_icon.default} {
69
101
  display: inline-flex;
70
102
  margin-right: 0;
@@ -85,18 +117,6 @@ const StyledMenuFullscreen = exports.StyledMenuFullscreen = _styledComponents.de
85
117
  }
86
118
  }
87
119
  }
88
-
89
- ${isOpen && (0, _styledComponents.css)`
90
- visibility: visible;
91
- ${startPosition}: 0;
92
- transition: all 0.3s ease;
93
- `}
94
-
95
- ${!isOpen && (0, _styledComponents.css)`
96
- visibility: hidden;
97
- ${startPosition}: -100%;
98
- transition: all 0.3s ease;
99
- `}
100
120
  `}
101
121
 
102
122
  ${_box.default} {
@@ -123,4 +143,7 @@ const StyledMenuFullscreenHeader = exports.StyledMenuFullscreenHeader = _styledC
123
143
  `;
124
144
  StyledMenuFullscreen.defaultProps = {
125
145
  theme: _themes.baseTheme
146
+ };
147
+ StyledMenuModal.defaultProps = {
148
+ theme: _themes.baseTheme
126
149
  };
@@ -87,7 +87,9 @@ export interface NumeralDateProps<DateType extends NumeralDateObject = FullDate>
87
87
  * A React ref to pass to the input corresponding to the year
88
88
  */
89
89
  yearRef?: React.ForwardedRef<HTMLInputElement>;
90
+ /** Flag to configure component as optional. */
91
+ isOptional?: boolean;
90
92
  }
91
93
  export declare type ValidDateFormat = typeof ALLOWED_DATE_FORMATS[number];
92
- export declare const NumeralDate: <DateType extends NumeralDateObject = FullDate>({ dateFormat, defaultValue, disabled, error, warning, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, info, id, name, onBlur, onChange, value, validationOnLabel, label, labelInline, labelWidth, labelAlign, labelHelp, labelSpacing, fieldHelp, adaptiveLabelBreakpoint, required, readOnly, size, enableInternalError, enableInternalWarning, tooltipPosition, helpAriaLabel, dayRef, monthRef, yearRef, ...rest }: NumeralDateProps<DateType>) => React.JSX.Element;
94
+ export declare const NumeralDate: <DateType extends NumeralDateObject = FullDate>({ dateFormat, defaultValue, disabled, error, warning, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, info, id, name, onBlur, onChange, value, validationOnLabel, label, labelInline, labelWidth, labelAlign, labelHelp, labelSpacing, fieldHelp, adaptiveLabelBreakpoint, required, isOptional, readOnly, size, enableInternalError, enableInternalWarning, tooltipPosition, helpAriaLabel, dayRef, monthRef, yearRef, ...rest }: NumeralDateProps<DateType>) => React.JSX.Element;
93
95
  export default NumeralDate;
@@ -112,6 +112,7 @@ const NumeralDate = ({
112
112
  fieldHelp,
113
113
  adaptiveLabelBreakpoint,
114
114
  required,
115
+ isOptional,
115
116
  readOnly,
116
117
  size,
117
118
  enableInternalError,
@@ -224,6 +225,7 @@ const NumeralDate = ({
224
225
  fieldHelp: fieldHelp,
225
226
  adaptiveLabelBreakpoint: adaptiveLabelBreakpoint,
226
227
  isRequired: required,
228
+ isOptional: isOptional,
227
229
  validationRedesignOptIn: validationRedesignOptIn
228
230
  }, (0, _utils.filterStyledSystemMarginProps)(rest)), validationRedesignOptIn && labelHelp && /*#__PURE__*/_react.default.createElement(_textbox2.StyledHintText, null, labelHelp), /*#__PURE__*/_react.default.createElement(_box.default, {
229
231
  position: "relative"
@@ -294,8 +296,6 @@ const NumeralDate = ({
294
296
  error: !!internalError,
295
297
  warning: !!internalWarning,
296
298
  info: !!info
297
- }, required && {
298
- required
299
299
  }, isEnd && !validationRedesignOptIn && !validationOnLabel && {
300
300
  error: internalError,
301
301
  warning: internalWarning,
@@ -303,7 +303,8 @@ const NumeralDate = ({
303
303
  }, {
304
304
  size: size,
305
305
  tooltipPosition: tooltipPosition,
306
- "aria-labelledby": labelId
306
+ "aria-labelledby": labelId,
307
+ required: required
307
308
  })))));
308
309
  }))))));
309
310
  };
@@ -32,6 +32,8 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
32
32
  onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
33
33
  /** Flag to configure component as mandatory */
34
34
  required?: boolean;
35
+ /** Flag to configure component as optional. */
36
+ isOptional?: boolean;
35
37
  /** value of the selected RadioButton */
36
38
  value?: string;
37
39
  /** Overrides the default tooltip position */
@@ -44,6 +44,7 @@ const RadioButtonGroup = props => {
44
44
  adaptiveLegendBreakpoint,
45
45
  adaptiveSpacingBreakpoint,
46
46
  required,
47
+ isOptional,
47
48
  tooltipPosition
48
49
  } = props;
49
50
  const {
@@ -73,7 +74,8 @@ const RadioButtonGroup = props => {
73
74
  legendWidth: legendWidth,
74
75
  legendAlign: legendAlign,
75
76
  legendSpacing: legendSpacing,
76
- isRequired: required
77
+ isRequired: required,
78
+ isOptional: isOptional
77
79
  }, (0, _tags.default)("radiogroup", props), marginProps, {
78
80
  ml: marginLeft,
79
81
  blockGroupBehaviour: !(error || warning)
@@ -119,7 +121,8 @@ const RadioButtonGroup = props => {
119
121
  legendWidth: legendWidth,
120
122
  legendAlign: legendAlign,
121
123
  legendSpacing: legendSpacing,
122
- isRequired: required
124
+ isRequired: required,
125
+ isOptional: isOptional
123
126
  }, (0, _tags.default)("radiogroup", props), marginProps, {
124
127
  ml: marginLeft,
125
128
  blockGroupBehaviour: !(error || warning || info)
@@ -143,7 +146,6 @@ const RadioButtonGroup = props => {
143
146
  error: !!error,
144
147
  warning: !!warning,
145
148
  info: !!info,
146
- required,
147
149
  ...child.props
148
150
  });
149
151
  }))))));
@@ -3,9 +3,8 @@ import { MarginProps } from "styled-system";
3
3
  import { CommonCheckableInputProps } from "../../__internal__/checkable-input";
4
4
  interface InternalRadioButtonProps {
5
5
  inline?: boolean;
6
- required?: boolean;
7
6
  }
8
- export interface RadioButtonProps extends CommonCheckableInputProps, MarginProps {
7
+ export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "required" | "IsOptional">, MarginProps {
9
8
  /** Identifier used for testing purposes, applied to the root element of the component. */
10
9
  "data-component"?: string;
11
10
  /** Identifier used for testing purposes, applied to the root element of the component. */
@@ -38,7 +38,6 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
38
38
  onFocus,
39
39
  value,
40
40
  reverse = false,
41
- required,
42
41
  size,
43
42
  error,
44
43
  warning,
@@ -106,7 +105,6 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
106
105
  * opposite way around by default)
107
106
  */
108
107
  reverse: !reverse,
109
- required,
110
108
  ref: ref || inputRef,
111
109
  ...props
112
110
  };
@@ -234,6 +232,7 @@ if (process.env.NODE_ENV !== "production") {
234
232
  })]),
235
233
  "inputWidth": _propTypes.default.number,
236
234
  "is": _propTypes.default.string,
235
+ "isOptional": _propTypes.default.bool,
237
236
  "itemID": _propTypes.default.string,
238
237
  "itemProp": _propTypes.default.string,
239
238
  "itemRef": _propTypes.default.string,
@@ -574,7 +573,6 @@ if (process.env.NODE_ENV !== "production") {
574
573
  "radioGroup": _propTypes.default.string,
575
574
  "readOnly": _propTypes.default.bool,
576
575
  "rel": _propTypes.default.string,
577
- "required": _propTypes.default.bool,
578
576
  "resource": _propTypes.default.string,
579
577
  "results": _propTypes.default.number,
580
578
  "rev": _propTypes.default.string,
@@ -61,6 +61,10 @@ export interface FilterableSelectProps extends Omit<FormInputPropTypes, "default
61
61
  /** Boolean to disable automatic filtering and highlighting of options.
62
62
  * This allows custom filtering and option styling to be performed outside of the component when the filter text changes. */
63
63
  disableDefaultFiltering?: boolean;
64
+ /** Flag to configure component as optional. */
65
+ isOptional?: boolean;
66
+ /** Flag to configure component as mandatory */
67
+ required?: boolean;
64
68
  }
65
69
  export declare const FilterableSelect: React.ForwardRefExoticComponent<FilterableSelectProps & React.RefAttributes<unknown>>;
66
70
  export default FilterableSelect;
@@ -63,6 +63,8 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
63
63
  enableVirtualScroll,
64
64
  virtualScrollOverscan,
65
65
  disableDefaultFiltering = false,
66
+ isOptional,
67
+ required,
66
68
  ...textboxProps
67
69
  }, ref) => {
68
70
  const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
@@ -406,6 +408,8 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
406
408
  onMouseDown: handleTextboxMouseDown,
407
409
  tooltipPosition,
408
410
  inputRef,
411
+ required,
412
+ isOptional,
409
413
  ...(0, _utils.filterOutStyledSystemSpacingProps)(textboxProps)
410
414
  };
411
415
  }
@@ -574,6 +578,7 @@ if (process.env.NODE_ENV !== "production") {
574
578
  "inputWidth": _propTypes.default.number,
575
579
  "is": _propTypes.default.string,
576
580
  "isLoading": _propTypes.default.bool,
581
+ "isOptional": _propTypes.default.bool,
577
582
  "itemID": _propTypes.default.string,
578
583
  "itemProp": _propTypes.default.string,
579
584
  "itemRef": _propTypes.default.string,
@@ -55,6 +55,8 @@ export interface MultiSelectProps extends Omit<FormInputPropTypes, "defaultValue
55
55
  * Higher values make for smoother scrolling but may impact performance.
56
56
  * Only used if the `enableVirtualScroll` prop is set. */
57
57
  virtualScrollOverscan?: number;
58
+ /** Flag to configure component as optional. */
59
+ isOptional?: boolean;
58
60
  }
59
61
  export declare const MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<unknown>>;
60
62
  export default MultiSelect;
@@ -64,6 +64,8 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
64
64
  inputRef,
65
65
  enableVirtualScroll,
66
66
  virtualScrollOverscan,
67
+ isOptional,
68
+ required,
67
69
  ...textboxProps
68
70
  }, ref) => {
69
71
  const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
@@ -413,6 +415,8 @@ const MultiSelect = exports.MultiSelect = /*#__PURE__*/_react.default.forwardRef
413
415
  onChange: handleTextboxChange,
414
416
  tooltipPosition,
415
417
  size,
418
+ required,
419
+ isOptional,
416
420
  inputRef,
417
421
  ...(0, _utils.filterOutStyledSystemSpacingProps)(textboxProps)
418
422
  };
@@ -583,6 +587,7 @@ if (process.env.NODE_ENV !== "production") {
583
587
  "inputWidth": _propTypes.default.number,
584
588
  "is": _propTypes.default.string,
585
589
  "isLoading": _propTypes.default.bool,
590
+ "isOptional": _propTypes.default.bool,
586
591
  "itemID": _propTypes.default.string,
587
592
  "itemProp": _propTypes.default.string,
588
593
  "itemRef": _propTypes.default.string,
@@ -59,6 +59,8 @@ export interface FormInputPropTypes extends ValidationProps, Omit<CommonTextboxP
59
59
  *
60
60
  */
61
61
  labelId?: string;
62
+ /** Flag to configure component as optional in Form */
63
+ isOptional?: boolean;
62
64
  }
63
65
  export interface SelectTextboxProps extends FormInputPropTypes {
64
66
  /** Id attribute of the select list */
@@ -46,6 +46,7 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
46
46
  onChange,
47
47
  selectedValue,
48
48
  required,
49
+ isOptional,
49
50
  textboxRef,
50
51
  hasTextCursor,
51
52
  transparent,
@@ -89,6 +90,7 @@ const SelectTextbox = /*#__PURE__*/_react.default.forwardRef(({
89
90
  id,
90
91
  readOnly,
91
92
  required,
93
+ isOptional,
92
94
  onClick: handleTextboxClick,
93
95
  onFocus: handleTextboxFocus,
94
96
  onBlur: handleTextboxBlur,
@@ -243,6 +245,7 @@ if (process.env.NODE_ENV !== "production") {
243
245
  "inputWidth": _propTypes.default.number,
244
246
  "is": _propTypes.default.string,
245
247
  "isOpen": _propTypes.default.bool,
248
+ "isOptional": _propTypes.default.bool,
246
249
  "itemID": _propTypes.default.string,
247
250
  "itemProp": _propTypes.default.string,
248
251
  "itemRef": _propTypes.default.string,
@@ -61,6 +61,10 @@ export interface SimpleSelectProps extends Omit<FormInputPropTypes, "defaultValu
61
61
  * Higher values make for smoother scrolling but may impact performance.
62
62
  * Only used if the `enableVirtualScroll` prop is set. */
63
63
  virtualScrollOverscan?: number;
64
+ /** Flag to configure component as optional in Form */
65
+ isOptional?: boolean;
66
+ /** Flag to configure component as mandatory */
67
+ isRequired?: boolean;
64
68
  }
65
69
  export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<unknown>>;
66
70
  export default SimpleSelect;