@protobase/ui 0.33.0 → 0.33.1

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,8 +9,10 @@ import { AppLink, useAppAddress } from "../use-app-address.js";
9
9
  import { ErrorBanner } from "../error-banner.js";
10
10
  import { useProjectUi } from "../pages/project-ui.js";
11
11
  import { can } from "../permissions.js";
12
- import { DataGrid } from "../../data-grid/data-grid.js";
12
+ import { text } from "./messages.js";
13
+ import { cutOffNote } from "./cut-off-note.js";
13
14
  import { viewAllAddress } from "./embedded-display.js";
15
+ import { DataGrid } from "../../data-grid/data-grid.js";
14
16
  import { BoardDisplay } from "../displays/board-display.js";
15
17
  import { CalendarDisplay } from "../displays/calendar-display.js";
16
18
  import { TimelineDisplay } from "../displays/timeline-display.js";
@@ -19,8 +21,6 @@ import { CustomDisplay } from "../displays/custom-display.js";
19
21
  import { MapDisplay } from "../displays/map-display.js";
20
22
  import { DisplaySwitch } from "../displays/display-controls.js";
21
23
  import { embeddedColumns } from "./embedded-columns.js";
22
- import { text } from "./messages.js";
23
- import { cutOffNote } from "./cut-off-note.js";
24
24
  import { embeddedRowTargets } from "./embedded-row-targets.js";
25
25
  import { useEmbeddedRows } from "./use-embedded-rows.js";
26
26
  import { useMemo, useState } from "react";
@@ -0,0 +1,40 @@
1
+ import { SectionContent } from "../../../record-view/section.js";
2
+ import { listColumnNames } from "../../../live/columns-from-model.js";
3
+ import { useAdminMeta } from "../../meta-gate.js";
4
+ import { propsOf } from "./block-props.js";
5
+ import { RelatedCards } from "../../related-cards/related-cards.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ //#region src/app/pages/blocks/record-cards.tsx
8
+ /**
9
+ * What a filter finds as the record page's related cards, stacked full width under a heading like a record page
10
+ * section's, with no card frame around them, so no card sits in another.
11
+ */
12
+ const RecordCardsBlock = ({ node, slots }) => {
13
+ const { resource, filter = "", sort = "", fields, cardActions = [], limit = 10, display, title, description, empty } = propsOf(node);
14
+ const { resources, views } = useAdminMeta();
15
+ const model = resources[resource];
16
+ if (!model) return null;
17
+ const view = views[model.name];
18
+ return /* @__PURE__ */ jsx("section", {
19
+ className: "min-w-0",
20
+ "aria-label": title,
21
+ children: /* @__PURE__ */ jsx(SectionContent, {
22
+ title,
23
+ help: description,
24
+ actions: slots.actions,
25
+ children: /* @__PURE__ */ jsx(RelatedCards, {
26
+ model,
27
+ view,
28
+ filter,
29
+ sort,
30
+ fields: fields ?? listColumnNames(model, view),
31
+ actions: cardActions,
32
+ limit,
33
+ display,
34
+ empty
35
+ })
36
+ })
37
+ });
38
+ };
39
+ //#endregion
40
+ export { RecordCardsBlock };
@@ -14,6 +14,7 @@ import { ModalFormBlock } from "./blocks/modal-form.js";
14
14
  import { PageBlock } from "./blocks/page-block.js";
15
15
  import { ProgressBlock } from "./blocks/progress.js";
16
16
  import { RecordCardBlock } from "./blocks/record-card.js";
17
+ import { RecordCardsBlock } from "./blocks/record-cards.js";
17
18
  import { RecordRowBlock } from "./blocks/record-row.js";
18
19
  import { ShowBlock } from "./blocks/show.js";
19
20
  import { StatBlock } from "./blocks/stat.js";
@@ -34,6 +35,7 @@ const blocks = {
34
35
  Table: TableBlock,
35
36
  CardRow: CardRowBlock,
36
37
  RecordRow: RecordRowBlock,
38
+ RecordCards: RecordCardsBlock,
37
39
  Chart: ChartBlock,
38
40
  Progress: ProgressBlock,
39
41
  ModalForm: ModalFormBlock,
@@ -7,8 +7,8 @@ import { defaultOrderBy } from "../list-order.js";
7
7
  import { useAdminMeta } from "../meta-gate.js";
8
8
  import { AppLink } from "../use-app-address.js";
9
9
  import { ErrorBanner } from "../error-banner.js";
10
- import { useLiveRows } from "../../live/use-live-rows.js";
11
10
  import { viewAllAddress } from "../embedded-list/embedded-display.js";
11
+ import { useLiveRows } from "../../live/use-live-rows.js";
12
12
  import { FilterChipList } from "../searches/filter-chip-list.js";
13
13
  import { useFilterChips } from "../searches/use-filter-chips.js";
14
14
  import { text } from "./messages.js";
@@ -5,9 +5,9 @@ import { defaultOrderBy } from "../list-order.js";
5
5
  import { AppLink } from "../use-app-address.js";
6
6
  import { ErrorBanner } from "../error-banner.js";
7
7
  import { scopeOf, useCount, useListPage } from "../pages/use-layout-data.js";
8
- import { embeddedDisplay, viewAllAddress } from "../embedded-list/embedded-display.js";
9
8
  import { text } from "../embedded-list/messages.js";
10
9
  import { cutOffNote } from "../embedded-list/cut-off-note.js";
10
+ import { embeddedDisplay, viewAllAddress } from "../embedded-list/embedded-display.js";
11
11
  import { text as text$1 } from "./messages.js";
12
12
  import { RelatedCard } from "./related-card.js";
13
13
  import { ArrowRight } from "lucide-react";
@@ -6,6 +6,7 @@ import { listColumnNames } from "../live/columns-from-model.js";
6
6
  import { useAdminMeta, usePermissions } from "./meta-gate.js";
7
7
  import { ErrorBanner } from "./error-banner.js";
8
8
  import { countQuery } from "./pages/use-layout-data.js";
9
+ import { RelatedCards } from "./related-cards/related-cards.js";
9
10
  import { searchAll } from "../live/search-all.js";
10
11
  import { relatedHandOrder } from "./hand-order/hand-order.js";
11
12
  import { relatedOpens } from "./related-opens.js";
@@ -14,7 +15,6 @@ import { useEmbeddedDisplay } from "./embedded-list/use-embedded-display.js";
14
15
  import { text } from "./record-messages.js";
15
16
  import { HandSortedList } from "./hand-order/hand-sorted-list.js";
16
17
  import { ReorderButton } from "./hand-order/reorder-button.js";
17
- import { RelatedCards } from "./related-cards/related-cards.js";
18
18
  import { useState } from "react";
19
19
  import { jsx, jsxs } from "react/jsx-runtime";
20
20
  import { useQuery } from "@tanstack/react-query";
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.33.0";
2
+ var version = "0.33.1";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };
@@ -1,10 +1,13 @@
1
1
  import { ReactNode } from "react";
2
2
  //#region src/record-view/section.d.ts
3
- /** A titled part of the record page; `actions` sit at the end of the title's line. */
4
- export declare const Section: ({ title, help, actions, children }: {
5
- title: string;
3
+ type SectionProps = {
4
+ title?: string;
6
5
  help?: string;
7
6
  actions?: ReactNode;
8
7
  children: ReactNode;
8
+ };
9
+ /** A titled part of the record page; `actions` sit at the end of the title's line. */
10
+ export declare const Section: ({ title, help, actions, children }: SectionProps & {
11
+ title: string;
9
12
  }) => import("react").JSX.Element;
10
13
  //#endregion
@@ -1,28 +1,35 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  //#region src/record-view/section.tsx
3
- /** A titled part of the record page; `actions` sit at the end of the title's line. */
4
- const Section = ({ title, help, actions, children }) => {
5
- const heading = /* @__PURE__ */ jsx("h2", {
3
+ /** A section's title, its `actions` at the end of the title's line and its help, over its content, with no frame or spacing around them. */
4
+ const SectionContent = ({ title, help, actions, children }) => {
5
+ const heading = title ? /* @__PURE__ */ jsx("h2", {
6
6
  className: "text-[16px] font-semibold text-foreground",
7
7
  children: title
8
- });
9
- return /* @__PURE__ */ jsxs("section", {
10
- className: "py-8 first:pt-8",
11
- children: [
12
- actions ? /* @__PURE__ */ jsxs("div", {
13
- className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
14
- children: [heading, actions]
15
- }) : heading,
16
- help && /* @__PURE__ */ jsx("p", {
17
- className: "mt-1 max-w-xl leading-6 text-muted-foreground",
18
- children: help
19
- }),
20
- /* @__PURE__ */ jsx("div", {
21
- className: "mt-5",
22
- children
23
- })
24
- ]
25
- });
8
+ }) : null;
9
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10
+ actions ? /* @__PURE__ */ jsxs("div", {
11
+ className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2",
12
+ children: [heading ?? /* @__PURE__ */ jsx("span", {}), actions]
13
+ }) : heading,
14
+ help && /* @__PURE__ */ jsx("p", {
15
+ className: "mt-1 max-w-xl leading-6 text-muted-foreground",
16
+ children: help
17
+ }),
18
+ Boolean(heading || actions || help) ? /* @__PURE__ */ jsx("div", {
19
+ className: "mt-5",
20
+ children
21
+ }) : children
22
+ ] });
26
23
  };
24
+ /** A titled part of the record page; `actions` sit at the end of the title's line. */
25
+ const Section = ({ title, help, actions, children }) => /* @__PURE__ */ jsx("section", {
26
+ className: "py-8 first:pt-8",
27
+ children: /* @__PURE__ */ jsx(SectionContent, {
28
+ title,
29
+ help,
30
+ actions,
31
+ children
32
+ })
33
+ });
27
34
  //#endregion
28
- export { Section };
35
+ export { Section, SectionContent };