@optiaxiom/proteus 1.0.0 → 1.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.
- package/dist/esm/_virtual/_openai-shim-script.js +3 -2
- package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BeRNNwBj.css → ProteusChart.css.ts.vanilla-yGx8JdKz.css} +2 -2
- package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-Df_IhL_i.css → ProteusChartTooltipContent.css.ts.vanilla-HapBe2oo.css} +2 -2
- package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-CyMtrn1n.css → ProteusDocumentShell.css.ts.vanilla-BPytQ9pT.css} +2 -2
- package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-Dbf7yRF1.css → ProteusImageCarousel.css.ts.vanilla-DnlXoyv1.css} +2 -2
- package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-cmHZWqNR.css → ProteusQuestion.css.ts.vanilla-CpDgoW0l.css} +2 -2
- package/dist/esm/hooks/useEffectEvent.js +11 -10
- package/dist/esm/hooks/useObserveValue.js +24 -30
- package/dist/esm/icons/IconAngleLeft.js +13 -19
- package/dist/esm/icons/IconAngleRight.js +13 -19
- package/dist/esm/icons/IconX.js +10 -18
- package/dist/esm/icons/withIcon.js +17 -28
- package/dist/esm/index.js +22 -17
- package/dist/esm/proteus-action/ProteusAction.js +44 -39
- package/dist/esm/proteus-bridge/ProteusBridge.js +71 -85
- package/dist/esm/proteus-card-link/ProteusCardLink.js +24 -37
- package/dist/esm/proteus-chart/ProteusChart-css.js +14 -5
- package/dist/esm/proteus-chart/ProteusChart.js +86 -84
- package/dist/esm/proteus-chart/ProteusChartContext.js +3 -3
- package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +23 -6
- package/dist/esm/proteus-chart/ProteusChartTooltipContent.js +52 -66
- package/dist/esm/proteus-data-table/ProteusDataTable.js +28 -29
- package/dist/esm/proteus-date-input/ProteusDateInput.js +23 -0
- package/dist/esm/proteus-document/ProteusDocumentContext.js +4 -3
- package/dist/esm/proteus-document/ProteusDocumentPathContext.js +6 -5
- package/dist/esm/proteus-document/ProteusDocumentRenderer.js +25 -33
- package/dist/esm/proteus-document/ProteusDocumentShell-css.js +32 -6
- package/dist/esm/proteus-document/ProteusDocumentShell.js +226 -219
- package/dist/esm/proteus-document/getProteusValue.js +28 -42
- package/dist/esm/proteus-document/resolveProteusProp.js +31 -49
- package/dist/esm/proteus-document/resolveProteusValue.js +73 -136
- package/dist/esm/proteus-document/schemas.js +42 -45
- package/dist/esm/proteus-document/useResolveProteusValues.js +10 -16
- package/dist/esm/proteus-element/ProteusElement.js +114 -180
- package/dist/esm/proteus-federated/ProteusFederated.js +51 -52
- package/dist/esm/proteus-file-icon/ProteusFileIcon.js +29 -38
- package/dist/esm/proteus-file-upload/ProteusFileUpload.js +107 -133
- package/dist/esm/proteus-image/ProteusImage.js +99 -106
- package/dist/esm/proteus-image/downloadFile.js +3 -2
- package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +49 -11
- package/dist/esm/proteus-image-carousel/ProteusImageCarousel.js +151 -163
- package/dist/esm/proteus-input/ProteusInput.js +19 -27
- package/dist/esm/proteus-length/ProteusLength.js +10 -0
- package/dist/esm/proteus-map/ProteusMap.js +18 -31
- package/dist/esm/proteus-map-index/ProteusMapIndex.js +11 -0
- package/dist/esm/proteus-pill-menu/ProteusPillMenu.js +65 -0
- package/dist/esm/proteus-pill-menu/useInputValueChangeInteraction.js +36 -0
- package/dist/esm/proteus-question/ProteusQuestion-css.js +40 -8
- package/dist/esm/proteus-question/ProteusQuestion.js +324 -400
- package/dist/esm/proteus-select/ProteusSelect.js +25 -40
- package/dist/esm/proteus-show/ProteusShow.js +10 -18
- package/dist/esm/proteus-switch/ProteusSwitch.js +33 -36
- package/dist/esm/proteus-textarea/ProteusTextarea.js +18 -27
- package/dist/esm/proteus-value/ProteusValue.js +4 -4
- package/dist/esm/schema/public-schema.js +4537 -0
- package/dist/esm/schema/runtime-schema.js +4460 -0
- package/dist/esm/spec.js +5 -1
- package/dist/esm/use-proteus-value/useProteusValue.js +8 -12
- package/dist/index.d.ts +516 -347
- package/dist/spec.d.ts +5 -9952
- package/package.json +4 -4
- package/dist/esm/icons/IconCalendar.js +0 -20
- package/dist/esm/schema/public-schema.json.js +0 -9026
- package/dist/esm/schema/runtime-schema.json.js +0 -8959
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { DataTable, DataTableBody } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
2
|
+
import { applyFormatter } from "../proteus-document/getProteusValue.js";
|
|
3
|
+
import { DataTable, DataTableBody } from "@optiaxiom/react";
|
|
4
|
+
import { get } from "jsonpointer";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { createColumnHelper, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
|
7
|
+
//#region src/proteus-data-table/ProteusDataTable.tsx
|
|
8
8
|
const ProteusDataTable = ({ columns, data }) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return /* @__PURE__ */ jsx(DataTable, { maxH: "md", table, children: /* @__PURE__ */ jsx(DataTableBody, {}) });
|
|
9
|
+
const tableData = data;
|
|
10
|
+
const columnHelper = createColumnHelper();
|
|
11
|
+
return /* @__PURE__ */ jsx(DataTable, {
|
|
12
|
+
maxH: "md",
|
|
13
|
+
table: useReactTable({
|
|
14
|
+
columns: (columns || []).map((col) => {
|
|
15
|
+
return columnHelper.accessor((row) => {
|
|
16
|
+
const value = get(row, "/" + col.accessorKey);
|
|
17
|
+
return col.format ? String(applyFormatter(value, col.format)) : value;
|
|
18
|
+
}, {
|
|
19
|
+
header: col.header,
|
|
20
|
+
id: col.accessorKey,
|
|
21
|
+
size: col.size
|
|
22
|
+
});
|
|
23
|
+
}),
|
|
24
|
+
data: tableData,
|
|
25
|
+
enableSorting: false,
|
|
26
|
+
getCoreRowModel: getCoreRowModel()
|
|
27
|
+
}),
|
|
28
|
+
children: /* @__PURE__ */ jsx(DataTableBody, {})
|
|
29
|
+
});
|
|
31
30
|
};
|
|
32
31
|
ProteusDataTable.displayName = "@optiaxiom/proteus/ProteusDataTable";
|
|
33
|
-
|
|
32
|
+
//#endregion
|
|
34
33
|
export { ProteusDataTable };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useProteusDocumentContext } from "../proteus-document/ProteusDocumentContext.js";
|
|
3
|
+
import { useProteusDocumentPathContext } from "../proteus-document/ProteusDocumentPathContext.js";
|
|
4
|
+
import { useProteusValue } from "../use-proteus-value/useProteusValue.js";
|
|
5
|
+
import { DateInput } from "@optiaxiom/react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/proteus-date-input/ProteusDateInput.tsx
|
|
8
|
+
function ProteusDateInput(props) {
|
|
9
|
+
const { onDataChange, readOnly } = useProteusDocumentContext("@optiaxiom/proteus/ProteusDateInput");
|
|
10
|
+
const { path: parentPath } = useProteusDocumentPathContext("@optiaxiom/proteus/ProteusDateInput");
|
|
11
|
+
const value = useProteusValue({ path: props.name ?? "" });
|
|
12
|
+
return /* @__PURE__ */ jsx(DateInput, {
|
|
13
|
+
...props,
|
|
14
|
+
onValueChange: (value) => {
|
|
15
|
+
if (props.name) onDataChange?.(`${parentPath}/${props.name}`, value);
|
|
16
|
+
},
|
|
17
|
+
readOnly,
|
|
18
|
+
value: props.name ? String(value ?? "") : ""
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
ProteusDateInput.displayName = "@optiaxiom/proteus/ProteusDateInput";
|
|
22
|
+
//#endregion
|
|
23
|
+
export { ProteusDateInput };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { createContext } from "@radix-ui/react-context";
|
|
4
|
+
//#region src/proteus-document/ProteusDocumentContext.ts
|
|
4
5
|
const [ProteusDocumentProvider, useProteusDocumentContext] = createContext("@optiaxiom/proteus/ProteusDocument");
|
|
5
|
-
|
|
6
|
+
//#endregion
|
|
6
7
|
export { ProteusDocumentProvider, useProteusDocumentContext };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { createContext } from "@radix-ui/react-context";
|
|
4
|
+
//#region src/proteus-document/ProteusDocumentPathContext.ts
|
|
4
5
|
const [ProteusDocumentPathProvider, useProteusDocumentPathContext] = createContext("@optiaxiom/proteus/ProteusDocumentPath", {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
mapIndices: [],
|
|
7
|
+
path: ""
|
|
7
8
|
});
|
|
8
|
-
|
|
9
|
+
//#endregion
|
|
9
10
|
export { ProteusDocumentPathProvider, useProteusDocumentPathContext };
|
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { ProteusElement } from
|
|
4
|
-
import { ProteusDocumentShell } from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
body: hasValue(result.data.body) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.body }),
|
|
26
|
-
subtitle: hasValue(result.data.subtitle) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.subtitle }),
|
|
27
|
-
title: hasValue(result.data.title) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.title })
|
|
28
|
-
},
|
|
29
|
-
strict,
|
|
30
|
-
...props
|
|
31
|
-
}
|
|
32
|
-
);
|
|
2
|
+
import { safeParseDocument } from "./schemas.js";
|
|
3
|
+
import { ProteusElement } from "../proteus-element/ProteusElement.js";
|
|
4
|
+
import { ProteusDocumentShell } from "./ProteusDocumentShell.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/proteus-document/ProteusDocumentRenderer.tsx
|
|
8
|
+
function ProteusDocumentRenderer({ element: elementProp, strict = false, ...props }) {
|
|
9
|
+
const result = safeParseDocument(elementProp);
|
|
10
|
+
if (!result.success) {
|
|
11
|
+
if (strict) throw new Error(`Invalid document: ${result.error.join("\n")}`);
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(ProteusDocumentShell, {
|
|
15
|
+
element: {
|
|
16
|
+
...result.data,
|
|
17
|
+
actions: hasValue(result.data.actions) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.actions }),
|
|
18
|
+
body: hasValue(result.data.body) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.body }),
|
|
19
|
+
subtitle: hasValue(result.data.subtitle) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.subtitle }),
|
|
20
|
+
title: hasValue(result.data.title) && /* @__PURE__ */ jsx(ProteusElement, { element: result.data.title })
|
|
21
|
+
},
|
|
22
|
+
strict,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
33
25
|
}
|
|
34
26
|
ProteusDocumentRenderer.displayName = "@optiaxiom/proteus/ProteusDocumentRenderer";
|
|
35
27
|
function hasValue(value) {
|
|
36
|
-
|
|
28
|
+
return !!value && (!Array.isArray(value) || value.length > 0);
|
|
37
29
|
}
|
|
38
|
-
|
|
30
|
+
//#endregion
|
|
39
31
|
export { ProteusDocumentRenderer };
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
var body = recipe({
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { recipe } from "@optiaxiom/react/css-runtime";
|
|
2
|
+
import "./../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-BPytQ9pT.css";
|
|
3
|
+
//#region src/proteus-document/ProteusDocumentShell.css.ts
|
|
4
|
+
var body = recipe({
|
|
5
|
+
base: [{
|
|
6
|
+
flexDirection: "column",
|
|
7
|
+
gap: "16"
|
|
8
|
+
}, "ProteusDocumentShell__vpuvfj0"],
|
|
9
|
+
variants: { truncate: {
|
|
10
|
+
false: {},
|
|
11
|
+
true: [{
|
|
12
|
+
maxH: "sm",
|
|
13
|
+
overflow: "auto",
|
|
14
|
+
p: "4"
|
|
15
|
+
}, "ProteusDocumentShell__vpuvfj1"]
|
|
16
|
+
} }
|
|
17
|
+
});
|
|
18
|
+
var scrollIndicator = recipe({ base: [{
|
|
19
|
+
bg: "bg.secondary",
|
|
20
|
+
border: "1",
|
|
21
|
+
borderColor: "border.secondary",
|
|
22
|
+
color: "fg.secondary",
|
|
23
|
+
display: "grid",
|
|
24
|
+
flex: "none",
|
|
25
|
+
placeItems: "center",
|
|
26
|
+
pointerEvents: "none",
|
|
27
|
+
rounded: "full",
|
|
28
|
+
shadow: "sm",
|
|
29
|
+
size: "lg",
|
|
30
|
+
transition: "opacity"
|
|
31
|
+
}, "ProteusDocumentShell__vpuvfj2"] });
|
|
32
|
+
//#endregion
|
|
7
33
|
export { body, scrollIndicator };
|