react-restyle-components 0.3.22 → 0.3.23

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.
@@ -2,12 +2,12 @@ import React from 'react';
2
2
  interface SingleSelectProps {
3
3
  options: Array<any>;
4
4
  displayKey?: string;
5
- value?: string;
5
+ displayValue?: string;
6
6
  hasError?: boolean;
7
7
  className?: string;
8
8
  style?: React.CSSProperties;
9
9
  onSelect: (item: any) => any;
10
10
  }
11
- export declare const SingleSelect: ({ options, displayKey, hasError, className, style, onSelect, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const SingleSelect: ({ options, displayKey, displayValue, hasError, className, style, onSelect, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export {};
13
13
  //# sourceMappingURL=single-select.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"single-select.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/molecules/single-select/single-select.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,UAAU,iBAAiB;IACzB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,mEAOtB,iBAAiB,4CA+JnB,CAAC"}
1
+ {"version":3,"file":"single-select.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/molecules/single-select/single-select.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAKzD,UAAU,iBAAiB;IACzB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,iFAQtB,iBAAiB,4CAsKnB,CAAC"}
@@ -3,7 +3,7 @@ import { useState, useEffect, useRef } from 'react';
3
3
  import { Icon } from '../../..';
4
4
  import s from '../../tc.module.css';
5
5
  import { cn } from '../../utils';
6
- export const SingleSelect = ({ options = [], displayKey = 'title', hasError = false, className = '', style = {}, onSelect, }) => {
6
+ export const SingleSelect = ({ options = [], displayKey = 'title', displayValue = '', hasError = false, className = '', style = {}, onSelect, }) => {
7
7
  const [value, setValue] = useState('');
8
8
  const [isListOpen, setIsListOpen] = useState(false);
9
9
  // Arrow navigation state
@@ -25,6 +25,8 @@ export const SingleSelect = ({ options = [], displayKey = 'title', hasError = fa
25
25
  useOutsideAlerter(wrapperRef);
26
26
  // Keyboard navigation
27
27
  useEffect(() => {
28
+ if (displayValue)
29
+ setValue(displayValue);
28
30
  if (!isListOpen)
29
31
  return;
30
32
  const handleKeyDown = (e) => {
@@ -41,11 +43,16 @@ export const SingleSelect = ({ options = [], displayKey = 'title', hasError = fa
41
43
  setIsListOpen(false);
42
44
  }
43
45
  };
44
- if (value)
45
- setValue(value);
46
46
  document.addEventListener('keydown', handleKeyDown);
47
47
  return () => document.removeEventListener('keydown', handleKeyDown);
48
- }, [isListOpen, highlightedIndex, options, displayKey, onSelect, value]);
48
+ }, [
49
+ isListOpen,
50
+ highlightedIndex,
51
+ options,
52
+ displayKey,
53
+ onSelect,
54
+ displayValue,
55
+ ]);
49
56
  // Reset highlight when list opens/closes
50
57
  useEffect(() => {
51
58
  if (isListOpen)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
6
  "author": {