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