@primer/react 0.0.0-20260218205658 → 0.0.0-20260218210324
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 +22 -4
- package/dist/ActionList/Description.js +113 -35
- package/dist/ActionList/Divider.js +30 -11
- package/dist/ActionList/Group.js +294 -117
- package/dist/ActionList/Heading.js +77 -22
- package/dist/ActionList/Item.js +98 -37
- package/dist/ActionList/LinkItem.js +80 -24
- package/dist/ActionList/List.js +143 -33
- package/dist/ActionList/Selection.js +78 -30
- package/dist/ActionList/TrailingAction.js +83 -23
- package/dist/ActionList/Visuals.js +162 -64
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +72 -62
- package/dist/Button/Button.js +34 -11
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +9 -14
- package/dist/Button/IconButton.js +140 -51
- package/dist/Button/LinkButton.js +39 -11
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/PageLayout/PageLayout-cb491b47.css +2 -0
- package/dist/PageLayout/PageLayout-cb491b47.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +2 -71
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +44 -498
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +4 -16
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +109 -123
- 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/UnderlineNav/UnderlineNav-e56ca858.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-e56ca858.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +82 -317
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +4 -11
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +2 -3
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +94 -85
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-1f8c23b5.css.map → SelectPanel-f0c4b9ca.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useIsMacOS.d.ts +15 -3
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +24 -26
- package/dist/internal/components/UnderlineTabbedInterface-135d7279.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-135d7279.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +0 -1
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +41 -48
- 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 +7 -4
- package/generated/components.json +2 -200
- package/package.json +2 -2
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +0 -1
- package/dist/PageLayout/PageLayout-06f4c069.css +0 -2
- package/dist/PageLayout/PageLayout-06f4c069.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +0 -1
- package/dist/UnderlineNav/styles.d.ts +0 -16
- package/dist/UnderlineNav/styles.d.ts.map +0 -1
- package/dist/UnderlineNav/styles.js +0 -19
- package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +0 -1
- package/dist/utils/environment.js +0 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
3
|
import { IconButton } from '../Button/IconButton.js';
|
|
3
4
|
import { ButtonComponent } from '../Button/Button.js';
|
|
@@ -5,20 +6,59 @@ import { clsx } from 'clsx';
|
|
|
5
6
|
import classes from './ActionList.module.css.js';
|
|
6
7
|
import { jsx } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
|
-
const TrailingAction = /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
const TrailingAction = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
10
|
+
const $ = c(23);
|
|
11
|
+
let className;
|
|
12
|
+
let icon;
|
|
13
|
+
let label;
|
|
14
|
+
let loading;
|
|
15
|
+
let props;
|
|
16
|
+
let style;
|
|
17
|
+
let t1;
|
|
18
|
+
let t2;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
({
|
|
21
|
+
as: t1,
|
|
22
|
+
icon,
|
|
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, {
|
|
22
62
|
as: as,
|
|
23
63
|
"aria-label": label,
|
|
24
64
|
icon: icon,
|
|
@@ -26,16 +66,11 @@ const TrailingAction = /*#__PURE__*/forwardRef(({
|
|
|
26
66
|
tooltipDirection: "w",
|
|
27
67
|
href: href,
|
|
28
68
|
loading: loading,
|
|
29
|
-
"data-loading": Boolean(loading)
|
|
30
|
-
// @ts-expect-error StyledButton wants both Anchor and Button refs
|
|
31
|
-
,
|
|
69
|
+
"data-loading": Boolean(loading),
|
|
32
70
|
ref: forwardedRef,
|
|
33
71
|
className: classes.TrailingActionButton,
|
|
34
72
|
...props
|
|
35
|
-
}) :
|
|
36
|
-
/*#__PURE__*/
|
|
37
|
-
// @ts-expect-error shhh
|
|
38
|
-
jsx(ButtonComponent, {
|
|
73
|
+
}) : /*#__PURE__*/jsx(ButtonComponent, {
|
|
39
74
|
variant: "invisible",
|
|
40
75
|
as: as,
|
|
41
76
|
href: href,
|
|
@@ -45,8 +80,33 @@ const TrailingAction = /*#__PURE__*/forwardRef(({
|
|
|
45
80
|
className: classes.TrailingActionButton,
|
|
46
81
|
...props,
|
|
47
82
|
children: label
|
|
48
|
-
})
|
|
49
|
-
|
|
83
|
+
});
|
|
84
|
+
$[11] = as;
|
|
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;
|
|
50
110
|
});
|
|
51
111
|
TrailingAction.__SLOT__ = Symbol('ActionList.TrailingAction');
|
|
52
112
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { AlertIcon } from '@primer/octicons-react';
|
|
3
4
|
import { ItemContext } from './shared.js';
|
|
@@ -7,86 +8,183 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
8
|
import { Tooltip } from '../TooltipV2/Tooltip.js';
|
|
8
9
|
import Spinner from '../Spinner/Spinner.js';
|
|
9
10
|
|
|
10
|
-
const VisualContainer =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const VisualContainer = t0 => {
|
|
12
|
+
const $ = c(8);
|
|
13
|
+
let className;
|
|
14
|
+
let props;
|
|
15
|
+
if ($[0] !== t0) {
|
|
16
|
+
({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
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;
|
|
18
48
|
};
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
className
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
const LeadingVisual = t0 => {
|
|
50
|
+
const $ = c(8);
|
|
51
|
+
let className;
|
|
52
|
+
let props;
|
|
53
|
+
if ($[0] !== t0) {
|
|
54
|
+
({
|
|
55
|
+
className,
|
|
56
|
+
...props
|
|
57
|
+
} = t0);
|
|
58
|
+
$[0] = t0;
|
|
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;
|
|
29
87
|
};
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
className
|
|
33
|
-
|
|
34
|
-
|
|
88
|
+
const TrailingVisual = t0 => {
|
|
89
|
+
const $ = c(9);
|
|
90
|
+
let className;
|
|
91
|
+
let props;
|
|
92
|
+
if ($[0] !== t0) {
|
|
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
|
+
}
|
|
35
104
|
const {
|
|
36
105
|
trailingVisualId
|
|
37
106
|
} = React.useContext(ItemContext);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
107
|
+
let t1;
|
|
108
|
+
if ($[3] !== className) {
|
|
109
|
+
t1 = clsx(className, classes.TrailingVisual);
|
|
110
|
+
$[3] = className;
|
|
111
|
+
$[4] = t1;
|
|
112
|
+
} else {
|
|
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;
|
|
44
131
|
};
|
|
45
|
-
|
|
132
|
+
|
|
46
133
|
// VisualOrIndicator handles the positioning of indicators and determines whether to show a visual or an indicator.
|
|
47
134
|
//
|
|
48
135
|
// If we're showing an *inactive* or *loading* indicator and a leading visual has NOT been passed,
|
|
49
136
|
// replace the trailing visual with the inactive indicator.
|
|
50
137
|
//
|
|
51
138
|
// This preserves the left alignment of item text.
|
|
52
|
-
const VisualOrIndicator =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
139
|
+
const VisualOrIndicator = t0 => {
|
|
140
|
+
const $ = c(5);
|
|
141
|
+
const {
|
|
142
|
+
children,
|
|
143
|
+
labelId,
|
|
144
|
+
loading,
|
|
145
|
+
inactiveText,
|
|
146
|
+
itemHasLeadingVisual,
|
|
147
|
+
position,
|
|
148
|
+
className
|
|
149
|
+
} = t0;
|
|
150
|
+
const VisualComponent = position === "leading" ? LeadingVisual : TrailingVisual;
|
|
151
|
+
if (!loading && !inactiveText) {
|
|
68
152
|
return children;
|
|
69
153
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
154
|
+
if (itemHasLeadingVisual && position === "trailing" || !itemHasLeadingVisual && position === "leading") {
|
|
155
|
+
return children;
|
|
156
|
+
}
|
|
157
|
+
let t1;
|
|
158
|
+
if ($[0] !== VisualComponent || $[1] !== className || $[2] !== inactiveText || $[3] !== labelId) {
|
|
159
|
+
t1 = inactiveText ? /*#__PURE__*/jsx("span", {
|
|
160
|
+
className: classes.InactiveButtonWrap,
|
|
161
|
+
children: /*#__PURE__*/jsx(Tooltip, {
|
|
162
|
+
text: inactiveText,
|
|
163
|
+
type: "description",
|
|
164
|
+
children: /*#__PURE__*/jsx("button", {
|
|
165
|
+
type: "button",
|
|
166
|
+
className: classes.InactiveButtonReset,
|
|
167
|
+
"aria-labelledby": labelId,
|
|
168
|
+
children: /*#__PURE__*/jsx(VisualComponent, {
|
|
169
|
+
children: /*#__PURE__*/jsx(AlertIcon, {})
|
|
170
|
+
})
|
|
81
171
|
})
|
|
82
172
|
})
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})
|
|
89
|
-
|
|
173
|
+
}) : /*#__PURE__*/jsx(VisualComponent, {
|
|
174
|
+
className: className,
|
|
175
|
+
children: /*#__PURE__*/jsx(Spinner, {
|
|
176
|
+
size: "small"
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
$[0] = VisualComponent;
|
|
180
|
+
$[1] = className;
|
|
181
|
+
$[2] = inactiveText;
|
|
182
|
+
$[3] = labelId;
|
|
183
|
+
$[4] = t1;
|
|
184
|
+
} else {
|
|
185
|
+
t1 = $[4];
|
|
186
|
+
}
|
|
187
|
+
return t1;
|
|
90
188
|
};
|
|
91
189
|
LeadingVisual.displayName = 'ActionList.LeadingVisual';
|
|
92
190
|
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":"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"}
|
package/dist/Banner/Banner.js
CHANGED
|
@@ -5,10 +5,12 @@ import { XIcon, AlertIcon, InfoIcon, CheckCircleIcon, StopIcon } from '@primer/o
|
|
|
5
5
|
import { IconButton } from '../Button/IconButton.js';
|
|
6
6
|
import { ButtonComponent } from '../Button/Button.js';
|
|
7
7
|
import { useMergedRefs } from '../internal/hooks/useMergedRefs.js';
|
|
8
|
+
import { useId } from '../hooks/useId.js';
|
|
8
9
|
import classes from './Banner.module.css.js';
|
|
9
|
-
import {
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
11
12
|
|
|
13
|
+
const BannerContext = /*#__PURE__*/React.createContext(undefined);
|
|
12
14
|
const iconForVariant = {
|
|
13
15
|
critical: /*#__PURE__*/jsx(StopIcon, {}),
|
|
14
16
|
info: /*#__PURE__*/jsx(InfoIcon, {}),
|
|
@@ -16,13 +18,6 @@ const iconForVariant = {
|
|
|
16
18
|
upsell: /*#__PURE__*/jsx(InfoIcon, {}),
|
|
17
19
|
warning: /*#__PURE__*/jsx(AlertIcon, {})
|
|
18
20
|
};
|
|
19
|
-
const labels = {
|
|
20
|
-
critical: 'Critical',
|
|
21
|
-
info: 'Information',
|
|
22
|
-
success: 'Success',
|
|
23
|
-
upsell: 'Recommendation',
|
|
24
|
-
warning: 'Warning'
|
|
25
|
-
};
|
|
26
21
|
const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
27
22
|
'aria-label': label,
|
|
28
23
|
'aria-labelledby': labelledBy,
|
|
@@ -46,6 +41,7 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
46
41
|
const bannerRef = React.useRef(null);
|
|
47
42
|
const ref = useMergedRefs(forwardRef, bannerRef);
|
|
48
43
|
const supportsCustomIcon = variant === 'info' || variant === 'upsell';
|
|
44
|
+
const titleId = useId();
|
|
49
45
|
const visual = leadingVisual !== null && leadingVisual !== void 0 ? leadingVisual : icon;
|
|
50
46
|
if (process.env.NODE_ENV !== "production") {
|
|
51
47
|
// This hook is called consistently depending on the environment
|
|
@@ -66,52 +62,59 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner({
|
|
|
66
62
|
}
|
|
67
63
|
}, [title]);
|
|
68
64
|
}
|
|
69
|
-
return /*#__PURE__*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
65
|
+
return /*#__PURE__*/jsx(BannerContext.Provider, {
|
|
66
|
+
value: {
|
|
67
|
+
titleId
|
|
68
|
+
},
|
|
69
|
+
children: /*#__PURE__*/jsxs("section", {
|
|
70
|
+
...rest,
|
|
71
|
+
"aria-labelledby": labelledBy !== null && labelledBy !== void 0 ? labelledBy : label ? undefined : titleId,
|
|
72
|
+
"aria-label": labelledBy ? undefined : label,
|
|
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, {
|
|
91
|
+
children: title
|
|
92
|
+
})
|
|
93
|
+
}) : /*#__PURE__*/jsx(BannerTitle, {
|
|
91
94
|
children: title
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
}) : null, description ? /*#__PURE__*/jsx(BannerDescription, {
|
|
96
|
+
children: description
|
|
97
|
+
}) : null, children]
|
|
98
|
+
}), hasActions ? /*#__PURE__*/jsx(BannerActions, {
|
|
99
|
+
primaryAction: primaryAction,
|
|
100
|
+
secondaryAction: secondaryAction
|
|
101
|
+
}) : null]
|
|
102
|
+
}), dismissible ? /*#__PURE__*/jsx(IconButton, {
|
|
103
|
+
"aria-label": "Dismiss banner",
|
|
104
|
+
onClick: onDismiss,
|
|
105
|
+
className: classes.BannerDismiss,
|
|
106
|
+
icon: XIcon,
|
|
107
|
+
variant: "invisible"
|
|
101
108
|
}) : null]
|
|
102
|
-
})
|
|
103
|
-
"aria-label": "Dismiss banner",
|
|
104
|
-
onClick: onDismiss,
|
|
105
|
-
className: classes.BannerDismiss,
|
|
106
|
-
icon: XIcon,
|
|
107
|
-
variant: "invisible"
|
|
108
|
-
}) : null]
|
|
109
|
+
})
|
|
109
110
|
});
|
|
110
111
|
});
|
|
111
112
|
function BannerTitle(props) {
|
|
112
|
-
|
|
113
|
+
var _id;
|
|
114
|
+
const $ = c(14);
|
|
113
115
|
let children;
|
|
114
116
|
let className;
|
|
117
|
+
let id;
|
|
115
118
|
let rest;
|
|
116
119
|
let t0;
|
|
117
120
|
if ($[0] !== props) {
|
|
@@ -119,43 +122,50 @@ function BannerTitle(props) {
|
|
|
119
122
|
as: t0,
|
|
120
123
|
className,
|
|
121
124
|
children,
|
|
125
|
+
id,
|
|
122
126
|
...rest
|
|
123
127
|
} = props);
|
|
124
128
|
$[0] = props;
|
|
125
129
|
$[1] = children;
|
|
126
130
|
$[2] = className;
|
|
127
|
-
$[3] =
|
|
128
|
-
$[4] =
|
|
131
|
+
$[3] = id;
|
|
132
|
+
$[4] = rest;
|
|
133
|
+
$[5] = t0;
|
|
129
134
|
} else {
|
|
130
135
|
children = $[1];
|
|
131
136
|
className = $[2];
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
id = $[3];
|
|
138
|
+
rest = $[4];
|
|
139
|
+
t0 = $[5];
|
|
134
140
|
}
|
|
135
141
|
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;
|
|
136
144
|
let t1;
|
|
137
|
-
if ($[
|
|
145
|
+
if ($[6] !== className) {
|
|
138
146
|
t1 = clsx(className, classes.BannerTitle);
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
147
|
+
$[6] = className;
|
|
148
|
+
$[7] = t1;
|
|
141
149
|
} else {
|
|
142
|
-
t1 = $[
|
|
150
|
+
t1 = $[7];
|
|
143
151
|
}
|
|
144
152
|
let t2;
|
|
145
|
-
if ($[
|
|
153
|
+
if ($[8] !== Heading || $[9] !== children || $[10] !== rest || $[11] !== t1 || $[12] !== titleId) {
|
|
146
154
|
t2 = /*#__PURE__*/jsx(Heading, {
|
|
147
155
|
...rest,
|
|
156
|
+
id: titleId,
|
|
148
157
|
className: t1,
|
|
149
158
|
"data-banner-title": "",
|
|
150
159
|
children: children
|
|
151
160
|
});
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
161
|
+
$[8] = Heading;
|
|
162
|
+
$[9] = children;
|
|
163
|
+
$[10] = rest;
|
|
164
|
+
$[11] = t1;
|
|
165
|
+
$[12] = titleId;
|
|
166
|
+
$[13] = t2;
|
|
157
167
|
} else {
|
|
158
|
-
t2 = $[
|
|
168
|
+
t2 = $[13];
|
|
159
169
|
}
|
|
160
170
|
return t2;
|
|
161
171
|
}
|
package/dist/Button/Button.js
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
|
+
import { c } from 'react-compiler-runtime';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
3
|
import { ButtonBase } from './ButtonBase.js';
|
|
3
4
|
import { jsx } from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
|
-
const ButtonComponent = /*#__PURE__*/forwardRef(({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const ButtonComponent = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
7
|
+
const $ = c(7);
|
|
8
|
+
let children;
|
|
9
|
+
let props;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
} = t0);
|
|
15
|
+
$[0] = t0;
|
|
16
|
+
$[1] = children;
|
|
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;
|
|
16
39
|
});
|
|
17
40
|
ButtonComponent.displayName = 'Button';
|
|
18
41
|
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,EA2JV,8BAA8B,CAAC,QAAQ,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;AAEjE,OAAO,EAAC,UAAU,EAAC,CAAA"}
|