orcs-design-system 3.1.33 → 3.1.36

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.
@@ -250,9 +250,9 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
250
250
  },
251
251
  onBlur: function onBlur(e) {
252
252
  setTimeout(function () {
253
- var _document$getElementB;
253
+ var _wrapperRef$current, _document$getElementB;
254
254
  var focusedElement = document.activeElement;
255
- var isChild = wrapperRef.current.contains(focusedElement);
255
+ var isChild = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.contains(focusedElement);
256
256
  var isModalChild = (_document$getElementB = document.getElementById("modal-overlay")) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.contains(focusedElement);
257
257
  var isModalAndTabbed = isTabbed && isModalChild;
258
258
  if (isChild || isModalAndTabbed) return;
@@ -145,6 +145,7 @@ var Modal = function Modal(_ref) {
145
145
  });
146
146
  };
147
147
  }, [visible, onClose, overlayID]);
148
+ if (!visible) return null;
148
149
  var component = /*#__PURE__*/React.createElement(Overlay, _extends({
149
150
  alignItems: "center",
150
151
  justifyContent: "center",
@@ -196,12 +197,9 @@ var Modal = function Modal(_ref) {
196
197
  headerContent: headerContent,
197
198
  overflow: overflow
198
199
  }, children), footerContent && /*#__PURE__*/React.createElement(FooterContent, null, footerContent)))));
199
- var wrapper = visible && /*#__PURE__*/ReactDOM.createPortal(theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
200
+ return /*#__PURE__*/ReactDOM.createPortal(theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
200
201
  theme: theme
201
202
  }, component) : component, document.body);
202
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
203
- theme: theme
204
- }, wrapper) : wrapper;
205
203
  };
206
204
  Modal.propTypes = {
207
205
  /** Specifies the children of the Modal */
@@ -245,164 +243,4 @@ Modal.defaultProps = {
245
243
  overlayID: "modal-overlay",
246
244
  modalID: "modal-container"
247
245
  };
248
- Modal.__docgenInfo = {
249
- "description": "",
250
- "methods": [],
251
- "displayName": "Modal",
252
- "props": {
253
- "width": {
254
- "defaultValue": {
255
- "value": "\"350px\"",
256
- "computed": false
257
- },
258
- "description": "Specifies the width of the Modal",
259
- "type": {
260
- "name": "string"
261
- },
262
- "required": false
263
- },
264
- "height": {
265
- "defaultValue": {
266
- "value": "\"auto\"",
267
- "computed": false
268
- },
269
- "description": "Specifies the height of the Modal",
270
- "type": {
271
- "name": "string"
272
- },
273
- "required": false
274
- },
275
- "maxHeight": {
276
- "defaultValue": {
277
- "value": "\"90vh\"",
278
- "computed": false
279
- },
280
- "description": "Specifies the max height of the Modal",
281
- "type": {
282
- "name": "string"
283
- },
284
- "required": false
285
- },
286
- "maxWidth": {
287
- "defaultValue": {
288
- "value": "\"90vw\"",
289
- "computed": false
290
- },
291
- "description": "Specifies the max width of the Modal",
292
- "type": {
293
- "name": "string"
294
- },
295
- "required": false
296
- },
297
- "overlayID": {
298
- "defaultValue": {
299
- "value": "\"modal-overlay\"",
300
- "computed": false
301
- },
302
- "description": "Specifies the id of the overlay element for targeting",
303
- "type": {
304
- "name": "string"
305
- },
306
- "required": false
307
- },
308
- "modalID": {
309
- "defaultValue": {
310
- "value": "\"modal-container\"",
311
- "computed": false
312
- },
313
- "description": "Specifies the id of the modal element for targeting",
314
- "type": {
315
- "name": "string"
316
- },
317
- "required": false
318
- },
319
- "children": {
320
- "description": "Specifies the children of the Modal",
321
- "type": {
322
- "name": "union",
323
- "value": [{
324
- "name": "element"
325
- }, {
326
- "name": "string"
327
- }, {
328
- "name": "node"
329
- }]
330
- },
331
- "required": false
332
- },
333
- "headerContent": {
334
- "description": "Specifies content for the header of the modal",
335
- "type": {
336
- "name": "union",
337
- "value": [{
338
- "name": "element"
339
- }, {
340
- "name": "node"
341
- }]
342
- },
343
- "required": false
344
- },
345
- "footerContent": {
346
- "description": "Specifies content for the header of the modal",
347
- "type": {
348
- "name": "union",
349
- "value": [{
350
- "name": "element"
351
- }, {
352
- "name": "node"
353
- }]
354
- },
355
- "required": false
356
- },
357
- "minWidth": {
358
- "description": "Specifies the min width of the Modal",
359
- "type": {
360
- "name": "string"
361
- },
362
- "required": false
363
- },
364
- "minHeight": {
365
- "description": "Specifies the min height of the Modal",
366
- "type": {
367
- "name": "string"
368
- },
369
- "required": false
370
- },
371
- "visible": {
372
- "description": "Specifies the visibility of the Modal",
373
- "type": {
374
- "name": "bool"
375
- },
376
- "required": false
377
- },
378
- "onClose": {
379
- "description": "Specifies the function to run on clicking X icon. Ensure that this function will close Modal through the `visible` prop",
380
- "type": {
381
- "name": "func"
382
- },
383
- "required": false
384
- },
385
- "overflow": {
386
- "description": "Specifies whether the Modal overflow is visible or not, default is `hidden`. If height is not enough, vertical scrollbar will be displayed (`overflow-y: auto`)",
387
- "type": {
388
- "name": "string"
389
- },
390
- "required": false
391
- },
392
- "theme": {
393
- "description": "Sets the theme for the Modal",
394
- "type": {
395
- "name": "object"
396
- },
397
- "required": false
398
- },
399
- "ariaLabel": {
400
- "description": "Specifies the aria-label for the modal. Set this if headerContent is not defined as a string.",
401
- "type": {
402
- "name": "string"
403
- },
404
- "required": false
405
- }
406
- }
407
- };
408
246
  export default Modal;
@@ -6,7 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import React, { forwardRef } from "react";
7
7
  import PropTypes from "prop-types";
8
8
  import styled, { ThemeProvider, useTheme } from "styled-components";
9
- import { default as ReactSelect } from "react-select";
9
+ import { default as ReactSelect, components } from "react-select";
10
10
  import AsyncSelect from "react-select/async";
11
11
  import CreatableSelect from "react-select/creatable";
12
12
  import { space, layout, compose } from "styled-system";
@@ -45,6 +45,20 @@ var Label = styled("label").withConfig({
45
45
  mb: "xs"
46
46
  });
47
47
  });
48
+ var MultiValueRemove = function MultiValueRemove(props) {
49
+ var innerProps = props.innerProps,
50
+ data = props.data;
51
+ return /*#__PURE__*/React.createElement(components.MultiValueRemove, _objectSpread(_objectSpread({}, props), {}, {
52
+ innerProps: _objectSpread(_objectSpread({}, innerProps), {}, {
53
+ "aria-label": "Remove ".concat(data.label)
54
+ })
55
+ }));
56
+ };
57
+ var SELECT_TYPES = {
58
+ creatable: CreatableSelect,
59
+ async: AsyncSelect,
60
+ "default": ReactSelect
61
+ };
48
62
 
49
63
  /**
50
64
  *
@@ -63,6 +77,7 @@ var Label = styled("label").withConfig({
63
77
  *
64
78
  */
65
79
  var Select = /*#__PURE__*/forwardRef(function (props, ref) {
80
+ var _SELECT_TYPES$props$s;
66
81
  var theme = useTheme();
67
82
  var inputRef = useInputFocus(ref, props.focus);
68
83
  var _props$updateStyles = props.updateStyles,
@@ -350,6 +365,10 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
350
365
  });
351
366
  }
352
367
  });
368
+ var components = _objectSpread({
369
+ MultiValueRemove: MultiValueRemove
370
+ }, (props === null || props === void 0 ? void 0 : props.components) || {});
371
+ var SelectComponent = (_SELECT_TYPES$props$s = SELECT_TYPES[props === null || props === void 0 ? void 0 : props.selectType]) !== null && _SELECT_TYPES$props$s !== void 0 ? _SELECT_TYPES$props$s : SELECT_TYPES["default"];
353
372
  var component = /*#__PURE__*/React.createElement(Wrapper, _extends({
354
373
  inverted: props.inverted,
355
374
  "data-testid": props["data-testid"]
@@ -361,7 +380,7 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
361
380
  }, props.label, props.mandatory && /*#__PURE__*/React.createElement(Small, {
362
381
  color: "danger",
363
382
  ml: "xs"
364
- }, "*")), props.selectType === "creatable" ? /*#__PURE__*/React.createElement(CreatableSelect, _extends({
383
+ }, "*")), /*#__PURE__*/React.createElement(SelectComponent, _extends({
365
384
  ref: inputRef,
366
385
  styles: customStyles,
367
386
  theme: theme,
@@ -371,27 +390,9 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
371
390
  classNamePrefix: props.classNamePrefix,
372
391
  onChange: props.onChange,
373
392
  "aria-label": props.ariaLabel
374
- }, props)) : props.selectType === "async" ? /*#__PURE__*/React.createElement(AsyncSelect, _extends({
375
- ref: inputRef,
376
- styles: customStyles,
377
- theme: theme,
378
- inputId: props.inputId,
379
- inverted: props.inverted,
380
- isMulti: props.isMulti,
381
- classNamePrefix: props.classNamePrefix,
382
- onChange: props.onChange,
383
- "aria-label": props.ariaLabel
384
- }, props)) : /*#__PURE__*/React.createElement(ReactSelect, _extends({
385
- ref: inputRef,
386
- styles: customStyles,
387
- theme: theme,
388
- inputId: props.inputId,
389
- inverted: props.inverted,
390
- isMulti: props.isMulti,
391
- classNamePrefix: props.classNamePrefix,
392
- onChange: props.onChange,
393
- "aria-label": props.ariaLabel
394
- }, props)));
393
+ }, props, {
394
+ components: components
395
+ })));
395
396
  return props.theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
396
397
  theme: props.theme
397
398
  }, component) : component;
@@ -452,7 +453,9 @@ Select.propTypes = {
452
453
  /** Shows asterisk to denote a mandatory field */
453
454
  mandatory: PropTypes.bool,
454
455
  /** Focus on input */
455
- focus: PropTypes.bool
456
+ focus: PropTypes.bool,
457
+ /** Allows overrides of react-select components */
458
+ components: PropTypes.object
456
459
  };
457
460
  Select.defaultProps = {
458
461
  selectType: "default"
@@ -624,6 +627,13 @@ Select.__docgenInfo = {
624
627
  "name": "bool"
625
628
  },
626
629
  "required": false
630
+ },
631
+ "components": {
632
+ "description": "Allows overrides of react-select components",
633
+ "type": {
634
+ "name": "object"
635
+ },
636
+ "required": false
627
637
  }
628
638
  }
629
639
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcs-design-system",
3
- "version": "3.1.33",
3
+ "version": "3.1.36",
4
4
  "engines": {
5
5
  "node": "18.17.1"
6
6
  },