aefis-core-ui 2.3.0-rc12 → 2.3.0-rc14

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.
@@ -10,6 +10,7 @@ import { red, orange, green, blue, grey, yellow, indigo, purple, cyan, teal, lim
10
10
  import makeStyles$1 from '@mui/styles/makeStyles';
11
11
  import withStyles from '@mui/styles/withStyles';
12
12
  import { useTheme, alpha, createTheme as createTheme$1, ThemeProvider, styled as styled$1, StyledEngineProvider } from '@mui/material/styles';
13
+ import { useFormControl } from '@mui/material/FormControl';
13
14
  import mustache from 'mustache';
14
15
  import { Box as Box$2 } from '@mui/system';
15
16
  import { Skeleton as Skeleton$4, TextField as TextField$1, Box as Box$3 } from '@mui/material/';
@@ -67,12 +68,8 @@ import 'lodash/camelCase';
67
68
  import debounce from 'lodash/debounce';
68
69
  import StepConnector, { stepConnectorClasses } from '@mui/material/StepConnector';
69
70
  import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
70
- import '@mui/icons-material/KeyboardArrowUpOutlined';
71
- import '@mui/icons-material/KeyboardArrowDownOutlined';
72
- import { MenuButton as MenuButton$1 } from 'core-ui';
73
71
  import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
74
72
  import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
75
- import 'core-ui/components/AnimatedExpandMoreIcon/AnimatedExpandMoreIcon';
76
73
  import '@mui/icons-material/MoreVert';
77
74
  import produce from 'immer';
78
75
  import { v4 } from 'uuid';
@@ -81,7 +78,6 @@ import isEmpty from 'lodash/isEmpty';
81
78
  import compose from 'lodash/fp/compose';
82
79
  import Chip$2 from '@mui/material/Chip';
83
80
  import TextField$2 from '@mui/material/TextField';
84
- import { useFormControl } from '@mui/material/FormControl';
85
81
  import get$1 from 'lodash/get';
86
82
  import isPlainObject from 'lodash/isPlainObject';
87
83
  import ToggleButton$1 from '@mui/material/ToggleButton';
@@ -2284,10 +2280,10 @@ ClickWrapper.propTypes = {
2284
2280
  const Chip = ({
2285
2281
  id,
2286
2282
  colorPalette,
2287
- size,
2283
+ size: _size2 = "medium",
2288
2284
  icon,
2289
2285
  label,
2290
- displayType,
2286
+ displayType: _displayType = "default",
2291
2287
  deleteIcon,
2292
2288
  onDelete,
2293
2289
  canDelete,
@@ -2295,7 +2291,7 @@ const Chip = ({
2295
2291
  }) => {
2296
2292
  const keyValue = useUID();
2297
2293
  const colors = _extends({}, defaultColorPalette, colorPalette);
2298
- const _size = size === "medium" || size === "large" ? "medium" : size;
2294
+ const _size = _size2 === "medium" || _size2 === "large" ? "medium" : _size2;
2299
2295
  const styles = {
2300
2296
  outlined: {
2301
2297
  borderWidth: 2,
@@ -2315,14 +2311,14 @@ const Chip = ({
2315
2311
  }
2316
2312
  };
2317
2313
  let chipStyles = styles.chip;
2318
- if (displayType === "outlined") chipStyles = styles.outlined;
2319
- if (displayType === "withOutline") chipStyles = styles.withOutline;
2314
+ if (_displayType === "outlined") chipStyles = styles.outlined;
2315
+ if (_displayType === "withOutline") chipStyles = styles.withOutline;
2320
2316
  const chipProps = {
2321
2317
  key: id || keyValue,
2322
2318
  icon,
2323
2319
  label,
2324
2320
  sx: chipStyles,
2325
- variant: displayType === "withOutline" ? "default" : displayType,
2321
+ variant: _displayType === "withOutline" ? "default" : _displayType,
2326
2322
  size: _size,
2327
2323
  deleteIcon: deleteIcon || /*#__PURE__*/jsx(ClickWrapper, {
2328
2324
  label: label,
@@ -2339,12 +2335,20 @@ const Chip = ({
2339
2335
  })
2340
2336
  })
2341
2337
  };
2342
- const Chip = () => /*#__PURE__*/jsx(Chip$1, _extends({
2343
- role: role || "presentation",
2344
- "aria-label": label
2345
- }, chipProps, canDelete && {
2346
- onDelete
2347
- }));
2338
+ const {
2339
+ disabled
2340
+ } = useFormControl();
2341
+ const _canDelete = canDelete && !disabled;
2342
+ const Chip = () => {
2343
+ return /*#__PURE__*/jsx(Chip$1, _extends({
2344
+ role: role || "presentation",
2345
+ "aria-label": label
2346
+ }, chipProps, _canDelete && {
2347
+ onDelete
2348
+ }, {
2349
+ disabled: disabled
2350
+ }));
2351
+ };
2348
2352
 
2349
2353
  /**return tooltipText ? (
2350
2354
  <Tooltip title={tooltipText}>
@@ -2384,12 +2388,6 @@ Chip.propTypes = {
2384
2388
  /** ARIA Role attribute */
2385
2389
  role: PropTypes.string
2386
2390
  };
2387
- Chip.defaultProps = {
2388
- size: "medium",
2389
- variant: "default",
2390
- canRemove: false,
2391
- displayType: "default"
2392
- };
2393
2391
 
2394
2392
  const colorPalette$v = {
2395
2393
  light: grey[200],
@@ -11322,7 +11320,8 @@ const BusinessObjectPicker = _ref => {
11322
11320
  tooltipText: option.description,
11323
11321
  size: props.size === "medium" || props.size === "small" ? "small" : "large",
11324
11322
  onDelete: () => handleTagDelete(option),
11325
- canDelete: true
11323
+ canDelete: true,
11324
+ displayType: "default"
11326
11325
  })
11327
11326
  }, getKey(option))), [props.size, getKey, getLabel, handleTagDelete]);
11328
11327
  const renderTypeTags = useCallback(value => value.map(option => /*#__PURE__*/jsx(Box$1, {
@@ -11371,7 +11370,11 @@ const BusinessObjectPicker = _ref => {
11371
11370
  value: value,
11372
11371
  renderOption: renderOptionProp || (props.type ? renderBusinessObject : renderOption),
11373
11372
  noOptionsText: status === "error" ? "Error loading options" : "No options",
11374
- getOptionDisabled: optionItem => (optionItem == null ? void 0 : optionItem.__type) === "loadMore" || (optionItem == null ? void 0 : optionItem.__type) === "noOption",
11373
+ getOptionDisabled: optionItem => {
11374
+ if (props.disabled) return true;
11375
+ const type = optionItem == null ? void 0 : optionItem.__type;
11376
+ return type === "loadMore" || type === "noOption";
11377
+ },
11375
11378
  handleHomeEndKeys: true
11376
11379
  // INFO: freeSolo prevents warning:
11377
11380
  // https://stackoverflow.com/questions/61947941/material-ui-autocomplete-warning-the-value-provided-to-autocomplete-is-invalid
@@ -11404,7 +11407,7 @@ const BusinessObjectPicker = _ref => {
11404
11407
  style: {
11405
11408
  color: red[500]
11406
11409
  }
11407
- }), listSelect !== true && /*#__PURE__*/jsx(IconButton$1, {
11410
+ }), listSelect !== true && /*#__PURE__*/jsx(IconButton, {
11408
11411
  "aria-label": open ? `hide options` : "show options",
11409
11412
  size: "small",
11410
11413
  onClick: () => {
@@ -11417,7 +11420,7 @@ const BusinessObjectPicker = _ref => {
11417
11420
  [classes.expandOpen]: open
11418
11421
  })
11419
11422
  })
11420
- }), enhancedSearch && /*#__PURE__*/jsx(IconButton$1, {
11423
+ }), enhancedSearch && /*#__PURE__*/jsx(IconButton, {
11421
11424
  "aria-label": "search",
11422
11425
  size: "small",
11423
11426
  onKeyDown: handleKeyDown,
@@ -11425,6 +11428,7 @@ const BusinessObjectPicker = _ref => {
11425
11428
  name: events.OPEN_ENHANCED_SEARCH_DIALOG,
11426
11429
  payload: true
11427
11430
  }),
11431
+ disabled: props.disabled,
11428
11432
  children: /*#__PURE__*/jsx(Search, {})
11429
11433
  })]
11430
11434
  })
@@ -11447,13 +11451,14 @@ const BusinessObjectPicker = _ref => {
11447
11451
  flexDirection: "column",
11448
11452
  padding: 1
11449
11453
  },
11450
- children: /*#__PURE__*/jsx(IconButton$1, {
11454
+ children: /*#__PURE__*/jsx(IconButton, {
11451
11455
  onClick: () => {
11452
11456
  eventDispatch({
11453
11457
  name: events.OPEN_ADD_ITEM_DIALOG,
11454
11458
  payload: true
11455
11459
  });
11456
11460
  },
11461
+ disabled: props.disabled,
11457
11462
  children: /*#__PURE__*/jsx(AddIcon, {
11458
11463
  sx: {
11459
11464
  color: "grey"
@@ -15398,7 +15403,7 @@ function Row({
15398
15403
  width: "48px",
15399
15404
  marginTop: "22px"
15400
15405
  },
15401
- children: /*#__PURE__*/jsx(MenuButton$1, {
15406
+ children: /*#__PURE__*/jsx(MenuButton, {
15402
15407
  displayType: "icon",
15403
15408
  menuConfiguration: [{
15404
15409
  name: "Move Up",