@primer/components 0.0.0-2021928161034 → 0.0.0-2021928193630
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 +2 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js.map +1 -1
- package/lib/Autocomplete/Autocomplete.d.ts +6 -6
- package/lib/Autocomplete/AutocompleteInput.d.ts +6 -6
- package/lib/Button/Button.d.ts +5 -5
- package/lib/Button/ButtonBase.d.ts +1 -1
- package/lib/Button/ButtonClose.d.ts +23 -23
- package/lib/Button/ButtonDanger.d.ts +5 -5
- package/lib/Button/ButtonInvisible.d.ts +5 -5
- package/lib/Button/ButtonOutline.d.ts +5 -5
- package/lib/Button/ButtonPrimary.d.ts +5 -5
- package/lib/CircleBadge.d.ts +2 -2
- package/lib/CircleOcticon.d.ts +22 -22
- package/lib/Dialog.d.ts +24 -24
- package/lib/Dropdown.d.ts +88 -88
- package/lib/DropdownMenu/DropdownButton.d.ts +24 -24
- package/lib/FilterList.d.ts +21 -21
- package/lib/Flash.d.ts +1 -1
- package/lib/Label.d.ts +1 -1
- package/lib/Position.d.ts +4 -4
- package/lib/ProgressBar.d.ts +1 -1
- package/lib/SelectMenu/SelectMenu.d.ts +117 -117
- package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib/TextInputWithTokens.d.ts +6 -6
- package/lib/Timeline.d.ts +22 -22
- package/lib/Token/AvatarToken.d.ts +1 -1
- package/lib/Token/IssueLabelToken.d.ts +1 -1
- package/lib/Token/Token.d.ts +1 -1
- package/lib/_TextInputWrapper.d.ts +1 -1
- package/lib/sx.d.ts +8 -4
- package/lib/sx.js +0 -8
- package/lib/theme.d.ts +78 -0
- package/lib/theme.js +3 -1
- package/lib/utils/types/KeyPaths.d.ts +3 -0
- package/lib/utils/types/KeyPaths.js +1 -0
- package/lib-esm/Autocomplete/Autocomplete.d.ts +6 -6
- package/lib-esm/Autocomplete/AutocompleteInput.d.ts +6 -6
- package/lib-esm/Button/Button.d.ts +5 -5
- package/lib-esm/Button/ButtonBase.d.ts +1 -1
- package/lib-esm/Button/ButtonClose.d.ts +23 -23
- package/lib-esm/Button/ButtonDanger.d.ts +5 -5
- package/lib-esm/Button/ButtonInvisible.d.ts +5 -5
- package/lib-esm/Button/ButtonOutline.d.ts +5 -5
- package/lib-esm/Button/ButtonPrimary.d.ts +5 -5
- package/lib-esm/CircleBadge.d.ts +2 -2
- package/lib-esm/CircleOcticon.d.ts +22 -22
- package/lib-esm/Dialog.d.ts +24 -24
- package/lib-esm/Dropdown.d.ts +88 -88
- package/lib-esm/DropdownMenu/DropdownButton.d.ts +24 -24
- package/lib-esm/FilterList.d.ts +21 -21
- package/lib-esm/Flash.d.ts +1 -1
- package/lib-esm/Label.d.ts +1 -1
- package/lib-esm/Position.d.ts +4 -4
- package/lib-esm/ProgressBar.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenu.d.ts +117 -117
- package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
- package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
- package/lib-esm/TextInputWithTokens.d.ts +6 -6
- package/lib-esm/Timeline.d.ts +22 -22
- package/lib-esm/Token/AvatarToken.d.ts +1 -1
- package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
- package/lib-esm/Token/Token.d.ts +1 -1
- package/lib-esm/_TextInputWrapper.d.ts +1 -1
- package/lib-esm/sx.d.ts +8 -4
- package/lib-esm/sx.js +1 -3
- package/lib-esm/theme.d.ts +78 -0
- package/lib-esm/theme.js +2 -1
- package/lib-esm/utils/types/KeyPaths.d.ts +3 -0
- package/lib-esm/utils/types/KeyPaths.js +1 -0
- package/package.json +1 -1
- package/lib/ActionList2/Description.d.ts +0 -6
- package/lib/ActionList2/Description.js +0 -53
- package/lib/ActionList2/Divider.d.ts +0 -5
- package/lib/ActionList2/Divider.js +0 -33
- package/lib/ActionList2/Group.d.ts +0 -5
- package/lib/ActionList2/Group.js +0 -46
- package/lib/ActionList2/Header.d.ts +0 -26
- package/lib/ActionList2/Header.js +0 -55
- package/lib/ActionList2/Item.d.ts +0 -48
- package/lib/ActionList2/Item.js +0 -204
- package/lib/ActionList2/List.d.ts +0 -26
- package/lib/ActionList2/List.js +0 -56
- package/lib/ActionList2/Selection.d.ts +0 -5
- package/lib/ActionList2/Selection.js +0 -64
- 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 -28
- package/lib/ActionList2/index.js +0 -42
- package/lib/experiments.d.ts +0 -1
- package/lib/experiments.js +0 -13
- 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 -5
- package/lib-esm/ActionList2/Divider.js +0 -21
- package/lib-esm/ActionList2/Group.d.ts +0 -5
- package/lib-esm/ActionList2/Group.js +0 -32
- 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 -48
- package/lib-esm/ActionList2/Item.js +0 -176
- package/lib-esm/ActionList2/List.d.ts +0 -26
- package/lib-esm/ActionList2/List.js +0 -38
- package/lib-esm/ActionList2/Selection.d.ts +0 -5
- package/lib-esm/ActionList2/Selection.js +0 -48
- 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 -28
- package/lib-esm/ActionList2/index.js +0 -29
- package/lib-esm/experiments.d.ts +0 -1
- package/lib-esm/experiments.js +0 -2
- 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
@@ -1,30 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* These colors are not yet in our default theme.
|
3
|
-
* TODO: Need to remove this once they are added.
|
4
|
-
*/
|
5
|
-
export declare const customItemThemes: {
|
6
|
-
default: {
|
7
|
-
hover: {
|
8
|
-
light: string;
|
9
|
-
dark: string;
|
10
|
-
dark_dimmed: string;
|
11
|
-
};
|
12
|
-
focus: {
|
13
|
-
light: string;
|
14
|
-
dark: string;
|
15
|
-
dark_dimmed: string;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
danger: {
|
19
|
-
hover: {
|
20
|
-
light: string;
|
21
|
-
dark: string;
|
22
|
-
dark_dimmed: string;
|
23
|
-
};
|
24
|
-
focus: {
|
25
|
-
light: string;
|
26
|
-
dark: string;
|
27
|
-
dark_dimmed: string;
|
28
|
-
};
|
29
|
-
};
|
30
|
-
};
|
package/lib/ActionList2/hacks.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.customItemThemes = void 0;
|
7
|
-
|
8
|
-
/**
|
9
|
-
* These colors are not yet in our default theme.
|
10
|
-
* TODO: Need to remove this once they are added.
|
11
|
-
*/
|
12
|
-
const customItemThemes = {
|
13
|
-
default: {
|
14
|
-
hover: {
|
15
|
-
light: 'rgba(46, 77, 108, 0.06)',
|
16
|
-
dark: 'rgba(201, 206, 212, 0.12)',
|
17
|
-
dark_dimmed: 'rgba(201, 206, 212, 0.12)'
|
18
|
-
},
|
19
|
-
focus: {
|
20
|
-
light: 'rgba(54, 77, 100, 0.16)',
|
21
|
-
dark: 'rgba(201, 206, 212, 0.24)',
|
22
|
-
dark_dimmed: 'rgba(201, 206, 212, 0.24)'
|
23
|
-
}
|
24
|
-
},
|
25
|
-
danger: {
|
26
|
-
hover: {
|
27
|
-
light: 'rgba(234, 74, 90, 0.08)',
|
28
|
-
dark: 'rgba(248, 81, 73, 0.16)',
|
29
|
-
dark_dimmed: 'rgba(248, 81, 73, 0.16)'
|
30
|
-
},
|
31
|
-
focus: {
|
32
|
-
light: 'rgba(234, 74, 90, 0.14)',
|
33
|
-
dark: 'rgba(248, 81, 73, 0.24)',
|
34
|
-
dark_dimmed: 'rgba(248, 81, 73, 0.24)'
|
35
|
-
}
|
36
|
-
}
|
37
|
-
};
|
38
|
-
exports.customItemThemes = customItemThemes;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
import { Divider } from './Divider';
|
3
|
-
export type { ListProps as ActionListProps } from './List';
|
4
|
-
export type { GroupProps } from './Group';
|
5
|
-
export type { ItemProps } from './Item';
|
6
|
-
export type { DescriptionProps } from './Description';
|
7
|
-
export type { LeadingVisualProps, TrailingVisualProps } from './Visuals';
|
8
|
-
/**
|
9
|
-
* Collection of list-related components.
|
10
|
-
*/
|
11
|
-
export declare const ActionList: import("@radix-ui/react-polymorphic").ForwardRefComponent<"ul", import("./List").ListProps> & {
|
12
|
-
/** Collects related `Items` in an `ActionList`. */
|
13
|
-
Group: import("react").FC<import("./Group").GroupProps>;
|
14
|
-
/** An actionable or selectable `Item` */
|
15
|
-
Item: import("@radix-ui/react-polymorphic").ForwardRefComponent<"li", import("./Item").ItemProps>;
|
16
|
-
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
17
|
-
Divider: typeof Divider;
|
18
|
-
/** Secondary text which provides additional information about an `Item`. */
|
19
|
-
Description: import("react").FC<import("./Description").DescriptionProps>;
|
20
|
-
/** Icon (or similar) positioned before `Item` text. */
|
21
|
-
LeadingVisual: import("react").FC<import("../sx").SxProp & {
|
22
|
-
children: import("react").ReactNode;
|
23
|
-
}>;
|
24
|
-
/** Icon (or similar) positioned after `Item` text. */
|
25
|
-
TrailingVisual: import("react").FC<import("../sx").SxProp & {
|
26
|
-
children: import("react").ReactNode;
|
27
|
-
}>;
|
28
|
-
};
|
package/lib/ActionList2/index.js
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.ActionList = void 0;
|
7
|
-
|
8
|
-
var _List = require("./List");
|
9
|
-
|
10
|
-
var _Group = require("./Group");
|
11
|
-
|
12
|
-
var _Item = require("./Item");
|
13
|
-
|
14
|
-
var _Divider = require("./Divider");
|
15
|
-
|
16
|
-
var _Description = require("./Description");
|
17
|
-
|
18
|
-
var _Visuals = require("./Visuals");
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Collection of list-related components.
|
22
|
-
*/
|
23
|
-
const ActionList = Object.assign(_List.List, {
|
24
|
-
/** Collects related `Items` in an `ActionList`. */
|
25
|
-
Group: _Group.Group,
|
26
|
-
|
27
|
-
/** An actionable or selectable `Item` */
|
28
|
-
Item: _Item.Item,
|
29
|
-
|
30
|
-
/** Visually separates `Item`s or `Group`s in an `ActionList`. */
|
31
|
-
Divider: _Divider.Divider,
|
32
|
-
|
33
|
-
/** Secondary text which provides additional information about an `Item`. */
|
34
|
-
Description: _Description.Description,
|
35
|
-
|
36
|
-
/** Icon (or similar) positioned before `Item` text. */
|
37
|
-
LeadingVisual: _Visuals.LeadingVisual,
|
38
|
-
|
39
|
-
/** Icon (or similar) positioned after `Item` text. */
|
40
|
-
TrailingVisual: _Visuals.TrailingVisual
|
41
|
-
});
|
42
|
-
exports.ActionList = ActionList;
|
package/lib/experiments.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { ActionList } from './ActionList2';
|
package/lib/experiments.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "ActionList", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function () {
|
9
|
-
return _ActionList.ActionList;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
|
13
|
-
var _ActionList = require("./ActionList2");
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
/** createSlots is a factory that can create a
|
3
|
-
* typesafe Slots + Slot pair to use in a component definition
|
4
|
-
* For example: ActionList.Item uses createSlots to get a Slots wrapper
|
5
|
-
* + Slot component that is used by LeadingVisual, Description
|
6
|
-
*/
|
7
|
-
declare const createSlots: <SlotNames extends string>(slotNames: SlotNames[]) => {
|
8
|
-
Slots: React.FC<{
|
9
|
-
context: Record<string, unknown>;
|
10
|
-
children: (slots: { [key in SlotNames]?: React.ReactNode; }) => React.ReactNode;
|
11
|
-
}>;
|
12
|
-
Slot: React.FC<{
|
13
|
-
name: SlotNames;
|
14
|
-
children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
|
15
|
-
}>;
|
16
|
-
};
|
17
|
-
export default createSlots;
|
@@ -1,105 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
var _useForceUpdate = require("./use-force-update");
|
11
|
-
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
-
|
14
|
-
/** createSlots is a factory that can create a
|
15
|
-
* typesafe Slots + Slot pair to use in a component definition
|
16
|
-
* For example: ActionList.Item uses createSlots to get a Slots wrapper
|
17
|
-
* + Slot component that is used by LeadingVisual, Description
|
18
|
-
*/
|
19
|
-
const createSlots = slotNames => {
|
20
|
-
const SlotsContext = /*#__PURE__*/_react.default.createContext({
|
21
|
-
registerSlot: () => null,
|
22
|
-
unregisterSlot: () => null,
|
23
|
-
context: {}
|
24
|
-
});
|
25
|
-
/** Slots uses a Double render strategy inspired by [reach-ui/descendants](https://github.com/reach/reach-ui/tree/develop/packages/descendants)
|
26
|
-
* Slot registers themself with the Slots parent.
|
27
|
-
* When all the children have mounted = registered themselves in slot,
|
28
|
-
* we re-render the parent component to render with slots
|
29
|
-
*/
|
30
|
-
|
31
|
-
|
32
|
-
const Slots = ({
|
33
|
-
context,
|
34
|
-
children
|
35
|
-
}) => {
|
36
|
-
// initialise slots
|
37
|
-
const slotsDefinition = {};
|
38
|
-
slotNames.map(name => slotsDefinition[name] = null);
|
39
|
-
|
40
|
-
const slotsRef = _react.default.useRef(slotsDefinition);
|
41
|
-
|
42
|
-
const rerenderWithSlots = (0, _useForceUpdate.useForceUpdate)();
|
43
|
-
|
44
|
-
const [isMounted, setIsMounted] = _react.default.useState(false); // fires after all the effects in children
|
45
|
-
|
46
|
-
|
47
|
-
_react.default.useEffect(() => {
|
48
|
-
rerenderWithSlots();
|
49
|
-
setIsMounted(true);
|
50
|
-
}, [rerenderWithSlots]);
|
51
|
-
|
52
|
-
const registerSlot = _react.default.useCallback((name, contents) => {
|
53
|
-
slotsRef.current[name] = contents; // don't render until the component mounts = all slots are registered
|
54
|
-
|
55
|
-
if (isMounted) rerenderWithSlots();
|
56
|
-
}, [isMounted, rerenderWithSlots]); // Slot can be removed from the tree as well,
|
57
|
-
// we need to unregister them from the slot
|
58
|
-
|
59
|
-
|
60
|
-
const unregisterSlot = _react.default.useCallback(name => {
|
61
|
-
slotsRef.current[name] = null;
|
62
|
-
rerenderWithSlots();
|
63
|
-
}, [rerenderWithSlots]);
|
64
|
-
/**
|
65
|
-
* Slots uses a render prop API so abstract the
|
66
|
-
* implementation detail of using a context provider.
|
67
|
-
*/
|
68
|
-
|
69
|
-
|
70
|
-
const slots = slotsRef.current;
|
71
|
-
return /*#__PURE__*/_react.default.createElement(SlotsContext.Provider, {
|
72
|
-
value: {
|
73
|
-
registerSlot,
|
74
|
-
unregisterSlot,
|
75
|
-
context
|
76
|
-
}
|
77
|
-
}, children(slots));
|
78
|
-
};
|
79
|
-
|
80
|
-
const Slot = ({
|
81
|
-
name,
|
82
|
-
children
|
83
|
-
}) => {
|
84
|
-
const {
|
85
|
-
registerSlot,
|
86
|
-
unregisterSlot,
|
87
|
-
context
|
88
|
-
} = _react.default.useContext(SlotsContext);
|
89
|
-
|
90
|
-
_react.default.useEffect(() => {
|
91
|
-
registerSlot(name, typeof children === 'function' ? children(context) : children);
|
92
|
-
return () => unregisterSlot(name);
|
93
|
-
}, [name, children, registerSlot, unregisterSlot, context]);
|
94
|
-
|
95
|
-
return null;
|
96
|
-
};
|
97
|
-
|
98
|
-
return {
|
99
|
-
Slots,
|
100
|
-
Slot
|
101
|
-
};
|
102
|
-
};
|
103
|
-
|
104
|
-
var _default = createSlots;
|
105
|
-
exports.default = _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const useForceUpdate: () => () => void;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useForceUpdate = void 0;
|
7
|
-
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
9
|
-
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
-
|
12
|
-
// Inspired from reach-ui: https://github.com/reach/reach-ui/blob/develop/packages/utils/src/use-force-update.ts
|
13
|
-
const useForceUpdate = () => {
|
14
|
-
const [, rerender] = _react.default.useState({});
|
15
|
-
|
16
|
-
return _react.default.useCallback(() => rerender({}), []);
|
17
|
-
};
|
18
|
-
|
19
|
-
exports.useForceUpdate = useForceUpdate;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import Box from '../Box';
|
3
|
-
import { merge } from '../sx';
|
4
|
-
import Truncate from '../Truncate';
|
5
|
-
import { Slot } from './Item';
|
6
|
-
export const Description = ({
|
7
|
-
variant = 'inline',
|
8
|
-
sx = {},
|
9
|
-
...props
|
10
|
-
}) => {
|
11
|
-
const styles = {
|
12
|
-
color: 'fg.muted',
|
13
|
-
fontSize: 0,
|
14
|
-
lineHeight: '16px',
|
15
|
-
flexGrow: 1,
|
16
|
-
flexBasis: 0,
|
17
|
-
minWidth: 0,
|
18
|
-
marginLeft: variant === 'block' ? 0 : 2
|
19
|
-
};
|
20
|
-
return /*#__PURE__*/React.createElement(Slot, {
|
21
|
-
name: variant === 'block' ? 'BlockDescription' : 'InlineDescription'
|
22
|
-
}, ({
|
23
|
-
blockDescriptionId,
|
24
|
-
inlineDescriptionId
|
25
|
-
}) => variant === 'block' ? /*#__PURE__*/React.createElement(Box, {
|
26
|
-
as: "span",
|
27
|
-
sx: merge(styles, sx),
|
28
|
-
id: blockDescriptionId
|
29
|
-
}, props.children) : /*#__PURE__*/React.createElement(Truncate, {
|
30
|
-
id: inlineDescriptionId,
|
31
|
-
sx: merge(styles, sx),
|
32
|
-
title: props.children,
|
33
|
-
inline: true,
|
34
|
-
maxWidth: "100%"
|
35
|
-
}, props.children));
|
36
|
-
};
|
37
|
-
Description.displayName = "Description";
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import Box from '../Box';
|
3
|
-
import { get } from '../constants';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Visually separates `Item`s or `Group`s in an `ActionList`.
|
7
|
-
*/
|
8
|
-
export function Divider() {
|
9
|
-
return /*#__PURE__*/React.createElement(Box, {
|
10
|
-
as: "li",
|
11
|
-
role: "separator",
|
12
|
-
sx: {
|
13
|
-
height: 1,
|
14
|
-
backgroundColor: 'border.muted',
|
15
|
-
marginTop: theme => `calc(${get('space.2')(theme)} - 1px)`,
|
16
|
-
marginBottom: 2
|
17
|
-
},
|
18
|
-
"data-component": "ActionList.Divider"
|
19
|
-
});
|
20
|
-
}
|
21
|
-
Divider.displayName = "Divider";
|
@@ -1,32 +0,0 @@
|
|
1
|
-
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); }
|
2
|
-
|
3
|
-
import React from 'react';
|
4
|
-
import Box from '../Box';
|
5
|
-
import { Header } from './Header';
|
6
|
-
export const Group = ({
|
7
|
-
title,
|
8
|
-
variant,
|
9
|
-
auxiliaryText,
|
10
|
-
sx = {},
|
11
|
-
...props
|
12
|
-
}) => {
|
13
|
-
return /*#__PURE__*/React.createElement(Box, _extends({
|
14
|
-
as: "li",
|
15
|
-
sx: {
|
16
|
-
'&:not(:first-child)': {
|
17
|
-
marginTop: 2
|
18
|
-
},
|
19
|
-
...sx
|
20
|
-
}
|
21
|
-
}, props), title && /*#__PURE__*/React.createElement(Header, {
|
22
|
-
title: title,
|
23
|
-
variant: variant,
|
24
|
-
auxiliaryText: auxiliaryText
|
25
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
26
|
-
as: "ul",
|
27
|
-
sx: {
|
28
|
-
paddingInlineStart: 0
|
29
|
-
}
|
30
|
-
}, props.children));
|
31
|
-
};
|
32
|
-
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,45 +0,0 @@
|
|
1
|
-
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); }
|
2
|
-
|
3
|
-
import React from 'react';
|
4
|
-
import Box from '../Box';
|
5
|
-
import { ListContext } from './List';
|
6
|
-
/**
|
7
|
-
* Contract for props passed to the `Header` component.
|
8
|
-
*/
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Displays the name and description of a `Group`.
|
12
|
-
*/
|
13
|
-
export function Header({
|
14
|
-
variant = 'subtle',
|
15
|
-
title,
|
16
|
-
auxiliaryText,
|
17
|
-
children: _children,
|
18
|
-
sx = {},
|
19
|
-
...props
|
20
|
-
}) {
|
21
|
-
const {
|
22
|
-
variant: listVariant
|
23
|
-
} = React.useContext(ListContext);
|
24
|
-
const styles = {
|
25
|
-
paddingY: '6px',
|
26
|
-
paddingX: listVariant === 'full' ? 2 : 3,
|
27
|
-
fontSize: 0,
|
28
|
-
fontWeight: 'bold',
|
29
|
-
color: 'fg.muted',
|
30
|
-
...(variant === 'filled' && {
|
31
|
-
backgroundColor: 'canvas.subtle',
|
32
|
-
marginX: 0,
|
33
|
-
marginBottom: 2,
|
34
|
-
borderTop: '1px solid',
|
35
|
-
borderBottom: '1px solid',
|
36
|
-
borderColor: 'neutral.muted'
|
37
|
-
}),
|
38
|
-
...sx
|
39
|
-
};
|
40
|
-
return /*#__PURE__*/React.createElement(Box, _extends({
|
41
|
-
sx: styles,
|
42
|
-
role: "heading"
|
43
|
-
}, props), title, auxiliaryText && /*#__PURE__*/React.createElement("span", null, "auxiliaryText"));
|
44
|
-
}
|
45
|
-
Header.displayName = "Header";
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
|
3
|
-
import { SxProp } from '../sx';
|
4
|
-
import { AriaRole } from '../utils/types';
|
5
|
-
export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
|
6
|
-
color: string;
|
7
|
-
iconColor: string;
|
8
|
-
annotationColor: string;
|
9
|
-
};
|
10
|
-
export declare type ItemProps = {
|
11
|
-
/**
|
12
|
-
* Primary content for an Item
|
13
|
-
*/
|
14
|
-
children: React.ReactNode;
|
15
|
-
/**
|
16
|
-
* Callback that will trigger both on click selection and keyboard selection.
|
17
|
-
*/
|
18
|
-
onSelect?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
|
19
|
-
/**
|
20
|
-
* Is the `Item` is currently selected?
|
21
|
-
*/
|
22
|
-
selected?: boolean;
|
23
|
-
/**
|
24
|
-
* Style variations associated with various `Item` types.
|
25
|
-
*
|
26
|
-
* - `"default"` - An action `Item`.
|
27
|
-
* - `"danger"` - A destructive action `Item`.
|
28
|
-
*/
|
29
|
-
variant?: 'default' | 'danger';
|
30
|
-
/**
|
31
|
-
* Items that are disabled can not be clicked, selected, or navigated through.
|
32
|
-
*/
|
33
|
-
disabled?: boolean;
|
34
|
-
/**
|
35
|
-
* The ARIA role describing the function of `Item` component. `option` is a common value. |
|
36
|
-
*/
|
37
|
-
role?: AriaRole;
|
38
|
-
} & SxProp;
|
39
|
-
declare const Slot: React.FC<{
|
40
|
-
name: "LeadingVisual" | "InlineDescription" | "BlockDescription" | "TrailingVisual";
|
41
|
-
children: React.ReactNode | ((context: Record<string, unknown>) => React.ReactNode);
|
42
|
-
}>;
|
43
|
-
export { Slot };
|
44
|
-
export declare type ItemContext = Pick<ItemProps, 'variant' | 'disabled'> & {
|
45
|
-
inlineDescriptionId: string;
|
46
|
-
blockDescriptionId: string;
|
47
|
-
};
|
48
|
-
export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
|