@optiaxiom/proteus 0.1.11 → 0.1.13

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.
@@ -8,6 +8,7 @@ import { useResolveProteusValues } from '../proteus-document/useResolveProteusVa
8
8
  function ProteusAction({
9
9
  children,
10
10
  onClick,
11
+ type = "button",
11
12
  ...props
12
13
  }) {
13
14
  const { onEvent, valid } = useProteusDocumentContext(
@@ -20,7 +21,7 @@ function ProteusAction({
20
21
  return /* @__PURE__ */ jsx(
21
22
  Button,
22
23
  {
23
- disabled: !valid,
24
+ disabled: type === "submit" && !valid,
24
25
  justifyContent: "center",
25
26
  loading,
26
27
  onClick: async () => {
@@ -31,6 +32,7 @@ function ProteusAction({
31
32
  await onEvent(resolvedOnClick);
32
33
  setLoading(false);
33
34
  },
35
+ type,
34
36
  ...props,
35
37
  children
36
38
  }
@@ -14,9 +14,9 @@ function ProteusDocumentShell({
14
14
  defaultOpen = true,
15
15
  element,
16
16
  onDataChange,
17
+ onInteraction,
17
18
  onMessage,
18
19
  onOpenChange,
19
- onToolCall,
20
20
  open: openProp,
21
21
  readOnly = false,
22
22
  strict
@@ -45,8 +45,8 @@ function ProteusDocumentShell({
45
45
  onDataChange?.(next);
46
46
  }),
47
47
  onEvent: useEffectEvent(async (event) => {
48
- if ("tool" in event) {
49
- await onToolCall?.(event.tool);
48
+ if ("interaction" in event) {
49
+ await onInteraction?.(event.interaction);
50
50
  } else if ("message" in event) {
51
51
  await onMessage?.(event.message);
52
52
  } else if (event.action === "download") {
@@ -2488,7 +2488,7 @@ var definitions = {
2488
2488
  appearance: "primary",
2489
2489
  children: "Submit",
2490
2490
  onClick: {
2491
- tool: "submit_feedback"
2491
+ interaction: "submit_feedback"
2492
2492
  }
2493
2493
  }
2494
2494
  ],
@@ -2532,7 +2532,7 @@ var definitions = {
2532
2532
  appearance: "primary",
2533
2533
  children: "Create Test Plan",
2534
2534
  onClick: {
2535
- tool: "create_test_plan"
2535
+ interaction: "create_test_plan"
2536
2536
  }
2537
2537
  }
2538
2538
  ],
@@ -2767,15 +2767,15 @@ var definitions = {
2767
2767
  anyOf: [
2768
2768
  {
2769
2769
  additionalProperties: false,
2770
- description: "Server-side tool call",
2770
+ description: "Server-side interaction call",
2771
2771
  properties: {
2772
- tool: {
2773
- description: "Name of registered tool to call",
2772
+ interaction: {
2773
+ description: "Name of registered interaction to call",
2774
2774
  type: "string"
2775
2775
  }
2776
2776
  },
2777
2777
  required: [
2778
- "tool"
2778
+ "interaction"
2779
2779
  ],
2780
2780
  type: "object"
2781
2781
  },
@@ -2834,7 +2834,7 @@ var definitions = {
2834
2834
  type: "object"
2835
2835
  }
2836
2836
  ],
2837
- description: "Handler for user interactions - a server-side tool call, client-side message, or client-side component action"
2837
+ description: "Handler for user interactions - a server-side interaction call, client-side message, or client-side component action"
2838
2838
  },
2839
2839
  ProteusNode: {
2840
2840
  anyOf: [
@@ -3136,6 +3136,23 @@ var definitions = {
3136
3136
  transition: {
3137
3137
  $ref: "#/definitions/SprinkleProp_transition"
3138
3138
  },
3139
+ type: {
3140
+ anyOf: [
3141
+ {
3142
+ "const": "button"
3143
+ },
3144
+ {
3145
+ "const": "reset"
3146
+ },
3147
+ {
3148
+ "const": "submit"
3149
+ },
3150
+ {
3151
+ $ref: "#/definitions/ProteusValue"
3152
+ }
3153
+ ],
3154
+ description: "The default behavior of the button."
3155
+ },
3139
3156
  w: {
3140
3157
  $ref: "#/definitions/SprinkleProp_w"
3141
3158
  },
@@ -2476,7 +2476,7 @@ var definitions = {
2476
2476
  appearance: "primary",
2477
2477
  children: "Submit",
2478
2478
  onClick: {
2479
- tool: "submit_feedback"
2479
+ interaction: "submit_feedback"
2480
2480
  }
2481
2481
  }
2482
2482
  ],
@@ -2520,7 +2520,7 @@ var definitions = {
2520
2520
  appearance: "primary",
2521
2521
  children: "Create Test Plan",
2522
2522
  onClick: {
2523
- tool: "create_test_plan"
2523
+ interaction: "create_test_plan"
2524
2524
  }
2525
2525
  }
2526
2526
  ],
@@ -2754,15 +2754,15 @@ var definitions = {
2754
2754
  ProteusEventHandler: {
2755
2755
  anyOf: [
2756
2756
  {
2757
- description: "Server-side tool call",
2757
+ description: "Server-side interaction call",
2758
2758
  properties: {
2759
- tool: {
2760
- description: "Name of registered tool to call",
2759
+ interaction: {
2760
+ description: "Name of registered interaction to call",
2761
2761
  type: "string"
2762
2762
  }
2763
2763
  },
2764
2764
  required: [
2765
- "tool"
2765
+ "interaction"
2766
2766
  ],
2767
2767
  type: "object"
2768
2768
  },
@@ -2819,7 +2819,7 @@ var definitions = {
2819
2819
  type: "object"
2820
2820
  }
2821
2821
  ],
2822
- description: "Handler for user interactions - a server-side tool call, client-side message, or client-side component action"
2822
+ description: "Handler for user interactions - a server-side interaction call, client-side message, or client-side component action"
2823
2823
  },
2824
2824
  ProteusNode: {
2825
2825
  anyOf: [
@@ -3118,6 +3118,23 @@ var definitions = {
3118
3118
  transition: {
3119
3119
  $ref: "#/definitions/SprinkleProp_transition"
3120
3120
  },
3121
+ type: {
3122
+ anyOf: [
3123
+ {
3124
+ "const": "button"
3125
+ },
3126
+ {
3127
+ "const": "reset"
3128
+ },
3129
+ {
3130
+ "const": "submit"
3131
+ },
3132
+ {
3133
+ $ref: "#/definitions/ProteusValue"
3134
+ }
3135
+ ],
3136
+ description: "The default behavior of the button."
3137
+ },
3121
3138
  w: {
3122
3139
  $ref: "#/definitions/SprinkleProp_w"
3123
3140
  },
package/dist/index.d.ts CHANGED
@@ -190,13 +190,13 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
190
190
  */
191
191
  onDataChange?: (data: Record<string, unknown>) => void;
192
192
  /**
193
- * Callback when user sends a message action
193
+ * Callback when user clicks a Action button with interaction handler
194
194
  */
195
- onMessage?: (message: string) => Promise<void> | void;
195
+ onInteraction?: (name: string) => Promise<void> | void;
196
196
  /**
197
- * Callback when user clicks a Action button with tool handler
197
+ * Callback when user sends a message action
198
198
  */
199
- onToolCall?: (toolName: string) => Promise<void> | void;
199
+ onMessage?: (message: string) => Promise<void> | void;
200
200
  /**
201
201
  * Whether form is readonly
202
202
  */
@@ -216,7 +216,7 @@ type ProteusDocument$2 = {
216
216
  title?: ReactNode;
217
217
  titleIcon?: string;
218
218
  };
219
- declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onMessage, onOpenChange, onToolCall, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
219
+ declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onInteraction, onMessage, onOpenChange, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
220
220
  declare namespace ProteusDocumentShell {
221
221
  var displayName: string;
222
222
  }
@@ -227,9 +227,9 @@ type ProteusEventHandler = {
227
227
  $type: "Value";
228
228
  }) | string | string[];
229
229
  } | {
230
- message: string;
230
+ interaction: string;
231
231
  } | {
232
- tool: string;
232
+ message: string;
233
233
  };
234
234
  type ProteusDocument$1 = ProteusDocumentShellProps["element"] & {
235
235
  $type: "Document";
@@ -249,7 +249,7 @@ type ProteusActionProps = Omit<ButtonProps, "onClick"> & {
249
249
  */
250
250
  onClick?: ProteusEventHandler;
251
251
  };
252
- declare function ProteusAction({ children, onClick, ...props }: ProteusActionProps): react_jsx_runtime.JSX.Element;
252
+ declare function ProteusAction({ children, onClick, type, ...props }: ProteusActionProps): react_jsx_runtime.JSX.Element;
253
253
  declare namespace ProteusAction {
254
254
  var displayName: string;
255
255
  }