@visns-studio/visns-components 5.14.11 → 5.14.12

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/package.json CHANGED
@@ -24,13 +24,13 @@
24
24
  "dayjs": "^1.11.13",
25
25
  "fabric": "^6.7.1",
26
26
  "file-saver": "^2.0.5",
27
- "framer-motion": "^12.23.6",
27
+ "framer-motion": "^12.23.11",
28
28
  "html-react-parser": "^5.2.6",
29
29
  "lodash": "^4.17.21",
30
30
  "lodash.debounce": "^4.0.8",
31
- "lucide-react": "^0.525.0",
31
+ "lucide-react": "^0.532.0",
32
32
  "moment": "^2.30.1",
33
- "motion": "^12.23.6",
33
+ "motion": "^12.23.11",
34
34
  "numeral": "^2.0.6",
35
35
  "pluralize": "^8.0.0",
36
36
  "qrcode.react": "^4.2.0",
@@ -89,7 +89,7 @@
89
89
  "react-dom": "^17.0.0 || ^18.0.0"
90
90
  },
91
91
  "name": "@visns-studio/visns-components",
92
- "version": "5.14.11",
92
+ "version": "5.14.12",
93
93
  "description": "Various packages to assist in the development of our Custom Applications.",
94
94
  "main": "src/index.js",
95
95
  "files": [
@@ -1006,12 +1006,27 @@ function Field({
1006
1006
  ) {
1007
1007
  return (
1008
1008
  <div className={styles['file-upload-container']}>
1009
+ <div className={styles['file-upload-button-wrapper']}>
1010
+ <label
1011
+ htmlFor={`file-input-${settings.id}`}
1012
+ className={styles['file-upload-button']}
1013
+ >
1014
+ <span>📁</span>
1015
+ Browse Files...
1016
+ </label>
1017
+ <div className={styles['file-upload-help-text']}>
1018
+ Select multiple files to upload. You can add more files later.
1019
+ </div>
1020
+ </div>
1021
+
1009
1022
  <input
1023
+ id={`file-input-${settings.id}`}
1010
1024
  type="file"
1011
1025
  multiple
1012
1026
  data-name={settings.id}
1013
1027
  className={inputClass[settings.id]}
1014
1028
  onChange={onChange}
1029
+ accept={settings.accept || "*/*"}
1015
1030
  />
1016
1031
 
1017
1032
  {inputValue && inputValue.length > 0 && (
@@ -123,14 +123,63 @@ function Form({
123
123
  _dataset = e.target[e.target.selectedIndex].dataset;
124
124
  }
125
125
 
126
- if (e.target.files) {
127
- setFormData((prevState) => ({
128
- ...prevState,
129
- [id]:
130
- e.target.files.length > 1
131
- ? Array.from(e.target.files)
132
- : e.target.files[0],
133
- }));
126
+ if (e.target.files && e.target.files.length > 0) {
127
+ // Find the field settings to check if multiple is enabled
128
+ const fieldSettings = formSettings?.fields?.find(field => field.id === id);
129
+ const isMultiple = fieldSettings?.multiple === true;
130
+
131
+ // Debug logging for development
132
+ if (process.env.NODE_ENV === 'development') {
133
+ console.log('File input change:', {
134
+ id,
135
+ filesCount: e.target.files.length,
136
+ isMultiple,
137
+ fieldSettings
138
+ });
139
+ }
140
+
141
+ if (isMultiple) {
142
+ // For multiple file inputs, append new files to existing ones
143
+ setFormData((prevState) => {
144
+ const existingFiles = prevState[id] || [];
145
+ const newFiles = Array.from(e.target.files);
146
+
147
+ // Ensure existingFiles is always an array for multiple inputs
148
+ const currentFiles = Array.isArray(existingFiles) ? existingFiles : [];
149
+
150
+ const updatedFiles = [...currentFiles, ...newFiles];
151
+
152
+ // Debug logging for development
153
+ if (process.env.NODE_ENV === 'development') {
154
+ console.log('Multiple file update:', {
155
+ existingCount: currentFiles.length,
156
+ newCount: newFiles.length,
157
+ totalCount: updatedFiles.length
158
+ });
159
+ }
160
+
161
+ return {
162
+ ...prevState,
163
+ [id]: updatedFiles,
164
+ };
165
+ });
166
+
167
+ // Clear the input so the same files can be selected again
168
+ setTimeout(() => {
169
+ if (e.target) {
170
+ e.target.value = '';
171
+ }
172
+ }, 100);
173
+ } else {
174
+ // For single file inputs or when not multiple, use original behavior
175
+ setFormData((prevState) => ({
176
+ ...prevState,
177
+ [id]:
178
+ e.target.files.length > 1
179
+ ? Array.from(e.target.files)
180
+ : e.target.files[0],
181
+ }));
182
+ }
134
183
  } else {
135
184
  if (parent) {
136
185
  setFormData((prevState) => ({