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,11 +1,16 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { useElementLayout } from "../hooks/useElementLayout.js";
|
|
3
|
+
import React, { useRef } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region ../ui/src/lists/InfoList.tsx
|
|
7
|
+
var WIDE_MIN_WIDTH = 600;
|
|
6
8
|
function BaseInfoList({ className, children }) {
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const { width } = useElementLayout(ref);
|
|
7
11
|
return /* @__PURE__ */ jsx("dl", {
|
|
8
|
-
|
|
12
|
+
ref,
|
|
13
|
+
className: classNames("InfoList", width >= WIDE_MIN_WIDTH && "InfoList--wide", className),
|
|
9
14
|
children
|
|
10
15
|
});
|
|
11
16
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.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
|
|
4
|
+
import Tooltip from "../overlays/Tooltip.js";
|
|
5
5
|
import DropdownContext from "../actions/Dropdown/DropdownContext.js";
|
|
6
6
|
import { Dropdown } from "../actions/Dropdown/index.js";
|
|
7
7
|
import { handlePointerLeaveList, handlePointerMoveList } from "../utils/pointerNearGap.js";
|
|
8
8
|
import React, { useContext } 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/InsertGap.tsx
|
|
12
12
|
/**
|
|
13
13
|
* The props of the element of a list with gaps: give them to the element
|
|
@@ -23,7 +23,7 @@ var Bar = ({ label, onTrigger, open }) => {
|
|
|
23
23
|
const { triggerId, menuId } = useContext(DropdownContext);
|
|
24
24
|
const { tm } = useTranslation();
|
|
25
25
|
const labelText = tm(label);
|
|
26
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
26
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
27
27
|
placement: "left",
|
|
28
28
|
label: labelText,
|
|
29
29
|
children: /* @__PURE__ */ jsx("span", {
|
|
@@ -35,10 +35,20 @@ export type MediaCardOption = MediaCardOptionBase & ({
|
|
|
35
35
|
/** Runs when the user picks the option. */
|
|
36
36
|
onClick: (e: React.MouseEvent) => void;
|
|
37
37
|
submenu?: never;
|
|
38
|
+
action?: never;
|
|
39
|
+
} | {
|
|
40
|
+
/**
|
|
41
|
+
* The id of an action of the registry (`ui/Actions`). The option
|
|
42
|
+
* runs it and shows its keys.
|
|
43
|
+
*/
|
|
44
|
+
action: string;
|
|
45
|
+
onClick?: never;
|
|
46
|
+
submenu?: never;
|
|
38
47
|
} | {
|
|
39
48
|
/** The options of the submenu that the option opens. */
|
|
40
49
|
submenu: React.ReactNode;
|
|
41
50
|
onClick?: never;
|
|
51
|
+
action?: never;
|
|
42
52
|
});
|
|
43
53
|
/** A click on the media opens a page of the app. */
|
|
44
54
|
type LinkCard = {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
3
|
+
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
2
4
|
import Link from "../navigation/Link.js";
|
|
3
5
|
import RawButton from "../semantic/RawButton.js";
|
|
4
6
|
import Button from "../actions/Button.js";
|
|
5
|
-
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
6
|
-
import { Generic } from "../../icons/index.js";
|
|
7
7
|
import { Dropdown } from "../actions/Dropdown/index.js";
|
|
8
8
|
import { forwardRef, useRef, useState } from "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/lists/MediaCard.tsx
|
|
12
12
|
var nextCaptionId = 0;
|
|
13
13
|
var MediaCard = forwardRef(function MediaCard({ isDraggable, isDragging, isCompact, isDisabled, caption, captionDisabled, captionAction, selection, options, actions, to, onClick, children }, ref) {
|
|
@@ -31,7 +31,12 @@ var MediaCard = forwardRef(function MediaCard({ isDraggable, isDragging, isCompa
|
|
|
31
31
|
children: /* @__PURE__ */ jsx(Dropdown.Menu, {
|
|
32
32
|
placement: "bottom-end",
|
|
33
33
|
contextualSearch: false,
|
|
34
|
-
children: options.map((option, index) => option.
|
|
34
|
+
children: options.map((option, index) => option.action !== void 0 ? /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
35
|
+
alert: option.alert,
|
|
36
|
+
disabled: option.disabled,
|
|
37
|
+
action: option.action,
|
|
38
|
+
children: tc(option.label)
|
|
39
|
+
}, index) : option.onClick ? /* @__PURE__ */ jsx(Dropdown.Option, {
|
|
35
40
|
alert: option.alert,
|
|
36
41
|
disabled: option.disabled,
|
|
37
42
|
onPick: (e) => handleOptionClick(option.onClick, e),
|
|
@@ -2,8 +2,8 @@ import Link from "../navigation/Link.js";
|
|
|
2
2
|
import DragHandle from "./dnd/DragHandle.js";
|
|
3
3
|
import "./dnd/index.js";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import classNames from "classnames";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import mergeRefs from "@react-hook/merged-ref";
|
|
8
8
|
//#region ../ui/src/lists/RowList.tsx
|
|
9
9
|
/**
|
|
@@ -24,7 +24,7 @@ var Item = React.forwardRef(function Item({ to, onClick, selected = false, muted
|
|
|
24
24
|
"RowList__item--sortable": sortable,
|
|
25
25
|
"RowList__item--dragging": sortable?.isDragging
|
|
26
26
|
});
|
|
27
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
28
28
|
sortable && /* @__PURE__ */ jsx(DragHandle, {
|
|
29
29
|
ref: sortable.handleRef,
|
|
30
30
|
gutter: "normal",
|
|
@@ -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/SettingsList.tsx
|
|
6
6
|
function BaseSettingsList({ className, children }) {
|
|
7
7
|
return /* @__PURE__ */ jsx("ul", {
|
|
@@ -2,8 +2,8 @@ import { SortableList, useSortableListState } from "../dnd/SortableList.js";
|
|
|
2
2
|
import "../dnd/index.js";
|
|
3
3
|
import { useTableRowsContext } from "./TableContext.js";
|
|
4
4
|
import React, { forwardRef } 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/lists/Table/Body.tsx
|
|
8
8
|
var Content = forwardRef(function Content({ className, style, children }, ref) {
|
|
9
9
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -2,8 +2,8 @@ import { TableRowNameIdContext } from "./TableContext.js";
|
|
|
2
2
|
import { columnCellStyle } from "./layout.js";
|
|
3
3
|
import { TreeToggle, TreeToggleSlot } from "./TreeToggle.js";
|
|
4
4
|
import React, { useContext, useMemo } 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/lists/Table/Cell.tsx
|
|
8
8
|
var FILL_STYLE = { width: "100%" };
|
|
9
9
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useTranslation } from "../../i18n.js";
|
|
2
1
|
import { Generic } from "../../../icons/index.js";
|
|
2
|
+
import { useTranslation } from "../../i18n.js";
|
|
3
3
|
import { Dropdown } from "../../actions/Dropdown/index.js";
|
|
4
4
|
import React, { useMemo } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -3,7 +3,7 @@ import { DisclosureChevronPlaceholder } from "../../navigation/Chevron.js";
|
|
|
3
3
|
import { SortableList } from "../dnd/SortableList.js";
|
|
4
4
|
import "../dnd/index.js";
|
|
5
5
|
import { useTableHeaderContext } from "./TableContext.js";
|
|
6
|
-
import {
|
|
6
|
+
import { columnWidthVariable, moveColumn, pushColumnWidths, resizeColumns, toPercentage, toggleColumn, withHiddenColumns } from "./layout.js";
|
|
7
7
|
import { TreeToggleSlot } from "./TreeToggle.js";
|
|
8
8
|
import ColumnsMenu_default from "./ColumnsMenu.js";
|
|
9
9
|
import HeaderCell_default from "./HeaderCell.js";
|
|
@@ -37,24 +37,22 @@ function Header({ selectAll }) {
|
|
|
37
37
|
const target = startEvent.currentTarget;
|
|
38
38
|
const startX = startEvent.clientX;
|
|
39
39
|
const columnsWidth = columnsElement.getBoundingClientRect().width;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
let amount = 0;
|
|
40
|
+
const startWidths = latest.current.shown.widths;
|
|
41
|
+
const minWidth = 48 / columnsWidth;
|
|
42
|
+
let widths = startWidths;
|
|
44
43
|
startEvent.preventDefault();
|
|
45
44
|
target.setPointerCapture(startEvent.pointerId);
|
|
46
45
|
const handleMove = (event) => {
|
|
47
|
-
|
|
48
|
-
table.style.setProperty(columnWidthVariable(
|
|
49
|
-
table.style.setProperty(columnWidthVariable(index + 1), toPercentage(rightWidth + amount));
|
|
46
|
+
widths = pushColumnWidths(startWidths, index, (event.clientX - startX) / columnsWidth, minWidth);
|
|
47
|
+
for (let i = index; i < widths.length; i += 1) table.style.setProperty(columnWidthVariable(i), toPercentage(widths[i]));
|
|
50
48
|
};
|
|
51
49
|
const handleEnd = () => {
|
|
52
50
|
target.removeEventListener("pointermove", handleMove);
|
|
53
51
|
target.removeEventListener("pointerup", handleEnd);
|
|
54
52
|
target.removeEventListener("pointercancel", handleEnd);
|
|
55
|
-
if (
|
|
53
|
+
if (widths !== startWidths) {
|
|
56
54
|
const current = latest.current;
|
|
57
|
-
current.onLayoutChange(withHiddenColumns(current.resolved, current.shown,
|
|
55
|
+
current.onLayoutChange(withHiddenColumns(current.resolved, current.shown, resizeColumns(current.shown, widths)));
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
58
|
target.addEventListener("pointermove", handleMove);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useTranslation } from "../../i18n.js";
|
|
2
1
|
import { Navigation } from "../../../icons/index.js";
|
|
2
|
+
import { useTranslation } from "../../i18n.js";
|
|
3
3
|
import DragHandle from "../dnd/DragHandle.js";
|
|
4
4
|
import { SortableItem } from "../dnd/SortableList.js";
|
|
5
5
|
import "../dnd/index.js";
|
|
6
6
|
import { columnCellStyle } from "./layout.js";
|
|
7
7
|
import React from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import classNames from "classnames";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region ../ui/src/lists/Table/HeaderCell.tsx
|
|
11
11
|
function nextDirection(direction) {
|
|
12
12
|
if (direction === null) return "asc";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type Action } from '../../actions/Actions/index.js';
|
|
2
3
|
import { type DisabledWithReason } from '../../actions/disabledReason.js';
|
|
3
4
|
import type { RefCallback } from '../dnd/types.js';
|
|
4
5
|
import { type TableFirstCell } from './Cell.js';
|
|
@@ -97,6 +98,11 @@ type RowBaseProps<R> = {
|
|
|
97
98
|
wrapperProps?: React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
98
99
|
/** The element of the row, without the handle */
|
|
99
100
|
rowRef?: Ref<HTMLDivElement>;
|
|
101
|
+
/**
|
|
102
|
+
* The actions of the row (see `ui/Actions`): their keys work while the
|
|
103
|
+
* pointer or the focus is in the row, and a menu in the row runs them.
|
|
104
|
+
*/
|
|
105
|
+
actions?: readonly Action[];
|
|
100
106
|
rowClassName?: string;
|
|
101
107
|
/**
|
|
102
108
|
* In a tree: the indentation of the row and the toggle of its child rows.
|
|
@@ -119,7 +125,7 @@ export type RowProps<R = any> = RowBaseProps<R> & RowAction;
|
|
|
119
125
|
* A row of the table. The cells come from the `renderCell` of the visible
|
|
120
126
|
* columns, or from the children (Table.Cell).
|
|
121
127
|
*/
|
|
122
|
-
declare function Row<R>({ row, to: path, keepSearch, selection, onOpen, active, openWithArrows, drag, dragging, fetching, wrapperProps, rowRef, rowClassName, firstCell, muted, trailing, children, }: RowProps<R>): React.JSX.Element;
|
|
128
|
+
declare function Row<R>({ row, to: path, keepSearch, selection, onOpen, active, openWithArrows, drag, dragging, fetching, wrapperProps, rowRef, actions, rowClassName, firstCell, muted, trailing, children, }: RowProps<R>): React.JSX.Element;
|
|
123
129
|
export declare const MemoRow: typeof Row;
|
|
124
130
|
export type SortableRowProps<R = any> = Omit<RowBaseProps<R>, 'drag'> & RowAction & {
|
|
125
131
|
/** The identifier of the row in the Table.Body with `reorder` */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useRegisterActions } from "../../actions/Actions/registry.js";
|
|
2
|
+
import "../../actions/Actions/index.js";
|
|
1
3
|
import { useNavigation } from "../../navigation/NavigationProvider.js";
|
|
2
4
|
import Link from "../../navigation/Link.js";
|
|
3
5
|
import { DisabledReasonTooltip } from "../../actions/disabledReason.js";
|
|
@@ -9,10 +11,11 @@ import { TableRowNameIdContext, useTableRowsContext } from "./TableContext.js";
|
|
|
9
11
|
import Cell_default from "./Cell.js";
|
|
10
12
|
import ProgressBar_default from "../../feedback/ProgressBar.js";
|
|
11
13
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import classNames from "classnames";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
16
|
import mergeRefs from "@react-hook/merged-ref";
|
|
15
17
|
//#region ../ui/src/lists/Table/Row.tsx
|
|
18
|
+
var NO_ACTIONS = [];
|
|
16
19
|
function Handle({ handle }) {
|
|
17
20
|
if (!handle) return null;
|
|
18
21
|
if ("ref" in handle) return /* @__PURE__ */ jsx(DragHandle, {
|
|
@@ -64,7 +67,7 @@ function stopPropagation(event) {
|
|
|
64
67
|
* A row of the table. The cells come from the `renderCell` of the visible
|
|
65
68
|
* columns, or from the children (Table.Cell).
|
|
66
69
|
*/
|
|
67
|
-
function Row({ row, to: path, keepSearch = false, selection, onOpen, active = false, openWithArrows = false, drag, dragging, fetching, wrapperProps, rowRef, rowClassName, firstCell, muted = false, trailing, children }) {
|
|
70
|
+
function Row({ row, to: path, keepSearch = false, selection, onOpen, active = false, openWithArrows = false, drag, dragging, fetching, wrapperProps, rowRef, actions = NO_ACTIONS, rowClassName, firstCell, muted = false, trailing, children }) {
|
|
68
71
|
const { columnsByName, columnNames, selectable, trailingWidth, tree, truncate } = useTableRowsContext("Table.Row");
|
|
69
72
|
const nameId = `table-row-name-${useAutoincrementIntegerId()}`;
|
|
70
73
|
const { location } = useNavigation();
|
|
@@ -74,6 +77,7 @@ function Row({ row, to: path, keepSearch = false, selection, onOpen, active = fa
|
|
|
74
77
|
const selected = selection?.selected ?? false;
|
|
75
78
|
const ownRowRef = useRef(null);
|
|
76
79
|
const mergedRowRef = mergeRefs(ownRowRef, rowRef ?? null);
|
|
80
|
+
useRegisterActions(ownRowRef, actions);
|
|
77
81
|
useEffect(() => {
|
|
78
82
|
if (active) ownRowRef.current?.scrollIntoView({
|
|
79
83
|
block: "nearest",
|
|
@@ -2,8 +2,8 @@ import { useIsSmallViewport } from "../../hooks/useMediaQuery.js";
|
|
|
2
2
|
import { TableHeaderContext, TableRowsContext } from "./TableContext.js";
|
|
3
3
|
import { columnWidthsStyle, fitTableLayout, resolveTableLayout } from "./layout.js";
|
|
4
4
|
import React, { useEffect, useMemo, useRef, useState } 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/lists/Table/Table.tsx
|
|
8
8
|
/**
|
|
9
9
|
* A table with columns that the user shows, hides, moves, resizes and
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Generic } from "../../../icons/index.js";
|
|
1
2
|
import Spinner_default from "../../feedback/Spinner.js";
|
|
2
3
|
import RawButton from "../../semantic/RawButton.js";
|
|
3
4
|
import { DisabledReasonTooltip, disabledReasonOf } from "../../actions/disabledReason.js";
|
|
4
|
-
import { Generic } from "../../../icons/index.js";
|
|
5
5
|
import { DisclosureChevron, DisclosureChevronPlaceholder } from "../../navigation/Chevron.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const Table: (<R>({ columns, layout, onLayoutChange, sort: sortState, checkboxes, reorderable, trailingWidth, tree, truncate, className, children, }: import("./Table.js").TableProps<R>) => import("react").JSX.Element) & {
|
|
2
2
|
Header: import("react").MemoExoticComponent<({ selectAll }: import("./Header.js").TableHeaderProps) => import("react").JSX.Element>;
|
|
3
3
|
Body: import("react").NamedExoticComponent<import("./Body.js").TableBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
-
Row: <R>({ row, to: path, keepSearch, selection, onOpen, active, openWithArrows, drag, dragging, fetching, wrapperProps, rowRef, rowClassName, firstCell, muted, trailing, children, }: import("./Row.js").RowProps<R>) => import("react").JSX.Element;
|
|
4
|
+
Row: <R>({ row, to: path, keepSearch, selection, onOpen, active, openWithArrows, drag, dragging, fetching, wrapperProps, rowRef, actions, rowClassName, firstCell, muted, trailing, children, }: import("./Row.js").RowProps<R>) => import("react").JSX.Element;
|
|
5
5
|
SortableRow: <R>({ id, index, dragging, ...rest }: import("./Row.js").SortableRowProps<R>) => import("react").JSX.Element;
|
|
6
6
|
Cell: import("react").MemoExoticComponent<({ index, fill, firstCell, truncate, children, }: import("./Cell.js").TableCellProps) => import("react").JSX.Element>;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
2
|
import type { SortableDropResult } from '../dnd/index.js';
|
|
3
3
|
import type { TableColumn, TableLayout } from './types.js';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const MIN_RESIZE_COLUMN_PIXELS = 48;
|
|
5
5
|
export type ResolvedTableLayout = {
|
|
6
6
|
columnNames: string[];
|
|
7
7
|
widths: number[];
|
|
@@ -11,7 +11,8 @@ export declare function fitTableLayout(resolved: ResolvedTableLayout, columnsByN
|
|
|
11
11
|
export declare function withHiddenColumns(resolved: ResolvedTableLayout, shown: ResolvedTableLayout, layout: TableLayout): TableLayout;
|
|
12
12
|
export declare function toggleColumn(resolved: ResolvedTableLayout, columnName: string): TableLayout;
|
|
13
13
|
export declare function moveColumn(resolved: ResolvedTableLayout, dropResult: SortableDropResult): TableLayout;
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function pushColumnWidths(widths: number[], index: number, delta: number, minWidth: number): number[];
|
|
15
|
+
export declare function resizeColumns(resolved: ResolvedTableLayout, widths: number[]): TableLayout;
|
|
15
16
|
export declare function columnWidthVariable(index: number): string;
|
|
16
17
|
export declare function toPercentage(width: number): string;
|
|
17
18
|
export declare function columnWidthsStyle(widths: number[]): CSSProperties;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { reorder } from "../dnd/reorder.js";
|
|
2
2
|
//#region ../ui/src/lists/Table/layout.ts
|
|
3
|
-
var MIN_COLUMN_WIDTH = .05;
|
|
4
3
|
var NEW_COLUMN_WIDTH = .15;
|
|
5
4
|
function resolveTableLayout(columns, layout) {
|
|
6
5
|
const existing = layout.columns.filter(({ name }) => columns.some((column) => column.name === name));
|
|
@@ -71,17 +70,31 @@ function toggleColumn(resolved, columnName) {
|
|
|
71
70
|
function moveColumn(resolved, dropResult) {
|
|
72
71
|
return { columns: reorder(toLayoutColumns(resolved), dropResult) };
|
|
73
72
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
width
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
function pushColumnWidths(widths, index, delta, minWidth) {
|
|
74
|
+
const after = widths.slice(index + 1);
|
|
75
|
+
if (delta > 0) {
|
|
76
|
+
const slack = after.reduce((sum, width) => sum + Math.max(0, width - minWidth), 0);
|
|
77
|
+
const applied = Math.min(delta, slack);
|
|
78
|
+
if (applied <= 0) return widths;
|
|
79
|
+
return widths.map((width, columnIndex) => {
|
|
80
|
+
if (columnIndex === index) return width + applied;
|
|
81
|
+
if (columnIndex > index) return width - Math.max(0, width - minWidth) * applied / slack;
|
|
82
|
+
return width;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const applied = Math.min(-delta, Math.max(0, widths[index] - minWidth));
|
|
86
|
+
const afterSum = after.reduce((sum, width) => sum + width, 0);
|
|
87
|
+
if (applied <= 0 || afterSum <= 0) return widths;
|
|
88
|
+
return widths.map((width, columnIndex) => {
|
|
89
|
+
if (columnIndex === index) return width - applied;
|
|
90
|
+
if (columnIndex > index) return width + width * applied / afterSum;
|
|
91
|
+
return width;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function resizeColumns(resolved, widths) {
|
|
95
|
+
return { columns: toLayoutColumns({
|
|
96
|
+
...resolved,
|
|
97
|
+
widths
|
|
85
98
|
}) };
|
|
86
99
|
}
|
|
87
100
|
function columnWidthVariable(index) {
|
|
@@ -99,4 +112,4 @@ function columnCellStyle(index) {
|
|
|
99
112
|
return cellStyles[index];
|
|
100
113
|
}
|
|
101
114
|
//#endregion
|
|
102
|
-
export {
|
|
115
|
+
export { columnCellStyle, columnWidthVariable, columnWidthsStyle, fitTableLayout, moveColumn, pushColumnWidths, resizeColumns, resolveTableLayout, toPercentage, toggleColumn, withHiddenColumns };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Generic } from "../../../icons/index.js";
|
|
2
2
|
import { forwardRef } 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/lists/dnd/DragHandle.tsx
|
|
6
6
|
/**
|
|
7
7
|
* The grip that the user drags to move an item. Give it the `handleRef` of
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } 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/lists/dnd/DropIndicator.tsx
|
|
5
5
|
function DropIndicator({ edge, gap = "0px", inset = "0px" }) {
|
|
6
6
|
const style = useMemo(() => ({
|
|
@@ -5,7 +5,7 @@ import { useDraggable } from "./useDraggable.js";
|
|
|
5
5
|
import { useDragMonitor } from "./useDragMonitor.js";
|
|
6
6
|
import { useDropTarget } from "./useDropTarget.js";
|
|
7
7
|
import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
8
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
9
9
|
import { attachClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/attach-closest-edge";
|
|
10
10
|
import { extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/extract-closest-edge";
|
|
11
11
|
import { getReorderDestinationIndex } from "@atlaskit/pragmatic-drag-and-drop-hitbox/util/get-reorder-destination-index";
|
|
@@ -226,7 +226,7 @@ function SortableItem({ id, index, disabled = false, handle = false, preview, ch
|
|
|
226
226
|
edge: target.edge,
|
|
227
227
|
gap: `${target.gap}px`
|
|
228
228
|
}) : null;
|
|
229
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children({
|
|
229
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: children({
|
|
230
230
|
ref,
|
|
231
231
|
handleRef,
|
|
232
232
|
isDragging,
|
|
@@ -8,8 +8,8 @@ import { TreeRowProvider } from "./TreeRowContext.js";
|
|
|
8
8
|
import { flattenTree, getItem, getParent, getSourcePosition, hasChildren } from "./utils.js";
|
|
9
9
|
import { useTreeKeyboardNavigation } from "./useTreeKeyboardNavigation.js";
|
|
10
10
|
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import classNames from "classnames";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
14
14
|
//#region ../ui/src/lists/dnd/tree/SortableTree.tsx
|
|
15
15
|
var instanceCounter = 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Spinner_default from "../feedback/Spinner.js";
|
|
2
1
|
import { Navigation } from "../../icons/index.js";
|
|
2
|
+
import Spinner_default from "../feedback/Spinner.js";
|
|
3
3
|
import React from "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/navigation/Chevron.tsx
|
|
7
7
|
/**
|
|
8
8
|
* For a toggle that opens content in place. Put it before the title. It
|
|
@@ -9,6 +9,27 @@ export type SegmentedControlOption<T extends string> = {
|
|
|
9
9
|
/** An icon before the label */
|
|
10
10
|
icon?: React.ReactNode;
|
|
11
11
|
};
|
|
12
|
+
/** An option that shows only its icon */
|
|
13
|
+
export type SegmentedControlIconOption<T extends string> = {
|
|
14
|
+
/** The value that `onChange` gets, for example "dark" */
|
|
15
|
+
value: T;
|
|
16
|
+
/** The tooltip and the accessible name of the option, for example "Dark" */
|
|
17
|
+
label: TextMessage;
|
|
18
|
+
/** The icon of the option */
|
|
19
|
+
icon: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
/** The look of the options: a text, or only an icon with a tooltip */
|
|
22
|
+
export type SegmentedControlOptions<T extends string> =
|
|
23
|
+
/** Each option shows its label, with an optional icon before it */
|
|
24
|
+
{
|
|
25
|
+
options: readonly SegmentedControlOption<T>[];
|
|
26
|
+
iconOnly?: false;
|
|
27
|
+
}
|
|
28
|
+
/** Each option shows only its icon. The label goes in a tooltip. */
|
|
29
|
+
| {
|
|
30
|
+
options: readonly SegmentedControlIconOption<T>[];
|
|
31
|
+
iconOnly: true;
|
|
32
|
+
};
|
|
12
33
|
/** The accessible name of the group: a text, or the id of a visible label */
|
|
13
34
|
export type SegmentedControlName =
|
|
14
35
|
/** A text, for example "Layout", when no visible label names the group */
|
|
@@ -21,9 +42,7 @@ export type SegmentedControlName =
|
|
|
21
42
|
ariaLabelledBy: string;
|
|
22
43
|
ariaLabel?: never;
|
|
23
44
|
};
|
|
24
|
-
export type SegmentedControlProps<T extends string> = SegmentedControlName & {
|
|
25
|
-
/** The options. Give 2 to 4 short options. */
|
|
26
|
-
options: readonly SegmentedControlOption<T>[];
|
|
45
|
+
export type SegmentedControlProps<T extends string> = SegmentedControlName & SegmentedControlOptions<T> & {
|
|
27
46
|
/** The `value` of the selected option */
|
|
28
47
|
value: T;
|
|
29
48
|
/** Runs when the user picks another option */
|
|
@@ -46,6 +65,6 @@ export type SegmentedControlProps<T extends string> = SegmentedControlName & {
|
|
|
46
65
|
* once, with no confirm. The group is one tab stop: the arrow keys, Home and
|
|
47
66
|
* End move the focus and select the option, as in a native radio group.
|
|
48
67
|
*/
|
|
49
|
-
declare function SegmentedControl<T extends string>({ options, value, onChange, ariaLabel, ariaLabelledBy, size, fill, disabled, className, }: SegmentedControlProps<T>): React.JSX.Element;
|
|
68
|
+
declare function SegmentedControl<T extends string>({ options, iconOnly, value, onChange, ariaLabel, ariaLabelledBy, size, fill, disabled, className, }: SegmentedControlProps<T>): React.JSX.Element;
|
|
50
69
|
declare const _default: typeof SegmentedControl;
|
|
51
70
|
export default _default;
|
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
import { useTranslation } from "../i18n.js";
|
|
2
2
|
import RawButton from "../semantic/RawButton.js";
|
|
3
3
|
import { useButtonSize } from "../actions/Button.js";
|
|
4
|
+
import Tooltip from "../overlays/Tooltip.js";
|
|
4
5
|
import { useRovingKeyDown } from "../hooks/useRovingKeyDown.js";
|
|
5
6
|
import React from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import classNames from "classnames";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region ../ui/src/navigation/SegmentedControl.tsx
|
|
9
10
|
/**
|
|
10
11
|
* A choice of one value from a few options, always visible. It applies at
|
|
11
12
|
* once, with no confirm. The group is one tab stop: the arrow keys, Home and
|
|
12
13
|
* End move the focus and select the option, as in a native radio group.
|
|
13
14
|
*/
|
|
14
|
-
function SegmentedControl({ options, value, onChange, ariaLabel, ariaLabelledBy, size, fill, disabled, className }) {
|
|
15
|
+
function SegmentedControl({ options, iconOnly, value, onChange, ariaLabel, ariaLabelledBy, size, fill, disabled, className }) {
|
|
15
16
|
const { tm, tc } = useTranslation();
|
|
16
17
|
const placeSize = useButtonSize();
|
|
17
18
|
const handleKeyDown = useRovingKeyDown("[role=\"radio\"]", true);
|
|
18
19
|
const hasSelection = options.some((option) => option.value === value);
|
|
19
20
|
return /* @__PURE__ */ jsx("div", {
|
|
20
|
-
className: classNames("SegmentedControl", `SegmentedControl--${size ?? placeSize}`, {
|
|
21
|
+
className: classNames("SegmentedControl", `SegmentedControl--${size ?? placeSize}`, {
|
|
22
|
+
"SegmentedControl--fill": fill,
|
|
23
|
+
"SegmentedControl--icon-only": iconOnly
|
|
24
|
+
}, className),
|
|
21
25
|
role: "radiogroup",
|
|
22
26
|
"aria-label": ariaLabel ? tm(ariaLabel) : void 0,
|
|
23
27
|
"aria-labelledby": ariaLabelledBy,
|
|
24
28
|
onKeyDown: handleKeyDown,
|
|
25
29
|
children: options.map((option, index) => {
|
|
26
30
|
const isSelected = option.value === value;
|
|
27
|
-
|
|
31
|
+
const buttonProps = {
|
|
28
32
|
radio: { checked: isSelected },
|
|
29
33
|
tabIndex: isSelected || !hasSelection && index === 0 ? 0 : -1,
|
|
30
34
|
className: classNames("SegmentedControl__button", { "is-selected": isSelected }),
|
|
31
35
|
disabled,
|
|
32
|
-
onClick: () => !isSelected && onChange(option.value)
|
|
36
|
+
onClick: () => !isSelected && onChange(option.value)
|
|
37
|
+
};
|
|
38
|
+
if (iconOnly) {
|
|
39
|
+
const labelText = tm(option.label);
|
|
40
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
41
|
+
label: labelText,
|
|
42
|
+
children: /* @__PURE__ */ jsx(RawButton, {
|
|
43
|
+
...buttonProps,
|
|
44
|
+
ariaLabel: labelText,
|
|
45
|
+
children: option.icon
|
|
46
|
+
})
|
|
47
|
+
}, option.value);
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsxs(RawButton, {
|
|
50
|
+
...buttonProps,
|
|
33
51
|
children: [option.icon, tc(option.label)]
|
|
34
52
|
}, option.value);
|
|
35
53
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Generic } from "../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../i18n.js";
|
|
2
3
|
import Link from "./Link.js";
|
|
3
|
-
import { Generic } from "../../icons/index.js";
|
|
4
4
|
import Nav from "../semantic/Nav.js";
|
|
5
5
|
import { SidebarTree } from "./SidebarTree/index.js";
|
|
6
6
|
import FeedbackDot_default from "../content/FeedbackDot.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region ../ui/src/navigation/SettingsMenu.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The menu of the sections of a settings area. It fills its Pane and
|
|
@@ -68,7 +68,7 @@ function Item(props) {
|
|
|
68
68
|
*/
|
|
69
69
|
function Notice(props) {
|
|
70
70
|
const { icon, children } = props;
|
|
71
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [icon, /* @__PURE__ */ jsx("span", { children })] });
|
|
71
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [icon, /* @__PURE__ */ jsx("span", { children })] });
|
|
72
72
|
if (props.to !== void 0) return /* @__PURE__ */ jsx(Link, {
|
|
73
73
|
className: "SettingsMenu__notice",
|
|
74
74
|
to: props.to,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { Generic } from "../../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../../i18n.js";
|
|
2
3
|
import { isActivePath, useNavigation } from "../NavigationProvider.js";
|
|
3
4
|
import Link from "../Link.js";
|
|
4
5
|
import RawButton from "../../semantic/RawButton.js";
|
|
5
|
-
import { Generic } from "../../../icons/index.js";
|
|
6
6
|
import { DisclosureChevron } from "../Chevron.js";
|
|
7
7
|
import { dropTargetClassName } from "../../lists/dnd/dropTargetClassName.js";
|
|
8
8
|
import { useTreeRow } from "../../lists/dnd/tree/TreeRowContext.js";
|
|
9
9
|
import "../../lists/dnd/index.js";
|
|
10
10
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
11
|
import classNames from "classnames";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import mergeRefs from "@react-hook/merged-ref";
|
|
14
14
|
//#region ../ui/src/navigation/SidebarTree/SidebarTreeNode.tsx
|
|
15
15
|
var SIDEBAR_TREE_OFFSET_PER_LEVEL = 28;
|
|
@@ -69,7 +69,7 @@ function SidebarTreeNode({ label, afterTitle, details, trailing, icon, to, exact
|
|
|
69
69
|
const editable = tree && treeRow ? getEditableTreeNodeProps(treeRow.provided, treeRow.snapshot, tree.editMode) : void 0;
|
|
70
70
|
const linkDraggable = tree?.editMode ? false : void 0;
|
|
71
71
|
const treeItem = tree && treeRow?.provided.treeItemProps;
|
|
72
|
-
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
72
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
73
73
|
icon && /* @__PURE__ */ jsx("span", {
|
|
74
74
|
"aria-hidden": "true",
|
|
75
75
|
className: "SidebarTree__node__icon",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Generic } from "../../../icons/index.js";
|
|
1
2
|
import { useTranslation } from "../../i18n.js";
|
|
2
3
|
import { useNavigation } from "../NavigationProvider.js";
|
|
3
|
-
import { Generic } from "../../../icons/index.js";
|
|
4
4
|
import { Dropdown } from "../../actions/Dropdown/index.js";
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -7,8 +7,8 @@ import { useRovingKeyDown } from "../hooks/useRovingKeyDown.js";
|
|
|
7
7
|
import Root from "../layout/Toolbar/Root.js";
|
|
8
8
|
import Nav from "../semantic/Nav.js";
|
|
9
9
|
import React, { useCallback } 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
|
//#region ../ui/src/navigation/Tabs.tsx
|
|
13
13
|
/**
|
|
14
14
|
* Gives the DOM ids that link the tabs to their panel. Give `tabId(key)` to
|