@quillsql/react 2.11.16 → 2.11.17

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 (203) hide show
  1. package/dist/cjs/Chart.d.ts +117 -42
  2. package/dist/cjs/Chart.d.ts.map +1 -1
  3. package/dist/cjs/Chart.js +44 -18
  4. package/dist/cjs/ChartBuilder.d.ts +194 -30
  5. package/dist/cjs/ChartBuilder.d.ts.map +1 -1
  6. package/dist/cjs/ChartBuilder.js +122 -62
  7. package/dist/cjs/ChartEditor.d.ts +114 -18
  8. package/dist/cjs/ChartEditor.d.ts.map +1 -1
  9. package/dist/cjs/ChartEditor.js +47 -15
  10. package/dist/cjs/Dashboard.d.ts +148 -91
  11. package/dist/cjs/Dashboard.d.ts.map +1 -1
  12. package/dist/cjs/Dashboard.js +46 -152
  13. package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
  14. package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
  15. package/dist/cjs/DateRangePicker/QuillDateRangePicker.js +5 -2
  16. package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +1 -1
  17. package/dist/cjs/QuillProvider.d.ts +105 -2
  18. package/dist/cjs/QuillProvider.d.ts.map +1 -1
  19. package/dist/cjs/QuillProvider.js +59 -0
  20. package/dist/cjs/ReportBuilder.d.ts +188 -42
  21. package/dist/cjs/ReportBuilder.d.ts.map +1 -1
  22. package/dist/cjs/ReportBuilder.js +466 -394
  23. package/dist/cjs/SQLEditor.d.ts +158 -23
  24. package/dist/cjs/SQLEditor.d.ts.map +1 -1
  25. package/dist/cjs/SQLEditor.js +35 -30
  26. package/dist/cjs/Table.d.ts +119 -15
  27. package/dist/cjs/Table.d.ts.map +1 -1
  28. package/dist/cjs/Table.js +37 -6
  29. package/dist/cjs/TableChart.d.ts.map +1 -1
  30. package/dist/cjs/TableChart.js +0 -194
  31. package/dist/cjs/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
  32. package/dist/cjs/components/Chart/BarList.d.ts.map +1 -0
  33. package/dist/cjs/{BarList.js → components/Chart/BarList.js} +1 -1
  34. package/dist/cjs/components/Chart/LineChart.d.ts +2 -3
  35. package/dist/cjs/components/Chart/LineChart.d.ts.map +1 -1
  36. package/dist/cjs/components/Chart/LineChart.js +3 -3
  37. package/dist/cjs/components/Chart/PieChart.d.ts.map +1 -0
  38. package/dist/cjs/{PieChart.js → components/Chart/PieChart.js} +1 -1
  39. package/dist/cjs/components/Dashboard/ChartComponent.d.ts +2 -1
  40. package/dist/cjs/components/Dashboard/ChartComponent.d.ts.map +1 -1
  41. package/dist/cjs/components/Dashboard/ChartComponent.js +6 -7
  42. package/dist/cjs/components/Dashboard/DashboardFilter.d.ts +22 -0
  43. package/dist/cjs/components/Dashboard/DashboardFilter.d.ts.map +1 -0
  44. package/dist/cjs/components/Dashboard/DashboardFilter.js +75 -0
  45. package/dist/cjs/components/Dashboard/DataLoader.d.ts +1 -1
  46. package/dist/cjs/components/Dashboard/DataLoader.d.ts.map +1 -1
  47. package/dist/cjs/components/Dashboard/DataLoader.js +1 -1
  48. package/dist/cjs/components/Dashboard/MetricComponent.d.ts +2 -12
  49. package/dist/cjs/components/Dashboard/MetricComponent.d.ts.map +1 -1
  50. package/dist/cjs/components/Dashboard/MetricComponent.js +39 -17
  51. package/dist/cjs/components/Dashboard/TableComponent.d.ts +2 -1
  52. package/dist/cjs/components/Dashboard/TableComponent.d.ts.map +1 -1
  53. package/dist/cjs/components/Dashboard/TableComponent.js +6 -9
  54. package/dist/cjs/components/QuillSelect.d.ts +4 -1
  55. package/dist/cjs/components/QuillSelect.d.ts.map +1 -1
  56. package/dist/cjs/components/QuillSelect.js +13 -8
  57. package/dist/cjs/components/QuillTable.d.ts +16 -2
  58. package/dist/cjs/components/QuillTable.d.ts.map +1 -1
  59. package/dist/cjs/components/QuillTable.js +4 -4
  60. package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
  61. package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  62. package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +8 -6
  63. package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
  64. package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
  65. package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +4 -14
  66. package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts +21 -1
  67. package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
  68. package/dist/cjs/components/ReportBuilder/AddSortPopover.js +15 -17
  69. package/dist/cjs/components/ReportBuilder/bigDateMap.js +1 -1
  70. package/dist/cjs/components/ReportBuilder/convert.d.ts +2 -1
  71. package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
  72. package/dist/cjs/components/ReportBuilder/convert.js +40 -20
  73. package/dist/cjs/components/ReportBuilder/pivot.d.ts +2 -1
  74. package/dist/cjs/components/ReportBuilder/pivot.d.ts.map +1 -1
  75. package/dist/cjs/components/ReportBuilder/ui.d.ts +83 -18
  76. package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
  77. package/dist/cjs/components/ReportBuilder/ui.js +52 -100
  78. package/dist/cjs/components/ReportBuilder/util.d.ts +2 -1
  79. package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
  80. package/dist/cjs/components/ReportBuilder/util.js +16 -9
  81. package/dist/cjs/components/UiComponents.d.ts +86 -86
  82. package/dist/cjs/components/UiComponents.d.ts.map +1 -1
  83. package/dist/cjs/components/UiComponents.js +118 -103
  84. package/dist/cjs/hooks/index.d.ts +1 -0
  85. package/dist/cjs/hooks/index.d.ts.map +1 -1
  86. package/dist/cjs/hooks/index.js +3 -1
  87. package/dist/cjs/hooks/useTheme.d.ts +7 -0
  88. package/dist/cjs/hooks/useTheme.d.ts.map +1 -0
  89. package/dist/cjs/hooks/useTheme.js +12 -0
  90. package/dist/cjs/index.d.ts +10 -2
  91. package/dist/cjs/index.d.ts.map +1 -1
  92. package/dist/cjs/internals/ReportBuilder/PivotList.d.ts.map +1 -1
  93. package/dist/cjs/internals/ReportBuilder/PivotList.js +10 -10
  94. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +29 -14
  95. package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
  96. package/dist/cjs/internals/ReportBuilder/PivotModal.js +73 -49
  97. package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
  98. package/dist/cjs/utils/dataFetcher.js +2 -0
  99. package/dist/esm/Chart.d.ts +117 -42
  100. package/dist/esm/Chart.d.ts.map +1 -1
  101. package/dist/esm/Chart.js +45 -19
  102. package/dist/esm/ChartBuilder.d.ts +194 -30
  103. package/dist/esm/ChartBuilder.d.ts.map +1 -1
  104. package/dist/esm/ChartBuilder.js +122 -62
  105. package/dist/esm/ChartEditor.d.ts +114 -18
  106. package/dist/esm/ChartEditor.d.ts.map +1 -1
  107. package/dist/esm/ChartEditor.js +51 -19
  108. package/dist/esm/Dashboard.d.ts +148 -91
  109. package/dist/esm/Dashboard.d.ts.map +1 -1
  110. package/dist/esm/Dashboard.js +49 -153
  111. package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
  112. package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
  113. package/dist/esm/DateRangePicker/QuillDateRangePicker.js +6 -3
  114. package/dist/esm/DateRangePicker/dateRangePickerUtils.js +1 -1
  115. package/dist/esm/QuillProvider.d.ts +105 -2
  116. package/dist/esm/QuillProvider.d.ts.map +1 -1
  117. package/dist/esm/QuillProvider.js +59 -0
  118. package/dist/esm/ReportBuilder.d.ts +188 -42
  119. package/dist/esm/ReportBuilder.d.ts.map +1 -1
  120. package/dist/esm/ReportBuilder.js +468 -396
  121. package/dist/esm/SQLEditor.d.ts +158 -23
  122. package/dist/esm/SQLEditor.d.ts.map +1 -1
  123. package/dist/esm/SQLEditor.js +35 -30
  124. package/dist/esm/Table.d.ts +119 -15
  125. package/dist/esm/Table.d.ts.map +1 -1
  126. package/dist/esm/Table.js +38 -7
  127. package/dist/esm/TableChart.d.ts.map +1 -1
  128. package/dist/esm/TableChart.js +0 -194
  129. package/dist/esm/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
  130. package/dist/esm/components/Chart/BarList.d.ts.map +1 -0
  131. package/dist/esm/{BarList.js → components/Chart/BarList.js} +1 -1
  132. package/dist/esm/components/Chart/LineChart.d.ts +2 -3
  133. package/dist/esm/components/Chart/LineChart.d.ts.map +1 -1
  134. package/dist/esm/components/Chart/LineChart.js +3 -3
  135. package/dist/esm/components/Chart/PieChart.d.ts.map +1 -0
  136. package/dist/esm/{PieChart.js → components/Chart/PieChart.js} +1 -1
  137. package/dist/esm/components/Dashboard/ChartComponent.d.ts +2 -1
  138. package/dist/esm/components/Dashboard/ChartComponent.d.ts.map +1 -1
  139. package/dist/esm/components/Dashboard/ChartComponent.js +5 -6
  140. package/dist/esm/components/Dashboard/DashboardFilter.d.ts +22 -0
  141. package/dist/esm/components/Dashboard/DashboardFilter.d.ts.map +1 -0
  142. package/dist/esm/components/Dashboard/DashboardFilter.js +71 -0
  143. package/dist/esm/components/Dashboard/DataLoader.d.ts +1 -1
  144. package/dist/esm/components/Dashboard/DataLoader.d.ts.map +1 -1
  145. package/dist/esm/components/Dashboard/DataLoader.js +1 -1
  146. package/dist/esm/components/Dashboard/MetricComponent.d.ts +2 -12
  147. package/dist/esm/components/Dashboard/MetricComponent.d.ts.map +1 -1
  148. package/dist/esm/components/Dashboard/MetricComponent.js +39 -17
  149. package/dist/esm/components/Dashboard/TableComponent.d.ts +2 -1
  150. package/dist/esm/components/Dashboard/TableComponent.d.ts.map +1 -1
  151. package/dist/esm/components/Dashboard/TableComponent.js +6 -9
  152. package/dist/esm/components/QuillSelect.d.ts +4 -1
  153. package/dist/esm/components/QuillSelect.d.ts.map +1 -1
  154. package/dist/esm/components/QuillSelect.js +14 -9
  155. package/dist/esm/components/QuillTable.d.ts +16 -2
  156. package/dist/esm/components/QuillTable.d.ts.map +1 -1
  157. package/dist/esm/components/QuillTable.js +4 -4
  158. package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
  159. package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
  160. package/dist/esm/components/ReportBuilder/AddColumnPopover.js +8 -6
  161. package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
  162. package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
  163. package/dist/esm/components/ReportBuilder/AddLimitPopover.js +4 -14
  164. package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts +21 -1
  165. package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
  166. package/dist/esm/components/ReportBuilder/AddSortPopover.js +17 -19
  167. package/dist/esm/components/ReportBuilder/bigDateMap.js +1 -1
  168. package/dist/esm/components/ReportBuilder/convert.d.ts +2 -1
  169. package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
  170. package/dist/esm/components/ReportBuilder/convert.js +33 -13
  171. package/dist/esm/components/ReportBuilder/pivot.d.ts +2 -1
  172. package/dist/esm/components/ReportBuilder/pivot.d.ts.map +1 -1
  173. package/dist/esm/components/ReportBuilder/ui.d.ts +83 -18
  174. package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
  175. package/dist/esm/components/ReportBuilder/ui.js +50 -98
  176. package/dist/esm/components/ReportBuilder/util.d.ts +2 -1
  177. package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
  178. package/dist/esm/components/ReportBuilder/util.js +14 -8
  179. package/dist/esm/components/UiComponents.d.ts +86 -86
  180. package/dist/esm/components/UiComponents.d.ts.map +1 -1
  181. package/dist/esm/components/UiComponents.js +111 -101
  182. package/dist/esm/hooks/index.d.ts +1 -0
  183. package/dist/esm/hooks/index.d.ts.map +1 -1
  184. package/dist/esm/hooks/index.js +1 -0
  185. package/dist/esm/hooks/useTheme.d.ts +7 -0
  186. package/dist/esm/hooks/useTheme.d.ts.map +1 -0
  187. package/dist/esm/hooks/useTheme.js +10 -0
  188. package/dist/esm/index.d.ts +10 -2
  189. package/dist/esm/index.d.ts.map +1 -1
  190. package/dist/esm/internals/ReportBuilder/PivotList.d.ts.map +1 -1
  191. package/dist/esm/internals/ReportBuilder/PivotList.js +10 -10
  192. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +29 -14
  193. package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
  194. package/dist/esm/internals/ReportBuilder/PivotModal.js +73 -49
  195. package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
  196. package/dist/esm/utils/dataFetcher.js +2 -0
  197. package/package.json +1 -1
  198. package/dist/cjs/BarList.d.ts.map +0 -1
  199. package/dist/cjs/PieChart.d.ts.map +0 -1
  200. package/dist/esm/BarList.d.ts.map +0 -1
  201. package/dist/esm/PieChart.d.ts.map +0 -1
  202. /package/dist/cjs/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
  203. /package/dist/esm/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
@@ -3,13 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DashboardFilter = void 0;
7
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
+ /* eslint-disable no-unused-vars */
8
8
  const react_1 = require("react");
9
9
  const Chart_1 = __importDefault(require("./Chart"));
10
10
  const dateRangePickerUtils_1 = require("./DateRangePicker/dateRangePickerUtils");
11
11
  const Context_1 = require("./Context");
12
- const assets_1 = require("./assets");
13
12
  const useDashboard_1 = require("./hooks/useDashboard");
14
13
  const crypto_1 = require("./utils/crypto");
15
14
  const DashboardSectionContainer_1 = __importDefault(require("./components/Dashboard/DashboardSectionContainer"));
@@ -21,138 +20,8 @@ const styles_1 = require("./utils/styles");
21
20
  const dashboard_1 = require("./utils/dashboard");
22
21
  const QuillDateRangePicker_1 = require("./DateRangePicker/QuillDateRangePicker");
23
22
  const DataLoader_1 = __importDefault(require("./components/Dashboard/DataLoader"));
24
- const QuillSelect_1 = require("./components/QuillSelect");
25
- const ChartSkeleton_1 = __importDefault(require("./components/Chart/ChartSkeleton"));
26
- function DashboardFilter({ filter, onChangeFilter, SelectComponent = QuillSelect_1.QuillSelectComponent, DateRangePickerComponent, theme, }) {
27
- const { comparisonRange, setComparisonRange } = (0, Context_1.useComparisonRange)();
28
- const { setDateFilter } = (0, Context_1.useDateFilter)();
29
- const [filterValue, setFilterValue] = (0, react_1.useState)(null);
30
- (0, react_1.useEffect)(() => {
31
- if (filter.filterType === 'string') {
32
- setFilterValue(filter.selectedValue);
33
- }
34
- if (filter.filterType == 'date_range') {
35
- setDateFilter(filter.preset.label);
36
- if (filter?.comparisonRange?.value) {
37
- const newComparisonRange = dateRangePickerUtils_1.COMPARISON_OPTIONS.find((option) => {
38
- return option.value === filter.comparisonRange.value;
39
- });
40
- setComparisonRange(newComparisonRange);
41
- }
42
- else {
43
- setComparisonRange(null);
44
- }
45
- }
46
- }, [filter]);
47
- if (filter.filterType === 'string') {
48
- return ((0, jsx_runtime_1.jsx)(SelectComponent, { theme: theme, label: filter.label, value: filterValue, onChange: (e) => {
49
- onChangeFilter(filter, e);
50
- }, options: [
51
- ...filter.options.map((elem) => {
52
- return {
53
- label: elem[filter.labelField],
54
- value: elem[filter.field],
55
- };
56
- }),
57
- ] }));
58
- }
59
- if (filter.filterType == 'date_range') {
60
- return ((0, jsx_runtime_1.jsxs)("div", { style: {
61
- display: 'flex',
62
- flexDirection: 'row',
63
- alignItems: 'flex-end',
64
- }, children: [(0, jsx_runtime_1.jsx)(DateRangePickerComponent, { label: filter.label, dateRange: { startDate: filter.startDate, endDate: filter.endDate }, preset: filter.preset.label, onChangeDateRange: (value) => {
65
- onChangeFilter(filter, {
66
- startDate: value.startDate,
67
- endDate: value.endDate,
68
- });
69
- }, onChangePreset: (value) => {
70
- onChangeFilter(filter, { preset: value });
71
- }, presetOptions: filter.options.map((option) => {
72
- return { label: option.label, value: option.label };
73
- }) }), comparisonRange && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: {
74
- display: 'flex',
75
- flexDirection: 'row',
76
- alignItems: 'center',
77
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
78
- paddingLeft: 16,
79
- paddingRight: 12,
80
- color: theme?.secondaryTextColor,
81
- fontFamily: theme?.fontFamily,
82
- fontSize: 14,
83
- display: 'flex',
84
- alignItems: 'center',
85
- flex: 1,
86
- minWidth: 80,
87
- justifyContent: 'center',
88
- }, children: "compared to" }), (0, jsx_runtime_1.jsx)(SelectComponent, { theme: theme, value: comparisonRange.value, onChange: (e) => {
89
- onChangeFilter(filter, null, dateRangePickerUtils_1.COMPARISON_OPTIONS.find((option) => {
90
- return option.value === e;
91
- }));
92
- }, options: dateRangePickerUtils_1.COMPARISON_OPTIONS.map((compareOption) => {
93
- return {
94
- value: compareOption.value,
95
- label: compareOption.text,
96
- };
97
- }) })] }) }))] }));
98
- }
99
- return null;
100
- }
101
- exports.DashboardFilter = DashboardFilter;
102
- const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
103
- const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
104
- const handleOnChange = (0, react_1.useCallback)((event) => {
105
- onChange(event.target.value);
106
- }, [onChange]);
107
- return ((0, jsx_runtime_1.jsxs)("div", { children: [label && ((0, jsx_runtime_1.jsx)("div", { style: {
108
- marginBottom: 6,
109
- fontWeight: theme.labelFontWeight || '600',
110
- color: theme.secondaryTextColor,
111
- fontFamily: theme.fontFamily,
112
- fontSize: 14,
113
- }, children: label })), (0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', height: 38 }, children: [(0, jsx_runtime_1.jsxs)("select", { onChange: handleOnChange, value: value ?? '', id: 'reportbuilderdropdown',
114
- // defaultValue="Select"
115
- style: {
116
- width: '100%',
117
- WebkitAppearance: 'none',
118
- minWidth: 230,
119
- outline: 'none',
120
- textAlign: 'left',
121
- whiteSpace: 'nowrap',
122
- overflow: 'hidden',
123
- textOverflow: 'ellipsis',
124
- borderRadius: 6,
125
- paddingLeft: 12,
126
- paddingRight: 12,
127
- height: 38,
128
- borderWidth: theme.borderWidth,
129
- borderColor: theme.borderColor,
130
- background: theme.backgroundColor,
131
- color: theme.primaryTextColor,
132
- boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
133
- fontFamily: theme.fontFamily,
134
- fontSize: 14,
135
- fontWeight: 500,
136
- boxSizing: 'border-box',
137
- }, children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: "Select" }), options.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.value, children: option.label }, option.label + index)))] }), (0, jsx_runtime_1.jsx)(assets_1.ArrowDownHeadIcon, { style: {
138
- height: '20px',
139
- width: '20px',
140
- flex: 'none',
141
- position: 'absolute',
142
- right: 8,
143
- top: 9,
144
- color: theme?.secondaryTextColor,
145
- }, "aria-hidden": "true" })] })] }));
146
- };
147
- const MemoizedDropdown = (0, react_1.memo)(QuillDropdownComponent);
148
- const areEqual = (prevProps, nextProps) => {
149
- // This function returns true if passing nextProps to render would return
150
- // the same result as passing prevProps to render, otherwise it returns false
151
- return (prevProps.dateRange.startDate === nextProps.dateRange.startDate &&
152
- prevProps.dateRange.endDate === nextProps.dateRange.endDate);
153
- };
154
- const MemoizedDateRangePicker = (0, react_1.memo)(QuillDateRangePicker_1.QuillDateRangePicker, areEqual);
155
- const QuillEmptyDashboardComponent = () => (0, jsx_runtime_1.jsx)("div", {});
23
+ const UiComponents_1 = require("./components/UiComponents");
24
+ const DashboardFilter_1 = require("./components/Dashboard/DashboardFilter");
156
25
  const defaultChartContainerStyles = {
157
26
  display: 'flex',
158
27
  width: '100%',
@@ -160,10 +29,37 @@ const defaultChartContainerStyles = {
160
29
  height: 300,
161
30
  };
162
31
  /**
163
- * Quill Dashboard.
32
+ * ### Quill Dashboard
33
+ *
34
+ * Dynamically displays a filterable grid of charts, metrics, and tables with
35
+ * live data from your database. Once implemented, Quill lets you perform
36
+ * zero-downtime, zero-code updates to your dashboard views on an org-level as
37
+ * well as company-wide.
38
+ *
39
+ * @example
40
+ * ```js
41
+ * // Usage without custom components
42
+ * <Dashboard />
43
+ * ```
44
+ *
45
+ * @example
46
+ * ```js
47
+ * // You can also pass your own components
48
+ * <Dashboard
49
+ * name="saved_reports"
50
+ * SelectComponent={MySelect}
51
+ * onClickDashboardItem={(item) => navigate(`/detail/${item.id}`)}
52
+ * MetricComponent={MyMetric}
53
+ * ChartComponent={MyChart}
54
+ * TableComponent={MyTable}
55
+ * containerStyle={{ backgroundColor: 'white', padding: '10px' }}
56
+ * />
57
+ * ```
58
+ *
59
+ * ### API Reference
60
+ * @see https://docs.quillsql.com/components/dashboard
164
61
  */
165
- function Dashboard({ name, containerStyle, chartContainerStyle = defaultChartContainerStyles, metricContainerStyle, maxColumnWidth, rowHeight, onClickDashboardItem, hideFilters, dateRangeFilterDisabled = false, SelectComponent, EmptyDashboardComponent = QuillEmptyDashboardComponent, DateRangePickerComponent, FilterButtonComponent, FilterModalComponent, onChangeLoading, MetricComponent = MetricComponent_1.default, ChartComponent = ChartComponent_1.default, TableComponent = TableComponent_1.default, SkeletonComponent = ChartSkeleton_1.default, DashboardSectionContainerComponent = DashboardSectionContainer_1.default, DashboardSectionComponent = DashboardSection_1.default, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, dashedComparison = false, singlePointStyle = 'dot', }) {
166
- const { dateFilter } = (0, Context_1.useDateFilter)();
62
+ function Dashboard({ name, SelectComponent = UiComponents_1.QuillDropdownComponent, EmptyDashboardComponent = UiComponents_1.QuillEmptyDashboardComponent, DateRangePickerComponent = QuillDateRangePicker_1.QuillDateRangePicker, MetricComponent = MetricComponent_1.default, ChartComponent = ChartComponent_1.default, TableComponent = TableComponent_1.default, DashboardSectionComponent = DashboardSection_1.default, DashboardSectionContainerComponent = DashboardSectionContainer_1.default, onClickDashboardItem, onChangeLoading, hideFilters, hideDateRangeFilter = false, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, comparisonLineStyle = 'solid', containerStyle, className, chartContainerStyle = defaultChartContainerStyles, }) {
167
63
  const { dispatch } = (0, react_1.useContext)(Context_1.DashboardContext);
168
64
  const { isLoading: isDataLoading, data, reload, } = (0, useDashboard_1.useDashboard)(name);
169
65
  const [dashboardSections, setDashboardSections] = (0, react_1.useState)(null);
@@ -424,16 +320,16 @@ function Dashboard({ name, containerStyle, chartContainerStyle = defaultChartCon
424
320
  return (0, jsx_runtime_1.jsx)(EmptyDashboardComponent, {});
425
321
  const sortByOrdering = (a, b) => {
426
322
  if (a.order === undefined && b.order === undefined)
427
- return 0; // both items don't have the 'order' field
323
+ return 0;
428
324
  if (a.order === undefined)
429
- return 1; // only 'a' doesn't have the 'order' field, place 'a' last
325
+ return 1;
430
326
  if (b.order === undefined)
431
- return -1; // only 'b' doesn't have the 'order' field, place 'b' last
432
- return a.order - b.order; // both items have the 'order' field, sort numerically
327
+ return -1;
328
+ return a.order - b.order;
433
329
  };
434
330
  const sortedFilters = Object.values(dashboardFilters)
435
331
  .sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
436
- .filter((f) => !dateRangeFilterDisabled || f.filterType !== 'date_range');
332
+ .filter((f) => !hideDateRangeFilter || f.filterType !== 'date_range');
437
333
  const metrics = (section) => dashboardSections[section]
438
334
  .filter(({ chartType }) => chartType === 'metric')
439
335
  .sort(sortByOrdering);
@@ -443,7 +339,7 @@ function Dashboard({ name, containerStyle, chartContainerStyle = defaultChartCon
443
339
  const tables = (section) => dashboardSections[section]
444
340
  .filter(({ chartType }) => chartType === 'table')
445
341
  .sort(sortByOrdering);
446
- return ((0, jsx_runtime_1.jsxs)("div", { ...(0, styles_1.styleToProps)(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
342
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className, ...(0, styles_1.styleToProps)(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
447
343
  display: 'flex',
448
344
  boxSizing: 'content-box',
449
345
  flexDirection: 'row',
@@ -455,9 +351,7 @@ function Dashboard({ name, containerStyle, chartContainerStyle = defaultChartCon
455
351
  flexDirection: 'row',
456
352
  alignItems: 'center',
457
353
  gap: 12,
458
- }, children: sortedFilters.map((filter, index) => ((0, jsx_runtime_1.jsx)(DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent ? SelectComponent : MemoizedDropdown, DateRangePickerComponent: DateRangePickerComponent
459
- ? DateRangePickerComponent
460
- : MemoizedDateRangePicker }, index))) }) })), Object.keys(dashboardSections)
354
+ }, children: sortedFilters.map((filter, index) => ((0, jsx_runtime_1.jsx)(DashboardFilter_1.DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent, DateRangePickerComponent: DateRangePickerComponent }, index))) }) })), Object.keys(dashboardSections)
461
355
  .sort(function (a, b) {
462
356
  return a.length - b.length;
463
357
  })
@@ -471,16 +365,16 @@ function Dashboard({ name, containerStyle, chartContainerStyle = defaultChartCon
471
365
  textAlign: 'left',
472
366
  marginTop: 12,
473
367
  }, children: section })] })), metrics(section).length > 0 && ((0, jsx_runtime_1.jsx)(DashboardSectionComponent, { section: "metrics", children: metrics(section).map((item, index) => {
474
- return ((0, jsx_runtime_1.jsx)(DataLoader_1.default, { id: item._id, children: ({ isLoading, error }) => ((0, jsx_runtime_1.jsx)(MetricComponent, { theme: theme, error: error, isLoading: isLoading, dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), onClickDashboardItem: onClickDashboardItem
368
+ return ((0, jsx_runtime_1.jsx)(DataLoader_1.default, { id: item._id, children: ({ isLoading, error }) => ((0, jsx_runtime_1.jsx)(MetricComponent, { error: error, isLoading: isLoading, dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), onClick: onClickDashboardItem
475
369
  ? () => handleOnClickDashboardItem(item)
476
- : void null }, item.name + '' + index)) }, `${item.name}${index}`));
477
- }) })), charts(section).length > 0 && ((0, jsx_runtime_1.jsx)(DashboardSectionComponent, { section: "charts", children: charts(section).map((item, index) => ((0, jsx_runtime_1.jsx)(ChartComponent, { theme: theme, dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), onClickDashboardItem: onClickDashboardItem
370
+ : undefined }, item.name + '' + index)) }, `${item.name}${index}`));
371
+ }) })), charts(section).length > 0 && ((0, jsx_runtime_1.jsx)(DashboardSectionComponent, { section: "charts", children: charts(section).map((item, index) => ((0, jsx_runtime_1.jsx)(ChartComponent, { dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), onClick: onClickDashboardItem
478
372
  ? () => handleOnClickDashboardItem(item)
479
- : void null, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: chartContainerStyle, chartId: item._id, colors: theme.chartColors?.length
373
+ : undefined, children: (0, jsx_runtime_1.jsx)(Chart_1.default, { containerStyle: chartContainerStyle, chartId: item._id, colors: theme.chartColors?.length
480
374
  ? theme.chartColors
481
- : undefined, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, dashedComparison: dashedComparison, singlePointStyle: singlePointStyle }) }, item.name + '' + index))) })), tables(section).length > 0 && ((0, jsx_runtime_1.jsx)(DashboardSectionComponent, { section: "tables", children: tables(section).map((item, index) => ((0, jsx_runtime_1.jsx)(DataLoader_1.default, { id: item._id, children: ({ isLoading, error }) => ((0, jsx_runtime_1.jsx)(TableComponent, { theme: theme, dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), isLoading: isLoading, error: error, onClickDashboardItem: onClickDashboardItem
375
+ : undefined, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, comparisonLineStyle: comparisonLineStyle }) }, item.name + '' + index))) })), tables(section).length > 0 && ((0, jsx_runtime_1.jsx)(DashboardSectionComponent, { section: "tables", children: tables(section).map((item, index) => ((0, jsx_runtime_1.jsx)(DataLoader_1.default, { id: item._id, children: ({ isLoading, error }) => ((0, jsx_runtime_1.jsx)(TableComponent, { dashboardItem: (0, dashboard_1.cleanDashboardItem)(dashboard[item._id] ?? item, dashboardFilters), isLoading: isLoading, error: error, onClick: onClickDashboardItem
482
376
  ? () => handleOnClickDashboardItem(item)
483
- : void null })) }, `${item.name}${index}`))) }))] }, section + '' + sectionIndex));
377
+ : undefined })) }, `${item.name}${index}`))) }))] }, section + '' + sectionIndex));
484
378
  })] }));
485
379
  }
486
380
  exports.default = Dashboard;
@@ -1,3 +1,23 @@
1
- import { DateRangePickerComponentProps } from '../Dashboard';
1
+ import { ChangeEvent } from 'react';
2
+ export interface DateRangePickerComponentProps {
3
+ preset: string;
4
+ label?: string;
5
+ dateRange: {
6
+ startDate: Date;
7
+ endDate: Date;
8
+ };
9
+ presetOptions: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ onChangeDateRange: ({ startDate, endDate, }: {
14
+ startDate: Date;
15
+ endDate: Date;
16
+ }) => void;
17
+ onChangePreset: (event: ChangeEvent<HTMLSelectElement>) => void;
18
+ }
19
+ /**
20
+ * The fallback date range picked used in <Dashboard/>.
21
+ */
2
22
  export declare function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }: DateRangePickerComponentProps): import("react/jsx-runtime").JSX.Element;
3
23
  //# sourceMappingURL=QuillDateRangePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuillDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/QuillDateRangePicker.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAK7D,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,MAAM,EACN,KAAK,GACN,EAAE,6BAA6B,2CA+H/B"}
1
+ {"version":3,"file":"QuillDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/QuillDateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAqBf,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE;QAAE,SAAS,EAAE,IAAI,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE,CAAC;IAC9C,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,iBAAiB,EAAE,CAAC,EAClB,SAAS,EACT,OAAO,GACR,EAAE;QACD,SAAS,EAAE,IAAI,CAAC;QAChB,OAAO,EAAE,IAAI,CAAC;KACf,KAAK,IAAI,CAAC;IACX,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,MAAM,EACN,KAAK,GACN,EAAE,6BAA6B,2CA8H/B"}
@@ -7,6 +7,9 @@ const date_fns_1 = require("date-fns");
7
7
  const Context_1 = require("../Context");
8
8
  const hooks_1 = require("../hooks");
9
9
  const QuillSelect_1 = require("../components/QuillSelect");
10
+ /**
11
+ * The fallback date range picked used in <Dashboard/>.
12
+ */
10
13
  function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }) {
11
14
  const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
12
15
  const [anchorStartDate, setAnchorStartDate] = (0, react_1.useState)(getAnchorStartDate(dateRange.startDate, dateRange.endDate));
@@ -57,8 +60,8 @@ function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onC
57
60
  value: option.label,
58
61
  })), value: localPreset.label || '', onChange: (e) => {
59
62
  onChangePreset(e);
60
- setLocalPreset({ label: e });
61
- }, theme: theme })] }));
63
+ setLocalPreset({ label: e.target.value });
64
+ } })] }));
62
65
  }
63
66
  exports.QuillDateRangePicker = QuillDateRangePicker;
64
67
  function CalendarRow({ theme, anchorStartDate, anchorEndDate, setAnchorStartDate, setAnchorEndDate, localStartDate, localEndDate, setLocalStartDate, setLocalEndDate, updateDateFilter, setLocalPreset, setShowModal, }) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatSelectedDates = exports.displaySelected = exports.getDateStyles = exports.getRangeFromPresetOptions = exports.getRangeFromPreset = exports.reportBuilderOptions = exports.defaultOptions = exports.defaultOptionsV2 = exports.COMPARISON_RANGE = exports.COMPARISON_OPTIONS = exports.PRIMARY_CODES = exports.PRIMARY_RANGE = exports.parseEndDate = exports.parseStartDate = exports.getEndDateByDropdownValue = exports.getStartDateByDropdownValue = exports.capitalize = exports.getWeekdays = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
- const BarList_1 = require("../BarList");
5
+ const BarList_1 = require("../components/Chart/BarList");
6
6
  const getWeekdays = (locale) => {
7
7
  const firstDayOfWeek = (0, date_fns_1.startOfWeek)(new Date());
8
8
  return Array.from(Array(7)).map((e, i) => (0, date_fns_1.format)((0, date_fns_1.addDays)(firstDayOfWeek, i), 'EEEEEE', { locale }));
@@ -17,7 +17,51 @@ interface WithQueryEndpoint extends BaseQuillProviderProps {
17
17
  queryHeaders: object;
18
18
  withCredentials?: boolean;
19
19
  }
20
- type QuillProviderProps = WithOrganizationId | WithQueryEndpoint;
20
+ export type IQuillProviderProps = WithOrganizationId | WithQueryEndpoint;
21
+ /**
22
+ * Props for the QuillProvider component.
23
+ */
24
+ export type QuillProviderProps = {
25
+ /**
26
+ * Your Quill public key.
27
+ */
28
+ publicKey: string;
29
+ /**
30
+ * The url of the query endpoint if using self-hosted.
31
+ */
32
+ queryEndpoint: string | never;
33
+ /**
34
+ * Request headers passed to queryEndpoint, if self-hosted.
35
+ */
36
+ queryHeaders: object | never;
37
+ /**
38
+ * The organization id of this request, if any.
39
+ */
40
+ organizationId?: string;
41
+ /**
42
+ * The environment where this request is executed (eg. 'production')
43
+ */
44
+ environment?: string;
45
+ /**
46
+ * The theme object used to customize all quill components.
47
+ */
48
+ theme?: QuillTheme;
49
+ /**
50
+ * Whether to pass credentials to the custom query endpoint, if any.
51
+ */
52
+ withCredentials?: boolean;
53
+ /**
54
+ * The children of this provider (typically, this is the rest of your app).
55
+ */
56
+ children?: React.ReactNode;
57
+ };
58
+ /**
59
+ * ## Quill Theme
60
+ * Customizable styles used throughout Quill.
61
+ *
62
+ * ### QuillTheme API
63
+ * @see https://docs.quillsql.com/components/quill-provider#quilltheme
64
+ */
21
65
  export interface QuillTheme {
22
66
  fontFamily: string;
23
67
  backgroundColor: string;
@@ -29,9 +73,9 @@ export interface QuillTheme {
29
73
  chartTickColor: string;
30
74
  chartColors: string[];
31
75
  borderColor: string;
76
+ borderWidth: number;
32
77
  primaryButtonColor?: string;
33
78
  secondaryButtonColor?: string;
34
- borderWidth: number;
35
79
  buttonFontWeight?: number;
36
80
  labelFontWeight?: number;
37
81
  fontSize?: number;
@@ -55,6 +99,65 @@ export declare const defaultQuillTheme: {
55
99
  loadingStateBackgroundColor: string;
56
100
  hoverBackgroundColor: string;
57
101
  };
102
+ /**
103
+ * ### Quill Provider
104
+ *
105
+ * The quill provider allows all the quill components in your app to share
106
+ * information which lets your dashboards render fast and update dynamically.
107
+ *
108
+ * Similar to React’s `Context.Provider`, `QuillProvider` wraps your React app
109
+ * and places Quill Client on the context, enabling you to access it from
110
+ * anywhere in your component tree. We suggest putting the QuillProvider
111
+ * somewhere high in your app, above any component that might need to access
112
+ * your quill data.
113
+ *
114
+ * ### Quickstart
115
+ * There are two ways to set up the QuillProvider; with an organization id using
116
+ * our fully-managed cloud platform, or with a query endpoint pointing to your
117
+ * own server running our self-hosted server SDK.
118
+ *
119
+ * @example
120
+ * ```js
121
+ * // Usage with organization id
122
+ * <QuillProvider
123
+ * organizationId={'acme_org'}
124
+ * publicKey={QUILL_API_KEY}
125
+ * >
126
+ * // rest of your app here
127
+ * </QuillProvider>
128
+ * ```
129
+ *
130
+ * @example
131
+ * ```js
132
+ * // Usage with query endpoint
133
+ * <QuillProvider
134
+ * queryEndpoint="https://example.com/quill"
135
+ * queryHeaders={AUTH_HEADERS}
136
+ * publicKey={QUILL_API_KEY}
137
+ * >
138
+ * // rest of your app here
139
+ * </QuillProvider>
140
+ * ```
141
+ *
142
+ * ### Custom Themes
143
+ * You can also pass in a custom theme into the QuillProvider to automatically
144
+ * style all default quill components at the same time. The combination of
145
+ * passing custom themes as well as passing your existing components gets you
146
+ * pixel-perfect dashboards in a fraction of the time.
147
+ *
148
+ * Our guide on custom themes is coming soon.
149
+ *
150
+ * ### Endpoint Authorization
151
+ * When self-hosting the server SDK, you might need extra authentication measures
152
+ * to ensure a secure system. In addition to passing a `queryHeaders` object along
153
+ * with any requests to your custom endpoint, you also can pass a `withCredentials`
154
+ * boolean.
155
+ *
156
+ * Our guide on endpoint authorization is coming soon.
157
+ *
158
+ * ### Dashboard API
159
+ * @see https://docs.quillsql.com/components/quill-provider
160
+ */
58
161
  declare const QuillProvider: ({ organizationId, publicKey, queryEndpoint, queryHeaders, environment, children, theme, withCredentials, }: QuillProviderProps) => import("react/jsx-runtime").JSX.Element;
59
162
  export default QuillProvider;
60
163
  //# sourceMappingURL=QuillProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuillProvider.d.ts","sourceRoot":"","sources":["../../src/QuillProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAGrD,UAAU,sBAAsB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,UAAU,kBAAmB,SAAQ,sBAAsB;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,UAAU,iBAAkB,SAAQ,sBAAsB;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,KAAK,kBAAkB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjE,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAwB7B,CAAC;AAEF,QAAA,MAAM,aAAa,+GAShB,kBAAkB,4CA+BpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"QuillProvider.d.ts","sourceRoot":"","sources":["../../src/QuillProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,sBAAsB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,UAAU,kBAAmB,SAAQ,sBAAsB;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,UAAU,iBAAkB,SAAQ,sBAAsB;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAGD,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC;IAE9B;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC;IAE7B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAwB7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,QAAA,MAAM,aAAa,+GAShB,kBAAkB,4CA+BpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -28,6 +28,65 @@ exports.defaultQuillTheme = {
28
28
  loadingStateBackgroundColor: '#F9F9FA',
29
29
  hoverBackgroundColor: '#F4F4F5',
30
30
  };
31
+ /**
32
+ * ### Quill Provider
33
+ *
34
+ * The quill provider allows all the quill components in your app to share
35
+ * information which lets your dashboards render fast and update dynamically.
36
+ *
37
+ * Similar to React’s `Context.Provider`, `QuillProvider` wraps your React app
38
+ * and places Quill Client on the context, enabling you to access it from
39
+ * anywhere in your component tree. We suggest putting the QuillProvider
40
+ * somewhere high in your app, above any component that might need to access
41
+ * your quill data.
42
+ *
43
+ * ### Quickstart
44
+ * There are two ways to set up the QuillProvider; with an organization id using
45
+ * our fully-managed cloud platform, or with a query endpoint pointing to your
46
+ * own server running our self-hosted server SDK.
47
+ *
48
+ * @example
49
+ * ```js
50
+ * // Usage with organization id
51
+ * <QuillProvider
52
+ * organizationId={'acme_org'}
53
+ * publicKey={QUILL_API_KEY}
54
+ * >
55
+ * // rest of your app here
56
+ * </QuillProvider>
57
+ * ```
58
+ *
59
+ * @example
60
+ * ```js
61
+ * // Usage with query endpoint
62
+ * <QuillProvider
63
+ * queryEndpoint="https://example.com/quill"
64
+ * queryHeaders={AUTH_HEADERS}
65
+ * publicKey={QUILL_API_KEY}
66
+ * >
67
+ * // rest of your app here
68
+ * </QuillProvider>
69
+ * ```
70
+ *
71
+ * ### Custom Themes
72
+ * You can also pass in a custom theme into the QuillProvider to automatically
73
+ * style all default quill components at the same time. The combination of
74
+ * passing custom themes as well as passing your existing components gets you
75
+ * pixel-perfect dashboards in a fraction of the time.
76
+ *
77
+ * Our guide on custom themes is coming soon.
78
+ *
79
+ * ### Endpoint Authorization
80
+ * When self-hosting the server SDK, you might need extra authentication measures
81
+ * to ensure a secure system. In addition to passing a `queryHeaders` object along
82
+ * with any requests to your custom endpoint, you also can pass a `withCredentials`
83
+ * boolean.
84
+ *
85
+ * Our guide on endpoint authorization is coming soon.
86
+ *
87
+ * ### Dashboard API
88
+ * @see https://docs.quillsql.com/components/quill-provider
89
+ */
31
90
  const QuillProvider = ({ organizationId, publicKey, queryEndpoint = 'https://quill-344421.uc.r.appspot.com/cloud', queryHeaders, environment, children, theme = exports.defaultQuillTheme, withCredentials = false, }) => {
32
91
  return ((0, jsx_runtime_1.jsxs)(Context_1.ContextProvider, { initialTheme: theme, publicKey: publicKey, environment: environment, customerId: organizationId, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials, children: [children, (0, jsx_runtime_1.jsx)("style", { children: `/* For WebKit-based browsers (Chrome, Safari, Opera) */
33
92
  ::-webkit-scrollbar {