@sentio/ui-dashboard 0.2.9 → 0.3.0

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/index.mjs CHANGED
@@ -3913,14 +3913,1504 @@ var QueryValueChart = forwardRef4(
3913
3913
  );
3914
3914
  QueryValueChart.displayName = "QueryValueChart";
3915
3915
 
3916
+ // src/charts/TimeSeriesChart.tsx
3917
+ import {
3918
+ forwardRef as forwardRef5,
3919
+ useCallback as useCallback4,
3920
+ useEffect as useEffect8,
3921
+ useMemo as useMemo9,
3922
+ useRef as useRef4,
3923
+ useState as useState10
3924
+ } from "react";
3925
+ import dayjs5 from "dayjs";
3926
+
3927
+ // src/charts/series-utils.ts
3928
+ import dayjs3 from "dayjs";
3929
+ import duration from "dayjs/plugin/duration";
3930
+ import utc3 from "dayjs/plugin/utc";
3931
+ import timezone3 from "dayjs/plugin/timezone";
3932
+ import quarterOfYear from "dayjs/plugin/quarterOfYear";
3933
+ import localizedFormat from "dayjs/plugin/localizedFormat";
3934
+ dayjs3.extend(duration);
3935
+ dayjs3.extend(utc3);
3936
+ dayjs3.extend(timezone3);
3937
+ dayjs3.extend(quarterOfYear);
3938
+ dayjs3.extend(localizedFormat);
3939
+ var TimeUnitShortNames = {
3940
+ s: "seconds",
3941
+ m: "minutes",
3942
+ h: "hours",
3943
+ d: "days",
3944
+ w: "weeks",
3945
+ M: "months",
3946
+ y: "years"
3947
+ };
3948
+ function dateRangeOfSeries(series) {
3949
+ let min = /* @__PURE__ */ new Date();
3950
+ let max = /* @__PURE__ */ new Date(0);
3951
+ for (const s of series) {
3952
+ if (s.data.length > 0) {
3953
+ const dmin = s.data[0][0] || min;
3954
+ const dmax = s.data[s.data.length - 1][0] || max;
3955
+ if (dmin < min) min = dmin;
3956
+ if (dmax > max) max = dmax;
3957
+ }
3958
+ }
3959
+ return [min, max];
3960
+ }
3961
+ function durationToSeconds(d) {
3962
+ if (!d) return 0;
3963
+ return dayjs3.duration(Number(d.value) || 0, d.unit).asSeconds();
3964
+ }
3965
+ function parseDuration(s) {
3966
+ const m = s.match(/(\d+)([a-z]+)/i);
3967
+ if (m) {
3968
+ const [, value, unit] = m;
3969
+ return { value: parseInt(value), unit: TimeUnitShortNames[unit] };
3970
+ }
3971
+ return { value: 0, unit: "second" };
3972
+ }
3973
+ function roundInterval(diff) {
3974
+ switch (true) {
3975
+ case diff <= dayjs3.duration(15, "minute").asMilliseconds():
3976
+ return "10s";
3977
+ case diff <= dayjs3.duration(1, "day").asMilliseconds():
3978
+ return "1m";
3979
+ case diff <= dayjs3.duration(30, "day").asMilliseconds():
3980
+ return "1h";
3981
+ case diff <= dayjs3.duration(2, "years").asMilliseconds():
3982
+ return "1d";
3983
+ case diff <= dayjs3.duration(10, "years").asMilliseconds():
3984
+ default:
3985
+ return "7d";
3986
+ }
3987
+ }
3988
+ function calculateStepByDate(start, end) {
3989
+ return parseDuration(roundInterval(end.getTime() - start.getTime()));
3990
+ }
3991
+ function shiftTimezone(time, tz) {
3992
+ const origin = dayjs3.isDayjs(time) ? time : dayjs3(time);
3993
+ if (!tz) return origin.toDate();
3994
+ const offset = origin.tz(tz).utcOffset() - origin.utcOffset();
3995
+ return origin.add(offset, "minute").toDate();
3996
+ }
3997
+ var formatTime = (time, tz, interval) => {
3998
+ const d = dayjs3(shiftTimezone(time, tz));
3999
+ switch (interval?.unit) {
4000
+ case "s":
4001
+ return d.format("HH:mm:ss");
4002
+ case "m":
4003
+ return d.format("DD HH:mm");
4004
+ case "h":
4005
+ return d.format("MM-DD HH:mm");
4006
+ case "d":
4007
+ case "w":
4008
+ return d.format("YYYY-MM-DD");
4009
+ case "M":
4010
+ return interval.value === 3 ? `${d.format("YYYY")}-Q${d.quarter()}` : d.format("YYYY-MMM");
4011
+ default:
4012
+ return d.format("lll");
4013
+ }
4014
+ };
4015
+
4016
+ // src/charts/time-utils.ts
4017
+ import dayjs4 from "dayjs";
4018
+ import {
4019
+ toDayjs,
4020
+ isRelativeTime,
4021
+ now,
4022
+ TimeUnitShortNames as TimeUnitShortNames2
4023
+ } from "@sentio/ui-core";
4024
+ function alignTime(time, step, tz, align = "start") {
4025
+ try {
4026
+ const d = toDayjs(time);
4027
+ const seconds = durationToSeconds(step);
4028
+ const tzOffset = (tz ? d.tz(tz).utcOffset() : 0) * 60;
4029
+ const offset = (d.unix() + tzOffset) % seconds;
4030
+ if (offset === 0) {
4031
+ return time;
4032
+ }
4033
+ return align == "start" ? d.subtract(offset, "second") : d.add(seconds - offset, "second");
4034
+ } catch (e) {
4035
+ console.error(e);
4036
+ return time;
4037
+ }
4038
+ }
4039
+ function timeBefore(time, duration2, asStart = true) {
4040
+ const durationValue = Number(duration2.value);
4041
+ if (isRelativeTime(time)) {
4042
+ const rt = time;
4043
+ if (rt.unit == null || time == now) {
4044
+ return {
4045
+ sign: -1,
4046
+ unit: TimeUnitShortNames2[duration2.unit],
4047
+ value: durationValue
4048
+ };
4049
+ }
4050
+ if (rt.align) {
4051
+ const t2 = toDayjs(rt, asStart);
4052
+ return t2.subtract(durationValue, TimeUnitShortNames2[duration2.unit]);
4053
+ }
4054
+ const t = toDayjs(time);
4055
+ const nt = t.subtract(durationValue, TimeUnitShortNames2[duration2.unit]);
4056
+ const unit = "days";
4057
+ const value = nt.diff(dayjs4(), unit);
4058
+ return { sign: value < 0 ? -1 : 1, unit, value: Math.abs(value) };
4059
+ } else {
4060
+ const t = toDayjs(time);
4061
+ return t.subtract(durationValue, TimeUnitShortNames2[duration2.unit]);
4062
+ }
4063
+ }
4064
+
4065
+ // src/charts/TimeSeriesChart.tsx
4066
+ import {
4067
+ toDayjs as toDayjs2,
4068
+ fromNumber,
4069
+ classNames as classNames8,
4070
+ PopupMenuButton
4071
+ } from "@sentio/ui-core";
4072
+
4073
+ // src/charts/options/YaxisControls.tsx
4074
+ import { defaults } from "lodash";
4075
+ import { Button, Checkbox, DisclosurePanel } from "@sentio/ui-core";
4076
+
4077
+ // src/charts/options/controls-ui.tsx
4078
+ import { classNames as classNames7 } from "@sentio/ui-core";
4079
+ import { jsx as jsx25 } from "react/jsx-runtime";
4080
+ var AddonLabel = ({
4081
+ className,
4082
+ children
4083
+ }) => /* @__PURE__ */ jsx25(
4084
+ "span",
4085
+ {
4086
+ className: classNames7(
4087
+ "sm:text-icontent border-main inline-flex items-center whitespace-nowrap bg-gray-50",
4088
+ className
4089
+ ),
4090
+ children
4091
+ }
4092
+ );
4093
+
4094
+ // src/charts/options/YaxisControls.tsx
4095
+ import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
4096
+ var initialConfig = {
4097
+ yAxis: {
4098
+ min: "",
4099
+ max: "",
4100
+ scale: true,
4101
+ stack: ""
4102
+ }
4103
+ };
4104
+ function YaxisControls({
4105
+ yAxis,
4106
+ setYAxis,
4107
+ defaultOpen,
4108
+ columnSelect,
4109
+ supportSetName = true,
4110
+ supportSetMinMax = true,
4111
+ supportStackSeries = true,
4112
+ supportAlwaysShowZero = true,
4113
+ supportReset = true,
4114
+ panelTitle = "Y-Axis Controls"
4115
+ }) {
4116
+ yAxis = defaults(yAxis || {}, initialConfig.yAxis);
4117
+ const onChangeInput = (field) => (event) => {
4118
+ const { value } = event.target;
4119
+ setYAxis({
4120
+ ...yAxis,
4121
+ [field]: value || void 0,
4122
+ scale: field == "min" && value > "0" ? true : yAxis?.scale
4123
+ });
4124
+ };
4125
+ const onToggleZero = (checked) => {
4126
+ setYAxis({ ...yAxis, scale: !checked, min: checked ? "" : yAxis?.min });
4127
+ };
4128
+ const onClickResetYAxis = () => {
4129
+ setYAxis(initialConfig.yAxis);
4130
+ };
4131
+ const onToggleStack = (checked) => {
4132
+ setYAxis({ ...yAxis, stacked: checked ? "samesign" : "" });
4133
+ };
4134
+ const minMaxLabelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
4135
+ const minMaxInputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
4136
+ return /* @__PURE__ */ jsx26(
4137
+ DisclosurePanel,
4138
+ {
4139
+ title: panelTitle,
4140
+ defaultOpen,
4141
+ containerClassName: "w-full bg-default-bg",
4142
+ children: /* @__PURE__ */ jsxs16("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
4143
+ supportSetName && /* @__PURE__ */ jsxs16("label", { className: "inline-flex h-8", children: [
4144
+ /* @__PURE__ */ jsx26(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
4145
+ /* @__PURE__ */ jsx26(
4146
+ "input",
4147
+ {
4148
+ type: "text",
4149
+ className: "focus:border-primary-500 sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 w-40 rounded-r-md border",
4150
+ value: yAxis?.name,
4151
+ placeholder: "Axis Name",
4152
+ onChange: onChangeInput("name")
4153
+ }
4154
+ )
4155
+ ] }),
4156
+ columnSelect && /* @__PURE__ */ jsxs16("span", { className: "inline-flex h-8", children: [
4157
+ /* @__PURE__ */ jsx26(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
4158
+ columnSelect
4159
+ ] }),
4160
+ supportSetMinMax && /* @__PURE__ */ jsxs16(Fragment8, { children: [
4161
+ /* @__PURE__ */ jsxs16("label", { className: "inline-flex h-8", children: [
4162
+ /* @__PURE__ */ jsx26("span", { className: minMaxLabelCls, children: "Min" }),
4163
+ /* @__PURE__ */ jsx26(
4164
+ "input",
4165
+ {
4166
+ type: "text",
4167
+ className: minMaxInputCls,
4168
+ style: { width: "10em" },
4169
+ value: yAxis.min,
4170
+ placeholder: "Auto",
4171
+ onChange: onChangeInput("min")
4172
+ }
4173
+ )
4174
+ ] }),
4175
+ /* @__PURE__ */ jsxs16("label", { className: "inline-flex h-8", children: [
4176
+ /* @__PURE__ */ jsx26("span", { className: minMaxLabelCls, children: "Max" }),
4177
+ /* @__PURE__ */ jsx26(
4178
+ "input",
4179
+ {
4180
+ type: "text",
4181
+ className: minMaxInputCls,
4182
+ style: { width: "10em" },
4183
+ value: yAxis.max,
4184
+ placeholder: "Auto",
4185
+ onChange: onChangeInput("max")
4186
+ }
4187
+ )
4188
+ ] })
4189
+ ] }),
4190
+ supportStackSeries && /* @__PURE__ */ jsx26(
4191
+ Checkbox,
4192
+ {
4193
+ checked: !!yAxis?.stacked,
4194
+ onChange: onToggleStack,
4195
+ label: "Stack series"
4196
+ }
4197
+ ),
4198
+ supportAlwaysShowZero && /* @__PURE__ */ jsx26(
4199
+ Checkbox,
4200
+ {
4201
+ checked: !yAxis.scale,
4202
+ onChange: onToggleZero,
4203
+ label: "Always show zero"
4204
+ }
4205
+ ),
4206
+ supportReset && /* @__PURE__ */ jsx26(Button, { type: "button", role: "link", onClick: onClickResetYAxis, children: "Reset" })
4207
+ ] })
4208
+ }
4209
+ );
4210
+ }
4211
+
4212
+ // src/charts/options/XaxisControls.tsx
4213
+ import {
4214
+ Button as Button2,
4215
+ DisclosurePanel as DisclosurePanel2,
4216
+ PopoverTooltip,
4217
+ Select
4218
+ } from "@sentio/ui-core";
4219
+ import { LuInfo } from "react-icons/lu";
4220
+ import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
4221
+ var TypeSelect = Select;
4222
+ var SortSelect = Select;
4223
+ var OrderSelect = Select;
4224
+ var sortByItems = [
4225
+ { label: "Name", value: "ByName" },
4226
+ { label: "Value", value: "ByValue" }
4227
+ ];
4228
+ var orderItems = [
4229
+ { label: "Ascendant", value: false },
4230
+ { label: "Descendant", value: true }
4231
+ ];
4232
+ var XAxisControls = ({
4233
+ xAxis,
4234
+ setXAxis,
4235
+ defaultOpen,
4236
+ columnSelect,
4237
+ columnIsNonTime,
4238
+ panelTitle = "X-Axis Controls",
4239
+ supportName = true,
4240
+ supportSort,
4241
+ supportSetType
4242
+ }) => {
4243
+ const onChangeInput = (field) => (event) => {
4244
+ const { value } = event.target;
4245
+ setXAxis({ ...xAxis, [field]: value || void 0 });
4246
+ };
4247
+ const onClickResetXAxis = () => {
4248
+ setXAxis(void 0);
4249
+ };
4250
+ const isXAixsNoneTime = xAxis && xAxis.column && columnIsNonTime;
4251
+ return /* @__PURE__ */ jsx27(
4252
+ DisclosurePanel2,
4253
+ {
4254
+ title: panelTitle,
4255
+ defaultOpen,
4256
+ containerClassName: "w-full bg-default-bg",
4257
+ children: /* @__PURE__ */ jsxs17("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
4258
+ supportName && /* @__PURE__ */ jsxs17("label", { className: "inline-flex h-8", children: [
4259
+ /* @__PURE__ */ jsx27(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
4260
+ /* @__PURE__ */ jsx27(
4261
+ "input",
4262
+ {
4263
+ type: "text",
4264
+ className: "sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 w-40 rounded-r-md",
4265
+ value: xAxis?.name,
4266
+ placeholder: "Axis Name",
4267
+ onChange: onChangeInput("name")
4268
+ }
4269
+ )
4270
+ ] }),
4271
+ supportSetType && /* @__PURE__ */ jsxs17("span", { className: "inline-flex h-8", children: [
4272
+ /* @__PURE__ */ jsxs17("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2", children: [
4273
+ "X-Axis Type",
4274
+ " ",
4275
+ /* @__PURE__ */ jsx27(
4276
+ PopoverTooltip,
4277
+ {
4278
+ strategy: "fixed",
4279
+ hideArrow: true,
4280
+ placementOption: "bottom",
4281
+ text: /* @__PURE__ */ jsxs17("div", { className: "text-text-foreground max-w-[300px] p-2", children: [
4282
+ /* @__PURE__ */ jsx27("span", { className: "font-medium", children: "Discrete axis" }),
4283
+ " displays",
4284
+ " ",
4285
+ /* @__PURE__ */ jsx27("span", { className: "text-primary-600", children: "discrete values evenly" }),
4286
+ ", while ",
4287
+ /* @__PURE__ */ jsx27("span", { className: "font-medium", children: "Continuous axis" }),
4288
+ " ",
4289
+ "shows",
4290
+ " ",
4291
+ /* @__PURE__ */ jsx27("span", { className: "text-primary-600", children: "continuous time series" }),
4292
+ " ",
4293
+ "and",
4294
+ " ",
4295
+ /* @__PURE__ */ jsx27("span", { className: "text-primary-600", children: "auto-fills missing time points" })
4296
+ ] }),
4297
+ children: /* @__PURE__ */ jsx27(LuInfo, { className: "text-text-foreground-secondary h-4 w-4" })
4298
+ }
4299
+ )
4300
+ ] }),
4301
+ /* @__PURE__ */ jsx27(
4302
+ TypeSelect,
4303
+ {
4304
+ className: "h-8 w-40",
4305
+ buttonClassName: "h-full border-main rounded-l-none items-center inline-flex items-center",
4306
+ value: xAxis?.type || "time",
4307
+ onChange: (val) => {
4308
+ setXAxis({ ...xAxis, type: val });
4309
+ },
4310
+ options: [
4311
+ { label: "Continuous", value: "time" },
4312
+ { label: "Discrete", value: "category" }
4313
+ ]
4314
+ }
4315
+ )
4316
+ ] }),
4317
+ columnSelect && /* @__PURE__ */ jsxs17("span", { className: "inline-flex h-8", children: [
4318
+ /* @__PURE__ */ jsx27(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
4319
+ columnSelect
4320
+ ] }),
4321
+ supportSort && isXAixsNoneTime && /* @__PURE__ */ jsxs17("span", { className: "inline-flex h-8", children: [
4322
+ /* @__PURE__ */ jsx27(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Sort By" }),
4323
+ /* @__PURE__ */ jsx27(
4324
+ SortSelect,
4325
+ {
4326
+ className: "h-8 w-20 leading-8",
4327
+ buttonClassName: "h-full border-main rounded-none inline-flex items-center",
4328
+ options: sortByItems,
4329
+ value: xAxis?.sort?.sortBy,
4330
+ onChange: (value) => {
4331
+ setXAxis({
4332
+ ...xAxis,
4333
+ sort: { ...xAxis?.sort, sortBy: value }
4334
+ });
4335
+ },
4336
+ placeholder: "Sort By"
4337
+ }
4338
+ ),
4339
+ /* @__PURE__ */ jsx27(
4340
+ OrderSelect,
4341
+ {
4342
+ className: "h-8 w-40 leading-8",
4343
+ buttonClassName: "h-full border-l-0 border-main rounded-l-none inline-flex items-center",
4344
+ options: orderItems,
4345
+ value: xAxis?.sort?.orderDesc,
4346
+ onChange: (value) => {
4347
+ setXAxis({
4348
+ ...xAxis,
4349
+ sort: { ...xAxis?.sort, orderDesc: value }
4350
+ });
4351
+ },
4352
+ placeholder: "Sort Order"
4353
+ }
4354
+ )
4355
+ ] }),
4356
+ /* @__PURE__ */ jsx27(
4357
+ Button2,
4358
+ {
4359
+ type: "button",
4360
+ role: "link",
4361
+ onClick: onClickResetXAxis,
4362
+ className: "h-8",
4363
+ children: "Reset"
4364
+ }
4365
+ )
4366
+ ] })
4367
+ }
4368
+ );
4369
+ };
4370
+
4371
+ // src/charts/TimeSeriesChart.tsx
4372
+ import ReactDOMServer from "react-dom/server";
4373
+ import { isArray, isEqual as isEqual3, isNumber as isNumber3, uniq } from "lodash";
4374
+ import {
4375
+ flip,
4376
+ FloatingOverlay,
4377
+ FloatingPortal as FloatingPortal2,
4378
+ shift as shift2,
4379
+ useFloating as useFloating3
4380
+ } from "@floating-ui/react";
4381
+ import { useBoolean } from "@sentio/ui-core";
4382
+ import { LuChevronDown as LuChevronDown2 } from "react-icons/lu";
4383
+ import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
4384
+ var NumberFormat = (o) => new Intl.NumberFormat("en-US", o);
4385
+ function roundByDPR(value) {
4386
+ const dpr = window.devicePixelRatio || 1;
4387
+ return Math.round(value * dpr) / dpr;
4388
+ }
4389
+ function onClickPreventDefault(e) {
4390
+ e.preventDefault();
4391
+ e.stopPropagation();
4392
+ }
4393
+ var closestNumber = (arr, needle) => {
4394
+ return arr?.reduce(
4395
+ (a, b) => Math.abs(b - needle) < Math.abs(a - needle) ? b : a
4396
+ );
4397
+ };
4398
+ var initialConfig2 = {
4399
+ xAxis: {
4400
+ type: "category",
4401
+ min: "",
4402
+ max: "",
4403
+ scale: true,
4404
+ name: "",
4405
+ column: ""
4406
+ },
4407
+ yAxis: {
4408
+ min: "",
4409
+ max: "",
4410
+ scale: true
4411
+ }
4412
+ };
4413
+ var createYAxisResult = (min, max, scale, name) => {
4414
+ const result = { min, max, scale };
4415
+ if (name) {
4416
+ result.name = name;
4417
+ }
4418
+ return result;
4419
+ };
4420
+ var calculateMargin = (value, isMin) => {
4421
+ if (isMin) {
4422
+ return value >= 0 ? Math.max(0, value * 0.9) : value * 1.1;
4423
+ } else {
4424
+ return value >= 0 ? value * 1.1 : value * 0.9;
4425
+ }
4426
+ };
4427
+ var yAxisToChartOption = (option, markLines = [], values) => {
4428
+ const { min, max, scale, name } = option || {};
4429
+ const hasValidMin = min !== void 0 && min !== "";
4430
+ const hasValidMax = max !== void 0 && max !== "";
4431
+ const optionMin = hasValidMin ? parseFloat(min) || min : void 0;
4432
+ const optionMax = hasValidMax ? parseFloat(max) || max : void 0;
4433
+ if (hasValidMin && hasValidMax) {
4434
+ return createYAxisResult(optionMin, optionMax, scale, name);
4435
+ }
4436
+ const lineValues = markLines.map((m) => m.value).filter(
4437
+ (v) => v !== void 0 && v !== 0 && v !== "0"
4438
+ );
4439
+ if (lineValues.length === 0 && !hasValidMin && !hasValidMax) {
4440
+ return createYAxisResult(void 0, void 0, scale, name);
4441
+ }
4442
+ const allValues = [...lineValues];
4443
+ if (values) {
4444
+ const valueSet = /* @__PURE__ */ new Set();
4445
+ values.forEach((series) => {
4446
+ series.data.forEach((point) => {
4447
+ const value = point[1];
4448
+ if (isNumber3(value)) {
4449
+ valueSet.add(value);
4450
+ }
4451
+ });
4452
+ });
4453
+ valueSet.forEach((value) => {
4454
+ allValues.push(value);
4455
+ });
4456
+ }
4457
+ let finalMin = optionMin;
4458
+ let finalMax = optionMax;
4459
+ if (allValues.length > 0) {
4460
+ if (!hasValidMin) {
4461
+ const minValue = allValues.reduce(
4462
+ (min2, current) => Math.min(min2, current),
4463
+ Infinity
4464
+ );
4465
+ finalMin = calculateMargin(minValue, true);
4466
+ }
4467
+ if (!hasValidMax) {
4468
+ const maxValue = allValues.reduce(
4469
+ (max2, current) => Math.max(max2, current),
4470
+ -Infinity
4471
+ );
4472
+ finalMax = calculateMargin(maxValue, false);
4473
+ }
4474
+ }
4475
+ return createYAxisResult(finalMin, finalMax, scale, name);
4476
+ };
4477
+ var getEventName = (name) => {
4478
+ let eventName = name.split("-")[0].trim();
4479
+ if (eventName.toLowerCase() === "all events") {
4480
+ eventName = void 0;
4481
+ }
4482
+ return eventName;
4483
+ };
4484
+ var DARK_AREA_FILL_OPACITY = 0.35;
4485
+ var applyDarkAreaOpacity = (series) => {
4486
+ if (series.length <= 1) {
4487
+ return series;
4488
+ }
4489
+ return series.map((s) => {
4490
+ if (!s?.areaStyle) {
4491
+ return s;
4492
+ }
4493
+ const existing = typeof s.areaStyle.opacity === "number" ? s.areaStyle.opacity : 0.7;
4494
+ return {
4495
+ ...s,
4496
+ areaStyle: {
4497
+ ...s.areaStyle,
4498
+ opacity: Math.min(existing, DARK_AREA_FILL_OPACITY)
4499
+ }
4500
+ };
4501
+ });
4502
+ };
4503
+ var fixTimeSeries = (series) => {
4504
+ try {
4505
+ if (!series?.length) {
4506
+ return;
4507
+ }
4508
+ const isValidDateSeries = series.every(
4509
+ (s) => s.data?.every((point) => {
4510
+ const date = point?.[0];
4511
+ return date instanceof Date && !isNaN(date.getTime());
4512
+ })
4513
+ );
4514
+ if (!isValidDateSeries || series.length < 2 || uniq(series.map((s) => s.data?.length)).length === 1) {
4515
+ return;
4516
+ }
4517
+ const timeIndex = [];
4518
+ const dataIndexes = new Array(series.length).fill(0);
4519
+ while (dataIndexes.some((d, index) => d < (series[index]?.data?.length || 0))) {
4520
+ const times = dataIndexes.map((d, index) => {
4521
+ const date = series[index]?.data?.[d]?.[0];
4522
+ return date instanceof Date && !isNaN(date.getTime()) ? date.getTime() : Infinity;
4523
+ });
4524
+ const minTime = Math.min(...times);
4525
+ if (!isFinite(minTime)) {
4526
+ break;
4527
+ }
4528
+ const newDate = new Date(minTime);
4529
+ if (isNaN(newDate.getTime())) {
4530
+ break;
4531
+ }
4532
+ timeIndex.push(newDate);
4533
+ dataIndexes.forEach((d, index) => {
4534
+ const date = series[index]?.data?.[d]?.[0];
4535
+ if (date instanceof Date && !isNaN(date.getTime()) && date.getTime() === minTime) {
4536
+ dataIndexes[index]++;
4537
+ }
4538
+ });
4539
+ }
4540
+ series.forEach((s) => {
4541
+ if (!s?.data) return;
4542
+ const data = s.data;
4543
+ const fixedData = [];
4544
+ let index = 0;
4545
+ timeIndex.forEach((t) => {
4546
+ if (data[index]?.[0] instanceof Date && !isNaN(data[index][0].getTime()) && isEqual3(data[index][0], t)) {
4547
+ fixedData.push(data[index]);
4548
+ index++;
4549
+ } else {
4550
+ fixedData.push([t, null]);
4551
+ }
4552
+ });
4553
+ s.data = fixedData;
4554
+ });
4555
+ } catch (error) {
4556
+ console.warn("Error in fixTimeSeries:", error);
4557
+ }
4558
+ };
4559
+ var TimeSeriesChart = forwardRef5(
4560
+ (props, ref) => {
4561
+ const yAxisRef = useRef4(null);
4562
+ const {
4563
+ group,
4564
+ title,
4565
+ startTime,
4566
+ endTime,
4567
+ tz,
4568
+ minHeight,
4569
+ onSelectTimeRange,
4570
+ loading,
4571
+ controls,
4572
+ config,
4573
+ markAreas,
4574
+ markLines,
4575
+ onChangeConfig,
4576
+ style,
4577
+ chartType,
4578
+ allowClick,
4579
+ sourceType,
4580
+ getEventNameById,
4581
+ noLegend: _noLegend = false,
4582
+ onInitChart,
4583
+ nonXAxis,
4584
+ // injected
4585
+ series: seriesProp,
4586
+ compareSeries: compareSeriesProp,
4587
+ legend: legendProp,
4588
+ numberFormatter,
4589
+ overlay,
4590
+ templateVariableKeys: _templateVariableKeys,
4591
+ seriesToMetricLabels,
4592
+ eventNameMap,
4593
+ eventsQueryMap,
4594
+ onViewLogs,
4595
+ onViewUsers,
4596
+ viewLogDisabled: viewLogDisabledProp,
4597
+ viewUsersDisabled: viewUsersDisabledProp,
4598
+ returnedSeries,
4599
+ totalSeries
4600
+ } = props;
4601
+ void _templateVariableKeys;
4602
+ const seriesToMetricLabelsRef = useMemo9(
4603
+ () => seriesToMetricLabels ?? [],
4604
+ [seriesToMetricLabels]
4605
+ );
4606
+ const eventNameMapRef = useMemo9(
4607
+ () => eventNameMap ?? /* @__PURE__ */ new Map(),
4608
+ [eventNameMap]
4609
+ );
4610
+ const eventsQueryMapRef = useMemo9(
4611
+ () => eventsQueryMap ?? /* @__PURE__ */ new Map(),
4612
+ [eventsQueryMap]
4613
+ );
4614
+ const [yAxis, setYAxis] = useState10(config?.yAxis || initialConfig2.yAxis);
4615
+ const [xAxis, setXAxis] = useState10(config?.xAxis || initialConfig2.xAxis);
4616
+ const [maximumSignificantDigits, setMaximumSignificantDigits] = useState10(3);
4617
+ const isDarkMode = useDarkMode();
4618
+ const minRef = useRef4(0);
4619
+ const maxRef = useRef4(0);
4620
+ const getSymbolSize = useCallback4(
4621
+ (value) => {
4622
+ const val = value[2] || 0;
4623
+ return normalize(
4624
+ val,
4625
+ minRef.current,
4626
+ maxRef.current,
4627
+ config?.scatterConfig?.minSize,
4628
+ config?.scatterConfig?.maxSize
4629
+ );
4630
+ },
4631
+ [config?.scatterConfig?.minSize, config?.scatterConfig?.maxSize]
4632
+ );
4633
+ useEffect8(() => {
4634
+ setYAxis(config?.yAxis || initialConfig2.yAxis);
4635
+ }, [config]);
4636
+ const legend = useMemo9(() => legendProp || [], [legendProp]);
4637
+ const series = useMemo9(() => {
4638
+ const result = (seriesProp || []).map((s) => ({ ...s }));
4639
+ computeMarkLines(result, markLines || []);
4640
+ computeMarksAreas(result, markAreas || []);
4641
+ if (config?.yAxis?.stacked) {
4642
+ fixTimeSeries(result);
4643
+ result.forEach((s) => {
4644
+ if (config?.seriesConfig && config.seriesConfig.series?.[s.name]) {
4645
+ return;
4646
+ }
4647
+ s.stack = "Total";
4648
+ s.stackStrategy = config?.yAxis?.stacked;
4649
+ });
4650
+ }
4651
+ if (config?.lineConfig) {
4652
+ result.forEach((s) => {
4653
+ s.lineStyle = {
4654
+ ...s.lineStyle,
4655
+ type: config?.lineConfig?.style?.toLowerCase() || "solid"
4656
+ };
4657
+ if (config?.lineConfig?.smooth) {
4658
+ s.smooth = true;
4659
+ }
4660
+ });
4661
+ }
4662
+ if (chartType === "SCATTER") {
4663
+ result.forEach((s) => {
4664
+ const min = s.data?.reduce((min2, p) => {
4665
+ const val = p[2] || 0;
4666
+ return Math.min(min2, val);
4667
+ }, Infinity);
4668
+ const max = s.data?.reduce((max2, p) => {
4669
+ const val = p[2] || 0;
4670
+ return Math.max(max2, val);
4671
+ }, -Infinity);
4672
+ minRef.current = min;
4673
+ maxRef.current = max;
4674
+ s.symbolSize = getSymbolSize;
4675
+ });
4676
+ }
4677
+ if (allowClick) {
4678
+ result.forEach((serie) => {
4679
+ serie.emphasis = serie.type === "bar" ? {
4680
+ itemStyle: {
4681
+ shadowColor: "rgba(0, 0, 0, 0.3)",
4682
+ shadowBlur: 10
4683
+ }
4684
+ } : {
4685
+ scale: 1.5
4686
+ };
4687
+ });
4688
+ }
4689
+ return result;
4690
+ }, [
4691
+ seriesProp,
4692
+ markAreas,
4693
+ markLines,
4694
+ chartType,
4695
+ config?.yAxis,
4696
+ config?.lineConfig,
4697
+ config?.seriesConfig,
4698
+ allowClick,
4699
+ getSymbolSize
4700
+ ]);
4701
+ useEffect8(() => {
4702
+ setMaximumSignificantDigits(3);
4703
+ }, [seriesProp]);
4704
+ const compareSeries = useMemo9(() => {
4705
+ if (!compareSeriesProp?.length) {
4706
+ return [];
4707
+ }
4708
+ const result = compareSeriesProp.map((s) => ({ ...s }));
4709
+ for (const s of result) {
4710
+ s.lineStyle = {
4711
+ ...s.lineStyle,
4712
+ type: "dashed"
4713
+ };
4714
+ s.itemStyle = {
4715
+ ...s.itemStyle,
4716
+ color: "rgba(120, 120, 120, 0.3)"
4717
+ };
4718
+ s.xAxisIndex = 1;
4719
+ if (chartType === "SCATTER") {
4720
+ s.symbolSize = getSymbolSize;
4721
+ }
4722
+ }
4723
+ return result;
4724
+ }, [compareSeriesProp, chartType, getSymbolSize]);
4725
+ const NF = NumberFormat({ notation: "compact", maximumSignificantDigits });
4726
+ const NF_LARGE = NumberFormat({ notation: "scientific" });
4727
+ const seriesIdToYAxisName = overlay?.seriesIdToYAxisName ?? /* @__PURE__ */ new Map();
4728
+ const overlaySeriesIdToFormatter = overlay?.overlaySeriesIdToFormatter ?? /* @__PURE__ */ new Map();
4729
+ const applyOverlaySeries = overlay?.applyOverlaySeries ?? ((options2) => options2);
4730
+ const setYAxisWrap = (yAxis2) => {
4731
+ setYAxis(yAxis2);
4732
+ onChangeConfig?.({ ...config, yAxis: yAxis2 });
4733
+ };
4734
+ let yAxisLabel;
4735
+ const [start, end] = useMemo9(() => {
4736
+ const [dataStart, dataEnd] = dateRangeOfSeries(series);
4737
+ const selectStart = startTime && toDayjs2(startTime, true).toDate();
4738
+ const selectEnd = endTime && toDayjs2(endTime, false).toDate();
4739
+ const selStart = selectStart ? shiftTimezone(selectStart, tz) : void 0;
4740
+ const selEnd = selectEnd ? shiftTimezone(selectEnd, tz) : void 0;
4741
+ const start2 = dataStart && selStart ? dataStart.getTime() < selStart.getTime() ? dataStart : selStart : selStart;
4742
+ const end2 = dataEnd && selEnd ? dataEnd.getTime() > selEnd.getTime() ? dataEnd : selEnd : selEnd;
4743
+ return [start2, end2];
4744
+ }, [series, startTime, endTime]);
4745
+ const xLabelFormatter = useMemo9(() => {
4746
+ return config?.xAxis?.type === "category" ? (value) => {
4747
+ const date = shiftTimezone(value, tz);
4748
+ let interval = config?.timeRangeOverride?.timeRange?.interval;
4749
+ if (!interval && start && end) {
4750
+ interval = calculateStepByDate(start, end);
4751
+ }
4752
+ return formatTime(date, tz, interval);
4753
+ } : void 0;
4754
+ }, [
4755
+ config?.xAxis?.type,
4756
+ config?.timeRangeOverride?.timeRange,
4757
+ tz,
4758
+ start,
4759
+ end
4760
+ ]);
4761
+ const tooltipParmsRef = useRef4({});
4762
+ const getSeriesContext = useCallback4(
4763
+ (seriesId, seriesIndex) => {
4764
+ const params = tooltipParmsRef.current?.data;
4765
+ if (!params || !seriesToMetricLabelsRef) {
4766
+ return null;
4767
+ }
4768
+ let value;
4769
+ let idx;
4770
+ if (Array.isArray(params)) {
4771
+ const param = params.find(
4772
+ (p) => p.seriesId === seriesId || p.seriesIndex === seriesIndex
4773
+ );
4774
+ if (!param) return null;
4775
+ value = param.value;
4776
+ idx = param.seriesIndex;
4777
+ } else {
4778
+ value = params.value;
4779
+ idx = seriesIndex;
4780
+ }
4781
+ if (!value) return null;
4782
+ const {
4783
+ labels = {},
4784
+ name = "",
4785
+ id
4786
+ } = seriesToMetricLabelsRef[idx] || {};
4787
+ const isEventSeries = eventNameMapRef.has(id) || sourceType === "ANALYTICS";
4788
+ let eventName;
4789
+ if (sourceType === "ANALYTICS") {
4790
+ try {
4791
+ const _eventName = getEventNameById?.(id);
4792
+ eventName = _eventName == void 0 ? getEventName(name) : _eventName;
4793
+ } catch {
4794
+ }
4795
+ } else if (eventNameMapRef.has(id)) {
4796
+ eventName = eventNameMapRef.get(id) || void 0;
4797
+ }
4798
+ const query = eventsQueryMapRef.get(id);
4799
+ return {
4800
+ value,
4801
+ labels,
4802
+ name,
4803
+ id,
4804
+ isEventSeries,
4805
+ eventName,
4806
+ query
4807
+ };
4808
+ },
4809
+ [
4810
+ seriesToMetricLabelsRef,
4811
+ eventNameMapRef,
4812
+ eventsQueryMapRef,
4813
+ sourceType,
4814
+ getEventNameById
4815
+ ]
4816
+ );
4817
+ const handleViewLogs = useCallback4(
4818
+ (seriesId, seriesIndex) => {
4819
+ const ctx = getSeriesContext(seriesId, seriesIndex);
4820
+ if (!ctx) return;
4821
+ onViewLogs?.(ctx);
4822
+ },
4823
+ [getSeriesContext, onViewLogs]
4824
+ );
4825
+ const handleViewUsers = useCallback4(
4826
+ (seriesId, seriesIndex) => {
4827
+ const ctx = getSeriesContext(seriesId, seriesIndex);
4828
+ if (!ctx) return;
4829
+ onViewUsers?.(ctx);
4830
+ },
4831
+ [getSeriesContext, onViewUsers]
4832
+ );
4833
+ const getViewLogDisabled = useCallback4(
4834
+ (seriesId, seriesIndex) => {
4835
+ const ctx = getSeriesContext(seriesId, seriesIndex);
4836
+ return viewLogDisabledProp?.(ctx) ?? false;
4837
+ },
4838
+ [getSeriesContext, viewLogDisabledProp]
4839
+ );
4840
+ const getViewUsersDisabled = useCallback4(
4841
+ (seriesId, seriesIndex) => {
4842
+ const ctx = getSeriesContext(seriesId, seriesIndex);
4843
+ return viewUsersDisabledProp?.(ctx) ?? false;
4844
+ },
4845
+ [getSeriesContext, viewUsersDisabledProp]
4846
+ );
4847
+ const tooltipFormatter = useCallback4(
4848
+ (params) => {
4849
+ const paramsArray = Array.isArray(params) ? params : [params];
4850
+ if (allowClick) {
4851
+ yAxisRef.current = paramsArray.map((param) => ({
4852
+ value: param.value,
4853
+ seriesIndex: param.seriesIndex,
4854
+ seriesName: param.seriesName
4855
+ }));
4856
+ }
4857
+ let title2 = void 0;
4858
+ if (nonXAxis) {
4859
+ const value = paramsArray?.[0]?.data?.[0];
4860
+ title2 = `${config?.xAxis?.column ? `${config?.xAxis?.column}:` : ""} ${value}`;
4861
+ } else if (xLabelFormatter) {
4862
+ const value = paramsArray?.[0]?.data?.[0];
4863
+ title2 = xLabelFormatter(value);
4864
+ }
4865
+ const annotatedParams = paramsArray.map((param) => {
4866
+ const yAxisName = seriesIdToYAxisName.get(param.seriesId);
4867
+ if (yAxisName) {
4868
+ return { ...param, seriesName: `${param.seriesName}(${yAxisName})` };
4869
+ }
4870
+ return param;
4871
+ });
4872
+ const parmas = {
4873
+ data: chartType === "SCATTER" ? params : annotatedParams,
4874
+ title: title2,
4875
+ highlightSeriesId: global.highlightSeriesId,
4876
+ compareTimeDuration: config?.timeRangeOverride?.compareTime?.ago,
4877
+ numberFormatter: (value, seriesId) => {
4878
+ const seriesFormatter = seriesId ? overlaySeriesIdToFormatter.get(seriesId) : void 0;
4879
+ if (seriesFormatter) {
4880
+ return seriesFormatter(value);
4881
+ }
4882
+ return numberFormatter(value);
4883
+ },
4884
+ showTotal: config?.valueConfig?.tooltipTotal,
4885
+ // Gate on the outward props existing (same as the original gating on the
4886
+ // handlers existing): no handler → button doesn't render.
4887
+ onViewLogs: onViewLogs ? handleViewLogs : void 0,
4888
+ viewLogDisabled: onViewLogs ? getViewLogDisabled : void 0,
4889
+ onViewUsers: onViewUsers ? handleViewUsers : void 0,
4890
+ viewUsersDisabled: onViewUsers ? getViewUsersDisabled : void 0,
4891
+ sizeTitle: config?.scatterConfig?.symbolSize
4892
+ };
4893
+ tooltipParmsRef.current = parmas;
4894
+ if (chartType === "SCATTER") {
4895
+ return ReactDOMServer.renderToString(
4896
+ /* @__PURE__ */ jsx28(
4897
+ ScatterChartTooltip,
4898
+ {
4899
+ ...parmas,
4900
+ onViewLogs: void 0,
4901
+ viewLogDisabled: void 0,
4902
+ onViewUsers: void 0,
4903
+ viewUsersDisabled: void 0,
4904
+ sizeTitle: config?.scatterConfig?.symbolSize
4905
+ }
4906
+ )
4907
+ );
4908
+ } else {
4909
+ return ReactDOMServer.renderToString(
4910
+ /* @__PURE__ */ jsx28(
4911
+ ChartTooltip,
4912
+ {
4913
+ ...parmas,
4914
+ onViewLogs: void 0,
4915
+ viewLogDisabled: void 0,
4916
+ onViewUsers: void 0,
4917
+ viewUsersDisabled: void 0
4918
+ }
4919
+ )
4920
+ );
4921
+ }
4922
+ },
4923
+ [
4924
+ allowClick,
4925
+ numberFormatter,
4926
+ overlaySeriesIdToFormatter,
4927
+ config,
4928
+ nonXAxis,
4929
+ chartType,
4930
+ xLabelFormatter,
4931
+ onViewLogs,
4932
+ handleViewLogs,
4933
+ getViewLogDisabled,
4934
+ onViewUsers,
4935
+ handleViewUsers,
4936
+ getViewUsersDisabled,
4937
+ seriesIdToYAxisName
4938
+ ]
4939
+ );
4940
+ const [active, setActive] = useState10(false);
4941
+ const onSelect = useCallback4(
4942
+ (start2, end2) => {
4943
+ if (onSelectTimeRange && active) {
4944
+ let startTime2 = fromNumber(start2);
4945
+ let endTime2 = fromNumber(end2);
4946
+ const interval = config?.timeRangeOverride?.timeRange?.interval;
4947
+ if (interval) {
4948
+ startTime2 = alignTime(startTime2, interval, tz, "start");
4949
+ endTime2 = alignTime(endTime2, interval, tz, "end");
4950
+ }
4951
+ onSelectTimeRange(startTime2, endTime2);
4952
+ }
4953
+ },
4954
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4955
+ [onSelectTimeRange, active]
4956
+ );
4957
+ const allowBrush = useMemo9(() => {
4958
+ if (nonXAxis) {
4959
+ return false;
4960
+ }
4961
+ if (onSelectTimeRange && startTime && endTime) {
4962
+ const interval = config?.timeRangeOverride?.timeRange?.interval;
4963
+ const diff = toDayjs2(endTime).diff(toDayjs2(startTime), "seconds");
4964
+ return interval ? diff > durationToSeconds(interval) : true;
4965
+ }
4966
+ return false;
4967
+ }, [
4968
+ config?.timeRangeOverride?.timeRange,
4969
+ startTime,
4970
+ endTime,
4971
+ onSelectTimeRange,
4972
+ nonXAxis
4973
+ ]);
4974
+ const xAxisData = useMemo9(() => {
4975
+ if (nonXAxis) {
4976
+ return [
4977
+ {
4978
+ type: "category",
4979
+ axisLabel: {
4980
+ hideOverlap: true,
4981
+ fontSize: 11
4982
+ },
4983
+ name: config?.xAxis?.name
4984
+ }
4985
+ ];
4986
+ }
4987
+ const ret = [
4988
+ {
4989
+ type: config?.xAxis?.type || "time",
4990
+ min: config?.xAxis?.type === "category" ? void 0 : start,
4991
+ max: config?.xAxis?.type === "category" ? void 0 : end,
4992
+ axisLabel: {
4993
+ hideOverlap: true,
4994
+ fontSize: 11,
4995
+ formatter: xLabelFormatter
4996
+ },
4997
+ axisTick: {
4998
+ show: false
4999
+ }
5000
+ }
5001
+ ];
5002
+ if (config?.xAxis?.name) {
5003
+ ret[0].name = config?.xAxis?.name;
5004
+ }
5005
+ if (config?.timeRangeOverride?.compareTime?.ago) {
5006
+ const d = config?.timeRangeOverride?.compareTime?.ago;
5007
+ const compareStart = toDayjs2(timeBefore(dayjs5(start), d, true)).toDate();
5008
+ const compareEnd = toDayjs2(timeBefore(dayjs5(end), d, false)).toDate();
5009
+ ret.push({
5010
+ show: false,
5011
+ type: config?.xAxis?.type || "time",
5012
+ min: config?.xAxis?.type === "category" ? void 0 : compareStart,
5013
+ max: config?.xAxis?.type === "category" ? void 0 : compareEnd,
5014
+ axisLabel: {
5015
+ hideOverlap: true,
5016
+ fontSize: 11,
5017
+ formatter: xLabelFormatter
5018
+ }
5019
+ });
5020
+ }
5021
+ return ret;
5022
+ }, [
5023
+ config?.timeRangeOverride?.compareTime,
5024
+ start,
5025
+ end,
5026
+ nonXAxis,
5027
+ config?.xAxis,
5028
+ xLabelFormatter
5029
+ ]);
5030
+ const options = useMemo9(() => {
5031
+ const primarySeries = xAxisData.length == 2 ? [...series, ...compareSeries] : series;
5032
+ const primaryYAxis = {
5033
+ type: "value",
5034
+ axisLabel: {
5035
+ formatter: function(value) {
5036
+ if (value == yAxisLabel && maximumSignificantDigits < 21) {
5037
+ setMaximumSignificantDigits(maximumSignificantDigits + 1);
5038
+ }
5039
+ yAxisLabel = value;
5040
+ if (value > 1e21) {
5041
+ return NF_LARGE.format(value);
5042
+ }
5043
+ return NF.format(value);
5044
+ },
5045
+ margin: chartType === "SCATTER" ? config?.scatterConfig?.maxSize ? config.scatterConfig.maxSize : 30 : 4
5046
+ },
5047
+ ...yAxisToChartOption(
5048
+ yAxis,
5049
+ markLines,
5050
+ primarySeries
5051
+ )
5052
+ };
5053
+ const baseOptions = {
5054
+ title: {
5055
+ text: title
5056
+ },
5057
+ grid: {
5058
+ top: title ? 48 : 16,
5059
+ right: chartType === "SCATTER" ? 16 : 8,
5060
+ bottom: 8,
5061
+ left: chartType === "SCATTER" ? 20 : 12,
5062
+ containLabel: true
5063
+ },
5064
+ xAxis: xAxisData,
5065
+ dataZoom: {
5066
+ type: "inside",
5067
+ zoomLock: true
5068
+ },
5069
+ legend: {
5070
+ data: legend,
5071
+ top: -1e4,
5072
+ left: -1e4
5073
+ },
5074
+ brush: allowBrush ? {
5075
+ xAxisIndex: 0
5076
+ } : void 0,
5077
+ toolbox: {
5078
+ show: false
5079
+ },
5080
+ yAxis: primaryYAxis,
5081
+ animation: false,
5082
+ series: primarySeries,
5083
+ tooltip: {
5084
+ trigger: chartType === "SCATTER" ? "item" : "axis",
5085
+ confine: true,
5086
+ textStyle: {
5087
+ fontSize: 14,
5088
+ fontFamily: sansFontFamily
5089
+ },
5090
+ extraCssText: "max-width: 75%; max-height: 50vh; overflow-y: auto; padding: 10px 0; background-color: rgba(var(--text-background)); border-color: rgba(var(--border-color));",
5091
+ formatter: tooltipFormatter
5092
+ },
5093
+ visualMap: chartType === "SCATTER" && config?.scatterConfig?.color && sentioColors.dark[config.scatterConfig.color] ? {
5094
+ dimension: 2,
5095
+ min: minRef.current,
5096
+ max: maxRef.current,
5097
+ show: false,
5098
+ inRange: {
5099
+ color: isDarkMode ? sentioColors.dark[config.scatterConfig.color] : sentioColors.light[config.scatterConfig.color]
5100
+ }
5101
+ } : void 0
5102
+ };
5103
+ const finalOptions = applyOverlaySeries(baseOptions);
5104
+ if (isDarkMode && Array.isArray(finalOptions.series)) {
5105
+ finalOptions.series = applyDarkAreaOpacity(
5106
+ finalOptions.series
5107
+ );
5108
+ }
5109
+ return finalOptions;
5110
+ }, [
5111
+ title,
5112
+ xAxisData,
5113
+ legend,
5114
+ allowBrush,
5115
+ yAxis,
5116
+ series,
5117
+ compareSeries,
5118
+ applyOverlaySeries,
5119
+ tooltipFormatter,
5120
+ maximumSignificantDigits,
5121
+ xAxis,
5122
+ chartType,
5123
+ isDarkMode
5124
+ ]);
5125
+ const {
5126
+ value: isOpen,
5127
+ setFalse: setClose,
5128
+ setTrue: setOpen
5129
+ } = useBoolean(false);
5130
+ const clickEventParamsRef = useRef4(null);
5131
+ const [selectedSeriesIndex, setSelectedSeriesIndex] = useState10(0);
5132
+ const chartPositionRef = useRef4(null);
5133
+ const { x, y, strategy, refs } = useFloating3({
5134
+ open: isOpen,
5135
+ placement: "right",
5136
+ middleware: [flip(), shift2()]
5137
+ });
5138
+ const onClick = useCallback4(
5139
+ (params, rawParams) => {
5140
+ if (!params) {
5141
+ setClose();
5142
+ return;
5143
+ }
5144
+ const baseBoundingRect = chartPositionRef.current?.getBoundingClientRect();
5145
+ if (params.event) {
5146
+ const { event } = params;
5147
+ clickEventParamsRef.current = params;
5148
+ const targetBoundRect = event.target.getBoundingRect();
5149
+ refs.setPositionReference({
5150
+ getBoundingClientRect: () => {
5151
+ return {
5152
+ x: event.offsetX + (baseBoundingRect?.x ?? 0),
5153
+ y: event.offsetY + (baseBoundingRect?.y ?? 0),
5154
+ width: targetBoundRect.width,
5155
+ height: targetBoundRect.height,
5156
+ top: event.offsetY + (baseBoundingRect?.top ?? 0),
5157
+ right: event.offsetX + (baseBoundingRect?.right ?? 0),
5158
+ bottom: event.offsetY + (baseBoundingRect?.bottom ?? 0),
5159
+ left: event.offsetX + (baseBoundingRect?.left ?? 0)
5160
+ };
5161
+ }
5162
+ });
5163
+ } else if (isArray(params)) {
5164
+ const targetValue = closestNumber(
5165
+ yAxisRef.current?.map((item) => item.value[1]),
5166
+ params[1]
5167
+ );
5168
+ clickEventParamsRef.current = yAxisRef.current?.find(
5169
+ (item) => item.value[1] === targetValue
5170
+ );
5171
+ refs.setPositionReference({
5172
+ getBoundingClientRect: () => {
5173
+ return {
5174
+ x: rawParams.offsetX + (baseBoundingRect?.x ?? 0),
5175
+ y: rawParams.offsetY + (baseBoundingRect?.y ?? 0),
5176
+ width: 10,
5177
+ height: 10,
5178
+ top: rawParams.offsetY + (baseBoundingRect?.top ?? 0),
5179
+ right: rawParams.offsetX + (baseBoundingRect?.right ?? 0),
5180
+ bottom: rawParams.offsetY + (baseBoundingRect?.bottom ?? 0),
5181
+ left: rawParams.offsetX + (baseBoundingRect?.left ?? 0)
5182
+ };
5183
+ }
5184
+ });
5185
+ }
5186
+ setOpen();
5187
+ },
5188
+ [refs, setClose, setOpen]
5189
+ );
5190
+ const onSeriesEvent = useCallback4((event, params) => {
5191
+ switch (event) {
5192
+ case "click":
5193
+ setSelectedSeriesIndex(params.seriesIndex);
5194
+ break;
5195
+ case "mouseover":
5196
+ ;
5197
+ global.highlightSeriesId = params.seriesId;
5198
+ document.querySelectorAll(`.series_${params.seriesId}`).forEach((node) => {
5199
+ node.classList.add("highlighted");
5200
+ });
5201
+ break;
5202
+ case "mouseout":
5203
+ const previousSeriesId = global.highlightSeriesId;
5204
+ if (previousSeriesId) {
5205
+ document.querySelectorAll(`.series_${previousSeriesId}`).forEach((node) => {
5206
+ node.classList.remove("highlighted");
5207
+ });
5208
+ }
5209
+ ;
5210
+ global.highlightSeriesId = "";
5211
+ }
5212
+ }, []);
5213
+ const onSelectSeries = useCallback4(
5214
+ (seriesIndex) => {
5215
+ clickEventParamsRef.current = {
5216
+ seriesIndex,
5217
+ seriesName: series[seriesIndex].name
5218
+ };
5219
+ if (yAxisRef.current[seriesIndex]?.value) {
5220
+ clickEventParamsRef.current.value = yAxisRef.current[seriesIndex].value;
5221
+ }
5222
+ setSelectedSeriesIndex(seriesIndex);
5223
+ },
5224
+ [series, setSelectedSeriesIndex]
5225
+ );
5226
+ const switchSeries = useMemo9(() => {
5227
+ const items = [
5228
+ series.map((serie, index) => ({
5229
+ label: serie.name || "",
5230
+ key: `${index}`
5231
+ }))
5232
+ ];
5233
+ return /* @__PURE__ */ jsx28(
5234
+ PopupMenuButton,
5235
+ {
5236
+ onSelect: (d) => onSelectSeries(parseInt(d, 10)),
5237
+ items,
5238
+ buttonIcon: (open) => /* @__PURE__ */ jsx28(
5239
+ "span",
5240
+ {
5241
+ className: classNames8(
5242
+ "text-primary-100",
5243
+ "hover:bg-primary-200/80 inline-block cursor-pointer rounded-md px-1 py-0.5",
5244
+ open ? "bg-primary-200/80" : ""
5245
+ ),
5246
+ children: /* @__PURE__ */ jsx28(LuChevronDown2, { className: "h-3.5 w-3.5" })
5247
+ }
5248
+ ),
5249
+ portal: false,
5250
+ placement: "bottom-end",
5251
+ itemsClassName: "max-h-[50vh] overflow-y-auto"
5252
+ }
5253
+ );
5254
+ }, [series]);
5255
+ void switchSeries;
5256
+ void selectedSeriesIndex;
5257
+ const noLegend = useMemo9(() => {
5258
+ if (chartType === "SCATTER" && series.length === 1) {
5259
+ return true;
5260
+ }
5261
+ return _noLegend;
5262
+ }, [_noLegend, chartType, series?.length]);
5263
+ console.log("options", options);
5264
+ return /* @__PURE__ */ jsxs18(
5265
+ "div",
5266
+ {
5267
+ className: "h-full w-full",
5268
+ onMouseOver: () => {
5269
+ setActive(true);
5270
+ },
5271
+ onMouseOut: () => {
5272
+ setActive(false);
5273
+ },
5274
+ children: [
5275
+ /* @__PURE__ */ jsx28(
5276
+ ReactEChartsBase,
5277
+ {
5278
+ ref,
5279
+ loading,
5280
+ group,
5281
+ option: options,
5282
+ minHeight,
5283
+ returnedSeries,
5284
+ totalSeries,
5285
+ onSelect,
5286
+ onClick: allowClick ? onClick : void 0,
5287
+ style,
5288
+ onSeriesEvent,
5289
+ noLegend,
5290
+ onInitChart
5291
+ }
5292
+ ),
5293
+ controls && nonXAxis && /* @__PURE__ */ jsx28(XAxisControls, { xAxis, setXAxis, defaultOpen: true }),
5294
+ controls && /* @__PURE__ */ jsx28(YaxisControls, { yAxis, setYAxis: setYAxisWrap }),
5295
+ /* @__PURE__ */ jsx28("div", { className: "absolute left-0 top-0", ref: chartPositionRef }),
5296
+ isOpen && allowClick && /* @__PURE__ */ jsx28(FloatingPortal2, { children: /* @__PURE__ */ jsx28(FloatingOverlay, { className: "z-50 bg-gray-100/20", onClick: setClose, children: /* @__PURE__ */ jsx28(
5297
+ "div",
5298
+ {
5299
+ ref: refs.setFloating,
5300
+ className: "border-border-color bg-default-bg min-w-64 absolute w-fit divide-y rounded-md border pb-2 shadow-sm",
5301
+ style: {
5302
+ position: strategy,
5303
+ top: 0,
5304
+ left: 0,
5305
+ transform: `translate(${roundByDPR(x || 0)}px,${roundByDPR(y || 0)}px)`
5306
+ },
5307
+ onClick: onClickPreventDefault,
5308
+ children: /* @__PURE__ */ jsx28("div", { className: "text-text-foreground max-h-80 max-w-[50vw] overflow-y-auto py-2 text-sm", children: chartType === "SCATTER" ? /* @__PURE__ */ jsx28(ScatterChartTooltip, { ...tooltipParmsRef.current, isFixed: true }) : /* @__PURE__ */ jsx28(ChartTooltip, { ...tooltipParmsRef.current, isFixed: true }) })
5309
+ }
5310
+ ) }) })
5311
+ ]
5312
+ }
5313
+ );
5314
+ }
5315
+ );
5316
+ TimeSeriesChart.displayName = "TimeSeriesChart";
5317
+ function computeMarkLines(series, markLines) {
5318
+ if (markLines && markLines.length > 0 && series.length > 0) {
5319
+ series[0] = {
5320
+ ...series[0],
5321
+ markLine: {
5322
+ symbol: [],
5323
+ data: markLines.map((area) => {
5324
+ if (area.from || area.to) {
5325
+ return [
5326
+ {
5327
+ name: "threshold",
5328
+ xAxis: area.from,
5329
+ yAxis: area.value ?? "min",
5330
+ symbol: "react",
5331
+ symbolSize: [20, 1],
5332
+ symbolOffset: [area.below ? -10 : 10, 0],
5333
+ label: {
5334
+ formatter: `${area.label}`,
5335
+ position: area.below ? "insideMiddleBottom" : "insideMiddleTop",
5336
+ color: area.color || "#ff0000"
5337
+ },
5338
+ lineStyle: {
5339
+ color: area.color || "#ff0000"
5340
+ }
5341
+ },
5342
+ {
5343
+ symbol: "rect",
5344
+ symbolSize: [20, 1],
5345
+ symbolOffset: [area.below ? 10 : -10, 0],
5346
+ xAxis: area.to ? area.to : void 0,
5347
+ yAxis: area.value ?? "max"
5348
+ }
5349
+ ];
5350
+ } else {
5351
+ return {
5352
+ name: "threshold",
5353
+ yAxis: area.value,
5354
+ symbol: "react",
5355
+ symbolSize: [20, 1],
5356
+ symbolOffset: [area.below ? -10 : 10, 0],
5357
+ label: {
5358
+ formatter: `${area.label}`,
5359
+ position: area.below ? "insideStartBottom" : "insideStartTop",
5360
+ color: area.color || "#ff0000"
5361
+ },
5362
+ lineStyle: {
5363
+ color: area.color || "#ff0000"
5364
+ }
5365
+ };
5366
+ }
5367
+ })
5368
+ }
5369
+ };
5370
+ }
5371
+ }
5372
+ function computeMarksAreas(series, markAreas) {
5373
+ if (markAreas && markAreas.length > 0 && series.length > 0) {
5374
+ series[0].markArea = {
5375
+ itemStyle: {
5376
+ color: markAreas[0].color || "rgba(255, 173, 177, 0.4)"
5377
+ }
5378
+ };
5379
+ series[0].markArea.data = markAreas.map((markArea) => {
5380
+ return [
5381
+ {
5382
+ xAxis: markArea.from ? markArea.from : void 0
5383
+ },
5384
+ {
5385
+ xAxis: markArea.to ? markArea.to : void 0
5386
+ }
5387
+ ];
5388
+ });
5389
+ }
5390
+ }
5391
+ var MIN_SIZE = 5;
5392
+ var MAX_SIZE = 30;
5393
+ var LEVELS = 10;
5394
+ function normalize(value, min, max, minSize = MIN_SIZE, maxSize = MAX_SIZE) {
5395
+ if (max === min) return MIN_SIZE;
5396
+ if (value <= min) return minSize;
5397
+ if (value >= max) return maxSize;
5398
+ const range = max - min;
5399
+ const levelRange = range / LEVELS;
5400
+ const sizeIncrement = (maxSize - minSize) / (LEVELS - 1);
5401
+ const level = Math.floor((value - min) / levelRange);
5402
+ const clampedLevel = Math.min(level, LEVELS - 1);
5403
+ return minSize + clampedLevel * sizeIncrement;
5404
+ }
5405
+
3916
5406
  // src/charts/options/LineControls.tsx
3917
5407
  import { produce as produce4 } from "immer";
3918
5408
  import {
3919
- DisclosurePanel,
5409
+ DisclosurePanel as DisclosurePanel3,
3920
5410
  NewButtonGroup as ButtonGroup2,
3921
- Checkbox
5411
+ Checkbox as Checkbox2
3922
5412
  } from "@sentio/ui-core";
3923
- import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
5413
+ import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
3924
5414
  var lineStyles = [
3925
5415
  { label: "Solid", value: "Solid" },
3926
5416
  { label: "Dotted", value: "Dotted" }
@@ -3940,13 +5430,13 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
3940
5430
  })
3941
5431
  );
3942
5432
  };
3943
- return /* @__PURE__ */ jsx25(
3944
- DisclosurePanel,
5433
+ return /* @__PURE__ */ jsx29(
5434
+ DisclosurePanel3,
3945
5435
  {
3946
5436
  title: "Line style",
3947
5437
  containerClassName: "w-full bg-default-bg",
3948
- children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-4", children: [
3949
- /* @__PURE__ */ jsx25(
5438
+ children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-4", children: [
5439
+ /* @__PURE__ */ jsx29(
3950
5440
  ButtonGroup2,
3951
5441
  {
3952
5442
  buttons: lineStyles,
@@ -3955,8 +5445,8 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
3955
5445
  small: true
3956
5446
  }
3957
5447
  ),
3958
- /* @__PURE__ */ jsx25(
3959
- Checkbox,
5448
+ /* @__PURE__ */ jsx29(
5449
+ Checkbox2,
3960
5450
  {
3961
5451
  label: "Smooth Curves",
3962
5452
  checked: config?.smooth,
@@ -3969,16 +5459,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
3969
5459
  };
3970
5460
 
3971
5461
  // src/charts/options/LabelControls.tsx
3972
- import { useEffect as useEffect8, useMemo as useMemo9 } from "react";
5462
+ import { useEffect as useEffect9, useMemo as useMemo10 } from "react";
3973
5463
  import { produce as produce5 } from "immer";
3974
- import { Button as NewButton2, DisclosurePanel as DisclosurePanel2, HelpIcon as HelpIcon2 } from "@sentio/ui-core";
3975
- import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
3976
- var initialConfig = {
5464
+ import { Button as NewButton2, DisclosurePanel as DisclosurePanel4, HelpIcon as HelpIcon2 } from "@sentio/ui-core";
5465
+ import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
5466
+ var initialConfig3 = {
3977
5467
  columns: [],
3978
5468
  alias: ""
3979
5469
  };
3980
5470
  var LabelControls = ({ config, setConfig, defaultOpen }) => {
3981
- useEffect8(() => {
5471
+ useEffect9(() => {
3982
5472
  if (config?.columns && config.columns.length > 0 && !config.alias) {
3983
5473
  const aliasParts = [];
3984
5474
  config.columns.forEach((colConfig) => {
@@ -4003,36 +5493,36 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
4003
5493
  }, [config, setConfig]);
4004
5494
  const onAliasChanged = (alias) => {
4005
5495
  setConfig(
4006
- produce5(config ?? initialConfig, (draft) => {
5496
+ produce5(config ?? initialConfig3, (draft) => {
4007
5497
  draft.alias = alias;
4008
5498
  })
4009
5499
  );
4010
5500
  };
4011
- const _defaultOpen = useMemo9(() => {
5501
+ const _defaultOpen = useMemo10(() => {
4012
5502
  if (defaultOpen) {
4013
5503
  return true;
4014
5504
  }
4015
5505
  return config?.alias !== "" || config?.columns && config.columns.length > 0;
4016
5506
  }, [config, defaultOpen]);
4017
- return /* @__PURE__ */ jsx26(
4018
- DisclosurePanel2,
5507
+ return /* @__PURE__ */ jsx30(
5508
+ DisclosurePanel4,
4019
5509
  {
4020
5510
  title: "Label Controls",
4021
5511
  defaultOpen: _defaultOpen,
4022
5512
  containerClassName: "w-full bg-default-bg",
4023
- children: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
4024
- /* @__PURE__ */ jsxs17("div", { className: "inline-flex h-8", children: [
4025
- /* @__PURE__ */ jsxs17("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
5513
+ children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
5514
+ /* @__PURE__ */ jsxs20("div", { className: "inline-flex h-8", children: [
5515
+ /* @__PURE__ */ jsxs20("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
4026
5516
  "Label Alias",
4027
- /* @__PURE__ */ jsx26(
5517
+ /* @__PURE__ */ jsx30(
4028
5518
  HelpIcon2,
4029
5519
  {
4030
- text: /* @__PURE__ */ jsxs17("div", { className: "text-icontent text-text-foreground", children: [
4031
- /* @__PURE__ */ jsx26("div", { children: "Series name override or template." }),
4032
- /* @__PURE__ */ jsxs17("div", { children: [
5520
+ text: /* @__PURE__ */ jsxs20("div", { className: "text-icontent text-text-foreground", children: [
5521
+ /* @__PURE__ */ jsx30("div", { children: "Series name override or template." }),
5522
+ /* @__PURE__ */ jsxs20("div", { children: [
4033
5523
  "Ex.",
4034
5524
  " ",
4035
- /* @__PURE__ */ jsx26("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
5525
+ /* @__PURE__ */ jsx30("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
4036
5526
  " ",
4037
5527
  "will be replaced with the value of the contract label."
4038
5528
  ] })
@@ -4040,7 +5530,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
4040
5530
  }
4041
5531
  )
4042
5532
  ] }),
4043
- /* @__PURE__ */ jsx26(
5533
+ /* @__PURE__ */ jsx30(
4044
5534
  "input",
4045
5535
  {
4046
5536
  type: "text",
@@ -4051,13 +5541,13 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
4051
5541
  }
4052
5542
  )
4053
5543
  ] }),
4054
- /* @__PURE__ */ jsx26(
5544
+ /* @__PURE__ */ jsx30(
4055
5545
  NewButton2,
4056
5546
  {
4057
5547
  type: "button",
4058
5548
  role: "link",
4059
5549
  onClick: () => {
4060
- setConfig(initialConfig);
5550
+ setConfig(initialConfig3);
4061
5551
  },
4062
5552
  children: "Reset"
4063
5553
  }
@@ -4069,13 +5559,13 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
4069
5559
 
4070
5560
  // src/charts/options/PieChartControls.tsx
4071
5561
  import { produce as produce6 } from "immer";
4072
- import { defaults } from "lodash";
5562
+ import { defaults as defaults3 } from "lodash";
4073
5563
  import {
4074
- Checkbox as Checkbox2,
4075
- DisclosurePanel as DisclosurePanel3,
5564
+ Checkbox as Checkbox3,
5565
+ DisclosurePanel as DisclosurePanel5,
4076
5566
  NewButtonGroup as ButtonGroup3
4077
5567
  } from "@sentio/ui-core";
4078
- import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
5568
+ import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
4079
5569
  var defaultConfig = {
4080
5570
  pieType: "Pie",
4081
5571
  calculation: "LAST",
@@ -4096,7 +5586,7 @@ var PieTypeItems = [
4096
5586
  { label: "Donut", value: "Donut" }
4097
5587
  ];
4098
5588
  function PieChartControls({ config, defaultOpen, onChange }) {
4099
- config = defaults(config, defaultConfig);
5589
+ config = defaults3(config, defaultConfig);
4100
5590
  function onCalculationChange(cal) {
4101
5591
  config && onChange(produce6(config, (draft) => void (draft.calculation = cal)));
4102
5592
  }
@@ -4110,14 +5600,14 @@ function PieChartControls({ config, defaultOpen, onChange }) {
4110
5600
  })
4111
5601
  );
4112
5602
  }
4113
- return /* @__PURE__ */ jsx27(
4114
- DisclosurePanel3,
5603
+ return /* @__PURE__ */ jsx31(
5604
+ DisclosurePanel5,
4115
5605
  {
4116
5606
  title: "Pie Chart Options",
4117
5607
  defaultOpen,
4118
5608
  containerClassName: "w-full bg-default-bg",
4119
- children: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-4", children: [
4120
- /* @__PURE__ */ jsx27("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ jsx27(
5609
+ children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-4", children: [
5610
+ /* @__PURE__ */ jsx31("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ jsx31(
4121
5611
  ButtonGroup3,
4122
5612
  {
4123
5613
  small: true,
@@ -4126,22 +5616,22 @@ function PieChartControls({ config, defaultOpen, onChange }) {
4126
5616
  onChange: onPieTypeChange
4127
5617
  }
4128
5618
  ) }),
4129
- /* @__PURE__ */ jsxs18("div", { className: "shadow-xs flex rounded-md", children: [
4130
- /* @__PURE__ */ jsx27("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
4131
- /* @__PURE__ */ jsx27(
5619
+ /* @__PURE__ */ jsxs21("div", { className: "shadow-xs flex rounded-md", children: [
5620
+ /* @__PURE__ */ jsx31("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
5621
+ /* @__PURE__ */ jsx31(
4132
5622
  "select",
4133
5623
  {
4134
5624
  value: config.calculation,
4135
5625
  className: "sm:text-ilabel text-text-foreground border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
4136
5626
  onChange: (e) => onCalculationChange(e.target.value),
4137
5627
  children: CalculationItems.map((d) => {
4138
- return /* @__PURE__ */ jsx27("option", { value: d.value, children: d.label }, d.value);
5628
+ return /* @__PURE__ */ jsx31("option", { value: d.value, children: d.label }, d.value);
4139
5629
  })
4140
5630
  }
4141
5631
  )
4142
5632
  ] }),
4143
- /* @__PURE__ */ jsx27(
4144
- Checkbox2,
5633
+ /* @__PURE__ */ jsx31(
5634
+ Checkbox3,
4145
5635
  {
4146
5636
  checked: config?.showValue,
4147
5637
  onChange: (v) => toggle("showValue", v),
@@ -4149,8 +5639,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
4149
5639
  labelClassName: "whitespace-nowrap"
4150
5640
  }
4151
5641
  ),
4152
- /* @__PURE__ */ jsx27(
4153
- Checkbox2,
5642
+ /* @__PURE__ */ jsx31(
5643
+ Checkbox3,
4154
5644
  {
4155
5645
  checked: config?.showPercent,
4156
5646
  onChange: (v) => toggle("showPercent", v),
@@ -4158,8 +5648,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
4158
5648
  labelClassName: "whitespace-nowrap"
4159
5649
  }
4160
5650
  ),
4161
- /* @__PURE__ */ jsx27(
4162
- Checkbox2,
5651
+ /* @__PURE__ */ jsx31(
5652
+ Checkbox3,
4163
5653
  {
4164
5654
  checked: config?.absValue,
4165
5655
  onChange: (v) => toggle("absValue", v),
@@ -4174,9 +5664,9 @@ function PieChartControls({ config, defaultOpen, onChange }) {
4174
5664
 
4175
5665
  // src/charts/options/BarGaugeControls.tsx
4176
5666
  import { produce as produce7 } from "immer";
4177
- import { defaults as defaults2 } from "lodash";
4178
- import { DisclosurePanel as DisclosurePanel4 } from "@sentio/ui-core";
4179
- import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
5667
+ import { defaults as defaults4 } from "lodash";
5668
+ import { DisclosurePanel as DisclosurePanel6 } from "@sentio/ui-core";
5669
+ import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
4180
5670
  var defaultConfig2 = {
4181
5671
  direction: "HORIZONTAL",
4182
5672
  calculation: "LAST",
@@ -4197,16 +5687,16 @@ var CalculationItems2 = [
4197
5687
  { label: "Max", value: "MAX" },
4198
5688
  { label: "Min", value: "MIN" }
4199
5689
  ];
4200
- var sortByItems = [
5690
+ var sortByItems2 = [
4201
5691
  { label: "Name", value: "ByName" },
4202
5692
  { label: "Value", value: "ByValue" }
4203
5693
  ];
4204
- var orderItems = [
5694
+ var orderItems2 = [
4205
5695
  { label: "Ascendant", value: "false" },
4206
5696
  { label: "Descendant", value: "true" }
4207
5697
  ];
4208
5698
  function BarGaugeControls({ config, defaultOpen, onChange }) {
4209
- config = defaults2(config, defaultConfig2);
5699
+ config = defaults4(config, defaultConfig2);
4210
5700
  function onCalculationChange(cal) {
4211
5701
  config && onChange(produce7(config, (draft) => void (draft.calculation = cal)));
4212
5702
  }
@@ -4229,62 +5719,62 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
4229
5719
  })
4230
5720
  );
4231
5721
  }
4232
- return /* @__PURE__ */ jsx28(
4233
- DisclosurePanel4,
5722
+ return /* @__PURE__ */ jsx32(
5723
+ DisclosurePanel6,
4234
5724
  {
4235
5725
  title: "Bar Gauge Options",
4236
5726
  defaultOpen,
4237
5727
  containerClassName: "w-full bg-default-bg",
4238
- children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-4", children: [
4239
- /* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
4240
- /* @__PURE__ */ jsx28("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
4241
- /* @__PURE__ */ jsx28(
5728
+ children: /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-4", children: [
5729
+ /* @__PURE__ */ jsxs22("div", { className: "shadow-xs flex rounded-md", children: [
5730
+ /* @__PURE__ */ jsx32("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
5731
+ /* @__PURE__ */ jsx32(
4242
5732
  "select",
4243
5733
  {
4244
5734
  value: config.direction,
4245
5735
  className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
4246
5736
  onChange: (e) => onDirectionChange(e.target.value),
4247
5737
  children: directionItems.map((d) => {
4248
- return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
5738
+ return /* @__PURE__ */ jsx32("option", { value: d.value, children: d.label }, d.value);
4249
5739
  })
4250
5740
  }
4251
5741
  )
4252
5742
  ] }),
4253
- /* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
4254
- /* @__PURE__ */ jsx28("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
4255
- /* @__PURE__ */ jsx28(
5743
+ /* @__PURE__ */ jsxs22("div", { className: "shadow-xs flex rounded-md", children: [
5744
+ /* @__PURE__ */ jsx32("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
5745
+ /* @__PURE__ */ jsx32(
4256
5746
  "select",
4257
5747
  {
4258
5748
  value: config.calculation,
4259
5749
  className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
4260
5750
  onChange: (e) => onCalculationChange(e.target.value),
4261
5751
  children: CalculationItems2.map((d) => {
4262
- return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
5752
+ return /* @__PURE__ */ jsx32("option", { value: d.value, children: d.label }, d.value);
4263
5753
  })
4264
5754
  }
4265
5755
  )
4266
5756
  ] }),
4267
- /* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
4268
- /* @__PURE__ */ jsx28("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
4269
- /* @__PURE__ */ jsx28(
5757
+ /* @__PURE__ */ jsxs22("div", { className: "shadow-xs flex rounded-md", children: [
5758
+ /* @__PURE__ */ jsx32("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
5759
+ /* @__PURE__ */ jsx32(
4270
5760
  "select",
4271
5761
  {
4272
5762
  value: config?.sort?.sortBy,
4273
5763
  className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center border pl-4 pr-7",
4274
5764
  onChange: (e) => onSortByChange(e.target.value),
4275
- children: sortByItems.map((d) => {
4276
- return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
5765
+ children: sortByItems2.map((d) => {
5766
+ return /* @__PURE__ */ jsx32("option", { value: d.value, children: d.label }, d.value);
4277
5767
  })
4278
5768
  }
4279
5769
  ),
4280
- /* @__PURE__ */ jsx28(
5770
+ /* @__PURE__ */ jsx32(
4281
5771
  "select",
4282
5772
  {
4283
5773
  value: config?.sort?.orderDesc + "",
4284
5774
  className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border border-l-0 pl-4 pr-7",
4285
5775
  onChange: (e) => onOrderChange(e.target.value === "true"),
4286
- children: orderItems.map((d) => {
4287
- return /* @__PURE__ */ jsx28("option", { value: d.value + "", children: d.label }, d.label);
5776
+ children: orderItems2.map((d) => {
5777
+ return /* @__PURE__ */ jsx32("option", { value: d.value + "", children: d.label }, d.label);
4288
5778
  })
4289
5779
  }
4290
5780
  )
@@ -4296,30 +5786,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
4296
5786
 
4297
5787
  // src/charts/options/ValueOptions.tsx
4298
5788
  import { produce as produce9 } from "immer";
4299
- import { ComboInput, classNames as classNames9 } from "@sentio/ui-core";
4300
-
4301
- // src/charts/options/controls-ui.tsx
4302
- import { classNames as classNames7 } from "@sentio/ui-core";
4303
- import { jsx as jsx29 } from "react/jsx-runtime";
4304
- var AddonLabel = ({
4305
- className,
4306
- children
4307
- }) => /* @__PURE__ */ jsx29(
4308
- "span",
4309
- {
4310
- className: classNames7(
4311
- "sm:text-icontent border-main inline-flex items-center whitespace-nowrap bg-gray-50",
4312
- className
4313
- ),
4314
- children
4315
- }
4316
- );
5789
+ import { ComboInput, classNames as classNames10 } from "@sentio/ui-core";
4317
5790
 
4318
5791
  // src/charts/options/ValueStringMapping.tsx
4319
5792
  import { LuPlus, LuTrash2 } from "react-icons/lu";
4320
- import { Button, classNames as classNames8 } from "@sentio/ui-core";
5793
+ import { Button as Button3, classNames as classNames9 } from "@sentio/ui-core";
4321
5794
  import { produce as produce8 } from "immer";
4322
- import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
5795
+ import { jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
4323
5796
  var operators = {
4324
5797
  ">": "greater than",
4325
5798
  ">=": "greater or equal",
@@ -4329,17 +5802,17 @@ var operators = {
4329
5802
  "<=": "less or equal"
4330
5803
  };
4331
5804
  var renderTreeLine = (index, isLast) => {
4332
- return /* @__PURE__ */ jsx30("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ jsxs20("div", { className: "flex h-full w-full items-center", children: [
4333
- /* @__PURE__ */ jsx30(
5805
+ return /* @__PURE__ */ jsx33("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ jsxs23("div", { className: "flex h-full w-full items-center", children: [
5806
+ /* @__PURE__ */ jsx33(
4334
5807
  "div",
4335
5808
  {
4336
- className: classNames8(
5809
+ className: classNames9(
4337
5810
  "w-px bg-gray-300",
4338
5811
  isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
4339
5812
  )
4340
5813
  }
4341
5814
  ),
4342
- /* @__PURE__ */ jsx30("div", { className: "h-px w-3 bg-gray-300" })
5815
+ /* @__PURE__ */ jsx33("div", { className: "h-px w-3 bg-gray-300" })
4343
5816
  ] }) });
4344
5817
  };
4345
5818
  function ValueStringMapping({ rules, onChange }) {
@@ -4370,31 +5843,31 @@ function ValueStringMapping({ rules, onChange }) {
4370
5843
  })
4371
5844
  );
4372
5845
  }
4373
- return /* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col rounded-md py-2", children: [
5846
+ return /* @__PURE__ */ jsxs23("div", { className: "flex w-full flex-col rounded-md py-2", children: [
4374
5847
  (rules || []).map((rule, index) => {
4375
5848
  const isLast = index === (rules || []).length - 1;
4376
- return /* @__PURE__ */ jsxs20(
5849
+ return /* @__PURE__ */ jsxs23(
4377
5850
  "div",
4378
5851
  {
4379
5852
  className: "text-text-foreground flex h-10 items-center py-1",
4380
5853
  children: [
4381
5854
  renderTreeLine(index, isLast),
4382
- /* @__PURE__ */ jsx30("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
4383
- /* @__PURE__ */ jsx30(
5855
+ /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
5856
+ /* @__PURE__ */ jsx33(
4384
5857
  "select",
4385
5858
  {
4386
5859
  value: rule.comparison,
4387
5860
  onChange: (e) => changeRule(index, "comparison", e.target.value),
4388
5861
  className: "rounded-r-0 sm:text-ilabel border-main text-text-foreground focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex h-full items-center rounded-l-md border border-r-0 bg-gray-50 py-1 pl-4 pr-7",
4389
5862
  children: Object.entries(operators).map(([op, display]) => {
4390
- return /* @__PURE__ */ jsxs20("option", { value: op, children: [
5863
+ return /* @__PURE__ */ jsxs23("option", { value: op, children: [
4391
5864
  "is ",
4392
5865
  display
4393
5866
  ] }, op);
4394
5867
  })
4395
5868
  }
4396
5869
  ),
4397
- /* @__PURE__ */ jsx30(
5870
+ /* @__PURE__ */ jsx33(
4398
5871
  "input",
4399
5872
  {
4400
5873
  type: "text",
@@ -4408,8 +5881,8 @@ function ValueStringMapping({ rules, onChange }) {
4408
5881
  }
4409
5882
  }
4410
5883
  ),
4411
- /* @__PURE__ */ jsx30("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
4412
- /* @__PURE__ */ jsx30(
5884
+ /* @__PURE__ */ jsx33("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
5885
+ /* @__PURE__ */ jsx33(
4413
5886
  "input",
4414
5887
  {
4415
5888
  type: "text",
@@ -4423,14 +5896,14 @@ function ValueStringMapping({ rules, onChange }) {
4423
5896
  }
4424
5897
  }
4425
5898
  ),
4426
- /* @__PURE__ */ jsx30(
5899
+ /* @__PURE__ */ jsx33(
4427
5900
  "button",
4428
5901
  {
4429
5902
  type: "button",
4430
5903
  className: "mx-2",
4431
5904
  "aria-label": "remove",
4432
5905
  onClick: () => removeRule(index),
4433
- children: /* @__PURE__ */ jsx30(
5906
+ children: /* @__PURE__ */ jsx33(
4434
5907
  LuTrash2,
4435
5908
  {
4436
5909
  className: "icon text-text-foreground-disabled",
@@ -4444,8 +5917,8 @@ function ValueStringMapping({ rules, onChange }) {
4444
5917
  index
4445
5918
  );
4446
5919
  }),
4447
- /* @__PURE__ */ jsxs20(
4448
- Button,
5920
+ /* @__PURE__ */ jsxs23(
5921
+ Button3,
4449
5922
  {
4450
5923
  type: "button",
4451
5924
  role: "secondary",
@@ -4453,7 +5926,7 @@ function ValueStringMapping({ rules, onChange }) {
4453
5926
  "aria-label": "remove",
4454
5927
  onClick: addRule,
4455
5928
  children: [
4456
- /* @__PURE__ */ jsx30(LuPlus, { className: classNames8("h-4 w-4"), "aria-hidden": "true" }),
5929
+ /* @__PURE__ */ jsx33(LuPlus, { className: classNames9("h-4 w-4"), "aria-hidden": "true" }),
4457
5930
  "Add Formatting Rule"
4458
5931
  ]
4459
5932
  }
@@ -4462,7 +5935,7 @@ function ValueStringMapping({ rules, onChange }) {
4462
5935
  }
4463
5936
 
4464
5937
  // src/charts/options/ValueOptions.tsx
4465
- import { Fragment as Fragment8, jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
5938
+ import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
4466
5939
  var ValueFormatters = [
4467
5940
  { label: "Number", value: "NumberFormatter" },
4468
5941
  { label: "Date", value: "DateFormatter" },
@@ -4491,7 +5964,7 @@ var CurrencySymbols = [
4491
5964
  var AddonLabel2 = ({
4492
5965
  className,
4493
5966
  children
4494
- }) => /* @__PURE__ */ jsx31(AddonLabel, { className: classNames9("px-3", className), children });
5967
+ }) => /* @__PURE__ */ jsx34(AddonLabel, { className: classNames10("px-3", className), children });
4495
5968
  var ValueOptions = ({
4496
5969
  config,
4497
5970
  onChange,
@@ -4558,9 +6031,9 @@ var ValueOptions = ({
4558
6031
  function numberAddons(style) {
4559
6032
  switch (style) {
4560
6033
  case "None":
4561
- return /* @__PURE__ */ jsxs21(Fragment8, { children: [
4562
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-l-0", children: "Fraction Digits" }),
4563
- /* @__PURE__ */ jsx31(
6034
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
6035
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-l-0", children: "Fraction Digits" }),
6036
+ /* @__PURE__ */ jsx34(
4564
6037
  "input",
4565
6038
  {
4566
6039
  disabled: true,
@@ -4571,9 +6044,9 @@ var ValueOptions = ({
4571
6044
  ] });
4572
6045
  case "Percent":
4573
6046
  case "Standard":
4574
- return /* @__PURE__ */ jsxs21(Fragment8, { children: [
4575
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-x-0", children: "Fraction Digits" }),
4576
- /* @__PURE__ */ jsx31(
6047
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
6048
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-x-0", children: "Fraction Digits" }),
6049
+ /* @__PURE__ */ jsx34(
4577
6050
  "input",
4578
6051
  {
4579
6052
  type: "number",
@@ -4587,9 +6060,9 @@ var ValueOptions = ({
4587
6060
  )
4588
6061
  ] });
4589
6062
  case "Currency":
4590
- return /* @__PURE__ */ jsxs21(Fragment8, { children: [
4591
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-r-0", children: "Symbol" }),
4592
- /* @__PURE__ */ jsx31("div", { className: "w-28 ", children: /* @__PURE__ */ jsx31(
6063
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
6064
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-r-0", children: "Symbol" }),
6065
+ /* @__PURE__ */ jsx34("div", { className: "w-28 ", children: /* @__PURE__ */ jsx34(
4593
6066
  ComboInput,
4594
6067
  {
4595
6068
  onChange: onChangeSymbol,
@@ -4602,8 +6075,8 @@ var ValueOptions = ({
4602
6075
  value: config?.currencySymbol
4603
6076
  }
4604
6077
  ) }),
4605
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border", children: "Precision" }),
4606
- /* @__PURE__ */ jsx31(
6078
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border", children: "Precision" }),
6079
+ /* @__PURE__ */ jsx34(
4607
6080
  "input",
4608
6081
  {
4609
6082
  type: "number",
@@ -4618,9 +6091,9 @@ var ValueOptions = ({
4618
6091
  )
4619
6092
  ] });
4620
6093
  default:
4621
- return /* @__PURE__ */ jsxs21(Fragment8, { children: [
4622
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-x-0", children: "Max significant digits" }),
4623
- /* @__PURE__ */ jsx31(
6094
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
6095
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-x-0", children: "Max significant digits" }),
6096
+ /* @__PURE__ */ jsx34(
4624
6097
  "input",
4625
6098
  {
4626
6099
  type: "number",
@@ -4635,62 +6108,62 @@ var ValueOptions = ({
4635
6108
  ] });
4636
6109
  }
4637
6110
  }
4638
- return /* @__PURE__ */ jsxs21(Fragment8, { children: [
4639
- /* @__PURE__ */ jsx31("div", { children: /* @__PURE__ */ jsxs21("div", { className: "flex", children: [
4640
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
4641
- /* @__PURE__ */ jsx31(
6111
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
6112
+ /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsxs24("div", { className: "flex", children: [
6113
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
6114
+ /* @__PURE__ */ jsx34(
4642
6115
  "select",
4643
6116
  {
4644
6117
  value: config.valueFormatter,
4645
- className: classNames9(
6118
+ className: classNames10(
4646
6119
  "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1.5 pl-4 pr-7 focus:ring-0",
4647
6120
  config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
4648
6121
  ),
4649
6122
  onChange: (e) => onChangeFormatter(e.target.value),
4650
6123
  children: formatters.map((d) => {
4651
- return /* @__PURE__ */ jsx31("option", { value: d.value, children: d.label }, d.value);
6124
+ return /* @__PURE__ */ jsx34("option", { value: d.value, children: d.label }, d.value);
4652
6125
  })
4653
6126
  }
4654
6127
  ),
4655
- config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ jsxs21(Fragment8, { children: [
4656
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-l-0 border-r-0", children: "Style" }),
4657
- /* @__PURE__ */ jsxs21(
6128
+ config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ jsxs24(Fragment9, { children: [
6129
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-l-0 border-r-0", children: "Style" }),
6130
+ /* @__PURE__ */ jsxs24(
4658
6131
  "select",
4659
6132
  {
4660
6133
  value: config.style,
4661
6134
  className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1 pl-4 pr-7 focus:ring-0",
4662
6135
  onChange: (e) => onStyleChange(e.target.value),
4663
6136
  children: [
4664
- /* @__PURE__ */ jsx31("option", { value: "None", children: "None" }),
4665
- /* @__PURE__ */ jsx31("option", { value: "Compact", children: "Compact" }),
4666
- /* @__PURE__ */ jsx31("option", { value: "Standard", children: "Standard" }),
4667
- /* @__PURE__ */ jsx31("option", { value: "Scientific", children: "Scientific" }),
4668
- /* @__PURE__ */ jsx31("option", { value: "Percent", children: "Percent" }),
4669
- /* @__PURE__ */ jsx31("option", { value: "Currency", children: "Currency" })
6137
+ /* @__PURE__ */ jsx34("option", { value: "None", children: "None" }),
6138
+ /* @__PURE__ */ jsx34("option", { value: "Compact", children: "Compact" }),
6139
+ /* @__PURE__ */ jsx34("option", { value: "Standard", children: "Standard" }),
6140
+ /* @__PURE__ */ jsx34("option", { value: "Scientific", children: "Scientific" }),
6141
+ /* @__PURE__ */ jsx34("option", { value: "Percent", children: "Percent" }),
6142
+ /* @__PURE__ */ jsx34("option", { value: "Currency", children: "Currency" })
4670
6143
  ]
4671
6144
  }
4672
6145
  ),
4673
6146
  config.style && numberAddons(config.style)
4674
6147
  ] }),
4675
- config.valueFormatter == "DateFormatter" && /* @__PURE__ */ jsxs21(Fragment8, { children: [
4676
- /* @__PURE__ */ jsx31(AddonLabel2, { className: "border border-l-0", children: "Date format" }),
4677
- /* @__PURE__ */ jsx31(
6148
+ config.valueFormatter == "DateFormatter" && /* @__PURE__ */ jsxs24(Fragment9, { children: [
6149
+ /* @__PURE__ */ jsx34(AddonLabel2, { className: "border border-l-0", children: "Date format" }),
6150
+ /* @__PURE__ */ jsx34(
4678
6151
  "select",
4679
6152
  {
4680
6153
  value: config.dateFormat,
4681
6154
  className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center rounded-r-md border border-l-0 py-1 pl-4 pr-7",
4682
6155
  onChange: (e) => onChangeDateFormat(e.target.value),
4683
6156
  children: dateFormats.map((d) => {
4684
- return /* @__PURE__ */ jsx31("option", { value: d.value, children: d.label }, d.value);
6157
+ return /* @__PURE__ */ jsx34("option", { value: d.value, children: d.label }, d.value);
4685
6158
  })
4686
6159
  }
4687
6160
  )
4688
6161
  ] })
4689
6162
  ] }) }),
4690
- (showPrefix || showSuffix) && /* @__PURE__ */ jsx31("div", { children: /* @__PURE__ */ jsxs21("div", { className: "mt-2 flex items-center gap-4", children: [
4691
- showPrefix && /* @__PURE__ */ jsxs21("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
4692
- /* @__PURE__ */ jsx31("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
4693
- /* @__PURE__ */ jsx31(
6163
+ (showPrefix || showSuffix) && /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsxs24("div", { className: "mt-2 flex items-center gap-4", children: [
6164
+ showPrefix && /* @__PURE__ */ jsxs24("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
6165
+ /* @__PURE__ */ jsx34("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
6166
+ /* @__PURE__ */ jsx34(
4694
6167
  "input",
4695
6168
  {
4696
6169
  type: "text",
@@ -4701,9 +6174,9 @@ var ValueOptions = ({
4701
6174
  }
4702
6175
  )
4703
6176
  ] }),
4704
- showSuffix && /* @__PURE__ */ jsxs21("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
4705
- /* @__PURE__ */ jsx31("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
4706
- /* @__PURE__ */ jsx31(
6177
+ showSuffix && /* @__PURE__ */ jsxs24("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
6178
+ /* @__PURE__ */ jsx34("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
6179
+ /* @__PURE__ */ jsx34(
4707
6180
  "input",
4708
6181
  {
4709
6182
  type: "text",
@@ -4715,7 +6188,7 @@ var ValueOptions = ({
4715
6188
  )
4716
6189
  ] })
4717
6190
  ] }) }),
4718
- config.valueFormatter == "StringFormatter" && /* @__PURE__ */ jsx31(
6191
+ config.valueFormatter == "StringFormatter" && /* @__PURE__ */ jsx34(
4719
6192
  ValueStringMapping,
4720
6193
  {
4721
6194
  rules: config.mappingRules || [],
@@ -4726,10 +6199,10 @@ var ValueOptions = ({
4726
6199
  };
4727
6200
 
4728
6201
  // src/charts/options/ValueControls.tsx
4729
- import { defaults as defaults3 } from "lodash";
4730
- import { Checkbox as Checkbox3, DisclosurePanel as DisclosurePanel5 } from "@sentio/ui-core";
6202
+ import { defaults as defaults5 } from "lodash";
6203
+ import { Checkbox as Checkbox4, DisclosurePanel as DisclosurePanel7 } from "@sentio/ui-core";
4731
6204
  import { produce as produce10 } from "immer";
4732
- import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
6205
+ import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
4733
6206
  var defaultConfig4 = {
4734
6207
  valueFormatter: "NumberFormatter",
4735
6208
  showValueLabel: false,
@@ -4747,7 +6220,7 @@ var ValueControls = ({
4747
6220
  showPrefix,
4748
6221
  showSuffix
4749
6222
  }) => {
4750
- config = defaults3(config || {}, defaultConfig4);
6223
+ config = defaults5(config || {}, defaultConfig4);
4751
6224
  function toggleShowValueLabel(checked) {
4752
6225
  config && onChange(
4753
6226
  produce10(config, (draft) => void (draft.showValueLabel = checked))
@@ -4756,14 +6229,14 @@ var ValueControls = ({
4756
6229
  function toggleTooltipTotal(checked) {
4757
6230
  config && onChange(produce10(config, (draft) => void (draft.tooltipTotal = checked)));
4758
6231
  }
4759
- return /* @__PURE__ */ jsxs22(
4760
- DisclosurePanel5,
6232
+ return /* @__PURE__ */ jsxs25(
6233
+ DisclosurePanel7,
4761
6234
  {
4762
6235
  title: "Value Options",
4763
6236
  defaultOpen,
4764
6237
  containerClassName: "w-full bg-default-bg",
4765
6238
  children: [
4766
- /* @__PURE__ */ jsx32(
6239
+ /* @__PURE__ */ jsx35(
4767
6240
  ValueOptions,
4768
6241
  {
4769
6242
  onChange,
@@ -4773,17 +6246,17 @@ var ValueControls = ({
4773
6246
  showSuffix
4774
6247
  }
4775
6248
  ),
4776
- /* @__PURE__ */ jsxs22("div", { className: "mt-2 flex items-center gap-2", children: [
4777
- /* @__PURE__ */ jsx32(
4778
- Checkbox3,
6249
+ /* @__PURE__ */ jsxs25("div", { className: "mt-2 flex items-center gap-2", children: [
6250
+ /* @__PURE__ */ jsx35(
6251
+ Checkbox4,
4779
6252
  {
4780
6253
  checked: config?.showValueLabel,
4781
6254
  onChange: toggleShowValueLabel,
4782
6255
  label: "Show value label"
4783
6256
  }
4784
6257
  ),
4785
- /* @__PURE__ */ jsx32(
4786
- Checkbox3,
6258
+ /* @__PURE__ */ jsx35(
6259
+ Checkbox4,
4787
6260
  {
4788
6261
  checked: config?.tooltipTotal,
4789
6262
  onChange: toggleTooltipTotal,
@@ -4796,290 +6269,11 @@ var ValueControls = ({
4796
6269
  );
4797
6270
  };
4798
6271
 
4799
- // src/charts/options/YaxisControls.tsx
4800
- import { defaults as defaults4 } from "lodash";
4801
- import { Button as Button2, Checkbox as Checkbox4, DisclosurePanel as DisclosurePanel6 } from "@sentio/ui-core";
4802
- import { Fragment as Fragment9, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
4803
- var initialConfig2 = {
4804
- yAxis: {
4805
- min: "",
4806
- max: "",
4807
- scale: true,
4808
- stack: ""
4809
- }
4810
- };
4811
- function YaxisControls({
4812
- yAxis,
4813
- setYAxis,
4814
- defaultOpen,
4815
- columnSelect,
4816
- supportSetName = true,
4817
- supportSetMinMax = true,
4818
- supportStackSeries = true,
4819
- supportAlwaysShowZero = true,
4820
- supportReset = true,
4821
- panelTitle = "Y-Axis Controls"
4822
- }) {
4823
- yAxis = defaults4(yAxis || {}, initialConfig2.yAxis);
4824
- const onChangeInput = (field) => (event) => {
4825
- const { value } = event.target;
4826
- setYAxis({
4827
- ...yAxis,
4828
- [field]: value || void 0,
4829
- scale: field == "min" && value > "0" ? true : yAxis?.scale
4830
- });
4831
- };
4832
- const onToggleZero = (checked) => {
4833
- setYAxis({ ...yAxis, scale: !checked, min: checked ? "" : yAxis?.min });
4834
- };
4835
- const onClickResetYAxis = () => {
4836
- setYAxis(initialConfig2.yAxis);
4837
- };
4838
- const onToggleStack = (checked) => {
4839
- setYAxis({ ...yAxis, stacked: checked ? "samesign" : "" });
4840
- };
4841
- const minMaxLabelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
4842
- const minMaxInputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
4843
- return /* @__PURE__ */ jsx33(
4844
- DisclosurePanel6,
4845
- {
4846
- title: panelTitle,
4847
- defaultOpen,
4848
- containerClassName: "w-full bg-default-bg",
4849
- children: /* @__PURE__ */ jsxs23("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
4850
- supportSetName && /* @__PURE__ */ jsxs23("label", { className: "inline-flex h-8", children: [
4851
- /* @__PURE__ */ jsx33(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
4852
- /* @__PURE__ */ jsx33(
4853
- "input",
4854
- {
4855
- type: "text",
4856
- className: "focus:border-primary-500 sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 w-40 rounded-r-md border",
4857
- value: yAxis?.name,
4858
- placeholder: "Axis Name",
4859
- onChange: onChangeInput("name")
4860
- }
4861
- )
4862
- ] }),
4863
- columnSelect && /* @__PURE__ */ jsxs23("span", { className: "inline-flex h-8", children: [
4864
- /* @__PURE__ */ jsx33(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
4865
- columnSelect
4866
- ] }),
4867
- supportSetMinMax && /* @__PURE__ */ jsxs23(Fragment9, { children: [
4868
- /* @__PURE__ */ jsxs23("label", { className: "inline-flex h-8", children: [
4869
- /* @__PURE__ */ jsx33("span", { className: minMaxLabelCls, children: "Min" }),
4870
- /* @__PURE__ */ jsx33(
4871
- "input",
4872
- {
4873
- type: "text",
4874
- className: minMaxInputCls,
4875
- style: { width: "10em" },
4876
- value: yAxis.min,
4877
- placeholder: "Auto",
4878
- onChange: onChangeInput("min")
4879
- }
4880
- )
4881
- ] }),
4882
- /* @__PURE__ */ jsxs23("label", { className: "inline-flex h-8", children: [
4883
- /* @__PURE__ */ jsx33("span", { className: minMaxLabelCls, children: "Max" }),
4884
- /* @__PURE__ */ jsx33(
4885
- "input",
4886
- {
4887
- type: "text",
4888
- className: minMaxInputCls,
4889
- style: { width: "10em" },
4890
- value: yAxis.max,
4891
- placeholder: "Auto",
4892
- onChange: onChangeInput("max")
4893
- }
4894
- )
4895
- ] })
4896
- ] }),
4897
- supportStackSeries && /* @__PURE__ */ jsx33(
4898
- Checkbox4,
4899
- {
4900
- checked: !!yAxis?.stacked,
4901
- onChange: onToggleStack,
4902
- label: "Stack series"
4903
- }
4904
- ),
4905
- supportAlwaysShowZero && /* @__PURE__ */ jsx33(
4906
- Checkbox4,
4907
- {
4908
- checked: !yAxis.scale,
4909
- onChange: onToggleZero,
4910
- label: "Always show zero"
4911
- }
4912
- ),
4913
- supportReset && /* @__PURE__ */ jsx33(Button2, { type: "button", role: "link", onClick: onClickResetYAxis, children: "Reset" })
4914
- ] })
4915
- }
4916
- );
4917
- }
4918
-
4919
- // src/charts/options/XaxisControls.tsx
4920
- import {
4921
- Button as Button3,
4922
- DisclosurePanel as DisclosurePanel7,
4923
- PopoverTooltip,
4924
- Select
4925
- } from "@sentio/ui-core";
4926
- import { LuInfo } from "react-icons/lu";
4927
- import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
4928
- var TypeSelect = Select;
4929
- var SortSelect = Select;
4930
- var OrderSelect = Select;
4931
- var sortByItems2 = [
4932
- { label: "Name", value: "ByName" },
4933
- { label: "Value", value: "ByValue" }
4934
- ];
4935
- var orderItems2 = [
4936
- { label: "Ascendant", value: false },
4937
- { label: "Descendant", value: true }
4938
- ];
4939
- var XAxisControls = ({
4940
- xAxis,
4941
- setXAxis,
4942
- defaultOpen,
4943
- columnSelect,
4944
- columnIsNonTime,
4945
- panelTitle = "X-Axis Controls",
4946
- supportName = true,
4947
- supportSort,
4948
- supportSetType
4949
- }) => {
4950
- const onChangeInput = (field) => (event) => {
4951
- const { value } = event.target;
4952
- setXAxis({ ...xAxis, [field]: value || void 0 });
4953
- };
4954
- const onClickResetXAxis = () => {
4955
- setXAxis(void 0);
4956
- };
4957
- const isXAixsNoneTime = xAxis && xAxis.column && columnIsNonTime;
4958
- return /* @__PURE__ */ jsx34(
4959
- DisclosurePanel7,
4960
- {
4961
- title: panelTitle,
4962
- defaultOpen,
4963
- containerClassName: "w-full bg-default-bg",
4964
- children: /* @__PURE__ */ jsxs24("div", { className: "text-icontent flex flex-wrap gap-[10px]", children: [
4965
- supportName && /* @__PURE__ */ jsxs24("label", { className: "inline-flex h-8", children: [
4966
- /* @__PURE__ */ jsx34(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Name" }),
4967
- /* @__PURE__ */ jsx34(
4968
- "input",
4969
- {
4970
- type: "text",
4971
- className: "sm:text-icontent border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 w-40 rounded-r-md",
4972
- value: xAxis?.name,
4973
- placeholder: "Axis Name",
4974
- onChange: onChangeInput("name")
4975
- }
4976
- )
4977
- ] }),
4978
- supportSetType && /* @__PURE__ */ jsxs24("span", { className: "inline-flex h-8", children: [
4979
- /* @__PURE__ */ jsxs24("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2", children: [
4980
- "X-Axis Type",
4981
- " ",
4982
- /* @__PURE__ */ jsx34(
4983
- PopoverTooltip,
4984
- {
4985
- strategy: "fixed",
4986
- hideArrow: true,
4987
- placementOption: "bottom",
4988
- text: /* @__PURE__ */ jsxs24("div", { className: "text-text-foreground max-w-[300px] p-2", children: [
4989
- /* @__PURE__ */ jsx34("span", { className: "font-medium", children: "Discrete axis" }),
4990
- " displays",
4991
- " ",
4992
- /* @__PURE__ */ jsx34("span", { className: "text-primary-600", children: "discrete values evenly" }),
4993
- ", while ",
4994
- /* @__PURE__ */ jsx34("span", { className: "font-medium", children: "Continuous axis" }),
4995
- " ",
4996
- "shows",
4997
- " ",
4998
- /* @__PURE__ */ jsx34("span", { className: "text-primary-600", children: "continuous time series" }),
4999
- " ",
5000
- "and",
5001
- " ",
5002
- /* @__PURE__ */ jsx34("span", { className: "text-primary-600", children: "auto-fills missing time points" })
5003
- ] }),
5004
- children: /* @__PURE__ */ jsx34(LuInfo, { className: "text-text-foreground-secondary h-4 w-4" })
5005
- }
5006
- )
5007
- ] }),
5008
- /* @__PURE__ */ jsx34(
5009
- TypeSelect,
5010
- {
5011
- className: "h-8 w-40",
5012
- buttonClassName: "h-full border-main rounded-l-none items-center inline-flex items-center",
5013
- value: xAxis?.type || "time",
5014
- onChange: (val) => {
5015
- setXAxis({ ...xAxis, type: val });
5016
- },
5017
- options: [
5018
- { label: "Continuous", value: "time" },
5019
- { label: "Discrete", value: "category" }
5020
- ]
5021
- }
5022
- )
5023
- ] }),
5024
- columnSelect && /* @__PURE__ */ jsxs24("span", { className: "inline-flex h-8", children: [
5025
- /* @__PURE__ */ jsx34(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Column" }),
5026
- columnSelect
5027
- ] }),
5028
- supportSort && isXAixsNoneTime && /* @__PURE__ */ jsxs24("span", { className: "inline-flex h-8", children: [
5029
- /* @__PURE__ */ jsx34(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Sort By" }),
5030
- /* @__PURE__ */ jsx34(
5031
- SortSelect,
5032
- {
5033
- className: "h-8 w-20 leading-8",
5034
- buttonClassName: "h-full border-main rounded-none inline-flex items-center",
5035
- options: sortByItems2,
5036
- value: xAxis?.sort?.sortBy,
5037
- onChange: (value) => {
5038
- setXAxis({
5039
- ...xAxis,
5040
- sort: { ...xAxis?.sort, sortBy: value }
5041
- });
5042
- },
5043
- placeholder: "Sort By"
5044
- }
5045
- ),
5046
- /* @__PURE__ */ jsx34(
5047
- OrderSelect,
5048
- {
5049
- className: "h-8 w-40 leading-8",
5050
- buttonClassName: "h-full border-l-0 border-main rounded-l-none inline-flex items-center",
5051
- options: orderItems2,
5052
- value: xAxis?.sort?.orderDesc,
5053
- onChange: (value) => {
5054
- setXAxis({
5055
- ...xAxis,
5056
- sort: { ...xAxis?.sort, orderDesc: value }
5057
- });
5058
- },
5059
- placeholder: "Sort Order"
5060
- }
5061
- )
5062
- ] }),
5063
- /* @__PURE__ */ jsx34(
5064
- Button3,
5065
- {
5066
- type: "button",
5067
- role: "link",
5068
- onClick: onClickResetXAxis,
5069
- className: "h-8",
5070
- children: "Reset"
5071
- }
5072
- )
5073
- ] })
5074
- }
5075
- );
5076
- };
5077
-
5078
6272
  // src/charts/options/MarkerControls.tsx
5079
6273
  import { produce as produce11 } from "immer";
5080
6274
  import { LuMinus, LuPlus as LuPlus2 } from "react-icons/lu";
5081
6275
  import { Button as Button4, DisclosurePanel as DisclosurePanel8 } from "@sentio/ui-core";
5082
- import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
6276
+ import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
5083
6277
  var labelCls = "inline-flex items-center border border-r-0 sm:text-icontent border-main bg-gray-50 px-2 rounded-l-md";
5084
6278
  var inputCls = "border focus:border-primary-500 rounded-r-md sm:text-icontent border-main w-28 hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30";
5085
6279
  function MarkerInput({
@@ -5096,25 +6290,25 @@ function MarkerInput({
5096
6290
  })
5097
6291
  );
5098
6292
  };
5099
- return /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-[10px]", children: [
5100
- /* @__PURE__ */ jsxs25("label", { className: "inline-flex h-8", children: [
5101
- /* @__PURE__ */ jsxs25("span", { className: labelCls, children: [
5102
- /* @__PURE__ */ jsx35("span", { className: "pr-2", children: label }),
5103
- /* @__PURE__ */ jsxs25(
6293
+ return /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-[10px]", children: [
6294
+ /* @__PURE__ */ jsxs26("label", { className: "inline-flex h-8", children: [
6295
+ /* @__PURE__ */ jsxs26("span", { className: labelCls, children: [
6296
+ /* @__PURE__ */ jsx36("span", { className: "pr-2", children: label }),
6297
+ /* @__PURE__ */ jsxs26(
5104
6298
  "select",
5105
6299
  {
5106
6300
  className: "sm:text-ilabel border-main text-text-foreground inline-flex h-full items-center border border-b-0 border-t-0 bg-gray-50 p-0 pl-4 pr-7 focus:border-transparent focus:ring-inset",
5107
6301
  value: marker.type,
5108
6302
  onChange: (e) => _onChange("type", e.target.value),
5109
6303
  children: [
5110
- /* @__PURE__ */ jsx35("option", { value: "LINE", children: "horizontal line" }),
5111
- /* @__PURE__ */ jsx35("option", { value: "LINEX", children: "vertical line" })
6304
+ /* @__PURE__ */ jsx36("option", { value: "LINE", children: "horizontal line" }),
6305
+ /* @__PURE__ */ jsx36("option", { value: "LINEX", children: "vertical line" })
5112
6306
  ]
5113
6307
  }
5114
6308
  ),
5115
- /* @__PURE__ */ jsx35("span", { className: "pl-2", children: "at" })
6309
+ /* @__PURE__ */ jsx36("span", { className: "pl-2", children: "at" })
5116
6310
  ] }),
5117
- marker.type === "LINEX" ? /* @__PURE__ */ jsx35(
6311
+ marker.type === "LINEX" ? /* @__PURE__ */ jsx36(
5118
6312
  "input",
5119
6313
  {
5120
6314
  className: inputCls,
@@ -5123,7 +6317,7 @@ function MarkerInput({
5123
6317
  placeholder: "YYYY-MM-DD",
5124
6318
  onChange: (e) => _onChange("valueX", e.target.value)
5125
6319
  }
5126
- ) : /* @__PURE__ */ jsx35(
6320
+ ) : /* @__PURE__ */ jsx36(
5127
6321
  "input",
5128
6322
  {
5129
6323
  className: inputCls,
@@ -5133,11 +6327,11 @@ function MarkerInput({
5133
6327
  }
5134
6328
  )
5135
6329
  ] }),
5136
- /* @__PURE__ */ jsxs25("label", { className: "inline-flex h-8", children: [
5137
- /* @__PURE__ */ jsx35("span", { className: labelCls, children: "Color" }),
5138
- /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
5139
- /* @__PURE__ */ jsx35("div", { className: "absolute inset-0 flex w-8 items-center justify-center", children: /* @__PURE__ */ jsx35("div", { className: "h-4 w-4", style: { background: marker.color } }) }),
5140
- /* @__PURE__ */ jsx35(
6330
+ /* @__PURE__ */ jsxs26("label", { className: "inline-flex h-8", children: [
6331
+ /* @__PURE__ */ jsx36("span", { className: labelCls, children: "Color" }),
6332
+ /* @__PURE__ */ jsxs26("div", { className: "relative", children: [
6333
+ /* @__PURE__ */ jsx36("div", { className: "absolute inset-0 flex w-8 items-center justify-center", children: /* @__PURE__ */ jsx36("div", { className: "h-4 w-4", style: { background: marker.color } }) }),
6334
+ /* @__PURE__ */ jsx36(
5141
6335
  "input",
5142
6336
  {
5143
6337
  className: inputCls + " pl-8",
@@ -5148,9 +6342,9 @@ function MarkerInput({
5148
6342
  )
5149
6343
  ] })
5150
6344
  ] }),
5151
- /* @__PURE__ */ jsxs25("label", { className: "inline-flex h-8", children: [
5152
- /* @__PURE__ */ jsx35("span", { className: labelCls, children: "Label" }),
5153
- /* @__PURE__ */ jsx35(
6345
+ /* @__PURE__ */ jsxs26("label", { className: "inline-flex h-8", children: [
6346
+ /* @__PURE__ */ jsx36("span", { className: labelCls, children: "Label" }),
6347
+ /* @__PURE__ */ jsx36(
5154
6348
  "input",
5155
6349
  {
5156
6350
  className: inputCls,
@@ -5160,14 +6354,14 @@ function MarkerInput({
5160
6354
  }
5161
6355
  )
5162
6356
  ] }),
5163
- /* @__PURE__ */ jsx35(
6357
+ /* @__PURE__ */ jsx36(
5164
6358
  "button",
5165
6359
  {
5166
6360
  type: "button",
5167
6361
  className: "ml-2 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full bg-gray-800 hover:bg-red-600",
5168
6362
  "aria-label": "Remove marker",
5169
6363
  onClick: onRemove,
5170
- children: /* @__PURE__ */ jsx35(
6364
+ children: /* @__PURE__ */ jsx36(
5171
6365
  LuMinus,
5172
6366
  {
5173
6367
  className: "dark:text-default-bg h-3 w-3 text-white",
@@ -5202,14 +6396,14 @@ function MarkerControls({ markers, onChange }) {
5202
6396
  })
5203
6397
  );
5204
6398
  };
5205
- return /* @__PURE__ */ jsx35(
6399
+ return /* @__PURE__ */ jsx36(
5206
6400
  DisclosurePanel8,
5207
6401
  {
5208
6402
  title: "Markers",
5209
6403
  containerClassName: "w-full bg-default-bg",
5210
6404
  defaultOpen: true,
5211
- children: /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
5212
- _markers.map((marker, index) => /* @__PURE__ */ jsx35(
6405
+ children: /* @__PURE__ */ jsxs26("div", { className: "space-y-2", children: [
6406
+ _markers.map((marker, index) => /* @__PURE__ */ jsx36(
5213
6407
  MarkerInput,
5214
6408
  {
5215
6409
  marker,
@@ -5219,8 +6413,8 @@ function MarkerControls({ markers, onChange }) {
5219
6413
  },
5220
6414
  index
5221
6415
  )),
5222
- /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsxs25(Button4, { type: "button", onClick: onAdd, children: [
5223
- /* @__PURE__ */ jsx35(LuPlus2, { className: "h-4 w-4", "aria-hidden": "true" }),
6416
+ /* @__PURE__ */ jsx36("div", { children: /* @__PURE__ */ jsxs26(Button4, { type: "button", onClick: onAdd, children: [
6417
+ /* @__PURE__ */ jsx36(LuPlus2, { className: "h-4 w-4", "aria-hidden": "true" }),
5224
6418
  "Add Marker"
5225
6419
  ] }) })
5226
6420
  ] })
@@ -5230,9 +6424,9 @@ function MarkerControls({ markers, onChange }) {
5230
6424
 
5231
6425
  // src/charts/options/DataControls.tsx
5232
6426
  import { produce as produce12 } from "immer";
5233
- import { defaults as defaults5 } from "lodash";
6427
+ import { defaults as defaults6 } from "lodash";
5234
6428
  import { DisclosurePanel as DisclosurePanel9 } from "@sentio/ui-core";
5235
- import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
6429
+ import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
5236
6430
  var defaultConfig5 = {
5237
6431
  seriesLimit: void 0
5238
6432
  };
@@ -5242,7 +6436,7 @@ function DataControls({
5242
6436
  chartConfig,
5243
6437
  defaultSeriesLimit = 20
5244
6438
  }) {
5245
- const config = defaults5(chartConfig?.dataConfig, defaultConfig5);
6439
+ const config = defaults6(chartConfig?.dataConfig, defaultConfig5);
5246
6440
  const currentSeriesLimit = config?.seriesLimit || chartConfig?.tableConfig?.rowLimit;
5247
6441
  function onSeriesLimitChange(e) {
5248
6442
  const value = parseInt(e.target.value);
@@ -5260,15 +6454,15 @@ function DataControls({
5260
6454
  e.preventDefault();
5261
6455
  }
5262
6456
  }
5263
- return /* @__PURE__ */ jsx36(
6457
+ return /* @__PURE__ */ jsx37(
5264
6458
  DisclosurePanel9,
5265
6459
  {
5266
6460
  title: "Data Options",
5267
6461
  defaultOpen,
5268
6462
  containerClassName: "w-full bg-default-bg",
5269
- children: /* @__PURE__ */ jsxs26("div", { className: "flex h-8", children: [
5270
- /* @__PURE__ */ jsx36(AddonLabel, { className: "rounded-l-md border border-r-0 px-3", children: "Max Series Limit" }),
5271
- /* @__PURE__ */ jsx36(
6463
+ children: /* @__PURE__ */ jsxs27("div", { className: "flex h-8", children: [
6464
+ /* @__PURE__ */ jsx37(AddonLabel, { className: "rounded-l-md border border-r-0 px-3", children: "Max Series Limit" }),
6465
+ /* @__PURE__ */ jsx37(
5272
6466
  "input",
5273
6467
  {
5274
6468
  type: "number",
@@ -5287,10 +6481,10 @@ function DataControls({
5287
6481
 
5288
6482
  // src/charts/options/ScatterControls.tsx
5289
6483
  import { produce as produce13 } from "immer";
5290
- import { defaults as defaults6 } from "lodash";
5291
- import { useCallback as useCallback4 } from "react";
6484
+ import { defaults as defaults7 } from "lodash";
6485
+ import { useCallback as useCallback5 } from "react";
5292
6486
  import { DisclosurePanel as DisclosurePanel10 } from "@sentio/ui-core";
5293
- import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
6487
+ import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
5294
6488
  var defaultConfig6 = {
5295
6489
  minSize: 5,
5296
6490
  maxSize: 30
@@ -5302,57 +6496,57 @@ function ScatterControls({
5302
6496
  columnSelect,
5303
6497
  colorPicker
5304
6498
  }) {
5305
- config = defaults6(config, defaultConfig6);
5306
- const onSymbolSizeColumnChange = useCallback4(
6499
+ config = defaults7(config, defaultConfig6);
6500
+ const onSymbolSizeColumnChange = useCallback5(
5307
6501
  (column) => {
5308
6502
  config && onChange(produce13(config, (draft) => void (draft.symbolSize = column)));
5309
6503
  },
5310
6504
  [config, onChange]
5311
6505
  );
5312
- const onSymbolColorChange = useCallback4(
6506
+ const onSymbolColorChange = useCallback5(
5313
6507
  (color) => {
5314
6508
  config && onChange(produce13(config, (draft) => void (draft.color = color)));
5315
6509
  },
5316
6510
  [config, onChange]
5317
6511
  );
5318
- const onMinSizeChange = useCallback4(
6512
+ const onMinSizeChange = useCallback5(
5319
6513
  (event) => {
5320
6514
  const value = parseInt(event.target.value) || 5;
5321
6515
  config && onChange(produce13(config, (draft) => void (draft.minSize = value)));
5322
6516
  },
5323
6517
  [config, onChange]
5324
6518
  );
5325
- const onMaxSizeChange = useCallback4(
6519
+ const onMaxSizeChange = useCallback5(
5326
6520
  (event) => {
5327
6521
  const value = parseInt(event.target.value) || 50;
5328
6522
  config && onChange(produce13(config, (draft) => void (draft.maxSize = value)));
5329
6523
  },
5330
6524
  [config, onChange]
5331
6525
  );
5332
- return /* @__PURE__ */ jsx37(
6526
+ return /* @__PURE__ */ jsx38(
5333
6527
  DisclosurePanel10,
5334
6528
  {
5335
6529
  title: "Scatter Chart Options",
5336
6530
  defaultOpen,
5337
6531
  containerClassName: "w-full bg-default-bg",
5338
- children: /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-4", children: [
5339
- columnSelect && /* @__PURE__ */ jsxs27("div", { className: "inline-flex h-8", children: [
5340
- /* @__PURE__ */ jsx37(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size By Column" }),
6532
+ children: /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-4", children: [
6533
+ columnSelect && /* @__PURE__ */ jsxs28("div", { className: "inline-flex h-8", children: [
6534
+ /* @__PURE__ */ jsx38(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size By Column" }),
5341
6535
  columnSelect({
5342
6536
  value: config.symbolSize,
5343
6537
  onChange: onSymbolSizeColumnChange
5344
6538
  })
5345
6539
  ] }),
5346
- colorPicker && /* @__PURE__ */ jsxs27("div", { className: "inline-flex h-8", children: [
5347
- /* @__PURE__ */ jsx37(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size Color Mapping" }),
6540
+ colorPicker && /* @__PURE__ */ jsxs28("div", { className: "inline-flex h-8", children: [
6541
+ /* @__PURE__ */ jsx38(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Size Color Mapping" }),
5348
6542
  colorPicker({
5349
6543
  value: config.color,
5350
6544
  onChange: onSymbolColorChange
5351
6545
  })
5352
6546
  ] }),
5353
- /* @__PURE__ */ jsxs27("div", { className: "inline-flex h-8", children: [
5354
- /* @__PURE__ */ jsx37(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Min Size" }),
5355
- /* @__PURE__ */ jsx37(
6547
+ /* @__PURE__ */ jsxs28("div", { className: "inline-flex h-8", children: [
6548
+ /* @__PURE__ */ jsx38(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Min Size" }),
6549
+ /* @__PURE__ */ jsx38(
5356
6550
  "input",
5357
6551
  {
5358
6552
  name: "minSize",
@@ -5365,9 +6559,9 @@ function ScatterControls({
5365
6559
  }
5366
6560
  )
5367
6561
  ] }),
5368
- /* @__PURE__ */ jsxs27("div", { className: "inline-flex h-8", children: [
5369
- /* @__PURE__ */ jsx37(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Max Size" }),
5370
- /* @__PURE__ */ jsx37(
6562
+ /* @__PURE__ */ jsxs28("div", { className: "inline-flex h-8", children: [
6563
+ /* @__PURE__ */ jsx38(AddonLabel, { className: "rounded-l-md border border-r-0 px-2", children: "Max Size" }),
6564
+ /* @__PURE__ */ jsx38(
5371
6565
  "input",
5372
6566
  {
5373
6567
  name: "maxSize",
@@ -5422,6 +6616,7 @@ export {
5422
6616
  ScatterIcon_default as ScatterIcon,
5423
6617
  SystemLabels,
5424
6618
  TableIcon_default as TableIcon,
6619
+ TimeSeriesChart,
5425
6620
  ValueControls,
5426
6621
  ValueFormatters,
5427
6622
  ValueOptions,