@optiaxiom/proteus 0.2.14 → 0.2.15

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.
@@ -9,6 +9,7 @@ import { useEffectEvent } from '../hooks/useEffectEvent.js';
9
9
  import { downloadFile } from '../proteus-image/downloadFile.js';
10
10
  import { ProteusDocumentProvider } from './ProteusDocumentContext.js';
11
11
  import { scrollIndicator, body } from './ProteusDocumentShell-css.js';
12
+ import { resolveProteusValue } from './resolveProteusValue.js';
12
13
 
13
14
  function ProteusDocumentShell({
14
15
  collapsible: collapsibleProp,
@@ -62,7 +63,8 @@ function ProteusDocumentShell({
62
63
  }, []);
63
64
  const collapsible = collapsibleProp && element.appName;
64
65
  const Trigger = collapsible ? DisclosureTrigger : Box;
65
- const inline = !element.title && !element.appName && !element.blocking;
66
+ const appearance = resolveProteusValue(element.appearance, data, "", []);
67
+ const inline = appearance === "inline";
66
68
  return /* @__PURE__ */ jsx(
67
69
  ProteusDocumentProvider,
68
70
  {
@@ -8,13 +8,14 @@ const mimeIconMap = [
8
8
  [/^video\//, IconFileVideo],
9
9
  [/^audio\//, IconMusic],
10
10
  [/presentation|powerpoint|keynote|slides/, IconPresentationScreen],
11
- [/spreadsheet|excel|csv|tsv|parquet/, IconTableLayout],
11
+ [/spreadsheet|excel|csv|tab-separated-values|tsv|parquet/, IconTableLayout],
12
12
  [/zip|tar|compress|archive|x-7z|x-rar/, IconFileZipper],
13
- [/pdf|word|wordprocessing|opendocument\.text|^text\//, IconFileLines],
13
+ [/pdf|wordprocessing|opendocument\.text/, IconFileLines],
14
14
  [
15
15
  /json|xml|yaml|javascript|typescript|html|css|x-sh|x-python|code|script/,
16
16
  IconCode
17
- ]
17
+ ],
18
+ [/^text\/|word|rtf/, IconFileLines]
18
19
  ];
19
20
  function ProteusFileIcon({ mimeType, ...props }) {
20
21
  const Icon = getIconForMimeType(mimeType);
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { IconPlus } from '@optiaxiom/icons';
4
- import { Flex } from '@optiaxiom/react';
4
+ import { toaster, Flex } from '@optiaxiom/react';
5
5
  import { FileUpload, VisuallyHidden, FileUploadTrigger, FileUploadList, FileUploadDropzone } from '@optiaxiom/react/unstable';
6
6
  import { useRef, useState, useCallback } from 'react';
7
7
  import { useObserveValue } from '../hooks/useObserveValue.js';
@@ -40,10 +40,22 @@ function ProteusFileUpload({
40
40
  }, [forceValueChange, name, onDataChange, parentPath]);
41
41
  const handleFilesDrop = useCallback(
42
42
  async (incoming) => {
43
- if (multiple) {
44
- incoming = maxFiles !== void 0 ? incoming.slice(0, Math.max(0, maxFiles - itemsRef.current.length)) : incoming;
45
- } else {
46
- incoming = incoming.slice(0, 1);
43
+ let skipped = 0;
44
+ if (maxFiles !== void 0) {
45
+ const existing = multiple ? itemsRef.current.length : 0;
46
+ const remaining = Math.max(0, maxFiles - existing);
47
+ if (incoming.length > remaining) {
48
+ skipped = incoming.length - remaining;
49
+ incoming = incoming.slice(0, remaining);
50
+ }
51
+ }
52
+ if (skipped > 0) {
53
+ const accepted = incoming.length;
54
+ const skippedWord = skipped === 1 ? "was" : "were";
55
+ toaster.create(
56
+ accepted > 0 ? `Added ${accepted} file${accepted === 1 ? "" : "s"}. ${skipped} ${skippedWord} skipped because the limit is ${maxFiles}.` : `${skipped} file${skipped === 1 ? "" : "s"} ${skippedWord} skipped because the limit is ${maxFiles}.`,
57
+ { type: "warning" }
58
+ );
47
59
  }
48
60
  if (!onUpload || readOnly || incoming.length === 0) {
49
61
  return;
@@ -2657,6 +2657,20 @@ var definitions = {
2657
2657
  $ref: "#/definitions/ProteusNode",
2658
2658
  description: "Actions available for this document"
2659
2659
  },
2660
+ appearance: {
2661
+ anyOf: [
2662
+ {
2663
+ "const": "default"
2664
+ },
2665
+ {
2666
+ "const": "inline"
2667
+ },
2668
+ {
2669
+ $ref: "#/definitions/ProteusExpression"
2670
+ }
2671
+ ],
2672
+ description: "Visual treatment of the document shell. 'default' renders the document as a card with background, border, and padding. 'inline' strips the surrounding chrome so the document blends into its host container."
2673
+ },
2660
2674
  appIcon: {
2661
2675
  description: "URL or data URI for the application icon (e.g., 'https://example.com/icon.png' or 'data:image/svg+xml,...'). Rendered as an <img> element.",
2662
2676
  type: "string"
@@ -2645,6 +2645,20 @@ var definitions = {
2645
2645
  $ref: "#/definitions/ProteusNode",
2646
2646
  description: "Actions available for this document"
2647
2647
  },
2648
+ appearance: {
2649
+ anyOf: [
2650
+ {
2651
+ "const": "default"
2652
+ },
2653
+ {
2654
+ "const": "inline"
2655
+ },
2656
+ {
2657
+ $ref: "#/definitions/ProteusExpression"
2658
+ }
2659
+ ],
2660
+ description: "Visual treatment of the document shell. 'default' renders the document as a card with background, border, and padding. 'inline' strips the surrounding chrome so the document blends into its host container."
2661
+ },
2648
2662
  appIcon: {
2649
2663
  description: "URL or data URI for the application icon (e.g., 'https://example.com/icon.png' or 'data:image/svg+xml,...'). Rendered as an <img> element.",
2650
2664
  type: "string"
package/dist/index.d.ts CHANGED
@@ -340,6 +340,7 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
340
340
  };
341
341
  type ProteusDocument$2 = {
342
342
  actions?: ReactNode;
343
+ appearance?: "default" | "inline" | Record<string, unknown>;
343
344
  appIcon?: string;
344
345
  appName?: string;
345
346
  blocking?: boolean;
@@ -416,6 +417,7 @@ type ProteusDocumentRendererProps = Omit<ComponentPropsWithoutRef<typeof Proteus
416
417
  type ProteusDocument = {
417
418
  $type: "Document";
418
419
  actions?: unknown;
420
+ appearance?: "default" | "inline" | Record<string, unknown>;
419
421
  appIcon?: string;
420
422
  appName?: string;
421
423
  blocking?: boolean;