@primer/components 0.0.0-20219151705 → 0.0.0-2021915202729

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 (50) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/browser.esm.js +725 -725
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +731 -731
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/index.d.ts +0 -1
  7. package/lib/index.js +0 -8
  8. package/lib-esm/index.d.ts +0 -1
  9. package/lib-esm/index.js +0 -1
  10. package/package.json +1 -2
  11. package/lib/ActionList2/Description.d.ts +0 -5
  12. package/lib/ActionList2/Description.js +0 -55
  13. package/lib/ActionList2/Divider.d.ts +0 -8
  14. package/lib/ActionList2/Divider.js +0 -42
  15. package/lib/ActionList2/Group.d.ts +0 -8
  16. package/lib/ActionList2/Group.js +0 -39
  17. package/lib/ActionList2/Header.d.ts +0 -26
  18. package/lib/ActionList2/Header.js +0 -55
  19. package/lib/ActionList2/Item.d.ts +0 -56
  20. package/lib/ActionList2/Item.js +0 -216
  21. package/lib/ActionList2/List.d.ts +0 -18
  22. package/lib/ActionList2/List.js +0 -52
  23. package/lib/ActionList2/Selection.d.ts +0 -5
  24. package/lib/ActionList2/Selection.js +0 -67
  25. package/lib/ActionList2/Visuals.d.ts +0 -12
  26. package/lib/ActionList2/Visuals.js +0 -101
  27. package/lib/ActionList2/hacks.d.ts +0 -30
  28. package/lib/ActionList2/hacks.js +0 -38
  29. package/lib/ActionList2/index.d.ts +0 -26
  30. package/lib/ActionList2/index.js +0 -36
  31. package/lib-esm/ActionList2/Description.d.ts +0 -5
  32. package/lib-esm/ActionList2/Description.js +0 -37
  33. package/lib-esm/ActionList2/Divider.d.ts +0 -8
  34. package/lib-esm/ActionList2/Divider.js +0 -30
  35. package/lib-esm/ActionList2/Group.d.ts +0 -8
  36. package/lib-esm/ActionList2/Group.js +0 -29
  37. package/lib-esm/ActionList2/Header.d.ts +0 -26
  38. package/lib-esm/ActionList2/Header.js +0 -45
  39. package/lib-esm/ActionList2/Item.d.ts +0 -56
  40. package/lib-esm/ActionList2/Item.js +0 -211
  41. package/lib-esm/ActionList2/List.d.ts +0 -18
  42. package/lib-esm/ActionList2/List.js +0 -42
  43. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  44. package/lib-esm/ActionList2/Selection.js +0 -50
  45. package/lib-esm/ActionList2/Visuals.d.ts +0 -12
  46. package/lib-esm/ActionList2/Visuals.js +0 -76
  47. package/lib-esm/ActionList2/hacks.d.ts +0 -30
  48. package/lib-esm/ActionList2/hacks.js +0 -30
  49. package/lib-esm/ActionList2/index.d.ts +0 -26
  50. package/lib-esm/ActionList2/index.js +0 -23
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"));
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-20219151705",
3
+ "version": "0.0.0-2021915202729",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -59,7 +59,6 @@
59
59
  "color2k": "1.2.4",
60
60
  "deepmerge": "4.2.2",
61
61
  "focus-visible": "5.2.0",
62
- "lodash.isequal": "4.5.0",
63
62
  "styled-system": "5.1.5"
64
63
  },
65
64
  "devDependencies": {
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export declare type DescriptionProps = {
3
- variant?: 'inline' | 'block';
4
- };
5
- export declare const Description: React.FC<DescriptionProps>;
@@ -1,55 +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 _Truncate = _interopRequireDefault(require("../Truncate"));
13
-
14
- var _Item = require("./Item");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const Description = ({
19
- variant = 'inline',
20
- ...props
21
- }) => {
22
- const {
23
- registerSlot,
24
- deregisterSlot
25
- } = _react.default.useContext(_Item.ItemContext);
26
-
27
- const styles = {
28
- color: 'fg.muted',
29
- fontSize: 0,
30
- lineHeight: '16px',
31
- flexGrow: 1,
32
- flexBasis: 0,
33
- minWidth: 0,
34
- marginLeft: variant === 'block' ? 0 : 2
35
- };
36
- const contents = variant === 'block' ? /*#__PURE__*/_react.default.createElement(_Box.default, {
37
- as: "span",
38
- sx: styles
39
- }, props.children) : /*#__PURE__*/_react.default.createElement(_Truncate.default, {
40
- sx: styles,
41
- title: props.children,
42
- inline: true,
43
- maxWidth: "100%"
44
- }, props.children);
45
-
46
- _react.default.useLayoutEffect(() => {
47
- const slotName = variant === 'block' ? 'BlockDescription' : 'InlineDescription';
48
- registerSlot(slotName, contents);
49
- return () => deregisterSlot(slotName);
50
- }, [variant, props.children]);
51
-
52
- return null;
53
- };
54
-
55
- exports.Description = Description;
@@ -1,8 +0,0 @@
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
- }
@@ -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;
@@ -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,56 +0,0 @@
1
- /**
2
- * test suite!
3
- * id, role
4
- * text could be non-text
5
- * activeDescendantAttribute
6
- * deepmerge sx
7
- * nicer name for showDivider?
8
- * aria-label
9
- * aria-describedby
10
- * React.FC<Props> doesn't allow id?
11
- * truncate description
12
- * icon color
13
- * disabled checkbox
14
- * check height with divider
15
- *
16
- * use immediate child slot API instead of double render?
17
- * change as= li | div based on context of menu or not?
18
- * check if everyone accepts sx prop
19
- * link example outside of overlay? (details)
20
- * if one item has selected, should we give all of them selected without the need to pass prop?
21
- * move custom item themes to primitives?
22
- * padding: 8 or 6?
23
- * ActionList.Selection or ActionList.Item selected?
24
- * different size for icon and avatar, range?
25
- * minimize number of divs?
26
- * improve double render by wrapping custom children in memo
27
- * improve double render by wrapping children in memo
28
- */
29
- import React from 'react';
30
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
31
- import { SxProp } from '../sx';
32
- export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
33
- color: (props: any) => any;
34
- iconColor: (props: any) => any;
35
- annotationColor: (props: any) => any;
36
- } | {
37
- color: string;
38
- iconColor: string;
39
- annotationColor: string;
40
- };
41
- export declare type ItemProps = {
42
- children: React.ReactNode;
43
- onAction?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
44
- selected?: boolean;
45
- variant?: 'default' | 'danger';
46
- disabled?: boolean;
47
- showDivider?: boolean;
48
- } & SxProp;
49
- declare type SlotNames = 'LeadingVisual' | 'InlineDescription' | 'BlockDescription' | 'TrailingVisual';
50
- declare type ContextProps = {
51
- registerSlot: (name: SlotNames, contents: JSX.Element) => void;
52
- deregisterSlot: (name: SlotNames) => void;
53
- };
54
- export declare const ItemContext: React.Context<ContextProps>;
55
- export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
56
- export {};
@@ -1,216 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Item = exports.ItemContext = exports.getVariantStyles = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _ThemeProvider = require("../ThemeProvider");
11
-
12
- var _Box = _interopRequireDefault(require("../Box"));
13
-
14
- var _constants = require("../constants");
15
-
16
- var _List = require("./List");
17
-
18
- var _hacks = require("./hacks");
19
-
20
- var _Selection = require("./Selection");
21
-
22
- var _lodash = _interopRequireDefault(require("lodash.isequal"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- 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); }
27
-
28
- const getVariantStyles = (variant, disabled) => {
29
- if (disabled) {
30
- return {
31
- color: (0, _constants.get)('colors.fg.muted'),
32
- iconColor: (0, _constants.get)('colors.fg.muted'),
33
- annotationColor: (0, _constants.get)('colors.fg.muted')
34
- };
35
- }
36
-
37
- switch (variant) {
38
- case 'danger':
39
- return {
40
- color: 'danger.fg',
41
- iconColor: 'danger.fg',
42
- annotationColor: 'fg.muted'
43
- };
44
-
45
- default:
46
- return {
47
- color: 'fg.default',
48
- iconColor: 'fg.muted',
49
- annotationColor: 'fg.muted'
50
- };
51
- }
52
- };
53
-
54
- exports.getVariantStyles = getVariantStyles;
55
-
56
- const ItemContext = /*#__PURE__*/_react.default.createContext({
57
- registerSlot: () => null,
58
- deregisterSlot: () => null
59
- });
60
-
61
- exports.ItemContext = ItemContext;
62
-
63
- const Item = /*#__PURE__*/_react.default.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 = _hacks.customItemThemes[variant];
73
-
74
- const {
75
- variant: listVariant
76
- } = _react.default.useContext(_List.ListContext);
77
-
78
- const {
79
- theme
80
- } = (0, _ThemeProvider.useTheme)(); // Double render strategy
81
- // when the effect is run for the first time,
82
- // all the children have rendered = registed themself in slot.
83
- // we re-render the Item component to re-render with filled slots.
84
-
85
- const [, rerenderWithSlots] = _react.default.useState(0);
86
-
87
- const [isMounted, setIsMounted] = _react.default.useState(false);
88
-
89
- _react.default.useLayoutEffect(() => {
90
- setIsMounted(true);
91
- rerenderWithSlots(count => count + 1);
92
- }, []);
93
-
94
- const slotsRef = _react.default.useRef({
95
- LeadingVisual: null,
96
- InlineDescription: null,
97
- BlockDescription: null,
98
- TrailingVisual: null
99
- });
100
-
101
- const slots = slotsRef.current;
102
-
103
- const registerSlot = (name, contents) => {
104
- const currentContents = slotsRef.current[name];
105
- slotsRef.current[name] = contents; // don't render until the component mounts = all slots are registered
106
-
107
- if (!isMounted) return; // only rerender if the values are different to avoid an infinite loop
108
-
109
- if (!(0, _lodash.default)(currentContents === null || currentContents === void 0 ? void 0 : currentContents.props, contents.props)) {
110
- rerenderWithSlots(count => count + 1);
111
- }
112
- };
113
-
114
- const deregisterSlot = name => {
115
- slotsRef.current[name] = null;
116
- rerenderWithSlots(count => count + 1);
117
- };
118
-
119
- const styles = {
120
- display: 'flex',
121
- paddingX: (0, _constants.get)('space.2'),
122
- paddingY: '6px',
123
- marginX: listVariant === 'inset' ? (0, _constants.get)('space.2') : 0,
124
- minHeight: (0, _constants.get)('space.5'),
125
- borderRadius: (0, _constants.get)('radii.2'),
126
- transition: 'background 33.333ms linear',
127
- color: getVariantStyles(variant, disabled).color,
128
- textDecoration: 'none',
129
- // for as="a"
130
- ':not(disabled)': {
131
- cursor: 'pointer'
132
- },
133
- '@media (hover: hover) and (pointer: fine)': {
134
- ':hover': {
135
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.hover, 'inherit')
136
- },
137
- ':focus': {
138
- backgroundColor: (0, _ThemeProvider.useColorSchemeVar)(customItemTheme.focus, 'inherit')
139
- }
140
- },
141
-
142
- /** Divider styles */
143
- '[data-component="ActionList.Item--Main"]': {
144
- position: 'relative'
145
- },
146
- '[data-component="ActionList.Item--Main"]::before': {
147
- content: '" "',
148
- display: 'block',
149
- position: 'absolute',
150
- width: '100%',
151
- top: '-7px',
152
- border: '0 solid',
153
- borderTopWidth: showDivider ? `1px` : '0',
154
- borderColor: 'var(--divider-color, transparent)'
155
- },
156
- // show between 2 items
157
- ':not(:first-of-type)': {
158
- '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.border.muted
159
- },
160
- // hide divider after dividers & group header
161
- '[data-component="ActionList.Divider"] + &': {
162
- '--divider-color': 'transparent'
163
- },
164
- // hide border on current and previous item
165
- '&:hover, &:focus': {
166
- '--divider-color': 'transparent'
167
- },
168
- '&:hover + &, &:focus + &': {
169
- '--divider-color': 'transparent'
170
- },
171
- ...sx
172
- };
173
-
174
- const clickHandler = _react.default.useCallback(event => {
175
- if (disabled) return;
176
- if (!event.defaultPrevented) onAction(event);
177
- }, [onAction, disabled]);
178
-
179
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
180
- as: "li",
181
- sx: styles,
182
- "data-component": "ActionList.Item",
183
- onClick: clickHandler,
184
- ref: forwardedRef
185
- }, props), /*#__PURE__*/_react.default.createElement(ItemContext.Provider, {
186
- value: {
187
- registerSlot,
188
- deregisterSlot
189
- }
190
- }, /*#__PURE__*/_react.default.createElement(_Selection.Selection, {
191
- selected: selected,
192
- disabled: disabled
193
- }), slots.LeadingVisual, /*#__PURE__*/_react.default.createElement(_Box.default, {
194
- "data-component": "ActionList.Item--Main",
195
- sx: {
196
- display: 'flex',
197
- flexDirection: 'column',
198
- flexGrow: 1,
199
- minWidth: 0
200
- }
201
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
202
- sx: {
203
- display: 'flex'
204
- }
205
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
206
- sx: {
207
- display: 'flex',
208
- flexGrow: 1,
209
- alignItems: 'baseline',
210
- minWidth: 0
211
- }
212
- }, /*#__PURE__*/_react.default.createElement("span", null, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
213
- });
214
-
215
- exports.Item = Item;
216
- Item.displayName = 'ActionList.Item';
@@ -1,18 +0,0 @@
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 {};
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.List = exports.ListContext = void 0;
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
- 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
- const ListContext = /*#__PURE__*/_react.default.createContext({});
19
-
20
- exports.ListContext = ListContext;
21
-
22
- const List = /*#__PURE__*/_react.default.forwardRef(({
23
- variant = 'inset',
24
- selectionVariant = 'single',
25
- sx = {},
26
- ...props
27
- }, forwardedRef) => {
28
- const styles = {
29
- margin: 0,
30
- fontSize: (0, _constants.get)('fontSizes.1'),
31
- lineHeight: '20px',
32
- // TODO: check if we replace this already
33
- paddingInlineStart: 0,
34
- // reset ul styles
35
- paddingY: variant === 'inset' ? (0, _constants.get)('space.2') : 0,
36
- ...sx
37
- };
38
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
39
- as: "ul",
40
- sx: styles
41
- }, props, {
42
- ref: forwardedRef
43
- }), /*#__PURE__*/_react.default.createElement(ListContext.Provider, {
44
- value: {
45
- variant,
46
- selectionVariant
47
- }
48
- }, props.children));
49
- });
50
-
51
- exports.List = List;
52
- List.displayName = 'ActionList';
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { ItemProps } from './Item';
3
- declare type SelectionProps = Pick<ItemProps, 'selected' | 'disabled'>;
4
- export declare const Selection: React.FC<SelectionProps>;
5
- export {};