@six-vallees/ui-react 0.1.0 → 0.1.1

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.
Files changed (70) hide show
  1. package/README.md +54 -0
  2. package/dist/button/button.d.ts +23 -0
  3. package/dist/button/button.js +10 -0
  4. package/dist/button/button.js.map +1 -0
  5. package/dist/charts/area-chart.d.ts +27 -0
  6. package/dist/charts/area-chart.js +9 -0
  7. package/dist/charts/area-chart.js.map +1 -0
  8. package/dist/charts/bar-chart.d.ts +29 -0
  9. package/dist/charts/bar-chart.js +10 -0
  10. package/dist/charts/bar-chart.js.map +1 -0
  11. package/dist/charts/lib/path.d.ts +4 -0
  12. package/dist/charts/lib/path.js +7 -0
  13. package/dist/charts/lib/path.js.map +1 -0
  14. package/dist/charts/lib/series.d.ts +31 -0
  15. package/dist/charts/lib/series.js +17 -0
  16. package/dist/charts/lib/series.js.map +1 -0
  17. package/dist/charts/ring.d.ts +43 -0
  18. package/dist/charts/ring.js +10 -0
  19. package/dist/charts/ring.js.map +1 -0
  20. package/dist/charts/segmented-bar.d.ts +34 -0
  21. package/dist/charts/segmented-bar.js +9 -0
  22. package/dist/charts/segmented-bar.js.map +1 -0
  23. package/dist/charts/sparkline.d.ts +19 -0
  24. package/dist/charts/sparkline.js +9 -0
  25. package/dist/charts/sparkline.js.map +1 -0
  26. package/dist/charts/stat.d.ts +22 -0
  27. package/dist/charts/stat.js +8 -0
  28. package/dist/charts/stat.js.map +1 -0
  29. package/dist/chunk-35UH66I7.js +28 -0
  30. package/dist/chunk-35UH66I7.js.map +1 -0
  31. package/dist/chunk-DXRY7AS4.js +11 -0
  32. package/dist/chunk-DXRY7AS4.js.map +1 -0
  33. package/dist/chunk-GD6IYLWY.js +30 -0
  34. package/dist/chunk-GD6IYLWY.js.map +1 -0
  35. package/dist/chunk-I2PXLL75.js +41 -0
  36. package/dist/chunk-I2PXLL75.js.map +1 -0
  37. package/dist/chunk-LKIXZUNS.js +38 -0
  38. package/dist/chunk-LKIXZUNS.js.map +1 -0
  39. package/dist/chunk-N5ZJZ7I3.js +18 -0
  40. package/dist/chunk-N5ZJZ7I3.js.map +1 -0
  41. package/dist/chunk-NYHHTSX4.js +69 -0
  42. package/dist/chunk-NYHHTSX4.js.map +1 -0
  43. package/dist/chunk-RV75OH74.js +81 -0
  44. package/dist/chunk-RV75OH74.js.map +1 -0
  45. package/dist/chunk-SC5A4Q7G.js +89 -0
  46. package/dist/chunk-SC5A4Q7G.js.map +1 -0
  47. package/dist/chunk-T7ESUAJU.js +14 -0
  48. package/dist/chunk-T7ESUAJU.js.map +1 -0
  49. package/dist/chunk-UM6DTEFE.js +50 -0
  50. package/dist/chunk-UM6DTEFE.js.map +1 -0
  51. package/dist/chunk-YE4P3T6M.js +97 -0
  52. package/dist/chunk-YE4P3T6M.js.map +1 -0
  53. package/dist/chunk-YSUYAW4O.js +26 -0
  54. package/dist/chunk-YSUYAW4O.js.map +1 -0
  55. package/dist/icon/icon.d.ts +30 -0
  56. package/dist/icon/icon.js +8 -0
  57. package/dist/icon/icon.js.map +1 -0
  58. package/dist/index.d.ts +15 -257
  59. package/dist/index.js +59 -437
  60. package/dist/index.js.map +1 -1
  61. package/dist/lib/utils.d.ts +6 -0
  62. package/dist/lib/utils.js +7 -0
  63. package/dist/lib/utils.js.map +1 -0
  64. package/dist/logo/logo-mark.d.ts +15 -0
  65. package/dist/logo/logo-mark.js +7 -0
  66. package/dist/logo/logo-mark.js.map +1 -0
  67. package/dist/logo/logo.d.ts +16 -0
  68. package/dist/logo/logo.js +7 -0
  69. package/dist/logo/logo.js.map +1 -0
  70. package/package.json +10 -5
package/dist/index.js CHANGED
@@ -1,439 +1,61 @@
1
- import * as React3 from 'react';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { cva } from 'class-variance-authority';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
6
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
-
8
- // src/button/button.tsx
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
- var buttonVariants = cva(
13
- "inline-flex items-center justify-center gap-2 leading-none rounded-control font-medium whitespace-nowrap transition-[background-color,border-color,filter] duration-150 outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:pointer-events-none disabled:opacity-40",
14
- {
15
- variants: {
16
- variant: {
17
- primary: "bg-primary text-on-primary hover:bg-primary-hover active:brightness-90",
18
- secondary: "border border-outline-strong bg-surface text-on-surface hover:bg-surface-subtle active:bg-surface-muted",
19
- ghost: "text-on-surface hover:bg-surface-subtle active:bg-surface-muted",
20
- danger: "bg-danger text-on-danger hover:brightness-95 active:brightness-90"
21
- },
22
- size: {
23
- sm: "h-9 px-3 text-[13px]",
24
- md: "h-11 px-5 text-sm",
25
- lg: "h-12 px-6 text-base"
26
- }
27
- },
28
- defaultVariants: { variant: "primary", size: "md" }
29
- }
30
- );
31
- var Button = React3.forwardRef(
32
- ({ className, variant, size, asChild = false, ...props }, ref) => {
33
- const Comp = asChild ? Slot : "button";
34
- return /* @__PURE__ */ jsx(Comp, { ref, className: cn(buttonVariants({ variant, size }), className), ...props });
35
- }
36
- );
37
- Button.displayName = "Button";
38
- var SIZES = { sm: 16, md: 20, lg: 24, xl: 32 };
39
- function Icon({ icon: Glyph, size = "md", weight = "regular", label, className }) {
40
- const px = typeof size === "number" ? size : SIZES[size];
41
- const a11y = label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
42
- return /* @__PURE__ */ jsx(Glyph, { size: px, weight, className: cn("inline-block shrink-0", className), ...a11y });
43
- }
44
- Icon.displayName = "Icon";
45
- function Logo({ title = "Six Vall\xE9es", className, ...props }) {
46
- return /* @__PURE__ */ jsx(
47
- "svg",
48
- {
49
- viewBox: "0 0 3528 570",
50
- fill: "currentColor",
51
- xmlns: "http://www.w3.org/2000/svg",
52
- role: title ? "img" : void 0,
53
- "aria-label": title || void 0,
54
- "aria-hidden": title ? void 0 : true,
55
- className,
56
- ...props,
57
- children: /* @__PURE__ */ jsxs("g", { transform: "matrix(1,0,0,1,-38236.28375,-1970.557917)", children: [
58
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,38236.28375,2181.884167)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,40.893L22.244,36.051C23.917,46.695 26.756,54.41 30.764,59.188C34.769,63.974 41.375,66.364 50.585,66.364C58.237,66.364 64.218,64.843 68.523,61.795C72.827,58.74 74.98,54.592 74.98,49.322C74.98,44.067 72.976,39.94 68.972,36.948C64.964,33.963 55.906,30.312 41.795,26.003C28.639,21.939 19.222,16.978 13.543,11.12C7.862,5.262 5.022,-1.857 5.022,-10.23C5.022,-19.795 8.727,-27.986 16.144,-34.804C23.558,-41.622 33.602,-45.027 46.28,-45.027C58.12,-45.027 68.224,-42.126 76.595,-36.331C84.964,-30.53 90.107,-21.946 92.021,-10.588L71.393,-5.564C69.716,-11.779 66.968,-16.628 63.142,-20.096C59.313,-23.565 53.693,-25.295 46.28,-25.295C39.464,-25.295 34.352,-23.922 30.943,-21.168C27.534,-18.421 25.831,-14.834 25.831,-10.405C25.831,-6.341 27.683,-3.111 31.391,-0.722C35.096,1.675 43.827,5.199 57.58,9.859C72.407,14.883 82.483,20.145 87.807,25.646C93.127,31.146 95.789,38.623 95.789,48.068C95.789,58.95 91.69,67.982 83.501,75.157C75.308,82.333 64.277,85.92 50.405,85.92C35.935,85.92 24.395,82.122 15.785,74.527C7.175,66.938 1.911,55.727 0,40.893" }) }),
59
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,36000,187.379167)", children: /* @__PURE__ */ jsx("rect", { x: "651.688", y: "473.118", width: "20.448", height: "88.793" }) }),
60
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,38869.324167,2132.544167)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,95.071L32.826,46.099L1.972,0L23.498,0L45.563,33.542L45.921,33.542L67.805,0L89.331,0L58.658,46.099L91.305,95.071L69.24,95.071L45.742,59.37L45.383,59.37L22.063,95.071L0,95.071Z" }) }),
61
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,39935.577917,2299.980833)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,14.701C-6.699,16.383 -11.152,18.289 -13.364,20.447C-15.578,22.598 -16.682,25.226 -16.682,28.337C-16.682,35.988 -11.479,39.814 -1.076,39.814C6.576,39.814 12.346,38.266 16.234,35.154C20.119,32.043 22.063,28.281 22.063,23.852L22.063,4.835L21.706,4.835C21.226,5.795 20.599,6.629 19.821,7.351C19.043,8.065 17.011,9.081 13.723,10.399C10.432,11.716 5.858,13.152 0,14.701M24.397,54.886L24.397,45.378L24.038,45.378C23.558,46.092 22.841,46.961 21.885,47.977C20.926,48.993 19.401,50.311 17.311,51.922C15.217,53.541 12.406,54.886 8.88,55.958C5.352,57.037 1.435,57.577 -2.869,57.577C-13.991,57.577 -22.363,54.914 -27.983,49.596C-33.606,44.271 -36.414,37.663 -36.414,29.773C-36.414,21.638 -33.965,15.395 -29.06,11.029C-24.157,6.664 -15.846,3.041 -4.125,0.175C6.396,-2.452 13.275,-4.638 16.503,-6.376C19.732,-8.107 21.347,-10.65 21.347,-14C21.347,-17.223 19.881,-19.914 16.952,-22.072C14.019,-24.223 9.687,-25.295 3.947,-25.295C-2.631,-25.295 -7.443,-23.803 -10.493,-20.811C-13.543,-17.826 -15.785,-13.755 -17.22,-8.618L-34.62,-15.254C-32.588,-23.382 -28.342,-30.018 -21.885,-35.161C-15.426,-40.304 -6.995,-42.876 3.409,-42.876C14.888,-42.876 24.155,-39.947 31.213,-34.089C38.267,-28.224 41.795,-19.08 41.795,-6.642L41.795,54.886L24.397,54.886Z" }) }),
62
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,36000,11.729167)", children: /* @__PURE__ */ jsx("rect", { x: "1011.445", y: "473.119", width: "21.167", height: "130.947" }) }),
63
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,36000,11.729167)", children: /* @__PURE__ */ jsx("rect", { x: "1059.517", y: "473.119", width: "21.167", height: "130.947" }) }),
64
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,40675.49,2369.469167)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,-18.653L46.281,-18.653C45.922,-25.352 43.769,-30.824 39.823,-35.07C35.876,-39.31 30.255,-41.44 22.962,-41.44C16.144,-41.44 10.702,-39.163 6.637,-34.622C2.572,-30.074 0.359,-24.756 0,-18.653M48.613,6.635L63.323,18.652C54.112,33.486 40.958,40.9 23.859,40.9C10.702,40.9 -0.03,36.324 -8.34,27.173C-16.654,18.029 -20.807,5.858 -20.807,-9.327C-20.807,-24.511 -16.682,-36.682 -8.429,-45.833C-0.179,-54.977 10.285,-59.553 22.962,-59.553C35.636,-59.553 46.012,-55.005 54.084,-45.924C62.156,-36.829 66.192,-24.637 66.192,-9.327L66.192,-3.231L-0.179,-3.231C0.06,4.666 2.242,10.973 6.369,15.695C10.495,20.418 16.204,22.78 23.5,22.78C26.967,22.78 30.074,22.303 32.828,21.343C35.576,20.39 37.999,18.954 40.092,17.041C42.182,15.128 43.769,13.453 44.845,12.017C45.922,10.58 47.178,8.787 48.613,6.635" }) }),
65
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,41097.772083,2369.469167)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,-18.653L46.281,-18.653C45.922,-25.352 43.769,-30.824 39.823,-35.07C35.876,-39.31 30.255,-41.44 22.962,-41.44C16.144,-41.44 10.702,-39.163 6.637,-34.622C2.572,-30.074 0.359,-24.756 0,-18.653M48.613,6.635L63.323,18.652C54.112,33.486 40.958,40.9 23.859,40.9C10.702,40.9 -0.03,36.324 -8.34,27.173C-16.654,18.029 -20.807,5.858 -20.807,-9.327C-20.807,-24.511 -16.682,-36.682 -8.429,-45.833C-0.179,-54.977 10.285,-59.553 22.962,-59.553C35.636,-59.553 46.012,-55.005 54.084,-45.924C62.156,-36.829 66.192,-24.637 66.192,-9.327L66.192,-3.231L-0.179,-3.231C0.06,4.666 2.242,10.973 6.369,15.695C10.495,20.418 16.204,22.78 23.5,22.78C26.967,22.78 30.074,22.303 32.828,21.343C35.576,20.39 37.999,18.954 40.092,17.041C42.182,15.128 43.769,13.453 44.845,12.017C45.922,10.58 47.178,8.787 48.613,6.635" }) }),
66
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,41429.620417,2264.828333)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,31.574L18.656,27.09C20.329,41.559 27.983,48.79 41.616,48.79C47.953,48.79 52.885,47.69 56.415,45.476C59.942,43.262 61.707,40.305 61.707,36.591C61.707,33.003 60.092,30.376 56.864,28.701C53.635,27.026 46.518,24.637 35.517,21.526C24.395,18.415 16.293,14.743 11.211,10.497C6.128,6.251 3.588,0.659 3.588,-6.278C3.588,-13.93 6.695,-20.537 12.916,-26.101C19.133,-31.657 27.683,-34.439 38.567,-34.439C59.493,-34.439 72.47,-25.169 77.492,-6.635L60.271,-1.611C56.683,-12.136 49.447,-17.398 38.567,-17.398C33.423,-17.398 29.419,-16.382 26.548,-14.35C23.678,-12.318 22.244,-9.922 22.244,-7.175C22.244,-4.064 23.827,-1.702 26.996,-0.091C30.163,1.528 37.908,4.064 50.226,7.533C61.707,10.763 69.569,14.652 73.815,19.193C78.058,23.74 80.183,29.661 80.183,36.955C80.183,44.488 76.983,51.215 70.585,57.136C64.188,63.05 54.77,66.013 42.333,66.013C29.298,66.013 19.311,62.692 12.378,56.057C5.441,49.421 1.314,41.258 0,31.574" }) }),
67
- /* @__PURE__ */ jsx("g", { transform: "matrix(0,-4.166667,-4.166667,0,39388.936667,2005.484583)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M-12.625,-12.626C-19.598,-12.626 -25.251,-6.973 -25.251,-0C-25.251,6.972 -19.598,12.625 -12.625,12.625C-5.652,12.625 0,6.972 0,-0C0,-6.973 -5.652,-12.626 -12.625,-12.626" }) }),
68
- /* @__PURE__ */ jsx("g", { transform: "matrix(0,-4.166667,-4.166667,0,40770.042917,1970.557917)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M-12.626,-12.625C-19.599,-12.625 -25.251,-6.972 -25.251,-0C-25.251,6.973 -19.599,12.626 -12.626,12.626C-5.653,12.626 0,6.973 0,-0C0,-6.972 -5.653,-12.625 -12.626,-12.625" }) }),
69
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,39551.4625,2157.219167)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,52.74L30.14,-36.417L55.25,-36.417L10.402,89.157L-11.657,89.157L0,52.74Z" }) }),
70
- /* @__PURE__ */ jsx("g", { transform: "matrix(0,-4.166667,-4.166667,0,38757.969583,2008.057917)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M-12.626,-12.625C-19.599,-12.625 -25.251,-6.972 -25.251,0.001C-25.251,6.973 -19.599,12.626 -12.626,12.626C-5.653,12.626 0,6.973 0,0.001C0,-6.972 -5.653,-12.625 -12.626,-12.625" }) })
71
- ] })
72
- }
73
- );
74
- }
75
- Logo.displayName = "Logo";
76
- function LogoMark({ title = "Six Vall\xE9es", className, ...props }) {
77
- return /* @__PURE__ */ jsx(
78
- "svg",
79
- {
80
- viewBox: "0 0 1042 648",
81
- fill: "currentColor",
82
- xmlns: "http://www.w3.org/2000/svg",
83
- role: title ? "img" : void 0,
84
- "aria-label": title || void 0,
85
- "aria-hidden": title ? void 0 : true,
86
- className,
87
- ...props,
88
- children: /* @__PURE__ */ jsxs("g", { transform: "matrix(1,0,0,1,-21444.579167,-1926.130417)", children: [
89
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,21444.579167,2147.084583)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,49.399L30.241,42.796C32.086,54.442 35.102,62.856 39.287,68.037C43.481,73.219 50.326,75.81 59.84,75.81C67.933,75.81 74.388,74.354 79.215,71.443C84.041,68.531 86.458,64.233 86.458,58.558C86.458,52.596 84.154,48.013 79.535,44.824C74.925,41.627 64.38,37.476 47.917,32.364C32.441,27.537 21.472,21.68 15.016,14.8C8.552,7.911 5.329,-0.572 5.329,-10.649C5.329,-22.286 9.826,-32.268 18.846,-40.569C27.858,-48.878 40.11,-53.029 55.577,-53.029C69.64,-53.029 81.736,-49.624 91.891,-42.804C102.038,-35.994 108.389,-25.838 110.945,-12.356L83.053,-5.329C78.651,-19.383 69.493,-26.41 55.577,-26.41C48.194,-26.41 42.701,-24.989 39.079,-22.147C35.457,-19.305 33.646,-15.545 33.646,-10.865C33.646,-6.464 35.699,-3.093 39.824,-0.745C43.94,1.595 54.52,5.676 71.555,11.499C88.018,17.174 99.309,23.318 105.409,29.92C111.517,36.514 114.567,45.43 114.567,56.643C114.567,69.848 109.594,80.775 99.664,89.44C89.725,98.096 76.451,102.428 59.84,102.428C42.943,102.428 29.279,97.992 18.846,89.119C8.414,80.246 2.132,67.006 0,49.399" }) }),
90
- /* @__PURE__ */ jsx("g", { transform: "matrix(4.166667,0,0,4.166667,22212.97625,2119.575)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M0,62.604L35.777,-43.229L65.585,-43.229L12.347,105.833L-13.838,105.833L0,62.604Z" }) }),
91
- /* @__PURE__ */ jsx("g", { transform: "matrix(0,-4.166667,-4.166667,0,22020.05375,1939.45375)", children: /* @__PURE__ */ jsx("path", { fillRule: "nonzero", d: "M-14.987,-14.987C-23.264,-14.987 -29.974,-8.277 -29.974,0C-29.974,8.277 -23.264,14.987 -14.987,14.987C-6.71,14.987 0,8.277 0,0C0,-8.277 -6.71,-14.987 -14.987,-14.987" }) })
92
- ] })
93
- }
94
- );
95
- }
96
- LogoMark.displayName = "LogoMark";
97
- function smooth(pts) {
98
- return pts.reduce((acc, [x, y], i, arr) => {
99
- if (i === 0) return `M ${x},${y}`;
100
- const [px, py] = arr[i - 1];
101
- const cx = (px + x) / 2;
102
- return `${acc} C ${cx},${py} ${cx},${y} ${x},${y}`;
103
- }, "");
104
- }
105
- function Sparkline({ data, width = 120, height = 34, type = "line", strokeWidth = 1.75, className }) {
106
- if (data.length < 2) return null;
107
- const min = Math.min(...data);
108
- const max = Math.max(...data);
109
- const range = max - min || 1;
110
- const step = width / (data.length - 1);
111
- const pad = strokeWidth;
112
- const pts = data.map((v, i) => [i * step, pad + (1 - (v - min) / range) * (height - pad * 2)]);
113
- const line = smooth(pts);
114
- const area = `${line} L ${width},${height} L 0,${height} Z`;
115
- return /* @__PURE__ */ jsxs("svg", { viewBox: `0 0 ${width} ${height}`, width, height, fill: "none", className: cn("overflow-visible", className), "aria-hidden": "true", children: [
116
- type === "area" && /* @__PURE__ */ jsx("path", { d: area, fill: "currentColor", opacity: "0.12" }),
117
- /* @__PURE__ */ jsx("path", { d: line, stroke: "currentColor", strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })
118
- ] });
119
- }
120
- Sparkline.displayName = "Sparkline";
121
- var W = 1e3;
122
- var TOP = 26;
123
- var BOTTOM = 8;
124
- function smooth2(pts) {
125
- return pts.reduce((acc, [x, y], i, arr) => {
126
- if (i === 0) return `M ${x},${y}`;
127
- const [px, py] = arr[i - 1];
128
- const cx = (px + x) / 2;
129
- return `${acc} C ${cx},${py} ${cx},${y} ${x},${y}`;
130
- }, "");
131
- }
132
- function AreaChart({ data, height = 240, markerIndex, markerLabel, className }) {
133
- const values = data.map((d) => typeof d === "number" ? d : d.value);
134
- if (values.length < 2) return null;
135
- const min = Math.min(...values);
136
- const max = Math.max(...values);
137
- const range = max - min || 1;
138
- const stepX = W / (values.length - 1);
139
- const y = (v) => TOP + (1 - (v - min) / range) * (height - TOP - BOTTOM);
140
- const pts = values.map((v, i) => [i * stepX, y(v)]);
141
- const line = smooth2(pts);
142
- const area = `${line} L ${W},${height} L 0,${height} Z`;
143
- const marked = markerIndex != null && markerIndex >= 0 && markerIndex < values.length;
144
- const markLeft = marked ? markerIndex / (values.length - 1) * 100 : 0;
145
- return /* @__PURE__ */ jsxs("div", { className: cn("relative w-full", className), style: { height }, children: [
146
- /* @__PURE__ */ jsxs(
147
- "svg",
148
- {
149
- viewBox: `0 0 ${W} ${height}`,
150
- width: "100%",
151
- height,
152
- preserveAspectRatio: "none",
153
- fill: "none",
154
- "aria-hidden": "true",
155
- children: [
156
- /* @__PURE__ */ jsx("path", { d: area, fill: "currentColor", fillOpacity: 0.1 }),
157
- /* @__PURE__ */ jsx(
158
- "path",
159
- {
160
- d: line,
161
- stroke: "currentColor",
162
- strokeWidth: 2.5,
163
- strokeLinecap: "round",
164
- strokeLinejoin: "round",
165
- vectorEffect: "non-scaling-stroke"
166
- }
167
- ),
168
- marked && /* @__PURE__ */ jsx(
169
- "line",
170
- {
171
- x1: markerIndex * stepX,
172
- y1: TOP,
173
- x2: markerIndex * stepX,
174
- y2: height,
175
- stroke: "var(--sv-sys-color-outline-strong)",
176
- strokeWidth: 1,
177
- vectorEffect: "non-scaling-stroke"
178
- }
179
- )
180
- ]
181
- }
182
- ),
183
- marked && /* @__PURE__ */ jsxs(Fragment, { children: [
184
- /* @__PURE__ */ jsx(
185
- "span",
186
- {
187
- className: "pointer-events-none absolute size-3 -translate-x-1/2 -translate-y-1/2 rounded-full border-[2.5px] border-current bg-surface",
188
- style: { left: `${markLeft}%`, top: y(values[markerIndex]) },
189
- "aria-hidden": "true"
190
- }
191
- ),
192
- markerLabel && /* @__PURE__ */ jsx(
193
- "span",
194
- {
195
- className: "pointer-events-none absolute top-0 -translate-x-1/2 whitespace-nowrap text-[12px] font-medium text-on-surface",
196
- style: { left: `${markLeft}%` },
197
- children: markerLabel
198
- }
199
- )
200
- ] })
201
- ] });
202
- }
203
- AreaChart.displayName = "AreaChart";
204
- function BarChart({ data, height = 200, showValue = true, tone = "ink", className }) {
205
- const max = Math.max(...data.map((d) => d.value), 1);
206
- const [hover, setHover] = React3.useState(null);
207
- const activeFill = tone === "accent" ? "var(--sv-sys-chart-categorical-2)" : "var(--sv-sys-chart-ink)";
208
- const mutedFill = "var(--sv-sys-chart-muted)";
209
- return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
210
- /* @__PURE__ */ jsx("div", { className: "flex items-end gap-2", style: { height }, onMouseLeave: () => setHover(null), children: data.map((d, i) => {
211
- const on = d.active || hover === i;
212
- const dim = hover != null && hover !== i;
213
- return /* @__PURE__ */ jsxs(
214
- "div",
215
- {
216
- className: "flex h-full flex-1 flex-col items-center justify-end gap-2",
217
- onMouseEnter: () => setHover(i),
218
- children: [
219
- /* @__PURE__ */ jsx(
220
- "span",
221
- {
222
- className: cn(
223
- "rounded-md px-2 py-0.5 text-[11px] font-medium tabular-nums transition-opacity duration-150",
224
- on && showValue ? "opacity-100" : "opacity-0"
225
- ),
226
- style: { background: activeFill, color: "var(--sv-sys-color-on-primary)" },
227
- children: d.value
228
- }
229
- ),
230
- /* @__PURE__ */ jsx(
231
- "div",
232
- {
233
- className: cn(
234
- "w-full rounded-t-md transition-[height,background-color,opacity] duration-500 ease-out",
235
- dim && "opacity-60"
236
- ),
237
- style: { height: `${Math.max(2, d.value / max * 100)}%`, background: on ? activeFill : mutedFill }
238
- }
239
- )
240
- ]
241
- },
242
- i
243
- );
244
- }) }),
245
- /* @__PURE__ */ jsx("div", { className: "mt-3 flex gap-2", children: data.map((d, i) => /* @__PURE__ */ jsx(
246
- "span",
247
- {
248
- className: cn(
249
- "flex-1 text-center text-[12px] transition-colors",
250
- d.active || hover === i ? "text-on-surface" : "text-on-surface-variant"
251
- ),
252
- children: d.label
253
- },
254
- i
255
- )) })
256
- ] });
257
- }
258
- BarChart.displayName = "BarChart";
259
- function Stat({ value, label, delta, children, className }) {
260
- const tone = delta?.tone ?? "neutral";
261
- const toneCls = tone === "success" ? "text-success" : tone === "error" ? "text-error" : "text-on-surface-variant";
262
- return /* @__PURE__ */ jsxs("div", { className: cn("rounded-card border border-outline p-5", className), children: [
263
- label && /* @__PURE__ */ jsx("p", { className: "text-[13px] text-on-surface-variant", children: label }),
264
- /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-end justify-between gap-4", children: [
265
- /* @__PURE__ */ jsxs("div", { children: [
266
- /* @__PURE__ */ jsx("div", { className: "text-[28px] font-semibold leading-none tracking-tight tabular-nums text-on-surface", children: value }),
267
- delta && /* @__PURE__ */ jsx("div", { className: cn("mt-2 text-[13px] font-medium", toneCls), children: delta.value })
268
- ] }),
269
- children && /* @__PURE__ */ jsx("div", { className: "shrink-0 text-on-surface-variant", children })
270
- ] })
271
- ] });
272
- }
273
- Stat.displayName = "Stat";
274
-
275
- // src/charts/lib/series.ts
276
- var chartToken = {
277
- ink: "var(--sv-sys-chart-ink)",
278
- muted: "var(--sv-sys-chart-muted)",
279
- grid: "var(--sv-sys-chart-grid)",
280
- axis: "var(--sv-sys-chart-axis)",
281
- track: "var(--sv-sys-chart-track)"
1
+ import {
2
+ Icon
3
+ } from "./chunk-N5ZJZ7I3.js";
4
+ import {
5
+ LogoMark
6
+ } from "./chunk-35UH66I7.js";
7
+ import {
8
+ Logo
9
+ } from "./chunk-LKIXZUNS.js";
10
+ import {
11
+ Button,
12
+ buttonVariants
13
+ } from "./chunk-I2PXLL75.js";
14
+ import {
15
+ AreaChart
16
+ } from "./chunk-SC5A4Q7G.js";
17
+ import {
18
+ BarChart
19
+ } from "./chunk-RV75OH74.js";
20
+ import {
21
+ Ring
22
+ } from "./chunk-YE4P3T6M.js";
23
+ import {
24
+ SegmentedBar
25
+ } from "./chunk-UM6DTEFE.js";
26
+ import {
27
+ CATEGORICAL_MAX,
28
+ categorical,
29
+ categoricalOn,
30
+ chartToken,
31
+ sequential,
32
+ sequentialOn
33
+ } from "./chunk-NYHHTSX4.js";
34
+ import {
35
+ Sparkline
36
+ } from "./chunk-GD6IYLWY.js";
37
+ import "./chunk-T7ESUAJU.js";
38
+ import {
39
+ Stat
40
+ } from "./chunk-YSUYAW4O.js";
41
+ import "./chunk-DXRY7AS4.js";
42
+ export {
43
+ AreaChart,
44
+ BarChart,
45
+ Button,
46
+ CATEGORICAL_MAX,
47
+ Icon,
48
+ Logo,
49
+ LogoMark,
50
+ Ring,
51
+ SegmentedBar,
52
+ Sparkline,
53
+ Stat,
54
+ buttonVariants,
55
+ categorical,
56
+ categoricalOn,
57
+ chartToken,
58
+ sequential,
59
+ sequentialOn
282
60
  };
283
- var CATEGORICAL = [
284
- "var(--sv-sys-chart-categorical-1)",
285
- "var(--sv-sys-chart-categorical-2)",
286
- "var(--sv-sys-chart-categorical-3)",
287
- "var(--sv-sys-chart-categorical-4)"
288
- ];
289
- var SEQUENTIAL = [
290
- "var(--sv-sys-chart-sequential-1)",
291
- "var(--sv-sys-chart-sequential-2)",
292
- "var(--sv-sys-chart-sequential-3)",
293
- "var(--sv-sys-chart-sequential-4)",
294
- "var(--sv-sys-chart-sequential-5)"
295
- ];
296
- var CATEGORICAL_MAX = CATEGORICAL.length;
297
- var CATEGORICAL_ON = [
298
- "var(--sv-sys-color-on-primary)",
299
- // white, on ink
300
- "var(--sv-sys-color-on-primary)",
301
- // white, on blue.600 (5.2:1)
302
- "var(--sv-sys-color-on-surface)",
303
- // ink, on acid.400 (16:1)
304
- "var(--sv-sys-color-on-surface)"
305
- // ink, on neutral.400 (5.6:1)
306
- ];
307
- var SEQUENTIAL_ON = [
308
- "var(--sv-sys-color-on-surface)",
309
- // ink, on blue.100
310
- "var(--sv-sys-color-on-surface)",
311
- // ink, on blue.300
312
- "var(--sv-sys-color-on-primary)",
313
- // white, on blue.500 (4.8:1)
314
- "var(--sv-sys-color-on-primary)",
315
- // white, on blue.700
316
- "var(--sv-sys-color-on-primary)"
317
- // white, on blue.900
318
- ];
319
- var wrap = (i, n) => (i % n + n) % n;
320
- var rampIndex = (i, n) => n <= 1 ? SEQUENTIAL.length - 1 : Math.round(Math.min(Math.max(i / (n - 1), 0), 1) * (SEQUENTIAL.length - 1));
321
- function categorical(i) {
322
- return CATEGORICAL[wrap(i, CATEGORICAL_MAX)];
323
- }
324
- function categoricalOn(i) {
325
- return CATEGORICAL_ON[wrap(i, CATEGORICAL_MAX)];
326
- }
327
- function sequential(i, n) {
328
- return SEQUENTIAL[rampIndex(i, n)];
329
- }
330
- function sequentialOn(i, n) {
331
- return SEQUENTIAL_ON[rampIndex(i, n)];
332
- }
333
- function Ring({
334
- value,
335
- size = 160,
336
- thickness = 14,
337
- tone = "ink",
338
- color,
339
- casing = false,
340
- animate = true,
341
- children,
342
- className,
343
- "aria-label": ariaLabel
344
- }) {
345
- const pct = Math.min(Math.max(value, 0), 100);
346
- const r = (size - thickness) / 2;
347
- const c = 2 * Math.PI * r;
348
- const [progress, setProgress] = React3.useState(animate ? 0 : pct);
349
- React3.useEffect(() => {
350
- if (!animate) {
351
- setProgress(pct);
352
- return;
353
- }
354
- const id = requestAnimationFrame(() => setProgress(pct));
355
- return () => cancelAnimationFrame(id);
356
- }, [pct, animate]);
357
- const arc = progress / 100 * c;
358
- const stroke = color ?? (tone === "accent" ? "var(--sv-sys-chart-categorical-2)" : chartToken.ink);
359
- return /* @__PURE__ */ jsxs(
360
- "div",
361
- {
362
- className: cn("relative inline-grid place-items-center", className),
363
- style: { width: size, height: size },
364
- role: "img",
365
- "aria-label": ariaLabel ?? `${Math.round(pct)}%`,
366
- children: [
367
- /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, className: "rotate-[-90deg]", "aria-hidden": "true", children: [
368
- /* @__PURE__ */ jsx("circle", { cx: size / 2, cy: size / 2, r, fill: "none", stroke: chartToken.track, strokeWidth: thickness }),
369
- casing && /* @__PURE__ */ jsx(
370
- "circle",
371
- {
372
- cx: size / 2,
373
- cy: size / 2,
374
- r,
375
- fill: "none",
376
- stroke: typeof casing === "string" ? casing : "var(--sv-sys-color-on-surface)",
377
- strokeWidth: thickness + 2,
378
- strokeLinecap: "round",
379
- strokeDasharray: `${arc} ${c - arc}`,
380
- className: "transition-[stroke-dasharray] duration-[900ms] ease-out"
381
- }
382
- ),
383
- /* @__PURE__ */ jsx(
384
- "circle",
385
- {
386
- cx: size / 2,
387
- cy: size / 2,
388
- r,
389
- fill: "none",
390
- stroke,
391
- strokeWidth: thickness,
392
- strokeLinecap: "round",
393
- strokeDasharray: `${arc} ${c - arc}`,
394
- className: "transition-[stroke-dasharray] duration-[900ms] ease-out"
395
- }
396
- )
397
- ] }),
398
- children != null && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center", children })
399
- ]
400
- }
401
- );
402
- }
403
- Ring.displayName = "Ring";
404
- function SegmentedBar({ data, height = 40, scale = "mono", showLegend = true, className }) {
405
- const total = data.reduce((s, d) => s + d.value, 0) || 1;
406
- const hasActive = data.some((d) => d.active);
407
- const fill = (d, i) => {
408
- if (scale === "categorical") return categorical(i);
409
- if (scale === "sequential") return sequential(i, data.length);
410
- if (!hasActive) return "var(--sv-sys-chart-ink)";
411
- return d.active ? "var(--sv-sys-chart-ink)" : "var(--sv-sys-chart-muted)";
412
- };
413
- const onFill = (d, i) => {
414
- if (scale === "categorical") return categoricalOn(i);
415
- if (scale === "sequential") return sequentialOn(i, data.length);
416
- if (!hasActive) return "var(--sv-sys-color-on-primary)";
417
- return d.active ? "var(--sv-sys-color-on-primary)" : "var(--sv-sys-color-on-surface)";
418
- };
419
- return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
420
- /* @__PURE__ */ jsx("div", { className: "flex w-full overflow-hidden rounded-control", style: { height }, role: "img", "aria-label": data.map((d) => `${d.label} ${d.value}`).join(", "), children: data.map((d, i) => /* @__PURE__ */ jsx(
421
- "div",
422
- {
423
- className: "flex items-center justify-end px-2 first:rounded-l-control last:rounded-r-control",
424
- style: { width: `${d.value / total * 100}%`, background: fill(d, i) },
425
- children: /* @__PURE__ */ jsx("span", { className: "truncate text-[11px] font-medium tabular-nums", style: { color: onFill(d, i) }, children: d.value })
426
- },
427
- i
428
- )) }),
429
- showLegend && /* @__PURE__ */ jsx("ul", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-1", children: data.map((d, i) => /* @__PURE__ */ jsxs("li", { className: cn("flex items-center gap-1.5 text-[12px]", d.active ? "text-on-surface" : "text-on-surface-variant"), children: [
430
- /* @__PURE__ */ jsx("span", { className: "size-2 shrink-0 rounded-[2px]", style: { background: fill(d, i) }, "aria-hidden": "true" }),
431
- d.label
432
- ] }, i)) })
433
- ] });
434
- }
435
- SegmentedBar.displayName = "SegmentedBar";
436
-
437
- export { AreaChart, BarChart, Button, CATEGORICAL_MAX, Icon, Logo, LogoMark, Ring, SegmentedBar, Sparkline, Stat, buttonVariants, categorical, categoricalOn, chartToken, sequential, sequentialOn };
438
- //# sourceMappingURL=index.js.map
439
61
  //# sourceMappingURL=index.js.map