@ssa-ui-kit/core 2.9.1 → 2.10.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.
@@ -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';
@@ -1,3 +1,3 @@
1
1
  import { RadioGroupProps } from './types';
2
- declare const RadioGroup: ({ name, isRequired, initialState, onChange, children, className, }: RadioGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
2
+ declare const RadioGroup: ({ name, isRequired, externalState, onChange, children, className, }: RadioGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
3
3
  export default RadioGroup;
@@ -2,8 +2,8 @@ import { RadioProps } from '../Radio/types';
2
2
  export interface RadioGroupProps {
3
3
  name: string;
4
4
  isRequired?: boolean;
5
- initialState?: string;
5
+ externalState?: string | number;
6
6
  className?: string;
7
- onChange: (value: string) => void;
7
+ onChange: (value: string | number) => void;
8
8
  children?: React.ReactElement<RadioProps>[] | React.ReactElement<RadioProps>;
9
9
  }
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),
@@ -4422,12 +4424,15 @@ const RadioGroupBase = /*#__PURE__*/base_default()("div", true ? {
4422
4424
  const RadioGroup = ({
4423
4425
  name,
4424
4426
  isRequired,
4425
- initialState,
4427
+ externalState,
4426
4428
  onChange,
4427
4429
  children,
4428
4430
  className
4429
4431
  }) => {
4430
- const [activeValue, setActiveValue] = (0,external_react_namespaceObject.useState)(initialState);
4432
+ const [activeValue, setActiveValue] = (0,external_react_namespaceObject.useState)(externalState);
4433
+ (0,external_react_namespaceObject.useEffect)(() => {
4434
+ setActiveValue(externalState);
4435
+ }, [externalState]);
4431
4436
  const onRadioValueChange = value => {
4432
4437
  setActiveValue(value);
4433
4438
  onChange(value);
@@ -16390,6 +16395,255 @@ const BarGaugeChart = WithFullscreenMode(BarGaugeChartComponent);
16390
16395
  ;// ./src/components/Charts/BarGaugeChart/index.ts
16391
16396
 
16392
16397
 
16398
+ ;// ./src/components/Charts/BigNumberChart/components/BigNumberChartHeader.tsx
16399
+
16400
+ 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)."; }
16401
+
16402
+
16403
+
16404
+
16405
+ const BigNumberChartHeader_FullScreenButton = /*#__PURE__*/base_default()(Button_Button, true ? {
16406
+ target: "elke6i10"
16407
+ } : 0)("height:auto;padding:0;background:none;box-shadow:none;&:hover,&:focus{background:none;box-shadow:none;&::before{display:none;}}&:hover{svg path{fill:", ({
16408
+ theme
16409
+ }) => theme.colors.greyDarker, ";}}" + ( true ? "" : 0));
16410
+ var BigNumberChartHeader_ref = true ? {
16411
+ name: "1pqzlpx",
16412
+ styles: "width:auto;margin-left:auto"
16413
+ } : 0;
16414
+ var BigNumberChartHeader_ref2 = true ? {
16415
+ name: "e0dnmk",
16416
+ styles: "cursor:pointer"
16417
+ } : 0;
16418
+ const BigNumberChartHeader = ({
16419
+ features = []
16420
+ }) => {
16421
+ const {
16422
+ isFullscreenMode,
16423
+ toggleFullscreenMode
16424
+ } = useFullscreenMode();
16425
+ const theme = (0,react_namespaceObject.useTheme)();
16426
+ return (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
16427
+ css: BigNumberChartHeader_ref,
16428
+ children: features.includes('fullscreenMode') && (0,jsx_runtime_namespaceObject.jsx)(BigNumberChartHeader_FullScreenButton, {
16429
+ variant: "tertiary",
16430
+ onClick: toggleFullscreenMode,
16431
+ children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
16432
+ name: isFullscreenMode ? 'cross' : 'maximize',
16433
+ css: BigNumberChartHeader_ref2,
16434
+ tooltip: isFullscreenMode ? 'Close' : 'Maximize',
16435
+ size: 18,
16436
+ color: theme.colors.greyFilterIcon
16437
+ })
16438
+ })
16439
+ });
16440
+ };
16441
+ ;// external "@nivo/core"
16442
+ const core_namespaceObject = require("@nivo/core");
16443
+ ;// external "@nivo/line"
16444
+ const line_namespaceObject = require("@nivo/line");
16445
+ ;// ./src/components/Charts/BigNumberChart/components/TrendLineTooltip.tsx
16446
+
16447
+
16448
+ const TrendLineTooltipStyled = /*#__PURE__*/base_default()("div", true ? {
16449
+ target: "e19yhkwp0"
16450
+ } : 0)("background:", ({
16451
+ theme
16452
+ }) => theme.colors.white, ";border:1px solid ", ({
16453
+ theme
16454
+ }) => theme.colors.grey20, ";border-radius:8px;color:", ({
16455
+ theme
16456
+ }) => theme.colors.greyDarker, ";font-weight:600;line-height:12px;font-size:10px;padding:0.5rem;" + ( true ? "" : 0));
16457
+ const TrendLineTooltip = ({
16458
+ point,
16459
+ valueFormat
16460
+ }) => {
16461
+ const {
16462
+ data
16463
+ } = point;
16464
+ const {
16465
+ xFormatted,
16466
+ yFormatted
16467
+ } = point.data;
16468
+ return (0,jsx_runtime_namespaceObject.jsx)(TrendLineTooltipStyled, {
16469
+ children: valueFormat?.(data) ?? `${xFormatted} - ${yFormatted}`
16470
+ });
16471
+ };
16472
+ ;// ./src/components/Charts/BigNumberChart/components/TrendLine.tsx
16473
+
16474
+
16475
+
16476
+
16477
+
16478
+ const ActivePoint = ({
16479
+ currentPoint,
16480
+ ...props
16481
+ }) => (0,jsx_runtime_namespaceObject.jsx)("g", {
16482
+ children: currentPoint && (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.DotsItem, {
16483
+ size: props.pointSize || 10,
16484
+ borderWidth: props.pointBorderWidth || 10,
16485
+ x: currentPoint.x,
16486
+ y: currentPoint.y,
16487
+ datum: currentPoint.data,
16488
+ color: currentPoint.color,
16489
+ borderColor: currentPoint.borderColor,
16490
+ labelYOffset: props.pointLabelYOffset
16491
+ }, currentPoint.id)
16492
+ });
16493
+ const TrendLine = ({
16494
+ color,
16495
+ tooltipValueFormat,
16496
+ ...props
16497
+ }) => {
16498
+ const theme = (0,react_namespaceObject.useTheme)();
16499
+ const _color = color ?? theme.colors.purpleDark;
16500
+ return (0,jsx_runtime_namespaceObject.jsx)(line_namespaceObject.ResponsiveLine, {
16501
+ axisBottom: null,
16502
+ axisLeft: null,
16503
+ axisRight: null,
16504
+ axisTop: null,
16505
+ colors: _color,
16506
+ curve: "linear",
16507
+ enableArea: true,
16508
+ enableGridX: false,
16509
+ enableGridY: false,
16510
+ enablePoints: false,
16511
+ lineWidth: 2,
16512
+ pointBorderWidth: 2,
16513
+ pointColor: "black",
16514
+ pointLabelYOffset: -12,
16515
+ pointSize: 5,
16516
+ useMesh: true,
16517
+ enableTouchCrosshair: true,
16518
+ defs: [{
16519
+ colors: [{
16520
+ color: _color,
16521
+ offset: 0
16522
+ }, {
16523
+ color: theme.colors.white,
16524
+ offset: 100
16525
+ }],
16526
+ id: 'gradientA',
16527
+ type: 'linearGradient'
16528
+ }],
16529
+ fill: [{
16530
+ id: 'gradientA',
16531
+ match: '*'
16532
+ }],
16533
+ enableCrosshair: false,
16534
+ animate: false,
16535
+ yScale: {
16536
+ type: 'linear',
16537
+ stacked: true,
16538
+ reverse: false
16539
+ },
16540
+ pointBorderColor: {
16541
+ from: 'serieColor'
16542
+ },
16543
+ margin: {
16544
+ top: 5,
16545
+ right: 5,
16546
+ bottom: 5,
16547
+ left: 5
16548
+ },
16549
+ legends: [],
16550
+ tooltip: args => (0,jsx_runtime_namespaceObject.jsx)(TrendLineTooltip, {
16551
+ ...args,
16552
+ valueFormat: tooltipValueFormat
16553
+ }),
16554
+ layers: ['grid', 'markers', 'axes', 'areas', 'crosshair', 'lines', 'points', 'slices', 'mesh', 'legends', ActivePoint],
16555
+ ...props
16556
+ });
16557
+ };
16558
+ ;// ./src/components/Charts/BigNumberChart/BigNumberChart.tsx
16559
+ 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)."; }
16560
+
16561
+
16562
+
16563
+
16564
+
16565
+
16566
+ var BigNumberChart_ref = true ? {
16567
+ name: "qdcqne",
16568
+ styles: "height:100%;justify-content:space-between"
16569
+ } : 0;
16570
+ var BigNumberChart_ref2 = true ? {
16571
+ name: "gfqabp",
16572
+ styles: "font-size:32px;font-weight:700"
16573
+ } : 0;
16574
+ var BigNumberChart_ref3 = true ? {
16575
+ name: "26qidl",
16576
+ styles: "position:relative;width:100%;height:50%"
16577
+ } : 0;
16578
+ var BigNumberChart_ref4 = true ? {
16579
+ name: "19s8nj4",
16580
+ styles: "position:absolute;width:100%;height:100%"
16581
+ } : 0;
16582
+ const BigNumberChartComponent = ({
16583
+ data,
16584
+ title,
16585
+ widgetCardProps,
16586
+ trendLineProps,
16587
+ interactive = true,
16588
+ features = [],
16589
+ valueFormat
16590
+ }) => {
16591
+ const [hoveredValue, setHoveredValue] = (0,external_react_namespaceObject.useState)(null);
16592
+ const lastValue = data.sort((a, b) => {
16593
+ const ax = a.x ?? 0;
16594
+ const bx = b.x ?? 0;
16595
+ return Number(ax) - Number(bx);
16596
+ }).at(-1);
16597
+ const setHoveredValueThrottled = (0,hooks_namespaceObject.useThrottledCallback)(value => {
16598
+ setHoveredValue(value);
16599
+ }, 100);
16600
+ const handleMouseMove = data => {
16601
+ if (!interactive) return;
16602
+ setHoveredValueThrottled(data.data);
16603
+ };
16604
+ const handleMouseLeave = () => {
16605
+ setHoveredValueThrottled(null);
16606
+ };
16607
+ const value = hoveredValue ?? lastValue;
16608
+ return (0,jsx_runtime_namespaceObject.jsx)(WithWidgetCard, {
16609
+ features: features,
16610
+ cardProps: {
16611
+ title,
16612
+ headerContent: (0,jsx_runtime_namespaceObject.jsx)(BigNumberChartHeader, {
16613
+ features: features
16614
+ }),
16615
+ ...widgetCardProps
16616
+ },
16617
+ children: (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
16618
+ direction: "column",
16619
+ alignItems: "start",
16620
+ css: BigNumberChart_ref,
16621
+ children: [(0,jsx_runtime_namespaceObject.jsx)("div", {
16622
+ css: BigNumberChart_ref2,
16623
+ children: (0,jsx_runtime_namespaceObject.jsx)("span", {
16624
+ children: value && (valueFormat?.(value) ?? value?.y?.toString())
16625
+ })
16626
+ }), (0,jsx_runtime_namespaceObject.jsx)("div", {
16627
+ css: BigNumberChart_ref3,
16628
+ children: (0,jsx_runtime_namespaceObject.jsx)("div", {
16629
+ css: BigNumberChart_ref4,
16630
+ children: (0,jsx_runtime_namespaceObject.jsx)(TrendLine, {
16631
+ ...trendLineProps,
16632
+ data: [{
16633
+ id: 'trend-line',
16634
+ data
16635
+ }],
16636
+ onMouseMove: handleMouseMove,
16637
+ onMouseLeave: handleMouseLeave
16638
+ })
16639
+ })
16640
+ })]
16641
+ })
16642
+ });
16643
+ };
16644
+ const BigNumberChart = WithFullscreenMode(BigNumberChartComponent);
16645
+ ;// ./src/components/Charts/BigNumberChart/index.ts
16646
+
16393
16647
  ;// ./src/components/Charts/index.ts
16394
16648
 
16395
16649
 
@@ -16399,6 +16653,7 @@ const BarGaugeChart = WithFullscreenMode(BarGaugeChartComponent);
16399
16653
 
16400
16654
 
16401
16655
 
16656
+
16402
16657
  ;// ./src/components/Popover/hooks/index.ts
16403
16658
 
16404
16659
 
@@ -17757,7 +18012,7 @@ const WithVisibleUpToLG = (Component, styles) => {
17757
18012
  ;// ./src/components/WithVisibleUpToLG/index.ts
17758
18013
 
17759
18014
  ;// external "@rjsf/core"
17760
- const core_namespaceObject = require("@rjsf/core");
18015
+ const external_rjsf_core_namespaceObject = require("@rjsf/core");
17761
18016
  ;// external "@rjsf/utils"
17762
18017
  const external_rjsf_utils_namespaceObject = require("@rjsf/utils");
17763
18018
  ;// ./src/components/JsonSchemaForm/templates/SubmitButton.tsx
@@ -18366,7 +18621,7 @@ const RadioWidget = props => {
18366
18621
  return (0,jsx_runtime_namespaceObject.jsx)(RadioGroup_RadioGroup, {
18367
18622
  name: name,
18368
18623
  onChange: handleChange,
18369
- initialState: selectedIndex,
18624
+ externalState: selectedIndex,
18370
18625
  isRequired: required,
18371
18626
  css: /*#__PURE__*/(0,react_namespaceObject.css)({
18372
18627
  [`> label`]: {
@@ -18776,7 +19031,7 @@ function generateTheme() {
18776
19031
  }
18777
19032
  const Theme = generateTheme();
18778
19033
  function generateForm() {
18779
- return (0,core_namespaceObject.withTheme)(generateTheme());
19034
+ return (0,external_rjsf_core_namespaceObject.withTheme)(generateTheme());
18780
19035
  }
18781
19036
  const UnstyledForm = generateForm();
18782
19037
  const JsonSchemaForm_Form = /*#__PURE__*/base_default()(UnstyledForm, true ? {