@primer/react 0.0.0-20260701235500 → 0.0.0-20260702155148
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 +7 -1
- package/dist/ActionList/Heading.js +25 -35
- package/dist/ActionList/List.js +46 -45
- package/dist/AnchoredOverlay/AnchoredOverlay.js +2 -4
- package/dist/Autocomplete/Autocomplete.js +131 -74
- package/dist/Autocomplete/AutocompleteInput.js +7 -10
- 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/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.js +4 -5
- package/dist/ConfirmationDialog/ConfirmationDialog.js +86 -24
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FilteredActionList/FilteredActionList.js +5 -7
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/PageLayout/PageLayout.js +1274 -478
- package/dist/Pagination/Pagination.js +196 -70
- package/dist/SelectPanel/SelectPanelMessage.js +72 -29
- package/dist/TextInput/TextInput.js +4 -5
- package/dist/TooltipV2/Tooltip.js +5 -15
- package/dist/UnderlineNav/UnderlineNav-964b246d.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-964b246d.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.js +198 -64
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +110 -22
- package/dist/experimental/Tabs/types.d.ts +2 -2
- package/dist/experimental/Tabs/useTabList.js +15 -16
- package/dist/hooks/useMergedRefs.js +20 -14
- package/dist/hooks/useOpenAndCloseFocus.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.js +10 -7
- package/dist/hooks/useScrollFlash.js +24 -10
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-25587345.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-47547980.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-47547980.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +0 -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,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { FocusKeys, useFocusZone } from "../hooks/useFocusZone.js";
|
|
3
3
|
import ButtonGroup_module_css_default from "./ButtonGroup.module.css.js";
|
|
4
4
|
import { c } from "react-compiler-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import React
|
|
7
|
+
import React from "react";
|
|
8
8
|
//#region src/ButtonGroup/ButtonGroup.tsx
|
|
9
9
|
const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
10
|
-
const $ = c(
|
|
10
|
+
const $ = c(20);
|
|
11
11
|
let children;
|
|
12
12
|
let className;
|
|
13
13
|
let rest;
|
|
@@ -29,8 +29,6 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
29
29
|
t1 = $[5];
|
|
30
30
|
}
|
|
31
31
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
32
|
-
const buttonRef = useRef(null);
|
|
33
|
-
const mergedRef = useMergedRefs(buttonRef, forwardRef);
|
|
34
32
|
let t2;
|
|
35
33
|
if ($[6] !== children) {
|
|
36
34
|
t2 = React.Children.map(children, _temp);
|
|
@@ -38,43 +36,45 @@ const ButtonGroup = /*#__PURE__*/ React.forwardRef(function ButtonGroup(t0, forw
|
|
|
38
36
|
$[7] = t2;
|
|
39
37
|
} else t2 = $[7];
|
|
40
38
|
const buttons = t2;
|
|
39
|
+
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
41
40
|
const t3 = role !== "toolbar";
|
|
42
41
|
let t4;
|
|
43
|
-
if ($[8] !== t3) {
|
|
42
|
+
if ($[8] !== buttonRef || $[9] !== t3) {
|
|
44
43
|
t4 = {
|
|
45
44
|
containerRef: buttonRef,
|
|
46
45
|
disabled: t3,
|
|
47
46
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
48
47
|
focusOutBehavior: "wrap"
|
|
49
48
|
};
|
|
50
|
-
$[8] =
|
|
51
|
-
$[9] =
|
|
52
|
-
|
|
49
|
+
$[8] = buttonRef;
|
|
50
|
+
$[9] = t3;
|
|
51
|
+
$[10] = t4;
|
|
52
|
+
} else t4 = $[10];
|
|
53
53
|
useFocusZone(t4);
|
|
54
54
|
let t5;
|
|
55
|
-
if ($[
|
|
55
|
+
if ($[11] !== className) {
|
|
56
56
|
t5 = clsx(className, ButtonGroup_module_css_default.ButtonGroup);
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t5 = $[
|
|
57
|
+
$[11] = className;
|
|
58
|
+
$[12] = t5;
|
|
59
|
+
} else t5 = $[12];
|
|
60
60
|
let t6;
|
|
61
|
-
if ($[
|
|
61
|
+
if ($[13] !== BaseComponent || $[14] !== buttonRef || $[15] !== buttons || $[16] !== rest || $[17] !== role || $[18] !== t5) {
|
|
62
62
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
63
|
-
ref:
|
|
63
|
+
ref: buttonRef,
|
|
64
64
|
className: t5,
|
|
65
65
|
role,
|
|
66
66
|
...rest,
|
|
67
67
|
"data-component": "ButtonGroup",
|
|
68
68
|
children: buttons
|
|
69
69
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
} else t6 = $[
|
|
70
|
+
$[13] = BaseComponent;
|
|
71
|
+
$[14] = buttonRef;
|
|
72
|
+
$[15] = buttons;
|
|
73
|
+
$[16] = rest;
|
|
74
|
+
$[17] = role;
|
|
75
|
+
$[18] = t5;
|
|
76
|
+
$[19] = t6;
|
|
77
|
+
} else t6 = $[19];
|
|
78
78
|
return t6;
|
|
79
79
|
});
|
|
80
80
|
ButtonGroup.displayName = "ButtonGroup";
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
3
3
|
import shared_module_css_default from "./shared.module.css.js";
|
|
4
4
|
import { CheckboxGroupContext } from "../CheckboxGroup/CheckboxGroupContext.js";
|
|
5
5
|
import Checkbox_module_css_default from "./Checkbox.module.css.js";
|
|
6
6
|
import { clsx } from "clsx";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import React, { useContext, useEffect
|
|
8
|
+
import React, { useContext, useEffect } from "react";
|
|
9
9
|
//#region src/Checkbox/Checkbox.tsx
|
|
10
10
|
/**
|
|
11
11
|
* An accessible, native checkbox component
|
|
12
12
|
*/
|
|
13
13
|
const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ["data-component"]: dataComponent, ...rest }, ref) => {
|
|
14
|
-
const checkboxRef =
|
|
15
|
-
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
14
|
+
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
16
15
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
17
16
|
const handleOnChange = (e) => {
|
|
18
17
|
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
@@ -25,7 +24,7 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
25
24
|
const inputProps = {
|
|
26
25
|
type: "checkbox",
|
|
27
26
|
disabled,
|
|
28
|
-
ref:
|
|
27
|
+
ref: checkboxRef,
|
|
29
28
|
checked: indeterminate ? false : checked,
|
|
30
29
|
defaultChecked,
|
|
31
30
|
required,
|
|
@@ -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 };
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
3
|
import { useOnEscapePress } from "../hooks/useOnEscapePress.js";
|
|
3
4
|
import { useResizeObserver } from "../hooks/useResizeObserver.js";
|
|
4
5
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
@@ -243,8 +244,7 @@ const Footer = /*#__PURE__*/ React.forwardRef(function Footer({ className, ...re
|
|
|
243
244
|
Footer.displayName = "Dialog.Footer";
|
|
244
245
|
const Buttons = ({ buttons }) => {
|
|
245
246
|
var _buttons$find;
|
|
246
|
-
const autoFocusRef =
|
|
247
|
-
const mergedRef = useMergedRefs(autoFocusRef, (_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
247
|
+
const autoFocusRef = useProvidedRefOrCreate((_buttons$find = buttons.find((button) => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
|
|
248
248
|
let autoFocusCount = 0;
|
|
249
249
|
const [hasRendered, setHasRendered] = useState(0);
|
|
250
250
|
useEffect(() => {
|
|
@@ -259,7 +259,7 @@ const Buttons = ({ buttons }) => {
|
|
|
259
259
|
"data-component": "Dialog.FooterButton",
|
|
260
260
|
...buttonProps,
|
|
261
261
|
variant: buttonType === "normal" ? "default" : buttonType,
|
|
262
|
-
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++,
|
|
262
|
+
ref: autoFocus && autoFocusCount === 0 ? (autoFocusCount++, autoFocusRef) : null,
|
|
263
263
|
children: content
|
|
264
264
|
}, index);
|
|
265
265
|
}) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
1
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
2
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
3
|
import { useProvidedStateOrCreate } from "../hooks/useProvidedStateOrCreate.js";
|
|
4
4
|
import { useId as useId$1 } from "../hooks/useId.js";
|
|
5
5
|
import { useFocusZone } from "../hooks/useFocusZone.js";
|
|
@@ -35,10 +35,8 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
35
35
|
}, [onFilterChange, setInternalFilterValue]);
|
|
36
36
|
const inputAndListContainerRef = useRef(null);
|
|
37
37
|
const listRef = useRef(null);
|
|
38
|
-
const scrollContainerRef =
|
|
39
|
-
const
|
|
40
|
-
const inputRef = useRef(null);
|
|
41
|
-
const combinedInputRef = useMergedRefs(inputRef, providedInputRef);
|
|
38
|
+
const scrollContainerRef = useProvidedRefOrCreate(providedScrollContainerRef);
|
|
39
|
+
const inputRef = useProvidedRefOrCreate(providedInputRef);
|
|
42
40
|
const usingRovingTabindex = _PrivateFocusManagement === "roving-tabindex";
|
|
43
41
|
const [listContainerElement, setListContainerElement] = useState(null);
|
|
44
42
|
const activeDescendantRef = useRef();
|
|
@@ -293,7 +291,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
293
291
|
"data-component": "FilteredActionList",
|
|
294
292
|
children: [
|
|
295
293
|
/*#__PURE__*/ jsx(FilteredActionListInput, {
|
|
296
|
-
inputRef
|
|
294
|
+
inputRef,
|
|
297
295
|
value: filterValue,
|
|
298
296
|
onInputChange,
|
|
299
297
|
onInputKeyPress,
|
|
@@ -327,7 +325,7 @@ function FilteredActionList({ loading = false, placeholderText, filterValue: ext
|
|
|
327
325
|
})]
|
|
328
326
|
}),
|
|
329
327
|
/*#__PURE__*/ jsx("div", {
|
|
330
|
-
ref:
|
|
328
|
+
ref: scrollContainerRef,
|
|
331
329
|
className: FilteredActionList_module_css_default.Container,
|
|
332
330
|
children: getBodyContent()
|
|
333
331
|
})
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
|
|
4
4
|
//#region src/FilteredActionList/FilteredActionListInput.d.ts
|
|
5
5
|
interface FilteredActionListInputProps extends Partial<Omit<TextInputProps, 'onChange' | 'onKeyDown'>> {
|
|
6
|
-
inputRef: React.
|
|
6
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
7
7
|
onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
onInputKeyPress?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
9
9
|
onInputKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
2
2
|
import { warning } from "../utils/warning.js";
|
|
3
3
|
import { isResponsiveValue } from "../hooks/useResponsiveValue.js";
|
|
4
4
|
import { isSlot } from "../utils/is-slot.js";
|
|
@@ -10,7 +10,7 @@ import PageHeader_module_css_default from "./PageHeader.module.css.js";
|
|
|
10
10
|
import { c } from "react-compiler-runtime";
|
|
11
11
|
import { clsx } from "clsx";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import React, { useEffect
|
|
13
|
+
import React, { useEffect } from "react";
|
|
14
14
|
import { ArrowLeftIcon } from "@primer/octicons-react";
|
|
15
15
|
//#region src/PageHeader/PageHeader.tsx
|
|
16
16
|
const hiddenOnRegularAndWide = {
|
|
@@ -24,15 +24,14 @@ const hiddenOnNarrow = {
|
|
|
24
24
|
wide: false
|
|
25
25
|
};
|
|
26
26
|
const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
27
|
-
const $ = c(
|
|
27
|
+
const $ = c(14);
|
|
28
28
|
const { children, className, as: t1, "aria-label": ariaLabel, role, hasBorder } = t0;
|
|
29
29
|
const BaseComponent = t1 === void 0 ? "div" : t1;
|
|
30
|
-
const rootRef =
|
|
31
|
-
const mergedRef = useMergedRefs(rootRef, forwardedRef);
|
|
30
|
+
const rootRef = useProvidedRefOrCreate(forwardedRef);
|
|
32
31
|
const isInteractive = _temp;
|
|
33
32
|
let t2;
|
|
34
33
|
let t3;
|
|
35
|
-
if ($[0] !== children) {
|
|
34
|
+
if ($[0] !== children || $[1] !== rootRef) {
|
|
36
35
|
t2 = function validateInteractiveElementsInTitle() {
|
|
37
36
|
let hasContextArea = false;
|
|
38
37
|
let hasLeadingAction = false;
|
|
@@ -47,24 +46,25 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
47
46
|
};
|
|
48
47
|
t3 = [children, rootRef];
|
|
49
48
|
$[0] = children;
|
|
50
|
-
$[1] =
|
|
51
|
-
$[2] =
|
|
49
|
+
$[1] = rootRef;
|
|
50
|
+
$[2] = t2;
|
|
51
|
+
$[3] = t3;
|
|
52
52
|
} else {
|
|
53
|
-
t2 = $[
|
|
54
|
-
t3 = $[
|
|
53
|
+
t2 = $[2];
|
|
54
|
+
t3 = $[3];
|
|
55
55
|
}
|
|
56
56
|
useEffect(t2, t3);
|
|
57
57
|
let t4;
|
|
58
|
-
if ($[
|
|
58
|
+
if ($[4] !== className) {
|
|
59
59
|
t4 = clsx(PageHeader_module_css_default.PageHeader, className);
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
} else t4 = $[
|
|
60
|
+
$[4] = className;
|
|
61
|
+
$[5] = t4;
|
|
62
|
+
} else t4 = $[5];
|
|
63
63
|
const t5 = hasBorder ? "true" : void 0;
|
|
64
64
|
let t6;
|
|
65
|
-
if ($[
|
|
65
|
+
if ($[6] !== BaseComponent || $[7] !== ariaLabel || $[8] !== children || $[9] !== role || $[10] !== rootRef || $[11] !== t4 || $[12] !== t5) {
|
|
66
66
|
t6 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
67
|
-
ref:
|
|
67
|
+
ref: rootRef,
|
|
68
68
|
className: t4,
|
|
69
69
|
"data-component": "PageHeader",
|
|
70
70
|
"data-has-border": t5,
|
|
@@ -72,15 +72,15 @@ const Root = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
72
72
|
role,
|
|
73
73
|
children
|
|
74
74
|
});
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[8] = mergedRef;
|
|
75
|
+
$[6] = BaseComponent;
|
|
76
|
+
$[7] = ariaLabel;
|
|
77
|
+
$[8] = children;
|
|
79
78
|
$[9] = role;
|
|
80
|
-
$[10] =
|
|
81
|
-
$[11] =
|
|
82
|
-
$[12] =
|
|
83
|
-
|
|
79
|
+
$[10] = rootRef;
|
|
80
|
+
$[11] = t4;
|
|
81
|
+
$[12] = t5;
|
|
82
|
+
$[13] = t6;
|
|
83
|
+
} else t6 = $[13];
|
|
84
84
|
return t6;
|
|
85
85
|
});
|
|
86
86
|
const ContextArea = (t0) => {
|
|
@@ -262,6 +262,7 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
262
262
|
const { children, className, hidden: t1, variant: t2 } = t0;
|
|
263
263
|
const hidden = t1 === void 0 ? false : t1;
|
|
264
264
|
const variant = t2 === void 0 ? "medium" : t2;
|
|
265
|
+
const titleAreaRef = useProvidedRefOrCreate(forwardedRef);
|
|
265
266
|
let t3;
|
|
266
267
|
if ($[0] !== className) {
|
|
267
268
|
t3 = clsx(PageHeader_module_css_default.TitleArea, className);
|
|
@@ -281,20 +282,20 @@ const TitleArea = /*#__PURE__*/ React.forwardRef((t0, forwardedRef) => {
|
|
|
281
282
|
$[5] = t5;
|
|
282
283
|
} else t5 = $[5];
|
|
283
284
|
let t6;
|
|
284
|
-
if ($[6] !== children || $[7] !==
|
|
285
|
+
if ($[6] !== children || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== titleAreaRef) {
|
|
285
286
|
t6 = /*#__PURE__*/ jsx("div", {
|
|
286
287
|
className: t3,
|
|
287
|
-
ref:
|
|
288
|
+
ref: titleAreaRef,
|
|
288
289
|
"data-component": "TitleArea",
|
|
289
290
|
...t4,
|
|
290
291
|
...t5,
|
|
291
292
|
children
|
|
292
293
|
});
|
|
293
294
|
$[6] = children;
|
|
294
|
-
$[7] =
|
|
295
|
-
$[8] =
|
|
296
|
-
$[9] =
|
|
297
|
-
$[10] =
|
|
295
|
+
$[7] = t3;
|
|
296
|
+
$[8] = t4;
|
|
297
|
+
$[9] = t5;
|
|
298
|
+
$[10] = titleAreaRef;
|
|
298
299
|
$[11] = t6;
|
|
299
300
|
} else t6 = $[11];
|
|
300
301
|
return t6;
|