@primer/react 0.0.0-20260218210324 → 0.0.0-20260218211332
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 +4 -22
- 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.js +37 -98
- 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/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +62 -72
- package/dist/Button/Button.js +11 -34
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +14 -9
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/PageLayout/PageLayout-06f4c069.css +2 -0
- package/dist/PageLayout/PageLayout-06f4c069.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +71 -2
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +498 -44
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +16 -4
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +123 -109
- 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/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +317 -82
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -4
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +3 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +85 -94
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/styles.d.ts +16 -0
- package/dist/UnderlineNav/styles.d.ts.map +1 -0
- package/dist/UnderlineNav/styles.js +19 -0
- 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.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/internal/components/UnderlineTabbedInterface-20c3ba3d.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +48 -41
- 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/dist/utils/environment.js +9 -0
- package/generated/components.json +200 -2
- package/package.json +2 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +0 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
- package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-e56ca858.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-e56ca858.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-135d7279.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-135d7279.css.map +0 -1
|
@@ -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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,EAAqB,KAAK,WAAW,EAAC,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../src/Banner/Banner.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,EAAqB,KAAK,WAAW,EAAC,MAAM,WAAW,CAAA;AAI9D,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAElF,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,SAAS,CAAC,GAAG;IACpE;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE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';
|
|
6
6
|
import { ButtonComponent } from '../Button/Button.js';
|
|
7
7
|
import { useMergedRefs } from '../internal/hooks/useMergedRefs.js';
|
|
8
|
-
import { useId } from '../hooks/useId.js';
|
|
9
8
|
import classes from './Banner.module.css.js';
|
|
10
|
-
import {
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
10
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
12
11
|
|
|
13
|
-
const BannerContext = /*#__PURE__*/React.createContext(undefined);
|
|
14
12
|
const iconForVariant = {
|
|
15
13
|
critical: /*#__PURE__*/jsx(StopIcon, {}),
|
|
16
14
|
info: /*#__PURE__*/jsx(InfoIcon, {}),
|
|
@@ -18,6 +16,13 @@ const iconForVariant = {
|
|
|
18
16
|
upsell: /*#__PURE__*/jsx(InfoIcon, {}),
|
|
19
17
|
warning: /*#__PURE__*/jsx(AlertIcon, {})
|
|
20
18
|
};
|
|
19
|
+
const labels = {
|
|
20
|
+
critical: 'Critical',
|
|
21
|
+
info: 'Information',
|
|
22
|
+
success: 'Success',
|
|
23
|
+
upsell: 'Recommendation',
|
|
24
|
+
warning: 'Warning'
|
|
25
|
+
};
|
|
21
26
|
const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
22
27
|
'aria-label': label,
|
|
23
28
|
'aria-labelledby': labelledBy,
|
|
@@ -41,7 +46,6 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
41
46
|
const bannerRef = React.useRef(null);
|
|
42
47
|
const ref = useMergedRefs(forwardRef, bannerRef);
|
|
43
48
|
const supportsCustomIcon = variant === 'info' || variant === 'upsell';
|
|
44
|
-
const titleId = useId();
|
|
45
49
|
const visual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : icon;
|
|
46
50
|
if (process.env.NODE_ENV !== "production") {
|
|
47
51
|
// This hook is called consistently depending on the environment
|
|
@@ -62,59 +66,52 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
62
66
|
}
|
|
63
67
|
}, [title]);
|
|
64
68
|
}
|
|
65
|
-
return /*#__PURE__*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
88
|
-
className: classes.BannerContent,
|
|
89
|
-
children: [title ? hideTitle ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
90
|
-
children: /*#__PURE__*/jsx(BannerTitle, {
|
|
91
|
-
children: title
|
|
92
|
-
})
|
|
93
|
-
}) : /*#__PURE__*/jsx(BannerTitle, {
|
|
69
|
+
return /*#__PURE__*/jsxs("section", {
|
|
70
|
+
...rest,
|
|
71
|
+
"aria-labelledby": labelledBy,
|
|
72
|
+
"aria-label": labelledBy ? undefined : label !== null && label !== void 0 ? label : labels[variant],
|
|
73
|
+
className: clsx(className, classes.Banner),
|
|
74
|
+
"data-dismissible": onDismiss ? '' : undefined,
|
|
75
|
+
"data-title-hidden": hideTitle ? '' : undefined,
|
|
76
|
+
"data-variant": variant,
|
|
77
|
+
"data-actions-layout": actionsLayout,
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
ref: ref,
|
|
80
|
+
"data-layout": rest.layout || 'default',
|
|
81
|
+
"data-flush": flush ? '' : undefined,
|
|
82
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
83
|
+
className: classes.BannerIcon,
|
|
84
|
+
children: visual && supportsCustomIcon ? visual : iconForVariant[variant]
|
|
85
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
86
|
+
className: classes.BannerContainer,
|
|
87
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
88
|
+
className: classes.BannerContent,
|
|
89
|
+
children: [title ? hideTitle ? /*#__PURE__*/jsx(VisuallyHidden, {
|
|
90
|
+
children: /*#__PURE__*/jsx(BannerTitle, {
|
|
94
91
|
children: title
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
onClick: onDismiss,
|
|
105
|
-
className: classes.BannerDismiss,
|
|
106
|
-
icon: XIcon,
|
|
107
|
-
variant: "invisible"
|
|
92
|
+
})
|
|
93
|
+
}) : /*#__PURE__*/jsx(BannerTitle, {
|
|
94
|
+
children: title
|
|
95
|
+
}) : null, description ? /*#__PURE__*/jsx(BannerDescription, {
|
|
96
|
+
children: description
|
|
97
|
+
}) : null, children]
|
|
98
|
+
}), hasActions ? /*#__PURE__*/jsx(BannerActions, {
|
|
99
|
+
primaryAction: primaryAction,
|
|
100
|
+
secondaryAction: secondaryAction
|
|
108
101
|
}) : null]
|
|
109
|
-
})
|
|
102
|
+
}), dismissible ? /*#__PURE__*/jsx(IconButton, {
|
|
103
|
+
"aria-label": "Dismiss banner",
|
|
104
|
+
onClick: onDismiss,
|
|
105
|
+
className: classes.BannerDismiss,
|
|
106
|
+
icon: XIcon,
|
|
107
|
+
variant: "invisible"
|
|
108
|
+
}) : null]
|
|
110
109
|
});
|
|
111
110
|
});
|
|
112
111
|
function BannerTitle(props) {
|
|
113
|
-
|
|
114
|
-
const $ = c(14);
|
|
112
|
+
const $ = c(12);
|
|
115
113
|
let children;
|
|
116
114
|
let className;
|
|
117
|
-
let id;
|
|
118
115
|
let rest;
|
|
119
116
|
let t0;
|
|
120
117
|
if ($[0] !== props) {
|
|
@@ -122,50 +119,43 @@ function BannerTitle(props) {
|
|
|
122
119
|
as: t0,
|
|
123
120
|
className,
|
|
124
121
|
children,
|
|
125
|
-
id,
|
|
126
122
|
...rest
|
|
127
123
|
} = props);
|
|
128
124
|
$[0] = props;
|
|
129
125
|
$[1] = children;
|
|
130
126
|
$[2] = className;
|
|
131
|
-
$[3] =
|
|
132
|
-
$[4] =
|
|
133
|
-
$[5] = t0;
|
|
127
|
+
$[3] = rest;
|
|
128
|
+
$[4] = t0;
|
|
134
129
|
} else {
|
|
135
130
|
children = $[1];
|
|
136
131
|
className = $[2];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
t0 = $[5];
|
|
132
|
+
rest = $[3];
|
|
133
|
+
t0 = $[4];
|
|
140
134
|
}
|
|
141
135
|
const Heading = t0 === undefined ? "h2" : t0;
|
|
142
|
-
const context = React.useContext(BannerContext);
|
|
143
|
-
const titleId = (_id = id) !== null && _id !== void 0 ? _id : context === null || context === void 0 ? void 0 : context.titleId;
|
|
144
136
|
let t1;
|
|
145
|
-
if ($[
|
|
137
|
+
if ($[5] !== className) {
|
|
146
138
|
t1 = clsx(className, classes.BannerTitle);
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
139
|
+
$[5] = className;
|
|
140
|
+
$[6] = t1;
|
|
149
141
|
} else {
|
|
150
|
-
t1 = $[
|
|
142
|
+
t1 = $[6];
|
|
151
143
|
}
|
|
152
144
|
let t2;
|
|
153
|
-
if ($[
|
|
145
|
+
if ($[7] !== Heading || $[8] !== children || $[9] !== rest || $[10] !== t1) {
|
|
154
146
|
t2 = /*#__PURE__*/jsx(Heading, {
|
|
155
147
|
...rest,
|
|
156
|
-
id: titleId,
|
|
157
148
|
className: t1,
|
|
158
149
|
"data-banner-title": "",
|
|
159
150
|
children: children
|
|
160
151
|
});
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[13] = t2;
|
|
152
|
+
$[7] = Heading;
|
|
153
|
+
$[8] = children;
|
|
154
|
+
$[9] = rest;
|
|
155
|
+
$[10] = t1;
|
|
156
|
+
$[11] = t2;
|
|
167
157
|
} else {
|
|
168
|
-
t2 = $[
|
|
158
|
+
t2 = $[11];
|
|
169
159
|
}
|
|
170
160
|
return t2;
|
|
171
161
|
}
|
package/dist/Button/Button.js
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { forwardRef } from 'react';
|
|
3
2
|
import { ButtonBase } from './ButtonBase.js';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
|
-
const ButtonComponent = /*#__PURE__*/forwardRef((
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$[2] = props;
|
|
18
|
-
} else {
|
|
19
|
-
children = $[1];
|
|
20
|
-
props = $[2];
|
|
21
|
-
}
|
|
22
|
-
let t1;
|
|
23
|
-
if ($[3] !== children || $[4] !== forwardedRef || $[5] !== props) {
|
|
24
|
-
t1 = /*#__PURE__*/jsx(ButtonBase, {
|
|
25
|
-
ref: forwardedRef,
|
|
26
|
-
as: "button",
|
|
27
|
-
type: "button",
|
|
28
|
-
...props,
|
|
29
|
-
children: children
|
|
30
|
-
});
|
|
31
|
-
$[3] = children;
|
|
32
|
-
$[4] = forwardedRef;
|
|
33
|
-
$[5] = props;
|
|
34
|
-
$[6] = t1;
|
|
35
|
-
} else {
|
|
36
|
-
t1 = $[6];
|
|
37
|
-
}
|
|
38
|
-
return t1;
|
|
5
|
+
const ButtonComponent = /*#__PURE__*/forwardRef(({
|
|
6
|
+
children,
|
|
7
|
+
...props
|
|
8
|
+
}, forwardedRef) => {
|
|
9
|
+
return /*#__PURE__*/jsx(ButtonBase, {
|
|
10
|
+
ref: forwardedRef,
|
|
11
|
+
as: "button",
|
|
12
|
+
type: "button",
|
|
13
|
+
...props,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
39
16
|
});
|
|
40
17
|
ButtonComponent.displayName = 'Button';
|
|
41
18
|
ButtonComponent.__SLOT__ = Symbol('Button');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../src/Button/ButtonBase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAC/F,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAA;AA2BxC,QAAA,MAAM,UAAU,EAkKV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|