@xsolla/xui-b2b-drawer 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/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@xsolla/xui-b2b-drawer",
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-stepper": "0.147.1",
17
+ "@xsolla/xui-button": "0.147.1",
18
+ "@xsolla/xui-core": "0.147.1",
19
+ "@xsolla/xui-icons-base": "0.147.1",
20
+ "@xsolla/xui-primitives-core": "0.147.1",
21
+ "@xsolla/xui-typography": "0.147.1"
22
+ },
23
+ "peerDependencies": {
24
+ "react": ">=16.8.0",
25
+ "react-dom": ">=16",
26
+ "styled-components": ">=4"
27
+ },
28
+ "devDependencies": {
29
+ "@testing-library/jest-dom": "^6.9.1",
30
+ "@testing-library/react": "^14.1.2",
31
+ "@vitest/coverage-v8": "^4.0.18",
32
+ "jsdom": "^24.0.0",
33
+ "react": "^18.0.0",
34
+ "react-dom": "^18.0.0",
35
+ "tsup": "^8.0.0",
36
+ "vitest": "^4.0.18"
37
+ },
38
+ "license": "MIT",
39
+ "sideEffects": false,
40
+ "react-native": "./native/index.js",
41
+ "exports": {
42
+ ".": {
43
+ "react-native": {
44
+ "types": "./native/index.d.ts",
45
+ "import": "./native/index.mjs",
46
+ "require": "./native/index.js"
47
+ },
48
+ "import": {
49
+ "types": "./web/index.d.ts",
50
+ "default": "./web/index.mjs"
51
+ },
52
+ "require": {
53
+ "types": "./web/index.d.ts",
54
+ "default": "./web/index.js"
55
+ },
56
+ "default": {
57
+ "types": "./web/index.d.ts",
58
+ "default": "./web/index.js"
59
+ }
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,64 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
4
+
5
+ type DrawerSize = "sm" | "md" | "lg";
6
+ type DrawerFooterAlign = "center" | "right";
7
+ /** @deprecated Use individual `title` and `onBack` props instead */
8
+ interface LegacyDrawerHeader {
9
+ title?: ReactNode;
10
+ onBack?: () => void;
11
+ }
12
+ interface DrawerProps extends ThemeOverrideProps {
13
+ /** Whether the drawer is open */
14
+ open?: boolean;
15
+ /** @deprecated Use `open` instead */
16
+ isOpen?: boolean;
17
+ /** Called when the drawer should close */
18
+ onClose?: () => void;
19
+ /** Width preset: sm=480px, md=620px, lg=1056px */
20
+ size?: DrawerSize;
21
+ /** Title text displayed in the header (18px compact/Medium, ellipsis) */
22
+ title?: ReactNode;
23
+ /** @deprecated Use `title` and `onBack` props instead */
24
+ header?: LegacyDrawerHeader;
25
+ /** Renders a back arrow button in the header when provided */
26
+ onBack?: () => void;
27
+ /** Optional action element in the header, rendered between title and close button */
28
+ headerAction?: ReactNode;
29
+ /** Whether clicking the scrim backdrop closes the drawer. Defaults to true. */
30
+ closeOnOverlayClick?: boolean;
31
+ /** Whether pressing Escape closes the drawer. Defaults to true. */
32
+ closeOnEscape?: boolean;
33
+ /** Footer content (typically a ButtonGroup) */
34
+ footer?: ReactNode;
35
+ /** @deprecated Use `footer` instead */
36
+ bottom?: ReactNode;
37
+ /** Alignment of footer content. Defaults to "right". */
38
+ footerAlign?: DrawerFooterAlign;
39
+ /** Show a drop shadow above the footer. Defaults to false. */
40
+ footerShadow?: boolean;
41
+ /** Whether footer buttons stretch to full width. Defaults to true. */
42
+ footerFullWidth?: boolean;
43
+ /** Optional stepper sidebar rendered to the left of the content panel */
44
+ stepper?: ReactNode;
45
+ /** Main drawer content */
46
+ children: ReactNode;
47
+ /** Ref to element that should receive focus when the drawer opens */
48
+ initialFocusRef?: RefObject<HTMLElement>;
49
+ }
50
+
51
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
52
+
53
+ interface UseDrawerOptions {
54
+ onOpen?: () => void;
55
+ onClose?: () => void;
56
+ }
57
+ interface UseDrawerReturn {
58
+ isOpen: boolean;
59
+ open: () => void;
60
+ close: () => void;
61
+ }
62
+ declare function useDrawer(options?: UseDrawerOptions): UseDrawerReturn;
63
+
64
+ export { Drawer, type DrawerFooterAlign, type DrawerProps, type DrawerSize, type LegacyDrawerHeader, type UseDrawerOptions, type UseDrawerReturn, useDrawer };
package/web/index.d.ts ADDED
@@ -0,0 +1,64 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
4
+
5
+ type DrawerSize = "sm" | "md" | "lg";
6
+ type DrawerFooterAlign = "center" | "right";
7
+ /** @deprecated Use individual `title` and `onBack` props instead */
8
+ interface LegacyDrawerHeader {
9
+ title?: ReactNode;
10
+ onBack?: () => void;
11
+ }
12
+ interface DrawerProps extends ThemeOverrideProps {
13
+ /** Whether the drawer is open */
14
+ open?: boolean;
15
+ /** @deprecated Use `open` instead */
16
+ isOpen?: boolean;
17
+ /** Called when the drawer should close */
18
+ onClose?: () => void;
19
+ /** Width preset: sm=480px, md=620px, lg=1056px */
20
+ size?: DrawerSize;
21
+ /** Title text displayed in the header (18px compact/Medium, ellipsis) */
22
+ title?: ReactNode;
23
+ /** @deprecated Use `title` and `onBack` props instead */
24
+ header?: LegacyDrawerHeader;
25
+ /** Renders a back arrow button in the header when provided */
26
+ onBack?: () => void;
27
+ /** Optional action element in the header, rendered between title and close button */
28
+ headerAction?: ReactNode;
29
+ /** Whether clicking the scrim backdrop closes the drawer. Defaults to true. */
30
+ closeOnOverlayClick?: boolean;
31
+ /** Whether pressing Escape closes the drawer. Defaults to true. */
32
+ closeOnEscape?: boolean;
33
+ /** Footer content (typically a ButtonGroup) */
34
+ footer?: ReactNode;
35
+ /** @deprecated Use `footer` instead */
36
+ bottom?: ReactNode;
37
+ /** Alignment of footer content. Defaults to "right". */
38
+ footerAlign?: DrawerFooterAlign;
39
+ /** Show a drop shadow above the footer. Defaults to false. */
40
+ footerShadow?: boolean;
41
+ /** Whether footer buttons stretch to full width. Defaults to true. */
42
+ footerFullWidth?: boolean;
43
+ /** Optional stepper sidebar rendered to the left of the content panel */
44
+ stepper?: ReactNode;
45
+ /** Main drawer content */
46
+ children: ReactNode;
47
+ /** Ref to element that should receive focus when the drawer opens */
48
+ initialFocusRef?: RefObject<HTMLElement>;
49
+ }
50
+
51
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
52
+
53
+ interface UseDrawerOptions {
54
+ onOpen?: () => void;
55
+ onClose?: () => void;
56
+ }
57
+ interface UseDrawerReturn {
58
+ isOpen: boolean;
59
+ open: () => void;
60
+ close: () => void;
61
+ }
62
+ declare function useDrawer(options?: UseDrawerOptions): UseDrawerReturn;
63
+
64
+ export { Drawer, type DrawerFooterAlign, type DrawerProps, type DrawerSize, type LegacyDrawerHeader, type UseDrawerOptions, type UseDrawerReturn, useDrawer };