@locusgraph/blocks 0.3.0 → 0.3.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.
@@ -1,6 +1,84 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { RuleGridCell, RuleGridLabel, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps } from "@locusgraph/components";
1
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { RuleGridCell, RuleGridLabel, SkeletonBar, SkeletonLoadingLabel, skeletonRootProps, } from "@locusgraph/components";
3
- export function WalletSkeleton({ grants = 1 }) {
4
- const count = Math.max(0, Math.floor(grants));
5
- return (_jsxs(RuleGridCell, { "data-slot": "wallet-skeleton", ...skeletonRootProps, className: "gap-4", children: [_jsx("span", { className: "flex min-h-6 items-center justify-between", children: _jsx(RuleGridLabel, { children: "Prepaid credits" }) }), _jsx("div", { className: "flex flex-col gap-1", "aria-hidden": "true", children: _jsx(SkeletonBar, { className: "h-9 w-32" }) }), _jsx("ul", { className: "flex flex-col divide-y divide-line", "aria-hidden": "true", children: Array.from({ length: count }, (_, index) => (_jsxs("li", { "data-slot": "wallet-grant-skeleton", className: "flex justify-between gap-4 py-2", children: [_jsx(SkeletonBar, { className: "h-4 w-24" }), _jsx(SkeletonBar, { className: "h-4 w-40" })] }, index))) }), _jsx(SkeletonLoadingLabel, { children: "Loading credits\u2026" })] }));
4
+ export function WalletSkeleton(t0) {
5
+ const $ = _c(7);
6
+ const {
7
+ grants: t1
8
+ } = t0;
9
+ const grants = t1 === undefined ? 1 : t1;
10
+ 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", {
14
+ className: "flex min-h-6 items-center justify-between",
15
+ children: /*#__PURE__*/_jsx(RuleGridLabel, {
16
+ children: "Prepaid credits"
17
+ })
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", {
26
+ className: "flex flex-col gap-1",
27
+ "aria-hidden": "true",
28
+ children: /*#__PURE__*/_jsx(SkeletonBar, {
29
+ className: "h-9 w-32"
30
+ })
31
+ });
32
+ $[1] = t3;
33
+ } else {
34
+ t3 = $[1];
35
+ }
36
+ let t4;
37
+ if ($[2] !== count) {
38
+ t4 = /*#__PURE__*/_jsx("ul", {
39
+ className: "flex flex-col divide-y divide-line",
40
+ "aria-hidden": "true",
41
+ children: Array.from({
42
+ 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, {
53
+ 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
+ })]
83
+ }, index);
6
84
  }
package/dist/types.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export function periodLabel(period) {
2
- return period === "month" ? "this month" : "lifetime";
2
+ return period === "month" ? "this month" : "lifetime";
3
3
  }
@@ -1,24 +1,203 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Progress } from "@locusgraph/components";
3
3
  import { formatCount, quotaPercent, quotaStatus } from "@locusgraph/utils";
4
4
  import { periodLabel } from "../types.js";
5
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
5
6
  const statusIndicator = {
6
- ok: "",
7
- near: "[&_[data-slot=progress-indicator]]:bg-warn",
8
- over: "[&_[data-slot=progress-indicator]]:bg-destructive",
7
+ ok: "",
8
+ near: "[&_[data-slot=progress-indicator]]:bg-warn",
9
+ over: "[&_[data-slot=progress-indicator]]:bg-destructive"
9
10
  };
10
- function QuotaStatusNote({ quota }) {
11
- const status = quotaStatus(quota);
12
- if (status === "over") {
13
- return (_jsxs("span", { className: "font-medium text-destructive", children: [formatCount(quota.used - quota.included), " over"] }));
11
+ function QuotaStatusNote(t0) {
12
+ const $ = _c(8);
13
+ const {
14
+ quota
15
+ } = t0;
16
+ const status = quotaStatus(quota);
17
+ 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];
14
26
  }
15
- if (status === "near") {
16
- return _jsxs("span", { className: "font-medium text-warn", children: [quotaPercent(quota), "%"] });
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];
17
37
  }
18
- return null;
38
+ return t3;
39
+ }
40
+ 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;
61
+ }
62
+ return null;
19
63
  }
20
- export function Quota({ quota }) {
21
- const percent = quotaPercent(quota);
22
- const name = quota.label ?? quota.key;
23
- return (_jsxs("div", { "data-slot": "quota", "data-status": quotaStatus(quota), className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 text-sm", children: [_jsx("span", { className: quota.label ? "text-muted-foreground" : "font-mono text-muted-foreground", children: name }), _jsxs("span", { className: "flex items-baseline gap-2 tabular-nums", children: [_jsxs("span", { className: "font-medium text-foreground", children: [formatCount(quota.used), " of ", formatCount(quota.included), " ", periodLabel(quota.period)] }), _jsx(QuotaStatusNote, { quota: quota })] })] }), _jsx(Progress, { value: percent, "aria-label": `${name} ${percent}% of quota`, className: statusIndicator[quotaStatus(quota)] })] }));
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;
78
+ 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", {
162
+ 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, {
176
+ 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;
24
203
  }
@@ -1,29 +1,222 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Warning as CircleAlertIcon } from "@carbon/icons-react";
3
3
  import { Alert, AlertDescription, AlertTitle, Button } from "@locusgraph/components";
4
- import { balanceLevel, formatCount, formatMicroUsd, quotaStatus, } from "@locusgraph/utils";
4
+ import { balanceLevel, formatCount, formatMicroUsd, quotaStatus } from "@locusgraph/utils";
5
5
  import { periodLabel } from "../types.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
  function attentionTitle(level, overCount) {
7
- if (level === "empty")
8
- return "Out of credits";
9
- if (overCount === 0)
10
- return "Credits are running low";
11
- return level === "low"
12
- ? "Usage is over your plan and credits are low"
13
- : "Usage is over your plan";
8
+ if (level === "empty") return "Out of credits";
9
+ if (overCount === 0) return "Credits are running low";
10
+ return level === "low" ? "Usage is over your plan and credits are low" : "Usage is over your plan";
14
11
  }
15
12
  const toneClasses = {
16
- warn: "bg-warn/5 [&>svg]:text-warn",
17
- destructive: "bg-destructive/5 text-card-foreground [&>svg]:text-destructive",
13
+ warn: "bg-warn/5 [&>svg]:text-warn",
14
+ destructive: "bg-destructive/5 text-card-foreground [&>svg]:text-destructive"
18
15
  };
19
- export function UsageAlert({ balanceMicroUsd, quotas, paidPlan, buyCreditsHref, upgradeHref, linkComponent: Link = "a", }) {
20
- const level = balanceMicroUsd === null ? "fine" : balanceLevel(balanceMicroUsd);
21
- const over = quotas.filter((quota) => quotaStatus(quota) === "over");
22
- if (level === "fine" && over.length === 0)
23
- return null;
24
- const empty = level === "empty";
25
- const upgradeFirst = !paidPlan && over.length > 0;
26
- return (_jsxs(Alert, { className: toneClasses[empty ? "destructive" : "warn"], children: [_jsx(CircleAlertIcon, {}), _jsx(AlertTitle, { children: attentionTitle(level, over.length) }), _jsxs(AlertDescription, { className: "flex flex-col items-start gap-3", children: [_jsxs("ul", { className: "flex flex-col gap-1", children: [over.map((quota) => (_jsxs("li", { children: [_jsx("span", { className: quota.label ? undefined : "font-mono", children: quota.label ?? quota.key }), " ", "is at ", formatCount(quota.used), " of ", formatCount(quota.included), " ", periodLabel(quota.period), "."] }, quota.key))), balanceMicroUsd !== null && level !== "fine" && (_jsx("li", { children: empty
27
- ? "Paid usage is paused until you add credits."
28
- : `${formatMicroUsd(balanceMicroUsd)} of credits left.` }))] }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [!paidPlan && (_jsx(Button, { asChild: true, size: "sm", variant: upgradeFirst ? "default" : "ghost", children: _jsx(Link, { href: upgradeHref, children: "Upgrade to Pro" }) })), _jsx(Button, { asChild: true, size: "sm", variant: upgradeFirst ? "ghost" : "default", children: _jsx(Link, { href: buyCreditsHref, children: "Buy credits" }) })] })] })] }));
16
+ export function UsageAlert(t0) {
17
+ const $ = _c(49);
18
+ const {
19
+ balanceMicroUsd,
20
+ quotas,
21
+ paidPlan,
22
+ buyCreditsHref,
23
+ upgradeHref,
24
+ linkComponent: t1
25
+ } = t0;
26
+ const Link = t1 === undefined ? "a" : t1;
27
+ let T0;
28
+ let T1;
29
+ let empty;
30
+ let level;
31
+ let t2;
32
+ let t3;
33
+ let t4;
34
+ let t5;
35
+ let t6;
36
+ let t7;
37
+ let t8;
38
+ let upgradeFirst;
39
+ if ($[0] !== balanceMicroUsd || $[1] !== paidPlan || $[2] !== quotas) {
40
+ t8 = Symbol.for("react.early_return_sentinel");
41
+ bb0: {
42
+ level = balanceMicroUsd === null ? "fine" : balanceLevel(balanceMicroUsd);
43
+ const over = quotas.filter(_temp);
44
+ if (level === "fine" && over.length === 0) {
45
+ t8 = null;
46
+ break bb0;
47
+ }
48
+ empty = level === "empty";
49
+ upgradeFirst = !paidPlan && over.length > 0;
50
+ T1 = Alert;
51
+ t5 = toneClasses[empty ? "destructive" : "warn"];
52
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
53
+ t6 = /*#__PURE__*/_jsx(CircleAlertIcon, {});
54
+ $[15] = t6;
55
+ } else {
56
+ t6 = $[15];
57
+ }
58
+ t7 = /*#__PURE__*/_jsx(AlertTitle, {
59
+ children: attentionTitle(level, over.length)
60
+ });
61
+ T0 = AlertDescription;
62
+ t4 = "flex flex-col items-start gap-3";
63
+ t2 = "flex flex-col gap-1";
64
+ t3 = over.map(_temp2);
65
+ }
66
+ $[0] = balanceMicroUsd;
67
+ $[1] = paidPlan;
68
+ $[2] = quotas;
69
+ $[3] = T0;
70
+ $[4] = T1;
71
+ $[5] = empty;
72
+ $[6] = level;
73
+ $[7] = t2;
74
+ $[8] = t3;
75
+ $[9] = t4;
76
+ $[10] = t5;
77
+ $[11] = t6;
78
+ $[12] = t7;
79
+ $[13] = t8;
80
+ $[14] = upgradeFirst;
81
+ } else {
82
+ T0 = $[3];
83
+ T1 = $[4];
84
+ empty = $[5];
85
+ level = $[6];
86
+ t2 = $[7];
87
+ t3 = $[8];
88
+ t4 = $[9];
89
+ t5 = $[10];
90
+ t6 = $[11];
91
+ t7 = $[12];
92
+ t8 = $[13];
93
+ upgradeFirst = $[14];
94
+ }
95
+ if (t8 !== Symbol.for("react.early_return_sentinel")) {
96
+ return t8;
97
+ }
98
+ let t9;
99
+ if ($[16] !== balanceMicroUsd || $[17] !== empty || $[18] !== level) {
100
+ t9 = balanceMicroUsd !== null && level !== "fine" && /*#__PURE__*/_jsx("li", {
101
+ children: empty ? "Paid usage is paused until you add credits." : `${formatMicroUsd(balanceMicroUsd)} of credits left.`
102
+ });
103
+ $[16] = balanceMicroUsd;
104
+ $[17] = empty;
105
+ $[18] = level;
106
+ $[19] = t9;
107
+ } else {
108
+ t9 = $[19];
109
+ }
110
+ let t10;
111
+ if ($[20] !== t2 || $[21] !== t3 || $[22] !== t9) {
112
+ t10 = /*#__PURE__*/_jsxs("ul", {
113
+ className: t2,
114
+ children: [t3, t9]
115
+ });
116
+ $[20] = t2;
117
+ $[21] = t3;
118
+ $[22] = t9;
119
+ $[23] = t10;
120
+ } else {
121
+ t10 = $[23];
122
+ }
123
+ let t11;
124
+ if ($[24] !== Link || $[25] !== paidPlan || $[26] !== upgradeFirst || $[27] !== upgradeHref) {
125
+ t11 = !paidPlan && /*#__PURE__*/_jsx(Button, {
126
+ asChild: true,
127
+ size: "sm",
128
+ variant: upgradeFirst ? "default" : "ghost",
129
+ children: /*#__PURE__*/_jsx(Link, {
130
+ href: upgradeHref,
131
+ children: "Upgrade to Pro"
132
+ })
133
+ });
134
+ $[24] = Link;
135
+ $[25] = paidPlan;
136
+ $[26] = upgradeFirst;
137
+ $[27] = upgradeHref;
138
+ $[28] = t11;
139
+ } else {
140
+ t11 = $[28];
141
+ }
142
+ const t12 = upgradeFirst ? "ghost" : "default";
143
+ let t13;
144
+ if ($[29] !== Link || $[30] !== buyCreditsHref) {
145
+ t13 = /*#__PURE__*/_jsx(Link, {
146
+ href: buyCreditsHref,
147
+ children: "Buy credits"
148
+ });
149
+ $[29] = Link;
150
+ $[30] = buyCreditsHref;
151
+ $[31] = t13;
152
+ } else {
153
+ t13 = $[31];
154
+ }
155
+ let t14;
156
+ if ($[32] !== t12 || $[33] !== t13) {
157
+ t14 = /*#__PURE__*/_jsx(Button, {
158
+ asChild: true,
159
+ size: "sm",
160
+ variant: t12,
161
+ children: t13
162
+ });
163
+ $[32] = t12;
164
+ $[33] = t13;
165
+ $[34] = t14;
166
+ } else {
167
+ t14 = $[34];
168
+ }
169
+ let t15;
170
+ if ($[35] !== t11 || $[36] !== t14) {
171
+ t15 = /*#__PURE__*/_jsxs("div", {
172
+ className: "flex flex-wrap items-center gap-2",
173
+ children: [t11, t14]
174
+ });
175
+ $[35] = t11;
176
+ $[36] = t14;
177
+ $[37] = t15;
178
+ } else {
179
+ t15 = $[37];
180
+ }
181
+ let t16;
182
+ if ($[38] !== T0 || $[39] !== t10 || $[40] !== t15 || $[41] !== t4) {
183
+ t16 = /*#__PURE__*/_jsxs(T0, {
184
+ className: t4,
185
+ children: [t10, t15]
186
+ });
187
+ $[38] = T0;
188
+ $[39] = t10;
189
+ $[40] = t15;
190
+ $[41] = t4;
191
+ $[42] = t16;
192
+ } else {
193
+ t16 = $[42];
194
+ }
195
+ let t17;
196
+ if ($[43] !== T1 || $[44] !== t16 || $[45] !== t5 || $[46] !== t6 || $[47] !== t7) {
197
+ t17 = /*#__PURE__*/_jsxs(T1, {
198
+ className: t5,
199
+ children: [t6, t7, t16]
200
+ });
201
+ $[43] = T1;
202
+ $[44] = t16;
203
+ $[45] = t5;
204
+ $[46] = t6;
205
+ $[47] = t7;
206
+ $[48] = t17;
207
+ } else {
208
+ t17 = $[48];
209
+ }
210
+ return t17;
211
+ }
212
+ function _temp2(quota_0) {
213
+ return /*#__PURE__*/_jsxs("li", {
214
+ children: [/*#__PURE__*/_jsx("span", {
215
+ className: quota_0.label ? undefined : "font-mono",
216
+ children: quota_0.label ?? quota_0.key
217
+ }), " ", "is at ", formatCount(quota_0.used), " of ", formatCount(quota_0.included), " ", periodLabel(quota_0.period), "."]
218
+ }, quota_0.key);
219
+ }
220
+ function _temp(quota) {
221
+ return quotaStatus(quota) === "over";
29
222
  }
@@ -1,6 +1,57 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { RuleGrid, RuleGridCell, RuleGridLabel } from "@locusgraph/components";
3
3
  import { Quota } from "./quota.js";
4
- export function Usage({ quotas, label = "Usage", emptyText = "No plan includes metered usage yet.", }) {
5
- return (_jsx(RuleGrid, { columns: 1, children: _jsxs(RuleGridCell, { className: "gap-5", children: [_jsx(RuleGridLabel, { children: label }), quotas.length > 0 ? (quotas.map((quota) => _jsx(Quota, { quota: quota }, quota.key))) : (_jsx("p", { className: "text-sm text-muted-foreground", children: emptyText }))] }) }));
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function Usage(t0) {
6
+ const $ = _c(8);
7
+ const {
8
+ quotas,
9
+ label: t1,
10
+ emptyText: t2
11
+ } = t0;
12
+ const label = t1 === undefined ? "Usage" : t1;
13
+ const emptyText = t2 === undefined ? "No plan includes metered usage yet." : t2;
14
+ let t3;
15
+ if ($[0] !== label) {
16
+ t3 = /*#__PURE__*/_jsx(RuleGridLabel, {
17
+ children: label
18
+ });
19
+ $[0] = label;
20
+ $[1] = t3;
21
+ } else {
22
+ t3 = $[1];
23
+ }
24
+ let t4;
25
+ if ($[2] !== emptyText || $[3] !== quotas) {
26
+ t4 = quotas.length > 0 ? quotas.map(_temp) : /*#__PURE__*/_jsx("p", {
27
+ className: "text-sm text-muted-foreground",
28
+ children: emptyText
29
+ });
30
+ $[2] = emptyText;
31
+ $[3] = quotas;
32
+ $[4] = t4;
33
+ } else {
34
+ t4 = $[4];
35
+ }
36
+ let t5;
37
+ if ($[5] !== t3 || $[6] !== t4) {
38
+ t5 = /*#__PURE__*/_jsx(RuleGrid, {
39
+ columns: 1,
40
+ children: /*#__PURE__*/_jsxs(RuleGridCell, {
41
+ className: "gap-5",
42
+ children: [t3, t4]
43
+ })
44
+ });
45
+ $[5] = t3;
46
+ $[6] = t4;
47
+ $[7] = t5;
48
+ } else {
49
+ t5 = $[7];
50
+ }
51
+ return t5;
52
+ }
53
+ function _temp(quota) {
54
+ return /*#__PURE__*/_jsx(Quota, {
55
+ quota: quota
56
+ }, quota.key);
6
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusgraph/blocks",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Product sections built from @locusgraph/components: usage meters and alerts, wallet, credit packs, plan options and API keys.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "provenance": true
30
30
  },
31
31
  "peerDependencies": {
32
- "@locusgraph/components": "^0.2.0",
32
+ "@locusgraph/components": "^0.2.1",
33
33
  "react": "^19.2.0",
34
34
  "react-dom": "^19.2.0"
35
35
  },
@@ -38,7 +38,7 @@
38
38
  "@locusgraph/utils": "0.1.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@locusgraph/components": "0.2.0",
41
+ "@locusgraph/components": "0.2.1",
42
42
  "@locusgraph/config": "0.1.1",
43
43
  "@types/node": "^22.0.0",
44
44
  "@types/react": "^19.2.0",
@@ -49,7 +49,7 @@
49
49
  "vitest": "^5.0.3"
50
50
  },
51
51
  "scripts": {
52
- "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/sources.css dist/sources.css && node ../../scripts/esm-extensions.mjs dist",
52
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/sources.css dist/sources.css && node ../../scripts/react-compiler.mjs dist && node ../../scripts/esm-extensions.mjs dist",
53
53
  "typecheck": "tsc -p tsconfig.json --noEmit",
54
54
  "test": "vitest run"
55
55
  }