react-restyle-components 0.2.89 → 0.2.90
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/src/core-components/__mocks__/styleMock.d.ts +2 -0
- package/lib/src/core-components/__mocks__/styleMock.d.ts.map +1 -0
- package/lib/src/core-components/__mocks__/styleMock.js +1 -0
- package/lib/src/core-components/index.d.ts +34 -0
- package/lib/src/core-components/index.d.ts.map +1 -0
- package/lib/src/core-components/index.js +33 -0
- package/lib/src/core-components/jest.config.d.ts +12 -0
- package/lib/src/core-components/jest.config.d.ts.map +1 -0
- package/lib/src/core-components/jest.config.js +10 -0
- package/lib/src/core-components/src/App.d.ts +4 -0
- package/lib/src/core-components/src/App.d.ts.map +1 -0
- package/lib/src/core-components/src/App.js +9 -0
- package/lib/src/core-components/src/atoms/button/Button.test.d.ts +2 -0
- package/lib/src/core-components/src/atoms/button/Button.test.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/button/Button.test.js +27 -0
- package/lib/src/core-components/src/atoms/button/Button.types.d.ts +26 -0
- package/lib/src/core-components/src/atoms/button/Button.types.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/button/Button.types.js +1 -0
- package/lib/src/core-components/src/atoms/button/button.component.d.ts +4 -0
- package/lib/src/core-components/src/atoms/button/button.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/button/button.component.js +18 -0
- package/lib/src/core-components/src/atoms/button/buttonGroup/buttonGroup.component.d.ts +7 -0
- package/lib/src/core-components/src/atoms/button/buttonGroup/buttonGroup.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/button/buttonGroup/buttonGroup.component.js +4 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.component.d.ts +10 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.component.js +20 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.spec.d.ts +2 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.spec.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/check-box/checkBox.spec.js +32 -0
- package/lib/src/core-components/src/atoms/date-picker/date-picker.component.d.ts +12 -0
- package/lib/src/core-components/src/atoms/date-picker/date-picker.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/date-picker/date-picker.component.js +20 -0
- package/lib/src/core-components/src/atoms/form/form.component.d.ts +105 -0
- package/lib/src/core-components/src/atoms/form/form.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/form/form.component.js +87 -0
- package/lib/src/core-components/src/atoms/icons/icons.component.d.ts +11 -0
- package/lib/src/core-components/src/atoms/icons/icons.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/icons/icons.component.js +71 -0
- package/lib/src/core-components/src/atoms/input/input-otp.component.d.ts +14 -0
- package/lib/src/core-components/src/atoms/input/input-otp.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/input/input-otp.component.js +61 -0
- package/lib/src/core-components/src/atoms/input/input-pin.component.d.ts +16 -0
- package/lib/src/core-components/src/atoms/input/input-pin.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/input/input-pin.component.js +76 -0
- package/lib/src/core-components/src/atoms/input/input.component.d.ts +18 -0
- package/lib/src/core-components/src/atoms/input/input.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/input/input.component.js +16 -0
- package/lib/src/core-components/src/atoms/input-dropdown/input-dropdown.component.d.ts +10 -0
- package/lib/src/core-components/src/atoms/input-dropdown/input-dropdown.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/input-dropdown/input-dropdown.component.js +44 -0
- package/lib/src/core-components/src/atoms/loader/loader.component.d.ts +6 -0
- package/lib/src/core-components/src/atoms/loader/loader.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/loader/loader.component.js +6 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-images.components.d.ts +9 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-images.components.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-images.components.js +7 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-table.components.d.ts +11 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-table.components.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-table.components.js +48 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-typography.components.d.ts +21 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-typography.components.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-typography.components.js +70 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-wrapped-view.components.d.ts +53 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-wrapped-view.components.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/pdf/pdf-wrapped-view.components.js +50 -0
- package/lib/src/core-components/src/atoms/radio/radio.component.d.ts +9 -0
- package/lib/src/core-components/src/atoms/radio/radio.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/radio/radio.component.js +20 -0
- package/lib/src/core-components/src/atoms/stepper/stepper.component.d.ts +9 -0
- package/lib/src/core-components/src/atoms/stepper/stepper.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/stepper/stepper.component.js +26 -0
- package/lib/src/core-components/src/atoms/tabs/tabs.component.d.ts +18 -0
- package/lib/src/core-components/src/atoms/tabs/tabs.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/tabs/tabs.component.js +19 -0
- package/lib/src/core-components/src/atoms/timer/timer.component.d.ts +7 -0
- package/lib/src/core-components/src/atoms/timer/timer.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/timer/timer.component.js +76 -0
- package/lib/src/core-components/src/atoms/tooltip/Tooltip.types.d.ts +22 -0
- package/lib/src/core-components/src/atoms/tooltip/Tooltip.types.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/tooltip/Tooltip.types.js +1 -0
- package/lib/src/core-components/src/atoms/tooltip/tooltip.component.d.ts +10 -0
- package/lib/src/core-components/src/atoms/tooltip/tooltip.component.d.ts.map +1 -0
- package/lib/src/core-components/src/atoms/tooltip/tooltip.component.js +10 -0
- package/lib/src/core-components/src/helpers/constants.d.ts +4 -0
- package/lib/src/core-components/src/helpers/constants.d.ts.map +1 -0
- package/lib/src/core-components/src/helpers/constants.js +11 -0
- package/lib/src/core-components/src/hooks/index.d.ts +2 -0
- package/lib/src/core-components/src/hooks/index.d.ts.map +1 -0
- package/lib/src/core-components/src/hooks/index.js +1 -0
- package/lib/src/core-components/src/hooks/outside.hook.d.ts +2 -0
- package/lib/src/core-components/src/hooks/outside.hook.d.ts.map +1 -0
- package/lib/src/core-components/src/hooks/outside.hook.js +28 -0
- package/lib/src/core-components/src/index.d.ts +2 -0
- package/lib/src/core-components/src/index.d.ts.map +1 -0
- package/lib/src/core-components/src/index.js +12 -0
- package/lib/src/core-components/src/library/assets/svg/index.d.ts +10 -0
- package/lib/src/core-components/src/library/assets/svg/index.d.ts.map +1 -0
- package/lib/src/core-components/src/library/assets/svg/index.js +27 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts +17 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +101 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.d.ts +13 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +59 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts +18 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +109 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.d.ts +10 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.js +128 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.test.d.ts +2 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.test.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/auto-complete-group-by/auto-complete-group-by.component.test.js +9 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.d.ts +8 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.js +108 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.spec.d.ts +2 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.spec.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/autocomplete/autocomplete.spec.js +79 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.component.d.ts +6 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.component.js +12 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.spec.d.ts +2 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.spec.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/color-picker/color-picker.spec.js +7 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.component.d.ts +15 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.component.js +41 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.spec.d.ts +2 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.spec.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/color-picker-modal/color-picker-modal.spec.js +7 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-multiline-input.component.d.ts +11 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-multiline-input.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-multiline-input.component.js +91 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-properties.d.ts +8932 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-properties.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/css-multiline-input/css-properties.js +161 -0
- package/lib/src/core-components/src/molecules/modal/modal.component.d.ts +10 -0
- package/lib/src/core-components/src/molecules/modal/modal.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/modal/modal.component.js +19 -0
- package/lib/src/core-components/src/molecules/modal-confirm/modal-confirm.component.d.ts +14 -0
- package/lib/src/core-components/src/molecules/modal-confirm/modal-confirm.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/modal-confirm/modal-confirm.component.js +21 -0
- package/lib/src/core-components/src/molecules/multi-select/multi-select.component.d.ts +9 -0
- package/lib/src/core-components/src/molecules/multi-select/multi-select.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/multi-select/multi-select.component.js +49 -0
- package/lib/src/core-components/src/molecules/multi-select-with-field/multi-select-with-field.component.d.ts +10 -0
- package/lib/src/core-components/src/molecules/multi-select-with-field/multi-select-with-field.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/multi-select-with-field/multi-select-with-field.component.js +58 -0
- package/lib/src/core-components/src/molecules/multi-selection-dropdown/multi-selection-dropdown.component.d.ts +9 -0
- package/lib/src/core-components/src/molecules/multi-selection-dropdown/multi-selection-dropdown.component.d.ts.map +1 -0
- package/lib/src/core-components/src/molecules/multi-selection-dropdown/multi-selection-dropdown.component.js +43 -0
- package/lib/src/core-components/src/reportWebVitals.d.ts +4 -0
- package/lib/src/core-components/src/reportWebVitals.d.ts.map +1 -0
- package/lib/src/core-components/src/reportWebVitals.js +12 -0
- package/lib/src/core-components/src/setupTests.d.ts +2 -0
- package/lib/src/core-components/src/setupTests.d.ts.map +1 -0
- package/lib/src/core-components/src/setupTests.js +5 -0
- package/lib/src/core-components/src/utils/index.d.ts +2 -0
- package/lib/src/core-components/src/utils/index.d.ts.map +1 -0
- package/lib/src/core-components/src/utils/index.js +1 -0
- package/lib/src/core-components/src/utils/utility.util.d.ts +3 -0
- package/lib/src/core-components/src/utils/utility.util.d.ts.map +1 -0
- package/lib/src/core-components/src/utils/utility.util.js +5 -0
- package/lib/src/core-utils/jest.config.d.ts +11 -0
- package/lib/src/core-utils/jest.config.d.ts.map +1 -0
- package/lib/src/core-utils/jest.config.js +9 -0
- package/lib/src/core-utils/src/calculation/calculation.spec.d.ts +2 -0
- package/lib/src/core-utils/src/calculation/calculation.spec.d.ts.map +1 -0
- package/lib/src/core-utils/src/calculation/calculation.spec.js +52 -0
- package/lib/src/core-utils/src/index.d.ts +8 -0
- package/lib/src/core-utils/src/index.d.ts.map +1 -0
- package/lib/src/core-utils/src/index.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from '@react-pdf/renderer';
|
|
3
|
+
export const PdfView = ({ mh = 20, p = 2, flexDirection = 'column', style, fixed = false, isBreak = false, alignItems, mt, isWrap = true, children, }) => {
|
|
4
|
+
return (_jsx(View, { break: isBreak, style: {
|
|
5
|
+
marginHorizontal: mh,
|
|
6
|
+
marginTop: mt,
|
|
7
|
+
padding: p,
|
|
8
|
+
flexDirection: flexDirection,
|
|
9
|
+
alignItems: alignItems,
|
|
10
|
+
...style,
|
|
11
|
+
}, fixed: fixed, wrap: isWrap, children: children }));
|
|
12
|
+
};
|
|
13
|
+
export const PdfBorderView = ({ mh = 20, mv = 50, p = 2, borderColor = 'gray', bw = 2, style, flexDirection = 'column', fixed = false, isBreak = false, children, }) => {
|
|
14
|
+
return (_jsx(View, { break: isBreak, style: {
|
|
15
|
+
flexDirection: flexDirection,
|
|
16
|
+
marginHorizontal: mh,
|
|
17
|
+
marginVertical: mv,
|
|
18
|
+
padding: p,
|
|
19
|
+
borderColor: borderColor,
|
|
20
|
+
borderWidth: bw,
|
|
21
|
+
...style,
|
|
22
|
+
}, fixed: fixed, children: children }));
|
|
23
|
+
};
|
|
24
|
+
export const PdfHeader = ({ bg = 'orange', p = 10, alignItems = 'flex-start', fixed = false, style, children, }) => {
|
|
25
|
+
return (_jsx(View, { style: {
|
|
26
|
+
backgroundColor: bg,
|
|
27
|
+
alignItems: alignItems,
|
|
28
|
+
padding: p,
|
|
29
|
+
...style,
|
|
30
|
+
}, fixed: fixed, children: children }));
|
|
31
|
+
};
|
|
32
|
+
export const PdfSubHeader = ({ bg = 'yellow', p = 4, alignItems = 'flex-end', fixed = false, style, children, }) => {
|
|
33
|
+
return (_jsx(View, { style: {
|
|
34
|
+
backgroundColor: bg,
|
|
35
|
+
alignItems: alignItems,
|
|
36
|
+
padding: p,
|
|
37
|
+
...style,
|
|
38
|
+
}, fixed: fixed, children: children }));
|
|
39
|
+
};
|
|
40
|
+
export const PdfFooterView = ({ bottom = 0, left = 0, right = 0, bg = 'orange', p = 10, alignItems = 'center', fixed = false, height = '100%', style, children, }) => {
|
|
41
|
+
return (_jsx(View, { style: [
|
|
42
|
+
{ position: 'absolute', bottom, left, right, height },
|
|
43
|
+
{ backgroundColor: bg, padding: p, alignItems: alignItems, ...style },
|
|
44
|
+
], fixed: fixed, children: children }));
|
|
45
|
+
};
|
|
46
|
+
export const PdfGrid = ({ cols = 1, bg = 'white', style, children, }) => (_jsx(View, { style: {
|
|
47
|
+
width: `${100 / cols}%`,
|
|
48
|
+
backgroundColor: bg,
|
|
49
|
+
...style,
|
|
50
|
+
}, children: children }));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface RadioProps {
|
|
2
|
+
title: string;
|
|
3
|
+
data: Array<any>;
|
|
4
|
+
className?: string;
|
|
5
|
+
onChange: (item: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Radio: ({ title, data, className, onChange, }: RadioProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=radio.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/radio/radio.component.tsx"],"names":[],"mappings":"AAMA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,IAAI,KAAA,KAAK,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,KAAK,0CAKf,UAAU,4CAuCZ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { CheckedRadio, UncheckRadio } from '../../library/assets/svg';
|
|
4
|
+
import { InputWrapper } from '../form/form.component';
|
|
5
|
+
import s from '../../tc.module.css';
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
export const Radio = ({ title = 'Source', data = [], className, onChange, }) => {
|
|
8
|
+
const [list, setList] = useState(data);
|
|
9
|
+
const width = 20;
|
|
10
|
+
return (_jsx(_Fragment, { children: _jsx(InputWrapper, { label: title, children: list?.map((item, index) => (_jsx("div", { className: cn(className, s['flex'], s['items-center'], s['mb-1']), onClick: () => {
|
|
11
|
+
const result = list?.map((e, i) => {
|
|
12
|
+
if (i == index)
|
|
13
|
+
return { ...e, checked: true };
|
|
14
|
+
else
|
|
15
|
+
return { ...e, checked: false };
|
|
16
|
+
});
|
|
17
|
+
setList(result);
|
|
18
|
+
onChange(result?.find((item) => item.checked));
|
|
19
|
+
}, children: _jsxs("div", { className: cn(s['flex'], s['flex-row'], s['gap-1'], s['items-center']), children: [item.checked ? (_jsx(CheckedRadio, { width: width, height: width })) : (_jsx(UncheckRadio, { width: width, height: width })), _jsx("span", { className: cn(s['text-4xs']), children: item?.title })] }) }, index))) }) }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface StepperProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
steps: Array<string>;
|
|
4
|
+
currentStep: number;
|
|
5
|
+
onStepClick: (currentStep: any, index: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Stepper: ({ className, steps, currentStep, onStepClick, }: StepperProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=stepper.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepper.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/stepper/stepper.component.tsx"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,WAAW,KAAA,EAAE,KAAK,KAAA,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,OAAO,oDAKjB,YAAY,4CA+Hd,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import s from '../../tc.module.css';
|
|
3
|
+
import { cn } from '../../utils';
|
|
4
|
+
export const Stepper = ({ className = '', steps, currentStep = 1, onStepClick, }) => {
|
|
5
|
+
const finalClass = cn(className, s['w-full'], s['px-4'], s['sm:px-8']);
|
|
6
|
+
const progressClass = cn(s['absolute'], s['my-4'], s['top-1/2'], s['left-0'], s['h-0.5'], s['transform'], s['-translate-y-1/2'], s['bg-orange'], s['transition-width'], s['ease-in-out'], s['duration-500']);
|
|
7
|
+
const Steps = steps?.map((step, index) => {
|
|
8
|
+
let stepClass = cn(s['inline-block'], s['transform'], s['-translate-x-1/2'], s['pt-1'], s['w-8'], s['h-8'], s['rounded-full'], s['text-center']);
|
|
9
|
+
if (index < currentStep)
|
|
10
|
+
stepClass = cn(stepClass, s['font-medium'], s['border'], s['border-orange'], s['bg-background-secondary'], s['text-gray'], s['bg-white']);
|
|
11
|
+
else if (index > currentStep)
|
|
12
|
+
stepClass = cn(stepClass, s['font-medium'], s['border'], s['border-gray-dark-secondary'], s['text-gray'], s['bg-background-secondary'], s['bg-white']);
|
|
13
|
+
else if (currentStep === index)
|
|
14
|
+
stepClass = cn(stepClass, s['font-medium'], s['bg-orange'], s['text-white'], s['border']);
|
|
15
|
+
if (typeof onStepClick === 'function')
|
|
16
|
+
stepClass = cn(stepClass, s['cursor-pointer']);
|
|
17
|
+
return (_jsx("div", { style: { left: `${(index / (steps.length - 1)) * 100}%` }, className: cn(s['absolute']), children: _jsx("span", { className: cn(stepClass, s['font-arimaRegular'], s['text-4xs'], s['text-center'], s['z-2']), onClick: () => {
|
|
18
|
+
if (typeof onStepClick === 'function')
|
|
19
|
+
onStepClick(index + 1, step);
|
|
20
|
+
}, children: step }) }, step));
|
|
21
|
+
});
|
|
22
|
+
return (_jsxs("div", { className: finalClass, children: [_jsx("div", { className: cn(s['w-full'], s['relative'], s['z-0']), children: _jsx("div", { className: progressClass, style: {
|
|
23
|
+
// width: `${(currentStep / (steps.length - 1)) * 100}%`,
|
|
24
|
+
width: `100%`,
|
|
25
|
+
}, children: _jsx("div", { className: cn(s['w-3'], s['h-3'], s['bg-orange'], s['rounded-full'], s['absolute'], s['right-0'], s['top-1/2'], s['transform'], s['translate-x-1/2'], s['-translate-y-1/2']) }) }) }), _jsx("div", { className: cn(s['relative'], s['sm:block']), children: Steps })] }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TabProps {
|
|
3
|
+
title: string;
|
|
4
|
+
children: React.JSX.Element;
|
|
5
|
+
}
|
|
6
|
+
export declare const Tab: ({ title, children }: TabProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export interface TabsProps {
|
|
8
|
+
options: Array<{
|
|
9
|
+
title: string;
|
|
10
|
+
content?: React.JSX.Element;
|
|
11
|
+
inActive?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
onSelect?: (item: any, index: number) => void;
|
|
14
|
+
children: React.JSX.Element[];
|
|
15
|
+
}
|
|
16
|
+
export declare const Tabs: ({ options, onSelect, children }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=tabs.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/tabs/tabs.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAItC,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,GAAG,wBAAuB,QAAQ,4CAM9C,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;QAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,IAAI,oCAAmC,SAAS,4CAqD5D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import s from '../../tc.module.css';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
export const Tab = ({ title, children }) => {
|
|
6
|
+
return (_jsx("div", { className: cn(s.flex), children: children }, title));
|
|
7
|
+
};
|
|
8
|
+
export const Tabs = ({ options, onSelect, children }) => {
|
|
9
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
10
|
+
const [selected, setSelected] = useState(options[0].title);
|
|
11
|
+
const tabs = React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === Tab);
|
|
12
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: cn(s.flex, s['flex-col'], s['w-full']), children: [_jsx("div", { className: cn(s.flex, s['border-b']), children: options?.map((tab, index) => (_jsx("button", { type: "button", className: cn(s['py-2'], s['px-4'], s['mr-1'], s['border-none'], s['rounded-t-md'], s['shadow-inner'], s['cursor-pointer'], activeTab === index && s['bg-blue-500'], activeTab === index && s['border-none'], activeTab === index && s['text-white']), onClick: () => {
|
|
13
|
+
setSelected(tab?.title);
|
|
14
|
+
onSelect && onSelect(tab, index);
|
|
15
|
+
!tab.inActive && setActiveTab(index);
|
|
16
|
+
}, disabled: tab.inActive, children: tab.title }, index))) }), _jsx("div", { className: cn(s['p-2'], s.border, s['border-solid'], s['border-slate-600'], s['rounded-b-md']), children: options[activeTab]?.content
|
|
17
|
+
? options[activeTab]?.content
|
|
18
|
+
: tabs[options?.findIndex((item) => item.title === selected)] })] }) }));
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/timer/timer.component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAK3E,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAGD,eAAO,MAAM,KAAK,wEA8EjB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable react/prop-types */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
4
|
+
import React, { useEffect, useState, useImperativeHandle } from 'react';
|
|
5
|
+
import { TimerSVG } from '../../library/assets/svg';
|
|
6
|
+
import s from '../../tc.module.css';
|
|
7
|
+
import { cn } from '../../utils';
|
|
8
|
+
// eslint-disable-next-line react/display-name
|
|
9
|
+
export const Timer = React.forwardRef(({ onClear }, ref) => {
|
|
10
|
+
const width = 15;
|
|
11
|
+
const [minute, setMinute] = useState('00');
|
|
12
|
+
const [second, setSecond] = useState('10');
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const sec = parseInt(second);
|
|
15
|
+
const min = parseInt(minute);
|
|
16
|
+
const countDown = setInterval(() => {
|
|
17
|
+
if (min === 0 && sec === 0) {
|
|
18
|
+
setMinute('00');
|
|
19
|
+
setSecond('00');
|
|
20
|
+
clearInterval(countDown);
|
|
21
|
+
onClear && onClear();
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
let secondstTmp = (sec - 1).toString();
|
|
25
|
+
if (secondstTmp.length === 1) {
|
|
26
|
+
secondstTmp = '0'.concat(secondstTmp);
|
|
27
|
+
}
|
|
28
|
+
setSecond(secondstTmp);
|
|
29
|
+
if (sec === 0) {
|
|
30
|
+
setSecond('59');
|
|
31
|
+
const m = (min - 1).toString();
|
|
32
|
+
setMinute('0' + m);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, 1000);
|
|
36
|
+
return () => {
|
|
37
|
+
clearInterval(countDown);
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
useImperativeHandle(ref, () => ({
|
|
41
|
+
updateState() {
|
|
42
|
+
setMinute('02');
|
|
43
|
+
setSecond('00');
|
|
44
|
+
},
|
|
45
|
+
resetTimer() {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
const sec = parseInt(second);
|
|
48
|
+
const min = parseInt(minute === '00' ? '02' : minute);
|
|
49
|
+
const countDown = setInterval(() => {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
if (min === 0 && sec === 0) {
|
|
52
|
+
setMinute('00');
|
|
53
|
+
setSecond('00');
|
|
54
|
+
clearInterval(countDown);
|
|
55
|
+
onClear && onClear();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
let secondstTmp = (sec - 1).toString();
|
|
59
|
+
if (secondstTmp.length === 1) {
|
|
60
|
+
secondstTmp = '0'.concat(secondstTmp);
|
|
61
|
+
}
|
|
62
|
+
setSecond(secondstTmp);
|
|
63
|
+
if (sec === 0) {
|
|
64
|
+
setSecond('59');
|
|
65
|
+
const m = (min - 1).toString();
|
|
66
|
+
setMinute('0' + m);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, 1000);
|
|
70
|
+
return () => {
|
|
71
|
+
clearInterval(countDown);
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
return (_jsxs("div", { className: cn(s['flex'], s['flex-row'], s['items-center']), children: [_jsx(TimerSVG, { width: width, height: width, fill: "#E7503D" }), _jsxs("div", { className: cn(s['ml-2'], s['flex'], s['flex-row']), children: [_jsxs("span", { children: [minute, ":"] }), _jsx("span", { children: second })] })] }));
|
|
76
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type TooltipProps = {
|
|
3
|
+
/** custom classname to pass to the tooltip element */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The delay (in ms) before showing the tooltip */
|
|
6
|
+
delay?: number;
|
|
7
|
+
/** Sets the preferred position relative to the trigger */
|
|
8
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
9
|
+
/** Space between the tooltip element and anchor element (arrow not included in calculation) */
|
|
10
|
+
sideOffset?: number;
|
|
11
|
+
/** Use this to set the content of the tooltip*/
|
|
12
|
+
content?: React.ReactNode;
|
|
13
|
+
/** Sets the preferred alignment relative to the trigger & position */
|
|
14
|
+
align?: 'start' | 'center' | 'end';
|
|
15
|
+
/**Space between alignment point and tooltip */
|
|
16
|
+
alignOffset?: number;
|
|
17
|
+
/** If set to true then in the case of collision finds the alternate ways by changing the position or aligment or both to properly display tooltip */
|
|
18
|
+
avoidCollisions?: boolean;
|
|
19
|
+
/** Set true to prevent tooltip from displaying */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=Tooltip.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.types.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/tooltip/Tooltip.types.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,+FAA+F;IAC/F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sJAAsJ;IACtJ,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
|
+
import { TooltipProps } from './Tooltip.types';
|
|
5
|
+
/**
|
|
6
|
+
* The `Tooltip` must be nested somewhere inside the `TooltipProvider` in the component tree.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Tooltip: ({ align, side, children, content, avoidCollisions, alignOffset, sideOffset, disabled, delay, className, }: PropsWithChildren<TooltipProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
10
|
+
//# sourceMappingURL=tooltip.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/tooltip/tooltip.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,iBAAiB,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,OAAO,8GAWjB,kBAAkB,YAAY,CAAC,4CA4BjC,CAAC;AACF,eAAO,MAAM,eAAe,iDAA4B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
/**
|
|
4
|
+
* The `Tooltip` must be nested somewhere inside the `TooltipProvider` in the component tree.
|
|
5
|
+
*/
|
|
6
|
+
export const Tooltip = ({ align = 'center', side = 'bottom', children, content, avoidCollisions = true, alignOffset = 0, sideOffset = 5, disabled = false, delay = 400, className, }) => {
|
|
7
|
+
const isChildrenString = typeof children === 'string';
|
|
8
|
+
return (_jsxs(TooltipPrimitive.Root, { delayDuration: delay, children: [_jsx(TooltipPrimitive.Trigger, { asChild: !isChildrenString, disabled: disabled, className: className, children: children }), _jsx(TooltipPrimitive.Portal, { children: !disabled && content && (_jsxs(TooltipPrimitive.Content, { className: className, avoidCollisions: avoidCollisions, side: side, align: align, alignOffset: alignOffset, sideOffset: sideOffset, children: [content, _jsx(TooltipPrimitive.Arrow, { className: className })] })) })] }));
|
|
9
|
+
};
|
|
10
|
+
export const TooltipProvider = TooltipPrimitive.Provider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/src/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,UAQ3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './outside.hook';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outside.hook.d.ts","sourceRoot":"","sources":["../../../../../src/core-components/src/hooks/outside.hook.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,kCA6B3B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const useClickOutside = (ref, handler) => {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
let startedInside = false;
|
|
5
|
+
let startedWhenMounted = false;
|
|
6
|
+
const listener = (event) => {
|
|
7
|
+
// Do nothing if `mousedown` or `touchstart` started inside ref element
|
|
8
|
+
if (startedInside || !startedWhenMounted)
|
|
9
|
+
return;
|
|
10
|
+
// Do nothing if clicking ref's element or descendent elements
|
|
11
|
+
if (!ref.current || ref.current.contains(event.target))
|
|
12
|
+
return;
|
|
13
|
+
handler(event);
|
|
14
|
+
};
|
|
15
|
+
const validateEventStart = (event) => {
|
|
16
|
+
startedWhenMounted = ref.current;
|
|
17
|
+
startedInside = ref.current && ref.current.contains(event.target);
|
|
18
|
+
};
|
|
19
|
+
document.addEventListener('mousedown', validateEventStart);
|
|
20
|
+
document.addEventListener('touchstart', validateEventStart);
|
|
21
|
+
document.addEventListener('click', listener);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener('mousedown', validateEventStart);
|
|
24
|
+
document.removeEventListener('touchstart', validateEventStart);
|
|
25
|
+
document.removeEventListener('click', listener);
|
|
26
|
+
};
|
|
27
|
+
}, [ref, handler]);
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core-components/src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom/client';
|
|
4
|
+
import './index.css';
|
|
5
|
+
import App from './App';
|
|
6
|
+
import reportWebVitals from './reportWebVitals';
|
|
7
|
+
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
8
|
+
root.render(_jsx(React.StrictMode, { children: _jsx(App, {}) }));
|
|
9
|
+
// If you want to start measuring performance in your app, pass a function
|
|
10
|
+
// to log results (for example: reportWebVitals(console.log))
|
|
11
|
+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
12
|
+
reportWebVitals();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import UnCheckbox from './UnCheckbox.svg?react';
|
|
2
|
+
import CheckedBox from './CheckedBox.svg?react';
|
|
3
|
+
import DatePickerSvg from './datePicker.svg?react';
|
|
4
|
+
import CheckedRadio from './checkedRadio.svg?react';
|
|
5
|
+
import UncheckRadio from './uncheckRadio.svg?react';
|
|
6
|
+
import TimerSVG from './timer.svg?react';
|
|
7
|
+
import UpArrow from './UpArrow.svg?react';
|
|
8
|
+
import DownArrow from './DownArrow.svg?react';
|
|
9
|
+
export { UnCheckbox, CheckedBox, DatePickerSvg, CheckedRadio, UncheckRadio, TimerSVG, UpArrow, DownArrow, };
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core-components/src/library/assets/svg/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,SAAS,GACV,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import UnCheckbox from './UnCheckbox.svg?react';
|
|
2
|
+
import CheckedBox from './CheckedBox.svg?react';
|
|
3
|
+
import DatePickerSvg from './datePicker.svg?react';
|
|
4
|
+
import CheckedRadio from './checkedRadio.svg?react';
|
|
5
|
+
import UncheckRadio from './uncheckRadio.svg?react';
|
|
6
|
+
import TimerSVG from './timer.svg?react';
|
|
7
|
+
import UpArrow from './UpArrow.svg?react';
|
|
8
|
+
import DownArrow from './DownArrow.svg?react';
|
|
9
|
+
export { UnCheckbox, CheckedBox, DatePickerSvg, CheckedRadio, UncheckRadio, TimerSVG, UpArrow, DownArrow, };
|
|
10
|
+
// import {ReactComponent as UnCheckbox} from '../../../library/assets/svg/unCheckbox.svg';
|
|
11
|
+
// import {ReactComponent as CheckedBox} from '../../../library/assets/svg/checkedBox.svg';
|
|
12
|
+
// import {ReactComponent as DatePickerSvg} from '../../../library/assets/svg/datePicker.svg';
|
|
13
|
+
// import {ReactComponent as CheckedRadio} from '../../../library/assets/svg/checkedRadio.svg';
|
|
14
|
+
// import {ReactComponent as UncheckRadio} from '../../../library/assets/svg/uncheckRadio.svg';
|
|
15
|
+
// import {ReactComponent as TimerSVG} from '../../../library/assets/svg/timer.svg';
|
|
16
|
+
// import {ReactComponent as UpArrow} from '../../../library/assets/svg/UpArrow.svg';
|
|
17
|
+
// import {ReactComponent as DownArrow} from '../../../library/assets/svg/DownArrow.svg';
|
|
18
|
+
// export {
|
|
19
|
+
// UnCheckbox,
|
|
20
|
+
// CheckedBox,
|
|
21
|
+
// DatePickerSvg,
|
|
22
|
+
// CheckedRadio,
|
|
23
|
+
// UncheckRadio,
|
|
24
|
+
// TimerSVG,
|
|
25
|
+
// UpArrow,
|
|
26
|
+
// DownArrow,
|
|
27
|
+
// };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface AutoCompleteFilterMultipleSelectMultipleFieldsDisplayProps {
|
|
2
|
+
uniqueField?: string;
|
|
3
|
+
isSelectedStringArray?: boolean;
|
|
4
|
+
loader?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
data: any;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
disable?: boolean;
|
|
9
|
+
isUpperCase?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
onFilter?: (value: string) => void;
|
|
12
|
+
onUpdate: (item: any) => void;
|
|
13
|
+
onSelect: (item: any) => any;
|
|
14
|
+
onBlur?: (e: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const AutoCompleteFilterMultipleSelectMultipleFieldsDisplay: ({ uniqueField, isSelectedStringArray, loader, placeholder, data, hasError, disable, isUpperCase, name, onFilter, onUpdate, onSelect, onBlur, }: AutoCompleteFilterMultipleSelectMultipleFieldsDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,0DAA0D;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC7B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,qDAAqD,mJAc/D,0DAA0D,4CAkM5D,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 s from '../../tc.module.css';
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
import { debounce } from '@techabl/core-utils';
|
|
8
|
+
export const AutoCompleteFilterMultipleSelectMultipleFieldsDisplay = ({ uniqueField = '_id', isSelectedStringArray = false, loader = false, placeholder = 'Search...', data, hasError = false, disable = false, isUpperCase = false, name, onFilter, onUpdate, onSelect, onBlur, }) => {
|
|
9
|
+
const [value, setValue] = useState('');
|
|
10
|
+
const [options, setOptions] = useState();
|
|
11
|
+
const [originalOptions, setOriginalOptions] = useState();
|
|
12
|
+
const [isListOpen, setIsListOpen] = useState(false);
|
|
13
|
+
const useOutsideAlerter = (ref) => {
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
function handleClickOutside(event) {
|
|
16
|
+
if (ref.current && !ref.current.contains(event.target) && isListOpen) {
|
|
17
|
+
if (originalOptions && options) {
|
|
18
|
+
if (isListOpen) {
|
|
19
|
+
onUpdate && onUpdate(data.selected);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
setIsListOpen(false);
|
|
23
|
+
setValue('');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
27
|
+
return () => {
|
|
28
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
29
|
+
};
|
|
30
|
+
}, [ref, isListOpen]);
|
|
31
|
+
};
|
|
32
|
+
const wrapperRef = useRef(null);
|
|
33
|
+
useOutsideAlerter(wrapperRef);
|
|
34
|
+
let count = 0;
|
|
35
|
+
const getSelectedItem = (selectedItem, list) => {
|
|
36
|
+
if (count === 0) {
|
|
37
|
+
const finalList = list?.filter((item, index) => {
|
|
38
|
+
item.selected = false;
|
|
39
|
+
selectedItem && selectedItem.length > 0
|
|
40
|
+
? selectedItem.find((sItem, index) => {
|
|
41
|
+
if (isSelectedStringArray) {
|
|
42
|
+
if (sItem === item[uniqueField]) {
|
|
43
|
+
item.selected = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if (sItem[uniqueField] === item[uniqueField]) {
|
|
48
|
+
item.selected = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
: (item.selected = false);
|
|
53
|
+
count++;
|
|
54
|
+
return item;
|
|
55
|
+
});
|
|
56
|
+
list = finalList;
|
|
57
|
+
}
|
|
58
|
+
return list;
|
|
59
|
+
};
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setOriginalOptions(getSelectedItem(data.selected, data.list));
|
|
62
|
+
setOptions(getSelectedItem(data.selected, data.list));
|
|
63
|
+
}, [data, data.selected]);
|
|
64
|
+
const onChange = (e) => {
|
|
65
|
+
const search = e.target.value;
|
|
66
|
+
setValue(search);
|
|
67
|
+
debounce(() => {
|
|
68
|
+
onFilter && onFilter(search);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const onKeyUp = (e) => {
|
|
72
|
+
const charCode = e.which ? e.which : e.keyCode;
|
|
73
|
+
if (charCode === 8) {
|
|
74
|
+
const search = e.target.value;
|
|
75
|
+
debounce(() => {
|
|
76
|
+
onFilter && onFilter(search);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
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'], s['rounded-md'], {
|
|
81
|
+
[s['border-red']]: hasError,
|
|
82
|
+
[s['border-gray-300']]: !hasError,
|
|
83
|
+
}), children: [_jsx("input", { placeholder: placeholder, disabled: disable, name: name, value: !isListOpen
|
|
84
|
+
? data?.selected?.length > 0
|
|
85
|
+
? `${(data.selected && data.selected.length) || 0} Items`
|
|
86
|
+
: value
|
|
87
|
+
: isUpperCase
|
|
88
|
+
? value?.toUpperCase()
|
|
89
|
+
: value, className: cn(s['w-full'], s['focus:outline-none'], s['bg-none']), onKeyUp: onKeyUp, onChange: onChange, onClick: () => setIsListOpen(true), onBlur: (e) => onBlur && onBlur(e) }), isListOpen ? (_jsx(Icon, { nameIcon: "FaChevronUp", propsIcon: {
|
|
90
|
+
color: '#000000',
|
|
91
|
+
size: 22,
|
|
92
|
+
} })) : (_jsx(Icon, { nameIcon: "FaChevronDown", propsIcon: {
|
|
93
|
+
color: '#000000',
|
|
94
|
+
size: 22,
|
|
95
|
+
} }))] }), options && isListOpen
|
|
96
|
+
? options?.length > 0 && (_jsx("div", { className: cn(s['flex'], s['mt-1'], s['absolute'], s['rounded-sm'], s['z-500'], s['w-full']), style: { zIndex: 80 }, children: _jsx("ul", { className: cn(s['flex'], s['flex-col'], s['gap-2'], s['bg-gray-200'], s['p-2'], s['w-full']), children: options?.map((item, index) => (_jsx(_Fragment, { children: _jsx("li", { className: cn(s['flex'], s['gap-4'], s['p-2']), children: _jsxs("label", { className: cn(s['flex']), children: [_jsx("input", { id: index?.toString(), className: cn(s['flex'], s['h-4'], s['w-4']), type: "checkbox", checked: item.selected, onChange: () => onSelect(item) }), ' ', _jsx("span", { className: cn(s['flex'], s['h-4'], s['ml-2']), children: data.displayKey
|
|
97
|
+
.map((key) => `${item[key]}
|
|
98
|
+
`)
|
|
99
|
+
.join(' - ') })] }) }, index) }))) }) }))
|
|
100
|
+
: null] }) }));
|
|
101
|
+
};
|
|
@@ -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/src/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,4CAuIrC,CAAC"}
|