react-semaphor 0.1.368 → 0.1.370
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/brand-studio/index.cjs +5 -5
- package/dist/brand-studio/index.js +24 -23
- package/dist/chunks/{braces-Cc86y9Ov.js → braces-C3-w6xDL.js} +1 -1
- package/dist/chunks/{braces-CXvY9MwQ.js → braces-C8QqW4wu.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-BOFlzOJg.js → calendar-preferences-dialog-6q51A6XC.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-ZzwfJv2J.js → calendar-preferences-dialog-CUGzkNcE.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CUZL1zaU.js → chevrons-up-down-CnCSGY02.js} +1 -1
- package/dist/chunks/{chevrons-up-down-qQMadOWA.js → chevrons-up-down-DSvLu4Ye.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-9-PCYMjR.js → dashboard-briefing-launcher-BEZnvIla.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D2lBFqAd.js → dashboard-briefing-launcher-ptERmNJr.js} +176 -177
- package/dist/chunks/{dashboard-controls-D4bUHAjX.js → dashboard-controls-CGt6_hMf.js} +11 -11
- package/dist/chunks/{dashboard-controls-BIk094Ah.js → dashboard-controls-CqKC5oEk.js} +77 -77
- package/dist/chunks/{dashboard-json-DImOf512.js → dashboard-json-6SgPm_QW.js} +13 -14
- package/dist/chunks/dashboard-json-CYSbOdmE.js +1 -0
- package/dist/chunks/{edit-dashboard-visual-DTxkV6Fl.js → edit-dashboard-visual-ByQx_M2i.js} +8 -9
- package/dist/chunks/{edit-dashboard-visual-BHKlcqQR.js → edit-dashboard-visual-w6hKbjlw.js} +1 -1
- package/dist/chunks/index-BtqYNH_S.js +1361 -0
- package/dist/chunks/{index-BVEIk-rB.js → index-CPyEi9gS.js} +72498 -76193
- package/dist/chunks/{palette-DPuAc82h.js → palette-D-f4-82S.js} +1 -1
- package/dist/chunks/{palette-C1k347Tb.js → palette-DUGktM-M.js} +1 -1
- package/dist/chunks/{resource-management-panel-BeHceP2D.js → resource-management-panel-Bf8-3eUf.js} +1 -1
- package/dist/chunks/{resource-management-panel-BOfbSf48.js → resource-management-panel-mJ84NxzC.js} +152 -152
- package/dist/chunks/save-D3YYinDz.js +6 -0
- package/dist/chunks/save-kkBEBeLg.js +21 -0
- package/dist/chunks/{switch-xcWLtWs0.js → switch-Dkx2qEOr.js} +758 -776
- package/dist/chunks/{switch-C0S63HAv.js → switch-fIkmwzUt.js} +27 -32
- package/dist/chunks/{use-create-flow-overlay-state-B5FygfQL.js → use-create-flow-overlay-state-BfoXDDrd.js} +190 -189
- package/dist/chunks/use-create-flow-overlay-state-c6rCm36x.js +26 -0
- package/dist/chunks/{use-visual-utils-DxDE8S8M.js → use-visual-utils-C_c-aiqi.js} +1 -1
- package/dist/chunks/{use-visual-utils-CszWnFBW.js → use-visual-utils-NN0e3fBP.js} +13 -13
- package/dist/chunks/validation-DYL3ArlL.js +1 -0
- package/dist/chunks/validation-PPSpYtVf.js +900 -0
- package/dist/chunks/validators-CgxWT8UX.js +1 -0
- package/dist/chunks/validators-DBNa-eb1.js +1799 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +51 -1
- package/dist/data-app-builder/index.js +3666 -2
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +661 -389
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +472 -3
- package/dist/types/dashboard-assistant.d.ts +469 -3
- package/dist/types/dashboard-authoring.d.ts +170 -2
- package/dist/types/data-app-builder.d.ts +167 -2
- package/dist/types/data-app-sdk-validation.d.ts +576 -25
- package/dist/types/data-app-sdk.d.ts +655 -37
- package/dist/types/main.d.ts +167 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-json-Bo1kX6W1.js +0 -1
- package/dist/chunks/index-HjDeEytV.js +0 -1411
- package/dist/chunks/use-create-flow-overlay-state-DOXTbTcQ.js +0 -26
- package/dist/chunks/validation-CrUjNWby.js +0 -689
- package/dist/chunks/validation-DGl8wnTt.js +0 -1
- package/dist/chunks/validators-Dq5X4mp0.js +0 -1
- package/dist/chunks/validators-L0xEXtjf.js +0 -965
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/validators-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../chunks/validators-CgxWT8UX.js"),i=require("../chunks/catalog-field-grounding-Du6mKDcF.js"),l=require("../chunks/source-identity-C-xaeE_I.js");function c(e,a={}){const r=d(e),t={connectionId:a.connectionId,connectionType:e,path:["database","schema","table"],labels:{database:"Database",schema:"Schema",table:"Table"},prefixLevels:["database","schema","table"],dialect:"postgres",supportsFilterClause:!0};return r.includes("postgres")?{...t,prefixLevels:["schema","table"],dialect:"postgres"}:r.includes("mysql")?{...t,prefixLevels:["database","table"],dialect:"mysql",supportsFilterClause:!1}:r.includes("mssql")||r.includes("sqlserver")?{...t,dialect:"mssql",supportsFilterClause:!1}:r.includes("redshift")?{...t,prefixLevels:["schema","table"],dialect:"redshift"}:r.includes("snowflake")?{...t,dialect:"snowflake"}:r.includes("clickhouse")?{connectionId:a.connectionId,connectionType:e,path:["database","table"],labels:{database:"Database",table:"Table"},prefixLevels:["database","table"],dialect:"clickhouse",supportsFilterClause:!1}:r==="s3"||r==="api"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:r==="api"?"API Table":"File Table"},prefixLevels:["table"],dialect:"duckdb",supportsFilterClause:!0}:r==="googlesheets"||r==="fileupload"?{connectionId:a.connectionId,connectionType:e,path:["table"],labels:{table:"Table"},prefixLevels:["table"],dialect:"postgres",supportsFilterClause:!0}:r==="s3tables"?{...t,labels:{database:"Database",schema:"Namespace",table:"Table"},dialect:"duckdb"}:r==="bigquery"?{...t,labels:{database:"Project",schema:"Dataset",table:"Table"},prefixLevels:["schema","table"],dialect:"bigquery",supportsFilterClause:!1}:t}function u(e){const a=d(e);switch(a){case"mysql":case"bigquery":case"redshift":case"snowflake":case"clickhouse":case"duckdb":case"sqlite":return a;case"mssql":case"sqlserver":return"mssql";case"postgres":case"postgresql":return"postgres";default:return"unknown"}}function m(e){return e.capabilities.prefixLevels.every(a=>!!o(e.source,a))}function p(e){const a=e.quoteIdentifier??b;return e.capabilities.prefixLevels.map(r=>o(e.source,r)).filter(r=>!!r).map(r=>a(r,e.capabilities.dialect)).join(".")}function o(e,a){return a==="database"?e.databaseName:a==="schema"?e.schemaName:e.tableName}function b(e,a){return a==="mysql"||a==="bigquery"||a==="clickhouse"||a==="duckdb"?`\`${e.replace(/`/g,"``")}\``:a==="mssql"?`[${e.replace(/]/g,"]]")}]`:`"${e.replace(/"/g,'""')}"`}function d(e){if(typeof e!="string")return"";const a=[];for(const r of e.trim().toLowerCase())f(r)&&a.push(r);return a.join("")}function f(e){const a=e.charCodeAt(0);return a>=48&&a<=57||a>=97&&a<=122}const s={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},h={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:s,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:s,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"},{name:"revenue",role:"measure",dataType:"number"}],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:s,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],orderBy:{field:{name:"revenue",role:"measure"},direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",source:s,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:s,metrics:[{name:"revenue",role:"measure"}],primaryMetric:{name:"revenue",role:"measure"},dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},inboundSupplierConcentration:{version:1,kind:"metric",id:"inbound-supplier-concentration",label:"Inbound supplier concentration",source:s,metrics:[{name:"net_tons",role:"measure"},{name:"ticket_value",role:"measure"}],primaryMetric:{name:"net_tons",role:"measure"},dateField:{name:"ticket_date",role:"date",dataType:"date"},timeWindow:{unit:"month",value:6,anchor:"latest_available"},dimensions:[{name:"supplier_id",role:"dimension",dataType:"number"}],filters:[{field:{name:"direction",role:"dimension",dataType:"string"},operator:"=",values:["Inbound"]}],limit:15},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"sql",connectionId:"conn_sales",dialect:"postgres"},sql:"SELECT customer_name, SUM(revenue) AS revenue FROM public.orders GROUP BY customer_name ORDER BY revenue DESC LIMIT 20",limit:20,rationale:"Ranking is SQL-natural because it requires ordering grouped aggregate rows.",fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}]}};exports.normalizeSemaphorAnalyticsFilterOperator=n.normalizeSemaphorAnalyticsFilterOperator;exports.normalizeSemaphorInputOperator=n.normalizeSemaphorInputOperator;exports.parseSemaphorIsoTimeWindowBoundary=n.parseSemaphorIsoTimeWindowBoundary;exports.validateSemaphorAnalyticsIntent=n.validateSemaphorAnalyticsIntent;exports.validateSemaphorAnalyticsRecoveryPlan=n.validateSemaphorAnalyticsRecoveryPlan;exports.validateSemaphorDashboardIntent=n.validateSemaphorDashboardIntent;exports.validateSemaphorOperationIntent=n.validateSemaphorOperationIntent;exports.buildAnalyticsCatalogFieldSummary=i.buildAnalyticsCatalogFieldSummary;exports.getAnalyticsCatalogFieldCandidates=i.getAnalyticsCatalogFieldCandidates;exports.getAnalyticsCatalogFieldName=i.getAnalyticsCatalogFieldName;exports.isAnalyticsCatalogDateField=i.isAnalyticsCatalogDateField;exports.isAnalyticsCatalogDimensionField=i.isAnalyticsCatalogDimensionField;exports.isAnalyticsCatalogMetricField=i.isAnalyticsCatalogMetricField;exports.isAnalyticsDateLikeDataType=i.isAnalyticsDateLikeDataType;exports.isAnalyticsMetricIdentifierField=i.isAnalyticsMetricIdentifierField;exports.isAnalyticsTechnicalIdentifierField=i.isAnalyticsTechnicalIdentifierField;exports.normalizeAnalyticsCatalogDataType=i.normalizeAnalyticsCatalogDataType;exports.normalizeAnalyticsCatalogName=i.normalizeAnalyticsCatalogName;exports.preferSemaphorFieldRefMetadata=l.preferSemaphorFieldRefMetadata;exports.preferSemaphorSourceMetadata=l.preferSemaphorSourceMetadata;exports.semaphorFieldRefsMatch=l.semaphorFieldRefsMatch;exports.semaphorSourceIdentityKey=l.semaphorSourceIdentityKey;exports.semaphorSourcesReferToSameDataset=l.semaphorSourcesReferToSameDataset;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=h;exports.buildSemaphorQualifiedSourcePath=p;exports.getSemaphorConnectionCapabilities=c;exports.normalizeSemaphorDialect=u;exports.semaphorSourceHasRequiredCoordinates=m;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as h, n as v, p as g, v as y, c as k, d as S, b as I } from "../chunks/validators-
|
|
1
|
+
import { a as h, n as v, p as g, v as y, c as k, d as S, b as I } from "../chunks/validators-DBNa-eb1.js";
|
|
2
2
|
import { j as T, a as q, g as F, c as A, h as _, f as R, i as L, e as D, d as x, b as M, n as N } from "../chunks/catalog-field-grounding-DoEBOXQd.js";
|
|
3
3
|
import { c as w, p as z, b as E, s as P, a as B } from "../chunks/source-identity-Dj3dryN9.js";
|
|
4
4
|
function d(e, a = {}) {
|
|
@@ -1,21 +1,21 @@
|
|
|
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-fIkmwzUt.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");const V=require("../chunks/palette-DUGktM-M.js"),ge=require("../chunks/braces-C3-w6xDL.js"),be=require("../chunks/save-D3YYinDz.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
|
|
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 xe=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 he(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 he(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 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"]],ye=[0,1,2,3,4,5],M=A.APPEARANCE_FONT_PRESETS,ke=["#ffffff","#f8fafc","#f4f4f5","#e4e4e7","#18181b","#09090b","#2563eb","#0f766e","#047857","#d97706","#dc2626","#7c3aed"];function ve({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?we(p.tokens.radius.control):void 0,[p]),te=o=>{g(a=>{if(!a)return a;const h=Te(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 Se(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(fe,{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(be,{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(d.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:je.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(Ce,{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:me,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:ye.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 Ce({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=Ne(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(xe,{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:ke.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 Ne(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 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 Se(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=ve;exports.applyBrandStudioPreset=re;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],q=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=q.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=q.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:q.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?`#${M(n.r)}${M(n.g)}${M(n.b)}`:"#000000"}function M(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,11 @@
|
|
|
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, R as me, f as le,
|
|
4
|
-
import { r 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, S as se, e as je, T as Le, J as $e, K as M, M as _e, N as G, O as Ve, Q as Ue, V as Me, W as Ge, L as E, Y as Q, Z as ee, _ as re, $ as he, a0 as oe, a1 as ae, a2 as xe, a3 as ye, a4 as ke, a5 as ve, a6 as Ce, a7 as We } from "../chunks/switch-Dkx2qEOr.js";
|
|
4
|
+
import { r as He, v as Ye, A as Xe, a as Ze, p as qe } from "../chunks/index-CJdxSyQq.js";
|
|
5
5
|
import "../chunks/index-CuHybtft.js";
|
|
6
|
-
import { P as W } from "../chunks/palette-
|
|
7
|
-
import { B as
|
|
6
|
+
import { P as W } from "../chunks/palette-D-f4-82S.js";
|
|
7
|
+
import { B as Ke } from "../chunks/braces-C8QqW4wu.js";
|
|
8
|
+
import { S as Qe } from "../chunks/save-kkBEBeLg.js";
|
|
8
9
|
/**
|
|
9
10
|
* @license lucide-react v0.453.0 - ISC
|
|
10
11
|
*
|
|
@@ -209,17 +210,17 @@ const ar = $("Pipette", [
|
|
|
209
210
|
}
|
|
210
211
|
];
|
|
211
212
|
function j(e) {
|
|
212
|
-
const n =
|
|
213
|
+
const n = He({
|
|
213
214
|
organizationAppearance: e ?? void 0
|
|
214
215
|
});
|
|
215
216
|
return tr(O(n));
|
|
216
217
|
}
|
|
217
218
|
function L(e) {
|
|
218
219
|
const n = O({
|
|
219
|
-
version:
|
|
220
|
+
version: Xe,
|
|
220
221
|
mode: e.mode,
|
|
221
222
|
schemes: e.schemes
|
|
222
|
-
}), t =
|
|
223
|
+
}), t = Ye(n);
|
|
223
224
|
if (!t.success) {
|
|
224
225
|
const u = t.issues[0];
|
|
225
226
|
throw new Error(
|
|
@@ -443,7 +444,7 @@ const dr = [
|
|
|
443
444
|
["negative", "Negative"],
|
|
444
445
|
["warning", "Warning"],
|
|
445
446
|
["info", "Info"]
|
|
446
|
-
], ir = [0, 1, 2, 3, 4, 5], Y =
|
|
447
|
+
], ir = [0, 1, 2, 3, 4, 5], Y = Ze, cr = [
|
|
447
448
|
"#ffffff",
|
|
448
449
|
"#f8fafc",
|
|
449
450
|
"#f4f4f5",
|
|
@@ -457,7 +458,7 @@ const dr = [
|
|
|
457
458
|
"#dc2626",
|
|
458
459
|
"#7c3aed"
|
|
459
460
|
];
|
|
460
|
-
function
|
|
461
|
+
function Cr({
|
|
461
462
|
appearance: e,
|
|
462
463
|
previewTitle: n,
|
|
463
464
|
isLoading: t = !1,
|
|
@@ -611,7 +612,7 @@ function vr({
|
|
|
611
612
|
onOpenChange: Re,
|
|
612
613
|
children: [
|
|
613
614
|
/* @__PURE__ */ r(be, { asChild: !0, children: /* @__PURE__ */ d(C, { type: "button", size: "xs", variant: "ghost", disabled: !f, children: [
|
|
614
|
-
/* @__PURE__ */ r(
|
|
615
|
+
/* @__PURE__ */ r(Ke, { className: "h-3.5 w-3.5" }),
|
|
615
616
|
"Brand Spec"
|
|
616
617
|
] }) }),
|
|
617
618
|
/* @__PURE__ */ d(
|
|
@@ -726,7 +727,7 @@ function vr({
|
|
|
726
727
|
onClick: Pe,
|
|
727
728
|
disabled: !f || U || !!I || !k,
|
|
728
729
|
children: [
|
|
729
|
-
U ? /* @__PURE__ */ r(le, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(
|
|
730
|
+
U ? /* @__PURE__ */ r(le, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(Qe, { className: "h-3.5 w-3.5" }),
|
|
730
731
|
"Save"
|
|
731
732
|
]
|
|
732
733
|
}
|
|
@@ -738,7 +739,7 @@ function vr({
|
|
|
738
739
|
"aria-label": "Close Brand Studio",
|
|
739
740
|
className: "flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
740
741
|
onClick: S,
|
|
741
|
-
children: /* @__PURE__ */ r(
|
|
742
|
+
children: /* @__PURE__ */ r(Je, { className: "h-3.5 w-3.5" })
|
|
742
743
|
}
|
|
743
744
|
)
|
|
744
745
|
] }),
|
|
@@ -747,7 +748,7 @@ function vr({
|
|
|
747
748
|
/* @__PURE__ */ r(se, { className: "h-3.5 w-3.5 text-destructive" }),
|
|
748
749
|
"Preview keeps the last valid draft"
|
|
749
750
|
] }) : /* @__PURE__ */ d(ce, { children: [
|
|
750
|
-
/* @__PURE__ */ r(
|
|
751
|
+
/* @__PURE__ */ r(je, { className: "h-3.5 w-3.5 text-emerald-500" }),
|
|
751
752
|
"Draft is applied to the live dashboard preview"
|
|
752
753
|
] }) }),
|
|
753
754
|
/* @__PURE__ */ r("div", { className: "inline-flex h-7 items-center overflow-hidden rounded-control border border-border/70", children: ["light", "dark"].map((o) => /* @__PURE__ */ r(
|
|
@@ -765,13 +766,13 @@ function vr({
|
|
|
765
766
|
)) })
|
|
766
767
|
] }),
|
|
767
768
|
I && /* @__PURE__ */ r("div", { className: "border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-[12px] text-destructive", children: I }),
|
|
768
|
-
t ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ r(le, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : c ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: c }) : f && p ? /* @__PURE__ */ d(
|
|
769
|
-
/* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d(
|
|
769
|
+
t ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ r(le, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : c ? /* @__PURE__ */ r("div", { className: "p-4 text-[13px] text-muted-foreground", children: c }) : f && p ? /* @__PURE__ */ d(Le, { defaultValue: "style", className: "flex min-h-0 flex-1 flex-col", children: [
|
|
770
|
+
/* @__PURE__ */ r("div", { className: "shrink-0 px-4 pt-3", children: /* @__PURE__ */ d($e, { variant: "underline", className: "w-full gap-5", children: [
|
|
770
771
|
/* @__PURE__ */ r(M, { value: "style", children: "Style" }),
|
|
771
772
|
/* @__PURE__ */ r(M, { value: "surfaces", children: "Surfaces" }),
|
|
772
773
|
/* @__PURE__ */ r(M, { value: "data", children: "Data" })
|
|
773
774
|
] }) }),
|
|
774
|
-
/* @__PURE__ */ d(
|
|
775
|
+
/* @__PURE__ */ d(_e, { className: "min-h-0 flex-1", children: [
|
|
775
776
|
/* @__PURE__ */ d(G, { value: "style", className: "m-0 p-4", children: [
|
|
776
777
|
/* @__PURE__ */ r(
|
|
777
778
|
N,
|
|
@@ -837,7 +838,7 @@ function vr({
|
|
|
837
838
|
/* @__PURE__ */ d(
|
|
838
839
|
N,
|
|
839
840
|
{
|
|
840
|
-
icon:
|
|
841
|
+
icon: Ve,
|
|
841
842
|
title: "Typography",
|
|
842
843
|
description: "Fonts and density used by dashboard and workflow chrome.",
|
|
843
844
|
children: [
|
|
@@ -1035,7 +1036,7 @@ function vr({
|
|
|
1035
1036
|
/* @__PURE__ */ d(
|
|
1036
1037
|
N,
|
|
1037
1038
|
{
|
|
1038
|
-
icon:
|
|
1039
|
+
icon: Ue,
|
|
1039
1040
|
title: "Charts",
|
|
1040
1041
|
description: "Palette and semantic chart text/grid colors.",
|
|
1041
1042
|
children: [
|
|
@@ -1078,7 +1079,7 @@ function vr({
|
|
|
1078
1079
|
/* @__PURE__ */ d(
|
|
1079
1080
|
N,
|
|
1080
1081
|
{
|
|
1081
|
-
icon:
|
|
1082
|
+
icon: Me,
|
|
1082
1083
|
title: "Tables",
|
|
1083
1084
|
description: "Flat, aggregate, and pivot tables share this V1 table appearance.",
|
|
1084
1085
|
children: [
|
|
@@ -1190,7 +1191,7 @@ function N({
|
|
|
1190
1191
|
] })
|
|
1191
1192
|
] }),
|
|
1192
1193
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: u }),
|
|
1193
|
-
/* @__PURE__ */ r(
|
|
1194
|
+
/* @__PURE__ */ r(Ge, { className: "mt-5 bg-border/60" })
|
|
1194
1195
|
] });
|
|
1195
1196
|
}
|
|
1196
1197
|
function lr({
|
|
@@ -1356,7 +1357,7 @@ function v({
|
|
|
1356
1357
|
] });
|
|
1357
1358
|
}
|
|
1358
1359
|
function sr(e) {
|
|
1359
|
-
const n =
|
|
1360
|
+
const n = qe(e);
|
|
1360
1361
|
return n ? `#${X(n.r)}${X(n.g)}${X(n.b)}` : "#000000";
|
|
1361
1362
|
}
|
|
1362
1363
|
function X(e) {
|
|
@@ -1432,7 +1433,7 @@ function q({
|
|
|
1432
1433
|
}) {
|
|
1433
1434
|
return /* @__PURE__ */ d("div", { className: "flex h-8 items-center justify-between rounded-control border border-border/60 px-2", children: [
|
|
1434
1435
|
/* @__PURE__ */ r("span", { className: "text-[12px]", children: e }),
|
|
1435
|
-
/* @__PURE__ */ r(
|
|
1436
|
+
/* @__PURE__ */ r(We, { size: "xs", checked: n, onCheckedChange: t })
|
|
1436
1437
|
] });
|
|
1437
1438
|
}
|
|
1438
1439
|
function ur(e) {
|
|
@@ -1453,7 +1454,7 @@ function gr(e) {
|
|
|
1453
1454
|
}
|
|
1454
1455
|
export {
|
|
1455
1456
|
Ne as BRAND_STUDIO_PRESETS,
|
|
1456
|
-
|
|
1457
|
+
Cr as BrandStudioEditor,
|
|
1457
1458
|
nr as applyBrandStudioPreset,
|
|
1458
1459
|
L as buildAppearanceSpecFromDraft,
|
|
1459
1460
|
j as createBrandStudioDraft,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as r, jsxs as s, Fragment as X } from "react/jsx-runtime";
|
|
2
2
|
import ee, { useState as h, useCallback as F, useEffect as ae, useMemo as H } from "react";
|
|
3
|
-
import { u as re,
|
|
4
|
-
import { a as S, L as G, P as he, b as pe, B as j, d as ge, e as V, f as ve } from "./switch-
|
|
3
|
+
import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as _, l as R, m as me, n as fe, o as N } from "./index-CPyEi9gS.js";
|
|
4
|
+
import { a as S, L as G, P as he, b as pe, B as j, d as ge, e as V, f as ve } from "./switch-Dkx2qEOr.js";
|
|
5
5
|
import "./index-CuHybtft.js";
|
|
6
|
-
import { C as be } from "./chevrons-up-down-
|
|
6
|
+
import { C as be } from "./chevrons-up-down-DSvLu4Ye.js";
|
|
7
7
|
function we(n = {}) {
|
|
8
8
|
var C, A, E, L;
|
|
9
9
|
const { authToken: c, tokenProps: e } = re(), p = n.enabled ?? !0, d = (c == null ? void 0 : c.accessToken) ?? null, u = (e == null ? void 0 : e.apiServiceUrl) ?? null, [I, k] = h(!1), [y, b] = h(!1), [m, g] = h(!1), [T, o] = h(null), [v, w] = h(null), P = v || {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-BtqYNH_S.js"),i=require("./switch-fIkmwzUt.js");require("./index-BxM99sFL.js");const G=require("./chevrons-up-down-CnCSGY02.js");function W(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await o.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(o){const r=o instanceof Error?o.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async o=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(o)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const o=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!o.ok){const u=await o.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await o.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(o){const r=o instanceof Error?o.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function q(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function V(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function Z({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=W({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>_(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",o=a.inherited?V(a.inherited.weekStart):"Monday",r=q((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",o]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:i.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:i.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Timezone"}),e.jsxs(i.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(i.PopoverTrigger,{asChild:!0,children:e.jsxs(i.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(G.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(i.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(i.Check,{className:i.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(i.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:i.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(i.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(i.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(i.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=Z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),a=require("./switch-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),a=require("./switch-fIkmwzUt.js"),l=require("./index-BtqYNH_S.js"),le=require("./use-create-flow-overlay-state-c6rCm36x.js"),h=require("react"),bn=require("./use-visual-utils-C_c-aiqi.js");require("./index-BxM99sFL.js");const $s=require("./date-formatter-B4EBSe9C.js");require("./index-DRlMUglg.js");require("react-dom");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|