carbon-react 125.7.0 → 125.9.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 (75) hide show
  1. package/esm/__internal__/fieldset/fieldset.component.d.ts +13 -1
  2. package/esm/__internal__/fieldset/fieldset.component.js +20 -4
  3. package/esm/__internal__/fieldset/fieldset.style.d.ts +6 -1
  4. package/esm/__internal__/fieldset/fieldset.style.js +27 -1
  5. package/esm/__internal__/label/label.component.d.ts +6 -2
  6. package/esm/__internal__/label/label.component.js +7 -3
  7. package/esm/components/box/box.component.d.ts +3 -1
  8. package/esm/components/box/box.component.js +4 -1
  9. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
  10. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
  11. package/esm/components/button-toggle/button-toggle.style.d.ts +15 -0
  12. package/esm/components/button-toggle/button-toggle.style.js +3 -3
  13. package/esm/components/heading/heading.style.d.ts +1 -1
  14. package/esm/components/image/image.component.d.ts +1 -1
  15. package/esm/components/image/image.component.js +11 -1
  16. package/esm/components/image/image.style.d.ts +18 -2
  17. package/esm/components/image/image.style.js +26 -2
  18. package/esm/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
  19. package/esm/components/time/__internal__/time-toggle/index.d.ts +2 -0
  20. package/esm/components/time/__internal__/time-toggle/index.js +1 -0
  21. package/esm/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
  22. package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +52 -0
  23. package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
  24. package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +19 -0
  25. package/esm/components/time/index.d.ts +2 -0
  26. package/esm/components/time/index.js +1 -0
  27. package/esm/components/time/time.component.d.ts +73 -0
  28. package/esm/components/time/time.component.js +428 -0
  29. package/esm/components/time/time.style.d.ts +6 -0
  30. package/esm/components/time/time.style.js +19 -0
  31. package/esm/components/typography/typography.component.d.ts +7 -1
  32. package/esm/components/typography/typography.component.js +3 -1
  33. package/esm/components/typography/typography.style.js +5 -0
  34. package/esm/locales/__internal__/pl-pl.js +8 -0
  35. package/esm/locales/en-gb.js +8 -0
  36. package/esm/locales/locale.d.ts +8 -0
  37. package/lib/__internal__/fieldset/fieldset.component.d.ts +13 -1
  38. package/lib/__internal__/fieldset/fieldset.component.js +19 -3
  39. package/lib/__internal__/fieldset/fieldset.style.d.ts +6 -1
  40. package/lib/__internal__/fieldset/fieldset.style.js +27 -1
  41. package/lib/__internal__/label/label.component.d.ts +6 -2
  42. package/lib/__internal__/label/label.component.js +7 -3
  43. package/lib/components/box/box.component.d.ts +3 -1
  44. package/lib/components/box/box.component.js +4 -1
  45. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
  46. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
  47. package/lib/components/button-toggle/button-toggle.style.d.ts +15 -0
  48. package/lib/components/button-toggle/button-toggle.style.js +4 -4
  49. package/lib/components/heading/heading.style.d.ts +1 -1
  50. package/lib/components/image/image.component.d.ts +1 -1
  51. package/lib/components/image/image.component.js +11 -1
  52. package/lib/components/image/image.style.d.ts +18 -2
  53. package/lib/components/image/image.style.js +26 -2
  54. package/lib/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
  55. package/lib/components/time/__internal__/time-toggle/index.d.ts +2 -0
  56. package/lib/components/time/__internal__/time-toggle/index.js +13 -0
  57. package/lib/components/time/__internal__/time-toggle/package.json +6 -0
  58. package/lib/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
  59. package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +61 -0
  60. package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
  61. package/lib/components/time/__internal__/time-toggle/time-toggle.style.js +26 -0
  62. package/lib/components/time/index.d.ts +2 -0
  63. package/lib/components/time/index.js +13 -0
  64. package/lib/components/time/package.json +6 -0
  65. package/lib/components/time/time.component.d.ts +73 -0
  66. package/lib/components/time/time.component.js +437 -0
  67. package/lib/components/time/time.style.d.ts +6 -0
  68. package/lib/components/time/time.style.js +26 -0
  69. package/lib/components/typography/typography.component.d.ts +7 -1
  70. package/lib/components/typography/typography.component.js +3 -1
  71. package/lib/components/typography/typography.style.js +5 -0
  72. package/lib/locales/__internal__/pl-pl.js +8 -0
  73. package/lib/locales/en-gb.js +8 -0
  74. package/lib/locales/locale.d.ts +8 -0
  75. package/package.json +1 -1
@@ -22,6 +22,18 @@ export interface FieldsetProps extends MarginProps {
22
22
  isRequired?: boolean;
23
23
  /** Controls whether group behaviour should be enabled */
24
24
  blockGroupBehaviour?: boolean;
25
+ /** Margin props for the legend element */
26
+ legendMargin?: Pick<MarginProps, "mb">;
27
+ /** Any valid CSS string to set the component's width */
28
+ width?: string;
29
+ /** Flag to configure component as optional in Form */
30
+ isOptional?: boolean;
31
+ /** Apply disabled styling to the legend content */
32
+ isDisabled?: boolean;
33
+ /** Set a name value on the component */
34
+ name?: string;
35
+ /** Set an id value on the component */
36
+ id?: string;
25
37
  }
26
- declare const Fieldset: ({ legend, children, inline, legendWidth, legendAlign, legendSpacing, error, warning, info, isRequired, blockGroupBehaviour, ...rest }: FieldsetProps) => React.JSX.Element;
38
+ declare const Fieldset: ({ legend, children, inline, legendWidth, legendAlign, legendSpacing, error, warning, info, isRequired, blockGroupBehaviour, legendMargin, isDisabled, isOptional, ...rest }: FieldsetProps) => React.JSX.Element;
27
39
  export default Fieldset;
@@ -1,5 +1,5 @@
1
1
  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); }
2
- import React, { useContext } from "react";
2
+ import React, { useContext, useEffect, useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { StyledFieldset, StyledLegend, StyledLegendContent } from "./fieldset.style";
5
5
  import ValidationIcon from "../validations/validation-icon.component";
@@ -18,28 +18,44 @@ const Fieldset = ({
18
18
  info,
19
19
  isRequired,
20
20
  blockGroupBehaviour,
21
+ legendMargin = {},
22
+ isDisabled,
23
+ isOptional,
21
24
  ...rest
22
25
  }) => {
23
26
  const {
24
27
  validationRedesignOptIn
25
28
  } = useContext(NewValidationContext);
26
29
  const marginProps = useFormSpacing(rest);
30
+ const [ref, setRef] = useState(null);
31
+ useEffect(() => {
32
+ if (ref && isRequired) {
33
+ Array.from(ref.querySelectorAll("input") || /* istanbul ignore next */[]).forEach(el => {
34
+ el.setAttribute("required", "");
35
+ });
36
+ }
37
+ }, [ref, isRequired]);
27
38
  return /*#__PURE__*/React.createElement(InputGroupBehaviour, {
28
39
  blockGroupBehaviour: blockGroupBehaviour
29
40
  }, /*#__PURE__*/React.createElement(StyledFieldset, _extends({
41
+ ref: setRef,
30
42
  "data-component": "fieldset"
31
43
  }, rest, marginProps), legend && /*#__PURE__*/React.createElement(InputGroupContext.Consumer, null, ({
32
44
  onMouseEnter,
33
45
  onMouseLeave
34
- }) => /*#__PURE__*/React.createElement(StyledLegend, {
46
+ }) => /*#__PURE__*/React.createElement(StyledLegend, _extends({
35
47
  onMouseEnter: onMouseEnter,
36
48
  onMouseLeave: onMouseLeave,
37
49
  inline: inline,
38
50
  width: legendWidth,
39
51
  align: legendAlign,
40
52
  rightPadding: legendSpacing
41
- }, /*#__PURE__*/React.createElement(StyledLegendContent, {
42
- isRequired: isRequired
53
+ }, legendMargin, {
54
+ "data-element": "legend"
55
+ }), /*#__PURE__*/React.createElement(StyledLegendContent, {
56
+ isRequired: isRequired,
57
+ isOptional: isOptional,
58
+ isDisabled: isDisabled
43
59
  }, legend, !validationRedesignOptIn && /*#__PURE__*/React.createElement(ValidationIcon, {
44
60
  error: error,
45
61
  warning: warning,
@@ -1,6 +1,11 @@
1
- declare const StyledFieldset: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
1
+ declare type StyledFieldsetProps = {
2
+ width?: string;
3
+ };
4
+ declare const StyledFieldset: import("styled-components").StyledComponent<"fieldset", any, StyledFieldsetProps, never>;
2
5
  declare type StyledLegendContentProps = {
3
6
  isRequired?: boolean;
7
+ isOptional?: boolean;
8
+ isDisabled?: boolean;
4
9
  };
5
10
  declare const StyledLegendContent: import("styled-components").StyledComponent<"span", any, StyledLegendContentProps, never>;
6
11
  declare type StyledLegendProps = {
@@ -8,6 +8,9 @@ const StyledFieldset = styled.fieldset`
8
8
  padding: 0;
9
9
  min-width: 0;
10
10
  min-inline-size: 0;
11
+ ${({
12
+ width
13
+ }) => width && `width: ${width};`}
11
14
  `;
12
15
  StyledFieldset.defaultProps = {
13
16
  theme: BaseTheme
@@ -25,13 +28,35 @@ const StyledLegendContent = styled.span`
25
28
  color: var(--colorsSemanticNegative500);
26
29
  font-weight: 700;
27
30
  margin-left: var(--spacing100);
31
+ position: relative;
32
+ top: 1px;
33
+ left: -4px;
34
+ }
35
+ `}
36
+
37
+ ${({
38
+ isOptional
39
+ }) => isOptional && css`
40
+ ::after {
41
+ content: "(optional)";
42
+ font-weight: 350; //TODO: (tokens) use token var(--fontWeights400) - FE-6022
43
+ margin-left: 4px;
44
+ }
45
+ `}
46
+
47
+ ${({
48
+ isDisabled
49
+ }) => isDisabled && css`
50
+ color: var(--colorsUtilityYin030);
51
+ ::after {
52
+ color: var(--colorsUtilityYin030);
28
53
  }
29
54
  `}
30
55
  `;
31
56
  const StyledLegend = styled.legend`
32
57
  display: flex;
33
58
  align-items: center;
34
- margin-bottom: 8px;
59
+ margin-bottom: var(--spacing100);
35
60
  padding: 0;
36
61
  font-weight: 600;
37
62
  ${({
@@ -47,5 +72,6 @@ const StyledLegend = styled.legend`
47
72
  justify-content: ${align === "right" ? "flex-end" : "flex-start"};
48
73
  padding-right: ${rightPadding === 1 ? "var(--spacing100)" : "var(--spacing200)"};
49
74
  `}
75
+ ${margin}
50
76
  `;
51
77
  export { StyledFieldset, StyledLegend, StyledLegendContent };
@@ -20,7 +20,11 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
20
20
  useValidationIcon?: boolean;
21
21
  /** Id of the validation icon */
22
22
  validationIconId?: string;
23
+ /** Sets className for component */
24
+ className?: string;
25
+ /** Sets aria-label for label element */
26
+ "aria-label"?: string;
23
27
  }
24
- export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element;
25
- declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element>;
28
+ export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element;
29
+ declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, className, "aria-label": ariaLabel, }: LabelProps) => React.JSX.Element>;
26
30
  export default _default;
@@ -43,7 +43,9 @@ export const Label = ({
43
43
  useValidationIcon = true,
44
44
  validationIconId,
45
45
  warning,
46
- width = 30
46
+ width = 30,
47
+ className,
48
+ "aria-label": ariaLabel
47
49
  }) => {
48
50
  const [isFocused, setFocus] = useState(false);
49
51
  const {
@@ -100,7 +102,8 @@ export const Label = ({
100
102
  width: width,
101
103
  optional: optional,
102
104
  pr: pr,
103
- pl: pl
105
+ pl: pl,
106
+ className: className
104
107
  }, /*#__PURE__*/React.createElement(StyledLabel, _extends({
105
108
  "data-element": "label",
106
109
  disabled: disabled,
@@ -111,7 +114,8 @@ export const Label = ({
111
114
  onMouseEnter: handleMouseEnter,
112
115
  onMouseLeave: handleMouseLeave,
113
116
  isRequired: isRequired,
114
- as: as
117
+ as: as,
118
+ "aria-label": ariaLabel
115
119
  }), children), icon());
116
120
  };
117
121
  export default /*#__PURE__*/React.memo(Label);
@@ -9,7 +9,7 @@ export declare type BoxSizing = "content-box" | "border-box";
9
9
  declare type DesignTokensType = keyof typeof DesignTokens;
10
10
  declare type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
11
11
  declare type BorderRadiusType = Extract<DesignTokensType, `borderRadius${string}`>;
12
- export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, TagProps, Omit<PositionProps, "zIndex"> {
12
+ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, LayoutProps, Omit<PositionProps, "zIndex">, SpaceProps, TagProps {
13
13
  as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
14
14
  /** Set the ID attribute of the Box component */
15
15
  id?: string;
@@ -45,6 +45,8 @@ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<Gr
45
45
  backgroundColor?: string;
46
46
  /** Set the opacity attribute of the Box component */
47
47
  opacity?: string | number;
48
+ /** Set the container to be hidden from screen readers */
49
+ "aria-hidden"?: "true" | "false";
48
50
  }
49
51
  export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
50
52
  export default Box;
@@ -24,6 +24,7 @@ const Box = /*#__PURE__*/React.forwardRef(({
24
24
  borderRadius,
25
25
  color,
26
26
  opacity,
27
+ "aria-hidden": ariaHidden,
27
28
  ...rest
28
29
  }, ref) => {
29
30
  return /*#__PURE__*/React.createElement(StyledBox, _extends({
@@ -44,7 +45,8 @@ const Box = /*#__PURE__*/React.forwardRef(({
44
45
  boxShadow: boxShadow,
45
46
  borderRadius: borderRadius,
46
47
  color: color,
47
- opacity: opacity
48
+ opacity: opacity,
49
+ "aria-hidden": ariaHidden
48
50
  }, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest), filterStyledSystemFlexboxProps(rest), filterStyledSystemGridProps(rest), filterStyledSystemLayoutProps(rest)), children);
49
51
  });
50
52
  Box.propTypes = {
@@ -351,6 +353,7 @@ Box.propTypes = {
351
353
  "trimStart": PropTypes.func.isRequired,
352
354
  "valueOf": PropTypes.func.isRequired
353
355
  })]),
356
+ "aria-hidden": PropTypes.oneOf(["false", "true"]),
354
357
  "as": PropTypes.oneOfType([PropTypes.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]), PropTypes.func, PropTypes.shape({
355
358
  "childContextTypes": PropTypes.object,
356
359
  "contextType": PropTypes.shape({
@@ -44,6 +44,11 @@ export interface ButtonToggleGroupProps extends MarginProps, TagProps {
44
44
  helpAriaLabel?: string;
45
45
  /** set this to true to allow the buttons within the group to be deselected when already selected, leaving no selected button */
46
46
  allowDeselect?: boolean;
47
+ /**
48
+ * @private @ignore
49
+ * Set a class on the component
50
+ */
51
+ className?: string;
47
52
  }
48
53
  declare type ButtonToggleGroupContextType = {
49
54
  onButtonClick: (value: string) => void;
@@ -58,7 +63,7 @@ declare type ButtonToggleGroupContextType = {
58
63
  };
59
64
  export declare const ButtonToggleGroupContext: React.Context<ButtonToggleGroupContextType>;
60
65
  declare const ButtonToggleGroup: {
61
- ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, labelAlign, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, ...props }: ButtonToggleGroupProps): React.JSX.Element;
66
+ ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, labelAlign, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, className, ...props }: ButtonToggleGroupProps): React.JSX.Element;
62
67
  displayName: string;
63
68
  };
64
69
  export default ButtonToggleGroup;
@@ -42,6 +42,7 @@ const ButtonToggleGroup = ({
42
42
  helpAriaLabel,
43
43
  id,
44
44
  allowDeselect,
45
+ className,
45
46
  ...props
46
47
  }) => {
47
48
  const hasCorrectItemStructure = useMemo(() => {
@@ -152,7 +153,9 @@ const ButtonToggleGroup = ({
152
153
  "data-role": dataRole,
153
154
  "data-element": dataElement,
154
155
  id: id
155
- }, filterStyledSystemMarginProps(props)), children))))));
156
+ }, filterStyledSystemMarginProps(props), {
157
+ className: className
158
+ }), children))))));
156
159
  };
157
160
  ButtonToggleGroup.displayName = "ButtonToggleGroup";
158
161
  export default ButtonToggleGroup;
@@ -1,5 +1,20 @@
1
1
  import { IconType } from "../icon";
2
2
  export declare type ButtonToggleIconSizes = "small" | "large";
3
+ export declare const heightConfig: {
4
+ small: number;
5
+ medium: number;
6
+ large: number;
7
+ };
8
+ export declare const fontSizeConfig: {
9
+ small: number;
10
+ medium: number;
11
+ large: number;
12
+ };
13
+ export declare const paddingConfig: {
14
+ small: number;
15
+ medium: number;
16
+ large: number;
17
+ };
3
18
  declare const StyledButtonToggleContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
19
  export interface StyledButtonToggleProps {
5
20
  /** The icon to be rendered inside of the button */
@@ -2,17 +2,17 @@ import styled, { css } from "styled-components";
2
2
  import StyledIcon from "../icon/icon.style";
3
3
  import addFocusStyling from "../../style/utils/add-focus-styling";
4
4
  import baseTheme from "../../style/themes/base";
5
- const heightConfig = {
5
+ export const heightConfig = {
6
6
  small: 32,
7
7
  medium: 40,
8
8
  large: 48
9
9
  };
10
- const fontSizeConfig = {
10
+ export const fontSizeConfig = {
11
11
  small: 14,
12
12
  medium: 14,
13
13
  large: 16
14
14
  };
15
- const paddingConfig = {
15
+ export const paddingConfig = {
16
16
  small: 16,
17
17
  medium: 24,
18
18
  large: 32
@@ -12,7 +12,7 @@ declare type StyledHeadingTitleProps = {
12
12
  withMargin?: boolean;
13
13
  };
14
14
  declare const StyledHeadingTitle: import("styled-components").StyledComponent<{
15
- ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
15
+ ({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
16
16
  displayName: string;
17
17
  }, any, StyledHeadingTitleProps, never>;
18
18
  declare const StyledHeadingPills: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { StyledImageProps } from "./image.style";
3
3
  export declare const Image: {
4
- ({ alt, decorative, src, children, ...rest }: StyledImageProps): React.JSX.Element;
4
+ ({ alt, decorative, src, children, position, top, right, bottom, left, ...rest }: StyledImageProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default Image;
@@ -8,6 +8,11 @@ export const Image = ({
8
8
  decorative = false,
9
9
  src,
10
10
  children,
11
+ position,
12
+ top,
13
+ right,
14
+ bottom,
15
+ left,
11
16
  ...rest
12
17
  }) => {
13
18
  !(!src || !children) ? process.env.NODE_ENV !== "production" ? invariant(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : invariant(false) : void 0;
@@ -15,7 +20,12 @@ export const Image = ({
15
20
  return /*#__PURE__*/React.createElement(StyledImage, _extends({
16
21
  alt: alt,
17
22
  decorative: decorative,
18
- src: src
23
+ src: src,
24
+ position: position,
25
+ top: top,
26
+ right: right,
27
+ bottom: bottom,
28
+ left: left
19
29
  }, rest), children);
20
30
  };
21
31
  Image.displayName = "Image";
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
3
- export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
3
+ export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
4
+ export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
4
5
  /** HTML alt property to display when an img fails to load */
5
6
  alt?: string;
6
7
  /** Prop to specify if the image is decorative */
@@ -11,11 +12,26 @@ export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutPr
11
12
  hidden?: boolean;
12
13
  /** Children elements, will only render if component is a div element */
13
14
  children?: React.ReactNode;
15
+ /** Any valid CSS string for position */
16
+ position?: PositionProps;
17
+ /** Any valid CSS string for top */
18
+ top?: string;
19
+ /** Any valid CSS string for right */
20
+ right?: string;
21
+ /** Any valid CSS string for bottom */
22
+ bottom?: string;
23
+ /** Any valid CSS string for left */
24
+ left?: string;
14
25
  }
15
26
  declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
16
27
  children: import("react").ReactNode;
17
28
  src: string | undefined;
18
29
  hidden: boolean;
30
+ position: PositionProps | undefined;
31
+ top: string | undefined;
32
+ right: string | undefined;
33
+ bottom: string | undefined;
34
+ left: string | undefined;
19
35
  as?: string | undefined;
20
- } & StyledImageProps, "hidden" | "children" | "as" | "src">;
36
+ } & StyledImageProps, "hidden" | "children" | "as" | "left" | "right" | "bottom" | "top" | "src" | "position">;
21
37
  export { StyledImage };
@@ -4,18 +4,42 @@ import { baseTheme } from "../../style/themes";
4
4
  const StyledImage = styled.div.attrs(({
5
5
  src,
6
6
  children,
7
- hidden = false
7
+ hidden = false,
8
+ position,
9
+ top,
10
+ right,
11
+ bottom,
12
+ left
8
13
  }) => ({
9
14
  ...(src && {
10
15
  as: "img"
11
16
  }),
12
17
  children: src ? undefined : children,
13
18
  src,
14
- hidden
19
+ hidden,
20
+ position,
21
+ top,
22
+ right,
23
+ bottom,
24
+ left
15
25
  }))`
16
26
  ${margin}
17
27
  ${layout}
18
28
 
29
+ ${({
30
+ position,
31
+ top,
32
+ right,
33
+ bottom,
34
+ left
35
+ }) => css`
36
+ position: ${position};
37
+ top: ${top};
38
+ right: ${right};
39
+ bottom: ${bottom};
40
+ left: ${left};
41
+ `}
42
+
19
43
  ${({
20
44
  as
21
45
  }) => as !== "img" && css`
@@ -325,6 +325,7 @@ FlexTileCell.propTypes = {
325
325
  "trimStart": PropTypes.func.isRequired,
326
326
  "valueOf": PropTypes.func.isRequired
327
327
  })]),
328
+ "aria-hidden": PropTypes.oneOf(["false", "true"]),
328
329
  "as": PropTypes.oneOfType([PropTypes.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]), PropTypes.func, PropTypes.shape({
329
330
  "childContextTypes": PropTypes.object,
330
331
  "contextType": PropTypes.shape({
@@ -0,0 +1,2 @@
1
+ export { default as TimeToggle } from "./time-toggle.component";
2
+ export type { ToggleProps, ToggleDataProps } from "./time-toggle.component";
@@ -0,0 +1 @@
1
+ export { default as TimeToggle } from "./time-toggle.component";
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { TagProps } from "../../../../__internal__/utils/helpers/tags";
3
+ import { ToggleValue } from "../../time.component";
4
+ export interface ToggleDataProps {
5
+ wrapperProps?: Omit<TagProps, "data-component">;
6
+ amToggleProps?: Omit<TagProps, "data-component">;
7
+ pmToggleProps?: Omit<TagProps, "data-component">;
8
+ }
9
+ export interface ToggleProps extends Omit<TagProps, "data-component"> {
10
+ size?: "small" | "medium" | "large";
11
+ onChange: (pressedValue: ToggleValue) => void;
12
+ toggleValue: ToggleValue;
13
+ disabled?: boolean;
14
+ toggleProps?: ToggleDataProps;
15
+ }
16
+ declare const Toggle: {
17
+ ({ size, onChange, toggleValue, disabled, toggleProps, }: ToggleProps): React.JSX.Element;
18
+ displayName: string;
19
+ };
20
+ export default Toggle;
@@ -0,0 +1,52 @@
1
+ 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); }
2
+ import React, { useRef, useCallback } from "react";
3
+ import PropTypes from "prop-types";
4
+ import guid from "../../../../__internal__/utils/helpers/guid";
5
+ import useLocale from "../../../../hooks/__internal__/useLocale";
6
+ import ButtonToggleGroup from "./time-toggle.style";
7
+ import { ButtonToggle } from "../../../button-toggle";
8
+ const Toggle = ({
9
+ size,
10
+ onChange,
11
+ toggleValue,
12
+ disabled,
13
+ toggleProps
14
+ }) => {
15
+ const locale = useLocale();
16
+ const amText = locale.time.amText();
17
+ const pmText = locale.time.pmText();
18
+ const internalId = useRef(guid());
19
+ const {
20
+ wrapperProps,
21
+ amToggleProps,
22
+ pmToggleProps
23
+ } = toggleProps || /* istanbul ignore next */{};
24
+ const handleChange = useCallback(event => {
25
+ const selectedButtonValue = event.target.value;
26
+ if (selectedButtonValue !== toggleValue) {
27
+ onChange(selectedButtonValue);
28
+ }
29
+ }, [toggleValue, onChange]);
30
+ return /*#__PURE__*/React.createElement(ButtonToggleGroup, _extends({}, wrapperProps, {
31
+ "data-component": "time-button-toggle-group",
32
+ m: "0px 0px 0px 8px",
33
+ id: internalId.current,
34
+ onChange: handleChange,
35
+ value: toggleValue,
36
+ disabled: disabled
37
+ }), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, amToggleProps, {
38
+ "data-component": "am-button-toggle",
39
+ grouped: true,
40
+ value: "AM",
41
+ size: size,
42
+ disabled: disabled
43
+ }), amText), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, pmToggleProps, {
44
+ "data-component": "pm-button-toggle",
45
+ grouped: true,
46
+ value: "PM",
47
+ size: size,
48
+ disabled: disabled
49
+ }), pmText));
50
+ };
51
+ Toggle.displayName = "Toggle";
52
+ export default Toggle;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const _default: import("styled-components").StyledComponent<{
3
+ ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, labelAlign, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, className, ...props }: import("../../../button-toggle").ButtonToggleGroupProps): import("react").JSX.Element;
4
+ displayName: string;
5
+ }, any, {
6
+ disabled?: boolean | undefined;
7
+ }, never>;
8
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import styled, { css } from "styled-components";
2
+ import { ButtonToggleGroup } from "../../../button-toggle";
3
+
4
+ // TODO this can be removed as part of FE-6335
5
+ export default styled(ButtonToggleGroup)`
6
+ ${({
7
+ disabled
8
+ }) => disabled && css`
9
+ opacity: 0.3;
10
+
11
+ [aria-pressed="true"] {
12
+ cursor: not-allowed;
13
+ :hover {
14
+ background-color: transparent;
15
+ box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500);
16
+ }
17
+ }
18
+ `}
19
+ `;
@@ -0,0 +1,2 @@
1
+ export { default as Time } from "./time.component";
2
+ export type { TimeValue, TimeProps, TimeHandle, ToggleValue, } from "./time.component";
@@ -0,0 +1 @@
1
+ export { default as Time } from "./time.component";