carbon-react 109.4.0 → 109.5.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 (51) hide show
  1. package/esm/__internal__/form-field/form-field.component.d.ts +59 -0
  2. package/esm/__internal__/form-field/form-field.component.js +202 -57
  3. package/esm/__internal__/form-field/form-field.style.d.ts +7 -0
  4. package/esm/__internal__/form-field/form-field.style.js +6 -12
  5. package/esm/__internal__/form-field/index.d.ts +2 -5
  6. package/esm/__internal__/label/label.component.d.ts +2 -4
  7. package/esm/__internal__/label/label.component.js +0 -3
  8. package/esm/components/button/button-types.style.js +4 -0
  9. package/esm/components/button-toggle-group/button-toggle-group.component.js +9 -10
  10. package/esm/components/button-toggle-group/button-toggle-group.d.ts +3 -1
  11. package/esm/components/icon-button/icon-button.component.d.ts +23 -0
  12. package/esm/components/icon-button/icon-button.component.js +168 -22
  13. package/esm/components/icon-button/icon-button.style.d.ts +4 -0
  14. package/esm/components/icon-button/index.d.ts +2 -2
  15. package/esm/components/loader/loader-square.style.d.ts +2 -0
  16. package/esm/components/loader/loader.config.d.ts +1 -0
  17. package/esm/components/pill/pill.component.d.ts +2 -2
  18. package/esm/components/pill/pill.component.js +7 -9
  19. package/esm/components/popover-container/popover-container.component.d.ts +4 -4
  20. package/esm/components/popover-container/popover-container.style.d.ts +3 -3
  21. package/esm/components/switch/switch.component.js +0 -3
  22. package/esm/components/switch/switch.d.ts +0 -2
  23. package/esm/components/tabs/tab/tab.d.ts +3 -3
  24. package/lib/__internal__/form-field/form-field.component.d.ts +59 -0
  25. package/lib/__internal__/form-field/form-field.component.js +201 -57
  26. package/lib/__internal__/form-field/form-field.style.d.ts +7 -0
  27. package/lib/__internal__/form-field/form-field.style.js +9 -13
  28. package/lib/__internal__/form-field/index.d.ts +2 -5
  29. package/lib/__internal__/label/label.component.d.ts +2 -4
  30. package/lib/__internal__/label/label.component.js +0 -3
  31. package/lib/components/button/button-types.style.js +5 -0
  32. package/lib/components/button-toggle-group/button-toggle-group.component.js +9 -10
  33. package/lib/components/button-toggle-group/button-toggle-group.d.ts +3 -1
  34. package/lib/components/icon-button/icon-button.component.d.ts +23 -0
  35. package/lib/components/icon-button/icon-button.component.js +168 -25
  36. package/lib/components/icon-button/icon-button.style.d.ts +4 -0
  37. package/lib/components/icon-button/index.d.ts +2 -2
  38. package/lib/components/loader/loader-square.style.d.ts +2 -0
  39. package/lib/components/loader/loader.config.d.ts +1 -0
  40. package/lib/components/pill/pill.component.d.ts +2 -2
  41. package/lib/components/pill/pill.component.js +7 -9
  42. package/lib/components/popover-container/popover-container.component.d.ts +4 -4
  43. package/lib/components/popover-container/popover-container.style.d.ts +3 -3
  44. package/lib/components/switch/switch.component.js +0 -3
  45. package/lib/components/switch/switch.d.ts +0 -2
  46. package/lib/components/tabs/tab/tab.d.ts +3 -3
  47. package/package.json +1 -1
  48. package/esm/__internal__/form-field/form-field.d.ts +0 -66
  49. package/esm/components/icon-button/icon-button.d.ts +0 -18
  50. package/lib/__internal__/form-field/form-field.d.ts +0 -66
  51. package/lib/components/icon-button/icon-button.d.ts +0 -18
@@ -2,13 +2,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React, { useState, useCallback } from "react";
4
4
  import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
6
5
  import Events from "../../__internal__/utils/helpers/events";
7
6
  import StyledIconButton from "./icon-button.style";
8
- import Icon from "../icon";
9
7
  import { filterStyledSystemMarginProps } from "../../style/utils";
10
8
  import { TooltipProvider } from "../../__internal__/tooltip-provider";
11
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
12
9
  const IconButton = /*#__PURE__*/React.forwardRef(({
13
10
  "aria-label": ariaLabel,
14
11
  onAction,
@@ -16,10 +13,10 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
16
13
  disabled,
17
14
  ...rest
18
15
  }, ref) => {
19
- const [internalRef, setInternalRef] = useState(null);
16
+ const [internalRef, setInternalRef] = useState();
20
17
  const marginProps = filterStyledSystemMarginProps(rest);
21
18
 
22
- const onKeyDown = e => {
19
+ const handleKeyDown = e => {
23
20
  if (Events.isEnterKey(e) || Events.isSpaceKey(e)) {
24
21
  e.preventDefault();
25
22
  onAction(e);
@@ -28,7 +25,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
28
25
  }
29
26
  };
30
27
 
31
- const handleOnAction = e => {
28
+ const handleOnClick = e => {
32
29
  onAction(e);
33
30
  };
34
31
 
@@ -40,8 +37,8 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
40
37
  }, [ref]);
41
38
  return /*#__PURE__*/React.createElement(StyledIconButton, _extends({}, rest, {
42
39
  "aria-label": ariaLabel,
43
- onKeyDown: onKeyDown,
44
- onClick: handleOnAction,
40
+ onKeyDown: handleKeyDown,
41
+ onClick: handleOnClick,
45
42
  ref: setRefs,
46
43
  disabled: disabled
47
44
  }, marginProps), /*#__PURE__*/React.createElement(TooltipProvider, {
@@ -50,20 +47,169 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
50
47
  target: internalRef
51
48
  }, children));
52
49
  });
53
- IconButton.propTypes = { ...marginPropTypes,
54
-
55
- /** Children prop is restricted to one Icon Component */
56
- children: PropTypes.shape({
57
- type: PropTypes.oneOf([Icon, PropTypes.element])
58
- }).isRequired,
59
-
60
- /** Callback */
61
- onAction: PropTypes.func.isRequired,
62
-
63
- /** Prop to specify the aria-label of the icon-button component */
50
+ IconButton.propTypes = {
64
51
  "aria-label": PropTypes.string,
65
-
66
- /** Set the button to disabled */
67
- disabled: PropTypes.bool
52
+ "children": PropTypes.element.isRequired,
53
+ "disabled": PropTypes.bool,
54
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
55
+ "__@toStringTag": PropTypes.string.isRequired,
56
+ "description": PropTypes.string,
57
+ "toString": PropTypes.func.isRequired,
58
+ "valueOf": PropTypes.func.isRequired
59
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
60
+ "__@toStringTag": PropTypes.string.isRequired,
61
+ "description": PropTypes.string,
62
+ "toString": PropTypes.func.isRequired,
63
+ "valueOf": PropTypes.func.isRequired
64
+ }), PropTypes.string]),
65
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
66
+ "__@toStringTag": PropTypes.string.isRequired,
67
+ "description": PropTypes.string,
68
+ "toString": PropTypes.func.isRequired,
69
+ "valueOf": PropTypes.func.isRequired
70
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
71
+ "__@toStringTag": PropTypes.string.isRequired,
72
+ "description": PropTypes.string,
73
+ "toString": PropTypes.func.isRequired,
74
+ "valueOf": PropTypes.func.isRequired
75
+ }), PropTypes.string]),
76
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
77
+ "__@toStringTag": PropTypes.string.isRequired,
78
+ "description": PropTypes.string,
79
+ "toString": PropTypes.func.isRequired,
80
+ "valueOf": PropTypes.func.isRequired
81
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
82
+ "__@toStringTag": PropTypes.string.isRequired,
83
+ "description": PropTypes.string,
84
+ "toString": PropTypes.func.isRequired,
85
+ "valueOf": PropTypes.func.isRequired
86
+ }), PropTypes.string]),
87
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
88
+ "__@toStringTag": PropTypes.string.isRequired,
89
+ "description": PropTypes.string,
90
+ "toString": PropTypes.func.isRequired,
91
+ "valueOf": PropTypes.func.isRequired
92
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
93
+ "__@toStringTag": PropTypes.string.isRequired,
94
+ "description": PropTypes.string,
95
+ "toString": PropTypes.func.isRequired,
96
+ "valueOf": PropTypes.func.isRequired
97
+ }), PropTypes.string]),
98
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
99
+ "__@toStringTag": PropTypes.string.isRequired,
100
+ "description": PropTypes.string,
101
+ "toString": PropTypes.func.isRequired,
102
+ "valueOf": PropTypes.func.isRequired
103
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
104
+ "__@toStringTag": PropTypes.string.isRequired,
105
+ "description": PropTypes.string,
106
+ "toString": PropTypes.func.isRequired,
107
+ "valueOf": PropTypes.func.isRequired
108
+ }), PropTypes.string]),
109
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
110
+ "__@toStringTag": PropTypes.string.isRequired,
111
+ "description": PropTypes.string,
112
+ "toString": PropTypes.func.isRequired,
113
+ "valueOf": PropTypes.func.isRequired
114
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
115
+ "__@toStringTag": PropTypes.string.isRequired,
116
+ "description": PropTypes.string,
117
+ "toString": PropTypes.func.isRequired,
118
+ "valueOf": PropTypes.func.isRequired
119
+ }), PropTypes.string]),
120
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
121
+ "__@toStringTag": PropTypes.string.isRequired,
122
+ "description": PropTypes.string,
123
+ "toString": PropTypes.func.isRequired,
124
+ "valueOf": PropTypes.func.isRequired
125
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
126
+ "__@toStringTag": PropTypes.string.isRequired,
127
+ "description": PropTypes.string,
128
+ "toString": PropTypes.func.isRequired,
129
+ "valueOf": PropTypes.func.isRequired
130
+ }), PropTypes.string]),
131
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
132
+ "__@toStringTag": PropTypes.string.isRequired,
133
+ "description": PropTypes.string,
134
+ "toString": PropTypes.func.isRequired,
135
+ "valueOf": PropTypes.func.isRequired
136
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
137
+ "__@toStringTag": PropTypes.string.isRequired,
138
+ "description": PropTypes.string,
139
+ "toString": PropTypes.func.isRequired,
140
+ "valueOf": PropTypes.func.isRequired
141
+ }), PropTypes.string]),
142
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
143
+ "__@toStringTag": PropTypes.string.isRequired,
144
+ "description": PropTypes.string,
145
+ "toString": PropTypes.func.isRequired,
146
+ "valueOf": PropTypes.func.isRequired
147
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
148
+ "__@toStringTag": PropTypes.string.isRequired,
149
+ "description": PropTypes.string,
150
+ "toString": PropTypes.func.isRequired,
151
+ "valueOf": PropTypes.func.isRequired
152
+ }), PropTypes.string]),
153
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
154
+ "__@toStringTag": PropTypes.string.isRequired,
155
+ "description": PropTypes.string,
156
+ "toString": PropTypes.func.isRequired,
157
+ "valueOf": PropTypes.func.isRequired
158
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
159
+ "__@toStringTag": PropTypes.string.isRequired,
160
+ "description": PropTypes.string,
161
+ "toString": PropTypes.func.isRequired,
162
+ "valueOf": PropTypes.func.isRequired
163
+ }), PropTypes.string]),
164
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
165
+ "__@toStringTag": PropTypes.string.isRequired,
166
+ "description": PropTypes.string,
167
+ "toString": PropTypes.func.isRequired,
168
+ "valueOf": PropTypes.func.isRequired
169
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
170
+ "__@toStringTag": PropTypes.string.isRequired,
171
+ "description": PropTypes.string,
172
+ "toString": PropTypes.func.isRequired,
173
+ "valueOf": PropTypes.func.isRequired
174
+ }), PropTypes.string]),
175
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
176
+ "__@toStringTag": PropTypes.string.isRequired,
177
+ "description": PropTypes.string,
178
+ "toString": PropTypes.func.isRequired,
179
+ "valueOf": PropTypes.func.isRequired
180
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
181
+ "__@toStringTag": PropTypes.string.isRequired,
182
+ "description": PropTypes.string,
183
+ "toString": PropTypes.func.isRequired,
184
+ "valueOf": PropTypes.func.isRequired
185
+ }), PropTypes.string]),
186
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
187
+ "__@toStringTag": PropTypes.string.isRequired,
188
+ "description": PropTypes.string,
189
+ "toString": PropTypes.func.isRequired,
190
+ "valueOf": PropTypes.func.isRequired
191
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
192
+ "__@toStringTag": PropTypes.string.isRequired,
193
+ "description": PropTypes.string,
194
+ "toString": PropTypes.func.isRequired,
195
+ "valueOf": PropTypes.func.isRequired
196
+ }), PropTypes.string]),
197
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
198
+ "__@toStringTag": PropTypes.string.isRequired,
199
+ "description": PropTypes.string,
200
+ "toString": PropTypes.func.isRequired,
201
+ "valueOf": PropTypes.func.isRequired
202
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
203
+ "__@toStringTag": PropTypes.string.isRequired,
204
+ "description": PropTypes.string,
205
+ "toString": PropTypes.func.isRequired,
206
+ "valueOf": PropTypes.func.isRequired
207
+ }), PropTypes.string]),
208
+ "onAction": PropTypes.func.isRequired,
209
+ "onBlur": PropTypes.func,
210
+ "onFocus": PropTypes.func,
211
+ "onMouseEnter": PropTypes.func,
212
+ "onMouseLeave": PropTypes.func
68
213
  };
214
+ IconButton.displayName = "IconButton";
69
215
  export default IconButton;
@@ -0,0 +1,4 @@
1
+ declare const StyledIconButton: import("styled-components").StyledComponent<"button", any, {
2
+ type: "button";
3
+ }, "type">;
4
+ export default StyledIconButton;
@@ -1,2 +1,2 @@
1
- export { default } from "./icon-button";
2
- export * from "./icon-button";
1
+ export { default } from "./icon-button.component";
2
+ export type { IconButtonProps } from "./icon-button.component";
@@ -0,0 +1,2 @@
1
+ export default StyledLoaderSquare;
2
+ declare const StyledLoaderSquare: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1 @@
1
+ export const LOADER_SIZES: string[];
@@ -12,9 +12,9 @@ export interface PillProps extends StyledPillProps {
12
12
  /** Fills the pill background with colour. When fill is false only the border is coloured. */
13
13
  fill?: boolean;
14
14
  /** Callback function for when the pill is clicked. */
15
- onClick?: React.MouseEventHandler<HTMLSpanElement>;
15
+ onClick?: (ev: React.MouseEvent<HTMLSpanElement>) => void;
16
16
  /** Callback function for when the remove icon is clicked. */
17
- onDelete?: React.MouseEventHandler<HTMLButtonElement>;
17
+ onDelete?: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
18
18
  /** Sets the type of pill in use. */
19
19
  pillRole?: "tag" | "status";
20
20
  }
@@ -7,14 +7,6 @@ import Icon from "../icon";
7
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
8
8
  import IconButton from "../icon-button";
9
9
 
10
- const renderCloseIcon = onDelete => /*#__PURE__*/React.createElement(IconButton, {
11
- onAction: onDelete,
12
- "data-element": "close",
13
- "aria-label": "close"
14
- }, /*#__PURE__*/React.createElement(Icon, {
15
- type: "cross"
16
- }));
17
-
18
10
  const Pill = ({
19
11
  wrapText,
20
12
  borderColor,
@@ -38,7 +30,13 @@ const Pill = ({
38
30
  }, tagComponent("pill", rest), {
39
31
  maxWidth: maxWidth,
40
32
  wrapText: wrapText
41
- }, rest), children, onDelete && renderCloseIcon(onDelete));
33
+ }, rest), children, onDelete && /*#__PURE__*/React.createElement(IconButton, {
34
+ onAction: onDelete,
35
+ "data-element": "close",
36
+ "aria-label": "close"
37
+ }, /*#__PURE__*/React.createElement(Icon, {
38
+ type: "cross"
39
+ })));
42
40
 
43
41
  Pill.propTypes = {
44
42
  "borderColor": PropTypes.string,
@@ -4,7 +4,7 @@ export interface RenderOpenProps {
4
4
  tabIndex: number;
5
5
  isOpen?: boolean;
6
6
  "data-element": string;
7
- onClick: (ev: React.MouseEvent<HTMLElement>) => void;
7
+ onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
8
8
  ref: React.RefObject<HTMLButtonElement>;
9
9
  "aria-label"?: string;
10
10
  id?: string;
@@ -12,7 +12,7 @@ export interface RenderOpenProps {
12
12
  export interface RenderCloseProps {
13
13
  "data-element": string;
14
14
  tabIndex: number;
15
- onClick: (ev: React.MouseEvent<HTMLElement>) => void;
15
+ onClick: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
16
16
  ref: React.RefObject<HTMLButtonElement>;
17
17
  "aria-label": string;
18
18
  }
@@ -36,11 +36,11 @@ export interface PopoverContainerProps extends PaddingProps {
36
36
  /** Sets the popover container dialog header name */
37
37
  title?: string;
38
38
  /** Callback fires when close icon clicked */
39
- onClose?: (ev: React.MouseEvent<HTMLElement> | Event) => void;
39
+ onClose?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement> | Event) => void;
40
40
  /** if `true` the popover-container is open */
41
41
  open?: boolean;
42
42
  /** Callback fires when open component is clicked */
43
- onOpen?: (ev: React.MouseEvent<HTMLElement>) => void;
43
+ onOpen?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => void;
44
44
  /** if `true` the popover-container will cover open button */
45
45
  shouldCoverButton?: boolean;
46
46
  /** The id of the element that describe the dialog. */
@@ -1,5 +1,5 @@
1
+ /// <reference types="react" />
1
2
  import { TransitionStatus } from "react-transition-group";
2
- import IconButton from "../icon-button";
3
3
  declare const PopoverContainerWrapperStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  declare const PopoverContainerHeaderStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  declare type PopoverContainerContentStyleProps = {
@@ -10,7 +10,7 @@ declare type AdditionalIconButtonProps = {
10
10
  tabIndex?: number;
11
11
  id?: string;
12
12
  };
13
- declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<typeof IconButton, any, AdditionalIconButtonProps, never>;
14
- declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<typeof IconButton, any, AdditionalIconButtonProps, never>;
13
+ declare const PopoverContainerOpenIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
14
+ declare const PopoverContainerCloseIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon-button").IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, AdditionalIconButtonProps, never>;
15
15
  declare const PopoverContainerTitleStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
16
16
  export { PopoverContainerWrapperStyle, PopoverContainerHeaderStyle, PopoverContainerContentStyle, PopoverContainerCloseIcon, PopoverContainerTitleStyle, PopoverContainerOpenIcon, };
@@ -184,9 +184,6 @@ Switch.propTypes = {
184
184
  /** When true, validation icon will be placed on label instead of being placed by the input */
185
185
  validationOnLabel: PropTypes.bool,
186
186
 
187
- /** Override tab index on the validation and help icon */
188
- helpTabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
189
-
190
187
  /** Triggers loading animation */
191
188
  loading: PropTypes.bool,
192
189
 
@@ -15,8 +15,6 @@ export interface SwitchProps extends CommonCheckableInputProps, MarginProps {
15
15
  adaptiveLabelBreakpoint?: number;
16
16
  /** Set the default value of the Switch if component is meant to be used as uncontrolled */
17
17
  defaultChecked?: boolean;
18
- /** Overrides the default tabindex of the Help component */
19
- helpTabIndex?: number | string;
20
18
  /** Text alignment of the label */
21
19
  labelAlign?: LabelAlign;
22
20
  /** When true label is inline */
@@ -2,9 +2,9 @@ import * as React from "react";
2
2
  import { PaddingProps } from "styled-system";
3
3
 
4
4
  export interface TabContextProps {
5
- setError: (childId: string, hasError: boolean) => void;
6
- setWarning: (childId: string, hasWarning: boolean) => void;
7
- setInfo: (childId: string, hasInfo: boolean) => void;
5
+ setError?: (childId: string, hasError: boolean) => void;
6
+ setWarning?: (childId: string, hasWarning: boolean) => void;
7
+ setInfo?: (childId: string, hasInfo: boolean) => void;
8
8
  }
9
9
 
10
10
  export interface TabProps extends PaddingProps {
@@ -0,0 +1,59 @@
1
+ import React from "react";
2
+ import { ValidationProps } from "__internal__/validations";
3
+ import { MarginProps } from "styled-system";
4
+ import { TagProps } from "../utils/helpers/tags/tags";
5
+ import { IconType } from "../../components/icon";
6
+ interface CommonFormFieldProps extends MarginProps, ValidationProps {
7
+ /** If true, the component will be disabled */
8
+ disabled?: boolean;
9
+ /** Help content to be displayed under an input */
10
+ fieldHelp?: React.ReactNode;
11
+ /** The unique id of the Help component tooltip, used for accessibility */
12
+ tooltipId?: string;
13
+ /** The unique id of the FieldHelp component */
14
+ fieldHelpId?: string;
15
+ /** Label content */
16
+ label?: React.ReactNode;
17
+ /** Text alignment of the label */
18
+ labelAlign?: "left" | "right";
19
+ /** A message that the Help component will display */
20
+ labelHelp?: React.ReactNode;
21
+ /** Help Icon type */
22
+ labelHelpIcon?: IconType;
23
+ /** The unique id of the label element */
24
+ labelId?: string;
25
+ /** When true label is inline */
26
+ labelInline?: boolean;
27
+ /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
28
+ labelSpacing?: 1 | 2;
29
+ /** Label width */
30
+ labelWidth?: number;
31
+ /** If true the label switches position with the input */
32
+ reverse?: boolean;
33
+ /** Id of the validation icon */
34
+ validationIconId?: string;
35
+ }
36
+ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
37
+ /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
38
+ adaptiveLabelBreakpoint?: number;
39
+ /** Content to be rendered inside the FormField */
40
+ children?: React.ReactNode;
41
+ /**
42
+ * If true, the FieldHelp will be displayed inline
43
+ * To be used with labelInline prop set to true
44
+ */
45
+ fieldHelpInline?: boolean;
46
+ /** Id of the element a label should be bound to */
47
+ id: string;
48
+ /** [Legacy] Flag to configure component as optional in Form */
49
+ isOptional?: boolean;
50
+ /** Flag to configure component as mandatory */
51
+ isRequired?: boolean;
52
+ /** Whether to show the validation icon */
53
+ useValidationIcon?: boolean;
54
+ }
55
+ declare const FormField: {
56
+ ({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, ...rest }: FormFieldProps): JSX.Element;
57
+ displayName: string;
58
+ };
59
+ export default FormField;