@primer/components 33.0.0-rc.265a717f → 33.0.0-rc.42d465c3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/browser.esm.js +2 -2209
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +2 -2209
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Header.js +1 -1
  7. package/lib/ActionList/Item.js +10 -10
  8. package/lib/ActionList/List.js +1 -1
  9. package/lib/ActionList2/Item.js +1 -1
  10. package/lib/ActionList2/List.js +1 -1
  11. package/lib/BaseStyles.js +2 -20
  12. package/lib/BorderBox.js +1 -1
  13. package/lib/Box.js +1 -1
  14. package/lib/Breadcrumbs.js +3 -3
  15. package/lib/Button/Button.js +1 -1
  16. package/lib/Button/ButtonGroup.js +1 -1
  17. package/lib/Checkbox.js +1 -1
  18. package/lib/Details.js +1 -1
  19. package/lib/FilteredActionList/FilteredActionList.js +1 -1
  20. package/lib/Flex.js +1 -1
  21. package/lib/LabelGroup.js +1 -1
  22. package/lib/Overlay.js +1 -1
  23. package/lib/Pagination/Pagination.js +2 -2
  24. package/lib/Position.js +1 -1
  25. package/lib/SelectMenu/SelectMenu.js +1 -1
  26. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  27. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  28. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  29. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  30. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  31. package/lib/SelectMenu/SelectMenuTabs.js +1 -1
  32. package/lib/StateLabel.js +1 -1
  33. package/lib/StyledOcticon.js +1 -1
  34. package/lib/SubNav.js +3 -3
  35. package/lib/ThemeProvider.d.ts +1 -0
  36. package/lib/ThemeProvider.js +17 -4
  37. package/lib/Timeline.js +4 -4
  38. package/lib/Token/AvatarToken.js +1 -1
  39. package/lib/Token/TokenBase.js +1 -1
  40. package/lib/Tooltip.js +1 -1
  41. package/lib/UnderlineNav.js +2 -2
  42. package/lib/__tests__/ThemeProvider.test.js +114 -0
  43. package/lib/stories/ActionList.stories.js +3 -3
  44. package/lib/stories/ActionList2.stories.js +1 -1
  45. package/lib/stories/Checkbox.stories.js +2 -2
  46. package/lib/stories/ThemeProvider.stories.js +1 -5
  47. package/lib/stories/useFocusTrap.stories.js +1 -11
  48. package/lib/stories/useFocusZone.stories.js +2 -6
  49. package/lib-esm/ActionList/Header.js +1 -1
  50. package/lib-esm/ActionList/Item.js +10 -10
  51. package/lib-esm/ActionList/List.js +1 -1
  52. package/lib-esm/ActionList2/Item.js +1 -1
  53. package/lib-esm/ActionList2/List.js +1 -1
  54. package/lib-esm/BaseStyles.js +2 -20
  55. package/lib-esm/BorderBox.js +1 -1
  56. package/lib-esm/Box.js +1 -1
  57. package/lib-esm/Breadcrumbs.js +3 -3
  58. package/lib-esm/Button/Button.js +1 -1
  59. package/lib-esm/Button/ButtonGroup.js +1 -1
  60. package/lib-esm/Checkbox.js +1 -1
  61. package/lib-esm/Details.js +1 -1
  62. package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
  63. package/lib-esm/Flex.js +1 -1
  64. package/lib-esm/LabelGroup.js +1 -1
  65. package/lib-esm/Overlay.js +1 -1
  66. package/lib-esm/Pagination/Pagination.js +2 -2
  67. package/lib-esm/Position.js +1 -1
  68. package/lib-esm/SelectMenu/SelectMenu.js +1 -1
  69. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  70. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  71. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  72. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  73. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  74. package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
  75. package/lib-esm/StateLabel.js +1 -1
  76. package/lib-esm/StyledOcticon.js +1 -1
  77. package/lib-esm/SubNav.js +3 -3
  78. package/lib-esm/ThemeProvider.d.ts +1 -0
  79. package/lib-esm/ThemeProvider.js +17 -4
  80. package/lib-esm/Timeline.js +4 -4
  81. package/lib-esm/Token/AvatarToken.js +1 -1
  82. package/lib-esm/Token/TokenBase.js +1 -1
  83. package/lib-esm/Tooltip.js +1 -1
  84. package/lib-esm/UnderlineNav.js +2 -2
  85. package/lib-esm/__tests__/ThemeProvider.test.js +114 -0
  86. package/lib-esm/stories/ActionList.stories.js +3 -3
  87. package/lib-esm/stories/ActionList2.stories.js +1 -1
  88. package/lib-esm/stories/Checkbox.stories.js +2 -2
  89. package/lib-esm/stories/ThemeProvider.stories.js +1 -5
  90. package/lib-esm/stories/useFocusTrap.stories.js +1 -11
  91. package/lib-esm/stories/useFocusZone.stories.js +2 -6
  92. package/package-lock.json +41 -747
  93. package/package.json +2 -2
  94. package/src/ThemeProvider.tsx +22 -5
  95. package/src/__tests__/ThemeProvider.test.tsx +116 -0
  96. package/stats.html +1 -1
package/lib-esm/SubNav.js CHANGED
@@ -10,7 +10,7 @@ const ITEM_CLASS = 'SubNav-item';
10
10
  const SELECTED_CLASS = 'selected';
11
11
  const SubNavBase = styled.nav.withConfig({
12
12
  displayName: "SubNav__SubNavBase",
13
- componentId: "f7w0xa-0"
13
+ componentId: "sc-f7w0xa-0"
14
14
  })(["display:flex;justify-content:space-between;.SubNav-body{display:flex;margin-bottom:-1px;> *{margin-left:", ";}> *:first-child{margin-left:0;}}.SubNav-actions{align-self:center;}", ";"], get('space.2'), sx);
15
15
 
16
16
  function SubNav({
@@ -34,14 +34,14 @@ function SubNav({
34
34
  SubNav.displayName = "SubNav";
35
35
  const SubNavLinks = styled.div.withConfig({
36
36
  displayName: "SubNav__SubNavLinks",
37
- componentId: "f7w0xa-1"
37
+ componentId: "sc-f7w0xa-1"
38
38
  })(["display:flex;", ";"], sx);
39
39
  const SubNavLink = styled.a.attrs(props => ({
40
40
  activeClassName: typeof props.to === 'string' ? 'selected' : '',
41
41
  className: classnames(ITEM_CLASS, props.selected && SELECTED_CLASS, props.className)
42
42
  })).withConfig({
43
43
  displayName: "SubNav__SubNavLink",
44
- componentId: "f7w0xa-2"
44
+ componentId: "sc-f7w0xa-2"
45
45
  })(["padding-left:", ";padding-right:", ";font-weight:", ";font-size:", ";line-height:20px;min-height:34px;color:", ";text-align:center;text-decoration:none;border-top:1px solid ", ";border-bottom:1px solid ", ";border-right:1px solid ", ";display:flex;align-items:center;&:first-of-type{border-top-left-radius:", ";border-bottom-left-radius:", ";border-left:1px solid ", ";}&:last-of-type{border-top-right-radius:", ";border-bottom-right-radius:", ";}&:hover,&:focus{text-decoration:none;background-color:", ";transition:0.2s ease;.SubNav-octicon{color:", ";}}&.selected{color:", ";background-color:", ";border-color:", ";.SubNav-octicon{color:", ";}}", ";"], get('space.3'), get('space.3'), get('fontWeights.semibold'), get('fontSizes.1'), get('colors.fg.default'), get('colors.border.default'), get('colors.border.default'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.border.default'), get('radii.2'), get('radii.2'), get('colors.canvas.subtle'), get('colors.fg.muted'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.accent.emphasis'), get('colors.fg.onEmphasis'), sx);
46
46
  SubNavLink.displayName = 'SubNav.Link';
47
47
  SubNavLinks.displayName = 'SubNav.Links';
@@ -16,6 +16,7 @@ export declare function useTheme(): {
16
16
  colorScheme?: string | undefined;
17
17
  colorMode?: ColorModeWithAuto | undefined;
18
18
  resolvedColorMode?: ColorMode | undefined;
19
+ resolvedColorScheme?: string | undefined;
19
20
  dayScheme?: string | undefined;
20
21
  nightScheme?: string | undefined;
21
22
  setColorMode: React.Dispatch<React.SetStateAction<ColorModeWithAuto>>;
@@ -32,7 +32,10 @@ export const ThemeProvider = ({
32
32
  const systemColorMode = useSystemColorMode();
33
33
  const resolvedColorMode = resolveColorMode(colorMode, systemColorMode);
34
34
  const colorScheme = chooseColorScheme(resolvedColorMode, dayScheme, nightScheme);
35
- const resolvedTheme = React.useMemo(() => applyColorScheme(theme, colorScheme), [theme, colorScheme]); // Update state if props change
35
+ const {
36
+ resolvedTheme,
37
+ resolvedColorScheme
38
+ } = React.useMemo(() => applyColorScheme(theme, colorScheme), [theme, colorScheme]); // Update state if props change
36
39
 
37
40
  React.useEffect(() => {
38
41
  var _ref5, _props$colorMode2;
@@ -55,6 +58,7 @@ export const ThemeProvider = ({
55
58
  colorScheme,
56
59
  colorMode,
57
60
  resolvedColorMode,
61
+ resolvedColorScheme,
58
62
  dayScheme,
59
63
  nightScheme,
60
64
  setColorMode,
@@ -144,7 +148,10 @@ function chooseColorScheme(colorMode, dayScheme, nightScheme) {
144
148
 
145
149
  function applyColorScheme(theme, colorScheme) {
146
150
  if (!theme.colorSchemes) {
147
- return theme;
151
+ return {
152
+ resolvedTheme: theme,
153
+ resolvedColorScheme: undefined
154
+ };
148
155
  }
149
156
 
150
157
  if (!theme.colorSchemes[colorScheme]) {
@@ -152,10 +159,16 @@ function applyColorScheme(theme, colorScheme) {
152
159
  console.error(`\`${colorScheme}\` scheme not defined in \`theme.colorSchemes\``); // Apply the first defined color scheme
153
160
 
154
161
  const defaultColorScheme = Object.keys(theme.colorSchemes)[0];
155
- return deepmerge(theme, theme.colorSchemes[defaultColorScheme]);
162
+ return {
163
+ resolvedTheme: deepmerge(theme, theme.colorSchemes[defaultColorScheme]),
164
+ resolvedColorScheme: defaultColorScheme
165
+ };
156
166
  }
157
167
 
158
- return deepmerge(theme, theme.colorSchemes[colorScheme]);
168
+ return {
169
+ resolvedTheme: deepmerge(theme, theme.colorSchemes[colorScheme]),
170
+ resolvedColorScheme: colorScheme
171
+ };
159
172
  }
160
173
 
161
174
  export default ThemeProvider;
@@ -6,13 +6,13 @@ import { get } from './constants';
6
6
  import sx from './sx';
7
7
  const Timeline = styled.div.withConfig({
8
8
  displayName: "Timeline",
9
- componentId: "c4dq2e-0"
9
+ componentId: "sc-c4dq2e-0"
10
10
  })(["display:flex;flex-direction:column;", " ", ";"], props => props.clipSidebar && css([".Timeline-Item:first-child{padding-top:0;}.Timeline-Item:last-child{padding-bottom:0;}"]), sx);
11
11
  const TimelineItem = styled.div.attrs(props => ({
12
12
  className: classnames('Timeline-Item', props.className)
13
13
  })).withConfig({
14
14
  displayName: "Timeline__TimelineItem",
15
- componentId: "c4dq2e-1"
15
+ componentId: "sc-c4dq2e-1"
16
16
  })(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";"], get('space.3'), get('space.3'), get('colors.border.muted'), props => props.condensed && css(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], get('space.1'), get('space.3'), get('space.2'), get('space.2'), get('colors.fg.muted'), get('colors.canvas.default')), sx);
17
17
 
18
18
  const TimelineBadge = props => {
@@ -43,11 +43,11 @@ const TimelineBadge = props => {
43
43
  TimelineBadge.displayName = "TimelineBadge";
44
44
  const TimelineBody = styled.div.withConfig({
45
45
  displayName: "Timeline__TimelineBody",
46
- componentId: "c4dq2e-2"
46
+ componentId: "sc-c4dq2e-2"
47
47
  })(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], get('space.1'), get('colors.fg.muted'), get('fontSizes.1'), sx);
48
48
  const TimelineBreak = styled.div.withConfig({
49
49
  displayName: "Timeline__TimelineBreak",
50
- componentId: "c4dq2e-3"
50
+ componentId: "sc-c4dq2e-3"
51
51
  })(["position:relative z-index:1;height:24px;margin:0;margin-bottom:-", ";margin-left:0;background-color:", ";border:0;border-top:", " solid ", ";", ";"], get('space.3'), get('colors.canvas.default'), get('space.1'), get('colors.border.default'), sx);
52
52
  TimelineItem.displayName = 'Timeline.Item';
53
53
  TimelineBadge.displayName = 'Timeline.Badge';
@@ -8,7 +8,7 @@ import Token from './Token';
8
8
  import { Avatar } from '..';
9
9
  const AvatarContainer = styled.span.withConfig({
10
10
  displayName: "AvatarToken__AvatarContainer",
11
- componentId: "ubyudc-0"
11
+ componentId: "sc-ubyudc-0"
12
12
  })(["--spacing:calc(", " * 2);display:block;height:", ";width:", ";"], get('space.1'), props => `calc(${tokenSizes[props.avatarSize]} - var(--spacing))`, props => `calc(${tokenSizes[props.avatarSize]} - var(--spacing))`);
13
13
  const AvatarToken = /*#__PURE__*/forwardRef(({
14
14
  avatarSrc,
@@ -74,7 +74,7 @@ const TokenBase = styled.span.attrs(({
74
74
  'aria-label': onRemove ? `${text}, press backspace or delete to remove` : undefined
75
75
  })).withConfig({
76
76
  displayName: "TokenBase",
77
- componentId: "opajvp-0"
77
+ componentId: "sc-opajvp-0"
78
78
  })(["align-items:center;border-radius:999px;cursor:", ";display:inline-flex;font-weight:", ";font-family:inherit;text-decoration:none;white-space:nowrap;", " ", ""], props => isTokenInteractive(props) ? 'pointer' : 'auto', get('fontWeights.bold'), variants, sx);
79
79
  TokenBase.defaultProps = {
80
80
  as: 'span',
@@ -7,7 +7,7 @@ import { get } from './constants';
7
7
  import sx from './sx';
8
8
  const TooltipBase = styled.span.withConfig({
9
9
  displayName: "Tooltip__TooltipBase",
10
- componentId: "kp39nc-0"
10
+ componentId: "sc-kp39nc-0"
11
11
  })(["position:relative;&::before{position:absolute;z-index:1000001;display:none;width:0px;height:0px;color:", ";pointer-events:none;content:'';border:6px solid transparent;opacity:0;}&::after{position:absolute;z-index:1000000;display:none;padding:0.5em 0.75em;font:normal normal 11px/1.5 ", ";-webkit-font-smoothing:subpixel-antialiased;color:", ";text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:", ";border-radius:", ";opacity:0;}@keyframes tooltip-appear{from{opacity:0;}to{opacity:1;}}&:hover,&:active,&:focus{&::before,&::after{display:inline-block;text-decoration:none;animation-name:tooltip-appear;animation-duration:0.1s;animation-fill-mode:forwards;animation-timing-function:ease-in;animation-delay:0.4s;}}&.tooltipped-no-delay:hover,&.tooltipped-no-delay:active,&.tooltipped-no-delay:focus{&::before,&::after{animation-delay:0s;}}&.tooltipped-multiline:hover,&.tooltipped-multiline:active,&.tooltipped-multiline:focus{&::after{display:table-cell;}}&.tooltipped-s,&.tooltipped-se,&.tooltipped-sw{&::after{top:100%;right:50%;margin-top:6px;}&::before{top:auto;right:50%;bottom:-7px;margin-right:-6px;border-bottom-color:", ";}}&.tooltipped-se{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-sw::after{margin-right:-", ";}&.tooltipped-n,&.tooltipped-ne,&.tooltipped-nw{&::after{right:50%;bottom:100%;margin-bottom:6px;}&::before{top:-7px;right:50%;bottom:auto;margin-right:-6px;border-top-color:", ";}}&.tooltipped-ne{&::after{right:auto;left:50%;margin-left:-", ";}}&.tooltipped-nw::after{margin-right:-", ";}&.tooltipped-s::after,&.tooltipped-n::after{transform:translateX(50%);}&.tooltipped-w{&::after{right:100%;bottom:50%;margin-right:6px;transform:translateY(50%);}&::before{top:50%;bottom:50%;left:-7px;margin-top:-6px;border-left-color:", ";}}&.tooltipped-e{&::after{bottom:50%;left:100%;margin-left:6px;transform:translateY(50%);}&::before{top:50%;right:-7px;bottom:50%;margin-top:-6px;border-right-color:", ";}}&.tooltipped-multiline{&::after{width:max-content;max-width:250px;word-wrap:break-word;white-space:pre-line;border-collapse:separate;}&.tooltipped-s::after,&.tooltipped-n::after{right:auto;left:50%;transform:translateX(-50%);}&.tooltipped-w::after,&.tooltipped-e::after{right:100%;}}&.tooltipped-align-right-2::after{right:0;margin-right:0;}&.tooltipped-align-right-2::before{right:15px;}&.tooltipped-align-left-2::after{left:0;margin-left:0;}&.tooltipped-align-left-2::before{left:10px;}", ";"], get('colors.neutral.emphasisPlus'), get('fonts.normal'), get('colors.fg.onEmphasis'), get('colors.neutral.emphasisPlus'), get('radii.1'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('space.3'), get('space.3'), get('colors.neutral.emphasisPlus'), get('colors.neutral.emphasisPlus'), sx);
12
12
 
13
13
  function Tooltip({
@@ -10,7 +10,7 @@ const ITEM_CLASS = 'UnderlineNav-item';
10
10
  const SELECTED_CLASS = 'selected';
11
11
  const UnderlineNavBase = styled.nav.withConfig({
12
12
  displayName: "UnderlineNav__UnderlineNavBase",
13
- componentId: "zrnxqt-0"
13
+ componentId: "sc-zrnxqt-0"
14
14
  })(["display:flex;justify-content:space-between;border-bottom:1px solid ", ";&.UnderlineNav--right{justify-content:flex-end;.UnderlineNav-item{margin-right:0;margin-left:", ";}.UnderlineNav-actions{flex:1 1 auto;}}&.UnderlineNav--full{display:block;}.UnderlineNav-body{display:flex;margin-bottom:-1px;}.UnderlineNav-actions{align-self:center;}", ";"], get('colors.border.muted'), get('space.3'), sx);
15
15
 
16
16
  function UnderlineNav({
@@ -41,7 +41,7 @@ const UnderlineNavLink = styled.a.attrs(props => ({
41
41
  className: classnames(ITEM_CLASS, props.selected && SELECTED_CLASS, props.className)
42
42
  })).withConfig({
43
43
  displayName: "UnderlineNav__UnderlineNavLink",
44
- componentId: "zrnxqt-1"
44
+ componentId: "sc-zrnxqt-1"
45
45
  })(["padding:", " ", ";margin-right:", ";font-size:", ";line-height:", ";color:", ";text-align:center;border-bottom:2px solid transparent;text-decoration:none;&:hover,&:focus{color:", ";text-decoration:none;border-bottom-color:", ";transition:0.2s ease;.UnderlineNav-octicon{color:", ";}}&.selected{color:", ";border-bottom-color:", ";.UnderlineNav-octicon{color:", ";}}", ";"], get('space.3'), get('space.2'), get('space.3'), get('fontSizes.1'), get('lineHeights.default'), get('colors.fg.default'), get('colors.fg.default'), get('colors.neutral.muted'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.primer.border.active'), get('colors.fg.default'), sx);
46
46
  UnderlineNavLink.displayName = 'UnderlineNav.Link';
47
47
  export default Object.assign(UnderlineNav, {
@@ -405,4 +405,118 @@ describe('useColorSchemeVar', () => {
405
405
  screen.getByRole('button').click();
406
406
  expect(screen.getByText('Hello')).toHaveStyleRule('background-color', 'blue');
407
407
  });
408
+ });
409
+ describe('useTheme().resolvedColorScheme', () => {
410
+ it('is undefined when not in a theme', () => {
411
+ const Component = () => {
412
+ const {
413
+ resolvedColorScheme
414
+ } = useTheme();
415
+ return /*#__PURE__*/React.createElement(Text, {
416
+ "data-testid": "text"
417
+ }, resolvedColorScheme);
418
+ };
419
+
420
+ render( /*#__PURE__*/React.createElement(Component, null));
421
+ expect(screen.getByTestId('text').textContent).toEqual('');
422
+ });
423
+ it('is undefined when the theme has no colorScheme object', () => {
424
+ const Component = () => {
425
+ const {
426
+ resolvedColorScheme
427
+ } = useTheme();
428
+ return /*#__PURE__*/React.createElement(Text, {
429
+ "data-testid": "text"
430
+ }, resolvedColorScheme);
431
+ };
432
+
433
+ render( /*#__PURE__*/React.createElement(ThemeProvider, {
434
+ theme: {
435
+ color: 'red'
436
+ }
437
+ }, /*#__PURE__*/React.createElement(Component, null)));
438
+ expect(screen.getByTestId('text').textContent).toEqual('');
439
+ });
440
+ it('is the same as the applied colorScheme, when that colorScheme is in the theme', () => {
441
+ const Component = () => {
442
+ const {
443
+ resolvedColorScheme
444
+ } = useTheme();
445
+ return /*#__PURE__*/React.createElement(Text, {
446
+ "data-testid": "text"
447
+ }, resolvedColorScheme);
448
+ };
449
+
450
+ const schemeToApply = 'dark';
451
+ render( /*#__PURE__*/React.createElement(ThemeProvider, {
452
+ theme: exampleTheme,
453
+ colorMode: "day",
454
+ dayScheme: schemeToApply
455
+ }, /*#__PURE__*/React.createElement(Component, null)));
456
+ expect(exampleTheme.colorSchemes).toHaveProperty(schemeToApply);
457
+ expect(screen.getByTestId('text').textContent).toEqual(schemeToApply);
458
+ });
459
+ it('is the value of the fallback colorScheme applied when attempting to apply an invalid colorScheme', () => {
460
+ const Component = () => {
461
+ const {
462
+ resolvedColorScheme
463
+ } = useTheme();
464
+ return /*#__PURE__*/React.createElement(Text, {
465
+ "data-testid": "text"
466
+ }, resolvedColorScheme);
467
+ };
468
+
469
+ const schemeToApply = 'totally-invalid-colorscheme';
470
+ render( /*#__PURE__*/React.createElement(ThemeProvider, {
471
+ theme: exampleTheme,
472
+ colorMode: "day",
473
+ dayScheme: schemeToApply
474
+ }, /*#__PURE__*/React.createElement(Component, null)));
475
+ const defaultThemeColorScheme = Object.keys(exampleTheme.colorSchemes)[0];
476
+ expect(defaultThemeColorScheme).not.toEqual(schemeToApply);
477
+ expect(exampleTheme.colorSchemes).not.toHaveProperty(schemeToApply);
478
+ expect(screen.getByTestId('text').textContent).toEqual('light');
479
+ });
480
+ describe('nested theme', () => {
481
+ it('is the same as the applied colorScheme, when that colorScheme is in the theme', () => {
482
+ const Component = () => {
483
+ const {
484
+ resolvedColorScheme
485
+ } = useTheme();
486
+ return /*#__PURE__*/React.createElement(Text, {
487
+ "data-testid": "text"
488
+ }, resolvedColorScheme);
489
+ };
490
+
491
+ const schemeToApply = 'dark';
492
+ render( /*#__PURE__*/React.createElement(ThemeProvider, {
493
+ theme: exampleTheme,
494
+ colorMode: "day",
495
+ dayScheme: schemeToApply
496
+ }, /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Component, null))));
497
+ expect(exampleTheme.colorSchemes).toHaveProperty(schemeToApply);
498
+ expect(screen.getByTestId('text').textContent).toEqual(schemeToApply);
499
+ });
500
+ it('is the value of the fallback colorScheme applied when attempting to apply an invalid colorScheme', () => {
501
+ const Component = () => {
502
+ const {
503
+ resolvedColorScheme
504
+ } = useTheme();
505
+ return /*#__PURE__*/React.createElement(Text, {
506
+ "data-testid": "text"
507
+ }, resolvedColorScheme);
508
+ };
509
+
510
+ const schemeToApply = 'totally-invalid-colorscheme';
511
+ render( /*#__PURE__*/React.createElement(ThemeProvider, {
512
+ theme: exampleTheme,
513
+ colorMode: "day",
514
+ dayScheme: schemeToApply
515
+ }, /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Component, null))));
516
+ const defaultThemeColorScheme = Object.keys(exampleTheme.colorSchemes)[0];
517
+ expect(defaultThemeColorScheme).not.toEqual(schemeToApply);
518
+ expect(exampleTheme.colorSchemes).not.toHaveProperty(schemeToApply);
519
+ expect(screen.getByTestId('text').textContent).toEqual('light');
520
+ });
521
+ });
408
522
  });
@@ -24,7 +24,7 @@ const meta = {
24
24
  export default meta;
25
25
  const ErsatzOverlay = styled.div.withConfig({
26
26
  displayName: "ActionListstories__ErsatzOverlay",
27
- componentId: "akdcn0-0"
27
+ componentId: "sc-akdcn0-0"
28
28
  })(["border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,0.12),0 8px 24px rgba(149,157,165,0.2);overflow:hidden;max-width:", ";"], ({
29
29
  maxWidth
30
30
  }) => maxWidth || 'none');
@@ -90,7 +90,7 @@ MultiSelectListStory.storyName = 'Multi Select';
90
90
  export function ComplexListInsetVariantStory() {
91
91
  const StyledDiv = styled.div.withConfig({
92
92
  displayName: "ActionListstories__StyledDiv",
93
- componentId: "akdcn0-1"
93
+ componentId: "sc-akdcn0-1"
94
94
  })(["", ""], sx);
95
95
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "Complex List"), /*#__PURE__*/React.createElement("h2", null, "Inset Variant"), /*#__PURE__*/React.createElement(ErsatzOverlay, null, /*#__PURE__*/React.createElement(ActionList, {
96
96
  groupMetadata: [{
@@ -189,7 +189,7 @@ ComplexListInsetVariantStory.storyName = 'Complex List — Inset Variant';
189
189
  export function ComplexListFullVariantStory() {
190
190
  const StyledDiv = styled.div.withConfig({
191
191
  displayName: "ActionListstories__StyledDiv",
192
- componentId: "akdcn0-2"
192
+ componentId: "sc-akdcn0-2"
193
193
  })(["", ""], sx);
194
194
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h1", null, "Complex List"), /*#__PURE__*/React.createElement("h2", null, "Full Variant"), /*#__PURE__*/React.createElement(ErsatzOverlay, null, /*#__PURE__*/React.createElement(ActionList, {
195
195
  variant: "full",
@@ -31,7 +31,7 @@ const meta = {
31
31
  export default meta;
32
32
  const ErsatzOverlay = styled.div.withConfig({
33
33
  displayName: "ActionList2stories__ErsatzOverlay",
34
- componentId: "f9cezu-0"
34
+ componentId: "sc-f9cezu-0"
35
35
  })(["border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,0.12),0 8px 24px rgba(149,157,165,0.2);overflow:hidden;max-width:", ";"], ({
36
36
  maxWidth
37
37
  }) => maxWidth || 'none');
@@ -30,11 +30,11 @@ export default {
30
30
  };
31
31
  const StyledLabel = styled.label.withConfig({
32
32
  displayName: "Checkboxstories__StyledLabel",
33
- componentId: "sdupvr-0"
33
+ componentId: "sc-sdupvr-0"
34
34
  })(["user-select:none;font-weight:600;font-size:14px;line-height:18px;margin-left:16px;", ""], COMMON);
35
35
  const StyledSubLabel = styled(Text).withConfig({
36
36
  displayName: "Checkboxstories__StyledSubLabel",
37
- componentId: "sdupvr-1"
37
+ componentId: "sc-sdupvr-1"
38
38
  })(["color:", ";font-size:13px;", ""], get('colors.fg.muted'), COMMON);
39
39
  export const Default = args => {
40
40
  const [isChecked, setChecked] = useState(false);
@@ -12,11 +12,7 @@ export default {
12
12
  }
13
13
  }
14
14
  };
15
- const GlobalStyle = createGlobalStyle`
16
- body {
17
- background-color: ${themeGet('colors.bg.canvas')};
18
- }
19
- `;
15
+ const GlobalStyle = createGlobalStyle(["body{background-color:", ";}"], themeGet('colors.bg.canvas'));
20
16
 
21
17
  function ActiveColorScheme() {
22
18
  const {
@@ -11,17 +11,7 @@ export default {
11
11
  }; // NOTE: the below styles are solely intended as a visual aid for
12
12
  // this Storybook story, but they're not recommended for a real site!
13
13
 
14
- const HelperGlobalStyling = createGlobalStyle`
15
- *:focus {
16
- outline: 2px solid ${themeGet('colors.auto.blue.3')} !important;
17
- }
18
- [data-focus-trap='active'] {
19
- background-color: ${themeGet('colors.auto.green.2')}
20
- }
21
- [data-focus-trap='suspended'] {
22
- background-color: ${themeGet('colors.auto.yellow.2')}
23
- }
24
- `;
14
+ const HelperGlobalStyling = createGlobalStyle(["*:focus{outline:2px solid ", " !important;}[data-focus-trap='active']{background-color:", "}[data-focus-trap='suspended']{background-color:", "}"], themeGet('colors.auto.blue.3'), themeGet('colors.auto.green.2'), themeGet('colors.auto.yellow.2'));
25
15
  const MarginButton = styled(Button).withConfig({
26
16
  displayName: "useFocusTrapstories__MarginButton",
27
17
  componentId: "sc-12zkn1e-0"
@@ -16,14 +16,10 @@ export default {
16
16
  }; // NOTE: the below styles are solely intended as a visual aid for
17
17
  // this Storybook story, but they're not recommended for a real site!
18
18
 
19
- const HelperGlobalStyling = createGlobalStyle`
20
- *:focus {
21
- outline: 2px solid ${themeGet('colors.border.info')} !important;
22
- }
23
- `;
19
+ const HelperGlobalStyling = createGlobalStyle(["*:focus{outline:2px solid ", " !important;}"], themeGet('colors.border.info'));
24
20
  const MarginButton = styled(Button).withConfig({
25
21
  displayName: "useFocusZonestories__MarginButton",
26
- componentId: "e94kdz-0"
22
+ componentId: "sc-e94kdz-0"
27
23
  })(["margin:", ";"], themeGet('space.1'));
28
24
  export const BasicFocusZone = () => {
29
25
  // Display each key press in the top-right corner of the page as a visual aid