@databrainhq/plugin 0.7.19 → 0.7.20

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.es.js CHANGED
@@ -82409,6 +82409,17 @@ const Header = ({
82409
82409
  const {
82410
82410
  globalTheme
82411
82411
  } = useGlobalTheme();
82412
+ const saveDashboardStyle = useMemo(() => {
82413
+ var _a2, _b2;
82414
+ if (!globalTheme)
82415
+ return void 0;
82416
+ const style2 = {};
82417
+ if ((_a2 = globalTheme.dashboard.ctaColor) == null ? void 0 : _a2.trim())
82418
+ style2.backgroundColor = globalTheme.dashboard.ctaColor.trim() || void 0;
82419
+ if ((_b2 = globalTheme.dashboard.ctaTextColor) == null ? void 0 : _b2.trim())
82420
+ style2.color = globalTheme.dashboard.ctaTextColor.trim() || void 0;
82421
+ return style2;
82422
+ }, [globalTheme]);
82412
82423
  return /* @__PURE__ */ jsxs("div", {
82413
82424
  className: styles$h["header-container"],
82414
82425
  children: [/* @__PURE__ */ jsxs("div", {
@@ -82444,10 +82455,7 @@ const Header = ({
82444
82455
  className: styles$h["save-btn"],
82445
82456
  isDisabled: isDisableSaveBtn,
82446
82457
  onClick: () => setShowSaveMetricModal(true),
82447
- style: globalTheme ? {
82448
- backgroundColor: `${globalTheme.dashboard.ctaColor} !important`,
82449
- color: `${globalTheme.dashboard.ctaTextColor} !important`
82450
- } : void 0,
82458
+ style: saveDashboardStyle,
82451
82459
  children: [/* @__PURE__ */ jsx(Icons, {
82452
82460
  name: "save-icon",
82453
82461
  className: styles$h["save-btn-icon"]
@@ -84978,6 +84986,17 @@ const MetricForm = ({
84978
84986
  if (isEnableGroupBy)
84979
84987
  setSelectedGroupBy(selectedDimensions);
84980
84988
  }, [selectedDimensions, isEnableGroupBy]);
84989
+ const primaryButtonStyle = useMemo(() => {
84990
+ var _a2, _b2;
84991
+ if (!globalTheme)
84992
+ return void 0;
84993
+ const style2 = {};
84994
+ if ((_a2 = globalTheme.dashboard.ctaColor) == null ? void 0 : _a2.trim())
84995
+ style2.backgroundColor = globalTheme.dashboard.ctaColor.trim() || void 0;
84996
+ if ((_b2 = globalTheme.dashboard.ctaTextColor) == null ? void 0 : _b2.trim())
84997
+ style2.color = globalTheme.dashboard.ctaTextColor.trim() || void 0;
84998
+ return style2;
84999
+ }, [globalTheme]);
84981
85000
  return /* @__PURE__ */ jsxs("div", {
84982
85001
  className: styles$5["form-container"],
84983
85002
  children: [!isDisableTimeColumn && /* @__PURE__ */ jsxs("div", {
@@ -85093,6 +85112,7 @@ const MetricForm = ({
85093
85112
  type: "button",
85094
85113
  variant: "primary",
85095
85114
  size: "small",
85115
+ style: primaryButtonStyle,
85096
85116
  className: styles$5.disabled,
85097
85117
  isDisabled: !metricAggregate.value || !metricColumn.value,
85098
85118
  onClick: () => {
@@ -85184,6 +85204,7 @@ const MetricForm = ({
85184
85204
  type: "button",
85185
85205
  variant: "primary",
85186
85206
  size: "small",
85207
+ style: primaryButtonStyle,
85187
85208
  className: styles$5.disabled,
85188
85209
  isDisabled: !column2.value,
85189
85210
  onClick: () => {
@@ -85281,6 +85302,7 @@ const MetricForm = ({
85281
85302
  variant: "primary",
85282
85303
  size: "small",
85283
85304
  isDisabled: !filterColumn.value || !operator.value || !isFilterValue,
85305
+ style: primaryButtonStyle,
85284
85306
  className: styles$5.disabled,
85285
85307
  onClick: () => {
85286
85308
  setFilters((prev) => [...prev, `${isBigQuery || isMySql ? `${filterColumn.value}` : isMongoDb ? `\`${filterColumn.value}\`` : `"${filterColumn.value}"`} ${operator.value} ${isInFilter ? `(${selectedFilterValues.map((f2) => `'${f2}'`).join(", ")})` : `${filterValue.value ? `'${filterValue.value}'` : ""}`}`]);
@@ -85337,6 +85359,7 @@ const MetricForm = ({
85337
85359
  size: "small",
85338
85360
  isDisabled: !sortColumn.value || isDisableSorting,
85339
85361
  className: styles$5.disabled,
85362
+ style: primaryButtonStyle,
85340
85363
  onClick: () => {
85341
85364
  if (!columns.length) {
85342
85365
  setSort(`${sortAggregate.value}(${isBigQuery || isMySql ? `${sortColumn.value}` : isMongoDb ? `\`${sortColumn.value}\`` : `"${sortColumn.value}"`})`);
@@ -85387,10 +85410,7 @@ const MetricForm = ({
85387
85410
  variant: "primary",
85388
85411
  className: styles$5.generateButton,
85389
85412
  isDisabled: isGeneratingDataset || isDisableGenerate,
85390
- style: globalTheme ? {
85391
- backgroundColor: `${globalTheme.dashboard.ctaColor} !important`,
85392
- color: `${globalTheme.dashboard.ctaTextColor} !important`
85393
- } : void 0,
85413
+ style: primaryButtonStyle,
85394
85414
  onClick: () => {
85395
85415
  var _a2, _b2, _c2;
85396
85416
  setError("");
@@ -85803,6 +85823,17 @@ const EmbeddedMetricCreation = ({
85803
85823
  updateGroupData(data2, [selectedGroupBy[0]], selectedGroupBy, setGroupedData);
85804
85824
  }
85805
85825
  }, [groupedData, isEnableGroupBy, selectedGroupBy]);
85826
+ const createMetricStyle = useMemo(() => {
85827
+ var _a3, _b2;
85828
+ if (!globalTheme)
85829
+ return void 0;
85830
+ const style2 = {};
85831
+ if ((_a3 = globalTheme.dashboard.ctaColor) == null ? void 0 : _a3.trim())
85832
+ style2.backgroundColor = globalTheme.dashboard.ctaColor.trim() || void 0;
85833
+ if ((_b2 = globalTheme.dashboard.ctaTextColor) == null ? void 0 : _b2.trim())
85834
+ style2.color = globalTheme.dashboard.ctaTextColor.trim() || void 0;
85835
+ return style2;
85836
+ }, [globalTheme]);
85806
85837
  return /* @__PURE__ */ jsxs(Fragment, {
85807
85838
  children: [/* @__PURE__ */ jsx(Button, {
85808
85839
  type: "button",
@@ -85810,10 +85841,7 @@ const EmbeddedMetricCreation = ({
85810
85841
  size: "large",
85811
85842
  className: variant === "floating" ? styles$g.floatingCreateButton : "",
85812
85843
  onClick: () => setShowMetricCreateModal(true),
85813
- style: globalTheme ? {
85814
- backgroundColor: `${globalTheme.dashboard.ctaColor} !important`,
85815
- color: `${globalTheme.dashboard.ctaTextColor} !important`
85816
- } : void 0,
85844
+ style: createMetricStyle,
85817
85845
  children: variant === "floating" ? /* @__PURE__ */ jsx(mdiPlus, {
85818
85846
  className: styles$g.floatingCreateButtonIcon
85819
85847
  }) : "Create Metric"
@@ -91480,6 +91508,32 @@ const MetricCard = ({
91480
91508
  } : rls));
91481
91509
  }
91482
91510
  };
91511
+ const titleStyle = useMemo(() => {
91512
+ var _a3, _b3, _c3;
91513
+ if (!globalTheme)
91514
+ return void 0;
91515
+ const style2 = {};
91516
+ if ((_a3 = globalTheme.cardTitle.fontWeight) == null ? void 0 : _a3.trim())
91517
+ style2.fontWeight = globalTheme.cardTitle.fontWeight.trim() || void 0;
91518
+ if ((_b3 = globalTheme.cardTitle.color) == null ? void 0 : _b3.trim())
91519
+ style2.color = globalTheme.cardTitle.color.trim() || void 0;
91520
+ if ((_c3 = globalTheme.cardTitle.fontSize) == null ? void 0 : _c3.trim())
91521
+ style2.color = globalTheme.cardTitle.fontSize.trim() || void 0;
91522
+ return style2;
91523
+ }, [globalTheme]);
91524
+ const descriptionStyle = useMemo(() => {
91525
+ var _a3, _b3, _c3;
91526
+ if (!globalTheme)
91527
+ return void 0;
91528
+ const style2 = {};
91529
+ if ((_a3 = globalTheme.cardDescription.fontWeight) == null ? void 0 : _a3.trim())
91530
+ style2.fontWeight = globalTheme.cardDescription.fontWeight.trim() || void 0;
91531
+ if ((_b3 = globalTheme.cardDescription.color) == null ? void 0 : _b3.trim())
91532
+ style2.color = globalTheme.cardDescription.color.trim() || void 0;
91533
+ if ((_c3 = globalTheme.cardDescription.fontSize) == null ? void 0 : _c3.trim())
91534
+ style2.color = globalTheme.cardDescription.fontSize.trim() || void 0;
91535
+ return style2;
91536
+ }, [globalTheme]);
91483
91537
  return /* @__PURE__ */ jsx(Fragment, {
91484
91538
  children: /* @__PURE__ */ jsxs("div", {
91485
91539
  className: styles.cardContainer,
@@ -91489,30 +91543,18 @@ const MetricCard = ({
91489
91543
  variant: "h3",
91490
91544
  styleClass: "primary",
91491
91545
  className: styles.metricName,
91492
- style: globalTheme ? {
91493
- color: globalTheme.cardTitle.color,
91494
- fontWeight: globalTheme.cardTitle.fontWeight,
91495
- fontSize: globalTheme.cardTitle.fontSize
91496
- } : void 0,
91546
+ style: titleStyle,
91497
91547
  children: [renderHeaderName ? renderHeaderName(metricItem.name) : /* @__PURE__ */ jsx(Button, {
91498
91548
  type: "button",
91499
91549
  variant: "custom",
91500
91550
  isDisabled: !clickBehaviourConfigs.card.isEnable,
91501
91551
  className: "disabled:cursor-text",
91502
91552
  onClick: () => handleCardClick(clickBehaviourConfigs, metricItem.metricId, metricItem.id),
91503
- style: globalTheme ? {
91504
- color: globalTheme.cardTitle.color,
91505
- fontWeight: globalTheme.cardTitle.fontWeight,
91506
- fontSize: globalTheme.cardTitle.fontSize
91507
- } : void 0,
91553
+ style: titleStyle,
91508
91554
  children: metricItem.name
91509
91555
  }), metricItem.description && /* @__PURE__ */ jsx("span", {
91510
91556
  className: styles.metricDescription,
91511
- style: globalTheme ? {
91512
- color: globalTheme.cardDescription.color,
91513
- fontWeight: globalTheme.cardDescription.fontWeight,
91514
- fontSize: globalTheme.cardDescription.fontSize
91515
- } : void 0,
91557
+ style: descriptionStyle,
91516
91558
  children: metricItem.description
91517
91559
  })]
91518
91560
  }), /* @__PURE__ */ jsxs("div", {
@@ -91804,6 +91846,32 @@ const SingleValueCard = ({
91804
91846
  } : rls));
91805
91847
  }
91806
91848
  };
91849
+ const titleStyle = useMemo(() => {
91850
+ var _a3, _b2, _c2;
91851
+ if (!globalTheme)
91852
+ return void 0;
91853
+ const style2 = {};
91854
+ if ((_a3 = globalTheme.cardTitle.fontWeight) == null ? void 0 : _a3.trim())
91855
+ style2.fontWeight = globalTheme.cardTitle.fontWeight.trim() || void 0;
91856
+ if ((_b2 = globalTheme.cardTitle.color) == null ? void 0 : _b2.trim())
91857
+ style2.color = globalTheme.cardTitle.color.trim() || void 0;
91858
+ if ((_c2 = globalTheme.cardTitle.fontSize) == null ? void 0 : _c2.trim())
91859
+ style2.color = globalTheme.cardTitle.fontSize.trim() || void 0;
91860
+ return style2;
91861
+ }, [globalTheme]);
91862
+ const descriptionStyle = useMemo(() => {
91863
+ var _a3, _b2, _c2;
91864
+ if (!globalTheme)
91865
+ return void 0;
91866
+ const style2 = {};
91867
+ if ((_a3 = globalTheme.cardDescription.fontWeight) == null ? void 0 : _a3.trim())
91868
+ style2.fontWeight = globalTheme.cardDescription.fontWeight.trim() || void 0;
91869
+ if ((_b2 = globalTheme.cardDescription.color) == null ? void 0 : _b2.trim())
91870
+ style2.color = globalTheme.cardDescription.color.trim() || void 0;
91871
+ if ((_c2 = globalTheme.cardDescription.fontSize) == null ? void 0 : _c2.trim())
91872
+ style2.color = globalTheme.cardDescription.fontSize.trim() || void 0;
91873
+ return style2;
91874
+ }, [globalTheme]);
91807
91875
  return /* @__PURE__ */ jsx(Fragment, {
91808
91876
  children: /* @__PURE__ */ jsxs("div", {
91809
91877
  className: styles.cardContainer,
@@ -91813,30 +91881,18 @@ const SingleValueCard = ({
91813
91881
  variant: "h3",
91814
91882
  styleClass: "primary",
91815
91883
  className: styles.metricName,
91816
- style: globalTheme ? {
91817
- color: globalTheme.cardTitle.color,
91818
- fontWeight: globalTheme.cardTitle.fontWeight,
91819
- fontSize: globalTheme.cardTitle.fontSize
91820
- } : void 0,
91884
+ style: titleStyle,
91821
91885
  children: [renderHeaderName ? renderHeaderName(metricItem.name) : /* @__PURE__ */ jsx(Button, {
91822
91886
  type: "button",
91823
91887
  variant: "custom",
91824
91888
  isDisabled: !clickBehaviourConfigs.card.isEnable,
91825
91889
  className: "disabled:cursor-text",
91826
91890
  onClick: () => handleCardClick(clickBehaviourConfigs, metricItem.metricId, metricItem.id),
91827
- style: globalTheme ? {
91828
- color: globalTheme.cardTitle.color,
91829
- fontWeight: globalTheme.cardTitle.fontWeight,
91830
- fontSize: globalTheme.cardTitle.fontSize
91831
- } : void 0,
91891
+ style: titleStyle,
91832
91892
  children: metricItem.name
91833
91893
  }), metricItem.description && /* @__PURE__ */ jsx("span", {
91834
91894
  className: styles.metricDescription,
91835
- style: globalTheme ? {
91836
- color: globalTheme.cardDescription.color,
91837
- fontWeight: globalTheme.cardDescription.fontWeight,
91838
- fontSize: globalTheme.cardDescription.fontSize
91839
- } : void 0,
91895
+ style: descriptionStyle,
91840
91896
  children: metricItem.description
91841
91897
  })]
91842
91898
  }), /* @__PURE__ */ jsx("div", {
@@ -92137,13 +92193,21 @@ const EmbeddedDashboard = React__default.memo(({
92137
92193
  setGlobalTheme(res.themes[0]);
92138
92194
  }
92139
92195
  });
92196
+ const embedDashboardStyle = useMemo(() => {
92197
+ var _a3, _b3;
92198
+ if (!globalTheme)
92199
+ return void 0;
92200
+ const style2 = {};
92201
+ if ((_a3 = globalTheme.dashboard.backgroundColor) == null ? void 0 : _a3.trim())
92202
+ style2.backgroundColor = globalTheme.dashboard.backgroundColor.trim() || void 0;
92203
+ if ((_b3 = globalTheme.general.fontFamily) == null ? void 0 : _b3.trim())
92204
+ style2.fontFamily = globalTheme.general.fontFamily.trim() || void 0;
92205
+ return style2;
92206
+ }, [globalTheme]);
92140
92207
  return /* @__PURE__ */ jsx(Fragment, {
92141
92208
  children: /* @__PURE__ */ jsxs("div", {
92142
92209
  className: styles$C["embedDashboard-container"],
92143
- style: globalTheme ? {
92144
- backgroundColor: `${globalTheme.dashboard.backgroundColor} !important`,
92145
- fontFamily: `${globalTheme.general.fontFamily} !important`
92146
- } : void 0,
92210
+ style: embedDashboardStyle,
92147
92211
  children: [((_a2 = data2.externalDashboard) == null ? void 0 : _a2.id) && !isLoading && /* @__PURE__ */ jsxs(Fragment, {
92148
92212
  children: [!(options2 == null ? void 0 : options2.disableMetricCreation) && !data2.externalDashboard.filters.length && !data2.isAllowedToCreateMetrics ? null : /* @__PURE__ */ jsxs("div", {
92149
92213
  className: (options2 == null ? void 0 : options2.headerVariant) === "floating" ? styles$C["embedDashboard-header-floating"] : styles$C["embedDashboard-header-static"],