@primer/components 0.0.0-202191502023 → 0.0.0-202191514518

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/lib/ActionList2/Description.d.ts +5 -0
  3. package/lib/ActionList2/Description.js +54 -0
  4. package/lib/ActionList2/Divider.d.ts +8 -0
  5. package/lib/ActionList2/Divider.js +42 -0
  6. package/lib/ActionList2/Group.d.ts +8 -0
  7. package/lib/ActionList2/Group.js +39 -0
  8. package/lib/ActionList2/Header.d.ts +26 -0
  9. package/lib/ActionList2/Header.js +55 -0
  10. package/lib/ActionList2/Item.d.ts +52 -0
  11. package/lib/ActionList2/Item.js +188 -0
  12. package/lib/ActionList2/List.d.ts +18 -0
  13. package/lib/ActionList2/List.js +52 -0
  14. package/lib/ActionList2/Selection.d.ts +5 -0
  15. package/lib/ActionList2/Selection.js +67 -0
  16. package/lib/ActionList2/Visuals.d.ts +12 -0
  17. package/lib/ActionList2/Visuals.js +91 -0
  18. package/lib/ActionList2/hacks.d.ts +30 -0
  19. package/lib/ActionList2/hacks.js +38 -0
  20. package/lib/ActionList2/index.d.ts +26 -0
  21. package/lib/ActionList2/index.js +36 -0
  22. package/lib-esm/ActionList2/Description.d.ts +5 -0
  23. package/lib-esm/ActionList2/Description.js +38 -0
  24. package/lib-esm/ActionList2/Divider.d.ts +8 -0
  25. package/lib-esm/ActionList2/Divider.js +30 -0
  26. package/lib-esm/ActionList2/Group.d.ts +8 -0
  27. package/lib-esm/ActionList2/Group.js +29 -0
  28. package/lib-esm/ActionList2/Header.d.ts +26 -0
  29. package/lib-esm/ActionList2/Header.js +45 -0
  30. package/lib-esm/ActionList2/Item.d.ts +52 -0
  31. package/lib-esm/ActionList2/Item.js +184 -0
  32. package/lib-esm/ActionList2/List.d.ts +18 -0
  33. package/lib-esm/ActionList2/List.js +42 -0
  34. package/lib-esm/ActionList2/Selection.d.ts +5 -0
  35. package/lib-esm/ActionList2/Selection.js +50 -0
  36. package/lib-esm/ActionList2/Visuals.d.ts +12 -0
  37. package/lib-esm/ActionList2/Visuals.js +68 -0
  38. package/lib-esm/ActionList2/hacks.d.ts +30 -0
  39. package/lib-esm/ActionList2/hacks.js +30 -0
  40. package/lib-esm/ActionList2/index.d.ts +26 -0
  41. package/lib-esm/ActionList2/index.js +23 -0
  42. package/package.json +1 -1
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TrailingVisual = exports.LeadingVisual = exports.LeadingVisualContainer = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Box = _interopRequireDefault(require("../Box"));
11
+
12
+ var _constants = require("../constants");
13
+
14
+ var _Item = require("./Item");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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); }
19
+
20
+ const LeadingVisualContainer = ({
21
+ sx = {},
22
+ ...props
23
+ }) => {
24
+ return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
25
+ as: "span",
26
+ sx: {
27
+ height: '20px',
28
+ // match height of text row
29
+ minWidth: (0, _constants.get)('space.3'),
30
+ maxWidth: '20px',
31
+ // square (same as height)
32
+ display: 'flex',
33
+ justifyContent: 'center',
34
+ alignItems: 'center',
35
+ flexShrink: 0,
36
+ marginRight: 2,
37
+ ...sx
38
+ }
39
+ }, props));
40
+ };
41
+
42
+ exports.LeadingVisualContainer = LeadingVisualContainer;
43
+ LeadingVisualContainer.displayName = "LeadingVisualContainer";
44
+
45
+ const LeadingVisual = ({
46
+ variant,
47
+ disabled,
48
+ sx = {},
49
+ ...props
50
+ }) => {
51
+ const {
52
+ registerSlot
53
+ } = _react.default.useContext(_Item.ItemContext);
54
+
55
+ registerSlot('LeadingVisual', /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, _extends({
56
+ sx: {
57
+ color: (0, _Item.getVariantStyles)(variant, disabled).iconColor,
58
+ svg: {
59
+ fontSize: 0
60
+ },
61
+ ...sx
62
+ }
63
+ }, props), props.children));
64
+ return null;
65
+ };
66
+
67
+ exports.LeadingVisual = LeadingVisual;
68
+
69
+ const TrailingVisual = ({
70
+ variant,
71
+ disabled,
72
+ ...props
73
+ }) => {
74
+ const {
75
+ registerSlot
76
+ } = _react.default.useContext(_Item.ItemContext);
77
+
78
+ registerSlot('TrailingVisual', /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
79
+ as: "span",
80
+ sx: {
81
+ height: '20px',
82
+ // match height of text row
83
+ flexShrink: 0,
84
+ color: (0, _Item.getVariantStyles)(variant, disabled).annotationColor,
85
+ marginLeft: 2
86
+ }
87
+ }, props), props.children));
88
+ return null;
89
+ };
90
+
91
+ exports.TrailingVisual = TrailingVisual;
@@ -0,0 +1,30 @@
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
+ };
@@ -0,0 +1,38 @@
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;
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { Group } from './Group';
3
+ import { Divider } from './Divider';
4
+ export type { ListProps as ActionListProps } from './List';
5
+ export type { GroupProps } from './Group';
6
+ export type { ItemProps } from './Item';
7
+ export type { DescriptionProps } from './Description';
8
+ export type { LeadingVisualProps, TrailingVisualProps } from './Visuals';
9
+ /**
10
+ * Collection of list-related components.
11
+ */
12
+ export declare const ActionList: import("@radix-ui/react-polymorphic").ForwardRefComponent<"ul", import("./List").ListProps> & {
13
+ /** Collects related `Items` in an `ActionList`. */
14
+ Group: typeof Group;
15
+ /** An actionable or selectable `Item` with an optional icon and description. */
16
+ Item: import("@radix-ui/react-polymorphic").ForwardRefComponent<"li", import("./Item").ItemProps>;
17
+ /** Visually separates `Item`s or `Group`s in an `ActionList`. */
18
+ Divider: typeof Divider;
19
+ Description: import("react").FC<import("./Description").DescriptionProps>;
20
+ LeadingVisual: import("react").FC<Pick<import("./Item").ItemProps, "sx" | "disabled" | "variant"> & {
21
+ children: import("react").ReactNode;
22
+ }>;
23
+ TrailingVisual: import("react").FC<Pick<import("./Item").ItemProps, "sx" | "disabled" | "variant"> & {
24
+ children: import("react").ReactNode;
25
+ }>;
26
+ };
@@ -0,0 +1,36 @@
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` with an optional icon and description. */
28
+ Item: _Item.Item,
29
+
30
+ /** Visually separates `Item`s or `Group`s in an `ActionList`. */
31
+ Divider: _Divider.Divider,
32
+ Description: _Description.Description,
33
+ LeadingVisual: _Visuals.LeadingVisual,
34
+ TrailingVisual: _Visuals.TrailingVisual
35
+ });
36
+ exports.ActionList = ActionList;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare type DescriptionProps = {
3
+ variant?: 'inline' | 'block';
4
+ };
5
+ export declare const Description: React.FC<DescriptionProps>;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import Box from '../Box';
3
+ import Truncate from '../Truncate';
4
+ import { ItemContext } from './Item';
5
+ export const Description = ({
6
+ variant = 'inline',
7
+ ...props
8
+ }) => {
9
+ const {
10
+ registerSlot
11
+ } = React.useContext(ItemContext);
12
+ const slotName = variant === 'block' ? 'BlockDescription' : 'InlineDescription';
13
+ const styles = {
14
+ color: 'fg.muted',
15
+ fontSize: 0,
16
+ lineHeight: '16px',
17
+ flexGrow: 1,
18
+ flexBasis: 0,
19
+ minWidth: 0,
20
+ marginLeft: variant === 'block' ? 0 : 2
21
+ };
22
+
23
+ if (variant === 'block') {
24
+ registerSlot(slotName, /*#__PURE__*/React.createElement(Box, {
25
+ as: "span",
26
+ sx: styles
27
+ }, props.children));
28
+ } else {
29
+ registerSlot(slotName, /*#__PURE__*/React.createElement(Truncate, {
30
+ sx: styles,
31
+ title: props.children,
32
+ inline: true,
33
+ maxWidth: "100%"
34
+ }, props.children));
35
+ }
36
+
37
+ return null;
38
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Visually separates `Item`s or `Group`s in an `ActionList`.
4
+ */
5
+ export declare function Divider(): JSX.Element;
6
+ export declare namespace Divider {
7
+ var renderItem: typeof Divider;
8
+ }
@@ -0,0 +1,30 @@
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: "hr",
11
+ sx: {
12
+ border: 'none',
13
+ // override browser styles
14
+ height: 1,
15
+ backgroundColor: 'border.muted',
16
+ marginTop: theme => `calc(${get('space.2')(theme)} - 1px)`,
17
+ marginBottom: 2
18
+ },
19
+ "data-component": "ActionList.Divider"
20
+ });
21
+ }
22
+ Divider.displayName = "Divider";
23
+
24
+ /**
25
+ * `Divider` fulfills the `ItemPropsWithCustomRenderer` contract,
26
+ * so it can be used inline in an `ActionList`’s `items` prop.
27
+ * In other words, `items={[ActionList.Divider]}` is supported as a concise
28
+ * alternative to `items={[{renderItem: () => <ActionList.Divider />}]}`.
29
+ */
30
+ Divider.renderItem = Divider;
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,29 @@
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
+ /**
4
+ * show item dividers
5
+ */
6
+ import React from 'react';
7
+ import Box from '../Box';
8
+ import { Header } from './Header';
9
+ export function Group({
10
+ title,
11
+ variant,
12
+ auxiliaryText,
13
+ sx = {},
14
+ ...props
15
+ }) {
16
+ return /*#__PURE__*/React.createElement(Box, _extends({
17
+ sx: {
18
+ '&:not(:first-child)': {
19
+ marginTop: 2
20
+ },
21
+ ...sx
22
+ }
23
+ }, props), title && /*#__PURE__*/React.createElement(Header, {
24
+ title: title,
25
+ variant: variant,
26
+ auxiliaryText: auxiliaryText
27
+ }), props.children);
28
+ }
29
+ Group.displayName = "Group";
@@ -0,0 +1,26 @@
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;
@@ -0,0 +1,45 @@
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";
@@ -0,0 +1,52 @@
1
+ /**
2
+ * id, role
3
+ * text could be non-text
4
+ * activeDescendantAttribute
5
+ * deepmerge sx
6
+ * nicer name for showDivider?
7
+ * aria-label
8
+ * aria-describedby
9
+ * React.FC<Props> doesn't allow id?
10
+ * truncate description
11
+ * icon color
12
+ * disabled checkbox
13
+ * check height with divider
14
+ *
15
+ * use immediate child slot API instead of double render?
16
+ * change as= li | div based on context of menu or not?
17
+ * check if everyone accepts sx prop
18
+ * link example outside of overlay? (details)
19
+ * if one item has selected, should we give all of them selected without the need to pass prop?
20
+ * move custom item themes to primitives?
21
+ * padding: 8 or 6?
22
+ * ActionList.Selection or ActionList.Item selected?
23
+ * different size for icon and avatar, range?
24
+ * minimize number of divs?
25
+ */
26
+ import React from 'react';
27
+ import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
28
+ import { SxProp } from '../sx';
29
+ export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
30
+ color: (props: any) => any;
31
+ iconColor: (props: any) => any;
32
+ annotationColor: (props: any) => any;
33
+ } | {
34
+ color: string;
35
+ iconColor: string;
36
+ annotationColor: string;
37
+ };
38
+ export declare type ItemProps = {
39
+ children: React.ReactNode;
40
+ onAction?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
41
+ selected?: boolean;
42
+ variant?: 'default' | 'danger';
43
+ disabled?: boolean;
44
+ showDivider?: boolean;
45
+ } & SxProp;
46
+ declare type SlotNames = 'LeadingVisual' | 'InlineDescription' | 'BlockDescription' | 'TrailingVisual';
47
+ declare type ContextProps = {
48
+ registerSlot: (name: SlotNames, contents: React.ReactNode) => void;
49
+ };
50
+ export declare const ItemContext: React.Context<ContextProps>;
51
+ export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
52
+ export {};
@@ -0,0 +1,184 @@
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
+ /**
4
+ * id, role
5
+ * text could be non-text
6
+ * activeDescendantAttribute
7
+ * deepmerge sx
8
+ * nicer name for showDivider?
9
+ * aria-label
10
+ * aria-describedby
11
+ * React.FC<Props> doesn't allow id?
12
+ * truncate description
13
+ * icon color
14
+ * disabled checkbox
15
+ * check height with divider
16
+ *
17
+ * use immediate child slot API instead of double render?
18
+ * change as= li | div based on context of menu or not?
19
+ * check if everyone accepts sx prop
20
+ * link example outside of overlay? (details)
21
+ * if one item has selected, should we give all of them selected without the need to pass prop?
22
+ * move custom item themes to primitives?
23
+ * padding: 8 or 6?
24
+ * ActionList.Selection or ActionList.Item selected?
25
+ * different size for icon and avatar, range?
26
+ * minimize number of divs?
27
+ */
28
+ import React from 'react';
29
+ import { useColorSchemeVar, useTheme } from '../ThemeProvider';
30
+ import Box from '../Box';
31
+ import { get } from '../constants';
32
+ import { ListContext } from './List';
33
+ import { customItemThemes } from './hacks';
34
+ import { Selection } from './Selection';
35
+ export const getVariantStyles = (variant, disabled) => {
36
+ if (disabled) {
37
+ return {
38
+ color: get('colors.fg.muted'),
39
+ iconColor: get('colors.fg.muted'),
40
+ annotationColor: get('colors.fg.muted')
41
+ };
42
+ }
43
+
44
+ switch (variant) {
45
+ case 'danger':
46
+ return {
47
+ color: 'danger.fg',
48
+ iconColor: 'danger.fg',
49
+ annotationColor: 'fg.muted'
50
+ };
51
+
52
+ default:
53
+ return {
54
+ color: 'fg.default',
55
+ iconColor: 'fg.muted',
56
+ annotationColor: 'fg.muted'
57
+ };
58
+ }
59
+ };
60
+ export const ItemContext = /*#__PURE__*/React.createContext({
61
+ registerSlot: () => null
62
+ });
63
+ export const Item = /*#__PURE__*/React.forwardRef(({
64
+ variant = 'default',
65
+ disabled = false,
66
+ selected = undefined,
67
+ showDivider = false,
68
+ onAction = () => null,
69
+ sx = {},
70
+ ...props
71
+ }, forwardedRef) => {
72
+ const customItemTheme = customItemThemes[variant];
73
+ const {
74
+ variant: listVariant
75
+ } = React.useContext(ListContext);
76
+ const {
77
+ theme
78
+ } = useTheme();
79
+ const [slots, setSlots] = React.useState({
80
+ LeadingVisual: null,
81
+ InlineDescription: null,
82
+ BlockDescription: null,
83
+ TrailingVisual: null
84
+ });
85
+
86
+ const registerSlot = (name, contents) => {
87
+ if (slots[name] === null) setSlots({ ...slots,
88
+ [name]: contents
89
+ });
90
+ };
91
+
92
+ const styles = {
93
+ display: 'flex',
94
+ paddingX: get('space.2'),
95
+ paddingY: '6px',
96
+ marginX: listVariant === 'inset' ? get('space.2') : 0,
97
+ minHeight: get('space.5'),
98
+ borderRadius: get('radii.2'),
99
+ transition: 'background 33.333ms linear',
100
+ color: getVariantStyles(variant, disabled).color,
101
+ textDecoration: 'none',
102
+ // for as="a"
103
+ ':not(disabled)': {
104
+ cursor: 'pointer'
105
+ },
106
+ '@media (hover: hover) and (pointer: fine)': {
107
+ ':hover': {
108
+ backgroundColor: useColorSchemeVar(customItemTheme.hover, 'inherit')
109
+ },
110
+ ':focus': {
111
+ backgroundColor: useColorSchemeVar(customItemTheme.focus, 'inherit')
112
+ }
113
+ },
114
+
115
+ /** Divider styles */
116
+ '[data-component="ActionList.Item--Main"]': {
117
+ position: 'relative'
118
+ },
119
+ '[data-component="ActionList.Item--Main"]::before': {
120
+ content: '" "',
121
+ display: 'block',
122
+ position: 'absolute',
123
+ width: '100%',
124
+ top: '-7px',
125
+ border: '0 solid',
126
+ borderTopWidth: showDivider ? `1px` : '0',
127
+ borderColor: 'var(--divider-color, transparent)'
128
+ },
129
+ // show between 2 items
130
+ ':not(:first-of-type)': {
131
+ '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.border.muted
132
+ },
133
+ // hide divider after dividers & group header
134
+ '[data-component="ActionList.Divider"] + &': {
135
+ '--divider-color': 'transparent'
136
+ },
137
+ // hide border on current and previous item
138
+ '&:hover, &:focus': {
139
+ '--divider-color': 'transparent'
140
+ },
141
+ '&:hover + &, &:focus + &': {
142
+ '--divider-color': 'transparent'
143
+ },
144
+ ...sx
145
+ };
146
+ const clickHandler = React.useCallback(event => {
147
+ if (disabled) return;
148
+ if (!event.defaultPrevented) onAction(event);
149
+ }, [onAction, disabled]);
150
+ return /*#__PURE__*/React.createElement(Box, _extends({
151
+ as: "li",
152
+ sx: styles,
153
+ "data-component": "ActionList.Item",
154
+ onClick: clickHandler,
155
+ ref: forwardedRef
156
+ }, props), /*#__PURE__*/React.createElement(ItemContext.Provider, {
157
+ value: {
158
+ registerSlot
159
+ }
160
+ }, /*#__PURE__*/React.createElement(Selection, {
161
+ selected: selected,
162
+ disabled: disabled
163
+ }), slots.LeadingVisual, /*#__PURE__*/React.createElement(Box, {
164
+ "data-component": "ActionList.Item--Main",
165
+ sx: {
166
+ display: 'flex',
167
+ flexDirection: 'column',
168
+ flexGrow: 1,
169
+ minWidth: 0
170
+ }
171
+ }, /*#__PURE__*/React.createElement(Box, {
172
+ sx: {
173
+ display: 'flex'
174
+ }
175
+ }, /*#__PURE__*/React.createElement(Box, {
176
+ sx: {
177
+ display: 'flex',
178
+ flexGrow: 1,
179
+ alignItems: 'baseline',
180
+ minWidth: 0
181
+ }
182
+ }, /*#__PURE__*/React.createElement("span", null, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
183
+ });
184
+ Item.displayName = 'ActionList.Item';
@@ -0,0 +1,18 @@
1
+ /**
2
+ *
3
+ * showItemDividers
4
+ * deepmerge sx
5
+ * change as= ul | div based on context of menu or not?
6
+ * should selectionVariant be single by default or nothing. ask for explicit choice?
7
+ */
8
+ import React from 'react';
9
+ import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
10
+ import { SxProp } from '../sx';
11
+ export declare type ListProps = {
12
+ variant?: 'inset' | 'full';
13
+ selectionVariant?: 'single' | 'multiple';
14
+ } & SxProp;
15
+ declare type ContextProps = Pick<ListProps, 'selectionVariant' | 'variant'>;
16
+ export declare const ListContext: React.Context<ContextProps>;
17
+ export declare const List: PolymorphicForwardRefComponent<"ul", ListProps>;
18
+ export {};