@telia/teddy 0.6.9 → 0.6.11
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/components/circle-bar/circle-bar.cjs +58 -0
- package/dist/components/circle-bar/circle-bar.d.ts +10 -0
- package/dist/components/circle-bar/circle-bar.js +58 -0
- package/dist/components/circle-bar/css.cjs +30 -0
- package/dist/components/circle-bar/css.d.ts +1 -0
- package/dist/components/circle-bar/css.js +30 -0
- package/dist/components/circle-bar/index.cjs +4 -0
- package/dist/components/circle-bar/index.d.ts +2 -0
- package/dist/components/circle-bar/index.js +4 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/main.cjs +2 -0
- package/dist/main.js +2 -0
- package/dist/style.css +45 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const components_tooltip_index = require("../tooltip/index.cjs");
|
|
5
|
+
const components_circleBar_css = require("./css.cjs");
|
|
6
|
+
const CircleBar = ({ title, value, tooltip, tooltipLocation = "left" }) => {
|
|
7
|
+
const radius = 180;
|
|
8
|
+
const gapSize = 150;
|
|
9
|
+
const rotate = 114;
|
|
10
|
+
const circumference = 2 * Math.PI * radius;
|
|
11
|
+
const fillableCircumference = circumference - gapSize;
|
|
12
|
+
const percentFilled = value / 100;
|
|
13
|
+
const offset = circumference - fillableCircumference * percentFilled;
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: components_circleBar_css.css("teddy-circle-bar"), children: [
|
|
15
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${components_circleBar_css.css("__tooltip")} ${components_circleBar_css.css("__tooltip-" + tooltipLocation)}`, children: tooltip && /* @__PURE__ */ jsxRuntime.jsxs(components_tooltip_index.Tooltip, { children: [
|
|
16
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Trigger, {}),
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Content, { className: components_circleBar_css.css("__tooltip-content"), children: tooltip })
|
|
18
|
+
] }) }),
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: components_circleBar_css.css("__svg-container"), children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
"svg",
|
|
22
|
+
{
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "100%",
|
|
25
|
+
viewBox: "0 0 400 400",
|
|
26
|
+
className: components_circleBar_css.css("__svg"),
|
|
27
|
+
style: { strokeDasharray: `${fillableCircumference}, ${circumference}`, rotate: `${rotate}deg` },
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "200", cy: "200", r: radius, strokeWidth: "35", stroke: "#F5E0FF", fill: "none" }),
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31
|
+
"circle",
|
|
32
|
+
{
|
|
33
|
+
cx: "200",
|
|
34
|
+
cy: "200",
|
|
35
|
+
r: radius,
|
|
36
|
+
strokeWidth: "35.25",
|
|
37
|
+
stroke: "#4E0174",
|
|
38
|
+
fill: "none",
|
|
39
|
+
strokeDasharray: `${circumference}`,
|
|
40
|
+
strokeDashoffset: offset,
|
|
41
|
+
style: { transition: "stroke-dashoffset 0.222s ease-in-out" }
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: components_circleBar_css.css("__info-box"), children: [
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: components_circleBar_css.css("__value-label"), children: [
|
|
49
|
+
value,
|
|
50
|
+
" %"
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { children: title })
|
|
53
|
+
] })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
};
|
|
57
|
+
exports.CircleBar = CircleBar;
|
|
58
|
+
exports.default = CircleBar;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface CircleBarProps {
|
|
4
|
+
title: string;
|
|
5
|
+
value: number;
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
tooltipLocation?: 'left' | 'right';
|
|
8
|
+
}
|
|
9
|
+
export declare const CircleBar: React.FC<CircleBarProps>;
|
|
10
|
+
export default CircleBar;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip } from "../tooltip/index.js";
|
|
3
|
+
import { css } from "./css.js";
|
|
4
|
+
const CircleBar = ({ title, value, tooltip, tooltipLocation = "left" }) => {
|
|
5
|
+
const radius = 180;
|
|
6
|
+
const gapSize = 150;
|
|
7
|
+
const rotate = 114;
|
|
8
|
+
const circumference = 2 * Math.PI * radius;
|
|
9
|
+
const fillableCircumference = circumference - gapSize;
|
|
10
|
+
const percentFilled = value / 100;
|
|
11
|
+
const offset = circumference - fillableCircumference * percentFilled;
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", { className: css("teddy-circle-bar"), children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: `${css("__tooltip")} ${css("__tooltip-" + tooltipLocation)}`, children: tooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
14
|
+
/* @__PURE__ */ jsx(Tooltip.Trigger, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(Tooltip.Content, { className: css("__tooltip-content"), children: tooltip })
|
|
16
|
+
] }) }),
|
|
17
|
+
/* @__PURE__ */ jsxs("div", { className: css("__svg-container"), children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(
|
|
19
|
+
"svg",
|
|
20
|
+
{
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
viewBox: "0 0 400 400",
|
|
24
|
+
className: css("__svg"),
|
|
25
|
+
style: { strokeDasharray: `${fillableCircumference}, ${circumference}`, rotate: `${rotate}deg` },
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx("circle", { cx: "200", cy: "200", r: radius, strokeWidth: "35", stroke: "#F5E0FF", fill: "none" }),
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
"circle",
|
|
30
|
+
{
|
|
31
|
+
cx: "200",
|
|
32
|
+
cy: "200",
|
|
33
|
+
r: radius,
|
|
34
|
+
strokeWidth: "35.25",
|
|
35
|
+
stroke: "#4E0174",
|
|
36
|
+
fill: "none",
|
|
37
|
+
strokeDasharray: `${circumference}`,
|
|
38
|
+
strokeDashoffset: offset,
|
|
39
|
+
style: { transition: "stroke-dashoffset 0.222s ease-in-out" }
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", { className: css("__info-box"), children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: css("__value-label"), children: [
|
|
47
|
+
value,
|
|
48
|
+
" %"
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx("h3", { children: title })
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
] });
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
CircleBar,
|
|
57
|
+
CircleBar as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const clsx = require("clsx");
|
|
4
|
+
const styles = {
|
|
5
|
+
"teddy-circle-bar": "_teddy-circle-bar_40j64_1",
|
|
6
|
+
"teddy-circle-bar__tooltip": "_teddy-circle-bar__tooltip_40j64_6",
|
|
7
|
+
"teddy-circle-bar__tooltip-left": "_teddy-circle-bar__tooltip-left_40j64_12",
|
|
8
|
+
"teddy-circle-bar__tooltip-right": "_teddy-circle-bar__tooltip-right_40j64_15",
|
|
9
|
+
"teddy-circle-bar__tooltip-content": "_teddy-circle-bar__tooltip-content_40j64_18",
|
|
10
|
+
"teddy-circle-bar__svg-container": "_teddy-circle-bar__svg-container_40j64_21",
|
|
11
|
+
"teddy-circle-bar__svg": "_teddy-circle-bar__svg_40j64_21",
|
|
12
|
+
"teddy-circle-bar__info-box": "_teddy-circle-bar__info-box_40j64_31",
|
|
13
|
+
"teddy-circle-bar__value-label": "_teddy-circle-bar__value-label_40j64_37"
|
|
14
|
+
};
|
|
15
|
+
const rootClassName = "teddy-circle-bar";
|
|
16
|
+
const css = (suffix) => {
|
|
17
|
+
if (suffix == null)
|
|
18
|
+
return "";
|
|
19
|
+
let tmp = null;
|
|
20
|
+
if (suffix.startsWith("_") || suffix.startsWith("-") || suffix === "") {
|
|
21
|
+
tmp = clsx([styles[`${rootClassName + suffix}`]], "");
|
|
22
|
+
} else {
|
|
23
|
+
tmp = clsx([styles[`${suffix}`]], "");
|
|
24
|
+
}
|
|
25
|
+
if (!tmp) {
|
|
26
|
+
console.warn("Could not find css class " + suffix + " for the root " + rootClassName);
|
|
27
|
+
}
|
|
28
|
+
return tmp;
|
|
29
|
+
};
|
|
30
|
+
exports.css = css;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const css: (suffix: string | null) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
const styles = {
|
|
3
|
+
"teddy-circle-bar": "_teddy-circle-bar_40j64_1",
|
|
4
|
+
"teddy-circle-bar__tooltip": "_teddy-circle-bar__tooltip_40j64_6",
|
|
5
|
+
"teddy-circle-bar__tooltip-left": "_teddy-circle-bar__tooltip-left_40j64_12",
|
|
6
|
+
"teddy-circle-bar__tooltip-right": "_teddy-circle-bar__tooltip-right_40j64_15",
|
|
7
|
+
"teddy-circle-bar__tooltip-content": "_teddy-circle-bar__tooltip-content_40j64_18",
|
|
8
|
+
"teddy-circle-bar__svg-container": "_teddy-circle-bar__svg-container_40j64_21",
|
|
9
|
+
"teddy-circle-bar__svg": "_teddy-circle-bar__svg_40j64_21",
|
|
10
|
+
"teddy-circle-bar__info-box": "_teddy-circle-bar__info-box_40j64_31",
|
|
11
|
+
"teddy-circle-bar__value-label": "_teddy-circle-bar__value-label_40j64_37"
|
|
12
|
+
};
|
|
13
|
+
const rootClassName = "teddy-circle-bar";
|
|
14
|
+
const css = (suffix) => {
|
|
15
|
+
if (suffix == null)
|
|
16
|
+
return "";
|
|
17
|
+
let tmp = null;
|
|
18
|
+
if (suffix.startsWith("_") || suffix.startsWith("-") || suffix === "") {
|
|
19
|
+
tmp = clsx([styles[`${rootClassName + suffix}`]], "");
|
|
20
|
+
} else {
|
|
21
|
+
tmp = clsx([styles[`${suffix}`]], "");
|
|
22
|
+
}
|
|
23
|
+
if (!tmp) {
|
|
24
|
+
console.warn("Could not find css class " + suffix + " for the root " + rootClassName);
|
|
25
|
+
}
|
|
26
|
+
return tmp;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
css
|
|
30
|
+
};
|
|
@@ -57,6 +57,7 @@ const components_textSpacing_textSpacing = require("./text-spacing/text-spacing.
|
|
|
57
57
|
const components_container_container = require("./container/container.cjs");
|
|
58
58
|
const components_carousel_carouselRoot = require("./carousel/carousel-root.cjs");
|
|
59
59
|
const components_slider_slider = require("./slider/slider.cjs");
|
|
60
|
+
const components_circleBar_circleBar = require("./circle-bar/circle-bar.cjs");
|
|
60
61
|
const sonner = require("sonner");
|
|
61
62
|
const components_input_inputGroup = require("./input/input-group.cjs");
|
|
62
63
|
exports.Avatar = components_avatar_index.Avatar;
|
|
@@ -120,6 +121,7 @@ exports.TextSpacing = components_textSpacing_textSpacing.TextSpacing;
|
|
|
120
121
|
exports.Container = components_container_container.Container;
|
|
121
122
|
exports.Carousel = components_carousel_carouselRoot.Carousel;
|
|
122
123
|
exports.Slider = components_slider_slider.Slider;
|
|
124
|
+
exports.CircleBar = components_circleBar_circleBar.CircleBar;
|
|
123
125
|
Object.defineProperty(exports, "toast", {
|
|
124
126
|
enumerable: true,
|
|
125
127
|
get: () => sonner.toast
|
package/dist/components/index.js
CHANGED
|
@@ -55,6 +55,7 @@ import { TextSpacing } from "./text-spacing/text-spacing.js";
|
|
|
55
55
|
import { Container } from "./container/container.js";
|
|
56
56
|
import { Carousel } from "./carousel/carousel-root.js";
|
|
57
57
|
import { Slider } from "./slider/slider.js";
|
|
58
|
+
import { CircleBar } from "./circle-bar/circle-bar.js";
|
|
58
59
|
import { toast } from "sonner";
|
|
59
60
|
import { I } from "./input/input-group.js";
|
|
60
61
|
export {
|
|
@@ -72,6 +73,7 @@ export {
|
|
|
72
73
|
Checkbox,
|
|
73
74
|
CheckboxGroup,
|
|
74
75
|
Chip,
|
|
76
|
+
CircleBar,
|
|
75
77
|
Collapsible,
|
|
76
78
|
ColorDot,
|
|
77
79
|
Container,
|
package/dist/main.cjs
CHANGED
|
@@ -57,6 +57,7 @@ const components_textSpacing_textSpacing = require("./components/text-spacing/te
|
|
|
57
57
|
const components_container_container = require("./components/container/container.cjs");
|
|
58
58
|
const components_carousel_carouselRoot = require("./components/carousel/carousel-root.cjs");
|
|
59
59
|
const components_slider_slider = require("./components/slider/slider.cjs");
|
|
60
|
+
const components_circleBar_circleBar = require("./components/circle-bar/circle-bar.cjs");
|
|
60
61
|
const tokens_border_variables = require("./tokens/border/variables.cjs");
|
|
61
62
|
const tokens_breakpoint_variables = require("./tokens/breakpoint/variables.cjs");
|
|
62
63
|
const tokens_color_variables = require("./tokens/color/variables.cjs");
|
|
@@ -127,6 +128,7 @@ exports.TextSpacing = components_textSpacing_textSpacing.TextSpacing;
|
|
|
127
128
|
exports.Container = components_container_container.Container;
|
|
128
129
|
exports.Carousel = components_carousel_carouselRoot.Carousel;
|
|
129
130
|
exports.Slider = components_slider_slider.Slider;
|
|
131
|
+
exports.CircleBar = components_circleBar_circleBar.CircleBar;
|
|
130
132
|
exports.border = tokens_border_variables.variables;
|
|
131
133
|
exports.breakpoint = tokens_breakpoint_variables.variables;
|
|
132
134
|
exports.color = tokens_color_variables.variables;
|
package/dist/main.js
CHANGED
|
@@ -55,6 +55,7 @@ import { TextSpacing } from "./components/text-spacing/text-spacing.js";
|
|
|
55
55
|
import { Container } from "./components/container/container.js";
|
|
56
56
|
import { Carousel } from "./components/carousel/carousel-root.js";
|
|
57
57
|
import { Slider } from "./components/slider/slider.js";
|
|
58
|
+
import { CircleBar } from "./components/circle-bar/circle-bar.js";
|
|
58
59
|
import { v } from "./tokens/border/variables.js";
|
|
59
60
|
import { v as v2 } from "./tokens/breakpoint/variables.js";
|
|
60
61
|
import { v as v3 } from "./tokens/color/variables.js";
|
|
@@ -79,6 +80,7 @@ export {
|
|
|
79
80
|
Checkbox,
|
|
80
81
|
CheckboxGroup,
|
|
81
82
|
Chip,
|
|
83
|
+
CircleBar,
|
|
82
84
|
Collapsible,
|
|
83
85
|
ColorDot,
|
|
84
86
|
Container,
|
package/dist/style.css
CHANGED
|
@@ -6202,6 +6202,51 @@
|
|
|
6202
6202
|
._metricmeter__speed-unit-label_1wov3_70 {
|
|
6203
6203
|
font-size: var(--teddy-typography-scale-75);
|
|
6204
6204
|
font-weight: var(--teddy-typography-weight-normal);
|
|
6205
|
+
}._teddy-circle-bar_40j64_1 {
|
|
6206
|
+
position: relative;
|
|
6207
|
+
width: max-content;
|
|
6208
|
+
padding: 17px;
|
|
6209
|
+
}
|
|
6210
|
+
._teddy-circle-bar__tooltip_40j64_6 {
|
|
6211
|
+
width: max-content;
|
|
6212
|
+
position: absolute;
|
|
6213
|
+
top: -2px;
|
|
6214
|
+
z-index: 1;
|
|
6215
|
+
}
|
|
6216
|
+
._teddy-circle-bar__tooltip-left_40j64_12 {
|
|
6217
|
+
left: -2px;
|
|
6218
|
+
}
|
|
6219
|
+
._teddy-circle-bar__tooltip-right_40j64_15 {
|
|
6220
|
+
right: -2px;
|
|
6221
|
+
}
|
|
6222
|
+
._teddy-circle-bar__tooltip-content_40j64_18 {
|
|
6223
|
+
max-width: 300px;
|
|
6224
|
+
}
|
|
6225
|
+
._teddy-circle-bar__svg-container_40j64_21 {
|
|
6226
|
+
width: 155px;
|
|
6227
|
+
position: relative;
|
|
6228
|
+
}
|
|
6229
|
+
._teddy-circle-bar__svg_40j64_21 {
|
|
6230
|
+
transform-origin: center center;
|
|
6231
|
+
fill: transparent;
|
|
6232
|
+
stroke-linecap: round;
|
|
6233
|
+
stroke: #c4c4c4;
|
|
6234
|
+
}
|
|
6235
|
+
._teddy-circle-bar__info-box_40j64_31 {
|
|
6236
|
+
position: absolute;
|
|
6237
|
+
width: 100%;
|
|
6238
|
+
top: 47px;
|
|
6239
|
+
text-align: center;
|
|
6240
|
+
}
|
|
6241
|
+
._teddy-circle-bar__value-label_40j64_37 {
|
|
6242
|
+
font-size: 28px;
|
|
6243
|
+
font-weight: 700;
|
|
6244
|
+
margin-bottom: 6px;
|
|
6245
|
+
}
|
|
6246
|
+
._teddy-circle-bar_40j64_1 h3 {
|
|
6247
|
+
margin: 0;
|
|
6248
|
+
font-size: 14px;
|
|
6249
|
+
font-weight: 400;
|
|
6205
6250
|
}:root {
|
|
6206
6251
|
--teddy-border-radius-xs: 2px;
|
|
6207
6252
|
--teddy-border-radius-sm: 4px;
|