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
@@ -44,7 +44,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
44
44
  const {
45
45
  labelId,
46
46
  fieldHelpId,
47
- validationIconId,
47
+ validationId,
48
48
  ariaDescribedBy
49
49
  } = useInputAccessibility({
50
50
  id,
@@ -70,17 +70,16 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
70
70
  labelId,
71
71
  labelInline,
72
72
  labelSpacing,
73
- name: id,
74
73
  reverse,
75
74
  warning,
76
- validationIconId,
75
+ validationIconId: validationId,
77
76
  // We don't want an asterisk on each radio control, only the legend
78
77
  // However, we still want the input element to receive the required prop
79
78
  isRequired: isRadio ? undefined : required,
80
79
  useValidationIcon: validationOnLabel
81
80
  };
82
81
  const inputProps = {
83
- "aria-describedby": ariaDescribedBy,
82
+ ariaDescribedBy,
84
83
  "aria-labelledby": ariaLabelledBy,
85
84
  "aria-invalid": !!error,
86
85
  autoFocus,
@@ -95,6 +94,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
95
94
  onFocus,
96
95
  required,
97
96
  ref,
97
+ validationIconId: validationId,
98
98
  ...props
99
99
  };
100
100
  return /*#__PURE__*/React.createElement(StyledCheckableInputWrapper, {
@@ -161,6 +161,7 @@ CheckableInput.propTypes = {
161
161
  "aria-valuemin": PropTypes.number,
162
162
  "aria-valuenow": PropTypes.number,
163
163
  "aria-valuetext": PropTypes.string,
164
+ "ariaDescribedBy": PropTypes.string,
164
165
  "ariaLabelledBy": PropTypes.string,
165
166
  "autoCapitalize": PropTypes.string,
166
167
  "autoComplete": PropTypes.string,
@@ -460,6 +461,7 @@ CheckableInput.propTypes = {
460
461
  "type": PropTypes.string.isRequired,
461
462
  "typeof": PropTypes.string,
462
463
  "unselectable": PropTypes.oneOf(["off", "on"]),
464
+ "validationIconId": PropTypes.string,
463
465
  "validationOnLabel": PropTypes.bool,
464
466
  "value": PropTypes.string,
465
467
  "vocab": PropTypes.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
  }
@@ -5,6 +5,7 @@ import PropTypes from "prop-types";
5
5
  import HiddenCheckableInputStyle from "./hidden-checkable-input.style";
6
6
  import { InputContext, InputGroupContext } from "../input-behaviour";
7
7
  const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
8
+ ariaDescribedBy,
8
9
  ariaLabelledBy,
9
10
  name,
10
11
  checked,
@@ -13,19 +14,24 @@ const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
13
14
  onChange,
14
15
  autoFocus,
15
16
  role,
17
+ validationIconId,
16
18
  ...props
17
19
  }, ref) => {
18
20
  const {
19
21
  onBlur,
20
22
  onFocus,
21
23
  onMouseEnter,
22
- onMouseLeave
24
+ onMouseLeave,
25
+ hasFocus,
26
+ hasMouseOver
23
27
  } = useContext(InputContext);
24
28
  const {
25
29
  onBlur: onBlurGroup,
26
30
  onFocus: onFocusGroup,
27
31
  onMouseEnter: onMouseEnterGroup,
28
- onMouseLeave: onMouseLeaveGroup
32
+ onMouseLeave: onMouseLeaveGroup,
33
+ hasFocus: hasGroupFocus,
34
+ hasMouseOver: hasGroupMouseOver
29
35
  } = useContext(InputGroupContext);
30
36
 
31
37
  const handleFocus = ev => {
@@ -52,7 +58,16 @@ const HiddenCheckableInput = /*#__PURE__*/React.forwardRef(({
52
58
  if (onMouseLeaveGroup) onMouseLeaveGroup();
53
59
  };
54
60
 
61
+ const hasValidationPart = (hasFocus || hasGroupFocus || hasMouseOver || hasGroupMouseOver) && validationIconId;
62
+ const descriptionList = ariaDescribedBy ? [ariaDescribedBy] : [];
63
+
64
+ if (hasValidationPart) {
65
+ descriptionList.push(validationIconId);
66
+ }
67
+
68
+ const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
55
69
  return /*#__PURE__*/React.createElement(HiddenCheckableInputStyle, _extends({
70
+ "aria-describedby": combinedDescription,
56
71
  "aria-labelledby": ariaLabelledBy,
57
72
  autoFocus: autoFocus,
58
73
  "aria-checked": checked,
@@ -123,6 +138,7 @@ HiddenCheckableInput.propTypes = {
123
138
  "aria-valuemin": PropTypes.number,
124
139
  "aria-valuenow": PropTypes.number,
125
140
  "aria-valuetext": PropTypes.string,
141
+ "ariaDescribedBy": PropTypes.string,
126
142
  "ariaLabelledBy": PropTypes.string,
127
143
  "autoCapitalize": PropTypes.string,
128
144
  "autoComplete": PropTypes.string,
@@ -359,6 +375,7 @@ HiddenCheckableInput.propTypes = {
359
375
  "type": PropTypes.string.isRequired,
360
376
  "typeof": PropTypes.string,
361
377
  "unselectable": PropTypes.oneOf(["off", "on"]),
378
+ "validationIconId": PropTypes.string,
362
379
  "value": PropTypes.string,
363
380
  "vocab": PropTypes.string,
364
381
  "width": PropTypes.oneOfType([PropTypes.number, PropTypes.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 */
@@ -30,6 +30,7 @@ function selectTextOnFocus(input) {
30
30
  const Input = /*#__PURE__*/React.forwardRef(({
31
31
  align,
32
32
  "aria-labelledby": ariaLabelledBy,
33
+ ariaDescribedBy,
33
34
  placeholder,
34
35
  disabled,
35
36
  readOnly,
@@ -45,6 +46,7 @@ const Input = /*#__PURE__*/React.forwardRef(({
45
46
  type = "text",
46
47
  id,
47
48
  name,
49
+ validationIconId,
48
50
  ...rest
49
51
  }, ref) => {
50
52
  const context = useContext(InputContext);
@@ -145,7 +147,16 @@ const Input = /*#__PURE__*/React.forwardRef(({
145
147
  handleDeferred(ev);
146
148
  };
147
149
 
150
+ const hasValidationPart = (context.hasFocus || groupContext.hasFocus || context.hasMouseOver || groupContext.hasMouseOver) && validationIconId;
151
+ const descriptionList = ariaDescribedBy ? [ariaDescribedBy] : [];
152
+
153
+ if (hasValidationPart) {
154
+ descriptionList.push(validationIconId);
155
+ }
156
+
157
+ const combinedDescription = descriptionList.length ? descriptionList.filter(Boolean).join(" ") : undefined;
148
158
  return /*#__PURE__*/React.createElement(StyledInput, _extends({}, rest, {
159
+ "aria-describedby": combinedDescription,
149
160
  "aria-labelledby": ariaLabelledBy,
150
161
  align: align,
151
162
  placeholder: placeholder,
@@ -216,6 +227,7 @@ Input.propTypes = {
216
227
  "aria-valuemin": PropTypes.number,
217
228
  "aria-valuenow": PropTypes.number,
218
229
  "aria-valuetext": PropTypes.string,
230
+ "ariaDescribedBy": PropTypes.string,
219
231
  "as": PropTypes.elementType,
220
232
  "autoCapitalize": PropTypes.string,
221
233
  "autoComplete": PropTypes.string,
@@ -508,6 +520,7 @@ Input.propTypes = {
508
520
  "type": PropTypes.string,
509
521
  "typeof": PropTypes.string,
510
522
  "unselectable": PropTypes.oneOf(["off", "on"]),
523
+ "validationIconId": PropTypes.string,
511
524
  "value": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string]),
512
525
  "vocab": PropTypes.string,
513
526
  "width": PropTypes.oneOfType([PropTypes.number, PropTypes.string])
@@ -47,7 +47,7 @@ const InputIconToggle = ({
47
47
  onBlur: onBlur,
48
48
  isPartOfInput: true,
49
49
  tabIndex: iconTabIndex,
50
- iconId: validationIconId,
50
+ tooltipId: validationIconId,
51
51
  tooltipPosition: align === "right" ? "left" : "right"
52
52
  }));
53
53
  }
@@ -85,8 +85,7 @@ const Label = ({
85
85
  inline
86
86
  });
87
87
  return /*#__PURE__*/React.createElement(StyledIconWrapper, null, /*#__PURE__*/React.createElement(ValidationIcon, {
88
- iconId: validationIconId,
89
- tooltipId: tooltipId,
88
+ tooltipId: validationIconId,
90
89
  error: error,
91
90
  warning: warning,
92
91
  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;
@@ -4,17 +4,20 @@ import StyledValidationMessage from "./validation-message.style";
4
4
 
5
5
  const ValidationMessage = ({
6
6
  error,
7
+ validationId,
7
8
  warning
8
9
  }) => {
9
10
  const validation = error || warning;
10
11
  const isStringValidation = typeof validation === "string";
11
12
  return isStringValidation ? /*#__PURE__*/React.createElement(StyledValidationMessage, {
13
+ id: validationId,
12
14
  isWarning: !!(!error && warning)
13
15
  }, validation) : null;
14
16
  };
15
17
 
16
18
  ValidationMessage.propTypes = {
17
19
  "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
20
+ "validationId": PropTypes.string,
18
21
  "warning": PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
19
22
  };
20
23
  export default ValidationMessage;
@@ -1,8 +1,9 @@
1
1
  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); }
2
2
 
3
- import React, { useContext, useState } from "react";
3
+ import React, { useContext, useRef, useState } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import invariant from "invariant";
6
+ import guid from "../utils/helpers/guid";
6
7
  import Icon from "../../components/icon";
7
8
  import ValidationIconStyle from "./validation-icon.style";
8
9
  import { InputContext, InputGroupContext } from "../input-behaviour";
@@ -35,6 +36,7 @@ const ValidationIcon = ({
35
36
  tooltipFlipOverrides,
36
37
  ...rest
37
38
  }) => {
39
+ const validationTooltipId = useRef(tooltipId || guid());
38
40
  const flipBehaviourCheck = Array.isArray(tooltipFlipOverrides) && tooltipFlipOverrides.every(override => ["bottom", "left", "right", "top"].includes(override));
39
41
 
40
42
  if (tooltipFlipOverrides) {
@@ -76,10 +78,11 @@ const ValidationIcon = ({
76
78
  },
77
79
  isPartOfInput: isPartOfInput
78
80
  }, filterStyledSystemMarginProps(rest)), /*#__PURE__*/React.createElement(Icon, {
81
+ "aria-describedby": validationTooltipId.current,
79
82
  key: `${validationType}-icon`,
80
83
  type: validationType,
81
84
  tabIndex: tabIndex,
82
- tooltipId: tooltipId,
85
+ tooltipId: validationTooltipId.current,
83
86
  tooltipMessage: validationMessage,
84
87
  tooltipPosition: tooltipPosition,
85
88
  tooltipVisible: hasFocus || hasMouseOver || groupHasFocus || groupHasMouseOver || triggeredByIcon,
@@ -87,7 +90,6 @@ const ValidationIcon = ({
87
90
  isPartOfInput: isPartOfInput,
88
91
  inputSize: size,
89
92
  id: iconId,
90
- ariaLabel: validationMessage,
91
93
  focusable: tabIndex !== -1
92
94
  }));
93
95
  };
@@ -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,28 @@
1
+ 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); }
2
+
3
+ import React from "react";
4
+ import PropTypes from "prop-types";
5
+ import tagComponent from "../../__internal__/utils/helpers/tags";
6
+ import StyledBreadcrumbs from "./breadcrumbs.style";
7
+ import useLocale from "../../hooks/__internal__/useLocale";
8
+ const Breadcrumbs = /*#__PURE__*/React.forwardRef(({
9
+ children,
10
+ ...rest
11
+ }, ref) => {
12
+ const l = useLocale();
13
+ return /*#__PURE__*/React.createElement(StyledBreadcrumbs, _extends({
14
+ ref: ref,
15
+ role: "navigation"
16
+ }, tagComponent("breadcrumbs", rest), {
17
+ "aria-label": l.breadcrumbs.ariaLabel()
18
+ }), /*#__PURE__*/React.createElement("ol", null, children));
19
+ });
20
+ Breadcrumbs.propTypes = {
21
+ "children": PropTypes.node,
22
+ "data-component": PropTypes.string,
23
+ "data-element": PropTypes.string,
24
+ "data-role": PropTypes.string
25
+ };
26
+ export { Breadcrumbs };
27
+ Breadcrumbs.displayName = "Breadcrumbs";
28
+ export default Breadcrumbs;
@@ -0,0 +1,2 @@
1
+ declare const StyledBreadcrumbs: import("styled-components").StyledComponent<"nav", any, {}, never>;
2
+ export default StyledBreadcrumbs;
@@ -0,0 +1,9 @@
1
+ import styled from "styled-components";
2
+ const StyledBreadcrumbs = styled.nav`
3
+ ol {
4
+ list-style: none;
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+ }
8
+ `;
9
+ export default StyledBreadcrumbs;
@@ -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;
@@ -0,0 +1,80 @@
1
+ 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); }
2
+
3
+ import React from "react";
4
+ import PropTypes from "prop-types";
5
+ import tagComponent from "../../../__internal__/utils/helpers/tags";
6
+ import { StyledCrumb, Divider } from "./crumb.style";
7
+ const Crumb = /*#__PURE__*/React.forwardRef(({
8
+ href,
9
+ isCurrent,
10
+ children,
11
+ ...rest
12
+ }, ref) => /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(StyledCrumb, _extends({
13
+ ref: ref,
14
+ isCurrent: isCurrent,
15
+ "aria-current": isCurrent ? "page" : undefined
16
+ }, tagComponent("crumb", rest), !isCurrent && {
17
+ href
18
+ }), children), !isCurrent && /*#__PURE__*/React.createElement(Divider, null)));
19
+ Crumb.propTypes = {
20
+ "aria-activedescendant": PropTypes.string,
21
+ "aria-atomic": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
22
+ "aria-autocomplete": PropTypes.oneOf(["both", "inline", "list", "none"]),
23
+ "aria-busy": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
24
+ "aria-checked": PropTypes.oneOfType([PropTypes.oneOf(["false", "mixed", "true"]), PropTypes.bool]),
25
+ "aria-colcount": PropTypes.number,
26
+ "aria-colindex": PropTypes.number,
27
+ "aria-colspan": PropTypes.number,
28
+ "aria-controls": PropTypes.string,
29
+ "aria-current": PropTypes.oneOfType([PropTypes.oneOf(["date", "false", "location", "page", "step", "time", "true"]), PropTypes.bool]),
30
+ "aria-describedby": PropTypes.string,
31
+ "aria-details": PropTypes.string,
32
+ "aria-disabled": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
33
+ "aria-dropeffect": PropTypes.oneOf(["copy", "execute", "link", "move", "none", "popup"]),
34
+ "aria-errormessage": PropTypes.string,
35
+ "aria-expanded": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
36
+ "aria-flowto": PropTypes.string,
37
+ "aria-grabbed": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
38
+ "aria-haspopup": PropTypes.oneOfType([PropTypes.oneOf(["dialog", "false", "grid", "listbox", "menu", "tree", "true"]), PropTypes.bool]),
39
+ "aria-hidden": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
40
+ "aria-invalid": PropTypes.oneOfType([PropTypes.oneOf(["false", "grammar", "spelling", "true"]), PropTypes.bool]),
41
+ "aria-keyshortcuts": PropTypes.string,
42
+ "aria-label": PropTypes.string,
43
+ "aria-labelledby": PropTypes.string,
44
+ "aria-level": PropTypes.number,
45
+ "aria-live": PropTypes.oneOf(["assertive", "off", "polite"]),
46
+ "aria-modal": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
47
+ "aria-multiline": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
48
+ "aria-multiselectable": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
49
+ "aria-orientation": PropTypes.oneOf(["horizontal", "vertical"]),
50
+ "aria-owns": PropTypes.string,
51
+ "aria-placeholder": PropTypes.string,
52
+ "aria-posinset": PropTypes.number,
53
+ "aria-pressed": PropTypes.oneOfType([PropTypes.oneOf(["false", "mixed", "true"]), PropTypes.bool]),
54
+ "aria-readonly": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
55
+ "aria-relevant": PropTypes.oneOf(["additions removals", "additions text", "additions", "all", "removals additions", "removals text", "removals", "text additions", "text removals", "text"]),
56
+ "aria-required": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
57
+ "aria-roledescription": PropTypes.string,
58
+ "aria-rowcount": PropTypes.number,
59
+ "aria-rowindex": PropTypes.number,
60
+ "aria-rowspan": PropTypes.number,
61
+ "aria-selected": PropTypes.oneOfType([PropTypes.oneOf(["false", "true"]), PropTypes.bool]),
62
+ "aria-setsize": PropTypes.number,
63
+ "aria-sort": PropTypes.oneOf(["ascending", "descending", "none", "other"]),
64
+ "aria-valuemax": PropTypes.number,
65
+ "aria-valuemin": PropTypes.number,
66
+ "aria-valuenow": PropTypes.number,
67
+ "aria-valuetext": PropTypes.string,
68
+ "children": PropTypes.node,
69
+ "data-component": PropTypes.string,
70
+ "data-element": PropTypes.string,
71
+ "data-role": PropTypes.string,
72
+ "href": PropTypes.string.isRequired,
73
+ "isCurrent": PropTypes.bool,
74
+ "onClick": PropTypes.func,
75
+ "onKeyDown": PropTypes.func,
76
+ "onMouseDown": PropTypes.func,
77
+ "placeholderTabIndex": PropTypes.bool
78
+ };
79
+ Crumb.displayName = "Crumb";
80
+ export default Crumb;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { LinkProps } from "../../link";
3
+ interface StyleCrumbProps extends LinkProps {
4
+ isCurrent?: boolean;
5
+ }
6
+ export declare const StyledCrumb: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>, any, StyleCrumbProps, never>;
7
+ export declare const Divider: import("styled-components").StyledComponent<"span", any, {
8
+ children: "/";
9
+ "aria-hidden": "true";
10
+ }, "aria-hidden" | "children">;
11
+ declare const _default: {
12
+ StyledCrumb: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>, any, StyleCrumbProps, never>;
13
+ Divider: import("styled-components").StyledComponent<"span", any, {
14
+ children: "/";
15
+ "aria-hidden": "true";
16
+ }, "aria-hidden" | "children">;
17
+ };
18
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import styled, { css } from "styled-components";
2
+ import Link from "../../link";
3
+ export const StyledCrumb = styled(Link)`
4
+ font: var(--typographyLinkTextM);
5
+ ${({
6
+ isCurrent
7
+ }) => isCurrent && css`
8
+ a {
9
+ color: var(--colorsUtilityYin090);
10
+ text-decoration: none;
11
+ font: var(--typographyBreadcrumbCurrentPageM);
12
+ cursor: text;
13
+ :hover {
14
+ color: var(--colorsUtilityYin090);
15
+ text-decoration: none;
16
+ cursor: text;
17
+ }
18
+ }
19
+ `}
20
+ `;
21
+ export const Divider = styled.span.attrs({
22
+ children: "/",
23
+ "aria-hidden": "true"
24
+ })`
25
+ margin: 0px var(--spacing050) 0px var(--spacing100);
26
+ line-height: 16px;
27
+ font: var(--typographyBreadcrumbSeparatorM);
28
+ color: var(--colorsUtilityYin055);
29
+ `;
30
+ export default {
31
+ StyledCrumb,
32
+ Divider
33
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Crumb } from "./crumb.component";
2
+ export type { CrumbProps } from "./crumb.component";
@@ -0,0 +1 @@
1
+ export { default as Crumb } from "./crumb.component";
@@ -0,0 +1,4 @@
1
+ export { default as Breadcrumbs } from "./breadcrumbs.component";
2
+ export { Crumb } from "./crumb";
3
+ export type { BreadcrumbsProps } from "./breadcrumbs.component";
4
+ export type { CrumbProps } from "./crumb";
@@ -0,0 +1,2 @@
1
+ export { default as Breadcrumbs } from "./breadcrumbs.component";
2
+ export { Crumb } from "./crumb";
@@ -165,6 +165,7 @@ Checkbox.propTypes = {
165
165
  "aria-valuemin": PropTypes.number,
166
166
  "aria-valuenow": PropTypes.number,
167
167
  "aria-valuetext": PropTypes.string,
168
+ "ariaDescribedBy": PropTypes.string,
168
169
  "ariaLabelledBy": PropTypes.string,
169
170
  "autoCapitalize": PropTypes.string,
170
171
  "autoComplete": PropTypes.string,
@@ -625,6 +626,7 @@ Checkbox.propTypes = {
625
626
  "translate": PropTypes.oneOf(["no", "yes"]),
626
627
  "typeof": PropTypes.string,
627
628
  "unselectable": PropTypes.oneOf(["off", "on"]),
629
+ "validationIconId": PropTypes.string,
628
630
  "validationOnLabel": PropTypes.bool,
629
631
  "value": PropTypes.string,
630
632
  "vocab": PropTypes.string,
@@ -268,6 +268,7 @@ Decimal.propTypes = {
268
268
  "aria-valuemin": PropTypes.number,
269
269
  "aria-valuenow": PropTypes.number,
270
270
  "aria-valuetext": PropTypes.string,
271
+ "ariaDescribedBy": PropTypes.string,
271
272
  "as": PropTypes.elementType,
272
273
  "autoCapitalize": PropTypes.string,
273
274
  "autoComplete": PropTypes.string,
@@ -737,6 +738,7 @@ Decimal.propTypes = {
737
738
  "translate": PropTypes.oneOf(["no", "yes"]),
738
739
  "typeof": PropTypes.string,
739
740
  "unselectable": PropTypes.oneOf(["off", "on"]),
741
+ "validationIconId": PropTypes.string,
740
742
  "validationOnLabel": PropTypes.bool,
741
743
  "value": PropTypes.string,
742
744
  "vocab": PropTypes.string,
@@ -183,6 +183,7 @@ GroupedCharacter.propTypes = {
183
183
  "aria-valuemin": PropTypes.number,
184
184
  "aria-valuenow": PropTypes.number,
185
185
  "aria-valuetext": PropTypes.string,
186
+ "ariaDescribedBy": PropTypes.string,
186
187
  "as": PropTypes.elementType,
187
188
  "autoCapitalize": PropTypes.string,
188
189
  "autoComplete": PropTypes.string,
@@ -656,6 +657,7 @@ GroupedCharacter.propTypes = {
656
657
  "translate": PropTypes.oneOf(["no", "yes"]),
657
658
  "typeof": PropTypes.string,
658
659
  "unselectable": PropTypes.oneOf(["off", "on"]),
660
+ "validationIconId": PropTypes.string,
659
661
  "validationOnLabel": PropTypes.bool,
660
662
  "value": PropTypes.string,
661
663
  "vocab": PropTypes.string,
@@ -24,6 +24,9 @@ I18nProvider.propTypes = {
24
24
  "batchSelection": PropTypes.shape({
25
25
  "selected": PropTypes.func.isRequired
26
26
  }),
27
+ "breadcrumbs": PropTypes.shape({
28
+ "ariaLabel": PropTypes.func.isRequired
29
+ }),
27
30
  "characterCount": PropTypes.shape({
28
31
  "charactersLeft": PropTypes.func.isRequired,
29
32
  "hintString": PropTypes.func.isRequired,
@@ -108,6 +108,7 @@ Number.propTypes = {
108
108
  "aria-valuemin": PropTypes.number,
109
109
  "aria-valuenow": PropTypes.number,
110
110
  "aria-valuetext": PropTypes.string,
111
+ "ariaDescribedBy": PropTypes.string,
111
112
  "as": PropTypes.elementType,
112
113
  "autoCapitalize": PropTypes.string,
113
114
  "autoComplete": PropTypes.string,
@@ -579,6 +580,7 @@ Number.propTypes = {
579
580
  "translate": PropTypes.oneOf(["no", "yes"]),
580
581
  "typeof": PropTypes.string,
581
582
  "unselectable": PropTypes.oneOf(["off", "on"]),
583
+ "validationIconId": PropTypes.string,
582
584
  "validationOnLabel": PropTypes.bool,
583
585
  "value": PropTypes.string,
584
586
  "vocab": PropTypes.string,
@@ -161,6 +161,7 @@ RadioButton.propTypes = {
161
161
  "aria-valuemin": PropTypes.number,
162
162
  "aria-valuenow": PropTypes.number,
163
163
  "aria-valuetext": PropTypes.string,
164
+ "ariaDescribedBy": PropTypes.string,
164
165
  "ariaLabelledBy": PropTypes.string,
165
166
  "autoCapitalize": PropTypes.string,
166
167
  "autoComplete": PropTypes.string,
@@ -621,6 +622,7 @@ RadioButton.propTypes = {
621
622
  "translate": PropTypes.oneOf(["no", "yes"]),
622
623
  "typeof": PropTypes.string,
623
624
  "unselectable": PropTypes.oneOf(["off", "on"]),
625
+ "validationIconId": PropTypes.string,
624
626
  "validationOnLabel": PropTypes.bool,
625
627
  "value": PropTypes.string.isRequired,
626
628
  "vocab": PropTypes.string,
@@ -9,7 +9,9 @@ import Events from "../../__internal__/utils/helpers/events";
9
9
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
10
10
  import LocaleContext from "../../__internal__/i18n-context";
11
11
  import StyledPod from "./show-edit-pod.style";
12
+ import Logger from "../../__internal__/utils/logger";
12
13
  const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
14
+ let deprecateWarnTriggered = false;
13
15
 
14
16
  const ShowEditPod = ({
15
17
  border = false,
@@ -35,6 +37,11 @@ const ShowEditPod = ({
35
37
  variant = "transparent",
36
38
  ...rest
37
39
  }) => {
40
+ if (!deprecateWarnTriggered) {
41
+ deprecateWarnTriggered = true;
42
+ Logger.deprecate("The ShowEditPod component is deprecated and will soon be removed. Please use alternatives such as the Fieldset, Form or Pod components instead.");
43
+ }
44
+
38
45
  const locale = useContext(LocaleContext);
39
46
  const ref = useRef();
40
47
  const editModeNodeRef = useRef();