@primer/react 0.0.0-20260226223231 → 0.0.0-20260226230723
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 +53 -3
- package/dist/ActionList/ActionList-c04a02d6.css +2 -0
- package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/ActionList/Description.js +113 -35
- package/dist/ActionList/Divider.js +30 -11
- package/dist/ActionList/Group.js +294 -117
- package/dist/ActionList/Heading.js +77 -22
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +99 -37
- package/dist/ActionList/LinkItem.js +80 -24
- package/dist/ActionList/List.js +143 -33
- package/dist/ActionList/Selection.js +78 -30
- package/dist/ActionList/TrailingAction.js +83 -23
- package/dist/ActionList/Visuals.js +162 -64
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +112 -276
- package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
- package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
- package/dist/Blankslate/Blankslate.module.css.js +1 -1
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +9 -14
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +147 -42
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/Overlay/Overlay-390f808a.css +2 -0
- package/dist/Overlay/Overlay-390f808a.css.map +1 -0
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/PageLayout/PageLayout-3444a142.css +2 -0
- package/dist/PageLayout/PageLayout-3444a142.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +72 -2
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +750 -1235
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +18 -6
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +126 -112
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +85 -33
- package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
- package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
- package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +10 -13
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +11 -4
- package/dist/UnderlineNav/UnderlineNavItem.js +56 -149
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-1f8c23b5.css.map → SelectPanel-f0c4b9ca.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useIsMacOS.d.ts +15 -3
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +24 -26
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +14 -22
- package/dist/hooks/useSlots.d.ts +50 -6
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +114 -36
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/live-region/Announce.d.ts.map +1 -1
- package/dist/live-region/Announce.js +7 -4
- package/generated/components.json +198 -6
- package/package.json +4 -4
- package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
- package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
- package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +0 -1
- package/dist/Overlay/Overlay-c52b85b7.css +0 -2
- package/dist/Overlay/Overlay-c52b85b7.css.map +0 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
- package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +0 -1
package/dist/ActionList/Item.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { useId } from '../hooks/useId.js';
|
|
3
4
|
import { useSlots } from '../hooks/useSlots.js';
|
|
@@ -16,36 +17,96 @@ import { clsx } from 'clsx';
|
|
|
16
17
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
17
18
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
19
|
|
|
19
|
-
const SubItem =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const SubItem = t0 => {
|
|
21
|
+
const $ = c(2);
|
|
22
|
+
const {
|
|
23
|
+
children
|
|
24
|
+
} = t0;
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] !== children) {
|
|
27
|
+
t1 = /*#__PURE__*/jsx(Fragment, {
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
$[0] = children;
|
|
31
|
+
$[1] = t1;
|
|
32
|
+
} else {
|
|
33
|
+
t1 = $[1];
|
|
34
|
+
}
|
|
35
|
+
return t1;
|
|
25
36
|
};
|
|
26
37
|
SubItem.displayName = 'ActionList.SubItem';
|
|
27
|
-
const ButtonItemContainerNoBox = /*#__PURE__*/React.forwardRef(({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const ButtonItemContainerNoBox = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
39
|
+
const $ = c(9);
|
|
40
|
+
let children;
|
|
41
|
+
let props;
|
|
42
|
+
let style;
|
|
43
|
+
if ($[0] !== t0) {
|
|
44
|
+
({
|
|
45
|
+
children,
|
|
46
|
+
style,
|
|
47
|
+
...props
|
|
48
|
+
} = t0);
|
|
49
|
+
$[0] = t0;
|
|
50
|
+
$[1] = children;
|
|
51
|
+
$[2] = props;
|
|
52
|
+
$[3] = style;
|
|
53
|
+
} else {
|
|
54
|
+
children = $[1];
|
|
55
|
+
props = $[2];
|
|
56
|
+
style = $[3];
|
|
57
|
+
}
|
|
58
|
+
const t1 = forwardedRef;
|
|
59
|
+
let t2;
|
|
60
|
+
if ($[4] !== children || $[5] !== props || $[6] !== style || $[7] !== t1) {
|
|
61
|
+
t2 = /*#__PURE__*/jsx("button", {
|
|
62
|
+
type: "button",
|
|
63
|
+
ref: t1,
|
|
64
|
+
style: style,
|
|
65
|
+
...props,
|
|
66
|
+
children: children
|
|
67
|
+
});
|
|
68
|
+
$[4] = children;
|
|
69
|
+
$[5] = props;
|
|
70
|
+
$[6] = style;
|
|
71
|
+
$[7] = t1;
|
|
72
|
+
$[8] = t2;
|
|
73
|
+
} else {
|
|
74
|
+
t2 = $[8];
|
|
75
|
+
}
|
|
76
|
+
return t2;
|
|
39
77
|
});
|
|
40
|
-
const DivItemContainerNoBox = /*#__PURE__*/React.forwardRef(({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
const DivItemContainerNoBox = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
79
|
+
const $ = c(7);
|
|
80
|
+
let children;
|
|
81
|
+
let props;
|
|
82
|
+
if ($[0] !== t0) {
|
|
83
|
+
({
|
|
84
|
+
children,
|
|
85
|
+
...props
|
|
86
|
+
} = t0);
|
|
87
|
+
$[0] = t0;
|
|
88
|
+
$[1] = children;
|
|
89
|
+
$[2] = props;
|
|
90
|
+
} else {
|
|
91
|
+
children = $[1];
|
|
92
|
+
props = $[2];
|
|
93
|
+
}
|
|
94
|
+
const t1 = forwardedRef;
|
|
95
|
+
let t2;
|
|
96
|
+
if ($[3] !== children || $[4] !== props || $[5] !== t1) {
|
|
97
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
98
|
+
ref: t1,
|
|
99
|
+
...props,
|
|
100
|
+
children: children
|
|
101
|
+
});
|
|
102
|
+
$[3] = children;
|
|
103
|
+
$[4] = props;
|
|
104
|
+
$[5] = t1;
|
|
105
|
+
$[6] = t2;
|
|
106
|
+
} else {
|
|
107
|
+
t2 = $[6];
|
|
108
|
+
}
|
|
109
|
+
return t2;
|
|
49
110
|
});
|
|
50
111
|
const UnwrappedItem = ({
|
|
51
112
|
variant = 'default',
|
|
@@ -105,10 +166,10 @@ const UnwrappedItem = ({
|
|
|
105
166
|
const menuContext = container === 'ActionMenu' || container === 'SelectPanel' || container === 'FilteredActionList';
|
|
106
167
|
// TODO: when we change `menuContext` to check `listRole` instead of `container`
|
|
107
168
|
const showInactiveIndicator = inactive && !(listRole !== undefined && ['menu', 'listbox'].includes(listRole));
|
|
108
|
-
const onSelect = React.useCallback((event,
|
|
169
|
+
const onSelect = React.useCallback((event, afterSelect_0) => {
|
|
109
170
|
if (typeof onSelectUser === 'function') onSelectUser(event);
|
|
110
171
|
if (event.defaultPrevented) return;
|
|
111
|
-
if (typeof
|
|
172
|
+
if (typeof afterSelect_0 === 'function') afterSelect_0(event);
|
|
112
173
|
}, [onSelectUser]);
|
|
113
174
|
const selectionVariant = groupSelectionVariant ? groupSelectionVariant : listSelectionVariant;
|
|
114
175
|
|
|
@@ -135,20 +196,20 @@ const UnwrappedItem = ({
|
|
|
135
196
|
const listRoleTypes = ['listbox', 'menu', 'list'];
|
|
136
197
|
const listSemantics = listRole && listRoleTypes.includes(listRole) || inactive || listItemSemantics;
|
|
137
198
|
const buttonSemantics = !listSemantics && !_PrivateItemWrapper;
|
|
138
|
-
const clickHandler = React.useCallback(
|
|
199
|
+
const clickHandler = React.useCallback(event_0 => {
|
|
139
200
|
if (disabled || inactive || loading) return;
|
|
140
|
-
onSelect(
|
|
201
|
+
onSelect(event_0, afterSelect);
|
|
141
202
|
}, [onSelect, disabled, inactive, afterSelect, loading]);
|
|
142
|
-
const keyPressHandler = React.useCallback(
|
|
203
|
+
const keyPressHandler = React.useCallback(event_1 => {
|
|
143
204
|
if (disabled || inactive || loading) return;
|
|
144
|
-
if ([' ', 'Enter'].includes(
|
|
145
|
-
if (
|
|
146
|
-
|
|
205
|
+
if ([' ', 'Enter'].includes(event_1.key)) {
|
|
206
|
+
if (event_1.key === ' ') {
|
|
207
|
+
event_1.preventDefault(); // prevent scrolling on Space
|
|
147
208
|
// immediately reset defaultPrevented once its job is done
|
|
148
209
|
// so as to not disturb the functions that use that event after this
|
|
149
|
-
|
|
210
|
+
event_1.defaultPrevented = false;
|
|
150
211
|
}
|
|
151
|
-
onSelect(
|
|
212
|
+
onSelect(event_1, afterSelect);
|
|
152
213
|
}
|
|
153
214
|
}, [onSelect, disabled, loading, inactive, afterSelect]);
|
|
154
215
|
const itemId = useId(id);
|
|
@@ -216,6 +277,7 @@ const UnwrappedItem = ({
|
|
|
216
277
|
"data-variant": variant === 'danger' ? variant : undefined,
|
|
217
278
|
"data-active": active ? true : undefined,
|
|
218
279
|
"data-inactive": inactiveText ? true : undefined,
|
|
280
|
+
"data-is-disabled": disabled ? true : undefined,
|
|
219
281
|
"data-has-subitem": slots.subItem ? true : undefined,
|
|
220
282
|
"data-has-description": slots.description ? true : false,
|
|
221
283
|
className: clsx(classes.ActionListItem, className),
|
|
@@ -1,29 +1,54 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Item } from './Item.js';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
import Link from '../Link/Link.js';
|
|
5
6
|
|
|
6
|
-
const LinkItem = /*#__PURE__*/React.forwardRef(({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
const LinkItem = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => {
|
|
8
|
+
const $ = c(22);
|
|
9
|
+
let Component;
|
|
10
|
+
let active;
|
|
11
|
+
let className;
|
|
12
|
+
let inactiveText;
|
|
13
|
+
let props;
|
|
14
|
+
let size;
|
|
15
|
+
let variant;
|
|
16
|
+
if ($[0] !== t0) {
|
|
17
|
+
({
|
|
18
|
+
active,
|
|
19
|
+
inactiveText,
|
|
20
|
+
variant,
|
|
21
|
+
size,
|
|
22
|
+
as: Component,
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
} = t0);
|
|
26
|
+
$[0] = t0;
|
|
27
|
+
$[1] = Component;
|
|
28
|
+
$[2] = active;
|
|
29
|
+
$[3] = className;
|
|
30
|
+
$[4] = inactiveText;
|
|
31
|
+
$[5] = props;
|
|
32
|
+
$[6] = size;
|
|
33
|
+
$[7] = variant;
|
|
34
|
+
} else {
|
|
35
|
+
Component = $[1];
|
|
36
|
+
active = $[2];
|
|
37
|
+
className = $[3];
|
|
38
|
+
inactiveText = $[4];
|
|
39
|
+
props = $[5];
|
|
40
|
+
size = $[6];
|
|
41
|
+
variant = $[7];
|
|
42
|
+
}
|
|
43
|
+
const t1 = inactiveText ? true : undefined;
|
|
44
|
+
let t2;
|
|
45
|
+
if ($[8] !== Component || $[9] !== forwardedRef || $[10] !== inactiveText || $[11] !== props) {
|
|
46
|
+
t2 = t3 => {
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
onClick,
|
|
50
|
+
...rest
|
|
51
|
+
} = t3;
|
|
27
52
|
const clickHandler = event => {
|
|
28
53
|
onClick && onClick(event);
|
|
29
54
|
props.onClick && props.onClick(event);
|
|
@@ -39,9 +64,40 @@ const LinkItem = /*#__PURE__*/React.forwardRef(({
|
|
|
39
64
|
ref: forwardedRef,
|
|
40
65
|
children: children
|
|
41
66
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
};
|
|
68
|
+
$[8] = Component;
|
|
69
|
+
$[9] = forwardedRef;
|
|
70
|
+
$[10] = inactiveText;
|
|
71
|
+
$[11] = props;
|
|
72
|
+
$[12] = t2;
|
|
73
|
+
} else {
|
|
74
|
+
t2 = $[12];
|
|
75
|
+
}
|
|
76
|
+
let t3;
|
|
77
|
+
if ($[13] !== active || $[14] !== className || $[15] !== inactiveText || $[16] !== props.children || $[17] !== size || $[18] !== t1 || $[19] !== t2 || $[20] !== variant) {
|
|
78
|
+
t3 = /*#__PURE__*/jsx(Item, {
|
|
79
|
+
className: className,
|
|
80
|
+
active: active,
|
|
81
|
+
inactiveText: inactiveText,
|
|
82
|
+
"data-inactive": t1,
|
|
83
|
+
variant: variant,
|
|
84
|
+
size: size,
|
|
85
|
+
_PrivateItemWrapper: t2,
|
|
86
|
+
children: props.children
|
|
87
|
+
});
|
|
88
|
+
$[13] = active;
|
|
89
|
+
$[14] = className;
|
|
90
|
+
$[15] = inactiveText;
|
|
91
|
+
$[16] = props.children;
|
|
92
|
+
$[17] = size;
|
|
93
|
+
$[18] = t1;
|
|
94
|
+
$[19] = t2;
|
|
95
|
+
$[20] = variant;
|
|
96
|
+
$[21] = t3;
|
|
97
|
+
} else {
|
|
98
|
+
t3 = $[21];
|
|
99
|
+
}
|
|
100
|
+
return t3;
|
|
45
101
|
});
|
|
46
102
|
LinkItem.displayName = 'ActionList.LinkItem';
|
|
47
103
|
LinkItem.__SLOT__ = Symbol('ActionList.LinkItem');
|
package/dist/ActionList/List.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
|
|
3
4
|
import { ActionListContainerContext } from './ActionListContainerContext.js';
|
|
@@ -8,33 +9,70 @@ import { ListContext } from './shared.js';
|
|
|
8
9
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
9
10
|
import { clsx } from 'clsx';
|
|
10
11
|
import classes from './ActionList.module.css.js';
|
|
11
|
-
import {
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
13
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
13
14
|
import { FocusKeys } from '@primer/behaviors';
|
|
14
15
|
|
|
15
16
|
const UnwrappedList = (props, forwardedRef) => {
|
|
16
17
|
var _slots$heading$props$;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
const $ = c(37);
|
|
19
|
+
let className;
|
|
20
|
+
let restProps;
|
|
21
|
+
let role;
|
|
22
|
+
let selectionVariant;
|
|
23
|
+
let t0;
|
|
24
|
+
let t1;
|
|
25
|
+
let t2;
|
|
26
|
+
let t3;
|
|
27
|
+
if ($[0] !== props) {
|
|
28
|
+
({
|
|
29
|
+
as: t0,
|
|
30
|
+
variant: t1,
|
|
31
|
+
selectionVariant,
|
|
32
|
+
showDividers: t2,
|
|
33
|
+
role,
|
|
34
|
+
disableFocusZone: t3,
|
|
35
|
+
className,
|
|
36
|
+
...restProps
|
|
37
|
+
} = props);
|
|
38
|
+
$[0] = props;
|
|
39
|
+
$[1] = className;
|
|
40
|
+
$[2] = restProps;
|
|
41
|
+
$[3] = role;
|
|
42
|
+
$[4] = selectionVariant;
|
|
43
|
+
$[5] = t0;
|
|
44
|
+
$[6] = t1;
|
|
45
|
+
$[7] = t2;
|
|
46
|
+
$[8] = t3;
|
|
47
|
+
} else {
|
|
48
|
+
className = $[1];
|
|
49
|
+
restProps = $[2];
|
|
50
|
+
role = $[3];
|
|
51
|
+
selectionVariant = $[4];
|
|
52
|
+
t0 = $[5];
|
|
53
|
+
t1 = $[6];
|
|
54
|
+
t2 = $[7];
|
|
55
|
+
t3 = $[8];
|
|
56
|
+
}
|
|
57
|
+
const Component = t0 === undefined ? "ul" : t0;
|
|
58
|
+
const variant = t1 === undefined ? "inset" : t1;
|
|
59
|
+
const showDividers = t2 === undefined ? false : t2;
|
|
60
|
+
const disableFocusZone = t3 === undefined ? false : t3;
|
|
61
|
+
let t4;
|
|
62
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
63
|
+
t4 = {
|
|
64
|
+
heading: Heading
|
|
65
|
+
};
|
|
66
|
+
$[9] = t4;
|
|
67
|
+
} else {
|
|
68
|
+
t4 = $[9];
|
|
69
|
+
}
|
|
70
|
+
const [slots, childrenWithoutSlots] = useSlots(restProps.children, t4);
|
|
30
71
|
const headingId = useId();
|
|
31
|
-
|
|
32
|
-
/** if list is inside a Menu, it will get a role from the Menu */
|
|
33
72
|
const {
|
|
34
73
|
listRole: listRoleFromContainer,
|
|
35
74
|
listLabelledBy,
|
|
36
75
|
selectionVariant: containerSelectionVariant,
|
|
37
|
-
// TODO: Remove after DropdownMenu2 deprecation
|
|
38
76
|
enableFocusZone: enableFocusZoneFromContainer,
|
|
39
77
|
container
|
|
40
78
|
} = React.useContext(ActionListContainerContext);
|
|
@@ -42,23 +80,70 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
42
80
|
const listRole = role || listRoleFromContainer;
|
|
43
81
|
const listRef = useProvidedRefOrCreate(forwardedRef);
|
|
44
82
|
let enableFocusZone = false;
|
|
45
|
-
if (enableFocusZoneFromContainer !== undefined)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
83
|
+
if (enableFocusZoneFromContainer !== undefined) {
|
|
84
|
+
enableFocusZone = enableFocusZoneFromContainer;
|
|
85
|
+
} else {
|
|
86
|
+
if (listRole && !disableFocusZone) {
|
|
87
|
+
let t5;
|
|
88
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
89
|
+
t5 = ["menu", "menubar", "listbox"];
|
|
90
|
+
$[10] = t5;
|
|
91
|
+
} else {
|
|
92
|
+
t5 = $[10];
|
|
93
|
+
}
|
|
94
|
+
enableFocusZone = t5.includes(listRole);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const t5 = !enableFocusZone;
|
|
98
|
+
const t6 = listRole === "menu" || container === "SelectPanel" || container === "FilteredActionList" ? "wrap" : undefined;
|
|
99
|
+
let t7;
|
|
100
|
+
if ($[11] !== listRef || $[12] !== t5 || $[13] !== t6) {
|
|
101
|
+
t7 = {
|
|
102
|
+
disabled: t5,
|
|
103
|
+
containerRef: listRef,
|
|
104
|
+
bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd | FocusKeys.PageUpDown,
|
|
105
|
+
focusOutBehavior: t6
|
|
106
|
+
};
|
|
107
|
+
$[11] = listRef;
|
|
108
|
+
$[12] = t5;
|
|
109
|
+
$[13] = t6;
|
|
110
|
+
$[14] = t7;
|
|
111
|
+
} else {
|
|
112
|
+
t7 = $[14];
|
|
113
|
+
}
|
|
114
|
+
useFocusZone(t7);
|
|
115
|
+
const t8 = selectionVariant || containerSelectionVariant;
|
|
116
|
+
let t9;
|
|
117
|
+
if ($[15] !== headingId || $[16] !== listRole || $[17] !== showDividers || $[18] !== t8 || $[19] !== variant) {
|
|
118
|
+
t9 = {
|
|
54
119
|
variant,
|
|
55
|
-
selectionVariant:
|
|
120
|
+
selectionVariant: t8,
|
|
56
121
|
showDividers,
|
|
57
122
|
role: listRole,
|
|
58
123
|
headingId
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
124
|
+
};
|
|
125
|
+
$[15] = headingId;
|
|
126
|
+
$[16] = listRole;
|
|
127
|
+
$[17] = showDividers;
|
|
128
|
+
$[18] = t8;
|
|
129
|
+
$[19] = variant;
|
|
130
|
+
$[20] = t9;
|
|
131
|
+
} else {
|
|
132
|
+
t9 = $[20];
|
|
133
|
+
}
|
|
134
|
+
const t10 = slots.heading;
|
|
135
|
+
let t11;
|
|
136
|
+
if ($[21] !== className) {
|
|
137
|
+
t11 = clsx(classes.ActionList, className);
|
|
138
|
+
$[21] = className;
|
|
139
|
+
$[22] = t11;
|
|
140
|
+
} else {
|
|
141
|
+
t11 = $[22];
|
|
142
|
+
}
|
|
143
|
+
let t12;
|
|
144
|
+
if ($[23] !== Component || $[24] !== ariaLabelledBy || $[25] !== childrenWithoutSlots || $[26] !== listRef || $[27] !== listRole || $[28] !== restProps || $[29] !== showDividers || $[30] !== t11 || $[31] !== variant) {
|
|
145
|
+
t12 = /*#__PURE__*/jsx(Component, {
|
|
146
|
+
className: t11,
|
|
62
147
|
role: listRole,
|
|
63
148
|
"aria-labelledby": ariaLabelledBy,
|
|
64
149
|
ref: listRef,
|
|
@@ -66,10 +151,35 @@ const UnwrappedList = (props, forwardedRef) => {
|
|
|
66
151
|
"data-variant": variant,
|
|
67
152
|
...restProps,
|
|
68
153
|
children: childrenWithoutSlots
|
|
69
|
-
})
|
|
70
|
-
|
|
154
|
+
});
|
|
155
|
+
$[23] = Component;
|
|
156
|
+
$[24] = ariaLabelledBy;
|
|
157
|
+
$[25] = childrenWithoutSlots;
|
|
158
|
+
$[26] = listRef;
|
|
159
|
+
$[27] = listRole;
|
|
160
|
+
$[28] = restProps;
|
|
161
|
+
$[29] = showDividers;
|
|
162
|
+
$[30] = t11;
|
|
163
|
+
$[31] = variant;
|
|
164
|
+
$[32] = t12;
|
|
165
|
+
} else {
|
|
166
|
+
t12 = $[32];
|
|
167
|
+
}
|
|
168
|
+
let t13;
|
|
169
|
+
if ($[33] !== slots.heading || $[34] !== t12 || $[35] !== t9) {
|
|
170
|
+
t13 = /*#__PURE__*/jsxs(ListContext.Provider, {
|
|
171
|
+
value: t9,
|
|
172
|
+
children: [t10, t12]
|
|
173
|
+
});
|
|
174
|
+
$[33] = slots.heading;
|
|
175
|
+
$[34] = t12;
|
|
176
|
+
$[35] = t9;
|
|
177
|
+
$[36] = t13;
|
|
178
|
+
} else {
|
|
179
|
+
t13 = $[36];
|
|
180
|
+
}
|
|
181
|
+
return t13;
|
|
71
182
|
};
|
|
72
|
-
UnwrappedList.displayName = "UnwrappedList";
|
|
73
183
|
const List = fixedForwardRef(UnwrappedList);
|
|
74
184
|
Object.assign(List, {
|
|
75
185
|
displayName: 'ActionList'
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { CheckIcon } from '@primer/octicons-react';
|
|
3
4
|
import { GroupContext } from './Group.js';
|
|
@@ -8,10 +9,12 @@ import { warning } from '../utils/warning.js';
|
|
|
8
9
|
import { jsx } from 'react/jsx-runtime';
|
|
9
10
|
import Radio from '../Radio/Radio.js';
|
|
10
11
|
|
|
11
|
-
const Selection =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const Selection = t0 => {
|
|
13
|
+
const $ = c(11);
|
|
14
|
+
const {
|
|
15
|
+
selected,
|
|
16
|
+
className
|
|
17
|
+
} = t0;
|
|
15
18
|
const {
|
|
16
19
|
selectionVariant: listSelectionVariant,
|
|
17
20
|
role: listRole
|
|
@@ -19,48 +22,93 @@ const Selection = ({
|
|
|
19
22
|
const {
|
|
20
23
|
selectionVariant: groupSelectionVariant
|
|
21
24
|
} = React.useContext(GroupContext);
|
|
22
|
-
|
|
23
|
-
/** selectionVariant in Group can override the selectionVariant in List root */
|
|
24
|
-
/** fallback to selectionVariant from container menu if any (ActionMenu, SelectPanel ) */
|
|
25
25
|
let selectionVariant;
|
|
26
|
-
if (typeof groupSelectionVariant !==
|
|
26
|
+
if (typeof groupSelectionVariant !== "undefined") {
|
|
27
|
+
selectionVariant = groupSelectionVariant;
|
|
28
|
+
} else {
|
|
29
|
+
selectionVariant = listSelectionVariant;
|
|
30
|
+
}
|
|
27
31
|
if (!selectionVariant) {
|
|
28
|
-
// if selectionVariant is not set on List, but Item is selected
|
|
29
|
-
// warn in development
|
|
30
32
|
if (selected) {
|
|
31
|
-
process.env.NODE_ENV !== "production" ? warning(true,
|
|
33
|
+
process.env.NODE_ENV !== "production" ? warning(true, "For Item to be selected, ActionList or ActionList.Group should have a selectionVariant defined.") : void 0;
|
|
32
34
|
}
|
|
33
35
|
return null;
|
|
34
36
|
}
|
|
35
|
-
if (selectionVariant ===
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
children: /*#__PURE__*/jsx(Radio, {
|
|
37
|
+
if (selectionVariant === "radio") {
|
|
38
|
+
let t1;
|
|
39
|
+
if ($[0] !== selected) {
|
|
40
|
+
t1 = /*#__PURE__*/jsx(Radio, {
|
|
40
41
|
value: "unused",
|
|
41
42
|
checked: selected,
|
|
42
43
|
"aria-hidden": true,
|
|
43
44
|
tabIndex: -1
|
|
44
|
-
})
|
|
45
|
+
});
|
|
46
|
+
$[0] = selected;
|
|
47
|
+
$[1] = t1;
|
|
48
|
+
} else {
|
|
49
|
+
t1 = $[1];
|
|
50
|
+
}
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[2] !== className || $[3] !== t1) {
|
|
53
|
+
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
54
|
+
className: className,
|
|
55
|
+
"data-component": "ActionList.Selection",
|
|
56
|
+
children: t1
|
|
57
|
+
});
|
|
58
|
+
$[2] = className;
|
|
59
|
+
$[3] = t1;
|
|
60
|
+
$[4] = t2;
|
|
61
|
+
} else {
|
|
62
|
+
t2 = $[4];
|
|
63
|
+
}
|
|
64
|
+
return t2;
|
|
65
|
+
}
|
|
66
|
+
if (selectionVariant === "single" || listRole === "menu") {
|
|
67
|
+
let t1;
|
|
68
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
69
|
+
t1 = /*#__PURE__*/jsx(CheckIcon, {
|
|
70
|
+
className: classes.SingleSelectCheckmark
|
|
71
|
+
});
|
|
72
|
+
$[5] = t1;
|
|
73
|
+
} else {
|
|
74
|
+
t1 = $[5];
|
|
75
|
+
}
|
|
76
|
+
let t2;
|
|
77
|
+
if ($[6] !== className) {
|
|
78
|
+
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
79
|
+
className: className,
|
|
80
|
+
"data-component": "ActionList.Selection",
|
|
81
|
+
children: t1
|
|
82
|
+
});
|
|
83
|
+
$[6] = className;
|
|
84
|
+
$[7] = t2;
|
|
85
|
+
} else {
|
|
86
|
+
t2 = $[7];
|
|
87
|
+
}
|
|
88
|
+
return t2;
|
|
89
|
+
}
|
|
90
|
+
let t1;
|
|
91
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
92
|
+
t1 = /*#__PURE__*/jsx("div", {
|
|
93
|
+
className: classes.MultiSelectCheckbox
|
|
45
94
|
});
|
|
95
|
+
$[8] = t1;
|
|
96
|
+
} else {
|
|
97
|
+
t1 = $[8];
|
|
46
98
|
}
|
|
47
|
-
|
|
48
|
-
|
|
99
|
+
let t2;
|
|
100
|
+
if ($[9] !== className) {
|
|
101
|
+
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
49
102
|
className: className,
|
|
50
103
|
"data-component": "ActionList.Selection",
|
|
51
|
-
children:
|
|
52
|
-
className: classes.SingleSelectCheckmark
|
|
53
|
-
})
|
|
104
|
+
children: t1
|
|
54
105
|
});
|
|
106
|
+
$[9] = className;
|
|
107
|
+
$[10] = t2;
|
|
108
|
+
} else {
|
|
109
|
+
t2 = $[10];
|
|
55
110
|
}
|
|
56
|
-
return
|
|
57
|
-
className: className,
|
|
58
|
-
"data-component": "ActionList.Selection",
|
|
59
|
-
children: /*#__PURE__*/jsx("div", {
|
|
60
|
-
className: classes.MultiSelectCheckbox
|
|
61
|
-
})
|
|
62
|
-
});
|
|
111
|
+
return t2;
|
|
63
112
|
};
|
|
64
|
-
Selection.displayName = "Selection";
|
|
65
113
|
|
|
66
114
|
export { Selection };
|