@axa-fr/design-system-apollo-react 1.0.5-alpha.315 → 1.0.5-alpha.320

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Svg } from "../../../Svg/Svg";
3
- const CheckboxCommon = ({ errorId, checkBoxIcon, hasError, ...inputProps }) => (_jsxs("span", { className: "af-checkbox", children: [_jsx("input", { ...inputProps, type: "checkbox", "aria-errormessage": errorId, "aria-invalid": hasError, disabled: false }), _jsx(Svg, { src: checkBoxIcon, "aria-hidden": true })] }));
3
+ const CheckboxCommon = ({ errorId, checkBoxIcon, hasError, ...inputProps }) => (_jsxs("span", { className: "af-checkbox", children: [_jsx(Svg, { src: checkBoxIcon, "aria-hidden": true }), _jsx("input", { ...inputProps, type: "checkbox", "aria-errormessage": errorId, "aria-invalid": hasError, disabled: false })] }));
4
4
  CheckboxCommon.displayName = "CheckboxCommon";
5
5
  export { CheckboxCommon };
@@ -1,5 +1,4 @@
1
- import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
2
- export declare const DebugGrid: ({ cols, isCheckedByDefault, }: {
3
- cols?: number;
4
- isCheckedByDefault?: boolean;
5
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import { type DebugGridCommonProps } from "./DebugGridCommon";
2
+ type DebugGridProps<P = object> = Omit<DebugGridCommonProps<P>, "CardCheckbox">;
3
+ export declare const DebugGrid: <P = object>({ ...props }: DebugGridProps<P>) => import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -1,17 +1,6 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
3
- import { useState } from "react";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
4
2
  import { CardCheckbox } from "../Form/Checkbox/CardCheckbox/CardCheckboxApollo";
5
3
  import { DebugGridCommon } from "./DebugGridCommon";
6
- export const DebugGrid = ({ cols = 12, isCheckedByDefault = false, }) => {
7
- const [checked, setChecked] = useState(isCheckedByDefault);
8
- const handleChecked = () => setChecked(!checked);
9
- return (_jsxs(_Fragment, { children: [_jsx(CardCheckbox, { type: "horizontal", options: [
10
- {
11
- name: "debuggrid",
12
- label: "Grid",
13
- checked,
14
- onClick: handleChecked,
15
- },
16
- ] }), _jsx(DebugGridCommon, { cols: cols })] }));
4
+ export const DebugGrid = ({ ...props }) => {
5
+ return (_jsx(DebugGridCommon, { ...props, CardCheckbox: CardCheckbox }));
17
6
  };
@@ -1,4 +1,9 @@
1
1
  import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
2
- export declare const DebugGridCommon: ({ cols }: {
2
+ import type { ComponentProps, ComponentType } from "react";
3
+ import type { CardCheckboxCommon } from "../Form/Checkbox/CardCheckbox/CardCheckboxCommon";
4
+ export type DebugGridCommonProps<P = object> = P & {
3
5
  cols?: number;
4
- }) => import("react/jsx-runtime").JSX.Element;
6
+ isCheckedByDefault?: boolean;
7
+ CardCheckbox: ComponentType<Partial<ComponentProps<typeof CardCheckboxCommon>>>;
8
+ };
9
+ export declare const DebugGridCommon: <P = object>({ cols, isCheckedByDefault, CardCheckbox, ...props }: DebugGridCommonProps<P>) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,16 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
3
- export const DebugGridCommon = ({ cols = 12 }) => {
4
- return (_jsx("div", { className: "debug-grid", children: _jsx("div", { className: "grid", children: [...Array(cols).keys()].map((col) => (_jsx("div", { className: "cols" }, col))) }) }));
3
+ export const DebugGridCommon = ({ cols = 12, isCheckedByDefault = false, CardCheckbox, ...props }) => {
4
+ // The forceVisible prop is a hidden prop to force the component's visibility when building the storybook
5
+ const forceVisible = props?.forceVisible || false;
6
+ if (process.env.NODE_ENV === "production" && !forceVisible) {
7
+ return null;
8
+ }
9
+ return (_jsxs(_Fragment, { children: [_jsx(CardCheckbox, { type: "horizontal", options: [
10
+ {
11
+ name: "debuggrid",
12
+ label: "Grid",
13
+ defaultChecked: isCheckedByDefault,
14
+ },
15
+ ] }), _jsx("div", { className: "debug-grid", role: "presentation", children: _jsx("div", { className: "grid", children: [...Array(cols).keys()].map((col) => (_jsx("div", { className: "cols" }, col))) }) })] }));
5
16
  };
@@ -1,5 +1,4 @@
1
- import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
2
- export declare const DebugGrid: ({ cols, isCheckedByDefault, }: {
3
- cols?: number;
4
- isCheckedByDefault?: boolean;
5
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import { type DebugGridCommonProps } from "./DebugGridCommon";
2
+ type DebugGridProps<P = object> = Omit<DebugGridCommonProps<P>, "CardCheckbox">;
3
+ export declare const DebugGrid: <P = object>({ ...props }: DebugGridProps<P>) => import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -1,17 +1,6 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "@axa-fr/design-system-apollo-css/dist/Grid/DebugGrid.scss";
3
- import { useState } from "react";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
4
2
  import { CardCheckbox } from "../Form/Checkbox/CardCheckbox/CardCheckboxLF";
5
3
  import { DebugGridCommon } from "./DebugGridCommon";
6
- export const DebugGrid = ({ cols = 12, isCheckedByDefault = false, }) => {
7
- const [checked, setChecked] = useState(isCheckedByDefault);
8
- const handleChecked = () => setChecked(!checked);
9
- return (_jsxs(_Fragment, { children: [_jsx(CardCheckbox, { type: "horizontal", options: [
10
- {
11
- name: "debuggrid",
12
- label: "Grid",
13
- checked,
14
- onClick: handleChecked,
15
- },
16
- ] }), _jsx(DebugGridCommon, { cols: cols })] }));
4
+ export const DebugGrid = ({ ...props }) => {
5
+ return (_jsx(DebugGridCommon, { ...props, CardCheckbox: CardCheckbox }));
17
6
  };
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.315",
3
+ "version": "1.0.5-alpha.320",
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.315",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.315",
49
+ "@axa-fr/design-system-apollo-css": "1.0.5-alpha.320",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.5-alpha.320",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },