Skip to content

Commit

Permalink
Merge branch 'devel' into CB-5807-localize-backend-text
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniaBzzz authored Dec 13, 2024
2 parents 8bbb7ce + ea342f0 commit f5eec50
Show file tree
Hide file tree
Showing 59 changed files with 1,087 additions and 1,835 deletions.
6 changes: 5 additions & 1 deletion webapp/packages/core-blocks/src/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useCombinedRef } from '../useCombinedRef.js';
import { useObjectRef } from '../useObjectRef.js';
import { useS } from '../useS.js';
import style from './Menu.module.css';
import { MenuPanel } from './MenuPanel.js';
import { type IMenuPanelProps, MenuPanel } from './MenuPanel.js';
import { type IMenuState, MenuStateContext } from './MenuStateContext.js';
import type { IMouseContextMenu } from './useMouseContextMenu.js';

Expand All @@ -33,6 +33,7 @@ interface IMenuProps extends React.ButtonHTMLAttributes<any> {
rtl?: boolean;
hasBindings?: boolean;
panelAvailable?: boolean;
panelProps?: Partial<IMenuPanelProps>;
getHasBindings?: () => boolean;
onVisibleSwitch?: (visible: boolean) => void;
}
Expand All @@ -55,6 +56,7 @@ export const Menu = observer<IMenuProps, HTMLButtonElement>(
modal,
submenu,
rtl,
panelProps,
className,
...props
},
Expand Down Expand Up @@ -153,6 +155,7 @@ export const Menu = observer<IMenuProps, HTMLButtonElement>(
panelAvailable={panelAvailable}
hasBindings={hasBindings}
getHasBindings={getHasBindings}
{...panelProps}
>
{items}
</MenuPanel>
Expand Down Expand Up @@ -187,6 +190,7 @@ export const Menu = observer<IMenuProps, HTMLButtonElement>(
panelAvailable={panelAvailable}
hasBindings={hasBindings}
getHasBindings={getHasBindings}
{...panelProps}
>
{items}
</MenuPanel>
Expand Down
13 changes: 9 additions & 4 deletions webapp/packages/core-blocks/src/Menu/MenuPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import { Menu, type MenuStateReturn } from 'reakit';

import { ErrorBoundary } from '../ErrorBoundary.js';
import { getComputed } from '../getComputed.js';
import { useTranslate } from '../localization/useTranslate.js';
import { s } from '../s.js';
import { useS } from '../useS.js';
import { MenuEmptyItem } from './MenuEmptyItem.js';
import style from './MenuPanel.module.css';

export interface IMenuPanelProps {
export interface IMenuPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
label: string;
menu: MenuStateReturn; // from reakit useMenuState
panelAvailable?: boolean;
Expand All @@ -25,11 +26,14 @@ export interface IMenuPanelProps {
children: React.ReactNode | (() => React.ReactNode);
rtl?: boolean;
submenu?: boolean;
className?: string;
}

export const MenuPanel = observer<IMenuPanelProps, HTMLDivElement>(
forwardRef(function MenuPanel({ label, menu, submenu, panelAvailable = true, rtl, getHasBindings, hasBindings, children, className }, ref) {
forwardRef(function MenuPanel(
{ label, menu, submenu, panelAvailable = true, rtl, getHasBindings, hasBindings, children, className, ...rest },
ref,
) {
const translate = useTranslate();
const styles = useS(style);
const visible = menu.visible;

Expand All @@ -51,8 +55,9 @@ export const MenuPanel = observer<IMenuPanelProps, HTMLDivElement>(
ref={ref}
className={s(styles, { menu: true, modal: menu.modal, submenu }, className)}
{...menu}
aria-label={label}
aria-label={translate(label)}
visible={panelAvailable}
{...rest}
>
<div dir={rtl ? 'rtl' : undefined} data-s-has-bindings={hasBindings} className={s(styles, { menuBox: true })}>
{Children.count(renderedChildren) === 0 && <MenuEmptyItem />}
Expand Down
58 changes: 0 additions & 58 deletions webapp/packages/core-blocks/src/MenuPanel/MenuPanelItem.tsx

This file was deleted.

250 changes: 0 additions & 250 deletions webapp/packages/core-blocks/src/MenuPanel/MenuTrigger.tsx

This file was deleted.

Loading

0 comments on commit f5eec50

Please sign in to comment.