@axa-fr/design-system-apollo-react 1.0.5-alpha.278 → 1.0.5-alpha.279

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.
@@ -0,0 +1,6 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioApollo.scss";
2
+ import { RadioProps } from "./RadioCommon";
3
+ export declare const Radio: {
4
+ (props: RadioProps): import("react/jsx-runtime").JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioApollo.scss";
3
+ import { RadioCommon } from "./RadioCommon";
4
+ export const Radio = (props) => _jsx(RadioCommon, { ...props });
5
+ Radio.displayName = "Radio";
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export type RadioProps = {
3
+ errorId?: string;
4
+ hasError?: boolean;
5
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">;
6
+ export declare const RadioCommon: {
7
+ ({ errorId, hasError, ...inputProps }: RadioProps): import("react/jsx-runtime").JSX.Element;
8
+ displayName: string;
9
+ };
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const RadioCommon = ({ errorId, hasError, ...inputProps }) => (_jsxs("span", { className: "af-radio", "aria-invalid": hasError, "aria-errormessage": errorId, children: [_jsx("input", { ...inputProps, type: "radio" }), _jsx("span", { className: "af-radio__icons" })] }));
3
+ RadioCommon.displayName = "RadioCommon";
@@ -0,0 +1,6 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioLF.scss";
2
+ import { RadioProps } from "./RadioCommon";
3
+ export declare const Radio: {
4
+ (props: RadioProps): import("react/jsx-runtime").JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/Radio/RadioLF.scss";
3
+ import { RadioCommon } from "./RadioCommon";
4
+ export const Radio = (props) => _jsx(RadioCommon, { ...props });
5
+ Radio.displayName = "Radio";
@@ -0,0 +1,6 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/RadioCard/RadioCardApollo.scss";
2
+ import { RadioCardProps } from "./RadioCardCommon";
3
+ export declare const RadioCard: {
4
+ (props: RadioCardProps): import("react/jsx-runtime").JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/RadioCard/RadioCardApollo.scss";
3
+ import { Icon } from "../../../Icon/IconApollo";
4
+ import { RadioCardCommon } from "./RadioCardCommon";
5
+ import { Radio } from "../Radio/RadioApollo";
6
+ import { ItemMessage } from "../../ItemMessage/ItemMessageApollo";
7
+ export const RadioCard = (props) => (_jsx(RadioCardCommon, { ...props, IconComponent: Icon, RadioComponent: Radio, ItemMessageComponent: ItemMessage }));
8
+ RadioCard.displayName = "RadioCard";
@@ -0,0 +1,34 @@
1
+ import React, { type ComponentProps, ComponentPropsWithRef, type ComponentType, type ReactNode } from "react";
2
+ import { Icon } from "../../../Icon/IconCommon";
3
+ import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
4
+ import { RadioProps } from "../Radio/RadioCommon";
5
+ type RadioComponent = {
6
+ RadioComponent: ComponentType<RadioProps>;
7
+ };
8
+ type IconComponent = {
9
+ IconComponent: ComponentType<ComponentProps<typeof Icon>>;
10
+ };
11
+ export type RadioCardProps = ComponentPropsWithRef<"input"> & {
12
+ type: "vertical" | "horizontal";
13
+ labelGroup?: string;
14
+ descriptionGroup?: string;
15
+ isRequired?: boolean;
16
+ value?: number;
17
+ options: ({
18
+ label: ReactNode;
19
+ subtitle?: ReactNode;
20
+ description?: ReactNode;
21
+ hasError?: boolean;
22
+ icon?: string;
23
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">)[];
24
+ onChange?: React.ChangeEventHandler;
25
+ error?: string;
26
+ };
27
+ export type RadioCardCommonProps = RadioCardProps & RadioComponent & IconComponent & {
28
+ ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
29
+ };
30
+ declare const RadioCardCommon: {
31
+ ({ className, labelGroup, descriptionGroup, RadioComponent, IconComponent, isRequired, options, type, error, name, onChange, ItemMessageComponent, }: RadioCardCommonProps): import("react/jsx-runtime").JSX.Element;
32
+ displayName: string;
33
+ };
34
+ export { RadioCardCommon };
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId, } from "react";
3
+ import { getComponentClassName } from "../../../utilities/getComponentClassName";
4
+ import { useIsSmallScreen } from "../../../utilities/hook/useIsSmallScreen";
5
+ import { BREAKPOINT } from "../../../utilities/constants";
6
+ const RadioCardCommon = ({ className, labelGroup, descriptionGroup, RadioComponent, IconComponent, isRequired, options, type = "vertical", error, name, onChange, ItemMessageComponent, }) => {
7
+ const componentClassName = getComponentClassName("af-radio-card__container", className);
8
+ const RadioGroupClassName = getComponentClassName("af-radio-card-group", className, type);
9
+ const errorId = useId();
10
+ const isMobile = useIsSmallScreen(BREAKPOINT.SM);
11
+ const size = isMobile ? "M" : "L";
12
+ return (_jsxs("fieldset", { className: componentClassName, children: [_jsx("div", { className: "af-radio-card__label-container", children: _jsxs("legend", { children: [labelGroup && (_jsxs("span", { className: "af-radio-card__label", children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" })] })), descriptionGroup && (_jsx("p", { className: "af-radio-card__description", children: descriptionGroup }))] }) }), _jsx("div", { className: RadioGroupClassName, children: options.map(({ label, description, subtitle, icon, hasError, ...inputProps }, index) => (_jsxs("label", { "aria-invalid": Boolean(error) || hasError, htmlFor: `id-${name ?? inputProps.name}-${index}`, className: "af-radio-card-label", children: [_jsx(RadioComponent, { id: `id-${name ?? inputProps.name}-${index}`, errorId: errorId, hasError: Boolean(error) || hasError, ...inputProps, name: name ?? inputProps.name, onChange: onChange }), _jsxs("div", { className: "af-radio-card-content", children: [icon && _jsx(IconComponent, { src: icon, size: size }), _jsxs("div", { className: "af-radio-card-content-description", children: [_jsx("span", { children: label }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }, `${name ?? inputProps.name}`))) }), _jsx(ItemMessageComponent, { id: errorId, message: error, messageType: "error" })] }));
13
+ };
14
+ RadioCardCommon.displayName = "RadioCardCommon";
15
+ export { RadioCardCommon };
@@ -0,0 +1,6 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/RadioCard/RadioCardLF.scss";
2
+ import { RadioCardProps } from "./RadioCardCommon";
3
+ export declare const RadioCard: {
4
+ (props: RadioCardProps): import("react/jsx-runtime").JSX.Element;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/Radio/RadioCard/RadioCardLF.scss";
3
+ import { Icon } from "../../../Icon/IconLF";
4
+ import { RadioCardCommon } from "./RadioCardCommon";
5
+ import { Radio } from "../Radio/RadioLF";
6
+ import { ItemMessage } from "../../ItemMessage/ItemMessageLF";
7
+ export const RadioCard = (props) => (_jsx(RadioCardCommon, { ...props, IconComponent: Icon, RadioComponent: Radio, ItemMessageComponent: ItemMessage }));
8
+ RadioCard.displayName = "RadioCard";
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
16
16
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
17
17
  export { Select } from "./Form/Select/SelectApollo";
18
18
  export { TextArea } from "./Form/TextArea/TextAreaApollo";
19
+ export { Radio } from "./Form/Radio/Radio/RadioApollo";
20
+ export { RadioCard } from "./Form/Radio/RadioCard/RadioCardApollo";
19
21
  export { TextInput } from "./Form/TextInput/TextInputApollo";
20
22
  export { DebugGrid } from "./Grid/DebugGridApollo";
21
23
  export { Heading, type HeadingLevel } from "./Heading/HeadingApollo";
package/dist/index.js CHANGED
@@ -16,6 +16,8 @@ export { ItemLabel } from "./Form/ItemLabel/ItemLabelApollo";
16
16
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageApollo";
17
17
  export { Select } from "./Form/Select/SelectApollo";
18
18
  export { TextArea } from "./Form/TextArea/TextAreaApollo";
19
+ export { Radio } from "./Form/Radio/Radio/RadioApollo";
20
+ export { RadioCard } from "./Form/Radio/RadioCard/RadioCardApollo";
19
21
  export { TextInput } from "./Form/TextInput/TextInputApollo";
20
22
  export { DebugGrid } from "./Grid/DebugGridApollo";
21
23
  export { Heading } from "./Heading/HeadingApollo";
package/dist/indexLF.d.ts CHANGED
@@ -15,6 +15,8 @@ export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
15
15
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
16
16
  export { Select } from "./Form/Select/SelectLF";
17
17
  export { TextArea } from "./Form/TextArea/TextAreaLF";
18
+ export { Radio } from "./Form/Radio/Radio/RadioLF";
19
+ export { RadioCard } from "./Form/Radio/RadioCard/RadioCardLF";
18
20
  export { TextInput } from "./Form/TextInput/TextInputLF";
19
21
  export { DebugGrid } from "./Grid/DebugGridLF";
20
22
  export { Heading, type HeadingLevel } from "./Heading/HeadingLF";
package/dist/indexLF.js CHANGED
@@ -15,6 +15,8 @@ export { ItemLabel } from "./Form/ItemLabel/ItemLabelLF";
15
15
  export { ItemMessage } from "./Form/ItemMessage/ItemMessageLF";
16
16
  export { Select } from "./Form/Select/SelectLF";
17
17
  export { TextArea } from "./Form/TextArea/TextAreaLF";
18
+ export { Radio } from "./Form/Radio/Radio/RadioLF";
19
+ export { RadioCard } from "./Form/Radio/RadioCard/RadioCardLF";
18
20
  export { TextInput } from "./Form/TextInput/TextInputLF";
19
21
  export { DebugGrid } from "./Grid/DebugGridLF";
20
22
  export { Heading } from "./Heading/HeadingLF";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.5-alpha.278",
3
+ "version": "1.0.5-alpha.279",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "homepage": "https://github.com/AxaFrance/design-system#readme",
48
48
  "peerDependencies": {
49
- "@axa-fr/design-system-apollo-css": "1.0.5-alpha.278",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.278",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.279",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.279",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },