@wello-dev/charts 1.0.3 → 1.0.4
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/README.md +155 -155
- package/dist/index.cjs +72 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +72 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +62 -22
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -10,10 +10,17 @@
|
|
|
10
10
|
.wello-chart {
|
|
11
11
|
--wello-chart-primary: var(--wello-primary-color, var(--primary, #26372c));
|
|
12
12
|
--wello-chart-bg: var(--wello-color-surface, var(--card, #ffffff));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/*
|
|
14
|
+
* Axis text, grid and legend follow the text color of the surface the chart sits on,
|
|
15
|
+
* so the same chart reads on a white card and on a dark hero panel with no overrides.
|
|
16
|
+
* `currentColor` resolves where each token is used (the chart root keeps the inherited color).
|
|
17
|
+
*/
|
|
18
|
+
--wello-chart-text-color: color-mix(in srgb, currentColor 50%, transparent);
|
|
19
|
+
--wello-chart-legend-color: color-mix(in srgb, currentColor 85%, transparent);
|
|
20
|
+
--wello-chart-bright-color: currentColor;
|
|
21
|
+
--wello-chart-dimmed-color: color-mix(in srgb, currentColor 50%, transparent);
|
|
22
|
+
/* ≈ Mantine's rgba(gray, .6) grid: visible as a dashed line on light and dark cards. */
|
|
23
|
+
--wello-chart-grid-color: color-mix(in srgb, currentColor 22%, transparent);
|
|
17
24
|
--wello-chart-cursor-fill: color-mix(in srgb, var(--wello-chart-primary) 8%, transparent);
|
|
18
25
|
--wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #cbd5e1));
|
|
19
26
|
--wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #0f172a));
|
|
@@ -25,12 +32,7 @@
|
|
|
25
32
|
|
|
26
33
|
box-sizing: border-box;
|
|
27
34
|
position: relative;
|
|
28
|
-
|
|
29
|
-
border: 1px solid var(--wello-chart-grid-color);
|
|
30
|
-
border-radius: 12px;
|
|
31
|
-
background: var(--wello-chart-bg);
|
|
32
|
-
box-shadow: 0 2px 8px rgb(15 23 42 / 0.08);
|
|
33
|
-
color: var(--wello-chart-text-color);
|
|
35
|
+
/* No card of its own: transparent, sits on the app's surface and keeps its text color. */
|
|
34
36
|
font-family: var(--wello-chart-font);
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -39,15 +41,30 @@
|
|
|
39
41
|
.wello-chart[data-theme="dark"] {
|
|
40
42
|
--wello-chart-primary: var(--wello-primary-color, var(--primary, #9fbfa8));
|
|
41
43
|
--wello-chart-bg: var(--wello-color-surface, var(--card, #0f172a));
|
|
42
|
-
--wello-chart-text-color: var(--wello-color-dimmed, var(--muted-foreground, #94a3b8));
|
|
43
|
-
--wello-chart-bright-color: var(--wello-color-bright, var(--foreground, #f8fafc));
|
|
44
|
-
--wello-chart-dimmed-color: var(--wello-color-dimmed, var(--muted-foreground, #94a3b8));
|
|
45
|
-
--wello-chart-grid-color: var(--wello-color-border, var(--border, #334155));
|
|
46
44
|
--wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #475569));
|
|
47
45
|
--wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #f8fafc));
|
|
48
46
|
--wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #0f172a));
|
|
49
47
|
}
|
|
50
48
|
|
|
49
|
+
/*
|
|
50
|
+
* Snap grid lines to whole pixels. Tick spacing is rarely a whole number, so without this every
|
|
51
|
+
* other 1px line lands between two pixel rows, renders at half strength and all but vanishes.
|
|
52
|
+
*/
|
|
53
|
+
.wello-chart .recharts-cartesian-grid line {
|
|
54
|
+
shape-rendering: crispEdges;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* Recharts lays out every label in left-to-right coordinates. Under an RTL page the SVG inherits
|
|
59
|
+
* `direction: rtl`, which flips `text-anchor: start/end`, so axis labels (e.g. Arabic day names
|
|
60
|
+
* on a vertical chart) grow into the plot. Arabic words still shape correctly in an LTR box;
|
|
61
|
+
* the HTML legend and tooltip keep the page direction.
|
|
62
|
+
*/
|
|
63
|
+
.wello-chart .recharts-surface,
|
|
64
|
+
.wello-heatmap svg {
|
|
65
|
+
direction: ltr;
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
/* Recharts draws a focus outline around the whole chart on click. */
|
|
52
69
|
.wello-chart .recharts-wrapper:focus,
|
|
53
70
|
.wello-chart .recharts-surface:focus,
|
|
@@ -124,12 +141,17 @@
|
|
|
124
141
|
.wello-legend {
|
|
125
142
|
display: flex;
|
|
126
143
|
flex-wrap: wrap;
|
|
127
|
-
gap: 4px
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
144
|
+
gap: 4px 12px;
|
|
145
|
+
box-sizing: border-box;
|
|
146
|
+
max-width: 100%;
|
|
147
|
+
padding-bottom: 14px;
|
|
148
|
+
font-size: 12.5px;
|
|
149
|
+
font-weight: 500;
|
|
150
|
+
color: var(--wello-chart-legend-color);
|
|
131
151
|
}
|
|
132
152
|
|
|
153
|
+
/* start/end follow the text direction (start = right in Arabic). */
|
|
154
|
+
.wello-legend--start,
|
|
133
155
|
.wello-legend--left {
|
|
134
156
|
justify-content: flex-start;
|
|
135
157
|
}
|
|
@@ -138,17 +160,33 @@
|
|
|
138
160
|
justify-content: center;
|
|
139
161
|
}
|
|
140
162
|
|
|
163
|
+
.wello-legend--end,
|
|
141
164
|
.wello-legend--right {
|
|
142
165
|
justify-content: flex-end;
|
|
143
166
|
}
|
|
144
167
|
|
|
168
|
+
/* left/right stay physical in RTL. */
|
|
169
|
+
[dir="rtl"] .wello-legend--left {
|
|
170
|
+
justify-content: flex-end;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[dir="rtl"] .wello-legend--right {
|
|
174
|
+
justify-content: flex-start;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.wello-legend .wello-legend-swatch {
|
|
178
|
+
width: 10px;
|
|
179
|
+
height: 10px;
|
|
180
|
+
}
|
|
181
|
+
|
|
145
182
|
.wello-legend-item {
|
|
146
183
|
display: flex;
|
|
147
184
|
align-items: center;
|
|
148
|
-
gap:
|
|
149
|
-
padding:
|
|
150
|
-
border-radius:
|
|
185
|
+
gap: 8px;
|
|
186
|
+
padding: 3px 8px;
|
|
187
|
+
border-radius: 999px;
|
|
151
188
|
cursor: default;
|
|
189
|
+
transition: background-color 120ms ease;
|
|
152
190
|
}
|
|
153
191
|
|
|
154
192
|
.wello-legend-item:hover {
|
|
@@ -168,6 +206,7 @@
|
|
|
168
206
|
align-items: center;
|
|
169
207
|
justify-content: center;
|
|
170
208
|
padding: 16px;
|
|
209
|
+
color: var(--wello-chart-text-color);
|
|
171
210
|
font-size: 14px;
|
|
172
211
|
font-weight: 500;
|
|
173
212
|
text-align: center;
|
|
@@ -220,7 +259,8 @@
|
|
|
220
259
|
}
|
|
221
260
|
|
|
222
261
|
.wello-donut-label-main {
|
|
223
|
-
color:
|
|
262
|
+
/* The card's own text color: readable on light and dark cards (the brand primary may not be). */
|
|
263
|
+
color: var(--wello-chart-bright-color);
|
|
224
264
|
font-size: 24px;
|
|
225
265
|
font-weight: 900;
|
|
226
266
|
font-variant-numeric: tabular-nums;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wello-dev/charts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "React charts on recharts: area, bar, line, composite, candlestick, donut, pie, funnel, radar, scatter, bubble, radial bar, sparkline, heatmap, bars list, bullet, gauge, waffle, treemap, sunburst, sankey and matrix. Themeable, light by default, dark via class.",
|
|
5
5
|
"homepage": "https://wello-dev.vercel.app/",
|
|
6
6
|
"author": "Mohamed Wael <mohamedwael4553@gmail.com>",
|