@embeddable.com/remarkable-pro 0.0.3 → 0.0.5

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.
Files changed (116) hide show
  1. package/README.md +68 -17
  2. package/dist/BarChartDefaultHorizontalPro.js +25 -85
  3. package/dist/BarChartDefaultHorizontalPro.js.map +1 -1
  4. package/dist/BarChartDefaultPro.js +25 -84
  5. package/dist/BarChartDefaultPro.js.map +1 -1
  6. package/dist/BarChartGroupedHorizontalPro.js +33 -102
  7. package/dist/BarChartGroupedHorizontalPro.js.map +1 -1
  8. package/dist/BarChartGroupedPro.js +27 -95
  9. package/dist/BarChartGroupedPro.js.map +1 -1
  10. package/dist/BarChartStackedHorizontalPro.js +28 -98
  11. package/dist/BarChartStackedHorizontalPro.js.map +1 -1
  12. package/dist/BarChartStackedPro.js +28 -97
  13. package/dist/BarChartStackedPro.js.map +1 -1
  14. package/dist/{ChartCard-CsKQOusx.js → ChartCard-DPqhmLst.js} +19 -19
  15. package/dist/{ChartCard-CsKQOusx.js.map → ChartCard-DPqhmLst.js.map} +1 -1
  16. package/dist/{Color.type.emb-9H0O-uuD.js → Color.type.emb-WlORCMYm.js} +2 -2
  17. package/dist/{Color.type.emb-9H0O-uuD.js.map → Color.type.emb-WlORCMYm.js.map} +1 -1
  18. package/dist/ColorEditor.js +2 -2
  19. package/dist/{ComparisonPeriod.type.emb-C3XjaFoD.js → ComparisonPeriod.type.emb-2GetmOu1.js} +2 -2
  20. package/dist/{ComparisonPeriod.type.emb-C3XjaFoD.js.map → ComparisonPeriod.type.emb-2GetmOu1.js.map} +1 -1
  21. package/dist/ComparisonPeriodSelectFieldPro.js +17 -58
  22. package/dist/ComparisonPeriodSelectFieldPro.js.map +1 -1
  23. package/dist/DateRangeSelectFieldPro.js +3 -3
  24. package/dist/DonutChartPro.js +3 -3
  25. package/dist/DonutLabelChartPro.js +3 -3
  26. package/dist/EditorCard-BaL9GbQ9.js +32 -0
  27. package/dist/{EditorCard-BMEwnQuU.js.map → EditorCard-BaL9GbQ9.js.map} +1 -1
  28. package/dist/HeatMapPro.js +26 -93
  29. package/dist/HeatMapPro.js.map +1 -1
  30. package/dist/KpiChartNumberComparisonPro.js +25 -94
  31. package/dist/KpiChartNumberComparisonPro.js.map +1 -1
  32. package/dist/KpiChartNumberPro.js +14 -31
  33. package/dist/KpiChartNumberPro.js.map +1 -1
  34. package/dist/LineChartComparisonDefaultPro.js +59 -370
  35. package/dist/LineChartComparisonDefaultPro.js.map +1 -1
  36. package/dist/LineChartDefaultPro.js +31 -179
  37. package/dist/LineChartDefaultPro.js.map +1 -1
  38. package/dist/LineChartGroupedPro.js +30 -174
  39. package/dist/LineChartGroupedPro.js.map +1 -1
  40. package/dist/MultiSelectFieldPro.js +3 -3
  41. package/dist/PieChartPro.js +3 -3
  42. package/dist/PivotTablePro.js +23 -86
  43. package/dist/PivotTablePro.js.map +1 -1
  44. package/dist/SingleSelectFieldPro.js +3 -3
  45. package/dist/TableChartPaginated.js +37 -172
  46. package/dist/TableChartPaginated.js.map +1 -1
  47. package/dist/{bars.utils-BU_k5fia.js → bars.utils-aO0eZx5e.js} +7 -7
  48. package/dist/{bars.utils-BU_k5fia.js.map → bars.utils-aO0eZx5e.js.map} +1 -1
  49. package/dist/{charts.utils-rO92wRxO.js → charts.utils-CZnXoUqF.js} +4 -4
  50. package/dist/{charts.utils-rO92wRxO.js.map → charts.utils-CZnXoUqF.js.map} +1 -1
  51. package/dist/{component.constants-uP1WYyUb.js → component.constants-C7cqSNbp.js} +2 -2
  52. package/dist/{component.constants-uP1WYyUb.js.map → component.constants-C7cqSNbp.js.map} +1 -1
  53. package/dist/components/charts/tables/HeatMapPro/index.d.ts.map +1 -1
  54. package/dist/components/charts/tables/PivotTablePro/index.d.ts.map +1 -1
  55. package/dist/components/charts/tables/tables.hooks.d.ts +17 -0
  56. package/dist/components/charts/tables/tables.hooks.d.ts.map +1 -0
  57. package/dist/embeddable-components.json +13 -13
  58. package/dist/{formatter.utils-CeEdL8uQ.js → formatter.utils-CfrcSyDX.js} +2 -2
  59. package/dist/{formatter.utils-CeEdL8uQ.js.map → formatter.utils-CfrcSyDX.js.map} +1 -1
  60. package/dist/{index-Dwl9clc9.js → index-2EH0Voxh.js} +5 -5
  61. package/dist/{index-Dwl9clc9.js.map → index-2EH0Voxh.js.map} +1 -1
  62. package/dist/index-85Nzu6wl.js +95 -0
  63. package/dist/index-85Nzu6wl.js.map +1 -0
  64. package/dist/index-9GEogpMN.js +82 -0
  65. package/dist/index-9GEogpMN.js.map +1 -0
  66. package/dist/{index-BWpUwKTH.js → index-BAomPP89.js} +5 -5
  67. package/dist/{index-BWpUwKTH.js.map → index-BAomPP89.js.map} +1 -1
  68. package/dist/{index-DLFOG9Ar.js → index-BQf2W8Zn.js} +6 -6
  69. package/dist/{index-DLFOG9Ar.js.map → index-BQf2W8Zn.js.map} +1 -1
  70. package/dist/index-BSc_Axva.js +326 -0
  71. package/dist/index-BSc_Axva.js.map +1 -0
  72. package/dist/index-BjdJeBiT.js +73 -0
  73. package/dist/index-BjdJeBiT.js.map +1 -0
  74. package/dist/index-C1EIos9z.js +159 -0
  75. package/dist/index-C1EIos9z.js.map +1 -0
  76. package/dist/index-C_F-ZHJz.js +163 -0
  77. package/dist/index-C_F-ZHJz.js.map +1 -0
  78. package/dist/index-Cc-mtCkt.js +83 -0
  79. package/dist/index-Cc-mtCkt.js.map +1 -0
  80. package/dist/index-CvmifdRS.js +72 -0
  81. package/dist/index-CvmifdRS.js.map +1 -0
  82. package/dist/index-D1L8EF47.js +82 -0
  83. package/dist/index-D1L8EF47.js.map +1 -0
  84. package/dist/{index-DedIqjbn.js → index-D8D1R5YG.js} +17 -18
  85. package/dist/{index-DedIqjbn.js.map → index-D8D1R5YG.js.map} +1 -1
  86. package/dist/index-DGz1wzRd.js +81 -0
  87. package/dist/index-DGz1wzRd.js.map +1 -0
  88. package/dist/index-DORMEL0e.js +82 -0
  89. package/dist/index-DORMEL0e.js.map +1 -0
  90. package/dist/index-DTuHmdil.js +89 -0
  91. package/dist/index-DTuHmdil.js.map +1 -0
  92. package/dist/index-DZU1PTjb.js +148 -0
  93. package/dist/index-DZU1PTjb.js.map +1 -0
  94. package/dist/index-DaeSYZkv.js +30 -0
  95. package/dist/index-DaeSYZkv.js.map +1 -0
  96. package/dist/{index-Brb617sy.js → index-Dhwlo6sD.js} +5 -5
  97. package/dist/{index-Brb617sy.js.map → index-Dhwlo6sD.js.map} +1 -1
  98. package/dist/{index-B8bT85NR.js → index-L9ViZuWi.js} +5 -5
  99. package/dist/{index-B8bT85NR.js.map → index-L9ViZuWi.js.map} +1 -1
  100. package/dist/{index-DrosyYQD.js → index-WCMGd0_l.js} +15 -14
  101. package/dist/{index-DrosyYQD.js.map → index-WCMGd0_l.js.map} +1 -1
  102. package/dist/index-wy7P41uG.js +56 -0
  103. package/dist/index-wy7P41uG.js.map +1 -0
  104. package/dist/index.d.ts +27 -6
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +117 -74
  107. package/dist/index.js.map +1 -1
  108. package/dist/{pies.utils-Dap7Duqb.js → pies.utils-DlK4ABKU.js} +5 -5
  109. package/dist/{pies.utils-Dap7Duqb.js.map → pies.utils-DlK4ABKU.js.map} +1 -1
  110. package/dist/remarkable-pro.css +1 -1
  111. package/dist/tables.hooks-BQdyUxau.js +45 -0
  112. package/dist/tables.hooks-BQdyUxau.js.map +1 -0
  113. package/dist/{timeRange.utils-J3a4XL64.js → timeRange.utils-CWl9EGOR.js} +2 -2
  114. package/dist/{timeRange.utils-J3a4XL64.js.map → timeRange.utils-CWl9EGOR.js.map} +1 -1
  115. package/package.json +2 -2
  116. package/dist/EditorCard-BMEwnQuU.js +0 -32
@@ -1,8 +1,8 @@
1
- import { s as R, j as d, S as b } from "./index-DedIqjbn.js";
1
+ import { s as R, j as d, S as b } from "./index-D8D1R5YG.js";
2
2
  import { useTheme as O } from "@embeddable.com/react";
3
3
  import { g as j, u as y } from "./editors.timeRange.utils-DTtRGaCo.js";
4
- import { $ as C, r as x, i as F } from "./component.constants-uP1WYyUb.js";
5
- import { E as T } from "./EditorCard-BMEwnQuU.js";
4
+ import { $ as C, r as x, i as F } from "./component.constants-C7cqSNbp.js";
5
+ import { E as T } from "./EditorCard-BaL9GbQ9.js";
6
6
  import { useState as _, useEffect as c } from "react";
7
7
  /**
8
8
  * @license @tabler/icons-react v3.35.0 - MIT
@@ -10,23 +10,23 @@ import { useState as _, useEffect as c } from "react";
10
10
  * This source code is licensed under the MIT license.
11
11
  * See the LICENSE file in the root directory of this source tree.
12
12
  */
13
- const I = [["path", { d: "M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 1.993 -.117l.007 .117v1h6v-1a1 1 0 0 1 1 -1zm3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16v-9.625z", key: "svg-0" }], ["path", { d: "M12 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-2a1 1 0 0 1 -.117 -1.993l.117 -.007h1z", key: "svg-1" }]], L = R("filled", "calendar-filled", "CalendarFilled", I), z = (l) => l.map((a) => ({
14
- rightLabel: j(a.getRange(), a.dateFormat),
15
- value: a.value,
16
- label: C(a.label)
13
+ const I = [["path", { d: "M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 1.993 -.117l.007 .117v1h6v-1a1 1 0 0 1 1 -1zm3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16v-9.625z", key: "svg-0" }], ["path", { d: "M12 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-2a1 1 0 0 1 -.117 -1.993l.117 -.007h1z", key: "svg-1" }]], L = R("filled", "calendar-filled", "CalendarFilled", I), z = (l) => l.map((t) => ({
14
+ rightLabel: j(t.getRange(), t.dateFormat),
15
+ value: t.value,
16
+ label: C(t.label)
17
17
  })), D = (l) => {
18
- const a = O(), { dayjsLocaleReady: v } = y(), { selectedValue: e, clearable: m, onChange: g } = l, [o, i] = _(
18
+ const t = O(), { dayjsLocaleReady: v } = y(), { selectedValue: e, clearable: m, onChange: g } = l, [o, i] = _(
19
19
  e == null ? void 0 : e.relativeTimeString
20
- ), n = a.defaults.dateRangesOptions, r = e == null ? void 0 : e.relativeTimeString;
20
+ ), n = t.defaults.dateRangesOptions, r = e == null ? void 0 : e.relativeTimeString;
21
21
  if (c(() => {
22
22
  if (!r) return;
23
- const t = n.find(
23
+ const a = n.find(
24
24
  (s) => s.value === r
25
25
  );
26
- i(t ? t.value : void 0);
26
+ i(a ? a.value : void 0);
27
27
  }, [r, n]), c(() => {
28
28
  if (!e && !o) return;
29
- const t = n.find((S) => S.value === o), s = t ? t.getRange() : void 0;
29
+ const a = n.find((S) => S.value === o), s = a ? a.getRange() : void 0;
30
30
  g(s);
31
31
  }, [o, n]), c(() => {
32
32
  e || i(void 0);
@@ -40,7 +40,7 @@ const I = [["path", { d: "M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.99
40
40
  clearable: m,
41
41
  placeholder: f,
42
42
  value: o,
43
- onChange: (t) => i(t || void 0),
43
+ onChange: (a) => i(a || void 0),
44
44
  options: h,
45
45
  noOptionsMessage: F.t("common.noOptionsAvailable")
46
46
  }
@@ -51,6 +51,7 @@ const I = [["path", { d: "M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.99
51
51
  }, Symbol.toStringTag, { value: "Module" }));
52
52
  export {
53
53
  D,
54
+ z as g,
54
55
  N as i
55
56
  };
56
- //# sourceMappingURL=index-DrosyYQD.js.map
57
+ //# sourceMappingURL=index-WCMGd0_l.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DrosyYQD.js","sources":["../node_modules/@tabler/icons-react/dist/esm/icons/IconCalendarFilled.mjs","../src/components/editors/DateRangeSelectFieldPro/DateRangeSelectFieldPro.utils.ts","../src/components/editors/DateRangeSelectFieldPro/index.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.35.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 1.993 -.117l.007 .117v1h6v-1a1 1 0 0 1 1 -1zm3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16v-9.625z\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M12 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-2a1 1 0 0 1 -.117 -1.993l.117 -.007h1z\", \"key\": \"svg-1\" }]];\nconst IconCalendarFilled = createReactComponent(\"filled\", \"calendar-filled\", \"CalendarFilled\", __iconNode);\n\nexport { __iconNode, IconCalendarFilled as default };\n//# sourceMappingURL=IconCalendarFilled.mjs.map\n","import { DateRangeSelectFieldProOption } from './DateRangeSelectFieldPro.types';\nimport { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\nimport { getTimeRangeLabel } from '../editors.timeRange.utils';\nimport { resolveI18nString } from '../../component.utils';\n\nexport const getDateRangeSelectFieldProOptions = (\n dateRangeSelectFieldProOptions: DateRangeSelectFieldProOption[],\n): SelectListOptionProps[] => {\n return dateRangeSelectFieldProOptions.map((option) => {\n return {\n rightLabel: getTimeRangeLabel(option.getRange(), option.dateFormat),\n value: option.value,\n label: resolveI18nString(option.label),\n };\n });\n};\n","import { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '@embeddable.com/remarkable-ui';\nimport { Theme } from '../../../theme/theme.types';\nimport { useLoadDayjsLocale } from '../../../utils.ts/date.utils';\nimport { getDateRangeSelectFieldProOptions } from './DateRangeSelectFieldPro.utils';\nimport { TimeRange } from '@embeddable.com/core';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport { IconCalendarFilled } from '@tabler/icons-react';\nimport { i18n } from '../../../theme/i18n/i18n';\nimport { useEffect, useState } from 'react';\n\ntype DateRangeSelectFieldProProps = {\n description?: string;\n onChange: (newDateRange: TimeRange) => void;\n placeholder?: string;\n selectedValue: TimeRange;\n title?: string;\n clearable?: boolean;\n};\n\nconst DateRangeSelectFieldPro = (props: DateRangeSelectFieldProProps) => {\n const theme: Theme = useTheme() as Theme;\n const { dayjsLocaleReady } = useLoadDayjsLocale();\n\n const { selectedValue, clearable, onChange } = props;\n const [internalValue, setInternalValue] = useState<string | undefined>(\n selectedValue?.relativeTimeString,\n );\n\n // When updation the selectedValue in the builder, the defined value value can:\n // 1. exist in the options: relativeTimeString converted into TimeRange and onChange is called with the TimeRange\n // 2. not exist in the options: onChange is called with undefined (resets)\n\n const dateRangeOptions = theme.defaults.dateRangesOptions;\n\n const selectedValueRelativeTimeString = selectedValue?.relativeTimeString;\n\n useEffect(() => {\n if (!selectedValueRelativeTimeString) return;\n\n const matchedOption = dateRangeOptions.find(\n (option) => option.value === selectedValueRelativeTimeString,\n );\n\n setInternalValue(matchedOption ? matchedOption.value : undefined);\n }, [selectedValueRelativeTimeString, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue && !internalValue) return;\n\n const matchedOption = dateRangeOptions.find((option) => option.value === internalValue);\n\n const newChangeValue = matchedOption ? matchedOption.getRange() : undefined;\n\n onChange(newChangeValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [internalValue, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue) {\n setInternalValue(undefined);\n }\n }, [selectedValue]);\n\n if (!dayjsLocaleReady) {\n return null;\n }\n\n const { description, placeholder, title } = resolveI18nProps(props);\n\n const options = getDateRangeSelectFieldProOptions(dateRangeOptions);\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n startIcon={IconCalendarFilled}\n clearable={clearable}\n placeholder={placeholder}\n value={internalValue}\n onChange={(value) => setInternalValue(value || undefined)}\n options={options}\n noOptionsMessage={i18n.t('common.noOptionsAvailable')}\n />\n </EditorCard>\n );\n};\n\nexport default DateRangeSelectFieldPro;\n"],"names":["__iconNode","IconCalendarFilled","createReactComponent","getDateRangeSelectFieldProOptions","dateRangeSelectFieldProOptions","option","getTimeRangeLabel","resolveI18nString","DateRangeSelectFieldPro","props","theme","useTheme","dayjsLocaleReady","useLoadDayjsLocale","selectedValue","clearable","onChange","internalValue","setInternalValue","useState","dateRangeOptions","selectedValueRelativeTimeString","useEffect","matchedOption","newChangeValue","description","placeholder","title","resolveI18nProps","options","jsx","EditorCard","SingleSelectField","value","i18n"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa,CAAC,CAAC,QAAQ,EAAE,GAAK,iWAAiW,KAAO,QAAO,CAAE,GAAG,CAAC,QAAQ,EAAE,GAAK,oHAAoH,KAAO,QAAO,CAAE,CAAC,GACviBC,IAAqBC,EAAqB,UAAU,mBAAmB,kBAAkBF,CAAU,GCL5FG,IAAoC,CAC/CC,MAEOA,EAA+B,IAAI,CAACC,OAClC;AAAA,EACL,YAAYC,EAAkBD,EAAO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C,WAAW/B;AAAA,MACX,WAAAc;AAAA,MACA,aAAAW;AAAA,MACA,OAAOT;AAAA,MACP,UAAU,CAACgB,MAAUf,EAAiBe,KAAS,MAAS;AAAA,MACxD,SAAAJ;AAAA,MACA,kBAAkBK,EAAK,EAAE,2BAA2B;AAAA,IAAA;AAAA,EAAA,GAExD;AAEJ;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index-WCMGd0_l.js","sources":["../node_modules/@tabler/icons-react/dist/esm/icons/IconCalendarFilled.mjs","../src/components/editors/DateRangeSelectFieldPro/DateRangeSelectFieldPro.utils.ts","../src/components/editors/DateRangeSelectFieldPro/index.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.35.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M16 2a1 1 0 0 1 .993 .883l.007 .117v1h1a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h1v-1a1 1 0 0 1 1.993 -.117l.007 .117v1h6v-1a1 1 0 0 1 1 -1zm3 7h-14v9.625c0 .705 .386 1.286 .883 1.366l.117 .009h12c.513 0 .936 -.53 .993 -1.215l.007 -.16v-9.625z\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M12 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-2a1 1 0 0 1 -.117 -1.993l.117 -.007h1z\", \"key\": \"svg-1\" }]];\nconst IconCalendarFilled = createReactComponent(\"filled\", \"calendar-filled\", \"CalendarFilled\", __iconNode);\n\nexport { __iconNode, IconCalendarFilled as default };\n//# sourceMappingURL=IconCalendarFilled.mjs.map\n","import { DateRangeSelectFieldProOption } from './DateRangeSelectFieldPro.types';\nimport { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\nimport { getTimeRangeLabel } from '../editors.timeRange.utils';\nimport { resolveI18nString } from '../../component.utils';\n\nexport const getDateRangeSelectFieldProOptions = (\n dateRangeSelectFieldProOptions: DateRangeSelectFieldProOption[],\n): SelectListOptionProps[] => {\n return dateRangeSelectFieldProOptions.map((option) => {\n return {\n rightLabel: getTimeRangeLabel(option.getRange(), option.dateFormat),\n value: option.value,\n label: resolveI18nString(option.label),\n };\n });\n};\n","import { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '@embeddable.com/remarkable-ui';\nimport { Theme } from '../../../theme/theme.types';\nimport { useLoadDayjsLocale } from '../../../utils.ts/date.utils';\nimport { getDateRangeSelectFieldProOptions } from './DateRangeSelectFieldPro.utils';\nimport { TimeRange } from '@embeddable.com/core';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport { IconCalendarFilled } from '@tabler/icons-react';\nimport { i18n } from '../../../theme/i18n/i18n';\nimport { useEffect, useState } from 'react';\n\ntype DateRangeSelectFieldProProps = {\n description?: string;\n onChange: (newDateRange: TimeRange) => void;\n placeholder?: string;\n selectedValue: TimeRange;\n title?: string;\n clearable?: boolean;\n};\n\nconst DateRangeSelectFieldPro = (props: DateRangeSelectFieldProProps) => {\n const theme: Theme = useTheme() as Theme;\n const { dayjsLocaleReady } = useLoadDayjsLocale();\n\n const { selectedValue, clearable, onChange } = props;\n const [internalValue, setInternalValue] = useState<string | undefined>(\n selectedValue?.relativeTimeString,\n );\n\n // When updation the selectedValue in the builder, the defined value value can:\n // 1. exist in the options: relativeTimeString converted into TimeRange and onChange is called with the TimeRange\n // 2. not exist in the options: onChange is called with undefined (resets)\n\n const dateRangeOptions = theme.defaults.dateRangesOptions;\n\n const selectedValueRelativeTimeString = selectedValue?.relativeTimeString;\n\n useEffect(() => {\n if (!selectedValueRelativeTimeString) return;\n\n const matchedOption = dateRangeOptions.find(\n (option) => option.value === selectedValueRelativeTimeString,\n );\n\n setInternalValue(matchedOption ? matchedOption.value : undefined);\n }, [selectedValueRelativeTimeString, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue && !internalValue) return;\n\n const matchedOption = dateRangeOptions.find((option) => option.value === internalValue);\n\n const newChangeValue = matchedOption ? matchedOption.getRange() : undefined;\n\n onChange(newChangeValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [internalValue, dateRangeOptions]);\n\n useEffect(() => {\n if (!selectedValue) {\n setInternalValue(undefined);\n }\n }, [selectedValue]);\n\n if (!dayjsLocaleReady) {\n return null;\n }\n\n const { description, placeholder, title } = resolveI18nProps(props);\n\n const options = getDateRangeSelectFieldProOptions(dateRangeOptions);\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n startIcon={IconCalendarFilled}\n clearable={clearable}\n placeholder={placeholder}\n value={internalValue}\n onChange={(value) => setInternalValue(value || undefined)}\n options={options}\n noOptionsMessage={i18n.t('common.noOptionsAvailable')}\n />\n </EditorCard>\n );\n};\n\nexport default DateRangeSelectFieldPro;\n"],"names":["__iconNode","IconCalendarFilled","createReactComponent","getDateRangeSelectFieldProOptions","dateRangeSelectFieldProOptions","option","getTimeRangeLabel","resolveI18nString","DateRangeSelectFieldPro","props","theme","useTheme","dayjsLocaleReady","useLoadDayjsLocale","selectedValue","clearable","onChange","internalValue","setInternalValue","useState","dateRangeOptions","selectedValueRelativeTimeString","useEffect","matchedOption","newChangeValue","description","placeholder","title","resolveI18nProps","options","jsx","EditorCard","SingleSelectField","value","i18n"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa,CAAC,CAAC,QAAQ,EAAE,GAAK,iWAAiW,KAAO,QAAO,CAAE,GAAG,CAAC,QAAQ,EAAE,GAAK,oHAAoH,KAAO,QAAO,CAAE,CAAC,GACviBC,IAAqBC,EAAqB,UAAU,mBAAmB,kBAAkBF,CAAU,GCL5FG,IAAoC,CAC/CC,MA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AClC,UAAAK,gBAAAA,EAAAA;AAAAA,IAACE;AAAA,IAAA;AAAA,MACC,WAAW/B;AAAA,MACX,WAAAc;AAAA,MACA,aAAAW;AAAA,MACA,OAAOT;AAAA,MACP,UAAU,CAACgB,MAAUf,EAAiBe,KAAS,MAAS;AAAA,MACxD,SAAAJ;AAAA,MACA,kBAAkBK,EAAK,EAAE,2BAA2B;AAAA,IAAA;AAAA,EAAA,GAExD;AAEJ;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,56 @@
1
+ import { s as u, j as i, S as g } from "./index-D8D1R5YG.js";
2
+ import { useTheme as v } from "@embeddable.com/react";
3
+ import { g as h, u as f, a as y } from "./editors.timeRange.utils-DTtRGaCo.js";
4
+ import { $ as b, a as P, r as M, i as S } from "./component.constants-C7cqSNbp.js";
5
+ import { E as j } from "./EditorCard-BaL9GbQ9.js";
6
+ import { useMemo as C, useEffect as O } from "react";
7
+ /**
8
+ * @license @tabler/icons-react v3.35.0 - MIT
9
+ *
10
+ * This source code is licensed under the MIT license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+ const R = [["path", { d: "M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4", key: "svg-0" }], ["path", { d: "M18 18m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0", key: "svg-1" }], ["path", { d: "M15 3v4", key: "svg-2" }], ["path", { d: "M7 3v4", key: "svg-3" }], ["path", { d: "M3 11h16", key: "svg-4" }], ["path", { d: "M18 16.496v1.504l1 1", key: "svg-5" }]], k = u("outline", "calendar-time", "CalendarTime", R), x = (o, e) => !o || e.some((a) => a.value === o), T = (o, e) => o.map((a) => ({
14
+ rightLabel: e ? h(a.getRange(e), a.dateFormat) : "",
15
+ value: a.value,
16
+ label: b(a.label)
17
+ })), _ = (o) => {
18
+ const e = v();
19
+ P(e);
20
+ const { description: a, placeholder: l, title: c, comparisonPeriod: t, onChange: s } = M(o), r = e.defaults.comparisonPeriodsOptions, n = C(
21
+ () => x(t, r),
22
+ [t, r]
23
+ );
24
+ O(() => {
25
+ n || s(void 0);
26
+ }, [n, s]);
27
+ const { dayjsLocaleReady: m } = f(), d = y(o.primaryDateRange, e);
28
+ if (!m)
29
+ return null;
30
+ const p = T(
31
+ r,
32
+ d
33
+ );
34
+ return /* @__PURE__ */ i.jsx(j, { title: c, subtitle: a, children: /* @__PURE__ */ i.jsx(
35
+ g,
36
+ {
37
+ startIcon: k,
38
+ clearable: !0,
39
+ placeholder: l,
40
+ value: n ? t : void 0,
41
+ onChange: s,
42
+ options: p,
43
+ noOptionsMessage: S.t("common.noOptionsAvailable")
44
+ }
45
+ ) });
46
+ }, z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47
+ __proto__: null,
48
+ default: _
49
+ }, Symbol.toStringTag, { value: "Module" }));
50
+ export {
51
+ _ as D,
52
+ x as a,
53
+ T as g,
54
+ z as i
55
+ };
56
+ //# sourceMappingURL=index-wy7P41uG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-wy7P41uG.js","sources":["../node_modules/@tabler/icons-react/dist/esm/icons/IconCalendarTime.mjs","../src/components/editors/ComparisonPeriodSelectFieldPro/ComparisonPeriodSelectFieldPro.utils.ts","../src/components/editors/ComparisonPeriodSelectFieldPro/index.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.35.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M18 18m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M15 3v4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M7 3v4\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M3 11h16\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M18 16.496v1.504l1 1\", \"key\": \"svg-5\" }]];\nconst IconCalendarTime = createReactComponent(\"outline\", \"calendar-time\", \"CalendarTime\", __iconNode);\n\nexport { __iconNode, IconCalendarTime as default };\n//# sourceMappingURL=IconCalendarTime.mjs.map\n","import { SelectListOptionProps } from '@embeddable.com/remarkable-ui';\nimport { TimeRange } from '@embeddable.com/core';\nimport { ComparisonPeriodSelectFieldProOption } from './ComparisonPeriodSelectFieldPro.types';\nimport { getTimeRangeLabel } from '../editors.timeRange.utils';\nimport { resolveI18nString } from '../../component.utils';\n\n// Checks if the comparison period type is available in the embeddable types\nexport const isComparisonPeriodAvailable = (\n option: string | undefined,\n comparisonPeriodSelectFieldProOptions: ComparisonPeriodSelectFieldProOption[],\n): boolean => {\n return !option || comparisonPeriodSelectFieldProOptions.some((opt) => opt.value === option);\n};\n\nexport const getComparisonPeriodSelectFieldProOptions = (\n comparisonPeriodSelectFieldProOptions: ComparisonPeriodSelectFieldProOption[],\n toCompareTimeRange: TimeRange,\n): SelectListOptionProps[] => {\n return comparisonPeriodSelectFieldProOptions.map((option) => {\n return {\n rightLabel: toCompareTimeRange\n ? getTimeRangeLabel(option.getRange(toCompareTimeRange), option.dateFormat)\n : '',\n value: option.value,\n label: resolveI18nString(option.label),\n };\n });\n};\n","import { useTheme } from '@embeddable.com/react';\nimport { SingleSelectField } from '@embeddable.com/remarkable-ui';\nimport { Theme } from '../../../theme/theme.types';\nimport { useLoadDayjsLocale } from '../../../utils.ts/date.utils';\nimport { TimeRange } from '@embeddable.com/core';\nimport { resolveI18nProps } from '../../component.utils';\nimport { EditorCard } from '../shared/EditorCard/EditorCard';\nimport { IconCalendarTime } from '@tabler/icons-react';\nimport { i18n, i18nSetup } from '../../../theme/i18n/i18n';\nimport {\n getComparisonPeriodSelectFieldProOptions,\n isComparisonPeriodAvailable,\n} from './ComparisonPeriodSelectFieldPro.utils';\nimport { getTimeRangeFromTo } from '../editors.timeRange.utils';\nimport { useEffect, useMemo } from 'react';\n\ntype DateComparisonSelectFieldPro = {\n title?: string;\n description?: string;\n placeholder?: string;\n primaryDateRange?: TimeRange;\n comparisonPeriod?: string;\n onChange: (newComparisonPeriod?: string) => void;\n};\n\nconst DateComparisonSelectFieldPro = (props: DateComparisonSelectFieldPro) => {\n const theme: Theme = useTheme() as Theme;\n i18nSetup(theme);\n\n const { description, placeholder, title, comparisonPeriod, onChange } = resolveI18nProps(props);\n\n const comparisonPeriodOptions = theme.defaults.comparisonPeriodsOptions;\n\n const comparisonPeriodAvailable = useMemo(\n () => isComparisonPeriodAvailable(comparisonPeriod, comparisonPeriodOptions),\n [comparisonPeriod, comparisonPeriodOptions],\n );\n\n // If the current comparison period is not available, reset the field\n useEffect(() => {\n if (!comparisonPeriodAvailable) {\n onChange(undefined);\n }\n }, [comparisonPeriodAvailable, onChange]);\n\n const { dayjsLocaleReady } = useLoadDayjsLocale();\n\n // Obtain the actual range for the selected primaryDateRange\n const primaryDateRange = getTimeRangeFromTo(props.primaryDateRange, theme);\n\n if (!dayjsLocaleReady) {\n return null;\n }\n\n const options = getComparisonPeriodSelectFieldProOptions(\n comparisonPeriodOptions,\n primaryDateRange,\n );\n\n return (\n <EditorCard title={title} subtitle={description}>\n <SingleSelectField\n startIcon={IconCalendarTime}\n clearable\n placeholder={placeholder}\n value={comparisonPeriodAvailable ? comparisonPeriod : undefined}\n onChange={onChange}\n options={options}\n noOptionsMessage={i18n.t('common.noOptionsAvailable')}\n />\n </EditorCard>\n );\n};\n\nexport default DateComparisonSelectFieldPro;\n"],"names":["__iconNode","IconCalendarTime","createReactComponent","isComparisonPeriodAvailable","option","comparisonPeriodSelectFieldProOptions","opt","getComparisonPeriodSelectFieldProOptions","toCompareTimeRange","getTimeRangeLabel","resolveI18nString","DateComparisonSelectFieldPro","props","theme","useTheme","i18nSetup","description","placeholder","title","comparisonPeriod","onChange","resolveI18nProps","comparisonPeriodOptions","comparisonPeriodAvailable","useMemo","useEffect","dayjsLocaleReady","useLoadDayjsLocale","primaryDateRange","getTimeRangeFromTo","options","jsx","EditorCard","SingleSelectField","i18n"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa,CAAC,CAAC,QAAQ,EAAE,GAAK,2EAA2E,KAAO,SAAS,GAAG,CAAC,QAAQ,EAAE,GAAK,4CAA4C,KAAO,SAAS,GAAG,CAAC,QAAQ,EAAE,GAAK,WAAW,KAAO,QAAO,CAAE,GAAG,CAAC,QAAQ,EAAE,GAAK,UAAU,KAAO,SAAS,GAAG,CAAC,QAAQ,EAAE,GAAK,YAAY,KAAO,SAAS,GAAG,CAAC,QAAQ,EAAE,GAAK,wBAAwB,KAAO,QAAO,CAAE,CAAC,GAC9YC,IAAmBC,EAAqB,WAAW,iBAAiB,gBAAgBF,CAAU,GCHvFG,IAA8B,CACzCC,GACAC,MAEO,CAACD,KAAUC,EAAsC,KAAK,CAACC,MAAQA,EAAI,UAAUF,CAAM,GAG/EG,IAA2C,CACtDF,GACAG,MAEOH,EAAsC,IAAI,CAACD,OACzC;AAAA,EACL,YAAYI,IACRC,EAAkBL,EAAO,SAASI,CAAkB,GAAGJ,EAAO,UAAU,IACxE;AAAA,EACJ,OAAOA,EAAO;AAAA,EACd,OAAOM,EAAkBN,EAAO,KAAK;AAAA,EAExC,GCDGO,IAA+B,CAACC,MAAwC;AAC5E,QAAMC,IAAeC,EAAA;AACrB,EAAAC,EAAUF,CAAK;AAEf,QAAM,EAAE,aAAAG,GAAa,aAAAC,GAAa,OAAAC,GAAO,kBAAAC,GAAkB,UAAAC,EAAA,IAAaC,EAAiBT,CAAK,GAExFU,IAA0BT,EAAM,SAAS,0BAEzCU,IAA4BC;AAAA,IAChC,MAAMrB,EAA4BgB,GAAkBG,CAAuB;AAAA,IAC3E,CAACH,GAAkBG,CAAuB;AAAA,EAAA;AAI5C,EAAAG,EAAU,MAAM;AACd,IAAKF,KACHH,EAAS,MAAS;AAAA,EAEtB,GAAG,CAACG,GAA2BH,CAAQ,CAAC;AAExC,QAAM,EAAE,kBAAAM,EAAA,IAAqBC,EAAA,GAGvBC,IAAmBC,EAAmBjB,EAAM,kBAAkBC,CAAK;AAEzE,MAAI,CAACa;AACH,WAAO;AAGT,QAAMI,IAAUvB;AAAA,IACde;AAAA,IACAM;AAAA,EAAA;AAGF,SACEG,gBAAAA,EAAAA,IAACC,GAAA,EAAW,OAAAd,GAAc,UAAUF,GAClC,UAAAe,gBAAAA,EAAAA;AAAAA,IAACE;AAAA,IAAA;AAAA,MACC,WAAWhC;AAAA,MACX,WAAS;AAAA,MACT,aAAAgB;AAAA,MACA,OAAOM,IAA4BJ,IAAmB;AAAA,MACtD,UAAAC;AAAA,MACA,SAAAU;AAAA,MACA,kBAAkBI,EAAK,EAAE,2BAA2B;AAAA,IAAA;AAAA,EAAA,GAExD;AAEJ;;;;","x_google_ignoreList":[0]}
package/dist/index.d.ts CHANGED
@@ -6,17 +6,38 @@ export * from './theme/theme.constants';
6
6
  export type { NumberFormatter, DateTimeFormatter, StringFormatter, ThemeFormatter, } from './theme/formatter/formatter.types';
7
7
  export { getThemeFormatter } from './theme/formatter/formatter.utils';
8
8
  export { resolveI18nProps } from './components/component.utils';
9
- export { ChartCard } from './components/charts/shared/ChartCard/ChartCard';
10
- export * from './components/component.constants';
11
- export * from './components/charts/pies/pies.types';
12
- export * as PieChartPro from './components/charts/pies/PieChartPro';
9
+ export * as BarChartDefaultPro from './components/charts/bars/BarChartDefaultPro';
10
+ export * as BarChartStackedPro from './components/charts/bars/BarChartStackedPro';
11
+ export * as BarChartGroupedPro from './components/charts/bars/BarChartGroupedPro';
12
+ export * as BarChartDefaultHorizontalPro from './components/charts/bars/BarChartDefaultHorizontalPro';
13
+ export * as BarChartStackedHorizontalPro from './components/charts/bars/BarChartStackedHorizontalPro';
14
+ export * as BarChartGroupedHorizontalPro from './components/charts/bars/BarChartGroupedHorizontalPro';
15
+ export * from './components/charts/bars/bars.utils';
16
+ export * as KpiChartNumberPro from './components/charts/kpis/KpiChartNumberPro';
17
+ export * as KpiChartNumberComparisonPro from './components/charts/kpis/KpiChartNumberComparisonPro';
18
+ export * as LineChartDefaultPro from './components/charts/lines/LineChartDefaultPro';
19
+ export * as LineChartGroupedPro from './components/charts/lines/LineChartGroupedPro';
20
+ export * as LineChartComparisonDefaultPro from './components/charts/lines/LineChartComparisonDefaultPro';
21
+ export * from './components/charts/lines/LineChartComparisonDefaultPro/LineChartComparisonDefaultPro.utils';
22
+ export * from './components/charts/lines/LineChartDefaultPro/LineChartDefaultPro.utils';
23
+ export * from './components/charts/lines/LineChartGroupedPro/LineChartGroupedPro.utils';
13
24
  export * as DonutChartPro from './components/charts/pies/DonutChartPro';
25
+ export * as PieChartPro from './components/charts/pies/PieChartPro';
14
26
  export * as DonutLabelChartPro from './components/charts/pies/DonutLabelChartPro';
27
+ export * from './components/charts/pies/pies.types';
15
28
  export * from './components/charts/pies/pies.utils';
16
- export { EditorCard } from './components/editors/shared/EditorCard/EditorCard';
29
+ export * as HeatMapPro from './components/charts/tables/HeatMapPro';
30
+ export * as PivotTablePro from './components/charts/tables/PivotTablePro';
31
+ export * as TableChartPaginatedPro from './components/charts/tables/TableChartPaginated';
32
+ export { ChartCard } from './components/charts/shared/ChartCard/ChartCard';
33
+ export * from './components/component.constants';
34
+ export * as ComparisonPeriodSelectFieldPro from './components/editors/ComparisonPeriodSelectFieldPro';
35
+ export * from './components/editors/ComparisonPeriodSelectFieldPro/ComparisonPeriodSelectFieldPro.utils';
36
+ export * as DateRangeSelectFieldPro from './components/editors/DateRangeSelectFieldPro';
37
+ export * from './components/editors/DateRangeSelectFieldPro/DateRangeSelectFieldPro.utils';
17
38
  export * as MultiSelectFieldPro from './components/editors/MultiSelectFieldPro';
18
39
  export * as SingleSelectFieldPro from './components/editors/SingleSelectFieldPro';
19
- export * as DateRangeSelectFieldPro from './components/editors/DateRangeSelectFieldPro';
40
+ export { EditorCard } from './components/editors/shared/EditorCard/EditorCard';
20
41
  export { default as ComparisonPeriodType } from './components/types/ComparisonPeriod.type.emb';
21
42
  export { setColorAlpha, isColorValid } from './utils.ts/color.utils';
22
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGpD,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AAGxC,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAC3E,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,OAAO,KAAK,WAAW,MAAM,sCAAsC,CAAC;AACpE,OAAO,KAAK,aAAa,MAAM,wCAAwC,CAAC;AACxE,OAAO,KAAK,kBAAkB,MAAM,6CAA6C,CAAC;AAClF,cAAc,qCAAqC,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAC/E,OAAO,KAAK,mBAAmB,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,oBAAoB,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,uBAAuB,MAAM,8CAA8C,CAAC;AAGxF,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAG/F,OAAO,EAAE,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M,sCAAsC,CAAC;AACpE,OAAO,KAAK,kBAAkB,MAAM,6CAA6C,CAAC;AAClF,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AAEpD,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,aAAa,MAAM,0CAA0C,CAAC;AAC1E,OAAO,KAAK,sBAAsB,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAC3E,cAAc,kCAAkC,CAAC;AAGjD,OAAO,KAAK,8BAA8B,MAAM,qDAAqD,CAAC;AACtG,cAAc,0FAA0F,CAAC;AACzG,OAAO,KAAK,uBAAuB,MAAM,8CAA8C,CAAC;AACxF,cAAc,4EAA4E,CAAC;AAC3F,OAAO,KAAK,mBAAmB,MAAM,0CAA0C,CAAC;AAChF,OAAO,KAAK,oBAAoB,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,mDAAmD,CAAC;AAG/E,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -1,87 +1,130 @@
1
- import { g as e } from "./object.utils-D_Zzon-H.js";
2
- import { v as o, G as i, w as t, B as n, x as m, y as u, z as p, A as x, C as l, Q as b, g as d, c as g, d as h, b as c, i as I, a as f, Z as P, H as C, D as A, E as S, _ as y, r as M, P as D, R as L, I as T, M as R, J as w, Y as v, L as B, K as F, p as N, e as G, o as O, q as E, n as V, j as W, k as j, l as k, t as K, m as X, f as Y, h as q, s as z, u as H, F as J, N as Q, W as U, V as Z, U as _, O as $, X as ss, T as as, S as es } from "./component.constants-uP1WYyUb.js";
3
- import { r as os } from "./charts.utils-rO92wRxO.js";
4
- import { g as ts } from "./formatter.utils-CeEdL8uQ.js";
5
- import { C as ms } from "./ChartCard-CsKQOusx.js";
6
- import { i as ps } from "./index-B8bT85NR.js";
7
- import { i as ls } from "./index-Brb617sy.js";
8
- import { i as ds } from "./index-DLFOG9Ar.js";
9
- import { g as hs, a as cs } from "./pies.utils-Dap7Duqb.js";
10
- import { E as fs } from "./EditorCard-BMEwnQuU.js";
11
- import { i as Cs } from "./index-BWpUwKTH.js";
12
- import { i as Ss } from "./index-Dwl9clc9.js";
13
- import { i as Ms } from "./index-DrosyYQD.js";
14
- import { C as Ls } from "./ComparisonPeriod.type.emb-C3XjaFoD.js";
15
- import { i as Rs, s as ws } from "./color.utils-BSg_DFOh.js";
1
+ import { g as r } from "./object.utils-D_Zzon-H.js";
2
+ import { v as o, G as t, w as i, B as n, x as p, y as m, z as u, A as l, C as x, Q as P, g, c as C, d as h, b as d, i as f, a as b, Z as c, H as D, D as I, E as L, _ as S, r as A, P as B, R as M, I as y, M as T, J as O, Y as G, L as R, K as F, p as v, e as w, o as N, q as k, n as H, j as z, k as K, l as E, t as V, m as W, f as j, h as X, s as Y, u as q, F as J, N as Q, W as U, V as Z, U as _, O as $, X as aa, T as ea, S as ra } from "./component.constants-C7cqSNbp.js";
3
+ import { r as oa } from "./charts.utils-CZnXoUqF.js";
4
+ import { g as ia } from "./formatter.utils-CfrcSyDX.js";
5
+ import { i as pa } from "./index-CvmifdRS.js";
6
+ import { i as ua } from "./index-9GEogpMN.js";
7
+ import { i as xa } from "./index-DGz1wzRd.js";
8
+ import { i as ga } from "./index-BjdJeBiT.js";
9
+ import { i as ha } from "./index-Cc-mtCkt.js";
10
+ import { i as fa } from "./index-D1L8EF47.js";
11
+ import { a as ca, b as Da, g as Ia } from "./bars.utils-aO0eZx5e.js";
12
+ import { i as Sa } from "./index-DaeSYZkv.js";
13
+ import { i as Ba } from "./index-DORMEL0e.js";
14
+ import { i as ya, g as Ta, a as Oa } from "./index-C_F-ZHJz.js";
15
+ import { i as Ra, g as Fa, a as va } from "./index-C1EIos9z.js";
16
+ import { i as Na, g as ka, a as Ha } from "./index-BSc_Axva.js";
17
+ import { i as Ka } from "./index-Dhwlo6sD.js";
18
+ import { i as Va } from "./index-L9ViZuWi.js";
19
+ import { i as ja } from "./index-BQf2W8Zn.js";
20
+ import { g as Ya, a as qa } from "./pies.utils-DlK4ABKU.js";
21
+ import { i as Qa } from "./index-85Nzu6wl.js";
22
+ import { i as Za } from "./index-DTuHmdil.js";
23
+ import { i as $a } from "./index-DZU1PTjb.js";
24
+ import { C as ee } from "./ChartCard-DPqhmLst.js";
25
+ import { i as se, g as oe, a as te } from "./index-wy7P41uG.js";
26
+ import { i as ne, g as pe } from "./index-WCMGd0_l.js";
27
+ import { i as ue } from "./index-BAomPP89.js";
28
+ import { i as xe } from "./index-2EH0Voxh.js";
29
+ import { E as ge } from "./EditorCard-BaL9GbQ9.js";
30
+ import { C as he } from "./ComparisonPeriod.type.emb-2GetmOu1.js";
31
+ import { i as fe, s as be } from "./color.utils-BSg_DFOh.js";
16
32
  export {
17
- ms as ChartCard,
18
- Ls as ComparisonPeriodType,
19
- Ms as DateRangeSelectFieldPro,
20
- ls as DonutChartPro,
21
- ds as DonutLabelChartPro,
22
- fs as EditorCard,
23
- Cs as MultiSelectFieldPro,
24
- ps as PieChartPro,
25
- Ss as SingleSelectFieldPro,
33
+ ga as BarChartDefaultHorizontalPro,
34
+ pa as BarChartDefaultPro,
35
+ fa as BarChartGroupedHorizontalPro,
36
+ xa as BarChartGroupedPro,
37
+ ha as BarChartStackedHorizontalPro,
38
+ ua as BarChartStackedPro,
39
+ ee as ChartCard,
40
+ se as ComparisonPeriodSelectFieldPro,
41
+ he as ComparisonPeriodType,
42
+ ne as DateRangeSelectFieldPro,
43
+ Ka as DonutChartPro,
44
+ ja as DonutLabelChartPro,
45
+ ge as EditorCard,
46
+ Qa as HeatMapPro,
47
+ Ba as KpiChartNumberComparisonPro,
48
+ Sa as KpiChartNumberPro,
49
+ Na as LineChartComparisonDefaultPro,
50
+ ya as LineChartDefaultPro,
51
+ Ra as LineChartGroupedPro,
52
+ ue as MultiSelectFieldPro,
53
+ Va as PieChartPro,
54
+ Za as PivotTablePro,
55
+ xe as SingleSelectFieldPro,
56
+ $a as TableChartPaginatedPro,
26
57
  o as dataset,
27
- i as description,
28
- t as dimension,
58
+ t as description,
59
+ i as dimension,
29
60
  n as dimensionOrMeasure,
30
- m as dimensionSimple,
31
- u as dimensionTime,
32
- p as dimensionWithDateBounds,
33
- x as dimensions,
34
- l as dimensionsAndMeasures,
35
- b as displayPercentages,
36
- d as genericBoolean,
37
- g as genericNumber,
61
+ p as dimensionSimple,
62
+ m as dimensionTime,
63
+ u as dimensionWithDateBounds,
64
+ l as dimensions,
65
+ x as dimensionsAndMeasures,
66
+ P as displayPercentages,
67
+ g as genericBoolean,
68
+ C as genericNumber,
38
69
  h as genericString,
39
- c as genericTimeRange,
40
- e as getObjectStableKey,
41
- hs as getPieChartProData,
42
- cs as getPieChartProOptions,
43
- ts as getThemeFormatter,
44
- I as i18n,
45
- f as i18nSetup,
46
- Rs as isColorValid,
47
- P as maxLegendItems,
48
- C as maxResults,
49
- A as measure,
50
- S as measures,
51
- y as placeholder,
52
- os as remarkableTheme,
53
- M as resolveI18nProps,
54
- D as reverseXAxis,
55
- L as reverseYAxis,
56
- ws as setColorAlpha,
57
- T as showLegend,
58
- R as showLogarithmicScale,
59
- w as showTooltips,
60
- v as showTopItems,
61
- B as showTotalLabels,
70
+ d as genericTimeRange,
71
+ ca as getBarChartProData,
72
+ Da as getBarChartProOptions,
73
+ Ia as getBarStackedChartProData,
74
+ oe as getComparisonPeriodSelectFieldProOptions,
75
+ pe as getDateRangeSelectFieldProOptions,
76
+ ka as getLineChartComparisonProData,
77
+ Ha as getLineChartComparisonProOptions,
78
+ Fa as getLineChartGroupedProData,
79
+ va as getLineChartGroupedProOptions,
80
+ Ta as getLineChartProData,
81
+ Oa as getLineChartProOptions,
82
+ r as getObjectStableKey,
83
+ Ya as getPieChartProData,
84
+ qa as getPieChartProOptions,
85
+ ia as getThemeFormatter,
86
+ f as i18n,
87
+ b as i18nSetup,
88
+ fe as isColorValid,
89
+ te as isComparisonPeriodAvailable,
90
+ c as maxLegendItems,
91
+ D as maxResults,
92
+ I as measure,
93
+ L as measures,
94
+ S as placeholder,
95
+ oa as remarkableTheme,
96
+ A as resolveI18nProps,
97
+ B as reverseXAxis,
98
+ M as reverseYAxis,
99
+ be as setColorAlpha,
100
+ y as showLegend,
101
+ T as showLogarithmicScale,
102
+ O as showTooltips,
103
+ G as showTopItems,
104
+ R as showTotalLabels,
62
105
  F as showValueLabels,
63
- N as subInputAbbreviateLargeNumber,
64
- G as subInputAlign,
65
- O as subInputCurrency,
66
- E as subInputDateBounds,
67
- V as subInputDecimalPlaces,
68
- W as subInputDisplayName,
69
- j as subInputGenericBoolean,
70
- k as subInputGenericNumber,
71
- K as subInputGranularity,
72
- X as subInputMaxCharacters,
73
- Y as subInputPrefix,
74
- q as subInputSuffix,
75
- z as subInputWidth,
76
- H as timeDimensionSubInputs,
106
+ v as subInputAbbreviateLargeNumber,
107
+ w as subInputAlign,
108
+ N as subInputCurrency,
109
+ k as subInputDateBounds,
110
+ H as subInputDecimalPlaces,
111
+ z as subInputDisplayName,
112
+ K as subInputGenericBoolean,
113
+ E as subInputGenericNumber,
114
+ V as subInputGranularity,
115
+ W as subInputMaxCharacters,
116
+ j as subInputPrefix,
117
+ X as subInputSuffix,
118
+ Y as subInputWidth,
119
+ q as timeDimensionSubInputs,
77
120
  J as title,
78
121
  Q as xAxisLabel,
79
122
  U as xAxisMaxItems,
80
123
  Z as xAxisRangeMax,
81
124
  _ as xAxisRangeMin,
82
125
  $ as yAxisLabel,
83
- ss as yAxisMaxItems,
84
- as as yAxisRangeMax,
85
- es as yAxisRangeMin
126
+ aa as yAxisMaxItems,
127
+ ea as yAxisRangeMax,
128
+ ra as yAxisRangeMin
86
129
  };
87
130
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
- import { r as g, g as b } from "./charts.utils-rO92wRxO.js";
2
- import { g as u } from "./formatter.utils-CeEdL8uQ.js";
1
+ import { r as g, g as b } from "./charts.utils-CZnXoUqF.js";
2
+ import { g as u } from "./formatter.utils-CfrcSyDX.js";
3
3
  import { g as h, a as c } from "./object.utils-D_Zzon-H.js";
4
- import { g as C } from "./index-DedIqjbn.js";
5
- import { i as f } from "./component.constants-uP1WYyUb.js";
4
+ import { g as C } from "./index-D8D1R5YG.js";
5
+ import { i as f } from "./component.constants-C7cqSNbp.js";
6
6
  const T = (a, o = g) => {
7
7
  const s = u(o);
8
8
  if (!a.data)
@@ -70,4 +70,4 @@ export {
70
70
  w as a,
71
71
  T as g
72
72
  };
73
- //# sourceMappingURL=pies.utils-Dap7Duqb.js.map
73
+ //# sourceMappingURL=pies.utils-DlK4ABKU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pies.utils-Dap7Duqb.js","sources":["../src/components/charts/pies/pies.utils.ts"],"sourcesContent":["import { DataResponse, Dimension, Measure } from '@embeddable.com/core';\nimport { ChartData, ChartOptions } from 'chart.js';\nimport { groupTailAsOther } from '../charts.utils';\nimport { Theme } from '../../../theme/theme.types';\nimport { remarkableTheme } from '../../../theme/theme.constants';\nimport { getThemeFormatter } from '../../../theme/formatter/formatter.utils';\nimport { getColor } from '../../../theme/styles/styles.utils';\nimport { getChartColors } from '@embeddable.com/remarkable-ui';\nimport { i18n } from '../../../theme/i18n/i18n';\nimport { getObjectStableKey } from '../../../utils.ts/object.utils';\n\nexport const getPieChartProData = (\n props: {\n data: DataResponse['data'];\n dimension: Dimension;\n measure: Measure;\n maxLegendItems?: number;\n },\n theme: Theme = remarkableTheme,\n): ChartData<'pie'> => {\n const themeFormatter = getThemeFormatter(theme);\n\n if (!props.data)\n return {\n labels: [],\n datasets: [{ data: [] }],\n };\n\n const groupedData = groupTailAsOther(\n props.data,\n props.dimension,\n [props.measure],\n props.maxLegendItems,\n );\n\n const themeKey = getObjectStableKey(theme);\n const chartColors = getChartColors();\n const backgroundColor = groupedData.map((item, i) =>\n getColor(\n `${themeKey}.charts.backgroundColors`,\n `${props.dimension.name}.${item[props.dimension.name]}`,\n theme.charts.backgroundColors ?? chartColors,\n i,\n ),\n );\n\n const borderColor = groupedData.map((item, i) =>\n getColor(\n `${themeKey}.charts.borderColors`,\n `${props.dimension.name}.${item[props.dimension.name]}`,\n theme.charts.borderColors ?? chartColors,\n i,\n ),\n );\n\n return {\n labels: groupedData.map((item) => {\n const value = item[props.dimension.name];\n const formattedValue = themeFormatter.data(props.dimension, value);\n\n // If formatter did not work, try i18n translation\n if (value === formattedValue) {\n return i18n.t(value);\n }\n return formattedValue;\n }),\n datasets: [\n {\n data: groupedData.map((item) => item[props.measure.name]),\n backgroundColor,\n borderColor,\n },\n ],\n };\n};\n\nexport const getPieChartProOptions = (\n measure: Measure,\n theme: Theme = remarkableTheme,\n): Partial<ChartOptions<'pie'>> => {\n const themeFormatter = getThemeFormatter(theme);\n\n return {\n plugins: {\n legend: { position: theme.charts.legendPosition ?? 'bottom' },\n datalabels: {\n formatter: (value: string | number) => themeFormatter.data(measure, value),\n },\n tooltip: {\n callbacks: {\n label(context) {\n const raw = context.raw as number;\n const total = context.dataset.data.reduce(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (sum: number, v: any) => sum + parseFloat(v),\n 0,\n );\n const pct = Math.round((raw / total) * 100);\n return `${themeFormatter.data(measure, raw)} (${pct}%)`;\n },\n },\n },\n },\n };\n};\n"],"names":["getPieChartProData","props","theme","remarkableTheme","themeFormatter","getThemeFormatter","groupedData","groupTailAsOther","themeKey","getObjectStableKey","chartColors","getChartColors","backgroundColor","item","i","getColor","borderColor","value","formattedValue","i18n","getPieChartProOptions","measure","context","raw","total","sum","v","pct"],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AAEJ,GAEaI,IAAwB,CACnCC,GACAnB,IAAeC,MACkB;AACjC,QAAMC,IAAiBC,EAAkBH,CAAK;AAE9C,SAAO;AAAA,IACL,SAAS;AAAA,MACP,QAAQ,EAAE,UAAUA,EAAM,OAAO,kBAAkB,SAAA;AAAA,MACnD,YAAY;AAAA,QACV,WAAW,CAACe,MAA2Bb,EAAe,KAAKiB,GAASJ,CAAK;AAAA,MAAA;AAAA,MAE3E,SAAS;AAAA,QACP,WAAW;AAAA,UACT,MAAMK,GAAS;AACb,kBAAMC,IAAMD,EAAQ,KACdE,IAAQF,EAAQ,QAAQ,KAAK;AAAA;AAAA,cAEjC,CAACG,GAAaC,MAAWD,IAAM,WAAWC,CAAC;AAAA,cAC3C;AAAA,YAAA,GAEIC,IAAM,KAAK,MAAOJ,IAAMC,IAAS,GAAG;AAC1C,mBAAO,GAAGpB,EAAe,KAAKiB,GAASE,CAAG,CAAC,KAAKI,CAAG;AAAA,UACrD;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"pies.utils-DlK4ABKU.js","sources":["../src/components/charts/pies/pies.utils.ts"],"sourcesContent":["import { DataResponse, Dimension, Measure } from '@embeddable.com/core';\nimport { ChartData, ChartOptions } from 'chart.js';\nimport { groupTailAsOther } from '../charts.utils';\nimport { Theme } from '../../../theme/theme.types';\nimport { remarkableTheme } from '../../../theme/theme.constants';\nimport { getThemeFormatter } from '../../../theme/formatter/formatter.utils';\nimport { getColor } from '../../../theme/styles/styles.utils';\nimport { getChartColors } from '@embeddable.com/remarkable-ui';\nimport { i18n } from '../../../theme/i18n/i18n';\nimport { getObjectStableKey } from '../../../utils.ts/object.utils';\n\nexport const getPieChartProData = (\n props: {\n data: DataResponse['data'];\n dimension: Dimension;\n measure: Measure;\n maxLegendItems?: number;\n },\n theme: Theme = remarkableTheme,\n): ChartData<'pie'> => {\n const themeFormatter = getThemeFormatter(theme);\n\n if (!props.data)\n return {\n labels: [],\n datasets: [{ data: [] }],\n };\n\n const groupedData = groupTailAsOther(\n props.data,\n props.dimension,\n [props.measure],\n props.maxLegendItems,\n );\n\n const themeKey = getObjectStableKey(theme);\n const chartColors = getChartColors();\n const backgroundColor = groupedData.map((item, i) =>\n getColor(\n `${themeKey}.charts.backgroundColors`,\n `${props.dimension.name}.${item[props.dimension.name]}`,\n theme.charts.backgroundColors ?? chartColors,\n i,\n ),\n );\n\n const borderColor = groupedData.map((item, i) =>\n getColor(\n `${themeKey}.charts.borderColors`,\n `${props.dimension.name}.${item[props.dimension.name]}`,\n theme.charts.borderColors ?? chartColors,\n i,\n ),\n );\n\n return {\n labels: groupedData.map((item) => {\n const value = item[props.dimension.name];\n const formattedValue = themeFormatter.data(props.dimension, value);\n\n // If formatter did not work, try i18n translation\n if (value === formattedValue) {\n return i18n.t(value);\n }\n return formattedValue;\n }),\n datasets: [\n {\n data: groupedData.map((item) => item[props.measure.name]),\n backgroundColor,\n borderColor,\n },\n ],\n };\n};\n\nexport const getPieChartProOptions = (\n measure: Measure,\n theme: Theme = remarkableTheme,\n): Partial<ChartOptions<'pie'>> => {\n const themeFormatter = getThemeFormatter(theme);\n\n return {\n plugins: {\n legend: { position: theme.charts.legendPosition ?? 'bottom' },\n datalabels: {\n formatter: (value: string | number) => themeFormatter.data(measure, value),\n },\n tooltip: {\n callbacks: {\n label(context) {\n const raw = context.raw as number;\n const total = context.dataset.data.reduce(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (sum: number, v: any) => sum + parseFloat(v),\n 0,\n );\n const pct = Math.round((raw / total) * 100);\n return `${themeFormatter.data(measure, raw)} (${pct}%)`;\n },\n },\n },\n },\n };\n};\n"],"names":["getPieChartProData","props","theme","remarkableTheme","themeFormatter","getThemeFormatter","groupedData","groupTailAsOther","themeKey","getObjectStableKey","chartColors","getChartColors","backgroundColor","item","i","getColor","borderColor","value","formattedValue","i18n","getPieChartProOptions","measure","context","raw","total","sum","v","pct"],"mappings":";;;;;AAWO,MAAM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