@optiaxiom/proteus 0.0.0 → 0.1.0

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 (44) hide show
  1. package/LICENSE +201 -0
  2. package/dist/esm/assets/src/proteus-chart/ProteusChart.css.ts.vanilla-WpbWN23E.css +9 -0
  3. package/dist/esm/assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-sqWemcZm.css +9 -0
  4. package/dist/esm/assets/src/proteus-question/ProteusQuestionItem.css.ts.vanilla-Dns_NfIP.css +26 -0
  5. package/dist/esm/hooks/useEffectEvent.js +14 -0
  6. package/dist/esm/icons/IconAngleLeft.js +21 -0
  7. package/dist/esm/icons/IconCalendar.js +20 -0
  8. package/dist/esm/icons/withIcon.js +31 -0
  9. package/dist/esm/index.js +14 -0
  10. package/dist/esm/proteus-action/ProteusAction.js +41 -0
  11. package/dist/esm/proteus-action/ProteusCancelAction.js +41 -0
  12. package/dist/esm/proteus-chart/ProteusChart-css.js +6 -0
  13. package/dist/esm/proteus-chart/ProteusChart.js +71 -0
  14. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +7 -0
  15. package/dist/esm/proteus-chart/ProteusChartTooltipContent.js +45 -0
  16. package/dist/esm/proteus-data-table/ProteusDataTable.js +34 -0
  17. package/dist/esm/proteus-document/ProteusDocumentContext.js +6 -0
  18. package/dist/esm/proteus-document/ProteusDocumentPathContext.js +8 -0
  19. package/dist/esm/proteus-document/ProteusDocumentRenderer.js +39 -0
  20. package/dist/esm/proteus-document/ProteusDocumentShell.js +128 -0
  21. package/dist/esm/proteus-document/getProteusValue.js +49 -0
  22. package/dist/esm/proteus-document/resolveProteusProp.js +39 -0
  23. package/dist/esm/proteus-document/resolveProteusValue.js +18 -0
  24. package/dist/esm/proteus-document/schemas.js +48 -0
  25. package/dist/esm/proteus-document/useProteusValue.js +15 -0
  26. package/dist/esm/proteus-document/useResolvedProteusProps.js +19 -0
  27. package/dist/esm/proteus-element/ProteusElement.js +153 -0
  28. package/dist/esm/proteus-image/ProteusImage.js +91 -0
  29. package/dist/esm/proteus-image/downloadFile.js +12 -0
  30. package/dist/esm/proteus-input/ProteusInput.js +32 -0
  31. package/dist/esm/proteus-map/ProteusMap.js +35 -0
  32. package/dist/esm/proteus-question/ProteusQuestion.js +96 -0
  33. package/dist/esm/proteus-question/ProteusQuestionItem-css.js +9 -0
  34. package/dist/esm/proteus-question/ProteusQuestionItem.js +57 -0
  35. package/dist/esm/proteus-select/ProteusSelect.js +44 -0
  36. package/dist/esm/proteus-show/ProteusShow.js +70 -0
  37. package/dist/esm/proteus-textarea/ProteusTextarea.js +32 -0
  38. package/dist/esm/proteus-value/ProteusValue.js +9 -0
  39. package/dist/esm/schema/public-schema.json.js +7904 -0
  40. package/dist/esm/schema/runtime-schema.json.js +7851 -0
  41. package/dist/esm/spec.js +1 -0
  42. package/dist/index.d.ts +293 -0
  43. package/dist/spec.d.ts +8626 -0
  44. package/package.json +41 -3
@@ -0,0 +1 @@
1
+ export { default as schema } from './schema/public-schema.json.js';
@@ -0,0 +1,293 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { BoxProps, SelectProps, Disclosure, ButtonProps, InputProps, TextareaProps } from '@optiaxiom/react';
3
+ import { ReactNode, ComponentPropsWithoutRef } from 'react';
4
+
5
+ type ProteusCancelActionProps = {
6
+ children?: ReactNode;
7
+ /**
8
+ * Placeholder text for the text input field
9
+ */
10
+ placeholder?: string;
11
+ };
12
+ declare function ProteusCancelAction({ children, placeholder, }: ProteusCancelActionProps): react_jsx_runtime.JSX.Element;
13
+ declare namespace ProteusCancelAction {
14
+ var displayName: string;
15
+ }
16
+
17
+ type Series = {
18
+ dataKey: string;
19
+ name?: string;
20
+ };
21
+ type ProteusChartProps = {
22
+ /**
23
+ * Chart data records, either inline, a ProteusValue reference, or a
24
+ * ProteusZip transformation
25
+ */
26
+ data: Record<string, unknown>[];
27
+ /**
28
+ * Data series configuration
29
+ */
30
+ series: Series[];
31
+ /**
32
+ * Chart type
33
+ */
34
+ type: "bar" | "line";
35
+ /**
36
+ * Key in data records for x-axis labels
37
+ */
38
+ xAxisKey?: string;
39
+ };
40
+ declare const ProteusChart: {
41
+ ({ data, series, type, xAxisKey, }: ProteusChartProps): react_jsx_runtime.JSX.Element;
42
+ displayName: string;
43
+ };
44
+
45
+ type ProteusDataTableProps = {
46
+ /**
47
+ * Column definitions
48
+ */
49
+ columns: ColumnDef[];
50
+ /**
51
+ * Column data
52
+ */
53
+ data?: Record<string, unknown>[];
54
+ };
55
+ type ColumnDef = {
56
+ accessorKey: string;
57
+ format?: string | {
58
+ options?: Record<string, unknown>;
59
+ type: string;
60
+ };
61
+ header: string;
62
+ size?: number;
63
+ };
64
+ declare const ProteusDataTable: {
65
+ ({ columns, data }: ProteusDataTableProps): react_jsx_runtime.JSX.Element;
66
+ displayName: string;
67
+ };
68
+
69
+ type ProteusImageProps = BoxProps<"img">;
70
+ declare function ProteusImage(props: ProteusImageProps): react_jsx_runtime.JSX.Element;
71
+ declare namespace ProteusImage {
72
+ var displayName: string;
73
+ }
74
+
75
+ type ProteusMapProps = {
76
+ children?: ReactNode;
77
+ /**
78
+ * JSON pointer path to the source array in the data (e.g., '/results')
79
+ */
80
+ path: string;
81
+ /**
82
+ * Optional separator to render between items. Can be a string or a
83
+ * ReactNode for more complex separators.
84
+ */
85
+ separator?: ReactNode;
86
+ };
87
+ declare function ProteusMap({ children, path, separator }: ProteusMapProps): react_jsx_runtime.JSX.Element | null;
88
+ declare namespace ProteusMap {
89
+ var displayName: string;
90
+ }
91
+
92
+ type ProteusSelectProps = Omit<SelectProps, "options"> & {
93
+ /**
94
+ * The select items/options we want to render.
95
+ */
96
+ options?: Array<{
97
+ /**
98
+ * String representation of items
99
+ */
100
+ label: string;
101
+ /**
102
+ * Return a unique key for each item
103
+ */
104
+ value: string;
105
+ }>;
106
+ };
107
+ declare function ProteusSelect({ children, options, ...props }: ProteusSelectProps): react_jsx_runtime.JSX.Element;
108
+ declare namespace ProteusSelect {
109
+ var displayName: string;
110
+ }
111
+
112
+ type ProteusShowProps = {
113
+ children?: ReactNode;
114
+ /**
115
+ * Single condition or array of conditions (AND logic). Each condition is an
116
+ * object with one operator key.
117
+ */
118
+ when: ProteusCondition;
119
+ };
120
+ type ComparisonValue = boolean | null | number | string | {
121
+ $type: "Value";
122
+ path: string;
123
+ };
124
+ type ProteusCondition = {
125
+ "!!": ComparisonValue;
126
+ } | {
127
+ "!=": ComparisonValue[];
128
+ } | {
129
+ "<": ComparisonValue[];
130
+ } | {
131
+ "<=": ComparisonValue[];
132
+ } | {
133
+ "==": ComparisonValue[];
134
+ } | {
135
+ ">": ComparisonValue[];
136
+ } | {
137
+ ">=": ComparisonValue[];
138
+ } | {
139
+ and: ProteusCondition[];
140
+ } | {
141
+ or: ProteusCondition[];
142
+ };
143
+ declare function ProteusShow({ children, when }: ProteusShowProps): react_jsx_runtime.JSX.Element | null;
144
+ declare namespace ProteusShow {
145
+ var displayName: string;
146
+ }
147
+
148
+ type ProteusValueProps = {
149
+ /**
150
+ * Format to apply to cell values (e.g. 'Number', 'DateTime')
151
+ */
152
+ formatter?: "DateTime" | "Number" | {
153
+ /**
154
+ * Options passed to the Intl formatter constructor (e.g.,
155
+ * Intl.DateTimeFormatOptions or Intl.NumberFormatOptions)
156
+ */
157
+ options?: Record<string, unknown>;
158
+ /**
159
+ * Formatter type
160
+ */
161
+ type: "DateTime" | "Number";
162
+ };
163
+ /**
164
+ * Path to a value in the data. Absolute paths start with '/' and resolve from
165
+ * the root (e.g., '/title', '/options/0/label'). Inside a Map template, paths
166
+ * without a leading '/' are relative to the current item (e.g., 'title'
167
+ * resolves to each item's 'title' field).
168
+ */
169
+ path: string;
170
+ };
171
+ declare function ProteusValue(props: ProteusValueProps): any;
172
+ declare namespace ProteusValue {
173
+ var displayName: string;
174
+ }
175
+
176
+ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure>, "defaultOpen" | "onOpenChange" | "open"> & {
177
+ /**
178
+ * Whether block is collapsible
179
+ */
180
+ collapsible?: boolean;
181
+ /**
182
+ * Current form data
183
+ */
184
+ data?: Record<string, unknown>;
185
+ /**
186
+ * The Proteus document to render
187
+ */
188
+ element: ProteusDocument$2;
189
+ /**
190
+ * Callback when form fields change
191
+ */
192
+ onDataChange?: (data: Record<string, unknown>) => void;
193
+ /**
194
+ * Callback when user sends a message action
195
+ */
196
+ onMessage?: (message: string) => Promise<void> | void;
197
+ /**
198
+ * Callback when user clicks a Action button with tool handler
199
+ */
200
+ onToolCall?: (toolName: string) => Promise<void> | void;
201
+ /**
202
+ * Whether form is readonly
203
+ */
204
+ readOnly?: boolean;
205
+ /**
206
+ * If true, the renderer will throw an error if the provided document is invalid. Otherwise, it will fail silently and render nothing.
207
+ */
208
+ strict?: boolean;
209
+ };
210
+ type ProteusDocument$2 = {
211
+ actions?: ReactNode;
212
+ appIcon?: string;
213
+ appName?: string;
214
+ blocking?: boolean;
215
+ body: ReactNode;
216
+ subtitle?: ReactNode;
217
+ title: ReactNode;
218
+ };
219
+ declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onMessage, onOpenChange, onToolCall, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
220
+ declare namespace ProteusDocumentShell {
221
+ var displayName: string;
222
+ }
223
+
224
+ type ProteusEventHandler = {
225
+ action: "download";
226
+ url: (ProteusValueProps & {
227
+ $type: "Value";
228
+ }) | string;
229
+ } | {
230
+ message: string;
231
+ } | {
232
+ tool: string;
233
+ };
234
+ type ProteusDocument$1 = ProteusDocumentShellProps["element"] & {
235
+ $type: "Document";
236
+ };
237
+ type SafeParseResult<T> = {
238
+ data: T;
239
+ success: true;
240
+ } | {
241
+ error: string[];
242
+ success: false;
243
+ };
244
+ declare function safeParseDocument({ actions, body, ...data }: Record<string, unknown>): SafeParseResult<ProteusDocument$1>;
245
+
246
+ type ProteusActionProps = Omit<ButtonProps, "onClick"> & {
247
+ /**
248
+ * Action triggered when button is clicked
249
+ */
250
+ onClick?: ProteusEventHandler;
251
+ };
252
+ declare function ProteusAction({ children, onClick, ...props }: ProteusActionProps): react_jsx_runtime.JSX.Element;
253
+ declare namespace ProteusAction {
254
+ var displayName: string;
255
+ }
256
+
257
+ type ProteusDocumentRendererProps = Omit<ComponentPropsWithoutRef<typeof ProteusDocumentShell>, "element"> & {
258
+ /**
259
+ * The Proteus document to render
260
+ */
261
+ element: ProteusDocument;
262
+ /**
263
+ * If true, the renderer will throw an error if the provided document is invalid. Otherwise, it will fail silently and render nothing.
264
+ */
265
+ strict?: boolean;
266
+ };
267
+ type ProteusDocument = {
268
+ $type: "Document";
269
+ actions?: unknown;
270
+ appIcon?: string;
271
+ appName?: string;
272
+ blocking?: boolean;
273
+ body: unknown;
274
+ subtitle?: unknown;
275
+ title: unknown;
276
+ };
277
+ declare function ProteusDocumentRenderer({ element: elementProp, strict, ...props }: ProteusDocumentRendererProps): react_jsx_runtime.JSX.Element | null;
278
+ declare namespace ProteusDocumentRenderer {
279
+ var displayName: string;
280
+ }
281
+
282
+ declare function ProteusInput(props: InputProps): react_jsx_runtime.JSX.Element;
283
+ declare namespace ProteusInput {
284
+ var displayName: string;
285
+ }
286
+
287
+ declare function ProteusTextarea(props: TextareaProps): react_jsx_runtime.JSX.Element;
288
+ declare namespace ProteusTextarea {
289
+ var displayName: string;
290
+ }
291
+
292
+ export { ProteusAction, ProteusCancelAction, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, ProteusValue, safeParseDocument };
293
+ export type { ProteusDocumentRendererProps, ProteusDocumentShellProps };