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
|
@@ -49,9 +49,15 @@ export interface TypographyProps extends SpaceProps, TagProps {
|
|
|
49
49
|
/** Set whether it will be visually hidden
|
|
50
50
|
* NOTE: This is for screen readers only and will make a lot of the other props redundant */
|
|
51
51
|
screenReaderOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
* @ignore
|
|
55
|
+
* Override the default color of the rendered element to match disabled styling
|
|
56
|
+
* */
|
|
57
|
+
isDisabled?: boolean;
|
|
52
58
|
}
|
|
53
59
|
export declare const Typography: {
|
|
54
|
-
({ "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 }: TypographyProps): React.JSX.Element;
|
|
60
|
+
({ "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 }: TypographyProps): React.JSX.Element;
|
|
55
61
|
displayName: string;
|
|
56
62
|
};
|
|
57
63
|
export default Typography;
|
|
@@ -29,6 +29,7 @@ export const Typography = ({
|
|
|
29
29
|
children,
|
|
30
30
|
className,
|
|
31
31
|
screenReaderOnly,
|
|
32
|
+
isDisabled,
|
|
32
33
|
...rest
|
|
33
34
|
}) => {
|
|
34
35
|
return /*#__PURE__*/React.createElement(StyledTypography, _extends({
|
|
@@ -52,7 +53,8 @@ export const Typography = ({
|
|
|
52
53
|
bg: bg,
|
|
53
54
|
opacity: opacity,
|
|
54
55
|
className: className,
|
|
55
|
-
screenReaderOnly: screenReaderOnly
|
|
56
|
+
screenReaderOnly: screenReaderOnly,
|
|
57
|
+
isDisabled: isDisabled
|
|
56
58
|
}, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest)), children);
|
|
57
59
|
};
|
|
58
60
|
Typography.displayName = "Typography";
|
|
@@ -190,6 +190,11 @@ const StyledTypography = styled.span.attrs(({
|
|
|
190
190
|
backgroundColor,
|
|
191
191
|
...rest
|
|
192
192
|
})}
|
|
193
|
+
${({
|
|
194
|
+
isDisabled
|
|
195
|
+
}) => isDisabled && css`
|
|
196
|
+
color: var(--colorsUtilityYin030);
|
|
197
|
+
`}
|
|
193
198
|
`;
|
|
194
199
|
StyledTypography.defaultProps = {
|
|
195
200
|
theme: baseTheme
|
package/esm/global.d.ts
CHANGED
|
@@ -198,6 +198,14 @@ const plPL = {
|
|
|
198
198
|
tileSelect: {
|
|
199
199
|
deselect: () => "Odznacz"
|
|
200
200
|
},
|
|
201
|
+
time: {
|
|
202
|
+
amText: () => "AM",
|
|
203
|
+
pmText: () => "PM",
|
|
204
|
+
hoursLabelText: () => "Hrs.",
|
|
205
|
+
minutesLabelText: () => "Min.",
|
|
206
|
+
hoursAriaLabelText: () => "Godziny",
|
|
207
|
+
minutesAriaLabelText: () => "Minuty"
|
|
208
|
+
},
|
|
201
209
|
toast: {
|
|
202
210
|
ariaLabels: {
|
|
203
211
|
close: () => "Zamknij"
|
package/esm/locales/en-gb.js
CHANGED
|
@@ -163,6 +163,14 @@ const enGB = {
|
|
|
163
163
|
tileSelect: {
|
|
164
164
|
deselect: () => "Deselect"
|
|
165
165
|
},
|
|
166
|
+
time: {
|
|
167
|
+
amText: () => "AM",
|
|
168
|
+
pmText: () => "PM",
|
|
169
|
+
hoursLabelText: () => "Hrs.",
|
|
170
|
+
minutesLabelText: () => "Mins.",
|
|
171
|
+
hoursAriaLabelText: () => "Hours",
|
|
172
|
+
minutesAriaLabelText: () => "Minutes"
|
|
173
|
+
},
|
|
166
174
|
toast: {
|
|
167
175
|
ariaLabels: {
|
|
168
176
|
close: () => "Close"
|
package/esm/locales/locale.d.ts
CHANGED
|
@@ -138,6 +138,14 @@ interface Locale {
|
|
|
138
138
|
tileSelect: {
|
|
139
139
|
deselect: () => string;
|
|
140
140
|
};
|
|
141
|
+
time: {
|
|
142
|
+
amText: () => string;
|
|
143
|
+
pmText: () => string;
|
|
144
|
+
hoursLabelText: () => string;
|
|
145
|
+
minutesLabelText: () => string;
|
|
146
|
+
hoursAriaLabelText: () => string;
|
|
147
|
+
minutesAriaLabelText: () => string;
|
|
148
|
+
};
|
|
141
149
|
toast: {
|
|
142
150
|
ariaLabels: {
|
|
143
151
|
close: () => string;
|
|
@@ -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;
|
|
@@ -27,28 +27,44 @@ const Fieldset = ({
|
|
|
27
27
|
info,
|
|
28
28
|
isRequired,
|
|
29
29
|
blockGroupBehaviour,
|
|
30
|
+
legendMargin = {},
|
|
31
|
+
isDisabled,
|
|
32
|
+
isOptional,
|
|
30
33
|
...rest
|
|
31
34
|
}) => {
|
|
32
35
|
const {
|
|
33
36
|
validationRedesignOptIn
|
|
34
37
|
} = (0, _react.useContext)(_carbonProvider.NewValidationContext);
|
|
35
38
|
const marginProps = (0, _useFormSpacing.default)(rest);
|
|
39
|
+
const [ref, setRef] = (0, _react.useState)(null);
|
|
40
|
+
(0, _react.useEffect)(() => {
|
|
41
|
+
if (ref && isRequired) {
|
|
42
|
+
Array.from(ref.querySelectorAll("input") || /* istanbul ignore next */[]).forEach(el => {
|
|
43
|
+
el.setAttribute("required", "");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, [ref, isRequired]);
|
|
36
47
|
return /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupBehaviour, {
|
|
37
48
|
blockGroupBehaviour: blockGroupBehaviour
|
|
38
49
|
}, /*#__PURE__*/_react.default.createElement(_fieldset.StyledFieldset, _extends({
|
|
50
|
+
ref: setRef,
|
|
39
51
|
"data-component": "fieldset"
|
|
40
52
|
}, rest, marginProps), legend && /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputGroupContext.Consumer, null, ({
|
|
41
53
|
onMouseEnter,
|
|
42
54
|
onMouseLeave
|
|
43
|
-
}) => /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, {
|
|
55
|
+
}) => /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, _extends({
|
|
44
56
|
onMouseEnter: onMouseEnter,
|
|
45
57
|
onMouseLeave: onMouseLeave,
|
|
46
58
|
inline: inline,
|
|
47
59
|
width: legendWidth,
|
|
48
60
|
align: legendAlign,
|
|
49
61
|
rightPadding: legendSpacing
|
|
50
|
-
},
|
|
51
|
-
|
|
62
|
+
}, legendMargin, {
|
|
63
|
+
"data-element": "legend"
|
|
64
|
+
}), /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegendContent, {
|
|
65
|
+
isRequired: isRequired,
|
|
66
|
+
isOptional: isOptional,
|
|
67
|
+
isDisabled: isDisabled
|
|
52
68
|
}, legend, !validationRedesignOptIn && /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
|
|
53
69
|
error: error,
|
|
54
70
|
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 = {
|
|
@@ -17,6 +17,9 @@ const StyledFieldset = exports.StyledFieldset = _styledComponents.default.fields
|
|
|
17
17
|
padding: 0;
|
|
18
18
|
min-width: 0;
|
|
19
19
|
min-inline-size: 0;
|
|
20
|
+
${({
|
|
21
|
+
width
|
|
22
|
+
}) => width && `width: ${width};`}
|
|
20
23
|
`;
|
|
21
24
|
StyledFieldset.defaultProps = {
|
|
22
25
|
theme: _base.default
|
|
@@ -34,13 +37,35 @@ const StyledLegendContent = exports.StyledLegendContent = _styledComponents.defa
|
|
|
34
37
|
color: var(--colorsSemanticNegative500);
|
|
35
38
|
font-weight: 700;
|
|
36
39
|
margin-left: var(--spacing100);
|
|
40
|
+
position: relative;
|
|
41
|
+
top: 1px;
|
|
42
|
+
left: -4px;
|
|
43
|
+
}
|
|
44
|
+
`}
|
|
45
|
+
|
|
46
|
+
${({
|
|
47
|
+
isOptional
|
|
48
|
+
}) => isOptional && (0, _styledComponents.css)`
|
|
49
|
+
::after {
|
|
50
|
+
content: "(optional)";
|
|
51
|
+
font-weight: 350; //TODO: (tokens) use token var(--fontWeights400) - FE-6022
|
|
52
|
+
margin-left: 4px;
|
|
53
|
+
}
|
|
54
|
+
`}
|
|
55
|
+
|
|
56
|
+
${({
|
|
57
|
+
isDisabled
|
|
58
|
+
}) => isDisabled && (0, _styledComponents.css)`
|
|
59
|
+
color: var(--colorsUtilityYin030);
|
|
60
|
+
::after {
|
|
61
|
+
color: var(--colorsUtilityYin030);
|
|
37
62
|
}
|
|
38
63
|
`}
|
|
39
64
|
`;
|
|
40
65
|
const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
|
|
41
66
|
display: flex;
|
|
42
67
|
align-items: center;
|
|
43
|
-
margin-bottom:
|
|
68
|
+
margin-bottom: var(--spacing100);
|
|
44
69
|
padding: 0;
|
|
45
70
|
font-weight: 600;
|
|
46
71
|
${({
|
|
@@ -56,4 +81,5 @@ const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
|
|
|
56
81
|
justify-content: ${align === "right" ? "flex-end" : "flex-start"};
|
|
57
82
|
padding-right: ${rightPadding === 1 ? "var(--spacing100)" : "var(--spacing200)"};
|
|
58
83
|
`}
|
|
84
|
+
${_styledSystem.margin}
|
|
59
85
|
`;
|
|
@@ -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;
|
|
@@ -52,7 +52,9 @@ const Label = ({
|
|
|
52
52
|
useValidationIcon = true,
|
|
53
53
|
validationIconId,
|
|
54
54
|
warning,
|
|
55
|
-
width = 30
|
|
55
|
+
width = 30,
|
|
56
|
+
className,
|
|
57
|
+
"aria-label": ariaLabel
|
|
56
58
|
}) => {
|
|
57
59
|
const [isFocused, setFocus] = (0, _react.useState)(false);
|
|
58
60
|
const {
|
|
@@ -109,7 +111,8 @@ const Label = ({
|
|
|
109
111
|
width: width,
|
|
110
112
|
optional: optional,
|
|
111
113
|
pr: pr,
|
|
112
|
-
pl: pl
|
|
114
|
+
pl: pl,
|
|
115
|
+
className: className
|
|
113
116
|
}, /*#__PURE__*/_react.default.createElement(_label.default, _extends({
|
|
114
117
|
"data-element": "label",
|
|
115
118
|
disabled: disabled,
|
|
@@ -120,7 +123,8 @@ const Label = ({
|
|
|
120
123
|
onMouseEnter: handleMouseEnter,
|
|
121
124
|
onMouseLeave: handleMouseLeave,
|
|
122
125
|
isRequired: isRequired,
|
|
123
|
-
as: as
|
|
126
|
+
as: as,
|
|
127
|
+
"aria-label": ariaLabel
|
|
124
128
|
}), children), icon());
|
|
125
129
|
};
|
|
126
130
|
exports.Label = 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;
|
|
@@ -9,12 +9,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
10
10
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
11
11
|
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events"));
|
|
12
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
12
13
|
var _accordion = require("./accordion.style");
|
|
13
14
|
var _validations = _interopRequireDefault(require("../../__internal__/validations"));
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
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); }
|
|
16
17
|
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; }
|
|
17
18
|
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); }
|
|
19
|
+
let deprecatedSchemeWarnTriggered = false;
|
|
20
|
+
let deprecatedButtonHeadingWarnTriggered = false;
|
|
18
21
|
const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
19
22
|
borders = "default",
|
|
20
23
|
defaultExpanded,
|
|
@@ -24,8 +27,8 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
24
27
|
handleKeyboardAccessibility,
|
|
25
28
|
id,
|
|
26
29
|
index,
|
|
27
|
-
iconType
|
|
28
|
-
iconAlign
|
|
30
|
+
iconType,
|
|
31
|
+
iconAlign,
|
|
29
32
|
scheme = "white",
|
|
30
33
|
size = "large",
|
|
31
34
|
subTitle,
|
|
@@ -39,8 +42,17 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
39
42
|
buttonHeading,
|
|
40
43
|
buttonWidth = "150px",
|
|
41
44
|
openTitle,
|
|
45
|
+
variant = "standard",
|
|
42
46
|
...rest
|
|
43
47
|
}, ref) => {
|
|
48
|
+
if (!deprecatedSchemeWarnTriggered && scheme === "transparent") {
|
|
49
|
+
deprecatedSchemeWarnTriggered = true;
|
|
50
|
+
_logger.default.deprecate("The `scheme` prop for `Accordion` component is deprecated and will soon be removed.");
|
|
51
|
+
}
|
|
52
|
+
if (!deprecatedButtonHeadingWarnTriggered && buttonHeading) {
|
|
53
|
+
deprecatedButtonHeadingWarnTriggered = true;
|
|
54
|
+
_logger.default.deprecate("The `buttonHeading` prop for `Accordion` component is deprecated and will soon be removed. Please use `subtle` variant instead.");
|
|
55
|
+
}
|
|
44
56
|
const isControlled = expanded !== undefined;
|
|
45
57
|
const [isExpandedInternal, setIsExpandedInternal] = (0, _react.useState)(defaultExpanded || false);
|
|
46
58
|
const [contentHeight, setContentHeight] = (0, _react.useState)(isExpandedInternal ? "auto" : 0);
|
|
@@ -72,13 +84,15 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
72
84
|
const contentId = `AccordionContent_${guid.current}`;
|
|
73
85
|
const showValidationIcon = !!(error || warning || info);
|
|
74
86
|
const getTitle = () => isExpanded ? openTitle || title : title;
|
|
87
|
+
const getIconType = () => size === "small" || variant === "subtle" ? "chevron_down_thick" : "chevron_down";
|
|
75
88
|
return /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionContainer, _extends({
|
|
76
89
|
id: accordionId,
|
|
77
90
|
"data-component": "accordion",
|
|
78
91
|
width: width,
|
|
79
|
-
borders: borders,
|
|
92
|
+
borders: variant === "subtle" ? "none" : borders,
|
|
80
93
|
scheme: scheme,
|
|
81
|
-
buttonHeading: buttonHeading
|
|
94
|
+
buttonHeading: buttonHeading,
|
|
95
|
+
variant: variant
|
|
82
96
|
}, rest), /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionTitleContainer, _extends({
|
|
83
97
|
"data-element": "accordion-title-container",
|
|
84
98
|
id: headerId,
|
|
@@ -87,10 +101,12 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
87
101
|
onClick: toggleAccordion,
|
|
88
102
|
onKeyDown: handleKeyDown,
|
|
89
103
|
tabIndex: 0,
|
|
90
|
-
iconAlign: iconAlign,
|
|
104
|
+
iconAlign: iconAlign || (variant === "standard" ? "right" : "left"),
|
|
91
105
|
ref: ref,
|
|
92
106
|
size: size,
|
|
93
107
|
buttonHeading: buttonHeading,
|
|
108
|
+
isExpanded: isExpanded,
|
|
109
|
+
variant: variant,
|
|
94
110
|
buttonWidth: buttonWidth,
|
|
95
111
|
hasButtonProps: buttonHeading && !(typeof headerSpacing === "undefined"),
|
|
96
112
|
role: "button"
|
|
@@ -102,19 +118,20 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
102
118
|
buttonHeading: buttonHeading
|
|
103
119
|
}, !buttonHeading && typeof title === "string" ? /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionTitle, {
|
|
104
120
|
"data-element": "accordion-title",
|
|
105
|
-
size: size
|
|
106
|
-
|
|
121
|
+
size: size,
|
|
122
|
+
variant: variant
|
|
123
|
+
}, title) : getTitle(), !buttonHeading && variant !== "subtle" && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showValidationIcon && /*#__PURE__*/_react.default.createElement(_validations.default, {
|
|
107
124
|
error: error,
|
|
108
125
|
warning: warning,
|
|
109
126
|
info: info,
|
|
110
127
|
tooltipPosition: "top",
|
|
111
128
|
tabIndex: 0,
|
|
112
129
|
ml: 1
|
|
113
|
-
}), subTitle && size === "large" && /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionSubTitle, null, subTitle))), /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionIcon, {
|
|
130
|
+
}), subTitle && size === "large" && variant === "standard" && /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionSubTitle, null, subTitle))), /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionIcon, {
|
|
114
131
|
"data-element": "accordion-icon",
|
|
115
|
-
type: iconType,
|
|
132
|
+
type: iconType || getIconType(),
|
|
116
133
|
isExpanded: isExpanded,
|
|
117
|
-
iconAlign: iconAlign
|
|
134
|
+
iconAlign: iconAlign || (variant === "standard" ? "right" : "left")
|
|
118
135
|
})), /*#__PURE__*/_react.default.createElement(_accordion.StyledAccordionContentContainer, {
|
|
119
136
|
isExpanded: isExpanded,
|
|
120
137
|
maxHeight: contentHeight
|
|
@@ -124,7 +141,8 @@ const Accordion = exports.Accordion = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
124
141
|
id: contentId,
|
|
125
142
|
"aria-labelledby": headerId,
|
|
126
143
|
ref: accordionContent,
|
|
127
|
-
disableContentPadding: disableContentPadding
|
|
144
|
+
disableContentPadding: disableContentPadding,
|
|
145
|
+
variant: variant
|
|
128
146
|
}, children)));
|
|
129
147
|
});
|
|
130
148
|
Accordion.propTypes = {
|
|
@@ -448,7 +466,7 @@ Accordion.propTypes = {
|
|
|
448
466
|
}), _propTypes.default.string])
|
|
449
467
|
}),
|
|
450
468
|
"iconAlign": _propTypes.default.oneOf(["left", "right"]),
|
|
451
|
-
"iconType": _propTypes.default.oneOf(["chevron_down", "dropdown"]),
|
|
469
|
+
"iconType": _propTypes.default.oneOf(["chevron_down_thick", "chevron_down", "dropdown"]),
|
|
452
470
|
"id": _propTypes.default.string,
|
|
453
471
|
"index": _propTypes.default.number,
|
|
454
472
|
"info": _propTypes.default.string,
|
|
@@ -766,6 +784,7 @@ Accordion.propTypes = {
|
|
|
766
784
|
"size": _propTypes.default.oneOf(["large", "small"]),
|
|
767
785
|
"subTitle": _propTypes.default.string,
|
|
768
786
|
"title": _propTypes.default.node,
|
|
787
|
+
"variant": _propTypes.default.oneOf(["standard", "subtle"]),
|
|
769
788
|
"warning": _propTypes.default.string,
|
|
770
789
|
"width": _propTypes.default.string
|
|
771
790
|
};
|
|
@@ -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, };
|
|
@@ -20,8 +20,9 @@ const StyledAccordionContainer = exports.StyledAccordionContainer = _styledCompo
|
|
|
20
20
|
${_styledSystem.space}
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: ${({
|
|
23
|
-
buttonHeading
|
|
24
|
-
|
|
23
|
+
buttonHeading,
|
|
24
|
+
variant
|
|
25
|
+
}) => buttonHeading || variant === "subtle" ? "flex-start" : "stretch"};
|
|
25
26
|
justify-content: center;
|
|
26
27
|
flex-direction: column;
|
|
27
28
|
box-sizing: border-box;
|
|
@@ -30,8 +31,9 @@ const StyledAccordionContainer = exports.StyledAccordionContainer = _styledCompo
|
|
|
30
31
|
}) => width || "100%"};
|
|
31
32
|
color: var(--colorsUtilityYin090);
|
|
32
33
|
background-color: ${({
|
|
33
|
-
scheme
|
|
34
|
-
|
|
34
|
+
scheme,
|
|
35
|
+
variant
|
|
36
|
+
}) => scheme === "white" && variant !== "subtle" ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityMajorTransparent)"};
|
|
35
37
|
border: 1px solid var(--colorsUtilityMajor100);
|
|
36
38
|
${({
|
|
37
39
|
borders
|
|
@@ -45,19 +47,22 @@ const StyledAccordionContainer = exports.StyledAccordionContainer = _styledCompo
|
|
|
45
47
|
border: none;
|
|
46
48
|
`}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
${({
|
|
51
|
+
variant
|
|
52
|
+
}) => variant !== "subtle" && (0, _styledComponents.css)`
|
|
53
|
+
& + & {
|
|
54
|
+
margin-top: -1px;
|
|
55
|
+
border-top: 1px solid var(--colorsUtilityMajor100);
|
|
56
|
+
border-bottom: 1px solid var(--colorsUtilityMajor100);
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
53
59
|
`;
|
|
54
60
|
const StyledAccordionTitle = exports.StyledAccordionTitle = _styledComponents.default.h3`
|
|
55
61
|
font-size: ${({
|
|
56
|
-
size
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}) => size === "small" ? 700 : 900};
|
|
62
|
+
size,
|
|
63
|
+
variant
|
|
64
|
+
}) => size === "small" || variant === "subtle" ? "var(--fontSizes200)" : "var(--fontSizes400)"};
|
|
65
|
+
font-weight: 700;
|
|
61
66
|
line-height: 1;
|
|
62
67
|
user-select: none;
|
|
63
68
|
margin: 0;
|
|
@@ -67,15 +72,18 @@ const StyledAccordionSubTitle = exports.StyledAccordionSubTitle = _styledCompone
|
|
|
67
72
|
`;
|
|
68
73
|
const StyledAccordionIcon = exports.StyledAccordionIcon = (0, _styledComponents.default)(_icon.default)`
|
|
69
74
|
transition: transform 0.3s;
|
|
75
|
+
transform: rotate(0deg);
|
|
70
76
|
margin-right: ${({
|
|
71
77
|
iconAlign
|
|
72
78
|
}) => iconAlign === "left" ? "var(--spacing200)" : "var(--spacing000)"};
|
|
79
|
+
|
|
73
80
|
${({
|
|
74
81
|
isExpanded,
|
|
75
82
|
iconAlign
|
|
76
83
|
}) => {
|
|
77
|
-
return
|
|
84
|
+
return isExpanded && (iconAlign === "right" ? "transform: rotate(180deg)" : "transform: rotate(-180deg)");
|
|
78
85
|
}};
|
|
86
|
+
|
|
79
87
|
color: var(--colorsActionMinor500);
|
|
80
88
|
`;
|
|
81
89
|
const StyledAccordionHeadingsContainer = exports.StyledAccordionHeadingsContainer = _styledComponents.default.div`
|
|
@@ -113,7 +121,9 @@ const StyledAccordionTitleContainer = exports.StyledAccordionTitleContainer = _s
|
|
|
113
121
|
iconAlign,
|
|
114
122
|
size,
|
|
115
123
|
hasButtonProps,
|
|
116
|
-
theme
|
|
124
|
+
theme,
|
|
125
|
+
isExpanded,
|
|
126
|
+
variant
|
|
117
127
|
}) => (0, _styledComponents.css)`
|
|
118
128
|
padding: ${size === "small" ? "var(--spacing200)" : "var(--spacing300)"};
|
|
119
129
|
${_styledSystem.space}
|
|
@@ -133,7 +143,25 @@ const StyledAccordionTitleContainer = exports.StyledAccordionTitleContainer = _s
|
|
|
133
143
|
${!theme.focusRedesignOptOut ? (0, _addFocusStyling.default)() : /* istanbul ignore next */oldFocusStyling}
|
|
134
144
|
}
|
|
135
145
|
|
|
136
|
-
${
|
|
146
|
+
${variant === "subtle" && (0, _styledComponents.css)`
|
|
147
|
+
color: var(--colorsActionMajor500);
|
|
148
|
+
padding: var(--spacing025);
|
|
149
|
+
margin-bottom: ${isExpanded && "var(--spacing200)"};
|
|
150
|
+
|
|
151
|
+
${StyledAccordionIcon} {
|
|
152
|
+
color: var(--colorsActionMajor500);
|
|
153
|
+
${iconAlign === "left" && "margin-right: var(--spacing050)"};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:hover {
|
|
157
|
+
color: var(--colorsActionMajor600);
|
|
158
|
+
${StyledAccordionIcon} {
|
|
159
|
+
color: var(--colorsActionMajor600);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`}
|
|
163
|
+
|
|
164
|
+
${!buttonHeading && variant !== "subtle" && (0, _styledComponents.css)`
|
|
137
165
|
&:hover {
|
|
138
166
|
background-color: var(--colorsUtilityMajor050);
|
|
139
167
|
}
|
|
@@ -194,7 +222,7 @@ const StyledAccordionContentContainer = exports.StyledAccordionContentContainer
|
|
|
194
222
|
`;
|
|
195
223
|
const StyledAccordionContent = exports.StyledAccordionContent = _styledComponents.default.div`
|
|
196
224
|
padding: var(--spacing300);
|
|
197
|
-
padding-top:
|
|
225
|
+
padding-top: var(--spacing100);
|
|
198
226
|
overflow: hidden;
|
|
199
227
|
|
|
200
228
|
${({
|
|
@@ -202,6 +230,14 @@ const StyledAccordionContent = exports.StyledAccordionContent = _styledComponent
|
|
|
202
230
|
}) => disableContentPadding && (0, _styledComponents.css)`
|
|
203
231
|
padding: 0;
|
|
204
232
|
`}
|
|
233
|
+
|
|
234
|
+
${({
|
|
235
|
+
variant
|
|
236
|
+
}) => variant === "subtle" && (0, _styledComponents.css)`
|
|
237
|
+
margin-left: var(--spacing150);
|
|
238
|
+
padding: var(--spacing100) var(--spacing200) var(--spacing300);
|
|
239
|
+
border-left: 2px solid var(--colorsUtilityMajor100);
|
|
240
|
+
`}
|
|
205
241
|
`;
|
|
206
242
|
StyledAccordionGroup.defaultProps = {
|
|
207
243
|
theme: _themes.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;
|
|
@@ -31,6 +31,7 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
31
31
|
borderRadius,
|
|
32
32
|
color,
|
|
33
33
|
opacity,
|
|
34
|
+
"aria-hidden": ariaHidden,
|
|
34
35
|
...rest
|
|
35
36
|
}, ref) => {
|
|
36
37
|
return /*#__PURE__*/_react.default.createElement(_box.default, _extends({
|
|
@@ -51,7 +52,8 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
51
52
|
boxShadow: boxShadow,
|
|
52
53
|
borderRadius: borderRadius,
|
|
53
54
|
color: color,
|
|
54
|
-
opacity: opacity
|
|
55
|
+
opacity: opacity,
|
|
56
|
+
"aria-hidden": ariaHidden
|
|
55
57
|
}, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest), (0, _utils.filterStyledSystemFlexboxProps)(rest), (0, _utils.filterStyledSystemGridProps)(rest), (0, _utils.filterStyledSystemLayoutProps)(rest)), children);
|
|
56
58
|
});
|
|
57
59
|
Box.propTypes = {
|
|
@@ -358,6 +360,7 @@ Box.propTypes = {
|
|
|
358
360
|
"trimStart": _propTypes.default.func.isRequired,
|
|
359
361
|
"valueOf": _propTypes.default.func.isRequired
|
|
360
362
|
})]),
|
|
363
|
+
"aria-hidden": _propTypes.default.oneOf(["false", "true"]),
|
|
361
364
|
"as": _propTypes.default.oneOfType([_propTypes.default.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.default.func, _propTypes.default.shape({
|
|
362
365
|
"childContextTypes": _propTypes.default.object,
|
|
363
366
|
"contextType": _propTypes.default.shape({
|