@carbon/react 1.46.1-rc.0 → 1.47.0-rc.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 (101) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +933 -899
  2. package/es/components/Accordion/AccordionItem.js +3 -1
  3. package/es/components/ContentSwitcher/index.d.ts +11 -0
  4. package/es/components/DataTable/TableExpandRow.d.ts +1 -1
  5. package/es/components/DataTable/TableHeader.d.ts +1 -1
  6. package/es/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
  7. package/es/components/ErrorBoundary/ErrorBoundary.js +2 -0
  8. package/es/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
  9. package/es/components/ErrorBoundary/index.d.ts +8 -0
  10. package/es/components/FeatureFlags/index.js +2 -2
  11. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
  12. package/es/components/InlineCheckbox/InlineCheckbox.js +8 -1
  13. package/es/components/ModalWrapper/ModalWrapper.d.ts +75 -0
  14. package/es/components/ModalWrapper/ModalWrapper.js +15 -14
  15. package/es/components/ModalWrapper/index.d.ts +9 -0
  16. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  17. package/es/components/PrimaryButton/PrimaryButton.d.ts +10 -0
  18. package/es/components/PrimaryButton/PrimaryButton.js +1 -2
  19. package/es/components/PrimaryButton/index.d.ts +9 -0
  20. package/es/components/ProgressBar/ProgressBar.d.ts +88 -0
  21. package/es/components/ProgressBar/ProgressBar.js +13 -11
  22. package/es/components/ProgressBar/index.d.ts +9 -0
  23. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
  24. package/es/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
  25. package/es/components/ProgressIndicator/ProgressIndicator.js +4 -6
  26. package/es/components/ProgressIndicator/index.d.ts +8 -0
  27. package/es/components/Search/Search.js +3 -2
  28. package/es/components/SecondaryButton/SecondaryButton.d.ts +10 -0
  29. package/es/components/SecondaryButton/SecondaryButton.js +1 -2
  30. package/es/components/SecondaryButton/index.d.ts +9 -0
  31. package/es/components/SkeletonIcon/SkeletonIcon.js +1 -2
  32. package/es/components/SkeletonIcon/index.d.ts +9 -0
  33. package/es/components/Slider/Slider.Skeleton.js +1 -2
  34. package/es/components/Slider/Slider.d.ts +1 -1
  35. package/es/components/Slider/index.d.ts +11 -0
  36. package/es/components/Stack/Stack.d.ts +58 -0
  37. package/es/components/Stack/Stack.js +0 -1
  38. package/es/components/Stack/index.d.ts +11 -0
  39. package/es/components/Switch/Switch.js +1 -2
  40. package/es/components/Switch/index.d.ts +10 -0
  41. package/es/components/TextArea/TextArea.d.ts +5 -0
  42. package/es/components/TextArea/TextArea.js +9 -0
  43. package/es/components/TileGroup/TileGroup.d.ts +83 -0
  44. package/es/components/TileGroup/TileGroup.js +67 -79
  45. package/es/components/Toggle/Toggle.d.ts +1 -1
  46. package/es/components/TreeView/TreeNode.js +3 -0
  47. package/es/components/UIShell/SideNavMenu.js +0 -8
  48. package/es/components/UIShell/SideNavSwitcher.d.ts +1 -1
  49. package/es/index.js +12 -12
  50. package/es/internal/createClassWrapper.d.ts +12 -0
  51. package/es/internal/createClassWrapper.js +0 -3
  52. package/lib/components/Accordion/AccordionItem.js +3 -1
  53. package/lib/components/ContentSwitcher/index.d.ts +11 -0
  54. package/lib/components/DataTable/TableExpandRow.d.ts +1 -1
  55. package/lib/components/DataTable/TableHeader.d.ts +1 -1
  56. package/lib/components/ErrorBoundary/ErrorBoundary.d.ts +47 -0
  57. package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -0
  58. package/lib/components/ErrorBoundary/ErrorBoundaryContext.d.ts +11 -0
  59. package/lib/components/ErrorBoundary/index.d.ts +8 -0
  60. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +3 -2
  61. package/lib/components/InlineCheckbox/InlineCheckbox.js +8 -1
  62. package/lib/components/ModalWrapper/ModalWrapper.d.ts +75 -0
  63. package/lib/components/ModalWrapper/ModalWrapper.js +15 -14
  64. package/lib/components/ModalWrapper/index.d.ts +9 -0
  65. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  66. package/lib/components/PrimaryButton/PrimaryButton.d.ts +10 -0
  67. package/lib/components/PrimaryButton/PrimaryButton.js +1 -2
  68. package/lib/components/PrimaryButton/index.d.ts +9 -0
  69. package/lib/components/ProgressBar/ProgressBar.d.ts +88 -0
  70. package/lib/components/ProgressBar/ProgressBar.js +13 -11
  71. package/lib/components/ProgressBar/index.d.ts +9 -0
  72. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.d.ts +33 -0
  73. package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +179 -0
  74. package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -6
  75. package/lib/components/ProgressIndicator/index.d.ts +8 -0
  76. package/lib/components/Search/Search.js +3 -2
  77. package/lib/components/SecondaryButton/SecondaryButton.d.ts +10 -0
  78. package/lib/components/SecondaryButton/SecondaryButton.js +1 -2
  79. package/lib/components/SecondaryButton/index.d.ts +9 -0
  80. package/lib/components/SkeletonIcon/SkeletonIcon.js +1 -2
  81. package/lib/components/SkeletonIcon/index.d.ts +9 -0
  82. package/lib/components/Slider/Slider.Skeleton.js +1 -2
  83. package/lib/components/Slider/Slider.d.ts +1 -1
  84. package/lib/components/Slider/index.d.ts +11 -0
  85. package/lib/components/Stack/Stack.d.ts +58 -0
  86. package/lib/components/Stack/Stack.js +0 -1
  87. package/lib/components/Stack/index.d.ts +11 -0
  88. package/lib/components/Switch/Switch.js +1 -2
  89. package/lib/components/Switch/index.d.ts +10 -0
  90. package/lib/components/TextArea/TextArea.d.ts +5 -0
  91. package/lib/components/TextArea/TextArea.js +9 -0
  92. package/lib/components/TileGroup/TileGroup.d.ts +83 -0
  93. package/lib/components/TileGroup/TileGroup.js +64 -76
  94. package/lib/components/Toggle/Toggle.d.ts +1 -1
  95. package/lib/components/TreeView/TreeNode.js +3 -0
  96. package/lib/components/UIShell/SideNavMenu.js +0 -8
  97. package/lib/components/UIShell/SideNavSwitcher.d.ts +1 -1
  98. package/lib/index.js +25 -25
  99. package/lib/internal/createClassWrapper.d.ts +12 -0
  100. package/lib/internal/createClassWrapper.js +0 -3
  101. package/package.json +6 -5
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
10
+ /**
11
+ * Provide `<ProgressStep>` components to be rendered in the
12
+ * `<ProgressIndicator>`
13
+ */
14
+ children?: React.ReactNode;
15
+ /**
16
+ * Provide an optional className to be applied to the containing node
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Optionally specify the current step array index
21
+ */
22
+ currentIndex?: number;
23
+ /**
24
+ * Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
25
+ */
26
+ onChange?: (data: number) => void;
27
+ /**
28
+ * Specify whether the progress steps should be split equally in size in the div
29
+ */
30
+ spaceEqually?: boolean;
31
+ /**
32
+ * Determines whether or not the ProgressIndicator should be rendered vertically.
33
+ */
34
+ vertical?: boolean;
35
+ }
36
+ declare function ProgressIndicator({ children, className: customClassName, currentIndex: controlledIndex, onChange, spaceEqually, vertical, ...rest }: ProgressIndicatorProps): JSX.Element;
37
+ declare namespace ProgressIndicator {
38
+ var propTypes: {
39
+ /**
40
+ * Provide `<ProgressStep>` components to be rendered in the
41
+ * `<ProgressIndicator>`
42
+ */
43
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
44
+ /**
45
+ * Provide an optional className to be applied to the containing node
46
+ */
47
+ className: PropTypes.Requireable<string>;
48
+ /**
49
+ * Optionally specify the current step array index
50
+ */
51
+ currentIndex: PropTypes.Requireable<number>;
52
+ /**
53
+ * Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
54
+ */
55
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
56
+ /**
57
+ * Specify whether the progress steps should be split equally in size in the div
58
+ */
59
+ spaceEqually: PropTypes.Requireable<boolean>;
60
+ /**
61
+ * Determines whether or not the ProgressIndicator should be rendered vertically.
62
+ */
63
+ vertical: PropTypes.Requireable<boolean>;
64
+ };
65
+ }
66
+ interface ProgressStepProps {
67
+ /**
68
+ * Provide an optional className to be applied to the containing `<li>` node
69
+ */
70
+ className?: string;
71
+ /**
72
+ * Specify whether the step has been completed
73
+ */
74
+ complete?: boolean;
75
+ /**
76
+ * Specify whether the step is the current step
77
+ */
78
+ current?: boolean;
79
+ /**
80
+ * Provide a description for the `<ProgressStep>`
81
+ */
82
+ description?: string;
83
+ /**
84
+ * Specify whether the step is disabled
85
+ */
86
+ disabled?: boolean;
87
+ /**
88
+ * Index of the current step within the ProgressIndicator
89
+ */
90
+ index?: number;
91
+ /**
92
+ * Specify whether the step is invalid
93
+ */
94
+ invalid?: boolean;
95
+ /**
96
+ * Provide the label for the `<ProgressStep>`
97
+ */
98
+ label: string;
99
+ /**
100
+ * A callback called if the step is clicked or the enter key is pressed
101
+ */
102
+ onClick?: (event: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
103
+ /**
104
+ * Provide the props that describe a progress step tooltip
105
+ */
106
+ overflowTooltipProps?: object;
107
+ /**
108
+ * Provide an optional secondary label
109
+ */
110
+ secondaryLabel?: string;
111
+ /**
112
+ * The ID of the tooltip content.
113
+ */
114
+ tooltipId?: string;
115
+ /**
116
+ * Optional method that takes in a message id and returns an
117
+ * internationalized string.
118
+ */
119
+ translateWithId?: (id: string) => string;
120
+ }
121
+ declare function ProgressStep({ label, description, className, current, complete, invalid, secondaryLabel, disabled, onClick, translateWithId: t, ...rest }: ProgressStepProps): JSX.Element;
122
+ declare namespace ProgressStep {
123
+ var propTypes: {
124
+ /**
125
+ * Provide an optional className to be applied to the containing `<li>` node
126
+ */
127
+ className: PropTypes.Requireable<string>;
128
+ /**
129
+ * Specify whether the step has been completed
130
+ */
131
+ complete: PropTypes.Requireable<boolean>;
132
+ /**
133
+ * Specify whether the step is the current step
134
+ */
135
+ current: PropTypes.Requireable<boolean>;
136
+ /**
137
+ * Provide a description for the `<ProgressStep>`
138
+ */
139
+ description: PropTypes.Requireable<string>;
140
+ /**
141
+ * Specify whether the step is disabled
142
+ */
143
+ disabled: PropTypes.Requireable<boolean>;
144
+ /**
145
+ * Index of the current step within the ProgressIndicator
146
+ */
147
+ index: PropTypes.Requireable<number>;
148
+ /**
149
+ * Specify whether the step is invalid
150
+ */
151
+ invalid: PropTypes.Requireable<boolean>;
152
+ /**
153
+ * Provide the label for the `<ProgressStep>`
154
+ */
155
+ label: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
156
+ /**
157
+ * A callback called if the step is clicked or the enter key is pressed
158
+ */
159
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
160
+ /**
161
+ * Provide the props that describe a progress step tooltip
162
+ */
163
+ overflowTooltipProps: PropTypes.Requireable<object>;
164
+ /**
165
+ * Provide an optional secondary label
166
+ */
167
+ secondaryLabel: PropTypes.Requireable<string>;
168
+ /**
169
+ * The ID of the tooltip content.
170
+ */
171
+ tooltipId: PropTypes.Requireable<string>;
172
+ /**
173
+ * Optional method that takes in a message id and returns an
174
+ * internationalized string.
175
+ */
176
+ translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
177
+ };
178
+ }
179
+ export { ProgressIndicator, ProgressStep };
@@ -42,7 +42,7 @@ function ProgressIndicator(_ref) {
42
42
  [`${prefix}--progress`]: true,
43
43
  [`${prefix}--progress--vertical`]: vertical,
44
44
  [`${prefix}--progress--space-equal`]: spaceEqually && !vertical,
45
- [customClassName]: customClassName
45
+ [customClassName ?? '']: customClassName
46
46
  });
47
47
  if (controlledIndex !== prevControlledIndex) {
48
48
  setCurrentIndex(controlledIndex);
@@ -130,15 +130,13 @@ function ProgressStep(_ref2) {
130
130
  [`${prefix}--progress-step--complete`]: complete,
131
131
  [`${prefix}--progress-step--incomplete`]: !complete && !current,
132
132
  [`${prefix}--progress-step--disabled`]: disabled,
133
- [className]: className
133
+ [className ?? '']: className
134
134
  });
135
135
  const handleKeyDown = e => {
136
- if (matches(e, [Enter, Space])) {
137
- onClick();
136
+ if (matches(e, [Enter, Space]) && onClick) {
137
+ onClick(e);
138
138
  }
139
139
  };
140
-
141
- // eslint-disable-next-line react/prop-types
142
140
  const SVGIcon = _ref3 => {
143
141
  let {
144
142
  complete,
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ export { default as ProgressIndicatorSkeleton } from './ProgressIndicator.Skeleton';
8
+ export * from './ProgressIndicator';
@@ -120,14 +120,15 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
120
120
  "aria-label": placeholder,
121
121
  className: searchClasses
122
122
  }, /*#__PURE__*/React__default.createElement("div", {
123
+ "aria-label": "button",
123
124
  "aria-labelledby": onExpand ? uniqueId : undefined,
124
- role: onExpand ? 'button' : undefined,
125
+ role: "button",
125
126
  className: `${prefix}--search-magnifier`,
126
127
  onClick: onExpand,
127
128
  onKeyDown: handleExpandButtonKeyDown,
128
129
  tabIndex: onExpand && !isExpanded ? 0 : -1,
129
130
  ref: expandButtonRef,
130
- "aria-expanded": onExpand && isExpanded ? true : undefined,
131
+ "aria-expanded": onExpand && isExpanded ? true : false,
131
132
  "aria-controls": onExpand ? uniqueId : undefined
132
133
  }, /*#__PURE__*/React__default.createElement(CustomSearchIcon, {
133
134
  icon: renderIcon
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import { ButtonProps } from '../Button';
9
+ declare const SecondaryButton: <T extends React.ElementType<any>>(props: ButtonProps<T>) => JSX.Element;
10
+ export default SecondaryButton;
@@ -13,6 +13,5 @@ import '../Button/Button.Skeleton.js';
13
13
  const SecondaryButton = props => /*#__PURE__*/React__default.createElement(Button, _extends({
14
14
  kind: "secondary"
15
15
  }, props));
16
- var SecondaryButton$1 = SecondaryButton;
17
16
 
18
- export { SecondaryButton$1 as default };
17
+ export { SecondaryButton as default };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import SecondaryButton from './SecondaryButton';
8
+ export default SecondaryButton;
9
+ export { SecondaryButton };
@@ -34,6 +34,5 @@ SkeletonIcon.propTypes = {
34
34
  */
35
35
  style: PropTypes.object
36
36
  };
37
- var SkeletonIcon$1 = SkeletonIcon;
38
37
 
39
- export { SkeletonIcon$1 as default };
38
+ export { SkeletonIcon as default };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import SkeletonIcon from './SkeletonIcon';
8
+ export default SkeletonIcon;
9
+ export { SkeletonIcon };
@@ -78,6 +78,5 @@ SliderSkeleton.propTypes = {
78
78
  */
79
79
  twoHandles: PropTypes.bool
80
80
  };
81
- var SliderSkeleton$1 = SliderSkeleton;
82
81
 
83
- export { SliderSkeleton, SliderSkeleton$1 as default };
82
+ export { SliderSkeleton, SliderSkeleton as default };
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import React, { KeyboardEventHandler, PureComponent } from 'react';
7
+ import React, { type KeyboardEventHandler, PureComponent } from 'react';
8
8
  import PropTypes, { ReactNodeLike } from 'prop-types';
9
9
  /**
10
10
  * Distinguish two handles by lower and upper positions.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference types="react" />
8
+ declare const Slider: import("react").FunctionComponent<import("./Slider").SliderProps>;
9
+ export { default as SliderSkeleton } from './Slider.Skeleton';
10
+ export default Slider;
11
+ export { Slider };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ /**
9
+ * The steps in the spacing scale
10
+ * @type {Array<number>}
11
+ */
12
+ declare const SPACING_STEPS: number[];
13
+ interface StackProps extends React.HTMLAttributes<HTMLElement> {
14
+ /**
15
+ * Provide a custom element type to render as the outermost element in
16
+ * the Stack component. By default, this component will render a `div`.
17
+ */
18
+ as?: (() => React.ReactNode) | string | React.ElementType;
19
+ /**
20
+ * Provide the elements that will be rendered as children inside of the Stack
21
+ * component. These elements will have having spacing between them according
22
+ * to the `step` and `orientation` prop
23
+ */
24
+ children?: React.ReactNode;
25
+ /**
26
+ * Provide a custom class name to be used by the outermost element rendered by
27
+ * Stack
28
+ */
29
+ className?: string;
30
+ /**
31
+ * Provide either a custom value or a step from the spacing scale to be used
32
+ * as the gap in the layout
33
+ */
34
+ gap?: string | (typeof SPACING_STEPS)[number];
35
+ /**
36
+ * Specify the orientation of them items in the Stack
37
+ */
38
+ orientation?: 'horizontal' | 'vertical';
39
+ }
40
+ /**
41
+ * The Stack component is a useful layout utility in a component-based model.
42
+ * This allows components to not use margin and instead delegate the
43
+ * responsibility of positioning and layout to parent components.
44
+ *
45
+ * In the case of the Stack component, it uses the spacing scale from the
46
+ * Design Language in order to determine how much space there should be between
47
+ * items rendered by the Stack component. It also supports a custom `gap` prop
48
+ * which will allow a user to provide a custom value for the gap of the layout.
49
+ *
50
+ * This component supports both horizontal and vertical orientations.
51
+ *
52
+ * Inspiration for this component:
53
+ *
54
+ * - https://paste.twilio.design/layout/stack/
55
+ * - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
56
+ */
57
+ declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<React.ReactNode>>;
58
+ export { Stack };
@@ -21,7 +21,6 @@ const SPACING_STEPS = Array.from({
21
21
  }).map((_, step) => {
22
22
  return step + 1;
23
23
  });
24
-
25
24
  /**
26
25
  * The Stack component is a useful layout utility in a component-based model.
27
26
  * This allows components to not use margin and instead delegate the
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ import { Stack } from './Stack';
9
+ declare const HStack: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
10
+ declare const VStack: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
11
+ export { HStack, Stack, VStack };
@@ -105,6 +105,5 @@ Switch.propTypes = {
105
105
  */
106
106
  text: PropTypes.string
107
107
  };
108
- var Switch$1 = Switch;
109
108
 
110
- export { Switch$1 as default };
109
+ export { Switch as default };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import Switch from './Switch';
8
+ import IconSwitch from './IconSwitch';
9
+ export default Switch;
10
+ export { Switch, IconSwitch };
@@ -73,6 +73,11 @@ export interface TextAreaProps extends React.InputHTMLAttributes<HTMLTextAreaEle
73
73
  * `<textarea>` is clicked
74
74
  */
75
75
  onClick?: (evt: React.MouseEvent<HTMLTextAreaElement>) => void;
76
+ /**
77
+ * Optionally provide an `onKeyDown` handler that is called whenever `<textarea>`
78
+ * is keyed
79
+ */
80
+ onKeyDown?: (evt: React.KeyboardEvent<HTMLTextAreaElement>) => void;
76
81
  /**
77
82
  * Specify the placeholder attribute for the `<textarea>`
78
83
  */
@@ -32,6 +32,7 @@ const TextArea = /*#__PURE__*/React__default.forwardRef((props, forwardRef) => {
32
32
  hideLabel,
33
33
  onChange = noopFn,
34
34
  onClick = noopFn,
35
+ onKeyDown = noopFn,
35
36
  invalid = false,
36
37
  invalidText = '',
37
38
  helperText = '',
@@ -90,6 +91,9 @@ const TextArea = /*#__PURE__*/React__default.forwardRef((props, forwardRef) => {
90
91
  evt.preventDefault();
91
92
  }
92
93
  }
94
+ if (!disabled && onKeyDown) {
95
+ onKeyDown(evt);
96
+ }
93
97
  },
94
98
  onPaste: evt => {
95
99
  if (!disabled) {
@@ -320,6 +324,11 @@ TextArea.propTypes = {
320
324
  * `<textarea>` is clicked
321
325
  */
322
326
  onClick: PropTypes.func,
327
+ /**
328
+ * Optionally provide an `onKeyDown` handler that is called whenever `<textarea>`
329
+ * is keyed
330
+ */
331
+ onKeyDown: PropTypes.func,
323
332
  /**
324
333
  * Specify the placeholder attribute for the `<textarea>`
325
334
  */
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes, { ReactNodeLike } from 'prop-types';
8
+ import { ReactAttr } from '../../types/common';
9
+ type ExcludedAttributes = 'onChange';
10
+ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, ExcludedAttributes> {
11
+ /**
12
+ * Provide a collection of <RadioTile> components to render in the group
13
+ */
14
+ children?: ReactNodeLike;
15
+ /**
16
+ * Provide an optional className to be applied to the container node
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Specify the the value of <RadioTile> to be selected by default
21
+ */
22
+ defaultSelected?: string | number;
23
+ /**
24
+ * Specify whether the group is disabled
25
+ */
26
+ disabled?: boolean;
27
+ /**
28
+ * Provide an optional legend for this group
29
+ */
30
+ legend?: string;
31
+ /**
32
+ * Specify the name of the underlying `<input>` nodes
33
+ */
34
+ name: string;
35
+ /**
36
+ * Provide an optional `onChange` hook that is called whenever the value of the group changes
37
+ */
38
+ onChange?: (selection: unknown, name: string, evt: unknown) => void;
39
+ /**
40
+ * Specify the value that is currently selected in the group
41
+ */
42
+ valueSelected?: string | number;
43
+ }
44
+ declare const TileGroup: {
45
+ (props: any): JSX.Element;
46
+ propTypes: {
47
+ /**
48
+ * Provide a collection of <RadioTile> components to render in the group
49
+ */
50
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
51
+ /**
52
+ * Provide an optional className to be applied to the container node
53
+ */
54
+ className: PropTypes.Requireable<string>;
55
+ /**
56
+ * Specify the the value of <RadioTile> to be selected by default
57
+ */
58
+ defaultSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
59
+ /**
60
+ * Specify whether the group is disabled
61
+ */
62
+ disabled: PropTypes.Requireable<boolean>;
63
+ /**
64
+ * Provide an optional legend for this group
65
+ */
66
+ legend: PropTypes.Requireable<string>;
67
+ /**
68
+ * Specify the name of the underlying `<input>` nodes
69
+ */
70
+ name: PropTypes.Validator<string>;
71
+ /**
72
+ * Provide an optional `onChange` hook that is called whenever the value of
73
+ * the group changes
74
+ */
75
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
76
+ /**
77
+ * Specify the value that is currently selected in the group
78
+ */
79
+ valueSelected: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
80
+ };
81
+ displayName: string;
82
+ };
83
+ export default TileGroup;