react-restyle-components 0.2.45 → 0.2.46

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
6
  "author": {
@@ -30,5 +30,6 @@ export * from './molecules/autocomplete/autocomplete';
30
30
  export * from './molecules/auto-complete-group-by/auto-complete-group-by.component';
31
31
  export * from './molecules/color-picker/color-picker.component';
32
32
  export * from './molecules/color-picker-modal/color-picker-modal.component';
33
+ export * from './molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component';
33
34
  export { Form };
34
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AAEpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kDAAkD,CAAC;AAEjE,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iDAAiD,CAAC;AAChE,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,mCAAmC,CAAC;AAElD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AAExD,cAAc,+DAA+D,CAAC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AC;AAC5E,cAAc,6FAA6F,CAAC;AAE5G,OAAO,EAAC,IAAI,EAAC,CAAC"}
@@ -30,4 +30,5 @@ export * from './molecules/autocomplete/autocomplete';
30
30
  export * from './molecules/auto-complete-group-by/auto-complete-group-by.component';
31
31
  export * from './molecules/color-picker/color-picker.component';
32
32
  export * from './molecules/color-picker-modal/color-picker-modal.component';
33
+ export * from './molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component';
33
34
  export { Form };
@@ -0,0 +1,13 @@
1
+ interface AutoCompleteFilterSingleSelectProps {
2
+ loader?: boolean;
3
+ disable?: boolean;
4
+ displayValue?: string;
5
+ placeholder?: string;
6
+ data: any;
7
+ hasError?: boolean;
8
+ onFilter: (item: any) => void;
9
+ onSelect: (item: any) => any;
10
+ }
11
+ export declare const AutoCompleteFilterSingleSelect: ({ disable, loader, displayValue, placeholder, data, hasError, onFilter, onSelect, }: AutoCompleteFilterSingleSelectProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=auto-complete-filter-single-select.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-complete-filter-single-select.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.tsx"],"names":[],"mappings":"AAKA,UAAU,mCAAmC;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,8BAA8B,wFASxC,mCAAmC,4CAuGrC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /* eslint-disable */
3
+ import { useState, useEffect, useRef } from 'react';
4
+ import { Icon } from '../../atoms/icons/icons.component';
5
+ import { debounce } from '../../../core-utils';
6
+ export const AutoCompleteFilterSingleSelect = ({ disable = false, loader = false, displayValue = '', placeholder = 'Search...', data, hasError = false, onFilter, onSelect, }) => {
7
+ const [value, setValue] = useState(displayValue);
8
+ const [options, setOptions] = useState();
9
+ const [isListOpen, setIsListOpen] = useState(false);
10
+ const useOutsideAlerter = (ref) => {
11
+ useEffect(() => {
12
+ function handleClickOutside(event) {
13
+ if (ref.current && !ref.current.contains(event.target) && isListOpen) {
14
+ setIsListOpen(false);
15
+ setValue('');
16
+ }
17
+ }
18
+ document.addEventListener('mousedown', handleClickOutside);
19
+ return () => {
20
+ document.removeEventListener('mousedown', handleClickOutside);
21
+ };
22
+ }, [ref, isListOpen]);
23
+ };
24
+ const wrapperRef = useRef(null);
25
+ useOutsideAlerter(wrapperRef);
26
+ useEffect(() => {
27
+ setOptions(data.list);
28
+ }, [data]);
29
+ useEffect(() => {
30
+ setValue(displayValue);
31
+ }, [displayValue]);
32
+ const onChange = (e) => {
33
+ const search = e.target.value;
34
+ setValue(search);
35
+ debounce(() => {
36
+ onFilter(search);
37
+ });
38
+ };
39
+ return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, children: [_jsxs("div", { className: `flex items-center leading-4 p-2 focus:outline-none focus:ring w-full shadow-sm sm:text-base border-2 ${hasError ? 'border-red' : 'border-gray-300'} rounded-md`, children: [_jsx("input", { placeholder: placeholder, value: !isListOpen ? value : value, className: `w-full focus:outline-none bg-none`,
40
+ // onKeyUp={onKeyUp}
41
+ onChange: onChange, onClick: () => setIsListOpen(true), disabled: disable }), isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
42
+ color: '#000000',
43
+ size: 22,
44
+ } })) : (_jsx(Icon, { nameIcon: "FaChevronDown", propsIcon: {
45
+ color: '#000000',
46
+ size: 22,
47
+ } }))] }), options && isListOpen
48
+ ? options.length > 0 && (_jsx("div", { className: "mt-1 absolute bg-gray-100 p-2 rounded-sm z-50", children: _jsx("ul", { children: options?.map((item, index) => (_jsx(_Fragment, { children: _jsx("li", { className: "text-gray-400 flex items-center", onClick: () => {
49
+ setValue(item[data.displayKey]);
50
+ setIsListOpen(false);
51
+ onSelect(item);
52
+ }, children: _jsx("label", { className: "ml-2 mt-1 text-black", children: item[data.displayKey] }) }, index) }))) }) }))
53
+ : null] }) }));
54
+ };
@@ -1,3 +1,4 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  export declare const cn: (...inputs: ClassValue[]) => string;
3
+ export declare const debounce: any;
3
4
  //# sourceMappingURL=utility.util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utility.util.d.ts","sourceRoot":"","sources":["../../../src/core-utils/utility.util.ts"],"names":[],"mappings":"AAAA,OAAa,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAGtC,eAAO,MAAM,EAAE,cAAe,UAAU,EAAE,KAAG,MAE5C,CAAC"}
1
+ {"version":3,"file":"utility.util.d.ts","sourceRoot":"","sources":["../../../src/core-utils/utility.util.ts"],"names":[],"mappings":"AACA,OAAa,EAAC,UAAU,EAAC,MAAM,MAAM,CAAC;AAGtC,eAAO,MAAM,EAAE,cAAe,UAAU,EAAE,KAAG,MAE5C,CAAC;AAEF,eAAO,MAAM,QAAQ,KAEb,CAAC"}
@@ -1,5 +1,9 @@
1
+ import _ from 'lodash';
1
2
  import clsx from 'clsx';
2
3
  import { twMerge } from 'tailwind-merge';
3
4
  export const cn = (...inputs) => {
4
5
  return twMerge(clsx(inputs));
5
6
  };
7
+ export const debounce = _.debounce((fun) => {
8
+ fun();
9
+ }, 1000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
6
  "author": {