@cere/cere-design-system 0.0.45 → 0.1.0

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 (153) hide show
  1. package/dist/WorkflowNode-BnxXO6t_.d.mts +46 -0
  2. package/dist/WorkflowNode-BnxXO6t_.d.ts +46 -0
  3. package/dist/buttons.d.mts +114 -0
  4. package/dist/buttons.d.ts +114 -0
  5. package/dist/buttons.js +19 -0
  6. package/dist/buttons.js.map +1 -0
  7. package/dist/buttons.mjs +19 -0
  8. package/dist/buttons.mjs.map +1 -0
  9. package/dist/carousel.d.mts +51 -0
  10. package/dist/carousel.d.ts +51 -0
  11. package/dist/carousel.js +185 -0
  12. package/dist/carousel.js.map +1 -0
  13. package/dist/carousel.mjs +185 -0
  14. package/dist/carousel.mjs.map +1 -0
  15. package/dist/charts.d.mts +209 -0
  16. package/dist/charts.d.ts +209 -0
  17. package/dist/charts.js +20 -0
  18. package/dist/charts.js.map +1 -0
  19. package/dist/charts.mjs +20 -0
  20. package/dist/charts.mjs.map +1 -0
  21. package/dist/chunk-27JEWSWA.mjs +233 -0
  22. package/dist/chunk-27JEWSWA.mjs.map +1 -0
  23. package/dist/chunk-2EBCST6X.js +25 -0
  24. package/dist/chunk-2EBCST6X.js.map +1 -0
  25. package/dist/chunk-3WCMINE5.mjs +490 -0
  26. package/dist/chunk-3WCMINE5.mjs.map +1 -0
  27. package/dist/chunk-463SRKKD.js +111 -0
  28. package/dist/chunk-463SRKKD.js.map +1 -0
  29. package/dist/chunk-5ASG6G6U.mjs +40 -0
  30. package/dist/chunk-5ASG6G6U.mjs.map +1 -0
  31. package/dist/chunk-6EUAU67C.mjs +374 -0
  32. package/dist/chunk-6EUAU67C.mjs.map +1 -0
  33. package/dist/chunk-AIY6222Q.js +11 -0
  34. package/dist/chunk-AIY6222Q.js.map +1 -0
  35. package/dist/chunk-AJBM7IE6.mjs +2366 -0
  36. package/dist/chunk-AJBM7IE6.mjs.map +1 -0
  37. package/dist/chunk-ATIFLPH6.mjs +278 -0
  38. package/dist/chunk-ATIFLPH6.mjs.map +1 -0
  39. package/dist/chunk-BIZK6FUD.js +37 -0
  40. package/dist/chunk-BIZK6FUD.js.map +1 -0
  41. package/dist/chunk-CCN6M4LI.js +103 -0
  42. package/dist/chunk-CCN6M4LI.js.map +1 -0
  43. package/dist/chunk-CUCKULYC.mjs +2658 -0
  44. package/dist/chunk-CUCKULYC.mjs.map +1 -0
  45. package/dist/chunk-CWJ4OU6W.mjs +45 -0
  46. package/dist/chunk-CWJ4OU6W.mjs.map +1 -0
  47. package/dist/chunk-EOF3QNPF.js +2366 -0
  48. package/dist/chunk-EOF3QNPF.js.map +1 -0
  49. package/dist/chunk-FFZ5S7PQ.mjs +146 -0
  50. package/dist/chunk-FFZ5S7PQ.mjs.map +1 -0
  51. package/dist/chunk-FN5YL4BK.js +278 -0
  52. package/dist/chunk-FN5YL4BK.js.map +1 -0
  53. package/dist/chunk-HLH2VWXL.js +2658 -0
  54. package/dist/chunk-HLH2VWXL.js.map +1 -0
  55. package/dist/chunk-IE6GCHDI.mjs +530 -0
  56. package/dist/chunk-IE6GCHDI.mjs.map +1 -0
  57. package/dist/chunk-JBHRAAN3.js +31 -0
  58. package/dist/chunk-JBHRAAN3.js.map +1 -0
  59. package/dist/chunk-JS4IB5IU.mjs +162 -0
  60. package/dist/chunk-JS4IB5IU.mjs.map +1 -0
  61. package/dist/chunk-KF2Y7HO3.js +595 -0
  62. package/dist/chunk-KF2Y7HO3.js.map +1 -0
  63. package/dist/chunk-KPDYKK3V.js +162 -0
  64. package/dist/chunk-KPDYKK3V.js.map +1 -0
  65. package/dist/chunk-KVBMZNWT.mjs +103 -0
  66. package/dist/chunk-KVBMZNWT.mjs.map +1 -0
  67. package/dist/chunk-L2TIGA7I.js +530 -0
  68. package/dist/chunk-L2TIGA7I.js.map +1 -0
  69. package/dist/chunk-MNM6HE72.js +146 -0
  70. package/dist/chunk-MNM6HE72.js.map +1 -0
  71. package/dist/chunk-NXTVJ6PY.js +374 -0
  72. package/dist/chunk-NXTVJ6PY.js.map +1 -0
  73. package/dist/chunk-OWWDNDF4.js +40 -0
  74. package/dist/chunk-OWWDNDF4.js.map +1 -0
  75. package/dist/chunk-PHMNZK2R.mjs +18 -0
  76. package/dist/chunk-PHMNZK2R.mjs.map +1 -0
  77. package/dist/chunk-PWF2NJDB.mjs +377 -0
  78. package/dist/chunk-PWF2NJDB.mjs.map +1 -0
  79. package/dist/chunk-QBCRH7YF.mjs +37 -0
  80. package/dist/chunk-QBCRH7YF.mjs.map +1 -0
  81. package/dist/chunk-QD6RLAO2.mjs +11 -0
  82. package/dist/chunk-QD6RLAO2.mjs.map +1 -0
  83. package/dist/chunk-QY65OUAC.mjs +111 -0
  84. package/dist/chunk-QY65OUAC.mjs.map +1 -0
  85. package/dist/chunk-QYYQYZHV.js +45 -0
  86. package/dist/chunk-QYYQYZHV.js.map +1 -0
  87. package/dist/chunk-T7LPABOL.mjs +595 -0
  88. package/dist/chunk-T7LPABOL.mjs.map +1 -0
  89. package/dist/chunk-THQKYTQE.js +490 -0
  90. package/dist/chunk-THQKYTQE.js.map +1 -0
  91. package/dist/chunk-U2QHFISG.js +18 -0
  92. package/dist/chunk-U2QHFISG.js.map +1 -0
  93. package/dist/chunk-UPGFBPFX.mjs +25 -0
  94. package/dist/chunk-UPGFBPFX.mjs.map +1 -0
  95. package/dist/chunk-X7E6GMFL.js +233 -0
  96. package/dist/chunk-X7E6GMFL.js.map +1 -0
  97. package/dist/chunk-XF66WQZE.mjs +1535 -0
  98. package/dist/chunk-XF66WQZE.mjs.map +1 -0
  99. package/dist/chunk-YQOZPLTY.js +1535 -0
  100. package/dist/chunk-YQOZPLTY.js.map +1 -0
  101. package/dist/chunk-ZGCN5WCG.js +377 -0
  102. package/dist/chunk-ZGCN5WCG.js.map +1 -0
  103. package/dist/chunk-ZP26PGMS.mjs +31 -0
  104. package/dist/chunk-ZP26PGMS.mjs.map +1 -0
  105. package/dist/feedback.d.mts +356 -0
  106. package/dist/feedback.d.ts +356 -0
  107. package/dist/feedback.js +43 -0
  108. package/dist/feedback.js.map +1 -0
  109. package/dist/feedback.mjs +43 -0
  110. package/dist/feedback.mjs.map +1 -0
  111. package/dist/icons.d.mts +22 -0
  112. package/dist/icons.d.ts +22 -0
  113. package/dist/icons.js +23 -0
  114. package/dist/icons.js.map +1 -0
  115. package/dist/icons.mjs +23 -0
  116. package/dist/icons.mjs.map +1 -0
  117. package/dist/index.d.mts +165 -3080
  118. package/dist/index.d.ts +165 -3080
  119. package/dist/index.js +320 -10082
  120. package/dist/index.js.map +1 -1
  121. package/dist/index.mjs +262 -9983
  122. package/dist/index.mjs.map +1 -1
  123. package/dist/inputs.d.mts +109 -0
  124. package/dist/inputs.d.ts +109 -0
  125. package/dist/inputs.js +43 -0
  126. package/dist/inputs.js.map +1 -0
  127. package/dist/inputs.mjs +43 -0
  128. package/dist/inputs.mjs.map +1 -0
  129. package/dist/layout.d.mts +927 -0
  130. package/dist/layout.d.ts +927 -0
  131. package/dist/layout.js +122 -0
  132. package/dist/layout.js.map +1 -0
  133. package/dist/layout.mjs +122 -0
  134. package/dist/layout.mjs.map +1 -0
  135. package/dist/navigation.d.mts +716 -0
  136. package/dist/navigation.d.ts +716 -0
  137. package/dist/navigation.js +58 -0
  138. package/dist/navigation.js.map +1 -0
  139. package/dist/navigation.mjs +58 -0
  140. package/dist/navigation.mjs.map +1 -0
  141. package/dist/third-party.d.mts +637 -0
  142. package/dist/third-party.d.ts +637 -0
  143. package/dist/third-party.js +45 -0
  144. package/dist/third-party.js.map +1 -0
  145. package/dist/third-party.mjs +45 -0
  146. package/dist/third-party.mjs.map +1 -0
  147. package/dist/utilities.d.mts +39 -0
  148. package/dist/utilities.d.ts +39 -0
  149. package/dist/utilities.js +19 -0
  150. package/dist/utilities.js.map +1 -0
  151. package/dist/utilities.mjs +19 -0
  152. package/dist/utilities.mjs.map +1 -0
  153. package/package.json +55 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/cere-design-system/cere-design-system/dist/carousel.js","../src/components/layout/Carousel.tsx"],"names":[],"mappings":"AAAA;ACAA,8BAA6D;AAC7D,kFAAgB;AAChB,8GAAuB;AACvB,8GAAuB;AACvB,wHAA4B;AAC5B,4HAA6B;AAC7B,8CAAsB;AAEtB,kIAA6B;AAC7B,8IAAqB;AA4IT,+CAAA;AAlGZ,IAAM,KAAA,EAAO,CAAC,CAAA,EAAA,GAAc,MAAA,CAAO,CAAC,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAA;AAO9C,SAAS,QAAA,CAAY;AAAA,EAC1B,MAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA,EAAgB,CAAA;AAAA,EAChB,SAAA,EAAW,IAAA;AAAA,EACX,gBAAA,EAAkB,GAAA;AAAA,EAClB,SAAA,EAAW,IAAA;AAAA,EACX,YAAA,EAAc,IAAA;AAAA,EACd,WAAA,EAAa,IAAA;AAAA,EACb,aAAA,EAAe,IAAA;AAAA,EACf,SAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,QAAA,EAAU,4BAAA;AAAA,IACd,CAAA,EAAA,GACE,SAAA,EACI;AAAA,MACE,6CAAA;AAAS,QACP,KAAA,EAAO,eAAA;AAAA,QACP,iBAAA,EAAmB,IAAA;AAAA,QACnB,gBAAA,EAAkB;AAAA,MACpB,CAAC;AAAA,IACH,EAAA,EACA,CAAC,CAAA;AAAA,IACP,CAAC,QAAA,EAAU,eAAA,EAAiB,YAAY;AAAA,EAC1C,CAAA;AAEA,EAAA,MAAM,CAAC,QAAA,EAAU,QAAQ,EAAA,EAAI,0CAAA;AAAA,IAC3B,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,GAAG,aAAa,CAAA;AAAA,IAC9C;AAAA,EACF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,MAAA;AAAA,IAAA;AAEJ,EAAA;AAEJ;AD7DsB;AACA;AACA","file":"/home/runner/work/cere-design-system/cere-design-system/dist/carousel.js","sourcesContent":[null,"import { Key, ReactNode, useEffect, useMemo, useState } from 'react';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\nimport ChevronLeftIcon from '@mui/icons-material/ChevronLeft';\nimport ChevronRightIcon from '@mui/icons-material/ChevronRight';\nimport { alpha } from '@mui/material/styles';\nimport type { SxProps, Theme } from '@mui/material/styles';\nimport useEmblaCarousel from 'embla-carousel-react';\nimport Autoplay from 'embla-carousel-autoplay';\nimport type { EmblaOptionsType } from 'embla-carousel';\n\nexport interface CarouselProps<T> {\n /** Slide data. Each entry is passed to `renderSlide`. */\n slides: T[];\n /** Render function for an individual slide. */\n renderSlide: (item: T, index: number) => ReactNode;\n /**\n * Stable per-slide React key. Always set this when `slides` can be reordered\n * or filtered; otherwise React will reuse the wrong slide's internal state\n * across renders. Defaults to the slide's array index when omitted.\n */\n getKey?: (item: T, index: number) => Key;\n /** Slides visible in the viewport. @default 1 */\n slidesPerView?: number;\n /** Auto-advance every `autoplayDelayMs` while not hovered. @default true */\n autoplay?: boolean;\n /** Autoplay tick in milliseconds. @default 5000 */\n autoplayDelayMs?: number;\n /** Show dot indicators when more than one slide. @default true */\n showDots?: boolean;\n /** Show the `01 / 03`-style counter when more than one slide. @default true */\n showCounter?: boolean;\n /** Show prev/next chevrons when more than one slide. @default true */\n showArrows?: boolean;\n /** Pause autoplay while the pointer is over the carousel. @default true */\n pauseOnHover?: boolean;\n /** Accessible label for the surrounding region. */\n ariaLabel?: string;\n /** Fires with the new index whenever embla selects a slide. */\n onSelect?: (index: number) => void;\n /** Override the IconButton sx for the prev/next arrows. */\n arrowSx?: SxProps<Theme>;\n /** Override the dot color (inactive). Accepts any CSS color string. */\n dotColor?: string;\n /** Override the active dot color. Accepts any CSS color string. */\n dotActiveColor?: string;\n /** Escape hatch for advanced embla options. Most consumers don't need this. */\n emblaOptions?: EmblaOptionsType;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, '0');\n\n/**\n * Carousel — embla-carousel-based slide deck with autoplay, dots, counter,\n * prev/next arrows and pause-on-hover. Generic over slide payload type; the\n * caller decides the slide markup via `renderSlide`.\n */\nexport function Carousel<T>({\n slides,\n renderSlide,\n getKey,\n slidesPerView = 1,\n autoplay = true,\n autoplayDelayMs = 5000,\n showDots = true,\n showCounter = true,\n showArrows = true,\n pauseOnHover = true,\n ariaLabel,\n onSelect,\n arrowSx,\n dotColor,\n dotActiveColor,\n emblaOptions,\n}: CarouselProps<T>) {\n const plugins = useMemo(\n () =>\n autoplay\n ? [\n Autoplay({\n delay: autoplayDelayMs,\n stopOnInteraction: true,\n stopOnMouseEnter: pauseOnHover,\n }),\n ]\n : [],\n [autoplay, autoplayDelayMs, pauseOnHover],\n );\n\n const [emblaRef, emblaApi] = useEmblaCarousel(\n { loop: true, align: 'start', ...emblaOptions },\n plugins,\n );\n const [selected, setSelected] = useState(0);\n const [snapCount, setSnapCount] = useState(0);\n const count = slides.length;\n\n useEffect(() => {\n if (!emblaApi) return;\n const refreshSnaps = () => {\n setSnapCount(emblaApi.scrollSnapList().length);\n };\n const handleSelect = () => {\n const next = emblaApi.selectedScrollSnap();\n setSelected(next);\n onSelect?.(next);\n };\n emblaApi.on('select', handleSelect);\n emblaApi.on('reInit', refreshSnaps);\n refreshSnaps();\n handleSelect();\n return () => {\n emblaApi.off('select', handleSelect);\n emblaApi.off('reInit', refreshSnaps);\n };\n }, [emblaApi, onSelect]);\n\n if (count === 0) return null;\n\n const showControls = count > 1;\n const slideBasis = `${100 / Math.max(1, slidesPerView)}%`;\n // Embla groups slides into snap positions; with slidesPerView > 1 there are\n // fewer snaps than slides. Fall back to slide count if snap list hasn't\n // populated yet (first render before embla emits reInit).\n const dotCount = snapCount > 0 ? snapCount : count;\n\n // Default arrow style is the carrier-agnostic pill (bg.paper + shadow) so\n // arrows read on any slide background. Consumers that need a different look\n // (e.g. transparent white-on-gradient for a banner) pass `arrowSx`.\n const arrowBaseSx: SxProps<Theme> = {\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n bgcolor: 'background.paper',\n boxShadow: 1,\n '&:hover': { bgcolor: 'background.paper' },\n };\n\n return (\n <Box\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel}\n sx={{ position: 'relative', width: '100%' }}\n >\n <Box ref={emblaRef} sx={{ overflow: 'hidden' }}>\n <Box sx={{ display: 'flex' }}>\n {slides.map((item, i) => (\n <Box\n key={getKey ? getKey(item, i) : i}\n role=\"group\"\n aria-roledescription=\"slide\"\n aria-label={`${i + 1} of ${count}`}\n sx={{ flex: `0 0 ${slideBasis}`, minWidth: 0 }}\n >\n {renderSlide(item, i)}\n </Box>\n ))}\n </Box>\n </Box>\n\n {showControls && showArrows && (\n <>\n <IconButton\n aria-label=\"Previous slide\"\n onClick={() => emblaApi?.scrollPrev()}\n sx={[arrowBaseSx, { left: 8 }, ...(Array.isArray(arrowSx) ? arrowSx : [arrowSx])]}\n >\n <ChevronLeftIcon />\n </IconButton>\n <IconButton\n aria-label=\"Next slide\"\n onClick={() => emblaApi?.scrollNext()}\n sx={[arrowBaseSx, { right: 8 }, ...(Array.isArray(arrowSx) ? arrowSx : [arrowSx])]}\n >\n <ChevronRightIcon />\n </IconButton>\n </>\n )}\n\n {showControls && showCounter && (\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n position: 'absolute',\n top: 12,\n right: 16,\n px: 1,\n py: 0.25,\n borderRadius: 1,\n bgcolor: alpha(theme.palette.common.black, 0.5),\n color: 'common.white',\n letterSpacing: 1,\n })}\n >\n {pad2(selected + 1)} / {pad2(dotCount)}\n </Typography>\n )}\n\n {showControls && showDots && (\n <Box\n role=\"tablist\"\n aria-label=\"Carousel slides\"\n sx={{\n position: 'absolute',\n bottom: 12,\n left: 0,\n right: 0,\n display: 'flex',\n justifyContent: 'center',\n gap: 1,\n }}\n >\n {Array.from({ length: dotCount }).map((_, i) => (\n <Box\n key={i}\n component=\"button\"\n role=\"tab\"\n aria-selected={i === selected}\n aria-label={`Go to slide ${i + 1}`}\n type=\"button\"\n onClick={() => emblaApi?.scrollTo(i)}\n sx={(theme) => ({\n width: i === selected ? 24 : 8,\n height: 8,\n borderRadius: 4,\n border: 'none',\n padding: 0,\n cursor: 'pointer',\n bgcolor:\n i === selected\n ? (dotActiveColor ?? theme.palette.primary.main)\n : (dotColor ?? theme.palette.action.disabled),\n transition: 'width 0.2s ease, background 0.2s ease',\n })}\n />\n ))}\n </Box>\n )}\n </Box>\n );\n}\n"]}
@@ -0,0 +1,185 @@
1
+ // src/components/layout/Carousel.tsx
2
+ import { useEffect, useMemo, useState } from "react";
3
+ import Box from "@mui/material/Box";
4
+ import IconButton from "@mui/material/IconButton";
5
+ import Typography from "@mui/material/Typography";
6
+ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
7
+ import ChevronRightIcon from "@mui/icons-material/ChevronRight";
8
+ import { alpha } from "@mui/material/styles";
9
+ import useEmblaCarousel from "embla-carousel-react";
10
+ import Autoplay from "embla-carousel-autoplay";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ var pad2 = (n) => String(n).padStart(2, "0");
13
+ function Carousel({
14
+ slides,
15
+ renderSlide,
16
+ getKey,
17
+ slidesPerView = 1,
18
+ autoplay = true,
19
+ autoplayDelayMs = 5e3,
20
+ showDots = true,
21
+ showCounter = true,
22
+ showArrows = true,
23
+ pauseOnHover = true,
24
+ ariaLabel,
25
+ onSelect,
26
+ arrowSx,
27
+ dotColor,
28
+ dotActiveColor,
29
+ emblaOptions
30
+ }) {
31
+ const plugins = useMemo(
32
+ () => autoplay ? [
33
+ Autoplay({
34
+ delay: autoplayDelayMs,
35
+ stopOnInteraction: true,
36
+ stopOnMouseEnter: pauseOnHover
37
+ })
38
+ ] : [],
39
+ [autoplay, autoplayDelayMs, pauseOnHover]
40
+ );
41
+ const [emblaRef, emblaApi] = useEmblaCarousel(
42
+ { loop: true, align: "start", ...emblaOptions },
43
+ plugins
44
+ );
45
+ const [selected, setSelected] = useState(0);
46
+ const [snapCount, setSnapCount] = useState(0);
47
+ const count = slides.length;
48
+ useEffect(() => {
49
+ if (!emblaApi) return;
50
+ const refreshSnaps = () => {
51
+ setSnapCount(emblaApi.scrollSnapList().length);
52
+ };
53
+ const handleSelect = () => {
54
+ const next = emblaApi.selectedScrollSnap();
55
+ setSelected(next);
56
+ onSelect?.(next);
57
+ };
58
+ emblaApi.on("select", handleSelect);
59
+ emblaApi.on("reInit", refreshSnaps);
60
+ refreshSnaps();
61
+ handleSelect();
62
+ return () => {
63
+ emblaApi.off("select", handleSelect);
64
+ emblaApi.off("reInit", refreshSnaps);
65
+ };
66
+ }, [emblaApi, onSelect]);
67
+ if (count === 0) return null;
68
+ const showControls = count > 1;
69
+ const slideBasis = `${100 / Math.max(1, slidesPerView)}%`;
70
+ const dotCount = snapCount > 0 ? snapCount : count;
71
+ const arrowBaseSx = {
72
+ position: "absolute",
73
+ top: "50%",
74
+ transform: "translateY(-50%)",
75
+ bgcolor: "background.paper",
76
+ boxShadow: 1,
77
+ "&:hover": { bgcolor: "background.paper" }
78
+ };
79
+ return /* @__PURE__ */ jsxs(
80
+ Box,
81
+ {
82
+ role: "region",
83
+ "aria-roledescription": "carousel",
84
+ "aria-label": ariaLabel,
85
+ sx: { position: "relative", width: "100%" },
86
+ children: [
87
+ /* @__PURE__ */ jsx(Box, { ref: emblaRef, sx: { overflow: "hidden" }, children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex" }, children: slides.map((item, i) => /* @__PURE__ */ jsx(
88
+ Box,
89
+ {
90
+ role: "group",
91
+ "aria-roledescription": "slide",
92
+ "aria-label": `${i + 1} of ${count}`,
93
+ sx: { flex: `0 0 ${slideBasis}`, minWidth: 0 },
94
+ children: renderSlide(item, i)
95
+ },
96
+ getKey ? getKey(item, i) : i
97
+ )) }) }),
98
+ showControls && showArrows && /* @__PURE__ */ jsxs(Fragment, { children: [
99
+ /* @__PURE__ */ jsx(
100
+ IconButton,
101
+ {
102
+ "aria-label": "Previous slide",
103
+ onClick: () => emblaApi?.scrollPrev(),
104
+ sx: [arrowBaseSx, { left: 8 }, ...Array.isArray(arrowSx) ? arrowSx : [arrowSx]],
105
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
106
+ }
107
+ ),
108
+ /* @__PURE__ */ jsx(
109
+ IconButton,
110
+ {
111
+ "aria-label": "Next slide",
112
+ onClick: () => emblaApi?.scrollNext(),
113
+ sx: [arrowBaseSx, { right: 8 }, ...Array.isArray(arrowSx) ? arrowSx : [arrowSx]],
114
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
115
+ }
116
+ )
117
+ ] }),
118
+ showControls && showCounter && /* @__PURE__ */ jsxs(
119
+ Typography,
120
+ {
121
+ variant: "caption",
122
+ sx: (theme) => ({
123
+ position: "absolute",
124
+ top: 12,
125
+ right: 16,
126
+ px: 1,
127
+ py: 0.25,
128
+ borderRadius: 1,
129
+ bgcolor: alpha(theme.palette.common.black, 0.5),
130
+ color: "common.white",
131
+ letterSpacing: 1
132
+ }),
133
+ children: [
134
+ pad2(selected + 1),
135
+ " / ",
136
+ pad2(dotCount)
137
+ ]
138
+ }
139
+ ),
140
+ showControls && showDots && /* @__PURE__ */ jsx(
141
+ Box,
142
+ {
143
+ role: "tablist",
144
+ "aria-label": "Carousel slides",
145
+ sx: {
146
+ position: "absolute",
147
+ bottom: 12,
148
+ left: 0,
149
+ right: 0,
150
+ display: "flex",
151
+ justifyContent: "center",
152
+ gap: 1
153
+ },
154
+ children: Array.from({ length: dotCount }).map((_, i) => /* @__PURE__ */ jsx(
155
+ Box,
156
+ {
157
+ component: "button",
158
+ role: "tab",
159
+ "aria-selected": i === selected,
160
+ "aria-label": `Go to slide ${i + 1}`,
161
+ type: "button",
162
+ onClick: () => emblaApi?.scrollTo(i),
163
+ sx: (theme) => ({
164
+ width: i === selected ? 24 : 8,
165
+ height: 8,
166
+ borderRadius: 4,
167
+ border: "none",
168
+ padding: 0,
169
+ cursor: "pointer",
170
+ bgcolor: i === selected ? dotActiveColor ?? theme.palette.primary.main : dotColor ?? theme.palette.action.disabled,
171
+ transition: "width 0.2s ease, background 0.2s ease"
172
+ })
173
+ },
174
+ i
175
+ ))
176
+ }
177
+ )
178
+ ]
179
+ }
180
+ );
181
+ }
182
+ export {
183
+ Carousel
184
+ };
185
+ //# sourceMappingURL=carousel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/layout/Carousel.tsx"],"sourcesContent":["import { Key, ReactNode, useEffect, useMemo, useState } from 'react';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\nimport ChevronLeftIcon from '@mui/icons-material/ChevronLeft';\nimport ChevronRightIcon from '@mui/icons-material/ChevronRight';\nimport { alpha } from '@mui/material/styles';\nimport type { SxProps, Theme } from '@mui/material/styles';\nimport useEmblaCarousel from 'embla-carousel-react';\nimport Autoplay from 'embla-carousel-autoplay';\nimport type { EmblaOptionsType } from 'embla-carousel';\n\nexport interface CarouselProps<T> {\n /** Slide data. Each entry is passed to `renderSlide`. */\n slides: T[];\n /** Render function for an individual slide. */\n renderSlide: (item: T, index: number) => ReactNode;\n /**\n * Stable per-slide React key. Always set this when `slides` can be reordered\n * or filtered; otherwise React will reuse the wrong slide's internal state\n * across renders. Defaults to the slide's array index when omitted.\n */\n getKey?: (item: T, index: number) => Key;\n /** Slides visible in the viewport. @default 1 */\n slidesPerView?: number;\n /** Auto-advance every `autoplayDelayMs` while not hovered. @default true */\n autoplay?: boolean;\n /** Autoplay tick in milliseconds. @default 5000 */\n autoplayDelayMs?: number;\n /** Show dot indicators when more than one slide. @default true */\n showDots?: boolean;\n /** Show the `01 / 03`-style counter when more than one slide. @default true */\n showCounter?: boolean;\n /** Show prev/next chevrons when more than one slide. @default true */\n showArrows?: boolean;\n /** Pause autoplay while the pointer is over the carousel. @default true */\n pauseOnHover?: boolean;\n /** Accessible label for the surrounding region. */\n ariaLabel?: string;\n /** Fires with the new index whenever embla selects a slide. */\n onSelect?: (index: number) => void;\n /** Override the IconButton sx for the prev/next arrows. */\n arrowSx?: SxProps<Theme>;\n /** Override the dot color (inactive). Accepts any CSS color string. */\n dotColor?: string;\n /** Override the active dot color. Accepts any CSS color string. */\n dotActiveColor?: string;\n /** Escape hatch for advanced embla options. Most consumers don't need this. */\n emblaOptions?: EmblaOptionsType;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, '0');\n\n/**\n * Carousel — embla-carousel-based slide deck with autoplay, dots, counter,\n * prev/next arrows and pause-on-hover. Generic over slide payload type; the\n * caller decides the slide markup via `renderSlide`.\n */\nexport function Carousel<T>({\n slides,\n renderSlide,\n getKey,\n slidesPerView = 1,\n autoplay = true,\n autoplayDelayMs = 5000,\n showDots = true,\n showCounter = true,\n showArrows = true,\n pauseOnHover = true,\n ariaLabel,\n onSelect,\n arrowSx,\n dotColor,\n dotActiveColor,\n emblaOptions,\n}: CarouselProps<T>) {\n const plugins = useMemo(\n () =>\n autoplay\n ? [\n Autoplay({\n delay: autoplayDelayMs,\n stopOnInteraction: true,\n stopOnMouseEnter: pauseOnHover,\n }),\n ]\n : [],\n [autoplay, autoplayDelayMs, pauseOnHover],\n );\n\n const [emblaRef, emblaApi] = useEmblaCarousel(\n { loop: true, align: 'start', ...emblaOptions },\n plugins,\n );\n const [selected, setSelected] = useState(0);\n const [snapCount, setSnapCount] = useState(0);\n const count = slides.length;\n\n useEffect(() => {\n if (!emblaApi) return;\n const refreshSnaps = () => {\n setSnapCount(emblaApi.scrollSnapList().length);\n };\n const handleSelect = () => {\n const next = emblaApi.selectedScrollSnap();\n setSelected(next);\n onSelect?.(next);\n };\n emblaApi.on('select', handleSelect);\n emblaApi.on('reInit', refreshSnaps);\n refreshSnaps();\n handleSelect();\n return () => {\n emblaApi.off('select', handleSelect);\n emblaApi.off('reInit', refreshSnaps);\n };\n }, [emblaApi, onSelect]);\n\n if (count === 0) return null;\n\n const showControls = count > 1;\n const slideBasis = `${100 / Math.max(1, slidesPerView)}%`;\n // Embla groups slides into snap positions; with slidesPerView > 1 there are\n // fewer snaps than slides. Fall back to slide count if snap list hasn't\n // populated yet (first render before embla emits reInit).\n const dotCount = snapCount > 0 ? snapCount : count;\n\n // Default arrow style is the carrier-agnostic pill (bg.paper + shadow) so\n // arrows read on any slide background. Consumers that need a different look\n // (e.g. transparent white-on-gradient for a banner) pass `arrowSx`.\n const arrowBaseSx: SxProps<Theme> = {\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n bgcolor: 'background.paper',\n boxShadow: 1,\n '&:hover': { bgcolor: 'background.paper' },\n };\n\n return (\n <Box\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel}\n sx={{ position: 'relative', width: '100%' }}\n >\n <Box ref={emblaRef} sx={{ overflow: 'hidden' }}>\n <Box sx={{ display: 'flex' }}>\n {slides.map((item, i) => (\n <Box\n key={getKey ? getKey(item, i) : i}\n role=\"group\"\n aria-roledescription=\"slide\"\n aria-label={`${i + 1} of ${count}`}\n sx={{ flex: `0 0 ${slideBasis}`, minWidth: 0 }}\n >\n {renderSlide(item, i)}\n </Box>\n ))}\n </Box>\n </Box>\n\n {showControls && showArrows && (\n <>\n <IconButton\n aria-label=\"Previous slide\"\n onClick={() => emblaApi?.scrollPrev()}\n sx={[arrowBaseSx, { left: 8 }, ...(Array.isArray(arrowSx) ? arrowSx : [arrowSx])]}\n >\n <ChevronLeftIcon />\n </IconButton>\n <IconButton\n aria-label=\"Next slide\"\n onClick={() => emblaApi?.scrollNext()}\n sx={[arrowBaseSx, { right: 8 }, ...(Array.isArray(arrowSx) ? arrowSx : [arrowSx])]}\n >\n <ChevronRightIcon />\n </IconButton>\n </>\n )}\n\n {showControls && showCounter && (\n <Typography\n variant=\"caption\"\n sx={(theme) => ({\n position: 'absolute',\n top: 12,\n right: 16,\n px: 1,\n py: 0.25,\n borderRadius: 1,\n bgcolor: alpha(theme.palette.common.black, 0.5),\n color: 'common.white',\n letterSpacing: 1,\n })}\n >\n {pad2(selected + 1)} / {pad2(dotCount)}\n </Typography>\n )}\n\n {showControls && showDots && (\n <Box\n role=\"tablist\"\n aria-label=\"Carousel slides\"\n sx={{\n position: 'absolute',\n bottom: 12,\n left: 0,\n right: 0,\n display: 'flex',\n justifyContent: 'center',\n gap: 1,\n }}\n >\n {Array.from({ length: dotCount }).map((_, i) => (\n <Box\n key={i}\n component=\"button\"\n role=\"tab\"\n aria-selected={i === selected}\n aria-label={`Go to slide ${i + 1}`}\n type=\"button\"\n onClick={() => emblaApi?.scrollTo(i)}\n sx={(theme) => ({\n width: i === selected ? 24 : 8,\n height: 8,\n borderRadius: 4,\n border: 'none',\n padding: 0,\n cursor: 'pointer',\n bgcolor:\n i === selected\n ? (dotActiveColor ?? theme.palette.primary.main)\n : (dotColor ?? theme.palette.action.disabled),\n transition: 'width 0.2s ease, background 0.2s ease',\n })}\n />\n ))}\n </Box>\n )}\n </Box>\n );\n}\n"],"mappings":";AAAA,SAAyB,WAAW,SAAS,gBAAgB;AAC7D,OAAO,SAAS;AAChB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,OAAO,sBAAsB;AAC7B,SAAS,aAAa;AAEtB,OAAO,sBAAsB;AAC7B,OAAO,cAAc;AA4IT,SAcJ,UAdI,KAcJ,YAdI;AAlGZ,IAAM,OAAO,CAAC,MAAc,OAAO,CAAC,EAAE,SAAS,GAAG,GAAG;AAO9C,SAAS,SAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,G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S,MAAM,MAAM,QAAQ,OAAO,OAAO,GAAG;AAAA,cAC9C,OAAO;AAAA,cACP,eAAe;AAAA,YACjB;AAAA,YAEC;AAAA,mBAAK,WAAW,CAAC;AAAA,cAAE;AAAA,cAAI,KAAK,QAAQ;AAAA;AAAA;AAAA,QACvC;AAAA,QAGD,gBAAgB,YACf;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,IAAI;AAAA,cACF,UAAU;AAAA,cACV,QAAQ;AAAA,cACR,MAAM;AAAA,cACN,OAAO;AAAA,cACP,SAAS;AAAA,cACT,gBAAgB;AAAA,cAChB,KAAK;AAAA,YACP;AAAA,YAEC,gBAAM,KAAK,EAAE,QAAQ,SAAS,CAAC,EAAE,IAAI,CAAC,GAAG,MACxC;AAAA,cAAC;AAAA;AAAA,gBAEC,WAAU;AAAA,gBACV,MAAK;AAAA,gBACL,iBAAe,MAAM;AAAA,gBACrB,cAAY,eAAe,IAAI,CAAC;AAAA,gBAChC,MAAK;AAAA,gBACL,SAAS,MAAM,UAAU,SAAS,CAAC;AAAA,gBACnC,IAAI,CAAC,WAAW;AAAA,kBACd,OAAO,MAAM,WAAW,KAAK;AAAA,kBAC7B,QAAQ;AAAA,kBACR,cAAc;AAAA,kBACd,QAAQ;AAAA,kBACR,SAAS;AAAA,kBACT,QAAQ;AAAA,kBACR,SACE,MAAM,WACD,kBAAkB,MAAM,QAAQ,QAAQ,OACxC,YAAY,MAAM,QAAQ,OAAO;AAAA,kBACxC,YAAY;AAAA,gBACd;AAAA;AAAA,cAnBK;AAAA,YAoBP,CACD;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -0,0 +1,209 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type ChartWidgetHistoryRecord = {
5
+ date: Date;
6
+ value: number;
7
+ };
8
+ type ChartWidgetProps = {
9
+ title: string;
10
+ value?: ReactNode;
11
+ history?: ChartWidgetHistoryRecord[];
12
+ formatValue?: (value: number) => string;
13
+ };
14
+ declare const ChartWidget: ({ title, value, history, formatValue, }: ChartWidgetProps) => react_jsx_runtime.JSX.Element;
15
+
16
+ type MetricsHistoryRecord = {
17
+ storedBytes: number;
18
+ transferredBytes: number;
19
+ puts: number;
20
+ gets: number;
21
+ recordTime: Date;
22
+ };
23
+ type MetricsChartProps = {
24
+ history?: MetricsHistoryRecord[];
25
+ };
26
+ /**
27
+ * TODO: Refactor this component to use shared graphs configuration
28
+ */
29
+ declare const MetricsChart: ({ history }: MetricsChartProps) => react_jsx_runtime.JSX.Element;
30
+
31
+ type MetricsPeriod = 'hour' | 'day' | 'week' | 'month';
32
+ type PeriodSelectProps = {
33
+ value?: MetricsPeriod;
34
+ onChange?: (value: MetricsPeriod) => void;
35
+ };
36
+ declare const PeriodSelect: ({ value, onChange }: PeriodSelectProps) => react_jsx_runtime.JSX.Element;
37
+
38
+ /**
39
+ * Represents a single time range option in the dropdown.
40
+ */
41
+ interface TimeRangeOption {
42
+ /** Display label shown in the dropdown (e.g., "1 week") */
43
+ label: string;
44
+ /** Value identifier passed to the callback on selection */
45
+ value: string;
46
+ }
47
+ interface TimeRangeSelectProps {
48
+ /** Available time range options */
49
+ options: TimeRangeOption[];
50
+ /** Currently selected time range value */
51
+ value?: string;
52
+ /** Callback invoked when user selects a different time range */
53
+ onChange?: (value: string) => void;
54
+ }
55
+ /**
56
+ * Configurable time range dropdown selector.
57
+ * Renders a compact select field with the provided time range options.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * <TimeRangeSelect
62
+ * options={[
63
+ * { label: 'Last hour', value: 'hour' },
64
+ * { label: '24 hours', value: 'day' },
65
+ * { label: '1 week', value: 'week' },
66
+ * ]}
67
+ * value="week"
68
+ * onChange={(value) => console.log(value)}
69
+ * />
70
+ * ```
71
+ */
72
+ declare const TimeRangeSelect: ({ options, value, onChange }: TimeRangeSelectProps) => react_jsx_runtime.JSX.Element;
73
+
74
+ /**
75
+ * Represents a single summary statistic item displayed below the graph.
76
+ */
77
+ interface SummaryItem {
78
+ /** Descriptive label (e.g., "Total Engagements") */
79
+ label: string;
80
+ /** Numeric or string value (e.g., "13.72" or 11372) */
81
+ value: string | number;
82
+ /** Optional unit suffix (e.g., "K", "GB", "%") */
83
+ unit?: string;
84
+ }
85
+ interface SummaryStatsProps {
86
+ /** Array of summary items to display */
87
+ items: SummaryItem[];
88
+ }
89
+ /**
90
+ * Renders a horizontal row of summary statistics below the graph.
91
+ * Each item shows a label with its corresponding value and optional unit.
92
+ *
93
+ * Matches the Figma design layout with label in secondary text color
94
+ * and value in bold heading typography.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * <SummaryStats
99
+ * items={[
100
+ * { label: 'Total Engagements', value: 11372 },
101
+ * { label: 'Total Consumed', value: '156.91', unit: 'GB' },
102
+ * ]}
103
+ * />
104
+ * ```
105
+ */
106
+ declare const SummaryStats: ({ items }: SummaryStatsProps) => react_jsx_runtime.JSX.Element | null;
107
+
108
+ /**
109
+ * A single data point in a time series.
110
+ * Use `null` for the value to represent missing/gap data — the line will break.
111
+ */
112
+ interface DataPoint {
113
+ /** Timestamp of the observation */
114
+ timestamp: Date;
115
+ /** Numeric value, or `null` to indicate a gap in the data */
116
+ value: number | null;
117
+ }
118
+ /**
119
+ * Represents one line on the graph (a named data series).
120
+ */
121
+ interface DataSeries {
122
+ /** Unique display name for this series (shown in legend) */
123
+ name: string;
124
+ /** CSS color string for the line and legend indicator */
125
+ color: string;
126
+ /** Ordered array of data points */
127
+ data: DataPoint[];
128
+ }
129
+ interface TimeSeriesGraphProps {
130
+ /** Optional title displayed at the top-left of the graph card */
131
+ title?: string;
132
+ /**
133
+ * Array of data series to render. Each series becomes one line on the graph.
134
+ * There is no hardcoded limit on the number of series.
135
+ */
136
+ series: DataSeries[];
137
+ /**
138
+ * Configurable time range options for the dropdown selector.
139
+ * When omitted, the time range dropdown is not rendered.
140
+ */
141
+ timeRangeOptions?: TimeRangeOption[];
142
+ /** Currently selected time range value (controlled) */
143
+ selectedTimeRange?: string;
144
+ /** Callback invoked when the user picks a different time range */
145
+ onTimeRangeChange?: (value: string) => void;
146
+ /**
147
+ * Optional array of summary statistics displayed below the graph.
148
+ * When omitted or empty, the summary section is hidden.
149
+ */
150
+ summaryItems?: SummaryItem[];
151
+ /**
152
+ * Whether to show the summary statistics section.
153
+ * Defaults to `true`. Set to `false` to explicitly hide, even when `summaryItems` are provided.
154
+ */
155
+ showSummary?: boolean;
156
+ /**
157
+ * Optional header action element rendered to the right of the title
158
+ * (e.g., a secondary dropdown or filter control).
159
+ */
160
+ headerAction?: ReactNode;
161
+ /**
162
+ * When `true`, shows a loading overlay (spinner) over the graph area
163
+ * while the header remains visible and interactive.
164
+ */
165
+ loading?: boolean;
166
+ /**
167
+ * Override the x-axis date format string (date-fns format tokens).
168
+ * When omitted, the format is auto-detected from the data's time span:
169
+ * - <= 24 hours → `'HH:mm'`
170
+ * - > 24 hours → `'do MMM'`
171
+ */
172
+ xAxisFormat?: string;
173
+ }
174
+ /**
175
+ * A reusable time series graph component that displays one or more data lines
176
+ * over a shared time axis. Supports configurable time range selection,
177
+ * optional summary statistics, interactive legend toggling, crosshair tooltips,
178
+ * and a loading state.
179
+ *
180
+ * Built on `@mui/x-charts` LineChart and the Cere Design System theme.
181
+ *
182
+ * @example
183
+ * ```tsx
184
+ * <TimeSeriesGraph
185
+ * title="Engagement over time"
186
+ * series={[
187
+ * { name: 'Engagements', color: '#6750A4', data: engagementData },
188
+ * { name: 'Unique Streams', color: '#4caf50', data: streamData },
189
+ * ]}
190
+ * timeRangeOptions={[
191
+ * { label: 'Last hour', value: 'hour' },
192
+ * { label: '24 hours', value: 'day' },
193
+ * { label: '1 week', value: 'week' },
194
+ * { label: '1 month', value: 'month' },
195
+ * ]}
196
+ * selectedTimeRange="week"
197
+ * onTimeRangeChange={(range) => fetchData(range)}
198
+ * summaryItems={[
199
+ * { label: 'Total Engagements', value: 11372 },
200
+ * { label: 'Daily Engagements', value: 156 },
201
+ * ]}
202
+ * />
203
+ * ```
204
+ *
205
+ * Figma reference: [ROB Design - Node 162:1172](https://www.figma.com/design/xky11VbkkFcgZLwZE8BdCN/ROB?node-id=162-1172&m=dev)
206
+ */
207
+ declare const TimeSeriesGraph: ({ title, series, timeRangeOptions, selectedTimeRange, onTimeRangeChange, summaryItems, showSummary, headerAction, loading, xAxisFormat, }: TimeSeriesGraphProps) => react_jsx_runtime.JSX.Element;
208
+
209
+ export { ChartWidget, type ChartWidgetProps, type DataPoint, type DataSeries, MetricsChart, type MetricsChartProps, type MetricsPeriod, PeriodSelect, type SummaryItem, SummaryStats, type SummaryStatsProps, type TimeRangeOption, TimeRangeSelect, type TimeRangeSelectProps, TimeSeriesGraph, type TimeSeriesGraphProps };
@@ -0,0 +1,209 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type ChartWidgetHistoryRecord = {
5
+ date: Date;
6
+ value: number;
7
+ };
8
+ type ChartWidgetProps = {
9
+ title: string;
10
+ value?: ReactNode;
11
+ history?: ChartWidgetHistoryRecord[];
12
+ formatValue?: (value: number) => string;
13
+ };
14
+ declare const ChartWidget: ({ title, value, history, formatValue, }: ChartWidgetProps) => react_jsx_runtime.JSX.Element;
15
+
16
+ type MetricsHistoryRecord = {
17
+ storedBytes: number;
18
+ transferredBytes: number;
19
+ puts: number;
20
+ gets: number;
21
+ recordTime: Date;
22
+ };
23
+ type MetricsChartProps = {
24
+ history?: MetricsHistoryRecord[];
25
+ };
26
+ /**
27
+ * TODO: Refactor this component to use shared graphs configuration
28
+ */
29
+ declare const MetricsChart: ({ history }: MetricsChartProps) => react_jsx_runtime.JSX.Element;
30
+
31
+ type MetricsPeriod = 'hour' | 'day' | 'week' | 'month';
32
+ type PeriodSelectProps = {
33
+ value?: MetricsPeriod;
34
+ onChange?: (value: MetricsPeriod) => void;
35
+ };
36
+ declare const PeriodSelect: ({ value, onChange }: PeriodSelectProps) => react_jsx_runtime.JSX.Element;
37
+
38
+ /**
39
+ * Represents a single time range option in the dropdown.
40
+ */
41
+ interface TimeRangeOption {
42
+ /** Display label shown in the dropdown (e.g., "1 week") */
43
+ label: string;
44
+ /** Value identifier passed to the callback on selection */
45
+ value: string;
46
+ }
47
+ interface TimeRangeSelectProps {
48
+ /** Available time range options */
49
+ options: TimeRangeOption[];
50
+ /** Currently selected time range value */
51
+ value?: string;
52
+ /** Callback invoked when user selects a different time range */
53
+ onChange?: (value: string) => void;
54
+ }
55
+ /**
56
+ * Configurable time range dropdown selector.
57
+ * Renders a compact select field with the provided time range options.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * <TimeRangeSelect
62
+ * options={[
63
+ * { label: 'Last hour', value: 'hour' },
64
+ * { label: '24 hours', value: 'day' },
65
+ * { label: '1 week', value: 'week' },
66
+ * ]}
67
+ * value="week"
68
+ * onChange={(value) => console.log(value)}
69
+ * />
70
+ * ```
71
+ */
72
+ declare const TimeRangeSelect: ({ options, value, onChange }: TimeRangeSelectProps) => react_jsx_runtime.JSX.Element;
73
+
74
+ /**
75
+ * Represents a single summary statistic item displayed below the graph.
76
+ */
77
+ interface SummaryItem {
78
+ /** Descriptive label (e.g., "Total Engagements") */
79
+ label: string;
80
+ /** Numeric or string value (e.g., "13.72" or 11372) */
81
+ value: string | number;
82
+ /** Optional unit suffix (e.g., "K", "GB", "%") */
83
+ unit?: string;
84
+ }
85
+ interface SummaryStatsProps {
86
+ /** Array of summary items to display */
87
+ items: SummaryItem[];
88
+ }
89
+ /**
90
+ * Renders a horizontal row of summary statistics below the graph.
91
+ * Each item shows a label with its corresponding value and optional unit.
92
+ *
93
+ * Matches the Figma design layout with label in secondary text color
94
+ * and value in bold heading typography.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * <SummaryStats
99
+ * items={[
100
+ * { label: 'Total Engagements', value: 11372 },
101
+ * { label: 'Total Consumed', value: '156.91', unit: 'GB' },
102
+ * ]}
103
+ * />
104
+ * ```
105
+ */
106
+ declare const SummaryStats: ({ items }: SummaryStatsProps) => react_jsx_runtime.JSX.Element | null;
107
+
108
+ /**
109
+ * A single data point in a time series.
110
+ * Use `null` for the value to represent missing/gap data — the line will break.
111
+ */
112
+ interface DataPoint {
113
+ /** Timestamp of the observation */
114
+ timestamp: Date;
115
+ /** Numeric value, or `null` to indicate a gap in the data */
116
+ value: number | null;
117
+ }
118
+ /**
119
+ * Represents one line on the graph (a named data series).
120
+ */
121
+ interface DataSeries {
122
+ /** Unique display name for this series (shown in legend) */
123
+ name: string;
124
+ /** CSS color string for the line and legend indicator */
125
+ color: string;
126
+ /** Ordered array of data points */
127
+ data: DataPoint[];
128
+ }
129
+ interface TimeSeriesGraphProps {
130
+ /** Optional title displayed at the top-left of the graph card */
131
+ title?: string;
132
+ /**
133
+ * Array of data series to render. Each series becomes one line on the graph.
134
+ * There is no hardcoded limit on the number of series.
135
+ */
136
+ series: DataSeries[];
137
+ /**
138
+ * Configurable time range options for the dropdown selector.
139
+ * When omitted, the time range dropdown is not rendered.
140
+ */
141
+ timeRangeOptions?: TimeRangeOption[];
142
+ /** Currently selected time range value (controlled) */
143
+ selectedTimeRange?: string;
144
+ /** Callback invoked when the user picks a different time range */
145
+ onTimeRangeChange?: (value: string) => void;
146
+ /**
147
+ * Optional array of summary statistics displayed below the graph.
148
+ * When omitted or empty, the summary section is hidden.
149
+ */
150
+ summaryItems?: SummaryItem[];
151
+ /**
152
+ * Whether to show the summary statistics section.
153
+ * Defaults to `true`. Set to `false` to explicitly hide, even when `summaryItems` are provided.
154
+ */
155
+ showSummary?: boolean;
156
+ /**
157
+ * Optional header action element rendered to the right of the title
158
+ * (e.g., a secondary dropdown or filter control).
159
+ */
160
+ headerAction?: ReactNode;
161
+ /**
162
+ * When `true`, shows a loading overlay (spinner) over the graph area
163
+ * while the header remains visible and interactive.
164
+ */
165
+ loading?: boolean;
166
+ /**
167
+ * Override the x-axis date format string (date-fns format tokens).
168
+ * When omitted, the format is auto-detected from the data's time span:
169
+ * - <= 24 hours → `'HH:mm'`
170
+ * - > 24 hours → `'do MMM'`
171
+ */
172
+ xAxisFormat?: string;
173
+ }
174
+ /**
175
+ * A reusable time series graph component that displays one or more data lines
176
+ * over a shared time axis. Supports configurable time range selection,
177
+ * optional summary statistics, interactive legend toggling, crosshair tooltips,
178
+ * and a loading state.
179
+ *
180
+ * Built on `@mui/x-charts` LineChart and the Cere Design System theme.
181
+ *
182
+ * @example
183
+ * ```tsx
184
+ * <TimeSeriesGraph
185
+ * title="Engagement over time"
186
+ * series={[
187
+ * { name: 'Engagements', color: '#6750A4', data: engagementData },
188
+ * { name: 'Unique Streams', color: '#4caf50', data: streamData },
189
+ * ]}
190
+ * timeRangeOptions={[
191
+ * { label: 'Last hour', value: 'hour' },
192
+ * { label: '24 hours', value: 'day' },
193
+ * { label: '1 week', value: 'week' },
194
+ * { label: '1 month', value: 'month' },
195
+ * ]}
196
+ * selectedTimeRange="week"
197
+ * onTimeRangeChange={(range) => fetchData(range)}
198
+ * summaryItems={[
199
+ * { label: 'Total Engagements', value: 11372 },
200
+ * { label: 'Daily Engagements', value: 156 },
201
+ * ]}
202
+ * />
203
+ * ```
204
+ *
205
+ * Figma reference: [ROB Design - Node 162:1172](https://www.figma.com/design/xky11VbkkFcgZLwZE8BdCN/ROB?node-id=162-1172&m=dev)
206
+ */
207
+ declare const TimeSeriesGraph: ({ title, series, timeRangeOptions, selectedTimeRange, onTimeRangeChange, summaryItems, showSummary, headerAction, loading, xAxisFormat, }: TimeSeriesGraphProps) => react_jsx_runtime.JSX.Element;
208
+
209
+ export { ChartWidget, type ChartWidgetProps, type DataPoint, type DataSeries, MetricsChart, type MetricsChartProps, type MetricsPeriod, PeriodSelect, type SummaryItem, SummaryStats, type SummaryStatsProps, type TimeRangeOption, TimeRangeSelect, type TimeRangeSelectProps, TimeSeriesGraph, type TimeSeriesGraphProps };
package/dist/charts.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _chunkKF2Y7HO3js = require('./chunk-KF2Y7HO3.js');
9
+ require('./chunk-AIY6222Q.js');
10
+ require('./chunk-FN5YL4BK.js');
11
+ require('./chunk-ZGCN5WCG.js');
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+ exports.ChartWidget = _chunkKF2Y7HO3js.ChartWidget; exports.MetricsChart = _chunkKF2Y7HO3js.MetricsChart; exports.PeriodSelect = _chunkKF2Y7HO3js.PeriodSelect; exports.SummaryStats = _chunkKF2Y7HO3js.SummaryStats; exports.TimeRangeSelect = _chunkKF2Y7HO3js.TimeRangeSelect; exports.TimeSeriesGraph = _chunkKF2Y7HO3js.TimeSeriesGraph;
20
+ //# sourceMappingURL=charts.js.map