design-react-kit 5.8.2 → 5.9.0

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.
@@ -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
- /** Quando attivo distanzia la Card nella versione mobile */
17
- spacing?: boolean;
18
- /** Quando attivo rimuove il componente contenitore della carta. Utile per card multiple nello stesso contenitore */
19
- noWrapper?: boolean;
20
- /** Classi aggiuntive per l'elemento contenitore */
21
- wrapperClassName?: string;
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.8.2",
28
+ "version": "5.9.0",
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": "^8.4.0",
93
- "@storybook/addon-docs": "^8.4.0",
94
- "@storybook/addon-essentials": "^8.4.0",
95
- "@storybook/addon-interactions": "^8.4.0",
96
- "@storybook/addon-links": "^8.4.0",
97
- "@storybook/addon-onboarding": "^8.4.0",
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
- "bootstrap-italia": "^2.15.1",
107
+ "@types/uuid": "^10.0.0",
108
+ "bootstrap-italia": "^2.16.1",
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.75.0",
128
- "storybook": "^8.4.0",
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
- /** Quando attivo distanzia la Card nella versione mobile */
20
- spacing?: boolean;
21
- /** Quando attivo rimuove il componente contenitore della carta. Utile per card multiple nello stesso contenitore */
22
- noWrapper?: boolean;
23
- /** Classi aggiuntive per l'elemento contenitore */
24
- wrapperClassName?: string;
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 = 'div',
30
- href = undefined,
42
+ tag = 'article',
31
43
  teaser,
32
- spacing,
33
- noWrapper = false,
34
- wrapperClassName,
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 wrapperClasses = classNames('card-wrapper', wrapperClassName, {
39
- 'card-space': spacing,
40
- 'card-teaser-wrapper': teaser
41
- });
42
- const cardClasses = classNames(attributes.className, {
43
- 'card-teaser': teaser
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
- if (noWrapper) {
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
- <div className={wrapperClasses} data-testid={testId}>
60
- <CardBase {...attributes} className={cardClasses} tag={tag} href={tag === 'a' ? href : undefined} />
61
- </div>
81
+ <T
82
+ {...attributes}
83
+ className={cardClasses}
84
+ data-testid={testId}
85
+ />
62
86
  );
87
+
63
88
  };
@@ -113,7 +113,7 @@ export const Video: FC<VideoProps> = (props) => {
113
113
  instance.dispose();
114
114
  }
115
115
  };
116
- }, [instance]);
116
+ }, []);
117
117
 
118
118
  const loadYouTubeVideo = (url: string) => {
119
119
  if (instance) {