datocms-react-ui 3.1.0-next.10 → 3.1.0-next.11
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/InsertGap.js +2 -2
- package/dist/styles.css +364 -52
- package/dist/ui-public/icons/index.js +304 -300
- package/dist/ui-public/icons/lucide/arrow-down-wide-narrow.js +28 -0
- package/dist/ui-public/icons/lucide/arrow-up-narrow-wide.js +28 -0
- package/dist/ui-public/locales/en.js +1 -0
- package/dist/ui-public/src/UiTextKey.d.ts +1 -1
- package/dist/ui-public/src/actions/Actions/index.d.ts +1 -1
- package/dist/ui-public/src/actions/Actions/registry.d.ts +23 -1
- package/dist/ui-public/src/actions/Actions/registry.js +38 -6
- package/dist/ui-public/src/form/SelectInput/SelectMenu.js +1 -1
- package/dist/ui-public/src/form/SelectInput/SortableMultiValue.js +1 -1
- package/dist/ui-public/src/form/SwitchInput.d.ts +17 -2
- package/dist/ui-public/src/form/SwitchInput.js +57 -38
- package/dist/ui-public/src/form/SwitchList.d.ts +2 -1
- package/dist/ui-public/src/form/SwitchList.js +2 -1
- package/dist/ui-public/src/layout/SidebarPanel.d.ts +15 -1
- package/dist/ui-public/src/layout/SidebarPanel.js +30 -17
- package/dist/ui-public/src/layout/SplitPane/index.js +1 -0
- package/dist/ui-public/src/layout/Toolbar/FilterToggle.d.ts +2 -2
- package/dist/ui-public/src/layout/Toolbar/FilterToggle.js +6 -6
- package/dist/ui-public/src/layout/Toolbar/Help.d.ts +7 -1
- package/dist/ui-public/src/layout/Toolbar/Help.js +5 -4
- package/dist/ui-public/src/layout/Toolbar/index.d.ts +1 -1
- package/dist/ui-public/src/layout/Toolbar/index.js +1 -1
- package/dist/ui-public/src/lists/InfoList/Value.d.ts +22 -2
- package/dist/ui-public/src/lists/InfoList/Value.js +25 -1
- package/dist/ui-public/src/lists/InfoList/index.d.ts +2 -1
- package/dist/ui-public/src/lists/InsertGap/index.d.ts +31 -1
- package/dist/ui-public/src/lists/InsertGap/index.js +23 -3
- package/dist/ui-public/src/lists/InsertGap/parts.d.ts +2 -1
- package/dist/ui-public/src/lists/InsertGap/parts.js +60 -27
- package/dist/ui-public/src/lists/Table/cells/TimeCell.d.ts +1 -1
- package/dist/ui-public/src/lists/Table/cells/TimeCell.js +8 -5
- package/dist/ui-public/src/lists/Table/layout.js +3 -3
- package/dist/ui-public/src/lists/Table/types.d.ts +6 -0
- package/dist/ui-public/src/lists/UploadCard.js +7 -4
- package/dist/ui-public/src/overlays/Modal/Layer.d.ts +18 -0
- package/dist/ui-public/src/overlays/Modal/Layer.js +3 -2
- package/dist/ui-public/src/overlays/Modal/index.d.ts +10 -1
- package/dist/ui-public/src/overlays/Modal/index.js +2 -1
- package/dist/ui-public/src/overlays/Popover.js +4 -1
- package/dist/ui-public/src/patterns/ListDetail/Split.js +1 -0
- package/dist/ui-public/src/utils/pointerNearGap.d.ts +23 -0
- package/dist/ui-public/src/utils/pointerNearGap.js +211 -11
- package/package.json +1 -1
|
@@ -6,13 +6,13 @@ import React from "react";
|
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region ../ui-public/src/layout/Toolbar/Help.tsx
|
|
9
|
-
function Trigger({ open, onTrigger }) {
|
|
10
|
-
const { t } = useTranslation();
|
|
9
|
+
function Trigger({ open, onTrigger, ariaLabel }) {
|
|
10
|
+
const { t, tm } = useTranslation();
|
|
11
11
|
return /* @__PURE__ */ jsx(DropdownTriggerButton_default, {
|
|
12
12
|
open,
|
|
13
13
|
onTrigger,
|
|
14
14
|
className: classNames("Toolbar__help", { "is-open": open }),
|
|
15
|
-
"aria-label": t("toolbar.help"),
|
|
15
|
+
"aria-label": ariaLabel ? tm(ariaLabel) : t("toolbar.help"),
|
|
16
16
|
children: /* @__PURE__ */ jsx(Generic.CircleQuestionIcon, {})
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -20,9 +20,10 @@ function Trigger({ open, onTrigger }) {
|
|
|
20
20
|
* A "?" button that opens the text that says what the page is for. Give
|
|
21
21
|
* Help to the "help" prop of Toolbar.Title, not as a sibling of the title.
|
|
22
22
|
*/
|
|
23
|
-
function Help({ children, docsUrl }) {
|
|
23
|
+
function Help({ children, docsUrl, ariaLabel }) {
|
|
24
24
|
return /* @__PURE__ */ jsx(Dropdown, {
|
|
25
25
|
triggerComponent: Trigger,
|
|
26
|
+
ariaLabel,
|
|
26
27
|
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
27
28
|
placement: "bottom-start",
|
|
28
29
|
minWidth: 360,
|
|
@@ -31,7 +31,7 @@ declare const Toolbar: typeof Root & {
|
|
|
31
31
|
PresetsTitle: import("react").NamedExoticComponent<import("./PresetsTitle.js").PresetsTitleProps> & {
|
|
32
32
|
Option: import("react").NamedExoticComponent<import("./PresetsTitle.js").PresetsTitleOptionProps>;
|
|
33
33
|
};
|
|
34
|
-
Help: import("react").MemoExoticComponent<({ children, docsUrl }: import("./Help.js").HelpProps) => import("react").JSX.Element>;
|
|
34
|
+
Help: import("react").MemoExoticComponent<({ children, docsUrl, ariaLabel }: import("./Help.js").HelpProps) => import("react").JSX.Element>;
|
|
35
35
|
HelpBody: typeof HelpBody;
|
|
36
36
|
Note: typeof Note;
|
|
37
37
|
Spinner: typeof Spinner;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Help_default, { HelpBody } from "./Help.js";
|
|
1
2
|
import Root from "./Root.js";
|
|
2
3
|
import { TabButton, TabLink, TabList } from "../../navigation/Tabs.js";
|
|
3
4
|
import PrimaryButton from "./PrimaryButton.js";
|
|
@@ -10,7 +11,6 @@ import FilterInput_default from "./FilterInput.js";
|
|
|
10
11
|
import FilterToggle_default, { useFilterToolbar } from "./FilterToggle.js";
|
|
11
12
|
import GoBack from "./GoBack.js";
|
|
12
13
|
import Group_default from "./Group.js";
|
|
13
|
-
import Help_default, { HelpBody } from "./Help.js";
|
|
14
14
|
import Note from "./Note.js";
|
|
15
15
|
import ToolbarPagination from "./Pagination.js";
|
|
16
16
|
import Title from "./Title.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { type SyntheticEvent } from 'react';
|
|
2
|
-
import type { Message } from '../../Message.js';
|
|
1
|
+
import React, { type MouseEvent, type SyntheticEvent } from 'react';
|
|
2
|
+
import type { Message, TextMessage } from '../../Message.js';
|
|
3
|
+
import type { SvgIcon } from '../../utils/types.js';
|
|
3
4
|
export type InfoListValueProps = {
|
|
4
5
|
/** The value, for example the file name of an asset */
|
|
5
6
|
label: Message;
|
|
@@ -12,6 +13,18 @@ export type InfoListValueTriggerProps = {
|
|
|
12
13
|
/** Opens or closes the menu. Dropdown gives it. */
|
|
13
14
|
onTrigger: (event: SyntheticEvent) => void;
|
|
14
15
|
};
|
|
16
|
+
export type InfoListValueButtonProps = {
|
|
17
|
+
/** The value, for example the name of a plan */
|
|
18
|
+
label: Message;
|
|
19
|
+
/** The icon after the value. It says what the click does. */
|
|
20
|
+
icon: SvgIcon;
|
|
21
|
+
/**
|
|
22
|
+
* What the click does, for example "Details of the plan". It shows in a
|
|
23
|
+
* tooltip on hover and on keyboard focus.
|
|
24
|
+
*/
|
|
25
|
+
tooltip: TextMessage;
|
|
26
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => unknown;
|
|
27
|
+
};
|
|
15
28
|
/**
|
|
16
29
|
* A value in a row of an InfoList, that the user cannot change. It has the
|
|
17
30
|
* same look as `InfoList.Value.Trigger`, so the values of the rows align.
|
|
@@ -22,9 +35,16 @@ declare function Value({ label }: InfoListValueProps): React.JSX.Element;
|
|
|
22
35
|
* trigger of a Dropdown. Give it to `triggerComponent` of `Dropdown`.
|
|
23
36
|
*/
|
|
24
37
|
declare function ValueTrigger({ label, open, onTrigger }: InfoListValueTriggerProps): React.JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* A value in a row of an InfoList that a click opens, for example the
|
|
40
|
+
* details of a plan. It is not for a value that the user changes: that is
|
|
41
|
+
* `InfoList.Value.Trigger`.
|
|
42
|
+
*/
|
|
43
|
+
declare function ValueButton({ label, icon: Icon, tooltip, onClick, }: InfoListValueButtonProps): React.JSX.Element;
|
|
25
44
|
declare const _default: React.NamedExoticComponent<InfoListValueProps> & {
|
|
26
45
|
readonly type: typeof Value;
|
|
27
46
|
} & {
|
|
28
47
|
Trigger: React.MemoExoticComponent<typeof ValueTrigger>;
|
|
48
|
+
Button: React.MemoExoticComponent<typeof ValueButton>;
|
|
29
49
|
};
|
|
30
50
|
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useTranslation } from "../../i18n.js";
|
|
2
|
+
import Tooltip from "../../overlays/Tooltip/index.js";
|
|
3
|
+
import RawButton from "../../semantic/RawButton.js";
|
|
2
4
|
import { MenuChevron } from "../../navigation/Chevron.js";
|
|
3
5
|
import DropdownTriggerButton_default from "../../actions/Dropdown/triggers/DropdownTriggerButton.js";
|
|
4
6
|
import React from "react";
|
|
@@ -34,6 +36,28 @@ function ValueTrigger({ label, open, onTrigger }) {
|
|
|
34
36
|
}), /* @__PURE__ */ jsx(MenuChevron, {})]
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
/**
|
|
40
|
+
* A value in a row of an InfoList that a click opens, for example the
|
|
41
|
+
* details of a plan. It is not for a value that the user changes: that is
|
|
42
|
+
* `InfoList.Value.Trigger`.
|
|
43
|
+
*/
|
|
44
|
+
function ValueButton({ label, icon: Icon, tooltip, onClick }) {
|
|
45
|
+
const { tc, tm } = useTranslation();
|
|
46
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
47
|
+
label: tm(tooltip),
|
|
48
|
+
children: /* @__PURE__ */ jsxs(RawButton, {
|
|
49
|
+
className: "InfoList__value is-editable button--ghost-inline",
|
|
50
|
+
onClick,
|
|
51
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: "InfoList__value__label",
|
|
53
|
+
children: tc(label)
|
|
54
|
+
}), /* @__PURE__ */ jsx(Icon, {})]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
var Value_default = Object.assign(React.memo(Value), {
|
|
59
|
+
Trigger: React.memo(ValueTrigger),
|
|
60
|
+
Button: React.memo(ValueButton)
|
|
61
|
+
});
|
|
38
62
|
//#endregion
|
|
39
63
|
export { Value_default as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { type Message } from '../../Message.js';
|
|
3
3
|
export type { InfoListUserData, InfoListUserProps, InfoListUserTriggerProps, } from './User.js';
|
|
4
|
-
export type { InfoListValueProps, InfoListValueTriggerProps } from './Value.js';
|
|
4
|
+
export type { InfoListValueButtonProps, InfoListValueProps, InfoListValueTriggerProps, } from './Value.js';
|
|
5
5
|
export type InfoListProps = {
|
|
6
6
|
className?: string;
|
|
7
7
|
/** The rows (InfoList.Row) and the groups (InfoList.Group) */
|
|
@@ -49,6 +49,7 @@ declare const InfoList: React.NamedExoticComponent<InfoListProps> & {
|
|
|
49
49
|
readonly type: ({ label }: import("./Value.js").InfoListValueProps) => React.JSX.Element;
|
|
50
50
|
} & {
|
|
51
51
|
Trigger: React.MemoExoticComponent<({ label, open, onTrigger }: import("./Value.js").InfoListValueTriggerProps) => React.JSX.Element>;
|
|
52
|
+
Button: React.MemoExoticComponent<({ label, icon: Icon, tooltip, onClick, }: import("./Value.js").InfoListValueButtonProps) => React.JSX.Element>;
|
|
52
53
|
};
|
|
53
54
|
User: React.NamedExoticComponent<import("./User.js").InfoListUserProps> & {
|
|
54
55
|
readonly type: ({ user, tooltip }: import("./User.js").InfoListUserProps) => React.JSX.Element;
|
|
@@ -5,24 +5,54 @@ import { type InsertGapBaseProps } from './parts.js';
|
|
|
5
5
|
* The props of the element of a list with gaps: give them to the element
|
|
6
6
|
* that holds the items (`<div {...insertGapListProps}>`). The gaps of the
|
|
7
7
|
* list then show their button when the pointer is near them.
|
|
8
|
+
*
|
|
9
|
+
* When the list has free space on its left, the gap nearest to the pointer
|
|
10
|
+
* shows its label next to the "+", in that margin. The gaps of the nested
|
|
11
|
+
* lists then move to the column of the outermost list. When the margin is
|
|
12
|
+
* too narrow for the label, each gap shows only its "+", in the gutter of
|
|
13
|
+
* its own list.
|
|
8
14
|
*/
|
|
9
15
|
export declare const insertGapListProps: {
|
|
10
16
|
'data-gap-list': string;
|
|
11
17
|
onPointerMove: typeof handlePointerMoveList;
|
|
12
18
|
onPointerLeave: typeof handlePointerLeaveList;
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* The props of an element that draws a frame around the lists in it: the
|
|
22
|
+
* free margin of those lists ends at its left edge. A list in it shows its
|
|
23
|
+
* labels only when they fit on the right of that edge.
|
|
24
|
+
*/
|
|
25
|
+
export declare const insertGapMarginBoundaryProps: {
|
|
26
|
+
"data-gap-margin-boundary": string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The props of an element that is in the margin on the left of a list, for
|
|
30
|
+
* example a title at the side of the list. A gap whose label covers the
|
|
31
|
+
* element shows only its "+", in the gutter of its own list. The other gaps
|
|
32
|
+
* show their label.
|
|
33
|
+
*/
|
|
34
|
+
export declare const insertGapMarginObstacleProps: {
|
|
35
|
+
"data-gap-margin-obstacle": string;
|
|
36
|
+
};
|
|
14
37
|
/** A gap that adds the item at once, when there is no choice to make. */
|
|
15
38
|
export type InsertGapActionProps = InsertGapBaseProps & {
|
|
16
39
|
/** Runs on a click on the gap. */
|
|
17
40
|
onTrigger: () => void;
|
|
18
41
|
children?: never;
|
|
42
|
+
menuMinWidth?: never;
|
|
19
43
|
};
|
|
20
44
|
/** A gap that opens a menu, when the user has a choice to make. */
|
|
21
45
|
export type InsertGapMenuProps = InsertGapBaseProps & {
|
|
22
46
|
onTrigger?: never;
|
|
23
47
|
/** The options of the menu that a click on the gap opens. */
|
|
24
48
|
children: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* The minimum width of the menu, in pixels. Give the width of the menu
|
|
51
|
+
* that adds the same items in another place, so the two menus look the
|
|
52
|
+
* same.
|
|
53
|
+
*/
|
|
54
|
+
menuMinWidth?: number;
|
|
25
55
|
};
|
|
26
56
|
export type InsertGapProps = InsertGapActionProps | InsertGapMenuProps;
|
|
27
|
-
declare const _default: React.MemoExoticComponent<({ position, label, onTrigger, children, }: InsertGapProps) => React.JSX.Element>;
|
|
57
|
+
declare const _default: React.MemoExoticComponent<({ position, label, onTrigger, children, menuMinWidth, }: InsertGapProps) => React.JSX.Element>;
|
|
28
58
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dropdown } from "../../actions/Dropdown/index.js";
|
|
2
|
-
import { handlePointerLeaveList, handlePointerMoveList } from "../../utils/pointerNearGap.js";
|
|
2
|
+
import { MARGIN_BOUNDARY_ATTRIBUTE, MARGIN_OBSTACLE_ATTRIBUTE, handlePointerLeaveList, handlePointerMoveList } from "../../utils/pointerNearGap.js";
|
|
3
3
|
import { Bar, GapFrame } from "./parts.js";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -8,18 +8,37 @@ import { jsx } from "react/jsx-runtime";
|
|
|
8
8
|
* The props of the element of a list with gaps: give them to the element
|
|
9
9
|
* that holds the items (`<div {...insertGapListProps}>`). The gaps of the
|
|
10
10
|
* list then show their button when the pointer is near them.
|
|
11
|
+
*
|
|
12
|
+
* When the list has free space on its left, the gap nearest to the pointer
|
|
13
|
+
* shows its label next to the "+", in that margin. The gaps of the nested
|
|
14
|
+
* lists then move to the column of the outermost list. When the margin is
|
|
15
|
+
* too narrow for the label, each gap shows only its "+", in the gutter of
|
|
16
|
+
* its own list.
|
|
11
17
|
*/
|
|
12
18
|
var insertGapListProps = {
|
|
13
19
|
"data-gap-list": "",
|
|
14
20
|
onPointerMove: handlePointerMoveList,
|
|
15
21
|
onPointerLeave: handlePointerLeaveList
|
|
16
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* The props of an element that draws a frame around the lists in it: the
|
|
25
|
+
* free margin of those lists ends at its left edge. A list in it shows its
|
|
26
|
+
* labels only when they fit on the right of that edge.
|
|
27
|
+
*/
|
|
28
|
+
var insertGapMarginBoundaryProps = { [MARGIN_BOUNDARY_ATTRIBUTE]: "" };
|
|
29
|
+
/**
|
|
30
|
+
* The props of an element that is in the margin on the left of a list, for
|
|
31
|
+
* example a title at the side of the list. A gap whose label covers the
|
|
32
|
+
* element shows only its "+", in the gutter of its own list. The other gaps
|
|
33
|
+
* show their label.
|
|
34
|
+
*/
|
|
35
|
+
var insertGapMarginObstacleProps = { [MARGIN_OBSTACLE_ATTRIBUTE]: "" };
|
|
17
36
|
var BarMenuTrigger = ({ label, onTrigger, open }) => /* @__PURE__ */ jsx(Bar, {
|
|
18
37
|
label,
|
|
19
38
|
onTrigger,
|
|
20
39
|
open
|
|
21
40
|
});
|
|
22
|
-
var InsertGap = ({ position, label, onTrigger, children }) => /* @__PURE__ */ jsx(GapFrame, {
|
|
41
|
+
var InsertGap = ({ position, label, onTrigger, children, menuMinWidth }) => /* @__PURE__ */ jsx(GapFrame, {
|
|
23
42
|
position,
|
|
24
43
|
children: onTrigger ? /* @__PURE__ */ jsx(Bar, {
|
|
25
44
|
label,
|
|
@@ -29,10 +48,11 @@ var InsertGap = ({ position, label, onTrigger, children }) => /* @__PURE__ */ js
|
|
|
29
48
|
label,
|
|
30
49
|
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
31
50
|
placement: "bottom-start",
|
|
51
|
+
minWidth: menuMinWidth,
|
|
32
52
|
children
|
|
33
53
|
})
|
|
34
54
|
})
|
|
35
55
|
});
|
|
36
56
|
var InsertGap_default = React.memo(InsertGap);
|
|
37
57
|
//#endregion
|
|
38
|
-
export { InsertGap_default as default, insertGapListProps };
|
|
58
|
+
export { InsertGap_default as default, insertGapListProps, insertGapMarginBoundaryProps, insertGapMarginObstacleProps };
|
|
@@ -8,7 +8,8 @@ export type InsertGapBaseProps = {
|
|
|
8
8
|
position: 'before' | 'after';
|
|
9
9
|
/**
|
|
10
10
|
* What a click on the gap does. For example "Add a block". It is the
|
|
11
|
-
* accessible name of the gap and the text of the
|
|
11
|
+
* accessible name of the gap and the tooltip text of the small button. In
|
|
12
|
+
* a list with free space on its left, it also shows next to the small
|
|
12
13
|
* button.
|
|
13
14
|
*/
|
|
14
15
|
label: TextMessage;
|
|
@@ -3,44 +3,77 @@ import { useTranslation } from "../../i18n.js";
|
|
|
3
3
|
import Tooltip from "../../overlays/Tooltip/index.js";
|
|
4
4
|
import RawButton from "../../semantic/RawButton.js";
|
|
5
5
|
import DropdownContext from "../../actions/Dropdown/DropdownContext.js";
|
|
6
|
-
import {
|
|
6
|
+
import { GAP_SELECTOR, LABEL_FITS_ATTRIBUTE, watchEndGap } from "../../utils/pointerNearGap.js";
|
|
7
|
+
import { useContext, useEffect, useRef, useState } from "react";
|
|
7
8
|
import classNames from "classnames";
|
|
8
|
-
import {
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
//#region ../ui-public/src/lists/InsertGap/parts.tsx
|
|
11
|
+
function useLabelInMargin() {
|
|
12
|
+
const labelRef = useRef(null);
|
|
13
|
+
const [labelInMargin, setLabelInMargin] = useState(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const gap = labelRef.current?.closest(GAP_SELECTOR);
|
|
16
|
+
if (!gap) return;
|
|
17
|
+
const read = () => setLabelInMargin(gap.hasAttribute(LABEL_FITS_ATTRIBUTE));
|
|
18
|
+
const observer = new MutationObserver(read);
|
|
19
|
+
read();
|
|
20
|
+
observer.observe(gap, {
|
|
21
|
+
attributes: true,
|
|
22
|
+
attributeFilter: [LABEL_FITS_ATTRIBUTE]
|
|
23
|
+
});
|
|
24
|
+
return () => observer.disconnect();
|
|
25
|
+
}, []);
|
|
26
|
+
return {
|
|
27
|
+
labelRef,
|
|
28
|
+
labelInMargin
|
|
29
|
+
};
|
|
30
|
+
}
|
|
10
31
|
var Bar = ({ label, onTrigger, open }) => {
|
|
11
32
|
const { triggerId, menuId } = useContext(DropdownContext);
|
|
12
33
|
const { tm } = useTranslation();
|
|
13
34
|
const labelText = tm(label);
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
label: labelText,
|
|
17
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
18
|
-
className: "InsertGap__plus",
|
|
19
|
-
children: /* @__PURE__ */ jsx(Generic.AddIcon, {})
|
|
20
|
-
})
|
|
21
|
-
}), /* @__PURE__ */ jsx("span", { className: "InsertGap__line" })] });
|
|
22
|
-
return open === void 0 ? /* @__PURE__ */ jsx(RawButton, {
|
|
23
|
-
className: "InsertGap__bar",
|
|
24
|
-
ariaLabel: labelText,
|
|
25
|
-
onClick: onTrigger,
|
|
26
|
-
children: content
|
|
27
|
-
}) : /* @__PURE__ */ jsx(RawButton, {
|
|
28
|
-
id: triggerId,
|
|
35
|
+
const { labelRef, labelInMargin } = useLabelInMargin();
|
|
36
|
+
const bar = /* @__PURE__ */ jsxs(RawButton, {
|
|
29
37
|
className: "InsertGap__bar",
|
|
30
38
|
ariaLabel: labelText,
|
|
31
39
|
onClick: onTrigger,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
...open === void 0 ? void 0 : {
|
|
41
|
+
id: triggerId,
|
|
42
|
+
haspopup: "menu",
|
|
43
|
+
expandable: {
|
|
44
|
+
open,
|
|
45
|
+
controls: menuId
|
|
46
|
+
}
|
|
36
47
|
},
|
|
37
|
-
children:
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx("span", {
|
|
50
|
+
ref: labelRef,
|
|
51
|
+
className: "InsertGap__label",
|
|
52
|
+
"aria-hidden": "true",
|
|
53
|
+
children: labelText
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "InsertGap__plus",
|
|
57
|
+
children: /* @__PURE__ */ jsx(Generic.AddIcon, {})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx("span", { className: "InsertGap__line" })
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
63
|
+
placement: "left",
|
|
64
|
+
label: !labelInMargin && labelText,
|
|
65
|
+
children: bar
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var GapFrame = ({ position, children }) => {
|
|
69
|
+
const ref = useRef(null);
|
|
70
|
+
useEffect(() => position === "after" && ref.current ? watchEndGap(ref.current) : void 0, [position]);
|
|
71
|
+
return /* @__PURE__ */ jsx("div", {
|
|
72
|
+
ref,
|
|
73
|
+
className: classNames("InsertGap", `InsertGap--${position}`),
|
|
74
|
+
"data-gap": position,
|
|
75
|
+
children
|
|
38
76
|
});
|
|
39
77
|
};
|
|
40
|
-
var GapFrame = ({ position, children }) => /* @__PURE__ */ jsx("div", {
|
|
41
|
-
className: classNames("InsertGap", `InsertGap--${position}`),
|
|
42
|
-
"data-gap": "",
|
|
43
|
-
children
|
|
44
|
-
});
|
|
45
78
|
//#endregion
|
|
46
79
|
export { Bar, GapFrame };
|
|
@@ -3,7 +3,7 @@ export type TimeCellProps = {
|
|
|
3
3
|
/** The date, as an ISO 8601 string */
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
|
-
/** A date as a relative time.
|
|
6
|
+
/** A date as a relative time. A tooltip shows the full date and time. */
|
|
7
7
|
declare function TimeCell({ value }: TimeCellProps): React.JSX.Element;
|
|
8
8
|
declare const _default: React.MemoExoticComponent<typeof TimeCell>;
|
|
9
9
|
export default _default;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { useDateSettings } from "../../../content/DateSettings.js";
|
|
2
|
+
import Tooltip from "../../../overlays/Tooltip/index.js";
|
|
2
3
|
import { formatFullDateTime } from "../../../utils/formatDate.js";
|
|
3
4
|
import SmartDate from "../../../content/SmartDate.js";
|
|
4
5
|
import React from "react";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
//#region ../ui-public/src/lists/Table/cells/TimeCell.tsx
|
|
7
|
-
/** A date as a relative time.
|
|
8
|
+
/** A date as a relative time. A tooltip shows the full date and time. */
|
|
8
9
|
function TimeCell({ value }) {
|
|
9
10
|
const settings = useDateSettings();
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
12
|
+
label: formatFullDateTime(value, settings),
|
|
13
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "TimeCell",
|
|
15
|
+
children: /* @__PURE__ */ jsx(SmartDate, { value })
|
|
16
|
+
})
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
var TimeCell_default = React.memo(TimeCell);
|
|
@@ -19,12 +19,12 @@ function toLayoutColumns({ columnNames, widths }) {
|
|
|
19
19
|
}
|
|
20
20
|
var DEFAULT_MIN_COLUMN_PIXELS = 120;
|
|
21
21
|
function fitTableLayout(resolved, columnsByName, availableWidth) {
|
|
22
|
-
if (availableWidth === void 0) return resolved;
|
|
23
22
|
const minWidth = (name) => columnsByName.get(name)?.minWidth ?? DEFAULT_MIN_COLUMN_PIXELS;
|
|
24
23
|
const priority = (name) => columnsByName.get(name)?.priority ?? 0;
|
|
25
|
-
const
|
|
24
|
+
const notHidden = resolved.columnNames.filter((name) => !columnsByName.get(name)?.hidden);
|
|
25
|
+
const names = notHidden.length > 0 ? notHidden : resolved.columnNames.slice(0, 1);
|
|
26
26
|
let total = names.reduce((sum, name) => sum + minWidth(name), 0);
|
|
27
|
-
while (names.length > 1 && total > availableWidth) {
|
|
27
|
+
while (availableWidth !== void 0 && names.length > 1 && total > availableWidth) {
|
|
28
28
|
let dropIndex = names.length - 1;
|
|
29
29
|
for (let index = names.length - 2; index >= 1; index -= 1) if (priority(names[index]) < priority(names[dropIndex])) dropIndex = index;
|
|
30
30
|
total -= minWidth(names[dropIndex]);
|
|
@@ -25,6 +25,12 @@ export type TableColumn<R = any> = {
|
|
|
25
25
|
* is 0). The first visible column always stays.
|
|
26
26
|
*/
|
|
27
27
|
priority?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The table does not show the column, but the layout keeps its place and
|
|
30
|
+
* its width. Use it for a column that shows only in some conditions (a wide
|
|
31
|
+
* viewport, an open pane), so that the choices of the user stay.
|
|
32
|
+
*/
|
|
33
|
+
hidden?: boolean;
|
|
28
34
|
/**
|
|
29
35
|
* The content of the cell of this column for a row. A row with its own
|
|
30
36
|
* children does not use it.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Generic, Status } from "../../icons/index.js";
|
|
2
2
|
import { useTranslation } from "../i18n.js";
|
|
3
3
|
import { useLoadedUpload, useUploadMainLocale } from "../content/UploadPreview/presentation.js";
|
|
4
|
+
import Tooltip from "../overlays/Tooltip/index.js";
|
|
4
5
|
import Button from "../actions/Button.js";
|
|
5
6
|
import MediaCard from "./MediaCard.js";
|
|
6
7
|
import { useAudioPlayback } from "../content/UploadPreview/audio.js";
|
|
@@ -55,10 +56,12 @@ var PreviewModeCard = forwardRef(function PreviewModeCard({ children, caption, p
|
|
|
55
56
|
...cardProps,
|
|
56
57
|
ref,
|
|
57
58
|
caption: cardCaption,
|
|
58
|
-
children: [threatDetected && /* @__PURE__ */
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
children: [threatDetected && /* @__PURE__ */ jsx(Tooltip, {
|
|
60
|
+
label: threatLabel,
|
|
61
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "UploadCard__antivirus-badge",
|
|
63
|
+
children: [/* @__PURE__ */ jsx(Status.BanIcon, {}), /* @__PURE__ */ jsx("span", { children: threatLabel })]
|
|
64
|
+
})
|
|
62
65
|
}), children]
|
|
63
66
|
});
|
|
64
67
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** How the backdrop covers the page: see `ModalProps` */
|
|
3
|
+
export type ModalBackdrop = 'blur' | 'dim';
|
|
4
|
+
type ModalLayerProps = {
|
|
5
|
+
kind: 'dialog' | 'fullscreen';
|
|
6
|
+
/** @default "blur" */
|
|
7
|
+
backdrop?: ModalBackdrop;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
10
|
+
/** The panel of the dialog */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The layer of a dialog over the page, with its backdrop. `Modal`,
|
|
15
|
+
* `FullscreenModal` and their pictures at rest (`Static.tsx`) render it.
|
|
16
|
+
*/
|
|
17
|
+
export default function ModalLayer({ kind, backdrop, style, onClick, children, }: ModalLayerProps): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import "react";
|
|
2
|
+
import classNames from "classnames";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region ../ui-public/src/overlays/Modal/Layer.tsx
|
|
4
5
|
/**
|
|
5
6
|
* The layer of a dialog over the page, with its backdrop. `Modal`,
|
|
6
7
|
* `FullscreenModal` and their pictures at rest (`Static.tsx`) render it.
|
|
7
8
|
*/
|
|
8
|
-
function ModalLayer({ kind, style, onClick, children }) {
|
|
9
|
+
function ModalLayer({ kind, backdrop = "blur", style, onClick, children }) {
|
|
9
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
10
11
|
className: `Modal Modal--${kind}`,
|
|
11
12
|
style,
|
|
12
13
|
onClick,
|
|
13
|
-
children: [/* @__PURE__ */ jsx("div", { className: "Modal__backdrop" }), children]
|
|
14
|
+
children: [/* @__PURE__ */ jsx("div", { className: classNames("Modal__backdrop", { "Modal__backdrop--dim": backdrop === "dim" }) }), children]
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
//#endregion
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type Message, type TextMessage } from '../../Message.js';
|
|
3
|
+
import { type ModalBackdrop } from './Layer.js';
|
|
3
4
|
import { type ModalWidth } from './Panel.js';
|
|
4
|
-
export type { ModalWidth };
|
|
5
|
+
export type { ModalBackdrop, ModalWidth };
|
|
5
6
|
/**
|
|
6
7
|
* The name of the dialog for a screen reader: the title of its header, or an
|
|
7
8
|
* `ariaLabel` when the dialog has no header.
|
|
@@ -44,6 +45,14 @@ export type ModalProps = ModalName & {
|
|
|
44
45
|
* @default "s"
|
|
45
46
|
*/
|
|
46
47
|
width?: ModalWidth | number;
|
|
48
|
+
/**
|
|
49
|
+
* How the backdrop covers the page. `"blur"` blurs and dims the page.
|
|
50
|
+
* `"dim"` only dims it a little, so the user still reads the page. Use
|
|
51
|
+
* it for a dialog that acts on the page under it, for example the
|
|
52
|
+
* command palette.
|
|
53
|
+
* @default "blur"
|
|
54
|
+
*/
|
|
55
|
+
backdrop?: ModalBackdrop;
|
|
47
56
|
};
|
|
48
57
|
export type ModalPartProps = {
|
|
49
58
|
/** The content of the part. */
|
|
@@ -14,7 +14,7 @@ var nextTitleId = 0;
|
|
|
14
14
|
* A dialog over the page, with a header, a body and a footer. For a task
|
|
15
15
|
* that needs all the screen, use FullscreenModal.
|
|
16
16
|
*/
|
|
17
|
-
var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, freeContent = false, closeButton: showCloseButton = true, width }) {
|
|
17
|
+
var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, freeContent = false, closeButton: showCloseButton = true, width, backdrop }) {
|
|
18
18
|
const { tm } = useTranslation();
|
|
19
19
|
const [titleId] = useState(() => `Modal__header-${++nextTitleId}`);
|
|
20
20
|
const layer = useDialogLayer();
|
|
@@ -28,6 +28,7 @@ var Modal = React.memo(function Modal({ onClose, children, title, ariaLabel, fre
|
|
|
28
28
|
value: contextValue,
|
|
29
29
|
children: /* @__PURE__ */ jsx(ModalLayer, {
|
|
30
30
|
kind: "dialog",
|
|
31
|
+
backdrop,
|
|
31
32
|
style: { zIndex },
|
|
32
33
|
onClick: onClose && !showCloseButton ? (event) => {
|
|
33
34
|
if (event.target === event.currentTarget) handleClose(event);
|
|
@@ -11,7 +11,10 @@ import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui
|
|
|
11
11
|
function floatingMiddleware(offsetOptions) {
|
|
12
12
|
return [
|
|
13
13
|
offset(offsetOptions),
|
|
14
|
-
flip(
|
|
14
|
+
flip({
|
|
15
|
+
crossAxis: "alignment",
|
|
16
|
+
fallbackAxisSideDirection: "end"
|
|
17
|
+
}),
|
|
15
18
|
shift({ padding: 8 }),
|
|
16
19
|
size({
|
|
17
20
|
padding: 8,
|
|
@@ -68,6 +68,7 @@ function useDetailActions(isOpen, onClose, onReopen) {
|
|
|
68
68
|
name: { id: "sidebar.toggleRight" },
|
|
69
69
|
icon: Misc.SidebarFlipIcon,
|
|
70
70
|
shortcut: { key: "]" },
|
|
71
|
+
palette: "searchOnly",
|
|
71
72
|
applicable: () => isOpen || Boolean(onReopen),
|
|
72
73
|
run: () => isOpen ? onClose() : onReopen?.()
|
|
73
74
|
}]);
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import type { PointerEvent } from 'react';
|
|
2
2
|
export declare const NEAR_DISTANCE = 100;
|
|
3
3
|
export declare const NEAR_ATTRIBUTE = "data-near";
|
|
4
|
+
export declare const GAP_ATTRIBUTE = "data-gap";
|
|
5
|
+
export declare const GAP_SELECTOR = "[data-gap]";
|
|
6
|
+
export declare const MARGIN_BOUNDARY_ATTRIBUTE = "data-gap-margin-boundary";
|
|
7
|
+
export declare const MARGIN_OBSTACLE_ATTRIBUTE = "data-gap-margin-obstacle";
|
|
8
|
+
export declare const LABEL_FITS_ATTRIBUTE = "data-label-fits";
|
|
9
|
+
/**
|
|
10
|
+
* The index of the value nearest to `y`, or -1 when there are no values.
|
|
11
|
+
* The first value wins a tie.
|
|
12
|
+
*/
|
|
13
|
+
export declare function nearestIndex(centers: number[], y: number): number;
|
|
14
|
+
type Box = Pick<DOMRect, 'top' | 'right' | 'bottom' | 'left'>;
|
|
15
|
+
/** The two boxes have a common point. An edge that touches counts. */
|
|
16
|
+
export declare function overlaps(a: Box, b: Box): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The gap at the end of an outermost list always shows its "+" (see
|
|
19
|
+
* _InsertGap.css). Thus the script must find that gap, and put it at its
|
|
20
|
+
* position in the margin, also when the pointer is not on the list. This
|
|
21
|
+
* function sets the gaps of the list of `gap` when `gap` shows, and when
|
|
22
|
+
* the list or the window changes its size. It does nothing for a gap of a
|
|
23
|
+
* nested list. It gives the function that stops the watch.
|
|
24
|
+
*/
|
|
25
|
+
export declare function watchEndGap(gap: HTMLElement): (() => void) | undefined;
|
|
4
26
|
export declare function handlePointerMoveList(event: PointerEvent<HTMLElement>): void;
|
|
5
27
|
export declare function handlePointerLeaveList(event: PointerEvent<HTMLElement>): void;
|
|
28
|
+
export {};
|