@astrato-io/visualizations 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/THIRD_PARTY_NOTICES.md +94 -4
  3. package/chunks/ClickAwayListener-BbeNMAvj.js +52 -0
  4. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-B1FeWaen.js} +54 -54
  5. package/chunks/app-filter-bar.compiler-BGJ7HAbr.js +64 -0
  6. package/chunks/bar.compiler-CT0ZbQKc.js +374 -0
  7. package/chunks/{src-Cum_2NLV.js → builder-B6dWSIdD.js} +5779 -5635
  8. package/chunks/{coloring-C16AUZEi.js → coloring-B1XAfg6b.js} +234 -233
  9. package/chunks/{src-BC7cGcJ-.js → definitions-D3OVqmXl.js} +438 -360
  10. package/chunks/{escobar-BGqT1EsE.js → escobar-eDjtGpkC.js} +4645 -4619
  11. package/chunks/filter.compiler-DBsyRBJt.js +70 -0
  12. package/chunks/{filtering-Yq4DEa0t.js → filtering-tqjAyJH5.js} +432 -313
  13. package/chunks/{grouping-type-BX_9Ix5q.js → grouping-type-On4s9Thj.js} +1 -1
  14. package/chunks/handlers-VTBfIZYZ.js +13072 -0
  15. package/chunks/isEqual-BDxAhUo8.js +7514 -0
  16. package/chunks/line.compiler-CzdM5Ld0.js +198 -0
  17. package/chunks/{metadata-CPXdYoln.js → metadata-BGElBy5Z.js} +1 -1
  18. package/chunks/number.compiler-G-R7y16P.js +53 -0
  19. package/chunks/{src-C0LgoUWY.js → operations-CTNUX6Sy.js} +9576 -9432
  20. package/chunks/{range-DrzdfBX4.js → range-CiwTbMig.js} +2 -2
  21. package/chunks/{registry-CExpGJ1N.js → registry-CsQQzukD.js} +153 -153
  22. package/chunks/{requirements-DNhuShLS.js → requirements-DYjZCFyf.js} +1 -1
  23. package/chunks/{shared-CKDL4hx9.js → shared-CBvcC5YV.js} +460 -413
  24. package/chunks/{standalone-D5vnf-9y.js → standalone-0M4HlmDW2.js} +823 -822
  25. package/chunks/standalone-0ashe9w1.js +411 -0
  26. package/chunks/{standalone-C85u7U6I.js → standalone-B7jax8wa.js} +93 -94
  27. package/chunks/standalone-BK0VYU-l.js +463 -0
  28. package/chunks/{standalone-BDCwI6Hn.js → standalone-BMIbT1b2.js} +815 -815
  29. package/chunks/standalone-BZV5vOwA.js +6 -0
  30. package/chunks/standalone-BhDrWj4p.js +1980 -0
  31. package/chunks/{standalone-CNyNHKVx.js → standalone-BtSHCp2U2.js} +97 -98
  32. package/chunks/{standalone-CDQnr6qT.js → standalone-BvaKdky9.js} +95 -96
  33. package/chunks/standalone-BwtM31-f.js +2 -0
  34. package/chunks/{standalone-CY57qwZ-.js → standalone-C3gg736V.js} +153 -153
  35. package/chunks/{standalone-DFPva_ku.js → standalone-CC1VUjO32.js} +60 -60
  36. package/chunks/{standalone-CCNtaJ7s.js → standalone-C_rYnZ0N.js} +41 -41
  37. package/chunks/{standalone-CZynjFG7.js → standalone-CoLrAxRV.js} +3701 -3482
  38. package/chunks/{standalone-jiz0L2Dg.js → standalone-DC-aUgXC.js} +104 -104
  39. package/chunks/standalone-DCtRoTWg.js +675 -0
  40. package/chunks/standalone-DUDFTBqL.js +833 -0
  41. package/chunks/standalone-DhZkX9Td.js +2 -0
  42. package/chunks/{standalone-Dx3MLlrO.js → standalone-DtLElfuM.js} +141 -141
  43. package/chunks/{standalone-BmfMt74U.js → standalone-G9Q4Uczu.js} +192 -192
  44. package/chunks/{standalone-BH5NqDwp.js → standalone-JuLF-OoH.js} +390 -391
  45. package/chunks/standalone-_DeX21JJ.js +383 -0
  46. package/chunks/{standalone-lBm9hQ-q.js → standalone-gFhKZh8m.js} +34 -34
  47. package/chunks/standalone-tDNy-SFH.js +281 -0
  48. package/chunks/{standalone-rJ45Zfl1.js → standalone-v1oxfU20.js} +10 -10
  49. package/chunks/{standalone-BYm1UjLr.js → standalone-vzBY6q0I2.js} +18 -18
  50. package/chunks/table.compiler-tb914oj3.js +222 -0
  51. package/chunks/{ui-D1HQNIBy.js → ui-DQWtv2iM.js} +13485 -3973
  52. package/chunks/{useFieldName-oqQ3bvnO.js → useFieldName-BvdcoJRl.js} +1 -1
  53. package/chunks/{utils-Ba9T0TqC.js → utils-Bg7K-t6K.js} +7306 -6024
  54. package/chunks/{src-DvX5LU9T.js → view-Bn83C8d9.js} +2555 -4831
  55. package/definitions.js +3 -3
  56. package/docs/operations/astrato-app-filter-bar.md +17 -17
  57. package/docs/operations/bar.md +989 -1071
  58. package/docs/operations/combo.md +717 -738
  59. package/docs/operations/date-picker.md +25 -25
  60. package/docs/operations/distribution-gauge.md +471 -607
  61. package/docs/operations/dot.md +787 -879
  62. package/docs/operations/filter.md +139 -163
  63. package/docs/operations/gauge.md +491 -627
  64. package/docs/operations/heatMap.md +834 -916
  65. package/docs/operations/histogram.md +166 -180
  66. package/docs/operations/iframe.md +5 -5
  67. package/docs/operations/image.md +16 -16
  68. package/docs/operations/index.md +12 -12
  69. package/docs/operations/line.md +811 -888
  70. package/docs/operations/number.md +470 -536
  71. package/docs/operations/pie.md +825 -958
  72. package/docs/operations/radar.md +599 -679
  73. package/docs/operations/sankey.md +462 -584
  74. package/docs/operations/scatter.md +823 -929
  75. package/docs/operations/shape.md +34 -34
  76. package/docs/operations/simpleTextObject.md +18 -25
  77. package/docs/operations/slider.md +33 -43
  78. package/docs/operations/table.md +1160 -1150
  79. package/docs/operations/tree.md +354 -361
  80. package/docs/operations/treemap.md +545 -637
  81. package/docs/operations/waterfall.md +369 -379
  82. package/docs/operations/word-cloud.md +512 -583
  83. package/getters.js +3 -3
  84. package/index.js +51 -51
  85. package/metadata.js +3 -3
  86. package/operations.js +7 -7
  87. package/package.json +80 -86
  88. package/src/definitions/index.d.ts +2 -2
  89. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  90. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  91. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  92. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1341 -0
  93. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  94. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  95. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  96. package/src/definitions/model/definitions/index.d.ts +23 -0
  97. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  98. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  99. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  100. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  101. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  102. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  103. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +6 -6
  104. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  105. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  106. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  107. package/chunks/Radio-Ciu-F4CU.js +0 -957
  108. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  109. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  110. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  111. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  112. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  113. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  114. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  115. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  116. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  117. package/chunks/line-settings-DfYTUyPz.js +0 -4
  118. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  119. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  120. package/chunks/pie-uv42Eqal.js +0 -10
  121. package/chunks/src-Dun_jXtz.js +0 -10295
  122. package/chunks/standalone-87YV_m9n.js +0 -687
  123. package/chunks/standalone-BLVAWLNJ.js +0 -385
  124. package/chunks/standalone-BPomtAVs.js +0 -2
  125. package/chunks/standalone-BXyBcUOQ.js +0 -2
  126. package/chunks/standalone-BllF4rDp.js +0 -383
  127. package/chunks/standalone-BqWyrnZI.js +0 -281
  128. package/chunks/standalone-DQxxNwF8.js +0 -675
  129. package/chunks/standalone-DS9T0FZ-.js +0 -830
  130. package/chunks/standalone-DzixzZAL.js +0 -411
  131. package/chunks/standalone-QJ1kKMnO.js +0 -6
  132. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  133. package/chunks/toInteger-DVZr-D1j.js +0 -11
  134. package/chunks/treemap-x_zmJoG7.js +0 -23
  135. package/chunks/types-dVVCsDWD.js +0 -4
  136. package/chunks/view-CLqWMV7Z.js +0 -156
  137. package/src/definitions/shared/index.d.ts +0 -5
  138. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  139. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  140. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  141. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  143. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  144. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  145. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  146. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  147. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  148. /package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +0 -0
  149. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -1,957 +0,0 @@
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 };