@axa-fr/canopee-react 2.0.0-alpha.75 → 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.
@@ -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 className = defaultClassName(mode);
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: "af-form__checkbox-container", children: options.map((option) => {
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: className, isChecked: isChecked, name: name, disabled: option.disabled || disabled, ...option }, children));
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";
@@ -6,7 +6,7 @@ import { CheckboxModes } from "./CheckboxModes";
6
6
  const CheckboxInput = ({ label, mode = "default", options, children, ...otherProps }) => {
7
7
  const newOptions = useOptionsWithId(options);
8
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: ariaInvalid ? `${inputClassName} error` : inputClassName, "aria-describedby": errorId, "aria-invalid": ariaInvalid, ...props }), children] }));
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,10 +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
3
  import { getClassName } from "../../utilities";
4
+ const baseClassName = "af-form__nested-question";
4
5
  export const NestedQuestion = ({ children, className, }) => {
5
6
  const componentClassName = getClassName({
6
- baseClassName: "af-form__nested-question",
7
+ baseClassName,
7
8
  className,
8
9
  });
9
- return (_jsxs("section", { className: componentClassName, children: [_jsx("div", { className: "af-form__nested-question-arrow" }), _jsx("section", { children: children })] }));
10
+ return (_jsxs("section", { className: componentClassName, children: [_jsx("div", { className: `${baseClassName}-arrow` }), _jsx("section", { children: children })] }));
10
11
  };
@@ -1,8 +1,8 @@
1
1
  import "@axa-fr/canopee-css/distributeur/Form/Text/Text.css";
2
2
  import { type ComponentPropsWithRef } from "react";
3
3
  type Props = Omit<ComponentPropsWithRef<"input">, "type"> & {};
4
- declare const Number: {
4
+ declare const NumberComponent: {
5
5
  ({ id, className, required, ...otherProps }: Props): import("react/jsx-runtime").JSX.Element;
6
6
  displayName: string;
7
7
  };
8
- export { Number };
8
+ export { NumberComponent as Number };
@@ -2,7 +2,7 @@ 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 Number = ({ id, className, required, ...otherProps }) => {
5
+ const NumberComponent = ({ id, className, required, ...otherProps }) => {
6
6
  const inputUseId = useId();
7
7
  const inputId = id ?? inputUseId;
8
8
  const componentClassName = getClassName({
@@ -11,5 +11,5 @@ const Number = ({ id, className, required, ...otherProps }) => {
11
11
  });
12
12
  return (_jsx("input", { className: componentClassName, id: inputId, type: "number", required: required, ...otherProps }));
13
13
  };
14
- Number.displayName = "Number";
15
- export { Number };
14
+ NumberComponent.displayName = "Number";
15
+ export { NumberComponent as Number };
@@ -3,7 +3,6 @@ import { getClassName } from "../utilities/helpers/getClassName";
3
3
  const THead = ({ children, className, ...otherProps }) => {
4
4
  const componentClassName = getClassName({
5
5
  baseClassName: "af-table__thead",
6
- modifiers: [],
7
6
  className,
8
7
  });
9
8
  return (_jsx("thead", { className: componentClassName, ...otherProps, children: children }));
@@ -4,7 +4,6 @@ import { getClassName } from "../utilities/helpers/getClassName";
4
4
  const Tr = ({ children, id, className, ...otherProps }) => {
5
5
  const componentClassName = getClassName({
6
6
  baseClassName: "af-table__tr",
7
- modifiers: [],
8
7
  className,
9
8
  });
10
9
  return (_jsx("tr", { className: componentClassName, ...otherProps, children: children }, id));
@@ -1,4 +1,4 @@
1
- import { type FormEvent, type ReactElement } from "react";
1
+ import { type ReactElement, type SyntheticEvent } from "react";
2
2
  import type { TabProps } from "./Tab";
3
3
  export type TabsStatelessProps = {
4
4
  children: ReactElement<TabProps> | ReactElement<TabProps>[];
@@ -6,7 +6,7 @@ export type TabsStatelessProps = {
6
6
  className?: string;
7
7
  };
8
8
  export type TabsStatelessHandlers = {
9
- onChange: (event: FormEvent<HTMLButtonElement>, index: number) => void;
9
+ onChange: (event: SyntheticEvent<HTMLButtonElement>, index: number) => void;
10
10
  };
11
11
  type Props = TabsStatelessProps & TabsStatelessHandlers;
12
12
  declare const TabsStateless: ({ activeIndex, className, children, onChange, }: Props) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/canopee-react",
3
- "version": "2.0.0-alpha.75",
3
+ "version": "2.0.0-alpha.76",
4
4
  "description": "Package React - Design System Canopée",
5
5
  "exports": {
6
6
  "./distributeur": {
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "homepage": "https://github.com/AxaFrance/design-system#readme",
55
55
  "peerDependencies": {
56
- "@axa-fr/canopee-css": "2.0.0-alpha.75",
56
+ "@axa-fr/canopee-css": "2.0.0-alpha.76",
57
57
  "@material-symbols/svg-400": ">= 0.19.0",
58
58
  "@material-symbols/svg-700": ">= 0.19.0",
59
59
  "react": ">= 19"