@primer/react 0.0.0-20260226022908 → 0.0.0-20260226102817
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 +2 -98
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +152 -92
- package/dist/ActionList/ActionList-f4ac3b54.css +2 -0
- package/dist/ActionList/ActionList-f4ac3b54.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/ActionList/Description.js +35 -113
- package/dist/ActionList/Divider.js +11 -30
- package/dist/ActionList/Group.js +117 -294
- package/dist/ActionList/Heading.js +22 -77
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +37 -99
- package/dist/ActionList/LinkItem.js +24 -80
- package/dist/ActionList/List.js +33 -143
- package/dist/ActionList/Selection.js +30 -78
- package/dist/ActionList/TrailingAction.js +23 -83
- package/dist/ActionList/Visuals.js +64 -162
- package/dist/Autocomplete/Autocomplete.js +159 -76
- package/dist/Autocomplete/AutocompleteMenu.js +333 -128
- package/dist/Autocomplete/AutocompleteOverlay.js +130 -49
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +276 -112
- package/dist/Blankslate/{Blankslate-a039d79a.css → Blankslate-f5a9755a.css} +2 -2
- package/dist/Blankslate/Blankslate-f5a9755a.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 +14 -9
- package/dist/Checkbox/Checkbox.js +163 -55
- package/dist/Dialog/Dialog.js +347 -105
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.d.ts +1 -16
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +42 -147
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/Overlay/Overlay-43cda449.css +2 -0
- package/dist/Overlay/Overlay-43cda449.css.map +1 -0
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +2 -0
- package/dist/PageLayout/PageLayout-cb491b47.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +6 -117
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +1227 -750
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/index.d.ts +0 -1
- package/dist/PageLayout/index.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.d.ts +11 -38
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +198 -359
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +33 -85
- package/dist/SplitPageLayout/SplitPageLayout.d.ts +1 -4
- package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
- package/dist/SplitPageLayout/SplitPageLayout.js +2 -54
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +13 -10
- package/dist/Timeline/{Timeline-19bef8c5.css → Timeline-116393ee.css} +2 -2
- package/dist/Timeline/{Timeline-19bef8c5.css.map → Timeline-116393ee.css.map} +1 -1
- package/dist/Timeline/Timeline.module.css.js +1 -1
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +98 -59
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +4 -11
- package/dist/UnderlineNav/UnderlineNavItem.js +149 -56
- package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-f0c4b9ca.css.map → SelectPanel-1f8c23b5.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +593 -209
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useIsMacOS.d.ts +3 -15
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +26 -24
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +2 -10
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +22 -14
- package/dist/hooks/useSlots.d.ts +6 -50
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +36 -114
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.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 +4 -7
- package/generated/components.json +11 -239
- package/package.json +4 -4
- package/dist/ActionList/ActionList-c04a02d6.css +0 -2
- package/dist/ActionList/ActionList-c04a02d6.css.map +0 -1
- package/dist/Blankslate/Blankslate-a039d79a.css.map +0 -1
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +0 -1
- package/dist/Overlay/Overlay-15519c09.css +0 -2
- package/dist/Overlay/Overlay-15519c09.css.map +0 -1
- package/dist/PageLayout/PageLayout-3444a142.css +0 -2
- package/dist/PageLayout/PageLayout-3444a142.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { ItemContext } from './shared.js';
|
|
4
3
|
import classes from './ActionList.module.css.js';
|
|
@@ -6,125 +5,48 @@ import { clsx } from 'clsx';
|
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
7
6
|
import Truncate from '../Truncate/Truncate.js';
|
|
8
7
|
|
|
9
|
-
const Description =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if ($[0] !== t0) {
|
|
17
|
-
({
|
|
18
|
-
variant: t1,
|
|
19
|
-
className,
|
|
20
|
-
truncate,
|
|
21
|
-
style,
|
|
22
|
-
...props
|
|
23
|
-
} = t0);
|
|
24
|
-
$[0] = t0;
|
|
25
|
-
$[1] = className;
|
|
26
|
-
$[2] = props;
|
|
27
|
-
$[3] = style;
|
|
28
|
-
$[4] = t1;
|
|
29
|
-
$[5] = truncate;
|
|
30
|
-
} else {
|
|
31
|
-
className = $[1];
|
|
32
|
-
props = $[2];
|
|
33
|
-
style = $[3];
|
|
34
|
-
t1 = $[4];
|
|
35
|
-
truncate = $[5];
|
|
36
|
-
}
|
|
37
|
-
const variant = t1 === undefined ? "inline" : t1;
|
|
8
|
+
const Description = ({
|
|
9
|
+
variant = 'inline',
|
|
10
|
+
className,
|
|
11
|
+
truncate,
|
|
12
|
+
style,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
38
15
|
const {
|
|
39
16
|
blockDescriptionId,
|
|
40
17
|
inlineDescriptionId
|
|
41
18
|
} = React.useContext(ItemContext);
|
|
42
19
|
const containerRef = React.useRef(null);
|
|
43
|
-
const [computedTitle, setComputedTitle] = React.useState(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
$[6] = truncate;
|
|
53
|
-
$[7] = t2;
|
|
54
|
-
} else {
|
|
55
|
-
t2 = $[7];
|
|
56
|
-
}
|
|
57
|
-
let t3;
|
|
58
|
-
if ($[8] !== props.children || $[9] !== truncate) {
|
|
59
|
-
t3 = [truncate, props.children];
|
|
60
|
-
$[8] = props.children;
|
|
61
|
-
$[9] = truncate;
|
|
62
|
-
$[10] = t3;
|
|
63
|
-
} else {
|
|
64
|
-
t3 = $[10];
|
|
65
|
-
}
|
|
66
|
-
React.useEffect(t2, t3);
|
|
67
|
-
const effectiveTitle = typeof props.children === "string" ? props.children : computedTitle;
|
|
68
|
-
if (variant === "block" || !truncate) {
|
|
69
|
-
const t4 = variant === "block" ? blockDescriptionId : inlineDescriptionId;
|
|
70
|
-
let t5;
|
|
71
|
-
if ($[11] !== className) {
|
|
72
|
-
t5 = clsx(className, classes.Description);
|
|
73
|
-
$[11] = className;
|
|
74
|
-
$[12] = t5;
|
|
75
|
-
} else {
|
|
76
|
-
t5 = $[12];
|
|
77
|
-
}
|
|
78
|
-
let t6;
|
|
79
|
-
if ($[13] !== props.children || $[14] !== style || $[15] !== t4 || $[16] !== t5) {
|
|
80
|
-
t6 = /*#__PURE__*/jsx("span", {
|
|
81
|
-
id: t4,
|
|
82
|
-
className: t5,
|
|
83
|
-
style: style,
|
|
84
|
-
"data-component": "ActionList.Description",
|
|
85
|
-
children: props.children
|
|
86
|
-
});
|
|
87
|
-
$[13] = props.children;
|
|
88
|
-
$[14] = style;
|
|
89
|
-
$[15] = t4;
|
|
90
|
-
$[16] = t5;
|
|
91
|
-
$[17] = t6;
|
|
92
|
-
} else {
|
|
93
|
-
t6 = $[17];
|
|
20
|
+
const [computedTitle, setComputedTitle] = React.useState('');
|
|
21
|
+
|
|
22
|
+
// Extract text content from rendered DOM for tooltip
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
if (truncate && containerRef.current) {
|
|
25
|
+
const textContent = containerRef.current.textContent || '';
|
|
26
|
+
setComputedTitle(textContent);
|
|
94
27
|
}
|
|
95
|
-
|
|
28
|
+
}, [truncate, props.children]);
|
|
29
|
+
const effectiveTitle = typeof props.children === 'string' ? props.children : computedTitle;
|
|
30
|
+
if (variant === 'block' || !truncate) {
|
|
31
|
+
return /*#__PURE__*/jsx("span", {
|
|
32
|
+
id: variant === 'block' ? blockDescriptionId : inlineDescriptionId,
|
|
33
|
+
className: clsx(className, classes.Description),
|
|
34
|
+
style: style,
|
|
35
|
+
"data-component": "ActionList.Description",
|
|
36
|
+
children: props.children
|
|
37
|
+
});
|
|
96
38
|
} else {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
ref: containerRef,
|
|
109
|
-
id: inlineDescriptionId,
|
|
110
|
-
className: t4,
|
|
111
|
-
style: style,
|
|
112
|
-
title: effectiveTitle,
|
|
113
|
-
inline: true,
|
|
114
|
-
maxWidth: "100%",
|
|
115
|
-
"data-component": "ActionList.Description",
|
|
116
|
-
children: props.children
|
|
117
|
-
});
|
|
118
|
-
$[20] = effectiveTitle;
|
|
119
|
-
$[21] = inlineDescriptionId;
|
|
120
|
-
$[22] = props.children;
|
|
121
|
-
$[23] = style;
|
|
122
|
-
$[24] = t4;
|
|
123
|
-
$[25] = t5;
|
|
124
|
-
} else {
|
|
125
|
-
t5 = $[25];
|
|
126
|
-
}
|
|
127
|
-
return t5;
|
|
39
|
+
return /*#__PURE__*/jsx(Truncate, {
|
|
40
|
+
ref: containerRef,
|
|
41
|
+
id: inlineDescriptionId,
|
|
42
|
+
className: clsx(className, classes.Description),
|
|
43
|
+
style: style,
|
|
44
|
+
title: effectiveTitle,
|
|
45
|
+
inline: true,
|
|
46
|
+
maxWidth: "100%",
|
|
47
|
+
"data-component": "ActionList.Description",
|
|
48
|
+
children: props.children
|
|
49
|
+
});
|
|
128
50
|
}
|
|
129
51
|
};
|
|
130
52
|
Description.__SLOT__ = Symbol('ActionList.Description');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { clsx } from 'clsx';
|
|
3
2
|
import classes from './ActionList.module.css.js';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -6,36 +5,18 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
6
5
|
/**
|
|
7
6
|
* Visually separates `Items` or `Groups` in an `ActionList`.
|
|
8
7
|
*/
|
|
9
|
-
const Divider =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
$[1] = t1;
|
|
20
|
-
} else {
|
|
21
|
-
t1 = $[1];
|
|
22
|
-
}
|
|
23
|
-
let t2;
|
|
24
|
-
if ($[2] !== style || $[3] !== t1) {
|
|
25
|
-
t2 = /*#__PURE__*/jsx("li", {
|
|
26
|
-
className: t1,
|
|
27
|
-
style: style,
|
|
28
|
-
"aria-hidden": "true",
|
|
29
|
-
"data-component": "ActionList.Divider"
|
|
30
|
-
});
|
|
31
|
-
$[2] = style;
|
|
32
|
-
$[3] = t1;
|
|
33
|
-
$[4] = t2;
|
|
34
|
-
} else {
|
|
35
|
-
t2 = $[4];
|
|
36
|
-
}
|
|
37
|
-
return t2;
|
|
8
|
+
const Divider = ({
|
|
9
|
+
className,
|
|
10
|
+
style
|
|
11
|
+
}) => {
|
|
12
|
+
return /*#__PURE__*/jsx("li", {
|
|
13
|
+
className: clsx(className, classes.Divider),
|
|
14
|
+
style: style,
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
"data-component": "ActionList.Divider"
|
|
17
|
+
});
|
|
38
18
|
};
|
|
19
|
+
Divider.displayName = "Divider";
|
|
39
20
|
Divider.__SLOT__ = Symbol('ActionList.Divider');
|
|
40
21
|
|
|
41
22
|
export { Divider };
|
package/dist/ActionList/Group.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { useId } from '../hooks/useId.js';
|
|
4
3
|
import { ListContext } from './shared.js';
|
|
@@ -9,54 +8,21 @@ import classes from './ActionList.module.css.js';
|
|
|
9
8
|
import groupClasses from './Group.module.css.js';
|
|
10
9
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
11
10
|
|
|
12
|
-
const Heading =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...rest
|
|
26
|
-
} = t0);
|
|
27
|
-
$[0] = t0;
|
|
28
|
-
$[1] = children;
|
|
29
|
-
$[2] = className;
|
|
30
|
-
$[3] = id;
|
|
31
|
-
$[4] = rest;
|
|
32
|
-
$[5] = t1;
|
|
33
|
-
} else {
|
|
34
|
-
children = $[1];
|
|
35
|
-
className = $[2];
|
|
36
|
-
id = $[3];
|
|
37
|
-
rest = $[4];
|
|
38
|
-
t1 = $[5];
|
|
39
|
-
}
|
|
40
|
-
const Component = t1 === undefined ? "h3" : t1;
|
|
41
|
-
let t2;
|
|
42
|
-
if ($[6] !== Component || $[7] !== children || $[8] !== className || $[9] !== id || $[10] !== rest) {
|
|
43
|
-
t2 = /*#__PURE__*/jsx(Component, {
|
|
44
|
-
className: className,
|
|
45
|
-
id: id,
|
|
46
|
-
...rest,
|
|
47
|
-
children: children
|
|
48
|
-
});
|
|
49
|
-
$[6] = Component;
|
|
50
|
-
$[7] = children;
|
|
51
|
-
$[8] = className;
|
|
52
|
-
$[9] = id;
|
|
53
|
-
$[10] = rest;
|
|
54
|
-
$[11] = t2;
|
|
55
|
-
} else {
|
|
56
|
-
t2 = $[11];
|
|
57
|
-
}
|
|
58
|
-
return t2;
|
|
11
|
+
const Heading = ({
|
|
12
|
+
as: Component = 'h3',
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
id,
|
|
16
|
+
...rest
|
|
17
|
+
}) => {
|
|
18
|
+
return /*#__PURE__*/jsx(Component, {
|
|
19
|
+
className: className,
|
|
20
|
+
id: id,
|
|
21
|
+
...rest,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
59
24
|
};
|
|
25
|
+
Heading.displayName = "Heading";
|
|
60
26
|
const HeadingWrap = ({
|
|
61
27
|
as = 'div',
|
|
62
28
|
children,
|
|
@@ -72,168 +38,66 @@ const GroupContext = /*#__PURE__*/React.createContext({
|
|
|
72
38
|
groupHeadingId: undefined,
|
|
73
39
|
selectionVariant: undefined
|
|
74
40
|
});
|
|
75
|
-
const Group =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if ($[0] !== t0) {
|
|
87
|
-
({
|
|
88
|
-
title,
|
|
89
|
-
variant: t1,
|
|
90
|
-
auxiliaryText,
|
|
91
|
-
selectionVariant,
|
|
92
|
-
role,
|
|
93
|
-
className,
|
|
94
|
-
"aria-label": ariaLabel,
|
|
95
|
-
...props
|
|
96
|
-
} = t0);
|
|
97
|
-
$[0] = t0;
|
|
98
|
-
$[1] = ariaLabel;
|
|
99
|
-
$[2] = auxiliaryText;
|
|
100
|
-
$[3] = className;
|
|
101
|
-
$[4] = props;
|
|
102
|
-
$[5] = role;
|
|
103
|
-
$[6] = selectionVariant;
|
|
104
|
-
$[7] = t1;
|
|
105
|
-
$[8] = title;
|
|
106
|
-
} else {
|
|
107
|
-
ariaLabel = $[1];
|
|
108
|
-
auxiliaryText = $[2];
|
|
109
|
-
className = $[3];
|
|
110
|
-
props = $[4];
|
|
111
|
-
role = $[5];
|
|
112
|
-
selectionVariant = $[6];
|
|
113
|
-
t1 = $[7];
|
|
114
|
-
title = $[8];
|
|
115
|
-
}
|
|
116
|
-
const variant = t1 === undefined ? "subtle" : t1;
|
|
41
|
+
const Group = ({
|
|
42
|
+
title,
|
|
43
|
+
variant = 'subtle',
|
|
44
|
+
auxiliaryText,
|
|
45
|
+
selectionVariant,
|
|
46
|
+
role,
|
|
47
|
+
className,
|
|
48
|
+
'aria-label': ariaLabel,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
var _slots$groupHeading;
|
|
117
52
|
const id = useId();
|
|
118
53
|
const {
|
|
119
54
|
role: listRole
|
|
120
55
|
} = React.useContext(ListContext);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
groupHeading: GroupHeading
|
|
125
|
-
};
|
|
126
|
-
$[9] = t2;
|
|
127
|
-
} else {
|
|
128
|
-
t2 = $[9];
|
|
129
|
-
}
|
|
130
|
-
const [slots, childrenWithoutSlots] = useSlots(props.children, t2);
|
|
56
|
+
const [slots, childrenWithoutSlots] = useSlots(props.children, {
|
|
57
|
+
groupHeading: GroupHeading
|
|
58
|
+
});
|
|
131
59
|
let groupHeadingId = undefined;
|
|
60
|
+
|
|
61
|
+
// ActionList.GroupHeading
|
|
132
62
|
if (slots.groupHeading) {
|
|
133
63
|
var _slots$groupHeading$p;
|
|
64
|
+
// If there is an id prop passed in the ActionList.GroupHeading, use it otherwise use the generated id.
|
|
134
65
|
groupHeadingId = (_slots$groupHeading$p = slots.groupHeading.props.id) !== null && _slots$groupHeading$p !== void 0 ? _slots$groupHeading$p : id;
|
|
135
66
|
}
|
|
67
|
+
// Supports the deprecated `title` prop
|
|
136
68
|
if (title) {
|
|
137
69
|
groupHeadingId = id;
|
|
138
70
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
$[15] = auxiliaryText;
|
|
168
|
-
$[16] = slots.groupHeading;
|
|
169
|
-
$[17] = title;
|
|
170
|
-
$[18] = variant;
|
|
171
|
-
$[19] = t6;
|
|
172
|
-
} else {
|
|
173
|
-
t6 = $[19];
|
|
174
|
-
}
|
|
175
|
-
let t7;
|
|
176
|
-
if ($[20] !== slots.groupHeading || $[21] !== title) {
|
|
177
|
-
t7 = !title && slots.groupHeading ? /*#__PURE__*/React.cloneElement(slots.groupHeading) : null;
|
|
178
|
-
$[20] = slots.groupHeading;
|
|
179
|
-
$[21] = title;
|
|
180
|
-
$[22] = t7;
|
|
181
|
-
} else {
|
|
182
|
-
t7 = $[22];
|
|
183
|
-
}
|
|
184
|
-
const t8 = listRole ? undefined : groupHeadingId;
|
|
185
|
-
const t9 = (_ariaLabel = ariaLabel) !== null && _ariaLabel !== void 0 ? _ariaLabel : listRole ? (_title = title) !== null && _title !== void 0 ? _title : (_slots$groupHeading = slots.groupHeading) === null || _slots$groupHeading === void 0 ? void 0 : _slots$groupHeading.props.children : undefined;
|
|
186
|
-
const t10 = role || listRole && "group";
|
|
187
|
-
const t11 = slots.groupHeading ? childrenWithoutSlots : props.children;
|
|
188
|
-
let t12;
|
|
189
|
-
if ($[23] !== t10 || $[24] !== t11 || $[25] !== t8 || $[26] !== t9) {
|
|
190
|
-
t12 = /*#__PURE__*/jsx("ul", {
|
|
191
|
-
"aria-labelledby": t8,
|
|
192
|
-
"aria-label": t9,
|
|
193
|
-
role: t10,
|
|
194
|
-
className: groupClasses.GroupList,
|
|
195
|
-
children: t11
|
|
196
|
-
});
|
|
197
|
-
$[23] = t10;
|
|
198
|
-
$[24] = t11;
|
|
199
|
-
$[25] = t8;
|
|
200
|
-
$[26] = t9;
|
|
201
|
-
$[27] = t12;
|
|
202
|
-
} else {
|
|
203
|
-
t12 = $[27];
|
|
204
|
-
}
|
|
205
|
-
let t13;
|
|
206
|
-
if ($[28] !== t12 || $[29] !== t5 || $[30] !== t6 || $[31] !== t7) {
|
|
207
|
-
t13 = /*#__PURE__*/jsxs(GroupContext.Provider, {
|
|
208
|
-
value: t5,
|
|
209
|
-
children: [t6, t7, t12]
|
|
210
|
-
});
|
|
211
|
-
$[28] = t12;
|
|
212
|
-
$[29] = t5;
|
|
213
|
-
$[30] = t6;
|
|
214
|
-
$[31] = t7;
|
|
215
|
-
$[32] = t13;
|
|
216
|
-
} else {
|
|
217
|
-
t13 = $[32];
|
|
218
|
-
}
|
|
219
|
-
let t14;
|
|
220
|
-
if ($[33] !== props || $[34] !== t13 || $[35] !== t3 || $[36] !== t4) {
|
|
221
|
-
t14 = /*#__PURE__*/jsx("li", {
|
|
222
|
-
className: t3,
|
|
223
|
-
role: t4,
|
|
224
|
-
...props,
|
|
225
|
-
children: t13
|
|
226
|
-
});
|
|
227
|
-
$[33] = props;
|
|
228
|
-
$[34] = t13;
|
|
229
|
-
$[35] = t3;
|
|
230
|
-
$[36] = t4;
|
|
231
|
-
$[37] = t14;
|
|
232
|
-
} else {
|
|
233
|
-
t14 = $[37];
|
|
234
|
-
}
|
|
235
|
-
return t14;
|
|
71
|
+
return /*#__PURE__*/jsx("li", {
|
|
72
|
+
className: clsx(className, groupClasses.Group),
|
|
73
|
+
role: listRole ? 'none' : undefined,
|
|
74
|
+
...props,
|
|
75
|
+
children: /*#__PURE__*/jsxs(GroupContext.Provider, {
|
|
76
|
+
value: {
|
|
77
|
+
selectionVariant,
|
|
78
|
+
groupHeadingId
|
|
79
|
+
},
|
|
80
|
+
children: [title && !slots.groupHeading ?
|
|
81
|
+
/*#__PURE__*/
|
|
82
|
+
// Escape hatch: supports old API <ActionList.Group title="group title"> in a non breaking way
|
|
83
|
+
jsx(GroupHeading, {
|
|
84
|
+
variant: variant,
|
|
85
|
+
auxiliaryText: auxiliaryText,
|
|
86
|
+
_internalBackwardCompatibleTitle: title
|
|
87
|
+
}) : null, !title && slots.groupHeading ? /*#__PURE__*/React.cloneElement(slots.groupHeading) : null, /*#__PURE__*/jsx("ul", {
|
|
88
|
+
// if listRole is set (listbox or menu), we don't label the list with the groupHeadingId
|
|
89
|
+
// because the heading is hidden from the accessibility tree and only used for presentation role.
|
|
90
|
+
// We will instead use aria-label to label the list. See a line below.
|
|
91
|
+
"aria-labelledby": listRole ? undefined : groupHeadingId,
|
|
92
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : listRole ? title !== null && title !== void 0 ? title : (_slots$groupHeading = slots.groupHeading) === null || _slots$groupHeading === void 0 ? void 0 : _slots$groupHeading.props.children : undefined,
|
|
93
|
+
role: role || listRole && 'group',
|
|
94
|
+
className: groupClasses.GroupList,
|
|
95
|
+
children: slots.groupHeading ? childrenWithoutSlots : props.children
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
});
|
|
236
99
|
};
|
|
100
|
+
Group.displayName = "Group";
|
|
237
101
|
/**
|
|
238
102
|
* Heading of a `Group`.
|
|
239
103
|
*
|
|
@@ -242,110 +106,69 @@ const Group = t0 => {
|
|
|
242
106
|
* hidden from the accessibility tree due to the limitation of listbox children. https://w3c.github.io/aria/#listbox
|
|
243
107
|
* groups under menu or listbox are labelled by `aria-label`
|
|
244
108
|
*/
|
|
245
|
-
const GroupHeading =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
({
|
|
257
|
-
as,
|
|
258
|
-
variant: t1,
|
|
259
|
-
_internalBackwardCompatibleTitle,
|
|
260
|
-
auxiliaryText,
|
|
261
|
-
children,
|
|
262
|
-
className,
|
|
263
|
-
headingWrapElement: t2,
|
|
264
|
-
...props
|
|
265
|
-
} = t0);
|
|
266
|
-
$[0] = t0;
|
|
267
|
-
$[1] = _internalBackwardCompatibleTitle;
|
|
268
|
-
$[2] = as;
|
|
269
|
-
$[3] = auxiliaryText;
|
|
270
|
-
$[4] = children;
|
|
271
|
-
$[5] = className;
|
|
272
|
-
$[6] = props;
|
|
273
|
-
$[7] = t1;
|
|
274
|
-
$[8] = t2;
|
|
275
|
-
} else {
|
|
276
|
-
_internalBackwardCompatibleTitle = $[1];
|
|
277
|
-
as = $[2];
|
|
278
|
-
auxiliaryText = $[3];
|
|
279
|
-
children = $[4];
|
|
280
|
-
className = $[5];
|
|
281
|
-
props = $[6];
|
|
282
|
-
t1 = $[7];
|
|
283
|
-
t2 = $[8];
|
|
284
|
-
}
|
|
285
|
-
const variant = t1 === undefined ? "subtle" : t1;
|
|
286
|
-
const headingWrapElement = t2 === undefined ? "div" : t2;
|
|
109
|
+
const GroupHeading = ({
|
|
110
|
+
as,
|
|
111
|
+
variant = 'subtle',
|
|
112
|
+
// We are not recommending this prop to be used, it should only be used internally for incremental rollout.
|
|
113
|
+
_internalBackwardCompatibleTitle,
|
|
114
|
+
auxiliaryText,
|
|
115
|
+
children,
|
|
116
|
+
className,
|
|
117
|
+
headingWrapElement = 'div',
|
|
118
|
+
...props
|
|
119
|
+
}) => {
|
|
287
120
|
const {
|
|
288
121
|
role: listRole
|
|
289
122
|
} = React.useContext(ListContext);
|
|
290
123
|
const {
|
|
291
124
|
groupHeadingId
|
|
292
125
|
} = React.useContext(GroupContext);
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
126
|
+
// for list role, the headings are proper heading tags, for menu and listbox, they are just representational and divs
|
|
127
|
+
const missingAsForList = (listRole === undefined || listRole === 'list') && children !== undefined && as === undefined;
|
|
128
|
+
const unnecessaryAsForListboxOrMenu = listRole !== undefined && listRole !== 'list' && children !== undefined && as !== undefined;
|
|
129
|
+
!
|
|
130
|
+
// 'as' prop is required for list roles. <GroupHeading as="h2">...</GroupHeading>
|
|
131
|
+
!missingAsForList ? process.env.NODE_ENV !== "production" ? invariant(false, `You are setting a heading for a list, that requires a heading level. Please use 'as' prop to set a proper heading level.`) : invariant(false) : void 0;
|
|
132
|
+
!
|
|
133
|
+
// 'as' prop on listbox or menu roles are not needed since they are rendered as divs and they could be misleading.
|
|
134
|
+
!unnecessaryAsForListboxOrMenu ? process.env.NODE_ENV !== "production" ? invariant(false, `Looks like you are trying to set a heading level to a ${listRole} role. Group headings for ${listRole} type action lists are for representational purposes, and rendered as divs. Therefore they don't need a heading level.`) : invariant(false) : void 0;
|
|
135
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
136
|
+
children: listRole && listRole !== 'list' ? /*#__PURE__*/jsxs(HeadingWrap, {
|
|
137
|
+
role: "presentation",
|
|
138
|
+
className: groupClasses.GroupHeadingWrap,
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
"data-variant": variant,
|
|
141
|
+
"data-component": "GroupHeadingWrap",
|
|
142
|
+
as: headingWrapElement,
|
|
143
|
+
...props,
|
|
144
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
145
|
+
className: clsx(className, groupClasses.GroupHeading),
|
|
146
|
+
id: groupHeadingId,
|
|
147
|
+
children: _internalBackwardCompatibleTitle !== null && _internalBackwardCompatibleTitle !== void 0 ? _internalBackwardCompatibleTitle : children
|
|
148
|
+
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
149
|
+
className: classes.Description,
|
|
150
|
+
children: auxiliaryText
|
|
151
|
+
})]
|
|
152
|
+
}) :
|
|
153
|
+
/*#__PURE__*/
|
|
154
|
+
// for explicit (role="list" is passed as prop) and implicit list roles (ActionList ins rendered as list by default), group titles are proper heading tags.
|
|
155
|
+
jsxs(HeadingWrap, {
|
|
156
|
+
className: groupClasses.GroupHeadingWrap,
|
|
157
|
+
"data-variant": variant,
|
|
158
|
+
as: headingWrapElement,
|
|
159
|
+
"data-component": "GroupHeadingWrap",
|
|
160
|
+
children: [/*#__PURE__*/jsx(Heading, {
|
|
161
|
+
className: clsx(className, groupClasses.GroupHeading),
|
|
162
|
+
as: as || 'h3',
|
|
163
|
+
id: groupHeadingId,
|
|
308
164
|
...props,
|
|
309
|
-
children:
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
})]
|
|
317
|
-
}) : /*#__PURE__*/jsxs(HeadingWrap, {
|
|
318
|
-
className: groupClasses.GroupHeadingWrap,
|
|
319
|
-
"data-variant": variant,
|
|
320
|
-
as: headingWrapElement,
|
|
321
|
-
"data-component": "GroupHeadingWrap",
|
|
322
|
-
children: [/*#__PURE__*/jsx(Heading, {
|
|
323
|
-
className: clsx(className, groupClasses.GroupHeading),
|
|
324
|
-
as: as || "h3",
|
|
325
|
-
id: groupHeadingId,
|
|
326
|
-
...props,
|
|
327
|
-
children: (_internalBackwardComp2 = _internalBackwardCompatibleTitle) !== null && _internalBackwardComp2 !== void 0 ? _internalBackwardComp2 : children
|
|
328
|
-
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
329
|
-
className: classes.Description,
|
|
330
|
-
children: auxiliaryText
|
|
331
|
-
})]
|
|
332
|
-
})
|
|
333
|
-
});
|
|
334
|
-
$[9] = _internalBackwardCompatibleTitle;
|
|
335
|
-
$[10] = as;
|
|
336
|
-
$[11] = auxiliaryText;
|
|
337
|
-
$[12] = children;
|
|
338
|
-
$[13] = className;
|
|
339
|
-
$[14] = groupHeadingId;
|
|
340
|
-
$[15] = headingWrapElement;
|
|
341
|
-
$[16] = listRole;
|
|
342
|
-
$[17] = props;
|
|
343
|
-
$[18] = variant;
|
|
344
|
-
$[19] = t3;
|
|
345
|
-
} else {
|
|
346
|
-
t3 = $[19];
|
|
347
|
-
}
|
|
348
|
-
return t3;
|
|
165
|
+
children: _internalBackwardCompatibleTitle !== null && _internalBackwardCompatibleTitle !== void 0 ? _internalBackwardCompatibleTitle : children
|
|
166
|
+
}), auxiliaryText && /*#__PURE__*/jsx("div", {
|
|
167
|
+
className: classes.Description,
|
|
168
|
+
children: auxiliaryText
|
|
169
|
+
})]
|
|
170
|
+
})
|
|
171
|
+
});
|
|
349
172
|
};
|
|
350
173
|
GroupHeading.displayName = 'ActionList.GroupHeading';
|
|
351
174
|
Group.displayName = 'ActionList.Group';
|