@astral/ui 1.0.0-test.1671539620 → 1.0.0-test.1671604949

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.
@@ -24,14 +24,14 @@ const Checkbox_1 = require("../Checkbox");
24
24
  const OverflowTypography_1 = require("../OverflowTypography");
25
25
  const constants_1 = require("./constants");
26
26
  const Autocomplete = (props) => {
27
- const { multiple, placeholder, error, success, helperText, label, size = 'medium', getOptionLabel, renderOption: externalRenderOption, overflowOption } = props, restProps = __rest(props, ["multiple", "placeholder", "error", "success", "helperText", "label", "size", "getOptionLabel", "renderOption", "overflowOption"]);
27
+ const { multiple, placeholder, error, success, helperText, label, size = 'medium', getOptionLabel, renderOption: externalRenderOption, isOptionEqualToValue, overflowOption } = props, restProps = __rest(props, ["multiple", "placeholder", "error", "success", "helperText", "label", "size", "getOptionLabel", "renderOption", "isOptionEqualToValue", "overflowOption"]);
28
28
  const renderTags = (0, react_2.useCallback)((tags, getTagProps) => {
29
29
  return tags.map((tag, index) => {
30
30
  const title = (getOptionLabel && getOptionLabel(tag)) || '';
31
31
  return ((0, jsx_runtime_1.jsx)(Tag_1.Tag, Object.assign({ deleteIcon: (0, jsx_runtime_1.jsx)(icons_1.CrossSmOutlineSm, {}), color: "grey", label: title }, getTagProps({ index }))));
32
32
  });
33
33
  }, [getOptionLabel]);
34
- const isOptionEqualToValue = (0, react_2.useCallback)((option, value) => {
34
+ const handleIsOptionEqualToValue = (0, react_2.useCallback)((option, value) => {
35
35
  return JSON.stringify(option) === JSON.stringify(value);
36
36
  }, []);
37
37
  const renderInput = (0, react_2.useCallback)((inputParams) => ((0, jsx_runtime_1.jsx)(TextField_1.TextField, Object.assign({}, inputParams, { placeholder: placeholder, label: label, success: success, error: error, helperText: helperText, size: size }))), [placeholder, label, success, error, helperText, size]);
@@ -44,6 +44,6 @@ const Autocomplete = (props) => {
44
44
  multiple && ((0, jsx_runtime_1.jsx)(material_1.ListItemIcon, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { role: "menuitemcheckbox", checked: selected }) })),
45
45
  (0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, Object.assign({ rowsCount: constants_1.DEFAULT_AUTOCOMPLETE_ELEMENT_ROWS_COUNT }, overflowOption, { children: optionProps.key }))));
46
46
  }, [multiple, externalRenderOption]);
47
- return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, Object.assign({}, restProps, { size: size, multiple: multiple, getOptionLabel: getOptionLabel, disableCloseOnSelect: multiple, renderTags: renderTags, renderInput: renderInput, renderOption: renderOption, popupIcon: (0, jsx_runtime_1.jsx)(icons_1.ChevronDOutlineMd, {}), clearIcon: (0, jsx_runtime_1.jsx)(icons_1.CrossSmOutlineSm, {}), isOptionEqualToValue: isOptionEqualToValue, componentsProps: { clearIndicator: { disableRipple: true } }, noOptionsText: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })));
47
+ return ((0, jsx_runtime_1.jsx)(material_1.Autocomplete, Object.assign({}, restProps, { size: size, multiple: multiple, getOptionLabel: getOptionLabel, disableCloseOnSelect: multiple, renderTags: renderTags, renderInput: renderInput, renderOption: renderOption, popupIcon: (0, jsx_runtime_1.jsx)(icons_1.ChevronDOutlineMd, {}), clearIcon: (0, jsx_runtime_1.jsx)(icons_1.CrossSmOutlineSm, {}), isOptionEqualToValue: isOptionEqualToValue || handleIsOptionEqualToValue, componentsProps: { clearIndicator: { disableRipple: true } }, noOptionsText: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })));
48
48
  };
49
49
  exports.Autocomplete = Autocomplete;
@@ -21,14 +21,14 @@ import { Checkbox } from '../Checkbox';
21
21
  import { OverflowTypography, } from '../OverflowTypography';
22
22
  import { DEFAULT_AUTOCOMPLETE_ELEMENT_ROWS_COUNT } from './constants';
23
23
  export const Autocomplete = (props) => {
24
- const { multiple, placeholder, error, success, helperText, label, size = 'medium', getOptionLabel, renderOption: externalRenderOption, overflowOption } = props, restProps = __rest(props, ["multiple", "placeholder", "error", "success", "helperText", "label", "size", "getOptionLabel", "renderOption", "overflowOption"]);
24
+ const { multiple, placeholder, error, success, helperText, label, size = 'medium', getOptionLabel, renderOption: externalRenderOption, isOptionEqualToValue, overflowOption } = props, restProps = __rest(props, ["multiple", "placeholder", "error", "success", "helperText", "label", "size", "getOptionLabel", "renderOption", "isOptionEqualToValue", "overflowOption"]);
25
25
  const renderTags = useCallback((tags, getTagProps) => {
26
26
  return tags.map((tag, index) => {
27
27
  const title = (getOptionLabel && getOptionLabel(tag)) || '';
28
28
  return (_jsx(Tag, Object.assign({ deleteIcon: _jsx(CrossSmOutlineSm, {}), color: "grey", label: title }, getTagProps({ index }))));
29
29
  });
30
30
  }, [getOptionLabel]);
31
- const isOptionEqualToValue = useCallback((option, value) => {
31
+ const handleIsOptionEqualToValue = useCallback((option, value) => {
32
32
  return JSON.stringify(option) === JSON.stringify(value);
33
33
  }, []);
34
34
  const renderInput = useCallback((inputParams) => (_jsx(TextField, Object.assign({}, inputParams, { placeholder: placeholder, label: label, success: success, error: error, helperText: helperText, size: size }))), [placeholder, label, success, error, helperText, size]);
@@ -41,5 +41,5 @@ export const Autocomplete = (props) => {
41
41
  multiple && (_jsx(ListItemIcon, { children: _jsx(Checkbox, { role: "menuitemcheckbox", checked: selected }) })),
42
42
  _jsx(OverflowTypography, Object.assign({ rowsCount: DEFAULT_AUTOCOMPLETE_ELEMENT_ROWS_COUNT }, overflowOption, { children: optionProps.key }))));
43
43
  }, [multiple, externalRenderOption]);
44
- return (_jsx(MuiAutocomplete, Object.assign({}, restProps, { size: size, multiple: multiple, getOptionLabel: getOptionLabel, disableCloseOnSelect: multiple, renderTags: renderTags, renderInput: renderInput, renderOption: renderOption, popupIcon: _jsx(ChevronDOutlineMd, {}), clearIcon: _jsx(CrossSmOutlineSm, {}), isOptionEqualToValue: isOptionEqualToValue, componentsProps: { clearIndicator: { disableRipple: true } }, noOptionsText: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })));
44
+ return (_jsx(MuiAutocomplete, Object.assign({}, restProps, { size: size, multiple: multiple, getOptionLabel: getOptionLabel, disableCloseOnSelect: multiple, renderTags: renderTags, renderInput: renderInput, renderOption: renderOption, popupIcon: _jsx(ChevronDOutlineMd, {}), clearIcon: _jsx(CrossSmOutlineSm, {}), isOptionEqualToValue: isOptionEqualToValue || handleIsOptionEqualToValue, componentsProps: { clearIndicator: { disableRipple: true } }, noOptionsText: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })));
45
45
  };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.0.0-test.1671539620",
3
+ "version": "1.0.0-test.1671604949",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.0.0-test.1671539620",
7
+ "@astral/icons": "^1.0.0-test.1671604949",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",