@zauru-sdk/components 1.0.99 → 1.0.100

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 (95) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Form/Checkbox/index.d.ts +1 -3
  3. package/dist/Form/DatePicker/index.d.ts +1 -3
  4. package/dist/Form/FileUpload/index.d.ts +1 -2
  5. package/dist/Form/ReactZodForm/index.d.ts +12 -0
  6. package/dist/Form/SelectField/index.d.ts +6 -9
  7. package/dist/Form/TextArea/index.d.ts +1 -3
  8. package/dist/Form/TextField/index.d.ts +1 -3
  9. package/dist/Form/TimePicker/index.d.ts +1 -2
  10. package/dist/Form/YesNo/index.d.ts +1 -0
  11. package/dist/Form/index.d.ts +1 -2
  12. package/dist/Layouts/homeLayout/index.d.ts +3 -1
  13. package/dist/Modal/Modal.d.ts +1 -1
  14. package/dist/Zendesk/zendesk.config.d.ts +1 -1
  15. package/dist/cjs/Alerts/StaticAlert.js +0 -6
  16. package/dist/cjs/Buttons/Button.js +13 -2
  17. package/dist/cjs/DynamicTable/DynamicPrintTable.js +2 -2
  18. package/dist/cjs/DynamicTable/DynamicTable.js +3 -3
  19. package/dist/cjs/DynamicTable/GenericDynamicTable.js +4 -5
  20. package/dist/cjs/Footer/Footer.js +1 -1
  21. package/dist/cjs/Form/Checkbox/index.js +14 -14
  22. package/dist/cjs/Form/Checklist/index.js +1 -1
  23. package/dist/cjs/Form/DatePicker/index.js +14 -13
  24. package/dist/cjs/Form/DynamicBaculoForm/index.js +1 -1
  25. package/dist/cjs/Form/FileUpload/index.js +25 -13
  26. package/dist/cjs/Form/ReactZodForm/index.js +31 -0
  27. package/dist/cjs/Form/SelectField/index.js +118 -73
  28. package/dist/cjs/Form/TextArea/index.js +15 -15
  29. package/dist/cjs/Form/TextField/index.js +20 -16
  30. package/dist/cjs/Form/TimePicker/index.js +17 -15
  31. package/dist/cjs/Form/YesNo/index.js +12 -6
  32. package/dist/cjs/Form/index.js +1 -2
  33. package/dist/cjs/Layouts/homeLayout/index.js +45 -8
  34. package/dist/cjs/Modal/Modal.js +1 -2
  35. package/dist/cjs/NavBar/NavBar.js +12 -17
  36. package/dist/cjs/Table/ZauruTable.js +11 -4
  37. package/dist/cjs/WithTooltip/WithTooltip.js +1 -1
  38. package/dist/cjs/Zendesk/zendesk.config.js +7 -9
  39. package/dist/esm/Alerts/StaticAlert.js +0 -6
  40. package/dist/esm/Buttons/Button.js +13 -2
  41. package/dist/esm/DynamicTable/DynamicPrintTable.js +4 -4
  42. package/dist/esm/DynamicTable/DynamicTable.js +6 -6
  43. package/dist/esm/DynamicTable/GenericDynamicTable.js +7 -8
  44. package/dist/esm/Footer/Footer.js +1 -1
  45. package/dist/esm/Form/Checkbox/index.js +13 -12
  46. package/dist/esm/Form/Checklist/index.js +2 -2
  47. package/dist/esm/Form/DatePicker/index.js +13 -11
  48. package/dist/esm/Form/DynamicBaculoForm/index.js +2 -2
  49. package/dist/esm/Form/FileUpload/index.js +24 -11
  50. package/dist/esm/Form/ReactZodForm/index.js +27 -0
  51. package/dist/esm/Form/SelectField/index.js +118 -49
  52. package/dist/esm/Form/TextArea/index.js +14 -13
  53. package/dist/esm/Form/TextField/index.js +19 -14
  54. package/dist/esm/Form/TimePicker/index.js +16 -13
  55. package/dist/esm/Form/YesNo/index.js +12 -6
  56. package/dist/esm/Form/index.js +1 -2
  57. package/dist/esm/Layouts/homeLayout/index.js +46 -9
  58. package/dist/esm/Modal/Modal.js +1 -2
  59. package/dist/esm/NavBar/NavBar.js +12 -17
  60. package/dist/esm/Table/ZauruTable.js +11 -4
  61. package/dist/esm/WithTooltip/WithTooltip.js +2 -2
  62. package/dist/esm/Zendesk/zendesk.config.js +7 -6
  63. package/package.json +6 -3
  64. package/src/Alerts/StaticAlert.tsx +0 -10
  65. package/src/Buttons/Button.tsx +24 -4
  66. package/src/DynamicTable/DynamicPrintTable.tsx +5 -6
  67. package/src/DynamicTable/DynamicTable.tsx +7 -7
  68. package/src/DynamicTable/GenericDynamicTable.tsx +7 -8
  69. package/src/Footer/Footer.tsx +1 -1
  70. package/src/Form/Checkbox/index.tsx +21 -18
  71. package/src/Form/Checklist/index.tsx +2 -2
  72. package/src/Form/DatePicker/index.tsx +22 -19
  73. package/src/Form/DynamicBaculoForm/index.tsx +2 -2
  74. package/src/Form/FileUpload/index.tsx +29 -14
  75. package/src/Form/ReactZodForm/index.tsx +60 -0
  76. package/src/Form/SelectField/index.tsx +246 -130
  77. package/src/Form/TextArea/index.tsx +22 -19
  78. package/src/Form/TextField/index.tsx +25 -18
  79. package/src/Form/TimePicker/index.tsx +25 -18
  80. package/src/Form/YesNo/index.tsx +20 -7
  81. package/src/Form/index.ts +1 -2
  82. package/src/Layouts/homeLayout/index.tsx +114 -21
  83. package/src/Modal/Modal.tsx +2 -5
  84. package/src/NavBar/NavBar.tsx +35 -46
  85. package/src/Table/ZauruTable.tsx +11 -4
  86. package/src/WithTooltip/WithTooltip.tsx +8 -7
  87. package/src/Zendesk/zendesk.config.ts +8 -6
  88. package/dist/Form/FormLayout/index.d.ts +0 -11
  89. package/dist/Form/RadioButtonGroup/index.d.ts +0 -20
  90. package/dist/cjs/Form/FormLayout/index.js +0 -11
  91. package/dist/cjs/Form/RadioButtonGroup/index.js +0 -26
  92. package/dist/esm/Form/FormLayout/index.js +0 -7
  93. package/dist/esm/Form/RadioButtonGroup/index.js +0 -21
  94. package/src/Form/FormLayout/index.tsx +0 -37
  95. package/src/Form/RadioButtonGroup/index.tsx +0 -108
@@ -1,4 +1,4 @@
1
- import jwt from "jsonwebtoken";
1
+ //import jwt from "jsonwebtoken";
2
2
 
3
3
  export function zendeskJwt(
4
4
  current_user: {
@@ -31,10 +31,12 @@ export function zendeskJwt(
31
31
  exp: expiresIn,
32
32
  };
33
33
 
34
- const jwtHeader: jwt.JwtHeader = { kid: jwtKey, typ: "JWT", alg: "HS256" };
34
+ // const jwtHeader: jwt.JwtHeader = { kid: jwtKey, typ: "JWT", alg: "HS256" };
35
35
 
36
- return jwt.sign(payload, jwtSecret, {
37
- algorithm: "HS256",
38
- header: jwtHeader,
39
- });
36
+ // return jwt.sign(payload, jwtSecret, {
37
+ // algorithm: "HS256",
38
+ // header: jwtHeader,
39
+ // });
40
+
41
+ return {};
40
42
  }
@@ -1,11 +0,0 @@
1
- import { type FormMethod } from "@remix-run/react";
2
- import { type ReactNode } from "react";
3
- type Props = {
4
- formId: string;
5
- title?: string;
6
- children: ReactNode;
7
- buttons?: ReactNode;
8
- method?: FormMethod;
9
- };
10
- export declare const FormLayout: (props: Props) => import("react/jsx-runtime").JSX.Element;
11
- export {};
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- type RadioButtonProps = {
3
- id?: string;
4
- name?: string;
5
- options: {
6
- label: string;
7
- value: string;
8
- }[];
9
- defaultValue?: string;
10
- orientation?: "vertical" | "horizontal";
11
- onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
12
- disabled?: boolean;
13
- error?: string;
14
- title?: string;
15
- helpText?: string;
16
- className?: string;
17
- };
18
- export declare const RadioButtonGroupWithoutValidation: (props: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
19
- export declare const RadioButtonGroup: (props: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
20
- export {};
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormLayout = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("@remix-run/react");
6
- const index_js_1 = require("../../Containers/index.js");
7
- const FormLayout = (props) => {
8
- const { title, children, buttons, method, formId } = props;
9
- return ((0, jsx_runtime_1.jsxs)(react_1.Form, { id: formId, name: formId, method: method ?? "post", children: [title && ((0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-3", children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "shadow sm:overflow-hidden sm:rounded-md", children: [(0, jsx_runtime_1.jsx)("div", { className: "space-y-6 bg-white px-4 py-5 sm:p-6", children: children }), buttons && ((0, jsx_runtime_1.jsx)(index_js_1.ButtonSectionContainer, { children: buttons }))] })] }, formId));
10
- };
11
- exports.FormLayout = FormLayout;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RadioButtonGroup = exports.RadioButtonGroupWithoutValidation = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const icons_1 = require("@zauru-sdk/icons");
6
- const redux_1 = require("@zauru-sdk/redux");
7
- const react_1 = require("react");
8
- const RadioButtonGroupWithoutValidation = (props) => {
9
- const { id, name, options, defaultValue, orientation = "vertical", onChange, disabled = false, error, title, helpText, className, } = props;
10
- const [selectedValue, setSelectedValue] = (0, react_1.useState)(defaultValue);
11
- const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
12
- const handleChange = (event) => {
13
- setSelectedValue(event.target.value);
14
- onChange && onChange(event.target.value, event);
15
- };
16
- const containerClass = orientation === "vertical" ? "flex flex-col" : "flex flex-row space-x-5";
17
- return ((0, jsx_runtime_1.jsxs)("div", { className: `radio-button-group ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: "block mb-1 text-sm font-medium text-gray-700", children: title })), (0, jsx_runtime_1.jsx)("div", { className: containerClass, children: options.map((option, index) => ((0, jsx_runtime_1.jsxs)("label", { className: "flex items-center space-x-2", children: [(0, jsx_runtime_1.jsx)("input", { type: "radio", id: id ? `${id}-${option.value}` : undefined, name: name, value: option.value, checked: selectedValue === option.value, onChange: handleChange, disabled: disabled, className: "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300" }), (0, jsx_runtime_1.jsx)("span", { className: "text-sm text-gray-700", children: option.label })] }, index))) }), helpText && ((0, jsx_runtime_1.jsxs)("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [(0, jsx_runtime_1.jsx)(icons_1.IdeaIconSVG, {}), showTooltip && ((0, jsx_runtime_1.jsx)("div", { className: "absolute mt-2 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] })), error && ((0, jsx_runtime_1.jsxs)("p", { className: "mt-2 text-sm text-red-600", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] }))] }));
18
- };
19
- exports.RadioButtonGroupWithoutValidation = RadioButtonGroupWithoutValidation;
20
- const RadioButtonGroup = (props) => {
21
- const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
22
- const error = formValidations[props.name ?? "-1"];
23
- props = { ...props, error };
24
- return (0, jsx_runtime_1.jsx)(exports.RadioButtonGroupWithoutValidation, { ...props });
25
- };
26
- exports.RadioButtonGroup = RadioButtonGroup;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Form } from "@remix-run/react";
3
- import { ButtonSectionContainer } from "../../Containers/index.js";
4
- export const FormLayout = (props) => {
5
- const { title, children, buttons, method, formId } = props;
6
- return (_jsxs(Form, { id: formId, name: formId, method: method ?? "post", children: [title && (_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-3", children: title })), _jsxs("div", { className: "shadow sm:overflow-hidden sm:rounded-md", children: [_jsx("div", { className: "space-y-6 bg-white px-4 py-5 sm:p-6", children: children }), buttons && (_jsx(ButtonSectionContainer, { children: buttons }))] })] }, formId));
7
- };
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { IdeaIconSVG } from "@zauru-sdk/icons";
3
- import { useAppSelector } from "@zauru-sdk/redux";
4
- import { useState } from "react";
5
- export const RadioButtonGroupWithoutValidation = (props) => {
6
- const { id, name, options, defaultValue, orientation = "vertical", onChange, disabled = false, error, title, helpText, className, } = props;
7
- const [selectedValue, setSelectedValue] = useState(defaultValue);
8
- const [showTooltip, setShowTooltip] = useState(false);
9
- const handleChange = (event) => {
10
- setSelectedValue(event.target.value);
11
- onChange && onChange(event.target.value, event);
12
- };
13
- const containerClass = orientation === "vertical" ? "flex flex-col" : "flex flex-row space-x-5";
14
- return (_jsxs("div", { className: `radio-button-group ${className}`, children: [title && (_jsx("label", { htmlFor: id, className: "block mb-1 text-sm font-medium text-gray-700", children: title })), _jsx("div", { className: containerClass, children: options.map((option, index) => (_jsxs("label", { className: "flex items-center space-x-2", children: [_jsx("input", { type: "radio", id: id ? `${id}-${option.value}` : undefined, name: name, value: option.value, checked: selectedValue === option.value, onChange: handleChange, disabled: disabled, className: "focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300" }), _jsx("span", { className: "text-sm text-gray-700", children: option.label })] }, index))) }), helpText && (_jsxs("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [_jsx(IdeaIconSVG, {}), showTooltip && (_jsx("div", { className: "absolute mt-2 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] })), error && (_jsxs("p", { className: "mt-2 text-sm text-red-600", children: [_jsx("span", { className: "font-medium", children: "Oops!" }), " ", error] }))] }));
15
- };
16
- export const RadioButtonGroup = (props) => {
17
- const { formValidations } = useAppSelector((state) => state.formValidation);
18
- const error = formValidations[props.name ?? "-1"];
19
- props = { ...props, error };
20
- return _jsx(RadioButtonGroupWithoutValidation, { ...props });
21
- };
@@ -1,37 +0,0 @@
1
- import { Form, type FormMethod } from "@remix-run/react";
2
- import { type ReactNode } from "react";
3
- import { ButtonSectionContainer } from "../../Containers/index.js";
4
-
5
- type Props = {
6
- formId: string;
7
- title?: string;
8
- children: ReactNode;
9
- buttons?: ReactNode;
10
- method?: FormMethod;
11
- };
12
-
13
- export const FormLayout = (props: Props) => {
14
- const { title, children, buttons, method, formId } = props;
15
-
16
- return (
17
- <Form id={formId} name={formId} method={method ?? "post"} key={formId}>
18
- {title && (
19
- <label className="block text-sm font-medium text-gray-700 mb-3">
20
- {title}
21
- </label>
22
- )}
23
- <div className="shadow sm:overflow-hidden sm:rounded-md">
24
- <div className="space-y-6 bg-white px-4 py-5 sm:p-6">
25
- {/* AQUÍ VAN EL CONTENIDO DEL FORM */}
26
- {children}
27
- </div>
28
- {buttons && (
29
- <ButtonSectionContainer>
30
- {/* AQUÍ VAN LOS BOTONES */}
31
- {buttons}
32
- </ButtonSectionContainer>
33
- )}
34
- </div>
35
- </Form>
36
- );
37
- };
@@ -1,108 +0,0 @@
1
- import { IdeaIconSVG } from "@zauru-sdk/icons";
2
- import { useAppSelector } from "@zauru-sdk/redux";
3
- import React, { useState } from "react";
4
-
5
- type RadioButtonProps = {
6
- id?: string;
7
- name?: string;
8
- options: { label: string; value: string }[];
9
- defaultValue?: string;
10
- orientation?: "vertical" | "horizontal";
11
- onChange?: (
12
- value: string,
13
- event: React.ChangeEvent<HTMLInputElement>
14
- ) => void;
15
- disabled?: boolean;
16
- error?: string;
17
- title?: string;
18
- helpText?: string;
19
- className?: string;
20
- };
21
-
22
- export const RadioButtonGroupWithoutValidation = (props: RadioButtonProps) => {
23
- const {
24
- id,
25
- name,
26
- options,
27
- defaultValue,
28
- orientation = "vertical",
29
- onChange,
30
- disabled = false,
31
- error,
32
- title,
33
- helpText,
34
- className,
35
- } = props;
36
-
37
- const [selectedValue, setSelectedValue] = useState<string | undefined>(
38
- defaultValue
39
- );
40
-
41
- const [showTooltip, setShowTooltip] = useState<boolean>(false);
42
-
43
- const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
44
- setSelectedValue(event.target.value);
45
- onChange && onChange(event.target.value, event);
46
- };
47
-
48
- const containerClass =
49
- orientation === "vertical" ? "flex flex-col" : "flex flex-row space-x-5";
50
-
51
- return (
52
- <div className={`radio-button-group ${className}`}>
53
- {title && (
54
- <label
55
- htmlFor={id}
56
- className="block mb-1 text-sm font-medium text-gray-700"
57
- >
58
- {title}
59
- </label>
60
- )}
61
- <div className={containerClass}>
62
- {options.map((option, index) => (
63
- <label key={index} className="flex items-center space-x-2">
64
- <input
65
- type="radio"
66
- id={id ? `${id}-${option.value}` : undefined}
67
- name={name}
68
- value={option.value}
69
- checked={selectedValue === option.value}
70
- onChange={handleChange}
71
- disabled={disabled}
72
- className="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300"
73
- />
74
- <span className="text-sm text-gray-700">{option.label}</span>
75
- </label>
76
- ))}
77
- </div>
78
- {helpText && (
79
- <div
80
- className="relative cursor-pointer"
81
- onMouseEnter={() => setShowTooltip(true)}
82
- onMouseLeave={() => setShowTooltip(false)}
83
- >
84
- <IdeaIconSVG />
85
- {showTooltip && (
86
- <div className="absolute mt-2 p-2 bg-white border rounded shadow text-black z-50">
87
- {helpText}
88
- </div>
89
- )}
90
- </div>
91
- )}
92
- {error && (
93
- <p className="mt-2 text-sm text-red-600">
94
- <span className="font-medium">Oops!</span> {error}
95
- </p>
96
- )}
97
- </div>
98
- );
99
- };
100
-
101
- export const RadioButtonGroup = (props: RadioButtonProps) => {
102
- const { formValidations } = useAppSelector((state) => state.formValidation);
103
- const error = formValidations[props.name ?? "-1"];
104
-
105
- props = { ...props, error };
106
-
107
- return <RadioButtonGroupWithoutValidation {...props} />;
108
- };