design-react-kit 5.8.3 → 5.9.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 +23 -4
- package/README.EN.md +20 -0
- package/README.md +20 -0
- package/dist/Card/Card.cjs +1 -1
- package/dist/Card/Card.cjs.map +1 -1
- package/dist/Card/Card.js +20 -13
- package/dist/Card/Card.js.map +1 -1
- package/dist/Input/Input.cjs +1 -1
- package/dist/Input/Input.cjs.map +1 -1
- package/dist/Input/Input.js +3 -2
- package/dist/Input/Input.js.map +1 -1
- package/dist/Pager/Pager.cjs +1 -1
- package/dist/Pager/Pager.cjs.map +1 -1
- package/dist/Pager/Pager.js +3 -2
- package/dist/Pager/Pager.js.map +1 -1
- package/dist/Rating/Rating.cjs +1 -1
- package/dist/Rating/Rating.cjs.map +1 -1
- package/dist/Transfer/Item.cjs +1 -1
- package/dist/Transfer/Item.cjs.map +1 -1
- package/dist/Transfer/SelectAllCheckbox.cjs +1 -1
- package/dist/Transfer/SelectAllCheckbox.cjs.map +1 -1
- package/dist/Transfer/Source.cjs +1 -1
- package/dist/Transfer/Source.cjs.map +1 -1
- package/dist/Transfer/Target.cjs +1 -1
- package/dist/Transfer/Target.cjs.map +1 -1
- package/dist/Transfer/Transfer.cjs +1 -1
- package/dist/Transfer/Transfer.cjs.map +1 -1
- package/dist/Video/Video.cjs +1 -1
- package/dist/Video/Video.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/types/Card/Card.d.ts +22 -8
- package/package.json +13 -15
- package/src/Card/Card.tsx +59 -34
- package/src/Input/Input.tsx +3 -2
- package/src/Pager/Pager.tsx +3 -2
|
@@ -3,8 +3,6 @@ import { CSSModule } from 'reactstrap/types/lib/utils';
|
|
|
3
3
|
export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
4
4
|
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
5
5
|
tag?: ElementType;
|
|
6
|
-
/** Utilizzarlo quando si passa `a` a `tag` per ottenere una special card cliccabile */
|
|
7
|
-
href?: string;
|
|
8
6
|
/** Classi aggiuntive da usare per il componente Card */
|
|
9
7
|
className?: string;
|
|
10
8
|
/** Da utilizzare per impostare un riferimento all'elemento DOM */
|
|
@@ -13,12 +11,28 @@ export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
|
13
11
|
cssModule?: CSSModule;
|
|
14
12
|
/** Abilita la versione teaser della Card */
|
|
15
13
|
teaser?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
14
|
+
/** La card contiene un'immagine */
|
|
15
|
+
image?: boolean;
|
|
16
|
+
/** La card è di tipo banner */
|
|
17
|
+
banner?: boolean;
|
|
18
|
+
/** La card è di tipo profile */
|
|
19
|
+
profile?: boolean;
|
|
20
|
+
/** La card è inline */
|
|
21
|
+
inline?: boolean;
|
|
22
|
+
/** La card è inline-reverse */
|
|
23
|
+
inlineReverse?: boolean;
|
|
24
|
+
/** La card è inline-mini */
|
|
25
|
+
inlineMini?: boolean;
|
|
26
|
+
/** La card è arrotondata */
|
|
27
|
+
rounded?: boolean;
|
|
28
|
+
/** La card è full height */
|
|
29
|
+
fullHeight?: boolean;
|
|
30
|
+
/** La card ha un bordo */
|
|
31
|
+
border?: boolean;
|
|
32
|
+
/** La card ha un bordo di estremità */
|
|
33
|
+
borderTop?: boolean;
|
|
34
|
+
/** La card ha un bordo */
|
|
35
|
+
shadow?: 'sm' | 'lg' | 'normal' | null;
|
|
22
36
|
testId?: string;
|
|
23
37
|
}
|
|
24
38
|
export declare const Card: FC<CardProps>;
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/italia/design-react-kit/issues"
|
|
27
27
|
},
|
|
28
|
-
"version": "5.
|
|
28
|
+
"version": "5.9.1",
|
|
29
29
|
"license": "BSD-3",
|
|
30
30
|
"type": "module",
|
|
31
31
|
"module": "./dist/index.js",
|
|
@@ -89,18 +89,14 @@
|
|
|
89
89
|
"@commitlint/cli": "^18.4.3",
|
|
90
90
|
"@commitlint/config-conventional": "^18.4.3",
|
|
91
91
|
"@eslint/js": "^9.10.0",
|
|
92
|
-
"@storybook/addon-a11y": "^
|
|
93
|
-
"@storybook/addon-docs": "^
|
|
94
|
-
"@storybook/addon-
|
|
95
|
-
"@storybook/addon-
|
|
96
|
-
"@storybook/
|
|
97
|
-
"@
|
|
98
|
-
"@storybook/blocks": "^8.4.0",
|
|
99
|
-
"@storybook/react": "^8.4.0",
|
|
100
|
-
"@storybook/react-vite": "^8.4.0",
|
|
101
|
-
"@storybook/test": "^8.4.0",
|
|
92
|
+
"@storybook/addon-a11y": "^9.1.2",
|
|
93
|
+
"@storybook/addon-docs": "^9.1.2",
|
|
94
|
+
"@storybook/addon-links": "^9.1.2",
|
|
95
|
+
"@storybook/addon-onboarding": "^9.1.2",
|
|
96
|
+
"@storybook/react-vite": "^9.1.2",
|
|
97
|
+
"@testing-library/dom": "^10.4.1",
|
|
102
98
|
"@testing-library/jest-dom": "^6.4.2",
|
|
103
|
-
"@testing-library/react": "^16",
|
|
99
|
+
"@testing-library/react": "^16.3.0",
|
|
104
100
|
"@types/is-number": "^7.0.3",
|
|
105
101
|
"@types/jest": "^29.5.12",
|
|
106
102
|
"@types/node": "^20.12.2",
|
|
@@ -108,12 +104,14 @@
|
|
|
108
104
|
"@types/react-bootstrap": "^0.32.37",
|
|
109
105
|
"@types/react-dom": "^18.2.24",
|
|
110
106
|
"@types/react-transition-group": "^4.4.10",
|
|
111
|
-
"
|
|
107
|
+
"@types/uuid": "^10.0.0",
|
|
108
|
+
"bootstrap-italia": "^2.17.0",
|
|
112
109
|
"browserslist-config-design-italia": "^1.0.0",
|
|
113
110
|
"eslint": "^9.10.0",
|
|
114
111
|
"eslint-plugin-mdx": "^3.1.5",
|
|
115
112
|
"eslint-plugin-prettier": "^5.1.3",
|
|
116
113
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
114
|
+
"eslint-plugin-storybook": "^9.1.2",
|
|
117
115
|
"globals": "^15.9.0",
|
|
118
116
|
"husky": "^8.0.1",
|
|
119
117
|
"jest": "^29.7.0",
|
|
@@ -124,8 +122,8 @@
|
|
|
124
122
|
"react": "^18.2.0",
|
|
125
123
|
"react-dom": "^18.2.0",
|
|
126
124
|
"react-layout-masonry": "^1.2.0",
|
|
127
|
-
"sass": "^1.
|
|
128
|
-
"storybook": "^
|
|
125
|
+
"sass-embedded": "^1.90.0",
|
|
126
|
+
"storybook": "^9.1.2",
|
|
129
127
|
"ts-jest": "^29.1.2",
|
|
130
128
|
"tslib": "^2.4.0",
|
|
131
129
|
"tsup": "^8.0.2",
|
package/src/Card/Card.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React, { FC, HTMLAttributes, ElementType, Ref } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { Card as CardBase } from 'reactstrap';
|
|
4
3
|
import { CSSModule } from 'reactstrap/types/lib/utils';
|
|
5
4
|
|
|
6
5
|
export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
7
6
|
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
8
7
|
tag?: ElementType;
|
|
9
|
-
/** Utilizzarlo quando si passa `a` a `tag` per ottenere una special card cliccabile */
|
|
10
|
-
href?: string;
|
|
11
8
|
/** Classi aggiuntive da usare per il componente Card */
|
|
12
9
|
className?: string;
|
|
13
10
|
/** Da utilizzare per impostare un riferimento all'elemento DOM */
|
|
@@ -16,48 +13,76 @@ export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
|
16
13
|
cssModule?: CSSModule;
|
|
17
14
|
/** Abilita la versione teaser della Card */
|
|
18
15
|
teaser?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
16
|
+
/** La card contiene un'immagine */
|
|
17
|
+
image?: boolean;
|
|
18
|
+
/** La card è di tipo banner */
|
|
19
|
+
banner?: boolean;
|
|
20
|
+
/** La card è di tipo profile */
|
|
21
|
+
profile?: boolean;
|
|
22
|
+
/** La card è inline */
|
|
23
|
+
inline?: boolean;
|
|
24
|
+
/** La card è inline-reverse */
|
|
25
|
+
inlineReverse?: boolean;
|
|
26
|
+
/** La card è inline-mini */
|
|
27
|
+
inlineMini?: boolean;
|
|
28
|
+
/** La card è arrotondata */
|
|
29
|
+
rounded?: boolean;
|
|
30
|
+
/** La card è full height */
|
|
31
|
+
fullHeight?: boolean;
|
|
32
|
+
/** La card ha un bordo */
|
|
33
|
+
border?: boolean;
|
|
34
|
+
/** La card ha un bordo di estremità */
|
|
35
|
+
borderTop?: boolean;
|
|
36
|
+
/** La card ha un bordo */
|
|
37
|
+
shadow?: 'sm' | 'lg' | 'normal' | null;
|
|
25
38
|
testId?: string;
|
|
26
39
|
}
|
|
27
40
|
|
|
28
41
|
export const Card: FC<CardProps> = ({
|
|
29
|
-
tag = '
|
|
30
|
-
href = undefined,
|
|
42
|
+
tag = 'article',
|
|
31
43
|
teaser,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
image,
|
|
45
|
+
border=true,
|
|
46
|
+
borderTop,
|
|
47
|
+
inline,
|
|
48
|
+
inlineReverse,
|
|
49
|
+
inlineMini,
|
|
50
|
+
rounded,
|
|
51
|
+
fullHeight,
|
|
52
|
+
banner,
|
|
53
|
+
profile,
|
|
54
|
+
shadow=null,
|
|
35
55
|
testId,
|
|
36
56
|
...attributes
|
|
37
57
|
}) => {
|
|
38
|
-
const
|
|
39
|
-
'card-
|
|
40
|
-
'card-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'card-
|
|
58
|
+
const cardClasses = classNames('it-card', attributes.className, {
|
|
59
|
+
'card-teaser': teaser,
|
|
60
|
+
'it-card-image': image,
|
|
61
|
+
'border': border,
|
|
62
|
+
'it-card-inline': inline,
|
|
63
|
+
'it-card-inline-reverse': inlineReverse,
|
|
64
|
+
'it-card-inline-mini': inlineMini,
|
|
65
|
+
'it-card-height-full': fullHeight,
|
|
66
|
+
'rounded': rounded,
|
|
67
|
+
'card-teaser-wrapper': teaser,
|
|
68
|
+
'shadow': shadow === 'normal',
|
|
69
|
+
'shadow-lg': shadow === 'lg',
|
|
70
|
+
'shadow-sm': shadow === 'sm',
|
|
71
|
+
'it-card-banner': banner,
|
|
72
|
+
'it-card-profile': profile,
|
|
73
|
+
'it-border-top': borderTop,
|
|
74
|
+
'it-border-top-secondary': borderTop,
|
|
75
|
+
|
|
44
76
|
});
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<CardBase
|
|
49
|
-
{...attributes}
|
|
50
|
-
className={cardClasses}
|
|
51
|
-
tag={tag}
|
|
52
|
-
href={tag === 'a' ? href : undefined}
|
|
53
|
-
data-testid={testId}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
78
|
+
const T = tag;
|
|
57
79
|
|
|
58
80
|
return (
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
<T
|
|
82
|
+
{...attributes}
|
|
83
|
+
className={cardClasses}
|
|
84
|
+
data-testid={testId}
|
|
85
|
+
/>
|
|
62
86
|
);
|
|
87
|
+
|
|
63
88
|
};
|
package/src/Input/Input.tsx
CHANGED
|
@@ -308,6 +308,7 @@ export const Input = ({
|
|
|
308
308
|
className={classNames({
|
|
309
309
|
'input-group': true,
|
|
310
310
|
'input-number': true,
|
|
311
|
+
'is-invalid': valid == false,
|
|
311
312
|
disabled: rest.disabled,
|
|
312
313
|
'input-number-adaptive': type === 'adaptive'
|
|
313
314
|
})}
|
|
@@ -327,10 +328,10 @@ export const Input = ({
|
|
|
327
328
|
ref={inputRef}
|
|
328
329
|
/>
|
|
329
330
|
<span className='input-group-text align-buttons flex-column'>
|
|
330
|
-
<button className='input-number-add' onClick={() => clickIncrDecr(1)}>
|
|
331
|
+
<button type='button' className='input-number-add' onClick={() => clickIncrDecr(1)}>
|
|
331
332
|
<span className='visually-hidden'>{incrementLabel || ''}</span>
|
|
332
333
|
</button>
|
|
333
|
-
<button className='input-number-sub' onClick={() => clickIncrDecr(-1)}>
|
|
334
|
+
<button type='button' className='input-number-sub' onClick={() => clickIncrDecr(-1)}>
|
|
334
335
|
<span className='visually-hidden'>{decrementLabel || ''}</span>
|
|
335
336
|
</button>
|
|
336
337
|
</span>
|
package/src/Pager/Pager.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { FC, HTMLAttributes, ElementType } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
+
import { PagerItem } from '..';
|
|
3
4
|
|
|
4
5
|
export interface PagerProps extends HTMLAttributes<HTMLElement> {
|
|
5
6
|
/** Etichetta di descrizione del contenuto del componente Pager */
|
|
@@ -35,9 +36,9 @@ export const Pager: FC<PagerProps> = ({
|
|
|
35
36
|
const { ariaLabel, label } = total || {};
|
|
36
37
|
const totalAriaLabel = ariaLabel ? <span className='visually-hidden'>{ariaLabel}</span> : null;
|
|
37
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
-
const listChildren = React.Children.toArray(children).filter((child: any) => child.type
|
|
39
|
+
const listChildren = React.Children.toArray(children).filter((child: any) => child.type === PagerItem);
|
|
39
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
const extraChildren = React.Children.toArray(children).filter((child: any)=> child.type
|
|
41
|
+
const extraChildren = React.Children.toArray(children).filter((child: any)=> child.type !== PagerItem);
|
|
41
42
|
|
|
42
43
|
// listChildren?.forEach(child => {
|
|
43
44
|
// console.log(child)
|