@xsolla/xui-b2b-itemer-group 0.216.0 → 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.
@@ -3,33 +3,134 @@ import React__default, { ReactNode } from 'react';
3
3
  import { ThemeOverrideProps } from '@xsolla/xui-core';
4
4
  import { BaseIconComponent } from '@xsolla/xui-icons-base';
5
5
 
6
- /** Any `@xsolla/xui-icons-base` icon component for row remove buttons. Defaults to `Remove`. */
6
+ /** Any `@xsolla/xui-icons-base` icon component for row remove buttons. */
7
7
  type ItemerGroupRemoveIcon = BaseIconComponent;
8
- type ItemerGroupContentType = "input" | "select";
8
+ /**
9
+ * Built-in remove-button icons. Either option works with any variant of the
10
+ * component — it is not tied to the kind of control used in the rows.
11
+ *
12
+ * `cross` renders `Remove` (×), `minus` renders `Minus` (−).
13
+ */
14
+ type ItemerGroupRemoveButtonIcon = "cross" | "minus";
15
+ /**
16
+ * Width of a single control column inside a row.
17
+ *
18
+ * - `number` — flex grow factor. `1` is an equal share, `2` is twice as wide
19
+ * as a sibling column with `1`.
20
+ * - `"auto"` — the column takes its control's own width and never grows or
21
+ * shrinks. Use it for fixed-size controls such as `ItemerGroupPreview`.
22
+ * - any other `string` — an explicit CSS length used as `flex-basis`,
23
+ * typically a percentage (e.g. `"40%"`).
24
+ */
25
+ type ItemerGroupColumnWidth = number | "auto" | string;
9
26
  interface ItemerGroupProps extends ThemeOverrideProps {
10
27
  label?: string | string[];
28
+ /**
29
+ * Toggle the label row. Works for every variant of the component, so a
30
+ * label can be defined and hidden without dropping the `label` prop.
31
+ */
32
+ showLabel?: boolean;
11
33
  children?: ReactNode;
12
34
  draggable?: boolean;
13
35
  /**
14
- * Row control layout — sets the default remove icon when `removeIcon` is omitted.
15
- * `input` uses `Remove` (×); `select` uses `Minus` (−).
36
+ * Minimum number of rows the group must keep. Remove buttons are hidden
37
+ * while the row count is at or below this value.
38
+ *
39
+ * - `1` (default) — the last remaining row cannot be removed.
40
+ * - `0` — every row can be removed, so the list may become empty. Use this
41
+ * when having no items is a valid state.
16
42
  */
17
- contentType?: ItemerGroupContentType;
43
+ minRows?: number;
18
44
  /**
19
- * Icon component for row remove buttons — any export from `@xsolla/xui-icons-base`
20
- * (e.g. `Remove`, `Minus`). Overrides the `contentType` default.
45
+ * Maximum number of rows the group accepts. Once the row count reaches this
46
+ * value the whole action row below the list — the built-in add button *and*
47
+ * any `actions`, such as an "Upload file" button — is hidden, so no further
48
+ * item can be added.
49
+ *
50
+ * Omit for an unbounded list (the default).
51
+ */
52
+ maxRows?: number;
53
+ /**
54
+ * Which built-in icon the row remove buttons use. Independent of the kind of
55
+ * control rendered in the rows.
56
+ */
57
+ removeButtonIcon?: ItemerGroupRemoveButtonIcon;
58
+ /**
59
+ * Escape hatch for an arbitrary icon component from `@xsolla/xui-icons-base`.
60
+ * Overrides `removeButtonIcon`.
21
61
  */
22
62
  removeIcon?: ItemerGroupRemoveIcon;
63
+ /**
64
+ * Width of each control column, applied to both the label row and every
65
+ * `ItemerGroupRow`. Omit for equal-width columns.
66
+ *
67
+ * Columns beyond the end of the array fall back to an equal share.
68
+ */
69
+ columnWidths?: ItemerGroupColumnWidth[];
23
70
  onAdd?: () => void;
24
71
  addButtonLabel?: string;
25
72
  showAddButton?: boolean;
73
+ /**
74
+ * Extra action buttons rendered in the row below the list, after the
75
+ * built-in add button — for example an "Upload file" `Button` that opens a
76
+ * file picker. The row is rendered when either the add button or `actions`
77
+ * is present, so `showAddButton={false}` + `actions` gives an upload-only
78
+ * variant.
79
+ *
80
+ * Hidden together with the add button once `maxRows` is reached.
81
+ */
82
+ actions?: ReactNode;
83
+ className?: string;
84
+ testID?: string;
85
+ }
86
+ interface ItemerGroupFileCellProps extends ThemeOverrideProps {
87
+ /** File name (or any primary text). Truncated with an ellipsis. */
88
+ name: string;
89
+ /** Secondary text shown on the right, typically the file size (`"1.5MB"`). */
90
+ meta?: string;
91
+ /**
92
+ * Highlights the cell as invalid without rendering a message. Use it when
93
+ * the validation text lives elsewhere on the page.
94
+ */
95
+ error?: boolean;
96
+ /**
97
+ * Validation message rendered below the cell — for example when an uploaded
98
+ * file is too large. Implies `error`, so it does not have to be set as well.
99
+ */
100
+ errorMessage?: string;
101
+ className?: string;
102
+ testID?: string;
103
+ }
104
+ interface ItemerGroupPreviewProps extends ThemeOverrideProps {
105
+ /**
106
+ * Image URL. When omitted the preview renders a neutral placeholder with a
107
+ * file icon.
108
+ */
109
+ src?: string;
110
+ alt?: string;
111
+ /**
112
+ * Renders a spinner in place of the image or the file-icon placeholder while
113
+ * the thumbnail is being resolved — for example while fetching the preview
114
+ * of a link the user has just pasted. Takes precedence over `src`.
115
+ */
116
+ loading?: boolean;
117
+ /** Accessible label announced while `loading` is set. */
118
+ loadingLabel?: string;
26
119
  className?: string;
27
120
  testID?: string;
28
121
  }
29
122
  interface ItemerGroupRowProps {
123
+ /**
124
+ * Row content. Any control is allowed — `Input` and `Select` are the common
125
+ * cases, but a date picker or anything else works too. Each direct child
126
+ * becomes one column, sized by the parent's `columnWidths`.
127
+ */
30
128
  children: ReactNode;
129
+ /**
130
+ * Removes this row. The button is hidden automatically while this is the
131
+ * last remaining row of the group.
132
+ */
31
133
  onRemove?: () => void;
32
- onAdd?: () => void;
33
134
  className?: string;
34
135
  }
35
136
 
@@ -37,11 +138,46 @@ declare const ItemerGroup: React__default.FC<ItemerGroupProps>;
37
138
 
38
139
  declare const ItemerGroupRow: React__default.FC<ItemerGroupRowProps>;
39
140
 
141
+ /**
142
+ * Read-only row content for an uploaded file — the file name on the left and
143
+ * an optional meta text (typically the size) on the right, styled like a
144
+ * `size="sm"` input so it lines up with other controls in the group.
145
+ *
146
+ * The cell is non-interactive by design: the user cannot edit the file name
147
+ * despite the input-like chrome. Pass `errorMessage` to surface file-level
148
+ * validation (e.g. "file is too large") below the cell, matching how `Input`
149
+ * renders its own errors.
150
+ *
151
+ * Pair it with `ItemerGroupPreview` for a thumbnail column and with the group's
152
+ * `actions` slot for an "Upload file" button.
153
+ */
154
+ declare const ItemerGroupFileCell: React__default.FC<ItemerGroupFileCellProps>;
155
+
156
+ /**
157
+ * Fixed-size 77×40 thumbnail for a file row. Renders, in order of precedence:
158
+ * a spinner while `loading`, the image when `src` is set, and a neutral
159
+ * placeholder with a file icon otherwise.
160
+ *
161
+ * Because the size is fixed, give its column `"auto"` in the parent group's
162
+ * `columnWidths` (e.g. `columnWidths={["auto", 1]}`) so it does not stretch.
163
+ */
164
+ declare const ItemerGroupPreview: React__default.FC<ItemerGroupPreviewProps>;
165
+
40
166
  interface ItemerGroupContextValue {
41
167
  draggable: boolean;
168
+ /**
169
+ * Number of rows in the group. `0` means the row is rendered outside an
170
+ * `ItemerGroup`, so the row count is unknown.
171
+ */
42
172
  rowCount: number;
173
+ /**
174
+ * Minimum number of rows the group keeps. Remove buttons are hidden while
175
+ * `rowCount <= minRows`.
176
+ */
177
+ minRows: number;
43
178
  removeIcon: ItemerGroupRemoveIcon;
179
+ columnWidths?: ItemerGroupColumnWidth[];
44
180
  }
45
181
  declare const ItemerGroupContext: React.Context<ItemerGroupContextValue>;
46
182
 
47
- export { ItemerGroup, type ItemerGroupContentType, ItemerGroupContext, type ItemerGroupProps, type ItemerGroupRemoveIcon, ItemerGroupRow, type ItemerGroupRowProps };
183
+ export { ItemerGroup, type ItemerGroupColumnWidth, ItemerGroupContext, ItemerGroupFileCell, type ItemerGroupFileCellProps, ItemerGroupPreview, type ItemerGroupPreviewProps, type ItemerGroupProps, type ItemerGroupRemoveButtonIcon, type ItemerGroupRemoveIcon, ItemerGroupRow, type ItemerGroupRowProps };
package/native/index.d.ts CHANGED
@@ -3,33 +3,134 @@ import React__default, { ReactNode } from 'react';
3
3
  import { ThemeOverrideProps } from '@xsolla/xui-core';
4
4
  import { BaseIconComponent } from '@xsolla/xui-icons-base';
5
5
 
6
- /** Any `@xsolla/xui-icons-base` icon component for row remove buttons. Defaults to `Remove`. */
6
+ /** Any `@xsolla/xui-icons-base` icon component for row remove buttons. */
7
7
  type ItemerGroupRemoveIcon = BaseIconComponent;
8
- type ItemerGroupContentType = "input" | "select";
8
+ /**
9
+ * Built-in remove-button icons. Either option works with any variant of the
10
+ * component — it is not tied to the kind of control used in the rows.
11
+ *
12
+ * `cross` renders `Remove` (×), `minus` renders `Minus` (−).
13
+ */
14
+ type ItemerGroupRemoveButtonIcon = "cross" | "minus";
15
+ /**
16
+ * Width of a single control column inside a row.
17
+ *
18
+ * - `number` — flex grow factor. `1` is an equal share, `2` is twice as wide
19
+ * as a sibling column with `1`.
20
+ * - `"auto"` — the column takes its control's own width and never grows or
21
+ * shrinks. Use it for fixed-size controls such as `ItemerGroupPreview`.
22
+ * - any other `string` — an explicit CSS length used as `flex-basis`,
23
+ * typically a percentage (e.g. `"40%"`).
24
+ */
25
+ type ItemerGroupColumnWidth = number | "auto" | string;
9
26
  interface ItemerGroupProps extends ThemeOverrideProps {
10
27
  label?: string | string[];
28
+ /**
29
+ * Toggle the label row. Works for every variant of the component, so a
30
+ * label can be defined and hidden without dropping the `label` prop.
31
+ */
32
+ showLabel?: boolean;
11
33
  children?: ReactNode;
12
34
  draggable?: boolean;
13
35
  /**
14
- * Row control layout — sets the default remove icon when `removeIcon` is omitted.
15
- * `input` uses `Remove` (×); `select` uses `Minus` (−).
36
+ * Minimum number of rows the group must keep. Remove buttons are hidden
37
+ * while the row count is at or below this value.
38
+ *
39
+ * - `1` (default) — the last remaining row cannot be removed.
40
+ * - `0` — every row can be removed, so the list may become empty. Use this
41
+ * when having no items is a valid state.
16
42
  */
17
- contentType?: ItemerGroupContentType;
43
+ minRows?: number;
18
44
  /**
19
- * Icon component for row remove buttons — any export from `@xsolla/xui-icons-base`
20
- * (e.g. `Remove`, `Minus`). Overrides the `contentType` default.
45
+ * Maximum number of rows the group accepts. Once the row count reaches this
46
+ * value the whole action row below the list — the built-in add button *and*
47
+ * any `actions`, such as an "Upload file" button — is hidden, so no further
48
+ * item can be added.
49
+ *
50
+ * Omit for an unbounded list (the default).
51
+ */
52
+ maxRows?: number;
53
+ /**
54
+ * Which built-in icon the row remove buttons use. Independent of the kind of
55
+ * control rendered in the rows.
56
+ */
57
+ removeButtonIcon?: ItemerGroupRemoveButtonIcon;
58
+ /**
59
+ * Escape hatch for an arbitrary icon component from `@xsolla/xui-icons-base`.
60
+ * Overrides `removeButtonIcon`.
21
61
  */
22
62
  removeIcon?: ItemerGroupRemoveIcon;
63
+ /**
64
+ * Width of each control column, applied to both the label row and every
65
+ * `ItemerGroupRow`. Omit for equal-width columns.
66
+ *
67
+ * Columns beyond the end of the array fall back to an equal share.
68
+ */
69
+ columnWidths?: ItemerGroupColumnWidth[];
23
70
  onAdd?: () => void;
24
71
  addButtonLabel?: string;
25
72
  showAddButton?: boolean;
73
+ /**
74
+ * Extra action buttons rendered in the row below the list, after the
75
+ * built-in add button — for example an "Upload file" `Button` that opens a
76
+ * file picker. The row is rendered when either the add button or `actions`
77
+ * is present, so `showAddButton={false}` + `actions` gives an upload-only
78
+ * variant.
79
+ *
80
+ * Hidden together with the add button once `maxRows` is reached.
81
+ */
82
+ actions?: ReactNode;
83
+ className?: string;
84
+ testID?: string;
85
+ }
86
+ interface ItemerGroupFileCellProps extends ThemeOverrideProps {
87
+ /** File name (or any primary text). Truncated with an ellipsis. */
88
+ name: string;
89
+ /** Secondary text shown on the right, typically the file size (`"1.5MB"`). */
90
+ meta?: string;
91
+ /**
92
+ * Highlights the cell as invalid without rendering a message. Use it when
93
+ * the validation text lives elsewhere on the page.
94
+ */
95
+ error?: boolean;
96
+ /**
97
+ * Validation message rendered below the cell — for example when an uploaded
98
+ * file is too large. Implies `error`, so it does not have to be set as well.
99
+ */
100
+ errorMessage?: string;
101
+ className?: string;
102
+ testID?: string;
103
+ }
104
+ interface ItemerGroupPreviewProps extends ThemeOverrideProps {
105
+ /**
106
+ * Image URL. When omitted the preview renders a neutral placeholder with a
107
+ * file icon.
108
+ */
109
+ src?: string;
110
+ alt?: string;
111
+ /**
112
+ * Renders a spinner in place of the image or the file-icon placeholder while
113
+ * the thumbnail is being resolved — for example while fetching the preview
114
+ * of a link the user has just pasted. Takes precedence over `src`.
115
+ */
116
+ loading?: boolean;
117
+ /** Accessible label announced while `loading` is set. */
118
+ loadingLabel?: string;
26
119
  className?: string;
27
120
  testID?: string;
28
121
  }
29
122
  interface ItemerGroupRowProps {
123
+ /**
124
+ * Row content. Any control is allowed — `Input` and `Select` are the common
125
+ * cases, but a date picker or anything else works too. Each direct child
126
+ * becomes one column, sized by the parent's `columnWidths`.
127
+ */
30
128
  children: ReactNode;
129
+ /**
130
+ * Removes this row. The button is hidden automatically while this is the
131
+ * last remaining row of the group.
132
+ */
31
133
  onRemove?: () => void;
32
- onAdd?: () => void;
33
134
  className?: string;
34
135
  }
35
136
 
@@ -37,11 +138,46 @@ declare const ItemerGroup: React__default.FC<ItemerGroupProps>;
37
138
 
38
139
  declare const ItemerGroupRow: React__default.FC<ItemerGroupRowProps>;
39
140
 
141
+ /**
142
+ * Read-only row content for an uploaded file — the file name on the left and
143
+ * an optional meta text (typically the size) on the right, styled like a
144
+ * `size="sm"` input so it lines up with other controls in the group.
145
+ *
146
+ * The cell is non-interactive by design: the user cannot edit the file name
147
+ * despite the input-like chrome. Pass `errorMessage` to surface file-level
148
+ * validation (e.g. "file is too large") below the cell, matching how `Input`
149
+ * renders its own errors.
150
+ *
151
+ * Pair it with `ItemerGroupPreview` for a thumbnail column and with the group's
152
+ * `actions` slot for an "Upload file" button.
153
+ */
154
+ declare const ItemerGroupFileCell: React__default.FC<ItemerGroupFileCellProps>;
155
+
156
+ /**
157
+ * Fixed-size 77×40 thumbnail for a file row. Renders, in order of precedence:
158
+ * a spinner while `loading`, the image when `src` is set, and a neutral
159
+ * placeholder with a file icon otherwise.
160
+ *
161
+ * Because the size is fixed, give its column `"auto"` in the parent group's
162
+ * `columnWidths` (e.g. `columnWidths={["auto", 1]}`) so it does not stretch.
163
+ */
164
+ declare const ItemerGroupPreview: React__default.FC<ItemerGroupPreviewProps>;
165
+
40
166
  interface ItemerGroupContextValue {
41
167
  draggable: boolean;
168
+ /**
169
+ * Number of rows in the group. `0` means the row is rendered outside an
170
+ * `ItemerGroup`, so the row count is unknown.
171
+ */
42
172
  rowCount: number;
173
+ /**
174
+ * Minimum number of rows the group keeps. Remove buttons are hidden while
175
+ * `rowCount <= minRows`.
176
+ */
177
+ minRows: number;
43
178
  removeIcon: ItemerGroupRemoveIcon;
179
+ columnWidths?: ItemerGroupColumnWidth[];
44
180
  }
45
181
  declare const ItemerGroupContext: React.Context<ItemerGroupContextValue>;
46
182
 
47
- export { ItemerGroup, type ItemerGroupContentType, ItemerGroupContext, type ItemerGroupProps, type ItemerGroupRemoveIcon, ItemerGroupRow, type ItemerGroupRowProps };
183
+ export { ItemerGroup, type ItemerGroupColumnWidth, ItemerGroupContext, ItemerGroupFileCell, type ItemerGroupFileCellProps, ItemerGroupPreview, type ItemerGroupPreviewProps, type ItemerGroupProps, type ItemerGroupRemoveButtonIcon, type ItemerGroupRemoveIcon, ItemerGroupRow, type ItemerGroupRowProps };