@bundle-stats/ui 4.22.2 → 4.23.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/.babelrc.js +65 -24
  2. package/globals.d.ts +13 -0
  3. package/lib/app/app.js +3 -0
  4. package/lib/app/app.js.map +1 -1
  5. package/lib/app/app.module.css +11 -1
  6. package/lib/components/bundle-modules/index.js.map +1 -1
  7. package/lib/components/delta/delta.js +3 -13
  8. package/lib/components/delta/delta.js.map +1 -1
  9. package/lib/components/delta/delta.module.css +13 -12
  10. package/lib/components/delta/index.js.map +1 -1
  11. package/lib/components/index.js +3 -1
  12. package/lib/components/index.js.map +1 -1
  13. package/lib/components/insight-icon/insight-icon.module.css +6 -6
  14. package/lib/components/job-name/job-name.js +1 -2
  15. package/lib/components/job-name/job-name.js.map +1 -1
  16. package/lib/components/metric-change-legend/index.js +18 -0
  17. package/lib/components/metric-change-legend/index.js.map +1 -0
  18. package/lib/components/metric-change-legend/metric-change-legend.js +91 -0
  19. package/lib/components/metric-change-legend/metric-change-legend.js.map +1 -0
  20. package/lib/components/metric-change-legend/metric-change-legend.module.css +69 -0
  21. package/lib/components/metric-run-info/metric-run-info.js +30 -7
  22. package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
  23. package/lib/components/metrics-display-selector/metrics-display-selector.js +7 -9
  24. package/lib/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  25. package/lib/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  26. package/lib/components/metrics-table-header/metrics-table-header.js +8 -8
  27. package/lib/components/metrics-table-header/metrics-table-header.js.map +1 -1
  28. package/lib/components/metrics-table-header/metrics-table-header.module.css +8 -12
  29. package/lib/components/metrics-table-options/metrics-table-options.js +1 -1
  30. package/lib/components/metrics-table-options/metrics-table-options.js.map +1 -1
  31. package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
  32. package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
  33. package/lib/components/run-info/run-info.js +26 -14
  34. package/lib/components/run-info/run-info.js.map +1 -1
  35. package/lib/components/run-info/run-info.module.css +35 -26
  36. package/lib/components/summary/summary.js +9 -10
  37. package/lib/components/summary/summary.js.map +1 -1
  38. package/lib/components/summary/summary.module.css +60 -10
  39. package/lib/constants.js +13 -1
  40. package/lib/constants.js.map +1 -1
  41. package/lib/css/default.css +1 -1
  42. package/lib/css/variables.css +71 -58
  43. package/lib/hooks/rows-sort.js +13 -12
  44. package/lib/hooks/rows-sort.js.map +1 -1
  45. package/lib/ui/button/button.js.map +1 -1
  46. package/lib/ui/dialog/dialog.js +4 -2
  47. package/lib/ui/dialog/dialog.js.map +1 -1
  48. package/lib/ui/dialog/dialog.module.css +22 -0
  49. package/lib/ui/dropdown/dropdown.js +4 -3
  50. package/lib/ui/dropdown/dropdown.js.map +1 -1
  51. package/lib/ui/dropdown/dropdown.module.css +11 -0
  52. package/lib/ui/empty-set/empty-set.js +3 -3
  53. package/lib/ui/empty-set/empty-set.js.map +1 -1
  54. package/lib/ui/hover-card/hover-card.js +1 -1
  55. package/lib/ui/hover-card/hover-card.js.map +1 -1
  56. package/lib/ui/hover-card/hover-card.module.css +14 -0
  57. package/lib/ui/table/table.module.css +0 -1
  58. package/lib/ui/tooltip/tooltip.js +1 -1
  59. package/lib/ui/tooltip/tooltip.js.map +1 -1
  60. package/lib/ui/tooltip/tooltip.module.css +11 -0
  61. package/lib-esm/app/app.js +4 -1
  62. package/lib-esm/app/app.js.map +1 -1
  63. package/lib-esm/app/app.module.css +11 -1
  64. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  65. package/lib-esm/components/delta/delta.js +3 -13
  66. package/lib-esm/components/delta/delta.js.map +1 -1
  67. package/lib-esm/components/delta/delta.module.css +13 -12
  68. package/lib-esm/components/delta/index.js.map +1 -1
  69. package/lib-esm/components/index.js +1 -0
  70. package/lib-esm/components/index.js.map +1 -1
  71. package/lib-esm/components/insight-icon/insight-icon.module.css +6 -6
  72. package/lib-esm/components/job-name/job-name.js +1 -2
  73. package/lib-esm/components/job-name/job-name.js.map +1 -1
  74. package/lib-esm/components/metric-change-legend/index.js +2 -0
  75. package/lib-esm/components/metric-change-legend/index.js.map +1 -0
  76. package/lib-esm/components/metric-change-legend/metric-change-legend.js +84 -0
  77. package/lib-esm/components/metric-change-legend/metric-change-legend.js.map +1 -0
  78. package/lib-esm/components/metric-change-legend/metric-change-legend.module.css +69 -0
  79. package/lib-esm/components/metric-run-info/metric-run-info.js +31 -8
  80. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
  81. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js +7 -9
  82. package/lib-esm/components/metrics-display-selector/metrics-display-selector.js.map +1 -1
  83. package/lib-esm/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  84. package/lib-esm/components/metrics-table-header/metrics-table-header.js +8 -8
  85. package/lib-esm/components/metrics-table-header/metrics-table-header.js.map +1 -1
  86. package/lib-esm/components/metrics-table-header/metrics-table-header.module.css +8 -12
  87. package/lib-esm/components/metrics-table-options/metrics-table-options.js +1 -1
  88. package/lib-esm/components/metrics-table-options/metrics-table-options.js.map +1 -1
  89. package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
  90. package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
  91. package/lib-esm/components/run-info/run-info.js +26 -14
  92. package/lib-esm/components/run-info/run-info.js.map +1 -1
  93. package/lib-esm/components/run-info/run-info.module.css +35 -26
  94. package/lib-esm/components/summary/summary.js +10 -11
  95. package/lib-esm/components/summary/summary.js.map +1 -1
  96. package/lib-esm/components/summary/summary.module.css +60 -10
  97. package/lib-esm/constants.js +12 -0
  98. package/lib-esm/constants.js.map +1 -1
  99. package/lib-esm/css/default.css +1 -1
  100. package/lib-esm/css/variables.css +71 -58
  101. package/lib-esm/hooks/rows-sort.js +10 -8
  102. package/lib-esm/hooks/rows-sort.js.map +1 -1
  103. package/lib-esm/ui/button/button.js.map +1 -1
  104. package/lib-esm/ui/dialog/dialog.js +4 -2
  105. package/lib-esm/ui/dialog/dialog.js.map +1 -1
  106. package/lib-esm/ui/dialog/dialog.module.css +22 -0
  107. package/lib-esm/ui/dropdown/dropdown.js +4 -3
  108. package/lib-esm/ui/dropdown/dropdown.js.map +1 -1
  109. package/lib-esm/ui/dropdown/dropdown.module.css +11 -0
  110. package/lib-esm/ui/empty-set/empty-set.js +3 -3
  111. package/lib-esm/ui/empty-set/empty-set.js.map +1 -1
  112. package/lib-esm/ui/hover-card/hover-card.js +1 -1
  113. package/lib-esm/ui/hover-card/hover-card.js.map +1 -1
  114. package/lib-esm/ui/hover-card/hover-card.module.css +14 -0
  115. package/lib-esm/ui/table/table.module.css +0 -1
  116. package/lib-esm/ui/tooltip/tooltip.js +1 -1
  117. package/lib-esm/ui/tooltip/tooltip.js.map +1 -1
  118. package/lib-esm/ui/tooltip/tooltip.module.css +11 -0
  119. package/package.json +26 -15
  120. package/src/app/app.jsx +6 -1
  121. package/src/app/app.module.css +11 -1
  122. package/src/app/app.stories.tsx +2 -2
  123. package/src/components/asset-info/asset-info.stories.tsx +47 -39
  124. package/src/components/asset-name/asset-name.stories.tsx +1 -3
  125. package/src/components/asset-not-predictive/asset-not-predictive.stories.tsx +22 -15
  126. package/src/components/browsertime-table/browsertime-table.stories.tsx +45 -0
  127. package/src/components/bundle-assets-totals/bundle-assets-totals.stories.tsx +47 -0
  128. package/src/components/bundle-modules/bundle-modules.stories.tsx +191 -0
  129. package/src/components/bundle-modules/bundle-modules.tsx +1 -1
  130. package/src/components/bundle-modules/index.tsx +4 -0
  131. package/src/components/bundle-packages/bundle-packages.stories.tsx +87 -0
  132. package/src/components/delta/delta.module.css +13 -12
  133. package/src/components/delta/delta.stories.tsx +57 -0
  134. package/src/components/delta/delta.tsx +32 -0
  135. package/src/components/entry-info/entry-info.stories.tsx +49 -54
  136. package/src/components/{index.js → index.ts} +7 -2
  137. package/src/components/insight-icon/insight-icon.module.css +6 -6
  138. package/src/components/insights/insights.stories.tsx +36 -33
  139. package/src/components/job-name/job-name.jsx +2 -3
  140. package/src/components/job-name/job-name.stories.tsx +46 -0
  141. package/src/components/jobs-header/jobs-header.stories.tsx +19 -15
  142. package/src/components/lighthouse-table/lighthouse-table.stories.tsx +30 -0
  143. package/src/components/metric/metric.stories.tsx +24 -22
  144. package/src/components/metric-change-legend/index.ts +1 -0
  145. package/src/components/metric-change-legend/metric-change-legend.module.css +69 -0
  146. package/src/components/metric-change-legend/metric-change-legend.stories.tsx +13 -0
  147. package/src/components/metric-change-legend/metric-change-legend.tsx +148 -0
  148. package/src/components/metric-run-info/metric-run-info.stories.tsx +45 -41
  149. package/src/components/metric-run-info/metric-run-info.tsx +41 -17
  150. package/src/components/metrics-display-selector/metrics-display-selector.module.css +0 -25
  151. package/src/components/metrics-display-selector/metrics-display-selector.tsx +25 -37
  152. package/src/components/metrics-table/metrics-table.stories.tsx +33 -13
  153. package/src/components/metrics-table/metrics-table.tsx +1 -1
  154. package/src/components/metrics-table-header/metrics-table-header.module.css +8 -12
  155. package/src/components/metrics-table-header/metrics-table-header.tsx +14 -10
  156. package/src/components/metrics-table-options/metrics-table-options.tsx +1 -1
  157. package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
  158. package/src/components/module-info/module-info.stories.tsx +41 -30
  159. package/src/components/package-info/package-info.stories.tsx +20 -15
  160. package/src/components/run-info/run-info.module.css +35 -26
  161. package/src/components/run-info/run-info.stories.tsx +47 -39
  162. package/src/components/run-info/run-info.tsx +132 -73
  163. package/src/components/summary/summary.module.css +60 -10
  164. package/src/components/summary/summary.stories.tsx +26 -32
  165. package/src/components/summary/summary.tsx +47 -50
  166. package/src/constants.ts +13 -0
  167. package/src/css/default.css +1 -1
  168. package/src/css/variables.css +71 -58
  169. package/src/hooks/rows-sort.ts +9 -6
  170. package/src/layout/box/box.stories.tsx +35 -28
  171. package/src/layout/flex-stack/flex-stack.stories.tsx +79 -48
  172. package/src/layout/footer/footer.stories.tsx +30 -0
  173. package/src/layout/stack/stack.stories.tsx +68 -44
  174. package/src/ui/alert/alert.stories.tsx +25 -21
  175. package/src/ui/button/button.stories.tsx +181 -176
  176. package/src/ui/button/button.tsx +8 -1
  177. package/src/ui/container/container.stories.tsx +28 -21
  178. package/src/ui/control-group/control-group.stories.tsx +23 -16
  179. package/src/ui/dialog/dialog.module.css +22 -0
  180. package/src/ui/dialog/dialog.tsx +9 -2
  181. package/src/ui/dropdown/dropdown.module.css +11 -0
  182. package/src/ui/dropdown/dropdown.stories.tsx +23 -15
  183. package/src/ui/dropdown/dropdown.tsx +5 -1
  184. package/src/ui/empty-set/empty-set.jsx +16 -4
  185. package/src/ui/empty-set/empty-set.stories.tsx +41 -0
  186. package/src/ui/file-name/file-name.stories.tsx +45 -0
  187. package/src/ui/filters/filters.stories.tsx +29 -26
  188. package/src/ui/hover-card/hover-card.module.css +14 -0
  189. package/src/ui/hover-card/hover-card.stories.tsx +35 -26
  190. package/src/ui/hover-card/hover-card.tsx +1 -1
  191. package/src/ui/icon/icon.stories.tsx +36 -28
  192. package/src/ui/input/input.stories.tsx +17 -5
  193. package/src/ui/input-search/input-search.stories.tsx +31 -0
  194. package/src/ui/loader/loader.stories.tsx +22 -0
  195. package/src/ui/skeleton/skeleton.stories.tsx +42 -0
  196. package/src/ui/table/table.module.css +0 -1
  197. package/src/ui/table/table.stories.tsx +244 -218
  198. package/src/ui/tag/tag.stories.tsx +11 -10
  199. package/src/ui/toolbar/toolbar.stories.tsx +41 -0
  200. package/src/ui/tooltip/tooltip.module.css +11 -0
  201. package/src/ui/tooltip/tooltip.tsx +1 -1
  202. package/types/components/bundle-modules/bundle-modules.d.ts +1 -1
  203. package/types/components/bundle-modules/index.d.ts +2 -1
  204. package/types/components/delta/delta.d.ts +7 -21
  205. package/types/components/delta/index.d.ts +1 -1
  206. package/types/components/index.d.ts +25 -20
  207. package/types/components/metric-change-legend/index.d.ts +1 -0
  208. package/types/components/metric-change-legend/metric-change-legend.d.ts +4 -0
  209. package/types/components/metric-run-info/metric-run-info.d.ts +2 -6
  210. package/types/components/metrics-table/metrics-table.d.ts +1 -1
  211. package/types/components/metrics-table-header/metrics-table-header.d.ts +1 -1
  212. package/types/components/run-info/run-info.d.ts +16 -7
  213. package/types/constants.d.ts +12 -0
  214. package/types/hooks/rows-sort.d.ts +2 -2
  215. package/types/ui/button/button.d.ts +1 -1
  216. package/types/ui/dialog/dialog.d.ts +3 -2
  217. package/types/ui/dropdown/dropdown.d.ts +1 -0
  218. package/vitest.config.ts +47 -0
  219. package/vitest.setup.ts +26 -0
  220. package/lib/assets/icons.svg.js +0 -100
  221. package/lib/assets/icons.svg.js.map +0 -1
  222. package/lib-esm/assets/icons.svg.js +0 -63
  223. package/lib-esm/assets/icons.svg.js.map +0 -1
  224. package/src/assets/icons.svg.jsx +0 -279
  225. package/src/components/delta/delta.jsx +0 -22
  226. package/types/assets/icons.svg.d.ts +0 -2
  227. /package/src/components/delta/{index.js → index.ts} +0 -0
@@ -1,24 +1,31 @@
1
1
  import React from 'react';
2
- import { Meta } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  import { Button } from '../button';
5
5
  import { ControlGroup } from '.';
6
6
 
7
- export default {
7
+ const meta = {
8
8
  title: 'UI/ControlGroup',
9
9
  component: ControlGroup,
10
- } as Meta;
10
+ args: {
11
+ children: (
12
+ <>
13
+ <Button outline type="button">
14
+ Option A
15
+ </Button>
16
+ <Button outline type="button">
17
+ Option B
18
+ </Button>
19
+ <Button outline type="button">
20
+ Option C
21
+ </Button>
22
+ </>
23
+ ),
24
+ },
25
+ } satisfies Meta<typeof ControlGroup>;
11
26
 
12
- export const Default = () => (
13
- <ControlGroup>
14
- <Button outline type="button">
15
- Option A
16
- </Button>
17
- <Button outline type="button">
18
- Option B
19
- </Button>
20
- <Button outline type="button">
21
- Option C
22
- </Button>
23
- </ControlGroup>
24
- );
27
+ export default meta;
28
+
29
+ type Story = StoryObj<typeof meta>;
30
+
31
+ export const Default: Story = {};
@@ -3,6 +3,17 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  z-index: var(--layer-xxhigh);
6
+ opacity: 0;
7
+ transition: var(--transition-out);
8
+ }
9
+
10
+ .backdrop[data-enter] {
11
+ opacity: 1;
12
+ transition: var(--transition-in);
13
+ }
14
+
15
+ .backdrop[data-leave] {
16
+ pointer-events: none;
6
17
  }
7
18
 
8
19
  .backdrop::before {
@@ -27,6 +38,17 @@
27
38
  background: var(--color-background);
28
39
  box-shadow: 0 0 var(--space-medium) var(--color-shadow);
29
40
  z-index: var(--layer-xxhigh);
41
+ opacity: 0;
42
+ transition: var(--transition-out);
43
+ }
44
+
45
+ .dialog[data-enter] {
46
+ opacity: 1;
47
+ transition: var(--transition-in);
48
+ }
49
+
50
+ .digalog[data-leave] {
51
+ pointer-events: none;
30
52
  }
31
53
 
32
54
  .header {
@@ -1,13 +1,20 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
2
  import React from 'react';
3
3
  import cx from 'classnames';
4
- import { Dialog as AriakitDialog, DialogDismiss as AriakitDialogDismiss } from 'ariakit/dialog';
4
+ import {
5
+ Dialog as AriakitDialog,
6
+ DialogDismiss as AriakitDialogDismiss,
7
+ useDialogState as useAriakitDialogState,
8
+ type DialogStateProps,
9
+ } from 'ariakit/dialog';
5
10
 
6
11
  import { Stack } from '../../layout/stack';
7
12
  import { BUTTON_GLYPHS, Button } from '../button';
8
13
  import css from './dialog.module.css';
9
14
 
10
- export { useDialogState } from 'ariakit/dialog';
15
+ export const useDialogState = (options: DialogStateProps = {}) => {
16
+ return useAriakitDialogState({ animated: true, ...options });
17
+ };
11
18
 
12
19
  type AriakitDialogProps = ComponentProps<typeof AriakitDialog>;
13
20
 
@@ -16,6 +16,17 @@
16
16
  min-width: 12em;
17
17
  z-index: var(--layer-high);
18
18
  padding: calc(var(--space-xxxsmall) / 2);
19
+ opacity: 0;
20
+ transition: var(--transition-out);
21
+ }
22
+
23
+ .dropdown[data-enter] {
24
+ opacity: 1;
25
+ transition: var(--transition-in);
26
+ }
27
+
28
+ .dropdown[data-leave] {
29
+ pointer-events: none;
19
30
  }
20
31
 
21
32
  .dropdown:focus {
@@ -1,25 +1,33 @@
1
1
  import React from 'react';
2
- import { Meta } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  import { getWrapperDecorator } from '../../stories';
5
5
  import { Dropdown, DropdownItem } from '.';
6
6
 
7
- export default {
7
+ const meta = {
8
8
  title: 'UI/Dropdown',
9
9
  component: Dropdown,
10
10
  decorators: [getWrapperDecorator()],
11
- } as Meta;
11
+ args: {
12
+ glyph: 'filter',
13
+ label: 'Toggle',
14
+ children: (
15
+ <>
16
+ <DropdownItem>Option 1</DropdownItem>
17
+ <DropdownItem>Option 2</DropdownItem>
18
+ </>
19
+ ),
20
+ },
21
+ } satisfies Meta<typeof Dropdown>;
12
22
 
13
- export const Defualt = () => (
14
- <Dropdown glyph="filter" label="Toggle">
15
- <DropdownItem>Option 1</DropdownItem>
16
- <DropdownItem>Option 2</DropdownItem>
17
- </Dropdown>
18
- );
23
+ export default meta;
19
24
 
20
- export const Disabled = () => (
21
- <Dropdown glyph="filter" label="Toggle" disabled>
22
- <DropdownItem>Option 1</DropdownItem>
23
- <DropdownItem>Option 2</DropdownItem>
24
- </Dropdown>
25
- );
25
+ type Story = StoryObj<typeof meta>;
26
+
27
+ export const Default: Story = {};
28
+
29
+ export const Disabled: Story = {
30
+ args: {
31
+ disabled: true,
32
+ },
33
+ };
@@ -4,6 +4,7 @@ import { Menu, MenuButton, MenuItem, MenuStateProps, useMenuState } from 'ariaki
4
4
 
5
5
  import { Button, BUTTON_SIZE } from '../button';
6
6
  import css from './dropdown.module.css';
7
+ import { Icon } from '../icon';
7
8
 
8
9
  interface DropdownItemProps {
9
10
  isActive?: boolean;
@@ -26,6 +27,7 @@ interface DropdownProps {
26
27
  placement?: MenuStateProps['placement'];
27
28
  gutter?: MenuStateProps['gutter'];
28
29
  shift?: MenuStateProps['shift'];
30
+ showChevron?: boolean;
29
31
  }
30
32
 
31
33
  export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) => {
@@ -35,6 +37,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
35
37
  label = null,
36
38
  ariaLabel = '',
37
39
  glyph = '',
40
+ showChevron = true,
38
41
  disabled = false,
39
42
  placement,
40
43
  gutter = 4,
@@ -43,7 +46,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
43
46
  } = props;
44
47
 
45
48
  const dropdownAriaLabel = ariaLabel || (typeof label === 'string' ? label : '');
46
- const menuState = useMenuState({ placement, gutter, shift });
49
+ const menuState = useMenuState({ animated: true, placement, gutter, shift });
47
50
 
48
51
  return (
49
52
  <>
@@ -52,6 +55,7 @@ export const Dropdown = (props: DropdownProps & React.ComponentProps<'div'>) =>
52
55
  outline
53
56
  size={BUTTON_SIZE.SMALL}
54
57
  glyph={glyph}
58
+ rightGlyph={showChevron ? Icon.ICONS.CHEVRON_DOWN : undefined}
55
59
  disabled={disabled}
56
60
  state={menuState}
57
61
  tabIndex={null}
@@ -13,14 +13,26 @@ export const EmptySet = (props) => {
13
13
  const actions = [
14
14
  ...(handleResetFilters
15
15
  ? [
16
- <Button kind="primary" type="button" onClick={handleResetFilters} className={css.action}>
16
+ <Button
17
+ key="reset-filters"
18
+ kind="primary"
19
+ type="button"
20
+ onClick={handleResetFilters}
21
+ className={css.action}
22
+ >
17
23
  {I18N.RESET_FILTERS}
18
24
  </Button>,
19
25
  ]
20
26
  : []),
21
27
  ...(handleViewAll
22
28
  ? [
23
- <Button kind="primary" type="button" onClick={handleViewAll} className={css.action}>
29
+ <Button
30
+ key="view-all"
31
+ kind="primary"
32
+ type="button"
33
+ onClick={handleViewAll}
34
+ className={css.action}
35
+ >
24
36
  {I18N.VIEW_ALL}
25
37
  </Button>,
26
38
  ]
@@ -32,10 +44,10 @@ export const EmptySet = (props) => {
32
44
  <p>{message}</p>
33
45
  {filtered &&
34
46
  actions.map((action, index) => (
35
- <>
47
+ <React.Fragment key={action.key}>
36
48
  {index > 0 && ' or '}
37
49
  {action}
38
- </>
50
+ </React.Fragment>
39
51
  ))}
40
52
  </Stack>
41
53
  );
@@ -0,0 +1,41 @@
1
+ import type React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { getWrapperDecorator } from '../../stories';
5
+ import { EmptySet } from '.';
6
+
7
+ // EmptySet is a plain .jsx component with defaultProps instead of inline
8
+ // destructuring defaults, so TS can't infer its props as optional on its own.
9
+ const TypedEmptySet = EmptySet as unknown as React.ComponentType<{
10
+ resources: string;
11
+ filtered: boolean;
12
+ handleResetFilters?: () => void;
13
+ handleViewAll?: () => void;
14
+ }>;
15
+
16
+ const meta = {
17
+ title: 'UI/EmptySet',
18
+ component: TypedEmptySet,
19
+ decorators: [getWrapperDecorator()],
20
+ args: {
21
+ resources: 'assets',
22
+ },
23
+ } satisfies Meta<typeof TypedEmptySet>;
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ export const Default: Story = {
30
+ args: {
31
+ filtered: true,
32
+ handleResetFilters: () => console.log('RESET_FILTERS'),
33
+ handleViewAll: () => console.log('VIEW_ALL'),
34
+ },
35
+ };
36
+
37
+ export const Empty: Story = {
38
+ args: {
39
+ filtered: false,
40
+ },
41
+ };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import { getWrapperDecorator } from '../../stories';
5
+ import { FileName } from './file-name';
6
+
7
+ // FileName is a plain .jsx component with defaultProps instead of inline
8
+ // destructuring defaults, so TS can't infer its props as optional on its own.
9
+ const TypedFileName = FileName as unknown as React.ComponentType<{
10
+ className?: string;
11
+ as?: React.ElementType;
12
+ name?: React.ReactNode;
13
+ }>;
14
+
15
+ const meta = {
16
+ title: 'Ui/FileName',
17
+ component: TypedFileName,
18
+ decorators: [getWrapperDecorator()],
19
+ } satisfies Meta<typeof TypedFileName>;
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ const NAMES = [
26
+ 'styles.css',
27
+ './src/components/sources/styles.css',
28
+ 'css ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src!./src/components/sources/source/styles.css',
29
+ 'rreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordeallylongwordrreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordeallylongwordrreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordreallylongwordeallylongword',
30
+ ];
31
+
32
+ export const Default: Story = {
33
+ render: () => (
34
+ <div>
35
+ {NAMES.map((name) => (
36
+ <div
37
+ key={name}
38
+ style={{ padding: '12px', outline: '1px dotted lightpink', margin: '12px' }}
39
+ >
40
+ <TypedFileName name={name} />
41
+ </div>
42
+ ))}
43
+ </div>
44
+ ),
45
+ };
@@ -1,20 +1,25 @@
1
- import React from 'react';
2
- import { Meta } from '@storybook/react';
3
- import { action } from 'storybook/actions'; // eslint-disable-line
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { action } from 'storybook/actions';
4
3
 
5
4
  import { getWrapperDecorator } from '../../stories';
6
5
  import { Filters } from '.';
7
6
 
8
- export default {
7
+ const meta = {
9
8
  title: 'UI/Filters',
10
9
  component: Filters,
11
10
  decorators: [getWrapperDecorator({ paddingLeft: '200px' })],
12
- } as Meta;
11
+ args: {
12
+ onChange: action('CHANGE'),
13
+ },
14
+ } satisfies Meta<typeof Filters>;
13
15
 
14
- export const Default = () => (
15
- <Filters
16
- onChange={action('CHANGE')}
17
- filters={{
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ filters: {
18
23
  changed: {
19
24
  label: 'Changed',
20
25
  defaultValue: true,
@@ -44,14 +49,13 @@ export const Default = () => (
44
49
  },
45
50
  ],
46
51
  },
47
- }}
48
- />
49
- );
52
+ },
53
+ },
54
+ };
50
55
 
51
- export const Overflow = () => (
52
- <Filters
53
- onChange={action('CHANGE')}
54
- filters={{
56
+ export const Overflow: Story = {
57
+ args: {
58
+ filters: {
55
59
  changed: {
56
60
  label: 'Changed',
57
61
  defaultValue: true,
@@ -66,14 +70,13 @@ export const Overflow = () => (
66
70
  defaultValue: true,
67
71
  })),
68
72
  },
69
- }}
70
- />
71
- );
73
+ },
74
+ },
75
+ };
72
76
 
73
- export const DisableOptions = () => (
74
- <Filters
75
- onChange={action('CHANGE')}
76
- filters={{
77
+ export const DisableOptions: Story = {
78
+ args: {
79
+ filters: {
77
80
  changed: {
78
81
  label: 'Changed',
79
82
  defaultValue: false,
@@ -104,6 +107,6 @@ export const DisableOptions = () => (
104
107
  },
105
108
  ],
106
109
  },
107
- }}
108
- />
109
- );
110
+ },
111
+ },
112
+ };
@@ -5,11 +5,14 @@
5
5
  .anchor {
6
6
  display: inline-block;
7
7
  color: inherit;
8
+ cursor: default;
8
9
  text-decoration: none;
10
+ transition: var(--transition-out);
9
11
  }
10
12
 
11
13
  .anchor:hover {
12
14
  color: var(--color-primary);
15
+ transition: var(--transition-in);
13
16
  }
14
17
 
15
18
  .anchor:focus {
@@ -27,4 +30,15 @@
27
30
  will-change: filter;
28
31
  background: var(--color-light);
29
32
  font-size: var(--size-small);
33
+ opacity: 0;
34
+ transition: var(--transition-out);
35
+ }
36
+
37
+ .hoverCard[data-enter] {
38
+ opacity: 1;
39
+ transition: var(--transition-in);
40
+ }
41
+
42
+ .hoverCard[data-leave] {
43
+ pointer-events: none;
30
44
  }
@@ -1,34 +1,43 @@
1
1
  import React from 'react';
2
- import { Meta, Story } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
3
 
4
- import { HoverCard, HoverCardProps } from '.';
4
+ import { HoverCard } from '.';
5
5
 
6
- export default {
6
+ const meta = {
7
7
  title: 'UI/HoverCard',
8
8
  component: HoverCard,
9
- } as Meta;
9
+ render: (args) => (
10
+ <>
11
+ <HoverCard {...args} />
12
+ <p style={{ position: 'relative', zIndex: 1, maxWidth: 360 }}>
13
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in neque ante. Curabitur
14
+ vehicula, lorem sit amet fringilla dapibus, justo mauris varius elit, ut fermentum leo velit
15
+ eget risus
16
+ </p>
17
+ </>
18
+ ),
19
+ } satisfies Meta<typeof HoverCard>;
10
20
 
11
- const Template: Story<HoverCardProps> = (props) => (
12
- <>
13
- <HoverCard {...props} />
14
- <p style={{ position: 'relative', zIndex: 1, maxWidth: 360 }}>
15
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in neque ante. Curabitur
16
- vehicula, lorem sit amet fringilla dapibus, justo mauris varius elit, ut fermentum leo velit
17
- eget risus
18
- </p>
19
- </>
20
- );
21
+ export default meta;
21
22
 
22
- export const Default = () => (
23
- <Template label="main.js">
24
- <h1>main.js</h1>
25
- <p>info</p>
26
- </Template>
27
- );
23
+ type Story = StoryObj<typeof meta>;
28
24
 
29
- export const WithRenderFn = () => (
30
- <Template label="main.js">
31
- {({ close }) => (
25
+ export const Default: Story = {
26
+ args: {
27
+ label: 'main.js',
28
+ children: (
29
+ <>
30
+ <h1>main.js</h1>
31
+ <p>info</p>
32
+ </>
33
+ ),
34
+ },
35
+ };
36
+
37
+ export const WithRenderFn: Story = {
38
+ args: {
39
+ label: 'main.js',
40
+ children: ({ close }) => (
32
41
  <div>
33
42
  <h1>main.js</h1>
34
43
  <p>info</p>
@@ -36,6 +45,6 @@ export const WithRenderFn = () => (
36
45
  close
37
46
  </button>
38
47
  </div>
39
- )}
40
- </Template>
41
- );
48
+ ),
49
+ },
50
+ };
@@ -31,7 +31,7 @@ export const HoverCard = (props: HoverCardProps) => {
31
31
  children,
32
32
  } = props;
33
33
 
34
- const state = useHovercardState({ gutter: 8, timeout: 300, placement: 'top' });
34
+ const state = useHovercardState({ animated: true, gutter: 8, timeout: 300, placement: 'top' });
35
35
  const hovercardProps = useHovercard({ state, portal: true });
36
36
 
37
37
  // Fallback to span if no href
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { Meta, Story } from '@storybook/react';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
3
 
4
4
  import { Icon } from '.';
5
5
 
6
- export default {
6
+ const meta = {
7
7
  title: 'UI/Icon',
8
8
  component: Icon,
9
9
  args: {
@@ -19,36 +19,44 @@ export default {
19
19
  control: { type: 'select' },
20
20
  },
21
21
  },
22
- } as Meta;
22
+ } satisfies Meta<typeof Icon>;
23
23
 
24
- const Template: Story = (args: any) => <Icon {...args} />;
24
+ export default meta;
25
25
 
26
- export const Standard = Template.bind({});
26
+ type Story = StoryObj<typeof meta>;
27
27
 
28
- Standard.args = {
29
- glyph: Icon.ICONS.ARROW,
28
+ export const Standard: Story = {
29
+ args: {
30
+ glyph: Icon.ICONS.ARROW,
31
+ },
30
32
  };
31
33
 
32
- export const CustomSize = Template.bind({});
33
-
34
- CustomSize.args = {
35
- glyph: Icon.ICONS.ARROW,
36
- size: Icon.SIZE_LARGE,
34
+ export const CustomSize: Story = {
35
+ args: {
36
+ glyph: Icon.ICONS.ARROW,
37
+ size: Icon.SIZE_LARGE,
38
+ },
37
39
  };
38
40
 
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
- );
41
+ export const All: Story = {
42
+ args: {
43
+ glyph: Icon.ICONS.ARROW,
44
+ },
45
+ render: ({ size }) => (
46
+ <>
47
+ {Object.values(Icon.ICONS).map((glyph) => (
48
+ <div
49
+ key={glyph}
50
+ style={{
51
+ display: 'inline-block',
52
+ padding: '1rem',
53
+ textAlign: 'center',
54
+ }}
55
+ >
56
+ <Icon glyph={glyph} size={size} />
57
+ <code style={{ display: 'block' }}>{glyph}</code>
58
+ </div>
59
+ ))}
60
+ </>
61
+ ),
62
+ };
@@ -1,13 +1,25 @@
1
- import React from 'react';
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
2
 
3
3
  import { getWrapperDecorator } from '../../stories';
4
4
  import { Input } from '.';
5
5
 
6
- export default {
6
+ const meta = {
7
7
  title: 'UI/Input',
8
8
  component: Input,
9
9
  decorators: [getWrapperDecorator()],
10
- };
10
+ args: {
11
+ placeholder: 'Search',
12
+ },
13
+ } satisfies Meta<typeof Input>;
14
+
15
+ export default meta;
16
+
17
+ type Story = StoryObj<typeof meta>;
11
18
 
12
- export const Default = () => <Input placeholder="Search" />;
13
- export const WithSize = () => <Input placeholder="Search" size="small" />;
19
+ export const Default: Story = {};
20
+
21
+ export const WithSize: Story = {
22
+ args: {
23
+ size: 'small',
24
+ },
25
+ };