orcs-design-system 3.1.21 → 3.1.22

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,6 +1,7 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "label", "colour", "disabled", "checked", "onClick", "onChange", "theme"];
4
+ var _excluded = ["name", "label", "colour", "disabled", "checked", "onClick", "onChange", "theme", "ariaLabel"];
4
5
  import React, { useRef } from "react";
5
6
  import PropTypes from "prop-types";
6
7
  import styled, { keyframes, ThemeProvider } from "styled-components";
@@ -70,6 +71,7 @@ export default function Checkbox(_ref) {
70
71
  onClick = _ref.onClick,
71
72
  onChange = _ref.onChange,
72
73
  theme = _ref.theme,
74
+ ariaLabel = _ref.ariaLabel,
73
75
  props = _objectWithoutProperties(_ref, _excluded);
74
76
  var inputRef = useRef(null);
75
77
  var handleClick = function handleClick() {
@@ -97,7 +99,8 @@ export default function Checkbox(_ref) {
97
99
  disabled: disabled,
98
100
  checked: checked,
99
101
  onChange: onChange,
100
- ref: inputRef
102
+ ref: inputRef,
103
+ "aria-label": ariaLabel
101
104
  }), /*#__PURE__*/React.createElement(Box, {
102
105
  colour: colour,
103
106
  onClick: onClick
@@ -121,6 +124,16 @@ Checkbox.propTypes = {
121
124
  onClick: PropTypes.string,
122
125
  /** Text label to display beside the checkbox */
123
126
  label: PropTypes.string,
127
+ // ariaLabel prop must be specified if label is not provided
128
+ ariaLabel: function ariaLabel(props, propName) {
129
+ if (!props.label && (props[propName] == null || props[propName] === "")) {
130
+ return new Error("Missing prop `".concat(propName, "` not specified for Checkbox component. When `label` is not provided, `").concat(propName, "` is required."));
131
+ }
132
+ if (props[propName] && typeof props[propName] !== "string") {
133
+ return new Error("Invalid propType `".concat(propName, "` supplied to Checkbox component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
134
+ }
135
+ return null;
136
+ },
124
137
  /** Specifies the system design theme. */
125
138
  theme: PropTypes.object
126
139
  };
@@ -194,6 +207,14 @@ Checkbox.__docgenInfo = {
194
207
  },
195
208
  "required": false
196
209
  },
210
+ "ariaLabel": {
211
+ "description": "",
212
+ "type": {
213
+ "name": "custom",
214
+ "raw": "(props, propName) => {\n if (!props.label && (props[propName] == null || props[propName] === \"\")) {\n return new Error(\n `Missing prop \\`${propName}\\` not specified for Checkbox component. When \\`label\\` is not provided, \\`${propName}\\` is required.`\n );\n }\n if (props[propName] && typeof props[propName] !== \"string\") {\n return new Error(\n `Invalid propType \\`${propName}\\` supplied to Checkbox component. Expected \\`string\\`, received \\`${typeof props[\n propName\n ]}\\`.`\n );\n }\n return null;\n}"
215
+ },
216
+ "required": false
217
+ },
197
218
  "theme": {
198
219
  "description": "Specifies the system design theme.",
199
220
  "type": {
@@ -1,6 +1,7 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "value", "label", "variant", "disabled", "checked", "onChange", "theme"];
4
+ var _excluded = ["name", "value", "label", "variant", "disabled", "checked", "onChange", "theme", "ariaLabel"];
4
5
  import React from "react";
5
6
  import PropTypes from "prop-types";
6
7
  import styled, { ThemeProvider } from "styled-components";
@@ -186,6 +187,7 @@ export default function RadioButton(_ref) {
186
187
  checked = _ref.checked,
187
188
  onChange = _ref.onChange,
188
189
  theme = _ref.theme,
190
+ ariaLabel = _ref.ariaLabel,
189
191
  props = _objectWithoutProperties(_ref, _excluded);
190
192
  var component = /*#__PURE__*/React.createElement(RadioButtonItem, _extends({
191
193
  variant: variant
@@ -197,7 +199,8 @@ export default function RadioButton(_ref) {
197
199
  value: value,
198
200
  disabled: disabled,
199
201
  checked: checked,
200
- onChange: onChange
202
+ onChange: onChange,
203
+ "aria-label": ariaLabel
201
204
  }), /*#__PURE__*/React.createElement(RadioButtonCircle, {
202
205
  variant: variant
203
206
  }, /*#__PURE__*/React.createElement(RadioButtonDot, {
@@ -214,6 +217,16 @@ RadioButton.propTypes = {
214
217
  value: PropTypes.string,
215
218
  /** Sets the label of the radio button */
216
219
  label: PropTypes.string,
220
+ // ariaLabel prop must be specified if label is not provided
221
+ ariaLabel: function ariaLabel(props, propName) {
222
+ if (!props.label && (props[propName] == null || props[propName] === "")) {
223
+ return new Error("Missing prop `".concat(propName, "` not specified for Radio component. When `label` is not provided, `").concat(propName, "` is required."));
224
+ }
225
+ if (props[propName] && typeof props[propName] !== "string") {
226
+ return new Error("Invalid propType `".concat(propName, "` supplied to Radio component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
227
+ }
228
+ return null;
229
+ },
217
230
  /** Sets radio button colour. Default is greyDarker. Use white for inverted styling */
218
231
  variant: PropTypes.oneOf(["success", "warning", "danger", "primary", "white"]),
219
232
  /** Applies disabled attribute and styling */
@@ -251,6 +264,14 @@ RadioButton.__docgenInfo = {
251
264
  },
252
265
  "required": false
253
266
  },
267
+ "ariaLabel": {
268
+ "description": "",
269
+ "type": {
270
+ "name": "custom",
271
+ "raw": "(props, propName) => {\n if (!props.label && (props[propName] == null || props[propName] === \"\")) {\n return new Error(\n `Missing prop \\`${propName}\\` not specified for Radio component. When \\`label\\` is not provided, \\`${propName}\\` is required.`\n );\n }\n if (props[propName] && typeof props[propName] !== \"string\") {\n return new Error(\n `Invalid propType \\`${propName}\\` supplied to Radio component. Expected \\`string\\`, received \\`${typeof props[\n propName\n ]}\\`.`\n );\n }\n return null;\n}"
272
+ },
273
+ "required": false
274
+ },
254
275
  "variant": {
255
276
  "description": "Sets radio button colour. Default is greyDarker. Use white for inverted styling",
256
277
  "type": {
@@ -402,9 +402,9 @@ Select.propTypes = {
402
402
  /** Specifies the label for the `Select` */
403
403
  label: PropTypes.string,
404
404
  // ariaLabel prop must be specified if label is not provided
405
- ariaLabel: function ariaLabel(props, propName, componentName) {
405
+ ariaLabel: function ariaLabel(props, propName) {
406
406
  if (!props.label && (props[propName] == null || props[propName] === "")) {
407
- return new Error("Invalid prop `".concat(propName, "` supplied to `").concat(componentName, "`. When `label` is not provided, `").concat(propName, "` is required."));
407
+ return new Error("Missing prop `".concat(propName, "` not specified for Select component. When `label` is not provided, `").concat(propName, "` is required."));
408
408
  }
409
409
  if (props[propName] && typeof props[propName] !== "string") {
410
410
  return new Error("Invalid propType `".concat(propName, "` supplied to Select component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
@@ -508,7 +508,7 @@ Select.__docgenInfo = {
508
508
  "description": "",
509
509
  "type": {
510
510
  "name": "custom",
511
- "raw": "(props, propName, componentName) => {\n if (!props.label && (props[propName] == null || props[propName] === \"\")) {\n return new Error(\n `Invalid prop \\`${propName}\\` supplied to \\`${componentName}\\`. When \\`label\\` is not provided, \\`${propName}\\` is required.`\n );\n }\n if (props[propName] && typeof props[propName] !== \"string\") {\n return new Error(\n `Invalid propType \\`${propName}\\` supplied to Select component. Expected \\`string\\`, received \\`${typeof props[\n propName\n ]}\\`.`\n );\n }\n return null;\n}"
511
+ "raw": "(props, propName) => {\n if (!props.label && (props[propName] == null || props[propName] === \"\")) {\n return new Error(\n `Missing prop \\`${propName}\\` not specified for Select component. When \\`label\\` is not provided, \\`${propName}\\` is required.`\n );\n }\n if (props[propName] && typeof props[propName] !== \"string\") {\n return new Error(\n `Invalid propType \\`${propName}\\` supplied to Select component. Expected \\`string\\`, received \\`${typeof props[\n propName\n ]}\\`.`\n );\n }\n return null;\n}"
512
512
  },
513
513
  "required": false
514
514
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.1.21",
3
+ "version": "3.1.22",
4
4
  "engines": {
5
5
  "node": "18.17.1"
6
6
  },