@moneyforward/mfui-components 3.6.0 → 3.8.0
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/dist/src/DataGrid/index.d.ts +16 -8
- package/dist/src/DataGrid/index.js +9 -1
- package/dist/src/{DataGrid/DataGrid.d.ts → DataTable/DataTable.d.ts} +94 -82
- package/dist/src/{DataGrid/DataGrid.js → DataTable/DataTable.js} +120 -97
- package/dist/src/{DataGrid/DataGrid.types.d.ts → DataTable/DataTable.types.d.ts} +11 -11
- package/dist/src/DataTable/DataTableBody/DataTableBody.d.ts +1 -0
- package/dist/src/DataTable/DataTableBody/DataTableBody.js +19 -0
- package/dist/src/{DataGrid/DataGridBody/DataGridBody.types.d.ts → DataTable/DataTableBody/DataTableBody.types.d.ts} +2 -2
- package/dist/src/DataTable/DataTableBody/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableBody/index.js +1 -0
- package/dist/src/DataTable/DataTableCell/DataTableCell.d.ts +2 -0
- package/dist/src/{DataGrid/DataGridCell/DataGridCell.js → DataTable/DataTableCell/DataTableCell.js} +20 -13
- package/dist/src/{DataGrid/DataGridCell/DataGridCell.types.d.ts → DataTable/DataTableCell/DataTableCell.types.d.ts} +8 -8
- package/dist/src/DataTable/DataTableCell/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableCell/index.js +1 -0
- package/dist/src/DataTable/DataTableHeader/DataTableHeader.d.ts +1 -0
- package/dist/src/DataTable/DataTableHeader/DataTableHeader.js +12 -0
- package/dist/src/{DataGrid/DataGridHeader/DataGridHeader.types.d.ts → DataTable/DataTableHeader/DataTableHeader.types.d.ts} +2 -2
- package/dist/src/DataTable/DataTableHeader/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeader/index.js +1 -0
- package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderCell/DataTableHeaderCell.js +58 -0
- package/dist/src/{DataGrid/DataGridHeaderCell/DataGridHeaderCell.types.d.ts → DataTable/DataTableHeaderCell/DataTableHeaderCell.types.d.ts} +6 -6
- package/dist/src/DataTable/DataTableHeaderCell/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderCell/index.js +1 -0
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderRow/DataTableHeaderRow.js +31 -0
- package/dist/src/{DataGrid/DataGridHeaderRow/DataGridHeaderRow.types.d.ts → DataTable/DataTableHeaderRow/DataTableHeaderRow.types.d.ts} +3 -3
- package/dist/src/DataTable/DataTableHeaderRow/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableHeaderRow/index.js +1 -0
- package/dist/src/DataTable/DataTableProvider.d.ts +27 -0
- package/dist/src/{DataGrid/DataGridProvider.js → DataTable/DataTableProvider.js} +9 -9
- package/dist/src/DataTable/DataTableRow/DataTableRow.d.ts +2 -0
- package/dist/src/{DataGrid/DataGridRow/DataGridRow.js → DataTable/DataTableRow/DataTableRow.js} +11 -10
- package/dist/src/{DataGrid/DataGridRow/DataGridRow.types.d.ts → DataTable/DataTableRow/DataTableRow.types.d.ts} +5 -5
- package/dist/src/DataTable/DataTableRow/index.d.ts +2 -0
- package/dist/src/DataTable/DataTableRow/index.js +1 -0
- package/dist/src/DataTable/index.d.ts +8 -0
- package/dist/src/DataTable/index.js +1 -0
- package/dist/src/MainNavigation/BaseMainNavigation.js +25 -10
- package/dist/src/MainNavigation/MainNavigation.types.d.ts +49 -1
- package/dist/src/MainNavigation/NarrowViewportMainNavigation.js +17 -2
- package/dist/src/StatusLabel/StatusLabel.d.ts +1 -0
- package/dist/src/StatusLabel/StatusLabel.js +2 -2
- package/dist/src/StatusLabel/StatusLabel.types.d.ts +6 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/utilities/dom/useFixedColumns.d.ts +1 -1
- package/dist/src/utilities/dom/useFixedColumns.js +1 -1
- package/dist/src/utilities/react/isComponentOrWrapped.d.ts +7 -7
- package/dist/src/utilities/react/isComponentOrWrapped.js +7 -7
- package/dist/styled-system/jsx/is-valid-prop.js +1 -1
- package/dist/styled-system/patterns/divider.d.ts +1 -1
- package/dist/styled-system/patterns/float.d.ts +1 -1
- package/dist/styled-system/recipes/base-main-navigation-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/base-main-navigation-slot-recipe.js +12 -0
- package/dist/styled-system/recipes/data-table-body-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-body-slot-recipe.js +28 -0
- package/dist/styled-system/recipes/data-table-cell-slot-recipe.d.ts +38 -0
- package/dist/styled-system/recipes/data-table-cell-slot-recipe.js +77 -0
- package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.d.ts +37 -0
- package/dist/styled-system/recipes/data-table-header-cell-slot-recipe.js +73 -0
- package/dist/styled-system/recipes/data-table-header-row-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-header-row-slot-recipe.js +28 -0
- package/dist/styled-system/recipes/data-table-header-slot-recipe.d.ts +33 -0
- package/dist/styled-system/recipes/data-table-header-slot-recipe.js +35 -0
- package/dist/styled-system/recipes/data-table-row-slot-recipe.d.ts +36 -0
- package/dist/styled-system/recipes/{data-grid-row-slot-recipe.js → data-table-row-slot-recipe.js} +13 -13
- package/dist/styled-system/recipes/data-table-slot-recipe.d.ts +36 -0
- package/dist/styled-system/recipes/data-table-slot-recipe.js +45 -0
- package/dist/styled-system/recipes/index.d.ts +7 -7
- package/dist/styled-system/recipes/index.js +7 -7
- package/dist/styled-system/recipes/narrow-viewport-main-navigation-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/narrow-viewport-main-navigation-slot-recipe.js +12 -0
- package/dist/styled-system/recipes/status-label-slot-recipe.d.ts +4 -0
- package/dist/styled-system/recipes/status-label-slot-recipe.js +9 -1
- package/dist/styled-system/tokens/index.js +117 -117
- package/dist/styled-system/tokens/tokens.d.ts +2 -2
- package/dist/styled-system/types/csstype.d.ts +6405 -5133
- package/dist/styled-system/types/style-props.d.ts +2748 -2163
- package/dist/styled-system/types/system-types.d.ts +14 -132
- package/dist/styles.css +222 -515
- package/dist/theme-orange.css +3 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/dist/src/DataGrid/DataGridBody/DataGridBody.d.ts +0 -1
- package/dist/src/DataGrid/DataGridBody/DataGridBody.js +0 -17
- package/dist/src/DataGrid/DataGridBody/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridBody/index.js +0 -1
- package/dist/src/DataGrid/DataGridCell/DataGridCell.d.ts +0 -2
- package/dist/src/DataGrid/DataGridCell/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridCell/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeader/DataGridHeader.d.ts +0 -1
- package/dist/src/DataGrid/DataGridHeader/DataGridHeader.js +0 -11
- package/dist/src/DataGrid/DataGridHeader/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeader/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeaderCell/DataGridHeaderCell.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderCell/DataGridHeaderCell.js +0 -50
- package/dist/src/DataGrid/DataGridHeaderCell/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderCell/index.js +0 -1
- package/dist/src/DataGrid/DataGridHeaderRow/DataGridHeaderRow.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderRow/DataGridHeaderRow.js +0 -30
- package/dist/src/DataGrid/DataGridHeaderRow/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridHeaderRow/index.js +0 -1
- package/dist/src/DataGrid/DataGridProvider.d.ts +0 -27
- package/dist/src/DataGrid/DataGridRow/DataGridRow.d.ts +0 -2
- package/dist/src/DataGrid/DataGridRow/index.d.ts +0 -2
- package/dist/src/DataGrid/DataGridRow/index.js +0 -1
- package/dist/styled-system/recipes/data-grid-body-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-body-slot-recipe.js +0 -28
- package/dist/styled-system/recipes/data-grid-cell-slot-recipe.d.ts +0 -38
- package/dist/styled-system/recipes/data-grid-cell-slot-recipe.js +0 -77
- package/dist/styled-system/recipes/data-grid-header-cell-slot-recipe.d.ts +0 -37
- package/dist/styled-system/recipes/data-grid-header-cell-slot-recipe.js +0 -73
- package/dist/styled-system/recipes/data-grid-header-row-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-header-row-slot-recipe.js +0 -28
- package/dist/styled-system/recipes/data-grid-header-slot-recipe.d.ts +0 -33
- package/dist/styled-system/recipes/data-grid-header-slot-recipe.js +0 -35
- package/dist/styled-system/recipes/data-grid-row-slot-recipe.d.ts +0 -36
- package/dist/styled-system/recipes/data-grid-slot-recipe.d.ts +0 -36
- package/dist/styled-system/recipes/data-grid-slot-recipe.js +0 -45
- /package/dist/src/{DataGrid/DataGrid.types.js → DataTable/DataTable.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridBody/DataGridBody.types.js → DataTable/DataTableBody/DataTableBody.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridCell/DataGridCell.types.js → DataTable/DataTableCell/DataTableCell.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeader/DataGridHeader.types.js → DataTable/DataTableHeader/DataTableHeader.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeaderCell/DataGridHeaderCell.types.js → DataTable/DataTableHeaderCell/DataTableHeaderCell.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridHeaderRow/DataGridHeaderRow.types.js → DataTable/DataTableHeaderRow/DataTableHeaderRow.types.js} +0 -0
- /package/dist/src/{DataGrid/DataGridRow/DataGridRow.types.js → DataTable/DataTableRow/DataTableRow.types.js} +0 -0
- /package/dist/src/{DataGrid → DataTable}/utils/handleCheckbox.d.ts +0 -0
- /package/dist/src/{DataGrid → DataTable}/utils/handleCheckbox.js +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { type CellDataType } from '../
|
|
2
|
+
import { type CellDataType } from '../DataTable.types';
|
|
3
3
|
/**
|
|
4
|
-
* The props for the `
|
|
4
|
+
* The props for the `DataTableCell` component.
|
|
5
5
|
*
|
|
6
6
|
* It extends the general attributes of `td` element.
|
|
7
7
|
*
|
|
8
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type DataTableCellProps = {
|
|
11
11
|
/**
|
|
12
12
|
* The type of the cell data.
|
|
13
13
|
* Used for determining how to align the cell content.
|
|
@@ -20,10 +20,10 @@ export type DataGridCellProps = {
|
|
|
20
20
|
* @example
|
|
21
21
|
* ```tsx
|
|
22
22
|
* // For standard text columns
|
|
23
|
-
* <
|
|
23
|
+
* <DataTable.Cell>John Doe</DataTable.Cell>
|
|
24
24
|
*
|
|
25
25
|
* // For amount/balance columns
|
|
26
|
-
* <
|
|
26
|
+
* <DataTable.Cell type="amount">¥125,000</DataTable.Cell>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
type?: CellDataType;
|
|
@@ -38,7 +38,7 @@ export type DataGridCellProps = {
|
|
|
38
38
|
* **Do not pass this prop manually.**
|
|
39
39
|
*
|
|
40
40
|
* Indicates whether the row containing this cell is highlighted.
|
|
41
|
-
* This prop is automatically passed down from the
|
|
41
|
+
* This prop is automatically passed down from the DataTableRow component.
|
|
42
42
|
*
|
|
43
43
|
* @default false
|
|
44
44
|
*/
|
|
@@ -47,13 +47,13 @@ export type DataGridCellProps = {
|
|
|
47
47
|
* **Do not pass this prop manually.**
|
|
48
48
|
*
|
|
49
49
|
* Indicates whether the cell is disabled.
|
|
50
|
-
* This prop is automatically passed down from the
|
|
50
|
+
* This prop is automatically passed down from the DataTableRow component.
|
|
51
51
|
*
|
|
52
52
|
* @default false
|
|
53
53
|
*/
|
|
54
54
|
disabled?: boolean;
|
|
55
55
|
/**
|
|
56
|
-
* The depth of the
|
|
56
|
+
* The depth of the DataTable.
|
|
57
57
|
* padding-left is applied based on the depth.
|
|
58
58
|
*
|
|
59
59
|
* @default 0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTableCell } from './DataTableCell';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DataTableHeader: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { dataTableHeaderSlotRecipe } from '../../../styled-system/recipes';
|
|
4
|
+
import { useDataTableContext } from '../DataTableProvider';
|
|
5
|
+
import { cx } from '../../../styled-system/css';
|
|
6
|
+
export const DataTableHeader = forwardRef(({ children, className, ...props }, ref) => {
|
|
7
|
+
const { fixedHeader } = useDataTableContext();
|
|
8
|
+
const classes = dataTableHeaderSlotRecipe({ fixedHeader });
|
|
9
|
+
return (_jsx("thead", { className: cx(classes.root, 'mfui-DataTableHeader__root',
|
|
10
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeader__root', className), ...props, ref: ref, children: children }));
|
|
11
|
+
});
|
|
12
|
+
DataTableHeader.displayName = 'DataTableHeader';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* The props for the `
|
|
3
|
+
* The props for the `DataTableHeader` component.
|
|
4
4
|
*
|
|
5
5
|
* It extends the general attributes of `thead` element.
|
|
6
6
|
*
|
|
7
7
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type DataTableHeaderProps = ComponentPropsWithRef<'thead'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTableHeader } from './DataTableHeader';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SortAscending, SortDescending, SortUnsorted } from '@moneyforward/mfui-icons-react';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { FocusIndicator } from '../../FocusIndicator';
|
|
5
|
+
import { dataTableHeaderCellSlotRecipe } from '../../../styled-system/recipes';
|
|
6
|
+
import { Typography } from '../../Typography';
|
|
7
|
+
import { useDataTableContext } from '../DataTableProvider';
|
|
8
|
+
import { cx } from '../../../styled-system/css';
|
|
9
|
+
import { useFixedColumns } from '../../utilities/dom/useFixedColumns';
|
|
10
|
+
import { handleCheckboxCellClick } from '../utils/handleCheckbox';
|
|
11
|
+
import { mergeRefs } from '../../utilities/dom/mergeRefs';
|
|
12
|
+
export const DataTableHeaderCell = forwardRef(({ children, type = 'text', sortButtonProps, sortOrder, ascendingIconProps, descendingIconProps, unsortedIconProps, className, columnIndex, disabled = false, ...props }, ref) => {
|
|
13
|
+
const { size, leftFixedColumnIndex, rightFixedColumnIndex, enableRowSelection } = useDataTableContext();
|
|
14
|
+
const { cellRef, isFixedColumn, isEdgeFixedColumn, fixedPositionStyles } = useFixedColumns({
|
|
15
|
+
enableRowSelection,
|
|
16
|
+
columnIndex,
|
|
17
|
+
leftFixedColumnIndex,
|
|
18
|
+
rightFixedColumnIndex,
|
|
19
|
+
});
|
|
20
|
+
const classes = dataTableHeaderCellSlotRecipe({
|
|
21
|
+
size,
|
|
22
|
+
type,
|
|
23
|
+
fixedColumn: isFixedColumn,
|
|
24
|
+
edgeFixedColumn: isEdgeFixedColumn,
|
|
25
|
+
isCheckboxCell: enableRowSelection && columnIndex === 0,
|
|
26
|
+
});
|
|
27
|
+
const isCheckboxCell = enableRowSelection && columnIndex === 0;
|
|
28
|
+
const isStringChild = typeof children === 'string';
|
|
29
|
+
const sortIcon = (() => {
|
|
30
|
+
if (!sortOrder) {
|
|
31
|
+
return (_jsx(SortUnsorted, { className: cx(classes.unsortedIcon, 'mfui-DataTableHeaderCell__unsortedIcon',
|
|
32
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__unsortedIcon'), "aria-label": unsortedIconProps?.['aria-label'] ?? '並び替えを解除' }));
|
|
33
|
+
}
|
|
34
|
+
if (sortOrder === 'ascending') {
|
|
35
|
+
return (_jsx(SortAscending, { className: cx(classes.sortIcon, 'mfui-DataTableHeaderCell__sortIcon',
|
|
36
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__sortIcon'), "aria-label": ascendingIconProps?.['aria-label'] ?? '昇順で並び替え' }));
|
|
37
|
+
}
|
|
38
|
+
return (_jsx(SortDescending, { className: cx(classes.sortIcon, 'mfui-DataTableHeaderCell__sortIcon',
|
|
39
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__sortIcon'), "aria-label": descendingIconProps?.['aria-label'] ?? '降順で並び替え' }));
|
|
40
|
+
})();
|
|
41
|
+
const handleClickSortButton = sortButtonProps?.onClick;
|
|
42
|
+
const cellContent = (() => {
|
|
43
|
+
if (sortButtonProps?.onClick) {
|
|
44
|
+
return (_jsx(FocusIndicator, { position: "inside", children: _jsxs("button", { type: "button", className: cx(classes.sortButton, 'mfui-DataTableHeaderCell__sortButton',
|
|
45
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__sortButton'), onClick: handleClickSortButton, children: [isStringChild ? _jsx(Typography, { variant: "strongBody", children: children }) : children, _jsx("div", { className: cx(classes.sortIconContainer, 'mfui-DataTableHeaderCell__sortIconContainer',
|
|
46
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__sortIconContainer'), children: sortIcon })] }) }));
|
|
47
|
+
}
|
|
48
|
+
if (isCheckboxCell) {
|
|
49
|
+
return (_jsx(FocusIndicator, { position: "inside", children: _jsx("div", { className: cx(classes.headerCell, 'mfui-DataTableHeaderCell__headerCell',
|
|
50
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__headerCell'), ...(disabled && { 'data-disabled': true, 'aria-disabled': true }), onClick: disabled ? undefined : handleCheckboxCellClick, children: isStringChild ? _jsx(Typography, { variant: "strongBody", children: children }) : children }) }));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx("div", { className: cx(classes.headerCell, 'mfui-DataTableHeaderCell__headerCell',
|
|
53
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__headerCell'), children: isStringChild ? _jsx(Typography, { variant: "strongBody", children: children }) : children }));
|
|
54
|
+
})();
|
|
55
|
+
return (_jsx("th", { ref: mergeRefs(ref, cellRef), className: cx(classes.root, 'mfui-DataTableHeaderCell__root',
|
|
56
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderCell__root', className), "aria-sort": sortOrder, style: fixedPositionStyles, ...props, children: cellContent }));
|
|
57
|
+
});
|
|
58
|
+
DataTableHeaderCell.displayName = 'DataTableHeaderCell';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
import { type CellDataType } from '../
|
|
2
|
+
import { type CellDataType } from '../DataTable.types';
|
|
3
3
|
/**
|
|
4
|
-
* The props for the `
|
|
4
|
+
* The props for the `DataTableHeaderCell` component.
|
|
5
5
|
*
|
|
6
6
|
* It extends the general attributes of `th` element.
|
|
7
7
|
*
|
|
8
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type DataTableHeaderCellProps = {
|
|
11
11
|
/**
|
|
12
12
|
* The type of the cell data.
|
|
13
13
|
* Used for determining how to align the header cell content.
|
|
@@ -20,10 +20,10 @@ export type DataGridHeaderCellProps = {
|
|
|
20
20
|
* @example
|
|
21
21
|
* ```tsx
|
|
22
22
|
* // For standard text columns
|
|
23
|
-
* <
|
|
23
|
+
* <DataTable.HeaderCell>Account Name</DataTable.HeaderCell>
|
|
24
24
|
*
|
|
25
25
|
* // For amount/balance columns
|
|
26
|
-
* <
|
|
26
|
+
* <DataTable.HeaderCell type="amount">Balance</DataTable.HeaderCell>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
type?: CellDataType;
|
|
@@ -74,7 +74,7 @@ export type DataGridHeaderCellProps = {
|
|
|
74
74
|
* **Do not pass this prop manually.**
|
|
75
75
|
*
|
|
76
76
|
* Indicates whether the cell is disabled.
|
|
77
|
-
* This prop is automatically passed down from the
|
|
77
|
+
* This prop is automatically passed down from the DataTableHeaderRow component.
|
|
78
78
|
*
|
|
79
79
|
* @default false
|
|
80
80
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTableHeaderCell } from './DataTableHeaderCell';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, forwardRef, isValidElement, useEffect } from 'react';
|
|
3
|
+
import { dataTableHeaderRowSlotRecipe } from '../../../styled-system/recipes';
|
|
4
|
+
import { useDataTableContext } from '../DataTableProvider';
|
|
5
|
+
import { DataTableHeaderCell } from '../DataTableHeaderCell';
|
|
6
|
+
import { Checkbox } from '../../Checkbox';
|
|
7
|
+
import { cx } from '../../../styled-system/css';
|
|
8
|
+
import { isComponentOrWrapped } from '../../utilities/react/isComponentOrWrapped';
|
|
9
|
+
export const DataTableHeaderRow = forwardRef(({ children, checkboxProps, className, ...props }, ref) => {
|
|
10
|
+
const { enableRowSelection, setNumberColumns } = useDataTableContext();
|
|
11
|
+
const classes = dataTableHeaderRowSlotRecipe();
|
|
12
|
+
// Count the number of header cells
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const headerCells = Children.toArray(children).filter((child) => isValidElement(child) && isComponentOrWrapped(child, DataTableHeaderCell));
|
|
15
|
+
setNumberColumns(headerCells.length);
|
|
16
|
+
}, [children, enableRowSelection, setNumberColumns]);
|
|
17
|
+
return (_jsxs("tr", { className: cx(classes.root, 'mfui-DataTableHeaderRow__root',
|
|
18
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridHeaderRow__root', className), ...props, ref: ref, children: [enableRowSelection ? (_jsx(DataTableHeaderCell, { columnIndex: 0, disabled: checkboxProps?.disabled, children: _jsx(Checkbox, { checked: checkboxProps?.checked, indeterminate: checkboxProps?.indeterminate, "aria-label": checkboxProps?.['aria-label'] ?? 'すべての行を選択', disabled: checkboxProps?.disabled, onChange: checkboxProps?.onChange, onClick: checkboxProps?.onClick }) })) : null, Children.map(children, (child, index) => {
|
|
19
|
+
if (!isValidElement(child)) {
|
|
20
|
+
return child;
|
|
21
|
+
}
|
|
22
|
+
// Check if the component is DataTableHeaderCell or wraps DataTableHeaderCell
|
|
23
|
+
if (isComponentOrWrapped(child, DataTableHeaderCell)) {
|
|
24
|
+
// Add selectable offset to columnIndex if selectable is true
|
|
25
|
+
const columnIndex = enableRowSelection ? index + 1 : index;
|
|
26
|
+
return cloneElement(child, { columnIndex });
|
|
27
|
+
}
|
|
28
|
+
return child;
|
|
29
|
+
})] }));
|
|
30
|
+
});
|
|
31
|
+
DataTableHeaderRow.displayName = 'DataTableHeaderRow';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { type CheckboxProps } from '../../Checkbox';
|
|
3
3
|
/**
|
|
4
|
-
* The props for the `
|
|
4
|
+
* The props for the `DataTableHeaderRow` component.
|
|
5
5
|
*
|
|
6
6
|
* It extends the general attributes of `tr` element.
|
|
7
7
|
*
|
|
8
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type DataTableHeaderRowProps = {
|
|
11
11
|
/**
|
|
12
12
|
* The properties for the checkbox.
|
|
13
|
-
* This prop is available when the `enableRowSelection` prop of the `
|
|
13
|
+
* This prop is available when the `enableRowSelection` prop of the `DataTable` component is `true`.
|
|
14
14
|
* If this prop is not passed, the default values for each property will be applied.
|
|
15
15
|
*
|
|
16
16
|
* @property aria-label - The alternative text for the checkbox. default is 'すべての行を選択'.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTableHeaderRow } from './DataTableHeaderRow';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type DataTableProps } from './DataTable.types';
|
|
3
|
+
export type DataTableSize = 'small' | 'medium';
|
|
4
|
+
/**
|
|
5
|
+
* The props for the `DataTableContext` component.
|
|
6
|
+
*/
|
|
7
|
+
export type DataTableContextProps = Pick<DataTableProps, 'size' | 'enableRowSelection' | 'fixedHeader' | 'leftFixedColumnIndex' | 'rightFixedColumnIndex' | 'loading' | 'layout'>;
|
|
8
|
+
export type DataTableProviderValues = {
|
|
9
|
+
numberColumns: number;
|
|
10
|
+
setNumberColumns: (number: number) => void;
|
|
11
|
+
} & DataTableContextProps;
|
|
12
|
+
/**
|
|
13
|
+
* The context for the `DataTable` component.
|
|
14
|
+
*
|
|
15
|
+
* This should only be used in DataTable component.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DataTableContext: import("react").Context<DataTableProviderValues>;
|
|
18
|
+
/**
|
|
19
|
+
* The hook to use the `DataTableContext`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useDataTableContext: () => DataTableProviderValues;
|
|
22
|
+
/**
|
|
23
|
+
* The provider for the `DataTableContext`.
|
|
24
|
+
*
|
|
25
|
+
* This should only be used in DataTable component.
|
|
26
|
+
*/
|
|
27
|
+
export declare function DataTableProvider({ children, size, enableRowSelection, fixedHeader, leftFixedColumnIndex, rightFixedColumnIndex, loading, layout, }: PropsWithChildren<DataTableContextProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useMemo, useState } from 'react';
|
|
4
4
|
/**
|
|
5
|
-
* The context for the `
|
|
5
|
+
* The context for the `DataTable` component.
|
|
6
6
|
*
|
|
7
|
-
* This should only be used in
|
|
7
|
+
* This should only be used in DataTable component.
|
|
8
8
|
*/
|
|
9
|
-
export const
|
|
9
|
+
export const DataTableContext = createContext({
|
|
10
10
|
size: 'medium',
|
|
11
11
|
enableRowSelection: false,
|
|
12
12
|
fixedHeader: false,
|
|
@@ -19,15 +19,15 @@ export const DataGridContext = createContext({
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
/**
|
|
22
|
-
* The hook to use the `
|
|
22
|
+
* The hook to use the `DataTableContext`.
|
|
23
23
|
*/
|
|
24
|
-
export const
|
|
24
|
+
export const useDataTableContext = () => useContext(DataTableContext);
|
|
25
25
|
/**
|
|
26
|
-
* The provider for the `
|
|
26
|
+
* The provider for the `DataTableContext`.
|
|
27
27
|
*
|
|
28
|
-
* This should only be used in
|
|
28
|
+
* This should only be used in DataTable component.
|
|
29
29
|
*/
|
|
30
|
-
export function
|
|
30
|
+
export function DataTableProvider({ children, size = 'medium', enableRowSelection = false, fixedHeader = false, leftFixedColumnIndex, rightFixedColumnIndex, loading, layout = 'default', }) {
|
|
31
31
|
const [numberColumns, setNumberColumns] = useState(0);
|
|
32
32
|
const contextValue = useMemo(() => ({
|
|
33
33
|
size,
|
|
@@ -49,5 +49,5 @@ export function DataGridProvider({ children, size = 'medium', enableRowSelection
|
|
|
49
49
|
layout,
|
|
50
50
|
numberColumns,
|
|
51
51
|
]);
|
|
52
|
-
return _jsx(
|
|
52
|
+
return _jsx(DataTableContext.Provider, { value: contextValue, children: children });
|
|
53
53
|
}
|
package/dist/src/{DataGrid/DataGridRow/DataGridRow.js → DataTable/DataTableRow/DataTableRow.js}
RENAMED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, forwardRef, isValidElement } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { dataTableRowSlotRecipe } from '../../../styled-system/recipes';
|
|
4
|
+
import { DataTableCell } from '../DataTableCell';
|
|
5
5
|
import { Checkbox } from '../../Checkbox';
|
|
6
|
-
import {
|
|
6
|
+
import { useDataTableContext } from '../DataTableProvider';
|
|
7
7
|
import { cx } from '../../../styled-system/css';
|
|
8
8
|
import { isComponentOrWrapped } from '../../utilities/react/isComponentOrWrapped';
|
|
9
|
-
export const
|
|
10
|
-
const { enableRowSelection: contextEnableRowSelection, layout } =
|
|
9
|
+
export const DataTableRow = forwardRef(({ children, disabled = false, highlighted, checkboxProps, className, onClickRow, selectable, ...props }, ref) => {
|
|
10
|
+
const { enableRowSelection: contextEnableRowSelection, layout } = useDataTableContext();
|
|
11
11
|
const isSelectable = selectable ?? contextEnableRowSelection;
|
|
12
12
|
const isRowHighlighted = isSelectable ? (checkboxProps?.checked ?? highlighted) : highlighted;
|
|
13
13
|
const isInteractive = onClickRow !== undefined && !disabled;
|
|
14
|
-
const classes =
|
|
14
|
+
const classes = dataTableRowSlotRecipe({
|
|
15
15
|
layout,
|
|
16
16
|
highlighted: isRowHighlighted,
|
|
17
17
|
interactive: isInteractive,
|
|
@@ -27,13 +27,14 @@ export const DataGridRow = forwardRef(({ children, disabled = false, highlighted
|
|
|
27
27
|
onClickRow?.(event);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
return (_jsxs("tr", { ref: ref, className: cx(classes.root, 'mfui-
|
|
30
|
+
return (_jsxs("tr", { ref: ref, className: cx(classes.root, 'mfui-DataTableRow__root',
|
|
31
|
+
/* TODO: Remove in v5.0.0 */ 'mfui-DataGridRow__root', className), ...props,
|
|
31
32
|
// When the row is clickable, the role should be 'button' in order to allow screen readers to understand the row is clickable.
|
|
32
|
-
role: isInteractive ? 'button' : 'row', tabIndex: isInteractive ? 0 : undefined, ...(disabled && { 'aria-disabled': disabled }), onClick: handleClickRow, onKeyDown: handleKeyDownRow, children: [isSelectable ? (_jsx(
|
|
33
|
+
role: isInteractive ? 'button' : 'row', tabIndex: isInteractive ? 0 : undefined, ...(disabled && { 'aria-disabled': disabled }), onClick: handleClickRow, onKeyDown: handleKeyDownRow, children: [isSelectable ? (_jsx(DataTableCell, { columnIndex: 0, isRowHighlighted: isRowHighlighted, disabled: disabled, children: _jsx(Checkbox, { checked: checkboxProps?.checked, "aria-label": checkboxProps?.['aria-label'] ?? '行を選択', disabled: disabled || checkboxProps?.disabled, onChange: checkboxProps?.onChange, onClick: checkboxProps?.onClick }) })) : null, Children.map(children, (child, index) => {
|
|
33
34
|
if (!isValidElement(child)) {
|
|
34
35
|
return child;
|
|
35
36
|
}
|
|
36
|
-
if (isComponentOrWrapped(child,
|
|
37
|
+
if (isComponentOrWrapped(child, DataTableCell)) {
|
|
37
38
|
// Add selectable offset to columnIndex if selectable is true
|
|
38
39
|
const columnIndex = isSelectable ? index + 1 : index;
|
|
39
40
|
return cloneElement(child, { isRowHighlighted, columnIndex, disabled });
|
|
@@ -41,4 +42,4 @@ export const DataGridRow = forwardRef(({ children, disabled = false, highlighted
|
|
|
41
42
|
return child;
|
|
42
43
|
})] }));
|
|
43
44
|
});
|
|
44
|
-
|
|
45
|
+
DataTableRow.displayName = 'DataTableRow';
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
2
|
import { type CheckboxProps } from '../../Checkbox';
|
|
3
3
|
/**
|
|
4
|
-
* The props for the `
|
|
4
|
+
* The props for the `DataTableRow` component.
|
|
5
5
|
*
|
|
6
6
|
* It extends the general attributes of `tr` element.
|
|
7
7
|
*
|
|
8
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type DataTableRowProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Whether the row is disabled.
|
|
13
13
|
* When true, interaction when the row is clicked and the checkbox for selectable feature will be disabled.
|
|
14
14
|
* The row content remains visible with appropriate styling for readability.
|
|
15
|
-
* Interactive elements passed as a children for
|
|
15
|
+
* Interactive elements passed as a children for DataTable.Cell won't be disabled automatically.
|
|
16
16
|
*
|
|
17
17
|
* @default false
|
|
18
18
|
*/
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The state of the row whether it is highlighted without a selected.
|
|
22
|
-
* This prop displays a highlighted background color regardless of the `enableRowSelection` prop of the
|
|
22
|
+
* This prop displays a highlighted background color regardless of the `enableRowSelection` prop of the DataTable component.
|
|
23
23
|
*
|
|
24
24
|
* @default false
|
|
25
25
|
*/
|
|
26
26
|
highlighted?: boolean;
|
|
27
27
|
/**
|
|
28
28
|
* The properties for the checkbox.
|
|
29
|
-
* This prop is available when the `enableRowSelection` prop of the `
|
|
29
|
+
* This prop is available when the `enableRowSelection` prop of the `DataTable` component is `true`.
|
|
30
30
|
* If this prop is not passed, the default values for each property will be applied.
|
|
31
31
|
*
|
|
32
32
|
* @property aria-label - The alternative text for the checkbox. default is '行を選択'.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTableRow } from './DataTableRow';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { DataTable } from './DataTable';
|
|
2
|
+
export type { DataTableProps } from './DataTable.types';
|
|
3
|
+
export type { DataTableBodyProps } from './DataTableBody';
|
|
4
|
+
export type { DataTableCellProps } from './DataTableCell';
|
|
5
|
+
export type { DataTableHeaderProps } from './DataTableHeader';
|
|
6
|
+
export type { DataTableHeaderCellProps } from './DataTableHeaderCell';
|
|
7
|
+
export type { DataTableHeaderRowProps } from './DataTableHeaderRow';
|
|
8
|
+
export type { DataTableRowProps } from './DataTableRow';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DataTable } from './DataTable';
|
|
@@ -30,16 +30,31 @@ export function BaseMainNavigation({ className, featureShortcut, navigationItems
|
|
|
30
30
|
const InternalLinkTag = customLinkComponent ?? 'a';
|
|
31
31
|
const hasCurrentNavigationInChildren = (children) => children?.some((child) => child.isCurrent);
|
|
32
32
|
const toggleButtonLabel = isCollapsed ? 'ナビゲーションを拡げる' : 'ナビゲーションを折りたたむ';
|
|
33
|
-
return (_jsxs("div", { "data-mfui-collapsed": isCollapsed, className: cx(classes.root, 'mfui-BaseMainNavigation__root', className), children: [featureShortcut ? (_jsx("div", { className: cx(classes.featureShortcut, 'mfui-BaseMainNavigation__featureShortcut'), children: _jsx(FocusIndicator, { children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: featureShortcut.isExternal, href: featureShortcut.href, className: cx(classes.featureShortcutAnchor, 'mfui-BaseMainNavigation__featureShortcutAnchor'), children: _jsx(Typography, { variant: "controlLabel", children: featureShortcut.label }) }) }) })) : null,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
return (_jsxs("div", { "data-mfui-collapsed": isCollapsed, className: cx(classes.root, 'mfui-BaseMainNavigation__root', className), children: [featureShortcut ? (_jsx("div", { className: cx(classes.featureShortcut, 'mfui-BaseMainNavigation__featureShortcut'), children: _jsx(FocusIndicator, { children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: featureShortcut.isExternal, href: featureShortcut.href, className: cx(classes.featureShortcutAnchor, 'mfui-BaseMainNavigation__featureShortcutAnchor'), children: _jsx(Typography, { variant: "controlLabel", children: featureShortcut.label }) }) }) })) : null, _jsxs("nav", { id: navId, className: cx(classes.nav, 'mfui-BaseMainNavigation__nav'), children: [_jsx("ul", { className: cx(classes.list, 'mfui-BaseMainNavigation__list'), children: navigationItems.map((navigation, index) => {
|
|
34
|
+
const isGroupLabel = navigation.children && 'isGroupLabel' in navigation && navigation.isGroupLabel;
|
|
35
|
+
if (isGroupLabel) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (_jsx("li", { className: cx(classes.listItem, 'mfui-BaseMainNavigation__listItem'), "data-mfui-popover-portal-target-id": `nested-popover-portal-target-${String(index)}`, children: navigation.children ? (isCollapsed ? (_jsx(CollapsedNestedNavigationItem, { navigation: navigation, classes: classes, InternalLinkTag: InternalLinkTag, hasCurrentChildren: hasCurrentNavigationInChildren(navigation.children) || false, popoverPortalTargetId: `nested-popover-portal-target-${String(index)}`, isOpen: openPopoverIndex === index, onOpenChange: (isOpen) => {
|
|
39
|
+
if (isOpen) {
|
|
40
|
+
setOpenPopoverIndex(index);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
setOpenPopoverIndex(null);
|
|
44
|
+
}
|
|
45
|
+
} })) : (_jsxs("details", { open: ('isOpenByDefault' in navigation && navigation.isOpenByDefault) ||
|
|
46
|
+
hasCurrentNavigationInChildren(navigation.children), className: cx(classes.parentDetails, 'mfui-BaseMainNavigation__parentDetails'), children: [_jsx(FocusIndicator, { position: "inside", children: _jsxs("summary", { className: cx(classes.parentSummary, 'mfui-BaseMainNavigation__parentSummary'), children: [_jsx("div", { className: cx(classes.parentSummaryIcon, 'mfui-BaseMainNavigation__parentSummaryIcon'), children: navigation.icon }), _jsx(Typography, { variant: "controlLabel", children: navigation.label }), _jsx(DisclosureBasicCollapsed, { className: "mfui-BaseMainNavigation__icon_collapsed", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-collapsed" }), _jsx(DisclosureBasicExpanded, { className: "mfui-BaseMainNavigation__icon_expanded", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-expanded" })] }) }), _jsx("ul", { className: cx(classes.childrenList, 'mfui-BaseMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-BaseMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.childrenListItemAnchor, 'mfui-BaseMainNavigation__childrenListItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, children: _jsx(Typography, { variant: "controlLabel", children: child.label }) }) }) }, childIndex))) })] }))) : (_jsx(Tooltip, { className: cx(classes.listItemTooltip, 'mfui-BaseMainNavigation__listItemTooltip'), content: navigation.label, disabled: !isCollapsed, placement: "right", children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: navigation.isExternal, href: navigation.href, className: cx(classes.listItemAnchor, 'mfui-BaseMainNavigation__listItemAnchor'), "aria-label": isCollapsed ? navigation.label : undefined, "aria-current": navigation.isCurrent ? 'page' : undefined, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-BaseMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-BaseMainNavigation__iconAndLabel'), children: [_jsx("div", { className: cx(classes.listItemAnchorIcon, 'mfui-BaseMainNavigation__listItemAnchorIcon'), children: navigation.icon }), isCollapsed ? null : _jsx(Typography, { variant: "controlLabel", children: navigation.label })] }), navigation.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-BaseMainNavigation__lockIcon'), "aria-label": navigation.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null, !isCollapsed && navigation.statusSlot && navigation.locked !== true
|
|
47
|
+
? navigation.statusSlot
|
|
48
|
+
: null] }) }) }) })) }, index));
|
|
49
|
+
}) }), !isCollapsed &&
|
|
50
|
+
navigationItems.map((navigation, index) => {
|
|
51
|
+
const isGroupLabel = navigation.children && 'isGroupLabel' in navigation && navigation.isGroupLabel;
|
|
52
|
+
if (!isGroupLabel) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const groupLabelId = `${navId}-group-label-${String(index)}`;
|
|
56
|
+
return (_jsxs("div", { className: cx(classes.groupLabelSection, 'mfui-BaseMainNavigation__groupLabelSection'), children: [_jsx("div", { className: cx(classes.groupLabel, 'mfui-BaseMainNavigation__groupLabel'), children: _jsx(Typography, { id: groupLabelId, variant: "condensedControlLabel", className: cx(classes.groupLabelText, 'mfui-BaseMainNavigation__groupLabelText'), children: navigation.label }) }), _jsx("ul", { "aria-labelledby": groupLabelId, className: cx(classes.childrenList, 'mfui-BaseMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-BaseMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.listItemAnchor, 'mfui-BaseMainNavigation__listItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-BaseMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-BaseMainNavigation__iconAndLabel'), children: [_jsx("div", { className: cx(classes.listItemAnchorIcon, 'mfui-BaseMainNavigation__listItemAnchorIcon'), children: child.icon }), _jsx(Typography, { variant: "controlLabel", children: child.label })] }), child.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-BaseMainNavigation__lockIcon'), "aria-label": child.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null, child.statusSlot && child.locked !== true ? child.statusSlot : null] }) }) }) }, childIndex))) })] }, index));
|
|
57
|
+
})] }), enableCollapsible ? (_jsx("div", { className: cx(classes.footer, 'mfui-BaseMainNavigation__footer'), children: _jsx(Tooltip, { content: toggleButtonLabel, placement: "right", children: _jsx(ToggleButton, { className: cx(classes.toggleButton, 'mfui-BaseMainNavigation__toggleButton'), iconClassName: cx(classes.toggleButtonIcon, 'mfui-BaseMainNavigation__toggleButtonIcon'), isCollapsed: isCollapsed, "aria-label": toggleButtonLabel, targetId: navId, handleClickToggleButton: handleClickToggleButton }) }) })) : null] }));
|
|
43
58
|
}
|
|
44
59
|
/**
|
|
45
60
|
* The component for displaying nested navigation in collapsed state with popover.
|
|
@@ -96,8 +96,56 @@ type ParentNavigationItem = {
|
|
|
96
96
|
* The nested depth is limited to one level and the icon is only allowed for the first level navigation item.
|
|
97
97
|
*/
|
|
98
98
|
children: Omit<BasicNavigationItem, 'icon' | 'children'>[];
|
|
99
|
+
/**
|
|
100
|
+
* Whether this navigation item is a group label.
|
|
101
|
+
*
|
|
102
|
+
* This property is not allowed for the parent navigation items.
|
|
103
|
+
*/
|
|
104
|
+
isGroupLabel?: undefined;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The group label navigation item type.
|
|
108
|
+
* Used for displaying a label that groups child navigation items that are always visible.
|
|
109
|
+
* Commonly used for important menus that need to be constantly displayed or menus with display toggle functionality.
|
|
110
|
+
*
|
|
111
|
+
* Example: Administrator Menu (menu only visible to users with admin privileges)
|
|
112
|
+
*/
|
|
113
|
+
type GroupLabelNavigationItem = {
|
|
114
|
+
/**
|
|
115
|
+
* The label of the group.
|
|
116
|
+
*/
|
|
117
|
+
label: string;
|
|
118
|
+
/**
|
|
119
|
+
* The URL of the navigation item.
|
|
120
|
+
*
|
|
121
|
+
* This property is not allowed for the group label navigation items.
|
|
122
|
+
*/
|
|
123
|
+
href?: undefined;
|
|
124
|
+
/**
|
|
125
|
+
* The icon of the navigation item.
|
|
126
|
+
*
|
|
127
|
+
* This property is not allowed for the group label navigation items.
|
|
128
|
+
*/
|
|
129
|
+
icon?: undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Whether the navigation item is the current page.
|
|
132
|
+
*
|
|
133
|
+
* This property is not allowed for the group label navigation items.
|
|
134
|
+
*/
|
|
135
|
+
isCurrent?: undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Nested navigation items under the group label.
|
|
138
|
+
*
|
|
139
|
+
* These items are always visible and cannot be toggled.
|
|
140
|
+
*/
|
|
141
|
+
children: Omit<BasicNavigationItem, 'children'>[];
|
|
142
|
+
/**
|
|
143
|
+
* Indicates that this navigation item is a group label.
|
|
144
|
+
* Group labels are always expanded and cannot be collapsed.
|
|
145
|
+
*/
|
|
146
|
+
isGroupLabel: true;
|
|
99
147
|
};
|
|
100
|
-
type NavigationItem = BasicNavigationItem | ParentNavigationItem;
|
|
148
|
+
type NavigationItem = BasicNavigationItem | ParentNavigationItem | GroupLabelNavigationItem;
|
|
101
149
|
type FeatureShortcut = {
|
|
102
150
|
/**
|
|
103
151
|
* The label of the feature shortcut link button.
|