@primer/react 37.29.0-rc.af59a9de1 → 38.0.0-rc.195178541
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 +3 -15
- package/dist/browser.esm.js +2 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +3 -3
- package/dist/browser.umd.js.map +1 -1
- package/dist/components.css +72 -85
- package/generated/components.json +133 -133
- package/lib/ActionList/Description.d.ts.map +1 -1
- package/lib/ActionList/Description.js +2 -1
- package/lib/ActionList/Divider.d.ts.map +1 -1
- package/lib/ActionList/Divider.js +2 -1
- package/lib/ActionList/Group.d.ts.map +1 -1
- package/lib/ActionList/Group.js +6 -1
- package/lib/ActionList/Item.d.ts.map +1 -1
- package/lib/ActionList/Item.js +2 -1
- package/lib/ActionList/LinkItem.d.ts.map +1 -1
- package/lib/ActionList/LinkItem.js +2 -1
- package/lib/ActionList/List.d.ts.map +1 -1
- package/lib/ActionList/List.js +3 -0
- package/lib/ActionList/Visuals.d.ts.map +1 -1
- package/lib/ActionList/Visuals.js +7 -0
- package/lib/Avatar/Avatar.d.ts.map +1 -1
- package/lib/Avatar/Avatar.js +41 -39
- package/lib/AvatarPair/AvatarPair.js +1 -1
- package/lib/AvatarStack/AvatarStack.d.ts +1 -1
- package/lib/AvatarStack/AvatarStack.d.ts.map +1 -1
- package/lib/AvatarStack/AvatarStack.js +2 -1
- package/lib/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/lib/ButtonGroup/ButtonGroup.js +61 -24
- package/lib/CounterLabel/CounterLabel.d.ts.map +1 -1
- package/lib/CounterLabel/CounterLabel.js +87 -43
- package/lib/DataTable/Pagination.d.ts.map +1 -1
- package/lib/DataTable/Pagination.js +88 -81
- package/lib/DataTable/Table.d.ts +1 -1
- package/lib/DataTable/Table.d.ts.map +1 -1
- package/lib/DataTable/Table.js +26 -18
- package/lib/Details/Details.d.ts.map +1 -1
- package/lib/Details/Details.js +82 -35
- package/lib/FilteredActionList/FilteredActionListLoaders.js +1 -1
- package/lib/FormControl/FormControl.d.ts.map +1 -1
- package/lib/FormControl/FormControl.js +12 -3
- package/lib/Header/Header.d.ts.map +1 -1
- package/lib/Header/Header.js +170 -64
- package/lib/InlineMessage/InlineMessage.d.ts +1 -1
- package/lib/InlineMessage/InlineMessage.d.ts.map +1 -1
- package/lib/InlineMessage/InlineMessage.js +69 -31
- package/lib/PageLayout/PageLayout.d.ts.map +1 -1
- package/lib/PageLayout/PageLayout.js +473 -465
- package/lib/Pagehead/Pagehead.d.ts +1 -1
- package/lib/Pagehead/Pagehead.d.ts.map +1 -1
- package/lib/Pagehead/Pagehead.js +11 -2
- package/lib/Radio/Radio.d.ts.map +1 -1
- package/lib/Radio/Radio.js +91 -40
- package/lib/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/SegmentedControl/SegmentedControl.js +25 -23
- package/lib/SegmentedControl/SegmentedControlButton.d.ts.map +1 -1
- package/lib/SegmentedControl/SegmentedControlButton.js +72 -70
- package/lib/SegmentedControl/SegmentedControlIconButton.d.ts.map +1 -1
- package/lib/SegmentedControl/SegmentedControlIconButton.js +112 -110
- package/lib/SideNav.d.ts.map +1 -1
- package/lib/SideNav.js +2 -1
- package/lib/Skeleton/SkeletonBox.d.ts +2 -2
- package/lib/Skeleton/SkeletonBox.d.ts.map +1 -1
- package/lib/Skeleton/SkeletonBox.js +24 -25
- package/lib/Spinner/Spinner.d.ts +1 -1
- package/lib/Spinner/Spinner.d.ts.map +1 -1
- package/lib/Spinner/Spinner.js +51 -13
- package/lib/SubNav/SubNav.d.ts.map +1 -1
- package/lib/SubNav/SubNav.js +215 -77
- package/lib/Timeline/Timeline.d.ts +1 -1
- package/lib/Timeline/Timeline.d.ts.map +1 -1
- package/lib/Timeline/Timeline.js +264 -92
- package/lib/Token/Token.d.ts.map +1 -1
- package/lib/Token/Token.js +128 -120
- package/lib/TreeView/TreeView.js +2 -2
- package/lib/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/lib/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/lib/VisuallyHidden/VisuallyHidden.js +51 -19
- package/lib/_VisuallyHidden.d.ts +2 -3
- package/lib/_VisuallyHidden.d.ts.map +1 -1
- package/lib/_VisuallyHidden.js +26 -63
- package/lib/experimental/Skeleton/SkeletonAvatar-e00fff32.css +2 -0
- package/lib/experimental/Skeleton/SkeletonAvatar-e00fff32.css.map +1 -0
- package/lib/experimental/Skeleton/SkeletonAvatar.d.ts +8 -0
- package/lib/experimental/Skeleton/SkeletonAvatar.d.ts.map +1 -0
- package/lib/{SkeletonAvatar → experimental/Skeleton}/SkeletonAvatar.js +5 -5
- package/lib/{SkeletonAvatar → experimental/Skeleton}/SkeletonAvatar.module.css.js +1 -1
- package/lib/experimental/Skeleton/SkeletonText-5cf908c1.css +2 -0
- package/lib/experimental/Skeleton/SkeletonText-5cf908c1.css.map +1 -0
- package/lib/{SkeletonText → experimental/Skeleton}/SkeletonText.d.ts +4 -5
- package/lib/experimental/Skeleton/SkeletonText.d.ts.map +1 -0
- package/lib/experimental/Skeleton/SkeletonText.js +149 -0
- package/lib/experimental/Skeleton/SkeletonText.module.css.js +7 -0
- package/lib/experimental/Skeleton/index.d.ts +4 -0
- package/lib/experimental/Skeleton/index.d.ts.map +1 -0
- package/lib/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/lib/experimental/UnderlinePanels/UnderlinePanels.js +40 -30
- package/lib/experimental/index.d.ts +1 -6
- package/lib/experimental/index.d.ts.map +1 -1
- package/lib/experimental/index.js +2 -2
- package/lib/internal/components/ButtonReset.d.ts +2 -1
- package/lib/internal/components/ButtonReset.d.ts.map +1 -1
- package/lib/internal/components/ButtonReset.js +13 -49
- package/lib/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/lib/internal/components/UnderlineTabbedInterface.js +108 -60
- package/lib/internal/utils/toggleStyledComponent.d.ts +20 -0
- package/lib/internal/utils/toggleStyledComponent.d.ts.map +1 -0
- package/lib-esm/ActionList/Description.js +2 -1
- package/lib-esm/ActionList/Divider.js +2 -1
- package/lib-esm/ActionList/Group.js +6 -1
- package/lib-esm/ActionList/Item.js +2 -1
- package/lib-esm/ActionList/LinkItem.js +2 -1
- package/lib-esm/ActionList/List.js +3 -0
- package/lib-esm/ActionList/Visuals.js +7 -0
- package/lib-esm/Avatar/Avatar.js +41 -39
- package/lib-esm/AvatarPair/AvatarPair.js +1 -1
- package/lib-esm/AvatarStack/AvatarStack.d.ts +1 -1
- package/lib-esm/AvatarStack/AvatarStack.js +2 -1
- package/lib-esm/ButtonGroup/ButtonGroup.js +61 -24
- package/lib-esm/CounterLabel/CounterLabel.js +87 -43
- package/lib-esm/DataTable/Pagination.js +84 -81
- package/lib-esm/DataTable/Table.d.ts +1 -1
- package/lib-esm/DataTable/Table.js +26 -18
- package/lib-esm/Details/Details.js +82 -35
- package/lib-esm/FilteredActionList/FilteredActionListLoaders.js +1 -1
- package/lib-esm/FormControl/FormControl.js +12 -3
- package/lib-esm/Header/Header.js +170 -64
- package/lib-esm/InlineMessage/InlineMessage.d.ts +1 -1
- package/lib-esm/InlineMessage/InlineMessage.js +69 -31
- package/lib-esm/PageLayout/PageLayout.js +473 -465
- package/lib-esm/Pagehead/Pagehead.d.ts +1 -1
- package/lib-esm/Pagehead/Pagehead.js +11 -2
- package/lib-esm/Radio/Radio.js +91 -40
- package/lib-esm/SegmentedControl/SegmentedControl.js +25 -23
- package/lib-esm/SegmentedControl/SegmentedControlButton.js +72 -70
- package/lib-esm/SegmentedControl/SegmentedControlIconButton.js +112 -110
- package/lib-esm/SideNav.js +2 -1
- package/lib-esm/Skeleton/SkeletonBox.d.ts +2 -2
- package/lib-esm/Skeleton/SkeletonBox.js +24 -25
- package/lib-esm/Spinner/Spinner.d.ts +1 -1
- package/lib-esm/Spinner/Spinner.js +47 -13
- package/lib-esm/SubNav/SubNav.js +215 -77
- package/lib-esm/Timeline/Timeline.d.ts +1 -1
- package/lib-esm/Timeline/Timeline.js +264 -92
- package/lib-esm/Token/Token.js +128 -120
- package/lib-esm/TreeView/TreeView.js +2 -2
- package/lib-esm/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/lib-esm/VisuallyHidden/VisuallyHidden.js +51 -19
- package/lib-esm/_VisuallyHidden.d.ts +2 -3
- package/lib-esm/_VisuallyHidden.js +22 -63
- package/lib-esm/experimental/Skeleton/SkeletonAvatar-e00fff32.css +2 -0
- package/lib-esm/experimental/Skeleton/SkeletonAvatar-e00fff32.css.map +1 -0
- package/lib-esm/experimental/Skeleton/SkeletonAvatar.d.ts +8 -0
- package/lib-esm/{SkeletonAvatar → experimental/Skeleton}/SkeletonAvatar.js +5 -5
- package/lib-esm/experimental/Skeleton/SkeletonAvatar.module.css.js +5 -0
- package/lib-esm/experimental/Skeleton/SkeletonText-5cf908c1.css +2 -0
- package/lib-esm/experimental/Skeleton/SkeletonText-5cf908c1.css.map +1 -0
- package/lib-esm/{SkeletonText → experimental/Skeleton}/SkeletonText.d.ts +4 -5
- package/lib-esm/experimental/Skeleton/SkeletonText.js +143 -0
- package/lib-esm/experimental/Skeleton/SkeletonText.module.css.js +5 -0
- package/lib-esm/experimental/Skeleton/index.d.ts +4 -0
- package/lib-esm/experimental/UnderlinePanels/UnderlinePanels.js +40 -30
- package/lib-esm/experimental/index.d.ts +1 -6
- package/lib-esm/experimental/index.js +2 -2
- package/lib-esm/internal/components/ButtonReset.d.ts +2 -1
- package/lib-esm/internal/components/ButtonReset.js +9 -49
- package/lib-esm/internal/components/UnderlineTabbedInterface.js +108 -60
- package/lib-esm/internal/utils/toggleStyledComponent.d.ts +20 -0
- package/package.json +1 -1
- package/lib/DataTable/Pagination-b6f8418c.css +0 -2
- package/lib/DataTable/Pagination-b6f8418c.css.map +0 -1
- package/lib/DataTable/Pagination.module.css.js +0 -7
- package/lib/SkeletonAvatar/SkeletonAvatar-e00fff32.css +0 -2
- package/lib/SkeletonAvatar/SkeletonAvatar-e00fff32.css.map +0 -1
- package/lib/SkeletonAvatar/SkeletonAvatar.d.ts +0 -12
- package/lib/SkeletonAvatar/SkeletonAvatar.d.ts.map +0 -1
- package/lib/SkeletonAvatar/index.d.ts +0 -3
- package/lib/SkeletonAvatar/index.d.ts.map +0 -1
- package/lib/SkeletonText/SkeletonText-5cf908c1.css +0 -2
- package/lib/SkeletonText/SkeletonText-5cf908c1.css.map +0 -1
- package/lib/SkeletonText/SkeletonText.d.ts.map +0 -1
- package/lib/SkeletonText/SkeletonText.js +0 -142
- package/lib/SkeletonText/SkeletonText.module.css.js +0 -7
- package/lib/SkeletonText/index.d.ts +0 -3
- package/lib/SkeletonText/index.d.ts.map +0 -1
- package/lib/_VisuallyHidden-5c0a2499.css +0 -2
- package/lib/_VisuallyHidden-5c0a2499.css.map +0 -1
- package/lib/_VisuallyHidden.module.css.js +0 -7
- package/lib/internal/components/ButtonReset-904f2483.css +0 -2
- package/lib/internal/components/ButtonReset-904f2483.css.map +0 -1
- package/lib/internal/components/ButtonReset.module.css.js +0 -7
- package/lib-esm/DataTable/Pagination-b6f8418c.css +0 -2
- package/lib-esm/DataTable/Pagination-b6f8418c.css.map +0 -1
- package/lib-esm/DataTable/Pagination.module.css.js +0 -5
- package/lib-esm/SkeletonAvatar/SkeletonAvatar-e00fff32.css +0 -2
- package/lib-esm/SkeletonAvatar/SkeletonAvatar-e00fff32.css.map +0 -1
- package/lib-esm/SkeletonAvatar/SkeletonAvatar.d.ts +0 -12
- package/lib-esm/SkeletonAvatar/SkeletonAvatar.module.css.js +0 -5
- package/lib-esm/SkeletonAvatar/index.d.ts +0 -3
- package/lib-esm/SkeletonText/SkeletonText-5cf908c1.css +0 -2
- package/lib-esm/SkeletonText/SkeletonText-5cf908c1.css.map +0 -1
- package/lib-esm/SkeletonText/SkeletonText.js +0 -140
- package/lib-esm/SkeletonText/SkeletonText.module.css.js +0 -5
- package/lib-esm/SkeletonText/index.d.ts +0 -3
- package/lib-esm/_VisuallyHidden-5c0a2499.css +0 -2
- package/lib-esm/_VisuallyHidden-5c0a2499.css.map +0 -1
- package/lib-esm/_VisuallyHidden.module.css.js +0 -5
- package/lib-esm/internal/components/ButtonReset-904f2483.css +0 -2
- package/lib-esm/internal/components/ButtonReset-904f2483.css.map +0 -1
- package/lib-esm/internal/components/ButtonReset.module.css.js +0 -5
|
@@ -3,22 +3,25 @@ import React from 'react';
|
|
|
3
3
|
import classes from './ButtonGroup.module.css.js';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
6
|
-
import {
|
|
6
|
+
import { defaultSxProp } from '../utils/defaultSxProp.js';
|
|
7
7
|
import { jsx } from 'react/jsx-runtime';
|
|
8
8
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
9
|
+
import Box from '../Box/Box.js';
|
|
9
10
|
import { FocusKeys } from '@primer/behaviors';
|
|
10
11
|
|
|
11
12
|
const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwardRef) {
|
|
12
|
-
const $ = c(
|
|
13
|
+
const $ = c(28);
|
|
13
14
|
let children;
|
|
14
15
|
let className;
|
|
15
16
|
let rest;
|
|
16
17
|
let role;
|
|
18
|
+
let sx;
|
|
17
19
|
if ($[0] !== t0) {
|
|
18
20
|
({
|
|
19
21
|
children,
|
|
20
22
|
className,
|
|
21
23
|
role,
|
|
24
|
+
sx,
|
|
22
25
|
...rest
|
|
23
26
|
} = t0);
|
|
24
27
|
$[0] = t0;
|
|
@@ -26,63 +29,97 @@ const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(t0, forwa
|
|
|
26
29
|
$[2] = className;
|
|
27
30
|
$[3] = rest;
|
|
28
31
|
$[4] = role;
|
|
32
|
+
$[5] = sx;
|
|
29
33
|
} else {
|
|
30
34
|
children = $[1];
|
|
31
35
|
className = $[2];
|
|
32
36
|
rest = $[3];
|
|
33
37
|
role = $[4];
|
|
38
|
+
sx = $[5];
|
|
34
39
|
}
|
|
35
40
|
let t1;
|
|
36
|
-
if ($[
|
|
41
|
+
if ($[6] !== children) {
|
|
37
42
|
t1 = React.Children.map(children, _temp);
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
43
|
+
$[6] = children;
|
|
44
|
+
$[7] = t1;
|
|
40
45
|
} else {
|
|
41
|
-
t1 = $[
|
|
46
|
+
t1 = $[7];
|
|
42
47
|
}
|
|
43
48
|
const buttons = t1;
|
|
44
49
|
const buttonRef = useProvidedRefOrCreate(forwardRef);
|
|
45
50
|
const t2 = role !== "toolbar";
|
|
46
51
|
let t3;
|
|
47
|
-
if ($[
|
|
52
|
+
if ($[8] !== buttonRef || $[9] !== t2) {
|
|
48
53
|
t3 = {
|
|
49
54
|
containerRef: buttonRef,
|
|
50
55
|
disabled: t2,
|
|
51
56
|
bindKeys: FocusKeys.ArrowHorizontal,
|
|
52
57
|
focusOutBehavior: "wrap"
|
|
53
58
|
};
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
59
|
+
$[8] = buttonRef;
|
|
60
|
+
$[9] = t2;
|
|
61
|
+
$[10] = t3;
|
|
57
62
|
} else {
|
|
58
|
-
t3 = $[
|
|
63
|
+
t3 = $[10];
|
|
59
64
|
}
|
|
60
65
|
useFocusZone(t3);
|
|
66
|
+
if (sx !== defaultSxProp) {
|
|
67
|
+
let t4;
|
|
68
|
+
if ($[11] !== className) {
|
|
69
|
+
t4 = clsx(className, classes.ButtonGroup);
|
|
70
|
+
$[11] = className;
|
|
71
|
+
$[12] = t4;
|
|
72
|
+
} else {
|
|
73
|
+
t4 = $[12];
|
|
74
|
+
}
|
|
75
|
+
let t5;
|
|
76
|
+
if ($[13] !== buttonRef || $[14] !== buttons || $[15] !== rest || $[16] !== role || $[17] !== sx || $[18] !== t4) {
|
|
77
|
+
t5 = /*#__PURE__*/jsx(Box, {
|
|
78
|
+
as: "div",
|
|
79
|
+
className: t4,
|
|
80
|
+
role: role,
|
|
81
|
+
...rest,
|
|
82
|
+
sx: sx,
|
|
83
|
+
ref: buttonRef,
|
|
84
|
+
children: buttons
|
|
85
|
+
});
|
|
86
|
+
$[13] = buttonRef;
|
|
87
|
+
$[14] = buttons;
|
|
88
|
+
$[15] = rest;
|
|
89
|
+
$[16] = role;
|
|
90
|
+
$[17] = sx;
|
|
91
|
+
$[18] = t4;
|
|
92
|
+
$[19] = t5;
|
|
93
|
+
} else {
|
|
94
|
+
t5 = $[19];
|
|
95
|
+
}
|
|
96
|
+
return t5;
|
|
97
|
+
}
|
|
61
98
|
let t4;
|
|
62
|
-
if ($[
|
|
99
|
+
if ($[20] !== className) {
|
|
63
100
|
t4 = clsx(className, classes.ButtonGroup);
|
|
64
|
-
$[
|
|
65
|
-
$[
|
|
101
|
+
$[20] = className;
|
|
102
|
+
$[21] = t4;
|
|
66
103
|
} else {
|
|
67
|
-
t4 = $[
|
|
104
|
+
t4 = $[21];
|
|
68
105
|
}
|
|
69
106
|
let t5;
|
|
70
|
-
if ($[
|
|
71
|
-
t5 = /*#__PURE__*/jsx(
|
|
107
|
+
if ($[22] !== buttonRef || $[23] !== buttons || $[24] !== rest || $[25] !== role || $[26] !== t4) {
|
|
108
|
+
t5 = /*#__PURE__*/jsx("div", {
|
|
72
109
|
ref: buttonRef,
|
|
73
110
|
className: t4,
|
|
74
111
|
role: role,
|
|
75
112
|
...rest,
|
|
76
113
|
children: buttons
|
|
77
114
|
});
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
115
|
+
$[22] = buttonRef;
|
|
116
|
+
$[23] = buttons;
|
|
117
|
+
$[24] = rest;
|
|
118
|
+
$[25] = role;
|
|
119
|
+
$[26] = t4;
|
|
120
|
+
$[27] = t5;
|
|
84
121
|
} else {
|
|
85
|
-
t5 = $[
|
|
122
|
+
t5 = $[27];
|
|
86
123
|
}
|
|
87
124
|
return t5;
|
|
88
125
|
});
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
+
import { defaultSxProp } from '../utils/defaultSxProp.js';
|
|
4
5
|
import classes from './CounterLabel.module.css.js';
|
|
5
|
-
import { BoxWithFallback } from '../internal/components/BoxWithFallback.js';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import Box from '../Box/Box.js';
|
|
7
8
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
8
9
|
|
|
9
10
|
const CounterLabel = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
10
|
-
const $ = c(
|
|
11
|
+
const $ = c(31);
|
|
11
12
|
let children;
|
|
12
13
|
let className;
|
|
13
14
|
let rest;
|
|
14
15
|
let t1;
|
|
16
|
+
let t2;
|
|
15
17
|
if ($[0] !== t0) {
|
|
16
18
|
({
|
|
17
19
|
scheme: t1,
|
|
20
|
+
sx: t2,
|
|
18
21
|
className,
|
|
19
22
|
children,
|
|
20
23
|
...rest
|
|
@@ -24,75 +27,116 @@ const CounterLabel = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
24
27
|
$[2] = className;
|
|
25
28
|
$[3] = rest;
|
|
26
29
|
$[4] = t1;
|
|
30
|
+
$[5] = t2;
|
|
27
31
|
} else {
|
|
28
32
|
children = $[1];
|
|
29
33
|
className = $[2];
|
|
30
34
|
rest = $[3];
|
|
31
35
|
t1 = $[4];
|
|
36
|
+
t2 = $[5];
|
|
32
37
|
}
|
|
33
38
|
const scheme = t1 === undefined ? "secondary" : t1;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
const sx = t2 === undefined ? defaultSxProp : t2;
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[6] !== children) {
|
|
42
|
+
t3 = /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
37
43
|
children: ["\xA0(", children, ")"]
|
|
38
44
|
});
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
45
|
+
$[6] = children;
|
|
46
|
+
$[7] = t3;
|
|
41
47
|
} else {
|
|
42
|
-
|
|
48
|
+
t3 = $[7];
|
|
43
49
|
}
|
|
44
|
-
const label =
|
|
45
|
-
let
|
|
46
|
-
if ($[
|
|
47
|
-
|
|
50
|
+
const label = t3;
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[8] !== forwardedRef || $[9] !== rest || $[10] !== scheme) {
|
|
53
|
+
t4 = {
|
|
48
54
|
ref: forwardedRef,
|
|
49
55
|
"aria-hidden": "true",
|
|
50
56
|
"data-scheme": scheme,
|
|
51
57
|
...rest
|
|
52
58
|
};
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
59
|
+
$[8] = forwardedRef;
|
|
60
|
+
$[9] = rest;
|
|
61
|
+
$[10] = scheme;
|
|
62
|
+
$[11] = t4;
|
|
57
63
|
} else {
|
|
58
|
-
|
|
64
|
+
t4 = $[11];
|
|
59
65
|
}
|
|
60
|
-
const counterProps =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const counterProps = t4;
|
|
67
|
+
if (sx !== defaultSxProp) {
|
|
68
|
+
let t5;
|
|
69
|
+
if ($[12] !== className) {
|
|
70
|
+
t5 = clsx(className, classes.CounterLabel);
|
|
71
|
+
$[12] = className;
|
|
72
|
+
$[13] = t5;
|
|
73
|
+
} else {
|
|
74
|
+
t5 = $[13];
|
|
75
|
+
}
|
|
76
|
+
let t6;
|
|
77
|
+
if ($[14] !== children || $[15] !== counterProps || $[16] !== sx || $[17] !== t5) {
|
|
78
|
+
t6 = /*#__PURE__*/jsx(Box, {
|
|
79
|
+
as: "span",
|
|
80
|
+
...counterProps,
|
|
81
|
+
className: t5,
|
|
82
|
+
sx: sx,
|
|
83
|
+
children: children
|
|
84
|
+
});
|
|
85
|
+
$[14] = children;
|
|
86
|
+
$[15] = counterProps;
|
|
87
|
+
$[16] = sx;
|
|
88
|
+
$[17] = t5;
|
|
89
|
+
$[18] = t6;
|
|
90
|
+
} else {
|
|
91
|
+
t6 = $[18];
|
|
92
|
+
}
|
|
93
|
+
let t7;
|
|
94
|
+
if ($[19] !== label || $[20] !== t6) {
|
|
95
|
+
t7 = /*#__PURE__*/jsxs(Fragment, {
|
|
96
|
+
children: [t6, label]
|
|
97
|
+
});
|
|
98
|
+
$[19] = label;
|
|
99
|
+
$[20] = t6;
|
|
100
|
+
$[21] = t7;
|
|
101
|
+
} else {
|
|
102
|
+
t7 = $[21];
|
|
103
|
+
}
|
|
104
|
+
return t7;
|
|
68
105
|
}
|
|
69
106
|
let t5;
|
|
70
|
-
if ($[
|
|
71
|
-
t5 =
|
|
72
|
-
|
|
107
|
+
if ($[22] !== className) {
|
|
108
|
+
t5 = clsx(className, classes.CounterLabel);
|
|
109
|
+
$[22] = className;
|
|
110
|
+
$[23] = t5;
|
|
111
|
+
} else {
|
|
112
|
+
t5 = $[23];
|
|
113
|
+
}
|
|
114
|
+
let t6;
|
|
115
|
+
if ($[24] !== children || $[25] !== counterProps || $[26] !== t5) {
|
|
116
|
+
t6 = /*#__PURE__*/jsx("span", {
|
|
73
117
|
...counterProps,
|
|
74
|
-
className:
|
|
118
|
+
className: t5,
|
|
75
119
|
children: children
|
|
76
120
|
});
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
121
|
+
$[24] = children;
|
|
122
|
+
$[25] = counterProps;
|
|
123
|
+
$[26] = t5;
|
|
124
|
+
$[27] = t6;
|
|
81
125
|
} else {
|
|
82
|
-
|
|
126
|
+
t6 = $[27];
|
|
83
127
|
}
|
|
84
|
-
let
|
|
85
|
-
if ($[
|
|
86
|
-
|
|
87
|
-
children: [
|
|
128
|
+
let t7;
|
|
129
|
+
if ($[28] !== label || $[29] !== t6) {
|
|
130
|
+
t7 = /*#__PURE__*/jsxs(Fragment, {
|
|
131
|
+
children: [t6, label]
|
|
88
132
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
133
|
+
$[28] = label;
|
|
134
|
+
$[29] = t6;
|
|
135
|
+
$[30] = t7;
|
|
92
136
|
} else {
|
|
93
|
-
|
|
137
|
+
t7 = $[30];
|
|
94
138
|
}
|
|
95
|
-
return
|
|
139
|
+
return t7;
|
|
96
140
|
});
|
|
97
141
|
CounterLabel.displayName = 'CounterLabel';
|
|
98
142
|
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { ChevronLeftIcon, ChevronRightIcon } from '@primer/octicons-react';
|
|
3
3
|
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { get } from '../constants.js';
|
|
4
6
|
import { Button } from '../internal/components/ButtonReset.js';
|
|
5
7
|
import { LiveRegion, LiveRegionOutlet, Message } from '../internal/components/LiveRegion.js';
|
|
6
8
|
import { warning } from '../utils/warning.js';
|
|
7
9
|
import { viewportRanges } from '../hooks/useResponsiveValue.js';
|
|
8
10
|
import { buildPaginationModel } from '../Pagination/model.js';
|
|
9
|
-
import classes from './Pagination.module.css.js';
|
|
10
|
-
import { clsx } from 'clsx';
|
|
11
11
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
|
|
13
13
|
|
|
14
|
+
const StyledPagination = styled.nav.withConfig({
|
|
15
|
+
displayName: "Pagination__StyledPagination",
|
|
16
|
+
componentId: "sc-1auq45q-0"
|
|
17
|
+
})(["display:flex;align-items:center;justify-content:space-between;column-gap:1rem;width:100%;grid-area:footer;padding:0.5rem 1rem;border:1px solid ", ";border-top-width:0;border-end-start-radius:6px;border-end-end-radius:6px;.TablePaginationRange{color:", ";font-size:0.75rem;margin:0;}.TablePaginationSteps{display:flex;align-items:center;flex-wrap:wrap;list-style:none;color:", ";font-size:0.875rem;margin:0;padding:0;}.TablePaginationStep:first-of-type{margin-right:1rem;}.TablePaginationStep:last-of-type{margin-left:1rem;}.TablePaginationAction{display:flex;align-items:center;color:", ";font-size:0.875rem;line-height:calc(20 / 14);user-select:none;padding:0.5rem;border-radius:6px;}.TablePaginationAction[data-has-page]{color:", ";}.TablePaginationPage{min-width:2rem;min-height:2rem;display:flex;align-items:center;justify-content:center;font-size:0.875rem;line-height:calc(20 / 14);user-select:none;border-radius:6px;padding:0.5rem calc((2rem - 1.25rem) / 2);}.TablePaginationAction[data-has-page]:hover,.TablePaginationAction[data-has-page]:focus,.TablePaginationPage:hover,.TablePaginationPage:focus{background-color:", ";}.TablePaginationPage[data-active='true']{background-color:", ";color:", ";}.TablePaginationPage[data-active='true']:focus-visible{outline:2px solid var(--bgColor-accent-emphasis);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--fgColor-onEmphasis);}.TablePaginationTruncationStep{display:flex;align-items:center;justify-content:center;min-width:2rem;min-height:2rem;user-select:none;}", ""], get('colors.border.default'), get('colors.fg.muted'), get('colors.fg.default'), get('colors.fg.muted'), get('colors.accent.fg'), get('colors.actionListItem.default.hoverBg'), get('colors.accent.emphasis'), get('colors.fg.onEmphasis'),
|
|
18
|
+
// Hides pages based on the viewport range passed to `showPages`
|
|
19
|
+
Object.keys(viewportRanges).map(viewportRangeKey => {
|
|
20
|
+
return `
|
|
21
|
+
@media (${viewportRanges[viewportRangeKey]}) {
|
|
22
|
+
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:not(:first-child):not(:last-child) {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:first-child {
|
|
27
|
+
margin-inline-end: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.TablePaginationSteps[data-hidden-viewport-ranges*='${viewportRangeKey}'] > *:last-child {
|
|
31
|
+
margin-inline-start: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
}).join(''));
|
|
14
36
|
const defaultShowPages = {
|
|
15
37
|
narrow: false
|
|
16
38
|
};
|
|
@@ -53,20 +75,20 @@ function Pagination({
|
|
|
53
75
|
return buildPaginationModel(pageCount, pageIndex + 1, !!showPages, 1, 2);
|
|
54
76
|
}, [pageCount, pageIndex, showPages]);
|
|
55
77
|
return /*#__PURE__*/jsxs(LiveRegion, {
|
|
56
|
-
children: [/*#__PURE__*/jsx(LiveRegionOutlet, {}), /*#__PURE__*/jsxs(
|
|
78
|
+
children: [/*#__PURE__*/jsx(LiveRegionOutlet, {}), /*#__PURE__*/jsxs(StyledPagination, {
|
|
57
79
|
"aria-label": label,
|
|
58
|
-
className:
|
|
80
|
+
className: "TablePagination",
|
|
59
81
|
id: id,
|
|
60
82
|
children: [/*#__PURE__*/jsx(Range, {
|
|
61
83
|
pageStart: pageStart,
|
|
62
84
|
pageEnd: pageEnd,
|
|
63
85
|
totalCount: totalCount
|
|
64
86
|
}), /*#__PURE__*/jsxs("ol", {
|
|
65
|
-
className:
|
|
87
|
+
className: "TablePaginationSteps",
|
|
66
88
|
"data-hidden-viewport-ranges": getViewportRangesToHidePages().join(' '),
|
|
67
89
|
children: [/*#__PURE__*/jsx(Step, {
|
|
68
90
|
children: /*#__PURE__*/jsxs(Button, {
|
|
69
|
-
className:
|
|
91
|
+
className: "TablePaginationAction",
|
|
70
92
|
type: "button",
|
|
71
93
|
"data-has-page": hasPreviousPage ? true : undefined,
|
|
72
94
|
"aria-disabled": !hasPreviousPage ? true : undefined,
|
|
@@ -77,6 +99,7 @@ function Pagination({
|
|
|
77
99
|
selectPreviousPage();
|
|
78
100
|
},
|
|
79
101
|
children: [hasPreviousPage ? /*#__PURE__*/jsx(ChevronLeftIcon, {}) : null, /*#__PURE__*/jsx("span", {
|
|
102
|
+
className: "TablePaginationActionLabel",
|
|
80
103
|
children: "Previous"
|
|
81
104
|
}), /*#__PURE__*/jsx(VisuallyHidden, {
|
|
82
105
|
children: "\xA0page"
|
|
@@ -100,7 +123,7 @@ function Pagination({
|
|
|
100
123
|
}
|
|
101
124
|
}), /*#__PURE__*/jsx(Step, {
|
|
102
125
|
children: /*#__PURE__*/jsxs(Button, {
|
|
103
|
-
className:
|
|
126
|
+
className: "TablePaginationAction",
|
|
104
127
|
type: "button",
|
|
105
128
|
"data-has-page": hasNextPage ? true : undefined,
|
|
106
129
|
"aria-disabled": !hasNextPage ? true : undefined,
|
|
@@ -111,6 +134,7 @@ function Pagination({
|
|
|
111
134
|
selectNextPage();
|
|
112
135
|
},
|
|
113
136
|
children: [/*#__PURE__*/jsx("span", {
|
|
137
|
+
className: "TablePaginationActionLabel",
|
|
114
138
|
children: "Next"
|
|
115
139
|
}), /*#__PURE__*/jsx(VisuallyHidden, {
|
|
116
140
|
children: "\xA0page"
|
|
@@ -123,7 +147,7 @@ function Pagination({
|
|
|
123
147
|
}
|
|
124
148
|
Pagination.displayName = "Pagination";
|
|
125
149
|
function Range(t0) {
|
|
126
|
-
const $ = c(
|
|
150
|
+
const $ = c(11);
|
|
127
151
|
const {
|
|
128
152
|
pageStart,
|
|
129
153
|
pageEnd,
|
|
@@ -143,53 +167,46 @@ function Range(t0) {
|
|
|
143
167
|
t2 = $[1];
|
|
144
168
|
}
|
|
145
169
|
let t3;
|
|
146
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
147
|
-
t3 = clsx("TablePaginationRange", classes.TablePaginationRange);
|
|
148
|
-
$[2] = t3;
|
|
149
|
-
} else {
|
|
150
|
-
t3 = $[2];
|
|
151
|
-
}
|
|
152
170
|
let t4;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
t4 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
171
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
172
|
+
t3 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
156
173
|
children: "\xA0through\xA0"
|
|
157
174
|
});
|
|
158
|
-
|
|
175
|
+
t4 = /*#__PURE__*/jsx("span", {
|
|
159
176
|
"aria-hidden": "true",
|
|
160
177
|
children: "\u2012"
|
|
161
178
|
});
|
|
179
|
+
$[2] = t3;
|
|
162
180
|
$[3] = t4;
|
|
163
|
-
$[4] = t5;
|
|
164
181
|
} else {
|
|
182
|
+
t3 = $[2];
|
|
165
183
|
t4 = $[3];
|
|
166
|
-
t5 = $[4];
|
|
167
184
|
}
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
171
|
-
className:
|
|
172
|
-
children: [start,
|
|
185
|
+
let t5;
|
|
186
|
+
if ($[4] !== end || $[5] !== start || $[6] !== totalCount) {
|
|
187
|
+
t5 = /*#__PURE__*/jsxs("p", {
|
|
188
|
+
className: "TablePaginationRange",
|
|
189
|
+
children: [start, t3, t4, end, " of ", totalCount]
|
|
173
190
|
});
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
191
|
+
$[4] = end;
|
|
192
|
+
$[5] = start;
|
|
193
|
+
$[6] = totalCount;
|
|
194
|
+
$[7] = t5;
|
|
178
195
|
} else {
|
|
179
|
-
|
|
196
|
+
t5 = $[7];
|
|
180
197
|
}
|
|
181
|
-
let
|
|
182
|
-
if ($[
|
|
183
|
-
|
|
184
|
-
children: [t2,
|
|
198
|
+
let t6;
|
|
199
|
+
if ($[8] !== t2 || $[9] !== t5) {
|
|
200
|
+
t6 = /*#__PURE__*/jsxs(Fragment, {
|
|
201
|
+
children: [t2, t5]
|
|
185
202
|
});
|
|
186
|
-
$[
|
|
203
|
+
$[8] = t2;
|
|
204
|
+
$[9] = t5;
|
|
187
205
|
$[10] = t6;
|
|
188
|
-
$[11] = t7;
|
|
189
206
|
} else {
|
|
190
|
-
|
|
207
|
+
t6 = $[10];
|
|
191
208
|
}
|
|
192
|
-
return
|
|
209
|
+
return t6;
|
|
193
210
|
}
|
|
194
211
|
function TruncationStep() {
|
|
195
212
|
const $ = c(1);
|
|
@@ -197,7 +214,7 @@ function TruncationStep() {
|
|
|
197
214
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
198
215
|
t0 = /*#__PURE__*/jsx("li", {
|
|
199
216
|
"aria-hidden": "true",
|
|
200
|
-
className:
|
|
217
|
+
className: "TablePaginationTruncationStep",
|
|
201
218
|
children: "\u2026"
|
|
202
219
|
});
|
|
203
220
|
$[0] = t0;
|
|
@@ -207,74 +224,60 @@ function TruncationStep() {
|
|
|
207
224
|
return t0;
|
|
208
225
|
}
|
|
209
226
|
function Step(t0) {
|
|
210
|
-
const $ = c(
|
|
227
|
+
const $ = c(2);
|
|
211
228
|
const {
|
|
212
229
|
children
|
|
213
230
|
} = t0;
|
|
214
231
|
let t1;
|
|
215
|
-
if ($[0]
|
|
216
|
-
t1 =
|
|
217
|
-
|
|
218
|
-
} else {
|
|
219
|
-
t1 = $[0];
|
|
220
|
-
}
|
|
221
|
-
let t2;
|
|
222
|
-
if ($[1] !== children) {
|
|
223
|
-
t2 = /*#__PURE__*/jsx("li", {
|
|
224
|
-
className: t1,
|
|
232
|
+
if ($[0] !== children) {
|
|
233
|
+
t1 = /*#__PURE__*/jsx("li", {
|
|
234
|
+
className: "TablePaginationStep",
|
|
225
235
|
children: children
|
|
226
236
|
});
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
237
|
+
$[0] = children;
|
|
238
|
+
$[1] = t1;
|
|
229
239
|
} else {
|
|
230
|
-
|
|
240
|
+
t1 = $[1];
|
|
231
241
|
}
|
|
232
|
-
return
|
|
242
|
+
return t1;
|
|
233
243
|
}
|
|
234
244
|
function Page(t0) {
|
|
235
|
-
const $ = c(
|
|
245
|
+
const $ = c(6);
|
|
236
246
|
const {
|
|
237
247
|
active,
|
|
238
248
|
children,
|
|
239
249
|
onClick
|
|
240
250
|
} = t0;
|
|
241
|
-
|
|
242
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
243
|
-
t1 = clsx("TablePaginationPage", classes.TablePaginationPage);
|
|
244
|
-
$[0] = t1;
|
|
245
|
-
} else {
|
|
246
|
-
t1 = $[0];
|
|
247
|
-
}
|
|
251
|
+
const t1 = active ? true : undefined;
|
|
248
252
|
const t2 = active ? true : undefined;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
t4 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
253
|
+
let t3;
|
|
254
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
255
|
+
t3 = /*#__PURE__*/jsx(VisuallyHidden, {
|
|
253
256
|
children: "Page\xA0"
|
|
254
257
|
});
|
|
255
|
-
$[
|
|
258
|
+
$[0] = t3;
|
|
256
259
|
} else {
|
|
257
|
-
|
|
260
|
+
t3 = $[0];
|
|
258
261
|
}
|
|
259
|
-
let
|
|
260
|
-
if ($[
|
|
261
|
-
|
|
262
|
-
className:
|
|
262
|
+
let t4;
|
|
263
|
+
if ($[1] !== children || $[2] !== onClick || $[3] !== t1 || $[4] !== t2) {
|
|
264
|
+
t4 = /*#__PURE__*/jsxs(Button, {
|
|
265
|
+
className: "TablePaginationPage",
|
|
263
266
|
type: "button",
|
|
264
|
-
"data-active":
|
|
265
|
-
"aria-current":
|
|
267
|
+
"data-active": t1,
|
|
268
|
+
"aria-current": t2,
|
|
266
269
|
onClick: onClick,
|
|
267
|
-
children: [
|
|
270
|
+
children: [t3, children]
|
|
268
271
|
});
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
272
|
+
$[1] = children;
|
|
273
|
+
$[2] = onClick;
|
|
274
|
+
$[3] = t1;
|
|
271
275
|
$[4] = t2;
|
|
272
|
-
$[5] =
|
|
273
|
-
$[6] = t5;
|
|
276
|
+
$[5] = t4;
|
|
274
277
|
} else {
|
|
275
|
-
|
|
278
|
+
t4 = $[5];
|
|
276
279
|
}
|
|
277
|
-
return
|
|
280
|
+
return t4;
|
|
278
281
|
}
|
|
279
282
|
function usePagination(config) {
|
|
280
283
|
const $ = c(24);
|
|
@@ -81,7 +81,7 @@ declare function TableCell({ align, className, children, scope, ...rest }: Table
|
|
|
81
81
|
type TableCellPlaceholderProps = React.PropsWithChildren;
|
|
82
82
|
declare function TableCellPlaceholder({ children }: TableCellPlaceholderProps): React.JSX.Element;
|
|
83
83
|
export type TableContainerProps = React.PropsWithChildren<SxProp & React.HTMLAttributes<HTMLDivElement>>;
|
|
84
|
-
declare function TableContainer({ children, className, ...rest }: TableContainerProps): React.JSX.Element;
|
|
84
|
+
declare function TableContainer({ children, className, sx: sxProp, ...rest }: TableContainerProps): React.JSX.Element;
|
|
85
85
|
export type TableTitleProps = React.PropsWithChildren<{
|
|
86
86
|
/**
|
|
87
87
|
* Provide an alternate element or component to use as the container for
|