@primer/components 0.0.0-2021926103714 → 0.0.0-202192613168
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 +14 -4
- package/dist/browser.esm.js +610 -610
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +176 -176
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +6 -0
- package/lib/ActionList/Item.js +5 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -8
- package/lib/sx.d.ts +0 -2
- package/lib/sx.js +0 -8
- package/lib-esm/ActionList/Item.d.ts +6 -0
- package/lib-esm/ActionList/Item.js +5 -1
- package/lib-esm/index.d.ts +0 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/sx.d.ts +0 -2
- package/lib-esm/sx.js +1 -3
- package/package.json +6 -6
- package/lib/ActionList2/Description.d.ts +0 -6
- package/lib/ActionList2/Description.js +0 -53
- package/lib/ActionList2/Divider.d.ts +0 -8
- package/lib/ActionList2/Divider.js +0 -42
- package/lib/ActionList2/Group.d.ts +0 -8
- package/lib/ActionList2/Group.js +0 -39
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -49
- package/lib/ActionList2/Item.js +0 -190
- package/lib/ActionList2/List.d.ts +0 -11
- package/lib/ActionList2/List.js +0 -53
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -67
- package/lib/ActionList2/Visuals.d.ts +0 -11
- package/lib/ActionList2/Visuals.js +0 -90
- package/lib/ActionList2/hacks.d.ts +0 -30
- package/lib/ActionList2/hacks.js +0 -38
- package/lib/ActionList2/index.d.ts +0 -26
- package/lib/ActionList2/index.js +0 -36
- package/lib/utils/create-slots.d.ts +0 -17
- package/lib/utils/create-slots.js +0 -105
- package/lib/utils/use-force-update.d.ts +0 -1
- package/lib/utils/use-force-update.js +0 -19
- package/lib-esm/ActionList2/Description.d.ts +0 -6
- package/lib-esm/ActionList2/Description.js +0 -37
- package/lib-esm/ActionList2/Divider.d.ts +0 -8
- package/lib-esm/ActionList2/Divider.js +0 -30
- package/lib-esm/ActionList2/Group.d.ts +0 -8
- package/lib-esm/ActionList2/Group.js +0 -29
- package/lib-esm/ActionList2/Header.d.ts +0 -26
- package/lib-esm/ActionList2/Header.js +0 -45
- package/lib-esm/ActionList2/Item.d.ts +0 -49
- package/lib-esm/ActionList2/Item.js +0 -183
- package/lib-esm/ActionList2/List.d.ts +0 -11
- package/lib-esm/ActionList2/List.js +0 -35
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -50
- package/lib-esm/ActionList2/Visuals.d.ts +0 -11
- package/lib-esm/ActionList2/Visuals.js +0 -68
- package/lib-esm/ActionList2/hacks.d.ts +0 -30
- package/lib-esm/ActionList2/hacks.js +0 -30
- package/lib-esm/ActionList2/index.d.ts +0 -26
- package/lib-esm/ActionList2/index.js +0 -23
- package/lib-esm/utils/create-slots.d.ts +0 -17
- package/lib-esm/utils/create-slots.js +0 -84
- package/lib-esm/utils/use-force-update.d.ts +0 -1
- package/lib-esm/utils/use-force-update.js +0 -6
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
@@ -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/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib/index.js
CHANGED
@@ -147,12 +147,6 @@ Object.defineProperty(exports, "ActionList", {
|
|
147
147
|
return _ActionList.ActionList;
|
148
148
|
}
|
149
149
|
});
|
150
|
-
Object.defineProperty(exports, "ActionList2", {
|
151
|
-
enumerable: true,
|
152
|
-
get: function () {
|
153
|
-
return _ActionList2.ActionList;
|
154
|
-
}
|
155
|
-
});
|
156
150
|
Object.defineProperty(exports, "ActionMenu", {
|
157
151
|
enumerable: true,
|
158
152
|
get: function () {
|
@@ -542,8 +536,6 @@ var _ConfirmationDialog = require("./Dialog/ConfirmationDialog");
|
|
542
536
|
|
543
537
|
var _ActionList = require("./ActionList");
|
544
538
|
|
545
|
-
var _ActionList2 = require("./ActionList2");
|
546
|
-
|
547
539
|
var _ActionMenu = require("./ActionMenu");
|
548
540
|
|
549
541
|
var _Autocomplete = _interopRequireDefault(require("./Autocomplete"));
|
package/lib/sx.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { SystemStyleObject } from '@styled-system/css';
|
2
|
-
import merge from 'deepmerge';
|
3
2
|
export interface SxProp {
|
4
3
|
sx?: SystemStyleObject;
|
5
4
|
}
|
6
5
|
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
7
6
|
export default sx;
|
8
|
-
export { merge };
|
package/lib/sx.js
CHANGED
@@ -3,18 +3,10 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
Object.defineProperty(exports, "merge", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _deepmerge.default;
|
10
|
-
}
|
11
|
-
});
|
12
6
|
exports.default = void 0;
|
13
7
|
|
14
8
|
var _css = _interopRequireDefault(require("@styled-system/css"));
|
15
9
|
|
16
|
-
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
17
|
-
|
18
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
11
|
|
20
12
|
const sx = props => (0, _css.default)(props.sx);
|
@@ -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
|
*
|
@@ -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/index.d.ts
CHANGED
@@ -22,7 +22,6 @@ export { useOnEscapePress } from './hooks/useOnEscapePress';
|
|
22
22
|
export { useOverlay } from './hooks/useOverlay';
|
23
23
|
export { useConfirm } from './Dialog/ConfirmationDialog';
|
24
24
|
export { ActionList } from './ActionList';
|
25
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
26
25
|
export { ActionMenu } from './ActionMenu';
|
27
26
|
export type { ActionMenuProps } from './ActionMenu';
|
28
27
|
export { default as Autocomplete } from './Autocomplete';
|
package/lib-esm/index.js
CHANGED
@@ -18,7 +18,6 @@ export { useOverlay } from './hooks/useOverlay';
|
|
18
18
|
export { useConfirm } from './Dialog/ConfirmationDialog'; // Components
|
19
19
|
|
20
20
|
export { ActionList } from './ActionList';
|
21
|
-
export { ActionList as ActionList2 } from './ActionList2';
|
22
21
|
export { ActionMenu } from './ActionMenu';
|
23
22
|
export { default as Autocomplete } from './Autocomplete';
|
24
23
|
export { default as Avatar } from './Avatar';
|
package/lib-esm/sx.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import { SystemStyleObject } from '@styled-system/css';
|
2
|
-
import merge from 'deepmerge';
|
3
2
|
export interface SxProp {
|
4
3
|
sx?: SystemStyleObject;
|
5
4
|
}
|
6
5
|
declare const sx: (props: SxProp) => import("@styled-system/css").CssFunctionReturnType;
|
7
6
|
export default sx;
|
8
|
-
export { merge };
|
package/lib-esm/sx.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/components",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-202192613168",
|
4
4
|
"description": "Primer react components",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib-esm/index.js",
|
@@ -76,11 +76,11 @@
|
|
76
76
|
"@rollup/plugin-commonjs": "19.0.2",
|
77
77
|
"@rollup/plugin-node-resolve": "13.0.5",
|
78
78
|
"@size-limit/preset-big-lib": "5.0.2",
|
79
|
-
"@storybook/addon-a11y": "6.3.
|
80
|
-
"@storybook/addon-actions": "^6.
|
81
|
-
"@storybook/addon-essentials": "6.
|
82
|
-
"@storybook/addon-links": "^6.
|
83
|
-
"@storybook/react": "6.3.
|
79
|
+
"@storybook/addon-a11y": "6.3.12",
|
80
|
+
"@storybook/addon-actions": "^6.3.12",
|
81
|
+
"@storybook/addon-essentials": "6.3.12",
|
82
|
+
"@storybook/addon-links": "^6.3.12",
|
83
|
+
"@storybook/react": "6.3.12",
|
84
84
|
"@testing-library/dom": "7.31.2",
|
85
85
|
"@testing-library/react": "11.2.7",
|
86
86
|
"@testing-library/react-hooks": "7.0.2",
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Description = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _sx = require("../sx");
|
13
|
-
|
14
|
-
var _Truncate = _interopRequireDefault(require("../Truncate"));
|
15
|
-
|
16
|
-
var _Item = require("./Item");
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
const Description = ({
|
21
|
-
variant = 'inline',
|
22
|
-
sx = {},
|
23
|
-
...props
|
24
|
-
}) => {
|
25
|
-
const styles = {
|
26
|
-
color: 'fg.muted',
|
27
|
-
fontSize: 0,
|
28
|
-
lineHeight: '16px',
|
29
|
-
flexGrow: 1,
|
30
|
-
flexBasis: 0,
|
31
|
-
minWidth: 0,
|
32
|
-
marginLeft: variant === 'block' ? 0 : 2
|
33
|
-
};
|
34
|
-
return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
|
35
|
-
name: variant === 'block' ? 'BlockDescription' : 'InlineDescription'
|
36
|
-
}, ({
|
37
|
-
blockDescriptionId,
|
38
|
-
inlineDescriptionId
|
39
|
-
}) => variant === 'block' ? /*#__PURE__*/_react.default.createElement(_Box.default, {
|
40
|
-
as: "span",
|
41
|
-
sx: (0, _sx.merge)(styles, sx),
|
42
|
-
id: blockDescriptionId
|
43
|
-
}, props.children) : /*#__PURE__*/_react.default.createElement(_Truncate.default, {
|
44
|
-
id: inlineDescriptionId,
|
45
|
-
sx: (0, _sx.merge)(styles, sx),
|
46
|
-
title: props.children,
|
47
|
-
inline: true,
|
48
|
-
maxWidth: "100%"
|
49
|
-
}, props.children));
|
50
|
-
};
|
51
|
-
|
52
|
-
exports.Description = Description;
|
53
|
-
Description.displayName = "Description";
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Divider = Divider;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _constants = require("../constants");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
18
|
-
*/
|
19
|
-
function Divider() {
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, {
|
21
|
-
as: "hr",
|
22
|
-
sx: {
|
23
|
-
border: 'none',
|
24
|
-
// override browser styles
|
25
|
-
height: 1,
|
26
|
-
backgroundColor: 'border.muted',
|
27
|
-
marginTop: theme => `calc(${(0, _constants.get)('space.2')(theme)} - 1px)`,
|
28
|
-
marginBottom: 2
|
29
|
-
},
|
30
|
-
"data-component": "ActionList.Divider"
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
Divider.displayName = "Divider";
|
35
|
-
|
36
|
-
/**
|
37
|
-
* `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
|
38
|
-
* so it can be used inline in an `ActionList`’s `items` prop.
|
39
|
-
* In other words, `items={[ActionList.Divider]}` is supported as a concise
|
40
|
-
* alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
|
41
|
-
*/
|
42
|
-
Divider.renderItem = Divider;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* show item dividers
|
3
|
-
*/
|
4
|
-
/// <reference types="react" />
|
5
|
-
import { SxProp } from '../sx';
|
6
|
-
import { HeaderProps } from './Header';
|
7
|
-
export declare type GroupProps = HeaderProps & SxProp;
|
8
|
-
export declare function Group({ title, variant, auxiliaryText, sx, ...props }: GroupProps): JSX.Element;
|
package/lib/ActionList2/Group.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Group = Group;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _Header = require("./Header");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
17
|
-
|
18
|
-
function Group({
|
19
|
-
title,
|
20
|
-
variant,
|
21
|
-
auxiliaryText,
|
22
|
-
sx = {},
|
23
|
-
...props
|
24
|
-
}) {
|
25
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
|
26
|
-
sx: {
|
27
|
-
'&:not(:first-child)': {
|
28
|
-
marginTop: 2
|
29
|
-
},
|
30
|
-
...sx
|
31
|
-
}
|
32
|
-
}, props), title && /*#__PURE__*/_react.default.createElement(_Header.Header, {
|
33
|
-
title: title,
|
34
|
-
variant: variant,
|
35
|
-
auxiliaryText: auxiliaryText
|
36
|
-
}), props.children);
|
37
|
-
}
|
38
|
-
|
39
|
-
Group.displayName = "Group";
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SxProp } from '../sx';
|
3
|
-
/**
|
4
|
-
* Contract for props passed to the `Header` component.
|
5
|
-
*/
|
6
|
-
export interface HeaderProps extends React.ComponentPropsWithoutRef<'div'>, SxProp {
|
7
|
-
/**
|
8
|
-
* Style variations. Usage is discretionary.
|
9
|
-
*
|
10
|
-
* - `"filled"` - Superimposed on a background, offset from nearby content
|
11
|
-
* - `"subtle"` - Relatively less offset from nearby content
|
12
|
-
*/
|
13
|
-
variant?: 'subtle' | 'filled';
|
14
|
-
/**
|
15
|
-
* Primary text which names a `Group`.
|
16
|
-
*/
|
17
|
-
title?: string;
|
18
|
-
/**
|
19
|
-
* Secondary text which provides additional information about a `Group`.
|
20
|
-
*/
|
21
|
-
auxiliaryText?: string;
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* Displays the name and description of a `Group`.
|
25
|
-
*/
|
26
|
-
export declare function Header({ variant, title, auxiliaryText, children: _children, sx, ...props }: HeaderProps): JSX.Element;
|
@@ -1,55 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.Header = Header;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _Box = _interopRequireDefault(require("../Box"));
|
11
|
-
|
12
|
-
var _List = require("./List");
|
13
|
-
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
17
|
-
|
18
|
-
/**
|
19
|
-
* Displays the name and description of a `Group`.
|
20
|
-
*/
|
21
|
-
function Header({
|
22
|
-
variant = 'subtle',
|
23
|
-
title,
|
24
|
-
auxiliaryText,
|
25
|
-
children: _children,
|
26
|
-
sx = {},
|
27
|
-
...props
|
28
|
-
}) {
|
29
|
-
const {
|
30
|
-
variant: listVariant
|
31
|
-
} = _react.default.useContext(_List.ListContext);
|
32
|
-
|
33
|
-
const styles = {
|
34
|
-
paddingY: '6px',
|
35
|
-
paddingX: listVariant === 'full' ? 2 : 3,
|
36
|
-
fontSize: 0,
|
37
|
-
fontWeight: 'bold',
|
38
|
-
color: 'fg.muted',
|
39
|
-
...(variant === 'filled' && {
|
40
|
-
backgroundColor: 'canvas.subtle',
|
41
|
-
marginX: 0,
|
42
|
-
marginBottom: 2,
|
43
|
-
borderTop: '1px solid',
|
44
|
-
borderBottom: '1px solid',
|
45
|
-
borderColor: 'neutral.muted'
|
46
|
-
}),
|
47
|
-
...sx
|
48
|
-
};
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
|
50
|
-
sx: styles,
|
51
|
-
role: "heading"
|
52
|
-
}, props), title, auxiliaryText && /*#__PURE__*/_react.default.createElement("span", null, "auxiliaryText"));
|
53
|
-
}
|
54
|
-
|
55
|
-
Header.displayName = "Header";
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* minimize number of divs
|
3
|
-
* docs
|
4
|
-
* docs for types
|
5
|
-
* test suite!
|
6
|
-
* ref unhappy with polymorphic
|
7
|
-
*
|
8
|
-
* check height with divider
|
9
|
-
* questions:
|
10
|
-
* nicer name for showDivider?
|
11
|
-
* change as= li | div based on context of menu or not?
|
12
|
-
* should selectionVariant be single by default or nothing. ask for explicit choice?
|
13
|
-
* selection api - if one item has selected, should we give all of them selected without the need to pass prop?
|
14
|
-
* move custom item themes to primitives?
|
15
|
-
* padding: 8 or 6?
|
16
|
-
* different size for icon and avatar, range?
|
17
|
-
* ActionList.Selection or ActionList.Item selected?
|
18
|
-
* aria-describedby empty value bad? also, 2 description = 2 values?
|
19
|
-
*
|
20
|
-
* activeDescendantAttribute (for actionMenu)
|
21
|
-
*/
|
22
|
-
import React from 'react';
|
23
|
-
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
|
24
|
-
import { SxProp } from '../sx';
|
25
|
-
import { AriaRole } from '../utils/types';
|
26
|
-
export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
|
27
|
-
color: string;
|
28
|
-
iconColor: string;
|
29
|
-
annotationColor: string;
|
30
|
-
};
|
31
|
-
export declare type ItemProps = {
|
32
|
-
children: React.ReactNode;
|
33
|
-
onAction?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
|
34
|
-
selected?: boolean;
|
35
|
-
variant?: 'default' | 'danger';
|
36
|
-
disabled?: boolean;
|
37
|
-
showDivider?: boolean;
|
38
|
-
role?: AriaRole;
|
39
|
-
} & SxProp;
|
40
|
-
declare const Slot: React.FC<{
|
41
|
-
name: "LeadingVisual" | "InlineDescription" | "BlockDescription" | "TrailingVisual";
|
42
|
-
children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
|
43
|
-
}>;
|
44
|
-
export { Slot };
|
45
|
-
export declare type ItemContext = Pick<ItemProps, 'variant' | 'disabled'> & {
|
46
|
-
inlineDescriptionId: string;
|
47
|
-
blockDescriptionId: string;
|
48
|
-
};
|
49
|
-
export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
|