react-semaphor 0.1.326 → 0.1.327
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 +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/chunks/{braces-dHeaioTd.js → braces-B6qRDu1H.js} +1 -1
- package/dist/chunks/{braces-DVaMJoCd.js → braces-BGWZEnQJ.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog--2jD-eKu.js → calendar-preferences-dialog-CjwbE_82.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-mqU_uOmY.js → calendar-preferences-dialog-fkLUMJyR.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CLbzBHoI.js → chevrons-up-down-BpsogQvv.js} +1 -1
- package/dist/chunks/{chevrons-up-down-DNQE-uEp.js → chevrons-up-down-xG-bVFD9.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DguNfFr8.js → dashboard-briefing-launcher-Co57xBfS.js} +2 -2
- package/dist/chunks/{dashboard-briefing-launcher-DsjXUPFq.js → dashboard-briefing-launcher-Cy1nWZRW.js} +713 -719
- package/dist/chunks/{dashboard-controls-DgNkM1yT.js → dashboard-controls-BWnVEFJq.js} +7 -7
- package/dist/chunks/{dashboard-controls-XCa9PZuU.js → dashboard-controls-C7rOGZO-.js} +1 -1
- package/dist/chunks/{dashboard-json-DkA6Bf0Y.js → dashboard-json-BpRNSsF3.js} +2 -2
- package/dist/chunks/{dashboard-json-DiBd65Xf.js → dashboard-json-DBPMknGo.js} +1 -1
- package/dist/chunks/date-formatter-B4EBSe9C.js +1 -0
- package/dist/chunks/date-formatter-CzcPZx39.js +416 -0
- package/dist/chunks/edit-dashboard-visual-B2vkIKEa.js +178 -0
- package/dist/chunks/{edit-dashboard-visual-Q5hW5MXk.js → edit-dashboard-visual-CYf26co_.js} +8241 -7784
- package/dist/chunks/{index-B1-46PoR.js → index-BD90s-wf.js} +208 -202
- package/dist/chunks/{index-DwfDwtv2.js → index-DTlbYpxd.js} +26702 -26334
- package/dist/chunks/{palette-DtmNws9a.js → palette-CSF7IVJn.js} +1 -1
- package/dist/chunks/{palette-DpcvHAiY.js → palette-CWgEPBoG.js} +1 -1
- package/dist/chunks/{resource-management-panel-CGwWKZOP.js → resource-management-panel-D6nbfJY3.js} +1 -1
- package/dist/chunks/{resource-management-panel-D2oAQkKi.js → resource-management-panel-D893Onv8.js} +3 -3
- package/dist/chunks/{save-Cv_XRb94.js → save-CtQbSub2.js} +1 -1
- package/dist/chunks/{save-BY7WF62U.js → save-DRdFKF57.js} +1 -1
- package/dist/chunks/switch-DJJJD_g1.js +168 -0
- package/dist/chunks/{switch-j3AThLFk.js → switch-DKf6vHfP.js} +2447 -2405
- package/dist/chunks/{use-create-flow-overlay-state-BQPXP0AM.js → use-create-flow-overlay-state-C4LgoK8q.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CP6GDQAX.js → use-create-flow-overlay-state-p21zs2p6.js} +4 -4
- package/dist/chunks/{use-visual-utils-CSXU-96k.js → use-visual-utils-BKBua6o4.js} +2 -2
- package/dist/chunks/{use-visual-utils-NpOW5uZ1.js → use-visual-utils-BqWm0QeW.js} +1 -1
- package/dist/chunks/{validators-DvTxl9i0.js → validators-DDAweCzB.js} +67 -48
- package/dist/chunks/validators-odlRJblR.js +2 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +907 -527
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.cjs +4 -4
- package/dist/format-utils/index.js +22 -21
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +1 -0
- package/dist/types/dashboard-authoring.d.ts +79 -2
- package/dist/types/dashboard.d.ts +17 -2
- package/dist/types/data-app-sdk.d.ts +1 -0
- package/dist/types/format-utils.d.ts +25 -0
- package/dist/types/main.d.ts +65 -10
- package/dist/types/shared.d.ts +17 -2
- package/dist/types/surfboard.d.ts +17 -2
- package/dist/types/types.d.ts +32 -3
- package/package.json +1 -1
- package/dist/chunks/date-formatter-D9Bvw5Qk.js +0 -1
- package/dist/chunks/date-formatter-DyIOb6uC.js +0 -333
- package/dist/chunks/edit-dashboard-visual-BC9eOc4U.js +0 -178
- package/dist/chunks/switch-5aQ_jcLH.js +0 -168
- package/dist/chunks/validators-DJUMR5An.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../chunks/validators-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../chunks/validators-odlRJblR.js");function o(e){return typeof e=="string"?e.trim().toLowerCase():""}function f(e){return String(e.column_name||e.name||e.qualifiedFieldName||"")}function v(e){return Array.from(new Set([e.column_name,e.name,e.qualifiedFieldName,e.alias].filter(i=>typeof i=="string"&&i.trim().length>0).map(i=>i.trim())))}function m(e){const i=o(e);return i?i.includes("int")||i.includes("numeric")||i.includes("decimal")||i.includes("double")||i.includes("float")||i.includes("number")||i.includes("real")||i.includes("money")?"number":i.includes("timestamp")||i.includes("datetime")||i==="time"||i.startsWith("time ")?"datetime":i.includes("date")?"date":i.includes("bool")?"boolean":"string":"unknown"}function A(e){const i=m(e);return i==="date"||i==="datetime"}function u(e){return A(e.dataType||e.data_type)}function p(e){const i=b(e);return i==="id"||i==="row_id"}function l(e){const i=b(e);return p(e)||i.endsWith("_id")||i.endsWith("_key")||i.endsWith("_number")}function b(e){return o(f(e)||e.name||e.alias).replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function g(e,i={}){const n=o(e.role);return n==="metric"||n==="measure"?!i.excludeIdentifiers||!l(e):n==="groupby"||n==="dimension"||n==="date"||n==="id"?!1:m(e.dataType||e.data_type)==="number"&&(!i.excludeIdentifiers||!l(e))}function T(e){return!g(e)&&!u(e)}function F(e){return[e.column_name,e.name,e.label,e.alias,e.qualifiedFieldName].filter(i=>typeof i=="string"&&i.trim().length>0).map(i=>o(i).replace(/[^a-z0-9]+/g," ")).join(" ")}function d(e,i){return i.some(n=>{const t=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|\\s)${t}(\\s|$)`,"i").test(e)})}function C(e){const i=F(e);if(i)return d(i,["pct","percent","percentage","rate","ratio","share","conversion","retention","churn","growth","margin rate","margin pct","margin percent","margin percentage"])?{type:"percent",minimumFractionDigits:0,maximumFractionDigits:1,percentValueMode:"fraction"}:d(i,["revenue","sales","profit","arr","mrr","gmv","amount","price","cost","spend","expense","budget","income","value","booking","bookings"])?{type:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:1,compact:!0}:d(i,["count","quantity","orders","order","users","customers","tickets","units","sessions","visits","items","rows"])?{type:"number",minimumFractionDigits:0,maximumFractionDigits:0,compact:!0}:{type:"number",minimumFractionDigits:0,maximumFractionDigits:1,compact:!0}}function D(e){const i=new Set,n=new Set,t=new Set;for(const s of e){if(p(s))continue;const c=v(s);if(c.length!==0){if(u(s)){c.forEach(a=>n.add(a));continue}if(g(s,{excludeIdentifiers:!0})){c.forEach(a=>i.add(a));continue}c.forEach(a=>t.add(a))}}return{validMetricCandidates:Array.from(i).sort(),validDateCandidates:Array.from(n).sort(),validDimensionCandidates:Array.from(t).sort()}}const r={kind:"semantic",domainId:"domain_sales",datasetName:"orders",connectionId:"conn_sales",label:"Orders"},_={revenueKpi:{version:1,kind:"metric",id:"revenue-kpi",label:"Revenue",source:r,metric:"revenue",comparison:{kind:"previous_period"},limit:1},revenueTrend:{version:1,kind:"records",id:"revenue-trend",label:"Revenue trend",source:r,fields:[{name:"order_date",role:"date",dataType:"date",label:"Order Date"}],measures:["revenue"],dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"month",limit:100},topCustomersRecords:{version:1,kind:"records",id:"top-customers",label:"Top customers",source:r,fields:[{name:"customer_name",role:"dimension",dataType:"string"},{name:"segment",role:"dimension",dataType:"string"},{name:"revenue",role:"measure",dataType:"number"}],measures:["revenue"],orderBy:{field:"revenue",direction:"desc"},limit:20},regionInputOptions:{version:1,kind:"inputOptions",id:"region-options",label:"Region options",source:r,field:{name:"region",role:"dimension",dataType:"string"},limit:100},previousPeriodRevenueComparison:{version:1,kind:"metric",id:"revenue-previous-period",label:"Revenue previous period comparison",source:r,metric:"revenue",dateField:{name:"order_date",role:"date",dataType:"date"},timeGrain:"week",comparison:{kind:"previous_period"},limit:100},boundedSqlRanking:{version:1,kind:"sql",id:"top-customer-ranking-sql",label:"Top customer ranking SQL",source:{kind:"physical",connectionId:"conn_sales",databaseName:"warehouse",schemaName:"public",tableName:"orders",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.validateSemaphorAnalyticsIntent=y.validateSemaphorAnalyticsIntent;exports.validateSemaphorDashboardIntent=y.validateSemaphorDashboardIntent;exports.SEMAPHOR_ANALYTICS_INTENT_FIXTURES=_;exports.buildAnalyticsCatalogFieldSummary=D;exports.getAnalyticsCatalogFieldCandidates=v;exports.getAnalyticsCatalogFieldName=f;exports.inferAnalyticsMetricFormat=C;exports.isAnalyticsCatalogDateField=u;exports.isAnalyticsCatalogDimensionField=T;exports.isAnalyticsCatalogMetricField=g;exports.isAnalyticsDateLikeDataType=A;exports.isAnalyticsMetricIdentifierField=l;exports.isAnalyticsTechnicalIdentifierField=p;exports.normalizeAnalyticsCatalogDataType=m;exports.normalizeAnalyticsCatalogName=o;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),d=require("../chunks/switch-DJJJD_g1.js"),A=require("../chunks/index-DRlMUglg.js");require("../chunks/index-BxM99sFL.js");const V=require("../chunks/palette-CWgEPBoG.js"),ge=require("../chunks/braces-BGWZEnQJ.js"),be=require("../chunks/save-CtQbSub2.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,11 +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, 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-
|
|
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-DKf6vHfP.js";
|
|
4
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 Ke } from "../chunks/braces-
|
|
8
|
-
import { S as Qe } from "../chunks/save-
|
|
6
|
+
import { P as W } from "../chunks/palette-CSF7IVJn.js";
|
|
7
|
+
import { B as Ke } from "../chunks/braces-B6qRDu1H.js";
|
|
8
|
+
import { S as Qe } from "../chunks/save-DRdFKF57.js";
|
|
9
9
|
/**
|
|
10
10
|
* @license lucide-react v0.453.0 - ISC
|
|
11
11
|
*
|
|
@@ -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, 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-
|
|
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-DTlbYpxd.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-DKf6vHfP.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-BpsogQvv.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-BD90s-wf.js"),i=require("./switch-DJJJD_g1.js");require("./index-BxM99sFL.js");const G=require("./chevrons-up-down-xG-bVFD9.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;
|