@xsolla/xui-b2c-currency-tag 0.211.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.
@@ -0,0 +1,85 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps, ComponentSize } from '@xsolla/xui-core';
3
+
4
+ /**
5
+ * Xsolla virtual currency the tag represents. Maps 1:1 onto the `Type` variant
6
+ * of the Figma `CurrencyTag` component set.
7
+ */
8
+ type CurrencyType = "xsolla-points" | "xsolla-tickets" | "xsolla-gold" | "play-time" | "green-orb";
9
+ /** Which side of the value the currency icon sits on. Figma: `Icon`. */
10
+ type CurrencyTagIconPosition = "left" | "right";
11
+ /**
12
+ * Tag size. Figma's size matrix (`6767:26747`) is XS / S / M / L / XL —
13
+ * mapped onto the toolkit `ComponentSize` scale. Default `'sm'` matches the
14
+ * 24px `CurrencyTag` component set.
15
+ */
16
+ type CurrencyTagSize = ComponentSize;
17
+ interface CurrencyTagProps extends ThemeOverrideProps {
18
+ /** Currency the tag represents. Default: `'xsolla-points'` */
19
+ currency?: CurrencyType;
20
+ /**
21
+ * Size of the tag. Default: `'sm'` (the Figma `CurrencyTag` chip).
22
+ * Figma size matrix: XS / S / M / L / XL → `xs` / `sm` / `md` / `lg` / `xl`.
23
+ */
24
+ size?: CurrencyTagSize;
25
+ /** The amount shown in the tag, e.g. `250` or `'+250'` */
26
+ value?: ReactNode;
27
+ /**
28
+ * Previous amount, rendered struck through and dimmed before `value`.
29
+ * Figma: the `Sublable` boolean property.
30
+ */
31
+ sublabel?: ReactNode;
32
+ /** Side the currency icon sits on. Default: `'left'` */
33
+ iconPosition?: CurrencyTagIconPosition;
34
+ /**
35
+ * Renders the tag on the themed surface with accent-coloured content instead
36
+ * of a solid accent fill. Figma: `Inverted=Yes`. Default: `false`
37
+ */
38
+ inverted?: boolean;
39
+ /** Replaces the built-in currency icon. Pass `null` to render no icon. */
40
+ icon?: ReactNode;
41
+ /** Accessible label for the tag. Falls back to the rendered text. */
42
+ "aria-label"?: string;
43
+ /** Test identifier applied to the root element. */
44
+ testID?: string;
45
+ }
46
+
47
+ declare const CurrencyTag: React.FC<CurrencyTagProps>;
48
+
49
+ /**
50
+ * Per-currency accent palette.
51
+ *
52
+ * Values are taken verbatim from the `CurrencyTag` component set in the B2C
53
+ * Figma library (node `1738:20679`). They are Figma-local variables with no
54
+ * counterpart in the shared XUI theme tokens, so they live here rather than in
55
+ * `@xsolla/xui-core`. `bg` is the solid tag fill of the non-inverted variant and
56
+ * doubles as the content colour of the inverted variant; `border` is the 1px
57
+ * inside stroke of the non-inverted variant.
58
+ */
59
+ declare const CURRENCY_TAG_PALETTE: Record<CurrencyType, {
60
+ bg: string;
61
+ border: string;
62
+ }>;
63
+ /** Content colour on the solid (non-inverted) tag. Figma: `#000000`. */
64
+ declare const CURRENCY_TAG_SOLID_CONTENT_COLOR = "#000000";
65
+ /**
66
+ * Geometry extras that stay constant across sizes, plus the Figma `sm` snapshot
67
+ * (node `1738:20679`, 24px). Height, padding, radius, icon, and type scale
68
+ * with `theme.sizing.tag(size)` — XS / S / M / L / XL in Figma.
69
+ */
70
+ declare const CURRENCY_TAG_METRICS: {
71
+ readonly height: 24;
72
+ readonly paddingHorizontal: 4;
73
+ readonly borderRadius: 4;
74
+ readonly borderWidth: 1;
75
+ readonly iconSize: 16;
76
+ readonly textPaddingHorizontal: 2;
77
+ readonly textGap: 3;
78
+ readonly fontSize: 14;
79
+ readonly lineHeight: 16;
80
+ readonly fontWeight: 500;
81
+ /** Opacity applied to the struck-through sublabel. */
82
+ readonly sublabelOpacity: 0.48;
83
+ };
84
+
85
+ export { CURRENCY_TAG_METRICS, CURRENCY_TAG_PALETTE, CURRENCY_TAG_SOLID_CONTENT_COLOR, CurrencyTag, type CurrencyTagIconPosition, type CurrencyTagProps, type CurrencyTagSize, type CurrencyType };
package/web/index.d.ts ADDED
@@ -0,0 +1,85 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps, ComponentSize } from '@xsolla/xui-core';
3
+
4
+ /**
5
+ * Xsolla virtual currency the tag represents. Maps 1:1 onto the `Type` variant
6
+ * of the Figma `CurrencyTag` component set.
7
+ */
8
+ type CurrencyType = "xsolla-points" | "xsolla-tickets" | "xsolla-gold" | "play-time" | "green-orb";
9
+ /** Which side of the value the currency icon sits on. Figma: `Icon`. */
10
+ type CurrencyTagIconPosition = "left" | "right";
11
+ /**
12
+ * Tag size. Figma's size matrix (`6767:26747`) is XS / S / M / L / XL —
13
+ * mapped onto the toolkit `ComponentSize` scale. Default `'sm'` matches the
14
+ * 24px `CurrencyTag` component set.
15
+ */
16
+ type CurrencyTagSize = ComponentSize;
17
+ interface CurrencyTagProps extends ThemeOverrideProps {
18
+ /** Currency the tag represents. Default: `'xsolla-points'` */
19
+ currency?: CurrencyType;
20
+ /**
21
+ * Size of the tag. Default: `'sm'` (the Figma `CurrencyTag` chip).
22
+ * Figma size matrix: XS / S / M / L / XL → `xs` / `sm` / `md` / `lg` / `xl`.
23
+ */
24
+ size?: CurrencyTagSize;
25
+ /** The amount shown in the tag, e.g. `250` or `'+250'` */
26
+ value?: ReactNode;
27
+ /**
28
+ * Previous amount, rendered struck through and dimmed before `value`.
29
+ * Figma: the `Sublable` boolean property.
30
+ */
31
+ sublabel?: ReactNode;
32
+ /** Side the currency icon sits on. Default: `'left'` */
33
+ iconPosition?: CurrencyTagIconPosition;
34
+ /**
35
+ * Renders the tag on the themed surface with accent-coloured content instead
36
+ * of a solid accent fill. Figma: `Inverted=Yes`. Default: `false`
37
+ */
38
+ inverted?: boolean;
39
+ /** Replaces the built-in currency icon. Pass `null` to render no icon. */
40
+ icon?: ReactNode;
41
+ /** Accessible label for the tag. Falls back to the rendered text. */
42
+ "aria-label"?: string;
43
+ /** Test identifier applied to the root element. */
44
+ testID?: string;
45
+ }
46
+
47
+ declare const CurrencyTag: React.FC<CurrencyTagProps>;
48
+
49
+ /**
50
+ * Per-currency accent palette.
51
+ *
52
+ * Values are taken verbatim from the `CurrencyTag` component set in the B2C
53
+ * Figma library (node `1738:20679`). They are Figma-local variables with no
54
+ * counterpart in the shared XUI theme tokens, so they live here rather than in
55
+ * `@xsolla/xui-core`. `bg` is the solid tag fill of the non-inverted variant and
56
+ * doubles as the content colour of the inverted variant; `border` is the 1px
57
+ * inside stroke of the non-inverted variant.
58
+ */
59
+ declare const CURRENCY_TAG_PALETTE: Record<CurrencyType, {
60
+ bg: string;
61
+ border: string;
62
+ }>;
63
+ /** Content colour on the solid (non-inverted) tag. Figma: `#000000`. */
64
+ declare const CURRENCY_TAG_SOLID_CONTENT_COLOR = "#000000";
65
+ /**
66
+ * Geometry extras that stay constant across sizes, plus the Figma `sm` snapshot
67
+ * (node `1738:20679`, 24px). Height, padding, radius, icon, and type scale
68
+ * with `theme.sizing.tag(size)` — XS / S / M / L / XL in Figma.
69
+ */
70
+ declare const CURRENCY_TAG_METRICS: {
71
+ readonly height: 24;
72
+ readonly paddingHorizontal: 4;
73
+ readonly borderRadius: 4;
74
+ readonly borderWidth: 1;
75
+ readonly iconSize: 16;
76
+ readonly textPaddingHorizontal: 2;
77
+ readonly textGap: 3;
78
+ readonly fontSize: 14;
79
+ readonly lineHeight: 16;
80
+ readonly fontWeight: 500;
81
+ /** Opacity applied to the struck-through sublabel. */
82
+ readonly sublabelOpacity: 0.48;
83
+ };
84
+
85
+ export { CURRENCY_TAG_METRICS, CURRENCY_TAG_PALETTE, CURRENCY_TAG_SOLID_CONTENT_COLOR, CurrencyTag, type CurrencyTagIconPosition, type CurrencyTagProps, type CurrencyTagSize, type CurrencyType };