react-restyle-components 0.2.48 → 0.2.50
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 +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +5 -3
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +7 -4
- package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.js +4 -9
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts +0 -1
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js +4 -3
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/modal-confirm/modal-confirm.component.js +6 -4
- package/lib/src/core-components/molecules/multi-select/multi-select.component.d.ts +0 -1
- package/lib/src/core-components/molecules/multi-select/multi-select.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/multi-select/multi-select.component.js +9 -5
- package/lib/src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.d.ts.map +1 -1
- package/lib/src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.js +6 -4
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1 +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":"
|
|
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":"AAOA,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,4CAiIrC,CAAC"}
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
5
5
|
import { debounce } from '../../../core-utils';
|
|
6
|
+
import s from '../../../tc.module.css';
|
|
7
|
+
import { cn } from '../../../core-utils';
|
|
6
8
|
export const AutoCompleteFilterSingleSelect = ({ disable = false, loader = false, displayValue = '', placeholder = 'Search...', data, hasError = false, onFilter, onSelect, }) => {
|
|
7
9
|
const [value, setValue] = useState(displayValue);
|
|
8
10
|
const [options, setOptions] = useState();
|
|
@@ -36,7 +38,7 @@ export const AutoCompleteFilterSingleSelect = ({ disable = false, loader = false
|
|
|
36
38
|
onFilter(search);
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, children: [_jsxs("div", { className:
|
|
41
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, children: [_jsxs("div", { className: cn(s['flex'], s['items-center'], s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border-2'], hasError ? s['border-red'] : s['border-gray-300'], s['rounded-md']), children: [_jsx("input", { placeholder: placeholder, value: !isListOpen ? value : value, className: cn(s['w-full'], s['focus:outline-none'], s['bg-none']),
|
|
40
42
|
// onKeyUp={onKeyUp}
|
|
41
43
|
onChange: onChange, onClick: () => setIsListOpen(true), disabled: disable }), isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
|
|
42
44
|
color: '#000000',
|
|
@@ -45,10 +47,10 @@ export const AutoCompleteFilterSingleSelect = ({ disable = false, loader = false
|
|
|
45
47
|
color: '#000000',
|
|
46
48
|
size: 22,
|
|
47
49
|
} }))] }), options && isListOpen
|
|
48
|
-
? options.length > 0 && (_jsx("div", { className:
|
|
50
|
+
? options.length > 0 && (_jsx("div", { className: cn(s['mt-1'], s['absolute'], s['bg-gray-100'], s['p-2'], s['rounded-sm'], s['z-50']), children: _jsx("ul", { children: options?.map((item, index) => (_jsx(_Fragment, { children: _jsx("li", { className: cn(s['text-gray-400'], s['flex'], s['items-center']), onClick: () => {
|
|
49
51
|
setValue(item[data.displayKey]);
|
|
50
52
|
setIsListOpen(false);
|
|
51
53
|
onSelect(item);
|
|
52
|
-
}, children: _jsx("label", { className:
|
|
54
|
+
}, children: _jsx("label", { className: cn(s['ml-2'], s['mt-1'], s['text-black']), children: item[data.displayKey] }) }, index) }))) }) }))
|
|
53
55
|
: null] }) }));
|
|
54
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-complete-filter-single-select-multiple-fields-display.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.tsx"],"names":[],"mappings":"AAIA,OAAO,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-complete-filter-single-select-multiple-fields-display.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.tsx"],"names":[],"mappings":"AAIA,OAAO,wBAAwB,CAAC;AAIhC,UAAU,qDAAqD;IAC7D,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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC7B;AAED,eAAO,MAAM,gDAAgD,+HAa1D,qDAAqD,4CA4LvD,CAAC"}
|
|
@@ -3,6 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
5
5
|
import '../../../tc.module.css';
|
|
6
|
+
import s from '../../../tc.module.css';
|
|
7
|
+
import { cn } from '../../../core-utils';
|
|
6
8
|
export const AutoCompleteFilterSingleSelectMultiFieldsDisplay = ({ disable = false, loader = false, displayValue = '', placeholder = 'Search...', data, hasError = false, className, posstion = 'absolute', keyboard = 'text', onFilter, onSelect, onBlur, }) => {
|
|
7
9
|
const [value, setValue] = useState(displayValue);
|
|
8
10
|
const [options, setOptions] = useState(data.list);
|
|
@@ -55,22 +57,22 @@ export const AutoCompleteFilterSingleSelectMultiFieldsDisplay = ({ disable = fal
|
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, className:
|
|
60
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, className: cn(s['w-full'], s['relative']), children: [_jsxs("div", { className: cn(s['flex'], s['items-center'], s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border-2'], hasError ? s['border-red'] : s['border-gray-300'], s['rounded-md'], s['dark:text-black']), children: [_jsx("input", { placeholder: placeholder, type: keyboard, value: value, className: cn(className, s['w-full'], s['focus:outline-none'], s['bg-none'], s['dark:text-black']), onKeyUp: onKeyUp, onChange: onChange, onClick: () => setIsListOpen(true), disabled: disable, onMouseDown: () => setValue(''), onBlur: (e) => onBlur && onBlur(e), onKeyDown: onKeyDown }), isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
|
|
59
61
|
color: '#000000',
|
|
60
62
|
size: 22,
|
|
61
63
|
} })) : (_jsx(Icon, { nameIcon: "FaChevronDown", propsIcon: {
|
|
62
64
|
color: '#000000',
|
|
63
65
|
size: 22,
|
|
64
66
|
} }))] }), options && isListOpen
|
|
65
|
-
? options.length > 0 && (_jsx("div", { className:
|
|
67
|
+
? options.length > 0 && (_jsx("div", { className: cn(s['mt-1'], s['absolute'], s['w-full'], s['bg-gray-100'], s['p-2'], s['rounded-sm']), style: {
|
|
66
68
|
zIndex: 500,
|
|
67
|
-
}, children: _jsx("ul", { children: options?.map((item, index) => (_jsxs("li", { className:
|
|
69
|
+
}, children: _jsx("ul", { children: options?.map((item, index) => (_jsxs("li", { className: cn(s['text-gray-400'], s['flex'], s['items-center']), onClick: () => {
|
|
68
70
|
setValue(data.displayKey
|
|
69
71
|
.map((key) => `${item[key]}`)
|
|
70
72
|
.join(' - '));
|
|
71
73
|
setIsListOpen(false);
|
|
72
74
|
onSelect && onSelect(item);
|
|
73
|
-
}, children: [' ', _jsx("label", { className:
|
|
75
|
+
}, children: [' ', _jsx("label", { className: cn(s['ml-2'], s['mt-1'], s['text-black']), style: {
|
|
74
76
|
textOverflow: 'ellipsis',
|
|
75
77
|
minWidth: 0,
|
|
76
78
|
overflow: 'hidden',
|
|
@@ -81,6 +83,7 @@ export const AutoCompleteFilterSingleSelectMultiFieldsDisplay = ({ disable = fal
|
|
|
81
83
|
.join(' - '), children: data.displayKey
|
|
82
84
|
.map((key) => `${item[key]}
|
|
83
85
|
`)
|
|
86
|
+
.filter(Boolean)
|
|
84
87
|
.join(' - ') })] }, index))) }) }))
|
|
85
88
|
: null] }) }));
|
|
86
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-complete-group-by.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auto-complete-group-by.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/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,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,mBAAmB,UAAW,wBAAwB,4CAsPlE,CAAC"}
|
package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
5
|
+
import s from '../../../tc.module.css';
|
|
6
|
+
import { cn } from '../../../core-utils';
|
|
5
7
|
export const AutocompleteGroupBy = (props) => {
|
|
6
8
|
//const [userRouter, setUserRouter] = useState<any>()
|
|
7
9
|
const [value, setValue] = useState(props.displayValue);
|
|
@@ -77,14 +79,7 @@ export const AutocompleteGroupBy = (props) => {
|
|
|
77
79
|
setValue(search);
|
|
78
80
|
filter(search, props.data);
|
|
79
81
|
};
|
|
80
|
-
|
|
81
|
-
// const charCode = e.which ? e.which : e.keyCode;
|
|
82
|
-
// if (charCode === 8) {
|
|
83
|
-
// const search = e.target.value;
|
|
84
|
-
// filter(search, data);
|
|
85
|
-
// }
|
|
86
|
-
// };
|
|
87
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, className: "w-full relative", children: [_jsxs("div", { className: `flex items-center leading-4 p-2 bg-white focus:outline-none focus:ring w-full shadow-sm sm:text-base border-2 ${props.hasError ? 'border-red ' : 'border-gray-300'} rounded-md`, children: [_jsx("input", { placeholder: "Search...", value: !isListOpen ? value : value, className: "w-full focus:outline-none",
|
|
82
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { ref: wrapperRef, className: s['w-full'] + ' ' + s['relative'], children: [_jsxs("div", { className: cn(s['flex'], s['items-center'], s['leading-4'], s['p-2'], s['bg-white'], s['focus:outline-none'], s['focus:ring'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border-2'], props.hasError ? s['border-red'] : s['border-gray-300'], s['rounded-md']), children: [_jsx("input", { placeholder: "Search...", value: !isListOpen ? value : value, className: cn(s['w-full'] + ' ' + s['focus:outline-none']),
|
|
88
83
|
// onKeyUp={onKeyUp}
|
|
89
84
|
onChange: onChange, onClick: () => setIsListOpen(true), onKeyDown: (e) => {
|
|
90
85
|
if (e.key === 'Enter') {
|
|
@@ -120,7 +115,7 @@ export const AutocompleteGroupBy = (props) => {
|
|
|
120
115
|
color: '#000000',
|
|
121
116
|
size: 22,
|
|
122
117
|
} }))] }), options && isListOpen
|
|
123
|
-
? options?.length > 0 && (_jsx("div", { className:
|
|
118
|
+
? options?.length > 0 && (_jsx("div", { className: cn(s['flex'], s['mt-1'], s['absolute'], s['z-50'], s['rounded-md'], s['bg-gray-200'], s['w-100'], s['w-full']), children: _jsx("ul", { className: cn(s['flex'], s['p-2'], s['rounded-sm'], s['w-full']), children: _jsx("div", { className: cn(s['flex'], s['flex-col'], s['w-full'], s['overflow-scroll']), style: { height: 'auto', maxHeight: '350px' }, children: options?.map((item, index) => (_jsxs(_Fragment, { children: [_jsx("li", { className: cn(s['flex'] + ' ' + s['text-gray-400']), children: item.title }, index), _jsx("ul", { className: cn(s['flex'], s['flex-col'], s['ml-4'], s['w-full']), children: item?.children?.map((children, childrenIndex) => (_jsx("li", { className: cn(s['flex'], s['hover:bg-gray-200'], s['focus:outline-none'], s['cursor-pointer'], s['w-full']), onClick: async () => {
|
|
124
119
|
props.onChange &&
|
|
125
120
|
props.onChange(item, children);
|
|
126
121
|
setIsListOpen(false);
|
package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-multiline-input.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/css-multiline-input/css-multiline-input.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css-multiline-input.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/css-multiline-input/css-multiline-input.component.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,IAAI,KAAA,GAAG,IAAI,CAAC;CACtB;AAWD,eAAO,MAAM,YAAY,sEAOtB,iBAAiB,4CA8HnB,CAAC"}
|
package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js
CHANGED
|
@@ -2,7 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useState, useRef } from 'react';
|
|
3
3
|
import * as Form from '../../atoms/form/form.component';
|
|
4
4
|
import { properties as propertiesObj } from './css-properties';
|
|
5
|
-
import '../../../tc.module.css';
|
|
5
|
+
import s from '../../../tc.module.css';
|
|
6
|
+
import { cn } from '../../../core-utils';
|
|
6
7
|
const mapToArray = (arr) => {
|
|
7
8
|
const res = [];
|
|
8
9
|
arr.forEach(function (obj, index) {
|
|
@@ -60,10 +61,10 @@ export const CSSMultiline = ({ label = 'Main Box CSS', defaultValue = '', classN
|
|
|
60
61
|
const onKeyUp = (e) => {
|
|
61
62
|
setIsListOpen(true);
|
|
62
63
|
};
|
|
63
|
-
return (_jsxs("div", { className:
|
|
64
|
+
return (_jsxs("div", { className: cn(s['flex'], s['flex-col'], s['w-full']), ref: wrapperRef, children: [_jsx(Form.MultilineInput, { label: label, style: { color: '#ffffff', backgroundColor: '#000000', ...style }, placeholder: placeholder, value: value.current, className: cn(className), onKeyUp: onKeyUp, onChange: (css) => {
|
|
64
65
|
value.current = css;
|
|
65
66
|
filter(css);
|
|
66
|
-
} }), isListOpen && (_jsx("div", { style: { marginTop: -10 }, children: _jsx("ul", { className:
|
|
67
|
+
} }), isListOpen && (_jsx("div", { style: { marginTop: -10 }, children: _jsx("ul", { className: cn(s['flex'], s['flex-col'], s['max-h-40'], s['bg-black'], s['m-2'], s['text-white'], s['overflow-y-scroll']), children: properties?.map((item, index) => (_jsxs("li", { className: cn(s['flex'], s['flex-col'], s['gap-4'], s['p-2']), children: [_jsx("span", { className: cn(s['underline']), children: item[0] }), item[1]?.map((prop) => (_jsxs("li", { className: cn(s['flex'], s['-mt-2'], s['px-2'], s['h-8'], s['bg-slate-800'], s['rounded-md'], s['items-center'], s['cursor-pointer']), onClick: () => {
|
|
67
68
|
let existsString = value.current?.split(',');
|
|
68
69
|
if (value.current.includes(',')) {
|
|
69
70
|
existsString = existsString.map((item) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-confirm.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/modal-confirm/modal-confirm.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal-confirm.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/modal-confirm/modal-confirm.component.tsx"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,4EAQtB,iBAAiB,4CAkLnB,CAAC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Container } from 'reactstrap';
|
|
4
|
+
import s from '../../../tc.module.css';
|
|
5
|
+
import { cn } from '../../../core-utils';
|
|
4
6
|
export const ModalConfirm = ({ visible = false, title = 'Confirm', message = '', submitTitle = 'Send', closeTitle = 'Close', onClick, onClose, }) => {
|
|
5
7
|
const [showModal, setShowModal] = useState(visible);
|
|
6
8
|
useEffect(() => {
|
|
7
9
|
setShowModal(visible);
|
|
8
10
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9
11
|
}, [visible]);
|
|
10
|
-
return (_jsx(_Fragment, { children: _jsx(Container, { children: showModal && (_jsxs(_Fragment, { children: [_jsx("div", { className:
|
|
12
|
+
return (_jsx(_Fragment, { children: _jsx(Container, { children: showModal && (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(s['flex'], s['justify-center'], s['items-center'], s['overflow-x-hidden'], s['overflow-y-auto'], s['fixed'], s['inset-0'], s['z-50'], s['outline-none'], s['focus:outline-none']), children: _jsx("div", { className: cn(s['relative'], s['my-6'], s['mx-auto']), children: _jsxs("div", { className: cn(s['border-0'], s['rounded-lg'], s['shadow-lg'], s['relative'], s['flex'], s['flex-col'], s['w-fit'], s['min-w-80'], s['bg-white'], s['outline-none'], s['focus:outline-none']), children: [_jsxs("div", { className: cn(s['flex'], s['items-center'], s['justify-between'], s['p-2'], s['border-b'], s['border-solid'], s['border-gray-300'], s['rounded-t']), children: [_jsx("h3", { className: cn(s['text-2xl'], s['font-semibold']), children: title }), _jsx("button", { className: cn(s['p-1'], s['border-0'], s['text-black'], s['opacity-1'], s['ml-6'], s['float-right'], s['text-3xl'], s['leading-none'], s['font-semibold'], s['outline-none'], s['focus:outline-none']), onClick: () => {
|
|
11
13
|
setShowModal(false);
|
|
12
14
|
onClose && onClose();
|
|
13
|
-
}, children: _jsx("span", { className:
|
|
15
|
+
}, children: _jsx("span", { className: cn(s['text-black'], s['h-6'], s['w-6'], s['text-2xl'], s['block'], s['outline-none'], s['focus:outline-none']), children: "\u00D7" }) })] }), _jsx("div", { className: cn(s['flex'], s['p-2']), children: _jsx("div", { className: cn(s['flex']), children: _jsx("span", { className: cn(s['text-md']), children: message }) }) }), _jsxs("div", { className: cn(s['flex'], s['items-center'], s['justify-end'], s['p-2'], s['border-t'], s['border-solid'], s['border-gray-300'], s['rounded-b']), children: [_jsx("button", { className: cn(s['text-red-500'], s['background-transparent'], s['font-bold'], s['uppercase'], s['p-2'], s['text-sm'], s['outline-none'], s['focus:outline-none'], s['mr-1'], s['mb-1']), type: "button", style: { transition: 'all .15s ease' }, onClick: () => {
|
|
14
16
|
setShowModal(false);
|
|
15
17
|
onClose && onClose();
|
|
16
|
-
}, children: closeTitle }), _jsx("button", { className:
|
|
18
|
+
}, children: closeTitle }), _jsx("button", { className: cn(s['bg-green-500'], s['text-white'], s['active:bg-green-600'], s['font-bold'], s['uppercase'], s['text-sm'], s['p-2'], s['rounded'], s['shadow'], s['hover:shadow-lg'], s['outline-none'], s['focus:outline-none'], s['mr-1'], s['mb-1']), type: "button", style: { transition: 'all .15s ease' }, onClick: () => {
|
|
17
19
|
onClick();
|
|
18
|
-
}, children: submitTitle })] })] }) }) }), _jsx("div", { className:
|
|
20
|
+
}, children: submitTitle })] })] }) }) }), _jsx("div", { className: cn(s['opacity-25'], s['fixed'], s['inset-0'], s['z-40'], s['bg-black']) })] })) }) }));
|
|
19
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/multi-select/multi-select.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multi-select.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/multi-select/multi-select.component.tsx"],"names":[],"mappings":"AAIA,UAAU,gBAAgB;IACxB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,oDAKrB,gBAAgB,4CAuHlB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
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 '../../../tc.module.css';
|
|
3
|
+
import s from '../../../tc.module.css';
|
|
4
|
+
import { cn } from '../../../core-utils';
|
|
4
5
|
export const MultiSelect = ({ options = [], selectedItems = [], hasError = false, onSelect, }) => {
|
|
5
6
|
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
6
7
|
const [isListOpen, setIsListOpen] = useState(false);
|
|
@@ -22,10 +23,13 @@ export const MultiSelect = ({ options = [], selectedItems = [], hasError = false
|
|
|
22
23
|
}, [selectedItems]);
|
|
23
24
|
const wrapperRef = useRef(null);
|
|
24
25
|
useOutsideAlerter(wrapperRef);
|
|
25
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className:
|
|
26
|
+
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-2'], {
|
|
27
|
+
[s['border-red']]: hasError,
|
|
28
|
+
[s['border-gray-300']]: !hasError,
|
|
29
|
+
}), ref: wrapperRef, children: [_jsx("span", { className: cn(s['p-2'], s['mt-1'], s['shadow-sm']), onClick: () => {
|
|
26
30
|
setIsListOpen(!isListOpen);
|
|
27
|
-
}, children: selectedOptions?.length > 0 ? selectedOptions?.join(',') : 'Select' }), _jsx("div", { className:
|
|
28
|
-
? options?.length > 0 && (_jsx("div", { className:
|
|
31
|
+
}, children: selectedOptions?.length > 0 ? selectedOptions?.join(',') : 'Select' }), _jsx("div", { className: cn(s['flex'], { [s['show']]: isListOpen, [s['hidden']]: !isListOpen }, s['relative']), children: options
|
|
32
|
+
? 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']), children: _jsxs("label", { className: cn(s['flex'], s['gap-2']), children: [_jsx("input", { className: cn(s['flex'], s['h-4'], s['w-4']), type: "checkbox", checked: selectedOptions?.includes(item), onChange: () => {
|
|
29
33
|
if (selectedOptions?.includes(item)) {
|
|
30
34
|
setSelectedOptions(selectedOptions?.filter((e) => e != item));
|
|
31
35
|
}
|
|
@@ -40,6 +44,6 @@ export const MultiSelect = ({ options = [], selectedItems = [], hasError = false
|
|
|
40
44
|
}, onBlur: () => {
|
|
41
45
|
if (!isListOpen)
|
|
42
46
|
onSelect(selectedOptions);
|
|
43
|
-
} }), _jsx("span", { className:
|
|
47
|
+
} }), _jsx("span", { className: cn(s['flex'], s['h-4']), children: item })] }) }, index))) }) }))
|
|
44
48
|
: null })] }) }));
|
|
45
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-select-with-field.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multi-select-with-field.component.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.tsx"],"names":[],"mappings":"AAMA,UAAU,yBAAyB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,kEAM9B,yBAAyB,4CAkI3B,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
import { useState, useEffect, useRef } from 'react';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
+
import s from '../../../tc.module.css';
|
|
6
|
+
import { cn } from '../../../core-utils';
|
|
5
7
|
export const MultiSelectWithField = ({ displayField = '', options = [], selectedItems = [], hasError = false, onSelect, }) => {
|
|
6
8
|
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
7
9
|
const [isListOpen, setIsListOpen] = useState(false);
|
|
@@ -23,12 +25,12 @@ export const MultiSelectWithField = ({ displayField = '', options = [], selected
|
|
|
23
25
|
}, [selectedItems]);
|
|
24
26
|
const wrapperRef = useRef(null);
|
|
25
27
|
useOutsideAlerter(wrapperRef);
|
|
26
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className:
|
|
28
|
+
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-2'], hasError ? s['border-red'] : s['border-gray-300']), ref: wrapperRef, children: [_jsx("span", { className: cn(s['p-2'], s['mt-1'], s['shadow-sm']), onClick: () => {
|
|
27
29
|
setIsListOpen(!isListOpen);
|
|
28
30
|
}, children: selectedOptions?.length > 0
|
|
29
31
|
? `${selectedOptions?.length} Items`
|
|
30
|
-
: 'Select' }), _jsx("div", { className:
|
|
31
|
-
? options?.length > 0 && (_jsx("ul", { className:
|
|
32
|
+
: 'Select' }), _jsx("div", { className: cn(s['flex'], s['mx-2'], isListOpen ? s['show'] : s['hidden']), children: options
|
|
33
|
+
? options?.length > 0 && (_jsx("ul", { className: cn(s['flex'], s['flex-col'], s['gap-1'], s['p-2']), children: options?.map((item, index) => (_jsxs("li", { className: cn(s['flex'], s['items-center']), children: [_jsx("input", { className: cn(s['flex'], s['bg-black']), type: "checkbox", checked: !_.isEmpty(selectedOptions?.find((e) => e[displayField]?.toUpperCase() ==
|
|
32
34
|
item[displayField]?.toUpperCase()))
|
|
33
35
|
? true
|
|
34
36
|
: false, onChange: () => {
|
|
@@ -48,6 +50,6 @@ export const MultiSelectWithField = ({ displayField = '', options = [], selected
|
|
|
48
50
|
}, onBlur: () => {
|
|
49
51
|
if (!isListOpen)
|
|
50
52
|
onSelect(selectedOptions);
|
|
51
|
-
} }), ' ', _jsx("span", { className:
|
|
53
|
+
} }), ' ', _jsx("span", { className: cn(s['flex'], s['ml-2'], s['dark:text-white'], s['text-center']), children: item[displayField] })] }, index))) }))
|
|
52
54
|
: null })] }) }));
|
|
53
55
|
};
|