@axa-fr/design-system-apollo-react 1.0.5-alpha.268 → 1.0.5-alpha.270
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/BasePicture/BasePictureCommon.js +1 -1
- package/dist/Form/Checkbox/CheckboxCard/CheckboxCardCommon.d.ts +7 -19
- package/dist/Form/Checkbox/CheckboxCard/CheckboxCardCommon.js +4 -5
- package/dist/Form/Checkbox/CheckboxCard/CheckboxCardItem.d.ts +15 -0
- package/dist/Form/Checkbox/CheckboxCard/CheckboxCardItem.js +7 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import logo from "@axa-fr/design-system-
|
|
3
|
+
import logo from "@axa-fr/design-system-apollo-css/logo-axa.svg";
|
|
4
4
|
import { getComponentClassName } from "../utilities/getComponentClassName";
|
|
5
5
|
export const BasePicture = ({ className, src, ...rest }) => {
|
|
6
6
|
const componentClassName = useMemo(() => getComponentClassName("af-basepicture", className), [className]);
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
type CheckboxComponent = {
|
|
5
|
-
CheckboxComponent: ComponentType<CheckboxProps>;
|
|
6
|
-
};
|
|
7
|
-
type IconComponent = {
|
|
8
|
-
IconComponent: ComponentType<ComponentProps<typeof Icon>>;
|
|
9
|
-
};
|
|
1
|
+
import React, { ComponentPropsWithRef } from "react";
|
|
2
|
+
import { type TCheckboxCardItem } from "./CheckboxCardItem";
|
|
3
|
+
import type { CheckboxComponent, IconComponent } from "./types";
|
|
10
4
|
export type CheckboxCardProps = ComponentPropsWithRef<"input"> & {
|
|
11
5
|
type: "vertical" | "horizontal";
|
|
12
6
|
labelGroup?: string;
|
|
13
7
|
descriptionGroup?: string;
|
|
14
8
|
isRequired?: boolean;
|
|
15
|
-
options:
|
|
16
|
-
label: ReactNode;
|
|
17
|
-
subtitle?: ReactNode;
|
|
18
|
-
description?: ReactNode;
|
|
19
|
-
hasError?: boolean;
|
|
20
|
-
icon?: string;
|
|
21
|
-
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled">)[];
|
|
9
|
+
options: TCheckboxCardItem[];
|
|
22
10
|
onChange?: React.ChangeEventHandler;
|
|
23
11
|
};
|
|
24
|
-
|
|
25
|
-
declare const CheckboxCardCommon: {
|
|
12
|
+
type CheckboxCardCommonProps = CheckboxCardProps & CheckboxComponent & IconComponent;
|
|
13
|
+
export declare const CheckboxCardCommon: {
|
|
26
14
|
({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type, }: CheckboxCardCommonProps): import("react/jsx-runtime").JSX.Element;
|
|
27
15
|
displayName: string;
|
|
28
16
|
};
|
|
29
|
-
export {
|
|
17
|
+
export {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId
|
|
2
|
+
import { useId } from "react";
|
|
3
3
|
import { BREAKPOINT } from "../../../utilities/constants";
|
|
4
4
|
import { getComponentClassName } from "../../../utilities/getComponentClassName";
|
|
5
5
|
import { useIsSmallScreen } from "../../../utilities/hook/useIsSmallScreen";
|
|
6
|
-
|
|
6
|
+
import { CheckboxCardItem } from "./CheckboxCardItem";
|
|
7
|
+
export const CheckboxCardCommon = ({ className, labelGroup, descriptionGroup, CheckboxComponent, IconComponent, isRequired, options, onChange, type = "vertical", }) => {
|
|
7
8
|
const componentClassName = getComponentClassName("af-checkbox-card__container", className);
|
|
8
9
|
const checkboxGroupClassName = getComponentClassName("af-checkbox-card-group", className, type);
|
|
9
|
-
const optionId = useId();
|
|
10
10
|
const errorId = useId();
|
|
11
11
|
const isMobile = useIsSmallScreen(BREAKPOINT.SM);
|
|
12
12
|
const size = isMobile ? "M" : "L";
|
|
13
|
-
return (_jsxs("
|
|
13
|
+
return (_jsxs("fieldset", { className: componentClassName, children: [_jsx("div", { className: "af-checkbox-card__label-container", children: labelGroup && (_jsxs("legend", { className: "af-checkbox-card__legend", children: [labelGroup, isRequired && _jsx("span", { "aria-hidden": true, children: "\u00A0*" }), descriptionGroup && (_jsx("p", { className: "af-checkbox-card__description", children: descriptionGroup }))] })) }), _jsx("ul", { className: checkboxGroupClassName, children: options.map((inputProps) => (_jsx("li", { children: _jsx(CheckboxCardItem, { size: size, errorId: errorId, onChange: onChange, CheckboxComponent: CheckboxComponent, IconComponent: IconComponent, ...inputProps }) }, crypto.randomUUID()))) })] }));
|
|
14
14
|
};
|
|
15
15
|
CheckboxCardCommon.displayName = "CheckboxCardCommon";
|
|
16
|
-
export { CheckboxCardCommon };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { CheckboxComponent, IconComponent } from "./types";
|
|
3
|
+
export type TCheckboxCardItem = {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
subtitle?: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
hasError?: boolean;
|
|
8
|
+
icon?: string;
|
|
9
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled" | "size">;
|
|
10
|
+
type CheckboxCardItemProps = {
|
|
11
|
+
size: "M" | "L";
|
|
12
|
+
errorId: string;
|
|
13
|
+
} & TCheckboxCardItem & CheckboxComponent & IconComponent;
|
|
14
|
+
export declare const CheckboxCardItem: ({ CheckboxComponent, IconComponent, id, label, description, subtitle, icon, errorId, hasError, size, ...inputProps }: CheckboxCardItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
export const CheckboxCardItem = ({ CheckboxComponent, IconComponent, id, label, description, subtitle, icon, errorId, hasError, size, ...inputProps }) => {
|
|
4
|
+
let inputId = useId();
|
|
5
|
+
inputId = id ?? inputId;
|
|
6
|
+
return (_jsxs("label", { htmlFor: inputId, className: "af-checkbox-card-label", "aria-invalid": hasError, children: [_jsx(CheckboxComponent, { id: inputId, errorId: errorId, hasError: hasError, ...inputProps }), _jsxs("div", { className: "af-checkbox-card-content", children: [icon && _jsx(IconComponent, { src: icon, size: size }), _jsxs("div", { className: "af-checkbox-card-content-description", children: [_jsx("span", { children: label }), description && _jsx("span", { children: description }), subtitle && _jsx("span", { children: subtitle })] })] })] }));
|
|
7
|
+
};
|
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.
|
|
3
|
+
"version": "1.0.5-alpha.270",
|
|
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.
|
|
50
|
-
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.
|
|
49
|
+
"@axa-fr/design-system-apollo-css": "1.0.5-alpha.270",
|
|
50
|
+
"@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.270",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|