datocms-react-ui 3.1.0-next.0 → 3.1.0-next.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/dist/Actions.d.ts +1 -0
- package/dist/Actions.js +4 -0
- package/dist/IconAvatar.d.ts +2 -0
- package/dist/IconAvatar.js +2 -0
- package/dist/ListDetail.js +2 -2
- package/dist/Pane.js +2 -1
- package/dist/SplitPane.js +2 -2
- package/dist/react-ui/src/Canvas.d.ts +2 -1
- package/dist/react-ui/src/Canvas.js +8 -6
- package/dist/react-ui/src/ContextInspector.js +2 -2
- package/dist/react-ui/src/messageText.js +1 -1
- package/dist/styles.css +330 -195
- package/dist/ui/icons/brands/gitlab.js +15 -0
- package/dist/ui/icons/custom/netlify.js +7 -29
- package/dist/ui/icons/custom/vercel.js +1 -4
- package/dist/ui/icons/index.js +206 -195
- package/dist/ui/icons/regular/command.js +16 -0
- package/dist/ui/icons/regular/keyboard.js +16 -0
- package/dist/ui/icons/regular/list-tree.js +2 -1
- package/dist/ui/icons/regular/list.js +2 -1
- package/dist/ui/icons/regular/memo.js +2 -1
- package/dist/ui/locales/en.js +10 -3
- package/dist/ui/src/BundledTexts.js +2 -2
- package/dist/ui/src/UiTextKey.d.ts +1 -1
- package/dist/ui/src/actions/Actions/ActionTooltip.js +24 -0
- package/dist/ui/src/actions/Actions/Shortcut.d.ts +23 -0
- package/dist/ui/src/actions/Actions/Shortcut.js +45 -0
- package/dist/ui/src/actions/Actions/index.d.ts +3 -0
- package/dist/ui/src/actions/Actions/index.js +3 -0
- package/dist/ui/src/actions/Actions/registry.d.ts +211 -0
- package/dist/ui/src/actions/Actions/registry.js +580 -0
- package/dist/ui/src/actions/Actions/shortcuts.d.ts +85 -0
- package/dist/ui/src/actions/Actions/shortcuts.js +284 -0
- package/dist/ui/src/actions/Button.d.ts +13 -12
- package/dist/ui/src/actions/Button.js +8 -7
- package/dist/ui/src/actions/Dropdown/DropdownContext.js +2 -1
- package/dist/ui/src/actions/Dropdown/Footer.js +1 -1
- package/dist/ui/src/actions/Dropdown/Menu.d.ts +2 -1
- package/dist/ui/src/actions/Dropdown/Menu.js +43 -37
- package/dist/ui/src/actions/Dropdown/MenuContent.js +22 -12
- package/dist/ui/src/actions/Dropdown/MenuParts.js +3 -3
- package/dist/ui/src/actions/Dropdown/Option.d.ts +20 -3
- package/dist/ui/src/actions/Dropdown/Option.js +48 -9
- package/dist/ui/src/actions/Dropdown/OptionAction.js +1 -1
- package/dist/ui/src/actions/Dropdown/Submenu.js +2 -2
- package/dist/ui/src/actions/Dropdown/index.d.ts +4 -1
- package/dist/ui/src/actions/Dropdown/index.js +6 -4
- package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.d.ts +4 -4
- package/dist/ui/src/actions/Dropdown/triggers/ButtonTrigger.js +7 -6
- package/dist/ui/src/actions/Dropdown/triggers/PillTrigger.js +1 -1
- package/dist/ui/src/actions/Dropdown/triggers/TextualTrigger.js +1 -1
- package/dist/ui/src/actions/EditorToolbar/Button.js +2 -2
- package/dist/ui/src/actions/EditorToolbar/Buttons.js +2 -2
- package/dist/ui/src/actions/EditorToolbar/index.js +1 -1
- package/dist/ui/src/actions/MultipleSelectionActionBar.d.ts +20 -3
- package/dist/ui/src/actions/MultipleSelectionActionBar.js +25 -7
- package/dist/ui/src/actions/SplitButton/Caret.js +1 -1
- package/dist/ui/src/actions/SplitButton/index.js +1 -1
- package/dist/ui/src/actions/disabledReason.js +1 -1
- package/dist/ui/src/content/Avatar.d.ts +5 -3
- package/dist/ui/src/content/Avatar.js +4 -3
- package/dist/ui/src/content/CodeSnippet.js +1 -1
- package/dist/ui/src/content/CopyButton.js +1 -1
- package/dist/ui/src/content/CopyableId.d.ts +6 -1
- package/dist/ui/src/content/CopyableId.js +5 -2
- package/dist/ui/src/content/CopyableValue.js +2 -2
- package/dist/ui/src/content/FeedbackDot.js +1 -1
- package/dist/ui/src/content/IconAvatar.d.ts +42 -0
- package/dist/ui/src/content/IconAvatar.js +36 -0
- package/dist/ui/src/content/InitialsAvatar.js +1 -2
- package/dist/ui/src/content/Pill.js +3 -3
- package/dist/ui/src/content/SmartDate.js +1 -1
- package/dist/ui/src/content/UploadThreatTriangle.js +1 -1
- package/dist/ui/src/content/UsageMeter.d.ts +2 -1
- package/dist/ui/src/content/UsageMeter.js +3 -2
- package/dist/ui/src/content/ValidityTriangles.js +3 -3
- package/dist/ui/src/feedback/BlankSlate.js +2 -2
- package/dist/ui/src/feedback/Callout.js +2 -2
- package/dist/ui/src/feedback/ProgressBar.js +1 -1
- package/dist/ui/src/form/AutosizeInput.js +1 -1
- package/dist/ui/src/form/FieldHint.js +1 -1
- package/dist/ui/src/form/FieldWrapper.js +1 -1
- package/dist/ui/src/form/InputGroup.js +1 -1
- package/dist/ui/src/form/Label.js +2 -2
- package/dist/ui/src/form/PasswordInput.js +1 -1
- package/dist/ui/src/form/RadioGroupInput.js +1 -1
- package/dist/ui/src/form/SelectInput/SelectMenu.js +3 -3
- package/dist/ui/src/form/SelectInput/SelectMultiValueRemove.js +7 -0
- package/dist/ui/src/form/SelectInput/SelectOption.js +1 -1
- package/dist/ui/src/form/SelectInput/SortableMultiValue.js +1 -1
- package/dist/ui/src/form/StringInput.js +1 -1
- package/dist/ui/src/form/SwitchInput.d.ts +2 -0
- package/dist/ui/src/form/SwitchInput.js +4 -3
- package/dist/ui/src/form/SwitchList.js +1 -1
- package/dist/ui/src/form/TableList.js +2 -2
- package/dist/ui/src/form/TextareaInput.js +1 -1
- package/dist/ui/src/i18n.js +6 -6
- package/dist/ui/src/layout/ListOrOverview.js +3 -3
- package/dist/ui/src/layout/Page/Page.js +1 -1
- package/dist/ui/src/layout/Page/PageContent.js +1 -1
- package/dist/ui/src/layout/Page/PageGroup.js +2 -2
- package/dist/ui/src/layout/Page/PageSection.js +1 -1
- package/dist/ui/src/layout/Pane/ListFilter.js +6 -12
- package/dist/ui/src/layout/Pane/PaneHeader.js +3 -3
- package/dist/ui/src/layout/Pane/PaneRegion.d.ts +14 -0
- package/dist/ui/src/layout/Pane/PaneRegion.js +23 -0
- package/dist/ui/src/layout/Pane/index.d.ts +1 -0
- package/dist/ui/src/layout/Pane/index.js +36 -32
- package/dist/ui/src/layout/SidebarPanel.js +1 -1
- package/dist/ui/src/layout/SplitPane.d.ts +2 -0
- package/dist/ui/src/layout/SplitPane.js +79 -37
- package/dist/ui/src/layout/SplitView/SashActionButton.js +17 -9
- package/dist/ui/src/layout/SplitView/SplitView.js +1 -1
- package/dist/ui/src/layout/SplitView/SplitViewSash.js +2 -1
- package/dist/ui/src/layout/Toolbar/AddNewButton.d.ts +10 -6
- package/dist/ui/src/layout/Toolbar/AddNewButton.js +10 -23
- package/dist/ui/src/layout/Toolbar/Divider.d.ts +8 -0
- package/dist/ui/src/layout/Toolbar/Divider.js +16 -0
- package/dist/ui/src/layout/Toolbar/DotsDropdown.d.ts +8 -1
- package/dist/ui/src/layout/Toolbar/DotsDropdown.js +3 -2
- package/dist/ui/src/layout/Toolbar/Fill.js +1 -1
- package/dist/ui/src/layout/Toolbar/FilterInput.d.ts +7 -3
- package/dist/ui/src/layout/Toolbar/FilterInput.js +62 -49
- package/dist/ui/src/layout/Toolbar/FilterToggle.d.ts +6 -4
- package/dist/ui/src/layout/Toolbar/FilterToggle.js +42 -7
- package/dist/ui/src/layout/Toolbar/GoBack.d.ts +6 -1
- package/dist/ui/src/layout/Toolbar/GoBack.js +12 -5
- package/dist/ui/src/layout/Toolbar/Group.js +1 -1
- package/dist/ui/src/layout/Toolbar/Help.js +3 -3
- package/dist/ui/src/layout/Toolbar/Pagination.js +2 -2
- package/dist/ui/src/layout/Toolbar/PresetsTitle.js +3 -3
- package/dist/ui/src/layout/Toolbar/PrimaryButton.d.ts +3 -3
- package/dist/ui/src/layout/Toolbar/PrimaryButton.js +2 -2
- package/dist/ui/src/layout/Toolbar/Root.d.ts +6 -1
- package/dist/ui/src/layout/Toolbar/Root.js +13 -2
- package/dist/ui/src/layout/Toolbar/Search.d.ts +2 -1
- package/dist/ui/src/layout/Toolbar/Search.js +8 -3
- package/dist/ui/src/layout/Toolbar/context.js +2 -1
- package/dist/ui/src/layout/Toolbar/index.d.ts +5 -3
- package/dist/ui/src/layout/Toolbar/index.js +2 -0
- package/dist/ui/src/lists/CardList.d.ts +7 -2
- package/dist/ui/src/lists/CardList.js +7 -6
- package/dist/ui/src/lists/EmptySlot.js +2 -2
- package/dist/ui/src/lists/EntityRow.js +1 -1
- package/dist/ui/src/lists/InfoList.js +8 -3
- package/dist/ui/src/lists/InsertGap.js +4 -4
- package/dist/ui/src/lists/MediaCard.d.ts +10 -0
- package/dist/ui/src/lists/MediaCard.js +9 -4
- package/dist/ui/src/lists/RowList.js +2 -2
- package/dist/ui/src/lists/SettingsList.js +1 -1
- package/dist/ui/src/lists/Table/Body.js +1 -1
- package/dist/ui/src/lists/Table/Cell.js +1 -1
- package/dist/ui/src/lists/Table/ColumnsMenu.js +1 -1
- package/dist/ui/src/lists/Table/Header.js +8 -10
- package/dist/ui/src/lists/Table/HeaderCell.js +2 -2
- package/dist/ui/src/lists/Table/Row.d.ts +7 -1
- package/dist/ui/src/lists/Table/Row.js +6 -2
- package/dist/ui/src/lists/Table/Table.js +1 -1
- package/dist/ui/src/lists/Table/TreeToggle.js +1 -1
- package/dist/ui/src/lists/Table/index.d.ts +1 -1
- package/dist/ui/src/lists/Table/layout.d.ts +3 -2
- package/dist/ui/src/lists/Table/layout.js +26 -13
- package/dist/ui/src/lists/dnd/DragHandle.js +1 -1
- package/dist/ui/src/lists/dnd/DropIndicator.js +1 -1
- package/dist/ui/src/lists/dnd/SortableList.js +2 -2
- package/dist/ui/src/lists/dnd/tree/SortableTree.js +1 -1
- package/dist/ui/src/navigation/Chevron.js +2 -2
- package/dist/ui/src/navigation/SegmentedControl.d.ts +23 -4
- package/dist/ui/src/navigation/SegmentedControl.js +23 -5
- package/dist/ui/src/navigation/SettingsMenu.js +3 -3
- package/dist/ui/src/navigation/SidebarTree/SidebarTreeNode.js +3 -3
- package/dist/ui/src/navigation/SidebarTree/SidebarTreeNodeActions.js +1 -1
- package/dist/ui/src/navigation/Tabs.js +1 -1
- package/dist/ui/src/overlays/FullscreenModal.js +48 -53
- package/dist/ui/src/overlays/HoverCard.js +4 -4
- package/dist/ui/src/overlays/Modal.d.ts +7 -0
- package/dist/ui/src/overlays/Modal.js +53 -55
- package/dist/ui/src/overlays/Popover.d.ts +6 -3
- package/dist/ui/src/overlays/Popover.js +13 -8
- package/dist/ui/src/overlays/Portal.js +1 -1
- package/dist/ui/src/overlays/Tooltip.d.ts +6 -3
- package/dist/ui/src/overlays/Tooltip.js +29 -13
- package/dist/ui/src/overlays/useModalClose.js +17 -12
- package/dist/ui/src/patterns/ListDetail/Page.d.ts +9 -0
- package/dist/ui/src/patterns/ListDetail/Page.js +33 -26
- package/dist/ui/src/patterns/ListDetail/Panel.js +4 -2
- package/dist/ui/src/patterns/ListDetail/Split.d.ts +5 -0
- package/dist/ui/src/patterns/ListDetail/Split.js +75 -56
- package/dist/ui/src/patterns/ListDetail/index.d.ts +2 -2
- package/dist/ui/src/patterns/ListDetail/index.js +2 -2
- package/dist/ui/src/patterns/ListFormPage.js +2 -2
- package/dist/ui/src/semantic/Main.d.ts +4 -1
- package/dist/ui/src/semantic/Main.js +53 -3
- package/dist/ui/src/semantic/NavigationFocusProvider.js +9 -0
- package/package.json +1 -1
- package/dist/HotKey.d.ts +0 -1
- package/dist/HotKey.js +0 -2
- package/dist/ui/src/actions/HotKey.d.ts +0 -98
- package/dist/ui/src/actions/HotKey.js +0 -270
- package/dist/ui/src/actions/hotKeyContext.d.ts +0 -32
- package/dist/ui/src/actions/hotKeyContext.js +0 -15
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { DisabledReasonTooltip } from "../disabledReason.js";
|
|
2
1
|
import { Generic, Navigation } from "../../../icons/index.js";
|
|
2
|
+
import { useAction, useRunAction } from "../Actions/registry.js";
|
|
3
|
+
import { Shortcut } from "../Actions/Shortcut.js";
|
|
4
|
+
import { DisabledReasonTooltip } from "../disabledReason.js";
|
|
3
5
|
import DropdownContext from "./DropdownContext.js";
|
|
4
6
|
import { SortableItem } from "../../lists/dnd/SortableList.js";
|
|
5
7
|
import "../../lists/dnd/index.js";
|
|
@@ -7,14 +9,39 @@ import { MenuItem } from "./MenuParts.js";
|
|
|
7
9
|
import MenuContext from "./MenuContext.js";
|
|
8
10
|
import { InvalidCurrentVersionIcon } from "../../content/ValidityTriangles.js";
|
|
9
11
|
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import classNames from "classnames";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
14
|
import mergeRefs from "@react-hook/merged-ref";
|
|
13
15
|
import cuid from "cuid";
|
|
14
16
|
import { test } from "fuzzyjs";
|
|
15
17
|
//#region ../ui/src/actions/Dropdown/Option.tsx
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The pick and the disabled state of an option that runs an action of the
|
|
20
|
+
* registry. The root of the dropdown finds the action of the region of the
|
|
21
|
+
* menu (see `find` of the registry).
|
|
22
|
+
*/
|
|
23
|
+
function useOptionAction(id, rootRef) {
|
|
24
|
+
const action = useAction(id, rootRef.current);
|
|
25
|
+
const runAction = useRunAction();
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
if (id === void 0) return void 0;
|
|
28
|
+
return {
|
|
29
|
+
onPick: () => runAction(id, { origin: rootRef.current }),
|
|
30
|
+
disabled: action?.disabledReason !== void 0 ? { reason: action.disabledReason } : action === void 0
|
|
31
|
+
};
|
|
32
|
+
}, [
|
|
33
|
+
id,
|
|
34
|
+
action,
|
|
35
|
+
runAction,
|
|
36
|
+
rootRef
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
var Option = React.forwardRef(({ onPick: onPickProp, action, to, href, newTab, active, forceHover, alert, invalid, children, sortable, disabled: disabledProp, closeMenuOnClick, checkbox, actions, icon, keywords, submenu }, ref) => {
|
|
17
40
|
const id = useMemo(() => cuid(), []);
|
|
41
|
+
const { closeMenu, setCloseOnClickOutside, rootRef, triggerId } = useContext(DropdownContext);
|
|
42
|
+
const registryAction = useOptionAction(action, rootRef);
|
|
43
|
+
const onPick = registryAction ? registryAction.onPick : onPickProp;
|
|
44
|
+
const disabled = disabledProp || registryAction?.disabled;
|
|
18
45
|
const { searchTerm, addOption, setClickHandlerForOption } = useContext(MenuContext);
|
|
19
46
|
const contentRef = useRef(null);
|
|
20
47
|
const [innerText, setInnerText] = useState("");
|
|
@@ -37,7 +64,6 @@ var Option = React.forwardRef(({ onPick, to, href, newTab, active, forceHover, a
|
|
|
37
64
|
const className = classNames(checkbox && "has-checkbox", forceHover && "is-hover", isDisabled && "is-disabled", invalid && "is-invalid", sortable && "is-sortable", alert && "is-dangerous");
|
|
38
65
|
const clickable = !actions && !checkbox;
|
|
39
66
|
const isCheckboxItem = Boolean(checkbox) && !onPick && !link;
|
|
40
|
-
const { closeMenu, setCloseOnClickOutside } = useContext(DropdownContext);
|
|
41
67
|
const handleMouseMove = useCallback((e) => {
|
|
42
68
|
const element = e.currentTarget;
|
|
43
69
|
if (isDisabled || element.classList.contains("is-selected")) return;
|
|
@@ -55,12 +81,19 @@ var Option = React.forwardRef(({ onPick, to, href, newTab, active, forceHover, a
|
|
|
55
81
|
return;
|
|
56
82
|
}
|
|
57
83
|
if (isDisabled) return;
|
|
84
|
+
if (checkbox && "key" in e && e.key === " ") {
|
|
85
|
+
checkbox.onChange?.(!checkbox.checked);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
58
88
|
if (!onPick) {
|
|
59
89
|
checkbox?.onChange?.(!checkbox.checked);
|
|
60
90
|
return;
|
|
61
91
|
}
|
|
62
92
|
const keepMenuOpen = closeMenuOnClick === false;
|
|
63
|
-
if (!keepMenuOpen)
|
|
93
|
+
if (!keepMenuOpen) {
|
|
94
|
+
if (e.type === "keydown" && triggerId) document.getElementById(triggerId)?.focus();
|
|
95
|
+
closeMenu();
|
|
96
|
+
}
|
|
64
97
|
const result = onPick(e);
|
|
65
98
|
if (keepMenuOpen && result instanceof Promise) {
|
|
66
99
|
setCloseOnClickOutside(false);
|
|
@@ -77,7 +110,8 @@ var Option = React.forwardRef(({ onPick, to, href, newTab, active, forceHover, a
|
|
|
77
110
|
isDisabled,
|
|
78
111
|
closeMenuOnClick,
|
|
79
112
|
closeMenu,
|
|
80
|
-
setCloseOnClickOutside
|
|
113
|
+
setCloseOnClickOutside,
|
|
114
|
+
triggerId
|
|
81
115
|
]);
|
|
82
116
|
const handleLinkClick = useCallback(() => {
|
|
83
117
|
if (closeMenuOnClick ?? true) closeMenu();
|
|
@@ -106,7 +140,12 @@ var Option = React.forwardRef(({ onPick, to, href, newTab, active, forceHover, a
|
|
|
106
140
|
"aria-hidden": isCheckboxItem || void 0,
|
|
107
141
|
onChange: (e) => checkbox.onChange?.(e.target.checked)
|
|
108
142
|
});
|
|
109
|
-
const after = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
143
|
+
const after = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
144
|
+
action !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
145
|
+
className: "Dropdown__menu__option__shortcut",
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
children: /* @__PURE__ */ jsx(Shortcut, { action })
|
|
148
|
+
}),
|
|
110
149
|
submenu && /* @__PURE__ */ jsx("span", {
|
|
111
150
|
className: "Dropdown__menu__option__chevron",
|
|
112
151
|
children: /* @__PURE__ */ jsx(Navigation.ChevronRightIcon, {})
|
|
@@ -141,8 +180,8 @@ var Option = React.forwardRef(({ onPick, to, href, newTab, active, forceHover, a
|
|
|
141
180
|
"aria-checked": isCheckboxItem ? checkbox?.checked : void 0,
|
|
142
181
|
id,
|
|
143
182
|
ref: mergeRefs(sortableRef, ref),
|
|
144
|
-
before: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Generic.DragGripIcon, {}), checkboxInput] }),
|
|
145
|
-
after: /* @__PURE__ */ jsxs(Fragment, { children: [after, dropIndicator] }),
|
|
183
|
+
before: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Generic.DragGripIcon, {}), checkboxInput] }),
|
|
184
|
+
after: /* @__PURE__ */ jsxs(Fragment$1, { children: [after, dropIndicator] }),
|
|
146
185
|
contentRef,
|
|
147
186
|
contentProps,
|
|
148
187
|
link,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTranslation } from "../../i18n.js";
|
|
2
|
-
import Tooltip from "../../overlays/Tooltip.js";
|
|
3
2
|
import RawButton from "../../semantic/RawButton.js";
|
|
3
|
+
import Tooltip from "../../overlays/Tooltip.js";
|
|
4
4
|
import DropdownContext from "./DropdownContext.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { useIsMenuSheet } from "./MenuSheet.js";
|
|
1
2
|
import NewZIndex from "../../overlays/NewZIndex.js";
|
|
2
3
|
import Portal from "../../overlays/Portal.js";
|
|
3
|
-
import { useIsMenuSheet } from "./MenuSheet.js";
|
|
4
4
|
import DropdownContext from "./DropdownContext.js";
|
|
5
5
|
import MenuContent from "./MenuContent.js";
|
|
6
6
|
import Option from "./Option.js";
|
|
7
7
|
import { placementStyle } from "./placementStyle.js";
|
|
8
8
|
import Menu from "./Menu.js";
|
|
9
9
|
import { useContext, useState } from "react";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import classNames from "classnames";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { autoUpdate, flip, offset, safePolygon, size, useFloating, useHover, useInteractions } from "@floating-ui/react";
|
|
13
13
|
//#region ../ui/src/actions/Dropdown/Submenu.tsx
|
|
14
14
|
/**
|
|
@@ -6,7 +6,10 @@ type AbstractTriggerComponentProps = {
|
|
|
6
6
|
open: boolean;
|
|
7
7
|
onTrigger: (event: React.SyntheticEvent) => void;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Lets the parent open the menu from code (for example, with a keyboard
|
|
11
|
+
* shortcut)
|
|
12
|
+
*/
|
|
10
13
|
export type DropdownHandle = {
|
|
11
14
|
open: () => void;
|
|
12
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useClickOutside } from "../../hooks/useClickOutside.js";
|
|
2
1
|
import { useIsMenuSheet } from "./MenuSheet.js";
|
|
2
|
+
import { useClickOutside } from "../../hooks/useClickOutside.js";
|
|
3
3
|
import { useAutoincrementIntegerId } from "../../hooks/useAutoincrementIntegerId.js";
|
|
4
4
|
import DropdownContext from "./DropdownContext.js";
|
|
5
5
|
import Footer_default from "./Footer.js";
|
|
@@ -19,8 +19,8 @@ import TextualTrigger from "./triggers/TextualTrigger.js";
|
|
|
19
19
|
import { useCloseMenu } from "./useCloseMenu.js";
|
|
20
20
|
import { useDropdownRegistry } from "./useDropdownRegistry.js";
|
|
21
21
|
import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
22
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
22
|
import classNames from "classnames";
|
|
23
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
24
|
import mergeRefs from "@react-hook/merged-ref";
|
|
25
25
|
//#region ../ui/src/actions/Dropdown/index.tsx
|
|
26
26
|
/**
|
|
@@ -58,7 +58,8 @@ var DropdownRoot = React.forwardRef(({ triggerComponent, children, className, co
|
|
|
58
58
|
isMenuSheet
|
|
59
59
|
]);
|
|
60
60
|
const outsideRef = useClickOutside(handleClickOutside);
|
|
61
|
-
const
|
|
61
|
+
const rootRef = useRef(null);
|
|
62
|
+
const mergedRef = mergeRefs(outsideRef, ref, rootRef);
|
|
62
63
|
const handleClose = useCallback(() => {
|
|
63
64
|
changeOpen(false);
|
|
64
65
|
}, [changeOpen]);
|
|
@@ -77,7 +78,8 @@ var DropdownRoot = React.forwardRef(({ triggerComponent, children, className, co
|
|
|
77
78
|
setCloseOnClickOutside,
|
|
78
79
|
isClosing,
|
|
79
80
|
triggerId,
|
|
80
|
-
menuId
|
|
81
|
+
menuId,
|
|
82
|
+
rootRef
|
|
81
83
|
},
|
|
82
84
|
children: /* @__PURE__ */ jsxs("div", {
|
|
83
85
|
className: classNames("Dropdown", className, { "is-open": isOpen || isClosing }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Message, type TextMessage } from '../../../Message.js';
|
|
3
3
|
import { SvgIcon } from '../../../utils/types.js';
|
|
4
|
-
import { ButtonSize, ButtonTone
|
|
4
|
+
import { type ActionTooltipOptions, ButtonSize, ButtonTone } from '../../Button.js';
|
|
5
5
|
import { type Disabled } from '../../disabledReason.js';
|
|
6
6
|
import { DropdownTriggerBaseProps } from './types.js';
|
|
7
7
|
/** A label with an optional icon before it, and the chevron of the menu after it */
|
|
@@ -45,10 +45,10 @@ export type ButtonTriggerProps = DropdownTriggerBaseProps & {
|
|
|
45
45
|
disabled?: Disabled;
|
|
46
46
|
/**
|
|
47
47
|
* The tooltip of the button (the label for an icon-only button), or the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* name and the keys of an action (see Button). It does not show while the
|
|
49
|
+
* menu is open: the menu is in its place.
|
|
50
50
|
*/
|
|
51
|
-
tooltip?: Message | false | null |
|
|
51
|
+
tooltip?: Message | false | null | ActionTooltipOptions;
|
|
52
52
|
/** Only for the place of the button, not for its look */
|
|
53
53
|
className?: string;
|
|
54
54
|
} & ButtonTriggerContent;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { useTranslation } from "../../../i18n.js";
|
|
2
|
-
import
|
|
2
|
+
import { ActionTooltip } from "../../Actions/ActionTooltip.js";
|
|
3
3
|
import { disabledReasonOf } from "../../disabledReason.js";
|
|
4
4
|
import { buttonClassName, useButtonSize } from "../../Button.js";
|
|
5
|
-
import
|
|
5
|
+
import Tooltip from "../../../overlays/Tooltip.js";
|
|
6
6
|
import { MenuChevron } from "../../../navigation/Chevron.js";
|
|
7
7
|
import DropdownTriggerButton_default from "./DropdownTriggerButton.js";
|
|
8
8
|
import "react";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import classNames from "classnames";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region ../ui/src/actions/Dropdown/triggers/ButtonTrigger.tsx
|
|
12
|
-
function
|
|
13
|
-
return typeof tooltip === "object" && tooltip !== null && "
|
|
12
|
+
function isActionTooltip(tooltip) {
|
|
13
|
+
return typeof tooltip === "object" && tooltip !== null && "action" in tooltip && typeof tooltip.action === "string";
|
|
14
14
|
}
|
|
15
15
|
/** The trigger of a Dropdown with the look of a Button */
|
|
16
16
|
var ButtonTrigger = ({ open, onTrigger, tone = "soft", size, expand, disabled, tooltip, className, label, icon: Icon, iconOnly }) => {
|
|
@@ -35,7 +35,8 @@ var ButtonTrigger = ({ open, onTrigger, tone = "soft", size, expand, disabled, t
|
|
|
35
35
|
]
|
|
36
36
|
});
|
|
37
37
|
if (disabledReasonOf(disabled) !== void 0) return button;
|
|
38
|
-
if (
|
|
38
|
+
if (isActionTooltip(tooltip)) return /* @__PURE__ */ jsx(ActionTooltip, {
|
|
39
|
+
action: tooltip.action,
|
|
39
40
|
placement: tooltip.placement,
|
|
40
41
|
label: iconOnlyLabel,
|
|
41
42
|
hidden: open,
|
|
@@ -3,8 +3,8 @@ import { MenuChevron } from "../../../navigation/Chevron.js";
|
|
|
3
3
|
import DropdownTriggerButton_default from "./DropdownTriggerButton.js";
|
|
4
4
|
import { pillClassName } from "../../../content/pillClassName.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import classNames from "classnames";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region ../ui/src/actions/Dropdown/triggers/PillTrigger.tsx
|
|
9
9
|
/** A Pill that opens a menu to change its value */
|
|
10
10
|
var PillTrigger = ({ label, tone, icon, triggerClassName, open, onTrigger }) => {
|
|
@@ -2,8 +2,8 @@ import { useTranslation } from "../../../i18n.js";
|
|
|
2
2
|
import { MenuChevron } from "../../../navigation/Chevron.js";
|
|
3
3
|
import DropdownTriggerButton_default from "./DropdownTriggerButton.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import classNames from "classnames";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region ../ui/src/actions/Dropdown/triggers/TextualTrigger.tsx
|
|
8
8
|
/**
|
|
9
9
|
* A value in a line of text that opens a menu to change it (an inline ghost
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useTranslation } from "../../i18n.js";
|
|
2
|
-
import Tooltip from "../../overlays/Tooltip.js";
|
|
3
2
|
import RawButton from "../../semantic/RawButton.js";
|
|
3
|
+
import Tooltip from "../../overlays/Tooltip.js";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
5
|
import classNames from "classnames";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region ../ui/src/actions/EditorToolbar/Button.tsx
|
|
8
8
|
var TooltipPlacementContext = createContext("top");
|
|
9
9
|
function EditorToolbarTooltipPlacement({ value, children }) {
|
|
@@ -2,7 +2,7 @@ import { TextFormat } from "../../../icons/index.js";
|
|
|
2
2
|
import { EditorToolbarButton } from "./Button.js";
|
|
3
3
|
import { EditorToolbarGroup } from "./Group.js";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region ../ui/src/actions/EditorToolbar/Buttons.tsx
|
|
7
7
|
var buttonGroups = [
|
|
8
8
|
[
|
|
@@ -125,7 +125,7 @@ var ToolbarButton = React.memo(function ToolbarButton({ spec, command }) {
|
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
var EditorToolbarButtons = React.memo(function EditorToolbarButtons({ buttons, commands }) {
|
|
128
|
-
return /* @__PURE__ */ jsx(Fragment, { children: buttonGroups.map((group) => {
|
|
128
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: buttonGroups.map((group) => {
|
|
129
129
|
const shown = group.filter(({ key }) => buttons.includes(key) && commands[key]);
|
|
130
130
|
if (shown.length === 0) return null;
|
|
131
131
|
return /* @__PURE__ */ jsx(EditorToolbarGroup, { children: shown.map((spec) => /* @__PURE__ */ jsx(ToolbarButton, {
|
|
@@ -9,8 +9,8 @@ import { EditorToolbarGroup } from "./Group.js";
|
|
|
9
9
|
import { EditorToolbarButtons } from "./Buttons.js";
|
|
10
10
|
import { useEditorToolbarState, useEditorToolbarVisible, useEditorToolbarWiring } from "./hooks.js";
|
|
11
11
|
import { useContext, useEffect, useRef, useState } from "react";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import classNames from "classnames";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region ../ui/src/actions/EditorToolbar/index.tsx
|
|
15
15
|
var ITEM_SELECTOR = ".EditorToolbar__button, .EditorToolbar__dropdown__current";
|
|
16
16
|
function useRovingFocus() {
|
|
@@ -11,6 +11,17 @@ type ActionBehavior =
|
|
|
11
11
|
*/
|
|
12
12
|
onClick: (() => void) | (() => Promise<void>);
|
|
13
13
|
menu?: never;
|
|
14
|
+
action?: never;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runs an action of the registry (`ui/Actions`). The tooltip of the
|
|
18
|
+
* button and the option of the ⋮ menu show its keys.
|
|
19
|
+
*/
|
|
20
|
+
| {
|
|
21
|
+
/** The id of the action */
|
|
22
|
+
action: string;
|
|
23
|
+
onClick?: never;
|
|
24
|
+
menu?: never;
|
|
14
25
|
}
|
|
15
26
|
/** Opens a menu */
|
|
16
27
|
| {
|
|
@@ -20,6 +31,7 @@ type ActionBehavior =
|
|
|
20
31
|
*/
|
|
21
32
|
menu: ReactNode;
|
|
22
33
|
onClick?: never;
|
|
34
|
+
action?: never;
|
|
23
35
|
};
|
|
24
36
|
export type Action = ActionBehavior & {
|
|
25
37
|
/** A name that stays the same between renders. It is the React key. */
|
|
@@ -29,8 +41,8 @@ export type Action = ActionBehavior & {
|
|
|
29
41
|
/**
|
|
30
42
|
* `primary` is a button on the brand color for the main actions on the
|
|
31
43
|
* selection. `plain` is for the actions that change the selection itself
|
|
32
|
-
* ("Select all", "Invert"). On a small viewport, the plain actions
|
|
33
|
-
*
|
|
44
|
+
* ("Select all", "Invert"). On a small viewport, the plain actions that
|
|
45
|
+
* do not open a menu go in one menu (⋮).
|
|
34
46
|
* @default "plain"
|
|
35
47
|
*/
|
|
36
48
|
tone?: 'primary' | 'plain';
|
|
@@ -51,6 +63,11 @@ export type MultipleSelectionActionBarProps = {
|
|
|
51
63
|
status: Message;
|
|
52
64
|
/** Runs when the user clicks the cross at the end of the bar. */
|
|
53
65
|
onDeselectAll: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* The id of the action of the registry that clears the selection: the
|
|
68
|
+
* tooltip of the cross shows its keys. The click still runs onDeselectAll.
|
|
69
|
+
*/
|
|
70
|
+
deselectAllAction?: string;
|
|
54
71
|
/**
|
|
55
72
|
* The buttons of the bar. An array in the list gives a group of buttons
|
|
56
73
|
* that touch each other. A value that is `false`, `null` or `undefined`
|
|
@@ -71,5 +88,5 @@ export type MultipleSelectionActionBarProps = {
|
|
|
71
88
|
*/
|
|
72
89
|
extra?: ReactNode;
|
|
73
90
|
};
|
|
74
|
-
export default function MultipleSelectionActionBar({ open, status, onDeselectAll, actions, extra, placement, }: MultipleSelectionActionBarProps): React.JSX.Element;
|
|
91
|
+
export default function MultipleSelectionActionBar({ open, status, onDeselectAll, deselectAllAction, actions, extra, placement, }: MultipleSelectionActionBarProps): React.JSX.Element;
|
|
75
92
|
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
2
|
+
import { useRunAction } from "./Actions/registry.js";
|
|
1
3
|
import { useTranslation } from "../i18n.js";
|
|
4
|
+
import { useIsSmallViewport } from "../hooks/useMediaQuery.js";
|
|
2
5
|
import NewZIndex from "../overlays/NewZIndex.js";
|
|
3
6
|
import Button, { buttonClassName } from "./Button.js";
|
|
4
7
|
import Portal from "../overlays/Portal.js";
|
|
5
|
-
import { useIsSmallViewport } from "../hooks/useMediaQuery.js";
|
|
6
|
-
import { Generic } from "../../icons/index.js";
|
|
7
8
|
import { MenuChevron } from "../navigation/Chevron.js";
|
|
8
9
|
import DropdownTriggerButton_default from "./Dropdown/triggers/DropdownTriggerButton.js";
|
|
9
10
|
import { Dropdown } from "./Dropdown/index.js";
|
|
10
11
|
import { useRef } from "react";
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import classNames from "classnames";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
|
14
15
|
//#region ../ui/src/actions/MultipleSelectionActionBar.tsx
|
|
15
16
|
var MenuActionTrigger = ({ buttonClassName, disabled, label, open, onTrigger }) => {
|
|
@@ -22,16 +23,28 @@ var MenuActionTrigger = ({ buttonClassName, disabled, label, open, onTrigger })
|
|
|
22
23
|
children: [/* @__PURE__ */ jsx("span", { children: tc(label) }), /* @__PURE__ */ jsx(MenuChevron, {})]
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
|
-
function MultipleSelectionActionBar({ open, status, onDeselectAll, actions, extra, placement = "pane" }) {
|
|
26
|
+
function MultipleSelectionActionBar({ open, status, onDeselectAll, deselectAllAction, actions, extra, placement = "pane" }) {
|
|
26
27
|
const { tc } = useTranslation();
|
|
27
28
|
const nodeRef = useRef(null);
|
|
28
29
|
const smallViewport = useIsSmallViewport();
|
|
29
|
-
const
|
|
30
|
+
const runAction = useRunAction();
|
|
31
|
+
const goesInMenu = (action) => smallViewport && !!action && action.tone !== "primary" && !action.menu;
|
|
30
32
|
const menuActions = actions.flat().filter(goesInMenu);
|
|
31
33
|
const barActions = actions.map((actionOrGroup) => Array.isArray(actionOrGroup) ? actionOrGroup.filter((action) => !goesInMenu(action)) : goesInMenu(actionOrGroup) ? null : actionOrGroup).filter((actionOrGroup) => Array.isArray(actionOrGroup) ? actionOrGroup.some(Boolean) : true);
|
|
32
34
|
const renderAction = (action) => {
|
|
33
35
|
if (!action) return null;
|
|
34
36
|
const tone = action.tone === "primary" ? "on-primary" : "overlay";
|
|
37
|
+
if (action.action !== void 0) {
|
|
38
|
+
const id = action.action;
|
|
39
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
40
|
+
tone,
|
|
41
|
+
size: "micro",
|
|
42
|
+
label: action.label,
|
|
43
|
+
disabled: action.disabled,
|
|
44
|
+
tooltip: { action: id },
|
|
45
|
+
onClick: () => runAction(id, { origin: nodeRef.current })
|
|
46
|
+
}, action.id);
|
|
47
|
+
}
|
|
35
48
|
if (action.onClick) return /* @__PURE__ */ jsx(Button, {
|
|
36
49
|
tone,
|
|
37
50
|
size: "micro",
|
|
@@ -47,7 +60,7 @@ function MultipleSelectionActionBar({ open, status, onDeselectAll, actions, extr
|
|
|
47
60
|
}),
|
|
48
61
|
disabled: action.disabled,
|
|
49
62
|
label: action.label,
|
|
50
|
-
children: () => /* @__PURE__ */ jsx(Fragment, { children: action.menu })
|
|
63
|
+
children: () => /* @__PURE__ */ jsx(Fragment$1, { children: action.menu })
|
|
51
64
|
}, action.id);
|
|
52
65
|
};
|
|
53
66
|
const bar = /* @__PURE__ */ jsx(NewZIndex, { children: (zIndex) => /* @__PURE__ */ jsx(TransitionGroup, { children: open && /* @__PURE__ */ jsx(CSSTransition, {
|
|
@@ -74,7 +87,11 @@ function MultipleSelectionActionBar({ open, status, onDeselectAll, actions, extr
|
|
|
74
87
|
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
75
88
|
placement: "top-start",
|
|
76
89
|
contextualSearch: false,
|
|
77
|
-
children: menuActions.map((action) => /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
90
|
+
children: menuActions.map((action) => action.action !== void 0 ? /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
91
|
+
action: action.action,
|
|
92
|
+
disabled: action.disabled,
|
|
93
|
+
children: tc(action.label)
|
|
94
|
+
}, action.id) : /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
78
95
|
onPick: action.onClick,
|
|
79
96
|
disabled: action.disabled,
|
|
80
97
|
children: tc(action.label)
|
|
@@ -94,6 +111,7 @@ function MultipleSelectionActionBar({ open, status, onDeselectAll, actions, extr
|
|
|
94
111
|
iconOnly: true,
|
|
95
112
|
icon: Generic.CloseIcon,
|
|
96
113
|
label: { id: "MultipleSelectionActionBar.deselectAll" },
|
|
114
|
+
tooltip: deselectAllAction ? { action: deselectAllAction } : void 0,
|
|
97
115
|
onClick: onDeselectAll
|
|
98
116
|
})
|
|
99
117
|
]
|
|
@@ -3,8 +3,8 @@ import { buttonClassName } from "../Button.js";
|
|
|
3
3
|
import { MenuChevron } from "../../navigation/Chevron.js";
|
|
4
4
|
import DropdownTriggerButton_default from "../Dropdown/triggers/DropdownTriggerButton.js";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import classNames from "classnames";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region ../ui/src/actions/SplitButton/Caret.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The caret half of a SplitButton. It has the tone and the size of the main
|
|
@@ -2,8 +2,8 @@ import Button, { useButtonSize } from "../Button.js";
|
|
|
2
2
|
import { Dropdown } from "../Dropdown/index.js";
|
|
3
3
|
import Caret from "./Caret.js";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import classNames from "classnames";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region ../ui/src/actions/SplitButton/index.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The main action and a caret with a menu of the other variants of the same
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
|
-
import Tooltip from "../overlays/Tooltip.js";
|
|
3
2
|
import HoverCard_default from "../overlays/HoverCard.js";
|
|
3
|
+
import Tooltip from "../overlays/Tooltip.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region ../ui/src/actions/disabledReason.tsx
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* "small" is 20px, "regular" is 30px, "large" is 40px
|
|
4
|
-
* large avatars have a ring, so avatars in a stack stay
|
|
3
|
+
* "small" is 20px, "regular" is 30px, "large" is 40px, "xlarge" is 48px.
|
|
4
|
+
* The regular and the large avatars have a ring, so avatars in a stack stay
|
|
5
|
+
* apart. The xlarge avatar is for a single person, for example the header of
|
|
6
|
+
* a profile, thus it has no ring.
|
|
5
7
|
*/
|
|
6
|
-
export type AvatarSize = 'small' | 'regular' | 'large';
|
|
8
|
+
export type AvatarSize = 'small' | 'regular' | 'large' | 'xlarge';
|
|
7
9
|
/** The side of each size in pixels, for example to ask an image of that size */
|
|
8
10
|
export declare const AVATAR_SIZE_IN_PIXELS: Record<AvatarSize, number>;
|
|
9
11
|
/** The image of the avatar: a URL, or the Gravatar image of the email */
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Users } from "../../icons/index.js";
|
|
2
2
|
import InitialsAvatar, { initialsFor } from "./InitialsAvatar.js";
|
|
3
3
|
import { forwardRef, useCallback, useState } from "react";
|
|
4
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import classNames from "classnames";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import md5 from "min-md5";
|
|
7
7
|
//#region ../ui/src/content/Avatar.tsx
|
|
8
8
|
/** The side of each size in pixels, for example to ask an image of that size */
|
|
9
9
|
var AVATAR_SIZE_IN_PIXELS = {
|
|
10
10
|
small: 20,
|
|
11
11
|
regular: 30,
|
|
12
|
-
large: 40
|
|
12
|
+
large: 40,
|
|
13
|
+
xlarge: 48
|
|
13
14
|
};
|
|
14
15
|
function gravatarUrl(email, pixels) {
|
|
15
16
|
return `https://secure.gravatar.com/avatar/${md5(email.trim().toLowerCase())}?${new URLSearchParams({
|
|
@@ -39,7 +40,7 @@ var Avatar = forwardRef(({ size = "regular", active = false, name, email, imageU
|
|
|
39
40
|
surface: email ? { seed: email } : void 0,
|
|
40
41
|
size: AVATAR_SIZE_IN_PIXELS[size],
|
|
41
42
|
labelled
|
|
42
|
-
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(InitialsAvatar, {
|
|
43
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(InitialsAvatar, {
|
|
43
44
|
name,
|
|
44
45
|
surface: "muted",
|
|
45
46
|
size: AVATAR_SIZE_IN_PIXELS[size],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
2
|
import CopyButton_default from "./CopyButton.js";
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import classNames from "classnames";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region ../ui/src/content/CodeSnippet.tsx
|
|
7
7
|
function CodeSnippet({ code, ariaLabel, maxHeight, children }) {
|
|
8
8
|
const { tm } = useTranslation();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { UI } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
3
|
import Button from "../actions/Button.js";
|
|
3
|
-
import { UI } from "../../icons/index.js";
|
|
4
4
|
import { useCopyToClipboard } from "../hooks/useCopyToClipboard.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -2,7 +2,12 @@ import React from 'react';
|
|
|
2
2
|
export type CopyableIdProps = {
|
|
3
3
|
/** The ID to show and to copy, for example "168342". */
|
|
4
4
|
id: string;
|
|
5
|
+
/**
|
|
6
|
+
* The id of the action of the registry that copies the same ID: the
|
|
7
|
+
* tooltip shows its keys. The click still copies the ID.
|
|
8
|
+
*/
|
|
9
|
+
action?: string;
|
|
5
10
|
};
|
|
6
|
-
declare function CopyableId({ id }: CopyableIdProps): React.JSX.Element | null;
|
|
11
|
+
declare function CopyableId({ id, action: actionId }: CopyableIdProps): React.JSX.Element | null;
|
|
7
12
|
declare const _default: React.MemoExoticComponent<typeof CopyableId>;
|
|
8
13
|
export default _default;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { useAction } from "../actions/Actions/registry.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
|
-
import Tooltip from "../overlays/Tooltip.js";
|
|
3
3
|
import RawButton from "../semantic/RawButton.js";
|
|
4
|
+
import Tooltip from "../overlays/Tooltip.js";
|
|
4
5
|
import { useCopyToClipboard } from "../hooks/useCopyToClipboard.js";
|
|
5
6
|
import IdText from "./IdText.js";
|
|
6
7
|
import React from "react";
|
|
7
8
|
import { jsx } from "react/jsx-runtime";
|
|
8
9
|
//#region ../ui/src/content/CopyableId.tsx
|
|
9
|
-
function CopyableId({ id }) {
|
|
10
|
+
function CopyableId({ id, action: actionId }) {
|
|
10
11
|
const { t } = useTranslation();
|
|
12
|
+
const action = useAction(actionId);
|
|
11
13
|
const { copied, copy } = useCopyToClipboard(id);
|
|
12
14
|
function handleClick(e) {
|
|
13
15
|
e.stopPropagation();
|
|
@@ -17,6 +19,7 @@ function CopyableId({ id }) {
|
|
|
17
19
|
if (!id) return null;
|
|
18
20
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
19
21
|
label: copied ? t("clipboard.copied") : t("clipboard.copyId"),
|
|
22
|
+
shortcut: action?.shortcuts,
|
|
20
23
|
placement: "bottom",
|
|
21
24
|
children: /* @__PURE__ */ jsx(RawButton, {
|
|
22
25
|
className: "CopyableId button--ghost-inline",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
3
|
import Button from "../actions/Button.js";
|
|
3
|
-
import { Generic } from "../../icons/index.js";
|
|
4
4
|
import CopyButton_default from "./CopyButton.js";
|
|
5
5
|
import { useAutoincrementIntegerId } from "../hooks/useAutoincrementIntegerId.js";
|
|
6
6
|
import React, { useCallback } from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import classNames from "classnames";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region ../ui/src/content/CopyableValue.tsx
|
|
10
10
|
function CopyableValue({ value, openable, code, label, hint, ariaLabel }) {
|
|
11
11
|
const { tc, tm } = useTranslation();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import classNames from "classnames";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region ../ui/src/content/FeedbackDot.tsx
|
|
6
6
|
/** A small colored dot that shows the state of an item, before its label. */
|
|
7
7
|
function FeedbackDot({ tone, ariaLabel }) {
|