@quillsql/react 1.6.9 → 1.7.1

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 (201) hide show
  1. package/lib/AddToDashboardModal.js +249 -369
  2. package/lib/AddToDashboardModal.js.map +1 -1
  3. package/lib/BarList.js +92 -109
  4. package/lib/BarList.js.map +1 -1
  5. package/lib/Chart.js +378 -491
  6. package/lib/Chart.js.map +1 -1
  7. package/lib/Context.d.ts +3 -3
  8. package/lib/Context.js +94 -96
  9. package/lib/Context.js.map +1 -1
  10. package/lib/Dashboard.js +200 -217
  11. package/lib/Dashboard.js.map +1 -1
  12. package/lib/DateRangePicker/Calendar.js +87 -91
  13. package/lib/DateRangePicker/Calendar.js.map +1 -1
  14. package/lib/DateRangePicker/DateRangePicker.js +70 -68
  15. package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
  16. package/lib/DateRangePicker/DateRangePickerButton.js +46 -57
  17. package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
  18. package/lib/DateRangePicker/dateRangePickerUtils.js +105 -99
  19. package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
  20. package/lib/DateRangePicker/index.js +8 -1
  21. package/lib/DateRangePicker/index.js.map +1 -1
  22. package/lib/PieChart.js +221 -225
  23. package/lib/PieChart.js.map +1 -1
  24. package/lib/QuillProvider.d.ts +2 -1
  25. package/lib/QuillProvider.js +8 -18
  26. package/lib/QuillProvider.js.map +1 -1
  27. package/lib/ReportBuilder.d.ts +1 -1
  28. package/lib/ReportBuilder.js +430 -526
  29. package/lib/ReportBuilder.js.map +1 -1
  30. package/lib/SQLEditor.js +183 -268
  31. package/lib/SQLEditor.js.map +1 -1
  32. package/lib/Table.js +213 -256
  33. package/lib/Table.js.map +1 -1
  34. package/lib/TableChart.js +76 -75
  35. package/lib/TableChart.js.map +1 -1
  36. package/lib/assets/ArrowDownHeadIcon.js +5 -28
  37. package/lib/assets/ArrowDownHeadIcon.js.map +1 -1
  38. package/lib/assets/ArrowDownIcon.js +5 -28
  39. package/lib/assets/ArrowDownIcon.js.map +1 -1
  40. package/lib/assets/ArrowDownRightIcon.js +5 -28
  41. package/lib/assets/ArrowDownRightIcon.js.map +1 -1
  42. package/lib/assets/ArrowLeftHeadIcon.js +5 -28
  43. package/lib/assets/ArrowLeftHeadIcon.js.map +1 -1
  44. package/lib/assets/ArrowRightHeadIcon.js +5 -28
  45. package/lib/assets/ArrowRightHeadIcon.js.map +1 -1
  46. package/lib/assets/ArrowRightIcon.js +5 -28
  47. package/lib/assets/ArrowRightIcon.js.map +1 -1
  48. package/lib/assets/ArrowUpHeadIcon.js +5 -28
  49. package/lib/assets/ArrowUpHeadIcon.js.map +1 -1
  50. package/lib/assets/ArrowUpIcon.js +5 -28
  51. package/lib/assets/ArrowUpIcon.js.map +1 -1
  52. package/lib/assets/ArrowUpRightIcon.js +5 -28
  53. package/lib/assets/ArrowUpRightIcon.js.map +1 -1
  54. package/lib/assets/CalendarIcon.js +5 -28
  55. package/lib/assets/CalendarIcon.js.map +1 -1
  56. package/lib/assets/DoubleArrowLeftHeadIcon.js +5 -28
  57. package/lib/assets/DoubleArrowLeftHeadIcon.js.map +1 -1
  58. package/lib/assets/DoubleArrowRightHeadIcon.js +5 -28
  59. package/lib/assets/DoubleArrowRightHeadIcon.js.map +1 -1
  60. package/lib/assets/ExclamationFilledIcon.js +5 -28
  61. package/lib/assets/ExclamationFilledIcon.js.map +1 -1
  62. package/lib/assets/LoadingSpinner.js +5 -28
  63. package/lib/assets/LoadingSpinner.js.map +1 -1
  64. package/lib/assets/SearchIcon.js +5 -28
  65. package/lib/assets/SearchIcon.js.map +1 -1
  66. package/lib/assets/XCircleIcon.js +5 -28
  67. package/lib/assets/XCircleIcon.js.map +1 -1
  68. package/lib/assets/index.js +38 -16
  69. package/lib/assets/index.js.map +1 -1
  70. package/lib/components/BigModal/BigModal.js +45 -43
  71. package/lib/components/BigModal/BigModal.js.map +1 -1
  72. package/lib/components/Dropdown/Dropdown.js +57 -53
  73. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  74. package/lib/components/Dropdown/DropdownItem.js +43 -40
  75. package/lib/components/Dropdown/DropdownItem.js.map +1 -1
  76. package/lib/components/Dropdown/index.js +10 -2
  77. package/lib/components/Dropdown/index.js.map +1 -1
  78. package/lib/components/Modal/Modal.js +45 -43
  79. package/lib/components/Modal/Modal.js.map +1 -1
  80. package/lib/components/Modal/index.js +8 -1
  81. package/lib/components/Modal/index.js.map +1 -1
  82. package/lib/components/selectUtils.js +20 -15
  83. package/lib/components/selectUtils.js.map +1 -1
  84. package/lib/contexts/BaseColorContext.js +5 -3
  85. package/lib/contexts/BaseColorContext.js.map +1 -1
  86. package/lib/contexts/HoveredValueContext.js +5 -3
  87. package/lib/contexts/HoveredValueContext.js.map +1 -1
  88. package/lib/contexts/RootStylesContext.js +5 -3
  89. package/lib/contexts/RootStylesContext.js.map +1 -1
  90. package/lib/contexts/SelectedValueContext.js +5 -3
  91. package/lib/contexts/SelectedValueContext.js.map +1 -1
  92. package/lib/contexts/index.js +14 -4
  93. package/lib/contexts/index.js.map +1 -1
  94. package/lib/hooks/index.js +14 -4
  95. package/lib/hooks/index.js.map +1 -1
  96. package/lib/hooks/useInternalState.js +9 -7
  97. package/lib/hooks/useInternalState.js.map +1 -1
  98. package/lib/hooks/useOnClickOutside.js +8 -6
  99. package/lib/hooks/useOnClickOutside.js.map +1 -1
  100. package/lib/hooks/useOnWindowResize.js +9 -7
  101. package/lib/hooks/useOnWindowResize.js.map +1 -1
  102. package/lib/hooks/useQuill.js +60 -111
  103. package/lib/hooks/useQuill.js.map +1 -1
  104. package/lib/hooks/useSelectOnKeyDown.js +17 -15
  105. package/lib/hooks/useSelectOnKeyDown.js.map +1 -1
  106. package/lib/index.js +22 -8
  107. package/lib/index.js.map +1 -1
  108. package/package.json +9 -2
  109. package/rollup.config.ts +21 -0
  110. package/src/AddToDashboardModal.tsx +10 -3
  111. package/src/Chart.tsx +66 -195
  112. package/src/Context.tsx +10 -27
  113. package/src/Dashboard.tsx +40 -23
  114. package/src/QuillProvider.tsx +3 -0
  115. package/src/ReportBuilder.tsx +10 -5
  116. package/src/SQLEditor.tsx +9 -4
  117. package/src/Table.tsx +0 -1
  118. package/src/hooks/useQuill.ts +2 -1
  119. package/lib/AddToDashboardButton.d.ts +0 -1
  120. package/lib/AddToDashboardButton.js +0 -2
  121. package/lib/AddToDashboardButton.js.map +0 -1
  122. package/lib/AppContext.d.ts +0 -29
  123. package/lib/AppContext.js +0 -94
  124. package/lib/AppContext.js.map +0 -1
  125. package/lib/Button.d.ts +0 -26
  126. package/lib/Button.js +0 -151
  127. package/lib/Button.js.map +0 -1
  128. package/lib/ContextProvider.d.ts +0 -28
  129. package/lib/ContextProvider.js +0 -93
  130. package/lib/ContextProvider.js.map +0 -1
  131. package/lib/DateRangePicker.d.ts +0 -32
  132. package/lib/DateRangePicker.js +0 -105
  133. package/lib/DateRangePicker.js.map +0 -1
  134. package/lib/Dialog.d.ts +0 -68
  135. package/lib/Dialog.js +0 -407
  136. package/lib/Dialog.js.map +0 -1
  137. package/lib/Portal.d.ts +0 -32
  138. package/lib/Portal.js +0 -171
  139. package/lib/Portal.js.map +0 -1
  140. package/lib/Props.d.ts +0 -0
  141. package/lib/Props.js +0 -2
  142. package/lib/Props.js.map +0 -1
  143. package/lib/components/BigModal/Modal.d.ts +0 -14
  144. package/lib/components/BigModal/Modal.js +0 -109
  145. package/lib/components/BigModal/Modal.js.map +0 -1
  146. package/lib/components/Modal/Dropdown/Dropdown.d.ts +0 -12
  147. package/lib/components/Modal/Dropdown/Dropdown.js +0 -52
  148. package/lib/components/Modal/Dropdown/Dropdown.js.map +0 -1
  149. package/lib/components/Modal/Dropdown/DropdownItem.d.ts +0 -8
  150. package/lib/components/Modal/Dropdown/DropdownItem.js +0 -51
  151. package/lib/components/Modal/Dropdown/DropdownItem.js.map +0 -1
  152. package/lib/components/Modal/Dropdown/index.d.ts +0 -2
  153. package/lib/components/Modal/Dropdown/index.js +0 -3
  154. package/lib/components/Modal/Dropdown/index.js.map +0 -1
  155. package/lib/hooks/useSyncRefs.d.ts +0 -5
  156. package/lib/hooks/useSyncRefs.js +0 -38
  157. package/lib/hooks/useSyncRefs.js.map +0 -1
  158. package/lib/lib/colorClassNames.d.ts +0 -19
  159. package/lib/lib/colorClassNames.js +0 -3175
  160. package/lib/lib/colorClassNames.js.map +0 -1
  161. package/lib/lib/constants.d.ts +0 -16
  162. package/lib/lib/constants.js +0 -47
  163. package/lib/lib/constants.js.map +0 -1
  164. package/lib/lib/font.d.ts +0 -13
  165. package/lib/lib/font.js +0 -14
  166. package/lib/lib/font.js.map +0 -1
  167. package/lib/lib/hexColors.d.ts +0 -3
  168. package/lib/lib/hexColors.js +0 -29
  169. package/lib/lib/hexColors.js.map +0 -1
  170. package/lib/lib/index.d.ts +0 -3
  171. package/lib/lib/index.js +0 -4
  172. package/lib/lib/index.js.map +0 -1
  173. package/lib/lib/inputTypes.d.ts +0 -20
  174. package/lib/lib/inputTypes.js +0 -56
  175. package/lib/lib/inputTypes.js.map +0 -1
  176. package/lib/lib/shape.d.ts +0 -73
  177. package/lib/lib/shape.js +0 -74
  178. package/lib/lib/shape.js.map +0 -1
  179. package/lib/lib/sizing.d.ts +0 -46
  180. package/lib/lib/sizing.js +0 -43
  181. package/lib/lib/sizing.js.map +0 -1
  182. package/lib/lib/spacing.d.ts +0 -264
  183. package/lib/lib/spacing.js +0 -265
  184. package/lib/lib/spacing.js.map +0 -1
  185. package/lib/lib/theme.d.ts +0 -22
  186. package/lib/lib/theme.js +0 -46
  187. package/lib/lib/theme.js.map +0 -1
  188. package/lib/lib/utils.d.ts +0 -9
  189. package/lib/lib/utils.js +0 -40
  190. package/lib/lib/utils.js.map +0 -1
  191. package/lib/styles.css +0 -15795
  192. package/lib/types/Props.d.ts +0 -0
  193. package/lib/types/Props.js +0 -2
  194. package/lib/types/Props.js.map +0 -1
  195. package/lib/types.d.ts +0 -27
  196. package/lib/types.js +0 -6
  197. package/lib/types.js.map +0 -1
  198. package/src/lib/font.ts +0 -14
  199. package/src/lib/index.ts +0 -3
  200. package/src/lib/inputTypes.ts +0 -81
  201. package/src/lib/utils.tsx +0 -46
package/lib/Dashboard.js CHANGED
@@ -1,63 +1,45 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
46
7
  }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
47
27
  };
48
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const jsx_runtime_1 = require("react/jsx-runtime");
30
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
49
31
  // @ts-nocheck
50
- import React, { useContext, useEffect, useState, useRef } from 'react';
51
- import Chart from './Chart';
52
- import { ClientContext, DashboardContext, DateFilterContext, ThemeContext, DashboardFiltersContext, } from './Context';
53
- import { startOfToday, sub } from 'date-fns';
54
- import { DateRangePicker } from './DateRangePicker/index';
55
- import axios from 'axios';
56
- import Modal from './components/Modal/Modal';
57
- import { HoveredValueContext, SelectedValueContext } from './contexts';
58
- import { DropdownItem } from './components/Dropdown';
59
- import { ArrowDownHeadIcon } from './assets';
60
- import { useInternalState, useSelectOnKeyDown } from './hooks';
32
+ const react_1 = __importStar(require("react"));
33
+ const Chart_1 = __importDefault(require("./Chart"));
34
+ const Context_1 = require("./Context");
35
+ const date_fns_1 = require("date-fns");
36
+ const index_1 = require("./DateRangePicker/index");
37
+ const axios_1 = __importDefault(require("axios"));
38
+ const Modal_1 = __importDefault(require("./components/Modal/Modal"));
39
+ const contexts_1 = require("./contexts");
40
+ const Dropdown_1 = require("./components/Dropdown");
41
+ const assets_1 = require("./assets");
42
+ const hooks_1 = require("./hooks");
61
43
  // const theme = {
62
44
  // fontFamily: 'Inter; Helvetica',
63
45
  // primaryTextColor: '#212121',
@@ -66,133 +48,137 @@ import { useInternalState, useSelectOnKeyDown } from './hooks';
66
48
  // chartTickColor: '#CCCCCC',
67
49
  // chartColors: ['#6269E9', '#E14F62'],
68
50
  // };
69
- export default function Dashboard(_a) {
70
- var name = _a.name, containerStyle = _a.containerStyle, maxColumnWidth = _a.maxColumnWidth, rowHeight = _a.rowHeight, onClickDashboardItem = _a.onClickDashboardItem, hideDateFilter = _a.hideDateFilter;
71
- var _b = useState(null), dashboardSections = _b[0], setDashboardSections = _b[1];
72
- var dashboard = useContext(DashboardContext).dashboard;
73
- var _c = useContext(ClientContext), client = _c[0], _ = _c[1];
74
- var _d = useContext(ThemeContext), theme = _d[0], _ = _d[1];
75
- var _e = useContext(DateFilterContext), dateFilter = _e.dateFilter, dateFilterDispatch = _e.dateFilterDispatch;
76
- var dashboardFiltersDispatch = useContext(DashboardFiltersContext).dashboardFiltersDispatch;
77
- var _f = useState([]), configFilters = _f[0], setConfigFilters = _f[1];
78
- var setGlobalDateFilter = function (startDate, endDate) {
79
- dateFilterDispatch({
80
- type: 'SET_GLOBAL_DATE_FILTER',
81
- payload: { startDate: startDate, endDate: endDate },
82
- });
83
- };
84
- React.useEffect(function () {
85
- function getDashboards() {
86
- return __awaiter(this, void 0, void 0, function () {
87
- var publicKey, customerId, environment, queryEndpoint, queryHeaders, response_1, response, error_1;
88
- return __generator(this, function (_a) {
89
- switch (_a.label) {
90
- case 0:
91
- publicKey = client.publicKey, customerId = client.customerId, environment = client.environment, queryEndpoint = client.queryEndpoint, queryHeaders = client.queryHeaders;
92
- _a.label = 1;
93
- case 1:
94
- _a.trys.push([1, 5, , 6]);
95
- if (!(queryEndpoint && queryHeaders)) return [3 /*break*/, 3];
96
- return [4 /*yield*/, axios.post(queryEndpoint, {
97
- metadata: { name: name, task: 'config' },
98
- }, {
99
- headers: queryHeaders,
100
- })];
101
- case 2:
102
- response_1 = _a.sent();
103
- if (response_1.status !== 200) {
104
- throw new Error("HTTP error! Status: ".concat(response_1.status));
105
- }
106
- setDashboardSections(response_1.data.sections);
107
- setConfigFilters(response_1.data.filters || []);
108
- return [2 /*return*/];
109
- case 3: return [4 /*yield*/, axios.get('https://quill-344421.uc.r.appspot.com/dashconfig', {
110
- params: {
111
- publicKey: publicKey,
112
- orgId: customerId,
113
- name: name,
114
- task: 'dashconfig',
115
- },
116
- headers: {
117
- environment: environment || undefined,
118
- },
119
- })];
120
- case 4:
121
- response = _a.sent();
122
- if (response.status !== 200) {
123
- throw new Error("HTTP error! Status: ".concat(response.status));
124
- }
125
- setDashboardSections(response.data.sections);
126
- setConfigFilters(response.data.filters || []);
127
- return [3 /*break*/, 6];
128
- case 5:
129
- error_1 = _a.sent();
130
- console.error('Error fetching data:', error_1);
131
- return [3 /*break*/, 6];
132
- case 6: return [2 /*return*/];
51
+ function Dashboard({ name, containerStyle, maxColumnWidth, rowHeight, onClickDashboardItem, hideDateFilter, }) {
52
+ const [dashboardSections, setDashboardSections] = (0, react_1.useState)(null);
53
+ const { dashboard } = (0, react_1.useContext)(Context_1.DashboardContext);
54
+ const [client] = (0, react_1.useContext)(Context_1.ClientContext);
55
+ const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
56
+ const { dashboardFiltersDispatch } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
57
+ const [configFilters, setConfigFilters] = (0, react_1.useState)([]);
58
+ react_1.default.useEffect(() => {
59
+ async function getDashboards() {
60
+ const { publicKey, customerId, environment, queryEndpoint, queryHeaders, withCredentials, } = client;
61
+ try {
62
+ // const response = await fetch(
63
+ // `https://quill-344421.uc.r.appspot.com/dashsections/${publicKey}/${customerId}/${name}`
64
+ // );
65
+ if (queryEndpoint) {
66
+ //&& queryHeaders
67
+ const response = await axios_1.default.post(queryEndpoint, {
68
+ metadata: { name, task: 'config' },
69
+ }, {
70
+ headers: queryHeaders,
71
+ withCredentials,
72
+ });
73
+ if (response.status !== 200) {
74
+ throw new Error(`HTTP error! Status: ${response.status}`);
133
75
  }
76
+ setDashboardSections(response.data.sections);
77
+ setConfigFilters(response.data.filters || []);
78
+ return;
79
+ }
80
+ const response = await axios_1.default.get('https://quill-344421.uc.r.appspot.com/dashconfig', {
81
+ params: {
82
+ publicKey: publicKey,
83
+ orgId: customerId,
84
+ name: name,
85
+ task: 'dashconfig',
86
+ },
87
+ headers: {
88
+ environment: environment || undefined,
89
+ },
134
90
  });
135
- });
91
+ if (response.status !== 200) {
92
+ throw new Error(`HTTP error! Status: ${response.status}`);
93
+ }
94
+ setDashboardSections(response.data.sections);
95
+ setConfigFilters(response.data.filters || []);
96
+ }
97
+ catch (error) {
98
+ console.error('Error fetching data:', error);
99
+ }
136
100
  }
137
101
  getDashboards();
138
102
  }, [name]);
139
- var onChangeDateFilter = function (dateFilter) {
140
- setGlobalDateFilter(dateFilter[0], dateFilter[1]);
141
- };
142
- useEffect(function () {
103
+ (0, react_1.useEffect)(() => {
143
104
  // change to be set on the dashboard / section as default date range
144
- dateFilterDispatch({
145
- type: 'SET_GLOBAL_DATE_FILTER',
146
- payload: {
147
- startDate: sub(startOfToday(), { days: 90 }),
148
- endDate: new Date(),
105
+ const filter = {
106
+ startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
107
+ endDate: new Date(),
108
+ filterType: 'DATE_RANGE',
109
+ };
110
+ dashboardFiltersDispatch({
111
+ type: 'ADD_DASHBOARD_FILTER',
112
+ id: 'date_range',
113
+ data: {
114
+ ...filter,
149
115
  },
150
116
  });
151
117
  }, []);
152
- var handleOnClickDashboardItem = function (id) {
118
+ const handleOnClickDashboardItem = id => {
153
119
  if (dashboard[id]) {
154
120
  onClickDashboardItem(dashboard[id]);
155
121
  }
156
122
  };
157
- var onChangeFilter = function (value, filter) {
123
+ const onChangeDateFilter = dateFilter => {
124
+ setGlobalDateFilter(dateFilter[0], dateFilter[1]);
125
+ };
126
+ const setGlobalDateFilter = (startDate, endDate) => {
127
+ const filter = {
128
+ startDate: startDate,
129
+ endDate: endDate,
130
+ filterType: 'DATE_RANGE',
131
+ };
158
132
  dashboardFiltersDispatch({
159
133
  type: 'ADD_DASHBOARD_FILTER',
160
- id: filter._id,
161
- data: __assign(__assign({}, filter), { selectedValue: filter.options.find(function (elem) { return elem[removeQuotes(filter.field)] === value[2]; })[removeQuotes(filter.field)] }),
134
+ id: 'date_range',
135
+ data: {
136
+ ...filter,
137
+ },
138
+ });
139
+ };
140
+ const onChangeFilter = (value, filter) => {
141
+ dashboardFiltersDispatch({
142
+ type: 'ADD_DASHBOARD_FILTER',
143
+ id: 'date_range',
144
+ data: {
145
+ ...filter,
146
+ selectedValue: filter.options.find(elem => elem[removeQuotes(filter.field)] === value[2])[removeQuotes(filter.field)],
147
+ },
162
148
  });
163
149
  };
164
150
  if (!dashboardSections) {
165
151
  return null;
166
152
  }
167
- return (_jsxs("div", __assign({ style: containerStyle }, { children: [_jsxs("div", __assign({ style: {
153
+ return ((0, jsx_runtime_1.jsxs)("div", { style: containerStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
168
154
  display: 'flex',
169
155
  boxSizing: 'content-box',
170
156
  flexDirection: 'row',
171
157
  alignItems: 'center',
172
- } }, { children: [!hideDateFilter ? (_jsxs("div", __assign({ style: { width: 420, marginBottom: 25, marginLeft: 25 } }, { children: [_jsx("div", __assign({ style: {
158
+ }, children: [!hideDateFilter ? ((0, jsx_runtime_1.jsxs)("div", { style: { width: 420, marginBottom: 25, marginLeft: 25 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
173
159
  marginBottom: 6,
174
160
  fontWeight: '600',
175
161
  color: theme.secondaryTextColor,
176
162
  fontFamily: theme.fontFamily,
177
163
  fontSize: 14,
178
- } }, { children: "Date" })), _jsx(DateRangePicker
164
+ }, children: "Date" }), (0, jsx_runtime_1.jsx)(index_1.DateRangePicker
179
165
  // change to be set on the dashboard / section as default date range
180
166
  , {
181
167
  // change to be set on the dashboard / section as default date range
182
- defaultValue: [undefined, undefined, '90d'], onValueChange: onChangeDateFilter, theme: theme })] }))) : null, _jsx("div", __assign({ style: { width: 280, marginBottom: 25, marginLeft: 25 } }, { children: configFilters.map(function (elem, index) { return (_jsx(Filter, { onValueChange: function (value) { return onChangeFilter(value, elem); }, defaultValue: [
168
+ defaultValue: [undefined, undefined, '90d'], onValueChange: onChangeDateFilter, theme: theme })] })) : null, (0, jsx_runtime_1.jsx)("div", { style: { width: 280, marginBottom: 25, marginLeft: 25 }, children: configFilters.map((elem, index) => ((0, jsx_runtime_1.jsx)(Filter, { onValueChange: value => onChangeFilter(value, elem), defaultValue: [
183
169
  undefined,
184
170
  undefined,
185
171
  elem.options[removeQuotes(elem.field)],
186
- ], theme: theme, filter: elem }, 'filter' + configFilters.field + index)); }) }))] })), Object.keys(dashboardSections)
172
+ ], theme: theme, filter: elem }, 'filter' + configFilters.field + index))) })] }), Object.keys(dashboardSections)
187
173
  .sort(function (a, b) {
188
174
  return a.length - b.length;
189
175
  })
190
- .map(function (section, sectionIndex) {
191
- return (_jsxs("div", __assign({ style: {
176
+ .map((section, sectionIndex) => {
177
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
192
178
  width: '100%',
193
179
  display: 'flex',
194
180
  flexDirection: 'column',
195
- } }, { children: [_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsx("div", { style: { height: sectionIndex > 0 ? 25 : 0 } }), section && (_jsx("h1", __assign({ style: {
181
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: sectionIndex > 0 ? 25 : 0 } }), section && ((0, jsx_runtime_1.jsx)("h1", { style: {
196
182
  fontSize: 22,
197
183
  color: theme.primaryTextColor,
198
184
  fontFamily: theme.fontFamily,
@@ -202,20 +188,20 @@ export default function Dashboard(_a) {
202
188
  marginLeft: 25,
203
189
  textAlign: 'left',
204
190
  marginTop: 12,
205
- } }, { children: section })))] })), dashboardSections[section].filter(function (elem) { return elem.chartType === 'metric'; }).length ? (_jsx("div", __assign({ style: {
191
+ }, children: section }))] }), dashboardSections[section].filter(elem => elem.chartType === 'metric').length ? ((0, jsx_runtime_1.jsx)("div", { style: {
206
192
  boxSizing: 'content-box',
207
- width: "100%",
193
+ width: `100%`,
208
194
  listStyleType: 'none',
209
195
  marginBottom: 50,
210
196
  display: 'grid',
211
197
  gridGap: 25,
212
- gridTemplateColumns: "repeat(auto-fill,minmax(".concat(maxColumnWidth || 400, "px, 1fr))"),
213
- gridTemplateRows: "repeat(".concat(170, "px)"),
214
- } }, { children: dashboardSections[section]
215
- .filter(function (elem) { return elem.chartType === 'metric'; })
216
- .map(function (elem, index) {
217
- return (_jsx("div", __assign({ onClick: onClickDashboardItem
218
- ? function () { return handleOnClickDashboardItem(elem._id); }
198
+ gridTemplateColumns: `repeat(auto-fill,minmax(${maxColumnWidth || 400}px, 1fr))`,
199
+ gridTemplateRows: `repeat(${170}px)`,
200
+ }, children: dashboardSections[section]
201
+ .filter(elem => elem.chartType === 'metric')
202
+ .map((elem, index) => {
203
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
204
+ ? () => handleOnClickDashboardItem(elem._id)
219
205
  : undefined, style: {
220
206
  // background: theme.elevatedCardColor,
221
207
  // borderRadius: theme.borderRadius,
@@ -226,22 +212,22 @@ export default function Dashboard(_a) {
226
212
  height: '100%',
227
213
  cursor: 'pointer',
228
214
  width: '100%',
229
- } }, { children: _jsx("div", __assign({
215
+ }, children: (0, jsx_runtime_1.jsx)("div", {
230
216
  // className="group-hover:bg-black"
231
217
  style: {
232
218
  width: '100%',
233
219
  boxSizing: 'content-box',
234
220
  height: '100%',
235
- } }, { children: _jsx("div", __assign({ style: {
221
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
236
222
  width: '100%',
237
223
  boxSizing: 'content-box',
238
224
  height: '100%',
239
- } }, { children: _jsxs("div", __assign({ style: {
225
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
240
226
  display: 'flex',
241
227
  flexDirection: 'column',
242
228
  justifyContent: 'space-between',
243
229
  boxSizing: 'content-box',
244
- } }, { children: [_jsxs("div", __assign({
230
+ }, children: [(0, jsx_runtime_1.jsxs)("div", {
245
231
  // className="group-hover:bg-black"
246
232
  style: {
247
233
  display: 'flex',
@@ -252,7 +238,7 @@ export default function Dashboard(_a) {
252
238
  // paddingLeft: theme.padding,
253
239
  paddingRight: 25,
254
240
  // paddingTop: theme.padding,
255
- } }, { children: [_jsx("div", __assign({ title: elem.name, style: {
241
+ }, children: [(0, jsx_runtime_1.jsx)("div", { title: elem.name, style: {
256
242
  fontFamily: theme.fontFamily,
257
243
  color: theme.primaryTextColor,
258
244
  boxSizing: 'content-box',
@@ -271,7 +257,7 @@ export default function Dashboard(_a) {
271
257
  display: 'block',
272
258
  maxWidth: '100%',
273
259
  overflow: 'hidden',
274
- } }, { children: elem.name })), onClickDashboardItem ? (_jsx("div", __assign({
260
+ }, children: elem.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", {
275
261
  // className="hover:bg-black"
276
262
  style: {
277
263
  fontFamily: theme.fontFamily,
@@ -284,27 +270,26 @@ export default function Dashboard(_a) {
284
270
  display: 'flex',
285
271
  alignItems: 'center',
286
272
  justifyContent: 'flex-end',
287
- } }, { children: 'view report →' }))) : null] })), _jsx("div", __assign({ style: { padding: 0 } }, { children: _jsx(Chart, { containerStyle: {
273
+ }, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: { padding: 0 }, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
288
274
  display: 'flex',
289
275
  // width: '100%',
290
276
  height: 30,
291
277
  // marginBottom: 50,
292
278
  marginTop: 20,
293
- }, isDateFilter: true, chartId: elem._id, query: elem.queryString }) }))] })) })) })) }), elem.name + '' + index));
294
- }) }))) : null, _jsx("div", __assign({ style: {
279
+ }, dateFilter: true, chartId: elem._id, query: elem.queryString }) })] }) }) }) }, elem.name + '' + index));
280
+ }) })) : null, (0, jsx_runtime_1.jsx)("div", { style: {
295
281
  // width: `100%`,
296
282
  listStyleType: 'none',
297
283
  display: 'grid',
298
284
  gridGap: 25,
299
285
  boxSizing: 'content-box',
300
- gridTemplateColumns: "repeat(auto-fill,minmax(".concat(maxColumnWidth || 400, "px, 1fr))"),
301
- gridTemplateRows: "repeat(auto-fill, ".concat(rowHeight || 400, "px)"),
302
- } }, { children: dashboardSections[section]
303
- .filter(function (elem) { return elem.chartType !== 'metric'; })
304
- .map(function (elem, index) {
305
- var _a;
306
- return (_jsx("div", __assign({ onClick: onClickDashboardItem
307
- ? function () { return handleOnClickDashboardItem(elem._id); }
286
+ gridTemplateColumns: `repeat(auto-fill,minmax(${maxColumnWidth || 400}px, 1fr))`,
287
+ gridTemplateRows: `repeat(auto-fill, ${rowHeight || 400}px)`,
288
+ }, children: dashboardSections[section]
289
+ .filter(elem => elem.chartType !== 'metric')
290
+ .map((elem, index) => {
291
+ return ((0, jsx_runtime_1.jsx)("div", { onClick: onClickDashboardItem
292
+ ? () => handleOnClickDashboardItem(elem._id)
308
293
  : undefined,
309
294
  // onClick={() => handleEditDashboardItem(elem)}
310
295
  // className="qq-shadow"
@@ -320,21 +305,21 @@ export default function Dashboard(_a) {
320
305
  minHeight: rowHeight || 400,
321
306
  borderRadius: 8,
322
307
  paddingTop: 20,
323
- } }, { children: _jsx("div", __assign({ style: {
308
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
324
309
  width: '100%',
325
310
  height: '100%',
326
311
  boxSizing: 'content-box',
327
- } }, { children: _jsx("div", __assign({ style: {
312
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
328
313
  width: '100%',
329
314
  height: '100%',
330
315
  boxSizing: 'content-box',
331
- } }, { children: _jsxs("div", __assign({ style: {
316
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
332
317
  display: 'flex',
333
318
  flexDirection: 'column',
334
319
  justifyContent: 'space-between',
335
320
  height: '100%',
336
321
  boxSizing: 'content-box',
337
- } }, { children: [_jsxs("div", __assign({ style: {
322
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
338
323
  display: 'flex',
339
324
  flexDirection: 'row',
340
325
  justifyContent: 'space-between',
@@ -343,7 +328,7 @@ export default function Dashboard(_a) {
343
328
  // paddingLeft: theme.padding,
344
329
  // paddingRight: theme.padding,
345
330
  // paddingTop: theme.padding,
346
- } }, { children: [_jsx("div", __assign({ style: {
331
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
347
332
  fontFamily: theme.fontFamily,
348
333
  color: theme.primaryTextColor,
349
334
  boxSizing: 'content-box',
@@ -360,7 +345,7 @@ export default function Dashboard(_a) {
360
345
  display: 'block',
361
346
  maxWidth: '100%',
362
347
  overflow: 'hidden',
363
- } }, { children: elem.name })), onClickDashboardItem ? (_jsx("div", __assign({
348
+ }, children: elem.name }), onClickDashboardItem ? ((0, jsx_runtime_1.jsx)("div", {
364
349
  // className="hover:bg-black"
365
350
  style: {
366
351
  fontFamily: theme.fontFamily,
@@ -373,27 +358,27 @@ export default function Dashboard(_a) {
373
358
  display: 'flex',
374
359
  alignItems: 'center',
375
360
  justifyContent: 'flex-end',
376
- } }, { children: 'view report →' }))) : null] })), _jsx("div", __assign({ style: {
361
+ }, children: 'view report →' })) : null] }), (0, jsx_runtime_1.jsx)("div", { style: {
377
362
  padding: 0,
378
363
  height: '100%',
379
364
  boxSizing: 'content-box',
380
- } }, { children: _jsx(Chart, { containerStyle: {
365
+ }, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: {
381
366
  display: 'flex',
382
367
  width: '100%',
383
368
  // TODO: fix fixed height
384
369
  height: 300,
385
370
  marginBottom: 50,
386
371
  marginTop: 30,
387
- }, isDateFilter: true, chartId: elem._id, colors: ((_a = theme.chartColors) === null || _a === void 0 ? void 0 : _a.length)
372
+ }, isDateFilter: true, chartId: elem._id, colors: theme.chartColors?.length
388
373
  ? theme.chartColors
389
- : undefined }) }))] })) })) })) }), elem.name + '' + index));
390
- }) }))] }), section + '' + sectionIndex));
391
- })] })));
374
+ : undefined }) })] }) }) }) }, elem.name + '' + index));
375
+ }) })] }, section + '' + sectionIndex));
376
+ })] }));
392
377
  }
393
- function Filter(_a) {
394
- var _b;
395
- var defaultValue = _a.defaultValue, theme = _a.theme, onValueChange = _a.onValueChange, filter = _a.filter;
396
- var dropdownOptions = [
378
+ exports.default = Dashboard;
379
+ function Filter({ defaultValue, theme, onValueChange, filter }) {
380
+ //should be date as well as strings
381
+ const dropdownOptions = [
397
382
  { value: 'popupbagelsmardens', text: 'popupbagelsmardens' },
398
383
  { value: 'popupbagelswestport', text: 'popupbagelswestport' },
399
384
  { value: 'popupbagelseasthampton', text: 'popupbagelseasthampton' },
@@ -401,23 +386,23 @@ function Filter(_a) {
401
386
  { value: 'popupbagelsredding', text: 'popupbagelsredding' },
402
387
  { value: 'popupbagelsthompson', text: 'popupbagelsthompson' },
403
388
  ];
404
- var dropdownRef = useRef(null);
405
- var _c = useState(false), showDropdown = _c[0], setShowDropdown = _c[1];
406
- var _d = useInternalState(defaultValue, undefined), selectedValue = _d[0], setSelectedValue = _d[1];
407
- var selectedDropdownValue = selectedValue ? (_b = selectedValue[2]) !== null && _b !== void 0 ? _b : null : null;
408
- var handleDropdownOptionClick = function (dropdownValue) {
389
+ const dropdownRef = (0, react_1.useRef)(null);
390
+ const [showDropdown, setShowDropdown] = (0, react_1.useState)(false);
391
+ const [selectedValue, setSelectedValue] = (0, hooks_1.useInternalState)(defaultValue, undefined);
392
+ const selectedDropdownValue = selectedValue ? selectedValue[2] ?? null : null;
393
+ const handleDropdownOptionClick = (dropdownValue) => {
409
394
  setSelectedValue([undefined, undefined, dropdownValue]);
410
- onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange([undefined, undefined, dropdownValue]);
395
+ onValueChange?.([undefined, undefined, dropdownValue]);
411
396
  setShowDropdown(false);
412
397
  };
413
- var _e = useSelectOnKeyDown(handleDropdownOptionClick, dropdownOptions.map(function (option) { return option.value; }), showDropdown, setShowDropdown, selectedDropdownValue), hoveredDropdownValue = _e[0], handleDropdownKeyDown = _e[1];
414
- return (_jsxs("div", __assign({ style: { position: 'relative', width: '100%' } }, { children: [_jsx("div", __assign({ style: {
398
+ const [hoveredDropdownValue, handleDropdownKeyDown] = (0, hooks_1.useSelectOnKeyDown)(handleDropdownOptionClick, dropdownOptions.map((option) => option.value), showDropdown, setShowDropdown, selectedDropdownValue);
399
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
415
400
  marginBottom: 6,
416
401
  fontWeight: '600',
417
402
  color: theme.secondaryTextColor,
418
403
  fontSize: 14,
419
404
  fontFamily: theme.fontFamily,
420
- } }, { children: filter.label })), _jsx(FilterDropdown, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, handleDropdownKeyDown: handleDropdownKeyDown, dropdownRef: dropdownRef, theme: theme, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, field: filter.field, label: filter.labelField }), _jsx(FilterModal, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, dropdownRef: dropdownRef, theme: theme, hoveredDropdownValue: hoveredDropdownValue, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, handleDropdownOptionClick: handleDropdownOptionClick, field: filter.field, label: filter.labelField })] })));
405
+ }, children: filter.label }), (0, jsx_runtime_1.jsx)(FilterDropdown, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, handleDropdownKeyDown: handleDropdownKeyDown, dropdownRef: dropdownRef, theme: theme, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, field: filter.field, label: filter.labelField }), (0, jsx_runtime_1.jsx)(FilterModal, { showDropdown: showDropdown, setShowDropdown: setShowDropdown, dropdownRef: dropdownRef, theme: theme, hoveredDropdownValue: hoveredDropdownValue, selectedDropdownValue: selectedDropdownValue, dropdownOptions: filter.options, handleDropdownOptionClick: handleDropdownOptionClick, field: filter.field, label: filter.labelField })] }));
421
406
  }
422
407
  function removeQuotes(str) {
423
408
  if (str.startsWith('"') && str.endsWith('"')) {
@@ -427,22 +412,21 @@ function removeQuotes(str) {
427
412
  return str;
428
413
  }
429
414
  }
430
- function FilterDropdown(_a) {
431
- var setShowDropdown = _a.setShowDropdown, dropdownRef = _a.dropdownRef, showDropdown = _a.showDropdown, handleDropdownKeyDown = _a.handleDropdownKeyDown, theme = _a.theme, _b = _a.dropdownPlaceholder, dropdownPlaceholder = _b === void 0 ? 'Select' : _b, selectedDropdownValue = _a.selectedDropdownValue, dropdownOptions = _a.dropdownOptions, field = _a.field, label = _a.label;
432
- var dropdownText = selectedDropdownValue
433
- ? String(dropdownOptions.find(function (option) { return option[removeQuotes(field)] === selectedDropdownValue; })[removeQuotes(label)])
415
+ function FilterDropdown({ setShowDropdown, dropdownRef, showDropdown, handleDropdownKeyDown, theme, dropdownPlaceholder = 'Select', selectedDropdownValue, dropdownOptions, field, label, }) {
416
+ const dropdownText = selectedDropdownValue
417
+ ? String(dropdownOptions.find(option => option[removeQuotes(field)] === selectedDropdownValue)[removeQuotes(label)])
434
418
  : dropdownPlaceholder;
435
- return (_jsx("div", __assign({ style: {
419
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
436
420
  display: 'flex',
437
421
  alignItems: 'center',
438
422
  justifyContent: 'space-between',
439
423
  borderRadius: '0.375rem',
440
- background: theme === null || theme === void 0 ? void 0 : theme.backgroundColor,
441
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
424
+ background: theme?.backgroundColor,
425
+ fontFamily: theme?.fontFamily,
442
426
  boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
443
- } }, { children: _jsxs("button", __assign({ type: "button", style: {
427
+ }, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", style: {
444
428
  // fontFamily: theme?.fontFamily,
445
- borderColor: (theme === null || theme === void 0 ? void 0 : theme.borderColor) || '#E5E7EB',
429
+ borderColor: theme?.borderColor || '#E5E7EB',
446
430
  borderStyle: 'solid',
447
431
  borderWidth: 1,
448
432
  cursor: 'pointer',
@@ -459,31 +443,30 @@ function FilterDropdown(_a) {
459
443
  minHeight: 38,
460
444
  justifyContent: 'space-between',
461
445
  alignItems: 'center',
462
- background: theme === null || theme === void 0 ? void 0 : theme.backgroundColor,
463
- fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
446
+ background: theme?.backgroundColor,
447
+ fontSize: theme?.fontSizeSmall || '0.875rem',
464
448
  // fontWeight: theme?.fontWeightMedium || '800',
465
- }, ref: dropdownRef, onClick: function () { return setShowDropdown(!showDropdown); }, onKeyDown: handleDropdownKeyDown }, { children: [_jsx("p", __assign({ style: {
449
+ }, ref: dropdownRef, onClick: () => setShowDropdown(!showDropdown), onKeyDown: handleDropdownKeyDown, children: [(0, jsx_runtime_1.jsx)("p", { style: {
466
450
  margin: 0,
467
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
468
- color: (theme === null || theme === void 0 ? void 0 : theme.primaryTextColor) || '#364153',
451
+ fontFamily: theme?.fontFamily,
452
+ color: theme?.primaryTextColor || '#364153',
469
453
  overflow: 'hidden',
470
454
  textOverflow: 'ellipsis',
471
455
  whiteSpace: 'nowrap',
472
- fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
473
- fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
474
- } }, { children: dropdownText })), _jsx(ArrowDownHeadIcon, { style: {
456
+ fontWeight: theme?.fontWeightMedium || '500',
457
+ fontSize: theme?.fontSizeSmall || '0.875rem',
458
+ }, children: dropdownText }), (0, jsx_runtime_1.jsx)(assets_1.ArrowDownHeadIcon, { style: {
475
459
  height: '1.25rem',
476
460
  width: '1.25rem',
477
461
  flex: 'none',
478
- color: theme === null || theme === void 0 ? void 0 : theme.secondaryTextColor,
462
+ color: theme?.secondaryTextColor,
479
463
  marginRight: '-0.25rem',
480
- }, "aria-hidden": "true" })] })) })));
464
+ }, "aria-hidden": "true" })] }) }));
481
465
  }
482
- function FilterModal(_a) {
483
- var setShowDropdown = _a.setShowDropdown, dropdownRef = _a.dropdownRef, showDropdown = _a.showDropdown, theme = _a.theme, selectedDropdownValue = _a.selectedDropdownValue, hoveredDropdownValue = _a.hoveredDropdownValue, dropdownOptions = _a.dropdownOptions, handleDropdownOptionClick = _a.handleDropdownOptionClick, field = _a.field, label = _a.label;
484
- return (_jsx(Modal, __assign({ showModal: showDropdown, setShowModal: setShowDropdown, parentRef: dropdownRef, theme: theme }, { children: _jsx(SelectedValueContext.Provider, __assign({ value: {
466
+ function FilterModal({ setShowDropdown, dropdownRef, showDropdown, theme, selectedDropdownValue, hoveredDropdownValue, dropdownOptions, handleDropdownOptionClick, field, label, }) {
467
+ return ((0, jsx_runtime_1.jsx)(Modal_1.default, { showModal: showDropdown, setShowModal: setShowDropdown, parentRef: dropdownRef, theme: theme, children: (0, jsx_runtime_1.jsx)(contexts_1.SelectedValueContext.Provider, { value: {
485
468
  selectedValue: selectedDropdownValue,
486
469
  handleValueChange: handleDropdownOptionClick,
487
- } }, { children: _jsx(HoveredValueContext.Provider, __assign({ value: { hoveredValue: hoveredDropdownValue } }, { children: dropdownOptions.map(function (row, index) { return (_jsx(DropdownItem, { value: row[removeQuotes(field)], text: row[removeQuotes(label)], theme: theme, lastItem: dropdownOptions.length - 1 === index }, row[removeQuotes(field)])); }) })) })) })));
470
+ }, children: (0, jsx_runtime_1.jsx)(contexts_1.HoveredValueContext.Provider, { value: { hoveredValue: hoveredDropdownValue }, children: dropdownOptions.map((row, index) => ((0, jsx_runtime_1.jsx)(Dropdown_1.DropdownItem, { value: row[removeQuotes(field)], text: row[removeQuotes(label)], theme: theme, lastItem: dropdownOptions.length - 1 === index }, row[removeQuotes(field)]))) }) }) }));
488
471
  }
489
472
  //# sourceMappingURL=Dashboard.js.map