@npm_leadtech/legal-contracts-ui 0.190.11 → 0.190.501

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.
@@ -130,6 +130,20 @@ export interface ToastProps {
130
130
  onClose: () => void;
131
131
  }
132
132
 
133
+ export interface UploadZoneError {
134
+ kind: UploadZoneErrorKind;
135
+ }
136
+
137
+ export interface UploadZoneErrorCopy {
138
+ tooLarge: string;
139
+ unsupportedFormat: string;
140
+ generic: string;
141
+ retryLabel: string;
142
+ chooseFileLabel: string;
143
+ }
144
+
145
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
146
+
133
147
  export interface UploadZoneProps {
134
148
  uploadPromptText?: string;
135
149
  addDocumentLabel: string;
@@ -144,5 +158,11 @@ export interface UploadZoneProps {
144
158
  onAddDocument?: () => void;
145
159
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
146
160
  dataQa?: string;
161
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
162
+ error?: UploadZoneError | null;
163
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
164
+ errorCopy?: Partial<UploadZoneErrorCopy>;
165
+ /** Recovery action for the inline error CTA (retry or open the picker). */
166
+ onErrorAction?: () => void;
147
167
  }
148
168
 
@@ -10,6 +10,20 @@ export declare interface ConversionSectionProps {
10
10
  dataQa?: string;
11
11
  }
12
12
 
13
+ export interface UploadZoneError {
14
+ kind: UploadZoneErrorKind;
15
+ }
16
+
17
+ export interface UploadZoneErrorCopy {
18
+ tooLarge: string;
19
+ unsupportedFormat: string;
20
+ generic: string;
21
+ retryLabel: string;
22
+ chooseFileLabel: string;
23
+ }
24
+
25
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
26
+
13
27
  export interface UploadZoneProps {
14
28
  uploadPromptText?: string;
15
29
  addDocumentLabel: string;
@@ -24,5 +38,11 @@ export interface UploadZoneProps {
24
38
  onAddDocument?: () => void;
25
39
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
26
40
  dataQa?: string;
41
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
42
+ error?: UploadZoneError | null;
43
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
44
+ errorCopy?: Partial<UploadZoneErrorCopy>;
45
+ /** Recovery action for the inline error CTA (retry or open the picker). */
46
+ onErrorAction?: () => void;
27
47
  }
28
48
 
@@ -122,6 +122,20 @@ export interface ToastProps {
122
122
  onClose: () => void;
123
123
  }
124
124
 
125
+ export interface UploadZoneError {
126
+ kind: UploadZoneErrorKind;
127
+ }
128
+
129
+ export interface UploadZoneErrorCopy {
130
+ tooLarge: string;
131
+ unsupportedFormat: string;
132
+ generic: string;
133
+ retryLabel: string;
134
+ chooseFileLabel: string;
135
+ }
136
+
137
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
138
+
125
139
  export interface UploadZoneProps {
126
140
  uploadPromptText?: string;
127
141
  addDocumentLabel: string;
@@ -136,5 +150,11 @@ export interface UploadZoneProps {
136
150
  onAddDocument?: () => void;
137
151
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
138
152
  dataQa?: string;
153
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
154
+ error?: UploadZoneError | null;
155
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
156
+ errorCopy?: Partial<UploadZoneErrorCopy>;
157
+ /** Recovery action for the inline error CTA (retry or open the picker). */
158
+ onErrorAction?: () => void;
139
159
  }
140
160
 
@@ -19,6 +19,20 @@ export declare interface Hero2SectionProps {
19
19
  uploadZone: UploadZoneProps;
20
20
  }
21
21
 
22
+ export interface UploadZoneError {
23
+ kind: UploadZoneErrorKind;
24
+ }
25
+
26
+ export interface UploadZoneErrorCopy {
27
+ tooLarge: string;
28
+ unsupportedFormat: string;
29
+ generic: string;
30
+ retryLabel: string;
31
+ chooseFileLabel: string;
32
+ }
33
+
34
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
35
+
22
36
  export interface UploadZoneProps {
23
37
  uploadPromptText?: string;
24
38
  addDocumentLabel: string;
@@ -33,5 +47,11 @@ export interface UploadZoneProps {
33
47
  onAddDocument?: () => void;
34
48
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
35
49
  dataQa?: string;
50
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
51
+ error?: UploadZoneError | null;
52
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
53
+ errorCopy?: Partial<UploadZoneErrorCopy>;
54
+ /** Recovery action for the inline error CTA (retry or open the picker). */
55
+ onErrorAction?: () => void;
36
56
  }
37
57
 
@@ -20,6 +20,20 @@ export declare interface PdfToolsHeroProps {
20
20
  bgRight?: ReactNode | null;
21
21
  }
22
22
 
23
+ export interface UploadZoneError {
24
+ kind: UploadZoneErrorKind;
25
+ }
26
+
27
+ export interface UploadZoneErrorCopy {
28
+ tooLarge: string;
29
+ unsupportedFormat: string;
30
+ generic: string;
31
+ retryLabel: string;
32
+ chooseFileLabel: string;
33
+ }
34
+
35
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
36
+
23
37
  export interface UploadZoneProps {
24
38
  uploadPromptText?: string;
25
39
  addDocumentLabel: string;
@@ -34,5 +48,11 @@ export interface UploadZoneProps {
34
48
  onAddDocument?: () => void;
35
49
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
36
50
  dataQa?: string;
51
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
52
+ error?: UploadZoneError | null;
53
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
54
+ errorCopy?: Partial<UploadZoneErrorCopy>;
55
+ /** Recovery action for the inline error CTA (retry or open the picker). */
56
+ onErrorAction?: () => void;
37
57
  }
38
58
 
@@ -108,6 +108,20 @@ export interface ToastProps {
108
108
  onClose: () => void;
109
109
  }
110
110
 
111
+ export interface UploadZoneError {
112
+ kind: UploadZoneErrorKind;
113
+ }
114
+
115
+ export interface UploadZoneErrorCopy {
116
+ tooLarge: string;
117
+ unsupportedFormat: string;
118
+ generic: string;
119
+ retryLabel: string;
120
+ chooseFileLabel: string;
121
+ }
122
+
123
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
124
+
111
125
  export interface UploadZoneProps {
112
126
  uploadPromptText?: string;
113
127
  addDocumentLabel: string;
@@ -122,5 +136,11 @@ export interface UploadZoneProps {
122
136
  onAddDocument?: () => void;
123
137
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
124
138
  dataQa?: string;
139
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
140
+ error?: UploadZoneError | null;
141
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
142
+ errorCopy?: Partial<UploadZoneErrorCopy>;
143
+ /** Recovery action for the inline error CTA (retry or open the picker). */
144
+ onErrorAction?: () => void;
125
145
  }
126
146
 
@@ -9,6 +9,20 @@ export declare type Hero2Highlight = {
9
9
 
10
10
  export declare const UploadZone: FC<UploadZoneProps>;
11
11
 
12
+ export declare interface UploadZoneError {
13
+ kind: UploadZoneErrorKind;
14
+ }
15
+
16
+ export declare interface UploadZoneErrorCopy {
17
+ tooLarge: string;
18
+ unsupportedFormat: string;
19
+ generic: string;
20
+ retryLabel: string;
21
+ chooseFileLabel: string;
22
+ }
23
+
24
+ export declare type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
25
+
12
26
  export declare interface UploadZoneProps {
13
27
  uploadPromptText?: string;
14
28
  addDocumentLabel: string;
@@ -23,5 +37,11 @@ export declare interface UploadZoneProps {
23
37
  onAddDocument?: () => void;
24
38
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
25
39
  dataQa?: string;
40
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
41
+ error?: UploadZoneError | null;
42
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
43
+ errorCopy?: Partial<UploadZoneErrorCopy>;
44
+ /** Recovery action for the inline error CTA (retry or open the picker). */
45
+ onErrorAction?: () => void;
26
46
  }
27
47
 
@@ -1,16 +1,72 @@
1
1
  "use client";
2
2
  "use client";
3
3
  import { AddIcon as e } from "./AddIcon.js";
4
- import { SecurityIcon as t } from "./SecurityIcon.js";
5
- import { UploadDocIcon as n } from "./UploadDocIcon.js";
6
- import { Button as r } from "./Button.js";
7
- import { Markdown as i } from "./Markdown.js";
8
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
9
- import s from "clsx";
4
+ import { InfoIcon as t } from "./InfoIcon.js";
5
+ import { SecurityIcon as n } from "./SecurityIcon.js";
6
+ import { UploadDocIcon as r } from "./UploadDocIcon.js";
7
+ import { Button as i } from "./Button.js";
8
+ import { Markdown as a } from "./Markdown.js";
9
+ import { useEffect as o, useRef as s } from "react";
10
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
+ import u from "clsx";
10
12
  //#region lib/components/molecules/UploadZone.tsx
11
- var c = ({ uploadPromptText: c, addDocumentLabel: l, fileSizeText: u, disclaimer: d, title: f, description: p, trustLine: m, uploadIcon: h, variant: g = "default", containerClassName: _ = "", onAddDocument: v, onDropDocument: y, dataQa: b }) => {
12
- let x = g === "pdf-tools";
13
- return /* @__PURE__ */ o("div", {
13
+ var d = {
14
+ tooLarge: "File’s too large.",
15
+ unsupportedFormat: "Upload failed.",
16
+ generic: "Something went wrong. Please retry.",
17
+ retryLabel: "Try Again",
18
+ chooseFileLabel: "Choose Another File"
19
+ };
20
+ function f(e, t) {
21
+ return e === "too-large" ? t.tooLarge : e === "unsupported-format" ? t.unsupportedFormat : t.generic;
22
+ }
23
+ function p(e, t) {
24
+ return e === "generic" ? t.retryLabel : t.chooseFileLabel;
25
+ }
26
+ var m = ({ uploadPromptText: m, addDocumentLabel: h, fileSizeText: g, disclaimer: _, title: v, description: y, trustLine: b, uploadIcon: x, variant: S = "default", containerClassName: C = "", onAddDocument: w, onDropDocument: T, dataQa: E, error: D, errorCopy: O, onErrorAction: k }) => {
27
+ let A = S === "pdf-tools", j = s(null), M = s(void 0), N = D?.kind ?? null, P = {
28
+ ...d,
29
+ ...O
30
+ };
31
+ o(() => {
32
+ let e = M.current;
33
+ e !== void 0 && N !== null && N !== e && j.current?.focus(), M.current = N;
34
+ }, [N]);
35
+ let F = N ? /* @__PURE__ */ l("div", {
36
+ role: "alert",
37
+ "aria-live": "assertive",
38
+ "data-qa": E ? `${E}_error` : "upload-document-error",
39
+ className: "flex flex-col items-center gap-3",
40
+ children: [
41
+ /* @__PURE__ */ c(t, {
42
+ "aria-hidden": "true",
43
+ className: "h-6 w-6",
44
+ fill: "var(--color-error-500)"
45
+ }),
46
+ /* @__PURE__ */ c("p", {
47
+ className: "text-small md:text-medium text-neutral-600",
48
+ children: f(N, P)
49
+ }),
50
+ /* @__PURE__ */ c(i, {
51
+ ref: j,
52
+ dataQa: E ? `${E}_error_action` : void 0,
53
+ variant: "secondary-red",
54
+ className: "w-fit",
55
+ onClick: () => {
56
+ if (k) {
57
+ k();
58
+ return;
59
+ }
60
+ w?.();
61
+ },
62
+ children: /* @__PURE__ */ c("span", {
63
+ className: "text-medium font-bold",
64
+ children: p(N, P)
65
+ })
66
+ })
67
+ ]
68
+ }) : null;
69
+ return /* @__PURE__ */ l("div", {
14
70
  role: "presentation",
15
71
  "data-qa": "upload-document-dragover",
16
72
  onDragOver: (e) => {
@@ -20,87 +76,92 @@ var c = ({ uploadPromptText: c, addDocumentLabel: l, fileSizeText: u, disclaimer
20
76
  e.preventDefault();
21
77
  },
22
78
  onDrop: (e) => {
23
- e.preventDefault(), y?.(e);
79
+ e.preventDefault(), T?.(e);
24
80
  },
25
- className: s("rounded-3xl", x ? "w-full bg-white p-5 shadow-[0px_10px_30px_0px_rgba(2,55,74,0.06)]" : "group bg-neutral-200/50 p-4 backdrop-blur-xs md:max-w-80 lg:max-w-120 xl:max-w-140", _),
26
- children: [x && /* @__PURE__ */ o("div", {
27
- className: "border-primary-300 flex flex-col items-center gap-4 rounded-2xl border-[1.5px] border-dashed px-4 py-8 text-center md:px-6 lg:px-8 lg:py-10",
81
+ className: u("rounded-3xl", A ? "w-full bg-white p-5 shadow-[0px_10px_30px_0px_rgba(2,55,74,0.06)]" : "group bg-neutral-200/50 p-4 backdrop-blur-xs md:max-w-80 lg:max-w-120 xl:max-w-140", C),
82
+ children: [A && /* @__PURE__ */ l("div", {
83
+ className: u("flex flex-col items-center gap-4 rounded-2xl border-[1.5px] border-dashed px-4 py-8 text-center md:px-6 lg:px-8 lg:py-10", N ? "border-error-500" : "border-primary-300"),
28
84
  children: [
29
- /* @__PURE__ */ a("div", {
30
- className: "bg-primary-50 text-primary-800 flex h-13.5 w-13.5 items-center justify-center rounded-2xl",
31
- children: h ?? /* @__PURE__ */ a(n, { className: "h-6 w-6" })
85
+ /* @__PURE__ */ c("div", {
86
+ className: u("flex h-13.5 w-13.5 items-center justify-center rounded-2xl", N ? "bg-error-25 text-error-500" : "bg-primary-50 text-primary-800"),
87
+ children: x ?? /* @__PURE__ */ c(r, { className: "h-6 w-6" })
32
88
  }),
33
- (f || c || p) && /* @__PURE__ */ o("div", {
89
+ F,
90
+ !F && (v || m || y) && /* @__PURE__ */ l("div", {
34
91
  className: "flex flex-col gap-1.5",
35
92
  children: [
36
- f && /* @__PURE__ */ a("p", {
93
+ v && /* @__PURE__ */ c("p", {
37
94
  className: "text-big md:text-large font-bold text-neutral-800",
38
- children: f
95
+ children: v
39
96
  }),
40
- c && /* @__PURE__ */ a("p", {
97
+ m && /* @__PURE__ */ c("p", {
41
98
  className: "text-small text-neutral-600",
42
- children: c
99
+ children: m
43
100
  }),
44
- p && /* @__PURE__ */ a("p", {
101
+ y && /* @__PURE__ */ c("p", {
45
102
  className: "text-small md:text-medium text-neutral-600",
46
- children: p
103
+ children: y
47
104
  })
48
105
  ]
49
106
  }),
50
- /* @__PURE__ */ a(r, {
51
- dataQa: b,
107
+ !F && /* @__PURE__ */ c(i, {
108
+ dataQa: E,
52
109
  variant: "primary-green",
53
110
  className: "w-fit",
54
- onClick: v,
55
- children: /* @__PURE__ */ a("span", {
111
+ onClick: w,
112
+ children: /* @__PURE__ */ c("span", {
56
113
  className: "text-medium font-bold",
57
- children: l
114
+ children: h
58
115
  })
59
116
  }),
60
- u && /* @__PURE__ */ a("p", {
117
+ g && /* @__PURE__ */ c("p", {
61
118
  className: "text-extra-small md:text-small text-neutral-600",
62
- children: u
119
+ children: g
63
120
  }),
64
- m && /* @__PURE__ */ o("div", {
121
+ b && /* @__PURE__ */ l("div", {
65
122
  className: "flex items-start justify-center gap-1 text-left md:items-center",
66
- children: [/* @__PURE__ */ a(t, {
123
+ children: [/* @__PURE__ */ c(n, {
67
124
  className: "h-4 w-4 shrink-0",
68
125
  fill: "var(--color-neutral-600)"
69
- }), /* @__PURE__ */ a("p", {
126
+ }), /* @__PURE__ */ c("p", {
70
127
  className: "text-extra-small md:text-small text-neutral-600",
71
- children: m
128
+ children: b
72
129
  })]
73
130
  })
74
131
  ]
75
- }), !x && /* @__PURE__ */ o("div", {
132
+ }), !A && /* @__PURE__ */ l("div", {
76
133
  className: "bg-neutral-25 flex flex-col gap-14 rounded-2xl px-6 pt-14 pb-2 text-center",
77
- children: [/* @__PURE__ */ o("div", {
134
+ children: [/* @__PURE__ */ l("div", {
78
135
  className: "flex flex-col items-center gap-10",
79
- children: [c && /* @__PURE__ */ a("p", {
80
- className: "text-medium text-neutral-400 transition-all duration-500 group-hover:text-neutral-900",
81
- children: c
82
- }), /* @__PURE__ */ o(r, {
83
- dataQa: b,
84
- variant: "primary-green",
85
- className: "w-fit",
86
- onClick: v,
87
- children: [/* @__PURE__ */ a(e, {}), /* @__PURE__ */ a("span", {
88
- className: "text-medium font-bold",
89
- children: l
90
- })]
91
- })]
92
- }), /* @__PURE__ */ o("div", {
136
+ children: [
137
+ F,
138
+ !F && m && /* @__PURE__ */ c("p", {
139
+ className: "text-medium text-neutral-400 transition-all duration-500 group-hover:text-neutral-900",
140
+ children: m
141
+ }),
142
+ !F && /* @__PURE__ */ l(i, {
143
+ dataQa: E,
144
+ variant: "primary-green",
145
+ className: "w-fit",
146
+ onClick: w,
147
+ children: [/* @__PURE__ */ c(e, {}), /* @__PURE__ */ c("span", {
148
+ className: "text-medium font-bold",
149
+ children: h
150
+ })]
151
+ })
152
+ ]
153
+ }), /* @__PURE__ */ l("div", {
93
154
  className: "flex flex-col gap-2",
94
- children: [u && /* @__PURE__ */ a("p", {
155
+ children: [g && /* @__PURE__ */ c("p", {
95
156
  className: "text-extra-small text-neutral-400",
96
- children: u
97
- }), d && /* @__PURE__ */ a(i, {
157
+ children: g
158
+ }), _ && /* @__PURE__ */ c(a, {
98
159
  className: "text-tiny text-neutral-400 [&_a]:text-neutral-400",
99
- content: d
160
+ content: _
100
161
  })]
101
162
  })]
102
163
  })]
103
164
  });
104
165
  };
105
166
  //#endregion
106
- export { c as UploadZone };
167
+ export { m as UploadZone };
@@ -1456,6 +1456,20 @@ export declare interface UnsubscribeSectionProps {
1456
1456
 
1457
1457
  export declare const UploadDocIcon: React_2.FC<React_2.SVGProps<SVGSVGElement>>;
1458
1458
 
1459
+ export interface UploadZoneError {
1460
+ kind: UploadZoneErrorKind;
1461
+ }
1462
+
1463
+ export interface UploadZoneErrorCopy {
1464
+ tooLarge: string;
1465
+ unsupportedFormat: string;
1466
+ generic: string;
1467
+ retryLabel: string;
1468
+ chooseFileLabel: string;
1469
+ }
1470
+
1471
+ export type UploadZoneErrorKind = 'too-large' | 'unsupported-format' | 'generic';
1472
+
1459
1473
  export interface UploadZoneProps {
1460
1474
  uploadPromptText?: string;
1461
1475
  addDocumentLabel: string;
@@ -1470,6 +1484,12 @@ export interface UploadZoneProps {
1470
1484
  onAddDocument?: () => void;
1471
1485
  onDropDocument?: (e: React.DragEvent<HTMLDivElement>) => void;
1472
1486
  dataQa?: string;
1487
+ /** Inline error state: replaces the prompt block and keeps the zone droppable. */
1488
+ error?: UploadZoneError | null;
1489
+ /** Per-locale copy for the inline error state; missing entries fall back to English. */
1490
+ errorCopy?: Partial<UploadZoneErrorCopy>;
1491
+ /** Recovery action for the inline error CTA (retry or open the picker). */
1492
+ onErrorAction?: () => void;
1473
1493
  }
1474
1494
 
1475
1495
  export declare const UsFlagIcon: React_2.FC<React_2.SVGProps<SVGSVGElement>>;
package/dist/globals.css CHANGED
@@ -280,6 +280,11 @@ body {
280
280
  @apply btn-base border-error-500 text-error-500 hover:bg-error-25 border-2 bg-transparent font-semibold disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400;
281
281
  }
282
282
 
283
+ /* btn-base fija el focus ring en primary; los CTAs de error deben mantener el token rojo. */
284
+ .btn-secondary-red:focus-visible {
285
+ --tw-ring-color: var(--error-500);
286
+ }
287
+
283
288
  @utility btn-secondary-black {
284
289
  @apply btn-base border-2 border-neutral-600 bg-transparent font-semibold text-neutral-800 hover:bg-neutral-200 disabled:cursor-not-allowed disabled:border-neutral-200 disabled:bg-neutral-200 disabled:text-neutral-400;
285
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-contracts-ui",
3
- "version": "0.190.11",
3
+ "version": "0.190.501",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",