aefis-core-ui 2.3.0-rc13 → 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/';
@@ -77,7 +78,6 @@ import isEmpty from 'lodash/isEmpty';
77
78
  import compose from 'lodash/fp/compose';
78
79
  import Chip$2 from '@mui/material/Chip';
79
80
  import TextField$2 from '@mui/material/TextField';
80
- import { useFormControl } from '@mui/material/FormControl';
81
81
  import get$1 from 'lodash/get';
82
82
  import isPlainObject from 'lodash/isPlainObject';
83
83
  import ToggleButton$1 from '@mui/material/ToggleButton';
@@ -2280,10 +2280,10 @@ ClickWrapper.propTypes = {
2280
2280
  const Chip = ({
2281
2281
  id,
2282
2282
  colorPalette,
2283
- size,
2283
+ size: _size2 = "medium",
2284
2284
  icon,
2285
2285
  label,
2286
- displayType,
2286
+ displayType: _displayType = "default",
2287
2287
  deleteIcon,
2288
2288
  onDelete,
2289
2289
  canDelete,
@@ -2291,7 +2291,7 @@ const Chip = ({
2291
2291
  }) => {
2292
2292
  const keyValue = useUID();
2293
2293
  const colors = _extends({}, defaultColorPalette, colorPalette);
2294
- const _size = size === "medium" || size === "large" ? "medium" : size;
2294
+ const _size = _size2 === "medium" || _size2 === "large" ? "medium" : _size2;
2295
2295
  const styles = {
2296
2296
  outlined: {
2297
2297
  borderWidth: 2,
@@ -2311,14 +2311,14 @@ const Chip = ({
2311
2311
  }
2312
2312
  };
2313
2313
  let chipStyles = styles.chip;
2314
- if (displayType === "outlined") chipStyles = styles.outlined;
2315
- if (displayType === "withOutline") chipStyles = styles.withOutline;
2314
+ if (_displayType === "outlined") chipStyles = styles.outlined;
2315
+ if (_displayType === "withOutline") chipStyles = styles.withOutline;
2316
2316
  const chipProps = {
2317
2317
  key: id || keyValue,
2318
2318
  icon,
2319
2319
  label,
2320
2320
  sx: chipStyles,
2321
- variant: displayType === "withOutline" ? "default" : displayType,
2321
+ variant: _displayType === "withOutline" ? "default" : _displayType,
2322
2322
  size: _size,
2323
2323
  deleteIcon: deleteIcon || /*#__PURE__*/jsx(ClickWrapper, {
2324
2324
  label: label,
@@ -2335,12 +2335,20 @@ const Chip = ({
2335
2335
  })
2336
2336
  })
2337
2337
  };
2338
- const Chip = () => /*#__PURE__*/jsx(Chip$1, _extends({
2339
- role: role || "presentation",
2340
- "aria-label": label
2341
- }, chipProps, canDelete && {
2342
- onDelete
2343
- }));
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
+ };
2344
2352
 
2345
2353
  /**return tooltipText ? (
2346
2354
  <Tooltip title={tooltipText}>
@@ -2380,12 +2388,6 @@ Chip.propTypes = {
2380
2388
  /** ARIA Role attribute */
2381
2389
  role: PropTypes.string
2382
2390
  };
2383
- Chip.defaultProps = {
2384
- size: "medium",
2385
- variant: "default",
2386
- canRemove: false,
2387
- displayType: "default"
2388
- };
2389
2391
 
2390
2392
  const colorPalette$v = {
2391
2393
  light: grey[200],
@@ -11318,7 +11320,8 @@ const BusinessObjectPicker = _ref => {
11318
11320
  tooltipText: option.description,
11319
11321
  size: props.size === "medium" || props.size === "small" ? "small" : "large",
11320
11322
  onDelete: () => handleTagDelete(option),
11321
- canDelete: true
11323
+ canDelete: true,
11324
+ displayType: "default"
11322
11325
  })
11323
11326
  }, getKey(option))), [props.size, getKey, getLabel, handleTagDelete]);
11324
11327
  const renderTypeTags = useCallback(value => value.map(option => /*#__PURE__*/jsx(Box$1, {
@@ -11367,7 +11370,11 @@ const BusinessObjectPicker = _ref => {
11367
11370
  value: value,
11368
11371
  renderOption: renderOptionProp || (props.type ? renderBusinessObject : renderOption),
11369
11372
  noOptionsText: status === "error" ? "Error loading options" : "No options",
11370
- 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
+ },
11371
11378
  handleHomeEndKeys: true
11372
11379
  // INFO: freeSolo prevents warning:
11373
11380
  // https://stackoverflow.com/questions/61947941/material-ui-autocomplete-warning-the-value-provided-to-autocomplete-is-invalid
@@ -11400,7 +11407,7 @@ const BusinessObjectPicker = _ref => {
11400
11407
  style: {
11401
11408
  color: red[500]
11402
11409
  }
11403
- }), listSelect !== true && /*#__PURE__*/jsx(IconButton$1, {
11410
+ }), listSelect !== true && /*#__PURE__*/jsx(IconButton, {
11404
11411
  "aria-label": open ? `hide options` : "show options",
11405
11412
  size: "small",
11406
11413
  onClick: () => {
@@ -11413,7 +11420,7 @@ const BusinessObjectPicker = _ref => {
11413
11420
  [classes.expandOpen]: open
11414
11421
  })
11415
11422
  })
11416
- }), enhancedSearch && /*#__PURE__*/jsx(IconButton$1, {
11423
+ }), enhancedSearch && /*#__PURE__*/jsx(IconButton, {
11417
11424
  "aria-label": "search",
11418
11425
  size: "small",
11419
11426
  onKeyDown: handleKeyDown,
@@ -11421,6 +11428,7 @@ const BusinessObjectPicker = _ref => {
11421
11428
  name: events.OPEN_ENHANCED_SEARCH_DIALOG,
11422
11429
  payload: true
11423
11430
  }),
11431
+ disabled: props.disabled,
11424
11432
  children: /*#__PURE__*/jsx(Search, {})
11425
11433
  })]
11426
11434
  })
@@ -11443,13 +11451,14 @@ const BusinessObjectPicker = _ref => {
11443
11451
  flexDirection: "column",
11444
11452
  padding: 1
11445
11453
  },
11446
- children: /*#__PURE__*/jsx(IconButton$1, {
11454
+ children: /*#__PURE__*/jsx(IconButton, {
11447
11455
  onClick: () => {
11448
11456
  eventDispatch({
11449
11457
  name: events.OPEN_ADD_ITEM_DIALOG,
11450
11458
  payload: true
11451
11459
  });
11452
11460
  },
11461
+ disabled: props.disabled,
11453
11462
  children: /*#__PURE__*/jsx(AddIcon, {
11454
11463
  sx: {
11455
11464
  color: "grey"