@alixpartners/ui-components 2.5.0 → 2.5.2

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 (35) hide show
  1. package/README.md +97 -97
  2. package/dist/RichTextEditor-CHGQT1Qj.js +363 -0
  3. package/dist/assets/Datepicker.css +1 -0
  4. package/dist/assets/DragAndDrop.css +1 -1
  5. package/dist/assets/FilePicker.css +1 -1
  6. package/dist/assets/RadioGroup.css +1 -1
  7. package/dist/assets/RichTextEditor.css +1 -0
  8. package/dist/components/Creatable/Creatable.js +1 -1
  9. package/dist/components/Datepicker/Datepicker.d.ts +22 -0
  10. package/dist/components/Datepicker/Datepicker.js +227 -0
  11. package/dist/components/Datepicker/Datepicker.test.d.ts +1 -0
  12. package/dist/components/Datepicker/Datepicker.test.js +40 -0
  13. package/dist/components/DragAndDrop/DragAndDrop.d.ts +4 -1
  14. package/dist/components/DragAndDrop/DragAndDrop.js +96 -84
  15. package/dist/components/DragAndDrop/DragAndDrop.test.js +179 -173
  16. package/dist/components/Dropdown/Dropdown.js +1 -1
  17. package/dist/components/NavBar/NavBar.js +1 -1
  18. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -1
  19. package/dist/components/RadioGroup/RadioGroup.js +16 -14
  20. package/dist/components/RadioGroup/RadioGroup.test.js +8 -0
  21. package/dist/components/RichTextEditor/RichTextEditor.d.ts +26 -0
  22. package/dist/components/RichTextEditor/RichTextEditor.js +10 -0
  23. package/dist/components/RichTextEditor/RichTextEditor.model.d.ts +12 -0
  24. package/dist/components/RichTextEditor/RichTextEditor.test.d.ts +1 -0
  25. package/dist/components/RichTextEditor/RichTextEditor.test.js +91 -0
  26. package/dist/components/SplitButton/SplitButton.js +1 -1
  27. package/dist/components/TagsFields/TagsFields.js +1 -1
  28. package/dist/components/Tooltip/Tooltip.js +1 -1
  29. package/dist/{index-C-3_YVJ1.js → index-D34Qo5Qx.js} +478 -473
  30. package/dist/{index-C4ffg1vf.js → index-DZ4Gof57.js} +1 -1
  31. package/dist/{index-D_3jWVyV.js → index-DgdVwltD.js} +1 -1
  32. package/dist/main.d.ts +2 -0
  33. package/dist/main.js +54 -50
  34. package/dist/web.config +8 -8
  35. package/package.json +88 -88
@@ -1,93 +1,99 @@
1
1
  import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
- import { d as y, i as l, r as p, g as e, s as o, v as c, w as f, f as B } from "../../vi.bdSIJ99Y-017e_Pkz.js";
3
- import d from "./DragAndDrop.js";
4
- import { c as T, d as I } from "../../DragAndDrop.utils-D3xTV9EK.js";
2
+ import { d as y, i as d, r, g as e, s as o, v as c, w as f, f as B } from "../../vi.bdSIJ99Y-017e_Pkz.js";
3
+ import l from "./DragAndDrop.js";
4
+ import { c as h, d as I } from "../../DragAndDrop.utils-D3xTV9EK.js";
5
5
  import { u as w } from "../../index-DkTDHhag.js";
6
6
  y("DragAndDrop", () => {
7
7
  y("Rendering", () => {
8
8
  y("Basic rendering", () => {
9
- l("should render component with required props", () => {
10
- p(/* @__PURE__ */ i(d, { label: "Upload File", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("Upload File")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-zone")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-input")).toBeInTheDocument();
11
- }), l("should not render label element when label prop is omitted", () => {
12
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.queryByText("Upload File")).not.toBeInTheDocument(), e(o.getByTestId("drag-and-drop-zone")).toBeInTheDocument();
13
- }), l("should render required asterisk when required prop is true", () => {
14
- p(/* @__PURE__ */ i(d, { label: "Upload File", required: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByTestId("drag-and-drop-required")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-required")).toHaveTextContent("*");
15
- }), l("should not render required asterisk when required prop is false", () => {
16
- p(/* @__PURE__ */ i(d, { label: "Upload File", required: !1, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.queryByTestId("drag-and-drop-required")).not.toBeInTheDocument();
17
- }), l("should render browse button with default text for single file", () => {
18
- p(/* @__PURE__ */ i(d, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
9
+ d("should render component with required props", () => {
10
+ r(/* @__PURE__ */ i(l, { label: "Upload File", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("Upload File")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-zone")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-input")).toBeInTheDocument();
11
+ }), d("should not render label element when label prop is omitted", () => {
12
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.queryByText("Upload File")).not.toBeInTheDocument(), e(o.getByTestId("drag-and-drop-zone")).toBeInTheDocument();
13
+ }), d("should render required asterisk when required prop is true", () => {
14
+ r(/* @__PURE__ */ i(l, { label: "Upload File", required: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByTestId("drag-and-drop-required")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-required")).toHaveTextContent("*");
15
+ }), d("should not render required asterisk when required prop is false", () => {
16
+ r(/* @__PURE__ */ i(l, { label: "Upload File", required: !1, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.queryByTestId("drag-and-drop-required")).not.toBeInTheDocument();
17
+ }), d("should render browse button with default text for single file", () => {
18
+ r(/* @__PURE__ */ i(l, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
19
19
  const t = o.getByText("Browse file");
20
20
  e(t).toBeInTheDocument();
21
- }), l("should render browse button with default text for multiple files", () => {
22
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
21
+ }), d("should render browse button with default text for multiple files", () => {
22
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
23
23
  const t = o.getByText("Browse files");
24
24
  e(t).toBeInTheDocument();
25
- }), l("should render drag text for single file", () => {
26
- p(/* @__PURE__ */ i(d, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("or drag your file")).toBeInTheDocument();
27
- }), l("should render drag text for multiple files", () => {
28
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("or drag multiple files")).toBeInTheDocument();
29
- }), l("should render file list when files are present", async () => {
25
+ }), d("should render drag text for single file", () => {
26
+ r(/* @__PURE__ */ i(l, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("or drag your file")).toBeInTheDocument();
27
+ }), d("should render drag text for multiple files", () => {
28
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), e(o.getByText("or drag multiple files")).toBeInTheDocument();
29
+ }), d("should render file list when files are present", async () => {
30
30
  const t = new File(["test"], "test.pdf", {
31
31
  type: "application/pdf"
32
32
  }), a = c.fn();
33
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
33
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
34
34
  const n = o.getByTestId("drag-and-drop-input");
35
35
  await w.upload(n, t), await f(() => {
36
36
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument();
37
37
  });
38
38
  });
39
39
  }), y("Disabled state", () => {
40
- l("should render browse button as enabled by default", () => {
41
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
40
+ d("should render browse button as enabled by default", () => {
41
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
42
42
  const t = o.getByText("Browse file");
43
43
  e(t).not.toBeDisabled();
44
- }), l("should render browse button as disabled when disabled prop is true", () => {
45
- p(/* @__PURE__ */ i(d, { disabled: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
44
+ }), d("should render browse button as disabled when disabled prop is true", () => {
45
+ r(/* @__PURE__ */ i(l, { disabled: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 }));
46
46
  const t = o.getByTestId("button");
47
47
  e(t).toBeDisabled();
48
48
  });
49
49
  }), y("CSS Classes", () => {
50
- l("should apply disabled CSS class to container when disabled prop is true", () => {
50
+ d("should apply disabled CSS class to container when disabled prop is true", () => {
51
51
  const {
52
52
  container: t
53
- } = p(/* @__PURE__ */ i(d, { disabled: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), a = t.firstChild;
53
+ } = r(/* @__PURE__ */ i(l, { disabled: !0, fileExtensionsAllowed: ["pdf"], maxSize: 5 })), a = t.firstChild;
54
54
  e(a.className).toContain("disabled");
55
- }), l("should merge custom className with default container classes", () => {
55
+ }), d("should merge custom className with default container classes", () => {
56
56
  const {
57
57
  container: t
58
- } = p(/* @__PURE__ */ i(d, { className: "custom-class", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), a = t.firstChild;
58
+ } = r(/* @__PURE__ */ i(l, { className: "custom-class", fileExtensionsAllowed: ["pdf"], maxSize: 5 })), a = t.firstChild;
59
59
  e(a.className).toContain("custom-class");
60
60
  });
61
61
  });
62
62
  }), y("Text Customization", () => {
63
- l("should use custom browse text when provided as string", () => {
64
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
63
+ d("should use custom browse text when provided as string", () => {
64
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
65
65
  browse: "Select File"
66
66
  } })), e(o.getByText("Select File")).toBeInTheDocument();
67
- }), l("should use custom browse text when provided as function", () => {
68
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
67
+ }), d("should use custom browse text when provided as function", () => {
68
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
69
69
  browse: (t) => t === "single" ? "Choose One" : "Choose Many"
70
70
  } })), e(o.getByText("Choose Many")).toBeInTheDocument();
71
- }), l("should use custom drag text when provided as string", () => {
72
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
71
+ }), d("should use custom drag text when provided as string", () => {
72
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
73
73
  drag: "or drop here"
74
74
  } })), e(o.getByText("or drop here")).toBeInTheDocument();
75
- }), l("should use custom drag text when provided as function", () => {
76
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
75
+ }), d("should use custom drag text when provided as function", () => {
76
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, texts: {
77
77
  drag: (t) => t === "single" ? "drop one" : "drop many"
78
78
  } })), e(o.getByText("drop many")).toBeInTheDocument();
79
- }), l("should use custom constraints text when provided", () => {
80
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf", "doc"], maxSize: 10, texts: {
79
+ }), d("should use custom constraints text when provided", () => {
80
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf", "doc"], maxSize: 10, texts: {
81
81
  constraints: ({
82
82
  extensions: t,
83
83
  maxSize: a
84
84
  }) => `Formats: ${t.join(", ")}. Max: ${a}MB`
85
85
  } })), e(o.getByText(/Formats: pdf, doc. Max: 10MB/)).toBeInTheDocument();
86
- }), l("should use custom error messages when provided", async () => {
86
+ }), d("should use constraintsText when provided", () => {
87
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, constraintsText: "PDF only, max 5 MB per file." })), e(o.getByText("PDF only, max 5 MB per file.")).toBeInTheDocument();
88
+ }), d("should prefer constraintsText over texts.constraints", () => {
89
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, constraintsText: "From prop", texts: {
90
+ constraints: () => "From texts"
91
+ } })), e(o.getByText("From prop")).toBeInTheDocument(), e(o.queryByText("From texts")).not.toBeInTheDocument();
92
+ }), d("should use custom error messages when provided", async () => {
87
93
  const t = new File(["x".repeat(10485760)], "large.pdf", {
88
94
  type: "application/pdf"
89
95
  }), a = c.fn();
90
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 1, onUpload: a, texts: {
96
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 1, onUpload: a, texts: {
91
97
  errors: {
92
98
  sizeTooLarge: (s) => `File is too big! Maximum is ${s}MB`
93
99
  }
@@ -98,55 +104,55 @@ y("DragAndDrop", () => {
98
104
  });
99
105
  });
100
106
  }), y("Icon Customization", () => {
101
- l("should use custom file icon when provided", async () => {
107
+ d("should use custom file icon when provided", async () => {
102
108
  const t = new File(["test"], "test.pdf", {
103
109
  type: "application/pdf"
104
110
  }), a = c.fn();
105
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, fileIcon: "ap-icon-document-rpm" }));
111
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, fileIcon: "ap-icon-document-rpm" }));
106
112
  const n = o.getByTestId("drag-and-drop-input");
107
113
  await w.upload(n, t), await f(() => {
108
114
  const s = o.getByTestId("drag-and-drop-file-item-0").querySelector(".ap-icon-document-rpm");
109
115
  e(s).toBeInTheDocument();
110
116
  });
111
- }), l("should use custom error icon when provided", async () => {
117
+ }), d("should use custom error icon when provided", async () => {
112
118
  const t = new File(["test"], "test.txt", {
113
119
  type: "text/plain"
114
120
  }), a = c.fn();
115
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errorIcon: "ap-icon-alert-filled" }));
121
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errorIcon: "ap-icon-alert-filled" }));
116
122
  const n = o.getByTestId("drag-and-drop-input"), s = new DataTransfer();
117
123
  s.items.add(t), Object.defineProperty(n, "files", {
118
124
  value: s.files,
119
125
  writable: !1
120
126
  }), B.change(n), await f(() => {
121
- const r = o.getByTestId("drag-and-drop-file-error-0");
122
- e(r).toBeInTheDocument();
123
- const u = r.querySelector(".ap-icon-alert-filled");
127
+ const p = o.getByTestId("drag-and-drop-file-error-0");
128
+ e(p).toBeInTheDocument();
129
+ const u = p.querySelector(".ap-icon-alert-filled");
124
130
  e(u).toBeInTheDocument();
125
131
  });
126
- }), l("should use custom browse button icon when provided", () => {
127
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, browseButtonIcon: "ap-icon-upload" }));
132
+ }), d("should use custom browse button icon when provided", () => {
133
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, browseButtonIcon: "ap-icon-upload" }));
128
134
  const t = o.getByTestId("button-icon");
129
135
  e(t).toBeInTheDocument(), e(t.className).toContain("ap-icon-upload");
130
136
  });
131
137
  }), y("Render Props", () => {
132
- l("should use custom renderFileItem when provided", async () => {
138
+ d("should use custom renderFileItem when provided", async () => {
133
139
  const t = new File(["test"], "test.pdf", {
134
140
  type: "application/pdf"
135
- }), a = c.fn(), n = c.fn((r, u, g) => /* @__PURE__ */ v("div", { children: [
141
+ }), a = c.fn(), n = c.fn((p, u, g) => /* @__PURE__ */ v("div", { children: [
136
142
  "Custom: ",
137
- r.file.name,
143
+ p.file.name,
138
144
  /* @__PURE__ */ i("button", { onClick: g, children: "Remove" })
139
145
  ] }));
140
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, renderFileItem: n }));
146
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, renderFileItem: n }));
141
147
  const s = o.getByTestId("drag-and-drop-input");
142
148
  await w.upload(s, t), await f(() => {
143
149
  e(o.getByTestId("custom-file-item")).toBeInTheDocument(), e(o.getByText("Custom: test.pdf")).toBeInTheDocument(), e(n).toHaveBeenCalledTimes(1);
144
150
  });
145
- }), l("should call renderFileItem with correct parameters", async () => {
151
+ }), d("should call renderFileItem with correct parameters", async () => {
146
152
  const t = new File(["test"], "test.pdf", {
147
153
  type: "application/pdf"
148
- }), a = c.fn(), n = c.fn((r, u, g) => /* @__PURE__ */ i("div", { children: "Custom" }));
149
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, renderFileItem: n }));
154
+ }), a = c.fn(), n = c.fn((p, u, g) => /* @__PURE__ */ i("div", { children: "Custom" }));
155
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, renderFileItem: n }));
150
156
  const s = o.getByTestId("drag-and-drop-input");
151
157
  await w.upload(s, t), await f(() => {
152
158
  e(n).toHaveBeenCalledWith(e.objectContaining({
@@ -156,22 +162,22 @@ y("DragAndDrop", () => {
156
162
  });
157
163
  });
158
164
  }), y("File Size Formatter", () => {
159
- l("should use custom fileSizeFormatter when provided", async () => {
165
+ d("should use custom fileSizeFormatter when provided", async () => {
160
166
  const t = new File(["test"], "test.pdf", {
161
167
  type: "application/pdf"
162
- }), a = c.fn(), n = c.fn((r) => `${(r / 1024).toFixed(0)} KB`);
163
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, fileSizeFormatter: n }));
168
+ }), a = c.fn(), n = c.fn((p) => `${(p / 1024).toFixed(0)} KB`);
169
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, fileSizeFormatter: n }));
164
170
  const s = o.getByTestId("drag-and-drop-input");
165
171
  await w.upload(s, t), await f(() => {
166
172
  e(n).toHaveBeenCalled();
167
- const r = o.getByTestId("drag-and-drop-file-size-0");
168
- e(r.textContent).toBe(`${Math.round(t.size / 1024)} KB`);
173
+ const p = o.getByTestId("drag-and-drop-file-size-0");
174
+ e(p.textContent).toBe(`${Math.round(t.size / 1024)} KB`);
169
175
  });
170
- }), l("should use default formatter when fileSizeFormatter is not provided", async () => {
176
+ }), d("should use default formatter when fileSizeFormatter is not provided", async () => {
171
177
  const t = new File(["test"], "test.pdf", {
172
178
  type: "application/pdf"
173
179
  }), a = c.fn();
174
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
180
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
175
181
  const n = o.getByTestId("drag-and-drop-input");
176
182
  await w.upload(n, t), await f(() => {
177
183
  const s = o.getByTestId("drag-and-drop-file-size-0");
@@ -179,8 +185,8 @@ y("DragAndDrop", () => {
179
185
  });
180
186
  });
181
187
  }), y("Button Customization", () => {
182
- l("should apply browseButtonProps to browse button", () => {
183
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, browseButtonProps: {
188
+ d("should apply browseButtonProps to browse button", () => {
189
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, browseButtonProps: {
184
190
  type: "primary",
185
191
  variant: "danger",
186
192
  size: "md"
@@ -189,146 +195,146 @@ y("DragAndDrop", () => {
189
195
  e(t.className).toContain("btn-primary"), e(t.className).toContain("btn-danger"), e(t.className).toContain("btn-md");
190
196
  });
191
197
  }), y("File Upload Interactions", () => {
192
- l("should call onUpload when file is selected", async () => {
198
+ d("should call onUpload when file is selected", async () => {
193
199
  const t = new File(["test"], "test.pdf", {
194
200
  type: "application/pdf"
195
201
  }), a = c.fn();
196
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
202
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
197
203
  const n = o.getByTestId("drag-and-drop-input");
198
204
  await w.upload(n, t), await f(() => {
199
205
  e(a).toHaveBeenCalledTimes(1), e(a).toHaveBeenCalledWith(e.arrayContaining([e.objectContaining({
200
206
  file: e.any(File)
201
207
  })]));
202
208
  });
203
- }), l("should handle multiple file selection", async () => {
209
+ }), d("should handle multiple file selection", async () => {
204
210
  const t = new File(["test1"], "test1.pdf", {
205
211
  type: "application/pdf"
206
212
  }), a = new File(["test2"], "test2.pdf", {
207
213
  type: "application/pdf"
208
214
  }), n = c.fn();
209
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n }));
215
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n }));
210
216
  const s = o.getByTestId("drag-and-drop-input");
211
217
  await w.upload(s, [t, a]), await f(() => {
212
218
  e(n).toHaveBeenCalledTimes(1);
213
- const r = n.mock.calls[0][0];
214
- e(r).toHaveLength(2);
219
+ const p = n.mock.calls[0][0];
220
+ e(p).toHaveLength(2);
215
221
  });
216
- }), l("should call onRemoveFile when remove button is clicked", async () => {
222
+ }), d("should call onRemoveFile when remove button is clicked", async () => {
217
223
  const t = new File(["test"], "test.pdf", {
218
224
  type: "application/pdf"
219
225
  }), a = c.fn(), n = c.fn();
220
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, onRemoveFile: n }));
226
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, onRemoveFile: n }));
221
227
  const s = o.getByTestId("drag-and-drop-input");
222
228
  await w.upload(s, t), await f(() => {
223
229
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument();
224
230
  });
225
- const r = o.getByTestId("drag-and-drop-remove-0");
226
- B.click(r), e(n).toHaveBeenCalledTimes(1);
231
+ const p = o.getByTestId("drag-and-drop-remove-0");
232
+ B.click(p), e(n).toHaveBeenCalledTimes(1);
227
233
  const [u, g] = n.mock.calls[0];
228
234
  e(u).toBe(t), e(g).toHaveLength(0), await f(() => {
229
235
  e(o.queryByTestId("drag-and-drop-files-list")).not.toBeInTheDocument();
230
236
  });
231
- }), l("should queue files when queueFiles is true", async () => {
237
+ }), d("should queue files when queueFiles is true", async () => {
232
238
  const t = new File(["test1"], "test1.pdf", {
233
239
  type: "application/pdf"
234
240
  }), a = new File(["test2"], "test2.pdf", {
235
241
  type: "application/pdf"
236
242
  }), n = c.fn();
237
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n, queueFiles: !0 }));
243
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n, queueFiles: !0 }));
238
244
  const s = o.getByTestId("drag-and-drop-input");
239
245
  await w.upload(s, t), await f(() => {
240
246
  e(n).toHaveBeenCalledTimes(1);
241
247
  }), await w.upload(s, a), await f(() => {
242
248
  e(n).toHaveBeenCalledTimes(2);
243
- const r = n.mock.calls[1][0];
244
- e(r.length).toBeGreaterThan(1);
249
+ const p = n.mock.calls[1][0];
250
+ e(p.length).toBeGreaterThan(1);
245
251
  });
246
252
  });
247
253
  }), y("Drag and Drop Interactions", () => {
248
- l("should handle drag over event", () => {
254
+ d("should handle drag over event", () => {
249
255
  const t = c.fn();
250
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onDragOver: t }));
256
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onDragOver: t }));
251
257
  const a = o.getByTestId("drag-and-drop-zone");
252
258
  B.dragOver(a), e(t).toHaveBeenCalledTimes(1);
253
- }), l("should handle drag leave event", () => {
259
+ }), d("should handle drag leave event", () => {
254
260
  const t = c.fn();
255
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onDragLeave: t }));
261
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onDragLeave: t }));
256
262
  const a = o.getByTestId("drag-and-drop-zone");
257
263
  B.dragLeave(a), e(t).toHaveBeenCalledTimes(1);
258
- }), l("should handle drop event and call onUpload", async () => {
264
+ }), d("should handle drop event and call onUpload", async () => {
259
265
  const t = new File(["test"], "test.pdf", {
260
266
  type: "application/pdf"
261
267
  }), a = c.fn(), n = c.fn();
262
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, onDrop: n }));
263
- const s = o.getByTestId("drag-and-drop-zone"), r = {
268
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, onDrop: n }));
269
+ const s = o.getByTestId("drag-and-drop-zone"), p = {
264
270
  files: [t],
265
271
  clearData: c.fn()
266
272
  };
267
273
  B.drop(s, {
268
- dataTransfer: r
274
+ dataTransfer: p
269
275
  }), await f(() => {
270
276
  e(n).toHaveBeenCalledTimes(1), e(a).toHaveBeenCalledTimes(1);
271
277
  });
272
278
  });
273
279
  }), y("Validation", () => {
274
- l("should validate file size and show error for oversized files", async () => {
280
+ d("should validate file size and show error for oversized files", async () => {
275
281
  const t = new File(["x".repeat(10485760)], "large.pdf", {
276
282
  type: "application/pdf"
277
283
  }), a = c.fn();
278
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 1, onUpload: a }));
284
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 1, onUpload: a }));
279
285
  const n = o.getByTestId("drag-and-drop-input");
280
286
  await w.upload(n, t), await f(() => {
281
287
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument();
282
288
  const s = o.getByTestId("drag-and-drop-file-error-0");
283
289
  e(s.textContent).toContain("too large");
284
290
  });
285
- }), l("should validate file extension and show error for invalid extensions", async () => {
291
+ }), d("should validate file extension and show error for invalid extensions", async () => {
286
292
  const t = new File(["test"], "test.txt", {
287
293
  type: "text/plain"
288
294
  }), a = c.fn();
289
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
295
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
290
296
  const n = o.getByTestId("drag-and-drop-input"), s = new DataTransfer();
291
297
  s.items.add(t), Object.defineProperty(n, "files", {
292
298
  value: s.files,
293
299
  writable: !1
294
300
  }), B.change(n), await f(() => {
295
301
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument();
296
- const r = o.getByTestId("drag-and-drop-file-error-0");
297
- e(r.textContent).toContain("format is incorrect");
302
+ const p = o.getByTestId("drag-and-drop-file-error-0");
303
+ e(p.textContent).toContain("format is incorrect");
298
304
  });
299
- }), l("should use custom validator when provided", async () => {
305
+ }), d("should use custom validator when provided", async () => {
300
306
  const t = new File(["test"], "test.pdf", {
301
307
  type: "application/pdf"
302
308
  }), a = c.fn(), n = c.fn(
303
309
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
304
- (r, u) => r.name.includes("test") ? {
305
- file: r,
310
+ (p, u) => p.name.includes("test") ? {
311
+ file: p,
306
312
  error: 'Files with "test" in name are not allowed'
307
313
  } : {
308
- file: r
314
+ file: p
309
315
  }
310
316
  );
311
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, validator: n }));
317
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, validator: n }));
312
318
  const s = o.getByTestId("drag-and-drop-input");
313
319
  await w.upload(s, t), await f(() => {
314
320
  e(n).toHaveBeenCalledTimes(1), e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText('Files with "test" in name are not allowed')).toBeInTheDocument();
315
321
  });
316
- }), l("should execute synchronous custom validator and display returned error message", async () => {
322
+ }), d("should execute synchronous custom validator and display returned error message", async () => {
317
323
  const t = new File(["test"], "test.pdf", {
318
324
  type: "application/pdf"
319
325
  }), a = c.fn(), n = c.fn(
320
326
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
321
- (r, u) => ({
322
- file: r,
327
+ (p, u) => ({
328
+ file: p,
323
329
  error: "Synchronous validation failed"
324
330
  })
325
331
  );
326
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, validator: n }));
332
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, validator: n }));
327
333
  const s = o.getByTestId("drag-and-drop-input");
328
334
  await w.upload(s, t), await f(() => {
329
335
  e(n).toHaveBeenCalledTimes(1), e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText("Synchronous validation failed")).toBeInTheDocument();
330
336
  });
331
- }), l("should accept first N files and mark excess files with error when maxFiles limit is exceeded", async () => {
337
+ }), d("should accept first N files and mark excess files with error when maxFiles limit is exceeded", async () => {
332
338
  const t = new File(["test1"], "test1.pdf", {
333
339
  type: "application/pdf"
334
340
  }), a = new File(["test2"], "test2.pdf", {
@@ -336,53 +342,53 @@ y("DragAndDrop", () => {
336
342
  }), n = new File(["test3"], "test3.pdf", {
337
343
  type: "application/pdf"
338
344
  }), s = c.fn();
339
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, maxFiles: 2, onUpload: s }));
340
- const r = o.getByTestId("drag-and-drop-input");
341
- await w.upload(r, [t, a, n]), await f(() => {
345
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, maxFiles: 2, onUpload: s }));
346
+ const p = o.getByTestId("drag-and-drop-input");
347
+ await w.upload(p, [t, a, n]), await f(() => {
342
348
  e(s).toHaveBeenCalledTimes(1);
343
349
  const u = s.mock.calls[0][0];
344
350
  e(u).toHaveLength(3), e(u[0].error).toBeUndefined(), e(u[1].error).toBeUndefined(), e(u[2].error).toContain("Maximum 2 files allowed");
345
351
  });
346
- }), l("should only accept first file when type is single and multiple files are dropped", async () => {
352
+ }), d("should only accept first file when type is single and multiple files are dropped", async () => {
347
353
  const t = new File(["test1"], "test1.pdf", {
348
354
  type: "application/pdf"
349
355
  }), a = new File(["test2"], "test2.pdf", {
350
356
  type: "application/pdf"
351
357
  }), n = c.fn();
352
- p(/* @__PURE__ */ i(d, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n }));
358
+ r(/* @__PURE__ */ i(l, { type: "single", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n }));
353
359
  const s = o.getByTestId("drag-and-drop-input");
354
360
  await w.upload(s, [t, a]), await f(() => {
355
361
  e(n).toHaveBeenCalledTimes(1);
356
- const r = n.mock.calls[0][0];
357
- e(r).toHaveLength(1);
362
+ const p = n.mock.calls[0][0];
363
+ e(p).toHaveLength(1);
358
364
  });
359
365
  });
360
366
  }), y("Controlled Mode", () => {
361
- l("should use controlled value when value prop is provided", async () => {
367
+ d("should use controlled value when value prop is provided", async () => {
362
368
  const t = new File(["test"], "test.pdf", {
363
369
  type: "application/pdf"
364
370
  }), a = c.fn(), {
365
371
  rerender: n
366
- } = p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, value: t, onUpload: a }));
372
+ } = r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, value: t, onUpload: a }));
367
373
  await f(() => {
368
374
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent("test.pdf");
369
375
  });
370
376
  const s = new File(["new"], "new.pdf", {
371
377
  type: "application/pdf"
372
378
  });
373
- n(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, value: s, onUpload: a })), await f(() => {
379
+ n(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, value: s, onUpload: a })), await f(() => {
374
380
  e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent("new.pdf");
375
381
  });
376
- }), l("should use controlled value array when value prop is array", async () => {
382
+ }), d("should use controlled value array when value prop is array", async () => {
377
383
  const t = new File(["test1"], "test1.pdf", {
378
384
  type: "application/pdf"
379
385
  }), a = new File(["test2"], "test2.pdf", {
380
386
  type: "application/pdf"
381
387
  }), n = c.fn();
382
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: [t, a], onUpload: n })), await f(() => {
388
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: [t, a], onUpload: n })), await f(() => {
383
389
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument(), e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent("test1.pdf"), e(o.getByTestId("drag-and-drop-file-name-1")).toHaveTextContent("test2.pdf");
384
390
  });
385
- }), l("should remove files by filename in controlled mode", async () => {
391
+ }), d("should remove files by filename in controlled mode", async () => {
386
392
  const t = new File(["test1"], "test1.pdf", {
387
393
  type: "application/pdf"
388
394
  }), a = new File(["test2"], "test2.pdf", {
@@ -391,128 +397,128 @@ y("DragAndDrop", () => {
391
397
  let n = [];
392
398
  const s = c.fn((m) => {
393
399
  n = m;
394
- }), r = c.fn((m, h) => {
395
- n = h;
400
+ }), p = c.fn((m, T) => {
401
+ n = T;
396
402
  }), {
397
403
  rerender: u
398
- } = p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: r })), g = o.getByTestId("drag-and-drop-input");
404
+ } = r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: p })), g = o.getByTestId("drag-and-drop-input");
399
405
  await w.upload(g, [t, a]), await f(() => {
400
406
  e(s).toHaveBeenCalled(), e(n.length).toBe(2);
401
- }), u(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: r })), await f(() => {
407
+ }), u(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: p })), await f(() => {
402
408
  e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent("test1.pdf"), e(o.getByTestId("drag-and-drop-file-name-1")).toHaveTextContent("test2.pdf");
403
409
  });
404
410
  const x = o.getByTestId("drag-and-drop-remove-0");
405
411
  B.click(x), await f(() => {
406
- e(r).toHaveBeenCalledTimes(1);
407
- const [m, h] = r.mock.calls[0];
408
- e(m).toBe(t), e(h).toHaveLength(1), e(h[0].file).toBe(a);
409
- }), e(n.length).toBe(1), e(n.find((m) => m.file.name === "test1.pdf")).toBeUndefined(), u(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: r })), await f(() => {
412
+ e(p).toHaveBeenCalledTimes(1);
413
+ const [m, T] = p.mock.calls[0];
414
+ e(m).toBe(t), e(T).toHaveLength(1), e(T[0].file).toBe(a);
415
+ }), e(n.length).toBe(1), e(n.find((m) => m.file.name === "test1.pdf")).toBeUndefined(), u(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, value: n.map((m) => m.file), onUpload: s, onRemoveFile: p })), await f(() => {
410
416
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument();
411
417
  const m = n[0];
412
418
  e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent(m.file.name), e(o.queryByTestId("drag-and-drop-file-name-1")).not.toBeInTheDocument();
413
419
  });
414
420
  });
415
421
  }), y("File Display", () => {
416
- l("should display file name", async () => {
422
+ d("should display file name", async () => {
417
423
  const t = new File(["test"], "test.pdf", {
418
424
  type: "application/pdf"
419
425
  }), a = c.fn();
420
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
426
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
421
427
  const n = o.getByTestId("drag-and-drop-input");
422
428
  await w.upload(n, t), await f(() => {
423
429
  e(o.getByTestId("drag-and-drop-file-name-0")).toHaveTextContent("test.pdf");
424
430
  });
425
- }), l("should display file size", async () => {
431
+ }), d("should display file size", async () => {
426
432
  const t = new File(["test"], "test.pdf", {
427
433
  type: "application/pdf"
428
434
  }), a = c.fn();
429
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
435
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
430
436
  const n = o.getByTestId("drag-and-drop-input");
431
437
  await w.upload(n, t), await f(() => {
432
438
  e(o.getByTestId("drag-and-drop-file-size-0")).toBeInTheDocument();
433
439
  });
434
- }), l("should display error message when file has error", async () => {
440
+ }), d("should display error message when file has error", async () => {
435
441
  const t = new File(["test"], "test.txt", {
436
442
  type: "text/plain"
437
443
  }), a = c.fn();
438
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
444
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a }));
439
445
  const n = o.getByTestId("drag-and-drop-input"), s = new DataTransfer();
440
446
  s.items.add(t), Object.defineProperty(n, "files", {
441
447
  value: s.files,
442
448
  writable: !1
443
449
  }), B.change(n), await f(() => {
444
450
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument();
445
- const r = o.getByTestId("drag-and-drop-file-error-0");
446
- e(r.textContent).toContain("format is incorrect");
451
+ const p = o.getByTestId("drag-and-drop-file-error-0");
452
+ e(p.textContent).toContain("format is incorrect");
447
453
  });
448
454
  });
449
455
  }), y("External Errors Prop", () => {
450
- l("should display external errors when no validator errors exist", async () => {
456
+ d("should display external errors when no validator errors exist", async () => {
451
457
  const t = new File(["test"], "test.pdf", {
452
458
  type: "application/pdf"
453
459
  }), a = c.fn();
454
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errors: {
460
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errors: {
455
461
  "test.pdf": "Custom external error message"
456
462
  } }));
457
463
  const s = o.getByTestId("drag-and-drop-input");
458
464
  await w.upload(s, t), await f(() => {
459
465
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText("Custom external error message")).toBeInTheDocument();
460
466
  });
461
- }), l("should hide external errors when validator errors exist (precedence)", async () => {
467
+ }), d("should hide external errors when validator errors exist (precedence)", async () => {
462
468
  const t = new File(["test"], "test.txt", {
463
469
  type: "text/plain"
464
470
  }), a = c.fn();
465
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errors: {
471
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, errors: {
466
472
  "test.txt": "Custom external error message"
467
473
  } }));
468
- const s = o.getByTestId("drag-and-drop-input"), r = new DataTransfer();
469
- r.items.add(t), Object.defineProperty(s, "files", {
470
- value: r.files,
474
+ const s = o.getByTestId("drag-and-drop-input"), p = new DataTransfer();
475
+ p.items.add(t), Object.defineProperty(s, "files", {
476
+ value: p.files,
471
477
  writable: !1
472
478
  }), B.change(s), await f(() => {
473
479
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText(/format is incorrect/)).toBeInTheDocument(), e(o.queryByText("Custom external error message")).not.toBeInTheDocument();
474
480
  });
475
- }), l("should update external errors when errors prop changes", async () => {
481
+ }), d("should update external errors when errors prop changes", async () => {
476
482
  const t = new File(["test"], "test.pdf", {
477
483
  type: "application/pdf"
478
484
  }), a = c.fn(), {
479
485
  rerender: n
480
- } = p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t }));
486
+ } = r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t }));
481
487
  await f(() => {
482
488
  e(o.getByTestId("drag-and-drop-files-list")).toBeInTheDocument(), e(o.queryByTestId("drag-and-drop-file-error-0")).not.toBeInTheDocument();
483
- }), n(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {
489
+ }), n(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {
484
490
  "test.pdf": "New error message"
485
491
  } })), await f(() => {
486
492
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText("New error message")).toBeInTheDocument();
487
493
  });
488
- }), l("should clear external errors when errors prop is cleared", async () => {
494
+ }), d("should clear external errors when errors prop is cleared", async () => {
489
495
  const t = new File(["test"], "test.pdf", {
490
496
  type: "application/pdf"
491
497
  }), a = c.fn(), {
492
498
  rerender: n
493
- } = p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {
499
+ } = r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {
494
500
  "test.pdf": "Error message"
495
501
  } }));
496
502
  await f(() => {
497
503
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument();
498
- }), n(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {} })), await f(() => {
504
+ }), n(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: a, value: t, errors: {} })), await f(() => {
499
505
  e(o.queryByTestId("drag-and-drop-file-error-0")).not.toBeInTheDocument();
500
506
  });
501
- }), l("should handle external errors with duplicate filenames correctly", async () => {
507
+ }), d("should handle external errors with duplicate filenames correctly", async () => {
502
508
  const t = new File(["test1"], "test.pdf", {
503
509
  type: "application/pdf"
504
510
  }), a = new File(["test2"], "test.pdf", {
505
511
  type: "application/pdf"
506
512
  }), n = c.fn();
507
- p(/* @__PURE__ */ i(d, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n, value: [t, a], errors: {
513
+ r(/* @__PURE__ */ i(l, { type: "multiple", fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: n, value: [t, a], errors: {
508
514
  "test.pdf": "Error for duplicate filename"
509
515
  } })), await f(() => {
510
- const r = o.getAllByTestId(/drag-and-drop-file-error-/);
511
- e(r.length).toBeGreaterThan(0);
516
+ const p = o.getAllByTestId(/drag-and-drop-file-error-/);
517
+ e(p.length).toBeGreaterThan(0);
512
518
  });
513
519
  });
514
520
  }), y("composeValidators", () => {
515
- l("should compose multiple validators correctly", () => {
521
+ d("should compose multiple validators correctly", () => {
516
522
  const t = c.fn((m) => m.name.includes("test") ? {
517
523
  file: m,
518
524
  error: "Validator 1 error"
@@ -523,72 +529,72 @@ y("DragAndDrop", () => {
523
529
  error: "Validator 2 error"
524
530
  } : {
525
531
  file: m
526
- }), n = T(t, a), s = {
532
+ }), n = h(t, a), s = {
527
533
  maxSize: 5,
528
534
  fileExtensionsAllowed: ["pdf"],
529
535
  type: "single",
530
536
  maxFiles: 1
531
- }, r = new File(["test"], "test.pdf", {
537
+ }, p = new File(["test"], "test.pdf", {
532
538
  type: "application/pdf"
533
- }), u = n(r, s);
539
+ }), u = n(p, s);
534
540
  e(u.error).toBe("Validator 1 error"), e(t).toHaveBeenCalledTimes(1), e(a).not.toHaveBeenCalled();
535
541
  const g = new File(["x".repeat(2e3)], "valid.pdf", {
536
542
  type: "application/pdf"
537
543
  }), x = n(g, s);
538
544
  e(x.error).toBe("Validator 2 error"), e(a).toHaveBeenCalledTimes(1);
539
- }), l("should return first error encountered", () => {
545
+ }), d("should return first error encountered", () => {
540
546
  const t = c.fn((g) => ({
541
547
  file: g,
542
548
  error: "First error"
543
549
  })), a = c.fn((g) => ({
544
550
  file: g,
545
551
  error: "Second error"
546
- })), n = T(t, a), s = {
552
+ })), n = h(t, a), s = {
547
553
  maxSize: 5,
548
554
  fileExtensionsAllowed: ["pdf"],
549
555
  type: "single",
550
556
  maxFiles: 1
551
- }, r = new File(["test"], "test.pdf", {
557
+ }, p = new File(["test"], "test.pdf", {
552
558
  type: "application/pdf"
553
- }), u = n(r, s);
559
+ }), u = n(p, s);
554
560
  e(u.error).toBe("First error"), e(t).toHaveBeenCalledTimes(1), e(a).not.toHaveBeenCalled();
555
- }), l("should return success when all validators pass", () => {
561
+ }), d("should return success when all validators pass", () => {
556
562
  const t = c.fn((g) => ({
557
563
  file: g
558
564
  })), a = c.fn((g) => ({
559
565
  file: g
560
- })), n = T(t, a), s = {
566
+ })), n = h(t, a), s = {
561
567
  maxSize: 5,
562
568
  fileExtensionsAllowed: ["pdf"],
563
569
  type: "single",
564
570
  maxFiles: 1
565
- }, r = new File(["test"], "test.pdf", {
571
+ }, p = new File(["test"], "test.pdf", {
566
572
  type: "application/pdf"
567
- }), u = n(r, s);
573
+ }), u = n(p, s);
568
574
  e(u.error).toBeUndefined(), e(t).toHaveBeenCalledTimes(1), e(a).toHaveBeenCalledTimes(1);
569
- }), l("should work with defaultValidator in composition", () => {
575
+ }), d("should work with defaultValidator in composition", () => {
570
576
  const t = c.fn((x, m) => {
571
- const h = I(x, m);
572
- return h.error ? h : x.name.startsWith("reject") ? {
577
+ const T = I(x, m);
578
+ return T.error ? T : x.name.startsWith("reject") ? {
573
579
  file: x,
574
580
  error: "Custom rejection error"
575
581
  } : {
576
582
  file: x
577
583
  };
578
- }), a = T(I, t), n = {
584
+ }), a = h(I, t), n = {
579
585
  maxSize: 1,
580
586
  fileExtensionsAllowed: ["pdf"],
581
587
  type: "single",
582
588
  maxFiles: 1
583
589
  }, s = new File(["x".repeat(2 * 1024 * 1024)], "large.pdf", {
584
590
  type: "application/pdf"
585
- }), r = a(s, n);
586
- e(r.error).toContain("too large"), e(r.errorCode).toBe("SIZE_TOO_LARGE");
591
+ }), p = a(s, n);
592
+ e(p.error).toContain("too large"), e(p.errorCode).toBe("SIZE_TOO_LARGE");
587
593
  const u = new File(["test"], "reject.pdf", {
588
594
  type: "application/pdf"
589
595
  }), g = a(u, n);
590
596
  e(g.error).toBe("Custom rejection error");
591
- }), l("should integrate composeValidators with component", async () => {
597
+ }), d("should integrate composeValidators with component", async () => {
592
598
  const t = c.fn((u, g) => {
593
599
  const x = I(u, g);
594
600
  return x.error ? x : u.name.startsWith("blocked") ? {
@@ -597,12 +603,12 @@ y("DragAndDrop", () => {
597
603
  } : {
598
604
  file: u
599
605
  };
600
- }), a = T(I, t), n = new File(["test"], "blocked.pdf", {
606
+ }), a = h(I, t), n = new File(["test"], "blocked.pdf", {
601
607
  type: "application/pdf"
602
608
  }), s = c.fn();
603
- p(/* @__PURE__ */ i(d, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: s, validator: a }));
604
- const r = o.getByTestId("drag-and-drop-input");
605
- await w.upload(r, n), await f(() => {
609
+ r(/* @__PURE__ */ i(l, { fileExtensionsAllowed: ["pdf"], maxSize: 5, onUpload: s, validator: a }));
610
+ const p = o.getByTestId("drag-and-drop-input");
611
+ await w.upload(p, n), await f(() => {
606
612
  e(o.getByTestId("drag-and-drop-file-error-0")).toBeInTheDocument(), e(o.getByText("File name blocked")).toBeInTheDocument();
607
613
  });
608
614
  });