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,65 +1,78 @@
|
|
|
1
|
+
import { Generic } from "../../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../../i18n.js";
|
|
2
3
|
import Button from "../../actions/Button.js";
|
|
3
|
-
import {
|
|
4
|
+
import { InSearchContext } from "./context.js";
|
|
4
5
|
import DebouncedTextInput_default from "../../form/DebouncedTextInput.js";
|
|
5
6
|
import Search from "../../semantic/Search.js";
|
|
6
7
|
import { usePaneAriaLabel } from "../Pane/PaneAriaLabel.js";
|
|
7
|
-
import React from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import React, { useContext } from "react";
|
|
9
9
|
import classNames from "classnames";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
//#region ../ui/src/layout/Toolbar/FilterInput.tsx
|
|
11
|
-
/** The
|
|
12
|
-
function
|
|
13
|
-
const { t
|
|
12
|
+
/** The magnifier, the field and the "✕" of the filter, without a landmark */
|
|
13
|
+
function FilterParts({ value, onChange, autoFocus = true, debounce = false, disabled = false, onClose }) {
|
|
14
|
+
const { t } = useTranslation();
|
|
14
15
|
const placeholder = t("fullTextQuery.placeholder");
|
|
15
|
-
const paneAriaLabel = usePaneAriaLabel();
|
|
16
16
|
const handleChange = (newValue) => {
|
|
17
17
|
onChange(newValue ?? "");
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */ jsxs(
|
|
19
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: classNames("Toolbar__filter__icon", { "Toolbar__filter__icon--disabled": disabled }),
|
|
22
|
+
children: /* @__PURE__ */ jsx(Generic.SearchIcon, {})
|
|
23
|
+
}),
|
|
24
|
+
debounce ? /* @__PURE__ */ jsx(DebouncedTextInput_default, {
|
|
25
|
+
autoFocus,
|
|
26
|
+
name: "fullTextQuery",
|
|
27
|
+
type: "text",
|
|
28
|
+
"aria-label": placeholder,
|
|
29
|
+
placeholder,
|
|
30
|
+
className: "Toolbar__filter__input",
|
|
31
|
+
value: value || null,
|
|
32
|
+
onChange: handleChange,
|
|
33
|
+
onBlur: handleChange,
|
|
34
|
+
disabled
|
|
35
|
+
}) : /* @__PURE__ */ jsx("input", {
|
|
36
|
+
autoFocus,
|
|
37
|
+
name: "fullTextQuery",
|
|
38
|
+
type: "text",
|
|
39
|
+
"aria-label": placeholder,
|
|
40
|
+
placeholder,
|
|
41
|
+
className: "Toolbar__filter__input",
|
|
42
|
+
value,
|
|
43
|
+
disabled,
|
|
44
|
+
onChange: (event) => {
|
|
45
|
+
onChange(event.target.value);
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
(onClose || value) && !disabled && /* @__PURE__ */ jsx(Button, {
|
|
49
|
+
tone: "ghost",
|
|
50
|
+
size: "micro",
|
|
51
|
+
iconOnly: true,
|
|
52
|
+
icon: Generic.CloseIcon,
|
|
53
|
+
label: { id: onClose ? "fullTextQuery.close" : "field.clearValue" },
|
|
54
|
+
onClick: () => {
|
|
55
|
+
onChange("");
|
|
56
|
+
onClose?.();
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
] });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The text filter of a list, with a magnifier and a "✕" that clears it. It is
|
|
63
|
+
* a search landmark, except in a Toolbar.Search (the text cell of a form).
|
|
64
|
+
*/
|
|
65
|
+
function FilterInput({ ariaLabel, ...props }) {
|
|
66
|
+
const { tm } = useTranslation();
|
|
67
|
+
const paneAriaLabel = usePaneAriaLabel();
|
|
68
|
+
if (useContext(InSearchContext)) return /* @__PURE__ */ jsx("div", {
|
|
69
|
+
className: "Toolbar__filter",
|
|
70
|
+
children: /* @__PURE__ */ jsx(FilterParts, { ...props })
|
|
71
|
+
});
|
|
72
|
+
return /* @__PURE__ */ jsx(Search, {
|
|
20
73
|
ariaLabel: ariaLabel ? tm(ariaLabel) : paneAriaLabel,
|
|
21
74
|
className: "Toolbar__filter",
|
|
22
|
-
children:
|
|
23
|
-
/* @__PURE__ */ jsx("span", {
|
|
24
|
-
className: classNames("Toolbar__filter__icon", { "Toolbar__filter__icon--disabled": disabled }),
|
|
25
|
-
children: /* @__PURE__ */ jsx(Generic.SearchIcon, {})
|
|
26
|
-
}),
|
|
27
|
-
debounce ? /* @__PURE__ */ jsx(DebouncedTextInput_default, {
|
|
28
|
-
autoFocus,
|
|
29
|
-
name: "fullTextQuery",
|
|
30
|
-
type: "text",
|
|
31
|
-
"aria-label": placeholder,
|
|
32
|
-
placeholder,
|
|
33
|
-
className: "Toolbar__filter__input",
|
|
34
|
-
value: value || null,
|
|
35
|
-
onChange: handleChange,
|
|
36
|
-
onBlur: handleChange,
|
|
37
|
-
disabled
|
|
38
|
-
}) : /* @__PURE__ */ jsx("input", {
|
|
39
|
-
autoFocus,
|
|
40
|
-
name: "fullTextQuery",
|
|
41
|
-
type: "text",
|
|
42
|
-
"aria-label": placeholder,
|
|
43
|
-
placeholder,
|
|
44
|
-
className: "Toolbar__filter__input",
|
|
45
|
-
value,
|
|
46
|
-
disabled,
|
|
47
|
-
onChange: (event) => {
|
|
48
|
-
onChange(event.target.value);
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
(onClose || value) && !disabled && /* @__PURE__ */ jsx(Button, {
|
|
52
|
-
tone: "ghost",
|
|
53
|
-
size: "micro",
|
|
54
|
-
iconOnly: true,
|
|
55
|
-
icon: Generic.CloseIcon,
|
|
56
|
-
label: { id: onClose ? "fullTextQuery.close" : "field.clearValue" },
|
|
57
|
-
onClick: () => {
|
|
58
|
-
onChange("");
|
|
59
|
-
onClose?.();
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
]
|
|
75
|
+
children: /* @__PURE__ */ jsx(FilterParts, { ...props })
|
|
63
76
|
});
|
|
64
77
|
}
|
|
65
78
|
var FilterInput_default = React.memo(FilterInput);
|
|
@@ -4,16 +4,18 @@ export type FilterToggleProps = {
|
|
|
4
4
|
pressed: boolean;
|
|
5
5
|
/** Opens or closes the filter ("onToggle" of useFilterToolbar) */
|
|
6
6
|
onClick: () => void;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Opens the filter ("onOpen" of useFilterToolbar). `F` and `/` run it while
|
|
9
|
+
* the pointer or the focus is in the Pane, and the tooltip shows the keys.
|
|
10
|
+
*/
|
|
11
|
+
onOpen?: () => void;
|
|
9
12
|
};
|
|
10
|
-
export declare const FILTER_LIST_HOT_KEY = "mod+shift+f";
|
|
11
13
|
/**
|
|
12
14
|
* The magnifier that opens the filter of a list. Put the toggle at the
|
|
13
15
|
* right end of the title bar, immediately before the button of the title
|
|
14
16
|
* bar when there is one. Use the toggle with useFilterToolbar.
|
|
15
17
|
*/
|
|
16
|
-
declare function FilterToggle({ pressed, onClick,
|
|
18
|
+
declare function FilterToggle({ pressed, onClick, onOpen }: FilterToggleProps): React.JSX.Element;
|
|
17
19
|
declare const _default: React.MemoExoticComponent<typeof FilterToggle>;
|
|
18
20
|
export default _default;
|
|
19
21
|
type UseFilterToolbarOptions = {
|
|
@@ -1,25 +1,60 @@
|
|
|
1
|
-
import { useTranslation } from "../../i18n.js";
|
|
2
1
|
import { Generic } from "../../../icons/index.js";
|
|
2
|
+
import { LIST_ACTION_GROUP, useRegisterActions } from "../../actions/Actions/registry.js";
|
|
3
|
+
import { useTranslation } from "../../i18n.js";
|
|
4
|
+
import { useCollectionRegion, usePaneRegion } from "../Pane/PaneRegion.js";
|
|
3
5
|
import Button from "./Button.js";
|
|
4
6
|
import { usePaneAriaLabel } from "../Pane/PaneAriaLabel.js";
|
|
5
|
-
import React, { useCallback, useEffect, useState } from "react";
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
7
9
|
//#region ../ui/src/layout/Toolbar/FilterToggle.tsx
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
+
var FILTER_LIST_ACTION_ID = "list.filter";
|
|
11
|
+
var FILTER_FIELD = "input, textarea, select";
|
|
12
|
+
/**
|
|
13
|
+
* Registers `F` and `/`, the keys that open the filter of the list and move
|
|
14
|
+
* the focus to it, while the pointer or the focus is in the Pane of the
|
|
15
|
+
* list. When the list is at the side of a split, the keys are on in all the
|
|
16
|
+
* split. Out of a Pane, the keys are on for the page. `undefined` registers
|
|
17
|
+
* nothing.
|
|
18
|
+
*/
|
|
19
|
+
function useFilterListAction(open) {
|
|
20
|
+
const pane = usePaneRegion();
|
|
21
|
+
const collection = useCollectionRegion();
|
|
22
|
+
const actions = useMemo(() => {
|
|
23
|
+
if (!open) return [];
|
|
24
|
+
const run = () => {
|
|
25
|
+
open();
|
|
26
|
+
requestAnimationFrame(() => {
|
|
27
|
+
const header = pane?.current?.querySelector(".Pane__header");
|
|
28
|
+
const active = document.activeElement;
|
|
29
|
+
if (active?.matches(FILTER_FIELD) && header?.contains(active)) return;
|
|
30
|
+
header?.querySelector(FILTER_FIELD)?.focus();
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return [{
|
|
34
|
+
id: FILTER_LIST_ACTION_ID,
|
|
35
|
+
name: { id: "hotkeys.filterList" },
|
|
36
|
+
icon: Generic.SearchIcon,
|
|
37
|
+
group: LIST_ACTION_GROUP,
|
|
38
|
+
shortcut: [{ key: "f" }, { key: "/" }],
|
|
39
|
+
run
|
|
40
|
+
}];
|
|
41
|
+
}, [open, pane]);
|
|
42
|
+
useRegisterActions(collection ?? pane, actions);
|
|
43
|
+
}
|
|
10
44
|
/**
|
|
11
45
|
* The magnifier that opens the filter of a list. Put the toggle at the
|
|
12
46
|
* right end of the title bar, immediately before the button of the title
|
|
13
47
|
* bar when there is one. Use the toggle with useFilterToolbar.
|
|
14
48
|
*/
|
|
15
|
-
function FilterToggle({ pressed, onClick,
|
|
49
|
+
function FilterToggle({ pressed, onClick, onOpen }) {
|
|
16
50
|
const { t } = useTranslation();
|
|
17
51
|
const paneAriaLabel = usePaneAriaLabel();
|
|
52
|
+
useFilterListAction(onOpen);
|
|
18
53
|
return /* @__PURE__ */ jsx(Button, {
|
|
19
54
|
label: paneAriaLabel ? t("a11y.filterToggle", { name: paneAriaLabel }) : t("hotkeys.filterList"),
|
|
20
55
|
icon: Generic.SearchIcon,
|
|
21
56
|
iconOnly: true,
|
|
22
|
-
tooltip:
|
|
57
|
+
tooltip: onOpen ? { action: FILTER_LIST_ACTION_ID } : void 0,
|
|
23
58
|
pressed,
|
|
24
59
|
onClick
|
|
25
60
|
});
|
|
@@ -59,4 +94,4 @@ function useFilterToolbar({ isFiltering, onClear, onClose, defaultOpen = false }
|
|
|
59
94
|
};
|
|
60
95
|
}
|
|
61
96
|
//#endregion
|
|
62
|
-
export {
|
|
97
|
+
export { FilterToggle_default as default, useFilterToolbar };
|
|
@@ -21,7 +21,12 @@ export type GoBackProps = (GoBackLink | GoBackButton) & {
|
|
|
21
21
|
* @default { id: 'toolbar.goBack' } ("Go back to the collection")
|
|
22
22
|
*/
|
|
23
23
|
ariaLabel?: TextMessage;
|
|
24
|
+
/**
|
|
25
|
+
* The id of the action of the registry that goes back: a tooltip shows
|
|
26
|
+
* the name of the chevron and the keys of the action
|
|
27
|
+
*/
|
|
28
|
+
action?: string;
|
|
24
29
|
};
|
|
25
30
|
/** The chevron that goes back, before the title */
|
|
26
|
-
declare function GoBack({ to, onClick, ariaLabel, }: GoBackProps): React.JSX.Element;
|
|
31
|
+
declare function GoBack({ to, onClick, ariaLabel, action, }: GoBackProps): React.JSX.Element;
|
|
27
32
|
export default GoBack;
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
+
import { Navigation } from "../../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../../i18n.js";
|
|
2
3
|
import Link from "../../navigation/Link.js";
|
|
3
4
|
import RawButton from "../../semantic/RawButton.js";
|
|
4
|
-
import {
|
|
5
|
+
import { ActionTooltip } from "../../actions/Actions/ActionTooltip.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
//#region ../ui/src/layout/Toolbar/GoBack.tsx
|
|
8
9
|
/** The chevron that goes back, before the title */
|
|
9
|
-
function GoBack({ to, onClick, ariaLabel = { id: "toolbar.goBack" } }) {
|
|
10
|
+
function GoBack({ to, onClick, ariaLabel = { id: "toolbar.goBack" }, action }) {
|
|
10
11
|
const { tm } = useTranslation();
|
|
11
12
|
const icon = /* @__PURE__ */ jsx(Navigation.ChevronLeftIcon, {});
|
|
12
|
-
|
|
13
|
+
const chevron = to !== void 0 ? /* @__PURE__ */ jsx(Link, {
|
|
13
14
|
to,
|
|
14
15
|
className: "Toolbar__back",
|
|
15
16
|
"aria-label": tm(ariaLabel),
|
|
16
17
|
children: icon
|
|
17
|
-
})
|
|
18
|
-
return /* @__PURE__ */ jsx(RawButton, {
|
|
18
|
+
}) : /* @__PURE__ */ jsx(RawButton, {
|
|
19
19
|
className: "Toolbar__back",
|
|
20
20
|
onClick,
|
|
21
21
|
ariaLabel,
|
|
22
22
|
children: icon
|
|
23
23
|
});
|
|
24
|
+
if (!action) return chevron;
|
|
25
|
+
return /* @__PURE__ */ jsx(ActionTooltip, {
|
|
26
|
+
action,
|
|
27
|
+
label: ariaLabel,
|
|
28
|
+
placement: "bottom",
|
|
29
|
+
children: chevron
|
|
30
|
+
});
|
|
24
31
|
}
|
|
25
32
|
//#endregion
|
|
26
33
|
export { GoBack as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import classNames from "classnames";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region ../ui/src/layout/Toolbar/Group.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Controls that act as one unit (for example the filter controls at the
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useTranslation } from "../../i18n.js";
|
|
2
1
|
import { Generic } from "../../../icons/index.js";
|
|
2
|
+
import { useTranslation } from "../../i18n.js";
|
|
3
3
|
import DropdownTriggerButton_default from "../../actions/Dropdown/triggers/DropdownTriggerButton.js";
|
|
4
4
|
import { Dropdown } from "../../actions/Dropdown/index.js";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import classNames from "classnames";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region ../ui/src/layout/Toolbar/Help.tsx
|
|
9
9
|
function Trigger({ open, onTrigger }) {
|
|
10
10
|
const { t } = useTranslation();
|
|
@@ -42,7 +42,7 @@ function HelpBody({ children, docsUrl, secondary = false }) {
|
|
|
42
42
|
const { t } = useTranslation();
|
|
43
43
|
return /* @__PURE__ */ jsxs("div", {
|
|
44
44
|
className: classNames("Dropdown__menu__body Toolbar__help__body", { "Toolbar__help__body--secondary": secondary }),
|
|
45
|
-
children: [children, docsUrl && /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("a", {
|
|
45
|
+
children: [children, docsUrl && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("a", {
|
|
46
46
|
href: docsUrl,
|
|
47
47
|
target: "_blank",
|
|
48
48
|
rel: "noopener noreferrer",
|
|
@@ -3,7 +3,7 @@ import { MenuChevron } from "../../navigation/Chevron.js";
|
|
|
3
3
|
import { usePaneAriaLabel } from "../Pane/PaneAriaLabel.js";
|
|
4
4
|
import Pagination from "../Pagination.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region ../ui/src/layout/Toolbar/Pagination.tsx
|
|
8
8
|
var DEFAULT_PER_PAGE_OPTIONS = [
|
|
9
9
|
25,
|
|
@@ -23,7 +23,7 @@ function ToolbarPagination({ ariaLabel, totalEntries, compact, perPage, currentP
|
|
|
23
23
|
const showPages = totalEntries > perPage;
|
|
24
24
|
const showPerPageSelect = perPageSelect !== void 0 && !compact && totalEntries > Math.min(...perPageOptions);
|
|
25
25
|
if (!showPages && !showPerPageSelect) return null;
|
|
26
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [perPageSelect && showPerPageSelect && /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [perPageSelect && showPerPageSelect && /* @__PURE__ */ jsxs("div", {
|
|
27
27
|
className: "Pagination__per-page",
|
|
28
28
|
children: [
|
|
29
29
|
t("pagination.show", { perPage }),
|
|
@@ -4,7 +4,7 @@ import Pill_default from "../../content/Pill.js";
|
|
|
4
4
|
import Title from "./Title.js";
|
|
5
5
|
import ToolbarTitleTrigger from "./ToolbarTitleTrigger.js";
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region ../ui/src/layout/Toolbar/PresetsTitle.tsx
|
|
9
9
|
/**
|
|
10
10
|
* A toolbar title that is the menu of the presets of a list (views of the
|
|
@@ -20,14 +20,14 @@ var PresetsTitle = React.memo(function PresetsTitle({ label, qualifier, children
|
|
|
20
20
|
children: /* @__PURE__ */ jsx(Dropdown, {
|
|
21
21
|
className: "ListPresets__dropdown",
|
|
22
22
|
triggerComponent: ToolbarTitleTrigger,
|
|
23
|
-
label: /* @__PURE__ */ jsxs(Fragment, { children: [tc(label), qualifier && /* @__PURE__ */ jsxs("span", {
|
|
23
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [tc(label), qualifier && /* @__PURE__ */ jsxs("span", {
|
|
24
24
|
className: "ListPresets__qualifier",
|
|
25
25
|
children: [" · ", tc(qualifier)]
|
|
26
26
|
})] }),
|
|
27
27
|
children: () => /* @__PURE__ */ jsxs(Dropdown.Menu, {
|
|
28
28
|
placement: "bottom-start",
|
|
29
29
|
minWidth: footer ? 360 : void 0,
|
|
30
|
-
children: [children, footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Dropdown.Separator, {}), footer] })]
|
|
30
|
+
children: [children, footer && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Dropdown.Separator, {}), footer] })]
|
|
31
31
|
})
|
|
32
32
|
})
|
|
33
33
|
});
|
|
@@ -30,10 +30,10 @@ export type PrimaryButtonProps = {
|
|
|
30
30
|
/** The button, the caret and the actions of the menu are disabled */
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
/**
|
|
33
|
-
* The
|
|
34
|
-
* tooltip (see the "
|
|
33
|
+
* The id of the action of the main button: its name and its keys show in
|
|
34
|
+
* the tooltip (see the "action" tooltip of Button)
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
action?: string;
|
|
37
37
|
/**
|
|
38
38
|
* Shows only the icon of the main action. The label is then the
|
|
39
39
|
* accessible name of the button.
|
|
@@ -10,7 +10,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
10
10
|
* The primary button of a toolbar, with an optional menu of other actions
|
|
11
11
|
* of the same kind (a split button)
|
|
12
12
|
*/
|
|
13
|
-
var PrimaryButton = React.memo(React.forwardRef(function PrimaryButton({ actions, disabled,
|
|
13
|
+
var PrimaryButton = React.memo(React.forwardRef(function PrimaryButton({ actions, disabled, action: actionId, iconOnly, size: sizeProp }, ref) {
|
|
14
14
|
const { tc } = useTranslation();
|
|
15
15
|
const { navigate } = useNavigation();
|
|
16
16
|
const defaultSize = useButtonSize();
|
|
@@ -18,7 +18,7 @@ var PrimaryButton = React.memo(React.forwardRef(function PrimaryButton({ actions
|
|
|
18
18
|
if (actions.length === 0) return null;
|
|
19
19
|
const [{ to, label, icon: Icon, onPick }, ...rest] = actions;
|
|
20
20
|
const action = onPick ? { onClick: onPick } : to ? { to } : {};
|
|
21
|
-
const tooltip =
|
|
21
|
+
const tooltip = actionId ? { action: actionId } : void 0;
|
|
22
22
|
const content = iconOnly && Icon ? {
|
|
23
23
|
label,
|
|
24
24
|
icon: Icon,
|
|
@@ -14,6 +14,11 @@ export type ToolbarProps = {
|
|
|
14
14
|
* of the fields ("field" size), thus their edges align
|
|
15
15
|
*/
|
|
16
16
|
fields?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Closes the toolbar of a filter ("onClose" of useFilterToolbar). Escape
|
|
19
|
+
* in a text field of the toolbar calls it.
|
|
20
|
+
*/
|
|
21
|
+
onClose?: () => void;
|
|
17
22
|
/** Only for the placement of the toolbar (for example "Modal__header") */
|
|
18
23
|
className?: string;
|
|
19
24
|
};
|
|
@@ -21,5 +26,5 @@ export type ToolbarProps = {
|
|
|
21
26
|
* The bar of a Toolbar. Import it from this file only in a component that
|
|
22
27
|
* the Toolbar index imports (for example Tabs), to prevent an import cycle.
|
|
23
28
|
*/
|
|
24
|
-
declare function Root({ children, style, borderBottom, fields, className, }: ToolbarProps): React.JSX.Element;
|
|
29
|
+
declare function Root({ children, style, borderBottom, fields, onClose, className, }: ToolbarProps): React.JSX.Element;
|
|
25
30
|
export default Root;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { ButtonSizeContext } from "../../actions/Button.js";
|
|
2
2
|
import { InToolbarContext } from "./context.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import classNames from "classnames";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region ../ui/src/layout/Toolbar/Root.tsx
|
|
7
|
+
var TEXT_FIELD = "input:not([type=checkbox]):not([type=radio]), textarea";
|
|
7
8
|
/**
|
|
8
9
|
* The bar of a Toolbar. Import it from this file only in a component that
|
|
9
10
|
* the Toolbar index imports (for example Tabs), to prevent an import cycle.
|
|
10
11
|
*/
|
|
11
|
-
function Root({ children, style, borderBottom, fields, className }) {
|
|
12
|
+
function Root({ children, style, borderBottom, fields, onClose, className }) {
|
|
13
|
+
const handleKeyDown = (event) => {
|
|
14
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
15
|
+
const target = event.target;
|
|
16
|
+
if (!target.matches(TEXT_FIELD)) return;
|
|
17
|
+
if (!event.currentTarget.contains(target)) return;
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
onClose?.();
|
|
21
|
+
};
|
|
12
22
|
return /* @__PURE__ */ jsx("div", {
|
|
23
|
+
onKeyDown: onClose ? handleKeyDown : void 0,
|
|
13
24
|
className: classNames("Toolbar", style && `Toolbar--${style}`, { "Toolbar--border-bottom": borderBottom }, className),
|
|
14
25
|
children: /* @__PURE__ */ jsx(InToolbarContext.Provider, {
|
|
15
26
|
value: true,
|
|
@@ -13,7 +13,8 @@ export type ToolbarSearchProps = {
|
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* A search or a filter form that takes all the free width of the toolbar.
|
|
16
|
-
* Its children are in a row. It is a search landmark.
|
|
16
|
+
* Its children are in a row. It is a search landmark: a Toolbar.FilterInput
|
|
17
|
+
* in it renders no landmark of its own.
|
|
17
18
|
*/
|
|
18
19
|
declare function ToolbarSearch({ ariaLabel, children, className }: ToolbarSearchProps): React.JSX.Element;
|
|
19
20
|
export default ToolbarSearch;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { useTranslation } from "../../i18n.js";
|
|
2
|
+
import { InSearchContext } from "./context.js";
|
|
2
3
|
import Search from "../../semantic/Search.js";
|
|
3
4
|
import { usePaneAriaLabel } from "../Pane/PaneAriaLabel.js";
|
|
4
5
|
import "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import classNames from "classnames";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
//#region ../ui/src/layout/Toolbar/Search.tsx
|
|
8
9
|
/**
|
|
9
10
|
* A search or a filter form that takes all the free width of the toolbar.
|
|
10
|
-
* Its children are in a row. It is a search landmark.
|
|
11
|
+
* Its children are in a row. It is a search landmark: a Toolbar.FilterInput
|
|
12
|
+
* in it renders no landmark of its own.
|
|
11
13
|
*/
|
|
12
14
|
function ToolbarSearch({ ariaLabel, children, className }) {
|
|
13
15
|
const paneAriaLabel = usePaneAriaLabel();
|
|
@@ -15,7 +17,10 @@ function ToolbarSearch({ ariaLabel, children, className }) {
|
|
|
15
17
|
return /* @__PURE__ */ jsx(Search, {
|
|
16
18
|
ariaLabel: ariaLabel ? tm(ariaLabel) : paneAriaLabel,
|
|
17
19
|
className: classNames("Toolbar__fill", className),
|
|
18
|
-
children
|
|
20
|
+
children: /* @__PURE__ */ jsx(InSearchContext.Provider, {
|
|
21
|
+
value: true,
|
|
22
|
+
children
|
|
23
|
+
})
|
|
19
24
|
});
|
|
20
25
|
}
|
|
21
26
|
//#endregion
|
|
@@ -5,5 +5,6 @@ function NoMenuProvider({ children }) {
|
|
|
5
5
|
return React.createElement(React.Fragment, null, children);
|
|
6
6
|
}
|
|
7
7
|
var ToolbarMenuProviderContext = React.createContext(NoMenuProvider);
|
|
8
|
+
var InSearchContext = React.createContext(false);
|
|
8
9
|
//#endregion
|
|
9
|
-
export { InToolbarContext, ToolbarMenuProviderContext };
|
|
10
|
+
export { InSearchContext, InToolbarContext, ToolbarMenuProviderContext };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Divider from './Divider.js';
|
|
1
2
|
import DotsDropdown from './DotsDropdown.js';
|
|
2
3
|
import Fill from './Fill.js';
|
|
3
4
|
import { useFilterToolbar } from './FilterToggle.js';
|
|
@@ -13,12 +14,13 @@ import Subtitle from './Subtitle.js';
|
|
|
13
14
|
import TextualDropdown from './TextualDropdown.js';
|
|
14
15
|
import Title from './Title.js';
|
|
15
16
|
declare const Toolbar: typeof Root & {
|
|
16
|
-
AddNewButton: import("react").MemoExoticComponent<({ label,
|
|
17
|
+
AddNewButton: import("react").MemoExoticComponent<({ label, to, disabled, icon: customIcon, extraActions, action, }: import("./AddNewButton.js").AddNewButtonProps) => import("react").JSX.Element>;
|
|
17
18
|
Button: import("react").ForwardRefExoticComponent<(import("../../actions/Button.js").ButtonProps & {
|
|
18
19
|
size?: never;
|
|
19
20
|
}) & import("react").RefAttributes<HTMLElement>>;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
Divider: typeof Divider;
|
|
22
|
+
FilterInput: import("react").MemoExoticComponent<({ ariaLabel, ...props }: import("./FilterInput.js").FilterInputProps) => import("react").JSX.Element>;
|
|
23
|
+
FilterToggle: import("react").MemoExoticComponent<({ pressed, onClick, onOpen }: import("./FilterToggle.js").FilterToggleProps) => import("react").JSX.Element>;
|
|
22
24
|
Fill: typeof Fill;
|
|
23
25
|
Search: typeof Search;
|
|
24
26
|
Space: typeof Space;
|
|
@@ -3,6 +3,7 @@ import { TabButton, TabLink, TabList } from "../../navigation/Tabs.js";
|
|
|
3
3
|
import PrimaryButton from "./PrimaryButton.js";
|
|
4
4
|
import AddNewButton_default from "./AddNewButton.js";
|
|
5
5
|
import Button from "./Button.js";
|
|
6
|
+
import Divider from "./Divider.js";
|
|
6
7
|
import DotsDropdown from "./DotsDropdown.js";
|
|
7
8
|
import Fill from "./Fill.js";
|
|
8
9
|
import FilterInput_default from "./FilterInput.js";
|
|
@@ -23,6 +24,7 @@ import TextualDropdown from "./TextualDropdown.js";
|
|
|
23
24
|
var Toolbar = Object.assign(Root, {
|
|
24
25
|
AddNewButton: AddNewButton_default,
|
|
25
26
|
Button,
|
|
27
|
+
Divider,
|
|
26
28
|
FilterInput: FilterInput_default,
|
|
27
29
|
FilterToggle: FilterToggle_default,
|
|
28
30
|
Fill,
|
|
@@ -35,7 +35,7 @@ export type CardListProps = {
|
|
|
35
35
|
* the pointer or the focus is on the item, when its menu is open or when
|
|
36
36
|
* the item is open (on devices without a pointer, always). Use `always`
|
|
37
37
|
* in a list that the user only reads: the actions are the only way to go
|
|
38
|
-
* further.
|
|
38
|
+
* further, and the row under the pointer gets the hover surface.
|
|
39
39
|
*/
|
|
40
40
|
actionsVisibility?: 'hover' | 'always';
|
|
41
41
|
className?: string;
|
|
@@ -98,9 +98,14 @@ type ItemWithoutRow = {
|
|
|
98
98
|
body: ReactNode;
|
|
99
99
|
expandable?: never;
|
|
100
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* The other props go to the `li`, thus the item can be the trigger of a
|
|
103
|
+
* Tooltip for the whole row
|
|
104
|
+
*/
|
|
105
|
+
type ItemElementProps = Omit<React.HTMLAttributes<HTMLLIElement>, 'children' | 'className'>;
|
|
101
106
|
export type CardListItemProps = {
|
|
102
107
|
className?: string;
|
|
103
|
-
} & (ItemWithRow | ExpandableItem | ItemWithoutRow);
|
|
108
|
+
} & ItemElementProps & (ItemWithRow | ExpandableItem | ItemWithoutRow);
|
|
104
109
|
export type CardListRemoveButtonProps = {
|
|
105
110
|
/** The accessible name and the tooltip, for example "Remove trigger" */
|
|
106
111
|
label: TextMessage;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
3
|
import RawButton from "../semantic/RawButton.js";
|
|
3
4
|
import Button from "../actions/Button.js";
|
|
4
|
-
import { Generic } from "../../icons/index.js";
|
|
5
5
|
import { DisclosureChevron } from "../navigation/Chevron.js";
|
|
6
6
|
import { Dropdown } from "../actions/Dropdown/index.js";
|
|
7
7
|
import { useSmartRowClick } from "../hooks/useSmartRowClick.js";
|
|
8
8
|
import React from "react";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import classNames from "classnames";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region ../ui/src/lists/CardList.tsx
|
|
12
12
|
/**
|
|
13
13
|
* A list of items in one card (the rules of a role, the triggers of a
|
|
@@ -20,12 +20,12 @@ import classNames from "classnames";
|
|
|
20
20
|
* makes at each render. Memoize the components that make the items.
|
|
21
21
|
*/
|
|
22
22
|
function CardList({ header, add, empty, actionsVisibility = "hover", className, id, children }) {
|
|
23
|
-
if (empty && React.Children.toArray(children).length === 0) return /* @__PURE__ */ jsx(Fragment, { children: empty });
|
|
23
|
+
if (empty && React.Children.toArray(children).length === 0) return /* @__PURE__ */ jsx(Fragment$1, { children: empty });
|
|
24
24
|
const open = header?.collapse ? header.collapse.open : true;
|
|
25
25
|
return /* @__PURE__ */ jsxs("div", {
|
|
26
26
|
className: classNames("CardList", { "CardList--actions-always": actionsVisibility === "always" }, className),
|
|
27
27
|
id,
|
|
28
|
-
children: [header && /* @__PURE__ */ jsx(CardListHeaderStrip, { ...header }), open && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("ul", {
|
|
28
|
+
children: [header && /* @__PURE__ */ jsx(CardListHeaderStrip, { ...header }), open && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("ul", {
|
|
29
29
|
className: "CardList__items",
|
|
30
30
|
children
|
|
31
31
|
}), add && /* @__PURE__ */ jsx(CardListAddButton, { ...add })] })]
|
|
@@ -33,7 +33,7 @@ function CardList({ header, add, empty, actionsVisibility = "hover", className,
|
|
|
33
33
|
}
|
|
34
34
|
function CardListHeaderStrip({ image, title, aside, trailing, collapse }) {
|
|
35
35
|
const { tc } = useTranslation();
|
|
36
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
37
37
|
collapse && /* @__PURE__ */ jsx(DisclosureChevron, { open: collapse.open }),
|
|
38
38
|
image && /* @__PURE__ */ jsx("span", {
|
|
39
39
|
className: "CardList__image",
|
|
@@ -87,10 +87,11 @@ function CardListAddButton({ label, icon = Generic.AddIcon, onClick, options })
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
/** An item of a CardList: a row, a body, or a row with a body */
|
|
90
|
-
var Item = React.forwardRef(function Item({ className, row, body, expandable }, ref) {
|
|
90
|
+
var Item = React.forwardRef(function Item({ className, row, body, expandable, ...elementProps }, ref) {
|
|
91
91
|
const visibleBody = expandable ? expandable.open && expandable.body : body;
|
|
92
92
|
const handleRowClick = useSmartRowClick(() => expandable?.onToggle(), Boolean(expandable));
|
|
93
93
|
return /* @__PURE__ */ jsxs("li", {
|
|
94
|
+
...elementProps,
|
|
94
95
|
ref,
|
|
95
96
|
className: classNames("CardList__item", { "is-open": expandable?.open }, className),
|
|
96
97
|
children: [row && /* @__PURE__ */ jsxs("div", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
3
|
import RawButton from "../semantic/RawButton.js";
|
|
3
4
|
import { buttonClassName } from "../actions/Button.js";
|
|
4
|
-
import { Generic } from "../../icons/index.js";
|
|
5
5
|
import { Dropdown } from "../actions/Dropdown/index.js";
|
|
6
6
|
import "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/lists/EmptySlot.tsx
|
|
10
10
|
var EmptySlot = (props) => {
|
|
11
11
|
const { tc } = useTranslation();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import classNames from "classnames";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region ../ui/src/lists/EntityRow.tsx
|
|
6
6
|
function EntityRow({ layout, image, kicker, title, afterTitle, aside, multilineTitle, trailing, children }) {
|
|
7
7
|
const { tc } = useTranslation();
|