carbon-react 147.7.1 → 147.7.2

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.
@@ -6,7 +6,7 @@ export interface BadgeProps {
6
6
  children: React.ReactNode;
7
7
  /** The number rendered in the badge component */
8
8
  counter?: string | number;
9
- /** Prop to specify the colour of the component */
9
+ /** Prop to specify the color of the component */
10
10
  color?: string;
11
11
  /** Callback fired when badge is clicked */
12
12
  onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
@@ -185,6 +185,7 @@ const Switch = /*#__PURE__*/React.forwardRef(({
185
185
  const errorMargin = error || warning ? defaultInputWrapperMargin : defaultMargin;
186
186
  const direction = labelInline ? "row" : "column";
187
187
  const reverseDirection = labelInline ? "row-reverse" : "column";
188
+ const labelWrapperAlignSelf = labelInline && !error && !warning && !info ? "center" : "";
188
189
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledSwitch, switchStylePropsForNewValidation, /*#__PURE__*/React.createElement(Box, {
189
190
  "data-role": "field-reverse-wrapper",
190
191
  display: "flex",
@@ -193,7 +194,8 @@ const Switch = /*#__PURE__*/React.forwardRef(({
193
194
  flexDirection: !reverse ? reverseDirection : direction,
194
195
  width: labelInline ? "100%" : "auto"
195
196
  }, /*#__PURE__*/React.createElement(Box, {
196
- "data-role": "label-wrapper"
197
+ "data-role": "label-wrapper",
198
+ alignSelf: labelWrapperAlignSelf
197
199
  }, /*#__PURE__*/React.createElement(Label, {
198
200
  isDarkBackground: isDarkBackground,
199
201
  labelId: labelId.current,
@@ -210,10 +212,11 @@ const Switch = /*#__PURE__*/React.forwardRef(({
210
212
  id: inputHintId.current,
211
213
  isDarkBackground: isDarkBackground
212
214
  }, labelHelp))), /*#__PURE__*/React.createElement(Box, {
213
- ml: reverse ? errorMargin : defaultInputWrapperMargin,
214
- mr: !reverse ? errorMargin : defaultInputWrapperMargin,
215
+ ml: reverse ? errorMargin : 0,
216
+ mr: !reverse ? errorMargin : 0,
215
217
  position: "relative",
216
- id: "input-wrapper"
218
+ id: "input-wrapper",
219
+ "data-role": "input-wrapper"
217
220
  }, /*#__PURE__*/React.createElement(ValidationMessage, {
218
221
  error: error,
219
222
  warning: warning,
@@ -6,7 +6,7 @@ export interface BadgeProps {
6
6
  children: React.ReactNode;
7
7
  /** The number rendered in the badge component */
8
8
  counter?: string | number;
9
- /** Prop to specify the colour of the component */
9
+ /** Prop to specify the color of the component */
10
10
  color?: string;
11
11
  /** Callback fired when badge is clicked */
12
12
  onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
@@ -194,6 +194,7 @@ const Switch = exports.Switch = /*#__PURE__*/_react.default.forwardRef(({
194
194
  const errorMargin = error || warning ? defaultInputWrapperMargin : defaultMargin;
195
195
  const direction = labelInline ? "row" : "column";
196
196
  const reverseDirection = labelInline ? "row-reverse" : "column";
197
+ const labelWrapperAlignSelf = labelInline && !error && !warning && !info ? "center" : "";
197
198
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_switch.default, switchStylePropsForNewValidation, /*#__PURE__*/_react.default.createElement(_box.default, {
198
199
  "data-role": "field-reverse-wrapper",
199
200
  display: "flex",
@@ -202,7 +203,8 @@ const Switch = exports.Switch = /*#__PURE__*/_react.default.forwardRef(({
202
203
  flexDirection: !reverse ? reverseDirection : direction,
203
204
  width: labelInline ? "100%" : "auto"
204
205
  }, /*#__PURE__*/_react.default.createElement(_box.default, {
205
- "data-role": "label-wrapper"
206
+ "data-role": "label-wrapper",
207
+ alignSelf: labelWrapperAlignSelf
206
208
  }, /*#__PURE__*/_react.default.createElement(_label.default, {
207
209
  isDarkBackground: isDarkBackground,
208
210
  labelId: labelId.current,
@@ -219,10 +221,11 @@ const Switch = exports.Switch = /*#__PURE__*/_react.default.forwardRef(({
219
221
  id: inputHintId.current,
220
222
  isDarkBackground: isDarkBackground
221
223
  }, labelHelp))), /*#__PURE__*/_react.default.createElement(_box.default, {
222
- ml: reverse ? errorMargin : defaultInputWrapperMargin,
223
- mr: !reverse ? errorMargin : defaultInputWrapperMargin,
224
+ ml: reverse ? errorMargin : 0,
225
+ mr: !reverse ? errorMargin : 0,
224
226
  position: "relative",
225
- id: "input-wrapper"
227
+ id: "input-wrapper",
228
+ "data-role": "input-wrapper"
226
229
  }, /*#__PURE__*/_react.default.createElement(_validationMessage.default, {
227
230
  error: error,
228
231
  warning: warning,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "147.7.1",
3
+ "version": "147.7.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",