@xsolla/xui-b2b-accordion 0.147.1
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/native/index.d.mts +32 -0
- package/native/index.d.ts +32 -0
- package/native/index.js +274 -0
- package/native/index.js.map +1 -0
- package/native/index.mjs +251 -0
- package/native/index.mjs.map +1 -0
- package/package.json +58 -0
- package/web/index.d.mts +32 -0
- package/web/index.d.ts +32 -0
- package/web/index.js +356 -0
- package/web/index.js.map +1 -0
- package/web/index.mjs +319 -0
- package/web/index.mjs.map +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeOverrideProps } from '@xsolla/xui-core';
|
|
4
|
+
|
|
5
|
+
interface AccordionItem {
|
|
6
|
+
key: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
caption?: ReactNode;
|
|
9
|
+
/** Optional icon shown in a 32×32 slot at the left of the trigger. */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** Optional content shown to the right of the text, before the chevron. */
|
|
12
|
+
trailing?: ReactNode;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
interface AccordionProps extends ThemeOverrideProps {
|
|
16
|
+
items: AccordionItem[];
|
|
17
|
+
/**
|
|
18
|
+
* When true, multiple items can be open simultaneously.
|
|
19
|
+
* Defaults to false (only one item open at a time).
|
|
20
|
+
*/
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/** Initial open keys for uncontrolled usage. */
|
|
23
|
+
defaultOpenKeys?: string[];
|
|
24
|
+
/** Controlled open keys. */
|
|
25
|
+
openKeys?: string[];
|
|
26
|
+
onOpenChange?: (keys: string[]) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
|
|
32
|
+
export { Accordion, type AccordionItem, type AccordionProps };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ThemeOverrideProps } from '@xsolla/xui-core';
|
|
4
|
+
|
|
5
|
+
interface AccordionItem {
|
|
6
|
+
key: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
caption?: ReactNode;
|
|
9
|
+
/** Optional icon shown in a 32×32 slot at the left of the trigger. */
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** Optional content shown to the right of the text, before the chevron. */
|
|
12
|
+
trailing?: ReactNode;
|
|
13
|
+
content: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
interface AccordionProps extends ThemeOverrideProps {
|
|
16
|
+
items: AccordionItem[];
|
|
17
|
+
/**
|
|
18
|
+
* When true, multiple items can be open simultaneously.
|
|
19
|
+
* Defaults to false (only one item open at a time).
|
|
20
|
+
*/
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/** Initial open keys for uncontrolled usage. */
|
|
23
|
+
defaultOpenKeys?: string[];
|
|
24
|
+
/** Controlled open keys. */
|
|
25
|
+
openKeys?: string[];
|
|
26
|
+
onOpenChange?: (keys: string[]) => void;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
|
|
32
|
+
export { Accordion, type AccordionItem, type AccordionProps };
|
package/native/index.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.tsx
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Accordion: () => Accordion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/Accordion.tsx
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
|
|
30
|
+
// ../../foundation/primitives-native/src/Box.tsx
|
|
31
|
+
var import_react_native = require("react-native");
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var Box = ({
|
|
34
|
+
children,
|
|
35
|
+
onPress,
|
|
36
|
+
onLayout,
|
|
37
|
+
onMoveShouldSetResponder,
|
|
38
|
+
onResponderGrant,
|
|
39
|
+
onResponderMove,
|
|
40
|
+
onResponderRelease,
|
|
41
|
+
onResponderTerminate,
|
|
42
|
+
backgroundColor,
|
|
43
|
+
borderColor,
|
|
44
|
+
borderWidth,
|
|
45
|
+
borderBottomWidth,
|
|
46
|
+
borderBottomColor,
|
|
47
|
+
borderTopWidth,
|
|
48
|
+
borderTopColor,
|
|
49
|
+
borderLeftWidth,
|
|
50
|
+
borderLeftColor,
|
|
51
|
+
borderRightWidth,
|
|
52
|
+
borderRightColor,
|
|
53
|
+
borderRadius,
|
|
54
|
+
borderStyle,
|
|
55
|
+
height,
|
|
56
|
+
padding,
|
|
57
|
+
paddingHorizontal,
|
|
58
|
+
paddingVertical,
|
|
59
|
+
margin,
|
|
60
|
+
marginTop,
|
|
61
|
+
marginBottom,
|
|
62
|
+
marginLeft,
|
|
63
|
+
marginRight,
|
|
64
|
+
flexDirection,
|
|
65
|
+
alignItems,
|
|
66
|
+
justifyContent,
|
|
67
|
+
position,
|
|
68
|
+
top,
|
|
69
|
+
bottom,
|
|
70
|
+
left,
|
|
71
|
+
right,
|
|
72
|
+
width,
|
|
73
|
+
minWidth,
|
|
74
|
+
minHeight,
|
|
75
|
+
maxWidth,
|
|
76
|
+
maxHeight,
|
|
77
|
+
flex,
|
|
78
|
+
overflow,
|
|
79
|
+
zIndex,
|
|
80
|
+
hoverStyle,
|
|
81
|
+
pressStyle,
|
|
82
|
+
style,
|
|
83
|
+
"data-testid": dataTestId,
|
|
84
|
+
testID,
|
|
85
|
+
as,
|
|
86
|
+
src,
|
|
87
|
+
alt,
|
|
88
|
+
...rest
|
|
89
|
+
}) => {
|
|
90
|
+
const getContainerStyle = (pressed) => ({
|
|
91
|
+
backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
|
|
92
|
+
borderColor,
|
|
93
|
+
borderWidth,
|
|
94
|
+
borderBottomWidth,
|
|
95
|
+
borderBottomColor,
|
|
96
|
+
borderTopWidth,
|
|
97
|
+
borderTopColor,
|
|
98
|
+
borderLeftWidth,
|
|
99
|
+
borderLeftColor,
|
|
100
|
+
borderRightWidth,
|
|
101
|
+
borderRightColor,
|
|
102
|
+
borderRadius,
|
|
103
|
+
borderStyle,
|
|
104
|
+
overflow,
|
|
105
|
+
zIndex,
|
|
106
|
+
height,
|
|
107
|
+
width,
|
|
108
|
+
minWidth,
|
|
109
|
+
minHeight,
|
|
110
|
+
maxWidth,
|
|
111
|
+
maxHeight,
|
|
112
|
+
padding,
|
|
113
|
+
paddingHorizontal,
|
|
114
|
+
paddingVertical,
|
|
115
|
+
margin,
|
|
116
|
+
marginTop,
|
|
117
|
+
marginBottom,
|
|
118
|
+
marginLeft,
|
|
119
|
+
marginRight,
|
|
120
|
+
flexDirection,
|
|
121
|
+
alignItems,
|
|
122
|
+
justifyContent,
|
|
123
|
+
position,
|
|
124
|
+
top,
|
|
125
|
+
bottom,
|
|
126
|
+
left,
|
|
127
|
+
right,
|
|
128
|
+
flex,
|
|
129
|
+
...style
|
|
130
|
+
});
|
|
131
|
+
const finalTestID = dataTestId || testID;
|
|
132
|
+
const {
|
|
133
|
+
role,
|
|
134
|
+
tabIndex,
|
|
135
|
+
onKeyDown,
|
|
136
|
+
onKeyUp,
|
|
137
|
+
"aria-label": _ariaLabel,
|
|
138
|
+
"aria-labelledby": _ariaLabelledBy,
|
|
139
|
+
"aria-current": _ariaCurrent,
|
|
140
|
+
"aria-disabled": _ariaDisabled,
|
|
141
|
+
"aria-live": _ariaLive,
|
|
142
|
+
className,
|
|
143
|
+
"data-testid": _dataTestId,
|
|
144
|
+
...nativeRest
|
|
145
|
+
} = rest;
|
|
146
|
+
if (as === "img" && src) {
|
|
147
|
+
const imageStyle = {
|
|
148
|
+
width,
|
|
149
|
+
height,
|
|
150
|
+
borderRadius,
|
|
151
|
+
position,
|
|
152
|
+
top,
|
|
153
|
+
bottom,
|
|
154
|
+
left,
|
|
155
|
+
right,
|
|
156
|
+
...style
|
|
157
|
+
};
|
|
158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
|
+
import_react_native.Image,
|
|
160
|
+
{
|
|
161
|
+
source: { uri: src },
|
|
162
|
+
style: imageStyle,
|
|
163
|
+
testID: finalTestID,
|
|
164
|
+
resizeMode: "cover",
|
|
165
|
+
...nativeRest
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
if (onPress) {
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
|
+
import_react_native.Pressable,
|
|
172
|
+
{
|
|
173
|
+
onPress,
|
|
174
|
+
onLayout,
|
|
175
|
+
onMoveShouldSetResponder,
|
|
176
|
+
onResponderGrant,
|
|
177
|
+
onResponderMove,
|
|
178
|
+
onResponderRelease,
|
|
179
|
+
onResponderTerminate,
|
|
180
|
+
style: ({ pressed }) => getContainerStyle(pressed),
|
|
181
|
+
testID: finalTestID,
|
|
182
|
+
...nativeRest,
|
|
183
|
+
children
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
import_react_native.View,
|
|
189
|
+
{
|
|
190
|
+
style: getContainerStyle(),
|
|
191
|
+
testID: finalTestID,
|
|
192
|
+
onLayout,
|
|
193
|
+
onMoveShouldSetResponder,
|
|
194
|
+
onResponderGrant,
|
|
195
|
+
onResponderMove,
|
|
196
|
+
onResponderRelease,
|
|
197
|
+
onResponderTerminate,
|
|
198
|
+
...nativeRest,
|
|
199
|
+
children
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/Accordion.tsx
|
|
205
|
+
var import_xui_core = require("@xsolla/xui-core");
|
|
206
|
+
var import_xui_b2b_collapsible = require("@xsolla/xui-b2b-collapsible");
|
|
207
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
208
|
+
var Accordion = (0, import_react.forwardRef)(
|
|
209
|
+
({
|
|
210
|
+
items,
|
|
211
|
+
multiple = false,
|
|
212
|
+
defaultOpenKeys = [],
|
|
213
|
+
openKeys: openKeysProp,
|
|
214
|
+
onOpenChange,
|
|
215
|
+
className,
|
|
216
|
+
themeMode,
|
|
217
|
+
themeProductContext,
|
|
218
|
+
...rest
|
|
219
|
+
}, ref) => {
|
|
220
|
+
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
221
|
+
const sizing = theme.sizing.collapsibleB2b();
|
|
222
|
+
const isControlled = openKeysProp !== void 0;
|
|
223
|
+
const [openState, setOpenState] = (0, import_react.useState)(defaultOpenKeys);
|
|
224
|
+
const openKeys = isControlled ? openKeysProp : openState;
|
|
225
|
+
const handleOpenChange = (0, import_react.useCallback)(
|
|
226
|
+
(key, open) => {
|
|
227
|
+
let next;
|
|
228
|
+
if (open) {
|
|
229
|
+
next = multiple ? [...openKeys, key] : [key];
|
|
230
|
+
} else {
|
|
231
|
+
next = openKeys.filter((k) => k !== key);
|
|
232
|
+
}
|
|
233
|
+
if (!isControlled) setOpenState(next);
|
|
234
|
+
onOpenChange?.(next);
|
|
235
|
+
},
|
|
236
|
+
[openKeys, multiple, isControlled, onOpenChange]
|
|
237
|
+
);
|
|
238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
239
|
+
Box,
|
|
240
|
+
{
|
|
241
|
+
ref,
|
|
242
|
+
"data-testid": "accordion",
|
|
243
|
+
className,
|
|
244
|
+
flexDirection: "column",
|
|
245
|
+
alignItems: "stretch",
|
|
246
|
+
width: "100%",
|
|
247
|
+
style: { gap: sizing.accordionItemGap },
|
|
248
|
+
...rest,
|
|
249
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
250
|
+
import_xui_b2b_collapsible.Collapsible,
|
|
251
|
+
{
|
|
252
|
+
title: item.title,
|
|
253
|
+
caption: item.caption,
|
|
254
|
+
icon: item.icon,
|
|
255
|
+
trailing: item.trailing,
|
|
256
|
+
view: "white-surface",
|
|
257
|
+
open: openKeys.includes(item.key),
|
|
258
|
+
onOpenChange: (open) => handleOpenChange(item.key, open),
|
|
259
|
+
themeMode,
|
|
260
|
+
themeProductContext,
|
|
261
|
+
children: item.content
|
|
262
|
+
},
|
|
263
|
+
item.key
|
|
264
|
+
))
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
Accordion.displayName = "Accordion";
|
|
270
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
271
|
+
0 && (module.exports = {
|
|
272
|
+
Accordion
|
|
273
|
+
});
|
|
274
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.tsx","../../src/Accordion.tsx","../../../../foundation/primitives-native/src/Box.tsx"],"sourcesContent":["export { Accordion } from \"./Accordion\";\nexport type { AccordionProps, AccordionItem } from \"./types\";\n","import { forwardRef, useState, useCallback } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme } from \"@xsolla/xui-core\";\nimport { Collapsible } from \"@xsolla/xui-b2b-collapsible\";\nimport type { AccordionProps } from \"./types\";\n\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n items,\n multiple = false,\n defaultOpenKeys = [],\n openKeys: openKeysProp,\n onOpenChange,\n className,\n themeMode,\n themeProductContext,\n ...rest\n },\n ref\n ) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n const sizing = theme.sizing.collapsibleB2b();\n\n const isControlled = openKeysProp !== undefined;\n const [openState, setOpenState] = useState<string[]>(defaultOpenKeys);\n const openKeys = isControlled ? openKeysProp! : openState;\n\n const handleOpenChange = useCallback(\n (key: string, open: boolean) => {\n let next: string[];\n if (open) {\n next = multiple ? [...openKeys, key] : [key];\n } else {\n next = openKeys.filter((k) => k !== key);\n }\n if (!isControlled) setOpenState(next);\n onOpenChange?.(next);\n },\n [openKeys, multiple, isControlled, onOpenChange]\n );\n\n return (\n <Box\n ref={ref}\n data-testid=\"accordion\"\n className={className}\n flexDirection=\"column\"\n alignItems=\"stretch\"\n width=\"100%\"\n style={{ gap: sizing.accordionItemGap }}\n {...rest}\n >\n {items.map((item) => (\n <Collapsible\n key={item.key}\n title={item.title}\n caption={item.caption}\n icon={item.icon}\n trailing={item.trailing}\n view=\"white-surface\"\n open={openKeys.includes(item.key)}\n onOpenChange={(open) => handleOpenChange(item.key, open)}\n themeMode={themeMode}\n themeProductContext={themeProductContext}\n >\n {item.content}\n </Collapsible>\n ))}\n </Box>\n );\n }\n);\n\nAccordion.displayName = \"Accordion\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n minWidth: minWidth as DimensionValue,\n minHeight: minHeight as DimensionValue,\n maxWidth: maxWidth as DimensionValue,\n maxHeight: maxHeight as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAkD;;;ACClD,0BAQO;AA2ID;AAxIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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,QAYZ,CACD;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;","names":["import_jsx_runtime"]}
|
package/native/index.mjs
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// src/Accordion.tsx
|
|
2
|
+
import { forwardRef, useState, useCallback } from "react";
|
|
3
|
+
|
|
4
|
+
// ../../foundation/primitives-native/src/Box.tsx
|
|
5
|
+
import {
|
|
6
|
+
View,
|
|
7
|
+
Pressable,
|
|
8
|
+
Image
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var Box = ({
|
|
12
|
+
children,
|
|
13
|
+
onPress,
|
|
14
|
+
onLayout,
|
|
15
|
+
onMoveShouldSetResponder,
|
|
16
|
+
onResponderGrant,
|
|
17
|
+
onResponderMove,
|
|
18
|
+
onResponderRelease,
|
|
19
|
+
onResponderTerminate,
|
|
20
|
+
backgroundColor,
|
|
21
|
+
borderColor,
|
|
22
|
+
borderWidth,
|
|
23
|
+
borderBottomWidth,
|
|
24
|
+
borderBottomColor,
|
|
25
|
+
borderTopWidth,
|
|
26
|
+
borderTopColor,
|
|
27
|
+
borderLeftWidth,
|
|
28
|
+
borderLeftColor,
|
|
29
|
+
borderRightWidth,
|
|
30
|
+
borderRightColor,
|
|
31
|
+
borderRadius,
|
|
32
|
+
borderStyle,
|
|
33
|
+
height,
|
|
34
|
+
padding,
|
|
35
|
+
paddingHorizontal,
|
|
36
|
+
paddingVertical,
|
|
37
|
+
margin,
|
|
38
|
+
marginTop,
|
|
39
|
+
marginBottom,
|
|
40
|
+
marginLeft,
|
|
41
|
+
marginRight,
|
|
42
|
+
flexDirection,
|
|
43
|
+
alignItems,
|
|
44
|
+
justifyContent,
|
|
45
|
+
position,
|
|
46
|
+
top,
|
|
47
|
+
bottom,
|
|
48
|
+
left,
|
|
49
|
+
right,
|
|
50
|
+
width,
|
|
51
|
+
minWidth,
|
|
52
|
+
minHeight,
|
|
53
|
+
maxWidth,
|
|
54
|
+
maxHeight,
|
|
55
|
+
flex,
|
|
56
|
+
overflow,
|
|
57
|
+
zIndex,
|
|
58
|
+
hoverStyle,
|
|
59
|
+
pressStyle,
|
|
60
|
+
style,
|
|
61
|
+
"data-testid": dataTestId,
|
|
62
|
+
testID,
|
|
63
|
+
as,
|
|
64
|
+
src,
|
|
65
|
+
alt,
|
|
66
|
+
...rest
|
|
67
|
+
}) => {
|
|
68
|
+
const getContainerStyle = (pressed) => ({
|
|
69
|
+
backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
|
|
70
|
+
borderColor,
|
|
71
|
+
borderWidth,
|
|
72
|
+
borderBottomWidth,
|
|
73
|
+
borderBottomColor,
|
|
74
|
+
borderTopWidth,
|
|
75
|
+
borderTopColor,
|
|
76
|
+
borderLeftWidth,
|
|
77
|
+
borderLeftColor,
|
|
78
|
+
borderRightWidth,
|
|
79
|
+
borderRightColor,
|
|
80
|
+
borderRadius,
|
|
81
|
+
borderStyle,
|
|
82
|
+
overflow,
|
|
83
|
+
zIndex,
|
|
84
|
+
height,
|
|
85
|
+
width,
|
|
86
|
+
minWidth,
|
|
87
|
+
minHeight,
|
|
88
|
+
maxWidth,
|
|
89
|
+
maxHeight,
|
|
90
|
+
padding,
|
|
91
|
+
paddingHorizontal,
|
|
92
|
+
paddingVertical,
|
|
93
|
+
margin,
|
|
94
|
+
marginTop,
|
|
95
|
+
marginBottom,
|
|
96
|
+
marginLeft,
|
|
97
|
+
marginRight,
|
|
98
|
+
flexDirection,
|
|
99
|
+
alignItems,
|
|
100
|
+
justifyContent,
|
|
101
|
+
position,
|
|
102
|
+
top,
|
|
103
|
+
bottom,
|
|
104
|
+
left,
|
|
105
|
+
right,
|
|
106
|
+
flex,
|
|
107
|
+
...style
|
|
108
|
+
});
|
|
109
|
+
const finalTestID = dataTestId || testID;
|
|
110
|
+
const {
|
|
111
|
+
role,
|
|
112
|
+
tabIndex,
|
|
113
|
+
onKeyDown,
|
|
114
|
+
onKeyUp,
|
|
115
|
+
"aria-label": _ariaLabel,
|
|
116
|
+
"aria-labelledby": _ariaLabelledBy,
|
|
117
|
+
"aria-current": _ariaCurrent,
|
|
118
|
+
"aria-disabled": _ariaDisabled,
|
|
119
|
+
"aria-live": _ariaLive,
|
|
120
|
+
className,
|
|
121
|
+
"data-testid": _dataTestId,
|
|
122
|
+
...nativeRest
|
|
123
|
+
} = rest;
|
|
124
|
+
if (as === "img" && src) {
|
|
125
|
+
const imageStyle = {
|
|
126
|
+
width,
|
|
127
|
+
height,
|
|
128
|
+
borderRadius,
|
|
129
|
+
position,
|
|
130
|
+
top,
|
|
131
|
+
bottom,
|
|
132
|
+
left,
|
|
133
|
+
right,
|
|
134
|
+
...style
|
|
135
|
+
};
|
|
136
|
+
return /* @__PURE__ */ jsx(
|
|
137
|
+
Image,
|
|
138
|
+
{
|
|
139
|
+
source: { uri: src },
|
|
140
|
+
style: imageStyle,
|
|
141
|
+
testID: finalTestID,
|
|
142
|
+
resizeMode: "cover",
|
|
143
|
+
...nativeRest
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
if (onPress) {
|
|
148
|
+
return /* @__PURE__ */ jsx(
|
|
149
|
+
Pressable,
|
|
150
|
+
{
|
|
151
|
+
onPress,
|
|
152
|
+
onLayout,
|
|
153
|
+
onMoveShouldSetResponder,
|
|
154
|
+
onResponderGrant,
|
|
155
|
+
onResponderMove,
|
|
156
|
+
onResponderRelease,
|
|
157
|
+
onResponderTerminate,
|
|
158
|
+
style: ({ pressed }) => getContainerStyle(pressed),
|
|
159
|
+
testID: finalTestID,
|
|
160
|
+
...nativeRest,
|
|
161
|
+
children
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return /* @__PURE__ */ jsx(
|
|
166
|
+
View,
|
|
167
|
+
{
|
|
168
|
+
style: getContainerStyle(),
|
|
169
|
+
testID: finalTestID,
|
|
170
|
+
onLayout,
|
|
171
|
+
onMoveShouldSetResponder,
|
|
172
|
+
onResponderGrant,
|
|
173
|
+
onResponderMove,
|
|
174
|
+
onResponderRelease,
|
|
175
|
+
onResponderTerminate,
|
|
176
|
+
...nativeRest,
|
|
177
|
+
children
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/Accordion.tsx
|
|
183
|
+
import { useResolvedTheme } from "@xsolla/xui-core";
|
|
184
|
+
import { Collapsible } from "@xsolla/xui-b2b-collapsible";
|
|
185
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
186
|
+
var Accordion = forwardRef(
|
|
187
|
+
({
|
|
188
|
+
items,
|
|
189
|
+
multiple = false,
|
|
190
|
+
defaultOpenKeys = [],
|
|
191
|
+
openKeys: openKeysProp,
|
|
192
|
+
onOpenChange,
|
|
193
|
+
className,
|
|
194
|
+
themeMode,
|
|
195
|
+
themeProductContext,
|
|
196
|
+
...rest
|
|
197
|
+
}, ref) => {
|
|
198
|
+
const { theme } = useResolvedTheme({ themeMode, themeProductContext });
|
|
199
|
+
const sizing = theme.sizing.collapsibleB2b();
|
|
200
|
+
const isControlled = openKeysProp !== void 0;
|
|
201
|
+
const [openState, setOpenState] = useState(defaultOpenKeys);
|
|
202
|
+
const openKeys = isControlled ? openKeysProp : openState;
|
|
203
|
+
const handleOpenChange = useCallback(
|
|
204
|
+
(key, open) => {
|
|
205
|
+
let next;
|
|
206
|
+
if (open) {
|
|
207
|
+
next = multiple ? [...openKeys, key] : [key];
|
|
208
|
+
} else {
|
|
209
|
+
next = openKeys.filter((k) => k !== key);
|
|
210
|
+
}
|
|
211
|
+
if (!isControlled) setOpenState(next);
|
|
212
|
+
onOpenChange?.(next);
|
|
213
|
+
},
|
|
214
|
+
[openKeys, multiple, isControlled, onOpenChange]
|
|
215
|
+
);
|
|
216
|
+
return /* @__PURE__ */ jsx2(
|
|
217
|
+
Box,
|
|
218
|
+
{
|
|
219
|
+
ref,
|
|
220
|
+
"data-testid": "accordion",
|
|
221
|
+
className,
|
|
222
|
+
flexDirection: "column",
|
|
223
|
+
alignItems: "stretch",
|
|
224
|
+
width: "100%",
|
|
225
|
+
style: { gap: sizing.accordionItemGap },
|
|
226
|
+
...rest,
|
|
227
|
+
children: items.map((item) => /* @__PURE__ */ jsx2(
|
|
228
|
+
Collapsible,
|
|
229
|
+
{
|
|
230
|
+
title: item.title,
|
|
231
|
+
caption: item.caption,
|
|
232
|
+
icon: item.icon,
|
|
233
|
+
trailing: item.trailing,
|
|
234
|
+
view: "white-surface",
|
|
235
|
+
open: openKeys.includes(item.key),
|
|
236
|
+
onOpenChange: (open) => handleOpenChange(item.key, open),
|
|
237
|
+
themeMode,
|
|
238
|
+
themeProductContext,
|
|
239
|
+
children: item.content
|
|
240
|
+
},
|
|
241
|
+
item.key
|
|
242
|
+
))
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
Accordion.displayName = "Accordion";
|
|
248
|
+
export {
|
|
249
|
+
Accordion
|
|
250
|
+
};
|
|
251
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Accordion.tsx","../../../../foundation/primitives-native/src/Box.tsx"],"sourcesContent":["import { forwardRef, useState, useCallback } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme } from \"@xsolla/xui-core\";\nimport { Collapsible } from \"@xsolla/xui-b2b-collapsible\";\nimport type { AccordionProps } from \"./types\";\n\nexport const Accordion = forwardRef<HTMLDivElement, AccordionProps>(\n (\n {\n items,\n multiple = false,\n defaultOpenKeys = [],\n openKeys: openKeysProp,\n onOpenChange,\n className,\n themeMode,\n themeProductContext,\n ...rest\n },\n ref\n ) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n const sizing = theme.sizing.collapsibleB2b();\n\n const isControlled = openKeysProp !== undefined;\n const [openState, setOpenState] = useState<string[]>(defaultOpenKeys);\n const openKeys = isControlled ? openKeysProp! : openState;\n\n const handleOpenChange = useCallback(\n (key: string, open: boolean) => {\n let next: string[];\n if (open) {\n next = multiple ? [...openKeys, key] : [key];\n } else {\n next = openKeys.filter((k) => k !== key);\n }\n if (!isControlled) setOpenState(next);\n onOpenChange?.(next);\n },\n [openKeys, multiple, isControlled, onOpenChange]\n );\n\n return (\n <Box\n ref={ref}\n data-testid=\"accordion\"\n className={className}\n flexDirection=\"column\"\n alignItems=\"stretch\"\n width=\"100%\"\n style={{ gap: sizing.accordionItemGap }}\n {...rest}\n >\n {items.map((item) => (\n <Collapsible\n key={item.key}\n title={item.title}\n caption={item.caption}\n icon={item.icon}\n trailing={item.trailing}\n view=\"white-surface\"\n open={openKeys.includes(item.key)}\n onOpenChange={(open) => handleOpenChange(item.key, open)}\n themeMode={themeMode}\n themeProductContext={themeProductContext}\n >\n {item.content}\n </Collapsible>\n ))}\n </Box>\n );\n }\n);\n\nAccordion.displayName = \"Accordion\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n minWidth: minWidth as DimensionValue,\n minHeight: minHeight as DimensionValue,\n maxWidth: maxWidth as DimensionValue,\n maxHeight: maxHeight as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n"],"mappings":";AAAA,SAAS,YAAY,UAAU,mBAAmB;;;ACClD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AA2ID;AAxIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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ACpC,uBAAe,IAAI;AAAA,MACrB;AAAA,MACA,CAAC,UAAU,UAAU,cAAc,YAAY;AAAA,IACjD;AAEA,WACE,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ;AAAA,QACA,eAAc;AAAA,QACd,YAAW;AAAA,QACX,OAAM;AAAA,QACN,OAAO,EAAE,KAAK,OAAO,iBAAiB;AAAA,QACrC,GAAG;AAAA,QAEH,gBAAM,IAAI,CAAC,SACV,gBAAAA;AAAA,UAAC;AAAA;AAAA,YAEC,OAAO,KAAK;AAAA,YACZ,SAAS,KAAK;AAAA,YACd,MAAM,KAAK;AAAA,YACX,UAAU,KAAK;AAAA,YACf,MAAK;AAAA,YACL,MAAM,SAAS,SAAS,KAAK,GAAG;AAAA,YAChC,cAAc,CAAC,SAAS,iBAAiB,KAAK,KAAK,IAAI;AAAA,YACvD;AAAA,YACA;AAAA,YAEC,eAAK;AAAA;AAAA,UAXD,KAAK;AAAA,QAYZ,CACD;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,UAAU,cAAc;","names":["jsx"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xsolla/xui-b2b-accordion",
|
|
3
|
+
"version": "0.147.1",
|
|
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-b2b-collapsible": "0.147.1",
|
|
17
|
+
"@xsolla/xui-core": "0.147.1",
|
|
18
|
+
"@xsolla/xui-primitives-core": "0.147.1"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": ">=16.8.0",
|
|
22
|
+
"styled-components": ">=4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
26
|
+
"@testing-library/react": "^14.1.2",
|
|
27
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
28
|
+
"jsdom": "^24.0.0",
|
|
29
|
+
"react": "^18.0.0",
|
|
30
|
+
"react-dom": "^18.0.0",
|
|
31
|
+
"tsup": "^8.0.0",
|
|
32
|
+
"vitest": "^4.0.18"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"react-native": "./native/index.js",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"react-native": {
|
|
40
|
+
"types": "./native/index.d.ts",
|
|
41
|
+
"import": "./native/index.mjs",
|
|
42
|
+
"require": "./native/index.js"
|
|
43
|
+
},
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./web/index.d.ts",
|
|
46
|
+
"default": "./web/index.mjs"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./web/index.d.ts",
|
|
50
|
+
"default": "./web/index.js"
|
|
51
|
+
},
|
|
52
|
+
"default": {
|
|
53
|
+
"types": "./web/index.d.ts",
|
|
54
|
+
"default": "./web/index.js"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|