@primer/components 0.0.0-202111245715 → 0.0.0-20211124581
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/CHANGELOG.md +7 -1
- package/dist/browser.esm.js +166 -148
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +174 -156
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList2/Divider.d.ts +3 -2
- package/lib/ActionList2/Divider.js +10 -5
- package/lib/ActionList2/Item.js +21 -5
- package/lib/ActionList2/List.js +11 -1
- package/lib/ActionList2/MenuContext.d.ts +10 -0
- package/lib/ActionList2/MenuContext.js +15 -0
- package/lib/ActionList2/Selection.js +11 -0
- package/lib/ActionList2/index.d.ts +1 -2
- package/lib/ActionMenu2.d.ts +310 -0
- package/lib/ActionMenu2.js +91 -0
- package/lib/Autocomplete/Autocomplete.d.ts +10 -2
- package/lib/Autocomplete/AutocompleteInput.d.ts +10 -2
- package/lib/Checkbox.d.ts +1 -1
- package/lib/NewButton/button.d.ts +11 -2
- package/lib/NewButton/button.js +283 -6
- package/lib/NewButton/index.d.ts +11 -6
- package/lib/NewButton/index.js +0 -18
- package/lib/NewButton/types.d.ts +8 -28
- package/lib/NewButton/types.js +1 -19
- package/lib/SelectMenu/SelectMenu.d.ts +10 -2
- package/lib/TextInput.d.ts +8 -1
- package/lib/TextInput.js +16 -5
- package/lib/TextInputWithTokens.d.ts +10 -2
- package/lib/_TextInputWrapper.d.ts +3 -0
- package/lib/_TextInputWrapper.js +18 -7
- package/lib/drafts.d.ts +1 -0
- package/lib/drafts.js +13 -0
- package/lib-esm/ActionList2/Divider.d.ts +3 -2
- package/lib-esm/ActionList2/Divider.js +8 -5
- package/lib-esm/ActionList2/Item.js +19 -5
- package/lib-esm/ActionList2/List.js +9 -1
- package/lib-esm/ActionList2/MenuContext.d.ts +10 -0
- package/lib-esm/ActionList2/MenuContext.js +3 -0
- package/lib-esm/ActionList2/Selection.js +9 -0
- package/lib-esm/ActionList2/index.d.ts +1 -2
- package/lib-esm/ActionMenu2.d.ts +310 -0
- package/lib-esm/ActionMenu2.js +67 -0
- package/lib-esm/Autocomplete/Autocomplete.d.ts +10 -2
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +10 -2
- package/lib-esm/Checkbox.d.ts +1 -1
- package/lib-esm/NewButton/button.d.ts +11 -2
- package/lib-esm/NewButton/button.js +275 -4
- package/lib-esm/NewButton/index.d.ts +11 -6
- package/lib-esm/NewButton/index.js +1 -4
- package/lib-esm/NewButton/types.d.ts +8 -28
- package/lib-esm/NewButton/types.js +1 -6
- package/lib-esm/SelectMenu/SelectMenu.d.ts +10 -2
- package/lib-esm/TextInput.d.ts +8 -1
- package/lib-esm/TextInput.js +16 -5
- package/lib-esm/TextInputWithTokens.d.ts +10 -2
- package/lib-esm/_TextInputWrapper.d.ts +3 -0
- package/lib-esm/_TextInputWrapper.js +18 -7
- package/lib-esm/drafts.d.ts +1 -0
- package/lib-esm/drafts.js +2 -1
- package/package.json +1 -1
- package/lib/NewButton/button-base.d.ts +0 -6
- package/lib/NewButton/button-base.js +0 -69
- package/lib/NewButton/button-link.d.ts +0 -26
- package/lib/NewButton/button-link.js +0 -31
- package/lib/NewButton/icon-button.d.ts +0 -4
- package/lib/NewButton/icon-button.js +0 -57
- package/lib/NewButton/styles.d.ts +0 -202
- package/lib/NewButton/styles.js +0 -248
- package/lib-esm/NewButton/button-base.d.ts +0 -6
- package/lib-esm/NewButton/button-base.js +0 -47
- package/lib-esm/NewButton/button-link.d.ts +0 -26
- package/lib-esm/NewButton/button-link.js +0 -15
- package/lib-esm/NewButton/icon-button.d.ts +0 -4
- package/lib-esm/NewButton/icon-button.js +0 -35
- package/lib-esm/NewButton/styles.d.ts +0 -202
- package/lib-esm/NewButton/styles.js +0 -229
@@ -44,11 +44,17 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
44
44
|
} & {
|
45
45
|
as?: string | React.ComponentType<any> | undefined;
|
46
46
|
forwardedAs?: string | React.ComponentType<any> | undefined;
|
47
|
-
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "
|
47
|
+
}, string | number | symbol>, "maxWidth" | "minWidth" | "width" | "size" | "block" | "icon" | "variant" | "sx" | "className" | "disabled" | "leadingVisual" | "trailingVisual" | "contrast"> & {
|
48
48
|
className?: string | undefined;
|
49
49
|
icon?: React.ComponentType<{
|
50
50
|
className?: string | undefined;
|
51
51
|
}> | undefined;
|
52
|
+
leadingVisual?: string | React.ComponentType<{
|
53
|
+
className?: string | undefined;
|
54
|
+
}> | undefined;
|
55
|
+
trailingVisual?: string | React.ComponentType<{
|
56
|
+
className?: string | undefined;
|
57
|
+
}> | undefined;
|
52
58
|
} & Pick<{
|
53
59
|
color?: string | undefined;
|
54
60
|
maxWidth?: import("styled-system").ResponsiveValue<import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
@@ -61,6 +67,7 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
61
67
|
slot?: string | undefined;
|
62
68
|
style?: React.CSSProperties | undefined;
|
63
69
|
title?: string | undefined;
|
70
|
+
size?: "small" | "large" | undefined;
|
64
71
|
block?: boolean | undefined;
|
65
72
|
variant?: "small" | "large" | undefined;
|
66
73
|
role?: React.AriaRole | undefined;
|
@@ -318,9 +325,10 @@ declare const TextInputWithTokens: React.ForwardRefExoticComponent<Pick<{
|
|
318
325
|
disabled?: boolean | undefined;
|
319
326
|
hasIcon?: boolean | undefined;
|
320
327
|
contrast?: boolean | undefined;
|
328
|
+
validationStatus?: "error" | "warning" | undefined;
|
321
329
|
} & {
|
322
330
|
theme?: any;
|
323
|
-
}, "maxWidth" | "minWidth" | "width" | "
|
331
|
+
}, "maxWidth" | "minWidth" | "width" | "size" | "block" | "variant" | "sx" | "disabled" | "contrast">, string | number | symbol> & React.RefAttributes<HTMLInputElement> & {
|
324
332
|
selectedTokenIndex: number | undefined;
|
325
333
|
setSelectedTokenIndex: React.Dispatch<React.SetStateAction<number | undefined>>;
|
326
334
|
}, string | number | symbol> & React.RefAttributes<HTMLInputElement>>;
|
@@ -5,6 +5,9 @@ declare const TextInputWrapper: import("styled-components").StyledComponent<"spa
|
|
5
5
|
hasIcon?: boolean | undefined;
|
6
6
|
block?: boolean | undefined;
|
7
7
|
contrast?: boolean | undefined;
|
8
|
+
validationStatus?: "error" | "warning" | undefined;
|
9
|
+
/** @deprecated Use `size` prop instead */
|
8
10
|
variant?: "small" | "large" | undefined;
|
11
|
+
size?: "small" | "large" | undefined;
|
9
12
|
} & WidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Width<import("styled-system").TLengthStyledSystem>> & MinWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MinWidth<import("styled-system").TLengthStyledSystem>> & MaxWidthProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxWidth<import("styled-system").TLengthStyledSystem>> & SxProp, never>;
|
10
13
|
export default TextInputWrapper;
|
package/lib/_TextInputWrapper.js
CHANGED
@@ -19,7 +19,24 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
19
19
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21
21
|
|
22
|
+
const sizeDeprecatedVariants = (0, _styledSystem.variant)({
|
23
|
+
variants: {
|
24
|
+
small: {
|
25
|
+
minHeight: '28px',
|
26
|
+
px: 2,
|
27
|
+
py: '3px',
|
28
|
+
fontSize: 0,
|
29
|
+
lineHeight: '20px'
|
30
|
+
},
|
31
|
+
large: {
|
32
|
+
px: 2,
|
33
|
+
py: '10px',
|
34
|
+
fontSize: 3
|
35
|
+
}
|
36
|
+
}
|
37
|
+
});
|
22
38
|
const sizeVariants = (0, _styledSystem.variant)({
|
39
|
+
prop: 'size',
|
23
40
|
variants: {
|
24
41
|
small: {
|
25
42
|
minHeight: '28px',
|
@@ -39,13 +56,7 @@ const sizeVariants = (0, _styledSystem.variant)({
|
|
39
56
|
const TextInputWrapper = _styledComponents.default.span.withConfig({
|
40
57
|
displayName: "_TextInputWrapper__TextInputWrapper",
|
41
58
|
componentId: "sc-5vfcis-0"
|
42
|
-
})(["
|
43
|
-
if (props.hasIcon) {
|
44
|
-
return (0, _styledComponents.css)(["padding:0;"]);
|
45
|
-
} else {
|
46
|
-
return (0, _styledComponents.css)(["padding:6px 12px;"]);
|
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.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%;"]), props => props.block && props.hasIcon && (0, _styledComponents.css)(["display:flex;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeVariants, _sx.default);
|
59
|
+
})(["width:max-content;min-height:34px;font-size:", ";line-height:20px;color:", ";vertical-align:middle;background-color:", ";background-repeat:no-repeat;background-position:right 8px center;border:1px solid ", ";border-radius:", ";outline:none;box-shadow:", ";cursor:text;padding:6px 12px;display:grid;grid-template-columns:auto 1fr auto;justify-items:end;& >:not(:last-child){margin-right:", ";}[data-component=' leadingVisual ']{align-self:center;color:", ";}[data-component=' trailingVisual ']{align-self:center;color:", ";}.TextInput-icon{align-self:center;color:", ";margin:0 ", ";flex-shrink:0;}&:focus-within{border-color:", ";box-shadow:", ";}", " ", " ", " ", " ", " @media (min-width:", "){font-size:", ";}", " ", " ", " ", " ", " ", ";"], (0, _constants.get)('fontSizes.1'), (0, _constants.get)('colors.fg.default'), (0, _constants.get)('colors.canvas.default'), (0, _constants.get)('colors.border.default'), (0, _constants.get)('radii.2'), (0, _constants.get)('shadows.primer.shadow.inset'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.fg.muted'), (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.validationStatus === 'error' && (0, _styledComponents.css)(["border-color:", ";&:focus-within{border-color:", ";box-shadow:", ";}"], (0, _constants.get)('colors.danger.emphasis'), (0, _constants.get)('colors.danger.emphasis'), (0, _constants.get)('shadows.btn.danger.focusShadow')), props => props.validationStatus === 'warning' && (0, _styledComponents.css)(["border-color:", ";&:focus-within{border-color:", ";box-shadow:0 0 0 3px ", ";}"], (0, _constants.get)('colors.attention.emphasis'), (0, _constants.get)('colors.attention.emphasis'), (0, _constants.get)('colors.attention.muted')), props => props.block && (0, _styledComponents.css)(["width:100%;"]), (0, _constants.get)('breakpoints.1'), (0, _constants.get)('fontSizes.1'), _styledSystem.width, _styledSystem.minWidth, _styledSystem.maxWidth, sizeDeprecatedVariants, sizeVariants, _sx.default);
|
49
60
|
|
50
61
|
var _default = TextInputWrapper;
|
51
62
|
exports.default = _default;
|
package/lib/drafts.d.ts
CHANGED
package/lib/drafts.js
CHANGED
@@ -28,4 +28,17 @@ Object.keys(_NewButton).forEach(function (key) {
|
|
28
28
|
return _NewButton[key];
|
29
29
|
}
|
30
30
|
});
|
31
|
+
});
|
32
|
+
|
33
|
+
var _ActionMenu = require("./ActionMenu2");
|
34
|
+
|
35
|
+
Object.keys(_ActionMenu).forEach(function (key) {
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
37
|
+
if (key in exports && exports[key] === _ActionMenu[key]) return;
|
38
|
+
Object.defineProperty(exports, key, {
|
39
|
+
enumerable: true,
|
40
|
+
get: function () {
|
41
|
+
return _ActionMenu[key];
|
42
|
+
}
|
43
|
+
});
|
31
44
|
});
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
|
+
import { SxProp } from '../sx';
|
2
3
|
/**
|
3
4
|
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
4
5
|
*/
|
5
|
-
export declare
|
6
|
+
export declare const Divider: React.FC<SxProp>;
|
@@ -1,23 +1,26 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import Box from '../Box';
|
3
3
|
import { get } from '../constants';
|
4
|
-
|
4
|
+
import { merge } from '../sx';
|
5
5
|
/**
|
6
6
|
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
7
7
|
*/
|
8
|
-
|
8
|
+
|
9
|
+
export const Divider = ({
|
10
|
+
sx = {}
|
11
|
+
}) => {
|
9
12
|
return /*#__PURE__*/React.createElement(Box, {
|
10
13
|
as: "li",
|
11
14
|
role: "separator",
|
12
|
-
sx: {
|
15
|
+
sx: merge({
|
13
16
|
height: 1,
|
14
17
|
backgroundColor: 'actionListItem.inlineDivider',
|
15
18
|
marginTop: theme => `calc(${get('space.2')(theme)} - 1px)`,
|
16
19
|
marginBottom: 2,
|
17
20
|
listStyle: 'none' // hide the ::marker inserted by browser's stylesheet
|
18
21
|
|
19
|
-
},
|
22
|
+
}, sx),
|
20
23
|
"data-component": "ActionList.Divider"
|
21
24
|
});
|
22
|
-
}
|
25
|
+
};
|
23
26
|
Divider.displayName = "Divider";
|
@@ -8,6 +8,7 @@ import Box from '../Box';
|
|
8
8
|
import sx, { merge } from '../sx';
|
9
9
|
import createSlots from '../utils/create-slots';
|
10
10
|
import { ListContext } from './List';
|
11
|
+
import { MenuContext } from './MenuContext';
|
11
12
|
import { Selection } from './Selection';
|
12
13
|
export const getVariantStyles = (variant, disabled) => {
|
13
14
|
if (disabled) {
|
@@ -54,6 +55,7 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
54
55
|
onSelect,
|
55
56
|
sx: sxProp = {},
|
56
57
|
id,
|
58
|
+
role,
|
57
59
|
_PrivateItemWrapper,
|
58
60
|
...props
|
59
61
|
}, forwardedRef) => {
|
@@ -61,6 +63,10 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
61
63
|
variant: listVariant,
|
62
64
|
showDividers
|
63
65
|
} = React.useContext(ListContext);
|
66
|
+
const {
|
67
|
+
itemRole,
|
68
|
+
afterSelect
|
69
|
+
} = React.useContext(MenuContext);
|
64
70
|
const {
|
65
71
|
theme
|
66
72
|
} = useTheme();
|
@@ -135,16 +141,23 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
135
141
|
const clickHandler = React.useCallback(event => {
|
136
142
|
if (typeof onSelect !== 'function') return;
|
137
143
|
if (disabled) return;
|
138
|
-
|
139
|
-
|
144
|
+
|
145
|
+
if (!event.defaultPrevented) {
|
146
|
+
onSelect(event); // if this Item is inside a Menu, close the Menu
|
147
|
+
|
148
|
+
if (typeof afterSelect === 'function') afterSelect();
|
149
|
+
}
|
150
|
+
}, [onSelect, disabled, afterSelect]);
|
140
151
|
const keyPressHandler = React.useCallback(event => {
|
141
152
|
if (typeof onSelect !== 'function') return;
|
142
153
|
if (disabled) return;
|
143
154
|
|
144
155
|
if (!event.defaultPrevented && [' ', 'Enter'].includes(event.key)) {
|
145
|
-
onSelect(event);
|
156
|
+
onSelect(event); // if this Item is inside a Menu, close the Menu
|
157
|
+
|
158
|
+
if (typeof afterSelect === 'function') afterSelect();
|
146
159
|
}
|
147
|
-
}, [onSelect, disabled]); // use props.id if provided, otherwise generate one.
|
160
|
+
}, [onSelect, disabled, afterSelect]); // use props.id if provided, otherwise generate one.
|
148
161
|
|
149
162
|
const labelId = useSSRSafeId(id);
|
150
163
|
const inlineDescriptionId = useSSRSafeId(id && `${id}--inline-description`);
|
@@ -166,7 +179,8 @@ export const Item = /*#__PURE__*/React.forwardRef(({
|
|
166
179
|
"aria-disabled": disabled ? true : undefined,
|
167
180
|
tabIndex: disabled || _PrivateItemWrapper ? undefined : 0,
|
168
181
|
"aria-labelledby": `${labelId} ${slots.InlineDescription ? inlineDescriptionId : ''}`,
|
169
|
-
"aria-describedby": slots.BlockDescription ? blockDescriptionId : undefined
|
182
|
+
"aria-describedby": slots.BlockDescription ? blockDescriptionId : undefined,
|
183
|
+
role: role || itemRole
|
170
184
|
}, props), /*#__PURE__*/React.createElement(ItemWrapper, null, /*#__PURE__*/React.createElement(Selection, {
|
171
185
|
selected: selected
|
172
186
|
}), slots.LeadingVisual, /*#__PURE__*/React.createElement(Box, {
|
@@ -3,6 +3,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
3
3
|
import React from 'react';
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import sx, { merge } from '../sx';
|
6
|
+
import { MenuContext } from './MenuContext';
|
6
7
|
export const ListContext = /*#__PURE__*/React.createContext({});
|
7
8
|
const ListBox = styled.ul.withConfig({
|
8
9
|
displayName: "List__ListBox",
|
@@ -12,6 +13,7 @@ export const List = /*#__PURE__*/React.forwardRef(({
|
|
12
13
|
variant = 'inset',
|
13
14
|
selectionVariant,
|
14
15
|
showDividers = false,
|
16
|
+
role,
|
15
17
|
sx: sxProp = {},
|
16
18
|
...props
|
17
19
|
}, forwardedRef) => {
|
@@ -21,8 +23,14 @@ export const List = /*#__PURE__*/React.forwardRef(({
|
|
21
23
|
// reset ul styles
|
22
24
|
paddingY: variant === 'inset' ? 2 : 0
|
23
25
|
};
|
26
|
+
/** if list is inside a Menu, it will get a role from the Menu */
|
27
|
+
|
28
|
+
const {
|
29
|
+
listRole
|
30
|
+
} = React.useContext(MenuContext);
|
24
31
|
return /*#__PURE__*/React.createElement(ListBox, _extends({
|
25
|
-
sx: merge(styles, sxProp)
|
32
|
+
sx: merge(styles, sxProp),
|
33
|
+
role: role || listRole
|
26
34
|
}, props, {
|
27
35
|
ref: forwardedRef
|
28
36
|
}), /*#__PURE__*/React.createElement(ListContext.Provider, {
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/** This context can be used by components that compose ActionList inside a Menu */
|
2
|
+
import React from 'react';
|
3
|
+
declare type ContextProps = {
|
4
|
+
parent?: string;
|
5
|
+
listRole?: string;
|
6
|
+
itemRole?: string;
|
7
|
+
afterSelect?: () => void;
|
8
|
+
};
|
9
|
+
export declare const MenuContext: React.Context<ContextProps>;
|
10
|
+
export {};
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { CheckIcon } from '@primer/octicons-react';
|
3
3
|
import { ListContext } from './List';
|
4
4
|
import { GroupContext } from './Group';
|
5
|
+
import { MenuContext } from './MenuContext';
|
5
6
|
import { LeadingVisualContainer } from './Visuals';
|
6
7
|
export const Selection = ({
|
7
8
|
selected
|
@@ -12,6 +13,9 @@ export const Selection = ({
|
|
12
13
|
const {
|
13
14
|
selectionVariant: groupSelectionVariant
|
14
15
|
} = React.useContext(GroupContext);
|
16
|
+
const {
|
17
|
+
parent
|
18
|
+
} = React.useContext(MenuContext);
|
15
19
|
/** selectionVariant in Group can override the selectionVariant in List root */
|
16
20
|
|
17
21
|
const selectionVariant = typeof groupSelectionVariant !== 'undefined' ? groupSelectionVariant : listSelectionVariant; // if selectionVariant is not set on List, don't show selection
|
@@ -22,6 +26,11 @@ export const Selection = ({
|
|
22
26
|
return null;
|
23
27
|
}
|
24
28
|
|
29
|
+
if (parent === 'ActionMenu') {
|
30
|
+
throw new Error('ActionList cannot have a selectionVariant inside ActionMenu, please use DropdownMenu or SelectPanel instead. More information: https://primer.style/design/components/action-list#application');
|
31
|
+
return null;
|
32
|
+
}
|
33
|
+
|
25
34
|
if (selectionVariant === 'single') {
|
26
35
|
return /*#__PURE__*/React.createElement(LeadingVisualContainer, null, selected && /*#__PURE__*/React.createElement(CheckIcon, null));
|
27
36
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import { Divider } from './Divider';
|
3
2
|
export type { ListProps as ActionListProps } from './List';
|
4
3
|
export type { GroupProps } from './Group';
|
5
4
|
export type { ItemProps } from './Item';
|
@@ -26,7 +25,7 @@ export declare const ActionList: import("@radix-ui/react-polymorphic").ForwardRe
|
|
26
25
|
referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
|
27
26
|
}>;
|
28
27
|
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
29
|
-
Divider:
|
28
|
+
Divider: import("react").FC<import("../sx").SxProp>;
|
30
29
|
/** Secondary text which provides additional information about an `Item`. */
|
31
30
|
Description: import("react").FC<import("./Description").DescriptionProps>;
|
32
31
|
/** Icon (or similar) positioned before `Item` text. */
|