carbon-react 154.1.1 → 154.2.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,20 +1,11 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface ValidationProps {
4
- /** Indicate that error has occurred
5
- * Pass string to display icon, tooltip and red border
6
- * Pass true boolean to only display red border
7
- */
4
+ /** Indicate that error has occurred. */
8
5
  error?: boolean | string;
9
- /** Indicate additional information
10
- * Pass string to display icon, tooltip and blue border
11
- * Pass true boolean to only display blue border
12
- */
6
+ /** [Legacy] Indicate additional information. */
13
7
  info?: boolean | string;
14
- /** Indicate that warning has occurred
15
- * Pass string to display icon, tooltip and orange border
16
- * Pass true boolean to only display orange border
17
- */
8
+ /** Indicate that warning has occurred. */
18
9
  warning?: boolean | string;
19
10
  }
20
11
  type TooltipPositions = "top" | "bottom" | "left" | "right";
@@ -22,7 +22,7 @@ export const Password = ({
22
22
  type: visibleInput ? "text" : "password",
23
23
  disabled: disabled
24
24
  }, rest, tagComponent("password", rest)), /*#__PURE__*/React.createElement(ButtonMinor, {
25
- "aria-label": visibleInput ? "Hide password" : "Show password",
25
+ "aria-label": visibleInput ? l.password?.ariaLabelHide?.() : l.password?.ariaLabelShow?.(),
26
26
  "aria-controls": internalInputId.current,
27
27
  onClick: () => setPasswordShown(!passwordShown),
28
28
  pr: 1,
@@ -32,7 +32,7 @@ export const Password = ({
32
32
  size: "small",
33
33
  disabled: forceObscurity || disabled,
34
34
  isInPassword: true
35
- }, visibleInput ? "Hide" : "Show")), /*#__PURE__*/React.createElement(HiddenAriaLive, {
35
+ }, visibleInput ? l.password?.buttonLabelHide?.() : l.password?.buttonLabelShow?.())), /*#__PURE__*/React.createElement(HiddenAriaLive, {
36
36
  role: "status",
37
37
  "aria-live": "polite"
38
38
  }, visibleInput ? l.password.ariaLiveShownMessage() : l.password.ariaLiveHiddenMessage()));
@@ -61,7 +61,7 @@ export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<C
61
61
  labelInline?: boolean;
62
62
  /** [Legacy] Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8). */
63
63
  labelSpacing?: 1 | 2;
64
- /** [Legacy] Label width. */
64
+ /** [Legacy] Label width as a percentage when label is inline. */
65
65
  labelWidth?: number;
66
66
  /** Specify a callback triggered on change */
67
67
  onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
@@ -146,6 +146,10 @@ const enGB = {
146
146
  ofY: count => `of ${count}`
147
147
  },
148
148
  password: {
149
+ buttonLabelHide: () => "Hide",
150
+ buttonLabelShow: () => "Show",
151
+ ariaLabelHide: () => "Hide password",
152
+ ariaLabelShow: () => "Show password",
149
153
  ariaLiveShownMessage: () => "Your password has been shown. Focus on the password input to have it read to you, if it is safe to do so.",
150
154
  ariaLiveHiddenMessage: () => "Your password is currently hidden."
151
155
  },
@@ -121,6 +121,10 @@ interface Locale {
121
121
  ofY: (count: string | number) => string;
122
122
  };
123
123
  password: {
124
+ buttonLabelHide?: () => string;
125
+ buttonLabelShow?: () => string;
126
+ ariaLabelHide?: () => string;
127
+ ariaLabelShow?: () => string;
124
128
  ariaLiveShownMessage: () => string;
125
129
  ariaLiveHiddenMessage: () => string;
126
130
  };
@@ -1,20 +1,11 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  export interface ValidationProps {
4
- /** Indicate that error has occurred
5
- * Pass string to display icon, tooltip and red border
6
- * Pass true boolean to only display red border
7
- */
4
+ /** Indicate that error has occurred. */
8
5
  error?: boolean | string;
9
- /** Indicate additional information
10
- * Pass string to display icon, tooltip and blue border
11
- * Pass true boolean to only display blue border
12
- */
6
+ /** [Legacy] Indicate additional information. */
13
7
  info?: boolean | string;
14
- /** Indicate that warning has occurred
15
- * Pass string to display icon, tooltip and orange border
16
- * Pass true boolean to only display orange border
17
- */
8
+ /** Indicate that warning has occurred. */
18
9
  warning?: boolean | string;
19
10
  }
20
11
  type TooltipPositions = "top" | "bottom" | "left" | "right";
@@ -31,7 +31,7 @@ const Password = ({
31
31
  type: visibleInput ? "text" : "password",
32
32
  disabled: disabled
33
33
  }, rest, (0, _tags.default)("password", rest)), /*#__PURE__*/_react.default.createElement(_buttonMinor.default, {
34
- "aria-label": visibleInput ? "Hide password" : "Show password",
34
+ "aria-label": visibleInput ? l.password?.ariaLabelHide?.() : l.password?.ariaLabelShow?.(),
35
35
  "aria-controls": internalInputId.current,
36
36
  onClick: () => setPasswordShown(!passwordShown),
37
37
  pr: 1,
@@ -41,7 +41,7 @@ const Password = ({
41
41
  size: "small",
42
42
  disabled: forceObscurity || disabled,
43
43
  isInPassword: true
44
- }, visibleInput ? "Hide" : "Show")), /*#__PURE__*/_react.default.createElement(_password.HiddenAriaLive, {
44
+ }, visibleInput ? l.password?.buttonLabelHide?.() : l.password?.buttonLabelShow?.())), /*#__PURE__*/_react.default.createElement(_password.HiddenAriaLive, {
45
45
  role: "status",
46
46
  "aria-live": "polite"
47
47
  }, visibleInput ? l.password.ariaLiveShownMessage() : l.password.ariaLiveHiddenMessage()));
@@ -61,7 +61,7 @@ export interface CommonTextboxProps extends ValidationProps, MarginProps, Omit<C
61
61
  labelInline?: boolean;
62
62
  /** [Legacy] Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8). */
63
63
  labelSpacing?: 1 | 2;
64
- /** [Legacy] Label width. */
64
+ /** [Legacy] Label width as a percentage when label is inline. */
65
65
  labelWidth?: number;
66
66
  /** Specify a callback triggered on change */
67
67
  onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
@@ -152,6 +152,10 @@ const enGB = {
152
152
  ofY: count => `of ${count}`
153
153
  },
154
154
  password: {
155
+ buttonLabelHide: () => "Hide",
156
+ buttonLabelShow: () => "Show",
157
+ ariaLabelHide: () => "Hide password",
158
+ ariaLabelShow: () => "Show password",
155
159
  ariaLiveShownMessage: () => "Your password has been shown. Focus on the password input to have it read to you, if it is safe to do so.",
156
160
  ariaLiveHiddenMessage: () => "Your password is currently hidden."
157
161
  },
@@ -121,6 +121,10 @@ interface Locale {
121
121
  ofY: (count: string | number) => string;
122
122
  };
123
123
  password: {
124
+ buttonLabelHide?: () => string;
125
+ buttonLabelShow?: () => string;
126
+ ariaLabelHide?: () => string;
127
+ ariaLabelShow?: () => string;
124
128
  ariaLiveShownMessage: () => string;
125
129
  ariaLiveHiddenMessage: () => string;
126
130
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "154.1.1",
3
+ "version": "154.2.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",