@protobase/ui 0.19.11 → 0.19.13

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.
@@ -2,49 +2,55 @@ import { AvatarStack } from "../primitives/avatar.js";
2
2
  import { Badge } from "../primitives/badge.js";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region src/record-view/record-header.tsx
5
- const RecordHeader = ({ collection, title, status, lastEditedBy, presence = [], actions }) => /* @__PURE__ */ jsxs("header", {
6
- className: "flex flex-col gap-4 border-b border-border pb-6 md:flex-row md:items-end md:justify-between md:gap-6",
7
- children: [/* @__PURE__ */ jsxs("div", { children: [
8
- collection && /* @__PURE__ */ jsx("p", {
9
- className: "mb-1 text-xs text-muted-foreground",
10
- children: collection
11
- }),
12
- /* @__PURE__ */ jsxs("div", {
13
- className: "flex flex-wrap items-center gap-x-3 gap-y-1",
14
- children: [/* @__PURE__ */ jsx("h1", {
15
- className: "text-xl font-semibold tracking-tight text-foreground md:text-2xl",
16
- children: title
17
- }), status && /* @__PURE__ */ jsx(Badge, {
18
- tone: status.tone,
19
- children: status.label
20
- })]
21
- }),
22
- lastEditedBy && /* @__PURE__ */ jsx("p", {
23
- className: "mt-1.5 text-xs text-muted-foreground",
24
- children: lastEditedBy.name ? /* @__PURE__ */ jsxs(Fragment, { children: [
25
- "Last edited by ",
26
- /* @__PURE__ */ jsx("span", {
27
- className: "font-medium text-foreground",
28
- children: lastEditedBy.name
29
- }),
30
- " ",
31
- lastEditedBy.ago
32
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: ["Last updated ", lastEditedBy.ago] })
33
- })
34
- ] }), /* @__PURE__ */ jsxs("div", {
35
- className: "flex items-center gap-4",
36
- children: [presence.length > 0 && /* @__PURE__ */ jsxs("span", {
37
- className: "flex items-center gap-2 text-xs text-muted-foreground",
38
- children: [
39
- /* @__PURE__ */ jsx(AvatarStack, {
40
- people: presence,
41
- size: "md"
42
- }),
43
- presence.length,
44
- " viewing"
45
- ]
46
- }), actions]
47
- })]
48
- });
5
+ const RecordHeader = ({ collection, title, titleHidden, status, lastEditedBy, presence = [], actions }) => {
6
+ if (titleHidden && !collection && !status && !lastEditedBy && presence.length === 0 && !actions) return /* @__PURE__ */ jsx("h1", {
7
+ className: "sr-only",
8
+ children: title
9
+ });
10
+ return /* @__PURE__ */ jsxs("header", {
11
+ className: "flex flex-col gap-4 border-b border-border pb-6 md:flex-row md:items-end md:justify-between md:gap-6",
12
+ children: [/* @__PURE__ */ jsxs("div", { children: [
13
+ collection && /* @__PURE__ */ jsx("p", {
14
+ className: "mb-1 text-xs text-muted-foreground",
15
+ children: collection
16
+ }),
17
+ /* @__PURE__ */ jsxs("div", {
18
+ className: "flex flex-wrap items-center gap-x-3 gap-y-1",
19
+ children: [/* @__PURE__ */ jsx("h1", {
20
+ className: titleHidden ? "sr-only" : "text-xl font-semibold tracking-tight text-foreground md:text-2xl",
21
+ children: title
22
+ }), status && /* @__PURE__ */ jsx(Badge, {
23
+ tone: status.tone,
24
+ children: status.label
25
+ })]
26
+ }),
27
+ lastEditedBy && /* @__PURE__ */ jsx("p", {
28
+ className: "mt-1.5 text-xs text-muted-foreground",
29
+ children: lastEditedBy.name ? /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ "Last edited by ",
31
+ /* @__PURE__ */ jsx("span", {
32
+ className: "font-medium text-foreground",
33
+ children: lastEditedBy.name
34
+ }),
35
+ " ",
36
+ lastEditedBy.ago
37
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: ["Last updated ", lastEditedBy.ago] })
38
+ })
39
+ ] }), /* @__PURE__ */ jsxs("div", {
40
+ className: "flex items-center gap-4",
41
+ children: [presence.length > 0 && /* @__PURE__ */ jsxs("span", {
42
+ className: "flex items-center gap-2 text-xs text-muted-foreground",
43
+ children: [
44
+ /* @__PURE__ */ jsx(AvatarStack, {
45
+ people: presence,
46
+ size: "md"
47
+ }),
48
+ presence.length,
49
+ " viewing"
50
+ ]
51
+ }), actions]
52
+ })]
53
+ });
54
+ };
49
55
  //#endregion
50
56
  export { RecordHeader };