@bundle-stats/ui 4.16.0-beta.1 → 4.16.0-beta.11

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 (116) hide show
  1. package/lib/components/bundle-assets/bundle-assets.js +5 -3
  2. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  3. package/lib/components/bundle-assets-totals/bundle-assets-totals.js +4 -2
  4. package/lib/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  5. package/lib/components/bundle-modules/bundle-modules.js +4 -2
  6. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  7. package/lib/components/bundle-packages/bundle-packages.js +4 -2
  8. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  9. package/lib/components/insights/insights.module.css +1 -0
  10. package/lib/components/metrics-table-export/metrics-table-export.js +10 -12
  11. package/lib/components/metrics-table-export/metrics-table-export.js.map +1 -1
  12. package/lib/components/metrics-table-options/metrics-table-options.js +7 -5
  13. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  14. package/lib/components/metrics-table-options/metrics-table-options.module.css +5 -0
  15. package/lib/components/preview-source/preview-source.js +8 -5
  16. package/lib/components/preview-source/preview-source.js.map +1 -1
  17. package/lib/components/preview-source/preview-source.module.css +12 -0
  18. package/lib/css/variables.css +4 -0
  19. package/lib/i18n.js +2 -0
  20. package/lib/i18n.js.map +1 -1
  21. package/lib/ui/dialog/dialog.module.css +3 -3
  22. package/lib/ui/index.js +3 -1
  23. package/lib/ui/index.js.map +1 -1
  24. package/lib/ui/markdown/index.js +18 -0
  25. package/lib/ui/markdown/index.js.map +1 -0
  26. package/lib/ui/markdown/markdown.js +40 -0
  27. package/lib/ui/markdown/markdown.js.map +1 -0
  28. package/lib/ui/markdown/markdown.module.css +7 -0
  29. package/lib/ui/skeleton/skeleton.module.css +3 -3
  30. package/lib/ui/tabs/index.js +15 -3
  31. package/lib/ui/tabs/index.js.map +1 -1
  32. package/lib/ui/tabs/tabs.js +9 -20
  33. package/lib/ui/tabs/tabs.js.map +1 -1
  34. package/lib/ui/tabs/tabs.module.css +6 -5
  35. package/lib/ui/textarea/textarea.js +2 -2
  36. package/lib/ui/textarea/textarea.js.map +1 -1
  37. package/lib/ui/textarea/textarea.module.css +0 -7
  38. package/lib-esm/components/bundle-assets/bundle-assets.js +6 -4
  39. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  40. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js +5 -3
  41. package/lib-esm/components/bundle-assets-totals/bundle-assets-totals.js.map +1 -1
  42. package/lib-esm/components/bundle-modules/bundle-modules.js +5 -3
  43. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  44. package/lib-esm/components/bundle-packages/bundle-packages.js +5 -3
  45. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  46. package/lib-esm/components/insights/insights.module.css +1 -0
  47. package/lib-esm/components/metrics-table-export/metrics-table-export.js +11 -10
  48. package/lib-esm/components/metrics-table-export/metrics-table-export.js.map +1 -1
  49. package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -5
  50. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  51. package/lib-esm/components/metrics-table-options/metrics-table-options.module.css +5 -0
  52. package/lib-esm/components/preview-source/preview-source.js +8 -5
  53. package/lib-esm/components/preview-source/preview-source.js.map +1 -1
  54. package/lib-esm/components/preview-source/preview-source.module.css +12 -0
  55. package/lib-esm/css/variables.css +4 -0
  56. package/lib-esm/i18n.js +2 -0
  57. package/lib-esm/i18n.js.map +1 -1
  58. package/lib-esm/ui/dialog/dialog.module.css +3 -3
  59. package/lib-esm/ui/index.js +1 -0
  60. package/lib-esm/ui/index.js.map +1 -1
  61. package/lib-esm/ui/markdown/index.js +2 -0
  62. package/lib-esm/ui/markdown/index.js.map +1 -0
  63. package/lib-esm/ui/markdown/markdown.js +10 -0
  64. package/lib-esm/ui/markdown/markdown.js.map +1 -0
  65. package/lib-esm/ui/markdown/markdown.module.css +7 -0
  66. package/lib-esm/ui/skeleton/skeleton.module.css +3 -3
  67. package/lib-esm/ui/tabs/index.js +1 -1
  68. package/lib-esm/ui/tabs/index.js.map +1 -1
  69. package/lib-esm/ui/tabs/tabs.js +7 -19
  70. package/lib-esm/ui/tabs/tabs.js.map +1 -1
  71. package/lib-esm/ui/tabs/tabs.module.css +6 -5
  72. package/lib-esm/ui/textarea/textarea.js +2 -2
  73. package/lib-esm/ui/textarea/textarea.js.map +1 -1
  74. package/lib-esm/ui/textarea/textarea.module.css +0 -7
  75. package/package.json +11 -10
  76. package/src/components/bundle-assets/bundle-assets.jsx +16 -8
  77. package/src/components/bundle-assets-totals/bundle-assets-totals.jsx +11 -3
  78. package/src/components/bundle-modules/bundle-modules.tsx +11 -3
  79. package/src/components/bundle-packages/bundle-packages.jsx +11 -3
  80. package/src/components/insights/insights.module.css +1 -0
  81. package/src/components/metrics-table-export/metrics-table-export.tsx +28 -20
  82. package/src/components/metrics-table-options/metrics-table-options.module.css +5 -0
  83. package/src/components/metrics-table-options/metrics-table-options.tsx +14 -6
  84. package/src/components/preview-source/preview-source.module.css +12 -0
  85. package/src/components/preview-source/preview-source.stories.tsx +19 -1
  86. package/src/components/preview-source/preview-source.tsx +30 -21
  87. package/src/css/variables.css +4 -0
  88. package/src/i18n.js +2 -0
  89. package/src/ui/dialog/dialog.module.css +3 -3
  90. package/src/ui/index.js +1 -0
  91. package/src/ui/markdown/index.ts +1 -0
  92. package/src/ui/markdown/markdown.module.css +7 -0
  93. package/src/ui/markdown/markdown.stories.tsx +29 -0
  94. package/src/ui/markdown/markdown.tsx +24 -0
  95. package/src/ui/skeleton/skeleton.module.css +3 -3
  96. package/src/ui/tabs/index.ts +1 -0
  97. package/src/ui/tabs/tabs.module.css +6 -5
  98. package/src/ui/tabs/tabs.stories.tsx +25 -0
  99. package/src/ui/tabs/tabs.tsx +32 -0
  100. package/src/ui/textarea/textarea.module.css +0 -7
  101. package/src/ui/textarea/textarea.tsx +2 -8
  102. package/types/components/metrics-table-export/metrics-table-export.d.ts +1 -0
  103. package/types/components/metrics-table-options/metrics-table-options.d.ts +1 -1
  104. package/types/components/preview-source/preview-source.d.ts +2 -1
  105. package/types/i18n.d.ts +2 -0
  106. package/types/ui/index.d.ts +1 -0
  107. package/types/ui/markdown/index.d.ts +1 -0
  108. package/types/ui/markdown/markdown.d.ts +7 -0
  109. package/types/ui/tabs/index.d.ts +1 -1
  110. package/types/ui/tabs/tabs.d.ts +11 -41
  111. package/types/ui/textarea/textarea.d.ts +0 -1
  112. package/lib/components/metrics-table-export/metrics-table-export.module.css +0 -8
  113. package/lib-esm/components/metrics-table-export/metrics-table-export.module.css +0 -8
  114. package/src/components/metrics-table-export/metrics-table-export.module.css +0 -8
  115. package/src/ui/tabs/index.js +0 -1
  116. package/src/ui/tabs/tabs.jsx +0 -39
@@ -7,6 +7,8 @@
7
7
  z-index: 2;
8
8
  top: var(--space-xsmall);
9
9
  right: var(--space-xsmall);
10
+ background: var(--color-background);
11
+ border-radius: var(--radius-medium);
10
12
  }
11
13
 
12
14
  /** fix control group with nested components */
@@ -21,8 +23,18 @@
21
23
  box-shadow: none;
22
24
  }
23
25
 
26
+ /** Source content */
24
27
  .content {
25
28
  position: relative;
26
29
  z-index: 1;
27
30
  height: 100%;
31
+ background: var(--color-highlight);
32
+ color: var(--color-text);
33
+ font-family: var(--font-family-fixed);
34
+ }
35
+
36
+ /** Empty / loading state */
37
+ .isEmpty .content {
38
+ pointer-events: none;
39
+ background: var(--color-highlight);
28
40
  }
@@ -29,7 +29,25 @@ const SOURCE = JSON.stringify(
29
29
 
30
30
  export const Default: Story = {
31
31
  args: {
32
- source: SOURCE,
32
+ source: JSON.stringify(
33
+ [
34
+ {
35
+ label: 'Hey',
36
+ runs: [
37
+ { value: 1, name: 'a' },
38
+ { value: 2, name: 'b' },
39
+ ],
40
+ },
41
+ ],
42
+ null,
43
+ 2,
44
+ ),
45
+ download: 'bundle-stats--assets.json',
46
+ },
47
+ };
48
+
49
+ export const Empty: Story = {
50
+ args: {
33
51
  download: 'bundle-stats--assets.json',
34
52
  },
35
53
  };
@@ -9,8 +9,14 @@ import { Tooltip } from '../../ui/tooltip';
9
9
  import { Textarea } from '../../ui/textarea';
10
10
  import css from './preview-source.module.css';
11
11
 
12
+ const DEFAULT_ROWS = 10;
13
+
12
14
  type PreviewSourceProps = {
13
- source: string;
15
+ source?: string;
16
+ /**
17
+ * Textarea rows
18
+ */
19
+ rows?: number;
14
20
  /**
15
21
  * Link download attribute
16
22
  * @example
@@ -20,28 +26,31 @@ type PreviewSourceProps = {
20
26
  } & ComponentProps<'div'>;
21
27
 
22
28
  export const PreviewSource = (props: PreviewSourceProps) => {
23
- const { className = '', source, download = false, ...restProps } = props;
29
+ const { className = '', source, rows = DEFAULT_ROWS, download = false, ...restProps } = props;
30
+
31
+ const isEmpty = !source;
32
+ const rootClassName = cx(css.root, className, isEmpty && css.isEmpty);
24
33
 
25
34
  return (
26
- <div className={cx(css.root, className)} {...restProps}>
27
- <ControlGroup className={css.toolbar}>
28
- <CopyToClipboard outline size="small" text={source} />
29
- {download && (
30
- <Tooltip title={`Download ${download}`} className={css.downloadTooltip}>
31
- <Button
32
- outline
33
- rightGlyph={BUTTON_GLYPHS.DOWNLOAD}
34
- size="small"
35
- as="a"
36
- href={`data:application/json,${encodeURIComponent(source)}`}
37
- download={download}
38
- />
39
- </Tooltip>
40
- )}
41
- </ControlGroup>
42
- <Textarea previewSource readOnly rows={12} className={css.content}>
43
- {source}
44
- </Textarea>
35
+ <div className={rootClassName} {...restProps}>
36
+ {source && (
37
+ <ControlGroup className={css.toolbar}>
38
+ <CopyToClipboard outline size="small" text={source} />
39
+ {download && (
40
+ <Tooltip title={`Download ${download}`} className={css.downloadTooltip}>
41
+ <Button
42
+ outline
43
+ rightGlyph={BUTTON_GLYPHS.DOWNLOAD}
44
+ size="small"
45
+ as="a"
46
+ href={`data:application/json,${encodeURIComponent(source)}`}
47
+ download={download}
48
+ />
49
+ </Tooltip>
50
+ )}
51
+ </ControlGroup>
52
+ )}
53
+ <Textarea readOnly rows={rows} value={source} className={css.content} />
45
54
  </div>
46
55
  );
47
56
  };
@@ -201,6 +201,10 @@
201
201
 
202
202
  --outline-hover: 0 0 0 var(--space-xxxsmall) var(--color-highlight);
203
203
 
204
+ --skeleton-inline-background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 89.9%, transparent 90%);
205
+ --skeleton-block-background: currentColor;
206
+ --skeleton-opacity: 0.06;
207
+
204
208
  /** Layout */
205
209
  --max-width: 88rem;
206
210
  --entry-info-width: 64rem;
package/src/i18n.js CHANGED
@@ -22,6 +22,8 @@ export default {
22
22
  RESET_FILTERS: 'Reset filters',
23
23
  VIEW_ALL: 'View all entries',
24
24
  EXPORT: 'Export',
25
+ EXPORT_CSV: 'Export CSV',
26
+ EXPORT_JSON: 'Export JSON',
25
27
 
26
28
  COPY_TO_CLIPBOARD: 'Copy to clipboard',
27
29
  COPY_TO_CLIPBOARD_DONE: 'Copied to clipboard',
@@ -61,11 +61,11 @@
61
61
 
62
62
  /** Width variation */
63
63
  .width--narrow {
64
- max-width: 480px;
64
+ max-width: 360px;
65
65
  }
66
66
 
67
67
  .width--medium {
68
- max-width: 748px;
68
+ max-width: 640px;
69
69
  }
70
70
 
71
71
  .width--wide {
@@ -73,7 +73,7 @@
73
73
  }
74
74
 
75
75
  .width--extra-wide {
76
- max-width: var(--max-width);
76
+ max-width: calc(var(--max-width) + 2 * var(--space-medium));
77
77
  }
78
78
 
79
79
  /** Center variation */
package/src/ui/index.js CHANGED
@@ -13,6 +13,7 @@ export { Icon } from './icon';
13
13
  export { Input } from './input';
14
14
  export { InputSearch } from './input-search';
15
15
  export { Loader } from './loader';
16
+ export { Markdown } from './markdown';
16
17
  export { Skeleton } from './skeleton';
17
18
  export { Table } from './table';
18
19
  export { Tabs } from './tabs';
@@ -0,0 +1 @@
1
+ export * from './markdown';
@@ -0,0 +1,7 @@
1
+ .root code {
2
+ padding: 2px var(--space-xxxsmall);
3
+ background: var(--color-highlight);
4
+ outline: 1px solid var(--color-outline);
5
+ border-radius: var(--radius-small);
6
+ color: var(--color-text);
7
+ }
@@ -0,0 +1,29 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Markdown } from '.';
3
+
4
+ const meta: Meta<typeof Markdown> = {
5
+ title: 'UI/Markdown',
6
+ component: Markdown,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof meta>;
12
+
13
+ export const Default: Story = {
14
+ args: {
15
+ content: '**One line** _markdown_ content',
16
+ },
17
+ };
18
+
19
+ const MULTI_LINE_MARKDOWN = `
20
+ **Lorem ipsum** dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Habitant morbi tristique senectus et netus et malesuada.
21
+
22
+ Eget nunc scelerisque viverra mauris in. Ipsum dolor sit amet consectetur adipiscing.
23
+ `;
24
+
25
+ export const MultiLine: Story = {
26
+ args: {
27
+ content: MULTI_LINE_MARKDOWN,
28
+ },
29
+ };
@@ -0,0 +1,24 @@
1
+ import React, { ComponentProps, ElementType, useMemo } from 'react';
2
+ import cx from 'classnames';
3
+ import snarkdown from 'snarkdown';
4
+
5
+ import css from './markdown.module.css';
6
+
7
+ type MarkdownProps = {
8
+ content?: string;
9
+ as?: ElementType;
10
+ } & ComponentProps<'div'>;
11
+
12
+ export const Markdown = (props: MarkdownProps) => {
13
+ const { className = '', content = '', as: Component = 'div', ...restProps } = props;
14
+
15
+ const html = useMemo(() => snarkdown(content), [content]);
16
+
17
+ return (
18
+ <Component
19
+ className={cx(css.root, className)}
20
+ {...restProps}
21
+ dangerouslySetInnerHTML={{ __html: html }}
22
+ />
23
+ );
24
+ };
@@ -1,6 +1,6 @@
1
1
  .root {
2
- background: linear-gradient(transparent 10%, currentColor 10.1%, currentColor 89.9%, transparent 90%);
3
- opacity: 0.05;
2
+ background: var(--skeleton-inline-background);
3
+ opacity: var(--skeleton-opacity);
4
4
  pointer-events: none;
5
5
  min-width: 6em;
6
6
  border-radius: var(--radius-medium);
@@ -14,5 +14,5 @@
14
14
  }
15
15
 
16
16
  .block {
17
- background: currentColor;
17
+ background: var(--skeleton-block-background);
18
18
  }
@@ -0,0 +1 @@
1
+ export * from './tabs';
@@ -4,12 +4,16 @@
4
4
  }
5
5
 
6
6
  .item {
7
+ appearance: none;
8
+ background: none;
9
+ border: 0;
7
10
  position: relative;
8
11
  display: inline-block;
9
12
  padding: var(--space-xsmall) var(--space-small);
10
13
  color: var(--color-text-ultra-light);
11
14
  font-weight: bold;
12
15
  text-decoration: none;
16
+ transition: var(--ui-transition-out);
13
17
  }
14
18
 
15
19
  .item::after {
@@ -26,8 +30,9 @@
26
30
  .item:hover,
27
31
  .item:active,
28
32
  .item:focus {
29
- color: var(--color-primary-dark);
33
+ color: var(--color-primary);
30
34
  outline: none;
35
+ transition: var(--ui-transition-out);
31
36
  }
32
37
 
33
38
  .item:hover::after,
@@ -43,7 +48,3 @@
43
48
  .itemActive::after {
44
49
  background: currentColor;
45
50
  }
46
-
47
- .item + .item {
48
- _margin-left: var(--space-medium);
49
- }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { getWrapperDecorator } from '../../stories';
5
+ import { Tabs, TabItem } from '.';
6
+
7
+ const meta: Meta<typeof Tabs> = {
8
+ title: 'UI/Tabs',
9
+ component: Tabs,
10
+ decorators: [getWrapperDecorator()],
11
+ };
12
+
13
+ export default meta;
14
+
15
+ type Story = StoryObj<typeof meta>;
16
+
17
+ export const Default: Story = {
18
+ render: () => (
19
+ <Tabs>
20
+ <TabItem isTabActive>Option A</TabItem>
21
+ <TabItem>Option B</TabItem>
22
+ <TabItem>Option C</TabItem>
23
+ </Tabs>
24
+ ),
25
+ };
@@ -0,0 +1,32 @@
1
+ import type { ComponentProps, ElementType } from 'react';
2
+ import React from 'react';
3
+ import cx from 'classnames';
4
+
5
+ import css from './tabs.module.css';
6
+
7
+ export type TabItemProps<T extends ElementType> = {
8
+ isTabActive?: boolean;
9
+ as?: T;
10
+ } & ComponentProps<T>;
11
+
12
+ export const TabItem = <T extends ElementType = 'button'>(props: TabItemProps<T>) => {
13
+ const { className = '', as: Component = 'button', isTabActive = false, ...restProps } = props;
14
+
15
+ return (
16
+ <Component
17
+ role="tab"
18
+ className={cx(css.item, className, isTabActive && css.itemActive)}
19
+ {...restProps}
20
+ />
21
+ );
22
+ };
23
+
24
+ export type TabsProps = ComponentProps<'div'>;
25
+
26
+ export const Tabs = (props: TabsProps) => {
27
+ const { className = '', ...restProps } = props;
28
+
29
+ return <div role="tablist" className={cx(css.root, className)} {...restProps} />;
30
+ };
31
+
32
+ Tabs.Item = TabItem;
@@ -36,13 +36,6 @@
36
36
  color: var(--color-text-light);
37
37
  }
38
38
 
39
- /**
40
- * Source variation
41
- */
42
- .previewSource {
43
- font-family: var(--font-family-fixed);
44
- }
45
-
46
39
  /** Size modifier */
47
40
  /* default - medium */
48
41
  .root {
@@ -5,19 +5,13 @@ import cx from 'classnames';
5
5
  import css from './textarea.module.css';
6
6
 
7
7
  export type TextareaProps = {
8
- previewSource?: boolean;
9
8
  size?: 'small' | 'medium' | 'large';
10
9
  } & ComponentProps<'textarea'>;
11
10
 
12
11
  export const Textarea = (props: TextareaProps) => {
13
- const { className = '', previewSource = false, size = '', ...restProps } = props;
12
+ const { className = '', size = '', ...restProps } = props;
14
13
 
15
- const rootClassName = cx(
16
- css.root,
17
- previewSource && css.previewSource,
18
- size && css[size],
19
- className,
20
- );
14
+ const rootClassName = cx(css.root, size && css[size], className);
21
15
 
22
16
  return <textarea className={rootClassName} {...restProps} />;
23
17
  };
@@ -4,6 +4,7 @@ import type { ReportMetricRow } from '@bundle-stats/utils';
4
4
  import { Stack } from '../../layout/stack';
5
5
  type MetricsTableExportProps = {
6
6
  items: Array<ReportMetricRow>;
7
+ initialSourceType?: string;
7
8
  download: string;
8
9
  } & ComponentProps<typeof Stack>;
9
10
  export declare const MetricsTableExport: (props: MetricsTableExportProps) => React.JSX.Element;
@@ -4,7 +4,7 @@ import { Dropdown } from '../../ui/dropdown';
4
4
  type MetricsTableOptionsProps = {
5
5
  onViewAllClick?: () => void;
6
6
  onResetClick?: () => void;
7
- onExportClick?: () => void;
7
+ onExportClick?: (sourceType: string) => void;
8
8
  } & ComponentProps<typeof Dropdown>;
9
9
  export declare const MetricsTableOptions: (props: MetricsTableOptionsProps) => React.JSX.Element;
10
10
  export {};
@@ -1,7 +1,8 @@
1
1
  import type { ComponentProps } from 'react';
2
2
  import React from 'react';
3
3
  type PreviewSourceProps = {
4
- source: string;
4
+ source?: string;
5
+ rows?: number;
5
6
  download?: string;
6
7
  } & ComponentProps<'div'>;
7
8
  export declare const PreviewSource: (props: PreviewSourceProps) => React.JSX.Element;
package/types/i18n.d.ts CHANGED
@@ -15,6 +15,8 @@ declare namespace _default {
15
15
  let RESET_FILTERS: string;
16
16
  let VIEW_ALL: string;
17
17
  let EXPORT: string;
18
+ let EXPORT_CSV: string;
19
+ let EXPORT_JSON: string;
18
20
  let COPY_TO_CLIPBOARD: string;
19
21
  let COPY_TO_CLIPBOARD_DONE: string;
20
22
  let GITHUB_LINK_TITLE: string;
@@ -13,6 +13,7 @@ export { Icon } from "./icon";
13
13
  export { Input } from "./input";
14
14
  export { InputSearch } from "./input-search";
15
15
  export { Loader } from "./loader";
16
+ export { Markdown } from "./markdown";
16
17
  export { Skeleton } from "./skeleton";
17
18
  export { Table } from "./table";
18
19
  export { Tabs } from "./tabs";
@@ -0,0 +1 @@
1
+ export * from './markdown';
@@ -0,0 +1,7 @@
1
+ import React, { ComponentProps, ElementType } from 'react';
2
+ type MarkdownProps = {
3
+ content?: string;
4
+ as?: ElementType;
5
+ } & ComponentProps<'div'>;
6
+ export declare const Markdown: (props: MarkdownProps) => React.JSX.Element;
7
+ export {};
@@ -1 +1 @@
1
- export { Tabs } from "./tabs";
1
+ export * from './tabs';
@@ -1,42 +1,12 @@
1
- export function Tabs({ className, ...restProps }: {
2
- [x: string]: any;
3
- className?: string | undefined;
4
- }): React.JSX.Element;
5
- export namespace Tabs {
6
- export namespace defaultProps {
7
- let className: string;
8
- }
9
- export namespace propTypes {
10
- let className_1: PropTypes.Requireable<string>;
11
- export { className_1 as className };
12
- export let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
13
- }
14
- export { Item };
15
- }
1
+ import type { ComponentProps, ElementType } from 'react';
16
2
  import React from 'react';
17
- import PropTypes from 'prop-types';
18
- declare function Item({ isTabActive, as: Component, className, ...restProps }: {
19
- [x: string]: any;
20
- isTabActive: any;
21
- as?: string | undefined;
22
- className?: string | undefined;
23
- }): React.JSX.Element;
24
- declare namespace Item {
25
- export namespace defaultProps_1 {
26
- export let isTabActive: boolean;
27
- let className_2: string;
28
- export { className_2 as className };
29
- export let as: string;
30
- }
31
- export { defaultProps_1 as defaultProps };
32
- export namespace propTypes_1 {
33
- let isTabActive_1: PropTypes.Requireable<boolean>;
34
- export { isTabActive_1 as isTabActive };
35
- let className_3: PropTypes.Requireable<string>;
36
- export { className_3 as className };
37
- let as_1: PropTypes.Requireable<PropTypes.ReactComponentLike>;
38
- export { as_1 as as };
39
- }
40
- export { propTypes_1 as propTypes };
41
- }
42
- export {};
3
+ export type TabItemProps<T extends ElementType> = {
4
+ isTabActive?: boolean;
5
+ as?: T;
6
+ } & ComponentProps<T>;
7
+ export declare const TabItem: <T extends ElementType = "button">(props: TabItemProps<T>) => React.JSX.Element;
8
+ export type TabsProps = ComponentProps<'div'>;
9
+ export declare const Tabs: {
10
+ (props: TabsProps): React.JSX.Element;
11
+ Item: <T extends ElementType = "button">(props: TabItemProps<T>) => React.JSX.Element;
12
+ };
@@ -1,7 +1,6 @@
1
1
  import type { ComponentProps } from 'react';
2
2
  import React from 'react';
3
3
  export type TextareaProps = {
4
- previewSource?: boolean;
5
4
  size?: 'small' | 'medium' | 'large';
6
5
  } & ComponentProps<'textarea'>;
7
6
  export declare const Textarea: (props: TextareaProps) => React.JSX.Element;
@@ -1,8 +0,0 @@
1
- .panels {
2
- }
3
-
4
- .panel {
5
- min-height: 320px;
6
- height: 60vh;
7
- max-height: 480px;
8
- }
@@ -1,8 +0,0 @@
1
- .panels {
2
- }
3
-
4
- .panel {
5
- min-height: 320px;
6
- height: 60vh;
7
- max-height: 480px;
8
- }
@@ -1,8 +0,0 @@
1
- .panels {
2
- }
3
-
4
- .panel {
5
- min-height: 320px;
6
- height: 60vh;
7
- max-height: 480px;
8
- }
@@ -1 +0,0 @@
1
- export { Tabs } from './tabs';
@@ -1,39 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
-
5
- import css from './tabs.module.css';
6
-
7
- const Item = ({ isTabActive, as: Component = 'span', className = '', ...restProps }) => (
8
- <Component className={cx(css.item, className, isTabActive && css.itemActive)} {...restProps} />
9
- );
10
-
11
- Item.defaultProps = {
12
- isTabActive: false,
13
- className: '',
14
- as: 'span',
15
- };
16
-
17
- Item.propTypes = {
18
- isTabActive: PropTypes.bool,
19
- className: PropTypes.string,
20
- as: PropTypes.elementType,
21
- };
22
-
23
- export const Tabs = ({ className = '', ...restProps }) => (
24
- <nav className={cx(css.root, className)} {...restProps} />
25
- );
26
-
27
- Tabs.defaultProps = {
28
- className: '',
29
- };
30
-
31
- Tabs.propTypes = {
32
- /** Adopted child class name */
33
- className: PropTypes.string,
34
-
35
- /** Component children */
36
- children: PropTypes.node.isRequired,
37
- };
38
-
39
- Tabs.Item = Item;