datocms-react-ui 3.1.0-next.4 → 3.1.0-next.5
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/styles.css +351 -162
- package/dist/ui-public/icons/custom/dato_symbol.js +22 -0
- package/dist/ui-public/icons/index.js +1 -1
- package/dist/ui-public/src/actions/Button.d.ts +4 -1
- package/dist/ui-public/src/actions/Button.js +1 -1
- package/dist/ui-public/src/actions/Dropdown/Menu.js +2 -1
- package/dist/ui-public/src/actions/Dropdown/MenuContent.d.ts +2 -1
- package/dist/ui-public/src/actions/Dropdown/MenuContent.js +13 -3
- package/dist/ui-public/src/actions/Dropdown/Submenu.js +5 -2
- package/dist/ui-public/src/form/SwitchInput.js +4 -2
- package/dist/ui-public/src/layout/Pagination.d.ts +6 -1
- package/dist/ui-public/src/layout/Pagination.js +4 -2
- package/dist/ui-public/src/layout/Toolbar/Pagination.d.ts +4 -1
- package/dist/ui-public/src/layout/Toolbar/Pagination.js +30 -26
- package/dist/ui-public/src/lists/CardList.js +4 -1
- package/dist/ui-public/src/lists/SettingsList.d.ts +4 -3
- package/dist/ui-public/src/navigation/SegmentedControl.js +4 -1
- package/dist/ui-public/src/navigation/Tabs.js +23 -1
- package/package.json +1 -1
- package/dist/ui-public/icons/custom/color_d_icon.js +0 -20
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region ../ui-public/icons/custom/dato_symbol.svg?react
|
|
4
|
+
var SvgDatoSymbol = (props, ref) => /* @__PURE__ */ jsx("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
viewBox: "0 0 19.8929 20.0209",
|
|
7
|
+
fill: "none",
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
ref,
|
|
12
|
+
...props,
|
|
13
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
14
|
+
fillRule: "evenodd",
|
|
15
|
+
clipRule: "evenodd",
|
|
16
|
+
d: "M9.94643 0C14.922 0 19.8929 4.4849 19.8929 10.0119C19.8928 15.5389 14.9211 20.0209 9.94643 20.0209H0V0H9.94643ZM11.9906 5.08295C11.016 4.67891 9.94353 4.57293 8.90873 4.77843C7.87392 4.98394 6.92335 5.49169 6.17711 6.23748C5.43089 6.98325 4.92249 7.93345 4.71636 8.96812C4.51023 10.0028 4.61549 11.0754 5.01892 12.0502C5.42237 13.025 6.10585 13.8584 6.98289 14.4448C7.85992 15.0312 8.89119 15.3444 9.94619 15.3447C10.6467 15.3451 11.3405 15.2074 11.9879 14.9397C12.6352 14.6719 13.2237 14.2792 13.7192 13.7839C14.2147 13.2887 14.6078 12.7008 14.8759 12.0536C15.1441 11.4064 15.2819 10.7127 15.2818 10.0122C15.2822 8.95716 14.9698 7.92554 14.3839 7.04814C13.7981 6.17077 12.9651 5.48698 11.9906 5.08295Z",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
var ForwardRef = forwardRef(SvgDatoSymbol);
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ForwardRef as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./brands/gitlab.js";
|
|
2
2
|
import "./brands/markdown.js";
|
|
3
|
-
import ForwardRef from "./custom/
|
|
3
|
+
import ForwardRef from "./custom/dato_symbol.js";
|
|
4
4
|
import "./custom/fieldgroup-boolean.js";
|
|
5
5
|
import "./custom/fieldgroup-color.js";
|
|
6
6
|
import "./custom/fieldgroup-datetime.js";
|
|
@@ -91,7 +91,10 @@ type ButtonElementState = {
|
|
|
91
91
|
* "onClick" that returns a promise sets it automatically.
|
|
92
92
|
*/
|
|
93
93
|
busy?: boolean;
|
|
94
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* The state of a toggle button (for example the filter toggle). Only the
|
|
96
|
+
* soft and the ghost tones show it: a toggle is never the main action.
|
|
97
|
+
*/
|
|
95
98
|
pressed?: boolean;
|
|
96
99
|
};
|
|
97
100
|
/** A link has no busy or pressed state */
|
|
@@ -25,7 +25,7 @@ function isTooltipOptions(tooltip) {
|
|
|
25
25
|
return typeof tooltip === "object" && tooltip !== null && !isIntlMessage(tooltip) && !isHtmlMessage(tooltip) && !React.isValidElement(tooltip);
|
|
26
26
|
}
|
|
27
27
|
var toneClassName = {
|
|
28
|
-
soft: "button",
|
|
28
|
+
soft: "button button--soft",
|
|
29
29
|
ghost: "button button--ghost",
|
|
30
30
|
primary: "button button--primary",
|
|
31
31
|
alert: "button button--alert",
|
|
@@ -46,7 +46,7 @@ var Menu = React.forwardRef(({ children, placement = "bottom-start", noOverflowH
|
|
|
46
46
|
const detectedLocale = useTriggerLang();
|
|
47
47
|
const isMobile = useIsMenuSheet();
|
|
48
48
|
const Wrapper = isMobile ? MenuMobileContainer : MenuDesktopContainer;
|
|
49
|
-
const { refs, floatingStyles, placement: finalPlacement } = useFloating({
|
|
49
|
+
const { refs, floatingStyles, placement: finalPlacement, isPositioned } = useFloating({
|
|
50
50
|
placement,
|
|
51
51
|
whileElementsMounted: autoUpdate,
|
|
52
52
|
middleware: [
|
|
@@ -86,6 +86,7 @@ var Menu = React.forwardRef(({ children, placement = "bottom-start", noOverflowH
|
|
|
86
86
|
},
|
|
87
87
|
children: [/* @__PURE__ */ jsx(MenuContent, {
|
|
88
88
|
isRoot: true,
|
|
89
|
+
isPositioned: isMobile || isPositioned,
|
|
89
90
|
title: isMobile ? { id: "dropdown.selectOption" } : void 0,
|
|
90
91
|
noOverflowHidden,
|
|
91
92
|
contextualSearch,
|
|
@@ -16,6 +16,7 @@ type Props = {
|
|
|
16
16
|
optionPaddingY?: number;
|
|
17
17
|
isRoot?: boolean;
|
|
18
18
|
title?: Message;
|
|
19
|
+
isPositioned: boolean;
|
|
19
20
|
};
|
|
20
|
-
export default function MenuContent({ children, noOverflowHidden, contextualSearch, minWidth, optionPaddingY, isRoot, title, }: Props): React.JSX.Element;
|
|
21
|
+
export default function MenuContent({ children, noOverflowHidden, contextualSearch, minWidth, optionPaddingY, isRoot, title, isPositioned, }: Props): React.JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -16,7 +16,7 @@ function highlightOption(menu, option) {
|
|
|
16
16
|
block: "nearest"
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function MenuContent({ children, noOverflowHidden, contextualSearch = "auto", minWidth, optionPaddingY, isRoot = false, title }) {
|
|
19
|
+
function MenuContent({ children, noOverflowHidden, contextualSearch = "auto", minWidth, optionPaddingY, isRoot = false, title, isPositioned }) {
|
|
20
20
|
const { t, tm, tc } = useTranslation();
|
|
21
21
|
const { closeMenu, triggerId, menuId } = useContext(DropdownContext);
|
|
22
22
|
const [searchTerm, setSearchTerm] = useState("");
|
|
@@ -55,14 +55,24 @@ function MenuContent({ children, noOverflowHidden, contextualSearch = "auto", mi
|
|
|
55
55
|
openedByKeyRef.current = Boolean(triggerId && document.getElementById(triggerId)?.matches(":focus-visible"));
|
|
56
56
|
}, [triggerId]);
|
|
57
57
|
useEffect(() => {
|
|
58
|
+
if (!isPositioned) return;
|
|
58
59
|
const focusTarget = showSearch ? searchInputRef.current : menuRef.current;
|
|
59
60
|
const first = menuRef.current?.querySelector(".Dropdown__menu__option:not(.is-disabled)");
|
|
60
61
|
if (isRoot && openedByKeyRef.current && first && focusTarget) highlightOption(focusTarget, first);
|
|
61
|
-
}, [
|
|
62
|
+
}, [
|
|
63
|
+
isRoot,
|
|
64
|
+
showSearch,
|
|
65
|
+
isPositioned
|
|
66
|
+
]);
|
|
62
67
|
useEffect(() => {
|
|
68
|
+
if (!isPositioned) return;
|
|
63
69
|
if (showSearch) searchInputRef.current?.focus();
|
|
64
70
|
else if (isRoot) menuRef.current?.focus();
|
|
65
|
-
}, [
|
|
71
|
+
}, [
|
|
72
|
+
showSearch,
|
|
73
|
+
isRoot,
|
|
74
|
+
isPositioned
|
|
75
|
+
]);
|
|
66
76
|
const handleKeyDown = useCallback((event) => {
|
|
67
77
|
if (isHotkey("escape", event.nativeEvent) || isHotkey("tab", event.nativeEvent)) {
|
|
68
78
|
event.preventDefault();
|
|
@@ -20,7 +20,7 @@ function Submenu({ children, triggerContent, triggerIcon, disabled = false }) {
|
|
|
20
20
|
const [isOpenOnMobile, setIsOpenOnMobile] = useState(false);
|
|
21
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
22
22
|
const { isClosing } = useContext(DropdownContext);
|
|
23
|
-
const { refs, floatingStyles, context, placement: finalPlacement } = useFloating({
|
|
23
|
+
const { refs, floatingStyles, context, placement: finalPlacement, isPositioned } = useFloating({
|
|
24
24
|
open: isOpen,
|
|
25
25
|
onOpenChange: setIsOpen,
|
|
26
26
|
placement: "right-start",
|
|
@@ -75,7 +75,10 @@ function Submenu({ children, triggerContent, triggerIcon, disabled = false }) {
|
|
|
75
75
|
},
|
|
76
76
|
...placementAttributes,
|
|
77
77
|
...getFloatingProps(),
|
|
78
|
-
children: /* @__PURE__ */ jsx(MenuContent, {
|
|
78
|
+
children: /* @__PURE__ */ jsx(MenuContent, {
|
|
79
|
+
isPositioned,
|
|
80
|
+
children
|
|
81
|
+
})
|
|
79
82
|
}) }) }),
|
|
80
83
|
isMobile && isOpenOnMobile && !disabled && /* @__PURE__ */ jsx(Menu, {
|
|
81
84
|
placement: "right-start",
|
|
@@ -49,8 +49,10 @@ var SwitchInput = React.memo(function SwitchInput(props) {
|
|
|
49
49
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
50
50
|
className: classNames("SwitchInput", inList && "SwitchInput--row"),
|
|
51
51
|
children: [
|
|
52
|
-
inList &&
|
|
53
|
-
|
|
52
|
+
inList && /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "SwitchInput__text",
|
|
54
|
+
children: [labelElement, reasonElement]
|
|
55
|
+
}),
|
|
54
56
|
/* @__PURE__ */ jsx("input", {
|
|
55
57
|
type: "checkbox",
|
|
56
58
|
id: checkboxId,
|
|
@@ -12,6 +12,11 @@ export type PaginationProps = {
|
|
|
12
12
|
* @default 7
|
|
13
13
|
*/
|
|
14
14
|
maxPagesToBeShown?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The most page numbers that show in a narrow toolbar (see
|
|
17
|
+
* Toolbar.Pagination). The other page numbers show only in a wide toolbar.
|
|
18
|
+
*/
|
|
19
|
+
maxNarrowPagesToBeShown?: number;
|
|
15
20
|
/** The number of items in all the pages */
|
|
16
21
|
totalEntries: number;
|
|
17
22
|
/** Runs when the user picks a page. The first page is 0. */
|
|
@@ -23,5 +28,5 @@ export type PaginationProps = {
|
|
|
23
28
|
disabled?: boolean;
|
|
24
29
|
};
|
|
25
30
|
/** The buttons of the pages of a list: "Previous", the numbers and "Next". */
|
|
26
|
-
declare const Pagination: ({ ariaLabel, perPage, currentPage, totalEntries, onChange, disabled, maxPagesToBeShown, }: PaginationProps) => React.JSX.Element;
|
|
31
|
+
declare const Pagination: ({ ariaLabel, perPage, currentPage, totalEntries, onChange, disabled, maxPagesToBeShown, maxNarrowPagesToBeShown, }: PaginationProps) => React.JSX.Element;
|
|
27
32
|
export default Pagination;
|
|
@@ -4,6 +4,7 @@ import { buttonClassName } from "../actions/Button.js";
|
|
|
4
4
|
import Nav from "../semantic/Nav.js";
|
|
5
5
|
import times from "../utils/times.js";
|
|
6
6
|
import "react";
|
|
7
|
+
import classNames from "classnames";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
//#region ../ui-public/src/layout/Pagination.tsx
|
|
9
10
|
/**
|
|
@@ -21,10 +22,11 @@ var pageButtonClassName = `Pagination__button ${buttonClassName({
|
|
|
21
22
|
size: "milli"
|
|
22
23
|
})}`;
|
|
23
24
|
/** The buttons of the pages of a list: "Previous", the numbers and "Next". */
|
|
24
|
-
var Pagination = ({ ariaLabel, perPage, currentPage, totalEntries, onChange, disabled = false, maxPagesToBeShown = 7 }) => {
|
|
25
|
+
var Pagination = ({ ariaLabel, perPage, currentPage, totalEntries, onChange, disabled = false, maxPagesToBeShown = 7, maxNarrowPagesToBeShown }) => {
|
|
25
26
|
const { t, tm } = useTranslation();
|
|
26
27
|
const pageCount = Math.ceil(totalEntries / perPage);
|
|
27
28
|
const pages = visiblePages(pageCount, currentPage, maxPagesToBeShown);
|
|
29
|
+
const narrowPages = maxNarrowPagesToBeShown === void 0 ? pages : visiblePages(pageCount, currentPage, maxNarrowPagesToBeShown);
|
|
28
30
|
return /* @__PURE__ */ jsxs(Nav, {
|
|
29
31
|
className: "Pagination",
|
|
30
32
|
ariaLabel: t("a11y.pagination.label", { name: tm(ariaLabel) }),
|
|
@@ -41,7 +43,7 @@ var Pagination = ({ ariaLabel, perPage, currentPage, totalEntries, onChange, dis
|
|
|
41
43
|
children: pages.map((page) => {
|
|
42
44
|
const isCurrentPage = page === currentPage;
|
|
43
45
|
return /* @__PURE__ */ jsx(RawButton, {
|
|
44
|
-
className: pageButtonClassName,
|
|
46
|
+
className: classNames(pageButtonClassName, { "Pagination__button--wide-only": !narrowPages.includes(page) }),
|
|
45
47
|
disabled,
|
|
46
48
|
onClick: () => onChange(page),
|
|
47
49
|
ariaLabel: t("a11y.pagination.goToPage", { page: page + 1 }),
|
|
@@ -14,7 +14,10 @@ export type ToolbarPaginationPerPageSelect = {
|
|
|
14
14
|
export type ToolbarPaginationProps = Omit<PaginationProps, 'maxPagesToBeShown' | 'ariaLabel'> & {
|
|
15
15
|
/** What the pages are of ("Roles"). Without it, the ariaLabel of the Pane. */
|
|
16
16
|
ariaLabel?: TextMessage;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Always fewer page numbers, and no "Show" select. Without it, the
|
|
19
|
+
* pagination has this layout only when the toolbar is narrow.
|
|
20
|
+
*/
|
|
18
21
|
compact?: boolean;
|
|
19
22
|
/**
|
|
20
23
|
* A "Show" select before the pages, to change the number of items of a
|
|
@@ -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 {
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region ../ui-public/src/layout/Toolbar/Pagination.tsx
|
|
8
8
|
var DEFAULT_PER_PAGE_OPTIONS = [
|
|
9
9
|
25,
|
|
@@ -23,31 +23,35 @@ 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(
|
|
27
|
-
className: "
|
|
28
|
-
children: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
children: i
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "Toolbar__pagination",
|
|
28
|
+
children: [perPageSelect && showPerPageSelect && /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "Pagination__per-page",
|
|
30
|
+
children: [
|
|
31
|
+
t("pagination.show", { perPage }),
|
|
32
|
+
/* @__PURE__ */ jsx(MenuChevron, {}),
|
|
33
|
+
/* @__PURE__ */ jsx("select", {
|
|
34
|
+
"aria-label": t("a11y.pagination.perPage"),
|
|
35
|
+
value: perPage,
|
|
36
|
+
disabled,
|
|
37
|
+
onChange: (e) => perPageSelect.onChange(parseInt(e.target.value, 10)),
|
|
38
|
+
children: perPageOptions.map((i) => /* @__PURE__ */ jsx("option", {
|
|
39
|
+
value: i,
|
|
40
|
+
children: i
|
|
41
|
+
}, i))
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
}), showPages && /* @__PURE__ */ jsx(Pagination, {
|
|
45
|
+
ariaLabel: ariaLabel ? tm(ariaLabel) : paneAriaLabel,
|
|
46
|
+
totalEntries,
|
|
47
|
+
perPage,
|
|
48
|
+
currentPage,
|
|
49
|
+
onChange,
|
|
50
|
+
disabled,
|
|
51
|
+
maxPagesToBeShown: compact ? 3 : 10,
|
|
52
|
+
maxNarrowPagesToBeShown: 3
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
51
55
|
}
|
|
52
56
|
//#endregion
|
|
53
57
|
export { ToolbarPagination as default };
|
|
@@ -107,7 +107,10 @@ var Item = React.forwardRef(function Item({ className, row, body, expandable, ..
|
|
|
107
107
|
className: "CardList__summary",
|
|
108
108
|
children: row.summary
|
|
109
109
|
}),
|
|
110
|
-
row.trailing,
|
|
110
|
+
row.trailing && /* @__PURE__ */ jsx("div", {
|
|
111
|
+
className: "CardList__trailing",
|
|
112
|
+
children: row.trailing
|
|
113
|
+
}),
|
|
111
114
|
/* @__PURE__ */ jsx("div", {
|
|
112
115
|
className: "CardList__actions",
|
|
113
116
|
children: row.actions
|
|
@@ -12,9 +12,10 @@ export type SettingsListRowProps = {
|
|
|
12
12
|
/** One short sentence about the setting or about the result of the action */
|
|
13
13
|
description?: Message;
|
|
14
14
|
/**
|
|
15
|
-
* The current value. A long value gets an ellipsis
|
|
16
|
-
*
|
|
17
|
-
* (for example "Log out
|
|
15
|
+
* The current value. A long value gets an ellipsis (in a narrow list, it
|
|
16
|
+
* goes on more lines), and a value on more lines (an address) has each
|
|
17
|
+
* line at the right. An action without a value (for example "Log out
|
|
18
|
+
* everywhere") has no value.
|
|
18
19
|
*/
|
|
19
20
|
value?: ReactNode;
|
|
20
21
|
/**
|
|
@@ -48,7 +48,10 @@ function SegmentedControl({ options, iconOnly, value, onChange, ariaLabel, ariaL
|
|
|
48
48
|
}
|
|
49
49
|
return /* @__PURE__ */ jsxs(RawButton, {
|
|
50
50
|
...buttonProps,
|
|
51
|
-
children: [option.icon,
|
|
51
|
+
children: [option.icon, /* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: "SegmentedControl__label",
|
|
53
|
+
children: tc(option.label)
|
|
54
|
+
})]
|
|
52
55
|
}, option.value);
|
|
53
56
|
})
|
|
54
57
|
});
|
|
@@ -6,7 +6,7 @@ import { useAutoincrementIntegerId } from "../hooks/useAutoincrementIntegerId.js
|
|
|
6
6
|
import { useRovingKeyDown } from "../hooks/useRovingKeyDown.js";
|
|
7
7
|
import Root from "../layout/Toolbar/Root.js";
|
|
8
8
|
import Nav from "../semantic/Nav.js";
|
|
9
|
-
import React, { useCallback } from "react";
|
|
9
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
10
10
|
import classNames from "classnames";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
//#region ../ui-public/src/navigation/Tabs.tsx
|
|
@@ -24,6 +24,24 @@ function useTabIds() {
|
|
|
24
24
|
}
|
|
25
25
|
var TAB_SELECTOR = "[role=\"tab\"]";
|
|
26
26
|
/**
|
|
27
|
+
* Scrolls the row of tabs until the active tab is fully visible. It scrolls
|
|
28
|
+
* only the row: scrollIntoView also scrolls the page, and a row of tabs
|
|
29
|
+
* under the fold must not move the page when it mounts.
|
|
30
|
+
*/
|
|
31
|
+
function useScrollIntoTabRow(active) {
|
|
32
|
+
const ref = useRef(null);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const tab = ref.current;
|
|
35
|
+
const row = tab?.closest(".Toolbar__tabs");
|
|
36
|
+
if (!active || !tab || !row) return;
|
|
37
|
+
const rowRect = row.getBoundingClientRect();
|
|
38
|
+
const tabRect = tab.getBoundingClientRect();
|
|
39
|
+
if (tabRect.left < rowRect.left) row.scrollBy({ left: tabRect.left - rowRect.left });
|
|
40
|
+
else if (tabRect.right > rowRect.right) row.scrollBy({ left: tabRect.right - rowRect.right });
|
|
41
|
+
}, [active]);
|
|
42
|
+
return ref;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
27
45
|
* The WAI-ARIA tablist. The parent keeps the active tab in its state. The
|
|
28
46
|
* arrow keys, Home and End move the focus and select the tab (automatic
|
|
29
47
|
* activation). It is Toolbar.Tabs.
|
|
@@ -42,7 +60,9 @@ var TabList = React.memo(function TabList({ ariaLabel, children }) {
|
|
|
42
60
|
/** A tab of a Toolbar.Tabs. It is Toolbar.Tab. */
|
|
43
61
|
var TabButton = React.memo(function TabButton({ id, panelId, label, active, invalid, onPick }) {
|
|
44
62
|
const { tc } = useTranslation();
|
|
63
|
+
const ref = useScrollIntoTabRow(active);
|
|
45
64
|
return /* @__PURE__ */ jsx(RawButton, {
|
|
65
|
+
ref,
|
|
46
66
|
id,
|
|
47
67
|
tab: {
|
|
48
68
|
selected: active,
|
|
@@ -65,7 +85,9 @@ var TabLink = React.memo(function TabLink({ to, label, active, invalid, replace
|
|
|
65
85
|
const { tc } = useTranslation();
|
|
66
86
|
const { location } = useNavigation();
|
|
67
87
|
const isActive = active ?? (location ? isActivePath(location.pathname, to) : false);
|
|
88
|
+
const ref = useScrollIntoTabRow(isActive);
|
|
68
89
|
return /* @__PURE__ */ jsx(Link, {
|
|
90
|
+
ref,
|
|
69
91
|
to,
|
|
70
92
|
replace,
|
|
71
93
|
active: isActive,
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
//#region ../ui-public/icons/custom/color_d_icon.svg?react
|
|
4
|
-
var SvgColorDIcon = (props, ref) => /* @__PURE__ */ jsxs("svg", {
|
|
5
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
-
viewBox: "0 0 95 95",
|
|
7
|
-
width: "1em",
|
|
8
|
-
height: "1em",
|
|
9
|
-
"aria-hidden": "true",
|
|
10
|
-
ref,
|
|
11
|
-
...props,
|
|
12
|
-
children: [/* @__PURE__ */ jsx("title", { children: "DatoCMS" }), /* @__PURE__ */ jsx("path", {
|
|
13
|
-
fill: "#ff593d",
|
|
14
|
-
fillRule: "evenodd",
|
|
15
|
-
d: "M0 0h47.5a47.5 47.5 0 0 1 0 95H0ZM47.5 26a21.5 21.5 0 1 0 0 43 21.5 21.5 0 1 0 0-43Z"
|
|
16
|
-
})]
|
|
17
|
-
});
|
|
18
|
-
var ForwardRef = forwardRef(SvgColorDIcon);
|
|
19
|
-
//#endregion
|
|
20
|
-
export { ForwardRef as default };
|