react-semaphor 0.1.302 → 0.1.304
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/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/brand-studio/index.cjs +5 -5
- package/dist/brand-studio/index.js +334 -385
- package/dist/chunks/common-types-C6cAQgyh.js +9 -0
- package/dist/chunks/common-types-nBuCd3u2.js +1 -0
- package/dist/chunks/{dashboard-controls-CZuC_QjN.js → dashboard-controls-CyFZfGaN.js} +800 -776
- package/dist/chunks/dashboard-controls-DCZnUFI0.js +47 -0
- package/dist/chunks/{dashboard-filter-controls-button-kfb_T18o.js → dashboard-filter-controls-button-DI7XUgZK.js} +142 -142
- package/dist/chunks/{dashboard-filter-controls-button-2I1ltWQ9.js → dashboard-filter-controls-button-YQZ-oeN5.js} +3 -3
- package/dist/chunks/{dashboard-json-Df6v2Jem.js → dashboard-json-C6R2qixD.js} +3 -3
- package/dist/chunks/{dashboard-json-C3v6rBdp.js → dashboard-json-Z8jz16Yj.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DKAaWq-G.js → dashboard-summary-settings-dialog-BlD77h63.js} +2 -2
- package/dist/chunks/{dashboard-summary-settings-dialog-BBALEHJQ.js → dashboard-summary-settings-dialog-DJyY-PB9.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CGBYahAK.js → edit-dashboard-visual-CNGc1zcN.js} +33 -33
- package/dist/chunks/{edit-dashboard-visual-D8L0cl_U.js → edit-dashboard-visual-CfRJXwDR.js} +167 -168
- package/dist/chunks/{index-uRJmUpof.js → index-CJdxSyQq.js} +679 -656
- package/dist/chunks/index-D2vz3gvd.js +1360 -0
- package/dist/chunks/index-DRlMUglg.js +4 -0
- package/dist/chunks/{index-BmoR3VQT.js → index-GHhvGdF9.js} +42745 -40322
- package/dist/chunks/{palette-326-dgn0.js → palette-BqJlrRto.js} +7 -2
- package/dist/chunks/{palette-jd7xiGTg.js → palette-DD-i7bNS.js} +23 -3
- package/dist/chunks/{resource-management-panel-C_c-BwrC.js → resource-management-panel-7Y4ITzGH.js} +65 -65
- package/dist/chunks/{resource-management-panel-DrcEEARD.js → resource-management-panel-Bdus73Iu.js} +1 -1
- package/dist/chunks/{rotate-ccw-BugHcM1w.js → rotate-ccw-CdGW8Rxm.js} +1 -1
- package/dist/chunks/{rotate-ccw-yFwqBFJZ.js → rotate-ccw-X8MbX_hF.js} +1 -1
- package/dist/chunks/{save-CaybXtdd.js → save-CFBIhbHD.js} +1 -1
- package/dist/chunks/{save-DU0FXUlM.js → save-j-clxFtx.js} +1 -1
- package/dist/chunks/{switch-CZtMtqEj.js → switch-BFhVVwh9.js} +4285 -3275
- package/dist/chunks/switch-BH17qlxH.js +163 -0
- package/dist/chunks/use-create-flow-overlay-state-CSytlf2H.js +16 -0
- package/dist/chunks/{use-create-flow-overlay-state-84Xe8VrP.js → use-create-flow-overlay-state-CllZvyvE.js} +318 -316
- package/dist/chunks/{use-visual-utils-lp5DfmvL.js → use-visual-utils-CDO4kVX5.js} +1 -1
- package/dist/chunks/{use-visual-utils-z3ifg6Fd.js → use-visual-utils-CyjLzcDG.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.js +61 -60
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +6 -6
- package/dist/types/dashboard.d.ts +168 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +8 -11
- package/dist/types/main.d.ts +195 -2
- package/dist/types/shared.d.ts +120 -0
- package/dist/types/surfboard.d.ts +168 -0
- package/dist/types/types.d.ts +168 -0
- package/package.json +1 -1
- package/dist/chunks/braces-CpOcaBNm.js +0 -6
- package/dist/chunks/braces-TYclg8Hl.js +0 -23
- package/dist/chunks/dashboard-controls-BkuB9TQX.js +0 -47
- package/dist/chunks/index-Cxb9UUro.js +0 -4
- package/dist/chunks/index-eM6MU4q_.js +0 -1361
- package/dist/chunks/switch-AmoR1YIA.js +0 -163
- package/dist/chunks/use-create-flow-overlay-state-CiKVJGWF.js +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DRlMUglg.js");exports.APPEARANCE_SPEC_VERSION=e.APPEARANCE_SPEC_VERSION;exports.assertValidAppearanceSpec=e.assertValidAppearanceSpec;exports.mergeAppearanceSpecs=e.mergeAppearanceSpecs;exports.normalizeAppearanceSpec=e.normalizeAppearanceSpec;exports.resolveAppearance=e.resolveAppearance;exports.validateAppearanceSpec=e.validateAppearanceSpec;
|
package/dist/appearance/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-BH17qlxH.js"),A=require("../chunks/index-DRlMUglg.js"),J=require("../chunks/palette-BqJlrRto.js"),re=require("../chunks/rotate-ccw-CdGW8Rxm.js"),be=require("../chunks/save-CFBIhbHD.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const fe=d.createLucideIcon("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const me=d.createLucideIcon("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
|
|
12
12
|
* @license lucide-react v0.453.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const xe=
|
|
16
|
+
*/const xe=d.createLucideIcon("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
17
17
|
* @license lucide-react v0.453.0 - ISC
|
|
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=s.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 A(r){const n=J.resolveAppearance({organizationAppearance:r??void 0});return ye(F(n))}function I(r){const n=F({version:J.APPEARANCE_SPEC_VERSION,mode:r.mode,schemes:r.schemes}),t=J.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 ae(r,n){const t=W.find(i=>i.id===n);if(!t)return r;const u=F(r);return ee(u.schemes.light,t.light),ee(u.schemes.dark,t.dark),u}function ee(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]=F(r.components.table)}function re(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 M(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 ye(r){var n,t;for(const u of["light","dark"]){const i=r.schemes[u],l=i.tokens,d=l.color,j=(n=i.components)==null?void 0:n.aggregateTable,y=(t=i.components)==null?void 0:t.pivotTable,P={fontFamily:"",headingFontFamily:"",monoFontFamily:"",baseFontSize:14,density:"comfortable"};l.typography={...P,...l.typography};const f={control:5,card:5,table:5,badge:999};l.radius={...f,...l.radius};const b={dashboardPadding:16,gridGap:12,cardPadding:16,controlGap:8,tableCellX:12,tableCellY:8};l.spacing={...b,...l.spacing};const N={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={...N,...l.shadow};const S={dashboard:{background:d.background,foreground:d.foreground,borderColor:d.border,padding:l.spacing.dashboardPadding},card:{background:d.card,foreground:d.cardForeground,borderColor:d.border,borderRadius:l.radius.card,padding:l.spacing.cardPadding,shadow:l.shadow.card},interactive:{toolbarBackground:d.background,background:d.card,foreground:d.foreground,borderColor:d.border,borderRadius:l.radius.control},chart:{palette:[],background:d.card,foreground:d.foreground,gridColor:d.border,axisColor:d.mutedForeground},table:T(d,l),aggregateTable:T(d,l),pivotTable:T(d,l),pagination:{background:d.card,foreground:d.foreground,borderColor:d.border,borderRadius:l.radius.control}};i.components={...S,...i.components};const L={palette:[],background:d.card,foreground:d.foreground,gridColor:d.border,axisColor:d.mutedForeground};i.components.chart={...L,...i.components.chart},i.components.table={...T(d,l),...i.components.table},i.components.aggregateTable=j?{...T(d,l),...j}:F(i.components.table),i.components.pivotTable=y?{...T(d,l),...y}:F(i.components.table)}return r}function T(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 F(r){return JSON.parse(JSON.stringify(r))}const je=[["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],_=[{id:"semaphor",label:"Semaphor / Inter",value:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},{id:"system",label:"System UI",value:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},{id:"aptos",label:"Aptos",value:'Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif'},{id:"ibm-plex-sans",label:"IBM Plex Sans",value:'"IBM Plex Sans", Inter, ui-sans-serif, system-ui, sans-serif'},{id:"roboto",label:"Roboto",value:"Roboto, Arial, ui-sans-serif, system-ui, sans-serif"},{id:"open-sans",label:"Open Sans",value:'"Open Sans", Arial, ui-sans-serif, system-ui, sans-serif'},{id:"source-sans",label:"Source Sans 3",value:'"Source Sans 3", Arial, ui-sans-serif, system-ui, sans-serif'},{id:"custom",label:"Custom stack",value:""}],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:d,onSave:j,onClearConfig:y,onCancel:P}){const[f,b]=m.useState(null),[N,S]=m.useState("light"),[L,R]=m.useState(!1),[ne,B]=m.useState("idle"),[X,te]=m.useState(!1),[z,U]=m.useState(""),[E,x]=m.useState(null),Y=m.useRef(null),D=m.useRef(d),O=m.useRef(!1);m.useEffect(()=>{D.current=d},[d]),m.useEffect(()=>{if(r===void 0){O.current=!0,b(null);return}const o=A(r);O.current=!0,b(o),S("light"),x(null)},[r]),m.useEffect(()=>{var o;if(f){if(O.current){O.current=!1;return}try{const a=I(f);(o=D.current)==null||o.call(D,a),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}}},[f]);const p=f==null?void 0:f.schemes[N],$=u||L,se=m.useMemo(()=>p?we(p.tokens.radius.control):void 0,[p]),de=o=>{b(a=>{if(!a)return a;const h=Te(a);return o(h),h})},g=o=>{de(a=>{o(a.schemes[N])})},ie=async()=>{if(!f||!j)return;let o;try{o=I(f)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid");return}R(!0);try{await j(o)}finally{R(!1)}},le=()=>{const o=A(null);B("idle"),b(o)},ce=async()=>{if(y){R(!0),x(null),B("idle");try{await y(),O.current=!0,b(A(null)),S("light")}catch(o){x(o instanceof Error?o.message:"Unable to clear organization appearance")}finally{R(!1)}}},Z=m.useCallback(()=>f?JSON.stringify(I(f),null,2):"",[f]),ue=o=>{if(te(o),o)try{U(Z()),x(null)}catch(a){x(a instanceof Error?a.message:"Appearance is invalid")}},pe=async()=>{if(f)try{const o=X&&z?z:Z();await navigator.clipboard.writeText(o),x(null),B("copied")}catch(o){x(o instanceof Error?o.message:"Unable to copy appearance JSON")}},K=o=>{const a=JSON.parse(o),h=A(a),w=I(h);B("idle"),S("light"),b(h),U(JSON.stringify(w,null,2))},be=()=>{try{K(z)}catch(o){x(o instanceof Error?o.message:"JSON must be a valid AppearanceSpec")}},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(w){x(w instanceof Error?w.message:"Uploaded file must be valid AppearanceSpec JSON")}};return e.jsxs("div",{className:s.cn("flex min-h-0 flex-1 flex-col bg-background text-foreground",l),style:se,children:[e.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-border/60 px-4",children:[e.jsx("div",{className:"flex h-6 w-6 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",children:"Brand Studio"}),e.jsxs("p",{className:"truncate text-[11px] text-muted-foreground",children:["Previewing ",n||"current dashboard"]})]}),e.jsxs(s.Popover,{open:X,onOpenChange:ue,children:[e.jsx(s.PopoverTrigger,{asChild:!0,children:e.jsxs(s.Button,{type:"button",size:"xs",variant:"ghost",disabled:!f,children:[e.jsx(Q,{className:"h-3.5 w-3.5"}),"JSON"]})}),e.jsxs(s.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:"AppearanceSpec JSON"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Edit, apply, copy, or upload the active spec."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(s.Button,{type:"button",size:"xs",variant:"ghost",onClick:pe,children:[e.jsx(Q,{className:"h-3.5 w-3.5"}),ne==="copied"?"Copied":"Copy"]}),e.jsxs(s.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>{var o;return(o=Y.current)==null?void 0:o.click()},children:[e.jsx(s.Upload,{className:"h-3.5 w-3.5"}),"Upload"]}),e.jsx(s.Button,{type:"button",size:"xs",onClick:be,children:"Apply"})]})]}),e.jsx("div",{className:"h-[320px] overflow-hidden rounded-control border border-input",children:e.jsx(s.CodeEditor,{ariaLabel:"AppearanceSpec JSON",value:z,onValueChange:o=>{U(o),B("idle")},language:"json",embedded:!0,hideLineNumbers:!0,dense:!0})})]})]}),e.jsx("input",{ref:Y,"aria-label":"Upload AppearanceSpec JSON",type:"file",accept:"application/json,.json",className:"sr-only",onChange:ge}),e.jsxs(s.Button,{type:"button",size:"xs",variant:"ghost",onClick:le,disabled:!f,children:[e.jsx(oe.RotateCcw,{className:"h-3.5 w-3.5"}),"Reset"]}),y&&e.jsxs(s.Button,{type:"button",size:"xs",variant:"ghost",onClick:ce,disabled:$,children:[e.jsx(me,{className:"h-3.5 w-3.5"}),"No config"]}),e.jsxs(s.Button,{type:"button",size:"xs",onClick:ie,disabled:!f||$||!!E||!j,children:[$?e.jsx(s.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(fe.Save,{className:"h-3.5 w-3.5"}),"Save"]}),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:P,children:e.jsx(s.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:E?e.jsxs(e.Fragment,{children:[e.jsx(s.SlidersHorizontal,{className:"h-3.5 w-3.5 text-destructive"}),"Preview keeps the last valid draft"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.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:s.cn("h-full px-2.5 text-[12px] capitalize transition-colors",N===o?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>S(o),children:o},o))})]}),E&&e.jsx("div",{className:"border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive",children:E}),t?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(s.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(s.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(s.TabsList,{variant:"underline",className:"w-full gap-5",children:[e.jsx(s.TabsTrigger,{value:"style",children:"Style"}),e.jsx(s.TabsTrigger,{value:"surfaces",children:"Surfaces"}),e.jsx(s.TabsTrigger,{value:"data",children:"Data"})]})}),e.jsxs(s.ScrollArea,{className:"min-h-0 flex-1",children:[e.jsxs(s.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=ae(f,o.id);b(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 ${N} scheme.`,children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:je.map(([o,a])=>e.jsx(k,{label:a,value:p.tokens.color[o],onChange:h=>g(w=>{re(w,o,h)})},o))})}),e.jsxs(v,{icon:s.Type,title:"Typography",description:"Fonts and density used by dashboard and workflow chrome.",children:[e.jsx(Ne,{value:p.tokens.typography.fontFamily,onChange:o=>g(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=>g(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=>g(a=>{a.tokens.typography.density=o,a.components.table.density=a.tokens.typography.density,c(a,"aggregateTable"),c(a,"pivotTable")})})]})]})]}),e.jsxs(s.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=>g(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=>g(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=>g(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=>g(a=>{M(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=>g(a=>{M(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=>g(a=>{M(a,"table",o)})})]})]}),e.jsx(v,{icon:s.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=>g(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=>g(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=>g(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=>g(a=>{re(a,"accent",o)})})]})})]}),e.jsxs(s.TabsContent,{value:"data",className:"m-0 p-4",children:[e.jsxs(v,{icon:s.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=>g(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=>g(a=>{a.components.chart.gridColor=o})}),e.jsx(k,{label:"Axis",value:p.components.chart.axisColor,onChange:o=>g(a=>{a.components.chart.axisColor=o})})]})]}),e.jsxs(v,{icon:s.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=>g(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=>g(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=>g(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=>g(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=>g(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=>g(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=>g(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(s.Separator,{className:"mt-5 bg-border/60"})]})}function Ne({value:r,onChange:n}){var u;const t=((u=_.find(i=>i.value===r))==null?void 0:u.id)??"custom";return e.jsxs("div",{children:[e.jsx(s.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(s.Select,{value:t,onValueChange:i=>{const l=_.find(d=>d.id===i);!l||l.id==="custom"||n(l.value)},children:[e.jsx(s.SelectTrigger,{size:"xs","aria-label":"Font family preset",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:_.map(i=>e.jsx(s.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"})]}),e.jsx(s.Input,{size:"xs","aria-label":"Custom font family",value:r,onChange:i=>n(i.target.value),className:"mt-2 font-mono"})]})}function k({label:r,tooltip:n,value:t,onChange:u}){const[i,l]=m.useState(!1),[d,j]=m.useState(t),y=Se(t),P=t!==d,f=b=>{l(b),b&&j(t)};return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(s.Label,{className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.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(s.Info,{className:"h-3 w-3"})})}),e.jsx(s.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(s.Popover,{open:i,onOpenChange:f,children:[e.jsx(s.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(s.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:y,onChange:b=>u(b.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(s.Label,{className:"block text-[11px] font-normal text-muted-foreground",children:"Color value"}),e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Reset ${r} color to previous value`,disabled:!P,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(d),children:e.jsx(oe.RotateCcw,{className:"h-3 w-3"})})}),e.jsx(s.TooltipContent,{side:"top",children:"Reset to previous value"})]})})]}),e.jsx(s.Input,{size:"xs","aria-label":`${r} popover color value`,value:t,onChange:b=>u(b.target.value),className:"font-mono"})]})]}),e.jsx("div",{className:"mt-2 grid grid-cols-6 gap-1",children:ve.map(b=>e.jsx("button",{type:"button","aria-label":`Set ${r} to ${b}`,className:s.cn("h-6 rounded-control border border-border/70 shadow-sm",t.toLowerCase()===b&&"ring-2 ring-ring"),style:{backgroundColor:b},onClick:()=>u(b)},b))})]})]}),e.jsx(s.Input,{size:"xs","aria-label":`${r} color value`,value:t,onChange:b=>u(b.target.value),className:"h-full border-0 px-2 font-mono shadow-none focus-visible:border-0"})]})]})}function Se(r){const n=J.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 d=m.useId();return e.jsxs("div",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(s.Label,{htmlFor:d,className:"text-[11px] font-normal text-muted-foreground",children:r}),n?e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.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(s.Info,{className:"h-3 w-3"})})}),e.jsx(s.TooltipContent,{side:"top",className:"max-w-56",children:n})]})}):null]}),e.jsx(s.Input,{id:d,size:"xs",type:"number",min:u,max:i,value:t,onChange:j=>{const y=Number(j.target.value);Number.isNaN(y)||l(y)}})]})}function G({label:r,value:n,options:t,onChange:u}){return e.jsxs("div",{children:[e.jsx(s.Label,{className:"mb-1 block text-[11px] font-normal text-muted-foreground",children:r}),e.jsxs(s.Select,{value:n,onValueChange:u,children:[e.jsx(s.SelectTrigger,{size:"xs",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:t.map(([i,l])=>e.jsx(s.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(s.Switch,{size:"xs",checked:n,onCheckedChange:t})]})}function we(r){const n=`${Number((r/16).toFixed(4))}rem`;return{"--semaphor-radius":n,"--semaphor-control-radius":n}}function Te(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=ae;exports.buildAppearanceSpecFromDraft=I;exports.createBrandStudioDraft=A;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 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;
|