nexus-admin 1.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.
package/USER-GUIDE.md ADDED
@@ -0,0 +1,166 @@
1
+ # nexus.core — User Guide
2
+
3
+ **nexus.core** is a shared React library for Nexus applications. It provides UI components, form/input builders, layout helpers, themes, loaders, and TypeScript interfaces used across public and admin modules.
4
+
5
+ ## Requirements
6
+
7
+ | Dependency | Version |
8
+ | ------------ | --------- |
9
+ | react | ≥ 18 |
10
+ | react-dom | ≥ 18 |
11
+ | next | ≥ 14 |
12
+
13
+ The library targets **Next.js** apps (several components use `next/link`, `next/font`, or `next/script`).
14
+
15
+ ## Installation
16
+
17
+ ### From npm (when published)
18
+
19
+ ```bash
20
+ npm install nexus.core
21
+ ```
22
+
23
+ ### From the monorepo (local path)
24
+
25
+ ```json
26
+ "dependencies": {
27
+ "nexus.core": "file:../../nexus.packages/nexus.core"
28
+ }
29
+ ```
30
+
31
+ ```bash
32
+ npm install
33
+ ```
34
+
35
+ After updating the package, rebuild it in `nexus.packages/nexus.core` with `npm run build`, then reinstall in your app if types or exports look stale.
36
+
37
+ ## Styles
38
+
39
+ Import the bundled stylesheet once in your root layout (recommended):
40
+
41
+ ```ts
42
+ import "nexus.core/styles.css";
43
+ ```
44
+
45
+ If you use `GlobalLayout`, styles are also loaded through that component’s CSS imports when the layout is rendered.
46
+
47
+ ## Basic usage
48
+
49
+ ### Forms and inputs
50
+
51
+ ```tsx
52
+ "use client";
53
+
54
+ import { Form, GetForms, GetInputs, OnFormChangeHandler } from "nexus.core";
55
+
56
+ const onChanged: OnFormChangeHandler = (value, isInit, isForced, isDisposed, key, index) => {
57
+ // handle form state
58
+ };
59
+
60
+ const form = GetForms.Create({
61
+ id: "my-form",
62
+ inputs: [
63
+ GetInputs.Textbox({ id: "email", label: "Email" }),
64
+ GetInputs.Textbox({ id: "password", label: "Password", type: EInputTypes.Password }),
65
+ ],
66
+ onChanged,
67
+ });
68
+
69
+ export function MyForm() {
70
+ return <Form param={form} />;
71
+ }
72
+ ```
73
+
74
+ Import `EInputTypes` from `nexus.core` when defining input types.
75
+
76
+ ### Buttons and icons
77
+
78
+ ```tsx
79
+ import { Button, GetButton, Iconbox, EIcons, EIconTypes } from "nexus.core";
80
+
81
+ const btn = GetButton("Save", "save-btn", undefined, EIcons.CHECKMARK);
82
+
83
+ <Button button={btn} />;
84
+ <Iconbox icon={EIcons.SETTINGS} iconType={EIconTypes.Outline} />;
85
+ ```
86
+
87
+ ### Loader
88
+
89
+ ```tsx
90
+ import { ShowLoader, HideLoader } from "nexus.core";
91
+
92
+ await ShowLoader();
93
+ // … async work …
94
+ await HideLoader();
95
+ ```
96
+
97
+ ### Global layout (Next.js)
98
+
99
+ ```tsx
100
+ import { GlobalLayout, GetGlobalLayout } from "nexus.core";
101
+
102
+ const globalLayout = GetGlobalLayout(/* … */);
103
+
104
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
105
+ return <GlobalLayout globalLayout={globalLayout}>{children}</GlobalLayout>;
106
+ }
107
+ ```
108
+
109
+ ### Environment and config
110
+
111
+ ```tsx
112
+ import { NEXUS_INFO, NEXUS_CONFIG, FILES } from "nexus.core";
113
+ ```
114
+
115
+ ### Theme
116
+
117
+ ```tsx
118
+ import { InitializeStyles, SwitchTheme, GetCurrentTheme } from "nexus.core";
119
+
120
+ InitializeStyles();
121
+ SwitchTheme("dark");
122
+ ```
123
+
124
+ ## Package exports
125
+
126
+ | Import path | Purpose |
127
+ | ------------------------ | -------------------------------- |
128
+ | `nexus.core` | All public APIs (barrel export) |
129
+ | `nexus.core/styles.css` | Combined package styles |
130
+
131
+ ## Main API areas
132
+
133
+ Everything is exported from the package root:
134
+
135
+ | Area | Examples |
136
+ | --------------- | ----------------------------------------------------- |
137
+ | **Components** | `Form`, `Button`, `Iconbox`, `GlobalLayout`, `GlobalDialogbox` |
138
+ | **Factories** | `GetForms`, `GetInputs`, `GetButton`, `GetGlobalLayout` |
139
+ | **DOM builders**| `CreateForm`, `CreateInput`, `CreateButton`, `CreateIconBox` |
140
+ | **Interfaces** | `EIcons`, `ESizes`, `EBackgrounds`, `IForm`, `IButton` |
141
+ | **Services** | `ShowLoader`, `HideLoader`, `InitializeStyles` |
142
+ | **Helpers** | `Debounce`, `IsBrowser`, `DynamicSorting` |
143
+
144
+ See TypeScript definitions in `dist/index.d.ts` for the full list.
145
+
146
+ ## TypeScript
147
+
148
+ Types ship with the package. No separate `@types` package is required.
149
+
150
+ ```ts
151
+ import type { IForm, IButton, IGlobalLayout } from "nexus.core";
152
+ ```
153
+
154
+ ## Next.js notes
155
+
156
+ - Use `"use client"` in files that call client-only APIs (`CreateForm`, loaders, theme switching in the browser).
157
+ - `GlobalLayout` is a server component (`"use server"`); use it from `app/layout.tsx` as appropriate for your Next version.
158
+ - Ensure `react` and `next` versions satisfy peer dependency ranges.
159
+
160
+ ## Versioning
161
+
162
+ Follow semver for published releases. Patch: fixes; minor: backward-compatible features; major: breaking API or peer dependency changes.
163
+
164
+ ## Support
165
+
166
+ For package development and contribution steps, see **DEVELOPER.md** in the source repository (not included in the npm install).