design-react-kit 5.3.0 → 5.4.1
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/CHANGELOG.md +30 -0
- package/dist/Card/CardCategory.cjs +1 -1
- package/dist/Card/CardCategory.cjs.map +1 -1
- package/dist/Card/CardCategory.js +7 -3
- package/dist/Card/CardCategory.js.map +1 -1
- package/dist/Forward/Forward.cjs +1 -1
- package/dist/Forward/Forward.cjs.map +1 -1
- package/dist/Forward/Forward.js +13 -5
- package/dist/Forward/Forward.js.map +1 -1
- package/dist/Grid/GridItemTextWrapper.cjs +1 -1
- package/dist/Grid/GridItemTextWrapper.cjs.map +1 -1
- package/dist/Grid/GridItemTextWrapper.js +3 -2
- package/dist/Grid/GridItemTextWrapper.js.map +1 -1
- package/dist/Grid/index.cjs +1 -1
- package/dist/Grid/index.cjs.map +1 -1
- package/dist/Input/Input.cjs +1 -1
- package/dist/Input/Input.cjs.map +1 -1
- package/dist/Input/TextArea.cjs +1 -1
- package/dist/Input/TextArea.cjs.map +1 -1
- package/dist/Input/TextArea.js +4 -1
- package/dist/Input/TextArea.js.map +1 -1
- package/dist/Input/utils.cjs +1 -1
- package/dist/Input/utils.cjs.map +1 -1
- package/dist/Input/utils.js +2 -2
- package/dist/Input/utils.js.map +1 -1
- package/dist/List/ListItem.cjs +1 -1
- package/dist/List/ListItem.cjs.map +1 -1
- package/dist/List/ListItem.js +2 -2
- package/dist/List/ListItem.js.map +1 -1
- package/dist/Rating/Rating.cjs +1 -1
- package/dist/Rating/Rating.cjs.map +1 -1
- package/dist/ResponsiveImage/ResponsiveImage.cjs +1 -1
- package/dist/ResponsiveImage/ResponsiveImage.cjs.map +1 -1
- package/dist/ResponsiveImage/ResponsiveImage.js +21 -5
- package/dist/ResponsiveImage/ResponsiveImage.js.map +1 -1
- package/dist/ThumbNav/ThumbNavItem.cjs +1 -1
- package/dist/ThumbNav/ThumbNavItem.cjs.map +1 -1
- package/dist/ThumbNav/ThumbNavItem.js +0 -1
- package/dist/ThumbNav/ThumbNavItem.js.map +1 -1
- package/dist/Timeline/TimelinePin.cjs +1 -1
- package/dist/Timeline/TimelinePin.cjs.map +1 -1
- package/dist/Timeline/TimelinePin.js +4 -3
- package/dist/Timeline/TimelinePin.js.map +1 -1
- package/dist/Toolbar/ToolbarDividerItem.cjs +1 -1
- package/dist/Toolbar/ToolbarDividerItem.cjs.map +1 -1
- package/dist/Toolbar/ToolbarDividerItem.js +1 -1
- package/dist/Toolbar/ToolbarDividerItem.js.map +1 -1
- package/dist/Toolbar/ToolbarItem.cjs +1 -1
- package/dist/Toolbar/ToolbarItem.cjs.map +1 -1
- package/dist/Toolbar/ToolbarItem.js +2 -4
- package/dist/Toolbar/ToolbarItem.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/types/Card/CardCategory.d.ts +6 -0
- package/dist/types/Forward/Forward.d.ts +1 -2
- package/dist/types/Grid/GridItemTextWrapper.d.ts +3 -1
- package/dist/types/Input/TextArea.d.ts +1 -1
- package/dist/types/ResponsiveImage/ResponsiveImage.d.ts +2 -0
- package/dist/types/Timeline/TimelinePin.d.ts +7 -1
- package/package.json +4 -3
- package/src/Card/CardCategory.tsx +16 -7
- package/src/Forward/Forward.tsx +15 -9
- package/src/Grid/GridItemTextWrapper.tsx +7 -4
- package/src/Input/TextArea.tsx +9 -3
- package/src/Input/utils.tsx +2 -2
- package/src/List/ListItem.tsx +3 -5
- package/src/ResponsiveImage/ResponsiveImage.tsx +32 -8
- package/src/ThumbNav/ThumbNavItem.tsx +0 -1
- package/src/Timeline/TimelinePin.tsx +13 -4
- package/src/Toolbar/ToolbarDividerItem.tsx +1 -1
- package/src/Toolbar/ToolbarItem.tsx +1 -4
|
@@ -6,6 +6,12 @@ export interface CardCategoryProps extends HTMLAttributes<HTMLElement> {
|
|
|
6
6
|
date?: string;
|
|
7
7
|
/** Se usato come link, passare l'URL target. */
|
|
8
8
|
href?: string;
|
|
9
|
+
/** Descrizione della data (es. 'Data evento') */
|
|
10
|
+
dateDescription?: string;
|
|
11
|
+
/** Descrizione del testo (es. 'Titolo evento') */
|
|
12
|
+
textDescription?: string;
|
|
13
|
+
/** Titolo dell' icona */
|
|
14
|
+
iconTitle?: string;
|
|
9
15
|
/** Da utilizzare al posto di url quando la gestione del click è in JS */
|
|
10
16
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
11
17
|
testId?: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { FC, AnchorHTMLAttributes
|
|
1
|
+
import { FC, AnchorHTMLAttributes } from 'react';
|
|
2
2
|
export interface ForwardProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
3
3
|
/** Classi aggiuntive da usare per il componente Forward */
|
|
4
4
|
className?: string;
|
|
5
5
|
/** Riferimento al nodo a cui scorrere quando premuto */
|
|
6
|
-
scrollToRef: MutableRefObject<Element | null>;
|
|
7
6
|
testId?: string;
|
|
8
7
|
}
|
|
9
8
|
export declare const Forward: FC<ForwardProps>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react';
|
|
1
|
+
import { ElementType, FC, HTMLAttributes } from 'react';
|
|
2
2
|
export interface GridItemTextWrapperProps extends HTMLAttributes<HTMLSpanElement> {
|
|
3
3
|
/** Classi aggiuntive da usare per l'elemento */
|
|
4
4
|
className?: string;
|
|
5
5
|
testId?: string;
|
|
6
|
+
/** Tag dell'elemento (può essere ad esempio trasformato in figcaption) */
|
|
7
|
+
tag?: ElementType;
|
|
6
8
|
}
|
|
7
9
|
export declare const GridItemTextWrapper: FC<GridItemTextWrapperProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode, Ref, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import type { CSSModule } from 'reactstrap/types/lib/utils';
|
|
3
3
|
export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
4
4
|
/** Etichetta del campo TextArea. */
|
|
@@ -7,5 +7,7 @@ export interface ResponsiveImageProps extends HTMLAttributes<HTMLImageElement> {
|
|
|
7
7
|
/** Il titolo dell'immagine */
|
|
8
8
|
title?: string;
|
|
9
9
|
testId?: string;
|
|
10
|
+
/** Indica se l'immagine deve essere considerata proporzionata */
|
|
11
|
+
proportioned?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare const ResponsiveImage: FC<ResponsiveImageProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react';
|
|
1
|
+
import { ElementType, FC, HTMLAttributes } from 'react';
|
|
2
2
|
export interface TimelinePinProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
/** Classi aggiuntive da usare per il componente TimelinePin */
|
|
4
4
|
className?: string;
|
|
@@ -9,6 +9,10 @@ export interface TimelinePinProps extends HTMLAttributes<HTMLElement> {
|
|
|
9
9
|
* @deprecated. Utilizzare `iconName`.
|
|
10
10
|
* */
|
|
11
11
|
icon?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Titolo dell'icona all'interno del TimelinePin.
|
|
14
|
+
* */
|
|
15
|
+
iconTitle?: string;
|
|
12
16
|
/** Etichetta da associare all'elemento */
|
|
13
17
|
label: string;
|
|
14
18
|
/** Quando abilitato indica che l'evento TimelinePin è collocato nel presente (azzurro) */
|
|
@@ -17,6 +21,8 @@ export interface TimelinePinProps extends HTMLAttributes<HTMLElement> {
|
|
|
17
21
|
nowText?: string;
|
|
18
22
|
/** Quando abilitato indica che l'evento TimelinePin è collocato nel passato (blu scuro) */
|
|
19
23
|
past?: boolean;
|
|
24
|
+
/** Tag del pin da utilizzare a seconda della struttura */
|
|
25
|
+
tag?: ElementType;
|
|
20
26
|
testId?: string;
|
|
21
27
|
}
|
|
22
28
|
export declare const TimelinePin: FC<TimelinePinProps>;
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/italia/design-react-kit/issues"
|
|
26
26
|
},
|
|
27
|
-
"version": "5.
|
|
27
|
+
"version": "5.4.1",
|
|
28
28
|
"license": "BSD-3",
|
|
29
29
|
"type": "module",
|
|
30
30
|
"module": "./dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"postversion": "echo \"You can now publish your version using 'git push --follow-tags'\""
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"bootstrap-italia": "2.
|
|
68
|
+
"bootstrap-italia": "2.11.0",
|
|
69
69
|
"react": ">=18.2.0"
|
|
70
70
|
},
|
|
71
71
|
"browserslist": [
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@types/react": "^18.2.75",
|
|
98
98
|
"@types/react-dom": "^18.2.24",
|
|
99
99
|
"@types/react-transition-group": "^4.4.10",
|
|
100
|
-
"bootstrap-italia": "^2.
|
|
100
|
+
"bootstrap-italia": "^2.11.0",
|
|
101
101
|
"browserslist-config-design-italia": "^1.0.0",
|
|
102
102
|
"eslint": "^9.10.0",
|
|
103
103
|
"eslint-plugin-mdx": "^3.1.5",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"prettier": "^3.2.5",
|
|
112
112
|
"react": "^18.2.0",
|
|
113
113
|
"react-dom": "^18.2.0",
|
|
114
|
+
"react-layout-masonry": "^1.2.0",
|
|
114
115
|
"sass": "^1.75.0",
|
|
115
116
|
"storybook": "^8.0.5",
|
|
116
117
|
"ts-jest": "^29.1.2",
|
|
@@ -10,33 +10,42 @@ export interface CardCategoryProps extends HTMLAttributes<HTMLElement> {
|
|
|
10
10
|
date?: string;
|
|
11
11
|
/** Se usato come link, passare l'URL target. */
|
|
12
12
|
href?: string;
|
|
13
|
+
/** Descrizione della data (es. 'Data evento') */
|
|
14
|
+
dateDescription?: string;
|
|
15
|
+
/** Descrizione del testo (es. 'Titolo evento') */
|
|
16
|
+
textDescription?: string;
|
|
17
|
+
/** Titolo dell' icona */
|
|
18
|
+
iconTitle?: string;
|
|
13
19
|
/** Da utilizzare al posto di url quando la gestione del click è in JS */
|
|
14
20
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
15
21
|
testId?: string;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
|
-
export const CardCategory: FC<CardCategoryProps> = ({ iconName, date, href, onClick, testId, children, ...rest }) => {
|
|
24
|
+
export const CardCategory: FC<CardCategoryProps> = ({ iconName, iconTitle, date, href, onClick, testId, children, textDescription, dateDescription, ...rest }) => {
|
|
19
25
|
const classes = classNames({
|
|
20
26
|
'category-top': date || ' ',
|
|
21
27
|
'categoryicon-top': iconName
|
|
22
28
|
});
|
|
23
29
|
// Simple category link
|
|
24
30
|
const categoryLink = !iconName && (
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
|
|
31
|
+
<>
|
|
32
|
+
{textDescription && <span className="visually-hidden">{textDescription}</span>}
|
|
33
|
+
<a href={href} className='category' onClick={onClick}>
|
|
34
|
+
{children}
|
|
35
|
+
</a>
|
|
36
|
+
</>
|
|
28
37
|
);
|
|
29
38
|
const categoryDate = date && <span className='data'>{date}</span>;
|
|
30
39
|
// Category with icon
|
|
31
40
|
const categoryText = iconName && <span className='text'>{children}</span>;
|
|
32
|
-
const categoryIcon = iconName && <Icon icon={iconName} />;
|
|
41
|
+
const categoryIcon = iconName && <Icon icon={iconName} title={iconTitle} />;
|
|
33
42
|
|
|
34
43
|
return (
|
|
35
44
|
<div className={classes} {...rest} data-testid={testId}>
|
|
36
45
|
{categoryLink}
|
|
37
46
|
{categoryIcon}
|
|
38
|
-
{categoryText}
|
|
39
|
-
{categoryDate}
|
|
47
|
+
{categoryText && textDescription && <span className="visually-hidden">{textDescription}</span>}{categoryText}
|
|
48
|
+
{dateDescription && <span className="visually-hidden">{dateDescription}</span>}{categoryDate}
|
|
40
49
|
</div>
|
|
41
50
|
);
|
|
42
51
|
};
|
package/src/Forward/Forward.tsx
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import React, { FC, AnchorHTMLAttributes
|
|
1
|
+
import React, { FC, AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
4
|
export interface ForwardProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
5
5
|
/** Classi aggiuntive da usare per il componente Forward */
|
|
6
6
|
className?: string;
|
|
7
7
|
/** Riferimento al nodo a cui scorrere quando premuto */
|
|
8
|
-
scrollToRef: MutableRefObject<Element | null>;
|
|
8
|
+
// scrollToRef: MutableRefObject<Element | null>;
|
|
9
9
|
testId?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const Forward: FC<ForwardProps> = ({ className,
|
|
12
|
+
export const Forward: FC<ForwardProps> = ({ className, children, testId, ...attributes }) => {
|
|
13
13
|
const classes = classNames(className, 'forward');
|
|
14
14
|
return (
|
|
15
15
|
<a
|
|
16
16
|
className={classes}
|
|
17
|
-
onClick={() =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
onClick={(e) => {
|
|
18
|
+
e.preventDefault()
|
|
19
|
+
if (attributes.href) {
|
|
20
|
+
const scrollToRef = document.querySelector(attributes.href)
|
|
21
|
+
if (scrollToRef) {
|
|
22
|
+
scrollToRef.scrollIntoView({
|
|
23
|
+
behavior: 'smooth',
|
|
24
|
+
block: 'start'
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}}
|
|
23
29
|
data-testid={testId}
|
|
24
30
|
{...attributes}
|
|
25
31
|
>
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import React, { FC, HTMLAttributes } from 'react';
|
|
1
|
+
import React, { ElementType, FC, HTMLAttributes } from 'react';
|
|
2
2
|
import classname from 'classnames';
|
|
3
3
|
|
|
4
4
|
export interface GridItemTextWrapperProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
5
|
/** Classi aggiuntive da usare per l'elemento */
|
|
6
6
|
className?: string;
|
|
7
7
|
testId?: string;
|
|
8
|
+
/** Tag dell'elemento (può essere ad esempio trasformato in figcaption) */
|
|
9
|
+
tag?: ElementType;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
export const GridItemTextWrapper: FC<GridItemTextWrapperProps> = ({ className, children, testId, ...attributes }) => {
|
|
12
|
+
export const GridItemTextWrapper: FC<GridItemTextWrapperProps> = ({ className, children, testId, tag='span', ...attributes }) => {
|
|
11
13
|
const classes = classname('it-griditem-text-wrapper', className);
|
|
14
|
+
const Tag = tag;
|
|
12
15
|
return (
|
|
13
|
-
<
|
|
16
|
+
<Tag {...attributes} className={classes} data-testid={testId}>
|
|
14
17
|
{children}
|
|
15
|
-
</
|
|
18
|
+
</Tag>
|
|
16
19
|
);
|
|
17
20
|
};
|
package/src/Input/TextArea.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ReactNode, Ref, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
|
-
import { InputContainer } from './InputContainer';
|
|
4
|
-
import { getClasses, getValidationTextControlClass, useFocus } from './utils';
|
|
5
3
|
import type { CSSModule } from 'reactstrap/types/lib/utils';
|
|
4
|
+
import { InputContainer } from './InputContainer';
|
|
5
|
+
import { getClasses, getFormControlClass, getValidationTextControlClass, useFocus } from './utils';
|
|
6
6
|
|
|
7
7
|
export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
8
8
|
/** Etichetta del campo TextArea. */
|
|
@@ -56,6 +56,11 @@ export const TextArea = ({
|
|
|
56
56
|
|
|
57
57
|
const extraAttributes: { ['aria-describedby']?: string } = {};
|
|
58
58
|
|
|
59
|
+
//Chiamo questa funzione per impostare classNames a 'form-control'
|
|
60
|
+
const formControlClass = getFormControlClass(
|
|
61
|
+
{},
|
|
62
|
+
cssModule
|
|
63
|
+
);
|
|
59
64
|
// associate the input field with the help text
|
|
60
65
|
const infoId = id ? `${id}Description` : undefined;
|
|
61
66
|
if (id) {
|
|
@@ -73,6 +78,7 @@ export const TextArea = ({
|
|
|
73
78
|
label,
|
|
74
79
|
validationText,
|
|
75
80
|
normalized: Boolean(normalized),
|
|
81
|
+
formControlClass,
|
|
76
82
|
validationTextControlClass,
|
|
77
83
|
isFocused,
|
|
78
84
|
originalWrapperClass
|
package/src/Input/utils.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
3
|
import type { CSSModule } from 'reactstrap/types/lib/utils';
|
|
4
4
|
import { mapToCssModules } from '../utils';
|
|
5
5
|
import type { InputProps } from './Input';
|
|
@@ -98,7 +98,7 @@ export function getClasses(
|
|
|
98
98
|
),
|
|
99
99
|
cssModule
|
|
100
100
|
);
|
|
101
|
-
const wrapperClass = mapToCssModules(classNames(
|
|
101
|
+
const wrapperClass = mapToCssModules(classNames(originalWrapperClass, 'form-group'), cssModule);
|
|
102
102
|
const validationTextClass = mapToCssModules(
|
|
103
103
|
classNames(
|
|
104
104
|
{
|
package/src/List/ListItem.tsx
CHANGED
|
@@ -55,11 +55,9 @@ export const ListItem: FC<ListItemProps> & {
|
|
|
55
55
|
if (href) {
|
|
56
56
|
return (
|
|
57
57
|
<li className={wrapperClassName} data-testid={testId}>
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
</a>
|
|
62
|
-
</Tag>
|
|
58
|
+
<a href={href || '#'} {...attributes} className={classes}>
|
|
59
|
+
<div className="it-right-zone">{children}</div>
|
|
60
|
+
</a>
|
|
63
61
|
</li>
|
|
64
62
|
);
|
|
65
63
|
}
|
|
@@ -8,16 +8,40 @@ export interface ResponsiveImageProps extends HTMLAttributes<HTMLImageElement> {
|
|
|
8
8
|
/** Il titolo dell'immagine */
|
|
9
9
|
title?: string;
|
|
10
10
|
testId?: string;
|
|
11
|
+
/** Indica se l'immagine deve essere considerata proporzionata */
|
|
12
|
+
proportioned?: boolean;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const ResponsiveImage: FC<ResponsiveImageProps> = ({ alt, testId, ...attributes }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<div className='img-wrapper'>
|
|
18
|
-
<
|
|
15
|
+
export const ResponsiveImage: FC<ResponsiveImageProps> = ({ alt, testId, proportioned=false, children, ...attributes }) => {
|
|
16
|
+
if (children) {
|
|
17
|
+
if (proportioned) {
|
|
18
|
+
return(
|
|
19
|
+
<div className='img-responsive-wrapper'>
|
|
20
|
+
<div className='img-responsive'>
|
|
21
|
+
<figure className='img-wrapper'>
|
|
22
|
+
<img {...attributes} alt={alt} className='figure-img img-fluid rounded' />
|
|
23
|
+
{children}
|
|
24
|
+
</figure>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
} else {
|
|
29
|
+
return(
|
|
30
|
+
<figure className='figure img-full w-100 img-responsive-wrapper'>
|
|
31
|
+
<img {...attributes} alt={alt} className='figure-img img-fluid rounded' />
|
|
32
|
+
{children}
|
|
33
|
+
</figure>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
return (
|
|
38
|
+
<div className='img-responsive-wrapper' data-testid={testId}>
|
|
39
|
+
<div className='img-responsive'>
|
|
40
|
+
<div className='img-wrapper'>
|
|
41
|
+
<img {...attributes} alt={alt} />
|
|
42
|
+
</div>
|
|
19
43
|
</div>
|
|
20
44
|
</div>
|
|
21
|
-
|
|
22
|
-
|
|
45
|
+
);
|
|
46
|
+
}
|
|
23
47
|
};
|
|
@@ -21,7 +21,6 @@ export const ThumbNavItem: FC<ThumbNavItemProps> = ({
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<li {...attributes} data-testid={testId}>
|
|
24
|
-
<img src={'https://picsum.photos/240/160?image=1056'} className='thumb-nav-resizer' aria-hidden='true' alt='' />
|
|
25
24
|
<a href={targetUrl} className={classes}>
|
|
26
25
|
<img src={imageUrl} alt={actionDescription} />
|
|
27
26
|
</a>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC, HTMLAttributes } from 'react';
|
|
1
|
+
import React, { ElementType, FC, HTMLAttributes } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Icon } from '../Icon/Icon';
|
|
@@ -13,6 +13,10 @@ export interface TimelinePinProps extends HTMLAttributes<HTMLElement> {
|
|
|
13
13
|
* @deprecated. Utilizzare `iconName`.
|
|
14
14
|
* */
|
|
15
15
|
icon?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Titolo dell'icona all'interno del TimelinePin.
|
|
18
|
+
* */
|
|
19
|
+
iconTitle?: string;
|
|
16
20
|
/** Etichetta da associare all'elemento */
|
|
17
21
|
label: string;
|
|
18
22
|
/** Quando abilitato indica che l'evento TimelinePin è collocato nel presente (azzurro) */
|
|
@@ -21,18 +25,22 @@ export interface TimelinePinProps extends HTMLAttributes<HTMLElement> {
|
|
|
21
25
|
nowText?: string;
|
|
22
26
|
/** Quando abilitato indica che l'evento TimelinePin è collocato nel passato (blu scuro) */
|
|
23
27
|
past?: boolean;
|
|
28
|
+
/** Tag del pin da utilizzare a seconda della struttura */
|
|
29
|
+
tag?: ElementType;
|
|
24
30
|
testId?: string;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export const TimelinePin: FC<TimelinePinProps> = ({
|
|
28
34
|
iconName = 'it-code-circle',
|
|
29
35
|
icon = 'it-code-circle',
|
|
36
|
+
iconTitle = '',
|
|
30
37
|
label = ' ',
|
|
31
38
|
past,
|
|
32
39
|
now,
|
|
33
40
|
nowText,
|
|
34
41
|
testId,
|
|
35
42
|
className,
|
|
43
|
+
tag='h3',
|
|
36
44
|
...attributes
|
|
37
45
|
}) => {
|
|
38
46
|
const { children, ...rest } = attributes;
|
|
@@ -43,7 +51,7 @@ export const TimelinePin: FC<TimelinePinProps> = ({
|
|
|
43
51
|
});
|
|
44
52
|
const pinIcon = (
|
|
45
53
|
<div className='pin-icon'>
|
|
46
|
-
<Icon icon={iconName || icon} />
|
|
54
|
+
<Icon icon={iconName || icon} role="img" title={iconTitle} />
|
|
47
55
|
</div>
|
|
48
56
|
);
|
|
49
57
|
const pinLabel = (
|
|
@@ -53,14 +61,15 @@ export const TimelinePin: FC<TimelinePinProps> = ({
|
|
|
53
61
|
);
|
|
54
62
|
|
|
55
63
|
const pinTextNow = now && <span className='it-now-label d-none d-lg-flex'>{nowText}</span>;
|
|
64
|
+
const Tag = tag;
|
|
56
65
|
|
|
57
66
|
return (
|
|
58
67
|
<div className={classes} data-testid={testId}>
|
|
59
68
|
{pinTextNow}
|
|
60
|
-
<
|
|
69
|
+
<Tag className={innerClasses} {...rest}>
|
|
61
70
|
{pinIcon}
|
|
62
71
|
{pinLabel}
|
|
63
|
-
</
|
|
72
|
+
</Tag>
|
|
64
73
|
{children}
|
|
65
74
|
</div>
|
|
66
75
|
);
|
|
@@ -67,8 +67,6 @@ export interface ToolbarItemProps extends HTMLAttributes<HTMLElement> {
|
|
|
67
67
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
const disabledMessage = ' elemento disabilitato';
|
|
71
|
-
|
|
72
70
|
function ToolbarItemLabel({
|
|
73
71
|
label,
|
|
74
72
|
size,
|
|
@@ -83,12 +81,11 @@ function ToolbarItemLabel({
|
|
|
83
81
|
const showSrText = size && size !== 'large';
|
|
84
82
|
if (disabled) {
|
|
85
83
|
if (!label || showSrText) {
|
|
86
|
-
return <span
|
|
84
|
+
return <span></span>;
|
|
87
85
|
}
|
|
88
86
|
return (
|
|
89
87
|
<>
|
|
90
88
|
<span className='toolbar-label'>{label}</span>
|
|
91
|
-
<span className='visually-hidden'>{disabledMessage}</span>
|
|
92
89
|
</>
|
|
93
90
|
);
|
|
94
91
|
}
|