@axa-fr/design-system-slash-react 1.2.1-alpha.106 → 1.2.1-alpha.109
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/Layout/Header/Infos/Infos.js +3 -1
- package/dist/Table/Pagination/Items.d.ts +1 -1
- package/dist/Table/Pagination/Li.d.ts +2 -1
- package/dist/Table/Pagination/Li.js +2 -2
- package/dist/Table/Pagination/Pager.d.ts +5 -1
- package/dist/Table/Pagination/Pager.js +3 -3
- package/dist/Table/Pagination/PaginationButton.d.ts +2 -1
- package/dist/Table/Pagination/PaginationButton.js +2 -2
- package/dist/Table/Pagination/Paging.d.ts +2 -1
- package/dist/Table/Pagination/Paging.js +2 -2
- package/package.json +2 -2
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from "react";
|
|
3
|
+
import infoIcon from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
3
4
|
import { getComponentClassName } from "../../../utilities";
|
|
4
5
|
import { generateId } from "../../../utilities/helpers/generateId";
|
|
5
6
|
import "@axa-fr/design-system-slash-css/dist/Layout/Header/Infos/Infos.scss";
|
|
7
|
+
import { Svg } from "../../../Svg";
|
|
6
8
|
const defaultClassName = "af-contrat";
|
|
7
9
|
const Infos = ({ infos, className, classModifier }) => {
|
|
8
10
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
9
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx(
|
|
11
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx(Svg, { className: "af-contrat__icon", src: infoIcon, "aria-hidden": "true" }), _jsx("dl", { className: `${defaultClassName}__list`, children: infos.map((info) => {
|
|
10
12
|
const idTerm = info.id ?? `info-${generateId(info)}`;
|
|
11
13
|
return (_jsxs(Fragment, { children: [_jsx("dt", { id: idTerm, className: `${defaultClassName}__word`, children: info.word }), _jsx("dd", { className: `${defaultClassName}__def`, "aria-labelledby": idTerm, children: info.definition })] }, idTerm));
|
|
12
14
|
}) })] }));
|
|
@@ -2,9 +2,10 @@ type LiProps = {
|
|
|
2
2
|
isVisible?: boolean;
|
|
3
3
|
active?: boolean;
|
|
4
4
|
value: number;
|
|
5
|
+
pageLinkLabel: string;
|
|
5
6
|
onChange: (e: {
|
|
6
7
|
value: number;
|
|
7
8
|
}) => void;
|
|
8
9
|
};
|
|
9
|
-
declare const Li: ({ isVisible, active, value,
|
|
10
|
+
declare const Li: ({ isVisible, active, value, pageLinkLabel, onChange }: LiProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
11
|
export { Li };
|
|
@@ -5,10 +5,10 @@ const onClick = ({ onChange, value }) => (event) => {
|
|
|
5
5
|
value: Number(value),
|
|
6
6
|
});
|
|
7
7
|
};
|
|
8
|
-
const Li = ({ isVisible, active, value,
|
|
8
|
+
const Li = ({ isVisible, active, value, pageLinkLabel, onChange }) => {
|
|
9
9
|
if (!isVisible) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { "aria-current": active ? "page" : undefined, className: "af-pager__item-link", href: "/#", onClick: onClick({
|
|
12
|
+
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { "aria-current": active ? "page" : undefined, className: "af-pager__item-link", href: "/#", "aria-label": `Page ${value} des ${pageLinkLabel}`, onClick: onClick({ onChange, value }), children: _jsx("span", { children: value }) }) }));
|
|
13
13
|
};
|
|
14
14
|
export { Li };
|
|
@@ -27,11 +27,15 @@ export type PagerComponentProps = Pick<ComponentPropsWithoutRef<typeof Paginatio
|
|
|
27
27
|
* Label for the next button
|
|
28
28
|
*/
|
|
29
29
|
nextLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Label for page links and select
|
|
32
|
+
*/
|
|
33
|
+
elementsLabel?: string;
|
|
30
34
|
/**
|
|
31
35
|
* Label for text betweeen current page a total number of pages. Only used in "light" mode
|
|
32
36
|
* @default "sur"
|
|
33
37
|
*/
|
|
34
38
|
ofLabel?: string;
|
|
35
39
|
};
|
|
36
|
-
declare const Pager: ({ className, classModifier, numberPages, currentPage, onChange, mode, previousLabel, nextLabel, ofLabel, }: PagerComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare const Pager: ({ className, classModifier, numberPages, currentPage, onChange, mode, previousLabel, nextLabel, elementsLabel, ofLabel, }: PagerComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
41
|
export { Pager };
|
|
@@ -4,13 +4,13 @@ import { getComponentClassName } from "../..";
|
|
|
4
4
|
import { Li } from "./Li";
|
|
5
5
|
import { LiPoint } from "./LiPoint";
|
|
6
6
|
import { PaginationButton } from "./PaginationButton";
|
|
7
|
-
const Pager = ({ className, classModifier, numberPages = 1, currentPage = 1, onChange, mode = "default", previousLabel = "« Précédent", nextLabel = "Suivant »", ofLabel = "sur", }) => {
|
|
7
|
+
const Pager = ({ className, classModifier, numberPages = 1, currentPage = 1, onChange, mode = "default", previousLabel = "« Précédent", nextLabel = "Suivant »", elementsLabel = "éléments", ofLabel = "sur", }) => {
|
|
8
8
|
const hasNext = currentPage < numberPages;
|
|
9
9
|
const hasPrevious = currentPage > 1;
|
|
10
10
|
const componentClassName = getComponentClassName(className, classModifier, "af-pager");
|
|
11
11
|
if (mode === "light") {
|
|
12
|
-
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, children: _jsx("i", { className: "glyphicon glyphicon-chevron-left", "aria-hidden": "true" }) }), _jsxs(LiPoint, { isVisible: true, children: [currentPage, " ", ofLabel, " ", numberPages] }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, children: _jsx("i", { className: "glyphicon glyphicon-chevron-right", "aria-hidden": "true" }) })] }) }));
|
|
12
|
+
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, ariaLabel: `Page précédente des ${elementsLabel}`, children: _jsx("i", { className: "glyphicon glyphicon-chevron-left", "aria-hidden": "true" }) }), _jsxs(LiPoint, { isVisible: true, children: [currentPage, " ", ofLabel, " ", numberPages] }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, ariaLabel: `Page suivante des ${elementsLabel}`, children: _jsx("i", { className: "glyphicon glyphicon-chevron-right", "aria-hidden": "true" }) })] }) }));
|
|
13
13
|
}
|
|
14
|
-
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, children: previousLabel }), _jsx(Li, { onChange: onChange, value: 1, isVisible: numberPages > 1 && currentPage > 1 }), _jsx(LiPoint, { isVisible: currentPage > 3, children: "..." }), _jsx(Li, { onChange: onChange, value: currentPage - 1, isVisible: numberPages > 2 && currentPage > 2 }), _jsx(Li, { onChange: onChange, value: currentPage, active: true, isVisible: numberPages > 0 }), _jsx(Li, { onChange: onChange, value: currentPage + 1, isVisible: currentPage < numberPages - 1 }), _jsx(LiPoint, { isVisible: currentPage < numberPages - 2, children: "..." }), _jsx(Li, { onChange: onChange, value: numberPages, isVisible: currentPage < numberPages }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, children: nextLabel })] }) }));
|
|
14
|
+
return (_jsx("nav", { className: componentClassName, children: _jsxs("ul", { className: "af-pager__pagination", children: [_jsx(PaginationButton, { onChange: onChange, value: currentPage - 1, active: hasPrevious, isVisible: true, ariaLabel: `Page précédente des ${elementsLabel}`, children: previousLabel }), _jsx(Li, { onChange: onChange, value: 1, isVisible: numberPages > 1 && currentPage > 1, pageLinkLabel: elementsLabel }), _jsx(LiPoint, { isVisible: currentPage > 3, children: "..." }), _jsx(Li, { onChange: onChange, value: currentPage - 1, isVisible: numberPages > 2 && currentPage > 2, pageLinkLabel: elementsLabel }), _jsx(Li, { onChange: onChange, value: currentPage, active: true, isVisible: numberPages > 0, pageLinkLabel: elementsLabel }), _jsx(Li, { onChange: onChange, value: currentPage + 1, isVisible: currentPage < numberPages - 1, pageLinkLabel: elementsLabel }), _jsx(LiPoint, { isVisible: currentPage < numberPages - 2, children: "..." }), _jsx(Li, { onChange: onChange, value: numberPages, isVisible: currentPage < numberPages, pageLinkLabel: elementsLabel }), _jsx(PaginationButton, { onChange: onChange, value: currentPage + 1, active: hasNext, isVisible: true, ariaLabel: `Page suivante des ${elementsLabel}`, children: nextLabel })] }) }));
|
|
15
15
|
};
|
|
16
16
|
export { Pager };
|
|
@@ -7,6 +7,7 @@ type PaginationButtonProps = {
|
|
|
7
7
|
onChange: (e: {
|
|
8
8
|
value: number;
|
|
9
9
|
}) => void;
|
|
10
|
+
ariaLabel: string;
|
|
10
11
|
};
|
|
11
|
-
declare const PaginationButton: ({ isVisible, active, children, value, onChange, }: PaginationButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
declare const PaginationButton: ({ isVisible, active, children, value, onChange, ariaLabel, }: PaginationButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
13
|
export { PaginationButton };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
const PaginationButton = ({ isVisible, active, children, value, onChange, }) => {
|
|
2
|
+
const PaginationButton = ({ isVisible, active, children, value, onChange, ariaLabel, }) => {
|
|
3
3
|
if (!isVisible) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
6
6
|
if (active) {
|
|
7
|
-
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { className: "af-pager__item-link", href: "/#", role: "button", onClick: (e) => {
|
|
7
|
+
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { className: "af-pager__item-link", href: "/#", role: "button", "aria-label": ariaLabel, onClick: (e) => {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
onChange({ value });
|
|
10
10
|
}, children: children }) }));
|
|
@@ -9,6 +9,7 @@ type OnChangePager = (e: {
|
|
|
9
9
|
}) => void;
|
|
10
10
|
export type Props = Omit<PagingComponentProps, "onChange"> & {
|
|
11
11
|
onChange?: OnChangePager;
|
|
12
|
+
selectPageSizeLabel?: string;
|
|
12
13
|
};
|
|
13
|
-
declare const Paging: ({ className, classModifier, currentPage, displayLabel,
|
|
14
|
+
declare const Paging: ({ className, classModifier, currentPage, displayLabel, elementsLabel, selectPageSizeLabel, id, mode, nextLabel, numberItems, numberPages, ofLabel, previousLabel, items, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export { Paging };
|
|
@@ -4,7 +4,7 @@ import { useCallback } from "react";
|
|
|
4
4
|
import { getComponentClassName } from "../..";
|
|
5
5
|
import { Items } from "./Items";
|
|
6
6
|
import { Pager } from "./Pager";
|
|
7
|
-
const Paging = ({ className, classModifier, currentPage = 1, displayLabel,
|
|
7
|
+
const Paging = ({ className, classModifier, currentPage = 1, displayLabel, elementsLabel, selectPageSizeLabel, id, mode, nextLabel, numberItems = 10, numberPages, ofLabel, previousLabel, items, onChange, }) => {
|
|
8
8
|
const componentClassName = getComponentClassName(className, classModifier, "af-paging");
|
|
9
9
|
const handleChangeItems = useCallback((e) => onChange &&
|
|
10
10
|
onChange({
|
|
@@ -16,6 +16,6 @@ const Paging = ({ className, classModifier, currentPage = 1, displayLabel, selec
|
|
|
16
16
|
numberItems,
|
|
17
17
|
page: e.value,
|
|
18
18
|
}), [numberItems, onChange]);
|
|
19
|
-
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, selectAriaLabel:
|
|
19
|
+
return (_jsxs("div", { className: componentClassName, children: [_jsx("div", { className: "af-paging__limit", children: _jsx(Items, { onChange: handleChangeItems, numberItems: numberItems, id: id, displayLabel: displayLabel, selectAriaLabel: selectPageSizeLabel, elementsLabel: elementsLabel, items: items }) }), _jsx("div", { className: "af-paging__pager", children: _jsx(Pager, { onChange: handleChangePager, currentPage: currentPage, numberPages: numberPages, previousLabel: previousLabel, nextLabel: nextLabel, elementsLabel: elementsLabel, ofLabel: ofLabel, mode: mode }) })] }));
|
|
20
20
|
};
|
|
21
21
|
export { Paging };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.109",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "1.2.1-alpha.
|
|
50
|
+
"@axa-fr/design-system-slash-css": "1.2.1-alpha.109",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|