@aumnidigital/bms 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,359 @@
1
+ # @aumnidigital/bms
2
+
3
+ Runtime MDX renderer with built-in shadcn/ui components for React applications. Perfect for blogs, CMS, and content-heavy applications.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **50+ shadcn/ui components** - Pre-configured and ready to use in MDX
8
+ - âš¡ **Runtime MDX compilation** - No build step required for content
9
+ - 🎯 **TypeScript support** - Full type safety
10
+ - 🌗 **Dark mode ready** - Works with any Tailwind + shadcn setup
11
+ - 📦 **Tree-shakeable** - Only bundle what you use
12
+ - 🔧 **Customizable** - Override default components
13
+ - 🚀 **Zero CSS bundle** - Uses your Tailwind configuration
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @aumnidigital/bms @mdx-js/mdx
19
+ ```
20
+
21
+ ### Peer Dependencies
22
+
23
+ This package requires:
24
+ - `react` ^18.0.0 || ^19.0.0
25
+ - `react-dom` ^18.0.0 || ^19.0.0
26
+ - `@mdx-js/mdx` ^3.0.0
27
+
28
+ ## Quick Start
29
+
30
+ ```tsx
31
+ import { MDXRenderer } from '@aumnidigital/bms';
32
+
33
+ function BlogPost({ content }) {
34
+ return (
35
+ <article>
36
+ <MDXRenderer content={content} />
37
+ </article>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ### Example MDX Content
43
+
44
+ ```mdx
45
+ # My Blog Post
46
+
47
+ This is a paragraph with **bold** and *italic* text.
48
+
49
+ <Alert>
50
+ <AlertTitle>Heads up!</AlertTitle>
51
+ <AlertDescription>
52
+ This is an important notice.
53
+ </AlertDescription>
54
+ </Alert>
55
+
56
+ ## Features
57
+
58
+ <Card>
59
+ <CardHeader>
60
+ <CardTitle>Amazing Feature</CardTitle>
61
+ <CardDescription>Check this out</CardDescription>
62
+ </CardHeader>
63
+ <CardContent>
64
+ <p>Some content here</p>
65
+ </CardContent>
66
+ </Card>
67
+
68
+ <CTASection
69
+ title="Ready to get started?"
70
+ description="Contact us today"
71
+ primaryAction={{ label: "Get Started", href: "/signup" }}
72
+ secondaryAction={{ label: "Learn More", href: "/about" }}
73
+ />
74
+
75
+ | Feature | Supported |
76
+ |---------|-----------|
77
+ | MDX | ✅ |
78
+ | Tables | ✅ |
79
+ ```
80
+
81
+ ## Setup Requirements
82
+
83
+ ### 1. Tailwind CSS Configuration
84
+
85
+ Add the package to your Tailwind `content` array:
86
+
87
+ ```js
88
+ // tailwind.config.js
89
+ module.exports = {
90
+ content: [
91
+ './src/**/*.{js,ts,jsx,tsx}',
92
+ './node_modules/@aumnidigital/bms/dist/**/*.{js,cjs}',
93
+ ],
94
+ // ... rest of config
95
+ };
96
+ ```
97
+
98
+ ### 2. CSS Variables
99
+
100
+ Add these CSS variables to your global stylesheet (required for shadcn components):
101
+
102
+ ```css
103
+ @layer base {
104
+ :root {
105
+ --background: 0 0% 100%;
106
+ --foreground: 222.2 84% 4.9%;
107
+ --card: 0 0% 100%;
108
+ --card-foreground: 222.2 84% 4.9%;
109
+ --primary: 222.2 47.4% 11.2%;
110
+ --primary-foreground: 210 40% 98%;
111
+ --secondary: 210 40% 96.1%;
112
+ --secondary-foreground: 222.2 47.4% 11.2%;
113
+ --muted: 210 40% 96.1%;
114
+ --muted-foreground: 215.4 16.3% 46.9%;
115
+ --accent: 210 40% 96.1%;
116
+ --accent-foreground: 222.2 47.4% 11.2%;
117
+ --destructive: 0 84.2% 60.2%;
118
+ --destructive-foreground: 210 40% 98%;
119
+ --border: 214.3 31.8% 91.4%;
120
+ --input: 214.3 31.8% 91.4%;
121
+ --ring: 222.2 84% 4.9%;
122
+ --radius: 0.5rem;
123
+ }
124
+
125
+ .dark {
126
+ --background: 222.2 84% 4.9%;
127
+ --foreground: 210 40% 98%;
128
+ --card: 222.2 84% 4.9%;
129
+ --card-foreground: 210 40% 98%;
130
+ --primary: 210 40% 98%;
131
+ --primary-foreground: 222.2 47.4% 11.2%;
132
+ --secondary: 217.2 32.6% 17.5%;
133
+ --secondary-foreground: 210 40% 98%;
134
+ --muted: 217.2 32.6% 17.5%;
135
+ --muted-foreground: 215 20.2% 65.1%;
136
+ --accent: 217.2 32.6% 17.5%;
137
+ --accent-foreground: 210 40% 98%;
138
+ --destructive: 0 62.8% 30.6%;
139
+ --destructive-foreground: 210 40% 98%;
140
+ --border: 217.2 32.6% 17.5%;
141
+ --input: 217.2 32.6% 17.5%;
142
+ --ring: 212.7 26.8% 83.9%;
143
+ }
144
+ }
145
+ ```
146
+
147
+ ## API Reference
148
+
149
+ ### MDXRenderer
150
+
151
+ ```tsx
152
+ interface MDXRendererProps {
153
+ /** Raw MDX content string */
154
+ content: string;
155
+ /** Custom components to override defaults */
156
+ components?: Record<string, React.ComponentType<any>>;
157
+ /** Variables/data to pass into MDX scope */
158
+ scope?: Record<string, unknown>;
159
+ /** MDX compile options */
160
+ options?: Omit<CompileOptions, "outputFormat">;
161
+ /** Loading fallback component */
162
+ fallback?: ReactNode;
163
+ /** Error callback */
164
+ onError?: (error: Error) => void;
165
+ }
166
+ ```
167
+
168
+ ### Custom Components
169
+
170
+ Override default components or add your own:
171
+
172
+ ```tsx
173
+ import { MDXRenderer } from '@aumnidigital/bms';
174
+ import { MyCustomComponent } from './components/MyCustomComponent';
175
+
176
+ function BlogPost({ content }) {
177
+ return (
178
+ <MDXRenderer
179
+ content={content}
180
+ components={{
181
+ // Override default button
182
+ Button: (props) => <button className="my-custom-btn" {...props} />,
183
+
184
+ // Add custom component
185
+ MyCustomComponent,
186
+ }}
187
+ />
188
+ );
189
+ }
190
+ ```
191
+
192
+ ### Pass Variables to MDX
193
+
194
+ ```tsx
195
+ <MDXRenderer
196
+ content={content}
197
+ scope={{
198
+ authorName: "John Doe",
199
+ publishDate: "2024-01-15",
200
+ }}
201
+ />
202
+ ```
203
+
204
+ Then in MDX:
205
+ ```mdx
206
+ Written by {authorName} on {publishDate}
207
+ ```
208
+
209
+ ## Available Components
210
+
211
+ ### UI Components (shadcn/ui)
212
+
213
+ All standard shadcn/ui components are included:
214
+
215
+ - **Buttons**: `Button`
216
+ - **Cards**: `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter`
217
+ - **Alerts**: `Alert`, `AlertTitle`, `AlertDescription`, `AlertDialog`
218
+ - **Forms**: `Input`, `Textarea`, `Label`, `Checkbox`, `Select`, `RadioGroup`, `Switch`, `Form`
219
+ - **Layout**: `Separator`, `Tabs`, `Accordion`, `Collapsible`, `ScrollArea`, `Sheet`, `Dialog`
220
+ - **Navigation**: `Breadcrumb`, `DropdownMenu`
221
+ - **Data Display**: `Table`, `Badge`, `Avatar`, `Progress`, `Skeleton`
222
+ - **Overlays**: `Tooltip`, `Popover`, `HoverCard`
223
+ - **Media**: `AspectRatio`, `Calendar`
224
+
225
+ ### Custom Components
226
+
227
+ #### CTAButtonGroup
228
+
229
+ ```tsx
230
+ <CTAButtonGroup
231
+ buttons={[
232
+ { label: "Get Started", href: "/signup", variant: "default" },
233
+ { label: "Learn More", href: "/docs", variant: "outline" }
234
+ ]}
235
+ />
236
+ ```
237
+
238
+ #### CTASection
239
+
240
+ ```tsx
241
+ <CTASection
242
+ title="Ready to get started?"
243
+ description="Join thousands of users today"
244
+ variant="highlight"
245
+ primaryAction={{ label: "Sign Up", href: "/signup" }}
246
+ secondaryAction={{ label: "Learn More", href: "/about" }}
247
+ />
248
+ ```
249
+
250
+ Variants: `default`, `highlight`, `minimal`
251
+
252
+ ### Enhanced HTML Elements
253
+
254
+ The renderer automatically styles standard HTML elements:
255
+
256
+ - Headings (`h1` - `h6`)
257
+ - Paragraphs (`p`)
258
+ - Lists (`ul`, `ol`, `li`)
259
+ - Links (`a`)
260
+ - Code blocks (`pre`, `code`)
261
+ - Blockquotes (`blockquote`)
262
+ - Tables (`table`, `tr`, `th`, `td`)
263
+ - Horizontal rules (`hr`)
264
+
265
+ ## Advanced Usage
266
+
267
+ ### Loading State
268
+
269
+ ```tsx
270
+ <MDXRenderer
271
+ content={content}
272
+ fallback={<div>Loading content...</div>}
273
+ />
274
+ ```
275
+
276
+ ### Error Handling
277
+
278
+ ```tsx
279
+ <MDXRenderer
280
+ content={content}
281
+ onError={(error) => {
282
+ console.error('MDX compilation failed:', error);
283
+ // Send to error tracking service
284
+ }}
285
+ />
286
+ ```
287
+
288
+ ### Custom Remark/Rehype Plugins
289
+
290
+ ```tsx
291
+ import remarkGfm from 'remark-gfm';
292
+ import rehypeHighlight from 'rehype-highlight';
293
+
294
+ <MDXRenderer
295
+ content={content}
296
+ options={{
297
+ remarkPlugins: [remarkGfm],
298
+ rehypePlugins: [rehypeHighlight],
299
+ }}
300
+ />
301
+ ```
302
+
303
+ ## TypeScript Support
304
+
305
+ Full TypeScript support with exported types:
306
+
307
+ ```tsx
308
+ import type {
309
+ MDXRendererProps,
310
+ MDXComponents,
311
+ MDXScope
312
+ } from '@aumnidigital/bms';
313
+ ```
314
+
315
+ ## Publishing to npm
316
+
317
+ This package is published to npm under the `@aumnidigital` scope.
318
+
319
+ ### Manual Publishing
320
+
321
+ ```bash
322
+ # Build the package
323
+ cd packages/bms
324
+ pnpm build
325
+
326
+ # Test the build
327
+ npm publish --dry-run
328
+
329
+ # Publish
330
+ npm publish --access public
331
+ ```
332
+
333
+ ### Automated Publishing
334
+
335
+ Push a git tag to trigger automated publishing:
336
+
337
+ ```bash
338
+ git tag @aumnidigital/bms@0.1.0
339
+ git push --tags
340
+ ```
341
+
342
+ ## Requirements
343
+
344
+ - **Node.js**: >=18.0.0
345
+ - **React**: ^18.0.0 || ^19.0.0
346
+ - **Tailwind CSS**: v3+ or v4+
347
+ - **@mdx-js/mdx**: ^3.0.0
348
+
349
+ ## License
350
+
351
+ MIT
352
+
353
+ ## Contributing
354
+
355
+ Contributions are welcome! This package is part of a Turborepo monorepo.
356
+
357
+ ## Support
358
+
359
+ For issues and questions, please open an issue on [GitHub](https://github.com/aumnidigital/blog-software-v2).