@bundle-stats/ui 4.2.4 → 4.2.5-beta.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.
Files changed (127) hide show
  1. package/globals.d.ts +4 -0
  2. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +13 -5
  3. package/lib/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
  4. package/lib/components/index.js +3 -3
  5. package/lib/components/index.js.map +1 -1
  6. package/lib/components/insight-icon/insight-icon.js.map +1 -1
  7. package/lib/components/insights/insights.js.map +1 -1
  8. package/lib/components/metric/index.js.map +1 -1
  9. package/lib/components/metric/metric.js +7 -64
  10. package/lib/components/metric/metric.js.map +1 -1
  11. package/lib/components/metric/metric.module.css +2 -2
  12. package/lib/components/{summary-item → metric-run-info}/index.js +1 -1
  13. package/lib/components/metric-run-info/index.js.map +1 -0
  14. package/lib/components/metric-run-info/metric-run-info.js +45 -0
  15. package/lib/components/metric-run-info/metric-run-info.js.map +1 -0
  16. package/lib/components/{summary-item/summary-item.module.css → metric-run-info/metric-run-info.module.css} +0 -18
  17. package/lib/components/summary/index.js.map +1 -1
  18. package/lib/components/summary/summary.js +50 -30
  19. package/lib/components/summary/summary.js.map +1 -1
  20. package/lib/components/summary/summary.module.css +19 -0
  21. package/lib/constants.js +1 -23
  22. package/lib/constants.js.map +1 -1
  23. package/lib/layout/box/box.js +2 -2
  24. package/lib/layout/box/box.js.map +1 -1
  25. package/lib/layout/flex-stack/flex-stack.js +3 -19
  26. package/lib/layout/flex-stack/flex-stack.js.map +1 -1
  27. package/lib/layout/flex-stack/index.js.map +1 -1
  28. package/lib/layout/stack/stack.js +3 -3
  29. package/lib/layout/stack/stack.js.map +1 -1
  30. package/lib/tokens.js +26 -0
  31. package/lib/tokens.js.map +1 -0
  32. package/lib/ui/container/container.js.map +1 -1
  33. package/lib/ui/tooltip/index.js.map +1 -1
  34. package/lib/ui/tooltip/tooltip.js +2 -22
  35. package/lib/ui/tooltip/tooltip.js.map +1 -1
  36. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +12 -6
  37. package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js.map +1 -1
  38. package/lib-esm/components/index.js +1 -1
  39. package/lib-esm/components/index.js.map +1 -1
  40. package/lib-esm/components/insight-icon/insight-icon.js.map +1 -1
  41. package/lib-esm/components/insights/insights.js.map +1 -1
  42. package/lib-esm/components/metric/index.js.map +1 -1
  43. package/lib-esm/components/metric/metric.js +7 -41
  44. package/lib-esm/components/metric/metric.js.map +1 -1
  45. package/lib-esm/components/metric/metric.module.css +2 -2
  46. package/lib-esm/components/metric-run-info/index.js +2 -0
  47. package/lib-esm/components/metric-run-info/index.js.map +1 -0
  48. package/lib-esm/components/metric-run-info/metric-run-info.js +38 -0
  49. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -0
  50. package/lib-esm/components/{summary-item/summary-item.module.css → metric-run-info/metric-run-info.module.css} +0 -18
  51. package/lib-esm/components/summary/index.js.map +1 -1
  52. package/lib-esm/components/summary/summary.js +27 -30
  53. package/lib-esm/components/summary/summary.js.map +1 -1
  54. package/lib-esm/components/summary/summary.module.css +19 -0
  55. package/lib-esm/constants.js +0 -22
  56. package/lib-esm/constants.js.map +1 -1
  57. package/lib-esm/layout/box/box.js +1 -1
  58. package/lib-esm/layout/box/box.js.map +1 -1
  59. package/lib-esm/layout/flex-stack/flex-stack.js +3 -19
  60. package/lib-esm/layout/flex-stack/flex-stack.js.map +1 -1
  61. package/lib-esm/layout/flex-stack/index.js.map +1 -1
  62. package/lib-esm/layout/stack/stack.js +1 -1
  63. package/lib-esm/layout/stack/stack.js.map +1 -1
  64. package/lib-esm/tokens.js +23 -0
  65. package/lib-esm/tokens.js.map +1 -0
  66. package/lib-esm/ui/container/container.js.map +1 -1
  67. package/lib-esm/ui/tooltip/index.js.map +1 -1
  68. package/lib-esm/ui/tooltip/tooltip.js +2 -22
  69. package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
  70. package/package.json +7 -6
  71. package/src/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +23 -15
  72. package/src/components/index.js +1 -1
  73. package/src/components/insight-icon/insight-icon.tsx +0 -2
  74. package/src/components/insights/insights.tsx +0 -1
  75. package/src/components/metric/metric.module.css +2 -2
  76. package/src/components/metric/metric.stories.tsx +41 -0
  77. package/src/components/metric/metric.tsx +42 -0
  78. package/src/components/metric-run-info/index.ts +1 -0
  79. package/src/components/{summary-item/summary-item.module.css → metric-run-info/metric-run-info.module.css} +0 -18
  80. package/src/components/metric-run-info/metric-run-info.stories.tsx +49 -0
  81. package/src/components/metric-run-info/metric-run-info.tsx +101 -0
  82. package/src/components/summary/summary.module.css +19 -0
  83. package/src/components/summary/summary.stories.tsx +56 -0
  84. package/src/components/summary/summary.tsx +124 -0
  85. package/src/constants.js +0 -24
  86. package/src/layout/box/box.tsx +11 -8
  87. package/src/layout/flex-stack/flex-stack.stories.tsx +59 -0
  88. package/src/layout/flex-stack/flex-stack.tsx +43 -0
  89. package/src/layout/stack/stack.jsx +1 -1
  90. package/src/tokens.ts +23 -0
  91. package/src/ui/container/container.tsx +0 -1
  92. package/src/ui/tooltip/tooltip.stories.tsx +30 -0
  93. package/src/ui/tooltip/tooltip.tsx +56 -0
  94. package/types/components/index.d.ts +1 -1
  95. package/types/components/metric/index.d.ts +1 -1
  96. package/types/components/metric/metric.d.ts +6 -32
  97. package/types/components/metric-run-info/index.d.ts +1 -0
  98. package/types/components/metric-run-info/metric-run-info.d.ts +14 -0
  99. package/types/components/summary/index.d.ts +1 -1
  100. package/types/components/summary/summary.d.ts +15 -36
  101. package/types/constants.d.ts +0 -11
  102. package/types/layout/box/box.d.ts +8 -7
  103. package/types/layout/flex-stack/flex-stack.d.ts +10 -33
  104. package/types/layout/flex-stack/index.d.ts +1 -1
  105. package/types/layout/stack/stack.d.ts +2 -2
  106. package/types/tokens.d.ts +11 -0
  107. package/types/ui/tooltip/index.d.ts +1 -1
  108. package/types/ui/tooltip/tooltip.d.ts +10 -28
  109. package/lib/components/summary-item/index.js.map +0 -1
  110. package/lib/components/summary-item/summary-item.js +0 -97
  111. package/lib/components/summary-item/summary-item.js.map +0 -1
  112. package/lib-esm/components/summary-item/index.js +0 -2
  113. package/lib-esm/components/summary-item/index.js.map +0 -1
  114. package/lib-esm/components/summary-item/summary-item.js +0 -67
  115. package/lib-esm/components/summary-item/summary-item.js.map +0 -1
  116. package/src/components/metric/metric.jsx +0 -63
  117. package/src/components/summary/summary.jsx +0 -74
  118. package/src/components/summary-item/index.js +0 -1
  119. package/src/components/summary-item/summary-item.jsx +0 -142
  120. package/src/layout/flex-stack/flex-stack.jsx +0 -49
  121. package/src/ui/tooltip/tooltip.jsx +0 -67
  122. package/types/components/summary-item/index.d.ts +0 -1
  123. package/types/components/summary-item/summary-item.d.ts +0 -40
  124. /package/src/components/metric/{index.js → index.ts} +0 -0
  125. /package/src/components/summary/{index.js → index.ts} +0 -0
  126. /package/src/layout/flex-stack/{index.js → index.ts} +0 -0
  127. /package/src/ui/tooltip/{index.js → index.ts} +0 -0
@@ -0,0 +1,124 @@
1
+ import React, { useCallback } from 'react';
2
+ import cx from 'classnames';
3
+ import get from 'lodash/get';
4
+ import { METRIC_COMPONENT_LINKS, getGlobalMetricType, getMetricRunInfo } from '@bundle-stats/utils';
5
+
6
+ import { METRICS_WEBPACK_GENERAL } from '../../constants';
7
+ import { Box } from '../../layout/box';
8
+ import { FlexStack } from '../../layout/flex-stack';
9
+ import { Stack } from '../../layout/stack';
10
+ import { ComponentLink } from '../component-link';
11
+ import { MetricRunInfo, MetricRunInfoProps } from '../metric-run-info';
12
+ import css from './summary.module.css';
13
+
14
+ interface MetricInfoProps {
15
+ description: string;
16
+ url?: string;
17
+ }
18
+
19
+ const MetricInfo = ({ description, url }: MetricInfoProps) => {
20
+ // The component parent can be rendered inside a link, use button to avoid using nested links
21
+ const onClick = useCallback(() => {
22
+ if (url) {
23
+ window.open(url);
24
+ }
25
+ }, [url]);
26
+
27
+ return (
28
+ <Stack space="xxxsmall">
29
+ <p>{description}</p>
30
+ {url && (
31
+ <p>
32
+ <button type="button" onClick={onClick} className={css.readMoreLink}>
33
+ Read more
34
+ </button>
35
+ </p>
36
+ )}
37
+ </Stack>
38
+ );
39
+ };
40
+
41
+ interface SummaryItemData {
42
+ current: number;
43
+ baseline: number;
44
+ }
45
+
46
+ interface SummaryProps {
47
+ size?: MetricRunInfoProps['size'];
48
+ keys?: Array<string>;
49
+ data?: Record<string, SummaryItemData> | null;
50
+ loading?: boolean;
51
+ showSummaryItemDelta?: boolean;
52
+ summaryItemLink?: React.ElementType;
53
+ }
54
+
55
+ interface SummaryItemProps {
56
+ metricId: string;
57
+ data?: SummaryProps['data'];
58
+ summaryItemLink: SummaryProps['summaryItemLink'];
59
+ size: SummaryProps['size'];
60
+ loading: SummaryProps['loading'];
61
+ showSummaryItemDelta: SummaryProps['showSummaryItemDelta'];
62
+ }
63
+
64
+ const SummaryItem = (props: SummaryItemProps & React.ComponentProps<'div'>) => {
65
+ const { className = '', metricId, data, summaryItemLink: SummaryItemCustomLink, size, loading, showSummaryItemDelta } = props;
66
+
67
+ const componentLink = METRIC_COMPONENT_LINKS.get(metricId);
68
+
69
+ const metricData = get(data, metricId, { current: 0, baseline: 0 });
70
+ const metric = getGlobalMetricType(metricId);
71
+ const metricRunInfo = getMetricRunInfo(metric, metricData.current, metricData.baseline);
72
+
73
+ return (
74
+ <Box
75
+ key={metricId}
76
+ outline
77
+ outlineHover
78
+ padding="small"
79
+ as={SummaryItemCustomLink}
80
+ {...componentLink?.link}
81
+ className={className}
82
+ >
83
+ <MetricRunInfo
84
+ title={metric.label}
85
+ titleHoverCard={<MetricInfo description={metric.description} url={metric.url} />}
86
+ current={metricRunInfo.displayValue}
87
+ baseline={metric.formatter(metricData.baseline)}
88
+ size={size}
89
+ loading={loading}
90
+ {...(showSummaryItemDelta && componentLink?.showDelta !== false && {
91
+ delta: metricRunInfo.displayDeltaPercentage,
92
+ deltaType: metricRunInfo.deltaType,
93
+ })}
94
+ />
95
+ </Box>
96
+ );
97
+ };
98
+
99
+ export const Summary = ({
100
+ className = '',
101
+ size = 'medium',
102
+ keys = METRICS_WEBPACK_GENERAL,
103
+ data = null,
104
+ loading = false,
105
+ showSummaryItemDelta = true,
106
+ summaryItemLink = ComponentLink,
107
+ }: SummaryProps & React.ComponentProps<'div'>) => (
108
+ <Box className={cx(css.root, className)}>
109
+ <FlexStack space="small" className={css.items}>
110
+ {keys.map((metricId) => (
111
+ <SummaryItem
112
+ key={metricId}
113
+ className={css.item}
114
+ metricId={metricId}
115
+ data={data}
116
+ summaryItemLink={summaryItemLink}
117
+ size={size}
118
+ loading={loading}
119
+ showSummaryItemDelta={showSummaryItemDelta}
120
+ />
121
+ ))}
122
+ </FlexStack>
123
+ </Box>
124
+ );
package/src/constants.js CHANGED
@@ -1,29 +1,5 @@
1
1
  import { FILE_TYPES, SECTIONS } from '@bundle-stats/utils';
2
2
 
3
- export const NO_SPACE = 'no-space';
4
- export const SPACE_XXXSMALL = 'xxxsmall';
5
- export const SPACE_XXSMALL = 'xxsmall';
6
- export const SPACE_XSMALL = 'xsmall';
7
- export const SPACE_SMALL = 'small';
8
- export const SPACE_MEDIUM = 'medium';
9
- export const SPACE_LARGE = 'large';
10
- export const SPACE_XLARGE = 'xlarge';
11
- export const SPACE_XXLARGE = 'xxlarge';
12
- export const SPACE_XXXLARGE = 'xxxlarge';
13
-
14
- export const SPACES = [
15
- NO_SPACE,
16
- SPACE_XXXSMALL,
17
- SPACE_XXSMALL,
18
- SPACE_XSMALL,
19
- SPACE_SMALL,
20
- SPACE_MEDIUM,
21
- SPACE_LARGE,
22
- SPACE_XLARGE,
23
- SPACE_XXLARGE,
24
- SPACE_XXXLARGE,
25
- ];
26
-
27
3
  export const URLS = {
28
4
  OVERVIEW: '/',
29
5
  ASSETS: '/assets',
@@ -1,20 +1,23 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
 
4
- import { NO_SPACE, SPACES } from '../../constants';
5
- // @ts-ignore
4
+ import { NO_SPACE, SPACES } from '../../tokens';
6
5
  import css from './box.module.css';
7
6
 
8
- interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
9
- as?: React.ElementType;
10
- padding?: typeof SPACES | Array<typeof SPACES>;
11
- horizontalPadding?: string;
12
- verticalPadding?: string;
7
+ type SpaceValue = (typeof SPACES)[number];
8
+
9
+ interface BoxProps<T extends React.ElementType> {
10
+ as?: T;
11
+ padding?: SpaceValue | [SpaceValue, SpaceValue];
12
+ horizontalPadding?: SpaceValue;
13
+ verticalPadding?: SpaceValue;
13
14
  outline?: boolean;
14
15
  outlineHover?: boolean;
15
16
  }
16
17
 
17
- export const Box = (props: BoxProps) => {
18
+ export const Box = <T extends React.ElementType = 'div'>(
19
+ props: BoxProps<T> & Omit<React.ComponentProps<T>, keyof BoxProps<T>>,
20
+ ) => {
18
21
  const {
19
22
  className = '',
20
23
  as: Component = 'div',
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { Box } from '../box';
5
+ import { FlexStack } from '.';
6
+
7
+ export default {
8
+ title: 'Layout/FlexStack',
9
+ component: FlexStack,
10
+ decorators: [getWrapperDecorator()],
11
+ };
12
+
13
+ export const Default = () => (
14
+ <FlexStack>
15
+ <Box outline>Lorem ipsum 1</Box>
16
+ <Box outline>Lorem ipsum 2</Box>
17
+ {null}
18
+ Lorem ipsum 3
19
+ </FlexStack>
20
+ );
21
+
22
+ export const withCustomWrapper = () => (
23
+ <FlexStack as="main" className="wrapper">
24
+ <Box outline>Lorem ipsum 1</Box>
25
+ <Box outline>Lorem ipsum 2</Box>
26
+ </FlexStack>
27
+ );
28
+
29
+ export const withLargeSpace = () => (
30
+ <FlexStack space="large">
31
+ <Box outline>Lorem ipsum 1</Box>
32
+ <Box outline>Lorem ipsum 2</Box>
33
+ <Box outline>Lorem ipsum 3</Box>
34
+ </FlexStack>
35
+ );
36
+
37
+ export const withNestedStack = () => (
38
+ <FlexStack space="large">
39
+ <Box outline>Lorem ipsum 1</Box>
40
+ <Box outline>Lorem ipsum 2</Box>
41
+ <FlexStack space="small">
42
+ <Box outline>Lorem ipsum 3.1</Box>
43
+ <Box outline>Lorem ipsum 3.2</Box>
44
+ </FlexStack>
45
+ </FlexStack>
46
+ );
47
+
48
+ export const singleItem = () => (
49
+ <FlexStack>
50
+ <Box outline>Lorem ipsum</Box>
51
+ </FlexStack>
52
+ );
53
+
54
+ export const withAlignItems = () => (
55
+ <FlexStack alignItems="center" space="medium">
56
+ <h1>Title</h1>
57
+ <a href="#test">Option 1</a>
58
+ </FlexStack>
59
+ );
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+
4
+ import { NO_SPACE, SPACES } from '../../tokens';
5
+ import { getRenderChildWithClassName } from '../../utils';
6
+ import css from './flex-stack.module.css';
7
+
8
+ type SpaceValue = (typeof SPACES)[number];
9
+
10
+ interface FlexStackProps<T extends React.ElementType> {
11
+ as?: T;
12
+ space?: SpaceValue;
13
+ inline?: boolean;
14
+ alignItems?: 'top' | 'center' | 'bottom';
15
+ }
16
+
17
+ export const FlexStack = <T extends React.ElementType = 'div'>(
18
+ props: FlexStackProps<T> & Omit<React.ComponentProps<T>, keyof FlexStackProps<T>>,
19
+ ) => {
20
+ const {
21
+ as: Component = 'div',
22
+ className = '',
23
+ space = NO_SPACE,
24
+ inline = false,
25
+ children = null,
26
+ alignItems = '',
27
+ ...restProps
28
+ } = props;
29
+
30
+ const rootClassName = cx(
31
+ className,
32
+ css.root,
33
+ css[`space--${space}`],
34
+ css[`align-items--${alignItems}`],
35
+ inline && css.inline,
36
+ );
37
+
38
+ return (
39
+ <Component {...restProps} className={rootClassName}>
40
+ {React.Children.map(children, getRenderChildWithClassName(css.item))}
41
+ </Component>
42
+ );
43
+ };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cx from 'classnames';
4
4
 
5
- import { NO_SPACE, SPACES } from '../../constants';
5
+ import { NO_SPACE, SPACES } from '../../tokens';
6
6
  import { getRenderChildWithClassName } from '../../utils';
7
7
  import css from './stack.module.css';
8
8
 
package/src/tokens.ts ADDED
@@ -0,0 +1,23 @@
1
+ export const NO_SPACE = 'no-space';
2
+ export const SPACE_XXXSMALL = 'xxxsmall';
3
+ export const SPACE_XXSMALL = 'xxsmall';
4
+ export const SPACE_XSMALL = 'xsmall';
5
+ export const SPACE_SMALL = 'small';
6
+ export const SPACE_MEDIUM = 'medium';
7
+ export const SPACE_LARGE = 'large';
8
+ export const SPACE_XLARGE = 'xlarge';
9
+ export const SPACE_XXLARGE = 'xxlarge';
10
+ export const SPACE_XXXLARGE = 'xxxlarge';
11
+
12
+ export const SPACES = [
13
+ NO_SPACE,
14
+ SPACE_XXXSMALL,
15
+ SPACE_XXSMALL,
16
+ SPACE_XSMALL,
17
+ SPACE_SMALL,
18
+ SPACE_MEDIUM,
19
+ SPACE_LARGE,
20
+ SPACE_XLARGE,
21
+ SPACE_XXLARGE,
22
+ SPACE_XXXLARGE,
23
+ ] as const;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
 
4
- // @ts-ignore
5
4
  import css from './container.module.css';
6
5
 
7
6
  interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Story } from '@storybook/react'; // eslint-disable-line
3
+
4
+ import { getWrapperDecorator } from '../../stories';
5
+ import { Tooltip } from '.';
6
+
7
+ export default {
8
+ title: 'UI/Tooltip',
9
+ component: Tooltip,
10
+ decorators: [getWrapperDecorator({ padding: '100px', textAlign: 'center' })],
11
+ args: {
12
+ title: 'View job #123',
13
+ },
14
+ };
15
+
16
+ const Template = (props: any) => <Tooltip {...props}>Job #123</Tooltip>;
17
+
18
+ export const Default: Story = Template.bind({});
19
+
20
+ export const LongTooltip: Story = Template.bind({});
21
+
22
+ LongTooltip.args = {
23
+ title: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam molestie neque id lectus mollis, et imperdiet libero porta.',
24
+ };
25
+
26
+ export const DarkModeFalse: Story = Template.bind({});
27
+
28
+ DarkModeFalse.args = {
29
+ darkMode: false,
30
+ };
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import {
4
+ Tooltip as UITooltip,
5
+ TooltipAnchor as UITooltipAnchor,
6
+ TooltipArrow as UITooltipArrow,
7
+ useTooltipState,
8
+ } from 'ariakit/tooltip';
9
+
10
+ import css from './tooltip.module.css';
11
+
12
+ interface TooltipProps<T extends React.ElementType> {
13
+ className?: string;
14
+ tooltipClassName?: string;
15
+ title?: React.ReactNode;
16
+ as?: T;
17
+ containerRef?: React.RefObject<HTMLElement>;
18
+ darkMode?: boolean;
19
+ }
20
+
21
+ export const Tooltip = <T extends React.ElementType = 'span'>(
22
+ props: TooltipProps<T> & Omit<React.ComponentProps<T>, keyof TooltipProps<T>>,
23
+ ) => {
24
+ const {
25
+ className = '',
26
+ tooltipClassName = '',
27
+ title = '',
28
+ as: Component = 'span',
29
+ containerRef: ref,
30
+ darkMode = true,
31
+ ...restProps
32
+ } = props;
33
+
34
+ const tooltip = useTooltipState({ placement: 'top' });
35
+
36
+ return (
37
+ <>
38
+ <UITooltipAnchor
39
+ as={Component as React.ElementType}
40
+ className={cx(css.root, className)}
41
+ state={tooltip}
42
+ {...(ref ? { ref } : {})}
43
+ {...restProps}
44
+ />
45
+ {title && (
46
+ <UITooltip
47
+ state={tooltip}
48
+ className={cx(css.tooltip, tooltipClassName, darkMode && css.tooltipDarkMode)}
49
+ >
50
+ <UITooltipArrow state={tooltip} className={css.arrow} size={12} />
51
+ {title}
52
+ </UITooltip>
53
+ )}
54
+ </>
55
+ );
56
+ };
@@ -18,6 +18,6 @@ export { MetricsTableOptions } from "./metrics-table-options";
18
18
  export { MetricsTableSearch } from "./metrics-table-search";
19
19
  export { MetricsTableTitle } from "./metrics-table-title";
20
20
  export { ModuleInfo } from "./module-info";
21
- export { SummaryItem } from "./summary-item";
22
21
  export { Summary } from "./summary";
23
22
  export { TotalSizeTypeTitle } from "./total-size-type-title";
23
+ export { MetricRunInfo, MetricRunInfoProps } from "./metric-run-info";
@@ -1 +1 @@
1
- export * from "./metric";
1
+ export * from './metric';
@@ -1,33 +1,7 @@
1
- export function Metric({ className, value, formatter, inline, children, enhanced }: {
2
- className: any;
3
- value: any;
4
- formatter: any;
5
- inline: any;
6
- children: any;
7
- enhanced: any;
8
- }): JSX.Element;
9
- export namespace Metric {
10
- namespace defaultProps {
11
- const className: string;
12
- const enhanced: boolean;
13
- const inline: boolean;
14
- const value: number;
15
- const children: never[];
16
- function formatter(val: any): any;
17
- }
18
- namespace propTypes {
19
- const className_1: PropTypes.Requireable<string>;
20
- export { className_1 as className };
21
- const enhanced_1: PropTypes.Requireable<boolean>;
22
- export { enhanced_1 as enhanced };
23
- const inline_1: PropTypes.Requireable<boolean>;
24
- export { inline_1 as inline };
25
- const value_1: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
26
- export { value_1 as value };
27
- const formatter_1: PropTypes.Requireable<(...args: any[]) => any>;
28
- export { formatter_1 as formatter };
29
- const children_1: PropTypes.Requireable<PropTypes.ReactNodeLike>;
30
- export { children_1 as children };
31
- }
1
+ import React from 'react';
2
+ export interface MetricProps {
3
+ value?: string;
4
+ unit?: string;
5
+ inline?: boolean;
32
6
  }
33
- import PropTypes from "prop-types";
7
+ export declare const Metric: (props: MetricProps & React.ComponentProps<'div'>) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './metric-run-info';
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface MetricRunInfoProps {
3
+ title?: string;
4
+ titleHoverCard?: React.ReactNode;
5
+ titleTooltip?: React.ReactNode;
6
+ current?: string;
7
+ baseline?: string;
8
+ delta?: string;
9
+ deltaType?: string;
10
+ as?: React.ElementType;
11
+ size?: 'medium' | 'large';
12
+ loading?: boolean;
13
+ }
14
+ export declare const MetricRunInfo: ({ className, title, titleHoverCard, titleTooltip, current, baseline, delta, deltaType, as: Component, size, loading, ...restProps }: MetricRunInfoProps & React.ComponentProps<'div'>) => JSX.Element;
@@ -1 +1 @@
1
- export * from "./summary";
1
+ export * from './summary';
@@ -1,37 +1,16 @@
1
- export function Summary({ className, size, keys, data, loading, showSummaryItemDelta, summaryItemLink: SummaryItemCustomLink, }: {
2
- className: any;
3
- size: any;
4
- keys: any;
5
- data: any;
6
- loading: any;
7
- showSummaryItemDelta: any;
8
- summaryItemLink: any;
9
- }): JSX.Element;
10
- export namespace Summary {
11
- namespace defaultProps {
12
- export const className: string;
13
- export const data: null;
14
- export const loading: boolean;
15
- export const size: string;
16
- export { METRICS_WEBPACK_GENERAL as keys };
17
- export const showSummaryItemDelta: boolean;
18
- export { ComponentLink as summaryItemLink };
19
- }
20
- namespace propTypes {
21
- const className_1: PropTypes.Requireable<string>;
22
- export { className_1 as className };
23
- const size_1: PropTypes.Requireable<string>;
24
- export { size_1 as size };
25
- export const keys: PropTypes.Requireable<(string | null | undefined)[]>;
26
- const data_1: PropTypes.Requireable<PropTypes.InferProps<{}>>;
27
- export { data_1 as data };
28
- const loading_1: PropTypes.Requireable<boolean>;
29
- export { loading_1 as loading };
30
- const showSummaryItemDelta_1: PropTypes.Requireable<boolean>;
31
- export { showSummaryItemDelta_1 as showSummaryItemDelta };
32
- export const summaryItemLink: PropTypes.Requireable<PropTypes.ReactComponentLike>;
33
- }
1
+ import React from 'react';
2
+ import { MetricRunInfoProps } from '../metric-run-info';
3
+ interface SummaryItemData {
4
+ current: number;
5
+ baseline: number;
34
6
  }
35
- import { METRICS_WEBPACK_GENERAL } from "../../constants";
36
- import { ComponentLink } from "../component-link";
37
- import PropTypes from "prop-types";
7
+ interface SummaryProps {
8
+ size?: MetricRunInfoProps['size'];
9
+ keys?: Array<string>;
10
+ data?: Record<string, SummaryItemData> | null;
11
+ loading?: boolean;
12
+ showSummaryItemDelta?: boolean;
13
+ summaryItemLink?: React.ElementType;
14
+ }
15
+ export declare const Summary: ({ className, size, keys, data, loading, showSummaryItemDelta, summaryItemLink, }: SummaryProps & React.ComponentProps<'div'>) => JSX.Element;
16
+ export {};
@@ -1,14 +1,3 @@
1
- export const NO_SPACE: "no-space";
2
- export const SPACE_XXXSMALL: "xxxsmall";
3
- export const SPACE_XXSMALL: "xxsmall";
4
- export const SPACE_XSMALL: "xsmall";
5
- export const SPACE_SMALL: "small";
6
- export const SPACE_MEDIUM: "medium";
7
- export const SPACE_LARGE: "large";
8
- export const SPACE_XLARGE: "xlarge";
9
- export const SPACE_XXLARGE: "xxlarge";
10
- export const SPACE_XXXLARGE: "xxxlarge";
11
- export const SPACES: string[];
12
1
  export namespace URLS {
13
2
  const OVERVIEW: string;
14
3
  const ASSETS: string;
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
- import { SPACES } from '../../constants';
3
- interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
4
- as?: React.ElementType;
5
- padding?: typeof SPACES | Array<typeof SPACES>;
6
- horizontalPadding?: string;
7
- verticalPadding?: string;
2
+ import { SPACES } from '../../tokens';
3
+ type SpaceValue = (typeof SPACES)[number];
4
+ interface BoxProps<T extends React.ElementType> {
5
+ as?: T;
6
+ padding?: SpaceValue | [SpaceValue, SpaceValue];
7
+ horizontalPadding?: SpaceValue;
8
+ verticalPadding?: SpaceValue;
8
9
  outline?: boolean;
9
10
  outlineHover?: boolean;
10
11
  }
11
- export declare const Box: (props: BoxProps) => JSX.Element;
12
+ export declare const Box: <T extends React.ElementType<any> = "div">(props: BoxProps<T> & Omit<React.ComponentProps<T>, keyof BoxProps<T>>) => JSX.Element;
12
13
  export {};
@@ -1,34 +1,11 @@
1
- export function FlexStack({ as: Component, className, space, inline, children, alignItems, ...restProps }: {
2
- [x: string]: any;
3
- as?: string | undefined;
4
- className?: string | undefined;
5
- space?: string | undefined;
6
- inline?: boolean | undefined;
7
- children?: null | undefined;
8
- alignItems?: string | undefined;
9
- }): JSX.Element;
10
- export namespace FlexStack {
11
- namespace defaultProps {
12
- export const as: string;
13
- export const className: string;
14
- export const children: null;
15
- export { NO_SPACE as space };
16
- export const alignItems: undefined;
17
- export const inline: boolean;
18
- }
19
- namespace propTypes {
20
- const as_1: PropTypes.Requireable<PropTypes.ReactComponentLike>;
21
- export { as_1 as as };
22
- const className_1: PropTypes.Requireable<string>;
23
- export { className_1 as className };
24
- const children_1: PropTypes.Requireable<PropTypes.ReactNodeLike>;
25
- export { children_1 as children };
26
- export const space: PropTypes.Requireable<string>;
27
- const alignItems_1: PropTypes.Requireable<string>;
28
- export { alignItems_1 as alignItems };
29
- const inline_1: PropTypes.Requireable<boolean>;
30
- export { inline_1 as inline };
31
- }
1
+ import React from 'react';
2
+ import { SPACES } from '../../tokens';
3
+ type SpaceValue = (typeof SPACES)[number];
4
+ interface FlexStackProps<T extends React.ElementType> {
5
+ as?: T;
6
+ space?: SpaceValue;
7
+ inline?: boolean;
8
+ alignItems?: 'top' | 'center' | 'bottom';
32
9
  }
33
- import { NO_SPACE } from "../../constants";
34
- import PropTypes from "prop-types";
10
+ export declare const FlexStack: <T extends React.ElementType<any> = "div">(props: FlexStackProps<T> & Omit<React.ComponentProps<T>, keyof FlexStackProps<T>>) => JSX.Element;
11
+ export {};
@@ -1 +1 @@
1
- export * from "./flex-stack";
1
+ export * from './flex-stack';
@@ -13,8 +13,8 @@ export namespace Stack {
13
13
  export { className_1 as className };
14
14
  const children_1: PropTypes.Requireable<PropTypes.ReactNodeLike>;
15
15
  export { children_1 as children };
16
- export const space: PropTypes.Requireable<string>;
16
+ export const space: PropTypes.Requireable<"no-space" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge">;
17
17
  }
18
18
  }
19
- import { NO_SPACE } from "../../constants";
19
+ import { NO_SPACE } from "../../tokens";
20
20
  import PropTypes from "prop-types";
@@ -0,0 +1,11 @@
1
+ export declare const NO_SPACE = "no-space";
2
+ export declare const SPACE_XXXSMALL = "xxxsmall";
3
+ export declare const SPACE_XXSMALL = "xxsmall";
4
+ export declare const SPACE_XSMALL = "xsmall";
5
+ export declare const SPACE_SMALL = "small";
6
+ export declare const SPACE_MEDIUM = "medium";
7
+ export declare const SPACE_LARGE = "large";
8
+ export declare const SPACE_XLARGE = "xlarge";
9
+ export declare const SPACE_XXLARGE = "xxlarge";
10
+ export declare const SPACE_XXXLARGE = "xxxlarge";
11
+ export declare const SPACES: readonly ["no-space", "xxxsmall", "xxsmall", "xsmall", "small", "medium", "large", "xlarge", "xxlarge", "xxxlarge"];
@@ -1 +1 @@
1
- export * from "./tooltip";
1
+ export * from './tooltip';