@fibery/ui-kit 1.37.0 → 1.38.1
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 +25 -0
- package/config/jest/testFrameworkSetup.js +1 -1
- package/package.json +20 -16
- package/src/abbreviate-name.ts +42 -0
- package/src/actions-menu/actions-menu-item.tsx +32 -11
- package/src/actions-menu/actions-menu-props.tsx +5 -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 +28 -9
- package/src/actions-menu/context-actions-menu.tsx +22 -0
- package/src/actions-panel.tsx +12 -2
- package/src/animated-height-container.tsx +24 -5
- package/src/antd/ant-upload.tsx +1 -1
- package/src/antd/input.tsx +4 -0
- package/src/avatar.tsx +1 -27
- 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 +7 -3
- package/src/button/button-group.tsx +1 -1
- package/src/button/button.tsx +33 -1
- package/src/button/icon-button.tsx +10 -1
- package/src/button/select-button.tsx +4 -0
- package/src/card-container.tsx +10 -6
- package/src/checkbox.tsx +17 -0
- package/src/collapsible-section.tsx +3 -1
- 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/autocomplete.tsx +11 -5
- package/src/date-picker/date-range-input.tsx +5 -1
- package/src/date-picker/date-range-picker-popup-content.tsx +31 -13
- 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-input.tsx +5 -1
- package/src/date-picker/single-date-picker.tsx +8 -5
- package/src/date-picker/styles.ts +52 -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 +45 -12
- package/src/dropdown-menu/index.tsx +19 -2
- package/src/emoji-picker/app-icon-picker.tsx +6 -4
- package/src/emoji-picker/emoji-picker-preview-footer.tsx +5 -1
- package/src/emoji-picker/emoji-picker.tsx +3 -0
- package/src/emoji-picker/emoji.tsx +5 -3
- package/src/emoji-picker/icon-emoji-picker.tsx +10 -1
- package/src/emoji-picker/primitives/emoji.tsx +49 -51
- package/src/emoji-picker/primitives/footer.tsx +5 -0
- package/src/emoji-picker/primitives/search.tsx +8 -0
- package/src/emoji-picker/primitives/skin-tone.tsx +12 -1
- 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/fibermoji-placeholder.tsx +1 -27
- package/src/field-icon.tsx +4 -1
- package/src/file-item-2.tsx +408 -0
- package/src/file-item.tsx +215 -47
- package/src/header-layout.tsx +11 -0
- package/src/html-styles.ts +21 -4
- package/src/icons/ast/ActivityFilled.ts +8 -0
- package/src/icons/ast/AiAssistantFilled.ts +8 -0
- package/src/icons/ast/Back.ts +1 -1
- 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/ExtensionFiles.ts +1 -1
- package/src/icons/ast/FileUpload.ts +1 -1
- 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/SwitchToMention.ts +8 -0
- package/src/icons/ast/SwitchToText.ts +8 -0
- package/src/icons/ast/SwitchToWidget.ts +8 -0
- package/src/icons/ast/TypeDate.ts +1 -1
- package/src/icons/ast/ViewGallery.ts +8 -0
- package/src/icons/ast/index.tsx +16 -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/SwitchToMention.tsx +13 -0
- package/src/icons/react/SwitchToText.tsx +13 -0
- package/src/icons/react/SwitchToWidget.tsx +13 -0
- package/src/icons/react/ViewGallery.tsx +13 -0
- package/src/icons/react/index.tsx +16 -0
- package/src/icons/svg/activity-filled.svg +4 -0
- package/src/icons/svg/ai-assistant-filled.svg +3 -0
- package/src/icons/svg/back.svg +3 -1
- 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/extension/files.svg +3 -1
- package/src/icons/svg/file-upload.svg +3 -6
- 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/switch-to-mention.svg +3 -0
- package/src/icons/svg/switch-to-text.svg +4 -0
- package/src/icons/svg/switch-to-widget.svg +4 -0
- package/src/icons/svg/type/date.svg +3 -2
- package/src/icons/svg/view-gallery.svg +4 -0
- package/src/images-gallery/images-gallery-fall-through-provider.tsx +11 -0
- package/src/images-gallery/images-gallery.tsx +257 -0
- package/src/images-gallery/zoom.tsx +123 -0
- package/src/images-gallery-2/images-gallery-2.tsx +442 -0
- package/src/images-gallery-2/slide-buttons.tsx +230 -0
- package/src/images-gallery-2/zoom.tsx +35 -0
- package/src/is-in-popup.ts +1 -1
- package/src/kbd.tsx +46 -0
- 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 +45 -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 +54 -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/notification-dot.tsx +16 -7
- package/src/online-users.tsx +3 -3
- package/src/palette.ts +1 -1
- package/src/platform-symbols.ts +9 -0
- package/src/platform.ts +2 -0
- package/src/popover/index.tsx +710 -0
- package/src/popover/mobile-popup-context.tsx +29 -0
- package/src/{popup → popover}/modifiers.tsx +25 -25
- package/src/{popup → popover}/popup-modifiers-context.ts +3 -3
- package/src/reactions/reaction-button.tsx +342 -135
- package/src/reactions/reaction-picker.tsx +51 -44
- package/src/reactions/reactions.tsx +11 -1
- package/src/reactions/tootltip.tsx +55 -0
- package/src/rich-text-embed-error.tsx +2 -1
- package/src/select/components/group-heading.tsx +8 -0
- package/src/select/components/menu-list-virtualized.tsx +6 -2
- package/src/select/components/option.tsx +4 -0
- package/src/select/index.tsx +8 -4
- package/src/select/select-control-settings-context.tsx +11 -2
- package/src/select/select-in-popover.tsx +30 -39
- package/src/select/styles.ts +21 -1
- package/src/tab-nav/tab-nav.tsx +36 -10
- 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 +11 -3
- package/src/tooltip.tsx +29 -20
- package/src/type-badge.tsx +5 -2
- package/src/unit/styles.ts +2 -2
- package/src/unit/unit-with-tooltip.tsx +1 -1
- package/src/use-is-phone.tsx +50 -4
- 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/shortcut-badge.tsx +0 -29
- /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,29 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import {FC, ReactNode, useState, useMemo} from "react";
|
|
3
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
4
|
+
|
|
5
|
+
type MobilePopupContext = {
|
|
6
|
+
title?: string;
|
|
7
|
+
headerSlot?: ReactNode;
|
|
8
|
+
setTitle: (title: string) => void;
|
|
9
|
+
setHeader: (header?: ReactNode) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const [Provider, useMobilePopup] = createContext<MobilePopupContext>("MobilePopupContext", {
|
|
13
|
+
setTitle: _.noop,
|
|
14
|
+
setHeader: _.noop,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const MobilePopupProvider: FC<{children?: ReactNode}> = ({children}) => {
|
|
18
|
+
const [title, setTitle] = useState<string | undefined>();
|
|
19
|
+
const [headerSlot, setHeader] = useState<ReactNode | undefined>();
|
|
20
|
+
|
|
21
|
+
const contextValue = useMemo(
|
|
22
|
+
() => ({title, headerSlot, setTitle, setHeader}),
|
|
23
|
+
[title, headerSlot, setTitle, setHeader]
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return <Provider value={contextValue}>{children}</Provider>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export {useMobilePopup};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import {Options as PreventOverflowOptions} from "@popperjs/core/lib/modifiers/preventOverflow";
|
|
2
|
-
import {
|
|
3
|
-
import {Modifier, ModifierArguments} from "@popperjs/core";
|
|
2
|
+
import {Modifier, ModifierArguments, Placement, Boundary, RootBoundary, Padding, Context} from "@popperjs/core";
|
|
4
3
|
import maxSize from "popper-max-size-modifier";
|
|
5
4
|
import {getResizeListener} from "@fibery/helpers/utils/resize-listener";
|
|
6
5
|
import {isElementReference} from "./reference";
|
|
7
6
|
import _ from "lodash";
|
|
8
7
|
|
|
9
|
-
type
|
|
8
|
+
type MaxSizeOptions = {
|
|
9
|
+
placement: Placement;
|
|
10
|
+
boundary: Boundary;
|
|
11
|
+
rootBoundary: RootBoundary;
|
|
12
|
+
elementContext: Context;
|
|
13
|
+
altBoundary: boolean;
|
|
14
|
+
padding: Padding;
|
|
15
|
+
};
|
|
10
16
|
|
|
11
|
-
export const
|
|
12
|
-
{
|
|
17
|
+
export const makeMaxSizeModifier = (options: Partial<PreventOverflowOptions>): Modifier<"maxSize", MaxSizeOptions> => {
|
|
18
|
+
return {
|
|
13
19
|
...maxSize,
|
|
14
|
-
options
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
name: "applyMaxSize",
|
|
18
|
-
enabled: true,
|
|
19
|
-
phase: "beforeWrite",
|
|
20
|
-
requires: ["maxSize"],
|
|
21
|
-
fn({state}) {
|
|
22
|
-
const {width, height} = state.modifiersData.maxSize;
|
|
23
|
-
state.styles.popper.maxWidth = `${width}px`;
|
|
24
|
-
state.styles.popper.maxHeight = `${height}px`;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
];
|
|
20
|
+
options,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
28
23
|
|
|
29
|
-
export const
|
|
30
|
-
name: "
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
export const applyMaxSize: Modifier<"applyMaxSize", Record<string, never>> = {
|
|
25
|
+
name: "applyMaxSize",
|
|
26
|
+
enabled: true,
|
|
27
|
+
phase: "beforeWrite",
|
|
28
|
+
requires: ["maxSize"],
|
|
29
|
+
fn({state}) {
|
|
30
|
+
const {width, height} = state.modifiersData.maxSize;
|
|
31
|
+
state.styles.popper.maxWidth = `${width}px`;
|
|
32
|
+
state.styles.popper.maxHeight = `${height}px`;
|
|
33
33
|
},
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
35
|
|
|
36
36
|
const observeWidthEffect: (arg0: ModifierArguments<Record<string, unknown>>) => void = ({state, instance}) => {
|
|
37
37
|
const {popper, reference} = state.elements;
|
|
@@ -61,7 +61,7 @@ const observeWidthEffect: (arg0: ModifierArguments<Record<string, unknown>>) =>
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
export const observeWidth:
|
|
64
|
+
export const observeWidth: Modifier<"observeWidth", Record<string, never>> = {
|
|
65
65
|
name: "observeWidth",
|
|
66
66
|
enabled: true,
|
|
67
67
|
phase: "main",
|
|
@@ -2,11 +2,11 @@ import {createContext} from "@fibery/react/src/create-context";
|
|
|
2
2
|
import {getPopupContainerElement} from "../utils-dom";
|
|
3
3
|
import {$TSFixMe} from "../tsfixme";
|
|
4
4
|
import {Modifier} from "react-popper";
|
|
5
|
-
import {
|
|
5
|
+
import {PopoverOldProps} from "./index";
|
|
6
6
|
|
|
7
7
|
export const [PopupModifiersProvider, usePopupModifiers] = createContext<{
|
|
8
8
|
getPopupContainer: () => HTMLElement;
|
|
9
9
|
additionalModifiers?: Array<Partial<Modifier<$TSFixMe, $TSFixMe>>>;
|
|
10
|
-
preventOverflowOptions?:
|
|
11
|
-
flipOptions?:
|
|
10
|
+
preventOverflowOptions?: PopoverOldProps["preventOverflowOptions"];
|
|
11
|
+
flipOptions?: PopoverOldProps["flipOptions"];
|
|
12
12
|
}>("PopupModifiersProvider", {getPopupContainer: getPopupContainerElement});
|
|
@@ -1,122 +1,357 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {Fragment, ReactEventHandler, ReactNode, useCallback, useState, useRef} from "react";
|
|
2
3
|
import {createPortal} from "react-dom";
|
|
3
|
-
import {
|
|
4
|
-
import {Fragment, ReactNode, useState} from "react";
|
|
4
|
+
import {fontSize, fontWeight, space, themeVars} from "../design-system";
|
|
5
5
|
import {Emoji} from "../emoji-picker/emoji";
|
|
6
|
-
import {
|
|
6
|
+
import {ToggleButton} from "../toggle-button/toggle-button";
|
|
7
7
|
import {Tooltip} from "../tooltip";
|
|
8
8
|
import {useIsPhone} from "../use-is-phone";
|
|
9
|
+
import {mobileRootSelector, safeAreaInsetBottomVar} from "../mobile-styles";
|
|
10
|
+
import {useLongPress} from "../use-long-press";
|
|
9
11
|
import {getWordDivider} from "./get-word-divider";
|
|
12
|
+
import {EmojiTooltipDescription, EmojiTooltipTitle} from "./tootltip";
|
|
13
|
+
import {TabNavLink, TabNavRoot, TabNavList, tabButton} from "../tab-nav/tab-nav";
|
|
14
|
+
import {AvatarImage} from "../avatar";
|
|
15
|
+
import {getPopupContainerElement} from "../utils-dom";
|
|
10
16
|
|
|
11
17
|
export type Reaction = {
|
|
12
18
|
count: number;
|
|
13
19
|
key: string;
|
|
14
20
|
selected: boolean;
|
|
15
21
|
alias?: string;
|
|
16
|
-
|
|
22
|
+
users?: Array<{name: string; avatarUrl: string | null}>;
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
type Props = {
|
|
20
26
|
reaction: Reaction;
|
|
27
|
+
reactions: Array<Reaction>;
|
|
21
28
|
disabled?: boolean;
|
|
22
29
|
onSelect: (reactionKey: string) => unknown;
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
all: unset;
|
|
27
|
-
padding-inline: ${space.s6}px;
|
|
28
|
-
box-sizing: border-box;
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
32
|
+
const reactionButtonCss = css`
|
|
31
33
|
min-width: ${space.s24 + space.s12}px;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
border-radius: ${border.radius8}px;
|
|
36
|
-
background-color: ${themeVars.colorBgReactionsDefault};
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
line-height: ${lineHeight.nowrap};
|
|
39
|
-
-webkit-user-select: none;
|
|
40
|
-
|
|
41
|
-
&[aria-disabled="true"] {
|
|
42
|
-
cursor: default;
|
|
43
|
-
border-color: ${themeVars.colorBorderReactionsHover};
|
|
44
|
-
background-color: transparent;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&:not([aria-disabled="true"]):hover {
|
|
48
|
-
background-color: ${themeVars.colorBgReactionsHover};
|
|
49
|
-
border-color: ${themeVars.colorBorderReactionsHover};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
export const selectedReactionButtonCss = css`
|
|
54
|
-
.${reactionButtonCss}& {
|
|
55
|
-
&:not([aria-disabled="true"]) {
|
|
56
|
-
background-color: ${themeVars.colorBgReactionsSelectedDefault};
|
|
57
|
-
border-color: ${themeVars.colorBorderReactionsSelectedDefault};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&:not([aria-disabled="true"]):hover {
|
|
61
|
-
background-color: ${themeVars.colorBgReactionsSelectedHover};
|
|
62
|
-
border-color: ${themeVars.colorBorderReactionsSelectedHover};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const countCss = css`
|
|
68
|
-
${textStyles.small};
|
|
69
|
-
line-height: ${lineHeight.nowrap};
|
|
70
|
-
padding: ${space.s2}px ${space.s2}px ${space.s2}px ${space.s4}px;
|
|
71
|
-
.${selectedReactionButtonCss}:not(:disabled) & {
|
|
72
|
-
color: ${themeVars.colorTextReactionsSelected};
|
|
34
|
+
${mobileRootSelector} & {
|
|
35
|
+
height: ${space.s28}px;
|
|
36
|
+
padding-inline: ${space.s6}px;
|
|
73
37
|
}
|
|
74
38
|
`;
|
|
75
|
-
|
|
39
|
+
const zIndexOverlay = 10001;
|
|
76
40
|
const overlayClassName = css`
|
|
77
41
|
position: absolute;
|
|
78
|
-
z-index:
|
|
42
|
+
z-index: ${zIndexOverlay};
|
|
79
43
|
display: flex;
|
|
80
44
|
flex-direction: column;
|
|
81
45
|
inset: 0;
|
|
82
46
|
`;
|
|
83
47
|
|
|
84
48
|
function TouchOverlay({onClick}: {onClick: () => void}) {
|
|
85
|
-
return createPortal(<div className={overlayClassName} onClick={onClick} />,
|
|
49
|
+
return createPortal(<div className={overlayClassName} onClick={onClick} />, getPopupContainerElement());
|
|
86
50
|
}
|
|
87
51
|
|
|
88
52
|
function MobileOverlay({content, onClose}: {content: ReactNode; onClose: () => void}) {
|
|
53
|
+
const handleClose: ReactEventHandler<HTMLDivElement> = useCallback(
|
|
54
|
+
(e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
onClose();
|
|
57
|
+
},
|
|
58
|
+
[onClose]
|
|
59
|
+
);
|
|
89
60
|
return createPortal(
|
|
90
61
|
<div className={overlayClassName}>
|
|
91
62
|
<div
|
|
92
|
-
|
|
63
|
+
onPointerDown={handleClose}
|
|
93
64
|
className={css`
|
|
94
65
|
background-color: ${themeVars.modalBg};
|
|
95
66
|
flex-grow: 1;
|
|
96
67
|
`}
|
|
97
68
|
/>
|
|
98
69
|
<div
|
|
70
|
+
onPointerDown={(e) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
}}
|
|
99
73
|
className={css`
|
|
100
74
|
flex-shrink: 0;
|
|
101
|
-
|
|
75
|
+
height: 70vh;
|
|
76
|
+
background-color: ${themeVars.panelBg};
|
|
77
|
+
padding-bottom: var(${safeAreaInsetBottomVar});
|
|
102
78
|
`}
|
|
103
79
|
>
|
|
104
80
|
{content}
|
|
105
81
|
</div>
|
|
106
82
|
</div>,
|
|
107
|
-
|
|
83
|
+
getPopupContainerElement()
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const navLinkClassName = css`
|
|
88
|
+
&.${tabButton} {
|
|
89
|
+
height: 32px;
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
const canScrollVar = "--can-scroll-fibery-reaction";
|
|
94
|
+
|
|
95
|
+
const tabNavRootWithShadow = css`
|
|
96
|
+
padding: 0;
|
|
97
|
+
display: flex;
|
|
98
|
+
overflow-x: auto;
|
|
99
|
+
scrollbar-width: none;
|
|
100
|
+
position: relative;
|
|
101
|
+
align-items: center;
|
|
102
|
+
border-bottom: 0.5px solid ${themeVars.separatorColor};
|
|
103
|
+
& > div {
|
|
104
|
+
flex-grow: 1;
|
|
105
|
+
top: ${space.s6}px;
|
|
106
|
+
}
|
|
107
|
+
:not(ul) ul {
|
|
108
|
+
gap: ${space.s12}px;
|
|
109
|
+
}
|
|
110
|
+
/* Only show Scroll Indicators when the scroller can actually scroll */
|
|
111
|
+
@keyframes detect-scroll {
|
|
112
|
+
from,
|
|
113
|
+
to {
|
|
114
|
+
${canScrollVar}: 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/* Scroll Indicators */
|
|
118
|
+
@keyframes reveal {
|
|
119
|
+
0% {
|
|
120
|
+
opacity: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
100% {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
&::before,
|
|
128
|
+
&::after {
|
|
129
|
+
content: "";
|
|
130
|
+
display: block;
|
|
131
|
+
flex-shrink: 0;
|
|
132
|
+
width: 12px;
|
|
133
|
+
height: ${44 + 12}px;
|
|
134
|
+
position: sticky;
|
|
135
|
+
visibility: hidden;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@supports (animation-timeline: scroll()) {
|
|
139
|
+
& {
|
|
140
|
+
scroll-timeline: --scroll-timeline x;
|
|
141
|
+
}
|
|
142
|
+
&::before {
|
|
143
|
+
background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&::after {
|
|
147
|
+
background: linear-gradient(to left, rgba(0, 0, 0, 0.15), transparent);
|
|
148
|
+
animation-direction: reverse;
|
|
149
|
+
animation-range: calc(100% - 40px) calc(100% - 20px);
|
|
150
|
+
}
|
|
151
|
+
&::before,
|
|
152
|
+
&::after {
|
|
153
|
+
animation-name: reveal;
|
|
154
|
+
animation-timeline: --scroll-timeline;
|
|
155
|
+
animation-fill-mode: both;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&::before {
|
|
159
|
+
left: 0;
|
|
160
|
+
animation-range: 1em 2em;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&::after {
|
|
164
|
+
right: 0;
|
|
165
|
+
animation-direction: reverse;
|
|
166
|
+
animation-range: calc(100% - 2em) calc(100% - 1em);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
& {
|
|
170
|
+
animation: detect-scroll;
|
|
171
|
+
animation-timeline: --scroll-timeline;
|
|
172
|
+
animation-fill-mode: none;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&::before,
|
|
176
|
+
&::after {
|
|
177
|
+
--visibility-if-can-scroll: var(${canScrollVar}) visible;
|
|
178
|
+
--visibility-if-cant-scroll: hidden;
|
|
179
|
+
visibility: var(--visibility-if-can-scroll, var(--visibility-if-cant-scroll));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
|
|
184
|
+
function PhoneTooltipContent({reactions}: {reactions: Array<Reaction>}): JSX.Element {
|
|
185
|
+
const [selectedTab, setSelectedTab] = useState("all");
|
|
186
|
+
const listRef = useRef<HTMLUListElement>(null);
|
|
187
|
+
const hasMultipleReactions = reactions.length > 1;
|
|
188
|
+
|
|
189
|
+
const allReactionsContent = (
|
|
190
|
+
<div
|
|
191
|
+
className={css`
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
gap: ${space.s16}px;
|
|
195
|
+
`}
|
|
196
|
+
>
|
|
197
|
+
{reactions.map((reaction) => (
|
|
198
|
+
<div
|
|
199
|
+
key={reaction.key}
|
|
200
|
+
className={css`
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: ${space.s16}px;
|
|
204
|
+
`}
|
|
205
|
+
>
|
|
206
|
+
<Emoji size={24} emoji={reaction.key} />
|
|
207
|
+
<div>
|
|
208
|
+
<div
|
|
209
|
+
className={css`
|
|
210
|
+
font-size: ${fontSize.sm}px;
|
|
211
|
+
font-weight: ${fontWeight.medium};
|
|
212
|
+
`}
|
|
213
|
+
>
|
|
214
|
+
{reaction.alias || reaction.key}
|
|
215
|
+
</div>
|
|
216
|
+
{reaction.users ? (
|
|
217
|
+
<div
|
|
218
|
+
className={css`
|
|
219
|
+
color: ${themeVars.accentTextColor};
|
|
220
|
+
display: -webkit-box;
|
|
221
|
+
-webkit-line-clamp: 3;
|
|
222
|
+
-webkit-box-orient: vertical;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
`}
|
|
226
|
+
>
|
|
227
|
+
<PrintNames users={reaction.users} />
|
|
228
|
+
</div>
|
|
229
|
+
) : null}
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
))}
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
const singleReactionContent = (reaction: Reaction | undefined | null) => {
|
|
237
|
+
if (!reaction) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
return (
|
|
241
|
+
<div
|
|
242
|
+
className={css`
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
gap: ${space.s16}px;
|
|
246
|
+
`}
|
|
247
|
+
>
|
|
248
|
+
<div
|
|
249
|
+
className={css`
|
|
250
|
+
font-weight: ${fontWeight.medium};
|
|
251
|
+
`}
|
|
252
|
+
>
|
|
253
|
+
{reaction.alias || reaction.key}
|
|
254
|
+
</div>
|
|
255
|
+
{reaction.users?.map(({name: userName, avatarUrl}) => (
|
|
256
|
+
<div
|
|
257
|
+
key={userName}
|
|
258
|
+
className={css`
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
gap: ${space.s12}px;
|
|
262
|
+
`}
|
|
263
|
+
>
|
|
264
|
+
<AvatarImage avatarUrl={avatarUrl} title={userName} size={24} />
|
|
265
|
+
<span
|
|
266
|
+
className={css`
|
|
267
|
+
overflow-wrap: anywhere;
|
|
268
|
+
font-size: ${fontSize.sm}px;
|
|
269
|
+
font-weight: ${fontWeight.medium};
|
|
270
|
+
`}
|
|
271
|
+
>
|
|
272
|
+
{userName}
|
|
273
|
+
</span>
|
|
274
|
+
</div>
|
|
275
|
+
))}
|
|
276
|
+
</div>
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<>
|
|
282
|
+
<TabNavRoot className={tabNavRootWithShadow}>
|
|
283
|
+
<TabNavList ref={listRef}>
|
|
284
|
+
{hasMultipleReactions ? (
|
|
285
|
+
<TabNavLink
|
|
286
|
+
className={navLinkClassName}
|
|
287
|
+
wide
|
|
288
|
+
active={selectedTab === "all"}
|
|
289
|
+
onClick={() => setSelectedTab("all")}
|
|
290
|
+
>
|
|
291
|
+
All
|
|
292
|
+
</TabNavLink>
|
|
293
|
+
) : null}
|
|
294
|
+
{reactions.map((reaction) => (
|
|
295
|
+
<TabNavLink
|
|
296
|
+
className={navLinkClassName}
|
|
297
|
+
key={reaction.key}
|
|
298
|
+
wide
|
|
299
|
+
active={selectedTab === reaction.key || !hasMultipleReactions}
|
|
300
|
+
onClick={() => setSelectedTab(reaction.key)}
|
|
301
|
+
before={<Emoji emoji={reaction.key} />}
|
|
302
|
+
>
|
|
303
|
+
{reaction.count}
|
|
304
|
+
</TabNavLink>
|
|
305
|
+
))}
|
|
306
|
+
</TabNavList>
|
|
307
|
+
</TabNavRoot>
|
|
308
|
+
|
|
309
|
+
<div
|
|
310
|
+
className={css`
|
|
311
|
+
padding: ${space.s12}px;
|
|
312
|
+
overflow-y: auto;
|
|
313
|
+
`}
|
|
314
|
+
>
|
|
315
|
+
{selectedTab === "all" && hasMultipleReactions
|
|
316
|
+
? allReactionsContent
|
|
317
|
+
: singleReactionContent(hasMultipleReactions ? reactions.find((r) => r.key === selectedTab) : reactions[0])}
|
|
318
|
+
</div>
|
|
319
|
+
</>
|
|
108
320
|
);
|
|
109
321
|
}
|
|
110
322
|
|
|
111
|
-
|
|
323
|
+
function PrintNames({users}: {users: {name: string}[]}): JSX.Element {
|
|
324
|
+
return (
|
|
325
|
+
<>
|
|
326
|
+
{users.map(({name}, index, names) => {
|
|
327
|
+
return (
|
|
328
|
+
<Fragment key={index}>
|
|
329
|
+
<span
|
|
330
|
+
className={css`
|
|
331
|
+
overflow-wrap: anywhere;
|
|
332
|
+
`}
|
|
333
|
+
>
|
|
334
|
+
{name}
|
|
335
|
+
</span>
|
|
336
|
+
{getWordDivider(names.length, index)}
|
|
337
|
+
</Fragment>
|
|
338
|
+
);
|
|
339
|
+
})}{" "}
|
|
340
|
+
</>
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export const ReactionButton = ({reaction, disabled, onSelect, reactions}: Props): JSX.Element => {
|
|
112
345
|
const [showOverlay, setShowOverlay] = useState<true | undefined>(undefined);
|
|
113
346
|
const isPhone = useIsPhone();
|
|
347
|
+
|
|
114
348
|
const onLongPress = () => {
|
|
115
349
|
// https://github.com/radix-ui/primitives/issues/931 - disable text selection
|
|
116
350
|
if (isPhone) {
|
|
117
351
|
document.body.style.userSelect = "none";
|
|
118
352
|
document.body.style.webkitUserSelect = "none";
|
|
119
353
|
}
|
|
354
|
+
|
|
120
355
|
setShowOverlay(true);
|
|
121
356
|
};
|
|
122
357
|
const close = () => {
|
|
@@ -131,85 +366,56 @@ export const ReactionButton = ({reaction, disabled, onSelect}: Props): JSX.Eleme
|
|
|
131
366
|
isPreventDefault: true,
|
|
132
367
|
delay: 300,
|
|
133
368
|
});
|
|
369
|
+
|
|
134
370
|
const button = (
|
|
135
|
-
<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
onClick={() => {
|
|
140
|
-
if (!disabled) {
|
|
141
|
-
onSelect(reaction.key);
|
|
142
|
-
}
|
|
143
|
-
}}
|
|
144
|
-
{...longPressEvent}
|
|
145
|
-
>
|
|
146
|
-
<div
|
|
147
|
-
className={css`
|
|
148
|
-
font-size: 18px;
|
|
149
|
-
height: 18px;
|
|
150
|
-
width: 18px;
|
|
151
|
-
`}
|
|
152
|
-
>
|
|
153
|
-
<Emoji emoji={reaction.key} />
|
|
154
|
-
</div>
|
|
155
|
-
<span className={countCss}>{reaction.count}</span>
|
|
156
|
-
</button>
|
|
157
|
-
);
|
|
158
|
-
if (reaction?.userNames?.length) {
|
|
159
|
-
// noinspection CssInvalidPropertyValue
|
|
160
|
-
const title = (
|
|
161
|
-
<div
|
|
162
|
-
className={css`
|
|
163
|
-
padding-top: ${space.s6}px;
|
|
164
|
-
padding-left: ${space.s6}px;
|
|
165
|
-
padding-right: ${space.s6}px;
|
|
166
|
-
display: flex;
|
|
167
|
-
justify-content: center;
|
|
168
|
-
`}
|
|
169
|
-
>
|
|
371
|
+
<ToggleButton
|
|
372
|
+
className={reactionButtonCss}
|
|
373
|
+
disabled={disabled}
|
|
374
|
+
iconStart={
|
|
170
375
|
<div
|
|
171
376
|
className={css`
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
377
|
+
font-size: 16px;
|
|
378
|
+
height: 16px;
|
|
379
|
+
width: 16px;
|
|
380
|
+
font-size-adjust: none;
|
|
381
|
+
|
|
382
|
+
${mobileRootSelector} & {
|
|
383
|
+
font-size: 18px;
|
|
384
|
+
height: 18px;
|
|
385
|
+
width: 18px;
|
|
386
|
+
line-height: 18px;
|
|
387
|
+
@supports (-webkit-touch-callout: none) {
|
|
388
|
+
/* Safari specific fix */
|
|
389
|
+
line-height: 17px;
|
|
390
|
+
.emoji {
|
|
391
|
+
font-size: 0.8em;
|
|
392
|
+
position: relative;
|
|
393
|
+
top: -1px;
|
|
394
|
+
img {
|
|
395
|
+
font-size: 1.2em;
|
|
396
|
+
top: 1px;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
175
401
|
`}
|
|
402
|
+
{...longPressEvent}
|
|
176
403
|
>
|
|
177
|
-
<Emoji emoji={reaction.key}
|
|
404
|
+
<Emoji emoji={reaction.key} />
|
|
178
405
|
</div>
|
|
179
|
-
|
|
180
|
-
|
|
406
|
+
}
|
|
407
|
+
onPressedChange={() => onSelect(reaction.key)}
|
|
408
|
+
pressed={reaction.selected}
|
|
409
|
+
>
|
|
410
|
+
<span>{reaction.count}</span>
|
|
411
|
+
</ToggleButton>
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
if (reaction?.users?.length) {
|
|
415
|
+
const title = <EmojiTooltipTitle emoji={reaction.key} />;
|
|
181
416
|
const description = (
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
css`
|
|
185
|
-
padding-top: ${space.s8}px;
|
|
186
|
-
padding-bottom: ${space.s6}px;
|
|
187
|
-
padding-left: ${space.s6}px;
|
|
188
|
-
padding-right: ${space.s6}px;
|
|
189
|
-
text-align: center;
|
|
190
|
-
word-wrap: break-word;
|
|
191
|
-
color: ${themeVars.whiteColor};
|
|
192
|
-
`,
|
|
193
|
-
!isPhone &&
|
|
194
|
-
css`
|
|
195
|
-
max-width: 200px;
|
|
196
|
-
`
|
|
197
|
-
)}
|
|
198
|
-
>
|
|
199
|
-
{reaction.userNames.map((name, index, names) => {
|
|
200
|
-
return (
|
|
201
|
-
<Fragment key={index}>
|
|
202
|
-
<span
|
|
203
|
-
className={css`
|
|
204
|
-
overflow-wrap: break-word;
|
|
205
|
-
`}
|
|
206
|
-
>
|
|
207
|
-
{name}
|
|
208
|
-
</span>
|
|
209
|
-
{getWordDivider(names.length, index)}
|
|
210
|
-
</Fragment>
|
|
211
|
-
);
|
|
212
|
-
})}
|
|
417
|
+
<EmojiTooltipDescription>
|
|
418
|
+
<PrintNames users={reaction.users} />
|
|
213
419
|
<span
|
|
214
420
|
className={css`
|
|
215
421
|
color: ${themeVars.shortcutTextColor};
|
|
@@ -217,7 +423,7 @@ export const ReactionButton = ({reaction, disabled, onSelect}: Props): JSX.Eleme
|
|
|
217
423
|
>
|
|
218
424
|
reacted with {reaction.alias || reaction.key}
|
|
219
425
|
</span>
|
|
220
|
-
</
|
|
426
|
+
</EmojiTooltipDescription>
|
|
221
427
|
);
|
|
222
428
|
if (isPhone) {
|
|
223
429
|
return (
|
|
@@ -229,11 +435,12 @@ export const ReactionButton = ({reaction, disabled, onSelect}: Props): JSX.Eleme
|
|
|
229
435
|
content={
|
|
230
436
|
<div
|
|
231
437
|
className={css`
|
|
232
|
-
|
|
438
|
+
display: flex;
|
|
439
|
+
height: 100%;
|
|
440
|
+
flex-direction: column;
|
|
233
441
|
`}
|
|
234
442
|
>
|
|
235
|
-
{
|
|
236
|
-
{description}
|
|
443
|
+
<PhoneTooltipContent reactions={reactions} />
|
|
237
444
|
</div>
|
|
238
445
|
}
|
|
239
446
|
/>
|