carbon-react 117.2.0 → 117.2.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 (31) hide show
  1. package/esm/__internal__/fieldset/fieldset.component.js +2 -3
  2. package/esm/__internal__/fieldset/fieldset.style.js +1 -0
  3. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +20 -2
  4. package/esm/components/advanced-color-picker/advanced-color-picker.style.d.ts +6 -1
  5. package/esm/components/advanced-color-picker/advanced-color-picker.style.js +8 -1
  6. package/esm/components/definition-list/dl.component.d.ts +2 -0
  7. package/esm/components/definition-list/dl.component.js +1 -0
  8. package/esm/components/fieldset/fieldset.component.js +1 -3
  9. package/esm/components/fieldset/fieldset.style.js +1 -0
  10. package/esm/components/i18n-provider/i18n-provider.component.js +5 -0
  11. package/esm/locales/en-gb.js +5 -0
  12. package/esm/locales/locale.d.ts +5 -0
  13. package/esm/locales/pl-pl.js +46 -0
  14. package/esm/style/utils/visually-hidden.d.ts +2 -0
  15. package/esm/style/utils/visually-hidden.js +10 -0
  16. package/lib/__internal__/fieldset/fieldset.component.js +2 -3
  17. package/lib/__internal__/fieldset/fieldset.style.js +1 -0
  18. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +22 -1
  19. package/lib/components/advanced-color-picker/advanced-color-picker.style.d.ts +6 -1
  20. package/lib/components/advanced-color-picker/advanced-color-picker.style.js +11 -1
  21. package/lib/components/definition-list/dl.component.d.ts +2 -0
  22. package/lib/components/definition-list/dl.component.js +1 -0
  23. package/lib/components/fieldset/fieldset.component.js +1 -3
  24. package/lib/components/fieldset/fieldset.style.js +1 -0
  25. package/lib/components/i18n-provider/i18n-provider.component.js +5 -0
  26. package/lib/locales/en-gb.js +5 -0
  27. package/lib/locales/locale.d.ts +5 -0
  28. package/lib/locales/pl-pl.js +46 -0
  29. package/lib/style/utils/visually-hidden.d.ts +2 -0
  30. package/lib/style/utils/visually-hidden.js +20 -0
  31. package/package.json +1 -1
@@ -25,9 +25,8 @@ const Fieldset = ({
25
25
  return /*#__PURE__*/React.createElement(InputGroupBehaviour, {
26
26
  blockGroupBehaviour: blockGroupBehaviour
27
27
  }, /*#__PURE__*/React.createElement(StyledFieldset, _extends({
28
- "data-component": "fieldset",
29
- m: 0
30
- }, marginProps, rest), legend && /*#__PURE__*/React.createElement(InputGroupContext.Consumer, null, ({
28
+ "data-component": "fieldset"
29
+ }, rest, marginProps), legend && /*#__PURE__*/React.createElement(InputGroupContext.Consumer, null, ({
31
30
  onMouseEnter,
32
31
  onMouseLeave
33
32
  }) => /*#__PURE__*/React.createElement(StyledLegend, {
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import BaseTheme from "../../style/themes/base";
4
4
  const StyledFieldset = styled.fieldset`
5
+ margin: 0;
5
6
  ${margin}
6
7
  border: none;
7
8
  padding: 0;
@@ -2,10 +2,13 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React, { useState, useEffect, useCallback, useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
- import { StyledAdvancedColorPickerWrapper, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle } from "./advanced-color-picker.style";
5
+ import { StyledAdvancedColorPickerWrapper, HiddenCurrentColorList, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle } from "./advanced-color-picker.style";
6
6
  import { SimpleColorPicker, SimpleColor } from "../simple-color-picker";
7
7
  import Events from "../../__internal__/utils/helpers/events";
8
8
  import { filterStyledSystemMarginProps } from "../../style/utils";
9
+ import guid from "../../__internal__/utils/helpers/guid";
10
+ import useLocale from "../../hooks/__internal__/useLocale";
11
+ import { Dt, Dd } from "../definition-list";
9
12
 
10
13
  const AdvancedColorPicker = ({
11
14
  "aria-describedby": ariaDescribedBy,
@@ -26,6 +29,8 @@ const AdvancedColorPicker = ({
26
29
  const [dialogOpen, setDialogOpen] = useState();
27
30
  const currentColor = selectedColor || defaultColor;
28
31
  const [selectedColorRef, setSelectedColorRef] = useState(null);
32
+ const descriptionId = useRef(guid());
33
+ const l = useLocale();
29
34
  const simpleColorPickerData = useRef(null);
30
35
  const colors = availableColors.map(({
31
36
  value,
@@ -41,6 +46,14 @@ const AdvancedColorPicker = ({
41
46
  simpleColorPickerData.current ? simpleColorPickerData.current.gridItemRefs[index] : null
42
47
  };
43
48
  });
49
+
50
+ const currentSelectedColor = () => {
51
+ var _availableColors$find;
52
+
53
+ const returnedColor = (_availableColors$find = availableColors.find(color => color.value === currentColor)) === null || _availableColors$find === void 0 ? void 0 : _availableColors$find.label;
54
+ return returnedColor || currentColor;
55
+ };
56
+
44
57
  useEffect(() => {
45
58
  if (dialogOpen || open) {
46
59
  const newColor = colors === null || colors === void 0 ? void 0 : colors.find(c => currentColor === c.value);
@@ -114,11 +127,16 @@ const AdvancedColorPicker = ({
114
127
  m: "15px auto auto 15px"
115
128
  }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledAdvancedColorPickerCell, {
116
129
  "data-element": "color-picker-cell",
130
+ "aria-label": l.advancedColorPicker.ariaLabel(),
131
+ "aria-describedby": descriptionId.current,
117
132
  onClick: handleOnOpen,
118
133
  onKeyDown: handleOnKeyDown,
119
134
  color: currentColor,
120
135
  tabIndex: 0
121
- }), /*#__PURE__*/React.createElement(DialogStyle, {
136
+ }), /*#__PURE__*/React.createElement(HiddenCurrentColorList, {
137
+ id: descriptionId.current,
138
+ "data-element": "current-color-description"
139
+ }, /*#__PURE__*/React.createElement(Dt, null, l.advancedColorPicker.currentColorDescriptionTerm(currentSelectedColor())), /*#__PURE__*/React.createElement(Dd, null, l.advancedColorPicker.currentColorAssigned(currentSelectedColor()))), /*#__PURE__*/React.createElement(DialogStyle, {
122
140
  "aria-describedby": ariaDescribedBy,
123
141
  "aria-label": ariaLabel,
124
142
  "aria-labelledby": ariaLabelledBy,
@@ -1,6 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import StyledAdvancedColorPickerCell from "./advanced-color-picker-cell.style";
3
3
  declare const StyledAdvancedColorPickerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ /** To be replaced by accessibly hidden class added in FE-5503 */
5
+ declare const HiddenCurrentColorList: import("styled-components").StyledComponent<{
6
+ ({ children, w, dtTextAlign, ddTextAlign, asSingleColumn, ...rest }: import("../definition-list").DlProps): JSX.Element;
7
+ displayName: string;
8
+ }, any, {}, never>;
4
9
  declare const StyledAdvancedColorPickerPreview: import("styled-components").StyledComponent<"div", any, {}, never>;
5
10
  declare const DialogStyle: import("styled-components").StyledComponent<({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, focusableSelectors, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: import("../dialog/dialog.component").DialogProps) => JSX.Element, any, {}, never>;
6
- export { StyledAdvancedColorPickerWrapper, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle, };
11
+ export { StyledAdvancedColorPickerWrapper, HiddenCurrentColorList, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle, };
@@ -8,10 +8,17 @@ import Dialog from "../dialog/dialog.component";
8
8
  import StyledIconButton from "../icon-button/icon-button.style";
9
9
  import checkerBoardSvg from "../simple-color-picker/simple-color/checker-board.svg";
10
10
  import baseTheme from "../../style/themes/base";
11
+ import visuallyHiddenStyles from "../../style/utils/visually-hidden";
12
+ import { Dl } from "../definition-list";
11
13
  const StyledAdvancedColorPickerWrapper = styled.div`
12
14
  ${margin}
13
15
  display: inline-block;
14
16
  `;
17
+ /** To be replaced by accessibly hidden class added in FE-5503 */
18
+
19
+ const HiddenCurrentColorList = styled(Dl)`
20
+ ${visuallyHiddenStyles}
21
+ `;
15
22
  StyledAdvancedColorPickerWrapper.defaultProps = {
16
23
  theme: baseTheme
17
24
  };
@@ -75,4 +82,4 @@ const DialogStyle = styled(Dialog)`
75
82
  color: var(--colorsActionMinor500);
76
83
  }
77
84
  `;
78
- export { StyledAdvancedColorPickerWrapper, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle };
85
+ export { StyledAdvancedColorPickerWrapper, HiddenCurrentColorList, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle };
@@ -2,6 +2,8 @@ import React from "react";
2
2
  import { SpaceProps } from "styled-system";
3
3
  import { StyledDtDivProps, StyledDdDivProps, StyledDlProps } from "./definition-list.style";
4
4
  export interface DlProps extends SpaceProps, StyledDlProps, StyledDtDivProps, StyledDdDivProps {
5
+ /** HTML id attribute of the input */
6
+ id?: string;
5
7
  /** prop to render children. */
6
8
  children: React.ReactNode;
7
9
  }
@@ -75,6 +75,7 @@ Dl.propTypes = {
75
75
  "children": PropTypes.node,
76
76
  "ddTextAlign": PropTypes.oneOf(["center", "left", "right"]),
77
77
  "dtTextAlign": PropTypes.oneOf(["center", "left", "right"]),
78
+ "id": PropTypes.string,
78
79
  "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
79
80
  "__@toStringTag": PropTypes.string.isRequired,
80
81
  "description": PropTypes.string,
@@ -29,9 +29,7 @@ const Fieldset = ({
29
29
  value: {
30
30
  validationRedesignOptIn: false
31
31
  }
32
- }, /*#__PURE__*/React.createElement(FieldsetStyle, _extends({}, tagComponent("fieldset", rest), rest, {
33
- m: 0
34
- }, marginProps), /*#__PURE__*/React.createElement(FieldsetContentStyle, {
32
+ }, /*#__PURE__*/React.createElement(FieldsetStyle, _extends({}, tagComponent("fieldset", rest), rest, marginProps), /*#__PURE__*/React.createElement(FieldsetContentStyle, {
35
33
  "data-component": "fieldset-style",
36
34
  inline: inline
37
35
  }, getLegend(), /*#__PURE__*/React.createElement(FormSpacingProvider, {
@@ -6,6 +6,7 @@ import StyledIcon from "../icon/icon.style";
6
6
  import baseTheme from "../../style/themes/base";
7
7
  import CheckboxStyle from "../checkbox/checkbox.style";
8
8
  const FieldsetStyle = styled.fieldset`
9
+ margin: 0;
9
10
  ${margin}
10
11
  border: none;
11
12
  padding: 0;
@@ -21,6 +21,11 @@ I18nProvider.propTypes = {
21
21
  "delete": PropTypes.func.isRequired,
22
22
  "edit": PropTypes.func.isRequired
23
23
  }),
24
+ "advancedColorPicker": PropTypes.shape({
25
+ "ariaLabel": PropTypes.func.isRequired,
26
+ "currentColorAssigned": PropTypes.func.isRequired,
27
+ "currentColorDescriptionTerm": PropTypes.func.isRequired
28
+ }),
24
29
  "batchSelection": PropTypes.shape({
25
30
  "selected": PropTypes.func.isRequired
26
31
  }),
@@ -11,6 +11,11 @@ const enGB = {
11
11
  actionPopover: {
12
12
  ariaLabel: () => "actions"
13
13
  },
14
+ advancedColorPicker: {
15
+ ariaLabel: () => "Change colour",
16
+ currentColorDescriptionTerm: () => "Current color assigned: ",
17
+ currentColorAssigned: currentColor => currentColor
18
+ },
14
19
  batchSelection: {
15
20
  selected: count => `${count} selected`
16
21
  },
@@ -8,6 +8,11 @@ interface Locale {
8
8
  actionPopover: {
9
9
  ariaLabel: () => string;
10
10
  };
11
+ advancedColorPicker: {
12
+ ariaLabel: () => string;
13
+ currentColorDescriptionTerm: (currentColor: string) => string;
14
+ currentColorAssigned: (currentColor: string) => string;
15
+ };
11
16
  batchSelection: {
12
17
  selected: (count: number | string) => string;
13
18
  };
@@ -13,6 +13,47 @@ export const PolishPlural = (singularNominativ, pluralNominativ, pluralGenitive,
13
13
 
14
14
  return pluralGenitive;
15
15
  };
16
+
17
+ const translateColor = color => {
18
+ switch (color.toLowerCase()) {
19
+ case "white":
20
+ return "biały";
21
+
22
+ case "transparent":
23
+ return "przezroczysty";
24
+
25
+ case "black":
26
+ return "czarny";
27
+
28
+ case "blue":
29
+ return "niebieski";
30
+
31
+ case "pink":
32
+ return "różowy";
33
+
34
+ case "purple":
35
+ return "fioletowy";
36
+
37
+ case "goldenrod":
38
+ return "złoty";
39
+
40
+ case "orchid":
41
+ return "ciemny róż";
42
+
43
+ case "desert":
44
+ return "pustynny";
45
+
46
+ case "turquoise":
47
+ return "turkusowy";
48
+
49
+ case "mint":
50
+ return "miętowy";
51
+
52
+ default:
53
+ return color;
54
+ }
55
+ };
56
+
16
57
  const plPL = {
17
58
  locale: () => "pl-PL",
18
59
  actions: {
@@ -22,6 +63,11 @@ const plPL = {
22
63
  actionPopover: {
23
64
  ariaLabel: () => "akcje"
24
65
  },
66
+ advancedColorPicker: {
67
+ ariaLabel: () => "Zmień kolor",
68
+ currentColorDescriptionTerm: currentColor => translateColor(currentColor) === "biały" ? "Aktualny przypisany kolor: " : "Aktualnie przypisany kolor: ",
69
+ currentColorAssigned: currentColor => translateColor(currentColor)
70
+ },
25
71
  batchSelection: {
26
72
  selected: count => `${count} wybrano`
27
73
  },
@@ -0,0 +1,2 @@
1
+ declare const _default: import("styled-components").FlattenSimpleInterpolation;
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { css } from "styled-components";
2
+ export default css`
3
+ border: 0;
4
+ height: 1px;
5
+ margin: -1px;
6
+ overflow: hidden;
7
+ padding: 0;
8
+ position: absolute;
9
+ width: 1px;
10
+ `;
@@ -39,9 +39,8 @@ const Fieldset = ({
39
39
  return /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupBehaviour, {
40
40
  blockGroupBehaviour: blockGroupBehaviour
41
41
  }, /*#__PURE__*/_react.default.createElement(_fieldset.StyledFieldset, _extends({
42
- "data-component": "fieldset",
43
- m: 0
44
- }, marginProps, rest), legend && /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupContext.Consumer, null, ({
42
+ "data-component": "fieldset"
43
+ }, rest, marginProps), legend && /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupContext.Consumer, null, ({
45
44
  onMouseEnter,
46
45
  onMouseLeave
47
46
  }) => /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, {
@@ -18,6 +18,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
18
18
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
20
  const StyledFieldset = _styledComponents.default.fieldset`
21
+ margin: 0;
21
22
  ${_styledSystem.margin}
22
23
  border: none;
23
24
  padding: 0;
@@ -17,6 +17,12 @@ var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/e
17
17
 
18
18
  var _utils = require("../../style/utils");
19
19
 
20
+ var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
21
+
22
+ var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
23
+
24
+ var _definitionList = require("../definition-list");
25
+
20
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
27
 
22
28
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -44,6 +50,8 @@ const AdvancedColorPicker = ({
44
50
  const [dialogOpen, setDialogOpen] = (0, _react.useState)();
45
51
  const currentColor = selectedColor || defaultColor;
46
52
  const [selectedColorRef, setSelectedColorRef] = (0, _react.useState)(null);
53
+ const descriptionId = (0, _react.useRef)((0, _guid.default)());
54
+ const l = (0, _useLocale.default)();
47
55
  const simpleColorPickerData = (0, _react.useRef)(null);
48
56
  const colors = availableColors.map(({
49
57
  value,
@@ -59,6 +67,14 @@ const AdvancedColorPicker = ({
59
67
  simpleColorPickerData.current ? simpleColorPickerData.current.gridItemRefs[index] : null
60
68
  };
61
69
  });
70
+
71
+ const currentSelectedColor = () => {
72
+ var _availableColors$find;
73
+
74
+ const returnedColor = (_availableColors$find = availableColors.find(color => color.value === currentColor)) === null || _availableColors$find === void 0 ? void 0 : _availableColors$find.label;
75
+ return returnedColor || currentColor;
76
+ };
77
+
62
78
  (0, _react.useEffect)(() => {
63
79
  if (dialogOpen || open) {
64
80
  const newColor = colors === null || colors === void 0 ? void 0 : colors.find(c => currentColor === c.value);
@@ -132,11 +148,16 @@ const AdvancedColorPicker = ({
132
148
  m: "15px auto auto 15px"
133
149
  }, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_advancedColorPicker.StyledAdvancedColorPickerCell, {
134
150
  "data-element": "color-picker-cell",
151
+ "aria-label": l.advancedColorPicker.ariaLabel(),
152
+ "aria-describedby": descriptionId.current,
135
153
  onClick: handleOnOpen,
136
154
  onKeyDown: handleOnKeyDown,
137
155
  color: currentColor,
138
156
  tabIndex: 0
139
- }), /*#__PURE__*/_react.default.createElement(_advancedColorPicker.DialogStyle, {
157
+ }), /*#__PURE__*/_react.default.createElement(_advancedColorPicker.HiddenCurrentColorList, {
158
+ id: descriptionId.current,
159
+ "data-element": "current-color-description"
160
+ }, /*#__PURE__*/_react.default.createElement(_definitionList.Dt, null, l.advancedColorPicker.currentColorDescriptionTerm(currentSelectedColor())), /*#__PURE__*/_react.default.createElement(_definitionList.Dd, null, l.advancedColorPicker.currentColorAssigned(currentSelectedColor()))), /*#__PURE__*/_react.default.createElement(_advancedColorPicker.DialogStyle, {
140
161
  "aria-describedby": ariaDescribedBy,
141
162
  "aria-label": ariaLabel,
142
163
  "aria-labelledby": ariaLabelledBy,
@@ -1,6 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import StyledAdvancedColorPickerCell from "./advanced-color-picker-cell.style";
3
3
  declare const StyledAdvancedColorPickerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ /** To be replaced by accessibly hidden class added in FE-5503 */
5
+ declare const HiddenCurrentColorList: import("styled-components").StyledComponent<{
6
+ ({ children, w, dtTextAlign, ddTextAlign, asSingleColumn, ...rest }: import("../definition-list").DlProps): JSX.Element;
7
+ displayName: string;
8
+ }, any, {}, never>;
4
9
  declare const StyledAdvancedColorPickerPreview: import("styled-components").StyledComponent<"div", any, {}, never>;
5
10
  declare const DialogStyle: import("styled-components").StyledComponent<({ className, children, open, height, size, title, disableEscKey, subtitle, disableAutoFocus, focusFirstElement, focusableSelectors, onCancel, showCloseIcon, bespokeFocusTrap, disableClose, help, role, contentPadding, focusableContainers, ...rest }: import("../dialog/dialog.component").DialogProps) => JSX.Element, any, {}, never>;
6
- export { StyledAdvancedColorPickerWrapper, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle, };
11
+ export { StyledAdvancedColorPickerWrapper, HiddenCurrentColorList, StyledAdvancedColorPickerCell, StyledAdvancedColorPickerPreview, DialogStyle, };
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "StyledAdvancedColorPickerCell", {
9
9
  return _advancedColorPickerCell.default;
10
10
  }
11
11
  });
12
- exports.DialogStyle = exports.StyledAdvancedColorPickerPreview = exports.StyledAdvancedColorPickerWrapper = void 0;
12
+ exports.DialogStyle = exports.StyledAdvancedColorPickerPreview = exports.HiddenCurrentColorList = exports.StyledAdvancedColorPickerWrapper = void 0;
13
13
 
14
14
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
15
15
 
@@ -31,6 +31,10 @@ var _checkerBoard = _interopRequireDefault(require("../simple-color-picker/simpl
31
31
 
32
32
  var _base = _interopRequireDefault(require("../../style/themes/base"));
33
33
 
34
+ var _visuallyHidden = _interopRequireDefault(require("../../style/utils/visually-hidden"));
35
+
36
+ var _definitionList = require("../definition-list");
37
+
34
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
39
 
36
40
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -41,7 +45,13 @@ const StyledAdvancedColorPickerWrapper = _styledComponents.default.div`
41
45
  ${_styledSystem.margin}
42
46
  display: inline-block;
43
47
  `;
48
+ /** To be replaced by accessibly hidden class added in FE-5503 */
49
+
44
50
  exports.StyledAdvancedColorPickerWrapper = StyledAdvancedColorPickerWrapper;
51
+ const HiddenCurrentColorList = (0, _styledComponents.default)(_definitionList.Dl)`
52
+ ${_visuallyHidden.default}
53
+ `;
54
+ exports.HiddenCurrentColorList = HiddenCurrentColorList;
45
55
  StyledAdvancedColorPickerWrapper.defaultProps = {
46
56
  theme: _base.default
47
57
  };
@@ -2,6 +2,8 @@ import React from "react";
2
2
  import { SpaceProps } from "styled-system";
3
3
  import { StyledDtDivProps, StyledDdDivProps, StyledDlProps } from "./definition-list.style";
4
4
  export interface DlProps extends SpaceProps, StyledDlProps, StyledDtDivProps, StyledDdDivProps {
5
+ /** HTML id attribute of the input */
6
+ id?: string;
5
7
  /** prop to render children. */
6
8
  children: React.ReactNode;
7
9
  }
@@ -94,6 +94,7 @@ Dl.propTypes = {
94
94
  "children": _propTypes.default.node,
95
95
  "ddTextAlign": _propTypes.default.oneOf(["center", "left", "right"]),
96
96
  "dtTextAlign": _propTypes.default.oneOf(["center", "left", "right"]),
97
+ "id": _propTypes.default.string,
97
98
  "m": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
98
99
  "__@toStringTag": _propTypes.default.string.isRequired,
99
100
  "description": _propTypes.default.string,
@@ -44,9 +44,7 @@ const Fieldset = ({
44
44
  value: {
45
45
  validationRedesignOptIn: false
46
46
  }
47
- }, /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetStyle, _extends({}, (0, _tags.default)("fieldset", rest), rest, {
48
- m: 0
49
- }, marginProps), /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetContentStyle, {
47
+ }, /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetStyle, _extends({}, (0, _tags.default)("fieldset", rest), rest, marginProps), /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetContentStyle, {
50
48
  "data-component": "fieldset-style",
51
49
  inline: inline
52
50
  }, getLegend(), /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
@@ -22,6 +22,7 @@ var _checkbox = _interopRequireDefault(require("../checkbox/checkbox.style"));
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
24
24
  const FieldsetStyle = _styledComponents.default.fieldset`
25
+ margin: 0;
25
26
  ${_styledSystem.margin}
26
27
  border: none;
27
28
  padding: 0;
@@ -35,6 +35,11 @@ I18nProvider.propTypes = {
35
35
  "delete": _propTypes.default.func.isRequired,
36
36
  "edit": _propTypes.default.func.isRequired
37
37
  }),
38
+ "advancedColorPicker": _propTypes.default.shape({
39
+ "ariaLabel": _propTypes.default.func.isRequired,
40
+ "currentColorAssigned": _propTypes.default.func.isRequired,
41
+ "currentColorDescriptionTerm": _propTypes.default.func.isRequired
42
+ }),
38
43
  "batchSelection": _propTypes.default.shape({
39
44
  "selected": _propTypes.default.func.isRequired
40
45
  }),
@@ -18,6 +18,11 @@ const enGB = {
18
18
  actionPopover: {
19
19
  ariaLabel: () => "actions"
20
20
  },
21
+ advancedColorPicker: {
22
+ ariaLabel: () => "Change colour",
23
+ currentColorDescriptionTerm: () => "Current color assigned: ",
24
+ currentColorAssigned: currentColor => currentColor
25
+ },
21
26
  batchSelection: {
22
27
  selected: count => `${count} selected`
23
28
  },
@@ -8,6 +8,11 @@ interface Locale {
8
8
  actionPopover: {
9
9
  ariaLabel: () => string;
10
10
  };
11
+ advancedColorPicker: {
12
+ ariaLabel: () => string;
13
+ currentColorDescriptionTerm: (currentColor: string) => string;
14
+ currentColorAssigned: (currentColor: string) => string;
15
+ };
11
16
  batchSelection: {
12
17
  selected: (count: number | string) => string;
13
18
  };
@@ -22,6 +22,47 @@ const PolishPlural = (singularNominativ, pluralNominativ, pluralGenitive, value)
22
22
  };
23
23
 
24
24
  exports.PolishPlurals = exports.PolishPlural = PolishPlural;
25
+
26
+ const translateColor = color => {
27
+ switch (color.toLowerCase()) {
28
+ case "white":
29
+ return "biały";
30
+
31
+ case "transparent":
32
+ return "przezroczysty";
33
+
34
+ case "black":
35
+ return "czarny";
36
+
37
+ case "blue":
38
+ return "niebieski";
39
+
40
+ case "pink":
41
+ return "różowy";
42
+
43
+ case "purple":
44
+ return "fioletowy";
45
+
46
+ case "goldenrod":
47
+ return "złoty";
48
+
49
+ case "orchid":
50
+ return "ciemny róż";
51
+
52
+ case "desert":
53
+ return "pustynny";
54
+
55
+ case "turquoise":
56
+ return "turkusowy";
57
+
58
+ case "mint":
59
+ return "miętowy";
60
+
61
+ default:
62
+ return color;
63
+ }
64
+ };
65
+
25
66
  const plPL = {
26
67
  locale: () => "pl-PL",
27
68
  actions: {
@@ -31,6 +72,11 @@ const plPL = {
31
72
  actionPopover: {
32
73
  ariaLabel: () => "akcje"
33
74
  },
75
+ advancedColorPicker: {
76
+ ariaLabel: () => "Zmień kolor",
77
+ currentColorDescriptionTerm: currentColor => translateColor(currentColor) === "biały" ? "Aktualny przypisany kolor: " : "Aktualnie przypisany kolor: ",
78
+ currentColorAssigned: currentColor => translateColor(currentColor)
79
+ },
34
80
  batchSelection: {
35
81
  selected: count => `${count} wybrano`
36
82
  },
@@ -0,0 +1,2 @@
1
+ declare const _default: import("styled-components").FlattenSimpleInterpolation;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _styledComponents = require("styled-components");
9
+
10
+ var _default = (0, _styledComponents.css)`
11
+ border: 0;
12
+ height: 1px;
13
+ margin: -1px;
14
+ overflow: hidden;
15
+ padding: 0;
16
+ position: absolute;
17
+ width: 1px;
18
+ `;
19
+
20
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "117.2.0",
3
+ "version": "117.2.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",