carbon-react 89.1.0 → 89.2.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 (35) hide show
  1. package/lib/__internal__/input/input.component.js +2 -1
  2. package/lib/__spec_helper__/mock-date-helper.js +2 -1
  3. package/lib/components/action-toolbar/action-toolbar.component.js +6 -7
  4. package/lib/components/app-wrapper/app-wrapper.component.js +2 -5
  5. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +6 -8
  6. package/lib/components/configurable-items/configurable-items.component.js +1 -2
  7. package/lib/components/date/date.component.js +1 -2
  8. package/lib/components/date-range/date-range.component.js +1 -2
  9. package/lib/components/decimal/decimal.component.js +1 -2
  10. package/lib/components/detail/detail.component.js +2 -3
  11. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +2 -3
  12. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +10 -11
  13. package/lib/components/drag-and-drop/with-drag/with-drag.js +4 -6
  14. package/lib/components/drag-and-drop/with-drop/with-drop.js +4 -6
  15. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +2 -1
  16. package/lib/components/heading/heading.component.js +4 -8
  17. package/lib/components/i18n-provider/i18n-provider.d.ts +3 -94
  18. package/lib/components/icon/icon.component.js +4 -3
  19. package/lib/components/mount-in-app/mount-in-app.js +2 -5
  20. package/lib/components/multi-step-wizard/multi-step-wizard.js +14 -17
  21. package/lib/components/multi-step-wizard/step/step.js +6 -9
  22. package/lib/components/scrollable-list/scrollable-list.component.js +2 -3
  23. package/lib/components/show-edit-pod/show-edit-pod.component.js +1 -3
  24. package/lib/components/sidebar/sidebar.component.js +2 -1
  25. package/lib/components/table/table.component.js +1 -3
  26. package/lib/components/text-editor/text-editor.component.js +2 -1
  27. package/lib/components/textarea/textarea.component.js +1 -3
  28. package/lib/locales/en-gb.d.ts +5 -0
  29. package/lib/locales/en-gb.js +2 -3
  30. package/lib/locales/index.d.ts +2 -0
  31. package/lib/locales/locale.d.ts +96 -0
  32. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +2 -3
  33. package/lib/patterns/configurable-items/configurable-items.js +2 -2
  34. package/lib/utils/helpers/with-unique-id-props/with-unique-id-props.hoc.js +2 -2
  35. package/package.json +8 -6
@@ -38,7 +38,8 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
38
38
  const context = (0, _react.useContext)(_inputBehaviour.InputContext);
39
39
  const groupContext = (0, _react.useContext)(_inputBehaviour.InputGroupContext);
40
40
  const deferredTimeout = (0, _react.useRef)(null);
41
- const input = ref || (0, _react.useRef)(null);
41
+ let input = (0, _react.useRef)(null);
42
+ if (ref) input = ref;
42
43
  (0, _react.useEffect)(() => {
43
44
  if (autoFocus && input.current) input.current.focus();
44
45
  }, [autoFocus, input]);
@@ -16,7 +16,8 @@ jest.mock("../utils/helpers/date", () => {
16
16
  default: (() => {
17
17
  const mockTodayDate = "1-1-2019";
18
18
  const isoDateFormat = "YYYY-MM-DD";
19
- const MockedDateHelper = Object.assign({}, _DateHelper.default);
19
+ const MockedDateHelper = { ..._DateHelper.default
20
+ };
20
21
 
21
22
  MockedDateHelper._parseDate = (value, options) => _DateHelper.default._parseDate(value, options).utc();
22
23
 
@@ -193,13 +193,6 @@ let ActionToolbar = /*#__PURE__*/function (_React$Component) {
193
193
  return ActionToolbar;
194
194
  }(_react.default.Component);
195
195
 
196
- _defineProperty(ActionToolbar, "contextTypes", {
197
- attachActionToolbar: _propTypes.default.func,
198
- // tracks the action toolbar component
199
- detachActionToolbar: _propTypes.default.func // tracks the action toolbar component
200
-
201
- });
202
-
203
196
  ActionToolbar.propTypes = {
204
197
  /** The actions to display in the toolbar */
205
198
  actions: _propTypes.default.object.isRequired,
@@ -210,5 +203,11 @@ ActionToolbar.propTypes = {
210
203
  /** A function to return child components for the action toolbar. */
211
204
  children: _propTypes.default.func
212
205
  };
206
+ ActionToolbar.contextTypes = {
207
+ attachActionToolbar: _propTypes.default.func,
208
+ // tracks the action toolbar component
209
+ detachActionToolbar: _propTypes.default.func // tracks the action toolbar component
210
+
211
+ };
213
212
  var _default = ActionToolbar;
214
213
  exports.default = _default;
@@ -41,8 +41,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
41
41
 
42
42
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
43
 
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
44
  /**
47
45
  * Manages the width and containment of your application.
48
46
  */
@@ -89,7 +87,7 @@ let AppWrapper = /*#__PURE__*/function (_React$Component) {
89
87
  return AppWrapper;
90
88
  }(_react.default.Component);
91
89
 
92
- _defineProperty(AppWrapper, "propTypes", {
90
+ AppWrapper.propTypes = {
93
91
  /**
94
92
  * Children elements
95
93
  *
@@ -105,7 +103,6 @@ _defineProperty(AppWrapper, "propTypes", {
105
103
  * @type {String}
106
104
  */
107
105
  className: _propTypes.default.string
108
- });
109
-
106
+ };
110
107
  var _default = AppWrapper;
111
108
  exports.default = _default;
@@ -137,14 +137,6 @@ let ConfigurableItemRow = /*#__PURE__*/function (_React$Component) {
137
137
  }(_react.default.Component);
138
138
 
139
139
  exports.ConfigurableItemRowWithoutHOC = ConfigurableItemRow;
140
-
141
- _defineProperty(ConfigurableItemRow, "contextTypes", {
142
- dragDropManager: _propTypes.default.object,
143
- // the React DND DragDropManager
144
- dragAndDropActiveIndex: _propTypes.default.number // tracks the currently active index
145
-
146
- });
147
-
148
140
  ConfigurableItemRow.propTypes = {
149
141
  /** A custom class name for the component. */
150
142
  className: _propTypes.default.string,
@@ -167,6 +159,12 @@ ConfigurableItemRow.propTypes = {
167
159
  /** An internal prop. Helpful to detect which component should be rendered */
168
160
  theme: _propTypes.default.object
169
161
  };
162
+ ConfigurableItemRow.contextTypes = {
163
+ dragDropManager: _propTypes.default.object,
164
+ // the React DND DragDropManager
165
+ dragAndDropActiveIndex: _propTypes.default.number // tracks the currently active index
166
+
167
+ };
170
168
  ConfigurableItemRow.defaultProps = {
171
169
  theme: _base.default
172
170
  };
@@ -126,8 +126,7 @@ let ConfigurableItems = /*#__PURE__*/function (_React$Component) {
126
126
  return ConfigurableItems;
127
127
  }(_react.default.Component);
128
128
 
129
- _defineProperty(ConfigurableItems, "contextType", _i18nContext.default);
130
-
129
+ ConfigurableItems.contextType = _i18nContext.default;
131
130
  ConfigurableItems.propTypes = {
132
131
  /** Children elements. */
133
132
  children: _propTypes.default.node,
@@ -627,8 +627,6 @@ let BaseDateInput = /*#__PURE__*/function (_React$Component) {
627
627
 
628
628
  exports.BaseDateInput = BaseDateInput;
629
629
 
630
- _defineProperty(BaseDateInput, "contextType", _i18nContext.default);
631
-
632
630
  function generateAdjustedValue({
633
631
  value,
634
632
  defaultValue,
@@ -686,6 +684,7 @@ function canReturnValue(value, allowEmptyValue, locale, formats, format) {
686
684
  }
687
685
 
688
686
  const DateInput = (0, _withUniqueIdProps.default)(BaseDateInput);
687
+ BaseDateInput.contextType = _i18nContext.default;
689
688
  BaseDateInput.propTypes = { ..._textbox.default.propTypes,
690
689
  ...marginPropTypes,
691
690
 
@@ -300,8 +300,7 @@ let DateRange = /*#__PURE__*/function (_React$Component) {
300
300
  return DateRange;
301
301
  }(_react.default.Component);
302
302
 
303
- _defineProperty(DateRange, "contextType", _i18nContext.default);
304
-
303
+ DateRange.contextType = _i18nContext.default;
305
304
  DateRange.propTypes = {
306
305
  /** Filtered styled system margin props */
307
306
  ...marginPropTypes,
@@ -281,10 +281,9 @@ let Decimal = /*#__PURE__*/function (_React$Component) {
281
281
  return Decimal;
282
282
  }(_react.default.Component);
283
283
 
284
- _defineProperty(Decimal, "contextType", _i18nContext.default);
285
-
286
284
  _defineProperty(Decimal, "maxPrecision", 15);
287
285
 
286
+ Decimal.contextType = _i18nContext.default;
288
287
  Decimal.propTypes = {
289
288
  /** Styled-system margin props */
290
289
  ...marginPropTypes,
@@ -106,7 +106,7 @@ let Detail = /*#__PURE__*/function (_React$Component) {
106
106
  return Detail;
107
107
  }(_react.default.Component);
108
108
 
109
- _defineProperty(Detail, "propTypes", { ...marginPropTypes,
109
+ Detail.propTypes = { ...marginPropTypes,
110
110
 
111
111
  /**
112
112
  * Custom className
@@ -129,7 +129,6 @@ _defineProperty(Detail, "propTypes", { ...marginPropTypes,
129
129
  * The rendered children of the component.
130
130
  */
131
131
  children: _propTypes.default.node
132
- });
133
-
132
+ };
134
133
  var _default = Detail;
135
134
  exports.default = _default;
@@ -146,7 +146,7 @@ let CustomDragLayer = /*#__PURE__*/function (_React$Component) {
146
146
  return CustomDragLayer;
147
147
  }(_react.default.Component);
148
148
 
149
- _defineProperty(CustomDragLayer, "propTypes", {
149
+ CustomDragLayer.propTypes = {
150
150
  /**
151
151
  * The dom node being dragged.
152
152
  */
@@ -162,8 +162,7 @@ _defineProperty(CustomDragLayer, "propTypes", {
162
162
  isDragging: _propTypes.default.bool.isRequired
163
163
  /* eslint-enable react/no-unused-prop-types */
164
164
 
165
- });
166
-
165
+ };
167
166
  const UndecoratedCustomDragLayer = CustomDragLayer;
168
167
  exports.UndecoratedCustomDragLayer = UndecoratedCustomDragLayer;
169
168
 
@@ -56,10 +56,6 @@ let DraggableContext = /*#__PURE__*/function (_React$Component) {
56
56
 
57
57
  var _super = _createSuper(DraggableContext);
58
58
 
59
- /**
60
- * Defines a context object for child components of the draggable context component.
61
- * https://facebook.github.io/react/docs/context.html
62
- */
63
59
  function DraggableContext(_props) {
64
60
  var _this;
65
61
 
@@ -216,7 +212,7 @@ let DraggableContext = /*#__PURE__*/function (_React$Component) {
216
212
  return DraggableContext;
217
213
  }(_react.default.Component);
218
214
 
219
- _defineProperty(DraggableContext, "propTypes", {
215
+ DraggableContext.propTypes = {
220
216
  /**
221
217
  * The element(s) where you want to apply drag
222
218
  * and drop functionality
@@ -238,9 +234,13 @@ _defineProperty(DraggableContext, "propTypes", {
238
234
  * Prop to enable/disable auto scroll on drag
239
235
  */
240
236
  autoScroll: _propTypes.default.bool
241
- });
237
+ };
238
+ /**
239
+ * Defines a context object for child components of the draggable context component.
240
+ * https://facebook.github.io/react/docs/context.html
241
+ */
242
242
 
243
- _defineProperty(DraggableContext, "childContextTypes", {
243
+ DraggableContext.childContextTypes = {
244
244
  dragAndDropActiveIndex: _propTypes.default.number,
245
245
  // Tracks the currently dragged index
246
246
  dragAndDropBeginDrag: _propTypes.default.func,
@@ -251,12 +251,11 @@ _defineProperty(DraggableContext, "childContextTypes", {
251
251
  // Callback for when a hover is triggered
252
252
  dragAndDropOnDrag: _propTypes.default.func // Callback for when order is changed
253
253
 
254
- });
255
-
256
- _defineProperty(DraggableContext, "defaultProps", {
254
+ };
255
+ DraggableContext.defaultProps = {
257
256
  customDragLayer: /*#__PURE__*/_react.default.createElement(_customDragLayer.default, null),
258
257
  autoScroll: false
259
- });
258
+ };
260
259
 
261
260
  var _default = (0, _reactDndLegacy.DragDropContext)((0, _reactDndTouchBackend.default)({
262
261
  enableMouseEvents: true
@@ -94,7 +94,7 @@ let WithDrag = /*#__PURE__*/function (_React$Component) {
94
94
  return WithDrag;
95
95
  }(_react.default.Component);
96
96
 
97
- _defineProperty(WithDrag, "propTypes", {
97
+ WithDrag.propTypes = {
98
98
  /**
99
99
  * The component that will have drag enabled
100
100
  */
@@ -145,13 +145,11 @@ _defineProperty(WithDrag, "propTypes", {
145
145
 
146
146
  /* eslint-enable react/no-unused-prop-types */
147
147
 
148
- });
149
-
150
- _defineProperty(WithDrag, "contextTypes", {
148
+ };
149
+ WithDrag.contextTypes = {
151
150
  dragAndDropBeginDrag: _propTypes.default.func,
152
151
  dragAndDropEndDrag: _propTypes.default.func
153
- });
154
-
152
+ };
155
153
  const ItemSource = {
156
154
  canDrag(props, monitor) {
157
155
  return props.canDrag ? props.canDrag(props, monitor) : true;
@@ -113,7 +113,7 @@ let WithDrop = /*#__PURE__*/function (_React$Component) {
113
113
  return WithDrop;
114
114
  }(_react.default.Component);
115
115
 
116
- _defineProperty(WithDrop, "propTypes", {
116
+ WithDrop.propTypes = {
117
117
  /**
118
118
  * The component that will have drop enabled
119
119
  */
@@ -166,13 +166,11 @@ _defineProperty(WithDrop, "propTypes", {
166
166
  * @ignore
167
167
  */
168
168
  didDrop: _propTypes.default.func
169
- });
170
-
171
- _defineProperty(WithDrop, "contextTypes", {
169
+ };
170
+ WithDrop.contextTypes = {
172
171
  dragAndDropOnDrag: _propTypes.default.func,
173
172
  dragAndDropHover: _propTypes.default.func
174
- });
175
-
173
+ };
176
174
  const ItemTarget = {
177
175
  canDrop(props, monitor) {
178
176
  return props.canDrop ? props.canDrop(props, monitor) : true;
@@ -53,7 +53,8 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
53
53
  moveItem
54
54
  }, ref) => {
55
55
  const [isExpanded, setIsExpanded] = (0, _react.useState)(expanded);
56
- const rowRef = ref || (0, _react.useRef)();
56
+ let rowRef = (0, _react.useRef)();
57
+ if (ref) rowRef = ref;
57
58
  const firstColumnExpandable = expandableArea === "firstColumn";
58
59
  const [stickyCellWidths, setStickyCellWidths] = (0, _react.useState)([]);
59
60
  const [leftPositions, setLeftPositions] = (0, _react.useState)([]);
@@ -41,8 +41,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
41
41
 
42
42
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
43
 
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
44
  const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
47
45
 
48
46
  let Heading = /*#__PURE__*/function (_React$Component) {
@@ -202,7 +200,7 @@ let Heading = /*#__PURE__*/function (_React$Component) {
202
200
  return Heading;
203
201
  }(_react.default.Component);
204
202
 
205
- _defineProperty(Heading, "propTypes", { ...marginPropTypes,
203
+ Heading.propTypes = { ...marginPropTypes,
206
204
 
207
205
  /**
208
206
  * Children elements
@@ -258,12 +256,10 @@ _defineProperty(Heading, "propTypes", { ...marginPropTypes,
258
256
  * Pills that will be added after the title.
259
257
  */
260
258
  pills: _propTypes.default.node
261
- });
262
-
263
- _defineProperty(Heading, "defaultProps", {
259
+ };
260
+ Heading.defaultProps = {
264
261
  divider: true,
265
262
  separator: false
266
- });
267
-
263
+ };
268
264
  var _default = Heading;
269
265
  exports.default = _default;
@@ -1,101 +1,10 @@
1
1
  import * as React from "react";
2
2
 
3
+ import Locale from "../../locales";
4
+
3
5
  export interface I18nProviderProps {
6
+ locale: Locale;
4
7
  children: React.ReactNode;
5
- locale: {
6
- locale: () => string;
7
- actions: {
8
- edit: () => string;
9
- delete: () => string;
10
- reset: () => string;
11
- };
12
- actionPopover: {
13
- ariaLabel: () => string;
14
- };
15
- actionToolbar: {
16
- selected: () => string;
17
- };
18
- batchSelection: {
19
- selected: (count: number | string) => string;
20
- };
21
- confirm: {
22
- no: () => string;
23
- yes: () => string;
24
- };
25
- date: {
26
- formats: {
27
- inputs: () => [string];
28
- javascript: () => string;
29
- };
30
- };
31
- errors: {
32
- messages: {
33
- formSummary: (
34
- errors: number,
35
- warnings: number,
36
- type: string
37
- ) => [string, string];
38
- };
39
- };
40
- message: {
41
- closeButtonAriaLabel: () => string;
42
- };
43
- numeralDate: {
44
- validation: {
45
- day: () => string;
46
- month: () => string;
47
- year: () => string;
48
- };
49
- };
50
- pager: {
51
- show: () => string;
52
- records: (count: number | string, showNumber: boolean) => string;
53
- first: () => string;
54
- last: () => string;
55
- next: () => string;
56
- previous: () => string;
57
- pageX: () => string;
58
- ofY: (count: string | number) => string;
59
- };
60
- select: {
61
- actionButtonText: () => string;
62
- placeholder: () => string;
63
- noResultsForTerm: (term: string) => string;
64
- };
65
- switch: {
66
- on: () => string;
67
- off: () => string;
68
- };
69
- table: {
70
- noData: () => string;
71
- };
72
- textEditor: {
73
- tooltipMessages: {
74
- bold: () => string;
75
- italic: () => string;
76
- bulletList: () => string;
77
- numberList: () => string;
78
- };
79
- ariaLabels: {
80
- bold: () => string;
81
- italic: () => string;
82
- bulletList: () => string;
83
- numberList: () => string;
84
- };
85
- };
86
- titleSelect: {
87
- deselect: () => string;
88
- };
89
- wizards: {
90
- multiStep: {
91
- buttons: {
92
- submit: () => string;
93
- next: () => string;
94
- back: () => string;
95
- };
96
- };
97
- };
98
- };
99
8
  }
100
9
 
101
10
  declare const I18nProvider: React.FunctionComponent<I18nProviderProps>;
@@ -113,11 +113,12 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
113
113
  "data-element": iconType()
114
114
  }, (0, _tags.default)("icon", rest), styleProps));
115
115
 
116
+ const {
117
+ tooltipPosition: tooltipPositionFromContext
118
+ } = (0, _react.useContext)(_tooltipProvider.TooltipContext);
119
+
116
120
  if (tooltipMessage) {
117
121
  const visible = disabled ? false : tooltipVisible;
118
- const {
119
- tooltipPosition: tooltipPositionFromContext
120
- } = (0, _react.useContext)(_tooltipProvider.TooltipContext);
121
122
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
122
123
  message: tooltipMessage,
123
124
  position: tooltipPositionFromContext || tooltipPosition,
@@ -35,8 +35,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
35
35
 
36
36
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
37
 
38
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
-
40
38
  let deprecatedWarnTriggered = false;
41
39
 
42
40
  let MountInApp = /*#__PURE__*/function (_React$Component) {
@@ -92,7 +90,7 @@ let MountInApp = /*#__PURE__*/function (_React$Component) {
92
90
  return MountInApp;
93
91
  }(_react.default.Component);
94
92
 
95
- _defineProperty(MountInApp, "propTypes", {
93
+ MountInApp.propTypes = {
96
94
  /**
97
95
  * Children elements
98
96
  */
@@ -102,7 +100,6 @@ _defineProperty(MountInApp, "propTypes", {
102
100
  * ID of the element in which the children components will be rendered.
103
101
  */
104
102
  targetId: _propTypes.default.string
105
- });
106
-
103
+ };
107
104
  var _default = MountInApp;
108
105
  exports.default = _default;
@@ -169,17 +169,17 @@ let MultiStepWizard = /*#__PURE__*/function (_React$Component) {
169
169
 
170
170
  return _this;
171
171
  }
172
+ /**
173
+ * Returns wizard object to child components.
174
+ *
175
+ * @method getChildContext
176
+ * @return {void}
177
+ */
178
+
172
179
 
173
180
  _createClass(MultiStepWizard, [{
174
181
  key: "getChildContext",
175
- value:
176
- /**
177
- * Returns wizard object to child components.
178
- *
179
- * @method getChildContext
180
- * @return {void}
181
- */
182
- function getChildContext() {
182
+ value: function getChildContext() {
183
183
  return {
184
184
  wizard: {
185
185
  nextHandler: this.props.onNext,
@@ -299,7 +299,7 @@ let MultiStepWizard = /*#__PURE__*/function (_React$Component) {
299
299
  return MultiStepWizard;
300
300
  }(_react.default.Component);
301
301
 
302
- _defineProperty(MultiStepWizard, "propTypes", {
302
+ MultiStepWizard.propTypes = {
303
303
  /**
304
304
  * Individual steps
305
305
  *
@@ -374,9 +374,8 @@ _defineProperty(MultiStepWizard, "propTypes", {
374
374
  */
375
375
  completed: _propTypes.default.bool // eslint-disable-line react/no-unused-prop-types
376
376
 
377
- });
378
-
379
- _defineProperty(MultiStepWizard, "defaultProps", {
377
+ };
378
+ MultiStepWizard.defaultProps = {
380
379
  beforeSubmitValidation: null,
381
380
  className: "",
382
381
  completed: false,
@@ -384,9 +383,8 @@ _defineProperty(MultiStepWizard, "defaultProps", {
384
383
  enableInactiveSteps: false,
385
384
  onNext: null,
386
385
  onBack: null
387
- });
388
-
389
- _defineProperty(MultiStepWizard, "childContextTypes", {
386
+ };
387
+ MultiStepWizard.childContextTypes = {
390
388
  /**
391
389
  * Defines a context object for child components of this wizard.
392
390
  *
@@ -394,7 +392,6 @@ _defineProperty(MultiStepWizard, "childContextTypes", {
394
392
  * @type {Object}
395
393
  */
396
394
  wizard: _propTypes.default.object
397
- });
398
-
395
+ };
399
396
  var _default = MultiStepWizard;
400
397
  exports.default = _default;
@@ -337,7 +337,7 @@ let Step = /*#__PURE__*/function (_React$Component) {
337
337
  return Step;
338
338
  }(_react.default.Component);
339
339
 
340
- _defineProperty(Step, "propTypes", {
340
+ Step.propTypes = {
341
341
  /**
342
342
  * Step number
343
343
  *
@@ -404,9 +404,8 @@ _defineProperty(Step, "propTypes", {
404
404
  * @type {Node}
405
405
  */
406
406
  children: _propTypes.default.node
407
- });
408
-
409
- _defineProperty(Step, "defaultProps", {
407
+ };
408
+ Step.defaultProps = {
410
409
  children: null,
411
410
  className: "",
412
411
  defaultButton: true,
@@ -414,11 +413,9 @@ _defineProperty(Step, "defaultProps", {
414
413
  extraButtons: [],
415
414
  onBack: null,
416
415
  onNext: null
417
- });
418
-
419
- _defineProperty(Step, "contextTypes", {
416
+ };
417
+ Step.contextTypes = {
420
418
  wizard: _propTypes.default.object
421
- });
422
-
419
+ };
423
420
  var _default = Step;
424
421
  exports.default = _default;
@@ -314,7 +314,7 @@ let ScrollableList = /*#__PURE__*/function (_Component) {
314
314
  return ScrollableList;
315
315
  }(_react.Component);
316
316
 
317
- _defineProperty(ScrollableList, "propTypes", {
317
+ ScrollableList.propTypes = {
318
318
  alwaysHighlight: _propTypes.default.bool,
319
319
  // ensures an item is always highlighted
320
320
  isLoopable: _propTypes.default.bool,
@@ -323,7 +323,6 @@ _defineProperty(ScrollableList, "propTypes", {
323
323
  maxHeight: _propTypes.default.string,
324
324
  onLazyLoad: _propTypes.default.func,
325
325
  onSelect: _propTypes.default.func
326
- });
327
-
326
+ };
328
327
  var _default = ScrollableList;
329
328
  exports.default = _default;
@@ -260,9 +260,7 @@ let ShowEditPod = /*#__PURE__*/function (_React$Component) {
260
260
  }(_react.default.Component);
261
261
 
262
262
  exports.BaseShowEditPod = ShowEditPod;
263
-
264
- _defineProperty(ShowEditPod, "contextType", _i18nContext.default);
265
-
263
+ ShowEditPod.contextType = _i18nContext.default;
266
264
  ShowEditPod.propTypes = { ...marginPropTypes,
267
265
 
268
266
  /** Pod theme variant. */
@@ -48,7 +48,8 @@ const Sidebar = /*#__PURE__*/_react.default.forwardRef(({
48
48
  onCancel,
49
49
  ...rest
50
50
  }, ref) => {
51
- const sidebarRef = ref || (0, _react.useRef)();
51
+ let sidebarRef = (0, _react.useRef)();
52
+ if (ref) sidebarRef = ref;
52
53
 
53
54
  const closeIcon = () => {
54
55
  if (!onCancel) return null;
@@ -660,9 +660,7 @@ let Table = /*#__PURE__*/function (_React$Component) {
660
660
  }(_react.default.Component);
661
661
 
662
662
  exports.Table = Table;
663
-
664
- _defineProperty(Table, "contextType", _i18nContext.default);
665
-
663
+ Table.contextType = _i18nContext.default;
666
664
  Table.propTypes = {
667
665
  /** The actions to display in the toolbar */
668
666
  actions: _propTypes.default.object,
@@ -65,7 +65,8 @@ const TextEditor = /*#__PURE__*/_react.default.forwardRef(({
65
65
  const [inlines, setInlines] = (0, _react.useState)([]);
66
66
  const [activeInlines, setActiveInlines] = (0, _react.useState)({});
67
67
  const [focusToolbar, setFocusToolbar] = (0, _react.useState)(false);
68
- const editor = ref || (0, _react.useRef)();
68
+ const editorRef = (0, _react.useRef)();
69
+ const editor = ref || editorRef;
69
70
  const contentLength = (0, _utils.getContent)(value).getPlainText("").length;
70
71
  const moveCursor = (0, _react.useRef)(contentLength > 0);
71
72
  const lastKeyPressed = (0, _react.useRef)();
@@ -245,9 +245,7 @@ let Textarea = /*#__PURE__*/function (_React$Component) {
245
245
  }(_react.default.Component);
246
246
 
247
247
  exports.OriginalTextarea = Textarea;
248
-
249
- _defineProperty(Textarea, "contextType", _i18nContext.default);
250
-
248
+ Textarea.contextType = _i18nContext.default;
251
249
  Textarea.propTypes = { ...marginPropTypes,
252
250
 
253
251
  /** id of the input */
@@ -0,0 +1,5 @@
1
+ import Locale from ".";
2
+
3
+ declare const EnGb: Locale;
4
+
5
+ export default EnGb;
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.isSingular = void 0;
6
+ exports.default = void 0;
7
7
 
8
- const isSingular = count => parseInt(count, 10) === 1;
8
+ const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
9
9
 
10
- exports.isSingular = isSingular;
11
10
  var _default = {
12
11
  locale: () => "en-GB",
13
12
  actions: {
@@ -0,0 +1,2 @@
1
+ export { default } from "./locale";
2
+ export { default as EnGb } from "./en-gb";
@@ -0,0 +1,96 @@
1
+ interface Locale {
2
+ locale: () => string;
3
+ actions: {
4
+ edit: () => string;
5
+ delete: () => string;
6
+ reset: () => string;
7
+ };
8
+ actionPopover: {
9
+ ariaLabel: () => string;
10
+ };
11
+ actionToolbar: {
12
+ selected: () => string;
13
+ };
14
+ batchSelection: {
15
+ selected: (count: number | string) => string;
16
+ };
17
+ confirm: {
18
+ no: () => string;
19
+ yes: () => string;
20
+ };
21
+ date: {
22
+ formats: {
23
+ inputs: () => [string];
24
+ javascript: () => string;
25
+ };
26
+ };
27
+ errors: {
28
+ messages: {
29
+ formSummary: (
30
+ errors: number,
31
+ warnings: number,
32
+ type: string
33
+ ) => [string, string];
34
+ };
35
+ };
36
+ message: {
37
+ closeButtonAriaLabel: () => string;
38
+ };
39
+ numeralDate: {
40
+ validation: {
41
+ day: () => string;
42
+ month: () => string;
43
+ year: () => string;
44
+ };
45
+ };
46
+ pager: {
47
+ show: () => string;
48
+ records: (count: number | string, showNumber: boolean) => string;
49
+ first: () => string;
50
+ last: () => string;
51
+ next: () => string;
52
+ previous: () => string;
53
+ pageX: () => string;
54
+ ofY: (count: string | number) => string;
55
+ };
56
+ select: {
57
+ actionButtonText: () => string;
58
+ placeholder: () => string;
59
+ noResultsForTerm: (term: string) => string;
60
+ };
61
+ switch: {
62
+ on: () => string;
63
+ off: () => string;
64
+ };
65
+ table: {
66
+ noData: () => string;
67
+ };
68
+ textEditor: {
69
+ tooltipMessages: {
70
+ bold: () => string;
71
+ italic: () => string;
72
+ bulletList: () => string;
73
+ numberList: () => string;
74
+ };
75
+ ariaLabels: {
76
+ bold: () => string;
77
+ italic: () => string;
78
+ bulletList: () => string;
79
+ numberList: () => string;
80
+ };
81
+ };
82
+ titleSelect: {
83
+ deselect: () => string;
84
+ };
85
+ wizards: {
86
+ multiStep: {
87
+ buttons: {
88
+ submit: () => string;
89
+ next: () => string;
90
+ back: () => string;
91
+ };
92
+ };
93
+ };
94
+ }
95
+
96
+ export default Locale;
@@ -87,7 +87,7 @@ let ConfigurableItemsContent = /*#__PURE__*/function (_React$Component) {
87
87
  return ConfigurableItemsContent;
88
88
  }(_react.default.Component);
89
89
 
90
- _defineProperty(ConfigurableItemsContent, "propTypes", {
90
+ ConfigurableItemsContent.propTypes = {
91
91
  /**
92
92
  * The configurable item data.
93
93
  *
@@ -135,7 +135,6 @@ _defineProperty(ConfigurableItemsContent, "propTypes", {
135
135
  * @type {Function}
136
136
  */
137
137
  onSave: _propTypes.default.func.isRequired
138
- });
139
-
138
+ };
140
139
  var _default = ConfigurableItemsContent;
141
140
  exports.default = _default;
@@ -161,7 +161,7 @@ let ConfigurableItemsPattern = /*#__PURE__*/function (_React$Component) {
161
161
  return ConfigurableItemsPattern;
162
162
  }(_react.default.Component);
163
163
 
164
- _defineProperty(ConfigurableItemsPattern, "propTypes", {
164
+ ConfigurableItemsPattern.propTypes = {
165
165
  /**
166
166
  * A custom class name for the component.
167
167
  *
@@ -209,7 +209,7 @@ _defineProperty(ConfigurableItemsPattern, "propTypes", {
209
209
  * @type {Object}
210
210
  */
211
211
  title: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object])
212
- });
212
+ };
213
213
 
214
214
  var _default = (0, _flux.connect)(ConfigurableItemsPattern, _store.default);
215
215
 
@@ -76,10 +76,10 @@ const withUniqueIdProps = WrappedComponent => {
76
76
  return WithUniqueIdProps;
77
77
  }(_react.default.Component);
78
78
 
79
- _defineProperty(WithUniqueIdProps, "propTypes", {
79
+ WithUniqueIdProps.propTypes = {
80
80
  forwardedRef: _propTypes.default.object,
81
81
  id: _propTypes.default.string
82
- });
82
+ };
83
83
 
84
84
  const Component = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
85
85
  return /*#__PURE__*/_react.default.createElement(WithUniqueIdProps, _extends({}, props, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "89.1.0",
3
+ "version": "89.2.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -101,14 +101,16 @@
101
101
  "enzyme-adapter-react-16": "^1.14.0",
102
102
  "enzyme-to-json": "^3.4.0",
103
103
  "eslint": "^7.25.0",
104
- "eslint-config-airbnb": "17.0.0",
104
+ "eslint-config-airbnb": "^18.2.0",
105
105
  "eslint-config-prettier": "^6.15.0",
106
106
  "eslint-plugin-cypress": "^2.0.1",
107
- "eslint-plugin-import": "2.13.0",
108
- "eslint-plugin-jsx-a11y": "6.1.1",
107
+ "eslint-plugin-import": "^2.22.0",
108
+ "eslint-plugin-jest": "^24.1.3",
109
+ "eslint-plugin-jest-dom": "^3.6.5",
110
+ "eslint-plugin-jsx-a11y": "^6.3.1",
109
111
  "eslint-plugin-no-unsanitized": "^3.1.4",
110
- "eslint-plugin-react": "7.19.0",
111
- "eslint-plugin-react-hooks": "2.3.0",
112
+ "eslint-plugin-react": "^7.20.3",
113
+ "eslint-plugin-react-hooks": "^4.2.0",
112
114
  "events": "~1.1.1",
113
115
  "flux": "^4.0.1",
114
116
  "husky": "^4.3.6",