@rise-x/apps-sdk 0.16.4 → 0.19.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 (37) hide show
  1. package/README.md +123 -1
  2. package/build/breadcrumb.d.ts +49 -0
  3. package/build/breadcrumb.js +58 -0
  4. package/build/index.d.ts +1 -0
  5. package/build/index.js +4 -1
  6. package/build/ui/classes.json +42 -42
  7. package/build/ui/components/ai.d.ts +68 -4
  8. package/build/ui/components/alert-dialog.d.ts +4 -4
  9. package/build/ui/components/app-frame.d.ts +47 -7
  10. package/build/ui/components/asset-pill.d.ts +8 -0
  11. package/build/ui/components/badge.d.ts +35 -2
  12. package/build/ui/components/button.d.ts +4 -4
  13. package/build/ui/components/calendar.d.ts +2 -2
  14. package/build/ui/components/chat-input.d.ts +4 -4
  15. package/build/ui/components/data-table.d.ts +128 -13
  16. package/build/ui/components/data-view.d.ts +94 -0
  17. package/build/ui/components/date-picker.d.ts +23 -1
  18. package/build/ui/components/file-upload.d.ts +9 -1
  19. package/build/ui/components/filter-bar.d.ts +89 -0
  20. package/build/ui/components/floating-panel.d.ts +53 -0
  21. package/build/ui/components/item.d.ts +1 -1
  22. package/build/ui/components/journey.d.ts +165 -0
  23. package/build/ui/components/nav.d.ts +52 -2
  24. package/build/ui/components/page-header.d.ts +8 -8
  25. package/build/ui/components/person.d.ts +14 -0
  26. package/build/ui/components/record-summary.d.ts +17 -0
  27. package/build/ui/components/search-dialog.d.ts +56 -0
  28. package/build/ui/components/statistic.d.ts +2 -1
  29. package/build/ui/components/table.d.ts +10 -3
  30. package/build/ui/components/toggle.d.ts +1 -1
  31. package/build/ui/demo.html +45921 -25459
  32. package/build/ui/index.d.ts +8 -0
  33. package/build/ui/standalone.js +984 -69
  34. package/build/ui/styles.css +1 -1
  35. package/build/ui/theme.css +2 -1
  36. package/package.json +4 -2
  37. package/template/src/App.tsx +4 -1
package/README.md CHANGED
@@ -600,7 +600,7 @@ design mocks** without repo access:
600
600
  The file is pretty-printed and starts with a navigation guide plus a JSON
601
601
  table of contents (`<script type="application/json" id="demo-toc">`) listing
602
602
  every section, screen, and the `data-slot` components each section
603
- demonstrates. Read the first ~80 lines for the TOC, then grep:
603
+ demonstrates. The guide names the line the TOC ends on — read that far, then grep:
604
604
 
605
605
  | To find | Grep for |
606
606
  | --- | --- |
@@ -740,6 +740,34 @@ everything. Pass `moreLabel` on `AppRail` to localise the label. Don't hand-roll
740
740
  a tab bar, and don't write your own breakpoints around the frame; compose inside
741
741
  it.
742
742
 
743
+ From the `2xl` width up the rail is **the user's to size**: 248px by default,
744
+ dragged anywhere from 200 to 420 by its right edge, or collapsed to 52px of
745
+ icons (click the edge, release a drag under 150px, or press ⌘. / Ctrl+.). The
746
+ size is remembered per `storageKey` (pass your app's id) and nothing else ever
747
+ changes it — not navigation, not opening a panel. Collapsed, a `NavItem` shows
748
+ its icon with the label as a tooltip, a `NavSection` becomes a hairline, and a
749
+ `NavGroup` with an `icon` becomes one button that opens its items as a list
750
+ beside the rail:
751
+
752
+ ```tsx
753
+ <AppRail storageKey="order-book">
754
+ <Nav>
755
+ <NavItem current><LineChart />Market</NavItem>
756
+ <NavGroup title="Offers" icon={<Tag />} more={<NavItem><Tag />All offers</NavItem>}>
757
+ <NavItem dot="needs">Spodumene SC6.0</NavItem>
758
+ </NavGroup>
759
+ </Nav>
760
+ </AppRail>
761
+ ```
762
+
763
+ The rail is the app's **menu of pages** — Overview, Records, People,
764
+ Settings — never a list of records or a to-do list. What waits on the user
765
+ belongs on a page (an Overview's "Waiting on you"), with at most a count
766
+ `Badge` on that page's item. Give every top-level item an icon; collapsed, the
767
+ icon is all there is. `dot` is for "needs you" (`needs`) or "running"
768
+ (`working`) only. Below `2xl` the
769
+ rail is the strip or the tab bar and neither collapses nor resizes.
770
+
743
771
  Rendering an `AppFrame` anywhere in the app is the signal that the app owns
744
772
  its layout: the next-gen shell detects it and hands over the full-bleed
745
773
  region. Apps without one are compensated — the host pads and scrolls the
@@ -769,6 +797,100 @@ Requirements in the app:
769
797
  It's a snapshot, not the source of truth: verify in a host (or deployed)
770
798
  before release.
771
799
 
800
+ #### Lists (`DataTable` / `DataView`)
801
+
802
+ Every list of records is a `DataTable`, and every table ships the same
803
+ toolbar — nothing to opt into:
804
+
805
+ - **Filters**, inferred from the columns (numbers, dates — `Date` values or
806
+ ISO strings — up to 12 names or
807
+ other words as a pick list — even when each appears once — and references
808
+ such as `REC-0412` or longer lists as text). Pass `filters` to
809
+ choose them; `meta: { filter: false }` leaves a column out.
810
+ - **A menu on every column header**: sort ascending or descending, filter by
811
+ this column, hide it. Plain-text headers get it automatically; a custom
812
+ header keeps it by rendering `DataTableColumnHeader`.
813
+ - **View**: the columns shown, and **Reset view** (columns and sort back to
814
+ default). Hiding every column shows an empty state with *Show all columns*.
815
+
816
+ Search stays opt-in (`searchable`): it only covers the rows already loaded.
817
+
818
+ Bulk actions: `enableRowSelection` (or `(row) => boolean`, so only rows the
819
+ action applies to can be ticked) plus `bulkActions={(rows, clear) => …}` —
820
+ the action shows in a bar that rises below the list, with the count and
821
+ clear, while anything is ticked. Ticks stay on their record across a refresh:
822
+ rows are named by their `id` field, or pass `getRowId`. A table inside a `FloatingPanelSection` sits bare; the section never
823
+ adds a second tile.
824
+
825
+ A list that needs more than one layout is a `DataView` — Table, Board
826
+ (kanban) and Calendar behind the one toolbar, so filters and sort carry
827
+ across layouts. The calendar shows 3 days, a week or a month (its own switch,
828
+ beside Today); 3 days and Week are a time grid placed by `calendar.date` and
829
+ `calendar.end`, and hovering an entry shows all its details. View is per layout — table columns, board card fields,
830
+ calendar entry details and weekends — each with Reset view:
831
+
832
+ ```tsx
833
+ <DataView
834
+ views={['table', 'board']} // only what the list needs
835
+ columns={columns}
836
+ data={orders}
837
+ onRowClick={(o) => openOrder(o.id)}
838
+ board={{ groupBy: 'status', groups: [{ value: 'Open', intent: 'waiting' }, …] }}
839
+ calendar={{ date: 'due', title: 'name' }} // when 'calendar' is in views
840
+ />
841
+ ```
842
+
843
+ **Ask before adding layouts.** Which views a list offers is a product
844
+ decision: ask the app's owner whether it needs Table, Board and/or Calendar.
845
+ A board needs a column that moves through stages; a calendar needs a date
846
+ people plan by. One layout is a plain `DataTable`.
847
+
848
+ #### Breadcrumb (`useShellBreadcrumb`)
849
+
850
+ **Required, on every page.** The shell's breadcrumb is always your app's name,
851
+ then the page, then anything deeper (the Home pill sits before it):
852
+
853
+ | Where | Declare | The strip shows |
854
+ | --- | --- | --- |
855
+ | the default page | `[{ label: 'Overview' }]` | `Invoice Audit / Overview` |
856
+ | any other page | `[{ label: 'Records' }]` | `Invoice Audit / Records` |
857
+ | deeper | `[{ label: 'Records', onClick }, { label: 'REC-0412' }]` | `Invoice Audit / Records / REC-0412` |
858
+
859
+ - The app's name comes from the shell and is **never a link** — it isn't a
860
+ page. There is no "app name alone" state: the default page declares itself
861
+ like any other.
862
+ - The page crumb uses the same words as your rail; the last crumb uses the
863
+ same words as the page title and is never a link. Every page crumb before
864
+ it takes `onClick` and goes back there.
865
+ - Don't name an app page "Home" — the Home pill is Rise-X's. Use "Overview".
866
+ - Never a crumb for a tab, a filter, a search, a dialog, a drawer or a wizard
867
+ step — they change what is shown, not where the user is.
868
+
869
+ Apps route inside themselves, so crumbs take `onClick`:
870
+
871
+ ```tsx
872
+ import { useShellBreadcrumb } from '@rise-x/apps-sdk';
873
+
874
+ const back = useShellBreadcrumb([
875
+ { label: 'My offers', onClick: () => go('offers') },
876
+ { label: offer.title },
877
+ ]);
878
+ // → Order Book / My offers / Spodumene SC6.0 · CIF Qingdao
879
+
880
+ // The page's back link, from the same trail — never written separately:
881
+ {back && <PageHeaderBack onClick={back.onClick}>{back.label}</PageHeaderBack>}
882
+ ```
883
+
884
+ The hook returns the trail's parent crumb (or `null` on a top-level page).
885
+ Drawing the back link from it makes the link and the strip's crumb one step,
886
+ so they can never point to different places. In the shell the link hides on
887
+ wide screens and shows on a phone.
888
+
889
+ Keep labels short: a crumb truncates at 180px (the current one at 300px), and
890
+ a trail past four crumbs shows only the first and the last two. `badge` (a
891
+ string, or `{ label, tone }`) shows on the current crumb, e.g. *Test mode*.
892
+ Outside a shell that supports it, the hook does nothing.
893
+
772
894
  #### `MapView`
773
895
 
774
896
  The one component with a real library behind it. It renders a Leaflet basemap
@@ -0,0 +1,49 @@
1
+ /** Plain data, so it crosses the module-federation boundary; the shell draws
2
+ * every crumb badge the same way. Honoured on the current (last) crumb only. */
3
+ export type ShellBreadcrumbBadge = string | {
4
+ label: string;
5
+ tone?: "neutral" | "success" | "warning" | "error" | "info";
6
+ };
7
+ /**
8
+ * One crumb an app adds after its own name. Apps route inside themselves, so
9
+ * a crumb takes `onClick` rather than a shell path. The last crumb is the
10
+ * current page and is never clickable.
11
+ */
12
+ export interface ShellBreadcrumbItem {
13
+ label: string;
14
+ onClick?: () => void;
15
+ badge?: ShellBreadcrumbBadge;
16
+ }
17
+ /**
18
+ * Set the trail after the app's name in the shell's breadcrumb — always the
19
+ * page, then anything deeper: `Order Book / My offers / Spodumene SC6.0`. The
20
+ * shell provides the app name itself, and it is never a link. Every page sets
21
+ * at least its own crumb, the default page included. Returns a function that
22
+ * clears it.
23
+ *
24
+ * Safe to call unconditionally: outside a shell that supports it (standalone
25
+ * dev, an older host) it no-ops.
26
+ */
27
+ export declare function setShellBreadcrumb(items: ShellBreadcrumbItem[]): () => void;
28
+ /** The page's way back, read from its own trail. */
29
+ export interface ShellBreadcrumbBack {
30
+ label: string;
31
+ onClick: () => void;
32
+ }
33
+ /**
34
+ * React form of `setShellBreadcrumb`: declares the trail for as long as the
35
+ * calling component is mounted. Re-sent only when a label, badge or the
36
+ * presence of a click changes, so it is cheap to call with inline arrays;
37
+ * clicks always reach the latest callbacks.
38
+ *
39
+ * Returns the trail's parent crumb — the one before the current page — or
40
+ * null when there is none. Render the page's back link from it, so the back
41
+ * link and the strip's crumb are the same step by construction:
42
+ *
43
+ * const back = useShellBreadcrumb([{ label: 'Records', onClick: list }, { label: id }]);
44
+ * {back && <PageHeaderBack onClick={back.onClick}>{back.label}</PageHeaderBack>}
45
+ *
46
+ * In the shell the back link then hides on wide screens (the strip is the way
47
+ * back) and shows on a phone; standalone it always shows.
48
+ */
49
+ export declare function useShellBreadcrumb(items: ShellBreadcrumbItem[]): ShellBreadcrumbBack | null;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setShellBreadcrumb = setShellBreadcrumb;
4
+ exports.useShellBreadcrumb = useShellBreadcrumb;
5
+ const react_1 = require("react");
6
+ const accessors_1 = require("./accessors");
7
+ /**
8
+ * Set the trail after the app's name in the shell's breadcrumb — always the
9
+ * page, then anything deeper: `Order Book / My offers / Spodumene SC6.0`. The
10
+ * shell provides the app name itself, and it is never a link. Every page sets
11
+ * at least its own crumb, the default page included. Returns a function that
12
+ * clears it.
13
+ *
14
+ * Safe to call unconditionally: outside a shell that supports it (standalone
15
+ * dev, an older host) it no-ops.
16
+ */
17
+ function setShellBreadcrumb(items) {
18
+ const shell = (0, accessors_1.getShell)();
19
+ const set = shell?.setAppBreadcrumb;
20
+ return typeof set === "function" ? set(items) : () => { };
21
+ }
22
+ /**
23
+ * React form of `setShellBreadcrumb`: declares the trail for as long as the
24
+ * calling component is mounted. Re-sent only when a label, badge or the
25
+ * presence of a click changes, so it is cheap to call with inline arrays;
26
+ * clicks always reach the latest callbacks.
27
+ *
28
+ * Returns the trail's parent crumb — the one before the current page — or
29
+ * null when there is none. Render the page's back link from it, so the back
30
+ * link and the strip's crumb are the same step by construction:
31
+ *
32
+ * const back = useShellBreadcrumb([{ label: 'Records', onClick: list }, { label: id }]);
33
+ * {back && <PageHeaderBack onClick={back.onClick}>{back.label}</PageHeaderBack>}
34
+ *
35
+ * In the shell the back link then hides on wide screens (the strip is the way
36
+ * back) and shows on a phone; standalone it always shows.
37
+ */
38
+ function useShellBreadcrumb(items) {
39
+ const latest = (0, react_1.useRef)({ items });
40
+ latest.current = { items };
41
+ const key = JSON.stringify(items, (_key, value) => typeof value === "function" ? true : value);
42
+ (0, react_1.useEffect)(() => {
43
+ return setShellBreadcrumb(latest.current.items.map((item, index) => ({
44
+ ...item,
45
+ onClick: item.onClick
46
+ ? () => latest.current.items[index]?.onClick?.()
47
+ : undefined,
48
+ })));
49
+ }, [key]);
50
+ const parentIndex = items.length - 2;
51
+ const parent = parentIndex >= 0 ? items[parentIndex] : undefined;
52
+ return parent?.onClick
53
+ ? {
54
+ label: parent.label,
55
+ onClick: () => latest.current.items[parentIndex]?.onClick?.(),
56
+ }
57
+ : null;
58
+ }
package/build/index.d.ts CHANGED
@@ -4,4 +4,5 @@ export { useShellUser, useShellEnvironment, useShellNavigate } from "./hooks";
4
4
  export { getShell, getShellAi, getShellApi, getShellApiV4, getShellEnvironment, getShellUser, } from "./accessors";
5
5
  export { createMockShell, isMockShell, type CreateMockShellOptions, type MockShellFixtures, } from "./mockShell";
6
6
  export { registerTopBarActions, type TopBarAction } from "./topBar";
7
+ export { setShellBreadcrumb, useShellBreadcrumb, type ShellBreadcrumbBack, type ShellBreadcrumbBadge, type ShellBreadcrumbItem, } from "./breadcrumb";
7
8
  export { APP_DEPENDENCY_KINDS, APP_MANIFEST_FILENAME, DEFAULT_APP_ENVIRONMENT, resolveAppManifest, type AgentAppDependencySource, type AgentEnvironmentIds, type AppDependencyKind, type AppDependencySource, type AppManifestSource, type AssetTypeAppDependencySource, type FlowAppDependencySource, type FlowOriginEnvironmentIds, type IntegrationAppDependencySource, type IntegrationEnvironmentIds, type ResolvedAgentDependency, type ResolvedAppDependency, type ResolvedAppManifest, type ResolvedAssetTypeDependency, type ResolvedFlowDependency, type ResolvedIntegrationDependency, } from "./manifest";
package/build/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.resolveAppManifest = exports.DEFAULT_APP_ENVIRONMENT = exports.APP_MANIFEST_FILENAME = exports.APP_DEPENDENCY_KINDS = exports.registerTopBarActions = exports.isMockShell = exports.createMockShell = exports.getShellUser = exports.getShellEnvironment = exports.getShellApiV4 = exports.getShellApi = exports.getShellAi = exports.getShell = exports.useShellNavigate = exports.useShellEnvironment = exports.useShellUser = void 0;
17
+ exports.resolveAppManifest = exports.DEFAULT_APP_ENVIRONMENT = exports.APP_MANIFEST_FILENAME = exports.APP_DEPENDENCY_KINDS = exports.useShellBreadcrumb = exports.setShellBreadcrumb = exports.registerTopBarActions = exports.isMockShell = exports.createMockShell = exports.getShellUser = exports.getShellEnvironment = exports.getShellApiV4 = exports.getShellApi = exports.getShellAi = exports.getShell = exports.useShellNavigate = exports.useShellEnvironment = exports.useShellUser = void 0;
18
18
  __exportStar(require("./shellBridge"), exports);
19
19
  __exportStar(require("./lifecycle"), exports);
20
20
  var hooks_1 = require("./hooks");
@@ -33,6 +33,9 @@ Object.defineProperty(exports, "createMockShell", { enumerable: true, get: funct
33
33
  Object.defineProperty(exports, "isMockShell", { enumerable: true, get: function () { return mockShell_1.isMockShell; } });
34
34
  var topBar_1 = require("./topBar");
35
35
  Object.defineProperty(exports, "registerTopBarActions", { enumerable: true, get: function () { return topBar_1.registerTopBarActions; } });
36
+ var breadcrumb_1 = require("./breadcrumb");
37
+ Object.defineProperty(exports, "setShellBreadcrumb", { enumerable: true, get: function () { return breadcrumb_1.setShellBreadcrumb; } });
38
+ Object.defineProperty(exports, "useShellBreadcrumb", { enumerable: true, get: function () { return breadcrumb_1.useShellBreadcrumb; } });
36
39
  // The app-dependency RUNTIME (useAppDependencies and the bound surfaces) is
37
40
  // deliberately absent from this barrel — it lives on the /dependencies subpath,
38
41
  // because it binds the connector layer and that layer must not ride the root