@ssa-ui-kit/core 2.2.2 → 2.3.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,23 @@
1
+ import { ResponsiveTreeMap } from '@nivo/treemap';
2
+ import React from 'react';
3
+ import { WidgetCardProps } from '../../WidgetCard';
4
+ export type TreeNode = {
5
+ name: string;
6
+ value?: number;
7
+ children?: TreeNode[];
8
+ };
9
+ export type TreeMapChartFeature = 'header' | 'fullscreenMode';
10
+ type NivoTreeMapChartProps = React.ComponentProps<typeof ResponsiveTreeMap>;
11
+ export interface TreeMapChartProps extends Omit<NivoTreeMapChartProps, 'data'> {
12
+ data: TreeNode;
13
+ title?: string;
14
+ fullScreen?: boolean;
15
+ features?: TreeMapChartFeature[];
16
+ widgetCardProps?: WidgetCardProps;
17
+ }
18
+ export declare const TreeMapChartComponent: ({ data, title, widgetCardProps, features, ...treeMapProps }: TreeMapChartProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ export declare const TreeMapChart: {
20
+ (props: TreeMapChartProps): import("@emotion/react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ export {};
@@ -0,0 +1,8 @@
1
+ import { TreeMapChartFeature } from './TreeMapChart';
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 TreeMapChartHeaderProps {
6
+ features: TreeMapChartFeature[];
7
+ }
8
+ export declare const TreeMapChartHeader: ({ features }: TreeMapChartHeaderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { TooltipProps } from '@nivo/treemap';
2
+ export declare const TreeMapChartTooltip: ({ node }: TooltipProps<object>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './TreeMapChart';
@@ -1,5 +1,6 @@
1
1
  export * from './PieChart';
2
2
  export * from './SegmentedPieChart';
3
3
  export * from './BarLineComplexChart';
4
+ export * from './TreeMapChart';
4
5
  export * from './common';
5
6
  export * from './hooks';
@@ -1,4 +1,11 @@
1
- import { PieChartProps } from '../Charts/PieChart';
2
- export declare const WithWidgetCard: ({ children, features, cardProps, }: {
1
+ import React from 'react';
2
+ import { WidgetCardProps } from './types';
3
+ type Has<T extends string, U extends string> = Exclude<U, T> extends never ? true : false;
4
+ type MustIncludeHeader<T extends readonly string[]> = Has<T[number], 'header'> extends true ? T : never;
5
+ export type WithWidgetCardProps<F extends string[]> = {
3
6
  children: React.ReactNode;
4
- } & Pick<PieChartProps, "features" | "cardProps">) => string | number | boolean | Iterable<import("react").ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element | null | undefined;
7
+ features?: MustIncludeHeader<F>;
8
+ cardProps?: WidgetCardProps;
9
+ };
10
+ export declare function WithWidgetCard<F extends string[]>({ children, features, cardProps, }: WithWidgetCardProps<F>): import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export {};
package/dist/index.js CHANGED
@@ -199,6 +199,8 @@ __webpack_require__.d(__webpack_exports__, {
199
199
  TooltipTrigger: () => (/* reexport */ TooltipTrigger_TooltipTrigger),
200
200
  TranslationContext: () => (/* reexport */ TranslationContext),
201
201
  TranslationProvider: () => (/* reexport */ TranslationProvider),
202
+ TreeMapChart: () => (/* reexport */ TreeMapChart),
203
+ TreeMapChartComponent: () => (/* reexport */ TreeMapChartComponent),
202
204
  Typeahead: () => (/* reexport */ Typeahead),
203
205
  TypeaheadItemIcon: () => (/* reexport */ TypeaheadItemIcon),
204
206
  TypeaheadItemImage: () => (/* reexport */ TypeaheadItemImage),
@@ -1111,6 +1113,8 @@ const main = {
1111
1113
  // #4178e1
1112
1114
  blue20: 'rgba(65, 120, 225, 0.2)',
1113
1115
  // #4178e1
1116
+ blueCool: 'rgba(108, 148, 247, 1)',
1117
+ // #6c94f7
1114
1118
  blueDark: 'rgba(36, 101, 227, 1)',
1115
1119
  // #2465e3
1116
1120
  blueLightDarker: 'rgba(127, 159, 221)',
@@ -1157,6 +1161,8 @@ const main = {
1157
1161
  //#487DE1
1158
1162
  blueRoyal12: 'rgba(72, 125, 225, 0.12)',
1159
1163
  //#487DE1
1164
+ cyanTeal: 'rgba(85, 214, 210, 1)',
1165
+ //#55D6D2
1160
1166
  dangerShades300: 'rgb(253, 128, 122)',
1161
1167
  //#FD807A
1162
1168
  dangerShades500: 'rgb(223, 90, 96)',
@@ -5891,14 +5897,21 @@ const WidgetCard = ({
5891
5897
  ;// ./src/components/WidgetCard/WithWidgetCard.tsx
5892
5898
 
5893
5899
 
5894
- const WithWidgetCard = ({
5900
+
5901
+ // `Has<T, U>` = `true` if every string in `U` also appears in `T`.
5902
+
5903
+ function WithWidgetCard({
5895
5904
  children,
5896
5905
  features = [],
5897
5906
  cardProps = {}
5898
- }) => features && features.includes('header') ? (0,jsx_runtime_namespaceObject.jsx)(WidgetCard, {
5899
- ...cardProps,
5900
- children: children
5901
- }) : children;
5907
+ }) {
5908
+ return features && features.includes('header') ? (0,jsx_runtime_namespaceObject.jsx)(WidgetCard, {
5909
+ ...cardProps,
5910
+ children: children
5911
+ }) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
5912
+ children: children
5913
+ });
5914
+ }
5902
5915
  ;// ./src/components/Charts/PieChart/PieChartBases.tsx
5903
5916
 
5904
5917
  function PieChartBases_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)."; }
@@ -13038,8 +13051,8 @@ const WithPagination = Component => {
13038
13051
 
13039
13052
  ;// ./src/components/Charts/PieChart/colorPalettes.ts
13040
13053
  const getBalancePalette = theme => {
13041
- const legendColorNames = ['yellow', 'blue', 'green', 'yellowWarm', 'blueLight', 'turquoise', 'pink', 'purple', '#6C94F7', '#55D6D2'];
13042
- const pieChartColors = [theme.colors.yellow, theme.colors.blue, theme.colors.green, theme.colors.yellowLighter, theme.colors.blueLight, theme.colors.turquoise, theme.colors.pink, theme.colors.purple, '#6C94F7', '#55D6D2'];
13054
+ const legendColorNames = ['yellow', 'blue', 'green', 'yellowWarm', 'blueLight', 'turquoise', 'pink', 'purple', 'blueCool', 'cyanTeal'];
13055
+ const pieChartColors = [theme.colors.yellow, theme.colors.blue, theme.colors.green, theme.colors.yellowLighter, theme.colors.blueLight, theme.colors.turquoise, theme.colors.pink, theme.colors.purple, theme.colors.blueCool, theme.colors.cyanTeal];
13043
13056
  return {
13044
13057
  legendColorNames,
13045
13058
  pieChartColors
@@ -14222,6 +14235,149 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
14222
14235
  ;// ./src/components/Charts/BarLineComplexChart/index.ts
14223
14236
 
14224
14237
 
14238
+ ;// external "@nivo/treemap"
14239
+ const treemap_namespaceObject = require("@nivo/treemap");
14240
+ ;// ./src/components/Charts/TreeMapChart/TreeMapChartHeader.tsx
14241
+
14242
+ function TreeMapChartHeader_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)."; }
14243
+
14244
+
14245
+
14246
+
14247
+ const FullScreenButton = /*#__PURE__*/base_default()(Button_Button, true ? {
14248
+ target: "e1nxcyi20"
14249
+ } : 0)("height:auto;padding:0;background:none;box-shadow:none;&:hover,&:focus{background:none;box-shadow:none;&::before{display:none;}}&:hover{svg path{fill:", ({
14250
+ theme
14251
+ }) => theme.colors.greyDarker, ";}}" + ( true ? "" : 0));
14252
+ var TreeMapChartHeader_ref = true ? {
14253
+ name: "1pqzlpx",
14254
+ styles: "width:auto;margin-left:auto"
14255
+ } : 0;
14256
+ var TreeMapChartHeader_ref2 = true ? {
14257
+ name: "e0dnmk",
14258
+ styles: "cursor:pointer"
14259
+ } : 0;
14260
+ const TreeMapChartHeader = ({
14261
+ features
14262
+ }) => {
14263
+ const {
14264
+ isFullscreenMode,
14265
+ toggleFullscreenMode
14266
+ } = useFullscreenMode();
14267
+ const theme = (0,react_namespaceObject.useTheme)();
14268
+ return (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
14269
+ css: TreeMapChartHeader_ref,
14270
+ children: features.includes('fullscreenMode') && (0,jsx_runtime_namespaceObject.jsx)(FullScreenButton, {
14271
+ variant: "tertiary",
14272
+ onClick: toggleFullscreenMode,
14273
+ children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
14274
+ name: isFullscreenMode ? 'cross' : 'maximize',
14275
+ css: TreeMapChartHeader_ref2,
14276
+ tooltip: isFullscreenMode ? 'Close' : 'Maximize',
14277
+ size: 18,
14278
+ color: theme.colors.greyFilterIcon
14279
+ })
14280
+ })
14281
+ });
14282
+ };
14283
+ ;// ./src/components/Charts/TreeMapChart/TreeMapChartTooltip.tsx
14284
+
14285
+ function TreeMapChartTooltip_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)."; }
14286
+
14287
+ const TreeMapChartTooltip_Tooltip = /*#__PURE__*/base_default()("div", true ? {
14288
+ target: "eikatys0"
14289
+ } : 0)("background-color:", ({
14290
+ theme
14291
+ }) => theme.colors.white, ";border:1px solid ", ({
14292
+ theme
14293
+ }) => theme.colors.green20, ";border-radius:4px;font-size:12px;font-weight:500;padding:4px 8px;display:flex;gap:5px;" + ( true ? "" : 0));
14294
+ var TreeMapChartTooltip_ref = true ? {
14295
+ name: "1j389vi",
14296
+ styles: "font-weight:700"
14297
+ } : 0;
14298
+ const TreeMapChartTooltip = ({
14299
+ node
14300
+ }) => {
14301
+ return (0,jsx_runtime_namespaceObject.jsxs)(TreeMapChartTooltip_Tooltip, {
14302
+ children: [(0,jsx_runtime_namespaceObject.jsx)("span", {
14303
+ children: node.id
14304
+ }), (0,jsx_runtime_namespaceObject.jsx)("span", {
14305
+ css: TreeMapChartTooltip_ref,
14306
+ children: node.formattedValue
14307
+ })]
14308
+ });
14309
+ };
14310
+ ;// ./src/components/Charts/TreeMapChart/TreeMapChart.tsx
14311
+ function TreeMapChart_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)."; }
14312
+
14313
+
14314
+
14315
+
14316
+
14317
+
14318
+
14319
+
14320
+ var TreeMapChart_ref = true ? {
14321
+ name: "1qkt16r",
14322
+ styles: "position:relative;height:100%;width:100%"
14323
+ } : 0;
14324
+ var TreeMapChart_ref2 = true ? {
14325
+ name: "19s8nj4",
14326
+ styles: "position:absolute;width:100%;height:100%"
14327
+ } : 0;
14328
+ const TreeMapChartComponent = ({
14329
+ data,
14330
+ title,
14331
+ widgetCardProps,
14332
+ features = [],
14333
+ ...treeMapProps
14334
+ }) => {
14335
+ const theme = (0,react_namespaceObject.useTheme)();
14336
+ const colors = [theme.colors.purple, theme.colors.blue, theme.colors.blueLight, theme.colors.turquoise, theme.colors.green, theme.colors.yellowLighter, theme.colors.yellow, theme.colors.pink, theme.colors.blueCool, theme.colors.cyanTeal];
14337
+ return (0,jsx_runtime_namespaceObject.jsx)(WithWidgetCard, {
14338
+ features: features,
14339
+ cardProps: {
14340
+ title,
14341
+ headerContent: (0,jsx_runtime_namespaceObject.jsx)(TreeMapChartHeader, {
14342
+ features: features
14343
+ }),
14344
+ ...widgetCardProps
14345
+ },
14346
+ children: (0,jsx_runtime_namespaceObject.jsx)("div", {
14347
+ css: TreeMapChart_ref,
14348
+ children: (0,jsx_runtime_namespaceObject.jsx)("div", {
14349
+ css: TreeMapChart_ref2,
14350
+ children: (0,jsx_runtime_namespaceObject.jsx)(treemap_namespaceObject.ResponsiveTreeMap, {
14351
+ borderWidth: 0,
14352
+ colors: colors,
14353
+ data: data,
14354
+ identity: "name",
14355
+ innerPadding: 4,
14356
+ label: node => `${node.id} (${node.formattedValue})`,
14357
+ labelSkipSize: 10,
14358
+ labelTextColor: theme.colors.white,
14359
+ parentLabelTextColor: theme.colors.white,
14360
+ leavesOnly: true,
14361
+ nodeOpacity: 1,
14362
+ theme: {
14363
+ labels: {
14364
+ text: {
14365
+ fontSize: 14,
14366
+ fontWeight: 600
14367
+ }
14368
+ }
14369
+ },
14370
+ tooltip: TreeMapChartTooltip,
14371
+ value: "value",
14372
+ ...treeMapProps
14373
+ })
14374
+ })
14375
+ })
14376
+ });
14377
+ };
14378
+ const TreeMapChart = WithFullscreenMode(TreeMapChartComponent);
14379
+ ;// ./src/components/Charts/TreeMapChart/index.ts
14380
+
14225
14381
  ;// ./src/components/Charts/common/index.ts
14226
14382
 
14227
14383
  ;// ./src/components/Charts/hooks/index.ts
@@ -14232,6 +14388,7 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
14232
14388
 
14233
14389
 
14234
14390
 
14391
+
14235
14392
  ;// ./src/components/Popover/hooks/index.ts
14236
14393
 
14237
14394