@xqmsg/ui-core 0.19.2 → 0.19.3

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,5 +1,5 @@
1
1
  {
2
- "version": "0.19.2",
2
+ "version": "0.19.3",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -11,13 +11,13 @@ import { StackedInputProps } from '../StackedInput/StackedInput';
11
11
  import colors from '../../../theme/foundations/colors';
12
12
  import { UseFormSetValue, FieldValues, Control } from 'react-hook-form';
13
13
  import { Dropdown } from '../components/dropdown';
14
- import useDidMountEffect from '../../../hooks/useDidMountEffect';
15
14
  import { useOnClickOutside } from '../../../hooks/useOnOutsideClick';
16
15
  import { Dropdown as DropdownIcon } from '../../icons/dropdown';
17
16
  import { debounce } from 'lodash';
18
17
 
19
18
  export interface StackedSelectProps extends StackedInputProps {
20
19
  options: FieldOptions;
20
+ fullOptions?: FieldOptions;
21
21
  setValue: UseFormSetValue<FieldValues>;
22
22
  control: Control<FieldValues, any>;
23
23
  handleOnChange: (value?: string) => void;
@@ -36,6 +36,7 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
36
36
  handleOnChange,
37
37
  disabled,
38
38
  value,
39
+ fullOptions,
39
40
  ...props
40
41
  },
41
42
  _ref
@@ -64,11 +65,12 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
64
65
  }
65
66
  }, [boundingClientRect]);
66
67
 
67
- useDidMountEffect(() => {
68
+ useEffect(() => {
68
69
  setSelectedOption(
69
- options.find(option => option.value === value)?.label ?? ''
70
+ (fullOptions || options).find(option => option.value === value)
71
+ ?.label ?? ''
70
72
  );
71
- }, [value]);
73
+ }, [fullOptions, value]);
72
74
 
73
75
  useOnClickOutside(dropdownRef, () => setIsFocussed(false));
74
76
 
@@ -35,6 +35,7 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
35
35
  label?: string;
36
36
  className?: string;
37
37
  options?: FieldOptions;
38
+ fullOptions?: FieldOptions;
38
39
  maxLength?: number;
39
40
  helperText?: React.ReactNode;
40
41
  control: Control<T, any>;
@@ -67,6 +68,7 @@ export function Input<T extends FieldValues>({
67
68
  isRequired,
68
69
  maxLength,
69
70
  defaultValue,
71
+ fullOptions,
70
72
  control,
71
73
  disabled,
72
74
  rightElement,
@@ -136,6 +138,7 @@ export function Input<T extends FieldValues>({
136
138
  value={value}
137
139
  defaultValue={defaultValue}
138
140
  placeholder={placeholder}
141
+ fullOptions={fullOptions}
139
142
  />
140
143
  );
141
144
  case 'textarea':