@openpkg-ts/ui 0.1.1 → 0.1.3

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,66 @@
1
+ # @openpkg-ts/ui
2
+
3
+ Low-level UI primitives for API documentation. Built with Radix UI, Tailwind CSS, and CodeHike.
4
+
5
+ Use `@openpkg-ts/react` for higher-level page components.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ bun add @openpkg-ts/ui
11
+ ```
12
+
13
+ Peer deps: `react@^18 || ^19`, `react-dom@^18 || ^19`
14
+
15
+ ## Entry Points
16
+
17
+ ### `@openpkg-ts/ui/api`
18
+
19
+ Components for displaying API exports and parameters.
20
+
21
+ ```tsx
22
+ import { ExportCard, ParameterItem, CodeTabs, TypeBadge, ImportSection } from '@openpkg-ts/ui/api';
23
+ ```
24
+
25
+ ### `@openpkg-ts/ui/badge`
26
+
27
+ Status and kind indicator badges.
28
+
29
+ ```tsx
30
+ import { KindBadge, StatusBadge } from '@openpkg-ts/ui/badge';
31
+ ```
32
+
33
+ ### `@openpkg-ts/ui/docskit`
34
+
35
+ Stripe-style API reference components and CodeHike integrations.
36
+
37
+ ```tsx
38
+ import {
39
+ // Page layout
40
+ APIReferencePage,
41
+ APISection,
42
+ ParameterList,
43
+ EndpointHeader,
44
+ ResponseBlock,
45
+
46
+ // Code blocks
47
+ DocsKitCode,
48
+ SingleCode,
49
+ Terminal,
50
+ PackageInstall,
51
+ CodeIcon,
52
+
53
+ // CodeHike handlers
54
+ addDocsKit,
55
+ } from '@openpkg-ts/ui/docskit';
56
+ ```
57
+
58
+ ### `@openpkg-ts/ui/lib/utils`
59
+
60
+ ```tsx
61
+ import { cn } from '@openpkg-ts/ui/lib/utils';
62
+ ```
63
+
64
+ ## License
65
+
66
+ MIT
@@ -1,3 +1,64 @@
1
+ import { ReactNode as ReactNode2 } from "react";
2
+ interface CodeTab {
3
+ /** Tab label */
4
+ label: string;
5
+ /** Tab content (code block) */
6
+ content: ReactNode2;
7
+ /** Raw code for copy button */
8
+ code: string;
9
+ }
10
+ interface CodeTabsProps {
11
+ /** Array of tabs */
12
+ tabs: CodeTab[];
13
+ /** Default selected tab index */
14
+ defaultIndex?: number;
15
+ /** Enable sticky positioning for the header */
16
+ sticky?: boolean;
17
+ /** Custom className */
18
+ className?: string;
19
+ }
20
+ /**
21
+ * Tabbed code block wrapper with copy button per tab.
22
+ * Uses docskit --dk-* CSS variables for consistent theming.
23
+ */
24
+ declare function CodeTabs({ tabs, defaultIndex, sticky, className }: CodeTabsProps): React.ReactNode2;
25
+ import * as React2 from "react";
26
+ type ExportKind = "function" | "type" | "variable" | "class" | "interface" | "enum";
27
+ /**
28
+ * Kind badge variants for export cards.
29
+ */
30
+ declare const kindBadgeVariants: (props?: {
31
+ kind?: ExportKind | null;
32
+ className?: string;
33
+ }) => string;
34
+ interface ExportCardProps extends React2.AnchorHTMLAttributes<HTMLAnchorElement> {
35
+ /** Export name */
36
+ name: string;
37
+ /** Description snippet */
38
+ description?: string;
39
+ /** Link to detail page */
40
+ href: string;
41
+ /** Export kind */
42
+ kind?: ExportKind | null;
43
+ /** Custom link component (for Next.js Link) */
44
+ as?: React2.ElementType;
45
+ }
46
+ /**
47
+ * Card component for displaying exports in an index grid.
48
+ * Features function name styling, description, kind badge, and hover effects.
49
+ */
50
+ declare const ExportCard: React2.ForwardRefExoticComponent<ExportCardProps & React2.RefAttributes<HTMLAnchorElement>>;
51
+ interface ImportSectionProps {
52
+ /** Import statement text */
53
+ importStatement: string;
54
+ /** Custom className */
55
+ className?: string;
56
+ }
57
+ /**
58
+ * Displays a copyable import statement with one-click copy.
59
+ * Monospace styling with copy button.
60
+ */
61
+ declare function ImportSection({ importStatement, className }: ImportSectionProps): React.ReactNode;
1
62
  interface ParameterSchema {
2
63
  /** Type name (e.g., "string", "number", "object") */
3
64
  type?: string;
@@ -29,7 +90,7 @@ interface ParameterItemProps {
29
90
  * Features expandable nested params, type annotations, and required/optional badges.
30
91
  */
31
92
  declare function ParameterItem({ name, schema, required: isRequired, description, depth, className }: ParameterItemProps): React.ReactNode;
32
- import * as React2 from "react";
93
+ import * as React3 from "react";
33
94
  type TypeColor = "string" | "number" | "boolean" | "null" | "undefined" | "object" | "array" | "function" | "union" | "generic" | "default";
34
95
  /**
35
96
  * Type coloring for syntax display.
@@ -39,7 +100,7 @@ declare const typeBadgeVariants: (props?: {
39
100
  typeColor?: TypeColor | null;
40
101
  className?: string;
41
102
  }) => string;
42
- interface TypeBadgeProps extends React2.HTMLAttributes<HTMLSpanElement> {
103
+ interface TypeBadgeProps extends React3.HTMLAttributes<HTMLSpanElement> {
43
104
  /** Type string to display */
44
105
  type: string;
45
106
  /** Override color detection */
@@ -49,66 +110,5 @@ interface TypeBadgeProps extends React2.HTMLAttributes<HTMLSpanElement> {
49
110
  * Inline type display with syntax coloring.
50
111
  * Automatically detects type category and applies appropriate color.
51
112
  */
52
- declare const TypeBadge: React2.ForwardRefExoticComponent<TypeBadgeProps & React2.RefAttributes<HTMLSpanElement>>;
53
- interface ImportSectionProps {
54
- /** Import statement text */
55
- importStatement: string;
56
- /** Custom className */
57
- className?: string;
58
- }
59
- /**
60
- * Displays a copyable import statement with one-click copy.
61
- * Monospace styling with copy button.
62
- */
63
- declare function ImportSection({ importStatement, className }: ImportSectionProps): React.ReactNode;
64
- import { ReactNode as ReactNode2 } from "react";
65
- interface CodeTab {
66
- /** Tab label */
67
- label: string;
68
- /** Tab content (code block) */
69
- content: ReactNode2;
70
- /** Raw code for copy button */
71
- code: string;
72
- }
73
- interface CodeTabsProps {
74
- /** Array of tabs */
75
- tabs: CodeTab[];
76
- /** Default selected tab index */
77
- defaultIndex?: number;
78
- /** Enable sticky positioning for the header */
79
- sticky?: boolean;
80
- /** Custom className */
81
- className?: string;
82
- }
83
- /**
84
- * Tabbed code block wrapper with copy button per tab.
85
- * Uses docskit --dk-* CSS variables for consistent theming.
86
- */
87
- declare function CodeTabs({ tabs, defaultIndex, sticky, className }: CodeTabsProps): React.ReactNode2;
88
- import * as React3 from "react";
89
- type ExportKind = "function" | "type" | "variable" | "class" | "interface" | "enum";
90
- /**
91
- * Kind badge variants for export cards.
92
- */
93
- declare const kindBadgeVariants: (props?: {
94
- kind?: ExportKind | null;
95
- className?: string;
96
- }) => string;
97
- interface ExportCardProps extends React3.AnchorHTMLAttributes<HTMLAnchorElement> {
98
- /** Export name */
99
- name: string;
100
- /** Description snippet */
101
- description?: string;
102
- /** Link to detail page */
103
- href: string;
104
- /** Export kind */
105
- kind?: ExportKind | null;
106
- /** Custom link component (for Next.js Link) */
107
- as?: React3.ElementType;
108
- }
109
- /**
110
- * Card component for displaying exports in an index grid.
111
- * Features function name styling, description, kind badge, and hover effects.
112
- */
113
- declare const ExportCard: React3.ForwardRefExoticComponent<ExportCardProps & React3.RefAttributes<HTMLAnchorElement>>;
113
+ declare const TypeBadge: React3.ForwardRefExoticComponent<TypeBadgeProps & React3.RefAttributes<HTMLSpanElement>>;
114
114
  export { typeBadgeVariants, kindBadgeVariants, TypeBadgeProps, TypeBadge, ParameterSchema, ParameterItemProps, ParameterItem, ImportSectionProps, ImportSection, ExportKind, ExportCardProps, ExportCard, CodeTabsProps, CodeTabs, CodeTab };