teraprox-ui-kit 0.1.0
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 +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +493 -0
- package/dist/index.mjs +448 -0
- package/package.json +66 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AddButtonProps {
|
|
4
|
+
callback: () => void;
|
|
5
|
+
hiddenBool?: boolean;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const AddButton: React.FC<AddButtonProps>;
|
|
9
|
+
|
|
10
|
+
interface DeleteButtonProps {
|
|
11
|
+
title: string;
|
|
12
|
+
onDeleteClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const DeleteButton: React.FC<DeleteButtonProps>;
|
|
15
|
+
|
|
16
|
+
interface ResponsiveContainerProps {
|
|
17
|
+
title?: string;
|
|
18
|
+
show: boolean;
|
|
19
|
+
setShow: (show: boolean) => void;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
scrollable?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ResponsiveContainer Component
|
|
26
|
+
*
|
|
27
|
+
* Renders a Modal for displaying content in a responsive container.
|
|
28
|
+
* Previously used GenericOffCanvas for mobile, now uses Modal consistently.
|
|
29
|
+
*
|
|
30
|
+
* @param title - The title of the modal.
|
|
31
|
+
* @param show - Controls the visibility of the modal.
|
|
32
|
+
* @param setShow - Function to update the visibility state.
|
|
33
|
+
* @param children - Content to be rendered inside the modal.
|
|
34
|
+
* @param onClose - Optional function to be executed on close.
|
|
35
|
+
* @param scrollable - Optional prop to enable scrolling the content.
|
|
36
|
+
*/
|
|
37
|
+
declare const ResponsiveContainer: React.FC<ResponsiveContainerProps>;
|
|
38
|
+
|
|
39
|
+
interface UuidPillProps {
|
|
40
|
+
uuid: string | null | undefined;
|
|
41
|
+
bg?: string;
|
|
42
|
+
textColor?: string;
|
|
43
|
+
short?: number;
|
|
44
|
+
}
|
|
45
|
+
declare const UuidPill: React.FC<UuidPillProps>;
|
|
46
|
+
|
|
47
|
+
declare class ConfigObject {
|
|
48
|
+
dotNotation: string;
|
|
49
|
+
style?: React.CSSProperties;
|
|
50
|
+
onClick?: () => void;
|
|
51
|
+
onBlur?: () => void;
|
|
52
|
+
onHideClick?: () => void;
|
|
53
|
+
hidden?: boolean;
|
|
54
|
+
mapData?: any;
|
|
55
|
+
additionalComponents?: (() => React.ReactNode)[];
|
|
56
|
+
constructor(dotNotation: string, style?: React.CSSProperties, onClick?: () => void, onBlur?: () => void, onHideClick?: () => void, hidden?: boolean, mapData?: any, additionalComponents?: (() => React.ReactNode)[]);
|
|
57
|
+
}
|
|
58
|
+
interface GenericDisplayProps {
|
|
59
|
+
ops?: any[];
|
|
60
|
+
loadFunc?: () => Promise<any>;
|
|
61
|
+
configObjects?: ConfigObject[];
|
|
62
|
+
rootName?: string;
|
|
63
|
+
context?: string;
|
|
64
|
+
/** Optional hook to call on mount/context update. Replaces the app-specific useContextUpdateHandler. */
|
|
65
|
+
onRefresh?: (refreshFunc: () => void) => void;
|
|
66
|
+
/** Optional renderer for edit buttons on root objects. */
|
|
67
|
+
editButtonRenderer?: (obj: any, location: string | null) => React.ReactNode;
|
|
68
|
+
}
|
|
69
|
+
declare const GenericDisplay: React.FC<GenericDisplayProps>;
|
|
70
|
+
|
|
71
|
+
interface SelectOption {
|
|
72
|
+
label: string;
|
|
73
|
+
value: string | number;
|
|
74
|
+
}
|
|
75
|
+
interface FieldDefinition {
|
|
76
|
+
label: string;
|
|
77
|
+
key: string;
|
|
78
|
+
type: 'text' | 'number' | 'select' | 'date' | 'custom-select';
|
|
79
|
+
options?: SelectOption[];
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
required?: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface GenericFormProps {
|
|
84
|
+
fields: FieldDefinition[];
|
|
85
|
+
onSubmit: (values: Record<string, any>) => void;
|
|
86
|
+
/** Optional custom select renderer. If not provided, custom-select falls back to native select. */
|
|
87
|
+
renderCustomSelect?: (props: {
|
|
88
|
+
label: string;
|
|
89
|
+
value: any;
|
|
90
|
+
options?: SelectOption[];
|
|
91
|
+
onChange: (value: any) => void;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
}) => React.ReactNode;
|
|
94
|
+
}
|
|
95
|
+
declare const GenericForm: React.FC<GenericFormProps>;
|
|
96
|
+
|
|
97
|
+
interface GenericSelectProps {
|
|
98
|
+
noLabel?: boolean;
|
|
99
|
+
title?: string;
|
|
100
|
+
onChange: (value: any) => void;
|
|
101
|
+
ops?: any[];
|
|
102
|
+
selection?: any;
|
|
103
|
+
returnType?: string;
|
|
104
|
+
displayType?: string;
|
|
105
|
+
filter?: string;
|
|
106
|
+
filterField?: string;
|
|
107
|
+
valueType?: string;
|
|
108
|
+
loadFunc?: () => Promise<any>;
|
|
109
|
+
loadCondition?: boolean;
|
|
110
|
+
actionClick?: () => React.ReactNode;
|
|
111
|
+
locked?: boolean;
|
|
112
|
+
isBold?: boolean;
|
|
113
|
+
default?: string;
|
|
114
|
+
}
|
|
115
|
+
declare class GenericSelectOps {
|
|
116
|
+
noLabel?: boolean;
|
|
117
|
+
title?: string;
|
|
118
|
+
onChange?: (value: any) => void;
|
|
119
|
+
ops?: any[];
|
|
120
|
+
selection?: any;
|
|
121
|
+
returnType?: string;
|
|
122
|
+
displayType?: string;
|
|
123
|
+
filter?: string;
|
|
124
|
+
filterField?: string;
|
|
125
|
+
valueType?: string;
|
|
126
|
+
loadFunc?: () => Promise<any>;
|
|
127
|
+
loadCondition?: boolean;
|
|
128
|
+
actionClick?: () => React.ReactNode;
|
|
129
|
+
locked?: boolean;
|
|
130
|
+
constructor(noLabel?: boolean, title?: string, onChange?: (value: any) => void, ops?: any[], selection?: any, returnType?: string, displayType?: string, filter?: string, filterField?: string, valueType?: string, loadFunc?: () => Promise<any>, loadCondition?: boolean, actionClick?: () => React.ReactNode, locked?: boolean);
|
|
131
|
+
}
|
|
132
|
+
declare const GenericSelect: React.FC<GenericSelectProps>;
|
|
133
|
+
|
|
134
|
+
export { AddButton, ConfigObject, DeleteButton, GenericDisplay, GenericForm, GenericSelect, GenericSelectOps, ResponsiveContainer, UuidPill };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AddButtonProps {
|
|
4
|
+
callback: () => void;
|
|
5
|
+
hiddenBool?: boolean;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const AddButton: React.FC<AddButtonProps>;
|
|
9
|
+
|
|
10
|
+
interface DeleteButtonProps {
|
|
11
|
+
title: string;
|
|
12
|
+
onDeleteClick: () => void;
|
|
13
|
+
}
|
|
14
|
+
declare const DeleteButton: React.FC<DeleteButtonProps>;
|
|
15
|
+
|
|
16
|
+
interface ResponsiveContainerProps {
|
|
17
|
+
title?: string;
|
|
18
|
+
show: boolean;
|
|
19
|
+
setShow: (show: boolean) => void;
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
scrollable?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ResponsiveContainer Component
|
|
26
|
+
*
|
|
27
|
+
* Renders a Modal for displaying content in a responsive container.
|
|
28
|
+
* Previously used GenericOffCanvas for mobile, now uses Modal consistently.
|
|
29
|
+
*
|
|
30
|
+
* @param title - The title of the modal.
|
|
31
|
+
* @param show - Controls the visibility of the modal.
|
|
32
|
+
* @param setShow - Function to update the visibility state.
|
|
33
|
+
* @param children - Content to be rendered inside the modal.
|
|
34
|
+
* @param onClose - Optional function to be executed on close.
|
|
35
|
+
* @param scrollable - Optional prop to enable scrolling the content.
|
|
36
|
+
*/
|
|
37
|
+
declare const ResponsiveContainer: React.FC<ResponsiveContainerProps>;
|
|
38
|
+
|
|
39
|
+
interface UuidPillProps {
|
|
40
|
+
uuid: string | null | undefined;
|
|
41
|
+
bg?: string;
|
|
42
|
+
textColor?: string;
|
|
43
|
+
short?: number;
|
|
44
|
+
}
|
|
45
|
+
declare const UuidPill: React.FC<UuidPillProps>;
|
|
46
|
+
|
|
47
|
+
declare class ConfigObject {
|
|
48
|
+
dotNotation: string;
|
|
49
|
+
style?: React.CSSProperties;
|
|
50
|
+
onClick?: () => void;
|
|
51
|
+
onBlur?: () => void;
|
|
52
|
+
onHideClick?: () => void;
|
|
53
|
+
hidden?: boolean;
|
|
54
|
+
mapData?: any;
|
|
55
|
+
additionalComponents?: (() => React.ReactNode)[];
|
|
56
|
+
constructor(dotNotation: string, style?: React.CSSProperties, onClick?: () => void, onBlur?: () => void, onHideClick?: () => void, hidden?: boolean, mapData?: any, additionalComponents?: (() => React.ReactNode)[]);
|
|
57
|
+
}
|
|
58
|
+
interface GenericDisplayProps {
|
|
59
|
+
ops?: any[];
|
|
60
|
+
loadFunc?: () => Promise<any>;
|
|
61
|
+
configObjects?: ConfigObject[];
|
|
62
|
+
rootName?: string;
|
|
63
|
+
context?: string;
|
|
64
|
+
/** Optional hook to call on mount/context update. Replaces the app-specific useContextUpdateHandler. */
|
|
65
|
+
onRefresh?: (refreshFunc: () => void) => void;
|
|
66
|
+
/** Optional renderer for edit buttons on root objects. */
|
|
67
|
+
editButtonRenderer?: (obj: any, location: string | null) => React.ReactNode;
|
|
68
|
+
}
|
|
69
|
+
declare const GenericDisplay: React.FC<GenericDisplayProps>;
|
|
70
|
+
|
|
71
|
+
interface SelectOption {
|
|
72
|
+
label: string;
|
|
73
|
+
value: string | number;
|
|
74
|
+
}
|
|
75
|
+
interface FieldDefinition {
|
|
76
|
+
label: string;
|
|
77
|
+
key: string;
|
|
78
|
+
type: 'text' | 'number' | 'select' | 'date' | 'custom-select';
|
|
79
|
+
options?: SelectOption[];
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
required?: boolean;
|
|
82
|
+
}
|
|
83
|
+
interface GenericFormProps {
|
|
84
|
+
fields: FieldDefinition[];
|
|
85
|
+
onSubmit: (values: Record<string, any>) => void;
|
|
86
|
+
/** Optional custom select renderer. If not provided, custom-select falls back to native select. */
|
|
87
|
+
renderCustomSelect?: (props: {
|
|
88
|
+
label: string;
|
|
89
|
+
value: any;
|
|
90
|
+
options?: SelectOption[];
|
|
91
|
+
onChange: (value: any) => void;
|
|
92
|
+
placeholder?: string;
|
|
93
|
+
}) => React.ReactNode;
|
|
94
|
+
}
|
|
95
|
+
declare const GenericForm: React.FC<GenericFormProps>;
|
|
96
|
+
|
|
97
|
+
interface GenericSelectProps {
|
|
98
|
+
noLabel?: boolean;
|
|
99
|
+
title?: string;
|
|
100
|
+
onChange: (value: any) => void;
|
|
101
|
+
ops?: any[];
|
|
102
|
+
selection?: any;
|
|
103
|
+
returnType?: string;
|
|
104
|
+
displayType?: string;
|
|
105
|
+
filter?: string;
|
|
106
|
+
filterField?: string;
|
|
107
|
+
valueType?: string;
|
|
108
|
+
loadFunc?: () => Promise<any>;
|
|
109
|
+
loadCondition?: boolean;
|
|
110
|
+
actionClick?: () => React.ReactNode;
|
|
111
|
+
locked?: boolean;
|
|
112
|
+
isBold?: boolean;
|
|
113
|
+
default?: string;
|
|
114
|
+
}
|
|
115
|
+
declare class GenericSelectOps {
|
|
116
|
+
noLabel?: boolean;
|
|
117
|
+
title?: string;
|
|
118
|
+
onChange?: (value: any) => void;
|
|
119
|
+
ops?: any[];
|
|
120
|
+
selection?: any;
|
|
121
|
+
returnType?: string;
|
|
122
|
+
displayType?: string;
|
|
123
|
+
filter?: string;
|
|
124
|
+
filterField?: string;
|
|
125
|
+
valueType?: string;
|
|
126
|
+
loadFunc?: () => Promise<any>;
|
|
127
|
+
loadCondition?: boolean;
|
|
128
|
+
actionClick?: () => React.ReactNode;
|
|
129
|
+
locked?: boolean;
|
|
130
|
+
constructor(noLabel?: boolean, title?: string, onChange?: (value: any) => void, ops?: any[], selection?: any, returnType?: string, displayType?: string, filter?: string, filterField?: string, valueType?: string, loadFunc?: () => Promise<any>, loadCondition?: boolean, actionClick?: () => React.ReactNode, locked?: boolean);
|
|
131
|
+
}
|
|
132
|
+
declare const GenericSelect: React.FC<GenericSelectProps>;
|
|
133
|
+
|
|
134
|
+
export { AddButton, ConfigObject, DeleteButton, GenericDisplay, GenericForm, GenericSelect, GenericSelectOps, ResponsiveContainer, UuidPill };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
AddButton: () => AddButton_default,
|
|
34
|
+
ConfigObject: () => ConfigObject,
|
|
35
|
+
DeleteButton: () => DeleteButton_default,
|
|
36
|
+
GenericDisplay: () => GenericDisplay_default,
|
|
37
|
+
GenericForm: () => GenericForm_default,
|
|
38
|
+
GenericSelect: () => GenericSelect_default,
|
|
39
|
+
GenericSelectOps: () => GenericSelectOps,
|
|
40
|
+
ResponsiveContainer: () => ResponsiveContainer_default,
|
|
41
|
+
UuidPill: () => UuidPill_default
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
|
|
45
|
+
// src/buttons/AddButton.tsx
|
|
46
|
+
var import_react_bootstrap = require("react-bootstrap");
|
|
47
|
+
var import_gr = require("react-icons/gr");
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
var AddButton = ({ callback, hiddenBool, size }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
import_react_bootstrap.Button,
|
|
51
|
+
{
|
|
52
|
+
hidden: hiddenBool || false,
|
|
53
|
+
variant: "outline-primary",
|
|
54
|
+
onClick: () => callback(),
|
|
55
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_gr.GrAdd, { size: size || 25 })
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
var AddButton_default = AddButton;
|
|
59
|
+
|
|
60
|
+
// src/buttons/DeleteButton.tsx
|
|
61
|
+
var import_react_bootstrap2 = require("react-bootstrap");
|
|
62
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
|
+
var DeleteButton = ({ title, onDeleteClick }) => {
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_bootstrap2.Button, { variant: "danger", onClick: () => onDeleteClick(), children: title });
|
|
65
|
+
};
|
|
66
|
+
var DeleteButton_default = DeleteButton;
|
|
67
|
+
|
|
68
|
+
// src/containers/ResponsiveContainer.tsx
|
|
69
|
+
var import_react_bootstrap3 = require("react-bootstrap");
|
|
70
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
71
|
+
var ResponsiveContainer = ({
|
|
72
|
+
title,
|
|
73
|
+
show,
|
|
74
|
+
setShow,
|
|
75
|
+
children,
|
|
76
|
+
onClose,
|
|
77
|
+
scrollable = false
|
|
78
|
+
}) => {
|
|
79
|
+
const handleClose = () => {
|
|
80
|
+
setShow(false);
|
|
81
|
+
if (onClose) onClose();
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_bootstrap3.Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.Modal.Header, { closeButton: true, onClick: handleClose }),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_bootstrap3.ModalBody, { children })
|
|
86
|
+
] });
|
|
87
|
+
};
|
|
88
|
+
var ResponsiveContainer_default = ResponsiveContainer;
|
|
89
|
+
|
|
90
|
+
// src/displays/UuidPill.tsx
|
|
91
|
+
var import_react = require("react");
|
|
92
|
+
var import_react_bootstrap4 = require("react-bootstrap");
|
|
93
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
94
|
+
var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
|
|
95
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
96
|
+
const ref = (0, import_react.useRef)(null);
|
|
97
|
+
const [showTooltip, setShowTooltip] = (0, import_react.useState)(false);
|
|
98
|
+
if (!uuid) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-muted", children: "\u2014" });
|
|
99
|
+
const shortId = String(uuid).substring(0, short);
|
|
100
|
+
const handleCopy = async (e) => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
try {
|
|
103
|
+
await navigator.clipboard.writeText(uuid);
|
|
104
|
+
} catch (e2) {
|
|
105
|
+
const ta = document.createElement("textarea");
|
|
106
|
+
ta.value = uuid;
|
|
107
|
+
document.body.appendChild(ta);
|
|
108
|
+
ta.select();
|
|
109
|
+
document.execCommand("copy");
|
|
110
|
+
document.body.removeChild(ta);
|
|
111
|
+
}
|
|
112
|
+
setCopied(true);
|
|
113
|
+
setTimeout(() => setCopied(false), 1500);
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
117
|
+
import_react_bootstrap4.Badge,
|
|
118
|
+
{
|
|
119
|
+
ref,
|
|
120
|
+
bg,
|
|
121
|
+
text: textColor,
|
|
122
|
+
pill: true,
|
|
123
|
+
className: "border px-2 py-1",
|
|
124
|
+
style: { cursor: "pointer", fontFamily: "monospace", fontSize: "0.8rem", userSelect: "none" },
|
|
125
|
+
onClick: handleCopy,
|
|
126
|
+
onMouseEnter: () => setShowTooltip(true),
|
|
127
|
+
onMouseLeave: () => {
|
|
128
|
+
setShowTooltip(false);
|
|
129
|
+
setCopied(false);
|
|
130
|
+
},
|
|
131
|
+
children: [
|
|
132
|
+
shortId,
|
|
133
|
+
"\u2026"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_bootstrap4.Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_bootstrap4.Tooltip, { ...props, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
|
|
138
|
+
uuid,
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("br", {}),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { className: "text-muted", children: "Clique para copiar" })
|
|
141
|
+
] }) }) })
|
|
142
|
+
] });
|
|
143
|
+
};
|
|
144
|
+
var UuidPill_default = UuidPill;
|
|
145
|
+
|
|
146
|
+
// src/displays/GenericDisplay.tsx
|
|
147
|
+
var import_react2 = __toESM(require("react"));
|
|
148
|
+
var import_react_bootstrap5 = require("react-bootstrap");
|
|
149
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
150
|
+
var ConfigObject = class {
|
|
151
|
+
constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
|
|
152
|
+
this.dotNotation = dotNotation;
|
|
153
|
+
this.style = style;
|
|
154
|
+
this.onClick = onClick;
|
|
155
|
+
this.onBlur = onBlur;
|
|
156
|
+
this.onHideClick = onHideClick;
|
|
157
|
+
this.hidden = hidden;
|
|
158
|
+
this.mapData = mapData;
|
|
159
|
+
this.additionalComponents = additionalComponents || [];
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var getRightConfigObjects = (currentPropertieMap, configObjects) => {
|
|
163
|
+
const curreDotNotation = currentPropertieMap.join(".");
|
|
164
|
+
if (!configObjects) return [];
|
|
165
|
+
return configObjects.filter((configObject) => configObject.dotNotation === curreDotNotation);
|
|
166
|
+
};
|
|
167
|
+
var getStyle = (configObjects) => {
|
|
168
|
+
let styleObject = {};
|
|
169
|
+
configObjects.forEach((configObject) => {
|
|
170
|
+
styleObject = { ...styleObject, ...configObject.style };
|
|
171
|
+
});
|
|
172
|
+
return styleObject;
|
|
173
|
+
};
|
|
174
|
+
var getAdditionalComponentes = (configObjects) => {
|
|
175
|
+
const components = [];
|
|
176
|
+
configObjects.forEach((configObject) => {
|
|
177
|
+
if (configObject.additionalComponents) {
|
|
178
|
+
components.push(...configObject.additionalComponents);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return components;
|
|
182
|
+
};
|
|
183
|
+
var getOnClick = (configObjects) => {
|
|
184
|
+
return () => {
|
|
185
|
+
configObjects.forEach((configObject) => {
|
|
186
|
+
configObject.onClick && configObject.onClick();
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, isRoot, editButtonRenderer) => {
|
|
191
|
+
const newPropertiesMap = [];
|
|
192
|
+
if (opn) newPropertiesMap.push(...propertiesMap, opn);
|
|
193
|
+
else newPropertiesMap.push(...propertiesMap);
|
|
194
|
+
const innerConfigs = getRightConfigObjects(newPropertiesMap, configObjects);
|
|
195
|
+
const styles = getStyle(innerConfigs);
|
|
196
|
+
const onClick = getOnClick(innerConfigs);
|
|
197
|
+
const extraComponents = getAdditionalComponentes(innerConfigs);
|
|
198
|
+
if (Array.isArray(obj)) {
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_bootstrap5.Container, { onClick, style: { ...styles }, children: [
|
|
200
|
+
opn && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: opn }) }),
|
|
201
|
+
obj.map((o, index) => {
|
|
202
|
+
const mapCopy = [...newPropertiesMap, `[${index}]`];
|
|
203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_bootstrap5.Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
|
|
204
|
+
})
|
|
205
|
+
] });
|
|
206
|
+
}
|
|
207
|
+
if (typeof obj === "object" && obj != null) {
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
209
|
+
import_react_bootstrap5.Container,
|
|
210
|
+
{
|
|
211
|
+
onClick,
|
|
212
|
+
style: {
|
|
213
|
+
border: innerArray ? "solid" : void 0,
|
|
214
|
+
borderColor: "lightgray",
|
|
215
|
+
borderRadius: innerArray ? 4 : 2,
|
|
216
|
+
borderWidth: 1,
|
|
217
|
+
padding: 4,
|
|
218
|
+
...styles
|
|
219
|
+
},
|
|
220
|
+
children: [
|
|
221
|
+
opn && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: opn }),
|
|
222
|
+
Object.entries(obj).map(
|
|
223
|
+
([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
|
|
224
|
+
),
|
|
225
|
+
extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react2.default.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_bootstrap5.Col, { children: [
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("strong", { children: [
|
|
232
|
+
opn,
|
|
233
|
+
": "
|
|
234
|
+
] }),
|
|
235
|
+
String(obj)
|
|
236
|
+
] });
|
|
237
|
+
};
|
|
238
|
+
var GenericDisplay = ({
|
|
239
|
+
ops = [],
|
|
240
|
+
loadFunc,
|
|
241
|
+
configObjects,
|
|
242
|
+
rootName,
|
|
243
|
+
context,
|
|
244
|
+
onRefresh,
|
|
245
|
+
editButtonRenderer
|
|
246
|
+
}) => {
|
|
247
|
+
const [innerOptions, setInnerOptions] = (0, import_react2.useState)();
|
|
248
|
+
const refreshFunc = () => {
|
|
249
|
+
if (loadFunc) {
|
|
250
|
+
loadFunc().then((res) => {
|
|
251
|
+
if (Array.isArray(res)) {
|
|
252
|
+
setInnerOptions(res);
|
|
253
|
+
} else {
|
|
254
|
+
setInnerOptions([res]);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
258
|
+
setInnerOptions(ops);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
(0, import_react2.useEffect)(() => {
|
|
262
|
+
if (onRefresh) {
|
|
263
|
+
onRefresh(refreshFunc);
|
|
264
|
+
} else {
|
|
265
|
+
refreshFunc();
|
|
266
|
+
}
|
|
267
|
+
}, [context]);
|
|
268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_bootstrap5.Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
|
|
269
|
+
};
|
|
270
|
+
var GenericDisplay_default = GenericDisplay;
|
|
271
|
+
|
|
272
|
+
// src/forms/GenericForm.tsx
|
|
273
|
+
var import_react3 = require("react");
|
|
274
|
+
var import_react_bootstrap6 = require("react-bootstrap");
|
|
275
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
276
|
+
var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
277
|
+
const [formValues, setFormValues] = (0, import_react3.useState)({});
|
|
278
|
+
const [errors, setErrors] = (0, import_react3.useState)({});
|
|
279
|
+
const handleChange = (key, value) => {
|
|
280
|
+
setFormValues({
|
|
281
|
+
...formValues,
|
|
282
|
+
[key]: value
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
const validate = () => {
|
|
286
|
+
const newErrors = {};
|
|
287
|
+
fields.forEach((field) => {
|
|
288
|
+
if (field.required && !formValues[field.key]) {
|
|
289
|
+
newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
setErrors(newErrors);
|
|
293
|
+
return Object.keys(newErrors).length === 0;
|
|
294
|
+
};
|
|
295
|
+
const handleSubmit = (e) => {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
if (validate()) {
|
|
298
|
+
onSubmit(formValues);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const renderField = (field) => {
|
|
302
|
+
const { label, key, type, options, placeholder } = field;
|
|
303
|
+
const value = formValues[key] || "";
|
|
304
|
+
switch (type) {
|
|
305
|
+
case "text":
|
|
306
|
+
case "number":
|
|
307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_bootstrap6.Form.Group, { className: "mb-3", children: [
|
|
308
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Label, { children: label }),
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
310
|
+
import_react_bootstrap6.Form.Control,
|
|
311
|
+
{
|
|
312
|
+
type,
|
|
313
|
+
placeholder,
|
|
314
|
+
value,
|
|
315
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
316
|
+
isInvalid: !!errors[key]
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
320
|
+
] }, key);
|
|
321
|
+
case "select": {
|
|
322
|
+
const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_bootstrap6.Form.Group, { className: "mb-3", children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Label, { children: label }),
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
326
|
+
import_react_bootstrap6.Form.Select,
|
|
327
|
+
{
|
|
328
|
+
value,
|
|
329
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
330
|
+
isInvalid: !!errors[key],
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "Selecione..." }),
|
|
333
|
+
orderedOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: option.value, children: option.label }, String(option.value)))
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
338
|
+
] }, key);
|
|
339
|
+
}
|
|
340
|
+
case "custom-select":
|
|
341
|
+
if (renderCustomSelect) {
|
|
342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
343
|
+
renderCustomSelect({
|
|
344
|
+
label,
|
|
345
|
+
value,
|
|
346
|
+
options,
|
|
347
|
+
onChange: (v) => handleChange(key, v),
|
|
348
|
+
placeholder
|
|
349
|
+
}),
|
|
350
|
+
errors[key] && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "invalid-feedback d-block", children: errors[key] })
|
|
351
|
+
] }, key);
|
|
352
|
+
}
|
|
353
|
+
return null;
|
|
354
|
+
case "date":
|
|
355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_bootstrap6.Form.Group, { className: "mb-3", children: [
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Label, { children: label }),
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
358
|
+
import_react_bootstrap6.Form.Control,
|
|
359
|
+
{
|
|
360
|
+
type: "date",
|
|
361
|
+
value,
|
|
362
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
363
|
+
isInvalid: !!errors[key]
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
367
|
+
] }, key);
|
|
368
|
+
default:
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_bootstrap6.Form, { onSubmit: handleSubmit, children: [
|
|
373
|
+
fields.map((field) => renderField(field)),
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "d-grid", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_bootstrap6.Button, { variant: "primary", type: "submit", children: "Salvar" }) })
|
|
375
|
+
] });
|
|
376
|
+
};
|
|
377
|
+
var GenericForm_default = GenericForm;
|
|
378
|
+
|
|
379
|
+
// src/forms/GenericSelect.tsx
|
|
380
|
+
var import_react4 = require("react");
|
|
381
|
+
var import_react_bootstrap7 = require("react-bootstrap");
|
|
382
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
383
|
+
var GenericSelectOps = class {
|
|
384
|
+
constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
|
|
385
|
+
this.noLabel = noLabel;
|
|
386
|
+
this.title = title;
|
|
387
|
+
this.onChange = onChange;
|
|
388
|
+
this.ops = ops;
|
|
389
|
+
this.selection = selection;
|
|
390
|
+
this.returnType = returnType;
|
|
391
|
+
this.displayType = displayType;
|
|
392
|
+
this.filter = filter;
|
|
393
|
+
this.filterField = filterField;
|
|
394
|
+
this.valueType = valueType;
|
|
395
|
+
this.loadFunc = loadFunc;
|
|
396
|
+
this.loadCondition = loadCondition;
|
|
397
|
+
this.actionClick = actionClick;
|
|
398
|
+
this.locked = locked;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var GenericSelect = ({
|
|
402
|
+
noLabel,
|
|
403
|
+
title,
|
|
404
|
+
onChange,
|
|
405
|
+
ops,
|
|
406
|
+
selection,
|
|
407
|
+
returnType,
|
|
408
|
+
displayType,
|
|
409
|
+
filter,
|
|
410
|
+
filterField,
|
|
411
|
+
valueType,
|
|
412
|
+
loadFunc,
|
|
413
|
+
loadCondition = true,
|
|
414
|
+
actionClick,
|
|
415
|
+
locked,
|
|
416
|
+
isBold,
|
|
417
|
+
...restProps
|
|
418
|
+
}) => {
|
|
419
|
+
const [options, setOptions] = (0, import_react4.useState)(ops || []);
|
|
420
|
+
(0, import_react4.useEffect)(() => {
|
|
421
|
+
const loadFunction = async () => {
|
|
422
|
+
if (loadCondition && loadFunc) {
|
|
423
|
+
loadFunc().then((res) => {
|
|
424
|
+
let newOps = res.content ? res.content : res;
|
|
425
|
+
if (filter && filterField) {
|
|
426
|
+
newOps = res.filter((op) => op[filterField] == filter);
|
|
427
|
+
}
|
|
428
|
+
setOptions(newOps);
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
loadFunction().catch((error) => console.log(error));
|
|
433
|
+
}, [loadCondition]);
|
|
434
|
+
const getTrueValue = (clickedIndex) => {
|
|
435
|
+
const returnValue = options.filter((_op, index) => index == clickedIndex - 1)[0];
|
|
436
|
+
if (returnType == "index") {
|
|
437
|
+
onChange(clickedIndex);
|
|
438
|
+
} else if (returnType) {
|
|
439
|
+
onChange(returnValue[returnType]);
|
|
440
|
+
} else {
|
|
441
|
+
onChange(returnValue);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
|
|
445
|
+
const selectContent = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
446
|
+
import_react_bootstrap7.Form.Control,
|
|
447
|
+
{
|
|
448
|
+
disabled: locked,
|
|
449
|
+
as: "select",
|
|
450
|
+
value: selection,
|
|
451
|
+
onChange: (event) => getTrueValue(event.target.selectedIndex),
|
|
452
|
+
children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("option", { value: void 0, children: [
|
|
454
|
+
"-- ",
|
|
455
|
+
defaultPlaceholder,
|
|
456
|
+
" --"
|
|
457
|
+
] }, 0),
|
|
458
|
+
(options == null ? void 0 : options.length) > 0 && options.map((op, index) => {
|
|
459
|
+
const val = valueType && op[valueType] || op.id || op;
|
|
460
|
+
let fill = displayType && op[displayType] || op;
|
|
461
|
+
if (typeof fill == "object") fill = "";
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: val, children: fill }, op.id || index);
|
|
463
|
+
})
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
if (actionClick) {
|
|
468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_bootstrap7.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_bootstrap7.InputGroup, { children: [
|
|
471
|
+
selectContent,
|
|
472
|
+
actionClick()
|
|
473
|
+
] })
|
|
474
|
+
] });
|
|
475
|
+
}
|
|
476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_bootstrap7.Form.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
478
|
+
selectContent
|
|
479
|
+
] });
|
|
480
|
+
};
|
|
481
|
+
var GenericSelect_default = GenericSelect;
|
|
482
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
483
|
+
0 && (module.exports = {
|
|
484
|
+
AddButton,
|
|
485
|
+
ConfigObject,
|
|
486
|
+
DeleteButton,
|
|
487
|
+
GenericDisplay,
|
|
488
|
+
GenericForm,
|
|
489
|
+
GenericSelect,
|
|
490
|
+
GenericSelectOps,
|
|
491
|
+
ResponsiveContainer,
|
|
492
|
+
UuidPill
|
|
493
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
// src/buttons/AddButton.tsx
|
|
2
|
+
import { Button } from "react-bootstrap";
|
|
3
|
+
import { GrAdd } from "react-icons/gr";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var AddButton = ({ callback, hiddenBool, size }) => /* @__PURE__ */ jsx(
|
|
6
|
+
Button,
|
|
7
|
+
{
|
|
8
|
+
hidden: hiddenBool || false,
|
|
9
|
+
variant: "outline-primary",
|
|
10
|
+
onClick: () => callback(),
|
|
11
|
+
children: /* @__PURE__ */ jsx(GrAdd, { size: size || 25 })
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
var AddButton_default = AddButton;
|
|
15
|
+
|
|
16
|
+
// src/buttons/DeleteButton.tsx
|
|
17
|
+
import { Button as Button2 } from "react-bootstrap";
|
|
18
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
19
|
+
var DeleteButton = ({ title, onDeleteClick }) => {
|
|
20
|
+
return /* @__PURE__ */ jsx2(Button2, { variant: "danger", onClick: () => onDeleteClick(), children: title });
|
|
21
|
+
};
|
|
22
|
+
var DeleteButton_default = DeleteButton;
|
|
23
|
+
|
|
24
|
+
// src/containers/ResponsiveContainer.tsx
|
|
25
|
+
import { Modal, ModalBody } from "react-bootstrap";
|
|
26
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
27
|
+
var ResponsiveContainer = ({
|
|
28
|
+
title,
|
|
29
|
+
show,
|
|
30
|
+
setShow,
|
|
31
|
+
children,
|
|
32
|
+
onClose,
|
|
33
|
+
scrollable = false
|
|
34
|
+
}) => {
|
|
35
|
+
const handleClose = () => {
|
|
36
|
+
setShow(false);
|
|
37
|
+
if (onClose) onClose();
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsxs(Modal, { size: "lg", show, onHide: handleClose, scrollable, children: [
|
|
40
|
+
/* @__PURE__ */ jsx3(Modal.Header, { closeButton: true, onClick: handleClose }),
|
|
41
|
+
/* @__PURE__ */ jsx3(ModalBody, { children })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
var ResponsiveContainer_default = ResponsiveContainer;
|
|
45
|
+
|
|
46
|
+
// src/displays/UuidPill.tsx
|
|
47
|
+
import { useState, useRef } from "react";
|
|
48
|
+
import { Badge, Overlay, Tooltip } from "react-bootstrap";
|
|
49
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
50
|
+
var UuidPill = ({ uuid, bg = "light", textColor = "dark", short = 8 }) => {
|
|
51
|
+
const [copied, setCopied] = useState(false);
|
|
52
|
+
const ref = useRef(null);
|
|
53
|
+
const [showTooltip, setShowTooltip] = useState(false);
|
|
54
|
+
if (!uuid) return /* @__PURE__ */ jsx4("span", { className: "text-muted", children: "\u2014" });
|
|
55
|
+
const shortId = String(uuid).substring(0, short);
|
|
56
|
+
const handleCopy = async (e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
try {
|
|
59
|
+
await navigator.clipboard.writeText(uuid);
|
|
60
|
+
} catch (e2) {
|
|
61
|
+
const ta = document.createElement("textarea");
|
|
62
|
+
ta.value = uuid;
|
|
63
|
+
document.body.appendChild(ta);
|
|
64
|
+
ta.select();
|
|
65
|
+
document.execCommand("copy");
|
|
66
|
+
document.body.removeChild(ta);
|
|
67
|
+
}
|
|
68
|
+
setCopied(true);
|
|
69
|
+
setTimeout(() => setCopied(false), 1500);
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
72
|
+
/* @__PURE__ */ jsxs2(
|
|
73
|
+
Badge,
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
bg,
|
|
77
|
+
text: textColor,
|
|
78
|
+
pill: true,
|
|
79
|
+
className: "border px-2 py-1",
|
|
80
|
+
style: { cursor: "pointer", fontFamily: "monospace", fontSize: "0.8rem", userSelect: "none" },
|
|
81
|
+
onClick: handleCopy,
|
|
82
|
+
onMouseEnter: () => setShowTooltip(true),
|
|
83
|
+
onMouseLeave: () => {
|
|
84
|
+
setShowTooltip(false);
|
|
85
|
+
setCopied(false);
|
|
86
|
+
},
|
|
87
|
+
children: [
|
|
88
|
+
shortId,
|
|
89
|
+
"\u2026"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ jsx4(Overlay, { target: ref.current, show: showTooltip, placement: "top", children: (props) => /* @__PURE__ */ jsx4(Tooltip, { ...props, children: copied ? /* @__PURE__ */ jsx4("span", { style: { color: "#6f6" }, children: "Copiado!" }) : /* @__PURE__ */ jsxs2("span", { style: { fontFamily: "monospace", fontSize: "0.75rem" }, children: [
|
|
94
|
+
uuid,
|
|
95
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
96
|
+
/* @__PURE__ */ jsx4("small", { className: "text-muted", children: "Clique para copiar" })
|
|
97
|
+
] }) }) })
|
|
98
|
+
] });
|
|
99
|
+
};
|
|
100
|
+
var UuidPill_default = UuidPill;
|
|
101
|
+
|
|
102
|
+
// src/displays/GenericDisplay.tsx
|
|
103
|
+
import React2, { useState as useState2, useEffect } from "react";
|
|
104
|
+
import { Col, Container, Row } from "react-bootstrap";
|
|
105
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
106
|
+
var ConfigObject = class {
|
|
107
|
+
constructor(dotNotation, style, onClick, onBlur, onHideClick, hidden, mapData, additionalComponents) {
|
|
108
|
+
this.dotNotation = dotNotation;
|
|
109
|
+
this.style = style;
|
|
110
|
+
this.onClick = onClick;
|
|
111
|
+
this.onBlur = onBlur;
|
|
112
|
+
this.onHideClick = onHideClick;
|
|
113
|
+
this.hidden = hidden;
|
|
114
|
+
this.mapData = mapData;
|
|
115
|
+
this.additionalComponents = additionalComponents || [];
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var getRightConfigObjects = (currentPropertieMap, configObjects) => {
|
|
119
|
+
const curreDotNotation = currentPropertieMap.join(".");
|
|
120
|
+
if (!configObjects) return [];
|
|
121
|
+
return configObjects.filter((configObject) => configObject.dotNotation === curreDotNotation);
|
|
122
|
+
};
|
|
123
|
+
var getStyle = (configObjects) => {
|
|
124
|
+
let styleObject = {};
|
|
125
|
+
configObjects.forEach((configObject) => {
|
|
126
|
+
styleObject = { ...styleObject, ...configObject.style };
|
|
127
|
+
});
|
|
128
|
+
return styleObject;
|
|
129
|
+
};
|
|
130
|
+
var getAdditionalComponentes = (configObjects) => {
|
|
131
|
+
const components = [];
|
|
132
|
+
configObjects.forEach((configObject) => {
|
|
133
|
+
if (configObject.additionalComponents) {
|
|
134
|
+
components.push(...configObject.additionalComponents);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return components;
|
|
138
|
+
};
|
|
139
|
+
var getOnClick = (configObjects) => {
|
|
140
|
+
return () => {
|
|
141
|
+
configObjects.forEach((configObject) => {
|
|
142
|
+
configObject.onClick && configObject.onClick();
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
var buildData = (obj, propertiesMap, configObjects, opn, innerArray, dispatch, isRoot, editButtonRenderer) => {
|
|
147
|
+
const newPropertiesMap = [];
|
|
148
|
+
if (opn) newPropertiesMap.push(...propertiesMap, opn);
|
|
149
|
+
else newPropertiesMap.push(...propertiesMap);
|
|
150
|
+
const innerConfigs = getRightConfigObjects(newPropertiesMap, configObjects);
|
|
151
|
+
const styles = getStyle(innerConfigs);
|
|
152
|
+
const onClick = getOnClick(innerConfigs);
|
|
153
|
+
const extraComponents = getAdditionalComponentes(innerConfigs);
|
|
154
|
+
if (Array.isArray(obj)) {
|
|
155
|
+
return /* @__PURE__ */ jsxs3(Container, { onClick, style: { ...styles }, children: [
|
|
156
|
+
opn && /* @__PURE__ */ jsx5("div", { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx5("strong", { children: opn }) }),
|
|
157
|
+
obj.map((o, index) => {
|
|
158
|
+
const mapCopy = [...newPropertiesMap, `[${index}]`];
|
|
159
|
+
return /* @__PURE__ */ jsx5(Row, { style: { padding: 4, ...styles }, children: buildData(o, mapCopy, configObjects, null, true, null, false, editButtonRenderer) }, index);
|
|
160
|
+
})
|
|
161
|
+
] });
|
|
162
|
+
}
|
|
163
|
+
if (typeof obj === "object" && obj != null) {
|
|
164
|
+
return /* @__PURE__ */ jsxs3(
|
|
165
|
+
Container,
|
|
166
|
+
{
|
|
167
|
+
onClick,
|
|
168
|
+
style: {
|
|
169
|
+
border: innerArray ? "solid" : void 0,
|
|
170
|
+
borderColor: "lightgray",
|
|
171
|
+
borderRadius: innerArray ? 4 : 2,
|
|
172
|
+
borderWidth: 1,
|
|
173
|
+
padding: 4,
|
|
174
|
+
...styles
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
opn && /* @__PURE__ */ jsx5("strong", { children: opn }),
|
|
178
|
+
Object.entries(obj).map(
|
|
179
|
+
([key, value]) => buildData(value, newPropertiesMap, configObjects, key, false, null, false, editButtonRenderer)
|
|
180
|
+
),
|
|
181
|
+
extraComponents.length > 0 ? extraComponents.map((comp, i) => /* @__PURE__ */ jsx5(React2.Fragment, { children: comp() }, i)) : isRoot && editButtonRenderer ? editButtonRenderer(obj, opn) : null
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return /* @__PURE__ */ jsxs3(Col, { children: [
|
|
187
|
+
/* @__PURE__ */ jsxs3("strong", { children: [
|
|
188
|
+
opn,
|
|
189
|
+
": "
|
|
190
|
+
] }),
|
|
191
|
+
String(obj)
|
|
192
|
+
] });
|
|
193
|
+
};
|
|
194
|
+
var GenericDisplay = ({
|
|
195
|
+
ops = [],
|
|
196
|
+
loadFunc,
|
|
197
|
+
configObjects,
|
|
198
|
+
rootName,
|
|
199
|
+
context,
|
|
200
|
+
onRefresh,
|
|
201
|
+
editButtonRenderer
|
|
202
|
+
}) => {
|
|
203
|
+
const [innerOptions, setInnerOptions] = useState2();
|
|
204
|
+
const refreshFunc = () => {
|
|
205
|
+
if (loadFunc) {
|
|
206
|
+
loadFunc().then((res) => {
|
|
207
|
+
if (Array.isArray(res)) {
|
|
208
|
+
setInnerOptions(res);
|
|
209
|
+
} else {
|
|
210
|
+
setInnerOptions([res]);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
} else {
|
|
214
|
+
setInnerOptions(ops);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (onRefresh) {
|
|
219
|
+
onRefresh(refreshFunc);
|
|
220
|
+
} else {
|
|
221
|
+
refreshFunc();
|
|
222
|
+
}
|
|
223
|
+
}, [context]);
|
|
224
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: innerOptions && innerOptions.map((cObj, index) => /* @__PURE__ */ jsx5(Container, { style: { padding: 4, border: "solid" }, children: buildData(cObj, [], configObjects, rootName || null, false, null, true, editButtonRenderer) }, index)) });
|
|
225
|
+
};
|
|
226
|
+
var GenericDisplay_default = GenericDisplay;
|
|
227
|
+
|
|
228
|
+
// src/forms/GenericForm.tsx
|
|
229
|
+
import { useState as useState3 } from "react";
|
|
230
|
+
import { Button as Button3, Form } from "react-bootstrap";
|
|
231
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
232
|
+
var GenericForm = ({ fields, onSubmit, renderCustomSelect }) => {
|
|
233
|
+
const [formValues, setFormValues] = useState3({});
|
|
234
|
+
const [errors, setErrors] = useState3({});
|
|
235
|
+
const handleChange = (key, value) => {
|
|
236
|
+
setFormValues({
|
|
237
|
+
...formValues,
|
|
238
|
+
[key]: value
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const validate = () => {
|
|
242
|
+
const newErrors = {};
|
|
243
|
+
fields.forEach((field) => {
|
|
244
|
+
if (field.required && !formValues[field.key]) {
|
|
245
|
+
newErrors[field.key] = `${field.label} \xE9 obrigat\xF3rio`;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
setErrors(newErrors);
|
|
249
|
+
return Object.keys(newErrors).length === 0;
|
|
250
|
+
};
|
|
251
|
+
const handleSubmit = (e) => {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
if (validate()) {
|
|
254
|
+
onSubmit(formValues);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const renderField = (field) => {
|
|
258
|
+
const { label, key, type, options, placeholder } = field;
|
|
259
|
+
const value = formValues[key] || "";
|
|
260
|
+
switch (type) {
|
|
261
|
+
case "text":
|
|
262
|
+
case "number":
|
|
263
|
+
return /* @__PURE__ */ jsxs4(Form.Group, { className: "mb-3", children: [
|
|
264
|
+
/* @__PURE__ */ jsx6(Form.Label, { children: label }),
|
|
265
|
+
/* @__PURE__ */ jsx6(
|
|
266
|
+
Form.Control,
|
|
267
|
+
{
|
|
268
|
+
type,
|
|
269
|
+
placeholder,
|
|
270
|
+
value,
|
|
271
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
272
|
+
isInvalid: !!errors[key]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ jsx6(Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
276
|
+
] }, key);
|
|
277
|
+
case "select": {
|
|
278
|
+
const orderedOptions = (options || []).filter((opt) => opt && opt.value !== void 0 && opt.label !== void 0).sort((a, b) => a.label.localeCompare(b.label));
|
|
279
|
+
return /* @__PURE__ */ jsxs4(Form.Group, { className: "mb-3", children: [
|
|
280
|
+
/* @__PURE__ */ jsx6(Form.Label, { children: label }),
|
|
281
|
+
/* @__PURE__ */ jsxs4(
|
|
282
|
+
Form.Select,
|
|
283
|
+
{
|
|
284
|
+
value,
|
|
285
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
286
|
+
isInvalid: !!errors[key],
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ jsx6("option", { value: "", children: "Selecione..." }),
|
|
289
|
+
orderedOptions.map((option) => /* @__PURE__ */ jsx6("option", { value: option.value, children: option.label }, String(option.value)))
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ jsx6(Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
294
|
+
] }, key);
|
|
295
|
+
}
|
|
296
|
+
case "custom-select":
|
|
297
|
+
if (renderCustomSelect) {
|
|
298
|
+
return /* @__PURE__ */ jsxs4("div", { children: [
|
|
299
|
+
renderCustomSelect({
|
|
300
|
+
label,
|
|
301
|
+
value,
|
|
302
|
+
options,
|
|
303
|
+
onChange: (v) => handleChange(key, v),
|
|
304
|
+
placeholder
|
|
305
|
+
}),
|
|
306
|
+
errors[key] && /* @__PURE__ */ jsx6("div", { className: "invalid-feedback d-block", children: errors[key] })
|
|
307
|
+
] }, key);
|
|
308
|
+
}
|
|
309
|
+
return null;
|
|
310
|
+
case "date":
|
|
311
|
+
return /* @__PURE__ */ jsxs4(Form.Group, { className: "mb-3", children: [
|
|
312
|
+
/* @__PURE__ */ jsx6(Form.Label, { children: label }),
|
|
313
|
+
/* @__PURE__ */ jsx6(
|
|
314
|
+
Form.Control,
|
|
315
|
+
{
|
|
316
|
+
type: "date",
|
|
317
|
+
value,
|
|
318
|
+
onChange: (e) => handleChange(key, e.target.value),
|
|
319
|
+
isInvalid: !!errors[key]
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
/* @__PURE__ */ jsx6(Form.Control.Feedback, { type: "invalid", children: errors[key] })
|
|
323
|
+
] }, key);
|
|
324
|
+
default:
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
return /* @__PURE__ */ jsxs4(Form, { onSubmit: handleSubmit, children: [
|
|
329
|
+
fields.map((field) => renderField(field)),
|
|
330
|
+
/* @__PURE__ */ jsx6("div", { className: "d-grid", children: /* @__PURE__ */ jsx6(Button3, { variant: "primary", type: "submit", children: "Salvar" }) })
|
|
331
|
+
] });
|
|
332
|
+
};
|
|
333
|
+
var GenericForm_default = GenericForm;
|
|
334
|
+
|
|
335
|
+
// src/forms/GenericSelect.tsx
|
|
336
|
+
import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
337
|
+
import { Form as Form2, InputGroup } from "react-bootstrap";
|
|
338
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
339
|
+
var GenericSelectOps = class {
|
|
340
|
+
constructor(noLabel, title, onChange, ops, selection, returnType, displayType, filter, filterField, valueType, loadFunc, loadCondition, actionClick, locked) {
|
|
341
|
+
this.noLabel = noLabel;
|
|
342
|
+
this.title = title;
|
|
343
|
+
this.onChange = onChange;
|
|
344
|
+
this.ops = ops;
|
|
345
|
+
this.selection = selection;
|
|
346
|
+
this.returnType = returnType;
|
|
347
|
+
this.displayType = displayType;
|
|
348
|
+
this.filter = filter;
|
|
349
|
+
this.filterField = filterField;
|
|
350
|
+
this.valueType = valueType;
|
|
351
|
+
this.loadFunc = loadFunc;
|
|
352
|
+
this.loadCondition = loadCondition;
|
|
353
|
+
this.actionClick = actionClick;
|
|
354
|
+
this.locked = locked;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
var GenericSelect = ({
|
|
358
|
+
noLabel,
|
|
359
|
+
title,
|
|
360
|
+
onChange,
|
|
361
|
+
ops,
|
|
362
|
+
selection,
|
|
363
|
+
returnType,
|
|
364
|
+
displayType,
|
|
365
|
+
filter,
|
|
366
|
+
filterField,
|
|
367
|
+
valueType,
|
|
368
|
+
loadFunc,
|
|
369
|
+
loadCondition = true,
|
|
370
|
+
actionClick,
|
|
371
|
+
locked,
|
|
372
|
+
isBold,
|
|
373
|
+
...restProps
|
|
374
|
+
}) => {
|
|
375
|
+
const [options, setOptions] = useState4(ops || []);
|
|
376
|
+
useEffect2(() => {
|
|
377
|
+
const loadFunction = async () => {
|
|
378
|
+
if (loadCondition && loadFunc) {
|
|
379
|
+
loadFunc().then((res) => {
|
|
380
|
+
let newOps = res.content ? res.content : res;
|
|
381
|
+
if (filter && filterField) {
|
|
382
|
+
newOps = res.filter((op) => op[filterField] == filter);
|
|
383
|
+
}
|
|
384
|
+
setOptions(newOps);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
loadFunction().catch((error) => console.log(error));
|
|
389
|
+
}, [loadCondition]);
|
|
390
|
+
const getTrueValue = (clickedIndex) => {
|
|
391
|
+
const returnValue = options.filter((_op, index) => index == clickedIndex - 1)[0];
|
|
392
|
+
if (returnType == "index") {
|
|
393
|
+
onChange(clickedIndex);
|
|
394
|
+
} else if (returnType) {
|
|
395
|
+
onChange(returnValue[returnType]);
|
|
396
|
+
} else {
|
|
397
|
+
onChange(returnValue);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
const defaultPlaceholder = (restProps == null ? void 0 : restProps.default) || "Seleciona uma Op\xE7\xE3o";
|
|
401
|
+
const selectContent = /* @__PURE__ */ jsxs5(
|
|
402
|
+
Form2.Control,
|
|
403
|
+
{
|
|
404
|
+
disabled: locked,
|
|
405
|
+
as: "select",
|
|
406
|
+
value: selection,
|
|
407
|
+
onChange: (event) => getTrueValue(event.target.selectedIndex),
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ jsxs5("option", { value: void 0, children: [
|
|
410
|
+
"-- ",
|
|
411
|
+
defaultPlaceholder,
|
|
412
|
+
" --"
|
|
413
|
+
] }, 0),
|
|
414
|
+
(options == null ? void 0 : options.length) > 0 && options.map((op, index) => {
|
|
415
|
+
const val = valueType && op[valueType] || op.id || op;
|
|
416
|
+
let fill = displayType && op[displayType] || op;
|
|
417
|
+
if (typeof fill == "object") fill = "";
|
|
418
|
+
return /* @__PURE__ */ jsx7("option", { value: val, children: fill }, op.id || index);
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
if (actionClick) {
|
|
424
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
425
|
+
/* @__PURE__ */ jsx7(Form2.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
426
|
+
/* @__PURE__ */ jsxs5(InputGroup, { children: [
|
|
427
|
+
selectContent,
|
|
428
|
+
actionClick()
|
|
429
|
+
] })
|
|
430
|
+
] });
|
|
431
|
+
}
|
|
432
|
+
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
433
|
+
/* @__PURE__ */ jsx7(Form2.Label, { style: { fontWeight: isBold ? "bold" : void 0 }, hidden: noLabel, children: title }),
|
|
434
|
+
selectContent
|
|
435
|
+
] });
|
|
436
|
+
};
|
|
437
|
+
var GenericSelect_default = GenericSelect;
|
|
438
|
+
export {
|
|
439
|
+
AddButton_default as AddButton,
|
|
440
|
+
ConfigObject,
|
|
441
|
+
DeleteButton_default as DeleteButton,
|
|
442
|
+
GenericDisplay_default as GenericDisplay,
|
|
443
|
+
GenericForm_default as GenericForm,
|
|
444
|
+
GenericSelect_default as GenericSelect,
|
|
445
|
+
GenericSelectOps,
|
|
446
|
+
ResponsiveContainer_default as ResponsiveContainer,
|
|
447
|
+
UuidPill_default as UuidPill
|
|
448
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "teraprox-ui-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Componentes visuais compartilhados entre módulos federados TeraproX",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./styles": "./dist/styles/teraprox-base.css"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
21
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": ">=17.0.0",
|
|
28
|
+
"react-bootstrap": ">=2.0.0",
|
|
29
|
+
"react-icons": ">=4.0.0",
|
|
30
|
+
"react-router-dom": ">=6.0.0",
|
|
31
|
+
"react-redux": ">=7.0.0",
|
|
32
|
+
"react-bootstrap-typeahead": ">=5.0.0",
|
|
33
|
+
"dayjs": ">=1.11.0",
|
|
34
|
+
"browser-image-compression": ">=2.0.0",
|
|
35
|
+
"react-dropzone": ">=14.0.0",
|
|
36
|
+
"react-color": ">=2.0.0",
|
|
37
|
+
"recharts": ">=2.0.0",
|
|
38
|
+
"qr-scanner": ">=1.0.0",
|
|
39
|
+
"qrcode": ">=1.0.0",
|
|
40
|
+
"react-qr-code": ">=2.0.0",
|
|
41
|
+
"file-saver": ">=2.0.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"react-bootstrap-typeahead": { "optional": true },
|
|
45
|
+
"browser-image-compression": { "optional": true },
|
|
46
|
+
"react-dropzone": { "optional": true },
|
|
47
|
+
"react-color": { "optional": true },
|
|
48
|
+
"recharts": { "optional": true },
|
|
49
|
+
"qr-scanner": { "optional": true },
|
|
50
|
+
"qrcode": { "optional": true },
|
|
51
|
+
"react-qr-code": { "optional": true },
|
|
52
|
+
"file-saver": { "optional": true },
|
|
53
|
+
"dayjs": { "optional": true }
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/react": "^18.2.0",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-bootstrap": "^2.10.0",
|
|
59
|
+
"react-icons": "^5.0.0",
|
|
60
|
+
"react-router-dom": "^6.20.0",
|
|
61
|
+
"react-redux": "^9.0.0",
|
|
62
|
+
"tsup": "^8.0.0",
|
|
63
|
+
"typescript": "^5.3.0"
|
|
64
|
+
},
|
|
65
|
+
"license": "UNLICENSED"
|
|
66
|
+
}
|