@axa-fr/canopee-react 2.0.0-alpha.74 → 2.0.0-alpha.76
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/distributeur/Accordion/Accordion.d.ts +1 -3
- package/dist/distributeur/Accordion/Accordion.js +2 -5
- package/dist/distributeur/Accordion/CollapseCard.d.ts +1 -3
- package/dist/distributeur/Accordion/CollapseCard.js +2 -4
- package/dist/distributeur/Accordion/Header.d.ts +1 -3
- package/dist/distributeur/Accordion/Header.js +1 -2
- package/dist/distributeur/Action/Action.d.ts +1 -3
- package/dist/distributeur/Action/Action.js +2 -3
- package/dist/distributeur/Form/Checkbox/Checkbox.d.ts +1 -1
- package/dist/distributeur/Form/Checkbox/Checkbox.js +9 -4
- package/dist/distributeur/Form/Checkbox/CheckboxInput.js +2 -2
- package/dist/distributeur/Form/Checkbox/CheckboxItem.d.ts +1 -3
- package/dist/distributeur/Form/Checkbox/CheckboxItem.js +2 -2
- package/dist/distributeur/Form/Choice/Choice.d.ts +0 -2
- package/dist/distributeur/Form/Choice/ChoiceInput.js +1 -1
- package/dist/distributeur/Form/Date/Date.d.ts +2 -3
- package/dist/distributeur/Form/Date/Date.js +3 -3
- package/dist/distributeur/Form/Date/DateInput.js +1 -1
- package/dist/distributeur/Form/File/File.d.ts +1 -3
- package/dist/distributeur/Form/File/File.js +1 -2
- package/dist/distributeur/Form/File/FileInput.d.ts +3 -1
- package/dist/distributeur/Form/File/FileInput.js +2 -2
- package/dist/distributeur/Form/File/FileLine.d.ts +1 -2
- package/dist/distributeur/Form/File/FileLine.js +6 -3
- package/dist/distributeur/Form/File/FileTable.d.ts +1 -2
- package/dist/distributeur/Form/File/FileTable.js +6 -3
- package/dist/distributeur/Form/MultiSelect/MultiSelectInput.js +1 -1
- package/dist/distributeur/Form/NestedQuestion/NestedQuestion.js +7 -3
- package/dist/distributeur/Form/Number/Number.d.ts +4 -7
- package/dist/distributeur/Form/Number/Number.js +4 -5
- package/dist/distributeur/Form/Number/NumberInput.js +1 -1
- package/dist/distributeur/Form/Radio/Radio.d.ts +1 -1
- package/dist/distributeur/Form/Radio/RadioInput.js +1 -1
- package/dist/distributeur/Form/Radio/RadioItem.d.ts +1 -3
- package/dist/distributeur/Form/Radio/RadioItem.js +2 -2
- package/dist/distributeur/Form/Select/Select.d.ts +3 -19
- package/dist/distributeur/Form/Select/Select.js +3 -4
- package/dist/distributeur/Form/Select/SelectBase.d.ts +3 -24
- package/dist/distributeur/Form/Select/SelectBase.js +2 -7
- package/dist/distributeur/Form/Select/SelectDefault.d.ts +3 -3
- package/dist/distributeur/Form/Select/SelectInput.js +1 -1
- package/dist/distributeur/Form/Select/index.d.ts +0 -1
- package/dist/distributeur/Form/Select/index.js +0 -1
- package/dist/distributeur/Form/Text/Text.d.ts +2 -3
- package/dist/distributeur/Form/Text/Text.js +3 -3
- package/dist/distributeur/Form/Text/TextInput.js +1 -1
- package/dist/distributeur/Form/Textarea/Textarea.d.ts +2 -3
- package/dist/distributeur/Form/Textarea/Textarea.js +3 -3
- package/dist/distributeur/Form/Textarea/TextareaInput.js +1 -1
- package/dist/distributeur/Form/core/Field.d.ts +4 -23
- package/dist/distributeur/Form/core/Field.js +25 -16
- package/dist/distributeur/Form/core/FieldError.js +5 -2
- package/dist/distributeur/Form/core/getOptionClassName.d.ts +1 -1
- package/dist/distributeur/Form/core/getOptionClassName.js +2 -6
- package/dist/distributeur/Form/core/index.d.ts +0 -8
- package/dist/distributeur/Form/core/index.js +0 -4
- package/dist/distributeur/HelpButton/index.d.ts +1 -1
- package/dist/distributeur/HelpButton/index.js +4 -6
- package/dist/distributeur/Layout/Header/Header.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Header.js +1 -2
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.d.ts +1 -2
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.js +7 -4
- package/dist/distributeur/Layout/Header/Infos/Infos.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Infos/Infos.js +1 -2
- package/dist/distributeur/Layout/Header/Name/Name.d.ts +1 -3
- package/dist/distributeur/Layout/Header/Name/Name.js +1 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBar.js +1 -6
- package/dist/distributeur/Layout/Header/NavBar/NavBarBase.d.ts +1 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarBase.js +7 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.d.ts +2 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItem.js +10 -3
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.d.ts +1 -2
- package/dist/distributeur/Layout/Header/NavBar/NavBarItem/NavBarItemBase.js +6 -3
- package/dist/distributeur/Layout/Header/User/User.d.ts +1 -11
- package/dist/distributeur/Layout/Header/User/User.js +1 -2
- package/dist/distributeur/Messages/Message.d.ts +2 -6
- package/dist/distributeur/Messages/Message.js +3 -14
- package/dist/distributeur/ModalAgent/BooleanModal.d.ts +1 -6
- package/dist/distributeur/ModalAgent/BooleanModal.js +7 -4
- package/dist/distributeur/ModalAgent/Modal.d.ts +2 -7
- package/dist/distributeur/ModalAgent/Modal.js +7 -16
- package/dist/distributeur/ModalAgent/components/Body.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/Body.js +1 -2
- package/dist/distributeur/ModalAgent/components/Footer.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/Footer.js +1 -2
- package/dist/distributeur/ModalAgent/components/Header.d.ts +1 -11
- package/dist/distributeur/ModalAgent/components/Header.js +2 -3
- package/dist/distributeur/ModalAgent/components/HeaderBase.d.ts +2 -5
- package/dist/distributeur/ModalAgent/components/HeaderBase.js +1 -2
- package/dist/distributeur/Popover/AnimatedPopover.d.ts +1 -3
- package/dist/distributeur/Popover/AnimatedPopover.js +1 -2
- package/dist/distributeur/Popover/Popover.d.ts +1 -3
- package/dist/distributeur/Popover/Popover.js +2 -2
- package/dist/distributeur/Popover/Popover.types.d.ts +0 -2
- package/dist/distributeur/Popover/PopoverBase.d.ts +1 -3
- package/dist/distributeur/Popover/PopoverBase.js +2 -2
- package/dist/distributeur/Popover/PopoverClick.d.ts +1 -1
- package/dist/distributeur/Popover/PopoverClick.js +2 -2
- package/dist/distributeur/Popover/PopoverOver.d.ts +1 -1
- package/dist/distributeur/Popover/PopoverOver.js +2 -2
- package/dist/distributeur/Restitution/ArticleRestitution.d.ts +2 -5
- package/dist/distributeur/Restitution/ArticleRestitution.js +1 -2
- package/dist/distributeur/Restitution/HeaderRestitution.d.ts +1 -3
- package/dist/distributeur/Restitution/HeaderRestitution.js +1 -2
- package/dist/distributeur/Restitution/Restitution.d.ts +1 -3
- package/dist/distributeur/Restitution/Restitution.js +2 -2
- package/dist/distributeur/Restitution/SectionRestitution.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitution.js +1 -2
- package/dist/distributeur/Restitution/SectionRestitutionColumn.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionColumn.js +1 -2
- package/dist/distributeur/Restitution/SectionRestitutionRow.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionRow.js +5 -9
- package/dist/distributeur/Restitution/SectionRestitutionTitle.d.ts +1 -3
- package/dist/distributeur/Restitution/SectionRestitutionTitle.js +1 -2
- package/dist/distributeur/Steps/Step.d.ts +1 -1
- package/dist/distributeur/Steps/Step.js +4 -4
- package/dist/distributeur/Steps/StepBase.d.ts +1 -3
- package/dist/distributeur/Steps/StepBase.js +1 -2
- package/dist/distributeur/Steps/Steps.d.ts +1 -3
- package/dist/distributeur/Steps/Steps.js +1 -2
- package/dist/distributeur/Summary/index.d.ts +1 -1
- package/dist/distributeur/Summary/index.js +1 -2
- package/dist/distributeur/Table/Pagination/Items.d.ts +1 -2
- package/dist/distributeur/Table/Pagination/Items.js +8 -8
- package/dist/distributeur/Table/Pagination/Pager.d.ts +1 -2
- package/dist/distributeur/Table/Pagination/Pager.js +6 -3
- package/dist/distributeur/Table/Pagination/Paging.d.ts +1 -1
- package/dist/distributeur/Table/Pagination/Paging.js +6 -3
- package/dist/distributeur/Table/TBody.d.ts +1 -5
- package/dist/distributeur/Table/TBody.js +1 -2
- package/dist/distributeur/Table/THead.d.ts +2 -5
- package/dist/distributeur/Table/THead.js +1 -2
- package/dist/distributeur/Table/Table.d.ts +6 -33
- package/dist/distributeur/Table/Table.js +1 -10
- package/dist/distributeur/Table/Td.d.ts +1 -5
- package/dist/distributeur/Table/Td.js +1 -2
- package/dist/distributeur/Table/Th.d.ts +2 -4
- package/dist/distributeur/Table/Th.js +2 -2
- package/dist/distributeur/Table/Tr.d.ts +2 -5
- package/dist/distributeur/Table/Tr.js +1 -2
- package/dist/distributeur/Table/index.d.ts +1 -1
- package/dist/distributeur/Tabs/components/Tab.d.ts +0 -4
- package/dist/distributeur/Tabs/components/TabsStateless.d.ts +3 -7
- package/dist/distributeur/Tabs/components/TabsStateless.js +2 -2
- package/dist/distributeur/Tag/Tag.d.ts +1 -6
- package/dist/distributeur/Tag/Tag.js +2 -2
- package/dist/distributeur/Title/Title.d.ts +1 -3
- package/dist/distributeur/Title/Title.js +2 -2
- package/dist/distributeur/utilities.d.ts +1 -1
- package/dist/distributeur/utilities.js +1 -1
- package/dist/distributeur.d.ts +5 -24
- package/dist/distributeur.js +5 -17
- package/package.json +2 -2
- package/dist/distributeur/Form/Pass/Pass.d.ts +0 -15
- package/dist/distributeur/Form/Pass/Pass.js +0 -13
- package/dist/distributeur/Form/Pass/PassInput.d.ts +0 -13
- package/dist/distributeur/Form/Pass/PassInput.js +0 -34
- package/dist/distributeur/Form/Pass/index.d.ts +0 -2
- package/dist/distributeur/Form/Pass/index.js +0 -2
- package/dist/distributeur/Form/Select/SelectDefaultWithOptions.d.ts +0 -26
- package/dist/distributeur/Form/Select/SelectDefaultWithOptions.js +0 -32
- package/dist/distributeur/Form/Slider/Slider.d.ts +0 -28
- package/dist/distributeur/Form/Slider/Slider.js +0 -40
- package/dist/distributeur/Form/Slider/SliderInput.d.ts +0 -9
- package/dist/distributeur/Form/Slider/SliderInput.js +0 -11
- package/dist/distributeur/Form/Slider/index.d.ts +0 -3
- package/dist/distributeur/Form/Slider/index.js +0 -3
- package/dist/distributeur/Form/core/Deprecated/Field.d.ts +0 -21
- package/dist/distributeur/Form/core/Deprecated/Field.js +0 -20
- package/dist/distributeur/Form/core/Deprecated/FieldForm.d.ts +0 -103
- package/dist/distributeur/Form/core/Deprecated/FieldForm.js +0 -162
- package/dist/distributeur/Form/core/Deprecated/FieldInput.d.ts +0 -16
- package/dist/distributeur/Form/core/Deprecated/FieldInput.js +0 -14
- package/dist/distributeur/Form/core/useInputClassModifier.d.ts +0 -4
- package/dist/distributeur/Form/core/useInputClassModifier.js +0 -13
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.d.ts +0 -1
- package/dist/distributeur/Layout/Header/HeaderTitle/HeaderTitle.helpers.js +0 -6
- package/dist/distributeur/utilities/helpers/getComponentClassName.d.ts +0 -20
- package/dist/distributeur/utilities/helpers/getComponentClassName.js +0 -54
|
@@ -5,10 +5,8 @@ import type { AccordionVariant, TDefaultProps } from "./types";
|
|
|
5
5
|
export type EnhancedProps = Partial<TDefaultProps> & {
|
|
6
6
|
onlyOne?: boolean;
|
|
7
7
|
className?: string;
|
|
8
|
-
/** @deprecated Use `variant` instead. */
|
|
9
|
-
classModifier?: string;
|
|
10
8
|
variant?: AccordionVariant;
|
|
11
9
|
children: React.ReactElement<CollapseProps>[] | React.ReactElement<CollapseProps>;
|
|
12
10
|
};
|
|
13
|
-
declare const Accordion: ({ className,
|
|
11
|
+
declare const Accordion: ({ className, variant, children, onlyOne, }: EnhancedProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
export { Accordion };
|
|
@@ -5,13 +5,10 @@ import React, { useId } from "react";
|
|
|
5
5
|
import { getClassName } from "../utilities/helpers/getClassName";
|
|
6
6
|
import { CollapseCard } from "./CollapseCard";
|
|
7
7
|
const defaultClassName = "af-accordion";
|
|
8
|
-
const Accordion = ({ className,
|
|
8
|
+
const Accordion = ({ className, variant = "default", children, onlyOne = false, }) => {
|
|
9
9
|
const componentClassName = getClassName({
|
|
10
10
|
baseClassName: defaultClassName,
|
|
11
|
-
modifiers: [
|
|
12
|
-
variant !== "default" && variant,
|
|
13
|
-
...(classModifier?.split(" ") ?? []),
|
|
14
|
-
],
|
|
11
|
+
modifiers: [variant !== "default" && variant],
|
|
15
12
|
className,
|
|
16
13
|
});
|
|
17
14
|
const id = useId();
|
|
@@ -8,9 +8,7 @@ export type CollapseProps = {
|
|
|
8
8
|
name?: string;
|
|
9
9
|
onToggle?: DetailsHTMLAttributes<HTMLDetailsElement>["onToggle"];
|
|
10
10
|
className?: string;
|
|
11
|
-
/** @deprecated Use `className` instead. */
|
|
12
|
-
classModifier?: string;
|
|
13
11
|
actions?: AccordionActions;
|
|
14
12
|
variant?: AccordionVariant;
|
|
15
13
|
};
|
|
16
|
-
export declare const CollapseCard: ({ children, name, title, id, open, onToggle, className,
|
|
14
|
+
export declare const CollapseCard: ({ children, name, title, id, open, onToggle, className, actions, variant, }: CollapseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,13 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { getClassName } from "../utilities/helpers/getClassName";
|
|
3
3
|
import { Body } from "./Body";
|
|
4
4
|
import { Header } from "./Header";
|
|
5
|
-
export const CollapseCard = ({ children, name, title, id, open, onToggle, className,
|
|
5
|
+
export const CollapseCard = ({ children, name, title, id, open, onToggle, className, actions, variant, }) => {
|
|
6
6
|
const headerId = id;
|
|
7
|
-
let newClassModifier = open ? "open" : "";
|
|
8
|
-
newClassModifier += ` ${classModifier}`;
|
|
9
7
|
const componentClassName = getClassName({
|
|
10
8
|
baseClassName: "af-accordion__details",
|
|
11
|
-
modifiers:
|
|
9
|
+
modifiers: open ? ["open"] : [],
|
|
12
10
|
className,
|
|
13
11
|
});
|
|
14
12
|
return (_jsxs("details", { open: open, name: name, className: componentClassName, onToggle: onToggle, children: [_jsx(Header, { id: headerId, actions: actions, variant: variant, children: title }), _jsx(Body, { children: children })] }));
|
|
@@ -8,11 +8,9 @@ export type HeaderToggleElement = {
|
|
|
8
8
|
export type HeaderProps = {
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
className?: string;
|
|
11
|
-
/** @deprecated Use `className` instead. */
|
|
12
|
-
classModifier?: string;
|
|
13
11
|
id?: string;
|
|
14
12
|
actions?: AccordionActions;
|
|
15
13
|
variant?: AccordionVariant;
|
|
16
14
|
};
|
|
17
|
-
declare const Header: ({ children, className,
|
|
15
|
+
declare const Header: ({ children, className, id, actions, variant }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
16
|
export { Header };
|
|
@@ -6,10 +6,9 @@ import { Svg } from "../Svg/Svg";
|
|
|
6
6
|
import { Title } from "../Title/Title";
|
|
7
7
|
import { getClassName } from "../utilities/helpers/getClassName";
|
|
8
8
|
const defaultClassName = "af-accordion__item-header";
|
|
9
|
-
const Header = ({ children, className,
|
|
9
|
+
const Header = ({ children, className, id, actions, variant }) => {
|
|
10
10
|
const componentClassName = getClassName({
|
|
11
11
|
baseClassName: defaultClassName,
|
|
12
|
-
modifiers: classModifier?.split(" "),
|
|
13
12
|
className,
|
|
14
13
|
});
|
|
15
14
|
return (_jsx("summary", { className: componentClassName, id: id, children: variant === "light" ? (_jsxs(Title, { heading: "h3", children: [_jsx(Svg, { src: arrow, className: "af-accordion__item-header-icon" }), children, actions
|
|
@@ -2,11 +2,9 @@ import "@axa-fr/canopee-css/distributeur/Action/Action.css";
|
|
|
2
2
|
import { type ComponentPropsWithRef } from "react";
|
|
3
3
|
type ActionCoreProps = ComponentPropsWithRef<"a"> & {
|
|
4
4
|
icon: string;
|
|
5
|
-
/** @deprecated Use `className` instead. */
|
|
6
|
-
classModifier?: string;
|
|
7
5
|
};
|
|
8
6
|
export declare const Action: {
|
|
9
|
-
({ icon, className,
|
|
7
|
+
({ icon, className, ...otherProps }: ActionCoreProps): import("react/jsx-runtime").JSX.Element;
|
|
10
8
|
displayName: string;
|
|
11
9
|
};
|
|
12
10
|
export {};
|
|
@@ -3,12 +3,11 @@ import "@axa-fr/canopee-css/distributeur/Action/Action.css";
|
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import {} from "react";
|
|
5
5
|
import { getClassName } from "../utilities/helpers/getClassName";
|
|
6
|
-
export const Action = ({ icon, className,
|
|
6
|
+
export const Action = ({ icon, className, ...otherProps }) => {
|
|
7
7
|
const componentClassName = classNames("btn", getClassName({
|
|
8
8
|
baseClassName: "af-btn--circle",
|
|
9
|
-
modifiers: classModifier?.split(" "),
|
|
10
9
|
className,
|
|
11
10
|
}));
|
|
12
|
-
return (_jsx("a", { ...otherProps, className: componentClassName, children: _jsx("i", { role: "
|
|
11
|
+
return (_jsx("a", { ...otherProps, className: componentClassName, children: _jsx("i", { role: "presentation", className: `glyphicon glyphicon-${icon}` }) }));
|
|
13
12
|
};
|
|
14
13
|
Action.displayName = "Action";
|
|
@@ -23,7 +23,7 @@ type Props = Omit<ComponentPropsWithRef<typeof CheckboxItem>, "value" | "label"
|
|
|
23
23
|
mode?: keyof typeof CheckboxModes;
|
|
24
24
|
} & OnChange;
|
|
25
25
|
export declare const Checkbox: {
|
|
26
|
-
({ id, name, options, disabled, children, values, mode, onChange, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ id, name, options, disabled, children, values, mode, onChange, className, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
displayName: string;
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
@@ -3,6 +3,7 @@ import { createElement as _createElement } from "react";
|
|
|
3
3
|
import React, {} from "react";
|
|
4
4
|
import { CheckboxItem } from "./CheckboxItem";
|
|
5
5
|
import { CheckboxModes } from "./CheckboxModes";
|
|
6
|
+
import { getClassName } from "../../utilities";
|
|
6
7
|
const defaultClassName = (mode) => {
|
|
7
8
|
switch (mode) {
|
|
8
9
|
case CheckboxModes.default:
|
|
@@ -13,17 +14,21 @@ const defaultClassName = (mode) => {
|
|
|
13
14
|
return `af-form__checkbox-${mode}`;
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
|
-
const CheckboxInner = ({ id, name, options, disabled, children, values = [], mode = CheckboxModes.default, onChange = () => { }, ...otherProps }) => {
|
|
17
|
-
const
|
|
17
|
+
const CheckboxInner = ({ id, name, options, disabled, children, values = [], mode = CheckboxModes.default, onChange = () => { }, className, ...otherProps }) => {
|
|
18
|
+
const itemClassName = defaultClassName(mode);
|
|
19
|
+
const componentClassName = getClassName({
|
|
20
|
+
baseClassName: "af-form__checkbox-container",
|
|
21
|
+
className,
|
|
22
|
+
});
|
|
18
23
|
const handleOnChange = ({ target: { value, checked }, }) => {
|
|
19
24
|
const newValues = checked
|
|
20
25
|
? [...values, value]
|
|
21
26
|
: values.filter((v) => v !== value);
|
|
22
27
|
onChange({ values: newValues, target: { value, checked }, id, name });
|
|
23
28
|
};
|
|
24
|
-
return (_jsx("div", { className:
|
|
29
|
+
return (_jsx("div", { className: componentClassName, children: options.map((option) => {
|
|
25
30
|
const isChecked = values ? values.indexOf(option.value) >= 0 : false;
|
|
26
|
-
return (_createElement(CheckboxItem, { ...otherProps, onChange: handleOnChange, key: option.value, className:
|
|
31
|
+
return (_createElement(CheckboxItem, { ...otherProps, onChange: handleOnChange, key: option.value, className: itemClassName, isChecked: isChecked, name: name, disabled: option.disabled || disabled, ...option }, children));
|
|
27
32
|
}) }));
|
|
28
33
|
};
|
|
29
34
|
CheckboxInner.displayName = "Checkbox";
|
|
@@ -5,8 +5,8 @@ import { Checkbox } from "./Checkbox";
|
|
|
5
5
|
import { CheckboxModes } from "./CheckboxModes";
|
|
6
6
|
const CheckboxInput = ({ label, mode = "default", options, children, ...otherProps }) => {
|
|
7
7
|
const newOptions = useOptionsWithId(options);
|
|
8
|
-
return (_jsx(Field, { label: label, labelPosition: mode === CheckboxModes.classic ? "top" : "center", roleContainer: "group", ...otherProps, renderInput: ({
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(Checkbox, { id: id, mode: mode, options: newOptions,
|
|
8
|
+
return (_jsx(Field, { label: label, labelPosition: mode === CheckboxModes.classic ? "top" : "center", roleContainer: "group", ...otherProps, renderInput: ({ inputClassName, id, ariaInvalid, errorId, ...props }) => {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(Checkbox, { id: id, mode: mode, options: newOptions, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), children] }));
|
|
10
10
|
} }));
|
|
11
11
|
};
|
|
12
12
|
CheckboxInput.displayName = "CheckboxInput";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/Checkbox/Checkbox.css";
|
|
3
3
|
type Props = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
4
|
-
/** @deprecated Use `className` instead. */
|
|
5
|
-
classModifier?: string;
|
|
6
4
|
optionClassName?: string;
|
|
7
5
|
children?: ReactNode;
|
|
8
6
|
label?: ReactNode;
|
|
@@ -10,7 +8,7 @@ type Props = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
|
10
8
|
variant?: "error" | "warning";
|
|
11
9
|
};
|
|
12
10
|
declare const CheckboxItem: {
|
|
13
|
-
({ disabled, value, id, children, label, isChecked, className,
|
|
11
|
+
({ disabled, value, id, children, label, isChecked, className, variant, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
displayName: string;
|
|
15
13
|
};
|
|
16
14
|
export { CheckboxItem };
|
|
@@ -4,11 +4,11 @@ import { useId } from "react";
|
|
|
4
4
|
import { getOptionClassName } from "../core";
|
|
5
5
|
import "@axa-fr/canopee-css/distributeur/Form/Checkbox/Checkbox.css";
|
|
6
6
|
import { Svg } from "../../Svg";
|
|
7
|
-
const CheckboxItem = ({ disabled = false, value = "", id, children, label, isChecked, className,
|
|
7
|
+
const CheckboxItem = ({ disabled = false, value = "", id, children, label, isChecked, className, variant, ...otherProps }) => {
|
|
8
8
|
const newLabel = children || label;
|
|
9
9
|
const generatedId = useId();
|
|
10
10
|
const newId = id ?? generatedId; // id is required on this component
|
|
11
|
-
const optionClassName = getOptionClassName(className ?? "",
|
|
11
|
+
const optionClassName = getOptionClassName(className ?? "", "af-form__checkbox", disabled, variant);
|
|
12
12
|
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-checkbox", value: value, id: newId, disabled: disabled, checked: isChecked, type: "checkbox" }), _jsxs("label", { className: "af-form__label", htmlFor: newId, children: [_jsx("span", { className: "af-form__indicator", children: _jsx(Svg, { role: "presentation", className: "ok-icon", src: check }) }), _jsx("span", { className: "af-form__description", children: newLabel })] })] }));
|
|
13
13
|
};
|
|
14
14
|
CheckboxItem.displayName = "CheckboxItem";
|
|
@@ -8,8 +8,6 @@ type Props = Omit<ComponentPropsWithRef<typeof Radio>, "options" | "value"> & {
|
|
|
8
8
|
value: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
value?: boolean | string;
|
|
11
|
-
/** @deprecated Use `className` instead. */
|
|
12
|
-
classModifier?: string;
|
|
13
11
|
};
|
|
14
12
|
declare const Choice: {
|
|
15
13
|
({ children, value, options, name, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,6 +6,6 @@ const defaultOptions = [
|
|
|
6
6
|
{ label: "Oui", value: true },
|
|
7
7
|
{ label: "Non", value: false },
|
|
8
8
|
];
|
|
9
|
-
const ChoiceInput = ({ label, options = defaultOptions, children, ...otherProps }) => (_jsx(Field, { label: label, roleContainer: "radiogroup", ...otherProps, renderInput: ({
|
|
9
|
+
const ChoiceInput = ({ label, options = defaultOptions, children, ...otherProps }) => (_jsx(Field, { label: label, roleContainer: "radiogroup", ...otherProps, renderInput: ({ inputClassName, id, errorId, ariaInvalid, ...props }) => (_jsxs(_Fragment, { children: [_jsx(Choice, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, options: options, ...props }), children] })) }));
|
|
10
10
|
ChoiceInput.displayName = "ChoiceInput";
|
|
11
11
|
export { ChoiceInput };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Date/Date.css";
|
|
2
2
|
import { type ComponentPropsWithRef } from "react";
|
|
3
3
|
type Props = Omit<ComponentPropsWithRef<"input">, "value"> & {
|
|
4
|
-
/** @deprecated Use `className` and the native `disabled`/`required` props instead. */
|
|
5
|
-
classModifier?: string;
|
|
6
4
|
defaultValue?: Date | string;
|
|
7
5
|
value?: Date | string;
|
|
6
|
+
hasInfobulle?: boolean;
|
|
8
7
|
};
|
|
9
8
|
declare const Date: {
|
|
10
|
-
({ className,
|
|
9
|
+
({ className, defaultValue, value, hasInfobulle, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
displayName: string;
|
|
12
11
|
};
|
|
13
12
|
export { Date };
|
|
@@ -3,13 +3,13 @@ import "@axa-fr/canopee-css/distributeur/Form/Date/Date.css";
|
|
|
3
3
|
import {} from "react";
|
|
4
4
|
import { formatDateInputValue } from "../../utilities/helpers/date";
|
|
5
5
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
6
|
-
const Date = ({ className,
|
|
6
|
+
const Date = ({ className, defaultValue, value, hasInfobulle, ...otherProps }) => {
|
|
7
7
|
const componentClassName = getClassName({
|
|
8
8
|
baseClassName: "af-form__input-date",
|
|
9
|
-
modifiers:
|
|
9
|
+
modifiers: [hasInfobulle && "hasinfobulle"],
|
|
10
10
|
className,
|
|
11
11
|
});
|
|
12
|
-
return (_jsx("input", { className: componentClassName, type: "date", defaultValue: formatDateInputValue(defaultValue), value: formatDateInputValue(value),
|
|
12
|
+
return (_jsx("input", { className: componentClassName, type: "date", defaultValue: formatDateInputValue(defaultValue), value: formatDateInputValue(value), ...otherProps }));
|
|
13
13
|
};
|
|
14
14
|
Date.displayName = "Date";
|
|
15
15
|
export { Date };
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import {} from "react";
|
|
3
3
|
import { Field } from "../core";
|
|
4
4
|
import { Date } from "./Date";
|
|
5
|
-
const DateInput = ({ children, ...otherProps }) => (_jsx(Field, {
|
|
5
|
+
const DateInput = ({ children, ...otherProps }) => (_jsx(Field, { fieldClassNameSuffix: "date", ...otherProps, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...props }) => (_jsxs(_Fragment, { children: [_jsx(Date, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), children] })) }));
|
|
6
6
|
DateInput.displayName = "DateInput";
|
|
7
7
|
export { DateInput };
|
|
@@ -2,8 +2,6 @@ import { type DropzoneInputProps, type DropzoneOptions, type FileRejection } fro
|
|
|
2
2
|
import type { FileActions } from "./constants";
|
|
3
3
|
type Dropzone = DropzoneInputProps & DropzoneOptions;
|
|
4
4
|
type Props = Omit<Dropzone, "onDrop" | "onChange"> & {
|
|
5
|
-
/** @deprecated Use `className` instead. */
|
|
6
|
-
classModifier?: string;
|
|
7
5
|
label?: string;
|
|
8
6
|
icon?: string;
|
|
9
7
|
onChange: (data: onChangeProps) => void;
|
|
@@ -22,5 +20,5 @@ type onChangeProps = {
|
|
|
22
20
|
values: CustomFile[];
|
|
23
21
|
errors?: CustomFile<FileRejection>[];
|
|
24
22
|
};
|
|
25
|
-
declare const File: ({ className,
|
|
23
|
+
declare const File: ({ className, id, name, disabled, onChange, multiple, maxSize, minSize, accept, readOnly, placeholder, label, icon, ...otherProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
26
24
|
export { File };
|
|
@@ -3,7 +3,7 @@ import { useId } from "react";
|
|
|
3
3
|
import { useDropzone, } from "react-dropzone";
|
|
4
4
|
import { Button } from "../../Button/Button";
|
|
5
5
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
6
|
-
const File = ({ className,
|
|
6
|
+
const File = ({ className, id, name, disabled, onChange, multiple = true, maxSize = 20000000, minSize = 0, accept, readOnly, placeholder = "Glissez/déposez vos fichiers", label = "Parcourir", icon = "open", ...otherProps }) => {
|
|
7
7
|
const valueId = useId();
|
|
8
8
|
const errorsId = useId();
|
|
9
9
|
const handleOnChange = (acceptedFiles, rejectedFiles) => {
|
|
@@ -56,7 +56,6 @@ const File = ({ className, classModifier, id, name, disabled, onChange, multiple
|
|
|
56
56
|
});
|
|
57
57
|
const componentClassName = getClassName({
|
|
58
58
|
baseClassName: "af-form__file-input",
|
|
59
|
-
modifiers: classModifier?.split(" "),
|
|
60
59
|
className,
|
|
61
60
|
});
|
|
62
61
|
return (_jsxs("div", { className: componentClassName, children: [_jsxs("div", { ...getRootProps({ className: "drop-box" }), children: [_jsx("input", { ...getInputProps({ id, name, readOnly, ...otherProps }) }), _jsx("div", { children: placeholder })] }), _jsx(Button, { className: "af-btn--file", leftIcon: _jsx("i", { className: `glyphicon glyphicon-${icon}` }), onClick: open, disabled: disabled, children: label })] }));
|
|
@@ -8,6 +8,8 @@ type FileTableProps = ComponentPropsWithoutRef<typeof FileTable>;
|
|
|
8
8
|
type Props = ConsumerFieldProps & FileProps & Pick<FileTableProps, "values" | "errors"> & {
|
|
9
9
|
fileLabel?: string;
|
|
10
10
|
helpMessage?: ReactNode;
|
|
11
|
+
} & {
|
|
12
|
+
tableClassName?: string;
|
|
11
13
|
};
|
|
12
|
-
declare const FileInput: ({ values, id, name, onChange, label, errors, fileLabel,
|
|
14
|
+
declare const FileInput: ({ values, id, name, onChange, label, errors, fileLabel, children, ...otherFileProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export { FileInput };
|
|
@@ -4,7 +4,7 @@ import { useId } from "react";
|
|
|
4
4
|
import { Field } from "../core";
|
|
5
5
|
import { File } from "./File";
|
|
6
6
|
import { FileTable } from "./FileTable";
|
|
7
|
-
const FileInput = ({ values = [], id, name = "", onChange, label, errors, fileLabel,
|
|
7
|
+
const FileInput = ({ values = [], id, name = "", onChange, label, errors, fileLabel, children, ...otherFileProps }) => {
|
|
8
8
|
const onDeleteClick = (selectedId, selectInputId) => {
|
|
9
9
|
const newValues = values.filter((element) => element.id !== selectedId);
|
|
10
10
|
onChange({
|
|
@@ -16,6 +16,6 @@ const FileInput = ({ values = [], id, name = "", onChange, label, errors, fileLa
|
|
|
16
16
|
};
|
|
17
17
|
const generatedId = useId();
|
|
18
18
|
const actualId = id ?? generatedId;
|
|
19
|
-
return (_jsx(Field, { label: label, labelPosition: "top", id: actualId,
|
|
19
|
+
return (_jsx(Field, { label: label, labelPosition: "top", id: actualId, fieldClassNameSuffix: "file", ...otherFileProps, renderInput: ({ inputClassName: inputClassModifiers, id: inputId, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(File, { id: inputId, name: name, onChange: onChange, className: inputClassModifiers, label: fileLabel, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), children] })), appendChildren: _jsx(FileTable, { errors: errors, values: values, onClick: (selectedId) => onDeleteClick(selectedId, actualId), className: otherFileProps.tableClassName }) }));
|
|
20
20
|
};
|
|
21
21
|
export { FileInput };
|
|
@@ -2,8 +2,7 @@ import type { CustomFile } from "./File";
|
|
|
2
2
|
type Props = CustomFile & {
|
|
3
3
|
onClick: (id: string) => void;
|
|
4
4
|
className?: string;
|
|
5
|
-
classModifier?: string;
|
|
6
5
|
disabled?: boolean;
|
|
7
6
|
};
|
|
8
|
-
declare const FileLine: ({ className,
|
|
7
|
+
declare const FileLine: ({ className, file, disabled, id, onClick }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export { FileLine };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
const FileLine = ({ className,
|
|
4
|
-
const componentClassName =
|
|
2
|
+
import { getClassName } from "../../utilities";
|
|
3
|
+
const FileLine = ({ className, file, disabled, id, onClick }) => {
|
|
4
|
+
const componentClassName = getClassName({
|
|
5
|
+
baseClassName: "af-form__file-line",
|
|
6
|
+
className,
|
|
7
|
+
});
|
|
5
8
|
return (_jsxs("li", { className: componentClassName, children: [file && file.type && file.type.startsWith("image") ? (_jsx("i", { className: "glyphicon glyphicon-picture" })) : (_jsx("i", { className: "glyphicon glyphicon-file" })), _jsx("span", { children: file.name }), _jsx("span", { children: file.size }), _jsx("button", { disabled: disabled, type: "button", className: "af-link af-link--delete-file", onClick: () => onClick(id), children: _jsx("span", { className: "af-link__text", children: "Supprimer" }) })] }));
|
|
6
9
|
};
|
|
7
10
|
export { FileLine };
|
|
@@ -7,8 +7,7 @@ type Props = Pick<FileLineProps, "onClick"> & {
|
|
|
7
7
|
errors?: FileRejection[];
|
|
8
8
|
values?: CustomFile[];
|
|
9
9
|
className?: string;
|
|
10
|
-
classModifier?: string;
|
|
11
10
|
disabled?: boolean;
|
|
12
11
|
};
|
|
13
|
-
declare const FileTable: ({ errors, values, className,
|
|
12
|
+
declare const FileTable: ({ errors, values, className, disabled, onClick }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
13
|
export { FileTable };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getClassName } from "../../utilities";
|
|
3
3
|
import { FileErrors } from "./FileErrors";
|
|
4
4
|
import { FileLine } from "./FileLine";
|
|
5
|
-
const FileTable = ({ errors, values, className,
|
|
6
|
-
const componentClassName =
|
|
5
|
+
const FileTable = ({ errors, values, className, disabled, onClick }) => {
|
|
6
|
+
const componentClassName = getClassName({
|
|
7
|
+
baseClassName: "af-file-table",
|
|
8
|
+
className: `custom-table-file ${className ?? ""}`,
|
|
9
|
+
});
|
|
7
10
|
return (_jsxs("div", { className: componentClassName, children: [errors && errors.length > 0 ? _jsx(FileErrors, { errors: errors }) : null, values && values.length > 0 ? (_jsx("ul", { className: "af-form__file-list", children: values.map(({ file, id }) => (_jsx(FileLine, { disabled: disabled, file: file, onClick: onClick, id: id }, id))) })) : null] }));
|
|
8
11
|
};
|
|
9
12
|
export { FileTable };
|
|
@@ -4,7 +4,7 @@ import {} from "react";
|
|
|
4
4
|
import { Field } from "../core";
|
|
5
5
|
import { MultiSelect } from "./MultiSelect";
|
|
6
6
|
const MultiSelectInput = ({ label, children, ...multiSelectProps }) => {
|
|
7
|
-
return (_jsx(Field, { label: label, ...multiSelectProps,
|
|
7
|
+
return (_jsx(Field, { label: label, ...multiSelectProps, fieldClassNameSuffix: "select", renderInput: ({ id, ariaInvalid, errorId, ...props }) => {
|
|
8
8
|
return (_jsxs(_Fragment, { children: [_jsx(MultiSelect, { id: id, "aria-invalid": ariaInvalid, "aria-describedby": errorId, ...props }), children] }));
|
|
9
9
|
} }));
|
|
10
10
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/NestedQuestion/NestedQuestion.css";
|
|
3
|
-
import {
|
|
3
|
+
import { getClassName } from "../../utilities";
|
|
4
|
+
const baseClassName = "af-form__nested-question";
|
|
4
5
|
export const NestedQuestion = ({ children, className, }) => {
|
|
5
|
-
const componentClassName =
|
|
6
|
-
|
|
6
|
+
const componentClassName = getClassName({
|
|
7
|
+
baseClassName,
|
|
8
|
+
className,
|
|
9
|
+
});
|
|
10
|
+
return (_jsxs("section", { className: componentClassName, children: [_jsx("div", { className: `${baseClassName}-arrow` }), _jsx("section", { children: children })] }));
|
|
7
11
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
|
|
2
2
|
import { type ComponentPropsWithRef } from "react";
|
|
3
|
-
type Props = Omit<ComponentPropsWithRef<"input">, "type"> & {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
declare const Number: {
|
|
8
|
-
({ id, className, classModifier, required, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
type Props = Omit<ComponentPropsWithRef<"input">, "type"> & {};
|
|
4
|
+
declare const NumberComponent: {
|
|
5
|
+
({ id, className, required, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
6
|
displayName: string;
|
|
10
7
|
};
|
|
11
|
-
export { Number };
|
|
8
|
+
export { NumberComponent as Number };
|
|
@@ -2,15 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { getClassName } from "../../utilities/helpers/getClassName";
|
|
5
|
-
const
|
|
5
|
+
const NumberComponent = ({ id, className, required, ...otherProps }) => {
|
|
6
6
|
const inputUseId = useId();
|
|
7
7
|
const inputId = id ?? inputUseId;
|
|
8
8
|
const componentClassName = getClassName({
|
|
9
9
|
baseClassName: "af-form__input-text",
|
|
10
|
-
modifiers: classModifier?.split(" "),
|
|
11
10
|
className,
|
|
12
11
|
});
|
|
13
|
-
return (_jsx("input", { className: componentClassName, id: inputId, type: "number", required: required
|
|
12
|
+
return (_jsx("input", { className: componentClassName, id: inputId, type: "number", required: required, ...otherProps }));
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
export { Number };
|
|
14
|
+
NumberComponent.displayName = "Number";
|
|
15
|
+
export { NumberComponent as Number };
|
|
@@ -3,5 +3,5 @@ import {} from "react";
|
|
|
3
3
|
import { Field } from "../core";
|
|
4
4
|
import { Number } from "./Number";
|
|
5
5
|
export const NumberInput = ({ children, ...props }) => {
|
|
6
|
-
return (_jsx(Field, { ...props, renderInput: ({ id,
|
|
6
|
+
return (_jsx(Field, { ...props, renderInput: ({ id, inputClassName, ariaInvalid, errorId, ...inputProps }) => (_jsxs(_Fragment, { children: [_jsx(Number, { id: id, className: inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...inputProps }), children] })) }));
|
|
7
7
|
};
|
|
@@ -10,7 +10,7 @@ export declare enum RadioModes {
|
|
|
10
10
|
}
|
|
11
11
|
type Props = {
|
|
12
12
|
options: Option[];
|
|
13
|
-
} & ((Omit<ComponentPropsWithRef<typeof RadioItem>, "id" | "label"
|
|
13
|
+
} & ((Omit<ComponentPropsWithRef<typeof RadioItem>, "id" | "label"> & {
|
|
14
14
|
mode?: "classic" | "default" | "inline";
|
|
15
15
|
}) | (ComponentPropsWithRef<typeof RadioCardGroup> & {
|
|
16
16
|
mode: "cardRadio";
|
|
@@ -5,7 +5,7 @@ import { Radio, RadioModes } from "./Radio";
|
|
|
5
5
|
const RadioInput = ({ label, mode = "default", options, children, ...props }) => {
|
|
6
6
|
const labelPosition = mode === RadioModes.classic ? "top" : "center";
|
|
7
7
|
const newOptions = useOptionsWithId(options);
|
|
8
|
-
return (_jsx(Field, { label: label, labelPosition: labelPosition, roleContainer: "radiogroup", ...props, renderInput: ({
|
|
8
|
+
return (_jsx(Field, { label: label, labelPosition: labelPosition, roleContainer: "radiogroup", ...props, renderInput: ({ inputClassName, ...radioProps }) => (_jsx(Radio, { options: newOptions, mode: mode, className: inputClassName, ...radioProps, children: children })) }));
|
|
9
9
|
};
|
|
10
10
|
RadioInput.displayName = "EnhancedInputRadio";
|
|
11
11
|
export { RadioInput };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Radio/Radio.css";
|
|
2
2
|
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
3
3
|
type Props = Omit<ComponentPropsWithRef<"input">, "checked" | "type"> & {
|
|
4
|
-
/** @deprecated Use `className` instead. */
|
|
5
|
-
classModifier?: string;
|
|
6
4
|
optionClassName?: string;
|
|
7
5
|
label?: ReactNode;
|
|
8
6
|
isChecked?: boolean;
|
|
9
7
|
};
|
|
10
8
|
declare const RadioItem: {
|
|
11
|
-
({ value, id, isChecked, label,
|
|
9
|
+
({ value, id, isChecked, label, className, disabled, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
displayName: string;
|
|
13
11
|
};
|
|
14
12
|
export { RadioItem };
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "@axa-fr/canopee-css/distributeur/Form/Radio/Radio.css";
|
|
3
3
|
import { useId } from "react";
|
|
4
4
|
import { getOptionClassName } from "../core";
|
|
5
|
-
const RadioItem = ({ value = "", id, isChecked, label,
|
|
6
|
-
const optionClassName = getOptionClassName(className,
|
|
5
|
+
const RadioItem = ({ value = "", id, isChecked, label, className = "", disabled = false, ...otherProps }) => {
|
|
6
|
+
const optionClassName = getOptionClassName(className, "af-form__radio", disabled);
|
|
7
7
|
const generatedId = useId();
|
|
8
8
|
const newId = id ?? generatedId;
|
|
9
9
|
return (_jsxs("div", { className: optionClassName, children: [_jsx("input", { ...otherProps, className: "af-form__input-radio", id: newId, type: "radio", value: value, checked: isChecked, disabled: disabled }), _jsx("label", { className: "af-form__label", htmlFor: newId, children: _jsx("span", { className: "af-form__description", children: label }) })] }, value));
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import { type ComponentProps, type
|
|
1
|
+
import { type ComponentProps, type PropsWithChildren } from "react";
|
|
2
2
|
import { SelectDefault } from "./SelectDefault";
|
|
3
|
-
|
|
4
|
-
type SelectProps = PropsWithChildren<ComponentProps<typeof SelectDefault | typeof SelectDefaultWithOptions> & {
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated Use `children` instead
|
|
7
|
-
* Instead of
|
|
8
|
-
* ```jsx
|
|
9
|
-
* <SelectBase options={[{ value: "1", label: "Option 1" }]} />
|
|
10
|
-
* ```
|
|
11
|
-
* you can now do something like :
|
|
12
|
-
* ```jsx
|
|
13
|
-
* <SelectBase>
|
|
14
|
-
* <option value="1">Option 1</option>
|
|
15
|
-
* </SelectBase>
|
|
16
|
-
* ```
|
|
17
|
-
* It allows you to use the `optgroup` tag for example.
|
|
18
|
-
*/
|
|
19
|
-
options?: OptionHTMLAttributes<HTMLOptionElement>[];
|
|
3
|
+
type SelectProps = PropsWithChildren<ComponentProps<typeof SelectDefault> & {
|
|
20
4
|
mode?: "default" | "base";
|
|
21
5
|
}>;
|
|
22
6
|
declare const Select: {
|
|
23
|
-
({ mode, children,
|
|
7
|
+
({ mode, children, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
24
8
|
displayName: string;
|
|
25
9
|
};
|
|
26
10
|
export { Select };
|
|
@@ -2,12 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import {} from "react";
|
|
3
3
|
import { SelectBase } from "./SelectBase";
|
|
4
4
|
import { SelectDefault } from "./SelectDefault";
|
|
5
|
-
|
|
6
|
-
const Select = ({ mode = "default", children, options, ...props }) => {
|
|
5
|
+
const Select = ({ mode = "default", children, ...props }) => {
|
|
7
6
|
if (mode === "default") {
|
|
8
|
-
return
|
|
7
|
+
return _jsx(SelectDefault, { ...props, children: children });
|
|
9
8
|
}
|
|
10
|
-
return
|
|
9
|
+
return _jsx(SelectBase, { ...props, children: children });
|
|
11
10
|
};
|
|
12
11
|
Select.displayName = "Select";
|
|
13
12
|
export { Select };
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import "@axa-fr/canopee-css/distributeur/Form/Select/Select.css";
|
|
2
|
-
import { type ComponentPropsWithRef
|
|
3
|
-
type Props = ComponentPropsWithRef<"select"
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use `children` instead
|
|
6
|
-
* Instead of
|
|
7
|
-
* ```jsx
|
|
8
|
-
* <SelectBase options={[{ value: "1", label: "Option 1" }]} />
|
|
9
|
-
* ```
|
|
10
|
-
* you can now do something like :
|
|
11
|
-
* ```jsx
|
|
12
|
-
* <SelectBase>
|
|
13
|
-
* <option value="1">Option 1</option>
|
|
14
|
-
* </SelectBase>
|
|
15
|
-
* ```
|
|
16
|
-
* It allows you to use the `optgroup` tag for example.
|
|
17
|
-
*/
|
|
18
|
-
options?: OptionHTMLAttributes<HTMLOptionElement>[];
|
|
19
|
-
/** @deprecated Use `className` and the native `required` prop instead. */
|
|
20
|
-
classModifier?: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Use Select instead
|
|
24
|
-
*/
|
|
2
|
+
import { type ComponentPropsWithRef } from "react";
|
|
3
|
+
type Props = ComponentPropsWithRef<"select">;
|
|
25
4
|
declare const SelectBase: {
|
|
26
|
-
({
|
|
5
|
+
({ id, className, required, children, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
|
|
27
6
|
displayName: string;
|
|
28
7
|
};
|
|
29
8
|
export { SelectBase };
|