@uniweb/kit 0.1.9 → 0.1.10
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Standard component library for Uniweb foundations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"tailwind-merge": "^2.6.0",
|
|
40
|
-
"@uniweb/core": "0.1.
|
|
40
|
+
"@uniweb/core": "0.1.15"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Article Component
|
|
3
|
+
*
|
|
4
|
+
* Semantic article wrapper with prose typography.
|
|
5
|
+
* Use for blog posts, news articles, documentation pages, etc.
|
|
6
|
+
*
|
|
7
|
+
* @module @uniweb/kit/styled/Article
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react'
|
|
11
|
+
import { cn } from '../../utils/index.js'
|
|
12
|
+
import { Render } from '../Section/Render.jsx'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Prose sizes
|
|
16
|
+
*/
|
|
17
|
+
const SIZE_CLASSES = {
|
|
18
|
+
sm: 'prose-sm',
|
|
19
|
+
base: 'prose-base',
|
|
20
|
+
lg: 'prose-lg',
|
|
21
|
+
xl: 'prose-xl',
|
|
22
|
+
'2xl': 'prose-2xl'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Article - Semantic article with prose typography
|
|
27
|
+
*
|
|
28
|
+
* Renders content inside a semantic <article> tag with prose styling.
|
|
29
|
+
* Can accept either children or a content prop (ProseMirror JSON).
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} props
|
|
32
|
+
* @param {Object|Array} [props.content] - ProseMirror content to render
|
|
33
|
+
* @param {string} [props.size='lg'] - Text size: sm, base, lg, xl, 2xl
|
|
34
|
+
* @param {string} [props.className] - Additional CSS classes
|
|
35
|
+
* @param {React.ReactNode} [props.children] - Content to render (alternative to content prop)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // With ProseMirror content
|
|
39
|
+
* <Article content={articleData.content} />
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // With children
|
|
43
|
+
* <Article>
|
|
44
|
+
* <h1>My Article</h1>
|
|
45
|
+
* <p>Article content...</p>
|
|
46
|
+
* </Article>
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // Composing with Render
|
|
50
|
+
* <Article size="base" className="dark:prose-invert">
|
|
51
|
+
* <Render content={proseMirrorContent} />
|
|
52
|
+
* </Article>
|
|
53
|
+
*/
|
|
54
|
+
export function Article({
|
|
55
|
+
content,
|
|
56
|
+
size = 'lg',
|
|
57
|
+
className,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}) {
|
|
61
|
+
const sizeClass = SIZE_CLASSES[size] || SIZE_CLASSES.lg
|
|
62
|
+
|
|
63
|
+
// Resolve content - if it's a ProseMirror doc, get the content array
|
|
64
|
+
let resolvedContent = content
|
|
65
|
+
if (resolvedContent?.type === 'doc') {
|
|
66
|
+
resolvedContent = resolvedContent.content
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<article
|
|
71
|
+
className={cn('prose', sizeClass, 'max-w-none', className)}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
74
|
+
{children || (resolvedContent && <Render content={resolvedContent} />)}
|
|
75
|
+
</article>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default Article
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prose Component
|
|
3
|
+
*
|
|
4
|
+
* Typography wrapper for long-form content.
|
|
5
|
+
* Applies prose styling for readable text.
|
|
6
|
+
*
|
|
7
|
+
* @module @uniweb/kit/styled/Prose
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react'
|
|
11
|
+
import { cn } from '../../utils/index.js'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Prose sizes
|
|
15
|
+
*/
|
|
16
|
+
const SIZE_CLASSES = {
|
|
17
|
+
sm: 'prose-sm',
|
|
18
|
+
base: 'prose-base',
|
|
19
|
+
lg: 'prose-lg',
|
|
20
|
+
xl: 'prose-xl',
|
|
21
|
+
'2xl': 'prose-2xl'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Prose - Typography wrapper for long-form content
|
|
26
|
+
*
|
|
27
|
+
* Applies Tailwind Typography (prose) classes for readable text styling.
|
|
28
|
+
* Use for article bodies, documentation, or any long-form content.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} props
|
|
31
|
+
* @param {string} [props.size='lg'] - Text size: sm, base, lg, xl, 2xl
|
|
32
|
+
* @param {string} [props.as='div'] - HTML element to render as
|
|
33
|
+
* @param {string} [props.className] - Additional CSS classes
|
|
34
|
+
* @param {React.ReactNode} props.children - Content to render
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <Prose>
|
|
38
|
+
* <h2>Article Title</h2>
|
|
39
|
+
* <p>Article content...</p>
|
|
40
|
+
* </Prose>
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* <Prose size="base" className="dark:prose-invert">
|
|
44
|
+
* <Render content={proseMirrorContent} />
|
|
45
|
+
* </Prose>
|
|
46
|
+
*/
|
|
47
|
+
export function Prose({
|
|
48
|
+
size = 'lg',
|
|
49
|
+
as: Component = 'div',
|
|
50
|
+
className,
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
const sizeClass = SIZE_CLASSES[size] || SIZE_CLASSES.lg
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Component
|
|
58
|
+
className={cn('prose', sizeClass, 'max-w-none', className)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
{children}
|
|
62
|
+
</Component>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default Prose
|
package/src/styled/index.js
CHANGED
|
@@ -20,9 +20,15 @@ export { SidebarLayout } from './SidebarLayout/index.js'
|
|
|
20
20
|
// Content Rendering
|
|
21
21
|
// ============================================================================
|
|
22
22
|
|
|
23
|
-
// Section - Rich content section
|
|
23
|
+
// Section - Rich content section layout container
|
|
24
24
|
export { Section, Render } from './Section/index.js'
|
|
25
25
|
|
|
26
|
+
// Prose - Typography wrapper for long-form content
|
|
27
|
+
export { Prose } from './Prose/index.jsx'
|
|
28
|
+
|
|
29
|
+
// Article - Semantic article with prose typography
|
|
30
|
+
export { Article } from './Article/index.jsx'
|
|
31
|
+
|
|
26
32
|
// Renderers - Individual content type renderers
|
|
27
33
|
export { Code, Alert, Warning, Table, Details, Divider } from './Section/renderers/index.js'
|
|
28
34
|
|