@primer/react 0.0.0-20260831205533 → 0.0.0-20260915162741
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 +39 -3
- package/dist/ActionBar/ActionBar.js +2 -2
- package/dist/ActionList/Description.js +3 -3
- package/dist/ActionList/Divider.js +2 -2
- package/dist/ActionList/Group.js +4 -4
- package/dist/ActionList/GroupHeadingTrailingAction.js +2 -2
- package/dist/ActionList/Heading.js +3 -3
- package/dist/ActionList/Item.js +4 -4
- package/dist/ActionList/List.js +3 -3
- package/dist/ActionList/Selection.js +2 -2
- package/dist/ActionList/TrailingAction.js +3 -3
- package/dist/ActionList/Visuals.js +3 -3
- package/dist/ActionMenu/ActionMenu.js +2 -2
- package/dist/AnchoredOverlay/AnchoredOverlay.js +3 -3
- package/dist/Autocomplete/Autocomplete.js +2 -2
- package/dist/Autocomplete/AutocompleteInput.js +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +3 -3
- package/dist/Autocomplete/AutocompleteOverlay.js +3 -3
- package/dist/Avatar/Avatar.js +3 -3
- package/dist/AvatarStack/AvatarStack.js +3 -3
- package/dist/Banner/Banner.js +3 -3
- package/dist/BaseStyles.js +2 -2
- package/dist/Blankslate/Blankslate.js +3 -3
- package/dist/BranchName/BranchName.js +2 -2
- package/dist/Breadcrumbs/Breadcrumbs.js +3 -3
- package/dist/Button/Button.js +2 -2
- package/dist/Button/{ButtonBase-b44e29d1.css → ButtonBase-faef2674.css} +2 -2
- package/dist/Button/ButtonBase-faef2674.css.map +1 -0
- package/dist/Button/ButtonBase.js +4 -4
- package/dist/Button/ButtonBase.module.css.js +1 -1
- package/dist/Button/IconButton.js +3 -3
- package/dist/Button/LinkButton.js +2 -2
- package/dist/ButtonGroup/ButtonGroup.js +3 -3
- package/dist/Card/Card.js +3 -3
- package/dist/Checkbox/Checkbox.js +2 -2
- package/dist/CheckboxGroup/CheckboxGroup.js +2 -2
- package/dist/CircleBadge/CircleBadge.js +2 -2
- package/dist/ConfirmationDialog/ConfirmationDialog.js +2 -2
- package/dist/CounterLabel/CounterLabel.js +3 -3
- package/dist/DataTable/DataTable.d.ts +20 -20
- package/dist/DataTable/DataTable.js +42 -27
- package/dist/DataTable/ErrorDialog.js +1 -1
- package/dist/DataTable/Pagination.js +5 -5
- package/dist/DataTable/Table-50e68700.css +2 -0
- package/dist/DataTable/Table-50e68700.css.map +1 -0
- package/dist/DataTable/Table.d.ts +1 -0
- package/dist/DataTable/Table.js +74 -44
- package/dist/DataTable/Table.module.css.js +7 -2
- package/dist/DataTable/TableGroup.d.ts +41 -0
- package/dist/DataTable/TableGroup.js +159 -0
- package/dist/DataTable/TableGroupContext.js +5 -0
- package/dist/DataTable/index.d.ts +4 -2
- package/dist/DataTable/index.js +2 -0
- package/dist/DataTable/row.d.ts +24 -1
- package/dist/DataTable/useTable.js +157 -80
- package/dist/DataTable/utils.d.ts +4 -2
- package/dist/Details/Details.js +3 -3
- package/dist/Dialog/Dialog.js +3 -3
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -2
- package/dist/FeatureFlags/FeatureFlags.js +2 -2
- package/dist/FeatureFlags/useFeatureFlag.js +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +2 -2
- package/dist/FilteredActionList/FilteredActionListInput.js +2 -2
- package/dist/FilteredActionList/FilteredActionListLoaders.js +1 -1
- package/dist/Flash/Flash.js +3 -3
- package/dist/FormControl/FormControl.js +4 -4
- package/dist/FormControl/FormControlCaption.js +2 -2
- package/dist/FormControl/FormControlLabel.js +1 -1
- package/dist/FormControl/FormControlLeadingVisual.js +1 -1
- package/dist/FormControl/_FormControlContext.js +1 -1
- package/dist/FormControl/_FormControlValidation.js +1 -1
- package/dist/Header/Header.js +3 -3
- package/dist/Heading/Heading.js +3 -3
- package/dist/Hidden/Hidden.js +2 -2
- package/dist/InlineMessage/InlineMessage.js +2 -2
- package/dist/KeybindingHint/KeybindingHint.js +3 -3
- package/dist/KeybindingHint/components/Chord.js +4 -4
- package/dist/KeybindingHint/components/Key.js +1 -1
- package/dist/KeybindingHint/components/Sequence.js +3 -3
- package/dist/Label/Label.js +3 -3
- package/dist/LabelGroup/LabelGroup.js +2 -2
- package/dist/Link/Link.js +3 -3
- package/dist/NavList/NavList.js +6 -6
- package/dist/Octicon/Octicon.js +2 -2
- package/dist/Overlay/Overlay.js +2 -2
- package/dist/PageHeader/PageHeader.js +4 -4
- package/dist/PageLayout/DragHandle.js +2 -2
- package/dist/PageLayout/PageLayout.js +3 -3
- package/dist/PageLayout/usePaneWidth.js +1 -1
- package/dist/Pagehead/Pagehead.js +2 -2
- package/dist/Pagination/Pagination.js +4 -4
- package/dist/Popover/Popover.js +3 -3
- package/dist/Portal/Portal.js +1 -1
- package/dist/ProgressBar/ProgressBar.js +3 -3
- package/dist/Radio/Radio.js +3 -3
- package/dist/RadioGroup/RadioGroup.js +1 -1
- package/dist/RelativeTime/RelativeTime.js +1 -1
- package/dist/ScrollableRegion/ScrollableRegion.js +3 -3
- package/dist/SegmentedControl/SegmentedControl-e68d4197.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-e68d4197.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +5 -1
- package/dist/SegmentedControl/SegmentedControl.js +204 -167
- package/dist/SegmentedControl/SegmentedControl.module.css.js +8 -4
- package/dist/SegmentedControl/SegmentedControlAction.d.ts +12 -0
- package/dist/SegmentedControl/SegmentedControlAction.js +111 -0
- package/dist/SegmentedControl/SegmentedControlActionContext.js +5 -0
- package/dist/SegmentedControl/SegmentedControlButton.js +2 -2
- package/dist/SegmentedControl/SegmentedControlDivider.d.ts +9 -0
- package/dist/SegmentedControl/SegmentedControlDivider.js +24 -0
- package/dist/SegmentedControl/SegmentedControlIconButton.js +2 -2
- package/dist/SegmentedControl/index.d.ts +3 -1
- package/dist/Select/Select.js +3 -3
- package/dist/SelectPanel/SelectPanel.js +3 -3
- package/dist/SelectPanel/SelectPanelMessage.js +2 -2
- package/dist/SideNav.js +2 -2
- package/dist/Skeleton/SkeletonBox.js +3 -3
- package/dist/SkeletonAvatar/SkeletonAvatar.js +2 -2
- package/dist/SkeletonText/SkeletonText.js +2 -2
- package/dist/Spinner/Spinner.js +3 -3
- package/dist/SplitPageLayout/SplitPageLayout.js +1 -1
- package/dist/Stack/Stack.js +3 -3
- package/dist/StateLabel/StateLabel.js +3 -3
- package/dist/SubNav/SubNav.js +3 -3
- package/dist/TabNav/TabNav.js +3 -3
- package/dist/Text/Text.js +2 -2
- package/dist/TextInput/TextInput.js +5 -5
- package/dist/TextInputWithTokens/TextInputWithTokens.js +3 -3
- package/dist/Textarea/Textarea.js +4 -4
- package/dist/ThemeProvider.js +2 -2
- package/dist/Timeline/Timeline.js +3 -3
- package/dist/ToggleSwitch/ToggleSwitch.js +4 -4
- package/dist/Token/IssueLabelToken.js +3 -3
- package/dist/Token/Token.js +3 -3
- package/dist/Token/TokenBase.js +3 -3
- package/dist/Token/_RemoveTokenButton.js +1 -1
- package/dist/Token/_TokenTextContainer.js +2 -2
- package/dist/Tooltip/Tooltip.js +2 -2
- package/dist/TooltipV2/Tooltip.js +21 -11
- package/dist/TopicTag/TopicTag.js +2 -2
- package/dist/TopicTag/TopicTagGroup.js +2 -2
- package/dist/TreeView/TreeView.js +9 -9
- package/dist/TreeView/useRovingTabIndex.js +1 -1
- package/dist/TreeView/useTreeItemCache.js +1 -1
- package/dist/TreeView/useTypeahead.js +1 -1
- package/dist/Truncate/Truncate.js +2 -2
- package/dist/UnderlineNav/UnderlineNav.js +3 -3
- package/dist/UnderlineNav/UnderlineNavItem.js +2 -2
- package/dist/VisuallyHidden/VisuallyHidden.js +2 -2
- package/dist/_VisuallyHidden.js +2 -2
- package/dist/deprecated/ActionList/Divider.js +1 -1
- package/dist/deprecated/ActionList/Group.js +1 -1
- package/dist/deprecated/ActionList/Header.js +2 -2
- package/dist/deprecated/ActionList/Item.js +4 -4
- package/dist/deprecated/ActionList/List.js +3 -3
- package/dist/deprecated/ActionMenu.js +2 -2
- package/dist/deprecated/DialogV1/Dialog.js +4 -4
- package/dist/deprecated/FilteredSearch/FilteredSearch.js +2 -2
- package/dist/deprecated/UnderlineNav/UnderlineNav.js +3 -3
- package/dist/experimental/IssueLabel/IssueLabel.js +2 -2
- package/dist/experimental/SelectPanel2/SelectPanel.js +5 -5
- package/dist/experimental/Tabs/Tabs.js +23 -26
- package/dist/experimental/Tabs/useTab.js +1 -1
- package/dist/experimental/Tabs/useTabList.js +17 -21
- package/dist/experimental/Tabs/useTabPanel.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +10 -15
- package/dist/experimental/index.d.ts +6 -5
- package/dist/experimental/index.js +1 -1
- package/dist/hooks/useDetails.js +1 -1
- package/dist/hooks/useDialog.js +1 -1
- package/dist/hooks/useMedia.js +1 -1
- package/dist/hooks/useMenuInitialFocus.js +1 -1
- package/dist/hooks/useMenuKeyboardNavigation.js +1 -1
- package/dist/hooks/useMergedRefs.js +1 -1
- package/dist/hooks/useMnemonics.js +1 -1
- package/dist/hooks/useOpenAndCloseFocus.js +1 -1
- package/dist/hooks/useOverflow.js +5 -5
- package/dist/hooks/useOverlay.js +1 -1
- package/dist/hooks/useProvidedStateOrCreate.js +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +1 -1
- package/dist/hooks/useRenderForcingRef.js +1 -1
- package/dist/hooks/useScrollFlash.js +1 -1
- package/dist/hooks/useSyncedState.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/internal/components/ButtonReset.js +2 -2
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +4 -4
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +3 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +3 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +2 -2
- package/dist/internal/components/ConditionalWrapper.js +1 -1
- package/dist/internal/components/InputLabel.js +2 -2
- package/dist/internal/components/InputValidation.js +2 -2
- package/dist/internal/components/OverflowObserverProvider.js +2 -2
- package/dist/internal/components/TextInputInnerAction.js +4 -4
- package/dist/internal/components/TextInputInnerVisualSlot.js +2 -2
- package/dist/internal/components/TextInputWrapper.js +3 -3
- package/dist/internal/components/ThemeProviderBase.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +3 -3
- package/dist/internal/components/UnstyledTextInput.js +3 -3
- package/dist/internal/components/ValidationAnimationContainer.js +2 -2
- package/dist/internal/hooks/useEffectCallback.js +1 -1
- package/dist/internal/hooks/useEffectOnce.js +1 -1
- package/dist/internal/hooks/useOverflowObserver.js +1 -1
- package/dist/internal/hooks/useThemeProvider.js +1 -1
- package/dist/live-region/Announce.js +2 -2
- package/dist/live-region/AriaAlert.d.ts +1 -1
- package/dist/live-region/AriaAlert.js +1 -1
- package/dist/live-region/AriaStatus.js +1 -1
- package/dist/next/ThemeProvider.js +1 -1
- package/dist/utils/descendant-registry.js +2 -2
- package/dist/utils/react-compiler-runtime.js +32 -0
- package/generated/components.json +185 -10
- package/package.json +8 -8
- package/dist/Button/ButtonBase-b44e29d1.css.map +0 -1
- package/dist/DataTable/Table-7f5cb3e4.css +0 -2
- package/dist/DataTable/Table-7f5cb3e4.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-4ef72733.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-4ef72733.css.map +0 -1
package/dist/DataTable/Table.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
1
2
|
import Text_default from "../Text/Text.js";
|
|
2
3
|
import VisuallyHidden from "../_VisuallyHidden.js";
|
|
3
4
|
import { ScrollableRegion } from "../ScrollableRegion/ScrollableRegion.js";
|
|
@@ -5,15 +6,15 @@ import { SkeletonText } from "../SkeletonText/SkeletonText.js";
|
|
|
5
6
|
import { SortDirection } from "./sorting.js";
|
|
6
7
|
import { useTableLayout } from "./useTable.js";
|
|
7
8
|
import { Button } from "../internal/components/ButtonReset.js";
|
|
9
|
+
import { TableGroupContext } from "./TableGroupContext.js";
|
|
8
10
|
import Table_module_css_default from "./Table.module.css.js";
|
|
9
|
-
import {
|
|
11
|
+
import React, { useContext } from "react";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
13
|
import { clsx } from "clsx";
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import React from "react";
|
|
13
14
|
import { SortAscIcon, SortDescIcon } from "@primer/octicons-react";
|
|
14
15
|
//#region src/DataTable/Table.tsx
|
|
15
16
|
const Table = /*#__PURE__*/ React.forwardRef(function Table(t0, ref) {
|
|
16
|
-
const $ = c(
|
|
17
|
+
const $ = c(24);
|
|
17
18
|
let className;
|
|
18
19
|
let gridTemplateColumns;
|
|
19
20
|
let labelledby;
|
|
@@ -35,6 +36,7 @@ const Table = /*#__PURE__*/ React.forwardRef(function Table(t0, ref) {
|
|
|
35
36
|
t1 = $[5];
|
|
36
37
|
}
|
|
37
38
|
const cellPadding = t1 === void 0 ? "normal" : t1;
|
|
39
|
+
const inheritedGroup = useContext(TableGroupContext);
|
|
38
40
|
let t2;
|
|
39
41
|
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
42
|
t2 = clsx("TableOverflowWrapper", Table_module_css_default.TableOverflowWrapper);
|
|
@@ -84,7 +86,18 @@ const Table = /*#__PURE__*/ React.forwardRef(function Table(t0, ref) {
|
|
|
84
86
|
$[19] = t6;
|
|
85
87
|
$[20] = t7;
|
|
86
88
|
} else t7 = $[20];
|
|
87
|
-
|
|
89
|
+
const table = t7;
|
|
90
|
+
let t8;
|
|
91
|
+
if ($[21] !== inheritedGroup || $[22] !== table) {
|
|
92
|
+
t8 = inheritedGroup ? /*#__PURE__*/ jsx(TableGroupContext.Provider, {
|
|
93
|
+
value: void 0,
|
|
94
|
+
children: table
|
|
95
|
+
}) : table;
|
|
96
|
+
$[21] = inheritedGroup;
|
|
97
|
+
$[22] = table;
|
|
98
|
+
$[23] = t8;
|
|
99
|
+
} else t8 = $[23];
|
|
100
|
+
return t8;
|
|
88
101
|
});
|
|
89
102
|
function TableHead(t0) {
|
|
90
103
|
const $ = c(3);
|
|
@@ -168,7 +181,7 @@ function TableHeader(t0) {
|
|
|
168
181
|
return t2;
|
|
169
182
|
}
|
|
170
183
|
function TableSortHeader(t0) {
|
|
171
|
-
const $ = c(
|
|
184
|
+
const $ = c(24);
|
|
172
185
|
let align;
|
|
173
186
|
let children;
|
|
174
187
|
let direction;
|
|
@@ -190,6 +203,7 @@ function TableSortHeader(t0) {
|
|
|
190
203
|
rest = $[5];
|
|
191
204
|
}
|
|
192
205
|
const ariaSort = direction === "DESC" ? "descending" : direction === "ASC" ? "ascending" : void 0;
|
|
206
|
+
const sortAction = direction === SortDirection.ASC ? "Sort descending" : "Sort ascending";
|
|
193
207
|
let t1;
|
|
194
208
|
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
195
209
|
t1 = clsx("TableSortButton", Table_module_css_default.TableSortButton);
|
|
@@ -205,7 +219,7 @@ function TableSortHeader(t0) {
|
|
|
205
219
|
} else t2 = $[8];
|
|
206
220
|
let t3;
|
|
207
221
|
if ($[9] !== direction) {
|
|
208
|
-
t3 = direction === SortDirection.NONE || direction === SortDirection.ASC ? /*#__PURE__*/
|
|
222
|
+
t3 = direction === SortDirection.NONE || direction === SortDirection.ASC ? /*#__PURE__*/ jsx(Fragment$1, { children: /*#__PURE__*/ jsx(SortAscIcon, { className: clsx("TableSortIcon", "TableSortIcon--ascending", Table_module_css_default.TableSortIcon, Table_module_css_default["TableSortIcon--ascending"]) }) }) : null;
|
|
209
223
|
$[9] = direction;
|
|
210
224
|
$[10] = t3;
|
|
211
225
|
} else t3 = $[10];
|
|
@@ -216,11 +230,12 @@ function TableSortHeader(t0) {
|
|
|
216
230
|
$[12] = t4;
|
|
217
231
|
} else t4 = $[12];
|
|
218
232
|
let t5;
|
|
219
|
-
if ($[13] !== children || $[14] !==
|
|
233
|
+
if ($[13] !== children || $[14] !== sortAction || $[15] !== t2 || $[16] !== t3 || $[17] !== t4) {
|
|
220
234
|
t5 = /*#__PURE__*/ jsxs(Button, {
|
|
221
235
|
type: "button",
|
|
222
236
|
className: t1,
|
|
223
237
|
"data-component": "Table.SortHeader.Button",
|
|
238
|
+
"aria-description": sortAction,
|
|
224
239
|
onClick: t2,
|
|
225
240
|
children: [
|
|
226
241
|
children,
|
|
@@ -229,13 +244,14 @@ function TableSortHeader(t0) {
|
|
|
229
244
|
]
|
|
230
245
|
});
|
|
231
246
|
$[13] = children;
|
|
232
|
-
$[14] =
|
|
233
|
-
$[15] =
|
|
234
|
-
$[16] =
|
|
235
|
-
$[17] =
|
|
236
|
-
|
|
247
|
+
$[14] = sortAction;
|
|
248
|
+
$[15] = t2;
|
|
249
|
+
$[16] = t3;
|
|
250
|
+
$[17] = t4;
|
|
251
|
+
$[18] = t5;
|
|
252
|
+
} else t5 = $[18];
|
|
237
253
|
let t6;
|
|
238
|
-
if ($[
|
|
254
|
+
if ($[19] !== align || $[20] !== ariaSort || $[21] !== rest || $[22] !== t5) {
|
|
239
255
|
t6 = /*#__PURE__*/ jsx(TableHeader, {
|
|
240
256
|
...rest,
|
|
241
257
|
"aria-sort": ariaSort,
|
|
@@ -243,12 +259,12 @@ function TableSortHeader(t0) {
|
|
|
243
259
|
"data-component": "Table.SortHeader",
|
|
244
260
|
children: t5
|
|
245
261
|
});
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
} else t6 = $[
|
|
262
|
+
$[19] = align;
|
|
263
|
+
$[20] = ariaSort;
|
|
264
|
+
$[21] = rest;
|
|
265
|
+
$[22] = t5;
|
|
266
|
+
$[23] = t6;
|
|
267
|
+
} else t6 = $[23];
|
|
252
268
|
return t6;
|
|
253
269
|
}
|
|
254
270
|
function TableRow(t0) {
|
|
@@ -285,56 +301,70 @@ function TableRow(t0) {
|
|
|
285
301
|
return t2;
|
|
286
302
|
}
|
|
287
303
|
function TableCell(t0) {
|
|
288
|
-
const $ = c(
|
|
304
|
+
const $ = c(21);
|
|
289
305
|
let align;
|
|
290
306
|
let children;
|
|
291
307
|
let className;
|
|
308
|
+
let headers;
|
|
292
309
|
let rest;
|
|
293
310
|
let scope;
|
|
294
311
|
if ($[0] !== t0) {
|
|
295
|
-
({align, className, children, scope, ...rest} = t0);
|
|
312
|
+
({align, className, children, scope, headers, ...rest} = t0);
|
|
296
313
|
$[0] = t0;
|
|
297
314
|
$[1] = align;
|
|
298
315
|
$[2] = children;
|
|
299
316
|
$[3] = className;
|
|
300
|
-
$[4] =
|
|
301
|
-
$[5] =
|
|
317
|
+
$[4] = headers;
|
|
318
|
+
$[5] = rest;
|
|
319
|
+
$[6] = scope;
|
|
302
320
|
} else {
|
|
303
321
|
align = $[1];
|
|
304
322
|
children = $[2];
|
|
305
323
|
className = $[3];
|
|
306
|
-
|
|
307
|
-
|
|
324
|
+
headers = $[4];
|
|
325
|
+
rest = $[5];
|
|
326
|
+
scope = $[6];
|
|
308
327
|
}
|
|
309
328
|
const BaseComponent = scope ? "th" : "td";
|
|
310
329
|
const role = scope ? "rowheader" : "cell";
|
|
330
|
+
const group = useContext(TableGroupContext);
|
|
311
331
|
let t1;
|
|
312
|
-
if ($[
|
|
313
|
-
t1 =
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
|
|
332
|
+
if ($[7] !== (group === null || group === void 0 ? void 0 : group.headerId) || $[8] !== headers) {
|
|
333
|
+
t1 = [group === null || group === void 0 ? void 0 : group.headerId, headers].filter(Boolean).join(" ") || void 0;
|
|
334
|
+
$[7] = group === null || group === void 0 ? void 0 : group.headerId;
|
|
335
|
+
$[8] = headers;
|
|
336
|
+
$[9] = t1;
|
|
337
|
+
} else t1 = $[9];
|
|
338
|
+
const resolvedHeaders = t1;
|
|
317
339
|
let t2;
|
|
318
|
-
if ($[
|
|
319
|
-
t2 =
|
|
340
|
+
if ($[10] !== className) {
|
|
341
|
+
t2 = clsx("TableCell", className, Table_module_css_default.TableCell);
|
|
342
|
+
$[10] = className;
|
|
343
|
+
$[11] = t2;
|
|
344
|
+
} else t2 = $[11];
|
|
345
|
+
let t3;
|
|
346
|
+
if ($[12] !== BaseComponent || $[13] !== align || $[14] !== children || $[15] !== resolvedHeaders || $[16] !== rest || $[17] !== role || $[18] !== scope || $[19] !== t2) {
|
|
347
|
+
t3 = /*#__PURE__*/ jsx(BaseComponent, {
|
|
320
348
|
...rest,
|
|
321
|
-
className:
|
|
349
|
+
className: t2,
|
|
322
350
|
scope,
|
|
323
351
|
role,
|
|
324
352
|
"data-cell-align": align,
|
|
325
353
|
"data-component": "Table.Cell",
|
|
354
|
+
headers: resolvedHeaders,
|
|
326
355
|
children
|
|
327
356
|
});
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[
|
|
335
|
-
$[
|
|
336
|
-
|
|
337
|
-
|
|
357
|
+
$[12] = BaseComponent;
|
|
358
|
+
$[13] = align;
|
|
359
|
+
$[14] = children;
|
|
360
|
+
$[15] = resolvedHeaders;
|
|
361
|
+
$[16] = rest;
|
|
362
|
+
$[17] = role;
|
|
363
|
+
$[18] = scope;
|
|
364
|
+
$[19] = t2;
|
|
365
|
+
$[20] = t3;
|
|
366
|
+
} else t3 = $[20];
|
|
367
|
+
return t3;
|
|
338
368
|
}
|
|
339
369
|
function TableCellPlaceholder(t0) {
|
|
340
370
|
const $ = c(2);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./Table-
|
|
1
|
+
import "./Table-50e68700.css";
|
|
2
2
|
//#region src/DataTable/Table.module.css.js
|
|
3
3
|
var Table_module_css_default = {
|
|
4
4
|
"TableContainer": "prc-DataTable-TableContainer-hn0p3",
|
|
@@ -20,7 +20,12 @@ var Table_module_css_default = {
|
|
|
20
20
|
"TableSortIcon--ascending": "prc-DataTable-TableSortIcon--ascending-Lpx6z",
|
|
21
21
|
"TableSortIcon--descending": "prc-DataTable-TableSortIcon--descending-hHJGo",
|
|
22
22
|
"TableCellSkeletonItems": "prc-DataTable-TableCellSkeletonItems-Ljhq5",
|
|
23
|
-
"
|
|
23
|
+
"TableGroupHeaderBody": "prc-DataTable-TableGroupHeaderBody-K-YqR",
|
|
24
|
+
"TableGroupHeaderCell": "prc-DataTable-TableGroupHeaderCell-vnb30",
|
|
25
|
+
"TableGroupHeaderContent": "prc-DataTable-TableGroupHeaderContent-H9FbA",
|
|
26
|
+
"TableGroupHeaderLabel": "prc-DataTable-TableGroupHeaderLabel--c-od",
|
|
27
|
+
"PlaceholderText": "prc-DataTable-PlaceholderText-8bHo7",
|
|
28
|
+
"TableGroupHeaderCount": "prc-DataTable-TableGroupHeaderCount-6r8Pj"
|
|
24
29
|
};
|
|
25
30
|
//#endregion
|
|
26
31
|
export { Table_module_css_default as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/DataTable/TableGroup.d.ts
|
|
4
|
+
type TableGroupProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Provide a custom class name for the group header section
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Provide a stable identifier exposed on both group sections as `data-group-id`
|
|
11
|
+
*/
|
|
12
|
+
id: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* Provide a label for the group header
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/**
|
|
18
|
+
* Specify the number of member rows in the group
|
|
19
|
+
*/
|
|
20
|
+
rowCount: number;
|
|
21
|
+
/**
|
|
22
|
+
* Provide an accessible name for the group header
|
|
23
|
+
*/
|
|
24
|
+
'aria-label'?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Specify the number of columns spanned by the group header
|
|
27
|
+
*/
|
|
28
|
+
colSpan: number;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
declare function TableGroup({
|
|
32
|
+
className,
|
|
33
|
+
id,
|
|
34
|
+
label,
|
|
35
|
+
rowCount,
|
|
36
|
+
colSpan,
|
|
37
|
+
children,
|
|
38
|
+
'aria-label': ariaLabel
|
|
39
|
+
}: TableGroupProps): React.JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { TableGroup, TableGroupProps };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
2
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
3
|
+
import { TableGroupContext } from "./TableGroupContext.js";
|
|
4
|
+
import Table_module_css_default from "./Table.module.css.js";
|
|
5
|
+
import { TableRow } from "./Table.js";
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
//#region src/DataTable/TableGroup.tsx
|
|
10
|
+
function TableGroup(t0) {
|
|
11
|
+
const $ = c(38);
|
|
12
|
+
const { className, id, label, rowCount, colSpan, children, "aria-label": ariaLabel } = t0;
|
|
13
|
+
const headerId = useId();
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== headerId) {
|
|
16
|
+
t1 = { headerId };
|
|
17
|
+
$[0] = headerId;
|
|
18
|
+
$[1] = t1;
|
|
19
|
+
} else t1 = $[1];
|
|
20
|
+
const contextValue = t1;
|
|
21
|
+
let t2;
|
|
22
|
+
if ($[2] !== className) {
|
|
23
|
+
t2 = clsx("TableGroupHeaderBody", Table_module_css_default.TableGroupHeaderBody, className);
|
|
24
|
+
$[2] = className;
|
|
25
|
+
$[3] = t2;
|
|
26
|
+
} else t2 = $[3];
|
|
27
|
+
let t3;
|
|
28
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
29
|
+
t3 = clsx("TableGroupHeaderCell", Table_module_css_default.TableGroupHeaderCell);
|
|
30
|
+
$[4] = t3;
|
|
31
|
+
} else t3 = $[4];
|
|
32
|
+
let t4;
|
|
33
|
+
let t5;
|
|
34
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
35
|
+
t4 = clsx("TableGroupHeaderContent", Table_module_css_default.TableGroupHeaderContent);
|
|
36
|
+
t5 = clsx("TableGroupHeaderLabel", Table_module_css_default.TableGroupHeaderLabel);
|
|
37
|
+
$[5] = t4;
|
|
38
|
+
$[6] = t5;
|
|
39
|
+
} else {
|
|
40
|
+
t4 = $[5];
|
|
41
|
+
t5 = $[6];
|
|
42
|
+
}
|
|
43
|
+
let t6;
|
|
44
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t6 = /*#__PURE__*/ jsx(VisuallyHidden, { children: "," });
|
|
46
|
+
$[7] = t6;
|
|
47
|
+
} else t6 = $[7];
|
|
48
|
+
let t7;
|
|
49
|
+
if ($[8] !== label) {
|
|
50
|
+
t7 = /*#__PURE__*/ jsxs("span", {
|
|
51
|
+
className: t5,
|
|
52
|
+
children: [label, t6]
|
|
53
|
+
});
|
|
54
|
+
$[8] = label;
|
|
55
|
+
$[9] = t7;
|
|
56
|
+
} else t7 = $[9];
|
|
57
|
+
let t8;
|
|
58
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
59
|
+
t8 = clsx("TableGroupHeaderCount", Table_module_css_default.TableGroupHeaderCount);
|
|
60
|
+
$[10] = t8;
|
|
61
|
+
} else t8 = $[10];
|
|
62
|
+
const t9 = rowCount === 1 ? " row" : " rows";
|
|
63
|
+
let t10;
|
|
64
|
+
if ($[11] !== t9) {
|
|
65
|
+
t10 = /*#__PURE__*/ jsx(VisuallyHidden, { children: t9 });
|
|
66
|
+
$[11] = t9;
|
|
67
|
+
$[12] = t10;
|
|
68
|
+
} else t10 = $[12];
|
|
69
|
+
let t11;
|
|
70
|
+
if ($[13] !== rowCount || $[14] !== t10) {
|
|
71
|
+
t11 = /*#__PURE__*/ jsxs("span", {
|
|
72
|
+
className: t8,
|
|
73
|
+
children: [rowCount, t10]
|
|
74
|
+
});
|
|
75
|
+
$[13] = rowCount;
|
|
76
|
+
$[14] = t10;
|
|
77
|
+
$[15] = t11;
|
|
78
|
+
} else t11 = $[15];
|
|
79
|
+
let t12;
|
|
80
|
+
if ($[16] !== t11 || $[17] !== t7) {
|
|
81
|
+
t12 = /*#__PURE__*/ jsxs("span", {
|
|
82
|
+
className: t4,
|
|
83
|
+
children: [t7, t11]
|
|
84
|
+
});
|
|
85
|
+
$[16] = t11;
|
|
86
|
+
$[17] = t7;
|
|
87
|
+
$[18] = t12;
|
|
88
|
+
} else t12 = $[18];
|
|
89
|
+
let t13;
|
|
90
|
+
if ($[19] !== ariaLabel || $[20] !== colSpan || $[21] !== headerId || $[22] !== t12) {
|
|
91
|
+
t13 = /*#__PURE__*/ jsx(TableRow, { children: /*#__PURE__*/ jsx("th", {
|
|
92
|
+
id: headerId,
|
|
93
|
+
className: t3,
|
|
94
|
+
scope: "colgroup",
|
|
95
|
+
colSpan,
|
|
96
|
+
role: "columnheader",
|
|
97
|
+
"aria-label": ariaLabel,
|
|
98
|
+
"data-component": "Table.Group.Header",
|
|
99
|
+
children: t12
|
|
100
|
+
}) });
|
|
101
|
+
$[19] = ariaLabel;
|
|
102
|
+
$[20] = colSpan;
|
|
103
|
+
$[21] = headerId;
|
|
104
|
+
$[22] = t12;
|
|
105
|
+
$[23] = t13;
|
|
106
|
+
} else t13 = $[23];
|
|
107
|
+
let t14;
|
|
108
|
+
if ($[24] !== id || $[25] !== t13 || $[26] !== t2) {
|
|
109
|
+
t14 = /*#__PURE__*/ jsx("tbody", {
|
|
110
|
+
className: t2,
|
|
111
|
+
role: "rowgroup",
|
|
112
|
+
"data-component": "Table.Group",
|
|
113
|
+
"data-group-id": id,
|
|
114
|
+
children: t13
|
|
115
|
+
});
|
|
116
|
+
$[24] = id;
|
|
117
|
+
$[25] = t13;
|
|
118
|
+
$[26] = t2;
|
|
119
|
+
$[27] = t14;
|
|
120
|
+
} else t14 = $[27];
|
|
121
|
+
let t15;
|
|
122
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
+
t15 = clsx("TableBody", Table_module_css_default.TableBody);
|
|
124
|
+
$[28] = t15;
|
|
125
|
+
} else t15 = $[28];
|
|
126
|
+
let t16;
|
|
127
|
+
if ($[29] !== children || $[30] !== contextValue) {
|
|
128
|
+
t16 = /*#__PURE__*/ jsx(TableGroupContext.Provider, {
|
|
129
|
+
value: contextValue,
|
|
130
|
+
children
|
|
131
|
+
});
|
|
132
|
+
$[29] = children;
|
|
133
|
+
$[30] = contextValue;
|
|
134
|
+
$[31] = t16;
|
|
135
|
+
} else t16 = $[31];
|
|
136
|
+
let t17;
|
|
137
|
+
if ($[32] !== id || $[33] !== t16) {
|
|
138
|
+
t17 = /*#__PURE__*/ jsx("tbody", {
|
|
139
|
+
className: t15,
|
|
140
|
+
role: "rowgroup",
|
|
141
|
+
"data-component": "Table.Group.Body",
|
|
142
|
+
"data-group-id": id,
|
|
143
|
+
children: t16
|
|
144
|
+
});
|
|
145
|
+
$[32] = id;
|
|
146
|
+
$[33] = t16;
|
|
147
|
+
$[34] = t17;
|
|
148
|
+
} else t17 = $[34];
|
|
149
|
+
let t18;
|
|
150
|
+
if ($[35] !== t14 || $[36] !== t17) {
|
|
151
|
+
t18 = /*#__PURE__*/ jsxs(Fragment$1, { children: [t14, t17] });
|
|
152
|
+
$[35] = t14;
|
|
153
|
+
$[36] = t17;
|
|
154
|
+
$[37] = t18;
|
|
155
|
+
} else t18 = $[37];
|
|
156
|
+
return t18;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
export { TableGroup };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SlotMarker } from "../utils/types/Slots.js";
|
|
2
2
|
import { ObjectPaths } from "./utils.js";
|
|
3
|
-
import { UniqueRow } from "./row.js";
|
|
3
|
+
import { DataTableData, DataTableRowGroup, UniqueRow } from "./row.js";
|
|
4
4
|
import { CellAlignment, Column, ColumnWidth, createColumnHelper } from "./column.js";
|
|
5
5
|
import { DataTable, DataTableProps } from "./DataTable.js";
|
|
6
6
|
import { ErrorDialog } from "./ErrorDialog.js";
|
|
7
7
|
import { Table as Table$1, TableActions, TableActionsProps, TableBody, TableBodyProps, TableCell, TableCellPlaceholder, TableCellProps, TableContainer, TableContainerProps, TableDivider, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, TableSkeleton, TableSkeletonProps, TableSubtitle, TableSubtitleProps, TableTitle, TableTitleProps } from "./Table.js";
|
|
8
|
+
import { TableGroup, TableGroupProps } from "./TableGroup.js";
|
|
8
9
|
import { Pagination } from "./Pagination.js";
|
|
9
10
|
|
|
10
11
|
//#region src/DataTable/index.d.ts
|
|
@@ -17,6 +18,7 @@ declare const Table: typeof Table$1 & SlotMarker & {
|
|
|
17
18
|
Skeleton: typeof TableSkeleton;
|
|
18
19
|
Head: typeof TableHead;
|
|
19
20
|
Body: typeof TableBody;
|
|
21
|
+
Group: typeof TableGroup;
|
|
20
22
|
Header: typeof TableHeader;
|
|
21
23
|
Row: typeof TableRow;
|
|
22
24
|
Cell: typeof TableCell;
|
|
@@ -25,4 +27,4 @@ declare const Table: typeof Table$1 & SlotMarker & {
|
|
|
25
27
|
ErrorDialog: typeof ErrorDialog;
|
|
26
28
|
};
|
|
27
29
|
//#endregion
|
|
28
|
-
export { type CellAlignment, type Column, type ColumnWidth, DataTable, type DataTableProps, type ObjectPaths, Table, type TableActionsProps, type TableBodyProps, type TableCellProps, type TableContainerProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TableSubtitleProps, type TableTitleProps, type UniqueRow, createColumnHelper };
|
|
30
|
+
export { type CellAlignment, type Column, type ColumnWidth, DataTable, type DataTableData, type DataTableProps, type DataTableRowGroup, type ObjectPaths, Table, type TableActionsProps, type TableBodyProps, type TableCellProps, type TableContainerProps, type TableGroupProps, type TableHeadProps, type TableHeaderProps, type TableProps, type TableRowProps, type TableSubtitleProps, type TableTitleProps, type UniqueRow, createColumnHelper };
|
package/dist/DataTable/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Table as Table$1, TableActions, TableBody, TableCell, TableCellPlaceholder, TableContainer, TableDivider, TableHead, TableHeader, TableRow, TableSkeleton, TableSubtitle, TableTitle } from "./Table.js";
|
|
2
|
+
import { TableGroup } from "./TableGroup.js";
|
|
2
3
|
import { DataTable } from "./DataTable.js";
|
|
3
4
|
import { ErrorDialog } from "./ErrorDialog.js";
|
|
4
5
|
import { Pagination } from "./Pagination.js";
|
|
@@ -13,6 +14,7 @@ const Table = Object.assign(Table$1, {
|
|
|
13
14
|
Skeleton: TableSkeleton,
|
|
14
15
|
Head: TableHead,
|
|
15
16
|
Body: TableBody,
|
|
17
|
+
Group: TableGroup,
|
|
16
18
|
Header: TableHeader,
|
|
17
19
|
Row: TableRow,
|
|
18
20
|
Cell: TableCell,
|
package/dist/DataTable/row.d.ts
CHANGED
|
@@ -2,5 +2,28 @@
|
|
|
2
2
|
interface UniqueRow {
|
|
3
3
|
id: string | number;
|
|
4
4
|
}
|
|
5
|
+
interface DataTableRowGroup<Data extends UniqueRow> {
|
|
6
|
+
/**
|
|
7
|
+
* Provide a stable identifier for the group.
|
|
8
|
+
*/
|
|
9
|
+
groupId: string | number;
|
|
10
|
+
/**
|
|
11
|
+
* Provide a visible label for the group.
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Provide the rows that belong to the group.
|
|
16
|
+
*/
|
|
17
|
+
rows: Array<Data>;
|
|
18
|
+
/**
|
|
19
|
+
* Provide an accessible name for the group header.
|
|
20
|
+
*/
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Items with both `groupId` and an array-valued `rows` are treated as groups.
|
|
25
|
+
* This combination is reserved and must not be used for standalone row data.
|
|
26
|
+
*/
|
|
27
|
+
type DataTableData<Data extends UniqueRow> = Array<Data | DataTableRowGroup<Data>>;
|
|
5
28
|
//#endregion
|
|
6
|
-
export { UniqueRow };
|
|
29
|
+
export { DataTableData, DataTableRowGroup, UniqueRow };
|