@bundle-stats/ui 4.4.0-beta.3 → 4.4.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 (76) hide show
  1. package/lib/app/header/header.js +9 -12
  2. package/lib/app/header/header.js.map +1 -1
  3. package/lib/app/header/header.module.css +27 -20
  4. package/lib/app/header/index.js.map +1 -1
  5. package/lib/assets/icons.svg +3 -4
  6. package/lib/assets/icons.svg.js +2 -3
  7. package/lib/assets/icons.svg.js.map +1 -1
  8. package/lib/components/bundle-assets/bundle-assets.module.css +13 -1
  9. package/lib/components/bundle-modules/bundle-modules.js +3 -4
  10. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  11. package/lib/components/bundle-modules/bundle-modules.module.css +10 -3
  12. package/lib/components/bundle-packages/bundle-packages.module.css +8 -14
  13. package/lib/components/entry-info/entry-info.module.css +1 -0
  14. package/lib/components/insight-icon/insight-icon.js.map +1 -1
  15. package/lib/components/jobs-header/jobs-header.js.map +1 -1
  16. package/lib/components/run-info/run-info.module.css +2 -2
  17. package/lib/components/summary/summary.js.map +1 -1
  18. package/lib/config.json +1 -1
  19. package/lib/css/variables.css +4 -2
  20. package/lib/layout/footer/footer.js +2 -4
  21. package/lib/layout/footer/footer.js.map +1 -1
  22. package/lib/ui/icon/icon.js +12 -18
  23. package/lib/ui/icon/icon.js.map +1 -1
  24. package/lib/ui/icon/index.js.map +1 -1
  25. package/lib-esm/app/header/header.js +9 -12
  26. package/lib-esm/app/header/header.js.map +1 -1
  27. package/lib-esm/app/header/header.module.css +27 -20
  28. package/lib-esm/app/header/index.js.map +1 -1
  29. package/lib-esm/assets/icons.svg +3 -4
  30. package/lib-esm/assets/icons.svg.js +2 -3
  31. package/lib-esm/assets/icons.svg.js.map +1 -1
  32. package/lib-esm/components/bundle-assets/bundle-assets.module.css +13 -1
  33. package/lib-esm/components/bundle-modules/bundle-modules.js +3 -4
  34. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  35. package/lib-esm/components/bundle-modules/bundle-modules.module.css +10 -3
  36. package/lib-esm/components/bundle-packages/bundle-packages.module.css +8 -14
  37. package/lib-esm/components/entry-info/entry-info.module.css +1 -0
  38. package/lib-esm/components/insight-icon/insight-icon.js.map +1 -1
  39. package/lib-esm/components/jobs-header/jobs-header.js.map +1 -1
  40. package/lib-esm/components/run-info/run-info.module.css +2 -2
  41. package/lib-esm/components/summary/summary.js.map +1 -1
  42. package/lib-esm/config.json +1 -1
  43. package/lib-esm/css/variables.css +4 -2
  44. package/lib-esm/layout/footer/footer.js +2 -4
  45. package/lib-esm/layout/footer/footer.js.map +1 -1
  46. package/lib-esm/ui/icon/icon.js +12 -18
  47. package/lib-esm/ui/icon/icon.js.map +1 -1
  48. package/lib-esm/ui/icon/index.js.map +1 -1
  49. package/package.json +3 -3
  50. package/src/app/header/header.module.css +27 -20
  51. package/src/app/header/header.tsx +26 -0
  52. package/src/assets/icons/github.svg +1 -0
  53. package/src/assets/icons.svg +3 -4
  54. package/src/assets/icons.svg.jsx +8 -14
  55. package/src/components/bundle-assets/bundle-assets.module.css +13 -1
  56. package/src/components/bundle-modules/bundle-modules.jsx +5 -6
  57. package/src/components/bundle-modules/bundle-modules.module.css +10 -3
  58. package/src/components/bundle-packages/bundle-packages.module.css +8 -14
  59. package/src/components/entry-info/entry-info.module.css +1 -0
  60. package/src/components/insight-icon/insight-icon.tsx +2 -2
  61. package/src/components/jobs-header/jobs-header.tsx +0 -1
  62. package/src/components/run-info/run-info.module.css +2 -2
  63. package/src/components/summary/summary.tsx +1 -2
  64. package/src/config.json +1 -1
  65. package/src/css/variables.css +4 -2
  66. package/src/layout/footer/footer.jsx +3 -4
  67. package/src/ui/icon/icon.stories.tsx +54 -0
  68. package/src/ui/icon/{icon.jsx → icon.tsx} +23 -22
  69. package/types/app/header/header.d.ts +6 -16
  70. package/types/app/header/index.d.ts +1 -1
  71. package/types/ui/icon/icon.d.ts +54 -40
  72. package/types/ui/icon/index.d.ts +1 -1
  73. package/src/app/header/header.jsx +0 -25
  74. package/src/assets/icons/cancel.svg +0 -1
  75. /package/src/app/header/{index.js → index.ts} +0 -0
  76. /package/src/ui/icon/{index.js → index.ts} +0 -0
@@ -22,11 +22,18 @@
22
22
  }
23
23
 
24
24
  .nameText {
25
- display: inline;
25
+ display: inline-block;
26
26
  vertical-align: middle;
27
27
  }
28
28
 
29
- .hoverCard {
30
- max-width: var(--entry-info-hovercard-width);
29
+ .root .name:hover,
30
+ .root .name:active,
31
+ .root .name:focus {
32
+ text-decoration: none;
31
33
  }
32
34
 
35
+ .root .name:hover .nameText,
36
+ .root .name:active .nameText,
37
+ .root .name:focus .nameText {
38
+ text-decoration: underline;
39
+ }
@@ -45,20 +45,14 @@
45
45
  content: 'd';
46
46
  }
47
47
 
48
-
49
- .packageHoverCardTitleIndex {
50
- color: var(--color-text-light);
51
- font-weight: normal;
52
- }
53
-
54
- .packageHoverCardPathValue {
55
- width: 100%;
56
- padding: var(--space-xxxsmall);
57
- background: var(--color-highlight-warning);
58
- font-family: var(--font-family-monospace);
48
+ .root .packageName:hover,
49
+ .root .packageName:active,
50
+ .root .packageName:focus {
51
+ text-decoration: none;
59
52
  }
60
53
 
61
- .packageHoverCardList {
62
- padding: 0;
63
- list-style: inside;
54
+ .root .packageName:hover .packageNameLabel,
55
+ .root .packageName:active .packageNameLabel,
56
+ .root .packageName:focus .packageNameLabel {
57
+ text-decoration: underline;
64
58
  }
@@ -56,6 +56,7 @@
56
56
  max-width: 100%;
57
57
  padding: 0 2px;
58
58
  background: var(--color-highlight-warning);
59
+ line-height: var(--line-height);
59
60
  }
60
61
 
61
62
  .label {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { InsightType } from '@bundle-stats/utils';
4
4
 
5
- import { Icon } from '../../ui/icon';
5
+ import { Icon, IconGlyph } from '../../ui/icon';
6
6
  import css from './insight-icon.module.css';
7
7
 
8
8
  const InsightTypeIconMap = new Map([
@@ -19,7 +19,7 @@ export const InsightIcon = (props: InsightIconProps) => {
19
19
  const { className, type } = props;
20
20
  const resolvedType = Object.values(InsightType).includes(type) ? type : InsightType.WARNING;
21
21
  const rootClassName = cx(css.root, css[resolvedType], className);
22
- const glyph = InsightTypeIconMap.get(resolvedType) as string;
22
+ const glyph = InsightTypeIconMap.get(resolvedType) as IconGlyph;
23
23
 
24
24
  return <Icon glyph={glyph} className={rootClassName} />;
25
25
  };
@@ -4,7 +4,6 @@ import { formatDateTime } from '@bundle-stats/utils';
4
4
 
5
5
  import I18N from '../../i18n';
6
6
  import { FlexStack } from '../../layout/flex-stack';
7
- import { Stack } from '../../layout/stack';
8
7
  import { Icon } from '../../ui/icon';
9
8
  import { Tag } from '../../ui/tag';
10
9
  import css from './jobs-header.module.css';
@@ -44,14 +44,14 @@
44
44
  .titleTooltipIcon[aria-controls=""] {
45
45
  opacity: 0;
46
46
  visibility: none;
47
- transition: var(--ui-transition-out);
47
+ transition: opacity var(--transition-duration-out) ease-out, color var(--transition-duration-out) ease-out, visibility 0s;
48
48
  }
49
49
 
50
50
  .root:hover .titleHoverCardIcon span,
51
51
  .root:hover .titleTooltipIcon {
52
52
  opacity: 1;
53
53
  visibility: visible;
54
- transition: var(--ui-transition-in);
54
+ transition: opacity var(--transition-duration-in) ease-in, color var(--transition-duration-in) ease-in, visibility 0s;
55
55
  }
56
56
 
57
57
  /* Size variation */
@@ -1,11 +1,10 @@
1
- import React, { useCallback } from 'react';
1
+ import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import get from 'lodash/get';
4
4
  import { METRIC_COMPONENT_LINKS } from '@bundle-stats/utils';
5
5
 
6
6
  import { METRICS_WEBPACK_GENERAL } from '../../constants';
7
7
  import { Box } from '../../layout/box';
8
- import { FlexStack } from '../../layout/flex-stack';
9
8
  import { ComponentLink } from '../component-link';
10
9
  import { MetricRunInfo, MetricRunInfoProps } from '../metric-run-info';
11
10
  import css from './summary.module.css';
package/src/config.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "appName": "RelativeCI",
3
3
  "siteUrl": "https://relative-ci.com",
4
- "githubUrl": "https://github.com/relative-ci/bundle-stats",
4
+ "gitHubUrl": "https://github.com/relative-ci/bundle-stats",
5
5
  "documentation" : {
6
6
  "assets": "https://relative-ci.com/documentation/metrics-and-data#assets",
7
7
  "modules": "https://relative-ci.com/documentation/metrics-and-data#modules",
@@ -175,8 +175,10 @@
175
175
 
176
176
  --color-shadow: rgba(0, 0, 0, 0.2);
177
177
 
178
- --transition-in: all 0.2s ease-in;
179
- --transition-out: all 0.17s ease-out;
178
+ --transition-duration-in: 0.2s;
179
+ --transition-duration-out: 0.17s;
180
+ --transition-in: all var(--transition-duration-in) ease-in;
181
+ --transition-out: all var(--transition-duration-out) ease-out;
180
182
 
181
183
  --layer-xlow: 1;
182
184
  --layer-low: 10;
@@ -24,16 +24,15 @@ export const Footer = ({ className, version }) => (
24
24
  <div>
25
25
  <nav className={css.nav}>
26
26
  <ExternalLink
27
- href={config.githubUrl}
27
+ href={config.gitHubUrl}
28
28
  className={cx(css.navItem, css.navLink)}
29
29
  title="In-depth bundle analyzer for webpack(bundle size, assets, modules, packages)"
30
30
  >
31
- {`BundleStats `}
32
- {version}
31
+ {`BundleStats ${version}`}
33
32
  </ExternalLink>
34
33
  <span className={css.navItem}>
35
34
  <ExternalLink
36
- href={`${config.githubUrl}/issues`}
35
+ href={`${config.gitHubUrl}/issues`}
37
36
  className={css.navLink}
38
37
  title="Navigate to GitHub and open issue"
39
38
  >
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { Meta, Story } from '@storybook/react';
3
+
4
+ import { Icon } from '.';
5
+
6
+ export default {
7
+ title: 'UI/Icon',
8
+ component: Icon,
9
+ args: {
10
+ size: Icon.SIZE_MEDIUM,
11
+ },
12
+ argTypes: {
13
+ size: {
14
+ options: Object.values(Icon.SIZES),
15
+ control: { type: 'select' },
16
+ },
17
+ glyph: {
18
+ options: Object.values(Icon.ICONS),
19
+ control: { type: 'select' },
20
+ },
21
+ },
22
+ } as Meta;
23
+
24
+ const Template: Story = (args: any) => <Icon {...args} />;
25
+
26
+ export const Standard = Template.bind({});
27
+
28
+ Standard.args = {
29
+ glyph: Icon.ICONS.ARROW,
30
+ };
31
+
32
+ export const CustomSize = Template.bind({});
33
+
34
+ CustomSize.args = {
35
+ glyph: Icon.ICONS.ARROW,
36
+ size: Icon.SIZE_LARGE,
37
+ };
38
+
39
+ export const All = ({ size }: Pick<React.ComponentProps<typeof Icon>, 'size'>) => (
40
+ <>
41
+ {Object.values(Icon.ICONS).map((glyph) => (
42
+ <div
43
+ style={{
44
+ display: 'inline-block',
45
+ padding: '1rem',
46
+ textAlign: 'center',
47
+ }}
48
+ >
49
+ <Icon glyph={glyph} size={size} key={glyph} />
50
+ <code style={{ display: 'block' }}>{glyph}</code>
51
+ </div>
52
+ ))}
53
+ </>
54
+ );
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import cx from 'classnames';
4
3
 
5
4
  import css from './icon.module.css';
@@ -7,23 +6,38 @@ import css from './icon.module.css';
7
6
  const ICONS = {
8
7
  ARROW: 'arrow',
9
8
  ARROW_RIGHT_CIRLCE: 'arrow-right-circle',
10
- CANCEL: 'cancel',
9
+ CANCEL: 'close',
11
10
  CLOSE: 'close',
12
11
  CLOCK: 'clock',
13
12
  COMMIT: 'commit',
14
13
  ERROR: 'error',
15
14
  EXTERNAL_LINK: 'external-link',
16
15
  FILTER: 'filter',
16
+ GITHUB: 'github',
17
17
  INFO: 'info',
18
18
  HELP: 'help',
19
19
  MENU: 'menu',
20
20
  MORE_VERTICAL: 'more-vertical',
21
21
  SORT: 'sort',
22
22
  WARNING: 'warning',
23
- };
23
+ } as const;
24
+
25
+ const SIZE = {
26
+ SMALL: 'small',
27
+ MEDIUM: 'medium',
28
+ LARGE: 'large',
29
+ } as const;
30
+
31
+ export type IconGlyph = (typeof ICONS)[keyof typeof ICONS];
32
+
33
+ interface IconProps {
34
+ glyph: IconGlyph;
35
+ size?: (typeof SIZE)[keyof typeof SIZE];
36
+ as?: React.ElementType;
37
+ }
24
38
 
25
- export const Icon = (props) => {
26
- const { className, glyph, as: Component, size, ...restProps } = props;
39
+ export const Icon = (props: IconProps & React.ComponentProps<'span'>) => {
40
+ const { className = '', glyph, as: Component = 'span', size = SIZE.MEDIUM, ...restProps } = props;
27
41
 
28
42
  return (
29
43
  <Component className={cx(css.root, className, css[size])} {...restProps}>
@@ -36,20 +50,7 @@ export const Icon = (props) => {
36
50
 
37
51
  Icon.ICONS = ICONS;
38
52
 
39
- Icon.SIZE_SMALL = 'small';
40
- Icon.SIZE_MEDIUM = 'medium';
41
- Icon.SIZE_LARGE = 'large';
42
- Icon.SIZES = [Icon.SIZE_SMALL, Icon.SIZE_MEDIUM, Icon.SIZE_LARGE];
43
-
44
- Icon.defaultProps = {
45
- className: '',
46
- as: 'span',
47
- size: Icon.SIZE_MEDIUM,
48
- };
49
-
50
- Icon.propTypes = {
51
- className: PropTypes.string,
52
- glyph: PropTypes.oneOfType([PropTypes.oneOf(Object.values(ICONS)), PropTypes.node]).isRequired,
53
- as: PropTypes.node,
54
- size: PropTypes.oneOf(Icon.SIZES),
55
- };
53
+ Icon.SIZE_SMALL = SIZE.SMALL;
54
+ Icon.SIZE_MEDIUM = SIZE.MEDIUM;
55
+ Icon.SIZE_LARGE = SIZE.LARGE;
56
+ Icon.SIZES = Object.values(SIZE);
@@ -1,17 +1,7 @@
1
- export function Header({ className, jobs }: {
2
- className: any;
3
- jobs: any;
4
- }): JSX.Element;
5
- export namespace Header {
6
- namespace propTypes {
7
- let className: PropTypes.Requireable<string>;
8
- let jobs: PropTypes.Requireable<(object | null | undefined)[]>;
9
- }
10
- namespace defaultProps {
11
- let className_1: string;
12
- export { className_1 as className };
13
- let jobs_1: null;
14
- export { jobs_1 as jobs };
15
- }
1
+ import React from 'react';
2
+ import { JobsHeader } from '../../components/jobs-header';
3
+ interface HeaderProps {
4
+ jobs: React.ComponentProps<typeof JobsHeader>['jobs'];
16
5
  }
17
- import PropTypes from 'prop-types';
6
+ export declare const Header: ({ className, jobs }: HeaderProps & React.ComponentProps<'header'>) => JSX.Element;
7
+ export {};
@@ -1 +1 @@
1
- export * from "./header";
1
+ export * from './header';
@@ -1,42 +1,56 @@
1
- export function Icon(props: any): JSX.Element;
2
- export namespace Icon {
3
- export { ICONS };
4
- export let SIZE_SMALL: string;
5
- export let SIZE_MEDIUM: string;
6
- export let SIZE_LARGE: string;
7
- export let SIZES: string[];
8
- export namespace defaultProps {
9
- export let className: string;
10
- export let as: string;
11
- import size = Icon.SIZE_MEDIUM;
12
- export { size };
13
- }
14
- export namespace propTypes {
15
- let className_1: PropTypes.Requireable<string>;
16
- export { className_1 as className };
17
- export let glyph: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
18
- let as_1: PropTypes.Requireable<PropTypes.ReactNodeLike>;
19
- export { as_1 as as };
20
- let size_1: PropTypes.Requireable<string>;
21
- export { size_1 as size };
22
- }
1
+ import React from 'react';
2
+ declare const ICONS: {
3
+ readonly ARROW: "arrow";
4
+ readonly ARROW_RIGHT_CIRLCE: "arrow-right-circle";
5
+ readonly CANCEL: "close";
6
+ readonly CLOSE: "close";
7
+ readonly CLOCK: "clock";
8
+ readonly COMMIT: "commit";
9
+ readonly ERROR: "error";
10
+ readonly EXTERNAL_LINK: "external-link";
11
+ readonly FILTER: "filter";
12
+ readonly GITHUB: "github";
13
+ readonly INFO: "info";
14
+ readonly HELP: "help";
15
+ readonly MENU: "menu";
16
+ readonly MORE_VERTICAL: "more-vertical";
17
+ readonly SORT: "sort";
18
+ readonly WARNING: "warning";
19
+ };
20
+ declare const SIZE: {
21
+ readonly SMALL: "small";
22
+ readonly MEDIUM: "medium";
23
+ readonly LARGE: "large";
24
+ };
25
+ export type IconGlyph = (typeof ICONS)[keyof typeof ICONS];
26
+ interface IconProps {
27
+ glyph: IconGlyph;
28
+ size?: (typeof SIZE)[keyof typeof SIZE];
29
+ as?: React.ElementType;
23
30
  }
24
- declare namespace ICONS {
25
- let ARROW: string;
26
- let ARROW_RIGHT_CIRLCE: string;
27
- let CANCEL: string;
28
- let CLOSE: string;
29
- let CLOCK: string;
30
- let COMMIT: string;
31
- let ERROR: string;
32
- let EXTERNAL_LINK: string;
33
- let FILTER: string;
34
- let INFO: string;
35
- let HELP: string;
36
- let MENU: string;
37
- let MORE_VERTICAL: string;
38
- let SORT: string;
39
- let WARNING: string;
40
- }
41
- import PropTypes from 'prop-types';
31
+ export declare const Icon: {
32
+ (props: IconProps & React.ComponentProps<'span'>): JSX.Element;
33
+ ICONS: {
34
+ readonly ARROW: "arrow";
35
+ readonly ARROW_RIGHT_CIRLCE: "arrow-right-circle";
36
+ readonly CANCEL: "close";
37
+ readonly CLOSE: "close";
38
+ readonly CLOCK: "clock";
39
+ readonly COMMIT: "commit";
40
+ readonly ERROR: "error";
41
+ readonly EXTERNAL_LINK: "external-link";
42
+ readonly FILTER: "filter";
43
+ readonly GITHUB: "github";
44
+ readonly INFO: "info";
45
+ readonly HELP: "help";
46
+ readonly MENU: "menu";
47
+ readonly MORE_VERTICAL: "more-vertical";
48
+ readonly SORT: "sort";
49
+ readonly WARNING: "warning";
50
+ };
51
+ SIZE_SMALL: "small";
52
+ SIZE_MEDIUM: "medium";
53
+ SIZE_LARGE: "large";
54
+ SIZES: ("small" | "medium" | "large")[];
55
+ };
42
56
  export {};
@@ -1 +1 @@
1
- export * from "./icon";
1
+ export * from './icon';
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
-
5
- import { Container } from '../../ui/container';
6
- import { JobsHeader } from '../../components/jobs-header';
7
- import css from './header.module.css';
8
-
9
- export const Header = ({ className, jobs }) => (
10
- <Container as="header" className={cx(css.root, className)}>
11
- <div className={css.inner}>
12
- <JobsHeader className={css.jobs} jobs={jobs} />
13
- </div>
14
- </Container>
15
- );
16
-
17
- Header.propTypes = {
18
- className: PropTypes.string,
19
- jobs: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types
20
- };
21
-
22
- Header.defaultProps = {
23
- className: '',
24
- jobs: null,
25
- };
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x-circle"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>
File without changes
File without changes