@verifiedinc-public/shared-ui-elements 3.10.0 → 3.11.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.
- package/dist/components/animation/index.mjs +1 -1
- package/dist/components/chart/PieChart/index.d.ts +87 -0
- package/dist/components/chart/PieChart/renderActiveShape.d.ts +2 -0
- package/dist/components/chart/PieChart/renderNeedle.d.ts +16 -0
- package/dist/components/chart/RiskScoreBarChart/index.d.ts +8 -0
- package/dist/components/chart/RiskScorePieChart/index.d.ts +18 -0
- package/dist/components/chart/SimpleBarChart/index.d.ts +3 -2
- package/dist/components/chart/SimpleLegend/index.d.ts +59 -0
- package/dist/components/chart/index.d.ts +3 -0
- package/dist/components/chart/index.mjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/typographies/index.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{PageSectionHeader-DClJcZmV.mjs → PageSectionHeader-DdpDhBZG.mjs} +1 -1
- package/dist/shared/index-DPBjdrwv.mjs +104 -0
- package/dist/shared/{index-CDq4CkLc.mjs → index-KVVTzcea.mjs} +1 -1
- package/dist/shared/jsx-runtime-DHlBLioN.mjs +1 -0
- package/dist/shared/{motions-CpxgbzKX.mjs → motions-BBPeWBPV.mjs} +1 -1
- package/package.json +1 -1
- package/dist/shared/index-Bbzs5AIe.mjs +0 -104
- package/dist/shared/jsx-runtime-jmtevAuS.mjs +0 -1
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{C as o,M as a,f as s,a as t,d as n,c as i,b as M,e}from"../../shared/motions-
|
1
|
+
"use strict";import{C as o,M as a,f as s,a as t,d as n,c as i,b as M,e}from"../../shared/motions-BBPeWBPV.mjs";export{o as Counter,a as MotionBox,s as MotionButton,t as MotionStack,n as MotionTableCell,i as MotionTableRow,M as MotionTbody,e as MotionTypography};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
import { PieProps } from 'recharts';
|
4
|
+
/**
|
5
|
+
* Data point structure for the PieChart component
|
6
|
+
*/
|
7
|
+
export interface DataPoint {
|
8
|
+
/** Label for the data point */
|
9
|
+
name: string;
|
10
|
+
/** Numeric value for the data point */
|
11
|
+
value: number;
|
12
|
+
/** Optional color for the slice */
|
13
|
+
color?: string;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Props for the PieChart component
|
17
|
+
*/
|
18
|
+
interface PieChartProps {
|
19
|
+
/**
|
20
|
+
* Array of data points to display in the pie chart
|
21
|
+
* Each point should have a name and value, and optionally a color
|
22
|
+
*/
|
23
|
+
data: DataPoint[];
|
24
|
+
/**
|
25
|
+
* MUI System props object for custom styling of the chart container
|
26
|
+
*/
|
27
|
+
sx?: SxProps;
|
28
|
+
/**
|
29
|
+
* Optional label for the chart's legend
|
30
|
+
*/
|
31
|
+
legendLabel?: string;
|
32
|
+
/**
|
33
|
+
* Optional visibility for the legend
|
34
|
+
* @default false
|
35
|
+
*/
|
36
|
+
legendToggle?: boolean;
|
37
|
+
/**
|
38
|
+
* Optional prefix for the value label
|
39
|
+
* @default ''
|
40
|
+
*/
|
41
|
+
valueText?: string;
|
42
|
+
/**
|
43
|
+
* Optional visibility for the value percentage
|
44
|
+
* @default true
|
45
|
+
*/
|
46
|
+
valuePercentage?: boolean;
|
47
|
+
/**
|
48
|
+
* Optional visibility for the needle
|
49
|
+
* @default false
|
50
|
+
*/
|
51
|
+
needleVisible?: boolean;
|
52
|
+
/**
|
53
|
+
* Optional needle value to display on the chart
|
54
|
+
*/
|
55
|
+
needleValue?: number;
|
56
|
+
/**
|
57
|
+
* Optional color for the needle
|
58
|
+
* @default '#d0d000'
|
59
|
+
*/
|
60
|
+
needleColor?: string;
|
61
|
+
/**
|
62
|
+
* Optional props object for the Pie component
|
63
|
+
*/
|
64
|
+
pie?: Partial<PieProps>;
|
65
|
+
}
|
66
|
+
/**
|
67
|
+
* A pie chart component that visualizes proportional data.
|
68
|
+
*
|
69
|
+
* The chart displays data points as slices of a pie, with optional donut style.
|
70
|
+
* It includes a legend and tooltips for better data visualization.
|
71
|
+
* Colors can be provided in the data points or will default to theme-based colors.
|
72
|
+
* Hovering over a slice shows detailed information about that segment.
|
73
|
+
*
|
74
|
+
* @example
|
75
|
+
* ```tsx
|
76
|
+
* <PieChart
|
77
|
+
* data={[
|
78
|
+
* { name: 'Group A', value: 400, color: '#ff0000' },
|
79
|
+
* { name: 'Group B', value: 300, color: '#00ff00' },
|
80
|
+
* ]}
|
81
|
+
* sx={{ width: 400, height: 400 }}
|
82
|
+
* legendLabel="Distribution"
|
83
|
+
* />
|
84
|
+
* ```
|
85
|
+
*/
|
86
|
+
export declare function PieChart({ data, sx, legendLabel, legendToggle, valueText, valuePercentage, pie, needleVisible, needleValue, needleColor, }: PieChartProps): ReactElement;
|
87
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
interface DataPoint {
|
3
|
+
value: number;
|
4
|
+
}
|
5
|
+
interface NeedleOptions {
|
6
|
+
value: number;
|
7
|
+
data: DataPoint[];
|
8
|
+
color: string;
|
9
|
+
innerRadius: string | number;
|
10
|
+
outerRadius: string | number;
|
11
|
+
boxDimensions?: DOMRectReadOnly;
|
12
|
+
legendDimensions: DOMRectReadOnly;
|
13
|
+
valueText?: string;
|
14
|
+
}
|
15
|
+
export declare const renderNeedle: (options: NeedleOptions) => ReactElement;
|
16
|
+
export {};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
interface RiskScoreBarChartProps {
|
4
|
+
data: Array<Record<number, number>>;
|
5
|
+
sx?: SxProps;
|
6
|
+
}
|
7
|
+
export declare function RiskScoreBarChart({ data, sx, }: RiskScoreBarChartProps): ReactElement;
|
8
|
+
export {};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
import { SxProps } from '@mui/material';
|
3
|
+
import { DataPoint } from '../PieChart';
|
4
|
+
export interface RiskScorePieChartProps {
|
5
|
+
data: Array<Pick<DataPoint, 'value'>>;
|
6
|
+
/** Optional style overrides */
|
7
|
+
sx?: SxProps;
|
8
|
+
/** The current risk score value (0-1000) */
|
9
|
+
score?: number;
|
10
|
+
/** Optional label for the legend */
|
11
|
+
legendLabel?: string;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* A specialized pie chart for displaying risk scores.
|
15
|
+
* Displays a semi-circular gauge with three segments (Allow, Flag, Block)
|
16
|
+
* and a needle indicating the current score.
|
17
|
+
*/
|
18
|
+
export declare function RiskScorePieChart({ sx, data, score, legendLabel, }: RiskScorePieChartProps): ReactElement;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ComponentProps, ReactElement } from 'react';
|
2
2
|
import { SxProps } from '@mui/material';
|
3
|
-
import { Bar, ReferenceLine, Tooltip, XAxis, YAxis } from 'recharts';
|
3
|
+
import { Bar, ReferenceArea, ReferenceLine, Tooltip, XAxis, YAxis } from 'recharts';
|
4
4
|
interface Series {
|
5
5
|
key: string;
|
6
6
|
dataKey: string;
|
@@ -14,7 +14,8 @@ interface SimpleBarChartProps {
|
|
14
14
|
tooltip?: ComponentProps<typeof Tooltip>;
|
15
15
|
bar?: ComponentProps<typeof Bar>;
|
16
16
|
referenceLines?: Array<ComponentProps<typeof ReferenceLine>>;
|
17
|
+
referenceAreas?: Array<ComponentProps<typeof ReferenceArea>>;
|
17
18
|
sx?: SxProps;
|
18
19
|
}
|
19
|
-
export declare function SimpleBarChart({ data, series, xAxis, yAxis, tooltip, bar, referenceLines, sx, }: SimpleBarChartProps): ReactElement;
|
20
|
+
export declare function SimpleBarChart({ data, series, xAxis, yAxis, tooltip, bar, referenceLines, referenceAreas, sx, }: SimpleBarChartProps): ReactElement;
|
20
21
|
export {};
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { ReactElement } from 'react';
|
2
|
+
/**
|
3
|
+
* Generic payload interface for legend items.
|
4
|
+
* Represents the data structure of each legend entry's payload.
|
5
|
+
*/
|
6
|
+
export interface Payload {
|
7
|
+
/** Unique identifier for the legend item */
|
8
|
+
name: string;
|
9
|
+
/** Additional dynamic properties */
|
10
|
+
[key: string]: any;
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* Represents a single entry in the legend.
|
14
|
+
*/
|
15
|
+
interface LegendEntry {
|
16
|
+
/** Display value for the legend item */
|
17
|
+
value: string;
|
18
|
+
/** Data payload associated with the legend item */
|
19
|
+
payload: Payload;
|
20
|
+
/** Color to be used for the legend item's marker and text */
|
21
|
+
color: string;
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Props for the SimpleLegend component
|
25
|
+
*/
|
26
|
+
interface CustomLegendProps {
|
27
|
+
/** Array of legend entries to be displayed */
|
28
|
+
payload?: LegendEntry[];
|
29
|
+
/** Set of item names that are currently hidden */
|
30
|
+
hiddenItems: Set<string>;
|
31
|
+
/** Optional callback function triggered when a legend item is clicked */
|
32
|
+
onToggle?: (payload: Payload) => void;
|
33
|
+
/** Optional label prefix for legend items */
|
34
|
+
legendLabel?: string;
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* A reusable legend component for charts that supports item toggling and custom styling.
|
38
|
+
*
|
39
|
+
* This component renders a horizontal list of legend items, each with a colored square marker
|
40
|
+
* and associated text. Items can be clicked to toggle their visibility in the associated chart.
|
41
|
+
*
|
42
|
+
* Features:
|
43
|
+
* - Customizable colors for markers and text
|
44
|
+
* - Click to toggle visibility
|
45
|
+
* - Visual feedback for hidden items (reduced opacity)
|
46
|
+
* - Optional label prefix for all items
|
47
|
+
* - Centered layout with consistent spacing
|
48
|
+
*
|
49
|
+
* @example
|
50
|
+
* ```tsx
|
51
|
+
* <SimpleLegend
|
52
|
+
* hiddenItems={new Set(["A"])}
|
53
|
+
* onToggle={(payload) => console.log("Toggled:", payload.name)}
|
54
|
+
* legendLabel="Type"
|
55
|
+
* />
|
56
|
+
* ```
|
57
|
+
*/
|
58
|
+
export declare function SimpleLegend({ payload, hiddenItems, onToggle, legendLabel, }: CustomLegendProps): ReactElement;
|
59
|
+
export {};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{j as s}from"../../shared/jsx-runtime-jmtevAuS.mjs";import*as D from"react";import{useCallback as X,useMemo as Y,createElement as Ee}from"react";import{Box as z,Stack as P,Typography as R,useTheme as q,Paper as Ae}from"@mui/material";import{ResponsiveContainer as ee,LineChart as Ce,CartesianGrid as oe,XAxis as te,YAxis as re,Label as fe,Tooltip as ne,Legend as De,Line as Le,AreaChart as Fe,Area as Ge,ComposedChart as Re,ReferenceLine as he,Bar as Me}from"recharts";import{b as ye,c as xe}from"../../shared/date-Cq0LS2Mr.mjs";import B,{Decimal as ae}from"decimal.js";import{AnimatePresence as We}from"framer-motion";import{u as Ie}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as ie}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as Ke,C as be}from"../../shared/motions-CpxgbzKX.mjs";import{i as Ve,_ as U,s as ze,a as f,c as ge,d as Pe,e as qe,f as Be,h as Ue,j as Ze,k as He,l as Je,m as Qe,n as Xe,o as Ye,p as eo,u as oo}from"../../shared/index-CDq4CkLc.mjs";import{u as to}from"../../shared/useCounter-BV32zXDQ.mjs";const ro=["ownerState"],no=["variants"],ao=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function io(e){return Object.keys(e).length===0}function so(e){return typeof e=="string"&&e.charCodeAt(0)>96}function se(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const lo=ge(),co=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function Z({defaultTheme:e,theme:o,themeId:t}){return io(o)?e:o[t]||o}function uo(e){return e?(o,t)=>t[e]:null}function H(e,o){let{ownerState:t}=o,r=U(o,ro);const a=typeof e=="function"?e(f({ownerState:t},r)):e;if(Array.isArray(a))return a.flatMap(n=>H(n,f({ownerState:t},r)));if(a&&typeof a=="object"&&Array.isArray(a.variants)){const{variants:n=[]}=a;let i=U(a,no);return n.forEach(c=>{let l=!0;typeof c.props=="function"?l=c.props(f({ownerState:t},r,t)):Object.keys(c.props).forEach(u=>{t?.[u]!==c.props[u]&&r[u]!==c.props[u]&&(l=!1)}),l&&(Array.isArray(i)||(i=[i]),i.push(typeof c.style=="function"?c.style(f({ownerState:t},r,t)):c.style))}),i}return a}function po(e={}){const{themeId:o,defaultTheme:t=lo,rootShouldForwardProp:r=se,slotShouldForwardProp:a=se}=e,n=i=>Pe(f({},i,{theme:Z(f({},i,{defaultTheme:t,themeId:o}))}));return n.__mui_systemSx=!0,(i,c={})=>{Ve(i,m=>m.filter(w=>!(w!=null&&w.__mui_systemSx)));const{name:l,slot:u,skipVariantsResolver:p,skipSx:d,overridesResolver:h=uo(co(u))}=c,y=U(c,ao),v=p!==void 0?p:u&&u!=="Root"&&u!=="root"||!1,x=d||!1;let j,k=se;u==="Root"||u==="root"?k=r:u?k=a:so(i)&&(k=void 0);const N=ze(i,f({shouldForwardProp:k,label:j},y)),W=m=>typeof m=="function"&&m.__emotion_real!==m||qe(m)?w=>H(m,f({},w,{theme:Z({theme:w.theme,defaultTheme:t,themeId:o})})):m,E=(m,...w)=>{let F=W(m);const _=w?w.map(W):[];l&&h&&_.push(b=>{const g=Z(f({},b,{defaultTheme:t,themeId:o}));if(!g.components||!g.components[l]||!g.components[l].styleOverrides)return null;const S=g.components[l].styleOverrides,A={};return Object.entries(S).forEach(([J,V])=>{A[J]=H(V,f({},b,{theme:g}))}),h(b,A)}),l&&!v&&_.push(b=>{var g;const S=Z(f({},b,{defaultTheme:t,themeId:o})),A=S==null||(g=S.components)==null||(g=g[l])==null?void 0:g.variants;return H({variants:A},f({},b,{theme:S}))}),x||_.push(n);const I=_.length-w.length;if(Array.isArray(m)&&I>0){const b=new Array(I).fill("");F=[...m,...b],F.raw=[...m.raw,...b]}const K=N(F,..._);return i.muiName&&(K.muiName=i.muiName),K};return N.withConfig&&(E.withConfig=N.withConfig),E}}const mo=po(),fo=(e,o)=>e.filter(t=>o.includes(t)),L=(e,o,t)=>{const r=e.keys[0];Array.isArray(o)?o.forEach((a,n)=>{t((i,c)=>{n<=e.keys.length-1&&(n===0?Object.assign(i,c):i[e.up(e.keys[n])]=c)},a)}):o&&typeof o=="object"?(Object.keys(o).length>e.keys.length?e.keys:fo(e.keys,Object.keys(o))).forEach(a=>{if(e.keys.indexOf(a)!==-1){const n=o[a];n!==void 0&&t((i,c)=>{r===a?Object.assign(i,c):i[e.up(a)]=c},n)}}):(typeof o=="number"||typeof o=="string")&&t((a,n)=>{Object.assign(a,n)},o)};function $(e){return e?`Level${e}`:""}function M(e){return e.unstable_level>0&&e.container}function ve(e){return function(o){return`var(--Grid-${o}Spacing${$(e.unstable_level)})`}}function le(e){return function(o){return e.unstable_level===0?`var(--Grid-${o}Spacing)`:`var(--Grid-${o}Spacing${$(e.unstable_level-1)})`}}function ce(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${$(e.unstable_level-1)})`}const ho=({theme:e,ownerState:o})=>{const t=ve(o),r={};return L(e.breakpoints,o.gridSize,(a,n)=>{let i={};n===!0&&(i={flexBasis:0,flexGrow:1,maxWidth:"100%"}),n==="auto"&&(i={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof n=="number"&&(i={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${n} / ${ce(o)}${M(o)?` + ${t("column")}`:""})`}),a(r,i)}),r},yo=({theme:e,ownerState:o})=>{const t={};return L(e.breakpoints,o.gridOffset,(r,a)=>{let n={};a==="auto"&&(n={marginLeft:"auto"}),typeof a=="number"&&(n={marginLeft:a===0?"0px":`calc(100% * ${a} / ${ce(o)})`}),r(t,n)}),t},xo=({theme:e,ownerState:o})=>{if(!o.container)return{};const t=M(o)?{[`--Grid-columns${$(o.unstable_level)}`]:ce(o)}:{"--Grid-columns":12};return L(e.breakpoints,o.columns,(r,a)=>{r(t,{[`--Grid-columns${$(o.unstable_level)}`]:a})}),t},bo=({theme:e,ownerState:o})=>{if(!o.container)return{};const t=le(o),r=M(o)?{[`--Grid-rowSpacing${$(o.unstable_level)}`]:t("row")}:{};return L(e.breakpoints,o.rowSpacing,(a,n)=>{var i;a(r,{[`--Grid-rowSpacing${$(o.unstable_level)}`]:typeof n=="string"?n:(i=e.spacing)==null?void 0:i.call(e,n)})}),r},go=({theme:e,ownerState:o})=>{if(!o.container)return{};const t=le(o),r=M(o)?{[`--Grid-columnSpacing${$(o.unstable_level)}`]:t("column")}:{};return L(e.breakpoints,o.columnSpacing,(a,n)=>{var i;a(r,{[`--Grid-columnSpacing${$(o.unstable_level)}`]:typeof n=="string"?n:(i=e.spacing)==null?void 0:i.call(e,n)})}),r},vo=({theme:e,ownerState:o})=>{if(!o.container)return{};const t={};return L(e.breakpoints,o.direction,(r,a)=>{r(t,{flexDirection:a})}),t},wo=({ownerState:e})=>{const o=ve(e),t=le(e);return f({minWidth:0,boxSizing:"border-box"},e.container&&f({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${o("row")} / -2) calc(${o("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${o("row")} * -1) 0px 0px calc(${o("column")} * -1)`}),(!e.container||M(e))&&f({padding:`calc(${t("row")} / 2) calc(${t("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${t("row")} 0px 0px ${t("column")}`}))},Oo=e=>{const o=[];return Object.entries(e).forEach(([t,r])=>{r!==!1&&r!==void 0&&o.push(`grid-${t}-${String(r)}`)}),o},jo=(e,o="xs")=>{function t(r){return r===void 0?!1:typeof r=="string"&&!Number.isNaN(Number(r))||typeof r=="number"&&r>0}if(t(e))return[`spacing-${o}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const r=[];return Object.entries(e).forEach(([a,n])=>{t(n)&&r.push(`spacing-${a}-${String(n)}`)}),r}return[]},ko=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([o,t])=>`direction-${o}-${t}`):[`direction-xs-${String(e)}`],So=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],$o=ge(),No=mo("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,o)=>o.root});function _o(e){return Je({props:e,name:"MuiGrid",defaultTheme:$o})}function To(e={}){const{createStyledComponent:o=No,useThemeProps:t=_o,componentName:r="MuiGrid"}=e,a=D.createContext(void 0),n=(l,u)=>{const{container:p,direction:d,spacing:h,wrap:y,gridSize:v}=l,x={root:["root",p&&"container",y!=="wrap"&&`wrap-xs-${String(y)}`,...ko(d),...Oo(v),...p?jo(h,u.breakpoints.keys[0]):[]]};return Qe(x,j=>Xe(r,j),{})},i=o(xo,go,bo,ho,vo,wo,yo),c=D.forwardRef(function(l,u){var p,d,h,y,v,x,j,k;const N=Be(),W=t(l),E=Ue(W),m=D.useContext(a),{className:w,children:F,columns:_=12,container:I=!1,component:K="div",direction:b="row",wrap:g="wrap",spacing:S=0,rowSpacing:A=S,columnSpacing:J=S,disableEqualOverflow:V,unstable_level:T=0}=E,ke=U(E,So);let G=V;T&&V!==void 0&&(G=l.disableEqualOverflow);const ue={},de={},pe={};Object.entries(ke).forEach(([O,C])=>{N.breakpoints.values[O]!==void 0?ue[O]=C:N.breakpoints.values[O.replace("Offset","")]!==void 0?de[O.replace("Offset","")]=C:pe[O]=C});const Se=(p=l.columns)!=null?p:T?void 0:_,$e=(d=l.spacing)!=null?d:T?void 0:S,Ne=(h=(y=l.rowSpacing)!=null?y:l.spacing)!=null?h:T?void 0:A,_e=(v=(x=l.columnSpacing)!=null?x:l.spacing)!=null?v:T?void 0:J,me=f({},E,{level:T,columns:Se,container:I,direction:b,wrap:g,spacing:$e,rowSpacing:Ne,columnSpacing:_e,gridSize:ue,gridOffset:de,disableEqualOverflow:(j=(k=G)!=null?k:m)!=null?j:!1,parentDisableEqualOverflow:m}),Te=n(me,N);let Q=s.jsx(i,f({ref:u,as:K,ownerState:me,className:Ze(Te.root,w)},pe,{children:D.Children.map(F,O=>{if(D.isValidElement(O)&&He(O,["Grid"])){var C;return D.cloneElement(O,{unstable_level:(C=O.props.unstable_level)!=null?C:T+1})}return O})}));return G!==void 0&&G!==(m??!1)&&(Q=s.jsx(a.Provider,{value:G,children:Q})),Q});return c.muiName="Grid",c}const we=To({createStyledComponent:Ye("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,o)=>o.root}),componentName:"MuiGrid2",useThemeProps:e=>eo({props:e,name:"MuiGrid2"})});function Eo({entry:e,payload:o}){const t=X(d=>{var h,y,v;return(v=(y=(h=d.payload)==null?void 0:h.data)==null?void 0:y.reduce)==null?void 0:v.call(y,(x,j)=>x+j.value,0)},[]),r=X(d=>{const h=new ae(t(d)||0),y=o?.reduce((j,k)=>j+t(k),0)||0,v=new ae(y),x=Number(h.div(v).times(100).toFixed(2,ae.ROUND_DOWN));return isNaN(x)||!isFinite(x)?0:x},[t,o]),a=Y(()=>t(e),[e,t]),n=ie(a),i=Y(()=>Number(r(e)),[e,r]),c=ie(i),l=X(d=>Math.floor(d).toLocaleString(),[]),u=Ie({type:"text/plain"}),p=oo();return s.jsxs(Ke,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[s.jsx(z,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),s.jsxs(P,{children:[s.jsxs(R,{component:"p",variant:"caption",children:[s.jsx(P,{component:"span",display:"inline-flex",mr:.5,children:s.jsx(be,{from:n??0,to:a,map:l,children:"0"})}),s.jsxs(P,{component:"span",direction:"row",display:"inline-flex",children:["(",s.jsx(be,{from:c??0,to:i,map:l,children:"0"}),"%)"]})]}),s.jsx(R,{variant:"body1",children:e.value}),e.payload.uuid&&s.jsxs(R,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{u.copy(e.payload.uuid).catch(()=>{}),p.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function Oe(e){const{payload:o}=e;return s.jsx(we,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:s.jsx(We,{children:o?.map(t=>s.jsx(we,{children:s.jsx(Eo,{entry:t,payload:o})},`item-${t.value}`))})})}function Ao(e){const o=q();return s.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:s.jsx(ee,{children:s.jsxs(Ce,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[s.jsx(oe,{vertical:!1}),s.jsx(te,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:t=>ye(t,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),s.jsx(re,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:t=>Number(t).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&s.jsx(fe,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),s.jsx(ne,{cursor:{stroke:o.palette.neutral.main,strokeWidth:1},formatter:t=>Number(t).toLocaleString(),labelFormatter:t=>xe(t,{timeZone:e.filter.timezone,hour12:!1})}),s.jsx(De,{content:s.jsx(Oe,{})}),e.data.map(t=>Ee(Le,{uuid:t.uuid,key:t.uuid,name:t.name,dataKey:"value",data:t.chartData,type:"monotone",stroke:t.color,strokeWidth:2}))]})})})}const Co=(e,o)=>{const t=new Map;return e.forEach(r=>{r.chartData.forEach(a=>{const n=new Date(a.date).getTime().toString();if(!t.has(n)){const i={date:n,total:0,diff:0,totalKey:"",originalTotal:0};o.forEach(({key:c})=>{i[c]=0,i[`${c}_absolute`]=0}),t.set(n,i)}o.forEach(({key:i})=>{const c=t.get(n),l=a[i],u=typeof l=="string"?l.trim()===""?0:parseInt(l,10):typeof l=="number"?l:0;c[`${i}_absolute`]=u,c[i]=0})})}),Array.from(t.values()).map(r=>{var a;const n=(a=o.find(l=>l.isTotal))==null?void 0:a.key,i=o.filter(l=>!l.isTotal).map(l=>l.key);if(!n||i.length===0)return r;const c=r[`${n}_absolute`];return r.originalTotal=c,r.total=c,r[n]=100,i.forEach(l=>{const u=r[`${l}_absolute`],p=c>0?new B(u.toString()).div(c).mul(100).toFixed(2,B.ROUND_DOWN):"0.00";r[l]=parseFloat(p)}),{...r,totalKey:n}}).sort((r,a)=>parseInt(r.date)-parseInt(a.date))};function Do(e){const o=q(),t=Y(()=>e.data?Co(e.data,e.keyValues):[],[e.data,e.keyValues]);return s.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:s.jsx(ee,{width:"100%",height:"100%",children:s.jsxs(Fe,{data:t,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[s.jsx(oe,{strokeDasharray:"3 3"}),s.jsx(te,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:r=>ye(r,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),s.jsx(re,{textAnchor:"end",tickLine:!1,tickFormatter:r=>`${r.toFixed(2)}%`}),s.jsx(ne,{cursor:{stroke:o.palette.neutral.main,strokeWidth:1},labelFormatter:r=>xe(r,{timeZone:e.filter.timezone,hour12:!1}),formatter:(r,a,n)=>{const i=n.payload.totalKey,c=n.dataKey,l=c===i,u=n.payload[`${c}_absolute`],p=n.payload.originalTotal,d=l?null:p===0?"0.00":new B(u.toString()).div(p).mul(100).toFixed(2,B.ROUND_DOWN);return[d?`${u.toLocaleString()} (${d}%)`:`${u.toLocaleString()} (TOTAL)`,a]}}),e.keyValues.sort((r,a)=>r.isTotal?-1:a.isTotal?1:0).map(r=>s.jsx(Ge,{type:"monotone",dataKey:r.key,name:r.name,stroke:r.color,fill:r.color,strokeWidth:2,fillOpacity:.6},r.key))]})})})}function Lo(e){const o=ie(e.value),{ref:t}=to({from:o??0,to:e.value,duration:1,map:e.map});return s.jsx(Ae,{sx:{p:3,flex:1,...e.sx},children:s.jsxs(P,{spacing:1,alignItems:"center",children:[s.jsx(R,{ref:t,variant:"h4",fontWeight:"bold",children:e.initialValue}),s.jsx(R,{color:"text.secondary",children:e.label})]})})}const Fo={margin:{top:5,right:30,left:20,bottom:5}},Go={tickLine:!1,fontSize:12,tickMargin:12},Ro={textAnchor:"end",tickLine:!1};function je({data:e,series:o,xAxis:t,yAxis:r,tooltip:a,bar:n,referenceLines:i,sx:c}){const l=q(),u=d=>!d.isFront,p=d=>!!d.isFront;return s.jsx(z,{sx:{width:"100%",height:"100%",...c},children:s.jsx(ee,{children:s.jsxs(Re,{data:e,...Fo,children:[s.jsx(oe,{strokeDasharray:"3 3",vertical:!1}),s.jsx(te,{...Go,...t}),s.jsx(re,{...Ro,...r}),s.jsx(ne,{cursor:{stroke:l.palette.neutral.main,strokeWidth:1},...a}),i?.filter(u).map((d,h)=>s.jsx(he,{...d},h)),o.map(d=>s.jsx(Me,{name:d.key,dataKey:d.dataKey,fill:d.color,stackId:"stack",isAnimationActive:!1,...n},d.key)),i?.filter(p).map((d,h)=>s.jsx(he,{...d},h))]})})})}function Mo({data:e,sx:o}){const t=q(),r=Object.entries(e??{}).map(([n,i])=>({key:n,[n]:i})),a=r.map(({key:n})=>({key:n,dataKey:n,color:t.palette.error.light}));return s.jsx(je,{sx:o,data:r,series:a,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,"dataMax + 100"]},tooltip:{labelFormatter:n=>"Total"},referenceLines:[{y:100,stroke:t.palette.error.dark,strokeDasharray:"3 3",label:s.jsx(fe,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}export{Lo as BigNumber,Mo as ErrorCodesChart,Ao as SeriesChart,Oe as SeriesChartLegend,Do as SeriesPercentageChart,je as SimpleBarChart};
|
1
|
+
"use strict";import{j as a}from"../../shared/jsx-runtime-DHlBLioN.mjs";import*as P from"react";import{useCallback as ee,useMemo as te,createElement as Ie,useState as q,useRef as Pe,useEffect as he}from"react";import{Box as z,Stack as U,Typography as W,useTheme as V,Paper as ze}from"@mui/material";import{ResponsiveContainer as Z,LineChart as Ve,CartesianGrid as ne,XAxis as oe,YAxis as re,Label as xe,Tooltip as ae,Legend as ye,Line as Ge,AreaChart as Ke,Area as We,ComposedChart as Be,ReferenceLine as ve,ReferenceArea as ge,Bar as qe,Sector as be,PieChart as Ue,Pie as Ze,Cell as Ye}from"recharts";import{b as we,c as je}from"../../shared/date-Cq0LS2Mr.mjs";import Y,{Decimal as ie}from"decimal.js";import{AnimatePresence as He}from"framer-motion";import{u as Xe}from"../../shared/useCopyToClipboard-BALOSYVW.mjs";import"qrcode";import{u as se}from"../../shared/usePrevious-DyvR1iCQ.mjs";import{a as Je,C as Oe}from"../../shared/motions-BBPeWBPV.mjs";import{c as ke,i as Qe,_ as H,s as et,a as S,d as tt,e as nt,f as ot,h as rt,j as at,k as it,l as st,m as lt,n as ct,o as ut,p as dt,u as pt}from"../../shared/index-KVVTzcea.mjs";import{u as mt}from"../../shared/useCounter-BV32zXDQ.mjs";const ft=["ownerState"],ht=["variants"],xt=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function yt(e){return Object.keys(e).length===0}function vt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function le(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const gt=ke(),bt=e=>e&&e.charAt(0).toLowerCase()+e.slice(1);function X({defaultTheme:e,theme:t,themeId:n}){return yt(t)?e:t[n]||t}function wt(e){return e?(t,n)=>n[e]:null}function J(e,t){let{ownerState:n}=t,o=H(t,ft);const r=typeof e=="function"?e(S({ownerState:n},o)):e;if(Array.isArray(r))return r.flatMap(s=>J(s,S({ownerState:n},o)));if(r&&typeof r=="object"&&Array.isArray(r.variants)){const{variants:s=[]}=r;let i=H(r,ht);return s.forEach(c=>{let l=!0;typeof c.props=="function"?l=c.props(S({ownerState:n},o,n)):Object.keys(c.props).forEach(d=>{n?.[d]!==c.props[d]&&o[d]!==c.props[d]&&(l=!1)}),l&&(Array.isArray(i)||(i=[i]),i.push(typeof c.style=="function"?c.style(S({ownerState:n},o,n)):c.style))}),i}return r}function jt(e={}){const{themeId:t,defaultTheme:n=gt,rootShouldForwardProp:o=le,slotShouldForwardProp:r=le}=e,s=i=>tt(S({},i,{theme:X(S({},i,{defaultTheme:n,themeId:t}))}));return s.__mui_systemSx=!0,(i,c={})=>{Qe(i,f=>f.filter(k=>!(k!=null&&k.__mui_systemSx)));const{name:l,slot:d,skipVariantsResolver:h,skipSx:x,overridesResolver:u=wt(bt(d))}=c,m=H(c,xt),j=h!==void 0?h:d&&d!=="Root"&&d!=="root"||!1,w=x||!1;let O,y=le;d==="Root"||d==="root"?y=o:d?y=r:vt(i)&&(y=void 0);const b=et(i,S({shouldForwardProp:y,label:O},m)),T=f=>typeof f=="function"&&f.__emotion_real!==f||nt(f)?k=>J(f,S({},k,{theme:X({theme:k.theme,defaultTheme:n,themeId:t})})):f,R=(f,...k)=>{let A=T(f);const $=k?k.map(T):[];l&&u&&$.push(v=>{const g=X(S({},v,{defaultTheme:n,themeId:t}));if(!g.components||!g.components[l]||!g.components[l].styleOverrides)return null;const N=g.components[l].styleOverrides,C={};return Object.entries(N).forEach(([_,L])=>{C[_]=J(L,S({},v,{theme:g}))}),u(v,C)}),l&&!j&&$.push(v=>{var g;const N=X(S({},v,{defaultTheme:n,themeId:t})),C=N==null||(g=N.components)==null||(g=g[l])==null?void 0:g.variants;return J({variants:C},S({},v,{theme:N}))}),w||$.push(s);const E=$.length-k.length;if(Array.isArray(f)&&E>0){const v=new Array(E).fill("");A=[...f,...v],A.raw=[...f.raw,...v]}const p=b(A,...$);return i.muiName&&(p.muiName=i.muiName),p};return b.withConfig&&(R.withConfig=b.withConfig),R}}const Ot=jt(),kt=(e,t)=>e.filter(n=>t.includes(n)),G=(e,t,n)=>{const o=e.keys[0];Array.isArray(t)?t.forEach((r,s)=>{n((i,c)=>{s<=e.keys.length-1&&(s===0?Object.assign(i,c):i[e.up(e.keys[s])]=c)},r)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:kt(e.keys,Object.keys(t))).forEach(r=>{if(e.keys.indexOf(r)!==-1){const s=t[r];s!==void 0&&n((i,c)=>{o===r?Object.assign(i,c):i[e.up(r)]=c},s)}}):(typeof t=="number"||typeof t=="string")&&n((r,s)=>{Object.assign(r,s)},t)};function F(e){return e?`Level${e}`:""}function B(e){return e.unstable_level>0&&e.container}function Se(e){return function(t){return`var(--Grid-${t}Spacing${F(e.unstable_level)})`}}function ce(e){return function(t){return e.unstable_level===0?`var(--Grid-${t}Spacing)`:`var(--Grid-${t}Spacing${F(e.unstable_level-1)})`}}function ue(e){return e.unstable_level===0?"var(--Grid-columns)":`var(--Grid-columns${F(e.unstable_level-1)})`}const St=({theme:e,ownerState:t})=>{const n=Se(t),o={};return G(e.breakpoints,t.gridSize,(r,s)=>{let i={};s===!0&&(i={flexBasis:0,flexGrow:1,maxWidth:"100%"}),s==="auto"&&(i={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof s=="number"&&(i={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${s} / ${ue(t)}${B(t)?` + ${n("column")}`:""})`}),r(o,i)}),o},$t=({theme:e,ownerState:t})=>{const n={};return G(e.breakpoints,t.gridOffset,(o,r)=>{let s={};r==="auto"&&(s={marginLeft:"auto"}),typeof r=="number"&&(s={marginLeft:r===0?"0px":`calc(100% * ${r} / ${ue(t)})`}),o(n,s)}),n},Tt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=B(t)?{[`--Grid-columns${F(t.unstable_level)}`]:ue(t)}:{"--Grid-columns":12};return G(e.breakpoints,t.columns,(o,r)=>{o(n,{[`--Grid-columns${F(t.unstable_level)}`]:r})}),n},Rt=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=ce(t),o=B(t)?{[`--Grid-rowSpacing${F(t.unstable_level)}`]:n("row")}:{};return G(e.breakpoints,t.rowSpacing,(r,s)=>{var i;r(o,{[`--Grid-rowSpacing${F(t.unstable_level)}`]:typeof s=="string"?s:(i=e.spacing)==null?void 0:i.call(e,s)})}),o},At=({theme:e,ownerState:t})=>{if(!t.container)return{};const n=ce(t),o=B(t)?{[`--Grid-columnSpacing${F(t.unstable_level)}`]:n("column")}:{};return G(e.breakpoints,t.columnSpacing,(r,s)=>{var i;r(o,{[`--Grid-columnSpacing${F(t.unstable_level)}`]:typeof s=="string"?s:(i=e.spacing)==null?void 0:i.call(e,s)})}),o},Ct=({theme:e,ownerState:t})=>{if(!t.container)return{};const n={};return G(e.breakpoints,t.direction,(o,r)=>{o(n,{flexDirection:r})}),n},Et=({ownerState:e})=>{const t=Se(e),n=ce(e);return S({minWidth:0,boxSizing:"border-box"},e.container&&S({display:"flex",flexWrap:"wrap"},e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},{margin:`calc(${t("row")} / -2) calc(${t("column")} / -2)`},e.disableEqualOverflow&&{margin:`calc(${t("row")} * -1) 0px 0px calc(${t("column")} * -1)`}),(!e.container||B(e))&&S({padding:`calc(${n("row")} / 2) calc(${n("column")} / 2)`},(e.disableEqualOverflow||e.parentDisableEqualOverflow)&&{padding:`${n("row")} 0px 0px ${n("column")}`}))},Nt=e=>{const t=[];return Object.entries(e).forEach(([n,o])=>{o!==!1&&o!==void 0&&t.push(`grid-${n}-${String(o)}`)}),t},_t=(e,t="xs")=>{function n(o){return o===void 0?!1:typeof o=="string"&&!Number.isNaN(Number(o))||typeof o=="number"&&o>0}if(n(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const o=[];return Object.entries(e).forEach(([r,s])=>{n(s)&&o.push(`spacing-${r}-${String(s)}`)}),o}return[]},Dt=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,n])=>`direction-${t}-${n}`):[`direction-xs-${String(e)}`],Lt=["className","children","columns","container","component","direction","wrap","spacing","rowSpacing","columnSpacing","disableEqualOverflow","unstable_level"],Mt=ke(),Ft=Ot("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,t)=>t.root});function It(e){return st({props:e,name:"MuiGrid",defaultTheme:Mt})}function Pt(e={}){const{createStyledComponent:t=Ft,useThemeProps:n=It,componentName:o="MuiGrid"}=e,r=P.createContext(void 0),s=(l,d)=>{const{container:h,direction:x,spacing:u,wrap:m,gridSize:j}=l,w={root:["root",h&&"container",m!=="wrap"&&`wrap-xs-${String(m)}`,...Dt(x),...Nt(j),...h?_t(u,d.breakpoints.keys[0]):[]]};return lt(w,O=>ct(o,O),{})},i=t(Tt,At,Rt,St,Ct,Et,$t),c=P.forwardRef(function(l,d){var h,x,u,m,j,w,O,y;const b=ot(),T=n(l),R=rt(T),f=P.useContext(r),{className:k,children:A,columns:$=12,container:E=!1,component:p="div",direction:v="row",wrap:g="wrap",spacing:N=0,rowSpacing:C=N,columnSpacing:_=N,disableEqualOverflow:L,unstable_level:M=0}=R,Ne=H(R,Lt);let K=L;M&&L!==void 0&&(K=l.disableEqualOverflow);const de={},pe={},me={};Object.entries(Ne).forEach(([D,I])=>{b.breakpoints.values[D]!==void 0?de[D]=I:b.breakpoints.values[D.replace("Offset","")]!==void 0?pe[D.replace("Offset","")]=I:me[D]=I});const _e=(h=l.columns)!=null?h:M?void 0:$,De=(x=l.spacing)!=null?x:M?void 0:N,Le=(u=(m=l.rowSpacing)!=null?m:l.spacing)!=null?u:M?void 0:C,Me=(j=(w=l.columnSpacing)!=null?w:l.spacing)!=null?j:M?void 0:_,fe=S({},R,{level:M,columns:_e,container:E,direction:v,wrap:g,spacing:De,rowSpacing:Le,columnSpacing:Me,gridSize:de,gridOffset:pe,disableEqualOverflow:(O=(y=K)!=null?y:f)!=null?O:!1,parentDisableEqualOverflow:f}),Fe=s(fe,b);let Q=a.jsx(i,S({ref:d,as:p,ownerState:fe,className:at(Fe.root,k)},me,{children:P.Children.map(A,D=>{if(P.isValidElement(D)&&it(D,["Grid"])){var I;return P.cloneElement(D,{unstable_level:(I=D.props.unstable_level)!=null?I:M+1})}return D})}));return K!==void 0&&K!==(f??!1)&&(Q=a.jsx(r.Provider,{value:K,children:Q})),Q});return c.muiName="Grid",c}const $e=Pt({createStyledComponent:ut("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,t)=>t.root}),componentName:"MuiGrid2",useThemeProps:e=>dt({props:e,name:"MuiGrid2"})});function zt({entry:e,payload:t}){const n=ee(x=>{var u,m,j;return(j=(m=(u=x.payload)==null?void 0:u.data)==null?void 0:m.reduce)==null?void 0:j.call(m,(w,O)=>w+O.value,0)},[]),o=ee(x=>{const u=new ie(n(x)||0),m=t?.reduce((O,y)=>O+n(y),0)||0,j=new ie(m),w=Number(u.div(j).times(100).toFixed(2,ie.ROUND_DOWN));return isNaN(w)||!isFinite(w)?0:w},[n,t]),r=te(()=>n(e),[e,n]),s=se(r),i=te(()=>Number(o(e)),[e,o]),c=se(i),l=ee(x=>Math.floor(x).toLocaleString(),[]),d=Xe({type:"text/plain"}),h=pt();return a.jsxs(Je,{component:"li",direction:"row",spacing:1,sx:{color:e.color},layout:"position",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:[a.jsx(z,{sx:{width:"3px",height:"100%",backgroundColor:e.color,borderRadius:3}}),a.jsxs(U,{children:[a.jsxs(W,{component:"p",variant:"caption",children:[a.jsx(U,{component:"span",display:"inline-flex",mr:.5,children:a.jsx(Oe,{from:s??0,to:r,map:l,children:"0"})}),a.jsxs(U,{component:"span",direction:"row",display:"inline-flex",children:["(",a.jsx(Oe,{from:c??0,to:i,map:l,children:"0"}),"%)"]})]}),a.jsx(W,{variant:"body1",children:e.value}),e.payload.uuid&&a.jsxs(W,{variant:"body2",sx:{cursor:"pointer","&:hover":{textDecoration:"underline"}},onClick:()=>{d.copy(e.payload.uuid).catch(()=>{}),h.enqueueSnackbar("UUID copied to clipboard","success")},children:[e.payload.uuid.slice(0,5),"..."]})]})]})}function Te(e){const{payload:t}=e;return a.jsx($e,{container:!0,direction:"row",component:"ul",gap:2,sx:{mt:2,justifyContent:"flex-start",alignItem:"center",flexWrap:"wrap"},children:a.jsx(He,{children:t?.map(n=>a.jsx($e,{children:a.jsx(zt,{entry:n,payload:t})},`item-${n.value}`))})})}function Vt(e){const t=V();return a.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:a.jsx(Z,{children:a.jsxs(Ve,{width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[a.jsx(ne,{vertical:!1}),a.jsx(oe,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:n=>we(n,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),a.jsx(re,{textAnchor:"end",dataKey:"value",tickLine:!1,tickFormatter:n=>Number(n).toLocaleString(),allowDecimals:!1,domain:[1,"dataMax"],children:e.label&&a.jsx(xe,{value:e.label,angle:-90,position:"insideLeft",style:{textAnchor:"middle"}})}),a.jsx(ae,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},formatter:n=>Number(n).toLocaleString(),labelFormatter:n=>je(n,{timeZone:e.filter.timezone,hour12:!1})}),a.jsx(ye,{content:a.jsx(Te,{})}),e.data.map(n=>Ie(Ge,{uuid:n.uuid,key:n.uuid,name:n.name,dataKey:"value",data:n.chartData,type:"monotone",stroke:n.color,strokeWidth:2}))]})})})}const Gt=(e,t)=>{const n=new Map;return e.forEach(o=>{o.chartData.forEach(r=>{const s=new Date(r.date).getTime().toString();if(!n.has(s)){const i={date:s,total:0,diff:0,totalKey:"",originalTotal:0};t.forEach(({key:c})=>{i[c]=0,i[`${c}_absolute`]=0}),n.set(s,i)}t.forEach(({key:i})=>{const c=n.get(s),l=r[i],d=typeof l=="string"?l.trim()===""?0:parseInt(l,10):typeof l=="number"?l:0;c[`${i}_absolute`]=d,c[i]=0})})}),Array.from(n.values()).map(o=>{var r;const s=(r=t.find(l=>l.isTotal))==null?void 0:r.key,i=t.filter(l=>!l.isTotal).map(l=>l.key);if(!s||i.length===0)return o;const c=o[`${s}_absolute`];return o.originalTotal=c,o.total=c,o[s]=100,i.forEach(l=>{const d=o[`${l}_absolute`],h=c>0?new Y(d.toString()).div(c).mul(100).toFixed(2,Y.ROUND_DOWN):"0.00";o[l]=parseFloat(h)}),{...o,totalKey:s}}).sort((o,r)=>parseInt(o.date)-parseInt(r.date))};function Kt(e){const t=V(),n=te(()=>e.data?Gt(e.data,e.keyValues):[],[e.data,e.keyValues]);return a.jsx(z,{sx:{width:"100%",height:"100%",...e.sx},children:a.jsx(Z,{width:"100%",height:"100%",children:a.jsxs(Ke,{data:n,width:500,height:300,margin:{top:5,right:60,left:20,bottom:5},children:[a.jsx(ne,{strokeDasharray:"3 3"}),a.jsx(oe,{dataKey:"date",type:"number",domain:["dataMin","dataMax"],tickFormatter:o=>we(o,{timeZone:e.filter.timezone,hour12:!1,hour:"numeric"}),allowDuplicatedCategory:!1,tickLine:!1,fontSize:12,tickMargin:12}),a.jsx(re,{textAnchor:"end",tickLine:!1,tickFormatter:o=>`${o.toFixed(2)}%`}),a.jsx(ae,{cursor:{stroke:t.palette.neutral.main,strokeWidth:1},labelFormatter:o=>je(o,{timeZone:e.filter.timezone,hour12:!1}),formatter:(o,r,s)=>{const i=s.payload.totalKey,c=s.dataKey,l=c===i,d=s.payload[`${c}_absolute`],h=s.payload.originalTotal,x=l?null:h===0?"0.00":new Y(d.toString()).div(h).mul(100).toFixed(2,Y.ROUND_DOWN);return[x?`${d.toLocaleString()} (${x}%)`:`${d.toLocaleString()} (TOTAL)`,r]}}),e.keyValues.sort((o,r)=>o.isTotal?-1:r.isTotal?1:0).map(o=>a.jsx(We,{type:"monotone",dataKey:o.key,name:o.name,stroke:o.color,fill:o.color,strokeWidth:2,fillOpacity:.6},o.key))]})})})}function Wt(e){const t=se(e.value),{ref:n}=mt({from:t??0,to:e.value,duration:1,map:e.map});return a.jsx(ze,{sx:{p:3,flex:1,...e.sx},children:a.jsxs(U,{spacing:1,alignItems:"center",children:[a.jsx(W,{ref:n,variant:"h4",fontWeight:"bold",children:e.initialValue}),a.jsx(W,{color:"text.secondary",children:e.label})]})})}const Re={margin:{top:5,right:30,left:20,bottom:5}},Bt={tickLine:!1,fontSize:12,tickMargin:12},qt={textAnchor:"end",tickLine:!1};function Ae({data:e,series:t,xAxis:n,yAxis:o,tooltip:r,bar:s,referenceLines:i,referenceAreas:c,sx:l}){const d=V(),h=u=>!u.isFront,x=u=>!!u.isFront;return a.jsx(z,{sx:{width:"100%",height:"100%",...l},children:a.jsx(Z,{children:a.jsxs(Be,{data:e,...Re,children:[a.jsx(ne,{strokeDasharray:"3 3",vertical:!1}),a.jsx(oe,{...Bt,...n}),a.jsx(re,{...qt,...o}),a.jsx(ae,{cursor:{stroke:d.palette.neutral.main,strokeWidth:1},...r}),i?.filter(h).map((u,m)=>a.jsx(ve,{...u},u.label??m)),c?.filter(h).map((u,m)=>a.jsx(ge,{...u},u.label??m)),t.map(u=>a.jsx(qe,{name:u.key,dataKey:u.dataKey,fill:u.color,stackId:"stack",isAnimationActive:!1,...s},u.key)),i?.filter(x).map((u,m)=>a.jsx(ve,{...u},u.label??m)),c?.filter(x).map((u,m)=>a.jsx(ge,{...u},u.label??m))]})})})}function Ut({data:e,sx:t}){const n=V(),o=Object.entries(e??{}).map(([s,i])=>({key:s,[s]:i})),r=o.map(({key:s})=>({key:s,dataKey:s,color:n.palette.error.light}));return a.jsx(Ae,{sx:t,data:o,series:r,xAxis:{tickLine:!1,dataKey:"key"},yAxis:{tickLine:!1,domain:[0,"dataMax + 100"]},tooltip:{labelFormatter:s=>"Total"},referenceLines:[{y:100,stroke:n.palette.error.dark,strokeDasharray:"3 3",label:a.jsx(xe,{value:"Unhealthy threshold",position:"insideBottomRight"}),isFront:!0}]})}function Ce({payload:e=[],hiddenItems:t,onToggle:n,legendLabel:o}){return a.jsx(z,{sx:{display:"flex",justifyContent:"center",gap:"20px",paddingTop:"20px"},children:e.map((r,s)=>{const i=t.has(r.payload.name);return a.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",opacity:i?.4:1},onClick:()=>{n?.(r.payload)},children:[a.jsx("div",{style:{width:"12px",height:"12px",backgroundColor:r.color,marginRight:"8px",borderRadius:"2px"}}),a.jsx("span",{style:{color:r.color},children:o?`${o}: ${r.value}`:r.value})]},`legend-${s}`)})})}const Zt=e=>{const t=Math.PI/180,{cx:n,cy:o,midAngle:r,innerRadius:s,outerRadius:i,startAngle:c,endAngle:l,fill:d,payload:h,percent:x,value:u,valueText:m,valuePercentage:j,needleVisible:w,customText:O}=e,y=Math.sin(-t*r),b=Math.cos(-t*r),T=n+(i+5)*b,R=o+(i+5)*y,f=n+(i+15)*b,k=o+(i+15)*y,A=f+(b>=0?1:-1)*15,$=k,E=b>=0?"start":"end",p=u.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0});return a.jsxs("g",{children:[!w&&a.jsx("text",{x:n,y:o,dy:8,textAnchor:"middle",fill:"#333",fontSize:14,children:h.name}),a.jsx(be,{cx:n,cy:o,innerRadius:s,outerRadius:i,startAngle:c,endAngle:l,fill:d}),a.jsx(be,{cx:n,cy:o,startAngle:c,endAngle:l,innerRadius:i+2,outerRadius:i+6,fill:d}),a.jsx("path",{d:`M${T},${R}L${f},${k}L${A},${$}`,stroke:d,fill:"none"}),a.jsx("circle",{cx:A,cy:$,r:2,fill:d,stroke:"none"}),a.jsx("text",{x:A+(b>=0?1:-1)*8,y:$,textAnchor:E,fill:"#333",fontSize:12,children:O||(m?`${m} ${p}`:p)}),j&&a.jsxs("text",{x:A+(b>=0?1:-1)*8,y:$,dy:16,textAnchor:E,fill:"#999",fontSize:11,children:[`${(x*100).toFixed(2)}%`," (",p,")"]})]})},Yt=e=>{const{value:t,data:n,color:o,innerRadius:r,outerRadius:s,boxDimensions:i,legendDimensions:c,valueText:l}=e,d=Math.PI/180;let h=0;n.forEach(g=>{h+=g.value});const x=i?i.width/2:150,u=(i?i.height/2:200)-c.height/2,m=180*(1-Math.max(0,Math.min(1,t/h))),j=(Number(r)+2*Number(s))/3,w=Math.sin(-d*m),O=Math.cos(-d*m),y=5,b=x-y,T=u,R=b+y*w,f=T-y*O,k=b-y*w,A=T+y*O,$=b+j*O,E=T+j*w,p=t.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0}),v=l??p;return a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:b,cy:T,r:y,fill:o,stroke:"none",style:{pointerEvents:"none"}},"needle-circle"),a.jsx("path",{d:`M${R} ${f}L${k} ${A} L${$} ${E} L${R} ${f}`,stroke:"none",fill:o,style:{pointerEvents:"none"}},"needle-path"),a.jsx("text",{x:b+y,y:T+26,textAnchor:"middle",fill:"#333",fontSize:12,children:v},"needle-value")]})},Ht=(e,t)=>({Allow:t.palette.success.main,Flag:t.palette.warning.main,Block:t.palette.error.main})[e]??t.palette.primary.main;function Ee({data:e,sx:t,legendLabel:n,legendToggle:o=!1,valueText:r="",valuePercentage:s=!0,pie:i,needleVisible:c=!1,needleValue:l,needleColor:d="#aaa"}){const{innerRadius:h=60,outerRadius:x=100}=i??{},u=V(),[m,j]=q(),[w,O]=q(new Set),y=Pe(null),[b,T]=q(null),[R,f]=q(null),k=(p,v)=>{j(v)},A=()=>{j(void 0)},$=p=>{o&&p&&O(v=>{const g=new Set(v);return g.has(p.name)?g.delete(p.name):g.size<e.length-1&&g.add(p.name),g})},E=e.map(p=>({...p,value:w.has(p.name)?0:p.value}));return he(()=>{const p=y.current;if(!p)return;const v=new ResizeObserver(N=>{var C;const _=(C=N[0])==null?void 0:C.contentRect;_&&T(_)});v.observe(p);const g=p.getBoundingClientRect();return T(g),()=>{v.disconnect()}},[]),he(()=>{var p;const v=(p=y.current)==null?void 0:p.querySelector(".recharts-legend-wrapper");if(!v){const C=setInterval(()=>{var _;const L=(_=y.current)==null?void 0:_.querySelector(".recharts-legend-wrapper");if(L){const M=L.getBoundingClientRect();f(M),clearInterval(C)}},100);return()=>{clearInterval(C)}}const g=new ResizeObserver(C=>{var _;const L=(_=C[0])==null?void 0:_.contentRect;L&&f(L)});g.observe(v);const N=v.getBoundingClientRect();return f(N),()=>{g.disconnect()}},[]),a.jsx(z,{ref:y,sx:{width:"100%",height:"100%","& g":{outline:"none"},...t},children:a.jsx(Z,{children:a.jsxs(Ue,{...Re,children:[a.jsx(Ze,{data:E,nameKey:"name",dataKey:"value",innerRadius:h,outerRadius:x,activeIndex:m,activeShape:p=>Zt({...p,valueText:r,valuePercentage:s,needleVisible:c}),paddingAngle:0,onMouseEnter:k,onMouseLeave:A,...i,children:E.map(p=>a.jsx(Ye,{fill:p.color??Ht(p.name,u),opacity:w.has(p.name)?.5:1,stroke:"none"},p.name))}),a.jsx(ye,{content:a.jsx(Ce,{legendLabel:n,hiddenItems:w,onToggle:$})}),c&&l!==void 0&&b&&R&&Yt({data:E,value:l,color:d,innerRadius:h,outerRadius:x,boxDimensions:b,legendDimensions:R,valueText:r})]})})})}function Xt({sx:e,data:t,score:n=200,legendLabel:o}){const r=V(),s=[{name:"Allow",customText:"0-299",value:t[0].value,color:r.palette.primary.main},{name:"Flag",customText:"300-599",value:t[1].value,color:r.palette.warning.main},{name:"Block",customText:"Over 600",value:t[2].value,color:r.palette.error.main}];return a.jsx(Ee,{data:s,legendToggle:!0,needleValue:n,legendLabel:o,sx:e})}export{Wt as BigNumber,Ut as ErrorCodesChart,Ee as PieChart,Xt as RiskScorePieChart,Vt as SeriesChart,Te as SeriesChartLegend,Kt as SeriesPercentageChart,Ae as SimpleBarChart,Ce as SimpleLegend};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{A as a,c as s,k as e,B as t,l as r,C as n,D as o,f as i,E as p,i as u,F as c,I as m,b as d,L as P,O as l,e as I,P as g,Q as B,R as S,S as h,d as f,j as k,T,g as b,a as y,V as C,h as A}from"../shared/index-
|
1
|
+
"use strict";import{A as a,c as s,k as e,B as t,l as r,C as n,D as o,f as i,E as p,i as u,F as c,I as m,b as d,L as P,O as l,e as I,P as g,Q as B,R as S,S as h,d as f,j as k,T,g as b,a as y,V as C,h as A}from"../shared/index-DPBjdrwv.mjs";import{a as L,b as D,P as E,S as N}from"../shared/PageSectionHeader-DdpDhBZG.mjs";import{C as R,W as v,u as x}from"../shared/index-KVVTzcea.mjs";import{SnackbarProvider as H}from"notistack";export{a as AcceptTermsNotice,s as Alert,e as Backdrop,t as Banner,r as Button,n as CredentialRequestsEditor,R as CustomAlertComponent,o as DateInput,i as DateRangeInput,p as EmailInput,u as ExactBirthdayBanner,c as FullWidthAlert,m as Image,d as LegalLink,P as LinkButton,l as OTPInput,L as PageHeader,D as PageSectionHeader,E as Paragraph,I as PhoneInput,g as PrivacyPolicyNotice,B as QRCodeDisplay,S as ResendPhoneBanner,h as SSNInput,N as SectionHeader,f as SelectInput,H as SnackbarProvider,k as TestPhoneNumbersBanner,T as TextButton,b as TimezoneInput,y as Typography,C as VerifiedImage,A as VerifiedIncLogo,v as When,x as useSnackbar};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{a,b as e,P as r,S as s}from"../../shared/PageSectionHeader-
|
1
|
+
"use strict";import{a,b as e,P as r,S as s}from"../../shared/PageSectionHeader-DdpDhBZG.mjs";export{a as PageHeader,e as PageSectionHeader,r as Paragraph,s as SectionHeader};
|
package/dist/index.mjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{A as e,c as t,k as r,B as o,l as n,C as i,D as m,f as u,E as l,i as c,F as d,I as p,b as h,L as g,O as S,e as f,P,Q as k,R as y,S as C,d as D,j as b,T as B,g as I,a as T,V as w,h as N,m as R,n as v,o as Y,q as x,p as A,s as G,v as L}from"./shared/index-
|
1
|
+
"use strict";import{A as e,c as t,k as r,B as o,l as n,C as i,D as m,f as u,E as l,i as c,F as d,I as p,b as h,L as g,O as S,e as f,P,Q as k,R as y,S as C,d as D,j as b,T as B,g as I,a as T,V as w,h as N,m as R,n as v,o as Y,q as x,p as A,s as G,v as L}from"./shared/index-DPBjdrwv.mjs";import{a as M,b as W,P as E,S as O}from"./shared/PageSectionHeader-DdpDhBZG.mjs";import{C as F,W as U,u as V}from"./shared/index-KVVTzcea.mjs";import{b as q,d as H,a as Q,j,u as z,e as X,c as Z,f as _,g as $,h as J,i as K}from"./shared/useIntersectionObserver-CbpWuEs0.mjs";import{u as aa}from"./shared/useCopyToClipboard-BALOSYVW.mjs";import{a as sa,u as ea}from"./shared/useOnClickOutside-P5GTcgh8.mjs";import{u as ta}from"./shared/useCounter-BV32zXDQ.mjs";import{u as ra}from"./shared/usePrevious-DyvR1iCQ.mjs";import{b as oa,a as na,v as ia,e as ma,d as ua,p as la,u as ca,h as da,j as pa,g as ha,o as ga,s as Sa,m as fa,c as Pa,l as ka,n as ya,q as Ca,f as Da,i as ba,r as Ba,z as Ia,t as Ta,x as wa,k as Na,w as Ra,y as va}from"./shared/shadows-Dhd7FrwF.mjs";import{f as Ya,b as xa,a as Aa,c as Ga}from"./shared/date-Cq0LS2Mr.mjs";import{masks as La}from"./utils/masks/index.mjs";import{M as Ma,S as Wa,U as Ea,d as Oa,e as Fa,f as Ua,g as Va,a as qa,s as Ha}from"./shared/unix.schema-CMYTtXco.mjs";import{p as Qa}from"./shared/phone.schema-XBbyizhq.mjs";import{SnackbarProvider as ja}from"notistack";async function za(a){try{return[await a,null]}catch(s){return[null,s]}}const Xa=a=>a.replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{e as AcceptTermsNotice,t as Alert,r as Backdrop,o as Banner,n as Button,i as CredentialRequestsEditor,F as CustomAlertComponent,m as DateInput,u as DateRangeInput,l as EmailInput,c as ExactBirthdayBanner,d as FullWidthAlert,p as Image,h as LegalLink,g as LinkButton,Ma as MaskedAndUnmaskedSSNSchema,S as OTPInput,M as PageHeader,W as PageSectionHeader,E as Paragraph,f as PhoneInput,P as PrivacyPolicyNotice,k as QRCodeDisplay,y as ResendPhoneBanner,C as SSNInput,Wa as SSNSchema,O as SectionHeader,D as SelectInput,ja as SnackbarProvider,b as TestPhoneNumbersBanner,B as TextButton,I as TimezoneInput,T as Typography,Ea as USDateSchema,w as VerifiedImage,N as VerifiedIncLogo,U as When,oa as black,na as blue,ia as colors,R as countries,ma as darkBlue,ua as darkGreen,la as darkGrey,ca as darkGreyContrast,da as darkRed,pa as darkYellow,Oa as descriptionSchema,Fa as emailSchema,Ua as fieldSchema,Ya as formatDateMMDDYYYY,xa as formatDateMMYY,Aa as formatDateToTimestamp,Ga as formatExtendedDate,Va as getDateSchemaWithPastValidation,v as getPhoneData,Y as getPhoneDataByFieldName,qa as getUnixSchema,ha as green,ga as grey,Sa as greyContrast,fa as infoContrast,Pa as lightBlue,ka as lightGreen,ya as lightGrey,Ca as lightGreyContrast,Da as lightRed,ba as lightYellow,La as masks,x as omitProperties,A as parseToPhoneNational,Qa as phoneSchema,Ba as red,Ia as shadows,G as sortByCountryName,Xa as ssnFormatter,Ha as stateSchema,Ta as textDisabled,wa as theme,q as useCallbackRef,aa as useCopyToClipboard,ta as useCounter,H as useDebounceValue,Q as useDisclosure,j as useIntersectionObserver,z as useLocalStorage,sa as useOnClickOutside,ra as usePrevious,ea as useQRCode,X as useScript,Z as useSearchParams,V as useSnackbar,_ as useThrottle,$ as useToggle,J as useWindowScroll,K as useWindowSize,L as validatePhone,Na as warningContrast,Ra as white,za as wrapPromise,va as yellow};
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";import{j as t}from"./jsx-runtime-
|
1
|
+
"use strict";import{j as t}from"./jsx-runtime-DHlBLioN.mjs";import{Typography as n,Box as r,Stack as o}from"@mui/material";const a=({children:i,sx:e,...s})=>t.jsx(n,{variant:"body1",textAlign:"center",width:"100%",marginTop:2,sx:{...e,wordBreak:"break-word"},...s,children:i}),c=({children:i,...e})=>t.jsx(n,{variant:"h2",textAlign:"center",fontWeight:900,...e,children:i});function h(i){return t.jsxs(r,{sx:{mt:6.25},children:[t.jsxs(o,{direction:"row",alignItems:"center",spacing:1,sx:{"& button":{marginTop:"4px!important"}},children:[t.jsx(n,{variant:"h3",fontSize:50,fontWeight:"800",children:i.title}),i.titleRightChildren]}),!!i.description&&t.jsx(n,{variant:"h4",fontSize:30,fontWeight:"700",color:"text.disabled",children:i.description})]})}function d(i){return t.jsxs(r,{children:[t.jsxs(o,{direction:"row",alignItems:"center",spacing:1,children:[t.jsx(n,{variant:"h4",fontSize:34,fontWeight:"900",children:i.title}),i.titleRightChildren]}),!!i.description&&t.jsx(n,{variant:"h5",fontSize:24,fontWeight:"400",children:i.description})]})}export{a as P,c as S,h as a,d as b};
|