@optiaxiom/proteus 0.2.11 → 0.2.13-next.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.
package/dist/index.d.ts CHANGED
@@ -104,16 +104,22 @@ type ProteusFileUploadProps = {
104
104
  */
105
105
  accept?: string[];
106
106
  /**
107
- * The name of the form control element. The resolved URL is written at
108
- * `parentPath/name` in form data once the host's `onUpload` resolves.
107
+ * Maximum number of files allowed. When set to `1` the field is in
108
+ * single-file mode; any other value (or omitted) allows multiple uploads.
109
109
  */
110
- name?: string;
110
+ maxFiles?: number;
111
+ /**
112
+ * Minimum number of files required.
113
+ */
114
+ minFiles?: number;
111
115
  /**
112
- * Whether a file is required.
116
+ * The name of the form control element. The resolved metadata array is
117
+ * written at `parentPath/name` in form data once the host's `onUpload`
118
+ * resolves.
113
119
  */
114
- required?: boolean;
120
+ name?: string;
115
121
  };
116
- declare function ProteusFileUpload({ accept, name, required, }: ProteusFileUploadProps): react_jsx_runtime.JSX.Element;
122
+ declare function ProteusFileUpload({ accept, maxFiles, minFiles, name, }: ProteusFileUploadProps): react_jsx_runtime.JSX.Element;
117
123
  declare namespace ProteusFileUpload {
118
124
  var displayName: string;
119
125
  }
@@ -154,6 +160,11 @@ declare namespace ProteusImage {
154
160
 
155
161
  type ProteusMapProps = {
156
162
  children?: ReactNode;
163
+ /**
164
+ * When true, flattens the result array by one level. Only used during
165
+ * value resolution (e.g., onClick message); ignored during rendering.
166
+ */
167
+ flat?: boolean;
157
168
  /**
158
169
  * JSON pointer path to the source array in the data (e.g., '/results')
159
170
  */
@@ -254,7 +265,11 @@ type ProteusValueProps = {
254
265
  path: string;
255
266
  };
256
267
 
257
- type UploadFile = (file: File) => Promise<string>;
268
+ type FileUploadMetadata = {
269
+ link: string;
270
+ name: string;
271
+ };
272
+ type UploadFile<F extends FileUploadMetadata = FileUploadMetadata> = (file: File) => Promise<F>;
258
273
  type UseResource = (resource: string) => {
259
274
  data: undefined | {
260
275
  mimeType: string;
@@ -302,7 +317,7 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
302
317
  onTrack?: (event: string, properties: Record<string, string>) => void;
303
318
  /**
304
319
  * Async upload callback used by FileUpload elements. Receives a File and
305
- * resolves to a URL string the document writes into form data.
320
+ * resolves to a metadata object the document writes into form data.
306
321
  */
307
322
  onUpload?: UploadFile;
308
323
  /**
@@ -350,8 +365,8 @@ type ProteusEventHandler = {
350
365
  } | {
351
366
  message: string | StructuredMessage;
352
367
  };
353
- type StructuredMessage = {
354
- files?: string[];
368
+ type StructuredMessage<F extends FileUploadMetadata = FileUploadMetadata> = {
369
+ files?: F[];
355
370
  parts: Array<{
356
371
  content: string;
357
372
  type: "text";
@@ -420,4 +435,4 @@ declare namespace ProteusTextarea {
420
435
  declare function useProteusValue(element: ProteusValueProps): any;
421
436
 
422
437
  export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFederated, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
423
- export type { ProteusDocumentRendererProps, ProteusDocumentShellProps, ProteusFileUploadProps, StructuredMessage, UploadFile };
438
+ export type { FileUploadMetadata, ProteusDocumentRendererProps, ProteusDocumentShellProps, ProteusFileUploadProps, StructuredMessage, UploadFile };