sellmate-design-system-react 9.0.0-beta.65 → 9.0.0-beta.66

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.
@@ -16,6 +16,7 @@
16
16
  | `showValueLabel?` | `boolean` | `false` | 고리 위에 몫(%)을 적는다. 좁은 조각은 글자가 넘치므로 적지 않는다 |
17
17
  | `showLegend?` | `boolean` | `true` | 범례를 보인다 |
18
18
  | `legendPosition?` | `SDonutChartLegendPosition` | `'top'` | 범례 위치 |
19
+ | `legendVariant?` | `SDonutChartLegendVariant` | `'simple'` | 범례 모양. `simple` 이름만 가로로 · `default` 이름+값을 세로로 쌓는 목록 |
19
20
  | `showTooltip?` | `boolean` | `true` | 조각에 마우스를 올리면 값 상자를 띄운다 |
20
21
  | `formatValue?` | `(value: number) => string` | — | 값 표시 형식 |
21
22
  | `tooltipFooter?` | `(slice: SDonutChartSlicePoint) => ReactNode` | — | 툴팁의 값 아래에 덧붙일 내용. 짚은 조각을 받아 그린다 — 몫·값만으로 모자란 맥락 (전월 대비, 건수 등)을 적는다. 툴팁은 누를 수 없으므로 버튼·링크는 넣지 않는다 |
@@ -77,6 +78,17 @@ export type SDonutChartColor =
77
78
  export type SDonutChartLegendPosition = 'top' | 'bottom';
78
79
  ```
79
80
 
81
+ ### SDonutChartLegendVariant
82
+
83
+ ```ts
84
+ /**
85
+ * 범례 모양.
86
+ * - `simple` 이름만 가로로 나열한다 (값 없음)
87
+ * - `default` 이름 뒤에 값을 적어 세로로 쌓는 목록이다
88
+ */
89
+ export type SDonutChartLegendVariant = 'simple' | 'default';
90
+ ```
91
+
80
92
  ### SDonutChartSlicePoint
81
93
 
82
94
  ```ts
@@ -1,6 +1,12 @@
1
1
  import { type CSSProperties, type ReactNode } from 'react';
2
2
  /** 범례 위치. */
3
3
  export type SDonutChartLegendPosition = 'top' | 'bottom';
4
+ /**
5
+ * 범례 모양.
6
+ * - `simple` 이름만 가로로 나열한다 (값 없음)
7
+ * - `default` 이름 뒤에 값을 적어 세로로 쌓는 목록이다
8
+ */
9
+ export type SDonutChartLegendVariant = 'simple' | 'default';
4
10
  /**
5
11
  * 색 팔레트. 조각마다 색이 달라야 하므로 한 색(`default`)은 없다.
6
12
  * - `multi` 서로 무관한 항목(11색)을 순서대로
@@ -46,6 +52,8 @@ export interface SDonutChartProps {
46
52
  showLegend?: boolean;
47
53
  /** 범례 위치 */
48
54
  legendPosition?: SDonutChartLegendPosition;
55
+ /** 범례 모양. `simple` 이름만 가로로 · `default` 이름+값을 세로로 쌓는 목록 */
56
+ legendVariant?: SDonutChartLegendVariant;
49
57
  /** 조각에 마우스를 올리면 값 상자를 띄운다 */
50
58
  showTooltip?: boolean;
51
59
  /** 값 표시 형식 */
@@ -13,6 +13,7 @@
13
13
  | `title?` | `string` | — | 차트 제목 — 왼쪽 위에 놓인다 |
14
14
  | `unit?` | `string` | — | 단위 — 오른쪽 위에 "단위 : " 를 붙여 놓는다 |
15
15
  | `curve?` | `SLineChartCurve` | `'linear'` | 점을 잇는 방식. `smooth` 는 값을 넘어가 부풀지 않는 곡선이다 |
16
+ | `lineStyle?` | `SLineChartLineStyle` | `'solid'` | 선 모양. `dashed` 는 차트의 모든 선을 점선으로 그린다 |
16
17
  | `area?` | `boolean` | `false` | 선 아래를 계열 색으로 채운다. 크기의 변화를 함께 보여줄 때 쓴다 |
17
18
  | `stacked?` | `boolean` | `false` | 계열을 겹쳐 그리는 대신 **아래 계열 위에 쌓는다**. 전체의 크기와 그 안의 구성을 함께 볼 때 쓴다 — 맨 위 선이 곧 합계다. 툴팁은 쌓기 전 각 계열의 값을 보여준다 |
18
19
  | `palette?` | `SLineChartPalette` | `'default'` | 색 팔레트. `custom` 일 때만 `colors` 를 본다 |
@@ -57,6 +58,13 @@ export interface SLineChartSeries {
57
58
  export type SLineChartCurve = 'linear' | 'smooth';
58
59
  ```
59
60
 
61
+ ### SLineChartLineStyle
62
+
63
+ ```ts
64
+ /** 선 모양. `dashed` 는 차트의 모든 선에 적용된다 — 일부 계열만 점선으로 구분하려면 쓰지 않는다 */
65
+ export type SLineChartLineStyle = 'solid' | 'dashed';
66
+ ```
67
+
60
68
  ### SLineChartPalette
61
69
 
62
70
  ```ts
@@ -1,6 +1,8 @@
1
1
  import { type CSSProperties, type ReactNode } from 'react';
2
2
  /** 점과 점을 잇는 방식. */
3
3
  export type SLineChartCurve = 'linear' | 'smooth';
4
+ /** 선 모양. `dashed` 는 차트의 모든 선에 적용된다 — 일부 계열만 점선으로 구분하려면 쓰지 않는다 */
5
+ export type SLineChartLineStyle = 'solid' | 'dashed';
4
6
  /** 범례 위치. */
5
7
  export type SLineChartLegendPosition = 'top' | 'bottom';
6
8
  /**
@@ -52,6 +54,8 @@ export interface SLineChartProps {
52
54
  unit?: string;
53
55
  /** 점을 잇는 방식. `smooth` 는 값을 넘어가 부풀지 않는 곡선이다 */
54
56
  curve?: SLineChartCurve;
57
+ /** 선 모양. `dashed` 는 차트의 모든 선을 점선으로 그린다 */
58
+ lineStyle?: SLineChartLineStyle;
55
59
  /** 선 아래를 계열 색으로 채운다. 크기의 변화를 함께 보여줄 때 쓴다 */
56
60
  area?: boolean;
57
61
  /**
@@ -28,6 +28,13 @@ export declare const LINE_WIDTH = "var(--cmp-chart-line-width)";
28
28
  * 선이 진해지면 굵기 탓에 짚지 않은 이웃 계열까지 덮는다.
29
29
  */
30
30
  export declare const LINE_OPACITY = "var(--cmp-chart-line-opacity)";
31
+ /**
32
+ * 점선 패턴(SVG `stroke-dasharray`, px) — dash 11·gap 11.
33
+ *
34
+ * `chart.line.*` 에 점선 토큰이 없어 시안 SVG 실측값을 그대로 옮긴다(선 두께 4px 기준
35
+ * dash:gap = 1:1). 토큰이 아니므로 두께가 바뀌면 이 값도 함께 검토해야 한다.
36
+ */
37
+ export declare const LINE_DASH = "11 11";
31
38
  /** 점의 반지름(px) — 토큰 `chart.line.point.size.default`(지름 10)의 절반. */
32
39
  export declare const POINT_RADIUS = 5;
33
40
  /** 짚은 항목의 점 — 토큰 `chart.line.point.size.hover`(지름 12)의 절반. 색은 그대로고 커지기만 한다. */
package/dist/index.cjs CHANGED
@@ -19637,8 +19637,51 @@ var ChartFrame = /* @__PURE__ */ react.forwardRef(function ChartFrame2({ title,
19637
19637
  );
19638
19638
  });
19639
19639
  var DOT_SIZE = 6;
19640
- function ChartLegend({ items, align = "center", activeIndex, className }) {
19640
+ function ChartLegend({
19641
+ items,
19642
+ align = "center",
19643
+ activeIndex,
19644
+ className,
19645
+ variant = "simple"
19646
+ }) {
19641
19647
  if (items.length === 0) return null;
19648
+ const dot = (color) => /* @__PURE__ */ jsxRuntime.jsx(
19649
+ "span",
19650
+ {
19651
+ "aria-hidden": true,
19652
+ className: "shrink-0 rounded-full",
19653
+ style: { width: DOT_SIZE, height: DOT_SIZE, background: color }
19654
+ }
19655
+ );
19656
+ if (variant === "default") {
19657
+ return /* @__PURE__ */ jsxRuntime.jsx(
19658
+ "ul",
19659
+ {
19660
+ className: cn(
19661
+ "flex list-none flex-col gap-(--cmp-chart-doughnut-legend-data-default-gap) p-0",
19662
+ className
19663
+ ),
19664
+ children: items.map((item4, index) => /* @__PURE__ */ jsxRuntime.jsxs(
19665
+ "li",
19666
+ {
19667
+ className: cn(
19668
+ "flex items-center gap-(--cmp-chart-legendItem-gap)",
19669
+ "py-(--cmp-chart-legendItem-paddingY)",
19670
+ "typo-body-sm-medium text-(--cmp-chart-legendItem-color)",
19671
+ "transition-opacity duration-200 ease-out motion-reduce:transition-none",
19672
+ activeIndex != null && activeIndex !== index && "opacity-(--opacity-060)"
19673
+ ),
19674
+ children: [
19675
+ dot(item4.color),
19676
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: item4.name }),
19677
+ item4.value != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto typo-body-sm-bold", style: { color: item4.valueColor }, children: item4.value })
19678
+ ]
19679
+ },
19680
+ `${item4.name}-${index}`
19681
+ ))
19682
+ }
19683
+ );
19684
+ }
19642
19685
  return /* @__PURE__ */ jsxRuntime.jsx(
19643
19686
  "ul",
19644
19687
  {
@@ -19660,14 +19703,7 @@ function ChartLegend({ items, align = "center", activeIndex, className }) {
19660
19703
  activeIndex != null && activeIndex !== index && "opacity-(--opacity-060)"
19661
19704
  ),
19662
19705
  children: [
19663
- /* @__PURE__ */ jsxRuntime.jsx(
19664
- "span",
19665
- {
19666
- "aria-hidden": true,
19667
- className: "shrink-0 rounded-full",
19668
- style: { width: DOT_SIZE, height: DOT_SIZE, background: item4.color }
19669
- }
19670
- ),
19706
+ dot(item4.color),
19671
19707
  item4.name
19672
19708
  ]
19673
19709
  },
@@ -19680,6 +19716,7 @@ function ChartLegend({ items, align = "center", activeIndex, className }) {
19680
19716
  // src/lib/chart/palette.ts
19681
19717
  var V3 = (path) => `var(--cmp-chart-palette-${path})`;
19682
19718
  var DIMMED = (path) => `var(--cmp-chart-line-point-dimmed-palette-${path})`;
19719
+ var VALUE = (path) => `var(--cmp-chart-dataValue-palette-${path})`;
19683
19720
  var colorsOf = (v) => ({
19684
19721
  positivePrimary: v("variation-positivePrimary"),
19685
19722
  positiveSecondary: v("variation-positiveSecondary"),
@@ -19716,6 +19753,31 @@ var CHART_COLORS = colorsOf(V3);
19716
19753
  var CHART_PALETTES = palettesOf(V3);
19717
19754
  var DIMMED_COLORS = colorsOf(DIMMED);
19718
19755
  var DIMMED_PALETTES = palettesOf(DIMMED);
19756
+ var DATA_VALUE_COLORS = colorsOf(VALUE);
19757
+ var DATA_VALUE_PALETTES = {
19758
+ default: [DATA_VALUE_COLORS.positivePrimary],
19759
+ multi: [
19760
+ VALUE("multi-blue"),
19761
+ VALUE("multi-skyblue"),
19762
+ VALUE("multi-yellow"),
19763
+ VALUE("multi-olive"),
19764
+ VALUE("multi-lightRed"),
19765
+ VALUE("multi-warmBlue"),
19766
+ VALUE("multi-orange"),
19767
+ VALUE("multi-green"),
19768
+ VALUE("multi-navy"),
19769
+ VALUE("multi-grey"),
19770
+ VALUE("multi-red")
19771
+ ],
19772
+ gradation: [
19773
+ V3("gradation-1"),
19774
+ V3("gradation-2"),
19775
+ V3("gradation-3"),
19776
+ V3("gradation-4"),
19777
+ V3("gradation-5"),
19778
+ VALUE("gradation-6")
19779
+ ]
19780
+ };
19719
19781
  function pick(names, palettes, palette, index, colors) {
19720
19782
  if (palette === "custom") {
19721
19783
  if (!colors?.length) return palettes.default[0];
@@ -19730,6 +19792,9 @@ function paletteColor(palette, index, colors) {
19730
19792
  function linePointDimmedColor(palette, index, colors) {
19731
19793
  return pick(DIMMED_COLORS, DIMMED_PALETTES, palette, index, colors);
19732
19794
  }
19795
+ function dataValueColor(palette, index, colors) {
19796
+ return pick(DATA_VALUE_COLORS, DATA_VALUE_PALETTES, palette, index, colors);
19797
+ }
19733
19798
  function useElementSize() {
19734
19799
  const ref = react.useRef(null);
19735
19800
  const [size, setSize] = react.useState({ width: 0, height: 0 });
@@ -20431,6 +20496,7 @@ var SBarChart = /* @__PURE__ */ react.forwardRef(function SBarChart2({
20431
20496
  // src/components/SLineChart/lineChart.config.ts
20432
20497
  var LINE_WIDTH = "var(--cmp-chart-line-width)";
20433
20498
  var LINE_OPACITY = "var(--cmp-chart-line-opacity)";
20499
+ var LINE_DASH = "11 11";
20434
20500
  var POINT_RADIUS = 5;
20435
20501
  var POINT_HOVER_RADIUS = 6;
20436
20502
  var POINT_HALO_RADIUS = 12;
@@ -20523,6 +20589,7 @@ var SLineChart = /* @__PURE__ */ react.forwardRef(function SLineChart2({
20523
20589
  title,
20524
20590
  unit,
20525
20591
  curve = "linear",
20592
+ lineStyle = "solid",
20526
20593
  area = false,
20527
20594
  stacked = false,
20528
20595
  palette = "default",
@@ -20731,14 +20798,15 @@ var SLineChart = /* @__PURE__ */ react.forwardRef(function SLineChart2({
20731
20798
  style: {
20732
20799
  stroke: colorAt(seriesIndex),
20733
20800
  strokeWidth: LINE_WIDTH,
20734
- strokeOpacity: LINE_OPACITY
20801
+ strokeOpacity: LINE_OPACITY,
20802
+ strokeDasharray: lineStyle === "dashed" ? LINE_DASH : void 0
20735
20803
  }
20736
20804
  },
20737
20805
  `line-${seriesIndex}-${runIndex}`
20738
20806
  );
20739
20807
  })
20740
20808
  ),
20741
- [plotted, smooth, colorAt]
20809
+ [plotted, smooth, colorAt, lineStyle]
20742
20810
  );
20743
20811
  const { pointHalos, pointDots } = react.useMemo(() => {
20744
20812
  const halos = [];
@@ -21018,6 +21086,7 @@ var RadialChart = /* @__PURE__ */ react.forwardRef(function RadialChart2({
21018
21086
  showValueLabel = false,
21019
21087
  showLegend = true,
21020
21088
  legendPosition = "top",
21089
+ legendVariant = "simple",
21021
21090
  showTooltip = true,
21022
21091
  formatValue = defaultFormat3,
21023
21092
  onSliceClick,
@@ -21045,7 +21114,8 @@ var RadialChart = /* @__PURE__ */ react.forwardRef(function RadialChart2({
21045
21114
  ratio,
21046
21115
  start,
21047
21116
  end: angle,
21048
- color: paletteColor(effective, slice2.index, colors)
21117
+ color: paletteColor(effective, slice2.index, colors),
21118
+ valueColor: dataValueColor(effective, slice2.index, colors)
21049
21119
  };
21050
21120
  });
21051
21121
  return list;
@@ -21058,8 +21128,14 @@ var RadialChart = /* @__PURE__ */ react.forwardRef(function RadialChart2({
21058
21128
  const legend = showLegend ? /* @__PURE__ */ jsxRuntime.jsx(
21059
21129
  ChartLegend,
21060
21130
  {
21061
- items: arcs.map((arc2) => ({ name: arc2.name, color: arc2.color })),
21062
- activeIndex: hoveredArc ? arcs.indexOf(hoveredArc) : null
21131
+ items: arcs.map((arc2) => ({
21132
+ name: arc2.name,
21133
+ color: arc2.color,
21134
+ value: legendVariant === "default" ? formatValue(arc2.value) : void 0,
21135
+ valueColor: arc2.valueColor
21136
+ })),
21137
+ activeIndex: hoveredArc ? arcs.indexOf(hoveredArc) : null,
21138
+ variant: legendVariant
21063
21139
  }
21064
21140
  ) : null;
21065
21141
  const tooltipAnchor = react.useMemo(() => {
@@ -21218,6 +21294,7 @@ var SDonutChart = /* @__PURE__ */ react.forwardRef(function SDonutChart2({
21218
21294
  showValueLabel = false,
21219
21295
  showLegend = true,
21220
21296
  legendPosition = "top",
21297
+ legendVariant = "simple",
21221
21298
  showTooltip = true,
21222
21299
  ...props
21223
21300
  }, ref) {
@@ -21230,6 +21307,7 @@ var SDonutChart = /* @__PURE__ */ react.forwardRef(function SDonutChart2({
21230
21307
  showValueLabel,
21231
21308
  showLegend,
21232
21309
  legendPosition,
21310
+ legendVariant,
21233
21311
  showTooltip,
21234
21312
  innerRatio: DONUT_INNER_RATIO,
21235
21313
  kind: "\uB3C4\uB11B \uADF8\uB798\uD504"