@sonardigital/carbon-ui 1.2.28 → 1.2.29

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonardigital/carbon-ui",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -59,6 +59,7 @@
59
59
  "@mui/material": "^7.3.2",
60
60
  "@mui/x-date-pickers": "^8.12.0",
61
61
  "@sonardigital/cli": "^1.6.4",
62
+ "@sonardigital/hooks": "^1.1.6",
62
63
  "dayjs": "^1.11.18",
63
64
  "eslint-plugin-react": "^7.34.3",
64
65
  "eslint-plugin-storybook": "^0.8.0",
@@ -3,6 +3,8 @@ import { Controller } from 'react-hook-form';
3
3
  import { FormLabel } from '../layout';
4
4
  import { FormError } from '../layout/FormError';
5
5
  import { SelectAutocomplete } from '../../inputs';
6
+ import { useDebounce } from '@sonardigital/hooks';
7
+ import { useState } from 'react';
6
8
 
7
9
  // eslint-disable-next-line
8
10
  interface SelectAutocompleteProps extends Omit<
@@ -16,6 +18,7 @@ interface SelectAutocompleteProps extends Omit<
16
18
  > {
17
19
  name: string;
18
20
  label: string;
21
+ onDebounce?: (value: string) => void;
19
22
  placeholder?: string;
20
23
  options?: { label: string; value: string | number }[];
21
24
  helperText?: string;
@@ -27,8 +30,13 @@ export function FormSelect({
27
30
  label,
28
31
  options,
29
32
  helperText,
33
+ onDebounce,
30
34
  ...rest
31
35
  }: SelectAutocompleteProps): React.ReactElement {
36
+ const [search, setSearch] = useState('');
37
+
38
+ useDebounce(search, 500, onDebounce);
39
+
32
40
  return (
33
41
  <Controller
34
42
  name={name}
@@ -42,6 +50,7 @@ export function FormSelect({
42
50
  {...rest}
43
51
  options={options}
44
52
  value={value}
53
+ onInputChange={(value) => setSearch((value?.target as HTMLInputElement)?.value ?? '')}
45
54
  onChange={onChange}
46
55
  />
47
56
  {fieldState.error && (