@groupeactual/ui-kit 1.0.6 → 1.0.8

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.
@@ -65,7 +65,7 @@ const AutocompleteMultipleSelect = <T,>({
65
65
  const [inputValue, setInputValue] = useState('');
66
66
 
67
67
  const handleValueChange = (
68
- event: React.SyntheticEvent<Element, Event>,
68
+ _event: React.SyntheticEvent<Element, Event>,
69
69
  newValue: T[]
70
70
  ) => {
71
71
  setValue(newValue);
@@ -76,7 +76,7 @@ const AutocompleteMultipleSelect = <T,>({
76
76
  };
77
77
 
78
78
  const handleInputChange = (
79
- event: React.SyntheticEvent<Element, Event>,
79
+ _event: React.SyntheticEvent<Element, Event>,
80
80
  newInputValue: string
81
81
  ) => {
82
82
  setInputValue(newInputValue);
@@ -88,9 +88,14 @@ const AutocompleteMultipleSelect = <T,>({
88
88
  };
89
89
 
90
90
  const handleDeleteChip = (chipValue: T) => {
91
- const newValue = value?.filter((val) => val !== chipValue);
92
- if (onChange) onChange(newValue);
93
- setValue(newValue);
91
+ const newValue = props?.value ?
92
+ props?.value?.filter((val) => val !== chipValue) :
93
+ value?.filter((val) => val !== chipValue);
94
+
95
+ if (newValue) {
96
+ if (onChange) onChange(newValue);
97
+ setValue(newValue);
98
+ }
94
99
  };
95
100
 
96
101
  const preventEventPropagation = (event: React.MouseEvent) => {
@@ -127,12 +132,12 @@ const AutocompleteMultipleSelect = <T,>({
127
132
  value={value}
128
133
  onChange={handleValueChange}
129
134
  onInputChange={handleInputChange}
135
+ inputValue={inputValue}
130
136
  {...props}
131
137
  placeholder={value.length || label === placeholder ? '' : placeholder}
132
138
  disableCloseOnSelect
133
139
  multiple
134
140
  disabled={disabled}
135
- inputValue={inputValue}
136
141
  options={options}
137
142
  clearIcon={
138
143
  <>
@@ -154,10 +159,10 @@ const AutocompleteMultipleSelect = <T,>({
154
159
  size={color === 'success' ? 'md' : 'sm'}
155
160
  />
156
161
  }
157
- renderTags={(value: T[]) => {
162
+ renderTags={(tag: T[]) => {
158
163
  return (
159
164
  <>
160
- {value.map((selectedOption: T, index: number) => (
165
+ {tag.map((selectedOption: T, _index: number) => (
161
166
  <Chip
162
167
  key={getKeyValue(selectedOption)}
163
168
  variant="filled"
@@ -85,7 +85,7 @@ const MultiSelect = <T extends {}>({
85
85
  };
86
86
 
87
87
  const getFormControlClassName = useMemo(() => {
88
- const classNames: string[] = ['DsSelect'];
88
+ const classNames: string[] = ['DsMultiSelect'];
89
89
 
90
90
  if (label === placeholder) {
91
91
  classNames.push('Select-mui');
@@ -63,7 +63,7 @@ const Select = <T extends {}>({
63
63
  };
64
64
 
65
65
  const getFormControlClassName = useMemo(() => {
66
- const classNames: string[] = [];
66
+ const classNames: string[] = ['DSSingleSelect'];
67
67
 
68
68
  if (label === placeholder) {
69
69
  classNames.push('Select-mui');