@docsplain-kit/core 0.0.50 → 0.0.52
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 +36 -0
- package/SERVER_COMPONENTS.md +256 -0
- package/halo-color/halo-color.d.ts +4 -0
- package/halo-color/halo-color.js +20 -0
- package/halo-color/halo-color.js.map +1 -0
- package/halo-color/halo-color.props.d.ts +15 -0
- package/halo-color/halo-color.props.js +3 -0
- package/halo-color/halo-color.props.js.map +1 -0
- package/halo-color/halo-color.style.d.ts +48 -0
- package/halo-color/halo-color.style.js +52 -0
- package/halo-color/halo-color.style.js.map +1 -0
- package/halo-color/index.d.ts +2 -0
- package/halo-color/index.js +6 -0
- package/halo-color/index.js.map +1 -0
- package/index.d.ts +3 -1
- package/index.js +9 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/server/client-wrapper.d.ts +116 -0
- package/server/client-wrapper.js +249 -0
- package/server/client-wrapper.js.map +1 -0
- package/server/index.d.ts +22 -0
- package/server/index.js +40 -0
- package/server/index.js.map +1 -0
package/README.md
CHANGED
|
@@ -26,3 +26,39 @@ Get started with DocSplain Core in seconds:
|
|
|
26
26
|
```bash
|
|
27
27
|
npm install --save @docsplain-kit/core
|
|
28
28
|
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 🔄 **Using in Server Components (Next.js App Router)**
|
|
33
|
+
|
|
34
|
+
All Docsplain UI Kit components are client components. To use them in server components, create a client wrapper file:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// components/docsplain.tsx
|
|
38
|
+
'use client';
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
Tab,
|
|
42
|
+
TabItem,
|
|
43
|
+
Button,
|
|
44
|
+
// ... other components
|
|
45
|
+
} from '@docsplain-kit/core';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then use in your server components:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
// app/page.tsx (Server Component)
|
|
52
|
+
import { Tab, TabItem } from './components/docsplain';
|
|
53
|
+
|
|
54
|
+
export default function Page() {
|
|
55
|
+
return (
|
|
56
|
+
<Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
57
|
+
<TabItem value="tab1">Home</TabItem>
|
|
58
|
+
<TabItem value="tab2">About</TabItem>
|
|
59
|
+
</Tab>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
📖 **See [SERVER_COMPONENTS.md](./SERVER_COMPONENTS.md) for a complete guide** with examples, best practices, and troubleshooting.
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Using Docsplain UI Kit in Server Components
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
All components in the Docsplain UI Kit are client components (they use `'use client'` directive) because they require React hooks, interactivity, and browser APIs. When using Next.js App Router or other React Server Components frameworks, you cannot directly import client components into server components.
|
|
6
|
+
|
|
7
|
+
## Solution: Client Component Wrappers
|
|
8
|
+
|
|
9
|
+
The recommended approach is to create client component wrappers that you can import in your server components. This guide shows you how to do this effectively.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Method 1: Create Individual Client Wrappers
|
|
14
|
+
|
|
15
|
+
Create a `components` directory in your project and create client wrapper files:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// components/client-tab.tsx
|
|
19
|
+
'use client';
|
|
20
|
+
|
|
21
|
+
import { Tab, TabItem } from '@docsplain-kit/core';
|
|
22
|
+
|
|
23
|
+
export { Tab, TabItem };
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use it in your server component:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// app/page.tsx (Server Component)
|
|
30
|
+
import { Tab, TabItem } from './components/client-tab';
|
|
31
|
+
|
|
32
|
+
export default function Page() {
|
|
33
|
+
return (
|
|
34
|
+
<Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
35
|
+
<TabItem value="tab1">Home</TabItem>
|
|
36
|
+
<TabItem value="tab2">About</TabItem>
|
|
37
|
+
</Tab>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Method 2: Use the Client Wrapper Utility
|
|
43
|
+
|
|
44
|
+
We provide a utility to help you create client wrappers more easily:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// components/docsplain-client.tsx
|
|
48
|
+
'use client';
|
|
49
|
+
|
|
50
|
+
import { createClientWrapper } from '@docsplain-kit/core/server';
|
|
51
|
+
|
|
52
|
+
// Export all components you need
|
|
53
|
+
export const {
|
|
54
|
+
Tab,
|
|
55
|
+
TabItem,
|
|
56
|
+
Button,
|
|
57
|
+
Checkbox,
|
|
58
|
+
// ... other components
|
|
59
|
+
} = createClientWrapper({
|
|
60
|
+
Tab: () => import('@docsplain-kit/core'),
|
|
61
|
+
TabItem: () => import('@docsplain-kit/core'),
|
|
62
|
+
Button: () => import('@docsplain-kit/core'),
|
|
63
|
+
Checkbox: () => import('@docsplain-kit/core'),
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Method 3: Create a Single Client Barrel File
|
|
68
|
+
|
|
69
|
+
Create a single file that re-exports all components you need:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// components/docsplain.tsx
|
|
73
|
+
'use client';
|
|
74
|
+
|
|
75
|
+
// Re-export all components you need
|
|
76
|
+
export {
|
|
77
|
+
Tab,
|
|
78
|
+
TabItem,
|
|
79
|
+
Button,
|
|
80
|
+
Checkbox,
|
|
81
|
+
Label,
|
|
82
|
+
TextInput,
|
|
83
|
+
Select,
|
|
84
|
+
// ... add other components as needed
|
|
85
|
+
} from '@docsplain-kit/core';
|
|
86
|
+
|
|
87
|
+
// Re-export provider and hooks
|
|
88
|
+
export {
|
|
89
|
+
DocsplainProvider,
|
|
90
|
+
useTheme,
|
|
91
|
+
useDocsplain,
|
|
92
|
+
} from '@docsplain-kit/core';
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then use it in your server components:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// app/page.tsx (Server Component)
|
|
99
|
+
import { Tab, TabItem } from './components/docsplain';
|
|
100
|
+
|
|
101
|
+
export default function Page() {
|
|
102
|
+
return (
|
|
103
|
+
<Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
104
|
+
<TabItem value="tab1">Home</TabItem>
|
|
105
|
+
<TabItem value="tab2">About</TabItem>
|
|
106
|
+
</Tab>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Complete Example: Next.js App Router
|
|
112
|
+
|
|
113
|
+
Here's a complete example showing how to structure your Next.js app:
|
|
114
|
+
|
|
115
|
+
### Project Structure
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
app/
|
|
119
|
+
layout.tsx # Server Component
|
|
120
|
+
page.tsx # Server Component
|
|
121
|
+
components/
|
|
122
|
+
docsplain.tsx # Client Component (wrapper)
|
|
123
|
+
client-tab.tsx # Client Component (specific wrapper)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 1. Create Client Wrapper
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// components/docsplain.tsx
|
|
130
|
+
'use client';
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
Tab,
|
|
134
|
+
TabItem,
|
|
135
|
+
Button,
|
|
136
|
+
Checkbox,
|
|
137
|
+
Label,
|
|
138
|
+
TextInput,
|
|
139
|
+
DocsplainProvider,
|
|
140
|
+
useTheme,
|
|
141
|
+
} from '@docsplain-kit/core';
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 2. Use in Server Component
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// app/page.tsx
|
|
148
|
+
import { Tab, TabItem } from '../components/docsplain';
|
|
149
|
+
|
|
150
|
+
export default function Page() {
|
|
151
|
+
// This is a server component - you can do server-side work here
|
|
152
|
+
const data = await fetchData(); // Server-side data fetching
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<div>
|
|
156
|
+
<h1>Server Component Page</h1>
|
|
157
|
+
<Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
158
|
+
<TabItem value="tab1">Home</TabItem>
|
|
159
|
+
<TabItem value="tab2">About</TabItem>
|
|
160
|
+
</Tab>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 3. Wrap with Provider (in Layout)
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// app/layout.tsx
|
|
170
|
+
import { DocsplainProvider } from '../components/docsplain';
|
|
171
|
+
|
|
172
|
+
export default function RootLayout({ children }) {
|
|
173
|
+
return (
|
|
174
|
+
<html>
|
|
175
|
+
<body>
|
|
176
|
+
<DocsplainProvider theme="light" dir="ltr">
|
|
177
|
+
{children}
|
|
178
|
+
</DocsplainProvider>
|
|
179
|
+
</body>
|
|
180
|
+
</html>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Advanced: Dynamic Imports with SSR Disabled
|
|
186
|
+
|
|
187
|
+
For components that don't need SSR, you can use dynamic imports:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// app/page.tsx
|
|
191
|
+
import dynamic from 'next/dynamic';
|
|
192
|
+
|
|
193
|
+
const Tab = dynamic(
|
|
194
|
+
() => import('@docsplain-kit/core').then(mod => mod.Tab),
|
|
195
|
+
{ ssr: false }
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
const TabItem = dynamic(
|
|
199
|
+
() => import('@docsplain-kit/core').then(mod => mod.TabItem),
|
|
200
|
+
{ ssr: false }
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
export default function Page() {
|
|
204
|
+
return (
|
|
205
|
+
<Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
206
|
+
<TabItem value="tab1">Home</TabItem>
|
|
207
|
+
<TabItem value="tab2">About</TabItem>
|
|
208
|
+
</Tab>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Note:** This approach disables SSR for these components, which may not be ideal for SEO and initial load performance.
|
|
214
|
+
|
|
215
|
+
## Best Practices
|
|
216
|
+
|
|
217
|
+
1. **Create a Single Client Barrel File**: Instead of creating individual wrappers for each component, create one file that exports all components you need. This is easier to maintain.
|
|
218
|
+
|
|
219
|
+
2. **Keep Server Components as Server Components**: Only create client wrappers when you actually need to use client components. Keep as much of your app as server components as possible.
|
|
220
|
+
|
|
221
|
+
3. **Use the Provider in Layout**: Wrap your app with `DocsplainProvider` in your root layout so all components have access to theme and configuration.
|
|
222
|
+
|
|
223
|
+
4. **Organize by Feature**: If you have many components, you can organize them by feature:
|
|
224
|
+
```typescript
|
|
225
|
+
// components/forms.tsx
|
|
226
|
+
'use client';
|
|
227
|
+
export { TextInput, Select, Checkbox, Label } from '@docsplain-kit/core';
|
|
228
|
+
|
|
229
|
+
// components/navigation.tsx
|
|
230
|
+
'use client';
|
|
231
|
+
export { Tab, TabItem, Button } from '@docsplain-kit/core';
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Troubleshooting
|
|
235
|
+
|
|
236
|
+
### Error: "use client" must be in a file that only exports client components
|
|
237
|
+
|
|
238
|
+
**Solution**: Make sure your wrapper file has `'use client'` at the very top and only exports client components. Don't mix server and client code in the same file.
|
|
239
|
+
|
|
240
|
+
### Error: Cannot use hooks in server components
|
|
241
|
+
|
|
242
|
+
**Solution**: If you need to use hooks (like `useState`, `useEffect`), you must use them in a client component. Create a client wrapper component that uses the hooks, then use that wrapper in your server component.
|
|
243
|
+
|
|
244
|
+
### Components not rendering on server
|
|
245
|
+
|
|
246
|
+
**Solution**: This is expected behavior. Client components are hydrated on the client side. If you need server-side rendering, consider using the dynamic import approach with `ssr: true` (though this may not work for all components that rely heavily on browser APIs).
|
|
247
|
+
|
|
248
|
+
## Summary
|
|
249
|
+
|
|
250
|
+
- All Docsplain UI Kit components are client components
|
|
251
|
+
- Create client wrapper files with `'use client'` directive
|
|
252
|
+
- Import from your wrappers in server components
|
|
253
|
+
- Use a single barrel file for easier maintenance
|
|
254
|
+
- Wrap your app with `DocsplainProvider` in the root layout
|
|
255
|
+
|
|
256
|
+
This approach allows you to use all Docsplain UI Kit components in your server components while maintaining the benefits of React Server Components.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.HaloColor = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
var halo_color_style_1 = require("./halo-color.style");
|
|
7
|
+
var tailwind_merge_1 = require("tailwind-merge");
|
|
8
|
+
var HaloColor = function (_a) {
|
|
9
|
+
var children = _a.children, className = _a.className, _b = _a.color, color = _b === void 0 ? 'primary' : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, left = _a.left, right = _a.right, bottom = _a.bottom, top = _a.top, _d = _a.opacity, opacity = _d === void 0 ? 'low' : _d, rest = tslib_1.__rest(_a, ["children", "className", "color", "size", "left", "right", "bottom", "top", "opacity"]);
|
|
10
|
+
var style = {
|
|
11
|
+
left: left,
|
|
12
|
+
right: right,
|
|
13
|
+
bottom: bottom,
|
|
14
|
+
top: top
|
|
15
|
+
};
|
|
16
|
+
return (react_1["default"].createElement("div", tslib_1.__assign({ style: style, className: (0, tailwind_merge_1.twMerge)("-z-[1] absolute blur-2xl rounded-full", halo_color_style_1.COLORS[color], halo_color_style_1.SIZES[size], halo_color_style_1.OPACITY[opacity], className) }, rest), children));
|
|
17
|
+
};
|
|
18
|
+
exports.HaloColor = HaloColor;
|
|
19
|
+
exports["default"] = exports.HaloColor;
|
|
20
|
+
//# sourceMappingURL=halo-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halo-color.js","sourceRoot":"","sources":["../../halo-color/halo-color.tsx"],"names":[],"mappings":";;;;AAAA,wDAA0B;AAE1B,uDAA4D;AAC5D,iDAAyC;AAElC,IAAM,SAAS,GAAG,UAAC,EAA+H;IAA7H,IAAA,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,aAAiB,EAAjB,KAAK,mBAAG,SAAS,KAAA,EAAE,YAAe,EAAf,IAAI,mBAAG,QAAQ,KAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,MAAM,YAAA,EAAE,GAAG,SAAA,EAAE,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAK,IAAI,sBAA7G,uFAA+G,CAAF;IACrI,IAAM,KAAK,GAAG;QACZ,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,GAAG;KACT,CAAC;IACF,OAAO,CACL,2DACE,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,wBAAO,EAChB,uCAAuC,EACvC,yBAAM,CAAC,KAAK,CAAC,EACb,wBAAK,CAAC,IAAI,CAAC,EACX,0BAAO,CAAC,OAAO,CAAC,EAChB,SAAS,CACV,IACG,IAAI,GACP,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,SAAS,aAqBpB;AAEF,qBAAe,iBAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Colors } from '../types';
|
|
3
|
+
export interface HaloColorProps {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
top?: string;
|
|
7
|
+
left?: string;
|
|
8
|
+
bottom?: string;
|
|
9
|
+
right?: string;
|
|
10
|
+
color?: Colors;
|
|
11
|
+
size?: Sizes;
|
|
12
|
+
opacity?: Opacity;
|
|
13
|
+
}
|
|
14
|
+
export type Sizes = 'tiny' | 'small' | 'medium' | 'large' | 'huge';
|
|
15
|
+
export type Opacity = 'thin' | 'low' | 'medium' | 'high';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halo-color.props.js","sourceRoot":"","sources":["../../halo-color/halo-color.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const COLORS: {
|
|
2
|
+
primary: string;
|
|
3
|
+
danger: string;
|
|
4
|
+
warning: string;
|
|
5
|
+
secondary: string;
|
|
6
|
+
control: string;
|
|
7
|
+
tertiary: string;
|
|
8
|
+
success: string;
|
|
9
|
+
info: string;
|
|
10
|
+
inherit: string;
|
|
11
|
+
slate: string;
|
|
12
|
+
zinc: string;
|
|
13
|
+
neutral: string;
|
|
14
|
+
stone: string;
|
|
15
|
+
red: string;
|
|
16
|
+
orange: string;
|
|
17
|
+
amber: string;
|
|
18
|
+
yellow: string;
|
|
19
|
+
lime: string;
|
|
20
|
+
green: string;
|
|
21
|
+
emerald: string;
|
|
22
|
+
teal: string;
|
|
23
|
+
cyan: string;
|
|
24
|
+
sky: string;
|
|
25
|
+
blue: string;
|
|
26
|
+
indigo: string;
|
|
27
|
+
violet: string;
|
|
28
|
+
purple: string;
|
|
29
|
+
fuchsia: string;
|
|
30
|
+
pink: string;
|
|
31
|
+
rose: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @constructor
|
|
35
|
+
*/
|
|
36
|
+
export declare const SIZES: {
|
|
37
|
+
tiny: string;
|
|
38
|
+
small: string;
|
|
39
|
+
medium: string;
|
|
40
|
+
large: string;
|
|
41
|
+
huge: string;
|
|
42
|
+
};
|
|
43
|
+
export declare const OPACITY: {
|
|
44
|
+
thin: string;
|
|
45
|
+
low: string;
|
|
46
|
+
medium: string;
|
|
47
|
+
high: string;
|
|
48
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.OPACITY = exports.SIZES = exports.COLORS = void 0;
|
|
4
|
+
exports.COLORS = {
|
|
5
|
+
primary: 'bg-primary-300',
|
|
6
|
+
danger: 'bg-danger-300',
|
|
7
|
+
warning: 'bg-warning-300',
|
|
8
|
+
secondary: 'bg-secondary-300',
|
|
9
|
+
control: 'bg-control-300',
|
|
10
|
+
tertiary: 'bg-tertiary-300',
|
|
11
|
+
success: 'bg-success-300',
|
|
12
|
+
info: 'bg-info-300',
|
|
13
|
+
inherit: 'bg-primary-300',
|
|
14
|
+
slate: 'bg-slate-300',
|
|
15
|
+
zinc: 'bg-zinc-300',
|
|
16
|
+
neutral: 'bg-neutral-300',
|
|
17
|
+
stone: 'bg-stone-300',
|
|
18
|
+
red: 'bg-red-300',
|
|
19
|
+
orange: 'bg-orange-300',
|
|
20
|
+
amber: 'bg-amber-300',
|
|
21
|
+
yellow: 'bg-yellow-300',
|
|
22
|
+
lime: 'bg-lime-300',
|
|
23
|
+
green: 'bg-green-300',
|
|
24
|
+
emerald: 'bg-emerald-300',
|
|
25
|
+
teal: 'bg-teal-300',
|
|
26
|
+
cyan: 'bg-cyan-300',
|
|
27
|
+
sky: 'bg-sky-300',
|
|
28
|
+
blue: 'bg-blue-300',
|
|
29
|
+
indigo: 'bg-indigo-300',
|
|
30
|
+
violet: 'bg-violet-300',
|
|
31
|
+
purple: 'bg-purple-300',
|
|
32
|
+
fuchsia: 'bg-fuchsia-300',
|
|
33
|
+
pink: 'bg-pink-300',
|
|
34
|
+
rose: 'bg-rose-300'
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @constructor
|
|
38
|
+
*/
|
|
39
|
+
exports.SIZES = {
|
|
40
|
+
tiny: 'w-[90px] h-[90px] sm:w-[150px] sm:h-[150px] md:w-[240px] md:h-[240px]',
|
|
41
|
+
small: 'w-[150px] h-[150px] sm:w-[210px] sm:h-[210px] md:w-[300px] md:h-[300px]',
|
|
42
|
+
medium: 'w-[210px] h-[210px] sm:w-[240px] sm:h-[240px] md:w-[480px] md:h-[480px]',
|
|
43
|
+
large: 'w-[240px] h-[240px] sm:w-[300px] sm:h-[300px] md:w-[540px] md:h-[540px]',
|
|
44
|
+
huge: 'w-[300px] h-[300px] sm:w-[240px] sm:h-[240px] md:w-[627px] md:h-[627px]'
|
|
45
|
+
};
|
|
46
|
+
exports.OPACITY = {
|
|
47
|
+
thin: 'opacity-5',
|
|
48
|
+
low: 'opacity-10',
|
|
49
|
+
medium: 'opacity-20',
|
|
50
|
+
high: 'opacity-25'
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=halo-color.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halo-color.style.js","sourceRoot":"","sources":["../../halo-color/halo-color.style.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,gBAAgB;IACzB,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB;IACzB,KAAK,EAAE,cAAc;IACrB,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,cAAc;IACrB,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,aAAa;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,eAAe;IACvB,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;CACpB,CAAC;AAEF;;GAEG;AACU,QAAA,KAAK,GAAG;IACnB,IAAI,EAAE,uEAAuE;IAC7E,KAAK,EAAE,yEAAyE;IAChF,MAAM,EAAE,yEAAyE;IACjF,KAAK,EAAE,yEAAyE;IAChF,IAAI,EAAE,yEAAyE;CAChF,CAAC;AAEW,QAAA,OAAO,GAAG;IACrB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,YAAY;IACjB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,YAAY;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../halo-color/index.ts"],"names":[],"mappings":";;;AAAA,oEAAqC;AAErC,qBAAe,uBAAS,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import Checkbox from './checkbox/checkbox';
|
|
|
15
15
|
import Chip from './chip/chip';
|
|
16
16
|
import Div from './div/div';
|
|
17
17
|
import Divider from './divider/divider';
|
|
18
|
+
import HaloColor from './halo-color/halo-color';
|
|
18
19
|
import Label from './label/label';
|
|
19
20
|
import ListItem from './list-item/list-item';
|
|
20
21
|
import List from './list/list';
|
|
@@ -41,4 +42,5 @@ import Textarea from './textarea/textarea';
|
|
|
41
42
|
import Tooltip from './tooltip/tooltip';
|
|
42
43
|
export { DocsplainProvider, useDocsplain, useFontSize, useResponsiveFontSize, useTextDirection, useTextScale, useTheme, } from './provider';
|
|
43
44
|
export type { DocsplainConfig, DocsplainProviderProps, TextDirection, TextScale, Theme, } from './provider';
|
|
44
|
-
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, Alert, AutoComplete, Avatar, Badge, Button, Card, CardBody, CardHeader, CardFooter, Checkbox, Chip, Div, Divider, Label, List, ListItem, Media, Modal, MousePopup, MultiSelect, Popper, PopperContent, PopperHandler, RadioButton, Select, Skeleton, Slider, Snackbar, Spinner, SwitchBox, Tab, TabItem, Text, Textarea, TextInput, Tooltip, twMerge, };
|
|
45
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, Alert, AutoComplete, Avatar, Badge, Button, Card, CardBody, CardHeader, CardFooter, Checkbox, Chip, Div, Divider, HaloColor, Label, List, ListItem, Media, Modal, MousePopup, MultiSelect, Popper, PopperContent, PopperHandler, RadioButton, Select, Skeleton, Slider, Snackbar, Spinner, SwitchBox, Tab, TabItem, Text, Textarea, TextInput, Tooltip, twMerge, };
|
|
46
|
+
export { createClientWrapper, generateClientWrapper, clientWrapperTemplates, type ComponentImport, } from './server';
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.twMerge = exports.Tooltip = exports.TextInput = exports.Textarea = exports.Text = exports.TabItem = exports.Tab = exports.SwitchBox = exports.Spinner = exports.Snackbar = exports.Slider = exports.Skeleton = exports.Select = exports.RadioButton = exports.PopperHandler = exports.PopperContent = exports.Popper = exports.MultiSelect = exports.MousePopup = exports.Modal = exports.Media = exports.ListItem = exports.List = exports.Label = exports.Divider = exports.Div = exports.Chip = exports.Checkbox = exports.CardFooter = exports.CardHeader = exports.CardBody = exports.Card = exports.Button = exports.Badge = exports.Avatar = exports.AutoComplete = exports.Alert = exports.AccordionItem = exports.AccordionHeader = exports.AccordionContent = exports.Accordion = exports.useTheme = exports.useTextScale = exports.useTextDirection = exports.useResponsiveFontSize = exports.useFontSize = exports.useDocsplain = exports.DocsplainProvider = void 0;
|
|
3
|
+
exports.createClientWrapper = exports.twMerge = exports.Tooltip = exports.TextInput = exports.Textarea = exports.Text = exports.TabItem = exports.Tab = exports.SwitchBox = exports.Spinner = exports.Snackbar = exports.Slider = exports.Skeleton = exports.Select = exports.RadioButton = exports.PopperHandler = exports.PopperContent = exports.Popper = exports.MultiSelect = exports.MousePopup = exports.Modal = exports.Media = exports.ListItem = exports.List = exports.Label = exports.HaloColor = exports.Divider = exports.Div = exports.Chip = exports.Checkbox = exports.CardFooter = exports.CardHeader = exports.CardBody = exports.Card = exports.Button = exports.Badge = exports.Avatar = exports.AutoComplete = exports.Alert = exports.AccordionItem = exports.AccordionHeader = exports.AccordionContent = exports.Accordion = exports.useTheme = exports.useTextScale = exports.useTextDirection = exports.useResponsiveFontSize = exports.useFontSize = exports.useDocsplain = exports.DocsplainProvider = void 0;
|
|
4
|
+
exports.clientWrapperTemplates = exports.generateClientWrapper = void 0;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var accordion_1 = tslib_1.__importDefault(require("./accordion/accordion"));
|
|
6
7
|
exports.Accordion = accordion_1["default"];
|
|
@@ -36,6 +37,8 @@ var div_1 = tslib_1.__importDefault(require("./div/div"));
|
|
|
36
37
|
exports.Div = div_1["default"];
|
|
37
38
|
var divider_1 = tslib_1.__importDefault(require("./divider/divider"));
|
|
38
39
|
exports.Divider = divider_1["default"];
|
|
40
|
+
var halo_color_1 = tslib_1.__importDefault(require("./halo-color/halo-color"));
|
|
41
|
+
exports.HaloColor = halo_color_1["default"];
|
|
39
42
|
var label_1 = tslib_1.__importDefault(require("./label/label"));
|
|
40
43
|
exports.Label = label_1["default"];
|
|
41
44
|
var list_item_1 = tslib_1.__importDefault(require("./list-item/list-item"));
|
|
@@ -93,4 +96,9 @@ tslib_1.__createBinding(exports, provider_1, "useResponsiveFontSize");
|
|
|
93
96
|
tslib_1.__createBinding(exports, provider_1, "useTextDirection");
|
|
94
97
|
tslib_1.__createBinding(exports, provider_1, "useTextScale");
|
|
95
98
|
tslib_1.__createBinding(exports, provider_1, "useTheme");
|
|
99
|
+
// Server Component Utilities
|
|
100
|
+
var server_1 = require("./server");
|
|
101
|
+
tslib_1.__createBinding(exports, server_1, "createClientWrapper");
|
|
102
|
+
tslib_1.__createBinding(exports, server_1, "generateClientWrapper");
|
|
103
|
+
tslib_1.__createBinding(exports, server_1, "clientWrapperTemplates");
|
|
96
104
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AAAA,4EAA8C;AA8D5C,oBA9DK,sBAAS,CA8DL;AA7DX,8GAA+E;AA8D7E,2BA9DK,8BAAgB,CA8DL;AA7DlB,2GAA4E;AA8D1E,0BA9DK,6BAAe,CA8DL;AA7DjB,qGAAsE;AA8DpE,wBA9DK,2BAAa,CA8DL;AA7Df,gEAAkC;AA8DhC,gBA9DK,kBAAK,CA8DL;AA7DP,0EAA2C;AA8DzC,uBA9DK,0BAAY,CA8DL;AA7Dd,mEAAqC;AA8DnC,iBA9DK,mBAAM,CA8DL;AA7DR,gEAAkC;AA8DhC,gBA9DK,kBAAK,CA8DL;AA7DP,mEAAqC;AA8DnC,iBA9DK,mBAAM,CA8DL;AA7DR,6DAA+B;AA8D7B,eA9DK,iBAAI,CA8DL;AA7DN,uEAAwC;AA8DtC,mBA9DK,sBAAQ,CA8DL;AA7DV,2EAA4C;AA+D1C,qBA/DK,wBAAU,CA+DL;AA9DZ,2EAA4C;AA6D1C,qBA7DK,wBAAU,CA6DL;AA5DZ,yEAA2C;AA8DzC,mBA9DK,qBAAQ,CA8DL;AA7DV,6DAA+B;AA8D7B,eA9DK,iBAAI,CA8DL;AA7DN,0DAA4B;AA8D1B,cA9DK,gBAAG,CA8DL;AA7DL,sEAAwC;AA8DtC,kBA9DK,oBAAO,CA8DL;AA7DT,+EAAgD;AA8D9C,oBA9DK,uBAAS,CA8DL;AA7DX,gEAAkC;AA8DhC,gBA9DK,kBAAK,CA8DL;AA7DP,4EAA6C;AA+D3C,mBA/DK,sBAAQ,CA+DL;AA9DV,6DAA+B;AA6D7B,eA7DK,iBAAI,CA6DL;AA5DN,gEAAkC;AA8DhC,gBA9DK,kBAAK,CA8DL;AA7DP,gEAAkC;A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
4
|
+
* This utility helps create client component wrappers for use in server components.
|
|
5
|
+
* Since all Docsplain UI Kit components are client components, you need to create
|
|
6
|
+
* wrapper files with 'use client' directive to use them in server components.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // components/docsplain.tsx
|
|
11
|
+
* 'use client';
|
|
12
|
+
*
|
|
13
|
+
* export {
|
|
14
|
+
* Tab,
|
|
15
|
+
* TabItem,
|
|
16
|
+
* Button,
|
|
17
|
+
* } from '@docsplain-kit/core';
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Then use in server components:
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // app/page.tsx
|
|
23
|
+
* import { Tab, TabItem } from './components/docsplain';
|
|
24
|
+
*
|
|
25
|
+
* export default function Page() {
|
|
26
|
+
* return (
|
|
27
|
+
* <Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
28
|
+
* <TabItem value="tab1">Home</TabItem>
|
|
29
|
+
* </Tab>
|
|
30
|
+
* );
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import React from 'react';
|
|
35
|
+
/**
|
|
36
|
+
* Type for component imports
|
|
37
|
+
*/
|
|
38
|
+
export type ComponentImport<T = any> = () => Promise<{
|
|
39
|
+
default?: T;
|
|
40
|
+
[key: string]: T | any;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for creating client wrappers
|
|
44
|
+
*/
|
|
45
|
+
interface ClientWrapperConfig {
|
|
46
|
+
[componentName: string]: ComponentImport;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates client component wrappers from dynamic imports
|
|
50
|
+
*
|
|
51
|
+
* This is useful when you want to lazy-load components or create
|
|
52
|
+
* wrappers that can be used in server components.
|
|
53
|
+
*
|
|
54
|
+
* @param config - Object mapping component names to their import functions
|
|
55
|
+
* @returns Object with component wrappers
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const { Tab, TabItem } = createClientWrapper({
|
|
60
|
+
* Tab: () => import('@docsplain-kit/core').then(mod => ({ default: mod.Tab })),
|
|
61
|
+
* TabItem: () => import('@docsplain-kit/core').then(mod => ({ default: mod.TabItem })),
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function createClientWrapper<T extends ClientWrapperConfig>(config: T): {
|
|
66
|
+
[K in keyof T]: React.ComponentType<any>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Helper to create a simple client wrapper file content
|
|
70
|
+
*
|
|
71
|
+
* This generates the content for a client wrapper file that you can
|
|
72
|
+
* copy into your project.
|
|
73
|
+
*
|
|
74
|
+
* @param componentNames - Array of component names to export
|
|
75
|
+
* @returns String content for the wrapper file
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* const content = generateClientWrapper(['Tab', 'TabItem', 'Button']);
|
|
80
|
+
* // Returns: 'use client';\n\nexport { Tab, TabItem, Button } from '@docsplain-kit/core';
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateClientWrapper(componentNames: string[]): string;
|
|
84
|
+
/**
|
|
85
|
+
* Pre-configured client wrapper exports
|
|
86
|
+
*
|
|
87
|
+
* These are ready-to-use exports for common component groups.
|
|
88
|
+
* You can copy these into your own client wrapper files.
|
|
89
|
+
*/
|
|
90
|
+
export declare const clientWrapperTemplates: {
|
|
91
|
+
/**
|
|
92
|
+
* All form components
|
|
93
|
+
*/
|
|
94
|
+
forms: string;
|
|
95
|
+
/**
|
|
96
|
+
* All navigation components
|
|
97
|
+
*/
|
|
98
|
+
navigation: string;
|
|
99
|
+
/**
|
|
100
|
+
* All layout components
|
|
101
|
+
*/
|
|
102
|
+
layout: string;
|
|
103
|
+
/**
|
|
104
|
+
* All feedback components
|
|
105
|
+
*/
|
|
106
|
+
feedback: string;
|
|
107
|
+
/**
|
|
108
|
+
* All data display components
|
|
109
|
+
*/
|
|
110
|
+
display: string;
|
|
111
|
+
/**
|
|
112
|
+
* All components
|
|
113
|
+
*/
|
|
114
|
+
all: string;
|
|
115
|
+
};
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client Wrapper Utility
|
|
4
|
+
*
|
|
5
|
+
* This utility helps create client component wrappers for use in server components.
|
|
6
|
+
* Since all Docsplain UI Kit components are client components, you need to create
|
|
7
|
+
* wrapper files with 'use client' directive to use them in server components.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // components/docsplain.tsx
|
|
12
|
+
* 'use client';
|
|
13
|
+
*
|
|
14
|
+
* export {
|
|
15
|
+
* Tab,
|
|
16
|
+
* TabItem,
|
|
17
|
+
* Button,
|
|
18
|
+
* } from '@docsplain-kit/core';
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Then use in server components:
|
|
22
|
+
* ```tsx
|
|
23
|
+
* // app/page.tsx
|
|
24
|
+
* import { Tab, TabItem } from './components/docsplain';
|
|
25
|
+
*
|
|
26
|
+
* export default function Page() {
|
|
27
|
+
* return (
|
|
28
|
+
* <Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
29
|
+
* <TabItem value="tab1">Home</TabItem>
|
|
30
|
+
* </Tab>
|
|
31
|
+
* );
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
'use client';
|
|
36
|
+
/**
|
|
37
|
+
* Client Wrapper Utility
|
|
38
|
+
*
|
|
39
|
+
* This utility helps create client component wrappers for use in server components.
|
|
40
|
+
* Since all Docsplain UI Kit components are client components, you need to create
|
|
41
|
+
* wrapper files with 'use client' directive to use them in server components.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* // components/docsplain.tsx
|
|
46
|
+
* 'use client';
|
|
47
|
+
*
|
|
48
|
+
* export {
|
|
49
|
+
* Tab,
|
|
50
|
+
* TabItem,
|
|
51
|
+
* Button,
|
|
52
|
+
* } from '@docsplain-kit/core';
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Then use in server components:
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // app/page.tsx
|
|
58
|
+
* import { Tab, TabItem } from './components/docsplain';
|
|
59
|
+
*
|
|
60
|
+
* export default function Page() {
|
|
61
|
+
* return (
|
|
62
|
+
* <Tab selectedValue="tab1" onTabSelect={() => {}}>
|
|
63
|
+
* <TabItem value="tab1">Home</TabItem>
|
|
64
|
+
* </Tab>
|
|
65
|
+
* );
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
exports.__esModule = true;
|
|
70
|
+
exports.clientWrapperTemplates = exports.generateClientWrapper = exports.createClientWrapper = void 0;
|
|
71
|
+
var tslib_1 = require("tslib");
|
|
72
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
73
|
+
/**
|
|
74
|
+
* Creates client component wrappers from dynamic imports
|
|
75
|
+
*
|
|
76
|
+
* This is useful when you want to lazy-load components or create
|
|
77
|
+
* wrappers that can be used in server components.
|
|
78
|
+
*
|
|
79
|
+
* @param config - Object mapping component names to their import functions
|
|
80
|
+
* @returns Object with component wrappers
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* const { Tab, TabItem } = createClientWrapper({
|
|
85
|
+
* Tab: () => import('@docsplain-kit/core').then(mod => ({ default: mod.Tab })),
|
|
86
|
+
* TabItem: () => import('@docsplain-kit/core').then(mod => ({ default: mod.TabItem })),
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function createClientWrapper(config) {
|
|
91
|
+
var _this = this;
|
|
92
|
+
var wrappers = {};
|
|
93
|
+
var _loop_1 = function (name_1, importFn) {
|
|
94
|
+
var LazyComponent = react_1["default"].lazy(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
95
|
+
var module;
|
|
96
|
+
return tslib_1.__generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0: return [4 /*yield*/, importFn()];
|
|
99
|
+
case 1:
|
|
100
|
+
module = _a.sent();
|
|
101
|
+
return [2 /*return*/, {
|
|
102
|
+
"default": module["default"] || module[name_1]
|
|
103
|
+
}];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); });
|
|
107
|
+
// Create a wrapper that handles Suspense
|
|
108
|
+
wrappers[name_1] = function (props) { return (react_1["default"].createElement(react_1["default"].Suspense, { fallback: react_1["default"].createElement("div", null, "Loading...") },
|
|
109
|
+
react_1["default"].createElement(LazyComponent, tslib_1.__assign({}, props)))); };
|
|
110
|
+
};
|
|
111
|
+
for (var _i = 0, _a = Object.entries(config); _i < _a.length; _i++) {
|
|
112
|
+
var _b = _a[_i], name_1 = _b[0], importFn = _b[1];
|
|
113
|
+
_loop_1(name_1, importFn);
|
|
114
|
+
}
|
|
115
|
+
return wrappers;
|
|
116
|
+
}
|
|
117
|
+
exports.createClientWrapper = createClientWrapper;
|
|
118
|
+
/**
|
|
119
|
+
* Helper to create a simple client wrapper file content
|
|
120
|
+
*
|
|
121
|
+
* This generates the content for a client wrapper file that you can
|
|
122
|
+
* copy into your project.
|
|
123
|
+
*
|
|
124
|
+
* @param componentNames - Array of component names to export
|
|
125
|
+
* @returns String content for the wrapper file
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* const content = generateClientWrapper(['Tab', 'TabItem', 'Button']);
|
|
130
|
+
* // Returns: 'use client';\n\nexport { Tab, TabItem, Button } from '@docsplain-kit/core';
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
function generateClientWrapper(componentNames) {
|
|
134
|
+
var exports = componentNames.join(', ');
|
|
135
|
+
return "'use client';\n\nexport { ".concat(exports, " } from '@docsplain-kit/core';");
|
|
136
|
+
}
|
|
137
|
+
exports.generateClientWrapper = generateClientWrapper;
|
|
138
|
+
/**
|
|
139
|
+
* Pre-configured client wrapper exports
|
|
140
|
+
*
|
|
141
|
+
* These are ready-to-use exports for common component groups.
|
|
142
|
+
* You can copy these into your own client wrapper files.
|
|
143
|
+
*/
|
|
144
|
+
exports.clientWrapperTemplates = {
|
|
145
|
+
/**
|
|
146
|
+
* All form components
|
|
147
|
+
*/
|
|
148
|
+
forms: generateClientWrapper([
|
|
149
|
+
'TextInput',
|
|
150
|
+
'Textarea',
|
|
151
|
+
'Select',
|
|
152
|
+
'MultiSelect',
|
|
153
|
+
'Checkbox',
|
|
154
|
+
'RadioButton',
|
|
155
|
+
'SwitchBox',
|
|
156
|
+
'Slider',
|
|
157
|
+
'Label',
|
|
158
|
+
'AutoComplete',
|
|
159
|
+
]),
|
|
160
|
+
/**
|
|
161
|
+
* All navigation components
|
|
162
|
+
*/
|
|
163
|
+
navigation: generateClientWrapper([
|
|
164
|
+
'Tab',
|
|
165
|
+
'TabItem',
|
|
166
|
+
'Button',
|
|
167
|
+
'Chip',
|
|
168
|
+
]),
|
|
169
|
+
/**
|
|
170
|
+
* All layout components
|
|
171
|
+
*/
|
|
172
|
+
layout: generateClientWrapper([
|
|
173
|
+
'Div',
|
|
174
|
+
'Card',
|
|
175
|
+
'CardHeader',
|
|
176
|
+
'CardBody',
|
|
177
|
+
'CardFooter',
|
|
178
|
+
'Divider',
|
|
179
|
+
'List',
|
|
180
|
+
'ListItem',
|
|
181
|
+
]),
|
|
182
|
+
/**
|
|
183
|
+
* All feedback components
|
|
184
|
+
*/
|
|
185
|
+
feedback: generateClientWrapper([
|
|
186
|
+
'Alert',
|
|
187
|
+
'Snackbar',
|
|
188
|
+
'Modal',
|
|
189
|
+
'Tooltip',
|
|
190
|
+
'MousePopup',
|
|
191
|
+
]),
|
|
192
|
+
/**
|
|
193
|
+
* All data display components
|
|
194
|
+
*/
|
|
195
|
+
display: generateClientWrapper([
|
|
196
|
+
'Avatar',
|
|
197
|
+
'Badge',
|
|
198
|
+
'Skeleton',
|
|
199
|
+
'Spinner',
|
|
200
|
+
'Text',
|
|
201
|
+
'Media',
|
|
202
|
+
]),
|
|
203
|
+
/**
|
|
204
|
+
* All components
|
|
205
|
+
*/
|
|
206
|
+
all: generateClientWrapper([
|
|
207
|
+
'Accordion',
|
|
208
|
+
'AccordionContent',
|
|
209
|
+
'AccordionHeader',
|
|
210
|
+
'AccordionItem',
|
|
211
|
+
'Alert',
|
|
212
|
+
'AutoComplete',
|
|
213
|
+
'Avatar',
|
|
214
|
+
'Badge',
|
|
215
|
+
'Button',
|
|
216
|
+
'Card',
|
|
217
|
+
'CardBody',
|
|
218
|
+
'CardFooter',
|
|
219
|
+
'CardHeader',
|
|
220
|
+
'Checkbox',
|
|
221
|
+
'Chip',
|
|
222
|
+
'Div',
|
|
223
|
+
'Divider',
|
|
224
|
+
'Label',
|
|
225
|
+
'List',
|
|
226
|
+
'ListItem',
|
|
227
|
+
'Media',
|
|
228
|
+
'Modal',
|
|
229
|
+
'MousePopup',
|
|
230
|
+
'MultiSelect',
|
|
231
|
+
'Popper',
|
|
232
|
+
'PopperContent',
|
|
233
|
+
'PopperHandler',
|
|
234
|
+
'RadioButton',
|
|
235
|
+
'Select',
|
|
236
|
+
'Skeleton',
|
|
237
|
+
'Slider',
|
|
238
|
+
'Snackbar',
|
|
239
|
+
'Spinner',
|
|
240
|
+
'SwitchBox',
|
|
241
|
+
'Tab',
|
|
242
|
+
'TabItem',
|
|
243
|
+
'Text',
|
|
244
|
+
'Textarea',
|
|
245
|
+
'TextInput',
|
|
246
|
+
'Tooltip',
|
|
247
|
+
])
|
|
248
|
+
};
|
|
249
|
+
//# sourceMappingURL=client-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-wrapper.js","sourceRoot":"","sources":["../../server/client-wrapper.tsx"],"names":[],"mappings":";AAAA;;;;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This module provides utilities and helpers for using Docsplain UI Kit
|
|
5
|
+
* components in React Server Components (Next.js App Router, etc.)
|
|
6
|
+
*
|
|
7
|
+
* Since all Docsplain UI Kit components are client components, you need
|
|
8
|
+
* to create wrapper files with 'use client' directive to use them in server components.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // components/docsplain.tsx
|
|
13
|
+
* 'use client';
|
|
14
|
+
*
|
|
15
|
+
* export {
|
|
16
|
+
* Tab,
|
|
17
|
+
* TabItem,
|
|
18
|
+
* Button,
|
|
19
|
+
* } from '@docsplain-kit/core';
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export { createClientWrapper, generateClientWrapper, clientWrapperTemplates, type ComponentImport, } from './client-wrapper';
|
package/server/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server Component Utilities
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities and helpers for using Docsplain UI Kit
|
|
6
|
+
* components in React Server Components (Next.js App Router, etc.)
|
|
7
|
+
*
|
|
8
|
+
* Since all Docsplain UI Kit components are client components, you need
|
|
9
|
+
* to create wrapper files with 'use client' directive to use them in server components.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // components/docsplain.tsx
|
|
14
|
+
* 'use client';
|
|
15
|
+
*
|
|
16
|
+
* export {
|
|
17
|
+
* Tab,
|
|
18
|
+
* TabItem,
|
|
19
|
+
* Button,
|
|
20
|
+
* } from '@docsplain-kit/core';
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
exports.__esModule = true;
|
|
35
|
+
exports.clientWrapperTemplates = exports.generateClientWrapper = exports.createClientWrapper = void 0;
|
|
36
|
+
var client_wrapper_1 = require("./client-wrapper");
|
|
37
|
+
__createBinding(exports, client_wrapper_1, "createClientWrapper");
|
|
38
|
+
__createBinding(exports, client_wrapper_1, "generateClientWrapper");
|
|
39
|
+
__createBinding(exports, client_wrapper_1, "clientWrapperTemplates");
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;AAEH,mDAK0B;AAJxB,kEAAmB;AACnB,oEAAqB;AACrB,qEAAsB"}
|