@snack-uikit/card 0.12.14-preview-d3c8ef06.0 → 0.12.14
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
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.12.14 (2024-05-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PDS-172:** shuffle classes order; add support props into Image; add space keydown handle' ([bb49373](https://github.com/cloud-ru-tech/snack-uikit/commit/bb49373d5a52a04cf86db7250db669e8600aa015))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.12.13 (2024-05-13)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -26,7 +26,7 @@ export function Card(_a) {
|
|
|
26
26
|
const onKeyDown = useCallback((e) => {
|
|
27
27
|
var _a, _b;
|
|
28
28
|
if (e.target === localDivRef.current) {
|
|
29
|
-
if (TRIGGER_CLICK_KEY_CODES.includes(e.code)) {
|
|
29
|
+
if (TRIGGER_CLICK_KEY_CODES.includes(e.code) || e.key === ' ') {
|
|
30
30
|
href ? (_a = localAnchorRef.current) === null || _a === void 0 ? void 0 : _a.click() : (_b = localDivRef.current) === null || _b === void 0 ? void 0 : _b.click();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
1
2
|
import { MODE } from './constants';
|
|
2
|
-
export type ImageProps = {
|
|
3
|
+
export type ImageProps = WithSupportProps<{
|
|
3
4
|
/** Путь до картинки */
|
|
4
5
|
src: string;
|
|
5
6
|
/** Описание картинки */
|
|
@@ -10,5 +11,5 @@ export type ImageProps = {
|
|
|
10
11
|
} | {
|
|
11
12
|
mode: typeof MODE.Background;
|
|
12
13
|
hideFading?: boolean;
|
|
13
|
-
})
|
|
14
|
-
export declare function Image({ src, alt, mode, hideFading }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
})>;
|
|
15
|
+
export declare function Image({ src, alt, mode, hideFading, ...rest }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { extractSupportProps } from '@snack-uikit/utils';
|
|
2
14
|
import { MODE } from './constants';
|
|
3
15
|
import styles from './styles.module.css';
|
|
4
|
-
export function Image(
|
|
5
|
-
|
|
16
|
+
export function Image(_a) {
|
|
17
|
+
var { src, alt, mode = MODE.Little, hideFading } = _a, rest = __rest(_a, ["src", "alt", "mode", "hideFading"]);
|
|
18
|
+
return (_jsx("img", Object.assign({}, extractSupportProps(rest), { src: src, alt: alt, "data-mode": mode, className: styles.image, "data-fading": !hideFading || undefined })));
|
|
6
19
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Card",
|
|
7
|
-
"version": "0.12.14
|
|
7
|
+
"version": "0.12.14",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@snack-uikit/utils": "3.3.0",
|
|
44
44
|
"classnames": "2.3.2"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "616e36de014b8451e203bcb195f0996ed4af75d6"
|
|
47
47
|
}
|
|
@@ -67,7 +67,7 @@ export function Card({
|
|
|
67
67
|
const onKeyDown = useCallback(
|
|
68
68
|
(e: KeyboardEvent<HTMLDivElement>) => {
|
|
69
69
|
if (e.target === localDivRef.current) {
|
|
70
|
-
if (TRIGGER_CLICK_KEY_CODES.includes(e.code)) {
|
|
70
|
+
if (TRIGGER_CLICK_KEY_CODES.includes(e.code) || e.key === ' ') {
|
|
71
71
|
href ? localAnchorRef.current?.click() : localDivRef.current?.click();
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
+
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
2
|
+
|
|
1
3
|
import { MODE } from './constants';
|
|
2
4
|
import styles from './styles.module.scss';
|
|
3
5
|
|
|
4
|
-
export type ImageProps =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export type ImageProps = WithSupportProps<
|
|
7
|
+
{
|
|
8
|
+
/** Путь до картинки */
|
|
9
|
+
src: string;
|
|
10
|
+
/** Описание картинки */
|
|
11
|
+
alt: string;
|
|
12
|
+
} /** Image mode */ & (
|
|
13
|
+
| { mode?: typeof MODE.Little | typeof MODE.Middle; hideFading?: never }
|
|
14
|
+
| { mode: typeof MODE.Background; hideFading?: boolean }
|
|
15
|
+
)
|
|
16
|
+
>;
|
|
13
17
|
|
|
14
|
-
export function Image({ src, alt, mode = MODE.Little, hideFading }: ImageProps) {
|
|
15
|
-
return
|
|
18
|
+
export function Image({ src, alt, mode = MODE.Little, hideFading, ...rest }: ImageProps) {
|
|
19
|
+
return (
|
|
20
|
+
<img
|
|
21
|
+
{...extractSupportProps(rest)}
|
|
22
|
+
src={src}
|
|
23
|
+
alt={alt}
|
|
24
|
+
data-mode={mode}
|
|
25
|
+
className={styles.image}
|
|
26
|
+
data-fading={!hideFading || undefined}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
16
29
|
}
|