@optiaxiom/proteus 0.1.23 → 0.1.24
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/assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-DxHEfy0L.css +17 -0
- package/dist/esm/proteus-document/ProteusDocumentShell-css.js +7 -0
- package/dist/esm/proteus-document/ProteusDocumentShell.js +33 -1
- package/dist/esm/schema/public-schema.json.js +4 -0
- package/dist/esm/schema/runtime-schema.json.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/spec.d.ts +302 -296
- package/package.json +3 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@layer optiaxiom.tmkl1w;
|
|
2
|
+
@layer optiaxiom.tmkl1w {
|
|
3
|
+
.ProteusDocumentShell__vpuvfj1 {
|
|
4
|
+
margin: -4px;
|
|
5
|
+
}
|
|
6
|
+
.ProteusDocumentShell__vpuvfj2 {
|
|
7
|
+
align-self: center;
|
|
8
|
+
bottom: 8px;
|
|
9
|
+
margin-top: -56px;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
position: sticky;
|
|
12
|
+
z-index: 10;
|
|
13
|
+
}
|
|
14
|
+
.ProteusDocumentShell__vpuvfj0[data-can-scroll] .ProteusDocumentShell__vpuvfj2 {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-DxHEfy0L.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
|
+
|
|
7
|
+
export { body, scrollIndicator };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { IconSouth } from '@optiaxiom/icons';
|
|
3
4
|
import { Disclosure, DisclosureTrigger, Box, Group, Text, DisclosureContent, Heading, Tooltip } from '@optiaxiom/react';
|
|
4
5
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
5
6
|
import { set } from 'jsonpointer';
|
|
@@ -7,6 +8,7 @@ import { useState, useRef, useEffect } from 'react';
|
|
|
7
8
|
import { useEffectEvent } from '../hooks/useEffectEvent.js';
|
|
8
9
|
import { downloadFile } from '../proteus-image/downloadFile.js';
|
|
9
10
|
import { ProteusDocumentProvider } from './ProteusDocumentContext.js';
|
|
11
|
+
import { scrollIndicator, body } from './ProteusDocumentShell-css.js';
|
|
10
12
|
|
|
11
13
|
function ProteusDocumentShell({
|
|
12
14
|
collapsible: collapsibleProp,
|
|
@@ -34,6 +36,26 @@ function ProteusDocumentShell({
|
|
|
34
36
|
onChange: onOpenChange,
|
|
35
37
|
prop: openProp
|
|
36
38
|
});
|
|
39
|
+
const bodyRef = useRef(null);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const node = bodyRef.current;
|
|
42
|
+
if (!node)
|
|
43
|
+
return;
|
|
44
|
+
const update = () => {
|
|
45
|
+
if (node.scrollHeight - node.scrollTop - node.clientHeight > 1) {
|
|
46
|
+
node.dataset.canScroll = "";
|
|
47
|
+
} else {
|
|
48
|
+
delete node.dataset.canScroll;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const observer = new ResizeObserver(update);
|
|
52
|
+
observer.observe(node);
|
|
53
|
+
node.addEventListener("scroll", update, { passive: true });
|
|
54
|
+
return () => {
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
node.removeEventListener("scroll", update);
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
37
59
|
const collapsible = collapsibleProp && element.appName;
|
|
38
60
|
const Trigger = collapsible ? DisclosureTrigger : Box;
|
|
39
61
|
return /* @__PURE__ */ jsx(
|
|
@@ -151,7 +173,17 @@ function ProteusDocumentShell({
|
|
|
151
173
|
},
|
|
152
174
|
ref: formRef,
|
|
153
175
|
children: [
|
|
154
|
-
|
|
176
|
+
/* @__PURE__ */ jsxs(
|
|
177
|
+
Group,
|
|
178
|
+
{
|
|
179
|
+
ref: element.compact ? bodyRef : void 0,
|
|
180
|
+
...body({ truncate: element.compact }),
|
|
181
|
+
children: [
|
|
182
|
+
element.body,
|
|
183
|
+
element.compact && /* @__PURE__ */ jsx(Box, { ...scrollIndicator(), children: /* @__PURE__ */ jsx(IconSouth, {}) })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
),
|
|
155
187
|
element.actions && !readOnly && /* @__PURE__ */ jsx(Group, { gap: "16", justifyContent: "end", w: "full", children: element.actions })
|
|
156
188
|
]
|
|
157
189
|
}
|
|
@@ -2673,6 +2673,10 @@ var definitions = {
|
|
|
2673
2673
|
$ref: "#/definitions/ProteusNode",
|
|
2674
2674
|
description: "The main content of the document."
|
|
2675
2675
|
},
|
|
2676
|
+
compact: {
|
|
2677
|
+
description: "If true, constrains the body to a max height and makes it scrollable when content overflows.",
|
|
2678
|
+
type: "boolean"
|
|
2679
|
+
},
|
|
2676
2680
|
subtitle: {
|
|
2677
2681
|
$ref: "#/definitions/ProteusNode",
|
|
2678
2682
|
description: "A brief description or tagline that provides additional context about the Proteus document's purpose."
|
|
@@ -2661,6 +2661,10 @@ var definitions = {
|
|
|
2661
2661
|
$ref: "#/definitions/ProteusNode",
|
|
2662
2662
|
description: "The main content of the document."
|
|
2663
2663
|
},
|
|
2664
|
+
compact: {
|
|
2665
|
+
description: "If true, constrains the body to a max height and makes it scrollable when content overflows.",
|
|
2666
|
+
type: "boolean"
|
|
2667
|
+
},
|
|
2664
2668
|
subtitle: {
|
|
2665
2669
|
$ref: "#/definitions/ProteusNode",
|
|
2666
2670
|
description: "A brief description or tagline that provides additional context about the Proteus document's purpose."
|
package/dist/index.d.ts
CHANGED
|
@@ -240,6 +240,7 @@ type ProteusDocument$2 = {
|
|
|
240
240
|
appName?: string;
|
|
241
241
|
blocking?: boolean;
|
|
242
242
|
body: ReactNode;
|
|
243
|
+
compact?: boolean;
|
|
243
244
|
subtitle?: ReactNode;
|
|
244
245
|
title?: ReactNode;
|
|
245
246
|
titleIcon?: string;
|
|
@@ -299,6 +300,7 @@ type ProteusDocument = {
|
|
|
299
300
|
appName?: string;
|
|
300
301
|
blocking?: boolean;
|
|
301
302
|
body: unknown;
|
|
303
|
+
compact?: boolean;
|
|
302
304
|
subtitle?: unknown;
|
|
303
305
|
title?: unknown;
|
|
304
306
|
titleIcon?: string;
|