@bundle-stats/ui 4.16.0-beta.0 → 4.16.0-beta.2

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 (152) hide show
  1. package/lib/assets/icons.svg +6 -1
  2. package/lib/assets/icons.svg.js +3 -0
  3. package/lib/assets/icons.svg.js.map +1 -1
  4. package/lib/components/bundle-assets/bundle-assets.js +9 -2
  5. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  6. package/lib/components/bundle-assets-totals/bundle-assets-totals.js +21 -9
  7. package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  8. package/lib/components/bundle-modules/bundle-modules.js +9 -2
  9. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  10. package/lib/components/bundle-packages/bundle-packages.js +9 -2
  11. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  12. package/lib/components/entry-info/entry-info.js +2 -2
  13. package/lib/components/entry-info/entry-info.js.map +1 -1
  14. package/lib/components/metrics-table-export/index.js +18 -0
  15. package/lib/components/metrics-table-export/index.js.map +1 -0
  16. package/lib/components/metrics-table-export/metrics-table-export.js +86 -0
  17. package/lib/components/metrics-table-export/metrics-table-export.js.map +1 -0
  18. package/lib/components/metrics-table-export/metrics-table-export.module.css +8 -0
  19. package/lib/components/metrics-table-options/index.js.map +1 -1
  20. package/lib/components/metrics-table-options/metrics-table-options.js +7 -15
  21. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  22. package/lib/components/preview-source/index.js +18 -0
  23. package/lib/components/preview-source/index.js.map +1 -0
  24. package/lib/components/preview-source/preview-source.js +25 -0
  25. package/lib/components/preview-source/preview-source.js.map +1 -0
  26. package/lib/components/preview-source/preview-source.module.css +28 -0
  27. package/lib/css/variables.css +1 -0
  28. package/lib/i18n.js +3 -0
  29. package/lib/i18n.js.map +1 -1
  30. package/lib/ui/button/button.js +2 -1
  31. package/lib/ui/button/button.js.map +1 -1
  32. package/lib/ui/copy-to-clipboard/copy-to-clipboard.js +2 -6
  33. package/lib/ui/copy-to-clipboard/copy-to-clipboard.js.map +1 -1
  34. package/lib/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
  35. package/lib/ui/dialog/dialog.js +27 -0
  36. package/lib/ui/dialog/dialog.js.map +1 -0
  37. package/lib/ui/dialog/dialog.module.css +89 -0
  38. package/lib/ui/dialog/index.js +18 -0
  39. package/lib/ui/dialog/index.js.map +1 -0
  40. package/lib/ui/icon/icon.js +1 -0
  41. package/lib/ui/icon/icon.js.map +1 -1
  42. package/lib/ui/index.js +5 -1
  43. package/lib/ui/index.js.map +1 -1
  44. package/lib/ui/tabs/tabs.js +2 -2
  45. package/lib/ui/tabs/tabs.js.map +1 -1
  46. package/lib/ui/textarea/index.js +18 -0
  47. package/lib/ui/textarea/index.js.map +1 -0
  48. package/lib/ui/textarea/textarea.js +16 -0
  49. package/lib/ui/textarea/textarea.js.map +1 -0
  50. package/lib/ui/textarea/textarea.module.css +64 -0
  51. package/lib-esm/assets/icons.svg +6 -1
  52. package/lib-esm/assets/icons.svg.js +3 -0
  53. package/lib-esm/assets/icons.svg.js.map +1 -1
  54. package/lib-esm/components/bundle-assets/bundle-assets.js +9 -2
  55. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  56. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +21 -9
  57. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  58. package/lib-esm/components/bundle-modules/bundle-modules.js +9 -2
  59. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  60. package/lib-esm/components/bundle-packages/bundle-packages.js +9 -2
  61. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  62. package/lib-esm/components/entry-info/entry-info.js +2 -2
  63. package/lib-esm/components/entry-info/entry-info.js.map +1 -1
  64. package/lib-esm/components/metrics-table-export/index.js +2 -0
  65. package/lib-esm/components/metrics-table-export/index.js.map +1 -0
  66. package/lib-esm/components/metrics-table-export/metrics-table-export.js +61 -0
  67. package/lib-esm/components/metrics-table-export/metrics-table-export.js.map +1 -0
  68. package/lib-esm/components/metrics-table-export/metrics-table-export.module.css +8 -0
  69. package/lib-esm/components/metrics-table-options/index.js.map +1 -1
  70. package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -15
  71. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  72. package/lib-esm/components/preview-source/index.js +2 -0
  73. package/lib-esm/components/preview-source/index.js.map +1 -0
  74. package/lib-esm/components/preview-source/preview-source.js +18 -0
  75. package/lib-esm/components/preview-source/preview-source.js.map +1 -0
  76. package/lib-esm/components/preview-source/preview-source.module.css +28 -0
  77. package/lib-esm/css/variables.css +1 -0
  78. package/lib-esm/i18n.js +3 -0
  79. package/lib-esm/i18n.js.map +1 -1
  80. package/lib-esm/ui/button/button.js +1 -0
  81. package/lib-esm/ui/button/button.js.map +1 -1
  82. package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.js +2 -6
  83. package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.js.map +1 -1
  84. package/lib-esm/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
  85. package/lib-esm/ui/dialog/dialog.js +19 -0
  86. package/lib-esm/ui/dialog/dialog.js.map +1 -0
  87. package/lib-esm/ui/dialog/dialog.module.css +89 -0
  88. package/lib-esm/ui/dialog/index.js +2 -0
  89. package/lib-esm/ui/dialog/index.js.map +1 -0
  90. package/lib-esm/ui/icon/icon.js +1 -0
  91. package/lib-esm/ui/icon/icon.js.map +1 -1
  92. package/lib-esm/ui/index.js +2 -0
  93. package/lib-esm/ui/index.js.map +1 -1
  94. package/lib-esm/ui/tabs/tabs.js +2 -2
  95. package/lib-esm/ui/tabs/tabs.js.map +1 -1
  96. package/lib-esm/ui/textarea/index.js +2 -0
  97. package/lib-esm/ui/textarea/index.js.map +1 -0
  98. package/lib-esm/ui/textarea/textarea.js +9 -0
  99. package/lib-esm/ui/textarea/textarea.js.map +1 -0
  100. package/lib-esm/ui/textarea/textarea.module.css +64 -0
  101. package/package.json +13 -13
  102. package/src/assets/icons/download.svg +4 -0
  103. package/src/assets/icons.svg +6 -1
  104. package/src/assets/icons.svg.jsx +9 -0
  105. package/src/components/bundle-assets/bundle-assets.jsx +15 -2
  106. package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +54 -35
  107. package/src/components/bundle-modules/bundle-modules.tsx +15 -2
  108. package/src/components/bundle-packages/bundle-packages.jsx +15 -2
  109. package/src/components/entry-info/entry-info.tsx +2 -2
  110. package/src/components/metrics-table-export/index.ts +1 -0
  111. package/src/components/metrics-table-export/metrics-table-export.module.css +8 -0
  112. package/src/components/metrics-table-export/metrics-table-export.stories.tsx +30 -0
  113. package/src/components/metrics-table-export/metrics-table-export.tsx +103 -0
  114. package/src/components/metrics-table-options/metrics-table-options.stories.tsx +22 -0
  115. package/src/components/metrics-table-options/metrics-table-options.tsx +25 -0
  116. package/src/components/preview-source/index.ts +1 -0
  117. package/src/components/preview-source/preview-source.module.css +28 -0
  118. package/src/components/preview-source/preview-source.stories.tsx +35 -0
  119. package/src/components/preview-source/preview-source.tsx +47 -0
  120. package/src/css/variables.css +1 -0
  121. package/src/i18n.js +4 -0
  122. package/src/ui/button/button.tsx +2 -1
  123. package/src/ui/copy-to-clipboard/copy-to-clipboard.module.css +5 -48
  124. package/src/ui/copy-to-clipboard/copy-to-clipboard.tsx +4 -8
  125. package/src/ui/dialog/dialog.module.css +89 -0
  126. package/src/ui/dialog/dialog.stories.tsx +67 -0
  127. package/src/ui/dialog/dialog.tsx +62 -0
  128. package/src/ui/dialog/index.ts +1 -0
  129. package/src/ui/icon/icon.tsx +1 -0
  130. package/src/ui/index.js +2 -0
  131. package/src/ui/tabs/tabs.jsx +2 -2
  132. package/src/ui/textarea/index.ts +1 -0
  133. package/src/ui/textarea/textarea.module.css +64 -0
  134. package/src/ui/textarea/textarea.stories.tsx +37 -0
  135. package/src/ui/textarea/textarea.tsx +23 -0
  136. package/types/components/metrics-table-export/index.d.ts +1 -0
  137. package/types/components/metrics-table-export/metrics-table-export.d.ts +10 -0
  138. package/types/components/metrics-table-options/index.d.ts +1 -1
  139. package/types/components/metrics-table-options/metrics-table-options.d.ts +9 -17
  140. package/types/components/preview-source/index.d.ts +1 -0
  141. package/types/components/preview-source/preview-source.d.ts +8 -0
  142. package/types/i18n.d.ts +3 -0
  143. package/types/ui/button/button.d.ts +26 -0
  144. package/types/ui/dialog/dialog.d.ts +13 -0
  145. package/types/ui/dialog/index.d.ts +1 -0
  146. package/types/ui/icon/icon.d.ts +2 -0
  147. package/types/ui/index.d.ts +2 -0
  148. package/types/ui/tabs/tabs.d.ts +3 -3
  149. package/types/ui/textarea/index.d.ts +1 -0
  150. package/types/ui/textarea/textarea.d.ts +7 -0
  151. package/src/components/metrics-table-options/metrics-table-options.jsx +0 -30
  152. /package/src/components/metrics-table-options/{index.js → index.ts} +0 -0
@@ -1,58 +1,15 @@
1
1
  .root {
2
- padding: var(--space-xxxsmall);
3
- }
4
-
5
- .wrapper {
6
- display: flex;
7
- gap: var(--space-xxsmall);
8
- align-items: center;
9
- }
10
-
11
- .content {
12
- flex: 1 1 auto;
13
2
  white-space: nowrap;
14
- line-height: 1.1;
15
- }
16
-
17
- .icon {
18
- flex: 0 0 auto;
19
- position: relative;
20
- width: var(--space-small);
21
- height: var(--space-small);
22
- }
23
-
24
- .iconCopy,
25
- .iconDone {
26
- position: absolute;
27
- top: 0;
28
- left: 0;
29
- }
30
-
31
- .iconCopy {
32
- color: var(--color-text-ultra-light);
33
- }
34
-
35
- .iconDone {
36
- color: var(--color-success);
3
+ /** override tooltip styles */
4
+ color: var(--color-text-ultra-light) !important;
37
5
  }
38
6
 
39
7
  /** done state */
40
- .iconCopy {
41
- opacity: 1;
42
- transition: var(--ui-transition-out);
43
- }
44
-
45
- .iconDone {
46
- opacity: 0;
8
+ .root svg {
47
9
  transition: var(--ui-transition-out);
48
10
  }
49
11
 
50
- .done .iconCopy {
51
- opacity: 0;
52
- transition: var(--ui-transition-in);
53
- }
54
-
55
- .done .iconDone {
56
- opacity: 1;
12
+ .done svg {
13
+ color: var(--color-success);
57
14
  transition: var(--ui-transition-in);
58
15
  }
@@ -3,6 +3,7 @@ import React, { useCallback, useState } from 'react';
3
3
  import cx from 'classnames';
4
4
  import { useCopyToClipboard } from 'react-use';
5
5
 
6
+ import I18N from '../../i18n';
6
7
  import { Button } from '../button';
7
8
  import { Icon } from '../icon';
8
9
  import { Tooltip } from '../tooltip';
@@ -38,20 +39,15 @@ export const CopyToClipboard = (props: CopyToClipboardProps) => {
38
39
 
39
40
  return (
40
41
  <Tooltip
41
- title={doneTimeout ? 'Copied' : 'Copy to clipboard'}
42
+ title={doneTimeout ? I18N.COPY_TO_CLIPBOARD_DONE : I18N.COPY_TO_CLIPBOARD}
42
43
  as={Button}
43
44
  type="button"
45
+ rightGlyph={doneTimeout ? Icon.ICONS.CLIPBOARD_CHECK : Icon.ICONS.CLIPBOARD}
44
46
  onClick={handleOnClick}
45
47
  className={rootClassName}
46
48
  {...restProps}
47
49
  >
48
- <span className={css.wrapper}>
49
- {children && <span className={css.content}>{children}</span>}
50
- <span className={css.icon}>
51
- <Icon className={css.iconCopy} glyph={Icon.ICONS.CLIPBOARD} />
52
- <Icon className={css.iconDone} glyph={Icon.ICONS.CLIPBOARD_CHECK} />
53
- </span>
54
- </span>
50
+ {children}
55
51
  </Tooltip>
56
52
  );
57
53
  };
@@ -0,0 +1,89 @@
1
+ .backdrop {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ z-index: 99999 !important;
6
+ }
7
+
8
+ .backdrop::before {
9
+ content: ' ';
10
+ position: absolute;
11
+ left: 0;
12
+ top: 0;
13
+ width: 100%;
14
+ height: 100%;
15
+ background: var(--color-backdrop);
16
+ filter:
17
+ }
18
+
19
+ .dialog {
20
+ --dialog-header-height: var(--space-medium);
21
+ --dialog-vspace: var(--space-xsmall);
22
+ --dialog-padding: var(--space-xsmall);
23
+
24
+ width: calc(100vw - 2 * var(--dialog-padding));
25
+ position: relative;
26
+ border-radius: var(--radius-medium);
27
+ padding: var(--dialog-padding);
28
+ background: var(--color-background);
29
+ box-shadow: 0 0 var(--space-medium) var(--color-shadow);
30
+ }
31
+
32
+ .header {
33
+ min-height: var(--dialog-header-height);
34
+ }
35
+
36
+ .header:empty {
37
+ display: none;
38
+ }
39
+
40
+ .headerClose {
41
+ position: absolute;
42
+ right: var(--space-xxsmall);
43
+ top: var(--space-xxsmall);
44
+ padding: var(--space-xxxsmall);
45
+ flex: 0 0 auto;
46
+ color: var(--color-outline-dark);
47
+ }
48
+
49
+ .headerClose:hover,
50
+ .headerClose:focus,
51
+ .headerClose:active {
52
+ color: var(--color-text-ultra-light);
53
+ }
54
+
55
+ .content {
56
+ width: 100%;
57
+ max-height: calc(100vh - 2 * var(--space-medium) - 2 * var(--dialog-padding) - var(--dialog-header-height) - var(--dialog-vspace));
58
+ padding-bottom: 0.3em; /* extra space to compensate for the title line-height and allow to show focus state correctly on buttons */
59
+ overflow: auto;
60
+ }
61
+
62
+ /** Width variation */
63
+ .width--narrow {
64
+ max-width: 480px;
65
+ }
66
+
67
+ .width--medium {
68
+ max-width: 748px;
69
+ }
70
+
71
+ .width--wide {
72
+ max-width: 1024px;
73
+ }
74
+
75
+ .width--extra-wide {
76
+ max-width: var(--max-width);
77
+ }
78
+
79
+ /** Center variation */
80
+ .center {
81
+ text-align: center;
82
+ }
83
+
84
+ @media (min-width: 768px) {
85
+ .dialog {
86
+ --dialog-vspace: var(--space-medium);
87
+ --dialog-padding: var(--space-large);
88
+ }
89
+ }
@@ -0,0 +1,67 @@
1
+ import React, { Fragment } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { Dropdown, DropdownItem } from '../dropdown';
5
+ import { Button } from '../button';
6
+ import { Dialog, useDialogState } from '.';
7
+
8
+ const meta: Meta<typeof Dialog> = {
9
+ title: 'UI/Dialog',
10
+ component: Dialog,
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Default: Story = {
18
+ render: function DefaultDialog() {
19
+ const dialog = useDialogState();
20
+
21
+ return (
22
+ <>
23
+ <Button type="button" onClick={dialog.toggle}>
24
+ Open
25
+ </Button>
26
+ <Dialog title="Title" state={dialog}>
27
+ <div style={{ maxWidth: 480 }}>
28
+ <Dropdown label="Select option">
29
+ <DropdownItem>Option 1</DropdownItem>
30
+ <DropdownItem>Option 2</DropdownItem>
31
+ <DropdownItem>Option 3</DropdownItem>
32
+ </Dropdown>
33
+ <br />
34
+ <br />
35
+ {[1, 2, 3].map((item) => (
36
+ <Fragment key={item}>
37
+ <p>
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vulputate, lectus
39
+ vitae tristique facilisis, quam ex vulputate risus, vitae mattis eros diam quis
40
+ velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames
41
+ ac turpis egestas. Sed et velit tortor. Suspendisse risus ipsum, convallis
42
+ ultricies justo vel, auctor semper est. Sed viverra pulvinar odio eget pharetra.
43
+ In eleifend felis nec odio convallis, eleifend rhoncus diam maximus. Cras diam
44
+ libero, egestas blandit vestibulum nec, volutpat a mi. Etiam blandit turpis ac
45
+ nulla molestie vehicula. Duis bibendum a nisl sollicitudin lobortis. Vestibulum
46
+ lobortis eget justo ac elementum. Vestibulum vel lorem arcu. Etiam sagittis luctus
47
+ justo eu interdum. Ut lobortis tempus turpis, vitae auctor elit congue id.
48
+ </p>
49
+ <br />
50
+ <p>
51
+ Nulla eu ullamcorper quam. Mauris rhoncus tristique dui in rutrum. Ut eget justo a
52
+ lorem efficitur consequat. Nunc sed erat at ipsum convallis iaculis at ac lacus.
53
+ Etiam pellentesque felis quis maximus ultrices. Vivamus non pretium quam. Aenean
54
+ vel nunc fringilla, lacinia felis a, vehicula purus. Vestibulum in varius purus.
55
+ Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos
56
+ himenaeos. Quisque laoreet ultrices ligula eget iaculis. Vivamus lacinia ante
57
+ mattis lorem ultricies consequat. Integer dui odio, semper ac neque vitae,
58
+ elementum hendrerit ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
59
+ </p>
60
+ </Fragment>
61
+ ))}
62
+ </div>
63
+ </Dialog>
64
+ </>
65
+ );
66
+ },
67
+ };
@@ -0,0 +1,62 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import React from 'react';
3
+ import cx from 'classnames';
4
+ import { Dialog as AriakitDialog, DialogDismiss as AriakitDialogDismiss } from 'ariakit/dialog';
5
+
6
+ import { Stack } from '../../layout/stack';
7
+ import { BUTTON_GLYPHS, Button } from '../button';
8
+ import css from './dialog.module.css';
9
+
10
+ export { useDialogState } from 'ariakit/dialog';
11
+
12
+ type AriakitDialogProps = ComponentProps<typeof AriakitDialog>;
13
+
14
+ type DialogProps = {
15
+ title?: ReactNode;
16
+ width?: 'narrow' | 'medium' | 'wide' | 'extra-wide';
17
+ center?: boolean;
18
+ modal?: AriakitDialogProps['modal'];
19
+ state: AriakitDialogProps['state'];
20
+ } & Omit<ComponentProps<'div'>, 'title'>;
21
+
22
+ export const Dialog = (props: DialogProps) => {
23
+ const {
24
+ state,
25
+ className = '',
26
+ title = '',
27
+ width = 'medium',
28
+ center = false,
29
+ modal = false,
30
+ children,
31
+ } = props;
32
+
33
+ const rootClassName = cx(css.dialog, width && css[`width--${width}`], center && css.center);
34
+
35
+ return (
36
+ <AriakitDialog
37
+ state={state}
38
+ modal={modal}
39
+ backdrop
40
+ backdropProps={{
41
+ className: css.backdrop,
42
+ }}
43
+ portal
44
+ className={rootClassName}
45
+ >
46
+ {!modal && (
47
+ <AriakitDialogDismiss as={Button} glyph={BUTTON_GLYPHS.CLOSE} className={css.headerClose}>
48
+ {/* null content to prevent DialogDismiss to render the default "x" */}
49
+ {null}
50
+ </AriakitDialogDismiss>
51
+ )}
52
+ <Stack space="medium">
53
+ {title && (
54
+ <header className={css.header}>
55
+ {typeof title === 'string' ? <h2>{title}</h2> : title}
56
+ </header>
57
+ )}
58
+ <div className={cx(css.content, className)}>{children}</div>
59
+ </Stack>
60
+ </AriakitDialog>
61
+ );
62
+ };
@@ -0,0 +1 @@
1
+ export * from './dialog';
@@ -15,6 +15,7 @@ const ICONS = {
15
15
  COMMIT: 'commit',
16
16
  CLIPBOARD: 'clipboard',
17
17
  CLIPBOARD_CHECK: 'clipboard-check',
18
+ DOWNLOAD: 'download',
18
19
  ERROR: 'error',
19
20
  EXTERNAL_LINK: 'external-link',
20
21
  FILTER: 'filter',
package/src/ui/index.js CHANGED
@@ -3,6 +3,7 @@ export { Button } from './button';
3
3
  export { CopyToClipboard } from './copy-to-clipboard';
4
4
  export { Container } from './container';
5
5
  export { ControlGroup } from './control-group';
6
+ export { Dialog } from './dialog';
6
7
  export { Dropdown } from './dropdown';
7
8
  export { EmptySet } from './empty-set';
8
9
  export { FileName } from './file-name';
@@ -16,4 +17,5 @@ export { Skeleton } from './skeleton';
16
17
  export { Table } from './table';
17
18
  export { Tabs } from './tabs';
18
19
  export { Tag } from './tag';
20
+ export { Textarea } from './textarea';
19
21
  export { Tooltip } from './tooltip';
@@ -4,7 +4,7 @@ import cx from 'classnames';
4
4
 
5
5
  import css from './tabs.module.css';
6
6
 
7
- const Item = ({ isTabActive, as: Component, className,...restProps }) => (
7
+ const Item = ({ isTabActive, as: Component = 'span', className = '', ...restProps }) => (
8
8
  <Component className={cx(css.item, className, isTabActive && css.itemActive)} {...restProps} />
9
9
  );
10
10
 
@@ -20,7 +20,7 @@ Item.propTypes = {
20
20
  as: PropTypes.elementType,
21
21
  };
22
22
 
23
- export const Tabs = ({ className, ...restProps }) => (
23
+ export const Tabs = ({ className = '', ...restProps }) => (
24
24
  <nav className={cx(css.root, className)} {...restProps} />
25
25
  );
26
26
 
@@ -0,0 +1 @@
1
+ export * from './textarea';
@@ -0,0 +1,64 @@
1
+ .root {
2
+ border: 1px solid var(--color-outline);
3
+ border-radius: var(--radius-small);
4
+ color: var(--color-text-light);
5
+ width: 100%;
6
+ resize: vertical;
7
+ transition: var(--transition-in);
8
+ appearance: none;
9
+ outline: none;
10
+ }
11
+
12
+ .root::-webkit-input-placeholder {
13
+ color: var(--color-text-light);
14
+ }
15
+
16
+ .root::-moz-placeholder {
17
+ color: var(--color-text-light);
18
+ }
19
+
20
+ .root:-ms-input-placeholder {
21
+ color: var(--color-text-light);
22
+ }
23
+
24
+ .root:-moz-placeholder {
25
+ color: var(--color-text-light);
26
+ }
27
+
28
+ .root:focus {
29
+ box-shadow: var(--outline-hover);
30
+ border-color: var(--color-outline-dark);
31
+ color: inherit;
32
+ transition: var(--transition-out);
33
+ }
34
+
35
+ .root[readonly=""] {
36
+ color: var(--color-text-light);
37
+ }
38
+
39
+ /**
40
+ * Source variation
41
+ */
42
+ .previewSource {
43
+ font-family: var(--font-family-fixed);
44
+ }
45
+
46
+ /** Size modifier */
47
+ /* default - medium */
48
+ .root {
49
+ padding: var(--space-xsmall);
50
+ font-size: var(--size-medium);
51
+ line-height: calc(var(--space-medium) - 2px);
52
+ }
53
+
54
+ .small {
55
+ padding: var(--space-xxsmall);
56
+ font-size: var(--size-small);
57
+ line-height: calc(var(--space-small) - 2px);
58
+ }
59
+
60
+ .large {
61
+ padding: var(--space-small);
62
+ font-size: var(--size-large);
63
+ line-height: calc(var(--space-large) - 2px);
64
+ }
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { Textarea } from '.';
4
+
5
+ const meta: Meta<typeof Textarea> = {
6
+ title: 'UI/Textarea',
7
+ component: Textarea,
8
+ args: {
9
+ placeholder: 'Enter value',
10
+ },
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Default: Story = {};
18
+
19
+ export const SizeSmall: Story = {
20
+ args: {
21
+ size: 'small',
22
+ },
23
+ };
24
+
25
+ export const ReadOnly: Story = {
26
+ args: {
27
+ readOnly: true,
28
+ defaultValue: 'Lorem ipsum dolor sit amed',
29
+ },
30
+ };
31
+ export const PreviewSource: Story = {
32
+ args: {
33
+ previewSource: true,
34
+ rows: 6,
35
+ defaultValue: JSON.stringify(ReadOnly, null, 2),
36
+ },
37
+ };
@@ -0,0 +1,23 @@
1
+ import type { ComponentProps } from 'react';
2
+ import React from 'react';
3
+ import cx from 'classnames';
4
+
5
+ import css from './textarea.module.css';
6
+
7
+ export type TextareaProps = {
8
+ previewSource?: boolean;
9
+ size?: 'small' | 'medium' | 'large';
10
+ } & ComponentProps<'textarea'>;
11
+
12
+ export const Textarea = (props: TextareaProps) => {
13
+ const { className = '', previewSource = false, size = '', ...restProps } = props;
14
+
15
+ const rootClassName = cx(
16
+ css.root,
17
+ previewSource && css.previewSource,
18
+ size && css[size],
19
+ className,
20
+ );
21
+
22
+ return <textarea className={rootClassName} {...restProps} />;
23
+ };
@@ -0,0 +1 @@
1
+ export * from './metrics-table-export';
@@ -0,0 +1,10 @@
1
+ import type { ComponentProps } from 'react';
2
+ import React from 'react';
3
+ import type { ReportMetricRow } from '@bundle-stats/utils';
4
+ import { Stack } from '../../layout/stack';
5
+ type MetricsTableExportProps = {
6
+ items: Array<ReportMetricRow>;
7
+ download: string;
8
+ } & ComponentProps<typeof Stack>;
9
+ export declare const MetricsTableExport: (props: MetricsTableExportProps) => React.JSX.Element;
10
+ export {};
@@ -1 +1 @@
1
- export * from "./metrics-table-options";
1
+ export * from './metrics-table-options';
@@ -1,18 +1,10 @@
1
- export function MetricsTableOptions(props: any): React.JSX.Element;
2
- export namespace MetricsTableOptions {
3
- namespace propTypes {
4
- let className: PropTypes.Requireable<string>;
5
- let handleViewAll: PropTypes.Requireable<(...args: any[]) => any>;
6
- let handleResetFilters: PropTypes.Requireable<(...args: any[]) => any>;
7
- }
8
- namespace defaultProps {
9
- let className_1: string;
10
- export { className_1 as className };
11
- let handleViewAll_1: null;
12
- export { handleViewAll_1 as handleViewAll };
13
- let handleResetFilters_1: null;
14
- export { handleResetFilters_1 as handleResetFilters };
15
- }
16
- }
1
+ import type { ComponentProps } from 'react';
17
2
  import React from 'react';
18
- import PropTypes from 'prop-types';
3
+ import { Dropdown } from '../../ui/dropdown';
4
+ type MetricsTableOptionsProps = {
5
+ onViewAllClick?: () => void;
6
+ onResetClick?: () => void;
7
+ onExportClick?: () => void;
8
+ } & ComponentProps<typeof Dropdown>;
9
+ export declare const MetricsTableOptions: (props: MetricsTableOptionsProps) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export * from './preview-source';
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps } from 'react';
2
+ import React from 'react';
3
+ type PreviewSourceProps = {
4
+ source: string;
5
+ download?: string;
6
+ } & ComponentProps<'div'>;
7
+ export declare const PreviewSource: (props: PreviewSourceProps) => React.JSX.Element;
8
+ export {};
package/types/i18n.d.ts CHANGED
@@ -14,6 +14,9 @@ declare namespace _default {
14
14
  let PACKAGES_INFO: string;
15
15
  let RESET_FILTERS: string;
16
16
  let VIEW_ALL: string;
17
+ let EXPORT: string;
18
+ let COPY_TO_CLIPBOARD: string;
19
+ let COPY_TO_CLIPBOARD_DONE: string;
17
20
  let GITHUB_LINK_TITLE: string;
18
21
  let REPORT_ISSUE: string;
19
22
  let REPORT_ISSUE_LINK_TITLE: string;
@@ -13,6 +13,32 @@ export declare const BUTTON_KIND: {
13
13
  readonly INFO: "info";
14
14
  readonly SUCCES: "success";
15
15
  };
16
+ export declare const BUTTON_GLYPHS: {
17
+ readonly ARROW: "arrow";
18
+ readonly ARROW_RIGHT_CIRCLE: "arrow-right-circle";
19
+ readonly CANCEL: "close";
20
+ readonly CHEVRON_DOWN: "chevron-down";
21
+ readonly CHEVRON_UP: "chevron-up";
22
+ readonly CHECK: "check";
23
+ readonly CLOSE: "close";
24
+ readonly CLOCK: "clock";
25
+ readonly COMMIT: "commit";
26
+ readonly CLIPBOARD: "clipboard";
27
+ readonly CLIPBOARD_CHECK: "clipboard-check";
28
+ readonly DOWNLOAD: "download";
29
+ readonly ERROR: "error";
30
+ readonly EXTERNAL_LINK: "external-link";
31
+ readonly FILTER: "filter";
32
+ readonly GITHUB: "github";
33
+ readonly INFO: "info";
34
+ readonly HELP: "help";
35
+ readonly TABLE: "table";
36
+ readonly TREEMAP: "treemap";
37
+ readonly MENU: "menu";
38
+ readonly MORE_VERTICAL: "more-vertical";
39
+ readonly SORT: "sort";
40
+ readonly WARNING: "warning";
41
+ };
16
42
  type Size = (typeof BUTTON_SIZE)[keyof typeof BUTTON_SIZE];
17
43
  type Kind = (typeof BUTTON_KIND)[keyof typeof BUTTON_KIND];
18
44
  interface ButtonProps<T extends React.ElementType> {
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import React from 'react';
3
+ import { Dialog as AriakitDialog } from 'ariakit/dialog';
4
+ export { useDialogState } from 'ariakit/dialog';
5
+ type AriakitDialogProps = ComponentProps<typeof AriakitDialog>;
6
+ type DialogProps = {
7
+ title?: ReactNode;
8
+ width?: 'narrow' | 'medium' | 'wide' | 'extra-wide';
9
+ center?: boolean;
10
+ modal?: AriakitDialogProps['modal'];
11
+ state: AriakitDialogProps['state'];
12
+ } & Omit<ComponentProps<'div'>, 'title'>;
13
+ export declare const Dialog: (props: DialogProps) => React.JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './dialog';
@@ -11,6 +11,7 @@ declare const ICONS: {
11
11
  readonly COMMIT: "commit";
12
12
  readonly CLIPBOARD: "clipboard";
13
13
  readonly CLIPBOARD_CHECK: "clipboard-check";
14
+ readonly DOWNLOAD: "download";
14
15
  readonly ERROR: "error";
15
16
  readonly EXTERNAL_LINK: "external-link";
16
17
  readonly FILTER: "filter";
@@ -49,6 +50,7 @@ export declare const Icon: {
49
50
  readonly COMMIT: "commit";
50
51
  readonly CLIPBOARD: "clipboard";
51
52
  readonly CLIPBOARD_CHECK: "clipboard-check";
53
+ readonly DOWNLOAD: "download";
52
54
  readonly ERROR: "error";
53
55
  readonly EXTERNAL_LINK: "external-link";
54
56
  readonly FILTER: "filter";
@@ -3,6 +3,7 @@ export { Button } from "./button";
3
3
  export { CopyToClipboard } from "./copy-to-clipboard";
4
4
  export { Container } from "./container";
5
5
  export { ControlGroup } from "./control-group";
6
+ export { Dialog } from "./dialog";
6
7
  export { Dropdown } from "./dropdown";
7
8
  export { EmptySet } from "./empty-set";
8
9
  export { FileName } from "./file-name";
@@ -16,4 +17,5 @@ export { Skeleton } from "./skeleton";
16
17
  export { Table } from "./table";
17
18
  export { Tabs } from "./tabs";
18
19
  export { Tag } from "./tag";
20
+ export { Textarea } from "./textarea";
19
21
  export { Tooltip } from "./tooltip";
@@ -1,6 +1,6 @@
1
1
  export function Tabs({ className, ...restProps }: {
2
2
  [x: string]: any;
3
- className: any;
3
+ className?: string | undefined;
4
4
  }): React.JSX.Element;
5
5
  export namespace Tabs {
6
6
  export namespace defaultProps {
@@ -18,8 +18,8 @@ import PropTypes from 'prop-types';
18
18
  declare function Item({ isTabActive, as: Component, className, ...restProps }: {
19
19
  [x: string]: any;
20
20
  isTabActive: any;
21
- as: any;
22
- className: any;
21
+ as?: string | undefined;
22
+ className?: string | undefined;
23
23
  }): React.JSX.Element;
24
24
  declare namespace Item {
25
25
  export namespace defaultProps_1 {
@@ -0,0 +1 @@
1
+ export * from './textarea';
@@ -0,0 +1,7 @@
1
+ import type { ComponentProps } from 'react';
2
+ import React from 'react';
3
+ export type TextareaProps = {
4
+ previewSource?: boolean;
5
+ size?: 'small' | 'medium' | 'large';
6
+ } & ComponentProps<'textarea'>;
7
+ export declare const Textarea: (props: TextareaProps) => React.JSX.Element;