@axa-fr/design-system-apollo-react 1.0.3-alpha.231 → 1.0.3-alpha.238

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.
Files changed (31) hide show
  1. package/dist/Form/DateInput/DateInput.helper.d.ts +1 -0
  2. package/dist/Form/DateInput/DateInput.helper.js +20 -0
  3. package/dist/Form/DateInput/DateInputApollo.d.ts +4 -0
  4. package/dist/Form/DateInput/DateInputApollo.js +6 -0
  5. package/dist/Form/DateInput/DateInputCommon.d.ts +17 -0
  6. package/dist/Form/DateInput/DateInputCommon.js +15 -0
  7. package/dist/Form/DateInput/DateInputLF.d.ts +4 -0
  8. package/dist/Form/DateInput/DateInputLF.js +6 -0
  9. package/dist/ProgressBar/ProgressBarApollo.d.ts +2 -0
  10. package/dist/ProgressBar/ProgressBarApollo.js +2 -0
  11. package/dist/ProgressBar/ProgressBarCommon.d.ts +5 -0
  12. package/dist/ProgressBar/ProgressBarCommon.js +6 -0
  13. package/dist/ProgressBar/ProgressBarLF.d.ts +2 -0
  14. package/dist/ProgressBar/ProgressBarLF.js +2 -0
  15. package/dist/ProgressBarGroup/ProgressBarGroupApollo.d.ts +3 -0
  16. package/dist/ProgressBarGroup/ProgressBarGroupApollo.js +5 -0
  17. package/dist/ProgressBarGroup/ProgressBarGroupCommon.d.ts +11 -0
  18. package/dist/ProgressBarGroup/ProgressBarGroupCommon.js +18 -0
  19. package/dist/ProgressBarGroup/ProgressBarGroupLF.d.ts +3 -0
  20. package/dist/ProgressBarGroup/ProgressBarGroupLF.js +5 -0
  21. package/dist/Stepper/StepperApollo.d.ts +3 -0
  22. package/dist/Stepper/StepperApollo.js +5 -0
  23. package/dist/Stepper/StepperCommon.d.ts +13 -0
  24. package/dist/Stepper/StepperCommon.js +7 -0
  25. package/dist/Stepper/StepperLF.d.ts +3 -0
  26. package/dist/Stepper/StepperLF.js +5 -0
  27. package/dist/index.d.ts +4 -0
  28. package/dist/index.js +4 -0
  29. package/dist/indexLF.d.ts +4 -0
  30. package/dist/indexLF.js +4 -0
  31. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ export declare const formatDateInputValue: (type: "date" | "text", value?: Date | string | undefined) => string | undefined;
@@ -0,0 +1,20 @@
1
+ const MAXIMUM_SIZE_DATE = 10;
2
+ export const formatDateInputValue = (type, value) => {
3
+ if (!value)
4
+ return undefined;
5
+ if (value instanceof Date) {
6
+ if (type === "date") {
7
+ return value.toISOString().slice(0, MAXIMUM_SIZE_DATE);
8
+ }
9
+ if (type === "text") {
10
+ const day = String(value.getDate()).padStart(2, "0");
11
+ const month = String(value.getMonth() + 1).padStart(2, "0");
12
+ const year = String(value.getFullYear()).padStart(4, "0");
13
+ return `${day}/${month}/${year}`;
14
+ }
15
+ }
16
+ if (typeof value === "string") {
17
+ return value;
18
+ }
19
+ return undefined;
20
+ };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/DateInput/DateInputApollo.scss";
2
+ import type { ComponentProps } from "react";
3
+ import { DateInput as DateInputCommon } from "./DateInputCommon";
4
+ export declare const DateInput: (props: Omit<ComponentProps<typeof DateInputCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/DateInput/DateInputApollo.scss";
3
+ import { ItemLabel } from "../ItemLabel/ItemLabelApollo";
4
+ import { ItemMessage } from "../ItemMessage/ItemMessageApollo";
5
+ import { DateInput as DateInputCommon } from "./DateInputCommon";
6
+ export const DateInput = (props) => (_jsx(DateInputCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
@@ -0,0 +1,17 @@
1
+ import { ComponentProps, ComponentPropsWithRef, ComponentType } from "react";
2
+ import { ItemLabel } from "../ItemLabel/ItemLabelCommon";
3
+ import { ItemMessage } from "../ItemMessage/ItemMessageCommon";
4
+ type DateInputProps = Omit<ComponentPropsWithRef<"input">, "value"> & {
5
+ classModifier?: string;
6
+ defaultValue?: Date | string;
7
+ value?: Date | string;
8
+ helper?: string;
9
+ error?: string;
10
+ success?: string;
11
+ label: ComponentProps<typeof ItemLabel>["label"];
12
+ type?: "text" | "date";
13
+ ItemLabelComponent: ComponentType<Omit<ComponentProps<typeof ItemLabel>, "ButtonComponent">>;
14
+ ItemMessageComponent: ComponentType<ComponentProps<typeof ItemMessage>>;
15
+ } & Partial<ComponentPropsWithRef<typeof ItemLabel>>;
16
+ declare const DateInput: import("react").ForwardRefExoticComponent<Omit<DateInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
17
+ export { DateInput };
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useId, } from "react";
3
+ import { getComponentClassName } from "../../utilities/getComponentClassName";
4
+ import { formatDateInputValue } from "./DateInput.helper";
5
+ const DateInput = forwardRef(({ className, classModifier = "", defaultValue, value, placeholder = "JJ/MM/AAAA", helper, error, success, label, description, buttonLabel, onButtonClick, ItemLabelComponent, ItemMessageComponent, required, "aria-errormessage": ariaErrormessage, type = "text", ...otherProps }, inputRef) => {
6
+ const componentClassName = getComponentClassName("af-form__input-date", className ?? "", classModifier + (error || ariaErrormessage ? " error" : ""));
7
+ let inputId = useId();
8
+ inputId = otherProps.id ?? inputId;
9
+ const idMessage = useId();
10
+ const idHelp = useId();
11
+ const idLabel = useId();
12
+ return (_jsxs("div", { className: "af-form__input-container", children: [_jsx(ItemLabelComponent, { label: label, description: description, buttonLabel: buttonLabel, onButtonClick: onButtonClick, required: required, inputId: inputId, idLabel: idLabel }), _jsx("input", { ...otherProps, id: inputId, className: componentClassName, type: type, placeholder: placeholder || "", ref: inputRef, defaultValue: formatDateInputValue(type, defaultValue), value: formatDateInputValue(type, value), "aria-labelledby": idLabel, "aria-errormessage": ariaErrormessage ?? idMessage, "aria-invalid": Boolean(error ?? ariaErrormessage), "aria-describedby": idHelp, required: required }), helper && (_jsx("span", { id: idHelp, className: "af-form__input-helper", children: helper })), _jsx(ItemMessageComponent, { id: idMessage, message: error ?? success, messageType: error ? "error" : "success" })] }));
13
+ });
14
+ DateInput.displayName = "DateInput";
15
+ export { DateInput };
@@ -0,0 +1,4 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Form/DateInput/DateInputLF.scss";
2
+ import { ComponentProps } from "react";
3
+ import { DateInput as DateInputCommon } from "./DateInputCommon";
4
+ export declare const DateInput: (props: Omit<ComponentProps<typeof DateInputCommon>, "ItemLabelComponent" | "ItemMessageComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Form/DateInput/DateInputLF.scss";
3
+ import { ItemLabel } from "../ItemLabel/ItemLabelLF";
4
+ import { ItemMessage } from "../ItemMessage/ItemMessageLF";
5
+ import { DateInput as DateInputCommon } from "./DateInputCommon";
6
+ export const DateInput = (props) => (_jsx(DateInputCommon, { ...props, ItemLabelComponent: ItemLabel, ItemMessageComponent: ItemMessage }));
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBar/ProgressBarApollo.scss";
2
+ export { ProgressBar, type ProgressBarProps } from "./ProgressBarCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBar/ProgressBarApollo.scss";
2
+ export { ProgressBar } from "./ProgressBarCommon";
@@ -0,0 +1,5 @@
1
+ export type ProgressBarProps = {
2
+ value: number;
3
+ active?: boolean;
4
+ };
5
+ export declare const ProgressBar: ({ value, active, }: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ const MAX_STEPPER_PROGRESS = 100;
3
+ export const ProgressBar = ({ value = MAX_STEPPER_PROGRESS, active = true, }) => {
4
+ const clampedValue = Math.max(0, Math.min(value, MAX_STEPPER_PROGRESS));
5
+ return (_jsx("div", { role: "progressbar", className: "af-progressbar", "aria-valuemin": 0, "aria-valuemax": MAX_STEPPER_PROGRESS, "aria-valuenow": clampedValue, "aria-current": active, "aria-hidden": !active, "aria-label": `Progression : ${clampedValue}%`, children: _jsx("div", { className: "af-progressbar__progress", style: { width: `${clampedValue}%` } }) }));
6
+ };
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBar/ProgressBarLF.scss";
2
+ export { ProgressBar, type ProgressBarProps } from "./ProgressBarCommon";
@@ -0,0 +1,2 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBar/ProgressBarLF.scss";
2
+ export { ProgressBar } from "./ProgressBarCommon";
@@ -0,0 +1,3 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBarGroup/ProgressBarGroupApollo.scss";
2
+ import { ProgressBarGroupProps } from "./ProgressBarGroupCommon";
3
+ export declare const ProgressBarGroup: (props: Omit<ProgressBarGroupProps, "ProgressBarComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBarGroup/ProgressBarGroupApollo.scss";
3
+ import { ProgressBar } from "../ProgressBar/ProgressBarApollo";
4
+ import { ProgressBarGroup as ProgressBarGroupCommon, } from "./ProgressBarGroupCommon";
5
+ export const ProgressBarGroup = (props) => _jsx(ProgressBarGroupCommon, { ...props, ProgressBarComponent: ProgressBar });
@@ -0,0 +1,11 @@
1
+ import { type ComponentProps, type ComponentType } from "react";
2
+ import { ProgressBar } from "../ProgressBar/ProgressBarCommon";
3
+ export type ProgressBarGroupProps = {
4
+ currentStepProgress?: number;
5
+ currentStep: number;
6
+ nbSteps?: 3 | 4 | 5 | 6 | 7 | 8;
7
+ label?: string;
8
+ className?: string;
9
+ ProgressBarComponent: ComponentType<ComponentProps<typeof ProgressBar>>;
10
+ };
11
+ export declare const ProgressBarGroup: ({ currentStepProgress, nbSteps, currentStep, label, className, ProgressBarComponent, }: ProgressBarGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { useId } from "react";
4
+ const INITIAL_STEPPER_PROGRESS = 10;
5
+ const MAX_STEPPER_PROGRESS = 100;
6
+ export const ProgressBarGroup = ({ currentStepProgress = INITIAL_STEPPER_PROGRESS, nbSteps = 4, currentStep, label, className, ProgressBarComponent, }) => {
7
+ const stepperId = useId();
8
+ const getCurrentProgress = (index) => {
9
+ if (index < currentStep) {
10
+ return MAX_STEPPER_PROGRESS;
11
+ }
12
+ if (index === currentStep) {
13
+ return currentStepProgress || INITIAL_STEPPER_PROGRESS;
14
+ }
15
+ return 0;
16
+ };
17
+ return (_jsx("div", { id: stepperId, role: "group", "aria-label": label, className: classNames("af-progress-bar-group", className), children: [...Array(nbSteps).keys()].map((index) => (_jsx(ProgressBarComponent, { value: getCurrentProgress(index), active: index === currentStep }, `${stepperId}-${index}`))) }));
18
+ };
@@ -0,0 +1,3 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBarGroup/ProgressBarGroupLF.scss";
2
+ import { ProgressBarGroupProps } from "./ProgressBarGroupCommon";
3
+ export declare const ProgressBarGroup: (props: Omit<ProgressBarGroupProps, "ProgressBarComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/ProgressBarGroup/ProgressBarGroupLF.scss";
3
+ import { ProgressBar } from "../ProgressBar/ProgressBarLF";
4
+ import { ProgressBarGroup as ProgressBarGroupCommon, } from "./ProgressBarGroupCommon";
5
+ export const ProgressBarGroup = (props) => _jsx(ProgressBarGroupCommon, { ...props, ProgressBarComponent: ProgressBar });
@@ -0,0 +1,3 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Stepper/StepperApollo.scss";
2
+ import { StepperProps } from "./StepperCommon";
3
+ export declare const Stepper: (props: Omit<StepperProps, "ProgressBarGroupComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Stepper/StepperApollo.scss";
3
+ import { ProgressBarGroup } from "../ProgressBarGroup/ProgressBarGroupApollo";
4
+ import { Stepper as StepperCommon } from "./StepperCommon";
5
+ export const Stepper = (props) => _jsx(StepperCommon, { ...props, ProgressBarGroupComponent: ProgressBarGroup });
@@ -0,0 +1,13 @@
1
+ import { ComponentType, HTMLAttributes } from "react";
2
+ import { ProgressBarGroupProps } from "../ProgressBarGroup/ProgressBarGroupCommon";
3
+ export type StepperProps = {
4
+ currentStepProgress?: number;
5
+ currentStep: number;
6
+ currentSubtitle?: string;
7
+ currentTitle?: string;
8
+ nbSteps?: 3 | 4 | 5 | 6 | 7 | 8;
9
+ helper?: string;
10
+ message?: string;
11
+ ProgressBarGroupComponent: ComponentType<Omit<ProgressBarGroupProps, "ProgressBarComponent">>;
12
+ } & Omit<HTMLAttributes<HTMLDivElement>, "role">;
13
+ export declare const Stepper: ({ currentStepProgress, currentTitle, nbSteps, currentStep, currentSubtitle, className, ProgressBarGroupComponent, helper, message, ...props }: StepperProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { ItemMessage } from "../Form/ItemMessage/ItemMessageCommon";
4
+ export const Stepper = ({ currentStepProgress, currentTitle, nbSteps, currentStep, currentSubtitle, className, ProgressBarGroupComponent, helper, message, ...props }) => {
5
+ const stepperId = useId();
6
+ return (_jsxs("div", { className: "af-stepper", ...props, children: [_jsxs("div", { className: "af-stepper__header", children: [_jsx("h2", { className: "af-stepper__title", "aria-describedby": stepperId, children: currentTitle }), Boolean(currentSubtitle) && (_jsx("p", { className: "af-stepper__subtitle", children: currentSubtitle }))] }), _jsx(ProgressBarGroupComponent, { label: currentTitle, className: className, currentStep: currentStep, nbSteps: nbSteps, currentStepProgress: currentStepProgress }), Boolean(helper) && _jsx("span", { className: "af-stepper__helper", children: helper }), _jsx(ItemMessage, { message: message, messageType: "success" })] }));
7
+ };
@@ -0,0 +1,3 @@
1
+ import "@axa-fr/design-system-apollo-css/dist/Stepper/StepperLF.scss";
2
+ import { StepperProps } from "./StepperCommon";
3
+ export declare const Stepper: (props: Omit<StepperProps, "ProgressBarGroupComponent">) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "@axa-fr/design-system-apollo-css/dist/Stepper/StepperLF.scss";
3
+ import { ProgressBarGroup } from "../ProgressBarGroup/ProgressBarGroupLF";
4
+ import { Stepper as StepperCommon } from "./StepperCommon";
5
+ export const Stepper = (props) => _jsx(StepperCommon, { ...props, ProgressBarGroupComponent: ProgressBarGroup });
package/dist/index.d.ts CHANGED
@@ -19,3 +19,7 @@ export { ClickIcon } from "./ClickIcon/ClickIconApollo";
19
19
  export { Toggle } from "./Toggle/ToggleApollo";
20
20
  export { BasePicture } from "./BasePicture/BasePictureApollo";
21
21
  export { Message, messageVariants, type MessageVariants, } from "./Message/MessageApollo";
22
+ export { ProgressBar } from "./ProgressBar/ProgressBarApollo";
23
+ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupApollo";
24
+ export { Stepper } from "./Stepper/StepperApollo";
25
+ export { DateInput } from "./Form/DateInput/DateInputApollo";
package/dist/index.js CHANGED
@@ -19,3 +19,7 @@ export { ClickIcon } from "./ClickIcon/ClickIconApollo";
19
19
  export { Toggle } from "./Toggle/ToggleApollo";
20
20
  export { BasePicture } from "./BasePicture/BasePictureApollo";
21
21
  export { Message, messageVariants, } from "./Message/MessageApollo";
22
+ export { ProgressBar } from "./ProgressBar/ProgressBarApollo";
23
+ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupApollo";
24
+ export { Stepper } from "./Stepper/StepperApollo";
25
+ export { DateInput } from "./Form/DateInput/DateInputApollo";
package/dist/indexLF.d.ts CHANGED
@@ -18,3 +18,7 @@ export { ClickIcon } from "./ClickIcon/ClickIconLF";
18
18
  export { Toggle } from "./Toggle/ToggleLF";
19
19
  export { BasePicture } from "./BasePicture/BasePictureLF";
20
20
  export { Message, messageVariants, type MessageVariants, } from "./Message/MessageLF";
21
+ export { ProgressBar } from "./ProgressBar/ProgressBarLF";
22
+ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupLF";
23
+ export { Stepper } from "./Stepper/StepperLF";
24
+ export { DateInput } from "./Form/DateInput/DateInputLF";
package/dist/indexLF.js CHANGED
@@ -18,3 +18,7 @@ export { ClickIcon } from "./ClickIcon/ClickIconLF";
18
18
  export { Toggle } from "./Toggle/ToggleLF";
19
19
  export { BasePicture } from "./BasePicture/BasePictureLF";
20
20
  export { Message, messageVariants, } from "./Message/MessageLF";
21
+ export { ProgressBar } from "./ProgressBar/ProgressBarLF";
22
+ export { ProgressBarGroup } from "./ProgressBarGroup/ProgressBarGroupLF";
23
+ export { Stepper } from "./Stepper/StepperLF";
24
+ export { DateInput } from "./Form/DateInput/DateInputLF";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/design-system-apollo-react",
3
- "version": "1.0.3-alpha.231",
3
+ "version": "1.0.3-alpha.238",
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.3-alpha.231",
50
- "@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.231",
49
+ "@axa-fr/design-system-apollo-css": "1.0.3-alpha.238",
50
+ "@axa-fr/design-system-look-and-feel-css": "1.0.3-alpha.238",
51
51
  "@material-symbols/svg-400": ">= 0.19.0",
52
52
  "react": ">= 18"
53
53
  },