carbon-react 147.4.3 → 147.6.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/components/fieldset/fieldset.component.js +9 -9
- package/esm/components/fieldset/fieldset.style.d.ts +5 -2
- package/esm/components/fieldset/fieldset.style.js +14 -11
- package/esm/components/multi-action-button/index.d.ts +1 -1
- package/esm/components/multi-action-button/multi-action-button.component.d.ts +5 -1
- package/esm/components/multi-action-button/multi-action-button.component.js +649 -4
- package/esm/components/split-button/index.d.ts +1 -1
- package/esm/components/split-button/split-button.component.d.ts +7 -1
- package/esm/components/split-button/split-button.component.js +556 -7
- package/lib/components/fieldset/fieldset.component.js +8 -8
- package/lib/components/fieldset/fieldset.style.d.ts +5 -2
- package/lib/components/fieldset/fieldset.style.js +14 -11
- package/lib/components/multi-action-button/index.d.ts +1 -1
- package/lib/components/multi-action-button/multi-action-button.component.d.ts +5 -1
- package/lib/components/multi-action-button/multi-action-button.component.js +647 -4
- package/lib/components/split-button/index.d.ts +1 -1
- package/lib/components/split-button/split-button.component.d.ts +7 -1
- package/lib/components/split-button/split-button.component.js +554 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useState, useEffect } from "react";
|
|
2
|
+
import React, { useState, useEffect, useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
5
5
|
import { FieldsetStyle, StyledLegend } from "./fieldset.style";
|
|
@@ -15,6 +15,9 @@ export const Fieldset = ({
|
|
|
15
15
|
}) => {
|
|
16
16
|
const [ref, setRef] = useState(null);
|
|
17
17
|
const marginProps = useFormSpacing(rest);
|
|
18
|
+
const {
|
|
19
|
+
validationRedesignOptIn
|
|
20
|
+
} = useContext(NewValidationContext);
|
|
18
21
|
useEffect(() => {
|
|
19
22
|
if (ref && required) {
|
|
20
23
|
Array.from(ref.querySelectorAll("input") || /* istanbul ignore next */[]).forEach(el => {
|
|
@@ -22,19 +25,16 @@ export const Fieldset = ({
|
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
27
|
}, [ref, required]);
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}, /*#__PURE__*/React.createElement(FieldsetStyle, _extends({
|
|
30
|
-
ref: setRef
|
|
28
|
+
return /*#__PURE__*/React.createElement(FieldsetStyle, _extends({
|
|
29
|
+
ref: setRef,
|
|
30
|
+
newValidation: validationRedesignOptIn
|
|
31
31
|
}, tagComponent("fieldset", rest), rest, marginProps), legend && /*#__PURE__*/React.createElement(StyledLegend, {
|
|
32
32
|
"data-element": "legend",
|
|
33
33
|
isRequired: required,
|
|
34
34
|
isOptional: isOptional
|
|
35
|
-
}, legend), /*#__PURE__*/React.createElement(FormSpacingProvider, {
|
|
35
|
+
}, legend), validationRedesignOptIn ? children : /*#__PURE__*/React.createElement(FormSpacingProvider, {
|
|
36
36
|
marginBottom: undefined
|
|
37
|
-
}, children))
|
|
37
|
+
}, children));
|
|
38
38
|
};
|
|
39
39
|
Fieldset.displayName = "Fieldset";
|
|
40
40
|
export default Fieldset;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export interface StyledFieldsetProps {
|
|
2
|
+
newValidation?: boolean;
|
|
3
|
+
}
|
|
4
|
+
declare const FieldsetStyle: import("styled-components").StyledComponent<"fieldset", any, StyledFieldsetProps, never>;
|
|
5
|
+
export interface StyledLegendProps {
|
|
2
6
|
/** Flag to configure fields as mandatory. */
|
|
3
7
|
isRequired?: boolean;
|
|
4
8
|
/** Flag to configure fields as optional. */
|
|
5
9
|
isOptional?: boolean;
|
|
6
10
|
}
|
|
7
|
-
declare const
|
|
8
|
-
declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledFieldsetProps, never>;
|
|
11
|
+
declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledLegendProps, never>;
|
|
9
12
|
export { FieldsetStyle, StyledLegend };
|
|
@@ -9,15 +9,19 @@ const FieldsetStyle = styled.fieldset`
|
|
|
9
9
|
border: none;
|
|
10
10
|
padding: 0;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
${({
|
|
13
|
+
newValidation
|
|
14
|
+
}) => !newValidation && css`
|
|
15
|
+
&&&& ${FormFieldStyle} {
|
|
16
|
+
margin-top: 0;
|
|
17
|
+
margin-bottom: -1px;
|
|
18
|
+
}
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
& ${CheckboxStyle} {
|
|
21
|
+
padding-top: 8px;
|
|
22
|
+
padding-bottom: 8px;
|
|
23
|
+
}
|
|
24
|
+
`}
|
|
21
25
|
`;
|
|
22
26
|
FieldsetStyle.defaultProps = {
|
|
23
27
|
theme: baseTheme
|
|
@@ -25,12 +29,11 @@ FieldsetStyle.defaultProps = {
|
|
|
25
29
|
const StyledLegend = styled.legend`
|
|
26
30
|
display: flex;
|
|
27
31
|
align-items: center;
|
|
28
|
-
margin-bottom:
|
|
29
|
-
font-size:
|
|
32
|
+
margin-bottom: var(--spacing250);
|
|
33
|
+
font-size: var(--fontSizes400);
|
|
30
34
|
font-weight: var(--fontWeights500);
|
|
31
35
|
color: var(--colorsUtilityYin090);
|
|
32
36
|
line-height: 24px;
|
|
33
|
-
margin-right: 4px;
|
|
34
37
|
|
|
35
38
|
${({
|
|
36
39
|
isRequired
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./multi-action-button.component";
|
|
2
|
-
export type { MultiActionButtonProps } from "./multi-action-button.component";
|
|
2
|
+
export type { MultiActionButtonHandle, MultiActionButtonProps, } from "./multi-action-button.component";
|
|
@@ -7,5 +7,9 @@ export interface MultiActionButtonProps extends WidthProps, Omit<SplitButtonProp
|
|
|
7
7
|
/** Second text child, renders under main text, only when size is "large" */
|
|
8
8
|
subtext?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare
|
|
10
|
+
export declare type MultiActionButtonHandle = {
|
|
11
|
+
/** Programmatically focus the main button */
|
|
12
|
+
focusMainButton: () => void;
|
|
13
|
+
} | null;
|
|
14
|
+
export declare const MultiActionButton: React.ForwardRefExoticComponent<MultiActionButtonProps & React.RefAttributes<MultiActionButtonHandle>>;
|
|
11
15
|
export default MultiActionButton;
|