@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,957 @@
1
+ import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
+ import { Oa as t, n, t as r } from "./interfaces-VUY4_yVO.js";
3
+ import { G as i, Ki as a, Nn as o, Nr as s, V as c, bi as l, gi as u, pi as d, pr as f, r as p, wi as m, xr as h, yi as g } from "./utils-Ba9T0TqC.js";
4
+ import { C as _, D as v, E as y, O as b, T as x, V as S, Z as C, ct as w, dt as T, l as E, st as D, v as ee, w as O } from "./_baseFlatten-DPXPOrea.js";
5
+ import "./coloring-C16AUZEi.js";
6
+ var k = /* @__PURE__ */ e(a()), A = m();
7
+ function j(e) {
8
+ return e.substring(2).toLowerCase();
9
+ }
10
+ function te(e, t) {
11
+ return t.documentElement.clientWidth < e.clientX || t.documentElement.clientHeight < e.clientY;
12
+ }
13
+ function ne(e) {
14
+ let { children: t, disableReactTree: n = !1, mouseEvent: r = "onClick", onClickAway: i, touchEvent: a = "onTouchEnd" } = e, o = k.useRef(!1), s = k.useRef(null), c = k.useRef(!1), l = k.useRef(!1);
15
+ k.useEffect(() => (setTimeout(() => {
16
+ c.current = !0;
17
+ }, 0), () => {
18
+ c.current = !1;
19
+ }), []);
20
+ let u = D(C(t), s), d = w((e) => {
21
+ let t = l.current;
22
+ l.current = !1;
23
+ let r = T(s.current);
24
+ if (!c.current || !s.current || "clientX" in e && te(e, r)) return;
25
+ if (o.current) {
26
+ o.current = !1;
27
+ return;
28
+ }
29
+ let a;
30
+ a = e.composedPath ? e.composedPath().indexOf(s.current) > -1 : !r.documentElement.contains(e.target) || s.current.contains(e.target), !a && (n || !t) && i(e);
31
+ }), f = (e) => (n) => {
32
+ l.current = !0;
33
+ let r = t.props[e];
34
+ r && r(n);
35
+ }, p = { ref: u };
36
+ return a !== !1 && (p[a] = f(a)), k.useEffect(() => {
37
+ if (a !== !1) {
38
+ let e = j(a), t = T(s.current), n = () => {
39
+ o.current = !0;
40
+ };
41
+ return t.addEventListener(e, d), t.addEventListener("touchmove", n), () => {
42
+ t.removeEventListener(e, d), t.removeEventListener("touchmove", n);
43
+ };
44
+ }
45
+ }, [d, a]), r !== !1 && (p[r] = f(r)), k.useEffect(() => {
46
+ if (r !== !1) {
47
+ let e = j(r), t = T(s.current);
48
+ return t.addEventListener(e, d), () => {
49
+ t.removeEventListener(e, d);
50
+ };
51
+ }
52
+ }, [d, r]), /*#__PURE__*/ (0, A.jsx)(k.Fragment, { children: /*#__PURE__*/ k.cloneElement(t, p) });
53
+ }
54
+ var M = {
55
+ "--background-color": t.white,
56
+ "--color": t.mainDarkNavy,
57
+ "--font-family": "Roboto",
58
+ "--font-weight": "normal",
59
+ "--font-style": "normal",
60
+ "--text-decoration": "none",
61
+ "--text-align": "left"
62
+ }, N = (e) => {
63
+ let t = e["--background-color"], n = e["--color"], r = ie(t), { searchFontColor: i, searchBorderColor: a } = re(t, n);
64
+ return {
65
+ "--background-color-hover": r,
66
+ "--search-font-color": i,
67
+ "--search-border-color": a
68
+ };
69
+ }, re = (e, n) => n ? {
70
+ searchFontColor: n,
71
+ searchBorderColor: n
72
+ } : !e || e === "transparent" ? {
73
+ searchFontColor: t.grey2,
74
+ searchBorderColor: t.grey3
75
+ } : new E(e).luminanceWithAlpha() < .5 ? {
76
+ searchFontColor: t.white,
77
+ searchBorderColor: t.white
78
+ } : {
79
+ searchFontColor: t.grey2,
80
+ searchBorderColor: t.grey3
81
+ }, ie = (e) => {
82
+ if (!e || e === "transparent") return t.grey3;
83
+ let n = new E(e);
84
+ return n.luminanceWithAlpha() < .5 ? n.addTint(.2).hex() : n.addShade(.1).hex();
85
+ }, P = {
86
+ [O.md]: {
87
+ fontSize: "11px",
88
+ lineHeight: "12px"
89
+ },
90
+ [O.sm]: {
91
+ fontSize: "9px",
92
+ lineHeight: "10px"
93
+ },
94
+ [O.xs]: {
95
+ fontSize: "8px",
96
+ lineHeight: "8px"
97
+ }
98
+ }, ae = i({
99
+ container: (e) => ({
100
+ backgroundColor: "var(--background-color)",
101
+ fontFamily: "var(--font-family)",
102
+ padding: "8px 0",
103
+ ...e && {
104
+ [O.md]: { padding: "6px 0" },
105
+ [O.sm]: { padding: "4px 0" },
106
+ [O.xs]: { padding: "2px 0" }
107
+ }
108
+ }),
109
+ divActions: {
110
+ boxShadow: `0 0 8px ${t.grey4}`,
111
+ display: "flex",
112
+ flexWrap: "wrap",
113
+ gap: 8,
114
+ marginBottom: -8,
115
+ marginTop: 8,
116
+ padding: 8
117
+ },
118
+ divActionsAction: {
119
+ ...n.normal14,
120
+ borderRadius: 4,
121
+ cursor: "pointer",
122
+ textAlign: "center",
123
+ width: "100%",
124
+ "&[aria-disabled=\"true\"]": {
125
+ cursor: "not-allowed",
126
+ opacity: .6
127
+ }
128
+ },
129
+ divActionsAction__primary: {
130
+ background: t.mainDarkNavy,
131
+ color: t.white,
132
+ padding: "2px 1px"
133
+ },
134
+ divActionsAction__secondary: {
135
+ border: `1px solid ${t.grey3}`,
136
+ color: t.mainDarkNavy,
137
+ padding: "1px 0"
138
+ },
139
+ divOptions: (e) => ({
140
+ ...r.propertiesPanel,
141
+ scrollbarGutter: "initial",
142
+ maxHeight: 400,
143
+ padding: "0 8px",
144
+ ...e && {
145
+ [O.md]: { padding: "0 6px" },
146
+ [O.sm]: { padding: "0 4px" },
147
+ [O.xs]: { padding: "0 2px" }
148
+ }
149
+ }),
150
+ header: (e) => ({
151
+ ...n.bold13,
152
+ gap: 8,
153
+ padding: "10px 16px",
154
+ display: "flex",
155
+ textAlign: "var(--text-align)",
156
+ color: "var(--color)",
157
+ ...e && P
158
+ }),
159
+ divOptionsOption: (e) => ({
160
+ alignItems: "center",
161
+ borderRadius: 4,
162
+ color: "var(--color)",
163
+ cursor: "pointer",
164
+ display: "flex",
165
+ textAlign: "var(--text-align)",
166
+ gap: 8,
167
+ padding: "0px 8px",
168
+ height: 32,
169
+ "&:hover": { background: "var(--background-color-hover)" },
170
+ "&[aria-disabled=\"true\"]": { color: t.grey3 },
171
+ "& > div": { display: "flex" },
172
+ ...e && {
173
+ ..._,
174
+ [O.md]: {
175
+ padding: "0px 8px",
176
+ height: 24,
177
+ gap: 4
178
+ },
179
+ [O.sm]: {
180
+ padding: "0px 6px",
181
+ height: 20,
182
+ gap: 2
183
+ },
184
+ [O.xs]: {
185
+ padding: "0px 4px",
186
+ height: 16,
187
+ gap: 1
188
+ }
189
+ }
190
+ }),
191
+ divOptionsOptionCategory: (e) => ({
192
+ ...n.bold13,
193
+ fontStyle: "var(--font-style)",
194
+ textDecoration: "var(--text-decoration)",
195
+ background: "var(--background-color)",
196
+ position: "sticky",
197
+ top: 0,
198
+ zIndex: 1,
199
+ ...e && P
200
+ }),
201
+ divOptionsOptionDivider: (e) => ({
202
+ borderRadius: "0px",
203
+ cursor: "initial",
204
+ padding: "0px",
205
+ margin: "10px 8px",
206
+ borderBottom: `1px solid ${t.grey4}`,
207
+ height: 0,
208
+ "&:hover": { background: "initial" },
209
+ ...e && {
210
+ [O.md]: { margin: "8px" },
211
+ [O.sm]: { margin: "6px" },
212
+ [O.xs]: { margin: "4px" }
213
+ }
214
+ }),
215
+ divOptionsOptionOption: (e) => ({
216
+ ...n.normal13,
217
+ fontStyle: "var(--font-style)",
218
+ lineHeight: n.normal13.lineHeight,
219
+ textDecoration: "var(--text-decoration)",
220
+ "&[aria-disabled=\"true\"]": { cursor: "not-allowed" },
221
+ "&[aria-expanded=\"true\"]": { background: t.grey5 },
222
+ ...e && P
223
+ }),
224
+ divOptionsOptionOptionLabel: {
225
+ ...n.overflowEllipsis,
226
+ display: "initial !important",
227
+ height: "100%",
228
+ alignContent: "center",
229
+ flexGrow: 1
230
+ },
231
+ divSearch: {
232
+ padding: "8px",
233
+ display: "flex",
234
+ "& > div": { flexGrow: 1 }
235
+ }
236
+ }), F = (0, k.createContext)({
237
+ onClose: () => null,
238
+ onOpen: () => null
239
+ }), I = (e) => {
240
+ let t = (0, k.useContext)(F), [n, r] = (0, k.useState)(!1), [i, a] = (0, k.useState)(!1), o = (0, k.useMemo)(() => ({
241
+ onClose: () => a(!1),
242
+ onOpen: () => a(!0)
243
+ }), []);
244
+ return /* @__PURE__ */ (0, A.jsx)(F.Provider, {
245
+ value: o,
246
+ children: /* @__PURE__ */ (0, A.jsx)(v, {
247
+ onClose: () => {
248
+ t.onClose(), r(!1);
249
+ },
250
+ onOpen: () => {
251
+ t.onOpen(), r(!0);
252
+ },
253
+ open: !i && n,
254
+ ...e
255
+ })
256
+ });
257
+ }, oe = ({ tooltip: e, children: t }) => e ? /* @__PURE__ */ (0, A.jsx)(I, {
258
+ title: e,
259
+ children: t
260
+ }) : t, se = ({ action: e, classNames: t }) => {
261
+ let { color: n = "primary", disabled: r = !1, key: i, label: a, onClick: s, style: c = {} } = e;
262
+ return /* @__PURE__ */ (0, A.jsx)(oe, {
263
+ tooltip: e.tooltip,
264
+ children: /* @__PURE__ */ (0, A.jsx)("div", {
265
+ "aria-disabled": r,
266
+ className: o({
267
+ [t.divActionsAction]: !0,
268
+ [t.divActionsAction__primary]: n === "primary",
269
+ [t.divActionsAction__secondary]: n === "secondary"
270
+ }),
271
+ onClick: r ? void 0 : s,
272
+ onKeyDown: y,
273
+ role: "button",
274
+ style: c,
275
+ tabIndex: r ? void 0 : 0,
276
+ children: a
277
+ }, i)
278
+ });
279
+ }, ce = ({ actions: e, classNames: t }) => e.length ? /* @__PURE__ */ (0, A.jsx)("div", {
280
+ className: t.divActions,
281
+ children: e.map((e) => /* @__PURE__ */ (0, A.jsx)(se, {
282
+ classNames: t,
283
+ action: e
284
+ }, e.key))
285
+ }) : null, L = (e) => {
286
+ let t = (0, k.useContext)(F), n = (0, k.useRef)(null), [r, i] = (0, k.useState)(!1), [a, o] = (0, k.useState)(!1), s = (0, k.useMemo)(() => ({
287
+ onClose: () => o(!1),
288
+ onOpen: () => o(!0)
289
+ }), []);
290
+ return /* @__PURE__ */ (0, A.jsx)(F.Provider, {
291
+ value: s,
292
+ children: /* @__PURE__ */ (0, A.jsx)(v, {
293
+ disableFocusListener: !0,
294
+ disableInteractive: !0,
295
+ enterDelay: 500,
296
+ enterNextDelay: 500,
297
+ onClose: () => {
298
+ t.onClose(), i(!1);
299
+ },
300
+ onOpen: () => {
301
+ if (n.current) {
302
+ let e = n.current.hasAttribute("data-ellipsis") ? n.current : n.current.querySelector("[data-ellipsis]");
303
+ if (e && e.clientWidth >= e.scrollWidth && e.clientHeight >= e.scrollHeight) return;
304
+ }
305
+ t.onOpen(), i(!0);
306
+ },
307
+ open: !a && r,
308
+ ref: n,
309
+ ...e
310
+ })
311
+ });
312
+ }, le = (e, t) => {
313
+ let { type: n } = e;
314
+ return n === "category" ? {
315
+ ...e,
316
+ children: e.children.filter((e) => t(e))
317
+ } : e;
318
+ }, ue = (e, t) => {
319
+ let { type: n } = e;
320
+ switch (n) {
321
+ case "category": {
322
+ let { children: t } = e;
323
+ return t.length > 0;
324
+ }
325
+ case "divider": return !0;
326
+ default: {
327
+ let { label: n, description: r } = e;
328
+ if (!n || typeof n != "string") return !0;
329
+ let i = n.toLocaleLowerCase(), a = r?.toLocaleLowerCase();
330
+ return i.includes(t) || !!a?.includes(t);
331
+ }
332
+ }
333
+ }, de = (e, t) => {
334
+ let n = (e) => ue(e, t);
335
+ return e.map((e) => le(e, n)).filter(n);
336
+ }, fe = (e) => {
337
+ let t = e.reduce((e, t) => e + Number("isChecked" in t && t.isChecked === !0), 0);
338
+ switch (!0) {
339
+ case t === e.length: return "full";
340
+ case t > 0: return "partial";
341
+ default: return "none";
342
+ }
343
+ }, pe = ({ classNames: e, option: t, openedElement: n, setOpenedElement: r, collapsed: i, setCollapsed: a, searchPhrase: s, onCloseClick: c, responsive: l, checkboxSize: d }) => {
344
+ let { children: f, disabled: p = !1, label: m, tooltip: h, onCheck: _, key: v } = t, b = fe(f);
345
+ return /* @__PURE__ */ (0, A.jsxs)(k.Fragment, { children: [/* @__PURE__ */ (0, A.jsx)(L, {
346
+ title: m,
347
+ children: /* @__PURE__ */ (0, A.jsxs)("div", {
348
+ "aria-disabled": p,
349
+ "aria-expanded": !i[v],
350
+ className: o({
351
+ [e.divOptionsOption]: !0,
352
+ [e.divOptionsOptionCategory]: !0
353
+ }),
354
+ onClick: () => {
355
+ a({
356
+ ...i,
357
+ [v]: !i[v]
358
+ }), r({});
359
+ },
360
+ onKeyDown: y,
361
+ role: "menuitem",
362
+ tabIndex: p ? void 0 : 0,
363
+ children: [
364
+ /* @__PURE__ */ (0, A.jsx)(B, {
365
+ onCheck: _,
366
+ checked: b,
367
+ disabled: p,
368
+ size: d
369
+ }),
370
+ /* @__PURE__ */ (0, A.jsx)(U, {
371
+ label: m,
372
+ searchPhrase: s,
373
+ classNames: e
374
+ }),
375
+ /* @__PURE__ */ (0, A.jsx)(q, { tooltipTitle: h }),
376
+ /* @__PURE__ */ (0, A.jsx)(V, { icon: i[v] ? /* @__PURE__ */ (0, A.jsx)(g, {}) : /* @__PURE__ */ (0, A.jsx)(u, {}) })
377
+ ]
378
+ })
379
+ }), i[v] ? null : f.map((t) => /* @__PURE__ */ (0, A.jsx)(J, {
380
+ classNames: e,
381
+ option: t,
382
+ openedElement: n,
383
+ setOpenedElement: r,
384
+ collapsed: i,
385
+ setCollapsed: a,
386
+ searchPhrase: s,
387
+ onCloseClick: c,
388
+ responsive: l,
389
+ checkboxSize: d
390
+ }, t.key))] }, v);
391
+ }, me = i({
392
+ container: {
393
+ position: "relative",
394
+ display: "flex",
395
+ justifyContent: "center"
396
+ },
397
+ checkbox: {
398
+ WebkitAppearance: "none",
399
+ appearance: "none",
400
+ margin: 0,
401
+ backgroundColor: t.white,
402
+ border: `1px solid ${t.grey3}`,
403
+ borderRadius: 4,
404
+ cursor: "pointer",
405
+ "&[aria-disabled=\"true\"]": { cursor: "default" },
406
+ "&[aria-readonly=\"true\"]": { cursor: "default" },
407
+ "&:focus": { boxShadow: `0px 0px 1px 1px ${t.mainDarkNavy}40` }
408
+ },
409
+ checkboxChecked: { border: `1px solid ${t.grey2} !important` },
410
+ checkboxUnchecked: { border: `1px solid ${t.grey3}` },
411
+ checkmark: {
412
+ top: 0,
413
+ position: "absolute",
414
+ cursor: "pointer"
415
+ }
416
+ }), R = {
417
+ onClick: null,
418
+ checkedType: "none",
419
+ checkMarkColor: t.mainBrightPink,
420
+ disabled: !1,
421
+ readOnly: !1,
422
+ size: 16,
423
+ styles: {},
424
+ tabIndex: 0
425
+ }, he = ({ checkedType: e, size: n, fill: r = t.mainBrightPink }) => {
426
+ switch (e) {
427
+ case "full": return /* @__PURE__ */ (0, A.jsx)(l, {
428
+ fill: r,
429
+ size: n
430
+ });
431
+ case "partial": return /* @__PURE__ */ (0, A.jsx)(h, {
432
+ fill: r,
433
+ size: n
434
+ });
435
+ default: return null;
436
+ }
437
+ }, z = (e) => {
438
+ let { onClick: t, checkedType: n, checkMarkColor: r, disabled: i, readOnly: a, size: s, styles: c, tabIndex: l } = {
439
+ ...R,
440
+ ...e
441
+ }, u = n !== "none", d = (e) => {
442
+ t && (e.stopPropagation(), !i && !a && t(e));
443
+ }, f = (e) => {
444
+ e.key === "Enter" && (e.preventDefault(), d(e));
445
+ }, p = me(), m = c?.borderWidth !== void 0 && !!c?.borderColor && !!c?.borderStyle;
446
+ return /* @__PURE__ */ (0, A.jsxs)("div", {
447
+ className: p.container,
448
+ style: { height: s },
449
+ onClick: d,
450
+ children: [/* @__PURE__ */ (0, A.jsx)("input", {
451
+ type: "checkbox",
452
+ "aria-disabled": i,
453
+ "aria-readonly": a,
454
+ "aria-checked": u,
455
+ style: {
456
+ ...c,
457
+ height: s,
458
+ width: s
459
+ },
460
+ tabIndex: l,
461
+ onKeyDown: f,
462
+ className: o({
463
+ [p.checkbox]: !0,
464
+ [p.checkboxUnchecked]: !u,
465
+ [p.checkboxChecked]: !m && u
466
+ })
467
+ }), /* @__PURE__ */ (0, A.jsx)("div", {
468
+ className: p.checkmark,
469
+ children: /* @__PURE__ */ (0, A.jsx)(he, {
470
+ checkedType: n,
471
+ size: s,
472
+ fill: r
473
+ })
474
+ })]
475
+ });
476
+ }, B = ({ onCheck: e, checked: t, disabled: n, size: r }) => e ? /* @__PURE__ */ (0, A.jsx)(z, {
477
+ onClick: e,
478
+ checkedType: t,
479
+ disabled: n,
480
+ size: r
481
+ }) : null, ge = ({ classNames: e, option: t }) => /* @__PURE__ */ (0, A.jsx)("div", {
482
+ className: o({
483
+ [e.divOptionsOption]: !0,
484
+ [e.divOptionsOptionDivider]: !0
485
+ }),
486
+ role: "separator"
487
+ }, t.key), V = ({ icon: e }) => e ? /* @__PURE__ */ (0, A.jsx)("div", { children: e }) : null, _e = i({ span: { fontWeight: "bold" } }), ve = (e, t) => {
488
+ let n = _e();
489
+ if (!e) return [{ children: t }];
490
+ let r = e.toLocaleLowerCase(), i = t.toLocaleLowerCase(), a = [], o = 0;
491
+ for (; o < t.length;) {
492
+ let s = i.indexOf(r, o);
493
+ switch (s) {
494
+ case -1:
495
+ a.push({ children: t.substring(o) }), o = t.length;
496
+ break;
497
+ default: a.push({ children: t.substring(o, s) }), a.push({
498
+ children: t.substring(s, s + e.length),
499
+ className: n.span
500
+ }), o = s + e.length;
501
+ }
502
+ }
503
+ return a;
504
+ }, H = ({ children: e, phrase: t }) => /* @__PURE__ */ (0, A.jsx)(A.Fragment, { children: ve(t, e).map((e, t) => /* @__PURE__ */ (0, A.jsx)("span", { ...e }, t)) }), U = ({ classNames: e, label: t, searchPhrase: n }) => /* @__PURE__ */ (0, A.jsx)("div", {
505
+ "data-ellipsis": !0,
506
+ className: e.divOptionsOptionOptionLabel,
507
+ children: typeof t == "string" ? /* @__PURE__ */ (0, A.jsx)(H, {
508
+ phrase: n,
509
+ children: t
510
+ }) : t
511
+ }), W = /* @__PURE__ */ function(e) {
512
+ return e.left = "left", e.right = "right", e;
513
+ }({}), G = ({ actions: e = [], anchorEl: t, anchorPosition: n, cssVariables: r, onClose: i, onCloseClick: a, options: o, searchEnabled: s = !1, style: c = {}, pickedOptionsIds: l, header: u, menuStyle: d, responsive: f, ...p }) => /* @__PURE__ */ (0, A.jsx)(b, {
514
+ ...p,
515
+ anchorEl: t,
516
+ anchorPosition: n,
517
+ MenuListProps: {
518
+ role: void 0,
519
+ tabIndex: void 0
520
+ },
521
+ onClose: i,
522
+ open: !!t || !!n,
523
+ style: d,
524
+ children: /* @__PURE__ */ (0, A.jsx)($, {
525
+ header: u,
526
+ actions: e,
527
+ onClose: i,
528
+ onCloseClick: a,
529
+ options: o,
530
+ pickedOptionsIds: l,
531
+ searchEnabled: s,
532
+ style: c,
533
+ cssVariables: r,
534
+ responsive: f
535
+ })
536
+ }), K = ({ children: e, classNames: t, option: n, onClick: r }) => {
537
+ let { disabled: i = !1, label: a, key: s } = n;
538
+ return /* @__PURE__ */ (0, A.jsx)(L, {
539
+ title: a,
540
+ children: /* @__PURE__ */ (0, A.jsx)("div", {
541
+ "aria-disabled": i,
542
+ className: o({
543
+ [t.divOptionsOption]: !0,
544
+ [t.divOptionsOptionOption]: !0
545
+ }),
546
+ onClick: r,
547
+ onKeyDown: y,
548
+ role: "menuitem",
549
+ tabIndex: i ? void 0 : 0,
550
+ children: e
551
+ })
552
+ }, s);
553
+ }, ye = (e) => {
554
+ let { openedElement: t, setOpenedElement: n, onCloseClick: r, multiSelect: i, classNames: a, option: o, checkboxSize: s } = e, { children: c = [], disabled: l = !1, label: u, onCheck: d, onClick: f, onMultiClick: p, isChecked: m, tooltip: h, key: g } = o, [_, v] = (0, k.useState)({ icon: o.icon || {} }), { icon: y } = _, b;
555
+ return c.length ? (b = (e) => {
556
+ l || n({ [g]: e.currentTarget });
557
+ }, /* @__PURE__ */ (0, A.jsxs)(k.Fragment, { children: [/* @__PURE__ */ (0, A.jsxs)(K, {
558
+ ...e,
559
+ onClick: b,
560
+ children: [
561
+ /* @__PURE__ */ (0, A.jsx)(V, { icon: y?.left }),
562
+ /* @__PURE__ */ (0, A.jsx)(U, {
563
+ label: u,
564
+ classNames: a
565
+ }),
566
+ /* @__PURE__ */ (0, A.jsx)(q, { tooltipTitle: h }),
567
+ /* @__PURE__ */ (0, A.jsx)(V, { icon: y?.right })
568
+ ]
569
+ }), /* @__PURE__ */ (0, A.jsx)(G, {
570
+ anchorEl: t[g],
571
+ anchorOrigin: {
572
+ horizontal: "left",
573
+ vertical: "top"
574
+ },
575
+ onClose: () => {
576
+ n({});
577
+ },
578
+ onCloseClick: (e) => {
579
+ r(e), n({});
580
+ },
581
+ options: c,
582
+ transformOrigin: {
583
+ horizontal: "right",
584
+ vertical: "top"
585
+ }
586
+ })] }, g)) : (b = (e) => {
587
+ if (!l) {
588
+ if (f?.(e), i) {
589
+ let e = p?.();
590
+ e && v((t) => ({
591
+ ...t,
592
+ ...e
593
+ }));
594
+ return;
595
+ }
596
+ d || r(e);
597
+ }
598
+ }, /* @__PURE__ */ (0, A.jsxs)(K, {
599
+ ...e,
600
+ onClick: b,
601
+ children: [
602
+ e.option.checkboxPosition !== W.right && /* @__PURE__ */ (0, A.jsx)(B, {
603
+ onCheck: d,
604
+ checked: m ? "full" : "none",
605
+ disabled: l,
606
+ size: s
607
+ }),
608
+ /* @__PURE__ */ (0, A.jsx)(V, { icon: y?.left }),
609
+ /* @__PURE__ */ (0, A.jsx)(U, {
610
+ label: u,
611
+ classNames: a
612
+ }),
613
+ /* @__PURE__ */ (0, A.jsx)(q, { tooltipTitle: h }),
614
+ /* @__PURE__ */ (0, A.jsx)(V, { icon: y?.right }),
615
+ e.option.checkboxPosition === W.right && /* @__PURE__ */ (0, A.jsx)(B, {
616
+ onCheck: d,
617
+ checked: m ? "full" : "none",
618
+ disabled: l,
619
+ size: s
620
+ })
621
+ ]
622
+ }));
623
+ }, q = ({ tooltipTitle: e }) => e ? /* @__PURE__ */ (0, A.jsx)(I, {
624
+ title: e,
625
+ children: /* @__PURE__ */ (0, A.jsx)("div", { children: /* @__PURE__ */ (0, A.jsx)(s, {}) })
626
+ }) : null, J = (e) => {
627
+ let { type: t } = e.option;
628
+ switch (t) {
629
+ case "category": return /* @__PURE__ */ (0, A.jsx)(pe, { ...e });
630
+ case "divider": return /* @__PURE__ */ (0, A.jsx)(ge, { ...e });
631
+ case "option": return /* @__PURE__ */ (0, A.jsx)(ye, { ...e });
632
+ default: return null;
633
+ }
634
+ }, Y = ({ classNames: e, options: t, searchPhrase: n, autoFocus: r, openedElement: i, setOpenedElement: a, collapsed: o, setCollapsed: s, onCloseClick: c, multiSelect: l = !1, responsive: u, checkboxSize: d }) => {
635
+ let f = n.toLocaleLowerCase(), p = de(t, f);
636
+ return /* @__PURE__ */ (0, A.jsx)("div", {
637
+ className: e.divOptions,
638
+ onKeyDown: x,
639
+ ref: r,
640
+ role: "menu",
641
+ children: p.map((t) => /* @__PURE__ */ (0, A.jsx)(J, {
642
+ classNames: e,
643
+ option: t,
644
+ openedElement: i,
645
+ setOpenedElement: a,
646
+ collapsed: o,
647
+ setCollapsed: s,
648
+ searchPhrase: f,
649
+ onCloseClick: c,
650
+ multiSelect: l,
651
+ responsive: u,
652
+ checkboxSize: d
653
+ }, t.key))
654
+ });
655
+ }, be = i({ button: {
656
+ background: "initial",
657
+ border: "initial",
658
+ padding: "initial",
659
+ borderRadius: 4,
660
+ cursor: "pointer",
661
+ display: "block"
662
+ } }), X = (0, k.forwardRef)(function({ children: e, className: t, ...n }, r) {
663
+ let i = be();
664
+ return /* @__PURE__ */ (0, A.jsx)("button", {
665
+ ...n,
666
+ className: o({
667
+ [String(t)]: !0,
668
+ [i.button]: !0
669
+ }),
670
+ ref: r,
671
+ children: e
672
+ });
673
+ }), xe = i({
674
+ button: (e) => ({
675
+ position: "absolute",
676
+ right: 4,
677
+ top: 4,
678
+ ...e && {
679
+ [O.md]: { top: 2 },
680
+ "& svg": {
681
+ [O.sm]: {
682
+ width: 12,
683
+ height: 12
684
+ },
685
+ [O.xs]: {
686
+ width: 8,
687
+ height: 8
688
+ }
689
+ }
690
+ }
691
+ }),
692
+ div: {
693
+ display: "flex",
694
+ position: "relative"
695
+ },
696
+ input: (e) => ({
697
+ ...n.normal13,
698
+ background: "initial",
699
+ border: `1px solid ${t.grey3}`,
700
+ borderRadius: 4,
701
+ boxSizing: "border-box",
702
+ color: t.mainDarkNavy,
703
+ flexGrow: 1,
704
+ height: 24,
705
+ padding: "3px 23px",
706
+ ...e && {
707
+ [O.md]: {
708
+ height: 20,
709
+ ...n.normal12
710
+ },
711
+ [O.sm]: {
712
+ height: 16,
713
+ ...n.normal11,
714
+ padding: "3px 16px"
715
+ },
716
+ [O.xs]: {
717
+ height: 12,
718
+ ...n.normal10,
719
+ padding: "0px 12px"
720
+ }
721
+ },
722
+ "&::placeholder": { color: "inherit" }
723
+ }),
724
+ svg: (e) => ({
725
+ left: 4,
726
+ pointerEvents: "none",
727
+ position: "absolute",
728
+ top: 4,
729
+ ...e && {
730
+ [O.md]: { top: 2 },
731
+ [O.sm]: {
732
+ width: 12,
733
+ height: 12,
734
+ top: 2
735
+ },
736
+ [O.xs]: {
737
+ width: 8,
738
+ height: 8,
739
+ top: 2
740
+ }
741
+ }
742
+ })
743
+ }), Z = (0, k.forwardRef)(function({ autoFocus: e, className: t, onChange: n, value: r, placeholder: i, style: a, responsive: s, ...c }, l) {
744
+ let u = (0, k.useRef)(null), p = S(u, l), m = xe(s);
745
+ return (0, k.useEffect)(() => {
746
+ e && u.current?.focus();
747
+ }, [e]), /* @__PURE__ */ (0, A.jsxs)("div", {
748
+ className: o({
749
+ [String(t)]: !0,
750
+ [m.div]: !0
751
+ }),
752
+ children: [
753
+ /* @__PURE__ */ (0, A.jsx)(f, {
754
+ className: m.svg,
755
+ fill: a?.color
756
+ }),
757
+ /* @__PURE__ */ (0, A.jsx)("input", {
758
+ ...c,
759
+ style: { ...a },
760
+ className: m.input,
761
+ onChange: n,
762
+ placeholder: i ?? "Search...",
763
+ ref: p,
764
+ size: 1,
765
+ value: r
766
+ }),
767
+ /* @__PURE__ */ (0, A.jsx)(X, {
768
+ className: m.button,
769
+ "data-testid": "input-search-clear",
770
+ onClick: () => {
771
+ u.current?.focus(), n?.({ target: { value: "" } });
772
+ },
773
+ style: { display: r ? void 0 : "none" },
774
+ children: /* @__PURE__ */ (0, A.jsx)(d, { fill: a?.color })
775
+ })
776
+ ]
777
+ });
778
+ }), Q = i({ button: {
779
+ paddingLeft: 4,
780
+ paddingRight: 4
781
+ } }), Se = ({ isAllCollapsed: e, clickCallback: t }) => {
782
+ let n = Q(), r = e ? g : u;
783
+ return /* @__PURE__ */ (0, A.jsx)(L, {
784
+ title: e ? "Expand all" : "Collapse all",
785
+ children: /* @__PURE__ */ (0, A.jsx)(X, {
786
+ onClick: () => t?.(!e),
787
+ className: n.button,
788
+ children: /* @__PURE__ */ (0, A.jsx)(r, {})
789
+ })
790
+ });
791
+ }, Ce = ({ classNames: e, searchEnabled: t, searchPhrase: n, onChange: r, options: i, collapsed: a, onCollapseChange: o, responsive: s }) => {
792
+ if (!t) return null;
793
+ let c = i.filter((e) => e.type === "category"), l = c.length > 0, u = c.every((e) => a[e.key]);
794
+ return /* @__PURE__ */ (0, A.jsxs)("div", {
795
+ className: e.divSearch,
796
+ children: [/* @__PURE__ */ (0, A.jsx)(Z, {
797
+ onChange: (e) => r(e.target.value),
798
+ value: n,
799
+ responsive: s,
800
+ style: {
801
+ borderColor: "var(--search-border-color)",
802
+ color: "var(--search-font-color)"
803
+ }
804
+ }), l && /* @__PURE__ */ (0, A.jsx)(Se, {
805
+ isAllCollapsed: u,
806
+ clickCallback: o
807
+ })]
808
+ });
809
+ }, $ = ({ actions: e = [], onClose: t, onCloseClick: n = t, options: r, stickyOptions: i, searchEnabled: a = !1, multiSelect: o = !1, style: s = {}, cssVariables: l, header: u, responsive: d }) => {
810
+ let f = c(), m = p(), h = ae(d), g = d ? ee(16, m.height, m.width) : 16, [_, v] = (0, k.useState)({}), [y, b] = (0, k.useState)({}), [x, S] = (0, k.useState)(""), C = (e) => {
811
+ S(e), b({});
812
+ }, w = {
813
+ ...M,
814
+ ...l
815
+ }, T = N(w), E = {
816
+ ...w,
817
+ ...T
818
+ }, D = (e) => {
819
+ let t = r.map((e) => e.key).reduce((t, n) => (t[n] = e, t), {});
820
+ v(t);
821
+ }, O = (e) => {
822
+ switch (e.stopPropagation(), e.key) {
823
+ case "ArrowDown":
824
+ e.target.tagName === "INPUT" && (e.preventDefault(), e.currentTarget.querySelector("[role=\"menuitem\"][tabindex]")?.focus());
825
+ break;
826
+ case "Escape":
827
+ t(e);
828
+ break;
829
+ case "Shift":
830
+ case "Tab": break;
831
+ default: e.currentTarget.querySelector("input")?.focus();
832
+ }
833
+ };
834
+ return /* @__PURE__ */ (0, A.jsxs)("div", {
835
+ style: {
836
+ ...E,
837
+ ...s
838
+ },
839
+ className: h.container,
840
+ onClick: (e) => {
841
+ e.stopPropagation();
842
+ },
843
+ onKeyDown: O,
844
+ children: [
845
+ u ? /* @__PURE__ */ (0, A.jsxs)("div", {
846
+ className: h.header,
847
+ children: [
848
+ " ",
849
+ u,
850
+ " "
851
+ ]
852
+ }) : null,
853
+ i?.length ? /* @__PURE__ */ (0, A.jsx)(Y, {
854
+ classNames: h,
855
+ options: i,
856
+ searchPhrase: "",
857
+ collapsed: _,
858
+ setCollapsed: v,
859
+ openedElement: y,
860
+ setOpenedElement: b,
861
+ onCloseClick: n,
862
+ autoFocus: f,
863
+ responsive: d,
864
+ checkboxSize: g
865
+ }) : null,
866
+ /* @__PURE__ */ (0, A.jsx)(Ce, {
867
+ searchEnabled: a,
868
+ searchPhrase: x,
869
+ onChange: C,
870
+ classNames: h,
871
+ cssVariables: E,
872
+ options: r,
873
+ collapsed: _,
874
+ onCollapseChange: D,
875
+ responsive: d
876
+ }),
877
+ /* @__PURE__ */ (0, A.jsx)(Y, {
878
+ classNames: h,
879
+ options: r,
880
+ autoFocus: f,
881
+ searchPhrase: x,
882
+ collapsed: _,
883
+ setCollapsed: v,
884
+ openedElement: y,
885
+ setOpenedElement: b,
886
+ onCloseClick: n,
887
+ multiSelect: o,
888
+ responsive: d,
889
+ checkboxSize: g
890
+ }),
891
+ /* @__PURE__ */ (0, A.jsx)(ce, {
892
+ actions: e,
893
+ classNames: h
894
+ })
895
+ ]
896
+ });
897
+ }, we = i({
898
+ radioWrapper: { position: "relative" },
899
+ radio: (e) => ({
900
+ display: "none",
901
+ "& + label": {
902
+ ...n.normal13,
903
+ color: t.grey1,
904
+ cursor: "inherit",
905
+ "&::before": {
906
+ content: "\"\"",
907
+ display: "block",
908
+ position: "relative",
909
+ width: 16,
910
+ height: 16,
911
+ borderRadius: 8,
912
+ border: `1px solid ${t.grey3}`,
913
+ backgroundColor: t.white,
914
+ ...e && { [O.sm]: {
915
+ width: 12,
916
+ height: 12
917
+ } }
918
+ },
919
+ ...e && { [O.sm]: {
920
+ lineHeight: "8px",
921
+ fontSize: "10px"
922
+ } }
923
+ },
924
+ "&:checked + label::after": {
925
+ content: "\"\"",
926
+ width: 8,
927
+ height: 8,
928
+ background: t.white,
929
+ position: "absolute",
930
+ top: 4,
931
+ left: 4,
932
+ borderRadius: 4,
933
+ ...e && { [O.sm]: {
934
+ width: 6,
935
+ height: 6,
936
+ top: 3,
937
+ left: 3
938
+ } }
939
+ },
940
+ "&:checked + label::before": { backgroundColor: t.mainBrightPink }
941
+ })
942
+ }), Te = ({ name: e = "", value: t, checked: n, onChange: r = () => {}, responsive: i = !1 }) => {
943
+ let a = we(i);
944
+ return /* @__PURE__ */ (0, A.jsxs)("div", {
945
+ className: a.radioWrapper,
946
+ children: [/* @__PURE__ */ (0, A.jsx)("input", {
947
+ className: a.radio,
948
+ id: `${e}-radio-button-${t}`,
949
+ type: "radio",
950
+ name: e,
951
+ value: t,
952
+ checked: !!n,
953
+ onChange: (e) => r?.(e.target.value)
954
+ }), /* @__PURE__ */ (0, A.jsx)("label", { htmlFor: `${e}-radio-button-${t}` })]
955
+ });
956
+ };
957
+ export { G as a, L as c, N as d, M as f, X as i, I as l, $ as n, H as o, ne as p, Z as r, z as s, Te as t, F as u };