react-semaphor 0.1.325 → 0.1.326
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-C7BeIXvM.js → braces-DVaMJoCd.js} +1 -1
- package/dist/chunks/{braces-ZjRH2Kl7.js → braces-dHeaioTd.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-DHhT6Sja.js → calendar-preferences-dialog--2jD-eKu.js} +6 -5
- package/dist/chunks/calendar-preferences-dialog-mqU_uOmY.js +1 -0
- package/dist/chunks/{chevrons-up-down-CA-XvN1o.js → chevrons-up-down-CLbzBHoI.js} +1 -1
- package/dist/chunks/{chevrons-up-down-Cuilz9aY.js → chevrons-up-down-DNQE-uEp.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DZiFMK8I.js → dashboard-briefing-launcher-DguNfFr8.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BzIxRlzW.js → dashboard-briefing-launcher-DsjXUPFq.js} +29 -28
- package/dist/chunks/{dashboard-controls-DVwsWny9.js → dashboard-controls-DgNkM1yT.js} +10 -9
- package/dist/chunks/{dashboard-controls-BX693lE0.js → dashboard-controls-XCa9PZuU.js} +1 -1
- package/dist/chunks/dashboard-json-DiBd65Xf.js +1 -0
- package/dist/chunks/{dashboard-json-D15C_I9e.js → dashboard-json-DkA6Bf0Y.js} +7 -6
- package/dist/chunks/{edit-dashboard-visual-90_qEgRc.js → edit-dashboard-visual-BC9eOc4U.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-wQyJEcVH.js → edit-dashboard-visual-Q5hW5MXk.js} +11 -9
- package/dist/chunks/{index-YTk9Hab2.js → index-B1-46PoR.js} +213 -213
- package/dist/chunks/index-BxM99sFL.js +1 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/{index-CffvIaZO.js → index-DwfDwtv2.js} +20578 -20474
- package/dist/chunks/{palette-CanPG11m.js → palette-DpcvHAiY.js} +1 -1
- package/dist/chunks/{palette-D96DOM7E.js → palette-DtmNws9a.js} +1 -1
- package/dist/chunks/{resource-management-panel-DlnrD0y-.js → resource-management-panel-CGwWKZOP.js} +1 -1
- package/dist/chunks/{resource-management-panel-CLoO2DL3.js → resource-management-panel-D2oAQkKi.js} +6 -5
- package/dist/chunks/{save-DxkSzUTZ.js → save-BY7WF62U.js} +1 -1
- package/dist/chunks/{save-CqrBQKG6.js → save-Cv_XRb94.js} +1 -1
- package/dist/chunks/{switch-BXICAlvS.js → switch-5aQ_jcLH.js} +39 -39
- package/dist/chunks/{switch-Deo2Ltmj.js → switch-j3AThLFk.js} +2580 -2628
- package/dist/chunks/{use-create-flow-overlay-state-DocFanjO.js → use-create-flow-overlay-state-BQPXP0AM.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DsPoCfMu.js → use-create-flow-overlay-state-CP6GDQAX.js} +29 -28
- package/dist/chunks/{use-visual-utils-BdO22fQZ.js → use-visual-utils-CSXU-96k.js} +2 -2
- package/dist/chunks/{use-visual-utils-DSbXQQD1.js → use-visual-utils-NpOW5uZ1.js} +1 -1
- package/dist/chunks/validators-DJUMR5An.js +2 -0
- package/dist/chunks/validators-DvTxl9i0.js +352 -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 +168 -136
- package/dist/data-app-sdk/index.cjs +1 -0
- package/dist/data-app-sdk/index.js +512 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +141 -140
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +325 -2
- package/dist/types/dashboard-authoring.d.ts +23 -1
- package/dist/types/dashboard.d.ts +6 -1
- package/dist/types/data-app-sdk.d.ts +378 -0
- package/dist/types/main.d.ts +117 -2
- package/dist/types/shared.d.ts +1 -0
- package/dist/types/surfboard.d.ts +6 -1
- package/dist/types/types.d.ts +6 -1
- 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
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare function createSemaphorDataAppExecutor(): SemaphorDataAppExecutor;
|
|
5
|
+
|
|
6
|
+
export declare function hasSemaphorInputValue(value: unknown): boolean;
|
|
7
|
+
|
|
8
|
+
export declare function normalizeSemaphorInputOptions(options?: Array<{
|
|
9
|
+
label: string;
|
|
10
|
+
value: SemaphorDataAppOptionValue;
|
|
11
|
+
} | SemaphorDataAppOptionValue>): {
|
|
12
|
+
label: string;
|
|
13
|
+
value: SemaphorDataAppOptionValue;
|
|
14
|
+
}[];
|
|
15
|
+
|
|
16
|
+
declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
|
|
17
|
+
|
|
18
|
+
export declare type SemaphorDataAppControlInputSpec<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue> = SemaphorDataAppInputBase<TValue> & {
|
|
19
|
+
kind: 'control';
|
|
20
|
+
role: SemaphorDataAppControlRole;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export declare type SemaphorDataAppControlRole = 'grain' | 'metric' | 'dimension' | 'aggregation' | 'sqlParam';
|
|
24
|
+
|
|
25
|
+
export declare type SemaphorDataAppExecutor = {
|
|
26
|
+
executeMetric(intent: SemaphorMetricIntent, context: SemaphorDataAppExecutorContext): Promise<SemaphorDataAppMetricData>;
|
|
27
|
+
executeRecords<TRecord extends Record<string, unknown> = Record<string, unknown>>(intent: SemaphorRecordsIntent, context: SemaphorDataAppExecutorContext): Promise<SemaphorDataAppRecordsData<TRecord>>;
|
|
28
|
+
executeInputOptions(intent: Extract<SemaphorAnalyticsIntent, {
|
|
29
|
+
kind: 'inputOptions';
|
|
30
|
+
}>, context: SemaphorDataAppExecutorContext): Promise<SemaphorDataAppInputOptionsData>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export declare type SemaphorDataAppExecutorContext = {
|
|
34
|
+
token?: string;
|
|
35
|
+
apiBaseUrl?: string;
|
|
36
|
+
activeInputs?: SemaphorDataAppInputSnapshot[];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export declare type SemaphorDataAppFieldSpec = string | SemaphorFieldRef;
|
|
40
|
+
|
|
41
|
+
export declare type SemaphorDataAppFilterInputSpec<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue> = SemaphorDataAppInputBase<TValue> & {
|
|
42
|
+
kind: 'filter';
|
|
43
|
+
field: SemaphorDataAppFieldSpec;
|
|
44
|
+
operator?: SemaphorInputOperator;
|
|
45
|
+
multi?: boolean;
|
|
46
|
+
source?: SemaphorSourceRef;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare type SemaphorDataAppInputBase<TValue extends SemaphorDataAppInputValue> = {
|
|
50
|
+
id: string;
|
|
51
|
+
label?: string;
|
|
52
|
+
value?: TValue;
|
|
53
|
+
defaultValue?: TValue;
|
|
54
|
+
onValueChange?: (value: TValue | undefined) => void;
|
|
55
|
+
options?: Array<SemaphorDataAppInputOption | SemaphorDataAppOptionValue>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export declare type SemaphorDataAppInputHandle<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue> = {
|
|
59
|
+
id: string;
|
|
60
|
+
kind: 'filter' | 'control';
|
|
61
|
+
label?: string;
|
|
62
|
+
field?: SemaphorFieldRef;
|
|
63
|
+
operator?: SemaphorInputOperator;
|
|
64
|
+
source?: SemaphorSourceRef;
|
|
65
|
+
controlRole?: SemaphorDataAppControlRole;
|
|
66
|
+
value: TValue | undefined;
|
|
67
|
+
options: SemaphorDataAppInputOption[];
|
|
68
|
+
isActive: boolean;
|
|
69
|
+
setValue(value: TValue | undefined): void;
|
|
70
|
+
clear(): void;
|
|
71
|
+
toAnalyticsInput(): SemaphorDataAppInputSnapshot<TValue>;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export declare type SemaphorDataAppInputOption = {
|
|
75
|
+
label: string;
|
|
76
|
+
value: SemaphorDataAppOptionValue;
|
|
77
|
+
count?: number;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export declare type SemaphorDataAppInputOptionsData = {
|
|
81
|
+
options: SemaphorDataAppInputOption[];
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export declare type SemaphorDataAppInputOptionsResult = SemaphorDataAppQueryState & SemaphorDataAppInputOptionsData & {
|
|
85
|
+
id?: string;
|
|
86
|
+
intent?: Extract<SemaphorAnalyticsIntent, {
|
|
87
|
+
kind: 'inputOptions';
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export declare type SemaphorDataAppInputOptionsSpec = SemaphorDataAppSourceSpec & {
|
|
92
|
+
id?: string;
|
|
93
|
+
label?: string;
|
|
94
|
+
field: SemaphorDataAppFieldSpec;
|
|
95
|
+
search?: string;
|
|
96
|
+
limit?: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export declare type SemaphorDataAppInputReference = SemaphorInputBinding | SemaphorDataAppInputSnapshot | SemaphorDataAppInputHandle;
|
|
100
|
+
|
|
101
|
+
export declare type SemaphorDataAppInputSnapshot<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue> = SemaphorInputBinding & {
|
|
102
|
+
kind: 'filter' | 'control';
|
|
103
|
+
label?: string;
|
|
104
|
+
value?: TValue;
|
|
105
|
+
isActive: boolean;
|
|
106
|
+
operator?: SemaphorInputOperator;
|
|
107
|
+
source?: SemaphorSourceRef;
|
|
108
|
+
controlRole?: SemaphorDataAppControlRole;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export declare type SemaphorDataAppInputSpec<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue> = SemaphorDataAppFilterInputSpec<TValue> | SemaphorDataAppControlInputSpec<TValue>;
|
|
112
|
+
|
|
113
|
+
export declare type SemaphorDataAppInputValue = SemaphorDataAppScalar | SemaphorDataAppScalar[];
|
|
114
|
+
|
|
115
|
+
export declare type SemaphorDataAppMetricComparison = 'none' | 'previous_period' | 'same_period_last_year' | 'previous_year' | {
|
|
116
|
+
kind: 'previous_period' | 'previous_year' | 'target';
|
|
117
|
+
targetValue?: number;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export declare type SemaphorDataAppMetricData = {
|
|
121
|
+
value: number | string | null;
|
|
122
|
+
metrics?: Record<string, number | string | null>;
|
|
123
|
+
comparisonValue?: number | string | null;
|
|
124
|
+
delta?: number | null;
|
|
125
|
+
deltaPercent?: number | null;
|
|
126
|
+
records?: Array<Record<string, unknown>>;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export declare type SemaphorDataAppMetricResult = SemaphorDataAppQueryState & SemaphorDataAppMetricData & {
|
|
130
|
+
id?: string;
|
|
131
|
+
intent?: SemaphorMetricIntent;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export declare type SemaphorDataAppMetricSpec = SemaphorDataAppSourceSpec & {
|
|
135
|
+
id?: string;
|
|
136
|
+
label?: string;
|
|
137
|
+
metric: string;
|
|
138
|
+
metrics?: string[];
|
|
139
|
+
dateField?: SemaphorDataAppFieldSpec;
|
|
140
|
+
timeGrain?: SemaphorTimeGrain;
|
|
141
|
+
dimensions?: SemaphorDataAppFieldSpec[];
|
|
142
|
+
comparison?: SemaphorDataAppMetricComparison;
|
|
143
|
+
inputs?: SemaphorDataAppInputReference[];
|
|
144
|
+
limit?: number;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export declare type SemaphorDataAppNonEmptyArray<T> = [T, ...T[]];
|
|
148
|
+
|
|
149
|
+
export declare type SemaphorDataAppOptionValue = string | number | boolean;
|
|
150
|
+
|
|
151
|
+
export declare function SemaphorDataAppProvider({ token, apiBaseUrl, executor, children, }: SemaphorDataAppProviderProps): JSX.Element;
|
|
152
|
+
|
|
153
|
+
export declare type SemaphorDataAppProviderProps = SemaphorDataAppExecutorContext & {
|
|
154
|
+
executor?: SemaphorDataAppExecutor;
|
|
155
|
+
children: ReactNode;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export declare type SemaphorDataAppQueryState = {
|
|
159
|
+
status: SemaphorDataAppQueryStatus;
|
|
160
|
+
isLoading: boolean;
|
|
161
|
+
error: Error | null;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export declare type SemaphorDataAppQueryStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
165
|
+
|
|
166
|
+
declare type SemaphorDataAppRecordsBaseSpec = SemaphorDataAppSourceSpec & {
|
|
167
|
+
id?: string;
|
|
168
|
+
label?: string;
|
|
169
|
+
dateField?: SemaphorDataAppFieldSpec;
|
|
170
|
+
timeGrain?: SemaphorTimeGrain;
|
|
171
|
+
orderBy?: SemaphorDataAppRecordsOrderBy;
|
|
172
|
+
inputs?: SemaphorDataAppInputReference[];
|
|
173
|
+
limit?: number;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export declare type SemaphorDataAppRecordsData<TRecord extends Record<string, unknown> = Record<string, unknown>> = {
|
|
177
|
+
records: TRecord[];
|
|
178
|
+
columns?: Array<{
|
|
179
|
+
name: string;
|
|
180
|
+
label?: string;
|
|
181
|
+
dataType?: SemaphorFieldRef['dataType'];
|
|
182
|
+
role?: SemaphorFieldRef['role'];
|
|
183
|
+
}>;
|
|
184
|
+
rowCount?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export declare type SemaphorDataAppRecordsOrderBy = {
|
|
188
|
+
field: string;
|
|
189
|
+
direction: 'asc' | 'desc';
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export declare type SemaphorDataAppRecordsResult<TRecord extends Record<string, unknown> = Record<string, unknown>> = SemaphorDataAppQueryState & SemaphorDataAppRecordsData<TRecord> & {
|
|
193
|
+
id?: string;
|
|
194
|
+
intent?: SemaphorRecordsIntent;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
declare type SemaphorDataAppRecordsSelectorSpec = {
|
|
198
|
+
fields: SemaphorDataAppNonEmptyArray<SemaphorDataAppFieldSpec>;
|
|
199
|
+
dimensions?: SemaphorDataAppFieldSpec[];
|
|
200
|
+
measures?: string[];
|
|
201
|
+
} | {
|
|
202
|
+
fields?: SemaphorDataAppFieldSpec[];
|
|
203
|
+
dimensions: SemaphorDataAppNonEmptyArray<SemaphorDataAppFieldSpec>;
|
|
204
|
+
measures?: string[];
|
|
205
|
+
} | {
|
|
206
|
+
fields?: SemaphorDataAppFieldSpec[];
|
|
207
|
+
dimensions?: SemaphorDataAppFieldSpec[];
|
|
208
|
+
measures: SemaphorDataAppNonEmptyArray<string>;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export declare type SemaphorDataAppRecordsSpec = SemaphorDataAppRecordsBaseSpec & SemaphorDataAppRecordsSelectorSpec;
|
|
212
|
+
|
|
213
|
+
export declare type SemaphorDataAppRuntime = SemaphorDataAppExecutorContext & {
|
|
214
|
+
executor?: SemaphorDataAppExecutor;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export declare type SemaphorDataAppScalar = string | number | boolean | null;
|
|
218
|
+
|
|
219
|
+
export declare type SemaphorDataAppSourceSpec = {
|
|
220
|
+
source: SemaphorSourceRef;
|
|
221
|
+
domainId?: never;
|
|
222
|
+
dataset?: never;
|
|
223
|
+
datasetName?: never;
|
|
224
|
+
datasetId?: never;
|
|
225
|
+
connectionId?: never;
|
|
226
|
+
} | {
|
|
227
|
+
source?: never;
|
|
228
|
+
domainId: string;
|
|
229
|
+
dataset?: string;
|
|
230
|
+
datasetName?: string;
|
|
231
|
+
datasetId?: string;
|
|
232
|
+
connectionId?: string;
|
|
233
|
+
sourceLabel?: string;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
declare type SemaphorDialect = 'semantic' | 'postgres' | 'mysql' | 'snowflake' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
|
|
237
|
+
|
|
238
|
+
declare type SemaphorFieldRef = {
|
|
239
|
+
name: string;
|
|
240
|
+
label?: string;
|
|
241
|
+
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
242
|
+
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare type SemaphorInputBinding = {
|
|
246
|
+
inputId: string;
|
|
247
|
+
field?: SemaphorFieldRef;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
declare type SemaphorInputOperator = '=' | '!=' | 'in' | 'not_in' | 'contains' | 'between' | '>' | '>=' | '<' | '<=';
|
|
251
|
+
|
|
252
|
+
declare type SemaphorInputOptionsIntent = {
|
|
253
|
+
kind: 'inputOptions';
|
|
254
|
+
version?: SemaphorProtocolVersion;
|
|
255
|
+
id?: string;
|
|
256
|
+
label?: string;
|
|
257
|
+
source: SemaphorSourceRef;
|
|
258
|
+
field: SemaphorFieldRef;
|
|
259
|
+
search?: string;
|
|
260
|
+
limit?: number;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare type SemaphorMetricIntent = {
|
|
264
|
+
kind: 'metric';
|
|
265
|
+
version?: SemaphorProtocolVersion;
|
|
266
|
+
id?: string;
|
|
267
|
+
source: SemaphorSourceRef;
|
|
268
|
+
metric: string;
|
|
269
|
+
metrics?: string[];
|
|
270
|
+
label?: string;
|
|
271
|
+
dateField?: SemaphorFieldRef;
|
|
272
|
+
timeGrain?: SemaphorTimeGrain;
|
|
273
|
+
dimensions?: SemaphorFieldRef[];
|
|
274
|
+
comparison?: {
|
|
275
|
+
kind: 'previous_period' | 'previous_year' | 'target';
|
|
276
|
+
targetValue?: number;
|
|
277
|
+
};
|
|
278
|
+
inputs?: SemaphorInputBinding[];
|
|
279
|
+
limit?: number;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
declare type SemaphorProtocolVersion = 1;
|
|
283
|
+
|
|
284
|
+
declare type SemaphorRecordsIntent = {
|
|
285
|
+
kind: 'records';
|
|
286
|
+
version?: SemaphorProtocolVersion;
|
|
287
|
+
source: SemaphorSourceRef;
|
|
288
|
+
id?: string;
|
|
289
|
+
label?: string;
|
|
290
|
+
fields: SemaphorFieldRef[];
|
|
291
|
+
measures?: string[];
|
|
292
|
+
dateField?: SemaphorFieldRef;
|
|
293
|
+
timeGrain?: SemaphorTimeGrain;
|
|
294
|
+
limit?: number;
|
|
295
|
+
orderBy?: {
|
|
296
|
+
field: string;
|
|
297
|
+
direction: 'asc' | 'desc';
|
|
298
|
+
};
|
|
299
|
+
inputs?: SemaphorInputBinding[];
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
declare type SemaphorSourceRef = {
|
|
303
|
+
kind: 'semantic';
|
|
304
|
+
domainId: string;
|
|
305
|
+
datasetName: string;
|
|
306
|
+
datasetId?: string;
|
|
307
|
+
label?: string;
|
|
308
|
+
connectionId?: string;
|
|
309
|
+
} | {
|
|
310
|
+
kind: 'physical';
|
|
311
|
+
connectionId: string;
|
|
312
|
+
tableName: string;
|
|
313
|
+
databaseName?: string;
|
|
314
|
+
schemaName?: string;
|
|
315
|
+
label?: string;
|
|
316
|
+
dialect?: SemaphorDialect;
|
|
317
|
+
} | {
|
|
318
|
+
kind: 'sql';
|
|
319
|
+
connectionId: string;
|
|
320
|
+
sql: string;
|
|
321
|
+
dialect?: SemaphorDialect;
|
|
322
|
+
label?: string;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
declare type SemaphorSqlIntent = {
|
|
326
|
+
kind: 'sql';
|
|
327
|
+
version?: SemaphorProtocolVersion;
|
|
328
|
+
id?: string;
|
|
329
|
+
label?: string;
|
|
330
|
+
source: Extract<SemaphorSourceRef, {
|
|
331
|
+
kind: 'sql' | 'physical';
|
|
332
|
+
}>;
|
|
333
|
+
sql?: string;
|
|
334
|
+
parameters?: Record<string, unknown>;
|
|
335
|
+
pythonCode?: string;
|
|
336
|
+
limit?: number;
|
|
337
|
+
rationale?: string;
|
|
338
|
+
fields?: SemaphorFieldRef[];
|
|
339
|
+
inputs?: SemaphorInputBinding[];
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
343
|
+
|
|
344
|
+
export declare function toSemaphorActiveInputSnapshots(inputs: SemaphorDataAppInputReference[] | undefined): SemaphorDataAppInputSnapshot[];
|
|
345
|
+
|
|
346
|
+
export declare function toSemaphorInputBinding(input: SemaphorDataAppInputReference): SemaphorInputBinding;
|
|
347
|
+
|
|
348
|
+
export declare function toSemaphorInputBindings(inputs: SemaphorDataAppInputReference[] | undefined): SemaphorInputBinding[] | undefined;
|
|
349
|
+
|
|
350
|
+
export declare function toSemaphorInputOptionsIntent(spec: SemaphorDataAppInputOptionsSpec): Extract<SemaphorAnalyticsIntent, {
|
|
351
|
+
kind: 'inputOptions';
|
|
352
|
+
}>;
|
|
353
|
+
|
|
354
|
+
export declare function toSemaphorInputSnapshots(inputs: SemaphorDataAppInputReference[] | undefined): SemaphorDataAppInputSnapshot[];
|
|
355
|
+
|
|
356
|
+
export declare function toSemaphorInputSpec<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue>(spec: SemaphorDataAppInputSpec<TValue>): SemaphorInputBinding & {
|
|
357
|
+
kind: SemaphorDataAppInputSpec['kind'];
|
|
358
|
+
label?: string;
|
|
359
|
+
field?: SemaphorFieldRef;
|
|
360
|
+
operator?: SemaphorInputOperator;
|
|
361
|
+
source?: SemaphorSourceRef;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export declare function toSemaphorMetricIntent(spec: SemaphorDataAppMetricSpec): SemaphorMetricIntent;
|
|
365
|
+
|
|
366
|
+
export declare function toSemaphorRecordsIntent(spec: SemaphorDataAppRecordsSpec): SemaphorRecordsIntent;
|
|
367
|
+
|
|
368
|
+
export declare function useSemaphorDataAppRuntime(): SemaphorDataAppRuntime;
|
|
369
|
+
|
|
370
|
+
export declare function useSemaphorInput<TValue extends SemaphorDataAppInputValue = SemaphorDataAppInputValue>(spec: SemaphorDataAppInputSpec<TValue>): SemaphorDataAppInputHandle<TValue>;
|
|
371
|
+
|
|
372
|
+
export declare function useSemaphorInputOptions(spec: SemaphorDataAppInputOptionsSpec): SemaphorDataAppInputOptionsResult;
|
|
373
|
+
|
|
374
|
+
export declare function useSemaphorMetric(spec: SemaphorDataAppMetricSpec): SemaphorDataAppMetricResult;
|
|
375
|
+
|
|
376
|
+
export declare function useSemaphorRecords<TRecord extends Record<string, unknown> = Record<string, unknown>>(spec: SemaphorDataAppRecordsSpec): SemaphorDataAppRecordsResult<TRecord>;
|
|
377
|
+
|
|
378
|
+
export { }
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1813,7 +1813,7 @@ export declare function DashboardCreateDialogBase({ open, onOpenChange, onCreate
|
|
|
1813
1813
|
export declare interface DashboardCreateDialogBaseProps {
|
|
1814
1814
|
open: boolean;
|
|
1815
1815
|
onOpenChange: (open: boolean) => void;
|
|
1816
|
-
onCreateBlank: (data: DashboardCreateBlankData) => void
|
|
1816
|
+
onCreateBlank: (data: DashboardCreateBlankData) => void | Promise<void>;
|
|
1817
1817
|
onAiCreateSuccess: (result: any) => void;
|
|
1818
1818
|
isCreatingBlank: boolean;
|
|
1819
1819
|
sources: DashboardAuthoringSource[];
|
|
@@ -2056,6 +2056,7 @@ declare type DashboardPlanCard = {
|
|
|
2056
2056
|
priority: number;
|
|
2057
2057
|
section?: string;
|
|
2058
2058
|
query?: DashboardCardQueryIntent;
|
|
2059
|
+
analyticsIntent?: SemaphorAnalyticsIntent;
|
|
2059
2060
|
text?: string;
|
|
2060
2061
|
};
|
|
2061
2062
|
|
|
@@ -2304,6 +2305,7 @@ export declare interface DataModelEntityReference extends DatabaseEntityReferenc
|
|
|
2304
2305
|
export declare interface DatasetEntityReference extends DatabaseEntityReference {
|
|
2305
2306
|
type: 'dataset';
|
|
2306
2307
|
datasetType: 'physical' | 'virtual';
|
|
2308
|
+
table?: string | null;
|
|
2307
2309
|
datamodelId?: string | null;
|
|
2308
2310
|
sql?: string | null;
|
|
2309
2311
|
id: string;
|
|
@@ -4361,17 +4363,125 @@ declare type SemanticExecutionPayload = {
|
|
|
4361
4363
|
}>;
|
|
4362
4364
|
};
|
|
4363
4365
|
|
|
4366
|
+
declare type SemaphorAnalyticsIntent = SemaphorMetricIntent | SemaphorRecordsIntent | SemaphorInputOptionsIntent | SemaphorSqlIntent;
|
|
4367
|
+
|
|
4364
4368
|
export declare const SemaphorContextProvider: ({ children, dashboardProps, }: {
|
|
4365
4369
|
children: React.ReactNode;
|
|
4366
4370
|
dashboardProps: DashboardProps;
|
|
4367
4371
|
}) => JSX.Element;
|
|
4368
4372
|
|
|
4373
|
+
declare type SemaphorDialect = 'semantic' | 'postgres' | 'mysql' | 'snowflake' | 'bigquery' | 'redshift' | 'duckdb' | 'sqlite' | 'unknown';
|
|
4374
|
+
|
|
4375
|
+
declare type SemaphorFieldRef = {
|
|
4376
|
+
name: string;
|
|
4377
|
+
label?: string;
|
|
4378
|
+
role?: 'dimension' | 'measure' | 'date' | 'id' | 'unknown';
|
|
4379
|
+
dataType?: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'unknown';
|
|
4380
|
+
};
|
|
4381
|
+
|
|
4382
|
+
declare type SemaphorInputBinding = {
|
|
4383
|
+
inputId: string;
|
|
4384
|
+
field?: SemaphorFieldRef;
|
|
4385
|
+
};
|
|
4386
|
+
|
|
4387
|
+
declare type SemaphorInputOptionsIntent = {
|
|
4388
|
+
kind: 'inputOptions';
|
|
4389
|
+
version?: SemaphorProtocolVersion;
|
|
4390
|
+
id?: string;
|
|
4391
|
+
label?: string;
|
|
4392
|
+
source: SemaphorSourceRef;
|
|
4393
|
+
field: SemaphorFieldRef;
|
|
4394
|
+
search?: string;
|
|
4395
|
+
limit?: number;
|
|
4396
|
+
};
|
|
4397
|
+
|
|
4398
|
+
declare type SemaphorMetricIntent = {
|
|
4399
|
+
kind: 'metric';
|
|
4400
|
+
version?: SemaphorProtocolVersion;
|
|
4401
|
+
id?: string;
|
|
4402
|
+
source: SemaphorSourceRef;
|
|
4403
|
+
metric: string;
|
|
4404
|
+
metrics?: string[];
|
|
4405
|
+
label?: string;
|
|
4406
|
+
dateField?: SemaphorFieldRef;
|
|
4407
|
+
timeGrain?: SemaphorTimeGrain;
|
|
4408
|
+
dimensions?: SemaphorFieldRef[];
|
|
4409
|
+
comparison?: {
|
|
4410
|
+
kind: 'previous_period' | 'previous_year' | 'target';
|
|
4411
|
+
targetValue?: number;
|
|
4412
|
+
};
|
|
4413
|
+
inputs?: SemaphorInputBinding[];
|
|
4414
|
+
limit?: number;
|
|
4415
|
+
};
|
|
4416
|
+
|
|
4417
|
+
declare type SemaphorProtocolVersion = 1;
|
|
4418
|
+
|
|
4369
4419
|
declare function SemaphorQueryClient({ children, }: {
|
|
4370
4420
|
children: React.ReactNode;
|
|
4371
4421
|
}): JSX.Element;
|
|
4372
4422
|
export { SemaphorQueryClient as SemaphorDataProvider }
|
|
4373
4423
|
export { SemaphorQueryClient }
|
|
4374
4424
|
|
|
4425
|
+
declare type SemaphorRecordsIntent = {
|
|
4426
|
+
kind: 'records';
|
|
4427
|
+
version?: SemaphorProtocolVersion;
|
|
4428
|
+
source: SemaphorSourceRef;
|
|
4429
|
+
id?: string;
|
|
4430
|
+
label?: string;
|
|
4431
|
+
fields: SemaphorFieldRef[];
|
|
4432
|
+
measures?: string[];
|
|
4433
|
+
dateField?: SemaphorFieldRef;
|
|
4434
|
+
timeGrain?: SemaphorTimeGrain;
|
|
4435
|
+
limit?: number;
|
|
4436
|
+
orderBy?: {
|
|
4437
|
+
field: string;
|
|
4438
|
+
direction: 'asc' | 'desc';
|
|
4439
|
+
};
|
|
4440
|
+
inputs?: SemaphorInputBinding[];
|
|
4441
|
+
};
|
|
4442
|
+
|
|
4443
|
+
declare type SemaphorSourceRef = {
|
|
4444
|
+
kind: 'semantic';
|
|
4445
|
+
domainId: string;
|
|
4446
|
+
datasetName: string;
|
|
4447
|
+
datasetId?: string;
|
|
4448
|
+
label?: string;
|
|
4449
|
+
connectionId?: string;
|
|
4450
|
+
} | {
|
|
4451
|
+
kind: 'physical';
|
|
4452
|
+
connectionId: string;
|
|
4453
|
+
tableName: string;
|
|
4454
|
+
databaseName?: string;
|
|
4455
|
+
schemaName?: string;
|
|
4456
|
+
label?: string;
|
|
4457
|
+
dialect?: SemaphorDialect;
|
|
4458
|
+
} | {
|
|
4459
|
+
kind: 'sql';
|
|
4460
|
+
connectionId: string;
|
|
4461
|
+
sql: string;
|
|
4462
|
+
dialect?: SemaphorDialect;
|
|
4463
|
+
label?: string;
|
|
4464
|
+
};
|
|
4465
|
+
|
|
4466
|
+
declare type SemaphorSqlIntent = {
|
|
4467
|
+
kind: 'sql';
|
|
4468
|
+
version?: SemaphorProtocolVersion;
|
|
4469
|
+
id?: string;
|
|
4470
|
+
label?: string;
|
|
4471
|
+
source: Extract<SemaphorSourceRef, {
|
|
4472
|
+
kind: 'sql' | 'physical';
|
|
4473
|
+
}>;
|
|
4474
|
+
sql?: string;
|
|
4475
|
+
parameters?: Record<string, unknown>;
|
|
4476
|
+
pythonCode?: string;
|
|
4477
|
+
limit?: number;
|
|
4478
|
+
rationale?: string;
|
|
4479
|
+
fields?: SemaphorFieldRef[];
|
|
4480
|
+
inputs?: SemaphorInputBinding[];
|
|
4481
|
+
};
|
|
4482
|
+
|
|
4483
|
+
declare type SemaphorTimeGrain = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
4484
|
+
|
|
4375
4485
|
/**
|
|
4376
4486
|
* Stable serializer for dashboard dirty checks.
|
|
4377
4487
|
* This consolidates normalization + serialization into one call site, so
|
|
@@ -5142,7 +5252,11 @@ export declare type TDataColumn = {
|
|
|
5142
5252
|
label?: string;
|
|
5143
5253
|
description?: string;
|
|
5144
5254
|
qualifiedFieldName?: string;
|
|
5145
|
-
|
|
5255
|
+
qualifiedEntityName?: string;
|
|
5256
|
+
entityId?: string;
|
|
5257
|
+
entityName?: string;
|
|
5258
|
+
entityType?: EntityType;
|
|
5259
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
5146
5260
|
expression?: string;
|
|
5147
5261
|
calculatedFormula?: CalculatedFieldFormula;
|
|
5148
5262
|
format?: FormatSpec;
|
|
@@ -6095,6 +6209,7 @@ export declare function useResourceManagement(resourceType: ResourceType, onDele
|
|
|
6095
6209
|
isFetching: boolean;
|
|
6096
6210
|
error: Error | null;
|
|
6097
6211
|
createResource: UseMutateFunction<any, Error, CreateResourceRequest, void>;
|
|
6212
|
+
createResourceAsync: UseMutateAsyncFunction<any, Error, CreateResourceRequest, void>;
|
|
6098
6213
|
updateResource: UseMutateFunction<any, Error, {
|
|
6099
6214
|
resourceId: string;
|
|
6100
6215
|
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;
|
|
@@ -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;
|
|
@@ -2512,7 +2513,11 @@ export declare type TDataColumn = {
|
|
|
2512
2513
|
label?: string;
|
|
2513
2514
|
description?: string;
|
|
2514
2515
|
qualifiedFieldName?: string;
|
|
2515
|
-
|
|
2516
|
+
qualifiedEntityName?: string;
|
|
2517
|
+
entityId?: string;
|
|
2518
|
+
entityName?: string;
|
|
2519
|
+
entityType?: EntityType;
|
|
2520
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
2516
2521
|
expression?: string;
|
|
2517
2522
|
calculatedFormula?: CalculatedFieldFormula;
|
|
2518
2523
|
format?: FormatSpec;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -3282,7 +3283,11 @@ export declare type TDataColumn = {
|
|
|
3282
3283
|
label?: string;
|
|
3283
3284
|
description?: string;
|
|
3284
3285
|
qualifiedFieldName?: string;
|
|
3285
|
-
|
|
3286
|
+
qualifiedEntityName?: string;
|
|
3287
|
+
entityId?: string;
|
|
3288
|
+
entityName?: string;
|
|
3289
|
+
entityType?: EntityType;
|
|
3290
|
+
role?: 'groupby' | 'metric' | 'sortby' | 'pivotby' | 'detail';
|
|
3286
3291
|
expression?: string;
|
|
3287
3292
|
calculatedFormula?: CalculatedFieldFormula;
|
|
3288
3293
|
format?: FormatSpec;
|
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.326",
|
|
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;
|