react-restyle-components 0.2.38 → 0.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +2 -2
- package/lib/src/App.js +1 -1
- package/lib/src/core-components/atoms/button/Button.stories.js +1 -1
- package/lib/src/core-components/atoms/button/_button.component.d.ts +7 -0
- package/lib/src/core-components/atoms/button/_button.component.js +20 -0
- package/lib/src/core-components/atoms/button/button.component.d.ts +0 -1
- package/lib/src/core-components/atoms/button/button.component.js +5 -4
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.d.ts +1 -1
- package/lib/src/core-components/atoms/button/buttonGroup/buttonGroup.component.js +1 -1
- package/lib/src/core-components/atoms/check-box/checkBox.component.d.ts +1 -1
- package/lib/src/core-components/atoms/check-box/checkBox.component.js +1 -1
- package/lib/src/core-components/atoms/date-picker/date-picker.component.d.ts +1 -1
- package/lib/src/core-components/atoms/date-picker/date-picker.component.js +1 -1
- package/lib/src/core-components/atoms/form/form.component.d.ts +1 -1
- package/lib/src/core-components/atoms/form/form.component.js +1 -1
- package/lib/src/core-components/atoms/grid/grid.component.d.ts +1 -1
- package/lib/src/core-components/atoms/grid/grid.component.js +1 -1
- package/lib/src/core-components/atoms/icons/icons.component.d.ts +1 -1
- package/lib/src/core-components/atoms/icons/icons.component.js +1 -1
- package/lib/src/core-components/atoms/input/input-otp.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input-otp.component.js +1 -1
- package/lib/src/core-components/atoms/input/input-pin.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input-pin.component.js +1 -1
- package/lib/src/core-components/atoms/input/input.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input/input.component.js +1 -1
- package/lib/src/core-components/atoms/input-dropdown/input-dropdown.component.d.ts +1 -1
- package/lib/src/core-components/atoms/input-dropdown/input-dropdown.component.js +1 -1
- package/lib/src/core-components/atoms/list/list.component.d.ts +1 -1
- package/lib/src/core-components/atoms/list/list.component.js +1 -1
- package/lib/src/core-components/atoms/loader/loader.component.d.ts +1 -1
- package/lib/src/core-components/atoms/loader/loader.component.js +1 -1
- package/lib/src/core-components/atoms/radio/radio.component.d.ts +1 -1
- package/lib/src/core-components/atoms/radio/radio.component.js +1 -1
- package/lib/src/core-components/atoms/stepper/stepper.component.d.ts +1 -1
- package/lib/src/core-components/atoms/stepper/stepper.component.js +1 -1
- package/lib/src/core-components/atoms/tabs/_tabs.component.d.ts +16 -0
- package/lib/src/core-components/atoms/tabs/_tabs.component.js +19 -0
- package/lib/src/core-components/atoms/tabs/tabs.component.js +0 -1
- package/lib/src/core-components/atoms/tabs/tabs.stories.d.ts +1 -1
- package/lib/src/core-components/atoms/tabs/tabs.stories.js +1 -1
- package/lib/src/core-components/atoms/timer/timer.component.d.ts +1 -1
- package/lib/src/core-components/atoms/timer/timer.component.js +1 -1
- package/lib/src/core-components/index.d.ts +1 -0
- package/lib/src/core-components/index.js +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.d.ts +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.d.ts +1 -1
- package/lib/src/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +1 -1
- package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.d.ts +1 -1
- package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.js +1 -1
- package/lib/src/core-components/molecules/autocomplete/autocomplete.d.ts +1 -1
- package/lib/src/core-components/molecules/autocomplete/autocomplete.js +1 -1
- package/lib/src/core-components/molecules/color-picker-modal/color-picker-modal.component.d.ts +1 -1
- package/lib/src/core-components/molecules/color-picker-modal/color-picker-modal.component.js +1 -1
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.d.ts +1 -1
- package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js +1 -1
- package/lib/src/core-components/molecules/multi-select/multi-select.component.d.ts +1 -1
- package/lib/src/core-components/molecules/multi-select/multi-select.component.js +1 -1
- package/lib/src/core-components/molecules/multi-select-with-field/multi-select-with-field.component.js +7 -7
- package/lib/src/core-utils/utility.util.d.ts +0 -1
- package/lib/src/core-utils/utility.util.js +0 -3
- package/package.json +2 -2
- package/lib/src/core-components/atoms/pdf/pdf-images.components.d.ts +0 -9
- package/lib/src/core-components/atoms/pdf/pdf-images.components.js +0 -8
- package/lib/src/core-components/atoms/pdf/pdf-table.components.d.ts +0 -11
- package/lib/src/core-components/atoms/pdf/pdf-table.components.js +0 -56
- package/lib/src/core-components/atoms/pdf/pdf-typography.components.d.ts +0 -20
- package/lib/src/core-components/atoms/pdf/pdf-typography.components.js +0 -70
- package/lib/src/core-components/atoms/pdf/pdf-wrapped-view.components.d.ts +0 -52
- package/lib/src/core-components/atoms/pdf/pdf-wrapped-view.components.js +0 -50
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-restyle-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easy use restyle components",
|
|
6
6
|
"author": {
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@storybook/addon-interactions": "^8.0.6",
|
|
72
72
|
"@storybook/addon-links": "^8.0.6",
|
|
73
73
|
"@storybook/addon-onboarding": "^8.0.6",
|
|
74
|
+
"@storybook/addon-postcss": "^2.0.0",
|
|
74
75
|
"@storybook/addon-themes": "^8.4.7",
|
|
75
76
|
"@storybook/addon-webpack5-compiler-swc": "^1.0.2",
|
|
76
77
|
"@storybook/blocks": "^8.0.6",
|
|
@@ -92,7 +93,6 @@
|
|
|
92
93
|
"husky": "^7.0.4",
|
|
93
94
|
"jest": "^29.7.0",
|
|
94
95
|
"lint-staged": "^12.4.0",
|
|
95
|
-
"postcss": "^8.4.49",
|
|
96
96
|
"postcss-loader": "^8.1.1",
|
|
97
97
|
"prettier": "^3.3.3",
|
|
98
98
|
"react-router-dom": "^7.0.2",
|
package/lib/src/App.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import './App.css';
|
|
3
|
-
import { Tab, Tabs } from './core-components';
|
|
3
|
+
import { Tab, Tabs } from './core-components/atoms/tabs/_tabs.component';
|
|
4
4
|
function App() {
|
|
5
5
|
const [color, setColor] = useState('#aabbcc');
|
|
6
6
|
return (React.createElement("div", { className: "flex flex-col gap-4 p-4" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TooltipProvider } from '../tooltip/tooltip.component';
|
|
3
|
-
import { Button } from './
|
|
3
|
+
import { Button } from './_button.component';
|
|
4
4
|
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Design System/Atoms/Button',
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps } from './Button.types';
|
|
3
|
+
import '../../../tc.module.css';
|
|
4
|
+
/**
|
|
5
|
+
* It's a `<button>button</button>`. Pass in regular button props such as onClick as well as any of the props defined here.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Tooltip } from '../tooltip/tooltip.component';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
|
+
/**
|
|
6
|
+
* It's a `<button>button</button>`. Pass in regular button props such as onClick as well as any of the props defined here.
|
|
7
|
+
*/
|
|
8
|
+
export const Button = forwardRef(({ variant = 'solid', tooltip, disabled = false, type = 'button', className, children, ...args }, ref) => {
|
|
9
|
+
const buttonColorClass = variant === 'solid'
|
|
10
|
+
? 'text-white bg-[#007BFF] hover:bg-[#007BFF] hover:shadow-lg text-white'
|
|
11
|
+
: 'dark:text-white text-black border border-gray-400 hover:shadow-lg';
|
|
12
|
+
const button = (React.createElement("button", { ref: ref, ...args, className: `${className} rounded-100px px-3 py-1 text-md ${buttonColorClass} pt-2 pb-2 font-nunitoSansRegular ${disabled ? 'opacity-50' : 'opacity-100'}`, type: type, disabled: disabled }, children));
|
|
13
|
+
if (tooltip) {
|
|
14
|
+
return React.createElement(Tooltip, { content: tooltip }, button);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return button;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Button.displayName = 'Button';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { Tooltip } from '../tooltip/tooltip.component';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import s from '../../../tc.module.css';
|
|
5
|
+
import { cn } from '../../../core-utils';
|
|
5
6
|
/**
|
|
6
7
|
* It's a `<button>button</button>`. Pass in regular button props such as onClick as well as any of the props defined here.
|
|
7
8
|
*/
|
|
8
9
|
export const Button = forwardRef(({ variant = 'solid', tooltip, disabled = false, type = 'button', className, children, ...args }, ref) => {
|
|
9
10
|
const buttonColorClass = variant === 'solid'
|
|
10
|
-
? 'text-white bg-[#007BFF] hover:bg-[#007BFF] hover:shadow-lg text-white'
|
|
11
|
-
: 'dark:text-white
|
|
12
|
-
const button = (React.createElement("button", { ref: ref, ...args, className:
|
|
11
|
+
? cn(s['text-white'], s['bg-[#007BFF]'], s['hover:bg-[#007BFF]'], s['hover:shadow-lg'], s['text-white'])
|
|
12
|
+
: cn(s['dark:text-white'], s['text-black'], s['border'], s['border-gray-400'], s['hover:shadow-lg']);
|
|
13
|
+
const button = (React.createElement("button", { ref: ref, ...args, className: cn(s['rounded-100px'], s['px-3'], s['py-1'], s['text-md'], buttonColorClass, s['pt-2'], s['pb-2'], s['font-nunitoSansRegular'], disabled ? s['opacity-50'] : s['opacity-100'], className), type: type, disabled: disabled }, children));
|
|
13
14
|
if (tooltip) {
|
|
14
15
|
return React.createElement(Tooltip, { content: tooltip }, button);
|
|
15
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import '../../../../tc.css';
|
|
3
|
+
import '../../../../tc.module.css';
|
|
4
4
|
export declare const ButtonGroup: ({ children, orientation, className, }: {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
orientation?: "horizontal" | "vertical" | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import '../../../../tc.css';
|
|
2
|
+
import '../../../../tc.module.css';
|
|
3
3
|
export const ButtonGroup = ({ children, orientation = 'horizontal', className, }) => (React.createElement("div", { className: `flex ${orientation == 'horizontal' ? 'flex-row' : 'flex-col'} w-fit gap-2 ${className}` }, children));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import '../../../tc.css';
|
|
2
|
+
import '../../../tc.module.css';
|
|
3
3
|
import { UnCheckbox, CheckedBox } from '../../../library/assets/svg';
|
|
4
4
|
import { InputWrapper } from '../form/form.component';
|
|
5
5
|
export const CheckBox = ({ title = 'Banks', data = [{ title: 'SBI Bank', checked: false }], className, onChange, }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, forwardRef } from 'react';
|
|
2
|
-
import '../../../tc.css';
|
|
2
|
+
import '../../../tc.module.css';
|
|
3
3
|
import DatePicker from 'react-datepicker';
|
|
4
4
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
5
5
|
import { DatePickerSvg } from '../../../library/assets/svg';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import '../../../tc.css';
|
|
3
|
+
import '../../../tc.module.css';
|
|
4
4
|
export const Label = (props) => (React.createElement(React.Fragment, null,
|
|
5
5
|
React.createElement("label", { htmlFor: props.htmlFor, className: `${props.hasError ? 'text-red-400' : 'text-current'} block text-3xs font-medium mb-1`, style: { ...props.style } }, props.children)));
|
|
6
6
|
export const InputWrapper = (props) => (React.createElement("div", { className: props.className, ref: props.ref },
|
|
@@ -2,7 +2,7 @@ import React, { Suspense } from 'react';
|
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import { Tooltip } from '../tooltip/tooltip.component';
|
|
4
4
|
import loadable from '@loadable/component';
|
|
5
|
-
import '../../../tc.css';
|
|
5
|
+
import '../../../tc.module.css';
|
|
6
6
|
let lib = 'md';
|
|
7
7
|
export const Icon = ({ nameIcon, propsIcon, tooltip = '', isDisable = false, onClick, }) => {
|
|
8
8
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import './input-otp.styles.css';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const InputOtp = ({ className, pin, onPinChanged, }) => {
|
|
6
6
|
const pinLength = 6;
|
|
7
7
|
const Pin_Min_Value = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import React, { useRef, useState } from 'react';
|
|
3
3
|
import './input.styles.css';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const InputPin = ({ title, className, defaultPin, errorMsg, defaultMsg, hasError, onPinChanged, }) => {
|
|
6
6
|
const pin = useRef([]);
|
|
7
7
|
const [reload, setReload] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import './input.styles.css';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const Input = ({ title, defaultValue, className, disable, hasError, errorMsg, defaultMsg, inputStyle, autoComplete, maxlength = 40, onChange, onBlur, }) => {
|
|
6
6
|
const [value, setValue] = useState(defaultValue);
|
|
7
7
|
const onKeyUpValue = (event) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { UpArrow, DownArrow } from '../../../library/assets/svg';
|
|
3
|
-
import '../../../tc.css';
|
|
3
|
+
import '../../../tc.module.css';
|
|
4
4
|
export const InputDropdown = ({ items, className, hasError, title, onChange, }) => {
|
|
5
5
|
const [isOpen, setIsOpen] = useState(false);
|
|
6
6
|
const [value, setValue] = useState('');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Container, Row, Spinner } from 'reactstrap';
|
|
3
|
-
import '../../../tc.css';
|
|
3
|
+
import '../../../tc.module.css';
|
|
4
4
|
export const Loader = () => (React.createElement(Container, { fluid: true, className: "vh-50 d-flex" },
|
|
5
5
|
React.createElement(Row, { className: "justify-content-center align-self-center w-100 text-center" },
|
|
6
6
|
React.createElement(Spinner, { color: "primary" }))));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { CheckedRadio, UncheckRadio } from '../../../library/assets/svg';
|
|
3
3
|
import { InputWrapper } from '../form/form.component';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const Radio = ({ title = 'Source', data = [], className, onChange, }) => {
|
|
6
6
|
const [list, setList] = useState(data);
|
|
7
7
|
const width = 20;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import '../../../tc.css';
|
|
2
|
+
import '../../../tc.module.css';
|
|
3
3
|
export const Stepper = ({ className = '', steps, currentStep = 1, onStepClick, }) => {
|
|
4
4
|
const finalClass = `${className} w-full px-4 sm:px-8`;
|
|
5
5
|
const progressClass = 'absolute my-4 top-1/2 left-0 h-0.5 transform -translate-y-1/2 bg-orange transition-width ease-in-out duration-500';
|
|
@@ -0,0 +1,16 @@
|
|
|
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) => React.JSX.Element;
|
|
7
|
+
export interface TabsProps {
|
|
8
|
+
options: Array<{
|
|
9
|
+
title: string;
|
|
10
|
+
content?: React.JSX.Element;
|
|
11
|
+
inActive?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
children: React.JSX.Element[];
|
|
14
|
+
}
|
|
15
|
+
export declare const Tabs: ({ options, children }: TabsProps) => React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { cn } from '../../../core-utils';
|
|
3
|
+
export const Tab = ({ title, children }) => {
|
|
4
|
+
return (React.createElement("div", { className: cn('flex'), key: title }, children));
|
|
5
|
+
};
|
|
6
|
+
export const Tabs = ({ options, children }) => {
|
|
7
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
8
|
+
const [selected, setSelected] = useState(options[0].title);
|
|
9
|
+
const tabs = React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === Tab);
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement("div", { className: cn('flex flex-col w-full') },
|
|
12
|
+
React.createElement("div", { className: cn('flex border-b') }, options?.map((tab, index) => (React.createElement("button", { type: "button", key: index, className: cn('py-2', 'px-4', 'mr-1', 'border-none', 'rounded-t-md', 'shadow-inner', 'cursor-pointer', activeTab === index && 'bg-blue-500', activeTab === index && 'border-none', activeTab === index && 'text-white'), onClick: () => {
|
|
13
|
+
setSelected(tab?.title);
|
|
14
|
+
!tab.inActive && setActiveTab(index);
|
|
15
|
+
}, disabled: tab.inActive }, tab.title)))),
|
|
16
|
+
React.createElement("div", { className: cn('p-2', 'border', 'border-solid', 'border-slate-600', 'rounded-b-md') }, options[activeTab]?.content
|
|
17
|
+
? options[activeTab]?.content
|
|
18
|
+
: tabs[options?.findIndex((item) => item.title === selected)]))));
|
|
19
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Tabs, Tab } from './
|
|
2
|
+
import { Tabs, Tab } from './_tabs.component';
|
|
3
3
|
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
|
|
4
4
|
const meta = {
|
|
5
5
|
title: 'Design System/Atoms/Tabs',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
3
3
|
import React, { useEffect, useState, useImperativeHandle } from 'react';
|
|
4
4
|
import { TimerSVG } from '../../../library/assets/svg';
|
|
5
|
-
import '../../../tc.css';
|
|
5
|
+
import '../../../tc.module.css';
|
|
6
6
|
// eslint-disable-next-line react/display-name
|
|
7
7
|
export const Timer = React.forwardRef(({ onClear }, ref) => {
|
|
8
8
|
const width = 15;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// import * as Form from './atoms/form/form.component';
|
|
2
|
-
|
|
2
|
+
export * from './atoms/button/button.component';
|
|
3
3
|
// export * from './atoms/button/buttonGroup/buttonGroup.component';
|
|
4
4
|
// export * from './atoms/check-box/checkBox.component';
|
|
5
5
|
// export * from './atoms/date-picker/date-picker.component';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import React, { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const AutoCompleteFilterMultipleSelectMultipleFieldsDisplay = ({ uniqueField = '_id', isSelectedStringArray = false, loader = false, placeholder = 'Search...', data, hasError = false, disable = false, isUpperCase = false, name, onFilter, onUpdate, onSelect, onBlur, }) => {
|
|
6
6
|
const [value, setValue] = useState('');
|
|
7
7
|
const [options, setOptions] = useState();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import React, { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
export const AutoCompleteFilterSingleSelectMultiFieldsDisplay = ({ disable = false, loader = false, displayValue = '', placeholder = 'Search...', data, hasError = false, className, posstion = 'absolute', onFilter, onSelect, onBlur, }) => {
|
|
6
6
|
const [value, setValue] = useState(displayValue);
|
|
7
7
|
const [options, setOptions] = useState(data.list);
|
package/lib/src/core-components/molecules/auto-complete-group-by/auto-complete-group-by.component.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { Icon } from '../../atoms/icons/icons.component';
|
|
4
4
|
// import PerfectScrollbar from 'react-perfect-scrollbar';
|
|
5
|
-
import '../../../tc.css';
|
|
5
|
+
import '../../../tc.module.css';
|
|
6
6
|
export const AutocompleteGroupBy = (props) => {
|
|
7
7
|
//const [userRouter, setUserRouter] = useState<any>()
|
|
8
8
|
const [value, setValue] = useState(props.displayValue);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
// import './autocomplete.css';
|
|
3
|
-
import '../../../tc.css';
|
|
3
|
+
import '../../../tc.module.css';
|
|
4
4
|
const LI_ELEMENT_HEIGHT = 34;
|
|
5
5
|
export const Autocomplete = ({ value = '', onValueChange, options = [], }) => {
|
|
6
6
|
const [activeOption, setActiveOption] = useState(value === '' || options.indexOf(value) === -1 ? 0 : options.indexOf(value));
|
package/lib/src/core-components/molecules/color-picker-modal/color-picker-modal.component.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useCallback, useRef, useState } from 'react';
|
|
|
2
2
|
import { HexColorPicker } from 'react-colorful';
|
|
3
3
|
import { useClickOutside } from '../../../hooks';
|
|
4
4
|
import './color-picker-modal.css';
|
|
5
|
-
import '../../../tc.css';
|
|
5
|
+
import '../../../tc.module.css';
|
|
6
6
|
export const ColorPickerModal = ({ color, onChange, onClose, }) => {
|
|
7
7
|
const popover = useRef();
|
|
8
8
|
const [isOpen, toggle] = useState(false);
|
package/lib/src/core-components/molecules/css-multiline-input/css-multiline-input.component.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import * as Form from '../../atoms/form/form.component';
|
|
3
3
|
import { properties as propertiesObj } from './css-properties';
|
|
4
|
-
import '../../../tc.css';
|
|
4
|
+
import '../../../tc.module.css';
|
|
5
5
|
const mapToArray = (arr) => {
|
|
6
6
|
const res = [];
|
|
7
7
|
arr.forEach(function (obj, index) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
-
import '../../../tc.css';
|
|
2
|
+
import '../../../tc.module.css';
|
|
3
3
|
export const MultiSelect = ({ options = [], selectedItems = [], hasError = false, onSelect, }) => {
|
|
4
4
|
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
5
5
|
const [isListOpen, setIsListOpen] = useState(false);
|
|
@@ -4,7 +4,7 @@ import _ from 'lodash';
|
|
|
4
4
|
export const MultiSelectWithField = ({ displayField = '', options = [], selectedItems = [], hasError = false, onSelect, }) => {
|
|
5
5
|
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
6
6
|
const [isListOpen, setIsListOpen] = useState(false);
|
|
7
|
-
const useOutsideAlerter = ref => {
|
|
7
|
+
const useOutsideAlerter = (ref) => {
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
function handleClickOutside(event) {
|
|
10
10
|
if (ref.current && !ref.current.contains(event.target) && isListOpen) {
|
|
@@ -24,20 +24,20 @@ export const MultiSelectWithField = ({ displayField = '', options = [], selected
|
|
|
24
24
|
useOutsideAlerter(wrapperRef);
|
|
25
25
|
return (React.createElement(React.Fragment, null,
|
|
26
26
|
React.createElement("div", { className: `flex dark:bg-boxdark dark:text-white flex-col w-full rounded-md border-2 ${hasError ? 'border-red ' : 'border-gray-300'}`, ref: wrapperRef },
|
|
27
|
-
React.createElement("span", { className:
|
|
27
|
+
React.createElement("span", { className: "p-2 mt-1 shadow-sm", onClick: () => {
|
|
28
28
|
setIsListOpen(!isListOpen);
|
|
29
29
|
} }, selectedOptions?.length > 0
|
|
30
30
|
? `${selectedOptions?.length} Items`
|
|
31
31
|
: 'Select'),
|
|
32
32
|
React.createElement("div", { className: `flex mx-2 ${isListOpen ? `show` : `hidden`}` }, options
|
|
33
|
-
? options?.length > 0 && (React.createElement("ul", { className:
|
|
34
|
-
React.createElement("input", { className:
|
|
33
|
+
? options?.length > 0 && (React.createElement("ul", { className: "flex flex-col gap-1 p-2" }, options?.map((item, index) => (React.createElement("li", { key: index, className: "flex items-center" },
|
|
34
|
+
React.createElement("input", { className: "flex bg-black", type: "checkbox", checked: !_.isEmpty(selectedOptions?.find((e) => e[displayField]?.toUpperCase() ==
|
|
35
35
|
item[displayField]?.toUpperCase()))
|
|
36
36
|
? true
|
|
37
37
|
: false, onChange: () => {
|
|
38
|
-
if (!_.isEmpty(selectedOptions?.find(e => e[displayField]?.toUpperCase() ==
|
|
38
|
+
if (!_.isEmpty(selectedOptions?.find((e) => e[displayField]?.toUpperCase() ==
|
|
39
39
|
item[displayField]?.toUpperCase()))) {
|
|
40
|
-
setSelectedOptions(selectedOptions?.filter(e => e[displayField]?.toUpperCase() !=
|
|
40
|
+
setSelectedOptions(selectedOptions?.filter((e) => e[displayField]?.toUpperCase() !=
|
|
41
41
|
item[displayField]?.toUpperCase()));
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
@@ -53,6 +53,6 @@ export const MultiSelectWithField = ({ displayField = '', options = [], selected
|
|
|
53
53
|
onSelect(selectedOptions);
|
|
54
54
|
} }),
|
|
55
55
|
' ',
|
|
56
|
-
React.createElement("span", { className:
|
|
56
|
+
React.createElement("span", { className: "flex ml-2 dark:text-white text-center" }, item[displayField]))))))
|
|
57
57
|
: null))));
|
|
58
58
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-restyle-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.39",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easy use restyle components",
|
|
6
6
|
"author": {
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@storybook/addon-interactions": "^8.0.6",
|
|
72
72
|
"@storybook/addon-links": "^8.0.6",
|
|
73
73
|
"@storybook/addon-onboarding": "^8.0.6",
|
|
74
|
+
"@storybook/addon-postcss": "^2.0.0",
|
|
74
75
|
"@storybook/addon-themes": "^8.4.7",
|
|
75
76
|
"@storybook/addon-webpack5-compiler-swc": "^1.0.2",
|
|
76
77
|
"@storybook/blocks": "^8.0.6",
|
|
@@ -92,7 +93,6 @@
|
|
|
92
93
|
"husky": "^7.0.4",
|
|
93
94
|
"jest": "^29.7.0",
|
|
94
95
|
"lint-staged": "^12.4.0",
|
|
95
|
-
"postcss": "^8.4.49",
|
|
96
96
|
"postcss-loader": "^8.1.1",
|
|
97
97
|
"prettier": "^3.3.3",
|
|
98
98
|
"react-router-dom": "^7.0.2",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Style } from '@react-pdf/types';
|
|
3
|
-
interface PdfImageProps {
|
|
4
|
-
src?: string | any;
|
|
5
|
-
style?: Style | Style[];
|
|
6
|
-
fixed?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const PdfImage: ({ src, style, }: PdfImageProps) => React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Image } from '@react-pdf/renderer';
|
|
3
|
-
export const PdfImage = ({ src = 'https://picsum.photos/200/300', style, }) => {
|
|
4
|
-
return (React.createElement(React.Fragment, null,
|
|
5
|
-
React.createElement(Image, { style: {
|
|
6
|
-
...style,
|
|
7
|
-
}, src: src })));
|
|
8
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Style } from '@react-pdf/types';
|
|
3
|
-
interface PdfTableProps {
|
|
4
|
-
style?: Style;
|
|
5
|
-
headerStyle?: Style;
|
|
6
|
-
headerFixed?: boolean;
|
|
7
|
-
fields: Array<any>;
|
|
8
|
-
data: Array<any>;
|
|
9
|
-
}
|
|
10
|
-
export declare const PdfTable: ({ headerFixed, fields, data, style, headerStyle, }: PdfTableProps) => React.JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, View, StyleSheet } from '@react-pdf/renderer';
|
|
3
|
-
import { PdfSmall } from './pdf-typography.components';
|
|
4
|
-
import { PdfBorderView } from './pdf-wrapped-view.components';
|
|
5
|
-
const styles = StyleSheet.create({
|
|
6
|
-
table: {
|
|
7
|
-
borderColor: '#000000',
|
|
8
|
-
borderWidth: 1,
|
|
9
|
-
marginHorizontal: 20,
|
|
10
|
-
flexFlow: 1,
|
|
11
|
-
},
|
|
12
|
-
tableRow: {
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
},
|
|
15
|
-
headerBg: {
|
|
16
|
-
backgroundColor: '#aaa',
|
|
17
|
-
borderStyle: 'solid',
|
|
18
|
-
borderColor: '#000000',
|
|
19
|
-
borderWidth: 1,
|
|
20
|
-
},
|
|
21
|
-
tableCellHeader: {
|
|
22
|
-
margin: 2,
|
|
23
|
-
fontSize: 10,
|
|
24
|
-
fontWeight: 'bold',
|
|
25
|
-
textAlign: 'center',
|
|
26
|
-
},
|
|
27
|
-
tableCell: {
|
|
28
|
-
margin: 2,
|
|
29
|
-
fontSize: 12,
|
|
30
|
-
},
|
|
31
|
-
textCenter: {
|
|
32
|
-
textAlign: 'center',
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
export const PdfTable = ({ headerFixed = false, fields, data, style, headerStyle, }) => (React.createElement(View, { style: [styles.table, { ...style }] },
|
|
36
|
-
React.createElement(View, { style: [styles.tableRow, styles.headerBg, { ...headerStyle }], fixed: headerFixed }, fields.map((item, index) => (React.createElement(View, { key: index, style: [{ width: item.width + '%' }] },
|
|
37
|
-
React.createElement(Text, { style: [styles.tableCellHeader] }, item?.title))))),
|
|
38
|
-
data?.map((item, index) => (React.createElement(View, { key: index, style: styles.tableRow }, Object.entries(item).map((_item, _idx) => (React.createElement(PdfBorderView, { key: _idx, style: {
|
|
39
|
-
width: fields[_idx]?.width + '%',
|
|
40
|
-
borderStyle: 'solid',
|
|
41
|
-
}, mh: 0, mv: 0, p: 0, bw: 1, borderColor: "#000000" }, typeof _item[1] == 'object' ? (React.createElement(React.Fragment, null,
|
|
42
|
-
React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1]?.panelDesc
|
|
43
|
-
? `Panel Description : ${_item[1]?.panelDesc} \n`
|
|
44
|
-
: ''),
|
|
45
|
-
React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1]?.panelMethodName
|
|
46
|
-
? `Panel Method Name: ${_item[1]?.panelMethodName} \n`
|
|
47
|
-
: ''),
|
|
48
|
-
React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1]?.testMethodName
|
|
49
|
-
? `Test Method Name: ${_item[1]?.testMethodName} \n`
|
|
50
|
-
: ''),
|
|
51
|
-
React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1]?.analyteDesc
|
|
52
|
-
? `Analyte Description: ${_item[1]?.analyteDesc} \n`
|
|
53
|
-
: ''),
|
|
54
|
-
React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1]?.analyteMethodName
|
|
55
|
-
? `Analyte Method Name: ${_item[1]?.analyteMethodName}`
|
|
56
|
-
: ''))) : (React.createElement(PdfSmall, { style: { textAlign: 'center' } }, _item[1] || ''))))))))));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Style } from '@react-pdf/types';
|
|
3
|
-
interface PdfTextProps {
|
|
4
|
-
fontWeight?: 'bold' | 'medium' | 'normal';
|
|
5
|
-
fontSize?: number;
|
|
6
|
-
fontFamily?: 'ArimaRegular' | 'ArimaBold' | string;
|
|
7
|
-
textAlign?: 'center' | 'left' | 'right';
|
|
8
|
-
style?: Style | Style[];
|
|
9
|
-
lineHeight?: number;
|
|
10
|
-
bottom?: number;
|
|
11
|
-
fixed?: boolean;
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export declare const PdfHeading: ({ fontWeight, fontSize, fontFamily, style, children, }: PdfTextProps) => React.JSX.Element;
|
|
15
|
-
export declare const PdfSubHeading: ({ fontWeight, fontSize, fontFamily, style, children, }: PdfTextProps) => React.JSX.Element;
|
|
16
|
-
export declare const PdfMedium: ({ fontWeight, fontSize, textAlign, fontFamily, style, children, }: PdfTextProps) => React.JSX.Element;
|
|
17
|
-
export declare const PdfRegular: ({ fontWeight, fontSize, textAlign, fontFamily, style, children, }: PdfTextProps) => React.JSX.Element;
|
|
18
|
-
export declare const PdfSmall: ({ fontSize, fontFamily, fontWeight, textAlign, lineHeight, fixed, style, children, }: PdfTextProps) => React.JSX.Element;
|
|
19
|
-
export declare const PdfPageNumber: ({ style, bottom }: PdfTextProps) => React.JSX.Element;
|
|
20
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, Font } from '@react-pdf/renderer';
|
|
3
|
-
Font.register({
|
|
4
|
-
family: 'ArimaBold',
|
|
5
|
-
fonts: [
|
|
6
|
-
{
|
|
7
|
-
src: '../../../library/assets/fonts/arima/arima-bold.ttf',
|
|
8
|
-
fontStyle: 'normal',
|
|
9
|
-
fontWeight: 'bold',
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
});
|
|
13
|
-
Font.register({
|
|
14
|
-
family: 'ArimaRegular',
|
|
15
|
-
src: '../../../library/assets/fonts/arima/arima-regular.ttf',
|
|
16
|
-
});
|
|
17
|
-
export const PdfHeading = ({ fontWeight = 'bold', fontSize = 22, fontFamily = 'ArimaRegular', style, children, }) => {
|
|
18
|
-
return (React.createElement(Text, { style: {
|
|
19
|
-
fontWeight: fontWeight,
|
|
20
|
-
fontSize: fontSize,
|
|
21
|
-
fontFamily: fontFamily,
|
|
22
|
-
...style,
|
|
23
|
-
} }, children));
|
|
24
|
-
};
|
|
25
|
-
export const PdfSubHeading = ({ fontWeight = 'bold', fontSize = 20, fontFamily = 'ArimaRegular', style, children, }) => {
|
|
26
|
-
return (React.createElement(Text, { style: {
|
|
27
|
-
fontWeight: fontWeight,
|
|
28
|
-
fontSize: fontSize,
|
|
29
|
-
fontFamily: fontFamily,
|
|
30
|
-
...style,
|
|
31
|
-
} }, children));
|
|
32
|
-
};
|
|
33
|
-
export const PdfMedium = ({ fontWeight = 'medium', fontSize = 16, textAlign = 'left', fontFamily = 'ArimaRegular', style, children, }) => {
|
|
34
|
-
return (React.createElement(Text, { style: {
|
|
35
|
-
fontWeight: fontWeight,
|
|
36
|
-
fontSize: fontSize,
|
|
37
|
-
fontFamily: fontFamily,
|
|
38
|
-
textAlign: textAlign,
|
|
39
|
-
...style,
|
|
40
|
-
} }, children));
|
|
41
|
-
};
|
|
42
|
-
export const PdfRegular = ({ fontWeight = 'normal', fontSize = 12, textAlign = 'left', fontFamily = 'ArimaRegular', style, children, }) => {
|
|
43
|
-
return (React.createElement(Text, { style: {
|
|
44
|
-
fontWeight: fontWeight,
|
|
45
|
-
fontSize: fontSize,
|
|
46
|
-
fontFamily: fontFamily,
|
|
47
|
-
textAlign: textAlign,
|
|
48
|
-
...style,
|
|
49
|
-
} }, children));
|
|
50
|
-
};
|
|
51
|
-
export const PdfSmall = ({ fontSize = 10, fontFamily = 'ArimaRegular', fontWeight = 'normal', textAlign = 'left', lineHeight = 0, fixed = false, style, children, }) => {
|
|
52
|
-
return (React.createElement(Text, { style: {
|
|
53
|
-
fontSize: fontSize,
|
|
54
|
-
fontFamily: fontFamily,
|
|
55
|
-
fontWeight: fontWeight,
|
|
56
|
-
lineHeight: lineHeight,
|
|
57
|
-
textAlign: textAlign,
|
|
58
|
-
...style,
|
|
59
|
-
}, fixed: fixed }, children));
|
|
60
|
-
};
|
|
61
|
-
export const PdfPageNumber = ({ style, bottom = 55 }) => {
|
|
62
|
-
return (React.createElement(Text, { style: {
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
bottom: bottom,
|
|
65
|
-
right: 14,
|
|
66
|
-
fontSize: 10,
|
|
67
|
-
color: 'black',
|
|
68
|
-
...style,
|
|
69
|
-
}, render: ({ pageNumber, totalPages }) => `Page ${pageNumber} of ${totalPages}`, fixed: true }));
|
|
70
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Style } from '@react-pdf/types';
|
|
3
|
-
interface PdfViewProps {
|
|
4
|
-
mh?: number;
|
|
5
|
-
mt?: number;
|
|
6
|
-
mv?: number;
|
|
7
|
-
p?: number;
|
|
8
|
-
borderColor?: string;
|
|
9
|
-
bg?: string;
|
|
10
|
-
bw?: number;
|
|
11
|
-
height?: string | number;
|
|
12
|
-
alignItems?: 'flex-end' | 'flex-start' | 'center';
|
|
13
|
-
flexDirection?: 'row' | 'column';
|
|
14
|
-
fixed?: boolean;
|
|
15
|
-
isBreak?: boolean;
|
|
16
|
-
isWrap?: boolean;
|
|
17
|
-
style?: Style | Style[] | any;
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
export declare const PdfView: ({ mh, p, flexDirection, style, fixed, isBreak, alignItems, mt, isWrap, children, }: PdfViewProps) => React.JSX.Element;
|
|
21
|
-
export declare const PdfBorderView: ({ mh, mv, p, borderColor, bw, style, flexDirection, fixed, isBreak, children, }: PdfViewProps) => React.JSX.Element;
|
|
22
|
-
interface PdfHeaderProps {
|
|
23
|
-
bg?: string;
|
|
24
|
-
p?: number;
|
|
25
|
-
alignItems?: React.CSSProperties['alignItems'] | any;
|
|
26
|
-
fixed?: boolean;
|
|
27
|
-
style?: React.CSSProperties | any;
|
|
28
|
-
children?: React.ReactNode;
|
|
29
|
-
}
|
|
30
|
-
export declare const PdfHeader: ({ bg, p, alignItems, fixed, style, children, }: PdfHeaderProps) => React.JSX.Element;
|
|
31
|
-
export declare const PdfSubHeader: ({ bg, p, alignItems, fixed, style, children, }: PdfViewProps) => React.JSX.Element;
|
|
32
|
-
interface PdfFooterViewProps {
|
|
33
|
-
bottom?: number;
|
|
34
|
-
left?: number;
|
|
35
|
-
right?: number;
|
|
36
|
-
bg?: string;
|
|
37
|
-
p?: number;
|
|
38
|
-
alignItems?: React.CSSProperties['alignItems'];
|
|
39
|
-
fixed?: boolean;
|
|
40
|
-
height?: string | number;
|
|
41
|
-
style?: React.CSSProperties | any;
|
|
42
|
-
children: React.ReactNode;
|
|
43
|
-
}
|
|
44
|
-
export declare const PdfFooterView: ({ bottom, left, right, bg, p, alignItems, fixed, height, style, children, }: PdfFooterViewProps) => React.JSX.Element;
|
|
45
|
-
interface GridProps {
|
|
46
|
-
cols?: number;
|
|
47
|
-
bg?: 'transparent' | string;
|
|
48
|
-
style?: Style | Style[];
|
|
49
|
-
children?: React.ReactNode;
|
|
50
|
-
}
|
|
51
|
-
export declare const PdfGrid: React.FunctionComponent<GridProps>;
|
|
52
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
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 (React.createElement(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));
|
|
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 (React.createElement(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));
|
|
23
|
-
};
|
|
24
|
-
export const PdfHeader = ({ bg = 'orange', p = 10, alignItems = 'flex-start', fixed = false, style, children, }) => {
|
|
25
|
-
return (React.createElement(View, { style: {
|
|
26
|
-
backgroundColor: bg,
|
|
27
|
-
alignItems: alignItems,
|
|
28
|
-
padding: p,
|
|
29
|
-
...style,
|
|
30
|
-
}, fixed: fixed }, children));
|
|
31
|
-
};
|
|
32
|
-
export const PdfSubHeader = ({ bg = 'yellow', p = 4, alignItems = 'flex-end', fixed = false, style, children, }) => {
|
|
33
|
-
return (React.createElement(View, { style: {
|
|
34
|
-
backgroundColor: bg,
|
|
35
|
-
alignItems: alignItems,
|
|
36
|
-
padding: p,
|
|
37
|
-
...style,
|
|
38
|
-
}, fixed: fixed }, 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 (React.createElement(View, { style: [
|
|
42
|
-
{ position: 'absolute', bottom, left, right, height },
|
|
43
|
-
{ backgroundColor: bg, padding: p, alignItems: alignItems, ...style },
|
|
44
|
-
], fixed: fixed }, children));
|
|
45
|
-
};
|
|
46
|
-
export const PdfGrid = ({ cols = 1, bg = 'white', style, children, }) => (React.createElement(View, { style: {
|
|
47
|
-
width: `${100 / cols}%`,
|
|
48
|
-
backgroundColor: bg,
|
|
49
|
-
...style,
|
|
50
|
-
} }, children));
|