Skip to content

Commit 505edac

Browse files
committed
feat(chart): add new component
1 parent 26f2cbf commit 505edac

40 files changed

+2857
-0
lines changed

src/components/chart/chart.scss

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
@use '../../style/mixins';
2+
$min-item-size: 0.5rem;
3+
4+
/**
5+
* @prop --chart-background-color: Defines the background color of the chart. Defaults to `transparent` for _most_ chart types.
6+
* @prop --chart-axis-line-color: Defines color of the axis lines. Defaults to `--contrast-900`. Note that lines have opacity as well, and get opaque on hover.
7+
* @prop --chart-item-border-radius: Defines the roundness of corners of items in a chart. Defaults to different values depending on the chart type. Does not have any effect on `pie` and `doughnut` types.
8+
* @prop --chart-stacked-item-divider-color: Defines the color that visually separates stacked chart items, for example for a `stacked-bar` chart. Defaults to `rgb(var(--color-white), 0.6)`.
9+
*/
10+
11+
:host(limel-chart) {
12+
--chart-axis-line-color: var(
13+
--limel-chart-axis-line-color,
14+
rgb(var(--contrast-900))
15+
);
16+
box-sizing: border-box;
17+
isolation: isolate;
18+
19+
display: flex;
20+
width: 100%;
21+
height: 100%;
22+
min-width: 0;
23+
min-height: 0;
24+
padding: var(--limel-chart-padding);
25+
}
26+
27+
table {
28+
// Since these are mainly "resets", no styles should be before them.
29+
all: unset;
30+
border-collapse: collapse;
31+
border-spacing: 0;
32+
empty-cells: show;
33+
34+
position: relative;
35+
display: flex;
36+
width: 100%;
37+
height: 100%;
38+
min-width: 0;
39+
min-height: 0;
40+
41+
colgroup,
42+
thead,
43+
tbody,
44+
tr,
45+
th,
46+
td {
47+
all: unset;
48+
}
49+
50+
caption,
51+
colgroup,
52+
thead,
53+
tfoot,
54+
th,
55+
td {
56+
@include mixins.visually-hidden;
57+
}
58+
}
59+
60+
*,
61+
*:before,
62+
*:after {
63+
box-sizing: border-box;
64+
}
65+
66+
.chart {
67+
position: relative;
68+
flex-grow: 1;
69+
width: 100%;
70+
height: 100%;
71+
min-height: 0;
72+
min-width: 0;
73+
74+
&:has(.item:hover),
75+
&:has(.item:focus-visible) {
76+
.item {
77+
opacity: 0.4;
78+
}
79+
}
80+
}
81+
82+
.item {
83+
transition:
84+
background-color 0.2s ease,
85+
filter 0.2s ease,
86+
opacity 0.4s ease;
87+
cursor: help;
88+
89+
&:focus-visible,
90+
&:hover {
91+
opacity: 1 !important;
92+
}
93+
}
94+
95+
@import './partial-styles/_layout-for-charts-with-x-y-axises';
96+
@import './partial-styles/_layout-for-charts-with-circular-shape';
97+
@import './partial-styles/_bar-gantt-scatter';
98+
@import './partial-styles/_area';
99+
@import './partial-styles/_line';
100+
@import './partial-styles/_pie-doughnut';
101+
@import './partial-styles/_ring';
102+
@import './partial-styles/_stacked-bar';
103+
@import './partial-styles/_axises';

0 commit comments

Comments
 (0)