@moneyforward/mfui-components 3.28.0 → 3.29.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/Accordion/Accordion.js +1 -1
- package/dist/src/Button/Button.js +1 -1
- package/dist/src/CheckboxGroup/CheckboxGroup.js +1 -1
- package/dist/src/DataTable/DataTableCell/DataTableCell.js +3 -3
- package/dist/src/DataTable/DataTableCell/DataTableCell.types.d.ts +8 -0
- package/dist/src/DataTable/DataTableRow/DataTableRow.js +7 -1
- package/dist/src/DateTimeSelection/FilterDatePicker/CalendarPopover/CalendarPopover.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterDatePicker/CalendarPopover/CalendarPopover.js +2 -2
- package/dist/src/DateTimeSelection/FilterDatePicker/CalendarPopover/CalendarPopover.types.d.ts +1 -0
- package/dist/src/DateTimeSelection/FilterDatePicker/FilterDatePicker.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterDatePicker/FilterDatePicker.js +2 -2
- package/dist/src/DateTimeSelection/FilterDatePicker/FilterDatePicker.types.d.ts +7 -1
- package/dist/src/DateTimeSelection/FilterDateRangePicker/DateRangePickerContent/DateRangePickerContent.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterDateRangePicker/DateRangePickerContent/DateRangePickerContent.js +2 -2
- package/dist/src/DateTimeSelection/FilterDateRangePicker/DateRangePickerContent/DateRangePickerContent.types.d.ts +1 -0
- package/dist/src/DateTimeSelection/FilterDateRangePicker/FilterDateRangePicker.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterDateRangePicker/FilterDateRangePicker.js +2 -2
- package/dist/src/DateTimeSelection/FilterDateRangePicker/FilterDateRangePicker.types.d.ts +7 -1
- package/dist/src/DateTimeSelection/FilterMonthPicker/FilterMonthPicker.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterMonthPicker/FilterMonthPicker.js +2 -2
- package/dist/src/DateTimeSelection/FilterMonthPicker/FilterMonthPicker.types.d.ts +7 -1
- package/dist/src/DateTimeSelection/FilterMonthPicker/MonthPickerPopover/MonthPickerPopover.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterMonthPicker/MonthPickerPopover/MonthPickerPopover.js +2 -2
- package/dist/src/DateTimeSelection/FilterMonthPicker/MonthPickerPopover/MonthPickerPopover.types.d.ts +1 -0
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/FilterMonthRangePicker.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/FilterMonthRangePicker.js +2 -2
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/FilterMonthRangePicker.types.d.ts +7 -1
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/MonthRangePickerPopover/MonthRangePickerPopover.d.ts +1 -1
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/MonthRangePickerPopover/MonthRangePickerPopover.js +2 -2
- package/dist/src/DateTimeSelection/FilterMonthRangePicker/MonthRangePickerPopover/MonthRangePickerPopover.types.d.ts +1 -0
- package/dist/src/DateTimeSelection/MonthRangePicker/MonthRangePickerMonthCell/MonthRangePickerMonthCell.js +1 -1
- package/dist/src/DateTimeSelection/TimePicker/TimePicker.d.ts +2 -0
- package/dist/src/DateTimeSelection/TimePicker/TimePicker.js +2 -2
- package/dist/src/DateTimeSelection/TimePicker/TimePicker.types.d.ts +6 -0
- package/dist/src/DateTimeSelection/shared/BaseRangePicker/BaseRangePickerPopover/BaseRangePickerCalendar/BaseRangePickerDateCell.js +1 -1
- package/dist/src/DateTimeSelection/shared/DayCell/DayCell.js +2 -2
- package/dist/src/DateTimeSelection/shared/accessibility/getDateAriaAttributes.d.ts +0 -1
- package/dist/src/DateTimeSelection/shared/accessibility/getDateAriaAttributes.js +0 -1
- package/dist/src/Dialog/Dialog.d.ts +3 -1
- package/dist/src/Dialog/Dialog.js +8 -4
- package/dist/src/Dialog/hooks/useDialogStateController.d.ts +5 -1
- package/dist/src/Dialog/hooks/useDialogStateController.js +7 -4
- package/dist/src/Disclosure/Disclosure.js +1 -1
- package/dist/src/FilterTrigger/FilterTrigger.js +1 -1
- package/dist/src/IconButton/IconButton.types.d.ts +6 -2
- package/dist/src/MainNavigation/BaseMainNavigation.js +4 -4
- package/dist/src/MainNavigation/NarrowViewportMainNavigation.js +2 -2
- package/dist/src/MultipleSelectBox/MultipleSelectBox.js +5 -4
- package/dist/src/MultipleSelectBox/MultipleSelectBox.types.d.ts +13 -2
- package/dist/src/MultipleSelectBox/MultipleSelectBoxTrigger/MultipleSelectBoxTrigger.js +1 -1
- package/dist/src/Pagination/PagePicker/PagePicker.js +2 -2
- package/dist/src/SearchBox/SearchBox.d.ts +3 -0
- package/dist/src/SearchBox/SearchBox.js +4 -1
- package/dist/src/SelectBox/SelectBox.js +9 -6
- package/dist/src/SelectBox/SelectBox.types.d.ts +13 -2
- package/dist/src/Sidebar/Sidebar.d.ts +1 -1
- package/dist/src/Sidebar/Sidebar.js +3 -3
- package/dist/src/Sidebar/Sidebar.types.d.ts +2 -2
- package/dist/src/Sidebar/SidebarServiceMenu.d.ts +3 -4
- package/dist/src/Sidebar/SidebarServiceMenu.js +5 -12
- package/dist/src/SubNavigation/SubNavigation.js +2 -2
- package/dist/styled-system/recipes/day-cell-slot-recipe.d.ts +1 -1
- package/dist/styled-system/recipes/day-cell-slot-recipe.js +4 -0
- package/dist/styled-system/tokens/index.js +60 -0
- package/dist/styled-system/tokens/tokens.d.ts +2 -2
- package/dist/styled-system/types/prop-type.d.ts +1 -1
- package/dist/styles.css +31 -54
- package/dist/theme-orange.css +18 -3
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback, useId } from 'react';
|
|
3
|
+
import { useCallback, useId, useState } from 'react';
|
|
4
4
|
import { Close } from '@moneyforward/mfui-icons-react';
|
|
5
5
|
import { cx } from '../../styled-system/css';
|
|
6
6
|
import { dialogSlotRecipe } from '../../styled-system/recipes';
|
|
@@ -12,7 +12,9 @@ import { compatibleForwardRef } from '../utilities/react/compatibleForwardRef';
|
|
|
12
12
|
import { Portal, TargetDomNodeProvider, useAutomaticTargetDomNode } from '../Portal';
|
|
13
13
|
/**
|
|
14
14
|
* The general purpose Dialog component.
|
|
15
|
-
* This component extends the props of `<div>` element
|
|
15
|
+
* This component extends the props of `<div>` element. The extended props and `ref` are
|
|
16
|
+
* applied to the root overlay element covering the viewport, while `role="dialog"` and
|
|
17
|
+
* `aria-modal="true"` are set on the inner dialog window element.
|
|
16
18
|
*
|
|
17
19
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
|
|
18
20
|
*/
|
|
@@ -21,11 +23,13 @@ export const Dialog = compatibleForwardRef(({ open, title, onClose, className, a
|
|
|
21
23
|
const titleId = `mfui-dialog-title-${id}`;
|
|
22
24
|
const contentId = `mfui-dialog-content-${id}`;
|
|
23
25
|
const classes = dialogSlotRecipe({ size });
|
|
26
|
+
const [insideElement, setInsideElement] = useState(null);
|
|
24
27
|
const { localOpen, closeDialog, handleStopCloseDialog, dialogElement, setDialogElement } = useDialogStateController({
|
|
25
28
|
open,
|
|
26
29
|
onClose,
|
|
27
30
|
forwardedRef: ref,
|
|
28
31
|
customFocusElement,
|
|
32
|
+
insideElement,
|
|
29
33
|
});
|
|
30
34
|
const handleKeyDown = useCallback((event) => {
|
|
31
35
|
if (event.key === 'Escape') {
|
|
@@ -47,8 +51,8 @@ export const Dialog = compatibleForwardRef(({ open, title, onClose, className, a
|
|
|
47
51
|
});
|
|
48
52
|
const targetElement = useAutomaticTargetDomNode(targetDOMNode, dialogElement);
|
|
49
53
|
const shouldRenderContent = enableAutoUnmount ? localOpen : true;
|
|
50
|
-
return (_jsx(TargetDomNodeProvider, { targetDomNode: dialogElement, children: shouldRenderContent ? (_jsx(Portal, { targetDOMNode: targetElement, children: _jsxs("div", { ref: setDialogElement,
|
|
54
|
+
return (_jsx(TargetDomNodeProvider, { targetDomNode: dialogElement, children: shouldRenderContent ? (_jsx(Portal, { targetDOMNode: targetElement, children: _jsxs("div", { ref: setDialogElement, ...dialogProps, className: cx(classes.root, 'mfui-Dialog__root', className), style: {
|
|
51
55
|
...dialogProps.style,
|
|
52
56
|
...(!enableAutoUnmount && !localOpen && { display: 'none' }),
|
|
53
|
-
}, onKeyDown: handleOnKeyDown, children: [_jsx("div", { "data-mfui-content": "backdrop", className: cx(classes.backdrop, 'mfui-Dialog__backdrop'), onClick: handleBackdropClick }), _jsxs("div", { "data-mfui-content": "inside", className: cx(classes.inside, 'mfui-Dialog__inside'), onClick: handleStopCloseDialog, children: [_jsx("header", { className: cx(classes.header, 'mfui-Dialog__header'), children: _jsxs("div", { className: cx(classes.headerContent, 'mfui-Dialog__headerContent'), children: [_jsx(Heading, { id: titleId, variant: "pageHeading2", tag: "h2", className: cx(classes.title, 'mfui-Dialog__title'), children: title }), !hideCloseButton ? (_jsx("div", { className: cx(classes.closeButtonWrapper, 'mfui-Dialog__closeButtonWrapper'), children: _jsx(IconButton, { "aria-label": closeButtonProps?.['aria-label'] ?? '閉じる', onClick: closeDialog, children: _jsx(Close, {}) }) })) : null] }) }), _jsx("main", { id: contentId, className: cx(classes.content, 'mfui-Dialog__content'), children: children }), _jsx("footer", { className: cx(classes.footer, 'mfui-Dialog__footer'), children: actionSlot })] })] }) })) : null }));
|
|
57
|
+
}, onKeyDown: handleOnKeyDown, children: [_jsx("div", { "data-mfui-content": "backdrop", className: cx(classes.backdrop, 'mfui-Dialog__backdrop'), onClick: handleBackdropClick }), _jsxs("div", { ref: setInsideElement, role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, "aria-describedby": contentId, tabIndex: -1, "data-mfui-content": "inside", className: cx(classes.inside, 'mfui-Dialog__inside'), onClick: handleStopCloseDialog, children: [_jsx("header", { className: cx(classes.header, 'mfui-Dialog__header'), children: _jsxs("div", { className: cx(classes.headerContent, 'mfui-Dialog__headerContent'), children: [_jsx(Heading, { id: titleId, variant: "pageHeading2", tag: "h2", className: cx(classes.title, 'mfui-Dialog__title'), children: title }), !hideCloseButton ? (_jsx("div", { className: cx(classes.closeButtonWrapper, 'mfui-Dialog__closeButtonWrapper'), children: _jsx(IconButton, { "aria-label": closeButtonProps?.['aria-label'] ?? '閉じる', onClick: closeDialog, children: _jsx(Close, {}) }) })) : null] }) }), _jsx("main", { id: contentId, className: cx(classes.content, 'mfui-Dialog__content'), children: children }), _jsx("footer", { className: cx(classes.footer, 'mfui-Dialog__footer'), children: actionSlot })] })] }) })) : null }));
|
|
54
58
|
});
|
|
@@ -4,6 +4,7 @@ type UseDialogStateControllerOptions = {
|
|
|
4
4
|
onClose?: () => void;
|
|
5
5
|
forwardedRef: ForwardedRef<HTMLDivElement | null>;
|
|
6
6
|
customFocusElement?: RefObject<HTMLElement | null> | HTMLElement | null;
|
|
7
|
+
insideElement?: HTMLElement | null;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Custom hook to control the open/close state of a dialog.
|
|
@@ -23,9 +24,12 @@ type UseDialogStateControllerOptions = {
|
|
|
23
24
|
* @param options.customFocusElement - Optional custom element to focus when the dialog opens.
|
|
24
25
|
* When provided, this element receives focus instead of the dialog container.
|
|
25
26
|
*
|
|
27
|
+
* @param options.insideElement - The dialog window element with `role="dialog"`. It receives
|
|
28
|
+
* default focus when the dialog opens, keeping focus inside the `aria-modal` boundary.
|
|
29
|
+
*
|
|
26
30
|
* @returns Object containing functions to handle closing the dialog and stopping the dialog from closing.
|
|
27
31
|
*/
|
|
28
|
-
export declare const useDialogStateController: ({ open, forwardedRef, onClose, customFocusElement, }: UseDialogStateControllerOptions) => {
|
|
32
|
+
export declare const useDialogStateController: ({ open, forwardedRef, onClose, customFocusElement, insideElement, }: UseDialogStateControllerOptions) => {
|
|
29
33
|
localOpen: boolean | undefined;
|
|
30
34
|
closeDialog: () => void;
|
|
31
35
|
handleStopCloseDialog: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -19,9 +19,12 @@ import { useUpdateEffect } from '../../utilities/effect/useUpdateEffect';
|
|
|
19
19
|
* @param options.customFocusElement - Optional custom element to focus when the dialog opens.
|
|
20
20
|
* When provided, this element receives focus instead of the dialog container.
|
|
21
21
|
*
|
|
22
|
+
* @param options.insideElement - The dialog window element with `role="dialog"`. It receives
|
|
23
|
+
* default focus when the dialog opens, keeping focus inside the `aria-modal` boundary.
|
|
24
|
+
*
|
|
22
25
|
* @returns Object containing functions to handle closing the dialog and stopping the dialog from closing.
|
|
23
26
|
*/
|
|
24
|
-
export const useDialogStateController = ({ open, forwardedRef, onClose, customFocusElement, }) => {
|
|
27
|
+
export const useDialogStateController = ({ open, forwardedRef, onClose, customFocusElement, insideElement, }) => {
|
|
25
28
|
const [dialogElement, setDialogElement] = useState(null);
|
|
26
29
|
const [localOpen, setLocalOpen] = useState(open);
|
|
27
30
|
// Whenever the `open` prop changes, update the local state.
|
|
@@ -67,9 +70,9 @@ export const useDialogStateController = ({ open, forwardedRef, onClose, customFo
|
|
|
67
70
|
customFocusElement.focus();
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
|
-
// Default behavior: focus the dialog
|
|
71
|
-
dialogElement?.focus();
|
|
72
|
-
}, [localOpen, dialogElement, customFocusElement]);
|
|
73
|
+
// Default behavior: focus the dialog window (`role="dialog"` element)
|
|
74
|
+
(insideElement ?? dialogElement)?.focus();
|
|
75
|
+
}, [localOpen, dialogElement, insideElement, customFocusElement]);
|
|
73
76
|
return {
|
|
74
77
|
localOpen,
|
|
75
78
|
closeDialog,
|
|
@@ -47,7 +47,7 @@ const Trigger = forwardRef(({ targetId, children, className, onClick, ...props }
|
|
|
47
47
|
toggle();
|
|
48
48
|
onClick?.(event);
|
|
49
49
|
}, [onClick, toggle]);
|
|
50
|
-
return (_jsx(FocusIndicator, { children: _jsxs("button", { ref: ref, className: cx(classes.trigger, 'mfui-Disclosure__trigger', className), "aria-expanded": isOpen, "aria-controls": targetId, onClick: handleClick, ...props, children: [_jsx(Typography, { variant: "controlLabel", children: children }), isOpen ? _jsx(DisclosureBasicExpanded, {}) : _jsx(DisclosureBasicCollapsed, {})] }) }));
|
|
50
|
+
return (_jsx(FocusIndicator, { children: _jsxs("button", { ref: ref, className: cx(classes.trigger, 'mfui-Disclosure__trigger', className), "aria-expanded": isOpen, "aria-controls": targetId, type: "button", onClick: handleClick, ...props, children: [_jsx(Typography, { variant: "controlLabel", children: children }), isOpen ? _jsx(DisclosureBasicExpanded, { "aria-hidden": "true" }) : _jsx(DisclosureBasicCollapsed, { "aria-hidden": "true" })] }) }));
|
|
51
51
|
});
|
|
52
52
|
/**
|
|
53
53
|
* The target component for the Disclosure.
|
|
@@ -13,6 +13,6 @@ import { filterTriggerSlotRecipe } from '../../styled-system/recipes';
|
|
|
13
13
|
export const FilterTrigger = forwardRef(({ label, value, inputProps, className, enableClearButton = false, clearButtonProps, ...props }, ref) => {
|
|
14
14
|
const classes = filterTriggerSlotRecipe();
|
|
15
15
|
const displayContent = value ? (_jsxs(Typography, { variant: "strongBody", children: [_jsx("span", { "data-mfui-content": "filter-trigger-label", children: `${label}:` }), _jsx("span", { "data-mfui-content": "filter-trigger-value", children: value })] })) : (_jsx(Typography, { variant: "controlLabel", children: _jsx("span", { "data-mfui-content": "filter-trigger-label", children: label }) }));
|
|
16
|
-
return (_jsxs("div", { className: cx(classes.wrapper, 'mfui-FilterTrigger__wrapper'), children: [_jsx(FocusIndicator, { children: _jsxs("button", { ref: ref, type: "button", className: cx(classes.trigger, 'mfui-FilterTrigger__trigger', className), "data-selected": !!value, "data-mfui-has-clear-button": enableClearButton ? !!value : false, ...props, children: [_jsx("span", { className: cx(classes.content, 'mfui-FilterTrigger__content'), "data-mfui-content": "filter-trigger-display-value", children: displayContent }), _jsx("span", { className: cx(classes.dropdownIcon, 'mfui-FilterTrigger__dropdownIcon'), children: _jsx(DropdownIcon, {}) })] }) }), _jsx("input", { type: "hidden", ...inputProps, value: value }), enableClearButton && value ? (_jsx("div", { className: cx(classes.clearButtonWrapper, 'mfui-FilterTrigger__clearButtonWrapper'), children: _jsx(ClearButton, { "aria-label": clearButtonProps?.['aria-label'] ?? '値をクリアする', "data-mfui-content": "filter-trigger-clear-button", onClick: clearButtonProps?.onClick }) })) : null] }));
|
|
16
|
+
return (_jsxs("div", { className: cx(classes.wrapper, 'mfui-FilterTrigger__wrapper'), children: [_jsx(FocusIndicator, { children: _jsxs("button", { ref: ref, type: "button", className: cx(classes.trigger, 'mfui-FilterTrigger__trigger', className), "data-selected": !!value, "data-mfui-has-clear-button": enableClearButton ? !!value : false, ...props, children: [_jsx("span", { className: cx(classes.content, 'mfui-FilterTrigger__content'), "data-mfui-content": "filter-trigger-display-value", children: displayContent }), _jsx("span", { className: cx(classes.dropdownIcon, 'mfui-FilterTrigger__dropdownIcon'), children: _jsx(DropdownIcon, { "aria-hidden": "true" }) })] }) }), _jsx("input", { type: "hidden", ...inputProps, value: value }), enableClearButton && value ? (_jsx("div", { className: cx(classes.clearButtonWrapper, 'mfui-FilterTrigger__clearButtonWrapper'), children: _jsx(ClearButton, { "aria-label": clearButtonProps?.['aria-label'] ?? '値をクリアする', "data-mfui-content": "filter-trigger-clear-button", onClick: clearButtonProps?.onClick }) })) : null] }));
|
|
17
17
|
});
|
|
18
18
|
FilterTrigger.displayName = 'FilterTrigger';
|
|
@@ -8,8 +8,12 @@ type IconButtonCommonProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
outlined?: IconButtonSlotRecipeVariant['outlined'];
|
|
10
10
|
/**
|
|
11
|
-
* Icon element to be rendered inside the button
|
|
12
|
-
* Only one element
|
|
11
|
+
* Icon element to be rendered inside the button.
|
|
12
|
+
* Only one element (typically an SVG icon) is expected.
|
|
13
|
+
*
|
|
14
|
+
* The icon is not hidden from assistive technologies automatically.
|
|
15
|
+
* If the icon is decorative, hide it yourself (e.g. `aria-hidden="true"`)
|
|
16
|
+
* and provide an `aria-label` on IconButton itself to expose the accessible name.
|
|
13
17
|
*/
|
|
14
18
|
children: React.ReactNode;
|
|
15
19
|
/**
|
|
@@ -38,7 +38,7 @@ export function BaseMainNavigation({ className, featureShortcut, navigationItems
|
|
|
38
38
|
if (navigation.children) {
|
|
39
39
|
return (_jsx(NestedNavigationItemRenderer, { navigation: navigation, originalIndex: index, classes: classes, InternalLinkTag: InternalLinkTag, isCollapsed: isCollapsed, openPopoverIndex: openPopoverIndex, setOpenPopoverIndex: setOpenPopoverIndex }, index));
|
|
40
40
|
}
|
|
41
|
-
return (_jsx("li", { className: cx(classes.listItem, 'mfui-BaseMainNavigation__listItem'), children: _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
|
|
41
|
+
return (_jsx("li", { className: cx(classes.listItem, 'mfui-BaseMainNavigation__listItem'), children: _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", { "aria-hidden": "true", 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
|
|
42
42
|
? navigation.statusSlot
|
|
43
43
|
: null] }) }) }) }) }, index));
|
|
44
44
|
}) }), navigationItems.some((navigation) => 'isGroupMenu' in navigation && navigation.isGroupMenu) && (_jsx("ul", { className: cx(classes.groupMenuList, 'mfui-BaseMainNavigation__groupMenuList'), children: navigationItems.map((navigation, index) => {
|
|
@@ -53,7 +53,7 @@ export function BaseMainNavigation({ className, featureShortcut, navigationItems
|
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
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));
|
|
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", { "aria-hidden": "true", 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
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] }));
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
@@ -66,7 +66,7 @@ function NestedNavigationItemRenderer({ navigation, originalIndex, classes, Inte
|
|
|
66
66
|
const hasCurrentChildren = navigation.children.some((child) => child.isCurrent);
|
|
67
67
|
return (_jsx("li", { className: cx(classes.listItem, 'mfui-BaseMainNavigation__listItem'), "data-mfui-popover-portal-target-id": popoverPortalTargetId, children: isCollapsed ? (_jsx(CollapsedNestedNavigationItem, { navigation: navigation, classes: classes, InternalLinkTag: InternalLinkTag, hasCurrentChildren: hasCurrentChildren, popoverPortalTargetId: popoverPortalTargetId, isOpen: openPopoverIndex === originalIndex, onOpenChange: (isOpen) => {
|
|
68
68
|
setOpenPopoverIndex(isOpen ? originalIndex : null);
|
|
69
|
-
} })) : (_jsxs("details", { open: ('isOpenByDefault' in navigation && navigation.isOpenByDefault) || hasCurrentChildren, 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))) })] })) }));
|
|
69
|
+
} })) : (_jsxs("details", { open: ('isOpenByDefault' in navigation && navigation.isOpenByDefault) || hasCurrentChildren, 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", { "aria-hidden": "true", 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))) })] })) }));
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* The component for displaying nested navigation in collapsed state with popover.
|
|
@@ -87,7 +87,7 @@ function CollapsedNestedNavigationItem({ navigation, classes, InternalLinkTag, h
|
|
|
87
87
|
};
|
|
88
88
|
return (_jsx(Popover, { enableAutoFocusOnPopover: false, enableAutoFocusOnTrigger: false, open: isOpen, targetDOMNode: document.querySelector(`[data-mfui-popover-portal-target-id="${popoverPortalTargetId}"]`), allowedPlacements: ['right-start', 'right', 'right-end'], contentProps: {
|
|
89
89
|
tabIndex: -1,
|
|
90
|
-
}, renderTrigger: ({ setTriggerRef }) => (_jsx(Tooltip, { className: cx(classes.listItemTooltip, 'mfui-BaseMainNavigation__listItemTooltip'), content: navigation.label, disabled: isOpen, placement: "right", children: _jsx(FocusIndicator, { position: "inside", children: _jsx("button", { ref: setTriggerRef, type: "button", className: cx(classes.listItemAnchor, 'mfui-BaseMainNavigation__listItemAnchor'), "data-mfui-current": hasCurrentChildren ? 'page' : undefined, "aria-current": hasCurrentChildren ? true : undefined, "aria-label": navigation.label, onClick: handleClick, onKeyDown: handleKeyDown, children: _jsx("div", { className: cx(classes.labelGroup, 'mfui-BaseMainNavigation__labelGroup'), children: _jsx("div", { className: cx(classes.iconAndLabel, 'mfui-BaseMainNavigation__iconAndLabel'), children: _jsx("div", { className: cx(classes.listItemAnchorIcon, 'mfui-BaseMainNavigation__listItemAnchorIcon'), children: navigation.icon }) }) }) }) }) })), renderContent: () => (_jsx("div", { ref: popoverContentRef, className: cx(classes.popoverChildrenList, 'mfui-BaseMainNavigation__popoverChildrenList'), tabIndex: -1, children: navigation.children.map((child, childIndex) => (_jsx("div", { 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, onClick: () => {
|
|
90
|
+
}, renderTrigger: ({ setTriggerRef }) => (_jsx(Tooltip, { className: cx(classes.listItemTooltip, 'mfui-BaseMainNavigation__listItemTooltip'), content: navigation.label, disabled: isOpen, placement: "right", children: _jsx(FocusIndicator, { position: "inside", children: _jsx("button", { ref: setTriggerRef, type: "button", className: cx(classes.listItemAnchor, 'mfui-BaseMainNavigation__listItemAnchor'), "data-mfui-current": hasCurrentChildren ? 'page' : undefined, "aria-current": hasCurrentChildren ? true : undefined, "aria-label": navigation.label, onClick: handleClick, onKeyDown: handleKeyDown, children: _jsx("div", { className: cx(classes.labelGroup, 'mfui-BaseMainNavigation__labelGroup'), children: _jsx("div", { className: cx(classes.iconAndLabel, 'mfui-BaseMainNavigation__iconAndLabel'), children: _jsx("div", { "aria-hidden": "true", className: cx(classes.listItemAnchorIcon, 'mfui-BaseMainNavigation__listItemAnchorIcon'), children: navigation.icon }) }) }) }) }) })), renderContent: () => (_jsx("div", { ref: popoverContentRef, className: cx(classes.popoverChildrenList, 'mfui-BaseMainNavigation__popoverChildrenList'), tabIndex: -1, children: navigation.children.map((child, childIndex) => (_jsx("div", { 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, onClick: () => {
|
|
91
91
|
onOpenChange(false);
|
|
92
92
|
}, children: _jsx(Typography, { variant: "controlLabel", children: child.label }) }) }) }, childIndex))) })), onOpenStateChanged: onOpenChange }));
|
|
93
93
|
}
|
|
@@ -54,13 +54,13 @@ export const NarrowViewportMainNavigation = forwardRef(({ className, featureShor
|
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
56
|
return (_jsx("li", { className: cx(classes.listItem, 'mfui-NarrowViewportMainNavigation__listItem'), children: navigation.children ? (_jsxs("details", { open: ('isOpenByDefault' in navigation && navigation.isOpenByDefault) ||
|
|
57
|
-
hasCurrentNavigationInChildren(navigation.children), className: cx(classes.parentDetails, 'mfui-NarrowViewportMainNavigation__parentDetails'), children: [_jsx(FocusIndicator, { position: "inside", children: _jsxs("summary", { className: cx(classes.parentSummary, 'mfui-NarrowViewportMainNavigation__parentSummary'), children: [_jsx("div", { className: cx(classes.parentSummaryIcon, 'mfui-NarrowViewportMainNavigation__parentSummaryIcon'), children: navigation.icon }), _jsx(Typography, { variant: "controlLabel", children: navigation.label }), _jsx(DisclosureBasicCollapsed, { className: "mfui-NarrowViewportMainNavigation__icon_collapsed", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-collapsed" }), _jsx(DisclosureBasicExpanded, { className: "mfui-NarrowViewportMainNavigation__icon_expanded", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-expanded" })] }) }), _jsx("ul", { className: cx(classes.childrenList, 'mfui-NarrowViewportMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-NarrowViewportMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.childrenListItemAnchor, 'mfui-NarrowViewportMainNavigation__childrenListItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsx(Typography, { variant: "controlLabel", children: child.label }) }) }) }, childIndex))) })] })) : (_jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: navigation.isExternal, href: navigation.href, className: cx(classes.listItemAnchor, 'mfui-NarrowViewportMainNavigation__listItemAnchor'), "aria-current": navigation.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-NarrowViewportMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-NarrowViewportMainNavigation__iconAndLabel'), children: [_jsx("div", { className: cx(classes.listItemAnchorIcon, 'mfui-NarrowViewportMainNavigation__listItemAnchorIcon'), children: navigation.icon }), _jsx(Typography, { variant: "controlLabel", children: navigation.label })] }), navigation.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-NarrowViewportMainNavigation__lockIcon'), "aria-label": navigation.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null] }) }) })) }, index));
|
|
57
|
+
hasCurrentNavigationInChildren(navigation.children), className: cx(classes.parentDetails, 'mfui-NarrowViewportMainNavigation__parentDetails'), children: [_jsx(FocusIndicator, { position: "inside", children: _jsxs("summary", { className: cx(classes.parentSummary, 'mfui-NarrowViewportMainNavigation__parentSummary'), children: [_jsx("div", { "aria-hidden": "true", className: cx(classes.parentSummaryIcon, 'mfui-NarrowViewportMainNavigation__parentSummaryIcon'), children: navigation.icon }), _jsx(Typography, { variant: "controlLabel", children: navigation.label }), _jsx(DisclosureBasicCollapsed, { className: "mfui-NarrowViewportMainNavigation__icon_collapsed", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-collapsed" }), _jsx(DisclosureBasicExpanded, { className: "mfui-NarrowViewportMainNavigation__icon_expanded", "aria-hidden": "true", "data-mfui-content": "main-navigation-icon-expanded" })] }) }), _jsx("ul", { className: cx(classes.childrenList, 'mfui-NarrowViewportMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-NarrowViewportMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.childrenListItemAnchor, 'mfui-NarrowViewportMainNavigation__childrenListItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsx(Typography, { variant: "controlLabel", children: child.label }) }) }) }, childIndex))) })] })) : (_jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: navigation.isExternal, href: navigation.href, className: cx(classes.listItemAnchor, 'mfui-NarrowViewportMainNavigation__listItemAnchor'), "aria-current": navigation.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-NarrowViewportMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-NarrowViewportMainNavigation__iconAndLabel'), children: [_jsx("div", { "aria-hidden": "true", className: cx(classes.listItemAnchorIcon, 'mfui-NarrowViewportMainNavigation__listItemAnchorIcon'), children: navigation.icon }), _jsx(Typography, { variant: "controlLabel", children: navigation.label })] }), navigation.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-NarrowViewportMainNavigation__lockIcon'), "aria-label": navigation.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null] }) }) })) }, index));
|
|
58
58
|
}) }), navigationItems.map((navigation, index) => {
|
|
59
59
|
const isGroupLabel = navigation.children && 'isGroupLabel' in navigation && navigation.isGroupLabel;
|
|
60
60
|
if (!isGroupLabel) {
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
const groupLabelId = `${navId}-group-label-${String(index)}`;
|
|
64
|
-
return (_jsxs("div", { className: cx(classes.groupLabelSection, 'mfui-NarrowViewportMainNavigation__groupLabelSection'), children: [_jsx("div", { className: cx(classes.groupLabel, 'mfui-NarrowViewportMainNavigation__groupLabel'), children: _jsx(Typography, { id: groupLabelId, variant: "condensedControlLabel", className: cx(classes.groupLabelText, 'mfui-NarrowViewportMainNavigation__groupLabelText'), children: navigation.label }) }), _jsx("ul", { "aria-labelledby": groupLabelId, className: cx(classes.childrenList, 'mfui-NarrowViewportMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-NarrowViewportMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.listItemAnchor, 'mfui-NarrowViewportMainNavigation__listItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-NarrowViewportMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-NarrowViewportMainNavigation__iconAndLabel'), children: [_jsx("div", { className: cx(classes.listItemAnchorIcon, 'mfui-NarrowViewportMainNavigation__listItemAnchorIcon'), children: child.icon }), _jsx(Typography, { variant: "controlLabel", children: child.label })] }), child.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-NarrowViewportMainNavigation__lockIcon'), "aria-label": child.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null, child.statusSlot && child.locked !== true ? child.statusSlot : null] }) }) }) }, childIndex))) })] }, index));
|
|
64
|
+
return (_jsxs("div", { className: cx(classes.groupLabelSection, 'mfui-NarrowViewportMainNavigation__groupLabelSection'), children: [_jsx("div", { className: cx(classes.groupLabel, 'mfui-NarrowViewportMainNavigation__groupLabel'), children: _jsx(Typography, { id: groupLabelId, variant: "condensedControlLabel", className: cx(classes.groupLabelText, 'mfui-NarrowViewportMainNavigation__groupLabelText'), children: navigation.label }) }), _jsx("ul", { "aria-labelledby": groupLabelId, className: cx(classes.childrenList, 'mfui-NarrowViewportMainNavigation__childrenList'), children: navigation.children.map((child, childIndex) => (_jsx("li", { className: cx(classes.childrenListItem, 'mfui-NarrowViewportMainNavigation__childrenListItem'), children: _jsx(FocusIndicator, { position: "inside", children: _jsx(NavigationLink, { tag: InternalLinkTag, isExternal: child.isExternal, href: child.href, className: cx(classes.listItemAnchor, 'mfui-NarrowViewportMainNavigation__listItemAnchor'), "aria-current": child.isCurrent ? 'page' : undefined, onClick: handleCloseMainNavigation, children: _jsxs("div", { className: cx(classes.labelGroup, 'mfui-NarrowViewportMainNavigation__labelGroup'), children: [_jsxs("div", { className: cx(classes.iconAndLabel, 'mfui-NarrowViewportMainNavigation__iconAndLabel'), children: [_jsx("div", { "aria-hidden": "true", className: cx(classes.listItemAnchorIcon, 'mfui-NarrowViewportMainNavigation__listItemAnchorIcon'), children: child.icon }), _jsx(Typography, { variant: "controlLabel", children: child.label })] }), child.locked ? (_jsx(Lock, { className: cx(classes.lockIcon, 'mfui-NarrowViewportMainNavigation__lockIcon'), "aria-label": child.lockIconProps?.['aria-label'] ?? 'ロックされています' })) : null, child.statusSlot && child.locked !== true ? child.statusSlot : null] }) }) }) }, childIndex))) })] }, index));
|
|
65
65
|
})] })] })] }) }));
|
|
66
66
|
});
|
|
@@ -315,13 +315,14 @@ placeholder, emptyMessage, disabled, invalid, targetDOMNode, name, onChange, val
|
|
|
315
315
|
]);
|
|
316
316
|
// Render infinite scroll loading indicator
|
|
317
317
|
const renderInfiniteScrollLoading = useCallback(() => isInfiniteScrollLoading && enableInfiniteScroll ? (_jsx("div", { className: cx(classes.infiniteScrollLoading, 'mfui-MultipleSelectBox__infiniteScrollLoading'), children: _jsx(ProgressIndicator, {}) })) : null, [isInfiniteScrollLoading, enableInfiniteScroll, classes.infiniteScrollLoading]);
|
|
318
|
-
const searchNode = enableSearchOptions ? (_jsx(SearchBox, { ref: searchInputRef, enableClearButton: true, value: searchText, textBoxSize: "small", autoComplete: "off", onChange: onSearchTextChange, ...searchBoxProps })) : null;
|
|
318
|
+
const searchNode = enableSearchOptions ? (_jsx(SearchBox, { ref: searchInputRef, enableClearButton: true, value: searchText, textBoxSize: "small", autoComplete: "off", "aria-label": "\u691C\u7D22\u3059\u308B", onChange: onSearchTextChange, ...searchBoxProps })) : null;
|
|
319
319
|
const allOptionsControlsNode = enableAllOptionsControls ? (_jsxs(HStack, { justifyContent: "space-between", children: [_jsx(Button, { ref: selectAllButtonRef, size: "small", onClick: handleSelectAll, children: selectAllButtonProps?.label ?? 'すべて選択' }), _jsx(Button, { ref: clearAllButtonRef, size: "small", onClick: handleClearAll, children: clearAllButtonProps?.label ?? 'すべて解除' })] })) : null;
|
|
320
320
|
const selectedCountNode = enableApplyControls || showSelectedCount ? (_jsx(Typography, { variant: "body", color: "neutral.600", children: enableApplyControls
|
|
321
321
|
? (selectedCountProps?.render?.(temporaryValues.size) ?? `${String(temporaryValues.size)}件選択中`)
|
|
322
322
|
: (selectedCountProps?.render?.(localSelectedValuesSet.size) ??
|
|
323
323
|
`${String(localSelectedValuesSet.size)}件選択中`) })) : null;
|
|
324
324
|
const applyControlsNode = enableApplyControls ? (_jsxs(HStack, { gap: "horizontal.0-1of2", children: [_jsx(Button, { ref: cancelButtonRef, size: "small", priority: "secondary", onClick: handleCancelButtonClick, children: cancelButtonProps?.label ?? 'キャンセル' }), _jsx(Button, { ref: applyButtonRef, size: "small", priority: "primary", onClick: handleApplyButtonClick, children: applyButtonProps?.label ?? '適用' })] })) : null;
|
|
325
|
+
const resolvedNotFoundMessage = typeof notFoundMessage === 'function' ? notFoundMessage(searchText.trim()) : notFoundMessage;
|
|
325
326
|
const optionsNode = (_jsxs("div", { ref: scrollWrapperRef, className: cx(classes.scrollWrapper, 'mfui-MultipleSelectBox__scrollWrapper'), onScroll: enableInfiniteScroll ? handleInfiniteScroll : undefined, children: [_jsx("ul", { ref: listBoxRef, role: "listbox", id: listBoxId, className: cx(classes.listBox, 'mfui-MultipleSelectBox__listBox'), tabIndex: -1, style: isVirtualized && totalSize > 0
|
|
326
327
|
? {
|
|
327
328
|
height: `${String(totalSize)}px`,
|
|
@@ -338,10 +339,10 @@ placeholder, emptyMessage, disabled, invalid, targetDOMNode, name, onChange, val
|
|
|
338
339
|
!isVirtualized && renderInfiniteScrollError(),
|
|
339
340
|
].filter(Boolean)
|
|
340
341
|
: [
|
|
341
|
-
_jsx("li", { className: cx(classes.emptyMessage, 'mfui-MultipleSelectBox__emptyMessage'), children: _jsx(Typography, { variant: "body", children: enableSearchOptions && searchText &&
|
|
342
|
-
?
|
|
342
|
+
_jsx("li", { className: cx(classes.emptyMessage, 'mfui-MultipleSelectBox__emptyMessage'), children: _jsx(Typography, { variant: "body", children: enableSearchOptions && searchText && resolvedNotFoundMessage
|
|
343
|
+
? resolvedNotFoundMessage
|
|
343
344
|
: options.length > 0
|
|
344
|
-
?
|
|
345
|
+
? resolvedNotFoundMessage
|
|
345
346
|
: emptyMessage }) }, "empty"),
|
|
346
347
|
!isVirtualized && renderInfiniteScrollError(),
|
|
347
348
|
].filter(Boolean) }), isVirtualized ? renderInfiniteScrollLoading() : null, isVirtualized ? renderInfiniteScrollError('div') : null] }));
|
|
@@ -398,12 +398,23 @@ export type MultipleSelectBoxProps<T extends AllowedValueTypes = string, Additio
|
|
|
398
398
|
enableSearchOptions?: boolean;
|
|
399
399
|
/**
|
|
400
400
|
* The message to be displayed when the options are not found.
|
|
401
|
+
*
|
|
402
|
+
* Pass a function to include the current search text in the message,
|
|
403
|
+
* as recommended by the design guidelines.
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```tsx
|
|
407
|
+
* <MultipleSelectBox notFoundMessage={(searchText) => `${searchText}を含むオプションがありません。`} />
|
|
408
|
+
* ```
|
|
401
409
|
*/
|
|
402
|
-
notFoundMessage?: string;
|
|
410
|
+
notFoundMessage?: string | ((searchText: string) => React.ReactNode);
|
|
403
411
|
/**
|
|
404
412
|
* The properties for the SearchBox component.
|
|
413
|
+
*
|
|
414
|
+
* Pass `aria-label` to override the search input's default
|
|
415
|
+
* accessible name (`検索する`).
|
|
405
416
|
*/
|
|
406
|
-
searchBoxProps?: Pick<SearchBoxProps, 'clearButtonProps' | 'placeholder' | 'invalid'>;
|
|
417
|
+
searchBoxProps?: Pick<SearchBoxProps, 'clearButtonProps' | 'placeholder' | 'invalid' | 'aria-label'>;
|
|
407
418
|
/**
|
|
408
419
|
* The properties for the option panel element.
|
|
409
420
|
*
|
|
@@ -48,6 +48,6 @@ placeholder, renderDisplayValue, updateSelectedValues, clearButtonProps, disable
|
|
|
48
48
|
.map((option) => option.value)
|
|
49
49
|
.filter((v) => v != null)
|
|
50
50
|
.map(String);
|
|
51
|
-
return (_jsx(FocusIndicator, { children: _jsxs("div", { ref: wrapperRef, className: cx(classes.wrapper, 'mfui-MultipleSelectBoxTrigger__wrapper', triggerWrapperProps?.className), children: [_jsx("button", { ref: mergeRefs(ref, triggerRef), type: "button", role: "combobox", "aria-controls": listBoxId, "aria-expanded": isOptionPanelOpen, "aria-haspopup": "listbox", "aria-invalid": invalid, value: selectedValues, disabled: disabled, onKeyDown: onKeyDown, onBlur: onBlur, ...rest, ...triggerProps, className: cx(classes.trigger, 'mfui-MultipleSelectBoxTrigger__trigger', triggerProps?.className) }), _jsx("input", { type: "hidden", name: name, value: selectedValues }), _jsx("div", { className: cx(classes.displayValues, 'mfui-MultipleSelectBoxTrigger__displayValues'), "data-mfui-content": "multiple-select-box-trigger-display-values", children: renderer() }), selectedOptions.length > 0 && !disabled && !disableClearButton ? (_jsx("div", { className: cx(classes.clearButtonContainer, 'mfui-MultipleSelectBoxTrigger__clearButtonContainer'), children: _jsx(ClearButton, { size: size === 'small' ? 'small' : 'default', className: cx(classes.clearButton, 'mfui-MultipleSelectBoxTrigger__clearButton'), "aria-label": clearButtonProps?.['aria-label'] ?? '値をクリアする', "data-mfui-content": "multiple-select-box-clear-button", onClick: handleClearValue }) })) : null, _jsx("div", { className: cx(classes.dropdownIconContainer, 'mfui-MultipleSelectBoxTrigger__dropdownIconContainer'), children: _jsx(DropdownIcon, { className: cx(classes.dropdownIcon, 'mfui-MultipleSelectBoxTrigger__dropdownIcon') }) })] }) }));
|
|
51
|
+
return (_jsx(FocusIndicator, { children: _jsxs("div", { ref: wrapperRef, className: cx(classes.wrapper, 'mfui-MultipleSelectBoxTrigger__wrapper', triggerWrapperProps?.className), children: [_jsx("button", { ref: mergeRefs(ref, triggerRef), type: "button", role: "combobox", "aria-controls": listBoxId, "aria-expanded": isOptionPanelOpen, "aria-haspopup": "listbox", "aria-invalid": invalid, value: selectedValues, disabled: disabled, onKeyDown: onKeyDown, onBlur: onBlur, ...rest, ...triggerProps, className: cx(classes.trigger, 'mfui-MultipleSelectBoxTrigger__trigger', triggerProps?.className) }), _jsx("input", { type: "hidden", name: name, value: selectedValues }), _jsx("div", { className: cx(classes.displayValues, 'mfui-MultipleSelectBoxTrigger__displayValues'), "data-mfui-content": "multiple-select-box-trigger-display-values", children: renderer() }), selectedOptions.length > 0 && !disabled && !disableClearButton ? (_jsx("div", { className: cx(classes.clearButtonContainer, 'mfui-MultipleSelectBoxTrigger__clearButtonContainer'), children: _jsx(ClearButton, { size: size === 'small' ? 'small' : 'default', className: cx(classes.clearButton, 'mfui-MultipleSelectBoxTrigger__clearButton'), "aria-label": clearButtonProps?.['aria-label'] ?? '値をクリアする', "data-mfui-content": "multiple-select-box-clear-button", onClick: handleClearValue }) })) : null, _jsx("div", { className: cx(classes.dropdownIconContainer, 'mfui-MultipleSelectBoxTrigger__dropdownIconContainer'), children: _jsx(DropdownIcon, { "aria-hidden": "true", className: cx(classes.dropdownIcon, 'mfui-MultipleSelectBoxTrigger__dropdownIcon') }) })] }) }));
|
|
52
52
|
}
|
|
53
53
|
export const MultipleSelectBoxTrigger = forwardRef(MultipleSelectBoxTriggerInner);
|
|
@@ -12,7 +12,7 @@ export function PagePicker({ currentPageNumber, totalPages, prevButtonProps, pag
|
|
|
12
12
|
const classes = pagePickerSlotRecipe();
|
|
13
13
|
return (_jsxs("div", { className: cx(classes.root, 'mfui-PagePicker__root'), children: [_jsx(IconButton, { className: cx(classes.prevButton, 'mfui-PagePicker__prevButton'), disabled: currentPageNumber === 1, "aria-label": prevButtonProps?.['aria-label'] ?? '前のページへ戻る', onClick: () => {
|
|
14
14
|
onPageChange?.(currentPageNumber - 1);
|
|
15
|
-
}, children: _jsx(PickerBefore, {}) }), _jsx("div", { className: cx(classes.pageSelect, 'mfui-PagePicker__pageSelect'), children: _jsx(SelectBox, { size: "small", triggerProps: {
|
|
15
|
+
}, children: _jsx(PickerBefore, { "aria-hidden": "true" }) }), _jsx("div", { className: cx(classes.pageSelect, 'mfui-PagePicker__pageSelect'), children: _jsx(SelectBox, { size: "small", triggerProps: {
|
|
16
16
|
'aria-label': pageSelectBoxProps?.['aria-label'] ?? 'ページを選択する',
|
|
17
17
|
}, value: { value: currentPageNumber.toString(), label: currentPageNumber.toString() }, options: Array.from({ length: totalPages }).map((_, index) => ({
|
|
18
18
|
value: (index + 1).toString(),
|
|
@@ -21,5 +21,5 @@ export function PagePicker({ currentPageNumber, totalPages, prevButtonProps, pag
|
|
|
21
21
|
onPageChange?.(Number(option?.value));
|
|
22
22
|
} }) }), _jsx(Typography, { className: cx(classes.separator, 'mfui-PagePicker__separator'), children: "/" }), _jsxs(Typography, { className: cx(classes.totalPages, 'mfui-PagePicker__totalPages'), children: [totalPages, pageSuffixLabel] }), _jsx(IconButton, { className: cx(classes.nextButton, 'mfui-PagePicker__nextButton'), "aria-label": nextButtonProps?.['aria-label'] ?? '次のページへ進む', disabled: currentPageNumber === totalPages, onClick: () => {
|
|
23
23
|
onPageChange?.(currentPageNumber + 1);
|
|
24
|
-
}, children: _jsx(PickerAfter, {}) })] }));
|
|
24
|
+
}, children: _jsx(PickerAfter, { "aria-hidden": "true" }) })] }));
|
|
25
25
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The component wrapped the TextBox component with Search icon.
|
|
3
3
|
* Some props in the TextBox component are not supported.
|
|
4
|
+
*
|
|
5
|
+
* The input has no default accessible name. Provide one with `aria-label`
|
|
6
|
+
* or associate an external label with `aria-labelledby`.
|
|
4
7
|
*/
|
|
5
8
|
export declare const SearchBox: import("react").ForwardRefExoticComponent<Omit<import("..").TextBoxProps, "prefixSlot" | "suffixSlot"> & {
|
|
6
9
|
normalizeFullWidth?: boolean;
|
|
@@ -7,6 +7,9 @@ import { normalizeFullWidth } from '../utilities/string/normalizeFullWidth';
|
|
|
7
7
|
/**
|
|
8
8
|
* The component wrapped the TextBox component with Search icon.
|
|
9
9
|
* Some props in the TextBox component are not supported.
|
|
10
|
+
*
|
|
11
|
+
* The input has no default accessible name. Provide one with `aria-label`
|
|
12
|
+
* or associate an external label with `aria-labelledby`.
|
|
10
13
|
*/
|
|
11
14
|
export const SearchBox = forwardRef(({ className, normalizeFullWidth: shouldNormalizeFullWidth = false, onChange, ...rest }, ref) => {
|
|
12
15
|
const handleChange = useCallback((event) => {
|
|
@@ -18,5 +21,5 @@ export const SearchBox = forwardRef(({ className, normalizeFullWidth: shouldNorm
|
|
|
18
21
|
}
|
|
19
22
|
onChange?.(event);
|
|
20
23
|
}, [shouldNormalizeFullWidth, onChange]);
|
|
21
|
-
return (_jsx(TextBox, { ref: ref, prefixSlot: _jsx(Search, {}), className: cx('mfui-SearchBox__root', className), onChange: handleChange, ...rest }));
|
|
24
|
+
return (_jsx(TextBox, { ref: ref, prefixSlot: _jsx(Search, { "aria-hidden": "true" }), className: cx('mfui-SearchBox__root', className), onChange: handleChange, ...rest }));
|
|
22
25
|
});
|
|
@@ -208,7 +208,7 @@ export const SelectBox = forwardRef((props, ref) => {
|
|
|
208
208
|
}
|
|
209
209
|
return (_jsx(Typography, { variant: "controlLabel", className: cx(classes.placeholder, 'mfui-SelectBox__placeholder'), children: placeholder }));
|
|
210
210
|
};
|
|
211
|
-
const searchNode = enableSearchOptions ? (_jsx("div", { className: cx(classes.menuHeader, 'mfui-SelectBox__menuHeader'), children: _jsx(SearchBox, { ref: searchInputRef, enableClearButton: true, value: searchText, textBoxSize: "small", autoComplete: "off", onChange: onSearchTextChange, ...searchBoxProps }) })) : null;
|
|
211
|
+
const searchNode = enableSearchOptions ? (_jsx("div", { className: cx(classes.menuHeader, 'mfui-SelectBox__menuHeader'), children: _jsx(SearchBox, { ref: searchInputRef, enableClearButton: true, value: searchText, textBoxSize: "small", autoComplete: "off", "aria-label": "\u691C\u7D22\u3059\u308B", onChange: onSearchTextChange, ...searchBoxProps }) })) : null;
|
|
212
212
|
// Render virtualized items - extracted for better maintainability
|
|
213
213
|
const renderVirtualizedItems = useCallback(() => virtualItems.map((virtualItem) => {
|
|
214
214
|
const virtualizedItem = virtualizedItems[virtualItem.index];
|
|
@@ -278,11 +278,14 @@ export const SelectBox = forwardRef((props, ref) => {
|
|
|
278
278
|
createKeyDownHandler,
|
|
279
279
|
]);
|
|
280
280
|
// Render empty message - extracted for better maintainability
|
|
281
|
-
const renderEmptyMessage = useCallback(() =>
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
?
|
|
285
|
-
:
|
|
281
|
+
const renderEmptyMessage = useCallback(() => {
|
|
282
|
+
const resolvedNotFoundMessage = typeof notFoundMessage === 'function' ? notFoundMessage(searchText.trim()) : notFoundMessage;
|
|
283
|
+
return (_jsx("li", { className: cx(classes.emptyMessage, 'mfui-SelectBox__emptyMessage'), children: _jsx(Typography, { variant: "body", children: enableSearchOptions && searchText && resolvedNotFoundMessage
|
|
284
|
+
? resolvedNotFoundMessage
|
|
285
|
+
: options.length > 0
|
|
286
|
+
? resolvedNotFoundMessage
|
|
287
|
+
: emptyMessage }) }, "empty-message"));
|
|
288
|
+
}, [classes.emptyMessage, enableSearchOptions, searchText, notFoundMessage, options.length, emptyMessage]);
|
|
286
289
|
// Render infinite scroll error message with retry button
|
|
287
290
|
const renderInfiniteScrollError = useCallback((as = 'li') => {
|
|
288
291
|
if (!infiniteScrollError)
|
|
@@ -334,12 +334,23 @@ export type SelectBoxProps<T extends AllowedValueTypes = string, AdditionalProps
|
|
|
334
334
|
enableSearchOptions?: boolean;
|
|
335
335
|
/**
|
|
336
336
|
* The message to be displayed when the options are not found.
|
|
337
|
+
*
|
|
338
|
+
* Pass a function to include the current search text in the message,
|
|
339
|
+
* as recommended by the design guidelines.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```tsx
|
|
343
|
+
* <SelectBox notFoundMessage={(searchText) => `${searchText}を含むオプションがありません。`} />
|
|
344
|
+
* ```
|
|
337
345
|
*/
|
|
338
|
-
notFoundMessage?: string;
|
|
346
|
+
notFoundMessage?: string | ((searchText: string) => React.ReactNode);
|
|
339
347
|
/**
|
|
340
348
|
* The properties for the SearchBox component.
|
|
349
|
+
*
|
|
350
|
+
* Pass `aria-label` to override the search input's default
|
|
351
|
+
* accessible name (`検索する`).
|
|
341
352
|
*/
|
|
342
|
-
searchBoxProps?: Pick<SearchBoxProps, 'clearButtonProps' | 'placeholder'>;
|
|
353
|
+
searchBoxProps?: Pick<SearchBoxProps, 'clearButtonProps' | 'placeholder' | 'aria-label'>;
|
|
343
354
|
/**
|
|
344
355
|
* Flag to indicate loading state of the options.
|
|
345
356
|
* When true, the SelectBox will display skeleton placeholders
|
|
@@ -17,7 +17,7 @@ declare function SidebarBase({ className, logoSlot, mainNavigationItems, extraNa
|
|
|
17
17
|
* The following composition components are provided as sub-components:
|
|
18
18
|
* - `Sidebar.NavigationItem` — a single navigation item; `mainNavigationItems` renders these for you,
|
|
19
19
|
* but it can also be used directly inside `extraNavigationSlot`.
|
|
20
|
-
* - `Sidebar.ServiceMenu` — the
|
|
20
|
+
* - `Sidebar.ServiceMenu` — the header service menu trigger, intended to wrap a list of services.
|
|
21
21
|
* - `Sidebar.TenantMenu` — the footer tenant (business) name and its menu.
|
|
22
22
|
* - `Sidebar.UserMenu` — the footer user (account) name and its menu.
|
|
23
23
|
*
|
|
@@ -15,12 +15,12 @@ function SidebarBase({ className, logoSlot, mainNavigationItems, extraNavigation
|
|
|
15
15
|
defaultWidth,
|
|
16
16
|
onWidthChange,
|
|
17
17
|
});
|
|
18
|
-
return (_jsxs("div", { ref: rootRef, className: cx(classes.root, 'mfui-Sidebar__root', className), style: { width: `${String(width)}px` }, "data-mfui-dragging": isDragging ? true : undefined, children: [_jsx("header", { className: cx(classes.header, 'mfui-Sidebar__header'), children:
|
|
18
|
+
return (_jsxs("div", { ref: rootRef, className: cx(classes.root, 'mfui-Sidebar__root', className), style: { width: `${String(width)}px` }, "data-mfui-dragging": isDragging ? true : undefined, children: [_jsx("header", { className: cx(classes.header, 'mfui-Sidebar__header'), children: _jsxs("div", { className: cx(classes.leftPane, 'mfui-Sidebar__leftPane'), children: [serviceMenuSlot ? (_jsx("div", { className: cx(classes.serviceMenu, 'mfui-Sidebar__serviceMenu'), children: serviceMenuSlot })) : null, _jsx("div", { className: cx(classes.logo, 'mfui-Sidebar__logo'), children: logoSlot })] }) }), _jsxs("div", { className: cx(classes.navigationWrapper, 'mfui-Sidebar__navigationWrapper'), children: [mainNavigationItems && mainNavigationItems.length > 0 ? (_jsx("nav", { "aria-label": mainNavigationLabel, className: cx(classes.mainNavigation, 'mfui-Sidebar__mainNavigation'), children: _jsx("ul", { className: cx(classes.navigationList, 'mfui-Sidebar__navigationList'), children: mainNavigationItems.map((item, index) => {
|
|
19
19
|
if ('type' in item) {
|
|
20
20
|
return (_jsx("li", { "aria-hidden": "true", className: cx(classes.navigationDivider, 'mfui-Sidebar__navigationDivider') }, index));
|
|
21
21
|
}
|
|
22
22
|
return _jsx(SidebarNavigationItem, { ...item }, index);
|
|
23
|
-
}) }) })) : null, extraNavigationSlot ? (_jsx("nav", { "aria-label": extraNavigationLabel, className: cx(classes.extraNavigation, 'mfui-Sidebar__extraNavigation'), children: extraNavigationSlot })) : null] }), _jsxs("div", { className: cx(classes.footer, 'mfui-Sidebar__footer'), children: [footerSlot ? _jsx("div", { className: cx(classes.footerSlot, 'mfui-Sidebar__footerSlot'), children: footerSlot }) : null,
|
|
23
|
+
}) }) })) : null, extraNavigationSlot ? (_jsx("nav", { "aria-label": extraNavigationLabel, className: cx(classes.extraNavigation, 'mfui-Sidebar__extraNavigation'), children: extraNavigationSlot })) : null] }), _jsxs("div", { className: cx(classes.footer, 'mfui-Sidebar__footer'), children: [footerSlot ? _jsx("div", { className: cx(classes.footerSlot, 'mfui-Sidebar__footerSlot'), children: footerSlot }) : null, _jsx("div", { className: cx(classes.footerIconMenu, 'mfui-Sidebar__footerIconMenu'), children: footerIconMenuSlot }), tenantSlot || userSlot ? (_jsxs("div", { className: cx(classes.footerUserIdMenu, 'mfui-Sidebar__footerUserIdMenu'), children: [tenantSlot ? (_jsx("div", { className: cx(classes.footerUserIdMenuItem, 'mfui-Sidebar__footerUserIdMenuItem'), children: tenantSlot })) : null, userSlot ? (_jsx("div", { className: cx(classes.footerUserIdMenuItem, 'mfui-Sidebar__footerUserIdMenuItem'), children: userSlot })) : null] })) : null] }), _jsx("div", { "data-mfui-handle": true, "data-mfui-dragging": isDragging ? true : undefined, role: "separator", "aria-orientation": "vertical", "aria-label": resizeHandleLabel, "aria-valuenow": width, "aria-valuemin": resolvedMinWidth, "aria-valuemax": resolvedMaxWidth,
|
|
24
24
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
25
25
|
tabIndex: 0, className: cx(classes.handle, 'mfui-Sidebar__handle'), onPointerDown: handlePointerDown, onKeyDown: handleKeyDown })] }));
|
|
26
26
|
}
|
|
@@ -37,7 +37,7 @@ function SidebarBase({ className, logoSlot, mainNavigationItems, extraNavigation
|
|
|
37
37
|
* The following composition components are provided as sub-components:
|
|
38
38
|
* - `Sidebar.NavigationItem` — a single navigation item; `mainNavigationItems` renders these for you,
|
|
39
39
|
* but it can also be used directly inside `extraNavigationSlot`.
|
|
40
|
-
* - `Sidebar.ServiceMenu` — the
|
|
40
|
+
* - `Sidebar.ServiceMenu` — the header service menu trigger, intended to wrap a list of services.
|
|
41
41
|
* - `Sidebar.TenantMenu` — the footer tenant (business) name and its menu.
|
|
42
42
|
* - `Sidebar.UserMenu` — the footer user (account) name and its menu.
|
|
43
43
|
*
|
|
@@ -74,12 +74,12 @@ export type SidebarProps = {
|
|
|
74
74
|
*/
|
|
75
75
|
extraNavigationSlot?: ReactNode;
|
|
76
76
|
/**
|
|
77
|
-
* Elements to be displayed above the
|
|
77
|
+
* Elements to be displayed above the footer icon menu.
|
|
78
78
|
* This slot accepts any content.
|
|
79
79
|
*/
|
|
80
80
|
footerSlot?: ReactNode;
|
|
81
81
|
/**
|
|
82
|
-
* Elements to be displayed as the service menu in the
|
|
82
|
+
* Elements to be displayed as the service menu in the header, to the left of the logo.
|
|
83
83
|
* Intended for a dropdown menu listing available services.
|
|
84
84
|
*/
|
|
85
85
|
serviceMenuSlot: ReactNode;
|
|
@@ -14,10 +14,9 @@ export type SidebarServiceMenuProps = {
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
|
-
* The service switcher menu shown in the Sidebar
|
|
17
|
+
* The service switcher menu shown in the Sidebar header.
|
|
18
18
|
*
|
|
19
|
-
* It renders
|
|
20
|
-
*
|
|
21
|
-
* menu items only.
|
|
19
|
+
* It renders an icon-only trigger with a tooltip that opens a dropdown of services.
|
|
20
|
+
* The trigger design and accessibility are fixed; pass the label, icon, and menu items only.
|
|
22
21
|
*/
|
|
23
22
|
export declare function SidebarServiceMenu({ label, icon, children }: SidebarServiceMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { DropdownMenu } from '../DropdownMenu';
|
|
4
|
+
import { Tooltip } from '../Tooltip';
|
|
4
5
|
/**
|
|
5
|
-
* The service switcher menu shown in the Sidebar
|
|
6
|
+
* The service switcher menu shown in the Sidebar header.
|
|
6
7
|
*
|
|
7
|
-
* It renders
|
|
8
|
-
*
|
|
9
|
-
* menu items only.
|
|
8
|
+
* It renders an icon-only trigger with a tooltip that opens a dropdown of services.
|
|
9
|
+
* The trigger design and accessibility are fixed; pass the label, icon, and menu items only.
|
|
10
10
|
*/
|
|
11
11
|
export function SidebarServiceMenu({ label, icon, children }) {
|
|
12
|
-
return (_jsx(DropdownMenu, { label: label,
|
|
13
|
-
priority: 'tertiary',
|
|
14
|
-
size: 'small',
|
|
15
|
-
isDropdownTrigger: false,
|
|
16
|
-
leftIcon: icon,
|
|
17
|
-
// Styled via the `serviceMenu` slot's `& .mfui-Sidebar__serviceTrigger` descendant selector.
|
|
18
|
-
className: 'mfui-Sidebar__serviceTrigger',
|
|
19
|
-
}, menuPopoverProps: { allowedPlacements: ['top-start'] }, children: children }));
|
|
12
|
+
return (_jsx(Tooltip, { content: label, placement: "bottom", children: _jsx(DropdownMenu, { label: label, icon: icon, menuPopoverProps: { allowedPlacements: ['bottom-start'] }, children: children }) }));
|
|
20
13
|
}
|
|
@@ -42,7 +42,7 @@ const renderNavigationItem = (navigationItem, customLinkComponent, classes, nest
|
|
|
42
42
|
return (_jsxs(_Fragment, { children: [_jsx(NavigationLink, { navigationItem: navigationItem, customLinkComponent: customLinkComponent, classes: classes, renderNavigationLabel: renderNavigationLabel }), _jsx(NestedNavigationList, { summarySlot: _jsx("div", { "data-mfui-content": "sub-navigation-disclosure-icon", className: cx(classes.disclosureIcon, 'mfui-SubNavigation__disclosureIcon'), children: _jsx(DisclosureBasicCollapsed, { "aria-label": label }) }), nestedNavigationItems: children, customLinkComponent: customLinkComponent, classes: classes, nestLevel: nestLevel + 1, renderNavigationLabel: renderNavigationLabel })] }));
|
|
43
43
|
}
|
|
44
44
|
// The the parent item will be rendered as a disclosure button with an icon.
|
|
45
|
-
return (_jsx(NestedNavigationList, { summarySlot: _jsxs(_Fragment, { children: [_jsx(NavigationLabelGroup, { label, labelIcon, locked, lockIconProps, statusSlot, classes, renderNavigationLabel }), _jsx("div", { "data-mfui-content": "sub-navigation-disclosure-icon", className: cx(classes.disclosureIcon, 'mfui-SubNavigation__disclosureIcon'), children: _jsx(DisclosureBasicCollapsed, { "aria-
|
|
45
|
+
return (_jsx(NestedNavigationList, { summarySlot: _jsxs(_Fragment, { children: [_jsx(NavigationLabelGroup, { label, labelIcon, locked, lockIconProps, statusSlot, classes, renderNavigationLabel }), _jsx("div", { "data-mfui-content": "sub-navigation-disclosure-icon", className: cx(classes.disclosureIcon, 'mfui-SubNavigation__disclosureIcon'), children: _jsx(DisclosureBasicCollapsed, { "aria-hidden": "true" }) })] }), nestedNavigationItems: children, customLinkComponent: customLinkComponent, classes: classes, nestLevel: nestLevel + 1, renderNavigationLabel: renderNavigationLabel }));
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* This is a group of a text label, an optional icon, and a status.
|
|
@@ -59,7 +59,7 @@ function NavigationLabelGroup({ label, labelIcon, locked, lockIconProps, statusS
|
|
|
59
59
|
}
|
|
60
60
|
return null;
|
|
61
61
|
};
|
|
62
|
-
return (_jsxs(_Fragment, { children: [labelIcon ? _jsx("div", { className: cx(classes.labelIcon, 'mfui-SubNavigation__labelIcon'), children: labelIcon }) : null, renderNavigationLabel ? (renderNavigationLabel(label)) : (_jsx(Typography, { variant: "strongControlLabel", className: cx(classes.label, 'mfui-SubNavigation__label'), children: label })), renderStatus()] }));
|
|
62
|
+
return (_jsxs(_Fragment, { children: [labelIcon ? (_jsx("div", { "aria-hidden": "true", className: cx(classes.labelIcon, 'mfui-SubNavigation__labelIcon'), children: labelIcon })) : null, renderNavigationLabel ? (renderNavigationLabel(label)) : (_jsx(Typography, { variant: "strongControlLabel", className: cx(classes.label, 'mfui-SubNavigation__label'), children: label })), renderStatus()] }));
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* This is a link that has NavigationLabelGroup.
|
|
@@ -10,7 +10,7 @@ type DayCellSlotRecipeVariantMap = {
|
|
|
10
10
|
[key in keyof DayCellSlotRecipeVariant]: Array<DayCellSlotRecipeVariant[key]>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
type DayCellSlotRecipeSlot = "root" | "label"
|
|
13
|
+
type DayCellSlotRecipeSlot = "root" | "label" | "srOnlyLabel"
|
|
14
14
|
|
|
15
15
|
export type DayCellSlotRecipeVariantProps = {
|
|
16
16
|
[key in keyof DayCellSlotRecipeVariant]?: ConditionalValue<DayCellSlotRecipeVariant[key]> | undefined
|
|
@@ -10,6 +10,10 @@ const dayCellSlotRecipeSlotNames = [
|
|
|
10
10
|
[
|
|
11
11
|
"label",
|
|
12
12
|
"DayCell__label"
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"srOnlyLabel",
|
|
16
|
+
"DayCell__srOnlyLabel"
|
|
13
17
|
]
|
|
14
18
|
];
|
|
15
19
|
const dayCellSlotRecipeSlotFns = /* @__PURE__ */ dayCellSlotRecipeSlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, dayCellSlotRecipeDefaultVariants, getSlotCompoundVariant(dayCellSlotRecipeCompoundVariants, slotName))]);
|