react-semaphor 0.1.304 → 0.1.306
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.
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +14 -14
- package/dist/chunks/braces-CuiOenEA.js +6 -0
- package/dist/chunks/braces-DZxcgUvn.js +23 -0
- package/dist/chunks/{dashboard-controls-DCZnUFI0.js → dashboard-controls-BpgZjEDy.js} +9 -9
- package/dist/chunks/{dashboard-controls-CyFZfGaN.js → dashboard-controls-CuQH4inS.js} +10 -9
- package/dist/chunks/{dashboard-filter-controls-button-YQZ-oeN5.js → dashboard-filter-controls-button-Bu90ytxy.js} +1 -1
- package/dist/chunks/{dashboard-filter-controls-button-DI7XUgZK.js → dashboard-filter-controls-button-NiAIAD1P.js} +4 -4
- package/dist/chunks/{dashboard-json-Z8jz16Yj.js → dashboard-json-Bk13vadr.js} +1 -1
- package/dist/chunks/{dashboard-json-C6R2qixD.js → dashboard-json-DzVn9KAU.js} +2 -2
- package/dist/chunks/{dashboard-summary-settings-dialog-DJyY-PB9.js → dashboard-summary-settings-dialog-8vZtKUjh.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BlD77h63.js → dashboard-summary-settings-dialog-dt20G_7d.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-CfRJXwDR.js → edit-dashboard-visual-BIuWXuCC.js} +8796 -8713
- package/dist/chunks/edit-dashboard-visual-DGhTFzSF.js +183 -0
- package/dist/chunks/index-CwzM5Lxh.js +1360 -0
- package/dist/chunks/{index-GHhvGdF9.js → index-DQApwxKL.js} +50813 -48256
- package/dist/chunks/{palette-BqJlrRto.js → palette-BwGE32UR.js} +2 -7
- package/dist/chunks/{palette-DD-i7bNS.js → palette-DFjOzeAG.js} +3 -23
- package/dist/chunks/{resource-management-panel-Bdus73Iu.js → resource-management-panel-BqJAVm7E.js} +1 -1
- package/dist/chunks/{resource-management-panel-7Y4ITzGH.js → resource-management-panel-CD_TQoTn.js} +3 -3
- package/dist/chunks/{save-CFBIhbHD.js → save-B3tqymYm.js} +1 -1
- package/dist/chunks/{save-j-clxFtx.js → save-QktcpXPy.js} +1 -1
- package/dist/chunks/{switch-BH17qlxH.js → switch-B72T1Hf_.js} +27 -22
- package/dist/chunks/{switch-BFhVVwh9.js → switch-BuZXNXQV.js} +431 -390
- package/dist/chunks/{use-create-flow-overlay-state-CllZvyvE.js → use-create-flow-overlay-state-Bg-LkLP7.js} +4 -4
- package/dist/chunks/{use-create-flow-overlay-state-CSytlf2H.js → use-create-flow-overlay-state-iUCs5ZgT.js} +1 -1
- package/dist/chunks/{use-visual-utils-CyjLzcDG.js → use-visual-utils-D_2r0Fmm.js} +2 -2
- package/dist/chunks/{use-visual-utils-CDO4kVX5.js → use-visual-utils-DqVxN0_F.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +142 -44
- package/dist/types/main.d.ts +144 -44
- package/dist/types/shared.d.ts +142 -44
- package/dist/types/surfboard.d.ts +142 -44
- package/dist/types/types.d.ts +142 -44
- package/package.json +4 -4
- package/dist/chunks/edit-dashboard-visual-CNGc1zcN.js +0 -183
- package/dist/chunks/index-D2vz3gvd.js +0 -1360
- package/dist/chunks/rotate-ccw-CdGW8Rxm.js +0 -6
- package/dist/chunks/rotate-ccw-X8MbX_hF.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-B72T1Hf_.js"),A=require("../chunks/index-DRlMUglg.js"),V=require("../chunks/palette-BwGE32UR.js"),ge=require("../chunks/braces-CuiOenEA.js"),be=require("../chunks/save-B3tqymYm.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const he=d.createLucideIcon("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]),W=[{id:"semaphor",name:"Semaphor",description:"Dense neutral system defaults for embedded analytics.",primary:"#18181b",accent:"#f4f4f5",light:{background:"#ffffff",foreground:"#18181b",muted:"#fafafa",mutedForeground:"#71717a",border:"#e4e4e7",primary:"#18181b",primaryForeground:"#ffffff",accent:"#f4f4f5",accentForeground:"#18181b",card:"#ffffff",cardForeground:"#18181b",chartPalette:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"]},dark:{background:"#09090b",foreground:"#fafafa",muted:"#18181b",mutedForeground:"#a1a1aa",border:"#27272a",primary:"#fafafa",primaryForeground:"#09090b",accent:"#27272a",accentForeground:"#fafafa",card:"#09090b",cardForeground:"#fafafa",chartPalette:["#60a5fa","#34d399","#fbbf24","#f87171","#a78bfa","#22d3ee"]}},{id:"atlas-blue",name:"Atlas Blue",description:"Crisp enterprise blue with restrained neutral surfaces.",primary:"#2563eb",accent:"#dbeafe",light:{background:"#f8fafc",foreground:"#0f172a",muted:"#f1f5f9",mutedForeground:"#64748b",border:"#cbd5e1",primary:"#2563eb",primaryForeground:"#ffffff",accent:"#dbeafe",accentForeground:"#1e3a8a",card:"#ffffff",cardForeground:"#0f172a",chartPalette:["#2563eb","#0f766e","#ca8a04","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#020617",foreground:"#e2e8f0",muted:"#0f172a",mutedForeground:"#94a3b8",border:"#1e293b",primary:"#60a5fa",primaryForeground:"#020617",accent:"#1e3a8a",accentForeground:"#dbeafe",card:"#0f172a",cardForeground:"#e2e8f0",chartPalette:["#60a5fa","#2dd4bf","#facc15","#f87171","#a78bfa","#22d3ee"]}},{id:"field-green",name:"Field Green",description:"Operational green accents with quiet, readable canvases.",primary:"#047857",accent:"#d1fae5",light:{background:"#fbfdfb",foreground:"#10231d",muted:"#f1f5f3",mutedForeground:"#64746d",border:"#d7ded9",primary:"#047857",primaryForeground:"#ffffff",accent:"#d1fae5",accentForeground:"#064e3b",card:"#ffffff",cardForeground:"#10231d",chartPalette:["#047857","#2563eb","#d97706","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#071511",foreground:"#e7f4ef",muted:"#10231d",mutedForeground:"#92aaa1",border:"#244139",primary:"#34d399",primaryForeground:"#071511",accent:"#064e3b",accentForeground:"#d1fae5",card:"#0b1d17",cardForeground:"#e7f4ef",chartPalette:["#34d399","#60a5fa","#fbbf24","#f87171","#a78bfa","#22d3ee"]}}];function O(r){const n=A.resolveAppearance({organizationAppearance:r??void 0});return je(P(n))}function E(r){const n=P({version:A.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=A.validateAppearanceSpec(n);if(!t.success){const u=t.issues[0];throw new Error(`Invalid Brand Studio appearance at ${u.path}: ${u.message}`)}return t.value}function oe(r,n){const t=W.find(i=>i.id===n);if(!t)return r;const u=P(r);return Q(u.schemes.light,t.light),Q(u.schemes.dark,t.dark),u}function Q(r,n){r.tokens.color.background=n.background,r.tokens.color.foreground=n.foreground,r.tokens.color.muted=n.muted,r.tokens.color.mutedForeground=n.mutedForeground,r.tokens.color.border=n.border,r.tokens.color.input=n.border,r.tokens.color.primary=n.primary,r.tokens.color.primaryForeground=n.primaryForeground,r.tokens.color.accent=n.accent,r.tokens.color.accentForeground=n.accentForeground,r.tokens.color.card=n.card,r.tokens.color.cardForeground=n.cardForeground,r.components.dashboard.background=n.background,r.components.dashboard.foreground=n.foreground,r.components.dashboard.borderColor=n.border,r.components.card.background=n.card,r.components.card.foreground=n.cardForeground,r.components.card.borderColor=n.border,r.components.interactive.toolbarBackground=n.background,r.components.interactive.background=n.card,r.components.interactive.foreground=n.foreground,r.components.interactive.borderColor=n.border,r.components.chart.palette=[...n.chartPalette],r.components.chart.background=n.card,r.components.chart.foreground=n.foreground,r.components.chart.gridColor=n.border,r.components.chart.axisColor=n.mutedForeground,r.components.table.container.background=n.card,r.components.table.container.borderColor=n.border,r.components.table.header.background=n.muted,r.components.table.header.foreground=n.mutedForeground,r.components.table.header.dividerColor=n.border,r.components.table.row.dividerColor=n.border,r.components.table.row.zebraBackground=n.muted,r.components.table.pagination.background=n.card,r.components.table.pagination.foreground=n.foreground,r.components.table.pagination.borderColor=n.border,c(r,"aggregateTable"),c(r,"pivotTable")}function c(r,n){r.components[n]=P(r.components.table)}function ee(r,n,t){switch(r.tokens.color[n]=t,n){case"background":r.components.dashboard.background=t,r.components.interactive.toolbarBackground=t;break;case"foreground":r.components.dashboard.foreground=t,r.components.interactive.foreground=t,r.components.pagination.foreground=t,r.components.chart.foreground=t,r.components.table.pagination.foreground=t,r.components.table.subtotal.foreground=t,r.components.table.grandTotal.foreground=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"card":r.components.card.background=t,r.components.interactive.background=t,r.components.pagination.background=t,r.components.chart.background=t,r.components.table.container.background=t,r.components.table.pagination.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"cardForeground":r.components.card.foreground=t;break;case"muted":r.components.table.header.background=t,r.components.table.row.zebraBackground=t,r.components.table.subtotal.background=t,r.components.table.grandTotal.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"mutedForeground":r.components.table.header.foreground=t,r.components.chart.axisColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"border":r.tokens.color.input=t,r.components.dashboard.borderColor=t,r.components.card.borderColor=t,r.components.interactive.borderColor=t,r.components.pagination.borderColor=t,r.components.chart.gridColor=t,r.components.table.container.borderColor=t,r.components.table.header.dividerColor=t,r.components.table.row.dividerColor=t,r.components.table.grandTotal.borderColor=t,r.components.table.pagination.borderColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"accent":r.components.table.row.hoverBackground=t,r.components.table.row.selectedBackground=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function U(r,n,t){switch(r.tokens.radius[n]=t,n){case"control":r.components.interactive.borderRadius=t,r.components.pagination.borderRadius=t;break;case"card":r.components.card.borderRadius=t;break;case"table":r.components.table.container.borderRadius=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function je(r){var n,t;for(const u of["light","dark"]){const i=r.schemes[u],l=i.tokens,s=l.color,y=(n=i.components)==null?void 0:n.aggregateTable,j=(t=i.components)==null?void 0:t.pivotTable,N={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};l.typography={...N,...l.typography};const f={control:5,card:5,table:5,badge:999};l.radius={...f,...l.radius};const g={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};l.spacing={...g,...l.spacing};const w={card:"none",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"};l.shadow={...w,...l.shadow};const T={dashboard:{background:s.background,foreground:s.foreground,borderColor:s.border,padding:l.spacing.dashboardPadding},card:{background:s.card,foreground:s.cardForeground,borderColor:s.border,borderRadius:l.radius.card,padding:l.spacing.cardPadding,shadow:l.shadow.card},interactive:{toolbarBackground:s.background,background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control},chart:{palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground},table:F(s,l),aggregateTable:F(s,l),pivotTable:F(s,l),pagination:{background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control}};i.components={...T,...i.components};const $={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground};i.components.chart={...$,...i.components.chart},i.components.table={...F(s,l),...i.components.table},i.components.aggregateTable=y?{...F(s,l),...y}:P(i.components.table),i.components.pivotTable=j?{...F(s,l),...j}:P(i.components.table)}return r}function F(r,n){return{density:n.typography.density,container:{background:r.card,borderColor:r.border,borderRadius:n.radius.table,shadow:n.shadow.card},header:{background:r.muted,foreground:r.mutedForeground,dividerColor:r.border,fontWeight:600,uppercase:!0,sticky:!0},row:{height:32,dividerColor:r.border,zebra:!1,zebraBackground:r.muted,hoverBackground:r.accent,selectedBackground:r.accent},cell:{paddingX:n.spacing.tableCellX,paddingY:n.spacing.tableCellY,verticalAlign:"middle",wrap:"nowrap"},subtotal:{background:r.muted,foreground:r.foreground,fontWeight:600},grandTotal:{background:r.muted,foreground:r.foreground,fontWeight:700,borderColor:r.border},pagination:{background:r.card,foreground:r.foreground,borderColor:r.border}}}function P(r){return JSON.parse(JSON.stringify(r))}const ye=[["background","Canvas"],["foreground","Text"],["card","Card"],["cardForeground","Card text"],["primary","Primary"],["primaryForeground","Primary text"],["accent","Accent"],["accentForeground","Accent text"],["muted","Muted"],["mutedForeground","Muted text"],["border","Border"],["positive","Positive"],["negative","Negative"],["warning","Warning"],["info","Info"]],ke=[0,1,2,3,4,5],M=A.APPEARANCE_FONT_PRESETS,ve=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Ce({appearance:r,previewTitle:n,isLoading:t=!1,isSaving:u=!1,error:i=null,className:l,onDraftChange:s,onSave:y,onClearConfig:j,onCancel:N}){const[f,g]=m.useState(null),[w,T]=m.useState("light"),[$,z]=m.useState(!1),[ae,B]=m.useState("idle"),[X,ne]=m.useState(!1),[I,_]=m.useState(""),[D,x]=m.useState(null),Y=m.useRef(null),L=m.useRef(s),R=m.useRef(!1);m.useEffect(()=>{L.current=s},[s]),m.useEffect(()=>{if(r===void 0){R.current=!0,g(null);return}const o=O(r);R.current=!0,g(o),T("light"),x(null)},[r]),m.useEffect(()=>{var o;if(f){if(R.current){R.current=!1;return}try{const a=E(f);(o=L.current)==null||o.call(L,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[w],V=u||$,te=m.useMemo(()=>p?Te(p.tokens.radius.control):void 0,[p]),de=o=>{g(a=>{if(!a)return a;const h=Se(a);return o(h),h})},b=o=>{de(a=>{o(a.schemes[w])})},se=async()=>{if(!f||!y)return;let o;try{o=E(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}z(!0);try{await y(o)}finally{z(!1)}},ie=()=>{const o=O(null);B("idle"),g(o)},ce=async()=>{if(j){z(!0),x(null),B("idle");try{await j(),R.current=!0,g(O(null)),T("light")}catch(o){x(o instanceof Error?o.message:"Unable to clear organization appearance")}finally{z(!1)}}},Z=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),le=o=>{if(ne(o),o)try{_(Z()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},ue=async()=>{if(f)try{const o=X&&I?I:Z();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},K=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),T("light"),g(h),_(JSON.stringify(S,null,2))},pe=()=>{try{K(I)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},ge=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{K(await Fe(a))}catch(S){x(S instanceof Error?S.message:"Uploaded file must be a valid brand spec")}};return e.jsxs("div",{className:d.cn("flex min-h-0 flex-1 flex-col bg-background text-foreground",l),style:te,children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2",children:[e.jsx("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70",children:e.jsx(J.Palette,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-[13px] font-semibold leading-tight",children:"Brand Studio"}),e.jsxs("p",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:["Previewing ",n||"current dashboard"]})]}),e.jsxs(d.Popover,{open:X,onOpenChange:le,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(J.Braces,{className:"h-3.5 w-3.5"}),"Brand Spec"]})}),e.jsxs(d.PopoverContent,{align:"end",sideOffset:6,className:"z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[12px] font-medium",children:"Brand spec"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload your brand spec."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ue,children:[e.jsx(me,{className:"h-3.5 w-3.5"}),ae==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},children:[e.jsx(d.Upload,{className:"h-3.5 w-3.5"}),"Upload"]}),e.jsx(d.Button,{type:"button",size:"xs",onClick:pe,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(d.CodeEditor,{ariaLabel:"Brand spec",value:I,onValueChange:o=>{_(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Y,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:ge}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ie,disabled:!f,children:[e.jsx(re.RotateCcw,{className:"h-3.5 w-3.5"}),"Reset"]}),j&&e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ce,disabled:V,children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:se,disabled:!f||V||!!D||!y,children:[V?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be.Save,{className:"h-3.5 w-3.5"}),"Save"]}),N&&e.jsx("button",{type:"button","aria-label":"Close Brand Studio",className:"flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:N,children:e.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsx("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:D?e.jsxs(e.Fragment,{children:[e.jsx(d.SlidersHorizontal,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):e.jsxs(e.Fragment,{children:[e.jsx(d.Check,{className:"h-3.5 w-3.5 text-emerald-500"}),"Draft is applied to the live dashboard preview"]})}),e.jsx("div",{className:"inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70",children:["light","dark"].map(o=>e.jsx("button",{type:"button",className:d.cn("h-full px-2.5 text-[12px] capitalize transition-colors",w===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>T(o),children:o},o))})]}),D&&e.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:D}),t?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(d.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?e.jsx("div",{className:"p-4 text-[13px] text-muted-foreground",children:i}):f&&p?e.jsxs(d.Tabs,{defaultValue:"style",className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-3",children:e.jsxs(d.TabsList,{variant:"underline",className:"w-full gap-5",children:[e.jsx(d.TabsTrigger,{value:"style",children:"Style"}),e.jsx(d.TabsTrigger,{value:"surfaces",children:"Surfaces"}),e.jsx(d.TabsTrigger,{value:"data",children:"Data"})]})}),e.jsxs(d.ScrollArea,{className:"min-h-0 flex-1",children:[e.jsxs(d.TabsContent,{value:"style",className:"m-0 p-4",children:[e.jsx(v,{icon:J.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:W.map(o=>e.jsxs("button",{type:"button",className:"flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",onClick:()=>{const a=oe(f,o.id);g(a)},children:[e.jsxs("div",{className:"flex h-7 w-10 overflow-hidden rounded-control border border-border/70",children:[e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.primary}}),e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.accent}})]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.name}),e.jsx("span",{className:"block truncate text-[12px] text-muted-foreground",children:o.description})]})]},o.id))})}),e.jsx(v,{icon:J.Palette,title:"Color",description:`Editing the ${w} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(([o,a])=>e.jsx(k,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{ee(S,o,h)})},o))})}),e.jsxs(v,{icon:d.Type,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[e.jsx(Ne,{value:p.tokens.typography.fontFamily,onChange:o=>b(a=>{a.tokens.typography.fontFamily=o,a.tokens.typography.headingFontFamily=o})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(C,{label:"Base size",value:p.tokens.typography.baseFontSize,min:11,max:18,onChange:o=>b(a=>{a.tokens.typography.baseFontSize=o})}),e.jsx(G,{label:"Density",value:p.tokens.typography.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.tokens.typography.density=o,a.components.table.density=a.tokens.typography.density,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]}),e.jsxs(d.TabsContent,{value:"surfaces",className:"m-0 p-4",children:[e.jsxs(v,{icon:xe,title:"Layout",description:"Canvas, grid, and card rhythm for embedded dashboards.",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Canvas pad",tooltip:"Outer padding around the dashboard canvas before cards begin.",value:p.tokens.spacing.dashboardPadding,min:0,max:48,onChange:o=>b(a=>{a.tokens.spacing.dashboardPadding=o,a.components.dashboard.padding=o})}),e.jsx(C,{label:"Grid gap",tooltip:"Spacing between dashboard cards in the grid.",value:p.tokens.spacing.gridGap,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.gridGap=o})}),e.jsx(C,{label:"Card pad",tooltip:"Inner padding inside card/widget frames around titles, controls, and visual content.",value:p.tokens.spacing.cardPadding,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.cardPadding=o,a.components.card.padding=o})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Control radius",tooltip:"Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",value:p.tokens.radius.control,min:0,max:12,onChange:o=>b(a=>{U(a,"control",o)})}),e.jsx(C,{label:"Card/widget radius",tooltip:"Corner radius for dashboard card frames and widget containers.",value:p.tokens.radius.card,min:0,max:12,onChange:o=>b(a=>{U(a,"card",o)})}),e.jsx(C,{label:"Table radius",tooltip:"Corner radius for table containers, table chrome, and table pagination surfaces.",value:p.tokens.radius.table,min:0,max:12,onChange:o=>b(a=>{U(a,"table",o)})})]})]}),e.jsx(v,{icon:d.SlidersHorizontal,title:"Filters and Controls",description:"Dashboard filter/control toolbar, chip states, menus, and settings panels.",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Toolbar background",tooltip:"Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",value:p.components.interactive.toolbarBackground||p.tokens.color.background,onChange:o=>b(a=>{a.components.interactive.toolbarBackground=o})}),e.jsx(k,{label:"Default state",tooltip:"Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",value:p.components.interactive.background||p.tokens.color.card,onChange:o=>b(a=>{a.components.interactive.background=o,a.components.pagination.background=o})}),e.jsx(k,{label:"Border",tooltip:"Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",value:p.components.interactive.borderColor||p.tokens.color.border,onChange:o=>b(a=>{a.components.interactive.borderColor=o,a.components.pagination.borderColor=o})}),e.jsx(k,{label:"Selected state",tooltip:"Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",value:p.tokens.color.accent,onChange:o=>b(a=>{ee(a,"accent",o)})})]})})]}),e.jsxs(d.TabsContent,{value:"data",className:"m-0 p-4",children:[e.jsxs(v,{icon:d.ChartColumn,title:"Charts",description:"Palette and semantic chart text/grid colors.",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ke.map(o=>e.jsx(k,{label:`Series ${o+1}`,value:p.components.chart.palette[o]||"#000000",onChange:a=>b(h=>{h.components.chart.palette[o]=a})},o))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Grid",value:p.components.chart.gridColor,onChange:o=>b(a=>{a.components.chart.gridColor=o})}),e.jsx(k,{label:"Axis",value:p.components.chart.axisColor,onChange:o=>b(a=>{a.components.chart.axisColor=o})})]})]}),e.jsxs(v,{icon:d.Table2,title:"Tables",description:"Flat, aggregate, and pivot tables share this V1 table appearance.",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(G,{label:"Density",value:p.components.table.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.components.table.density=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(G,{label:"Cell wrap",value:p.components.table.cell.wrap,options:[["nowrap","No wrap"],["wrap","Wrap"]],onChange:o=>b(a=>{a.components.table.cell.wrap=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Header",value:p.components.table.header.background,onChange:o=>b(a=>{a.components.table.header.background=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(k,{label:"Divider",value:p.components.table.row.dividerColor,onChange:o=>b(a=>{a.components.table.row.dividerColor=o,a.components.table.header.dividerColor=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsx(H,{label:"Zebra rows",checked:p.components.table.row.zebra,onCheckedChange:o=>b(a=>{a.components.table.row.zebra=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Sticky headers",checked:p.components.table.header.sticky,onCheckedChange:o=>b(a=>{a.components.table.header.sticky=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Uppercase headers",checked:p.components.table.header.uppercase,onCheckedChange:o=>b(a=>{a.components.table.header.uppercase=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]})]}):null]})}function v({icon:r,title:n,description:t,children:u}){return e.jsxs("section",{className:"mb-6 last:mb-0",children:[e.jsxs("div",{className:"mb-3 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70",children:e.jsx(r,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[13px] font-semibold",children:n}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-4 text-muted-foreground",children:t})]})]}),e.jsx("div",{className:"space-y-2",children:u}),e.jsx(d.Separator,{className:"mt-5 bg-border/60"})]})}function Ne({value:r,onChange:n}){var u;const t=(u=M.find(i=>i.value===r))==null?void 0:u.id;return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:"Font family"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_150px] gap-2",children:[e.jsxs(d.Select,{value:t,onValueChange:i=>{const l=M.find(s=>s.id===i);l&&n(l.value)},children:[e.jsx(d.SelectTrigger,{size:"xs","aria-label":"Font family preset",children:e.jsx(d.SelectValue,{placeholder:"Select font"})}),e.jsx(d.SelectContent,{children:M.map(i=>e.jsx(d.SelectItem,{value:i.id,children:i.label},i.id))})]}),e.jsx("div",{className:"flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",style:{fontFamily:r},children:"Aa 123"})]})]})}function k({label:r,tooltip:n,value:t,onChange:u}){const[i,l]=m.useState(!1),[s,y]=m.useState(t),j=we(t),N=t!==s,f=g=>{l(g),g&&y(t)};return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-64",children:n})]})}):null]}),e.jsxs("div",{className:"flex h-7 items-center overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(d.Popover,{open:i,onOpenChange:f,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Open ${r} color picker`,className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",style:{backgroundColor:t},children:e.jsx("span",{className:"sr-only",children:r})})}),e.jsxs(d.PopoverContent,{align:"start",sideOffset:6,className:"z-[60] w-64 rounded-control p-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",style:{backgroundColor:t},children:[e.jsx("input",{"aria-label":`${r} native color picker`,type:"color",value:j,onChange:g=>u(g.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"}),e.jsx("span",{className:"rounded-control bg-black/45 p-1 text-white shadow-sm",children:e.jsx(he,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsx(d.Label,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Reset ${r} color to previous value`,disabled:!N,className:"inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",onClick:()=>u(s),children:e.jsx(re.RotateCcw,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",children:"Reset to previous value"})]})})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} popover color value`,value:t,onChange:g=>u(g.target.value),className:"font-mono"})]})]}),e.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1",children:ve.map(g=>e.jsx("button",{type:"button","aria-label":`Set ${r} to ${g}`,className:d.cn("h-6 rounded-control border border-border/70 shadow-sm",t.toLowerCase()===g&&"ring-2 ring-ring"),style:{backgroundColor:g},onClick:()=>u(g)},g))})]})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} color value`,value:t,onChange:g=>u(g.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]})}function we(r){const n=A.parseAppearanceColor(r);return n?`#${q(n.r)}${q(n.g)}${q(n.b)}`:"#000000"}function q(r){return Math.round(r).toString(16).padStart(2,"0")}function C({label:r,tooltip:n,value:t,min:u,max:i,onChange:l}){const s=m.useId();return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{htmlFor:s,className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-56",children:n})]})}):null]}),e.jsx(d.Input,{id:s,size:"xs",type:"number",min:u,max:i,value:t,onChange:y=>{const j=Number(y.target.value);Number.isNaN(j)||l(j)}})]})}function G({label:r,value:n,options:t,onChange:u}){return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:r}),e.jsxs(d.Select,{value:n,onValueChange:u,children:[e.jsx(d.SelectTrigger,{size:"xs",children:e.jsx(d.SelectValue,{})}),e.jsx(d.SelectContent,{children:t.map(([i,l])=>e.jsx(d.SelectItem,{value:i,children:l},i))})]})]})}function H({label:r,checked:n,onCheckedChange:t}){return e.jsxs("div",{className:"flex h-8 items-center justify-between rounded-control border border-border/60 px-2",children:[e.jsx("span",{className:"text-[12px]",children:r}),e.jsx(d.Switch,{size:"xs",checked:n,onCheckedChange:t})]})}function Te(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Se(r){return JSON.parse(JSON.stringify(r))}function Fe(r){return typeof r.text=="function"?r.text():new Promise((n,t)=>{const u=new FileReader;u.onload=()=>n(String(u.result??"")),u.onerror=()=>t(u.error??new Error("Unable to read file")),u.readAsText(r)})}exports.BRAND_STUDIO_PRESETS=W;exports.BrandStudioEditor=Ce;exports.applyBrandStudioPreset=oe;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;
|
|
21
|
+
*/const he=d.createLucideIcon("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]),W=[{id:"semaphor",name:"Semaphor",description:"Dense neutral system defaults for embedded analytics.",primary:"#18181b",accent:"#f4f4f5",light:{background:"#ffffff",foreground:"#18181b",muted:"#fafafa",mutedForeground:"#71717a",border:"#e4e4e7",primary:"#18181b",primaryForeground:"#ffffff",accent:"#f4f4f5",accentForeground:"#18181b",card:"#ffffff",cardForeground:"#18181b",chartPalette:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"]},dark:{background:"#09090b",foreground:"#fafafa",muted:"#18181b",mutedForeground:"#a1a1aa",border:"#27272a",primary:"#fafafa",primaryForeground:"#09090b",accent:"#27272a",accentForeground:"#fafafa",card:"#09090b",cardForeground:"#fafafa",chartPalette:["#60a5fa","#34d399","#fbbf24","#f87171","#a78bfa","#22d3ee"]}},{id:"atlas-blue",name:"Atlas Blue",description:"Crisp enterprise blue with restrained neutral surfaces.",primary:"#2563eb",accent:"#dbeafe",light:{background:"#f8fafc",foreground:"#0f172a",muted:"#f1f5f9",mutedForeground:"#64748b",border:"#cbd5e1",primary:"#2563eb",primaryForeground:"#ffffff",accent:"#dbeafe",accentForeground:"#1e3a8a",card:"#ffffff",cardForeground:"#0f172a",chartPalette:["#2563eb","#0f766e","#ca8a04","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#020617",foreground:"#e2e8f0",muted:"#0f172a",mutedForeground:"#94a3b8",border:"#1e293b",primary:"#60a5fa",primaryForeground:"#020617",accent:"#1e3a8a",accentForeground:"#dbeafe",card:"#0f172a",cardForeground:"#e2e8f0",chartPalette:["#60a5fa","#2dd4bf","#facc15","#f87171","#a78bfa","#22d3ee"]}},{id:"field-green",name:"Field Green",description:"Operational green accents with quiet, readable canvases.",primary:"#047857",accent:"#d1fae5",light:{background:"#fbfdfb",foreground:"#10231d",muted:"#f1f5f3",mutedForeground:"#64746d",border:"#d7ded9",primary:"#047857",primaryForeground:"#ffffff",accent:"#d1fae5",accentForeground:"#064e3b",card:"#ffffff",cardForeground:"#10231d",chartPalette:["#047857","#2563eb","#d97706","#dc2626","#7c3aed","#0891b2"]},dark:{background:"#071511",foreground:"#e7f4ef",muted:"#10231d",mutedForeground:"#92aaa1",border:"#244139",primary:"#34d399",primaryForeground:"#071511",accent:"#064e3b",accentForeground:"#d1fae5",card:"#0b1d17",cardForeground:"#e7f4ef",chartPalette:["#34d399","#60a5fa","#fbbf24","#f87171","#a78bfa","#22d3ee"]}}];function O(r){const n=A.resolveAppearance({organizationAppearance:r??void 0});return je(P(n))}function E(r){const n=P({version:A.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=A.validateAppearanceSpec(n);if(!t.success){const u=t.issues[0];throw new Error(`Invalid Brand Studio appearance at ${u.path}: ${u.message}`)}return t.value}function re(r,n){const t=W.find(i=>i.id===n);if(!t)return r;const u=P(r);return Q(u.schemes.light,t.light),Q(u.schemes.dark,t.dark),u}function Q(r,n){r.tokens.color.background=n.background,r.tokens.color.foreground=n.foreground,r.tokens.color.muted=n.muted,r.tokens.color.mutedForeground=n.mutedForeground,r.tokens.color.border=n.border,r.tokens.color.input=n.border,r.tokens.color.primary=n.primary,r.tokens.color.primaryForeground=n.primaryForeground,r.tokens.color.accent=n.accent,r.tokens.color.accentForeground=n.accentForeground,r.tokens.color.card=n.card,r.tokens.color.cardForeground=n.cardForeground,r.components.dashboard.background=n.background,r.components.dashboard.foreground=n.foreground,r.components.dashboard.borderColor=n.border,r.components.card.background=n.card,r.components.card.foreground=n.cardForeground,r.components.card.borderColor=n.border,r.components.interactive.toolbarBackground=n.background,r.components.interactive.background=n.card,r.components.interactive.foreground=n.foreground,r.components.interactive.borderColor=n.border,r.components.chart.palette=[...n.chartPalette],r.components.chart.background=n.card,r.components.chart.foreground=n.foreground,r.components.chart.gridColor=n.border,r.components.chart.axisColor=n.mutedForeground,r.components.table.container.background=n.card,r.components.table.container.borderColor=n.border,r.components.table.header.background=n.muted,r.components.table.header.foreground=n.mutedForeground,r.components.table.header.dividerColor=n.border,r.components.table.row.dividerColor=n.border,r.components.table.row.zebraBackground=n.muted,r.components.table.pagination.background=n.card,r.components.table.pagination.foreground=n.foreground,r.components.table.pagination.borderColor=n.border,c(r,"aggregateTable"),c(r,"pivotTable")}function c(r,n){r.components[n]=P(r.components.table)}function ee(r,n,t){switch(r.tokens.color[n]=t,n){case"background":r.components.dashboard.background=t,r.components.interactive.toolbarBackground=t;break;case"foreground":r.components.dashboard.foreground=t,r.components.interactive.foreground=t,r.components.pagination.foreground=t,r.components.chart.foreground=t,r.components.table.pagination.foreground=t,r.components.table.subtotal.foreground=t,r.components.table.grandTotal.foreground=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"card":r.components.card.background=t,r.components.interactive.background=t,r.components.pagination.background=t,r.components.chart.background=t,r.components.table.container.background=t,r.components.table.pagination.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"cardForeground":r.components.card.foreground=t;break;case"muted":r.components.table.header.background=t,r.components.table.row.zebraBackground=t,r.components.table.subtotal.background=t,r.components.table.grandTotal.background=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"mutedForeground":r.components.table.header.foreground=t,r.components.chart.axisColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"border":r.tokens.color.input=t,r.components.dashboard.borderColor=t,r.components.card.borderColor=t,r.components.interactive.borderColor=t,r.components.pagination.borderColor=t,r.components.chart.gridColor=t,r.components.table.container.borderColor=t,r.components.table.header.dividerColor=t,r.components.table.row.dividerColor=t,r.components.table.grandTotal.borderColor=t,r.components.table.pagination.borderColor=t,c(r,"aggregateTable"),c(r,"pivotTable");break;case"accent":r.components.table.row.hoverBackground=t,r.components.table.row.selectedBackground=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function U(r,n,t){switch(r.tokens.radius[n]=t,n){case"control":r.components.interactive.borderRadius=t,r.components.pagination.borderRadius=t;break;case"card":r.components.card.borderRadius=t;break;case"table":r.components.table.container.borderRadius=t,c(r,"aggregateTable"),c(r,"pivotTable");break}}function je(r){var n,t;for(const u of["light","dark"]){const i=r.schemes[u],l=i.tokens,s=l.color,y=(n=i.components)==null?void 0:n.aggregateTable,j=(t=i.components)==null?void 0:t.pivotTable,N={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};l.typography={...N,...l.typography};const f={control:5,card:5,table:5,badge:999};l.radius={...f,...l.radius};const g={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};l.spacing={...g,...l.spacing};const w={card:"none",popover:"0 12px 32px rgba(15, 23, 42, 0.14)",focusRing:"0 0 0 2px rgba(37, 99, 235, 0.35)"};l.shadow={...w,...l.shadow};const T={dashboard:{background:s.background,foreground:s.foreground,borderColor:s.border,padding:l.spacing.dashboardPadding},card:{background:s.card,foreground:s.cardForeground,borderColor:s.border,borderRadius:l.radius.card,padding:l.spacing.cardPadding,shadow:l.shadow.card},interactive:{toolbarBackground:s.background,background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control},chart:{palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground},table:F(s,l),aggregateTable:F(s,l),pivotTable:F(s,l),pagination:{background:s.card,foreground:s.foreground,borderColor:s.border,borderRadius:l.radius.control}};i.components={...T,...i.components};const J={palette:[],background:s.card,foreground:s.foreground,gridColor:s.border,axisColor:s.mutedForeground};i.components.chart={...J,...i.components.chart},i.components.table={...F(s,l),...i.components.table},i.components.aggregateTable=y?{...F(s,l),...y}:P(i.components.table),i.components.pivotTable=j?{...F(s,l),...j}:P(i.components.table)}return r}function F(r,n){return{density:n.typography.density,container:{background:r.card,borderColor:r.border,borderRadius:n.radius.table,shadow:n.shadow.card},header:{background:r.muted,foreground:r.mutedForeground,dividerColor:r.border,fontWeight:600,uppercase:!0,sticky:!0},row:{height:32,dividerColor:r.border,zebra:!1,zebraBackground:r.muted,hoverBackground:r.accent,selectedBackground:r.accent},cell:{paddingX:n.spacing.tableCellX,paddingY:n.spacing.tableCellY,verticalAlign:"middle",wrap:"nowrap"},subtotal:{background:r.muted,foreground:r.foreground,fontWeight:600},grandTotal:{background:r.muted,foreground:r.foreground,fontWeight:700,borderColor:r.border},pagination:{background:r.card,foreground:r.foreground,borderColor:r.border}}}function P(r){return JSON.parse(JSON.stringify(r))}const ye=[["background","Canvas"],["foreground","Text"],["card","Card"],["cardForeground","Card text"],["primary","Primary"],["primaryForeground","Primary text"],["accent","Accent"],["accentForeground","Accent text"],["muted","Muted"],["mutedForeground","Muted text"],["border","Border"],["positive","Positive"],["negative","Negative"],["warning","Warning"],["info","Info"]],ke=[0,1,2,3,4,5],M=A.APPEARANCE_FONT_PRESETS,ve=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function Ce({appearance:r,previewTitle:n,isLoading:t=!1,isSaving:u=!1,error:i=null,className:l,onDraftChange:s,onSave:y,onClearConfig:j,onCancel:N}){const[f,g]=m.useState(null),[w,T]=m.useState("light"),[J,z]=m.useState(!1),[oe,B]=m.useState("idle"),[X,ae]=m.useState(!1),[I,$]=m.useState(""),[D,x]=m.useState(null),Y=m.useRef(null),L=m.useRef(s),R=m.useRef(!1);m.useEffect(()=>{L.current=s},[s]),m.useEffect(()=>{if(r===void 0){R.current=!0,g(null);return}const o=O(r);R.current=!0,g(o),T("light"),x(null)},[r]),m.useEffect(()=>{var o;if(f){if(R.current){R.current=!1;return}try{const a=E(f);(o=L.current)==null||o.call(L,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[w],_=u||J,ne=m.useMemo(()=>p?Te(p.tokens.radius.control):void 0,[p]),te=o=>{g(a=>{if(!a)return a;const h=Se(a);return o(h),h})},b=o=>{te(a=>{o(a.schemes[w])})},de=async()=>{if(!f||!y)return;let o;try{o=E(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}z(!0);try{await y(o)}finally{z(!1)}},se=()=>{const o=O(null);B("idle"),g(o)},ie=async()=>{if(j){z(!0),x(null),B("idle");try{await j(),R.current=!0,g(O(null)),T("light")}catch(o){x(o instanceof Error?o.message:"Unable to clear organization appearance")}finally{z(!1)}}},Z=m.useCallback(()=>f?JSON.stringify(E(f),null,2):"",[f]),ce=o=>{if(ae(o),o)try{$(Z()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},le=async()=>{if(f)try{const o=X&&I?I:Z();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy brand spec")}},K=o=>{const a=JSON.parse(o),h=O(a),S=E(h);B("idle"),T("light"),g(h),$(JSON.stringify(S,null,2))},ue=()=>{try{K(I)}catch(o){x(o instanceof Error?o.message:"Brand spec must be valid JSON")}},pe=async o=>{var h;const a=(h=o.target.files)==null?void 0:h[0];if(o.target.value="",!!a)try{K(await Fe(a))}catch(S){x(S instanceof Error?S.message:"Uploaded file must be a valid brand spec")}};return e.jsxs("div",{className:d.cn("flex min-h-0 flex-1 flex-col bg-background text-foreground",l),style:ne,children:[e.jsxs("header",{className:"flex h-11 shrink-0 items-start gap-3 border-b border-border/60 px-4 pt-2",children:[e.jsx("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-control border border-border/70",children:e.jsx(V.Palette,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-[13px] font-semibold leading-tight",children:"Brand Studio"}),e.jsxs("p",{className:"truncate text-[11px] leading-tight text-muted-foreground",children:["Previewing ",n||"current dashboard"]})]}),e.jsxs(d.Popover,{open:X,onOpenChange:ce,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(ge.Braces,{className:"h-3.5 w-3.5"}),"Brand Spec"]})}),e.jsxs(d.PopoverContent,{align:"end",sideOffset:6,className:"z-[60] w-[min(520px,calc(100vw-24px))] rounded-control p-2",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[12px] font-medium",children:"Brand spec"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload your brand spec."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:le,children:[e.jsx(me,{className:"h-3.5 w-3.5"}),oe==="copied"?"Copied":"Copy"]}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},children:[e.jsx(d.Upload,{className:"h-3.5 w-3.5"}),"Upload"]}),e.jsx(d.Button,{type:"button",size:"xs",onClick:ue,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(d.CodeEditor,{ariaLabel:"Brand spec",value:I,onValueChange:o=>{$(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Y,"aria-label":"Upload brand spec",type:"file",accept:"application/json,.json",className:"sr-only",onChange:pe}),e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:se,disabled:!f,children:[e.jsx(d.RotateCcw,{className:"h-3.5 w-3.5"}),"Reset"]}),j&&e.jsxs(d.Button,{type:"button",size:"xs",variant:"ghost",onClick:ie,disabled:_,children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(d.Button,{type:"button",size:"xs",onClick:de,disabled:!f||_||!!D||!y,children:[_?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(be.Save,{className:"h-3.5 w-3.5"}),"Save"]}),N&&e.jsx("button",{type:"button","aria-label":"Close Brand Studio",className:"flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:N,children:e.jsx(d.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsx("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:D?e.jsxs(e.Fragment,{children:[e.jsx(d.SlidersHorizontal,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):e.jsxs(e.Fragment,{children:[e.jsx(d.Check,{className:"h-3.5 w-3.5 text-emerald-500"}),"Draft is applied to the live dashboard preview"]})}),e.jsx("div",{className:"inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70",children:["light","dark"].map(o=>e.jsx("button",{type:"button",className:d.cn("h-full px-2.5 text-[12px] capitalize transition-colors",w===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>T(o),children:o},o))})]}),D&&e.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:D}),t?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(d.LoaderCircle,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):i?e.jsx("div",{className:"p-4 text-[13px] text-muted-foreground",children:i}):f&&p?e.jsxs(d.Tabs,{defaultValue:"style",className:"flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{className:"shrink-0 px-4 pt-3",children:e.jsxs(d.TabsList,{variant:"underline",className:"w-full gap-5",children:[e.jsx(d.TabsTrigger,{value:"style",children:"Style"}),e.jsx(d.TabsTrigger,{value:"surfaces",children:"Surfaces"}),e.jsx(d.TabsTrigger,{value:"data",children:"Data"})]})}),e.jsxs(d.ScrollArea,{className:"min-h-0 flex-1",children:[e.jsxs(d.TabsContent,{value:"style",className:"m-0 p-4",children:[e.jsx(v,{icon:V.Palette,title:"Presets",description:"Start from a full light and dark appearance.",children:e.jsx("div",{className:"grid grid-cols-1 gap-2",children:W.map(o=>e.jsxs("button",{type:"button",className:"flex items-center gap-3 rounded-control border border-border/70 px-3 py-2 text-left hover:bg-muted/60",onClick:()=>{const a=re(f,o.id);g(a)},children:[e.jsxs("div",{className:"flex h-7 w-10 overflow-hidden rounded-control border border-border/70",children:[e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.primary}}),e.jsx("span",{className:"h-full flex-1",style:{backgroundColor:o.accent}})]}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.name}),e.jsx("span",{className:"block truncate text-[12px] text-muted-foreground",children:o.description})]})]},o.id))})}),e.jsx(v,{icon:V.Palette,title:"Color",description:`Editing the ${w} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ye.map(([o,a])=>e.jsx(k,{label:a,value:p.tokens.color[o],onChange:h=>b(S=>{ee(S,o,h)})},o))})}),e.jsxs(v,{icon:d.Type,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[e.jsx(Ne,{value:p.tokens.typography.fontFamily,onChange:o=>b(a=>{a.tokens.typography.fontFamily=o,a.tokens.typography.headingFontFamily=o})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(C,{label:"Base size",value:p.tokens.typography.baseFontSize,min:11,max:18,onChange:o=>b(a=>{a.tokens.typography.baseFontSize=o})}),e.jsx(G,{label:"Density",value:p.tokens.typography.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.tokens.typography.density=o,a.components.table.density=a.tokens.typography.density,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]}),e.jsxs(d.TabsContent,{value:"surfaces",className:"m-0 p-4",children:[e.jsxs(v,{icon:xe,title:"Layout",description:"Canvas, grid, and card rhythm for embedded dashboards.",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Canvas pad",tooltip:"Outer padding around the dashboard canvas before cards begin.",value:p.tokens.spacing.dashboardPadding,min:0,max:48,onChange:o=>b(a=>{a.tokens.spacing.dashboardPadding=o,a.components.dashboard.padding=o})}),e.jsx(C,{label:"Grid gap",tooltip:"Spacing between dashboard cards in the grid.",value:p.tokens.spacing.gridGap,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.gridGap=o})}),e.jsx(C,{label:"Card pad",tooltip:"Inner padding inside card/widget frames around titles, controls, and visual content.",value:p.tokens.spacing.cardPadding,min:0,max:32,onChange:o=>b(a=>{a.tokens.spacing.cardPadding=o,a.components.card.padding=o})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(C,{label:"Control radius",tooltip:"Corner radius for buttons, inputs, selects, checkboxes, segmented controls, and similar interactive controls.",value:p.tokens.radius.control,min:0,max:12,onChange:o=>b(a=>{U(a,"control",o)})}),e.jsx(C,{label:"Card/widget radius",tooltip:"Corner radius for dashboard card frames and widget containers.",value:p.tokens.radius.card,min:0,max:12,onChange:o=>b(a=>{U(a,"card",o)})}),e.jsx(C,{label:"Table radius",tooltip:"Corner radius for table containers, table chrome, and table pagination surfaces.",value:p.tokens.radius.table,min:0,max:12,onChange:o=>b(a=>{U(a,"table",o)})})]})]}),e.jsx(v,{icon:d.SlidersHorizontal,title:"Filters and Controls",description:"Dashboard filter/control toolbar, chip states, menus, and settings panels.",children:e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Toolbar background",tooltip:"Background color for the dashboard filter/control toolbar strip. This is separate from chip state colors.",value:p.components.interactive.toolbarBackground||p.tokens.color.background,onChange:o=>b(a=>{a.components.interactive.toolbarBackground=o})}),e.jsx(k,{label:"Default state",tooltip:"Unselected filter/control chips plus the base surface for their menus, dialogs, and pagination fallback.",value:p.components.interactive.background||p.tokens.color.card,onChange:o=>b(a=>{a.components.interactive.background=o,a.components.pagination.background=o})}),e.jsx(k,{label:"Border",tooltip:"Border color for filter/control chips, runtime inputs, settings panels, and related popover chrome.",value:p.components.interactive.borderColor||p.tokens.color.border,onChange:o=>b(a=>{a.components.interactive.borderColor=o,a.components.pagination.borderColor=o})}),e.jsx(k,{label:"Selected state",tooltip:"Selected filter/control chips and hover feedback. This keeps a lighter default state and a stronger selected state.",value:p.tokens.color.accent,onChange:o=>b(a=>{ee(a,"accent",o)})})]})})]}),e.jsxs(d.TabsContent,{value:"data",className:"m-0 p-4",children:[e.jsxs(v,{icon:d.ChartColumn,title:"Charts",description:"Palette and semantic chart text/grid colors.",children:[e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ke.map(o=>e.jsx(k,{label:`Series ${o+1}`,value:p.components.chart.palette[o]||"#000000",onChange:a=>b(h=>{h.components.chart.palette[o]=a})},o))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Grid",value:p.components.chart.gridColor,onChange:o=>b(a=>{a.components.chart.gridColor=o})}),e.jsx(k,{label:"Axis",value:p.components.chart.axisColor,onChange:o=>b(a=>{a.components.chart.axisColor=o})})]})]}),e.jsxs(v,{icon:d.Table2,title:"Tables",description:"Flat, aggregate, and pivot tables share this V1 table appearance.",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(G,{label:"Density",value:p.components.table.density,options:[["compact","Compact"],["comfortable","Comfortable"],["spacious","Spacious"]],onChange:o=>b(a=>{a.components.table.density=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(G,{label:"Cell wrap",value:p.components.table.cell.wrap,options:[["nowrap","No wrap"],["wrap","Wrap"]],onChange:o=>b(a=>{a.components.table.cell.wrap=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(k,{label:"Header",value:p.components.table.header.background,onChange:o=>b(a=>{a.components.table.header.background=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(k,{label:"Divider",value:p.components.table.row.dividerColor,onChange:o=>b(a=>{a.components.table.row.dividerColor=o,a.components.table.header.dividerColor=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]}),e.jsx(H,{label:"Zebra rows",checked:p.components.table.row.zebra,onCheckedChange:o=>b(a=>{a.components.table.row.zebra=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Sticky headers",checked:p.components.table.header.sticky,onCheckedChange:o=>b(a=>{a.components.table.header.sticky=o,c(a,"aggregateTable"),c(a,"pivotTable")})}),e.jsx(H,{label:"Uppercase headers",checked:p.components.table.header.uppercase,onCheckedChange:o=>b(a=>{a.components.table.header.uppercase=o,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]})]}):null]})}function v({icon:r,title:n,description:t,children:u}){return e.jsxs("section",{className:"mb-6 last:mb-0",children:[e.jsxs("div",{className:"mb-3 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 flex h-5 w-5 items-center justify-center rounded-control border border-border/70",children:e.jsx(r,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-[13px] font-semibold",children:n}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-4 text-muted-foreground",children:t})]})]}),e.jsx("div",{className:"space-y-2",children:u}),e.jsx(d.Separator,{className:"mt-5 bg-border/60"})]})}function Ne({value:r,onChange:n}){var u;const t=(u=M.find(i=>i.value===r))==null?void 0:u.id;return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:"Font family"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_150px] gap-2",children:[e.jsxs(d.Select,{value:t,onValueChange:i=>{const l=M.find(s=>s.id===i);l&&n(l.value)},children:[e.jsx(d.SelectTrigger,{size:"xs","aria-label":"Font family preset",children:e.jsx(d.SelectValue,{placeholder:"Select font"})}),e.jsx(d.SelectContent,{children:M.map(i=>e.jsx(d.SelectItem,{value:i.id,children:i.label},i.id))})]}),e.jsx("div",{className:"flex h-7 items-center rounded-control border border-border/60 bg-muted/30 px-2 text-[12px]",style:{fontFamily:r},children:"Aa 123"})]})]})}function k({label:r,tooltip:n,value:t,onChange:u}){const[i,l]=m.useState(!1),[s,y]=m.useState(t),j=we(t),N=t!==s,f=g=>{l(g),g&&y(t)};return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-64",children:n})]})}):null]}),e.jsxs("div",{className:"flex h-7 items-center overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(d.Popover,{open:i,onOpenChange:f,children:[e.jsx(d.PopoverTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Open ${r} color picker`,className:"ml-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-control border border-border/70",style:{backgroundColor:t},children:e.jsx("span",{className:"sr-only",children:r})})}),e.jsxs(d.PopoverContent,{align:"start",sideOffset:6,className:"z-[60] w-64 rounded-control p-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"relative flex h-16 w-16 shrink-0 cursor-pointer items-center justify-center overflow-hidden rounded-control border border-border/70",style:{backgroundColor:t},children:[e.jsx("input",{"aria-label":`${r} native color picker`,type:"color",value:j,onChange:g=>u(g.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"}),e.jsx("span",{className:"rounded-control bg-black/45 p-1 text-white shadow-sm",children:e.jsx(he,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsx(d.Label,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Reset ${r} color to previous value`,disabled:!N,className:"inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",onClick:()=>u(s),children:e.jsx(d.RotateCcw,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",children:"Reset to previous value"})]})})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} popover color value`,value:t,onChange:g=>u(g.target.value),className:"font-mono"})]})]}),e.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1",children:ve.map(g=>e.jsx("button",{type:"button","aria-label":`Set ${r} to ${g}`,className:d.cn("h-6 rounded-control border border-border/70 shadow-sm",t.toLowerCase()===g&&"ring-2 ring-ring"),style:{backgroundColor:g},onClick:()=>u(g)},g))})]})]}),e.jsx(d.Input,{size:"xs","aria-label":`${r} color value`,value:t,onChange:g=>u(g.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]})}function we(r){const n=A.parseAppearanceColor(r);return n?`#${q(n.r)}${q(n.g)}${q(n.b)}`:"#000000"}function q(r){return Math.round(r).toString(16).padStart(2,"0")}function C({label:r,tooltip:n,value:t,min:u,max:i,onChange:l}){const s=m.useId();return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(d.Label,{htmlFor:s,className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`${r} details`,className:"inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(d.Info,{className:"h-3 w-3"})})}),e.jsx(d.TooltipContent,{side:"top",className:"max-w-56",children:n})]})}):null]}),e.jsx(d.Input,{id:s,size:"xs",type:"number",min:u,max:i,value:t,onChange:y=>{const j=Number(y.target.value);Number.isNaN(j)||l(j)}})]})}function G({label:r,value:n,options:t,onChange:u}){return e.jsxs("div",{children:[e.jsx(d.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:r}),e.jsxs(d.Select,{value:n,onValueChange:u,children:[e.jsx(d.SelectTrigger,{size:"xs",children:e.jsx(d.SelectValue,{})}),e.jsx(d.SelectContent,{children:t.map(([i,l])=>e.jsx(d.SelectItem,{value:i,children:l},i))})]})]})}function H({label:r,checked:n,onCheckedChange:t}){return e.jsxs("div",{className:"flex h-8 items-center justify-between rounded-control border border-border/60 px-2",children:[e.jsx("span",{className:"text-[12px]",children:r}),e.jsx(d.Switch,{size:"xs",checked:n,onCheckedChange:t})]})}function Te(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Se(r){return JSON.parse(JSON.stringify(r))}function Fe(r){return typeof r.text=="function"?r.text():new Promise((n,t)=>{const u=new FileReader;u.onload=()=>n(String(u.result??"")),u.onerror=()=>t(u.error??new Error("Unable to read file")),u.readAsText(r)})}exports.BRAND_STUDIO_PRESETS=W;exports.BrandStudioEditor=Ce;exports.applyBrandStudioPreset=re;exports.buildAppearanceSpecFromDraft=E;exports.createBrandStudioDraft=O;exports.mirrorTableAppearance=c;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as d, jsx as r, Fragment as ce } from "react/jsx-runtime";
|
|
2
2
|
import m from "react";
|
|
3
|
-
import { c as $, a as K, P as ge, b as be, B as C, d as fe, U as De, C as Ie, f as le, X as je, p as se, e as Je, T as Le, q as $e, r as G, s as _e, t as M, v as Ue, w as Ve, x as Ge, y as Me, L as E, z as Q, A as ee, D as re, E as
|
|
3
|
+
import { c as $, a as K, P as ge, b as be, B as C, d as fe, U as De, C as Ie, R as me, f as le, X as je, p as se, e as Je, T as Le, q as $e, r as G, s as _e, t as M, v as Ue, w as Ve, x as Ge, y as Me, L as E, z as Q, A as ee, D as re, E as he, F as oe, I as ae, g as xe, h as ye, i as ke, j as ve, k as Ce, S as We } from "../chunks/switch-BuZXNXQV.js";
|
|
4
4
|
import { r as He, v as Xe, A as Ye, a as qe, p as Ze } from "../chunks/index-CJdxSyQq.js";
|
|
5
|
-
import { P as W
|
|
6
|
-
import {
|
|
7
|
-
import { S as Qe } from "../chunks/save-
|
|
5
|
+
import { P as W } from "../chunks/palette-DFjOzeAG.js";
|
|
6
|
+
import { B as Ke } from "../chunks/braces-DZxcgUvn.js";
|
|
7
|
+
import { S as Qe } from "../chunks/save-QktcpXPy.js";
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.453.0 - ISC
|
|
10
10
|
*
|
|
@@ -699,7 +699,7 @@ function vr({
|
|
|
699
699
|
onClick: Be,
|
|
700
700
|
disabled: !f,
|
|
701
701
|
children: [
|
|
702
|
-
/* @__PURE__ */ r(
|
|
702
|
+
/* @__PURE__ */ r(me, { className: "h-3.5 w-3.5" }),
|
|
703
703
|
"Reset"
|
|
704
704
|
]
|
|
705
705
|
}
|
|
@@ -1203,7 +1203,7 @@ function lr({
|
|
|
1203
1203
|
/* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: "Font family" }),
|
|
1204
1204
|
/* @__PURE__ */ d("div", { className: "grid grid-cols-[minmax(0,1fr)_150px] gap-2", children: [
|
|
1205
1205
|
/* @__PURE__ */ d(
|
|
1206
|
-
|
|
1206
|
+
xe,
|
|
1207
1207
|
{
|
|
1208
1208
|
value: t,
|
|
1209
1209
|
onValueChange: (c) => {
|
|
@@ -1213,8 +1213,8 @@ function lr({
|
|
|
1213
1213
|
l && n(l.value);
|
|
1214
1214
|
},
|
|
1215
1215
|
children: [
|
|
1216
|
-
/* @__PURE__ */ r(
|
|
1217
|
-
/* @__PURE__ */ r(
|
|
1216
|
+
/* @__PURE__ */ r(ye, { size: "xs", "aria-label": "Font family preset", children: /* @__PURE__ */ r(ke, { placeholder: "Select font" }) }),
|
|
1217
|
+
/* @__PURE__ */ r(ve, { children: X.map((c) => /* @__PURE__ */ r(Ce, { value: c.id, children: c.label }, c.id)) })
|
|
1218
1218
|
]
|
|
1219
1219
|
}
|
|
1220
1220
|
),
|
|
@@ -1248,7 +1248,7 @@ function v({
|
|
|
1248
1248
|
type: "button",
|
|
1249
1249
|
"aria-label": `${e} details`,
|
|
1250
1250
|
className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
|
|
1251
|
-
children: /* @__PURE__ */ r(
|
|
1251
|
+
children: /* @__PURE__ */ r(he, { className: "h-3 w-3" })
|
|
1252
1252
|
}
|
|
1253
1253
|
) }),
|
|
1254
1254
|
/* @__PURE__ */ r(oe, { side: "top", className: "max-w-64", children: n })
|
|
@@ -1306,7 +1306,7 @@ function v({
|
|
|
1306
1306
|
disabled: !S,
|
|
1307
1307
|
className: "inline-flex h-5 w-5 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-35",
|
|
1308
1308
|
onClick: () => u(i),
|
|
1309
|
-
children: /* @__PURE__ */ r(
|
|
1309
|
+
children: /* @__PURE__ */ r(me, { className: "h-3 w-3" })
|
|
1310
1310
|
}
|
|
1311
1311
|
) }),
|
|
1312
1312
|
/* @__PURE__ */ r(oe, { side: "top", children: "Reset to previous value" })
|
|
@@ -1388,7 +1388,7 @@ function w({
|
|
|
1388
1388
|
type: "button",
|
|
1389
1389
|
"aria-label": `${e} details`,
|
|
1390
1390
|
className: "inline-flex h-3.5 w-3.5 items-center justify-center rounded-control text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground",
|
|
1391
|
-
children: /* @__PURE__ */ r(
|
|
1391
|
+
children: /* @__PURE__ */ r(he, { className: "h-3 w-3" })
|
|
1392
1392
|
}
|
|
1393
1393
|
) }),
|
|
1394
1394
|
/* @__PURE__ */ r(oe, { side: "top", className: "max-w-56", children: n })
|
|
@@ -1419,9 +1419,9 @@ function q({
|
|
|
1419
1419
|
}) {
|
|
1420
1420
|
return /* @__PURE__ */ d("div", { children: [
|
|
1421
1421
|
/* @__PURE__ */ r(E, { className: "mb-1 block text-[11px] font-normal text-muted-foreground", children: e }),
|
|
1422
|
-
/* @__PURE__ */ d(
|
|
1423
|
-
/* @__PURE__ */ r(
|
|
1424
|
-
/* @__PURE__ */ r(
|
|
1422
|
+
/* @__PURE__ */ d(xe, { value: n, onValueChange: u, children: [
|
|
1423
|
+
/* @__PURE__ */ r(ye, { size: "xs", children: /* @__PURE__ */ r(ke, {}) }),
|
|
1424
|
+
/* @__PURE__ */ r(ve, { children: t.map(([c, l]) => /* @__PURE__ */ r(Ce, { value: c, children: l }, c)) })
|
|
1425
1425
|
] })
|
|
1426
1426
|
] });
|
|
1427
1427
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";const e=require("./switch-B72T1Hf_.js");/**
|
|
2
|
+
* @license lucide-react v0.453.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const a=e.createLucideIcon("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);exports.Braces=a;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { c as a } from "./switch-BuZXNXQV.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v0.453.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const c = a("Braces", [
|
|
9
|
+
[
|
|
10
|
+
"path",
|
|
11
|
+
{ d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"path",
|
|
15
|
+
{
|
|
16
|
+
d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",
|
|
17
|
+
key: "e1hn23"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
]);
|
|
21
|
+
export {
|
|
22
|
+
c as B
|
|
23
|
+
};
|