@primer/react 38.0.0-rc.1 → 38.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/browser.esm.js +3 -3
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +3 -3
- package/dist/browser.umd.js.map +1 -1
- package/dist/components.css +660 -23
- package/generated/components.json +58 -121
- package/lib/AvatarStack/AvatarStack.d.ts +2 -3
- package/lib/AvatarStack/AvatarStack.d.ts.map +1 -1
- package/lib/AvatarStack/AvatarStack.js +1 -3
- package/lib/Banner/Banner.d.ts.map +1 -1
- package/lib/Banner/Banner.js +3 -1
- package/lib/Blankslate/Blankslate.js +38 -40
- package/lib/BranchName/BranchName.d.ts +6 -3
- package/lib/BranchName/BranchName.d.ts.map +1 -1
- package/lib/BranchName/BranchName.js +1 -3
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Checkbox/Checkbox.js +187 -56
- package/lib/CircleBadge/CircleBadge.d.ts +4 -0
- package/lib/CircleBadge/CircleBadge.d.ts.map +1 -1
- package/lib/CircleBadge/CircleBadge.js +4 -0
- package/lib/DataTable/useTable.js +63 -82
- package/lib/Details/Details.d.ts +2 -3
- package/lib/Details/Details.d.ts.map +1 -1
- package/lib/Details/Details.js +1 -3
- package/lib/FeatureFlags/FeatureFlags.js +10 -12
- package/lib/FilteredActionList/useAnnouncements.js +31 -40
- package/lib/LabelGroup/LabelGroup.d.ts +1 -2
- package/lib/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/lib/LabelGroup/LabelGroup.js +13 -16
- package/lib/NavList/NavList.js +219 -53
- package/lib/PageLayout/PageLayout.js +53 -55
- package/lib/PointerBox/PointerBox.d.ts +8 -0
- package/lib/PointerBox/PointerBox.d.ts.map +1 -1
- package/lib/PointerBox/PointerBox.js +4 -0
- package/{lib-esm/ProgressBar/ProgressBar-a0957632.css → lib/ProgressBar/ProgressBar-36f689cb.css} +2 -2
- package/lib/ProgressBar/ProgressBar-36f689cb.css.map +1 -0
- package/lib/ProgressBar/ProgressBar.d.ts +3 -4
- package/lib/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/lib/ProgressBar/ProgressBar.module.css.js +1 -1
- package/lib/ProgressBar/index.d.ts +2 -2
- package/lib/ProgressBar/index.d.ts.map +1 -1
- package/lib/Select/Select.d.ts +1 -1
- package/lib/Select/Select.d.ts.map +1 -1
- package/lib/Select/Select.js +53 -65
- package/lib/SelectPanel/{SelectPanel-06900070.css → SelectPanel-e11ce210.css} +2 -2
- package/lib/SelectPanel/SelectPanel-e11ce210.css.map +1 -0
- package/lib/SelectPanel/SelectPanel.d.ts +1 -1
- package/lib/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/lib/SelectPanel/SelectPanel.js +2 -9
- package/lib/SelectPanel/SelectPanel.module.css.js +2 -2
- package/lib/SideNav.d.ts +2 -3
- package/lib/SideNav.d.ts.map +1 -1
- package/lib/SideNav.js +4 -10
- package/lib/StateLabel/StateLabel-50420ff5.css +2 -0
- package/lib/StateLabel/StateLabel-50420ff5.css.map +1 -0
- package/lib/StateLabel/StateLabel.d.ts +6 -5
- package/lib/StateLabel/StateLabel.d.ts.map +1 -1
- package/lib/StateLabel/StateLabel.js +54 -126
- package/lib/StateLabel/StateLabel.module.css.js +2 -2
- package/lib/TextInputWithTokens/TextInputWithTokens.d.ts +6 -0
- package/lib/TextInputWithTokens/TextInputWithTokens.d.ts.map +1 -1
- package/lib/TextInputWithTokens/TextInputWithTokens.js +343 -331
- package/lib/ToggleSwitch/ToggleSwitch-4b23d166.css +2 -0
- package/lib/ToggleSwitch/ToggleSwitch-4b23d166.css.map +1 -0
- package/lib/ToggleSwitch/ToggleSwitch.d.ts +1 -3
- package/lib/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +120 -152
- package/lib/ToggleSwitch/ToggleSwitch.module.css.js +2 -2
- package/lib/Token/IssueLabelToken-0dbbbcdf.css +2 -0
- package/lib/Token/IssueLabelToken-0dbbbcdf.css.map +1 -0
- package/lib/Token/IssueLabelToken.d.ts.map +1 -1
- package/lib/Token/IssueLabelToken.js +7 -65
- package/lib/Token/IssueLabelToken.module.css.js +1 -1
- package/lib/Token/TokenBase.js +73 -82
- package/lib/Token/_RemoveTokenButton.js +106 -26
- package/lib/Tooltip/Tooltip.js +15 -17
- package/lib/TreeView/TreeView.js +18 -20
- package/lib/deprecated/ActionList/List.d.ts.map +1 -1
- package/lib/deprecated/ActionList/List.js +115 -138
- package/lib/deprecated/ActionMenu.js +19 -21
- package/lib/deprecated/index.d.ts +2 -0
- package/lib/deprecated/index.d.ts.map +1 -1
- package/lib/deprecated/index.js +2 -0
- package/lib/hooks/useMenuKeyboardNavigation.js +23 -43
- package/lib/hooks/useMnemonics.js +37 -76
- package/lib/hooks/useOpenAndCloseFocus.js +7 -14
- package/lib/hooks/useOverflow.js +7 -11
- package/lib/hooks/useScrollFlash.js +25 -14
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -10
- package/lib/internal/components/BoxWithFallback.js +40 -35
- package/lib/internal/components/Caret-e686f04c.css +2 -0
- package/lib/internal/components/Caret-e686f04c.css.map +1 -0
- package/lib/internal/components/Caret.d.ts +1 -3
- package/lib/internal/components/Caret.d.ts.map +1 -1
- package/lib/internal/components/Caret.js +14 -48
- package/lib/internal/components/Caret.module.css.js +7 -0
- package/lib/internal/components/LiveRegion.js +8 -10
- package/lib/internal/utils/getGlobalFocusStyles.js +1 -1
- package/lib-esm/AvatarStack/AvatarStack.d.ts +2 -3
- package/lib-esm/AvatarStack/AvatarStack.js +1 -3
- package/lib-esm/Banner/Banner.js +3 -1
- package/lib-esm/Blankslate/Blankslate.js +38 -40
- package/lib-esm/BranchName/BranchName.d.ts +6 -3
- package/lib-esm/BranchName/BranchName.js +1 -3
- package/lib-esm/Button/ButtonBase.js +2 -2
- package/lib-esm/Checkbox/Checkbox.js +187 -56
- package/lib-esm/CircleBadge/CircleBadge.d.ts +4 -0
- package/lib-esm/CircleBadge/CircleBadge.js +4 -0
- package/lib-esm/DataTable/useTable.js +64 -83
- package/lib-esm/Details/Details.d.ts +2 -3
- package/lib-esm/Details/Details.js +1 -3
- package/lib-esm/FeatureFlags/FeatureFlags.js +10 -12
- package/lib-esm/FilteredActionList/useAnnouncements.js +31 -40
- package/lib-esm/LabelGroup/LabelGroup.d.ts +1 -2
- package/lib-esm/LabelGroup/LabelGroup.js +13 -16
- package/lib-esm/NavList/NavList.js +219 -53
- package/lib-esm/PageLayout/PageLayout.js +53 -55
- package/lib-esm/PointerBox/PointerBox.d.ts +8 -0
- package/lib-esm/PointerBox/PointerBox.js +4 -0
- package/{lib/ProgressBar/ProgressBar-a0957632.css → lib-esm/ProgressBar/ProgressBar-36f689cb.css} +2 -2
- package/lib-esm/ProgressBar/ProgressBar-36f689cb.css.map +1 -0
- package/lib-esm/ProgressBar/ProgressBar.d.ts +3 -4
- package/lib-esm/ProgressBar/ProgressBar.module.css.js +1 -1
- package/lib-esm/ProgressBar/index.d.ts +2 -2
- package/lib-esm/Select/Select.d.ts +1 -1
- package/lib-esm/Select/Select.js +53 -65
- package/lib-esm/SelectPanel/{SelectPanel-06900070.css → SelectPanel-e11ce210.css} +2 -2
- package/lib-esm/SelectPanel/SelectPanel-e11ce210.css.map +1 -0
- package/lib-esm/SelectPanel/SelectPanel.d.ts +1 -1
- package/lib-esm/SelectPanel/SelectPanel.js +2 -9
- package/lib-esm/SelectPanel/SelectPanel.module.css.js +2 -2
- package/lib-esm/SideNav.d.ts +2 -3
- package/lib-esm/SideNav.js +4 -10
- package/lib-esm/StateLabel/StateLabel-50420ff5.css +2 -0
- package/lib-esm/StateLabel/StateLabel-50420ff5.css.map +1 -0
- package/lib-esm/StateLabel/StateLabel.d.ts +6 -5
- package/lib-esm/StateLabel/StateLabel.js +55 -123
- package/lib-esm/StateLabel/StateLabel.module.css.js +2 -2
- package/lib-esm/TextInputWithTokens/TextInputWithTokens.d.ts +6 -0
- package/lib-esm/TextInputWithTokens/TextInputWithTokens.js +343 -331
- package/lib-esm/ToggleSwitch/ToggleSwitch-4b23d166.css +2 -0
- package/lib-esm/ToggleSwitch/ToggleSwitch-4b23d166.css.map +1 -0
- package/lib-esm/ToggleSwitch/ToggleSwitch.d.ts +1 -3
- package/lib-esm/ToggleSwitch/ToggleSwitch.js +120 -151
- package/lib-esm/ToggleSwitch/ToggleSwitch.module.css.js +2 -2
- package/lib-esm/Token/IssueLabelToken-0dbbbcdf.css +2 -0
- package/lib-esm/Token/IssueLabelToken-0dbbbcdf.css.map +1 -0
- package/lib-esm/Token/IssueLabelToken.js +7 -65
- package/lib-esm/Token/IssueLabelToken.module.css.js +1 -1
- package/lib-esm/Token/TokenBase.js +73 -82
- package/lib-esm/Token/_RemoveTokenButton.js +106 -26
- package/lib-esm/Tooltip/Tooltip.js +15 -17
- package/lib-esm/TreeView/TreeView.js +18 -20
- package/lib-esm/deprecated/ActionList/List.js +116 -138
- package/lib-esm/deprecated/ActionMenu.js +19 -21
- package/lib-esm/deprecated/index.d.ts +2 -0
- package/lib-esm/deprecated/index.js +1 -0
- package/lib-esm/hooks/useMenuKeyboardNavigation.js +23 -43
- package/lib-esm/hooks/useMnemonics.js +37 -76
- package/lib-esm/hooks/useOpenAndCloseFocus.js +7 -14
- package/lib-esm/hooks/useOverflow.js +7 -11
- package/lib-esm/hooks/useScrollFlash.js +25 -14
- package/lib-esm/index.d.ts +4 -3
- package/lib-esm/index.js +1 -1
- package/lib-esm/internal/components/BoxWithFallback.js +40 -35
- package/lib-esm/internal/components/Caret-e686f04c.css +2 -0
- package/lib-esm/internal/components/Caret-e686f04c.css.map +1 -0
- package/lib-esm/internal/components/Caret.d.ts +1 -3
- package/lib-esm/internal/components/Caret.js +14 -44
- package/lib-esm/internal/components/Caret.module.css.js +5 -0
- package/lib-esm/internal/components/LiveRegion.js +8 -10
- package/lib-esm/internal/utils/getGlobalFocusStyles.js +1 -1
- package/package.json +10 -10
- package/lib/CircleOcticon/CircleOcticon.d.ts +0 -16
- package/lib/CircleOcticon/CircleOcticon.d.ts.map +0 -1
- package/lib/CircleOcticon/CircleOcticon.js +0 -99
- package/lib/CircleOcticon/index.d.ts +0 -3
- package/lib/CircleOcticon/index.d.ts.map +0 -1
- package/lib/ProgressBar/ProgressBar-a0957632.css.map +0 -1
- package/lib/SelectPanel/SelectPanel-06900070.css.map +0 -1
- package/lib/StateLabel/StateLabel-cd27f475.css +0 -2
- package/lib/StateLabel/StateLabel-cd27f475.css.map +0 -1
- package/lib/ToggleSwitch/ToggleSwitch-65936b4b.css +0 -4
- package/lib/ToggleSwitch/ToggleSwitch-65936b4b.css.map +0 -1
- package/lib/Token/IssueLabelToken-99c9b914.css +0 -2
- package/lib/Token/IssueLabelToken-99c9b914.css.map +0 -1
- package/lib-esm/CircleOcticon/CircleOcticon.d.ts +0 -16
- package/lib-esm/CircleOcticon/CircleOcticon.js +0 -97
- package/lib-esm/CircleOcticon/index.d.ts +0 -3
- package/lib-esm/ProgressBar/ProgressBar-a0957632.css.map +0 -1
- package/lib-esm/SelectPanel/SelectPanel-06900070.css.map +0 -1
- package/lib-esm/StateLabel/StateLabel-cd27f475.css +0 -2
- package/lib-esm/StateLabel/StateLabel-cd27f475.css.map +0 -1
- package/lib-esm/ToggleSwitch/ToggleSwitch-65936b4b.css +0 -4
- package/lib-esm/ToggleSwitch/ToggleSwitch-65936b4b.css.map +0 -1
- package/lib-esm/Token/IssueLabelToken-99c9b914.css +0 -2
- package/lib-esm/Token/IssueLabelToken-99c9b914.css.map +0 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React, { createElement } from 'react';
|
|
3
2
|
import { Group } from './Group.js';
|
|
4
3
|
import { Item } from './Item.js';
|
|
5
4
|
import { Divider } from './Divider.js';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import { get } from '../../constants.js';
|
|
8
5
|
import { hasActiveDescendantAttribute } from '@primer/behaviors';
|
|
9
|
-
import {
|
|
6
|
+
import { BoxWithFallback } from '../../internal/components/BoxWithFallback.js';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Asserts that the given value fulfills the `GroupedListProps` contract.
|
|
@@ -20,13 +18,16 @@ function isGroupedListProps(props) {
|
|
|
20
18
|
* Contract for props passed to the `List` component.
|
|
21
19
|
*/
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
// Base styles for the List component
|
|
22
|
+
const listStyles = {
|
|
23
|
+
fontSize: 'var(--text-body-size-medium, 14px)',
|
|
24
|
+
// 14px font-size * 1.428571429 = 20px line height
|
|
25
|
+
// TODO: When rem-based spacing on a 4px scale lands, replace hardcoded '20px'
|
|
26
|
+
lineHeight: '20px'
|
|
27
|
+
};
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
* Returns
|
|
30
|
+
* Returns style objects for `List` children matching the given `List` style variation.
|
|
30
31
|
* @param variant `List` style variation.
|
|
31
32
|
*/
|
|
32
33
|
function useListVariant(variant = 'inset') {
|
|
@@ -34,7 +35,8 @@ function useListVariant(variant = 'inset') {
|
|
|
34
35
|
case 'full':
|
|
35
36
|
return {
|
|
36
37
|
headerStyle: {
|
|
37
|
-
|
|
38
|
+
paddingLeft: 'var(--base-size-8, 8px)',
|
|
39
|
+
paddingRight: 'var(--base-size-8, 8px)'
|
|
38
40
|
},
|
|
39
41
|
itemStyle: {
|
|
40
42
|
borderRadius: 0
|
|
@@ -43,13 +45,14 @@ function useListVariant(variant = 'inset') {
|
|
|
43
45
|
default:
|
|
44
46
|
return {
|
|
45
47
|
firstGroupStyle: {
|
|
46
|
-
marginTop:
|
|
48
|
+
marginTop: 'var(--base-size-8, 8px)'
|
|
47
49
|
},
|
|
48
50
|
lastGroupStyle: {
|
|
49
|
-
marginBottom:
|
|
51
|
+
marginBottom: 'var(--base-size-8, 8px)'
|
|
50
52
|
},
|
|
51
53
|
itemStyle: {
|
|
52
|
-
|
|
54
|
+
marginLeft: 'var(--base-size-8, 8px)',
|
|
55
|
+
marginRight: 'var(--base-size-8, 8px)'
|
|
53
56
|
}
|
|
54
57
|
};
|
|
55
58
|
}
|
|
@@ -59,103 +62,113 @@ function useListVariant(variant = 'inset') {
|
|
|
59
62
|
* Lists `Item`s, either grouped or ungrouped, with a `Divider` between each `Group`.
|
|
60
63
|
*/
|
|
61
64
|
const List = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
62
|
-
|
|
65
|
+
// Extract style prop to avoid conflicts with BoxWithFallback
|
|
66
|
+
const {
|
|
67
|
+
style,
|
|
68
|
+
...restProps
|
|
69
|
+
} = props;
|
|
70
|
+
// Get style objects for `List` children matching the given `List` style variation.
|
|
63
71
|
const {
|
|
64
72
|
firstGroupStyle,
|
|
65
73
|
lastGroupStyle,
|
|
66
74
|
headerStyle,
|
|
67
75
|
itemStyle
|
|
68
|
-
} = useListVariant(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
} = useListVariant(restProps.variant);
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Render a `Group` using the first of the following renderers that is defined:
|
|
80
|
+
* A `Group`-level or `List`-level custom `Group` renderer, or
|
|
81
|
+
* the default `Group` renderer.
|
|
82
|
+
*/
|
|
83
|
+
const renderGroup = groupProps => {
|
|
84
|
+
var _ref;
|
|
85
|
+
const GroupComponent = ((_ref = 'renderGroup' in groupProps && groupProps.renderGroup) !== null && _ref !== void 0 ? _ref : restProps.renderGroup) || Group;
|
|
86
|
+
return /*#__PURE__*/createElement(GroupComponent, {
|
|
87
|
+
...groupProps,
|
|
88
|
+
key: groupProps.groupId
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Render an `Item` using the first of the following renderers that is defined:
|
|
94
|
+
* An `Item`-level, `Group`-level, or `List`-level custom `Item` renderer,
|
|
95
|
+
* or the default `Item` renderer.
|
|
96
|
+
*/
|
|
97
|
+
const renderItem = (itemProps, item, itemIndex) => {
|
|
98
|
+
var _ref2, _ref3, _itemProps$id;
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
100
|
+
const ItemComponent = 'renderItem' in itemProps && itemProps.renderItem || restProps.renderItem || Item;
|
|
101
|
+
const key = (_ref2 = (_ref3 = 'key' in itemProps ? itemProps.key : undefined) !== null && _ref3 !== void 0 ? _ref3 : (_itemProps$id = itemProps.id) === null || _itemProps$id === void 0 ? void 0 : _itemProps$id.toString()) !== null && _ref2 !== void 0 ? _ref2 : itemIndex.toString();
|
|
102
|
+
return /*#__PURE__*/createElement(ItemComponent, {
|
|
103
|
+
showDivider: restProps.showItemDividers,
|
|
104
|
+
selectionVariant: restProps.selectionVariant,
|
|
105
|
+
...itemProps,
|
|
106
|
+
key: key,
|
|
107
|
+
sx: {
|
|
108
|
+
...itemStyle,
|
|
109
|
+
...itemProps.sx
|
|
110
|
+
},
|
|
111
|
+
item: item
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* An array of `Group`s, each with an associated `Header` and with an array of `Item`s belonging to that `Group`.
|
|
117
|
+
*/
|
|
118
|
+
let groups = [];
|
|
119
|
+
|
|
120
|
+
// Collect rendered `Item`s into `Group`s, avoiding excess iteration over the lists of `items` and `groupMetadata`:
|
|
121
|
+
if (!isGroupedListProps(restProps)) {
|
|
122
|
+
// When no `groupMetadata`s is provided, collect rendered `Item`s into a single anonymous `Group`.
|
|
123
|
+
groups = [{
|
|
124
|
+
items: restProps.items.map((item_0, index) => renderItem(item_0, item_0, index)),
|
|
125
|
+
groupId: '0'
|
|
126
|
+
}];
|
|
81
127
|
} else {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
128
|
+
// When `groupMetadata` is provided, collect rendered `Item`s into their associated `Group`s.
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A map of group identifiers to `Group`s, each with an associated array of `Item`s belonging to that `Group`.
|
|
132
|
+
*/
|
|
133
|
+
const groupMap = restProps.groupMetadata.reduce((groupAccumulator, groupMetadata) => groupAccumulator.set(groupMetadata.groupId, groupMetadata), new Map());
|
|
134
|
+
for (const itemProps_0 of restProps.items) {
|
|
135
|
+
var _group$items$length, _group$items, _group$items2;
|
|
136
|
+
// Look up the group associated with the current item.
|
|
137
|
+
const group = groupMap.get(itemProps_0.groupId);
|
|
138
|
+
const itemIndex_0 = (_group$items$length = group === null || group === void 0 ? void 0 : (_group$items = group.items) === null || _group$items === void 0 ? void 0 : _group$items.length) !== null && _group$items$length !== void 0 ? _group$items$length : 0;
|
|
139
|
+
|
|
140
|
+
// Upsert the group to include the current item (rendered).
|
|
141
|
+
groupMap.set(itemProps_0.groupId, {
|
|
142
|
+
...group,
|
|
143
|
+
items: [...((_group$items2 = group === null || group === void 0 ? void 0 : group.items) !== null && _group$items2 !== void 0 ? _group$items2 : []), renderItem({
|
|
144
|
+
showDivider: group === null || group === void 0 ? void 0 : group.showItemDividers,
|
|
145
|
+
...(group && 'renderItem' in group && {
|
|
146
|
+
renderItem: group.renderItem
|
|
147
|
+
}),
|
|
148
|
+
...itemProps_0
|
|
149
|
+
}, itemProps_0, itemIndex_0)]
|
|
101
150
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
$[3] = props.renderItem;
|
|
105
|
-
$[4] = props.selectionVariant;
|
|
106
|
-
$[5] = props.showItemDividers;
|
|
107
|
-
$[6] = t1;
|
|
108
|
-
} else {
|
|
109
|
-
t1 = $[6];
|
|
151
|
+
}
|
|
152
|
+
groups = [...groupMap.values()];
|
|
110
153
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
$[18] = renderItem;
|
|
123
|
-
$[19] = t5;
|
|
124
|
-
} else {
|
|
125
|
-
t5 = $[19];
|
|
154
|
+
return /*#__PURE__*/jsx(BoxWithFallback, {
|
|
155
|
+
...restProps,
|
|
156
|
+
ref: forwardedRef,
|
|
157
|
+
style: {
|
|
158
|
+
...listStyles,
|
|
159
|
+
...(style || {})
|
|
160
|
+
},
|
|
161
|
+
sx: {
|
|
162
|
+
[`&[${hasActiveDescendantAttribute}], &:focus-within`]: {
|
|
163
|
+
'--item-hover-bg-override': 'none',
|
|
164
|
+
'--item-hover-divider-border-color-override': 'var(--borderColor-muted)'
|
|
126
165
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
const
|
|
133
|
-
for (const itemProps_0 of props.items) {
|
|
134
|
-
var _group$items$length, _group$items, _group$items2;
|
|
135
|
-
const group = groupMap.get(itemProps_0.groupId);
|
|
136
|
-
const itemIndex_0 = (_group$items$length = group === null || group === void 0 ? void 0 : (_group$items = group.items) === null || _group$items === void 0 ? void 0 : _group$items.length) !== null && _group$items$length !== void 0 ? _group$items$length : 0;
|
|
137
|
-
groupMap.set(itemProps_0.groupId, {
|
|
138
|
-
...group,
|
|
139
|
-
items: [...((_group$items2 = group === null || group === void 0 ? void 0 : group.items) !== null && _group$items2 !== void 0 ? _group$items2 : []), renderItem({
|
|
140
|
-
showDivider: group === null || group === void 0 ? void 0 : group.showItemDividers,
|
|
141
|
-
...(group && "renderItem" in group && {
|
|
142
|
-
renderItem: group.renderItem
|
|
143
|
-
}),
|
|
144
|
-
...itemProps_0
|
|
145
|
-
}, itemProps_0, itemIndex_0)]
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
groups = [...groupMap.values()];
|
|
149
|
-
}
|
|
150
|
-
T0 = StyledList;
|
|
151
|
-
t2 = props;
|
|
152
|
-
t3 = forwardedRef;
|
|
153
|
-
t4 = groups.map((t5, index_0) => {
|
|
154
|
-
const {
|
|
155
|
-
header,
|
|
156
|
-
...groupProps_0
|
|
157
|
-
} = t5;
|
|
158
|
-
const hasFilledHeader = (header === null || header === void 0 ? void 0 : header.variant) === "filled";
|
|
166
|
+
},
|
|
167
|
+
children: groups.map(({
|
|
168
|
+
header,
|
|
169
|
+
...groupProps_0
|
|
170
|
+
}, index_0) => {
|
|
171
|
+
const hasFilledHeader = (header === null || header === void 0 ? void 0 : header.variant) === 'filled';
|
|
159
172
|
const shouldShowDivider = index_0 > 0 && !hasFilledHeader;
|
|
160
173
|
return /*#__PURE__*/jsxs(React.Fragment, {
|
|
161
174
|
children: [shouldShowDivider ? /*#__PURE__*/jsx(Divider, {}, `${groupProps_0.groupId}-divider`) : null, renderGroup({
|
|
@@ -178,44 +191,9 @@ const List = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
178
191
|
...groupProps_0
|
|
179
192
|
})]
|
|
180
193
|
}, groupProps_0.groupId);
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
$[8] = forwardedRef;
|
|
184
|
-
$[9] = headerStyle;
|
|
185
|
-
$[10] = lastGroupStyle;
|
|
186
|
-
$[11] = props;
|
|
187
|
-
$[12] = renderGroup;
|
|
188
|
-
$[13] = renderItem;
|
|
189
|
-
$[14] = T0;
|
|
190
|
-
$[15] = t2;
|
|
191
|
-
$[16] = t3;
|
|
192
|
-
$[17] = t4;
|
|
193
|
-
} else {
|
|
194
|
-
T0 = $[14];
|
|
195
|
-
t2 = $[15];
|
|
196
|
-
t3 = $[16];
|
|
197
|
-
t4 = $[17];
|
|
198
|
-
}
|
|
199
|
-
let t5;
|
|
200
|
-
if ($[20] !== T0 || $[21] !== t2 || $[22] !== t3 || $[23] !== t4) {
|
|
201
|
-
t5 = /*#__PURE__*/jsx(T0, {
|
|
202
|
-
...t2,
|
|
203
|
-
ref: t3,
|
|
204
|
-
children: t4
|
|
205
|
-
});
|
|
206
|
-
$[20] = T0;
|
|
207
|
-
$[21] = t2;
|
|
208
|
-
$[22] = t3;
|
|
209
|
-
$[23] = t4;
|
|
210
|
-
$[24] = t5;
|
|
211
|
-
} else {
|
|
212
|
-
t5 = $[24];
|
|
213
|
-
}
|
|
214
|
-
return t5;
|
|
194
|
+
})
|
|
195
|
+
});
|
|
215
196
|
});
|
|
216
197
|
List.displayName = 'ActionList';
|
|
217
|
-
function _temp(groupAccumulator, groupMetadata) {
|
|
218
|
-
return groupAccumulator.set(groupMetadata.groupId, groupMetadata);
|
|
219
|
-
}
|
|
220
198
|
|
|
221
199
|
export { List };
|
|
@@ -117,11 +117,10 @@ const ActionMenuBase = t0 => {
|
|
|
117
117
|
}
|
|
118
118
|
const renderMenuAnchor = t4;
|
|
119
119
|
let t5;
|
|
120
|
-
let t6;
|
|
121
120
|
if ($[17] !== items || $[18] !== onAction || $[19] !== onClose) {
|
|
122
|
-
let
|
|
121
|
+
let t6;
|
|
123
122
|
if ($[21] !== onAction || $[22] !== onClose) {
|
|
124
|
-
|
|
123
|
+
t6 = item => ({
|
|
125
124
|
...item,
|
|
126
125
|
role: "menuitem",
|
|
127
126
|
onAction: (props_0, event) => {
|
|
@@ -135,43 +134,42 @@ const ActionMenuBase = t0 => {
|
|
|
135
134
|
});
|
|
136
135
|
$[21] = onAction;
|
|
137
136
|
$[22] = onClose;
|
|
138
|
-
$[23] =
|
|
137
|
+
$[23] = t6;
|
|
139
138
|
} else {
|
|
140
|
-
|
|
139
|
+
t6 = $[23];
|
|
141
140
|
}
|
|
142
|
-
|
|
141
|
+
t5 = items.map(t6);
|
|
143
142
|
$[17] = items;
|
|
144
143
|
$[18] = onAction;
|
|
145
144
|
$[19] = onClose;
|
|
146
|
-
$[20] =
|
|
145
|
+
$[20] = t5;
|
|
147
146
|
} else {
|
|
148
|
-
|
|
147
|
+
t5 = $[20];
|
|
149
148
|
}
|
|
150
|
-
t5 = t6;
|
|
151
149
|
const itemsToRender = t5;
|
|
152
|
-
let
|
|
150
|
+
let t6;
|
|
153
151
|
if ($[24] !== itemsToRender || $[25] !== listProps) {
|
|
154
|
-
|
|
152
|
+
t6 = /*#__PURE__*/jsx(List, {
|
|
155
153
|
...listProps,
|
|
156
154
|
role: "menu",
|
|
157
155
|
items: itemsToRender
|
|
158
156
|
});
|
|
159
157
|
$[24] = itemsToRender;
|
|
160
158
|
$[25] = listProps;
|
|
161
|
-
$[26] =
|
|
159
|
+
$[26] = t6;
|
|
162
160
|
} else {
|
|
163
|
-
|
|
161
|
+
t6 = $[26];
|
|
164
162
|
}
|
|
165
|
-
let
|
|
166
|
-
if ($[27] !== anchorRef || $[28] !== combinedOpenState || $[29] !== onClose || $[30] !== onOpen || $[31] !== overlayProps || $[32] !== renderMenuAnchor || $[33] !==
|
|
167
|
-
|
|
163
|
+
let t7;
|
|
164
|
+
if ($[27] !== anchorRef || $[28] !== combinedOpenState || $[29] !== onClose || $[30] !== onOpen || $[31] !== overlayProps || $[32] !== renderMenuAnchor || $[33] !== t6) {
|
|
165
|
+
t7 = /*#__PURE__*/jsx(AnchoredOverlay, {
|
|
168
166
|
renderAnchor: renderMenuAnchor,
|
|
169
167
|
anchorRef: anchorRef,
|
|
170
168
|
open: combinedOpenState,
|
|
171
169
|
onOpen: onOpen,
|
|
172
170
|
onClose: onClose,
|
|
173
171
|
overlayProps: overlayProps,
|
|
174
|
-
children:
|
|
172
|
+
children: t6
|
|
175
173
|
});
|
|
176
174
|
$[27] = anchorRef;
|
|
177
175
|
$[28] = combinedOpenState;
|
|
@@ -179,12 +177,12 @@ const ActionMenuBase = t0 => {
|
|
|
179
177
|
$[30] = onOpen;
|
|
180
178
|
$[31] = overlayProps;
|
|
181
179
|
$[32] = renderMenuAnchor;
|
|
182
|
-
$[33] =
|
|
183
|
-
$[34] =
|
|
180
|
+
$[33] = t6;
|
|
181
|
+
$[34] = t7;
|
|
184
182
|
} else {
|
|
185
|
-
|
|
183
|
+
t7 = $[34];
|
|
186
184
|
}
|
|
187
|
-
return
|
|
185
|
+
return t7;
|
|
188
186
|
};
|
|
189
187
|
ActionMenuBase.displayName = 'ActionMenu';
|
|
190
188
|
|
|
@@ -23,4 +23,6 @@ export { default as TabNav } from '../TabNav';
|
|
|
23
23
|
export type { TabNavProps, TabNavLinkProps } from '../TabNav';
|
|
24
24
|
export { default as Tooltip } from '../Tooltip/Tooltip';
|
|
25
25
|
export type { TooltipProps } from '../Tooltip/Tooltip';
|
|
26
|
+
export { default as PointerBox } from '../PointerBox';
|
|
27
|
+
export type { PointerBoxProps } from '../PointerBox';
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,6 +5,7 @@ export { default as Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
5
5
|
export { default as FilteredSearch } from './FilteredSearch/FilteredSearch.js';
|
|
6
6
|
export { default as Octicon } from '../Octicon/Octicon.js';
|
|
7
7
|
export { default as Pagehead } from '../Pagehead/Pagehead.js';
|
|
8
|
+
export { default as PointerBox } from '../PointerBox/PointerBox.js';
|
|
8
9
|
export { default as UnderlineNav } from './UnderlineNav/UnderlineNav.js';
|
|
9
10
|
export { default as Dialog } from '../DialogV1/Dialog.js';
|
|
10
11
|
export { default as TabNav } from '../TabNav/TabNav.js';
|
|
@@ -25,9 +25,10 @@ const useMenuKeyboardNavigation = (open, onClose, containerRef, anchorRef, t0) =
|
|
|
25
25
|
* and the focus should naturally move to the next item
|
|
26
26
|
*/
|
|
27
27
|
const useCloseMenuOnTab = (open, onClose, containerRef, anchorRef) => {
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(6);
|
|
29
29
|
let t0;
|
|
30
|
-
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[0] !== anchorRef || $[1] !== containerRef || $[2] !== onClose || $[3] !== open) {
|
|
31
32
|
t0 = () => {
|
|
32
33
|
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
33
34
|
const anchor = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current;
|
|
@@ -43,24 +44,16 @@ const useCloseMenuOnTab = (open, onClose, containerRef, anchorRef) => {
|
|
|
43
44
|
anchor === null || anchor === void 0 ? void 0 : anchor.removeEventListener("keydown", handler);
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
$[
|
|
47
|
+
t1 = [open, onClose, containerRef, anchorRef];
|
|
48
|
+
$[0] = anchorRef;
|
|
49
|
+
$[1] = containerRef;
|
|
48
50
|
$[2] = onClose;
|
|
49
51
|
$[3] = open;
|
|
50
52
|
$[4] = t0;
|
|
53
|
+
$[5] = t1;
|
|
51
54
|
} else {
|
|
52
55
|
t0 = $[4];
|
|
53
|
-
|
|
54
|
-
let t1;
|
|
55
|
-
if ($[5] !== anchorRef || $[6] !== containerRef || $[7] !== onClose || $[8] !== open) {
|
|
56
|
-
t1 = [open, onClose, containerRef, anchorRef];
|
|
57
|
-
$[5] = anchorRef;
|
|
58
|
-
$[6] = containerRef;
|
|
59
|
-
$[7] = onClose;
|
|
60
|
-
$[8] = open;
|
|
61
|
-
$[9] = t1;
|
|
62
|
-
} else {
|
|
63
|
-
t1 = $[9];
|
|
56
|
+
t1 = $[5];
|
|
64
57
|
}
|
|
65
58
|
React.useEffect(t0, t1);
|
|
66
59
|
};
|
|
@@ -69,9 +62,10 @@ const useCloseMenuOnTab = (open, onClose, containerRef, anchorRef) => {
|
|
|
69
62
|
* Close submenu when left arrow key is pressed
|
|
70
63
|
*/
|
|
71
64
|
const useCloseSubmenuOnArrow = (open, isSubmenu, onClose, containerRef) => {
|
|
72
|
-
const $ = c(
|
|
65
|
+
const $ = c(6);
|
|
73
66
|
let t0;
|
|
74
|
-
|
|
67
|
+
let t1;
|
|
68
|
+
if ($[0] !== containerRef || $[1] !== isSubmenu || $[2] !== onClose || $[3] !== open) {
|
|
75
69
|
t0 = () => {
|
|
76
70
|
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
77
71
|
const handler = event => {
|
|
@@ -84,24 +78,16 @@ const useCloseSubmenuOnArrow = (open, isSubmenu, onClose, containerRef) => {
|
|
|
84
78
|
container === null || container === void 0 ? void 0 : container.removeEventListener("keydown", handler);
|
|
85
79
|
};
|
|
86
80
|
};
|
|
87
|
-
|
|
81
|
+
t1 = [open, onClose, containerRef, isSubmenu];
|
|
82
|
+
$[0] = containerRef;
|
|
88
83
|
$[1] = isSubmenu;
|
|
89
84
|
$[2] = onClose;
|
|
90
85
|
$[3] = open;
|
|
91
86
|
$[4] = t0;
|
|
87
|
+
$[5] = t1;
|
|
92
88
|
} else {
|
|
93
89
|
t0 = $[4];
|
|
94
|
-
|
|
95
|
-
let t1;
|
|
96
|
-
if ($[5] !== containerRef || $[6] !== isSubmenu || $[7] !== onClose || $[8] !== open) {
|
|
97
|
-
t1 = [open, onClose, containerRef, isSubmenu];
|
|
98
|
-
$[5] = containerRef;
|
|
99
|
-
$[6] = isSubmenu;
|
|
100
|
-
$[7] = onClose;
|
|
101
|
-
$[8] = open;
|
|
102
|
-
$[9] = t1;
|
|
103
|
-
} else {
|
|
104
|
-
t1 = $[9];
|
|
90
|
+
t1 = $[5];
|
|
105
91
|
}
|
|
106
92
|
React.useEffect(t0, t1);
|
|
107
93
|
};
|
|
@@ -111,9 +97,10 @@ const useCloseSubmenuOnArrow = (open, isSubmenu, onClose, containerRef) => {
|
|
|
111
97
|
* focus should move to a menu item
|
|
112
98
|
*/
|
|
113
99
|
const useMoveFocusToMenuItem = (open, containerRef, anchorRef) => {
|
|
114
|
-
const $ = c(
|
|
100
|
+
const $ = c(5);
|
|
115
101
|
let t0;
|
|
116
|
-
|
|
102
|
+
let t1;
|
|
103
|
+
if ($[0] !== anchorRef || $[1] !== containerRef || $[2] !== open) {
|
|
117
104
|
t0 = () => {
|
|
118
105
|
const container = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
119
106
|
const anchor = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current;
|
|
@@ -136,22 +123,15 @@ const useMoveFocusToMenuItem = (open, containerRef, anchorRef) => {
|
|
|
136
123
|
anchor === null || anchor === void 0 ? void 0 : anchor.addEventListener("keydown", handler);
|
|
137
124
|
return () => anchor === null || anchor === void 0 ? void 0 : anchor.addEventListener("keydown", handler);
|
|
138
125
|
};
|
|
139
|
-
|
|
140
|
-
$[
|
|
126
|
+
t1 = [open, containerRef, anchorRef];
|
|
127
|
+
$[0] = anchorRef;
|
|
128
|
+
$[1] = containerRef;
|
|
141
129
|
$[2] = open;
|
|
142
130
|
$[3] = t0;
|
|
131
|
+
$[4] = t1;
|
|
143
132
|
} else {
|
|
144
133
|
t0 = $[3];
|
|
145
|
-
|
|
146
|
-
let t1;
|
|
147
|
-
if ($[4] !== anchorRef || $[5] !== containerRef || $[6] !== open) {
|
|
148
|
-
t1 = [open, containerRef, anchorRef];
|
|
149
|
-
$[4] = anchorRef;
|
|
150
|
-
$[5] = containerRef;
|
|
151
|
-
$[6] = open;
|
|
152
|
-
$[7] = t1;
|
|
153
|
-
} else {
|
|
154
|
-
t1 = $[7];
|
|
134
|
+
t1 = $[4];
|
|
155
135
|
}
|
|
156
136
|
React.useEffect(t0, t1);
|
|
157
137
|
};
|