@fibery/ui-kit 1.36.2 → 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 +20 -0
- package/package.json +8 -5
- package/src/action-badge.tsx +5 -4
- package/src/actions-menu/actions-menu-confirmation.tsx +1 -12
- package/src/actions-menu/actions-menu-item.tsx +19 -7
- 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/antd/ant-modal.tsx +17 -2
- package/src/antd/input.tsx +4 -3
- package/src/app-icon-with-fallback.tsx +5 -8
- package/src/app-icon-wrapper.tsx +4 -4
- package/src/appIcons.json +20 -0
- package/src/axis-header.tsx +136 -76
- package/src/badge.tsx +14 -7
- package/src/beta-badge.tsx +12 -8
- package/src/box.tsx +1 -1
- package/src/breadcrumb.tsx +78 -0
- package/src/button/actions-button-compact.tsx +5 -2
- package/src/button/base-button.tsx +7 -4
- package/src/button/button-group.tsx +1 -1
- package/src/button/button.tsx +120 -2
- package/src/button/icon-button.tsx +13 -2
- package/src/button/select-button.tsx +27 -8
- package/src/card-container.tsx +36 -69
- package/src/card-hidden-link.tsx +52 -0
- package/src/collapsible-section.tsx +13 -3
- package/src/color-picker/index.js +65 -60
- package/src/color-picker/swatch.tsx +29 -14
- package/src/command-menu/index.tsx +5 -5
- package/src/context-menu/index.tsx +10 -1
- package/src/count-badge.tsx +57 -0
- package/src/date-picker/date-range-input.tsx +1 -1
- package/src/date-picker/date-range-picker.tsx +6 -3
- package/src/date-picker/fake-date-input.tsx +1 -1
- package/src/date-picker/relative-date-picker.tsx +7 -3
- package/src/date-picker/single-date-input.tsx +1 -1
- 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/date-picker/utils.ts +9 -2
- 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 +91 -51
- package/src/dropdown-menu/index.tsx +8 -1
- package/src/emoji-picker/app-icon-picker.tsx +6 -4
- package/src/emoji-picker/emoji-picker-content-with-color.tsx +3 -9
- 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 +83 -68
- package/src/emoji-picker/primitives/footer.tsx +0 -1
- package/src/emoji-picker/primitives/header.tsx +1 -0
- package/src/emoji-picker/primitives/search.tsx +12 -13
- 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/error-alert/error-alert.tsx +19 -7
- package/src/field-app-icon.tsx +29 -0
- package/src/field-container.tsx +4 -2
- package/src/field-icon.tsx +29 -0
- package/src/field-type-icon.tsx +82 -0
- package/src/file-item.tsx +164 -47
- package/src/guide-link.tsx +4 -3
- package/src/hint.tsx +10 -1
- package/src/html-styles.ts +23 -13
- package/src/icons/ast/ActivityFilled.ts +8 -0
- package/src/icons/ast/AiAssistantFilled.ts +8 -0
- package/src/icons/ast/AiFiberyBuild.ts +8 -0
- package/src/icons/ast/Anthropic.ts +1 -1
- package/src/icons/ast/Apple.ts +8 -0
- package/src/icons/ast/ArrowBottom.ts +1 -1
- package/src/icons/ast/ArrowForward.ts +1 -1
- package/src/icons/ast/ArrowLeft.ts +1 -1
- package/src/icons/ast/ArrowRight.ts +1 -1
- package/src/icons/ast/ArrowTop.ts +1 -1
- package/src/icons/ast/CollapseAllHorizontal.ts +8 -0
- package/src/icons/ast/Crosshair.ts +8 -0
- package/src/icons/ast/DateRange.ts +1 -1
- package/src/icons/ast/Document.ts +8 -0
- package/src/icons/ast/EntityCreate.ts +8 -0
- package/src/icons/ast/EntityCreateFilled.ts +8 -0
- package/src/icons/ast/ExpandAll.ts +8 -0
- package/src/icons/ast/ExpandAllHorizontal.ts +8 -0
- package/src/icons/ast/FiberyDesktopApp.ts +8 -0
- package/src/icons/ast/FileDownload.ts +8 -0
- package/src/icons/ast/GlobeUnpublish.ts +8 -0
- package/src/icons/ast/GraduationCapFilled.ts +8 -0
- package/src/icons/ast/Home.ts +1 -1
- package/src/icons/ast/HomeFilled.ts +8 -0
- package/src/icons/ast/ImportFilled.ts +8 -0
- package/src/icons/ast/IntegrationsFilled.ts +8 -0
- package/src/icons/ast/KeyboardHideDown.ts +8 -0
- package/src/icons/ast/LayoutMultiple.ts +8 -0
- package/src/icons/ast/LocationEdit.ts +8 -0
- package/src/icons/ast/MessagePlus.ts +8 -0
- package/src/icons/ast/OpenAi.ts +1 -1
- package/src/icons/ast/RicheditorHistoryRedo.ts +1 -1
- package/src/icons/ast/RicheditorHistoryUndo.ts +1 -1
- package/src/icons/ast/RicheditorMarkHighlight.ts +8 -0
- package/src/icons/ast/RicheditorMarkStrike.ts +1 -1
- package/src/icons/ast/RicheditorMarkUnderline.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/SpaceApp.ts +8 -0
- package/src/icons/ast/SpaceGenerate.ts +8 -0
- package/src/icons/ast/SpaceScratch.ts +8 -0
- package/src/icons/ast/SpaceTemplate.ts +8 -0
- package/src/icons/ast/TableLayout.ts +8 -0
- package/src/icons/ast/TemplatesFilled.ts +8 -0
- package/src/icons/ast/ThumbsDown.ts +8 -0
- package/src/icons/ast/ThumbsUp.ts +8 -0
- package/src/icons/ast/TypeDate.ts +1 -1
- package/src/icons/ast/ViewDashboard.ts +8 -0
- package/src/icons/ast/WarningTriangleFilled.ts +8 -0
- package/src/icons/ast/Windows.ts +8 -0
- package/src/icons/ast/index.tsx +37 -0
- package/src/icons/react/ActivityFilled.tsx +13 -0
- package/src/icons/react/AiAssistantFilled.tsx +13 -0
- package/src/icons/react/AiFiberyBuild.tsx +13 -0
- package/src/icons/react/Apple.tsx +13 -0
- package/src/icons/react/CollapseAllHorizontal.tsx +13 -0
- package/src/icons/react/Crosshair.tsx +13 -0
- package/src/icons/react/Document.tsx +13 -0
- package/src/icons/react/EntityCreate.tsx +13 -0
- package/src/icons/react/EntityCreateFilled.tsx +13 -0
- package/src/icons/react/ExpandAll.tsx +13 -0
- package/src/icons/react/ExpandAllHorizontal.tsx +13 -0
- package/src/icons/react/FiberyDesktopApp.tsx +13 -0
- package/src/icons/react/FileDownload.tsx +13 -0
- package/src/icons/react/GlobeUnpublish.tsx +13 -0
- package/src/icons/react/GraduationCapFilled.tsx +13 -0
- package/src/icons/react/HomeFilled.tsx +13 -0
- package/src/icons/react/ImportFilled.tsx +13 -0
- package/src/icons/react/IntegrationsFilled.tsx +13 -0
- package/src/icons/react/KeyboardHideDown.tsx +13 -0
- package/src/icons/react/LayoutMultiple.tsx +13 -0
- package/src/icons/react/LocationEdit.tsx +13 -0
- package/src/icons/react/MessagePlus.tsx +13 -0
- package/src/icons/react/RicheditorMarkHighlight.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/SpaceApp.tsx +13 -0
- package/src/icons/react/SpaceGenerate.tsx +13 -0
- package/src/icons/react/SpaceScratch.tsx +13 -0
- package/src/icons/react/SpaceTemplate.tsx +13 -0
- package/src/icons/react/TableLayout.tsx +13 -0
- package/src/icons/react/TemplatesFilled.tsx +13 -0
- package/src/icons/react/ThumbsDown.tsx +13 -0
- package/src/icons/react/ThumbsUp.tsx +13 -0
- package/src/icons/react/ViewDashboard.tsx +13 -0
- package/src/icons/react/WarningTriangleFilled.tsx +13 -0
- package/src/icons/react/Windows.tsx +13 -0
- package/src/icons/react/index.tsx +37 -0
- package/src/icons/svg/activity-filled.svg +4 -0
- package/src/icons/svg/ai-assistant-filled.svg +3 -0
- package/src/icons/svg/ai-fibery-build.svg +24 -0
- package/src/icons/svg/anthropic.svg +2 -14
- package/src/icons/svg/apple.svg +4 -0
- package/src/icons/svg/arrow-bottom.svg +1 -1
- package/src/icons/svg/arrow-forward.svg +1 -1
- package/src/icons/svg/arrow-left.svg +1 -1
- package/src/icons/svg/arrow-right.svg +1 -1
- package/src/icons/svg/arrow-top.svg +1 -1
- package/src/icons/svg/collapse-all-horizontal.svg +3 -0
- package/src/icons/svg/crosshair.svg +4 -0
- package/src/icons/svg/date-range.svg +3 -3
- package/src/icons/svg/document.svg +4 -0
- package/src/icons/svg/entity-create-filled.svg +4 -0
- package/src/icons/svg/entity-create.svg +3 -0
- package/src/icons/svg/expand-all-horizontal.svg +3 -0
- package/src/icons/svg/expand-all.svg +3 -0
- package/src/icons/svg/fibery-desktop-app.svg +101 -0
- package/src/icons/svg/file-download.svg +4 -0
- package/src/icons/svg/globe-unpublish.svg +4 -0
- package/src/icons/svg/go-to.svg +1 -3
- package/src/icons/svg/graduation-cap-filled.svg +4 -0
- package/src/icons/svg/home-filled.svg +3 -0
- package/src/icons/svg/home.svg +4 -2
- package/src/icons/svg/import-filled.svg +4 -0
- package/src/icons/svg/integrations-filled.svg +4 -0
- package/src/icons/svg/keyboard-hide-down.svg +1 -0
- package/src/icons/svg/layout-multiple.svg +3 -0
- package/src/icons/svg/location-edit.svg +13 -0
- package/src/icons/svg/message-plus.svg +4 -0
- package/src/icons/svg/open-ai.svg +2 -7
- package/src/icons/svg/open-as-page.svg +2 -3
- package/src/icons/svg/richeditor/history/redo.svg +3 -2
- package/src/icons/svg/richeditor/history/undo.svg +3 -2
- package/src/icons/svg/richeditor/mark/code.svg +4 -5
- package/src/icons/svg/richeditor/mark/em.svg +3 -2
- package/src/icons/svg/richeditor/mark/highlight.svg +3 -0
- package/src/icons/svg/richeditor/mark/strike.svg +3 -2
- package/src/icons/svg/richeditor/mark/strong.svg +3 -2
- package/src/icons/svg/richeditor/mark/underline.svg +4 -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/space-app.svg +3 -0
- package/src/icons/svg/space-generate.svg +3 -0
- package/src/icons/svg/space-scratch.svg +3 -0
- package/src/icons/svg/space-template.svg +3 -0
- package/src/icons/svg/table-layout.svg +3 -0
- package/src/icons/svg/templates-filled.svg +6 -0
- package/src/icons/svg/thumbs-down.svg +3 -0
- package/src/icons/svg/thumbs-up.svg +3 -0
- package/src/icons/svg/type/date.svg +3 -2
- package/src/icons/svg/view-dashboard.svg +5 -0
- package/src/icons/svg/warning-triangle-filled.svg +3 -0
- package/src/icons/svg/windows.svg +15 -0
- package/src/images-gallery/images-gallery.tsx +254 -0
- package/src/images-gallery/zoom.tsx +112 -0
- package/src/integration-compact-info-button.tsx +3 -1
- package/src/is-in-popup.ts +1 -1
- package/src/layout-styles.ts +43 -0
- package/src/lists/actions-menu-row-surface.tsx +3 -1
- package/src/lists/list-row-surface.tsx +9 -2
- package/src/loaders.tsx +6 -6
- package/src/logo.tsx +16 -9
- package/src/mobile-keyboard-aware-popup.tsx +87 -0
- package/src/mobile-styles.ts +10 -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/new-badge.tsx +4 -7
- package/src/number-input/text-area-auto-sized.tsx +47 -0
- package/src/number-input/text-input-auto-sized.tsx +49 -0
- package/src/online-users.tsx +3 -3
- package/src/palette.ts +50 -50
- 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/rich-text-embed-error.tsx +2 -2
- package/src/select/{custom-select-partials → components}/menu.tsx +13 -7
- package/src/select/{custom-select-partials → components}/no-option-message.tsx +0 -1
- package/src/select/constants.ts +1 -0
- package/src/select/index.tsx +143 -148
- package/src/select/select-in-popover.tsx +119 -138
- package/src/select/styles.ts +60 -24
- package/src/shortcut-badge.tsx +1 -0
- package/src/tab-nav/tab-nav.tsx +47 -28
- package/src/theme-provider.tsx +9 -1
- 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-if-overflown.tsx +9 -3
- package/src/tooltip.tsx +2 -2
- package/src/unit/index.tsx +9 -1
- package/src/unit/loading-unit-value.tsx +1 -0
- package/src/unit/maybe-unit-value.tsx +3 -3
- package/src/unit/primitive.tsx +58 -42
- package/src/unit/styles.ts +10 -14
- package/src/unit/types.ts +4 -2
- package/src/unit/unit-button-group.tsx +6 -11
- package/src/unit/unit-content.tsx +13 -5
- package/src/unit/unit-with-title.tsx +6 -1
- package/src/unit/unit-with-tooltip.tsx +24 -9
- package/src/use-is-phone.tsx +37 -0
- 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 +17 -23
- package/src/number-input/text-area-with-autosize.tsx +0 -91
- package/src/number-input/text-inline-input-with-autosize.tsx +0 -60
- package/src/popup/index.tsx +0 -382
- package/src/use-is-phone.ts +0 -5
- /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
- /package/src/select/{custom-select-partials → components}/clear-indicator.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/drop-down-indicator.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/group-heading.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/menu-list-virtualized.tsx +0 -0
- /package/src/select/{custom-select-partials → components}/option.tsx +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const mobileRootClassName = "fibery-mobile";
|
|
2
|
+
export const mobileRootSelector = `.${mobileRootClassName}`;
|
|
3
|
+
export const mobileKeyboardOpenClassName = "fibery-mobile-keyboard-open";
|
|
4
|
+
export const mobileKeyboardOpenSelector = `.${mobileKeyboardOpenClassName}`;
|
|
5
|
+
export const keyboardHeightVar = "--fibery-on-screen-keyboard-height";
|
|
6
|
+
export const safeAreaInsetLeftVar = "--safe-area-inset-left";
|
|
7
|
+
export const safeAreaInsetRightVar = "--safe-area-inset-right";
|
|
8
|
+
export const safeAreaInsetTopVar = "--safe-area-inset-top";
|
|
9
|
+
export const safeAreaInsetBottomVar = "--safe-area-inset-bottom";
|
|
10
|
+
export const keyboardInsetBottomVar = "--keyboard-inset-bottom";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {createContext} from "@fibery/react/src/create-context";
|
|
2
|
+
|
|
3
|
+
export type SubmenuItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ModalMenuContext = {
|
|
9
|
+
open: boolean;
|
|
10
|
+
title: string;
|
|
11
|
+
submenuStack: SubmenuItem[];
|
|
12
|
+
contentContainer: HTMLDivElement | null;
|
|
13
|
+
setContentContainer: (el: HTMLDivElement | null) => void;
|
|
14
|
+
onOpenSubmenu: (item: SubmenuItem) => void;
|
|
15
|
+
onNavigateBack: () => void;
|
|
16
|
+
onOpenChange: (open: boolean) => void;
|
|
17
|
+
height?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const [ModalMenuContextProvider, useModalMenu] = createContext<ModalMenuContext>("ModalMenuContext");
|
|
21
|
+
|
|
22
|
+
export {ModalMenuContextProvider, useModalMenu};
|
|
@@ -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/new-badge.tsx
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
-
import {
|
|
2
|
+
import {space, textStyles, themeVars} from "./design-system";
|
|
3
3
|
|
|
4
4
|
const newBadgeStyle = css`
|
|
5
|
-
${textStyles.
|
|
6
|
-
text-transform: none;
|
|
7
|
-
font-weight: ${fontWeight.medium};
|
|
5
|
+
${textStyles.heading8}
|
|
8
6
|
display: inline-block;
|
|
9
|
-
padding: ${space.s2}px
|
|
7
|
+
padding: ${space.s2}px 5px;
|
|
10
8
|
color: ${themeVars.colorTextBadgeNeutral};
|
|
11
9
|
background-color: ${themeVars.colorBgBadgeNeutral};
|
|
12
|
-
//border: 0.5px solid ${themeVars.colorBorderButtonOutlineAccentDefault};
|
|
13
10
|
vertical-align: text-top;
|
|
14
|
-
border-radius:
|
|
11
|
+
border-radius: ${space.s4}px;
|
|
15
12
|
`;
|
|
16
13
|
|
|
17
14
|
type Props = {children: React.ReactNode};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {useEffect, useMemo, useRef} from "react";
|
|
2
|
+
import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
3
|
+
import {hiddenCss, inputCss, textAreaCss} from "./styles";
|
|
4
|
+
import {css, cx} from "@linaria/core";
|
|
5
|
+
import {Stack} from "./stack";
|
|
6
|
+
import {invalidInputClass} from "./edit-unit-styles";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
width?: number;
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
autoSelect?: boolean;
|
|
12
|
+
} & React.ComponentProps<"textarea">;
|
|
13
|
+
|
|
14
|
+
export const TextAreaAutoSized = ({value, placeholder, invalid, autoSelect, ...rest}: Props) => {
|
|
15
|
+
const ref = useRef<HTMLTextAreaElement>(null);
|
|
16
|
+
const initialValue = useRef(value);
|
|
17
|
+
|
|
18
|
+
const hiddenValue = useMemo(() => {
|
|
19
|
+
return !value || !initialValue.current ? placeholder : value;
|
|
20
|
+
}, [placeholder, value]);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (autoSelect && ref.current) {
|
|
24
|
+
ref.current.select();
|
|
25
|
+
}
|
|
26
|
+
}, [autoSelect]);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Stack
|
|
30
|
+
className={css`
|
|
31
|
+
width: 100%;
|
|
32
|
+
`}
|
|
33
|
+
bottom={<div className={cx(inputCss, textAreaCss, hiddenCss)}>{hiddenValue}</div>}
|
|
34
|
+
top={
|
|
35
|
+
<textarea
|
|
36
|
+
ref={ref}
|
|
37
|
+
rows={1} // Allows textarea to shrink to 1 row if there is only 1 row (otherwise it has min 2 by default)
|
|
38
|
+
value={value}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
onClick={stopPropagation}
|
|
41
|
+
{...rest}
|
|
42
|
+
className={cx(inputCss, textAreaCss, invalid && invalidInputClass)}
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {stopPropagation} from "@fibery/react/src/stop-propagation";
|
|
2
|
+
import {Stack} from "./stack";
|
|
3
|
+
import {cx} from "@linaria/core";
|
|
4
|
+
import {hiddenCss, inputCss, textInlineCss} from "./styles";
|
|
5
|
+
import {invalidInputClass} from "./edit-unit-styles";
|
|
6
|
+
import {useEffect, useMemo, useRef} from "react";
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
value?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
autoSelect?: boolean;
|
|
13
|
+
} & Omit<React.ComponentProps<"input">, "value">;
|
|
14
|
+
|
|
15
|
+
export const TextInputAutoSized = ({value, placeholder, invalid, autoSelect, ...rest}: Props) => {
|
|
16
|
+
const ref = useRef<HTMLInputElement>(null);
|
|
17
|
+
|
|
18
|
+
const hiddenValue = useMemo(() => {
|
|
19
|
+
let hiddenValue = placeholder || "";
|
|
20
|
+
if (value && value.length > hiddenValue.length - 1) {
|
|
21
|
+
hiddenValue = value;
|
|
22
|
+
}
|
|
23
|
+
return hiddenValue;
|
|
24
|
+
}, [placeholder, value]);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (autoSelect && ref.current) {
|
|
28
|
+
ref.current.select();
|
|
29
|
+
}
|
|
30
|
+
}, [autoSelect]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Stack
|
|
34
|
+
bottom={<div className={cx(inputCss, textInlineCss, hiddenCss)}>{hiddenValue}</div>}
|
|
35
|
+
top={
|
|
36
|
+
<input
|
|
37
|
+
ref={ref}
|
|
38
|
+
size={1} // Allows input to shrink (otherwise it has size 20 by default)
|
|
39
|
+
value={value || ""}
|
|
40
|
+
type="text"
|
|
41
|
+
placeholder={placeholder}
|
|
42
|
+
onClick={stopPropagation}
|
|
43
|
+
{...rest}
|
|
44
|
+
className={cx(inputCss, invalid && invalidInputClass)}
|
|
45
|
+
/>
|
|
46
|
+
}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
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
|
);
|