@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/react.js CHANGED
@@ -12387,8 +12387,18 @@ function ChartGaugeNode({
12387
12387
  const \u4F7F\u3048\u308B\u5E452 = node.w - PAD_SIDE * 2;
12388
12388
  const \u540D\u524D\u306E\u7D1A = 14;
12389
12389
  const \u6570\u5024\u306E\u7D1A = 13;
12390
- const \u5185\u8A33\u306E\u9AD8\u3055 = 56;
12390
+ const \u6BB5\u306E\u9AD8\u3055 = 56;
12391
12391
  const \u5F27\u3068\u5185\u8A33\u306E\u9593 = 16;
12392
+ const \u5370\u306E\u5E452 = 30;
12393
+ const \u533A\u753B\u306E\u9593 = 12;
12394
+ const \u5185\u8A33\u306E\u6570\u5024 = data.map((d) => `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`);
12395
+ 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;
12396
+ const \u884C\u306E\u4EF6\u6570 = Math.min(
12397
+ Math.max(1, Math.floor(\u4F7F\u3048\u308B\u5E452 / Math.max(\u4EF6\u306B\u8981\u308B\u5E45, 1))),
12398
+ Math.max(data.length, 1)
12399
+ );
12400
+ const \u5185\u8A33\u306E\u6BB5\u6570 = Math.ceil(Math.max(data.length, 1) / \u884C\u306E\u4EF6\u6570);
12401
+ const \u5185\u8A33\u306E\u9AD8\u3055 = \u6BB5\u306E\u9AD8\u3055 * \u5185\u8A33\u306E\u6BB5\u6570;
12392
12402
  const \u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055 = \u4F7F\u3048\u308B\u9AD8\u3055 - \u5185\u8A33\u306E\u9AD8\u3055 - \u5F27\u3068\u5185\u8A33\u306E\u9593;
12393
12403
  const radius = Math.max(24, Math.min(\u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055, \u4F7F\u3048\u308B\u5E452 / 2));
12394
12404
  const \u5185\u534A\u5F84 = radius * 0.62;
@@ -12417,7 +12427,7 @@ function ChartGaugeNode({
12417
12427
  );
12418
12428
  const \u5408\u8A08\u306E\u7D1A = Math.max(11, Math.round(\u7D1A\u306E\u5019\u88DC));
12419
12429
  const \u898B\u51FA\u3057\u306E\u7D1A = Math.max(9, Math.round(\u5408\u8A08\u306E\u7D1A * 0.38));
12420
- const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / Math.max(data.length, 1);
12430
+ const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / \u884C\u306E\u4EF6\u6570;
12421
12431
  const \u5185\u8A33\u306Ey = cy + \u5F27\u3068\u5185\u8A33\u306E\u9593;
12422
12432
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
12423
12433
  const \u5207\u308A\u629C\u304Did = `cdl-gauge-draw-${useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
@@ -12475,22 +12485,35 @@ function ChartGaugeNode({
12475
12485
  }
12476
12486
  ),
12477
12487
  data.map((d, idx) => {
12478
- const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * idx;
12479
- const \u6570\u5024 = `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`;
12488
+ const \u5217 = idx % \u884C\u306E\u4EF6\u6570;
12489
+ const \u6BB5 = Math.floor(idx / \u884C\u306E\u4EF6\u6570);
12490
+ const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * \u5217;
12491
+ const y = \u5185\u8A33\u306Ey + \u6BB5\u306E\u9AD8\u3055 * \u6BB5;
12492
+ const \u53CE\u307E\u308B\u5E45 = \u5185\u8A33\u306E\u5E45 - \u533A\u753B\u306E\u9593;
12480
12493
  return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-gauge-item", children: [
12481
- /* @__PURE__ */ jsx("rect", { x, y: \u5185\u8A33\u306Ey, width: 30, height: 4, rx: 2, fill: arcColor(d.tone, idx) }),
12494
+ /* @__PURE__ */ jsx(
12495
+ "rect",
12496
+ {
12497
+ x,
12498
+ y,
12499
+ width: Math.max(4, Math.min(\u5370\u306E\u5E452, \u53CE\u307E\u308B\u5E45)),
12500
+ height: 4,
12501
+ rx: 2,
12502
+ fill: arcColor(d.tone, idx)
12503
+ }
12504
+ ),
12482
12505
  /* @__PURE__ */ jsx(
12483
12506
  "text",
12484
12507
  {
12485
12508
  x,
12486
- y: \u5185\u8A33\u306Ey + 26,
12509
+ y: y + 26,
12487
12510
  fontSize: \u540D\u524D\u306E\u7D1A,
12488
12511
  fontWeight: 700,
12489
12512
  fill: "var(--cdl-text, #1a1f2a)",
12490
- children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u5185\u8A33\u306E\u5E45 - 12, \u540D\u524D\u306E\u7D1A)
12513
+ children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u53CE\u307E\u308B\u5E45, \u540D\u524D\u306E\u7D1A)
12491
12514
  }
12492
12515
  ),
12493
- /* @__PURE__ */ jsx("text", { x, y: \u5185\u8A33\u306Ey + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u6570\u5024 })
12516
+ /* @__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) })
12494
12517
  ] }, `legend-${idx}`);
12495
12518
  })
12496
12519
  ] });