react-restyle-components 0.3.0 → 0.3.2

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.
@@ -3,8 +3,10 @@ interface CollapsibleProps {
3
3
  label: string;
4
4
  labelClassName?: string;
5
5
  className?: string;
6
+ onExpand?: (label: string) => void;
7
+ onCollapse?: (label: string) => void;
6
8
  children: React.ReactNode;
7
9
  }
8
- export declare const Collapsible: ({ label, labelClassName, className, children, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Collapsible: ({ label, labelClassName, className, onExpand, onCollapse, children, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
9
11
  export {};
10
12
  //# sourceMappingURL=collapsible.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/collapsible/collapsible.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAItC,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,eAAO,MAAM,WAAW,oDAKrB,gBAAgB,4CA6ClB,CAAC"}
1
+ {"version":3,"file":"collapsible.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/collapsible/collapsible.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAItC,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,eAAO,MAAM,WAAW,0EAOrB,gBAAgB,4CAkDlB,CAAC"}
@@ -2,10 +2,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import s from '../../tc.module.css';
4
4
  import { cn } from '../../utils';
5
- export const Collapsible = ({ label, labelClassName, className, children, }) => {
5
+ export const Collapsible = ({ label, labelClassName, className, onExpand, onCollapse, children, }) => {
6
6
  const [open, setOPen] = useState(false);
7
7
  const toggle = () => {
8
+ if (open) {
9
+ onCollapse?.(label);
10
+ }
11
+ else {
12
+ onExpand?.(label);
13
+ }
8
14
  setOPen(!open);
9
15
  };
10
- return (_jsxs("div", { className: cn(s.flx, s['flx-col']), children: [_jsx("button", { className: cn(s.flx, s['items-center'], s['w-full'], s['p-1'], s['my-1'], s['text-base'], s['text-left'], s['bg-gray-200'], s['border-0'], s['transition'], s['focus:outline-none'], s['rounded-sm'], s['rounded-b-none'], labelClassName), type: "button", onClick: toggle, children: label?.toUpperCase() }), open && (_jsx("div", { className: cn(s['p-2'], s['bg-gray-200'], s['-my-2'], s['mb-1'], className), children: children }))] }));
16
+ return (_jsxs("div", { className: cn(s.flx, s['flx-col'], s['w-full']), children: [_jsx("button", { className: cn(s.flx, s['items-center'], s['w-full'], s['p-1'], s['my-1'], s['text-base'], s['text-left'], s['bg-gray-200'], s['border-0'], s['transition'], s['focus:outline-none'], s['rounded-sm'], s['rounded-b-none'], labelClassName), type: "button", onClick: toggle, children: label?.toUpperCase() }), open && (_jsx("div", { className: cn(s['p-2'], s['bg-gray-200'], s['-my-2'], s['mb-1'], className), children: children }))] }));
11
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"auto-complete-group-by.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.tsx"],"names":[],"mappings":"AAMA,UAAU,wBAAwB;IAChC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,yDAM7B,wBAAwB,4CAmP1B,CAAC"}
1
+ {"version":3,"file":"auto-complete-group-by.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.tsx"],"names":[],"mappings":"AAMA,UAAU,wBAAwB;IAChC,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,yDAM7B,wBAAwB,4CAiP1B,CAAC"}
@@ -101,8 +101,7 @@ export const AutocompleteGroupBy = ({ data = [], hasError = false, displayValue
101
101
  onChange(selectedItem, selectedChildren);
102
102
  }
103
103
  setIsListOpen(false);
104
- setValue(value); // Set the value to what the user entered
105
- setOptions([]);
104
+ setValue(value);
106
105
  }
107
106
  } }), isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
108
107
  color: '#000000',
@@ -114,6 +113,5 @@ export const AutocompleteGroupBy = ({ data = [], hasError = false, displayValue
114
113
  onChange && onChange(item, children);
115
114
  setIsListOpen(false);
116
115
  setValue(children.title);
117
- setOptions([]);
118
116
  }, children: children.title }, childrenIndex))) })] }))) }) }) })) : (_jsx("div", { className: cn(s['mt-1'], s['absolute'], s['bg-gray-200'], s['p-2'], s['rounded-md']), style: { zIndex: 80, width: '100%' }, children: _jsx("span", { children: "Not Found Result!!" }) }))) : null] }) }));
119
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
6
  "author": {