carbon-react 125.6.0 → 125.8.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__/fieldset/fieldset.component.d.ts +13 -1
- package/esm/__internal__/fieldset/fieldset.component.js +20 -4
- package/esm/__internal__/fieldset/fieldset.style.d.ts +6 -1
- package/esm/__internal__/fieldset/fieldset.style.js +27 -1
- package/esm/__internal__/label/label.component.d.ts +6 -2
- package/esm/__internal__/label/label.component.js +7 -3
- package/esm/components/accordion/accordion.component.d.ts +3 -3
- package/esm/components/accordion/accordion.component.js +31 -12
- package/esm/components/accordion/accordion.style.d.ts +9 -3
- package/esm/components/accordion/accordion.style.js +54 -18
- package/esm/components/box/box.component.d.ts +2 -0
- package/esm/components/box/box.component.js +4 -1
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
- package/esm/components/button-toggle/button-toggle.style.d.ts +15 -0
- package/esm/components/button-toggle/button-toggle.style.js +3 -3
- package/esm/components/heading/heading.style.d.ts +1 -1
- package/esm/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
- package/esm/components/time/__internal__/time-toggle/index.d.ts +2 -0
- package/esm/components/time/__internal__/time-toggle/index.js +1 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.component.js +52 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
- package/esm/components/time/__internal__/time-toggle/time-toggle.style.js +19 -0
- package/esm/components/time/index.d.ts +2 -0
- package/esm/components/time/index.js +1 -0
- package/esm/components/time/time.component.d.ts +73 -0
- package/esm/components/time/time.component.js +428 -0
- package/esm/components/time/time.style.d.ts +6 -0
- package/esm/components/time/time.style.js +19 -0
- package/esm/components/typography/typography.component.d.ts +7 -1
- package/esm/components/typography/typography.component.js +3 -1
- package/esm/components/typography/typography.style.js +5 -0
- package/esm/global.d.ts +1 -0
- package/esm/locales/__internal__/pl-pl.js +8 -0
- package/esm/locales/en-gb.js +8 -0
- package/esm/locales/locale.d.ts +8 -0
- package/lib/__internal__/fieldset/fieldset.component.d.ts +13 -1
- package/lib/__internal__/fieldset/fieldset.component.js +19 -3
- package/lib/__internal__/fieldset/fieldset.style.d.ts +6 -1
- package/lib/__internal__/fieldset/fieldset.style.js +27 -1
- package/lib/__internal__/label/label.component.d.ts +6 -2
- package/lib/__internal__/label/label.component.js +7 -3
- package/lib/components/accordion/accordion.component.d.ts +3 -3
- package/lib/components/accordion/accordion.component.js +31 -12
- package/lib/components/accordion/accordion.style.d.ts +9 -3
- package/lib/components/accordion/accordion.style.js +54 -18
- package/lib/components/box/box.component.d.ts +2 -0
- package/lib/components/box/box.component.js +4 -1
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +6 -1
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +4 -1
- package/lib/components/button-toggle/button-toggle.style.d.ts +15 -0
- package/lib/components/button-toggle/button-toggle.style.js +4 -4
- package/lib/components/heading/heading.style.d.ts +1 -1
- package/lib/components/tile/flex-tile-cell/flex-tile-cell.component.js +1 -0
- package/lib/components/time/__internal__/time-toggle/index.d.ts +2 -0
- package/lib/components/time/__internal__/time-toggle/index.js +13 -0
- package/lib/components/time/__internal__/time-toggle/package.json +6 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.component.d.ts +20 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.component.js +61 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.style.d.ts +8 -0
- package/lib/components/time/__internal__/time-toggle/time-toggle.style.js +26 -0
- package/lib/components/time/index.d.ts +2 -0
- package/lib/components/time/index.js +13 -0
- package/lib/components/time/package.json +6 -0
- package/lib/components/time/time.component.d.ts +73 -0
- package/lib/components/time/time.component.js +437 -0
- package/lib/components/time/time.style.d.ts +6 -0
- package/lib/components/time/time.style.js +26 -0
- package/lib/components/typography/typography.component.d.ts +7 -1
- package/lib/components/typography/typography.component.js +3 -1
- package/lib/components/typography/typography.style.js +5 -0
- package/lib/global.d.ts +1 -0
- package/lib/locales/__internal__/pl-pl.js +8 -0
- package/lib/locales/en-gb.js +8 -0
- package/lib/locales/locale.d.ts +8 -0
- 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
|
-
},
|
|
42
|
-
|
|
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
|
|
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:
|
|
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);
|
|
@@ -17,9 +17,9 @@ export interface AccordionProps extends StyledAccordionContainerProps, SpaceProp
|
|
|
17
17
|
/** Styled system spacing props provided to Accordion Title */
|
|
18
18
|
headerSpacing?: SpaceProps;
|
|
19
19
|
id?: string;
|
|
20
|
-
/** Sets icon type
|
|
21
|
-
iconType?: "chevron_down" | "dropdown";
|
|
22
|
-
/** Sets icon alignment
|
|
20
|
+
/** Sets icon type */
|
|
21
|
+
iconType?: "chevron_down" | "chevron_down_thick" | "dropdown";
|
|
22
|
+
/** Sets icon alignment */
|
|
23
23
|
iconAlign?: "left" | "right";
|
|
24
24
|
/** Sets accordion title */
|
|
25
25
|
title: React.ReactNode;
|
|
@@ -4,8 +4,11 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import useResizeObserver from "../../hooks/__internal__/useResizeObserver";
|
|
5
5
|
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
6
6
|
import Events from "../../__internal__/utils/helpers/events";
|
|
7
|
+
import Logger from "../../__internal__/utils/logger";
|
|
7
8
|
import { StyledAccordionContainer, StyledAccordionHeadingsContainer, StyledAccordionTitleContainer, StyledAccordionTitle, StyledAccordionSubTitle, StyledAccordionIcon, StyledAccordionContentContainer, StyledAccordionContent } from "./accordion.style";
|
|
8
9
|
import ValidationIcon from "../../__internal__/validations";
|
|
10
|
+
let deprecatedSchemeWarnTriggered = false;
|
|
11
|
+
let deprecatedButtonHeadingWarnTriggered = false;
|
|
9
12
|
const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
10
13
|
borders = "default",
|
|
11
14
|
defaultExpanded,
|
|
@@ -15,8 +18,8 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
15
18
|
handleKeyboardAccessibility,
|
|
16
19
|
id,
|
|
17
20
|
index,
|
|
18
|
-
iconType
|
|
19
|
-
iconAlign
|
|
21
|
+
iconType,
|
|
22
|
+
iconAlign,
|
|
20
23
|
scheme = "white",
|
|
21
24
|
size = "large",
|
|
22
25
|
subTitle,
|
|
@@ -30,8 +33,17 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
30
33
|
buttonHeading,
|
|
31
34
|
buttonWidth = "150px",
|
|
32
35
|
openTitle,
|
|
36
|
+
variant = "standard",
|
|
33
37
|
...rest
|
|
34
38
|
}, ref) => {
|
|
39
|
+
if (!deprecatedSchemeWarnTriggered && scheme === "transparent") {
|
|
40
|
+
deprecatedSchemeWarnTriggered = true;
|
|
41
|
+
Logger.deprecate("The `scheme` prop for `Accordion` component is deprecated and will soon be removed.");
|
|
42
|
+
}
|
|
43
|
+
if (!deprecatedButtonHeadingWarnTriggered && buttonHeading) {
|
|
44
|
+
deprecatedButtonHeadingWarnTriggered = true;
|
|
45
|
+
Logger.deprecate("The `buttonHeading` prop for `Accordion` component is deprecated and will soon be removed. Please use `subtle` variant instead.");
|
|
46
|
+
}
|
|
35
47
|
const isControlled = expanded !== undefined;
|
|
36
48
|
const [isExpandedInternal, setIsExpandedInternal] = useState(defaultExpanded || false);
|
|
37
49
|
const [contentHeight, setContentHeight] = useState(isExpandedInternal ? "auto" : 0);
|
|
@@ -63,13 +75,15 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
63
75
|
const contentId = `AccordionContent_${guid.current}`;
|
|
64
76
|
const showValidationIcon = !!(error || warning || info);
|
|
65
77
|
const getTitle = () => isExpanded ? openTitle || title : title;
|
|
78
|
+
const getIconType = () => size === "small" || variant === "subtle" ? "chevron_down_thick" : "chevron_down";
|
|
66
79
|
return /*#__PURE__*/React.createElement(StyledAccordionContainer, _extends({
|
|
67
80
|
id: accordionId,
|
|
68
81
|
"data-component": "accordion",
|
|
69
82
|
width: width,
|
|
70
|
-
borders: borders,
|
|
83
|
+
borders: variant === "subtle" ? "none" : borders,
|
|
71
84
|
scheme: scheme,
|
|
72
|
-
buttonHeading: buttonHeading
|
|
85
|
+
buttonHeading: buttonHeading,
|
|
86
|
+
variant: variant
|
|
73
87
|
}, rest), /*#__PURE__*/React.createElement(StyledAccordionTitleContainer, _extends({
|
|
74
88
|
"data-element": "accordion-title-container",
|
|
75
89
|
id: headerId,
|
|
@@ -78,10 +92,12 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
78
92
|
onClick: toggleAccordion,
|
|
79
93
|
onKeyDown: handleKeyDown,
|
|
80
94
|
tabIndex: 0,
|
|
81
|
-
iconAlign: iconAlign,
|
|
95
|
+
iconAlign: iconAlign || (variant === "standard" ? "right" : "left"),
|
|
82
96
|
ref: ref,
|
|
83
97
|
size: size,
|
|
84
98
|
buttonHeading: buttonHeading,
|
|
99
|
+
isExpanded: isExpanded,
|
|
100
|
+
variant: variant,
|
|
85
101
|
buttonWidth: buttonWidth,
|
|
86
102
|
hasButtonProps: buttonHeading && !(typeof headerSpacing === "undefined"),
|
|
87
103
|
role: "button"
|
|
@@ -93,19 +109,20 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
93
109
|
buttonHeading: buttonHeading
|
|
94
110
|
}, !buttonHeading && typeof title === "string" ? /*#__PURE__*/React.createElement(StyledAccordionTitle, {
|
|
95
111
|
"data-element": "accordion-title",
|
|
96
|
-
size: size
|
|
97
|
-
|
|
112
|
+
size: size,
|
|
113
|
+
variant: variant
|
|
114
|
+
}, title) : getTitle(), !buttonHeading && variant !== "subtle" && /*#__PURE__*/React.createElement(React.Fragment, null, showValidationIcon && /*#__PURE__*/React.createElement(ValidationIcon, {
|
|
98
115
|
error: error,
|
|
99
116
|
warning: warning,
|
|
100
117
|
info: info,
|
|
101
118
|
tooltipPosition: "top",
|
|
102
119
|
tabIndex: 0,
|
|
103
120
|
ml: 1
|
|
104
|
-
}), subTitle && size === "large" && /*#__PURE__*/React.createElement(StyledAccordionSubTitle, null, subTitle))), /*#__PURE__*/React.createElement(StyledAccordionIcon, {
|
|
121
|
+
}), subTitle && size === "large" && variant === "standard" && /*#__PURE__*/React.createElement(StyledAccordionSubTitle, null, subTitle))), /*#__PURE__*/React.createElement(StyledAccordionIcon, {
|
|
105
122
|
"data-element": "accordion-icon",
|
|
106
|
-
type: iconType,
|
|
123
|
+
type: iconType || getIconType(),
|
|
107
124
|
isExpanded: isExpanded,
|
|
108
|
-
iconAlign: iconAlign
|
|
125
|
+
iconAlign: iconAlign || (variant === "standard" ? "right" : "left")
|
|
109
126
|
})), /*#__PURE__*/React.createElement(StyledAccordionContentContainer, {
|
|
110
127
|
isExpanded: isExpanded,
|
|
111
128
|
maxHeight: contentHeight
|
|
@@ -115,7 +132,8 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
|
|
|
115
132
|
id: contentId,
|
|
116
133
|
"aria-labelledby": headerId,
|
|
117
134
|
ref: accordionContent,
|
|
118
|
-
disableContentPadding: disableContentPadding
|
|
135
|
+
disableContentPadding: disableContentPadding,
|
|
136
|
+
variant: variant
|
|
119
137
|
}, children)));
|
|
120
138
|
});
|
|
121
139
|
Accordion.propTypes = {
|
|
@@ -439,7 +457,7 @@ Accordion.propTypes = {
|
|
|
439
457
|
}), PropTypes.string])
|
|
440
458
|
}),
|
|
441
459
|
"iconAlign": PropTypes.oneOf(["left", "right"]),
|
|
442
|
-
"iconType": PropTypes.oneOf(["chevron_down", "dropdown"]),
|
|
460
|
+
"iconType": PropTypes.oneOf(["chevron_down_thick", "chevron_down", "dropdown"]),
|
|
443
461
|
"id": PropTypes.string,
|
|
444
462
|
"index": PropTypes.number,
|
|
445
463
|
"info": PropTypes.string,
|
|
@@ -757,6 +775,7 @@ Accordion.propTypes = {
|
|
|
757
775
|
"size": PropTypes.oneOf(["large", "small"]),
|
|
758
776
|
"subTitle": PropTypes.string,
|
|
759
777
|
"title": PropTypes.node,
|
|
778
|
+
"variant": PropTypes.oneOf(["standard", "subtle"]),
|
|
760
779
|
"warning": PropTypes.string,
|
|
761
780
|
"width": PropTypes.string
|
|
762
781
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const StyledAccordionGroup: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export interface StyledAccordionContainerProps {
|
|
4
|
-
/** Toggles left and right borders */
|
|
4
|
+
/** Toggles left and right borders, set to none when variant is subtle */
|
|
5
5
|
borders?: "default" | "full" | "none";
|
|
6
|
-
/** Renders the accordion heading in the style of a tertiary button */
|
|
6
|
+
/** (Deprecated) Renders the accordion heading in the style of a tertiary button */
|
|
7
7
|
buttonHeading?: boolean;
|
|
8
|
-
/** Sets background as white or transparent */
|
|
8
|
+
/** (Deprecated) Sets background as white or transparent, set to transparent when variant is subtle */
|
|
9
9
|
scheme?: "white" | "transparent";
|
|
10
10
|
/** Sets accordion width */
|
|
11
11
|
width?: string;
|
|
12
|
+
/** Sets accordion variant */
|
|
13
|
+
variant?: "standard" | "subtle";
|
|
12
14
|
}
|
|
13
15
|
declare const StyledAccordionContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionContainerProps, never>;
|
|
14
16
|
interface StyledAccordionTitleProps {
|
|
15
17
|
size?: "large" | "small";
|
|
18
|
+
variant?: "standard" | "subtle";
|
|
16
19
|
}
|
|
17
20
|
declare const StyledAccordionTitle: import("styled-components").StyledComponent<"h3", any, StyledAccordionTitleProps, never>;
|
|
18
21
|
declare const StyledAccordionSubTitle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -32,6 +35,8 @@ interface StyledAccordionTitleContainerProps {
|
|
|
32
35
|
hasButtonProps?: boolean;
|
|
33
36
|
iconAlign?: "left" | "right";
|
|
34
37
|
size?: "large" | "small";
|
|
38
|
+
isExpanded?: boolean;
|
|
39
|
+
variant?: "standard" | "subtle";
|
|
35
40
|
}
|
|
36
41
|
declare const StyledAccordionTitleContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionTitleContainerProps, never>;
|
|
37
42
|
export interface StyledAccordionContentContainerProps {
|
|
@@ -41,6 +46,7 @@ export interface StyledAccordionContentContainerProps {
|
|
|
41
46
|
declare const StyledAccordionContentContainer: import("styled-components").StyledComponent<"div", any, StyledAccordionContentContainerProps, never>;
|
|
42
47
|
export interface StyledAccordionContentProps {
|
|
43
48
|
disableContentPadding?: boolean;
|
|
49
|
+
variant?: "standard" | "subtle";
|
|
44
50
|
}
|
|
45
51
|
declare const StyledAccordionContent: import("styled-components").StyledComponent<"div", any, StyledAccordionContentProps, never>;
|
|
46
52
|
export { StyledAccordionGroup, StyledAccordionContainer, StyledAccordionHeadingsContainer, StyledAccordionSubTitle, StyledAccordionTitleContainer, StyledAccordionTitle, StyledAccordionIcon, StyledAccordionContent, StyledAccordionContentContainer, };
|
|
@@ -11,8 +11,9 @@ const StyledAccordionContainer = styled.div`
|
|
|
11
11
|
${space}
|
|
12
12
|
display: flex;
|
|
13
13
|
align-items: ${({
|
|
14
|
-
buttonHeading
|
|
15
|
-
|
|
14
|
+
buttonHeading,
|
|
15
|
+
variant
|
|
16
|
+
}) => buttonHeading || variant === "subtle" ? "flex-start" : "stretch"};
|
|
16
17
|
justify-content: center;
|
|
17
18
|
flex-direction: column;
|
|
18
19
|
box-sizing: border-box;
|
|
@@ -21,8 +22,9 @@ const StyledAccordionContainer = styled.div`
|
|
|
21
22
|
}) => width || "100%"};
|
|
22
23
|
color: var(--colorsUtilityYin090);
|
|
23
24
|
background-color: ${({
|
|
24
|
-
scheme
|
|
25
|
-
|
|
25
|
+
scheme,
|
|
26
|
+
variant
|
|
27
|
+
}) => scheme === "white" && variant !== "subtle" ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityMajorTransparent)"};
|
|
26
28
|
border: 1px solid var(--colorsUtilityMajor100);
|
|
27
29
|
${({
|
|
28
30
|
borders
|
|
@@ -36,19 +38,22 @@ const StyledAccordionContainer = styled.div`
|
|
|
36
38
|
border: none;
|
|
37
39
|
`}
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
${({
|
|
42
|
+
variant
|
|
43
|
+
}) => variant !== "subtle" && css`
|
|
44
|
+
& + & {
|
|
45
|
+
margin-top: -1px;
|
|
46
|
+
border-top: 1px solid var(--colorsUtilityMajor100);
|
|
47
|
+
border-bottom: 1px solid var(--colorsUtilityMajor100);
|
|
48
|
+
}
|
|
49
|
+
`}
|
|
44
50
|
`;
|
|
45
51
|
const StyledAccordionTitle = styled.h3`
|
|
46
52
|
font-size: ${({
|
|
47
|
-
size
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}) => size === "small" ? 700 : 900};
|
|
53
|
+
size,
|
|
54
|
+
variant
|
|
55
|
+
}) => size === "small" || variant === "subtle" ? "var(--fontSizes200)" : "var(--fontSizes400)"};
|
|
56
|
+
font-weight: 700;
|
|
52
57
|
line-height: 1;
|
|
53
58
|
user-select: none;
|
|
54
59
|
margin: 0;
|
|
@@ -58,15 +63,18 @@ const StyledAccordionSubTitle = styled.span`
|
|
|
58
63
|
`;
|
|
59
64
|
const StyledAccordionIcon = styled(Icon)`
|
|
60
65
|
transition: transform 0.3s;
|
|
66
|
+
transform: rotate(0deg);
|
|
61
67
|
margin-right: ${({
|
|
62
68
|
iconAlign
|
|
63
69
|
}) => iconAlign === "left" ? "var(--spacing200)" : "var(--spacing000)"};
|
|
70
|
+
|
|
64
71
|
${({
|
|
65
72
|
isExpanded,
|
|
66
73
|
iconAlign
|
|
67
74
|
}) => {
|
|
68
|
-
return
|
|
75
|
+
return isExpanded && (iconAlign === "right" ? "transform: rotate(180deg)" : "transform: rotate(-180deg)");
|
|
69
76
|
}};
|
|
77
|
+
|
|
70
78
|
color: var(--colorsActionMinor500);
|
|
71
79
|
`;
|
|
72
80
|
const StyledAccordionHeadingsContainer = styled.div`
|
|
@@ -104,7 +112,9 @@ const StyledAccordionTitleContainer = styled.div`
|
|
|
104
112
|
iconAlign,
|
|
105
113
|
size,
|
|
106
114
|
hasButtonProps,
|
|
107
|
-
theme
|
|
115
|
+
theme,
|
|
116
|
+
isExpanded,
|
|
117
|
+
variant
|
|
108
118
|
}) => css`
|
|
109
119
|
padding: ${size === "small" ? "var(--spacing200)" : "var(--spacing300)"};
|
|
110
120
|
${space}
|
|
@@ -124,7 +134,25 @@ const StyledAccordionTitleContainer = styled.div`
|
|
|
124
134
|
${!theme.focusRedesignOptOut ? addFocusStyling() : /* istanbul ignore next */oldFocusStyling}
|
|
125
135
|
}
|
|
126
136
|
|
|
127
|
-
${
|
|
137
|
+
${variant === "subtle" && css`
|
|
138
|
+
color: var(--colorsActionMajor500);
|
|
139
|
+
padding: var(--spacing025);
|
|
140
|
+
margin-bottom: ${isExpanded && "var(--spacing200)"};
|
|
141
|
+
|
|
142
|
+
${StyledAccordionIcon} {
|
|
143
|
+
color: var(--colorsActionMajor500);
|
|
144
|
+
${iconAlign === "left" && "margin-right: var(--spacing050)"};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:hover {
|
|
148
|
+
color: var(--colorsActionMajor600);
|
|
149
|
+
${StyledAccordionIcon} {
|
|
150
|
+
color: var(--colorsActionMajor600);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`}
|
|
154
|
+
|
|
155
|
+
${!buttonHeading && variant !== "subtle" && css`
|
|
128
156
|
&:hover {
|
|
129
157
|
background-color: var(--colorsUtilityMajor050);
|
|
130
158
|
}
|
|
@@ -185,7 +213,7 @@ const StyledAccordionContentContainer = styled.div`
|
|
|
185
213
|
`;
|
|
186
214
|
const StyledAccordionContent = styled.div`
|
|
187
215
|
padding: var(--spacing300);
|
|
188
|
-
padding-top:
|
|
216
|
+
padding-top: var(--spacing100);
|
|
189
217
|
overflow: hidden;
|
|
190
218
|
|
|
191
219
|
${({
|
|
@@ -193,6 +221,14 @@ const StyledAccordionContent = styled.div`
|
|
|
193
221
|
}) => disableContentPadding && css`
|
|
194
222
|
padding: 0;
|
|
195
223
|
`}
|
|
224
|
+
|
|
225
|
+
${({
|
|
226
|
+
variant
|
|
227
|
+
}) => variant === "subtle" && css`
|
|
228
|
+
margin-left: var(--spacing150);
|
|
229
|
+
padding: var(--spacing100) var(--spacing200) var(--spacing300);
|
|
230
|
+
border-left: 2px solid var(--colorsUtilityMajor100);
|
|
231
|
+
`}
|
|
196
232
|
`;
|
|
197
233
|
StyledAccordionGroup.defaultProps = {
|
|
198
234
|
theme: baseTheme
|
|
@@ -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)
|
|
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>;
|