carbon-react 117.1.1 → 117.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 (77) hide show
  1. package/esm/__internal__/checkable-input/checkable-input.component.js +6 -4
  2. package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -0
  3. package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +19 -2
  4. package/esm/__internal__/input/input.component.d.ts +4 -0
  5. package/esm/__internal__/input/input.component.js +13 -0
  6. package/esm/__internal__/input-icon-toggle/input-icon-toggle.component.js +1 -1
  7. package/esm/__internal__/label/label.component.js +1 -2
  8. package/esm/__internal__/validation-message/validation-message.component.d.ts +3 -1
  9. package/esm/__internal__/validation-message/validation-message.component.js +3 -0
  10. package/esm/__internal__/validations/validation-icon.component.js +5 -3
  11. package/esm/components/breadcrumbs/breadcrumbs.component.d.ts +8 -0
  12. package/esm/components/breadcrumbs/breadcrumbs.component.js +28 -0
  13. package/esm/components/breadcrumbs/breadcrumbs.style.d.ts +2 -0
  14. package/esm/components/breadcrumbs/breadcrumbs.style.js +9 -0
  15. package/esm/components/breadcrumbs/crumb/crumb.component.d.ts +11 -0
  16. package/esm/components/breadcrumbs/crumb/crumb.component.js +80 -0
  17. package/esm/components/breadcrumbs/crumb/crumb.style.d.ts +18 -0
  18. package/esm/components/breadcrumbs/crumb/crumb.style.js +33 -0
  19. package/esm/components/breadcrumbs/crumb/index.d.ts +2 -0
  20. package/esm/components/breadcrumbs/crumb/index.js +1 -0
  21. package/esm/components/breadcrumbs/index.d.ts +4 -0
  22. package/esm/components/breadcrumbs/index.js +2 -0
  23. package/esm/components/checkbox/checkbox.component.js +2 -0
  24. package/esm/components/decimal/decimal.component.js +2 -0
  25. package/esm/components/grouped-character/grouped-character.component.js +2 -0
  26. package/esm/components/i18n-provider/i18n-provider.component.js +3 -0
  27. package/esm/components/number/number.component.js +2 -0
  28. package/esm/components/radio-button/radio-button.component.js +2 -0
  29. package/esm/components/show-edit-pod/show-edit-pod.component.js +7 -0
  30. package/esm/components/switch/switch.component.js +2 -0
  31. package/esm/components/textarea/textarea.component.js +11 -7
  32. package/esm/components/textbox/textbox.component.js +12 -8
  33. package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +3 -2
  34. package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +10 -3
  35. package/esm/locales/en-gb.js +3 -0
  36. package/esm/locales/locale.d.ts +3 -0
  37. package/esm/locales/pl-pl.js +3 -0
  38. package/lib/__internal__/checkable-input/checkable-input.component.js +6 -4
  39. package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +4 -0
  40. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +19 -2
  41. package/lib/__internal__/input/input.component.d.ts +4 -0
  42. package/lib/__internal__/input/input.component.js +13 -0
  43. package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +1 -1
  44. package/lib/__internal__/label/label.component.js +1 -2
  45. package/lib/__internal__/validation-message/validation-message.component.d.ts +3 -1
  46. package/lib/__internal__/validation-message/validation-message.component.js +3 -0
  47. package/lib/__internal__/validations/validation-icon.component.js +5 -2
  48. package/lib/components/breadcrumbs/breadcrumbs.component.d.ts +8 -0
  49. package/lib/components/breadcrumbs/breadcrumbs.component.js +44 -0
  50. package/lib/components/breadcrumbs/breadcrumbs.style.d.ts +2 -0
  51. package/lib/components/breadcrumbs/breadcrumbs.style.js +20 -0
  52. package/lib/components/breadcrumbs/crumb/crumb.component.d.ts +11 -0
  53. package/lib/components/breadcrumbs/crumb/crumb.component.js +95 -0
  54. package/lib/components/breadcrumbs/crumb/crumb.style.d.ts +18 -0
  55. package/lib/components/breadcrumbs/crumb/crumb.style.js +51 -0
  56. package/lib/components/breadcrumbs/crumb/index.d.ts +2 -0
  57. package/lib/components/breadcrumbs/crumb/index.js +15 -0
  58. package/lib/components/breadcrumbs/crumb/package.json +6 -0
  59. package/lib/components/breadcrumbs/index.d.ts +4 -0
  60. package/lib/components/breadcrumbs/index.js +23 -0
  61. package/lib/components/breadcrumbs/package.json +6 -0
  62. package/lib/components/checkbox/checkbox.component.js +2 -0
  63. package/lib/components/decimal/decimal.component.js +2 -0
  64. package/lib/components/grouped-character/grouped-character.component.js +2 -0
  65. package/lib/components/i18n-provider/i18n-provider.component.js +3 -0
  66. package/lib/components/number/number.component.js +2 -0
  67. package/lib/components/radio-button/radio-button.component.js +2 -0
  68. package/lib/components/show-edit-pod/show-edit-pod.component.js +9 -0
  69. package/lib/components/switch/switch.component.js +2 -0
  70. package/lib/components/textarea/textarea.component.js +11 -7
  71. package/lib/components/textbox/textbox.component.js +12 -8
  72. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +3 -2
  73. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +10 -3
  74. package/lib/locales/en-gb.js +3 -0
  75. package/lib/locales/locale.d.ts +3 -0
  76. package/lib/locales/pl-pl.js +3 -0
  77. package/package.json +1 -1
@@ -169,6 +169,7 @@ Switch.propTypes = {
169
169
  "aria-valuemin": PropTypes.number,
170
170
  "aria-valuenow": PropTypes.number,
171
171
  "aria-valuetext": PropTypes.string,
172
+ "ariaDescribedBy": PropTypes.string,
172
173
  "ariaLabelledBy": PropTypes.string,
173
174
  "autoCapitalize": PropTypes.string,
174
175
  "autoComplete": PropTypes.string,
@@ -630,6 +631,7 @@ Switch.propTypes = {
630
631
  "translate": PropTypes.oneOf(["no", "yes"]),
631
632
  "typeof": PropTypes.string,
632
633
  "unselectable": PropTypes.oneOf(["off", "on"]),
634
+ "validationIconId": PropTypes.string,
633
635
  "validationOnLabel": PropTypes.bool,
634
636
  "value": PropTypes.string,
635
637
  "vocab": PropTypes.string,
@@ -103,11 +103,12 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
103
103
 
104
104
  const {
105
105
  labelId,
106
- validationIconId,
106
+ validationId,
107
107
  fieldHelpId,
108
108
  ariaDescribedBy
109
109
  } = useInputAccessibility({
110
110
  id,
111
+ validationRedesignOptIn,
111
112
  error,
112
113
  warning,
113
114
  info,
@@ -141,13 +142,12 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
141
142
  }
142
143
  };
143
144
  }, [expandable]);
144
- const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
145
+ const hasIconInside = !!(inputIcon || validationId && !validationOnLabel);
145
146
  const hintId = useRef(guid());
146
147
  const characterCountHintIdValue = characterCount ? characterCountHintId : undefined;
147
148
  const inputHintIdValue = inputHint ? hintId.current : undefined;
148
149
  const hintIdValue = characterLimit ? characterCountHintIdValue : inputHintIdValue;
149
- const ariaDescribedByValues = [validationRedesignOptIn ? undefined : ariaDescribedBy, hintIdValue];
150
- const ariaDescribedByValue = ariaDescribedByValues.filter(Boolean).join(" ");
150
+ const combinedAriaDescribedBy = [ariaDescribedBy, hintIdValue].filter(Boolean).join(" ");
151
151
  const input = /*#__PURE__*/React.createElement(InputPresentation, {
152
152
  size: size,
153
153
  disabled: disabled,
@@ -160,7 +160,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
160
160
  }, /*#__PURE__*/React.createElement(Input, _extends({
161
161
  "aria-invalid": !!error,
162
162
  "aria-labelledby": ariaLabelledBy,
163
- "aria-describedby": ariaDescribedByValue,
163
+ ariaDescribedBy: combinedAriaDescribedBy,
164
164
  autoFocus: autoFocus,
165
165
  name: name,
166
166
  value: value,
@@ -174,7 +174,8 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
174
174
  cols: cols,
175
175
  id: id,
176
176
  as: "textarea",
177
- inputRef: inputRef
177
+ inputRef: inputRef,
178
+ validationIconId: validationRedesignOptIn ? undefined : validationId
178
179
  }, rest)), children, /*#__PURE__*/React.createElement(InputIconToggle, {
179
180
  disabled: disabled,
180
181
  readOnly: readOnly,
@@ -183,7 +184,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
183
184
  error: error,
184
185
  warning: warning,
185
186
  info: info,
186
- validationIconId: validationRedesignOptIn ? undefined : validationIconId,
187
+ validationIconId: validationRedesignOptIn ? undefined : validationId,
187
188
  useValidationIcon: !(validationRedesignOptIn || validationOnLabel)
188
189
  }));
189
190
  const marginProps = useFormSpacing(rest);
@@ -222,6 +223,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
222
223
  position: "relative"
223
224
  }, /*#__PURE__*/React.createElement(ValidationMessage, {
224
225
  error: error,
226
+ validationId: validationId,
225
227
  warning: warning
226
228
  }), (error || warning) && /*#__PURE__*/React.createElement(ErrorBorder, {
227
229
  warning: !!(!error && warning)
@@ -282,6 +284,7 @@ Textarea.propTypes = {
282
284
  "aria-valuemin": PropTypes.number,
283
285
  "aria-valuenow": PropTypes.number,
284
286
  "aria-valuetext": PropTypes.string,
287
+ "ariaDescribedBy": PropTypes.string,
285
288
  "as": PropTypes.elementType,
286
289
  "autoCapitalize": PropTypes.string,
287
290
  "autoComplete": PropTypes.string,
@@ -747,6 +750,7 @@ Textarea.propTypes = {
747
750
  "translate": PropTypes.oneOf(["no", "yes"]),
748
751
  "typeof": PropTypes.string,
749
752
  "unselectable": PropTypes.oneOf(["off", "on"]),
753
+ "validationIconId": PropTypes.string,
750
754
  "validationOnLabel": PropTypes.bool,
751
755
  "value": PropTypes.string,
752
756
  "vocab": PropTypes.string,
@@ -95,11 +95,12 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
95
95
 
96
96
  const {
97
97
  labelId,
98
- validationIconId,
98
+ validationId,
99
99
  fieldHelpId,
100
100
  ariaDescribedBy
101
101
  } = useInputAccessibility({
102
102
  id: uniqueId,
103
+ validationRedesignOptIn,
103
104
  error,
104
105
  warning,
105
106
  info,
@@ -110,9 +111,8 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
110
111
  const characterCountHintIdValue = characterCount ? characterCountHintId : undefined;
111
112
  const inputHintIdValue = inputHint ? hintId.current : undefined;
112
113
  const hintIdValue = characterLimit ? characterCountHintIdValue : inputHintIdValue;
113
- const ariaDescribedByValues = [validationRedesignOptIn ? undefined : ariaDescribedBy, hintIdValue];
114
- const ariaDescribedByValue = ariaDescribedByValues.filter(Boolean).join(" ");
115
- const hasIconInside = !!(inputIcon || validationIconId && !validationOnLabel);
114
+ const combinedAriaDescribedBy = [ariaDescribedBy, hintIdValue].filter(Boolean).join(" ");
115
+ const hasIconInside = !!(inputIcon || validationId && !validationOnLabel);
116
116
  const input = /*#__PURE__*/React.createElement(InputPresentation, {
117
117
  align: align,
118
118
  disabled: disabled,
@@ -134,7 +134,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
134
134
  align: align,
135
135
  "aria-invalid": !!error,
136
136
  "aria-labelledby": ariaLabelledBy,
137
- "aria-describedby": ariaDescribedByValue,
137
+ ariaDescribedBy: combinedAriaDescribedBy,
138
138
  autoFocus: autoFocus,
139
139
  deferTimeout: deferTimeout,
140
140
  disabled: disabled,
@@ -151,7 +151,8 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
151
151
  placeholder: disabled || readOnly ? "" : placeholder,
152
152
  readOnly: readOnly,
153
153
  value: typeof formattedValue === "string" ? formattedValue : value,
154
- maxLength: maxLength
154
+ maxLength: maxLength,
155
+ validationIconId: validationRedesignOptIn ? undefined : validationId
155
156
  }, props)), children, /*#__PURE__*/React.createElement(InputIconToggle, {
156
157
  align: align,
157
158
  disabled: disabled,
@@ -165,7 +166,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
165
166
  size: size,
166
167
  useValidationIcon: !(validationRedesignOptIn || validationOnLabel),
167
168
  warning: warning,
168
- validationIconId: validationRedesignOptIn ? undefined : validationIconId
169
+ validationIconId: validationRedesignOptIn ? undefined : validationId
169
170
  }));
170
171
  return /*#__PURE__*/React.createElement(TooltipProvider, {
171
172
  helpAriaLabel: helpAriaLabel,
@@ -193,7 +194,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
193
194
  "data-component": dataComponent,
194
195
  "data-role": dataRole,
195
196
  "data-element": dataElement,
196
- validationIconId: validationRedesignOptIn ? undefined : validationIconId,
197
+ validationIconId: validationRedesignOptIn ? undefined : validationId,
197
198
  validationRedesignOptIn: validationRedesignOptIn
198
199
  }, filterStyledSystemMarginProps(props)), characterLimit || inputHint ? /*#__PURE__*/React.createElement(StyledInputHint, {
199
200
  id: hintIdValue,
@@ -202,6 +203,7 @@ const Textbox = /*#__PURE__*/React.forwardRef(({
202
203
  position: "relative"
203
204
  }, /*#__PURE__*/React.createElement(ValidationMessage, {
204
205
  error: error,
206
+ validationId: validationId,
205
207
  warning: warning
206
208
  }), !disableErrorBorder && (error || warning) && /*#__PURE__*/React.createElement(ErrorBorder, {
207
209
  warning: !!(!error && warning)
@@ -262,6 +264,7 @@ Textbox.propTypes = {
262
264
  "aria-valuemin": PropTypes.number,
263
265
  "aria-valuenow": PropTypes.number,
264
266
  "aria-valuetext": PropTypes.string,
267
+ "ariaDescribedBy": PropTypes.string,
265
268
  "as": PropTypes.elementType,
266
269
  "autoCapitalize": PropTypes.string,
267
270
  "autoComplete": PropTypes.string,
@@ -733,6 +736,7 @@ Textbox.propTypes = {
733
736
  "translate": PropTypes.oneOf(["no", "yes"]),
734
737
  "typeof": PropTypes.string,
735
738
  "unselectable": PropTypes.oneOf(["off", "on"]),
739
+ "validationIconId": PropTypes.string,
736
740
  "validationOnLabel": PropTypes.bool,
737
741
  "value": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string]),
738
742
  "vocab": PropTypes.string,
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
- export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
2
+ export default function useInputAccessibility({ id, validationRedesignOptIn, error, warning, info, label, fieldHelp, }: {
3
3
  id: string;
4
+ validationRedesignOptIn?: boolean;
4
5
  error?: string | boolean;
5
6
  warning?: string | boolean;
6
7
  info?: string | boolean;
@@ -8,7 +9,7 @@ export default function useInputAccessibility({ id, error, warning, info, label,
8
9
  fieldHelp?: React.ReactNode;
9
10
  }): {
10
11
  labelId?: string;
11
- validationIconId?: string;
12
+ validationId?: string;
12
13
  fieldHelpId?: string;
13
14
  ariaDescribedBy?: string;
14
15
  };
@@ -1,5 +1,6 @@
1
1
  export default function useInputAccessibility({
2
2
  id,
3
+ validationRedesignOptIn,
3
4
  error,
4
5
  warning,
5
6
  info,
@@ -7,12 +8,18 @@ export default function useInputAccessibility({
7
8
  fieldHelp
8
9
  }) {
9
10
  const labelId = label ? `${id}-label` : undefined;
10
- const validationIconId = [error, warning, info].filter(validation => validation && typeof validation === "string").length ? `${id}-validation-icon` : undefined;
11
+ const validationId = [error, warning, info].filter(validation => validation && typeof validation === "string").length ? `${id}-validation` : undefined;
11
12
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
12
- const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
13
+ const descriptionList = fieldHelpId ? [fieldHelpId] : [];
14
+
15
+ if (validationRedesignOptIn && validationId) {
16
+ descriptionList.push(validationId);
17
+ }
18
+
19
+ const ariaDescribedBy = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
13
20
  return {
14
21
  labelId,
15
- validationIconId,
22
+ validationId,
16
23
  fieldHelpId,
17
24
  ariaDescribedBy
18
25
  };
@@ -14,6 +14,9 @@ const enGB = {
14
14
  batchSelection: {
15
15
  selected: count => `${count} selected`
16
16
  },
17
+ breadcrumbs: {
18
+ ariaLabel: () => "breadcrumbs"
19
+ },
17
20
  confirm: {
18
21
  no: () => "No",
19
22
  yes: () => "Yes"
@@ -11,6 +11,9 @@ interface Locale {
11
11
  batchSelection: {
12
12
  selected: (count: number | string) => string;
13
13
  };
14
+ breadcrumbs: {
15
+ ariaLabel: () => string;
16
+ };
14
17
  characterCount: {
15
18
  hintString: () => string;
16
19
  tooManyCharacters: (count: number, formattedCount: string) => string;
@@ -25,6 +25,9 @@ const plPL = {
25
25
  batchSelection: {
26
26
  selected: count => `${count} wybrano`
27
27
  },
28
+ breadcrumbs: {
29
+ ariaLabel: () => "okruszki"
30
+ },
28
31
  confirm: {
29
32
  no: () => "Nie",
30
33
  yes: () => "Tak"
@@ -65,7 +65,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
65
65
  const {
66
66
  labelId,
67
67
  fieldHelpId,
68
- validationIconId,
68
+ validationId,
69
69
  ariaDescribedBy
70
70
  } = (0, _useInputAccessibility.default)({
71
71
  id,
@@ -91,17 +91,16 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
91
91
  labelId,
92
92
  labelInline,
93
93
  labelSpacing,
94
- name: id,
95
94
  reverse,
96
95
  warning,
97
- validationIconId,
96
+ validationIconId: validationId,
98
97
  // We don't want an asterisk on each radio control, only the legend
99
98
  // However, we still want the input element to receive the required prop
100
99
  isRequired: isRadio ? undefined : required,
101
100
  useValidationIcon: validationOnLabel
102
101
  };
103
102
  const inputProps = {
104
- "aria-describedby": ariaDescribedBy,
103
+ ariaDescribedBy,
105
104
  "aria-labelledby": ariaLabelledBy,
106
105
  "aria-invalid": !!error,
107
106
  autoFocus,
@@ -116,6 +115,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
116
115
  onFocus,
117
116
  required,
118
117
  ref,
118
+ validationIconId: validationId,
119
119
  ...props
120
120
  };
121
121
  return /*#__PURE__*/_react.default.createElement(_checkableInput.StyledCheckableInputWrapper, {
@@ -183,6 +183,7 @@ CheckableInput.propTypes = {
183
183
  "aria-valuemin": _propTypes.default.number,
184
184
  "aria-valuenow": _propTypes.default.number,
185
185
  "aria-valuetext": _propTypes.default.string,
186
+ "ariaDescribedBy": _propTypes.default.string,
186
187
  "ariaLabelledBy": _propTypes.default.string,
187
188
  "autoCapitalize": _propTypes.default.string,
188
189
  "autoComplete": _propTypes.default.string,
@@ -482,6 +483,7 @@ CheckableInput.propTypes = {
482
483
  "type": _propTypes.default.string.isRequired,
483
484
  "typeof": _propTypes.default.string,
484
485
  "unselectable": _propTypes.default.oneOf(["off", "on"]),
486
+ "validationIconId": _propTypes.default.string,
485
487
  "validationOnLabel": _propTypes.default.bool,
486
488
  "value": _propTypes.default.string,
487
489
  "vocab": _propTypes.default.string,
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
2
  export interface CommonHiddenCheckableInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "size" | "type"> {
3
+ /** The id of the element that describe the input. */
4
+ ariaDescribedBy?: string;
3
5
  /** Prop to specify the aria-labelledby attribute of the input */
4
6
  ariaLabelledBy?: string;
5
7
  /** If true the Component will be focused when page load */
@@ -18,6 +20,8 @@ export interface CommonHiddenCheckableInputProps extends Omit<React.InputHTMLAtt
18
20
  onMouseLeave?: (ev: React.MouseEvent<HTMLInputElement>) => void;
19
21
  /** OnMouseEnter event handler */
20
22
  onMouseEnter?: (ev: React.MouseEvent<HTMLInputElement>) => void;
23
+ /** Id of the validation icon */
24
+ validationIconId?: string;
21
25
  /** Value of the input */
22
26
  value?: string;
23
27
  }
@@ -22,6 +22,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
22
22
  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); }
23
23
 
24
24
  const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
25
+ ariaDescribedBy,
25
26
  ariaLabelledBy,
26
27
  name,
27
28
  checked,
@@ -30,19 +31,24 @@ const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
30
31
  onChange,
31
32
  autoFocus,
32
33
  role,
34
+ validationIconId,
33
35
  ...props
34
36
  }, ref) => {
35
37
  const {
36
38
  onBlur,
37
39
  onFocus,
38
40
  onMouseEnter,
39
- onMouseLeave
41
+ onMouseLeave,
42
+ hasFocus,
43
+ hasMouseOver
40
44
  } = (0, _react.useContext)(_inputBehaviour.InputContext);
41
45
  const {
42
46
  onBlur: onBlurGroup,
43
47
  onFocus: onFocusGroup,
44
48
  onMouseEnter: onMouseEnterGroup,
45
- onMouseLeave: onMouseLeaveGroup
49
+ onMouseLeave: onMouseLeaveGroup,
50
+ hasFocus: hasGroupFocus,
51
+ hasMouseOver: hasGroupMouseOver
46
52
  } = (0, _react.useContext)(_inputBehaviour.InputGroupContext);
47
53
 
48
54
  const handleFocus = ev => {
@@ -69,7 +75,16 @@ const HiddenCheckableInput = /*#__PURE__*/_react.default.forwardRef(({
69
75
  if (onMouseLeaveGroup) onMouseLeaveGroup();
70
76
  };
71
77
 
78
+ const hasValidationPart = (hasFocus || hasGroupFocus || hasMouseOver || hasGroupMouseOver) && validationIconId;
79
+ const descriptionList = ariaDescribedBy ? [ariaDescribedBy] : [];
80
+
81
+ if (hasValidationPart) {
82
+ descriptionList.push(validationIconId);
83
+ }
84
+
85
+ const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
72
86
  return /*#__PURE__*/_react.default.createElement(_hiddenCheckableInput.default, _extends({
87
+ "aria-describedby": combinedDescription,
73
88
  "aria-labelledby": ariaLabelledBy,
74
89
  autoFocus: autoFocus,
75
90
  "aria-checked": checked,
@@ -141,6 +156,7 @@ HiddenCheckableInput.propTypes = {
141
156
  "aria-valuemin": _propTypes.default.number,
142
157
  "aria-valuenow": _propTypes.default.number,
143
158
  "aria-valuetext": _propTypes.default.string,
159
+ "ariaDescribedBy": _propTypes.default.string,
144
160
  "ariaLabelledBy": _propTypes.default.string,
145
161
  "autoCapitalize": _propTypes.default.string,
146
162
  "autoComplete": _propTypes.default.string,
@@ -377,6 +393,7 @@ HiddenCheckableInput.propTypes = {
377
393
  "type": _propTypes.default.string.isRequired,
378
394
  "typeof": _propTypes.default.string,
379
395
  "unselectable": _propTypes.default.oneOf(["off", "on"]),
396
+ "validationIconId": _propTypes.default.string,
380
397
  "value": _propTypes.default.string,
381
398
  "vocab": _propTypes.default.string,
382
399
  "width": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
3
3
  align?: "right" | "left";
4
+ /** The id of the element that describe the input. */
5
+ ariaDescribedBy?: string;
4
6
  /** Override the variant component */
5
7
  as?: React.ElementType;
6
8
  /** If true the Component will be focused when rendered */
@@ -29,6 +31,8 @@ export interface CommonInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
29
31
  readOnly?: boolean;
30
32
  /** Flag to configure component as mandatory */
31
33
  required?: boolean;
34
+ /** Id of the validation icon */
35
+ validationIconId?: string;
32
36
  }
33
37
  export interface InputProps extends CommonInputProps {
34
38
  /** The visible width of the text control, in average character widths */
@@ -46,6 +46,7 @@ function selectTextOnFocus(input) {
46
46
  const Input = /*#__PURE__*/_react.default.forwardRef(({
47
47
  align,
48
48
  "aria-labelledby": ariaLabelledBy,
49
+ ariaDescribedBy,
49
50
  placeholder,
50
51
  disabled,
51
52
  readOnly,
@@ -61,6 +62,7 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
61
62
  type = "text",
62
63
  id,
63
64
  name,
65
+ validationIconId,
64
66
  ...rest
65
67
  }, ref) => {
66
68
  const context = (0, _react.useContext)(_inputBehaviour.InputContext);
@@ -161,7 +163,16 @@ const Input = /*#__PURE__*/_react.default.forwardRef(({
161
163
  handleDeferred(ev);
162
164
  };
163
165
 
166
+ const hasValidationPart = (context.hasFocus || groupContext.hasFocus || context.hasMouseOver || groupContext.hasMouseOver) && validationIconId;
167
+ const descriptionList = ariaDescribedBy ? [ariaDescribedBy] : [];
168
+
169
+ if (hasValidationPart) {
170
+ descriptionList.push(validationIconId);
171
+ }
172
+
173
+ const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
164
174
  return /*#__PURE__*/_react.default.createElement(_input2.default, _extends({}, rest, {
175
+ "aria-describedby": combinedDescription,
165
176
  "aria-labelledby": ariaLabelledBy,
166
177
  align: align,
167
178
  placeholder: placeholder,
@@ -233,6 +244,7 @@ Input.propTypes = {
233
244
  "aria-valuemin": _propTypes.default.number,
234
245
  "aria-valuenow": _propTypes.default.number,
235
246
  "aria-valuetext": _propTypes.default.string,
247
+ "ariaDescribedBy": _propTypes.default.string,
236
248
  "as": _propTypes.default.elementType,
237
249
  "autoCapitalize": _propTypes.default.string,
238
250
  "autoComplete": _propTypes.default.string,
@@ -525,6 +537,7 @@ Input.propTypes = {
525
537
  "type": _propTypes.default.string,
526
538
  "typeof": _propTypes.default.string,
527
539
  "unselectable": _propTypes.default.oneOf(["off", "on"]),
540
+ "validationIconId": _propTypes.default.string,
528
541
  "value": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.number, _propTypes.default.string]),
529
542
  "vocab": _propTypes.default.string,
530
543
  "width": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
@@ -60,7 +60,7 @@ const InputIconToggle = ({
60
60
  onBlur: onBlur,
61
61
  isPartOfInput: true,
62
62
  tabIndex: iconTabIndex,
63
- iconId: validationIconId,
63
+ tooltipId: validationIconId,
64
64
  tooltipPosition: align === "right" ? "left" : "right"
65
65
  }));
66
66
  }
@@ -104,8 +104,7 @@ const Label = ({
104
104
  inline
105
105
  });
106
106
  return /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
107
- iconId: validationIconId,
108
- tooltipId: tooltipId,
107
+ tooltipId: validationIconId,
109
108
  error: error,
110
109
  warning: warning,
111
110
  info: info,
@@ -3,9 +3,11 @@ export interface ValidationMessageProps {
3
3
  /** Indicate that error has occurred
4
4
  Pass string to display hint with error */
5
5
  error?: boolean | string;
6
+ /** Id of the component, to be used for accessibility purposes */
7
+ validationId?: string;
6
8
  /** Indicate that warning has occurred
7
9
  Pass string to display hint with warning */
8
10
  warning?: boolean | string;
9
11
  }
10
- declare const ValidationMessage: ({ error, warning }: ValidationMessageProps) => JSX.Element | null;
12
+ declare const ValidationMessage: ({ error, validationId, warning, }: ValidationMessageProps) => JSX.Element | null;
11
13
  export default ValidationMessage;
@@ -15,17 +15,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
 
16
16
  const ValidationMessage = ({
17
17
  error,
18
+ validationId,
18
19
  warning
19
20
  }) => {
20
21
  const validation = error || warning;
21
22
  const isStringValidation = typeof validation === "string";
22
23
  return isStringValidation ? /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
24
+ id: validationId,
23
25
  isWarning: !!(!error && warning)
24
26
  }, validation) : null;
25
27
  };
26
28
 
27
29
  ValidationMessage.propTypes = {
28
30
  "error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
31
+ "validationId": _propTypes.default.string,
29
32
  "warning": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool])
30
33
  };
31
34
  var _default = ValidationMessage;
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _invariant = _interopRequireDefault(require("invariant"));
13
13
 
14
+ var _guid = _interopRequireDefault(require("../utils/helpers/guid"));
15
+
14
16
  var _icon = _interopRequireDefault(require("../../components/icon"));
15
17
 
16
18
  var _validationIcon = _interopRequireDefault(require("./validation-icon.style"));
@@ -54,6 +56,7 @@ const ValidationIcon = ({
54
56
  tooltipFlipOverrides,
55
57
  ...rest
56
58
  }) => {
59
+ const validationTooltipId = (0, _react.useRef)(tooltipId || (0, _guid.default)());
57
60
  const flipBehaviourCheck = Array.isArray(tooltipFlipOverrides) && tooltipFlipOverrides.every(override => ["bottom", "left", "right", "top"].includes(override));
58
61
 
59
62
  if (tooltipFlipOverrides) {
@@ -95,10 +98,11 @@ const ValidationIcon = ({
95
98
  },
96
99
  isPartOfInput: isPartOfInput
97
100
  }, (0, _utils.filterStyledSystemMarginProps)(rest)), /*#__PURE__*/_react.default.createElement(_icon.default, {
101
+ "aria-describedby": validationTooltipId.current,
98
102
  key: `${validationType}-icon`,
99
103
  type: validationType,
100
104
  tabIndex: tabIndex,
101
- tooltipId: tooltipId,
105
+ tooltipId: validationTooltipId.current,
102
106
  tooltipMessage: validationMessage,
103
107
  tooltipPosition: tooltipPosition,
104
108
  tooltipVisible: hasFocus || hasMouseOver || groupHasFocus || groupHasMouseOver || triggeredByIcon,
@@ -106,7 +110,6 @@ const ValidationIcon = ({
106
110
  isPartOfInput: isPartOfInput,
107
111
  inputSize: size,
108
112
  id: iconId,
109
- ariaLabel: validationMessage,
110
113
  focusable: tabIndex !== -1
111
114
  }));
112
115
  };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { TagProps } from "../../__internal__/utils/helpers/tags";
3
+ export interface BreadcrumbsProps extends TagProps {
4
+ /** Child crumbs to display */
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLElement>>;
8
+ export default Breadcrumbs;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Breadcrumbs = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
13
+
14
+ var _breadcrumbs = _interopRequireDefault(require("./breadcrumbs.style"));
15
+
16
+ var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ 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); }
21
+
22
+ const Breadcrumbs = /*#__PURE__*/_react.default.forwardRef(({
23
+ children,
24
+ ...rest
25
+ }, ref) => {
26
+ const l = (0, _useLocale.default)();
27
+ return /*#__PURE__*/_react.default.createElement(_breadcrumbs.default, _extends({
28
+ ref: ref,
29
+ role: "navigation"
30
+ }, (0, _tags.default)("breadcrumbs", rest), {
31
+ "aria-label": l.breadcrumbs.ariaLabel()
32
+ }), /*#__PURE__*/_react.default.createElement("ol", null, children));
33
+ });
34
+
35
+ exports.Breadcrumbs = Breadcrumbs;
36
+ Breadcrumbs.propTypes = {
37
+ "children": _propTypes.default.node,
38
+ "data-component": _propTypes.default.string,
39
+ "data-element": _propTypes.default.string,
40
+ "data-role": _propTypes.default.string
41
+ };
42
+ Breadcrumbs.displayName = "Breadcrumbs";
43
+ var _default = Breadcrumbs;
44
+ exports.default = _default;
@@ -0,0 +1,2 @@
1
+ declare const StyledBreadcrumbs: import("styled-components").StyledComponent<"nav", any, {}, never>;
2
+ export default StyledBreadcrumbs;
@@ -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 = _interopRequireDefault(require("styled-components"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const StyledBreadcrumbs = _styledComponents.default.nav`
13
+ ol {
14
+ list-style: none;
15
+ display: flex;
16
+ flex-wrap: wrap;
17
+ }
18
+ `;
19
+ var _default = StyledBreadcrumbs;
20
+ exports.default = _default;
@@ -0,0 +1,11 @@
1
+ import { LinkProps } from "components/link/link.component";
2
+ import React from "react";
3
+ import { TagProps } from "../../../__internal__/utils/helpers/tags";
4
+ export interface CrumbProps extends Omit<LinkProps, "tooltipMessage" | "tooltipPosition" | "iconType" | "iconAlign" | "isSkipLink" | "isDarkBackground" | "ariaLabel" | "className" | "variant" | "target" | "rel" | "icon" | "disabled">, TagProps {
5
+ /** This sets the Crumb to current, does not render Link */
6
+ isCurrent?: boolean;
7
+ /** The href string for Crumb Link */
8
+ href: string;
9
+ }
10
+ declare const Crumb: React.ForwardRefExoticComponent<CrumbProps & React.RefAttributes<HTMLLinkElement>>;
11
+ export default Crumb;