@astrato-io/visualizations 0.0.0-stage → 0.6.4

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 (145) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +93 -0
  3. package/README.md +843 -2
  4. package/THIRD_PARTY_NOTICES.md +8387 -0
  5. package/VISUALIZATION_DEFINITIONS.md +2378 -0
  6. package/chunks/LinearProgress-CUZ0D8_t.js +253 -0
  7. package/chunks/Radio-Ciu-F4CU.js +957 -0
  8. package/chunks/ToggleButton-BCJc3Jlc.js +153 -0
  9. package/chunks/_baseFlatten-DPXPOrea.js +7076 -0
  10. package/chunks/accessors-DemrDevR.js +128 -0
  11. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +55 -0
  12. package/chunks/bar.compiler-oqaPzIut.js +370 -0
  13. package/chunks/color-settings-ZIvgNTq1.js +10 -0
  14. package/chunks/coloring-C16AUZEi.js +663 -0
  15. package/chunks/data-item-resolution-1lvYB5ln.js +53 -0
  16. package/chunks/debounce-fn-CUixuz45.js +7 -0
  17. package/chunks/escobar-BGqT1EsE.js +34580 -0
  18. package/chunks/event-bus-KiSiCJrC.js +2683 -0
  19. package/chunks/events-WZut5Ow6.js +4 -0
  20. package/chunks/extend-BKUkc4_i.js +37 -0
  21. package/chunks/filter.compiler-CuLtc_02.js +60 -0
  22. package/chunks/filtering-Yq4DEa0t.js +953 -0
  23. package/chunks/gauge-target-type-BkKXAqkX.js +4 -0
  24. package/chunks/grouping-type-BX_9Ix5q.js +3 -0
  25. package/chunks/interfaces-VUY4_yVO.js +8742 -0
  26. package/chunks/line-settings-DfYTUyPz.js +4 -0
  27. package/chunks/line.compiler-BpA_6Tc7.js +188 -0
  28. package/chunks/metadata-CPXdYoln.js +28 -0
  29. package/chunks/number.compiler-DbkWcG4S.js +44 -0
  30. package/chunks/pie-uv42Eqal.js +10 -0
  31. package/chunks/range-DrzdfBX4.js +22 -0
  32. package/chunks/registry-CExpGJ1N.js +920 -0
  33. package/chunks/requirements-DNhuShLS.js +6 -0
  34. package/chunks/rolldown-runtime-DleVn1XH.js +28 -0
  35. package/chunks/set-coloring-datafield-B3uIS1Pe.js +8 -0
  36. package/chunks/shared-CKDL4hx9.js +1171 -0
  37. package/chunks/src-BC7cGcJ-.js +2024 -0
  38. package/chunks/src-BOS6SqkZ.js +67 -0
  39. package/chunks/src-C0LgoUWY.js +26105 -0
  40. package/chunks/src-Cum_2NLV.js +12145 -0
  41. package/chunks/src-D9XogOrc.js +422 -0
  42. package/chunks/src-Dun_jXtz.js +10295 -0
  43. package/chunks/src-DvX5LU9T.js +14742 -0
  44. package/chunks/standalone-87YV_m9n.js +687 -0
  45. package/chunks/standalone-BDCwI6Hn.js +4619 -0
  46. package/chunks/standalone-BH5NqDwp.js +1763 -0
  47. package/chunks/standalone-BLVAWLNJ.js +385 -0
  48. package/chunks/standalone-BPomtAVs.js +2 -0
  49. package/chunks/standalone-BXyBcUOQ.js +2 -0
  50. package/chunks/standalone-BYm1UjLr.js +140 -0
  51. package/chunks/standalone-BllF4rDp.js +383 -0
  52. package/chunks/standalone-BmfMt74U.js +726 -0
  53. package/chunks/standalone-BqWyrnZI.js +281 -0
  54. package/chunks/standalone-C85u7U6I.js +340 -0
  55. package/chunks/standalone-CCNtaJ7s.js +741 -0
  56. package/chunks/standalone-CDQnr6qT.js +345 -0
  57. package/chunks/standalone-CNyNHKVx.js +674 -0
  58. package/chunks/standalone-CY57qwZ-.js +1129 -0
  59. package/chunks/standalone-CZynjFG7.js +12979 -0
  60. package/chunks/standalone-D5vnf-9y.js +3943 -0
  61. package/chunks/standalone-DFPva_ku.js +299 -0
  62. package/chunks/standalone-DQxxNwF8.js +675 -0
  63. package/chunks/standalone-DS9T0FZ-.js +830 -0
  64. package/chunks/standalone-Dx3MLlrO.js +512 -0
  65. package/chunks/standalone-DzixzZAL.js +411 -0
  66. package/chunks/standalone-QJ1kKMnO.js +6 -0
  67. package/chunks/standalone-jiz0L2Dg.js +3855 -0
  68. package/chunks/standalone-lBm9hQ-q.js +179 -0
  69. package/chunks/standalone-rJ45Zfl1.js +68 -0
  70. package/chunks/stroke-dash-UgMEcCS4.js +6 -0
  71. package/chunks/table.compiler-BrXkm4Fz.js +213 -0
  72. package/chunks/toInteger-DVZr-D1j.js +11 -0
  73. package/chunks/treemap-x_zmJoG7.js +23 -0
  74. package/chunks/typeof-CJDtcySz.js +13 -0
  75. package/chunks/types-dVVCsDWD.js +4 -0
  76. package/chunks/ui-D1HQNIBy.js +54039 -0
  77. package/chunks/url-utils-B17gj_mr.js +5501 -0
  78. package/chunks/useFieldName-oqQ3bvnO.js +7 -0
  79. package/chunks/utils-Ba9T0TqC.js +31097 -0
  80. package/chunks/view-CLqWMV7Z.js +156 -0
  81. package/definitions.js +3 -0
  82. package/docs/operations/astrato-app-filter-bar.md +161 -0
  83. package/docs/operations/bar.md +7050 -0
  84. package/docs/operations/combo.md +5825 -0
  85. package/docs/operations/date-picker.md +644 -0
  86. package/docs/operations/distribution-gauge.md +3218 -0
  87. package/docs/operations/dot.md +5662 -0
  88. package/docs/operations/filter.md +1507 -0
  89. package/docs/operations/gauge.md +3452 -0
  90. package/docs/operations/heatMap.md +6026 -0
  91. package/docs/operations/histogram.md +1870 -0
  92. package/docs/operations/iframe.md +56 -0
  93. package/docs/operations/image.md +177 -0
  94. package/docs/operations/index.md +46 -0
  95. package/docs/operations/line.md +6468 -0
  96. package/docs/operations/number.md +3969 -0
  97. package/docs/operations/pie.md +6089 -0
  98. package/docs/operations/radar.md +4646 -0
  99. package/docs/operations/sankey.md +3210 -0
  100. package/docs/operations/scatter.md +6075 -0
  101. package/docs/operations/shape.md +315 -0
  102. package/docs/operations/simpleTextObject.md +706 -0
  103. package/docs/operations/slider.md +230 -0
  104. package/docs/operations/table.md +8790 -0
  105. package/docs/operations/tree.md +2874 -0
  106. package/docs/operations/treemap.md +3619 -0
  107. package/docs/operations/waterfall.md +2938 -0
  108. package/docs/operations/word-cloud.md +3071 -0
  109. package/getters.js +18 -0
  110. package/index.js +1183 -0
  111. package/metadata.js +20 -0
  112. package/operations.js +64 -0
  113. package/package.json +191 -4
  114. package/src/definitions/index.d.ts +2 -0
  115. package/src/definitions/shared/index.d.ts +5 -0
  116. package/src/definitions/shared/lib/available-fields.d.ts +36 -0
  117. package/src/definitions/shared/lib/compilers/index.d.ts +7 -0
  118. package/src/definitions/shared/lib/registry/compile.d.ts +2 -0
  119. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +587 -0
  120. package/src/definitions/shared/lib/registry/index.d.ts +3 -0
  121. package/src/definitions/shared/lib/registry/validation.d.ts +3 -0
  122. package/src/definitions/shared/lib/schemas/app-filter-bar.schema.d.ts +22 -0
  123. package/src/definitions/shared/lib/schemas/bar.schema.d.ts +73 -0
  124. package/src/definitions/shared/lib/schemas/broad-chart.schema.d.ts +68 -0
  125. package/src/definitions/shared/lib/schemas/common.schema.d.ts +304 -0
  126. package/src/definitions/shared/lib/schemas/filter.schema.d.ts +22 -0
  127. package/src/definitions/shared/lib/schemas/index.d.ts +9 -0
  128. package/src/definitions/shared/lib/schemas/line.schema.d.ts +72 -0
  129. package/src/definitions/shared/lib/schemas/number.schema.d.ts +21 -0
  130. package/src/definitions/shared/lib/schemas/object.schema.d.ts +215 -0
  131. package/src/definitions/shared/lib/schemas/table.schema.d.ts +458 -0
  132. package/src/definitions/shared/lib/types/compilation.types.d.ts +36 -0
  133. package/src/definitions/shared/lib/types/definition.types.d.ts +2 -0
  134. package/src/definitions/shared/lib/types/descriptor.types.d.ts +39 -0
  135. package/src/definitions/shared/lib/types/index.d.ts +3 -0
  136. package/src/getters/index.d.ts +30 -0
  137. package/src/index.d.ts +4 -0
  138. package/src/metadata/index.d.ts +4 -0
  139. package/src/operations/index.d.ts +30 -0
  140. package/src/registry/index.d.ts +6 -0
  141. package/src/runtime/index.d.ts +2 -0
  142. package/src/types.d.ts +307 -0
  143. package/src/visualization-catalog.d.ts +82 -0
  144. package/src/web-components/index.d.ts +12 -0
  145. package/styles.css +2 -0
@@ -0,0 +1,687 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Oa as t, Ts as n, Wc as r, do as i, ds as a, fa as o, fo as s } from "./interfaces-VUY4_yVO.js";
3
+ import { $n as c, G as l, Gn as u, Ki as d, Sr as f, Zt as p, c as m, d as h, m as g, n as _, s as v, ui as y, wi as b, xn as x } from "./utils-Ba9T0TqC.js";
4
+ import { z as S } from "./ui-D1HQNIBy.js";
5
+ import { C, w } from "./_baseFlatten-DPXPOrea.js";
6
+ import { a as ee, c as te, h as ne, i as T, l as re, m as ie, n as ae, o as oe, r as E, s as se, t as D, u as O } from "./filtering-Yq4DEa0t.js";
7
+ import "./src-DvX5LU9T.js";
8
+ import { d as ce, f as k, i as A, l as j, n as M, p as N, r as P } from "./Radio-Ciu-F4CU.js";
9
+ var le = (e) => ({
10
+ hasImage: !!e.dimensions[1]?.dataItem,
11
+ hasMeasure: !!e.measures[0]?.dataItem,
12
+ searchEnabled: !!e.filterSettings?.searchable,
13
+ quickSelection: !!e.filterSettings?.quickSelect
14
+ }), F = a(), I = /* @__PURE__ */ e(d()), ue = /* @__PURE__ */ e(u()), L = l({ menuTrigger: ({ responsive: e, isDisplayImportant: t }) => ({
15
+ ...e && C,
16
+ display: t ? "inline-flex !important" : "inline-flex",
17
+ alignItems: "center",
18
+ justifyContent: "center",
19
+ minWidth: 22,
20
+ width: 22,
21
+ height: 22,
22
+ padding: 0,
23
+ borderRadius: 6,
24
+ border: "none",
25
+ backgroundColor: "transparent",
26
+ color: "inherit",
27
+ lineHeight: 0,
28
+ "&:hover": { boxShadow: "inset 0 0 0 1px currentColor" },
29
+ "&:focus": { outline: "none" },
30
+ ...e && {
31
+ [w.md]: {
32
+ minWidth: 20,
33
+ width: 20,
34
+ height: 20,
35
+ borderRadius: 5
36
+ },
37
+ [w.sm]: {
38
+ minWidth: 16,
39
+ width: 16,
40
+ height: 16,
41
+ borderRadius: 4
42
+ },
43
+ [w.xs]: {
44
+ minWidth: 12,
45
+ width: 12,
46
+ height: 12,
47
+ borderRadius: 3
48
+ }
49
+ }
50
+ }) }), R = b();
51
+ function z(e) {
52
+ let { isPreview: t, areSelectedValues: n, arePendingValues: r, isNotEnabled: i, responsive: a, onClear: o, onDeselectAll: s, onSelectAll: c, onSelectExcluded: l, toggleNotOperator: u, onLockClick: d, isSingleSelectField: p = !1 } = e, [m, h] = (0, I.useState)(!1), g = L({
53
+ responsive: a,
54
+ isDisplayImportant: !0
55
+ }), _ = x().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1, v = [{
56
+ disabled: t || !r,
57
+ key: "clear",
58
+ label: "Clear",
59
+ type: "option",
60
+ onClick: o
61
+ }];
62
+ return p || v.push({
63
+ key: "divider",
64
+ type: "divider"
65
+ }, {
66
+ disabled: t || !n,
67
+ key: "deselect-all",
68
+ label: "Deselect all",
69
+ type: "option",
70
+ onClick: s
71
+ }, {
72
+ disabled: t,
73
+ key: "select-all",
74
+ label: i ? "Exclude all" : "Select all",
75
+ type: "option",
76
+ onClick: c
77
+ }, {
78
+ disabled: t,
79
+ key: "invert",
80
+ label: "Invert",
81
+ type: "option",
82
+ onClick: l
83
+ }, {
84
+ disabled: t,
85
+ key: "not",
86
+ label: "Exclude",
87
+ type: "option",
88
+ onClick: u
89
+ }), _ && v.push({
90
+ key: "divider",
91
+ type: "divider"
92
+ }, {
93
+ key: "lock",
94
+ label: "Lock",
95
+ type: "option",
96
+ icon: { right: /* @__PURE__ */ (0, R.jsx)(f, {}) },
97
+ onClick: d
98
+ }), /* @__PURE__ */ (0, R.jsx)(j, {
99
+ open: m,
100
+ placement: "bottom-end",
101
+ title: /* @__PURE__ */ (0, R.jsx)(N, {
102
+ onClickAway: () => h(!1),
103
+ children: /* @__PURE__ */ (0, R.jsx)(M, {
104
+ onClose: () => h(!1),
105
+ options: v,
106
+ responsive: a,
107
+ style: { margin: "-8px -12px" }
108
+ })
109
+ }),
110
+ children: /* @__PURE__ */ (0, R.jsx)(A, {
111
+ onClick: () => h(!m),
112
+ "data-testid": "filter-button-icon-dots",
113
+ className: g.menuTrigger,
114
+ children: /* @__PURE__ */ (0, R.jsx)(y, {
115
+ fill: "currentColor",
116
+ size: 20
117
+ })
118
+ })
119
+ });
120
+ }
121
+ var B = {
122
+ borderBottom: `1px solid ${t.grey5}`,
123
+ margin: "0 12px",
124
+ width: "calc(100% - 24px)"
125
+ }, de = {
126
+ flexGrow: 1,
127
+ borderRadius: 0,
128
+ height: 28,
129
+ boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
130
+ clipPath: "inset(0 0 -10px 0)",
131
+ transform: "translateY(-3px)"
132
+ }, fe = {
133
+ position: "absolute",
134
+ inset: 0,
135
+ display: "flex",
136
+ justifyContent: "center",
137
+ alignItems: "flex-end",
138
+ pointerEvents: "auto",
139
+ zIndex: 2
140
+ }, V = ({ vSpec: e, vTheme: t, filterValues: n, isPreview: r, loadMoreData: i, searchTerm: a, setSearchTerm: s, allValuesLoaded: l, isSearching: u = !1, isApplyingFilters: d = !1 }) => {
141
+ let f = x(), [p, h] = (0, I.useState)(a), y = !!e.filterSettings?.defaultNotState, [b, C] = (0, I.useState)(y), [w, T] = ne(e), ie = (0, I.useMemo)(() => (0, ue.default)((e) => s(e), 300), [s]), oe = n.reduce((e, t) => (t.disabled || e.push(t.dimension), e), []), A = r ? [] : [{
142
+ dataItem: e.dimensions[0]?.dataItem,
143
+ dateLevel: e.dimensions[0]?.dateLevel,
144
+ datePart: e.dimensions[0]?.datePart,
145
+ values: oe
146
+ }], { hasImage: j, hasMeasure: M, searchEnabled: N, quickSelection: P } = le(e), L = e.filterSettings?.filterStyle?.backgroundColor ?? o.backgroundColor, V = ce({
147
+ ...k,
148
+ "--background-color": L
149
+ })["--background-color-hover"], [pe] = v(A, {
150
+ disabled: r,
151
+ state: P ? F.SelectionState.APPLIED : void 0,
152
+ defaultOperator: b ? F.FilterOperator.NotInList : F.FilterOperator.InList,
153
+ commitHistory: P
154
+ }), { onClear: me, onClick: H, onDeselectAll: U, onSelectExcluded: W, onNotOperatorChange: G, onSelectAll: K, field: q, state: J, operators: Y } = pe ?? m, { isFieldLocked: X, toggleFieldLock: he } = _(q), Z = J.pending ?? J.applied ?? [], ge = g([q]);
155
+ (0, I.useEffect)(() => {
156
+ let e = Y.pending ?? Y.applied;
157
+ if (e) {
158
+ C(e === F.FilterOperator.NotInList);
159
+ return;
160
+ }
161
+ C(y);
162
+ }, [y, Y]);
163
+ let _e = (0, I.useCallback)(() => {
164
+ C((e) => !e), G();
165
+ }, [C, G]);
166
+ function ve() {
167
+ l ? K() : f.daedalus.emitEvent(F.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
168
+ type: "warn",
169
+ message: "Cannot select values, because not all of them are loaded!"
170
+ });
171
+ }
172
+ let Q = X || d || u, ye = (0, I.useRef)(null);
173
+ (0, I.useEffect)(() => {
174
+ ye.current?.toggleAttribute("inert", Q);
175
+ }, [Q]);
176
+ let $ = n;
177
+ return X && ($ = n.filter((e) => Z.includes(e.dimension))), /* @__PURE__ */ (0, R.jsx)("div", {
178
+ style: {
179
+ position: "relative",
180
+ height: "100%"
181
+ },
182
+ children: /* @__PURE__ */ (0, R.jsx)(D, {
183
+ blurBackground: !0,
184
+ filterStyle: e.filterSettings?.filterStyle,
185
+ vTheme: t,
186
+ fontSize: e.filterSettings?.fontStyle?.fontSize ?? o.fontSize,
187
+ children: /* @__PURE__ */ (0, R.jsxs)(O.Provider, {
188
+ value: {
189
+ appliedOperator: Y.applied,
190
+ pendingOperator: Y.pending
191
+ },
192
+ children: [
193
+ /* @__PURE__ */ (0, R.jsx)(E, {
194
+ measureTitle: T,
195
+ dimensionTitle: w,
196
+ searchEnabled: N && !r,
197
+ searchTerm: p,
198
+ onSearchChange: (e) => {
199
+ h(e), ie(e);
200
+ },
201
+ onApplySearched: ve,
202
+ fontStyle: e.filterSettings?.fontStyle,
203
+ vTheme: t,
204
+ isNotEnabled: b,
205
+ responsive: e?.filterSettings?.responsive,
206
+ isLocked: X,
207
+ children: P ? null : /* @__PURE__ */ (0, R.jsx)(z, {
208
+ isPreview: r,
209
+ responsive: e?.filterSettings?.responsive,
210
+ areSelectedValues: Z.length > 0,
211
+ arePendingValues: !!J.pending,
212
+ onClear: me,
213
+ onDeselectAll: U,
214
+ onSelectExcluded: W,
215
+ onSelectAll: K,
216
+ toggleNotOperator: _e,
217
+ onLockClick: he,
218
+ isNotEnabled: b,
219
+ isSingleSelectField: ge
220
+ })
221
+ }),
222
+ u ? /* @__PURE__ */ (0, R.jsx)(ee, { loading: !0 }) : /* @__PURE__ */ (0, R.jsx)("div", { style: B }),
223
+ /* @__PURE__ */ (0, R.jsx)("div", {
224
+ ref: ye,
225
+ style: {
226
+ height: "100%",
227
+ opacity: Q ? .5 : 1,
228
+ pointerEvents: Q ? "none" : void 0,
229
+ transition: "opacity 0.15s ease"
230
+ },
231
+ children: /* @__PURE__ */ (0, R.jsxs)(ae, {
232
+ loadMoreData: i,
233
+ responsive: e?.filterSettings?.responsive,
234
+ children: [l && $.length === 0 && !u && !d ? /* @__PURE__ */ (0, R.jsx)(te, {
235
+ responsive: e?.filterSettings?.responsive,
236
+ applied: !1,
237
+ disabled: !1,
238
+ selected: !1,
239
+ hoverColor: V,
240
+ fontStyle: e.filterSettings.fontStyle,
241
+ dimensionValue: "No results to display."
242
+ }) : null, j || M ? /* @__PURE__ */ (0, R.jsx)(re, {
243
+ vSpec: e,
244
+ filterValues: $,
245
+ hoverColor: V,
246
+ onItemClick: H,
247
+ selectedValues: Z,
248
+ appliedValues: J.applied ?? [],
249
+ searchTerm: a
250
+ }) : /* @__PURE__ */ (0, R.jsx)(se, {
251
+ vSpec: e,
252
+ filterValues: $,
253
+ hoverColor: V,
254
+ onItemClick: H,
255
+ selectedValues: Z,
256
+ appliedValues: J.applied ?? [],
257
+ searchTerm: a
258
+ })]
259
+ })
260
+ }),
261
+ X && /* @__PURE__ */ (0, R.jsx)("div", {
262
+ style: fe,
263
+ children: /* @__PURE__ */ (0, R.jsx)(S, {
264
+ color: "secondary",
265
+ style: de,
266
+ onClick: () => he(),
267
+ children: /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(c, { fill: "white" }), "Unlock"] })
268
+ })
269
+ })
270
+ ]
271
+ })
272
+ })
273
+ });
274
+ };
275
+ function pe(e) {
276
+ let { quickSelection: t, isPreview: n, areSelectedValues: r, state: i, responsive: a, isSingleSelectField: o = !1, onClear: s, onDeselectAll: c, onSelectAll: l, onSelectExcluded: u, onNotOperatorChange: d, onLockClick: p } = e, [m, h] = (0, I.useState)(!1), g = L({ responsive: a }), { appliedOperator: _, pendingOperator: v } = (0, I.useContext)(O), b = _ ?? v ?? F.FilterOperator.InList, S = x().daedalus.getWorkbookProperties()?.isLockUnlockFieldsEnabled ?? !1;
277
+ if (t) return null;
278
+ let C = [{
279
+ disabled: n || !i.pending,
280
+ key: "clear",
281
+ label: "Clear",
282
+ type: "option",
283
+ onClick: s
284
+ }];
285
+ return o || C.push({
286
+ key: "divider",
287
+ type: "divider"
288
+ }, {
289
+ disabled: n || !r,
290
+ key: "deselect-all",
291
+ label: "Deselect all",
292
+ type: "option",
293
+ onClick: c
294
+ }, {
295
+ disabled: n,
296
+ key: "select-all",
297
+ label: b === F.FilterOperator.InList ? "Select all" : "Exclude all",
298
+ type: "option",
299
+ onClick: l
300
+ }, {
301
+ disabled: n,
302
+ key: "invert",
303
+ label: "Invert",
304
+ type: "option",
305
+ onClick: u
306
+ }, {
307
+ disabled: n,
308
+ key: "not",
309
+ label: "Exclude",
310
+ type: "option",
311
+ onClick: d
312
+ }), S && C.push({
313
+ key: "divider",
314
+ type: "divider"
315
+ }, {
316
+ key: "lock",
317
+ label: "Lock",
318
+ type: "option",
319
+ icon: { right: /* @__PURE__ */ (0, R.jsx)(f, {}) },
320
+ onClick: p
321
+ }), /* @__PURE__ */ (0, R.jsx)(j, {
322
+ open: m,
323
+ placement: "bottom-end",
324
+ title: /* @__PURE__ */ (0, R.jsx)(N, {
325
+ onClickAway: () => h(!1),
326
+ children: /* @__PURE__ */ (0, R.jsx)(M, {
327
+ onClose: () => h(!1),
328
+ options: C,
329
+ responsive: a,
330
+ style: { margin: "-8px -12px" }
331
+ })
332
+ }),
333
+ children: /* @__PURE__ */ (0, R.jsx)(A, {
334
+ onClick: () => h(!m),
335
+ className: g.menuTrigger,
336
+ children: /* @__PURE__ */ (0, R.jsx)(y, {
337
+ fill: "currentColor",
338
+ size: 20
339
+ })
340
+ })
341
+ });
342
+ }
343
+ var me = l({
344
+ searchWrapper: (e) => ({
345
+ alignItems: "center",
346
+ display: "flex",
347
+ flexDirection: "row",
348
+ gap: 4,
349
+ justifyContent: "space-between",
350
+ padding: "8px 8px 8px 12px",
351
+ position: "relative",
352
+ width: "100%",
353
+ ...e && {
354
+ [w.md]: { padding: "6px 6px 6px 10px" },
355
+ [w.sm]: { padding: "4px 4px 4px 8px" },
356
+ [w.xs]: { padding: "2px 2px 2px 4px" }
357
+ }
358
+ }),
359
+ searchWrapperSearch: { flexGrow: 1 },
360
+ tooltip: (e) => ({
361
+ "& .MuiTooltip-tooltip": {
362
+ padding: 0,
363
+ margin: 0,
364
+ backgroundColor: "transparent"
365
+ },
366
+ ...U("bottom", e),
367
+ ...U("top", e)
368
+ }),
369
+ unlockButtonStyles: {
370
+ width: "100%",
371
+ height: 28,
372
+ boxShadow: "0 3px 6px rgba(0, 0, 0, 0.2)",
373
+ clipPath: "inset(0 0 -10px 0)",
374
+ transform: "translateY(-3px)"
375
+ }
376
+ });
377
+ function H(e) {
378
+ let { children: n, isOpen: r, setIsOpen: i, isPreview: a, vSpec: s, vTheme: l, onSearchChange: u, setLocalSearch: d, allValuesLoaded: f, onSelectAll: p, localSearch: m, searchTerm: h, loadMoreData: g, headerElement: _, filterValues: v, onNotOperatorChange: y, onClick: b, onDeselectAll: C, onClear: w, onSelectExcluded: ne, state: T, onLockClick: E, isLocked: D, isSingleSelectField: O = !1, isSearching: A = !1, isApplyingFilters: M = !1 } = e, ue = x(), L = me(s?.filterSettings?.responsive), z = M || A, B = (0, I.useRef)(null);
379
+ (0, I.useEffect)(() => {
380
+ B.current?.toggleAttribute("inert", z);
381
+ }, [z]);
382
+ let { quickSelection: de, hasMeasure: fe, hasImage: V, searchEnabled: H } = le(s), U = T.pending ?? T.applied ?? [], W = s.filterSettings?.filterStyle?.borderRadius ?? o.borderRadius, G = s.filterSettings?.fontStyle?.fontColor ?? l?.fonts?.general?.color ?? t.mainDarkNavy, K = s.filterSettings?.filterStyle?.backgroundColor ?? o.backgroundColor, q = ce({
383
+ ...k,
384
+ "--background-color": K
385
+ })["--background-color-hover"];
386
+ function J(e) {
387
+ switch (e.key) {
388
+ case "Enter":
389
+ f ? p() : ue.daedalus.emitEvent(F.AstratoEvents.SHOW_GLOBAL_NOTIFICATION, {
390
+ type: "warn",
391
+ message: "Cannot select values, because not all of them are loaded!"
392
+ });
393
+ break;
394
+ case "Escape":
395
+ d("");
396
+ break;
397
+ }
398
+ }
399
+ return /* @__PURE__ */ (0, R.jsx)(j, {
400
+ placement: "bottom-start",
401
+ arrow: !1,
402
+ open: r,
403
+ classes: { popper: L.tooltip },
404
+ slotProps: { popper: { anchorEl: _?.current?.firstElementChild } },
405
+ title: /* @__PURE__ */ (0, R.jsx)(N, {
406
+ onClickAway: () => i(!1),
407
+ children: /* @__PURE__ */ (0, R.jsx)("div", {
408
+ style: {
409
+ minWidth: _.current?.clientWidth ?? null,
410
+ maxWidth: "80vw",
411
+ fontSize: s.filterSettings?.fontStyle?.fontSize ?? o.fontSize
412
+ },
413
+ children: r && /* @__PURE__ */ (0, R.jsxs)("div", {
414
+ style: { position: "relative" },
415
+ children: [/* @__PURE__ */ (0, R.jsx)("div", {
416
+ style: {
417
+ filter: D ? "brightness(0.93)" : void 0,
418
+ pointerEvents: D ? "none" : void 0
419
+ },
420
+ children: /* @__PURE__ */ (0, R.jsxs)(oe, {
421
+ filterStyle: s.filterSettings?.filterStyle,
422
+ vTheme: l,
423
+ isLocked: D,
424
+ children: [
425
+ H && !a && /* @__PURE__ */ (0, R.jsxs)("div", {
426
+ className: L.searchWrapper,
427
+ style: { color: G },
428
+ children: [/* @__PURE__ */ (0, R.jsx)(P, {
429
+ className: L.searchWrapperSearch,
430
+ "data-testid": "filter-search-input",
431
+ onChange: (e) => {
432
+ u(e.target.value);
433
+ },
434
+ autoFocus: !D,
435
+ onPaste: ie(u),
436
+ onKeyDown: J,
437
+ style: {
438
+ color: G,
439
+ borderColor: G
440
+ },
441
+ value: m,
442
+ responsive: s?.filterSettings?.responsive
443
+ }), /* @__PURE__ */ (0, R.jsx)(pe, {
444
+ responsive: s?.filterSettings?.responsive,
445
+ isPreview: a,
446
+ quickSelection: de,
447
+ areSelectedValues: !!U.length,
448
+ state: T,
449
+ onClear: w,
450
+ onDeselectAll: C,
451
+ onSelectAll: p,
452
+ onSelectExcluded: ne,
453
+ onNotOperatorChange: y,
454
+ onLockClick: E,
455
+ isSingleSelectField: O
456
+ })]
457
+ }),
458
+ /* @__PURE__ */ (0, R.jsx)(ee, { loading: A }),
459
+ /* @__PURE__ */ (0, R.jsx)("div", {
460
+ ref: B,
461
+ style: {
462
+ opacity: z ? .5 : 1,
463
+ pointerEvents: z ? "none" : void 0,
464
+ transition: "opacity 0.15s ease"
465
+ },
466
+ children: /* @__PURE__ */ (0, R.jsxs)(ae, {
467
+ loadMoreData: g,
468
+ isDropdown: !0,
469
+ hasSearch: H,
470
+ responsive: s?.filterSettings?.responsive,
471
+ children: [f && v.length === 0 && !A && !M ? /* @__PURE__ */ (0, R.jsx)(te, {
472
+ applied: !1,
473
+ disabled: !1,
474
+ selected: !1,
475
+ hoverColor: q,
476
+ fontStyle: s.filterSettings.fontStyle,
477
+ dimensionValue: "No results to display.",
478
+ responsive: s?.filterSettings?.responsive
479
+ }) : null, V || fe ? /* @__PURE__ */ (0, R.jsx)(re, {
480
+ vSpec: s,
481
+ filterValues: v,
482
+ hoverColor: q,
483
+ onItemClick: b,
484
+ selectedValues: U,
485
+ appliedValues: T.applied ?? [],
486
+ searchTerm: h
487
+ }) : /* @__PURE__ */ (0, R.jsx)(se, {
488
+ vSpec: s,
489
+ filterValues: v,
490
+ hoverColor: q,
491
+ onItemClick: b,
492
+ selectedValues: U,
493
+ appliedValues: T.applied ?? [],
494
+ searchTerm: h
495
+ })]
496
+ })
497
+ })
498
+ ]
499
+ })
500
+ }), D && /* @__PURE__ */ (0, R.jsx)(S, {
501
+ color: "secondary",
502
+ style: { borderRadius: `0 0 ${W}px ${W}px` },
503
+ className: L.unlockButtonStyles,
504
+ onClick: E,
505
+ children: /* @__PURE__ */ (0, R.jsxs)(R.Fragment, { children: [/* @__PURE__ */ (0, R.jsx)(c, { fill: "white" }), "Unlock"] })
506
+ })]
507
+ })
508
+ })
509
+ }),
510
+ children: n
511
+ });
512
+ }
513
+ function U(e, t) {
514
+ let n = e === "top" ? "marginBottom" : "marginTop";
515
+ return { [`&[data-popper-placement*="${e}"]`]: { "& .MuiTooltip-tooltip": {
516
+ [n]: 8,
517
+ ...t && {
518
+ [w.md]: { [n]: 6 },
519
+ [w.sm]: { [n]: 4 },
520
+ [w.xs]: { [n]: 2 }
521
+ }
522
+ } } };
523
+ }
524
+ var W = {
525
+ backgroundColor: "transparent",
526
+ borderEnabled: !1
527
+ }, G = ({ vSpec: e, filterValues: t, isPreview: n, vTheme: r, loadMoreData: i, searchTerm: a, setSearchTerm: s, allValuesLoaded: c, isSearching: l = !1, isApplyingFilters: u = !1 }) => {
528
+ let d = (0, I.useRef)(), [f, p] = (0, I.useState)(!1), [h, y] = (0, I.useState)(a), b = e.dimensions[0]?.formatter, x = t.map((e) => e.dimension), [S, C] = ne(e), { quickSelection: w } = le(e), ee = e.filterSettings?.defaultNotState ? F.FilterOperator.NotInList : F.FilterOperator.InList, [te] = v(n ? [] : [{
529
+ dataItem: e.dimensions[0]?.dataItem,
530
+ dateLevel: e.dimensions[0]?.dateLevel,
531
+ datePart: e.dimensions[0]?.datePart,
532
+ values: x
533
+ }], {
534
+ disabled: n,
535
+ state: w ? F.SelectionState.APPLIED : void 0,
536
+ defaultOperator: ee,
537
+ commitHistory: w
538
+ }), re = (0, I.useMemo)(() => (0, ue.default)((e) => s(e), 300), [s]), { onClear: ie, onClick: ae, onDeselectAll: oe, onSelectExcluded: E, onSelectAll: se, onNotOperatorChange: ce, state: k, operators: A, field: j } = te ?? m, M = k.pending ?? k.applied ?? [], { isFieldLocked: N, toggleFieldLock: P } = _(j), L = g([j]), z = (e) => {
539
+ y(e), re(e);
540
+ }, B = t;
541
+ return N && (B = t.filter((e) => M.includes(e.dimension))), /* @__PURE__ */ (0, R.jsx)(D, {
542
+ noBorder: !0,
543
+ vTheme: r,
544
+ filterStyle: W,
545
+ fontSize: e.filterSettings?.fontStyle?.fontSize ?? o.fontSize,
546
+ children: /* @__PURE__ */ (0, R.jsx)(O.Provider, {
547
+ value: {
548
+ appliedOperator: A.applied,
549
+ pendingOperator: A.pending
550
+ },
551
+ children: /* @__PURE__ */ (0, R.jsx)(H, {
552
+ isOpen: f,
553
+ isPreview: n,
554
+ vSpec: e,
555
+ vTheme: r,
556
+ allValuesLoaded: c,
557
+ localSearch: h,
558
+ searchTerm: a,
559
+ headerElement: d,
560
+ setIsOpen: p,
561
+ onSearchChange: z,
562
+ setLocalSearch: y,
563
+ loadMoreData: i,
564
+ filterValues: B,
565
+ onNotOperatorChange: ce,
566
+ onClick: ae,
567
+ onDeselectAll: oe,
568
+ onSelectAll: se,
569
+ onClear: ie,
570
+ onSelectExcluded: E,
571
+ state: k,
572
+ onLockClick: P,
573
+ isLocked: N,
574
+ isSingleSelectField: L,
575
+ isSearching: l,
576
+ isApplyingFilters: u,
577
+ children: /* @__PURE__ */ (0, R.jsx)("div", {
578
+ ref: d,
579
+ style: { height: "100%" },
580
+ children: /* @__PURE__ */ (0, R.jsx)(T, {
581
+ measureTitle: C,
582
+ dimensionTitle: S,
583
+ isOpen: f,
584
+ onToggle: () => p(!f),
585
+ dimensionFormatter: b,
586
+ selectedValues: M,
587
+ fontStyle: e.filterSettings?.fontStyle,
588
+ filterStyle: e.filterSettings?.filterStyle,
589
+ responsive: e?.filterSettings?.responsive,
590
+ isLocked: N
591
+ })
592
+ })
593
+ })
594
+ })
595
+ });
596
+ }, K = [
597
+ { value: "Value 1" },
598
+ { value: "Value 2" },
599
+ { value: "Value 3" },
600
+ { value: "Value 4" },
601
+ { value: "Value 5" },
602
+ { value: "Value 6" },
603
+ { value: "Value 7" },
604
+ { value: "Value 8" },
605
+ { value: "Value 9" },
606
+ { value: "Value 10" },
607
+ { value: "Value 11" }
608
+ ], q = ({ vSpec: e, vTheme: t }) => {
609
+ let a = K.map((e) => ({ dimension: e.value })), o = {
610
+ ...e,
611
+ dimensions: [{
612
+ dataItem: {
613
+ internalKey: null,
614
+ uniqueSignature: n(),
615
+ schema: "excel",
616
+ view: "pokemon",
617
+ name: "city",
618
+ dataType: F.FieldType.STRING,
619
+ type: r.Dimension
620
+ },
621
+ label: "Dimension"
622
+ }],
623
+ measures: []
624
+ };
625
+ return e.filterSettings.mode === i.Dropdown ? /* @__PURE__ */ (0, R.jsx)(G, {
626
+ allValuesLoaded: !0,
627
+ vSpec: o,
628
+ vTheme: t,
629
+ filterValues: a,
630
+ isPreview: !0,
631
+ searchTerm: "",
632
+ setSearchTerm: () => null,
633
+ loadMoreData: () => null
634
+ }) : /* @__PURE__ */ (0, R.jsx)(V, {
635
+ allValuesLoaded: !0,
636
+ vSpec: o,
637
+ vTheme: t,
638
+ filterValues: a,
639
+ isPreview: !0,
640
+ searchTerm: "",
641
+ setSearchTerm: () => null,
642
+ loadMoreData: () => null
643
+ });
644
+ }, J = p(({ vSpec: e, filterValues: t = [], vTheme: n, loadMoreData: r, searchTerm: a, setSearchTerm: o, allValuesLoaded: c, isSearching: l = !1, isApplyingFilters: u = !1 }) => {
645
+ let d = h();
646
+ if ((0, I.useEffect)(() => {
647
+ e?.dimensions?.length < 2 && d();
648
+ }, [e]), !e?.dimensions?.length && e?.dimensions !== void 0) return /* @__PURE__ */ (0, R.jsx)(q, {
649
+ vSpec: {
650
+ ...e,
651
+ filterSettings: {
652
+ ...e.filterSettings,
653
+ mode: e.filterSettings?.mode ?? i.Listbox,
654
+ source: e.filterSettings?.source ?? s.Engine
655
+ }
656
+ },
657
+ vTheme: n
658
+ });
659
+ if (e?.dimensions === void 0 || !e?.filterSettings?.mode || !e?.filterSettings?.source) return null;
660
+ switch (e.filterSettings.mode) {
661
+ case i.Image: return null;
662
+ case i.Dropdown: return /* @__PURE__ */ (0, R.jsx)(G, {
663
+ allValuesLoaded: c,
664
+ vSpec: e,
665
+ vTheme: n,
666
+ filterValues: t,
667
+ loadMoreData: r,
668
+ searchTerm: a,
669
+ setSearchTerm: o,
670
+ isSearching: l,
671
+ isApplyingFilters: u
672
+ });
673
+ case i.Listbox:
674
+ default: return /* @__PURE__ */ (0, R.jsx)(V, {
675
+ allValuesLoaded: c,
676
+ vSpec: e,
677
+ vTheme: n,
678
+ filterValues: t,
679
+ loadMoreData: r,
680
+ searchTerm: a,
681
+ setSearchTerm: o,
682
+ isSearching: l,
683
+ isApplyingFilters: u
684
+ });
685
+ }
686
+ });
687
+ export { J as Filter };