@fibery/ui-kit 1.37.0 → 1.38.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/CHANGELOG.md +14 -0
- package/package.json +8 -5
- package/src/actions-menu/actions-menu-item.tsx +18 -6
- package/src/actions-menu/actions-menu-props.tsx +4 -0
- package/src/actions-menu/actions-menu-sub-command-menu.tsx +7 -4
- package/src/actions-menu/actions-menu-sub-menu.tsx +9 -3
- package/src/actions-menu/actions-menu.tsx +24 -8
- package/src/actions-panel.tsx +12 -2
- package/src/axis-header.tsx +136 -76
- package/src/box.tsx +1 -1
- package/src/breadcrumb.tsx +78 -0
- package/src/button/actions-button-compact.tsx +4 -1
- package/src/button/base-button.tsx +5 -3
- package/src/button/button-group.tsx +1 -1
- package/src/button/button.tsx +31 -0
- package/src/button/icon-button.tsx +9 -0
- package/src/button/select-button.tsx +4 -0
- package/src/card-container.tsx +7 -4
- package/src/color-picker/swatch.tsx +1 -0
- package/src/command-menu/index.tsx +3 -3
- package/src/context-menu/index.tsx +10 -1
- package/src/date-picker/date-range-picker.tsx +6 -3
- package/src/date-picker/relative-date-picker.tsx +6 -2
- package/src/date-picker/single-date-picker.tsx +8 -5
- package/src/date-picker/styles.ts +32 -26
- package/src/date-picker/types.ts +3 -1
- package/src/day-select/day-select.tsx +21 -75
- package/src/day-select/iso-week-day-select.tsx +1 -1
- package/src/day-select/mount-day-select.tsx +2 -2
- package/src/day-select/week-day-select.tsx +1 -5
- package/src/design-system.ts +21 -12
- package/src/dropdown-menu/index.tsx +8 -1
- package/src/emoji-picker/app-icon-picker.tsx +6 -4
- package/src/emoji-picker/emoji-picker-preview-footer.tsx +1 -1
- package/src/emoji-picker/emoji-picker.tsx +3 -0
- package/src/emoji-picker/emoji.tsx +2 -1
- package/src/emoji-picker/icon-emoji-picker.tsx +10 -1
- package/src/emoji-picker/primitives/footer.tsx +0 -1
- package/src/emoji-picker/primitives/skin-tone.tsx +1 -0
- package/src/emoji-picker/use-responsive-emoji-size.ts +11 -0
- package/src/emoji-picker/utils/emoji-set.ts +2 -1
- package/src/empty-state/empty-state.tsx +6 -0
- package/src/field-icon.tsx +4 -1
- package/src/file-item.tsx +164 -47
- package/src/html-styles.ts +8 -0
- package/src/icons/ast/ActivityFilled.ts +8 -0
- package/src/icons/ast/AiAssistantFilled.ts +8 -0
- package/src/icons/ast/CollapseAllHorizontal.ts +8 -0
- package/src/icons/ast/DateRange.ts +1 -1
- package/src/icons/ast/EntityCreateFilled.ts +8 -0
- package/src/icons/ast/ExpandAllHorizontal.ts +8 -0
- package/src/icons/ast/GlobeUnpublish.ts +8 -0
- package/src/icons/ast/HomeFilled.ts +8 -0
- package/src/icons/ast/KeyboardHideDown.ts +8 -0
- package/src/icons/ast/LayoutMultiple.ts +8 -0
- package/src/icons/ast/RicheditorHistoryRedo.ts +1 -1
- package/src/icons/ast/RicheditorHistoryUndo.ts +1 -1
- package/src/icons/ast/SearchFilled.ts +8 -0
- package/src/icons/ast/SettingsFilled.ts +8 -0
- package/src/icons/ast/SlideMenuFilled.ts +8 -0
- package/src/icons/ast/TypeDate.ts +1 -1
- package/src/icons/ast/index.tsx +12 -0
- package/src/icons/react/ActivityFilled.tsx +13 -0
- package/src/icons/react/AiAssistantFilled.tsx +13 -0
- package/src/icons/react/CollapseAllHorizontal.tsx +13 -0
- package/src/icons/react/EntityCreateFilled.tsx +13 -0
- package/src/icons/react/ExpandAllHorizontal.tsx +13 -0
- package/src/icons/react/GlobeUnpublish.tsx +13 -0
- package/src/icons/react/HomeFilled.tsx +13 -0
- package/src/icons/react/KeyboardHideDown.tsx +13 -0
- package/src/icons/react/LayoutMultiple.tsx +13 -0
- package/src/icons/react/SearchFilled.tsx +13 -0
- package/src/icons/react/SettingsFilled.tsx +13 -0
- package/src/icons/react/SlideMenuFilled.tsx +13 -0
- package/src/icons/react/index.tsx +12 -0
- package/src/icons/svg/activity-filled.svg +4 -0
- package/src/icons/svg/ai-assistant-filled.svg +3 -0
- package/src/icons/svg/collapse-all-horizontal.svg +3 -0
- package/src/icons/svg/date-range.svg +3 -3
- package/src/icons/svg/entity-create-filled.svg +4 -0
- package/src/icons/svg/expand-all-horizontal.svg +3 -0
- package/src/icons/svg/globe-unpublish.svg +4 -0
- package/src/icons/svg/home-filled.svg +3 -0
- package/src/icons/svg/keyboard-hide-down.svg +1 -0
- package/src/icons/svg/layout-multiple.svg +3 -0
- package/src/icons/svg/richeditor/history/redo.svg +3 -2
- package/src/icons/svg/richeditor/history/undo.svg +3 -2
- package/src/icons/svg/search-filled.svg +3 -0
- package/src/icons/svg/settings-filled.svg +3 -0
- package/src/icons/svg/slide-menu-filled.svg +1 -0
- package/src/icons/svg/type/date.svg +3 -2
- package/src/images-gallery/images-gallery.tsx +254 -0
- package/src/images-gallery/zoom.tsx +112 -0
- package/src/is-in-popup.ts +1 -1
- package/src/layout-styles.ts +21 -1
- package/src/lists/actions-menu-row-surface.tsx +3 -1
- package/src/lists/list-row-surface.tsx +7 -1
- package/src/mobile-keyboard-aware-popup.tsx +87 -0
- package/src/mobile-styles.ts +8 -0
- package/src/modal-menu/contexts/modal-menu-context.tsx +22 -0
- package/src/modal-menu/contexts/modal-submenu-context.tsx +16 -0
- package/src/modal-menu/index.tsx +14 -0
- package/src/modal-menu/modal-menu-content.tsx +68 -0
- package/src/modal-menu/modal-menu-group.tsx +10 -0
- package/src/modal-menu/modal-menu-item.tsx +37 -0
- package/src/modal-menu/modal-menu-label.tsx +24 -0
- package/src/modal-menu/modal-menu-root.tsx +57 -0
- package/src/modal-menu/modal-menu-separator.tsx +14 -0
- package/src/modal-menu/modal-menu-trigger.tsx +37 -0
- package/src/modal-menu/modal-submenu-content.tsx +49 -0
- package/src/modal-menu/modal-submenu-trigger.tsx +34 -0
- package/src/modal-menu/modal-submenu.tsx +17 -0
- package/src/online-users.tsx +3 -3
- package/src/palette.ts +1 -1
- package/src/popover/index.tsx +687 -0
- package/src/popover/mobile-popup-context.tsx +29 -0
- package/src/{popup → popover}/modifiers.tsx +0 -7
- package/src/{popup → popover}/popup-modifiers-context.ts +3 -3
- package/src/reactions/reaction-button.tsx +30 -45
- package/src/reactions/reaction-picker.tsx +39 -45
- package/src/select/index.tsx +8 -4
- package/src/select/select-in-popover.tsx +21 -33
- package/src/tab-nav/tab-nav.tsx +35 -9
- package/src/toast/primitives.tsx +8 -1
- package/src/toggle-button/round-toggle-button.tsx +23 -0
- package/src/toggle-button/toggle-button-group.tsx +34 -0
- package/src/toggle-button/toggle-button.tsx +164 -0
- package/src/toggle.tsx +3 -3
- package/src/tooltip.tsx +2 -2
- package/src/unit/styles.ts +2 -2
- package/src/use-is-phone.tsx +28 -3
- package/src/use-is-support-hover.ts +1 -1
- package/src/use-on-screen-keyboard-data.tsx +66 -0
- package/src/workflow-progress-icon.tsx +16 -22
- package/src/popup/index.tsx +0 -383
- /package/src/{popup → popover}/popup-stack-context.tsx +0 -0
- /package/src/{popup → popover}/reference.ts +0 -0
- /package/src/{popup → popover}/styles.ts +0 -0
- /package/src/{popup → popover}/use-click-outside.ts +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
2
|
+
|
|
3
|
+
export type ModalSubmenuContext = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
depth: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// The default value below is only used to provide initial depth of 0
|
|
10
|
+
const [ModalSubmenuContextPovider, useModalSubmenu] = createContext<ModalSubmenuContext>("ModalSubmenuContext", {
|
|
11
|
+
id: "root",
|
|
12
|
+
title: "Root",
|
|
13
|
+
depth: 0,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export {ModalSubmenuContextPovider, useModalSubmenu};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is designed to be drop-in compatible with dropdown-menu or context-menu
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {ModalMenuRoot as Root} from "./modal-menu-root";
|
|
6
|
+
export {ModalMenuTrigger as Trigger} from "./modal-menu-trigger";
|
|
7
|
+
export {ModalMenuContent as Content} from "./modal-menu-content";
|
|
8
|
+
export {ModalMenuItem as Item} from "./modal-menu-item";
|
|
9
|
+
export {ModalMenuSeparator as Separator} from "./modal-menu-separator";
|
|
10
|
+
export {ModalMenuLabel as Label} from "./modal-menu-label";
|
|
11
|
+
export {ModalMenuGroup as Group} from "./modal-menu-group";
|
|
12
|
+
export {ModalSubmenu as Sub} from "./modal-submenu";
|
|
13
|
+
export {ModalSubmenuTrigger as SubTrigger} from "./modal-submenu-trigger";
|
|
14
|
+
export {ModalSubmenuContent as SubContent} from "./modal-submenu-content";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
import {createPortal} from "react-dom";
|
|
3
|
+
import {css} from "@linaria/core";
|
|
4
|
+
import {MobilePopup} from "../popover";
|
|
5
|
+
import {space, themeVars} from "../design-system";
|
|
6
|
+
import {getPopupContainerElement} from "../utils-dom";
|
|
7
|
+
import {CommandMenuList, CommandMenuRoot} from "../command-menu";
|
|
8
|
+
import {useModalMenu} from "./contexts/modal-menu-context";
|
|
9
|
+
|
|
10
|
+
interface ModalMenuContentProps {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ModalMenuContent = ({children}: ModalMenuContentProps) => {
|
|
15
|
+
const {open, title, submenuStack, setContentContainer, onOpenChange, onNavigateBack, height} = useModalMenu();
|
|
16
|
+
|
|
17
|
+
if (!open) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const content = (
|
|
22
|
+
<div
|
|
23
|
+
ref={setContentContainer}
|
|
24
|
+
className={css`
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
& ${CommandMenuRoot}:is(${CommandMenuRoot}) {
|
|
30
|
+
padding: 0 ${space.s4}px;
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
& ${CommandMenuList}:is(${CommandMenuList}) {
|
|
34
|
+
max-height: unset;
|
|
35
|
+
}
|
|
36
|
+
`}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
className={css`
|
|
40
|
+
position: absolute;
|
|
41
|
+
background: ${themeVars.actionMenuBg};
|
|
42
|
+
inset: 0;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
`}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
{/* Here the submenus will render via portals */}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return createPortal(
|
|
53
|
+
<MobilePopup
|
|
54
|
+
height={height}
|
|
55
|
+
title={submenuStack.at(-1)?.title ?? title}
|
|
56
|
+
content={content}
|
|
57
|
+
onClose={() => onOpenChange(false)}
|
|
58
|
+
onNavigateBack={
|
|
59
|
+
submenuStack.length === 0
|
|
60
|
+
? undefined
|
|
61
|
+
: () => {
|
|
62
|
+
onNavigateBack();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/>,
|
|
66
|
+
getPopupContainerElement()
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {ReactNode} from "react";
|
|
3
|
+
|
|
4
|
+
interface ModalMenuGroupProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ModalMenuGroup = ({children}: ModalMenuGroupProps) => {
|
|
9
|
+
return <div className={css``}>{children}</div>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
2
|
+
import {ComponentProps, ReactNode} from "react";
|
|
3
|
+
import {space, textStyles} from "../design-system";
|
|
4
|
+
import {useModalMenu} from "./contexts/modal-menu-context";
|
|
5
|
+
|
|
6
|
+
interface ModalMenuItemProps extends Omit<ComponentProps<"div">, "onSelect"> {
|
|
7
|
+
onSelect?: (event: Event) => void;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ModalMenuItem = ({children, onSelect, ...otherProps}: ModalMenuItemProps) => {
|
|
12
|
+
const {onOpenChange} = useModalMenu();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
role="button"
|
|
17
|
+
{...otherProps}
|
|
18
|
+
className={cx(
|
|
19
|
+
otherProps.className,
|
|
20
|
+
css`
|
|
21
|
+
${textStyles.big}
|
|
22
|
+
padding: ${space.s10}px ${space.s16}px ${space.s10}px ${space.s16}px;
|
|
23
|
+
`
|
|
24
|
+
)}
|
|
25
|
+
onClick={(event) => {
|
|
26
|
+
otherProps.onClick?.(event);
|
|
27
|
+
const selectionEvent = new CustomEvent("modal-menu-select", {bubbles: true, cancelable: true});
|
|
28
|
+
onSelect?.(selectionEvent);
|
|
29
|
+
if (!selectionEvent.defaultPrevented) {
|
|
30
|
+
onOpenChange(false);
|
|
31
|
+
}
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {ReactNode} from "react";
|
|
3
|
+
import {layoutVars, space, textStyles, themeVars} from "../design-system";
|
|
4
|
+
|
|
5
|
+
interface ModalMenuLabelProps {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ModalMenuLabel = ({children}: ModalMenuLabelProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<div
|
|
12
|
+
className={css`
|
|
13
|
+
${textStyles.big}
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
padding: ${space.s10}px ${space.s16}px ${space.s10}px ${space.s16}px;
|
|
17
|
+
min-height: ${layoutVars.sidebarMenuItemHeight};
|
|
18
|
+
color: ${themeVars.accentTextColor} !important;
|
|
19
|
+
`}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {ReactNode, RefObject, useCallback, useMemo, useState} from "react";
|
|
2
|
+
import {ModalMenuContextProvider, SubmenuItem} from "./contexts/modal-menu-context";
|
|
3
|
+
|
|
4
|
+
interface ModalMenuRootProps {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
contentRef?: RefObject<HTMLDivElement>;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ModalMenuRoot = ({
|
|
14
|
+
open,
|
|
15
|
+
title = "Actions",
|
|
16
|
+
children,
|
|
17
|
+
onOpenChange: _onOpenChange,
|
|
18
|
+
height,
|
|
19
|
+
}: ModalMenuRootProps) => {
|
|
20
|
+
const [submenuStack, setSubmenuStack] = useState<SubmenuItem[]>([]);
|
|
21
|
+
const [contentContainer, setContentContainer] = useState<HTMLDivElement | null>(null);
|
|
22
|
+
|
|
23
|
+
const onOpenChange = useCallback(
|
|
24
|
+
(open: boolean) => {
|
|
25
|
+
_onOpenChange?.(open);
|
|
26
|
+
if (!open) {
|
|
27
|
+
setSubmenuStack([]);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
[_onOpenChange]
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const onOpenSubmenu = useCallback((item: SubmenuItem) => {
|
|
34
|
+
setSubmenuStack((stack) => [...stack, item]);
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const onNavigateBack = useCallback(() => {
|
|
38
|
+
setSubmenuStack((stack) => stack.slice(0, -1));
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const contextValue = useMemo(
|
|
42
|
+
() => ({
|
|
43
|
+
title,
|
|
44
|
+
open: open ?? false,
|
|
45
|
+
submenuStack,
|
|
46
|
+
contentContainer,
|
|
47
|
+
setContentContainer,
|
|
48
|
+
onOpenChange,
|
|
49
|
+
onOpenSubmenu,
|
|
50
|
+
onNavigateBack,
|
|
51
|
+
height,
|
|
52
|
+
}),
|
|
53
|
+
[open, title, submenuStack, contentContainer, onOpenChange, onOpenSubmenu, onNavigateBack, height]
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return <ModalMenuContextProvider value={contextValue}>{children}</ModalMenuContextProvider>;
|
|
57
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {space, themeVars} from "../design-system";
|
|
3
|
+
|
|
4
|
+
export const ModalMenuSeparator = () => {
|
|
5
|
+
return (
|
|
6
|
+
<hr
|
|
7
|
+
className={css`
|
|
8
|
+
border: none;
|
|
9
|
+
border-bottom: 1px solid ${themeVars.separatorColor};
|
|
10
|
+
margin: ${space.s4}px 0;
|
|
11
|
+
`}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {cx} from "@linaria/core";
|
|
2
|
+
import {cloneElement, ComponentProps, ReactHTMLElement, ReactNode} from "react";
|
|
3
|
+
import {useModalMenu} from "./contexts/modal-menu-context";
|
|
4
|
+
|
|
5
|
+
interface ModalMenuTriggerProps extends ComponentProps<"div"> {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
children: ReactHTMLElement<HTMLDivElement> | ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ModalMenuTrigger = ({asChild, children, onClick, ...otherProps}: ModalMenuTriggerProps) => {
|
|
11
|
+
const {open, onOpenChange} = useModalMenu();
|
|
12
|
+
if (asChild) {
|
|
13
|
+
const className = (children as ReactHTMLElement<HTMLDivElement>)?.props?.className;
|
|
14
|
+
return cloneElement(children as ReactHTMLElement<HTMLDivElement>, {
|
|
15
|
+
...otherProps,
|
|
16
|
+
className: cx(className, otherProps.className),
|
|
17
|
+
onClick: (event) => {
|
|
18
|
+
onClick?.(event);
|
|
19
|
+
onOpenChange(!open);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div
|
|
26
|
+
role="button"
|
|
27
|
+
{...otherProps}
|
|
28
|
+
className={otherProps.className}
|
|
29
|
+
onClick={(event) => {
|
|
30
|
+
onClick?.(event);
|
|
31
|
+
onOpenChange(!open);
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {ReactNode} from "react";
|
|
2
|
+
import {createPortal} from "react-dom";
|
|
3
|
+
import {css} from "@linaria/core";
|
|
4
|
+
import {themeVars, transition} from "../design-system";
|
|
5
|
+
import {useModalMenu} from "./contexts/modal-menu-context";
|
|
6
|
+
import {useModalSubmenu} from "./contexts/modal-submenu-context";
|
|
7
|
+
|
|
8
|
+
interface ModalSubmenuContentProps {
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ModalSubmenuContent = ({children}: ModalSubmenuContentProps) => {
|
|
13
|
+
const {contentContainer, submenuStack} = useModalMenu();
|
|
14
|
+
const {id, depth} = useModalSubmenu();
|
|
15
|
+
|
|
16
|
+
const open = submenuStack.some((item) => item.id === id);
|
|
17
|
+
|
|
18
|
+
if (!contentContainer || !open) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return createPortal(
|
|
23
|
+
<div
|
|
24
|
+
className={css`
|
|
25
|
+
position: absolute;
|
|
26
|
+
background: ${themeVars.actionMenuBg};
|
|
27
|
+
inset: 0;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
|
|
30
|
+
transition: transform ${transition}, opacity ${transition};
|
|
31
|
+
transform: translateX(0);
|
|
32
|
+
opacity: 1;
|
|
33
|
+
|
|
34
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
35
|
+
@starting-style {
|
|
36
|
+
transform: translateX(20%);
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`}
|
|
41
|
+
style={{
|
|
42
|
+
zIndex: depth,
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</div>,
|
|
47
|
+
contentContainer
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
2
|
+
import {ComponentProps, ReactHTMLElement} from "react";
|
|
3
|
+
import {space, textStyles} from "../design-system";
|
|
4
|
+
import {useModalMenu} from "./contexts/modal-menu-context";
|
|
5
|
+
import {useModalSubmenu} from "./contexts/modal-submenu-context";
|
|
6
|
+
|
|
7
|
+
interface ModalSubmenuTriggerProps extends ComponentProps<"div"> {
|
|
8
|
+
children: ReactHTMLElement<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ModalSubmenuTrigger = ({children, ...otherProps}: ModalSubmenuTriggerProps) => {
|
|
12
|
+
const {onOpenSubmenu} = useModalMenu();
|
|
13
|
+
const {id, title} = useModalSubmenu();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
role="button"
|
|
18
|
+
{...otherProps}
|
|
19
|
+
className={cx(
|
|
20
|
+
otherProps.className,
|
|
21
|
+
css`
|
|
22
|
+
${textStyles.big}
|
|
23
|
+
padding: ${space.s10}px ${space.s16}px ${space.s10}px ${space.s16}px;
|
|
24
|
+
`
|
|
25
|
+
)}
|
|
26
|
+
onClick={(event) => {
|
|
27
|
+
otherProps.onClick?.(event);
|
|
28
|
+
onOpenSubmenu({id, title});
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {ReactNode, useId, useMemo} from "react";
|
|
2
|
+
import {ModalSubmenuContextPovider, useModalSubmenu} from "./contexts/modal-submenu-context";
|
|
3
|
+
|
|
4
|
+
interface ModalSubmenuProps {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
title?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ModalSubmenu = ({title = "Submenu", children}: ModalSubmenuProps) => {
|
|
12
|
+
const id = useId();
|
|
13
|
+
const {depth} = useModalSubmenu();
|
|
14
|
+
const contextValue = useMemo(() => ({id, title, depth: depth + 1}), [id, title, depth]);
|
|
15
|
+
|
|
16
|
+
return <ModalSubmenuContextPovider value={contextValue}>{children}</ModalSubmenuContextPovider>;
|
|
17
|
+
};
|
package/src/online-users.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import _ from "lodash";
|
|
|
3
3
|
import {useEffect, useRef, useState} from "react";
|
|
4
4
|
import {AvatarImage} from "./avatar";
|
|
5
5
|
import {getObjectColorMemoized, space, themeVars, tooltipDelay} from "./design-system";
|
|
6
|
-
import {
|
|
6
|
+
import {PopoverOld} from "./popover";
|
|
7
7
|
import {Tooltip} from "./tooltip";
|
|
8
8
|
|
|
9
9
|
const offset = [0, space.s6] as [number, number];
|
|
@@ -184,7 +184,7 @@ export function OnlineUsers({
|
|
|
184
184
|
)}
|
|
185
185
|
</div>
|
|
186
186
|
{Boolean(triggerElement) && users.length > maxVisibleUsers && (
|
|
187
|
-
<
|
|
187
|
+
<PopoverOld
|
|
188
188
|
offset={offset}
|
|
189
189
|
popupContainerClassName={popupContainerClassName}
|
|
190
190
|
popupClassName={popupClassName}
|
|
@@ -231,7 +231,7 @@ export function OnlineUsers({
|
|
|
231
231
|
</li>
|
|
232
232
|
))}
|
|
233
233
|
</ul>
|
|
234
|
-
</
|
|
234
|
+
</PopoverOld>
|
|
235
235
|
)}
|
|
236
236
|
</>
|
|
237
237
|
);
|
package/src/palette.ts
CHANGED
|
@@ -2,7 +2,7 @@ export const slate = {
|
|
|
2
2
|
slateBase: "hsl(0, 0%, 100%)",
|
|
3
3
|
slate1: "hsl(206, 0%, 99%)",
|
|
4
4
|
slate2: "hsl(210, 0%, 97%)",
|
|
5
|
-
slate3: "hsl(209, 0%,
|
|
5
|
+
slate3: "hsl(209, 0%, 96%)",
|
|
6
6
|
slate4: "hsl(209, 0%, 93%)",
|
|
7
7
|
slate5: "hsl(208, 0%, 91%)",
|
|
8
8
|
slate6: "hsl(208, 0%, 89%)",
|