@bundle-stats/ui 4.8.4 → 4.9.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 (161) hide show
  1. package/lib/components/bundle-assets/bundle-assets.js +2 -2
  2. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  3. package/lib/components/bundle-modules/bundle-modules.js +2 -2
  4. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  5. package/lib/components/bundle-packages/bundle-packages.js +2 -2
  6. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  7. package/lib/components/entry-info/entry-info.js +2 -1
  8. package/lib/components/entry-info/entry-info.js.map +1 -1
  9. package/lib/components/entry-info/entry-info.module.css +0 -6
  10. package/lib/components/index.js +1 -3
  11. package/lib/components/index.js.map +1 -1
  12. package/lib/components/metric-run-info/metric-run-info.js +2 -1
  13. package/lib/components/metric-run-info/metric-run-info.js.map +1 -1
  14. package/lib/components/metric-run-info/metric-run-info.module.css +0 -18
  15. package/lib/components/metrics-table/metrics-table.js +2 -1
  16. package/lib/components/metrics-table/metrics-table.js.map +1 -1
  17. package/lib/components/metrics-table/metrics-table.module.css +0 -18
  18. package/lib/components/metrics-table-title/metrics-table-title.js +2 -1
  19. package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
  20. package/lib/components/metrics-table-title/metrics-table-title.module.css +0 -18
  21. package/lib/components/sort-button/sort-button.js +4 -3
  22. package/lib/components/sort-button/sort-button.js.map +1 -1
  23. package/lib/components/sort-button/sort-button.module.css +5 -12
  24. package/lib/components/summary/summary.module.css +0 -18
  25. package/lib/components/total-size-type-title/total-size-type-title.js +2 -1
  26. package/lib/components/total-size-type-title/total-size-type-title.js.map +1 -1
  27. package/lib/components/total-size-type-title/total-size-type-title.module.css +0 -18
  28. package/lib/css/variables.css +14 -14
  29. package/lib/ui/button/button.js +34 -0
  30. package/lib/ui/button/button.js.map +1 -0
  31. package/lib/ui/button/button.module.css +285 -0
  32. package/lib/{components/metrics-table-search → ui/button}/index.js +1 -1
  33. package/lib/ui/button/index.js.map +1 -0
  34. package/lib/ui/dropdown/dropdown.module.css +1 -3
  35. package/lib/ui/empty-set/empty-set.js +4 -3
  36. package/lib/ui/empty-set/empty-set.js.map +1 -1
  37. package/lib/ui/empty-set/empty-set.module.css +0 -17
  38. package/lib/ui/filters/filters.i18n.js +5 -1
  39. package/lib/ui/filters/filters.i18n.js.map +1 -1
  40. package/lib/ui/filters/filters.js +24 -7
  41. package/lib/ui/filters/filters.js.map +1 -1
  42. package/lib/ui/filters/filters.module.css +14 -36
  43. package/lib/ui/index.js +5 -1
  44. package/lib/ui/index.js.map +1 -1
  45. package/lib/ui/input/index.js.map +1 -1
  46. package/lib/ui/input/input.js +2 -10
  47. package/lib/ui/input/input.js.map +1 -1
  48. package/lib/ui/input-search/index.js +18 -0
  49. package/lib/ui/input-search/index.js.map +1 -0
  50. package/lib/ui/input-search/input-search.js +64 -0
  51. package/lib/ui/input-search/input-search.js.map +1 -0
  52. package/lib/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +1 -18
  53. package/lib-esm/components/bundle-assets/bundle-assets.js +2 -2
  54. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  55. package/lib-esm/components/bundle-modules/bundle-modules.js +2 -2
  56. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  57. package/lib-esm/components/bundle-packages/bundle-packages.js +2 -2
  58. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  59. package/lib-esm/components/entry-info/entry-info.js +2 -1
  60. package/lib-esm/components/entry-info/entry-info.js.map +1 -1
  61. package/lib-esm/components/entry-info/entry-info.module.css +0 -6
  62. package/lib-esm/components/index.js +0 -1
  63. package/lib-esm/components/index.js.map +1 -1
  64. package/lib-esm/components/metric-run-info/metric-run-info.js +2 -1
  65. package/lib-esm/components/metric-run-info/metric-run-info.js.map +1 -1
  66. package/lib-esm/components/metric-run-info/metric-run-info.module.css +0 -18
  67. package/lib-esm/components/metrics-table/metrics-table.js +2 -1
  68. package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
  69. package/lib-esm/components/metrics-table/metrics-table.module.css +0 -18
  70. package/lib-esm/components/metrics-table-title/metrics-table-title.js +2 -1
  71. package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
  72. package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +0 -18
  73. package/lib-esm/components/sort-button/sort-button.js +4 -3
  74. package/lib-esm/components/sort-button/sort-button.js.map +1 -1
  75. package/lib-esm/components/sort-button/sort-button.module.css +5 -12
  76. package/lib-esm/components/summary/summary.module.css +0 -18
  77. package/lib-esm/components/total-size-type-title/total-size-type-title.js +2 -1
  78. package/lib-esm/components/total-size-type-title/total-size-type-title.js.map +1 -1
  79. package/lib-esm/components/total-size-type-title/total-size-type-title.module.css +0 -18
  80. package/lib-esm/css/variables.css +14 -14
  81. package/lib-esm/ui/button/button.js +27 -0
  82. package/lib-esm/ui/button/button.js.map +1 -0
  83. package/lib-esm/ui/button/button.module.css +285 -0
  84. package/lib-esm/ui/button/index.js +2 -0
  85. package/lib-esm/ui/button/index.js.map +1 -0
  86. package/lib-esm/ui/dropdown/dropdown.module.css +1 -3
  87. package/lib-esm/ui/empty-set/empty-set.js +4 -3
  88. package/lib-esm/ui/empty-set/empty-set.js.map +1 -1
  89. package/lib-esm/ui/empty-set/empty-set.module.css +0 -17
  90. package/lib-esm/ui/filters/filters.i18n.js +4 -0
  91. package/lib-esm/ui/filters/filters.i18n.js.map +1 -1
  92. package/lib-esm/ui/filters/filters.js +25 -8
  93. package/lib-esm/ui/filters/filters.js.map +1 -1
  94. package/lib-esm/ui/filters/filters.module.css +14 -36
  95. package/lib-esm/ui/index.js +2 -0
  96. package/lib-esm/ui/index.js.map +1 -1
  97. package/lib-esm/ui/input/index.js.map +1 -1
  98. package/lib-esm/ui/input/input.js +2 -10
  99. package/lib-esm/ui/input/input.js.map +1 -1
  100. package/lib-esm/ui/input-search/index.js +2 -0
  101. package/lib-esm/ui/input-search/index.js.map +1 -0
  102. package/lib-esm/ui/input-search/input-search.js +34 -0
  103. package/lib-esm/ui/input-search/input-search.js.map +1 -0
  104. package/lib-esm/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +1 -18
  105. package/package.json +9 -9
  106. package/src/components/bundle-assets/bundle-assets.jsx +4 -4
  107. package/src/components/bundle-modules/bundle-modules.tsx +4 -4
  108. package/src/components/bundle-packages/bundle-packages.jsx +4 -4
  109. package/src/components/entry-info/entry-info.module.css +0 -6
  110. package/src/components/entry-info/entry-info.tsx +4 -2
  111. package/src/components/index.js +0 -1
  112. package/src/components/metric-run-info/metric-run-info.module.css +0 -18
  113. package/src/components/metric-run-info/metric-run-info.tsx +3 -2
  114. package/src/components/metrics-table/metrics-table.module.css +0 -18
  115. package/src/components/metrics-table/metrics-table.tsx +9 -6
  116. package/src/components/metrics-table-title/metrics-table-title.jsx +7 -3
  117. package/src/components/metrics-table-title/metrics-table-title.module.css +0 -18
  118. package/src/components/sort-button/sort-button.module.css +5 -12
  119. package/src/components/sort-button/sort-button.tsx +5 -6
  120. package/src/components/summary/summary.module.css +0 -18
  121. package/src/components/total-size-type-title/total-size-type-title.jsx +4 -2
  122. package/src/components/total-size-type-title/total-size-type-title.module.css +0 -18
  123. package/src/css/variables.css +14 -14
  124. package/src/ui/button/button.module.css +285 -0
  125. package/src/ui/button/button.stories.tsx +108 -0
  126. package/src/ui/button/button.tsx +72 -0
  127. package/src/ui/button/index.ts +1 -0
  128. package/src/ui/dropdown/dropdown.module.css +1 -3
  129. package/src/ui/empty-set/empty-set.jsx +6 -5
  130. package/src/ui/empty-set/empty-set.module.css +0 -17
  131. package/src/ui/filters/filters.i18n.ts +4 -0
  132. package/src/ui/filters/filters.module.css +14 -36
  133. package/src/ui/filters/filters.tsx +76 -28
  134. package/src/ui/index.js +2 -0
  135. package/src/ui/input/input.stories.tsx +13 -0
  136. package/src/ui/input/input.tsx +16 -0
  137. package/src/ui/input-search/index.ts +1 -0
  138. package/src/{components/metrics-table-search/metrics-table-search.module.css → ui/input-search/input-search.module.css} +1 -18
  139. package/src/ui/input-search/input-search.tsx +85 -0
  140. package/types/components/index.d.ts +0 -1
  141. package/types/ui/button/button.d.ts +42 -0
  142. package/types/ui/button/index.d.ts +1 -0
  143. package/types/ui/filters/filters.i18n.d.ts +4 -0
  144. package/types/ui/index.d.ts +2 -0
  145. package/types/ui/input/index.d.ts +1 -1
  146. package/types/ui/input/input.d.ts +5 -18
  147. package/types/ui/input-search/index.d.ts +1 -0
  148. package/types/ui/input-search/input-search.d.ts +9 -0
  149. package/lib/components/metrics-table-search/index.js.map +0 -1
  150. package/lib/components/metrics-table-search/metrics-table-search.js +0 -73
  151. package/lib/components/metrics-table-search/metrics-table-search.js.map +0 -1
  152. package/lib-esm/components/metrics-table-search/index.js +0 -2
  153. package/lib-esm/components/metrics-table-search/index.js.map +0 -1
  154. package/lib-esm/components/metrics-table-search/metrics-table-search.js +0 -43
  155. package/lib-esm/components/metrics-table-search/metrics-table-search.js.map +0 -1
  156. package/src/components/metrics-table-search/index.js +0 -1
  157. package/src/components/metrics-table-search/metrics-table-search.jsx +0 -72
  158. package/src/ui/input/input.jsx +0 -20
  159. package/types/components/metrics-table-search/index.d.ts +0 -1
  160. package/types/components/metrics-table-search/metrics-table-search.d.ts +0 -17
  161. /package/src/ui/input/{index.js → index.ts} +0 -0
@@ -5,6 +5,7 @@ import cx from 'classnames';
5
5
  import I18N from '../../i18n';
6
6
  import { FlexStack } from '../../layout/flex-stack';
7
7
  import { Stack } from '../../layout/stack';
8
+ import { Button } from '../../ui/button';
8
9
  import { Icon } from '../../ui/icon';
9
10
  import { HoverCard } from '../../ui/hover-card';
10
11
  import css from './metrics-table-title.module.css';
@@ -19,14 +20,17 @@ export const MetricsTableTitle = (props) => {
19
20
  <span>{title}</span>
20
21
 
21
22
  {(popoverInfo || popoverHref) && (
22
- <HoverCard label={<Icon glyph={Icon.ICONS.HELP} className={css.anchorIcon} />} anchorClassName={css.anchor}>
23
+ <HoverCard
24
+ label={<Icon glyph={Icon.ICONS.HELP} className={css.anchorIcon} />}
25
+ anchorClassName={css.anchor}
26
+ >
23
27
  <Stack space="xxxsmall">
24
28
  {popoverInfo && <p>{popoverInfo}</p>}
25
29
  {popoverHref && (
26
30
  <p>
27
- <button type="button" onClick={() => window.open(popoverHref)} className={css.readMoreLink}>
31
+ <Button kind="primary" type="button" onClick={() => window.open(popoverHref)}>
28
32
  {I18N.READ_MORE}
29
- </button>
33
+ </Button>
30
34
  </p>
31
35
  )}
32
36
  </Stack>
@@ -23,21 +23,3 @@
23
23
  font-size: var(--size-xsmall);
24
24
  font-weight: bold;
25
25
  }
26
-
27
- .readMoreLink {
28
- appearance: none;
29
- background: none;
30
- margin: 0;
31
- border: 0;
32
- padding: 0;
33
- color: var(--color-primary);
34
- text-decoration: underline;
35
- cursor: pointer;
36
- }
37
-
38
- .readMoreLink:hover,
39
- .readMoreLink:active,
40
- .readMoreLink:focus {
41
- color: var(--color-primary-dark);
42
- text-decoration: none;
43
- }
@@ -1,22 +1,10 @@
1
1
  .root {
2
2
  --icon-dimension: 13px;
3
3
  display: inline-block;
4
- margin: calc(0px - var(--space-xxxsmall));
5
- margin-right: calc(0px - 1px - var(--icon-dimension));
6
4
  border-radius: var(--radius-small);
7
5
  position: relative;
8
6
  }
9
7
 
10
- .button {
11
- appearance: none;
12
- cursor: pointer;
13
- border: 0;
14
- padding: 0;
15
- margin: 0;
16
- background: transparent;
17
- transition: var(--transition-out);
18
- }
19
-
20
8
  .toggle {
21
9
  padding: 1px var(--space-xxxsmall);
22
10
  padding-right: calc(1px + var(--icon-dimension));
@@ -68,6 +56,11 @@
68
56
  transform: translateY(-5px);
69
57
  }
70
58
 
59
+ .interactive {
60
+ margin: calc(0px - var(--space-xxxsmall));
61
+ margin-right: calc(0px - 1px - var(--icon-dimension));
62
+ }
63
+
71
64
  .interactive:hover,
72
65
  .interactive:active,
73
66
  .interactive:focus {
@@ -3,6 +3,7 @@ import cx from 'classnames';
3
3
 
4
4
  import { SORT } from '../../constants';
5
5
  import type { SortAction } from '../../types';
6
+ import { Button } from '../../ui/button';
6
7
  import { Icon } from '../../ui/icon';
7
8
  import { Tooltip } from '../../ui/tooltip';
8
9
  import css from './sort-button.module.css';
@@ -76,20 +77,19 @@ export const SortButton = (props: SortButtonProps & React.ComponentProps<'div'>)
76
77
  <div className={cx(css.root, css.interactive, className, isSorted && css.active)}>
77
78
  <Tooltip
78
79
  title={toggleAction.title}
79
- as="button"
80
+ as={Button}
80
81
  type="button"
81
82
  onClick={getOrderOnClick(toggleAction)}
82
- className={cx(css.button, css.toggle)}
83
+ className={css.toggle}
83
84
  >
84
85
  {children}
85
86
  </Tooltip>
86
87
  <Tooltip
87
88
  title={ascAction.title}
88
- as="button"
89
+ as={Button}
89
90
  type="button"
90
91
  onClick={getOrderOnClick(ascAction)}
91
92
  className={cx(
92
- css.button,
93
93
  css.direction,
94
94
  css.directionAsc,
95
95
  isSorted && sort.direction === SORT.ASC && css.directionActive,
@@ -99,11 +99,10 @@ export const SortButton = (props: SortButtonProps & React.ComponentProps<'div'>)
99
99
  </Tooltip>
100
100
  <Tooltip
101
101
  title={descAction.title}
102
- as="button"
102
+ as={Button}
103
103
  type="button"
104
104
  onClick={getOrderOnClick(descAction)}
105
105
  className={cx(
106
- css.button,
107
106
  css.direction,
108
107
  css.directionDesc,
109
108
  isSorted && sort.direction === SORT.DESC && css.directionActive,
@@ -29,21 +29,3 @@
29
29
  .itemSmall {
30
30
  min-width: 8em;
31
31
  }
32
-
33
- .readMoreLink {
34
- appearance: none;
35
- background: none;
36
- margin: 0;
37
- border: 0;
38
- padding: 0;
39
- color: var(--color-primary);
40
- text-decoration: underline;
41
- cursor: pointer;
42
- }
43
-
44
- .readMoreLink:hover,
45
- .readMoreLink:active,
46
- .readMoreLink:focus {
47
- color: var(--color-primary-dark);
48
- text-decoration: none;
49
- }
@@ -6,6 +6,7 @@ import config from '../../config.json';
6
6
  import I18N from '../../i18n';
7
7
  import { FlexStack } from '../../layout/flex-stack';
8
8
  import { Stack } from '../../layout/stack';
9
+ import { Button } from '../../ui/button';
9
10
  import { Icon } from '../../ui/icon';
10
11
  import { HoverCard } from '../../ui/hover-card';
11
12
  import css from './total-size-type-title.module.css';
@@ -17,13 +18,14 @@ export const TotalSizeTypeTitle = ({ className }) => (
17
18
  <Stack space="xxxsmall">
18
19
  <p>{I18N.ASSET_TOTALS_INFO}</p>
19
20
  <p>
20
- <button
21
+ <Button
22
+ kind="primary"
21
23
  type="button"
22
24
  onClick={() => window.open(config.documentation.assets)}
23
25
  className={css.readMoreLink}
24
26
  >
25
27
  {I18N.READ_MORE}
26
- </button>
28
+ </Button>
27
29
  </p>
28
30
  </Stack>
29
31
  </HoverCard>
@@ -12,21 +12,3 @@
12
12
  .anchor {
13
13
  display: block;
14
14
  }
15
-
16
- .readMoreLink {
17
- appearance: none;
18
- background: none;
19
- margin: 0;
20
- border: 0;
21
- padding: 0;
22
- color: var(--color-primary);
23
- text-decoration: underline;
24
- cursor: pointer;
25
- }
26
-
27
- .readMoreLink:hover,
28
- .readMoreLink:active,
29
- .readMoreLink:focus {
30
- color: var(--color-primary-dark);
31
- text-decoration: none;
32
- }
@@ -28,8 +28,8 @@
28
28
 
29
29
  /*
30
30
  * Color scheme:
31
- * https://coolors.co/287acc-da444e-55b950-f6e179-192339
32
- * http://mcg.mbitson.com/#!?mcgpalette0=%23da444e&mcgpalette1=%2355b950&mcgpalette2=%23f3d966&mcgpalette3=%23353138&mcgpalette4=%23287acc&themename=mcgtheme
31
+ * https://coolors.co/287acc-da444e-55b950-efcc1a-192339
32
+ * http://mcg.mbitson.com/#!?mcgpalette0=%23da444e&mcgpalette1=%2355b950&mcgpalette2=%23efcc1a&mcgpalette3=%23353138&mcgpalette4=%23287acc&themename=mcgtheme
33
33
  * https://hihayk.github.io/scale/#4/5/50/90/-51/0/0/14/353138/53/49/56/white
34
34
  */
35
35
  --color-gray-25: #f9f9fa;
@@ -104,16 +104,16 @@
104
104
  --color-green-ultra-dark: var(--color-green-900);
105
105
 
106
106
  --color-yellow-25: #fffdf2;
107
- --color-yellow-50: #fefaed;
108
- --color-yellow-100: #fbf4d1;
109
- --color-yellow-200: #f9ecb3;
110
- --color-yellow-300: #f7e494;
111
- --color-yellow-400: #f5df7d;
112
- --color-yellow-500: #f3d966;
113
- --color-yellow-600: #f1d55e;
114
- --color-yellow-700: #efcf53;
115
- --color-yellow-800: #edca49;
116
- --color-yellow-900: #eac038;
107
+ --color-yellow-50: #fdf9e4;
108
+ --color-yellow-100: #faf0ba;
109
+ --color-yellow-200: #f7e68d;
110
+ --color-yellow-300: #f4db5f;
111
+ --color-yellow-400: #f1d43c;
112
+ --color-yellow-500: #efcc1a;
113
+ --color-yellow-600: #edc717;
114
+ --color-yellow-700: #ebc013;
115
+ --color-yellow-800: #e8b90f;
116
+ --color-yellow-900: #e4ad08;
117
117
 
118
118
  --color-yellow-light-background: var(--color-yellow-25);
119
119
  --color-yellow-ultra-light: var(--color-yellow-100);
@@ -189,9 +189,9 @@
189
189
  --shadow-layer: 0 0 var(--space-xxxsmall) var(--color-shadow);
190
190
  --shadow-layer-high: 0 0 var(--space-xxsmall) var(--color-shadow);
191
191
 
192
- --radius-small: 3px;
192
+ --radius-small: 4px;
193
193
  --radius-medium: 5px;
194
- --radius-large: 9px;
194
+ --radius-large: 6px;
195
195
 
196
196
  --outline-hover: 0 0 0 3px var(--color-highlight);
197
197
 
@@ -0,0 +1,285 @@
1
+ .root {
2
+ appearance: none;
3
+ padding: 0;
4
+ border: 0;
5
+ background: none;
6
+ transition: var(--transition-out);
7
+ color: var(--color-text-ultra-light);
8
+ line-height: 1;
9
+ }
10
+
11
+ .root:hover,
12
+ .root:active,
13
+ .root:focus {
14
+ color: var(--color-text-light);
15
+ transition: var(--transition-in);
16
+ }
17
+
18
+ /**
19
+ * Kind variation
20
+ */
21
+ .primary {
22
+ color: var(--color-primary);
23
+ }
24
+
25
+ .primary:hover,
26
+ .primary:active,
27
+ .primary:focus {
28
+ color: var(--color-primary-dark);
29
+ }
30
+
31
+ .secondary {
32
+ color: var(--color-secondary);
33
+ }
34
+
35
+ .secondary:hover,
36
+ .secondary:active,
37
+ .secondary:focus {
38
+ color: var(--color-secondary-dark);
39
+ }
40
+
41
+ .danger {
42
+ color: var(--color-danger);
43
+ }
44
+
45
+ .danger:hover,
46
+ .danger:active,
47
+ .danger:focus {
48
+ color: var(--color-danger-dark);
49
+ }
50
+
51
+ .warning {
52
+ color: var(--color-warning);
53
+ }
54
+
55
+ .warning:hover,
56
+ .warning:active,
57
+ .warning:focus {
58
+ color: var(--color-warning-dark);
59
+ }
60
+
61
+ .info {
62
+ color: var(--color-info);
63
+ }
64
+
65
+ .info:hover,
66
+ .info:active,
67
+ .info:focus {
68
+ color: var(--color-info-dark);
69
+ }
70
+
71
+ .success {
72
+ color: var(--color-success);
73
+ }
74
+
75
+ .success:hover,
76
+ .success:active,
77
+ .success:focus {
78
+ color: var(--color-success-dark);
79
+ }
80
+
81
+ /**
82
+ * Solid Kind variation
83
+ */
84
+ .solid {
85
+ background: var(--color-text-light);
86
+ color: var(--color-background);
87
+ }
88
+
89
+ .solid:hover,
90
+ .solid:active,
91
+ .solid:focus {
92
+ box-shadow: var(--outline-hover);
93
+ background: var(--color-text);
94
+ color: var(--color-background);
95
+ }
96
+
97
+ .solid--primary {
98
+ background: var(--color-primary);
99
+ }
100
+
101
+ .solid--primary:hover,
102
+ .solid--primary:active,
103
+ .solid--primary:focus {
104
+ background: var(--color-primary-dark);
105
+ }
106
+
107
+ .solid--secondary {
108
+ background: var(--color-secondary);
109
+ }
110
+
111
+ .solid--secondary:hover,
112
+ .solid--secondary:active,
113
+ .solid--secondary:focus {
114
+ background: var(--color-secondary-dark);
115
+ }
116
+
117
+ .solid--danger {
118
+ background: var(--color-danger);
119
+ }
120
+
121
+ .solid--danger:hover,
122
+ .solid--danger:active,
123
+ .solid--danger:focus {
124
+ background: var(--color-danger-dark);
125
+ }
126
+
127
+ .solid--warning {
128
+ background: var(--color-warning);
129
+ }
130
+
131
+ .solid--warning:hover,
132
+ .solid--warning:active,
133
+ .solid--warning:focus {
134
+ background: var(--color-warning-dark);
135
+ }
136
+
137
+ .solid--info {
138
+ background: var(--color-info);
139
+ }
140
+
141
+ .solid--info:hover,
142
+ .solid--info:active,
143
+ .solid--info:focus {
144
+ background: var(--color-info-dark);
145
+ }
146
+
147
+ .solid--success {
148
+ background: var(--color-success);
149
+ }
150
+
151
+ .solid--success:hover,
152
+ .solid--success:active,
153
+ .solid--success:focus {
154
+ background: var(--color-success-dark);
155
+ }
156
+
157
+ /**
158
+ * Outline variation
159
+ */
160
+ .outline {
161
+ border: 1px solid var(--color-outline);
162
+ }
163
+
164
+ .outline:hover,
165
+ .outline:active,
166
+ .outline:focus {
167
+ box-shadow: var(--outline-hover);
168
+ border-color: var(--color-outline-dark);
169
+ }
170
+
171
+ .outline--primary {
172
+ border-color: var(--color-outline-primary);
173
+ }
174
+
175
+ .outline--primary:hover,
176
+ .outline--primary:active,
177
+ .outline--primary:focus {
178
+ border-color: var(--color-outline-primary-dark);
179
+ }
180
+
181
+ .outline--secondary {
182
+ border-color: var(--color-outline-secondary);
183
+ }
184
+
185
+ .outline--secondary:hover,
186
+ .outline--secondary:active,
187
+ .outline--secondary:focus {
188
+ border-color: var(--color-outline-secondary-dark);
189
+ }
190
+
191
+ .outline--danger {
192
+ border-color: var(--color-outline-danger);
193
+ }
194
+
195
+ .outline--danger:hover,
196
+ .outline--danger:active,
197
+ .outline--danger:focus {
198
+ border-color: var(--color-outline-danger-dark);
199
+ }
200
+
201
+ .outline--warning {
202
+ border-color: var(--color-outline-warning);
203
+ }
204
+
205
+ .outline--warning:hover,
206
+ .outline--warning:active,
207
+ .outline--warning:focus {
208
+ border-color: var(--color-outline-warning-dark);
209
+ }
210
+
211
+ .outline--info {
212
+ border-color: var(--color-outline-info);
213
+ }
214
+
215
+ .outline--info:hover,
216
+ .outline--info:active,
217
+ .outline--info:focus {
218
+ border-color: var(--color-outline-info-dark);
219
+ }
220
+
221
+ .outline--success {
222
+ border-color: var(--color-outline-success);
223
+ }
224
+
225
+ .outline--success:hover,
226
+ .outline--success:active,
227
+ .outline--success:focus {
228
+ border-color: var(--color-outline-success-dark);
229
+ }
230
+
231
+ /**
232
+ * Size variation
233
+ */
234
+ .small {
235
+ font-size: var(--size-small);
236
+ }
237
+
238
+ .medium {
239
+ font-size: var(--size-medium);
240
+ }
241
+
242
+ .large {
243
+ font-size: var(--size-large);
244
+ }
245
+
246
+ /**
247
+ * Padding variation
248
+ */
249
+ .padding--small {
250
+ padding: var(--space-xxsmall);
251
+ }
252
+
253
+ .padding--medium {
254
+ padding: var(--space-xsmall);
255
+ }
256
+
257
+ .padding--large {
258
+ padding: var(--space-small);
259
+ }
260
+
261
+ /**
262
+ * Radius variation
263
+ */
264
+ .radius--small {
265
+ border-radius: var(--radius-small);
266
+ }
267
+
268
+ .radius--medium {
269
+ border-radius: var(--radius-medium);
270
+ }
271
+
272
+ .radius--large {
273
+ border-radius: var(--radius-large);
274
+ }
275
+
276
+ .radius--circle {
277
+ border-radius: 50%;
278
+ }
279
+
280
+ /**
281
+ * Disabled state
282
+ */
283
+ .root[disabled] {
284
+ filter: grayscale(1);
285
+ }
@@ -0,0 +1,108 @@
1
+ import React from 'react';
2
+ import { Meta, Story } from '@storybook/react';
3
+
4
+ import { Stack } from '../../layout/stack';
5
+ import { FlexStack } from '../../layout/flex-stack';
6
+ import { Button } from '.';
7
+
8
+ export default {
9
+ title: 'UI/Button',
10
+ component: Button,
11
+ } as Meta;
12
+
13
+ const Template: Story = ({ children = 'Action', ...props }) => (
14
+ <Button {...props}>{children}</Button>
15
+ );
16
+
17
+ export const Default = Template.bind({});
18
+
19
+ export const All = () => (
20
+ <Stack space="large">
21
+ <Stack space="medium">
22
+ <h2>Size</h2>
23
+ <FlexStack space="small" alignItems="top">
24
+ {Object.values(Button.SIZE).map((size) => (
25
+ <Button size={size} key={size}>
26
+ Action {size}
27
+ </Button>
28
+ ))}
29
+ </FlexStack>
30
+ </Stack>
31
+ <Stack space="medium">
32
+ <h2>Kind</h2>
33
+ <Stack space="small">
34
+ <FlexStack space="small" alignItems="top">
35
+ {Object.values(Button.KIND).map((kind) => (
36
+ <Button kind={kind} key={kind}>
37
+ Action {kind}
38
+ </Button>
39
+ ))}
40
+ </FlexStack>
41
+ <h3>Disabled</h3>
42
+ <FlexStack space="small" alignItems="top">
43
+ {Object.values(Button.KIND).map((kind) => (
44
+ <Button kind={kind} key={kind} disabled>
45
+ Action {kind}
46
+ </Button>
47
+ ))}
48
+ </FlexStack>
49
+ </Stack>
50
+ </Stack>
51
+ <Stack space="medium">
52
+ <h2>Outline & Kind</h2>
53
+ <Stack space="small">
54
+ {Object.values(Button.SIZE).map((size) => (
55
+ <FlexStack space="small" alignItems="top" key={size}>
56
+ <Button outline size={size}>
57
+ Action default
58
+ </Button>
59
+ {Object.values(Button.KIND).map((kind) => (
60
+ <Button outline kind={kind} key={kind} size={size}>
61
+ Action {kind}
62
+ </Button>
63
+ ))}
64
+ </FlexStack>
65
+ ))}
66
+ <h3>Disabled</h3>
67
+ <FlexStack space="small" alignItems="top">
68
+ <Button outline disabled>
69
+ Action default
70
+ </Button>
71
+ {Object.values(Button.KIND).map((kind) => (
72
+ <Button outline kind={kind} key={kind} disabled>
73
+ Action {kind}
74
+ </Button>
75
+ ))}
76
+ </FlexStack>
77
+ </Stack>
78
+ </Stack>
79
+ <Stack space="medium">
80
+ <h2>Solid & Kind</h2>
81
+ <Stack space="small">
82
+ {Object.values(Button.SIZE).map((size) => (
83
+ <FlexStack space="small" alignItems="top" key={size}>
84
+ <Button solid size={size}>
85
+ Action default
86
+ </Button>
87
+ {Object.values(Button.KIND).map((kind) => (
88
+ <Button solid kind={kind} key={kind} size={size}>
89
+ Action {kind}
90
+ </Button>
91
+ ))}
92
+ </FlexStack>
93
+ ))}
94
+ <h3>Disabled</h3>
95
+ <FlexStack space="small" alignItems="top">
96
+ <Button solid disabled>
97
+ Action default
98
+ </Button>
99
+ {Object.values(Button.KIND).map((kind) => (
100
+ <Button solid kind={kind} key={kind} disabled>
101
+ Action {kind}
102
+ </Button>
103
+ ))}
104
+ </FlexStack>
105
+ </Stack>
106
+ </Stack>
107
+ </Stack>
108
+ );