@primer/components 0.0.0-2021927203131 → 0.0.0-2021927232856

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.
@@ -35,14 +35,33 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
35
35
 
36
36
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
37
37
 
38
+ /**
39
+ * These colors are not yet in our default theme. Need to remove this once they are added.
40
+ */
38
41
  const customItemThemes = {
39
42
  default: {
40
- hover: (0, _constants.get)('colors.neutral.subtle'),
41
- focus: (0, _constants.get)('colors.neutral.muted')
43
+ hover: {
44
+ light: 'rgba(46, 77, 108, 0.06)',
45
+ dark: 'rgba(201, 206, 212, 0.12)',
46
+ dark_dimmed: 'rgba(201, 206, 212, 0.12)'
47
+ },
48
+ focus: {
49
+ light: 'rgba(54, 77, 100, 0.16)',
50
+ dark: 'rgba(201, 206, 212, 0.24)',
51
+ dark_dimmed: 'rgba(201, 206, 212, 0.24)'
52
+ }
42
53
  },
43
54
  danger: {
44
- hover: (0, _constants.get)('colors.danger.subtle'),
45
- focus: (0, _constants.get)('colors.danger.muted')
55
+ hover: {
56
+ light: 'rgba(234, 74, 90, 0.08)',
57
+ dark: 'rgba(248, 81, 73, 0.16)',
58
+ dark_dimmed: 'rgba(248, 81, 73, 0.16)'
59
+ },
60
+ focus: {
61
+ light: 'rgba(234, 74, 90, 0.14)',
62
+ dark: 'rgba(248, 81, 73, 0.24)',
63
+ dark_dimmed: 'rgba(248, 81, 73, 0.24)'
64
+ }
46
65
  }
47
66
  };
48
67
  /**
@@ -211,8 +230,8 @@ const Item = /*#__PURE__*/_react.default.forwardRef((itemProps, ref) => {
211
230
  }
212
231
  }, [onAction, disabled, itemProps, onClick]);
213
232
  const customItemTheme = customItemThemes[variant];
214
- const hoverBackground = customItemTheme.hover;
215
- const focusBackground = customItemTheme.focus;
233
+ const hoverBackground = (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.hover, 'inherit');
234
+ const focusBackground = (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.focus, 'inherit');
216
235
  const {
217
236
  theme
218
237
  } = (0, _ThemeProvider.useTheme)();
@@ -8,17 +8,37 @@ import Truncate from '../Truncate';
8
8
  import styled from 'styled-components';
9
9
  import { StyledHeader } from './Header';
10
10
  import { StyledDivider } from './Divider';
11
- import { useTheme } from '../ThemeProvider';
11
+ import { useColorSchemeVar, useTheme } from '../ThemeProvider';
12
12
  import { activeDescendantActivatedDirectly, activeDescendantActivatedIndirectly, isActiveDescendantAttribute } from '../behaviors/focusZone';
13
13
  import { useSSRSafeId } from '@react-aria/ssr';
14
+
15
+ /**
16
+ * These colors are not yet in our default theme. Need to remove this once they are added.
17
+ */
14
18
  const customItemThemes = {
15
19
  default: {
16
- hover: get('colors.neutral.subtle'),
17
- focus: get('colors.neutral.muted')
20
+ hover: {
21
+ light: 'rgba(46, 77, 108, 0.06)',
22
+ dark: 'rgba(201, 206, 212, 0.12)',
23
+ dark_dimmed: 'rgba(201, 206, 212, 0.12)'
24
+ },
25
+ focus: {
26
+ light: 'rgba(54, 77, 100, 0.16)',
27
+ dark: 'rgba(201, 206, 212, 0.24)',
28
+ dark_dimmed: 'rgba(201, 206, 212, 0.24)'
29
+ }
18
30
  },
19
31
  danger: {
20
- hover: get('colors.danger.subtle'),
21
- focus: get('colors.danger.muted')
32
+ hover: {
33
+ light: 'rgba(234, 74, 90, 0.08)',
34
+ dark: 'rgba(248, 81, 73, 0.16)',
35
+ dark_dimmed: 'rgba(248, 81, 73, 0.16)'
36
+ },
37
+ focus: {
38
+ light: 'rgba(234, 74, 90, 0.14)',
39
+ dark: 'rgba(248, 81, 73, 0.24)',
40
+ dark_dimmed: 'rgba(248, 81, 73, 0.24)'
41
+ }
22
42
  }
23
43
  };
24
44
  /**
@@ -177,8 +197,8 @@ export const Item = /*#__PURE__*/React.forwardRef((itemProps, ref) => {
177
197
  }
178
198
  }, [onAction, disabled, itemProps, onClick]);
179
199
  const customItemTheme = customItemThemes[variant];
180
- const hoverBackground = customItemTheme.hover;
181
- const focusBackground = customItemTheme.focus;
200
+ const hoverBackground = useColorSchemeVar(customItemTheme.hover, 'inherit');
201
+ const focusBackground = useColorSchemeVar(customItemTheme.focus, 'inherit');
182
202
  const {
183
203
  theme
184
204
  } = useTheme();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-2021927203131",
3
+ "version": "0.0.0-2021927232856",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -132,6 +132,7 @@
132
132
  "rollup-plugin-visualizer": "5.5.0",
133
133
  "semver": "7.3.5",
134
134
  "size-limit": "5.0.2",
135
+ "storybook-addon-performance": "0.16.1",
135
136
  "styled-components": "4.4.1",
136
137
  "typescript": "4.2.2"
137
138
  },