carbon-react 93.0.4 → 94.0.3

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 (81) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +7 -1
  2. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +11 -1
  3. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +5 -1
  4. package/lib/__internal__/form-field/form-field.component.js +9 -8
  5. package/lib/__internal__/form-field/form-field.d.ts +2 -0
  6. package/lib/components/action-popover/action-popover.component.js +28 -20
  7. package/lib/components/action-popover/action-popover.style.js +22 -12
  8. package/lib/components/i18n-provider/i18n-provider.component.js +0 -3
  9. package/lib/locales/en-gb.js +1 -8
  10. package/lib/locales/locale.d.ts +0 -7
  11. package/lib/locales/pl-pl.js +1 -8
  12. package/package.json +1 -6
  13. package/lib/components/action-toolbar/action-toolbar.component.js +0 -213
  14. package/lib/components/action-toolbar/action-toolbar.d.ts +0 -20
  15. package/lib/components/action-toolbar/action-toolbar.style.js +0 -40
  16. package/lib/components/action-toolbar/index.d.ts +0 -1
  17. package/lib/components/action-toolbar/index.js +0 -15
  18. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +0 -174
  19. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.d.ts +0 -25
  20. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.style.js +0 -73
  21. package/lib/components/configurable-items/configurable-item-row/index.d.ts +0 -1
  22. package/lib/components/configurable-items/configurable-item-row/index.js +0 -15
  23. package/lib/components/configurable-items/configurable-items.component.js +0 -155
  24. package/lib/components/configurable-items/configurable-items.d.ts +0 -20
  25. package/lib/components/configurable-items/configurable-items.style.js +0 -70
  26. package/lib/components/configurable-items/index.d.ts +0 -2
  27. package/lib/components/configurable-items/index.js +0 -23
  28. package/lib/components/drag-and-drop/__internal__/item-target/index.js +0 -15
  29. package/lib/components/drag-and-drop/__internal__/item-target/item-target.js +0 -44
  30. package/lib/components/drag-and-drop/__internal__/item-types/index.js +0 -15
  31. package/lib/components/drag-and-drop/__internal__/item-types/item-types.js +0 -20
  32. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +0 -171
  33. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.style.js +0 -28
  34. package/lib/components/drag-and-drop/custom-drag-layer/index.js +0 -15
  35. package/lib/components/drag-and-drop/drag-and-drop-test.stories.js +0 -95
  36. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +0 -15
  37. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/scrollable-parent.js +0 -36
  38. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +0 -264
  39. package/lib/components/drag-and-drop/draggable-context/index.js +0 -15
  40. package/lib/components/drag-and-drop/index.js +0 -39
  41. package/lib/components/drag-and-drop/with-drag/index.js +0 -15
  42. package/lib/components/drag-and-drop/with-drag/with-drag.js +0 -176
  43. package/lib/components/drag-and-drop/with-drop/index.js +0 -15
  44. package/lib/components/drag-and-drop/with-drop/with-drop.js +0 -201
  45. package/lib/components/table/draggable-table-cell/draggable-table-cell.component.js +0 -59
  46. package/lib/components/table/draggable-table-cell/draggable-table-cell.style.js +0 -36
  47. package/lib/components/table/draggable-table-cell/index.js +0 -15
  48. package/lib/components/table/index.js +0 -43
  49. package/lib/components/table/table-cell/index.js +0 -15
  50. package/lib/components/table/table-cell/table-cell.component.js +0 -164
  51. package/lib/components/table/table-cell/table-cell.style.js +0 -164
  52. package/lib/components/table/table-header/index.js +0 -15
  53. package/lib/components/table/table-header/table-header.component.js +0 -282
  54. package/lib/components/table/table-header/table-header.style.js +0 -116
  55. package/lib/components/table/table-modern.style.js +0 -110
  56. package/lib/components/table/table-row/index.js +0 -15
  57. package/lib/components/table/table-row/table-row-modern.style.js +0 -70
  58. package/lib/components/table/table-row/table-row.component.js +0 -486
  59. package/lib/components/table/table-row/table-row.style.js +0 -165
  60. package/lib/components/table/table-sizes.style.js +0 -33
  61. package/lib/components/table/table-story-helpers/table-story-wrapper.component.js +0 -189
  62. package/lib/components/table/table-subheader/index.js +0 -15
  63. package/lib/components/table/table-subheader/table-subheader.component.js +0 -35
  64. package/lib/components/table/table-subheader/table-subheader.style.js +0 -33
  65. package/lib/components/table/table.component.js +0 -792
  66. package/lib/components/table/table.config.js +0 -14
  67. package/lib/components/table/table.style.js +0 -139
  68. package/lib/components/table-ajax/__internal__/serialize/package.json +0 -3
  69. package/lib/components/table-ajax/__internal__/serialize/serialize.js +0 -26
  70. package/lib/components/table-ajax/index.js +0 -37
  71. package/lib/components/table-ajax/table-ajax.component.js +0 -602
  72. package/lib/patterns/configurable-items/actions/actions.js +0 -41
  73. package/lib/patterns/configurable-items/actions/package.json +0 -3
  74. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +0 -140
  75. package/lib/patterns/configurable-items/configurable-items-content/package.json +0 -3
  76. package/lib/patterns/configurable-items/configurable-items.js +0 -216
  77. package/lib/patterns/configurable-items/constants/constants.js +0 -13
  78. package/lib/patterns/configurable-items/constants/package.json +0 -3
  79. package/lib/patterns/configurable-items/package.json +0 -3
  80. package/lib/patterns/configurable-items/store/package.json +0 -3
  81. package/lib/patterns/configurable-items/store/store.js +0 -92
@@ -58,7 +58,9 @@ const CheckableInput = ({
58
58
  const {
59
59
  current: id
60
60
  } = (0, _react.useRef)(inputId || (0, _guid.default)());
61
- const helpId = `${id} help`;
61
+ const labelId = `${id}-label`;
62
+ const helpId = [error, warning, info, labelHelp].filter(validation => typeof validation === "string").length ? `${id}-help` : undefined;
63
+ const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
62
64
  const isRadio = type === "radio";
63
65
  const formFieldProps = {
64
66
  disabled,
@@ -66,12 +68,14 @@ const CheckableInput = ({
66
68
  fieldHelp,
67
69
  fieldHelpInline,
68
70
  helpId,
71
+ fieldHelpId,
69
72
  id,
70
73
  info,
71
74
  label,
72
75
  labelAlign,
73
76
  labelHelp,
74
77
  labelHelpIcon: "info",
78
+ labelId,
75
79
  labelInline,
76
80
  labelSpacing,
77
81
  name: id,
@@ -87,10 +91,12 @@ const CheckableInput = ({
87
91
  checked,
88
92
  disabled,
89
93
  helpId,
94
+ fieldHelpId,
90
95
  id,
91
96
  inputRef,
92
97
  type,
93
98
  value,
99
+ labelId,
94
100
  name,
95
101
  onBlur,
96
102
  onChange,
@@ -23,6 +23,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
23
23
 
24
24
  const HiddenCheckableInput = ({
25
25
  helpId,
26
+ fieldHelpId,
27
+ labelId,
26
28
  name,
27
29
  checked,
28
30
  type,
@@ -69,11 +71,13 @@ const HiddenCheckableInput = ({
69
71
  if (onMouseLeaveGroup) onMouseLeaveGroup(ev);
70
72
  };
71
73
 
74
+ const ariaDescribedBy = [fieldHelpId, helpId].filter(Boolean).join(" ");
72
75
  return /*#__PURE__*/_react.default.createElement(_hiddenCheckableInput.default, _extends({
73
76
  autoFocus: autoFocus,
74
77
  "aria-checked": checked,
75
78
  checked: checked,
76
- "aria-describedby": helpId,
79
+ "aria-labelledby": labelId,
80
+ "aria-describedby": ariaDescribedBy,
77
81
  name: name,
78
82
  role: type,
79
83
  type: type,
@@ -98,6 +102,9 @@ HiddenCheckableInput.propTypes = {
98
102
  /** Element id for aria-describedby */
99
103
  helpId: _propTypes.default.string,
100
104
 
105
+ /** Element id for aria-describedby */
106
+ fieldHelpId: _propTypes.default.string,
107
+
101
108
  /** Input name */
102
109
  name: _propTypes.default.string,
103
110
 
@@ -116,6 +123,9 @@ HiddenCheckableInput.propTypes = {
116
123
  /** OnMouseEnter event handler */
117
124
  onMouseEnter: _propTypes.default.func,
118
125
 
126
+ /** Element id for aria-labelledby */
127
+ labelId: _propTypes.default.string,
128
+
119
129
  /** HTML type attribute of the input */
120
130
  type: _propTypes.default.string.isRequired,
121
131
 
@@ -24,7 +24,7 @@ export interface CommonHiddenCheckableInputProps
24
24
  /** Value of the input */
25
25
  value?: string;
26
26
  /** A callback to retrieve the input reference */
27
- inputRef: React.Ref<HTMLInputElement>;
27
+ inputRef?: React.Ref<HTMLInputElement>;
28
28
  }
29
29
 
30
30
  export interface HiddenCheckableInputProps
@@ -33,6 +33,10 @@ export interface HiddenCheckableInputProps
33
33
  type: string;
34
34
  /** Element id for aria-describedby */
35
35
  helpId?: string;
36
+ /** Element id for aria-describedby */
37
+ fieldHelpId?: string;
38
+ /** Element id for aria-labelledby */
39
+ labelId?: string;
36
40
  }
37
41
 
38
42
  declare function HiddenCheckableInput(
@@ -38,12 +38,13 @@ const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.de
38
38
  const FormField = ({
39
39
  children,
40
40
  disabled,
41
- fieldHelp,
41
+ fieldHelp: fieldHelpContent,
42
42
  fieldHelpInline,
43
43
  error,
44
44
  warning,
45
45
  info,
46
46
  helpId,
47
+ fieldHelpId,
47
48
  helpTabIndex,
48
49
  label,
49
50
  labelId,
@@ -77,6 +78,11 @@ const FormField = ({
77
78
  }
78
79
  }, [id, context, error, warning, info]);
79
80
  const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
81
+ const fieldHelp = fieldHelpContent ? /*#__PURE__*/_react.default.createElement(_fieldHelp.default, {
82
+ labelInline: inlineLabel,
83
+ labelWidth: labelWidth,
84
+ id: fieldHelpId
85
+ }, fieldHelpContent) : null;
80
86
  return /*#__PURE__*/_react.default.createElement(_formField.default, _extends({}, (0, _tags.default)(rest["data-component"], rest), marginProps), /*#__PURE__*/_react.default.createElement(_formField.FieldLineStyle, {
81
87
  inline: inlineLabel
82
88
  }, reverse && children, label && /*#__PURE__*/_react.default.createElement(_label.default, {
@@ -98,13 +104,7 @@ const FormField = ({
98
104
  pr: !reverse ? labelSpacing : undefined,
99
105
  pl: reverse ? labelSpacing : undefined,
100
106
  isRequired: isRequired
101
- }, label), fieldHelp && fieldHelpInline && /*#__PURE__*/_react.default.createElement(_fieldHelp.default, {
102
- labelInline: inlineLabel,
103
- labelWidth: labelWidth
104
- }, fieldHelp), !reverse && children), fieldHelp && !fieldHelpInline && /*#__PURE__*/_react.default.createElement(_fieldHelp.default, {
105
- labelInline: inlineLabel,
106
- labelWidth: labelWidth
107
- }, fieldHelp));
107
+ }, label), fieldHelpInline && fieldHelp, !reverse && children), !fieldHelpInline && fieldHelp);
108
108
  };
109
109
 
110
110
  const errorPropType = (props, propName, componentName, ...rest) => {
@@ -129,6 +129,7 @@ FormField.propTypes = {
129
129
  warning: errorPropType,
130
130
  info: errorPropType,
131
131
  helpId: _propTypes.default.string,
132
+ fieldHelpId: _propTypes.default.string,
132
133
  helpTabIndex: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
133
134
  id: _propTypes.default.string.isRequired,
134
135
  isOptional: _propTypes.default.bool,
@@ -11,6 +11,8 @@ export interface CommonFormFieldPropTypes
11
11
  fieldHelp?: React.ReactNode;
12
12
  /** The unique id of the Help component */
13
13
  helpId?: string;
14
+ /** The unique id of the FieldHelp component */
15
+ fieldHelpId?: string;
14
16
  /** Overrides the default tabindex of the Help component */
15
17
  helpTabIndex?: number | string;
16
18
  /** Label content */
@@ -56,7 +56,7 @@ const ActionPopover = ({
56
56
  const [isOpen, setOpenState] = (0, _react.useState)(false);
57
57
  const [focusIndex, setFocusIndex] = (0, _react.useState)(0);
58
58
  const [guid] = (0, _react.useState)((0, _guid.default)());
59
- const button = (0, _react.useRef)();
59
+ const buttonRef = (0, _react.useRef)();
60
60
  const menu = (0, _react.useRef)();
61
61
  const itemCount = (0, _react.useMemo)(() => {
62
62
  return _react.default.Children.toArray(children).filter(child => child.type === _actionPopoverItem.default).length;
@@ -94,7 +94,7 @@ const ActionPopover = ({
94
94
 
95
95
  if (!isOpening) {
96
96
  // Closing the menu should focus the MenuButton
97
- button.current.focus();
97
+ buttonRef.current.querySelector("[data-component='action-popover-button']").focus();
98
98
  }
99
99
  }, [isOpen, setOpen]); // Keyboard commands implemented as recommended by WAI-ARIA best practices
100
100
  // https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions.html
@@ -112,7 +112,7 @@ const ActionPopover = ({
112
112
  setOpen(true);
113
113
  }
114
114
  }, [itemCount, setOpen]);
115
- const focusButton = (0, _react.useCallback)(() => button.current.focus(), []);
115
+ const focusButton = (0, _react.useCallback)(() => buttonRef.current.querySelector("[data-component='action-popover-button']").focus(), []);
116
116
  (0, _react.useEffect)(() => {
117
117
  const handler = ({
118
118
  target
@@ -120,7 +120,7 @@ const ActionPopover = ({
120
120
  // If the event didn't came from part of this component, close the menu.
121
121
  // There will be multiple document click listeners but we cant prevent propagation because it will interfere with
122
122
  // other instances on the same page
123
- if (!button.current.contains(target) && menu.current && !menu.current.contains(target)) {
123
+ if (!buttonRef.current.contains(target) && menu.current && !menu.current.contains(target)) {
124
124
  setOpen(false);
125
125
  }
126
126
  };
@@ -136,23 +136,37 @@ const ActionPopover = ({
136
136
  };
137
137
  }, [setOpen]);
138
138
 
139
- const menuButton = () => {
139
+ const menuButton = menuID => {
140
140
  if (renderButton) {
141
141
  return renderButton({
142
- tabIndex: -1,
143
- "data-element": "action-popover-menu-button"
142
+ tabIndex: isOpen ? "-1" : "0",
143
+ "data-component": "action-popover-button",
144
+ ariaAttributes: {
145
+ "aria-haspopup": "true",
146
+ "aria-label": l.actionPopover.ariaLabel(),
147
+ "aria-controls": menuID,
148
+ "aria-expanded": isOpen
149
+ }
144
150
  });
145
151
  }
146
152
 
147
- return /*#__PURE__*/_react.default.createElement(_actionPopover.ButtonIcon, {
153
+ return /*#__PURE__*/_react.default.createElement(_actionPopover.StyledButtonIcon, {
154
+ role: "button",
155
+ "aria-haspopup": "true",
156
+ "aria-label": l.actionPopover.ariaLabel(),
157
+ "aria-controls": menuID,
158
+ "aria-expanded": isOpen,
159
+ tabIndex: isOpen ? "-1" : "0",
160
+ "data-component": "action-popover-button"
161
+ }, /*#__PURE__*/_react.default.createElement(_actionPopover.ButtonIcon, {
148
162
  type: "ellipsis_vertical"
149
- });
163
+ }));
150
164
  };
151
165
 
152
166
  const parentID = id || `ActionPopoverButton_${guid}`;
153
167
  const menuID = `ActionPopoverMenu_${guid}`;
154
168
  const menuProps = {
155
- button,
169
+ buttonRef,
156
170
  parentID,
157
171
  setFocusIndex,
158
172
  focusIndex,
@@ -165,18 +179,12 @@ const ActionPopover = ({
165
179
  };
166
180
  return /*#__PURE__*/_react.default.createElement(_actionPopover.MenuButton, _extends({
167
181
  id: parentID,
168
- "data-component": "action-popover-button",
169
- role: "button",
170
- "aria-haspopup": "true",
171
- "aria-label": l.actionPopover.ariaLabel(),
172
- "aria-controls": menuID,
173
- "aria-expanded": isOpen,
174
- tabIndex: isOpen ? "-1" : "0",
182
+ "data-component": "action-popover-wrapper",
175
183
  onKeyDown: onButtonKeyDown,
176
184
  onClick: onButtonClick,
177
185
  isOpen,
178
- ref: button
179
- }, rest), menuButton(), /*#__PURE__*/_react.default.createElement(_actionPopoverContext.default.Provider, {
186
+ ref: buttonRef
187
+ }, rest), menuButton(menuID), /*#__PURE__*/_react.default.createElement(_actionPopoverContext.default.Provider, {
180
188
  value: {
181
189
  setOpenPopover: setOpen,
182
190
  focusButton,
@@ -184,7 +192,7 @@ const ActionPopover = ({
184
192
  }
185
193
  }, isOpen && /*#__PURE__*/_react.default.createElement(_popover.default, {
186
194
  placement: mappedPlacement,
187
- reference: button
195
+ reference: buttonRef
188
196
  }, /*#__PURE__*/_react.default.createElement(_actionPopoverMenu.default, _extends({
189
197
  "data-component": "action-popover",
190
198
  role: "menu",
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledMenuItem = exports.MenuButtonOverrideWrapper = exports.SubMenuItemIcon = exports.MenuItemDivider = exports.MenuItemIcon = exports.ButtonIcon = exports.MenuButton = exports.MenuItemFactory = exports.Menu = void 0;
6
+ exports.StyledMenuItem = exports.MenuButtonOverrideWrapper = exports.SubMenuItemIcon = exports.MenuItemDivider = exports.MenuItemIcon = exports.StyledButtonIcon = exports.ButtonIcon = exports.MenuButton = exports.MenuItemFactory = exports.Menu = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -131,16 +131,6 @@ const MenuButton = _styledComponents.default.div`
131
131
  isOpen,
132
132
  theme
133
133
  }) => isOpen && `background-color: ${theme.colors.white}`}
134
- &:hover, &:focus {
135
- background-color: ${({
136
- theme
137
- }) => theme.colors.white};
138
- }
139
- &:focus {
140
- outline: 2px solid ${({
141
- theme
142
- }) => theme.colors.focus};
143
- }
144
134
  `;
145
135
  /**
146
136
  * Creates a factory that returns a styled component with a custom
@@ -168,6 +158,21 @@ const iconThemeProviderFactory = (Component, themeFn) => (0, _styledComponents.w
168
158
 
169
159
  const ButtonIcon = iconThemeProviderFactory(_icon.default, palette => palette.slate);
170
160
  exports.ButtonIcon = ButtonIcon;
161
+ const StyledButtonIcon = _styledComponents.default.div`
162
+ &:hover,
163
+ &:focus {
164
+ background-color: ${({
165
+ theme
166
+ }) => theme.colors.white};
167
+ }
168
+
169
+ &:focus {
170
+ outline: 2px solid ${({
171
+ theme
172
+ }) => theme.colors.focus};
173
+ }
174
+ `;
175
+ exports.StyledButtonIcon = StyledButtonIcon;
171
176
  const MenuItemIcon = (0, _styledComponents.default)(iconThemeProviderFactory(_icon.default, () => "inherit"))`
172
177
  ${({
173
178
  theme,
@@ -203,13 +208,18 @@ exports.SubMenuItemIcon = SubMenuItemIcon;
203
208
  const MenuButtonOverrideWrapper = _styledComponents.default.div`
204
209
  ${({
205
210
  theme
206
- }) => `
211
+ }) => (0, _styledComponents.css)`
207
212
  ${_button.default} {
208
213
  padding: 0px ${theme.spacing}px;
209
214
  width: 100%;
210
215
  &:focus {
211
216
  outline-width: 2px;
212
217
  }
218
+
219
+ &:hover,
220
+ &:focus {
221
+ background-color: ${theme.colors.white};
222
+ }
213
223
  }
214
224
  `}
215
225
  `;
@@ -38,9 +38,6 @@ I18nProvider.propTypes = {
38
38
  actionPopover: _propTypes.default.shape({
39
39
  ariaLabel: _propTypes.default.func
40
40
  }),
41
- actionToolbar: _propTypes.default.shape({
42
- selected: _propTypes.default.func
43
- }),
44
41
  batchSelection: _propTypes.default.shape({
45
42
  selected: _propTypes.default.func
46
43
  }),
@@ -11,15 +11,11 @@ var _default = {
11
11
  locale: () => "en-GB",
12
12
  actions: {
13
13
  edit: () => "Edit",
14
- delete: () => "Delete",
15
- reset: () => "Reset Columns"
14
+ delete: () => "Delete"
16
15
  },
17
16
  actionPopover: {
18
17
  ariaLabel: () => "actions"
19
18
  },
20
- actionToolbar: {
21
- selected: () => "Selected"
22
- },
23
19
  batchSelection: {
24
20
  selected: count => `${count} selected`
25
21
  },
@@ -91,9 +87,6 @@ var _default = {
91
87
  on: () => "ON",
92
88
  off: () => "OFF"
93
89
  },
94
- table: {
95
- noData: () => "No results to display"
96
- },
97
90
  textEditor: {
98
91
  tooltipMessages: {
99
92
  bold: () => "Bold",
@@ -3,14 +3,10 @@ interface Locale {
3
3
  actions: {
4
4
  edit: () => string;
5
5
  delete: () => string;
6
- reset: () => string;
7
6
  };
8
7
  actionPopover: {
9
8
  ariaLabel: () => string;
10
9
  };
11
- actionToolbar: {
12
- selected: () => string;
13
- };
14
10
  batchSelection: {
15
11
  selected: (count: number | string) => string;
16
12
  };
@@ -62,9 +58,6 @@ interface Locale {
62
58
  on: () => string;
63
59
  off: () => string;
64
60
  };
65
- table: {
66
- noData: () => string;
67
- };
68
61
  textEditor: {
69
62
  tooltipMessages: {
70
63
  bold: () => string;
@@ -11,15 +11,11 @@ var _default = {
11
11
  locale: () => "pl-PL",
12
12
  actions: {
13
13
  edit: () => "Edytuj",
14
- delete: () => "Usuń",
15
- reset: () => "Resetuj Kolumny"
14
+ delete: () => "Usuń"
16
15
  },
17
16
  actionPopover: {
18
17
  ariaLabel: () => "akcje"
19
18
  },
20
- actionToolbar: {
21
- selected: () => "Wybrano"
22
- },
23
19
  batchSelection: {
24
20
  selected: count => `${count} wybrano`
25
21
  },
@@ -83,9 +79,6 @@ var _default = {
83
79
  on: () => "WŁ",
84
80
  off: () => "WYŁ"
85
81
  },
86
- table: {
87
- noData: () => "Brak wyników"
88
- },
89
82
  textEditor: {
90
83
  tooltipMessages: {
91
84
  bold: () => "Pogrubiony",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "93.0.4",
3
+ "version": "94.0.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -84,7 +84,6 @@
84
84
  "babel-eslint": "10.0.3",
85
85
  "babel-jest": "^26.6.3",
86
86
  "browserslist": "^4.16.6",
87
- "carbon-state-management": "^1.0.0",
88
87
  "chalk": "^4.1.1",
89
88
  "commitizen": "^4.2.4",
90
89
  "conventional-changelog-conventionalcommits": "^4.5.0",
@@ -114,7 +113,6 @@
114
113
  "eslint-plugin-react": "^7.20.3",
115
114
  "eslint-plugin-react-hooks": "^4.2.0",
116
115
  "events": "~1.1.1",
117
- "flux": "^4.0.1",
118
116
  "husky": "^4.3.6",
119
117
  "jest": "^26.6.3",
120
118
  "jest-styled-components": "^6.3.1",
@@ -124,7 +122,6 @@
124
122
  "prettier": "^2.1.2",
125
123
  "raf": "^3.4.0",
126
124
  "react": "^16.12.0",
127
- "react-dnd-test-backend": "^10.0.2",
128
125
  "react-dom": "^16.12.0",
129
126
  "react-test-renderer": "^16.12.0",
130
127
  "rimraf": "^3.0.2",
@@ -151,8 +148,6 @@
151
148
  "react-day-picker": "~6.1.1",
152
149
  "react-dnd": "^10.0.2",
153
150
  "react-dnd-html5-backend": "^10.0.2",
154
- "react-dnd-legacy": "npm:react-dnd@^2.6.0",
155
- "react-dnd-touch-backend": "0.2.7",
156
151
  "react-is": "^17.0.2",
157
152
  "react-transition-group": "^4.4.1",
158
153
  "sprintf-js": "^1.1.2",
@@ -1,213 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
- var _link = _interopRequireDefault(require("../link"));
15
-
16
- var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
17
-
18
- var _actionToolbar = require("./action-toolbar.style");
19
-
20
- var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
21
-
22
- var _i18nContext = _interopRequireDefault(require("../../__internal__/i18n-context"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _extends() { _extends = Object.assign || 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); }
27
-
28
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
-
30
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
31
-
32
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
33
-
34
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
35
-
36
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
37
-
38
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
-
40
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
41
-
42
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
-
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
-
46
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
-
48
- 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; }
49
-
50
- let deprecatedWarnTriggered = false;
51
- /**
52
- * A ActionToolbar widget.
53
- *
54
- * == How to use a ActionToolbar in a component:
55
- *
56
- * In your file
57
- *
58
- * import ActionToolbar from 'carbon-react/lib/components/action-toolbar';
59
- *
60
- * To render an ActionToolbar:
61
- *
62
- * let actions = {
63
- * subscription: {
64
- * text: "Add Subscriptions",
65
- * icon: "basket",
66
- * onClick: onClickHandler(event, selected) => {}
67
- * },
68
- * delete: {
69
- * text: "Delete",
70
- * icon: "bin",
71
- * onClick: onClickHandler(event, selected) => {}
72
- * }
73
- * };
74
- *
75
- * <ActionToolbar total={ count } actions={ actions } />
76
- *
77
- * Additional props for Link or Icon can be passed in the action object.
78
- *
79
- */
80
-
81
- let ActionToolbar = /*#__PURE__*/function (_React$Component) {
82
- _inherits(ActionToolbar, _React$Component);
83
-
84
- var _super = _createSuper(ActionToolbar);
85
-
86
- function ActionToolbar(...args) {
87
- var _this;
88
-
89
- _classCallCheck(this, ActionToolbar);
90
-
91
- _this = _super.call(this, ...args);
92
-
93
- _defineProperty(_assertThisInitialized(_this), "state", {
94
- total: 0,
95
- selected: {}
96
- });
97
-
98
- _defineProperty(_assertThisInitialized(_this), "handleOnClick", (onClick, selected) => {
99
- if (!onClick) {
100
- return null;
101
- }
102
-
103
- return event => onClick(selected, event);
104
- });
105
-
106
- _defineProperty(_assertThisInitialized(_this), "propsForChildren", () => {
107
- return {
108
- disabled: !_this.isActive(),
109
- selected: _this.state.selected,
110
- total: _this.state.total
111
- };
112
- });
113
-
114
- _this.actions = _this.actions.bind(_assertThisInitialized(_this));
115
- _this.isActive = _this.isActive.bind(_assertThisInitialized(_this));
116
- _this.buildAction = _this.buildAction.bind(_assertThisInitialized(_this));
117
-
118
- if (!deprecatedWarnTriggered) {
119
- deprecatedWarnTriggered = true;
120
-
121
- _logger.default.deprecate("`ActionToolbar` component is deprecated and will soon be removed.");
122
- }
123
-
124
- return _this;
125
- }
126
-
127
- _createClass(ActionToolbar, [{
128
- key: "UNSAFE_componentWillMount",
129
- value: function UNSAFE_componentWillMount() {
130
- if (this.context.attachActionToolbar) {
131
- this.context.attachActionToolbar(this);
132
- }
133
- }
134
- }, {
135
- key: "componentWillUnmount",
136
- value: function componentWillUnmount() {
137
- if (this.context.detachActionToolbar) {
138
- this.context.detachActionToolbar(this);
139
- }
140
- }
141
- }, {
142
- key: "actions",
143
- value: function actions() {
144
- const actions = [];
145
-
146
- for (const key in this.props.actions) {
147
- const action = this.props.actions[key];
148
- actions.push(this.buildAction(action, key));
149
- }
150
-
151
- return actions;
152
- }
153
- }, {
154
- key: "isActive",
155
- value: function isActive() {
156
- return this.state.total > 0;
157
- }
158
- }, {
159
- key: "linkClasses",
160
- value: function linkClasses(className) {
161
- return (0, _classnames.default)(className);
162
- }
163
- }, {
164
- key: "buildAction",
165
- value: function buildAction(action, index) {
166
- const {
167
- onClick,
168
- className,
169
- text,
170
- ...props
171
- } = action;
172
- return /*#__PURE__*/_react.default.createElement(_link.default, _extends({
173
- className: this.linkClasses(className),
174
- "data-element": "action",
175
- disabled: !this.isActive(),
176
- key: index,
177
- onClick: this.handleOnClick(onClick, this.state.selected)
178
- }, props), text);
179
- }
180
- }, {
181
- key: "render",
182
- value: function render() {
183
- return /*#__PURE__*/_react.default.createElement(_actionToolbar.StyledActionToolbar, _extends({
184
- className: this.props.className
185
- }, (0, _tags.default)("action-toolbar", this.props)), /*#__PURE__*/_react.default.createElement(_actionToolbar.StyledActionToolbarTotal, null, /*#__PURE__*/_react.default.createElement("strong", {
186
- "data-element": "total"
187
- }, this.state.total), "\xA0", /*#__PURE__*/_react.default.createElement(_i18nContext.default.Consumer, null, l => l.actionToolbar.selected())), /*#__PURE__*/_react.default.createElement(_actionToolbar.StyledActionToolbarActions, {
188
- disabled: !this.isActive()
189
- }, this.actions(), this.props.children && this.props.children(this.propsForChildren())));
190
- }
191
- }]);
192
-
193
- return ActionToolbar;
194
- }(_react.default.Component);
195
-
196
- ActionToolbar.propTypes = {
197
- /** The actions to display in the toolbar */
198
- actions: _propTypes.default.object.isRequired,
199
-
200
- /** A custom class name for the component. */
201
- className: _propTypes.default.string,
202
-
203
- /** A function to return child components for the action toolbar. */
204
- children: _propTypes.default.func
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
- };
212
- var _default = ActionToolbar;
213
- exports.default = _default;