@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,16 +1,14 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { RuleGridCell, RuleGridLabel, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps } from "@locusgraph/components";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- export function TopUpSkeleton(t0) {
5
- const $ = _c(6);
6
- const {
7
- packs: t1
8
- } = t0;
9
- const packs = t1 === undefined ? 3 : t1;
3
+ export function TopUpSkeleton({
4
+ packs = 3
5
+ }) {
10
6
  const count = Math.max(1, Math.floor(packs));
11
- let t2;
12
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
13
- t2 = /*#__PURE__*/_jsxs("div", {
7
+ return /*#__PURE__*/_jsxs(RuleGridCell, {
8
+ "data-slot": "top-up-skeleton",
9
+ ...skeletonRootProps,
10
+ className: "gap-4",
11
+ children: [/*#__PURE__*/_jsxs("div", {
14
12
  className: "flex flex-col gap-1.5",
15
13
  children: [/*#__PURE__*/_jsx("span", {
16
14
  className: "flex min-h-6 items-center",
@@ -22,52 +20,19 @@ export function TopUpSkeleton(t0) {
22
20
  }), /*#__PURE__*/_jsx(SkeletonBar, {
23
21
  className: "h-4 w-3/4 max-w-56"
24
22
  })]
25
- });
26
- $[0] = t2;
27
- } else {
28
- t2 = $[0];
29
- }
30
- let t3;
31
- if ($[1] !== count) {
32
- t3 = /*#__PURE__*/_jsx("div", {
23
+ }), /*#__PURE__*/_jsx("div", {
33
24
  className: "flex flex-wrap gap-2",
34
25
  "aria-hidden": "true",
35
26
  children: Array.from({
36
27
  length: count
37
- }, _temp)
38
- });
39
- $[1] = count;
40
- $[2] = t3;
41
- } else {
42
- t3 = $[2];
43
- }
44
- let t4;
45
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
46
- t4 = /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
28
+ }, (_, index) => /*#__PURE__*/_jsx(SkeletonBar
29
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder packs have no identity
30
+ , {
31
+ "data-slot": "credit-pack-skeleton",
32
+ className: "h-9 w-24 rounded-full"
33
+ }, index))
34
+ }), /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
47
35
  children: "Loading credit packs\u2026"
48
- });
49
- $[3] = t4;
50
- } else {
51
- t4 = $[3];
52
- }
53
- let t5;
54
- if ($[4] !== t3) {
55
- t5 = /*#__PURE__*/_jsxs(RuleGridCell, {
56
- "data-slot": "top-up-skeleton",
57
- ...skeletonRootProps,
58
- className: "gap-4",
59
- children: [t2, t3, t4]
60
- });
61
- $[4] = t3;
62
- $[5] = t5;
63
- } else {
64
- t5 = $[5];
65
- }
66
- return t5;
67
- }
68
- function _temp(_, index) {
69
- return /*#__PURE__*/_jsx(SkeletonBar, {
70
- "data-slot": "credit-pack-skeleton",
71
- className: "h-9 w-24 rounded-full"
72
- }, index);
36
+ })]
37
+ });
73
38
  }
@@ -1,88 +1,43 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { RuleGrid, RuleGridCell, RuleGridLabel, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps } from "@locusgraph/components";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  function QuotaSkeleton() {
5
- const $ = _c(1);
6
- let t0;
7
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
8
- t0 = /*#__PURE__*/_jsxs("div", {
9
- "data-slot": "quota-skeleton",
10
- "aria-hidden": "true",
11
- className: "flex flex-col gap-2",
12
- children: [/*#__PURE__*/_jsxs("div", {
13
- className: "flex items-baseline justify-between gap-4",
14
- children: [/*#__PURE__*/_jsx(SkeletonBar, {
15
- className: "h-4 w-28"
16
- }), /*#__PURE__*/_jsx(SkeletonBar, {
17
- className: "h-4 w-36"
18
- })]
4
+ return /*#__PURE__*/_jsxs("div", {
5
+ "data-slot": "quota-skeleton",
6
+ "aria-hidden": "true",
7
+ className: "flex flex-col gap-2",
8
+ children: [/*#__PURE__*/_jsxs("div", {
9
+ className: "flex items-baseline justify-between gap-4",
10
+ children: [/*#__PURE__*/_jsx(SkeletonBar, {
11
+ className: "h-4 w-28"
19
12
  }), /*#__PURE__*/_jsx(SkeletonBar, {
20
- className: "h-2 w-full rounded-full"
13
+ className: "h-4 w-36"
21
14
  })]
22
- });
23
- $[0] = t0;
24
- } else {
25
- t0 = $[0];
26
- }
27
- return t0;
15
+ }), /*#__PURE__*/_jsx(SkeletonBar, {
16
+ className: "h-2 w-full rounded-full"
17
+ })]
18
+ });
28
19
  }
29
- export function UsageSkeleton(t0) {
30
- const $ = _c(8);
31
- const {
32
- quotas: t1,
33
- label: t2
34
- } = t0;
35
- const quotas = t1 === undefined ? 2 : t1;
36
- const label = t2 === undefined ? "Usage" : t2;
20
+ export function UsageSkeleton({
21
+ quotas = 2,
22
+ label = "Usage"
23
+ }) {
37
24
  const count = Math.max(1, Math.floor(quotas));
38
- let t3;
39
- if ($[0] !== label) {
40
- t3 = /*#__PURE__*/_jsx(RuleGridLabel, {
41
- children: label
42
- });
43
- $[0] = label;
44
- $[1] = t3;
45
- } else {
46
- t3 = $[1];
47
- }
48
- let t4;
49
- if ($[2] !== count) {
50
- t4 = Array.from({
51
- length: count
52
- }, _temp);
53
- $[2] = count;
54
- $[3] = t4;
55
- } else {
56
- t4 = $[3];
57
- }
58
- let t5;
59
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
60
- t5 = /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
61
- children: "Loading usage\u2026"
62
- });
63
- $[4] = t5;
64
- } else {
65
- t5 = $[4];
66
- }
67
- let t6;
68
- if ($[5] !== t3 || $[6] !== t4) {
69
- t6 = /*#__PURE__*/_jsx(RuleGrid, {
70
- columns: 1,
71
- "data-slot": "usage-skeleton",
72
- ...skeletonRootProps,
73
- children: /*#__PURE__*/_jsxs(RuleGridCell, {
74
- className: "gap-5",
75
- children: [t3, t4, t5]
76
- })
77
- });
78
- $[5] = t3;
79
- $[6] = t4;
80
- $[7] = t6;
81
- } else {
82
- t6 = $[7];
83
- }
84
- return t6;
85
- }
86
- function _temp(_, index) {
87
- return /*#__PURE__*/_jsx(QuotaSkeleton, {}, index);
25
+ return /*#__PURE__*/_jsx(RuleGrid, {
26
+ columns: 1,
27
+ "data-slot": "usage-skeleton",
28
+ ...skeletonRootProps,
29
+ children: /*#__PURE__*/_jsxs(RuleGridCell, {
30
+ className: "gap-5",
31
+ children: [/*#__PURE__*/_jsx(RuleGridLabel, {
32
+ children: label
33
+ }), Array.from({
34
+ length: count
35
+ }, (_, index) =>
36
+ /*#__PURE__*/
37
+ // biome-ignore lint/suspicious/noArrayIndexKey: placeholder meters have no identity
38
+ _jsx(QuotaSkeleton, {}, index)), /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
39
+ children: "Loading usage\u2026"
40
+ })]
41
+ })
42
+ });
88
43
  }
@@ -1,84 +1,40 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { RuleGridCell, RuleGridLabel, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps } from "@locusgraph/components";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- export function WalletSkeleton(t0) {
5
- const $ = _c(7);
6
- const {
7
- grants: t1
8
- } = t0;
9
- const grants = t1 === undefined ? 1 : t1;
3
+ export function WalletSkeleton({
4
+ grants = 1
5
+ }) {
10
6
  const count = Math.max(0, Math.floor(grants));
11
- let t2;
12
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
13
- t2 = /*#__PURE__*/_jsx("span", {
7
+ return /*#__PURE__*/_jsxs(RuleGridCell, {
8
+ "data-slot": "wallet-skeleton",
9
+ ...skeletonRootProps,
10
+ className: "gap-4",
11
+ children: [/*#__PURE__*/_jsx("span", {
14
12
  className: "flex min-h-6 items-center justify-between",
15
13
  children: /*#__PURE__*/_jsx(RuleGridLabel, {
16
14
  children: "Prepaid credits"
17
15
  })
18
- });
19
- $[0] = t2;
20
- } else {
21
- t2 = $[0];
22
- }
23
- let t3;
24
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
25
- t3 = /*#__PURE__*/_jsx("div", {
16
+ }), /*#__PURE__*/_jsx("div", {
26
17
  className: "flex flex-col gap-1",
27
18
  "aria-hidden": "true",
28
19
  children: /*#__PURE__*/_jsx(SkeletonBar, {
29
20
  className: "h-9 w-32"
30
21
  })
31
- });
32
- $[1] = t3;
33
- } else {
34
- t3 = $[1];
35
- }
36
- let t4;
37
- if ($[2] !== count) {
38
- t4 = /*#__PURE__*/_jsx("ul", {
22
+ }), /*#__PURE__*/_jsx("ul", {
39
23
  className: "flex flex-col divide-y divide-line",
40
24
  "aria-hidden": "true",
41
25
  children: Array.from({
42
26
  length: count
43
- }, _temp)
44
- });
45
- $[2] = count;
46
- $[3] = t4;
47
- } else {
48
- t4 = $[3];
49
- }
50
- let t5;
51
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
52
- t5 = /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
27
+ }, (_, index) => /*#__PURE__*/_jsxs("li", {
28
+ "data-slot": "wallet-grant-skeleton",
29
+ className: "flex justify-between gap-4 py-2",
30
+ children: [/*#__PURE__*/_jsx(SkeletonBar, {
31
+ className: "h-4 w-24"
32
+ }), /*#__PURE__*/_jsx(SkeletonBar, {
33
+ className: "h-4 w-40"
34
+ })]
35
+ }, index))
36
+ }), /*#__PURE__*/_jsx(SkeletonLoadingLabel, {
53
37
  children: "Loading credits\u2026"
54
- });
55
- $[4] = t5;
56
- } else {
57
- t5 = $[4];
58
- }
59
- let t6;
60
- if ($[5] !== t4) {
61
- t6 = /*#__PURE__*/_jsxs(RuleGridCell, {
62
- "data-slot": "wallet-skeleton",
63
- ...skeletonRootProps,
64
- className: "gap-4",
65
- children: [t2, t3, t4, t5]
66
- });
67
- $[5] = t4;
68
- $[6] = t6;
69
- } else {
70
- t6 = $[6];
71
- }
72
- return t6;
73
- }
74
- function _temp(_, index) {
75
- return /*#__PURE__*/_jsxs("li", {
76
- "data-slot": "wallet-grant-skeleton",
77
- className: "flex justify-between gap-4 py-2",
78
- children: [/*#__PURE__*/_jsx(SkeletonBar, {
79
- className: "h-4 w-24"
80
- }), /*#__PURE__*/_jsx(SkeletonBar, {
81
- className: "h-4 w-40"
82
38
  })]
83
- }, index);
39
+ });
84
40
  }
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { Progress } from "@locusgraph/components";
3
2
  import { formatCount, quotaPercent, quotaStatus } from "@locusgraph/utils";
4
3
  import { periodLabel } from "../types.js";
@@ -8,196 +7,51 @@ const statusIndicator = {
8
7
  near: "[&_[data-slot=progress-indicator]]:bg-warn",
9
8
  over: "[&_[data-slot=progress-indicator]]:bg-destructive"
10
9
  };
11
- function QuotaStatusNote(t0) {
12
- const $ = _c(8);
13
- const {
14
- quota
15
- } = t0;
10
+ function QuotaStatusNote({
11
+ quota
12
+ }) {
16
13
  const status = quotaStatus(quota);
17
14
  if (status === "over") {
18
- const t1 = quota.used - quota.included;
19
- let t2;
20
- if ($[0] !== t1) {
21
- t2 = formatCount(t1);
22
- $[0] = t1;
23
- $[1] = t2;
24
- } else {
25
- t2 = $[1];
26
- }
27
- let t3;
28
- if ($[2] !== t2) {
29
- t3 = /*#__PURE__*/_jsxs("span", {
30
- className: "font-medium text-destructive",
31
- children: [t2, " over"]
32
- });
33
- $[2] = t2;
34
- $[3] = t3;
35
- } else {
36
- t3 = $[3];
37
- }
38
- return t3;
15
+ return /*#__PURE__*/_jsxs("span", {
16
+ className: "font-medium text-destructive",
17
+ children: [formatCount(quota.used - quota.included), " over"]
18
+ });
39
19
  }
40
20
  if (status === "near") {
41
- let t1;
42
- if ($[4] !== quota) {
43
- t1 = quotaPercent(quota);
44
- $[4] = quota;
45
- $[5] = t1;
46
- } else {
47
- t1 = $[5];
48
- }
49
- let t2;
50
- if ($[6] !== t1) {
51
- t2 = /*#__PURE__*/_jsxs("span", {
52
- className: "font-medium text-warn",
53
- children: [t1, "%"]
54
- });
55
- $[6] = t1;
56
- $[7] = t2;
57
- } else {
58
- t2 = $[7];
59
- }
60
- return t2;
21
+ return /*#__PURE__*/_jsxs("span", {
22
+ className: "font-medium text-warn",
23
+ children: [quotaPercent(quota), "%"]
24
+ });
61
25
  }
62
26
  return null;
63
27
  }
64
- export function Quota(t0) {
65
- const $ = _c(33);
66
- const {
67
- quota
68
- } = t0;
69
- let t1;
70
- if ($[0] !== quota) {
71
- t1 = quotaPercent(quota);
72
- $[0] = quota;
73
- $[1] = t1;
74
- } else {
75
- t1 = $[1];
76
- }
77
- const percent = t1;
28
+ export function Quota({
29
+ quota
30
+ }) {
31
+ const percent = quotaPercent(quota);
78
32
  const name = quota.label ?? quota.key;
79
- let t2;
80
- if ($[2] !== quota) {
81
- t2 = quotaStatus(quota);
82
- $[2] = quota;
83
- $[3] = t2;
84
- } else {
85
- t2 = $[3];
86
- }
87
- const t3 = quota.label ? "text-muted-foreground" : "font-mono text-muted-foreground";
88
- let t4;
89
- if ($[4] !== name || $[5] !== t3) {
90
- t4 = /*#__PURE__*/_jsx("span", {
91
- className: t3,
92
- children: name
93
- });
94
- $[4] = name;
95
- $[5] = t3;
96
- $[6] = t4;
97
- } else {
98
- t4 = $[6];
99
- }
100
- let t5;
101
- if ($[7] !== quota.used) {
102
- t5 = formatCount(quota.used);
103
- $[7] = quota.used;
104
- $[8] = t5;
105
- } else {
106
- t5 = $[8];
107
- }
108
- let t6;
109
- if ($[9] !== quota.included) {
110
- t6 = formatCount(quota.included);
111
- $[9] = quota.included;
112
- $[10] = t6;
113
- } else {
114
- t6 = $[10];
115
- }
116
- let t7;
117
- if ($[11] !== quota.period) {
118
- t7 = periodLabel(quota.period);
119
- $[11] = quota.period;
120
- $[12] = t7;
121
- } else {
122
- t7 = $[12];
123
- }
124
- let t8;
125
- if ($[13] !== t5 || $[14] !== t6 || $[15] !== t7) {
126
- t8 = /*#__PURE__*/_jsxs("span", {
127
- className: "font-medium text-foreground",
128
- children: [t5, " of ", t6, " ", t7]
129
- });
130
- $[13] = t5;
131
- $[14] = t6;
132
- $[15] = t7;
133
- $[16] = t8;
134
- } else {
135
- t8 = $[16];
136
- }
137
- let t9;
138
- if ($[17] !== quota) {
139
- t9 = /*#__PURE__*/_jsx(QuotaStatusNote, {
140
- quota: quota
141
- });
142
- $[17] = quota;
143
- $[18] = t9;
144
- } else {
145
- t9 = $[18];
146
- }
147
- let t10;
148
- if ($[19] !== t8 || $[20] !== t9) {
149
- t10 = /*#__PURE__*/_jsxs("span", {
150
- className: "flex items-baseline gap-2 tabular-nums",
151
- children: [t8, t9]
152
- });
153
- $[19] = t8;
154
- $[20] = t9;
155
- $[21] = t10;
156
- } else {
157
- t10 = $[21];
158
- }
159
- let t11;
160
- if ($[22] !== t10 || $[23] !== t4) {
161
- t11 = /*#__PURE__*/_jsxs("div", {
33
+ return /*#__PURE__*/_jsxs("div", {
34
+ "data-slot": "quota",
35
+ "data-status": quotaStatus(quota),
36
+ className: "flex flex-col gap-2",
37
+ children: [/*#__PURE__*/_jsxs("div", {
162
38
  className: "flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 text-sm",
163
- children: [t4, t10]
164
- });
165
- $[22] = t10;
166
- $[23] = t4;
167
- $[24] = t11;
168
- } else {
169
- t11 = $[24];
170
- }
171
- const t12 = `${name} ${percent}% of quota`;
172
- const t13 = statusIndicator[quotaStatus(quota)];
173
- let t14;
174
- if ($[25] !== percent || $[26] !== t12 || $[27] !== t13) {
175
- t14 = /*#__PURE__*/_jsx(Progress, {
39
+ children: [/*#__PURE__*/_jsx("span", {
40
+ className: quota.label ? "text-muted-foreground" : "font-mono text-muted-foreground",
41
+ children: name
42
+ }), /*#__PURE__*/_jsxs("span", {
43
+ className: "flex items-baseline gap-2 tabular-nums",
44
+ children: [/*#__PURE__*/_jsxs("span", {
45
+ className: "font-medium text-foreground",
46
+ children: [formatCount(quota.used), " of ", formatCount(quota.included), " ", periodLabel(quota.period)]
47
+ }), /*#__PURE__*/_jsx(QuotaStatusNote, {
48
+ quota: quota
49
+ })]
50
+ })]
51
+ }), /*#__PURE__*/_jsx(Progress, {
176
52
  value: percent,
177
- "aria-label": t12,
178
- className: t13
179
- });
180
- $[25] = percent;
181
- $[26] = t12;
182
- $[27] = t13;
183
- $[28] = t14;
184
- } else {
185
- t14 = $[28];
186
- }
187
- let t15;
188
- if ($[29] !== t11 || $[30] !== t14 || $[31] !== t2) {
189
- t15 = /*#__PURE__*/_jsxs("div", {
190
- "data-slot": "quota",
191
- "data-status": t2,
192
- className: "flex flex-col gap-2",
193
- children: [t11, t14]
194
- });
195
- $[29] = t11;
196
- $[30] = t14;
197
- $[31] = t2;
198
- $[32] = t15;
199
- } else {
200
- t15 = $[32];
201
- }
202
- return t15;
53
+ "aria-label": `${name} ${percent}% of quota`,
54
+ className: statusIndicator[quotaStatus(quota)]
55
+ })]
56
+ });
203
57
  }