@axa-fr/design-system-slash-react 0.2.0-beta.347 → 0.2.0-beta.353

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,15 @@
1
+ import "@axa-fr/design-system-slash-css/dist/Accordion/Accordion.scss";
2
+ import React from "react";
3
+ import { CollapseProps } from "./CollapseCard";
4
+ declare const defaultProps: {
5
+ onlyOne: boolean;
6
+ className: string;
7
+ };
8
+ export type EnhancedProps = Partial<typeof defaultProps> & {
9
+ onlyOne?: boolean;
10
+ className?: string;
11
+ classModifier?: string;
12
+ children: React.ReactElement<CollapseProps>[] | React.ReactElement<CollapseProps>;
13
+ };
14
+ declare const Accordion: ({ className, classModifier, children, onlyOne, }: EnhancedProps) => import("react/jsx-runtime").JSX.Element;
15
+ export { Accordion };
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createElement as _createElement } from "react";
3
+ import "@axa-fr/design-system-slash-css/dist/Accordion/Accordion.scss";
4
+ import { useId } from "react";
5
+ import { getComponentClassName } from "../utilities";
6
+ import { CollapseCard } from "./CollapseCard";
7
+ const defaultClassName = "af-accordion";
8
+ const defaultProps = {
9
+ onlyOne: false,
10
+ className: defaultClassName,
11
+ };
12
+ const Accordion = ({ className, classModifier, children, onlyOne = false, }) => {
13
+ const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
14
+ const id = useId();
15
+ const childrenArray = Array.isArray(children) ? children : [children];
16
+ return (_jsx("div", { className: componentClassName, children: childrenArray.map((child) => (_createElement(CollapseCard, { ...child.props, name: onlyOne ? id : undefined, key: child.props.id }, child.props.children))) }));
17
+ };
18
+ export { Accordion };
@@ -0,0 +1 @@
1
+ export declare const AccordionContext: import("react").Context<number[]>;
@@ -0,0 +1,2 @@
1
+ import { createContext } from "react";
2
+ export const AccordionContext = createContext([0]);
@@ -0,0 +1,6 @@
1
+ export type BodyProps = {
2
+ children: React.ReactNode;
3
+ ariaLabelledby?: string;
4
+ };
5
+ declare const Body: ({ children, ariaLabelledby }: BodyProps) => import("react/jsx-runtime").JSX.Element;
6
+ export { Body };
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ const Body = ({ children, ariaLabelledby }) => {
3
+ return (_jsx("div", { className: "af-accordion__content", "aria-labelledby": ariaLabelledby, children: _jsx("div", { children: children }) }));
4
+ };
5
+ export { Body };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from "react";
2
+ export type CollapseProps = {
3
+ id: string;
4
+ title: ReactNode;
5
+ children?: React.ReactNode;
6
+ open?: boolean;
7
+ name?: string;
8
+ onToggle?: React.DetailsHTMLAttributes<HTMLDetailsElement>["onToggle"];
9
+ };
10
+ export declare const CollapseCard: ({ children, name, title, id, open, onToggle, }: CollapseProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Body } from "./Body";
3
+ import { Header } from "./Header";
4
+ export const CollapseCard = ({ children, name, title, id, open, onToggle, }) => {
5
+ const headerId = id;
6
+ return (_jsxs("details", { open: open, name: name, className: "af-accordion__details", onToggle: onToggle, children: [_jsx(Header, { id: headerId, children: title }), _jsx(Body, { children: children })] }));
7
+ };
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ export type HeaderToggleElement = {
3
+ isOpen: boolean;
4
+ index: number;
5
+ id: string;
6
+ };
7
+ export type HeaderProps = {
8
+ children: React.ReactNode;
9
+ className?: string;
10
+ classModifier?: string;
11
+ id?: string;
12
+ };
13
+ declare const Header: ({ children, className, classModifier, id }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
14
+ export { Header };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getComponentClassName } from "../utilities";
3
+ const defaultClassName = "af-accordion__item-header";
4
+ const Header = ({ children, className, classModifier, id }) => {
5
+ const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
6
+ return (_jsxs("summary", { className: componentClassName, id: id, children: [_jsx("h3", { className: "af-accordion__item-title", children: children }), _jsx("span", { className: "glyphicon glyphicon-menu-down" })] }));
7
+ };
8
+ export { Header };
@@ -0,0 +1,2 @@
1
+ export { Accordion } from "./Accordion";
2
+ export { CollapseCard, type CollapseProps } from "./CollapseCard";
@@ -0,0 +1,2 @@
1
+ export { Accordion } from "./Accordion";
2
+ export { CollapseCard } from "./CollapseCard";
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
2
3
  import { getComponentClassName } from "../../utilities";
3
4
  import { FieldError } from "./FieldError";
4
5
  import { MessageTypes } from "./MessageTypes";
@@ -8,5 +9,7 @@ export const Field = ({ id = "", message = "", messageType = MessageTypes.error,
8
9
  return null;
9
10
  }
10
11
  const componentClassName = getComponentClassName(className, classModifier, "row af-form__group");
11
- return (_jsxs("div", { className: componentClassName, role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: "af-form__group-label", htmlFor: isLabelContainerLinkedToInput ? id : undefined, children: label }) }), _jsxs(FieldForm, { className: classNameContainerInput, message: message, messageType: messageType, forceDisplayMessage: forceDisplayMessage, children: [children, _jsx(FieldError, { message: message, messageType: messageType })] })] }));
12
+ return (_jsxs("div", { className: componentClassName, role: roleContainer, "aria-label": ariaLabelContainer, children: [_jsx("div", { className: classNameContainerLabel, children: _jsx("label", { className: classNames({
13
+ "af-form__group-label--required": classModifier.includes("required"),
14
+ }, "af-form__group-label"), htmlFor: isLabelContainerLinkedToInput ? id : undefined, children: label }) }), _jsxs(FieldForm, { className: classNameContainerInput, message: message, messageType: messageType, forceDisplayMessage: forceDisplayMessage, children: [children, _jsx(FieldError, { message: message, messageType: messageType })] })] }));
12
15
  };
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/TitleHeader/TitleHeader.scss";
2
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
3
3
  type Props = {
4
4
  children?: ReactNode;
5
5
  classModifier?: string;
@@ -9,5 +9,5 @@ type Props = {
9
9
  title: string;
10
10
  toggleMenu?: () => void;
11
11
  };
12
- declare const TitleHeader: ({ children, classModifier, className, isSticky, subtitle, title, toggleMenu, }: Props) => import("react/jsx-runtime").JSX.Element;
13
- export { TitleHeader };
12
+ declare const HeaderTitle: ({ children, classModifier, className, isSticky, subtitle, title, toggleMenu, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export { HeaderTitle };
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "@axa-fr/design-system-slash-css/dist/Layout/Header/TitleHeader/TitleHeader.scss";
2
+ import "@axa-fr/design-system-slash-css/dist/Layout/Header/HeaderTitle/HeaderTitle.scss";
3
3
  import { getComponentClassName } from "../../../utilities";
4
4
  import { ToggleButton } from "../ToggleButton/ToggleButton";
5
5
  import { Action } from "../../../Action/Action";
6
- import { getClassModifier } from "./TitleHeader.helpers";
6
+ import { getClassModifier } from "./HeaderTitle.helpers";
7
7
  const defaultClassName = "af-title-bar";
8
- const TitleHeader = ({ children, classModifier, className, isSticky = true, subtitle, title, toggleMenu, }) => {
8
+ const HeaderTitle = ({ children, classModifier, className, isSticky = true, subtitle, title, toggleMenu, }) => {
9
9
  const componentClassName = getComponentClassName(className, getClassModifier(classModifier, isSticky), defaultClassName);
10
10
  return (_jsx("div", { className: componentClassName, children: _jsxs("div", { className: `container ${defaultClassName}__wrapper`, children: [Boolean(toggleMenu) && (_jsx("div", { className: "burger-container", children: _jsx(ToggleButton, { idControl: "mainmenu", children: _jsx(Action, { className: "btn af-title-bar__mobile-menu af-btn--circle", id: "togglemenu", icon: "menu-hamburger", title: "Toggle menu", onClick: toggleMenu }) }) })), _jsxs("h1", { className: `${defaultClassName}__title`, children: [title, subtitle && (_jsx("span", { className: `${defaultClassName}__subtitle`, children: subtitle }))] }), children] }) }));
11
11
  };
12
- export { TitleHeader };
12
+ export { HeaderTitle };
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useState } from "react";
3
3
  import { NavBar } from "../NavBar";
4
- import { TitleHeader } from "../TitleHeader/TitleHeader";
4
+ import { HeaderTitle } from "../HeaderTitle/HeaderTitle";
5
5
  const MenuTitleWrapper = ({ children, menuVisible, subtitle, title, }) => {
6
6
  const [isMenuVisible, setIsMenuVisible] = useState(menuVisible);
7
7
  const handleClick = useCallback(() => {
@@ -9,6 +9,6 @@ const MenuTitleWrapper = ({ children, menuVisible, subtitle, title, }) => {
9
9
  body.classList.toggle("af-menu-open");
10
10
  setIsMenuVisible((prev) => !prev);
11
11
  }, []);
12
- return (_jsxs(_Fragment, { children: [_jsx(NavBar, { isVisible: isMenuVisible, onClick: handleClick, children: children }), _jsx(TitleHeader, { title: title, subtitle: subtitle, toggleMenu: handleClick })] }));
12
+ return (_jsxs(_Fragment, { children: [_jsx(NavBar, { isVisible: isMenuVisible, onClick: handleClick, children: children }), _jsx(HeaderTitle, { title: title, subtitle: subtitle, toggleMenu: handleClick })] }));
13
13
  };
14
14
  export { MenuTitleWrapper };
@@ -1,7 +1,7 @@
1
1
  export { Header } from "./Header";
2
2
  export { Infos } from "./Infos/Infos";
3
3
  export { Name } from "./Name/Name";
4
- export { TitleHeader } from "./TitleHeader/TitleHeader";
4
+ export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
5
5
  export { ToggleButton } from "./ToggleButton/ToggleButton";
6
6
  export { User } from "./User/User";
7
7
  export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
@@ -1,7 +1,7 @@
1
1
  export { Header } from "./Header";
2
2
  export { Infos } from "./Infos/Infos";
3
3
  export { Name } from "./Name/Name";
4
- export { TitleHeader } from "./TitleHeader/TitleHeader";
4
+ export { HeaderTitle } from "./HeaderTitle/HeaderTitle";
5
5
  export { ToggleButton } from "./ToggleButton/ToggleButton";
6
6
  export { User } from "./User/User";
7
7
  export { NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, } from "./NavBar";
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ export { Badge } from "./Badge/Badge";
6
6
  export { Button } from "./Button/Button";
7
7
  export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
8
8
  export { Choice, ChoiceInput } from "./Form/Choice";
9
- export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
10
9
  export { Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
11
10
  export { Date, DateInput } from "./Form/Date";
11
+ export { File, FileInput, FileTable } from "./Form/File";
12
12
  export { MultiSelect, MultiSelectInput } from "./Form/MultiSelect";
13
13
  export { Number, NumberInput } from "./Form/Number";
14
14
  export { Radio, RadioInput, RadioItem, RadioModes } from "./Form/Radio";
@@ -16,14 +16,15 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
16
16
  export { Slider, SliderInput } from "./Form/Slider";
17
17
  export { Text, TextInput } from "./Form/Text";
18
18
  export { Textarea, TextareaInput } from "./Form/Textarea";
19
- export { File, FileInput, FileTable } from "./Form/File";
20
19
  export { Footer } from "./Layout/Footer";
21
- export { Header, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, TitleHeader, ToggleButton, User, } from "./Layout/Header";
20
+ export { Header, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, HeaderTitle, ToggleButton, User, } from "./Layout/Header";
22
21
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
22
+ export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
23
23
  export { Step, StepBase, Steps } from "./Steps";
24
24
  export { Summary } from "./Summary";
25
25
  export { Svg } from "./Svg";
26
26
  export { Tabs } from "./Tabs/Tabs";
27
27
  export { Title } from "./Title/Title";
28
28
  export { getComponentClassName } from "./utilities";
29
+ export * from "./Accordion";
29
30
  export * from "./Table";
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ export { Badge } from "./Badge/Badge";
6
6
  export { Button } from "./Button/Button";
7
7
  export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
8
8
  export { Choice, ChoiceInput } from "./Form/Choice";
9
- export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
10
9
  export { Field, FieldError, FieldForm, FieldInput, FormClassManager, HelpMessage, InputList, MessageTypes, } from "./Form/core";
11
10
  export { Date, DateInput } from "./Form/Date";
11
+ export { File, FileInput, FileTable } from "./Form/File";
12
12
  export { MultiSelect, MultiSelectInput } from "./Form/MultiSelect";
13
13
  export { Number, NumberInput } from "./Form/Number";
14
14
  export { Radio, RadioInput, RadioItem, RadioModes } from "./Form/Radio";
@@ -16,14 +16,15 @@ export { Select, SelectBase, SelectInput } from "./Form/Select";
16
16
  export { Slider, SliderInput } from "./Form/Slider";
17
17
  export { Text, TextInput } from "./Form/Text";
18
18
  export { Textarea, TextareaInput } from "./Form/Textarea";
19
- export { File, FileInput, FileTable } from "./Form/File";
20
19
  export { Footer } from "./Layout/Footer";
21
- export { Header, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, TitleHeader, ToggleButton, User, } from "./Layout/Header";
20
+ export { Header, Infos, Name, NavBar, NavBarBase, NavBarItem, NavBarItemBase, NavBarItemLink, HeaderTitle, ToggleButton, User, } from "./Layout/Header";
22
21
  export { BooleanModal, Modal, ModalBody, ModalFooter, ModalHeader, ModalHeaderBase, } from "./ModalAgent";
22
+ export { ArticleRestitution, HeaderRestitution, Restitution, RestitutionList, SectionRestitution, SectionRestitutionColumn, SectionRestitutionRow, SectionRestitutionTitle, } from "./Restitution";
23
23
  export { Step, StepBase, Steps } from "./Steps";
24
24
  export { Summary } from "./Summary";
25
25
  export { Svg } from "./Svg";
26
26
  export { Tabs } from "./Tabs/Tabs";
27
27
  export { Title } from "./Title/Title";
28
28
  export { getComponentClassName } from "./utilities";
29
+ export * from "./Accordion";
29
30
  export * from "./Table";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-slash-react",
3
- "version": "0.2.0-beta.347",
3
+ "version": "0.2.0-beta.353",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "homepage": "https://github.com/AxaFrance/design-system#readme",
43
43
  "peerDependencies": {
44
- "@axa-fr/design-system-slash-css": "0.2.0-beta.347",
44
+ "@axa-fr/design-system-slash-css": "0.2.0-beta.353",
45
45
  "@material-symbols/svg-400": ">= 0.19.0",
46
46
  "react": ">= 18"
47
47
  },