react-restyle-components 0.2.89 → 0.2.91
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.css +45 -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/assets/styles/colors.css +217 -0
- package/lib/src/core-components/src/assets/styles/decorations.css +15 -0
- package/lib/src/core-components/src/assets/styles/fontface.css +17 -0
- package/lib/src/core-components/src/assets/styles/scrollbars.css +70 -0
- package/lib/src/core-components/src/assets/styles/typography.css +3 -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-otp.styles.css +35 -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/input.styles.css +35 -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/tabs/tabs.module.css +238 -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.css +118 -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/fonts/arima/arima-bold.ttf +0 -0
- package/lib/src/core-components/src/library/assets/fonts/arima/arima-regular.ttf +0 -0
- package/lib/src/core-components/src/library/assets/svg/CheckedBox.svg +14 -0
- package/lib/src/core-components/src/library/assets/svg/DownArrow.svg +14 -0
- package/lib/src/core-components/src/library/assets/svg/UnCheckbox.svg +3 -0
- package/lib/src/core-components/src/library/assets/svg/UpArrow.svg +14 -0
- package/lib/src/core-components/src/library/assets/svg/checkedRadio.svg +13 -0
- package/lib/src/core-components/src/library/assets/svg/datePicker.svg +3 -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/library/assets/svg/timer copy.svg +3 -0
- package/lib/src/core-components/src/library/assets/svg/timer.svg +3 -0
- package/lib/src/core-components/src/library/assets/svg/uncheckRadio.svg +3 -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.css +37 -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.css +24 -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.css +45 -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/tc.module.css +1 -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 +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import s from '../../tc.module.css';
|
|
4
|
+
import { cn } from '../../utils';
|
|
5
|
+
import { UnCheckbox, CheckedBox } from '../../library/assets/svg';
|
|
6
|
+
import { InputWrapper } from '../form/form.component';
|
|
7
|
+
export const CheckBox = ({ title = 'Banks', data = [{ title: 'SBI Bank', checked: false }], className, onChange, }) => {
|
|
8
|
+
const [list, setList] = useState(data);
|
|
9
|
+
const width = 20;
|
|
10
|
+
return (_jsx(InputWrapper, { label: title, children: list?.map((item, index) => (_jsxs("div", { className: `${cn(s.flex, s['flex-row'], s['items-center'])} ${className}`, onClick: () => {
|
|
11
|
+
const result = list?.map((e, i) => {
|
|
12
|
+
if (i === index)
|
|
13
|
+
return { ...e, checked: !item.checked };
|
|
14
|
+
else
|
|
15
|
+
return { ...e };
|
|
16
|
+
});
|
|
17
|
+
setList(result);
|
|
18
|
+
onChange(result?.filter((item) => item.checked));
|
|
19
|
+
}, children: [_jsx("div", { className: cn(s.flex, s['mt-1']), children: item.checked ? (_jsx(CheckedBox, { width: width, height: width, fill: "#E7503D", stroke: "E7503D" })) : (_jsx(UnCheckbox, { width: width, height: width })) }), _jsx("span", { children: item?.title })] }, index))) }));
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkBox.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/check-box/checkBox.spec.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import { CheckBox } from './checkBox.component';
|
|
6
|
+
describe('CheckBox Component', () => {
|
|
7
|
+
test('renders CheckBox with default props', () => {
|
|
8
|
+
render(_jsx(CheckBox, { title: "Banks", data: [{ title: 'SBI Bank', checked: false }], onChange: () => { } }));
|
|
9
|
+
expect(screen.getByText('Banks')).toBeInTheDocument();
|
|
10
|
+
expect(screen.getByText('SBI Bank')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
test('renders CheckBox with custom props', () => {
|
|
13
|
+
render(_jsx(CheckBox, { title: "Custom Title", data: [{ title: 'Custom Bank', checked: true }], onChange: () => { } }));
|
|
14
|
+
expect(screen.getByText('Custom Title')).toBeInTheDocument();
|
|
15
|
+
expect(screen.getByText('Custom Bank')).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
test('calls onChange with correct arguments when checkbox is clicked', () => {
|
|
18
|
+
const handleChange = vi.fn();
|
|
19
|
+
render(_jsx(CheckBox, { title: "Banks", data: [{ title: 'SBI Bank', checked: false }], onChange: handleChange }));
|
|
20
|
+
fireEvent.click(screen.getByText('SBI Bank'));
|
|
21
|
+
expect(handleChange).toHaveBeenCalledWith([
|
|
22
|
+
{ title: 'SBI Bank', checked: true },
|
|
23
|
+
]);
|
|
24
|
+
});
|
|
25
|
+
test('toggles checkbox state on click', () => {
|
|
26
|
+
const { container } = render(_jsx(CheckBox, { title: "Banks", data: [{ title: 'SBI Bank', checked: false }], onChange: () => { } }));
|
|
27
|
+
const checkbox = container.querySelector('svg');
|
|
28
|
+
expect(checkbox).toBeInTheDocument();
|
|
29
|
+
fireEvent.click(screen.getByText('SBI Bank'));
|
|
30
|
+
expect(container.querySelector('svg')).toHaveAttribute('fill', '#E7503D');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
2
|
+
interface DatePickerProps {
|
|
3
|
+
title: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
disable?: boolean;
|
|
7
|
+
showFormat?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const DatePickerComp: ({ title, className, disable, value, showFormat, placeholder, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=date-picker.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/date-picker/date-picker.component.tsx"],"names":[],"mappings":"AAEA,OAAO,4CAA4C,CAAC;AAOpD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,mEAOxB,eAAe,4CAkDjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, forwardRef } from 'react';
|
|
3
|
+
import DatePicker from 'react-datepicker';
|
|
4
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
5
|
+
import { DatePickerSvg } from '../../library/assets/svg';
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import { InputWrapper } from '../form/form.component';
|
|
8
|
+
import s from '../../tc.module.css';
|
|
9
|
+
import { cn } from '../../utils';
|
|
10
|
+
export const DatePickerComp = ({ title = 'Title', className, disable, value, showFormat = 'yyyy-MM-dd', placeholder = 'Select Date', }) => {
|
|
11
|
+
const [pickedDate, setPickedDate] = useState(value && dayjs(value).toDate());
|
|
12
|
+
const CustomInput = forwardRef((props, ref) => {
|
|
13
|
+
return (_jsxs("div", { onClick: !disable && props.onClick, ref: ref, className: cn(s['border-gray-light'], s['place-items-center'], s['border'], s['rounded-md'], s['px-2'], s.flex), children: [_jsx("label", { className: cn(s['mr-3'], s['font-arimaRegular'], s['text-primaryCharcoal'], s['text-lg']), children: props.value || props.placeholder }), _jsx(DatePickerSvg, { width: 15, height: 15 })] }));
|
|
14
|
+
});
|
|
15
|
+
CustomInput.displayName = 'CustomInput';
|
|
16
|
+
const handleChanges = (date) => {
|
|
17
|
+
setPickedDate(date);
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(InputWrapper, { label: title, children: _jsx("div", { className: cn(s.flex, s['zIndex-999'], className), children: _jsx(DatePicker, { selected: pickedDate || new Date(), dateFormat: showFormat, placeholder: placeholder, onChange: handleChanges, customInput: _jsx(CustomInput, {}) }) }) }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LabelProps {
|
|
3
|
+
htmlFor: string;
|
|
4
|
+
hasError?: boolean;
|
|
5
|
+
style?: any;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const Label: React.FunctionComponent<LabelProps>;
|
|
9
|
+
interface InputWrapperProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
hasError?: boolean;
|
|
14
|
+
style?: any;
|
|
15
|
+
ref?: any;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare const InputWrapper: React.FunctionComponent<InputWrapperProps>;
|
|
19
|
+
interface InputProps extends InputWrapperProps {
|
|
20
|
+
value?: any;
|
|
21
|
+
defaultValue?: any;
|
|
22
|
+
name?: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
labelClassName?: string;
|
|
29
|
+
rows?: number;
|
|
30
|
+
style?: any;
|
|
31
|
+
wrapperStyle?: any;
|
|
32
|
+
hasError?: boolean;
|
|
33
|
+
pattern?: any;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
isAutoFocus?: boolean;
|
|
36
|
+
input2isBlurEnable?: boolean;
|
|
37
|
+
onChange?: (e: any) => void;
|
|
38
|
+
onBlur?: (e: any) => void;
|
|
39
|
+
onKeyDown?: (e: any) => void;
|
|
40
|
+
onKeyUp?: (e: any) => void;
|
|
41
|
+
inputRef?: any;
|
|
42
|
+
}
|
|
43
|
+
export declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<any>>;
|
|
44
|
+
export declare const InputPassword: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<any>>;
|
|
45
|
+
export declare const MultilineInput: (props: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
interface InputRadioProps extends InputWrapperProps {
|
|
47
|
+
values?: any[];
|
|
48
|
+
value?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
labelStyle?: any;
|
|
53
|
+
onChange?: (e: any) => void;
|
|
54
|
+
}
|
|
55
|
+
export declare const InputRadio: (props: InputRadioProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
interface InputDateProps extends InputWrapperProps {
|
|
57
|
+
value?: any;
|
|
58
|
+
name?: string;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
hasError?: boolean;
|
|
61
|
+
format?: string;
|
|
62
|
+
isCalenderOpen?: boolean;
|
|
63
|
+
minDate?: Date;
|
|
64
|
+
maxDate?: Date;
|
|
65
|
+
onChange?: (e: any) => void;
|
|
66
|
+
onCalendarToggle?: (status: boolean) => void;
|
|
67
|
+
onFocusRemove?: (date: any) => void;
|
|
68
|
+
}
|
|
69
|
+
export declare const InputDate: ({ name, value, label, id, hasError, disabled, format, onChange, onFocusRemove, }: InputDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
interface InputDateTimeProps extends InputWrapperProps {
|
|
71
|
+
type?: string;
|
|
72
|
+
id?: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
hasError?: boolean;
|
|
75
|
+
className?: string;
|
|
76
|
+
min?: string;
|
|
77
|
+
onChange?: (value: any) => void;
|
|
78
|
+
}
|
|
79
|
+
export declare const InputDateTime: ({ type, id, label, hasError, className, min, onChange, }: InputDateTimeProps) => import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
export declare const CheckBox: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
interface InputFileProps extends InputWrapperProps {
|
|
82
|
+
value?: any;
|
|
83
|
+
name?: string;
|
|
84
|
+
placeholder?: string;
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
accept?: string;
|
|
87
|
+
multiple?: boolean;
|
|
88
|
+
hasError?: boolean;
|
|
89
|
+
onChange?: (e: any) => void;
|
|
90
|
+
}
|
|
91
|
+
export declare const InputFile: (props: InputFileProps) => import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
interface ToggleProps extends InputWrapperProps {
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
isToggleLabel?: boolean;
|
|
95
|
+
defaultChecked?: boolean;
|
|
96
|
+
className?: string;
|
|
97
|
+
icons?: any;
|
|
98
|
+
value?: boolean;
|
|
99
|
+
name?: string;
|
|
100
|
+
onChange?: (e: boolean) => void;
|
|
101
|
+
style?: any;
|
|
102
|
+
}
|
|
103
|
+
export declare const Toggle: (props: ToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
104
|
+
export {};
|
|
105
|
+
//# sourceMappingURL=form.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/form/form.component.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState, useEffect } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import s from '../../tc.module.css';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
export const Label = (props) => (_jsx(_Fragment, { children: _jsx("label", { htmlFor: props.htmlFor, className: cn(s['block'], s['text-3xs'], s['font-medium'], s['mb-1'], {
|
|
7
|
+
[s['text-red-400']]: props.hasError,
|
|
8
|
+
[s['text-current']]: !props.hasError,
|
|
9
|
+
}), style: { ...props.style }, children: props.children }) }));
|
|
10
|
+
export const InputWrapper = (props) => (_jsxs("div", { className: cn(props.className), ref: props.ref, children: [_jsx(Label, { htmlFor: props.id || '', hasError: props.hasError, style: { ...props.style }, children: _jsx("span", { className: cn(s['dark:text-white'], s['w-10']), children: props.label }) }), props.children] }));
|
|
11
|
+
export const Input = React.forwardRef((props, ref) => {
|
|
12
|
+
const handleKeyPress = (e) => {
|
|
13
|
+
const key = e.key;
|
|
14
|
+
const regex = props.pattern;
|
|
15
|
+
if (regex && !regex?.test(key)) {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return (_jsx(InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName, children: _jsx("input", { type: props.type || 'text', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: props?.isAutoFocus || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => props.onChange && props.onChange(e.target.value), onKeyPress: (e) => handleKeyPress(e), className: cn(props.className, s['leading-4'], s['p-2'], s['dark:bg-boxdark'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md'], {
|
|
20
|
+
[s['border-red']]: props.hasError,
|
|
21
|
+
[s['border-gray-300']]: !props.hasError,
|
|
22
|
+
}), onBlur: (e) => props.onBlur && props.onBlur(e.target.value), onKeyDown: props.onKeyDown && props.onKeyDown }) }));
|
|
23
|
+
});
|
|
24
|
+
export const InputPassword = React.forwardRef((props, ref) => {
|
|
25
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
26
|
+
const handleMouseDown = () => {
|
|
27
|
+
setShowPassword(true);
|
|
28
|
+
};
|
|
29
|
+
const handleMouseUp = () => {
|
|
30
|
+
setShowPassword(false);
|
|
31
|
+
};
|
|
32
|
+
return (_jsx(InputWrapper, { label: props.label, id: props.id, hasError: props.hasError, style: props.wrapperStyle, className: props.labelClassName, children: _jsxs("div", { className: cn(s['flex'], s['items-center'], s['relative']), children: [_jsx("input", { type: showPassword ? 'text' : 'password', id: props.id, ref: props.inputRef, "data-testid": "INPT", autoFocus: props?.isAutoFocus || false, name: props.name, style: props.style, defaultValue: props.defaultValue, placeholder: props.placeholder, required: props.required || false, disabled: props.disabled || false, autoComplete: "given-name", maxLength: props.maxLength, value: props.value, onChange: (e) => props.onChange && props.onChange(e.target.value), className: cn(props.className, s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md'], s['dark:bg-boxdark'], {
|
|
33
|
+
[s['border-red']]: props.hasError,
|
|
34
|
+
[s['border-gray-300']]: !props.hasError,
|
|
35
|
+
}), onBlur: (e) => props.onBlur && props.onBlur(e.target.value), onKeyDown: props.onKeyDown && props.onKeyDown }), _jsx("div", { className: cn(s['flex'], s['absolute'], s['right-3']), children: _jsx("svg", { className: cn(s['h-6'], s['dark:bg-boxdark']), fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 576 512", onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, children: showPassword ? (_jsx("path", { fill: "currentColor", d: "M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z" })) : (_jsx("path", { fill: "currentColor", d: "M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z" })) }) })] }) }));
|
|
36
|
+
});
|
|
37
|
+
export const MultilineInput = (props) => (_jsx(InputWrapper, { label: props.label, id: props.id, className: props.className, children: _jsx("textarea", { id: props.id, autoComplete: "given-name", value: props.value, disabled: props.disabled, style: props.style, rows: props.rows, onKeyUp: props.onKeyUp && props.onKeyUp, placeholder: props.placeholder, onChange: (e) => props.onChange && props.onChange(e.target.value), onBlur: (e) => props.onBlur && props.onBlur(e.target.value), className: cn(s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md'], s['dark:bg-boxdark'], {
|
|
38
|
+
[s['border-red']]: props.hasError,
|
|
39
|
+
[s['border-gray-300']]: !props.hasError,
|
|
40
|
+
}), defaultValue: props.defaultValue }) }));
|
|
41
|
+
export const InputRadio = (props) => (_jsx(InputWrapper, { label: props.label, id: props.id, style: props.labelStyle, children: props.values?.map((item, key) => (_jsxs("div", { className: cn(s['flex'], s['items-center'], s['gap-2']), onClick: () => {
|
|
42
|
+
props.onChange && props.onChange(item.value);
|
|
43
|
+
}, children: [_jsx("input", { type: "radio", id: props.id, name: props.name, value: item.value, checked: item.value == props.value ? true : false, onChange: () => props.onChange && props.onChange(item.value), className: cn(s['w-4'], s['h-4'], s['text-blue-600'], s['bg-gray-100'], s['border-gray-300'], s['focus:ring-blue-500'], s['dark:focus:ring-blue-600'], s['dark:ring-offset-gray-800'], s['focus:ring-2'], s['dark:bg-gray-700'], s['dark:border-gray-600']) }, key), _jsx(Label, { htmlFor: props.id || '', style: { marginTop: 6 }, children: item.label })] }, key))) }));
|
|
44
|
+
export const InputDate = ({ name, value, label, id, hasError, disabled, format, onChange, onFocusRemove, }) => (_jsx(InputWrapper, { label: label, id: id, hasError: hasError, children: _jsx("input", { type: "date", id: id, name: name, disabled: disabled || false, value: value, onChange: (e) => onChange && onChange(e), className: cn(s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], {
|
|
45
|
+
[s['border-red']]: hasError,
|
|
46
|
+
[s['border-gray-300']]: !hasError,
|
|
47
|
+
}) }) }));
|
|
48
|
+
export const InputDateTime = ({ type, id, label, hasError, className, min, onChange, }) => (_jsx(InputWrapper, { label: label, id: id, hasError: hasError, children: _jsx("input", { type: type || 'datetime-local', id: id || 'interviewDateTime', name: "interviewDateTime", className: cn(s['border'], s['border-gray-300'], s['rounded-md'], s['p-2'], s['w-full'], {
|
|
49
|
+
[s['border-red']]: hasError,
|
|
50
|
+
[s['border-gray-300']]: !hasError,
|
|
51
|
+
}, { className }), min: min || new Date().toISOString().slice(0, 16), onChange: (e) => {
|
|
52
|
+
onChange && onChange(e.target.value);
|
|
53
|
+
} }) }));
|
|
54
|
+
export const CheckBox = (props) => {
|
|
55
|
+
return (_jsxs("div", { children: [_jsx("input", { onClick: props.handleCheckChieldElement, type: "checkbox", checked: props.isChecked, value: props.value }, props.id), ' ', props.value] }));
|
|
56
|
+
};
|
|
57
|
+
export const InputFile = (props) => (_jsx(InputWrapper, { label: props.label, id: props.id, children: _jsx("input", { type: "file", id: props.id, name: props.name, disabled: props.disabled || false, accept: props.accept, value: props.value, onChange: (e) => props.onChange && props.onChange(e), className: cn(s['leading-4'], s['p-2'], s['focus:outline-none'], s['focus:ring'], s['block'], s['w-full'], s['shadow-sm'], s['sm:text-base'], s['border'], s['rounded-md'], {
|
|
58
|
+
[s['border-red']]: props.hasError,
|
|
59
|
+
[s['border-gray-300']]: !props.hasError,
|
|
60
|
+
}), multiple: props.multiple }) }));
|
|
61
|
+
export const Toggle = (props) => {
|
|
62
|
+
const [toggle, setToggle] = useState(props.value);
|
|
63
|
+
const { onChange, disabled, className, isToggleLabel = true } = props;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
setToggle(props.value);
|
|
66
|
+
}, [props.value]);
|
|
67
|
+
const triggerToggle = () => {
|
|
68
|
+
if (disabled) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setToggle(!toggle);
|
|
72
|
+
if (typeof onChange === 'function') {
|
|
73
|
+
onChange(!toggle);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const toggleClasses = classNames('wrg-toggle ', {
|
|
77
|
+
'wrg-toggle--checked': toggle,
|
|
78
|
+
'wrg-toggle--disabled': disabled,
|
|
79
|
+
}, className);
|
|
80
|
+
return (_jsx(InputWrapper, { label: props.label, id: props.id, style: props.style, children: _jsxs("div", { onClick: triggerToggle, className: toggleClasses, children: [_jsx("div", { className: cn(s['wrg-toggle-container'], {
|
|
81
|
+
'bg-green-700': toggle,
|
|
82
|
+
'bg-black dark:bg-white': !toggle,
|
|
83
|
+
}), children: isToggleLabel && (_jsxs(_Fragment, { children: [_jsx("div", { className: cn(s['wrg-toggle-check']), children: _jsx("span", { className: cn(s['text-white'], s['ml-1']), children: "Yes" }) }), _jsx("div", { className: cn(s['wrg-toggle-uncheck']), children: _jsx("span", { className: cn(s['dark:text-black']), children: "No" }) })] })) }), _jsx("div", { className: cn(s['wrg-toggle-circle'], s['dark:bg-black'], {
|
|
84
|
+
'ml-1': toggle,
|
|
85
|
+
'mr-1': !toggle,
|
|
86
|
+
}) }), _jsx("input", { type: "checkbox", "aria-label": "Toggle Button", className: cn(s['wrg-toggle-input']) })] }) }));
|
|
87
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IconBaseProps } from 'react-icons/lib';
|
|
2
|
+
interface IconProps {
|
|
3
|
+
nameIcon: string;
|
|
4
|
+
propsIcon?: IconBaseProps;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
isDisable?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Icon: ({ nameIcon, propsIcon, tooltip, isDisable, onClick, }: IconProps) => JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=icons.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/icons/icons.component.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAI9C,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,IAAI,0DAMd,SAAS,KAAG,WA8Ed,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense } from 'react';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { Tooltip } from '../tooltip/tooltip.component';
|
|
5
|
+
import loadable from '@loadable/component';
|
|
6
|
+
import s from '../../tc.module.css';
|
|
7
|
+
import { cn } from '../../utils';
|
|
8
|
+
export const Icon = ({ nameIcon, propsIcon, tooltip = '', isDisable = false, onClick, }) => {
|
|
9
|
+
try {
|
|
10
|
+
const iconProps = {
|
|
11
|
+
...propsIcon,
|
|
12
|
+
color: isDisable ? '#808080' : propsIcon?.color || 'rgb(36 48 63)',
|
|
13
|
+
};
|
|
14
|
+
// const lib = nameIcon
|
|
15
|
+
// .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
16
|
+
// .split(' ')[0]
|
|
17
|
+
// .toLowerCase();
|
|
18
|
+
const lib = nameIcon.startsWith('IoIo')
|
|
19
|
+
? 'io'
|
|
20
|
+
: nameIcon.startsWith('Io')
|
|
21
|
+
? 'io5'
|
|
22
|
+
: nameIcon
|
|
23
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
24
|
+
.split(' ')[0]
|
|
25
|
+
.toLowerCase();
|
|
26
|
+
const iconLibraries = {
|
|
27
|
+
fa: () => import('react-icons/fa'),
|
|
28
|
+
md: () => import('react-icons/md'),
|
|
29
|
+
io: () => import('react-icons/io'),
|
|
30
|
+
fi: () => import('react-icons/fi'),
|
|
31
|
+
bs: () => import('react-icons/bs'),
|
|
32
|
+
hi: () => import('react-icons/hi'),
|
|
33
|
+
go: () => import('react-icons/go'),
|
|
34
|
+
si: () => import('react-icons/si'),
|
|
35
|
+
ti: () => import('react-icons/ti'),
|
|
36
|
+
wi: () => import('react-icons/wi'),
|
|
37
|
+
di: () => import('react-icons/di'),
|
|
38
|
+
ri: () => import('react-icons/ri'),
|
|
39
|
+
fc: () => import('react-icons/fc'),
|
|
40
|
+
gr: () => import('react-icons/gr'),
|
|
41
|
+
lu: () => import('react-icons/lu'),
|
|
42
|
+
gi: () => import('react-icons/gi'),
|
|
43
|
+
tb: () => import('react-icons/tb'),
|
|
44
|
+
rx: () => import('react-icons/rx'),
|
|
45
|
+
im: () => import('react-icons/im'),
|
|
46
|
+
cg: () => import('react-icons/cg'),
|
|
47
|
+
io5: () => import('react-icons/io5'),
|
|
48
|
+
ai: () => import('react-icons/ai'),
|
|
49
|
+
vsc: () => import('react-icons/vsc'),
|
|
50
|
+
bi: () => import('react-icons/bi'),
|
|
51
|
+
fa2: () => import('react-icons/fa'),
|
|
52
|
+
ci: () => import('react-icons/ci'),
|
|
53
|
+
lib: () => import('react-icons/lib'),
|
|
54
|
+
lia: () => import('react-icons/lia'),
|
|
55
|
+
pi: () => import('react-icons/pi'),
|
|
56
|
+
tfi: () => import('react-icons/tfi'),
|
|
57
|
+
fa6: () => import('react-icons/fa6'),
|
|
58
|
+
};
|
|
59
|
+
const loadLibrary = iconLibraries[lib] || (() => import('react-icons/md'));
|
|
60
|
+
const ElementIcon = loadable(loadLibrary, {
|
|
61
|
+
resolveComponent: (el) => el[nameIcon] != null ? el[nameIcon] : el[Object.keys(el.default)[0]],
|
|
62
|
+
});
|
|
63
|
+
return (_jsx("div", { className: cn(s.iconContainer), onClick: () => {
|
|
64
|
+
if (!isDisable)
|
|
65
|
+
onClick && onClick();
|
|
66
|
+
}, children: !_.isEmpty(tooltip) ? (_jsx(Tooltip, { content: tooltip, children: _jsx(ElementIcon, { ...iconProps, className: cn(s.icon) }) })) : (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: _jsx(ElementIcon, { ...iconProps, className: cn(s.icon) }) })) }));
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
return _jsx(_Fragment, {});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PinInputGridProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
hasError?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
disable?: boolean;
|
|
7
|
+
blur?: any;
|
|
8
|
+
name?: string;
|
|
9
|
+
pin: Array<number | undefined>;
|
|
10
|
+
onPinChanged: (pinEntry: number | undefined, index: number) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const InputOtp: React.FC<PinInputGridProps>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=input-otp.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/input/input-otp.component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/B,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkHhD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import s from '../../tc.module.css';
|
|
5
|
+
import { cn } from '../../utils';
|
|
6
|
+
export const InputOtp = ({ className, pin, onPinChanged, }) => {
|
|
7
|
+
const pinLength = 6;
|
|
8
|
+
const Pin_Min_Value = 0;
|
|
9
|
+
const Pin_Max_Value = 9;
|
|
10
|
+
const BACKSPACE_Key = 'Backspace';
|
|
11
|
+
const inputRefs = useRef([]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const ref = inputRefs.current[0];
|
|
14
|
+
if (ref) {
|
|
15
|
+
ref.focus();
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
const changePinFocus = (pinIndex) => {
|
|
19
|
+
const ref = inputRefs.current[pinIndex];
|
|
20
|
+
if (ref) {
|
|
21
|
+
ref.focus();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const onChange = (event, index) => {
|
|
25
|
+
const value = event.target.value;
|
|
26
|
+
const pinNumber = Number(value.trim());
|
|
27
|
+
if (isNaN(pinNumber) || value.length === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
|
|
31
|
+
onPinChanged(pinNumber, index);
|
|
32
|
+
if (index < pinLength - 1) {
|
|
33
|
+
changePinFocus(index + 1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const onKeyDown = (event, index) => {
|
|
38
|
+
const keyboardKeyCode = event.nativeEvent.code;
|
|
39
|
+
if (keyboardKeyCode != BACKSPACE_Key)
|
|
40
|
+
return;
|
|
41
|
+
if (pin[index] === undefined) {
|
|
42
|
+
changePinFocus(index - 1);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
onPinChanged(undefined, index);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return (_jsx("div", { className: cn(className, s['relative']), children: _jsx("div", { className: cn(s['flex'], s['space-x-1'], s['bg-background-secondary'], s['rounded-lg'], s['outline-offset-8']), children: Array.from({ length: pinLength }, (_, index) => (_jsx("input", { "data-testid": "onPinChanged", className: cn(s['pt-3'], s['pb-2'], s['block'], s['w-full'], s['px-0'], s['text-5xl'], s['font-extrabold'], s['border-b-0'], s['text-orange'], s['mt-0'], s['bg-transparent'], s['text-center'], s['z-20'], s['appearance-none'], s['focus:outline-none'], s['font-arimaRegular']), onKeyDown: (event) => onKeyDown(event, index), onMouseUp: () => {
|
|
49
|
+
if (pin.join('').length <= 0) {
|
|
50
|
+
changePinFocus(0);
|
|
51
|
+
}
|
|
52
|
+
}, onClick: () => {
|
|
53
|
+
if (pin.join('').length <= 0) {
|
|
54
|
+
onPinChanged(undefined, 0);
|
|
55
|
+
}
|
|
56
|
+
}, ref: (el) => {
|
|
57
|
+
if (el) {
|
|
58
|
+
inputRefs.current[index] = el;
|
|
59
|
+
}
|
|
60
|
+
}, onChange: (event) => onChange(event, index), value: pin[index] || '' }, index))) }) }));
|
|
61
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.-z-1 {
|
|
2
|
+
z-index: -1;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.origin-0 {
|
|
6
|
+
transform-origin: 0%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
input:focus ~ label,
|
|
10
|
+
input:not(:placeholder-shown) ~ label,
|
|
11
|
+
textarea:focus ~ label,
|
|
12
|
+
textarea:not(:placeholder-shown) ~ label,
|
|
13
|
+
select:focus ~ label,
|
|
14
|
+
select:not([value=""]):valid ~ label {
|
|
15
|
+
/* @apply transform; scale-75; -translate-y-6; */
|
|
16
|
+
--tw-translate-x: 0;
|
|
17
|
+
--tw-translate-y: 0;
|
|
18
|
+
--tw-rotate: 0;
|
|
19
|
+
--tw-skew-x: 0;
|
|
20
|
+
--tw-skew-y: 0;
|
|
21
|
+
transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y))
|
|
22
|
+
rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))
|
|
23
|
+
scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
24
|
+
--tw-scale-x: 0.75;
|
|
25
|
+
--tw-scale-y: 0.75;
|
|
26
|
+
--tw-translate-y: -1.5rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input:focus ~ label,
|
|
30
|
+
select:focus ~ label {
|
|
31
|
+
/* @apply text-black; left-0; */
|
|
32
|
+
--tw-text-opacity: 1;
|
|
33
|
+
color: "#696969";
|
|
34
|
+
left: 0px;
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './input.styles.css';
|
|
3
|
+
interface PinInputGridProps {
|
|
4
|
+
title: string;
|
|
5
|
+
hasError?: any;
|
|
6
|
+
errorMsg?: string;
|
|
7
|
+
defaultMsg?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
disable?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
defaultPin: Array<number | undefined>;
|
|
12
|
+
onPinChanged: (item: any, index: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const InputPin: React.FC<PinInputGridProps>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=input-pin.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-pin.component.d.ts","sourceRoot":"","sources":["../../../../../../src/core-components/src/atoms/input/input-pin.component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAC9C,OAAO,oBAAoB,CAAC;AAI5B,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0KhD,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import './input.styles.css';
|
|
5
|
+
import s from '../../tc.module.css';
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
export const InputPin = ({ title, className, defaultPin, errorMsg, defaultMsg, hasError, onPinChanged, }) => {
|
|
8
|
+
const pin = useRef([]);
|
|
9
|
+
const [reload, setReload] = useState(false);
|
|
10
|
+
const pinLength = 12;
|
|
11
|
+
const Pin_Min_Value = 0;
|
|
12
|
+
const Pin_Max_Value = 9;
|
|
13
|
+
const BACKSPACE_Key = 'Backspace';
|
|
14
|
+
const inputRefs = useRef([]);
|
|
15
|
+
const removeValuesFromArray = (valuesArray, value) => {
|
|
16
|
+
const valueIndex = valuesArray.findIndex((entry) => entry === value);
|
|
17
|
+
if (valueIndex === -1) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
valuesArray.splice(valueIndex, 1);
|
|
21
|
+
};
|
|
22
|
+
const changePinFocus = (pinIndex) => {
|
|
23
|
+
const ref = inputRefs.current[pinIndex];
|
|
24
|
+
if (ref) {
|
|
25
|
+
ref.focus();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const onChange = (event, index) => {
|
|
29
|
+
const previousValue = event.target.defaultValue;
|
|
30
|
+
const valueArray = event.target.value.split('');
|
|
31
|
+
const output = removeValuesFromArray(valueArray, previousValue);
|
|
32
|
+
const value = valueArray.pop();
|
|
33
|
+
if (!value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const pinNumber = Number(value);
|
|
37
|
+
if (isNaN(pinNumber) || value.length === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
pin.current[pin.current?.length] = value;
|
|
41
|
+
setReload(!reload);
|
|
42
|
+
if (pinNumber >= Pin_Min_Value && pinNumber <= Pin_Max_Value) {
|
|
43
|
+
onPinChanged(pin.current, index);
|
|
44
|
+
if (index < pinLength - 1) {
|
|
45
|
+
changePinFocus(index + 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const onKeyDown = (event, index) => {
|
|
50
|
+
const keyboardKeyCode = event.nativeEvent.code;
|
|
51
|
+
if (keyboardKeyCode != BACKSPACE_Key)
|
|
52
|
+
return;
|
|
53
|
+
if (pin.current[index] !== undefined && keyboardKeyCode === BACKSPACE_Key) {
|
|
54
|
+
changePinFocus(index - 1);
|
|
55
|
+
}
|
|
56
|
+
if (pin.current[index] === undefined) {
|
|
57
|
+
changePinFocus(index - 1);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
onPinChanged(undefined, index);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return (_jsxs("div", { className: cn(className, s.relative), children: [_jsx("label", { className: cn(s['duration-300'], s['-z-1'], s['origin-0'], s['text-gray-dark-secondary'], s['font-arimaRegular'], s['text-md']), children: title }), _jsx("div", { className: cn(s.flex, s['space-x-1']), children: Array.from({ length: pinLength }, (_, index) => (_jsxs("div", { className: cn(s.flex, s['space-x-1'], s['max-w-full'], s['items-stretch']), children: [_jsx("input", { "data-testid": "inputElementPin", type: "tel", className: cn(s['pb-2'], s.block, s['w-4'], s['px-0'], s['mt-0'], s['bg-transparent'], s['text-center'], s['border-0'], s['border-b'], s['z-20'], s['appearance-none'], s['rounded-none'], s['focus:outline-none'], s['focus:ring-0'], s['focus:border-gray-secondary'], s['border-gray-secondary'], s['font-arimaRegular']), onKeyUp: (event) => onKeyDown(event, index), onMouseUp: () => {
|
|
64
|
+
if (pin.current.join('').length <= 0) {
|
|
65
|
+
changePinFocus(0);
|
|
66
|
+
}
|
|
67
|
+
}, onClick: () => {
|
|
68
|
+
if (pin.current.join('').length <= 0) {
|
|
69
|
+
onPinChanged(undefined, 0);
|
|
70
|
+
}
|
|
71
|
+
}, ref: (el) => {
|
|
72
|
+
if (el) {
|
|
73
|
+
inputRefs.current[index] = el;
|
|
74
|
+
}
|
|
75
|
+
}, onChange: (event) => onChange(event, index), value: pin.current[index]?.toString() || '' }, index), _jsx("div", { className: s.invisible, children: (index + 1) % 4 === 0 ? 'ss' : null })] }, index))) }), hasError && hasError?.type !== 'required' && (_jsx("span", { className: cn(s['text-sm'], s['text-red'], s['text-4xs'], s['font-arimaRegular']), id: "error", children: `${errorMsg || ''}` })), (!hasError || hasError?.type === 'required') && (_jsx("span", { className: cn(s['text-sm'], s['text-4xs'], s['font-arimaRegular']), id: "error", children: `${defaultMsg || ''}` }))] }));
|
|
76
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './input.styles.css';
|
|
2
|
+
interface InputProps {
|
|
3
|
+
title: string;
|
|
4
|
+
defaultValue: string;
|
|
5
|
+
hasError?: any;
|
|
6
|
+
errorMsg?: string;
|
|
7
|
+
defaultMsg?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
disable?: boolean;
|
|
10
|
+
inputStyle?: string;
|
|
11
|
+
autoComplete?: 'off' | 'on';
|
|
12
|
+
maxlength?: number;
|
|
13
|
+
onChange: (value: any) => void;
|
|
14
|
+
onBlur?: (value: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const Input: ({ title, defaultValue, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength, onChange, onBlur, }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=input.component.d.ts.map
|