@primer/react 38.31.0-rc.f96563b64 → 38.31.1-rc.43134a516
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 +8 -0
- package/dist/ActionBar/ActionBar.js +93 -98
- package/dist/Autocomplete/Autocomplete.js +131 -74
- package/dist/Autocomplete/AutocompleteMenu.js +277 -119
- package/dist/Autocomplete/AutocompleteOverlay.js +113 -38
- package/dist/Banner/Banner.js +414 -96
- package/dist/Button/Button.js +29 -8
- package/dist/Button/IconButton.js +120 -28
- package/dist/Button/LinkButton.js +34 -8
- package/dist/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/UnderlineNav/UnderlineNav.js +214 -63
- package/dist/UnderlineNav/UnderlineNavItem.js +94 -22
- package/dist/hooks/useMergedRefs.js +20 -11
- package/dist/hooks/useScrollFlash.js +24 -10
- package/dist/internal/components/OverflowObserverProvider.js +157 -0
- package/dist/internal/hooks/useOverflowObserver.js +57 -0
- package/dist/utils/descendant-registry.js +79 -42
- package/package.json +1 -1
|
@@ -3,43 +3,135 @@ import { ButtonBase } from "./ButtonBase.js";
|
|
|
3
3
|
import { TooltipContext } from "../TooltipV2/TooltipContext.js";
|
|
4
4
|
import { Tooltip } from "../TooltipV2/Tooltip.js";
|
|
5
5
|
import { TooltipContext as TooltipContext$1 } from "../Tooltip/TooltipContext.js";
|
|
6
|
+
import { c } from "react-compiler-runtime";
|
|
6
7
|
import { clsx } from "clsx";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
import React, { forwardRef } from "react";
|
|
9
10
|
//#region src/Button/IconButton.tsx
|
|
10
|
-
const IconButton = /*#__PURE__*/ forwardRef((
|
|
11
|
+
const IconButton = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
12
|
+
const $ = c(36);
|
|
13
|
+
let Icon;
|
|
14
|
+
let ariaLabel;
|
|
15
|
+
let className;
|
|
16
|
+
let description;
|
|
17
|
+
let disabled;
|
|
18
|
+
let keybindingHint;
|
|
19
|
+
let keyshortcuts;
|
|
20
|
+
let props;
|
|
21
|
+
let t1;
|
|
22
|
+
let tooltipDirection;
|
|
23
|
+
if ($[0] !== t0) {
|
|
24
|
+
({icon: Icon, "aria-label": ariaLabel, description, disabled, tooltipDirection, unsafeDisableTooltip: t1, keyshortcuts, keybindingHint, className, ...props} = t0);
|
|
25
|
+
$[0] = t0;
|
|
26
|
+
$[1] = Icon;
|
|
27
|
+
$[2] = ariaLabel;
|
|
28
|
+
$[3] = className;
|
|
29
|
+
$[4] = description;
|
|
30
|
+
$[5] = disabled;
|
|
31
|
+
$[6] = keybindingHint;
|
|
32
|
+
$[7] = keyshortcuts;
|
|
33
|
+
$[8] = props;
|
|
34
|
+
$[9] = t1;
|
|
35
|
+
$[10] = tooltipDirection;
|
|
36
|
+
} else {
|
|
37
|
+
Icon = $[1];
|
|
38
|
+
ariaLabel = $[2];
|
|
39
|
+
className = $[3];
|
|
40
|
+
description = $[4];
|
|
41
|
+
disabled = $[5];
|
|
42
|
+
keybindingHint = $[6];
|
|
43
|
+
keyshortcuts = $[7];
|
|
44
|
+
props = $[8];
|
|
45
|
+
t1 = $[9];
|
|
46
|
+
tooltipDirection = $[10];
|
|
47
|
+
}
|
|
48
|
+
const unsafeDisableTooltip = t1 === void 0 ? false : t1;
|
|
11
49
|
const { tooltipId } = React.useContext(TooltipContext);
|
|
12
50
|
const { tooltipId: tooltipIdV1 } = React.useContext(TooltipContext$1);
|
|
13
51
|
const { "aria-expanded": isExpanded, "aria-haspopup": hasPopup } = props;
|
|
14
52
|
const hasExternalTooltip = tooltipId || tooltipIdV1;
|
|
15
53
|
const hasActivePopup = (isExpanded === true || isExpanded === "true") && hasPopup === "true";
|
|
16
|
-
if (unsafeDisableTooltip || disabled || ariaLabel === void 0 || ariaLabel === "" || hasExternalTooltip)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
if (unsafeDisableTooltip || disabled || ariaLabel === void 0 || ariaLabel === "" || hasExternalTooltip) {
|
|
55
|
+
let t2;
|
|
56
|
+
if ($[11] !== className) {
|
|
57
|
+
t2 = clsx(className, ButtonBase_module_css_default.IconButton);
|
|
58
|
+
$[11] = className;
|
|
59
|
+
$[12] = t2;
|
|
60
|
+
} else t2 = $[12];
|
|
61
|
+
let t3;
|
|
62
|
+
if ($[13] !== Icon || $[14] !== ariaLabel || $[15] !== disabled || $[16] !== forwardedRef || $[17] !== props || $[18] !== t2) {
|
|
63
|
+
t3 = /*#__PURE__*/ jsx(ButtonBase, {
|
|
64
|
+
icon: Icon,
|
|
65
|
+
className: t2,
|
|
66
|
+
"data-component": "IconButton",
|
|
67
|
+
type: "button",
|
|
68
|
+
"aria-label": ariaLabel,
|
|
69
|
+
disabled,
|
|
70
|
+
...props,
|
|
71
|
+
ref: forwardedRef
|
|
72
|
+
});
|
|
73
|
+
$[13] = Icon;
|
|
74
|
+
$[14] = ariaLabel;
|
|
75
|
+
$[15] = disabled;
|
|
76
|
+
$[16] = forwardedRef;
|
|
77
|
+
$[17] = props;
|
|
78
|
+
$[18] = t2;
|
|
79
|
+
$[19] = t3;
|
|
80
|
+
} else t3 = $[19];
|
|
81
|
+
return t3;
|
|
82
|
+
} else {
|
|
83
|
+
var _description, _keybindingHint, _keyshortcuts;
|
|
84
|
+
const tooltipText = (_description = description) !== null && _description !== void 0 ? _description : ariaLabel;
|
|
85
|
+
const t2 = description ? void 0 : "label";
|
|
86
|
+
const t3 = (_keybindingHint = keybindingHint) !== null && _keybindingHint !== void 0 ? _keybindingHint : keyshortcuts;
|
|
87
|
+
let t4;
|
|
88
|
+
if ($[20] !== className) {
|
|
89
|
+
t4 = clsx(className, ButtonBase_module_css_default.IconButton);
|
|
90
|
+
$[20] = className;
|
|
91
|
+
$[21] = t4;
|
|
92
|
+
} else t4 = $[21];
|
|
93
|
+
const t5 = (_keyshortcuts = keyshortcuts) !== null && _keyshortcuts !== void 0 ? _keyshortcuts : void 0;
|
|
94
|
+
const t6 = description ? ariaLabel : void 0;
|
|
95
|
+
let t7;
|
|
96
|
+
if ($[22] !== Icon || $[23] !== props || $[24] !== t4 || $[25] !== t5 || $[26] !== t6) {
|
|
97
|
+
t7 = /*#__PURE__*/ jsx(ButtonBase, {
|
|
98
|
+
icon: Icon,
|
|
99
|
+
className: t4,
|
|
100
|
+
"data-component": "IconButton",
|
|
101
|
+
type: "button",
|
|
102
|
+
"aria-keyshortcuts": t5,
|
|
103
|
+
"aria-label": t6,
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
$[22] = Icon;
|
|
107
|
+
$[23] = props;
|
|
108
|
+
$[24] = t4;
|
|
109
|
+
$[25] = t5;
|
|
110
|
+
$[26] = t6;
|
|
111
|
+
$[27] = t7;
|
|
112
|
+
} else t7 = $[27];
|
|
113
|
+
let t8;
|
|
114
|
+
if ($[28] !== forwardedRef || $[29] !== hasActivePopup || $[30] !== t2 || $[31] !== t3 || $[32] !== t7 || $[33] !== tooltipDirection || $[34] !== tooltipText) {
|
|
115
|
+
t8 = /*#__PURE__*/ jsx(Tooltip, {
|
|
116
|
+
ref: forwardedRef,
|
|
117
|
+
text: tooltipText,
|
|
118
|
+
type: t2,
|
|
119
|
+
direction: tooltipDirection,
|
|
120
|
+
keybindingHint: t3,
|
|
121
|
+
_privateDisableTooltip: hasActivePopup,
|
|
122
|
+
children: t7
|
|
123
|
+
});
|
|
124
|
+
$[28] = forwardedRef;
|
|
125
|
+
$[29] = hasActivePopup;
|
|
126
|
+
$[30] = t2;
|
|
127
|
+
$[31] = t3;
|
|
128
|
+
$[32] = t7;
|
|
129
|
+
$[33] = tooltipDirection;
|
|
130
|
+
$[34] = tooltipText;
|
|
131
|
+
$[35] = t8;
|
|
132
|
+
} else t8 = $[35];
|
|
133
|
+
return t8;
|
|
134
|
+
}
|
|
43
135
|
});
|
|
44
136
|
//#endregion
|
|
45
137
|
export { IconButton };
|
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { ButtonBase } from "./ButtonBase.js";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
//#region src/Button/LinkButton.tsx
|
|
5
|
-
const LinkButton = /*#__PURE__*/ forwardRef((
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children
|
|
12
|
-
|
|
6
|
+
const LinkButton = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
7
|
+
const $ = c(9);
|
|
8
|
+
let children;
|
|
9
|
+
let props;
|
|
10
|
+
let t1;
|
|
11
|
+
if ($[0] !== t0) {
|
|
12
|
+
({children, as: t1, ...props} = t0);
|
|
13
|
+
$[0] = t0;
|
|
14
|
+
$[1] = children;
|
|
15
|
+
$[2] = props;
|
|
16
|
+
$[3] = t1;
|
|
17
|
+
} else {
|
|
18
|
+
children = $[1];
|
|
19
|
+
props = $[2];
|
|
20
|
+
t1 = $[3];
|
|
21
|
+
}
|
|
22
|
+
const Component = t1 === void 0 ? "a" : t1;
|
|
23
|
+
let t2;
|
|
24
|
+
if ($[4] !== Component || $[5] !== children || $[6] !== forwardedRef || $[7] !== props) {
|
|
25
|
+
t2 = /*#__PURE__*/ jsx(ButtonBase, {
|
|
26
|
+
as: Component,
|
|
27
|
+
ref: forwardedRef,
|
|
28
|
+
"data-component": "LinkButton",
|
|
29
|
+
...props,
|
|
30
|
+
children
|
|
31
|
+
});
|
|
32
|
+
$[4] = Component;
|
|
33
|
+
$[5] = children;
|
|
34
|
+
$[6] = forwardedRef;
|
|
35
|
+
$[7] = props;
|
|
36
|
+
$[8] = t2;
|
|
37
|
+
} else t2 = $[8];
|
|
38
|
+
return t2;
|
|
13
39
|
});
|
|
14
40
|
//#endregion
|
|
15
41
|
export { LinkButton };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
+
import "react";
|
|
4
5
|
//#region src/ConfirmationDialog/ConfirmationDialog.tsx
|
|
5
6
|
/**
|
|
6
7
|
* Props to customize the ConfirmationDialog.
|
|
@@ -12,37 +13,98 @@ import { useCallback } from "react";
|
|
|
12
13
|
* rendering capabilities are provided for ConfirmationDialog.
|
|
13
14
|
*/
|
|
14
15
|
const ConfirmationDialog = (props) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const $ = c(26);
|
|
17
|
+
const { onClose, title, cancelButtonContent: t0, confirmButtonContent: t1, confirmButtonType: t2, cancelButtonLoading: t3, confirmButtonLoading: t4, children, className, width: t5, height, overrideButtonFocus } = props;
|
|
18
|
+
const cancelButtonContent = t0 === void 0 ? "Cancel" : t0;
|
|
19
|
+
const confirmButtonContent = t1 === void 0 ? "OK" : t1;
|
|
20
|
+
const confirmButtonType = t2 === void 0 ? "normal" : t2;
|
|
21
|
+
const cancelButtonLoading = t3 === void 0 ? false : t3;
|
|
22
|
+
const confirmButtonLoading = t4 === void 0 ? false : t4;
|
|
23
|
+
const width = t5 === void 0 ? "medium" : t5;
|
|
24
|
+
let t6;
|
|
25
|
+
if ($[0] !== onClose) {
|
|
26
|
+
t6 = () => {
|
|
27
|
+
onClose("cancel");
|
|
28
|
+
};
|
|
29
|
+
$[0] = onClose;
|
|
30
|
+
$[1] = t6;
|
|
31
|
+
} else t6 = $[1];
|
|
32
|
+
const onCancelButtonClick = t6;
|
|
33
|
+
let t7;
|
|
34
|
+
if ($[2] !== onClose) {
|
|
35
|
+
t7 = () => {
|
|
36
|
+
onClose("confirm");
|
|
37
|
+
};
|
|
38
|
+
$[2] = onClose;
|
|
39
|
+
$[3] = t7;
|
|
40
|
+
} else t7 = $[3];
|
|
41
|
+
const onConfirmButtonClick = t7;
|
|
22
42
|
const buttonToFocus = overrideButtonFocus !== void 0 ? overrideButtonFocus : confirmButtonType === "danger" ? "cancel" : "confirm";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
footerButtons: [{
|
|
43
|
+
const t8 = buttonToFocus === "cancel";
|
|
44
|
+
let t9;
|
|
45
|
+
if ($[4] !== cancelButtonContent || $[5] !== cancelButtonLoading || $[6] !== onCancelButtonClick || $[7] !== t8) {
|
|
46
|
+
t9 = {
|
|
28
47
|
content: cancelButtonContent,
|
|
29
48
|
onClick: onCancelButtonClick,
|
|
30
|
-
autoFocus:
|
|
49
|
+
autoFocus: t8,
|
|
31
50
|
loading: cancelButtonLoading
|
|
32
|
-
}
|
|
51
|
+
};
|
|
52
|
+
$[4] = cancelButtonContent;
|
|
53
|
+
$[5] = cancelButtonLoading;
|
|
54
|
+
$[6] = onCancelButtonClick;
|
|
55
|
+
$[7] = t8;
|
|
56
|
+
$[8] = t9;
|
|
57
|
+
} else t9 = $[8];
|
|
58
|
+
const cancelButton = t9;
|
|
59
|
+
const t10 = buttonToFocus === "confirm";
|
|
60
|
+
let t11;
|
|
61
|
+
if ($[9] !== confirmButtonContent || $[10] !== confirmButtonLoading || $[11] !== confirmButtonType || $[12] !== onConfirmButtonClick || $[13] !== t10) {
|
|
62
|
+
t11 = {
|
|
33
63
|
content: confirmButtonContent,
|
|
34
64
|
buttonType: confirmButtonType,
|
|
35
65
|
onClick: onConfirmButtonClick,
|
|
36
|
-
autoFocus:
|
|
66
|
+
autoFocus: t10,
|
|
37
67
|
loading: confirmButtonLoading
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
};
|
|
69
|
+
$[9] = confirmButtonContent;
|
|
70
|
+
$[10] = confirmButtonLoading;
|
|
71
|
+
$[11] = confirmButtonType;
|
|
72
|
+
$[12] = onConfirmButtonClick;
|
|
73
|
+
$[13] = t10;
|
|
74
|
+
$[14] = t11;
|
|
75
|
+
} else t11 = $[14];
|
|
76
|
+
const confirmButton = t11;
|
|
77
|
+
let t12;
|
|
78
|
+
if ($[15] !== cancelButton || $[16] !== confirmButton) {
|
|
79
|
+
t12 = [cancelButton, confirmButton];
|
|
80
|
+
$[15] = cancelButton;
|
|
81
|
+
$[16] = confirmButton;
|
|
82
|
+
$[17] = t12;
|
|
83
|
+
} else t12 = $[17];
|
|
84
|
+
const footerButtons = t12;
|
|
85
|
+
let t13;
|
|
86
|
+
if ($[18] !== children || $[19] !== className || $[20] !== footerButtons || $[21] !== height || $[22] !== onClose || $[23] !== title || $[24] !== width) {
|
|
87
|
+
t13 = /*#__PURE__*/ jsx(Dialog, {
|
|
88
|
+
"data-component": "ConfirmationDialog",
|
|
89
|
+
onClose,
|
|
90
|
+
title,
|
|
91
|
+
footerButtons,
|
|
92
|
+
role: "alertdialog",
|
|
93
|
+
width,
|
|
94
|
+
height,
|
|
95
|
+
className,
|
|
96
|
+
children
|
|
97
|
+
});
|
|
98
|
+
$[18] = children;
|
|
99
|
+
$[19] = className;
|
|
100
|
+
$[20] = footerButtons;
|
|
101
|
+
$[21] = height;
|
|
102
|
+
$[22] = onClose;
|
|
103
|
+
$[23] = title;
|
|
104
|
+
$[24] = width;
|
|
105
|
+
$[25] = t13;
|
|
106
|
+
} else t13 = $[25];
|
|
107
|
+
return t13;
|
|
45
108
|
};
|
|
46
|
-
ConfirmationDialog.displayName = "ConfirmationDialog";
|
|
47
109
|
//#endregion
|
|
48
110
|
export { ConfirmationDialog };
|