@axa-fr/design-system-look-and-feel-react 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.d.ts +12 -0
- package/dist/Accordion/Accordion.js +11 -0
- package/dist/Accordion/AccordionTagDateContainer.d.ts +10 -0
- package/dist/Accordion/AccordionTagDateContainer.js +10 -0
- package/dist/Accordion/index.d.ts +3 -0
- package/dist/Accordion/index.js +3 -0
- package/dist/AccordionCore/AccordionCore.d.ts +12 -0
- package/dist/AccordionCore/AccordionCore.js +13 -0
- package/dist/AccordionCore/index.d.ts +2 -0
- package/dist/AccordionCore/index.js +2 -0
- package/dist/Alert/Alert.d.ts +22 -0
- package/dist/Alert/Alert.js +27 -0
- package/dist/Button/Button.d.ts +17 -0
- package/dist/Button/Button.js +15 -0
- package/dist/Card/Card.d.ts +6 -0
- package/dist/Card/Card.js +9 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/index.js +2 -0
- package/dist/Form/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Form/Checkbox/Checkbox.js +15 -0
- package/dist/Form/Checkbox/CheckboxSelect.d.ts +15 -0
- package/dist/Form/Checkbox/CheckboxSelect.js +7 -0
- package/dist/Form/Checkbox/index.d.ts +2 -0
- package/dist/Form/Checkbox/index.js +2 -0
- package/dist/Form/FileUpload/FileUpload.d.ts +32 -0
- package/dist/Form/FileUpload/FileUpload.js +51 -0
- package/dist/Form/FileUpload/index.d.ts +1 -0
- package/dist/Form/FileUpload/index.js +1 -0
- package/dist/Form/InputError/InputError.d.ts +7 -0
- package/dist/Form/InputError/InputError.js +5 -0
- package/dist/Form/InputError/index.d.ts +1 -0
- package/dist/Form/InputError/index.js +1 -0
- package/dist/Form/Radio/Radio.d.ts +7 -0
- package/dist/Form/Radio/Radio.js +14 -0
- package/dist/Form/Radio/RadioSelect.d.ts +20 -0
- package/dist/Form/Radio/RadioSelect.js +16 -0
- package/dist/Form/Radio/index.d.ts +2 -0
- package/dist/Form/Radio/index.js +2 -0
- package/dist/Form/Select/CustomOption.d.ts +4 -0
- package/dist/Form/Select/CustomOption.js +8 -0
- package/dist/Form/Select/DropdownIndicator.d.ts +4 -0
- package/dist/Form/Select/DropdownIndicator.js +11 -0
- package/dist/Form/Select/Select.d.ts +27 -0
- package/dist/Form/Select/Select.js +27 -0
- package/dist/Form/Select/index.d.ts +1 -0
- package/dist/Form/Select/index.js +1 -0
- package/dist/Form/Text/Text.d.ts +13 -0
- package/dist/Form/Text/Text.js +16 -0
- package/dist/Form/Text/index.d.ts +1 -0
- package/dist/Form/Text/index.js +1 -0
- package/dist/Form/core/Field.d.ts +16 -0
- package/dist/Form/core/Field.js +12 -0
- package/dist/Form/core/FieldError.d.ts +7 -0
- package/dist/Form/core/FieldError.js +8 -0
- package/dist/Form/core/FieldForm.d.ts +59 -0
- package/dist/Form/core/FieldForm.js +151 -0
- package/dist/Form/core/FieldInput.d.ts +9 -0
- package/dist/Form/core/FieldInput.js +9 -0
- package/dist/Form/core/FormClassManager.d.ts +7 -0
- package/dist/Form/core/FormClassManager.js +33 -0
- package/dist/Form/core/HelpMessage.d.ts +7 -0
- package/dist/Form/core/HelpMessage.js +2 -0
- package/dist/Form/core/InputList.d.ts +8 -0
- package/dist/Form/core/InputList.js +4 -0
- package/dist/Form/core/MessageTypes.d.ts +5 -0
- package/dist/Form/core/MessageTypes.js +6 -0
- package/dist/Form/core/getComponentClassName.d.ts +1 -0
- package/dist/Form/core/getComponentClassName.js +27 -0
- package/dist/Form/core/getFirstId.d.ts +2 -0
- package/dist/Form/core/getFirstId.js +1 -0
- package/dist/Form/core/getOptionClassName.d.ts +1 -0
- package/dist/Form/core/getOptionClassName.js +10 -0
- package/dist/Form/core/index.d.ts +31 -0
- package/dist/Form/core/index.js +13 -0
- package/dist/Form/core/useInputClassModifier.d.ts +4 -0
- package/dist/Form/core/useInputClassModifier.js +12 -0
- package/dist/Form/core/useOptionsWithId.d.ts +2 -0
- package/dist/Form/core/useOptionsWithId.js +13 -0
- package/dist/IconBg/IconBg.d.ts +9 -0
- package/dist/IconBg/IconBg.js +13 -0
- package/dist/IconBg/index.d.ts +2 -0
- package/dist/IconBg/index.js +2 -0
- package/dist/Layout/Footer/DynamicIcons.d.ts +4 -0
- package/dist/Layout/Footer/DynamicIcons.js +20 -0
- package/dist/Layout/Footer/Footer.d.ts +14 -0
- package/dist/Layout/Footer/Footer.js +16 -0
- package/dist/Layout/Footer/MenuIcons.d.ts +9 -0
- package/dist/Layout/Footer/MenuIcons.js +8 -0
- package/dist/Layout/Footer/MenuLink.d.ts +11 -0
- package/dist/Layout/Footer/MenuLink.js +10 -0
- package/dist/Layout/Header/Header.d.ts +9 -0
- package/dist/Layout/Header/Header.js +11 -0
- package/dist/Layout/Header/NavBar/NavBar.d.ts +8 -0
- package/dist/Layout/Header/NavBar/NavBar.js +13 -0
- package/dist/Layout/Header/NavBar/index.d.ts +1 -0
- package/dist/Layout/Header/NavBar/index.js +1 -0
- package/dist/Layout/Header/PreviousLink/PreviousLink.d.ts +7 -0
- package/dist/Layout/Header/PreviousLink/PreviousLink.js +14 -0
- package/dist/Layout/Header/PreviousLink/index.d.ts +1 -0
- package/dist/Layout/Header/PreviousLink/index.js +1 -0
- package/dist/Layout/Header/index.d.ts +1 -0
- package/dist/Layout/Header/index.js +1 -0
- package/dist/Link/Link.d.ts +7 -0
- package/dist/Link/Link.js +11 -0
- package/dist/List/ClickList/ClickItem/ClickItem.d.ts +11 -0
- package/dist/List/ClickList/ClickItem/ClickItem.js +17 -0
- package/dist/List/ClickList/ClickItem/index.d.ts +1 -0
- package/dist/List/ClickList/ClickItem/index.js +1 -0
- package/dist/List/ClickList/ClickList.d.ts +8 -0
- package/dist/List/ClickList/ClickList.js +4 -0
- package/dist/List/ClickList/index.d.ts +3 -0
- package/dist/List/ClickList/index.js +3 -0
- package/dist/List/ContentItemDuo/ContentItemDuo.d.ts +13 -0
- package/dist/List/ContentItemDuo/ContentItemDuo.js +18 -0
- package/dist/List/ContentItemDuo/index.d.ts +2 -0
- package/dist/List/ContentItemDuo/index.js +2 -0
- package/dist/List/ContentItemMono/ContentItemMono.d.ts +16 -0
- package/dist/List/ContentItemMono/ContentItemMono.js +16 -0
- package/dist/List/ContentItemMono/constants.d.ts +4 -0
- package/dist/List/ContentItemMono/constants.js +5 -0
- package/dist/List/ContentItemMono/index.d.ts +3 -0
- package/dist/List/ContentItemMono/index.js +3 -0
- package/dist/List/ContentTabList/ContentTabItem/ContentTabItem.d.ts +6 -0
- package/dist/List/ContentTabList/ContentTabItem/ContentTabItem.js +6 -0
- package/dist/List/ContentTabList/ContentTabItem/index.d.ts +2 -0
- package/dist/List/ContentTabList/ContentTabItem/index.js +1 -0
- package/dist/List/ContentTabList/ContentTabList.d.ts +8 -0
- package/dist/List/ContentTabList/ContentTabList.js +9 -0
- package/dist/List/ContentTabList/index.d.ts +1 -0
- package/dist/List/ContentTabList/index.js +1 -0
- package/dist/List/List.d.ts +6 -0
- package/dist/List/List.js +9 -0
- package/dist/List/index.d.ts +1 -0
- package/dist/List/index.js +1 -0
- package/dist/Loader/Loader.d.ts +11 -0
- package/dist/Loader/Loader.js +10 -0
- package/dist/Loader/index.d.ts +1 -0
- package/dist/Loader/index.js +1 -0
- package/dist/ModalClient/Modal.d.ts +24 -0
- package/dist/ModalClient/Modal.js +53 -0
- package/dist/Pagination/Pagination.d.ts +9 -0
- package/dist/Pagination/Pagination.js +14 -0
- package/dist/Pagination/PaginationDesktop.d.ts +9 -0
- package/dist/Pagination/PaginationDesktop.js +31 -0
- package/dist/Pagination/PaginationMobile.d.ts +9 -0
- package/dist/Pagination/PaginationMobile.js +10 -0
- package/dist/Stepper/Stepper.d.ts +12 -0
- package/dist/Stepper/Stepper.js +22 -0
- package/dist/Svg/Svg.d.ts +7 -0
- package/dist/Svg/Svg.js +47 -0
- package/dist/Svg/index.d.ts +1 -0
- package/dist/Svg/index.js +1 -0
- package/dist/Svg/svgInjector.d.ts +12 -0
- package/dist/Svg/svgInjector.js +28 -0
- package/dist/Tabs/Tabs.d.ts +16 -0
- package/dist/Tabs/Tabs.js +48 -0
- package/dist/Tag/Tag.d.ts +6 -0
- package/dist/Tag/Tag.js +7 -0
- package/dist/Tag/index.d.ts +2 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Title/Title.d.ts +14 -0
- package/dist/Title/Title.js +11 -0
- package/dist/Title/TitleWithSubtitles.d.ts +10 -0
- package/dist/Title/TitleWithSubtitles.js +6 -0
- package/dist/Title/constants.d.ts +5 -0
- package/dist/Title/constants.js +5 -0
- package/dist/Title/index.d.ts +3 -0
- package/dist/Title/index.js +3 -0
- package/dist/assets/svg/facebook.svg +1 -0
- package/dist/assets/svg/linkedin.svg +1 -0
- package/dist/assets/svg/twitterx.svg +1 -0
- package/dist/assets/svg/youtube.svg +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +28 -0
- package/dist/utilities/constants.d.ts +6 -0
- package/dist/utilities/constants.js +7 -0
- package/dist/utilities/helpers/getComponentClassName.d.ts +1 -0
- package/dist/utilities/helpers/getComponentClassName.js +27 -0
- package/dist/utilities/hooks/useIsSmallScreen.d.ts +1 -0
- package/dist/utilities/hooks/useIsSmallScreen.js +14 -0
- package/dist/utilities.d.ts +3 -0
- package/dist/utilities.js +3 -0
- package/package.json +123 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
2
|
+
import { AccordionCore } from "../AccordionCore/AccordionCore";
|
3
|
+
import { AccordionTagDateContainer } from "./AccordionTagDateContainer";
|
4
|
+
type AccordionProps = {
|
5
|
+
title: string;
|
6
|
+
subtitle?: string;
|
7
|
+
icon?: ReactNode;
|
8
|
+
value?: string;
|
9
|
+
isTitleFirst?: boolean;
|
10
|
+
} & ComponentProps<typeof AccordionTagDateContainer> & Partial<ComponentProps<typeof AccordionCore>>;
|
11
|
+
export declare const Accordion: ({ title, children, icon, subtitle, tagLabel, tagProps, dateLabel, dateProps, value, isTitleFirst, ...accordionCoreProps }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
12
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
import { AccordionCore } from "../AccordionCore/AccordionCore";
|
4
|
+
import { BREAKPOINT, getComponentClassName, useIsSmallScreen, } from "../utilities";
|
5
|
+
import { AccordionTagDateContainer } from "./AccordionTagDateContainer";
|
6
|
+
export const Accordion = ({ title, children, icon, subtitle, tagLabel, tagProps, dateLabel, dateProps, value, isTitleFirst = true, ...accordionCoreProps }) => {
|
7
|
+
const isMobile = useIsSmallScreen(BREAKPOINT.SM);
|
8
|
+
const isShowingIcon = Boolean(icon && isTitleFirst);
|
9
|
+
const summaryClassName = useMemo(() => getComponentClassName("af-accordion__summary", isTitleFirst ? "title-first" : ""), [isTitleFirst]);
|
10
|
+
return (_jsx(AccordionCore, { summary: _jsxs(_Fragment, { children: [isShowingIcon && isMobile && (_jsx("div", { className: "af-accordion__icon", children: icon })), !isTitleFirst && (_jsx(AccordionTagDateContainer, { tagLabel: tagLabel, dateLabel: dateLabel, tagProps: tagProps, dateProps: dateProps })), _jsxs("div", { className: "af-accordion__title-container", children: [isShowingIcon && !isMobile && (_jsx("div", { className: "af-accordion__icon", children: icon })), _jsx("p", { className: "af-accordion__title", children: title }), subtitle && _jsx("p", { className: "af-accordion__subtitle", children: subtitle })] }), isTitleFirst && (_jsx(AccordionTagDateContainer, { tagLabel: tagLabel, dateLabel: dateLabel, tagProps: tagProps, dateProps: dateProps })), value && _jsx("p", { className: "af-accordion__value", children: value })] }), summaryProps: { className: summaryClassName }, ...accordionCoreProps, children: children }));
|
11
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { type ComponentProps } from "react";
|
2
|
+
import { Tag } from "../Tag";
|
3
|
+
type AccordionTagDateContainerProps = {
|
4
|
+
tagLabel?: string;
|
5
|
+
tagProps?: ComponentProps<typeof Tag>;
|
6
|
+
dateLabel?: string;
|
7
|
+
dateProps?: ComponentProps<"time">;
|
8
|
+
};
|
9
|
+
export declare const AccordionTagDateContainer: ({ tagLabel, tagProps, dateLabel, dateProps, }: AccordionTagDateContainerProps) => import("react/jsx-runtime").JSX.Element | null;
|
10
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
import { Tag } from "../Tag";
|
4
|
+
export const AccordionTagDateContainer = ({ tagLabel, tagProps, dateLabel, dateProps, }) => {
|
5
|
+
const isShowing = useMemo(() => Boolean(tagLabel) || Boolean(dateLabel), [tagLabel, dateLabel]);
|
6
|
+
if (!isShowing) {
|
7
|
+
return null;
|
8
|
+
}
|
9
|
+
return (_jsxs("div", { className: "af-accordion__tag-date-container", children: [tagLabel && (_jsx("div", { className: "af-accordion__tag-container", children: _jsx(Tag, { classModifier: "warning", ...tagProps, children: tagLabel }) })), dateLabel && (_jsx("time", { className: "af-accordion__date", ...dateProps, children: dateLabel }))] }));
|
10
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { type ComponentProps, type MouseEvent, type ReactNode } from "react";
|
2
|
+
type AccordionProps = {
|
3
|
+
summary: ReactNode;
|
4
|
+
children: ReactNode;
|
5
|
+
isOpen?: boolean;
|
6
|
+
className?: string;
|
7
|
+
classModifier?: string;
|
8
|
+
summaryProps?: ComponentProps<"summary">;
|
9
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
10
|
+
} & Partial<ComponentProps<"details">>;
|
11
|
+
export declare const AccordionCore: ({ summary, children, className, classModifier, summaryProps, isOpen, onClick, ...detailsProps }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
12
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useMemo, } from "react";
|
3
|
+
import { getComponentClassName } from "../utilities";
|
4
|
+
export const AccordionCore = ({ summary, children, className, classModifier, summaryProps, isOpen, onClick, ...detailsProps }) => {
|
5
|
+
const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-accordion"), [classModifier, className]);
|
6
|
+
const handleToggle = useCallback((event) => {
|
7
|
+
if (onClick) {
|
8
|
+
event.preventDefault();
|
9
|
+
onClick(event);
|
10
|
+
}
|
11
|
+
}, [onClick]);
|
12
|
+
return (_jsxs("details", { className: componentClassName, open: isOpen, ...detailsProps, children: [_jsx("summary", { className: "af-accordion__summary", onClick: handleToggle, role: "button", tabIndex: 0, ...summaryProps, children: summary }), _jsx("hr", { className: "af-accordion__separator" }), _jsx("div", { className: "af-accordion__content", children: children })] }));
|
13
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { ComponentPropsWithoutRef, PropsWithChildren, ReactElement } from "react";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Alert/Alert.scss";
|
3
|
+
import { Link } from "../Link/Link";
|
4
|
+
import { ButtonClient } from "../Button/Button";
|
5
|
+
type Headings = "h2" | "h3" | "h4" | "h5" | "h6";
|
6
|
+
export declare const alertTypes: {
|
7
|
+
readonly validation: "validation";
|
8
|
+
readonly error: "error";
|
9
|
+
readonly warning: "warning";
|
10
|
+
readonly information: "information";
|
11
|
+
readonly neutral: "neutral";
|
12
|
+
};
|
13
|
+
export type AlertType = keyof typeof alertTypes;
|
14
|
+
type AlertProps = {
|
15
|
+
type: AlertType;
|
16
|
+
title?: string;
|
17
|
+
action?: ReactElement<typeof Link | typeof ButtonClient>;
|
18
|
+
iconSize?: number;
|
19
|
+
heading?: Headings;
|
20
|
+
} & ComponentPropsWithoutRef<"div">;
|
21
|
+
export declare const Alert: ({ type, title, children, action, iconSize, heading: Heading, }: PropsWithChildren<AlertProps>) => import("react/jsx-runtime").JSX.Element;
|
22
|
+
export {};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo, } from "react";
|
3
|
+
import wbIncandescentOutlined from "@material-symbols/svg-400/outlined/wb_incandescent.svg";
|
4
|
+
import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
|
5
|
+
import errorIcon from "@material-symbols/svg-400/outlined/emergency_home.svg";
|
6
|
+
import errorOutline from "@material-symbols/svg-400/outlined/error.svg";
|
7
|
+
import checkCircleOutline from "@material-symbols/svg-400/outlined/check_circle.svg";
|
8
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Alert/Alert.scss";
|
9
|
+
import { Svg } from "../Svg";
|
10
|
+
export const alertTypes = {
|
11
|
+
validation: "validation",
|
12
|
+
error: "error",
|
13
|
+
warning: "warning",
|
14
|
+
information: "information",
|
15
|
+
neutral: "neutral",
|
16
|
+
};
|
17
|
+
const getIconFromType = (type) => ({
|
18
|
+
[alertTypes.validation]: checkCircleOutline,
|
19
|
+
[alertTypes.error]: errorIcon,
|
20
|
+
[alertTypes.neutral]: infoIcon,
|
21
|
+
[alertTypes.warning]: errorOutline,
|
22
|
+
[alertTypes.information]: wbIncandescentOutlined,
|
23
|
+
})[type] || wbIncandescentOutlined;
|
24
|
+
export const Alert = ({ type = alertTypes.information, title, children, action, iconSize = 24, heading: Heading = "h4", }) => {
|
25
|
+
const icon = useMemo(() => getIconFromType(type), [type]);
|
26
|
+
return (_jsxs("div", { className: `af-alert af-alert--${type}`, role: "alert", children: [_jsx(Svg, { src: icon, width: iconSize, height: iconSize, className: "af-alert__icon", "aria-hidden": true }), _jsxs("div", { className: "af-alert-client__content", children: [title && _jsx(Heading, { className: "af-alert__title", children: title }), children, action && _jsx("p", { className: "af-alert__action", children: action })] })] }));
|
27
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Button/Button.scss";
|
2
|
+
import { ComponentPropsWithoutRef, PropsWithChildren, ReactNode } from "react";
|
3
|
+
export declare enum Variants {
|
4
|
+
primary = "primary",
|
5
|
+
business = "primary-business",
|
6
|
+
secondary = "secondary",
|
7
|
+
secondaryError = "secondary-error",
|
8
|
+
tertiary = "tertiary",
|
9
|
+
ghost = "ghost"
|
10
|
+
}
|
11
|
+
type ButtonProps = {
|
12
|
+
variant?: Variants;
|
13
|
+
iconLeft?: ReactNode;
|
14
|
+
iconRight?: ReactNode;
|
15
|
+
} & ComponentPropsWithoutRef<"button">;
|
16
|
+
export declare const ButtonClient: ({ children, className, disabled, variant, iconLeft, iconRight, ...args }: PropsWithChildren<ButtonProps>) => import("react/jsx-runtime").JSX.Element;
|
17
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Button/Button.scss";
|
3
|
+
import classNames from "classnames";
|
4
|
+
export var Variants;
|
5
|
+
(function (Variants) {
|
6
|
+
Variants["primary"] = "primary";
|
7
|
+
Variants["business"] = "primary-business";
|
8
|
+
Variants["secondary"] = "secondary";
|
9
|
+
Variants["secondaryError"] = "secondary-error";
|
10
|
+
Variants["tertiary"] = "tertiary";
|
11
|
+
Variants["ghost"] = "ghost";
|
12
|
+
})(Variants || (Variants = {}));
|
13
|
+
export const ButtonClient = ({ children, className, disabled, variant, iconLeft, iconRight, ...args }) => {
|
14
|
+
return (_jsxs("button", { className: classNames("af-btn-client", variant && `af-btn-client--${variant.toString()}`, className), disabled: disabled, type: "button", ...args, children: [iconLeft, children, iconRight] }));
|
15
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type ComponentProps } from "react";
|
2
|
+
type CardProps = ComponentProps<"section"> & ComponentProps<"button"> & {
|
3
|
+
classModifier?: string;
|
4
|
+
};
|
5
|
+
export declare const Card: ({ children, className, classModifier, onClick, ...otherProps }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
6
|
+
export {};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
import { getComponentClassName } from "../utilities";
|
4
|
+
export const Card = ({ children, className, classModifier, onClick, ...otherProps }) => {
|
5
|
+
const componentClassName = useMemo(() => getComponentClassName(className, classModifier, "af-card"), [className, classModifier]);
|
6
|
+
const Component = useMemo(() => (onClick ? "button" : "section"), [onClick]);
|
7
|
+
const componentProps = useMemo(() => (onClick ? { type: "button", onClick } : { tabIndex: 0 }), [onClick]);
|
8
|
+
return (_jsx(Component, { className: componentClassName, ...componentProps, ...otherProps, children: children }));
|
9
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
|
2
|
+
import React, { ReactNode } from "react";
|
3
|
+
declare const Checkbox: React.ForwardRefExoticComponent<{
|
4
|
+
label: string | ReactNode;
|
5
|
+
errorMessage?: string;
|
6
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "label"> & React.RefAttributes<HTMLInputElement>>;
|
7
|
+
export { Checkbox };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
|
3
|
+
import checkBoxIcon from "@material-symbols/svg-400/outlined/check_box-fill.svg";
|
4
|
+
import checkBoxOutlineBlankIcon from "@material-symbols/svg-400/outlined/check_box_outline_blank.svg";
|
5
|
+
import errorOutline from "@material-symbols/svg-400/outlined/error.svg";
|
6
|
+
import { forwardRef, useId } from "react";
|
7
|
+
import classNames from "classnames";
|
8
|
+
import { Svg } from "../../Svg";
|
9
|
+
const Checkbox = forwardRef(({ label, errorMessage, className, ...inputProps }, ref) => {
|
10
|
+
let inputId = useId();
|
11
|
+
inputId = inputProps.id || inputId;
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: classNames("af-checkbox", className), children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "checkbox", id: inputId, "aria-invalid": !!errorMessage }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), label] }, inputProps.name) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
|
13
|
+
});
|
14
|
+
Checkbox.displayName = "Checkbox";
|
15
|
+
export { Checkbox };
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
|
2
|
+
import React, { ReactNode } from "react";
|
3
|
+
type CheckboxProps = {
|
4
|
+
type: "vertical" | "horizontal";
|
5
|
+
options: ({
|
6
|
+
label: ReactNode;
|
7
|
+
subtitle?: ReactNode;
|
8
|
+
description?: ReactNode;
|
9
|
+
icon?: ReactNode;
|
10
|
+
} & React.InputHTMLAttributes<HTMLInputElement>)[];
|
11
|
+
errorMessage?: string;
|
12
|
+
onChange?: React.ChangeEventHandler;
|
13
|
+
};
|
14
|
+
export declare const CheckboxSelect: ({ options, errorMessage, onChange, type, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Checkbox/Checkbox.scss";
|
3
|
+
import checkBoxIcon from "@material-symbols/svg-400/outlined/check_box-fill.svg";
|
4
|
+
import checkBoxOutlineBlankIcon from "@material-symbols/svg-400/outlined/check_box_outline_blank.svg";
|
5
|
+
import errorOutline from "@material-symbols/svg-400/outlined/error.svg";
|
6
|
+
import { Svg } from "../../Svg";
|
7
|
+
export const CheckboxSelect = ({ options, errorMessage, onChange, type = "vertical", }) => (_jsxs(_Fragment, { children: [_jsx("div", { role: "group", className: `af-checkbox af-checkbox-select af-checkbox-select--${type}`, children: options.map(({ label, description, subtitle, icon, ...inputProps }) => (_jsxs("label", { htmlFor: `id-${inputProps.name}`, children: [_jsx("input", { type: "checkbox", ...inputProps, id: `id-${inputProps.name}`, onChange: onChange, "aria-invalid": Boolean(errorMessage) && !inputProps.disabled }), _jsxs("div", { className: "af-checkbox__icons", children: [_jsx(Svg, { src: checkBoxOutlineBlankIcon, className: "af-checkbox__unchecked" }), _jsx(Svg, { src: checkBoxIcon, className: "af-checkbox__checked" })] }), _jsxs("div", { className: "af-checkbox__content", children: [icon, _jsxs("div", { className: "af-checkbox__content-description", children: [_jsx("span", { children: label }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputProps.name))) }), errorMessage && (_jsxs("div", { className: "af-checkbox__error", "aria-live": "assertive", children: [_jsx(Svg, { src: errorOutline }), errorMessage] }))] }));
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { ComponentPropsWithRef } from "react";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/FileUpload/FileUpload.scss";
|
3
|
+
type Props = Omit<ComponentPropsWithRef<"input">, "required"> & {
|
4
|
+
id: string;
|
5
|
+
label?: string;
|
6
|
+
buttonLabel?: string;
|
7
|
+
dropzoneDescription?: string;
|
8
|
+
instructions?: string;
|
9
|
+
required?: boolean;
|
10
|
+
globalError: string;
|
11
|
+
errors: Array<{
|
12
|
+
id?: string | undefined;
|
13
|
+
message: string;
|
14
|
+
}>;
|
15
|
+
files: Array<{
|
16
|
+
id: string;
|
17
|
+
name: string;
|
18
|
+
size: number;
|
19
|
+
isLoading: boolean;
|
20
|
+
}>;
|
21
|
+
accept: string;
|
22
|
+
isMobile?: boolean;
|
23
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
24
|
+
onDrop?: (event: React.DragEvent<HTMLDivElement>) => void;
|
25
|
+
onView?: (id: string) => void;
|
26
|
+
onDelete?: (id: string) => void;
|
27
|
+
};
|
28
|
+
declare const FileUpload: {
|
29
|
+
({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, onView, onDelete, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
30
|
+
displayName: string;
|
31
|
+
};
|
32
|
+
export { FileUpload };
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/FileUpload/FileUpload.scss";
|
3
|
+
import visibility from "@material-symbols/svg-400/outlined/visibility-fill.svg";
|
4
|
+
import close from "@material-symbols/svg-400/outlined/close-fill.svg";
|
5
|
+
import check from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
|
6
|
+
import error from "@material-symbols/svg-400/outlined/error-fill.svg";
|
7
|
+
import errorO from "@material-symbols/svg-400/outlined/error.svg";
|
8
|
+
import plus from "@material-symbols/svg-400/outlined/add_circle-fill.svg";
|
9
|
+
import classNames from "classnames";
|
10
|
+
import { Svg } from "../../Svg";
|
11
|
+
import { Loader } from "../../Loader";
|
12
|
+
import { Button } from "../..";
|
13
|
+
import { Variants } from "../../Button/Button";
|
14
|
+
import { InputError } from "../InputError";
|
15
|
+
function getReadableFileSizeString(fileSizeInBytes) {
|
16
|
+
let i = -1;
|
17
|
+
let fileSizeInBytesCopy = fileSizeInBytes;
|
18
|
+
const byteUnits = [" Ko", " Mo", " Go"];
|
19
|
+
do {
|
20
|
+
fileSizeInBytesCopy /= 1024;
|
21
|
+
i += 1;
|
22
|
+
} while (fileSizeInBytesCopy > 1024);
|
23
|
+
return Math.max(fileSizeInBytesCopy, 0.1).toFixed(1) + byteUnits[i];
|
24
|
+
}
|
25
|
+
const FileUpload = ({ id, label, buttonLabel, instructions, dropzoneDescription, required, files, errors, globalError, isMobile, onView, onDelete, ...otherProps }) => {
|
26
|
+
const getIcon = (isInError, isLoading) => {
|
27
|
+
if (isInError) {
|
28
|
+
return (_jsx(Svg, { src: error, className: "af-form__file-title-container-icon-error" }));
|
29
|
+
}
|
30
|
+
if (isLoading) {
|
31
|
+
return _jsx(Loader, { size: 18, border: 2 });
|
32
|
+
}
|
33
|
+
return (_jsx(Svg, { src: check, className: "af-form__file-title-container-icon-success" }));
|
34
|
+
};
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsxs("label", { className: "af-form__group--label", htmlFor: id, children: [label, " ", required ? "*" : ""] }), _jsxs("div", { className: classNames("af-form__file-input", globalError && "af-form__file-input--error", (isMobile || !dropzoneDescription) && "is-mobile"), children: [_jsx("input", { type: "file", name: "file-input", id: id, ...otherProps }), dropzoneDescription && (_jsxs("div", { className: "af-form__file-input-dropdown-text", children: [_jsx("p", { children: dropzoneDescription }), _jsx("p", { children: "ou" })] })), _jsx(Button, { variant: Variants.tertiary, onClick: () => document.getElementById(id)?.click(), iconLeft: _jsx(Svg, { src: plus, className: "af-form__file-input-icon" }), children: buttonLabel })] }), globalError && _jsx(InputError, { message: globalError }), _jsx("small", { className: "af-form__file-input-help", children: instructions }), _jsx("div", { className: "custom-table-file af-file-table", children: _jsx("ul", { className: "af-form__file-list", children: files.map(({ id: fileId, name, size, isLoading }) => {
|
36
|
+
const effectiveSize = getReadableFileSizeString(size);
|
37
|
+
const isInError = errors.some((fileError) => fileError.id === fileId);
|
38
|
+
const errorMessage = errors.find((fileError) => fileError.id === fileId)?.message;
|
39
|
+
return (_jsxs("li", { className: "af-form__file-line", children: [_jsxs("div", { className: `af-form__file-line-container ${isInError ? "af-form__file-line-container--error" : ""}`, children: [_jsxs("div", { className: "af-form__file-title", children: [getIcon(isInError, isLoading), _jsxs("div", { children: [_jsx("span", { className: "af-form__file-name", children: name }), _jsx("span", { className: "af-form__file-size", children: effectiveSize })] })] }), _jsxs("div", { className: "af-form__file-actions", children: [onView && (_jsx(Svg, { tabIndex: 0, role: "button", "aria-label": "Visualiser", onClick: () => onView(fileId), onKeyDown: (e) => {
|
40
|
+
if (e.key === "Enter") {
|
41
|
+
onView(fileId);
|
42
|
+
}
|
43
|
+
}, className: "af-form__file-actions-icon", src: visibility })), onDelete && (_jsx(Svg, { tabIndex: 0, role: "button", "aria-label": "Supprimer", onClick: () => onDelete(fileId), onKeyDown: (e) => {
|
44
|
+
if (e.key === "Enter") {
|
45
|
+
onDelete(fileId);
|
46
|
+
}
|
47
|
+
}, className: "af-form__file-actions-icon", src: close }))] })] }), isInError && (_jsxs("small", { className: "af-form__file-error", children: [_jsx(Svg, { src: errorO, className: "af-form__file-error-icon", width: 18 }), errorMessage] }))] }, fileId));
|
48
|
+
}) }) })] }));
|
49
|
+
};
|
50
|
+
FileUpload.displayName = "FileUpload";
|
51
|
+
export { FileUpload };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { FileUpload } from "./FileUpload";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { FileUpload } from "./FileUpload";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/InputError/InputError.scss";
|
2
|
+
type InputErrorProps = {
|
3
|
+
message: string;
|
4
|
+
id?: string;
|
5
|
+
};
|
6
|
+
export declare const InputError: ({ message, id }: InputErrorProps) => import("react/jsx-runtime").JSX.Element;
|
7
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import errorIcon from "@material-symbols/svg-400/outlined/error.svg";
|
3
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/InputError/InputError.scss";
|
4
|
+
import { Svg } from "../../Svg";
|
5
|
+
export const InputError = ({ message, id }) => (_jsxs("div", { className: "af-input-error", children: [_jsx(Svg, { src: errorIcon, className: "af-input-error__icon" }), _jsx("span", { id: id, "aria-live": "assertive", className: "af-input-error__message", children: message })] }));
|
@@ -0,0 +1 @@
|
|
1
|
+
export { InputError } from "./InputError";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { InputError } from "./InputError";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
|
2
|
+
import React, { ReactNode } from "react";
|
3
|
+
declare const Radio: React.ForwardRefExoticComponent<{
|
4
|
+
label: string | ReactNode;
|
5
|
+
errorMessage?: string;
|
6
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
7
|
+
export { Radio };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
|
3
|
+
import radioIcon from "@material-symbols/svg-400/outlined/radio_button_checked.svg";
|
4
|
+
import radioOutlineBlankIcon from "@material-symbols/svg-400/outlined/radio_button_unchecked.svg";
|
5
|
+
import { forwardRef, useId } from "react";
|
6
|
+
import { Svg } from "../../Svg";
|
7
|
+
import { InputError } from "../InputError";
|
8
|
+
const Radio = forwardRef(({ label, errorMessage, ...inputProps }, ref) => {
|
9
|
+
let inputId = useId();
|
10
|
+
inputId = inputProps.id || inputId;
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "af-radio", role: "radiogroup", "aria-invalid": Boolean(errorMessage), children: _jsxs("label", { htmlFor: inputId, children: [_jsx("input", { ref: ref, ...inputProps, type: "radio", id: inputId }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), label] }, inputProps.name) }), errorMessage && _jsx(InputError, { message: errorMessage })] }));
|
12
|
+
});
|
13
|
+
Radio.displayName = "Radio";
|
14
|
+
export { Radio };
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
|
2
|
+
import React, { ComponentPropsWithRef, ReactNode } from "react";
|
3
|
+
type RadioSelectProps = {
|
4
|
+
type: "vertical" | "horizontal";
|
5
|
+
label?: string;
|
6
|
+
isRequired?: boolean;
|
7
|
+
options: ({
|
8
|
+
label: ReactNode;
|
9
|
+
subtitle?: ReactNode;
|
10
|
+
description?: ReactNode;
|
11
|
+
icon?: ReactNode;
|
12
|
+
} & React.InputHTMLAttributes<HTMLInputElement>)[];
|
13
|
+
name: string;
|
14
|
+
errorMessage?: string;
|
15
|
+
onChange?: React.ChangeEventHandler;
|
16
|
+
value?: string;
|
17
|
+
isDisabled?: boolean;
|
18
|
+
} & Omit<ComponentPropsWithRef<"div">, "className" | "aria-invalid">;
|
19
|
+
export declare const RadioSelect: React.ForwardRefExoticComponent<Omit<RadioSelectProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
20
|
+
export {};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Radio/Radio.scss";
|
3
|
+
import radioIcon from "@material-symbols/svg-400/outlined/radio_button_checked.svg";
|
4
|
+
import radioOutlineBlankIcon from "@material-symbols/svg-400/outlined/radio_button_unchecked.svg";
|
5
|
+
import { forwardRef, useId, } from "react";
|
6
|
+
import { Svg } from "../../Svg";
|
7
|
+
import { InputError } from "../InputError";
|
8
|
+
export const RadioSelect = forwardRef(({ id, label, options, errorMessage, onChange, type = "vertical", name, value, isDisabled, isRequired, ...rest }, ref) => {
|
9
|
+
const generatedId = useId();
|
10
|
+
const optionId = id || generatedId;
|
11
|
+
return (_jsxs("div", { className: "af-radio__container", children: [label && (_jsxs("span", { className: "af-radio__label", id: optionId, children: [label, isRequired && _jsx("span", { "aria-hidden": "true", children: "\u00A0*" })] })), _jsx("div", { ref: ref, ...rest, role: "radiogroup", className: `af-radio af-radio-select af-radio-select--${type}`, "aria-invalid": Boolean(errorMessage), "aria-labelledby": optionId, "aria-describedby": errorMessage ? `${optionId}-error` : undefined, children: options.map(({ label: inputLabel, description, subtitle, icon, disabled: inputDisabled, ...inputProps }) => (_jsxs("label", { htmlFor: `${optionId}-${inputLabel}`, children: [_jsx("input", { type: "radio", ...(isDisabled || inputDisabled ? { disabled: true } : null), ...inputProps, name: name, id: `${optionId}-${inputLabel}`, onChange: onChange, ...(value && {
|
12
|
+
"aria-checked": value === inputProps.value,
|
13
|
+
checked: value === inputProps.value,
|
14
|
+
}) }), _jsxs("div", { className: "af-radio__icons", children: [_jsx(Svg, { src: radioOutlineBlankIcon, className: "af-radio__unchecked" }), _jsx(Svg, { src: radioIcon, className: "af-radio__checked" })] }), _jsxs("div", { className: "af-radio__content", children: [icon, _jsxs("div", { className: "af-radio__content-description", children: [_jsx("span", { children: inputLabel }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }, inputLabel))) }), errorMessage && (_jsx(InputError, { id: `${optionId}-error`, message: errorMessage }))] }));
|
15
|
+
});
|
16
|
+
RadioSelect.displayName = "RadioSelect";
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
import { components } from "react-select";
|
4
|
+
const CustomOption = ({ getValue, ...otherProps }) => {
|
5
|
+
const value = useMemo(() => getValue(), [getValue]);
|
6
|
+
return (_jsx(components.Option, { ...otherProps, getValue: getValue, "data-value": value }));
|
7
|
+
};
|
8
|
+
export { CustomOption };
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import arrowDropDown from "@material-symbols/svg-400/outlined/arrow_drop_down.svg";
|
3
|
+
import arrowDropUp from "@material-symbols/svg-400/outlined/arrow_drop_up.svg";
|
4
|
+
import { components } from "react-select";
|
5
|
+
import classNames from "classnames";
|
6
|
+
import { Svg } from "../../Svg";
|
7
|
+
const DropdownIndicator = (props) => {
|
8
|
+
const { selectProps: { menuIsOpen, isDisabled }, } = props;
|
9
|
+
return (_jsx(components.DropdownIndicator, { ...props, children: _jsx(Svg, { src: menuIsOpen ? arrowDropUp : arrowDropDown, className: classNames(isDisabled && "af-form__input-select-container-icon-disabled") }) }));
|
10
|
+
};
|
11
|
+
export { DropdownIndicator };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Select/Select.scss";
|
2
|
+
import ReactSelect, { ActionMeta, SingleValue } from "react-select";
|
3
|
+
import { ComponentPropsWithoutRef, PropsWithChildren } from "react";
|
4
|
+
type Option = {
|
5
|
+
label: string;
|
6
|
+
value: string | number;
|
7
|
+
};
|
8
|
+
type Props = Omit<ComponentPropsWithoutRef<ReactSelect>, "placeholder" | "noOptionsMessage"> & {
|
9
|
+
id: string;
|
10
|
+
label: string;
|
11
|
+
options: {
|
12
|
+
label: string;
|
13
|
+
value?: string | number | readonly string[];
|
14
|
+
}[];
|
15
|
+
value: Option | null;
|
16
|
+
errorLabel?: string;
|
17
|
+
placeholder?: string;
|
18
|
+
noOptionsMessage?: string;
|
19
|
+
onChange: (newValue: SingleValue<Option>, actionMeta: ActionMeta<string>) => void;
|
20
|
+
disabled?: boolean;
|
21
|
+
required?: boolean;
|
22
|
+
};
|
23
|
+
declare const Select: {
|
24
|
+
({ id, required, disabled, label, errorLabel, noOptionsMessage, ...otherProps }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
25
|
+
displayName: string;
|
26
|
+
};
|
27
|
+
export { Select };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Select/Select.scss";
|
3
|
+
import ErrorOutline from "@material-symbols/svg-400/outlined/error.svg";
|
4
|
+
import ReactSelect from "react-select";
|
5
|
+
import classNames from "classnames";
|
6
|
+
import { DropdownIndicator } from "./DropdownIndicator";
|
7
|
+
import { Svg } from "../../Svg";
|
8
|
+
import { CustomOption } from "./CustomOption";
|
9
|
+
const Select = ({ id, required, disabled, label, errorLabel, noOptionsMessage, ...otherProps }) => {
|
10
|
+
return (_jsxs(_Fragment, { children: [label && (_jsxs("label", { id: `${id}__label`, htmlFor: `${id}__input`, className: "af-form__select-label", children: [label, required && _jsx("span", { children: " *" })] })), _jsx(ReactSelect, { inputId: `${id}__input`, "aria-labelledby": `${id}__label`, unstyled: true, isDisabled: disabled, noOptionsMessage: () => noOptionsMessage || "Aucun résultat", components: {
|
11
|
+
DropdownIndicator,
|
12
|
+
Option: CustomOption,
|
13
|
+
}, classNames: {
|
14
|
+
control: () => "af-form__input-select",
|
15
|
+
menu: () => "af-form__input-select-menu",
|
16
|
+
menuList: () => "af-form__select-menu-list",
|
17
|
+
container: ({ isFocused, isDisabled, selectProps: { menuIsOpen }, }) => classNames("af-form__input-select-container", isFocused && "af-form__input-select-container-focused", isDisabled && "af-form__input-select-container-disabled", errorLabel &&
|
18
|
+
!isFocused &&
|
19
|
+
!menuIsOpen &&
|
20
|
+
"af-form__input-select-container-error"),
|
21
|
+
option: ({ isSelected, isFocused, }) => classNames("af-form__input-select-menu-options", isSelected && "af-form__input-select-menu-options-selected", isFocused && "af-form__input-select-menu-options-focused"),
|
22
|
+
singleValue: ({ isDisabled, }) => classNames("af-form__select-single-value", isDisabled && "af-form__select-single-value-disabled"),
|
23
|
+
dropdownIndicator: () => "af-form__select-dropdown-indicator",
|
24
|
+
}, className: "af-form__input-select", ...otherProps }), errorLabel && (_jsxs("div", { className: "af-form__select-error", children: [_jsx(Svg, { src: ErrorOutline, width: 16, className: "af-form__select-error-icon" }), errorLabel] }))] }));
|
25
|
+
};
|
26
|
+
Select.displayName = "Select";
|
27
|
+
export { Select };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Select } from "./Select";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Select } from "./Select";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Text/Text.scss";
|
2
|
+
import { ComponentPropsWithRef, MouseEventHandler } from "react";
|
3
|
+
type Props = ComponentPropsWithRef<"input"> & {
|
4
|
+
classModifier?: string;
|
5
|
+
helper?: string;
|
6
|
+
error?: string;
|
7
|
+
description?: string;
|
8
|
+
label?: string;
|
9
|
+
buttonLabel?: string;
|
10
|
+
onButtonClick?: MouseEventHandler<HTMLButtonElement>;
|
11
|
+
};
|
12
|
+
declare const Text: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
13
|
+
export { Text };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import "@axa-fr/design-system-look-and-feel-css/dist/Form/Text/Text.scss";
|
3
|
+
import { forwardRef } from "react";
|
4
|
+
import infoIcon from "@material-symbols/svg-400/outlined/info.svg";
|
5
|
+
import { Button } from "../..";
|
6
|
+
import { Variants } from "../../Button/Button";
|
7
|
+
import { Svg } from "../../Svg";
|
8
|
+
import { getComponentClassName } from "../../utilities";
|
9
|
+
import { InputError } from "../InputError";
|
10
|
+
const Text = forwardRef(({ className, classModifier = "", label, description, helper, error, buttonLabel, onButtonClick, ...otherProps }, inputRef) => {
|
11
|
+
const componentClassName = getComponentClassName(className, classModifier, "af-form__input-text");
|
12
|
+
const { id, required } = otherProps;
|
13
|
+
return (_jsxs("div", { className: "af-form__input-container", children: [_jsxs("label", { htmlFor: id, className: "af-form__input-label", children: [label, " ", required && _jsx("span", { children: " *" })] }), description && (_jsx("span", { className: "af-form__input-description", children: description })), buttonLabel && (_jsx(Button, { className: "af-form__input-more", variant: Variants.ghost, iconLeft: _jsx(Svg, { src: infoIcon }), onClick: onButtonClick, children: buttonLabel })), _jsx("input", { className: componentClassName, type: "text", ref: inputRef, "aria-invalid": Boolean(error), "aria-describedby": error ? `${id}-error` : undefined, ...otherProps }), helper && _jsx("span", { className: "af-form__input-helper", children: helper }), error && _jsx(InputError, { id: `${id}-error`, message: error })] }));
|
14
|
+
});
|
15
|
+
Text.displayName = "Text";
|
16
|
+
export { Text };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Text } from "./Text";
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Text } from "./Text";
|