carbon-react 130.0.0 → 131.0.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.
@@ -1,11 +1,9 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface FieldsetProps extends MarginProps {
4
- /** When true, legend is placed in line with the children */
5
- inline?: boolean;
6
4
  /** Child elements */
7
5
  children?: React.ReactNode;
8
- /** The text for the fieldsets legend element. */
6
+ /** The text for the fieldset's legend element. */
9
7
  legend?: string;
10
8
  /** Flag to configure fields as mandatory. */
11
9
  required?: boolean;
@@ -13,7 +11,7 @@ export interface FieldsetProps extends MarginProps {
13
11
  isOptional?: boolean;
14
12
  }
15
13
  export declare const Fieldset: {
16
- ({ children, inline, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
14
+ ({ children, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
17
15
  displayName: string;
18
16
  };
19
17
  export default Fieldset;
@@ -2,30 +2,18 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React, { useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
5
- import { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle } from "./fieldset.style";
5
+ import { FieldsetStyle, StyledLegend } from "./fieldset.style";
6
6
  import { NewValidationContext } from "../carbon-provider/carbon-provider.component";
7
7
  import FormSpacingProvider from "../../__internal__/form-spacing-provider";
8
8
  import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
9
9
  export const Fieldset = ({
10
10
  children,
11
- inline = false,
12
11
  legend,
13
12
  required,
14
13
  isOptional,
15
14
  ...rest
16
15
  }) => {
17
16
  const [ref, setRef] = useState(null);
18
- const getLegend = () => {
19
- if (!legend) return null;
20
- return /*#__PURE__*/React.createElement(LegendContainerStyle, {
21
- isRequired: required,
22
- isOptional: isOptional,
23
- inline: inline,
24
- "data-component": "legend-style"
25
- }, /*#__PURE__*/React.createElement("legend", {
26
- "data-element": "legend"
27
- }, legend));
28
- };
29
17
  const marginProps = useFormSpacing(rest);
30
18
  useEffect(() => {
31
19
  if (ref && required) {
@@ -40,12 +28,13 @@ export const Fieldset = ({
40
28
  }
41
29
  }, /*#__PURE__*/React.createElement(FieldsetStyle, _extends({
42
30
  ref: setRef
43
- }, tagComponent("fieldset", rest), rest, marginProps), /*#__PURE__*/React.createElement(FieldsetContentStyle, {
44
- "data-component": "fieldset-style",
45
- inline: inline
46
- }, getLegend(), /*#__PURE__*/React.createElement(FormSpacingProvider, {
31
+ }, tagComponent("fieldset", rest), rest, marginProps), legend && /*#__PURE__*/React.createElement(StyledLegend, {
32
+ "data-element": "legend",
33
+ isRequired: required,
34
+ isOptional: isOptional
35
+ }, legend), /*#__PURE__*/React.createElement(FormSpacingProvider, {
47
36
  marginBottom: undefined
48
- }, children))));
37
+ }, children)));
49
38
  };
50
39
  Fieldset.displayName = "Fieldset";
51
40
  export default Fieldset;
@@ -1,12 +1,9 @@
1
1
  export interface StyledFieldsetProps {
2
- /** When true, legend is placed in line with the children */
3
- inline?: boolean;
4
2
  /** Flag to configure fields as mandatory. */
5
3
  isRequired?: boolean;
6
4
  /** Flag to configure fields as optional. */
7
5
  isOptional?: boolean;
8
6
  }
9
7
  declare const FieldsetStyle: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
10
- declare const LegendContainerStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
11
- declare const FieldsetContentStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
12
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
8
+ declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledFieldsetProps, never>;
9
+ export { FieldsetStyle, StyledLegend };
@@ -1,8 +1,6 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import FormFieldStyle from "../../__internal__/form-field/form-field.style";
4
- import ValidationIconStyle from "../../__internal__/validations/validation-icon.style";
5
- import StyledIcon from "../icon/icon.style";
6
4
  import baseTheme from "../../style/themes/base";
7
5
  import CheckboxStyle from "../checkbox/checkbox.style";
8
6
  const FieldsetStyle = styled.fieldset`
@@ -24,58 +22,40 @@ const FieldsetStyle = styled.fieldset`
24
22
  FieldsetStyle.defaultProps = {
25
23
  theme: baseTheme
26
24
  };
27
- const LegendContainerStyle = styled.div`
28
- ${({
29
- inline
30
- }) => inline && `
31
- margin-right: 32px;
32
- height: 34px !important;
33
- `}
25
+ const StyledLegend = styled.legend`
34
26
  display: flex;
35
27
  align-items: center;
36
28
  margin-bottom: 32px;
29
+ font-size: 20px;
30
+ font-weight: var(--fontWeights700);
31
+ color: var(--colorsUtilityYin090);
32
+ line-height: 24px;
33
+ margin-right: 4px;
37
34
 
38
- legend {
39
- font-size: 20px;
40
- font-weight: var(--fontWeights700);
41
- color: var(--colorsUtilityYin090);
42
- line-height: 24px;
43
- margin-right: 4px;
44
-
45
- ${({
35
+ ${({
46
36
  isRequired
47
37
  }) => isRequired && css`
48
- ::after {
49
- content: "*";
50
- line-height: 24px;
51
- color: var(--colorsSemanticNegative500);
52
- font-weight: var(--fontWeights700);
53
- margin-left: var(--spacing100);
54
- position: relative;
55
- top: 1px;
56
- left: -4px;
57
- }
58
- `}
38
+ ::after {
39
+ content: "*";
40
+ line-height: 24px;
41
+ color: var(--colorsSemanticNegative500);
42
+ font-weight: var(--fontWeights700);
43
+ margin-left: var(--spacing100);
44
+ position: relative;
45
+ top: 1px;
46
+ left: -4px;
47
+ }
48
+ `}
59
49
 
60
- ${({
50
+ ${({
61
51
  isOptional
62
52
  }) => isOptional && css`
63
- ::after {
64
- content: "(optional)";
65
- color: var(--colorsUtilityYin055);
66
- font-weight: var(--fontWeights400);
67
- margin-left: var(--spacing050);
68
- }
69
- `}
70
- }
71
-
72
- ${ValidationIconStyle} ${StyledIcon}:focus {
73
- outline: 2px solid #ffb500;
74
- }
75
- `;
76
- const FieldsetContentStyle = styled.div`
77
- ${({
78
- inline
79
- }) => inline && "display: flex;"}
53
+ ::after {
54
+ content: "(optional)";
55
+ color: var(--colorsUtilityYin055);
56
+ font-weight: var(--fontWeights400);
57
+ margin-left: var(--spacing050);
58
+ }
59
+ `}
80
60
  `;
81
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
61
+ export { FieldsetStyle, StyledLegend };
@@ -38,8 +38,8 @@ export const TileSelectGroup = ({
38
38
  legend: legend
39
39
  }, tagComponent("tile-select-group", rest), {
40
40
  multiSelect: multiSelect
41
- }, filterStyledSystemMarginProps(rest)), description ? /*#__PURE__*/React.createElement(StyledGroupDescription, {
41
+ }, filterStyledSystemMarginProps(rest)), description && /*#__PURE__*/React.createElement(StyledGroupDescription, {
42
42
  "data-element": "tile-select-group-description"
43
- }, description) : null, /*#__PURE__*/React.createElement("div", null, tiles));
43
+ }, description), tiles);
44
44
  };
45
45
  export default TileSelectGroup;
@@ -105,7 +105,7 @@ const TileSelect = /*#__PURE__*/React.forwardRef(({
105
105
  as: checkPropTypeIsNode(subtitle) ? "div" : undefined
106
106
  }, subtitle), titleAdornment && /*#__PURE__*/React.createElement(StyledAdornment, {
107
107
  hasAdditionalInformation: !!additionalInformation
108
- }, titleAdornment)), additionalInformation && /*#__PURE__*/React.createElement("div", null, additionalInformation), /*#__PURE__*/React.createElement(StyledDescription, {
108
+ }, titleAdornment && /*#__PURE__*/React.createElement("div", null, titleAdornment))), additionalInformation && /*#__PURE__*/React.createElement("div", null, additionalInformation), /*#__PURE__*/React.createElement(StyledDescription, {
109
109
  as: checkPropTypeIsNode(description) ? "div" : undefined
110
110
  }, description), footer && /*#__PURE__*/React.createElement(StyledFooterWrapper, null, footer), accordionContent && accordionControl && /*#__PURE__*/React.createElement(StyledAccordionFooterWrapper, {
111
111
  accordionExpanded: accordionExpanded
@@ -28,7 +28,7 @@ declare const StyledDeselectWrapper: import("styled-components").StyledComponent
28
28
  hasActionAdornment: boolean;
29
29
  }, never>;
30
30
  declare const StyledTileSelectFieldset: import("styled-components").StyledComponent<{
31
- ({ children, inline, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
31
+ ({ children, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
32
32
  displayName: string;
33
33
  }, any, {
34
34
  multiSelect: boolean;
@@ -2,7 +2,7 @@ import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import Fieldset from "../fieldset";
4
4
  import { Input } from "../../__internal__/input";
5
- import { LegendContainerStyle } from "../fieldset/fieldset.style";
5
+ import { StyledLegend } from "../fieldset/fieldset.style";
6
6
  import StyledIcon from "../icon/icon.style";
7
7
  import { baseTheme } from "../../style/themes";
8
8
  import addFocusStyling from "../../style/utils/add-focus-styling";
@@ -166,13 +166,11 @@ const StyledDeselectWrapper = styled.div`
166
166
  const StyledTileSelectFieldset = styled(Fieldset)`
167
167
  ${margin}
168
168
 
169
- ${LegendContainerStyle} {
169
+ ${StyledLegend} {
170
170
  margin-bottom: 16px;
171
- legend {
172
- font-size: 16px;
173
- line-height: 16px;
174
- margin-left: -2px;
175
- }
171
+ font-size: 16px;
172
+ line-height: 16px;
173
+ margin-left: -2px;
176
174
  }
177
175
  ${({
178
176
  multiSelect
@@ -1,11 +1,9 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface FieldsetProps extends MarginProps {
4
- /** When true, legend is placed in line with the children */
5
- inline?: boolean;
6
4
  /** Child elements */
7
5
  children?: React.ReactNode;
8
- /** The text for the fieldsets legend element. */
6
+ /** The text for the fieldset's legend element. */
9
7
  legend?: string;
10
8
  /** Flag to configure fields as mandatory. */
11
9
  required?: boolean;
@@ -13,7 +11,7 @@ export interface FieldsetProps extends MarginProps {
13
11
  isOptional?: boolean;
14
12
  }
15
13
  export declare const Fieldset: {
16
- ({ children, inline, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
14
+ ({ children, legend, required, isOptional, ...rest }: FieldsetProps): React.JSX.Element;
17
15
  displayName: string;
18
16
  };
19
17
  export default Fieldset;
@@ -17,24 +17,12 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
17
  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); }
18
18
  const Fieldset = ({
19
19
  children,
20
- inline = false,
21
20
  legend,
22
21
  required,
23
22
  isOptional,
24
23
  ...rest
25
24
  }) => {
26
25
  const [ref, setRef] = (0, _react.useState)(null);
27
- const getLegend = () => {
28
- if (!legend) return null;
29
- return /*#__PURE__*/_react.default.createElement(_fieldset.LegendContainerStyle, {
30
- isRequired: required,
31
- isOptional: isOptional,
32
- inline: inline,
33
- "data-component": "legend-style"
34
- }, /*#__PURE__*/_react.default.createElement("legend", {
35
- "data-element": "legend"
36
- }, legend));
37
- };
38
26
  const marginProps = (0, _useFormSpacing.default)(rest);
39
27
  (0, _react.useEffect)(() => {
40
28
  if (ref && required) {
@@ -49,12 +37,13 @@ const Fieldset = ({
49
37
  }
50
38
  }, /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetStyle, _extends({
51
39
  ref: setRef
52
- }, (0, _tags.default)("fieldset", rest), rest, marginProps), /*#__PURE__*/_react.default.createElement(_fieldset.FieldsetContentStyle, {
53
- "data-component": "fieldset-style",
54
- inline: inline
55
- }, getLegend(), /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
40
+ }, (0, _tags.default)("fieldset", rest), rest, marginProps), legend && /*#__PURE__*/_react.default.createElement(_fieldset.StyledLegend, {
41
+ "data-element": "legend",
42
+ isRequired: required,
43
+ isOptional: isOptional
44
+ }, legend), /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
56
45
  marginBottom: undefined
57
- }, children))));
46
+ }, children)));
58
47
  };
59
48
  exports.Fieldset = Fieldset;
60
49
  Fieldset.displayName = "Fieldset";
@@ -1,12 +1,9 @@
1
1
  export interface StyledFieldsetProps {
2
- /** When true, legend is placed in line with the children */
3
- inline?: boolean;
4
2
  /** Flag to configure fields as mandatory. */
5
3
  isRequired?: boolean;
6
4
  /** Flag to configure fields as optional. */
7
5
  isOptional?: boolean;
8
6
  }
9
7
  declare const FieldsetStyle: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
10
- declare const LegendContainerStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
11
- declare const FieldsetContentStyle: import("styled-components").StyledComponent<"div", any, StyledFieldsetProps, never>;
12
- export { FieldsetStyle, LegendContainerStyle, FieldsetContentStyle };
8
+ declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, StyledFieldsetProps, never>;
9
+ export { FieldsetStyle, StyledLegend };
@@ -3,12 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.LegendContainerStyle = exports.FieldsetStyle = exports.FieldsetContentStyle = void 0;
6
+ exports.StyledLegend = exports.FieldsetStyle = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _styledSystem = require("styled-system");
9
9
  var _formField = _interopRequireDefault(require("../../__internal__/form-field/form-field.style"));
10
- var _validationIcon = _interopRequireDefault(require("../../__internal__/validations/validation-icon.style"));
11
- var _icon = _interopRequireDefault(require("../icon/icon.style"));
12
10
  var _base = _interopRequireDefault(require("../../style/themes/base"));
13
11
  var _checkbox = _interopRequireDefault(require("../checkbox/checkbox.style"));
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -33,57 +31,39 @@ const FieldsetStyle = exports.FieldsetStyle = _styledComponents.default.fieldset
33
31
  FieldsetStyle.defaultProps = {
34
32
  theme: _base.default
35
33
  };
36
- const LegendContainerStyle = exports.LegendContainerStyle = _styledComponents.default.div`
37
- ${({
38
- inline
39
- }) => inline && `
40
- margin-right: 32px;
41
- height: 34px !important;
42
- `}
34
+ const StyledLegend = exports.StyledLegend = _styledComponents.default.legend`
43
35
  display: flex;
44
36
  align-items: center;
45
37
  margin-bottom: 32px;
38
+ font-size: 20px;
39
+ font-weight: var(--fontWeights700);
40
+ color: var(--colorsUtilityYin090);
41
+ line-height: 24px;
42
+ margin-right: 4px;
46
43
 
47
- legend {
48
- font-size: 20px;
49
- font-weight: var(--fontWeights700);
50
- color: var(--colorsUtilityYin090);
51
- line-height: 24px;
52
- margin-right: 4px;
53
-
54
- ${({
44
+ ${({
55
45
  isRequired
56
46
  }) => isRequired && (0, _styledComponents.css)`
57
- ::after {
58
- content: "*";
59
- line-height: 24px;
60
- color: var(--colorsSemanticNegative500);
61
- font-weight: var(--fontWeights700);
62
- margin-left: var(--spacing100);
63
- position: relative;
64
- top: 1px;
65
- left: -4px;
66
- }
67
- `}
47
+ ::after {
48
+ content: "*";
49
+ line-height: 24px;
50
+ color: var(--colorsSemanticNegative500);
51
+ font-weight: var(--fontWeights700);
52
+ margin-left: var(--spacing100);
53
+ position: relative;
54
+ top: 1px;
55
+ left: -4px;
56
+ }
57
+ `}
68
58
 
69
- ${({
59
+ ${({
70
60
  isOptional
71
61
  }) => isOptional && (0, _styledComponents.css)`
72
- ::after {
73
- content: "(optional)";
74
- color: var(--colorsUtilityYin055);
75
- font-weight: var(--fontWeights400);
76
- margin-left: var(--spacing050);
77
- }
78
- `}
79
- }
80
-
81
- ${_validationIcon.default} ${_icon.default}:focus {
82
- outline: 2px solid #ffb500;
83
- }
84
- `;
85
- const FieldsetContentStyle = exports.FieldsetContentStyle = _styledComponents.default.div`
86
- ${({
87
- inline
88
- }) => inline && "display: flex;"}
62
+ ::after {
63
+ content: "(optional)";
64
+ color: var(--colorsUtilityYin055);
65
+ font-weight: var(--fontWeights400);
66
+ margin-left: var(--spacing050);
67
+ }
68
+ `}
89
69
  `;
@@ -45,9 +45,9 @@ const TileSelectGroup = ({
45
45
  legend: legend
46
46
  }, (0, _tags.default)("tile-select-group", rest), {
47
47
  multiSelect: multiSelect
48
- }, (0, _utils.filterStyledSystemMarginProps)(rest)), description ? /*#__PURE__*/_react.default.createElement(_tileSelect.StyledGroupDescription, {
48
+ }, (0, _utils.filterStyledSystemMarginProps)(rest)), description && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledGroupDescription, {
49
49
  "data-element": "tile-select-group-description"
50
- }, description) : null, /*#__PURE__*/_react.default.createElement("div", null, tiles));
50
+ }, description), tiles);
51
51
  };
52
52
  exports.TileSelectGroup = TileSelectGroup;
53
53
  var _default = exports.default = TileSelectGroup;
@@ -114,7 +114,7 @@ const TileSelect = /*#__PURE__*/_react.default.forwardRef(({
114
114
  as: checkPropTypeIsNode(subtitle) ? "div" : undefined
115
115
  }, subtitle), titleAdornment && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAdornment, {
116
116
  hasAdditionalInformation: !!additionalInformation
117
- }, titleAdornment)), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, {
117
+ }, titleAdornment && /*#__PURE__*/_react.default.createElement("div", null, titleAdornment))), additionalInformation && /*#__PURE__*/_react.default.createElement("div", null, additionalInformation), /*#__PURE__*/_react.default.createElement(_tileSelect.StyledDescription, {
118
118
  as: checkPropTypeIsNode(description) ? "div" : undefined
119
119
  }, description), footer && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledFooterWrapper, null, footer), accordionContent && accordionControl && /*#__PURE__*/_react.default.createElement(_tileSelect.StyledAccordionFooterWrapper, {
120
120
  accordionExpanded: accordionExpanded
@@ -28,7 +28,7 @@ declare const StyledDeselectWrapper: import("styled-components").StyledComponent
28
28
  hasActionAdornment: boolean;
29
29
  }, never>;
30
30
  declare const StyledTileSelectFieldset: import("styled-components").StyledComponent<{
31
- ({ children, inline, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
31
+ ({ children, legend, required, isOptional, ...rest }: import("../fieldset").FieldsetProps): import("react").JSX.Element;
32
32
  displayName: string;
33
33
  }, any, {
34
34
  multiSelect: boolean;
@@ -175,13 +175,11 @@ const StyledDeselectWrapper = exports.StyledDeselectWrapper = _styledComponents.
175
175
  const StyledTileSelectFieldset = exports.StyledTileSelectFieldset = (0, _styledComponents.default)(_fieldset.default)`
176
176
  ${_styledSystem.margin}
177
177
 
178
- ${_fieldset2.LegendContainerStyle} {
178
+ ${_fieldset2.StyledLegend} {
179
179
  margin-bottom: 16px;
180
- legend {
181
- font-size: 16px;
182
- line-height: 16px;
183
- margin-left: -2px;
184
- }
180
+ font-size: 16px;
181
+ line-height: 16px;
182
+ margin-left: -2px;
185
183
  }
186
184
  ${({
187
185
  multiSelect
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "130.0.0",
3
+ "version": "131.0.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",