@ssa-ui-kit/core 2.2.1 → 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,3 +1,3 @@
1
1
  import { NestedTableRowContextType } from './types';
2
2
  export declare const NestedTableRowContext: import("react").Context<NestedTableRowContextType>;
3
- export declare const NestedTableRowProvider: ({ children, isCollapsed: isCollapsedInput, isSubHeader: isSubHeaderInput, childRowsCount: childRowsCountInput, }: React.PropsWithChildren<NestedTableRowContextType>) => import("@emotion/react/jsx-runtime").JSX.Element;
3
+ export declare const NestedTableRowProvider: ({ children, isCollapsed, isSubHeader: isSubHeaderInput, childRowsCount: childRowsCountInput, setIsCollapsed, }: React.PropsWithChildren<NestedTableRowContextType>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,5 +1,7 @@
1
+ import { Dispatch, SetStateAction } from 'react';
1
2
  export type NestedTableRowContextType = {
2
3
  isCollapsed: boolean;
3
4
  isSubHeader: boolean;
4
5
  childRowsCount: number;
6
+ setIsCollapsed: Dispatch<SetStateAction<boolean>>;
5
7
  };
@@ -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)."; }
@@ -12277,20 +12290,20 @@ const LinksTabBar = ({
12277
12290
  const NestedTableRowContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({
12278
12291
  childRowsCount: 0,
12279
12292
  isCollapsed: false,
12280
- isSubHeader: false
12293
+ isSubHeader: false,
12294
+ setIsCollapsed: () => {
12295
+ // no-op
12296
+ }
12281
12297
  });
12282
12298
  const NestedTableRowProvider = ({
12283
12299
  children,
12284
- isCollapsed: isCollapsedInput,
12300
+ isCollapsed,
12285
12301
  isSubHeader: isSubHeaderInput,
12286
- childRowsCount: childRowsCountInput
12302
+ childRowsCount: childRowsCountInput,
12303
+ setIsCollapsed
12287
12304
  }) => {
12288
- const [isCollapsed, setIsCollapsed] = (0,external_react_namespaceObject.useState)(isCollapsedInput);
12289
12305
  const [isSubHeader, setIsSubHeader] = (0,external_react_namespaceObject.useState)(isSubHeaderInput);
12290
12306
  const [childRowsCount, setChildRowsCount] = (0,external_react_namespaceObject.useState)(childRowsCountInput);
12291
- (0,external_react_namespaceObject.useEffect)(() => {
12292
- setIsCollapsed(isCollapsedInput);
12293
- }, [isCollapsedInput]);
12294
12307
  (0,external_react_namespaceObject.useEffect)(() => {
12295
12308
  setIsSubHeader(isSubHeaderInput);
12296
12309
  }, [isSubHeaderInput]);
@@ -12300,6 +12313,7 @@ const NestedTableRowProvider = ({
12300
12313
  return (0,jsx_runtime_namespaceObject.jsx)(NestedTableRowContext.Provider, {
12301
12314
  value: {
12302
12315
  isCollapsed,
12316
+ setIsCollapsed,
12303
12317
  isSubHeader,
12304
12318
  childRowsCount
12305
12319
  },
@@ -12405,11 +12419,20 @@ const NestedTableRow = ({
12405
12419
  const theme = (0,react_namespaceObject.useTheme)();
12406
12420
  const {
12407
12421
  isCollapsed,
12408
- isSubHeader
12422
+ isSubHeader,
12423
+ childRowsCount,
12424
+ setIsCollapsed
12409
12425
  } = useNestedTableRowContext();
12410
12426
  const headerCSS = isSubHeader ? {
12411
12427
  background: theme.colors.greyLighter60
12412
12428
  } : {};
12429
+ const classNames = [];
12430
+ if (isSubHeader) {
12431
+ classNames.push('first-row');
12432
+ }
12433
+ if (isCollapsed) {
12434
+ classNames.push('collapsed');
12435
+ }
12413
12436
  const notSubHeaderCSS = !isSubHeader && isCollapsed ? {
12414
12437
  maxHeight: 0,
12415
12438
  padding: 0,
@@ -12418,11 +12441,18 @@ const NestedTableRow = ({
12418
12441
  padding: 0
12419
12442
  }
12420
12443
  } : {};
12444
+ const handleClick = () => {
12445
+ if (childRowsCount > 1 && isSubHeader) {
12446
+ setIsCollapsed(currentState => !currentState);
12447
+ }
12448
+ };
12421
12449
  return (0,jsx_runtime_namespaceObject.jsxs)(TableRow_TableRow, {
12422
12450
  css: /*#__PURE__*/(0,react_namespaceObject.css)({
12423
12451
  ...headerCSS,
12424
12452
  ...notSubHeaderCSS
12425
12453
  }, true ? "" : 0, true ? "" : 0),
12454
+ onClick: handleClick,
12455
+ className: classNames.join(' '),
12426
12456
  ...props,
12427
12457
  children: [(0,jsx_runtime_namespaceObject.jsx)(NestedTableCellSubHeader, {
12428
12458
  isHeader: isHeader,
@@ -12448,25 +12478,12 @@ const WithNestedTableRow = ({
12448
12478
  return external_react_namespaceObject.Children.map(children, (child, index) => {
12449
12479
  if (/*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(child)) {
12450
12480
  const isSubHeader = index === 0;
12451
- const classNames = [];
12452
- if (isSubHeader) {
12453
- classNames.push('first-row');
12454
- }
12455
- if (isCollapsed) {
12456
- classNames.push('collapsed');
12457
- }
12458
12481
  return (0,jsx_runtime_namespaceObject.jsx)(NestedTableRowProvider, {
12459
12482
  isCollapsed: isCollapsed,
12483
+ setIsCollapsed: setIsCollapsed,
12460
12484
  isSubHeader: isSubHeader,
12461
12485
  childRowsCount: childRowsCount,
12462
- children: /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(child, {
12463
- className: classNames.length > 0 ? classNames.join(' ') : undefined,
12464
- isCollapsed,
12465
- childRowsCount,
12466
- onClick: childRowsCount > 1 ? () => {
12467
- setIsCollapsed(currentState => !currentState);
12468
- } : undefined
12469
- })
12486
+ children: /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(child)
12470
12487
  });
12471
12488
  }
12472
12489
  });
@@ -13034,8 +13051,8 @@ const WithPagination = Component => {
13034
13051
 
13035
13052
  ;// ./src/components/Charts/PieChart/colorPalettes.ts
13036
13053
  const getBalancePalette = theme => {
13037
- const legendColorNames = ['yellow', 'blue', 'green', 'yellowWarm', 'blueLight', 'turquoise', 'pink', 'purple', '#6C94F7', '#55D6D2'];
13038
- 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];
13039
13056
  return {
13040
13057
  legendColorNames,
13041
13058
  pieChartColors
@@ -14218,6 +14235,149 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
14218
14235
  ;// ./src/components/Charts/BarLineComplexChart/index.ts
14219
14236
 
14220
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
+
14221
14381
  ;// ./src/components/Charts/common/index.ts
14222
14382
 
14223
14383
  ;// ./src/components/Charts/hooks/index.ts
@@ -14228,6 +14388,7 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
14228
14388
 
14229
14389
 
14230
14390
 
14391
+
14231
14392
  ;// ./src/components/Popover/hooks/index.ts
14232
14393
 
14233
14394