nexus-shared 1.1.3 → 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.
- package/dist/chunk-7GVFDWOS.js +28 -0
- package/dist/chunk-7GVFDWOS.js.map +1 -0
- package/dist/chunk-EW6K4PYI.js +96 -0
- package/dist/chunk-EW6K4PYI.js.map +1 -0
- package/dist/chunk-UMV7E2RN.js +1 -0
- package/dist/chunk-UMV7E2RN.js.map +1 -0
- package/dist/client.css +119 -0
- package/dist/client.css.map +1 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +7 -0
- package/dist/client.js.map +1 -0
- package/dist/index.css +178 -946
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -1011
- package/dist/index.js +10 -2854
- package/dist/index.js.map +1 -1
- package/dist/interface.d.ts +9 -0
- package/dist/interface.js +2 -0
- package/dist/interface.js.map +1 -0
- package/dist/nexus-list-DV45tcM0.d.ts +24 -0
- package/dist/server.css +88 -0
- package/dist/server.css.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -0
- package/package.json +35 -45
- package/src/client/index.ts +1 -0
- package/src/client/nexus-selectable-list.css +131 -0
- package/src/client/nexus-selectable-list.tsx +111 -0
- package/src/client.ts +7 -0
- package/src/index.ts +11 -0
- package/src/interface.ts +5 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/nexus-base.ts +5 -0
- package/src/interfaces/nexus-list.ts +24 -0
- package/src/server/index.ts +1 -0
- package/src/server/nexus-stat-list.css +92 -0
- package/src/server/nexus-stat-list.tsx +46 -0
- package/src/server.ts +8 -0
- package/USER-GUIDE.md +0 -175
- package/dist/index.cjs +0 -3002
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -1011
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { N as NexusListItem, a as NexusSelectableListProps, b as NexusStatListProps } from './nexus-list-DV45tcM0.js';
|
|
2
|
+
|
|
3
|
+
/** Base props shared across Nexus packages */
|
|
4
|
+
interface NexusBaseProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type { NexusBaseProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Single row/item used by Nexus list components */
|
|
2
|
+
interface NexusListItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
}
|
|
8
|
+
/** Props for the server-rendered stat list */
|
|
9
|
+
interface NexusStatListProps {
|
|
10
|
+
title: string;
|
|
11
|
+
items: NexusListItem[];
|
|
12
|
+
emptyMessage?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Props for the client-side selectable & filterable list */
|
|
16
|
+
interface NexusSelectableListProps {
|
|
17
|
+
title: string;
|
|
18
|
+
items: NexusListItem[];
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
emptyMessage?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type { NexusListItem as N, NexusSelectableListProps as a, NexusStatListProps as b };
|
package/dist/server.css
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* src/server/nexus-stat-list.css */
|
|
2
|
+
.nexus-stat-list {
|
|
3
|
+
--nexus-stat-bg: #0f1419;
|
|
4
|
+
--nexus-stat-surface: #1a2332;
|
|
5
|
+
--nexus-stat-border: #2d3a4f;
|
|
6
|
+
--nexus-stat-accent: #3b82f6;
|
|
7
|
+
--nexus-stat-text: #e8edf4;
|
|
8
|
+
--nexus-stat-muted: #8b9cb3;
|
|
9
|
+
font-family:
|
|
10
|
+
system-ui,
|
|
11
|
+
-apple-system,
|
|
12
|
+
"Segoe UI",
|
|
13
|
+
sans-serif;
|
|
14
|
+
background: var(--nexus-stat-bg);
|
|
15
|
+
border: 1px solid var(--nexus-stat-border);
|
|
16
|
+
border-radius: 12px;
|
|
17
|
+
padding: 1.25rem 1.5rem;
|
|
18
|
+
color: var(--nexus-stat-text);
|
|
19
|
+
max-width: 28rem;
|
|
20
|
+
}
|
|
21
|
+
.nexus-stat-list__title {
|
|
22
|
+
margin: 0 0 1rem;
|
|
23
|
+
font-size: 1.125rem;
|
|
24
|
+
font-weight: 600;
|
|
25
|
+
letter-spacing: -0.02em;
|
|
26
|
+
color: var(--nexus-stat-text);
|
|
27
|
+
border-bottom: 2px solid var(--nexus-stat-accent);
|
|
28
|
+
padding-bottom: 0.5rem;
|
|
29
|
+
display: inline-block;
|
|
30
|
+
}
|
|
31
|
+
.nexus-stat-list__list {
|
|
32
|
+
list-style: none;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
.nexus-stat-list__item {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
gap: 1rem;
|
|
44
|
+
padding: 0.75rem 1rem;
|
|
45
|
+
background: var(--nexus-stat-surface);
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
border: 1px solid transparent;
|
|
48
|
+
transition: border-color 0.15s ease;
|
|
49
|
+
}
|
|
50
|
+
.nexus-stat-list__item:hover {
|
|
51
|
+
border-color: var(--nexus-stat-border);
|
|
52
|
+
}
|
|
53
|
+
.nexus-stat-list__label-group {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 0.15rem;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
}
|
|
59
|
+
.nexus-stat-list__label {
|
|
60
|
+
font-size: 0.9375rem;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
color: var(--nexus-stat-text);
|
|
63
|
+
}
|
|
64
|
+
.nexus-stat-list__description {
|
|
65
|
+
font-size: 0.8125rem;
|
|
66
|
+
color: var(--nexus-stat-muted);
|
|
67
|
+
line-height: 1.35;
|
|
68
|
+
}
|
|
69
|
+
.nexus-stat-list__value {
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
font-size: 0.875rem;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
color: var(--nexus-stat-accent);
|
|
74
|
+
background: rgba(59, 130, 246, 0.12);
|
|
75
|
+
padding: 0.25rem 0.625rem;
|
|
76
|
+
border-radius: 6px;
|
|
77
|
+
}
|
|
78
|
+
.nexus-stat-list__empty {
|
|
79
|
+
margin: 0;
|
|
80
|
+
padding: 1.5rem;
|
|
81
|
+
text-align: center;
|
|
82
|
+
font-size: 0.875rem;
|
|
83
|
+
color: var(--nexus-stat-muted);
|
|
84
|
+
background: var(--nexus-stat-surface);
|
|
85
|
+
border-radius: 8px;
|
|
86
|
+
border: 1px dashed var(--nexus-stat-border);
|
|
87
|
+
}
|
|
88
|
+
/*# sourceMappingURL=server.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/nexus-stat-list.css"],"sourcesContent":[".nexus-stat-list {\r\n --nexus-stat-bg: #0f1419;\r\n --nexus-stat-surface: #1a2332;\r\n --nexus-stat-border: #2d3a4f;\r\n --nexus-stat-accent: #3b82f6;\r\n --nexus-stat-text: #e8edf4;\r\n --nexus-stat-muted: #8b9cb3;\r\n\r\n font-family: system-ui, -apple-system, \"Segoe UI\", sans-serif;\r\n background: var(--nexus-stat-bg);\r\n border: 1px solid var(--nexus-stat-border);\r\n border-radius: 12px;\r\n padding: 1.25rem 1.5rem;\r\n color: var(--nexus-stat-text);\r\n max-width: 28rem;\r\n}\r\n\r\n.nexus-stat-list__title {\r\n margin: 0 0 1rem;\r\n font-size: 1.125rem;\r\n font-weight: 600;\r\n letter-spacing: -0.02em;\r\n color: var(--nexus-stat-text);\r\n border-bottom: 2px solid var(--nexus-stat-accent);\r\n padding-bottom: 0.5rem;\r\n display: inline-block;\r\n}\r\n\r\n.nexus-stat-list__list {\r\n list-style: none;\r\n margin: 0;\r\n padding: 0;\r\n display: flex;\r\n flex-direction: column;\r\n gap: 0.5rem;\r\n}\r\n\r\n.nexus-stat-list__item {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n gap: 1rem;\r\n padding: 0.75rem 1rem;\r\n background: var(--nexus-stat-surface);\r\n border-radius: 8px;\r\n border: 1px solid transparent;\r\n transition: border-color 0.15s ease;\r\n}\r\n\r\n.nexus-stat-list__item:hover {\r\n border-color: var(--nexus-stat-border);\r\n}\r\n\r\n.nexus-stat-list__label-group {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 0.15rem;\r\n min-width: 0;\r\n}\r\n\r\n.nexus-stat-list__label {\r\n font-size: 0.9375rem;\r\n font-weight: 500;\r\n color: var(--nexus-stat-text);\r\n}\r\n\r\n.nexus-stat-list__description {\r\n font-size: 0.8125rem;\r\n color: var(--nexus-stat-muted);\r\n line-height: 1.35;\r\n}\r\n\r\n.nexus-stat-list__value {\r\n flex-shrink: 0;\r\n font-size: 0.875rem;\r\n font-weight: 600;\r\n color: var(--nexus-stat-accent);\r\n background: rgba(59, 130, 246, 0.12);\r\n padding: 0.25rem 0.625rem;\r\n border-radius: 6px;\r\n}\r\n\r\n.nexus-stat-list__empty {\r\n margin: 0;\r\n padding: 1.5rem;\r\n text-align: center;\r\n font-size: 0.875rem;\r\n color: var(--nexus-stat-muted);\r\n background: var(--nexus-stat-surface);\r\n border-radius: 8px;\r\n border: 1px dashed var(--nexus-stat-border);\r\n}\r\n"],"mappings":";AAAA,CAAC;AACC,mBAAiB;AACjB,wBAAsB;AACtB,uBAAqB;AACrB,uBAAqB;AACrB,qBAAmB;AACnB,sBAAoB;AAEpB;AAAA,IAAa,SAAS;AAAA,IAAE,aAAa;AAAA,IAAE,UAAU;AAAA,IAAE;AACnD,cAAY,IAAI;AAChB,UAAQ,IAAI,MAAM,IAAI;AACtB,iBAAe;AACf,WAAS,QAAQ;AACjB,SAAO,IAAI;AACX,aAAW;AACb;AAEA,CAAC;AACC,UAAQ,EAAE,EAAE;AACZ,aAAW;AACX,eAAa;AACb,kBAAgB;AAChB,SAAO,IAAI;AACX,iBAAe,IAAI,MAAM,IAAI;AAC7B,kBAAgB;AAChB,WAAS;AACX;AAEA,CAAC;AACC,cAAY;AACZ,UAAQ;AACR,WAAS;AACT,WAAS;AACT,kBAAgB;AAChB,OAAK;AACP;AAEA,CAAC;AACC,WAAS;AACT,eAAa;AACb,mBAAiB;AACjB,OAAK;AACL,WAAS,QAAQ;AACjB,cAAY,IAAI;AAChB,iBAAe;AACf,UAAQ,IAAI,MAAM;AAClB,cAAY,aAAa,MAAM;AACjC;AAEA,CAZC,qBAYqB;AACpB,gBAAc,IAAI;AACpB;AAEA,CAAC;AACC,WAAS;AACT,kBAAgB;AAChB,OAAK;AACL,aAAW;AACb;AAEA,CAAC;AACC,aAAW;AACX,eAAa;AACb,SAAO,IAAI;AACb;AAEA,CAAC;AACC,aAAW;AACX,SAAO,IAAI;AACX,eAAa;AACf;AAEA,CAAC;AACC,eAAa;AACb,aAAW;AACX,eAAa;AACb,SAAO,IAAI;AACX,cAAY,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;AAC/B,WAAS,QAAQ;AACjB,iBAAe;AACjB;AAEA,CAAC;AACC,UAAQ;AACR,WAAS;AACT,cAAY;AACZ,aAAW;AACX,SAAO,IAAI;AACX,cAAY,IAAI;AAChB,iBAAe;AACf,UAAQ,IAAI,OAAO,IAAI;AACzB;","names":[]}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { b as NexusStatListProps } from './nexus-list-DV45tcM0.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Server component — renders a read-only list of labeled items with optional values.
|
|
6
|
+
*/
|
|
7
|
+
declare function NexusStatList({ title, items, emptyMessage, className, }: NexusStatListProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { NexusStatList };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,64 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexus-shared",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Nexus
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "Nexus global shared package (interfaces, server & client modules)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": ["**/*.css"],
|
|
9
7
|
"exports": {
|
|
10
8
|
".": {
|
|
11
9
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./
|
|
13
|
-
"
|
|
10
|
+
"import": "./src/index.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
14
12
|
},
|
|
15
|
-
"./
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"./
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
"./interface": {
|
|
14
|
+
"types": "./dist/interface.d.ts",
|
|
15
|
+
"import": "./src/interface.ts",
|
|
16
|
+
"default": "./dist/interface.js"
|
|
17
|
+
},
|
|
18
|
+
"./server": {
|
|
19
|
+
"types": "./dist/server.d.ts",
|
|
20
|
+
"import": "./src/server.ts",
|
|
21
|
+
"default": "./dist/server.js"
|
|
22
|
+
},
|
|
23
|
+
"./client": {
|
|
24
|
+
"types": "./dist/client.d.ts",
|
|
25
|
+
"import": "./src/client.ts",
|
|
26
|
+
"default": "./dist/client.js"
|
|
27
|
+
}
|
|
29
28
|
},
|
|
29
|
+
"files": ["dist", "src"],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsup",
|
|
32
32
|
"dev": "tsup --watch",
|
|
33
|
-
"
|
|
34
|
-
},
|
|
35
|
-
"keywords": [
|
|
36
|
-
"nexus",
|
|
37
|
-
"react",
|
|
38
|
-
"components"
|
|
39
|
-
],
|
|
40
|
-
"author": "",
|
|
41
|
-
"license": "ISC",
|
|
42
|
-
"publishConfig": {
|
|
43
|
-
"access": "public",
|
|
44
|
-
"registry": "https://registry.npmjs.org/"
|
|
45
|
-
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"dotenv": "^17.4.2"
|
|
33
|
+
"typecheck": "tsc --noEmit"
|
|
48
34
|
},
|
|
49
35
|
"peerDependencies": {
|
|
50
|
-
"next": "
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
36
|
+
"next": "^16.2.6",
|
|
37
|
+
"react": "^19.2.6",
|
|
38
|
+
"react-dom": "^19.2.6"
|
|
53
39
|
},
|
|
54
40
|
"devDependencies": {
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"@types/react": "^19",
|
|
57
|
-
"@types/react-dom": "^19",
|
|
41
|
+
"@types/node": "^24.12.4",
|
|
42
|
+
"@types/react": "^19.2.15",
|
|
43
|
+
"@types/react-dom": "^19.2.3",
|
|
58
44
|
"next": "^16.2.6",
|
|
59
45
|
"react": "^19.2.6",
|
|
60
46
|
"react-dom": "^19.2.6",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
47
|
+
"server-only": "^0.0.1",
|
|
48
|
+
"tsup": "^8.5.0",
|
|
49
|
+
"typescript": "^5.9.2"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "24.15.0"
|
|
63
53
|
}
|
|
64
54
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NexusSelectableList } from "./nexus-selectable-list";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
.nexus-selectable-list {
|
|
2
|
+
--nexus-select-bg: #12101a;
|
|
3
|
+
--nexus-select-surface: #1e1b28;
|
|
4
|
+
--nexus-select-border: #3d3654;
|
|
5
|
+
--nexus-select-accent: #a855f7;
|
|
6
|
+
--nexus-select-accent-dim: rgba(168, 85, 247, 0.15);
|
|
7
|
+
--nexus-select-text: #f4f0fa;
|
|
8
|
+
--nexus-select-muted: #9d94b0;
|
|
9
|
+
|
|
10
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
11
|
+
background: var(--nexus-select-bg);
|
|
12
|
+
border: 1px solid var(--nexus-select-border);
|
|
13
|
+
border-radius: 12px;
|
|
14
|
+
padding: 1.25rem 1.5rem;
|
|
15
|
+
color: var(--nexus-select-text);
|
|
16
|
+
max-width: 32rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nexus-selectable-list__header {
|
|
20
|
+
margin-bottom: 1rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.nexus-selectable-list__title {
|
|
24
|
+
margin: 0 0 0.75rem;
|
|
25
|
+
font-size: 1.125rem;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
letter-spacing: -0.02em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nexus-selectable-list__search {
|
|
31
|
+
width: 100%;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
padding: 0.625rem 0.875rem;
|
|
34
|
+
font-size: 0.875rem;
|
|
35
|
+
color: var(--nexus-select-text);
|
|
36
|
+
background: var(--nexus-select-surface);
|
|
37
|
+
border: 1px solid var(--nexus-select-border);
|
|
38
|
+
border-radius: 8px;
|
|
39
|
+
outline: none;
|
|
40
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nexus-selectable-list__search::placeholder {
|
|
44
|
+
color: var(--nexus-select-muted);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.nexus-selectable-list__search:focus {
|
|
48
|
+
border-color: var(--nexus-select-accent);
|
|
49
|
+
box-shadow: 0 0 0 3px var(--nexus-select-accent-dim);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.nexus-selectable-list__meta {
|
|
53
|
+
margin: 0.5rem 0 0;
|
|
54
|
+
font-size: 0.75rem;
|
|
55
|
+
color: var(--nexus-select-muted);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nexus-selectable-list__list {
|
|
59
|
+
list-style: none;
|
|
60
|
+
margin: 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: 0.375rem;
|
|
65
|
+
max-height: 16rem;
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.nexus-selectable-list__item {
|
|
70
|
+
display: block;
|
|
71
|
+
width: 100%;
|
|
72
|
+
text-align: left;
|
|
73
|
+
padding: 0.75rem 1rem;
|
|
74
|
+
font: inherit;
|
|
75
|
+
color: inherit;
|
|
76
|
+
background: var(--nexus-select-surface);
|
|
77
|
+
border: 1px solid transparent;
|
|
78
|
+
border-radius: 8px;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
transition:
|
|
81
|
+
background 0.15s ease,
|
|
82
|
+
border-color 0.15s ease;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nexus-selectable-list__item:hover {
|
|
86
|
+
border-color: var(--nexus-select-border);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nexus-selectable-list__item--selected {
|
|
90
|
+
background: var(--nexus-select-accent-dim);
|
|
91
|
+
border-color: var(--nexus-select-accent);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.nexus-selectable-list__label {
|
|
95
|
+
display: block;
|
|
96
|
+
font-size: 0.9375rem;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.nexus-selectable-list__description {
|
|
101
|
+
display: block;
|
|
102
|
+
margin-top: 0.2rem;
|
|
103
|
+
font-size: 0.8125rem;
|
|
104
|
+
color: var(--nexus-select-muted);
|
|
105
|
+
line-height: 1.35;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.nexus-selectable-list__empty {
|
|
109
|
+
margin: 0;
|
|
110
|
+
padding: 1.25rem;
|
|
111
|
+
text-align: center;
|
|
112
|
+
font-size: 0.875rem;
|
|
113
|
+
color: var(--nexus-select-muted);
|
|
114
|
+
background: var(--nexus-select-surface);
|
|
115
|
+
border-radius: 8px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.nexus-selectable-list__detail {
|
|
119
|
+
margin-top: 1rem;
|
|
120
|
+
padding: 0.875rem 1rem;
|
|
121
|
+
background: var(--nexus-select-surface);
|
|
122
|
+
border-left: 3px solid var(--nexus-select-accent);
|
|
123
|
+
border-radius: 0 8px 8px 0;
|
|
124
|
+
font-size: 0.8125rem;
|
|
125
|
+
line-height: 1.5;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nexus-selectable-list__detail strong {
|
|
129
|
+
color: var(--nexus-select-accent);
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import type { NexusSelectableListProps } from "../interfaces/nexus-list";
|
|
5
|
+
import "./nexus-selectable-list.css";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Client component — filterable list with selection and detail preview.
|
|
9
|
+
*/
|
|
10
|
+
export function NexusSelectableList({
|
|
11
|
+
title,
|
|
12
|
+
items,
|
|
13
|
+
placeholder = "Filter items…",
|
|
14
|
+
emptyMessage = "No matching items.",
|
|
15
|
+
className,
|
|
16
|
+
}: NexusSelectableListProps) {
|
|
17
|
+
const [query, setQuery] = useState("");
|
|
18
|
+
const [selectedId, setSelectedId] = useState<string | null>(
|
|
19
|
+
items[0]?.id ?? null,
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const filtered = useMemo(() => {
|
|
23
|
+
const q = query.trim().toLowerCase();
|
|
24
|
+
if (!q) return items;
|
|
25
|
+
return items.filter(
|
|
26
|
+
(item) =>
|
|
27
|
+
item.label.toLowerCase().includes(q) ||
|
|
28
|
+
item.description?.toLowerCase().includes(q),
|
|
29
|
+
);
|
|
30
|
+
}, [items, query]);
|
|
31
|
+
|
|
32
|
+
const selected = items.find((item) => item.id === selectedId) ?? null;
|
|
33
|
+
const rootClass = className
|
|
34
|
+
? `nexus-selectable-list ${className}`
|
|
35
|
+
: "nexus-selectable-list";
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<section
|
|
39
|
+
className={rootClass}
|
|
40
|
+
aria-labelledby="nexus-selectable-list-title"
|
|
41
|
+
>
|
|
42
|
+
<div className="nexus-selectable-list__header">
|
|
43
|
+
<h2 id="nexus-selectable-list-title" className="nexus-selectable-list__title">
|
|
44
|
+
{title}
|
|
45
|
+
</h2>
|
|
46
|
+
<input
|
|
47
|
+
type="search"
|
|
48
|
+
className="nexus-selectable-list__search"
|
|
49
|
+
placeholder={placeholder}
|
|
50
|
+
value={query}
|
|
51
|
+
onChange={(e) => setQuery(e.target.value)}
|
|
52
|
+
aria-label={`Filter ${title}`}
|
|
53
|
+
/>
|
|
54
|
+
<p className="nexus-selectable-list__meta">
|
|
55
|
+
Showing {filtered.length} of {items.length}
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
{filtered.length === 0 ? (
|
|
60
|
+
<p className="nexus-selectable-list__empty">{emptyMessage}</p>
|
|
61
|
+
) : (
|
|
62
|
+
<ul
|
|
63
|
+
className="nexus-selectable-list__list"
|
|
64
|
+
role="listbox"
|
|
65
|
+
aria-label={title}
|
|
66
|
+
>
|
|
67
|
+
{filtered.map((item) => {
|
|
68
|
+
const isSelected = item.id === selectedId;
|
|
69
|
+
const itemClass = isSelected
|
|
70
|
+
? "nexus-selectable-list__item nexus-selectable-list__item--selected"
|
|
71
|
+
: "nexus-selectable-list__item";
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<li key={item.id} role="presentation">
|
|
75
|
+
<button
|
|
76
|
+
type="button"
|
|
77
|
+
role="option"
|
|
78
|
+
aria-selected={isSelected}
|
|
79
|
+
className={itemClass}
|
|
80
|
+
onClick={() => setSelectedId(item.id)}
|
|
81
|
+
>
|
|
82
|
+
<span className="nexus-selectable-list__label">
|
|
83
|
+
{item.label}
|
|
84
|
+
</span>
|
|
85
|
+
{item.description ? (
|
|
86
|
+
<span className="nexus-selectable-list__description">
|
|
87
|
+
{item.description}
|
|
88
|
+
</span>
|
|
89
|
+
) : null}
|
|
90
|
+
</button>
|
|
91
|
+
</li>
|
|
92
|
+
);
|
|
93
|
+
})}
|
|
94
|
+
</ul>
|
|
95
|
+
)}
|
|
96
|
+
|
|
97
|
+
{selected ? (
|
|
98
|
+
<div className="nexus-selectable-list__detail">
|
|
99
|
+
<strong>{selected.label}</strong>
|
|
100
|
+
{selected.description ? <> — {selected.description}</> : null}
|
|
101
|
+
{selected.value !== undefined && selected.value !== null ? (
|
|
102
|
+
<>
|
|
103
|
+
<br />
|
|
104
|
+
Value: <strong>{selected.value}</strong>
|
|
105
|
+
</>
|
|
106
|
+
) : null}
|
|
107
|
+
</div>
|
|
108
|
+
) : null}
|
|
109
|
+
</section>
|
|
110
|
+
);
|
|
111
|
+
}
|
package/src/client.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified entry — re-exports interface, server, and client modules.
|
|
3
|
+
*
|
|
4
|
+
* Prefer subpath imports in client-only code:
|
|
5
|
+
* - `@nexus/core/interface`
|
|
6
|
+
* - `@nexus/core/server`
|
|
7
|
+
* - `@nexus/core/client`
|
|
8
|
+
*/
|
|
9
|
+
export * from "./interface";
|
|
10
|
+
export * from "./server";
|
|
11
|
+
export * from "./client";
|
package/src/interface.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Single row/item used by Nexus list components */
|
|
2
|
+
export interface NexusListItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Props for the server-rendered stat list */
|
|
10
|
+
export interface NexusStatListProps {
|
|
11
|
+
title: string;
|
|
12
|
+
items: NexusListItem[];
|
|
13
|
+
emptyMessage?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Props for the client-side selectable & filterable list */
|
|
18
|
+
export interface NexusSelectableListProps {
|
|
19
|
+
title: string;
|
|
20
|
+
items: NexusListItem[];
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
emptyMessage?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NexusStatList } from "./nexus-stat-list";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.nexus-stat-list {
|
|
2
|
+
--nexus-stat-bg: #0f1419;
|
|
3
|
+
--nexus-stat-surface: #1a2332;
|
|
4
|
+
--nexus-stat-border: #2d3a4f;
|
|
5
|
+
--nexus-stat-accent: #3b82f6;
|
|
6
|
+
--nexus-stat-text: #e8edf4;
|
|
7
|
+
--nexus-stat-muted: #8b9cb3;
|
|
8
|
+
|
|
9
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
10
|
+
background: var(--nexus-stat-bg);
|
|
11
|
+
border: 1px solid var(--nexus-stat-border);
|
|
12
|
+
border-radius: 12px;
|
|
13
|
+
padding: 1.25rem 1.5rem;
|
|
14
|
+
color: var(--nexus-stat-text);
|
|
15
|
+
max-width: 28rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nexus-stat-list__title {
|
|
19
|
+
margin: 0 0 1rem;
|
|
20
|
+
font-size: 1.125rem;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
letter-spacing: -0.02em;
|
|
23
|
+
color: var(--nexus-stat-text);
|
|
24
|
+
border-bottom: 2px solid var(--nexus-stat-accent);
|
|
25
|
+
padding-bottom: 0.5rem;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.nexus-stat-list__list {
|
|
30
|
+
list-style: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
gap: 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.nexus-stat-list__item {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
gap: 1rem;
|
|
43
|
+
padding: 0.75rem 1rem;
|
|
44
|
+
background: var(--nexus-stat-surface);
|
|
45
|
+
border-radius: 8px;
|
|
46
|
+
border: 1px solid transparent;
|
|
47
|
+
transition: border-color 0.15s ease;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nexus-stat-list__item:hover {
|
|
51
|
+
border-color: var(--nexus-stat-border);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nexus-stat-list__label-group {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 0.15rem;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nexus-stat-list__label {
|
|
62
|
+
font-size: 0.9375rem;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
color: var(--nexus-stat-text);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.nexus-stat-list__description {
|
|
68
|
+
font-size: 0.8125rem;
|
|
69
|
+
color: var(--nexus-stat-muted);
|
|
70
|
+
line-height: 1.35;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.nexus-stat-list__value {
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
font-size: 0.875rem;
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
color: var(--nexus-stat-accent);
|
|
78
|
+
background: rgba(59, 130, 246, 0.12);
|
|
79
|
+
padding: 0.25rem 0.625rem;
|
|
80
|
+
border-radius: 6px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.nexus-stat-list__empty {
|
|
84
|
+
margin: 0;
|
|
85
|
+
padding: 1.5rem;
|
|
86
|
+
text-align: center;
|
|
87
|
+
font-size: 0.875rem;
|
|
88
|
+
color: var(--nexus-stat-muted);
|
|
89
|
+
background: var(--nexus-stat-surface);
|
|
90
|
+
border-radius: 8px;
|
|
91
|
+
border: 1px dashed var(--nexus-stat-border);
|
|
92
|
+
}
|