@axa-fr/design-system-slash-react 1.2.1-alpha.39 → 1.2.1-alpha.41
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/Form/Radio/RadioInput.d.ts +1 -1
- package/dist/Form/Select/Select.d.ts +52 -52
- package/dist/Form/Select/SelectInput.d.ts +52 -52
- package/dist/Messages/Message.d.ts +47 -0
- package/dist/Messages/Message.js +43 -0
- package/dist/Summary/index.d.ts +3 -3
- package/dist/Summary/index.js +3 -2
- package/dist/Table/Pagination/Li.js +1 -4
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -1
- package/dist/utilities/helpers/getComponentClassName.d.ts +7 -0
- package/dist/utilities/helpers/getComponentClassName.js +14 -0
- package/package.json +2 -2
- package/dist/Alert/Alert.d.ts +0 -17
- package/dist/Alert/Alert.js +0 -14
|
@@ -37,7 +37,7 @@ declare const RadioInput: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
37
37
|
optionClassName?: string;
|
|
38
38
|
label?: import("react").ReactNode;
|
|
39
39
|
isChecked?: boolean;
|
|
40
|
-
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "
|
|
40
|
+
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "className" | "id" | "label"> & {
|
|
41
41
|
options: import("../core").Option[];
|
|
42
42
|
mode?: keyof typeof RadioModes;
|
|
43
43
|
}, "ref"> & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,61 +1,14 @@
|
|
|
1
1
|
import { OptionHTMLAttributes } from "react";
|
|
2
2
|
declare const Select: import("react").ForwardRefExoticComponent<(Omit<Omit<{
|
|
3
|
-
form?: string | undefined | undefined;
|
|
4
|
-
slot?: string | undefined | undefined;
|
|
5
|
-
style?: import("react").CSSProperties | undefined;
|
|
6
|
-
title?: string | undefined | undefined;
|
|
7
|
-
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
8
|
-
key?: import("react").Key | null | undefined;
|
|
9
|
-
defaultChecked?: boolean | undefined | undefined;
|
|
10
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
11
|
-
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
12
3
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
13
|
-
accessKey?: string | undefined | undefined;
|
|
14
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
15
|
-
autoFocus?: boolean | undefined | undefined;
|
|
16
4
|
className?: string | undefined | undefined;
|
|
17
|
-
|
|
18
|
-
contextMenu?: string | undefined | undefined;
|
|
19
|
-
dir?: string | undefined | undefined;
|
|
20
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
21
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
22
|
-
hidden?: boolean | undefined | undefined;
|
|
5
|
+
color?: string | undefined | undefined;
|
|
23
6
|
id?: string | undefined | undefined;
|
|
24
7
|
lang?: string | undefined | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
tabIndex?: number | undefined | undefined;
|
|
28
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
29
|
-
radioGroup?: string | undefined | undefined;
|
|
8
|
+
name?: string | undefined | undefined;
|
|
9
|
+
style?: import("react").CSSProperties | undefined;
|
|
30
10
|
role?: import("react").AriaRole | undefined;
|
|
31
|
-
|
|
32
|
-
content?: string | undefined | undefined;
|
|
33
|
-
datatype?: string | undefined | undefined;
|
|
34
|
-
inlist?: any;
|
|
35
|
-
prefix?: string | undefined | undefined;
|
|
36
|
-
property?: string | undefined | undefined;
|
|
37
|
-
rel?: string | undefined | undefined;
|
|
38
|
-
resource?: string | undefined | undefined;
|
|
39
|
-
rev?: string | undefined | undefined;
|
|
40
|
-
typeof?: string | undefined | undefined;
|
|
41
|
-
vocab?: string | undefined | undefined;
|
|
42
|
-
autoCorrect?: string | undefined | undefined;
|
|
43
|
-
autoSave?: string | undefined | undefined;
|
|
44
|
-
color?: string | undefined | undefined;
|
|
45
|
-
itemProp?: string | undefined | undefined;
|
|
46
|
-
itemScope?: boolean | undefined | undefined;
|
|
47
|
-
itemType?: string | undefined | undefined;
|
|
48
|
-
itemID?: string | undefined | undefined;
|
|
49
|
-
itemRef?: string | undefined | undefined;
|
|
50
|
-
results?: number | undefined | undefined;
|
|
51
|
-
security?: string | undefined | undefined;
|
|
52
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
53
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
54
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
55
|
-
popoverTarget?: string | undefined | undefined;
|
|
56
|
-
inert?: boolean | undefined | undefined;
|
|
57
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
58
|
-
is?: string | undefined | undefined;
|
|
11
|
+
tabIndex?: number | undefined | undefined;
|
|
59
12
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
60
13
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
61
14
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
@@ -281,9 +234,56 @@ declare const Select: import("react").ForwardRefExoticComponent<(Omit<Omit<{
|
|
|
281
234
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
282
235
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
283
236
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
237
|
+
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
238
|
+
form?: string | undefined | undefined;
|
|
239
|
+
slot?: string | undefined | undefined;
|
|
240
|
+
title?: string | undefined | undefined;
|
|
241
|
+
dir?: string | undefined | undefined;
|
|
284
242
|
classModifier?: string | undefined;
|
|
243
|
+
key?: import("react").Key | null | undefined;
|
|
244
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
245
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
246
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
247
|
+
accessKey?: string | undefined | undefined;
|
|
248
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
249
|
+
autoFocus?: boolean | undefined | undefined;
|
|
250
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
251
|
+
contextMenu?: string | undefined | undefined;
|
|
252
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
253
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
254
|
+
hidden?: boolean | undefined | undefined;
|
|
255
|
+
nonce?: string | undefined | undefined;
|
|
256
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
257
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
258
|
+
radioGroup?: string | undefined | undefined;
|
|
259
|
+
about?: string | undefined | undefined;
|
|
260
|
+
content?: string | undefined | undefined;
|
|
261
|
+
datatype?: string | undefined | undefined;
|
|
262
|
+
inlist?: any;
|
|
263
|
+
prefix?: string | undefined | undefined;
|
|
264
|
+
property?: string | undefined | undefined;
|
|
265
|
+
rel?: string | undefined | undefined;
|
|
266
|
+
resource?: string | undefined | undefined;
|
|
267
|
+
rev?: string | undefined | undefined;
|
|
268
|
+
typeof?: string | undefined | undefined;
|
|
269
|
+
vocab?: string | undefined | undefined;
|
|
270
|
+
autoCorrect?: string | undefined | undefined;
|
|
271
|
+
autoSave?: string | undefined | undefined;
|
|
272
|
+
itemProp?: string | undefined | undefined;
|
|
273
|
+
itemScope?: boolean | undefined | undefined;
|
|
274
|
+
itemType?: string | undefined | undefined;
|
|
275
|
+
itemID?: string | undefined | undefined;
|
|
276
|
+
itemRef?: string | undefined | undefined;
|
|
277
|
+
results?: number | undefined | undefined;
|
|
278
|
+
security?: string | undefined | undefined;
|
|
279
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
280
|
+
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
281
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
282
|
+
popoverTarget?: string | undefined | undefined;
|
|
283
|
+
inert?: boolean | undefined | undefined;
|
|
284
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
285
|
+
is?: string | undefined | undefined;
|
|
285
286
|
disabled?: boolean | undefined | undefined;
|
|
286
|
-
name?: string | undefined | undefined;
|
|
287
287
|
value?: string | number | readonly string[] | undefined;
|
|
288
288
|
required?: boolean | undefined | undefined;
|
|
289
289
|
autoComplete?: string | undefined | undefined;
|
|
@@ -33,62 +33,15 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
|
|
|
33
33
|
isLabelContainerLinkedToInput?: boolean;
|
|
34
34
|
errorId?: string;
|
|
35
35
|
} & Omit<Omit<{
|
|
36
|
-
form?: string | undefined | undefined;
|
|
37
|
-
slot?: string | undefined | undefined;
|
|
38
|
-
style?: import("react").CSSProperties | undefined;
|
|
39
|
-
title?: string | undefined | undefined;
|
|
40
|
-
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
41
|
-
key?: import("react").Key | null | undefined;
|
|
42
|
-
defaultChecked?: boolean | undefined | undefined;
|
|
43
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
44
|
-
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
45
36
|
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
46
|
-
accessKey?: string | undefined | undefined;
|
|
47
|
-
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
48
|
-
autoFocus?: boolean | undefined | undefined;
|
|
49
37
|
className?: string | undefined | undefined;
|
|
50
|
-
|
|
51
|
-
contextMenu?: string | undefined | undefined;
|
|
52
|
-
dir?: string | undefined | undefined;
|
|
53
|
-
draggable?: (boolean | "true" | "false") | undefined;
|
|
54
|
-
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
55
|
-
hidden?: boolean | undefined | undefined;
|
|
38
|
+
color?: string | undefined | undefined;
|
|
56
39
|
id?: string | undefined | undefined;
|
|
57
40
|
lang?: string | undefined | undefined;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
tabIndex?: number | undefined | undefined;
|
|
61
|
-
translate?: "yes" | "no" | undefined | undefined;
|
|
62
|
-
radioGroup?: string | undefined | undefined;
|
|
41
|
+
name?: string | undefined | undefined;
|
|
42
|
+
style?: import("react").CSSProperties | undefined;
|
|
63
43
|
role?: import("react").AriaRole | undefined;
|
|
64
|
-
|
|
65
|
-
content?: string | undefined | undefined;
|
|
66
|
-
datatype?: string | undefined | undefined;
|
|
67
|
-
inlist?: any;
|
|
68
|
-
prefix?: string | undefined | undefined;
|
|
69
|
-
property?: string | undefined | undefined;
|
|
70
|
-
rel?: string | undefined | undefined;
|
|
71
|
-
resource?: string | undefined | undefined;
|
|
72
|
-
rev?: string | undefined | undefined;
|
|
73
|
-
typeof?: string | undefined | undefined;
|
|
74
|
-
vocab?: string | undefined | undefined;
|
|
75
|
-
autoCorrect?: string | undefined | undefined;
|
|
76
|
-
autoSave?: string | undefined | undefined;
|
|
77
|
-
color?: string | undefined | undefined;
|
|
78
|
-
itemProp?: string | undefined | undefined;
|
|
79
|
-
itemScope?: boolean | undefined | undefined;
|
|
80
|
-
itemType?: string | undefined | undefined;
|
|
81
|
-
itemID?: string | undefined | undefined;
|
|
82
|
-
itemRef?: string | undefined | undefined;
|
|
83
|
-
results?: number | undefined | undefined;
|
|
84
|
-
security?: string | undefined | undefined;
|
|
85
|
-
unselectable?: "on" | "off" | undefined | undefined;
|
|
86
|
-
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
87
|
-
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
88
|
-
popoverTarget?: string | undefined | undefined;
|
|
89
|
-
inert?: boolean | undefined | undefined;
|
|
90
|
-
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
91
|
-
is?: string | undefined | undefined;
|
|
44
|
+
tabIndex?: number | undefined | undefined;
|
|
92
45
|
"aria-activedescendant"?: string | undefined | undefined;
|
|
93
46
|
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
94
47
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
@@ -314,9 +267,56 @@ declare const SelectInput: import("react").ForwardRefExoticComponent<(Omit<Omit<
|
|
|
314
267
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
315
268
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
316
269
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLSelectElement> | undefined;
|
|
270
|
+
ref?: import("react").Ref<HTMLSelectElement> | undefined;
|
|
271
|
+
form?: string | undefined | undefined;
|
|
272
|
+
slot?: string | undefined | undefined;
|
|
273
|
+
title?: string | undefined | undefined;
|
|
274
|
+
dir?: string | undefined | undefined;
|
|
317
275
|
classModifier?: string | undefined;
|
|
276
|
+
key?: import("react").Key | null | undefined;
|
|
277
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
278
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
279
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
280
|
+
accessKey?: string | undefined | undefined;
|
|
281
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
282
|
+
autoFocus?: boolean | undefined | undefined;
|
|
283
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
284
|
+
contextMenu?: string | undefined | undefined;
|
|
285
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
286
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
287
|
+
hidden?: boolean | undefined | undefined;
|
|
288
|
+
nonce?: string | undefined | undefined;
|
|
289
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
290
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
291
|
+
radioGroup?: string | undefined | undefined;
|
|
292
|
+
about?: string | undefined | undefined;
|
|
293
|
+
content?: string | undefined | undefined;
|
|
294
|
+
datatype?: string | undefined | undefined;
|
|
295
|
+
inlist?: any;
|
|
296
|
+
prefix?: string | undefined | undefined;
|
|
297
|
+
property?: string | undefined | undefined;
|
|
298
|
+
rel?: string | undefined | undefined;
|
|
299
|
+
resource?: string | undefined | undefined;
|
|
300
|
+
rev?: string | undefined | undefined;
|
|
301
|
+
typeof?: string | undefined | undefined;
|
|
302
|
+
vocab?: string | undefined | undefined;
|
|
303
|
+
autoCorrect?: string | undefined | undefined;
|
|
304
|
+
autoSave?: string | undefined | undefined;
|
|
305
|
+
itemProp?: string | undefined | undefined;
|
|
306
|
+
itemScope?: boolean | undefined | undefined;
|
|
307
|
+
itemType?: string | undefined | undefined;
|
|
308
|
+
itemID?: string | undefined | undefined;
|
|
309
|
+
itemRef?: string | undefined | undefined;
|
|
310
|
+
results?: number | undefined | undefined;
|
|
311
|
+
security?: string | undefined | undefined;
|
|
312
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
313
|
+
popover?: "" | "auto" | "manual" | undefined | undefined;
|
|
314
|
+
popoverTargetAction?: "toggle" | "show" | "hide" | undefined | undefined;
|
|
315
|
+
popoverTarget?: string | undefined | undefined;
|
|
316
|
+
inert?: boolean | undefined | undefined;
|
|
317
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
318
|
+
is?: string | undefined | undefined;
|
|
318
319
|
disabled?: boolean | undefined | undefined;
|
|
319
|
-
name?: string | undefined | undefined;
|
|
320
320
|
value?: string | number | readonly string[] | undefined;
|
|
321
321
|
required?: boolean | undefined | undefined;
|
|
322
322
|
autoComplete?: string | undefined | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
|
|
2
|
+
import { MouseEventHandler, PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
export type MessageVariants = "error" | "warning" | "info" | "success";
|
|
4
|
+
export type MessageProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Content of the message title. Can be a string or a ReactNode.
|
|
7
|
+
*/
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* URL of an svg icon to display in the sidebar of the message.
|
|
11
|
+
* If not provided, a default icon based on the classModifier will be used.
|
|
12
|
+
* <strong>This not recommended to use</strong>. Only use as an escape hatch.
|
|
13
|
+
*/
|
|
14
|
+
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* handler for the close button click event.
|
|
17
|
+
* If not provided, the close button will not be displayed.
|
|
18
|
+
*/
|
|
19
|
+
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
20
|
+
/**
|
|
21
|
+
* If you want to add a custom class to the component.
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Message className="my-custom-class" title="My message">
|
|
25
|
+
* ```
|
|
26
|
+
* will produce
|
|
27
|
+
* ```html
|
|
28
|
+
* <div class="my-custom-class af-alert">My message</div>
|
|
29
|
+
*/
|
|
30
|
+
className?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use `variant` instead.
|
|
33
|
+
*/
|
|
34
|
+
classModifier?: MessageVariants | "danger";
|
|
35
|
+
/**
|
|
36
|
+
* Variant of the message.
|
|
37
|
+
* This will determine the icon and the style of the message.
|
|
38
|
+
*/
|
|
39
|
+
variant?: MessageVariants;
|
|
40
|
+
/**
|
|
41
|
+
* Aria label for the close button.
|
|
42
|
+
* This is important for accessibility, use a meaningful label to describe the action.
|
|
43
|
+
* @default "close"
|
|
44
|
+
*/
|
|
45
|
+
closeButtonAriaLabel?: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const Message: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: PropsWithChildren<MessageProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "@axa-fr/design-system-slash-css/dist/Message/Message.css";
|
|
3
|
+
import successSvg from "@material-symbols/svg-400/outlined/check_circle-fill.svg";
|
|
4
|
+
import closeSvg from "@material-symbols/svg-400/outlined/close.svg";
|
|
5
|
+
import errorSvg from "@material-symbols/svg-400/outlined/error-fill.svg";
|
|
6
|
+
import infoSvg from "@material-symbols/svg-400/outlined/info-fill.svg";
|
|
7
|
+
import warningSvg from "@material-symbols/svg-400/outlined/warning-fill.svg";
|
|
8
|
+
import { Svg } from "../Svg";
|
|
9
|
+
import { getComponentClassNameWithUserClassname } from "../utilities/helpers/getComponentClassName";
|
|
10
|
+
const getIconUrl = (type) => {
|
|
11
|
+
switch (type) {
|
|
12
|
+
case "info":
|
|
13
|
+
return infoSvg;
|
|
14
|
+
case "success":
|
|
15
|
+
return successSvg;
|
|
16
|
+
case "error":
|
|
17
|
+
return errorSvg;
|
|
18
|
+
case "warning":
|
|
19
|
+
return warningSvg;
|
|
20
|
+
default:
|
|
21
|
+
return errorSvg;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const getVariant = (classModifier, variant) => {
|
|
25
|
+
if (variant) {
|
|
26
|
+
return variant;
|
|
27
|
+
}
|
|
28
|
+
if (classModifier) {
|
|
29
|
+
return classModifier === "danger" ? "warning" : classModifier;
|
|
30
|
+
}
|
|
31
|
+
return "error"; // Default variant
|
|
32
|
+
};
|
|
33
|
+
export const Message = ({ className, onClose, icon, title, children, classModifier = "error", variant, // Backward compatibility
|
|
34
|
+
closeButtonAriaLabel = "close", }) => {
|
|
35
|
+
const safeVariant = getVariant(classModifier, variant);
|
|
36
|
+
const componentClassName = getComponentClassNameWithUserClassname({
|
|
37
|
+
componentClassName: "af-alert",
|
|
38
|
+
userClassName: className,
|
|
39
|
+
classModifier: safeVariant,
|
|
40
|
+
});
|
|
41
|
+
const iconSrc = icon ?? getIconUrl(safeVariant);
|
|
42
|
+
return (_jsxs("div", { className: componentClassName, role: "alert", children: [_jsx("div", { className: "af-alert__sidebar", children: _jsx("div", { className: "af-alert__indicator", children: _jsx(Svg, { src: iconSrc, className: "af-alert__icon", role: "presentation" }) }) }), _jsxs("div", { className: "af-alert__content", children: [_jsx("div", { className: "af-alert__title", children: title }), children] }), onClose ? (_jsx("button", { onClick: onClose, "aria-label": closeButtonAriaLabel, type: "button", className: "af-alert__close-button", children: _jsx(Svg, { src: closeSvg, className: "af-alert__close-icon", role: "presentation" }) })) : null] }));
|
|
43
|
+
};
|
package/dist/Summary/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type SummaryProps = Omit<
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { type MessageProps } from "../Messages/Message";
|
|
3
|
+
type SummaryProps = Omit<MessageProps, "title"> & {
|
|
4
4
|
title?: string;
|
|
5
5
|
messages?: ReactNode[];
|
|
6
6
|
isVisible?: boolean;
|
package/dist/Summary/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Message } from "../Messages/Message";
|
|
3
3
|
import { generateId } from "../utilities/helpers/generateId";
|
|
4
4
|
export const Summary = ({ messages = [], isVisible = true, title = "Invalid form", classModifier = "error", ...args }) => {
|
|
5
5
|
const messagesNotBlank = messages.filter((message) => Boolean(message));
|
|
6
6
|
if (!messages || !isVisible || messagesNotBlank.length === 0) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
const variant = classModifier === "danger" ? "warning" : classModifier;
|
|
10
|
+
return (_jsx(Message, { icon: "glyphicon glyphicon-warning-sign", title: title, variant: variant, ...args, children: _jsx("ul", { className: "af-summary__message-list", children: messages.map((message) => (_jsx("li", { className: "af-summary__message-item", children: message }, `message_${generateId({ message })}`))) }) }));
|
|
10
11
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import classNames from "classnames";
|
|
3
2
|
const onClick = ({ onChange, value }) => (event) => {
|
|
4
3
|
event.preventDefault();
|
|
5
4
|
onChange({
|
|
@@ -10,8 +9,6 @@ const Li = ({ isVisible, active, value, ...props }) => {
|
|
|
10
9
|
if (!isVisible) {
|
|
11
10
|
return null;
|
|
12
11
|
}
|
|
13
|
-
return (_jsx("li", { className:
|
|
14
|
-
"af-pager__item--active": active,
|
|
15
|
-
}), children: _jsx("a", { className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
|
|
12
|
+
return (_jsx("li", { className: "af-pager__item", children: _jsx("a", { "aria-current": active ? "page" : undefined, className: "af-pager__item-link", href: "/#", onClick: onClick({ ...props, value }), children: _jsx("span", { children: value }) }) }));
|
|
16
13
|
};
|
|
17
14
|
export { Li };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
|
|
4
4
|
import "@fontsource/source-sans-pro";
|
|
5
|
+
import { Message } from "./Messages/Message";
|
|
5
6
|
export { Action } from "./Action/Action";
|
|
6
|
-
export { Alert } from "./Alert/Alert";
|
|
7
7
|
export { Badge } from "./Badge/Badge";
|
|
8
8
|
export { Button } from "./Button/Button";
|
|
9
9
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
@@ -31,8 +31,15 @@ export { Svg } from "./Svg";
|
|
|
31
31
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
32
|
export { Title } from "./Title/Title";
|
|
33
33
|
export { getComponentClassName } from "./utilities";
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
36
|
+
* @see {@link Message}
|
|
37
|
+
*/
|
|
38
|
+
declare const Alert: ({ className, onClose, icon, title, children, classModifier, variant, closeButtonAriaLabel, }: import("react").PropsWithChildren<import("./Messages/Message").MessageProps>) => import("react/jsx-runtime").JSX.Element;
|
|
34
39
|
export * from "./Accordion";
|
|
40
|
+
export { type MessageProps, type MessageVariants } from "./Messages/Message";
|
|
35
41
|
export * from "./Popover";
|
|
36
42
|
export * from "./Table";
|
|
43
|
+
export { Alert, Message };
|
|
37
44
|
export { HelpButton } from "./HelpButton";
|
|
38
45
|
export { Loader } from "./Loader/Loader";
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import "@axa-fr/design-system-slash-css/dist/common/icons.scss";
|
|
|
2
2
|
import "@axa-fr/design-system-slash-css/dist/common/reboot.scss";
|
|
3
3
|
import "@axa-fr/design-system-slash-css/dist/common/tokens.css";
|
|
4
4
|
import "@fontsource/source-sans-pro";
|
|
5
|
+
import { Message } from "./Messages/Message";
|
|
5
6
|
export { Action } from "./Action/Action";
|
|
6
|
-
export { Alert } from "./Alert/Alert";
|
|
7
7
|
export { Badge } from "./Badge/Badge";
|
|
8
8
|
export { Button } from "./Button/Button";
|
|
9
9
|
export { Checkbox, CheckboxInput, CheckboxItem, CheckboxModes, } from "./Form/Checkbox";
|
|
@@ -31,8 +31,14 @@ export { Svg } from "./Svg";
|
|
|
31
31
|
export { Tabs } from "./Tabs/Tabs";
|
|
32
32
|
export { Title } from "./Title/Title";
|
|
33
33
|
export { getComponentClassName } from "./utilities";
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated `Alert` has been renamed `Message` in order to comply with UX naming of components. Use `Message` instead.
|
|
36
|
+
* @see {@link Message}
|
|
37
|
+
*/
|
|
38
|
+
const Alert = Message;
|
|
34
39
|
export * from "./Accordion";
|
|
35
40
|
export * from "./Popover";
|
|
36
41
|
export * from "./Table";
|
|
42
|
+
export { Alert, Message };
|
|
37
43
|
export { HelpButton } from "./HelpButton";
|
|
38
44
|
export { Loader } from "./Loader/Loader";
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
export declare const getComponentClassName: (className?: string, classModifier?: string, defaultClassName?: string) => string;
|
|
2
|
+
type getComponentClassNameWithUserClassnameParams = {
|
|
3
|
+
userClassName?: string;
|
|
4
|
+
classModifier?: string;
|
|
5
|
+
componentClassName: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getComponentClassNameWithUserClassname: ({ componentClassName, userClassName, classModifier, }: getComponentClassNameWithUserClassnameParams) => string;
|
|
8
|
+
export {};
|
|
@@ -26,3 +26,17 @@ export const getComponentClassName = (className, classModifier, defaultClassName
|
|
|
26
26
|
});
|
|
27
27
|
return classNames(classNameToUse, modifiersObject);
|
|
28
28
|
};
|
|
29
|
+
export const getComponentClassNameWithUserClassname = ({ componentClassName, userClassName, classModifier, }) => {
|
|
30
|
+
// Fail fast, when no className or componentClassName we don't want to loop on modifier
|
|
31
|
+
if (!componentClassName) {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
const classWithoutModifier = getLastClassName(componentClassName);
|
|
35
|
+
const modifiers = listClassModifier(classModifier);
|
|
36
|
+
const modifiersObject = modifiers
|
|
37
|
+
.filter((it) => /\S/.test(it))
|
|
38
|
+
.map((it) => {
|
|
39
|
+
return `${classWithoutModifier}--${it}`;
|
|
40
|
+
});
|
|
41
|
+
return classNames(componentClassName, modifiersObject, userClassName);
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axa-fr/design-system-slash-react",
|
|
3
|
-
"version": "1.2.1-alpha.
|
|
3
|
+
"version": "1.2.1-alpha.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/AxaFrance/design-system#readme",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@axa-fr/design-system-slash-css": "1.2.1-alpha.
|
|
50
|
+
"@axa-fr/design-system-slash-css": "1.2.1-alpha.41",
|
|
51
51
|
"@material-symbols/svg-400": ">= 0.19.0",
|
|
52
52
|
"react": ">= 18"
|
|
53
53
|
},
|
package/dist/Alert/Alert.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MouseEventHandler, PropsWithChildren } from "react";
|
|
2
|
-
import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
|
|
3
|
-
export declare enum TypeIcons {
|
|
4
|
-
error = "glyphicon glyphicon-minus-sign",
|
|
5
|
-
danger = "glyphicon glyphicon-alert",
|
|
6
|
-
info = "glyphicon glyphicon-info-sign",
|
|
7
|
-
success = "glyphicon glyphicon-ok"
|
|
8
|
-
}
|
|
9
|
-
export type AlertCoreComponentProps = {
|
|
10
|
-
title: string;
|
|
11
|
-
icon?: string;
|
|
12
|
-
onClose?: MouseEventHandler<HTMLButtonElement>;
|
|
13
|
-
className?: string;
|
|
14
|
-
classModifier?: "error" | "danger" | "info" | "success";
|
|
15
|
-
closeButtonAriaLabel?: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const Alert: ({ className, onClose, icon, title, children, classModifier, closeButtonAriaLabel, }: PropsWithChildren<AlertCoreComponentProps>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/Alert/Alert.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getComponentClassName } from "../utilities";
|
|
3
|
-
import "@axa-fr/design-system-slash-css/dist/Alert/Alert.scss";
|
|
4
|
-
export var TypeIcons;
|
|
5
|
-
(function (TypeIcons) {
|
|
6
|
-
TypeIcons["error"] = "glyphicon glyphicon-minus-sign";
|
|
7
|
-
TypeIcons["danger"] = "glyphicon glyphicon-alert";
|
|
8
|
-
TypeIcons["info"] = "glyphicon glyphicon-info-sign";
|
|
9
|
-
TypeIcons["success"] = "glyphicon glyphicon-ok";
|
|
10
|
-
})(TypeIcons || (TypeIcons = {}));
|
|
11
|
-
export const Alert = ({ className, onClose, icon, title, children, classModifier = "error", closeButtonAriaLabel = "close", }) => {
|
|
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", { role: "presentation", 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": closeButtonAriaLabel, 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 })] }))] }));
|
|
14
|
-
};
|