@canonical/react-components 0.37.9 → 0.39.0
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/components/Accordion/Accordion.d.ts +2 -2
- package/dist/components/Accordion/AccordionSection/AccordionSection.d.ts +2 -2
- package/dist/components/ActionButton/ActionButton.d.ts +1 -1
- package/dist/components/ArticlePagination/ArticlePagination.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/CheckboxInput/CheckableInput/CheckableInput.d.ts +1 -1
- package/dist/components/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Code/Code.d.ts +1 -1
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/dist/components/CodeSnippet/CodeSnippetBlock.d.ts +1 -1
- package/dist/components/CodeSnippet/CodeSnippetDropdown.d.ts +2 -2
- package/dist/components/Col/Col.d.ts +2 -2
- package/dist/components/ContextualMenu/ContextualMenu.d.ts +1 -1
- package/dist/components/ContextualMenu/ContextualMenuDropdown/ContextualMenuDropdown.d.ts +3 -3
- package/dist/components/Field/Field.d.ts +2 -2
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +4 -4
- package/dist/components/List/List.js +1 -1
- package/dist/components/MainTable/MainTable.d.ts +4 -4
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/ModularTable/ModularTable.d.ts +6 -2
- package/dist/components/ModularTable/ModularTable.js +8 -4
- package/dist/components/Navigation/Navigation.d.ts +1 -1
- package/dist/components/Navigation/NavigationLink/NavigationLink.d.ts +1 -1
- package/dist/components/Navigation/NavigationMenu/NavigationMenu.d.ts +1 -1
- package/dist/components/Navigation/types.d.ts +8 -8
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/Pagination/Pagination.d.ts +6 -2
- package/dist/components/Pagination/Pagination.js +13 -3
- package/dist/components/Pagination/PaginationButton/PaginationButton.d.ts +2 -2
- package/dist/components/Pagination/PaginationItem/PaginationItem.d.ts +1 -1
- package/dist/components/PasswordToggle/PasswordToggle.d.ts +1 -1
- package/dist/components/RadioInput/RadioInput.d.ts +1 -1
- package/dist/components/Row/Row.d.ts +1 -1
- package/dist/components/SearchAndFilter/FilterPanelSection/FilterPanelSection.d.ts +1 -1
- package/dist/components/SearchAndFilter/SearchAndFilter.d.ts +1 -1
- package/dist/components/SearchAndFilter/types.d.ts +2 -2
- package/dist/components/SearchBox/SearchBox.d.ts +10 -2
- package/dist/components/SearchBox/SearchBox.js +7 -3
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Slider/Slider.js +3 -1
- package/dist/components/Spinner/Spinner.d.ts +1 -1
- package/dist/components/StatusLabel/StatusLabel.d.ts +1 -1
- package/dist/components/Strip/Strip.d.ts +1 -1
- package/dist/components/SummaryButton/SummaryButton.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/TableCell/TableCell.d.ts +1 -1
- package/dist/components/TableHeader/TableHeader.d.ts +1 -1
- package/dist/components/TableRow/TableRow.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -2
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +4 -4
- package/dist/components/Tooltip/Tooltip.js +8 -3
- package/dist/hooks/useThrottle.d.ts +1 -1
- package/dist/hooks/useWindowFitment.d.ts +1 -1
- package/dist/testing/mock-scss.js +4 -0
- package/dist/types/index.d.ts +7 -7
- package/dist/types/react-table-config.d.js +3 -1
- package/package.json +47 -47
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { HTMLProps } from "react";
|
|
2
2
|
import type { AccordionHeadings, AccordionSectionProps } from "./AccordionSection";
|
|
3
3
|
import type { ClassName, PropsWithSpread } from "../../types";
|
|
4
|
-
export
|
|
4
|
+
export type Section = AccordionSectionProps & {
|
|
5
5
|
/**
|
|
6
6
|
* An optional key for the section component. It will also be
|
|
7
7
|
* used to track which section is selected.
|
|
8
8
|
*/
|
|
9
9
|
key?: string | number;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Props = PropsWithSpread<{
|
|
12
12
|
/**
|
|
13
13
|
* Optional classes applied to the parent element.
|
|
14
14
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { Headings } from "../../../types";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type AccordionHeadings = Exclude<Headings, "h1">;
|
|
4
|
+
export type Props = {
|
|
5
5
|
/**
|
|
6
6
|
* The content of the section.
|
|
7
7
|
*/
|
|
@@ -12,7 +12,7 @@ export declare const ButtonAppearance: {
|
|
|
12
12
|
* The type of the Button props.
|
|
13
13
|
* @template P - The type of the props if providing a component to `element`
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type Props<P = null> = {
|
|
16
16
|
/**
|
|
17
17
|
* The appearance of the button.
|
|
18
18
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLProps } from "react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { PropsWithSpread } from "../../../types";
|
|
4
|
-
export
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
5
|
/**
|
|
6
6
|
* The type of the input element.
|
|
7
7
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CheckableInputProps } from "./CheckableInput";
|
|
2
|
-
export
|
|
2
|
+
export type Props = Omit<CheckableInputProps, "inputType">;
|
|
3
3
|
declare const CheckboxInput: ({ label, indeterminate, ...checkboxProps }: Props) => JSX.Element;
|
|
4
4
|
export default CheckboxInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLProps } from "react";
|
|
2
2
|
import type { Props as CodeSnippetBlockProps } from "./CodeSnippetBlock";
|
|
3
3
|
import type { ClassName, PropsWithSpread } from "../../types";
|
|
4
|
-
export
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
5
|
/**
|
|
6
6
|
* Optional class(es) to pass to the wrapping div element.
|
|
7
7
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ChangeEventHandler, HTMLProps } from "react";
|
|
2
|
-
export
|
|
2
|
+
export type DropdownOptionProps = {
|
|
3
3
|
/**
|
|
4
4
|
* The label of the dropdown option.
|
|
5
5
|
*/
|
|
6
6
|
label: string;
|
|
7
7
|
} & HTMLProps<HTMLOptionElement>;
|
|
8
|
-
export
|
|
8
|
+
export type Props = {
|
|
9
9
|
/**
|
|
10
10
|
* Function for handling the select value changing.
|
|
11
11
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ElementType, HTMLProps, ReactNode } from "react";
|
|
2
2
|
import type { ClassName, PropsWithSpread } from "../../types";
|
|
3
|
-
export
|
|
3
|
+
export type ColSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
4
4
|
export declare const colSizes: ColSize[];
|
|
5
|
-
export
|
|
5
|
+
export type Props = PropsWithSpread<{
|
|
6
6
|
/**
|
|
7
7
|
* The content of the column.
|
|
8
8
|
*/
|
|
@@ -11,7 +11,7 @@ export declare enum Label {
|
|
|
11
11
|
* The props for the ContextualMenu component.
|
|
12
12
|
* @template L - The type of the link props.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type Props<L> = PropsWithSpread<{
|
|
15
15
|
/**
|
|
16
16
|
* Whether the menu should adjust to fit in the screen.
|
|
17
17
|
*/
|
|
@@ -8,13 +8,13 @@ export declare enum Label {
|
|
|
8
8
|
* The type of the menu links.
|
|
9
9
|
* @template L - The type of the link props.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type MenuLink<L = null> = string | ButtonProps<L> | ButtonProps<L>[];
|
|
12
|
+
export type Position = "left" | "center" | "right";
|
|
13
13
|
/**
|
|
14
14
|
* The props for the ContextualMenuDropdown component.
|
|
15
15
|
* @template L - The type of the link props.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type Props<L = null> = {
|
|
18
18
|
adjustedPosition?: Position;
|
|
19
19
|
autoAdjust?: boolean;
|
|
20
20
|
closePortal?: (evt?: MouseEvent) => void;
|
|
@@ -3,7 +3,7 @@ import type { ClassName } from "../../types";
|
|
|
3
3
|
/**
|
|
4
4
|
* The props for the Field component.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type Props = {
|
|
7
7
|
/**
|
|
8
8
|
* The content for caution validation.
|
|
9
9
|
*/
|
|
@@ -31,7 +31,7 @@ export declare type Props = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Optional class(es) to pass to the help text element.
|
|
33
33
|
*/
|
|
34
|
-
helpClassName?:
|
|
34
|
+
helpClassName?: string;
|
|
35
35
|
/**
|
|
36
36
|
* An id to give to the help element.
|
|
37
37
|
*/
|
|
@@ -82,7 +82,7 @@ var Input = function Input(_ref) {
|
|
|
82
82
|
inputRef.current.focus();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
}, [takeFocus]);
|
|
85
|
+
}, [takeFocus, takeFocusDelay]);
|
|
86
86
|
var input;
|
|
87
87
|
|
|
88
88
|
if (type === "checkbox") {
|
|
@@ -109,7 +109,7 @@ var Input = function Input(_ref) {
|
|
|
109
109
|
error: error,
|
|
110
110
|
forId: id,
|
|
111
111
|
help: help,
|
|
112
|
-
helpClassName: helpClassName,
|
|
112
|
+
helpClassName: helpClassName + "",
|
|
113
113
|
helpId: helpId,
|
|
114
114
|
isTickElement: type === "checkbox" || type === "radio",
|
|
115
115
|
label: fieldLabel,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { HTMLProps, ReactNode } from "react";
|
|
2
2
|
import type { ClassName, Headings } from "../../types";
|
|
3
|
-
export
|
|
3
|
+
export type ListItem = ReactNode | ({
|
|
4
4
|
content: ReactNode;
|
|
5
5
|
} & HTMLProps<HTMLLIElement>);
|
|
6
|
-
export
|
|
6
|
+
export type SteppedListItem = {
|
|
7
7
|
content: ReactNode;
|
|
8
8
|
title: ReactNode;
|
|
9
9
|
titleElement?: Headings;
|
|
10
|
-
} & HTMLProps<HTMLLIElement>;
|
|
11
|
-
export
|
|
10
|
+
} & Omit<HTMLProps<HTMLLIElement>, "title" | "content">;
|
|
11
|
+
export type Props = {
|
|
12
12
|
/**
|
|
13
13
|
* Optional class(es) to pass to the wrapping element.
|
|
14
14
|
*/
|
|
@@ -62,7 +62,7 @@ var generateItems = function generateItems(_ref) {
|
|
|
62
62
|
if (stepped) {
|
|
63
63
|
body = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TitleComponent, {
|
|
64
64
|
className: "p-stepped-list__title"
|
|
65
|
-
}, title), /*#__PURE__*/_react.default.createElement("
|
|
65
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
66
66
|
className: "p-stepped-list__content"
|
|
67
67
|
}, content));
|
|
68
68
|
} else {
|
|
@@ -2,7 +2,7 @@ import type { HTMLProps, ReactNode } from "react";
|
|
|
2
2
|
import type { ClassName, PropsWithSpread, SortDirection } from "../../types";
|
|
3
3
|
import type { TableProps } from "../Table";
|
|
4
4
|
import type { TableCellProps } from "../TableCell";
|
|
5
|
-
export
|
|
5
|
+
export type MainTableHeader = PropsWithSpread<{
|
|
6
6
|
/**
|
|
7
7
|
* The content of the table header.
|
|
8
8
|
*/
|
|
@@ -20,13 +20,13 @@ export declare type MainTableHeader = PropsWithSpread<{
|
|
|
20
20
|
*/
|
|
21
21
|
heading?: string;
|
|
22
22
|
}, HTMLProps<HTMLTableHeaderCellElement>>;
|
|
23
|
-
export
|
|
23
|
+
export type MainTableCell = PropsWithSpread<{
|
|
24
24
|
/**
|
|
25
25
|
* The content of the table cell.
|
|
26
26
|
*/
|
|
27
27
|
content?: ReactNode;
|
|
28
28
|
}, Omit<TableCellProps, "children">>;
|
|
29
|
-
export
|
|
29
|
+
export type MainTableRow = PropsWithSpread<{
|
|
30
30
|
/**
|
|
31
31
|
* Optional class(es) to apply to the row.
|
|
32
32
|
*/
|
|
@@ -53,7 +53,7 @@ export declare type MainTableRow = PropsWithSpread<{
|
|
|
53
53
|
*/
|
|
54
54
|
sortData?: Record<string, unknown>;
|
|
55
55
|
}, HTMLProps<HTMLTableRowElement>>;
|
|
56
|
-
export
|
|
56
|
+
export type Props = PropsWithSpread<{
|
|
57
57
|
/**
|
|
58
58
|
* The default key to sort the rows by.
|
|
59
59
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import type { HTMLProps, ReactNode } from "react";
|
|
3
3
|
import { ClassName, PropsWithSpread } from "../../types";
|
|
4
|
-
export
|
|
4
|
+
export type Props = PropsWithSpread<{
|
|
5
5
|
/**
|
|
6
6
|
* Buttons to display underneath the main modal content.
|
|
7
7
|
*/
|
|
@@ -2,7 +2,7 @@ import { ReactNode, HTMLProps } from "react";
|
|
|
2
2
|
import { TableCellProps, TableHeaderProps, TableRowProps } from "react-table";
|
|
3
3
|
import type { Column, UseTableOptions, Cell, Row, HeaderGroup } from "react-table";
|
|
4
4
|
import { PropsWithSpread } from "../../types";
|
|
5
|
-
export
|
|
5
|
+
export type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
6
6
|
/**
|
|
7
7
|
* The columns of the table.
|
|
8
8
|
*/
|
|
@@ -19,6 +19,10 @@ export declare type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
|
19
19
|
* Optional extra row to display underneath the main table content.
|
|
20
20
|
*/
|
|
21
21
|
footer?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional argument to make the tables be sortable and use the `useSortBy` plugin.
|
|
24
|
+
*/
|
|
25
|
+
sortable?: Boolean;
|
|
22
26
|
/**
|
|
23
27
|
* This function is used to resolve any props needed for a particular column's header cell.
|
|
24
28
|
*/
|
|
@@ -33,5 +37,5 @@ export declare type Props<D extends Record<string, unknown>> = PropsWithSpread<{
|
|
|
33
37
|
getCellProps?: (cell: Cell<D>) => Partial<TableCellProps & HTMLProps<HTMLTableCellElement>>;
|
|
34
38
|
getRowId?: UseTableOptions<D>["getRowId"];
|
|
35
39
|
}, HTMLProps<HTMLTableElement>>;
|
|
36
|
-
declare function ModularTable({ data, columns, emptyMsg, footer, getHeaderProps, getRowProps, getCellProps, getRowId, ...props }: Props<Record<string, unknown>>): JSX.Element;
|
|
40
|
+
declare function ModularTable({ data, columns, emptyMsg, footer, sortable, getHeaderProps, getRowProps, getCellProps, getRowId, ...props }: Props<Record<string, unknown>>): JSX.Element;
|
|
37
41
|
export default ModularTable;
|
|
@@ -19,7 +19,7 @@ var _TableCell = _interopRequireDefault(require("../TableCell"));
|
|
|
19
19
|
|
|
20
20
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
21
21
|
|
|
22
|
-
var _excluded = ["data", "columns", "emptyMsg", "footer", "getHeaderProps", "getRowProps", "getCellProps", "getRowId"];
|
|
22
|
+
var _excluded = ["data", "columns", "emptyMsg", "footer", "sortable", "getHeaderProps", "getRowProps", "getCellProps", "getRowId"];
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
@@ -40,6 +40,7 @@ function ModularTable(_ref) {
|
|
|
40
40
|
columns = _ref.columns,
|
|
41
41
|
emptyMsg = _ref.emptyMsg,
|
|
42
42
|
footer = _ref.footer,
|
|
43
|
+
sortable = _ref.sortable,
|
|
43
44
|
getHeaderProps = _ref.getHeaderProps,
|
|
44
45
|
getRowProps = _ref.getRowProps,
|
|
45
46
|
getCellProps = _ref.getCellProps,
|
|
@@ -50,7 +51,7 @@ function ModularTable(_ref) {
|
|
|
50
51
|
columns: columns,
|
|
51
52
|
data: data,
|
|
52
53
|
getRowId: getRowId || undefined
|
|
53
|
-
}),
|
|
54
|
+
}, sortable ? _reactTable.useSortBy : undefined),
|
|
54
55
|
getTableProps = _useTable.getTableProps,
|
|
55
56
|
getTableBodyProps = _useTable.getTableBodyProps,
|
|
56
57
|
headerGroups = _useTable.headerGroups,
|
|
@@ -60,11 +61,14 @@ function ModularTable(_ref) {
|
|
|
60
61
|
var showEmpty = !!emptyMsg && (!rows || rows.length === 0);
|
|
61
62
|
return /*#__PURE__*/_react.default.createElement(_Table.default, _extends({}, getTableProps(), props), /*#__PURE__*/_react.default.createElement("thead", null, headerGroups.map(function (headerGroup) {
|
|
62
63
|
return /*#__PURE__*/_react.default.createElement(_TableRow.default, headerGroup.getHeaderGroupProps(), headerGroup.headers.map(function (column) {
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_TableHeader.default,
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_TableHeader.default, _extends({
|
|
65
|
+
sort: column.isSorted ? column.isSortedDesc ? "descending" : "ascending" : "none"
|
|
66
|
+
}, column.getHeaderProps([{
|
|
64
67
|
className: column.className
|
|
65
68
|
}, {
|
|
66
69
|
className: column.getCellIcon ? "p-table__cell--icon-placeholder" : ""
|
|
67
|
-
}, _objectSpread({}, getHeaderProps === null || getHeaderProps === void 0 ? void 0 : getHeaderProps(column))
|
|
70
|
+
}, _objectSpread({}, getHeaderProps === null || getHeaderProps === void 0 ? void 0 : getHeaderProps(column)), // Only call this if we want it to be sortable too.
|
|
71
|
+
sortable ? column.getSortByToggleProps() : {}])), column.render("Header"));
|
|
68
72
|
}));
|
|
69
73
|
})), /*#__PURE__*/_react.default.createElement("tbody", getTableBodyProps(), rows.map(function (row) {
|
|
70
74
|
// This function is responsible for lazily preparing a row for rendering.
|
|
@@ -3,7 +3,7 @@ import type { GenerateLink, NavItem, LogoProps } from "./types";
|
|
|
3
3
|
import { PropsWithSpread, SubComponentProps } from "../../types";
|
|
4
4
|
import { SearchBoxProps } from "../SearchBox";
|
|
5
5
|
import { Theme } from "../../enums";
|
|
6
|
-
export
|
|
6
|
+
export type Props = PropsWithSpread<{
|
|
7
7
|
/**
|
|
8
8
|
* By default the header is constrained to the width of the grid. Use this
|
|
9
9
|
* option to make the header take the full width of the page.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLProps } from "react";
|
|
2
2
|
import type { GenerateLink, NavMenu } from "../types";
|
|
3
3
|
import { PropsWithSpread } from "../../../types";
|
|
4
|
-
|
|
4
|
+
type Props = PropsWithSpread<NavMenu & {
|
|
5
5
|
generateLink?: GenerateLink;
|
|
6
6
|
}, HTMLProps<HTMLLIElement>>;
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes, HTMLProps, ReactNode } from "react";
|
|
2
2
|
import { PropsWithSpread } from "../../types";
|
|
3
|
-
export
|
|
3
|
+
export type NavLinkBase = {
|
|
4
4
|
/**
|
|
5
5
|
* Whether this nav item is currently selected.
|
|
6
6
|
*/
|
|
@@ -14,14 +14,14 @@ export declare type NavLinkBase = {
|
|
|
14
14
|
*/
|
|
15
15
|
url?: string;
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type NavLinkAnchor = PropsWithSpread<NavLinkBase & {
|
|
18
18
|
url: string;
|
|
19
19
|
}, HTMLAttributes<HTMLAnchorElement>>;
|
|
20
|
-
export
|
|
20
|
+
export type NavLinkButton = PropsWithSpread<NavLinkBase & {
|
|
21
21
|
url?: never;
|
|
22
22
|
}, HTMLAttributes<HTMLButtonElement>>;
|
|
23
|
-
export
|
|
24
|
-
export
|
|
23
|
+
export type NavLink = NavLinkAnchor | NavLinkButton;
|
|
24
|
+
export type NavMenu = {
|
|
25
25
|
/**
|
|
26
26
|
* Whether to align the dropdown to the right edge of the navigation item.
|
|
27
27
|
*/
|
|
@@ -38,13 +38,13 @@ export declare type NavMenu = {
|
|
|
38
38
|
/**
|
|
39
39
|
* Navigation items which can be either a link or a menu containing links.
|
|
40
40
|
*/
|
|
41
|
-
export
|
|
41
|
+
export type NavItem = NavLink | NavMenu;
|
|
42
42
|
/**
|
|
43
43
|
* A function that can be used to generate link elements when you don't want to
|
|
44
44
|
* use a standard HTML anchor.
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
47
|
-
export
|
|
46
|
+
export type GenerateLink = (item: NavLink) => ReactNode;
|
|
47
|
+
export type LogoProps = PropsWithSpread<{
|
|
48
48
|
/**
|
|
49
49
|
* An icon to display in the tag.
|
|
50
50
|
*/
|
|
@@ -9,14 +9,14 @@ export declare const NotificationSeverity: {
|
|
|
9
9
|
readonly NEGATIVE: "negative";
|
|
10
10
|
readonly POSITIVE: "positive";
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type NotificationAction = {
|
|
13
13
|
label: string;
|
|
14
14
|
onClick: () => void;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* The props for the Notification component.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type Props = PropsWithSpread<{
|
|
20
20
|
/**
|
|
21
21
|
* A list of up to two actions that the notification can perform.
|
|
22
22
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLProps } from "react";
|
|
2
2
|
import type { PropsWithSpread } from "../../types";
|
|
3
|
-
export
|
|
3
|
+
export type Props = PropsWithSpread<{
|
|
4
4
|
/**
|
|
5
5
|
* The current page being viewed.
|
|
6
6
|
*/
|
|
@@ -25,6 +25,10 @@ export declare type Props = PropsWithSpread<{
|
|
|
25
25
|
* The number of pages at which to truncate the pagination items.
|
|
26
26
|
*/
|
|
27
27
|
truncateThreshold?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Whether or not the pagination is ceneterd on the page.
|
|
30
|
+
*/
|
|
31
|
+
centered?: boolean;
|
|
28
32
|
}, HTMLProps<HTMLElement>>;
|
|
29
|
-
declare const Pagination: ({ itemsPerPage, totalItems, paginate, currentPage, scrollToTop, truncateThreshold, ...navProps }: Props) => JSX.Element;
|
|
33
|
+
declare const Pagination: ({ itemsPerPage, totalItems, paginate, currentPage, scrollToTop, truncateThreshold, centered, ...navProps }: Props) => JSX.Element;
|
|
30
34
|
export default Pagination;
|
|
@@ -5,16 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
10
12
|
var _PaginationButton = _interopRequireDefault(require("./PaginationButton"));
|
|
11
13
|
|
|
12
14
|
var _PaginationItem = _interopRequireDefault(require("./PaginationItem"));
|
|
13
15
|
|
|
14
|
-
var _excluded = ["itemsPerPage", "totalItems", "paginate", "currentPage", "scrollToTop", "truncateThreshold"];
|
|
16
|
+
var _excluded = ["itemsPerPage", "totalItems", "paginate", "currentPage", "scrollToTop", "truncateThreshold", "centered"];
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
20
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
18
22
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
23
|
|
|
20
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -121,6 +125,7 @@ var Pagination = function Pagination(_ref) {
|
|
|
121
125
|
scrollToTop = _ref.scrollToTop,
|
|
122
126
|
_ref$truncateThreshol = _ref.truncateThreshold,
|
|
123
127
|
truncateThreshold = _ref$truncateThreshol === void 0 ? 10 : _ref$truncateThreshol,
|
|
128
|
+
centered = _ref.centered,
|
|
124
129
|
navProps = _objectWithoutProperties(_ref, _excluded);
|
|
125
130
|
|
|
126
131
|
// return early if no pagination is required
|
|
@@ -139,8 +144,13 @@ var Pagination = function Pagination(_ref) {
|
|
|
139
144
|
scrollToTop && scrollTop();
|
|
140
145
|
};
|
|
141
146
|
|
|
142
|
-
return /*#__PURE__*/_react.default.createElement("nav",
|
|
143
|
-
className: "p-pagination"
|
|
147
|
+
return /*#__PURE__*/_react.default.createElement("nav", _extends({
|
|
148
|
+
className: "p-pagination",
|
|
149
|
+
"aria-label": "Pagination"
|
|
150
|
+
}, navProps), /*#__PURE__*/_react.default.createElement("ol", {
|
|
151
|
+
className: (0, _classnames.default)("p-pagination__items", {
|
|
152
|
+
"u-align--center": centered
|
|
153
|
+
})
|
|
144
154
|
}, /*#__PURE__*/_react.default.createElement(_PaginationButton.default, {
|
|
145
155
|
key: "back",
|
|
146
156
|
direction: "back",
|
|
@@ -3,8 +3,8 @@ export declare enum Label {
|
|
|
3
3
|
Next = "Next page",
|
|
4
4
|
Previous = "Previous page"
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type PaginationDirection = "forward" | "back";
|
|
7
|
+
export type Props = {
|
|
8
8
|
/**
|
|
9
9
|
* The direction of the pagination.
|
|
10
10
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CheckableInputProps } from "../CheckboxInput/CheckableInput";
|
|
2
|
-
export
|
|
2
|
+
export type Props = Omit<CheckableInputProps, "inputType">;
|
|
3
3
|
declare const RadioInput: ({ label, ...radioProps }: Props) => JSX.Element;
|
|
4
4
|
export default RadioInput;
|