@primer/components 0.0.0-202191841156 → 0.0.0-202191916821

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 (68) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/browser.esm.js +615 -615
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +180 -180
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/ActionList/Item.js +3 -3
  7. package/lib/ActionList2/Description.d.ts +5 -0
  8. package/lib/ActionList2/Description.js +45 -0
  9. package/lib/ActionList2/Divider.d.ts +8 -0
  10. package/lib/ActionList2/Divider.js +42 -0
  11. package/lib/ActionList2/Group.d.ts +8 -0
  12. package/lib/ActionList2/Group.js +39 -0
  13. package/lib/ActionList2/Header.d.ts +26 -0
  14. package/lib/ActionList2/Header.js +55 -0
  15. package/lib/ActionList2/Item.d.ts +52 -0
  16. package/lib/ActionList2/Item.js +171 -0
  17. package/lib/ActionList2/List.d.ts +18 -0
  18. package/lib/ActionList2/List.js +52 -0
  19. package/lib/ActionList2/Selection.d.ts +5 -0
  20. package/lib/ActionList2/Selection.js +67 -0
  21. package/lib/ActionList2/Visuals.d.ts +12 -0
  22. package/lib/ActionList2/Visuals.js +87 -0
  23. package/lib/ActionList2/hacks.d.ts +30 -0
  24. package/lib/ActionList2/hacks.js +38 -0
  25. package/lib/ActionList2/index.d.ts +26 -0
  26. package/lib/ActionList2/index.js +36 -0
  27. package/lib/Button/Button.js +1 -1
  28. package/lib/Button/ButtonTableList.js +1 -1
  29. package/lib/Pagination/Pagination.js +1 -1
  30. package/lib/_TextInputWrapper.js +1 -1
  31. package/lib/index.d.ts +1 -0
  32. package/lib/index.js +8 -0
  33. package/lib/utils/create-slots.d.ts +15 -0
  34. package/lib/utils/create-slots.js +101 -0
  35. package/lib/utils/use-force-update.d.ts +1 -0
  36. package/lib/utils/use-force-update.js +19 -0
  37. package/lib-esm/ActionList/Item.js +3 -3
  38. package/lib-esm/ActionList2/Description.d.ts +5 -0
  39. package/lib-esm/ActionList2/Description.js +30 -0
  40. package/lib-esm/ActionList2/Divider.d.ts +8 -0
  41. package/lib-esm/ActionList2/Divider.js +30 -0
  42. package/lib-esm/ActionList2/Group.d.ts +8 -0
  43. package/lib-esm/ActionList2/Group.js +29 -0
  44. package/lib-esm/ActionList2/Header.d.ts +26 -0
  45. package/lib-esm/ActionList2/Header.js +45 -0
  46. package/lib-esm/ActionList2/Item.d.ts +52 -0
  47. package/lib-esm/ActionList2/Item.js +172 -0
  48. package/lib-esm/ActionList2/List.d.ts +18 -0
  49. package/lib-esm/ActionList2/List.js +42 -0
  50. package/lib-esm/ActionList2/Selection.d.ts +5 -0
  51. package/lib-esm/ActionList2/Selection.js +50 -0
  52. package/lib-esm/ActionList2/Visuals.d.ts +12 -0
  53. package/lib-esm/ActionList2/Visuals.js +66 -0
  54. package/lib-esm/ActionList2/hacks.d.ts +30 -0
  55. package/lib-esm/ActionList2/hacks.js +30 -0
  56. package/lib-esm/ActionList2/index.d.ts +26 -0
  57. package/lib-esm/ActionList2/index.js +23 -0
  58. package/lib-esm/Button/Button.js +1 -1
  59. package/lib-esm/Button/ButtonTableList.js +1 -1
  60. package/lib-esm/Pagination/Pagination.js +1 -1
  61. package/lib-esm/_TextInputWrapper.js +1 -1
  62. package/lib-esm/index.d.ts +1 -0
  63. package/lib-esm/index.js +1 -0
  64. package/lib-esm/utils/create-slots.d.ts +15 -0
  65. package/lib-esm/utils/create-slots.js +80 -0
  66. package/lib-esm/utils/use-force-update.d.ts +1 -0
  67. package/lib-esm/utils/use-force-update.js +6 -0
  68. package/package.json +1 -1
@@ -0,0 +1,52 @@
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
+ * can use layoutEffect on server?
27
+ */
28
+ import React from 'react';
29
+ import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
30
+ import { SxProp } from '../sx';
31
+ export declare const getVariantStyles: (variant: ItemProps['variant'], disabled: ItemProps['disabled']) => {
32
+ color: (props: any) => any;
33
+ iconColor: (props: any) => any;
34
+ annotationColor: (props: any) => any;
35
+ } | {
36
+ color: string;
37
+ iconColor: string;
38
+ annotationColor: string;
39
+ };
40
+ declare const Slot: React.FC<{
41
+ name: "LeadingVisual" | "InlineDescription" | "BlockDescription" | "TrailingVisual";
42
+ }>;
43
+ export { Slot };
44
+ export declare type ItemProps = {
45
+ children: React.ReactNode;
46
+ onAction?: (event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void;
47
+ selected?: boolean;
48
+ variant?: 'default' | 'danger';
49
+ disabled?: boolean;
50
+ showDivider?: boolean;
51
+ } & SxProp;
52
+ export declare const Item: PolymorphicForwardRefComponent<"li", ItemProps>;
@@ -0,0 +1,172 @@
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
+ * test suite!
5
+ * id, role
6
+ * text could be non-text
7
+ * activeDescendantAttribute
8
+ * deepmerge sx
9
+ * nicer name for showDivider?
10
+ * aria-label
11
+ * aria-describedby
12
+ * React.FC<Props> doesn't allow id?
13
+ * truncate description
14
+ * icon color
15
+ * disabled checkbox
16
+ * check height with divider
17
+ *
18
+ * use immediate child slot API instead of double render?
19
+ * change as= li | div based on context of menu or not?
20
+ * check if everyone accepts sx prop
21
+ * link example outside of overlay? (details)
22
+ * if one item has selected, should we give all of them selected without the need to pass prop?
23
+ * move custom item themes to primitives?
24
+ * padding: 8 or 6?
25
+ * ActionList.Selection or ActionList.Item selected?
26
+ * different size for icon and avatar, range?
27
+ * minimize number of divs?
28
+ * can use layoutEffect on server?
29
+ */
30
+ import React from 'react';
31
+ import { useColorSchemeVar, useTheme } from '../ThemeProvider';
32
+ import Box from '../Box';
33
+ import { get } from '../constants';
34
+ import createSlots from '../utils/create-slots';
35
+ import { ListContext } from './List';
36
+ import { customItemThemes } from './hacks';
37
+ import { Selection } from './Selection';
38
+ export const getVariantStyles = (variant, disabled) => {
39
+ if (disabled) {
40
+ return {
41
+ color: get('colors.fg.muted'),
42
+ iconColor: get('colors.fg.muted'),
43
+ annotationColor: get('colors.fg.muted')
44
+ };
45
+ }
46
+
47
+ switch (variant) {
48
+ case 'danger':
49
+ return {
50
+ color: 'danger.fg',
51
+ iconColor: 'danger.fg',
52
+ annotationColor: 'fg.muted'
53
+ };
54
+
55
+ default:
56
+ return {
57
+ color: 'fg.default',
58
+ iconColor: 'fg.muted',
59
+ annotationColor: 'fg.muted'
60
+ };
61
+ }
62
+ };
63
+ const {
64
+ Slots,
65
+ Slot
66
+ } = createSlots(['LeadingVisual', 'InlineDescription', 'BlockDescription', 'TrailingVisual']);
67
+ export { Slot };
68
+ export const Item = /*#__PURE__*/React.forwardRef(({
69
+ variant = 'default',
70
+ disabled = false,
71
+ selected = undefined,
72
+ showDivider = false,
73
+ onAction = () => null,
74
+ sx = {},
75
+ ...props
76
+ }, forwardedRef) => {
77
+ const customItemTheme = customItemThemes[variant];
78
+ const {
79
+ variant: listVariant
80
+ } = React.useContext(ListContext);
81
+ const {
82
+ theme
83
+ } = useTheme();
84
+ const styles = {
85
+ display: 'flex',
86
+ paddingX: get('space.2'),
87
+ paddingY: '6px',
88
+ marginX: listVariant === 'inset' ? get('space.2') : 0,
89
+ minHeight: get('space.5'),
90
+ borderRadius: get('radii.2'),
91
+ transition: 'background 33.333ms linear',
92
+ color: getVariantStyles(variant, disabled).color,
93
+ textDecoration: 'none',
94
+ // for as="a"
95
+ ':not(disabled)': {
96
+ cursor: 'pointer'
97
+ },
98
+ '@media (hover: hover) and (pointer: fine)': {
99
+ ':hover': {
100
+ backgroundColor: useColorSchemeVar(customItemTheme.hover, 'inherit')
101
+ },
102
+ ':focus': {
103
+ backgroundColor: useColorSchemeVar(customItemTheme.focus, 'inherit')
104
+ }
105
+ },
106
+
107
+ /** Divider styles */
108
+ '[data-component="ActionList.Item--Main"]': {
109
+ position: 'relative'
110
+ },
111
+ '[data-component="ActionList.Item--Main"]::before': {
112
+ content: '" "',
113
+ display: 'block',
114
+ position: 'absolute',
115
+ width: '100%',
116
+ top: '-7px',
117
+ border: '0 solid',
118
+ borderTopWidth: showDivider ? `1px` : '0',
119
+ borderColor: 'var(--divider-color, transparent)'
120
+ },
121
+ // show between 2 items
122
+ ':not(:first-of-type)': {
123
+ '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.border.muted
124
+ },
125
+ // hide divider after dividers & group header
126
+ '[data-component="ActionList.Divider"] + &': {
127
+ '--divider-color': 'transparent'
128
+ },
129
+ // hide border on current and previous item
130
+ '&:hover, &:focus': {
131
+ '--divider-color': 'transparent'
132
+ },
133
+ '&:hover + &, &:focus + &': {
134
+ '--divider-color': 'transparent'
135
+ },
136
+ ...sx
137
+ };
138
+ const clickHandler = React.useCallback(event => {
139
+ if (disabled) return;
140
+ if (!event.defaultPrevented) onAction(event);
141
+ }, [onAction, disabled]);
142
+ return /*#__PURE__*/React.createElement(Slots, null, slots => /*#__PURE__*/React.createElement(Box, _extends({
143
+ as: "li",
144
+ sx: styles,
145
+ "data-component": "ActionList.Item",
146
+ onClick: clickHandler,
147
+ ref: forwardedRef
148
+ }, props), /*#__PURE__*/React.createElement(Selection, {
149
+ selected: selected,
150
+ disabled: disabled
151
+ }), slots.LeadingVisual, /*#__PURE__*/React.createElement(Box, {
152
+ "data-component": "ActionList.Item--Main",
153
+ sx: {
154
+ display: 'flex',
155
+ flexDirection: 'column',
156
+ flexGrow: 1,
157
+ minWidth: 0
158
+ }
159
+ }, /*#__PURE__*/React.createElement(Box, {
160
+ sx: {
161
+ display: 'flex'
162
+ }
163
+ }, /*#__PURE__*/React.createElement(Box, {
164
+ sx: {
165
+ display: 'flex',
166
+ flexGrow: 1,
167
+ alignItems: 'baseline',
168
+ minWidth: 0
169
+ }
170
+ }, /*#__PURE__*/React.createElement("span", null, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription)));
171
+ });
172
+ 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 {};
@@ -0,0 +1,42 @@
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
+ *
5
+ * showItemDividers
6
+ * deepmerge sx
7
+ * change as= ul | div based on context of menu or not?
8
+ * should selectionVariant be single by default or nothing. ask for explicit choice?
9
+ */
10
+ import React from 'react';
11
+ import Box from '../Box';
12
+ import { get } from '../constants';
13
+ export const ListContext = /*#__PURE__*/React.createContext({});
14
+ export const List = /*#__PURE__*/React.forwardRef(({
15
+ variant = 'inset',
16
+ selectionVariant = 'single',
17
+ sx = {},
18
+ ...props
19
+ }, forwardedRef) => {
20
+ const styles = {
21
+ margin: 0,
22
+ fontSize: get('fontSizes.1'),
23
+ lineHeight: '20px',
24
+ // TODO: check if we replace this already
25
+ paddingInlineStart: 0,
26
+ // reset ul styles
27
+ paddingY: variant === 'inset' ? get('space.2') : 0,
28
+ ...sx
29
+ };
30
+ return /*#__PURE__*/React.createElement(Box, _extends({
31
+ as: "ul",
32
+ sx: styles
33
+ }, props, {
34
+ ref: forwardedRef
35
+ }), /*#__PURE__*/React.createElement(ListContext.Provider, {
36
+ value: {
37
+ variant,
38
+ selectionVariant
39
+ }
40
+ }, props.children));
41
+ });
42
+ List.displayName = 'ActionList';
@@ -0,0 +1,5 @@
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 {};
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import { CheckIcon } from '@primer/octicons-react';
3
+ import { useTheme } from '../ThemeProvider';
4
+ import { ListContext } from './List';
5
+ import { LeadingVisualContainer } from './Visuals';
6
+ export const Selection = ({
7
+ selected,
8
+ disabled
9
+ }) => {
10
+ const {
11
+ selectionVariant
12
+ } = React.useContext(ListContext);
13
+ const {
14
+ theme
15
+ } = useTheme();
16
+ if (typeof selected === 'undefined') return null;
17
+
18
+ if (selectionVariant === 'single') {
19
+ return /*#__PURE__*/React.createElement(LeadingVisualContainer, null, selected && /*#__PURE__*/React.createElement(CheckIcon, {
20
+ fill: theme === null || theme === void 0 ? void 0 : theme.colors.text.primary
21
+ }));
22
+ }
23
+
24
+ if (selectionVariant === 'multiple') {
25
+ /**
26
+ * readOnly is required because we are doing a one-way bind to `checked`
27
+ * aria-readonly="false" tells screen that they can still interact with the checkbox
28
+ * TODO: not sure if disabled & aria-label be here or should we apply it on the instance as props
29
+ * TODO: aria-label should come from the text part of the slot
30
+ */
31
+ return /*#__PURE__*/React.createElement(LeadingVisualContainer, {
32
+ sx: {
33
+ input: {
34
+ margin: 0,
35
+ pointerEvents: 'none'
36
+ }
37
+ }
38
+ }, /*#__PURE__*/React.createElement("input", {
39
+ type: "checkbox",
40
+ checked: selected,
41
+ disabled: disabled,
42
+ "aria-label": "TODO",
43
+ tabIndex: -1,
44
+ readOnly: true,
45
+ "aria-readonly": "false"
46
+ }));
47
+ }
48
+
49
+ return null;
50
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { SxProp } from '../sx';
3
+ import { ItemProps } from './Item';
4
+ declare type VisualProps = Pick<ItemProps, 'variant' | 'disabled' | 'sx'> & {
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const LeadingVisualContainer: React.FC<SxProp>;
8
+ export declare type LeadingVisualProps = VisualProps;
9
+ export declare const LeadingVisual: React.FC<VisualProps>;
10
+ export declare type TrailingVisualProps = VisualProps;
11
+ export declare const TrailingVisual: React.FC<VisualProps>;
12
+ export {};
@@ -0,0 +1,66 @@
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 { get } from '../constants';
6
+ import { getVariantStyles, Slot } from './Item';
7
+ export const LeadingVisualContainer = ({
8
+ sx = {},
9
+ ...props
10
+ }) => {
11
+ return /*#__PURE__*/React.createElement(Box, _extends({
12
+ as: "span",
13
+ sx: {
14
+ height: '20px',
15
+ // match height of text row
16
+ minWidth: get('space.3'),
17
+ maxWidth: '20px',
18
+ // square (same as height)
19
+ display: 'flex',
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ flexShrink: 0,
23
+ marginRight: 2,
24
+ ...sx
25
+ }
26
+ }, props));
27
+ };
28
+ LeadingVisualContainer.displayName = "LeadingVisualContainer";
29
+ export const LeadingVisual = ({
30
+ variant,
31
+ disabled,
32
+ sx = {},
33
+ ...props
34
+ }) => {
35
+ return /*#__PURE__*/React.createElement(Slot, {
36
+ name: "LeadingVisual"
37
+ }, /*#__PURE__*/React.createElement(LeadingVisualContainer, _extends({
38
+ sx: {
39
+ color: getVariantStyles(variant, disabled).iconColor,
40
+ svg: {
41
+ fontSize: 0
42
+ },
43
+ ...sx
44
+ }
45
+ }, props), props.children));
46
+ };
47
+ LeadingVisual.displayName = "LeadingVisual";
48
+ export const TrailingVisual = ({
49
+ variant,
50
+ disabled,
51
+ ...props
52
+ }) => {
53
+ return /*#__PURE__*/React.createElement(Slot, {
54
+ name: "TrailingVisual"
55
+ }, /*#__PURE__*/React.createElement(Box, _extends({
56
+ as: "span",
57
+ sx: {
58
+ height: '20px',
59
+ // match height of text row
60
+ flexShrink: 0,
61
+ color: getVariantStyles(variant, disabled).annotationColor,
62
+ marginLeft: 2
63
+ }
64
+ }, props), props.children));
65
+ };
66
+ TrailingVisual.displayName = "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,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 const customItemThemes = {
6
+ default: {
7
+ hover: {
8
+ light: 'rgba(46, 77, 108, 0.06)',
9
+ dark: 'rgba(201, 206, 212, 0.12)',
10
+ dark_dimmed: 'rgba(201, 206, 212, 0.12)'
11
+ },
12
+ focus: {
13
+ light: 'rgba(54, 77, 100, 0.16)',
14
+ dark: 'rgba(201, 206, 212, 0.24)',
15
+ dark_dimmed: 'rgba(201, 206, 212, 0.24)'
16
+ }
17
+ },
18
+ danger: {
19
+ hover: {
20
+ light: 'rgba(234, 74, 90, 0.08)',
21
+ dark: 'rgba(248, 81, 73, 0.16)',
22
+ dark_dimmed: 'rgba(248, 81, 73, 0.16)'
23
+ },
24
+ focus: {
25
+ light: 'rgba(234, 74, 90, 0.14)',
26
+ dark: 'rgba(248, 81, 73, 0.24)',
27
+ dark_dimmed: 'rgba(248, 81, 73, 0.24)'
28
+ }
29
+ }
30
+ };
@@ -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,23 @@
1
+ import { List } from './List';
2
+ import { Group } from './Group';
3
+ import { Item } from './Item';
4
+ import { Divider } from './Divider';
5
+ import { Description } from './Description';
6
+ import { LeadingVisual, TrailingVisual } from './Visuals';
7
+
8
+ /**
9
+ * Collection of list-related components.
10
+ */
11
+ export const ActionList = Object.assign(List, {
12
+ /** Collects related `Items` in an `ActionList`. */
13
+ Group,
14
+
15
+ /** An actionable or selectable `Item` with an optional icon and description. */
16
+ Item,
17
+
18
+ /** Visually separates `Item`s or `Group`s in an `ActionList`. */
19
+ Divider,
20
+ Description,
21
+ LeadingVisual,
22
+ TrailingVisual
23
+ });
@@ -5,5 +5,5 @@ import ButtonBase, { buttonSystemProps } from './ButtonBase';
5
5
  const Button = styled(ButtonBase).withConfig({
6
6
  displayName: "Button",
7
7
  componentId: "xjtz72-0"
8
- })(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.primer.fg.disabled'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
8
+ })(["color:", ";background-color:", ";border:1px solid ", ";box-shadow:", ",", "};&:hover{background-color:", ";border-color:", ";}&:focus{border-color:", ";box-shadow:", ";}&:active{background-color:", ";box-shadow:", ";}&:disabled{color:", ";background-color:", ";border-color:", ";}", ";", ";"], get('colors.btn.text'), get('colors.btn.bg'), get('colors.btn.border'), get('shadows.btn.shadow'), get('shadows.btn.insetShadow'), get('colors.btn.hoverBg'), get('colors.btn.hoverBorder'), get('colors.btn.focusBorder'), get('shadows.btn.focusShadow'), get('colors.btn.selectedBg'), get('shadows.btn.shadowActive'), get('colors.fg.muted'), get('colors.btn.bg'), get('colors.btn.border'), buttonSystemProps, sx);
9
9
  export default Button;
@@ -4,5 +4,5 @@ import sx from '../sx';
4
4
  const ButtonTableList = styled.summary.withConfig({
5
5
  displayName: "ButtonTableList",
6
6
  componentId: "sc-1m4q8ia-0"
7
- })(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:", ";cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.muted'), get('colors.primer.fg.disabled'), get('space.1'), COMMON, TYPOGRAPHY, LAYOUT, sx);
7
+ })(["display:inline-block;padding:0;font-size:", ";color:", ";text-decoration:none;white-space:nowrap;cursor:pointer;user-select:none;background-color:transparent;border:0;appearance:none;&:hover{text-decoration:underline;}&:disabled{&,&:hover{color:rgba(", ",0.5);cursor:default;}}&:after{display:inline-block;margin-left:", ";width:0;height:0;vertical-align:-2px;content:'';border:4px solid transparent;border-top-color:currentcolor;}", " ", " ", " ", ";"], get('fontSizes.1'), get('colors.fg.muted'), get('colors.fg.muted'), get('space.1'), COMMON, TYPOGRAPHY, LAYOUT, sx);
8
8
  export default ButtonTableList;
@@ -9,7 +9,7 @@ import { buildComponentData, buildPaginationModel } from './model';
9
9
  const Page = styled.a.withConfig({
10
10
  displayName: "Pagination__Page",
11
11
  componentId: "b80nss-0"
12
- })(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.primer.fg.disabled'), get('space.1'), get('space.1'), COMMON);
12
+ })(["display:inline-block;min-width:32px;padding:5px 10px;font-style:normal;line-height:20px;color:", ";text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;user-select:none;text-decoration:none;margin-right:", ";&:last-child{margin-right:0;}border:", " solid transparent;border-radius:", ";transition:border-color 0.2s cubic-bezier(0.3,0,0.5,1);&:hover,&:focus{text-decoration:none;border-color:", ";outline:0;transition-duration:0.1s;}&:active{border-color:", ";}&[rel='prev'],&[rel='next']{color:", ";}&[aria-current],&[aria-current]:hover{color:", ";background-color:", ";border-color:transparent;}&[aria-disabled],&[aria-disabled]:hover{color:", ";cursor:default;border-color:transparent;}@supports (clip-path:polygon(50% 0,100% 50%,50% 100%)){&[rel='prev']::before,&[rel='next']::after{display:inline-block;width:16px;height:16px;vertical-align:text-bottom;content:'';background-color:currentColor;}&[rel='prev']::before{margin-right:", ";clip-path:polygon( 9.8px 12.8px,8.7px 12.8px,4.5px 8.5px,4.5px 7.5px,8.7px 3.2px,9.8px 4.3px,6.1px 8px,9.8px 11.7px,9.8px 12.8px );}&[rel='next']::after{margin-left:", ";clip-path:polygon( 6.2px 3.2px,7.3px 3.2px,11.5px 7.5px,11.5px 8.5px,7.3px 12.8px,6.2px 11.7px,9.9px 8px,6.2px 4.3px,6.2px 3.2px );}}", ";"], get('colors.fg.default'), get('space.1'), get('borderWidths.1'), get('radii.2'), get('colors.border.default'), get('colors.border.muted'), get('colors.accent.fg'), get('colors.fg.onEmphasis'), get('colors.accent.emphasis'), get('colors.fg.muted'), get('space.1'), get('space.1'), COMMON);
13
13
 
14
14
  function usePaginationPages({
15
15
  theme,
@@ -27,5 +27,5 @@ const TextInputWrapper = styled.span.withConfig({
27
27
  } else {
28
28
  return css(["padding:6px 12px;"]);
29
29
  }
30
- }, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.primer.fg.disabled'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx);
30
+ }, get('colors.fg.muted'), get('space.2'), get('colors.accent.emphasis'), get('shadows.primer.shadow.focus'), props => props.contrast && css(["background-color:", ";"], get('colors.canvas.inset')), props => props.disabled && css(["color:", ";background-color:", ";border-color:", ";"], get('colors.fg.muted'), get('colors.input.disabledBg'), get('colors.border.default')), props => props.block && css(["display:block;width:100%;"]), get('breakpoints.1'), get('fontSizes.1'), width, minWidth, maxWidth, sizeVariants, sx);
31
31
  export default TextInputWrapper;
@@ -22,6 +22,7 @@ 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';
25
26
  export { ActionMenu } from './ActionMenu';
26
27
  export type { ActionMenuProps } from './ActionMenu';
27
28
  export { default as Autocomplete } from './Autocomplete';
package/lib-esm/index.js CHANGED
@@ -18,6 +18,7 @@ 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';
21
22
  export { ActionMenu } from './ActionMenu';
22
23
  export { default as Autocomplete } from './Autocomplete';
23
24
  export { default as Avatar } from './Avatar';
@@ -0,0 +1,15 @@
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
+ children: (slots: { [key in SlotNames]?: React.ReactNode; }) => React.ReactNode;
10
+ }>;
11
+ Slot: React.FC<{
12
+ name: SlotNames;
13
+ }>;
14
+ };
15
+ export default createSlots;