@ssa-ui-kit/core 2.9.1 → 2.10.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.
@@ -0,0 +1,18 @@
1
+ import { Datum } from '@nivo/line';
2
+ import { WidgetCardProps } from '../../index';
3
+ import { TrendLineProps } from './components';
4
+ export type BigNumberChartFeatures = 'header' | 'fullscreenMode';
5
+ export interface BigNumberChartProps {
6
+ data: Datum[];
7
+ interactive?: boolean;
8
+ title?: string;
9
+ widgetCardProps?: WidgetCardProps;
10
+ trendLineProps?: Omit<TrendLineProps, 'data'>;
11
+ features?: BigNumberChartFeatures[];
12
+ valueFormat?: (value: Datum) => React.ReactNode;
13
+ }
14
+ export declare const BigNumberChartComponent: ({ data, title, widgetCardProps, trendLineProps, interactive, features, valueFormat, }: BigNumberChartProps) => import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export declare const BigNumberChart: {
16
+ (props: BigNumberChartProps): import("@emotion/react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
@@ -0,0 +1,8 @@
1
+ import { MustInclude } from '@ssa-ui-kit/utils';
2
+ export declare const FullScreenButton: import("@emotion/styled").StyledComponent<import("../../../Button/types").ButtonProps & import("react").RefAttributes<HTMLButtonElement> & {
3
+ theme?: import("@emotion/react").Theme;
4
+ }, {}, {}>;
5
+ export interface BigNumberChartHeaderProps<T extends string[]> {
6
+ features: MustInclude<T, 'fullscreenMode'>;
7
+ }
8
+ export declare const BigNumberChartHeader: <F extends string[]>({ features, }: BigNumberChartHeaderProps<F>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { LineProps } from '@nivo/line';
2
+ import { TrendLineTooltipProps } from './TrendLineTooltip';
3
+ export interface TrendLineProps extends LineProps {
4
+ color?: string;
5
+ tooltipValueFormat?: TrendLineTooltipProps['valueFormat'];
6
+ }
7
+ export declare const TrendLine: ({ color, tooltipValueFormat, ...props }: TrendLineProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Point, PointTooltipProps } from '@nivo/line';
2
+ export type TrendLineTooltipProps = PointTooltipProps & {
3
+ valueFormat?: (data: Point['data']) => React.ReactNode;
4
+ };
5
+ export declare const TrendLineTooltip: ({ point, valueFormat, }: TrendLineTooltipProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './BigNumberChartHeader';
2
+ export * from './TrendLine';
3
+ export * from './TrendLineTooltip';
@@ -0,0 +1 @@
1
+ export * from './BigNumberChart';
@@ -6,3 +6,4 @@ export * from './common';
6
6
  export * from './hooks';
7
7
  export * from './GaugeChart';
8
8
  export * from './BarGaugeChart';
9
+ export * from './BigNumberChart';
package/dist/index.js CHANGED
@@ -73,6 +73,8 @@ __webpack_require__.d(__webpack_exports__, {
73
73
  BarGaugeChart: () => (/* reexport */ BarGaugeChart),
74
74
  BarGaugeChartComponent: () => (/* reexport */ BarGaugeChartComponent),
75
75
  BarLineComplexChart: () => (/* reexport */ BarLineComplexChart),
76
+ BigNumberChart: () => (/* reexport */ BigNumberChart),
77
+ BigNumberChartComponent: () => (/* reexport */ BigNumberChartComponent),
76
78
  Button: () => (/* reexport */ Button_Button),
77
79
  ButtonGroup: () => (/* reexport */ ButtonGroup),
78
80
  Card: () => (/* reexport */ Card_Card),
@@ -16390,6 +16392,255 @@ const BarGaugeChart = WithFullscreenMode(BarGaugeChartComponent);
16390
16392
  ;// ./src/components/Charts/BarGaugeChart/index.ts
16391
16393
 
16392
16394
 
16395
+ ;// ./src/components/Charts/BigNumberChart/components/BigNumberChartHeader.tsx
16396
+
16397
+ function BigNumberChartHeader_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
16398
+
16399
+
16400
+
16401
+
16402
+ const BigNumberChartHeader_FullScreenButton = /*#__PURE__*/base_default()(Button_Button, true ? {
16403
+ target: "elke6i10"
16404
+ } : 0)("height:auto;padding:0;background:none;box-shadow:none;&:hover,&:focus{background:none;box-shadow:none;&::before{display:none;}}&:hover{svg path{fill:", ({
16405
+ theme
16406
+ }) => theme.colors.greyDarker, ";}}" + ( true ? "" : 0));
16407
+ var BigNumberChartHeader_ref = true ? {
16408
+ name: "1pqzlpx",
16409
+ styles: "width:auto;margin-left:auto"
16410
+ } : 0;
16411
+ var BigNumberChartHeader_ref2 = true ? {
16412
+ name: "e0dnmk",
16413
+ styles: "cursor:pointer"
16414
+ } : 0;
16415
+ const BigNumberChartHeader = ({
16416
+ features = []
16417
+ }) => {
16418
+ const {
16419
+ isFullscreenMode,
16420
+ toggleFullscreenMode
16421
+ } = useFullscreenMode();
16422
+ const theme = (0,react_namespaceObject.useTheme)();
16423
+ return (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
16424
+ css: BigNumberChartHeader_ref,
16425
+ children: features.includes('fullscreenMode') && (0,jsx_runtime_namespaceObject.jsx)(BigNumberChartHeader_FullScreenButton, {
16426
+ variant: "tertiary",
16427
+ onClick: toggleFullscreenMode,
16428
+ children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
16429
+ name: isFullscreenMode ? 'cross' : 'maximize',
16430
+ css: BigNumberChartHeader_ref2,
16431
+ tooltip: isFullscreenMode ? 'Close' : 'Maximize',
16432
+ size: 18,
16433
+ color: theme.colors.greyFilterIcon
16434
+ })
16435
+ })
16436
+ });
16437
+ };
16438
+ ;// external "@nivo/core"
16439
+ const core_namespaceObject = require("@nivo/core");
16440
+ ;// external "@nivo/line"
16441
+ const line_namespaceObject = require("@nivo/line");
16442
+ ;// ./src/components/Charts/BigNumberChart/components/TrendLineTooltip.tsx
16443
+
16444
+
16445
+ const TrendLineTooltipStyled = /*#__PURE__*/base_default()("div", true ? {
16446
+ target: "e19yhkwp0"
16447
+ } : 0)("background:", ({
16448
+ theme
16449
+ }) => theme.colors.white, ";border:1px solid ", ({
16450
+ theme
16451
+ }) => theme.colors.grey20, ";border-radius:8px;color:", ({
16452
+ theme
16453
+ }) => theme.colors.greyDarker, ";font-weight:600;line-height:12px;font-size:10px;padding:0.5rem;" + ( true ? "" : 0));
16454
+ const TrendLineTooltip = ({
16455
+ point,
16456
+ valueFormat
16457
+ }) => {
16458
+ const {
16459
+ data
16460
+ } = point;
16461
+ const {
16462
+ xFormatted,
16463
+ yFormatted
16464
+ } = point.data;
16465
+ return (0,jsx_runtime_namespaceObject.jsx)(TrendLineTooltipStyled, {
16466
+ children: valueFormat?.(data) ?? `${xFormatted} - ${yFormatted}`
16467
+ });
16468
+ };
16469
+ ;// ./src/components/Charts/BigNumberChart/components/TrendLine.tsx
16470
+
16471
+
16472
+
16473
+
16474
+
16475
+ const ActivePoint = ({
16476
+ currentPoint,
16477
+ ...props
16478
+ }) => (0,jsx_runtime_namespaceObject.jsx)("g", {
16479
+ children: currentPoint && (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.DotsItem, {
16480
+ size: props.pointSize || 10,
16481
+ borderWidth: props.pointBorderWidth || 10,
16482
+ x: currentPoint.x,
16483
+ y: currentPoint.y,
16484
+ datum: currentPoint.data,
16485
+ color: currentPoint.color,
16486
+ borderColor: currentPoint.borderColor,
16487
+ labelYOffset: props.pointLabelYOffset
16488
+ }, currentPoint.id)
16489
+ });
16490
+ const TrendLine = ({
16491
+ color,
16492
+ tooltipValueFormat,
16493
+ ...props
16494
+ }) => {
16495
+ const theme = (0,react_namespaceObject.useTheme)();
16496
+ const _color = color ?? theme.colors.purpleDark;
16497
+ return (0,jsx_runtime_namespaceObject.jsx)(line_namespaceObject.ResponsiveLine, {
16498
+ axisBottom: null,
16499
+ axisLeft: null,
16500
+ axisRight: null,
16501
+ axisTop: null,
16502
+ colors: _color,
16503
+ curve: "linear",
16504
+ enableArea: true,
16505
+ enableGridX: false,
16506
+ enableGridY: false,
16507
+ enablePoints: false,
16508
+ lineWidth: 2,
16509
+ pointBorderWidth: 2,
16510
+ pointColor: "black",
16511
+ pointLabelYOffset: -12,
16512
+ pointSize: 5,
16513
+ useMesh: true,
16514
+ enableTouchCrosshair: true,
16515
+ defs: [{
16516
+ colors: [{
16517
+ color: _color,
16518
+ offset: 0
16519
+ }, {
16520
+ color: theme.colors.white,
16521
+ offset: 100
16522
+ }],
16523
+ id: 'gradientA',
16524
+ type: 'linearGradient'
16525
+ }],
16526
+ fill: [{
16527
+ id: 'gradientA',
16528
+ match: '*'
16529
+ }],
16530
+ enableCrosshair: false,
16531
+ animate: false,
16532
+ yScale: {
16533
+ type: 'linear',
16534
+ stacked: true,
16535
+ reverse: false
16536
+ },
16537
+ pointBorderColor: {
16538
+ from: 'serieColor'
16539
+ },
16540
+ margin: {
16541
+ top: 5,
16542
+ right: 5,
16543
+ bottom: 5,
16544
+ left: 5
16545
+ },
16546
+ legends: [],
16547
+ tooltip: args => (0,jsx_runtime_namespaceObject.jsx)(TrendLineTooltip, {
16548
+ ...args,
16549
+ valueFormat: tooltipValueFormat
16550
+ }),
16551
+ layers: ['grid', 'markers', 'axes', 'areas', 'crosshair', 'lines', 'points', 'slices', 'mesh', 'legends', ActivePoint],
16552
+ ...props
16553
+ });
16554
+ };
16555
+ ;// ./src/components/Charts/BigNumberChart/BigNumberChart.tsx
16556
+ function BigNumberChart_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
16557
+
16558
+
16559
+
16560
+
16561
+
16562
+
16563
+ var BigNumberChart_ref = true ? {
16564
+ name: "qdcqne",
16565
+ styles: "height:100%;justify-content:space-between"
16566
+ } : 0;
16567
+ var BigNumberChart_ref2 = true ? {
16568
+ name: "gfqabp",
16569
+ styles: "font-size:32px;font-weight:700"
16570
+ } : 0;
16571
+ var BigNumberChart_ref3 = true ? {
16572
+ name: "26qidl",
16573
+ styles: "position:relative;width:100%;height:50%"
16574
+ } : 0;
16575
+ var BigNumberChart_ref4 = true ? {
16576
+ name: "19s8nj4",
16577
+ styles: "position:absolute;width:100%;height:100%"
16578
+ } : 0;
16579
+ const BigNumberChartComponent = ({
16580
+ data,
16581
+ title,
16582
+ widgetCardProps,
16583
+ trendLineProps,
16584
+ interactive = true,
16585
+ features = [],
16586
+ valueFormat
16587
+ }) => {
16588
+ const [hoveredValue, setHoveredValue] = (0,external_react_namespaceObject.useState)(null);
16589
+ const lastValue = data.sort((a, b) => {
16590
+ const ax = a.x ?? 0;
16591
+ const bx = b.x ?? 0;
16592
+ return Number(ax) - Number(bx);
16593
+ }).at(-1);
16594
+ const setHoveredValueThrottled = (0,hooks_namespaceObject.useThrottledCallback)(value => {
16595
+ setHoveredValue(value);
16596
+ }, 100);
16597
+ const handleMouseMove = data => {
16598
+ if (!interactive) return;
16599
+ setHoveredValueThrottled(data.data);
16600
+ };
16601
+ const handleMouseLeave = () => {
16602
+ setHoveredValueThrottled(null);
16603
+ };
16604
+ const value = hoveredValue ?? lastValue;
16605
+ return (0,jsx_runtime_namespaceObject.jsx)(WithWidgetCard, {
16606
+ features: features,
16607
+ cardProps: {
16608
+ title,
16609
+ headerContent: (0,jsx_runtime_namespaceObject.jsx)(BigNumberChartHeader, {
16610
+ features: features
16611
+ }),
16612
+ ...widgetCardProps
16613
+ },
16614
+ children: (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
16615
+ direction: "column",
16616
+ alignItems: "start",
16617
+ css: BigNumberChart_ref,
16618
+ children: [(0,jsx_runtime_namespaceObject.jsx)("div", {
16619
+ css: BigNumberChart_ref2,
16620
+ children: (0,jsx_runtime_namespaceObject.jsx)("span", {
16621
+ children: value && (valueFormat?.(value) ?? value?.y?.toString())
16622
+ })
16623
+ }), (0,jsx_runtime_namespaceObject.jsx)("div", {
16624
+ css: BigNumberChart_ref3,
16625
+ children: (0,jsx_runtime_namespaceObject.jsx)("div", {
16626
+ css: BigNumberChart_ref4,
16627
+ children: (0,jsx_runtime_namespaceObject.jsx)(TrendLine, {
16628
+ ...trendLineProps,
16629
+ data: [{
16630
+ id: 'trend-line',
16631
+ data
16632
+ }],
16633
+ onMouseMove: handleMouseMove,
16634
+ onMouseLeave: handleMouseLeave
16635
+ })
16636
+ })
16637
+ })]
16638
+ })
16639
+ });
16640
+ };
16641
+ const BigNumberChart = WithFullscreenMode(BigNumberChartComponent);
16642
+ ;// ./src/components/Charts/BigNumberChart/index.ts
16643
+
16393
16644
  ;// ./src/components/Charts/index.ts
16394
16645
 
16395
16646
 
@@ -16399,6 +16650,7 @@ const BarGaugeChart = WithFullscreenMode(BarGaugeChartComponent);
16399
16650
 
16400
16651
 
16401
16652
 
16653
+
16402
16654
  ;// ./src/components/Popover/hooks/index.ts
16403
16655
 
16404
16656
 
@@ -17757,7 +18009,7 @@ const WithVisibleUpToLG = (Component, styles) => {
17757
18009
  ;// ./src/components/WithVisibleUpToLG/index.ts
17758
18010
 
17759
18011
  ;// external "@rjsf/core"
17760
- const core_namespaceObject = require("@rjsf/core");
18012
+ const external_rjsf_core_namespaceObject = require("@rjsf/core");
17761
18013
  ;// external "@rjsf/utils"
17762
18014
  const external_rjsf_utils_namespaceObject = require("@rjsf/utils");
17763
18015
  ;// ./src/components/JsonSchemaForm/templates/SubmitButton.tsx
@@ -18776,7 +19028,7 @@ function generateTheme() {
18776
19028
  }
18777
19029
  const Theme = generateTheme();
18778
19030
  function generateForm() {
18779
- return (0,core_namespaceObject.withTheme)(generateTheme());
19031
+ return (0,external_rjsf_core_namespaceObject.withTheme)(generateTheme());
18780
19032
  }
18781
19033
  const UnstyledForm = generateForm();
18782
19034
  const JsonSchemaForm_Form = /*#__PURE__*/base_default()(UnstyledForm, true ? {