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.
- package/esm/__internal__/input/input-presentation.component.d.ts +3 -1
- package/esm/__internal__/input/input-presentation.component.js +4 -1
- package/esm/__internal__/input/input-presentation.style.d.ts +1 -1
- package/esm/__internal__/input/input-presentation.style.js +9 -5
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +13 -8
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +25 -13
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +5 -2
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.js +37 -7
- package/esm/components/button-toggle/button-toggle.component.d.ts +1 -1
- package/esm/components/button-toggle/button-toggle.component.js +7 -1
- package/esm/components/button-toggle/button-toggle.style.d.ts +1 -1
- package/esm/components/button-toggle/button-toggle.style.js +54 -77
- package/esm/components/textarea/textarea.component.d.ts +2 -0
- package/esm/components/textarea/textarea.component.js +4 -1
- package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +4 -9
- package/esm/components/time/time.component.js +1 -1
- package/esm/components/time/time.style.js +1 -1
- package/lib/__internal__/input/input-presentation.component.d.ts +3 -1
- package/lib/__internal__/input/input-presentation.component.js +4 -1
- package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
- package/lib/__internal__/input/input-presentation.style.js +9 -5
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +13 -8
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +23 -11
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +5 -2
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.js +38 -8
- package/lib/components/button-toggle/button-toggle.component.d.ts +1 -1
- package/lib/components/button-toggle/button-toggle.component.js +7 -1
- package/lib/components/button-toggle/button-toggle.style.d.ts +1 -1
- package/lib/components/button-toggle/button-toggle.style.js +54 -77
- package/lib/components/textarea/textarea.component.d.ts +2 -0
- package/lib/components/textarea/textarea.component.js +4 -1
- package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +4 -9
- package/lib/components/time/time.component.js +1 -1
- package/lib/components/time/time.style.js +1 -1
- package/package.json +1 -1
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +0 -8
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +0 -19
- package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +0 -8
- 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;
|
|
@@ -19,6 +19,7 @@ const InputPresentation = ({
|
|
|
19
19
|
disabled,
|
|
20
20
|
error,
|
|
21
21
|
hasIcon,
|
|
22
|
+
hideBorders = false,
|
|
22
23
|
info,
|
|
23
24
|
inputWidth,
|
|
24
25
|
maxWidth,
|
|
@@ -68,7 +69,8 @@ const InputPresentation = ({
|
|
|
68
69
|
info: info,
|
|
69
70
|
validationRedesignOptIn: validationRedesignOptIn,
|
|
70
71
|
hasIcon: hasIcon,
|
|
71
|
-
borderRadius: borderRadius
|
|
72
|
+
borderRadius: borderRadius,
|
|
73
|
+
hideBorders: hideBorders
|
|
72
74
|
}, children));
|
|
73
75
|
};
|
|
74
76
|
InputPresentation.propTypes = {
|
|
@@ -78,6 +80,7 @@ InputPresentation.propTypes = {
|
|
|
78
80
|
"disabled": _propTypes.default.bool,
|
|
79
81
|
"error": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
80
82
|
"hasIcon": _propTypes.default.bool,
|
|
83
|
+
"hideBorders": _propTypes.default.bool,
|
|
81
84
|
"info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
82
85
|
"inputWidth": _propTypes.default.number,
|
|
83
86
|
"maxWidth": _propTypes.default.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;
|
|
@@ -53,7 +53,9 @@ function stylingForValidations({
|
|
|
53
53
|
const InputPresentationStyle = _styledComponents.default.div`
|
|
54
54
|
align-items: stretch;
|
|
55
55
|
background: var(--colorsUtilityYang100);
|
|
56
|
-
|
|
56
|
+
${({
|
|
57
|
+
hideBorders
|
|
58
|
+
}) => hideBorders ? `border: 1px solid transparent;` : `border: 1px solid var(--colorsUtilityMajor300);`}
|
|
57
59
|
box-sizing: border-box;
|
|
58
60
|
cursor: text;
|
|
59
61
|
display: flex;
|
|
@@ -85,10 +87,11 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
85
87
|
`}
|
|
86
88
|
|
|
87
89
|
${({
|
|
88
|
-
disabled
|
|
90
|
+
disabled,
|
|
91
|
+
hideBorders
|
|
89
92
|
}) => disabled && (0, _styledComponents.css)`
|
|
90
93
|
background: var(--colorsUtilityDisabled400);
|
|
91
|
-
border-color: var(--colorsUtilityDisabled600);
|
|
94
|
+
border-color: ${hideBorders ? `transparent` : `var(--colorsUtilityDisabled600)`};
|
|
92
95
|
cursor: not-allowed;
|
|
93
96
|
`}
|
|
94
97
|
|
|
@@ -105,10 +108,11 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
105
108
|
${stylingForValidations}
|
|
106
109
|
|
|
107
110
|
${({
|
|
108
|
-
readOnly
|
|
111
|
+
readOnly,
|
|
112
|
+
hideBorders
|
|
109
113
|
}) => readOnly && (0, _styledComponents.css)`
|
|
110
114
|
background-color: var(--colorsUtilityReadOnly400);
|
|
111
|
-
border-color: var(--colorsUtilityReadOnly600);
|
|
115
|
+
border-color: ${hideBorders ? `transparent` : `var(--colorsUtilityReadOnly600)`};
|
|
112
116
|
`}
|
|
113
117
|
|
|
114
118
|
${({
|
|
@@ -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
|
-
/**
|
|
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;
|
|
@@ -16,6 +16,7 @@ var _tooltipProvider = require("../../../__internal__/tooltip-provider");
|
|
|
16
16
|
var _inputBehaviour = require("../../../__internal__/input-behaviour");
|
|
17
17
|
var _logger = _interopRequireDefault(require("../../../__internal__/utils/logger"));
|
|
18
18
|
var _events = _interopRequireDefault(require("../../../__internal__/utils/helpers/events"));
|
|
19
|
+
var _carbonProvider = require("../../carbon-provider/carbon-provider.component");
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,7 +28,8 @@ const ButtonToggleGroupContext = exports.ButtonToggleGroupContext = /*#__PURE__*
|
|
|
27
28
|
handleKeyDown: /* istanbul ignore next */() => {},
|
|
28
29
|
pressedButtonValue: undefined,
|
|
29
30
|
allowDeselect: false,
|
|
30
|
-
isInGroup: false
|
|
31
|
+
isInGroup: false,
|
|
32
|
+
isDisabled: false
|
|
31
33
|
});
|
|
32
34
|
const ButtonToggleGroup = ({
|
|
33
35
|
children,
|
|
@@ -37,6 +39,7 @@ const ButtonToggleGroup = ({
|
|
|
37
39
|
label,
|
|
38
40
|
labelHelp,
|
|
39
41
|
labelSpacing,
|
|
42
|
+
inputHint,
|
|
40
43
|
inputWidth,
|
|
41
44
|
fullWidth,
|
|
42
45
|
labelInline,
|
|
@@ -50,6 +53,7 @@ const ButtonToggleGroup = ({
|
|
|
50
53
|
helpAriaLabel,
|
|
51
54
|
id,
|
|
52
55
|
allowDeselect,
|
|
56
|
+
disabled,
|
|
53
57
|
className,
|
|
54
58
|
...props
|
|
55
59
|
}) => {
|
|
@@ -68,6 +72,10 @@ const ButtonToggleGroup = ({
|
|
|
68
72
|
_logger.default.deprecate(`The \`name\` prop in \`ButtonToggleGroup\` component is deprecated and will soon be removed. It does not provide any functionality
|
|
69
73
|
since the component can no longer be used in an uncontrolled fashion.`);
|
|
70
74
|
}
|
|
75
|
+
const {
|
|
76
|
+
validationRedesignOptIn
|
|
77
|
+
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
78
|
+
const computeLabelPropValues = prop => validationRedesignOptIn ? undefined : prop;
|
|
71
79
|
const onButtonClick = buttonValue => {
|
|
72
80
|
let newValue = buttonValue;
|
|
73
81
|
const currentValue = value || pressedButtonValue;
|
|
@@ -121,18 +129,19 @@ const ButtonToggleGroup = ({
|
|
|
121
129
|
helpAriaLabel: helpAriaLabel
|
|
122
130
|
}, /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({
|
|
123
131
|
label: label,
|
|
124
|
-
labelHelp: labelHelp,
|
|
132
|
+
labelHelp: computeLabelPropValues(labelHelp),
|
|
125
133
|
labelSpacing: labelSpacing,
|
|
126
|
-
fieldHelp: fieldHelp,
|
|
127
|
-
fieldHelpInline: fieldHelpInline,
|
|
128
|
-
labelInline: labelInline,
|
|
129
|
-
labelWidth: labelWidth,
|
|
134
|
+
fieldHelp: computeLabelPropValues(fieldHelp),
|
|
135
|
+
fieldHelpInline: computeLabelPropValues(fieldHelpInline),
|
|
136
|
+
labelInline: computeLabelPropValues(labelInline),
|
|
137
|
+
labelWidth: computeLabelPropValues(labelWidth),
|
|
130
138
|
labelId: labelId.current,
|
|
131
139
|
"data-component": dataComponent,
|
|
132
140
|
"data-role": dataRole,
|
|
133
141
|
"data-element": dataElement,
|
|
134
142
|
id: id,
|
|
135
|
-
labelAs: "span"
|
|
143
|
+
labelAs: "span",
|
|
144
|
+
disabled: disabled
|
|
136
145
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(ButtonToggleGroupContext.Provider, {
|
|
137
146
|
value: {
|
|
138
147
|
onButtonClick,
|
|
@@ -142,10 +151,13 @@ const ButtonToggleGroup = ({
|
|
|
142
151
|
name,
|
|
143
152
|
allowDeselect,
|
|
144
153
|
isInGroup: true,
|
|
154
|
+
isDisabled: disabled,
|
|
145
155
|
firstButton,
|
|
146
156
|
childButtonCallbackRef
|
|
147
157
|
}
|
|
148
|
-
}, /*#__PURE__*/_react.default.createElement(_buttonToggleGroup.
|
|
158
|
+
}, inputHint && /*#__PURE__*/_react.default.createElement(_buttonToggleGroup.StyledHintText, {
|
|
159
|
+
isDisabled: disabled
|
|
160
|
+
}, inputHint), /*#__PURE__*/_react.default.createElement(_buttonToggleGroup.StyledButtonToggleGroupWrapper, {
|
|
149
161
|
labelInline: labelInline,
|
|
150
162
|
ref: wrapperRef
|
|
151
163
|
}, /*#__PURE__*/_react.default.createElement(_buttonToggleGroup.default, _extends({}, label ? {
|
|
@@ -159,9 +171,9 @@ const ButtonToggleGroup = ({
|
|
|
159
171
|
"data-component": dataComponent,
|
|
160
172
|
"data-role": dataRole,
|
|
161
173
|
"data-element": dataElement,
|
|
162
|
-
id: id
|
|
163
|
-
|
|
164
|
-
|
|
174
|
+
id: id,
|
|
175
|
+
className: className,
|
|
176
|
+
disabled: disabled
|
|
165
177
|
}), children))))));
|
|
166
178
|
};
|
|
167
179
|
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;
|
|
@@ -3,28 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.StyledButtonToggleGroupWrapper = void 0;
|
|
6
|
+
exports.default = exports.StyledHintText = exports.StyledButtonToggleGroupWrapper = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _themes = require("../../../style/themes");
|
|
10
10
|
var _buttonToggle = require("../button-toggle.style");
|
|
11
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const StyledButtonToggleGroupWrapper = exports.StyledButtonToggleGroupWrapper = _styledComponents.default.div`
|
|
14
|
-
${({
|
|
15
|
-
labelInline
|
|
16
|
-
}) => labelInline && (0, _styledComponents.css)`
|
|
17
|
-
display: flex;
|
|
18
|
-
`}
|
|
19
|
-
`;
|
|
20
13
|
const StyledButtonToggleGroup = _styledComponents.default.div`
|
|
21
14
|
${_styledSystem.margin}
|
|
22
15
|
|
|
23
16
|
display: flex;
|
|
17
|
+
box-shadow: inset 0px 0px 0px 1px var(--colorsActionMinor500);
|
|
18
|
+
border-radius: var(--borderRadius100);
|
|
19
|
+
padding: 4px;
|
|
20
|
+
gap: 4px;
|
|
21
|
+
width: fit-content;
|
|
22
|
+
height: fit-content;
|
|
23
|
+
flex-wrap: wrap;
|
|
24
|
+
|
|
25
|
+
${({
|
|
26
|
+
disabled
|
|
27
|
+
}) => disabled && (0, _styledComponents.css)`
|
|
28
|
+
cursor: not-allowed;
|
|
29
|
+
box-shadow: inset 0px 0px 0px 1px var(--colorsActionDisabled600);
|
|
30
|
+
`}
|
|
24
31
|
|
|
25
32
|
${({
|
|
26
33
|
fullWidth
|
|
27
34
|
}) => fullWidth && (0, _styledComponents.css)`
|
|
35
|
+
width: 100%;
|
|
28
36
|
${_buttonToggle.StyledButtonToggle} {
|
|
29
37
|
width: 100%;
|
|
30
38
|
}
|
|
@@ -39,6 +47,28 @@ const StyledButtonToggleGroup = _styledComponents.default.div`
|
|
|
39
47
|
width: ${`${inputWidth}%`};
|
|
40
48
|
`}
|
|
41
49
|
`;
|
|
50
|
+
const StyledButtonToggleGroupWrapper = exports.StyledButtonToggleGroupWrapper = _styledComponents.default.div`
|
|
51
|
+
${({
|
|
52
|
+
labelInline
|
|
53
|
+
}) => labelInline && (0, _styledComponents.css)`
|
|
54
|
+
display: flex;
|
|
55
|
+
${StyledButtonToggleGroup} {
|
|
56
|
+
flex-wrap: nowrap;
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
`;
|
|
60
|
+
const StyledHintText = exports.StyledHintText = _styledComponents.default.div`
|
|
61
|
+
::after {
|
|
62
|
+
content: " ";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
margin-top: var(--spacing000);
|
|
66
|
+
margin-bottom: var(--spacing150);
|
|
67
|
+
color: ${({
|
|
68
|
+
isDisabled
|
|
69
|
+
}) => isDisabled ? "var(--colorsUtilityYin030)" : "var(--colorsUtilityYin055)"};
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
`;
|
|
42
72
|
StyledButtonToggleGroup.defaultProps = {
|
|
43
73
|
theme: _themes.baseTheme
|
|
44
74
|
};
|
|
@@ -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;
|
|
@@ -20,6 +20,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
20
20
|
let deprecateCheckedWarnTriggered = false;
|
|
21
21
|
let deprecateNameWarnTriggered = false;
|
|
22
22
|
let deprecateUncontrolledWarnTriggered = false;
|
|
23
|
+
let deprecateGroupedWarnTriggered = false;
|
|
23
24
|
const ButtonToggle = ({
|
|
24
25
|
"aria-label": ariaLabel,
|
|
25
26
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -50,6 +51,10 @@ const ButtonToggle = ({
|
|
|
50
51
|
_logger.default.deprecate(`The \`name\` prop in \`ButtonToggle\` component is deprecated and will soon be removed. It does not provide any functionality
|
|
51
52
|
since the component can no longer be used in an uncontrolled fashion.`);
|
|
52
53
|
}
|
|
54
|
+
if (grouped && !deprecateGroupedWarnTriggered) {
|
|
55
|
+
deprecateGroupedWarnTriggered = true;
|
|
56
|
+
_logger.default.deprecate("The `grouped` prop in `ButtonToggle` component is deprecated and will soon be removed. Spacing between buttons is no longer no removed.");
|
|
57
|
+
}
|
|
53
58
|
const pressedPropValue = pressed === undefined ? checked : pressed;
|
|
54
59
|
const buttonRef = (0, _react.useRef)(null);
|
|
55
60
|
const {
|
|
@@ -66,6 +71,7 @@ const ButtonToggle = ({
|
|
|
66
71
|
name: groupName,
|
|
67
72
|
allowDeselect,
|
|
68
73
|
isInGroup,
|
|
74
|
+
isDisabled,
|
|
69
75
|
firstButton,
|
|
70
76
|
childButtonCallbackRef
|
|
71
77
|
} = (0, _react.useContext)(_buttonToggleGroup.ButtonToggleGroupContext);
|
|
@@ -138,7 +144,7 @@ const ButtonToggle = ({
|
|
|
138
144
|
buttonIcon: buttonIcon,
|
|
139
145
|
buttonIconSize: buttonIconSize,
|
|
140
146
|
"data-element": "button-toggle-button",
|
|
141
|
-
disabled: disabled,
|
|
147
|
+
disabled: disabled || isDisabled,
|
|
142
148
|
id: inputGuid.current,
|
|
143
149
|
onMouseEnter: onMouseEnter,
|
|
144
150
|
onMouseLeave: onMouseLeave,
|
|
@@ -26,7 +26,7 @@ export interface StyledButtonToggleProps {
|
|
|
26
26
|
/** ButtonToggle size */
|
|
27
27
|
size: "small" | "medium" | "large";
|
|
28
28
|
grouped?: boolean;
|
|
29
|
-
/**
|
|
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>;
|
|
@@ -12,9 +12,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
14
|
const heightConfig = exports.heightConfig = {
|
|
15
|
-
small:
|
|
16
|
-
medium:
|
|
17
|
-
large:
|
|
15
|
+
small: 24,
|
|
16
|
+
medium: 32,
|
|
17
|
+
large: 40
|
|
18
18
|
};
|
|
19
19
|
const fontSizeConfig = exports.fontSizeConfig = {
|
|
20
20
|
small: 14,
|
|
@@ -22,17 +22,17 @@ const fontSizeConfig = exports.fontSizeConfig = {
|
|
|
22
22
|
large: 16
|
|
23
23
|
};
|
|
24
24
|
const paddingConfig = exports.paddingConfig = {
|
|
25
|
-
small:
|
|
26
|
-
medium:
|
|
27
|
-
large:
|
|
25
|
+
small: 8,
|
|
26
|
+
medium: 8,
|
|
27
|
+
large: 12
|
|
28
28
|
};
|
|
29
29
|
const heightLargeIconConfig = {
|
|
30
|
-
small:
|
|
31
|
-
medium:
|
|
32
|
-
large:
|
|
30
|
+
small: 72,
|
|
31
|
+
medium: 88,
|
|
32
|
+
large: 120
|
|
33
33
|
};
|
|
34
34
|
const paddingLargeIconConfig = {
|
|
35
|
-
small:
|
|
35
|
+
small: 24,
|
|
36
36
|
medium: 40,
|
|
37
37
|
large: 48
|
|
38
38
|
};
|
|
@@ -55,6 +55,17 @@ const StyledButtonToggle = exports.StyledButtonToggle = _styledComponents.defaul
|
|
|
55
55
|
box-sizing: border-box;
|
|
56
56
|
max-width: 100%;
|
|
57
57
|
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
text-align: start;
|
|
62
|
+
color: var(--colorsActionMinor500);
|
|
63
|
+
border: none;
|
|
64
|
+
|
|
65
|
+
${_icon.default} {
|
|
66
|
+
color: var(--colorsActionMinor500);
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
${({
|
|
59
70
|
size
|
|
60
71
|
}) => (0, _styledComponents.css)`
|
|
@@ -62,14 +73,17 @@ const StyledButtonToggle = exports.StyledButtonToggle = _styledComponents.defaul
|
|
|
62
73
|
padding: 0 ${paddingConfig[size]}px;
|
|
63
74
|
font-size: ${fontSizeConfig[size]}px;
|
|
64
75
|
`}
|
|
65
|
-
font-weight: 700;
|
|
66
|
-
background-color: transparent;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
text-align: start;
|
|
69
|
-
color: inherit;
|
|
70
|
-
|
|
71
|
-
border: 1px solid var(--colorsActionMinor500);
|
|
72
76
|
|
|
77
|
+
${({
|
|
78
|
+
buttonIcon,
|
|
79
|
+
buttonIconSize,
|
|
80
|
+
size
|
|
81
|
+
}) => buttonIcon && buttonIconSize === "large" && (0, _styledComponents.css)`
|
|
82
|
+
height: ${heightLargeIconConfig[size]}px;
|
|
83
|
+
padding: 0 ${paddingLargeIconConfig[size]}px;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
`}
|
|
86
|
+
|
|
73
87
|
&:focus {
|
|
74
88
|
${({
|
|
75
89
|
theme
|
|
@@ -77,9 +91,22 @@ const StyledButtonToggle = exports.StyledButtonToggle = _styledComponents.defaul
|
|
|
77
91
|
z-index: 100;
|
|
78
92
|
}
|
|
79
93
|
|
|
94
|
+
&:not(:disabled):hover {
|
|
95
|
+
background-color: var(--colorsActionMinor600);
|
|
96
|
+
color: var(--colorsActionMinorYang100);
|
|
97
|
+
${_icon.default} {
|
|
98
|
+
color: var(--colorsActionMinorYang100);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
80
102
|
&[aria-pressed="true"] {
|
|
81
|
-
background-color: var(--
|
|
82
|
-
color: var(--
|
|
103
|
+
background-color: var(--colorsActionMinor850);
|
|
104
|
+
color: var(--colorsActionMinorYang100);
|
|
105
|
+
|
|
106
|
+
${_icon.default} {
|
|
107
|
+
color: var(--colorsActionMinorYang100);
|
|
108
|
+
}
|
|
109
|
+
|
|
83
110
|
${({
|
|
84
111
|
allowDeselect
|
|
85
112
|
}) => !allowDeselect && (0, _styledComponents.css)`
|
|
@@ -87,72 +114,26 @@ const StyledButtonToggle = exports.StyledButtonToggle = _styledComponents.defaul
|
|
|
87
114
|
`}
|
|
88
115
|
}
|
|
89
116
|
|
|
90
|
-
${_icon.default} {
|
|
91
|
-
width: 16px;
|
|
92
|
-
height: 16px;
|
|
93
|
-
color: var(--colorsActionMinor500);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
${({
|
|
97
|
-
buttonIcon,
|
|
98
|
-
buttonIconSize,
|
|
99
|
-
size
|
|
100
|
-
}) => buttonIcon && buttonIconSize === "large" && (0, _styledComponents.css)`
|
|
101
|
-
height: ${heightLargeIconConfig[size]}px;
|
|
102
|
-
padding: 0 ${paddingLargeIconConfig[size]}px;
|
|
103
|
-
flex-direction: column;
|
|
104
|
-
`}
|
|
105
117
|
${({
|
|
106
118
|
disabled
|
|
107
119
|
}) => disabled && (0, _styledComponents.css)`
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
|
|
108
122
|
& {
|
|
109
|
-
border-color: var(--colorsActionDisabled500);
|
|
110
123
|
color: var(--colorsActionMinorYin030);
|
|
111
124
|
${_icon.default} {
|
|
112
125
|
color: var(--colorsActionMinorYin030);
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
|
-
cursor: not-allowed;
|
|
116
|
-
`}
|
|
117
|
-
|
|
118
|
-
& ${_icon.default} {
|
|
119
|
-
color: var(--colorsActionMinor500);
|
|
120
|
-
:not([aria-pressed="true"]):not(:disabled):hover {
|
|
121
|
-
color: var(--colorsActionMinorYang100);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
color: var(--colorsActionMinor500);
|
|
126
|
-
|
|
127
|
-
&[aria-pressed="true"]:not(:hover) {
|
|
128
|
-
box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500);
|
|
129
|
-
background-color: transparent;
|
|
130
|
-
:focus {
|
|
131
|
-
box-shadow: inset 0px 0px 0px 3px var(--colorsActionMinor500),
|
|
132
|
-
0px 0px 0px var(--borderWidth300) var(--colorsSemanticFocus500),
|
|
133
|
-
0px 0px 0px var(--borderWidth600) var(--colorsUtilityYin090);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
128
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&:not(:disabled):hover {
|
|
146
|
-
background-color: var(--colorsActionMinor600);
|
|
147
|
-
color: var(--colorsActionMinorYang100);
|
|
148
|
-
|
|
149
|
-
${_icon.default} {
|
|
150
|
-
color: var(--colorsActionMinorYang100);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
129
|
+
&[aria-pressed="true"] {
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
background-color: var(--colorsActionMinorYin030);
|
|
132
|
+
}
|
|
133
|
+
`}
|
|
153
134
|
`;
|
|
154
135
|
const iconFontSizes = {
|
|
155
|
-
smallIcon:
|
|
136
|
+
smallIcon: 20,
|
|
156
137
|
largeIcon: 32
|
|
157
138
|
};
|
|
158
139
|
const StyledButtonToggleIcon = exports.StyledButtonToggleIcon = _styledComponents.default.div`
|
|
@@ -216,10 +197,6 @@ const StyledButtonToggleWrapper = exports.StyledButtonToggleWrapper = _styledCom
|
|
|
216
197
|
`}
|
|
217
198
|
`}
|
|
218
199
|
|
|
219
|
-
&:not(:first-of-type) {
|
|
220
|
-
margin-left: 8px;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
200
|
${({
|
|
224
201
|
grouped
|
|
225
202
|
}) => grouped && (0, _styledComponents.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 };
|
|
@@ -68,6 +68,7 @@ const Textarea = exports.OriginalTextarea = exports.Textarea = /*#__PURE__*/_rea
|
|
|
68
68
|
helpAriaLabel,
|
|
69
69
|
inputRef,
|
|
70
70
|
borderRadius,
|
|
71
|
+
hideBorders = false,
|
|
71
72
|
...rest
|
|
72
73
|
}, ref) => {
|
|
73
74
|
const {
|
|
@@ -173,7 +174,8 @@ const Textarea = exports.OriginalTextarea = exports.Textarea = /*#__PURE__*/_rea
|
|
|
173
174
|
error: error,
|
|
174
175
|
warning: warning,
|
|
175
176
|
info: info,
|
|
176
|
-
borderRadius: borderRadius
|
|
177
|
+
borderRadius: borderRadius,
|
|
178
|
+
hideBorders: hideBorders
|
|
177
179
|
}, /*#__PURE__*/_react.default.createElement(_input2.default, _extends({
|
|
178
180
|
"aria-invalid": !!error,
|
|
179
181
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -344,6 +346,7 @@ Textarea.propTypes = {
|
|
|
344
346
|
"height": _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
345
347
|
"helpAriaLabel": _propTypes.default.string,
|
|
346
348
|
"hidden": _propTypes.default.bool,
|
|
349
|
+
"hideBorders": _propTypes.default.bool,
|
|
347
350
|
"id": _propTypes.default.string,
|
|
348
351
|
"info": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
349
352
|
"inlist": _propTypes.default.any,
|
|
@@ -8,7 +8,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _guid = _interopRequireDefault(require("../../../../__internal__/utils/helpers/guid"));
|
|
10
10
|
var _useLocale = _interopRequireDefault(require("../../../../hooks/__internal__/useLocale"));
|
|
11
|
-
var _timeToggle = _interopRequireDefault(require("./time-toggle.style"));
|
|
12
11
|
var _buttonToggle = require("../../../button-toggle");
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -36,25 +35,21 @@ const Toggle = ({
|
|
|
36
35
|
onChange(selectedButtonValue);
|
|
37
36
|
}
|
|
38
37
|
}, [toggleValue, onChange]);
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_buttonToggle.ButtonToggleGroup, _extends({}, wrapperProps, {
|
|
40
39
|
"data-component": "time-button-toggle-group",
|
|
41
|
-
m: "0px 0px 0px
|
|
40
|
+
m: "0px 0px 0px 16px",
|
|
42
41
|
id: internalId.current,
|
|
43
42
|
onChange: handleChange,
|
|
44
43
|
value: toggleValue,
|
|
45
44
|
disabled: disabled
|
|
46
45
|
}), /*#__PURE__*/_react.default.createElement(_buttonToggle.ButtonToggle, _extends({}, amToggleProps, {
|
|
47
46
|
"data-component": "am-button-toggle",
|
|
48
|
-
grouped: true,
|
|
49
47
|
value: "AM",
|
|
50
|
-
size: size
|
|
51
|
-
disabled: disabled
|
|
48
|
+
size: size
|
|
52
49
|
}), amText), /*#__PURE__*/_react.default.createElement(_buttonToggle.ButtonToggle, _extends({}, pmToggleProps, {
|
|
53
50
|
"data-component": "pm-button-toggle",
|
|
54
|
-
grouped: true,
|
|
55
51
|
value: "PM",
|
|
56
|
-
size: size
|
|
57
|
-
disabled: disabled
|
|
52
|
+
size: size
|
|
58
53
|
}), pmText));
|
|
59
54
|
};
|
|
60
55
|
Toggle.displayName = "Toggle";
|