@olwiba/ui 0.0.41 → 0.0.43

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.
@@ -0,0 +1,8 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface MdxContentProps {
4
+ code: string;
5
+ }
6
+ declare function MdxContent({ code }: MdxContentProps): react_jsx_runtime.JSX.Element;
7
+
8
+ export { MdxContent, type MdxContentProps };
@@ -0,0 +1,32 @@
1
+ import { cn } from '../chunk-SUKTBILF.js';
2
+ import { useMDXComponent } from '@content-collections/mdx/react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var components = {
6
+ h1: ({ className, ...props }) => /* @__PURE__ */ jsx("h1", { className: cn("mt-8 scroll-m-20 text-3xl font-bold tracking-tight text-foreground first:mt-0", className), ...props }),
7
+ h2: ({ className, ...props }) => /* @__PURE__ */ jsx("h2", { className: cn("mt-10 scroll-m-20 text-2xl font-semibold tracking-tight text-foreground first:mt-0", className), ...props }),
8
+ h3: ({ className, ...props }) => /* @__PURE__ */ jsx("h3", { className: cn("mt-8 scroll-m-20 text-xl font-semibold tracking-tight text-foreground", className), ...props }),
9
+ h4: ({ className, ...props }) => /* @__PURE__ */ jsx("h4", { className: cn("mt-6 scroll-m-20 text-lg font-semibold tracking-tight text-foreground", className), ...props }),
10
+ p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cn("leading-7 text-muted-foreground [&:not(:first-child)]:mt-6", className), ...props }),
11
+ ul: ({ className, ...props }) => /* @__PURE__ */ jsx("ul", { className: cn("my-6 ml-6 list-disc text-muted-foreground", className), ...props }),
12
+ ol: ({ className, ...props }) => /* @__PURE__ */ jsx("ol", { className: cn("my-6 ml-6 list-decimal text-muted-foreground", className), ...props }),
13
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", { className: cn("mt-2", className), ...props }),
14
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: cn("mt-6 rounded-r-lg border-l-4 border-primary bg-muted py-4 pl-6 pr-4 italic text-muted-foreground", className), ...props }),
15
+ hr: (props) => /* @__PURE__ */ jsx("hr", { className: "my-8 border-border", ...props }),
16
+ img: ({ className, alt, ...props }) => /* @__PURE__ */ jsx("img", { className: cn("rounded-lg border shadow-sm", className), alt, ...props }),
17
+ pre: ({ className, ...props }) => /* @__PURE__ */ jsx("pre", { className: cn("mt-6 mb-4 overflow-x-auto rounded-lg bg-muted p-4 text-sm", className), ...props }),
18
+ code: ({ className, ...props }) => /* @__PURE__ */ jsx("code", { className: cn("relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm text-foreground", className), ...props }),
19
+ table: ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: "my-6 w-full overflow-y-auto rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { className: cn("w-full", className), ...props }) }),
20
+ tr: ({ className, ...props }) => /* @__PURE__ */ jsx("tr", { className: cn("m-0 border-t border-border p-0 even:bg-muted", className), ...props }),
21
+ th: ({ className, ...props }) => /* @__PURE__ */ jsx("th", { className: cn("border border-border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right", className), ...props }),
22
+ td: ({ className, ...props }) => /* @__PURE__ */ jsx("td", { className: cn("border border-border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right", className), ...props }),
23
+ a: ({ className, ...props }) => /* @__PURE__ */ jsx("a", { className: cn("font-medium text-primary underline underline-offset-4 hover:text-primary/80", className), ...props })
24
+ };
25
+ function MdxContent({ code }) {
26
+ const MDXComponent = useMDXComponent(code);
27
+ return /* @__PURE__ */ jsx(MDXComponent, { components });
28
+ }
29
+
30
+ export { MdxContent };
31
+ //# sourceMappingURL=index.js.map
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/blog/MdxContent.tsx"],"names":[],"mappings":";;;;AAIA,IAAM,UAAA,GAAa;AAAA,EACjB,EAAA,EAAI,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,OAAO,CAAA,EACxD,CAAA;AAAA,EAEF,EAAA,EAAI,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,qBACzB,GAAA,CAAC,IAAA,EAAA,EAAG,WAAW,EAAA,CAAG,8CAAA,EAAgD,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAAA;AAAA,EAE3F,EAAA,EAAI,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,qBACzB,GAAA,CAAC,IAAA,EAAA,EAAG,WAAW,EAAA,CAAG,8GAAA,EAAgH,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAAA;AAAA,EAE3J,EAAA,EAAI,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,qBACzB,GAAA,CAAC,IAAA,EAAA,EAAG,WAAW,EAAA,CAAG,oGAAA,EAAsG,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAAA;AAAA,EAEjJ,CAAA,EAAG,CAAC,EAAE,SAAA,EAAW,GAAG,KAAA,EAAM,qBACxB,GAAA,CAAC,GAAA,EAAA,EAAE,WAAW,EAAA,CAAG,6EAAA,EAA+E,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO;AAE3H,CAAA;AAMO,SAAS,UAAA,CAAW,EAAE,IAAA,EAAK,EAAoB;AACpD,EAAA,MAAM,YAAA,GAAe,gBAAgB,IAAI,CAAA;AACzC,EAAA,uBAAO,GAAA,CAAC,gBAAa,UAAA,EAAwB,CAAA;AAC/C","file":"index.js","sourcesContent":["import * as React from 'react';\nimport { useMDXComponent } from '@content-collections/mdx/react';\nimport { cn } from '../lib/utils';\n\nconst components = {\n h1: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (\n <h1 className={cn('mt-8 scroll-m-20 text-3xl font-bold tracking-tight text-foreground first:mt-0', className)} {...props} />\n ),\n h2: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (\n <h2 className={cn('mt-10 scroll-m-20 text-2xl font-semibold tracking-tight text-foreground first:mt-0', className)} {...props} />\n ),\n h3: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (\n <h3 className={cn('mt-8 scroll-m-20 text-xl font-semibold tracking-tight text-foreground', className)} {...props} />\n ),\n h4: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (\n <h4 className={cn('mt-6 scroll-m-20 text-lg font-semibold tracking-tight text-foreground', className)} {...props} />\n ),\n p: ({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) => (\n <p className={cn('leading-7 text-muted-foreground [&:not(:first-child)]:mt-6', className)} {...props} />\n ),\n ul: ({ className, ...props }: React.HTMLAttributes<HTMLUListElement>) => (\n <ul className={cn('my-6 ml-6 list-disc text-muted-foreground', className)} {...props} />\n ),\n ol: ({ className, ...props }: React.HTMLAttributes<HTMLOListElement>) => (\n <ol className={cn('my-6 ml-6 list-decimal text-muted-foreground', className)} {...props} />\n ),\n li: ({ className, ...props }: React.HTMLAttributes<HTMLLIElement>) => (\n <li className={cn('mt-2', className)} {...props} />\n ),\n blockquote: ({ className, ...props }: React.HTMLAttributes<HTMLQuoteElement>) => (\n <blockquote className={cn('mt-6 rounded-r-lg border-l-4 border-primary bg-muted py-4 pl-6 pr-4 italic text-muted-foreground', className)} {...props} />\n ),\n hr: (props: React.HTMLAttributes<HTMLHRElement>) => (\n <hr className=\"my-8 border-border\" {...props} />\n ),\n img: ({ className, alt, ...props }: React.ImgHTMLAttributes<HTMLImageElement>) => (\n <img className={cn('rounded-lg border shadow-sm', className)} alt={alt} {...props} />\n ),\n pre: ({ className, ...props }: React.HTMLAttributes<HTMLPreElement>) => (\n <pre className={cn('mt-6 mb-4 overflow-x-auto rounded-lg bg-muted p-4 text-sm', className)} {...props} />\n ),\n code: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (\n <code className={cn('relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm text-foreground', className)} {...props} />\n ),\n table: ({ className, ...props }: React.HTMLAttributes<HTMLTableElement>) => (\n <div className=\"my-6 w-full overflow-y-auto rounded-lg border border-border\">\n <table className={cn('w-full', className)} {...props} />\n </div>\n ),\n tr: ({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (\n <tr className={cn('m-0 border-t border-border p-0 even:bg-muted', className)} {...props} />\n ),\n th: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (\n <th className={cn('border border-border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right', className)} {...props} />\n ),\n td: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (\n <td className={cn('border border-border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right', className)} {...props} />\n ),\n a: ({ className, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (\n <a className={cn('font-medium text-primary underline underline-offset-4 hover:text-primary/80', className)} {...props} />\n ),\n};\n\nexport interface MdxContentProps {\n code: string;\n}\n\nexport function MdxContent({ code }: MdxContentProps) {\n const MDXComponent = useMDXComponent(code);\n return <MDXComponent components={components} />;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olwiba/ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -15,6 +15,10 @@
15
15
  "./email": {
16
16
  "import": "./dist/email/index.js",
17
17
  "types": "./dist/email/index.d.ts"
18
+ },
19
+ "./mdx": {
20
+ "import": "./dist/mdx/index.js",
21
+ "types": "./dist/mdx/index.d.ts"
18
22
  }
19
23
  },
20
24
  "files": [
package/src/index.ts CHANGED
@@ -14,6 +14,9 @@ export {
14
14
  // ─── Primitives — mode-aware re-exports of @olwiba/cn components ─────────────
15
15
  export * from './primitives';
16
16
 
17
+ // ─── Layout — grid, stack, section primitives ────────────────────────────────
18
+ export * from './layout';
19
+
17
20
  // ─── App — shells, auth, feedback ────────────────────────────────────────────
18
21
  export {
19
22
  AppShell,
@@ -109,7 +112,9 @@ export { PostCard, type PostCardProps } from './blog/PostCard';
109
112
  export { PostList, type PostListProps } from './blog/PostList';
110
113
  export { ChangelogList, type ChangelogListProps } from './blog/ChangelogList';
111
114
  export { ChangelogCard, type ChangelogCardProps } from './blog/ChangelogCard';
112
- export { MdxContent, type MdxContentProps } from './blog/MdxContent';
115
+
116
+ // ─── MDX — import from @olwiba/ui/mdx (requires @content-collections/mdx peer) ─
117
+ // MdxContent is not exported here to avoid forcing @content-collections/mdx on all consumers.
113
118
 
114
119
  // ─── Hooks ────────────────────────────────────────────────────────────────────
115
120
  export { useMounted } from './hooks/use-mounted';
@@ -0,0 +1,72 @@
1
+ import React from 'react'
2
+ import { cn } from '../lib/utils'
3
+
4
+ const colsMap: Record<number, string> = {
5
+ 1: 'grid-cols-1',
6
+ 2: 'grid-cols-2',
7
+ 3: 'grid-cols-3',
8
+ 4: 'grid-cols-4',
9
+ 5: 'grid-cols-5',
10
+ 6: 'grid-cols-6',
11
+ 12: 'grid-cols-12',
12
+ }
13
+
14
+ const gapMap = {
15
+ none: 'gap-0',
16
+ xs: 'gap-2',
17
+ sm: 'gap-3',
18
+ md: 'gap-4',
19
+ lg: 'gap-6',
20
+ xl: 'gap-8',
21
+ }
22
+
23
+ const spanMap: Record<number, string> = {
24
+ 1: 'col-span-1',
25
+ 2: 'col-span-2',
26
+ 3: 'col-span-3',
27
+ 4: 'col-span-4',
28
+ 5: 'col-span-5',
29
+ 6: 'col-span-6',
30
+ 7: 'col-span-7',
31
+ 8: 'col-span-8',
32
+ 9: 'col-span-9',
33
+ 10: 'col-span-10',
34
+ 11: 'col-span-11',
35
+ 12: 'col-span-12',
36
+ }
37
+
38
+ const rowSpanMap: Record<number, string> = {
39
+ 1: 'row-span-1',
40
+ 2: 'row-span-2',
41
+ 3: 'row-span-3',
42
+ 4: 'row-span-4',
43
+ }
44
+
45
+ export interface GridProps extends React.HTMLAttributes<HTMLDivElement> {
46
+ columns?: 1 | 2 | 3 | 4 | 5 | 6 | 12
47
+ gap?: keyof typeof gapMap
48
+ }
49
+
50
+ export function Grid({ columns = 3, gap = 'md', className, children, ...props }: GridProps) {
51
+ return (
52
+ <div className={cn('grid', colsMap[columns], gapMap[gap], className)} {...props}>
53
+ {children}
54
+ </div>
55
+ )
56
+ }
57
+
58
+ export interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> {
59
+ span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
60
+ rowSpan?: 1 | 2 | 3 | 4
61
+ }
62
+
63
+ export function GridItem({ span = 1, rowSpan, className, children, ...props }: GridItemProps) {
64
+ return (
65
+ <div
66
+ className={cn(spanMap[span], rowSpan != null && rowSpanMap[rowSpan], className)}
67
+ {...props}
68
+ >
69
+ {children}
70
+ </div>
71
+ )
72
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react'
2
+ import { cn } from '../lib/utils'
3
+
4
+ const paddingMap = {
5
+ none: '',
6
+ sm: 'py-4',
7
+ md: 'py-8',
8
+ lg: 'py-16',
9
+ }
10
+
11
+ export interface SectionProps extends React.HTMLAttributes<HTMLElement> {
12
+ title?: string
13
+ description?: string
14
+ padding?: keyof typeof paddingMap
15
+ }
16
+
17
+ export function Section({ title, description, padding = 'md', className, children, ...props }: SectionProps) {
18
+ return (
19
+ <section className={cn('w-full', paddingMap[padding], className)} {...props}>
20
+ {(title || description) && (
21
+ <div className="mb-6">
22
+ {title && <h2 className="text-xl font-semibold text-foreground">{title}</h2>}
23
+ {description && <p className="mt-1 text-sm text-muted-foreground">{description}</p>}
24
+ </div>
25
+ )}
26
+ {children}
27
+ </section>
28
+ )
29
+ }
@@ -0,0 +1,62 @@
1
+ import React from 'react'
2
+ import { cn } from '../lib/utils'
3
+
4
+ const gapMap = {
5
+ none: 'gap-0',
6
+ xs: 'gap-2',
7
+ sm: 'gap-3',
8
+ md: 'gap-4',
9
+ lg: 'gap-6',
10
+ xl: 'gap-8',
11
+ }
12
+
13
+ const alignMap = {
14
+ start: 'items-start',
15
+ center: 'items-center',
16
+ end: 'items-end',
17
+ stretch: 'items-stretch',
18
+ }
19
+
20
+ const justifyMap = {
21
+ start: 'justify-start',
22
+ center: 'justify-center',
23
+ end: 'justify-end',
24
+ between: 'justify-between',
25
+ around: 'justify-around',
26
+ }
27
+
28
+ export interface StackProps extends React.HTMLAttributes<HTMLDivElement> {
29
+ direction?: 'col' | 'row'
30
+ gap?: keyof typeof gapMap
31
+ align?: keyof typeof alignMap
32
+ justify?: keyof typeof justifyMap
33
+ wrap?: boolean
34
+ }
35
+
36
+ export function Stack({
37
+ direction = 'col',
38
+ gap = 'md',
39
+ align = 'stretch',
40
+ justify = 'start',
41
+ wrap = false,
42
+ className,
43
+ children,
44
+ ...props
45
+ }: StackProps) {
46
+ return (
47
+ <div
48
+ className={cn(
49
+ 'flex',
50
+ direction === 'col' ? 'flex-col' : 'flex-row',
51
+ gapMap[gap],
52
+ alignMap[align],
53
+ justifyMap[justify],
54
+ wrap && 'flex-wrap',
55
+ className,
56
+ )}
57
+ {...props}
58
+ >
59
+ {children}
60
+ </div>
61
+ )
62
+ }
@@ -0,0 +1,6 @@
1
+ export { Grid, GridItem } from './Grid'
2
+ export type { GridProps, GridItemProps } from './Grid'
3
+ export { Stack } from './Stack'
4
+ export type { StackProps } from './Stack'
5
+ export { Section } from './Section'
6
+ export type { SectionProps } from './Section'
@@ -0,0 +1 @@
1
+ export { MdxContent, type MdxContentProps } from '../blog/MdxContent';