orcs-design-system 3.1.21 → 3.1.23
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.
|
@@ -3,8 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["as"],
|
|
6
|
-
_excluded2 = ["theme", "onToggle", "toggleState", "direction", "menuTopPosition", "menuLeftPosition", "menuRightPosition", "menuWidth", "customTriggerComponent", "children", "ariaLabel"],
|
|
7
|
-
_excluded3 = ["children", "customTriggerComponent", "direction", "isOpen", "theme", "closeOnClick", "ariaLabel"];
|
|
6
|
+
_excluded2 = ["theme", "onToggle", "toggleState", "direction", "menuTopPosition", "menuLeftPosition", "menuRightPosition", "menuWidth", "customTriggerComponent", "children", "triggerRef", "ariaLabel"],
|
|
7
|
+
_excluded3 = ["children", "customTriggerComponent", "direction", "isOpen", "theme", "closeOnClick", "ariaLabel", "triggerRef"];
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
import React, { useState, useEffect, useImperativeHandle, useCallback } from "react";
|
|
@@ -135,6 +135,7 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
|
|
|
135
135
|
menuWidth = _ref.menuWidth,
|
|
136
136
|
customTriggerComponent = _ref.customTriggerComponent,
|
|
137
137
|
children = _ref.children,
|
|
138
|
+
triggerRef = _ref.triggerRef,
|
|
138
139
|
_ref$ariaLabel = _ref.ariaLabel,
|
|
139
140
|
ariaLabel = _ref$ariaLabel === void 0 ? "Options Menu" : _ref$ariaLabel,
|
|
140
141
|
props = _objectWithoutProperties(_ref, _excluded2);
|
|
@@ -183,6 +184,7 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
|
|
|
183
184
|
triggerBtn = /*#__PURE__*/React.createElement(Control, {
|
|
184
185
|
"aria-label": ariaLabel,
|
|
185
186
|
"aria-expanded": "".concat(toggleState),
|
|
187
|
+
ref: triggerRef,
|
|
186
188
|
onClick: onToggleInView
|
|
187
189
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
188
190
|
isOpen: toggleState
|
|
@@ -213,7 +215,10 @@ ActionsMenuBody.propTypes = {
|
|
|
213
215
|
customTriggerComponent: PropTypes.node,
|
|
214
216
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
215
217
|
theme: PropTypes.object,
|
|
216
|
-
ariaLabel: PropTypes.string
|
|
218
|
+
ariaLabel: PropTypes.string,
|
|
219
|
+
triggerRef: PropTypes.shape({
|
|
220
|
+
current: PropTypes.any
|
|
221
|
+
})
|
|
217
222
|
};
|
|
218
223
|
var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
219
224
|
var children = _ref2.children,
|
|
@@ -226,6 +231,7 @@ var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
226
231
|
closeOnClick = _ref2$closeOnClick === void 0 ? true : _ref2$closeOnClick,
|
|
227
232
|
_ref2$ariaLabel = _ref2.ariaLabel,
|
|
228
233
|
ariaLabel = _ref2$ariaLabel === void 0 ? "Options Menu" : _ref2$ariaLabel,
|
|
234
|
+
triggerRef = _ref2.triggerRef,
|
|
229
235
|
props = _objectWithoutProperties(_ref2, _excluded3);
|
|
230
236
|
var _useState5 = useState(isOpen),
|
|
231
237
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -268,7 +274,8 @@ var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
268
274
|
customTriggerComponent: customTriggerComponent,
|
|
269
275
|
direction: direction,
|
|
270
276
|
theme: theme,
|
|
271
|
-
ariaLabel: ariaLabel
|
|
277
|
+
ariaLabel: ariaLabel,
|
|
278
|
+
triggerRef: triggerRef
|
|
272
279
|
}, props), children);
|
|
273
280
|
});
|
|
274
281
|
ActionsMenu.propTypes = {
|
|
@@ -280,7 +287,10 @@ ActionsMenu.propTypes = {
|
|
|
280
287
|
/** Specifies the colour theme */
|
|
281
288
|
theme: PropTypes.object,
|
|
282
289
|
/** Specifies the aria-label for the button */
|
|
283
|
-
ariaLabel: PropTypes.object
|
|
290
|
+
ariaLabel: PropTypes.object,
|
|
291
|
+
triggerRef: PropTypes.shape({
|
|
292
|
+
current: PropTypes.any
|
|
293
|
+
})
|
|
284
294
|
};
|
|
285
295
|
ActionsMenu.__docgenInfo = {
|
|
286
296
|
"description": "",
|
|
@@ -355,6 +365,19 @@ ActionsMenu.__docgenInfo = {
|
|
|
355
365
|
"name": "object"
|
|
356
366
|
},
|
|
357
367
|
"required": false
|
|
368
|
+
},
|
|
369
|
+
"triggerRef": {
|
|
370
|
+
"description": "",
|
|
371
|
+
"type": {
|
|
372
|
+
"name": "shape",
|
|
373
|
+
"value": {
|
|
374
|
+
"current": {
|
|
375
|
+
"name": "any",
|
|
376
|
+
"required": false
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"required": false
|
|
358
381
|
}
|
|
359
382
|
}
|
|
360
383
|
};
|
|
@@ -452,6 +475,19 @@ ActionsMenuBody.__docgenInfo = {
|
|
|
452
475
|
"name": "object"
|
|
453
476
|
},
|
|
454
477
|
"required": false
|
|
478
|
+
},
|
|
479
|
+
"triggerRef": {
|
|
480
|
+
"description": "",
|
|
481
|
+
"type": {
|
|
482
|
+
"name": "shape",
|
|
483
|
+
"value": {
|
|
484
|
+
"current": {
|
|
485
|
+
"name": "any",
|
|
486
|
+
"required": false
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
"required": false
|
|
455
491
|
}
|
|
456
492
|
}
|
|
457
493
|
};
|
|
@@ -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
|
|
405
|
+
ariaLabel: function ariaLabel(props, propName) {
|
|
406
406
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
407
|
-
return new Error("
|
|
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
|
|
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
|
},
|