react-semaphor 0.1.325 → 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 +260 -226
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +7 -6
- package/dist/chunks/{braces-ZjRH2Kl7.js → braces-B6qRDu1H.js} +1 -1
- package/dist/chunks/{braces-C7BeIXvM.js → braces-BGWZEnQJ.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DHhT6Sja.js → calendar-preferences-dialog-CjwbE_82.js} +6 -5
- package/dist/chunks/calendar-preferences-dialog-fkLUMJyR.js +1 -0
- package/dist/chunks/{chevrons-up-down-CA-XvN1o.js → chevrons-up-down-BpsogQvv.js} +1 -1
- package/dist/chunks/{chevrons-up-down-Cuilz9aY.js → chevrons-up-down-xG-bVFD9.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DZiFMK8I.js → dashboard-briefing-launcher-Co57xBfS.js} +2 -2
- package/dist/chunks/{dashboard-briefing-launcher-BzIxRlzW.js → dashboard-briefing-launcher-Cy1nWZRW.js} +714 -719
- package/dist/chunks/{dashboard-controls-DVwsWny9.js → dashboard-controls-BWnVEFJq.js} +10 -9
- package/dist/chunks/{dashboard-controls-BX693lE0.js → dashboard-controls-C7rOGZO-.js} +1 -1
- package/dist/chunks/{dashboard-json-D15C_I9e.js → dashboard-json-BpRNSsF3.js} +7 -6
- package/dist/chunks/dashboard-json-DBPMknGo.js +1 -0
- 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-wQyJEcVH.js → edit-dashboard-visual-CYf26co_.js} +8243 -7784
- package/dist/chunks/index-BD90s-wf.js +1309 -0
- package/dist/chunks/index-BxM99sFL.js +1 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/{index-CffvIaZO.js → index-DTlbYpxd.js} +29440 -28968
- package/dist/chunks/{palette-D96DOM7E.js → palette-CSF7IVJn.js} +1 -1
- package/dist/chunks/{palette-CanPG11m.js → palette-CWgEPBoG.js} +1 -1
- package/dist/chunks/{resource-management-panel-DlnrD0y-.js → resource-management-panel-D6nbfJY3.js} +1 -1
- package/dist/chunks/{resource-management-panel-CLoO2DL3.js → resource-management-panel-D893Onv8.js} +6 -5
- package/dist/chunks/{save-CqrBQKG6.js → save-CtQbSub2.js} +1 -1
- package/dist/chunks/{save-DxkSzUTZ.js → save-DRdFKF57.js} +1 -1
- package/dist/chunks/switch-DJJJD_g1.js +168 -0
- package/dist/chunks/{switch-Deo2Ltmj.js → switch-DKf6vHfP.js} +2222 -2228
- package/dist/chunks/{use-create-flow-overlay-state-DocFanjO.js → use-create-flow-overlay-state-C4LgoK8q.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DsPoCfMu.js → use-create-flow-overlay-state-p21zs2p6.js} +29 -28
- package/dist/chunks/{use-visual-utils-BdO22fQZ.js → use-visual-utils-BKBua6o4.js} +2 -2
- package/dist/chunks/{use-visual-utils-DSbXQQD1.js → use-visual-utils-BqWm0QeW.js} +1 -1
- package/dist/chunks/validators-DDAweCzB.js +371 -0
- 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 +919 -507
- package/dist/data-app-sdk/index.cjs +1 -0
- package/dist/data-app-sdk/index.js +512 -0
- 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 +141 -140
- 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 +326 -2
- package/dist/types/dashboard-authoring.d.ts +102 -3
- package/dist/types/dashboard.d.ts +23 -3
- package/dist/types/data-app-sdk.d.ts +379 -0
- package/dist/types/format-utils.d.ts +25 -0
- package/dist/types/main.d.ts +182 -12
- package/dist/types/shared.d.ts +18 -2
- package/dist/types/surfboard.d.ts +23 -3
- package/dist/types/types.d.ts +38 -4
- package/package.json +6 -1
- package/dist/chunks/calendar-preferences-dialog-BxeROxyq.js +0 -1
- package/dist/chunks/dashboard-json-DxNEFM-p.js +0 -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-90_qEgRc.js +0 -178
- package/dist/chunks/index-YTk9Hab2.js +0 -1303
- package/dist/chunks/switch-BXICAlvS.js +0 -168
package/dist/types/main.d.ts
CHANGED
|
@@ -1170,7 +1170,7 @@ export declare type CancelBriefingRunResponse = {
|
|
|
1170
1170
|
*/
|
|
1171
1171
|
export declare function cancelExport(apiServiceUrl: string, token: string, exportId: string): Promise<void>;
|
|
1172
1172
|
|
|
1173
|
-
export declare type CanonicalFormatSpec = NumericCanonicalFormat | DateCanonicalFormat | StringCanonicalFormat;
|
|
1173
|
+
export declare type CanonicalFormatSpec = NumericCanonicalFormat | DateCanonicalFormat | DurationCanonicalFormat | StringCanonicalFormat;
|
|
1174
1174
|
|
|
1175
1175
|
export declare interface CardConfig {
|
|
1176
1176
|
groupByColumns?: GroupByField[];
|
|
@@ -1771,12 +1771,19 @@ export declare type DashboardBriefingLauncherProps = {
|
|
|
1771
1771
|
client?: Partial<DashboardBriefingLauncherClient>;
|
|
1772
1772
|
};
|
|
1773
1773
|
|
|
1774
|
+
declare type DashboardCardQueryFieldRef = {
|
|
1775
|
+
name: string;
|
|
1776
|
+
source?: DashboardAuthoringDatasetRef;
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1774
1779
|
declare type DashboardCardQueryIntent = {
|
|
1775
1780
|
metric?: string;
|
|
1776
1781
|
metrics?: string[];
|
|
1777
1782
|
dateField?: string;
|
|
1783
|
+
dateFieldRef?: DashboardCardQueryFieldRef;
|
|
1778
1784
|
timeGrain?: 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
1779
1785
|
dimensions?: string[];
|
|
1786
|
+
dimensionRefs?: DashboardCardQueryFieldRef[];
|
|
1780
1787
|
limit?: number;
|
|
1781
1788
|
};
|
|
1782
1789
|
|
|
@@ -1813,18 +1820,13 @@ export declare function DashboardCreateDialogBase({ open, onOpenChange, onCreate
|
|
|
1813
1820
|
export declare interface DashboardCreateDialogBaseProps {
|
|
1814
1821
|
open: boolean;
|
|
1815
1822
|
onOpenChange: (open: boolean) => void;
|
|
1816
|
-
onCreateBlank: (data: DashboardCreateBlankData) => void
|
|
1823
|
+
onCreateBlank: (data: DashboardCreateBlankData) => void | Promise<void>;
|
|
1817
1824
|
onAiCreateSuccess: (result: any) => void;
|
|
1818
1825
|
isCreatingBlank: boolean;
|
|
1819
1826
|
sources: DashboardAuthoringSource[];
|
|
1820
1827
|
sourcesLoading?: boolean;
|
|
1821
|
-
suggestDashboards: (input:
|
|
1822
|
-
|
|
1823
|
-
}) => Promise<DashboardSuggestion[]>;
|
|
1824
|
-
planDashboard: AsyncMutation<{
|
|
1825
|
-
prompt: string;
|
|
1826
|
-
dataset: DashboardAuthoringDatasetRef;
|
|
1827
|
-
}, DashboardPlan>;
|
|
1828
|
+
suggestDashboards: (input: DashboardSuggestionRequest) => Promise<DashboardSuggestion[]>;
|
|
1829
|
+
planDashboard: AsyncMutation<DashboardPlanRequest, DashboardPlan>;
|
|
1828
1830
|
createDashboardFromPlan: AsyncMutation<DashboardPlan, any>;
|
|
1829
1831
|
settingsSlot?: ReactNode;
|
|
1830
1832
|
blankDescription?: string;
|
|
@@ -2056,6 +2058,7 @@ declare type DashboardPlanCard = {
|
|
|
2056
2058
|
priority: number;
|
|
2057
2059
|
section?: string;
|
|
2058
2060
|
query?: DashboardCardQueryIntent;
|
|
2061
|
+
analyticsIntent?: SemaphorAnalyticsIntent;
|
|
2059
2062
|
text?: string;
|
|
2060
2063
|
};
|
|
2061
2064
|
|
|
@@ -2068,6 +2071,15 @@ declare type DashboardPlanFilterInput = {
|
|
|
2068
2071
|
defaultValue?: unknown;
|
|
2069
2072
|
};
|
|
2070
2073
|
|
|
2074
|
+
declare type DashboardPlanRequest = {
|
|
2075
|
+
prompt: string;
|
|
2076
|
+
dataset: DashboardAuthoringDatasetRef;
|
|
2077
|
+
} | {
|
|
2078
|
+
prompt: string;
|
|
2079
|
+
domainId: string;
|
|
2080
|
+
datasetNames?: string[];
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2071
2083
|
declare type DashboardPlanSheet = {
|
|
2072
2084
|
id: string;
|
|
2073
2085
|
title: string;
|
|
@@ -2273,10 +2285,24 @@ declare type DashboardSuggestion = {
|
|
|
2273
2285
|
cardCount: number;
|
|
2274
2286
|
filterCount: number;
|
|
2275
2287
|
prompt: string;
|
|
2288
|
+
datasets?: Array<{
|
|
2289
|
+
name: string;
|
|
2290
|
+
label?: string;
|
|
2291
|
+
}>;
|
|
2292
|
+
relationshipHints?: string[];
|
|
2276
2293
|
};
|
|
2277
2294
|
|
|
2278
2295
|
declare type DashboardSuggestionPreviewKind = 'kpi' | 'line' | 'bar' | 'donut' | 'table';
|
|
2279
2296
|
|
|
2297
|
+
declare type DashboardSuggestionRequest = {
|
|
2298
|
+
dataset: DashboardAuthoringDatasetRef;
|
|
2299
|
+
instruction?: string;
|
|
2300
|
+
} | {
|
|
2301
|
+
domainId: string;
|
|
2302
|
+
datasetNames?: string[];
|
|
2303
|
+
instruction?: string;
|
|
2304
|
+
};
|
|
2305
|
+
|
|
2280
2306
|
export declare const DashboardWC: CustomElementConstructor;
|
|
2281
2307
|
|
|
2282
2308
|
export declare interface DatabaseEntityReference {
|
|
@@ -2304,6 +2330,7 @@ export declare interface DataModelEntityReference extends DatabaseEntityReferenc
|
|
|
2304
2330
|
export declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
2305
2331
|
type: 'dataset';
|
|
2306
2332
|
datasetType: 'physical' | 'virtual';
|
|
2333
|
+
table?: string | null;
|
|
2307
2334
|
datamodelId?: string | null;
|
|
2308
2335
|
sql?: string | null;
|
|
2309
2336
|
id: string;
|
|
@@ -2925,6 +2952,20 @@ export declare type DropdownItem = {
|
|
|
2925
2952
|
|
|
2926
2953
|
export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
|
|
2927
2954
|
|
|
2955
|
+
declare type DurationCanonicalFormat = {
|
|
2956
|
+
type: 'duration';
|
|
2957
|
+
inputUnit?: DurationUnit;
|
|
2958
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
2959
|
+
largestUnit?: DurationUnit;
|
|
2960
|
+
smallestUnit?: DurationUnit;
|
|
2961
|
+
maxUnits?: number;
|
|
2962
|
+
prefix?: string;
|
|
2963
|
+
suffix?: string;
|
|
2964
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
2965
|
+
};
|
|
2966
|
+
|
|
2967
|
+
declare type DurationUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2968
|
+
|
|
2928
2969
|
export declare interface DynamicDrillEvent extends BaseInteractionEvent {
|
|
2929
2970
|
interactionMode: 'dynamicDrill';
|
|
2930
2971
|
filterGroups: ClickFilterConditionGroup[];
|
|
@@ -3434,6 +3475,16 @@ export declare type FormatSpec = {
|
|
|
3434
3475
|
sourceTimezone?: string;
|
|
3435
3476
|
prefix?: string;
|
|
3436
3477
|
suffix?: string;
|
|
3478
|
+
} | {
|
|
3479
|
+
type: 'duration';
|
|
3480
|
+
inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3481
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
3482
|
+
largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3483
|
+
smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3484
|
+
maxUnits?: number;
|
|
3485
|
+
prefix?: string;
|
|
3486
|
+
suffix?: string;
|
|
3487
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
3437
3488
|
} | {
|
|
3438
3489
|
type: 'string';
|
|
3439
3490
|
prefix?: string;
|
|
@@ -4361,17 +4412,126 @@ declare type SemanticExecutionPayload = {
|
|
|
4361
4412
|
}>;
|
|
4362
4413
|
};
|
|
4363
4414
|
|
|
4415
|
+
declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
|
|
4416
|
+
|
|
4364
4417
|
export declare const SemaphorContextProvider: ({ children, dashboardProps, }: {
|
|
4365
4418
|
children: React.ReactNode;
|
|
4366
4419
|
dashboardProps: DashboardProps;
|
|
4367
4420
|
}) => JSX.Element;
|
|
4368
4421
|
|
|
4422
|
+
declare type SemaphorDialect = 'semantic' | 'postgres' | 'mysql' | 'snowflake' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
|
|
4423
|
+
|
|
4424
|
+
declare type SemaphorFieldRef = {
|
|
4425
|
+
name: string;
|
|
4426
|
+
label?: string;
|
|
4427
|
+
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
4428
|
+
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
4429
|
+
source?: SemaphorSourceRef;
|
|
4430
|
+
};
|
|
4431
|
+
|
|
4432
|
+
declare type SemaphorInputBinding = {
|
|
4433
|
+
inputId: string;
|
|
4434
|
+
field?: SemaphorFieldRef;
|
|
4435
|
+
};
|
|
4436
|
+
|
|
4437
|
+
declare type SemaphorInputOptionsIntent = {
|
|
4438
|
+
kind: 'inputOptions';
|
|
4439
|
+
version?: SemaphorProtocolVersion;
|
|
4440
|
+
id?: string;
|
|
4441
|
+
label?: string;
|
|
4442
|
+
source: SemaphorSourceRef;
|
|
4443
|
+
field: SemaphorFieldRef;
|
|
4444
|
+
search?: string;
|
|
4445
|
+
limit?: number;
|
|
4446
|
+
};
|
|
4447
|
+
|
|
4448
|
+
declare type SemaphorMetricIntent = {
|
|
4449
|
+
kind: 'metric';
|
|
4450
|
+
version?: SemaphorProtocolVersion;
|
|
4451
|
+
id?: string;
|
|
4452
|
+
source: SemaphorSourceRef;
|
|
4453
|
+
metric: string;
|
|
4454
|
+
metrics?: string[];
|
|
4455
|
+
label?: string;
|
|
4456
|
+
dateField?: SemaphorFieldRef;
|
|
4457
|
+
timeGrain?: SemaphorTimeGrain;
|
|
4458
|
+
dimensions?: SemaphorFieldRef[];
|
|
4459
|
+
comparison?: {
|
|
4460
|
+
kind: 'previous_period' | 'previous_year' | 'target';
|
|
4461
|
+
targetValue?: number;
|
|
4462
|
+
};
|
|
4463
|
+
inputs?: SemaphorInputBinding[];
|
|
4464
|
+
limit?: number;
|
|
4465
|
+
};
|
|
4466
|
+
|
|
4467
|
+
declare type SemaphorProtocolVersion = 1;
|
|
4468
|
+
|
|
4369
4469
|
declare function SemaphorQueryClient({ children, }: {
|
|
4370
4470
|
children: React.ReactNode;
|
|
4371
4471
|
}): JSX.Element;
|
|
4372
4472
|
export { SemaphorQueryClient as SemaphorDataProvider }
|
|
4373
4473
|
export { SemaphorQueryClient }
|
|
4374
4474
|
|
|
4475
|
+
declare type SemaphorRecordsIntent = {
|
|
4476
|
+
kind: 'records';
|
|
4477
|
+
version?: SemaphorProtocolVersion;
|
|
4478
|
+
source: SemaphorSourceRef;
|
|
4479
|
+
id?: string;
|
|
4480
|
+
label?: string;
|
|
4481
|
+
fields: SemaphorFieldRef[];
|
|
4482
|
+
measures?: string[];
|
|
4483
|
+
dateField?: SemaphorFieldRef;
|
|
4484
|
+
timeGrain?: SemaphorTimeGrain;
|
|
4485
|
+
limit?: number;
|
|
4486
|
+
orderBy?: {
|
|
4487
|
+
field: string;
|
|
4488
|
+
direction: 'asc' | 'desc';
|
|
4489
|
+
};
|
|
4490
|
+
inputs?: SemaphorInputBinding[];
|
|
4491
|
+
};
|
|
4492
|
+
|
|
4493
|
+
declare type SemaphorSourceRef = {
|
|
4494
|
+
kind: 'semantic';
|
|
4495
|
+
domainId: string;
|
|
4496
|
+
datasetName: string;
|
|
4497
|
+
datasetId?: string;
|
|
4498
|
+
label?: string;
|
|
4499
|
+
connectionId?: string;
|
|
4500
|
+
} | {
|
|
4501
|
+
kind: 'physical';
|
|
4502
|
+
connectionId: string;
|
|
4503
|
+
tableName: string;
|
|
4504
|
+
databaseName?: string;
|
|
4505
|
+
schemaName?: string;
|
|
4506
|
+
label?: string;
|
|
4507
|
+
dialect?: SemaphorDialect;
|
|
4508
|
+
} | {
|
|
4509
|
+
kind: 'sql';
|
|
4510
|
+
connectionId: string;
|
|
4511
|
+
sql: string;
|
|
4512
|
+
dialect?: SemaphorDialect;
|
|
4513
|
+
label?: string;
|
|
4514
|
+
};
|
|
4515
|
+
|
|
4516
|
+
declare type SemaphorSqlIntent = {
|
|
4517
|
+
kind: 'sql';
|
|
4518
|
+
version?: SemaphorProtocolVersion;
|
|
4519
|
+
id?: string;
|
|
4520
|
+
label?: string;
|
|
4521
|
+
source: Extract<SemaphorSourceRef, {
|
|
4522
|
+
kind: 'sql' | 'physical';
|
|
4523
|
+
}>;
|
|
4524
|
+
sql?: string;
|
|
4525
|
+
parameters?: Record<string, unknown>;
|
|
4526
|
+
pythonCode?: string;
|
|
4527
|
+
limit?: number;
|
|
4528
|
+
rationale?: string;
|
|
4529
|
+
fields?: SemaphorFieldRef[];
|
|
4530
|
+
inputs?: SemaphorInputBinding[];
|
|
4531
|
+
};
|
|
4532
|
+
|
|
4533
|
+
declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
4534
|
+
|
|
4375
4535
|
/**
|
|
4376
4536
|
* Stable serializer for dashboard dirty checks.
|
|
4377
4537
|
* This consolidates normalization + serialization into one call site, so
|
|
@@ -5142,7 +5302,11 @@ export declare type TDataColumn = {
|
|
|
5142
5302
|
label?: string;
|
|
5143
5303
|
description?: string;
|
|
5144
5304
|
qualifiedFieldName?: string;
|
|
5145
|
-
|
|
5305
|
+
qualifiedEntityName?: string;
|
|
5306
|
+
entityId?: string;
|
|
5307
|
+
entityName?: string;
|
|
5308
|
+
entityType?: EntityType;
|
|
5309
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
5146
5310
|
expression?: string;
|
|
5147
5311
|
calculatedFormula?: CalculatedFieldFormula;
|
|
5148
5312
|
format?: FormatSpec;
|
|
@@ -5157,7 +5321,7 @@ export declare type TDataLabelsConfig = {
|
|
|
5157
5321
|
display?: 'auto' | boolean;
|
|
5158
5322
|
formatMode?: 'inherit' | 'override';
|
|
5159
5323
|
/** @deprecated Use formatMode + formatOptions.type */
|
|
5160
|
-
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'none';
|
|
5324
|
+
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'duration' | 'none';
|
|
5161
5325
|
formatOptions?: TFormatOptions;
|
|
5162
5326
|
font?: {
|
|
5163
5327
|
size?: number;
|
|
@@ -5308,7 +5472,7 @@ export declare type TFilter = {
|
|
|
5308
5472
|
export declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForNull | FilterForDate;
|
|
5309
5473
|
|
|
5310
5474
|
export declare type TFormatOptions = {
|
|
5311
|
-
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date';
|
|
5475
|
+
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date' | 'duration';
|
|
5312
5476
|
decimalPlaces?: number;
|
|
5313
5477
|
minimumFractionDigits?: number;
|
|
5314
5478
|
maximumFractionDigits?: number;
|
|
@@ -5325,6 +5489,11 @@ export declare type TFormatOptions = {
|
|
|
5325
5489
|
timezone?: string;
|
|
5326
5490
|
sourceTimezone?: string;
|
|
5327
5491
|
relative?: boolean;
|
|
5492
|
+
durationInputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
5493
|
+
durationDisplayStyle?: 'compact' | 'digital' | 'long';
|
|
5494
|
+
durationLargestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
5495
|
+
durationSmallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
5496
|
+
durationMaxUnits?: number;
|
|
5328
5497
|
};
|
|
5329
5498
|
|
|
5330
5499
|
export declare type TFrame = {
|
|
@@ -6095,6 +6264,7 @@ export declare function useResourceManagement(resourceType: ResourceType, onDele
|
|
|
6095
6264
|
isFetching: boolean;
|
|
6096
6265
|
error: Error | null;
|
|
6097
6266
|
createResource: UseMutateFunction<any, Error, CreateResourceRequest, void>;
|
|
6267
|
+
createResourceAsync: UseMutateAsyncFunction<any, Error, CreateResourceRequest, void>;
|
|
6098
6268
|
updateResource: UseMutateFunction<any, Error, {
|
|
6099
6269
|
resourceId: string;
|
|
6100
6270
|
data: UpdateResourceRequest | UpdateDashboardTemplateRequest;
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -595,6 +595,7 @@ declare interface DataModelEntityReference extends DatabaseEntityReference {
|
|
|
595
595
|
declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
596
596
|
type: 'dataset';
|
|
597
597
|
datasetType: 'physical' | 'virtual';
|
|
598
|
+
table?: string | null;
|
|
598
599
|
datamodelId?: string | null;
|
|
599
600
|
sql?: string | null;
|
|
600
601
|
id: string;
|
|
@@ -1227,6 +1228,16 @@ declare type FormatSpec = {
|
|
|
1227
1228
|
sourceTimezone?: string;
|
|
1228
1229
|
prefix?: string;
|
|
1229
1230
|
suffix?: string;
|
|
1231
|
+
} | {
|
|
1232
|
+
type: 'duration';
|
|
1233
|
+
inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1234
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
1235
|
+
largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1236
|
+
smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1237
|
+
maxUnits?: number;
|
|
1238
|
+
prefix?: string;
|
|
1239
|
+
suffix?: string;
|
|
1240
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
1230
1241
|
} | {
|
|
1231
1242
|
type: 'string';
|
|
1232
1243
|
prefix?: string;
|
|
@@ -2097,7 +2108,7 @@ declare type TDataLabelsConfig = {
|
|
|
2097
2108
|
display?: 'auto' | boolean;
|
|
2098
2109
|
formatMode?: 'inherit' | 'override';
|
|
2099
2110
|
/** @deprecated Use formatMode + formatOptions.type */
|
|
2100
|
-
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'none';
|
|
2111
|
+
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'duration' | 'none';
|
|
2101
2112
|
formatOptions?: TFormatOptions;
|
|
2102
2113
|
font?: {
|
|
2103
2114
|
size?: number;
|
|
@@ -2235,7 +2246,7 @@ declare type TFilter = {
|
|
|
2235
2246
|
declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForNull | FilterForDate;
|
|
2236
2247
|
|
|
2237
2248
|
declare type TFormatOptions = {
|
|
2238
|
-
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date';
|
|
2249
|
+
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date' | 'duration';
|
|
2239
2250
|
decimalPlaces?: number;
|
|
2240
2251
|
minimumFractionDigits?: number;
|
|
2241
2252
|
maximumFractionDigits?: number;
|
|
@@ -2252,6 +2263,11 @@ declare type TFormatOptions = {
|
|
|
2252
2263
|
timezone?: string;
|
|
2253
2264
|
sourceTimezone?: string;
|
|
2254
2265
|
relative?: boolean;
|
|
2266
|
+
durationInputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2267
|
+
durationDisplayStyle?: 'compact' | 'digital' | 'long';
|
|
2268
|
+
durationLargestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2269
|
+
durationSmallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2270
|
+
durationMaxUnits?: number;
|
|
2255
2271
|
};
|
|
2256
2272
|
|
|
2257
2273
|
declare type TFrame = {
|
|
@@ -822,6 +822,7 @@ declare interface DataModelEntityReference extends DatabaseEntityReference {
|
|
|
822
822
|
declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
823
823
|
type: 'dataset';
|
|
824
824
|
datasetType: 'physical' | 'virtual';
|
|
825
|
+
table?: string | null;
|
|
825
826
|
datamodelId?: string | null;
|
|
826
827
|
sql?: string | null;
|
|
827
828
|
id: string;
|
|
@@ -1478,6 +1479,16 @@ declare type FormatSpec = {
|
|
|
1478
1479
|
sourceTimezone?: string;
|
|
1479
1480
|
prefix?: string;
|
|
1480
1481
|
suffix?: string;
|
|
1482
|
+
} | {
|
|
1483
|
+
type: 'duration';
|
|
1484
|
+
inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1485
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
1486
|
+
largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1487
|
+
smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1488
|
+
maxUnits?: number;
|
|
1489
|
+
prefix?: string;
|
|
1490
|
+
suffix?: string;
|
|
1491
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
1481
1492
|
} | {
|
|
1482
1493
|
type: 'string';
|
|
1483
1494
|
prefix?: string;
|
|
@@ -2512,7 +2523,11 @@ export declare type TDataColumn = {
|
|
|
2512
2523
|
label?: string;
|
|
2513
2524
|
description?: string;
|
|
2514
2525
|
qualifiedFieldName?: string;
|
|
2515
|
-
|
|
2526
|
+
qualifiedEntityName?: string;
|
|
2527
|
+
entityId?: string;
|
|
2528
|
+
entityName?: string;
|
|
2529
|
+
entityType?: EntityType;
|
|
2530
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
2516
2531
|
expression?: string;
|
|
2517
2532
|
calculatedFormula?: CalculatedFieldFormula;
|
|
2518
2533
|
format?: FormatSpec;
|
|
@@ -2527,7 +2542,7 @@ export declare type TDataLabelsConfig = {
|
|
|
2527
2542
|
display?: 'auto' | boolean;
|
|
2528
2543
|
formatMode?: 'inherit' | 'override';
|
|
2529
2544
|
/** @deprecated Use formatMode + formatOptions.type */
|
|
2530
|
-
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'none';
|
|
2545
|
+
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'duration' | 'none';
|
|
2531
2546
|
formatOptions?: TFormatOptions;
|
|
2532
2547
|
font?: {
|
|
2533
2548
|
size?: number;
|
|
@@ -2678,7 +2693,7 @@ declare type TFilter = {
|
|
|
2678
2693
|
declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForNull | FilterForDate;
|
|
2679
2694
|
|
|
2680
2695
|
export declare type TFormatOptions = {
|
|
2681
|
-
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date';
|
|
2696
|
+
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date' | 'duration';
|
|
2682
2697
|
decimalPlaces?: number;
|
|
2683
2698
|
minimumFractionDigits?: number;
|
|
2684
2699
|
maximumFractionDigits?: number;
|
|
@@ -2695,6 +2710,11 @@ export declare type TFormatOptions = {
|
|
|
2695
2710
|
timezone?: string;
|
|
2696
2711
|
sourceTimezone?: string;
|
|
2697
2712
|
relative?: boolean;
|
|
2713
|
+
durationInputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2714
|
+
durationDisplayStyle?: 'compact' | 'digital' | 'long';
|
|
2715
|
+
durationLargestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2716
|
+
durationSmallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2717
|
+
durationMaxUnits?: number;
|
|
2698
2718
|
};
|
|
2699
2719
|
|
|
2700
2720
|
export declare type TFrame = {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -645,7 +645,7 @@ export declare type CancelBriefingRunResponse = {
|
|
|
645
645
|
transitionApplied: boolean;
|
|
646
646
|
};
|
|
647
647
|
|
|
648
|
-
export declare type CanonicalFormatSpec = NumericCanonicalFormat | DateCanonicalFormat | StringCanonicalFormat;
|
|
648
|
+
export declare type CanonicalFormatSpec = NumericCanonicalFormat | DateCanonicalFormat | DurationCanonicalFormat | StringCanonicalFormat;
|
|
649
649
|
|
|
650
650
|
export declare interface CardConfig {
|
|
651
651
|
groupByColumns?: GroupByField[];
|
|
@@ -1277,6 +1277,7 @@ export declare interface DataModelEntityReference extends DatabaseEntityReferenc
|
|
|
1277
1277
|
export declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
1278
1278
|
type: 'dataset';
|
|
1279
1279
|
datasetType: 'physical' | 'virtual';
|
|
1280
|
+
table?: string | null;
|
|
1280
1281
|
datamodelId?: string | null;
|
|
1281
1282
|
sql?: string | null;
|
|
1282
1283
|
id: string;
|
|
@@ -1736,6 +1737,20 @@ declare interface DrillUpInteraction {
|
|
|
1736
1737
|
|
|
1737
1738
|
export declare type DroppableId = 'droppable-group-by' | 'droppable-metric';
|
|
1738
1739
|
|
|
1740
|
+
declare type DurationCanonicalFormat = {
|
|
1741
|
+
type: 'duration';
|
|
1742
|
+
inputUnit?: DurationUnit;
|
|
1743
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
1744
|
+
largestUnit?: DurationUnit;
|
|
1745
|
+
smallestUnit?: DurationUnit;
|
|
1746
|
+
maxUnits?: number;
|
|
1747
|
+
prefix?: string;
|
|
1748
|
+
suffix?: string;
|
|
1749
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
declare type DurationUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
1753
|
+
|
|
1739
1754
|
declare interface DynamicDrillInteraction {
|
|
1740
1755
|
mode: 'dynamicDrill';
|
|
1741
1756
|
/**
|
|
@@ -2014,6 +2029,16 @@ export declare type FormatSpec = {
|
|
|
2014
2029
|
sourceTimezone?: string;
|
|
2015
2030
|
prefix?: string;
|
|
2016
2031
|
suffix?: string;
|
|
2032
|
+
} | {
|
|
2033
|
+
type: 'duration';
|
|
2034
|
+
inputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2035
|
+
outputStyle?: 'compact' | 'digital' | 'long';
|
|
2036
|
+
largestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2037
|
+
smallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
2038
|
+
maxUnits?: number;
|
|
2039
|
+
prefix?: string;
|
|
2040
|
+
suffix?: string;
|
|
2041
|
+
negativeStyle?: 'minus' | 'parentheses';
|
|
2017
2042
|
} | {
|
|
2018
2043
|
type: 'string';
|
|
2019
2044
|
prefix?: string;
|
|
@@ -3282,7 +3307,11 @@ export declare type TDataColumn = {
|
|
|
3282
3307
|
label?: string;
|
|
3283
3308
|
description?: string;
|
|
3284
3309
|
qualifiedFieldName?: string;
|
|
3285
|
-
|
|
3310
|
+
qualifiedEntityName?: string;
|
|
3311
|
+
entityId?: string;
|
|
3312
|
+
entityName?: string;
|
|
3313
|
+
entityType?: EntityType;
|
|
3314
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
3286
3315
|
expression?: string;
|
|
3287
3316
|
calculatedFormula?: CalculatedFieldFormula;
|
|
3288
3317
|
format?: FormatSpec;
|
|
@@ -3297,7 +3326,7 @@ export declare type TDataLabelsConfig = {
|
|
|
3297
3326
|
display?: 'auto' | boolean;
|
|
3298
3327
|
formatMode?: 'inherit' | 'override';
|
|
3299
3328
|
/** @deprecated Use formatMode + formatOptions.type */
|
|
3300
|
-
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'none';
|
|
3329
|
+
format?: 'auto' | 'number' | 'currency' | 'percent' | 'date' | 'scientific' | 'duration' | 'none';
|
|
3301
3330
|
formatOptions?: TFormatOptions;
|
|
3302
3331
|
font?: {
|
|
3303
3332
|
size?: number;
|
|
@@ -3448,7 +3477,7 @@ export declare type TFilter = {
|
|
|
3448
3477
|
export declare type TFilterValue = FilterForString | FilterForEqual | FilterForCompare | FilterForBetween | FilterForIn | FilterForNull | FilterForDate;
|
|
3449
3478
|
|
|
3450
3479
|
export declare type TFormatOptions = {
|
|
3451
|
-
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date';
|
|
3480
|
+
type?: 'auto' | 'number' | 'currency' | 'percent' | 'scientific' | 'date' | 'duration';
|
|
3452
3481
|
decimalPlaces?: number;
|
|
3453
3482
|
minimumFractionDigits?: number;
|
|
3454
3483
|
maximumFractionDigits?: number;
|
|
@@ -3465,6 +3494,11 @@ export declare type TFormatOptions = {
|
|
|
3465
3494
|
timezone?: string;
|
|
3466
3495
|
sourceTimezone?: string;
|
|
3467
3496
|
relative?: boolean;
|
|
3497
|
+
durationInputUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3498
|
+
durationDisplayStyle?: 'compact' | 'digital' | 'long';
|
|
3499
|
+
durationLargestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3500
|
+
durationSmallestUnit?: 'millisecond' | 'second' | 'minute' | 'hour' | 'day';
|
|
3501
|
+
durationMaxUnits?: number;
|
|
3468
3502
|
};
|
|
3469
3503
|
|
|
3470
3504
|
export declare type TFrame = {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "support@semaphor.cloud"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.327",
|
|
9
9
|
"description": "Fully interactive and customizable dashboards for your apps.",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"react",
|
|
@@ -62,6 +62,11 @@
|
|
|
62
62
|
"import": "./dist/analytics-protocol/index.js",
|
|
63
63
|
"require": "./dist/analytics-protocol/index.cjs"
|
|
64
64
|
},
|
|
65
|
+
"./data-app-sdk": {
|
|
66
|
+
"types": "./dist/types/data-app-sdk.d.ts",
|
|
67
|
+
"import": "./dist/data-app-sdk/index.js",
|
|
68
|
+
"require": "./dist/data-app-sdk/index.cjs"
|
|
69
|
+
},
|
|
65
70
|
"./appearance": {
|
|
66
71
|
"types": "./dist/types/appearance.d.ts",
|
|
67
72
|
"import": "./dist/appearance/index.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-YTk9Hab2.js"),i=require("./switch-BXICAlvS.js"),G=require("./chevrons-up-down-Cuilz9aY.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 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react"),s=require("./switch-BXICAlvS.js");require("./index-YTk9Hab2.js");require("./index-DRlMUglg.js");require("react-dom");function b(){const t=s.useDashboardStore(e=>e.dashboard),c=s.useDashboardStore(e=>e.actions.setDashboard),u=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),a=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,d]=o.useState(a),n=o.useRef(a);return o.useEffect(()=>{a!==n.current&&(d(a),n.current=a)},[a]),r.jsxs("div",{className:s.cn("relative p-2",{hidden:!u}),children:[r.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[r.jsx(s.X,{className:"mr-2 h-4 w-4"}),"Close"]}),r.jsx("div",{className:"h-[550px] overflow-hidden",children:r.jsx(s.CodeEditor,{value:l,onValueChange:e=>{d(e);try{const i=JSON.parse(e);n.current=JSON.stringify(i,null,2),c(i)}catch{}},language:"json"})})]})}exports.default=b;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./index-D7KJindZ.js");function x(r,e){const t=u.toDate(r),a=u.toDate(e),c=t.getTime()-a.getTime();return c<0?-1:c>0?1:c}function Z(r){return u.constructFrom(r,Date.now())}function O(r,e){const t=u.toDate(r),a=u.toDate(e),c=t.getFullYear()-a.getFullYear(),f=t.getMonth()-a.getMonth();return c*12+f}function _(r){return e=>{const a=(r?Math[r]:Math.trunc)(e);return a===0?0:a}}function v(r,e){return+u.toDate(r)-+u.toDate(e)}function C(r){const e=u.toDate(r);return e.setHours(23,59,59,999),e}function X(r){const e=u.toDate(r),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function R(r){const e=u.toDate(r);return+C(e)==+X(e)}function U(r,e){const t=u.toDate(r),a=u.toDate(e),c=x(t,a),f=Math.abs(O(t,a));let n;if(f<1)n=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-c*f);let i=x(t,a)===-c;R(u.toDate(r))&&f===1&&x(r,a)===1&&(i=!1),n=c*(f-Number(i))}return n===0?0:n}function A(r,e,t){const a=v(r,e)/1e3;return _(t==null?void 0:t.roundingMethod)(a)}function W(r,e,t){const a=u.getDefaultOptions(),c=(t==null?void 0:t.locale)??a.locale??u.enUS,f=2520,n=x(r,e);if(isNaN(n))throw new RangeError("Invalid time value");const i=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:n});let s,D;n>0?(s=u.toDate(e),D=u.toDate(r)):(s=u.toDate(r),D=u.toDate(e));const m=A(D,s),T=(u.getTimezoneOffsetInMilliseconds(D)-u.getTimezoneOffsetInMilliseconds(s))/1e3,l=Math.round((m-T)/60);let d;if(l<2)return t!=null&&t.includeSeconds?m<5?c.formatDistance("lessThanXSeconds",5,i):m<10?c.formatDistance("lessThanXSeconds",10,i):m<20?c.formatDistance("lessThanXSeconds",20,i):m<40?c.formatDistance("halfAMinute",0,i):m<60?c.formatDistance("lessThanXMinutes",1,i):c.formatDistance("xMinutes",1,i):l===0?c.formatDistance("lessThanXMinutes",1,i):c.formatDistance("xMinutes",l,i);if(l<45)return c.formatDistance("xMinutes",l,i);if(l<90)return c.formatDistance("aboutXHours",1,i);if(l<u.minutesInDay){const g=Math.round(l/60);return c.formatDistance("aboutXHours",g,i)}else{if(l<f)return c.formatDistance("xDays",1,i);if(l<u.minutesInMonth){const g=Math.round(l/u.minutesInDay);return c.formatDistance("xDays",g,i)}else if(l<u.minutesInMonth*2)return d=Math.round(l/u.minutesInMonth),c.formatDistance("aboutXMonths",d,i)}if(d=U(D,s),d<12){const g=Math.round(l/u.minutesInMonth);return c.formatDistance("xMonths",g,i)}else{const g=d%12,M=Math.trunc(d/12);return g<3?c.formatDistance("aboutXYears",M,i):g<9?c.formatDistance("overXYears",M,i):c.formatDistance("almostXYears",M+1,i)}}function L(r,e){return W(r,Z(r),e)}function $(r){if(!r)return!1;const e=r.toLowerCase().replace("_","-");return e==="en-in"||e.startsWith("en-in-")}function G(r,e){const t=Math.abs(r);return t>=1e12?{divisor:1e12,suffix:"T"}:t>=1e9?{divisor:1e9,suffix:"B"}:$(e)&&t>=1e7?{divisor:1e7,suffix:"Cr"}:t>=1e6?{divisor:1e6,suffix:"M"}:$(e)&&t>=1e5?{divisor:1e5,suffix:"L"}:t>=1e3?{divisor:1e3,suffix:"K"}:{divisor:1,suffix:""}}function y(r,e){try{const t=h(e);return G(r,t)}catch{return G(r,"en-US")}}function V(r){try{return new Intl.NumberFormat(r),!0}catch{return!1}}function h(r){return r&&V(r)?r:"en-US"}function N(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale);let a=r;if(e!=null&&e.multiplyBy&&(a*=e.multiplyBy),e!=null&&e.useSuffix){const{divisor:f,suffix:n}=y(a,t);a=a/f;const i=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(a);return`${(e==null?void 0:e.prefix)??""}${i}${n}${(e==null?void 0:e.suffix)??""}`}const c=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(a);if(e!=null&&e.negativeInParentheses&&a<0){const f=c.replace("-","");return`(${(e==null?void 0:e.prefix)??""}${f}${(e==null?void 0:e.suffix)??""})`}return`${(e==null?void 0:e.prefix)??""}${c}${(e==null?void 0:e.suffix)??""}`}function P(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale),a=(e==null?void 0:e.currency)||"USD",c=r<0,f=!!(e!=null&&e.negativeInParentheses&&c),n=f?Math.abs(r):r;try{if(e!=null&&e.useSuffix){const{divisor:s,suffix:D}=y(n,t),m=n/s,l=`${new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(m)}${D}`;return f?`(${l})`:l}const i=new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(n);return f?`(${i})`:i}catch{const i=Math.abs(r),s=e!=null&&e.useSuffix?y(i,t):{divisor:1,suffix:""},D=N(i/s.divisor,{locale:t,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}),m=`${a} ${D}${s.suffix}`;return c?e!=null&&e.negativeInParentheses?`(${m})`:`-${m}`:m}}function S(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale),c=(e==null?void 0:e.alreadyPercent)??(e==null?void 0:e.percentValueMode)==="whole"?r/100:r;return new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(c)}function w(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale);return new Intl.NumberFormat(t,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r)}function Y(r,e,t="en-US"){if(r==null||isNaN(r))return"";const a=h((e==null?void 0:e.locale)||t),c=(e==null?void 0:e.style)||"decimal";if(c==="percent"){const n=((e==null?void 0:e.percentValueMode)??"whole")==="whole"?r/100:r;return new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(n)}return c==="currency"?new Intl.NumberFormat(a,{style:"currency",currency:(e==null?void 0:e.currency)||"USD",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r):c==="scientific"?w(r,{locale:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}):new Intl.NumberFormat(a,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r)}function B(r,e,t){const a={style:e==="currency"?"currency":e==="percent"?"percent":"decimal",locale:t==null?void 0:t.locale,currency:t==null?void 0:t.currency,minimumFractionDigits:t==null?void 0:t.decimalPlaces,maximumFractionDigits:t==null?void 0:t.decimalPlaces,useSuffix:t==null?void 0:t.useSuffix,prefix:t==null?void 0:t.prefix,suffix:t==null?void 0:t.suffix,negativeInParentheses:t==null?void 0:t.negativeInParentheses,multiplyBy:t==null?void 0:t.multiplyBy};switch(e){case"currency":return P(r,a);case"percent":return S(r,a);case"scientific":return w(r,a);default:return N(r,a)}}function k(r,e){return r&&r!=="auto"?r:e}function H(r,e=new Date){try{const t={timeZone:r,timeZoneName:"short"},c=new Intl.DateTimeFormat("en-US",t).formatToParts(e).find(f=>f.type==="timeZoneName");return(c==null?void 0:c.value)||r}catch{return r}}function E(r){try{const e={timeZone:r,timeZoneName:"long"},a=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(c=>c.type==="timeZoneName");return(a==null?void 0:a.value)||r}catch{return r}}function I(r,e="auto"){if(!r)return new Date(NaN);const t=r.endsWith("Z"),a=/[+-]\d{2}:?\d{2}$/.test(r),c=/\([A-Z]{3,4}\)$/.test(r);if(e==="auto")return t||a||c?new Date(r):new Date(r+"Z");if(e==="local"){if(t||a){const f=r.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(f)}return new Date(r)}else return e==="UTC"?t?new Date(r):a?new Date(r):new Date(r+"Z"):t||a||c?new Date(r):u.fromZonedTime(r,e)}const j="MM/dd/yyyy",q=(r,e,t,a="auto")=>{if(!r)return"";try{const c=I(r,a);if(isNaN(c.getTime()))return r;const n=(e&&e.trim()?e:j).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return t&&t!=="auto"?u.formatInTimeZone(c,t,n):u.format(c,n)}catch(c){return console.error("Date formatting error:",c),r}},K=(r,e="auto")=>{if(!r)return"";try{const t=I(r,e);return isNaN(t.getTime())?r:L(t,{addSuffix:!0})}catch(t){return console.error("Relative time formatting error:",t),r}};exports.formatCurrency=P;exports.formatDate=q;exports.formatDistanceToNow=L;exports.formatNumber=N;exports.formatNumberCustom=B;exports.formatNumberWithColumnSettings=Y;exports.formatPercent=S;exports.formatRelativeTime=K;exports.formatScientific=w;exports.getTimezoneAbbreviation=H;exports.getTimezoneName=E;exports.parseWithSourceTimezone=I;exports.resolveTimezone=k;
|