@galaxy-ds/core 1.1.81 → 1.1.82

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,4 +1,4 @@
1
- import React from "react";
2
- import { AutocompleteProps } from "./Autocomplete.types";
3
- declare const Autocomplete: React.FC<AutocompleteProps>;
1
+ import React from 'react';
2
+ import { CustomAutocompleteProps } from './Autocomplete.types';
3
+ declare const Autocomplete: React.FC<CustomAutocompleteProps<any, false, false, false>>;
4
4
  export default Autocomplete;
@@ -1,81 +1,28 @@
1
- /// <reference types="react" />
2
- export interface AutocompleteProps {
1
+ import { AutocompleteProps } from '@material-ui/lab';
2
+ export interface CustomAutocompleteProps<T, Multiple, DisableClearable, FreeSolo> extends AutocompleteProps<any, false, false, false> {
3
3
  /**
4
4
  * Custom action label to prepend at the bottom of the option list.
5
5
  */
6
6
  actionLabel?: string;
7
- autoComplete?: boolean;
8
- bottomButtonHeight?: number;
9
- defaultValue?: any;
10
7
  /**
11
8
  * A function fires when clicking the custom action button prepended at the bottom of the option list.
12
9
  */
13
10
  actionClick?: (e: any) => void;
14
- /**
15
- * If true, the input will be disabled.
16
- */
17
- disabled?: boolean;
18
- /**
19
- * If true, the input can't be cleared.
20
- */
21
- disableClearable?: boolean;
22
- /**
23
- * A filter function that determines the options that are eligible
24
- */
25
- filterOptions?: (options: any, state: any) => any;
26
- /**
27
- * If true, the Autocomplete is free solo, meaning that the user input is not bound to provided options.
28
- */
29
- freeSolo?: boolean;
11
+ bottomButtonHeight?: number;
30
12
  /**
31
13
  * If true, sets the Autocomplete text field to readonly.
32
14
  */
33
15
  textFieldReadOnly?: boolean;
34
- /**
35
- * Used to determine the string value for a given option. It's used to fill the input (and the list box options if renderOption is not provided).
36
- */
37
- getOptionLabel?: (option: any) => string;
38
16
  /**
39
17
  * Input label
40
18
  */
41
19
  label?: string;
42
- ListboxComponent?: any;
43
- /**
44
- * If true, value must be an array and the menu will support multiple selections.
45
- */
46
- multiple?: boolean;
47
- /**
48
- * Text to display when there are no options.
49
- */
50
- noOptionsText?: React.ReactNode;
51
- /**
52
- * Callback fired when the value changes.
53
- */
54
- onChange?: (event: object, value: any | any[], reason: string) => any;
55
- open?: boolean;
56
20
  onKeyDown?: (event: object) => void;
57
- /**
58
- * Array of options.
59
- */
60
- options: any[];
21
+ onBlur?: (e: any | undefined) => void;
22
+ onFocus?: (e: any | undefined) => void;
61
23
  /**
62
24
  * Placeholder passed to input
63
25
  */
64
26
  placeholder?: string;
65
27
  platform: 'desktop' | 'web';
66
- /**
67
- * Render the selected value.
68
- * (value: T[], getTagProps: function) => ReactNode
69
- * value: The value provided to the component.
70
- * getTagProps: A tag props getter.
71
- */
72
- renderTags?: (value: any, getTagProps: any) => React.ReactNode;
73
- /**
74
- * Render the option, use getOptionLabel by default.
75
- */
76
- renderOption?: (option: any, state: any) => React.ReactNode;
77
- filterSelectedOptions?: boolean;
78
- fullWidth?: boolean;
79
- onBlur?: (e: any | undefined) => void;
80
- onFocus?: (e: any | undefined) => void;
81
28
  }
package/dist/index.esm.js CHANGED
@@ -33264,9 +33264,7 @@ var useStyles$z = makeStyles(function (theme) {
33264
33264
  '&[class*="MuiInput-root"]': {
33265
33265
  height: 'auto',
33266
33266
  paddingBottom: 2,
33267
- paddingLeft: function (props) {
33268
- return props.platform === 'desktop' ? 0 : 2;
33269
- },
33267
+ paddingLeft: function (props) { return (props.platform === 'desktop' ? 0 : 2); },
33270
33268
  // flexWrap: 'nowrap',
33271
33269
  // overflowX: 'auto',
33272
33270
  // overflowY: 'hidden',
@@ -33281,7 +33279,7 @@ var useStyles$z = makeStyles(function (theme) {
33281
33279
  '-webkit-box-shadow': 'inset 0 0 6px rgba(0,0,0,0.05)',
33282
33280
  borderRadius: 8,
33283
33281
  backgroundColor: '#f3f3f3',
33284
- opacity: 0.05
33282
+ opacity: 0.05,
33285
33283
  },
33286
33284
  '&::-webkit-scrollbar-thumb': {
33287
33285
  borderRadius: 8,
@@ -33340,7 +33338,7 @@ var useStyles$z = makeStyles(function (theme) {
33340
33338
  });
33341
33339
  var Autocomplete = function (_a) {
33342
33340
  var _b;
33343
- var label = _a.label, placeholder = _a.placeholder, _c = _a.platform, platform = _c === void 0 ? 'desktop' : _c, actionLabel = _a.actionLabel, actionClick = _a.actionClick, onChange = _a.onChange, bottomButtonHeight = _a.bottomButtonHeight, textFieldReadOnly = _a.textFieldReadOnly, rest = __rest(_a, ["label", "placeholder", "platform", "actionLabel", "actionClick", "onChange", "bottomButtonHeight", "textFieldReadOnly"]);
33341
+ var label = _a.label, placeholder = _a.placeholder, _c = _a.platform, platform = _c === void 0 ? 'desktop' : _c, actionLabel = _a.actionLabel, actionClick = _a.actionClick, bottomButtonHeight = _a.bottomButtonHeight, textFieldReadOnly = _a.textFieldReadOnly, onChange = _a.onChange, rest = __rest(_a, ["label", "placeholder", "platform", "actionLabel", "actionClick", "bottomButtonHeight", "textFieldReadOnly", "onChange"]);
33344
33342
  var classes = useStyles$z({ platform: platform, bottomButtonHeight: bottomButtonHeight });
33345
33343
  var _d = useState(!((_b = rest.defaultValue) === null || _b === void 0 ? void 0 : _b.length) ? placeholder : null), inputPlaceholder = _d[0], setInputPlaceholder = _d[1];
33346
33344
  var root = useRef(null);
@@ -33361,16 +33359,16 @@ var Autocomplete = function (_a) {
33361
33359
  actionLabel && (React__default.createElement(React__default.Fragment, null,
33362
33360
  React__default.createElement(Divider, null),
33363
33361
  React__default.createElement(MuiListItem, { button: true, dense: true, onMouseDown: actionClick },
33364
- React__default.createElement(Box$2, { display: 'flex', justifyContent: 'center', width: '100%', padding: platform === 'desktop' ? 1 : 2 },
33365
- React__default.createElement(Typography, { variant: platform === 'desktop' ? 'body1' : 'body2', color: 'primaryLight', align: 'center' }, actionLabel))))))));
33362
+ React__default.createElement(Box$2, { display: "flex", justifyContent: "center", width: '100%', padding: platform === 'desktop' ? 1 : 2 },
33363
+ React__default.createElement(Typography, { variant: platform === 'desktop' ? 'body1' : 'body2', color: "primaryLight", align: "center" }, actionLabel))))))));
33366
33364
  };
33367
33365
  return (React__default.createElement(React__default.Fragment, null,
33368
33366
  label && React__default.createElement(InputLabel, null, label),
33369
- React__default.createElement(MuiAutocomplete, __assign$1({ classes: classes, disableClearable: true, renderInput: function (params) { return (React__default.createElement(TextField$1, __assign$1({}, params, { inputProps: __assign$1(__assign$1({}, params.inputProps), { autoComplete: "new-password", readOnly: textFieldReadOnly }), placeholder: inputPlaceholder, className: "customLargeSize" }))); }, PaperComponent: CustomPaper, onChange: function (event, value, reason) {
33367
+ React__default.createElement(MuiAutocomplete, __assign$1({ classes: classes, disableClearable: true, renderInput: function (params) { return (React__default.createElement(TextField$1, __assign$1({}, params, { inputProps: __assign$1(__assign$1({}, params.inputProps), { autoComplete: 'new-password', readOnly: textFieldReadOnly }), placeholder: inputPlaceholder, className: "customLargeSize" }))); }, PaperComponent: CustomPaper, onChange: function (event, value, reason) {
33368
+ onChange && onChange(event, value, reason);
33370
33369
  value && value.length > 0
33371
33370
  ? setInputPlaceholder(null)
33372
33371
  : setInputPlaceholder(placeholder);
33373
- onChange && onChange(event, value, reason);
33374
33372
  }, onKeyDown: onKeyDownHandler, ref: root }, rest))));
33375
33373
  };
33376
33374