@primer/react 38.44.1-rc.f98981f35 → 38.45.0-rc.72a855661
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 +11 -1
- package/dist/ActionMenu/ActionMenu.js +12 -8
- package/dist/DataTable/DataTable.d.ts +11 -2
- package/dist/DataTable/DataTable.js +148 -61
- package/dist/DataTable/Table-7f0e985b.css +2 -0
- package/dist/DataTable/{Table-0327e248.css.map → Table-7f0e985b.css.map} +1 -1
- package/dist/DataTable/Table.d.ts +1 -0
- package/dist/DataTable/Table.js +18 -13
- package/dist/DataTable/Table.module.css.js +1 -1
- package/dist/DataTable/TableBulkActions-aca5618a.css +2 -0
- package/dist/DataTable/TableBulkActions-aca5618a.css.map +1 -0
- package/dist/DataTable/TableBulkActions.d.ts +15 -0
- package/dist/DataTable/TableBulkActions.js +217 -0
- package/dist/DataTable/TableBulkActions.module.css.js +12 -0
- package/dist/DataTable/index.d.ts +4 -2
- package/dist/DataTable/index.js +2 -0
- package/dist/DataTable/useTable.js +46 -36
- package/dist/experimental/index.d.ts +3 -2
- package/dist/utils/descendant-registry.d.ts +1 -1
- package/dist/utils/descendant-registry.js +94 -76
- package/generated/components.json +51 -0
- package/package.json +2 -2
- package/dist/DataTable/Table-0327e248.css +0 -2
|
@@ -2771,6 +2771,10 @@
|
|
|
2771
2771
|
"id": "experimental-components-datatable-features--with-row-selection",
|
|
2772
2772
|
"code": "() => {\n const [selectedRows, setSelectedRows] = React.useState<\n ReadonlySet<DataTableRowId>\n >(() => new Set([2]))\n return (\n <Table.Container>\n <Table.Title as=\"h2\" id=\"selectable-repositories\">\n Selectable repositories\n </Table.Title>\n <DataTable\n aria-labelledby=\"selectable-repositories\"\n data={data}\n columns={groupedColumns}\n rowSelection\n selectedRows={selectedRows}\n onSelectionChange={({ selectedRows: nextSelectedRows }) => {\n setSelectedRows(nextSelectedRows)\n }}\n />\n </Table.Container>\n )\n}"
|
|
2773
2773
|
},
|
|
2774
|
+
{
|
|
2775
|
+
"id": "experimental-components-datatable-features--with-bulk-actions",
|
|
2776
|
+
"code": "() => {\n const repositories = [\n {\n id: 1,\n name: 'primer/react',\n visibility: 'Public',\n },\n {\n id: 2,\n name: 'primer/css',\n visibility: 'Public',\n },\n {\n id: 3,\n name: 'github/github',\n visibility: 'Internal',\n },\n ]\n const titleId = React.useId()\n const [rows, setRows] = React.useState(repositories)\n const [selectedRows, setSelectedRows] = React.useState<\n ReadonlySet<DataTableRowId>\n >(() => new Set([1]))\n const resetButtonRef = React.useRef<HTMLButtonElement>(null)\n return (\n <Table.Container>\n <Table.Title id={titleId}>Repositories</Table.Title>\n <Table.Actions>\n <Button\n ref={resetButtonRef}\n onClick={() => {\n setRows(repositories)\n setSelectedRows(new Set())\n }}\n >\n Reset repositories\n </Button>\n </Table.Actions>\n <DataTable\n aria-labelledby={titleId}\n data={[\n ...rows.filter((row) => row.visibility === 'Internal'),\n {\n groupId: 'public',\n label: 'Public',\n rows: rows.filter((row) => row.visibility === 'Public'),\n },\n ]}\n columns={[\n {\n header: 'Repository',\n field: 'name',\n rowHeader: true,\n sortBy: 'alphanumeric',\n },\n {\n header: 'Visibility',\n field: 'visibility',\n },\n ]}\n rowSelection\n selectedRows={selectedRows}\n onSelectionChange={({ selectedRows: next }) => setSelectedRows(next)}\n bulkActionsReturnFocusRef={\n rows.length === 0 ? resetButtonRef : undefined\n }\n collapsibleGroups\n renderBulkActions={({ selectedRows: effectiveIds, clearSelection }) => (\n <>\n <Button\n size=\"small\"\n onClick={() => {\n setRows((current) =>\n current.map((row) =>\n effectiveIds.has(row.id)\n ? {\n ...row,\n visibility: 'Internal',\n }\n : row,\n ),\n )\n clearSelection()\n }}\n >\n Make internal\n </Button>\n <Button\n size=\"small\"\n variant=\"danger\"\n onClick={() => {\n setRows((current) =>\n current.filter((row) => !effectiveIds.has(row.id)),\n )\n clearSelection()\n }}\n >\n Delete selected\n </Button>\n </>\n )}\n />\n </Table.Container>\n )\n}"
|
|
2777
|
+
},
|
|
2774
2778
|
{
|
|
2775
2779
|
"id": "experimental-components-datatable-features--with-grouped-row-selection",
|
|
2776
2780
|
"code": "() => {\n const [selectedRows, setSelectedRows] = React.useState<\n ReadonlySet<DataTableRowId>\n >(() => new Set())\n return (\n <Table.Container>\n <Table.Title as=\"h2\" id=\"selectable-repositories-by-visibility\">\n Selectable repositories by visibility\n </Table.Title>\n <DataTable\n aria-labelledby=\"selectable-repositories-by-visibility\"\n data={repoGroupsWithDisabledRow}\n columns={groupedColumns}\n rowSelection\n selectedRows={selectedRows}\n isRowSelectable={(repo) => repo.id !== 1}\n onSelectionChange={({ selectedRows: nextSelectedRows }) => {\n setSelectedRows(nextSelectedRows)\n }}\n />\n </Table.Container>\n )\n}"
|
|
@@ -2873,6 +2877,21 @@
|
|
|
2873
2877
|
"type": "({ expandedGroups }: { expandedGroups: Set<DataTableRowId> }) => void",
|
|
2874
2878
|
"description": "Receive a new expansion set on a disclosure request. Sorting and data replacement do not emit this callback or clear stored IDs."
|
|
2875
2879
|
},
|
|
2880
|
+
{
|
|
2881
|
+
"name": "renderBulkActions",
|
|
2882
|
+
"type": "(context: DataTableBulkActionsContext) => React.ReactNode",
|
|
2883
|
+
"description": "Render actions in place of visible column labels when rowSelection is enabled and selectable rows are selected. Receives selectedRows IDs, selectedCount, and clearSelection, excluding missing and non-selectable rows."
|
|
2884
|
+
},
|
|
2885
|
+
{
|
|
2886
|
+
"name": "bulkActionsProps",
|
|
2887
|
+
"type": "Pick<TableBulkActionsProps, 'aria-label' | 'getSelectedCountLabel'>",
|
|
2888
|
+
"description": "Localize the bulk-action group name and selected-count announcement (including zero)."
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
"name": "bulkActionsReturnFocusRef",
|
|
2892
|
+
"type": "React.RefObject<HTMLElement | null>",
|
|
2893
|
+
"description": "Override focus recovery when a focused action disappears. Defaults to select-all, or the table when no selectable rows remain. Does not override focus already moved by the consumer."
|
|
2894
|
+
},
|
|
2876
2895
|
{
|
|
2877
2896
|
"name": "cellPadding",
|
|
2878
2897
|
"type": "'condensed' | 'normal' | 'spacious'",
|
|
@@ -2922,6 +2941,38 @@
|
|
|
2922
2941
|
}
|
|
2923
2942
|
],
|
|
2924
2943
|
"subcomponents": [
|
|
2944
|
+
{
|
|
2945
|
+
"name": "Table.BulkActions",
|
|
2946
|
+
"props": [
|
|
2947
|
+
{
|
|
2948
|
+
"name": "selectedCount",
|
|
2949
|
+
"type": "number",
|
|
2950
|
+
"required": true,
|
|
2951
|
+
"description": "The effectively selected row count. Keep the component mounted at zero so count announcements and focus recovery can complete."
|
|
2952
|
+
},
|
|
2953
|
+
{
|
|
2954
|
+
"name": "onFocusReturn",
|
|
2955
|
+
"type": "() => void",
|
|
2956
|
+
"description": "Choose the recovery destination when a focused action disappears and focus has not moved elsewhere."
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
"name": "getSelectedCountLabel",
|
|
2960
|
+
"type": "(selectedCount: number) => string",
|
|
2961
|
+
"description": "Localize the visible and announced selected count, including zero."
|
|
2962
|
+
},
|
|
2963
|
+
{
|
|
2964
|
+
"name": "aria-label",
|
|
2965
|
+
"type": "string",
|
|
2966
|
+
"defaultValue": "'Bulk actions'",
|
|
2967
|
+
"description": "Name the action group."
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
"name": "children",
|
|
2971
|
+
"type": "React.ReactNode",
|
|
2972
|
+
"description": "Consumer-owned action elements in native Tab order, rendered only when selectedCount is positive."
|
|
2973
|
+
}
|
|
2974
|
+
]
|
|
2975
|
+
},
|
|
2925
2976
|
{
|
|
2926
2977
|
"name": "Table",
|
|
2927
2978
|
"props": [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "38.
|
|
4
|
+
"version": "38.45.0-rc.72a855661",
|
|
5
5
|
"description": "An implementation of GitHub's Primer Design System using React",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"mdast-util-to-string": "4.0.0",
|
|
157
157
|
"micromark-extension-frontmatter": "2.0.0",
|
|
158
158
|
"micromark-extension-mdxjs": "3.0.0",
|
|
159
|
-
"oxc-transform-react": "^0.
|
|
159
|
+
"oxc-transform-react": "^0.155.0",
|
|
160
160
|
"postcss-preset-primer": "^0.0.0",
|
|
161
161
|
"publint": "^0.3.15",
|
|
162
162
|
"react": "18.3.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
.prc-DataTable-TableContainer-hn0p3{column-gap:var(--base-size-8,.5rem);display:grid;grid-template-areas:"title actions" "divider divider" "subtitle subtitle" "filter filter" "table table" "footer footer";grid-template-columns:1fr 1fr}.prc-DataTable-TableTitle-nM43N{align-self:center;font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600);grid-area:title;line-height:20px}.prc-DataTable-TableSubtitle--L6Ho,.prc-DataTable-TableTitle-nM43N{color:var(--fgColor-default,#1f2328);margin:0}.prc-DataTable-TableSubtitle--L6Ho{font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-normal,400);grid-area:subtitle;line-height:var(--text-title-lineHeight-small,1.5)}.prc-DataTable-TableActions-fkc2b{align-items:center;column-gap:var(--base-size-8,.5rem);display:flex;grid-area:actions;justify-self:end}.prc-DataTable-TableDivider-TRc3b{background-color:var(--borderColor-default,#d1d9e0);grid-area:divider;height:1px;margin-block-end:var(--base-size-8,.5rem);margin-block-start:var(--base-size-16,1rem);width:100%}.prc-DataTable-TableActions-fkc2b+.prc-DataTable-TableOverflowWrapper-bSqT-,.prc-DataTable-TableSubtitle--L6Ho+.prc-DataTable-TableOverflowWrapper-bSqT-,.prc-DataTable-TableTitle-nM43N+.prc-DataTable-TableOverflowWrapper-bSqT-{margin-block-start:var(--base-size-8,.5rem)}.prc-DataTable-Table-7ux1n,.prc-DataTable-TableOverflowWrapper-bSqT-{grid-area:table}.prc-DataTable-Table-7ux1n{--table-border-radius:0.375rem;--table-cell-padding:var(--cell-padding-block,0.5rem) var(--cell-padding-inline,0.75rem);--table-font-size:0.75rem;background-color:var(--bgColor-default,#fff);border-collapse:separate;border-spacing:0;display:grid;font-size:var(--table-font-size);grid-template-columns:var(--grid-template-columns);line-height:1.66667;width:100%}.prc-DataTable-Table-7ux1n:where([data-cell-padding=condensed]){--cell-padding-block:0.25rem;--cell-padding-inline:0.5rem}.prc-DataTable-Table-7ux1n:where([data-cell-padding=normal]){--cell-padding-block:0.5rem;--cell-padding-inline:0.75rem}.prc-DataTable-Table-7ux1n:where([data-cell-padding=spacious]){--cell-padding-block:0.75rem;--cell-padding-inline:1rem}.prc-DataTable-TableCell-Fk4ve:first-child,.prc-DataTable-TableHeader-eyTab:first-child{border-inline-start:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0)}.prc-DataTable-TableCell-Fk4ve:last-child,.prc-DataTable-TableHeader-eyTab:last-child{border-inline-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0)}.prc-DataTable-TableCell-Fk4ve,.prc-DataTable-TableHeader-eyTab{align-items:center;border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);display:flex;padding:var(--table-cell-padding);text-align:start}.prc-DataTable-TableCell-Fk4ve:where([data-cell-align=end]),.prc-DataTable-TableHeader-eyTab:where([data-cell-align=end]){display:flex;justify-content:flex-end;text-align:end}.prc-DataTable-TableHeader-eyTab[data-cell-align=end] .prc-DataTable-TableSortButton--aq0y{display:flex;flex-direction:row-reverse}.prc-DataTable-TableHead-4FaBf .prc-DataTable-TableRow-Icc7F:first-of-type .prc-DataTable-TableHeader-eyTab{border-block-start:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0)}.prc-DataTable-TableHead-4FaBf .prc-DataTable-TableRow-Icc7F:first-of-type .prc-DataTable-TableHeader-eyTab:first-child{border-top-left-radius:var(--table-border-radius)}.prc-DataTable-TableHead-4FaBf .prc-DataTable-TableRow-Icc7F:first-of-type .prc-DataTable-TableHeader-eyTab:last-child{border-top-right-radius:var(--table-border-radius)}.prc-DataTable-TableOverflowWrapper-bSqT-:last-child .prc-DataTable-Table-7ux1n .prc-DataTable-TableBody-QKQy2:last-of-type .prc-DataTable-TableRow-Icc7F:last-of-type .prc-DataTable-TableCell-Fk4ve:first-child{border-bottom-left-radius:var(--table-border-radius)}.prc-DataTable-TableOverflowWrapper-bSqT-:last-child .prc-DataTable-Table-7ux1n .prc-DataTable-TableBody-QKQy2:last-of-type .prc-DataTable-TableRow-Icc7F:last-of-type .prc-DataTable-TableCell-Fk4ve:last-child{border-bottom-right-radius:var(--table-border-radius)}.prc-DataTable-TableOverflowWrapper-bSqT-:last-child .prc-DataTable-TableGroupHeaderBody-K-YqR:where(:has(+.prc-DataTable-TableBody-QKQy2[hidden]:last-child)) .prc-DataTable-TableGroupHeaderCell-vnb30{border-bottom-left-radius:var(--table-border-radius);border-bottom-right-radius:var(--table-border-radius)}.prc-DataTable-TableRow-Icc7F>:first-child .prc-DataTable-TableCellSkeletonItem-bGhwZ,.prc-DataTable-TableRow-Icc7F>:first-child:not(.prc-DataTable-TableCellSkeleton-DMdM5){padding-inline-start:var(--base-size-16,1rem)}.prc-DataTable-TableRow-Icc7F>:last-child .prc-DataTable-TableCellSkeletonItem-bGhwZ,.prc-DataTable-TableRow-Icc7F>:last-child:not(.prc-DataTable-TableCellSkeleton-DMdM5){padding-inline-end:var(--base-size-16,1rem)}.prc-DataTable-TableHeader-eyTab{background-color:var(--bgColor-muted,#f6f8fa);border-block-start:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);color:var(--fgColor-muted,#59636e);font-weight:var(--base-text-weight-semibold,600)}.prc-DataTable-TableHeader-eyTab:where([aria-sort=ascending]),.prc-DataTable-TableHeader-eyTab:where([aria-sort=descending]){color:var(--fgColor-default,#1f2328)}.prc-DataTable-TableRowSelection-HwyDU,.prc-DataTable-TableSelectionHeader-Op0cK{justify-content:center}.prc-DataTable-TableSortIcon-wHvJw{visibility:hidden}.prc-DataTable-TableHeader-eyTab .prc-DataTable-TableSortButton--aq0y:focus .prc-DataTable-TableSortIcon--ascending-Lpx6z,.prc-DataTable-TableHeader-eyTab:hover .prc-DataTable-TableSortIcon--ascending-Lpx6z,.prc-DataTable-TableHeader-eyTab[aria-sort=ascending] .prc-DataTable-TableSortIcon--ascending-Lpx6z,.prc-DataTable-TableHeader-eyTab[aria-sort=descending] .prc-DataTable-TableSortIcon--descending-hHJGo{visibility:visible}.prc-DataTable-TableRow-Icc7F:hover .prc-DataTable-TableCell-Fk4ve:not(.prc-DataTable-TableCellSkeleton-DMdM5){background-color:var(--control-transparent-bgColor-hover,#818b981a)}.prc-DataTable-TableCell-Fk4ve:where([scope=row]){align-items:center;color:var(--fgColor-default,#1f2328);display:flex;font-weight:var(--base-text-weight-semibold,600)}.prc-DataTable-TableCellSkeleton-DMdM5{padding:0}.prc-DataTable-TableCellSkeletonItems-Ljhq5{display:flex;flex-direction:column;width:100%}.prc-DataTable-TableCellSkeletonItem-bGhwZ{padding:var(--table-cell-padding)}.prc-DataTable-TableCellSkeletonItem-bGhwZ:nth-of-type(5n+1){--skeleton-item-width:85%}.prc-DataTable-TableCellSkeletonItem-bGhwZ:nth-of-type(5n+2){--skeleton-item-width:67.5%}.prc-DataTable-TableCellSkeletonItem-bGhwZ:nth-of-type(5n+3){--skeleton-item-width:80%}.prc-DataTable-TableCellSkeletonItem-bGhwZ:nth-of-type(5n+4){--skeleton-item-width:60%}.prc-DataTable-TableCellSkeletonItem-bGhwZ:nth-of-type(5n+5){--skeleton-item-width:75%}.prc-DataTable-TableCellSkeletonItem-bGhwZ [data-component=SkeletonText]{width:var(--skeleton-item-width)}.prc-DataTable-TableCellSkeletonItem-bGhwZ:not(:last-of-type){border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0)}.prc-DataTable-TableSortButton--aq0y{column-gap:.5rem}.prc-DataTable-TableBody-QKQy2,.prc-DataTable-TableGroupHeaderBody-K-YqR,.prc-DataTable-TableHead-4FaBf,.prc-DataTable-TableRow-Icc7F{display:contents}@supports (grid-template-columns:subgrid){.prc-DataTable-TableBody-QKQy2,.prc-DataTable-TableGroupHeaderBody-K-YqR,.prc-DataTable-TableHead-4FaBf,.prc-DataTable-TableRow-Icc7F{display:grid;grid-column:-1/1;grid-template-columns:subgrid}}.prc-DataTable-TableGroupHeaderCell-vnb30{align-items:center;background-color:var(--bgColor-muted,#f6f8fa);border-block-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);border-inline-end:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);border-inline-start:var(--borderWidth-thin,.0625rem) solid var(--borderColor-default,#d1d9e0);color:var(--fgColor-muted,#59636e);column-gap:calc(var(--cell-padding-inline)*2);display:flex;grid-column:1/-1;padding:var(--table-cell-padding);text-align:start}.prc-DataTable-TableGroupHeaderContent-H9FbA{align-items:baseline;column-gap:var(--base-size-8,.5rem);display:flex}.prc-DataTable-TableGroupHeaderLabel--c-od{color:var(--fgColor-default,#1f2328);font-weight:var(--base-text-weight-semibold,600)}.prc-DataTable-TableGroupHeaderCount-6r8Pj{color:var(--fgColor-muted,#59636e)}.prc-DataTable-TableBody-QKQy2:where([hidden]){display:none}.prc-DataTable-TableGroupToggle-9OwNG{align-items:center;align-self:center;border-radius:var(--borderRadius-small,.1875rem);color:var(--fgColor-default,#1f2328);display:inline-flex;flex-shrink:0;height:var(--base-size-24,1.5rem);justify-content:center;margin-inline:calc((var(--base-size-16,1rem) - var(--base-size-24,1.5rem))/2);width:var(--base-size-24,1.5rem)}.prc-DataTable-TableGroupToggle-9OwNG:hover{background-color:var(--bgColor-neutral-muted,#818b981f)}.prc-DataTable-TableGroupToggle-9OwNG:where([aria-expanded=true]) svg{transform:rotate(90deg)}.prc-DataTable-PlaceholderText-8bHo7{color:var(--fgColor-muted,#59636e)}
|
|
2
|
-
/*# sourceMappingURL=Table-0327e248.css.map */
|