@moda/om 17.1.0 → 17.2.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.
@@ -11,7 +11,7 @@ export declare type ColorSwatchProps = Omit<Omit<React.ButtonHTMLAttributes<HTML
11
11
  selected?: boolean;
12
12
  soldOut?: boolean;
13
13
  onSale?: boolean;
14
- onClick?(color: string): void;
15
- onMouseEnter?(color: string): void;
14
+ onClick?(color: string, title?: string): void;
15
+ onMouseEnter?(color: string, title?: string): void;
16
16
  };
17
17
  export declare const ColorSwatch: React.FC<ColorSwatchProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/om",
3
- "version": "17.1.0",
3
+ "version": "17.2.0",
4
4
  "description": "Moda Operandi design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -18,8 +18,8 @@ export type ColorSwatchProps = Omit<
18
18
  selected?: boolean;
19
19
  soldOut?: boolean;
20
20
  onSale?: boolean;
21
- onClick?(color: string): void;
22
- onMouseEnter?(color: string): void;
21
+ onClick?(color: string, title?: string): void;
22
+ onMouseEnter?(color: string, title?: string): void;
23
23
  };
24
24
 
25
25
  export const ColorSwatch: React.FC<ColorSwatchProps> = ({
@@ -35,20 +35,21 @@ export const ColorSwatch: React.FC<ColorSwatchProps> = ({
35
35
  onClick,
36
36
  onMouseEnter,
37
37
  disabled,
38
+ title,
38
39
  ...rest
39
40
  }) => {
40
41
  const handleClick = useCallback(
41
42
  (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
42
- onClick && onClick(color);
43
+ onClick && onClick(color, title);
43
44
  },
44
- [color, onClick]
45
+ [color, title, onClick]
45
46
  );
46
47
 
47
48
  const handleMouseEnter = useCallback(
48
49
  (_event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
49
- onMouseEnter && onMouseEnter(color);
50
+ onMouseEnter && onMouseEnter(color, title);
50
51
  },
51
- [color, onMouseEnter]
52
+ [color, title, onMouseEnter]
52
53
  );
53
54
 
54
55
  const backgroundColor = SKU_COLORS[color as SkuColor];
@@ -81,6 +82,7 @@ export const ColorSwatch: React.FC<ColorSwatchProps> = ({
81
82
  onClick={handleClick}
82
83
  onMouseEnter={handleMouseEnter}
83
84
  disabled={disabled}
85
+ title={title}
84
86
  {...rest}
85
87
  >
86
88
  <div className="ColorSwatch__chip" style={styles} />