@hauktui/registry 0.0.1

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.
Files changed (139) hide show
  1. package/components/accordion/accordion.tsx +146 -0
  2. package/components/accordion/index.ts +2 -0
  3. package/components/alert/alert.tsx +69 -0
  4. package/components/alert/index.ts +2 -0
  5. package/components/alert-dialog/alert-dialog.tsx +185 -0
  6. package/components/alert-dialog/index.ts +2 -0
  7. package/components/avatar/avatar.tsx +57 -0
  8. package/components/avatar/index.ts +2 -0
  9. package/components/avatar-group/avatar-group.tsx +144 -0
  10. package/components/avatar-group/index.ts +2 -0
  11. package/components/badge/badge.tsx +52 -0
  12. package/components/badge/index.ts +2 -0
  13. package/components/banner/banner.tsx +407 -0
  14. package/components/banner/index.ts +2 -0
  15. package/components/breadcrumb/breadcrumb.tsx +58 -0
  16. package/components/breadcrumb/index.ts +2 -0
  17. package/components/button/button.tsx +114 -0
  18. package/components/button/index.ts +2 -0
  19. package/components/calendar/calendar.tsx +250 -0
  20. package/components/calendar/index.ts +2 -0
  21. package/components/card/card.tsx +88 -0
  22. package/components/card/index.ts +2 -0
  23. package/components/carousel/carousel.tsx +185 -0
  24. package/components/carousel/index.ts +2 -0
  25. package/components/chart/chart.tsx +189 -0
  26. package/components/chart/index.ts +2 -0
  27. package/components/checkbox/checkbox.tsx +98 -0
  28. package/components/checkbox/index.ts +2 -0
  29. package/components/code-block/code-block.tsx +214 -0
  30. package/components/code-block/index.ts +2 -0
  31. package/components/collapsible/collapsible.tsx +123 -0
  32. package/components/collapsible/index.ts +2 -0
  33. package/components/color-picker/color-picker.tsx +211 -0
  34. package/components/color-picker/index.ts +2 -0
  35. package/components/combobox/combobox.tsx +275 -0
  36. package/components/combobox/index.ts +2 -0
  37. package/components/command/command.tsx +304 -0
  38. package/components/command/index.ts +2 -0
  39. package/components/confirm-dialog/confirm-dialog.tsx +140 -0
  40. package/components/confirm-dialog/index.ts +2 -0
  41. package/components/context-menu/context-menu.tsx +188 -0
  42. package/components/context-menu/index.ts +2 -0
  43. package/components/countdown/countdown.tsx +165 -0
  44. package/components/countdown/index.ts +2 -0
  45. package/components/data-table/data-table.tsx +256 -0
  46. package/components/data-table/index.ts +2 -0
  47. package/components/date-picker/date-picker.tsx +280 -0
  48. package/components/date-picker/index.ts +2 -0
  49. package/components/dialog/dialog.tsx +84 -0
  50. package/components/dialog/index.ts +2 -0
  51. package/components/drawer/drawer.tsx +141 -0
  52. package/components/drawer/index.ts +2 -0
  53. package/components/dropdown-menu/dropdown-menu.tsx +188 -0
  54. package/components/dropdown-menu/index.ts +2 -0
  55. package/components/empty/empty.tsx +107 -0
  56. package/components/empty/index.ts +2 -0
  57. package/components/field/field.tsx +83 -0
  58. package/components/field/index.ts +2 -0
  59. package/components/form/form.tsx +202 -0
  60. package/components/form/index.ts +8 -0
  61. package/components/hover-card/hover-card.tsx +72 -0
  62. package/components/hover-card/index.ts +2 -0
  63. package/components/input-otp/index.ts +2 -0
  64. package/components/input-otp/input-otp.tsx +176 -0
  65. package/components/kbd/index.ts +2 -0
  66. package/components/kbd/kbd.tsx +30 -0
  67. package/components/label/index.ts +2 -0
  68. package/components/label/label.tsx +56 -0
  69. package/components/list/index.ts +2 -0
  70. package/components/list/list.tsx +247 -0
  71. package/components/menubar/index.ts +2 -0
  72. package/components/menubar/menubar.tsx +220 -0
  73. package/components/navigation-menu/index.ts +6 -0
  74. package/components/navigation-menu/navigation-menu.tsx +216 -0
  75. package/components/pagination/index.ts +2 -0
  76. package/components/pagination/pagination.tsx +158 -0
  77. package/components/password-input/index.ts +2 -0
  78. package/components/password-input/password-input.tsx +198 -0
  79. package/components/popover/index.ts +2 -0
  80. package/components/popover/popover.tsx +102 -0
  81. package/components/progress/index.ts +2 -0
  82. package/components/progress/progress.tsx +73 -0
  83. package/components/radio-group/index.ts +2 -0
  84. package/components/radio-group/radio-group.tsx +167 -0
  85. package/components/resizable/index.ts +2 -0
  86. package/components/resizable/resizable.tsx +141 -0
  87. package/components/scroll-area/index.ts +2 -0
  88. package/components/scroll-area/scroll-area.tsx +133 -0
  89. package/components/select/index.ts +2 -0
  90. package/components/select/select.tsx +185 -0
  91. package/components/separator/index.ts +2 -0
  92. package/components/separator/separator.tsx +63 -0
  93. package/components/sheet/index.ts +2 -0
  94. package/components/sheet/sheet.tsx +137 -0
  95. package/components/sidebar/index.ts +2 -0
  96. package/components/sidebar/sidebar.tsx +225 -0
  97. package/components/skeleton/index.ts +2 -0
  98. package/components/skeleton/skeleton.tsx +64 -0
  99. package/components/slider/index.ts +2 -0
  100. package/components/slider/slider.tsx +128 -0
  101. package/components/spinner/index.ts +2 -0
  102. package/components/spinner/spinner.tsx +57 -0
  103. package/components/stat/index.ts +2 -0
  104. package/components/stat/stat.tsx +138 -0
  105. package/components/stepper/index.ts +2 -0
  106. package/components/stepper/stepper.tsx +219 -0
  107. package/components/switch/index.ts +2 -0
  108. package/components/switch/switch.tsx +102 -0
  109. package/components/table/index.ts +2 -0
  110. package/components/table/table.tsx +242 -0
  111. package/components/tabs/index.ts +2 -0
  112. package/components/tabs/tabs.tsx +240 -0
  113. package/components/tag-input/index.ts +2 -0
  114. package/components/tag-input/tag-input.tsx +180 -0
  115. package/components/terminal/index.ts +2 -0
  116. package/components/terminal/terminal.tsx +162 -0
  117. package/components/text-input/index.ts +2 -0
  118. package/components/text-input/text-input.tsx +179 -0
  119. package/components/textarea/index.ts +2 -0
  120. package/components/textarea/textarea.tsx +206 -0
  121. package/components/timeline/index.ts +2 -0
  122. package/components/timeline/timeline.tsx +167 -0
  123. package/components/toast/index.ts +2 -0
  124. package/components/toast/toast.tsx +93 -0
  125. package/components/toggle/index.ts +2 -0
  126. package/components/toggle/toggle.tsx +114 -0
  127. package/components/toggle-group/index.ts +2 -0
  128. package/components/toggle-group/toggle-group.tsx +176 -0
  129. package/components/tooltip/index.ts +2 -0
  130. package/components/tooltip/tooltip.tsx +65 -0
  131. package/components/tree-view/index.ts +2 -0
  132. package/components/tree-view/tree-view.tsx +245 -0
  133. package/components/typography/index.ts +12 -0
  134. package/components/typography/typography.tsx +154 -0
  135. package/dist/index.d.ts +102 -0
  136. package/dist/index.js +938 -0
  137. package/dist/index.js.map +1 -0
  138. package/package.json +41 -0
  139. package/registry.json +923 -0
@@ -0,0 +1,154 @@
1
+ import React from "react";
2
+ import { Text } from "ink";
3
+ import type { Tokens } from "@hauktui/tokens";
4
+ import { useTokens } from "@hauktui/primitives-ink";
5
+
6
+ export type TypographyVariant =
7
+ | "h1"
8
+ | "h2"
9
+ | "h3"
10
+ | "h4"
11
+ | "body"
12
+ | "small"
13
+ | "code"
14
+ | "quote"
15
+ | "lead";
16
+
17
+ export interface TypographyProps {
18
+ /** Text content */
19
+ children: React.ReactNode;
20
+ /** Typography variant */
21
+ variant?: TypographyVariant;
22
+ /** Text color (token name or hex) */
23
+ color?: "fg" | "muted" | "accent" | "success" | "warning" | "danger" | string;
24
+ /** Bold text */
25
+ bold?: boolean;
26
+ /** Italic text (dimmed in terminal) */
27
+ italic?: boolean;
28
+ /** Underline text */
29
+ underline?: boolean;
30
+ /** Strikethrough text */
31
+ strikethrough?: boolean;
32
+ /** Custom tokens override */
33
+ tokens?: Tokens;
34
+ /** Text alignment hint (for parent containers) */
35
+ align?: "left" | "center" | "right";
36
+ }
37
+
38
+ export function Typography({
39
+ children,
40
+ variant = "body",
41
+ color,
42
+ bold,
43
+ italic,
44
+ underline,
45
+ strikethrough,
46
+ tokens: propTokens,
47
+ }: TypographyProps): React.ReactElement {
48
+ const contextTokens = useTokens();
49
+ const tokens = propTokens ?? contextTokens;
50
+
51
+ // Variant styles
52
+ const variantStyles: Record<
53
+ TypographyVariant,
54
+ {
55
+ bold?: boolean;
56
+ dimColor?: boolean;
57
+ color?: string;
58
+ prefix?: string;
59
+ suffix?: string;
60
+ }
61
+ > = {
62
+ h1: { bold: true, color: tokens.colors.fg },
63
+ h2: { bold: true, color: tokens.colors.fg },
64
+ h3: { bold: true, color: tokens.colors.fg },
65
+ h4: { bold: true, color: tokens.colors.muted },
66
+ body: { color: tokens.colors.fg },
67
+ small: { dimColor: true, color: tokens.colors.muted },
68
+ code: { color: tokens.colors.accent },
69
+ quote: { dimColor: true, color: tokens.colors.muted, prefix: "│ " },
70
+ lead: { color: tokens.colors.fg },
71
+ };
72
+
73
+ const style = variantStyles[variant];
74
+
75
+ // Resolve color
76
+ let resolvedColor = style.color;
77
+ if (color) {
78
+ if (color in tokens.colors) {
79
+ resolvedColor = tokens.colors[color as keyof typeof tokens.colors];
80
+ } else {
81
+ resolvedColor = color;
82
+ }
83
+ }
84
+
85
+ // Build content with prefix/suffix
86
+ const content = React.createElement(
87
+ React.Fragment,
88
+ null,
89
+ style.prefix || null,
90
+ children,
91
+ style.suffix || null
92
+ );
93
+
94
+ return React.createElement(
95
+ Text,
96
+ {
97
+ color: resolvedColor,
98
+ bold: bold ?? style.bold,
99
+ dimColor: italic ?? style.dimColor,
100
+ underline,
101
+ strikethrough,
102
+ },
103
+ content
104
+ );
105
+ }
106
+
107
+ // Convenience components
108
+ export function H1(
109
+ props: Omit<TypographyProps, "variant">
110
+ ): React.ReactElement {
111
+ return React.createElement(Typography, { ...props, variant: "h1" });
112
+ }
113
+
114
+ export function H2(
115
+ props: Omit<TypographyProps, "variant">
116
+ ): React.ReactElement {
117
+ return React.createElement(Typography, { ...props, variant: "h2" });
118
+ }
119
+
120
+ export function H3(
121
+ props: Omit<TypographyProps, "variant">
122
+ ): React.ReactElement {
123
+ return React.createElement(Typography, { ...props, variant: "h3" });
124
+ }
125
+
126
+ export function H4(
127
+ props: Omit<TypographyProps, "variant">
128
+ ): React.ReactElement {
129
+ return React.createElement(Typography, { ...props, variant: "h4" });
130
+ }
131
+
132
+ export function Code(
133
+ props: Omit<TypographyProps, "variant">
134
+ ): React.ReactElement {
135
+ return React.createElement(Typography, { ...props, variant: "code" });
136
+ }
137
+
138
+ export function Quote(
139
+ props: Omit<TypographyProps, "variant">
140
+ ): React.ReactElement {
141
+ return React.createElement(Typography, { ...props, variant: "quote" });
142
+ }
143
+
144
+ export function Small(
145
+ props: Omit<TypographyProps, "variant">
146
+ ): React.ReactElement {
147
+ return React.createElement(Typography, { ...props, variant: "small" });
148
+ }
149
+
150
+ export function Lead(
151
+ props: Omit<TypographyProps, "variant">
152
+ ): React.ReactElement {
153
+ return React.createElement(Typography, { ...props, variant: "lead" });
154
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Registry component metadata
3
+ */
4
+ interface ComponentMeta {
5
+ /** Unique component name */
6
+ name: string;
7
+ /** Human-readable description */
8
+ description: string;
9
+ /** Component version */
10
+ version: string;
11
+ /** Files to copy (relative to component directory) */
12
+ files: string[];
13
+ /** NPM dependencies required */
14
+ dependencies: Record<string, string>;
15
+ /** haukTUI package dependencies */
16
+ hauktuiDependencies: string[];
17
+ /** Post-install notes/instructions */
18
+ notes?: string;
19
+ /** Component category */
20
+ category: ComponentCategory;
21
+ /** Tags for searchability */
22
+ tags: string[];
23
+ }
24
+ /**
25
+ * Component categories
26
+ */
27
+ type ComponentCategory = "primitive" | "input" | "layout" | "feedback" | "navigation" | "pattern" | "display";
28
+ /**
29
+ * Complete registry manifest
30
+ */
31
+ interface Registry {
32
+ /** Schema version */
33
+ version: string;
34
+ /** Base URL for remote fetching */
35
+ baseUrl?: string;
36
+ /** All available components */
37
+ components: ComponentMeta[];
38
+ }
39
+ /**
40
+ * Lock file entry for installed component
41
+ */
42
+ interface LockEntry {
43
+ /** Component name */
44
+ name: string;
45
+ /** Installed version */
46
+ version: string;
47
+ /** File hashes for change detection */
48
+ files: Record<string, string>;
49
+ /** Installation timestamp */
50
+ installedAt: string;
51
+ }
52
+ /**
53
+ * Lock file structure
54
+ */
55
+ interface LockFile {
56
+ /** Lock file version */
57
+ version: string;
58
+ /** Installed components */
59
+ components: Record<string, LockEntry>;
60
+ }
61
+ /**
62
+ * User configuration file
63
+ */
64
+ interface HaukConfig {
65
+ /** Schema version */
66
+ $schema?: string;
67
+ /** Target directory for components */
68
+ componentDir: string;
69
+ /** Token overrides file path */
70
+ tokensPath?: string;
71
+ /** Registry URL (for remote fetching) */
72
+ registryUrl?: string;
73
+ /** Aliases for import paths */
74
+ aliases?: Record<string, string>;
75
+ }
76
+
77
+ /**
78
+ * Embedded registry data
79
+ */
80
+ declare const registry: Registry;
81
+ /**
82
+ * Get all components in the registry
83
+ */
84
+ declare function getComponents(): ComponentMeta[];
85
+ /**
86
+ * Get a component by name
87
+ */
88
+ declare function getComponent(name: string): ComponentMeta | undefined;
89
+ /**
90
+ * Search components by query
91
+ */
92
+ declare function searchComponents(query: string): ComponentMeta[];
93
+ /**
94
+ * Get components by category
95
+ */
96
+ declare function getComponentsByCategory(category: ComponentMeta["category"]): ComponentMeta[];
97
+ /**
98
+ * Get the registry version
99
+ */
100
+ declare function getRegistryVersion(): string;
101
+
102
+ export { type ComponentCategory, type ComponentMeta, type HaukConfig, type LockEntry, type LockFile, type Registry, getComponent, getComponents, getComponentsByCategory, getRegistryVersion, registry, searchComponents };