@xsolla/xui-b2c-media-card 0.217.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.
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@xsolla/xui-b2c-media-card",
3
+ "version": "0.217.0",
4
+ "main": "./web/index.js",
5
+ "module": "./web/index.mjs",
6
+ "types": "./web/index.d.ts",
7
+ "scripts": {
8
+ "build": "yarn build:web && yarn build:native",
9
+ "build:web": "PLATFORM=web tsup",
10
+ "build:native": "PLATFORM=native tsup",
11
+ "test": "vitest",
12
+ "test:run": "vitest run",
13
+ "test:coverage": "vitest run --coverage"
14
+ },
15
+ "dependencies": {
16
+ "@xsolla/xui-core": "0.217.0",
17
+ "@xsolla/xui-primitives-core": "0.217.0"
18
+ },
19
+ "peerDependencies": {
20
+ "react": ">=16.8.0"
21
+ },
22
+ "devDependencies": {
23
+ "@testing-library/jest-dom": "^6.9.1",
24
+ "@testing-library/react": "^14.1.2",
25
+ "@vitest/coverage-v8": "^4.0.18",
26
+ "jsdom": "^24.0.0",
27
+ "react": "^18.0.0",
28
+ "react-dom": "^18.0.0",
29
+ "tsup": "^8.0.0",
30
+ "vitest": "^4.0.18"
31
+ },
32
+ "license": "MIT",
33
+ "sideEffects": false,
34
+ "react-native": "./native/index.js",
35
+ "exports": {
36
+ ".": {
37
+ "react-native": {
38
+ "types": "./native/index.d.ts",
39
+ "import": "./native/index.mjs",
40
+ "require": "./native/index.js"
41
+ },
42
+ "import": {
43
+ "types": "./web/index.d.ts",
44
+ "default": "./web/index.mjs"
45
+ },
46
+ "require": {
47
+ "types": "./web/index.d.ts",
48
+ "default": "./web/index.js"
49
+ },
50
+ "default": {
51
+ "types": "./web/index.d.ts",
52
+ "default": "./web/index.js"
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,64 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+
4
+ /**
5
+ * Figma `Orientation`. `horizontal` is the 319×179 landscape plate used in a
6
+ * video row; `vertical` is the 95×169 portrait plate used in a shorts rail.
7
+ */
8
+ type MediaCardOrientation = "horizontal" | "vertical";
9
+ interface MediaCardProps extends ThemeOverrideProps {
10
+ /** Thumbnail image URL. Fills the whole plate, cropped to cover. */
11
+ src: string;
12
+ /**
13
+ * Human-readable name of the media this card represents, e.g.
14
+ * `"Chapter 3: The Ascent"`.
15
+ *
16
+ * This is what makes a grid of cards usable with a screen reader: the Watch
17
+ * control is named `"Watch {mediaName}"` rather than a bare `"Watch"`, so ten
18
+ * cards in a row do not all announce as the same button. Required for that
19
+ * reason — pass the title even when it is not drawn on the card.
20
+ */
21
+ mediaName: string;
22
+ /**
23
+ * Alt text for the thumbnail. Defaults to `""` (decorative): the thumbnail is
24
+ * a picture *of* the media that `mediaName` already names, so describing it
25
+ * again duplicates the announcement. Pass a value only when the image carries
26
+ * information the name does not.
27
+ */
28
+ alt?: string;
29
+ /** Figma `Orientation`. Defaults to `horizontal`. */
30
+ orientation?: MediaCardOrientation;
31
+ /**
32
+ * Figma `Rewarded`. Marks the media as granting a reward for watching, which
33
+ * appends the `rewardIcon` to the Watch control and to its accessible name.
34
+ */
35
+ rewarded?: boolean;
36
+ /**
37
+ * The reward glyph shown inside the Watch control when `rewarded` is set.
38
+ * Unopinionated slot — pass the product's own coin/currency icon. Omit it and
39
+ * the card draws a neutral 16 px placeholder mark instead.
40
+ */
41
+ rewardIcon?: ReactNode;
42
+ /** Figma `Watch Button`. Set `false` to render the bare thumbnail. Defaults to `true`. */
43
+ showWatchButton?: boolean;
44
+ /** Visible label on the Watch control. Defaults to `"Watch"`. */
45
+ watchLabel?: string;
46
+ /** Called when the Watch control is activated. */
47
+ onWatchPress?: () => void;
48
+ /**
49
+ * Called when the plate itself is pressed. Optional — a card can be a pure
50
+ * thumbnail whose only action is the Watch control.
51
+ */
52
+ onPress?: () => void;
53
+ /** Removes interactivity from both the plate and the Watch control, and dims the card. */
54
+ disabled?: boolean;
55
+ /** Plate width. Defaults to the Figma frame width for the orientation. */
56
+ width?: number | string;
57
+ /** Plate height. Overrides the orientation's aspect ratio when supplied. */
58
+ height?: number | string;
59
+ testID?: string;
60
+ }
61
+
62
+ declare const MediaCard: React.FC<MediaCardProps>;
63
+
64
+ export { MediaCard, type MediaCardOrientation, type MediaCardProps };
package/web/index.d.ts ADDED
@@ -0,0 +1,64 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+
4
+ /**
5
+ * Figma `Orientation`. `horizontal` is the 319×179 landscape plate used in a
6
+ * video row; `vertical` is the 95×169 portrait plate used in a shorts rail.
7
+ */
8
+ type MediaCardOrientation = "horizontal" | "vertical";
9
+ interface MediaCardProps extends ThemeOverrideProps {
10
+ /** Thumbnail image URL. Fills the whole plate, cropped to cover. */
11
+ src: string;
12
+ /**
13
+ * Human-readable name of the media this card represents, e.g.
14
+ * `"Chapter 3: The Ascent"`.
15
+ *
16
+ * This is what makes a grid of cards usable with a screen reader: the Watch
17
+ * control is named `"Watch {mediaName}"` rather than a bare `"Watch"`, so ten
18
+ * cards in a row do not all announce as the same button. Required for that
19
+ * reason — pass the title even when it is not drawn on the card.
20
+ */
21
+ mediaName: string;
22
+ /**
23
+ * Alt text for the thumbnail. Defaults to `""` (decorative): the thumbnail is
24
+ * a picture *of* the media that `mediaName` already names, so describing it
25
+ * again duplicates the announcement. Pass a value only when the image carries
26
+ * information the name does not.
27
+ */
28
+ alt?: string;
29
+ /** Figma `Orientation`. Defaults to `horizontal`. */
30
+ orientation?: MediaCardOrientation;
31
+ /**
32
+ * Figma `Rewarded`. Marks the media as granting a reward for watching, which
33
+ * appends the `rewardIcon` to the Watch control and to its accessible name.
34
+ */
35
+ rewarded?: boolean;
36
+ /**
37
+ * The reward glyph shown inside the Watch control when `rewarded` is set.
38
+ * Unopinionated slot — pass the product's own coin/currency icon. Omit it and
39
+ * the card draws a neutral 16 px placeholder mark instead.
40
+ */
41
+ rewardIcon?: ReactNode;
42
+ /** Figma `Watch Button`. Set `false` to render the bare thumbnail. Defaults to `true`. */
43
+ showWatchButton?: boolean;
44
+ /** Visible label on the Watch control. Defaults to `"Watch"`. */
45
+ watchLabel?: string;
46
+ /** Called when the Watch control is activated. */
47
+ onWatchPress?: () => void;
48
+ /**
49
+ * Called when the plate itself is pressed. Optional — a card can be a pure
50
+ * thumbnail whose only action is the Watch control.
51
+ */
52
+ onPress?: () => void;
53
+ /** Removes interactivity from both the plate and the Watch control, and dims the card. */
54
+ disabled?: boolean;
55
+ /** Plate width. Defaults to the Figma frame width for the orientation. */
56
+ width?: number | string;
57
+ /** Plate height. Overrides the orientation's aspect ratio when supplied. */
58
+ height?: number | string;
59
+ testID?: string;
60
+ }
61
+
62
+ declare const MediaCard: React.FC<MediaCardProps>;
63
+
64
+ export { MediaCard, type MediaCardOrientation, type MediaCardProps };