next-recomponents 1.7.15 → 1.7.17
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/dist/index.d.mts +27 -15
- package/dist/index.d.ts +27 -15
- package/dist/index.js +115 -50
- package/dist/index.mjs +114 -50
- package/package.json +1 -1
- package/src/doc-viewer/index.tsx +69 -0
- package/src/index.tsx +1 -0
- package/src/table/index.tsx +2 -3
- package/src/table/v.tsx +32 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, Dispatch, SetStateAction, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
interface Props$
|
|
4
|
+
interface Props$6 {
|
|
5
5
|
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
declare function Alert({ color, children, ...props }: Props$
|
|
8
|
+
declare function Alert({ color, children, ...props }: Props$6): react_jsx_runtime.JSX.Element;
|
|
9
9
|
|
|
10
|
-
interface Props$
|
|
10
|
+
interface Props$5 extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
11
11
|
icon?: React.ReactNode;
|
|
12
12
|
size?: "full" | "small";
|
|
13
13
|
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
14
14
|
}
|
|
15
|
-
declare function Button({ className, size, color, children, icon, disabled, ...props }: Props$
|
|
15
|
+
declare function Button({ className, size, color, children, icon, disabled, ...props }: Props$5): react_jsx_runtime.JSX.Element;
|
|
16
16
|
|
|
17
17
|
type LocationItem = {
|
|
18
18
|
location: string;
|
|
@@ -33,7 +33,7 @@ declare function Container({ children, appName, menuList, navItems, leftPanel, f
|
|
|
33
33
|
interface OnSubmitProps extends React$1.FormEvent<HTMLFormElement> {
|
|
34
34
|
values: Record<string, any>;
|
|
35
35
|
}
|
|
36
|
-
interface Props$
|
|
36
|
+
interface Props$4 extends React$1.DetailedHTMLProps<React$1.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement> {
|
|
37
37
|
onSubmit: (e: OnSubmitProps) => void | Promise<void>;
|
|
38
38
|
children: React$1.ReactNode;
|
|
39
39
|
state?: [any, Dispatch<SetStateAction<any>>];
|
|
@@ -41,7 +41,7 @@ interface Props$3 extends React$1.DetailedHTMLProps<React$1.FormHTMLAttributes<H
|
|
|
41
41
|
loader?: React$1.ReactNode;
|
|
42
42
|
}
|
|
43
43
|
declare function useFormValues<T>(initial: Partial<T>): [Partial<T>, React$1.Dispatch<Partial<T>>];
|
|
44
|
-
declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$
|
|
44
|
+
declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$4): react_jsx_runtime.JSX.Element;
|
|
45
45
|
|
|
46
46
|
interface InputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
47
47
|
label: React.ReactNode;
|
|
@@ -57,11 +57,11 @@ declare const regularExpresions: {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
type DataType = string | number | Date | object | undefined | null;
|
|
60
|
-
type Item = {
|
|
60
|
+
type Item$1 = {
|
|
61
61
|
content: DataType;
|
|
62
62
|
handler: ReactNode;
|
|
63
63
|
};
|
|
64
|
-
type DataTypeOrItem = DataType | Item;
|
|
64
|
+
type DataTypeOrItem = DataType | Item$1;
|
|
65
65
|
type TableEventPropsItem = {
|
|
66
66
|
index: number;
|
|
67
67
|
originalData: number;
|
|
@@ -91,18 +91,18 @@ interface TableProps extends React.DetailedHTMLProps<React.TableHTMLAttributes<H
|
|
|
91
91
|
}
|
|
92
92
|
declare function Table({ ...props }: TableProps): react_jsx_runtime.JSX.Element;
|
|
93
93
|
|
|
94
|
-
interface Props$
|
|
94
|
+
interface Props$3 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
95
95
|
label?: React$1.ReactNode;
|
|
96
96
|
maxLength?: number;
|
|
97
97
|
}
|
|
98
|
-
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$
|
|
98
|
+
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$3): react_jsx_runtime.JSX.Element;
|
|
99
99
|
|
|
100
100
|
interface ItemsRecord<T = any> {
|
|
101
101
|
typeof: T;
|
|
102
102
|
id?: number | string | string[] | undefined;
|
|
103
103
|
defaultParams?: Record<string, any>;
|
|
104
104
|
}
|
|
105
|
-
interface Props$
|
|
105
|
+
interface Props$2<T extends Record<string, ItemsRecord>> {
|
|
106
106
|
baseURI: string;
|
|
107
107
|
endpoints: T;
|
|
108
108
|
onError?: (error: any) => void;
|
|
@@ -138,7 +138,7 @@ type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$
|
|
141
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$2<T>): EnhancedEndpoints<T>;
|
|
142
142
|
|
|
143
143
|
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
144
144
|
label?: string;
|
|
@@ -152,7 +152,7 @@ interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLA
|
|
|
152
152
|
}
|
|
153
153
|
declare function Select({ label, placeholder, children, strictMode, ...props }: CustomSelectProps): react_jsx_runtime.JSX.Element;
|
|
154
154
|
|
|
155
|
-
interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> {
|
|
155
|
+
interface Props$1 extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> {
|
|
156
156
|
button: React$1.ReactElement<{
|
|
157
157
|
onClick: (e: React$1.MouseEvent) => void;
|
|
158
158
|
}>;
|
|
@@ -160,7 +160,7 @@ interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<H
|
|
|
160
160
|
hide: () => void;
|
|
161
161
|
}>;
|
|
162
162
|
}
|
|
163
|
-
declare function Modal({ button, children, ref, title }: Props): react_jsx_runtime.JSX.Element;
|
|
163
|
+
declare function Modal({ button, children, ref, title }: Props$1): react_jsx_runtime.JSX.Element;
|
|
164
164
|
|
|
165
165
|
type PreProps = {
|
|
166
166
|
data: string;
|
|
@@ -190,4 +190,16 @@ interface CalendarProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputE
|
|
|
190
190
|
}
|
|
191
191
|
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, label, value, ...otherProps }: CalendarProps): react_jsx_runtime.JSX.Element | null;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
type Item = {
|
|
194
|
+
url: string;
|
|
195
|
+
name: string;
|
|
196
|
+
contentType: string;
|
|
197
|
+
width?: string;
|
|
198
|
+
height?: string;
|
|
199
|
+
};
|
|
200
|
+
type Props = {
|
|
201
|
+
item: Item;
|
|
202
|
+
};
|
|
203
|
+
declare function DocumentViewer({ item }: Props): react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
export { Alert, Button, Container, DocumentViewer, Form, Input, Modal, MyCalendar, Pre, Select, Table, type TableEventProps, TextArea, regularExpresions, useDates, useExcel, useFormValues, useResources };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { DetailedHTMLProps, ButtonHTMLAttributes, Dispatch, SetStateAction, InputHTMLAttributes, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
interface Props$
|
|
4
|
+
interface Props$6 {
|
|
5
5
|
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
declare function Alert({ color, children, ...props }: Props$
|
|
8
|
+
declare function Alert({ color, children, ...props }: Props$6): react_jsx_runtime.JSX.Element;
|
|
9
9
|
|
|
10
|
-
interface Props$
|
|
10
|
+
interface Props$5 extends DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> {
|
|
11
11
|
icon?: React.ReactNode;
|
|
12
12
|
size?: "full" | "small";
|
|
13
13
|
color?: "white" | "primary" | "secondary" | "info" | "danger" | "warning" | "success";
|
|
14
14
|
}
|
|
15
|
-
declare function Button({ className, size, color, children, icon, disabled, ...props }: Props$
|
|
15
|
+
declare function Button({ className, size, color, children, icon, disabled, ...props }: Props$5): react_jsx_runtime.JSX.Element;
|
|
16
16
|
|
|
17
17
|
type LocationItem = {
|
|
18
18
|
location: string;
|
|
@@ -33,7 +33,7 @@ declare function Container({ children, appName, menuList, navItems, leftPanel, f
|
|
|
33
33
|
interface OnSubmitProps extends React$1.FormEvent<HTMLFormElement> {
|
|
34
34
|
values: Record<string, any>;
|
|
35
35
|
}
|
|
36
|
-
interface Props$
|
|
36
|
+
interface Props$4 extends React$1.DetailedHTMLProps<React$1.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement> {
|
|
37
37
|
onSubmit: (e: OnSubmitProps) => void | Promise<void>;
|
|
38
38
|
children: React$1.ReactNode;
|
|
39
39
|
state?: [any, Dispatch<SetStateAction<any>>];
|
|
@@ -41,7 +41,7 @@ interface Props$3 extends React$1.DetailedHTMLProps<React$1.FormHTMLAttributes<H
|
|
|
41
41
|
loader?: React$1.ReactNode;
|
|
42
42
|
}
|
|
43
43
|
declare function useFormValues<T>(initial: Partial<T>): [Partial<T>, React$1.Dispatch<Partial<T>>];
|
|
44
|
-
declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$
|
|
44
|
+
declare function Form({ onSubmit, state, invalidMessage, children, loader, ...otherProps }: Props$4): react_jsx_runtime.JSX.Element;
|
|
45
45
|
|
|
46
46
|
interface InputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
47
47
|
label: React.ReactNode;
|
|
@@ -57,11 +57,11 @@ declare const regularExpresions: {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
type DataType = string | number | Date | object | undefined | null;
|
|
60
|
-
type Item = {
|
|
60
|
+
type Item$1 = {
|
|
61
61
|
content: DataType;
|
|
62
62
|
handler: ReactNode;
|
|
63
63
|
};
|
|
64
|
-
type DataTypeOrItem = DataType | Item;
|
|
64
|
+
type DataTypeOrItem = DataType | Item$1;
|
|
65
65
|
type TableEventPropsItem = {
|
|
66
66
|
index: number;
|
|
67
67
|
originalData: number;
|
|
@@ -91,18 +91,18 @@ interface TableProps extends React.DetailedHTMLProps<React.TableHTMLAttributes<H
|
|
|
91
91
|
}
|
|
92
92
|
declare function Table({ ...props }: TableProps): react_jsx_runtime.JSX.Element;
|
|
93
93
|
|
|
94
|
-
interface Props$
|
|
94
|
+
interface Props$3 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> {
|
|
95
95
|
label?: React$1.ReactNode;
|
|
96
96
|
maxLength?: number;
|
|
97
97
|
}
|
|
98
|
-
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$
|
|
98
|
+
declare function TextArea({ label, className, maxLength, onChange, children, ...props }: Props$3): react_jsx_runtime.JSX.Element;
|
|
99
99
|
|
|
100
100
|
interface ItemsRecord<T = any> {
|
|
101
101
|
typeof: T;
|
|
102
102
|
id?: number | string | string[] | undefined;
|
|
103
103
|
defaultParams?: Record<string, any>;
|
|
104
104
|
}
|
|
105
|
-
interface Props$
|
|
105
|
+
interface Props$2<T extends Record<string, ItemsRecord>> {
|
|
106
106
|
baseURI: string;
|
|
107
107
|
endpoints: T;
|
|
108
108
|
onError?: (error: any) => void;
|
|
@@ -138,7 +138,7 @@ type EnhancedEndpoints<T extends Record<string, ItemsRecord>> = {
|
|
|
138
138
|
};
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$
|
|
141
|
+
declare function useResources<T extends Record<string, ItemsRecord>>({ baseURI, endpoints, onError, }: Props$2<T>): EnhancedEndpoints<T>;
|
|
142
142
|
|
|
143
143
|
interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
144
144
|
label?: string;
|
|
@@ -152,7 +152,7 @@ interface CustomSelectProps extends React$1.DetailedHTMLProps<React$1.InputHTMLA
|
|
|
152
152
|
}
|
|
153
153
|
declare function Select({ label, placeholder, children, strictMode, ...props }: CustomSelectProps): react_jsx_runtime.JSX.Element;
|
|
154
154
|
|
|
155
|
-
interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> {
|
|
155
|
+
interface Props$1 extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement> {
|
|
156
156
|
button: React$1.ReactElement<{
|
|
157
157
|
onClick: (e: React$1.MouseEvent) => void;
|
|
158
158
|
}>;
|
|
@@ -160,7 +160,7 @@ interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<H
|
|
|
160
160
|
hide: () => void;
|
|
161
161
|
}>;
|
|
162
162
|
}
|
|
163
|
-
declare function Modal({ button, children, ref, title }: Props): react_jsx_runtime.JSX.Element;
|
|
163
|
+
declare function Modal({ button, children, ref, title }: Props$1): react_jsx_runtime.JSX.Element;
|
|
164
164
|
|
|
165
165
|
type PreProps = {
|
|
166
166
|
data: string;
|
|
@@ -190,4 +190,16 @@ interface CalendarProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputE
|
|
|
190
190
|
}
|
|
191
191
|
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, label, value, ...otherProps }: CalendarProps): react_jsx_runtime.JSX.Element | null;
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
type Item = {
|
|
194
|
+
url: string;
|
|
195
|
+
name: string;
|
|
196
|
+
contentType: string;
|
|
197
|
+
width?: string;
|
|
198
|
+
height?: string;
|
|
199
|
+
};
|
|
200
|
+
type Props = {
|
|
201
|
+
item: Item;
|
|
202
|
+
};
|
|
203
|
+
declare function DocumentViewer({ item }: Props): react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
export { Alert, Button, Container, DocumentViewer, Form, Input, Modal, MyCalendar, Pre, Select, Table, type TableEventProps, TextArea, regularExpresions, useDates, useExcel, useFormValues, useResources };
|
package/dist/index.js
CHANGED
|
@@ -2971,6 +2971,7 @@ __export(index_exports, {
|
|
|
2971
2971
|
Alert: () => Alert,
|
|
2972
2972
|
Button: () => Button,
|
|
2973
2973
|
Container: () => Container,
|
|
2974
|
+
DocumentViewer: () => DocumentViewer,
|
|
2974
2975
|
Form: () => Form,
|
|
2975
2976
|
Input: () => Input,
|
|
2976
2977
|
Modal: () => Modal,
|
|
@@ -43580,22 +43581,35 @@ function HTable(_a) {
|
|
|
43580
43581
|
] });
|
|
43581
43582
|
}
|
|
43582
43583
|
|
|
43583
|
-
// src/table/
|
|
43584
|
+
// src/table/v.tsx
|
|
43584
43585
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
43586
|
+
function VTable({ data }) {
|
|
43587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("table", { className: "min-w-full border border-gray-300 bg-white text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: Object.entries(data).map(([key, value], idx) => {
|
|
43588
|
+
const content = typeof value === "object" && value !== null && "content" in value ? value.content : value;
|
|
43589
|
+
const handler = typeof value === "object" && value !== null && "handler" in value ? value.handler : null;
|
|
43590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { className: "border-t", children: [
|
|
43591
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "p-2 font-medium text-gray-700 bg-gray-100 w-1/3", children: key }),
|
|
43592
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "p-2 text-gray-900", children: handler ? handler : String(content) })
|
|
43593
|
+
] }, idx);
|
|
43594
|
+
}) }) });
|
|
43595
|
+
}
|
|
43596
|
+
|
|
43597
|
+
// src/table/index.tsx
|
|
43598
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
43585
43599
|
function Table(_a) {
|
|
43586
43600
|
var props = __objRest(_a, []);
|
|
43587
|
-
return /* @__PURE__ */ (0,
|
|
43601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
43588
43602
|
"div",
|
|
43589
43603
|
{
|
|
43590
43604
|
className: "bg-gray-200 border rounded shadow p-1",
|
|
43591
|
-
children: Array.isArray(props.data) ? /* @__PURE__ */ (0,
|
|
43605
|
+
children: Array.isArray(props.data) ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HTable, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(VTable, __spreadValues({}, props))
|
|
43592
43606
|
}
|
|
43593
43607
|
);
|
|
43594
43608
|
}
|
|
43595
43609
|
|
|
43596
43610
|
// src/text-area/index.tsx
|
|
43597
43611
|
var import_react26 = require("react");
|
|
43598
|
-
var
|
|
43612
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
43599
43613
|
function TextArea(_a) {
|
|
43600
43614
|
var _b = _a, {
|
|
43601
43615
|
label,
|
|
@@ -43611,10 +43625,10 @@ function TextArea(_a) {
|
|
|
43611
43625
|
"children"
|
|
43612
43626
|
]);
|
|
43613
43627
|
const [value, setValue] = (0, import_react26.useState)(children);
|
|
43614
|
-
return /* @__PURE__ */ (0,
|
|
43615
|
-
/* @__PURE__ */ (0,
|
|
43616
|
-
/* @__PURE__ */ (0,
|
|
43617
|
-
/* @__PURE__ */ (0,
|
|
43628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
43629
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "font-bold ", children: label }),
|
|
43630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
|
|
43631
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
43618
43632
|
"textarea",
|
|
43619
43633
|
__spreadProps(__spreadValues({}, props), {
|
|
43620
43634
|
className: ["p-1 w-full rounded border shadow", className].join(
|
|
@@ -43630,7 +43644,7 @@ function TextArea(_a) {
|
|
|
43630
43644
|
value
|
|
43631
43645
|
})
|
|
43632
43646
|
),
|
|
43633
|
-
maxLength && /* @__PURE__ */ (0,
|
|
43647
|
+
maxLength && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: " text-xs text-gray text-right", children: [
|
|
43634
43648
|
value.length,
|
|
43635
43649
|
" / ",
|
|
43636
43650
|
maxLength
|
|
@@ -44132,9 +44146,9 @@ function useResources({
|
|
|
44132
44146
|
var import_react29 = __toESM(require("react"));
|
|
44133
44147
|
|
|
44134
44148
|
// src/select/icon.tsx
|
|
44135
|
-
var
|
|
44149
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
44136
44150
|
function SelectIcon() {
|
|
44137
|
-
return /* @__PURE__ */ (0,
|
|
44151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
44138
44152
|
"svg",
|
|
44139
44153
|
{
|
|
44140
44154
|
stroke: "currentColor",
|
|
@@ -44144,15 +44158,15 @@ function SelectIcon() {
|
|
|
44144
44158
|
height: "20px",
|
|
44145
44159
|
width: "20px",
|
|
44146
44160
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44147
|
-
children: /* @__PURE__ */ (0,
|
|
44161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z" })
|
|
44148
44162
|
}
|
|
44149
44163
|
);
|
|
44150
44164
|
}
|
|
44151
44165
|
|
|
44152
44166
|
// src/select/close.tsx
|
|
44153
|
-
var
|
|
44167
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
44154
44168
|
function CloseIcon() {
|
|
44155
|
-
return /* @__PURE__ */ (0,
|
|
44169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
44156
44170
|
"svg",
|
|
44157
44171
|
{
|
|
44158
44172
|
stroke: "currentColor",
|
|
@@ -44162,13 +44176,13 @@ function CloseIcon() {
|
|
|
44162
44176
|
height: "20px",
|
|
44163
44177
|
width: "20px",
|
|
44164
44178
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44165
|
-
children: /* @__PURE__ */ (0,
|
|
44179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
44166
44180
|
}
|
|
44167
44181
|
);
|
|
44168
44182
|
}
|
|
44169
44183
|
|
|
44170
44184
|
// src/select/index.tsx
|
|
44171
|
-
var
|
|
44185
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
44172
44186
|
function Select(_a) {
|
|
44173
44187
|
var _b = _a, {
|
|
44174
44188
|
label,
|
|
@@ -44250,10 +44264,10 @@ function Select(_a) {
|
|
|
44250
44264
|
}
|
|
44251
44265
|
}
|
|
44252
44266
|
}, [isOpen]);
|
|
44253
|
-
return /* @__PURE__ */ (0,
|
|
44254
|
-
label && /* @__PURE__ */ (0,
|
|
44255
|
-
/* @__PURE__ */ (0,
|
|
44256
|
-
/* @__PURE__ */ (0,
|
|
44267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: containerRef, className: "w-full", children: [
|
|
44268
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "font-bold mb-1 block", children: label }),
|
|
44269
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative", children: [
|
|
44270
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
44257
44271
|
"input",
|
|
44258
44272
|
__spreadProps(__spreadValues({
|
|
44259
44273
|
autoComplete: "off",
|
|
@@ -44291,8 +44305,8 @@ function Select(_a) {
|
|
|
44291
44305
|
onKeyDown: handleKeyDown
|
|
44292
44306
|
})
|
|
44293
44307
|
),
|
|
44294
|
-
!isOpen && /* @__PURE__ */ (0,
|
|
44295
|
-
isOpen && inputValue != "" && /* @__PURE__ */ (0,
|
|
44308
|
+
!isOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectIcon, {}) }),
|
|
44309
|
+
isOpen && inputValue != "" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
44296
44310
|
"button",
|
|
44297
44311
|
{
|
|
44298
44312
|
onClick: (e) => {
|
|
@@ -44305,14 +44319,14 @@ function Select(_a) {
|
|
|
44305
44319
|
},
|
|
44306
44320
|
className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold text-red-500",
|
|
44307
44321
|
style: { zIndex: 999999999 },
|
|
44308
|
-
children: /* @__PURE__ */ (0,
|
|
44322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon, {})
|
|
44309
44323
|
}
|
|
44310
44324
|
),
|
|
44311
|
-
isOpen && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
44325
|
+
isOpen && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
44312
44326
|
"div",
|
|
44313
44327
|
{
|
|
44314
44328
|
className: `absolute w-full border rounded shadow bg-white z-10 max-h-60 overflow-y-auto ${openUpwards ? "bottom-full mb-1" : "mt-1"}`,
|
|
44315
|
-
children: filtered.map((opt, index) => /* @__PURE__ */ (0,
|
|
44329
|
+
children: filtered.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
44316
44330
|
"div",
|
|
44317
44331
|
{
|
|
44318
44332
|
className: `p-2 cursor-pointer ${index === highlightedIndex ? "bg-blue-100" : "hover:bg-gray-100"}`,
|
|
@@ -44343,7 +44357,7 @@ function Select(_a) {
|
|
|
44343
44357
|
}
|
|
44344
44358
|
)
|
|
44345
44359
|
] }),
|
|
44346
|
-
isOpen && /* @__PURE__ */ (0,
|
|
44360
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
44347
44361
|
"div",
|
|
44348
44362
|
{
|
|
44349
44363
|
className: "fixed top-0 left-0 w-full h-screen",
|
|
@@ -44357,9 +44371,9 @@ function Select(_a) {
|
|
|
44357
44371
|
var import_react30 = __toESM(require("react"));
|
|
44358
44372
|
|
|
44359
44373
|
// src/modal/close.tsx
|
|
44360
|
-
var
|
|
44374
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
44361
44375
|
function CloseIcon2() {
|
|
44362
|
-
return /* @__PURE__ */ (0,
|
|
44376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
44363
44377
|
"svg",
|
|
44364
44378
|
{
|
|
44365
44379
|
stroke: "currentColor",
|
|
@@ -44369,13 +44383,13 @@ function CloseIcon2() {
|
|
|
44369
44383
|
height: "20px",
|
|
44370
44384
|
width: "20px",
|
|
44371
44385
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44372
|
-
children: /* @__PURE__ */ (0,
|
|
44386
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
44373
44387
|
}
|
|
44374
44388
|
);
|
|
44375
44389
|
}
|
|
44376
44390
|
|
|
44377
44391
|
// src/modal/index.tsx
|
|
44378
|
-
var
|
|
44392
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
44379
44393
|
function Modal({ button, children, ref, title = "" }) {
|
|
44380
44394
|
const modalRef = ref || (0, import_react30.useRef)(null);
|
|
44381
44395
|
function show() {
|
|
@@ -44386,7 +44400,7 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44386
44400
|
var _a;
|
|
44387
44401
|
typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.close());
|
|
44388
44402
|
}
|
|
44389
|
-
return /* @__PURE__ */ (0,
|
|
44403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
44390
44404
|
import_react30.default.Children.map(button, (child) => {
|
|
44391
44405
|
if (import_react30.default.isValidElement(child)) {
|
|
44392
44406
|
const { type, props } = child;
|
|
@@ -44400,17 +44414,17 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44400
44414
|
}
|
|
44401
44415
|
return child;
|
|
44402
44416
|
}),
|
|
44403
|
-
/* @__PURE__ */ (0,
|
|
44404
|
-
/* @__PURE__ */ (0,
|
|
44417
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("dialog", { ref: modalRef, className: "p-5 border shadow rounded", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "relative", children: [
|
|
44418
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
44405
44419
|
"button",
|
|
44406
44420
|
{
|
|
44407
44421
|
onClick: hide,
|
|
44408
44422
|
className: "absolute top-0 right-0 text-red-500 ",
|
|
44409
|
-
children: /* @__PURE__ */ (0,
|
|
44423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseIcon2, {})
|
|
44410
44424
|
}
|
|
44411
44425
|
),
|
|
44412
|
-
/* @__PURE__ */ (0,
|
|
44413
|
-
/* @__PURE__ */ (0,
|
|
44426
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "font-bold text-xl", children: title }),
|
|
44427
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-col gap-3 pt-6", children: import_react30.default.Children.map(children, (child) => {
|
|
44414
44428
|
if (import_react30.default.isValidElement(child)) {
|
|
44415
44429
|
const { type, props } = child;
|
|
44416
44430
|
return import_react30.default.createElement(type, __spreadProps(__spreadValues({}, props), { hide }));
|
|
@@ -44422,7 +44436,7 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44422
44436
|
}
|
|
44423
44437
|
|
|
44424
44438
|
// src/pre/index.tsx
|
|
44425
|
-
var
|
|
44439
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
44426
44440
|
var Pre = ({ data }) => {
|
|
44427
44441
|
let formatted = data;
|
|
44428
44442
|
try {
|
|
@@ -44431,7 +44445,7 @@ var Pre = ({ data }) => {
|
|
|
44431
44445
|
} catch (err) {
|
|
44432
44446
|
console.error("Invalid JSON string:", err);
|
|
44433
44447
|
}
|
|
44434
|
-
return /* @__PURE__ */ (0,
|
|
44448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
44435
44449
|
"pre",
|
|
44436
44450
|
{
|
|
44437
44451
|
style: {
|
|
@@ -44562,9 +44576,9 @@ var import_react31 = require("react");
|
|
|
44562
44576
|
var import_react_datepicker = __toESM(require("react-datepicker"));
|
|
44563
44577
|
|
|
44564
44578
|
// src/calendar/calendar.icon.tsx
|
|
44565
|
-
var
|
|
44579
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
44566
44580
|
function CalendarIcon() {
|
|
44567
|
-
return /* @__PURE__ */ (0,
|
|
44581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
44568
44582
|
"svg",
|
|
44569
44583
|
{
|
|
44570
44584
|
stroke: "currentColor",
|
|
@@ -44574,13 +44588,13 @@ function CalendarIcon() {
|
|
|
44574
44588
|
height: "20px",
|
|
44575
44589
|
width: "20px",
|
|
44576
44590
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44577
|
-
children: /* @__PURE__ */ (0,
|
|
44591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
|
|
44578
44592
|
}
|
|
44579
44593
|
);
|
|
44580
44594
|
}
|
|
44581
44595
|
|
|
44582
44596
|
// src/calendar/index.tsx
|
|
44583
|
-
var
|
|
44597
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
44584
44598
|
function MyCalendar(_a) {
|
|
44585
44599
|
var _b = _a, {
|
|
44586
44600
|
enabledDates,
|
|
@@ -44618,10 +44632,10 @@ function MyCalendar(_a) {
|
|
|
44618
44632
|
if (!(enabledDates == null ? void 0 : enabledDates.length)) {
|
|
44619
44633
|
return null;
|
|
44620
44634
|
}
|
|
44621
|
-
return /* @__PURE__ */ (0,
|
|
44622
|
-
/* @__PURE__ */ (0,
|
|
44623
|
-
/* @__PURE__ */ (0,
|
|
44624
|
-
/* @__PURE__ */ (0,
|
|
44635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
44636
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
44637
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "font-bold ", children: label }),
|
|
44638
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
44625
44639
|
"div",
|
|
44626
44640
|
{
|
|
44627
44641
|
onClick: () => {
|
|
@@ -44630,7 +44644,7 @@ function MyCalendar(_a) {
|
|
|
44630
44644
|
},
|
|
44631
44645
|
className: "cursor-pointer flex items-center justify-center",
|
|
44632
44646
|
children: [
|
|
44633
|
-
/* @__PURE__ */ (0,
|
|
44647
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
44634
44648
|
"input",
|
|
44635
44649
|
__spreadProps(__spreadValues({}, otherProps), {
|
|
44636
44650
|
className: [
|
|
@@ -44643,12 +44657,12 @@ function MyCalendar(_a) {
|
|
|
44643
44657
|
readOnly: true
|
|
44644
44658
|
})
|
|
44645
44659
|
),
|
|
44646
|
-
/* @__PURE__ */ (0,
|
|
44660
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CalendarIcon, {}) })
|
|
44647
44661
|
]
|
|
44648
44662
|
}
|
|
44649
44663
|
) })
|
|
44650
44664
|
] }),
|
|
44651
|
-
visible && /* @__PURE__ */ (0,
|
|
44665
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
44652
44666
|
"dialog",
|
|
44653
44667
|
{
|
|
44654
44668
|
ref: modalRef,
|
|
@@ -44660,7 +44674,7 @@ function MyCalendar(_a) {
|
|
|
44660
44674
|
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
44661
44675
|
}
|
|
44662
44676
|
},
|
|
44663
|
-
children: /* @__PURE__ */ (0,
|
|
44677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
44664
44678
|
import_react_datepicker.default,
|
|
44665
44679
|
{
|
|
44666
44680
|
inline: true,
|
|
@@ -44673,11 +44687,62 @@ function MyCalendar(_a) {
|
|
|
44673
44687
|
)
|
|
44674
44688
|
] });
|
|
44675
44689
|
}
|
|
44690
|
+
|
|
44691
|
+
// src/doc-viewer/index.tsx
|
|
44692
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
44693
|
+
function DocumentViewer({ item }) {
|
|
44694
|
+
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
44695
|
+
const isImage = contentType.startsWith("image/");
|
|
44696
|
+
const isPdf = contentType === "application/pdf";
|
|
44697
|
+
const isGoogleDocCompatible = isPdf || contentType.includes("msword") || contentType.includes("officedocument") || contentType.includes("presentation");
|
|
44698
|
+
const viewerUrl = isGoogleDocCompatible ? `https://docs.google.com/gview?url=${encodeURIComponent(
|
|
44699
|
+
url
|
|
44700
|
+
)}&embedded=true` : url;
|
|
44701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "border shadow rounded p-2 h-[100%]", children: [
|
|
44702
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mb-1 flex justify-between ", children: [
|
|
44703
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "font-bold", children: name }),
|
|
44704
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
44705
|
+
"a",
|
|
44706
|
+
{
|
|
44707
|
+
href: url,
|
|
44708
|
+
download: name,
|
|
44709
|
+
target: "_blank",
|
|
44710
|
+
rel: "noopener noreferrer",
|
|
44711
|
+
className: "border shadow rounded bg-blue-400 text-white p-2",
|
|
44712
|
+
children: "Descargar"
|
|
44713
|
+
}
|
|
44714
|
+
)
|
|
44715
|
+
] }),
|
|
44716
|
+
isImage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
44717
|
+
"img",
|
|
44718
|
+
{
|
|
44719
|
+
src: url,
|
|
44720
|
+
alt: name,
|
|
44721
|
+
style: {
|
|
44722
|
+
width,
|
|
44723
|
+
height,
|
|
44724
|
+
maxWidth: "100%",
|
|
44725
|
+
objectFit: "cover",
|
|
44726
|
+
display: "block"
|
|
44727
|
+
}
|
|
44728
|
+
}
|
|
44729
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
44730
|
+
"iframe",
|
|
44731
|
+
{
|
|
44732
|
+
title: name,
|
|
44733
|
+
src: viewerUrl,
|
|
44734
|
+
style: { width, height, border: "none" },
|
|
44735
|
+
allowFullScreen: true
|
|
44736
|
+
}
|
|
44737
|
+
)
|
|
44738
|
+
] });
|
|
44739
|
+
}
|
|
44676
44740
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44677
44741
|
0 && (module.exports = {
|
|
44678
44742
|
Alert,
|
|
44679
44743
|
Button,
|
|
44680
44744
|
Container,
|
|
44745
|
+
DocumentViewer,
|
|
44681
44746
|
Form,
|
|
44682
44747
|
Input,
|
|
44683
44748
|
Modal,
|
package/dist/index.mjs
CHANGED
|
@@ -43563,15 +43563,28 @@ function HTable(_a) {
|
|
|
43563
43563
|
] });
|
|
43564
43564
|
}
|
|
43565
43565
|
|
|
43566
|
+
// src/table/v.tsx
|
|
43567
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
43568
|
+
function VTable({ data }) {
|
|
43569
|
+
return /* @__PURE__ */ jsx13("table", { className: "min-w-full border border-gray-300 bg-white text-sm", children: /* @__PURE__ */ jsx13("tbody", { children: Object.entries(data).map(([key, value], idx) => {
|
|
43570
|
+
const content = typeof value === "object" && value !== null && "content" in value ? value.content : value;
|
|
43571
|
+
const handler = typeof value === "object" && value !== null && "handler" in value ? value.handler : null;
|
|
43572
|
+
return /* @__PURE__ */ jsxs11("tr", { className: "border-t", children: [
|
|
43573
|
+
/* @__PURE__ */ jsx13("td", { className: "p-2 font-medium text-gray-700 bg-gray-100 w-1/3", children: key }),
|
|
43574
|
+
/* @__PURE__ */ jsx13("td", { className: "p-2 text-gray-900", children: handler ? handler : String(content) })
|
|
43575
|
+
] }, idx);
|
|
43576
|
+
}) }) });
|
|
43577
|
+
}
|
|
43578
|
+
|
|
43566
43579
|
// src/table/index.tsx
|
|
43567
|
-
import { jsx as
|
|
43580
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
43568
43581
|
function Table(_a) {
|
|
43569
43582
|
var props = __objRest(_a, []);
|
|
43570
|
-
return /* @__PURE__ */
|
|
43583
|
+
return /* @__PURE__ */ jsx14(
|
|
43571
43584
|
"div",
|
|
43572
43585
|
{
|
|
43573
43586
|
className: "bg-gray-200 border rounded shadow p-1",
|
|
43574
|
-
children: Array.isArray(props.data) ? /* @__PURE__ */
|
|
43587
|
+
children: Array.isArray(props.data) ? /* @__PURE__ */ jsx14(HTable, __spreadValues({}, props)) : /* @__PURE__ */ jsx14(VTable, __spreadValues({}, props))
|
|
43575
43588
|
}
|
|
43576
43589
|
);
|
|
43577
43590
|
}
|
|
@@ -43580,7 +43593,7 @@ function Table(_a) {
|
|
|
43580
43593
|
import {
|
|
43581
43594
|
useState as useState7
|
|
43582
43595
|
} from "react";
|
|
43583
|
-
import { jsx as
|
|
43596
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
43584
43597
|
function TextArea(_a) {
|
|
43585
43598
|
var _b = _a, {
|
|
43586
43599
|
label,
|
|
@@ -43596,10 +43609,10 @@ function TextArea(_a) {
|
|
|
43596
43609
|
"children"
|
|
43597
43610
|
]);
|
|
43598
43611
|
const [value, setValue] = useState7(children);
|
|
43599
|
-
return /* @__PURE__ */
|
|
43600
|
-
/* @__PURE__ */
|
|
43601
|
-
/* @__PURE__ */
|
|
43602
|
-
/* @__PURE__ */
|
|
43612
|
+
return /* @__PURE__ */ jsx15("div", { className: "w-full", children: /* @__PURE__ */ jsxs12("label", { className: "flex flex-col gap-1", children: [
|
|
43613
|
+
/* @__PURE__ */ jsx15("div", { className: "font-bold ", children: label }),
|
|
43614
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
43615
|
+
/* @__PURE__ */ jsx15(
|
|
43603
43616
|
"textarea",
|
|
43604
43617
|
__spreadProps(__spreadValues({}, props), {
|
|
43605
43618
|
className: ["p-1 w-full rounded border shadow", className].join(
|
|
@@ -43615,7 +43628,7 @@ function TextArea(_a) {
|
|
|
43615
43628
|
value
|
|
43616
43629
|
})
|
|
43617
43630
|
),
|
|
43618
|
-
maxLength && /* @__PURE__ */
|
|
43631
|
+
maxLength && /* @__PURE__ */ jsxs12("div", { className: " text-xs text-gray text-right", children: [
|
|
43619
43632
|
value.length,
|
|
43620
43633
|
" / ",
|
|
43621
43634
|
maxLength
|
|
@@ -44121,9 +44134,9 @@ import React6, {
|
|
|
44121
44134
|
} from "react";
|
|
44122
44135
|
|
|
44123
44136
|
// src/select/icon.tsx
|
|
44124
|
-
import { jsx as
|
|
44137
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
44125
44138
|
function SelectIcon() {
|
|
44126
|
-
return /* @__PURE__ */
|
|
44139
|
+
return /* @__PURE__ */ jsx16(
|
|
44127
44140
|
"svg",
|
|
44128
44141
|
{
|
|
44129
44142
|
stroke: "currentColor",
|
|
@@ -44133,15 +44146,15 @@ function SelectIcon() {
|
|
|
44133
44146
|
height: "20px",
|
|
44134
44147
|
width: "20px",
|
|
44135
44148
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44136
|
-
children: /* @__PURE__ */
|
|
44149
|
+
children: /* @__PURE__ */ jsx16("path", { d: "M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z" })
|
|
44137
44150
|
}
|
|
44138
44151
|
);
|
|
44139
44152
|
}
|
|
44140
44153
|
|
|
44141
44154
|
// src/select/close.tsx
|
|
44142
|
-
import { jsx as
|
|
44155
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
44143
44156
|
function CloseIcon() {
|
|
44144
|
-
return /* @__PURE__ */
|
|
44157
|
+
return /* @__PURE__ */ jsx17(
|
|
44145
44158
|
"svg",
|
|
44146
44159
|
{
|
|
44147
44160
|
stroke: "currentColor",
|
|
@@ -44151,13 +44164,13 @@ function CloseIcon() {
|
|
|
44151
44164
|
height: "20px",
|
|
44152
44165
|
width: "20px",
|
|
44153
44166
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44154
|
-
children: /* @__PURE__ */
|
|
44167
|
+
children: /* @__PURE__ */ jsx17("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
44155
44168
|
}
|
|
44156
44169
|
);
|
|
44157
44170
|
}
|
|
44158
44171
|
|
|
44159
44172
|
// src/select/index.tsx
|
|
44160
|
-
import { jsx as
|
|
44173
|
+
import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
44161
44174
|
function Select(_a) {
|
|
44162
44175
|
var _b = _a, {
|
|
44163
44176
|
label,
|
|
@@ -44239,10 +44252,10 @@ function Select(_a) {
|
|
|
44239
44252
|
}
|
|
44240
44253
|
}
|
|
44241
44254
|
}, [isOpen]);
|
|
44242
|
-
return /* @__PURE__ */
|
|
44243
|
-
label && /* @__PURE__ */
|
|
44244
|
-
/* @__PURE__ */
|
|
44245
|
-
/* @__PURE__ */
|
|
44255
|
+
return /* @__PURE__ */ jsxs13("div", { ref: containerRef, className: "w-full", children: [
|
|
44256
|
+
label && /* @__PURE__ */ jsx18("label", { className: "font-bold mb-1 block", children: label }),
|
|
44257
|
+
/* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
44258
|
+
/* @__PURE__ */ jsx18(
|
|
44246
44259
|
"input",
|
|
44247
44260
|
__spreadProps(__spreadValues({
|
|
44248
44261
|
autoComplete: "off",
|
|
@@ -44280,8 +44293,8 @@ function Select(_a) {
|
|
|
44280
44293
|
onKeyDown: handleKeyDown
|
|
44281
44294
|
})
|
|
44282
44295
|
),
|
|
44283
|
-
!isOpen && /* @__PURE__ */
|
|
44284
|
-
isOpen && inputValue != "" && /* @__PURE__ */
|
|
44296
|
+
!isOpen && /* @__PURE__ */ jsx18("div", { className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold", children: /* @__PURE__ */ jsx18(SelectIcon, {}) }),
|
|
44297
|
+
isOpen && inputValue != "" && /* @__PURE__ */ jsx18(
|
|
44285
44298
|
"button",
|
|
44286
44299
|
{
|
|
44287
44300
|
onClick: (e) => {
|
|
@@ -44294,14 +44307,14 @@ function Select(_a) {
|
|
|
44294
44307
|
},
|
|
44295
44308
|
className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold text-red-500",
|
|
44296
44309
|
style: { zIndex: 999999999 },
|
|
44297
|
-
children: /* @__PURE__ */
|
|
44310
|
+
children: /* @__PURE__ */ jsx18(CloseIcon, {})
|
|
44298
44311
|
}
|
|
44299
44312
|
),
|
|
44300
|
-
isOpen && filtered.length > 0 && /* @__PURE__ */
|
|
44313
|
+
isOpen && filtered.length > 0 && /* @__PURE__ */ jsx18(
|
|
44301
44314
|
"div",
|
|
44302
44315
|
{
|
|
44303
44316
|
className: `absolute w-full border rounded shadow bg-white z-10 max-h-60 overflow-y-auto ${openUpwards ? "bottom-full mb-1" : "mt-1"}`,
|
|
44304
|
-
children: filtered.map((opt, index) => /* @__PURE__ */
|
|
44317
|
+
children: filtered.map((opt, index) => /* @__PURE__ */ jsx18(
|
|
44305
44318
|
"div",
|
|
44306
44319
|
{
|
|
44307
44320
|
className: `p-2 cursor-pointer ${index === highlightedIndex ? "bg-blue-100" : "hover:bg-gray-100"}`,
|
|
@@ -44332,7 +44345,7 @@ function Select(_a) {
|
|
|
44332
44345
|
}
|
|
44333
44346
|
)
|
|
44334
44347
|
] }),
|
|
44335
|
-
isOpen && /* @__PURE__ */
|
|
44348
|
+
isOpen && /* @__PURE__ */ jsx18(
|
|
44336
44349
|
"div",
|
|
44337
44350
|
{
|
|
44338
44351
|
className: "fixed top-0 left-0 w-full h-screen",
|
|
@@ -44346,9 +44359,9 @@ function Select(_a) {
|
|
|
44346
44359
|
import React7, { useRef as useRef6 } from "react";
|
|
44347
44360
|
|
|
44348
44361
|
// src/modal/close.tsx
|
|
44349
|
-
import { jsx as
|
|
44362
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
44350
44363
|
function CloseIcon2() {
|
|
44351
|
-
return /* @__PURE__ */
|
|
44364
|
+
return /* @__PURE__ */ jsx19(
|
|
44352
44365
|
"svg",
|
|
44353
44366
|
{
|
|
44354
44367
|
stroke: "currentColor",
|
|
@@ -44358,13 +44371,13 @@ function CloseIcon2() {
|
|
|
44358
44371
|
height: "20px",
|
|
44359
44372
|
width: "20px",
|
|
44360
44373
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44361
|
-
children: /* @__PURE__ */
|
|
44374
|
+
children: /* @__PURE__ */ jsx19("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
44362
44375
|
}
|
|
44363
44376
|
);
|
|
44364
44377
|
}
|
|
44365
44378
|
|
|
44366
44379
|
// src/modal/index.tsx
|
|
44367
|
-
import { Fragment as Fragment6, jsx as
|
|
44380
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
44368
44381
|
function Modal({ button, children, ref, title = "" }) {
|
|
44369
44382
|
const modalRef = ref || useRef6(null);
|
|
44370
44383
|
function show() {
|
|
@@ -44375,7 +44388,7 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44375
44388
|
var _a;
|
|
44376
44389
|
typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.close());
|
|
44377
44390
|
}
|
|
44378
|
-
return /* @__PURE__ */
|
|
44391
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
44379
44392
|
React7.Children.map(button, (child) => {
|
|
44380
44393
|
if (React7.isValidElement(child)) {
|
|
44381
44394
|
const { type, props } = child;
|
|
@@ -44389,17 +44402,17 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44389
44402
|
}
|
|
44390
44403
|
return child;
|
|
44391
44404
|
}),
|
|
44392
|
-
/* @__PURE__ */
|
|
44393
|
-
/* @__PURE__ */
|
|
44405
|
+
/* @__PURE__ */ jsx20("dialog", { ref: modalRef, className: "p-5 border shadow rounded", children: /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
|
|
44406
|
+
/* @__PURE__ */ jsx20(
|
|
44394
44407
|
"button",
|
|
44395
44408
|
{
|
|
44396
44409
|
onClick: hide,
|
|
44397
44410
|
className: "absolute top-0 right-0 text-red-500 ",
|
|
44398
|
-
children: /* @__PURE__ */
|
|
44411
|
+
children: /* @__PURE__ */ jsx20(CloseIcon2, {})
|
|
44399
44412
|
}
|
|
44400
44413
|
),
|
|
44401
|
-
/* @__PURE__ */
|
|
44402
|
-
/* @__PURE__ */
|
|
44414
|
+
/* @__PURE__ */ jsx20("div", { className: "font-bold text-xl", children: title }),
|
|
44415
|
+
/* @__PURE__ */ jsx20("div", { className: "flex flex-col gap-3 pt-6", children: React7.Children.map(children, (child) => {
|
|
44403
44416
|
if (React7.isValidElement(child)) {
|
|
44404
44417
|
const { type, props } = child;
|
|
44405
44418
|
return React7.createElement(type, __spreadProps(__spreadValues({}, props), { hide }));
|
|
@@ -44411,7 +44424,7 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
44411
44424
|
}
|
|
44412
44425
|
|
|
44413
44426
|
// src/pre/index.tsx
|
|
44414
|
-
import { jsx as
|
|
44427
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
44415
44428
|
var Pre = ({ data }) => {
|
|
44416
44429
|
let formatted = data;
|
|
44417
44430
|
try {
|
|
@@ -44420,7 +44433,7 @@ var Pre = ({ data }) => {
|
|
|
44420
44433
|
} catch (err) {
|
|
44421
44434
|
console.error("Invalid JSON string:", err);
|
|
44422
44435
|
}
|
|
44423
|
-
return /* @__PURE__ */
|
|
44436
|
+
return /* @__PURE__ */ jsx21(
|
|
44424
44437
|
"pre",
|
|
44425
44438
|
{
|
|
44426
44439
|
style: {
|
|
@@ -44555,9 +44568,9 @@ import {
|
|
|
44555
44568
|
import DatePicker from "react-datepicker";
|
|
44556
44569
|
|
|
44557
44570
|
// src/calendar/calendar.icon.tsx
|
|
44558
|
-
import { jsx as
|
|
44571
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
44559
44572
|
function CalendarIcon() {
|
|
44560
|
-
return /* @__PURE__ */
|
|
44573
|
+
return /* @__PURE__ */ jsx22(
|
|
44561
44574
|
"svg",
|
|
44562
44575
|
{
|
|
44563
44576
|
stroke: "currentColor",
|
|
@@ -44567,13 +44580,13 @@ function CalendarIcon() {
|
|
|
44567
44580
|
height: "20px",
|
|
44568
44581
|
width: "20px",
|
|
44569
44582
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44570
|
-
children: /* @__PURE__ */
|
|
44583
|
+
children: /* @__PURE__ */ jsx22("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
|
|
44571
44584
|
}
|
|
44572
44585
|
);
|
|
44573
44586
|
}
|
|
44574
44587
|
|
|
44575
44588
|
// src/calendar/index.tsx
|
|
44576
|
-
import { jsx as
|
|
44589
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
44577
44590
|
function MyCalendar(_a) {
|
|
44578
44591
|
var _b = _a, {
|
|
44579
44592
|
enabledDates,
|
|
@@ -44611,10 +44624,10 @@ function MyCalendar(_a) {
|
|
|
44611
44624
|
if (!(enabledDates == null ? void 0 : enabledDates.length)) {
|
|
44612
44625
|
return null;
|
|
44613
44626
|
}
|
|
44614
|
-
return /* @__PURE__ */
|
|
44615
|
-
/* @__PURE__ */
|
|
44616
|
-
/* @__PURE__ */
|
|
44617
|
-
/* @__PURE__ */
|
|
44627
|
+
return /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
44628
|
+
/* @__PURE__ */ jsxs15("label", { className: "flex flex-col gap-1", children: [
|
|
44629
|
+
/* @__PURE__ */ jsx23("div", { className: "font-bold ", children: label }),
|
|
44630
|
+
/* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsxs15(
|
|
44618
44631
|
"div",
|
|
44619
44632
|
{
|
|
44620
44633
|
onClick: () => {
|
|
@@ -44623,7 +44636,7 @@ function MyCalendar(_a) {
|
|
|
44623
44636
|
},
|
|
44624
44637
|
className: "cursor-pointer flex items-center justify-center",
|
|
44625
44638
|
children: [
|
|
44626
|
-
/* @__PURE__ */
|
|
44639
|
+
/* @__PURE__ */ jsx23(
|
|
44627
44640
|
"input",
|
|
44628
44641
|
__spreadProps(__spreadValues({}, otherProps), {
|
|
44629
44642
|
className: [
|
|
@@ -44636,12 +44649,12 @@ function MyCalendar(_a) {
|
|
|
44636
44649
|
readOnly: true
|
|
44637
44650
|
})
|
|
44638
44651
|
),
|
|
44639
|
-
/* @__PURE__ */
|
|
44652
|
+
/* @__PURE__ */ jsx23("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx23(CalendarIcon, {}) })
|
|
44640
44653
|
]
|
|
44641
44654
|
}
|
|
44642
44655
|
) })
|
|
44643
44656
|
] }),
|
|
44644
|
-
visible && /* @__PURE__ */
|
|
44657
|
+
visible && /* @__PURE__ */ jsx23(
|
|
44645
44658
|
"dialog",
|
|
44646
44659
|
{
|
|
44647
44660
|
ref: modalRef,
|
|
@@ -44653,7 +44666,7 @@ function MyCalendar(_a) {
|
|
|
44653
44666
|
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
44654
44667
|
}
|
|
44655
44668
|
},
|
|
44656
|
-
children: /* @__PURE__ */
|
|
44669
|
+
children: /* @__PURE__ */ jsx23(
|
|
44657
44670
|
DatePicker,
|
|
44658
44671
|
{
|
|
44659
44672
|
inline: true,
|
|
@@ -44666,10 +44679,61 @@ function MyCalendar(_a) {
|
|
|
44666
44679
|
)
|
|
44667
44680
|
] });
|
|
44668
44681
|
}
|
|
44682
|
+
|
|
44683
|
+
// src/doc-viewer/index.tsx
|
|
44684
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
44685
|
+
function DocumentViewer({ item }) {
|
|
44686
|
+
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
44687
|
+
const isImage = contentType.startsWith("image/");
|
|
44688
|
+
const isPdf = contentType === "application/pdf";
|
|
44689
|
+
const isGoogleDocCompatible = isPdf || contentType.includes("msword") || contentType.includes("officedocument") || contentType.includes("presentation");
|
|
44690
|
+
const viewerUrl = isGoogleDocCompatible ? `https://docs.google.com/gview?url=${encodeURIComponent(
|
|
44691
|
+
url
|
|
44692
|
+
)}&embedded=true` : url;
|
|
44693
|
+
return /* @__PURE__ */ jsxs16("div", { className: "border shadow rounded p-2 h-[100%]", children: [
|
|
44694
|
+
/* @__PURE__ */ jsxs16("div", { className: "mb-1 flex justify-between ", children: [
|
|
44695
|
+
/* @__PURE__ */ jsx24("h3", { className: "font-bold", children: name }),
|
|
44696
|
+
/* @__PURE__ */ jsx24(
|
|
44697
|
+
"a",
|
|
44698
|
+
{
|
|
44699
|
+
href: url,
|
|
44700
|
+
download: name,
|
|
44701
|
+
target: "_blank",
|
|
44702
|
+
rel: "noopener noreferrer",
|
|
44703
|
+
className: "border shadow rounded bg-blue-400 text-white p-2",
|
|
44704
|
+
children: "Descargar"
|
|
44705
|
+
}
|
|
44706
|
+
)
|
|
44707
|
+
] }),
|
|
44708
|
+
isImage ? /* @__PURE__ */ jsx24(
|
|
44709
|
+
"img",
|
|
44710
|
+
{
|
|
44711
|
+
src: url,
|
|
44712
|
+
alt: name,
|
|
44713
|
+
style: {
|
|
44714
|
+
width,
|
|
44715
|
+
height,
|
|
44716
|
+
maxWidth: "100%",
|
|
44717
|
+
objectFit: "cover",
|
|
44718
|
+
display: "block"
|
|
44719
|
+
}
|
|
44720
|
+
}
|
|
44721
|
+
) : /* @__PURE__ */ jsx24(
|
|
44722
|
+
"iframe",
|
|
44723
|
+
{
|
|
44724
|
+
title: name,
|
|
44725
|
+
src: viewerUrl,
|
|
44726
|
+
style: { width, height, border: "none" },
|
|
44727
|
+
allowFullScreen: true
|
|
44728
|
+
}
|
|
44729
|
+
)
|
|
44730
|
+
] });
|
|
44731
|
+
}
|
|
44669
44732
|
export {
|
|
44670
44733
|
Alert,
|
|
44671
44734
|
Button,
|
|
44672
44735
|
Container,
|
|
44736
|
+
DocumentViewer,
|
|
44673
44737
|
Form,
|
|
44674
44738
|
Input,
|
|
44675
44739
|
Modal,
|
package/package.json
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
type Item = {
|
|
4
|
+
url: string;
|
|
5
|
+
name: string;
|
|
6
|
+
contentType: string;
|
|
7
|
+
width?: string;
|
|
8
|
+
height?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
item: Item;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function DocumentViewer({ item }: Props) {
|
|
16
|
+
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
17
|
+
|
|
18
|
+
const isImage = contentType.startsWith("image/");
|
|
19
|
+
const isPdf = contentType === "application/pdf";
|
|
20
|
+
const isGoogleDocCompatible =
|
|
21
|
+
isPdf ||
|
|
22
|
+
contentType.includes("msword") ||
|
|
23
|
+
contentType.includes("officedocument") ||
|
|
24
|
+
contentType.includes("presentation");
|
|
25
|
+
|
|
26
|
+
const viewerUrl = isGoogleDocCompatible
|
|
27
|
+
? `https://docs.google.com/gview?url=${encodeURIComponent(
|
|
28
|
+
url
|
|
29
|
+
)}&embedded=true`
|
|
30
|
+
: url;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className="border shadow rounded p-2 h-[100%]">
|
|
34
|
+
<div className="mb-1 flex justify-between ">
|
|
35
|
+
<h3 className="font-bold">{name}</h3>
|
|
36
|
+
<a
|
|
37
|
+
href={url}
|
|
38
|
+
download={name}
|
|
39
|
+
target="_blank"
|
|
40
|
+
rel="noopener noreferrer"
|
|
41
|
+
className="border shadow rounded bg-blue-400 text-white p-2"
|
|
42
|
+
>
|
|
43
|
+
Descargar
|
|
44
|
+
</a>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
{isImage ? (
|
|
48
|
+
<img
|
|
49
|
+
src={url}
|
|
50
|
+
alt={name}
|
|
51
|
+
style={{
|
|
52
|
+
width: width,
|
|
53
|
+
height: height,
|
|
54
|
+
maxWidth: "100%",
|
|
55
|
+
objectFit: "cover",
|
|
56
|
+
display: "block",
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
) : (
|
|
60
|
+
<iframe
|
|
61
|
+
title={name}
|
|
62
|
+
src={viewerUrl}
|
|
63
|
+
style={{ width, height, border: "none" }}
|
|
64
|
+
allowFullScreen
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
package/src/index.tsx
CHANGED
package/src/table/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import HTable from "./h";
|
|
3
|
+
import VTable from "./v";
|
|
3
4
|
type DataType = string | number | Date | object | undefined | null;
|
|
4
5
|
type Item = { content: DataType; handler: ReactNode };
|
|
5
6
|
export type DataTypeOrItem = DataType | Item;
|
|
@@ -46,9 +47,7 @@ export default function Table({ ...props }: TableProps) {
|
|
|
46
47
|
{Array.isArray(props.data) ? (
|
|
47
48
|
<HTable {...props} />
|
|
48
49
|
) : (
|
|
49
|
-
<
|
|
50
|
-
No es un array
|
|
51
|
-
</div>
|
|
50
|
+
<VTable {...props} />
|
|
52
51
|
)}
|
|
53
52
|
</div>
|
|
54
53
|
);
|
package/src/table/v.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataTypeOrItem, TableProps } from ".";
|
|
2
|
+
|
|
3
|
+
export default function VTable({ data }: TableProps) {
|
|
4
|
+
return (
|
|
5
|
+
<table className="min-w-full border border-gray-300 bg-white text-sm">
|
|
6
|
+
<tbody>
|
|
7
|
+
{Object.entries(data).map(([key, value], idx) => {
|
|
8
|
+
const content =
|
|
9
|
+
typeof value === "object" && value !== null && "content" in value
|
|
10
|
+
? value.content
|
|
11
|
+
: value;
|
|
12
|
+
|
|
13
|
+
const handler =
|
|
14
|
+
typeof value === "object" && value !== null && "handler" in value
|
|
15
|
+
? value.handler
|
|
16
|
+
: null;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<tr key={idx} className="border-t">
|
|
20
|
+
<td className="p-2 font-medium text-gray-700 bg-gray-100 w-1/3">
|
|
21
|
+
{key}
|
|
22
|
+
</td>
|
|
23
|
+
<td className="p-2 text-gray-900">
|
|
24
|
+
{handler ? handler : String(content)}
|
|
25
|
+
</td>
|
|
26
|
+
</tr>
|
|
27
|
+
);
|
|
28
|
+
})}
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>
|
|
31
|
+
);
|
|
32
|
+
}
|