@chaibuilder/pages 0.4.6-beta.3 → 0.4.6-beta.4

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-C8daQItO.cjs"),t=require("./index-BosOek7g.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-D1hD4AZA.cjs"),t=require("./index-DL1vcgk2.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-DuN0t56f.js";
2
- import { g as d, c as f, a as e } from "./index-CHnFBKHF.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./B4MFY5CR-B0neOOrT.js";
2
+ import { g as d, c as f, a as e } from "./index-D_vvEddR.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-C8daQItO.cjs"),t=require("./index-BosOek7g.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./B4MFY5CR-D1hD4AZA.cjs"),t=require("./index-DL1vcgk2.cjs");var u=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),c=t.getPreferredColorScheme(),a=t.createMemo(()=>{const l=r.theme_preference||e.THEME_PREFERENCE;return l!=="system"?l:c()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{disabled:!0,localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.ParentPanel,{get children(){return t.createComponent(e.ContentView,{localStore:r,setLocalStore:n,get onClose(){return o.onClose},showPanelViewOnly:!0})}})}})}})}})},i=u;exports.default=i;
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-DuN0t56f.js";
2
- import { g as v, c as C, a as e } from "./index-CHnFBKHF.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./B4MFY5CR-B0neOOrT.js";
2
+ import { g as v, c as C, a as e } from "./index-D_vvEddR.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,108 @@
1
+ import { jsxs as i, Fragment as w, jsx as a } from "react/jsx-runtime";
2
+ import { Dialog as u, DialogContent as h, DialogHeader as b, DialogTitle as N, Label as r, Textarea as y, DialogFooter as D, Button as p } from "@chaibuilder/sdk/ui";
3
+ import { Eye as F } from "lucide-react";
4
+ import { useState as n } from "react";
5
+ function E({
6
+ asset: e,
7
+ onSave: l,
8
+ onCancel: o
9
+ }) {
10
+ const [c, f] = n(e.description || ""), [d, m] = n(!1), [v, s] = n(!1), x = async () => {
11
+ m(!0);
12
+ try {
13
+ await l({
14
+ description: c || void 0
15
+ });
16
+ } finally {
17
+ m(!1);
18
+ }
19
+ };
20
+ return /* @__PURE__ */ i(w, { children: [
21
+ /* @__PURE__ */ a(u, { open: !0, onOpenChange: () => o(), children: /* @__PURE__ */ i(h, { className: "sm:max-w-[700px]", children: [
22
+ /* @__PURE__ */ a(b, { children: /* @__PURE__ */ a(N, { children: "Edit Asset Details" }) }),
23
+ /* @__PURE__ */ i("div", { className: "flex gap-4", children: [
24
+ /* @__PURE__ */ i("div", { className: "relative group", children: [
25
+ /* @__PURE__ */ a(
26
+ "img",
27
+ {
28
+ src: e.url,
29
+ className: "max-h-96 w-96 border rounded-md p-2"
30
+ }
31
+ ),
32
+ /* @__PURE__ */ a(
33
+ "button",
34
+ {
35
+ onClick: () => s(!0),
36
+ className: "absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-md",
37
+ children: /* @__PURE__ */ a(F, { className: "h-8 w-8 text-white" })
38
+ }
39
+ )
40
+ ] }),
41
+ /* @__PURE__ */ i("div", { className: "grid gap-3 w-full", children: [
42
+ /* @__PURE__ */ a(r, { htmlFor: "description", children: "Details" }),
43
+ /* @__PURE__ */ a("div", { className: "grid grid-cols-1 gap-2 text-sm border rounded-md p-2", children: [
44
+ { label: "File Name", value: e.name },
45
+ { label: "Type", value: e.type },
46
+ { label: "Format", value: e.format },
47
+ { label: "Size", value: S(e.size) },
48
+ {
49
+ label: "Dimensions",
50
+ value: `${e.width} × ${e.height}`
51
+ },
52
+ { label: "Created", value: g(e.createdAt) },
53
+ {
54
+ label: "Updated",
55
+ value: g((e == null ? void 0 : e.updatedAt) || "")
56
+ }
57
+ ].map((t) => /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
58
+ /* @__PURE__ */ a(r, { className: "w-max text-left px-2 w-1/4 font-normal text-gray-700", children: t.label }),
59
+ ":",
60
+ /* @__PURE__ */ a("div", { className: "w-max text-left font-medium text-gray-900 capitalize", children: t.value })
61
+ ] })) }),
62
+ /* @__PURE__ */ i("div", { className: "grid gap-2", children: [
63
+ /* @__PURE__ */ a(r, { htmlFor: "description", children: "Description" }),
64
+ /* @__PURE__ */ a(
65
+ y,
66
+ {
67
+ id: "description",
68
+ value: c,
69
+ placeholder: "Enter a description for the asset",
70
+ onChange: (t) => f(t.target.value),
71
+ rows: 3
72
+ }
73
+ )
74
+ ] })
75
+ ] })
76
+ ] }),
77
+ /* @__PURE__ */ i(D, { children: [
78
+ /* @__PURE__ */ a(p, { variant: "outline", onClick: o, children: "Cancel" }),
79
+ /* @__PURE__ */ a(p, { onClick: x, disabled: d, children: d ? "Saving..." : "Save Changes" })
80
+ ] })
81
+ ] }) }),
82
+ /* @__PURE__ */ a(u, { open: v, onOpenChange: s, children: /* @__PURE__ */ a(h, { className: "w-[60vw] h-[60vh] p-0 flex items-center justify-center bg-gray-100", children: /* @__PURE__ */ a(
83
+ "img",
84
+ {
85
+ src: e.url,
86
+ className: "w-full h-full object-contain",
87
+ alt: e.name
88
+ }
89
+ ) }) })
90
+ ] });
91
+ }
92
+ function S(e) {
93
+ return e < 1024 ? `${e.toFixed(2)} KB` : `${(e / 1024).toFixed(2)} MB`;
94
+ }
95
+ function g(e) {
96
+ if (!e) return "N/A";
97
+ const l = new Date(e);
98
+ return new Intl.DateTimeFormat("en-US", {
99
+ month: "short",
100
+ day: "numeric",
101
+ year: "numeric",
102
+ hour: "2-digit",
103
+ minute: "2-digit"
104
+ }).format(l);
105
+ }
106
+ export {
107
+ E as default
108
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("@chaibuilder/sdk/ui"),g=require("lucide-react"),n=require("react");function p({asset:t,onSave:l,onCancel:r}){const[s,m]=n.useState(t.description||""),[c,o]=n.useState(!1),[h,d]=n.useState(!1),x=async()=>{o(!0);try{await l({description:s||void 0})}finally{o(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(a.Dialog,{open:!0,onOpenChange:()=>r(),children:e.jsxs(a.DialogContent,{className:"sm:max-w-[700px]",children:[e.jsx(a.DialogHeader,{children:e.jsx(a.DialogTitle,{children:"Edit Asset Details"})}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:t.url,className:"max-h-96 w-96 border rounded-md p-2"}),e.jsx("button",{onClick:()=>d(!0),className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-md",children:e.jsx(g.Eye,{className:"h-8 w-8 text-white"})})]}),e.jsxs("div",{className:"grid gap-3 w-full",children:[e.jsx(a.Label,{htmlFor:"description",children:"Details"}),e.jsx("div",{className:"grid grid-cols-1 gap-2 text-sm border rounded-md p-2",children:[{label:"File Name",value:t.name},{label:"Type",value:t.type},{label:"Format",value:t.format},{label:"Size",value:j(t.size)},{label:"Dimensions",value:`${t.width} × ${t.height}`},{label:"Created",value:u(t.createdAt)},{label:"Updated",value:u((t==null?void 0:t.updatedAt)||"")}].map(i=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.Label,{className:"w-max text-left px-2 w-1/4 font-normal text-gray-700",children:i.label}),":",e.jsx("div",{className:"w-max text-left font-medium text-gray-900 capitalize",children:i.value})]}))}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(a.Label,{htmlFor:"description",children:"Description"}),e.jsx(a.Textarea,{id:"description",value:s,placeholder:"Enter a description for the asset",onChange:i=>m(i.target.value),rows:3})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:r,children:"Cancel"}),e.jsx(a.Button,{onClick:x,disabled:c,children:c?"Saving...":"Save Changes"})]})]})}),e.jsx(a.Dialog,{open:h,onOpenChange:d,children:e.jsx(a.DialogContent,{className:"w-[60vw] h-[60vh] p-0 flex items-center justify-center bg-gray-100",children:e.jsx("img",{src:t.url,className:"w-full h-full object-contain",alt:t.name})})})]})}function j(t){return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`}function u(t){if(!t)return"N/A";const l=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(l)}exports.default=p;