@primer/components 31.0.0-rc.dfe9dc6b → 31.0.1-rc.0f466271
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.
- package/.github/workflows/check_for_changeset.yml +25 -0
- package/CHANGELOG.md +10 -0
- package/dist/browser.esm.js +33 -28
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +13 -8
- package/dist/browser.umd.js.map +1 -1
- package/docs/content/ActionList.mdx +2 -2
- package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +3 -1
- package/lib/ActionList/Item.d.ts +6 -0
- package/lib/ActionList/Item.js +8 -4
- package/lib/Button/Button.js +1 -1
- package/lib/Button/ButtonInvisible.js +1 -1
- package/lib/Button/ButtonTableList.js +1 -1
- package/lib/Pagination/Pagination.js +1 -1
- package/lib/_TextInputWrapper.js +1 -1
- package/lib/stories/ActionList.stories.js +3 -2
- package/lib/stories/ActionMenu.stories.js +14 -2
- package/lib/stories/Button.stories.js +12 -1
- package/lib-esm/ActionList/Item.d.ts +6 -0
- package/lib-esm/ActionList/Item.js +8 -4
- package/lib-esm/Button/Button.js +1 -1
- package/lib-esm/Button/ButtonInvisible.js +1 -1
- package/lib-esm/Button/ButtonTableList.js +1 -1
- package/lib-esm/Pagination/Pagination.js +1 -1
- package/lib-esm/_TextInputWrapper.js +1 -1
- package/lib-esm/stories/ActionList.stories.js +3 -2
- package/lib-esm/stories/ActionMenu.stories.js +14 -2
- package/lib-esm/stories/Button.stories.js +8 -0
- package/package.json +1 -1
- package/src/ActionList/Item.tsx +17 -4
- package/src/Button/Button.tsx +1 -1
- package/src/Button/ButtonInvisible.tsx +7 -2
- package/src/Button/ButtonTableList.tsx +1 -1
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/_TextInputWrapper.tsx +1 -1
- package/src/__tests__/Pagination/__snapshots__/Pagination.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/ActionMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/AnchoredOverlay.test.tsx.snap +3 -3
- package/src/__tests__/__snapshots__/Button.test.tsx.snap +12 -4
- package/src/__tests__/__snapshots__/ConfirmationDialog.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/Dropdown.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/DropdownMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/SelectMenu.test.tsx.snap +1 -1
- package/src/__tests__/__snapshots__/SelectPanel.test.tsx.snap +1 -1
- package/src/stories/ActionList.stories.tsx +3 -4
- package/src/stories/ActionMenu.stories.tsx +15 -3
- package/src/stories/Button.stories.tsx +4 -0
- package/stats.html +1 -1
@@ -32,7 +32,7 @@ An `ActionList` is a list of items which can be activated or selected. `ActionLi
|
|
32
32
|
{groupId: '4'}
|
33
33
|
]}
|
34
34
|
items={[
|
35
|
-
{key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0'},
|
35
|
+
{key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0', trailingVisual: '⌘R'},
|
36
36
|
{key: '2', leadingVisual: VersionsIcon, text: 'Duplicate', groupId: '0'},
|
37
37
|
{key: '3', leadingVisual: SearchIcon, text: 'repo:github/github', groupId: '1'},
|
38
38
|
{
|
@@ -59,7 +59,7 @@ An `ActionList` is a list of items which can be activated or selected. `ActionLi
|
|
59
59
|
groupId: '3'
|
60
60
|
},
|
61
61
|
{key: '7', leadingVisual: FilterIcon, text: 'Save sort and filters to new view', groupId: '3'},
|
62
|
-
{key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4'}
|
62
|
+
{key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4', trailingVisual: ArrowRightIcon}
|
63
63
|
]}
|
64
64
|
/>
|
65
65
|
```
|
@@ -17,7 +17,8 @@ import {
|
|
17
17
|
FilterIcon,
|
18
18
|
GearIcon,
|
19
19
|
TypographyIcon,
|
20
|
-
VersionsIcon
|
20
|
+
VersionsIcon,
|
21
|
+
ArrowRightIcon
|
21
22
|
} from '@primer/octicons-react'
|
22
23
|
import State from '../../../components/State'
|
23
24
|
import {Dialog as Dialog2} from '../../../../src/Dialog/Dialog'
|
@@ -46,6 +47,7 @@ export default {
|
|
46
47
|
GearIcon,
|
47
48
|
TypographyIcon,
|
48
49
|
VersionsIcon,
|
50
|
+
ArrowRightIcon,
|
49
51
|
Dialog2,
|
50
52
|
ConfirmationDialog,
|
51
53
|
useConfirm,
|
package/lib/ActionList/Item.d.ts
CHANGED
@@ -28,13 +28,19 @@ export interface ItemProps extends SxProp {
|
|
28
28
|
*/
|
29
29
|
leadingVisual?: React.FunctionComponent<IconProps>;
|
30
30
|
/**
|
31
|
+
* @deprecated Use `trailingVisual` instead
|
31
32
|
* Icon (or similar) positioned after `Item` text.
|
32
33
|
*/
|
33
34
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
34
35
|
/**
|
36
|
+
* @deprecated Use `trailingVisual` instead
|
35
37
|
* Text positioned after `Item` text and optional trailing icon.
|
36
38
|
*/
|
37
39
|
trailingText?: string;
|
40
|
+
/**
|
41
|
+
* Icon or text positioned after `Item` text.
|
42
|
+
*/
|
43
|
+
trailingVisual?: React.ReactNode;
|
38
44
|
/**
|
39
45
|
* Style variations associated with various `Item` types.
|
40
46
|
*
|
package/lib/ActionList/Item.js
CHANGED
@@ -71,9 +71,9 @@ const customItemThemes = {
|
|
71
71
|
const getItemVariant = (variant = 'default', disabled) => {
|
72
72
|
if (disabled) {
|
73
73
|
return {
|
74
|
-
color: (0, _constants.get)('colors.fg.
|
75
|
-
iconColor: (0, _constants.get)('colors.fg.
|
76
|
-
annotationColor: (0, _constants.get)('colors.fg.
|
74
|
+
color: (0, _constants.get)('colors.primer.fg.disabled'),
|
75
|
+
iconColor: (0, _constants.get)('colors.primer.fg.disabled'),
|
76
|
+
annotationColor: (0, _constants.get)('colors.primer.fg.disabled'),
|
77
77
|
hoverCursor: 'default'
|
78
78
|
};
|
79
79
|
}
|
@@ -187,6 +187,7 @@ const Item = /*#__PURE__*/_react.default.forwardRef((itemProps, ref) => {
|
|
187
187
|
selectionVariant,
|
188
188
|
leadingVisual: LeadingVisual,
|
189
189
|
trailingIcon: TrailingIcon,
|
190
|
+
trailingVisual: TrailingVisual,
|
190
191
|
trailingText,
|
191
192
|
variant = 'default',
|
192
193
|
showDivider,
|
@@ -278,7 +279,10 @@ const Item = /*#__PURE__*/_react.default.forwardRef((itemProps, ref) => {
|
|
278
279
|
title: description,
|
279
280
|
inline: true,
|
280
281
|
maxWidth: "100%"
|
281
|
-
}, description)) : null),
|
282
|
+
}, description)) : null), TrailingVisual ? /*#__PURE__*/_react.default.createElement(TrailingContent, {
|
283
|
+
variant: variant,
|
284
|
+
disabled: disabled
|
285
|
+
}, typeof TrailingVisual === 'function' ? /*#__PURE__*/_react.default.createElement(TrailingVisual, null) : TrailingVisual) : TrailingIcon || trailingText ? /*#__PURE__*/_react.default.createElement(TrailingContent, {
|
282
286
|
variant: variant,
|
283
287
|
disabled: disabled
|
284
288
|
}, trailingText, TrailingIcon && /*#__PURE__*/_react.default.createElement(TrailingIcon, null)) : null));
|
package/lib/Button/Button.js
CHANGED
@@ -22,6 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
22
22
|
const Button = (0, _styledComponents.default)(_ButtonBase.default).withConfig({
|
23
23
|
displayName: "Button",
|
24
24
|
componentId: "xjtz72-0"
|
25
|
-
})(["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:", ";}", ";", ";"], (0, _constants.get)('colors.btn.text'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), (0, _constants.get)('shadows.btn.shadow'), (0, _constants.get)('shadows.btn.insetShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.hoverBorder'), (0, _constants.get)('colors.btn.focusBorder'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.selectedBg'), (0, _constants.get)('shadows.btn.shadowActive'), (0, _constants.get)('colors.fg.
|
25
|
+
})(["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:", ";}", ";", ";"], (0, _constants.get)('colors.btn.text'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), (0, _constants.get)('shadows.btn.shadow'), (0, _constants.get)('shadows.btn.insetShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.hoverBorder'), (0, _constants.get)('colors.btn.focusBorder'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.selectedBg'), (0, _constants.get)('shadows.btn.shadowActive'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('colors.btn.bg'), (0, _constants.get)('colors.btn.border'), _ButtonBase.buttonSystemProps, _sx.default);
|
26
26
|
var _default = Button;
|
27
27
|
exports.default = _default;
|
@@ -22,6 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
22
22
|
const ButtonInvisible = (0, _styledComponents.default)(_ButtonBase.default).withConfig({
|
23
23
|
displayName: "ButtonInvisible",
|
24
24
|
componentId: "sc-1195tpn-0"
|
25
|
-
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}", ";", ""], (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.fg.
|
25
|
+
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}&:hover{background-color:", ";}&:active{background-color:", ";}", ";", ""], (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('shadows.btn.focusShadow'), (0, _constants.get)('colors.btn.hoverBg'), (0, _constants.get)('colors.btn.selectedBg'), _ButtonBase.buttonSystemProps, _sx.default);
|
26
26
|
var _default = ButtonInvisible;
|
27
27
|
exports.default = _default;
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
16
16
|
const ButtonTableList = _styledComponents.default.summary.withConfig({
|
17
17
|
displayName: "ButtonTableList",
|
18
18
|
componentId: "sc-1m4q8ia-0"
|
19
|
-
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:
|
19
|
+
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:", ";cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('space.1'), _constants.COMMON, _constants.TYPOGRAPHY, _constants.LAYOUT, _sx.default);
|
20
20
|
|
21
21
|
var _default = ButtonTableList;
|
22
22
|
exports.default = _default;
|
@@ -24,7 +24,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
24
24
|
const Page = _styledComponents.default.a.withConfig({
|
25
25
|
displayName: "Pagination__Page",
|
26
26
|
componentId: "b80nss-0"
|
27
|
-
})(["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 );}}", ";"], (0, _constants.get)('colors.fg.default'), (0, _constants.get)('space.1'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('colors.fg.
|
27
|
+
})(["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 );}}", ";"], (0, _constants.get)('colors.fg.default'), (0, _constants.get)('space.1'), (0, _constants.get)('borderWidths.1'), (0, _constants.get)('radii.2'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('colors.border.muted'), (0, _constants.get)('colors.accent.fg'), (0, _constants.get)('colors.fg.onEmphasis'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('space.1'), (0, _constants.get)('space.1'), _constants.COMMON);
|
28
28
|
|
29
29
|
function usePaginationPages({
|
30
30
|
theme,
|
package/lib/_TextInputWrapper.js
CHANGED
@@ -45,7 +45,7 @@ const TextInputWrapper = _styledComponents.default.span.withConfig({
|
|
45
45
|
} else {
|
46
46
|
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
47
47
|
}
|
48
|
-
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.fg.
|
48
|
+
}, (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.accent.emphasis'), (0, _constants.get)('shadows.primer.shadow.focus'), props => props.contrast && (0, _styledComponents.css)(["background-color:", ";"], (0, _constants.get)('colors.canvas.inset')), props => props.disabled && (0, _styledComponents.css)(["color:", ";background-color:", ";border-color:", ";"], (0, _constants.get)('colors.primer.fg.disabled'), (0, _constants.get)('colors.input.disabledBg'), (0, _constants.get)('colors.border.default')), props => props.block && (0, _styledComponents.css)(["display:block;width:100%;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeVariants, _sx.default);
|
49
49
|
|
50
50
|
var _default = TextInputWrapper;
|
51
51
|
exports.default = _default;
|
@@ -368,18 +368,19 @@ function SizeStressTestingStory() {
|
|
368
368
|
text: 'Block Description. Long text should wrap',
|
369
369
|
description: 'This description is long, but it is block so it wraps',
|
370
370
|
descriptionVariant: 'block',
|
371
|
-
|
371
|
+
trailingVisual: _octiconsReact.ArrowLeftIcon,
|
372
372
|
showDivider: true
|
373
373
|
}, {
|
374
374
|
leadingVisual: _octiconsReact.ArrowRightIcon,
|
375
375
|
text: 'Inline Description',
|
376
376
|
description: 'This description gets truncated because it is inline',
|
377
|
-
|
377
|
+
trailingVisual: _octiconsReact.ArrowLeftIcon,
|
378
378
|
showDivider: true
|
379
379
|
}, {
|
380
380
|
leadingVisual: _octiconsReact.ArrowRightIcon,
|
381
381
|
text: 'Really long text without a description should wrap',
|
382
382
|
trailingIcon: _octiconsReact.ArrowLeftIcon,
|
383
|
+
// backward compatible
|
383
384
|
showDivider: true
|
384
385
|
}]
|
385
386
|
})));
|
@@ -153,7 +153,7 @@ function ExternalOpenState() {
|
|
153
153
|
}, {
|
154
154
|
text: 'Delete file',
|
155
155
|
variant: 'danger',
|
156
|
-
|
156
|
+
trailingVisual: '⌘D'
|
157
157
|
}]
|
158
158
|
})));
|
159
159
|
}
|
@@ -202,6 +202,16 @@ function ComplexListStory() {
|
|
202
202
|
leadingVisual: _octiconsReact.VersionsIcon,
|
203
203
|
text: 'Duplicate',
|
204
204
|
groupId: '0'
|
205
|
+
}, {
|
206
|
+
leadingVisual: _octiconsReact.SearchIcon,
|
207
|
+
text: 'repo:github/github',
|
208
|
+
groupId: '1',
|
209
|
+
renderItem: props => /*#__PURE__*/_react.default.createElement(_ActionList.ActionList.Item, _extends({
|
210
|
+
style: {
|
211
|
+
color: 'rebeccapurple'
|
212
|
+
}
|
213
|
+
}, props)),
|
214
|
+
trailingVisual: () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u2318S", /*#__PURE__*/_react.default.createElement(_octiconsReact.ArrowRightIcon, null))
|
205
215
|
}, {
|
206
216
|
leadingVisual: _octiconsReact.SearchIcon,
|
207
217
|
text: 'repo:github/github',
|
@@ -212,7 +222,9 @@ function ComplexListStory() {
|
|
212
222
|
}
|
213
223
|
}, props)),
|
214
224
|
trailingText: '⌘S',
|
215
|
-
|
225
|
+
// backward compatible
|
226
|
+
trailingIcon: _octiconsReact.ArrowRightIcon // backward compatible
|
227
|
+
|
216
228
|
}, {
|
217
229
|
leadingVisual: _octiconsReact.NoteIcon,
|
218
230
|
text: 'Table',
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.buttonTableList = exports.buttonGroup = exports.closeButton = exports.invisibleButton = exports.primaryButton = exports.outlineButton = exports.dangerButton = exports.defaultButton = exports.default = void 0;
|
6
|
+
exports.disabledButton = exports.buttonTableList = exports.buttonGroup = exports.closeButton = exports.invisibleButton = exports.primaryButton = exports.outlineButton = exports.dangerButton = exports.defaultButton = exports.default = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -88,6 +88,17 @@ const buttonTableList = args => /*#__PURE__*/_react.default.createElement(_.Butt
|
|
88
88
|
|
89
89
|
exports.buttonTableList = buttonTableList;
|
90
90
|
buttonTableList.displayName = "buttonTableList";
|
91
|
+
|
92
|
+
const disabledButton = args => {
|
93
|
+
const props = {
|
94
|
+
disabled: true,
|
95
|
+
...args
|
96
|
+
};
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_.Button, props, "Disabled");
|
98
|
+
};
|
99
|
+
|
100
|
+
exports.disabledButton = disabledButton;
|
101
|
+
disabledButton.displayName = "disabledButton";
|
91
102
|
defaultButton.args = {
|
92
103
|
variant: 'medium'
|
93
104
|
};
|
@@ -28,13 +28,19 @@ export interface ItemProps extends SxProp {
|
|
28
28
|
*/
|
29
29
|
leadingVisual?: React.FunctionComponent<IconProps>;
|
30
30
|
/**
|
31
|
+
* @deprecated Use `trailingVisual` instead
|
31
32
|
* Icon (or similar) positioned after `Item` text.
|
32
33
|
*/
|
33
34
|
trailingIcon?: React.FunctionComponent<IconProps>;
|
34
35
|
/**
|
36
|
+
* @deprecated Use `trailingVisual` instead
|
35
37
|
* Text positioned after `Item` text and optional trailing icon.
|
36
38
|
*/
|
37
39
|
trailingText?: string;
|
40
|
+
/**
|
41
|
+
* Icon or text positioned after `Item` text.
|
42
|
+
*/
|
43
|
+
trailingVisual?: React.ReactNode;
|
38
44
|
/**
|
39
45
|
* Style variations associated with various `Item` types.
|
40
46
|
*
|
@@ -48,9 +48,9 @@ const customItemThemes = {
|
|
48
48
|
const getItemVariant = (variant = 'default', disabled) => {
|
49
49
|
if (disabled) {
|
50
50
|
return {
|
51
|
-
color: get('colors.fg.
|
52
|
-
iconColor: get('colors.fg.
|
53
|
-
annotationColor: get('colors.fg.
|
51
|
+
color: get('colors.primer.fg.disabled'),
|
52
|
+
iconColor: get('colors.primer.fg.disabled'),
|
53
|
+
annotationColor: get('colors.primer.fg.disabled'),
|
54
54
|
hoverCursor: 'default'
|
55
55
|
};
|
56
56
|
}
|
@@ -154,6 +154,7 @@ export const Item = /*#__PURE__*/React.forwardRef((itemProps, ref) => {
|
|
154
154
|
selectionVariant,
|
155
155
|
leadingVisual: LeadingVisual,
|
156
156
|
trailingIcon: TrailingIcon,
|
157
|
+
trailingVisual: TrailingVisual,
|
157
158
|
trailingText,
|
158
159
|
variant = 'default',
|
159
160
|
showDivider,
|
@@ -245,7 +246,10 @@ export const Item = /*#__PURE__*/React.forwardRef((itemProps, ref) => {
|
|
245
246
|
title: description,
|
246
247
|
inline: true,
|
247
248
|
maxWidth: "100%"
|
248
|
-
}, description)) : null),
|
249
|
+
}, description)) : null), TrailingVisual ? /*#__PURE__*/React.createElement(TrailingContent, {
|
250
|
+
variant: variant,
|
251
|
+
disabled: disabled
|
252
|
+
}, typeof TrailingVisual === 'function' ? /*#__PURE__*/React.createElement(TrailingVisual, null) : TrailingVisual) : TrailingIcon || trailingText ? /*#__PURE__*/React.createElement(TrailingContent, {
|
249
253
|
variant: variant,
|
250
254
|
disabled: disabled
|
251
255
|
}, trailingText, TrailingIcon && /*#__PURE__*/React.createElement(TrailingIcon, null)) : null));
|
package/lib-esm/Button/Button.js
CHANGED
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const Button = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "Button",
|
7
7
|
componentId: "xjtz72-0"
|
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.fg.
|
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'), buttonSystemProps, sx);
|
9
9
|
export default Button;
|
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
|
|
5
5
|
const ButtonInvisible = styled(ButtonBase).withConfig({
|
6
6
|
displayName: "ButtonInvisible",
|
7
7
|
componentId: "sc-1195tpn-0"
|
8
|
-
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}", ";", ""], get('colors.accent.fg'), get('radii.2'), get('colors.fg.
|
8
|
+
})(["color:", ";background-color:transparent;border:0;border-radius:", ";box-shadow:none;&:disabled{color:", ";}&:focus{box-shadow:", ";}&:hover{background-color:", ";}&:active{background-color:", ";}", ";", ""], get('colors.accent.fg'), get('radii.2'), get('colors.primer.fg.disabled'), get('shadows.btn.focusShadow'), get('colors.btn.hoverBg'), get('colors.btn.selectedBg'), buttonSystemProps, sx);
|
9
9
|
export default ButtonInvisible;
|
@@ -4,5 +4,5 @@ import sx from '../sx';
|
|
4
4
|
const ButtonTableList = styled.summary.withConfig({
|
5
5
|
displayName: "ButtonTableList",
|
6
6
|
componentId: "sc-1m4q8ia-0"
|
7
|
-
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:
|
7
|
+
})(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:", ";cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.muted'), get('colors.primer.fg.disabled'), get('space.1'), COMMON, TYPOGRAPHY, LAYOUT, sx);
|
8
8
|
export default ButtonTableList;
|
@@ -9,7 +9,7 @@ import { buildComponentData, buildPaginationModel } from './model';
|
|
9
9
|
const Page = styled.a.withConfig({
|
10
10
|
displayName: "Pagination__Page",
|
11
11
|
componentId: "b80nss-0"
|
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.fg.
|
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'), COMMON);
|
13
13
|
|
14
14
|
function usePaginationPages({
|
15
15
|
theme,
|
@@ -27,5 +27,5 @@ const TextInputWrapper = styled.span.withConfig({
|
|
27
27
|
} else {
|
28
28
|
return css(["padding:6px 12px;"]);
|
29
29
|
}
|
30
|
-
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.
|
30
|
+
}, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.primer.fg.disabled'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx);
|
31
31
|
export default TextInputWrapper;
|
@@ -315,18 +315,19 @@ export function SizeStressTestingStory() {
|
|
315
315
|
text: 'Block Description. Long text should wrap',
|
316
316
|
description: 'This description is long, but it is block so it wraps',
|
317
317
|
descriptionVariant: 'block',
|
318
|
-
|
318
|
+
trailingVisual: ArrowLeftIcon,
|
319
319
|
showDivider: true
|
320
320
|
}, {
|
321
321
|
leadingVisual: ArrowRightIcon,
|
322
322
|
text: 'Inline Description',
|
323
323
|
description: 'This description gets truncated because it is inline',
|
324
|
-
|
324
|
+
trailingVisual: ArrowLeftIcon,
|
325
325
|
showDivider: true
|
326
326
|
}, {
|
327
327
|
leadingVisual: ArrowRightIcon,
|
328
328
|
text: 'Really long text without a description should wrap',
|
329
329
|
trailingIcon: ArrowLeftIcon,
|
330
|
+
// backward compatible
|
330
331
|
showDivider: true
|
331
332
|
}]
|
332
333
|
})));
|
@@ -116,7 +116,7 @@ export function ExternalOpenState() {
|
|
116
116
|
}, {
|
117
117
|
text: 'Delete file',
|
118
118
|
variant: 'danger',
|
119
|
-
|
119
|
+
trailingVisual: '⌘D'
|
120
120
|
}]
|
121
121
|
})));
|
122
122
|
}
|
@@ -163,6 +163,16 @@ export function ComplexListStory() {
|
|
163
163
|
leadingVisual: VersionsIcon,
|
164
164
|
text: 'Duplicate',
|
165
165
|
groupId: '0'
|
166
|
+
}, {
|
167
|
+
leadingVisual: SearchIcon,
|
168
|
+
text: 'repo:github/github',
|
169
|
+
groupId: '1',
|
170
|
+
renderItem: props => /*#__PURE__*/React.createElement(ActionList.Item, _extends({
|
171
|
+
style: {
|
172
|
+
color: 'rebeccapurple'
|
173
|
+
}
|
174
|
+
}, props)),
|
175
|
+
trailingVisual: () => /*#__PURE__*/React.createElement(React.Fragment, null, "\u2318S", /*#__PURE__*/React.createElement(ArrowRightIcon, null))
|
166
176
|
}, {
|
167
177
|
leadingVisual: SearchIcon,
|
168
178
|
text: 'repo:github/github',
|
@@ -173,7 +183,9 @@ export function ComplexListStory() {
|
|
173
183
|
}
|
174
184
|
}, props)),
|
175
185
|
trailingText: '⌘S',
|
176
|
-
|
186
|
+
// backward compatible
|
187
|
+
trailingIcon: ArrowRightIcon // backward compatible
|
188
|
+
|
177
189
|
}, {
|
178
190
|
leadingVisual: NoteIcon,
|
179
191
|
text: 'Table',
|
@@ -52,6 +52,14 @@ export const buttonGroup = args => /*#__PURE__*/React.createElement(ButtonGroup,
|
|
52
52
|
buttonGroup.displayName = "buttonGroup";
|
53
53
|
export const buttonTableList = args => /*#__PURE__*/React.createElement(ButtonTableList, args, "Button Table List");
|
54
54
|
buttonTableList.displayName = "buttonTableList";
|
55
|
+
export const disabledButton = args => {
|
56
|
+
const props = {
|
57
|
+
disabled: true,
|
58
|
+
...args
|
59
|
+
};
|
60
|
+
return /*#__PURE__*/React.createElement(Button, props, "Disabled");
|
61
|
+
};
|
62
|
+
disabledButton.displayName = "disabledButton";
|
55
63
|
defaultButton.args = {
|
56
64
|
variant: 'medium'
|
57
65
|
};
|
package/package.json
CHANGED
package/src/ActionList/Item.tsx
CHANGED
@@ -75,15 +75,22 @@ export interface ItemProps extends SxProp {
|
|
75
75
|
leadingVisual?: React.FunctionComponent<IconProps>
|
76
76
|
|
77
77
|
/**
|
78
|
+
* @deprecated Use `trailingVisual` instead
|
78
79
|
* Icon (or similar) positioned after `Item` text.
|
79
80
|
*/
|
80
81
|
trailingIcon?: React.FunctionComponent<IconProps>
|
81
82
|
|
82
83
|
/**
|
84
|
+
* @deprecated Use `trailingVisual` instead
|
83
85
|
* Text positioned after `Item` text and optional trailing icon.
|
84
86
|
*/
|
85
87
|
trailingText?: string
|
86
88
|
|
89
|
+
/**
|
90
|
+
* Icon or text positioned after `Item` text.
|
91
|
+
*/
|
92
|
+
trailingVisual?: React.ReactNode
|
93
|
+
|
87
94
|
/**
|
88
95
|
* Style variations associated with various `Item` types.
|
89
96
|
*
|
@@ -146,9 +153,9 @@ export interface ItemProps extends SxProp {
|
|
146
153
|
const getItemVariant = (variant = 'default', disabled?: boolean) => {
|
147
154
|
if (disabled) {
|
148
155
|
return {
|
149
|
-
color: get('colors.fg.
|
150
|
-
iconColor: get('colors.fg.
|
151
|
-
annotationColor: get('colors.fg.
|
156
|
+
color: get('colors.primer.fg.disabled'),
|
157
|
+
iconColor: get('colors.primer.fg.disabled'),
|
158
|
+
annotationColor: get('colors.primer.fg.disabled'),
|
152
159
|
hoverCursor: 'default'
|
153
160
|
}
|
154
161
|
}
|
@@ -343,6 +350,7 @@ export const Item = React.forwardRef((itemProps, ref) => {
|
|
343
350
|
selectionVariant,
|
344
351
|
leadingVisual: LeadingVisual,
|
345
352
|
trailingIcon: TrailingIcon,
|
353
|
+
trailingVisual: TrailingVisual,
|
346
354
|
trailingText,
|
347
355
|
variant = 'default',
|
348
356
|
showDivider,
|
@@ -469,7 +477,12 @@ export const Item = React.forwardRef((itemProps, ref) => {
|
|
469
477
|
</DescriptionContainer>
|
470
478
|
) : null}
|
471
479
|
</MainContent>
|
472
|
-
{
|
480
|
+
{/* backward compatibility: prefer TrailingVisual but fallback to TrailingIcon */}
|
481
|
+
{TrailingVisual ? (
|
482
|
+
<TrailingContent variant={variant} disabled={disabled}>
|
483
|
+
{typeof TrailingVisual === 'function' ? <TrailingVisual /> : TrailingVisual}
|
484
|
+
</TrailingContent>
|
485
|
+
) : TrailingIcon || trailingText ? (
|
473
486
|
<TrailingContent variant={variant} disabled={disabled}>
|
474
487
|
{trailingText}
|
475
488
|
{TrailingIcon && <TrailingIcon />}
|
package/src/Button/Button.tsx
CHANGED
@@ -27,7 +27,7 @@ const Button = styled(ButtonBase)<ButtonBaseProps & ButtonSystemProps & SxProp>`
|
|
27
27
|
}
|
28
28
|
|
29
29
|
&:disabled {
|
30
|
-
color: ${get('colors.fg.
|
30
|
+
color: ${get('colors.primer.fg.disabled')};
|
31
31
|
background-color: ${get('colors.btn.bg')};
|
32
32
|
border-color: ${get('colors.btn.border')};
|
33
33
|
}
|
@@ -12,12 +12,17 @@ const ButtonInvisible = styled(ButtonBase)<ButtonBaseProps & ButtonSystemProps &
|
|
12
12
|
box-shadow: none;
|
13
13
|
|
14
14
|
&:disabled {
|
15
|
-
color: ${get('colors.fg.
|
15
|
+
color: ${get('colors.primer.fg.disabled')};
|
16
16
|
}
|
17
|
-
|
18
17
|
&:focus {
|
19
18
|
box-shadow: ${get('shadows.btn.focusShadow')};
|
20
19
|
}
|
20
|
+
&:hover {
|
21
|
+
background-color: ${get('colors.btn.hoverBg')};
|
22
|
+
}
|
23
|
+
&:active {
|
24
|
+
background-color: ${get('colors.btn.selectedBg')};
|
25
|
+
}
|
21
26
|
|
22
27
|
${buttonSystemProps};
|
23
28
|
${sx}
|
@@ -79,7 +79,7 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
|
|
79
79
|
${props =>
|
80
80
|
props.disabled &&
|
81
81
|
css`
|
82
|
-
color: ${get('colors.fg.
|
82
|
+
color: ${get('colors.primer.fg.disabled')};
|
83
83
|
background-color: ${get('colors.input.disabledBg')};
|
84
84
|
border-color: ${get('colors.border.default')};
|
85
85
|
`}
|
@@ -68,7 +68,7 @@ exports[`AnchoredOverlay renders consistently 1`] = `
|
|
68
68
|
}
|
69
69
|
|
70
70
|
.c1:disabled {
|
71
|
-
color: #
|
71
|
+
color: #8c959f;
|
72
72
|
background-color: #f6f8fa;
|
73
73
|
border-color: rgba(27,31,36,0.15);
|
74
74
|
}
|
@@ -163,7 +163,7 @@ Object {
|
|
163
163
|
}
|
164
164
|
|
165
165
|
.c1:disabled {
|
166
|
-
color: #
|
166
|
+
color: #8c959f;
|
167
167
|
background-color: #f6f8fa;
|
168
168
|
border-color: rgba(27,31,36,0.15);
|
169
169
|
}
|
@@ -243,7 +243,7 @@ Object {
|
|
243
243
|
<button
|
244
244
|
aria-haspopup="true"
|
245
245
|
aria-labelledby="react-aria-1"
|
246
|
-
class="ButtonBase-sc-181ps9o-0 Button-xjtz72-0
|
246
|
+
class="ButtonBase-sc-181ps9o-0 Button-xjtz72-0 iRqJHc"
|
247
247
|
id="react-aria-1"
|
248
248
|
tabindex="0"
|
249
249
|
>
|