@zauru-sdk/components 1.0.116 → 1.0.119
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/CHANGELOG.md +24 -0
- package/dist/Buttons/Button.d.ts +0 -1
- package/dist/HOC/ValidateEmployeeAccess/index.d.ts +1 -1
- package/dist/Layouts/errorLayout/index.d.ts +3 -1
- package/dist/ProgressBar/ProgressCircle.d.ts +1 -1
- package/dist/Zendesk/Chat.d.ts +0 -1
- package/dist/esm/Form/SelectField/index.js +2 -2
- package/dist/esm/Layouts/errorLayout/index.js +6 -6
- package/dist/esm/SidePanel/index.js +1 -1
- package/package.json +8 -9
- package/src/Form/SelectField/index.tsx +19 -1
- package/src/Form/TextField/index.tsx +1 -1
- package/src/Layouts/errorLayout/index.tsx +6 -1
- package/src/SidePanel/index.tsx +26 -26
- package/dist/cjs/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.js +0 -9
- package/dist/cjs/Alerts/StaticAlert.js +0 -32
- package/dist/cjs/Alerts/index.js +0 -18
- package/dist/cjs/BlockUI/BlockUI.js +0 -12
- package/dist/cjs/BlockUI/index.js +0 -17
- package/dist/cjs/Buttons/Button.js +0 -62
- package/dist/cjs/Buttons/index.js +0 -17
- package/dist/cjs/Card/Card.js +0 -9
- package/dist/cjs/Card/index.js +0 -17
- package/dist/cjs/Chat/ChatLayout.js +0 -31
- package/dist/cjs/Chat/ChatMessageHistory.js +0 -57
- package/dist/cjs/Chat/index.js +0 -18
- package/dist/cjs/ConnectionState/ConnectionState.js +0 -25
- package/dist/cjs/ConnectionState/index.js +0 -17
- package/dist/cjs/Containers/BodyContainer.js +0 -9
- package/dist/cjs/Containers/ButtonSectionContainer.js +0 -9
- package/dist/cjs/Containers/Container.js +0 -10
- package/dist/cjs/Containers/DoubleContainer.js +0 -18
- package/dist/cjs/Containers/MainContainer.js +0 -9
- package/dist/cjs/Containers/OutletContainer.js +0 -9
- package/dist/cjs/Containers/SubContainer.js +0 -10
- package/dist/cjs/Containers/index.js +0 -23
- package/dist/cjs/DynamicTable/BasicPrintDynamicTable.js +0 -31
- package/dist/cjs/DynamicTable/DynamicPrintTable.js +0 -158
- package/dist/cjs/DynamicTable/DynamicTable.js +0 -219
- package/dist/cjs/DynamicTable/GenericDynamicTable.js +0 -200
- package/dist/cjs/DynamicTable/index.js +0 -20
- package/dist/cjs/Footer/Footer.js +0 -20
- package/dist/cjs/Footer/index.js +0 -17
- package/dist/cjs/Form/Checkbox/index.js +0 -39
- package/dist/cjs/Form/Checklist/index.js +0 -14
- package/dist/cjs/Form/DatePicker/index.js +0 -37
- package/dist/cjs/Form/DynamicBaculoForm/index.js +0 -144
- package/dist/cjs/Form/FieldContainer/DoubleFieldContainer.js +0 -18
- package/dist/cjs/Form/FieldContainer/QuadrupleFieldContainer.js +0 -18
- package/dist/cjs/Form/FieldContainer/TripleFieldContainer.js +0 -18
- package/dist/cjs/Form/FieldContainer/index.js +0 -19
- package/dist/cjs/Form/FileUpload/index.js +0 -71
- package/dist/cjs/Form/FormButtons/index.js +0 -9
- package/dist/cjs/Form/ReactZodForm/index.js +0 -29
- package/dist/cjs/Form/SelectField/index.js +0 -176
- package/dist/cjs/Form/TextArea/index.js +0 -41
- package/dist/cjs/Form/TextField/index.js +0 -73
- package/dist/cjs/Form/TimePicker/index.js +0 -38
- package/dist/cjs/Form/YesNo/index.js +0 -28
- package/dist/cjs/Form/index.js +0 -29
- package/dist/cjs/HOC/ValidateEmployeeAccess/index.js +0 -17
- package/dist/cjs/Labels/InfoLabel/index.js +0 -9
- package/dist/cjs/Labels/index.js +0 -17
- package/dist/cjs/Layouts/errorLayout/index.js +0 -14
- package/dist/cjs/Layouts/homeLayout/index.js +0 -51
- package/dist/cjs/Layouts/index.js +0 -18
- package/dist/cjs/LineSeparator/LineSeparator.js +0 -8
- package/dist/cjs/LineSeparator/index.js +0 -17
- package/dist/cjs/Modal/Modal.js +0 -36
- package/dist/cjs/Modal/index.js +0 -17
- package/dist/cjs/NavBar/NavBar.js +0 -76
- package/dist/cjs/NavBar/NavBar.types.js +0 -2
- package/dist/cjs/NavBar/NavBar.utils.js +0 -61
- package/dist/cjs/NavBar/index.js +0 -19
- package/dist/cjs/ProgressBar/ProgressBar.js +0 -9
- package/dist/cjs/ProgressBar/ProgressCircle.js +0 -26
- package/dist/cjs/ProgressBar/index.js +0 -18
- package/dist/cjs/SidePanel/index.js +0 -48
- package/dist/cjs/Skeletons/LoadingInputSkeleton.js +0 -12
- package/dist/cjs/Skeletons/index.js +0 -17
- package/dist/cjs/Tab/Tab.js +0 -26
- package/dist/cjs/Tab/index.js +0 -17
- package/dist/cjs/Table/ZauruTable.js +0 -186
- package/dist/cjs/Table/index.js +0 -17
- package/dist/cjs/TaskList/TaskList.js +0 -40
- package/dist/cjs/TaskList/index.js +0 -17
- package/dist/cjs/Titles/LabelArray.js +0 -11
- package/dist/cjs/Titles/TableColumnTitle.js +0 -9
- package/dist/cjs/Titles/TitleH1.js +0 -9
- package/dist/cjs/Titles/TitleH2.js +0 -9
- package/dist/cjs/Titles/TitleH3.js +0 -9
- package/dist/cjs/Titles/index.js +0 -21
- package/dist/cjs/Tooltip/Tooltip.js +0 -18
- package/dist/cjs/Tooltip/index.js +0 -17
- package/dist/cjs/WithTooltip/WithTooltip.js +0 -9
- package/dist/cjs/WithTooltip/index.js +0 -17
- package/dist/cjs/Wizards/StepWizard.js +0 -18
- package/dist/cjs/Wizards/index.js +0 -17
- package/dist/cjs/Zendesk/Chat.js +0 -69
- package/dist/cjs/Zendesk/index.js +0 -18
- package/dist/cjs/Zendesk/zendesk.config.js +0 -29
- package/dist/cjs/index.js +0 -43
- package/dist/cjs/tailwind.config.js +0 -9
- package/tsconfig.cjs.json +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.119](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.117...v1.0.119) (2024-09-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zauru-sdk/components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.118](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.117...v1.0.118) (2024-09-26)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @zauru-sdk/components
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [1.0.117](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.116...v1.0.117) (2024-09-26)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @zauru-sdk/components
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [1.0.116](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.115...v1.0.116) (2024-09-26)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @zauru-sdk/components
|
package/dist/Buttons/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const ValidateEmployeeAccess: ({ children, permissionVariableName, showIfNoPermission, }: {
|
|
2
2
|
children: React.ReactNode;
|
|
3
3
|
permissionVariableName: string;
|
|
4
|
-
showIfNoPermission?: boolean
|
|
4
|
+
showIfNoPermission?: boolean;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Zendesk/Chat.d.ts
CHANGED
|
@@ -160,9 +160,9 @@ export const SelectField = (props) => {
|
|
|
160
160
|
}
|
|
161
161
|
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, ref: selectRef, children: [title && (_jsxs("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium ${color === "red"
|
|
162
162
|
? "text-red-700 dark:text-red-500"
|
|
163
|
-
: "text-gray-700 dark:text-gray-500"}`, children: [title, required && _jsx("span", { className: "text-red-500", children: "*" })] })), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", id: id, value: inputValue, onFocus: () => setIsOpen(true), onKeyDown: handleKeyDown, readOnly: isReadOnly, disabled: disabled, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm`, placeholder: isMulti ? "Select options..." : "Select an option...", autoComplete: "off", onChange: handleInputChange, onBlur: handleBlur, required: required }), _jsx("input", { type: "hidden", ...(register ?? {}), name: name, value: isMulti
|
|
163
|
+
: "text-gray-700 dark:text-gray-500"}`, children: [title, required && _jsx("span", { className: "text-red-500", children: "*" })] })), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", id: id, value: inputValue, onFocus: () => setIsOpen(true), onKeyDown: handleKeyDown, readOnly: isReadOnly, disabled: disabled, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm pr-10`, placeholder: isMulti ? "Select options..." : "Select an option...", autoComplete: "off", onChange: handleInputChange, onBlur: handleBlur, required: required }), _jsx("input", { type: "hidden", ...(register ?? {}), name: name, value: isMulti
|
|
164
164
|
? valueMulti.map((v) => v.value).join(",")
|
|
165
|
-
: value?.value || "" }), isClearable && (value || valueMulti.length > 0) && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 right-0 pr-3 flex items-center", children: "\u00D7" })), isOpen && !isReadOnly && (_jsx("ul", { ref: optionsRef, className: "absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm", children: filteredOptions.map((option, index) => (_jsx("li", { className: `cursor-pointer select-none relative py-2 pl-3 pr-9 ${(isMulti
|
|
165
|
+
: value?.value || "" }), isClearable && (value || valueMulti.length > 0) && (_jsx("button", { type: "button", onClick: handleClear, className: "absolute inset-y-0 right-0 pr-3 flex items-center", children: "\u00D7" })), !isClearable && (value || valueMulti.length > 0) && (_jsx("span", { className: "absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none", children: _jsx("svg", { className: "h-5 w-5 text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }) })), isOpen && !isReadOnly && (_jsx("ul", { ref: optionsRef, className: "absolute z-10 mt-1 w-full bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm", children: filteredOptions.map((option, index) => (_jsx("li", { className: `cursor-pointer select-none relative py-2 pl-3 pr-9 ${(isMulti
|
|
166
166
|
? valueMulti.some((v) => v.value === option.value)
|
|
167
167
|
: value?.value === option.value)
|
|
168
168
|
? "text-white bg-indigo-600"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { isRouteErrorResponse, Links, Meta, Scripts, useRouteError, Link, } from "@remix-run/react";
|
|
3
|
-
export const ErrorLayout = () => {
|
|
3
|
+
export const ErrorLayout = ({ from }) => {
|
|
4
4
|
const error = useRouteError();
|
|
5
|
-
return (_jsxs("html", { lang: "es", className: "bg-gray-900 text-white", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "\u00A1Ups! Algo sali\u00F3 mal" }), _jsx(Meta, {}), _jsx(Links, {})] }), _jsxs("body", { className: "min-h-screen flex flex-col items-center justify-center p-4", children: [_jsx("img", { src: "/logo.png", alt: "Zauru Logo", className: "mb-8 h-20" }), _jsx("h1", { className: "text-5xl font-extrabold text-red-500 mb-6", children: "\u00A1Ups!" }),
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
return (_jsxs("html", { lang: "es", className: "bg-gray-900 text-white", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: "\u00A1Ups! Algo sali\u00F3 mal" }), _jsx(Meta, {}), _jsx(Links, {})] }), _jsxs("body", { className: "min-h-screen flex flex-col items-center justify-center p-4", children: [_jsx("img", { src: "/logo.png", alt: "Zauru Logo", className: "mb-8 h-20" }), _jsx("h1", { className: "text-5xl font-extrabold text-red-500 mb-6", children: "\u00A1Ups!" }), _jsxs("div", { className: "w-full max-w-2xl", children: [_jsx("p", { className: "text-2xl text-gray-300 mb-8 text-center", children: isRouteErrorResponse(error)
|
|
6
|
+
? `Error ${error.status}: ${error.statusText}`
|
|
7
|
+
: error instanceof Error
|
|
8
|
+
? error.message
|
|
9
|
+
: "Ha ocurrido un error inesperado" }), from && (_jsxs("p", { className: "text-lg text-gray-400 mb-4 text-center", children: ["Error lanzado desde: ", from] }))] }), _jsx(Link, { to: "/", className: "bg-blue-600 text-white py-3 px-8 rounded-full text-lg font-semibold hover:bg-blue-700 transition duration-300 transform hover:scale-105", children: "Regresar al inicio" }), _jsx("div", { className: "mt-12 text-gray-500", children: _jsx("p", { children: "Si el problema persiste, por favor contacta a soporte." }) }), _jsx(Scripts, {})] })] }));
|
|
10
10
|
};
|
|
@@ -41,6 +41,6 @@ const SidePanel = ({ children, closeOnClickOutside = true, widthPercentage = 25,
|
|
|
41
41
|
return buttonIcon;
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
return (_jsxs(_Fragment, { children: [
|
|
44
|
+
return (_jsxs(_Fragment, { children: [_jsxs(motion.div, { ref: panelRef, initial: { x: "100%" }, animate: { x: isOpen ? 0 : "100%" }, transition: { type: "spring", stiffness: 300, damping: 30 }, className: `fixed top-0 right-0 h-full bg-white shadow-lg z-[9999] overflow-y-auto`, style: { width: `${widthPercentage}%` }, children: [_jsx("button", { onClick: togglePanel, className: "absolute top-4 left-4 p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition-colors", children: _jsx(ChevronRightIcon, {}) }), _jsx("div", { className: "p-6 mt-16", children: children })] }), _jsx(AnimatePresence, { children: !isOpen && (_jsx(motion.button, { initial: { opacity: 0, x: 20 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: 20 }, transition: { duration: 0.2 }, onClick: togglePanel, className: `fixed top-1/2 right-0 transform -translate-y-1/2 bg-indigo-600 text-white p-3 rounded-l-lg shadow-md hover:bg-indigo-700 transition-colors z-[10000]`, children: renderIcon() })) })] }));
|
|
45
45
|
};
|
|
46
46
|
export default SidePanel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.119",
|
|
4
4
|
"description": "Componentes reutilizables en las WebApps de Zauru.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "npm run build:
|
|
14
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
13
|
+
"build": "npm run build:esm",
|
|
15
14
|
"build:esm": "tsc -p tsconfig.esm.json",
|
|
16
15
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
16
|
},
|
|
@@ -34,11 +33,11 @@
|
|
|
34
33
|
"@hookform/resolvers": "^3.9.0",
|
|
35
34
|
"@reduxjs/toolkit": "^2.2.1",
|
|
36
35
|
"@remix-run/react": "^2.8.1",
|
|
37
|
-
"@zauru-sdk/common": "^1.0.
|
|
38
|
-
"@zauru-sdk/hooks": "^1.0.
|
|
39
|
-
"@zauru-sdk/icons": "^1.0.
|
|
40
|
-
"@zauru-sdk/types": "^1.0.
|
|
41
|
-
"@zauru-sdk/utils": "^1.0.
|
|
36
|
+
"@zauru-sdk/common": "^1.0.119",
|
|
37
|
+
"@zauru-sdk/hooks": "^1.0.119",
|
|
38
|
+
"@zauru-sdk/icons": "^1.0.119",
|
|
39
|
+
"@zauru-sdk/types": "^1.0.119",
|
|
40
|
+
"@zauru-sdk/utils": "^1.0.119",
|
|
42
41
|
"framer-motion": "^11.7.0",
|
|
43
42
|
"jsonwebtoken": "^9.0.2",
|
|
44
43
|
"react": "^18.2.0",
|
|
@@ -50,5 +49,5 @@
|
|
|
50
49
|
"styled-components": "^5.3.5",
|
|
51
50
|
"zod": "^3.23.8"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "61a0842f7e502c72e54defddb197fa69aa58f422"
|
|
54
53
|
}
|
|
@@ -274,7 +274,7 @@ export const SelectField = (props: Props) => {
|
|
|
274
274
|
onKeyDown={handleKeyDown}
|
|
275
275
|
readOnly={isReadOnly}
|
|
276
276
|
disabled={disabled}
|
|
277
|
-
className={`block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm`}
|
|
277
|
+
className={`block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm pr-10`}
|
|
278
278
|
placeholder={isMulti ? "Select options..." : "Select an option..."}
|
|
279
279
|
autoComplete="off"
|
|
280
280
|
onChange={handleInputChange}
|
|
@@ -300,6 +300,24 @@ export const SelectField = (props: Props) => {
|
|
|
300
300
|
×
|
|
301
301
|
</button>
|
|
302
302
|
)}
|
|
303
|
+
{!isClearable && (value || valueMulti.length > 0) && (
|
|
304
|
+
<span className="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
|
|
305
|
+
<svg
|
|
306
|
+
className="h-5 w-5 text-green-500"
|
|
307
|
+
fill="none"
|
|
308
|
+
stroke="currentColor"
|
|
309
|
+
viewBox="0 0 24 24"
|
|
310
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
311
|
+
>
|
|
312
|
+
<path
|
|
313
|
+
strokeLinecap="round"
|
|
314
|
+
strokeLinejoin="round"
|
|
315
|
+
strokeWidth={2}
|
|
316
|
+
d="M5 13l4 4L19 7"
|
|
317
|
+
/>
|
|
318
|
+
</svg>
|
|
319
|
+
</span>
|
|
320
|
+
)}
|
|
303
321
|
{isOpen && !isReadOnly && (
|
|
304
322
|
<ul
|
|
305
323
|
ref={optionsRef}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Link,
|
|
8
8
|
} from "@remix-run/react";
|
|
9
9
|
|
|
10
|
-
export const ErrorLayout = () => {
|
|
10
|
+
export const ErrorLayout = ({ from }: { from?: string }) => {
|
|
11
11
|
const error = useRouteError();
|
|
12
12
|
|
|
13
13
|
return (
|
|
@@ -30,6 +30,11 @@ export const ErrorLayout = () => {
|
|
|
30
30
|
? error.message
|
|
31
31
|
: "Ha ocurrido un error inesperado"}
|
|
32
32
|
</p>
|
|
33
|
+
{from && (
|
|
34
|
+
<p className="text-lg text-gray-400 mb-4 text-center">
|
|
35
|
+
Error lanzado desde: {from}
|
|
36
|
+
</p>
|
|
37
|
+
)}
|
|
33
38
|
</div>
|
|
34
39
|
<Link
|
|
35
40
|
to="/"
|
package/src/SidePanel/index.tsx
CHANGED
|
@@ -116,36 +116,36 @@ const SidePanel: React.FC<SidePanelProps> = ({
|
|
|
116
116
|
|
|
117
117
|
return (
|
|
118
118
|
<>
|
|
119
|
-
<
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
className="fixed top-0 right-0 h-full bg-white shadow-lg z-[9999] overflow-y-auto"
|
|
128
|
-
style={{ width: `${widthPercentage}%` }}
|
|
129
|
-
>
|
|
130
|
-
<button
|
|
131
|
-
onClick={togglePanel}
|
|
132
|
-
className="absolute top-4 left-4 p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition-colors"
|
|
133
|
-
>
|
|
134
|
-
<ChevronRightIcon />
|
|
135
|
-
</button>
|
|
136
|
-
<div className="p-6 mt-16">{children}</div>
|
|
137
|
-
</motion.div>
|
|
138
|
-
)}
|
|
139
|
-
</AnimatePresence>
|
|
140
|
-
|
|
141
|
-
{!isOpen && (
|
|
119
|
+
<motion.div
|
|
120
|
+
ref={panelRef}
|
|
121
|
+
initial={{ x: "100%" }}
|
|
122
|
+
animate={{ x: isOpen ? 0 : "100%" }}
|
|
123
|
+
transition={{ type: "spring", stiffness: 300, damping: 30 }}
|
|
124
|
+
className={`fixed top-0 right-0 h-full bg-white shadow-lg z-[9999] overflow-y-auto`}
|
|
125
|
+
style={{ width: `${widthPercentage}%` }}
|
|
126
|
+
>
|
|
142
127
|
<button
|
|
143
128
|
onClick={togglePanel}
|
|
144
|
-
className="
|
|
129
|
+
className="absolute top-4 left-4 p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition-colors"
|
|
145
130
|
>
|
|
146
|
-
|
|
131
|
+
<ChevronRightIcon />
|
|
147
132
|
</button>
|
|
148
|
-
|
|
133
|
+
<div className="p-6 mt-16">{children}</div>
|
|
134
|
+
</motion.div>
|
|
135
|
+
<AnimatePresence>
|
|
136
|
+
{!isOpen && (
|
|
137
|
+
<motion.button
|
|
138
|
+
initial={{ opacity: 0, x: 20 }}
|
|
139
|
+
animate={{ opacity: 1, x: 0 }}
|
|
140
|
+
exit={{ opacity: 0, x: 20 }}
|
|
141
|
+
transition={{ duration: 0.2 }}
|
|
142
|
+
onClick={togglePanel}
|
|
143
|
+
className={`fixed top-1/2 right-0 transform -translate-y-1/2 bg-indigo-600 text-white p-3 rounded-l-lg shadow-md hover:bg-indigo-700 transition-colors z-[10000]`}
|
|
144
|
+
>
|
|
145
|
+
{renderIcon()}
|
|
146
|
+
</motion.button>
|
|
147
|
+
)}
|
|
148
|
+
</AnimatePresence>
|
|
149
149
|
</>
|
|
150
150
|
);
|
|
151
151
|
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorBoundaryAlert = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const ErrorBoundaryAlert = (props) => {
|
|
6
|
-
const { title, description } = props;
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "rounded-full top-20 mx-auto p-3", children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-red-900 bg-red-100 border border-red-200 rounded-md", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between flex-wrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-0 flex-1 flex", children: [(0, jsx_runtime_1.jsx)("div", { className: "mr-3 pt-1", children: (0, jsx_runtime_1.jsx)("svg", { width: "26", height: "26", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { d: "M13.6086 3.247l8.1916 15.8c.0999.2.1998.5.1998.8 0 1-.7992 1.8-1.7982 1.8H3.7188c-.2997 0-.4995-.1-.7992-.2-.7992-.5-1.1988-1.5-.6993-2.4 5.3067-10.1184 8.0706-15.385 8.2915-15.8.3314-.6222.8681-.8886 1.4817-.897.6135-.008 1.273.2807 1.6151.897zM12 18.95c.718 0 1.3-.582 1.3-1.3 0-.718-.582-1.3-1.3-1.3-.718 0-1.3.582-1.3 1.3 0 .718.582 1.3 1.3 1.3zm-.8895-10.203v5.4c0 .5.4.9.9.9s.9-.4.9-.9v-5.3c0-.5-.4-.9-.9-.9s-.9.4-.9.8z" }) }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-md leading-6 font-medium", children: title?.toString() }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: description?.toString() })] })] }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "rounded-md focus:outline-none focus:ring-2 focus:ring-red-500", children: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { d: "M17.6555 6.3331a.9.9 0 0 1 .001 1.2728l-4.1032 4.1085a.4.4 0 0 0 0 .5653l4.1031 4.1088a.9002.9002 0 0 1 .0797 1.1807l-.0806.092a.9.9 0 0 1-1.2728-.0009l-4.1006-4.1068a.4.4 0 0 0-.5662 0l-4.099 4.1068a.9.9 0 1 1-1.2738-1.2718l4.1027-4.1089a.4.4 0 0 0 0-.5652L6.343 7.6059a.9002.9002 0 0 1-.0796-1.1807l.0806-.092a.9.9 0 0 1 1.2728.0009l4.099 4.1055a.4.4 0 0 0 .5662 0l4.1006-4.1055a.9.9 0 0 1 1.2728-.001z" }) }) }) })] }) }) }));
|
|
8
|
-
};
|
|
9
|
-
exports.ErrorBoundaryAlert = ErrorBoundaryAlert;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StaticAlert = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const getConfig = (type) => {
|
|
6
|
-
switch (type) {
|
|
7
|
-
case "info":
|
|
8
|
-
return {
|
|
9
|
-
containerClassName: "text-blue-900 bg-blue-100 border border-blue-200 rounded-md",
|
|
10
|
-
buttonClassName: "rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
11
|
-
path: ((0, jsx_runtime_1.jsx)("path", { d: "M14.1667 17h-3.3334c-.5 0-.8333-.3146-.8333-.7865 0-.472.3333-.7865.8333-.7865H11.5c.0833 0 .1667-.0787.1667-.1573v-3.5394c0-.0786-.0834-.1573-.1667-.1573h-.6667c-.5 0-.8333-.3146-.8333-.7865S10.3333 10 10.8333 10h.8334c.9166 0 1.6666.7079 1.6666 1.573v3.7753c0 .0787.0834.1573.1667.1573h.6667c.5 0 .8333.3146.8333.7865 0 .472-.3333.7079-.8333.7079zM12.3 6c.6933 0 1.3.6067 1.3 1.3s-.52 1.3-1.3 1.3S11 7.9933 11 7.3 11.6067 6 12.3 6zM12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2" })),
|
|
12
|
-
};
|
|
13
|
-
case "success":
|
|
14
|
-
return {
|
|
15
|
-
containerClassName: "text-green-900 bg-green-100 border border-green-200 rounded-md",
|
|
16
|
-
buttonClassName: "rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",
|
|
17
|
-
path: ((0, jsx_runtime_1.jsx)("path", { d: "M8.445 12.6675A.9.9 0 0 0 7.1424 13.91l2.5726 2.7448c.3679.3856.9884.3689 1.335-.036l5.591-7.0366a.9.9 0 0 0-1.3674-1.1705l-4.6548 5.9132a.4.4 0 0 1-.607.0252l-1.567-1.6826zM1.9995 12c0-5.5 4.5-10 10-10s10 4.5 10 10-4.5 10-10 10-10-4.5-10-10z" })),
|
|
18
|
-
};
|
|
19
|
-
default:
|
|
20
|
-
return {
|
|
21
|
-
containerClassName: "text-blue-900 bg-blue-100 border border-blue-200 rounded-md",
|
|
22
|
-
buttonClassName: "rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
23
|
-
path: ((0, jsx_runtime_1.jsx)("path", { d: "M14.1667 17h-3.3334c-.5 0-.8333-.3146-.8333-.7865 0-.472.3333-.7865.8333-.7865H11.5c.0833 0 .1667-.0787.1667-.1573v-3.5394c0-.0786-.0834-.1573-.1667-.1573h-.6667c-.5 0-.8333-.3146-.8333-.7865S10.3333 10 10.8333 10h.8334c.9166 0 1.6666.7079 1.6666 1.573v3.7753c0 .0787.0834.1573.1667.1573h.6667c.5 0 .8333.3146.8333.7865 0 .472-.3333.7079-.8333.7079zM12.3 6c.6933 0 1.3.6067 1.3 1.3s-.52 1.3-1.3 1.3S11 7.9933 11 7.3 11.6067 6 12.3 6zM12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2" })),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const StaticAlert = (props) => {
|
|
28
|
-
const { className, title, description, onClose, type = "info", loading = false, } = props;
|
|
29
|
-
const config = getConfig(type);
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: `${className} ${config.containerClassName} ${loading ? " hidden" : ""}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between flex-wrap", children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-0 flex-1 flex", children: [(0, jsx_runtime_1.jsx)("div", { className: "mr-3 pt-1", children: (0, jsx_runtime_1.jsx)("svg", { width: "26", height: "26", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: config.path }) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h4", { className: "text-md leading-6 font-medium", children: title }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm", children: description })] })] }), onClose && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: `${config.buttonClassName}`, onClick: onClose, children: (0, jsx_runtime_1.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { d: "M17.6555 6.3331a.9.9 0 0 1 .001 1.2728l-4.1032 4.1085a.4.4 0 0 0 0 .5653l4.1031 4.1088a.9002.9002 0 0 1 .0797 1.1807l-.0806.092a.9.9 0 0 1-1.2728-.0009l-4.1006-4.1068a.4.4 0 0 0-.5662 0l-4.099 4.1068a.9.9 0 1 1-1.2738-1.2718l4.1027-4.1089a.4.4 0 0 0 0-.5652L6.343 7.6059a.9002.9002 0 0 1-.0796-1.1807l.0806-.092a.9.9 0 0 1 1.2728.0009l4.099 4.1055a.4.4 0 0 0 .5662 0l4.1006-4.1055a.9.9 0 0 1 1.2728-.001z" }) }) }) }))] }) }));
|
|
31
|
-
};
|
|
32
|
-
exports.StaticAlert = StaticAlert;
|
package/dist/cjs/Alerts/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ErrorBoundaryAlert/ErrorBoundaryAlert.js"), exports);
|
|
18
|
-
__exportStar(require("./StaticAlert.js"), exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlockUI = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const BlockUI = (props) => {
|
|
6
|
-
const { children, active, loadingText } = props;
|
|
7
|
-
if (!active) {
|
|
8
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
9
|
-
}
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { className: "relative", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute bg-gray-100 bg-opacity-20 z-10 h-full w-full flex items-center justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-3xl mr-4", children: loadingText }), (0, jsx_runtime_1.jsxs)("svg", { className: "animate-spin h-5 w-5 text-gray-600", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [(0, jsx_runtime_1.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), (0, jsx_runtime_1.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] })] }) }), children] }) }));
|
|
11
|
-
};
|
|
12
|
-
exports.BlockUI = BlockUI;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BlockUI.js"), exports);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Button = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
-
const Button = (props) => {
|
|
7
|
-
const { type = "submit", loading = false, loadingText = "Guardando...", title = "Guardar", name = "save", onClickSave, selectedColor = "indigo", children, className = "", disabled = false, enableFormErrorsValidation = false, enableFormErrorsDescriptions = false, } = props;
|
|
8
|
-
const formContext = (0, react_hook_form_1.useFormContext)();
|
|
9
|
-
const formHasErrors = formContext ? !formContext.formState.isValid : false;
|
|
10
|
-
const formErrors = formContext ? formContext.formState.errors : {};
|
|
11
|
-
const COLORS = {
|
|
12
|
-
green: {
|
|
13
|
-
bg900: "bg-green-900",
|
|
14
|
-
bg700: "bg-green-700",
|
|
15
|
-
bg600: "bg-green-600",
|
|
16
|
-
bg500: "bg-green-500",
|
|
17
|
-
ring600: "ring-green-600",
|
|
18
|
-
ring500: "ring-green-500",
|
|
19
|
-
},
|
|
20
|
-
indigo: {
|
|
21
|
-
bg900: "bg-indigo-900",
|
|
22
|
-
bg700: "bg-indigo-700",
|
|
23
|
-
bg600: "bg-indigo-600",
|
|
24
|
-
bg500: "bg-indigo-500",
|
|
25
|
-
ring600: "ring-indigo-600",
|
|
26
|
-
ring500: "ring-indigo-500",
|
|
27
|
-
},
|
|
28
|
-
red: {
|
|
29
|
-
bg900: "bg-red-900",
|
|
30
|
-
bg700: "bg-red-700",
|
|
31
|
-
bg600: "bg-red-600",
|
|
32
|
-
bg500: "bg-red-500",
|
|
33
|
-
ring600: "ring-red-600",
|
|
34
|
-
ring500: "ring-red-500",
|
|
35
|
-
},
|
|
36
|
-
yellow: {
|
|
37
|
-
bg900: "bg-yellow-900",
|
|
38
|
-
bg700: "bg-yellow-700",
|
|
39
|
-
bg600: "bg-yellow-600",
|
|
40
|
-
bg500: "bg-yellow-500",
|
|
41
|
-
ring600: "ring-yellow-600",
|
|
42
|
-
ring500: "ring-yellow-500",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const color = COLORS[selectedColor];
|
|
46
|
-
const inside = children ?? title;
|
|
47
|
-
const errorMessage = formHasErrors
|
|
48
|
-
? Object.values(formErrors)
|
|
49
|
-
.map((error) => error?.message?.toString())
|
|
50
|
-
.join(", ")
|
|
51
|
-
: "";
|
|
52
|
-
const buttonContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", { type: "hidden", name: "action", value: name }), (0, jsx_runtime_1.jsx)("button", { type: type, disabled: loading || disabled || (enableFormErrorsValidation && formHasErrors), onClick: onClickSave, className: `ml-2 ${loading || disabled || (enableFormErrorsValidation && formHasErrors)
|
|
53
|
-
? " bg-opacity-25 "
|
|
54
|
-
: ""} ${loading
|
|
55
|
-
? " cursor-progress"
|
|
56
|
-
: `${disabled || (enableFormErrorsValidation && formHasErrors)
|
|
57
|
-
? ""
|
|
58
|
-
: `hover:${color.bg700}`}`} inline-flex justify-center rounded-md border border-transparent ${color.bg600} py-2 px-4 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:${color.ring500} focus:ring-offset-2 ${className}`, children: loading ? loadingText : inside })] }));
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(enableFormErrorsValidation && formHasErrors && errorMessage) ||
|
|
60
|
-
(enableFormErrorsDescriptions && errorMessage) ? ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-end mb-2", children: (0, jsx_runtime_1.jsx)("div", { className: "p-2 bg-red-100 border border-red-400 text-red-700 rounded-md shadow-sm", children: (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: errorMessage }) }) })) : null, buttonContent] }));
|
|
61
|
-
};
|
|
62
|
-
exports.Button = Button;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Button.js"), exports);
|
package/dist/cjs/Card/Card.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Card = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const Card = (props) => {
|
|
6
|
-
const { children, title, className } = props;
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: `p-4 space-y-3 shadow sm:overflow-hidden sm:rounded-md ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { className: "inline text-lg font-medium text-gray-700", children: `${title.toUpperCase()}` })), children] }));
|
|
8
|
-
};
|
|
9
|
-
exports.Card = Card;
|
package/dist/cjs/Card/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Card.js"), exports);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChatLayout = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const index_js_1 = require("../Form/TextField/index.js");
|
|
7
|
-
const react_2 = require("@remix-run/react");
|
|
8
|
-
const LoadingInputSkeleton_js_1 = require("../Skeletons/LoadingInputSkeleton.js");
|
|
9
|
-
const icons_1 = require("@zauru-sdk/icons");
|
|
10
|
-
const ChatLayout = ({ children, sendingMessage = false, formConfig = undefined, }) => {
|
|
11
|
-
const refAttachment = (0, react_1.useRef)(null);
|
|
12
|
-
const [formValues, setFormValues] = (0, react_1.useState)({ image: null });
|
|
13
|
-
const handleAttachmentClick = () => {
|
|
14
|
-
if (refAttachment.current) {
|
|
15
|
-
refAttachment.current.click();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col h-full", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-col-reverse overflow-y-auto p-4 bg-gray-100 border border-gray-200 rounded-lg grow max-h-[65vh]", children: children }), (0, jsx_runtime_1.jsxs)(react_2.Form, { id: "formRef", encType: "multipart/form-data", method: "post", children: [formConfig ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_1.TextField, { hidden: true, name: "reference", defaultValue: formConfig.reference ?? "" }), (0, jsx_runtime_1.jsx)(index_js_1.TextField, { hidden: true, name: "form_id", defaultValue: formConfig.form_id }), (0, jsx_runtime_1.jsx)(index_js_1.TextField, { hidden: true, name: "document_id", defaultValue: formConfig.document_id }), (0, jsx_runtime_1.jsx)(index_js_1.TextField, { hidden: true, name: "document_type", defaultValue: formConfig.document_type }), (0, jsx_runtime_1.jsx)(index_js_1.TextField, { hidden: true, name: "id_number", defaultValue: formConfig?.id_number ?? "" })] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})), (0, jsx_runtime_1.jsxs)("div", { className: "mt-4 flex", children: [sendingMessage ? ((0, jsx_runtime_1.jsx)(LoadingInputSkeleton_js_1.LoadingInputSkeleton, {})) : ((0, jsx_runtime_1.jsx)("input", { name: `message${formConfig?.messageFieldId
|
|
19
|
-
? `_${formConfig?.messageFieldId}`
|
|
20
|
-
: ""}`, type: "text", placeholder: "Escribe un mensaje...", className: "form-input px-4 py-2 border border-gray-300 rounded-l-lg grow" })), (0, jsx_runtime_1.jsx)("button", { onClick: handleAttachmentClick, className: `${formValues?.image ? "bg-blue-500" : ""} hover:bg-blue-700 text-white font-bold py-2 px-4`, type: "button", children: (0, jsx_runtime_1.jsx)(icons_1.AttachmentIconSVG, {}) }), (0, jsx_runtime_1.jsx)("button", { className: "bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-r-lg", type: "submit", name: "action", value: "sendMessage", children: sendingMessage ? (0, jsx_runtime_1.jsx)(icons_1.SpinnerSvg, {}) : (0, jsx_runtime_1.jsx)(icons_1.SendMessageIcon, {}) })] }), (0, jsx_runtime_1.jsx)("input", { ref: refAttachment, hidden: true, name: `attachment${formConfig?.attachmentFieldId
|
|
21
|
-
? `_${formConfig?.attachmentFieldId}`
|
|
22
|
-
: ""}`, type: "file", accept: ".jpg, .png, .jpeg, .png", onChange: (e) => {
|
|
23
|
-
if (e.target.value && e.target.value !== "") {
|
|
24
|
-
setFormValues({ ...formValues, image: e.target.value });
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
setFormValues({ ...formValues, image: null });
|
|
28
|
-
}
|
|
29
|
-
} })] })] }));
|
|
30
|
-
};
|
|
31
|
-
exports.ChatLayout = ChatLayout;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChatMessageHistory = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const icons_1 = require("@zauru-sdk/icons");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const ChatMessageHistory = (props) => {
|
|
8
|
-
const { author, content, onLike, onUpdateComment, id, commentOwner = false, date, imageLink, } = props;
|
|
9
|
-
const initials = author ? author[0].toUpperCase() : "A";
|
|
10
|
-
const [isUpdating, setIsUpdating] = (0, react_1.useState)(false);
|
|
11
|
-
const [updatedContent, setUpdatedContent] = (0, react_1.useState)(content);
|
|
12
|
-
const textAreaRef = (0, react_1.useRef)(null);
|
|
13
|
-
const [shouldPulse, setShouldPulse] = (0, react_1.useState)(false);
|
|
14
|
-
(0, react_1.useEffect)(() => {
|
|
15
|
-
if (isUpdating && textAreaRef.current) {
|
|
16
|
-
textAreaRef.current.style.height = "auto";
|
|
17
|
-
textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;
|
|
18
|
-
textAreaRef.current.focus();
|
|
19
|
-
}
|
|
20
|
-
}, [isUpdating]);
|
|
21
|
-
// Efecto secundario que se ejecuta cada vez que 'isUpdating' cambia
|
|
22
|
-
(0, react_1.useEffect)(() => {
|
|
23
|
-
// Activar la animación
|
|
24
|
-
setShouldPulse(true);
|
|
25
|
-
// Establecer un temporizador para eliminar la clase después de que la animación se haya completado
|
|
26
|
-
const timer = setTimeout(() => {
|
|
27
|
-
setShouldPulse(false);
|
|
28
|
-
}, 15000); // Tiempo total de la animación
|
|
29
|
-
// Limpiar el temporizador si el componente se desmonta o si 'isUpdating' cambia de nuevo antes de que la animación se complete
|
|
30
|
-
return () => clearTimeout(timer);
|
|
31
|
-
}, [isUpdating]);
|
|
32
|
-
const handleUpdate = (e) => {
|
|
33
|
-
if (e.target.value.length <= 254) {
|
|
34
|
-
setUpdatedContent(e.target.value);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const handleUpdateClick = () => {
|
|
38
|
-
if (isUpdating) {
|
|
39
|
-
if (textAreaRef.current) {
|
|
40
|
-
textAreaRef.current.blur();
|
|
41
|
-
}
|
|
42
|
-
//onUpdateComment && onUpdateComment(updatedContent, itsNew);
|
|
43
|
-
}
|
|
44
|
-
setIsUpdating(!isUpdating);
|
|
45
|
-
};
|
|
46
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "p-1 rounded-xl flex items-center space-x-4 relative", children: [commentOwner && ((0, jsx_runtime_1.jsx)("div", { className: "absolute top-2 right-2", children: (0, jsx_runtime_1.jsx)("button", { onClick: handleUpdateClick, className: `${shouldPulse ? "animate-custom-pulse" : ""}`, children: isUpdating ? (0, jsx_runtime_1.jsx)(icons_1.CheckIconSVG, {}) : (0, jsx_runtime_1.jsx)(icons_1.PencilSvg, {}) }) })), (0, jsx_runtime_1.jsx)("div", { className: `w-[0%] lg:w-[8%] h-16 bg-purple-300 rounded-full flex items-center justify-center overflow-hidden text-white text-xl font-bold`, children: initials }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col justify-between h-full w-[92%]", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-row space-x-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xl font-medium text-black", children: author }), (0, jsx_runtime_1.jsx)("div", { className: "text-xl font-medium text-gray-500", children: date && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [" - ", date] }) })] }), isUpdating ? ((0, jsx_runtime_1.jsx)("textarea", { ref: textAreaRef, className: "bg-gray-100 rounded p-2 w-full resize-none", value: updatedContent, onChange: handleUpdate, maxLength: 254, placeholder: "Deja tus buenos deseos..." })) : ((0, jsx_runtime_1.jsx)("p", { className: "text-gray-500", children: updatedContent }))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex justify-end items-center", children: (0, jsx_runtime_1.jsx)("button", { onClick: () => { }, children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}) }) })] }), imageLink && ((0, jsx_runtime_1.jsx)("div", { className: `w-[25%] flex items-center justify-center overflow-hidden text-white text-xl font-bold`, children: (0, jsx_runtime_1.jsx)("div", { onClick: () => {
|
|
47
|
-
return window.open(imageLink, "_blank");
|
|
48
|
-
}, children: (0, jsx_runtime_1.jsx)("img", { src: imageLink, alt: "IMG_CHAT", className: `h-48 w-48 inline mr-1 pb-1`, style: {
|
|
49
|
-
stroke: "currentColor",
|
|
50
|
-
strokeWidth: 2,
|
|
51
|
-
strokeLinecap: "round",
|
|
52
|
-
strokeLinejoin: "round",
|
|
53
|
-
fill: "none",
|
|
54
|
-
backgroundColor: "transparent",
|
|
55
|
-
} }) }) }))] }));
|
|
56
|
-
};
|
|
57
|
-
exports.ChatMessageHistory = ChatMessageHistory;
|
package/dist/cjs/Chat/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ChatLayout.js"), exports);
|
|
18
|
-
__exportStar(require("./ChatMessageHistory.js"), exports);
|