@axa-fr/design-system-slash-react 1.0.1 → 1.0.2-RC.2
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/Accordion/Accordion.d.ts +2 -5
- package/dist/Accordion/Accordion.js +0 -4
- package/dist/Accordion/CollapseCard.d.ts +3 -1
- package/dist/Accordion/CollapseCard.js +6 -2
- package/dist/Alert/Alert.d.ts +2 -2
- package/dist/Alert/Alert.js +2 -3
- package/dist/Form/Pass/index.d.ts +2 -0
- package/dist/Form/Pass/index.js +2 -0
- package/dist/Form/Radio/RadioInput.d.ts +2 -2
- package/dist/Form/Radio/RadioInput.js +2 -2
- package/dist/Form/core/FieldForm.d.ts +47 -8
- package/dist/Form/core/FormClassManager.d.ts +2 -2
- package/dist/Layout/Header/HeaderTitle/HeaderTitle.helpers.js +1 -3
- package/dist/Summary/index.js +1 -1
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +4 -4
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import "@axa-fr/design-system-slash-css/dist/Accordion/Accordion.scss";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { CollapseProps } from "./CollapseCard";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
className: string;
|
|
7
|
-
};
|
|
8
|
-
export type EnhancedProps = Partial<typeof defaultProps> & {
|
|
4
|
+
import { TDefaultProps } from "./types";
|
|
5
|
+
export type EnhancedProps = Partial<TDefaultProps> & {
|
|
9
6
|
onlyOne?: boolean;
|
|
10
7
|
className?: string;
|
|
11
8
|
classModifier?: string;
|
|
@@ -5,10 +5,6 @@ import { useId } from "react";
|
|
|
5
5
|
import { getComponentClassName } from "../utilities";
|
|
6
6
|
import { CollapseCard } from "./CollapseCard";
|
|
7
7
|
const defaultClassName = "af-accordion";
|
|
8
|
-
const defaultProps = {
|
|
9
|
-
onlyOne: false,
|
|
10
|
-
className: defaultClassName,
|
|
11
|
-
};
|
|
12
8
|
const Accordion = ({ className, classModifier, children, onlyOne = false, }) => {
|
|
13
9
|
const componentClassName = getComponentClassName(className, classModifier, defaultClassName);
|
|
14
10
|
const id = useId();
|
|
@@ -6,5 +6,7 @@ export type CollapseProps = {
|
|
|
6
6
|
open?: boolean;
|
|
7
7
|
name?: string;
|
|
8
8
|
onToggle?: React.DetailsHTMLAttributes<HTMLDetailsElement>["onToggle"];
|
|
9
|
+
className?: string;
|
|
10
|
+
classModifier?: string;
|
|
9
11
|
};
|
|
10
|
-
export declare const CollapseCard: ({ children, name, title, id, open, onToggle, }: CollapseProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const CollapseCard: ({ children, name, title, id, open, onToggle, className, classModifier, }: CollapseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Body } from "./Body";
|
|
3
3
|
import { Header } from "./Header";
|
|
4
|
-
|
|
4
|
+
import { getComponentClassName } from "../utilities";
|
|
5
|
+
export const CollapseCard = ({ children, name, title, id, open, onToggle, className, classModifier = "", }) => {
|
|
5
6
|
const headerId = id;
|
|
6
|
-
|
|
7
|
+
let newClassModifier = open ? "open" : "";
|
|
8
|
+
newClassModifier += ` ${classModifier}`;
|
|
9
|
+
const componentClassName = getComponentClassName(className, newClassModifier.trim(), "af-accordion__details");
|
|
10
|
+
return (_jsxs("details", { open: open, name: name, className: componentClassName, onToggle: onToggle, children: [_jsx(Header, { id: headerId, children: title }), _jsx(Body, { children: children })] }));
|
|
7
11
|
};
|
package/dist/Alert/Alert.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export declare enum TypeIcons {
|
|
|
8
8
|
}
|
|
9
9
|
export type AlertCoreComponentProps = {
|
|
10
10
|
title: string;
|
|
11
|
-
|
|
11
|
+
icon?: string;
|
|
12
12
|
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
13
13
|
className?: string;
|
|
14
14
|
classModifier?: "error" | "danger" | "info" | "success";
|
|
15
15
|
};
|
|
16
|
-
export declare const Alert: ({ className, onClose,
|
|
16
|
+
export declare const Alert: ({ className, onClose, icon, title, children, classModifier, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Alert/Alert.js
CHANGED
|
@@ -8,8 +8,7 @@ export var TypeIcons;
|
|
|
8
8
|
TypeIcons["info"] = "glyphicon glyphicon-info-sign";
|
|
9
9
|
TypeIcons["success"] = "glyphicon glyphicon-ok";
|
|
10
10
|
})(TypeIcons || (TypeIcons = {}));
|
|
11
|
-
export const Alert = ({ className, onClose,
|
|
11
|
+
export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", }) => {
|
|
12
12
|
const componentClassName = getComponentClassName(className, classModifier, "af-alert");
|
|
13
|
-
return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsxs("div", { className: "af-alert__title", children: [_jsx("div", { className: "af-alert__title-icon", children: _jsx("i", { className:
|
|
14
|
-
TypeIcons[classModifier] }) }), _jsx("div", { className: "af-alert__title-text", children: title }), onClose && (_jsx("button", { type: "button", className: "af-alert__title-icon-close", onClick: onClose, "aria-label": "close", children: _jsx("i", { className: "glyphicon glyphicon-close" }) }))] }), children && (_jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__content-left" }), _jsx("div", { className: "af-alert__content-right", children: children })] }))] }));
|
|
13
|
+
return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsxs("div", { className: "af-alert__title", children: [_jsx("div", { className: "af-alert__title-icon", children: _jsx("i", { className: icon || TypeIcons[classModifier] }) }), _jsx("div", { className: "af-alert__title-text", children: title }), onClose && (_jsx("button", { type: "button", className: "af-alert__title-icon-close", onClick: onClose, "aria-label": "close", children: _jsx("i", { className: "glyphicon glyphicon-close" }) }))] }), children && (_jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__content-left" }), _jsx("div", { className: "af-alert__content-right", children: children })] }))] }));
|
|
15
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RadioModes } from "./Radio";
|
|
2
2
|
declare const RadioInput: import("react").ForwardRefExoticComponent<Omit<{
|
|
3
3
|
message?: string;
|
|
4
|
-
messageType
|
|
4
|
+
messageType?: import("../core").MessageTypes;
|
|
5
5
|
} & {
|
|
6
6
|
className?: string;
|
|
7
7
|
classModifier?: string;
|
|
@@ -17,7 +17,7 @@ declare const RadioInput: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
17
17
|
hasChange: boolean;
|
|
18
18
|
memory: {
|
|
19
19
|
message?: string;
|
|
20
|
-
messageType
|
|
20
|
+
messageType?: import("../core").MessageTypes;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
}, "children"> & {
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { Field, getFirstId, useInputClassModifier, useOptionsWithId, } from "../core";
|
|
4
4
|
import { Radio, RadioModes } from "./Radio";
|
|
5
|
-
const RadioInput = forwardRef(({ mode, messageType, message, className, classModifier = "", isVisible, options, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, children, required, disabled = false, ...radioProps }, inputRef) => {
|
|
5
|
+
const RadioInput = forwardRef(({ mode, messageType, message, className, classModifier = "", isVisible, options, classNameContainerLabel, classNameContainerInput, label, forceDisplayMessage, children, required, disabled = false, ariaLabelContainer, ...radioProps }, inputRef) => {
|
|
6
6
|
const rowModifier = `${classModifier ?? ""}${mode === RadioModes.classic ? " label-top " : ""}`;
|
|
7
7
|
const newOptions = useOptionsWithId(options);
|
|
8
8
|
const firstId = getFirstId(newOptions);
|
|
9
9
|
const { inputClassModifier, inputFieldClassModifier } = useInputClassModifier(classModifier, disabled, Boolean(children), required);
|
|
10
|
-
return (_jsxs(Field, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier + inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: inputClassModifier, ref: inputRef, disabled: disabled, required: required, ...radioProps }), children] }));
|
|
10
|
+
return (_jsxs(Field, { label: label, id: firstId, message: message, messageType: messageType, isVisible: isVisible, forceDisplayMessage: forceDisplayMessage, className: className, classModifier: rowModifier + inputFieldClassModifier, classNameContainerLabel: classNameContainerLabel, classNameContainerInput: classNameContainerInput, roleContainer: "radiogroup", ariaLabelContainer: ariaLabelContainer ?? label?.toString(), isLabelContainerLinkedToInput: false, children: [_jsx(Radio, { options: newOptions, mode: mode, classModifier: inputClassModifier, ref: inputRef, disabled: disabled, required: required, ...radioProps }), children] }));
|
|
11
11
|
});
|
|
12
12
|
RadioInput.displayName = "RadioInput";
|
|
13
13
|
export { RadioInput };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseSyntheticEvent, ReactElement, ReactNode } from "react";
|
|
1
|
+
import { BaseSyntheticEvent, Dispatch, ReactElement, ReactNode, SetStateAction } from "react";
|
|
2
2
|
import { FormClassManager } from "./FormClassManager";
|
|
3
3
|
import { MessageTypes } from "./MessageTypes";
|
|
4
4
|
type TMessage = {
|
|
5
5
|
message?: string;
|
|
6
|
-
messageType
|
|
6
|
+
messageType?: MessageTypes;
|
|
7
7
|
};
|
|
8
8
|
declare const INITIAL_STATE: {
|
|
9
9
|
hasLostFocusOnce: boolean;
|
|
@@ -12,9 +12,9 @@ declare const INITIAL_STATE: {
|
|
|
12
12
|
memory: TMessage;
|
|
13
13
|
};
|
|
14
14
|
type EventFunction = {
|
|
15
|
-
onChange?:
|
|
16
|
-
onBlur?:
|
|
17
|
-
onFocus?:
|
|
15
|
+
onChange?: (event: BaseSyntheticEvent) => void;
|
|
16
|
+
onBlur?: (event: BaseSyntheticEvent) => void;
|
|
17
|
+
onFocus?: (event: BaseSyntheticEvent) => void;
|
|
18
18
|
};
|
|
19
19
|
type FieldFormProps = TMessage & {
|
|
20
20
|
className?: string;
|
|
@@ -30,7 +30,12 @@ type FieldFormProps = TMessage & {
|
|
|
30
30
|
type SetState = (prevState: typeof INITIAL_STATE) => typeof INITIAL_STATE;
|
|
31
31
|
export declare const setStateMemory: ({ message, messageType }: TMessage) => SetState;
|
|
32
32
|
export declare const setStateHasChange: () => SetState;
|
|
33
|
-
export declare const onChangeByState: (setState:
|
|
33
|
+
export declare const onChangeByState: (setState: Dispatch<SetStateAction<{
|
|
34
|
+
hasLostFocusOnce: boolean;
|
|
35
|
+
hasFocus: boolean;
|
|
36
|
+
hasChange: boolean;
|
|
37
|
+
memory: TMessage;
|
|
38
|
+
}>>, stateHasChange: boolean, setStateHasChangeFn?: () => SetState) => false | void;
|
|
34
39
|
export declare const setStateOnBlur: () => SetState;
|
|
35
40
|
export declare const setStateOnFocus: ({ message, messageType }: TMessage) => SetState;
|
|
36
41
|
type GetMessageInfoProps = typeof INITIAL_STATE & Required<Pick<FieldFormProps, "message" | "messageType" | "forceDisplayMessage">>;
|
|
@@ -48,9 +53,43 @@ type AddPropsClone = Omit<RenderChildrenProps, "children"> & {
|
|
|
48
53
|
classModifier: string;
|
|
49
54
|
name: string;
|
|
50
55
|
getMessageClassModifierFn?: typeof FormClassManager.getMessageClassModifier;
|
|
51
|
-
eventWrapperFn?:
|
|
56
|
+
eventWrapperFn?: ({ wrapper, props }: EventWrapperProps) => {
|
|
57
|
+
onChange: (ev: BaseSyntheticEvent) => void;
|
|
58
|
+
onBlur: (ev: BaseSyntheticEvent) => void;
|
|
59
|
+
onFocus: (ev: BaseSyntheticEvent) => void;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export declare const addPropsClone: ({ message, messageType, classModifier, wrapper, child, name, getMessageClassModifierFn, eventWrapperFn, ...rest }: AddPropsClone) => {
|
|
63
|
+
isVisible: boolean;
|
|
64
|
+
message?: undefined;
|
|
65
|
+
classModifier?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
message: string | undefined;
|
|
68
|
+
isVisible?: undefined;
|
|
69
|
+
classModifier?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
classModifier: string;
|
|
72
|
+
isVisible?: undefined;
|
|
73
|
+
message?: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
classModifier: string;
|
|
76
|
+
onChange: (ev: BaseSyntheticEvent) => void;
|
|
77
|
+
onBlur: (ev: BaseSyntheticEvent) => void;
|
|
78
|
+
onFocus: (ev: BaseSyntheticEvent) => void;
|
|
79
|
+
isVisible?: undefined;
|
|
80
|
+
message?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
onChange: (ev: BaseSyntheticEvent) => void;
|
|
83
|
+
onBlur: (ev: BaseSyntheticEvent) => void;
|
|
84
|
+
onFocus: (ev: BaseSyntheticEvent) => void;
|
|
85
|
+
isVisible?: undefined;
|
|
86
|
+
message?: undefined;
|
|
87
|
+
classModifier?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
isVisible?: undefined;
|
|
90
|
+
message?: undefined;
|
|
91
|
+
classModifier?: undefined;
|
|
52
92
|
};
|
|
53
|
-
export declare const addPropsClone: ({ message, messageType, classModifier, wrapper, child, name, getMessageClassModifierFn, eventWrapperFn, ...rest }: AddPropsClone) => any;
|
|
54
93
|
type RenderChildrenProps = {
|
|
55
94
|
wrapper: EventFunction;
|
|
56
95
|
} & Partial<Pick<FieldFormProps, "children">> & ReturnType<typeof getMessageInfo>;
|
|
@@ -2,6 +2,6 @@ import { ReactNode } from "react";
|
|
|
2
2
|
export declare const FormClassManager: {
|
|
3
3
|
getFieldInputClassModifier: (modifier: string, disabled: boolean) => string;
|
|
4
4
|
getInputClassModifier: (modifier: string, children: ReactNode) => string;
|
|
5
|
-
getModifier: (messageType: string) => string;
|
|
6
|
-
getMessageClassModifier: (messageType
|
|
5
|
+
getModifier: (messageType: string | undefined) => string;
|
|
6
|
+
getMessageClassModifier: (messageType?: "error" | "success" | "warning", message?: string | null, modifier?: string) => string;
|
|
7
7
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export const getClassModifier = (classModifier, isSticky) => {
|
|
2
2
|
if (isSticky) {
|
|
3
|
-
return classModifier
|
|
4
|
-
? "sticky"
|
|
5
|
-
: `${classModifier} sticky`.trim();
|
|
3
|
+
return !classModifier ? "sticky" : `${classModifier} sticky`.trim();
|
|
6
4
|
}
|
|
7
5
|
return classModifier;
|
|
8
6
|
};
|
package/dist/Summary/index.js
CHANGED
|
@@ -5,5 +5,5 @@ export const Summary = ({ messages = [], isVisible = true, title = "Invalid form
|
|
|
5
5
|
if (!messages || !isVisible || messagesNotBlank.length === 0) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
return (_jsx(Alert, {
|
|
8
|
+
return (_jsx(Alert, { icon: "glyphicon glyphicon-warning-sign", title: title, classModifier: classModifier, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${message}`))) }) }));
|
|
9
9
|
};
|
package/dist/Table/index.d.ts
CHANGED
package/dist/Table/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { Date, DateInput } from "./Form/Date";
|
|
|
11
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
|
+
export { Pass, PassInput } from "./Form/Pass";
|
|
14
15
|
export { Radio, RadioInput, RadioItem, RadioModes } from "./Form/Radio";
|
|
15
16
|
export { Select, SelectBase, SelectInput } from "./Form/Select";
|
|
16
17
|
export { Slider, SliderInput } from "./Form/Slider";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { Date, DateInput } from "./Form/Date";
|
|
|
11
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
|
+
export { Pass, PassInput } from "./Form/Pass";
|
|
14
15
|
export { Radio, RadioInput, RadioItem, RadioModes } from "./Form/Radio";
|
|
15
16
|
export { Select, SelectBase, SelectInput } from "./Form/Select";
|
|
16
17
|
export { Slider, SliderInput } from "./Form/Slider";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-RC.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@axa-fr/design-system-slash-css": "1.0.
|
|
48
|
+
"@axa-fr/design-system-slash-css": "1.0.2-RC.2+1",
|
|
49
49
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
50
50
|
"react": ">= 18"
|
|
51
51
|
},
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"@types/jest-axe": "^3.5.9",
|
|
88
88
|
"@types/node": "^20.14.9",
|
|
89
89
|
"@types/react": "^18.3.2",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
91
|
-
"@typescript-eslint/parser": "^
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
91
|
+
"@typescript-eslint/parser": "^8.17.0",
|
|
92
92
|
"@vitejs/plugin-react": "^4.3.1",
|
|
93
93
|
"@vitest/coverage-v8": "^2.0.5",
|
|
94
94
|
"@vitest/ui": "^2.1.2",
|