@cardenelabs/cdl 0.40.2 → 0.40.3

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.
package/dist/index.js CHANGED
@@ -24886,8 +24886,18 @@ function ChartGaugeNode({
24886
24886
  const \u4F7F\u3048\u308B\u5E452 = node.w - PAD_SIDE * 2;
24887
24887
  const \u540D\u524D\u306E\u7D1A = 14;
24888
24888
  const \u6570\u5024\u306E\u7D1A = 13;
24889
- const \u5185\u8A33\u306E\u9AD8\u3055 = 56;
24889
+ const \u6BB5\u306E\u9AD8\u3055 = 56;
24890
24890
  const \u5F27\u3068\u5185\u8A33\u306E\u9593 = 16;
24891
+ const \u5370\u306E\u5E452 = 30;
24892
+ const \u533A\u753B\u306E\u9593 = 12;
24893
+ const \u5185\u8A33\u306E\u6570\u5024 = data.map((d) => `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`);
24894
+ const \u4EF6\u306B\u8981\u308B\u5E45 = Math.max(\u5370\u306E\u5E452, ...\u5185\u8A33\u306E\u6570\u5024.map((t) => textWidth(t, \u6570\u5024\u306E\u7D1A))) + \u533A\u753B\u306E\u9593;
24895
+ const \u884C\u306E\u4EF6\u6570 = Math.min(
24896
+ Math.max(1, Math.floor(\u4F7F\u3048\u308B\u5E452 / Math.max(\u4EF6\u306B\u8981\u308B\u5E45, 1))),
24897
+ Math.max(data.length, 1)
24898
+ );
24899
+ const \u5185\u8A33\u306E\u6BB5\u6570 = Math.ceil(Math.max(data.length, 1) / \u884C\u306E\u4EF6\u6570);
24900
+ const \u5185\u8A33\u306E\u9AD8\u3055 = \u6BB5\u306E\u9AD8\u3055 * \u5185\u8A33\u306E\u6BB5\u6570;
24891
24901
  const \u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055 = \u4F7F\u3048\u308B\u9AD8\u3055 - \u5185\u8A33\u306E\u9AD8\u3055 - \u5F27\u3068\u5185\u8A33\u306E\u9593;
24892
24902
  const radius = Math.max(24, Math.min(\u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055, \u4F7F\u3048\u308B\u5E452 / 2));
24893
24903
  const \u5185\u534A\u5F84 = radius * 0.62;
@@ -24916,7 +24926,7 @@ function ChartGaugeNode({
24916
24926
  );
24917
24927
  const \u5408\u8A08\u306E\u7D1A = Math.max(11, Math.round(\u7D1A\u306E\u5019\u88DC));
24918
24928
  const \u898B\u51FA\u3057\u306E\u7D1A = Math.max(9, Math.round(\u5408\u8A08\u306E\u7D1A * 0.38));
24919
- const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / Math.max(data.length, 1);
24929
+ const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / \u884C\u306E\u4EF6\u6570;
24920
24930
  const \u5185\u8A33\u306Ey = cy + \u5F27\u3068\u5185\u8A33\u306E\u9593;
24921
24931
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
24922
24932
  const \u5207\u308A\u629C\u304Did = `cdl-gauge-draw-${useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
@@ -24974,22 +24984,35 @@ function ChartGaugeNode({
24974
24984
  }
24975
24985
  ),
24976
24986
  data.map((d, idx) => {
24977
- const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * idx;
24978
- const \u6570\u5024 = `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`;
24987
+ const \u5217 = idx % \u884C\u306E\u4EF6\u6570;
24988
+ const \u6BB5 = Math.floor(idx / \u884C\u306E\u4EF6\u6570);
24989
+ const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * \u5217;
24990
+ const y = \u5185\u8A33\u306Ey + \u6BB5\u306E\u9AD8\u3055 * \u6BB5;
24991
+ const \u53CE\u307E\u308B\u5E45 = \u5185\u8A33\u306E\u5E45 - \u533A\u753B\u306E\u9593;
24979
24992
  return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-gauge-item", children: [
24980
- /* @__PURE__ */ jsx("rect", { x, y: \u5185\u8A33\u306Ey, width: 30, height: 4, rx: 2, fill: arcColor(d.tone, idx) }),
24993
+ /* @__PURE__ */ jsx(
24994
+ "rect",
24995
+ {
24996
+ x,
24997
+ y,
24998
+ width: Math.max(4, Math.min(\u5370\u306E\u5E452, \u53CE\u307E\u308B\u5E45)),
24999
+ height: 4,
25000
+ rx: 2,
25001
+ fill: arcColor(d.tone, idx)
25002
+ }
25003
+ ),
24981
25004
  /* @__PURE__ */ jsx(
24982
25005
  "text",
24983
25006
  {
24984
25007
  x,
24985
- y: \u5185\u8A33\u306Ey + 26,
25008
+ y: y + 26,
24986
25009
  fontSize: \u540D\u524D\u306E\u7D1A,
24987
25010
  fontWeight: 700,
24988
25011
  fill: "var(--cdl-text, #1a1f2a)",
24989
- children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u5185\u8A33\u306E\u5E45 - 12, \u540D\u524D\u306E\u7D1A)
25012
+ children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u53CE\u307E\u308B\u5E45, \u540D\u524D\u306E\u7D1A)
24990
25013
  }
24991
25014
  ),
24992
- /* @__PURE__ */ jsx("text", { x, y: \u5185\u8A33\u306Ey + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u6570\u5024 })
25015
+ /* @__PURE__ */ jsx("text", { x, y: y + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u5207\u308A\u8A70\u3081\u308B(\u5185\u8A33\u306E\u6570\u5024[idx] ?? "", \u53CE\u307E\u308B\u5E45, \u6570\u5024\u306E\u7D1A) })
24993
25016
  ] }, `legend-${idx}`);
24994
25017
  })
24995
25018
  ] });