@zauru-sdk/components 1.0.54 → 1.0.61

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/LICENCE.md +11 -11
  3. package/package.json +7 -7
  4. package/src/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.tsx +66 -66
  5. package/src/Alerts/StaticAlert.tsx +121 -121
  6. package/src/Alerts/index.ts +2 -2
  7. package/src/BlockUI/BlockUI.tsx +50 -50
  8. package/src/BlockUI/index.tsx +1 -1
  9. package/src/Buttons/Button.tsx +90 -90
  10. package/src/Buttons/index.ts +1 -1
  11. package/src/Card/Card.tsx +24 -24
  12. package/src/Card/index.ts +1 -1
  13. package/src/Chat/ChatLayout.tsx +131 -131
  14. package/src/Chat/ChatMessageHistory.tsx +142 -142
  15. package/src/Chat/index.ts +2 -2
  16. package/src/ConnectionState/ConnectionState.tsx +27 -27
  17. package/src/ConnectionState/index.tsx +1 -1
  18. package/src/Containers/BodyContainer.tsx +14 -14
  19. package/src/Containers/ButtonSectionContainer.tsx +21 -21
  20. package/src/Containers/Container.tsx +39 -39
  21. package/src/Containers/DoubleContainer.tsx +48 -48
  22. package/src/Containers/MainContainer.tsx +17 -17
  23. package/src/Containers/OutletContainer.tsx +14 -14
  24. package/src/Containers/SubContainer.tsx +37 -37
  25. package/src/Containers/index.ts +7 -7
  26. package/src/DynamicTable/BasicPrintDynamicTable.tsx +73 -73
  27. package/src/DynamicTable/DynamicPrintTable.tsx +288 -288
  28. package/src/DynamicTable/DynamicTable.tsx +405 -405
  29. package/src/DynamicTable/GenericDynamicTable.tsx +456 -456
  30. package/src/DynamicTable/index.tsx +4 -4
  31. package/src/Footer/Footer.tsx +50 -50
  32. package/src/Footer/index.tsx +1 -1
  33. package/src/Form/Checkbox/index.tsx +96 -96
  34. package/src/Form/Checklist/index.tsx +35 -35
  35. package/src/Form/DatePicker/index.tsx +132 -132
  36. package/src/Form/DynamicBaculoForm/index.tsx +361 -361
  37. package/src/Form/FieldContainer/DoubleFieldContainer.tsx +35 -35
  38. package/src/Form/FieldContainer/QuadrupleFieldContainer.tsx +36 -36
  39. package/src/Form/FieldContainer/TripleFieldContainer.tsx +35 -35
  40. package/src/Form/FieldContainer/index.ts +3 -3
  41. package/src/Form/FileUpload/index.tsx +184 -184
  42. package/src/Form/FormButtons/index.tsx +78 -78
  43. package/src/Form/FormLayout/index.tsx +37 -37
  44. package/src/Form/SelectField/index.tsx +237 -237
  45. package/src/Form/TextArea/index.tsx +125 -125
  46. package/src/Form/TextField/index.tsx +194 -194
  47. package/src/Form/TimePicker/index.tsx +127 -127
  48. package/src/Form/YesNo/index.tsx +77 -77
  49. package/src/Form/index.ts +13 -13
  50. package/src/Labels/InfoLabel/index.tsx +21 -21
  51. package/src/Labels/index.tsx +1 -1
  52. package/src/Layouts/homeLayout/index.tsx +34 -34
  53. package/src/Layouts/index.ts +1 -1
  54. package/src/LineSeparator/LineSeparator.tsx +3 -3
  55. package/src/LineSeparator/index.tsx +1 -1
  56. package/src/Modal/Modal.tsx +104 -104
  57. package/src/Modal/index.tsx +1 -1
  58. package/src/NavBar/NavBar.tsx +223 -223
  59. package/src/NavBar/NavBar.types.ts +64 -64
  60. package/src/NavBar/NavBar.utils.ts +58 -58
  61. package/src/NavBar/index.tsx +5 -5
  62. package/src/ProgressBar/ProgressBar.tsx +25 -25
  63. package/src/ProgressBar/ProgressCircle.tsx +75 -75
  64. package/src/ProgressBar/index.tsx +2 -2
  65. package/src/Skeletons/LoadingInputSkeleton.tsx +12 -12
  66. package/src/Skeletons/index.ts +1 -1
  67. package/src/Tab/Tab.tsx +63 -63
  68. package/src/Tab/index.ts +1 -1
  69. package/src/Table/ZauruTable.tsx +265 -265
  70. package/src/Table/index.tsx +1 -1
  71. package/src/TaskList/TaskList.tsx +88 -88
  72. package/src/TaskList/index.ts +1 -1
  73. package/src/Titles/LabelArray.tsx +17 -17
  74. package/src/Titles/TableColumnTitle.tsx +9 -9
  75. package/src/Titles/TitleH1.tsx +10 -10
  76. package/src/Titles/TitleH2.tsx +10 -10
  77. package/src/Titles/TitleH3.tsx +10 -10
  78. package/src/Titles/index.ts +5 -5
  79. package/src/Tooltip/Tooltip.tsx +42 -42
  80. package/src/Tooltip/index.ts +1 -1
  81. package/src/WithTooltip/WithTooltip.tsx +21 -21
  82. package/src/WithTooltip/index.tsx +1 -1
  83. package/src/Wizards/StepWizard.tsx +88 -88
  84. package/src/Wizards/index.ts +1 -1
  85. package/src/Zendesk/Chat.tsx +83 -83
  86. package/src/Zendesk/index.ts +2 -2
  87. package/src/Zendesk/zendesk.config.ts +40 -40
  88. package/src/index.ts +24 -24
  89. package/src/postcss.config.mjs +5 -5
  90. package/src/tailwind.config.ts +10 -10
  91. package/src/tailwind.css +3 -3
  92. package/tsconfig.cjs.json +8 -8
  93. package/tsconfig.esm.json +11 -11
  94. package/tsconfig.json +17 -17
@@ -1,83 +1,83 @@
1
- import { useEffect } from "react";
2
-
3
- const canUseDOM = (): boolean => {
4
- if (
5
- typeof window === "undefined" ||
6
- !window.document ||
7
- !window.document.createElement
8
- ) {
9
- return false;
10
- }
11
- return true;
12
- };
13
-
14
- export const logoutFromZendesk = () => {
15
- if (canUseDOM() && (window as any).zE) {
16
- (window as any).zE("messenger", "logoutUser");
17
- } else {
18
- console.warn("Zendesk is not initialized yet");
19
- }
20
- };
21
-
22
- export const ZendeskAPI = (...args: any[]) => {
23
- if (canUseDOM() && (window as any).zE) {
24
- (window as any).zE.apply(null, args);
25
- } else {
26
- console.warn("Zendesk is not initialized yet");
27
- }
28
- };
29
-
30
- interface ZendeskProps {
31
- defer?: boolean;
32
- onLoaded?: () => void;
33
- token: string;
34
- configuration: {
35
- zendeskChatKey: string;
36
- };
37
- [key: string]: any; // Para propiedades adicionales que se pasen y se asignen a window.zESettings
38
- }
39
-
40
- export const Zendesk: React.FC<ZendeskProps> = (props: ZendeskProps) => {
41
- const { defer, configuration, token, ...other } = props;
42
-
43
- useEffect(() => {
44
- const insertScript = () => {
45
- const zendeskScript = document.createElement("script");
46
- if (defer) {
47
- zendeskScript.defer = true;
48
- } else {
49
- zendeskScript.async = true;
50
- }
51
- zendeskScript.id = "ze-snippet";
52
- zendeskScript.src = `https://static.zdassets.com/ekr/snippet.js?key=${configuration.zendeskChatKey}`;
53
- zendeskScript.addEventListener("load", () => {
54
- if (props.onLoaded) {
55
- props.onLoaded();
56
- }
57
-
58
- (window as any).zE("messenger", "loginUser", function (callback: any) {
59
- callback(token);
60
- });
61
- });
62
- document.body.appendChild(zendeskScript);
63
-
64
- return zendeskScript; // Devolvemos la referencia del script
65
- };
66
-
67
- let script: HTMLScriptElement | undefined; // Guardamos la referencia del script aquí
68
-
69
- if (canUseDOM() && !(window as any).zE) {
70
- script = insertScript();
71
- (window as any).zESettings = other;
72
- }
73
-
74
- return () => {
75
- if (script) {
76
- // Si el script existe, lo eliminamos del DOM
77
- script.remove();
78
- }
79
- };
80
- }, [props, defer, other, configuration, token]);
81
-
82
- return null;
83
- };
1
+ import { useEffect } from "react";
2
+
3
+ const canUseDOM = (): boolean => {
4
+ if (
5
+ typeof window === "undefined" ||
6
+ !window.document ||
7
+ !window.document.createElement
8
+ ) {
9
+ return false;
10
+ }
11
+ return true;
12
+ };
13
+
14
+ export const logoutFromZendesk = () => {
15
+ if (canUseDOM() && (window as any).zE) {
16
+ (window as any).zE("messenger", "logoutUser");
17
+ } else {
18
+ console.warn("Zendesk is not initialized yet");
19
+ }
20
+ };
21
+
22
+ export const ZendeskAPI = (...args: any[]) => {
23
+ if (canUseDOM() && (window as any).zE) {
24
+ (window as any).zE.apply(null, args);
25
+ } else {
26
+ console.warn("Zendesk is not initialized yet");
27
+ }
28
+ };
29
+
30
+ interface ZendeskProps {
31
+ defer?: boolean;
32
+ onLoaded?: () => void;
33
+ token: string;
34
+ configuration: {
35
+ zendeskChatKey: string;
36
+ };
37
+ [key: string]: any; // Para propiedades adicionales que se pasen y se asignen a window.zESettings
38
+ }
39
+
40
+ export const Zendesk: React.FC<ZendeskProps> = (props: ZendeskProps) => {
41
+ const { defer, configuration, token, ...other } = props;
42
+
43
+ useEffect(() => {
44
+ const insertScript = () => {
45
+ const zendeskScript = document.createElement("script");
46
+ if (defer) {
47
+ zendeskScript.defer = true;
48
+ } else {
49
+ zendeskScript.async = true;
50
+ }
51
+ zendeskScript.id = "ze-snippet";
52
+ zendeskScript.src = `https://static.zdassets.com/ekr/snippet.js?key=${configuration.zendeskChatKey}`;
53
+ zendeskScript.addEventListener("load", () => {
54
+ if (props.onLoaded) {
55
+ props.onLoaded();
56
+ }
57
+
58
+ (window as any).zE("messenger", "loginUser", function (callback: any) {
59
+ callback(token);
60
+ });
61
+ });
62
+ document.body.appendChild(zendeskScript);
63
+
64
+ return zendeskScript; // Devolvemos la referencia del script
65
+ };
66
+
67
+ let script: HTMLScriptElement | undefined; // Guardamos la referencia del script aquí
68
+
69
+ if (canUseDOM() && !(window as any).zE) {
70
+ script = insertScript();
71
+ (window as any).zESettings = other;
72
+ }
73
+
74
+ return () => {
75
+ if (script) {
76
+ // Si el script existe, lo eliminamos del DOM
77
+ script.remove();
78
+ }
79
+ };
80
+ }, [props, defer, other, configuration, token]);
81
+
82
+ return null;
83
+ };
@@ -1,2 +1,2 @@
1
- export * from "./Chat.js";
2
- export * from "./zendesk.config.js";
1
+ export * from "./Chat.js";
2
+ export * from "./zendesk.config.js";
@@ -1,40 +1,40 @@
1
- import jwt from "jsonwebtoken";
2
-
3
- export function zendeskJwt(
4
- current_user: {
5
- selected_entity_id: number;
6
- id: number;
7
- email: string;
8
- name: string;
9
- },
10
- configuration: {
11
- zendeskJWTSecret: string;
12
- zendeskJWTKey: string;
13
- }
14
- ) {
15
- // get the INFO
16
- const jwtSecret = configuration.zendeskJWTSecret;
17
- const jwtKey = configuration.zendeskJWTKey;
18
- const expiresIn = Math.floor(Date.now() / 1000) + 60 * 60 * 24; // Expires in 1 day
19
-
20
- // create the payload
21
- const payload = {
22
- external_id:
23
- "z" +
24
- current_user.selected_entity_id.toString() +
25
- "-" +
26
- current_user.id.toString(),
27
- email: current_user.email,
28
- name: current_user.name,
29
- organization_id: current_user.selected_entity_id.toString(),
30
- scope: "user",
31
- exp: expiresIn,
32
- };
33
-
34
- const jwtHeader: jwt.JwtHeader = { kid: jwtKey, typ: "JWT", alg: "HS256" };
35
-
36
- return jwt.sign(payload, jwtSecret, {
37
- algorithm: "HS256",
38
- header: jwtHeader,
39
- });
40
- }
1
+ import jwt from "jsonwebtoken";
2
+
3
+ export function zendeskJwt(
4
+ current_user: {
5
+ selected_entity_id: number;
6
+ id: number;
7
+ email: string;
8
+ name: string;
9
+ },
10
+ configuration: {
11
+ zendeskJWTSecret: string;
12
+ zendeskJWTKey: string;
13
+ }
14
+ ) {
15
+ // get the INFO
16
+ const jwtSecret = configuration.zendeskJWTSecret;
17
+ const jwtKey = configuration.zendeskJWTKey;
18
+ const expiresIn = Math.floor(Date.now() / 1000) + 60 * 60 * 24; // Expires in 1 day
19
+
20
+ // create the payload
21
+ const payload = {
22
+ external_id:
23
+ "z" +
24
+ current_user.selected_entity_id.toString() +
25
+ "-" +
26
+ current_user.id.toString(),
27
+ email: current_user.email,
28
+ name: current_user.name,
29
+ organization_id: current_user.selected_entity_id.toString(),
30
+ scope: "user",
31
+ exp: expiresIn,
32
+ };
33
+
34
+ const jwtHeader: jwt.JwtHeader = { kid: jwtKey, typ: "JWT", alg: "HS256" };
35
+
36
+ return jwt.sign(payload, jwtSecret, {
37
+ algorithm: "HS256",
38
+ header: jwtHeader,
39
+ });
40
+ }
package/src/index.ts CHANGED
@@ -1,24 +1,24 @@
1
- export * from "./Alerts/index.js";
2
- export * from "./BlockUI/index.js";
3
- export * from "./Buttons/index.js";
4
- export * from "./Card/index.js";
5
- export * from "./ConnectionState/index.js";
6
- export * from "./Chat/index.js";
7
- export * from "./Containers/index.js";
8
- export * from "./DynamicTable/index.js";
9
- export * from "./Footer/index.js";
10
- export * from "./Form/index.js";
11
- export * from "./Labels/index.js";
12
- export * from "./Layouts/index.js";
13
- export * from "./LineSeparator/index.js";
14
- export * from "./Modal/index.js";
15
- export * from "./NavBar/index.js";
16
- export * from "./Skeletons/index.js";
17
- export * from "./Tab/index.js";
18
- export * from "./Table/index.js";
19
- export * from "./TaskList/index.js";
20
- export * from "./Titles/index.js";
21
- export * from "./Tooltip/index.js";
22
- export * from "./WithTooltip/index.js";
23
- export * from "./Wizards/index.js";
24
- export * from "./Zendesk/index.js";
1
+ export * from "./Alerts/index.js";
2
+ export * from "./BlockUI/index.js";
3
+ export * from "./Buttons/index.js";
4
+ export * from "./Card/index.js";
5
+ export * from "./ConnectionState/index.js";
6
+ export * from "./Chat/index.js";
7
+ export * from "./Containers/index.js";
8
+ export * from "./DynamicTable/index.js";
9
+ export * from "./Footer/index.js";
10
+ export * from "./Form/index.js";
11
+ export * from "./Labels/index.js";
12
+ export * from "./Layouts/index.js";
13
+ export * from "./LineSeparator/index.js";
14
+ export * from "./Modal/index.js";
15
+ export * from "./NavBar/index.js";
16
+ export * from "./Skeletons/index.js";
17
+ export * from "./Tab/index.js";
18
+ export * from "./Table/index.js";
19
+ export * from "./TaskList/index.js";
20
+ export * from "./Titles/index.js";
21
+ export * from "./Tooltip/index.js";
22
+ export * from "./WithTooltip/index.js";
23
+ export * from "./Wizards/index.js";
24
+ export * from "./Zendesk/index.js";
@@ -1,5 +1,5 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- },
5
- };
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ },
5
+ };
@@ -1,10 +1,10 @@
1
- /** @type {import('tailwindcss').Config} */
2
- import type { Config } from "tailwindcss";
3
-
4
- module.exports = {
5
- content: ["./app/**/*.{ts,tsx,jsx,js}"],
6
- theme: {
7
- extend: {},
8
- },
9
- plugins: [require("@tailwindcss/forms")],
10
- } satisfies Config;
1
+ /** @type {import('tailwindcss').Config} */
2
+ import type { Config } from "tailwindcss";
3
+
4
+ module.exports = {
5
+ content: ["./app/**/*.{ts,tsx,jsx,js}"],
6
+ theme: {
7
+ extend: {},
8
+ },
9
+ plugins: [require("@tailwindcss/forms")],
10
+ } satisfies Config;
package/src/tailwind.css CHANGED
@@ -1,3 +1,3 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
package/tsconfig.cjs.json CHANGED
@@ -1,8 +1,8 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "CommonJS",
5
- "moduleResolution": "Node",
6
- "outDir": "./dist/cjs"
7
- }
8
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "outDir": "./dist/cjs"
7
+ }
8
+ }
package/tsconfig.esm.json CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "NodeNext",
5
- "target": "ES2022",
6
- "moduleResolution": "NodeNext",
7
- "outDir": "./dist/esm",
8
- "declaration": true,
9
- "declarationDir": "./dist"
10
- }
11
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "NodeNext",
5
+ "target": "ES2022",
6
+ "moduleResolution": "NodeNext",
7
+ "outDir": "./dist/esm",
8
+ "declaration": true,
9
+ "declarationDir": "./dist"
10
+ }
11
+ }
package/tsconfig.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "include": ["**/*.ts", "**/*.tsx", "**/*.css"],
3
- "compilerOptions": {
4
- "target": "ES2022",
5
- "module": "NodeNext",
6
- "moduleResolution": "NodeNext",
7
- "esModuleInterop": true,
8
- "strict": true,
9
- "jsx": "react-jsx",
10
- "baseUrl": ".",
11
- "outDir": "./dist",
12
- "rootDir": "./src",
13
- "paths": {
14
- "~/*": ["./src/*"]
15
- }
16
- }
17
- }
1
+ {
2
+ "include": ["**/*.ts", "**/*.tsx", "**/*.css"],
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "module": "NodeNext",
6
+ "moduleResolution": "NodeNext",
7
+ "esModuleInterop": true,
8
+ "strict": true,
9
+ "jsx": "react-jsx",
10
+ "baseUrl": ".",
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "paths": {
14
+ "~/*": ["./src/*"]
15
+ }
16
+ }
17
+ }