@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,9 +1,70 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { formatCents } from "@locusgraph/utils";
3
- const intervalLabel = { month: "/month", year: "/year" };
4
- export function PlanPrice({ plan }) {
5
- if (plan.amountCents === undefined) {
6
- return (_jsx("span", { className: "font-heading text-xl font-semibold tracking-[-0.02em] tabular-nums", children: plan.price }));
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ const intervalLabel = {
5
+ month: "/month",
6
+ year: "/year"
7
+ };
8
+ export function PlanPrice(t0) {
9
+ const $ = _c(11);
10
+ const {
11
+ plan
12
+ } = t0;
13
+ if (plan.amountCents === undefined) {
14
+ let t1;
15
+ if ($[0] !== plan.price) {
16
+ t1 = /*#__PURE__*/_jsx("span", {
17
+ className: "font-heading text-xl font-semibold tracking-[-0.02em] tabular-nums",
18
+ children: plan.price
19
+ });
20
+ $[0] = plan.price;
21
+ $[1] = t1;
22
+ } else {
23
+ t1 = $[1];
7
24
  }
8
- return (_jsxs("span", { className: "flex items-baseline gap-1", children: [_jsx("span", { className: "font-heading text-2xl font-semibold tracking-[-0.02em] tabular-nums", children: formatCents(plan.amountCents) }), plan.interval && (_jsx("span", { className: "text-sm text-muted-foreground", children: intervalLabel[plan.interval] }))] }));
25
+ return t1;
26
+ }
27
+ let t1;
28
+ if ($[2] !== plan.amountCents) {
29
+ t1 = formatCents(plan.amountCents);
30
+ $[2] = plan.amountCents;
31
+ $[3] = t1;
32
+ } else {
33
+ t1 = $[3];
34
+ }
35
+ let t2;
36
+ if ($[4] !== t1) {
37
+ t2 = /*#__PURE__*/_jsx("span", {
38
+ className: "font-heading text-2xl font-semibold tracking-[-0.02em] tabular-nums",
39
+ children: t1
40
+ });
41
+ $[4] = t1;
42
+ $[5] = t2;
43
+ } else {
44
+ t2 = $[5];
45
+ }
46
+ let t3;
47
+ if ($[6] !== plan.interval) {
48
+ t3 = plan.interval && /*#__PURE__*/_jsx("span", {
49
+ className: "text-sm text-muted-foreground",
50
+ children: intervalLabel[plan.interval]
51
+ });
52
+ $[6] = plan.interval;
53
+ $[7] = t3;
54
+ } else {
55
+ t3 = $[7];
56
+ }
57
+ let t4;
58
+ if ($[8] !== t2 || $[9] !== t3) {
59
+ t4 = /*#__PURE__*/_jsxs("span", {
60
+ className: "flex items-baseline gap-1",
61
+ children: [t2, t3]
62
+ });
63
+ $[8] = t2;
64
+ $[9] = t3;
65
+ $[10] = t4;
66
+ } else {
67
+ t4 = $[10];
68
+ }
69
+ return t4;
9
70
  }
@@ -1,9 +1,74 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Badge, RuleGrid, RuleGridCell, RuleGridFooter, RuleGridTitle, } from "@locusgraph/components";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Badge, RuleGrid, RuleGridCell, RuleGridFooter, RuleGridTitle } from "@locusgraph/components";
3
3
  import { PlanPrice } from "./plan-price.js";
4
- export function Plans({ plans, actionFor }) {
5
- return (_jsx(RuleGrid, { columns: plans.length >= 3 ? 3 : 2, children: plans.map((plan) => {
6
- const action = plan.current ? null : actionFor?.(plan);
7
- return (_jsxs(RuleGridCell, { "data-current": plan.current || undefined, className: "gap-4", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs(RuleGridTitle, { className: "flex min-h-6 items-center gap-2", children: [plan.name, plan.current && _jsx(Badge, { variant: "secondary", children: "Current" })] }), _jsx(PlanPrice, { plan: plan })] }), _jsx("ul", { className: "flex flex-col gap-1.5 text-sm text-muted-foreground", children: plan.points.map((point) => (_jsx("li", { children: point }, point))) }), _jsx(RuleGridFooter, { className: "mt-auto", children: plan.current ? (_jsx("p", { className: "flex min-h-8 items-center text-sm text-muted-foreground", children: "Your plan" })) : (action) })] }, plan.name));
8
- }) }));
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function Plans(t0) {
6
+ const $ = _c(8);
7
+ const {
8
+ plans,
9
+ actionFor
10
+ } = t0;
11
+ const t1 = plans.length >= 3 ? 3 : 2;
12
+ let t2;
13
+ if ($[0] !== actionFor || $[1] !== plans) {
14
+ let t3;
15
+ if ($[3] !== actionFor) {
16
+ t3 = plan => {
17
+ const action = plan.current ? null : actionFor?.(plan);
18
+ return /*#__PURE__*/_jsxs(RuleGridCell, {
19
+ "data-current": plan.current || undefined,
20
+ className: "gap-4",
21
+ children: [/*#__PURE__*/_jsxs("div", {
22
+ className: "flex flex-col gap-2",
23
+ children: [/*#__PURE__*/_jsxs(RuleGridTitle, {
24
+ className: "flex min-h-6 items-center gap-2",
25
+ children: [plan.name, plan.current && /*#__PURE__*/_jsx(Badge, {
26
+ variant: "secondary",
27
+ children: "Current"
28
+ })]
29
+ }), /*#__PURE__*/_jsx(PlanPrice, {
30
+ plan: plan
31
+ })]
32
+ }), /*#__PURE__*/_jsx("ul", {
33
+ className: "flex flex-col gap-1.5 text-sm text-muted-foreground",
34
+ children: plan.points.map(_temp)
35
+ }), /*#__PURE__*/_jsx(RuleGridFooter, {
36
+ className: "mt-auto",
37
+ children: plan.current ? /*#__PURE__*/_jsx("p", {
38
+ className: "flex min-h-8 items-center text-sm text-muted-foreground",
39
+ children: "Your plan"
40
+ }) : action
41
+ })]
42
+ }, plan.name);
43
+ };
44
+ $[3] = actionFor;
45
+ $[4] = t3;
46
+ } else {
47
+ t3 = $[4];
48
+ }
49
+ t2 = plans.map(t3);
50
+ $[0] = actionFor;
51
+ $[1] = plans;
52
+ $[2] = t2;
53
+ } else {
54
+ t2 = $[2];
55
+ }
56
+ let t3;
57
+ if ($[5] !== t1 || $[6] !== t2) {
58
+ t3 = /*#__PURE__*/_jsx(RuleGrid, {
59
+ columns: t1,
60
+ children: t2
61
+ });
62
+ $[5] = t1;
63
+ $[6] = t2;
64
+ $[7] = t3;
65
+ } else {
66
+ t3 = $[7];
67
+ }
68
+ return t3;
69
+ }
70
+ function _temp(point) {
71
+ return /*#__PURE__*/_jsx("li", {
72
+ children: point
73
+ }, point);
9
74
  }
@@ -1,12 +1,108 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, RuleGridCell, RuleGridDescription, RuleGridLabel, Spinner, } from "@locusgraph/components";
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Button, RuleGridCell, RuleGridDescription, RuleGridLabel, Spinner } from "@locusgraph/components";
3
3
  import { centsToMicroUsd, formatCents, formatMicroUsd } from "@locusgraph/utils";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
5
  function hasBonus(pack) {
5
- return centsToMicroUsd(pack.priceCents) !== pack.amountMicroUsd;
6
+ return centsToMicroUsd(pack.priceCents) !== pack.amountMicroUsd;
6
7
  }
7
- export function TopUp({ packs, onBuy, pending = false, pendingPackId, highlightedPackId, description = "Pay once with Stripe. Credits never expire and never renew on their own.", }) {
8
- const busy = pending || pendingPackId !== undefined;
9
- return (_jsxs(RuleGridCell, { className: "gap-4", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("span", { className: "flex min-h-6 items-center", children: _jsx(RuleGridLabel, { children: "Buy credits" }) }), _jsx(RuleGridDescription, { children: description })] }), _jsx("div", { className: "flex flex-wrap gap-2", children: packs.map((pack) => (_jsxs(Button, { variant: pack.id === highlightedPackId ? "default" : "outline", disabled: busy, "aria-busy": pack.id === pendingPackId || undefined, onClick: () => onBuy(pack.id), children: [pack.id === pendingPackId && _jsx(Spinner, { "aria-hidden": "true", role: undefined }), _jsx("span", { className: "tabular-nums", children: formatMicroUsd(pack.amountMicroUsd) }), hasBonus(pack) && (_jsxs("span", { className: pack.id === highlightedPackId
10
- ? "tabular-nums opacity-75"
11
- : "font-medium text-good tabular-nums", children: ["for ", formatCents(pack.priceCents)] }))] }, pack.id))) })] }));
8
+ export function TopUp(t0) {
9
+ const $ = _c(19);
10
+ const {
11
+ packs,
12
+ onBuy,
13
+ pending: t1,
14
+ pendingPackId,
15
+ highlightedPackId,
16
+ description: t2
17
+ } = t0;
18
+ const pending = t1 === undefined ? false : t1;
19
+ const description = t2 === undefined ? "Pay once with Stripe. Credits never expire and never renew on their own." : t2;
20
+ const busy = pending || pendingPackId !== undefined;
21
+ let t3;
22
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t3 = /*#__PURE__*/_jsx("span", {
24
+ className: "flex min-h-6 items-center",
25
+ children: /*#__PURE__*/_jsx(RuleGridLabel, {
26
+ children: "Buy credits"
27
+ })
28
+ });
29
+ $[0] = t3;
30
+ } else {
31
+ t3 = $[0];
32
+ }
33
+ let t4;
34
+ if ($[1] !== description) {
35
+ t4 = /*#__PURE__*/_jsxs("div", {
36
+ className: "flex flex-col gap-1.5",
37
+ children: [t3, /*#__PURE__*/_jsx(RuleGridDescription, {
38
+ children: description
39
+ })]
40
+ });
41
+ $[1] = description;
42
+ $[2] = t4;
43
+ } else {
44
+ t4 = $[2];
45
+ }
46
+ let t5;
47
+ if ($[3] !== busy || $[4] !== highlightedPackId || $[5] !== onBuy || $[6] !== packs || $[7] !== pendingPackId) {
48
+ let t6;
49
+ if ($[9] !== busy || $[10] !== highlightedPackId || $[11] !== onBuy || $[12] !== pendingPackId) {
50
+ t6 = pack => /*#__PURE__*/_jsxs(Button, {
51
+ variant: pack.id === highlightedPackId ? "default" : "outline",
52
+ disabled: busy,
53
+ "aria-busy": pack.id === pendingPackId || undefined,
54
+ onClick: () => onBuy(pack.id),
55
+ children: [pack.id === pendingPackId && /*#__PURE__*/_jsx(Spinner, {
56
+ "aria-hidden": "true",
57
+ role: undefined
58
+ }), /*#__PURE__*/_jsx("span", {
59
+ className: "tabular-nums",
60
+ children: formatMicroUsd(pack.amountMicroUsd)
61
+ }), hasBonus(pack) && /*#__PURE__*/_jsxs("span", {
62
+ className: pack.id === highlightedPackId ? "tabular-nums opacity-75" : "font-medium text-good tabular-nums",
63
+ children: ["for ", formatCents(pack.priceCents)]
64
+ })]
65
+ }, pack.id);
66
+ $[9] = busy;
67
+ $[10] = highlightedPackId;
68
+ $[11] = onBuy;
69
+ $[12] = pendingPackId;
70
+ $[13] = t6;
71
+ } else {
72
+ t6 = $[13];
73
+ }
74
+ t5 = packs.map(t6);
75
+ $[3] = busy;
76
+ $[4] = highlightedPackId;
77
+ $[5] = onBuy;
78
+ $[6] = packs;
79
+ $[7] = pendingPackId;
80
+ $[8] = t5;
81
+ } else {
82
+ t5 = $[8];
83
+ }
84
+ let t6;
85
+ if ($[14] !== t5) {
86
+ t6 = /*#__PURE__*/_jsx("div", {
87
+ className: "flex flex-wrap gap-2",
88
+ children: t5
89
+ });
90
+ $[14] = t5;
91
+ $[15] = t6;
92
+ } else {
93
+ t6 = $[15];
94
+ }
95
+ let t7;
96
+ if ($[16] !== t4 || $[17] !== t6) {
97
+ t7 = /*#__PURE__*/_jsxs(RuleGridCell, {
98
+ className: "gap-4",
99
+ children: [t4, t6]
100
+ });
101
+ $[16] = t4;
102
+ $[17] = t6;
103
+ $[18] = t7;
104
+ } else {
105
+ t7 = $[18];
106
+ }
107
+ return t7;
12
108
  }
@@ -1,19 +1,217 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Badge, RuleGridCell, RuleGridLabel } from "@locusgraph/components";
3
3
  import { balanceLevel, formatDate, formatMicroUsd } from "@locusgraph/utils";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
5
  const levelHint = {
5
- low: { badge: "Low", text: "Add credits before usage stops.", tone: "text-warn" },
6
- empty: {
7
- badge: "Empty",
8
- text: "Paid usage is paused until you add credits.",
9
- tone: "text-destructive",
10
- },
6
+ low: {
7
+ badge: "Low",
8
+ text: "Add credits before usage stops.",
9
+ tone: "text-warn"
10
+ },
11
+ empty: {
12
+ badge: "Empty",
13
+ text: "Paid usage is paused until you add credits.",
14
+ tone: "text-destructive"
15
+ }
11
16
  };
12
- function GrantList({ grants }) {
13
- return (_jsx("ul", { className: "flex flex-col divide-y divide-line", children: grants.map((grant) => (_jsxs("li", { className: "flex justify-between gap-4 py-2", children: [_jsx("span", { children: grant.label }), _jsxs("span", { className: "flex items-baseline gap-2 tabular-nums", children: [_jsx("span", { className: "font-medium text-foreground", children: formatMicroUsd(grant.remainingMicroUsd) }), _jsx("span", { className: "text-muted-foreground", children: grant.expiresAt ? `expires ${formatDate(grant.expiresAt)}` : "never expires" })] })] }, `${grant.label}:${grant.expiresAt}`))) }));
17
+ function GrantList(t0) {
18
+ const $ = _c(4);
19
+ const {
20
+ grants
21
+ } = t0;
22
+ let t1;
23
+ if ($[0] !== grants) {
24
+ t1 = grants.map(_temp);
25
+ $[0] = grants;
26
+ $[1] = t1;
27
+ } else {
28
+ t1 = $[1];
29
+ }
30
+ let t2;
31
+ if ($[2] !== t1) {
32
+ t2 = /*#__PURE__*/_jsx("ul", {
33
+ className: "flex flex-col divide-y divide-line",
34
+ children: t1
35
+ });
36
+ $[2] = t1;
37
+ $[3] = t2;
38
+ } else {
39
+ t2 = $[3];
40
+ }
41
+ return t2;
42
+ }
43
+ function _temp(grant) {
44
+ return /*#__PURE__*/_jsxs("li", {
45
+ className: "flex justify-between gap-4 py-2",
46
+ children: [/*#__PURE__*/_jsx("span", {
47
+ children: grant.label
48
+ }), /*#__PURE__*/_jsxs("span", {
49
+ className: "flex items-baseline gap-2 tabular-nums",
50
+ children: [/*#__PURE__*/_jsx("span", {
51
+ className: "font-medium text-foreground",
52
+ children: formatMicroUsd(grant.remainingMicroUsd)
53
+ }), /*#__PURE__*/_jsx("span", {
54
+ className: "text-muted-foreground",
55
+ children: grant.expiresAt ? `expires ${formatDate(grant.expiresAt)}` : "never expires"
56
+ })]
57
+ })]
58
+ }, `${grant.label}:${grant.expiresAt}`);
14
59
  }
15
- export function Wallet({ balanceMicroUsd, debtMicroUsd = 0, grants }) {
16
- const level = balanceLevel(balanceMicroUsd);
17
- const hint = level === "fine" ? null : levelHint[level];
18
- return (_jsxs(RuleGridCell, { "data-level": level, className: "gap-4", children: [_jsxs("span", { className: "flex min-h-6 items-center justify-between", children: [_jsx(RuleGridLabel, { children: "Prepaid credits" }), hint && (_jsx(Badge, { variant: level === "empty" ? "destructive" : "secondary", className: level === "low" ? "text-warn" : undefined, children: hint.badge }))] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: `font-heading text-3xl font-semibold tracking-[-0.02em] tabular-nums ${hint?.tone ?? ""}`, children: formatMicroUsd(balanceMicroUsd) }), hint && _jsx("p", { className: "text-sm text-muted-foreground", children: hint.text })] }), _jsxs("div", { className: "flex flex-col gap-3 text-sm", children: [grants.length > 0 && _jsx(GrantList, { grants: grants }), grants.length === 0 && level !== "empty" && (_jsx("p", { className: "text-muted-foreground", children: "No credit grants to show." })), debtMicroUsd > 0 && (_jsxs("p", { className: "text-destructive", children: [formatMicroUsd(debtMicroUsd), " owed. It comes out of the next credits you add."] }))] })] }));
60
+ export function Wallet(t0) {
61
+ const $ = _c(34);
62
+ const {
63
+ balanceMicroUsd,
64
+ debtMicroUsd: t1,
65
+ grants
66
+ } = t0;
67
+ const debtMicroUsd = t1 === undefined ? 0 : t1;
68
+ let t2;
69
+ if ($[0] !== balanceMicroUsd) {
70
+ t2 = balanceLevel(balanceMicroUsd);
71
+ $[0] = balanceMicroUsd;
72
+ $[1] = t2;
73
+ } else {
74
+ t2 = $[1];
75
+ }
76
+ const level = t2;
77
+ const hint = level === "fine" ? null : levelHint[level];
78
+ let t3;
79
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
80
+ t3 = /*#__PURE__*/_jsx(RuleGridLabel, {
81
+ children: "Prepaid credits"
82
+ });
83
+ $[2] = t3;
84
+ } else {
85
+ t3 = $[2];
86
+ }
87
+ let t4;
88
+ if ($[3] !== hint || $[4] !== level) {
89
+ t4 = hint && /*#__PURE__*/_jsx(Badge, {
90
+ variant: level === "empty" ? "destructive" : "secondary",
91
+ className: level === "low" ? "text-warn" : undefined,
92
+ children: hint.badge
93
+ });
94
+ $[3] = hint;
95
+ $[4] = level;
96
+ $[5] = t4;
97
+ } else {
98
+ t4 = $[5];
99
+ }
100
+ let t5;
101
+ if ($[6] !== t4) {
102
+ t5 = /*#__PURE__*/_jsxs("span", {
103
+ className: "flex min-h-6 items-center justify-between",
104
+ children: [t3, t4]
105
+ });
106
+ $[6] = t4;
107
+ $[7] = t5;
108
+ } else {
109
+ t5 = $[7];
110
+ }
111
+ const t6 = `font-heading text-3xl font-semibold tracking-[-0.02em] tabular-nums ${hint?.tone ?? ""}`;
112
+ let t7;
113
+ if ($[8] !== balanceMicroUsd) {
114
+ t7 = formatMicroUsd(balanceMicroUsd);
115
+ $[8] = balanceMicroUsd;
116
+ $[9] = t7;
117
+ } else {
118
+ t7 = $[9];
119
+ }
120
+ let t8;
121
+ if ($[10] !== t6 || $[11] !== t7) {
122
+ t8 = /*#__PURE__*/_jsx("span", {
123
+ className: t6,
124
+ children: t7
125
+ });
126
+ $[10] = t6;
127
+ $[11] = t7;
128
+ $[12] = t8;
129
+ } else {
130
+ t8 = $[12];
131
+ }
132
+ let t9;
133
+ if ($[13] !== hint) {
134
+ t9 = hint && /*#__PURE__*/_jsx("p", {
135
+ className: "text-sm text-muted-foreground",
136
+ children: hint.text
137
+ });
138
+ $[13] = hint;
139
+ $[14] = t9;
140
+ } else {
141
+ t9 = $[14];
142
+ }
143
+ let t10;
144
+ if ($[15] !== t8 || $[16] !== t9) {
145
+ t10 = /*#__PURE__*/_jsxs("div", {
146
+ className: "flex flex-col gap-1",
147
+ children: [t8, t9]
148
+ });
149
+ $[15] = t8;
150
+ $[16] = t9;
151
+ $[17] = t10;
152
+ } else {
153
+ t10 = $[17];
154
+ }
155
+ let t11;
156
+ if ($[18] !== grants) {
157
+ t11 = grants.length > 0 && /*#__PURE__*/_jsx(GrantList, {
158
+ grants: grants
159
+ });
160
+ $[18] = grants;
161
+ $[19] = t11;
162
+ } else {
163
+ t11 = $[19];
164
+ }
165
+ let t12;
166
+ if ($[20] !== grants.length || $[21] !== level) {
167
+ t12 = grants.length === 0 && level !== "empty" && /*#__PURE__*/_jsx("p", {
168
+ className: "text-muted-foreground",
169
+ children: "No credit grants to show."
170
+ });
171
+ $[20] = grants.length;
172
+ $[21] = level;
173
+ $[22] = t12;
174
+ } else {
175
+ t12 = $[22];
176
+ }
177
+ let t13;
178
+ if ($[23] !== debtMicroUsd) {
179
+ t13 = debtMicroUsd > 0 && /*#__PURE__*/_jsxs("p", {
180
+ className: "text-destructive",
181
+ children: [formatMicroUsd(debtMicroUsd), " owed. It comes out of the next credits you add."]
182
+ });
183
+ $[23] = debtMicroUsd;
184
+ $[24] = t13;
185
+ } else {
186
+ t13 = $[24];
187
+ }
188
+ let t14;
189
+ if ($[25] !== t11 || $[26] !== t12 || $[27] !== t13) {
190
+ t14 = /*#__PURE__*/_jsxs("div", {
191
+ className: "flex flex-col gap-3 text-sm",
192
+ children: [t11, t12, t13]
193
+ });
194
+ $[25] = t11;
195
+ $[26] = t12;
196
+ $[27] = t13;
197
+ $[28] = t14;
198
+ } else {
199
+ t14 = $[28];
200
+ }
201
+ let t15;
202
+ if ($[29] !== level || $[30] !== t10 || $[31] !== t14 || $[32] !== t5) {
203
+ t15 = /*#__PURE__*/_jsxs(RuleGridCell, {
204
+ "data-level": level,
205
+ className: "gap-4",
206
+ children: [t5, t10, t14]
207
+ });
208
+ $[29] = level;
209
+ $[30] = t10;
210
+ $[31] = t14;
211
+ $[32] = t5;
212
+ $[33] = t15;
213
+ } else {
214
+ t15 = $[33];
215
+ }
216
+ return t15;
19
217
  }
@@ -1,10 +1,54 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { useEffect, useState } from "react";
4
- const utcFormat = new Intl.DateTimeFormat("en-US", { dateStyle: "medium", timeZone: "UTC" });
5
- const localFormat = new Intl.DateTimeFormat("en-US", { dateStyle: "medium" });
6
- export function LocalDate({ value }) {
7
- const [hydrated, setHydrated] = useState(false);
8
- useEffect(() => setHydrated(true), []);
9
- return (_jsx("time", { dateTime: value, children: (hydrated ? localFormat : utcFormat).format(new Date(value)) }));
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const utcFormat = new Intl.DateTimeFormat("en-US", {
7
+ dateStyle: "medium",
8
+ timeZone: "UTC"
9
+ });
10
+ const localFormat = new Intl.DateTimeFormat("en-US", {
11
+ dateStyle: "medium"
12
+ });
13
+ export function LocalDate(t0) {
14
+ const $ = _c(8);
15
+ const {
16
+ value
17
+ } = t0;
18
+ const [hydrated, setHydrated] = useState(false);
19
+ let t1;
20
+ let t2;
21
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22
+ t1 = () => setHydrated(true);
23
+ t2 = [];
24
+ $[0] = t1;
25
+ $[1] = t2;
26
+ } else {
27
+ t1 = $[0];
28
+ t2 = $[1];
29
+ }
30
+ useEffect(t1, t2);
31
+ const t3 = hydrated ? localFormat : utcFormat;
32
+ let t4;
33
+ if ($[2] !== t3 || $[3] !== value) {
34
+ t4 = t3.format(new Date(value));
35
+ $[2] = t3;
36
+ $[3] = value;
37
+ $[4] = t4;
38
+ } else {
39
+ t4 = $[4];
40
+ }
41
+ let t5;
42
+ if ($[5] !== t4 || $[6] !== value) {
43
+ t5 = /*#__PURE__*/_jsx("time", {
44
+ dateTime: value,
45
+ children: t4
46
+ });
47
+ $[5] = t4;
48
+ $[6] = value;
49
+ $[7] = t5;
50
+ } else {
51
+ t5 = $[7];
52
+ }
53
+ return t5;
10
54
  }
@@ -1,8 +1,73 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Password as KeyRoundIcon, Add as PlusIcon } from "@carbon/icons-react";
3
- import { Button, RuleGrid, RuleGridCell, RuleGridDescription, RuleGridTitle, } from "@locusgraph/components";
4
- export function KeysEmpty({ newKeyHref, description = newKeyHref
5
- ? "Create a key to let a service call LocusGraph products for this organization."
6
- : "Ask an owner to create a key for this organization.", linkComponent: Link = "a", }) {
7
- return (_jsx(RuleGrid, { columns: 1, children: _jsxs(RuleGridCell, { className: "items-center gap-2 py-12 text-center", children: [_jsx(KeyRoundIcon, { className: "mb-1 size-5 text-muted-foreground" }), _jsx(RuleGridTitle, { children: "No API keys yet" }), _jsx(RuleGridDescription, { className: "max-w-sm", children: description }), newKeyHref && (_jsx(Button, { asChild: true, size: "sm", className: "mt-2", children: _jsxs(Link, { href: newKeyHref, children: [_jsx(PlusIcon, {}), "New key"] }) }))] }) }));
3
+ import { Button, RuleGrid, RuleGridCell, RuleGridDescription, RuleGridTitle } from "@locusgraph/components";
4
+ 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;
8
73
  }