@algolia/satellite 1.0.0-beta.132 → 1.0.0-beta.133
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/cjs/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
- package/cjs/AnnouncementBadge/AnnouncementBadge.js +3 -2
- package/cjs/AutoComplete/AutoComplete.d.ts +24 -14
- package/cjs/AutoComplete/AutoComplete.js +84 -15
- package/cjs/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
- package/cjs/AutoComplete/components/DefaultOptionItem.js +5 -2
- package/cjs/AutoComplete/types.d.ts +26 -18
- package/cjs/AutoComplete/utils.d.ts +4 -4
- package/cjs/DatePicker/DatePicker/DatePicker.d.ts +5 -11
- package/cjs/DatePicker/DatePicker/DatePicker.js +10 -6
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
- package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
- package/cjs/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
- package/cjs/DatePicker/components/Calendar.d.ts +4 -1
- package/cjs/DatePicker/components/Calendar.js +3 -1
- package/cjs/DatePicker/components/Display.d.ts +1 -1
- package/cjs/DatePicker/components/FooterActions.d.ts +2 -0
- package/cjs/DatePicker/components/FooterActions.js +4 -3
- package/cjs/DatePicker/components/Modal.d.ts +2 -2
- package/cjs/DatePicker/components/NavBar.d.ts +4 -1
- package/cjs/DatePicker/components/NavBar.js +4 -3
- package/cjs/DatePicker/types.d.ts +17 -0
- package/cjs/DatePicker/types.js +5 -0
- package/cjs/HelpUnderline/HelpUnderline.d.ts +1 -0
- package/cjs/KeyboardKey/KeyboardKey.d.ts +1 -0
- package/cjs/Modal/Modal.d.ts +4 -2
- package/cjs/Modal/Modal.js +2 -3
- package/cjs/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
- package/cjs/Pagination/CompactPagination/CompactPagination.js +6 -6
- package/cjs/Pagination/DotPagination/DotPagination.d.ts +4 -1
- package/cjs/Pagination/DotPagination/DotPagination.js +5 -2
- package/cjs/Pagination/Pagination/Pagination.d.ts +7 -1
- package/cjs/Pagination/Pagination/Pagination.js +15 -8
- package/cjs/ScrollIndicator/ScrollIndicator.d.ts +2 -0
- package/cjs/Sidebar/Sidebar.d.ts +2 -0
- package/cjs/Tables/DataTable/DataTable.d.ts +11 -1
- package/cjs/Tables/DataTable/DataTable.js +3 -2
- package/cjs/Tables/DataTable/components/Body.d.ts +2 -2
- package/cjs/Tables/DataTable/components/Body.js +6 -5
- package/cjs/Tables/DataTable/components/Loader.d.ts +3 -1
- package/cjs/Tables/DataTable/components/Loader.js +4 -3
- package/cjs/Tag/Tag.d.ts +4 -1
- package/cjs/Tag/Tag.js +3 -2
- package/cjs/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
- package/cjs/Tooltip/OverflowTooltipWrapper.js +1 -0
- package/cjs/utils/pluralize.js +6 -1
- package/esm/AnnouncementBadge/AnnouncementBadge.d.ts +1 -0
- package/esm/AnnouncementBadge/AnnouncementBadge.js +3 -2
- package/esm/AutoComplete/AutoComplete.d.ts +24 -14
- package/esm/AutoComplete/AutoComplete.js +85 -15
- package/esm/AutoComplete/components/DefaultOptionItem.d.ts +6 -2
- package/esm/AutoComplete/components/DefaultOptionItem.js +5 -2
- package/esm/AutoComplete/types.d.ts +26 -18
- package/esm/AutoComplete/utils.d.ts +4 -4
- package/esm/DatePicker/DatePicker/DatePicker.d.ts +5 -11
- package/esm/DatePicker/DatePicker/DatePicker.js +10 -6
- package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +5 -11
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +12 -6
- package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.d.ts +2 -0
- package/esm/DatePicker/DateRangePicker/DateRangePickerDisplay.js +3 -2
- package/esm/DatePicker/components/Calendar.d.ts +4 -1
- package/esm/DatePicker/components/Calendar.js +3 -1
- package/esm/DatePicker/components/Display.d.ts +1 -1
- package/esm/DatePicker/components/FooterActions.d.ts +2 -0
- package/esm/DatePicker/components/FooterActions.js +4 -3
- package/esm/DatePicker/components/Modal.d.ts +2 -2
- package/esm/DatePicker/components/NavBar.d.ts +4 -1
- package/esm/DatePicker/components/NavBar.js +4 -3
- package/esm/DatePicker/types.d.ts +17 -0
- package/esm/DatePicker/types.js +1 -0
- package/esm/HelpUnderline/HelpUnderline.d.ts +1 -0
- package/esm/KeyboardKey/KeyboardKey.d.ts +1 -0
- package/esm/Modal/Modal.d.ts +4 -2
- package/esm/Modal/Modal.js +2 -3
- package/esm/Pagination/CompactPagination/CompactPagination.d.ts +12 -0
- package/esm/Pagination/CompactPagination/CompactPagination.js +6 -6
- package/esm/Pagination/DotPagination/DotPagination.d.ts +4 -1
- package/esm/Pagination/DotPagination/DotPagination.js +5 -2
- package/esm/Pagination/Pagination/Pagination.d.ts +7 -1
- package/esm/Pagination/Pagination/Pagination.js +15 -8
- package/esm/ScrollIndicator/ScrollIndicator.d.ts +2 -0
- package/esm/Sidebar/Sidebar.d.ts +2 -0
- package/esm/Tables/DataTable/DataTable.d.ts +11 -1
- package/esm/Tables/DataTable/DataTable.js +3 -2
- package/esm/Tables/DataTable/components/Body.d.ts +2 -2
- package/esm/Tables/DataTable/components/Body.js +6 -5
- package/esm/Tables/DataTable/components/Loader.d.ts +3 -1
- package/esm/Tables/DataTable/components/Loader.js +4 -3
- package/esm/Tag/Tag.d.ts +4 -1
- package/esm/Tag/Tag.js +3 -2
- package/esm/Tooltip/OverflowTooltipWrapper.d.ts +1 -0
- package/esm/Tooltip/OverflowTooltipWrapper.js +2 -0
- package/esm/utils/pluralize.js +6 -1
- package/package.json +1 -1
- package/satellite.min.css +1 -1
@@ -25,7 +25,8 @@ var DateRangePickerDisplay = function DateRangePickerDisplay(_ref) {
|
|
25
25
|
var id = _ref.id,
|
26
26
|
onClick = _ref.onClick,
|
27
27
|
range = _ref.range,
|
28
|
-
buttonSize = _ref.buttonSize
|
28
|
+
buttonSize = _ref.buttonSize,
|
29
|
+
locale = _ref.locale;
|
29
30
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Display["default"], {
|
30
31
|
id: id,
|
31
32
|
onClick: onClick,
|
@@ -40,7 +41,7 @@ var DateRangePickerDisplay = function DateRangePickerDisplay(_ref) {
|
|
40
41
|
dateTime: range.end.toISOString(),
|
41
42
|
children: (0, _utils.formatDate)(range.end)
|
42
43
|
})]
|
43
|
-
}) : "Enter a date period..."
|
44
|
+
}) : (locale === null || locale === void 0 ? void 0 : locale.openButton) || "Enter a date period..."
|
44
45
|
});
|
45
46
|
};
|
46
47
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
2
|
import { DayPickerProps } from "react-day-picker";
|
3
|
+
import type { DatePickerLocale } from "../types";
|
3
4
|
declare type ExcludedDayPickerProps = "captionElement" | "showOutsideDays" | "enableOutsideDaysClick" | "fixedWeeks" | "labels" | "navbarElement" | "onTodayButtonClick" | "pagedNavigation" | "renderDay" | "renderWeek" | "reverseMonths" | "showWeekNumbers" | "showWeekDays" | "todayButton" | "weekdayElement" | "weekdaysLong" | "weekdaysShort";
|
4
5
|
export declare type EditableYearProps = {
|
5
6
|
editableYear?: false;
|
@@ -8,6 +9,8 @@ export declare type EditableYearProps = {
|
|
8
9
|
years?: number[];
|
9
10
|
initialDate?: Date;
|
10
11
|
};
|
11
|
-
export declare type CalendarProps = Omit<DayPickerProps, ExcludedDayPickerProps> & EditableYearProps
|
12
|
+
export declare type CalendarProps = Omit<Omit<DayPickerProps, "locale">, ExcludedDayPickerProps> & EditableYearProps & {
|
13
|
+
locale?: DatePickerLocale;
|
14
|
+
};
|
12
15
|
declare const Calendar: FunctionComponent<CalendarProps>;
|
13
16
|
export default Calendar;
|
@@ -75,7 +75,9 @@ var Calendar = function Calendar(props) {
|
|
75
75
|
enableOutsideDaysClick: false,
|
76
76
|
fixedWeeks: false,
|
77
77
|
navbarElement: function navbarElement(navBarProps) {
|
78
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavBar["default"], _objectSpread(_objectSpread({}, navBarProps), yearsProps)
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_NavBar["default"], _objectSpread(_objectSpread(_objectSpread({}, navBarProps), yearsProps), {}, {
|
79
|
+
locale: props.locale
|
80
|
+
}));
|
79
81
|
},
|
80
82
|
captionElement: function captionElement() {
|
81
83
|
return null;
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
2
|
import { ButtonProps } from "../../Button";
|
3
|
+
import type { DatePickerLocale } from "../types";
|
3
4
|
export interface FooterActionsProps {
|
4
5
|
onCancel: ButtonProps["onClick"];
|
5
6
|
onApply: ButtonProps["onClick"];
|
6
7
|
disableApply: boolean;
|
8
|
+
locale?: DatePickerLocale;
|
7
9
|
}
|
8
10
|
declare const FooterActions: FunctionComponent<FooterActionsProps>;
|
9
11
|
export default FooterActions;
|
@@ -20,18 +20,19 @@ var _templateObject, _templateObject2;
|
|
20
20
|
var FooterActions = function FooterActions(_ref) {
|
21
21
|
var onCancel = _ref.onCancel,
|
22
22
|
onApply = _ref.onApply,
|
23
|
-
disableApply = _ref.disableApply
|
23
|
+
disableApply = _ref.disableApply,
|
24
|
+
locale = _ref.locale;
|
24
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
25
26
|
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["ml-auto flex justify-end"]))),
|
26
27
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
27
28
|
onClick: onCancel,
|
28
29
|
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["mr-2"]))),
|
29
|
-
children: "Cancel"
|
30
|
+
children: (locale === null || locale === void 0 ? void 0 : locale.cancel) || "Cancel"
|
30
31
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.Button, {
|
31
32
|
disabled: disableApply,
|
32
33
|
onClick: onApply,
|
33
34
|
variant: "primary",
|
34
|
-
children: "Apply"
|
35
|
+
children: (locale === null || locale === void 0 ? void 0 : locale.apply) || "Apply"
|
35
36
|
})]
|
36
37
|
});
|
37
38
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Placement, StrictModifiers } from "@popperjs/core";
|
2
2
|
import type { FC, ReactNode } from "react";
|
3
|
-
import { StrictModifier } from "react-popper";
|
4
|
-
import { ClickAwayContainerProps } from "../../ClickAwayContainer";
|
3
|
+
import type { StrictModifier } from "react-popper";
|
4
|
+
import type { ClickAwayContainerProps } from "../../ClickAwayContainer";
|
5
5
|
export interface ModalProps {
|
6
6
|
children: ReactNode;
|
7
7
|
show: boolean;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
2
|
import type { NavbarElementProps } from "react-day-picker";
|
3
|
+
import type { DatePickerLocale } from "../types";
|
3
4
|
export declare type NavBarYearProps = {
|
4
5
|
editableYear?: false;
|
5
6
|
} | {
|
@@ -7,6 +8,8 @@ export declare type NavBarYearProps = {
|
|
7
8
|
years: number[];
|
8
9
|
onYearChange: (year: number) => void;
|
9
10
|
};
|
10
|
-
export declare type NavBarProps = NavbarElementProps & NavBarYearProps
|
11
|
+
export declare type NavBarProps = Omit<NavbarElementProps, "locale"> & NavBarYearProps & {
|
12
|
+
locale?: DatePickerLocale;
|
13
|
+
};
|
11
14
|
declare const NavBar: FunctionComponent<NavBarProps>;
|
12
15
|
export default NavBar;
|
@@ -27,7 +27,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
|
28
28
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
29
29
|
|
30
|
-
var _excluded = ["onPreviousClick", "onNextClick", "showPreviousButton", "showNextButton", "month", "localeUtils"];
|
30
|
+
var _excluded = ["onPreviousClick", "onNextClick", "showPreviousButton", "showNextButton", "month", "locale", "localeUtils"];
|
31
31
|
|
32
32
|
var NavBar = function NavBar(_ref) {
|
33
33
|
var onPreviousClick = _ref.onPreviousClick,
|
@@ -35,6 +35,7 @@ var NavBar = function NavBar(_ref) {
|
|
35
35
|
showPreviousButton = _ref.showPreviousButton,
|
36
36
|
showNextButton = _ref.showNextButton,
|
37
37
|
month = _ref.month,
|
38
|
+
locale = _ref.locale,
|
38
39
|
localeUtils = _ref.localeUtils,
|
39
40
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
40
41
|
var years = (0, _react.useMemo)(function () {
|
@@ -54,7 +55,7 @@ var NavBar = function NavBar(_ref) {
|
|
54
55
|
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["w-full top-3 left-0 pt-5 px-5 pb-2 flex justify-between"]))),
|
55
56
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
56
57
|
icon: _reactFeather.ChevronLeft,
|
57
|
-
title: "Previous month",
|
58
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.previousMonth) || "Previous month",
|
58
59
|
onClick: function onClick() {
|
59
60
|
return onPreviousClick();
|
60
61
|
},
|
@@ -79,7 +80,7 @@ var NavBar = function NavBar(_ref) {
|
|
79
80
|
})
|
80
81
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
81
82
|
icon: _reactFeather.ChevronRight,
|
82
|
-
title: "Next month",
|
83
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.nextMonth) || "Next month",
|
83
84
|
onClick: function onClick() {
|
84
85
|
return onNextClick();
|
85
86
|
},
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { ModalProps } from "./components/Modal";
|
2
|
+
export declare type DatePickerLocale = {
|
3
|
+
openButton?: string;
|
4
|
+
cancel?: string;
|
5
|
+
apply?: string;
|
6
|
+
nextMonth?: string;
|
7
|
+
previousMonth?: string;
|
8
|
+
};
|
9
|
+
export declare type SharedDatePickerProps = {
|
10
|
+
modalPlacement?: ModalProps["placement"];
|
11
|
+
locale?: DatePickerLocale;
|
12
|
+
} & ({
|
13
|
+
editableYear?: false;
|
14
|
+
} | {
|
15
|
+
editableYear: true;
|
16
|
+
years?: number[];
|
17
|
+
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
2
|
import { TooltipWrapperProps } from "../Tooltip";
|
3
3
|
export interface HelpUnderlineProps {
|
4
|
+
/** @ignore */
|
4
5
|
className?: string;
|
5
6
|
placement?: TooltipWrapperProps["placement"];
|
6
7
|
tooltipClassName?: TooltipWrapperProps["tooltipClassName"];
|
package/cjs/Modal/Modal.d.ts
CHANGED
@@ -11,10 +11,12 @@ export interface ModalProps {
|
|
11
11
|
centerY?: boolean;
|
12
12
|
onDismiss?: () => void;
|
13
13
|
children: ReactNode;
|
14
|
-
|
14
|
+
locale?: {
|
15
|
+
dismissText?: string;
|
16
|
+
};
|
15
17
|
}
|
16
18
|
export declare const Modal: {
|
17
|
-
({ title, className, children, open, fullBleed, onDismiss, animate, hideCloseIcon, size, centerY,
|
19
|
+
({ title, className, children, open, fullBleed, onDismiss, animate, hideCloseIcon, size, centerY, locale, }: ModalProps): import("react").ReactPortal;
|
18
20
|
Footer: import("react").FunctionComponent<import("./components/ModalFooter").ModalFooterProps>;
|
19
21
|
};
|
20
22
|
export default Modal;
|
package/cjs/Modal/Modal.js
CHANGED
@@ -88,8 +88,7 @@ var Modal = function Modal(_ref) {
|
|
88
88
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
89
89
|
_ref$centerY = _ref.centerY,
|
90
90
|
centerY = _ref$centerY === void 0 ? false : _ref$centerY,
|
91
|
-
|
92
|
-
closeIconText = _ref$closeIconText === void 0 ? "Dismiss" : _ref$closeIconText;
|
91
|
+
locale = _ref.locale;
|
93
92
|
|
94
93
|
var _useState = (0, _react.useState)(null),
|
95
94
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
@@ -164,7 +163,7 @@ var Modal = function Modal(_ref) {
|
|
164
163
|
children: title
|
165
164
|
}), !hideCloseIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
166
165
|
icon: _reactFeather.X,
|
167
|
-
title:
|
166
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.dismissText) || "Dismiss",
|
168
167
|
variant: "subtle",
|
169
168
|
onClick: onDismiss,
|
170
169
|
className: (0, _satellitePrefixer["default"])(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["flex-shrink-0 -mr-2"])))
|
@@ -1,5 +1,11 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
export declare type CompactPaginationLabel = "complete" | "compact" | "none";
|
3
|
+
declare type BaseLocaleProps = {
|
4
|
+
goToFirstPage?: string;
|
5
|
+
goToLastPage?: string;
|
6
|
+
goToNextPage?: string;
|
7
|
+
goToPreviousPage?: string;
|
8
|
+
};
|
3
9
|
declare type BaseCompactPaginationProps = {
|
4
10
|
/** Currently selected page (1 based index) */
|
5
11
|
currentPage: number;
|
@@ -10,9 +16,15 @@ declare type BaseCompactPaginationProps = {
|
|
10
16
|
export declare type DeterminateCompactPaginationProps = BaseCompactPaginationProps & {
|
11
17
|
nbPages: number;
|
12
18
|
showGoToLastPage?: boolean;
|
19
|
+
locale?: BaseLocaleProps & {
|
20
|
+
label?(page: number, nbPages: number): string;
|
21
|
+
};
|
13
22
|
};
|
14
23
|
export declare type IndeterminateCompactPaginationProps = BaseCompactPaginationProps & {
|
15
24
|
nextDisabled?: boolean;
|
25
|
+
locale?: BaseLocaleProps & {
|
26
|
+
label?(page: number): string;
|
27
|
+
};
|
16
28
|
};
|
17
29
|
export declare type CompactPaginationProps = DeterminateCompactPaginationProps | IndeterminateCompactPaginationProps;
|
18
30
|
export declare const isDeterminateCompactPaginationProps: (props: CompactPaginationProps) => props is DeterminateCompactPaginationProps;
|
@@ -32,24 +32,24 @@ var isIndeterminateCompactPaginationProps = function isIndeterminateCompactPagin
|
|
32
32
|
exports.isIndeterminateCompactPaginationProps = isIndeterminateCompactPaginationProps;
|
33
33
|
|
34
34
|
var CompactPagination = function CompactPagination(props) {
|
35
|
-
var _props$label;
|
35
|
+
var _props$label, _props$locale, _props$locale$label, _props$locale2, _props$locale2$label, _props$locale3, _props$locale4, _props$locale5, _props$locale6;
|
36
36
|
|
37
37
|
var labelType = (_props$label = props.label) !== null && _props$label !== void 0 ? _props$label : isDeterminateCompactPaginationProps(props) ? "complete" : "compact";
|
38
|
-
var label = labelType === "none" ? null : labelType === "compact" ? "".concat(props.currentPage) : isDeterminateCompactPaginationProps(props) ? "Page ".concat(props.currentPage, " of ").concat(props.nbPages) : "Page ".concat(props.currentPage, " of many");
|
38
|
+
var label = labelType === "none" ? null : labelType === "compact" ? "".concat(props.currentPage) : isDeterminateCompactPaginationProps(props) ? ((_props$locale = props.locale) === null || _props$locale === void 0 ? void 0 : (_props$locale$label = _props$locale.label) === null || _props$locale$label === void 0 ? void 0 : _props$locale$label.call(_props$locale, props.currentPage, props.nbPages)) || "Page ".concat(props.currentPage, " of ").concat(props.nbPages) : ((_props$locale2 = props.locale) === null || _props$locale2 === void 0 ? void 0 : (_props$locale2$label = _props$locale2.label) === null || _props$locale2$label === void 0 ? void 0 : _props$locale2$label.call(_props$locale2, props.currentPage)) || "Page ".concat(props.currentPage, " of many");
|
39
39
|
var isFirstPage = props.currentPage === 1;
|
40
40
|
var isLastPage = isDeterminateCompactPaginationProps(props) ? props.currentPage === props.nbPages : !!props.nextDisabled;
|
41
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
42
42
|
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex items-center space-x-2"]))),
|
43
43
|
children: [props.showGoToFirstPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
44
44
|
icon: _reactFeather.ChevronsLeft,
|
45
|
-
title: "Go to first page",
|
45
|
+
title: ((_props$locale3 = props.locale) === null || _props$locale3 === void 0 ? void 0 : _props$locale3.goToFirstPage) || "Go to first page",
|
46
46
|
onClick: function onClick() {
|
47
47
|
return props.onChange(1);
|
48
48
|
},
|
49
49
|
disabled: isFirstPage
|
50
50
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
51
51
|
icon: _reactFeather.ArrowLeft,
|
52
|
-
title: "Go to previous page",
|
52
|
+
title: ((_props$locale4 = props.locale) === null || _props$locale4 === void 0 ? void 0 : _props$locale4.goToPreviousPage) || "Go to previous page",
|
53
53
|
onClick: function onClick() {
|
54
54
|
return props.onChange(props.currentPage - 1);
|
55
55
|
},
|
@@ -59,14 +59,14 @@ var CompactPagination = function CompactPagination(props) {
|
|
59
59
|
children: label
|
60
60
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
61
61
|
icon: _reactFeather.ArrowRight,
|
62
|
-
title: "Go to next page",
|
62
|
+
title: ((_props$locale5 = props.locale) === null || _props$locale5 === void 0 ? void 0 : _props$locale5.goToNextPage) || "Go to next page",
|
63
63
|
onClick: function onClick() {
|
64
64
|
return props.onChange(props.currentPage + 1);
|
65
65
|
},
|
66
66
|
disabled: isLastPage
|
67
67
|
}), isDeterminateCompactPaginationProps(props) && props.showGoToLastPage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
68
68
|
icon: _reactFeather.ChevronsRight,
|
69
|
-
title: "Go to last page",
|
69
|
+
title: ((_props$locale6 = props.locale) === null || _props$locale6 === void 0 ? void 0 : _props$locale6.goToLastPage) || "Go to last page",
|
70
70
|
onClick: function onClick() {
|
71
71
|
return props.onChange(props.nbPages);
|
72
72
|
},
|
@@ -5,6 +5,9 @@ export declare type DotPaginationProps = {
|
|
5
5
|
onChange: (page: number) => void;
|
6
6
|
nbPages: number;
|
7
7
|
size?: "small" | "medium";
|
8
|
+
locale?: {
|
9
|
+
goToPageText?(page: number): string;
|
10
|
+
};
|
8
11
|
};
|
9
|
-
export declare const DotPagination: ({ currentPage, onChange, nbPages, size }: DotPaginationProps) => JSX.Element;
|
12
|
+
export declare const DotPagination: ({ currentPage, onChange, nbPages, size, locale }: DotPaginationProps) => JSX.Element;
|
10
13
|
export default DotPagination;
|
@@ -20,14 +20,17 @@ var DotPagination = function DotPagination(_ref) {
|
|
20
20
|
onChange = _ref.onChange,
|
21
21
|
nbPages = _ref.nbPages,
|
22
22
|
_ref$size = _ref.size,
|
23
|
-
size = _ref$size === void 0 ? "medium" : _ref$size
|
23
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
24
|
+
locale = _ref.locale;
|
24
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
25
26
|
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex"]))),
|
26
27
|
children: new Array(nbPages).fill(undefined).map(function (_, idx) {
|
28
|
+
var _locale$goToPageText;
|
29
|
+
|
27
30
|
var pageIdx = idx + 1;
|
28
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
29
32
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
30
|
-
"aria-label": "Go to page ".concat(pageIdx),
|
33
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : (_locale$goToPageText = locale.goToPageText) === null || _locale$goToPageText === void 0 ? void 0 : _locale$goToPageText.call(locale, pageIdx)) || "Go to page ".concat(pageIdx),
|
31
34
|
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n rounded-full mx-1\n ", "\n ", "\n "])), currentPage === pageIdx ? "bg-accent-600" : "bg-grey-200", size === "medium" ? "h-3 w-3" : "h-2 w-2"),
|
32
35
|
onClick: function onClick() {
|
33
36
|
return onChange(pageIdx);
|
@@ -1,9 +1,15 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
export declare type PaginationLocale = {
|
3
|
+
goToPage?(page: number): string;
|
4
|
+
goToNextPage?: string;
|
5
|
+
goToPreviousPage?: string;
|
6
|
+
};
|
2
7
|
export interface PaginationProps {
|
3
8
|
nbPages: number;
|
4
9
|
currentPage: number;
|
5
10
|
maxButtons?: number;
|
6
11
|
onChange: (page: number) => void;
|
12
|
+
locale?: PaginationLocale;
|
7
13
|
}
|
8
14
|
/**
|
9
15
|
* Use pagination to help our users to move through an ordered collection of items.
|
@@ -12,5 +18,5 @@ export interface PaginationProps {
|
|
12
18
|
* - Don't use on list with less than 20 items
|
13
19
|
* - Place the pagination at the bottom of the split item
|
14
20
|
*/
|
15
|
-
export declare const Pagination: ({ currentPage, nbPages, onChange, maxButtons: maxButtonsParam, }: PaginationProps) => JSX.Element;
|
21
|
+
export declare const Pagination: ({ currentPage, nbPages, onChange, maxButtons: maxButtonsParam, locale, }: PaginationProps) => JSX.Element;
|
16
22
|
export default Pagination;
|
@@ -41,11 +41,14 @@ var Ellipsis = function Ellipsis() {
|
|
41
41
|
var Group = function Group(_ref) {
|
42
42
|
var group = _ref.group,
|
43
43
|
currentPage = _ref.currentPage,
|
44
|
-
onChange = _ref.onChange
|
44
|
+
onChange = _ref.onChange,
|
45
|
+
locale = _ref.locale;
|
45
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
46
47
|
children: group.map(function (index) {
|
48
|
+
var _locale$goToPage;
|
49
|
+
|
47
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
48
|
-
"aria-label": "Go to page ".concat(index),
|
51
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : (_locale$goToPage = locale.goToPage) === null || _locale$goToPage === void 0 ? void 0 : _locale$goToPage.call(locale, index)) || "Go to page ".concat(index),
|
49
52
|
variant: index === currentPage ? "primary" : "neutral",
|
50
53
|
onClick: function onClick() {
|
51
54
|
return onChange(index);
|
@@ -69,7 +72,8 @@ var Pagination = function Pagination(_ref2) {
|
|
69
72
|
nbPages = _ref2.nbPages,
|
70
73
|
onChange = _ref2.onChange,
|
71
74
|
_ref2$maxButtons = _ref2.maxButtons,
|
72
|
-
maxButtonsParam = _ref2$maxButtons === void 0 ? DEFAULT_MAX_BUTTONS : _ref2$maxButtons
|
75
|
+
maxButtonsParam = _ref2$maxButtons === void 0 ? DEFAULT_MAX_BUTTONS : _ref2$maxButtons,
|
76
|
+
locale = _ref2.locale;
|
73
77
|
var padding = Math.floor((Math.min(nbPages, maxButtonsParam) - 1) / 2);
|
74
78
|
var maxButtons = 2 * padding + 1;
|
75
79
|
var currentPageGroupStart = Math.max(1, Math.min(currentPage - padding, nbPages - maxButtons));
|
@@ -87,7 +91,7 @@ var Pagination = function Pagination(_ref2) {
|
|
87
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.ButtonGroup, {
|
88
92
|
as: "nav",
|
89
93
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
90
|
-
"aria-label": "Go to previous page",
|
94
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.goToPreviousPage) || "Go to previous page",
|
91
95
|
disabled: currentPage === 1,
|
92
96
|
onClick: function onClick() {
|
93
97
|
return onChange(currentPage - 1);
|
@@ -98,17 +102,20 @@ var Pagination = function Pagination(_ref2) {
|
|
98
102
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Group, {
|
99
103
|
currentPage: currentPage,
|
100
104
|
onChange: onChange,
|
101
|
-
group: groups[0]
|
105
|
+
group: groups[0],
|
106
|
+
locale: locale
|
102
107
|
}), groups[0].length !== 0 && groups[1][0] - groups[0][0] > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(Ellipsis, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Group, {
|
103
108
|
currentPage: currentPage,
|
104
109
|
onChange: onChange,
|
105
|
-
group: groups[1]
|
110
|
+
group: groups[1],
|
111
|
+
locale: locale
|
106
112
|
}), groups[2].length !== 0 && groups[2][0] - groups[1][groups[1].length - 1] > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(Ellipsis, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Group, {
|
107
113
|
currentPage: currentPage,
|
108
114
|
onChange: onChange,
|
109
|
-
group: groups[2]
|
115
|
+
group: groups[2],
|
116
|
+
locale: locale
|
110
117
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
111
|
-
"aria-label": "Go to next page",
|
118
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.goToNextPage) || "Go to next page",
|
112
119
|
disabled: currentPage === nbPages,
|
113
120
|
onClick: function onClick() {
|
114
121
|
return onChange(currentPage + 1);
|
@@ -2,7 +2,9 @@ import type { CSSProperties, FunctionComponent, ReactHTML } from "react";
|
|
2
2
|
export declare type ScrollIndicatorVariant = "light" | "dark";
|
3
3
|
export interface ScrollIndicatorProps {
|
4
4
|
wrapperClassName?: string;
|
5
|
+
/** @ignore */
|
5
6
|
className?: string;
|
7
|
+
/** @ignore */
|
6
8
|
style?: CSSProperties;
|
7
9
|
tagName?: keyof ReactHTML;
|
8
10
|
variant?: ScrollIndicatorVariant;
|
package/cjs/Sidebar/Sidebar.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
2
2
|
import type { SidebarCollapsed, SidebarVariant } from "./types";
|
3
3
|
export interface SidebarProps extends DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
|
4
|
+
/** @default "dark" */
|
4
5
|
variant?: SidebarVariant;
|
6
|
+
/** @default false */
|
5
7
|
collapsed?: SidebarCollapsed;
|
6
8
|
}
|
7
9
|
export declare const Sidebar: {
|
@@ -1,6 +1,15 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { ColumnDefinition, DataConfiguration, GetItemId, PaginationConfiguration, Row, SelectMode, Sorting, Status } from "./types";
|
3
3
|
declare type CanSelectItem<Item> = (item: Item, idx: number) => boolean;
|
4
|
+
export declare type DataTableLocale = {
|
5
|
+
selectAllButton?: string;
|
6
|
+
noDataTitle?: string;
|
7
|
+
noDataDescription?: string;
|
8
|
+
loadingTitle?: string;
|
9
|
+
loadingDescription?: string;
|
10
|
+
errorTitle?: string;
|
11
|
+
errorDescription?: string;
|
12
|
+
};
|
4
13
|
interface BaseDataTableProps<Item> {
|
5
14
|
data: Item[];
|
6
15
|
itemId?: GetItemId<Item>;
|
@@ -13,6 +22,7 @@ interface BaseDataTableProps<Item> {
|
|
13
22
|
columns: ColumnDefinition<Item>[];
|
14
23
|
canHoverRow?(row: Row<Item>): boolean;
|
15
24
|
onRowHoveredChanged?(row: Row<Item> | null): void;
|
25
|
+
locale?: DataTableLocale;
|
16
26
|
}
|
17
27
|
declare type DataTableWithSelectMode<Item> = {
|
18
28
|
selectMode: Exclude<SelectMode, "none">;
|
@@ -46,5 +56,5 @@ export declare type DataTableProps<Item> = BaseDataTableProps<Item> & (DataTable
|
|
46
56
|
* - If a cell is empty or unavailable, keep the cell empty to reduce noise and help with legibility.
|
47
57
|
* - Truncate long text to make it fit into a cell. However, choose column width wisely based on expected values, and adjust the table accordingly
|
48
58
|
*/
|
49
|
-
export declare const DataTable: <Item extends {}>({ data, itemId, columns, onChange, status, noDataContent, errorContent, sorting, pagination, selectMode, selection, onSelectionChange, canSelectItem, canHoverRow, onRowHoveredChanged, }: DataTableProps<Item>) => JSX.Element;
|
59
|
+
export declare const DataTable: <Item extends {}>({ data, itemId, columns, onChange, status, noDataContent, errorContent, sorting, pagination, selectMode, selection, onSelectionChange, canSelectItem, canHoverRow, onRowHoveredChanged, locale, }: DataTableProps<Item>) => JSX.Element;
|
50
60
|
export default DataTable;
|
@@ -90,7 +90,8 @@ var DataTable = function DataTable(_ref) {
|
|
90
90
|
onSelectionChange = _ref.onSelectionChange,
|
91
91
|
canSelectItem = _ref.canSelectItem,
|
92
92
|
canHoverRow = _ref.canHoverRow,
|
93
|
-
onRowHoveredChanged = _ref.onRowHoveredChanged
|
93
|
+
onRowHoveredChanged = _ref.onRowHoveredChanged,
|
94
|
+
locale = _ref.locale;
|
94
95
|
|
95
96
|
if (process.env.NODE_ENV !== "production") {
|
96
97
|
var _selection$length;
|
@@ -152,7 +153,7 @@ var DataTable = function DataTable(_ref) {
|
|
152
153
|
var isChecked = selectionLength === dataLength;
|
153
154
|
var isIndeterminate = selectionLength > 0 && selectionLength !== dataLength;
|
154
155
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox["default"], {
|
155
|
-
"aria-label": "Select all" // Small hack to position the checkbox in the center of the header
|
156
|
+
"aria-label": (locale === null || locale === void 0 ? void 0 : locale.selectAllButton) || "Select all" // Small hack to position the checkbox in the center of the header
|
156
157
|
,
|
157
158
|
className: (0, _satellitePrefixer["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["absolute mb-2.5"]))),
|
158
159
|
checked: isChecked,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { DataTableProps } from "../DataTable";
|
3
3
|
import type { AdvancedColumnDefinition, Row, SelectMode, Status } from "../types";
|
4
|
-
export interface BodyProps<Item> extends Pick<DataTableProps<Item>, "selection" | "onSelectionChange" | "canHoverRow"> {
|
4
|
+
export interface BodyProps<Item> extends Pick<DataTableProps<Item>, "selection" | "onSelectionChange" | "canHoverRow" | "locale"> {
|
5
5
|
rows: Row<Item>[];
|
6
6
|
status?: Status;
|
7
7
|
noDataContent?: ReactNode;
|
@@ -10,5 +10,5 @@ export interface BodyProps<Item> extends Pick<DataTableProps<Item>, "selection"
|
|
10
10
|
onRowHoverChange(row: Row<Item> | null): void;
|
11
11
|
selectMode: SelectMode;
|
12
12
|
}
|
13
|
-
export declare const Body: <Item extends {}>({ rows, columns, status, noDataContent, errorContent, selectMode, selection, onSelectionChange, onRowHoverChange, canHoverRow, }: BodyProps<Item>) => JSX.Element;
|
13
|
+
export declare const Body: <Item extends {}>({ rows, columns, status, noDataContent, errorContent, selectMode, selection, onSelectionChange, onRowHoverChange, canHoverRow, locale, }: BodyProps<Item>) => JSX.Element;
|
14
14
|
export default Body;
|
@@ -43,7 +43,8 @@ var Body = function Body(_ref) {
|
|
43
43
|
_ref$canHoverRow = _ref.canHoverRow,
|
44
44
|
canHoverRow = _ref$canHoverRow === void 0 ? function () {
|
45
45
|
return true;
|
46
|
-
} : _ref$canHoverRow
|
46
|
+
} : _ref$canHoverRow,
|
47
|
+
locale = _ref.locale;
|
47
48
|
|
48
49
|
var handleRowSelection = function handleRowSelection(row) {
|
49
50
|
if (!onSelectionChange) return;
|
@@ -81,8 +82,8 @@ var Body = function Body(_ref) {
|
|
81
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
82
83
|
className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["flex justify-center py-6"]))),
|
83
84
|
children: errorContent || /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyState["default"], {
|
84
|
-
title: "Error",
|
85
|
-
description: "An error occurred while loading data.",
|
85
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.errorTitle) || "Error",
|
86
|
+
description: (locale === null || locale === void 0 ? void 0 : locale.errorDescription) || "An error occurred while loading data.",
|
86
87
|
centered: true,
|
87
88
|
usageContext: "result"
|
88
89
|
})
|
@@ -100,8 +101,8 @@ var Body = function Body(_ref) {
|
|
100
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
101
102
|
className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["flex justify-center py-6"]))),
|
102
103
|
children: noDataContent || /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmptyState["default"], {
|
103
|
-
title: "Empty",
|
104
|
-
description: "There is no data to display",
|
104
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.noDataTitle) || "Empty",
|
105
|
+
description: (locale === null || locale === void 0 ? void 0 : locale.noDataDescription) || "There is no data to display",
|
105
106
|
centered: true,
|
106
107
|
usageContext: "result"
|
107
108
|
})
|
@@ -1,6 +1,8 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import type { DataTableLocale } from "../DataTable";
|
2
3
|
export interface LoaderProps {
|
3
4
|
className?: string;
|
5
|
+
locale?: DataTableLocale;
|
4
6
|
}
|
5
|
-
export declare const Loader: ({ className }: LoaderProps) => JSX.Element;
|
7
|
+
export declare const Loader: ({ className, locale }: LoaderProps) => JSX.Element;
|
6
8
|
export default Loader;
|
@@ -24,7 +24,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
var _templateObject;
|
25
25
|
|
26
26
|
var Loader = function Loader(_ref) {
|
27
|
-
var className = _ref.className
|
27
|
+
var className = _ref.className,
|
28
|
+
locale = _ref.locale;
|
28
29
|
|
29
30
|
var _useState = (0, _react.useState)(false),
|
30
31
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
@@ -49,8 +50,8 @@ var Loader = function Loader(_ref) {
|
|
49
50
|
className: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["flex justify-center"]))),
|
50
51
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressSpinner["default"], {})
|
51
52
|
}),
|
52
|
-
title: "It appears to be taking a while to get your data",
|
53
|
-
description: "Please hold or try again later",
|
53
|
+
title: (locale === null || locale === void 0 ? void 0 : locale.loadingTitle) || "It appears to be taking a while to get your data",
|
54
|
+
description: (locale === null || locale === void 0 ? void 0 : locale.loadingDescription) || "Please hold or try again later",
|
54
55
|
centered: true
|
55
56
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressSpinner["default"], {})
|
56
57
|
});
|