nexus-shared 1.1.2 → 1.1.4

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 (43) hide show
  1. package/dist/chunk-7GVFDWOS.js +28 -0
  2. package/dist/chunk-7GVFDWOS.js.map +1 -0
  3. package/dist/chunk-EW6K4PYI.js +96 -0
  4. package/dist/chunk-EW6K4PYI.js.map +1 -0
  5. package/dist/chunk-UMV7E2RN.js +1 -0
  6. package/dist/chunk-UMV7E2RN.js.map +1 -0
  7. package/dist/client.css +119 -0
  8. package/dist/client.css.map +1 -0
  9. package/dist/client.d.ts +9 -0
  10. package/dist/client.js +7 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/index.css +178 -946
  13. package/dist/index.css.map +1 -1
  14. package/dist/index.d.ts +5 -1011
  15. package/dist/index.js +10 -2854
  16. package/dist/index.js.map +1 -1
  17. package/dist/interface.d.ts +9 -0
  18. package/dist/interface.js +2 -0
  19. package/dist/interface.js.map +1 -0
  20. package/dist/nexus-list-DV45tcM0.d.ts +24 -0
  21. package/dist/server.css +88 -0
  22. package/dist/server.css.map +1 -0
  23. package/dist/server.d.ts +9 -0
  24. package/dist/server.js +7 -0
  25. package/dist/server.js.map +1 -0
  26. package/package.json +35 -45
  27. package/src/client/index.ts +1 -0
  28. package/src/client/nexus-selectable-list.css +131 -0
  29. package/src/client/nexus-selectable-list.tsx +111 -0
  30. package/src/client.ts +7 -0
  31. package/src/index.ts +11 -0
  32. package/src/interface.ts +5 -0
  33. package/src/interfaces/index.ts +6 -0
  34. package/src/interfaces/nexus-base.ts +5 -0
  35. package/src/interfaces/nexus-list.ts +24 -0
  36. package/src/server/index.ts +1 -0
  37. package/src/server/nexus-stat-list.css +92 -0
  38. package/src/server/nexus-stat-list.tsx +46 -0
  39. package/src/server.ts +8 -0
  40. package/USER-GUIDE.md +0 -175
  41. package/dist/index.cjs +0 -3002
  42. package/dist/index.cjs.map +0 -1
  43. package/dist/index.d.mts +0 -1011
@@ -0,0 +1,46 @@
1
+ import type { NexusStatListProps } from "../interfaces/nexus-list";
2
+ import "./nexus-stat-list.css";
3
+
4
+ /**
5
+ * Server component — renders a read-only list of labeled items with optional values.
6
+ */
7
+ export function NexusStatList({
8
+ title,
9
+ items,
10
+ emptyMessage = "No items to display.",
11
+ className,
12
+ }: NexusStatListProps) {
13
+ const rootClass = className
14
+ ? `nexus-stat-list ${className}`
15
+ : "nexus-stat-list";
16
+
17
+ return (
18
+ <section className={rootClass} aria-labelledby="nexus-stat-list-title">
19
+ <h2 id="nexus-stat-list-title" className="nexus-stat-list__title">
20
+ {title}
21
+ </h2>
22
+
23
+ {items.length === 0 ? (
24
+ <p className="nexus-stat-list__empty">{emptyMessage}</p>
25
+ ) : (
26
+ <ul className="nexus-stat-list__list">
27
+ {items.map((item) => (
28
+ <li key={item.id} className="nexus-stat-list__item">
29
+ <div className="nexus-stat-list__label-group">
30
+ <span className="nexus-stat-list__label">{item.label}</span>
31
+ {item.description ? (
32
+ <span className="nexus-stat-list__description">
33
+ {item.description}
34
+ </span>
35
+ ) : null}
36
+ </div>
37
+ {item.value !== undefined && item.value !== null ? (
38
+ <span className="nexus-stat-list__value">{item.value}</span>
39
+ ) : null}
40
+ </li>
41
+ ))}
42
+ </ul>
43
+ )}
44
+ </section>
45
+ );
46
+ }
package/src/server.ts ADDED
@@ -0,0 +1,8 @@
1
+ import "server-only";
2
+ import "./server/nexus-stat-list.css";
3
+
4
+ /**
5
+ * Barrel entry for server-only modules (RSC, server actions, etc.).
6
+ * Add exports here as you create modules under ./server/
7
+ */
8
+ export * from "./server/index";
package/USER-GUIDE.md DELETED
@@ -1,175 +0,0 @@
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
- `next/font` must run in your app (not inside the pre-built package). Define the font in `app/layout.tsx` and pass `className` to `GlobalLayout`:
100
-
101
- ```tsx
102
- import { Inter } from "next/font/google";
103
- import { DEFAULT_FONT_WEIGHTS, GlobalLayout, GetGlobalLayout } from "nexus.core";
104
-
105
- const inter = Inter({ weight: DEFAULT_FONT_WEIGHTS, subsets: ["latin"] });
106
-
107
- const globalLayout = GetGlobalLayout(/* … */);
108
-
109
- export default function RootLayout({ children }: { children: React.ReactNode }) {
110
- return (
111
- <GlobalLayout globalLayout={globalLayout} bodyClassName={inter.className}>
112
- {children}
113
- </GlobalLayout>
114
- );
115
- }
116
- ```
117
-
118
- ### Environment and config
119
-
120
- ```tsx
121
- import { NEXUS_INFO, NEXUS_CONFIG, FILES } from "nexus.core";
122
- ```
123
-
124
- ### Theme
125
-
126
- ```tsx
127
- import { InitializeStyles, SwitchTheme, GetCurrentTheme } from "nexus.core";
128
-
129
- InitializeStyles();
130
- SwitchTheme("dark");
131
- ```
132
-
133
- ## Package exports
134
-
135
- | Import path | Purpose |
136
- | ------------------------ | -------------------------------- |
137
- | `nexus.core` | All public APIs (barrel export) |
138
- | `nexus.core/styles.css` | Combined package styles |
139
-
140
- ## Main API areas
141
-
142
- Everything is exported from the package root:
143
-
144
- | Area | Examples |
145
- | --------------- | ----------------------------------------------------- |
146
- | **Components** | `Form`, `Button`, `Iconbox`, `GlobalLayout`, `GlobalDialogbox` |
147
- | **Factories** | `GetForms`, `GetInputs`, `GetButton`, `GetGlobalLayout` |
148
- | **DOM builders**| `CreateForm`, `CreateInput`, `CreateButton`, `CreateIconBox` |
149
- | **Interfaces** | `EIcons`, `ESizes`, `EBackgrounds`, `IForm`, `IButton` |
150
- | **Services** | `ShowLoader`, `HideLoader`, `InitializeStyles` |
151
- | **Helpers** | `Debounce`, `IsBrowser`, `DynamicSorting` |
152
-
153
- See TypeScript definitions in `dist/index.d.ts` for the full list.
154
-
155
- ## TypeScript
156
-
157
- Types ship with the package. No separate `@types` package is required.
158
-
159
- ```ts
160
- import type { IForm, IButton, IGlobalLayout } from "nexus.core";
161
- ```
162
-
163
- ## Next.js notes
164
-
165
- - Use `"use client"` in files that call client-only APIs (`CreateForm`, loaders, theme switching in the browser).
166
- - `GlobalLayout` is a server component (`"use server"`); use it from `app/layout.tsx` as appropriate for your Next version.
167
- - Ensure `react` and `next` versions satisfy peer dependency ranges.
168
-
169
- ## Versioning
170
-
171
- Follow semver for published releases. Patch: fixes; minor: backward-compatible features; major: breaking API or peer dependency changes.
172
-
173
- ## Support
174
-
175
- For package development and contribution steps, see **DEVELOPER.md** in the source repository (not included in the npm install).