@primer/components 0.0.0-2021108143910 → 0.0.0-2021108205537

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 (110) hide show
  1. package/CHANGELOG.md +5 -3
  2. package/dist/browser.esm.js +472 -473
  3. package/dist/browser.esm.js.map +1 -1
  4. package/dist/browser.umd.js +73 -74
  5. package/dist/browser.umd.js.map +1 -1
  6. package/lib/Autocomplete/Autocomplete.d.ts +28 -28
  7. package/lib/Autocomplete/AutocompleteInput.d.ts +28 -28
  8. package/lib/Button/Button.d.ts +25 -25
  9. package/lib/Button/ButtonClose.d.ts +45 -45
  10. package/lib/Button/ButtonDanger.d.ts +25 -25
  11. package/lib/Button/ButtonInvisible.d.ts +25 -25
  12. package/lib/Button/ButtonOutline.d.ts +25 -25
  13. package/lib/Button/ButtonPrimary.d.ts +25 -25
  14. package/lib/CircleOcticon.d.ts +42 -42
  15. package/lib/Dialog.d.ts +45 -45
  16. package/lib/Dropdown.d.ts +176 -176
  17. package/lib/DropdownMenu/DropdownButton.d.ts +46 -46
  18. package/lib/FilterList.d.ts +42 -42
  19. package/lib/Position.d.ts +4 -4
  20. package/lib/SelectMenu/SelectMenu.d.ts +246 -246
  21. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  22. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  23. package/lib/SideNav.d.ts +11 -8
  24. package/lib/SideNav.js +8 -15
  25. package/lib/TextInputWithTokens.d.ts +28 -28
  26. package/lib/Timeline.d.ts +43 -43
  27. package/lib/Token/AvatarToken.d.ts +1 -1
  28. package/lib/Token/IssueLabelToken.d.ts +1 -1
  29. package/lib/Token/Token.d.ts +1 -1
  30. package/lib/sx.d.ts +0 -2
  31. package/lib/sx.js +0 -8
  32. package/lib/theme-preval.js +2 -81
  33. package/lib/utils/testing.d.ts +1 -14
  34. package/lib-esm/Autocomplete/Autocomplete.d.ts +28 -28
  35. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +28 -28
  36. package/lib-esm/Button/Button.d.ts +25 -25
  37. package/lib-esm/Button/ButtonClose.d.ts +45 -45
  38. package/lib-esm/Button/ButtonDanger.d.ts +25 -25
  39. package/lib-esm/Button/ButtonInvisible.d.ts +25 -25
  40. package/lib-esm/Button/ButtonOutline.d.ts +25 -25
  41. package/lib-esm/Button/ButtonPrimary.d.ts +25 -25
  42. package/lib-esm/CircleOcticon.d.ts +42 -42
  43. package/lib-esm/Dialog.d.ts +45 -45
  44. package/lib-esm/Dropdown.d.ts +176 -176
  45. package/lib-esm/DropdownMenu/DropdownButton.d.ts +46 -46
  46. package/lib-esm/FilterList.d.ts +42 -42
  47. package/lib-esm/Position.d.ts +4 -4
  48. package/lib-esm/SelectMenu/SelectMenu.d.ts +246 -246
  49. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  50. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  51. package/lib-esm/SideNav.d.ts +11 -8
  52. package/lib-esm/SideNav.js +8 -16
  53. package/lib-esm/TextInputWithTokens.d.ts +28 -28
  54. package/lib-esm/Timeline.d.ts +43 -43
  55. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  56. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  57. package/lib-esm/Token/Token.d.ts +1 -1
  58. package/lib-esm/sx.d.ts +0 -2
  59. package/lib-esm/sx.js +1 -3
  60. package/lib-esm/theme-preval.js +2 -81
  61. package/lib-esm/utils/testing.d.ts +1 -14
  62. package/package.json +2 -4
  63. package/lib/ActionList2/Description.d.ts +0 -12
  64. package/lib/ActionList2/Description.js +0 -53
  65. package/lib/ActionList2/Divider.d.ts +0 -5
  66. package/lib/ActionList2/Divider.js +0 -35
  67. package/lib/ActionList2/Group.d.ts +0 -32
  68. package/lib/ActionList2/Group.js +0 -104
  69. package/lib/ActionList2/Item.d.ts +0 -71
  70. package/lib/ActionList2/Item.js +0 -234
  71. package/lib/ActionList2/LinkItem.d.ts +0 -17
  72. package/lib/ActionList2/LinkItem.js +0 -57
  73. package/lib/ActionList2/List.d.ts +0 -26
  74. package/lib/ActionList2/List.js +0 -59
  75. package/lib/ActionList2/Selection.d.ts +0 -5
  76. package/lib/ActionList2/Selection.js +0 -70
  77. package/lib/ActionList2/Visuals.d.ts +0 -11
  78. package/lib/ActionList2/Visuals.js +0 -90
  79. package/lib/ActionList2/index.d.ts +0 -40
  80. package/lib/ActionList2/index.js +0 -47
  81. package/lib/experiments.d.ts +0 -1
  82. package/lib/experiments.js +0 -18
  83. package/lib/utils/create-slots.d.ts +0 -17
  84. package/lib/utils/create-slots.js +0 -105
  85. package/lib/utils/use-force-update.d.ts +0 -1
  86. package/lib/utils/use-force-update.js +0 -19
  87. package/lib-esm/ActionList2/Description.d.ts +0 -12
  88. package/lib-esm/ActionList2/Description.js +0 -37
  89. package/lib-esm/ActionList2/Divider.d.ts +0 -5
  90. package/lib-esm/ActionList2/Divider.js +0 -23
  91. package/lib-esm/ActionList2/Group.d.ts +0 -32
  92. package/lib-esm/ActionList2/Group.js +0 -85
  93. package/lib-esm/ActionList2/Item.d.ts +0 -71
  94. package/lib-esm/ActionList2/Item.js +0 -201
  95. package/lib-esm/ActionList2/LinkItem.d.ts +0 -17
  96. package/lib-esm/ActionList2/LinkItem.js +0 -43
  97. package/lib-esm/ActionList2/List.d.ts +0 -26
  98. package/lib-esm/ActionList2/List.js +0 -37
  99. package/lib-esm/ActionList2/Selection.d.ts +0 -5
  100. package/lib-esm/ActionList2/Selection.js +0 -52
  101. package/lib-esm/ActionList2/Visuals.d.ts +0 -11
  102. package/lib-esm/ActionList2/Visuals.js +0 -68
  103. package/lib-esm/ActionList2/index.d.ts +0 -40
  104. package/lib-esm/ActionList2/index.js +0 -33
  105. package/lib-esm/experiments.d.ts +0 -1
  106. package/lib-esm/experiments.js +0 -2
  107. package/lib-esm/utils/create-slots.d.ts +0 -17
  108. package/lib-esm/utils/create-slots.js +0 -84
  109. package/lib-esm/utils/use-force-update.d.ts +0 -1
  110. package/lib-esm/utils/use-force-update.js +0 -6
@@ -1,234 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Item = exports.TEXT_ROW_HEIGHT = exports.Slot = exports.getVariantStyles = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _ssr = require("@react-aria/ssr");
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _ThemeProvider = require("../ThemeProvider");
15
-
16
- var _Box = _interopRequireDefault(require("../Box"));
17
-
18
- var _sx = _interopRequireWildcard(require("../sx"));
19
-
20
- var _createSlots = _interopRequireDefault(require("../utils/create-slots"));
21
-
22
- var _List = require("./List");
23
-
24
- var _Selection = require("./Selection");
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
- 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); }
33
-
34
- const getVariantStyles = (variant, disabled) => {
35
- if (disabled) {
36
- return {
37
- color: 'fg.muted',
38
- iconColor: 'fg.muted',
39
- annotationColor: 'fg.muted'
40
- };
41
- }
42
-
43
- switch (variant) {
44
- case 'danger':
45
- return {
46
- color: 'danger.fg',
47
- iconColor: 'danger.fg',
48
- annotationColor: 'fg.muted',
49
- hoverColor: 'actionListItem.danger.hoverText'
50
- };
51
-
52
- default:
53
- return {
54
- color: 'fg.default',
55
- iconColor: 'fg.muted',
56
- annotationColor: 'fg.muted',
57
- hoverColor: 'fg.default',
58
- selectedBg: 'actionListItem.default.selectedBg'
59
- };
60
- }
61
- };
62
-
63
- exports.getVariantStyles = getVariantStyles;
64
- const {
65
- Slots,
66
- Slot
67
- } = (0, _createSlots.default)(['LeadingVisual', 'InlineDescription', 'BlockDescription', 'TrailingVisual']);
68
- exports.Slot = Slot;
69
-
70
- const LiBox = _styledComponents.default.li.withConfig({
71
- displayName: "Item__LiBox",
72
- componentId: "c3scat-0"
73
- })(_sx.default);
74
-
75
- const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
76
-
77
- exports.TEXT_ROW_HEIGHT = TEXT_ROW_HEIGHT;
78
-
79
- const Item = /*#__PURE__*/_react.default.forwardRef(({
80
- variant = 'default',
81
- disabled = false,
82
- selected = undefined,
83
- onSelect = () => null,
84
- sx: propsSx = {},
85
- id,
86
- _PrivateItemWrapper = ({
87
- children
88
- }) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children),
89
- ...props
90
- }, forwardedRef) => {
91
- const {
92
- variant: listVariant,
93
- showDividers
94
- } = _react.default.useContext(_List.ListContext);
95
-
96
- const {
97
- theme
98
- } = (0, _ThemeProvider.useTheme)();
99
- const styles = {
100
- display: 'flex',
101
- paddingX: 2,
102
- fontSize: 1,
103
- paddingY: '6px',
104
- // custom value off the scale
105
- lineHeight: TEXT_ROW_HEIGHT,
106
- marginX: listVariant === 'inset' ? 2 : 0,
107
- minHeight: 5,
108
- borderRadius: 2,
109
- transition: 'background 33.333ms linear',
110
- color: getVariantStyles(variant, disabled).color,
111
- textDecoration: 'none',
112
- // for as="a"
113
- '&[aria-selected=true]': {
114
- backgroundColor: getVariantStyles(variant, disabled).selectedBg
115
- },
116
- ':not([aria-disabled])': {
117
- cursor: 'pointer'
118
- },
119
- '@media (hover: hover) and (pointer: fine)': {
120
- ':hover:not([aria-disabled])': {
121
- backgroundColor: `actionListItem.${variant}.hoverBg`,
122
- color: getVariantStyles(variant, disabled).hoverColor
123
- },
124
- ':focus:not([aria-disabled])': {
125
- backgroundColor: `actionListItem.${variant}.activeBg`,
126
- color: getVariantStyles(variant, disabled).hoverColor,
127
- outline: 'none'
128
- }
129
- },
130
-
131
- /** Divider styles */
132
- '[data-component="ActionList.Item--DividerContainer"]': {
133
- position: 'relative'
134
- },
135
- '[data-component="ActionList.Item--DividerContainer"]::before': {
136
- content: '" "',
137
- display: 'block',
138
- position: 'absolute',
139
- width: '100%',
140
- top: '-7px',
141
- border: '0 solid',
142
- borderTopWidth: showDividers ? `1px` : '0',
143
- borderColor: 'var(--divider-color, transparent)'
144
- },
145
- // show between 2 items
146
- ':not(:first-of-type):not([aria-selected=true])': {
147
- '--divider-color': theme === null || theme === void 0 ? void 0 : theme.colors.actionListItem.inlineDivider
148
- },
149
- // hide divider after dividers & group header, with higher importance!
150
- '[data-component="ActionList.Divider"] + &': {
151
- '--divider-color': 'transparent !important'
152
- },
153
- // hide border on current and previous item
154
- '&:hover:not([aria-disabled]), &:focus:not([aria-disabled])': {
155
- '--divider-color': 'transparent'
156
- },
157
- '&:hover:not([aria-disabled]) + &, &:focus:not([aria-disabled]) + &': {
158
- '--divider-color': 'transparent'
159
- },
160
- // hide border around selected item
161
- '&[aria-selected=true] + &': {
162
- '--divider-color': 'transparent'
163
- }
164
- };
165
-
166
- const clickHandler = _react.default.useCallback(event => {
167
- if (disabled) return;
168
- if (!event.defaultPrevented) onSelect(event);
169
- }, [onSelect, disabled]); // use props.id if provided, otherwise generate one.
170
-
171
-
172
- const labelId = (0, _ssr.useSSRSafeId)(id);
173
- const inlineDescriptionId = (0, _ssr.useSSRSafeId)(id && `${id}--inline-description`);
174
- const blockDescriptionId = (0, _ssr.useSSRSafeId)(id && `${id}--block-description`);
175
- return /*#__PURE__*/_react.default.createElement(Slots, {
176
- context: {
177
- variant,
178
- disabled,
179
- inlineDescriptionId,
180
- blockDescriptionId
181
- }
182
- }, slots => /*#__PURE__*/_react.default.createElement(LiBox, _extends({
183
- ref: forwardedRef,
184
- sx: (0, _sx.merge)(styles, propsSx),
185
- onClick: clickHandler,
186
- "aria-selected": selected,
187
- "aria-disabled": disabled ? true : undefined,
188
- tabIndex: disabled ? undefined : -1,
189
- "aria-labelledby": labelId,
190
- "aria-describedby": [slots.InlineDescription && inlineDescriptionId, slots.BlockDescription && blockDescriptionId].filter(Boolean).join(' ')
191
- }, props), /*#__PURE__*/_react.default.createElement(_PrivateItemWrapper, null, /*#__PURE__*/_react.default.createElement(_Selection.Selection, {
192
- selected: selected,
193
- disabled: disabled
194
- }), slots.LeadingVisual, /*#__PURE__*/_react.default.createElement(_Box.default, {
195
- "data-component": "ActionList.Item--DividerContainer",
196
- sx: {
197
- display: 'flex',
198
- flexDirection: 'column',
199
- flexGrow: 1,
200
- minWidth: 0
201
- }
202
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
203
- if: Boolean(slots.TrailingVisual),
204
- sx: {
205
- display: 'flex',
206
- flexGrow: 1
207
- }
208
- }, /*#__PURE__*/_react.default.createElement(ConditionalBox, {
209
- if: Boolean(slots.InlineDescription),
210
- sx: {
211
- display: 'flex',
212
- flexGrow: 1,
213
- alignItems: 'baseline',
214
- minWidth: 0
215
- }
216
- }, /*#__PURE__*/_react.default.createElement(_Box.default, {
217
- as: "span",
218
- id: labelId,
219
- sx: {
220
- flexGrow: slots.InlineDescription ? 0 : 1
221
- }
222
- }, props.children), slots.InlineDescription), slots.TrailingVisual), slots.BlockDescription))));
223
- });
224
-
225
- exports.Item = Item;
226
- Item.displayName = 'ActionList.Item';
227
-
228
- const ConditionalBox = props => {
229
- const {
230
- if: condition,
231
- ...rest
232
- } = props;
233
- if (condition) return /*#__PURE__*/_react.default.createElement(_Box.default, rest, props.children);else return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
234
- };
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { ForwardRefComponent as PolymorphicForwardRefComponent } from '@radix-ui/react-polymorphic';
3
- import { ItemProps } from './Item';
4
- declare type LinkProps = {
5
- download?: string;
6
- href?: string;
7
- hrefLang?: string;
8
- media?: string;
9
- ping?: string;
10
- rel?: string;
11
- target?: string;
12
- type?: string;
13
- referrerPolicy?: React.AnchorHTMLAttributes<HTMLAnchorElement>['referrerPolicy'];
14
- };
15
- declare type LinkItemProps = Pick<ItemProps, 'children' | 'sx'> & LinkProps;
16
- export declare const LinkItem: PolymorphicForwardRefComponent<"a", LinkItemProps>;
17
- export {};
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.LinkItem = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _Link = _interopRequireDefault(require("../Link"));
11
-
12
- var _sx = require("../sx");
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 LinkItem = /*#__PURE__*/_react.default.forwardRef(({
21
- sx = {},
22
- as: Component,
23
- ...props
24
- }, forwardedRef) => {
25
- const styles = {
26
- // occupy full size of Item
27
- paddingX: 2,
28
- paddingY: '6px',
29
- // custom value off the scale
30
- display: 'flex',
31
- flexGrow: 1,
32
- // full width
33
- borderRadius: 2,
34
- // inherit Item styles
35
- color: 'inherit',
36
- '&:hover': {
37
- color: 'inherit',
38
- textDecoration: 'none'
39
- }
40
- };
41
- return /*#__PURE__*/_react.default.createElement(_Item.Item, {
42
- sx: {
43
- paddingY: 0,
44
- paddingX: 0
45
- },
46
- _PrivateItemWrapper: ({
47
- children
48
- }) => /*#__PURE__*/_react.default.createElement(_Link.default, _extends({
49
- as: Component,
50
- sx: (0, _sx.merge)(styles, sx)
51
- }, props, {
52
- ref: forwardedRef
53
- }), children)
54
- }, props.children);
55
- });
56
-
57
- exports.LinkItem = LinkItem;
@@ -1,26 +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 type ListProps = {
6
- /**
7
- * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges
8
- */
9
- variant?: 'inset' | 'full';
10
- /**
11
- * Whether multiple Items or a single Item can be selected.
12
- */
13
- selectionVariant?: 'single' | 'multiple';
14
- /**
15
- * Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
16
- */
17
- showDividers?: boolean;
18
- /**
19
- * The ARIA role describing the function of `List` component. `listbox` or `menu` are a common values.
20
- */
21
- role?: AriaRole;
22
- } & SxProp;
23
- declare type ContextProps = Omit<ListProps, 'sx'>;
24
- export declare const ListContext: React.Context<ContextProps>;
25
- export declare const List: PolymorphicForwardRefComponent<"ul", ListProps>;
26
- export {};
@@ -1,59 +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 _styledComponents = _interopRequireDefault(require("styled-components"));
11
-
12
- var _sx = _interopRequireWildcard(require("../sx"));
13
-
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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); }
21
-
22
- const ListContext = /*#__PURE__*/_react.default.createContext({});
23
-
24
- exports.ListContext = ListContext;
25
-
26
- const ListBox = _styledComponents.default.ul.withConfig({
27
- displayName: "List__ListBox",
28
- componentId: "cvbq60-0"
29
- })(_sx.default);
30
-
31
- const List = /*#__PURE__*/_react.default.forwardRef(({
32
- variant = 'inset',
33
- selectionVariant,
34
- showDividers = false,
35
- sx: propsSx = {},
36
- ...props
37
- }, forwardedRef) => {
38
- const styles = {
39
- margin: 0,
40
- paddingInlineStart: 0,
41
- // reset ul styles
42
- paddingY: variant === 'inset' ? 2 : 0
43
- };
44
- return /*#__PURE__*/_react.default.createElement(ListBox, _extends({
45
- sx: (0, _sx.merge)(styles, propsSx),
46
- "aria-multiselectable": selectionVariant === 'multiple' ? true : undefined
47
- }, props, {
48
- ref: forwardedRef
49
- }), /*#__PURE__*/_react.default.createElement(ListContext.Provider, {
50
- value: {
51
- variant,
52
- selectionVariant,
53
- showDividers
54
- }
55
- }, props.children));
56
- });
57
-
58
- exports.List = List;
59
- 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 {};
@@ -1,70 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Selection = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _octiconsReact = require("@primer/octicons-react");
11
-
12
- var _List = require("./List");
13
-
14
- var _Group = require("./Group");
15
-
16
- var _Visuals = require("./Visuals");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- const Selection = ({
21
- selected,
22
- disabled
23
- }) => {
24
- const {
25
- selectionVariant: listSelectionVariant
26
- } = _react.default.useContext(_List.ListContext);
27
-
28
- const {
29
- selectionVariant: groupSelectionVariant
30
- } = _react.default.useContext(_Group.GroupContext);
31
- /** selectionVariant in Group can override the selectionVariant in List root */
32
-
33
-
34
- const selectionVariant = typeof groupSelectionVariant !== 'undefined' ? groupSelectionVariant : listSelectionVariant; // if selectionVariant is not set on List, don't show selection
35
-
36
- if (!selectionVariant) {
37
- // to avoid confusion, fail loudly instead of silently ignoring
38
- if (selected) throw new Error('For Item to be selected, ActionList or ActionList.Group needs to have a selectionVariant defined');
39
- return null;
40
- }
41
-
42
- if (selectionVariant === 'single') {
43
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, null, selected && /*#__PURE__*/_react.default.createElement(_octiconsReact.CheckIcon, null));
44
- }
45
- /**
46
- * selectionVariant is multiple
47
- * readOnly is required because we are doing a one-way bind to `checked`
48
- * aria-readonly="false" tells screen that they can still interact with the checkbox
49
- */
50
-
51
-
52
- return /*#__PURE__*/_react.default.createElement(_Visuals.LeadingVisualContainer, {
53
- sx: {
54
- input: {
55
- margin: 0,
56
- pointerEvents: 'none'
57
- }
58
- }
59
- }, /*#__PURE__*/_react.default.createElement("input", {
60
- type: "checkbox",
61
- checked: selected,
62
- disabled: disabled,
63
- tabIndex: -1,
64
- readOnly: true,
65
- "aria-readonly": "false"
66
- }));
67
- };
68
-
69
- exports.Selection = Selection;
70
- Selection.displayName = "Selection";
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { SxProp } from '../sx';
3
- declare type VisualProps = SxProp & {
4
- children: React.ReactNode;
5
- };
6
- export declare const LeadingVisualContainer: React.FC<SxProp>;
7
- export declare type LeadingVisualProps = VisualProps;
8
- export declare const LeadingVisual: React.FC<VisualProps>;
9
- export declare type TrailingVisualProps = VisualProps;
10
- export declare const TrailingVisual: React.FC<VisualProps>;
11
- export {};
@@ -1,90 +0,0 @@
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 _sx = require("../sx");
13
-
14
- var _constants = require("../constants");
15
-
16
- var _Item = require("./Item");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- 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); }
21
-
22
- const LeadingVisualContainer = ({
23
- sx = {},
24
- ...props
25
- }) => {
26
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
27
- as: "span",
28
- sx: (0, _sx.merge)({
29
- height: _Item.TEXT_ROW_HEIGHT,
30
- // match height of text row
31
- minWidth: (0, _constants.get)('space.3'),
32
- maxWidth: _Item.TEXT_ROW_HEIGHT,
33
- // square (same as height)
34
- display: 'flex',
35
- justifyContent: 'center',
36
- alignItems: 'center',
37
- flexShrink: 0,
38
- marginRight: 2
39
- }, sx)
40
- }, props));
41
- };
42
-
43
- exports.LeadingVisualContainer = LeadingVisualContainer;
44
- LeadingVisualContainer.displayName = "LeadingVisualContainer";
45
-
46
- const LeadingVisual = ({
47
- sx = {},
48
- ...props
49
- }) => {
50
- return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
51
- name: "LeadingVisual"
52
- }, ({
53
- variant,
54
- disabled
55
- }) => /*#__PURE__*/_react.default.createElement(LeadingVisualContainer, _extends({
56
- sx: (0, _sx.merge)({
57
- color: (0, _Item.getVariantStyles)(variant, disabled).iconColor,
58
- svg: {
59
- fontSize: 0
60
- }
61
- }, sx)
62
- }, props), props.children));
63
- };
64
-
65
- exports.LeadingVisual = LeadingVisual;
66
- LeadingVisual.displayName = "LeadingVisual";
67
-
68
- const TrailingVisual = ({
69
- sx = {},
70
- ...props
71
- }) => {
72
- return /*#__PURE__*/_react.default.createElement(_Item.Slot, {
73
- name: "TrailingVisual"
74
- }, ({
75
- variant,
76
- disabled
77
- }) => /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
78
- as: "span",
79
- sx: (0, _sx.merge)({
80
- height: '20px',
81
- // match height of text row
82
- flexShrink: 0,
83
- color: (0, _Item.getVariantStyles)(variant, disabled).annotationColor,
84
- marginLeft: 2
85
- }, sx)
86
- }, props), props.children));
87
- };
88
-
89
- exports.TrailingVisual = TrailingVisual;
90
- TrailingVisual.displayName = "TrailingVisual";
@@ -1,40 +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
- /** A `Item` that renders a full-size anchor inside ListItem */
17
- LinkItem: import("@radix-ui/react-polymorphic").ForwardRefComponent<"a", Pick<import("./Item").ItemProps, "children" | "sx"> & {
18
- download?: string | undefined;
19
- href?: string | undefined;
20
- hrefLang?: string | undefined;
21
- media?: string | undefined;
22
- ping?: string | undefined;
23
- rel?: string | undefined;
24
- target?: string | undefined;
25
- type?: string | undefined;
26
- referrerPolicy?: import("react").HTMLAttributeReferrerPolicy | undefined;
27
- }>;
28
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
29
- Divider: typeof Divider;
30
- /** Secondary text which provides additional information about an `Item`. */
31
- Description: import("react").FC<import("./Description").DescriptionProps>;
32
- /** Icon (or similar) positioned before `Item` text. */
33
- LeadingVisual: import("react").FC<import("../sx").SxProp & {
34
- children: import("react").ReactNode;
35
- }>;
36
- /** Icon (or similar) positioned after `Item` text. */
37
- TrailingVisual: import("react").FC<import("../sx").SxProp & {
38
- children: import("react").ReactNode;
39
- }>;
40
- };
@@ -1,47 +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 _LinkItem = require("./LinkItem");
15
-
16
- var _Divider = require("./Divider");
17
-
18
- var _Description = require("./Description");
19
-
20
- var _Visuals = require("./Visuals");
21
-
22
- /**
23
- * Collection of list-related components.
24
- */
25
- const ActionList = Object.assign(_List.List, {
26
- /** Collects related `Items` in an `ActionList`. */
27
- Group: _Group.Group,
28
-
29
- /** An actionable or selectable `Item` */
30
- Item: _Item.Item,
31
-
32
- /** A `Item` that renders a full-size anchor inside ListItem */
33
- LinkItem: _LinkItem.LinkItem,
34
-
35
- /** Visually separates `Item`s or `Group`s in an `ActionList`. */
36
- Divider: _Divider.Divider,
37
-
38
- /** Secondary text which provides additional information about an `Item`. */
39
- Description: _Description.Description,
40
-
41
- /** Icon (or similar) positioned before `Item` text. */
42
- LeadingVisual: _Visuals.LeadingVisual,
43
-
44
- /** Icon (or similar) positioned after `Item` text. */
45
- TrailingVisual: _Visuals.TrailingVisual
46
- });
47
- exports.ActionList = ActionList;
@@ -1 +0,0 @@
1
- export * from './ActionList2';