@connectif/ui-components 1.0.8 → 1.0.9

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.
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import './EchartsConfig';
3
+ import { sizes } from '../../theme/Typography';
3
4
  import { IncrementLabelType } from '../../propTypes/IncrementLabel';
4
5
  import { ChartTooltipEntryFormatter } from '../../utils/ChartUtils';
5
6
  type YAxisLabelFormatter = (value: number) => string;
@@ -13,6 +14,18 @@ export type BarChartProps = {
13
14
  * The categories to display on the x axis.
14
15
  */
15
16
  categories: string[];
17
+ /**
18
+ * labels color
19
+ */
20
+ labelColor?: string;
21
+ /**
22
+ * font size to X labels
23
+ */
24
+ gridLabelSize?: keyof typeof sizes;
25
+ /**
26
+ * Grid lines color
27
+ */
28
+ gridLineColor?: string;
16
29
  /**
17
30
  * Optional callback to be called when the chart is clicked.
18
31
  */
@@ -49,6 +62,10 @@ export type BarChartProps = {
49
62
  * The text to use for this item as name in tooltip.
50
63
  */
51
64
  comparisonTooltipName?: string;
65
+ /**
66
+ * Set to show background color in bar when not is comparison
67
+ */
68
+ showBackgroundColorBar?: boolean;
52
69
  data: {
53
70
  /**
54
71
  * The value to display in the chart for this serie item.
@@ -80,5 +97,5 @@ export type BarChartProps = {
80
97
  /**
81
98
  * A bar chart component to display numeric data grouped by categories and series.
82
99
  */
83
- declare const BarChart: ({ style, isLoading, series, categories, yAxisLabelFormatter, tooltipEntryFormatter, onClick }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
100
+ declare const BarChart: ({ style, isLoading, series, categories, labelColor, gridLineColor, gridLabelSize, yAxisLabelFormatter, tooltipEntryFormatter, onClick }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
84
101
  export default BarChart;
@@ -59,6 +59,24 @@ export type LineChartProps = CategorizedChartProps & {
59
59
  * The yAxis for this serie
60
60
  */
61
61
  yAxisIndex: number;
62
+ /**
63
+ * The area color. With color will be a solid color. With startColor and endColor will be gradient color.
64
+ */
65
+ areaColor?: {
66
+ color: string;
67
+ startColor?: never;
68
+ endColor?: never;
69
+ } | {
70
+ color?: never;
71
+ startColor: {
72
+ offset: number;
73
+ color: string;
74
+ };
75
+ endColor: {
76
+ offset: number;
77
+ color: string;
78
+ };
79
+ };
62
80
  }[];
63
81
  /**
64
82
  * Option to disable the display of series names.
@@ -8,10 +8,14 @@ export type ChatProps = React.PropsWithChildren<{
8
8
  * Background color
9
9
  */
10
10
  backgroundColor?: string;
11
+ /**
12
+ * Class name to move scroll on new message. If undefined, scroll to bottom.
13
+ */
14
+ scrollToLastClassName?: string;
15
+ /**
16
+ * Scrollbar color
17
+ */
18
+ scrollbarColor?: string;
11
19
  }>;
12
- /**
13
- * Shows a list of chat message, in a vertical layout.
14
- *
15
- */
16
- declare const Chat: ({ children, header, backgroundColor }: ChatProps) => import("react/jsx-runtime").JSX.Element;
20
+ declare const Chat: ({ children, header, backgroundColor, scrollToLastClassName, scrollbarColor }: ChatProps) => import("react/jsx-runtime").JSX.Element;
17
21
  export default Chat;
package/dist/index.js CHANGED
@@ -7767,7 +7767,7 @@ function createBox(options = {}) {
7767
7767
  const BoxRoot = styled2("div", {
7768
7768
  shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
7769
7769
  })(styleFunctionSx_default);
7770
- const Box8 = /* @__PURE__ */ React16.forwardRef(function Box9(inProps, ref) {
7770
+ const Box7 = /* @__PURE__ */ React16.forwardRef(function Box8(inProps, ref) {
7771
7771
  const theme2 = useTheme_default(defaultTheme);
7772
7772
  const _extendSxProp = extendSxProp(inProps), {
7773
7773
  className,
@@ -7780,7 +7780,7 @@ function createBox(options = {}) {
7780
7780
  theme: themeId ? theme2[themeId] || theme2 : theme2
7781
7781
  }, other));
7782
7782
  });
7783
- return Box8;
7783
+ return Box7;
7784
7784
  }
7785
7785
 
7786
7786
  // node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js
@@ -11557,6 +11557,9 @@ var BarChart2 = ({
11557
11557
  isLoading,
11558
11558
  series = [],
11559
11559
  categories = [],
11560
+ labelColor = grey400,
11561
+ gridLineColor = grey200,
11562
+ gridLabelSize = "sm",
11560
11563
  yAxisLabelFormatter = (value) => `${value}`,
11561
11564
  tooltipEntryFormatter = ({ data }) => ({
11562
11565
  text: `${data.tooltipName}: ${data.tooltipValue}`
@@ -11690,8 +11693,8 @@ var BarChart2 = ({
11690
11693
  show: false
11691
11694
  },
11692
11695
  axisLabel: {
11693
- color: grey400,
11694
- fontSize: sizes3.sm,
11696
+ color: labelColor,
11697
+ fontSize: sizes3[gridLabelSize],
11695
11698
  width: (width2 - estimatedYAxisWidth) / categories.length,
11696
11699
  overflow: "truncate",
11697
11700
  hideOverlap: false,
@@ -11703,7 +11706,7 @@ var BarChart2 = ({
11703
11706
  boundaryGap: ["0", "10%"],
11704
11707
  splitLine: {
11705
11708
  lineStyle: {
11706
- color: grey200
11709
+ color: gridLineColor
11707
11710
  }
11708
11711
  },
11709
11712
  axisLine: {
@@ -11713,8 +11716,8 @@ var BarChart2 = ({
11713
11716
  show: false
11714
11717
  },
11715
11718
  axisLabel: {
11716
- color: grey400,
11717
- fontSize: sizes3.sm,
11719
+ color: labelColor,
11720
+ fontSize: sizes3[gridLabelSize],
11718
11721
  formatter: yAxisLabelFormatter
11719
11722
  }
11720
11723
  },
@@ -11724,14 +11727,15 @@ var BarChart2 = ({
11724
11727
  data,
11725
11728
  tooltipName,
11726
11729
  comparisonColor,
11727
- comparisonTooltipName
11730
+ comparisonTooltipName,
11731
+ showBackgroundColorBar
11728
11732
  }, serieIndex) => [
11729
11733
  ...isComparison ? [
11730
11734
  {
11731
11735
  ...defaultBarSeriesOptions,
11732
11736
  cursor,
11733
11737
  silent,
11734
- showBackground: false,
11738
+ showBackground: showBackgroundColorBar ?? false,
11735
11739
  stack: `${serieIndex}`,
11736
11740
  data: data.map(
11737
11741
  ({
@@ -11763,7 +11767,7 @@ var BarChart2 = ({
11763
11767
  ...defaultBarSeriesOptions,
11764
11768
  cursor,
11765
11769
  silent,
11766
- showBackground: true,
11770
+ showBackground: showBackgroundColorBar ?? true,
11767
11771
  stack: `${serieIndex}`,
11768
11772
  data: data.map(
11769
11773
  ({
@@ -12057,7 +12061,13 @@ var LineChart2 = ({
12057
12061
  ],
12058
12062
  series: [
12059
12063
  ...series.map(
12060
- ({ name, data, color: color2, yAxisIndex }) => ({
12064
+ ({
12065
+ name,
12066
+ data,
12067
+ color: color2,
12068
+ yAxisIndex,
12069
+ areaColor
12070
+ }) => ({
12061
12071
  type: "line",
12062
12072
  name,
12063
12073
  yAxisIndex,
@@ -12069,6 +12079,30 @@ var LineChart2 = ({
12069
12079
  type: "solid",
12070
12080
  width: 3
12071
12081
  },
12082
+ ...areaColor && {
12083
+ areaStyle: {
12084
+ ...areaColor.color && { color: areaColor.color },
12085
+ ...areaColor.startColor && areaColor.endColor && {
12086
+ color: new echarts3.graphic.LinearGradient(
12087
+ 0,
12088
+ 0,
12089
+ 0,
12090
+ 1,
12091
+ [
12092
+ {
12093
+ offset: areaColor.startColor.offset,
12094
+ color: areaColor.startColor.color
12095
+ },
12096
+ {
12097
+ offset: areaColor.endColor.offset,
12098
+ color: areaColor.endColor.color
12099
+ },
12100
+ { offset: 1, color: "transparent" }
12101
+ ]
12102
+ )
12103
+ }
12104
+ }
12105
+ },
12072
12106
  showSymbol: true,
12073
12107
  symbol: "circle",
12074
12108
  symbolSize: 3,
@@ -13328,9 +13362,10 @@ var ChatMessage = React34.forwardRef(function ChatMessage2({
13328
13362
  padding: "8px 16px",
13329
13363
  paddingBottom: !cancelableButtonText ? "8px" : "40px",
13330
13364
  marginLeft: 0,
13331
- marginRight: "10px",
13365
+ marginRight: "0",
13332
13366
  minHeight: "22px",
13333
- justifyContent: "center"
13367
+ justifyContent: "center",
13368
+ wordBreak: "break-all"
13334
13369
  },
13335
13370
  children: [
13336
13371
  /* @__PURE__ */ jsx79(
@@ -13420,55 +13455,99 @@ var ChatMessage = React34.forwardRef(function ChatMessage2({
13420
13455
  var ChatMessage_default = ChatMessage;
13421
13456
 
13422
13457
  // src/components/chat/Chat.tsx
13423
- import Box3 from "@mui/material/Box";
13424
13458
  import Stack5 from "@mui/material/Stack";
13425
13459
  import * as React35 from "react";
13426
13460
  import { jsx as jsx80, jsxs as jsxs35 } from "react/jsx-runtime";
13427
- var Chat = ({ children, header, backgroundColor: backgroundColor2 }) => {
13428
- let ref = void 0;
13429
- const [justifyContent, setJustifyContent] = React35.useState(true);
13461
+ var Chat = ({
13462
+ children,
13463
+ header,
13464
+ backgroundColor: backgroundColor2,
13465
+ scrollToLastClassName,
13466
+ scrollbarColor
13467
+ }) => {
13468
+ const ref = React35.useRef(null);
13430
13469
  const [isInitialize, setIsInitialize] = React35.useState(false);
13470
+ const [hasVerticalScroll, setHasVerticalScroll] = React35.useState(false);
13431
13471
  React35.useEffect(() => {
13432
- if (ref && ref.offsetHeight <= ref.scrollHeight) {
13433
- setJustifyContent(ref.offsetHeight >= ref.scrollHeight);
13472
+ const container = ref.current;
13473
+ if (!container) {
13474
+ return;
13434
13475
  }
13435
- ref?.scrollTo(0, ref?.scrollHeight);
13476
+ const observer = new ResizeObserver(() => {
13477
+ requestAnimationFrame(() => {
13478
+ const needsScroll = container.scrollHeight > container.clientHeight;
13479
+ setHasVerticalScroll(needsScroll);
13480
+ });
13481
+ });
13482
+ observer.observe(container);
13436
13483
  setIsInitialize(true);
13437
- }, [children, ref]);
13484
+ return () => observer.disconnect();
13485
+ }, []);
13438
13486
  React35.useEffect(() => {
13439
- if (ref && ref.offsetHeight < ref.scrollHeight) {
13440
- setJustifyContent(false);
13487
+ const container = ref.current;
13488
+ if (!container) {
13489
+ return;
13490
+ }
13491
+ if (scrollToLastClassName) {
13492
+ const elements = container.querySelectorAll(
13493
+ `.${scrollToLastClassName}`
13494
+ );
13495
+ const last = elements[elements.length - 1];
13496
+ if (last) {
13497
+ last.scrollIntoView({ behavior: "smooth", block: "start" });
13498
+ } else {
13499
+ container.scrollTo(0, container.scrollHeight);
13500
+ }
13501
+ } else {
13502
+ container.scrollTo(0, container.scrollHeight);
13441
13503
  }
13442
- ref?.scrollTo(0, ref?.scrollHeight);
13443
- }, [ref]);
13504
+ }, [children, scrollToLastClassName]);
13444
13505
  return /* @__PURE__ */ jsxs35(
13445
13506
  Stack5,
13446
13507
  {
13447
13508
  className: "Slim-Vertical-Scroll",
13509
+ ref,
13448
13510
  sx: {
13449
13511
  overflow: "hidden",
13450
13512
  overflowY: "auto",
13451
13513
  height: "calc(100% - 8px)",
13452
- visibility: !isInitialize ? "hidden" : null,
13514
+ visibility: !isInitialize ? "hidden" : "visible",
13515
+ width: `calc(100% - ${hasVerticalScroll ? "4px" : "8px"})`,
13453
13516
  paddingBottom: "8px",
13454
- ...isInitialize && justifyContent && {
13455
- justifyContent: header ? "space-between" : "end"
13456
- },
13457
- ":active::-webkit-scrollbar-thumb, :focus::-webkit-scrollbar-thumb, :hover::-webkit-scrollbar-thumb": {
13458
- visibility: "visible"
13517
+ ...backgroundColor2 && { backgroundColor: backgroundColor2 },
13518
+ paddingRight: hasVerticalScroll ? "4px" : "8px",
13519
+ "::-webkit-scrollbar": {
13520
+ width: "4px !important"
13459
13521
  },
13460
13522
  "::-webkit-scrollbar-thumb": {
13523
+ ...scrollbarColor && {
13524
+ backgroundColor: `${scrollbarColor} !important`
13525
+ },
13526
+ borderRadius: "4px",
13461
13527
  visibility: "hidden"
13462
13528
  },
13463
- ...backgroundColor2 && {
13464
- backgroundColor: backgroundColor2
13529
+ ":hover::-webkit-scrollbar-thumb": {
13530
+ visibility: "visible"
13465
13531
  }
13466
13532
  },
13467
13533
  spacing: "12px",
13468
- ref: (el) => ref = el,
13469
13534
  children: [
13470
13535
  header,
13471
- /* @__PURE__ */ jsx80(Box3, { sx: { "> *": { marginTop: "12px" } }, children })
13536
+ /* @__PURE__ */ jsx80(
13537
+ Stack5,
13538
+ {
13539
+ justifyContent: "end",
13540
+ ...!header && {
13541
+ minHeight: "100%",
13542
+ justifyContent: "end"
13543
+ },
13544
+ sx: {
13545
+ "> *": { marginTop: "12px" },
13546
+ flexShrink: 0
13547
+ },
13548
+ children
13549
+ }
13550
+ )
13472
13551
  ]
13473
13552
  }
13474
13553
  );
@@ -17549,9 +17628,9 @@ var ImageEditor_default = ImageEditor;
17549
17628
  import React45 from "react";
17550
17629
 
17551
17630
  // src/hooks/useResizeObserver.ts
17552
- import { useEffect as useEffect8, useState as useState13, useRef as useRef11 } from "react";
17631
+ import { useEffect as useEffect8, useState as useState13, useRef as useRef12 } from "react";
17553
17632
  function useResizeObserver() {
17554
- const ref = useRef11(null);
17633
+ const ref = useRef12(null);
17555
17634
  const [width2, setWidth] = useState13(0);
17556
17635
  const [height2, setHeight] = useState13(0);
17557
17636
  const [contentWidth, setContentWidth] = useState13(0);
@@ -17729,10 +17808,10 @@ var TextFieldContainer_default = TextFieldContainer;
17729
17808
  import * as React50 from "react";
17730
17809
 
17731
17810
  // src/hooks/useDebouncedCallback.ts
17732
- import { useEffect as useEffect9, useRef as useRef12 } from "react";
17811
+ import { useEffect as useEffect9, useRef as useRef13 } from "react";
17733
17812
  function useDebouncedCallback(callback, wait) {
17734
- const argsRef = useRef12();
17735
- const timeout = useRef12();
17813
+ const argsRef = useRef13();
17814
+ const timeout = useRef13();
17736
17815
  function cleanup() {
17737
17816
  if (timeout.current) {
17738
17817
  clearTimeout(timeout.current);
@@ -20289,14 +20368,14 @@ var ColorPicker = React59.forwardRef(function ColorPickerWrapper({
20289
20368
  var ColorPicker_default = ColorPicker;
20290
20369
 
20291
20370
  // src/components/input/UploadClickableArea.tsx
20292
- import { Box as Box4 } from "@mui/material";
20371
+ import { Box as Box3 } from "@mui/material";
20293
20372
  import { jsx as jsx115, jsxs as jsxs52 } from "react/jsx-runtime";
20294
20373
  var UploadClickableArea = ({
20295
20374
  accept,
20296
20375
  onFilesChanged,
20297
20376
  children
20298
20377
  }) => /* @__PURE__ */ jsxs52(
20299
- Box4,
20378
+ Box3,
20300
20379
  {
20301
20380
  component: "label",
20302
20381
  style: {
@@ -23334,7 +23413,7 @@ var LinearProgress_default = LinearProgress;
23334
23413
  import * as React74 from "react";
23335
23414
  import MuiCircularProgress from "@mui/material/CircularProgress";
23336
23415
  import Typography3 from "@mui/material/Typography";
23337
- import Box5 from "@mui/material/Box";
23416
+ import Box4 from "@mui/material/Box";
23338
23417
  import { jsx as jsx133, jsxs as jsxs66 } from "react/jsx-runtime";
23339
23418
  var circularSizes = {
23340
23419
  XS: "20px",
@@ -23361,7 +23440,7 @@ var CircularProgress = ({
23361
23440
  gradientColors ? crypto.randomUUID() : void 0
23362
23441
  );
23363
23442
  return /* @__PURE__ */ jsxs66(
23364
- Box5,
23443
+ Box4,
23365
23444
  {
23366
23445
  sx: {
23367
23446
  position: "relative",
@@ -23401,7 +23480,7 @@ var CircularProgress = ({
23401
23480
  }
23402
23481
  ) }) }),
23403
23482
  showCircularBackground && /* @__PURE__ */ jsx133(
23404
- Box5,
23483
+ Box4,
23405
23484
  {
23406
23485
  sx: {
23407
23486
  position: "absolute",
@@ -23455,7 +23534,7 @@ var CircularProgress = ({
23455
23534
  }
23456
23535
  ),
23457
23536
  variant !== "indeterminate" && /* @__PURE__ */ jsx133(
23458
- Box5,
23537
+ Box4,
23459
23538
  {
23460
23539
  sx: {
23461
23540
  top: 0,
@@ -23487,7 +23566,7 @@ var CircularProgress = ({
23487
23566
  var CircularProgress_default = CircularProgress;
23488
23567
 
23489
23568
  // src/components/progress/DonutProgress.tsx
23490
- import Box6 from "@mui/material/Box";
23569
+ import Box5 from "@mui/material/Box";
23491
23570
  import { Stack as Stack10 } from "@mui/material";
23492
23571
  import { jsx as jsx134, jsxs as jsxs67 } from "react/jsx-runtime";
23493
23572
  var CIRCULAR_PROGRESS_PERCENTAGE = 85;
@@ -23539,7 +23618,7 @@ var DonutProgress = ({
23539
23618
  )
23540
23619
  ] });
23541
23620
  return /* @__PURE__ */ jsxs67(
23542
- Box6,
23621
+ Box5,
23543
23622
  {
23544
23623
  sx: {
23545
23624
  position: "relative",
@@ -23563,7 +23642,7 @@ var DonutProgress = ({
23563
23642
  }
23564
23643
  ),
23565
23644
  /* @__PURE__ */ jsx134(
23566
- Box6,
23645
+ Box5,
23567
23646
  {
23568
23647
  sx: {
23569
23648
  position: "absolute",
@@ -23586,7 +23665,7 @@ var DonutProgress = ({
23586
23665
  }
23587
23666
  ),
23588
23667
  variant !== "empty" && labelChip && /* @__PURE__ */ jsx134(
23589
- Box6,
23668
+ Box5,
23590
23669
  {
23591
23670
  sx: {
23592
23671
  position: "absolute",
@@ -23669,6 +23748,7 @@ var MarkdownContainer = styled9("div")(
23669
23748
  margin: "0.5em 0"
23670
23749
  },
23671
23750
  "& ul, & ol": {
23751
+ ...variants[variant || "body2"],
23672
23752
  paddingLeft: "1.5em",
23673
23753
  margin: "0.5em 0"
23674
23754
  },
@@ -23781,7 +23861,7 @@ var Navbar_default = Navbar;
23781
23861
 
23782
23862
  // src/components/navbar/NavbarButton.tsx
23783
23863
  import * as React75 from "react";
23784
- import { Box as Box7, ButtonBase as ButtonBase2 } from "@mui/material";
23864
+ import { Box as Box6, ButtonBase as ButtonBase2 } from "@mui/material";
23785
23865
  import { jsx as jsx138, jsxs as jsxs69 } from "react/jsx-runtime";
23786
23866
  var NavbarButton = React75.forwardRef(
23787
23867
  function NavbarButton2({
@@ -23798,7 +23878,7 @@ var NavbarButton = React75.forwardRef(
23798
23878
  return element;
23799
23879
  }
23800
23880
  return /* @__PURE__ */ jsxs69(
23801
- Box7,
23881
+ Box6,
23802
23882
  {
23803
23883
  sx: {
23804
23884
  backgroundImage: `linear-gradient(to left, ${cornflowerBlue}, ${electricLavender})`,
@@ -23808,7 +23888,7 @@ var NavbarButton = React75.forwardRef(
23808
23888
  },
23809
23889
  children: [
23810
23890
  /* @__PURE__ */ jsx138(
23811
- Box7,
23891
+ Box6,
23812
23892
  {
23813
23893
  sx: {
23814
23894
  position: "absolute",
@@ -23824,7 +23904,7 @@ var NavbarButton = React75.forwardRef(
23824
23904
  }
23825
23905
  ),
23826
23906
  /* @__PURE__ */ jsx138(
23827
- Box7,
23907
+ Box6,
23828
23908
  {
23829
23909
  sx: {
23830
23910
  backgroundColor: white,