@bundle-stats/ui 4.2.1 → 4.2.3-beta.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.
Files changed (93) hide show
  1. package/lib/app/app.js +17 -5
  2. package/lib/app/app.js.map +1 -1
  3. package/lib/components/index.js +3 -1
  4. package/lib/components/index.js.map +1 -1
  5. package/lib/components/insight-icon/index.js +18 -0
  6. package/lib/components/insight-icon/index.js.map +1 -0
  7. package/lib/components/insight-icon/insight-icon.js +25 -0
  8. package/lib/components/insight-icon/insight-icon.js.map +1 -0
  9. package/lib/components/insight-icon/insight-icon.module.css +24 -0
  10. package/lib/components/insights/insights.js +6 -13
  11. package/lib/components/insights/insights.js.map +1 -1
  12. package/lib/components/insights/insights.module.css +0 -21
  13. package/lib/components/metrics-table-search/metrics-table-search.module.css +0 -6
  14. package/lib/components/summary/summary.js +1 -1
  15. package/lib/components/summary/summary.js.map +1 -1
  16. package/lib/components/summary/summary.module.css +0 -8
  17. package/lib/css/variables.css +2 -0
  18. package/lib/layout/box/box.js +2 -22
  19. package/lib/layout/box/box.js.map +1 -1
  20. package/lib/layout/box/box.module.css +11 -0
  21. package/lib/layout/box/index.js +15 -3
  22. package/lib/layout/box/index.js.map +1 -1
  23. package/lib/ui/container/container.js +1 -10
  24. package/lib/ui/container/container.js.map +1 -1
  25. package/lib/ui/container/index.js +15 -3
  26. package/lib/ui/container/index.js.map +1 -1
  27. package/lib/ui/dropdown/dropdown.module.css +1 -2
  28. package/lib/ui/filters/filters.module.css +1 -5
  29. package/lib/ui/input/input.module.css +3 -4
  30. package/lib-esm/app/app.js +18 -6
  31. package/lib-esm/app/app.js.map +1 -1
  32. package/lib-esm/components/index.js +1 -0
  33. package/lib-esm/components/index.js.map +1 -1
  34. package/lib-esm/components/insight-icon/index.js +2 -0
  35. package/lib-esm/components/insight-icon/index.js.map +1 -0
  36. package/lib-esm/components/insight-icon/insight-icon.js +18 -0
  37. package/lib-esm/components/insight-icon/insight-icon.js.map +1 -0
  38. package/lib-esm/components/insight-icon/insight-icon.module.css +24 -0
  39. package/lib-esm/components/insights/insights.js +7 -14
  40. package/lib-esm/components/insights/insights.js.map +1 -1
  41. package/lib-esm/components/insights/insights.module.css +0 -21
  42. package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +0 -6
  43. package/lib-esm/components/summary/summary.js +1 -1
  44. package/lib-esm/components/summary/summary.js.map +1 -1
  45. package/lib-esm/components/summary/summary.module.css +0 -8
  46. package/lib-esm/css/variables.css +2 -0
  47. package/lib-esm/layout/box/box.js +3 -23
  48. package/lib-esm/layout/box/box.js.map +1 -1
  49. package/lib-esm/layout/box/box.module.css +11 -0
  50. package/lib-esm/layout/box/index.js +1 -1
  51. package/lib-esm/layout/box/index.js.map +1 -1
  52. package/lib-esm/ui/container/container.js +1 -10
  53. package/lib-esm/ui/container/container.js.map +1 -1
  54. package/lib-esm/ui/container/index.js +1 -1
  55. package/lib-esm/ui/container/index.js.map +1 -1
  56. package/lib-esm/ui/dropdown/dropdown.module.css +1 -2
  57. package/lib-esm/ui/filters/filters.module.css +1 -5
  58. package/lib-esm/ui/input/input.module.css +3 -4
  59. package/package.json +5 -5
  60. package/src/app/app.jsx +21 -10
  61. package/src/components/index.js +1 -0
  62. package/src/components/insight-icon/index.ts +1 -0
  63. package/src/components/insight-icon/insight-icon.module.css +24 -0
  64. package/src/components/insight-icon/insight-icon.tsx +27 -0
  65. package/src/components/insights/insights.module.css +0 -21
  66. package/src/components/insights/insights.stories.tsx +26 -22
  67. package/src/components/insights/insights.tsx +8 -19
  68. package/src/components/metrics-table-search/metrics-table-search.module.css +0 -6
  69. package/src/components/summary/summary.jsx +1 -0
  70. package/src/components/summary/summary.module.css +0 -8
  71. package/src/css/variables.css +2 -0
  72. package/src/layout/box/box.module.css +11 -0
  73. package/src/layout/box/box.stories.tsx +44 -0
  74. package/src/layout/box/box.tsx +46 -0
  75. package/src/layout/box/index.ts +1 -0
  76. package/src/ui/container/container.stories.tsx +29 -0
  77. package/src/ui/container/container.tsx +19 -0
  78. package/src/ui/container/index.ts +1 -0
  79. package/src/ui/dropdown/dropdown.module.css +1 -2
  80. package/src/ui/filters/filters.module.css +1 -5
  81. package/src/ui/input/input.module.css +3 -4
  82. package/types/components/index.d.ts +1 -0
  83. package/types/components/insight-icon/index.d.ts +1 -0
  84. package/types/components/insight-icon/insight-icon.d.ts +7 -0
  85. package/types/components/insights/insights.d.ts +2 -2
  86. package/types/layout/box/box.d.ts +11 -25
  87. package/types/layout/box/index.d.ts +1 -1
  88. package/types/ui/container/container.d.ts +5 -17
  89. package/types/ui/container/index.d.ts +1 -1
  90. package/src/layout/box/box.jsx +0 -67
  91. package/src/layout/box/index.js +0 -1
  92. package/src/ui/container/container.jsx +0 -24
  93. package/src/ui/container/index.js +0 -1
@@ -1,42 +1,31 @@
1
1
  import React from 'react';
2
- import cx from 'classnames';
3
- import { InsightType, getInsightList } from '@bundle-stats/utils';
2
+ import { JobInsightsInfo, getInsightList } from '@bundle-stats/utils';
4
3
 
5
4
  import { FlexStack } from '../../layout/flex-stack';
6
5
  import { Stack } from '../../layout/stack';
7
- import { Icon } from '../../ui/icon';
8
6
  import { ComponentLink } from '../component-link';
7
+ import { InsightIcon } from '../insight-icon';
9
8
  // @ts-ignore
10
9
  import css from './insights.module.css';
11
10
 
12
- const InsightTypeIconMap = new Map([
13
- [InsightType.ERROR, Icon.ICONS.ERROR],
14
- [InsightType.WARNING, Icon.ICONS.WARNING],
15
- [InsightType.INFO, Icon.ICONS.INFO],
16
- ]);
17
-
18
11
  interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
19
- duplicatePackages: any;
20
- newPackages: any;
12
+ insights: JobInsightsInfo;
21
13
  customComponentLink?: React.ElementType;
22
14
  }
23
15
 
24
16
  export const Insights = (props: InsightsProps) => {
25
17
  const {
26
- duplicatePackages,
27
- newPackages,
18
+ insights,
28
19
  customComponentLink: CustomComponentLink = ComponentLink,
29
20
  ...restProps
30
21
  } = props;
31
22
 
32
- const insights = getInsightList({ duplicatePackages, newPackages });
23
+ const insightList = getInsightList(insights);
33
24
 
34
25
  return (
35
26
  <Stack space="xxsmall" {...restProps}>
36
- {insights.map(({ name, insight, link }) => {
37
- const glyph = InsightTypeIconMap.get(insight.type);
27
+ {insightList.map(({ name, insight, link }) => {
38
28
  const { text } = insight.data as { text: string };
39
-
40
29
  return (
41
30
  <FlexStack
42
31
  key={name}
@@ -44,9 +33,9 @@ export const Insights = (props: InsightsProps) => {
44
33
  alignItems="center"
45
34
  as={CustomComponentLink}
46
35
  {...link}
47
- className={cx(css.entry, css[insight.type])}
36
+ className={css.entry}
48
37
  >
49
- {glyph && <Icon glyph={glyph} className={css.icon} />}
38
+ <InsightIcon type={insight.type} className={css.icon} />
50
39
  <span>{text}</span>
51
40
  </FlexStack>
52
41
  );
@@ -5,13 +5,7 @@
5
5
  }
6
6
 
7
7
  .input {
8
- border-radius: var(--radius-small);
9
8
  height: var(--space-large);
10
- border-color: var(--color-outline);
11
- }
12
-
13
- .input:focus {
14
- border-color: var(--color-outline-dark);
15
9
  }
16
10
 
17
11
  .cancelButton {
@@ -28,6 +28,7 @@ export const Summary = ({
28
28
  <Box
29
29
  key={metricId}
30
30
  outline
31
+ outlineHover
31
32
  padding="small"
32
33
  as={SummaryItemCustomLink}
33
34
  {...metricOptions.link}
@@ -1,6 +1,5 @@
1
1
  .root {
2
2
  width: 100%;
3
- overflow: auto;
4
3
  }
5
4
 
6
5
  .item {
@@ -8,10 +7,3 @@
8
7
  min-width: 16em;
9
8
  text-decoration: none;
10
9
  }
11
-
12
- .item:hover,
13
- .item:active,
14
- .item:focus {
15
- border-color: var(--color-outline-dark);
16
- outline: none;
17
- }
@@ -190,6 +190,8 @@
190
190
  --radius-medium: 5px;
191
191
  --radius-large: 9px;
192
192
 
193
+ --outline-hover: 0 0 0 3px var(--color-highlight);
194
+
193
195
  /** Layout */
194
196
  --max-width: 80rem;
195
197
  }
@@ -15,6 +15,17 @@
15
15
  border-radius: 0 0 var(--radius-medium) var(--radius-medium);
16
16
  }
17
17
 
18
+ .outlineHover {
19
+ transition: var(--transition-out);
20
+ }
21
+
22
+ .outlineHover:focus,
23
+ .outlineHover:active,
24
+ .outlineHover:hover {
25
+ box-shadow: var(--outline-hover);
26
+ transition: var(--transition-in);
27
+ }
28
+
18
29
  .padding-xxxsmall {
19
30
  padding: var(--space-xxxsmall);
20
31
  }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+
3
+ import { getWrapperDecorator } from '../../stories';
4
+ import { Box } from '.';
5
+
6
+ export default {
7
+ title: 'Layout/Box',
8
+ component: Box,
9
+ decorators: [getWrapperDecorator()],
10
+ };
11
+
12
+ const Template = (props: any) => <Box style={{ border: '1px dotted magenta' }} {...props}>Lorem ipsum</Box>;
13
+
14
+ export const Default = Template.bind({});
15
+
16
+ export const WithPadding = Template.bind({});
17
+ WithPadding.args = {
18
+ padding: 'medium',
19
+ };
20
+
21
+ export const WithHorizontalPadding = Template.bind({});
22
+ WithHorizontalPadding.args = {
23
+ horizontalPadding: 'medium',
24
+ };
25
+
26
+ export const WithVerticalPadding = Template.bind({});
27
+ WithVerticalPadding.args = {
28
+ verticalPadding: 'medium',
29
+ };
30
+
31
+ export const WithHorizontalAndVerticalPadding = Template.bind({});
32
+ WithHorizontalAndVerticalPadding.args = {
33
+ padding: ['xxsmall', 'medium'],
34
+ };
35
+
36
+ export const WithOutline = Template.bind({});
37
+ WithOutline.args = {
38
+ outline: true,
39
+ };
40
+
41
+ export const WithOutlineHover = Template.bind({});
42
+ WithOutlineHover.args = {
43
+ outlineHover: true,
44
+ };
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+
4
+ import { NO_SPACE, SPACES } from '../../constants';
5
+ // @ts-ignore
6
+ import css from './box.module.css';
7
+
8
+ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ as?: React.ElementType;
10
+ padding?: typeof SPACES | Array<typeof SPACES>;
11
+ horizontalPadding?: string;
12
+ verticalPadding?: string;
13
+ outline?: boolean;
14
+ outlineHover?: boolean;
15
+ }
16
+
17
+ export const Box = (props: BoxProps) => {
18
+ const {
19
+ className = '',
20
+ as: Component = 'div',
21
+ padding = NO_SPACE,
22
+ horizontalPadding = '',
23
+ verticalPadding = '',
24
+ outline = false,
25
+ outlineHover = false,
26
+ ...restProps
27
+ } = props;
28
+
29
+ const [resolvedPadding, resolvedVerticalPadding, resolvedHorizontalPadding] = Array.isArray(
30
+ padding,
31
+ )
32
+ ? [null, ...padding]
33
+ : [padding, verticalPadding, horizontalPadding];
34
+
35
+ const rootClassName = cx(
36
+ css.root,
37
+ className,
38
+ resolvedPadding && css[`padding-${resolvedPadding}`],
39
+ resolvedVerticalPadding && css[`vertical-padding-${resolvedVerticalPadding}`],
40
+ resolvedHorizontalPadding && css[`horizontal-padding-${resolvedHorizontalPadding}`],
41
+ outline && css.outline,
42
+ outlineHover && css.outlineHover,
43
+ );
44
+
45
+ return <Component {...restProps} className={rootClassName} />;
46
+ };
@@ -0,0 +1 @@
1
+ export * from './box';
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+
3
+ import { Container } from '.';
4
+
5
+ export default {
6
+ title: 'UI/Container',
7
+ component: Container,
8
+ };
9
+
10
+ export const Default = () => (
11
+ <Container style={{ background: 'white' }}>
12
+ <div
13
+ style={{
14
+ background: 'white',
15
+ padding: '24px',
16
+ }}
17
+ >
18
+ Content
19
+ </div>
20
+ </Container>
21
+ );
22
+
23
+ Default.decorators = [
24
+ (Story: React.FunctionComponent) => (
25
+ <div style={{ background: 'hotpink' }}>
26
+ <Story />
27
+ </div>
28
+ ),
29
+ ];
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+
4
+ // @ts-ignore
5
+ import css from './container.module.css';
6
+
7
+ interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
8
+ as?: React.ElementType;
9
+ }
10
+
11
+ export const Container = ({
12
+ as: Component = 'div',
13
+ className = '',
14
+ ...restProps
15
+ }: ContainerProps) => (
16
+ <Component className={cx(css.root, className)}>
17
+ <div className={css.inner} {...restProps} />
18
+ </Component>
19
+ );
@@ -0,0 +1 @@
1
+ export * from './container';
@@ -25,8 +25,7 @@
25
25
  .button:focus,
26
26
  .button:active {
27
27
  outline: none;
28
- box-shadow: var(--shadow-layer);
29
- border-color: var(--color-outline-dark);
28
+ box-shadow: var(--outline-hover);
30
29
  color: var(--color-text);
31
30
  }
32
31
 
@@ -83,11 +83,7 @@
83
83
  .filterStandalone:active .filterCheckbox,
84
84
  .filterStandalone:focus .filterCheckbox {
85
85
  z-index: var(--layout-xlow); /* show collapsed border */
86
- box-shadow: var(--shadow-layer);
87
- }
88
-
89
- .filterStandalone:hover .filterCheckbox {
90
- border-color: var(--color-outline-dark);
86
+ box-shadow: var(--outline-hover);
91
87
  color: var(--color-text);
92
88
  }
93
89
 
@@ -1,6 +1,6 @@
1
1
  .root {
2
- border: 1px solid var(--color-outline);;
3
- border-radius: 0;
2
+ border: 1px solid var(--color-outline);
3
+ border-radius: var(--radius-small);
4
4
  color: var(--color-text-light);
5
5
  width: 100%;
6
6
  transition: var(--transition-in);
@@ -25,8 +25,7 @@
25
25
  }
26
26
 
27
27
  .root:focus {
28
- border-color: var(--color-outline-dark);
29
- box-shadow: var(--shadow-layer);
28
+ box-shadow: var(--outline-hover);
30
29
  color: inherit;
31
30
  transition: var(--transition-out);
32
31
  }
@@ -6,6 +6,7 @@ export { BundlePackages } from "./bundle-packages";
6
6
  export { BundleModules } from "./bundle-modules";
7
7
  export { ComponentLink } from "./component-link";
8
8
  export { Delta } from "./delta";
9
+ export { InsightIcon } from "./insight-icon";
9
10
  export { Insights } from "./insights";
10
11
  export { JobName } from "./job-name";
11
12
  export { JobHeader } from "./job-header";
@@ -0,0 +1 @@
1
+ export * from './insight-icon';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { InsightType } from '@bundle-stats/utils';
3
+ interface InsightIconProps extends React.HTMLAttributes<'span'> {
4
+ type: InsightType;
5
+ }
6
+ export declare const InsightIcon: (props: InsightIconProps) => JSX.Element;
7
+ export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
+ import { JobInsightsInfo } from '@bundle-stats/utils';
2
3
  interface InsightsProps extends React.HTMLAttributes<HTMLDivElement> {
3
- duplicatePackages: any;
4
- newPackages: any;
4
+ insights: JobInsightsInfo;
5
5
  customComponentLink?: React.ElementType;
6
6
  }
7
7
  export declare const Insights: (props: InsightsProps) => JSX.Element;
@@ -1,26 +1,12 @@
1
- export function Box(props: any): JSX.Element;
2
- export namespace Box {
3
- namespace defaultProps {
4
- export const className: string;
5
- export const as: string;
6
- export { NO_SPACE as padding };
7
- export const horizontalPadding: string;
8
- export const verticalPadding: string;
9
- export const outline: boolean;
10
- }
11
- namespace propTypes {
12
- const className_1: PropTypes.Requireable<string>;
13
- export { className_1 as className };
14
- const as_1: PropTypes.Requireable<PropTypes.ReactComponentLike>;
15
- export { as_1 as as };
16
- export const padding: PropTypes.Requireable<NonNullable<string | (string | null | undefined)[] | null | undefined>>;
17
- const horizontalPadding_1: PropTypes.Requireable<string>;
18
- export { horizontalPadding_1 as horizontalPadding };
19
- const verticalPadding_1: PropTypes.Requireable<string>;
20
- export { verticalPadding_1 as verticalPadding };
21
- const outline_1: PropTypes.Requireable<boolean>;
22
- export { outline_1 as outline };
23
- }
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;
8
+ outline?: boolean;
9
+ outlineHover?: boolean;
24
10
  }
25
- import { NO_SPACE } from "../../constants";
26
- import PropTypes from "prop-types";
11
+ export declare const Box: (props: BoxProps) => JSX.Element;
12
+ export {};
@@ -1 +1 @@
1
- export { Box } from "./box";
1
+ export * from './box';
@@ -1,18 +1,6 @@
1
- export function Container({ className, as: Component, ...restProps }: {
2
- [x: string]: any;
3
- className: any;
4
- as: any;
5
- }): JSX.Element;
6
- export namespace Container {
7
- namespace defaultProps {
8
- const className: string;
9
- const as: string;
10
- }
11
- namespace propTypes {
12
- const className_1: PropTypes.Requireable<string>;
13
- export { className_1 as className };
14
- const as_1: PropTypes.Requireable<PropTypes.ReactComponentLike>;
15
- export { as_1 as as };
16
- }
1
+ import React from 'react';
2
+ interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ as?: React.ElementType;
17
4
  }
18
- import PropTypes from "prop-types";
5
+ export declare const Container: ({ as: Component, className, ...restProps }: ContainerProps) => JSX.Element;
6
+ export {};
@@ -1 +1 @@
1
- export { Container } from "./container";
1
+ export * from './container';
@@ -1,67 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
-
5
- import { NO_SPACE, SPACES } from '../../constants';
6
- import css from './box.module.css';
7
-
8
- export const Box = (props) => {
9
- const {
10
- className,
11
- as: Component,
12
- padding,
13
- horizontalPadding,
14
- verticalPadding,
15
- outline,
16
- ...restProps
17
- } = props;
18
-
19
- const [resolvedPadding, resolvedVerticalPadding, resolvedHorizontalPadding] = Array.isArray(
20
- padding,
21
- )
22
- ? [null, ...padding]
23
- : [padding, verticalPadding, horizontalPadding];
24
-
25
- const rootClassName = cx(
26
- css.root,
27
- className,
28
- resolvedPadding && css[`padding-${resolvedPadding}`],
29
- resolvedVerticalPadding && css[`vertical-padding-${resolvedVerticalPadding}`],
30
- resolvedHorizontalPadding && css[`horizontal-padding-${resolvedHorizontalPadding}`],
31
- outline && css.outline,
32
- );
33
-
34
- return <Component {...restProps} className={rootClassName} />;
35
- };
36
-
37
- Box.defaultProps = {
38
- className: '',
39
- as: 'div',
40
- padding: NO_SPACE,
41
- horizontalPadding: '',
42
- verticalPadding: '',
43
- outline: false,
44
- };
45
-
46
- Box.propTypes = {
47
- /** Adopted child class name */
48
- className: PropTypes.string,
49
-
50
- /** Rendered component */
51
- as: PropTypes.elementType,
52
-
53
- /** Padding space size */
54
- padding: PropTypes.oneOfType([
55
- PropTypes.oneOf(SPACES),
56
- PropTypes.arrayOf(PropTypes.oneOf(SPACES)),
57
- ]),
58
-
59
- /** Horizonatl padding space size */
60
- horizontalPadding: PropTypes.oneOf(SPACES),
61
-
62
- /** Vertical padding space size */
63
- verticalPadding: PropTypes.oneOf(SPACES),
64
-
65
- /** Outline flag */
66
- outline: PropTypes.bool,
67
- };
@@ -1 +0,0 @@
1
- export { Box } from './box';
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
-
5
- import css from './container.module.css';
6
-
7
- export const Container = ({ className, as: Component, ...restProps }) => (
8
- <Component className={cx(css.root, className)}>
9
- <div className={css.inner} {...restProps} />
10
- </Component>
11
- );
12
-
13
- Container.defaultProps = {
14
- className: '',
15
- as: 'div',
16
- };
17
-
18
- Container.propTypes = {
19
- /** Adopted child class name */
20
- className: PropTypes.string,
21
-
22
- /** Custom component */
23
- as: PropTypes.elementType,
24
- };
@@ -1 +0,0 @@
1
- export { Container } from './container';