@optiaxiom/proteus 0.2.5 → 0.2.7

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 (23) hide show
  1. package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-DnNIn_rc.css → ProteusChart.css.ts.vanilla-BO0-TwP_.css} +2 -2
  2. package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-DoWJUTMo.css → ProteusChartTooltipContent.css.ts.vanilla-ETMXhILd.css} +2 -2
  3. package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-DcaxxIIv.css → ProteusDocumentShell.css.ts.vanilla-CDxANCyw.css} +2 -2
  4. package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-DasQYQWd.css → ProteusImageCarousel.css.ts.vanilla-CVLALefb.css} +2 -2
  5. package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-DyMq_aV3.css → ProteusQuestion.css.ts.vanilla-DKDk8HIF.css} +2 -2
  6. package/dist/esm/hooks/useObserveValue.js +33 -0
  7. package/dist/esm/index.js +1 -0
  8. package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
  9. package/dist/esm/proteus-chart/ProteusChart.js +1 -1
  10. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
  11. package/dist/esm/proteus-data-table/ProteusDataTable.js +1 -1
  12. package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
  13. package/dist/esm/proteus-document/ProteusDocumentShell.js +2 -0
  14. package/dist/esm/proteus-document/resolveProteusValue.js +18 -6
  15. package/dist/esm/proteus-element/ProteusElement.js +3 -0
  16. package/dist/esm/proteus-file-upload/ProteusFileUpload.js +94 -0
  17. package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +1 -1
  18. package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
  19. package/dist/esm/schema/public-schema.json.js +104 -1
  20. package/dist/esm/schema/runtime-schema.json.js +101 -1
  21. package/dist/index.d.ts +45 -8
  22. package/dist/spec.d.ts +865 -747
  23. package/package.json +4 -3
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ type ProteusChartProps = {
38
38
  /**
39
39
  * Data series configuration
40
40
  */
41
- series: Series[];
41
+ series?: Series[];
42
42
  /**
43
43
  * Chart type
44
44
  */
@@ -57,7 +57,7 @@ type ProteusDataTableProps = {
57
57
  /**
58
58
  * Column definitions
59
59
  */
60
- columns: ColumnDef[];
60
+ columns?: ColumnDef[];
61
61
  /**
62
62
  * Column data
63
63
  */
@@ -77,6 +77,28 @@ declare const ProteusDataTable: {
77
77
  displayName: string;
78
78
  };
79
79
 
80
+ type ProteusFileUploadProps = {
81
+ /**
82
+ * File types to accept; array of MIME types or extensions.
83
+ *
84
+ * @example ["image/*", ".pdf"]
85
+ */
86
+ accept?: string[];
87
+ /**
88
+ * The name of the form control element. The resolved URL is written at
89
+ * `parentPath/name` in form data once the host's `onUpload` resolves.
90
+ */
91
+ name?: string;
92
+ /**
93
+ * Whether a file is required.
94
+ */
95
+ required?: boolean;
96
+ };
97
+ declare function ProteusFileUpload({ accept, name, required, }: ProteusFileUploadProps): react_jsx_runtime.JSX.Element;
98
+ declare namespace ProteusFileUpload {
99
+ var displayName: string;
100
+ }
101
+
80
102
  type ProteusImageCarouselProps = {
81
103
  /**
82
104
  * Array of image data to display in the carousel.
@@ -213,6 +235,7 @@ type ProteusValueProps = {
213
235
  path: string;
214
236
  };
215
237
 
238
+ type UploadFile = (file: File) => Promise<string>;
216
239
  type UseResource = (resource: string) => {
217
240
  data: undefined | {
218
241
  mimeType: string;
@@ -249,13 +272,20 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
249
272
  */
250
273
  onInteraction?: (name: string, params?: Record<string, unknown>) => Promise<unknown> | unknown;
251
274
  /**
252
- * Callback when user sends a message action
275
+ * Callback when user sends a message action. The payload may be a plain
276
+ * string or a structured object (parts + optional files), depending on
277
+ * what the document declares for `Action.onClick.message`.
253
278
  */
254
- onMessage?: (message: string) => Promise<void> | void;
279
+ onMessage?: (message: string | StructuredMessage) => Promise<void> | void;
255
280
  /**
256
281
  * Callback when an analytics event is fired
257
282
  */
258
283
  onTrack?: (event: string, properties: Record<string, string>) => void;
284
+ /**
285
+ * Async upload callback used by FileUpload elements. Receives a File and
286
+ * resolves to a URL string the document writes into form data.
287
+ */
288
+ onUpload?: UploadFile;
259
289
  /**
260
290
  * Whether form is readonly
261
291
  */
@@ -280,7 +310,7 @@ type ProteusDocument$2 = {
280
310
  title?: ReactNode;
281
311
  titleIcon?: string;
282
312
  };
283
- declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, onTrack, open: openProp, readOnly, strict, useResource, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
313
+ declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, onTrack, onUpload, open: openProp, readOnly, strict, useResource, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
284
314
  declare namespace ProteusDocumentShell {
285
315
  var displayName: string;
286
316
  }
@@ -294,7 +324,14 @@ type ProteusEventHandler = {
294
324
  interaction: string;
295
325
  params?: Record<string, unknown>;
296
326
  } | {
297
- message: string;
327
+ message: string | StructuredMessage;
328
+ };
329
+ type StructuredMessage = {
330
+ files?: string[];
331
+ parts: Array<{
332
+ content: string;
333
+ type: "text";
334
+ }>;
298
335
  };
299
336
  type ProteusDocument$1 = ProteusDocumentShellProps["element"] & {
300
337
  $type: "Document";
@@ -358,5 +395,5 @@ declare namespace ProteusTextarea {
358
395
 
359
396
  declare function useProteusValue(element: ProteusValueProps): any;
360
397
 
361
- export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
362
- export type { ProteusDocumentRendererProps, ProteusDocumentShellProps };
398
+ export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
399
+ export type { ProteusDocumentRendererProps, ProteusDocumentShellProps, ProteusFileUploadProps, StructuredMessage, UploadFile };