@locusgraph/blocks 0.3.1 → 0.3.2

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.
@@ -1,73 +1,31 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { Password as KeyRoundIcon, Add as PlusIcon } from "@carbon/icons-react";
3
2
  import { Button, RuleGrid, RuleGridCell, RuleGridDescription, RuleGridTitle } from "@locusgraph/components";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- export function KeysEmpty(t0) {
6
- const $ = _c(10);
7
- const {
8
- newKeyHref,
9
- description: t1,
10
- linkComponent: t2
11
- } = t0;
12
- const description = t1 === undefined ? newKeyHref ? "Create a key to let a service call LocusGraph products for this organization." : "Ask an owner to create a key for this organization." : t1;
13
- const Link = t2 === undefined ? "a" : t2;
14
- let t3;
15
- let t4;
16
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
- t3 = /*#__PURE__*/_jsx(KeyRoundIcon, {
18
- className: "mb-1 size-5 text-muted-foreground"
19
- });
20
- t4 = /*#__PURE__*/_jsx(RuleGridTitle, {
21
- children: "No API keys yet"
22
- });
23
- $[0] = t3;
24
- $[1] = t4;
25
- } else {
26
- t3 = $[0];
27
- t4 = $[1];
28
- }
29
- let t5;
30
- if ($[2] !== description) {
31
- t5 = /*#__PURE__*/_jsx(RuleGridDescription, {
32
- className: "max-w-sm",
33
- children: description
34
- });
35
- $[2] = description;
36
- $[3] = t5;
37
- } else {
38
- t5 = $[3];
39
- }
40
- let t6;
41
- if ($[4] !== Link || $[5] !== newKeyHref) {
42
- t6 = newKeyHref && /*#__PURE__*/_jsx(Button, {
43
- asChild: true,
44
- size: "sm",
45
- className: "mt-2",
46
- children: /*#__PURE__*/_jsxs(Link, {
47
- href: newKeyHref,
48
- children: [/*#__PURE__*/_jsx(PlusIcon, {}), "New key"]
49
- })
50
- });
51
- $[4] = Link;
52
- $[5] = newKeyHref;
53
- $[6] = t6;
54
- } else {
55
- t6 = $[6];
56
- }
57
- let t7;
58
- if ($[7] !== t5 || $[8] !== t6) {
59
- t7 = /*#__PURE__*/_jsx(RuleGrid, {
60
- columns: 1,
61
- children: /*#__PURE__*/_jsxs(RuleGridCell, {
62
- className: "items-center gap-2 py-12 text-center",
63
- children: [t3, t4, t5, t6]
64
- })
65
- });
66
- $[7] = t5;
67
- $[8] = t6;
68
- $[9] = t7;
69
- } else {
70
- t7 = $[9];
71
- }
72
- return t7;
4
+ export function KeysEmpty({
5
+ newKeyHref,
6
+ description = newKeyHref ? "Create a key to let a service call LocusGraph products for this organization." : "Ask an owner to create a key for this organization.",
7
+ linkComponent: Link = "a"
8
+ }) {
9
+ return /*#__PURE__*/_jsx(RuleGrid, {
10
+ columns: 1,
11
+ children: /*#__PURE__*/_jsxs(RuleGridCell, {
12
+ className: "items-center gap-2 py-12 text-center",
13
+ children: [/*#__PURE__*/_jsx(KeyRoundIcon, {
14
+ className: "mb-1 size-5 text-muted-foreground"
15
+ }), /*#__PURE__*/_jsx(RuleGridTitle, {
16
+ children: "No API keys yet"
17
+ }), /*#__PURE__*/_jsx(RuleGridDescription, {
18
+ className: "max-w-sm",
19
+ children: description
20
+ }), newKeyHref && /*#__PURE__*/_jsx(Button, {
21
+ asChild: true,
22
+ size: "sm",
23
+ className: "mt-2",
24
+ children: /*#__PURE__*/_jsxs(Link, {
25
+ href: newKeyHref,
26
+ children: [/*#__PURE__*/_jsx(PlusIcon, {}), "New key"]
27
+ })
28
+ })]
29
+ })
30
+ });
73
31
  }
package/dist/keys/keys.js CHANGED
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@locusgraph/components";
3
2
  import { LocalDate } from "../dates/local-date.js";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -7,82 +6,35 @@ function dateOr(value, empty) {
7
6
  value: value
8
7
  }) : empty;
9
8
  }
10
- export function Keys(t0) {
11
- const $ = _c(22);
12
- const {
13
- keys,
14
- actions,
15
- highlightedId
16
- } = t0;
17
- let t1;
18
- let t2;
19
- let t3;
20
- let t4;
21
- let t5;
22
- let t6;
23
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
- t1 = /*#__PURE__*/_jsx(TableHead, {
25
- children: "Name"
26
- });
27
- t2 = /*#__PURE__*/_jsx(TableHead, {
28
- className: "hidden md:table-cell",
29
- children: "Key"
30
- });
31
- t3 = /*#__PURE__*/_jsx(TableHead, {
32
- children: "Product"
33
- });
34
- t4 = /*#__PURE__*/_jsx(TableHead, {
35
- className: "hidden md:table-cell",
36
- children: "Created by"
37
- });
38
- t5 = /*#__PURE__*/_jsx(TableHead, {
39
- className: "hidden md:table-cell",
40
- children: "Created"
41
- });
42
- t6 = /*#__PURE__*/_jsx(TableHead, {
43
- children: "Expires"
44
- });
45
- $[0] = t1;
46
- $[1] = t2;
47
- $[2] = t3;
48
- $[3] = t4;
49
- $[4] = t5;
50
- $[5] = t6;
51
- } else {
52
- t1 = $[0];
53
- t2 = $[1];
54
- t3 = $[2];
55
- t4 = $[3];
56
- t5 = $[4];
57
- t6 = $[5];
58
- }
59
- let t7;
60
- if ($[6] !== actions) {
61
- t7 = actions && /*#__PURE__*/_jsx(TableHead, {
62
- className: "w-0"
63
- });
64
- $[6] = actions;
65
- $[7] = t7;
66
- } else {
67
- t7 = $[7];
68
- }
69
- let t8;
70
- if ($[8] !== t7) {
71
- t8 = /*#__PURE__*/_jsx(TableHeader, {
9
+ export function Keys({
10
+ keys,
11
+ actions,
12
+ highlightedId
13
+ }) {
14
+ return /*#__PURE__*/_jsxs(Table, {
15
+ children: [/*#__PURE__*/_jsx(TableHeader, {
72
16
  children: /*#__PURE__*/_jsxs(TableRow, {
73
- children: [t1, t2, t3, t4, t5, t6, t7]
17
+ children: [/*#__PURE__*/_jsx(TableHead, {
18
+ children: "Name"
19
+ }), /*#__PURE__*/_jsx(TableHead, {
20
+ className: "hidden md:table-cell",
21
+ children: "Key"
22
+ }), /*#__PURE__*/_jsx(TableHead, {
23
+ children: "Product"
24
+ }), /*#__PURE__*/_jsx(TableHead, {
25
+ className: "hidden md:table-cell",
26
+ children: "Created by"
27
+ }), /*#__PURE__*/_jsx(TableHead, {
28
+ className: "hidden md:table-cell",
29
+ children: "Created"
30
+ }), /*#__PURE__*/_jsx(TableHead, {
31
+ children: "Expires"
32
+ }), actions && /*#__PURE__*/_jsx(TableHead, {
33
+ className: "w-0"
34
+ })]
74
35
  })
75
- });
76
- $[8] = t7;
77
- $[9] = t8;
78
- } else {
79
- t8 = $[9];
80
- }
81
- let t9;
82
- if ($[10] !== actions || $[11] !== highlightedId || $[12] !== keys) {
83
- let t10;
84
- if ($[14] !== actions || $[15] !== highlightedId) {
85
- t10 = key => /*#__PURE__*/_jsxs(TableRow, {
36
+ }), /*#__PURE__*/_jsx(TableBody, {
37
+ children: keys.map(key => /*#__PURE__*/_jsxs(TableRow, {
86
38
  "data-new": key.id === highlightedId ? "" : undefined,
87
39
  className: "transition-colors duration-1000 data-new:bg-accent",
88
40
  children: [/*#__PURE__*/_jsxs(TableCell, {
@@ -104,48 +56,14 @@ export function Keys(t0) {
104
56
  children: key.createdBy
105
57
  }), /*#__PURE__*/_jsx(TableCell, {
106
58
  className: "hidden md:table-cell",
107
- children: dateOr(key.createdAt, "\u2014")
59
+ children: dateOr(key.createdAt, "—")
108
60
  }), /*#__PURE__*/_jsx(TableCell, {
109
61
  children: dateOr(key.expiresAt, "Never")
110
62
  }), actions && /*#__PURE__*/_jsx(TableCell, {
111
63
  className: "w-0 pr-2 text-right whitespace-nowrap",
112
64
  children: actions(key)
113
65
  })]
114
- }, key.id);
115
- $[14] = actions;
116
- $[15] = highlightedId;
117
- $[16] = t10;
118
- } else {
119
- t10 = $[16];
120
- }
121
- t9 = keys.map(t10);
122
- $[10] = actions;
123
- $[11] = highlightedId;
124
- $[12] = keys;
125
- $[13] = t9;
126
- } else {
127
- t9 = $[13];
128
- }
129
- let t10;
130
- if ($[17] !== t9) {
131
- t10 = /*#__PURE__*/_jsx(TableBody, {
132
- children: t9
133
- });
134
- $[17] = t9;
135
- $[18] = t10;
136
- } else {
137
- t10 = $[18];
138
- }
139
- let t11;
140
- if ($[19] !== t10 || $[20] !== t8) {
141
- t11 = /*#__PURE__*/_jsxs(Table, {
142
- children: [t8, t10]
143
- });
144
- $[19] = t10;
145
- $[20] = t8;
146
- $[21] = t11;
147
- } else {
148
- t11 = $[21];
149
- }
150
- return t11;
66
+ }, key.id))
67
+ })]
68
+ });
151
69
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { SkeletonBar, SkeletonLoadingLabel, skeletonRootProps, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@locusgraph/components";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  const columns = [{
@@ -23,148 +22,64 @@ const columns = [{
23
22
  bar: "w-20"
24
23
  }];
25
24
  function NameCellSkeleton() {
26
- const $ = _c(1);
27
- let t0;
28
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
29
- t0 = /*#__PURE__*/_jsx(TableCell, {
30
- className: "max-w-40",
31
- children: /*#__PURE__*/_jsxs("div", {
32
- className: "flex flex-col gap-1",
33
- children: [/*#__PURE__*/_jsx(SkeletonBar, {
34
- className: "h-4 w-28"
35
- }), /*#__PURE__*/_jsx(SkeletonBar, {
36
- className: "h-3 w-20 md:hidden"
37
- })]
38
- })
39
- });
40
- $[0] = t0;
41
- } else {
42
- t0 = $[0];
43
- }
44
- return t0;
25
+ return /*#__PURE__*/_jsx(TableCell, {
26
+ className: "max-w-40",
27
+ children: /*#__PURE__*/_jsxs("div", {
28
+ className: "flex flex-col gap-1",
29
+ children: [/*#__PURE__*/_jsx(SkeletonBar, {
30
+ className: "h-4 w-28"
31
+ }), /*#__PURE__*/_jsx(SkeletonBar, {
32
+ className: "h-3 w-20 md:hidden"
33
+ })]
34
+ })
35
+ });
45
36
  }
46
- export function KeysSkeleton(t0) {
47
- const $ = _c(17);
48
- const {
49
- rows: t1,
50
- actions: t2
51
- } = t0;
52
- const rows = t1 === undefined ? 3 : t1;
53
- const actions = t2 === undefined ? false : t2;
37
+ export function KeysSkeleton({
38
+ rows = 3,
39
+ actions = false
40
+ }) {
54
41
  const count = Math.max(1, Math.floor(rows));
55
- let t3;
56
- let t4;
57
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
58
- t3 = /*#__PURE__*/_jsx(TableHead, {
59
- children: "Name"
60
- });
61
- t4 = columns.map(_temp);
62
- $[0] = t3;
63
- $[1] = t4;
64
- } else {
65
- t3 = $[0];
66
- t4 = $[1];
67
- }
68
- let t5;
69
- if ($[2] !== actions) {
70
- t5 = actions && /*#__PURE__*/_jsx(TableHead, {
71
- className: "w-0"
72
- });
73
- $[2] = actions;
74
- $[3] = t5;
75
- } else {
76
- t5 = $[3];
77
- }
78
- let t6;
79
- if ($[4] !== t5) {
80
- t6 = /*#__PURE__*/_jsx(TableHeader, {
81
- children: /*#__PURE__*/_jsxs(TableRow, {
82
- className: "hover:bg-transparent",
83
- children: [t3, t4, t5]
84
- })
85
- });
86
- $[4] = t5;
87
- $[5] = t6;
88
- } else {
89
- t6 = $[5];
90
- }
91
- let t7;
92
- if ($[6] !== actions || $[7] !== count) {
93
- let t8;
94
- if ($[9] !== actions) {
95
- t8 = (_, row) => /*#__PURE__*/_jsxs(TableRow, {
96
- "data-slot": "keys-skeleton-row",
97
- className: "hover:bg-transparent",
98
- children: [/*#__PURE__*/_jsx(NameCellSkeleton, {}), columns.map(_temp2), actions && /*#__PURE__*/_jsx(TableCell, {
99
- className: "w-0 pr-2 text-right",
100
- children: /*#__PURE__*/_jsx(SkeletonBar, {
101
- className: "ml-auto h-8 w-16 rounded-full"
102
- })
103
- })]
104
- }, row);
105
- $[9] = actions;
106
- $[10] = t8;
107
- } else {
108
- t8 = $[10];
109
- }
110
- t7 = /*#__PURE__*/_jsx(TableBody, {
111
- children: Array.from({
112
- length: count
113
- }, t8)
114
- });
115
- $[6] = actions;
116
- $[7] = count;
117
- $[8] = t7;
118
- } else {
119
- t7 = $[8];
120
- }
121
- let t8;
122
- if ($[11] !== t6 || $[12] !== t7) {
123
- t8 = /*#__PURE__*/_jsxs(Table, {
42
+ return /*#__PURE__*/_jsxs("div", {
43
+ "data-slot": "keys-skeleton",
44
+ ...skeletonRootProps,
45
+ className: "w-full",
46
+ children: [/*#__PURE__*/_jsxs(Table, {
124
47
  "aria-hidden": "true",
125
- children: [t6, t7]
126
- });
127
- $[11] = t6;
128
- $[12] = t7;
129
- $[13] = t8;
130
- } else {
131
- t8 = $[13];
132
- }
133
- let t9;
134
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
135
- t9 = /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
48
+ children: [/*#__PURE__*/_jsx(TableHeader, {
49
+ children: /*#__PURE__*/_jsxs(TableRow, {
50
+ className: "hover:bg-transparent",
51
+ children: [/*#__PURE__*/_jsx(TableHead, {
52
+ children: "Name"
53
+ }), columns.map(column => /*#__PURE__*/_jsx(TableHead, {
54
+ className: column.visibility,
55
+ children: column.name
56
+ }, column.name)), actions && /*#__PURE__*/_jsx(TableHead, {
57
+ className: "w-0"
58
+ })]
59
+ })
60
+ }), /*#__PURE__*/_jsx(TableBody, {
61
+ children: Array.from({
62
+ length: count
63
+ }, (_, row) => /*#__PURE__*/_jsxs(TableRow
64
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder rows have no identity
65
+ , {
66
+ "data-slot": "keys-skeleton-row",
67
+ className: "hover:bg-transparent",
68
+ children: [/*#__PURE__*/_jsx(NameCellSkeleton, {}), columns.map(column => /*#__PURE__*/_jsx(TableCell, {
69
+ className: column.visibility,
70
+ children: /*#__PURE__*/_jsx(SkeletonBar, {
71
+ className: `h-4 ${column.bar}`
72
+ })
73
+ }, column.name)), actions && /*#__PURE__*/_jsx(TableCell, {
74
+ className: "w-0 pr-2 text-right",
75
+ children: /*#__PURE__*/_jsx(SkeletonBar, {
76
+ className: "ml-auto h-8 w-16 rounded-full"
77
+ })
78
+ })]
79
+ }, row))
80
+ })]
81
+ }), /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
136
82
  children: "Loading API keys\u2026"
137
- });
138
- $[14] = t9;
139
- } else {
140
- t9 = $[14];
141
- }
142
- let t10;
143
- if ($[15] !== t8) {
144
- t10 = /*#__PURE__*/_jsxs("div", {
145
- "data-slot": "keys-skeleton",
146
- ...skeletonRootProps,
147
- className: "w-full",
148
- children: [t8, t9]
149
- });
150
- $[15] = t8;
151
- $[16] = t10;
152
- } else {
153
- t10 = $[16];
154
- }
155
- return t10;
156
- }
157
- function _temp2(column_0) {
158
- return /*#__PURE__*/_jsx(TableCell, {
159
- className: column_0.visibility,
160
- children: /*#__PURE__*/_jsx(SkeletonBar, {
161
- className: `h-4 ${column_0.bar}`
162
- })
163
- }, column_0.name);
164
- }
165
- function _temp(column) {
166
- return /*#__PURE__*/_jsx(TableHead, {
167
- className: column.visibility,
168
- children: column.name
169
- }, column.name);
83
+ })]
84
+ });
170
85
  }
@@ -1,94 +1,54 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { RuleGrid, RuleGridCell, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps } from "@locusgraph/components";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- export function PlansSkeleton(t0) {
5
- const $ = _c(11);
6
- const {
7
- plans: t1,
8
- points: t2,
9
- currentIndex: t3
10
- } = t0;
11
- const plans = t1 === undefined ? 2 : t1;
12
- const points = t2 === undefined ? 2 : t2;
13
- const currentIndex = t3 === undefined ? 0 : t3;
3
+ export function PlansSkeleton({
4
+ plans = 2,
5
+ points = 2,
6
+ currentIndex = 0
7
+ }) {
14
8
  const planCount = Math.max(1, Math.floor(plans));
15
9
  const pointCount = Math.max(0, Math.floor(points));
16
- const t4 = planCount >= 3 ? 3 : 2;
17
- let t5;
18
- if ($[0] !== currentIndex || $[1] !== planCount || $[2] !== pointCount) {
19
- let t6;
20
- if ($[4] !== currentIndex || $[5] !== pointCount) {
21
- t6 = (_, plan) => /*#__PURE__*/_jsxs(RuleGridCell, {
22
- "data-slot": "plan-skeleton",
23
- "aria-hidden": "true",
24
- className: "gap-4",
25
- children: [/*#__PURE__*/_jsxs("div", {
26
- className: "flex flex-col gap-2",
27
- children: [/*#__PURE__*/_jsx("div", {
28
- className: "flex min-h-6 items-center",
29
- children: /*#__PURE__*/_jsx(SkeletonBar, {
30
- className: "h-5 w-20"
31
- })
32
- }), /*#__PURE__*/_jsx(SkeletonBar, {
33
- className: "h-8 w-28"
34
- })]
35
- }), /*#__PURE__*/_jsx("div", {
36
- className: "flex flex-col gap-1.5",
37
- children: Array.from({
38
- length: pointCount
39
- }, _temp)
40
- }), plan === currentIndex ? /*#__PURE__*/_jsx("div", {
41
- className: "mt-auto flex min-h-8 items-center",
10
+ return /*#__PURE__*/_jsxs(RuleGrid, {
11
+ columns: planCount >= 3 ? 3 : 2,
12
+ "data-slot": "plans-skeleton",
13
+ ...skeletonRootProps,
14
+ children: [Array.from({
15
+ length: planCount
16
+ }, (_, plan) => /*#__PURE__*/_jsxs(RuleGridCell
17
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder plans have no identity
18
+ , {
19
+ "data-slot": "plan-skeleton",
20
+ "aria-hidden": "true",
21
+ className: "gap-4",
22
+ children: [/*#__PURE__*/_jsxs("div", {
23
+ className: "flex flex-col gap-2",
24
+ children: [/*#__PURE__*/_jsx("div", {
25
+ className: "flex min-h-6 items-center",
42
26
  children: /*#__PURE__*/_jsx(SkeletonBar, {
43
- className: "h-4 w-16"
27
+ className: "h-5 w-20"
44
28
  })
45
- }) : /*#__PURE__*/_jsx(SkeletonBar, {
46
- className: "mt-auto h-8 w-28 rounded-full"
29
+ }), /*#__PURE__*/_jsx(SkeletonBar, {
30
+ className: "h-8 w-28"
47
31
  })]
48
- }, plan);
49
- $[4] = currentIndex;
50
- $[5] = pointCount;
51
- $[6] = t6;
52
- } else {
53
- t6 = $[6];
54
- }
55
- t5 = Array.from({
56
- length: planCount
57
- }, t6);
58
- $[0] = currentIndex;
59
- $[1] = planCount;
60
- $[2] = pointCount;
61
- $[3] = t5;
62
- } else {
63
- t5 = $[3];
64
- }
65
- let t6;
66
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
67
- t6 = /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
32
+ }), /*#__PURE__*/_jsx("div", {
33
+ className: "flex flex-col gap-1.5",
34
+ children: Array.from({
35
+ length: pointCount
36
+ }, (_, point) =>
37
+ /*#__PURE__*/
38
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder points have no identity
39
+ _jsx(SkeletonBar, {
40
+ className: "h-4 w-40"
41
+ }, point))
42
+ }), plan === currentIndex ? /*#__PURE__*/_jsx("div", {
43
+ className: "mt-auto flex min-h-8 items-center",
44
+ children: /*#__PURE__*/_jsx(SkeletonBar, {
45
+ className: "h-4 w-16"
46
+ })
47
+ }) : /*#__PURE__*/_jsx(SkeletonBar, {
48
+ className: "mt-auto h-8 w-28 rounded-full"
49
+ })]
50
+ }, plan)), /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
68
51
  children: "Loading plans\u2026"
69
- });
70
- $[7] = t6;
71
- } else {
72
- t6 = $[7];
73
- }
74
- let t7;
75
- if ($[8] !== t4 || $[9] !== t5) {
76
- t7 = /*#__PURE__*/_jsxs(RuleGrid, {
77
- columns: t4,
78
- "data-slot": "plans-skeleton",
79
- ...skeletonRootProps,
80
- children: [t5, t6]
81
- });
82
- $[8] = t4;
83
- $[9] = t5;
84
- $[10] = t7;
85
- } else {
86
- t7 = $[10];
87
- }
88
- return t7;
89
- }
90
- function _temp(__0, point) {
91
- return /*#__PURE__*/_jsx(SkeletonBar, {
92
- className: "h-4 w-40"
93
- }, point);
52
+ })]
53
+ });
94
54
  }