carbon-react 126.7.1 → 126.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 (39) hide show
  1. package/esm/__internal__/input/input-presentation.component.d.ts +3 -1
  2. package/esm/__internal__/input/input-presentation.component.js +4 -1
  3. package/esm/__internal__/input/input-presentation.style.d.ts +1 -1
  4. package/esm/__internal__/input/input-presentation.style.js +9 -5
  5. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +13 -8
  6. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +25 -13
  7. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +5 -2
  8. package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.js +37 -7
  9. package/esm/components/button-toggle/button-toggle.component.d.ts +1 -1
  10. package/esm/components/button-toggle/button-toggle.component.js +7 -1
  11. package/esm/components/button-toggle/button-toggle.style.d.ts +1 -1
  12. package/esm/components/button-toggle/button-toggle.style.js +54 -77
  13. package/esm/components/textarea/textarea.component.d.ts +2 -0
  14. package/esm/components/textarea/textarea.component.js +4 -1
  15. package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +4 -9
  16. package/esm/components/time/time.component.js +1 -1
  17. package/esm/components/time/time.style.js +1 -1
  18. package/lib/__internal__/input/input-presentation.component.d.ts +3 -1
  19. package/lib/__internal__/input/input-presentation.component.js +4 -1
  20. package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
  21. package/lib/__internal__/input/input-presentation.style.js +9 -5
  22. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +13 -8
  23. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +23 -11
  24. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +5 -2
  25. package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.js +38 -8
  26. package/lib/components/button-toggle/button-toggle.component.d.ts +1 -1
  27. package/lib/components/button-toggle/button-toggle.component.js +7 -1
  28. package/lib/components/button-toggle/button-toggle.style.d.ts +1 -1
  29. package/lib/components/button-toggle/button-toggle.style.js +54 -77
  30. package/lib/components/textarea/textarea.component.d.ts +2 -0
  31. package/lib/components/textarea/textarea.component.js +4 -1
  32. package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +4 -9
  33. package/lib/components/time/time.component.js +1 -1
  34. package/lib/components/time/time.style.js +1 -1
  35. package/package.json +1 -1
  36. package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +0 -8
  37. package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +0 -19
  38. package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +0 -8
  39. package/lib/components/time/__internal__/time-toggle/time-toggle.style.js +0 -26
@@ -25,10 +25,12 @@ export interface CommonInputPresentationProps extends ValidationProps {
25
25
  hasIcon?: boolean;
26
26
  /** Specify a custom border radius. Any valid border-radius design token, or an array of border-radius design tokens. */
27
27
  borderRadius?: BorderRadiusType | BorderRadiusType[];
28
+ /** Renders with transparent borders. This will not effect focus styling or validation borders */
29
+ hideBorders?: boolean;
28
30
  }
29
31
  export interface InputPresentationProps extends CommonInputPresentationProps {
30
32
  /** Content to be rendered before the input */
31
33
  positionedChildren?: React.ReactNode;
32
34
  }
33
- declare const InputPresentation: ({ align, borderRadius, children, disabled, error, hasIcon, info, inputWidth, maxWidth, positionedChildren, prefix, readOnly, size, warning, }: InputPresentationProps) => JSX.Element;
35
+ declare const InputPresentation: ({ align, borderRadius, children, disabled, error, hasIcon, hideBorders, info, inputWidth, maxWidth, positionedChildren, prefix, readOnly, size, warning, }: InputPresentationProps) => JSX.Element;
34
36
  export default InputPresentation;
@@ -10,6 +10,7 @@ const InputPresentation = ({
10
10
  disabled,
11
11
  error,
12
12
  hasIcon,
13
+ hideBorders = false,
13
14
  info,
14
15
  inputWidth,
15
16
  maxWidth,
@@ -59,7 +60,8 @@ const InputPresentation = ({
59
60
  info: info,
60
61
  validationRedesignOptIn: validationRedesignOptIn,
61
62
  hasIcon: hasIcon,
62
- borderRadius: borderRadius
63
+ borderRadius: borderRadius,
64
+ hideBorders: hideBorders
63
65
  }, children));
64
66
  };
65
67
  InputPresentation.propTypes = {
@@ -69,6 +71,7 @@ InputPresentation.propTypes = {
69
71
  "disabled": PropTypes.bool,
70
72
  "error": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
71
73
  "hasIcon": PropTypes.bool,
74
+ "hideBorders": PropTypes.bool,
72
75
  "info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
73
76
  "inputWidth": PropTypes.number,
74
77
  "maxWidth": PropTypes.string,
@@ -2,5 +2,5 @@ import { CommonInputPresentationProps } from "./input-presentation.component";
2
2
  import { InputContextProps } from "../input-behaviour";
3
3
  import { CarbonProviderProps } from "../../components/carbon-provider";
4
4
  export declare const StyledInputPresentationContainer: import("styled-components").StyledComponent<"div", any, Pick<CommonInputPresentationProps, "maxWidth" | "inputWidth">, never>;
5
- declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, Pick<InputContextProps, "hasFocus"> & Pick<CommonInputPresentationProps, "disabled" | "error" | "info" | "warning" | "prefix" | "align" | "readOnly" | "size" | "borderRadius" | "hasIcon"> & Pick<CarbonProviderProps, "validationRedesignOptIn">, never>;
5
+ declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, Pick<InputContextProps, "hasFocus"> & Pick<CommonInputPresentationProps, "disabled" | "error" | "info" | "warning" | "prefix" | "align" | "readOnly" | "size" | "borderRadius" | "hasIcon" | "hideBorders"> & Pick<CarbonProviderProps, "validationRedesignOptIn">, never>;
6
6
  export default InputPresentationStyle;
@@ -44,7 +44,9 @@ function stylingForValidations({
44
44
  const InputPresentationStyle = styled.div`
45
45
  align-items: stretch;
46
46
  background: var(--colorsUtilityYang100);
47
- border: 1px solid var(--colorsUtilityMajor300);
47
+ ${({
48
+ hideBorders
49
+ }) => hideBorders ? `border: 1px solid transparent;` : `border: 1px solid var(--colorsUtilityMajor300);`}
48
50
  box-sizing: border-box;
49
51
  cursor: text;
50
52
  display: flex;
@@ -76,10 +78,11 @@ const InputPresentationStyle = styled.div`
76
78
  `}
77
79
 
78
80
  ${({
79
- disabled
81
+ disabled,
82
+ hideBorders
80
83
  }) => disabled && css`
81
84
  background: var(--colorsUtilityDisabled400);
82
- border-color: var(--colorsUtilityDisabled600);
85
+ border-color: ${hideBorders ? `transparent` : `var(--colorsUtilityDisabled600)`};
83
86
  cursor: not-allowed;
84
87
  `}
85
88
 
@@ -96,10 +99,11 @@ const InputPresentationStyle = styled.div`
96
99
  ${stylingForValidations}
97
100
 
98
101
  ${({
99
- readOnly
102
+ readOnly,
103
+ hideBorders
100
104
  }) => readOnly && css`
101
105
  background-color: var(--colorsUtilityReadOnly400);
102
- border-color: var(--colorsUtilityReadOnly600);
106
+ border-color: ${hideBorders ? `transparent` : `var(--colorsUtilityReadOnly600)`};
103
107
  `}
104
108
 
105
109
  ${({
@@ -18,17 +18,19 @@ export interface ButtonToggleGroupProps extends MarginProps, TagProps {
18
18
  "aria-label"?: string;
19
19
  /** Text for the visible label of the button group. */
20
20
  label?: string;
21
- /** Text for the label's help tooltip. */
21
+ /** [Legacy] Text for the label's help tooltip. */
22
22
  labelHelp?: React.ReactNode;
23
- /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
23
+ /** [Legacy] Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
24
24
  labelSpacing?: 1 | 2;
25
+ /** A hint string rendered before the input but after the label. Intended to describe the purpose or content of the input. */
26
+ inputHint?: React.ReactNode;
25
27
  /** The percentage width of the ButtonToggleGroup. */
26
28
  inputWidth?: number | string;
27
- /** The text for the field help. */
29
+ /** [Legacy] The text for the field help. */
28
30
  fieldHelp?: string;
29
- /** Sets the field help to inline. */
31
+ /** [Legacy] Sets the field help to inline. */
30
32
  fieldHelpInline?: boolean;
31
- /** Sets the label to be inline. */
33
+ /** [Legacy] Sets the label to be inline. */
32
34
  labelInline?: boolean;
33
35
  /** The percentage width of the label. */
34
36
  labelWidth?: number;
@@ -38,10 +40,12 @@ export interface ButtonToggleGroupProps extends MarginProps, TagProps {
38
40
  onChange?: (ev: React.MouseEvent<HTMLButtonElement>, value?: string, name?: string) => void;
39
41
  /** Determines which child button is selected when the component is used as a controlled component */
40
42
  value?: string;
41
- /** Aria label for rendered help component */
43
+ /** [Legacy] Aria label for rendered help component */
42
44
  helpAriaLabel?: string;
43
- /** set this to true to allow the buttons within the group to be deselected when already selected, leaving no selected button */
45
+ /** Allow buttons within the group to be deselected when already selected, leaving no selected button */
44
46
  allowDeselect?: boolean;
47
+ /** Disable all user interaction. */
48
+ disabled?: boolean;
45
49
  /**
46
50
  * @private @ignore
47
51
  * Set a class on the component
@@ -56,12 +60,13 @@ declare type ButtonToggleGroupContextType = {
56
60
  name?: string;
57
61
  allowDeselect?: boolean;
58
62
  isInGroup: boolean;
63
+ isDisabled?: boolean;
59
64
  firstButton?: HTMLButtonElement;
60
65
  childButtonCallbackRef?: (button: HTMLButtonElement | null) => void;
61
66
  };
62
67
  export declare const ButtonToggleGroupContext: React.Context<ButtonToggleGroupContextType>;
63
68
  declare const ButtonToggleGroup: {
64
- ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, className, ...props }: ButtonToggleGroupProps): React.JSX.Element;
69
+ ({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputHint, inputWidth, fullWidth, labelInline, labelWidth, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, disabled, className, ...props }: ButtonToggleGroupProps): React.JSX.Element;
65
70
  displayName: string;
66
71
  };
67
72
  export default ButtonToggleGroup;
@@ -1,16 +1,17 @@
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, { createContext, useMemo, useState, useRef } from "react";
2
+ import React, { createContext, useMemo, useState, useRef, useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import invariant from "invariant";
5
5
  import FormField from "../../../__internal__/form-field";
6
6
  import guid from "../../../__internal__/utils/helpers/guid";
7
- import StyledButtonToggleGroup, { StyledButtonToggleGroupWrapper } from "./button-toggle-group.style";
7
+ import StyledButtonToggleGroup, { StyledButtonToggleGroupWrapper, StyledHintText } from "./button-toggle-group.style";
8
8
  import { ButtonToggle } from "..";
9
9
  import { filterStyledSystemMarginProps } from "../../../style/utils";
10
10
  import { TooltipProvider } from "../../../__internal__/tooltip-provider";
11
11
  import { InputGroupBehaviour } from "../../../__internal__/input-behaviour";
12
12
  import Logger from "../../../__internal__/utils/logger";
13
13
  import Events from "../../../__internal__/utils/helpers/events";
14
+ import { NewValidationContext } from "../../carbon-provider/carbon-provider.component";
14
15
  let deprecateNameWarnTriggered = false;
15
16
  const BUTTON_TOGGLE_SELECTOR = '[data-element="button-toggle-button"]';
16
17
  export const ButtonToggleGroupContext = /*#__PURE__*/createContext({
@@ -18,7 +19,8 @@ export const ButtonToggleGroupContext = /*#__PURE__*/createContext({
18
19
  handleKeyDown: /* istanbul ignore next */() => {},
19
20
  pressedButtonValue: undefined,
20
21
  allowDeselect: false,
21
- isInGroup: false
22
+ isInGroup: false,
23
+ isDisabled: false
22
24
  });
23
25
  const ButtonToggleGroup = ({
24
26
  children,
@@ -28,6 +30,7 @@ const ButtonToggleGroup = ({
28
30
  label,
29
31
  labelHelp,
30
32
  labelSpacing,
33
+ inputHint,
31
34
  inputWidth,
32
35
  fullWidth,
33
36
  labelInline,
@@ -41,6 +44,7 @@ const ButtonToggleGroup = ({
41
44
  helpAriaLabel,
42
45
  id,
43
46
  allowDeselect,
47
+ disabled,
44
48
  className,
45
49
  ...props
46
50
  }) => {
@@ -59,6 +63,10 @@ const ButtonToggleGroup = ({
59
63
  Logger.deprecate(`The \`name\` prop in \`ButtonToggleGroup\` component is deprecated and will soon be removed. It does not provide any functionality
60
64
  since the component can no longer be used in an uncontrolled fashion.`);
61
65
  }
66
+ const {
67
+ validationRedesignOptIn
68
+ } = useContext(NewValidationContext);
69
+ const computeLabelPropValues = prop => validationRedesignOptIn ? undefined : prop;
62
70
  const onButtonClick = buttonValue => {
63
71
  let newValue = buttonValue;
64
72
  const currentValue = value || pressedButtonValue;
@@ -112,18 +120,19 @@ const ButtonToggleGroup = ({
112
120
  helpAriaLabel: helpAriaLabel
113
121
  }, /*#__PURE__*/React.createElement(InputGroupBehaviour, null, /*#__PURE__*/React.createElement(FormField, _extends({
114
122
  label: label,
115
- labelHelp: labelHelp,
123
+ labelHelp: computeLabelPropValues(labelHelp),
116
124
  labelSpacing: labelSpacing,
117
- fieldHelp: fieldHelp,
118
- fieldHelpInline: fieldHelpInline,
119
- labelInline: labelInline,
120
- labelWidth: labelWidth,
125
+ fieldHelp: computeLabelPropValues(fieldHelp),
126
+ fieldHelpInline: computeLabelPropValues(fieldHelpInline),
127
+ labelInline: computeLabelPropValues(labelInline),
128
+ labelWidth: computeLabelPropValues(labelWidth),
121
129
  labelId: labelId.current,
122
130
  "data-component": dataComponent,
123
131
  "data-role": dataRole,
124
132
  "data-element": dataElement,
125
133
  id: id,
126
- labelAs: "span"
134
+ labelAs: "span",
135
+ disabled: disabled
127
136
  }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(ButtonToggleGroupContext.Provider, {
128
137
  value: {
129
138
  onButtonClick,
@@ -133,10 +142,13 @@ const ButtonToggleGroup = ({
133
142
  name,
134
143
  allowDeselect,
135
144
  isInGroup: true,
145
+ isDisabled: disabled,
136
146
  firstButton,
137
147
  childButtonCallbackRef
138
148
  }
139
- }, /*#__PURE__*/React.createElement(StyledButtonToggleGroupWrapper, {
149
+ }, inputHint && /*#__PURE__*/React.createElement(StyledHintText, {
150
+ isDisabled: disabled
151
+ }, inputHint), /*#__PURE__*/React.createElement(StyledButtonToggleGroupWrapper, {
140
152
  labelInline: labelInline,
141
153
  ref: wrapperRef
142
154
  }, /*#__PURE__*/React.createElement(StyledButtonToggleGroup, _extends({}, label ? {
@@ -150,9 +162,9 @@ const ButtonToggleGroup = ({
150
162
  "data-component": dataComponent,
151
163
  "data-role": dataRole,
152
164
  "data-element": dataElement,
153
- id: id
154
- }, filterStyledSystemMarginProps(props), {
155
- className: className
165
+ id: id,
166
+ className: className,
167
+ disabled: disabled
156
168
  }), children))))));
157
169
  };
158
170
  ButtonToggleGroup.displayName = "ButtonToggleGroup";
@@ -1,6 +1,9 @@
1
1
  import { ButtonToggleGroupProps } from ".";
2
- declare type StyledButtonToggleGroupProps = Pick<ButtonToggleGroupProps, "inputWidth" | "fullWidth">;
2
+ declare type StyledButtonToggleGroupProps = Pick<ButtonToggleGroupProps, "inputWidth" | "fullWidth" | "disabled">;
3
3
  declare type StyledButtonToggleGroupWrapperProps = Pick<ButtonToggleGroupProps, "labelInline">;
4
- export declare const StyledButtonToggleGroupWrapper: import("styled-components").StyledComponent<"div", any, StyledButtonToggleGroupWrapperProps, never>;
5
4
  declare const StyledButtonToggleGroup: import("styled-components").StyledComponent<"div", any, StyledButtonToggleGroupProps, never>;
5
+ export declare const StyledButtonToggleGroupWrapper: import("styled-components").StyledComponent<"div", any, StyledButtonToggleGroupWrapperProps, never>;
6
+ export declare const StyledHintText: import("styled-components").StyledComponent<"div", any, {
7
+ isDisabled?: boolean | undefined;
8
+ }, never>;
6
9
  export default StyledButtonToggleGroup;
@@ -2,21 +2,29 @@ import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import { baseTheme } from "../../../style/themes";
4
4
  import { StyledButtonToggle, StyledButtonToggleWrapper } from "../button-toggle.style";
5
- export const StyledButtonToggleGroupWrapper = styled.div`
6
- ${({
7
- labelInline
8
- }) => labelInline && css`
9
- display: flex;
10
- `}
11
- `;
12
5
  const StyledButtonToggleGroup = styled.div`
13
6
  ${margin}
14
7
 
15
8
  display: flex;
9
+ box-shadow: inset 0px 0px 0px 1px var(--colorsActionMinor500);
10
+ border-radius: var(--borderRadius100);
11
+ padding: 4px;
12
+ gap: 4px;
13
+ width: fit-content;
14
+ height: fit-content;
15
+ flex-wrap: wrap;
16
+
17
+ ${({
18
+ disabled
19
+ }) => disabled && css`
20
+ cursor: not-allowed;
21
+ box-shadow: inset 0px 0px 0px 1px var(--colorsActionDisabled600);
22
+ `}
16
23
 
17
24
  ${({
18
25
  fullWidth
19
26
  }) => fullWidth && css`
27
+ width: 100%;
20
28
  ${StyledButtonToggle} {
21
29
  width: 100%;
22
30
  }
@@ -31,6 +39,28 @@ const StyledButtonToggleGroup = styled.div`
31
39
  width: ${`${inputWidth}%`};
32
40
  `}
33
41
  `;
42
+ export const StyledButtonToggleGroupWrapper = styled.div`
43
+ ${({
44
+ labelInline
45
+ }) => labelInline && css`
46
+ display: flex;
47
+ ${StyledButtonToggleGroup} {
48
+ flex-wrap: nowrap;
49
+ }
50
+ `}
51
+ `;
52
+ export const StyledHintText = styled.div`
53
+ ::after {
54
+ content: " ";
55
+ }
56
+
57
+ margin-top: var(--spacing000);
58
+ margin-bottom: var(--spacing150);
59
+ color: ${({
60
+ isDisabled
61
+ }) => isDisabled ? "var(--colorsUtilityYin030)" : "var(--colorsUtilityYin055)"};
62
+ font-size: 14px;
63
+ `;
34
64
  StyledButtonToggleGroup.defaultProps = {
35
65
  theme: baseTheme
36
66
  };
@@ -15,7 +15,7 @@ export interface ButtonToggleProps extends Partial<StyledButtonToggleProps> {
15
15
  "data-element"?: string;
16
16
  /** Identifier used for testing purposes, applied to the root element of the component. */
17
17
  "data-role"?: string;
18
- /** Remove spacing from between buttons. */
18
+ /** DEPRECATED: Remove spacing from between buttons. */
19
19
  grouped?: boolean;
20
20
  /** An optional string by which to identify the button in an onChange handler on the parent ButtonToggleGroup. */
21
21
  name?: string;
@@ -11,6 +11,7 @@ import { InputGroupContext } from "../../__internal__/input-behaviour";
11
11
  let deprecateCheckedWarnTriggered = false;
12
12
  let deprecateNameWarnTriggered = false;
13
13
  let deprecateUncontrolledWarnTriggered = false;
14
+ let deprecateGroupedWarnTriggered = false;
14
15
  export const ButtonToggle = ({
15
16
  "aria-label": ariaLabel,
16
17
  "aria-labelledby": ariaLabelledBy,
@@ -41,6 +42,10 @@ export const ButtonToggle = ({
41
42
  Logger.deprecate(`The \`name\` prop in \`ButtonToggle\` component is deprecated and will soon be removed. It does not provide any functionality
42
43
  since the component can no longer be used in an uncontrolled fashion.`);
43
44
  }
45
+ if (grouped && !deprecateGroupedWarnTriggered) {
46
+ deprecateGroupedWarnTriggered = true;
47
+ Logger.deprecate("The `grouped` prop in `ButtonToggle` component is deprecated and will soon be removed. Spacing between buttons is no longer no removed.");
48
+ }
44
49
  const pressedPropValue = pressed === undefined ? checked : pressed;
45
50
  const buttonRef = useRef(null);
46
51
  const {
@@ -57,6 +62,7 @@ export const ButtonToggle = ({
57
62
  name: groupName,
58
63
  allowDeselect,
59
64
  isInGroup,
65
+ isDisabled,
60
66
  firstButton,
61
67
  childButtonCallbackRef
62
68
  } = useContext(ButtonToggleGroupContext);
@@ -129,7 +135,7 @@ export const ButtonToggle = ({
129
135
  buttonIcon: buttonIcon,
130
136
  buttonIconSize: buttonIconSize,
131
137
  "data-element": "button-toggle-button",
132
- disabled: disabled,
138
+ disabled: disabled || isDisabled,
133
139
  id: inputGuid.current,
134
140
  onMouseEnter: onMouseEnter,
135
141
  onMouseLeave: onMouseLeave,
@@ -26,7 +26,7 @@ export interface StyledButtonToggleProps {
26
26
  /** ButtonToggle size */
27
27
  size: "small" | "medium" | "large";
28
28
  grouped?: boolean;
29
- /** set this to true to allow the button to be deselected when already selected */
29
+ /** Allow button to be deselected when already selected */
30
30
  allowDeselect?: boolean;
31
31
  }
32
32
  declare const StyledButtonToggle: import("styled-components").StyledComponent<"button", any, StyledButtonToggleProps, never>;
@@ -3,9 +3,9 @@ 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
5
  export const heightConfig = {
6
- small: 32,
7
- medium: 40,
8
- large: 48
6
+ small: 24,
7
+ medium: 32,
8
+ large: 40
9
9
  };
10
10
  export const fontSizeConfig = {
11
11
  small: 14,
@@ -13,17 +13,17 @@ export const fontSizeConfig = {
13
13
  large: 16
14
14
  };
15
15
  export const paddingConfig = {
16
- small: 16,
17
- medium: 24,
18
- large: 32
16
+ small: 8,
17
+ medium: 8,
18
+ large: 12
19
19
  };
20
20
  const heightLargeIconConfig = {
21
- small: 80,
22
- medium: 96,
23
- large: 112
21
+ small: 72,
22
+ medium: 88,
23
+ large: 120
24
24
  };
25
25
  const paddingLargeIconConfig = {
26
- small: 32,
26
+ small: 24,
27
27
  medium: 40,
28
28
  large: 48
29
29
  };
@@ -46,6 +46,17 @@ const StyledButtonToggle = styled.button`
46
46
  box-sizing: border-box;
47
47
  max-width: 100%;
48
48
 
49
+ font-weight: 700;
50
+ background-color: transparent;
51
+ cursor: pointer;
52
+ text-align: start;
53
+ color: var(--colorsActionMinor500);
54
+ border: none;
55
+
56
+ ${StyledIcon} {
57
+ color: var(--colorsActionMinor500);
58
+ }
59
+
49
60
  ${({
50
61
  size
51
62
  }) => css`
@@ -53,14 +64,17 @@ const StyledButtonToggle = styled.button`
53
64
  padding: 0 ${paddingConfig[size]}px;
54
65
  font-size: ${fontSizeConfig[size]}px;
55
66
  `}
56
- font-weight: 700;
57
- background-color: transparent;
58
- cursor: pointer;
59
- text-align: start;
60
- color: inherit;
61
-
62
- border: 1px solid var(--colorsActionMinor500);
63
67
 
68
+ ${({
69
+ buttonIcon,
70
+ buttonIconSize,
71
+ size
72
+ }) => buttonIcon && buttonIconSize === "large" && css`
73
+ height: ${heightLargeIconConfig[size]}px;
74
+ padding: 0 ${paddingLargeIconConfig[size]}px;
75
+ flex-direction: column;
76
+ `}
77
+
64
78
  &:focus {
65
79
  ${({
66
80
  theme
@@ -68,9 +82,22 @@ const StyledButtonToggle = styled.button`
68
82
  z-index: 100;
69
83
  }
70
84
 
85
+ &:not(:disabled):hover {
86
+ background-color: var(--colorsActionMinor600);
87
+ color: var(--colorsActionMinorYang100);
88
+ ${StyledIcon} {
89
+ color: var(--colorsActionMinorYang100);
90
+ }
91
+ }
92
+
71
93
  &[aria-pressed="true"] {
72
- background-color: var(--colorsActionMinor300);
73
- color: var(--colorsActionMinor600);
94
+ background-color: var(--colorsActionMinor850);
95
+ color: var(--colorsActionMinorYang100);
96
+
97
+ ${StyledIcon} {
98
+ color: var(--colorsActionMinorYang100);
99
+ }
100
+
74
101
  ${({
75
102
  allowDeselect
76
103
  }) => !allowDeselect && css`
@@ -78,72 +105,26 @@ const StyledButtonToggle = styled.button`
78
105
  `}
79
106
  }
80
107
 
81
- ${StyledIcon} {
82
- width: 16px;
83
- height: 16px;
84
- color: var(--colorsActionMinor500);
85
- }
86
-
87
- ${({
88
- buttonIcon,
89
- buttonIconSize,
90
- size
91
- }) => buttonIcon && buttonIconSize === "large" && css`
92
- height: ${heightLargeIconConfig[size]}px;
93
- padding: 0 ${paddingLargeIconConfig[size]}px;
94
- flex-direction: column;
95
- `}
96
108
  ${({
97
109
  disabled
98
110
  }) => disabled && css`
111
+ cursor: not-allowed;
112
+
99
113
  & {
100
- border-color: var(--colorsActionDisabled500);
101
114
  color: var(--colorsActionMinorYin030);
102
115
  ${StyledIcon} {
103
116
  color: var(--colorsActionMinorYin030);
104
117
  }
105
118
  }
106
- cursor: not-allowed;
107
- `}
108
-
109
- & ${StyledIcon} {
110
- color: var(--colorsActionMinor500);
111
- :not([aria-pressed="true"]):not(:disabled):hover {
112
- color: var(--colorsActionMinorYang100);
113
- }
114
- }
115
-
116
- color: var(--colorsActionMinor500);
117
-
118
- &[aria-pressed="true"]:not(:hover) {
119
- box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500);
120
- background-color: transparent;
121
- :focus {
122
- box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500),
123
- 0px 0px 0px var(--borderWidth300) var(--colorsSemanticFocus500),
124
- 0px 0px 0px var(--borderWidth600) var(--colorsUtilityYin090);
125
- }
126
- }
127
119
 
128
- :not([aria-pressed="true"]):not(:disabled):hover {
129
- color: var(--colorsActionMinorYang100);
130
- background-color: var(--colorsActionMinor600);
131
- ${StyledIcon} {
132
- color: var(--colorsActionMinorYang100);
133
- }
134
- }
135
-
136
- &:not(:disabled):hover {
137
- background-color: var(--colorsActionMinor600);
138
- color: var(--colorsActionMinorYang100);
139
-
140
- ${StyledIcon} {
141
- color: var(--colorsActionMinorYang100);
142
- }
143
- }
120
+ &[aria-pressed="true"] {
121
+ cursor: not-allowed;
122
+ background-color: var(--colorsActionMinorYin030);
123
+ }
124
+ `}
144
125
  `;
145
126
  const iconFontSizes = {
146
- smallIcon: 16,
127
+ smallIcon: 20,
147
128
  largeIcon: 32
148
129
  };
149
130
  const StyledButtonToggleIcon = styled.div`
@@ -207,10 +188,6 @@ const StyledButtonToggleWrapper = styled.div`
207
188
  `}
208
189
  `}
209
190
 
210
- &:not(:first-of-type) {
211
- margin-left: 8px;
212
- }
213
-
214
191
  ${({
215
192
  grouped
216
193
  }) => grouped && css`
@@ -99,6 +99,8 @@ export interface TextareaProps extends ValidationProps, MarginProps, Omit<Common
99
99
  warning?: boolean | string;
100
100
  /** Specify a custom border radius for the component. Any valid border-radius design token, or an array of border-radius design tokens. */
101
101
  borderRadius?: BorderRadiusType | BorderRadiusType[];
102
+ /** Hides the borders for the component. Please note that validation and focus styling will still be applied */
103
+ hideBorders?: boolean;
102
104
  }
103
105
  export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
104
106
  export { Textarea as OriginalTextarea };
@@ -59,6 +59,7 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
59
59
  helpAriaLabel,
60
60
  inputRef,
61
61
  borderRadius,
62
+ hideBorders = false,
62
63
  ...rest
63
64
  }, ref) => {
64
65
  const {
@@ -164,7 +165,8 @@ const Textarea = /*#__PURE__*/React.forwardRef(({
164
165
  error: error,
165
166
  warning: warning,
166
167
  info: info,
167
- borderRadius: borderRadius
168
+ borderRadius: borderRadius,
169
+ hideBorders: hideBorders
168
170
  }, /*#__PURE__*/React.createElement(Input, _extends({
169
171
  "aria-invalid": !!error,
170
172
  "aria-labelledby": ariaLabelledBy,
@@ -335,6 +337,7 @@ Textarea.propTypes = {
335
337
  "height": PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
336
338
  "helpAriaLabel": PropTypes.string,
337
339
  "hidden": PropTypes.bool,
340
+ "hideBorders": PropTypes.bool,
338
341
  "id": PropTypes.string,
339
342
  "info": PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
340
343
  "inlist": PropTypes.any,
@@ -3,8 +3,7 @@ import React, { useRef, useCallback } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import guid from "../../../../__internal__/utils/helpers/guid";
5
5
  import useLocale from "../../../../hooks/__internal__/useLocale";
6
- import ButtonToggleGroup from "./time-toggle.style";
7
- import { ButtonToggle } from "../../../button-toggle";
6
+ import { ButtonToggle, ButtonToggleGroup } from "../../../button-toggle";
8
7
  const Toggle = ({
9
8
  size,
10
9
  onChange,
@@ -29,23 +28,19 @@ const Toggle = ({
29
28
  }, [toggleValue, onChange]);
30
29
  return /*#__PURE__*/React.createElement(ButtonToggleGroup, _extends({}, wrapperProps, {
31
30
  "data-component": "time-button-toggle-group",
32
- m: "0px 0px 0px 8px",
31
+ m: "0px 0px 0px 16px",
33
32
  id: internalId.current,
34
33
  onChange: handleChange,
35
34
  value: toggleValue,
36
35
  disabled: disabled
37
36
  }), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, amToggleProps, {
38
37
  "data-component": "am-button-toggle",
39
- grouped: true,
40
38
  value: "AM",
41
- size: size,
42
- disabled: disabled
39
+ size: size
43
40
  }), amText), /*#__PURE__*/React.createElement(ButtonToggle, _extends({}, pmToggleProps, {
44
41
  "data-component": "pm-button-toggle",
45
- grouped: true,
46
42
  value: "PM",
47
- size: size,
48
- disabled: disabled
43
+ size: size
49
44
  }), pmText));
50
45
  };
51
46
  Toggle.displayName = "Toggle";
@@ -141,7 +141,7 @@ const Time = /*#__PURE__*/React.forwardRef(({
141
141
  legendMargin: {
142
142
  mb: 0
143
143
  },
144
- width: "min-content",
144
+ width: "fit-content",
145
145
  isRequired: required,
146
146
  isOptional: isOptional,
147
147
  isDisabled: disabled,