react-restyle-components 0.3.20 → 0.3.21

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.
@@ -1,9 +1,12 @@
1
+ import React from 'react';
1
2
  interface SingleSelectProps {
2
3
  options: Array<any>;
3
4
  displayKey?: string;
4
5
  hasError?: boolean;
6
+ className?: string;
7
+ style?: React.CSSProperties;
5
8
  onSelect: (item: any) => any;
6
9
  }
7
- export declare const SingleSelect: ({ options, displayKey, hasError, onSelect, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const SingleSelect: ({ options, displayKey, hasError, className, style, onSelect, }: SingleSelectProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export {};
9
12
  //# 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":"AAIA,UAAU,iBAAiB;IACzB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,iDAKtB,iBAAiB,4CA0KnB,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,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,4CA8JnB,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
+ import { Icon } from '../../..';
3
4
  import s from '../../tc.module.css';
4
5
  import { cn } from '../../utils';
5
- export const SingleSelect = ({ options = [], displayKey = 'title', hasError = false, onSelect, }) => {
6
+ export const SingleSelect = ({ options = [], displayKey = 'title', hasError = false, className = '', style = {}, onSelect, }) => {
6
7
  const [value, setValue] = useState('');
7
8
  const [isListOpen, setIsListOpen] = useState(false);
8
9
  // Arrow navigation state
@@ -51,9 +52,9 @@ export const SingleSelect = ({ options = [], displayKey = 'title', hasError = fa
51
52
  return (_jsx(_Fragment, { children: _jsxs("div", { className: cn(s['flex'], s['dark:bg-boxdark'], s['dark:text-white'], s['flex-col'], s['w-full'], s['rounded-md'], s['border'], {
52
53
  [s['border-red']]: hasError,
53
54
  [s['border-gray-300']]: !hasError,
54
- }), ref: wrapperRef, children: [_jsxs("span", { className: cn(s['p-2'], s['shadow-sm'], s['flex'], s['justify-between'], s['items-center']), onClick: () => {
55
+ }, className), ref: wrapperRef, style: style, children: [_jsxs("span", { className: cn(s['p-2'], s['shadow-sm'], s['flex'], s['justify-between'], s['items-center']), onClick: () => {
55
56
  setIsListOpen(!isListOpen);
56
- }, tabIndex: 0, style: { cursor: 'pointer' }, children: [value ? value : 'Select', _jsx("span", { children: isListOpen ? (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: _jsx("path", { d: "M5 12l5-5 5 5", stroke: "currentColor", strokeWidth: "2", fill: "none" }) })) : (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: _jsx("path", { d: "M5 8l5 5 5-5", stroke: "currentColor", strokeWidth: "2", fill: "none" }) })) })] }), _jsx("div", { className: cn(s['flex'], { [s['show']]: isListOpen, [s['hidden']]: !isListOpen }, s['relative']), children: options
57
+ }, tabIndex: 0, style: { cursor: 'pointer' }, children: [value ? value : 'Select', _jsx("span", { children: isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: { size: 16 } })) : (_jsx(Icon, { nameIcon: "FaChevronDown", propsIcon: { size: 16 } })) })] }), _jsx("div", { className: cn(s['flex'], { [s['show']]: isListOpen, [s['hidden']]: !isListOpen }, s['relative']), children: options
57
58
  ? options?.length > 0 && (_jsx("div", { className: cn(s['flex'], s['absolute'], s['rounded-sm'], s['w-full']), style: { zIndex: 999 }, children: _jsx("ul", { className: cn(s['flex'], s['flex-col'], s['gap-1'], s['bg-gray-200'], s['w-full']), children: options?.map((item, index) => (_jsx("li", { className: cn(s['flex'], s['gap-2'], s['p-2'], highlightedIndex === index && s['bg-blue-100']), style: {
58
59
  cursor: 'pointer',
59
60
  background: highlightedIndex === index ? '#e0e7ff' : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-restyle-components",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
4
4
  "private": false,
5
5
  "description": "Easy use restyle components",
6
6
  "author": {