@sciol/xyzen 0.3.9 → 0.3.11
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/README.md +154 -77
- package/dist/app/AppSide.d.ts +3 -1
- package/dist/app/auth/AuthErrorScreen.d.ts +6 -0
- package/dist/components/animate-ui/components/animate/tabs.d.ts +12 -0
- package/dist/components/animate-ui/components/buttons/button.d.ts +2 -2
- package/dist/components/animate-ui/components/buttons/flip.d.ts +10 -0
- package/dist/components/animate-ui/components/buttons/github-stars.d.ts +1 -1
- package/dist/components/animate-ui/components/radix/progress.d.ts +4 -0
- package/dist/components/animate-ui/primitives/animate/github-stars.d.ts +1 -2
- package/dist/components/animate-ui/primitives/animate/tabs.d.ts +51 -0
- package/dist/components/animate-ui/primitives/buttons/flip.d.ts +18 -0
- package/dist/components/animate-ui/primitives/effects/highlight.d.ts +1 -2
- package/dist/components/animate-ui/primitives/headless/checkbox.d.ts +1 -2
- package/dist/components/animate-ui/primitives/radix/dropdown-menu.d.ts +1 -3
- package/dist/components/animate-ui/primitives/radix/progress.d.ts +292 -0
- package/dist/components/features/NeedAuthBadge.d.ts +1 -0
- package/dist/components/features/ToggleSidePanelShortcutHint.d.ts +1 -0
- package/dist/components/layouts/XyzenAgent.d.ts +0 -26
- package/dist/components/layouts/components/SessionHistory.d.ts +2 -1
- package/dist/components/modals/EditAgentModal.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/configs/common.d.ts +4 -0
- package/dist/configs/index.d.ts +2 -0
- package/dist/constants/defaultMcps.d.ts +32 -0
- package/dist/core/auth.d.ts +19 -0
- package/dist/hooks/useAuth.d.ts +5 -9
- package/dist/hooks/useWorkShopChat.d.ts +1 -1
- package/dist/hooks/useXyzenChat.d.ts +1 -1
- package/dist/marketplace/components/SmitheryServerDetail.d.ts +7 -0
- package/dist/marketplace/hooks/useSmitheryMcp.d.ts +29 -0
- package/dist/marketplace/index.d.ts +3 -0
- package/dist/marketplace/services/smitheryService.d.ts +6 -0
- package/dist/marketplace/types/smithery.d.ts +64 -0
- package/dist/service/authService.d.ts +8 -24
- package/dist/service/http/client.d.ts +1 -0
- package/dist/service/mcpService.d.ts +1 -0
- package/dist/store/slices/agentSlice.d.ts +18 -1
- package/dist/store/slices/{authSlice.d.ts → authSlice/index.d.ts} +4 -4
- package/dist/store/slices/chatSlice.d.ts +15 -0
- package/dist/store/slices/index.d.ts +1 -1
- package/dist/store/slices/mcpSlice.d.ts +1 -0
- package/dist/store/slices/{uiSlice.d.ts → uiSlice/index.d.ts} +2 -1
- package/dist/store/slices/uiSlice/types.d.ts +6 -0
- package/dist/store/types.d.ts +0 -1
- package/dist/types/agents.d.ts +60 -0
- package/dist/types/mcp.d.ts +17 -2
- package/dist/utils/__tests__/auth.test.d.ts +1 -0
- package/dist/utils/auth.d.ts +17 -0
- package/dist/xyzen.css +1 -1
- package/dist/xyzen.es.js +47638 -46529
- package/dist/xyzen.umd.js +153 -139
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,110 +1,187 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Xyzen React Component
|
|
2
2
|
|
|
3
|
-
Xyzen
|
|
3
|
+
Xyzen is a modern, lightweight, and extensible chat component for React. It provides a full-featured sidebar that can be easily integrated into any React application.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Getting Started with Integration
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
To use the Xyzen component in your own project, you need to deploy the backend service first, then integrate the frontend component.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
yarn add @sciol/xyzen@latest
|
|
11
|
-
```
|
|
9
|
+
### Step 1: Deploy the Backend
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
The Xyzen component requires a running backend service to handle chat logic and LLM connections.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
13
|
+
1. Clone the Xyzen repository:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/ScienceOL/Xyzen.git
|
|
17
|
+
cd Xyzen
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. Deploy the backend using the one-click setup script:
|
|
21
|
+
|
|
22
|
+
**On Unix/Linux/macOS:**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
./launch/dev.sh
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**On Windows (PowerShell):**
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
.\launch\dev.ps1
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This script will automatically set up all required services (PostgreSQL, Mosquitto, Casdoor) and start the backend.
|
|
35
|
+
|
|
36
|
+
3. Configure LLM provider settings by creating a `.env.dev` file in the `docker` directory with the following keys:
|
|
37
|
+
|
|
38
|
+
```env
|
|
39
|
+
XYZEN_LLM_PROVIDER=azure_openai
|
|
40
|
+
XYZEN_LLM_KEY=<Your-LLM-API-Key>
|
|
41
|
+
XYZEN_LLM_ENDPOINT=<Your-LLM-Endpoint>
|
|
42
|
+
XYZEN_LLM_VERSION=<Your-LLM-API-Version>
|
|
43
|
+
XYZEN_LLM_DEPLOYMENT=<Your-LLM-Deployment-Name>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The backend will be available at `http://localhost:48196` by default, with API endpoints under `/xyzen/api`, `/xyzen/ws`, and `/xyzen/mcp`.
|
|
47
|
+
|
|
48
|
+
### Step 2: Install and Integrate the Frontend Component
|
|
49
|
+
|
|
50
|
+
1. Install the Xyzen component in your React project:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
yarn add @sciol/xyzen
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
or
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install @sciol/xyzen
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. Add the `Xyzen` component to your application layout:
|
|
63
|
+
|
|
64
|
+
In your root layout file (e.g., `App.tsx` or `Layout.tsx`), import and render the `Xyzen` component with the `backendUrl` prop pointing to your deployed backend:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
// src/App.tsx
|
|
68
|
+
import { Xyzen, useXyzen } from "@sciol/xyzen";
|
|
69
|
+
import "@sciol/xyzen/dist/style.css"; // Import the CSS
|
|
70
|
+
|
|
71
|
+
function App() {
|
|
72
|
+
const { openXyzen } = useXyzen();
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div>
|
|
76
|
+
<header>
|
|
77
|
+
<h1>My Application</h1>
|
|
78
|
+
<button onClick={openXyzen}>Open Chat</button>
|
|
79
|
+
</header>
|
|
80
|
+
<main>{/* Your application content */}</main>
|
|
81
|
+
<Xyzen backendUrl="http://localhost:48196" />
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export default App;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Note:** The `backendUrl` should point to the base URL of your Xyzen backend deployment. The component will automatically handle endpoints like `/xyzen/api`, `/xyzen/ws`, and `/xyzen/mcp`.
|
|
90
|
+
|
|
91
|
+
3. Control the Xyzen panel from any component:
|
|
92
|
+
|
|
93
|
+
Use the `useXyzen` hook to control the sidebar's visibility:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { useXyzen } from "@sciol/xyzen";
|
|
97
|
+
|
|
98
|
+
function MyComponent() {
|
|
99
|
+
const { isXyzenOpen, toggleXyzen, openXyzen, closeXyzen } = useXyzen();
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div>
|
|
103
|
+
<p>The chat panel is currently {isXyzenOpen ? "open" : "closed"}.</p>
|
|
104
|
+
<button onClick={toggleXyzen}>Toggle Chat</button>
|
|
105
|
+
<button onClick={openXyzen}>Open Chat</button>
|
|
106
|
+
<button onClick={closeXyzen}>Close Chat</button>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
18
111
|
|
|
19
|
-
##
|
|
112
|
+
## Local Development
|
|
20
113
|
|
|
21
|
-
|
|
114
|
+
To contribute to or modify the Xyzen web client source code, follow these steps.
|
|
22
115
|
|
|
23
|
-
|
|
116
|
+
### Prerequisites
|
|
24
117
|
|
|
25
|
-
|
|
118
|
+
- Node.js with Yarn (via Corepack)
|
|
119
|
+
- A running instance of the Xyzen backend service (see "Deploy the Backend" above)
|
|
26
120
|
|
|
27
|
-
|
|
121
|
+
### Setup
|
|
28
122
|
|
|
29
|
-
|
|
30
|
-
// src/App.tsx
|
|
31
|
-
import { Xyzen, useXyzen } from "@sciol/xyzen";
|
|
123
|
+
1. Navigate to the web directory:
|
|
32
124
|
|
|
33
|
-
|
|
34
|
-
|
|
125
|
+
```bash
|
|
126
|
+
cd web
|
|
127
|
+
```
|
|
35
128
|
|
|
36
|
-
|
|
37
|
-
<div>
|
|
38
|
-
<header>
|
|
39
|
-
<h1>我的应用</h1>
|
|
40
|
-
<button onClick={openXyzen}>打开聊天</button>
|
|
41
|
-
</header>
|
|
42
|
-
<main>{/* 你的应用内容 */}</main>
|
|
43
|
-
<Xyzen />
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
129
|
+
2. Enable Corepack to manage Yarn:
|
|
47
130
|
|
|
48
|
-
|
|
49
|
-
|
|
131
|
+
```bash
|
|
132
|
+
corepack enable
|
|
133
|
+
```
|
|
50
134
|
|
|
51
|
-
|
|
135
|
+
3. Install dependencies using Yarn:
|
|
52
136
|
|
|
53
|
-
|
|
137
|
+
```bash
|
|
138
|
+
yarn install
|
|
139
|
+
```
|
|
54
140
|
|
|
55
|
-
|
|
56
|
-
import { useXyzen } from "@sciol/xyzen";
|
|
141
|
+
4. Run the development server:
|
|
57
142
|
|
|
58
|
-
|
|
59
|
-
|
|
143
|
+
```bash
|
|
144
|
+
yarn dev
|
|
145
|
+
```
|
|
60
146
|
|
|
61
|
-
|
|
62
|
-
<div>
|
|
63
|
-
<p>聊天面板当前是 {isXyzenOpen ? "打开" : "关闭"} 状态。</p>
|
|
64
|
-
<button onClick={toggleXyzen}>切换聊天</button>
|
|
65
|
-
<button onClick={openXyzen}>打开聊天</button>
|
|
66
|
-
<button onClick={closeXyzen}>关闭聊天</button>
|
|
67
|
-
</div>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
```
|
|
147
|
+
The frontend will be available at `http://localhost:32233` and will connect to the local backend service.
|
|
71
148
|
|
|
72
149
|
## `useXyzen` Store API
|
|
73
150
|
|
|
74
|
-
`useXyzen` hook
|
|
151
|
+
The `useXyzen` hook provides access to the Xyzen state and actions.
|
|
75
152
|
|
|
76
|
-
###
|
|
153
|
+
### State
|
|
77
154
|
|
|
78
|
-
- `isXyzenOpen: boolean`:
|
|
79
|
-
- `panelWidth: number`:
|
|
80
|
-
- `activeChatChannel: string | null`:
|
|
81
|
-
- `user: User | null`:
|
|
82
|
-
- `activeTabIndex: number`:
|
|
83
|
-
- `theme: 'light' | 'dark' | 'system'`:
|
|
84
|
-
- `chatHistory: ChatHistoryItem[]`:
|
|
85
|
-
- `chatHistoryLoading: boolean`:
|
|
86
|
-
- `channels: Record<string, ChatChannel>`:
|
|
87
|
-
- `assistants: Assistant[]`:
|
|
155
|
+
- `isXyzenOpen: boolean`: Whether the sidebar is open.
|
|
156
|
+
- `panelWidth: number`: The current width of the sidebar.
|
|
157
|
+
- `activeChatChannel: string | null`: The ID of the currently active chat channel.
|
|
158
|
+
- `user: User | null`: The current user information.
|
|
159
|
+
- `activeTabIndex: number`: The index of the currently active tab.
|
|
160
|
+
- `theme: 'light' | 'dark' | 'system'`: The current theme.
|
|
161
|
+
- `chatHistory: ChatHistoryItem[]`: The list of chat history items.
|
|
162
|
+
- `chatHistoryLoading: boolean`: Whether the chat history is being loaded.
|
|
163
|
+
- `channels: Record<string, ChatChannel>`: A map of chat channels.
|
|
164
|
+
- `assistants: Assistant[]`: The list of available assistants.
|
|
88
165
|
|
|
89
|
-
###
|
|
166
|
+
### Actions
|
|
90
167
|
|
|
91
|
-
- `toggleXyzen()`:
|
|
92
|
-
- `openXyzen()`:
|
|
93
|
-
- `closeXyzen()`:
|
|
94
|
-
- `setPanelWidth(width: number)`:
|
|
95
|
-
- `setActiveChatChannel(channelUUID: string | null)`:
|
|
96
|
-
- `setTabIndex(index: number)`:
|
|
97
|
-
- `setTheme(theme: Theme)`:
|
|
98
|
-
- `fetchChatHistory(): Promise<void>`:
|
|
99
|
-
- `togglePinChat(chatId: string)`:
|
|
100
|
-
- `sendMessage(payload: { channelUUID: string; message: string })`:
|
|
101
|
-
- `createDefaultChannel()`:
|
|
168
|
+
- `toggleXyzen()`: Toggles the open/closed state of the sidebar.
|
|
169
|
+
- `openXyzen()`: Opens the sidebar.
|
|
170
|
+
- `closeXyzen()`: Closes the sidebar.
|
|
171
|
+
- `setPanelWidth(width: number)`: Sets the width of the sidebar.
|
|
172
|
+
- `setActiveChatChannel(channelUUID: string | null)`: Sets the currently active chat channel.
|
|
173
|
+
- `setTabIndex(index: number)`: Sets the active tab.
|
|
174
|
+
- `setTheme(theme: Theme)`: Sets the theme.
|
|
175
|
+
- `fetchChatHistory(): Promise<void>`: Fetches the chat history asynchronously.
|
|
176
|
+
- `togglePinChat(chatId: string)`: Toggles the pinned state of a chat.
|
|
177
|
+
- `sendMessage(payload: { channelUUID: string; message: string })`: Sends a message to a specified channel.
|
|
178
|
+
- `createDefaultChannel()`: Creates a new default chat channel。
|
|
102
179
|
|
|
103
|
-
##
|
|
180
|
+
## Customization
|
|
104
181
|
|
|
105
|
-
Xyzen
|
|
182
|
+
Xyzen is designed to be extensible. You can leverage the state and actions in the `useXyzen` store to build custom functionality or integrate with other components.
|
|
106
183
|
|
|
107
|
-
|
|
184
|
+
For example, you could create a button that not only opens Xyzen but also switches to a specific tab:
|
|
108
185
|
|
|
109
186
|
```tsx
|
|
110
187
|
import { useXyzen } from "@sciol/xyzen";
|
package/dist/app/AppSide.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export interface AppSideProps {
|
|
|
2
2
|
backendUrl?: string;
|
|
3
3
|
showLlmProvider?: boolean;
|
|
4
4
|
isMobile?: boolean;
|
|
5
|
+
showAuthError?: boolean;
|
|
6
|
+
onRetryAuth?: () => void;
|
|
5
7
|
}
|
|
6
|
-
export declare function AppSide({ backendUrl, showLlmProvider, isMobile, }: AppSideProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export declare function AppSide({ backendUrl, showLlmProvider, isMobile, showAuthError, onRetryAuth, }: AppSideProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TabsContentProps as TabsContentPrimitiveProps, TabsContentsProps as TabsContentsPrimitiveProps, TabsListProps as TabsListPrimitiveProps, TabsProps as TabsPrimitiveProps, TabsTriggerProps as TabsTriggerPrimitiveProps } from '../../primitives/animate/tabs';
|
|
2
|
+
type TabsProps = TabsPrimitiveProps;
|
|
3
|
+
declare function Tabs({ className, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
type TabsListProps = TabsListPrimitiveProps;
|
|
5
|
+
declare function TabsList({ className, ...props }: TabsListProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
type TabsTriggerProps = TabsTriggerPrimitiveProps;
|
|
7
|
+
declare function TabsTrigger({ className, ...props }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
type TabsContentsProps = TabsContentsPrimitiveProps;
|
|
9
|
+
declare function TabsContents(props: TabsContentsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
type TabsContentProps = TabsContentPrimitiveProps;
|
|
11
|
+
declare function TabsContent({ className, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { Tabs, TabsContent, TabsContents, TabsList, TabsTrigger, type TabsContentProps, type TabsContentsProps, type TabsListProps, type TabsProps, type TabsTriggerProps, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { ButtonProps as ButtonPrimitiveProps } from '../../primitives/buttons/button';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "
|
|
5
|
-
size?: "default" | "
|
|
4
|
+
variant?: "link" | "outline" | "default" | "accent" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
type ButtonProps = ButtonPrimitiveProps & VariantProps<typeof buttonVariants>;
|
|
8
8
|
declare function Button({ className, variant, size, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { buttonVariants } from './button';
|
|
3
|
+
import { FlipButtonBackProps as FlipButtonBackPrimitiveProps, FlipButtonFrontProps as FlipButtonFrontPrimitiveProps, FlipButtonProps as FlipButtonPrimitiveProps } from '../../primitives/buttons/flip';
|
|
4
|
+
type FlipButtonProps = FlipButtonPrimitiveProps & VariantProps<typeof buttonVariants>;
|
|
5
|
+
declare function FlipButton({ variant, size, ...props }: FlipButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
type FlipButtonFrontProps = FlipButtonFrontPrimitiveProps & VariantProps<typeof buttonVariants>;
|
|
7
|
+
declare function FlipButtonFront({ variant, size, className, ...props }: FlipButtonFrontProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
type FlipButtonBackProps = FlipButtonBackPrimitiveProps & VariantProps<typeof buttonVariants>;
|
|
9
|
+
declare function FlipButtonBack({ variant, size, className, ...props }: FlipButtonBackProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { FlipButton, FlipButtonBack, FlipButtonFront, type FlipButtonBackProps, type FlipButtonFrontProps, type FlipButtonProps, };
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { GithubStarsProps } from '../../primitives/animate/github-stars';
|
|
3
3
|
import { ButtonProps as ButtonPrimitiveProps } from '../../primitives/buttons/button';
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "outline" | "default" | "accent" | "ghost" | null | undefined;
|
|
6
6
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
type GitHubStarsButtonProps = Omit<ButtonPrimitiveProps & GithubStarsProps, "asChild" | "children"> & VariantProps<typeof buttonVariants>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ProgressProps as ProgressPrimitiveProps } from '../../primitives/radix/progress';
|
|
2
|
+
type ProgressProps = ProgressPrimitiveProps;
|
|
3
|
+
declare function Progress({ className, ...props }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { Progress, type ProgressProps };
|
|
@@ -36,5 +36,4 @@ type GithubStarsParticlesProps = ParticlesEffectProps & {
|
|
|
36
36
|
declare function GithubStarsParticles({ children, size, style, ...props }: GithubStarsParticlesProps): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
type GithubStarsLogoProps = React.SVGProps<SVGSVGElement>;
|
|
38
38
|
declare function GithubStarsLogo(props: GithubStarsLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
export { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsParticles, GithubStarsLogo, useGithubStars,
|
|
40
|
-
type GithubStarsProps, type GithubStarsNumberProps, type GithubStarsIconProps, type GithubStarsParticlesProps, type GithubStarsLogoProps, type GithubStarsContextType, };
|
|
39
|
+
export { GithubStars, GithubStarsNumber, GithubStarsIcon, GithubStarsParticles, GithubStarsLogo, useGithubStars, type GithubStarsProps, type GithubStarsNumberProps, type GithubStarsIconProps, type GithubStarsParticlesProps, type GithubStarsLogoProps, type GithubStarsContextType, };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HTMLMotionProps, Transition } from 'motion/react';
|
|
2
|
+
import { WithAsChild } from './slot';
|
|
3
|
+
import { HighlightItemProps, HighlightProps } from '../effects/highlight';
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
type TabsContextType = {
|
|
6
|
+
activeValue: string;
|
|
7
|
+
handleValueChange: (value: string) => void;
|
|
8
|
+
registerTrigger: (value: string, node: HTMLElement | null) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const useTabs: () => TabsContextType;
|
|
11
|
+
type BaseTabsProps = React.ComponentProps<"div"> & {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type UnControlledTabsProps = BaseTabsProps & {
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
value?: never;
|
|
17
|
+
onValueChange?: never;
|
|
18
|
+
};
|
|
19
|
+
type ControlledTabsProps = BaseTabsProps & {
|
|
20
|
+
value: string;
|
|
21
|
+
onValueChange?: (value: string) => void;
|
|
22
|
+
defaultValue?: never;
|
|
23
|
+
};
|
|
24
|
+
type TabsProps = UnControlledTabsProps | ControlledTabsProps;
|
|
25
|
+
declare function Tabs({ defaultValue, value, onValueChange, children, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
type TabsHighlightProps = Omit<HighlightProps, "controlledItems" | "value">;
|
|
27
|
+
declare function TabsHighlight({ transition, ...props }: TabsHighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
type TabsListProps = React.ComponentProps<"div"> & {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
31
|
+
declare function TabsList(props: TabsListProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
type TabsHighlightItemProps = HighlightItemProps & {
|
|
33
|
+
value: string;
|
|
34
|
+
};
|
|
35
|
+
declare function TabsHighlightItem(props: TabsHighlightItemProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
type TabsTriggerProps = WithAsChild<{
|
|
37
|
+
value: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
} & HTMLMotionProps<"button">>;
|
|
40
|
+
declare function TabsTrigger({ ref, value, asChild, ...props }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
type TabsContentsProps = HTMLMotionProps<"div"> & {
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
transition?: Transition;
|
|
44
|
+
};
|
|
45
|
+
declare function TabsContents({ children, transition, ...props }: TabsContentsProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
type TabsContentProps = WithAsChild<{
|
|
47
|
+
value: string;
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
} & HTMLMotionProps<"div">>;
|
|
50
|
+
declare function TabsContent({ value, style, asChild, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export { Tabs, TabsContent, TabsContents, TabsHighlight, TabsHighlightItem, TabsList, TabsTrigger, useTabs, type TabsContentProps, type TabsContentsProps, type TabsContextType, type TabsHighlightItemProps, type TabsHighlightProps, type TabsListProps, type TabsProps, type TabsTriggerProps, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HTMLMotionProps } from 'motion/react';
|
|
2
|
+
import { WithAsChild } from '../animate/slot';
|
|
3
|
+
type FlipDirection = "top" | "bottom" | "left" | "right";
|
|
4
|
+
type FlipButtonContextType = {
|
|
5
|
+
from: FlipDirection;
|
|
6
|
+
isVertical: boolean;
|
|
7
|
+
rotateAxis: string;
|
|
8
|
+
};
|
|
9
|
+
declare const useFlipButton: () => FlipButtonContextType;
|
|
10
|
+
type FlipButtonProps = WithAsChild<HTMLMotionProps<"button"> & {
|
|
11
|
+
from?: FlipDirection;
|
|
12
|
+
tapScale?: number;
|
|
13
|
+
}>;
|
|
14
|
+
declare function FlipButton({ from, tapScale, asChild, style, ...props }: FlipButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
type FlipButtonFaceProps = WithAsChild<HTMLMotionProps<"span">>;
|
|
16
|
+
declare function FlipButtonFront({ transition, asChild, style, ...props }: FlipButtonFaceProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function FlipButtonBack({ transition, asChild, style, ...props }: FlipButtonFaceProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { FlipButton, FlipButtonBack, FlipButtonFront, useFlipButton, type FlipButtonFaceProps as FlipButtonBackProps, type FlipButtonContextType, type FlipButtonFaceProps as FlipButtonFrontProps, type FlipButtonProps, type FlipDirection, };
|
|
@@ -88,5 +88,4 @@ type HighlightItemProps<T extends React.ElementType = "div"> = React.ComponentPr
|
|
|
88
88
|
forceUpdateBounds?: boolean;
|
|
89
89
|
};
|
|
90
90
|
declare function HighlightItem<T extends React.ElementType>({ ref, as, children, id, value, className, style, transition, disabled, activeClassName, exitDelay, asChild, forceUpdateBounds, ...props }: HighlightItemProps<T>): any;
|
|
91
|
-
export { Highlight, HighlightItem, useHighlight,
|
|
92
|
-
type HighlightItemProps, type HighlightProps, };
|
|
91
|
+
export { Highlight, HighlightItem, useHighlight, type HighlightItemProps, type HighlightProps, };
|
|
@@ -12,5 +12,4 @@ type CheckboxProps<TTag extends React.ElementType = typeof motion.button> = Chec
|
|
|
12
12
|
declare function Checkbox<TTag extends React.ElementType = typeof motion.button>({ children, ...props }: CheckboxProps<TTag>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
type CheckboxIndicatorProps = SVGMotionProps<SVGSVGElement>;
|
|
14
14
|
declare function CheckboxIndicator(props: CheckboxIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export { Checkbox, CheckboxIndicator, useCheckbox,
|
|
16
|
-
type CheckboxContextType, type CheckboxIndicatorProps, type CheckboxProps, };
|
|
15
|
+
export { Checkbox, CheckboxIndicator, useCheckbox, type CheckboxContextType, type CheckboxIndicatorProps, type CheckboxProps, };
|
|
@@ -52,6 +52,4 @@ type DropdownMenuShortcutProps = React.ComponentProps<"span">;
|
|
|
52
52
|
declare function DropdownMenuShortcut(props: DropdownMenuShortcutProps): import("react/jsx-runtime").JSX.Element;
|
|
53
53
|
type DropdownMenuItemIndicatorProps = Omit<React.ComponentProps<typeof DropdownMenuPrimitive.ItemIndicator>, "asChild"> & HTMLMotionProps<"div">;
|
|
54
54
|
declare function DropdownMenuItemIndicator(props: DropdownMenuItemIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHighlight, DropdownMenuHighlightItem, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, useDropdownMenu,
|
|
56
|
-
useDropdownMenuSub, //eslint-disable-line
|
|
57
|
-
type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuContextType, type DropdownMenuGroupProps, type DropdownMenuHighlightItemProps, type DropdownMenuHighlightProps, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuPortalProps, type DropdownMenuProps, type DropdownMenuRadioGroupProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, type DropdownMenuShortcutProps, type DropdownMenuSubContentProps, type DropdownMenuSubContextType, type DropdownMenuSubProps, type DropdownMenuSubTriggerProps, type DropdownMenuTriggerProps, };
|
|
55
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuHighlight, DropdownMenuHighlightItem, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, useDropdownMenu, useDropdownMenuSub, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuContextType, type DropdownMenuGroupProps, type DropdownMenuHighlightItemProps, type DropdownMenuHighlightProps, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuPortalProps, type DropdownMenuProps, type DropdownMenuRadioGroupProps, type DropdownMenuRadioItemProps, type DropdownMenuSeparatorProps, type DropdownMenuShortcutProps, type DropdownMenuSubContentProps, type DropdownMenuSubContextType, type DropdownMenuSubProps, type DropdownMenuSubTriggerProps, type DropdownMenuTriggerProps, };
|