@astral/ui 1.54.0 → 1.56.0

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,7 +24,7 @@ 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: externalOptionEqualToValue, 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)) || '';
@@ -32,8 +32,11 @@ const Autocomplete = (props) => {
32
32
  });
33
33
  }, [getOptionLabel]);
34
34
  const isOptionEqualToValue = (0, react_2.useCallback)((option, value) => {
35
+ if (externalOptionEqualToValue) {
36
+ return externalOptionEqualToValue(option, value);
37
+ }
35
38
  return JSON.stringify(option) === JSON.stringify(value);
36
- }, []);
39
+ }, [externalOptionEqualToValue]);
37
40
  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]);
38
41
  const renderOption = (0, react_2.useCallback)((optionProps, option, optionState) => {
39
42
  if (externalRenderOption) {
@@ -21,7 +21,7 @@ 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: externalOptionEqualToValue, 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)) || '';
@@ -29,8 +29,11 @@ export const Autocomplete = (props) => {
29
29
  });
30
30
  }, [getOptionLabel]);
31
31
  const isOptionEqualToValue = useCallback((option, value) => {
32
+ if (externalOptionEqualToValue) {
33
+ return externalOptionEqualToValue(option, value);
34
+ }
32
35
  return JSON.stringify(option) === JSON.stringify(value);
33
- }, []);
36
+ }, [externalOptionEqualToValue]);
34
37
  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]);
35
38
  const renderOption = useCallback((optionProps, option, optionState) => {
36
39
  if (externalRenderOption) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.54.0",
3
+ "version": "1.56.0",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.54.0",
7
+ "@astral/icons": "^1.56.0",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",