@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.
- package/CHANGELOG.md +2 -0
- package/dist/browser.esm.js +2 -2209
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +2 -2209
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Header.js +1 -1
- package/lib/ActionList/Item.js +10 -10
- package/lib/ActionList/List.js +1 -1
- package/lib/ActionList2/Item.js +1 -1
- package/lib/ActionList2/List.js +1 -1
- package/lib/BaseStyles.js +2 -20
- package/lib/BorderBox.js +1 -1
- package/lib/Box.js +1 -1
- package/lib/Breadcrumbs.js +3 -3
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Checkbox.js +1 -1
- package/lib/Details.js +1 -1
- package/lib/FilteredActionList/FilteredActionList.js +1 -1
- package/lib/Flex.js +1 -1
- package/lib/LabelGroup.js +1 -1
- package/lib/Overlay.js +1 -1
- package/lib/Pagination/Pagination.js +2 -2
- package/lib/Position.js +1 -1
- package/lib/SelectMenu/SelectMenu.js +1 -1
- package/lib/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib/SelectMenu/SelectMenuItem.js +1 -1
- package/lib/SelectMenu/SelectMenuTab.js +1 -1
- package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib/StateLabel.js +1 -1
- package/lib/StyledOcticon.js +1 -1
- package/lib/SubNav.js +3 -3
- package/lib/ThemeProvider.d.ts +1 -0
- package/lib/ThemeProvider.js +17 -4
- package/lib/Timeline.js +4 -4
- package/lib/Token/AvatarToken.js +1 -1
- package/lib/Token/TokenBase.js +1 -1
- package/lib/Tooltip.js +1 -1
- package/lib/UnderlineNav.js +2 -2
- package/lib/__tests__/ThemeProvider.test.js +114 -0
- package/lib/stories/ActionList.stories.js +3 -3
- package/lib/stories/ActionList2.stories.js +1 -1
- package/lib/stories/Checkbox.stories.js +2 -2
- package/lib/stories/ThemeProvider.stories.js +1 -5
- package/lib/stories/useFocusTrap.stories.js +1 -11
- package/lib/stories/useFocusZone.stories.js +2 -6
- package/lib-esm/ActionList/Header.js +1 -1
- package/lib-esm/ActionList/Item.js +10 -10
- package/lib-esm/ActionList/List.js +1 -1
- package/lib-esm/ActionList2/Item.js +1 -1
- package/lib-esm/ActionList2/List.js +1 -1
- package/lib-esm/BaseStyles.js +2 -20
- package/lib-esm/BorderBox.js +1 -1
- package/lib-esm/Box.js +1 -1
- package/lib-esm/Breadcrumbs.js +3 -3
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonGroup.js +1 -1
- package/lib-esm/Checkbox.js +1 -1
- package/lib-esm/Details.js +1 -1
- package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
- package/lib-esm/Flex.js +1 -1
- package/lib-esm/LabelGroup.js +1 -1
- package/lib-esm/Overlay.js +1 -1
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/lib-esm/Position.js +1 -1
- package/lib-esm/SelectMenu/SelectMenu.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
- package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
- package/lib-esm/StateLabel.js +1 -1
- package/lib-esm/StyledOcticon.js +1 -1
- package/lib-esm/SubNav.js +3 -3
- package/lib-esm/ThemeProvider.d.ts +1 -0
- package/lib-esm/ThemeProvider.js +17 -4
- package/lib-esm/Timeline.js +4 -4
- package/lib-esm/Token/AvatarToken.js +1 -1
- package/lib-esm/Token/TokenBase.js +1 -1
- package/lib-esm/Tooltip.js +1 -1
- package/lib-esm/UnderlineNav.js +2 -2
- package/lib-esm/__tests__/ThemeProvider.test.js +114 -0
- package/lib-esm/stories/ActionList.stories.js +3 -3
- package/lib-esm/stories/ActionList2.stories.js +1 -1
- package/lib-esm/stories/Checkbox.stories.js +2 -2
- package/lib-esm/stories/ThemeProvider.stories.js +1 -5
- package/lib-esm/stories/useFocusTrap.stories.js +1 -11
- package/lib-esm/stories/useFocusZone.stories.js +2 -6
- package/package-lock.json +41 -747
- package/package.json +2 -2
- package/src/ThemeProvider.tsx +22 -5
- package/src/__tests__/ThemeProvider.test.tsx +116 -0
- package/stats.html +1 -1
@@ -441,4 +441,118 @@ describe('useColorSchemeVar', () => {
|
|
441
441
|
|
442
442
|
expect(_react.screen.getByText('Hello')).toHaveStyleRule('background-color', 'blue');
|
443
443
|
});
|
444
|
+
});
|
445
|
+
describe('useTheme().resolvedColorScheme', () => {
|
446
|
+
it('is undefined when not in a theme', () => {
|
447
|
+
const Component = () => {
|
448
|
+
const {
|
449
|
+
resolvedColorScheme
|
450
|
+
} = (0, _.useTheme)();
|
451
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
452
|
+
"data-testid": "text"
|
453
|
+
}, resolvedColorScheme);
|
454
|
+
};
|
455
|
+
|
456
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(Component, null));
|
457
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual('');
|
458
|
+
});
|
459
|
+
it('is undefined when the theme has no colorScheme object', () => {
|
460
|
+
const Component = () => {
|
461
|
+
const {
|
462
|
+
resolvedColorScheme
|
463
|
+
} = (0, _.useTheme)();
|
464
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
465
|
+
"data-testid": "text"
|
466
|
+
}, resolvedColorScheme);
|
467
|
+
};
|
468
|
+
|
469
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, {
|
470
|
+
theme: {
|
471
|
+
color: 'red'
|
472
|
+
}
|
473
|
+
}, /*#__PURE__*/_react2.default.createElement(Component, null)));
|
474
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual('');
|
475
|
+
});
|
476
|
+
it('is the same as the applied colorScheme, when that colorScheme is in the theme', () => {
|
477
|
+
const Component = () => {
|
478
|
+
const {
|
479
|
+
resolvedColorScheme
|
480
|
+
} = (0, _.useTheme)();
|
481
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
482
|
+
"data-testid": "text"
|
483
|
+
}, resolvedColorScheme);
|
484
|
+
};
|
485
|
+
|
486
|
+
const schemeToApply = 'dark';
|
487
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, {
|
488
|
+
theme: exampleTheme,
|
489
|
+
colorMode: "day",
|
490
|
+
dayScheme: schemeToApply
|
491
|
+
}, /*#__PURE__*/_react2.default.createElement(Component, null)));
|
492
|
+
expect(exampleTheme.colorSchemes).toHaveProperty(schemeToApply);
|
493
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual(schemeToApply);
|
494
|
+
});
|
495
|
+
it('is the value of the fallback colorScheme applied when attempting to apply an invalid colorScheme', () => {
|
496
|
+
const Component = () => {
|
497
|
+
const {
|
498
|
+
resolvedColorScheme
|
499
|
+
} = (0, _.useTheme)();
|
500
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
501
|
+
"data-testid": "text"
|
502
|
+
}, resolvedColorScheme);
|
503
|
+
};
|
504
|
+
|
505
|
+
const schemeToApply = 'totally-invalid-colorscheme';
|
506
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, {
|
507
|
+
theme: exampleTheme,
|
508
|
+
colorMode: "day",
|
509
|
+
dayScheme: schemeToApply
|
510
|
+
}, /*#__PURE__*/_react2.default.createElement(Component, null)));
|
511
|
+
const defaultThemeColorScheme = Object.keys(exampleTheme.colorSchemes)[0];
|
512
|
+
expect(defaultThemeColorScheme).not.toEqual(schemeToApply);
|
513
|
+
expect(exampleTheme.colorSchemes).not.toHaveProperty(schemeToApply);
|
514
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual('light');
|
515
|
+
});
|
516
|
+
describe('nested theme', () => {
|
517
|
+
it('is the same as the applied colorScheme, when that colorScheme is in the theme', () => {
|
518
|
+
const Component = () => {
|
519
|
+
const {
|
520
|
+
resolvedColorScheme
|
521
|
+
} = (0, _.useTheme)();
|
522
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
523
|
+
"data-testid": "text"
|
524
|
+
}, resolvedColorScheme);
|
525
|
+
};
|
526
|
+
|
527
|
+
const schemeToApply = 'dark';
|
528
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, {
|
529
|
+
theme: exampleTheme,
|
530
|
+
colorMode: "day",
|
531
|
+
dayScheme: schemeToApply
|
532
|
+
}, /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, null, /*#__PURE__*/_react2.default.createElement(Component, null))));
|
533
|
+
expect(exampleTheme.colorSchemes).toHaveProperty(schemeToApply);
|
534
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual(schemeToApply);
|
535
|
+
});
|
536
|
+
it('is the value of the fallback colorScheme applied when attempting to apply an invalid colorScheme', () => {
|
537
|
+
const Component = () => {
|
538
|
+
const {
|
539
|
+
resolvedColorScheme
|
540
|
+
} = (0, _.useTheme)();
|
541
|
+
return /*#__PURE__*/_react2.default.createElement(_.Text, {
|
542
|
+
"data-testid": "text"
|
543
|
+
}, resolvedColorScheme);
|
544
|
+
};
|
545
|
+
|
546
|
+
const schemeToApply = 'totally-invalid-colorscheme';
|
547
|
+
(0, _react.render)( /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, {
|
548
|
+
theme: exampleTheme,
|
549
|
+
colorMode: "day",
|
550
|
+
dayScheme: schemeToApply
|
551
|
+
}, /*#__PURE__*/_react2.default.createElement(_.ThemeProvider, null, /*#__PURE__*/_react2.default.createElement(Component, null))));
|
552
|
+
const defaultThemeColorScheme = Object.keys(exampleTheme.colorSchemes)[0];
|
553
|
+
expect(defaultThemeColorScheme).not.toEqual(schemeToApply);
|
554
|
+
expect(exampleTheme.colorSchemes).not.toHaveProperty(schemeToApply);
|
555
|
+
expect(_react.screen.getByTestId('text').textContent).toEqual('light');
|
556
|
+
});
|
557
|
+
});
|
444
558
|
});
|
@@ -58,7 +58,7 @@ exports.default = _default;
|
|
58
58
|
|
59
59
|
const ErsatzOverlay = _styledComponents.default.div.withConfig({
|
60
60
|
displayName: "ActionListstories__ErsatzOverlay",
|
61
|
-
componentId: "akdcn0-0"
|
61
|
+
componentId: "sc-akdcn0-0"
|
62
62
|
})(["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:", ";"], ({
|
63
63
|
maxWidth
|
64
64
|
}) => maxWidth || 'none');
|
@@ -133,7 +133,7 @@ MultiSelectListStory.storyName = 'Multi Select';
|
|
133
133
|
function ComplexListInsetVariantStory() {
|
134
134
|
const StyledDiv = _styledComponents.default.div.withConfig({
|
135
135
|
displayName: "ActionListstories__StyledDiv",
|
136
|
-
componentId: "akdcn0-1"
|
136
|
+
componentId: "sc-akdcn0-1"
|
137
137
|
})(["", ""], _sx.default);
|
138
138
|
|
139
139
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h1", null, "Complex List"), /*#__PURE__*/_react.default.createElement("h2", null, "Inset Variant"), /*#__PURE__*/_react.default.createElement(ErsatzOverlay, null, /*#__PURE__*/_react.default.createElement(ActionList, {
|
@@ -235,7 +235,7 @@ ComplexListInsetVariantStory.storyName = 'Complex List — Inset Variant';
|
|
235
235
|
function ComplexListFullVariantStory() {
|
236
236
|
const StyledDiv = _styledComponents.default.div.withConfig({
|
237
237
|
displayName: "ActionListstories__StyledDiv",
|
238
|
-
componentId: "akdcn0-2"
|
238
|
+
componentId: "sc-akdcn0-2"
|
239
239
|
})(["", ""], _sx.default);
|
240
240
|
|
241
241
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h1", null, "Complex List"), /*#__PURE__*/_react.default.createElement("h2", null, "Full Variant"), /*#__PURE__*/_react.default.createElement(ErsatzOverlay, null, /*#__PURE__*/_react.default.createElement(ActionList, {
|
@@ -86,7 +86,7 @@ exports.default = _default;
|
|
86
86
|
|
87
87
|
const ErsatzOverlay = _styledComponents.default.div.withConfig({
|
88
88
|
displayName: "ActionList2stories__ErsatzOverlay",
|
89
|
-
componentId: "f9cezu-0"
|
89
|
+
componentId: "sc-f9cezu-0"
|
90
90
|
})(["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:", ";"], ({
|
91
91
|
maxWidth
|
92
92
|
}) => maxWidth || 'none');
|
@@ -50,12 +50,12 @@ exports.default = _default;
|
|
50
50
|
|
51
51
|
const StyledLabel = _styledComponents.default.label.withConfig({
|
52
52
|
displayName: "Checkboxstories__StyledLabel",
|
53
|
-
componentId: "sdupvr-0"
|
53
|
+
componentId: "sc-sdupvr-0"
|
54
54
|
})(["user-select:none;font-weight:600;font-size:14px;line-height:18px;margin-left:16px;", ""], _constants.COMMON);
|
55
55
|
|
56
56
|
const StyledSubLabel = (0, _styledComponents.default)(_2.Text).withConfig({
|
57
57
|
displayName: "Checkboxstories__StyledSubLabel",
|
58
|
-
componentId: "sdupvr-1"
|
58
|
+
componentId: "sc-sdupvr-1"
|
59
59
|
})(["color:", ";font-size:13px;", ""], (0, _constants.get)('colors.fg.muted'), _constants.COMMON);
|
60
60
|
|
61
61
|
const Default = args => {
|
@@ -25,11 +25,7 @@ var _default = {
|
|
25
25
|
}
|
26
26
|
};
|
27
27
|
exports.default = _default;
|
28
|
-
const GlobalStyle = (0, _styledComponents.createGlobalStyle)
|
29
|
-
body {
|
30
|
-
background-color: ${(0, _.themeGet)('colors.bg.canvas')};
|
31
|
-
}
|
32
|
-
`;
|
28
|
+
const GlobalStyle = (0, _styledComponents.createGlobalStyle)(["body{background-color:", ";}"], (0, _.themeGet)('colors.bg.canvas'));
|
33
29
|
|
34
30
|
function ActiveColorScheme() {
|
35
31
|
const {
|
@@ -28,17 +28,7 @@ var _default = {
|
|
28
28
|
// this Storybook story, but they're not recommended for a real site!
|
29
29
|
|
30
30
|
exports.default = _default;
|
31
|
-
const HelperGlobalStyling = (0, _styledComponents.createGlobalStyle)
|
32
|
-
*:focus {
|
33
|
-
outline: 2px solid ${(0, _themeGet.themeGet)('colors.auto.blue.3')} !important;
|
34
|
-
}
|
35
|
-
[data-focus-trap='active'] {
|
36
|
-
background-color: ${(0, _themeGet.themeGet)('colors.auto.green.2')}
|
37
|
-
}
|
38
|
-
[data-focus-trap='suspended'] {
|
39
|
-
background-color: ${(0, _themeGet.themeGet)('colors.auto.yellow.2')}
|
40
|
-
}
|
41
|
-
`;
|
31
|
+
const HelperGlobalStyling = (0, _styledComponents.createGlobalStyle)(["*:focus{outline:2px solid ", " !important;}[data-focus-trap='active']{background-color:", "}[data-focus-trap='suspended']{background-color:", "}"], (0, _themeGet.themeGet)('colors.auto.blue.3'), (0, _themeGet.themeGet)('colors.auto.green.2'), (0, _themeGet.themeGet)('colors.auto.yellow.2'));
|
42
32
|
const MarginButton = (0, _styledComponents.default)(_.Button).withConfig({
|
43
33
|
displayName: "useFocusTrapstories__MarginButton",
|
44
34
|
componentId: "sc-12zkn1e-0"
|
@@ -36,14 +36,10 @@ var _default = {
|
|
36
36
|
// this Storybook story, but they're not recommended for a real site!
|
37
37
|
|
38
38
|
exports.default = _default;
|
39
|
-
const HelperGlobalStyling = (0, _styledComponents.createGlobalStyle)
|
40
|
-
*:focus {
|
41
|
-
outline: 2px solid ${(0, _themeGet.themeGet)('colors.border.info')} !important;
|
42
|
-
}
|
43
|
-
`;
|
39
|
+
const HelperGlobalStyling = (0, _styledComponents.createGlobalStyle)(["*:focus{outline:2px solid ", " !important;}"], (0, _themeGet.themeGet)('colors.border.info'));
|
44
40
|
const MarginButton = (0, _styledComponents.default)(_.Button).withConfig({
|
45
41
|
displayName: "useFocusZonestories__MarginButton",
|
46
|
-
componentId: "e94kdz-0"
|
42
|
+
componentId: "sc-e94kdz-0"
|
47
43
|
})(["margin:", ";"], (0, _themeGet.themeGet)('space.1'));
|
48
44
|
|
49
45
|
const BasicFocusZone = () => {
|
@@ -10,7 +10,7 @@ import sx from '../sx';
|
|
10
10
|
|
11
11
|
export const StyledHeader = styled.div.withConfig({
|
12
12
|
displayName: "Header__StyledHeader",
|
13
|
-
componentId: "qmofje-0"
|
13
|
+
componentId: "sc-qmofje-0"
|
14
14
|
})(["{}padding:6px ", ";font-size:", ";font-weight:", ";color:", ";", " ", ""], get('space.3'), get('fontSizes.0'), get('fontWeights.bold'), get('colors.fg.muted'), ({
|
15
15
|
variant
|
16
16
|
}) => variant === 'filled' && css(["background:", ";margin:", " 0;border-top:1px solid ", ";border-bottom:1px solid ", ";&:first-child{margin-top:0;}"], get('colors.canvas.subtle'), get('space.2'), get('colors.neutral.muted'), get('colors.neutral.muted')), sx);
|
@@ -48,15 +48,15 @@ const getItemVariant = (variant = 'default', disabled) => {
|
|
48
48
|
|
49
49
|
const DividedContent = styled.div.withConfig({
|
50
50
|
displayName: "Item__DividedContent",
|
51
|
-
componentId: "jqpvy8-0"
|
51
|
+
componentId: "sc-jqpvy8-0"
|
52
52
|
})(["display:flex;min-width:0;position:relative;flex-grow:1;"]);
|
53
53
|
const MainContent = styled.div.withConfig({
|
54
54
|
displayName: "Item__MainContent",
|
55
|
-
componentId: "jqpvy8-1"
|
55
|
+
componentId: "sc-jqpvy8-1"
|
56
56
|
})(["align-items:baseline;display:flex;min-width:0;flex-direction:var(--main-content-flex-direction);flex-grow:1;"]);
|
57
57
|
const StyledItem = styled.div.withConfig({
|
58
58
|
displayName: "Item__StyledItem",
|
59
|
-
componentId: "jqpvy8-2"
|
59
|
+
componentId: "sc-jqpvy8-2"
|
60
60
|
})(["padding:6px ", ";display:flex;border-radius:", ";color:", ";transition:background 33.333ms linear;text-decoration:none;@media (hover:hover) and (pointer:fine){:hover{background:var( --item-hover-bg-override,", " );color:", ";cursor:", ";}}:not(:first-of-type):not(", " + &):not(", " + &){margin-top:", ";", "::before{content:' ';display:block;position:absolute;width:100%;top:-7px;border:0 solid ", ";border-top-width:", ";}}&:hover ", "::before,:hover + * ", "::before{border-color:var(--item-hover-divider-border-color-override,transparent) !important;}&:focus ", "::before,:focus + * ", "::before,&[", "] ", "::before,[", "] + & ", "::before{border-color:transparent !important;}&[", "='", "']{background:", ";}&[", "='", "']{background:", ";}&:focus{background:", ";outline:none;}&:active{background:", ";}", ""], get('space.2'), get('radii.2'), ({
|
61
61
|
variant,
|
62
62
|
item
|
@@ -88,37 +88,37 @@ const StyledItem = styled.div.withConfig({
|
|
88
88
|
}) => getItemVariant(variant, item === null || item === void 0 ? void 0 : item.disabled).focusBg, sx);
|
89
89
|
export const TextContainer = styled.span.withConfig({
|
90
90
|
displayName: "Item__TextContainer",
|
91
|
-
componentId: "jqpvy8-3"
|
91
|
+
componentId: "sc-jqpvy8-3"
|
92
92
|
})([""]);
|
93
93
|
const BaseVisualContainer = styled.div.withConfig({
|
94
94
|
displayName: "Item__BaseVisualContainer",
|
95
|
-
componentId: "jqpvy8-4"
|
95
|
+
componentId: "sc-jqpvy8-4"
|
96
96
|
})(["height:20px;width:", ";margin-right:", ";display:flex;justify-content:center;align-items:center;flex-shrink:0;"], get('space.3'), get('space.2'));
|
97
97
|
const ColoredVisualContainer = styled(BaseVisualContainer).withConfig({
|
98
98
|
displayName: "Item__ColoredVisualContainer",
|
99
|
-
componentId: "jqpvy8-5"
|
99
|
+
componentId: "sc-jqpvy8-5"
|
100
100
|
})(["svg{fill:", ";font-size:", ";}"], ({
|
101
101
|
variant,
|
102
102
|
disabled
|
103
103
|
}) => getItemVariant(variant, disabled).iconColor, get('fontSizes.0'));
|
104
104
|
const LeadingVisualContainer = styled(ColoredVisualContainer).withConfig({
|
105
105
|
displayName: "Item__LeadingVisualContainer",
|
106
|
-
componentId: "jqpvy8-6"
|
106
|
+
componentId: "sc-jqpvy8-6"
|
107
107
|
})(["display:flex;flex-direction:column;justify-content:center;"]);
|
108
108
|
const TrailingContent = styled(ColoredVisualContainer).withConfig({
|
109
109
|
displayName: "Item__TrailingContent",
|
110
|
-
componentId: "jqpvy8-7"
|
110
|
+
componentId: "sc-jqpvy8-7"
|
111
111
|
})(["color:", "};margin-left:", ";margin-right:0;width:auto;div:nth-child(2){margin-left:", ";}"], ({
|
112
112
|
variant,
|
113
113
|
disabled
|
114
114
|
}) => getItemVariant(variant, disabled).annotationColor, get('space.2'), get('space.2'));
|
115
115
|
const DescriptionContainer = styled.span.withConfig({
|
116
116
|
displayName: "Item__DescriptionContainer",
|
117
|
-
componentId: "jqpvy8-8"
|
117
|
+
componentId: "sc-jqpvy8-8"
|
118
118
|
})(["color:", ";font-size:", ";line-height:16px;margin-left:var(--description-container-margin-left);min-width:0;flex-grow:1;flex-basis:var(--description-container-flex-basis);"], get('colors.fg.muted'), get('fontSizes.0'));
|
119
119
|
const MultiSelectIcon = styled.svg.withConfig({
|
120
120
|
displayName: "Item__MultiSelectIcon",
|
121
|
-
componentId: "jqpvy8-9"
|
121
|
+
componentId: "sc-jqpvy8-9"
|
122
122
|
})(["rect{fill:", ";stroke:", ";shape-rendering:auto;}path{fill:", ";boxshadow:", ";opacity:", ";}"], ({
|
123
123
|
selected
|
124
124
|
}) => selected ? get('colors.accent.fg') : get('colors.canvas.default'), ({
|
@@ -22,7 +22,7 @@ function isGroupedListProps(props) {
|
|
22
22
|
|
23
23
|
const StyledList = styled.div.withConfig({
|
24
24
|
displayName: "List__StyledList",
|
25
|
-
componentId: "yr2k7d-0"
|
25
|
+
componentId: "sc-yr2k7d-0"
|
26
26
|
})(["font-size:", ";line-height:20px;&[", "],&:focus-within{--item-hover-bg-override:none;--item-hover-divider-border-color-override:", ";}"], get('fontSizes.1'), hasActiveDescendantAttribute, get('colors.border.muted'));
|
27
27
|
/**
|
28
28
|
* Returns `sx` prop values for `List` children matching the given `List` style variation.
|
@@ -7,7 +7,7 @@ import { MenuContext } from './MenuContext';
|
|
7
7
|
export const ListContext = /*#__PURE__*/React.createContext({});
|
8
8
|
const ListBox = styled.ul.withConfig({
|
9
9
|
displayName: "List__ListBox",
|
10
|
-
componentId: "cvbq60-0"
|
10
|
+
componentId: "sc-cvbq60-0"
|
11
11
|
})(sx);
|
12
12
|
export const List = /*#__PURE__*/React.forwardRef(({
|
13
13
|
variant = 'inset',
|
package/lib-esm/BaseStyles.js
CHANGED
@@ -3,28 +3,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
3
3
|
import React from 'react';
|
4
4
|
import styled, { createGlobalStyle } from 'styled-components';
|
5
5
|
import { COMMON, TYPOGRAPHY } from './constants';
|
6
|
-
const GlobalStyle = createGlobalStyle
|
7
|
-
* { box-sizing: border-box; }
|
8
|
-
body { margin: 0; }
|
9
|
-
table { border-collapse: collapse; }
|
10
|
-
|
11
|
-
[role="button"]:focus:not(:focus-visible):not(.focus-visible),
|
12
|
-
[role="tabpanel"][tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),
|
13
|
-
button:focus:not(:focus-visible):not(.focus-visible),
|
14
|
-
summary:focus:not(:focus-visible):not(.focus-visible),
|
15
|
-
a:focus:not(:focus-visible):not(.focus-visible) {
|
16
|
-
outline: none;
|
17
|
-
box-shadow: none;
|
18
|
-
}
|
19
|
-
|
20
|
-
[tabindex="0"]:focus:not(:focus-visible):not(.focus-visible),
|
21
|
-
details-dialog:focus:not(:focus-visible):not(.focus-visible) {
|
22
|
-
outline: none;
|
23
|
-
}
|
24
|
-
`;
|
6
|
+
const GlobalStyle = createGlobalStyle(["*{box-sizing:border-box;}body{margin:0;}table{border-collapse:collapse;}[role=\"button\"]:focus:not(:focus-visible):not(.focus-visible),[role=\"tabpanel\"][tabindex=\"0\"]:focus:not(:focus-visible):not(.focus-visible),button:focus:not(:focus-visible):not(.focus-visible),summary:focus:not(:focus-visible):not(.focus-visible),a:focus:not(:focus-visible):not(.focus-visible){outline:none;box-shadow:none;}[tabindex=\"0\"]:focus:not(:focus-visible):not(.focus-visible),details-dialog:focus:not(:focus-visible):not(.focus-visible){outline:none;}"]);
|
25
7
|
const Base = styled.div.withConfig({
|
26
8
|
displayName: "BaseStyles__Base",
|
27
|
-
componentId: "qvuaww-0"
|
9
|
+
componentId: "sc-qvuaww-0"
|
28
10
|
})(["", ";", ";"], TYPOGRAPHY, COMMON);
|
29
11
|
|
30
12
|
function BaseStyles(props) {
|
package/lib-esm/BorderBox.js
CHANGED
package/lib-esm/Box.js
CHANGED
@@ -3,6 +3,6 @@ import { background, border, color, flexbox, grid, layout, position, shadow, spa
|
|
3
3
|
import sx from './sx';
|
4
4
|
const Box = styled.div.withConfig({
|
5
5
|
displayName: "Box",
|
6
|
-
componentId: "nv15kw-0"
|
6
|
+
componentId: "sc-nv15kw-0"
|
7
7
|
})(space, color, typography, layout, flexbox, grid, background, border, position, shadow, sx);
|
8
8
|
export default Box;
|
package/lib-esm/Breadcrumbs.js
CHANGED
@@ -8,11 +8,11 @@ import sx from './sx';
|
|
8
8
|
const SELECTED_CLASS = 'selected';
|
9
9
|
const Wrapper = styled.li.withConfig({
|
10
10
|
displayName: "Breadcrumbs__Wrapper",
|
11
|
-
componentId: "hwwoo0-0"
|
11
|
+
componentId: "sc-hwwoo0-0"
|
12
12
|
})(["display:inline-block;white-space:nowrap;list-style:none;&::after{padding-right:0.5em;padding-left:0.5em;color:", ";font-size:", ";content:'/';}&:first-child{margin-left:0;}&:last-child{&::after{content:none;}}"], get('colors.fg.muted'), get('fontSizes.1'));
|
13
13
|
const BreadcrumbsBase = styled.nav.withConfig({
|
14
14
|
displayName: "Breadcrumbs__BreadcrumbsBase",
|
15
|
-
componentId: "hwwoo0-1"
|
15
|
+
componentId: "sc-hwwoo0-1"
|
16
16
|
})(["display:flex;justify-content:space-between;", ";"], sx);
|
17
17
|
|
18
18
|
function Breadcrumbs({
|
@@ -39,7 +39,7 @@ const BreadcrumbsItem = styled.a.attrs(props => ({
|
|
39
39
|
'aria-current': props.selected ? 'page' : null
|
40
40
|
})).withConfig({
|
41
41
|
displayName: "Breadcrumbs__BreadcrumbsItem",
|
42
|
-
componentId: "hwwoo0-2"
|
42
|
+
componentId: "sc-hwwoo0-2"
|
43
43
|
})(["color:", ";display:inline-block;font-size:", ";text-decoration:none;&:hover{text-decoration:underline;}&.selected{color:", ";pointer-events:none;}", ";"], get('colors.accent.fg'), get('fontSizes.1'), get('colors.fg.default'), sx);
|
44
44
|
Breadcrumbs.displayName = 'Breadcrumbs';
|
45
45
|
BreadcrumbsItem.displayName = 'Breadcrumbs.Item';
|
package/lib-esm/Button/Button.js
CHANGED
@@ -4,6 +4,6 @@ import sx from '../sx';
|
|
4
4
|
import ButtonBase from './ButtonBase';
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
|
-
componentId: "xjtz72-0"
|
7
|
+
componentId: "sc-xjtz72-0"
|
8
8
|
})(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), sx);
|
9
9
|
export default Button;
|
@@ -4,7 +4,7 @@ import { get } from '../constants';
|
|
4
4
|
import sx from '../sx';
|
5
5
|
const ButtonGroup = styled(Box).withConfig({
|
6
6
|
displayName: "ButtonGroup",
|
7
|
-
componentId: "peei04-0"
|
7
|
+
componentId: "sc-peei04-0"
|
8
8
|
})(["vertical-align:middle;&& > *{position:relative;border-right-width:0;border-radius:0;:first-child{border-top-left-radius:", ";border-bottom-left-radius:", ";margin-right:0;}:not(:first-child){margin-left:0;margin-right:0;}:last-child{border-right-width:1px;border-top-right-radius:", ";border-bottom-right-radius:", ";}:focus,:active,:hover{border-right-width:1px;+ *{border-left-width:0;}}:focus,:active{z-index:1;}}", ";"], get('radii.2'), get('radii.2'), get('radii.2'), get('radii.2'), sx);
|
9
9
|
ButtonGroup.defaultProps = {
|
10
10
|
display: 'inline-block'
|
package/lib-esm/Checkbox.js
CHANGED
@@ -6,7 +6,7 @@ import React, { useLayoutEffect } from 'react';
|
|
6
6
|
import sx from './sx';
|
7
7
|
const StyledCheckbox = styled.input.withConfig({
|
8
8
|
displayName: "Checkbox__StyledCheckbox",
|
9
|
-
componentId: "i51804-0"
|
9
|
+
componentId: "sc-i51804-0"
|
10
10
|
})(["cursor:pointer;", " ", ""], props => props.disabled && `cursor: not-allowed;`, sx);
|
11
11
|
/**
|
12
12
|
* An accessible, native checkbox component
|
package/lib-esm/Details.js
CHANGED
@@ -2,7 +2,7 @@ import styled from 'styled-components';
|
|
2
2
|
import sx from './sx';
|
3
3
|
const Details = styled.details.withConfig({
|
4
4
|
displayName: "Details",
|
5
|
-
componentId: "ssy9qz-0"
|
5
|
+
componentId: "sc-ssy9qz-0"
|
6
6
|
})(["& > summary{list-style:none;}& > summary::-webkit-details-marker{display:none;}", ";"], sx);
|
7
7
|
Details.displayName = 'Details';
|
8
8
|
export default Details;
|
@@ -15,7 +15,7 @@ import useScrollFlash from '../hooks/useScrollFlash';
|
|
15
15
|
import { scrollIntoViewingArea } from '../behaviors/scrollIntoViewingArea';
|
16
16
|
const StyledHeader = styled.div.withConfig({
|
17
17
|
displayName: "FilteredActionList__StyledHeader",
|
18
|
-
componentId: "yg3jkv-0"
|
18
|
+
componentId: "sc-yg3jkv-0"
|
19
19
|
})(["box-shadow:0 1px 0 ", ";z-index:1;"], get('colors.border.default'));
|
20
20
|
export function FilteredActionList({
|
21
21
|
loading = false,
|
package/lib-esm/Flex.js
CHANGED
package/lib-esm/LabelGroup.js
CHANGED
@@ -3,6 +3,6 @@ import { get } from './constants';
|
|
3
3
|
import sx from './sx';
|
4
4
|
const LabelGroup = styled.span.withConfig({
|
5
5
|
displayName: "LabelGroup",
|
6
|
-
componentId: "k6k3qa-0"
|
6
|
+
componentId: "sc-k6k3qa-0"
|
7
7
|
})(["& *{margin-right:", ";}& *:last-child{margin-right:0;}", ";"], get('space.1'), sx);
|
8
8
|
export default LabelGroup;
|
package/lib-esm/Overlay.js
CHANGED
@@ -60,7 +60,7 @@ function getSlideAnimationStartingVector(anchorSide) {
|
|
60
60
|
|
61
61
|
const StyledOverlay = styled.div.withConfig({
|
62
62
|
displayName: "Overlay__StyledOverlay",
|
63
|
-
componentId: "jhwkzw-0"
|
63
|
+
componentId: "sc-jhwkzw-0"
|
64
64
|
})(["background-color:", ";box-shadow:", ";position:absolute;min-width:192px;max-width:640px;height:", ";max-height:", ";width:", ";border-radius:12px;overflow:hidden;animation:overlay-appear ", "ms ", ";@keyframes overlay-appear{0%{opacity:0;}100%{opacity:1;}}visibility:var(--styled-overlay-visibility);:focus{outline:none;}", ";"], get('colors.canvas.overlay'), get('shadows.overlay.shadow'), props => heightMap[props.height || 'auto'], props => props.maxHeight && heightMap[props.maxHeight], props => widthMap[props.width || 'auto'], animationDuration, get('animation.easeOutCubic'), sx);
|
65
65
|
|
66
66
|
/**
|
@@ -8,7 +8,7 @@ import sx from '../sx';
|
|
8
8
|
import { buildComponentData, buildPaginationModel } from './model';
|
9
9
|
const Page = styled.a.withConfig({
|
10
10
|
displayName: "Pagination__Page",
|
11
|
-
componentId: "b80nss-0"
|
11
|
+
componentId: "sc-b80nss-0"
|
12
12
|
})(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'));
|
13
13
|
|
14
14
|
function usePaginationPages({
|
@@ -43,7 +43,7 @@ function usePaginationPages({
|
|
43
43
|
|
44
44
|
const PaginationContainer = styled.nav.withConfig({
|
45
45
|
displayName: "Pagination__PaginationContainer",
|
46
|
-
componentId: "b80nss-1"
|
46
|
+
componentId: "sc-b80nss-1"
|
47
47
|
})(["margin-top:20px;margin-bottom:15px;text-align:center;", ";"], sx);
|
48
48
|
|
49
49
|
function Pagination({
|
package/lib-esm/Position.js
CHANGED
@@ -32,7 +32,7 @@ const wrapperStyles = `
|
|
32
32
|
`;
|
33
33
|
const StyledSelectMenu = styled.details.withConfig({
|
34
34
|
displayName: "SelectMenu__StyledSelectMenu",
|
35
|
-
componentId: "i7h45b-0"
|
35
|
+
componentId: "sc-i7h45b-0"
|
36
36
|
})(["", " ", ";"], wrapperStyles, sx);
|
37
37
|
// 'as' is spread out because we don't want users to be able to change the tag.
|
38
38
|
const SelectMenu = /*#__PURE__*/React.forwardRef(({
|
@@ -8,7 +8,7 @@ import TextInput from '../TextInput';
|
|
8
8
|
import { MenuContext } from './SelectMenuContext';
|
9
9
|
const StyledForm = styled.form.withConfig({
|
10
10
|
displayName: "SelectMenuFilter__StyledForm",
|
11
|
-
componentId: "s7ktlh-0"
|
11
|
+
componentId: "sc-s7ktlh-0"
|
12
12
|
})(["padding:", ";margin:0;border-bottom:", " solid ", ";background-color:", ";@media (min-width:", "){padding:", ";}", ";"], get('space.3'), get('borderWidths.1'), get('colors.border.muted'), get('colors.canvas.overlay'), get('breakpoints.0'), get('space.2'), sx);
|
13
13
|
const SelectMenuFilter = /*#__PURE__*/forwardRef(({
|
14
14
|
theme,
|
@@ -4,7 +4,7 @@ import sx from '../sx';
|
|
4
4
|
const footerStyles = css(["margin-top:-1px;padding:", " ", ";font-size:", ";color:", ";text-align:center;border-top:", " solid ", ";@media (min-width:", "){padding:", " ", ";}"], get('space.2'), get('space.3'), get('fontSizes.0'), get('colors.fg.muted'), get('borderWidths.1'), get('colors.border.muted'), get('breakpoints.0'), get('space.1'), get('space.2'));
|
5
5
|
const SelectMenuFooter = styled.footer.withConfig({
|
6
6
|
displayName: "SelectMenuFooter",
|
7
|
-
componentId: "rkvco1-0"
|
7
|
+
componentId: "sc-rkvco1-0"
|
8
8
|
})(["", " ", ";"], footerStyles, sx);
|
9
9
|
SelectMenuFooter.displayName = 'SelectMenu.Footer';
|
10
10
|
export default SelectMenuFooter;
|
@@ -12,7 +12,7 @@ const StyledItem = styled.a.attrs(() => ({
|
|
12
12
|
role: 'menuitemcheckbox'
|
13
13
|
})).withConfig({
|
14
14
|
displayName: "SelectMenuItem__StyledItem",
|
15
|
-
componentId: "gjymba-0"
|
15
|
+
componentId: "sc-gjymba-0"
|
16
16
|
})(["", " ", ";"], listItemStyles, sx);
|
17
17
|
const SelectMenuItem = /*#__PURE__*/forwardRef(({
|
18
18
|
children,
|
@@ -9,7 +9,7 @@ import { MenuContext } from './SelectMenuContext';
|
|
9
9
|
const tabStyles = css(["flex:1;padding:", " ", ";font-size:", ";font-weight:500;color:", ";text-align:center;background-color:transparent;border:0;box-shadow:inset 0 -1px 0 ", ";@media (min-width:", "){flex:none;padding:", " ", ";border:", " solid transparent;border-bottom-width:0;border-top-left-radius:", ";border-top-right-radius:", ";}&[aria-selected='true']{z-index:1;color:", ";background-color:", ";box-shadow:0 0 0 1px ", ";@media (min-width:", "){border-color:", ";box-shadow:none;}}&:focus{background-color:", ";}"], get('space.2'), get('space.3'), get('fontSizes.0'), get('colors.fg.muted'), get('colors.border.muted'), get('breakpoints.0'), get('space.1'), get('space.3'), get('borderWidths.1'), get('radii.2'), get('radii.2'), get('colors.text-primary'), get('colors.canvas.overlay'), get('colors.border.muted'), get('breakpoints.0'), get('colors.border.muted'), get('colors.neutral.subtle'));
|
10
10
|
const StyledTab = styled.button.withConfig({
|
11
11
|
displayName: "SelectMenuTab__StyledTab",
|
12
|
-
componentId: "ga32sz-0"
|
12
|
+
componentId: "sc-ga32sz-0"
|
13
13
|
})(["", " ", ";"], tabStyles, sx);
|
14
14
|
|
15
15
|
const SelectMenuTab = ({
|
@@ -8,7 +8,7 @@ import { MenuContext } from './SelectMenuContext';
|
|
8
8
|
import SelectMenuList from './SelectMenuList';
|
9
9
|
const TabPanelBase = styled.div.withConfig({
|
10
10
|
displayName: "SelectMenuTabPanel__TabPanelBase",
|
11
|
-
componentId: "ck0ipe-0"
|
11
|
+
componentId: "sc-ck0ipe-0"
|
12
12
|
})(["border-top:", " solid ", ";", ";"], get('borderWidths.1'), get('colors.border.muted'), sx);
|
13
13
|
|
14
14
|
const TabPanel = ({
|
@@ -7,7 +7,7 @@ import sx from '../sx';
|
|
7
7
|
const tabWrapperStyles = css(["display:flex;flex-shrink:0;margin-bottom:-1px;-webkit-overflow-scrolling:touch;overflow-x:auto;overflow-y:hidden;&::-webkit-scrollbar{display:none;}@media (min-width:", "){padding:0 ", ";margin-top:", ";}"], get('breakpoints.0'), get('space.2'), get('space.3'));
|
8
8
|
const SelectMenuTabsBase = styled.div.withConfig({
|
9
9
|
displayName: "SelectMenuTabs__SelectMenuTabsBase",
|
10
|
-
componentId: "kgg21o-0"
|
10
|
+
componentId: "sc-kgg21o-0"
|
11
11
|
})(["", " ", ";"], tabWrapperStyles, sx);
|
12
12
|
|
13
13
|
const SelectMenuTabs = ({
|
package/lib-esm/StateLabel.js
CHANGED
@@ -66,7 +66,7 @@ const sizeVariants = variant({
|
|
66
66
|
});
|
67
67
|
const StateLabelBase = styled.span.withConfig({
|
68
68
|
displayName: "StateLabel__StateLabelBase",
|
69
|
-
componentId: "k4pd9e-0"
|
69
|
+
componentId: "sc-k4pd9e-0"
|
70
70
|
})(["display:inline-flex;align-items:center;font-weight:", ";line-height:16px;color:", ";text-align:center;border-radius:", ";", ";", ";", ";"], get('fontWeights.bold'), get('colors.canvas.default'), get('radii.3'), colorVariants, sizeVariants, sx);
|
71
71
|
|
72
72
|
function StateLabel({
|
package/lib-esm/StyledOcticon.js
CHANGED
@@ -12,7 +12,7 @@ function Octicon({
|
|
12
12
|
Octicon.displayName = "Octicon";
|
13
13
|
const StyledOcticon = styled(Octicon).withConfig({
|
14
14
|
displayName: "StyledOcticon",
|
15
|
-
componentId: "uhnt7w-0"
|
15
|
+
componentId: "sc-uhnt7w-0"
|
16
16
|
})(["", ""], sx);
|
17
17
|
StyledOcticon.defaultProps = {
|
18
18
|
size: 16
|