@primer/react 0.0.0-20260227111155 → 0.0.0-20260227121550
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/TreeView/TreeView.d.ts.map +1 -1
- package/dist/TreeView/TreeView.js +101 -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 { CheckIcon } from '@primer/octicons-react';
|
|
4
3
|
import { GroupContext } from './Group.js';
|
|
@@ -9,12 +8,10 @@ import { warning } from '../utils/warning.js';
|
|
|
9
8
|
import { jsx } from 'react/jsx-runtime';
|
|
10
9
|
import Radio from '../Radio/Radio.js';
|
|
11
10
|
|
|
12
|
-
const Selection =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
className
|
|
17
|
-
} = t0;
|
|
11
|
+
const Selection = ({
|
|
12
|
+
selected,
|
|
13
|
+
className
|
|
14
|
+
}) => {
|
|
18
15
|
const {
|
|
19
16
|
selectionVariant: listSelectionVariant,
|
|
20
17
|
role: listRole
|
|
@@ -22,93 +19,48 @@ const Selection = t0 => {
|
|
|
22
19
|
const {
|
|
23
20
|
selectionVariant: groupSelectionVariant
|
|
24
21
|
} = 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 !==
|
|
27
|
-
selectionVariant = groupSelectionVariant;
|
|
28
|
-
} else {
|
|
29
|
-
selectionVariant = listSelectionVariant;
|
|
30
|
-
}
|
|
26
|
+
if (typeof groupSelectionVariant !== 'undefined') selectionVariant = groupSelectionVariant;else selectionVariant = listSelectionVariant;
|
|
31
27
|
if (!selectionVariant) {
|
|
28
|
+
// if selectionVariant is not set on List, but Item is selected
|
|
29
|
+
// warn in development
|
|
32
30
|
if (selected) {
|
|
33
|
-
process.env.NODE_ENV !== "production" ? warning(true,
|
|
31
|
+
process.env.NODE_ENV !== "production" ? warning(true, 'For Item to be selected, ActionList or ActionList.Group should have a selectionVariant defined.') : void 0;
|
|
34
32
|
}
|
|
35
33
|
return null;
|
|
36
34
|
}
|
|
37
|
-
if (selectionVariant ===
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
if (selectionVariant === 'radio') {
|
|
36
|
+
return /*#__PURE__*/jsx(VisualContainer, {
|
|
37
|
+
className: className,
|
|
38
|
+
"data-component": "ActionList.Selection",
|
|
39
|
+
children: /*#__PURE__*/jsx(Radio, {
|
|
41
40
|
value: "unused",
|
|
42
41
|
checked: selected,
|
|
43
42
|
"aria-hidden": true,
|
|
44
43
|
tabIndex: -1
|
|
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
|
|
44
|
+
})
|
|
94
45
|
});
|
|
95
|
-
$[8] = t1;
|
|
96
|
-
} else {
|
|
97
|
-
t1 = $[8];
|
|
98
46
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
47
|
+
if (selectionVariant === 'single' || listRole === 'menu') {
|
|
48
|
+
return /*#__PURE__*/jsx(VisualContainer, {
|
|
102
49
|
className: className,
|
|
103
50
|
"data-component": "ActionList.Selection",
|
|
104
|
-
children:
|
|
51
|
+
children: /*#__PURE__*/jsx(CheckIcon, {
|
|
52
|
+
className: classes.SingleSelectCheckmark
|
|
53
|
+
})
|
|
105
54
|
});
|
|
106
|
-
$[9] = className;
|
|
107
|
-
$[10] = t2;
|
|
108
|
-
} else {
|
|
109
|
-
t2 = $[10];
|
|
110
55
|
}
|
|
111
|
-
return
|
|
56
|
+
return /*#__PURE__*/jsx(VisualContainer, {
|
|
57
|
+
className: className,
|
|
58
|
+
"data-component": "ActionList.Selection",
|
|
59
|
+
children: /*#__PURE__*/jsx("div", {
|
|
60
|
+
className: classes.MultiSelectCheckbox
|
|
61
|
+
})
|
|
62
|
+
});
|
|
112
63
|
};
|
|
64
|
+
Selection.displayName = "Selection";
|
|
113
65
|
|
|
114
66
|
export { Selection };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { forwardRef } from 'react';
|
|
3
2
|
import { IconButton } from '../Button/IconButton.js';
|
|
4
3
|
import { ButtonComponent } from '../Button/Button.js';
|
|
@@ -6,59 +5,20 @@ import { clsx } from 'clsx';
|
|
|
6
5
|
import classes from './ActionList.module.css.js';
|
|
7
6
|
import { jsx } from 'react/jsx-runtime';
|
|
8
7
|
|
|
9
|
-
const TrailingAction = /*#__PURE__*/forwardRef((
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
label,
|
|
24
|
-
href: t2,
|
|
25
|
-
className,
|
|
26
|
-
style,
|
|
27
|
-
loading,
|
|
28
|
-
...props
|
|
29
|
-
} = t0);
|
|
30
|
-
$[0] = t0;
|
|
31
|
-
$[1] = className;
|
|
32
|
-
$[2] = icon;
|
|
33
|
-
$[3] = label;
|
|
34
|
-
$[4] = loading;
|
|
35
|
-
$[5] = props;
|
|
36
|
-
$[6] = style;
|
|
37
|
-
$[7] = t1;
|
|
38
|
-
$[8] = t2;
|
|
39
|
-
} else {
|
|
40
|
-
className = $[1];
|
|
41
|
-
icon = $[2];
|
|
42
|
-
label = $[3];
|
|
43
|
-
loading = $[4];
|
|
44
|
-
props = $[5];
|
|
45
|
-
style = $[6];
|
|
46
|
-
t1 = $[7];
|
|
47
|
-
t2 = $[8];
|
|
48
|
-
}
|
|
49
|
-
const as = t1 === undefined ? "button" : t1;
|
|
50
|
-
const href = t2 === undefined ? null : t2;
|
|
51
|
-
let t3;
|
|
52
|
-
if ($[9] !== className) {
|
|
53
|
-
t3 = clsx(className, classes.TrailingAction);
|
|
54
|
-
$[9] = className;
|
|
55
|
-
$[10] = t3;
|
|
56
|
-
} else {
|
|
57
|
-
t3 = $[10];
|
|
58
|
-
}
|
|
59
|
-
let t4;
|
|
60
|
-
if ($[11] !== as || $[12] !== forwardedRef || $[13] !== href || $[14] !== icon || $[15] !== label || $[16] !== loading || $[17] !== props) {
|
|
61
|
-
t4 = icon ? /*#__PURE__*/jsx(IconButton, {
|
|
8
|
+
const TrailingAction = /*#__PURE__*/forwardRef(({
|
|
9
|
+
as = 'button',
|
|
10
|
+
icon,
|
|
11
|
+
label,
|
|
12
|
+
href = null,
|
|
13
|
+
className,
|
|
14
|
+
style,
|
|
15
|
+
loading,
|
|
16
|
+
...props
|
|
17
|
+
}, forwardedRef) => {
|
|
18
|
+
return /*#__PURE__*/jsx("span", {
|
|
19
|
+
className: clsx(className, classes.TrailingAction),
|
|
20
|
+
style: style,
|
|
21
|
+
children: icon ? /*#__PURE__*/jsx(IconButton, {
|
|
62
22
|
as: as,
|
|
63
23
|
"aria-label": label,
|
|
64
24
|
icon: icon,
|
|
@@ -66,11 +26,16 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
66
26
|
tooltipDirection: "w",
|
|
67
27
|
href: href,
|
|
68
28
|
loading: loading,
|
|
69
|
-
"data-loading": Boolean(loading)
|
|
29
|
+
"data-loading": Boolean(loading)
|
|
30
|
+
// @ts-expect-error StyledButton wants both Anchor and Button refs
|
|
31
|
+
,
|
|
70
32
|
ref: forwardedRef,
|
|
71
33
|
className: classes.TrailingActionButton,
|
|
72
34
|
...props
|
|
73
|
-
}) :
|
|
35
|
+
}) :
|
|
36
|
+
/*#__PURE__*/
|
|
37
|
+
// @ts-expect-error shhh
|
|
38
|
+
jsx(ButtonComponent, {
|
|
74
39
|
variant: "invisible",
|
|
75
40
|
as: as,
|
|
76
41
|
href: href,
|
|
@@ -80,33 +45,8 @@ const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
80
45
|
className: classes.TrailingActionButton,
|
|
81
46
|
...props,
|
|
82
47
|
children: label
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
$[12] = forwardedRef;
|
|
86
|
-
$[13] = href;
|
|
87
|
-
$[14] = icon;
|
|
88
|
-
$[15] = label;
|
|
89
|
-
$[16] = loading;
|
|
90
|
-
$[17] = props;
|
|
91
|
-
$[18] = t4;
|
|
92
|
-
} else {
|
|
93
|
-
t4 = $[18];
|
|
94
|
-
}
|
|
95
|
-
let t5;
|
|
96
|
-
if ($[19] !== style || $[20] !== t3 || $[21] !== t4) {
|
|
97
|
-
t5 = /*#__PURE__*/jsx("span", {
|
|
98
|
-
className: t3,
|
|
99
|
-
style: style,
|
|
100
|
-
children: t4
|
|
101
|
-
});
|
|
102
|
-
$[19] = style;
|
|
103
|
-
$[20] = t3;
|
|
104
|
-
$[21] = t4;
|
|
105
|
-
$[22] = t5;
|
|
106
|
-
} else {
|
|
107
|
-
t5 = $[22];
|
|
108
|
-
}
|
|
109
|
-
return t5;
|
|
48
|
+
})
|
|
49
|
+
});
|
|
110
50
|
});
|
|
111
51
|
TrailingAction.__SLOT__ = Symbol('ActionList.TrailingAction');
|
|
112
52
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { AlertIcon } from '@primer/octicons-react';
|
|
4
3
|
import { ItemContext } from './shared.js';
|
|
@@ -8,183 +7,86 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
8
7
|
import { Tooltip } from '../TooltipV2/Tooltip.js';
|
|
9
8
|
import Spinner from '../Spinner/Spinner.js';
|
|
10
9
|
|
|
11
|
-
const VisualContainer =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = t0);
|
|
20
|
-
$[0] = t0;
|
|
21
|
-
$[1] = className;
|
|
22
|
-
$[2] = props;
|
|
23
|
-
} else {
|
|
24
|
-
className = $[1];
|
|
25
|
-
props = $[2];
|
|
26
|
-
}
|
|
27
|
-
let t1;
|
|
28
|
-
if ($[3] !== className) {
|
|
29
|
-
t1 = clsx(className, classes.VisualWrap);
|
|
30
|
-
$[3] = className;
|
|
31
|
-
$[4] = t1;
|
|
32
|
-
} else {
|
|
33
|
-
t1 = $[4];
|
|
34
|
-
}
|
|
35
|
-
let t2;
|
|
36
|
-
if ($[5] !== props || $[6] !== t1) {
|
|
37
|
-
t2 = /*#__PURE__*/jsx("span", {
|
|
38
|
-
className: t1,
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
$[5] = props;
|
|
42
|
-
$[6] = t1;
|
|
43
|
-
$[7] = t2;
|
|
44
|
-
} else {
|
|
45
|
-
t2 = $[7];
|
|
46
|
-
}
|
|
47
|
-
return t2;
|
|
10
|
+
const VisualContainer = ({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/jsx("span", {
|
|
15
|
+
className: clsx(className, classes.VisualWrap),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
48
18
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
$[1] = className;
|
|
60
|
-
$[2] = props;
|
|
61
|
-
} else {
|
|
62
|
-
className = $[1];
|
|
63
|
-
props = $[2];
|
|
64
|
-
}
|
|
65
|
-
let t1;
|
|
66
|
-
if ($[3] !== className) {
|
|
67
|
-
t1 = clsx(className, classes.LeadingVisual);
|
|
68
|
-
$[3] = className;
|
|
69
|
-
$[4] = t1;
|
|
70
|
-
} else {
|
|
71
|
-
t1 = $[4];
|
|
72
|
-
}
|
|
73
|
-
let t2;
|
|
74
|
-
if ($[5] !== props || $[6] !== t1) {
|
|
75
|
-
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
76
|
-
className: t1,
|
|
77
|
-
...props,
|
|
78
|
-
children: props.children
|
|
79
|
-
});
|
|
80
|
-
$[5] = props;
|
|
81
|
-
$[6] = t1;
|
|
82
|
-
$[7] = t2;
|
|
83
|
-
} else {
|
|
84
|
-
t2 = $[7];
|
|
85
|
-
}
|
|
86
|
-
return t2;
|
|
19
|
+
VisualContainer.displayName = "VisualContainer";
|
|
20
|
+
const LeadingVisual = ({
|
|
21
|
+
className,
|
|
22
|
+
...props
|
|
23
|
+
}) => {
|
|
24
|
+
return /*#__PURE__*/jsx(VisualContainer, {
|
|
25
|
+
className: clsx(className, classes.LeadingVisual),
|
|
26
|
+
...props,
|
|
27
|
+
children: props.children
|
|
28
|
+
});
|
|
87
29
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
({
|
|
94
|
-
className,
|
|
95
|
-
...props
|
|
96
|
-
} = t0);
|
|
97
|
-
$[0] = t0;
|
|
98
|
-
$[1] = className;
|
|
99
|
-
$[2] = props;
|
|
100
|
-
} else {
|
|
101
|
-
className = $[1];
|
|
102
|
-
props = $[2];
|
|
103
|
-
}
|
|
30
|
+
LeadingVisual.displayName = "LeadingVisual";
|
|
31
|
+
const TrailingVisual = ({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
104
35
|
const {
|
|
105
36
|
trailingVisualId
|
|
106
37
|
} = React.useContext(ItemContext);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
t1 = $[4];
|
|
114
|
-
}
|
|
115
|
-
let t2;
|
|
116
|
-
if ($[5] !== props || $[6] !== t1 || $[7] !== trailingVisualId) {
|
|
117
|
-
t2 = /*#__PURE__*/jsx(VisualContainer, {
|
|
118
|
-
className: t1,
|
|
119
|
-
id: trailingVisualId,
|
|
120
|
-
...props,
|
|
121
|
-
children: props.children
|
|
122
|
-
});
|
|
123
|
-
$[5] = props;
|
|
124
|
-
$[6] = t1;
|
|
125
|
-
$[7] = trailingVisualId;
|
|
126
|
-
$[8] = t2;
|
|
127
|
-
} else {
|
|
128
|
-
t2 = $[8];
|
|
129
|
-
}
|
|
130
|
-
return t2;
|
|
38
|
+
return /*#__PURE__*/jsx(VisualContainer, {
|
|
39
|
+
className: clsx(className, classes.TrailingVisual),
|
|
40
|
+
id: trailingVisualId,
|
|
41
|
+
...props,
|
|
42
|
+
children: props.children
|
|
43
|
+
});
|
|
131
44
|
};
|
|
132
|
-
|
|
45
|
+
TrailingVisual.displayName = "TrailingVisual";
|
|
133
46
|
// VisualOrIndicator handles the positioning of indicators and determines whether to show a visual or an indicator.
|
|
134
47
|
//
|
|
135
48
|
// If we're showing an *inactive* or *loading* indicator and a leading visual has NOT been passed,
|
|
136
49
|
// replace the trailing visual with the inactive indicator.
|
|
137
50
|
//
|
|
138
51
|
// This preserves the left alignment of item text.
|
|
139
|
-
const VisualOrIndicator =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
52
|
+
const VisualOrIndicator = ({
|
|
53
|
+
children,
|
|
54
|
+
labelId,
|
|
55
|
+
loading,
|
|
56
|
+
inactiveText,
|
|
57
|
+
itemHasLeadingVisual,
|
|
58
|
+
position,
|
|
59
|
+
className
|
|
60
|
+
}) => {
|
|
61
|
+
const VisualComponent = position === 'leading' ? LeadingVisual : TrailingVisual;
|
|
62
|
+
if (!loading && !inactiveText) return children;
|
|
63
|
+
if (itemHasLeadingVisual && position === 'trailing' ||
|
|
64
|
+
// has a leading visual, and it's in the trailing position, or
|
|
65
|
+
!itemHasLeadingVisual && position === 'leading' // it doesn't have a leading visual, and it's in the leading position
|
|
66
|
+
) {
|
|
67
|
+
// => so we don't render the indicator here
|
|
152
68
|
return children;
|
|
153
69
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
type: "button",
|
|
166
|
-
className: classes.InactiveButtonReset,
|
|
167
|
-
"aria-labelledby": labelId,
|
|
168
|
-
children: /*#__PURE__*/jsx(VisualComponent, {
|
|
169
|
-
children: /*#__PURE__*/jsx(AlertIcon, {})
|
|
170
|
-
})
|
|
70
|
+
return inactiveText ? /*#__PURE__*/jsx("span", {
|
|
71
|
+
className: classes.InactiveButtonWrap,
|
|
72
|
+
children: /*#__PURE__*/jsx(Tooltip, {
|
|
73
|
+
text: inactiveText,
|
|
74
|
+
type: "description",
|
|
75
|
+
children: /*#__PURE__*/jsx("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: classes.InactiveButtonReset,
|
|
78
|
+
"aria-labelledby": labelId,
|
|
79
|
+
children: /*#__PURE__*/jsx(VisualComponent, {
|
|
80
|
+
children: /*#__PURE__*/jsx(AlertIcon, {})
|
|
171
81
|
})
|
|
172
82
|
})
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
$[1] = className;
|
|
181
|
-
$[2] = inactiveText;
|
|
182
|
-
$[3] = labelId;
|
|
183
|
-
$[4] = t1;
|
|
184
|
-
} else {
|
|
185
|
-
t1 = $[4];
|
|
186
|
-
}
|
|
187
|
-
return t1;
|
|
83
|
+
})
|
|
84
|
+
}) : /*#__PURE__*/jsx(VisualComponent, {
|
|
85
|
+
className: className,
|
|
86
|
+
children: /*#__PURE__*/jsx(Spinner, {
|
|
87
|
+
size: "small"
|
|
88
|
+
})
|
|
89
|
+
});
|
|
188
90
|
};
|
|
189
91
|
LeadingVisual.displayName = 'ActionList.LeadingVisual';
|
|
190
92
|
TrailingVisual.displayName = 'ActionList.TrailingVisual';
|