@optiaxiom/proteus 1.1.5 → 1.1.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 (21) hide show
  1. package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BYvPGdWv.css → ProteusChart.css.ts.vanilla-DCpG7JJL.css} +2 -2
  2. package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-CykN-vdX.css → ProteusChartTooltipContent.css.ts.vanilla-DwYO42tr.css} +2 -2
  3. package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-CnC9TXlJ.css → ProteusDocumentShell.css.ts.vanilla-BW7NpwDV.css} +2 -2
  4. package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-CPqn1tWx.css → ProteusImageCarousel.css.ts.vanilla-CAkWZRTL.css} +2 -2
  5. package/dist/esm/assets/src/proteus-markdown/ProteusMarkdown.css.ts.vanilla-DOGP_rJU.css +61 -0
  6. package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-DXJt60Ji.css → ProteusQuestion.css.ts.vanilla-Bx-y2xg6.css} +2 -2
  7. package/dist/esm/index.js +2 -1
  8. package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
  9. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
  10. package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
  11. package/dist/esm/proteus-element/ProteusElement.js +2 -0
  12. package/dist/esm/proteus-image/ProteusImage.js +25 -84
  13. package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +2 -1
  14. package/dist/esm/proteus-image-carousel/ProteusImageCarousel.js +21 -7
  15. package/dist/esm/proteus-markdown/ProteusMarkdown-css.js +29 -0
  16. package/dist/esm/proteus-markdown/ProteusMarkdown.js +120 -0
  17. package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
  18. package/dist/esm/schema/public-schema.js +75 -0
  19. package/dist/esm/schema/runtime-schema.js +74 -0
  20. package/dist/index.d.ts +38 -6
  21. package/package.json +4 -2
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.dx1887;
2
- @layer optiaxiom.dx1887 {
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
3
  .ProteusChart__jmlqij1 {
4
4
  border-radius: 16px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.dx1887;
2
- @layer optiaxiom.dx1887 {
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
3
  .ProteusChartTooltipContent__1gsvq810 {
4
4
  min-width: 128px;
5
5
  position: absolute;
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.dx1887;
2
- @layer optiaxiom.dx1887 {
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
3
  .ProteusDocumentShell__vpuvfj1 {
4
4
  margin: -4px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.dx1887;
2
- @layer optiaxiom.dx1887 {
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
3
  .ProteusImageCarousel__1t6qej70 {
4
4
  outline: none;
5
5
  user-select: none;
@@ -0,0 +1,61 @@
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
+ .ProteusMarkdown__1ibq5ae0 > * {
4
+ margin-bottom: 1em;
5
+ margin-top: 0;
6
+ }
7
+ .ProteusMarkdown__1ibq5ae0 li > * {
8
+ margin-bottom: 1em;
9
+ margin-top: 1em;
10
+ }
11
+ .ProteusMarkdown__1ibq5ae0 li:first-child > * {
12
+ margin-top: 0;
13
+ }
14
+ :is(.ProteusMarkdown__1ibq5ae0, .ProteusMarkdown__1ibq5ae0 li) > :is(h1, h2, h3, h4, h5, h6) {
15
+ margin-bottom: 0.6em;
16
+ margin-top: 1.2em;
17
+ }
18
+ .ProteusMarkdown__1ibq5ae0 > .ProteusMarkdown__1ibq5ae1 {
19
+ margin-bottom: 1em;
20
+ margin-top: 1em;
21
+ }
22
+ :is(.ProteusMarkdown__1ibq5ae0, .ProteusMarkdown__1ibq5ae0 li) > :is(h1, h2, h3, h4, h5, h6) + * {
23
+ margin-top: 0;
24
+ }
25
+ .ProteusMarkdown__1ibq5ae0 > :has(+ .ProteusMarkdown__1ibq5ae1), :is(.ProteusMarkdown__1ibq5ae0, .ProteusMarkdown__1ibq5ae0 li) > :last-child {
26
+ margin-bottom: 0;
27
+ }
28
+ .ProteusMarkdown__1ibq5ae0 > .ProteusMarkdown__1ibq5ae1 + *, .ProteusMarkdown__1ibq5ae0 > :first-child {
29
+ margin-top: 0;
30
+ }
31
+ .ProteusMarkdown__1ibq5ae2 {
32
+ margin-bottom: 2em;
33
+ margin-top: 2em;
34
+ }
35
+ .ProteusMarkdown__1ibq5ae3 {
36
+ list-style-type: decimal;
37
+ padding-inline-start: 1.5em;
38
+ }
39
+ .ProteusMarkdown__1ibq5ae4 {
40
+ list-style-type: disc;
41
+ padding-inline-start: 1.5em;
42
+ }
43
+ .ProteusMarkdown__1ibq5ae5 code {
44
+ background-color: transparent;
45
+ border-radius: 0;
46
+ padding: 0;
47
+ }
48
+ .ProteusMarkdown__1ibq5ae6 {
49
+ background-color: var(--ax-colors-bg-secondary);
50
+ border-radius: var(--ax-borderRadius-md);
51
+ font-size: 85%;
52
+ font-variant-ligatures: none;
53
+ padding: 0.2em 0.4em;
54
+ white-space: break-spaces;
55
+ }
56
+ .ProteusMarkdown__1ibq5ae7 {
57
+ display: inline-block;
58
+ max-width: 100%;
59
+ vertical-align: text-bottom;
60
+ }
61
+ }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.dx1887;
2
- @layer optiaxiom.dx1887 {
1
+ @layer optiaxiom.dk5man;
2
+ @layer optiaxiom.dk5man {
3
3
  .ProteusQuestion__8f590p0 {
4
4
  outline: none;
5
5
  }
package/dist/esm/index.js CHANGED
@@ -13,6 +13,7 @@ import { ProteusInput } from "./proteus-input/ProteusInput.js";
13
13
  import { ProteusLength } from "./proteus-length/ProteusLength.js";
14
14
  import { ProteusMapIndex } from "./proteus-map-index/ProteusMapIndex.js";
15
15
  import { ProteusMap } from "./proteus-map/ProteusMap.js";
16
+ import { ProteusMarkdown } from "./proteus-markdown/ProteusMarkdown.js";
16
17
  import { ProteusPillMenu } from "./proteus-pill-menu/ProteusPillMenu.js";
17
18
  import { ProteusRichTextEditor } from "./proteus-rich-text-editor/ProteusRichTextEditor.js";
18
19
  import { ProteusSelect } from "./proteus-select/ProteusSelect.js";
@@ -20,4 +21,4 @@ import { ProteusShow } from "./proteus-show/ProteusShow.js";
20
21
  import { ProteusTextarea } from "./proteus-textarea/ProteusTextarea.js";
21
22
  import { ProteusDocumentShell } from "./proteus-document/ProteusDocumentShell.js";
22
23
  import { ProteusDocumentRenderer } from "./proteus-document/ProteusDocumentRenderer.js";
23
- export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDateInput, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFederated, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusLength, ProteusMap, ProteusMapIndex, ProteusPillMenu, ProteusRichTextEditor, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
24
+ export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDateInput, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFederated, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusLength, ProteusMap, ProteusMapIndex, ProteusMarkdown, ProteusPillMenu, ProteusRichTextEditor, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
@@ -1,4 +1,4 @@
1
- import "./../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-BYvPGdWv.css";
1
+ import "./../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-DCpG7JJL.css";
2
2
  import { recipe } from "@optiaxiom/react/css-runtime";
3
3
  //#region src/proteus-chart/ProteusChart.css.ts
4
4
  var chart = recipe({ base: [
@@ -1,5 +1,5 @@
1
1
  import { recipe } from "@optiaxiom/react/css-runtime";
2
- import "./../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-CykN-vdX.css";
2
+ import "./../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-DwYO42tr.css";
3
3
  //#region src/proteus-chart/ProteusChartTooltipContent.css.ts
4
4
  var tooltip = recipe({ base: [{
5
5
  bg: "bg.default",
@@ -1,5 +1,5 @@
1
1
  import { recipe } from "@optiaxiom/react/css-runtime";
2
- import "./../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-CnC9TXlJ.css";
2
+ import "./../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-BW7NpwDV.css";
3
3
  //#region src/proteus-document/ProteusDocumentShell.css.ts
4
4
  var body = recipe({
5
5
  base: [{
@@ -17,6 +17,7 @@ import { ProteusInput } from "../proteus-input/ProteusInput.js";
17
17
  import { ProteusLength } from "../proteus-length/ProteusLength.js";
18
18
  import { ProteusMapIndex } from "../proteus-map-index/ProteusMapIndex.js";
19
19
  import { ProteusMap } from "../proteus-map/ProteusMap.js";
20
+ import { ProteusMarkdown } from "../proteus-markdown/ProteusMarkdown.js";
20
21
  import { ProteusPillMenu } from "../proteus-pill-menu/ProteusPillMenu.js";
21
22
  import { ProteusQuestion } from "../proteus-question/ProteusQuestion.js";
22
23
  import { ProteusRichTextEditor } from "../proteus-rich-text-editor/ProteusRichTextEditor.js";
@@ -100,6 +101,7 @@ const ProteusElement = ({ element: elementProp }) => {
100
101
  });
101
102
  case "Map": return /* @__PURE__ */ jsx(ProteusMap, { ...resolve(element) });
102
103
  case "MapIndex": return /* @__PURE__ */ jsx(ProteusMapIndex, { ...resolve(element) });
104
+ case "Markdown": return /* @__PURE__ */ jsx(ProteusMarkdown, { ...resolve(element) });
103
105
  case "PillMenu": return /* @__PURE__ */ jsx(ProteusPillMenu, { ...resolve(element) });
104
106
  case "Question": return /* @__PURE__ */ jsx(ProteusQuestion, { ...resolve(element) });
105
107
  case "Range": return /* @__PURE__ */ jsx(Range, { ...resolve(element) });
@@ -1,13 +1,9 @@
1
1
  "use client";
2
- import { useProteusDocumentContext } from "../proteus-document/ProteusDocumentContext.js";
3
- import { Box, Button, Dialog, DialogBody, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTrigger, Spinner } from "@optiaxiom/react";
2
+ import { Box, Spinner } from "@optiaxiom/react";
4
3
  import { useState } from "react";
5
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
5
  //#region src/proteus-image/ProteusImage.tsx
7
- function ProteusImage(props) {
8
- const { onEvent } = useProteusDocumentContext("@optiaxiom/proteus/ProteusImage");
9
- const [open, setOpen] = useState(false);
10
- const [isDownloading, setIsDownloading] = useState(false);
6
+ function ProteusImage({ ...props }) {
11
7
  const [isLoaded, setIsLoaded] = useState(false);
12
8
  return /* @__PURE__ */ jsxs(Fragment, { children: [!isLoaded && /* @__PURE__ */ jsx(Box, {
13
9
  alignItems: "center",
@@ -16,87 +12,32 @@ function ProteusImage(props) {
16
12
  justifyContent: "center",
17
13
  p: "24",
18
14
  rounded: "md",
19
- style: { aspectRatio: "16 / 9" },
20
15
  w: "full",
21
16
  ...props,
22
17
  children: /* @__PURE__ */ jsx(Spinner, {})
23
- }), /* @__PURE__ */ jsxs(Dialog, {
24
- onOpenChange: setOpen,
25
- open,
26
- children: [/* @__PURE__ */ jsx(DialogTrigger, {
27
- "aria-label": "Expand",
28
- asChild: true,
29
- children: /* @__PURE__ */ jsx(Box, {
30
- asChild: true,
31
- cursor: "pointer",
32
- display: isLoaded ? "flex" : "none",
33
- objectFit: "contain",
34
- overflow: "hidden",
35
- rounded: "inherit",
36
- size: "full",
37
- ...props,
38
- children: /* @__PURE__ */ jsx("img", {
39
- alt: props.alt,
40
- draggable: true,
41
- onDragStart: (event) => {
42
- event.stopPropagation();
43
- event.dataTransfer.effectAllowed = "copy";
44
- event.dataTransfer.setData("opal-chat-dnd-data", JSON.stringify({
45
- link: props.src,
46
- mime_type: "image/*",
47
- name: props.src?.split("/").pop()
48
- }));
49
- },
50
- onLoad: () => setIsLoaded(true),
51
- src: props.src
52
- })
53
- })
54
- }), /* @__PURE__ */ jsxs(DialogContent, {
55
- size: "fullscreen",
56
- children: [
57
- /* @__PURE__ */ jsx(DialogHeader, {
58
- lineClamp: "1",
59
- children: props.alt
60
- }),
61
- /* @__PURE__ */ jsx(DialogBody, {
62
- overflow: "hidden",
63
- children: /* @__PURE__ */ jsx(Box, {
64
- asChild: true,
65
- display: "block",
66
- maxH: "full",
67
- maxW: "full",
68
- objectFit: "contain",
69
- children: /* @__PURE__ */ jsx("img", {
70
- alt: props.alt,
71
- src: props.src
72
- })
73
- })
74
- }),
75
- /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, { children: "Close" }), /* @__PURE__ */ jsx(Button, {
76
- appearance: "primary",
77
- asChild: true,
78
- loading: isDownloading,
79
- onClick: async (event) => {
80
- event.preventDefault();
81
- if (isDownloading) return;
82
- setIsDownloading(true);
83
- try {
84
- await onEvent({
85
- action: "download",
86
- url: String(props.src)
87
- });
88
- } finally {
89
- setIsDownloading(false);
90
- }
91
- },
92
- children: /* @__PURE__ */ jsx("a", {
93
- download: true,
94
- href: props.src,
95
- children: "Download"
96
- })
97
- })] })
98
- ]
99
- })]
18
+ }), /* @__PURE__ */ jsx(Box, {
19
+ asChild: true,
20
+ display: isLoaded ? "flex" : "none",
21
+ objectFit: "contain",
22
+ overflow: "hidden",
23
+ rounded: "inherit",
24
+ size: "full",
25
+ ...props,
26
+ children: /* @__PURE__ */ jsx("img", {
27
+ alt: props.alt,
28
+ draggable: true,
29
+ onDragStart: (event) => {
30
+ event.stopPropagation();
31
+ event.dataTransfer.effectAllowed = "copy";
32
+ event.dataTransfer.setData("opal-chat-dnd-data", JSON.stringify({
33
+ link: props.src,
34
+ mime_type: "image/*",
35
+ name: props.src?.split("/").pop()
36
+ }));
37
+ },
38
+ onLoad: () => setIsLoaded(true),
39
+ src: props.src
40
+ })
100
41
  })] });
101
42
  }
102
43
  ProteusImage.displayName = "@optiaxiom/proteus/ProteusImage";
@@ -1,5 +1,5 @@
1
1
  import { recipe } from "@optiaxiom/react/css-runtime";
2
- import "./../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-CPqn1tWx.css";
2
+ import "./../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-CAkWZRTL.css";
3
3
  //#region src/proteus-image-carousel/ProteusImageCarousel.css.ts
4
4
  var carousel = recipe({ base: [{
5
5
  flexDirection: "column",
@@ -26,6 +26,7 @@ var navButton = recipe({
26
26
  } }
27
27
  });
28
28
  var slide = recipe({ base: [{
29
+ cursor: "pointer",
29
30
  objectFit: "cover",
30
31
  size: "full"
31
32
  }, "ProteusImageCarousel__1t6qej74"] });
@@ -24,8 +24,9 @@ function ProteusImageCarousel({ images, title }) {
24
24
  const [canScrollNext, setCanScrollNext] = useState(false);
25
25
  const onSelect = useCallback(() => {
26
26
  if (!emblaMainApi || !emblaThumbsApi) return;
27
- setSelectedIndex(emblaMainApi.selectedScrollSnap());
28
- emblaThumbsApi.scrollTo(emblaMainApi.selectedScrollSnap());
27
+ const index = emblaMainApi.selectedScrollSnap();
28
+ setSelectedIndex(index);
29
+ emblaThumbsApi.scrollTo(index);
29
30
  setCanScrollPrev(emblaMainApi.canScrollPrev());
30
31
  setCanScrollNext(emblaMainApi.canScrollNext());
31
32
  }, [emblaMainApi, emblaThumbsApi]);
@@ -61,7 +62,11 @@ function ProteusImageCarousel({ images, title }) {
61
62
  children: /* @__PURE__ */ jsx(Group, {
62
63
  ...slideContainer(),
63
64
  children: images.map((image, index) => /* @__PURE__ */ jsx(ProteusImage, {
64
- alt: image.alt,
65
+ alt: image.name ?? image.alt,
66
+ onClick: () => onEvent({
67
+ action: "preview",
68
+ file: toPreviewFile(image)
69
+ }),
65
70
  src: image.src,
66
71
  ...slide()
67
72
  }, index))
@@ -96,7 +101,7 @@ function ProteusImageCarousel({ images, title }) {
96
101
  objectFit: "cover",
97
102
  size: "full",
98
103
  children: /* @__PURE__ */ jsx("img", {
99
- alt: image.alt,
104
+ alt: image.name ?? image.alt,
100
105
  src: image.thumb ?? image.src
101
106
  })
102
107
  })
@@ -122,13 +127,13 @@ function ProteusImageCarousel({ images, title }) {
122
127
  options: [{
123
128
  execute: () => onEvent({
124
129
  action: "download",
125
- url: images[selectedIndex].src
130
+ url: images[selectedIndex].file_link ?? images[selectedIndex].src
126
131
  }),
127
132
  label: "Download this image"
128
133
  }, {
129
134
  execute: () => onEvent({
130
135
  action: "download",
131
- url: images.map((image) => image.src)
136
+ url: images.map((image) => image.file_link ?? image.src)
132
137
  }),
133
138
  label: "Download all images"
134
139
  }],
@@ -142,7 +147,7 @@ function ProteusImageCarousel({ images, title }) {
142
147
  ml: "auto",
143
148
  onClick: () => onEvent({
144
149
  action: "download",
145
- url: images[0].src
150
+ url: images[0].file_link ?? images[0].src
146
151
  }),
147
152
  children: "Download"
148
153
  })]
@@ -150,6 +155,15 @@ function ProteusImageCarousel({ images, title }) {
150
155
  ]
151
156
  });
152
157
  }
158
+ function toPreviewFile({ alt, extension, file_link, full_name, mime_type, name, src }) {
159
+ return {
160
+ extension: extension ?? "JPG",
161
+ file_link: file_link ?? src,
162
+ full_name: full_name ?? alt ?? src,
163
+ mime_type: mime_type ?? "image/jpeg",
164
+ name: name ?? alt ?? src
165
+ };
166
+ }
153
167
  ProteusImageCarousel.displayName = "@optiaxiom/proteus/ProteusImageCarousel";
154
168
  //#endregion
155
169
  export { ProteusImageCarousel };
@@ -0,0 +1,29 @@
1
+ import { recipe } from "@optiaxiom/react/css-runtime";
2
+ import "./../assets/src/proteus-markdown/ProteusMarkdown.css.ts.vanilla-DOGP_rJU.css";
3
+ //#region src/proteus-markdown/ProteusMarkdown.css.ts
4
+ var code = recipe({ base: [{
5
+ bg: "bg.secondary",
6
+ overflow: "auto",
7
+ p: "12",
8
+ rounded: "md"
9
+ }, "ProteusMarkdown__1ibq5ae5"] });
10
+ var inlineCode = recipe({ base: [{ fontFamily: "mono" }, "ProteusMarkdown__1ibq5ae6"] });
11
+ var inlineImage = recipe({ base: [{ rounded: "sm" }, "ProteusMarkdown__1ibq5ae7"] });
12
+ var markdown = recipe({ base: [{
13
+ color: "fg.default",
14
+ fontSize: "md"
15
+ }, "ProteusMarkdown__1ibq5ae0"] });
16
+ var orderedList = recipe({ base: [{
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ gap: "6"
20
+ }, "ProteusMarkdown__1ibq5ae3"] });
21
+ var separator = "ProteusMarkdown__1ibq5ae1";
22
+ var table = recipe({ base: ["ProteusMarkdown__1ibq5ae2"] });
23
+ var unorderedList = recipe({ base: [{
24
+ display: "flex",
25
+ flexDirection: "column",
26
+ gap: "6"
27
+ }, "ProteusMarkdown__1ibq5ae4"] });
28
+ //#endregion
29
+ export { code, inlineCode, inlineImage, markdown, orderedList, separator, table, unorderedList };
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { code, inlineCode, inlineImage, markdown, orderedList, separator, table, unorderedList } from "./ProteusMarkdown-css.js";
3
+ import { Box, Heading, Link, Separator, Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow, Text } from "@optiaxiom/react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import Markdown from "react-markdown";
6
+ import remarkGfm from "remark-gfm";
7
+ //#region src/proteus-markdown/ProteusMarkdown.tsx
8
+ const mapLevelToFontSize = {
9
+ "1": "2xl",
10
+ "2": "xl",
11
+ "3": "lg",
12
+ "4": "md"
13
+ };
14
+ /**
15
+ * Maps markdown heading levels (h1-h6) onto Axiom Heading levels (1-4). Markdown
16
+ * supports six levels but Heading only supports four, so deeper levels are
17
+ * clamped to the smallest visual size.
18
+ */
19
+ const heading = (level, Tag) => function MarkdownHeading({ children }) {
20
+ return /* @__PURE__ */ jsx(Heading, {
21
+ asChild: true,
22
+ fontSize: mapLevelToFontSize[level],
23
+ fontWeight: "600",
24
+ level,
25
+ children: /* @__PURE__ */ jsx(Tag, { children })
26
+ });
27
+ };
28
+ const components = {
29
+ a: ({ children, href }) => /* @__PURE__ */ jsx(Link, {
30
+ href,
31
+ rel: "noopener noreferrer",
32
+ target: "_blank",
33
+ children
34
+ }),
35
+ blockquote: ({ children }) => /* @__PURE__ */ jsx(Box, {
36
+ asChild: true,
37
+ borderL: "2",
38
+ color: "fg.secondary",
39
+ px: "16",
40
+ py: "6",
41
+ children: /* @__PURE__ */ jsx("blockquote", { children })
42
+ }),
43
+ code: ({ children }) => /* @__PURE__ */ jsx(Box, {
44
+ asChild: true,
45
+ ...inlineCode(),
46
+ children: /* @__PURE__ */ jsx("code", { children })
47
+ }),
48
+ em: ({ children }) => /* @__PURE__ */ jsx(Box, {
49
+ asChild: true,
50
+ children: /* @__PURE__ */ jsx("em", { children })
51
+ }),
52
+ h1: heading("1", "h1"),
53
+ h2: heading("2", "h2"),
54
+ h3: heading("3", "h3"),
55
+ h4: heading("4", "h4"),
56
+ h5: heading("4", "h5"),
57
+ h6: heading("4", "h6"),
58
+ hr: () => /* @__PURE__ */ jsx(Separator, { className: separator }),
59
+ img: ({ alt, src }) => typeof src === "string" ? /* @__PURE__ */ jsx(Box, {
60
+ asChild: true,
61
+ ...inlineImage(),
62
+ children: /* @__PURE__ */ jsx("img", {
63
+ alt: alt ?? "",
64
+ src
65
+ })
66
+ }) : null,
67
+ li: ({ children }) => /* @__PURE__ */ jsx(Text, {
68
+ asChild: true,
69
+ children: /* @__PURE__ */ jsx("li", { children })
70
+ }),
71
+ ol: ({ children }) => /* @__PURE__ */ jsx(Box, {
72
+ asChild: true,
73
+ ...orderedList(),
74
+ children: /* @__PURE__ */ jsx("ol", { children })
75
+ }),
76
+ p: ({ children }) => /* @__PURE__ */ jsx(Text, { children }),
77
+ pre: ({ children }) => /* @__PURE__ */ jsx(Box, {
78
+ asChild: true,
79
+ ...code(),
80
+ children: /* @__PURE__ */ jsx("pre", { children })
81
+ }),
82
+ strong: ({ children }) => /* @__PURE__ */ jsx(Box, {
83
+ asChild: true,
84
+ display: "inline",
85
+ fontWeight: "600",
86
+ children: /* @__PURE__ */ jsx("strong", { children })
87
+ }),
88
+ table: ({ children }) => /* @__PURE__ */ jsx(Table, {
89
+ ...table(),
90
+ children
91
+ }),
92
+ tbody: ({ children }) => /* @__PURE__ */ jsx(TableBody, { children }),
93
+ td: ({ children }) => /* @__PURE__ */ jsx(TableCell, { children }),
94
+ th: ({ children }) => /* @__PURE__ */ jsx(TableHeaderCell, { children }),
95
+ thead: ({ children }) => /* @__PURE__ */ jsx(TableHeader, { children }),
96
+ tr: ({ children }) => /* @__PURE__ */ jsx(TableRow, { children }),
97
+ ul: ({ children }) => /* @__PURE__ */ jsx(Box, {
98
+ asChild: true,
99
+ ...unorderedList(),
100
+ children: /* @__PURE__ */ jsx("ul", { children })
101
+ })
102
+ };
103
+ /**
104
+ * Renders markdown content (headings, paragraphs, lists, links, emphasis, code)
105
+ * as Axiom components so generated documents inherit the design system.
106
+ */
107
+ function ProteusMarkdown({ children, className, ...props }) {
108
+ return /* @__PURE__ */ jsx(Box, {
109
+ ...markdown({}, className),
110
+ ...props,
111
+ children: /* @__PURE__ */ jsx(Markdown, {
112
+ components,
113
+ remarkPlugins: [remarkGfm],
114
+ children
115
+ })
116
+ });
117
+ }
118
+ ProteusMarkdown.displayName = "@optiaxiom/proteus/ProteusMarkdown";
119
+ //#endregion
120
+ export { ProteusMarkdown };
@@ -1,5 +1,5 @@
1
1
  import { recipe } from "@optiaxiom/react/css-runtime";
2
- import "./../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-DXJt60Ji.css";
2
+ import "./../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-Bx-y2xg6.css";
3
3
  //#region src/proteus-question/ProteusQuestion.css.ts
4
4
  var addon = recipe({
5
5
  base: [{
@@ -1296,6 +1296,7 @@ var public_schema_default = {
1296
1296
  { "$ref": "#/definitions/ProteusLink" },
1297
1297
  { "$ref": "#/definitions/ProteusMap" },
1298
1298
  { "$ref": "#/definitions/ProteusMapIndex" },
1299
+ { "$ref": "#/definitions/ProteusMarkdown" },
1299
1300
  { "$ref": "#/definitions/ProteusPillMenu" },
1300
1301
  { "$ref": "#/definitions/ProteusQuestion" },
1301
1302
  { "$ref": "#/definitions/ProteusRange" },
@@ -3691,6 +3692,80 @@ var public_schema_default = {
3691
3692
  "required": ["$type"],
3692
3693
  "type": "object"
3693
3694
  },
3695
+ "ProteusMarkdown": {
3696
+ "additionalProperties": false,
3697
+ "examples": [{
3698
+ "$type": "Markdown",
3699
+ "children": "## Summary\n\nRevenue grew **12%** this quarter."
3700
+ }],
3701
+ "properties": {
3702
+ "$type": { "const": "Markdown" },
3703
+ "alignItems": { "$ref": "#/definitions/SprinkleProp_alignItems" },
3704
+ "alignSelf": { "$ref": "#/definitions/SprinkleProp_alignSelf" },
3705
+ "animation": { "$ref": "#/definitions/SprinkleProp_animation" },
3706
+ "backgroundImage": { "$ref": "#/definitions/SprinkleProp_backgroundImage" },
3707
+ "bg": { "$ref": "#/definitions/SprinkleProp_bg" },
3708
+ "border": { "$ref": "#/definitions/SprinkleProp_border" },
3709
+ "borderB": { "$ref": "#/definitions/SprinkleProp_borderB" },
3710
+ "borderColor": { "$ref": "#/definitions/SprinkleProp_borderColor" },
3711
+ "borderL": { "$ref": "#/definitions/SprinkleProp_borderL" },
3712
+ "borderR": { "$ref": "#/definitions/SprinkleProp_borderR" },
3713
+ "borderT": { "$ref": "#/definitions/SprinkleProp_borderT" },
3714
+ "children": {
3715
+ "anyOf": [{ "type": "string" }, { "$ref": "#/definitions/ProteusExpression" }],
3716
+ "description": "Markdown source string to render (e.g. headings, paragraphs, lists, links, emphasis, code). Can be a literal string or a ProteusExpression that resolves to a string."
3717
+ },
3718
+ "color": { "$ref": "#/definitions/SprinkleProp_color" },
3719
+ "cursor": { "$ref": "#/definitions/SprinkleProp_cursor" },
3720
+ "display": { "$ref": "#/definitions/SprinkleProp_display" },
3721
+ "flex": { "$ref": "#/definitions/SprinkleProp_flex" },
3722
+ "flexDirection": { "$ref": "#/definitions/SprinkleProp_flexDirection" },
3723
+ "flexWrap": { "$ref": "#/definitions/SprinkleProp_flexWrap" },
3724
+ "fontFamily": { "$ref": "#/definitions/SprinkleProp_fontFamily" },
3725
+ "fontSize": { "$ref": "#/definitions/SprinkleProp_fontSize" },
3726
+ "fontWeight": { "$ref": "#/definitions/SprinkleProp_fontWeight" },
3727
+ "gap": { "$ref": "#/definitions/SprinkleProp_gap" },
3728
+ "gridAutoRows": { "$ref": "#/definitions/SprinkleProp_gridAutoRows" },
3729
+ "gridColumn": { "$ref": "#/definitions/SprinkleProp_gridColumn" },
3730
+ "gridTemplateColumns": { "$ref": "#/definitions/SprinkleProp_gridTemplateColumns" },
3731
+ "h": { "$ref": "#/definitions/SprinkleProp_h" },
3732
+ "justifyContent": { "$ref": "#/definitions/SprinkleProp_justifyContent" },
3733
+ "justifyItems": { "$ref": "#/definitions/SprinkleProp_justifyItems" },
3734
+ "m": { "$ref": "#/definitions/SprinkleProp_m" },
3735
+ "maxH": { "$ref": "#/definitions/SprinkleProp_maxH" },
3736
+ "maxW": { "$ref": "#/definitions/SprinkleProp_maxW" },
3737
+ "mb": { "$ref": "#/definitions/SprinkleProp_mb" },
3738
+ "ml": { "$ref": "#/definitions/SprinkleProp_ml" },
3739
+ "mr": { "$ref": "#/definitions/SprinkleProp_mr" },
3740
+ "mt": { "$ref": "#/definitions/SprinkleProp_mt" },
3741
+ "mx": { "$ref": "#/definitions/SprinkleProp_mx" },
3742
+ "my": { "$ref": "#/definitions/SprinkleProp_my" },
3743
+ "objectFit": { "$ref": "#/definitions/SprinkleProp_objectFit" },
3744
+ "overflow": { "$ref": "#/definitions/SprinkleProp_overflow" },
3745
+ "overflowX": { "$ref": "#/definitions/SprinkleProp_overflowX" },
3746
+ "overflowY": { "$ref": "#/definitions/SprinkleProp_overflowY" },
3747
+ "p": { "$ref": "#/definitions/SprinkleProp_p" },
3748
+ "pb": { "$ref": "#/definitions/SprinkleProp_pb" },
3749
+ "pl": { "$ref": "#/definitions/SprinkleProp_pl" },
3750
+ "placeItems": { "$ref": "#/definitions/SprinkleProp_placeItems" },
3751
+ "pointerEvents": { "$ref": "#/definitions/SprinkleProp_pointerEvents" },
3752
+ "pr": { "$ref": "#/definitions/SprinkleProp_pr" },
3753
+ "pt": { "$ref": "#/definitions/SprinkleProp_pt" },
3754
+ "px": { "$ref": "#/definitions/SprinkleProp_px" },
3755
+ "py": { "$ref": "#/definitions/SprinkleProp_py" },
3756
+ "rounded": { "$ref": "#/definitions/SprinkleProp_rounded" },
3757
+ "shadow": { "$ref": "#/definitions/SprinkleProp_shadow" },
3758
+ "size": { "$ref": "#/definitions/SprinkleProp_size" },
3759
+ "textAlign": { "$ref": "#/definitions/SprinkleProp_textAlign" },
3760
+ "textTransform": { "$ref": "#/definitions/SprinkleProp_textTransform" },
3761
+ "transition": { "$ref": "#/definitions/SprinkleProp_transition" },
3762
+ "w": { "$ref": "#/definitions/SprinkleProp_w" },
3763
+ "whiteSpace": { "$ref": "#/definitions/SprinkleProp_whiteSpace" },
3764
+ "z": { "$ref": "#/definitions/SprinkleProp_z" }
3765
+ },
3766
+ "required": ["$type"],
3767
+ "type": "object"
3768
+ },
3694
3769
  "ProteusPillMenu": {
3695
3770
  "additionalProperties": false,
3696
3771
  "examples": [{
@@ -1283,6 +1283,7 @@ var definitions = {
1283
1283
  { "$ref": "#/definitions/ProteusLink" },
1284
1284
  { "$ref": "#/definitions/ProteusMap" },
1285
1285
  { "$ref": "#/definitions/ProteusMapIndex" },
1286
+ { "$ref": "#/definitions/ProteusMarkdown" },
1286
1287
  { "$ref": "#/definitions/ProteusPillMenu" },
1287
1288
  { "$ref": "#/definitions/ProteusQuestion" },
1288
1289
  { "$ref": "#/definitions/ProteusRange" },
@@ -3633,6 +3634,79 @@ var definitions = {
3633
3634
  "required": ["$type"],
3634
3635
  "type": "object"
3635
3636
  },
3637
+ "ProteusMarkdown": {
3638
+ "examples": [{
3639
+ "$type": "Markdown",
3640
+ "children": "## Summary\n\nRevenue grew **12%** this quarter."
3641
+ }],
3642
+ "properties": {
3643
+ "$type": { "const": "Markdown" },
3644
+ "alignItems": { "$ref": "#/definitions/SprinkleProp_alignItems" },
3645
+ "alignSelf": { "$ref": "#/definitions/SprinkleProp_alignSelf" },
3646
+ "animation": { "$ref": "#/definitions/SprinkleProp_animation" },
3647
+ "backgroundImage": { "$ref": "#/definitions/SprinkleProp_backgroundImage" },
3648
+ "bg": { "$ref": "#/definitions/SprinkleProp_bg" },
3649
+ "border": { "$ref": "#/definitions/SprinkleProp_border" },
3650
+ "borderB": { "$ref": "#/definitions/SprinkleProp_borderB" },
3651
+ "borderColor": { "$ref": "#/definitions/SprinkleProp_borderColor" },
3652
+ "borderL": { "$ref": "#/definitions/SprinkleProp_borderL" },
3653
+ "borderR": { "$ref": "#/definitions/SprinkleProp_borderR" },
3654
+ "borderT": { "$ref": "#/definitions/SprinkleProp_borderT" },
3655
+ "children": {
3656
+ "anyOf": [{ "type": "string" }, { "$ref": "#/definitions/ProteusExpression" }],
3657
+ "description": "Markdown source string to render (e.g. headings, paragraphs, lists, links, emphasis, code). Can be a literal string or a ProteusExpression that resolves to a string."
3658
+ },
3659
+ "color": { "$ref": "#/definitions/SprinkleProp_color" },
3660
+ "cursor": { "$ref": "#/definitions/SprinkleProp_cursor" },
3661
+ "display": { "$ref": "#/definitions/SprinkleProp_display" },
3662
+ "flex": { "$ref": "#/definitions/SprinkleProp_flex" },
3663
+ "flexDirection": { "$ref": "#/definitions/SprinkleProp_flexDirection" },
3664
+ "flexWrap": { "$ref": "#/definitions/SprinkleProp_flexWrap" },
3665
+ "fontFamily": { "$ref": "#/definitions/SprinkleProp_fontFamily" },
3666
+ "fontSize": { "$ref": "#/definitions/SprinkleProp_fontSize" },
3667
+ "fontWeight": { "$ref": "#/definitions/SprinkleProp_fontWeight" },
3668
+ "gap": { "$ref": "#/definitions/SprinkleProp_gap" },
3669
+ "gridAutoRows": { "$ref": "#/definitions/SprinkleProp_gridAutoRows" },
3670
+ "gridColumn": { "$ref": "#/definitions/SprinkleProp_gridColumn" },
3671
+ "gridTemplateColumns": { "$ref": "#/definitions/SprinkleProp_gridTemplateColumns" },
3672
+ "h": { "$ref": "#/definitions/SprinkleProp_h" },
3673
+ "justifyContent": { "$ref": "#/definitions/SprinkleProp_justifyContent" },
3674
+ "justifyItems": { "$ref": "#/definitions/SprinkleProp_justifyItems" },
3675
+ "m": { "$ref": "#/definitions/SprinkleProp_m" },
3676
+ "maxH": { "$ref": "#/definitions/SprinkleProp_maxH" },
3677
+ "maxW": { "$ref": "#/definitions/SprinkleProp_maxW" },
3678
+ "mb": { "$ref": "#/definitions/SprinkleProp_mb" },
3679
+ "ml": { "$ref": "#/definitions/SprinkleProp_ml" },
3680
+ "mr": { "$ref": "#/definitions/SprinkleProp_mr" },
3681
+ "mt": { "$ref": "#/definitions/SprinkleProp_mt" },
3682
+ "mx": { "$ref": "#/definitions/SprinkleProp_mx" },
3683
+ "my": { "$ref": "#/definitions/SprinkleProp_my" },
3684
+ "objectFit": { "$ref": "#/definitions/SprinkleProp_objectFit" },
3685
+ "overflow": { "$ref": "#/definitions/SprinkleProp_overflow" },
3686
+ "overflowX": { "$ref": "#/definitions/SprinkleProp_overflowX" },
3687
+ "overflowY": { "$ref": "#/definitions/SprinkleProp_overflowY" },
3688
+ "p": { "$ref": "#/definitions/SprinkleProp_p" },
3689
+ "pb": { "$ref": "#/definitions/SprinkleProp_pb" },
3690
+ "pl": { "$ref": "#/definitions/SprinkleProp_pl" },
3691
+ "placeItems": { "$ref": "#/definitions/SprinkleProp_placeItems" },
3692
+ "pointerEvents": { "$ref": "#/definitions/SprinkleProp_pointerEvents" },
3693
+ "pr": { "$ref": "#/definitions/SprinkleProp_pr" },
3694
+ "pt": { "$ref": "#/definitions/SprinkleProp_pt" },
3695
+ "px": { "$ref": "#/definitions/SprinkleProp_px" },
3696
+ "py": { "$ref": "#/definitions/SprinkleProp_py" },
3697
+ "rounded": { "$ref": "#/definitions/SprinkleProp_rounded" },
3698
+ "shadow": { "$ref": "#/definitions/SprinkleProp_shadow" },
3699
+ "size": { "$ref": "#/definitions/SprinkleProp_size" },
3700
+ "textAlign": { "$ref": "#/definitions/SprinkleProp_textAlign" },
3701
+ "textTransform": { "$ref": "#/definitions/SprinkleProp_textTransform" },
3702
+ "transition": { "$ref": "#/definitions/SprinkleProp_transition" },
3703
+ "w": { "$ref": "#/definitions/SprinkleProp_w" },
3704
+ "whiteSpace": { "$ref": "#/definitions/SprinkleProp_whiteSpace" },
3705
+ "z": { "$ref": "#/definitions/SprinkleProp_z" }
3706
+ },
3707
+ "required": ["$type"],
3708
+ "type": "object"
3709
+ },
3636
3710
  "ProteusPillMenu": {
3637
3711
  "examples": [{
3638
3712
  "$type": "PillMenu",
package/dist/index.d.ts CHANGED
@@ -153,9 +153,11 @@ declare namespace ProteusFileUpload {
153
153
  //#region src/proteus-image-carousel/ProteusImageCarousel.d.ts
154
154
  type ProteusImageCarouselProps = {
155
155
  /**
156
- * Array of image data to display in the carousel.
156
+ * Array of image data to display in the carousel. The host is responsible for
157
+ * supplying the preview metadata on each item.
157
158
  */
158
- images: Array<{
159
+ images: Array<ProteusPreviewFile & {
160
+ [key: string]: unknown;
159
161
  /**
160
162
  * Alternative text for the image.
161
163
  */
@@ -184,7 +186,9 @@ declare namespace ProteusImageCarousel {
184
186
  //#endregion
185
187
  //#region src/proteus-image/ProteusImage.d.ts
186
188
  type ProteusImageProps = BoxProps<"img">;
187
- declare function ProteusImage(props: ProteusImageProps): import("react/jsx-runtime").JSX.Element;
189
+ declare function ProteusImage({
190
+ ...props
191
+ }: ProteusImageProps): import("react/jsx-runtime").JSX.Element;
188
192
  declare namespace ProteusImage {
189
193
  var displayName: string;
190
194
  }
@@ -237,6 +241,27 @@ declare namespace ProteusMap {
237
241
  var displayName: string;
238
242
  }
239
243
  //#endregion
244
+ //#region src/proteus-markdown/ProteusMarkdown.d.ts
245
+ type ProteusMarkdownProps = BoxProps<"div", {
246
+ /**
247
+ * The markdown source to render. A single string (resolved upstream from a
248
+ * literal or a `Value`/`Concat` expression).
249
+ */
250
+ children?: string;
251
+ }>;
252
+ /**
253
+ * Renders markdown content (headings, paragraphs, lists, links, emphasis, code)
254
+ * as Axiom components so generated documents inherit the design system.
255
+ */
256
+ declare function ProteusMarkdown({
257
+ children,
258
+ className,
259
+ ...props
260
+ }: ProteusMarkdownProps): import("react/jsx-runtime").JSX.Element;
261
+ declare namespace ProteusMarkdown {
262
+ var displayName: string;
263
+ }
264
+ //#endregion
240
265
  //#region src/proteus-pill-menu/ProteusPillMenu.d.ts
241
266
  type ProteusPillMenuProps = {
242
267
  /**
@@ -436,7 +461,7 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
436
461
  * Callback when user triggers a preview action.
437
462
  * Receives the file object to preview.
438
463
  */
439
- onPreview?: (file: unknown) => Promise<void> | void;
464
+ onPreview?: (file: ProteusPreviewFile) => Promise<void> | void;
440
465
  /**
441
466
  * Callback when an analytics event is fired
442
467
  */
@@ -507,7 +532,7 @@ type ProteusEventHandler = {
507
532
  }) | string;
508
533
  } | {
509
534
  action: "preview";
510
- file: unknown;
535
+ file: ProteusPreviewFile;
511
536
  } | {
512
537
  action: "pushValue";
513
538
  path: string;
@@ -521,6 +546,13 @@ type ProteusEventHandler = {
521
546
  } | {
522
547
  message: string | StructuredMessage;
523
548
  };
549
+ type ProteusPreviewFile = {
550
+ extension: string;
551
+ file_link: string;
552
+ full_name: string;
553
+ mime_type: string;
554
+ name: string;
555
+ };
524
556
  type StructuredMessage<F extends FileUploadMetadata = FileUploadMetadata> = {
525
557
  files?: F[];
526
558
  parts: Array<{
@@ -621,4 +653,4 @@ declare namespace ProteusTextarea {
621
653
  //#region src/use-proteus-value/useProteusValue.d.ts
622
654
  declare function useProteusValue(element: ProteusValueProps): any;
623
655
  //#endregion
624
- export { type FileUploadMetadata, ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDateInput, ProteusDocumentRenderer, ProteusDocumentRendererProps, ProteusDocumentShell, ProteusDocumentShellProps, ProteusFederated, ProteusFileUpload, ProteusFileUploadProps, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusLength, ProteusMap, ProteusMapIndex, ProteusPillMenu, ProteusPillMenuProps, ProteusRichTextEditor, ProteusSelect, ProteusShow, ProteusTextarea, type StructuredMessage, type UploadFile, safeParseDocument, useProteusValue };
656
+ export { type FileUploadMetadata, ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDateInput, ProteusDocumentRenderer, ProteusDocumentRendererProps, ProteusDocumentShell, ProteusDocumentShellProps, ProteusFederated, ProteusFileUpload, ProteusFileUploadProps, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusLength, ProteusMap, ProteusMapIndex, ProteusMarkdown, ProteusPillMenu, ProteusPillMenuProps, type ProteusPreviewFile, ProteusRichTextEditor, ProteusSelect, ProteusShow, ProteusTextarea, type StructuredMessage, type UploadFile, safeParseDocument, useProteusValue };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/optimizely-axiom/optiaxiom.git"
8
8
  },
9
9
  "type": "module",
10
- "version": "1.1.5",
10
+ "version": "1.1.7",
11
11
  "files": [
12
12
  "dist/**",
13
13
  "LICENSE"
@@ -38,9 +38,11 @@
38
38
  "@tanstack/react-table": "^8.21.3",
39
39
  "embla-carousel-react": "^8.6.0",
40
40
  "jsonpointer": "^5.0.1",
41
+ "react-markdown": "^10.1.0",
41
42
  "recharts": "^3.8.1",
43
+ "remark-gfm": "^4.0.1",
42
44
  "@optiaxiom/icons": "^1.1.3",
43
- "@optiaxiom/react": "^1.9.40"
45
+ "@optiaxiom/react": "^1.9.41"
44
46
  },
45
47
  "devDependencies": {
46
48
  "@emotion/hash": "^0.9.2",