najm-kit 0.0.7

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,70 @@
1
+ # najm-kit
2
+
3
+ Reusable React component library for Najm applications. Provides themed UI primitives, hooks, and form components.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ bun add najm-kit
9
+ ```
10
+
11
+ Peer dependencies: `react >=18`, `react-dom >=18`.
12
+
13
+ Optional peer dependencies: `recharts`, `@tanstack/react-table`, `react-hook-form`, `@tanstack/react-query`.
14
+
15
+ ## Theme Provider
16
+
17
+ ```tsx
18
+ import { NajmThemeProvider } from 'najm-kit';
19
+
20
+ function App() {
21
+ return (
22
+ <NajmThemeProvider appearance={{ mode: 'light', accent: 'indigo' }}>
23
+ {children}
24
+ </NajmThemeProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Components
30
+
31
+ Import from `najm-kit`:
32
+
33
+ ```tsx
34
+ import { NButton, buttonVariants } from 'najm-kit';
35
+ import { Input } from 'najm-kit';
36
+ import { Card, CardHeader, CardTitle, CardContent } from 'najm-kit';
37
+ import { Dialog, DialogContent, DialogTrigger } from 'najm-kit';
38
+ import { DataTable } from 'najm-kit';
39
+ import { Form, FormInput, useNForm } from 'najm-kit';
40
+ ```
41
+
42
+ ### Available Primitives
43
+
44
+ | Category | Components |
45
+ |----------|-----------|
46
+ | Actions | NButton, IconButton, toggleVariants |
47
+ | Forms | Input, Textarea, Label, Select, Checkbox, RadioGroup, Switch, DateInput, FileInput |
48
+ | Feedback | Alert, Badge, Progress, Spinner, Toast |
49
+ | Layout | Card, Sheet, Dialog, Popover, DropdownMenu, Tabs |
50
+ | Data | Table (NTable), StatCard, DetailList |
51
+ | Overlays | Command palette, Tooltip, Toast |
52
+
53
+ ## Hooks
54
+
55
+ ```tsx
56
+ import { useKeyboard } from 'najm-kit';
57
+ import { useDelayedLoading } from 'najm-kit';
58
+ import { useClickOutside } from 'najm-kit';
59
+ import { useDebouncedValue } from 'najm-kit';
60
+ import { useInfiniteScroll } from 'najm-kit';
61
+ import { useSelection } from 'najm-kit';
62
+ ```
63
+
64
+ ## Production Notes
65
+
66
+ - Designed for dashboard/admin UIs in Najm-powered applications
67
+ - Uses Radix UI primitives under the hood — accessible by default
68
+ - All components are unstyled by default — apply `buttonVariants()`, `badgeVariants()`, etc. with Tailwind
69
+ - Requires Tailwind CSS in the host application
70
+ - CodeMirror components are optional peer deps — import from `najm-kit/json` only if needed
@@ -0,0 +1,5 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare function NTableJson(): react_jsx_runtime.JSX.Element;
4
+
5
+ export { NTableJson as N };
@@ -0,0 +1,20 @@
1
+ import React__default from 'react';
2
+
3
+ interface NextLinkAdapterProps extends Record<string, any> {
4
+ href: string;
5
+ children: React__default.ReactNode;
6
+ className?: string;
7
+ [key: string]: any;
8
+ }
9
+ declare function NextLinkAdapter({ children, ...props }: NextLinkAdapterProps): React__default.DetailedReactHTMLElement<{
10
+ [key: string]: any;
11
+ href: string;
12
+ className?: string;
13
+ }, HTMLElement>;
14
+ declare function useNextNavigationAdapter(): {
15
+ pathname: string;
16
+ push: (path: string) => void;
17
+ replace: (path: string) => void;
18
+ };
19
+
20
+ export { NextLinkAdapter, type NextLinkAdapterProps, useNextNavigationAdapter };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+
3
+ // src/adapters/next.tsx
4
+ function NextLinkAdapter({ children, ...props }) {
5
+ return React.createElement("a", props, children);
6
+ }
7
+ function useNextNavigationAdapter() {
8
+ return {
9
+ pathname: typeof window !== "undefined" ? window.location.pathname : "",
10
+ push: (path) => {
11
+ if (typeof window !== "undefined") {
12
+ window.history.pushState(null, "", path);
13
+ }
14
+ },
15
+ replace: (path) => {
16
+ if (typeof window !== "undefined") {
17
+ window.history.replaceState(null, "", path);
18
+ }
19
+ }
20
+ };
21
+ }
22
+
23
+ export { NextLinkAdapter, useNextNavigationAdapter };