@validationcloud/fractal-ui 1.76.0 → 1.78.0

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 (35) hide show
  1. package/README.md +22 -0
  2. package/dist/charts.d.ts +2 -0
  3. package/dist/charts.js +29 -20
  4. package/dist/components/dropdown-menu/dropdown-menu.js +34 -26
  5. package/dist/components/echarts-renderer/geo/africa-countries.json.d.ts +2463 -0
  6. package/dist/components/echarts-renderer/geo/africa-countries.json.js +9 -0
  7. package/dist/components/echarts-renderer/geo/americas-countries.json.d.ts +4160 -0
  8. package/dist/components/echarts-renderer/geo/americas-countries.json.js +9 -0
  9. package/dist/components/echarts-renderer/geo/asia-countries.json.d.ts +4275 -0
  10. package/dist/components/echarts-renderer/geo/asia-countries.json.js +9 -0
  11. package/dist/components/echarts-renderer/geo/europe-countries.json.d.ts +2407 -0
  12. package/dist/components/echarts-renderer/geo/europe-countries.json.js +9 -0
  13. package/dist/components/echarts-renderer/geo/us-states.json.d.ts +1338 -0
  14. package/dist/components/echarts-renderer/geo/us-states.json.js +9 -0
  15. package/dist/components/echarts-renderer/geo/world-continents.json.d.ts +10639 -0
  16. package/dist/components/echarts-renderer/geo/world-continents.json.js +9 -0
  17. package/dist/components/echarts-renderer/geo/world-countries.json.d.ts +14549 -0
  18. package/dist/components/echarts-renderer/geo/world-countries.json.js +9 -0
  19. package/dist/components/echarts-renderer/geo/world-regions.json.d.ts +10621 -0
  20. package/dist/components/echarts-renderer/geo/world-regions.json.js +9 -0
  21. package/dist/components/echarts-renderer/map-centers.d.ts +2 -0
  22. package/dist/components/echarts-renderer/map-centers.js +13 -0
  23. package/dist/components/echarts-renderer/map-style.d.ts +12 -0
  24. package/dist/components/echarts-renderer/map-style.js +12 -0
  25. package/dist/components/echarts-renderer/natural-earth-projection.d.ts +29 -0
  26. package/dist/components/echarts-renderer/natural-earth-projection.js +64 -0
  27. package/dist/components/echarts-renderer/register-map.d.ts +24 -0
  28. package/dist/components/echarts-renderer/register-map.js +62 -0
  29. package/dist/components/echarts-renderer/use-chart-instance.js +38 -36
  30. package/dist/components/icon/icon-ids.d.ts +1 -1
  31. package/dist/components/mount-svg-sprite/mount-svg-sprite.js +1 -1
  32. package/dist/hooks/use-scroll-to-bottom.d.ts +4 -3
  33. package/dist/lib/render-chart-to-image.js +72 -43
  34. package/dist/maps.json +438 -0
  35. package/package.json +19 -4
@@ -1,56 +1,58 @@
1
1
  "use client";
2
- import { useRef as d, useState as T, useEffect as I, useCallback as S } from "react";
2
+ import { useRef as f, useState as T, useEffect as I, useCallback as S } from "react";
3
3
  import { calculateTitleLayout as m } from "./calculate-title-layout.js";
4
4
  import { replaceFormatterTokens as O } from "./formatters/replace-formatter-tokens.js";
5
5
  import { mergeThemeGraphicIntoOptions as R } from "./merge-theme-graphic-into-options.js";
6
+ import { getRequiredMapName as j, registerMapAsync as x } from "./register-map.js";
6
7
  import { sanitizeChartOptions as w } from "./sanitize-chart-options.js";
7
8
  const W = /* @__PURE__ */ new Set();
8
- function L({ options: o, theme: t }) {
9
- const n = d(null), c = d(null), y = d(o), C = d(t?.config), z = d(t?.config.graphic), [b, v] = T(!1);
10
- y.current = o, C.current = t?.config, z.current = t?.config.graphic, I(() => {
11
- const s = n.current;
9
+ function B({ options: i, theme: t }) {
10
+ const e = f(null), o = f(null), y = f(i), C = f(t?.config), z = f(t?.config.graphic), [b, v] = T(!1);
11
+ y.current = i, C.current = t?.config, z.current = t?.config.graphic, I(() => {
12
+ const s = e.current;
12
13
  if (!s) return;
13
- let r = !0, e;
14
- const f = new ResizeObserver((i) => {
15
- const a = i[0], u = c.current;
16
- if (!a || !u) return;
17
- const p = a.contentRect.width, g = w(y.current), l = O(g), h = m(l, p, C.current);
18
- u.setOption(R(h, z.current), {
14
+ let r = !0, n;
15
+ const d = new ResizeObserver((c) => {
16
+ const u = c[0], a = o.current;
17
+ if (!u || !a) return;
18
+ const p = u.contentRect.width, g = w(y.current), l = O(g), h = m(l, p, C.current);
19
+ a.setOption(R(h, z.current), {
19
20
  replaceMerge: ["graphic"]
20
- }), u.resize();
21
+ }), a.resize();
21
22
  });
22
- return f.observe(s), (async () => {
23
+ return d.observe(s), (async () => {
23
24
  try {
24
- const i = await import("echarts");
25
- if (!r || !n.current) return;
26
- if (t && !W.has(t.name)) {
27
- const { graphic: h, ...F } = t.config;
28
- i.registerTheme(t.name, F), W.add(t.name);
25
+ const c = await import("echarts");
26
+ if (!r || !e.current) return;
27
+ const u = j(i);
28
+ if (u && await x(c, u), t && !W.has(t.name)) {
29
+ const { graphic: F, ...M } = t.config;
30
+ c.registerTheme(t.name, M), W.add(t.name);
29
31
  }
30
- const a = i.getInstanceByDom(n.current);
31
- a && a.dispose(), e = i.init(n.current, t?.name, {
32
+ const a = c.getInstanceByDom(e.current);
33
+ a && a.dispose(), n = c.init(e.current, t?.name, {
32
34
  renderer: "svg"
33
- }), c.current = e;
34
- const u = n.current.clientWidth, p = w(o), g = O(p), l = m(g, u, t?.config);
35
- e.setOption(R(l, t?.config.graphic), {
35
+ }), o.current = n;
36
+ const p = e.current.clientWidth, g = w(i), l = O(g), h = m(l, p, t?.config);
37
+ n.setOption(R(h, t?.config.graphic), {
36
38
  replaceMerge: ["graphic"]
37
- }), e.resize(), v(!0);
38
- } catch (i) {
39
- console.error("Failed to load echarts", i);
39
+ }), n.resize(), v(!0);
40
+ } catch (c) {
41
+ console.error("Failed to load echarts", c);
40
42
  }
41
43
  })(), () => {
42
- r = !1, f.disconnect(), e && e.dispose(), c.current = null, v(!1);
44
+ r = !1, d.disconnect(), n && n.dispose(), o.current = null, v(!1);
43
45
  };
44
- }, [t, o]), I(() => {
45
- if (!b || !c.current || !n.current) return;
46
- const s = n.current.clientWidth, r = w(o), e = O(r), f = m(e, s, t?.config);
47
- c.current.setOption(R(f, t?.config.graphic), {
46
+ }, [t, i]), I(() => {
47
+ if (!b || !o.current || !e.current) return;
48
+ const s = e.current.clientWidth, r = w(i), n = O(r), d = m(n, s, t?.config);
49
+ o.current.setOption(R(d, t?.config.graphic), {
48
50
  replaceMerge: ["graphic"]
49
51
  });
50
- }, [b, o, t?.config, t?.config.graphic]);
52
+ }, [b, i, t?.config, t?.config.graphic]);
51
53
  const k = S(async () => {
52
- if (!c.current) return;
53
- const s = c.current.getDataURL({
54
+ if (!o.current) return;
55
+ const s = o.current.getDataURL({
54
56
  type: "png",
55
57
  pixelRatio: 2,
56
58
  backgroundColor: "#fff"
@@ -58,10 +60,10 @@ function L({ options: o, theme: t }) {
58
60
  r.download = `chart-${(/* @__PURE__ */ new Date()).toISOString()}.png`, r.href = s, document.body.appendChild(r), r.click(), document.body.removeChild(r);
59
61
  }, []);
60
62
  return {
61
- containerRef: n,
63
+ containerRef: e,
62
64
  downloadChart: k
63
65
  };
64
66
  }
65
67
  export {
66
- L as useChartInstance
68
+ B as useChartInstance
67
69
  };
@@ -1 +1 @@
1
- export declare const iconIds: readonly ["arrow-narrow", "arrow", "banknote", "bar-chart", "billing", "bracket", "check", "chevron-vertical", "chevron", "circle-fill", "circle-stroke", "clock", "close", "cog", "collapse", "copy", "documents", "download", "edit", "enter", "exclamation", "expand", "faucet", "fire", "key", "filter", "help-center", "home", "info", "intercom", "link", "logout", "menu", "more", "minus", "node", "patch", "pin", "plus", "processing", "radio-empty", "radio-full", "resize", "search", "share", "sparkles", "step-indicator", "subgraphs", "sync-problem", "trash", "thumb", "unpin", "user", "wallet", "wallet-connected", "wallet-disconnected", "wrench"];
1
+ export declare const iconIds: readonly ["arrow-narrow", "arrow", "banknote", "bar-chart", "billing", "bracket", "check", "chevron-vertical", "chevron", "circle-fill", "circle-stroke", "clock", "close", "cog", "collapse", "copy", "documents", "download", "edit", "enter", "exclamation", "expand", "faucet", "fire", "key", "filter", "help-center", "home", "info", "intercom", "link", "logout", "menu", "more", "minus", "node", "patch", "pin", "plus", "processing", "radio-empty", "radio-full", "resize", "search", "share", "sparkles", "step-indicator", "subgraphs", "sync-problem", "team", "trash", "thumb", "unpin", "user", "wallet", "wallet-connected", "wallet-disconnected", "wrench"];