@olwiba/ui 0.0.45 → 0.0.46
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/dist/index.d.ts +71 -5
- package/dist/index.js +69 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/AppContent.tsx +34 -0
- package/src/layout/AppGrid.tsx +48 -0
- package/src/layout/PublicPageFrame.tsx +42 -0
- package/src/layout/index.ts +6 -0
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cn } from '../lib/utils'
|
|
3
|
+
|
|
4
|
+
const spacingMap = {
|
|
5
|
+
sm: 'space-y-4',
|
|
6
|
+
md: 'space-y-6',
|
|
7
|
+
lg: 'space-y-8',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const maxWidthMap = {
|
|
11
|
+
none: '',
|
|
12
|
+
'screen-lg': 'mx-auto max-w-screen-lg',
|
|
13
|
+
'screen-xl': 'mx-auto max-w-screen-xl',
|
|
14
|
+
'screen-2xl': 'mx-auto max-w-screen-2xl',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AppContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
spacing?: keyof typeof spacingMap
|
|
19
|
+
maxWidth?: keyof typeof maxWidthMap
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function AppContent({
|
|
23
|
+
spacing = 'md',
|
|
24
|
+
maxWidth = 'none',
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
...props
|
|
28
|
+
}: AppContentProps) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cn('p-6', maxWidthMap[maxWidth], spacingMap[spacing], className)} {...props}>
|
|
31
|
+
{children}
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cn } from '../lib/utils'
|
|
3
|
+
|
|
4
|
+
const columnsMap = {
|
|
5
|
+
1: 'grid-cols-1',
|
|
6
|
+
2: 'grid-cols-1 md:grid-cols-2',
|
|
7
|
+
3: 'grid-cols-1 md:grid-cols-2 xl:grid-cols-3',
|
|
8
|
+
4: 'grid-cols-1 md:grid-cols-2 xl:grid-cols-4',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const gapMap = {
|
|
12
|
+
sm: 'gap-3',
|
|
13
|
+
md: 'gap-4',
|
|
14
|
+
lg: 'gap-6',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const spanMap = {
|
|
18
|
+
1: 'md:col-span-1',
|
|
19
|
+
2: 'md:col-span-2',
|
|
20
|
+
3: 'xl:col-span-3',
|
|
21
|
+
4: 'xl:col-span-4',
|
|
22
|
+
full: 'col-span-full',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AppGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
26
|
+
columns?: keyof typeof columnsMap
|
|
27
|
+
gap?: keyof typeof gapMap
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function AppGrid({ columns = 3, gap = 'md', className, children, ...props }: AppGridProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn('grid', columnsMap[columns], gapMap[gap], className)} {...props}>
|
|
33
|
+
{children}
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface AppGridCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
39
|
+
span?: keyof typeof spanMap
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function AppGridCell({ span = 1, className, children, ...props }: AppGridCellProps) {
|
|
43
|
+
return (
|
|
44
|
+
<div className={cn(spanMap[span], className)} {...props}>
|
|
45
|
+
{children}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cn } from '../lib/utils'
|
|
3
|
+
|
|
4
|
+
const surfaceMap = {
|
|
5
|
+
default: 'bg-background',
|
|
6
|
+
muted: 'bg-muted/50',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const spacingMap = {
|
|
10
|
+
sm: 'gap-4 p-4',
|
|
11
|
+
md: 'gap-5 p-4 sm:gap-6 sm:p-6',
|
|
12
|
+
lg: 'gap-6 p-4 sm:gap-8 sm:p-6',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const maxWidthMap = {
|
|
16
|
+
none: '',
|
|
17
|
+
'screen-xl': 'mx-auto max-w-screen-xl',
|
|
18
|
+
'screen-2xl': 'mx-auto max-w-screen-2xl',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface PublicPageFrameProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
surface?: keyof typeof surfaceMap
|
|
23
|
+
spacing?: keyof typeof spacingMap
|
|
24
|
+
maxWidth?: keyof typeof maxWidthMap
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function PublicPageFrame({
|
|
28
|
+
surface = 'muted',
|
|
29
|
+
spacing = 'md',
|
|
30
|
+
maxWidth = 'none',
|
|
31
|
+
className,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}: PublicPageFrameProps) {
|
|
35
|
+
return (
|
|
36
|
+
<div className={cn('min-h-screen', surfaceMap[surface], className)} {...props}>
|
|
37
|
+
<div className={cn('flex flex-col', spacingMap[spacing], maxWidthMap[maxWidth])}>
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
package/src/layout/index.ts
CHANGED
|
@@ -4,3 +4,9 @@ export { Stack } from './Stack'
|
|
|
4
4
|
export type { StackProps } from './Stack'
|
|
5
5
|
export { Section } from './Section'
|
|
6
6
|
export type { SectionProps } from './Section'
|
|
7
|
+
export { AppContent } from './AppContent'
|
|
8
|
+
export type { AppContentProps } from './AppContent'
|
|
9
|
+
export { AppGrid, AppGridCell } from './AppGrid'
|
|
10
|
+
export type { AppGridProps, AppGridCellProps } from './AppGrid'
|
|
11
|
+
export { PublicPageFrame } from './PublicPageFrame'
|
|
12
|
+
export type { PublicPageFrameProps } from './PublicPageFrame'
|