@optiaxiom/proteus 0.1.22 → 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.
@@ -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
+ }
package/dist/esm/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export { ProteusAction } from './proteus-action/ProteusAction.js';
2
- export { ProteusCancelAction } from './proteus-action/ProteusCancelAction.js';
3
2
  export { ProteusChart } from './proteus-chart/ProteusChart.js';
4
3
  export { ProteusDataTable } from './proteus-data-table/ProteusDataTable.js';
5
4
  export { ProteusDocumentRenderer } from './proteus-document/ProteusDocumentRenderer.js';
@@ -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
- element.body,
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
  }
@@ -5,7 +5,6 @@ import { Time, Range } from '@optiaxiom/react/unstable';
5
5
  import { lazy, Suspense } from 'react';
6
6
  import { IconCalendar } from '../icons/IconCalendar.js';
7
7
  import { ProteusAction } from '../proteus-action/ProteusAction.js';
8
- import { ProteusCancelAction } from '../proteus-action/ProteusCancelAction.js';
9
8
  import { ProteusDataTable } from '../proteus-data-table/ProteusDataTable.js';
10
9
  import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentContext.js';
11
10
  import { useProteusDocumentPathContext } from '../proteus-document/ProteusDocumentPathContext.js';
@@ -66,8 +65,8 @@ const ProteusElement = ({
66
65
  return /* @__PURE__ */ jsx(Avatar, { ...resolve(element) });
67
66
  case "Badge":
68
67
  return /* @__PURE__ */ jsx(Badge, { ...resolve(element) });
69
- case "CancelAction":
70
- return /* @__PURE__ */ jsx(ProteusCancelAction, { ...resolve(element) });
68
+ case "Button":
69
+ return /* @__PURE__ */ jsx(ProteusAction, { ...resolve(element) });
71
70
  case "Card":
72
71
  return /* @__PURE__ */ jsx(Card, { ...resolve(element) });
73
72
  case "CardHeader":
@@ -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."
@@ -2704,7 +2708,7 @@ var definitions = {
2704
2708
  $ref: "#/definitions/ProteusBadge"
2705
2709
  },
2706
2710
  {
2707
- $ref: "#/definitions/ProteusCancelAction"
2711
+ $ref: "#/definitions/ProteusButton"
2708
2712
  },
2709
2713
  {
2710
2714
  $ref: "#/definitions/ProteusCard"
@@ -3703,17 +3707,18 @@ var definitions = {
3703
3707
  ],
3704
3708
  type: "object"
3705
3709
  },
3706
- ProteusCancelAction: {
3710
+ ProteusButton: {
3707
3711
  additionalProperties: false,
3708
3712
  examples: [
3709
3713
  {
3710
- $type: "CancelAction",
3711
- children: "Cancel"
3714
+ $type: "Button",
3715
+ appearance: "primary",
3716
+ children: "Action"
3712
3717
  }
3713
3718
  ],
3714
3719
  properties: {
3715
3720
  $type: {
3716
- "const": "CancelAction"
3721
+ "const": "Button"
3717
3722
  },
3718
3723
  alignItems: {
3719
3724
  $ref: "#/definitions/SprinkleProp_alignItems"
@@ -3724,6 +3729,38 @@ var definitions = {
3724
3729
  animation: {
3725
3730
  $ref: "#/definitions/SprinkleProp_animation"
3726
3731
  },
3732
+ appearance: {
3733
+ anyOf: [
3734
+ {
3735
+ "const": "default"
3736
+ },
3737
+ {
3738
+ "const": "danger"
3739
+ },
3740
+ {
3741
+ "const": "primary"
3742
+ },
3743
+ {
3744
+ "const": "subtle"
3745
+ },
3746
+ {
3747
+ "const": "danger-outline"
3748
+ },
3749
+ {
3750
+ "const": "default-opal"
3751
+ },
3752
+ {
3753
+ "const": "inverse"
3754
+ },
3755
+ {
3756
+ "const": "primary-opal"
3757
+ },
3758
+ {
3759
+ $ref: "#/definitions/ProteusExpression"
3760
+ }
3761
+ ],
3762
+ description: "Control the appearance by selecting between the different button types."
3763
+ },
3727
3764
  backgroundImage: {
3728
3765
  $ref: "#/definitions/SprinkleProp_backgroundImage"
3729
3766
  },
@@ -3880,6 +3917,23 @@ var definitions = {
3880
3917
  transition: {
3881
3918
  $ref: "#/definitions/SprinkleProp_transition"
3882
3919
  },
3920
+ type: {
3921
+ anyOf: [
3922
+ {
3923
+ "const": "button"
3924
+ },
3925
+ {
3926
+ "const": "reset"
3927
+ },
3928
+ {
3929
+ "const": "submit"
3930
+ },
3931
+ {
3932
+ $ref: "#/definitions/ProteusExpression"
3933
+ }
3934
+ ],
3935
+ description: "The default behavior of the button."
3936
+ },
3883
3937
  w: {
3884
3938
  $ref: "#/definitions/SprinkleProp_w"
3885
3939
  },
@@ -3889,9 +3943,9 @@ var definitions = {
3889
3943
  z: {
3890
3944
  $ref: "#/definitions/SprinkleProp_z"
3891
3945
  },
3892
- placeholder: {
3893
- description: "Placeholder text for the text input field",
3894
- type: "string"
3946
+ onClick: {
3947
+ $ref: "#/definitions/ProteusEventHandler",
3948
+ description: "Action triggered when button is clicked"
3895
3949
  }
3896
3950
  },
3897
3951
  required: [
@@ -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."
@@ -2692,7 +2696,7 @@ var definitions = {
2692
2696
  $ref: "#/definitions/ProteusBadge"
2693
2697
  },
2694
2698
  {
2695
- $ref: "#/definitions/ProteusCancelAction"
2699
+ $ref: "#/definitions/ProteusButton"
2696
2700
  },
2697
2701
  {
2698
2702
  $ref: "#/definitions/ProteusCard"
@@ -3683,16 +3687,17 @@ var definitions = {
3683
3687
  ],
3684
3688
  type: "object"
3685
3689
  },
3686
- ProteusCancelAction: {
3690
+ ProteusButton: {
3687
3691
  examples: [
3688
3692
  {
3689
- $type: "CancelAction",
3690
- children: "Cancel"
3693
+ $type: "Button",
3694
+ appearance: "primary",
3695
+ children: "Action"
3691
3696
  }
3692
3697
  ],
3693
3698
  properties: {
3694
3699
  $type: {
3695
- "const": "CancelAction"
3700
+ "const": "Button"
3696
3701
  },
3697
3702
  alignItems: {
3698
3703
  $ref: "#/definitions/SprinkleProp_alignItems"
@@ -3703,6 +3708,38 @@ var definitions = {
3703
3708
  animation: {
3704
3709
  $ref: "#/definitions/SprinkleProp_animation"
3705
3710
  },
3711
+ appearance: {
3712
+ anyOf: [
3713
+ {
3714
+ "const": "default"
3715
+ },
3716
+ {
3717
+ "const": "danger"
3718
+ },
3719
+ {
3720
+ "const": "primary"
3721
+ },
3722
+ {
3723
+ "const": "subtle"
3724
+ },
3725
+ {
3726
+ "const": "danger-outline"
3727
+ },
3728
+ {
3729
+ "const": "default-opal"
3730
+ },
3731
+ {
3732
+ "const": "inverse"
3733
+ },
3734
+ {
3735
+ "const": "primary-opal"
3736
+ },
3737
+ {
3738
+ $ref: "#/definitions/ProteusExpression"
3739
+ }
3740
+ ],
3741
+ description: "Control the appearance by selecting between the different button types."
3742
+ },
3706
3743
  backgroundImage: {
3707
3744
  $ref: "#/definitions/SprinkleProp_backgroundImage"
3708
3745
  },
@@ -3859,6 +3896,23 @@ var definitions = {
3859
3896
  transition: {
3860
3897
  $ref: "#/definitions/SprinkleProp_transition"
3861
3898
  },
3899
+ type: {
3900
+ anyOf: [
3901
+ {
3902
+ "const": "button"
3903
+ },
3904
+ {
3905
+ "const": "reset"
3906
+ },
3907
+ {
3908
+ "const": "submit"
3909
+ },
3910
+ {
3911
+ $ref: "#/definitions/ProteusExpression"
3912
+ }
3913
+ ],
3914
+ description: "The default behavior of the button."
3915
+ },
3862
3916
  w: {
3863
3917
  $ref: "#/definitions/SprinkleProp_w"
3864
3918
  },
@@ -3868,9 +3922,9 @@ var definitions = {
3868
3922
  z: {
3869
3923
  $ref: "#/definitions/SprinkleProp_z"
3870
3924
  },
3871
- placeholder: {
3872
- description: "Placeholder text for the text input field",
3873
- type: "string"
3925
+ onClick: {
3926
+ $ref: "#/definitions/ProteusEventHandler",
3927
+ description: "Action triggered when button is clicked"
3874
3928
  }
3875
3929
  },
3876
3930
  required: [
package/dist/index.d.ts CHANGED
@@ -2,18 +2,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { BoxProps, SelectProps, Disclosure, ButtonProps, InputProps, TextareaProps } from '@optiaxiom/react';
3
3
  import { ReactNode, ComponentPropsWithoutRef } from 'react';
4
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
5
  type Series = {
18
6
  dataKey: string;
19
7
  name?: string;
@@ -252,6 +240,7 @@ type ProteusDocument$2 = {
252
240
  appName?: string;
253
241
  blocking?: boolean;
254
242
  body: ReactNode;
243
+ compact?: boolean;
255
244
  subtitle?: ReactNode;
256
245
  title?: ReactNode;
257
246
  titleIcon?: string;
@@ -311,6 +300,7 @@ type ProteusDocument = {
311
300
  appName?: string;
312
301
  blocking?: boolean;
313
302
  body: unknown;
303
+ compact?: boolean;
314
304
  subtitle?: unknown;
315
305
  title?: unknown;
316
306
  titleIcon?: string;
@@ -332,5 +322,5 @@ declare namespace ProteusTextarea {
332
322
 
333
323
  declare function useProteusValue(element: ProteusValueProps): any;
334
324
 
335
- export { ProteusAction, ProteusCancelAction, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
325
+ export { ProteusAction, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
336
326
  export type { ProteusDocumentRendererProps, ProteusDocumentShellProps };