carbon-react 129.0.0 → 131.0.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 (27) hide show
  1. package/esm/components/fieldset/fieldset.component.d.ts +2 -4
  2. package/esm/components/fieldset/fieldset.component.js +7 -18
  3. package/esm/components/fieldset/fieldset.style.d.ts +2 -5
  4. package/esm/components/fieldset/fieldset.style.js +27 -47
  5. package/esm/components/flat-table/sort/sort.component.d.ts +7 -5
  6. package/esm/components/flat-table/sort/sort.component.js +8 -4
  7. package/esm/components/tile-select/tile-select-group/tile-select-group.component.js +2 -2
  8. package/esm/components/tile-select/tile-select.component.js +1 -1
  9. package/esm/components/tile-select/tile-select.style.d.ts +1 -1
  10. package/esm/components/tile-select/tile-select.style.js +5 -7
  11. package/esm/locales/__internal__/es-es.js +3 -0
  12. package/esm/locales/en-gb.js +3 -0
  13. package/esm/locales/locale.d.ts +7 -4
  14. package/lib/components/fieldset/fieldset.component.d.ts +2 -4
  15. package/lib/components/fieldset/fieldset.component.js +6 -17
  16. package/lib/components/fieldset/fieldset.style.d.ts +2 -5
  17. package/lib/components/fieldset/fieldset.style.js +27 -47
  18. package/lib/components/flat-table/sort/sort.component.d.ts +7 -5
  19. package/lib/components/flat-table/sort/sort.component.js +8 -4
  20. package/lib/components/tile-select/tile-select-group/tile-select-group.component.js +2 -2
  21. package/lib/components/tile-select/tile-select.component.js +1 -1
  22. package/lib/components/tile-select/tile-select.style.d.ts +1 -1
  23. package/lib/components/tile-select/tile-select.style.js +4 -6
  24. package/lib/locales/__internal__/es-es.js +3 -0
  25. package/lib/locales/en-gb.js +3 -0
  26. package/lib/locales/locale.d.ts +7 -4
  27. package/package.json +1 -1
@@ -1,11 +1,9 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface FieldsetProps extends MarginProps {
4
- /** When true, legend is placed in line with the children */
5
- inline?: boolean;
6
4
  /** Child elements */
7
5
  children?: React.ReactNode;
8
- /** The text for the fieldsets legend element. */
6
+ /** The text for the fieldset's legend element. */
9
7
  legend?: string;
10
8
  /** Flag to configure fields as mandatory. */
11
9
  required?: boolean;
@@ -13,7 +11,7 @@ export interface FieldsetProps extends MarginProps {
13
11
  isOptional?: boolean;
14
12
  }
15
13
  export declare const Fieldset: {
16
- ({ children, inline, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
14
+ ({ children, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
17
15
  displayName: string;
18
16
  };
19
17
  export default Fieldset;
@@ -2,30 +2,18 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React, { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
5
- import { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle } from "./fieldset.style";
5
+ import { FieldsetStyle, StyledLegend } from "./fieldset.style";
6
6
  import { NewValidationContext } from "../carbon-provider/carbon-provider.component";
7
7
  import FormSpacingProvider from "../../__internal__/form-spacing-provider";
8
8
  import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
9
9
  export const Fieldset = ({
10
10
  children,
11
- inline = false,
12
11
  legend,
13
12
  required,
14
13
  isOptional,
15
14
  ...rest
16
15
  }) => {
17
16
  const [ref, setRef] = useState(null);
18
- const getLegend = () => {
19
- if (!legend) return null;
20
- return /*#__PURE__*/React.createElement(LegendContainerStyle, {
21
- isRequired: required,
22
- isOptional: isOptional,
23
- inline: inline,
24
- "data-component": "legend-style"
25
- }, /*#__PURE__*/React.createElement("legend", {
26
- "data-element": "legend"
27
- }, legend));
28
- };
29
17
  const marginProps = useFormSpacing(rest);
30
18
  useEffect(() => {
31
19
  if (ref && required) {
@@ -40,12 +28,13 @@ export const Fieldset = ({
40
28
  }
41
29
  }, /*#__PURE__*/React.createElement(FieldsetStyle, _extends({
42
30
  ref: setRef
43
- }, tagComponent("fieldset", rest), rest, marginProps), /*#__PURE__*/React.createElement(FieldsetContentStyle, {
44
- "data-component": "fieldset-style",
45
- inline: inline
46
- }, getLegend(), /*#__PURE__*/React.createElement(FormSpacingProvider, {
31
+ }, tagComponent("fieldset", rest), rest, marginProps), legend && /*#__PURE__*/React.createElement(StyledLegend, {
32
+ "data-element": "legend",
33
+ isRequired: required,
34
+ isOptional: isOptional
35
+ }, legend), /*#__PURE__*/React.createElement(FormSpacingProvider, {
47
36
  marginBottom: undefined
48
- }, children))));
37
+ }, children)));
49
38
  };
50
39
  Fieldset.displayName = "Fieldset";
51
40
  export default Fieldset;
@@ -1,12 +1,9 @@
1
1
  export interface StyledFieldsetProps {
2
- /** When true, legend is placed in line with the children */
3
- inline?: boolean;
4
2
  /** Flag to configure fields as mandatory. */
5
3
  isRequired?: boolean;
6
4
  /** Flag to configure fields as optional. */
7
5
  isOptional?: boolean;
8
6
  }
9
7
  declare const FieldsetStyle: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
10
- declare const LegendContainerStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
11
- declare const FieldsetContentStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
12
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
8
+ declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledFieldsetProps, never>;
9
+ export { FieldsetStyle, StyledLegend };
@@ -1,8 +1,6 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import FormFieldStyle from "../../__internal__/form-field/form-field.style";
4
- import ValidationIconStyle from "../../__internal__/validations/validation-icon.style";
5
- import StyledIcon from "../icon/icon.style";
6
4
  import baseTheme from "../../style/themes/base";
7
5
  import CheckboxStyle from "../checkbox/checkbox.style";
8
6
  const FieldsetStyle = styled.fieldset`
@@ -24,58 +22,40 @@ const FieldsetStyle = styled.fieldset`
24
22
  FieldsetStyle.defaultProps = {
25
23
  theme: baseTheme
26
24
  };
27
- const LegendContainerStyle = styled.div`
28
- ${({
29
- inline
30
- }) => inline && `
31
- margin-right: 32px;
32
- height: 34px !important;
33
- `}
25
+ const StyledLegend = styled.legend`
34
26
  display: flex;
35
27
  align-items: center;
36
28
  margin-bottom: 32px;
29
+ font-size: 20px;
30
+ font-weight: var(--fontWeights700);
31
+ color: var(--colorsUtilityYin090);
32
+ line-height: 24px;
33
+ margin-right: 4px;
37
34
 
38
- legend {
39
- font-size: 20px;
40
- font-weight: var(--fontWeights700);
41
- color: var(--colorsUtilityYin090);
42
- line-height: 24px;
43
- margin-right: 4px;
44
-
45
- ${({
35
+ ${({
46
36
  isRequired
47
37
  }) => isRequired && css`
48
- ::after {
49
- content: "*";
50
- line-height: 24px;
51
- color: var(--colorsSemanticNegative500);
52
- font-weight: var(--fontWeights700);
53
- margin-left: var(--spacing100);
54
- position: relative;
55
- top: 1px;
56
- left: -4px;
57
- }
58
- `}
38
+ ::after {
39
+ content: "*";
40
+ line-height: 24px;
41
+ color: var(--colorsSemanticNegative500);
42
+ font-weight: var(--fontWeights700);
43
+ margin-left: var(--spacing100);
44
+ position: relative;
45
+ top: 1px;
46
+ left: -4px;
47
+ }
48
+ `}
59
49
 
60
- ${({
50
+ ${({
61
51
  isOptional
62
52
  }) => isOptional && css`
63
- ::after {
64
- content: "(optional)";
65
- color: var(--colorsUtilityYin055);
66
- font-weight: var(--fontWeights400);
67
- margin-left: var(--spacing050);
68
- }
69
- `}
70
- }
71
-
72
- ${ValidationIconStyle} ${StyledIcon}:focus {
73
- outline: 2px solid #ffb500;
74
- }
75
- `;
76
- const FieldsetContentStyle = styled.div`
77
- ${({
78
- inline
79
- }) => inline && "display: flex;"}
53
+ ::after {
54
+ content: "(optional)";
55
+ color: var(--colorsUtilityYin055);
56
+ font-weight: var(--fontWeights400);
57
+ margin-left: var(--spacing050);
58
+ }
59
+ `}
80
60
  `;
81
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
61
+ export { FieldsetStyle, StyledLegend };
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
2
  export interface SortProps {
3
3
  /** if `asc` it will show `sort_up` icon, if `desc` it will show `sort_down` */
4
- sortType?: "ascending" | "descending" | false;
5
- /** Callback fired when the `FlatTableSortHeader` is clicked */
4
+ sortType?: "ascending" | "descending";
5
+ /** Callback fired when the component is clicked */
6
6
  onClick?: () => void;
7
- /** Sets the content of `FlatTableSortHeader` */
8
- children?: React.ReactNode;
7
+ /** Sets the text content of the component */
8
+ children?: string;
9
+ /** Sets the accessible name of the component */
10
+ accessibleName?: string;
9
11
  }
10
- export declare const Sort: ({ children, onClick, sortType }: SortProps) => React.JSX.Element;
12
+ export declare const Sort: ({ children, onClick, sortType, accessibleName, }: SortProps) => React.JSX.Element;
11
13
  export default Sort;
@@ -1,15 +1,19 @@
1
1
  import React, { useRef, useContext } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import Event from "../../../__internal__/utils/helpers/events";
4
+ import Typography from "../../typography";
4
5
  import { StyledSort, StyledSpaceHolder, StyledSortIcon } from "./sort.style";
5
6
  import guid from "../../../__internal__/utils/helpers/guid";
7
+ import useLocale from "../../../hooks/__internal__/useLocale";
6
8
  import { FlatTableThemeContext } from "../flat-table.component";
7
9
  export const Sort = ({
8
10
  children,
9
11
  onClick,
10
- sortType
12
+ sortType,
13
+ accessibleName
11
14
  }) => {
12
15
  const id = useRef(guid());
16
+ const locale = useLocale();
13
17
  const onKeyDown = e => {
14
18
  if (Event.isEnterOrSpaceKey(e)) {
15
19
  e.preventDefault();
@@ -20,10 +24,10 @@ export const Sort = ({
20
24
  const {
21
25
  colorTheme
22
26
  } = useContext(FlatTableThemeContext);
23
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
24
- hidden: true,
27
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
28
+ screenReaderOnly: true,
25
29
  id: id.current
26
- }, children, sortType ? `, sort type ${sortType}` : ", sortable"), /*#__PURE__*/React.createElement(StyledSort, {
30
+ }, accessibleName || locale.sort.accessibleName(children, sortType)), /*#__PURE__*/React.createElement(StyledSort, {
27
31
  role: "button",
28
32
  onKeyDown: onKeyDown,
29
33
  tabIndex: 0,
@@ -38,8 +38,8 @@ export const TileSelectGroup = ({
38
38
  legend: legend
39
39
  }, tagComponent("tile-select-group", rest), {
40
40
  multiSelect: multiSelect
41
- }, filterStyledSystemMarginProps(rest)), description ? /*#__PURE__*/React.createElement(StyledGroupDescription, {
41
+ }, filterStyledSystemMarginProps(rest)), description && /*#__PURE__*/React.createElement(StyledGroupDescription, {
42
42
  "data-element": "tile-select-group-description"
43
- }, description) : null, /*#__PURE__*/React.createElement("div", null, tiles));
43
+ }, description), tiles);
44
44
  };
45
45
  export default TileSelectGroup;
@@ -105,7 +105,7 @@ const TileSelect = /*#__PURE__*/React.forwardRef(({
105
105
  as: checkPropTypeIsNode(subtitle) ? "div" : undefined
106
106
  }, subtitle), titleAdornment && /*#__PURE__*/React.createElement(StyledAdornment, {
107
107
  hasAdditionalInformation: !!additionalInformation
108
- }, titleAdornment)), additionalInformation && /*#__PURE__*/React.createElement("div", null, additionalInformation), /*#__PURE__*/React.createElement(StyledDescription, {
108
+ }, titleAdornment && /*#__PURE__*/React.createElement("div", null, titleAdornment))), additionalInformation && /*#__PURE__*/React.createElement("div", null, additionalInformation), /*#__PURE__*/React.createElement(StyledDescription, {
109
109
  as: checkPropTypeIsNode(description) ? "div" : undefined
110
110
  }, description), footer && /*#__PURE__*/React.createElement(StyledFooterWrapper, null, footer), accordionContent && accordionControl && /*#__PURE__*/React.createElement(StyledAccordionFooterWrapper, {
111
111
  accordionExpanded: accordionExpanded
@@ -28,7 +28,7 @@ declare const StyledDeselectWrapper: import("styled-components").StyledComponent
28
28
  hasActionAdornment: boolean;
29
29
  }, never>;
30
30
  declare const StyledTileSelectFieldset: import("styled-components").StyledComponent<{
31
- ({ children, inline, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
31
+ ({ children, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
32
32
  displayName: string;
33
33
  }, any, {
34
34
  multiSelect: boolean;
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import Fieldset from "../fieldset";
4
4
  import { Input } from "../../__internal__/input";
5
- import { LegendContainerStyle } from "../fieldset/fieldset.style";
5
+ import { StyledLegend } from "../fieldset/fieldset.style";
6
6
  import StyledIcon from "../icon/icon.style";
7
7
  import { baseTheme } from "../../style/themes";
8
8
  import addFocusStyling from "../../style/utils/add-focus-styling";
@@ -166,13 +166,11 @@ const StyledDeselectWrapper = styled.div`
166
166
  const StyledTileSelectFieldset = styled(Fieldset)`
167
167
  ${margin}
168
168
 
169
- ${LegendContainerStyle} {
169
+ ${StyledLegend} {
170
170
  margin-bottom: 16px;
171
- legend {
172
- font-size: 16px;
173
- line-height: 16px;
174
- margin-left: -2px;
175
- }
171
+ font-size: 16px;
172
+ line-height: 16px;
173
+ margin-left: -2px;
176
174
  }
177
175
  ${({
178
176
  multiSelect
@@ -150,6 +150,9 @@ const esES = {
150
150
  close: () => "Cerrar"
151
151
  }
152
152
  },
153
+ sort: {
154
+ accessibleName: (sortContent, sortType) => `Ordenar todo ${sortContent || "contenido"}${sortType ? ` en orden ${sortType === "ascending" ? "ascendente" : "descendente"}.` : " en orden ascendente o descendente."}`
155
+ },
153
156
  splitButton: {
154
157
  ariaLabel: () => "Mostrar más"
155
158
  },
@@ -152,6 +152,9 @@ const enGB = {
152
152
  close: () => "Close"
153
153
  }
154
154
  },
155
+ sort: {
156
+ accessibleName: (sortContent, sortType) => `Sort all ${sortContent || "contents"}${sortType ? ` in an ${sortType} order.` : " in an ascending or descending order."}`
157
+ },
155
158
  splitButton: {
156
159
  ariaLabel: () => "Show more"
157
160
  },
@@ -127,18 +127,21 @@ interface Locale {
127
127
  close: () => string;
128
128
  };
129
129
  };
130
+ sort: {
131
+ accessibleName: (sortContent?: string, sortType?: "ascending" | "descending") => string;
132
+ };
130
133
  splitButton: {
131
134
  ariaLabel: () => string;
132
135
  };
133
- switch: {
134
- on: () => string;
135
- off: () => string;
136
- };
137
136
  stepFlow: {
138
137
  stepLabel: (currentStep: number, totalSteps: number) => string;
139
138
  screenReaderOnlyTitle: (title: string, currentStep: number, totalSteps: number, category?: string) => string;
140
139
  closeIconAriaLabel?: () => string;
141
140
  };
141
+ switch: {
142
+ on: () => string;
143
+ off: () => string;
144
+ };
142
145
  textEditor: {
143
146
  tooltipMessages: {
144
147
  bold: () => string;
@@ -1,11 +1,9 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface FieldsetProps extends MarginProps {
4
- /** When true, legend is placed in line with the children */
5
- inline?: boolean;
6
4
  /** Child elements */
7
5
  children?: React.ReactNode;
8
- /** The text for the fieldsets legend element. */
6
+ /** The text for the fieldset's legend element. */
9
7
  legend?: string;
10
8
  /** Flag to configure fields as mandatory. */
11
9
  required?: boolean;
@@ -13,7 +11,7 @@ export interface FieldsetProps extends MarginProps {
13
11
  isOptional?: boolean;
14
12
  }
15
13
  export declare const Fieldset: {
16
- ({ children, inline, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
14
+ ({ children, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
17
15
  displayName: string;
18
16
  };
19
17
  export default Fieldset;
@@ -17,24 +17,12 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
17
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
18
18
  const Fieldset = ({
19
19
  children,
20
- inline = false,
21
20
  legend,
22
21
  required,
23
22
  isOptional,
24
23
  ...rest
25
24
  }) => {
26
25
  const [ref, setRef] = (0, _react.useState)(null);
27
- const getLegend = () => {
28
- if (!legend) return null;
29
- return /*#__PURE__*/_react.default.createElement(_fieldset.LegendContainerStyle, {
30
- isRequired: required,
31
- isOptional: isOptional,
32
- inline: inline,
33
- "data-component": "legend-style"
34
- }, /*#__PURE__*/_react.default.createElement("legend", {
35
- "data-element": "legend"
36
- }, legend));
37
- };
38
26
  const marginProps = (0, _useFormSpacing.default)(rest);
39
27
  (0, _react.useEffect)(() => {
40
28
  if (ref && required) {
@@ -49,12 +37,13 @@ const Fieldset = ({
49
37
  }
50
38
  }, /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetStyle, _extends({
51
39
  ref: setRef
52
- }, (0, _tags.default)("fieldset", rest), rest, marginProps), /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetContentStyle, {
53
- "data-component": "fieldset-style",
54
- inline: inline
55
- }, getLegend(), /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
40
+ }, (0, _tags.default)("fieldset", rest), rest, marginProps), legend && /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, {
41
+ "data-element": "legend",
42
+ isRequired: required,
43
+ isOptional: isOptional
44
+ }, legend), /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
56
45
  marginBottom: undefined
57
- }, children))));
46
+ }, children)));
58
47
  };
59
48
  exports.Fieldset = Fieldset;
60
49
  Fieldset.displayName = "Fieldset";
@@ -1,12 +1,9 @@
1
1
  export interface StyledFieldsetProps {
2
- /** When true, legend is placed in line with the children */
3
- inline?: boolean;
4
2
  /** Flag to configure fields as mandatory. */
5
3
  isRequired?: boolean;
6
4
  /** Flag to configure fields as optional. */
7
5
  isOptional?: boolean;
8
6
  }
9
7
  declare const FieldsetStyle: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
10
- declare const LegendContainerStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
11
- declare const FieldsetContentStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
12
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
8
+ declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledFieldsetProps, never>;
9
+ export { FieldsetStyle, StyledLegend };
@@ -3,12 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LegendContainerStyle = exports.FieldsetStyle = exports.FieldsetContentStyle = void 0;
6
+ exports.StyledLegend = exports.FieldsetStyle = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _styledSystem = require("styled-system");
9
9
  var _formField = _interopRequireDefault(require("../../__internal__/form-field/form-field.style"));
10
- var _validationIcon = _interopRequireDefault(require("../../__internal__/validations/validation-icon.style"));
11
- var _icon = _interopRequireDefault(require("../icon/icon.style"));
12
10
  var _base = _interopRequireDefault(require("../../style/themes/base"));
13
11
  var _checkbox = _interopRequireDefault(require("../checkbox/checkbox.style"));
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -33,57 +31,39 @@ const FieldsetStyle = exports.FieldsetStyle = _styledComponents.default.fieldset
33
31
  FieldsetStyle.defaultProps = {
34
32
  theme: _base.default
35
33
  };
36
- const LegendContainerStyle = exports.LegendContainerStyle = _styledComponents.default.div`
37
- ${({
38
- inline
39
- }) => inline && `
40
- margin-right: 32px;
41
- height: 34px !important;
42
- `}
34
+ const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
43
35
  display: flex;
44
36
  align-items: center;
45
37
  margin-bottom: 32px;
38
+ font-size: 20px;
39
+ font-weight: var(--fontWeights700);
40
+ color: var(--colorsUtilityYin090);
41
+ line-height: 24px;
42
+ margin-right: 4px;
46
43
 
47
- legend {
48
- font-size: 20px;
49
- font-weight: var(--fontWeights700);
50
- color: var(--colorsUtilityYin090);
51
- line-height: 24px;
52
- margin-right: 4px;
53
-
54
- ${({
44
+ ${({
55
45
  isRequired
56
46
  }) => isRequired && (0, _styledComponents.css)`
57
- ::after {
58
- content: "*";
59
- line-height: 24px;
60
- color: var(--colorsSemanticNegative500);
61
- font-weight: var(--fontWeights700);
62
- margin-left: var(--spacing100);
63
- position: relative;
64
- top: 1px;
65
- left: -4px;
66
- }
67
- `}
47
+ ::after {
48
+ content: "*";
49
+ line-height: 24px;
50
+ color: var(--colorsSemanticNegative500);
51
+ font-weight: var(--fontWeights700);
52
+ margin-left: var(--spacing100);
53
+ position: relative;
54
+ top: 1px;
55
+ left: -4px;
56
+ }
57
+ `}
68
58
 
69
- ${({
59
+ ${({
70
60
  isOptional
71
61
  }) => isOptional && (0, _styledComponents.css)`
72
- ::after {
73
- content: "(optional)";
74
- color: var(--colorsUtilityYin055);
75
- font-weight: var(--fontWeights400);
76
- margin-left: var(--spacing050);
77
- }
78
- `}
79
- }
80
-
81
- ${_validationIcon.default} ${_icon.default}:focus {
82
- outline: 2px solid #ffb500;
83
- }
84
- `;
85
- const FieldsetContentStyle = exports.FieldsetContentStyle = _styledComponents.default.div`
86
- ${({
87
- inline
88
- }) => inline && "display: flex;"}
62
+ ::after {
63
+ content: "(optional)";
64
+ color: var(--colorsUtilityYin055);
65
+ font-weight: var(--fontWeights400);
66
+ margin-left: var(--spacing050);
67
+ }
68
+ `}
89
69
  `;
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
2
  export interface SortProps {
3
3
  /** if `asc` it will show `sort_up` icon, if `desc` it will show `sort_down` */
4
- sortType?: "ascending" | "descending" | false;
5
- /** Callback fired when the `FlatTableSortHeader` is clicked */
4
+ sortType?: "ascending" | "descending";
5
+ /** Callback fired when the component is clicked */
6
6
  onClick?: () => void;
7
- /** Sets the content of `FlatTableSortHeader` */
8
- children?: React.ReactNode;
7
+ /** Sets the text content of the component */
8
+ children?: string;
9
+ /** Sets the accessible name of the component */
10
+ accessibleName?: string;
9
11
  }
10
- export declare const Sort: ({ children, onClick, sortType }: SortProps) => React.JSX.Element;
12
+ export declare const Sort: ({ children, onClick, sortType, accessibleName, }: SortProps) => React.JSX.Element;
11
13
  export default Sort;
@@ -7,8 +7,10 @@ exports.default = exports.Sort = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _events = _interopRequireDefault(require("../../../__internal__/utils/helpers/events"));
10
+ var _typography = _interopRequireDefault(require("../../typography"));
10
11
  var _sort = require("./sort.style");
11
12
  var _guid = _interopRequireDefault(require("../../../__internal__/utils/helpers/guid"));
13
+ var _useLocale = _interopRequireDefault(require("../../../hooks/__internal__/useLocale"));
12
14
  var _flatTable = require("../flat-table.component");
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -16,9 +18,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
16
18
  const Sort = ({
17
19
  children,
18
20
  onClick,
19
- sortType
21
+ sortType,
22
+ accessibleName
20
23
  }) => {
21
24
  const id = (0, _react.useRef)((0, _guid.default)());
25
+ const locale = (0, _useLocale.default)();
22
26
  const onKeyDown = e => {
23
27
  if (_events.default.isEnterOrSpaceKey(e)) {
24
28
  e.preventDefault();
@@ -29,10 +33,10 @@ const Sort = ({
29
33
  const {
30
34
  colorTheme
31
35
  } = (0, _react.useContext)(_flatTable.FlatTableThemeContext);
32
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
33
- hidden: true,
36
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_typography.default, {
37
+ screenReaderOnly: true,
34
38
  id: id.current
35
- }, children, sortType ? `, sort type ${sortType}` : ", sortable"), /*#__PURE__*/_react.default.createElement(_sort.StyledSort, {
39
+ }, accessibleName || locale.sort.accessibleName(children, sortType)), /*#__PURE__*/_react.default.createElement(_sort.StyledSort, {
36
40
  role: "button",
37
41
  onKeyDown: onKeyDown,
38
42
  tabIndex: 0,
@@ -45,9 +45,9 @@ const TileSelectGroup = ({
45
45
  legend: legend
46
46
  }, (0, _tags.default)("tile-select-group", rest), {
47
47
  multiSelect: multiSelect
48
- }, (0, _utils.filterStyledSystemMarginProps)(rest)), description ? /*#__PURE__*/_react.default.createElement(_tileSelect.StyledGroupDescription, {
48
+ }, (0, _utils.filterStyledSystemMarginProps)(rest)), description && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledGroupDescription, {
49
49
  "data-element": "tile-select-group-description"
50
- }, description) : null, /*#__PURE__*/_react.default.createElement("div", null, tiles));
50
+ }, description), tiles);
51
51
  };
52
52
  exports.TileSelectGroup = TileSelectGroup;
53
53
  var _default = exports.default = TileSelectGroup;
@@ -114,7 +114,7 @@ const TileSelect = /*#__PURE__*/_react.default.forwardRef(({
114
114
  as: checkPropTypeIsNode(subtitle) ? "div" : undefined
115
115
  }, subtitle), titleAdornment && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAdornment, {
116
116
  hasAdditionalInformation: !!additionalInformation
117
- }, titleAdornment)), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, {
117
+ }, titleAdornment && /*#__PURE__*/_react.default.createElement("div", null, titleAdornment))), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, {
118
118
  as: checkPropTypeIsNode(description) ? "div" : undefined
119
119
  }, description), footer && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledFooterWrapper, null, footer), accordionContent && accordionControl && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAccordionFooterWrapper, {
120
120
  accordionExpanded: accordionExpanded
@@ -28,7 +28,7 @@ declare const StyledDeselectWrapper: import("styled-components").StyledComponent
28
28
  hasActionAdornment: boolean;
29
29
  }, never>;
30
30
  declare const StyledTileSelectFieldset: import("styled-components").StyledComponent<{
31
- ({ children, inline, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
31
+ ({ children, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
32
32
  displayName: string;
33
33
  }, any, {
34
34
  multiSelect: boolean;
@@ -175,13 +175,11 @@ const StyledDeselectWrapper = exports.StyledDeselectWrapper = _styledComponents.
175
175
  const StyledTileSelectFieldset = exports.StyledTileSelectFieldset = (0, _styledComponents.default)(_fieldset.default)`
176
176
  ${_styledSystem.margin}
177
177
 
178
- ${_fieldset2.LegendContainerStyle} {
178
+ ${_fieldset2.StyledLegend} {
179
179
  margin-bottom: 16px;
180
- legend {
181
- font-size: 16px;
182
- line-height: 16px;
183
- margin-left: -2px;
184
- }
180
+ font-size: 16px;
181
+ line-height: 16px;
182
+ margin-left: -2px;
185
183
  }
186
184
  ${({
187
185
  multiSelect
@@ -156,6 +156,9 @@ const esES = {
156
156
  close: () => "Cerrar"
157
157
  }
158
158
  },
159
+ sort: {
160
+ accessibleName: (sortContent, sortType) => `Ordenar todo ${sortContent || "contenido"}${sortType ? ` en orden ${sortType === "ascending" ? "ascendente" : "descendente"}.` : " en orden ascendente o descendente."}`
161
+ },
159
162
  splitButton: {
160
163
  ariaLabel: () => "Mostrar más"
161
164
  },
@@ -158,6 +158,9 @@ const enGB = {
158
158
  close: () => "Close"
159
159
  }
160
160
  },
161
+ sort: {
162
+ accessibleName: (sortContent, sortType) => `Sort all ${sortContent || "contents"}${sortType ? ` in an ${sortType} order.` : " in an ascending or descending order."}`
163
+ },
161
164
  splitButton: {
162
165
  ariaLabel: () => "Show more"
163
166
  },
@@ -127,18 +127,21 @@ interface Locale {
127
127
  close: () => string;
128
128
  };
129
129
  };
130
+ sort: {
131
+ accessibleName: (sortContent?: string, sortType?: "ascending" | "descending") => string;
132
+ };
130
133
  splitButton: {
131
134
  ariaLabel: () => string;
132
135
  };
133
- switch: {
134
- on: () => string;
135
- off: () => string;
136
- };
137
136
  stepFlow: {
138
137
  stepLabel: (currentStep: number, totalSteps: number) => string;
139
138
  screenReaderOnlyTitle: (title: string, currentStep: number, totalSteps: number, category?: string) => string;
140
139
  closeIconAriaLabel?: () => string;
141
140
  };
141
+ switch: {
142
+ on: () => string;
143
+ off: () => string;
144
+ };
142
145
  textEditor: {
143
146
  tooltipMessages: {
144
147
  bold: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "129.0.0",
3
+ "version": "131.0.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",