@zauru-sdk/components 2.33.0 → 6.0.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/CHANGELOG.md +117 -0
- package/dist/esm/DynamicTable/DynamicPrintTable.js +2 -2
- package/package.json +14 -11
- package/src/DynamicTable/DynamicPrintTable.tsx +28 -20
- package/dist/Tooltip/Tooltip.d.ts +0 -7
- package/dist/Tooltip/index.d.ts +0 -1
- package/dist/WithTooltip/WithTooltip.d.ts +0 -7
- package/dist/WithTooltip/index.d.ts +0 -1
- package/dist/esm/Tooltip/Tooltip.js +0 -14
- package/dist/esm/Tooltip/index.js +0 -1
- package/dist/esm/WithTooltip/WithTooltip.js +0 -5
- package/dist/esm/WithTooltip/index.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,123 @@
|
|
|
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
|
+
# 6.0.0 (2026-05-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* pre-build ([3b84721](https://github.com/intuitiva/zauru-typescript-sdk/commit/3b847215ea45cfb47ff742d06b3f4a1f0a019de9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 5.0.3 (2026-05-13)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 5.0.2 (2026-05-13)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **publish:** explicit npmjs registry, lerna flags, and workspace protocol sync ([fd57ef3](https://github.com/intuitiva/zauru-typescript-sdk/commit/fd57ef30ffb91021e54bc9e078be794a4f4acfe5))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 5.0.1 (2026-05-13)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# 5.0.0 (2026-05-13)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* use workspace:^ for internal @zauru-sdk/webapp-* dependencies ([35ff200](https://github.com/intuitiva/zauru-typescript-sdk/commit/35ff200378dee1928e04bcf4327aa1490ecb3792))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
* feat!: move packages to packages/webapp and rename to @zauru-sdk/webapp-* ([64ca702](https://github.com/intuitiva/zauru-typescript-sdk/commit/64ca702ba340e15a9e6585ca856130f649ac2ef3))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### BREAKING CHANGES
|
|
44
|
+
|
|
45
|
+
* Published package names are now @zauru-sdk/webapp-<name>
|
|
46
|
+
(e.g. @zauru-sdk/webapp-services). Workspace layout is packages/webapp/*.
|
|
47
|
+
Monorepo version set to 3.0.0.
|
|
48
|
+
|
|
49
|
+
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## [5.0.3](https://github.com/intuitiva/zauru-typescript-sdk/compare/v5.0.2...v5.0.3) (2026-05-13)
|
|
56
|
+
|
|
57
|
+
**Note:** Version bump only for package @zauru-sdk/webapp-components
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [5.0.2](https://github.com/intuitiva/zauru-typescript-sdk/compare/v5.0.1...v5.0.2) (2026-05-13)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* **publish:** explicit npmjs registry, lerna flags, and workspace protocol sync ([fd57ef3](https://github.com/intuitiva/zauru-typescript-sdk/commit/fd57ef30ffb91021e54bc9e078be794a4f4acfe5))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## [5.0.1](https://github.com/intuitiva/zauru-typescript-sdk/compare/v5.0.0...v5.0.1) (2026-05-13)
|
|
75
|
+
|
|
76
|
+
**Note:** Version bump only for package @zauru-sdk/webapp-components
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# [5.0.0](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.33.0...v5.0.0) (2026-05-13)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Bug Fixes
|
|
86
|
+
|
|
87
|
+
* use workspace:^ for internal @zauru-sdk/webapp-* dependencies ([35ff200](https://github.com/intuitiva/zauru-typescript-sdk/commit/35ff200378dee1928e04bcf4327aa1490ecb3792))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
* feat!: move packages to packages/webapp and rename to @zauru-sdk/webapp-* ([64ca702](https://github.com/intuitiva/zauru-typescript-sdk/commit/64ca702ba340e15a9e6585ca856130f649ac2ef3))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### BREAKING CHANGES
|
|
94
|
+
|
|
95
|
+
* Published package names are now @zauru-sdk/webapp-<name>
|
|
96
|
+
(e.g. @zauru-sdk/webapp-services). Workspace layout is packages/webapp/*.
|
|
97
|
+
Monorepo version set to 3.0.0.
|
|
98
|
+
|
|
99
|
+
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# [4.0.0](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.33.0...v4.0.0) (2026-05-13)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
* feat!: move packages to packages/webapp and rename to @zauru-sdk/webapp-* ([64ca702](https://github.com/intuitiva/zauru-typescript-sdk/commit/64ca702ba340e15a9e6585ca856130f649ac2ef3))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### BREAKING CHANGES
|
|
112
|
+
|
|
113
|
+
* Published package names are now @zauru-sdk/webapp-<name>
|
|
114
|
+
(e.g. @zauru-sdk/webapp-services). Workspace layout is packages/webapp/*.
|
|
115
|
+
Monorepo version set to 3.0.0.
|
|
116
|
+
|
|
117
|
+
Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
6
123
|
# [2.33.0](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.32.4...v2.33.0) (2026-05-12)
|
|
7
124
|
|
|
8
125
|
**Note:** Version bump only for package @zauru-sdk/components
|
|
@@ -121,8 +121,8 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }) => {
|
|
|
121
121
|
addRow();
|
|
122
122
|
}, type: "button", children: "+" }) }), _jsxs("td", { colSpan: 2, children: ["Total de etiquetas a imprimir:", " ", tableData?.reduce((sum, x) => {
|
|
123
123
|
const val = React.isValidElement(x[1])
|
|
124
|
-
? x[1]?.props?.defaultValue
|
|
125
|
-
:
|
|
124
|
+
? (x[1]?.props?.defaultValue ?? 0)
|
|
125
|
+
: 0;
|
|
126
126
|
if (!sum)
|
|
127
127
|
return val;
|
|
128
128
|
return sum + val;
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Componentes reutilizables en las WebApps de Zauru.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "npm run build:esm",
|
|
@@ -23,8 +24,8 @@
|
|
|
23
24
|
"@tailwindcss/forms": "^0.5.7",
|
|
24
25
|
"@types/jsonwebtoken": "^9.0.2",
|
|
25
26
|
"@types/rails__activestorage": "^7.1.1",
|
|
26
|
-
"@types/react": "^
|
|
27
|
-
"@types/react-dom": "^
|
|
27
|
+
"@types/react": "^19.0.0",
|
|
28
|
+
"@types/react-dom": "^19.0.0",
|
|
28
29
|
"@types/styled-components": "^5.1.34",
|
|
29
30
|
"postcss": "^8.4.35",
|
|
30
31
|
"tailwindcss": "^3.4.1",
|
|
@@ -34,14 +35,16 @@
|
|
|
34
35
|
"@hookform/resolvers": "^3.9.0",
|
|
35
36
|
"@rails/activestorage": "^8.0.200",
|
|
36
37
|
"@reduxjs/toolkit": "^2.2.1",
|
|
38
|
+
"@remix-run/node": "^2.8.1",
|
|
37
39
|
"@remix-run/react": "^2.8.1",
|
|
38
|
-
"@zauru-sdk/common": "^
|
|
39
|
-
"@zauru-sdk/hooks": "^
|
|
40
|
-
"@zauru-sdk/icons": "^
|
|
41
|
-
"@zauru-sdk/
|
|
42
|
-
"@zauru-sdk/
|
|
40
|
+
"@zauru-sdk/common": "^6.0.0",
|
|
41
|
+
"@zauru-sdk/hooks": "^6.0.0",
|
|
42
|
+
"@zauru-sdk/icons": "^6.0.0",
|
|
43
|
+
"@zauru-sdk/redux": "^6.0.0",
|
|
44
|
+
"@zauru-sdk/types": "^6.0.0",
|
|
45
|
+
"@zauru-sdk/utils": "^6.0.0",
|
|
43
46
|
"browser-image-compression": "^2.0.2",
|
|
44
|
-
"framer-motion": "^
|
|
47
|
+
"framer-motion": "^12.0.0",
|
|
45
48
|
"jsonwebtoken": "^9.0.2",
|
|
46
49
|
"react": "^18.2.0",
|
|
47
50
|
"react-data-table-component": "^7.6.2",
|
|
@@ -52,5 +55,5 @@
|
|
|
52
55
|
"styled-components": "^5.3.5",
|
|
53
56
|
"zod": "^3.23.8"
|
|
54
57
|
},
|
|
55
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "32fe3db68a20bc4bfec9b59db37bd1bf221acc34"
|
|
56
59
|
}
|
|
@@ -23,7 +23,7 @@ type Props = {
|
|
|
23
23
|
forwardedRef?: React.RefObject<{
|
|
24
24
|
insertItems: (items: FormatedItem[]) => void;
|
|
25
25
|
getTableState: (
|
|
26
|
-
updatedData?: ReactNode[][]
|
|
26
|
+
updatedData?: ReactNode[][],
|
|
27
27
|
) => TableStateItem[] | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
};
|
|
@@ -39,7 +39,7 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
39
39
|
|
|
40
40
|
const createItemSelect = (
|
|
41
41
|
rowIndex: number,
|
|
42
|
-
defaultValue?: SelectFieldOption
|
|
42
|
+
defaultValue?: SelectFieldOption,
|
|
43
43
|
) => (
|
|
44
44
|
<SelectField
|
|
45
45
|
key={rowIndex}
|
|
@@ -77,13 +77,13 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
77
77
|
const createRow = (
|
|
78
78
|
rowIndex: number,
|
|
79
79
|
item?: FormatedItem,
|
|
80
|
-
quantity?: number
|
|
80
|
+
quantity?: number,
|
|
81
81
|
) => {
|
|
82
82
|
const itemCreated = createItemSelect(rowIndex, item ?? undefined);
|
|
83
83
|
const quantityCreated = createItemQuantity(rowIndex, quantity ?? 1);
|
|
84
84
|
const templateCreated = createTemplateName(
|
|
85
85
|
rowIndex,
|
|
86
|
-
item ? item.template : "Seleccione un item para visualizar su etiqueta."
|
|
86
|
+
item ? item.template : "Seleccione un item para visualizar su etiqueta.",
|
|
87
87
|
);
|
|
88
88
|
return [itemCreated, quantityCreated, templateCreated];
|
|
89
89
|
};
|
|
@@ -99,26 +99,30 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
99
99
|
const rowIndex = (prevData?.length ?? 0) + index;
|
|
100
100
|
const [itemCreated, quantityCreated, templateCreated] = createRow(
|
|
101
101
|
rowIndex,
|
|
102
|
-
item
|
|
102
|
+
item,
|
|
103
103
|
);
|
|
104
104
|
updateRow(rowIndex, item, 1);
|
|
105
105
|
return [itemCreated, quantityCreated, templateCreated];
|
|
106
106
|
}),
|
|
107
107
|
]);
|
|
108
108
|
},
|
|
109
|
-
[items]
|
|
109
|
+
[items],
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
const getTableState = (temp?: ReactNode[][]) => {
|
|
113
113
|
const updatedData = temp ?? tableData;
|
|
114
114
|
const tableState = updatedData?.map((rowData) => {
|
|
115
115
|
const firstElement = rowData[0];
|
|
116
|
-
const item_id = React.isValidElement
|
|
116
|
+
const item_id = React.isValidElement<{
|
|
117
|
+
defaultValue?: { value?: string };
|
|
118
|
+
}>(firstElement)
|
|
117
119
|
? firstElement.props.defaultValue?.value
|
|
118
120
|
: undefined;
|
|
119
121
|
|
|
120
122
|
const secondElement = rowData[1];
|
|
121
|
-
const quantity = React.isValidElement(
|
|
123
|
+
const quantity = React.isValidElement<{ defaultValue?: number }>(
|
|
124
|
+
secondElement,
|
|
125
|
+
)
|
|
122
126
|
? secondElement.props.defaultValue
|
|
123
127
|
: undefined;
|
|
124
128
|
|
|
@@ -133,7 +137,7 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
133
137
|
const updateRow = (
|
|
134
138
|
rowIndex: number,
|
|
135
139
|
item?: FormatedItem,
|
|
136
|
-
quantity?: number
|
|
140
|
+
quantity?: number,
|
|
137
141
|
) => {
|
|
138
142
|
setTableData((prevData) => {
|
|
139
143
|
const updatedData = prevData?.map((_, index) => {
|
|
@@ -141,18 +145,20 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
141
145
|
const firstElement = prevData[index][0];
|
|
142
146
|
const selectedItem =
|
|
143
147
|
item ??
|
|
144
|
-
(React.isValidElement(
|
|
148
|
+
(React.isValidElement<{ defaultValue?: { value?: number } }>(
|
|
149
|
+
firstElement,
|
|
150
|
+
)
|
|
145
151
|
? items?.find(
|
|
146
|
-
(x) => x.value === firstElement.props.defaultValue?.value
|
|
152
|
+
(x) => x.value === firstElement.props.defaultValue?.value,
|
|
147
153
|
)
|
|
148
154
|
: undefined);
|
|
149
155
|
|
|
150
156
|
const secondElement = prevData[index][1];
|
|
151
157
|
const newQuantity = quantity
|
|
152
158
|
? quantity
|
|
153
|
-
: React.isValidElement(secondElement)
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
: React.isValidElement<{ defaultValue?: number }>(secondElement)
|
|
160
|
+
? secondElement.props.defaultValue
|
|
161
|
+
: undefined;
|
|
156
162
|
|
|
157
163
|
return createRow(rowIndex, selectedItem, newQuantity);
|
|
158
164
|
} else {
|
|
@@ -179,7 +185,7 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
179
185
|
|
|
180
186
|
const removeRow = (rowIndex: number) => {
|
|
181
187
|
setTableData((prevData) =>
|
|
182
|
-
prevData?.filter((_, index) => index !== rowIndex)
|
|
188
|
+
prevData?.filter((_, index) => index !== rowIndex),
|
|
183
189
|
);
|
|
184
190
|
};
|
|
185
191
|
|
|
@@ -213,7 +219,7 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
213
219
|
<button
|
|
214
220
|
className="bg-red-500 hover:bg-red-600 font-bold py-1 px-2 rounded ml-2"
|
|
215
221
|
onClick={(
|
|
216
|
-
event: React.MouseEvent<HTMLButtonElement, MouseEvent
|
|
222
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
217
223
|
) => {
|
|
218
224
|
event.preventDefault();
|
|
219
225
|
event.stopPropagation();
|
|
@@ -255,7 +261,7 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
255
261
|
<button
|
|
256
262
|
className="bg-blue-500 hover:bg-blue-600 font-bold py-2 px-4 rounded"
|
|
257
263
|
onClick={(
|
|
258
|
-
event: React.MouseEvent<HTMLButtonElement, MouseEvent
|
|
264
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
259
265
|
) => {
|
|
260
266
|
event.preventDefault();
|
|
261
267
|
event.stopPropagation();
|
|
@@ -269,9 +275,11 @@ export const DynamicPrintTable = ({ forwardedRef, ...props }: Props) => {
|
|
|
269
275
|
<td colSpan={2}>
|
|
270
276
|
Total de etiquetas a imprimir:{" "}
|
|
271
277
|
{tableData?.reduce((sum, x) => {
|
|
272
|
-
const val = React.isValidElement(
|
|
273
|
-
|
|
274
|
-
|
|
278
|
+
const val = React.isValidElement<{ defaultValue?: number }>(
|
|
279
|
+
x[1],
|
|
280
|
+
)
|
|
281
|
+
? (x[1]?.props?.defaultValue ?? 0)
|
|
282
|
+
: 0;
|
|
275
283
|
if (!sum) return val;
|
|
276
284
|
return sum + val;
|
|
277
285
|
}, 0)}
|
package/dist/Tooltip/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Tooltip.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./WithTooltip.js";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
export const Tooltip = ({ children, text }) => {
|
|
5
|
-
const [show, setShow] = useState(false);
|
|
6
|
-
return (_jsxs("div", { className: "relative inline-block", children: [_jsx("div", { onMouseEnter: () => setShow(true), onMouseLeave: () => setShow(false), children: children }), show && (_jsxs("div", { className: "absolute z-10 bg-gray-700 text-white px-2 py-1 rounded-md bottom-full left-1/2 transform -translate-x-1/2", style: { whiteSpace: "nowrap", height: "2rem" }, children: [text, _jsx("div", { className: "absolute top-full left-1/2 transform -translate-x-1/2", style: {
|
|
7
|
-
width: "0",
|
|
8
|
-
height: "0",
|
|
9
|
-
borderTop: "6px solid transparent",
|
|
10
|
-
borderLeft: "6px solid transparent",
|
|
11
|
-
borderRight: "6px solid transparent",
|
|
12
|
-
borderBottom: "6px solid gray",
|
|
13
|
-
} })] }))] }));
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Tooltip.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const WithTooltip = (props) => {
|
|
3
|
-
const { children, text } = props;
|
|
4
|
-
return (_jsxs("div", { className: "group relative inline-block", children: [children, _jsx("div", { className: "pointer-events-none absolute left-1/2 -translate-x-1/2 bottom-full mb-2 opacity-0 transition-opacity duration-300 group-hover:opacity-100", children: _jsxs("div", { className: "relative bg-black text-white text-sm rounded py-1 px-2 text-wrap w-40", children: [text, _jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-black" })] }) })] }));
|
|
5
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./WithTooltip.js";
|