nexus-shared 1.1.5 → 1.1.6
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/package.json +8 -4
- package/src/api-services/preference-service.tsx +5 -0
- package/src/api-services/system-service.tsx +322 -0
- package/src/components/documents/button.tsx +136 -0
- package/src/components/documents/icon-box.tsx +92 -0
- package/src/components/documents/page-title.tsx +7 -0
- package/src/components/documents/tab-button.tsx +169 -0
- package/src/components/index.js +0 -0
- package/src/components/inputs/checkbox-input.tsx +66 -0
- package/src/components/inputs/input-box.tsx +45 -0
- package/src/components/inputs/input-element.tsx +65 -0
- package/src/components/inputs/input-form.tsx +50 -0
- package/src/components/inputs/input.tsx +181 -0
- package/src/components/inputs/number-input.tsx +108 -0
- package/src/components/inputs/radiobox-input.tsx +53 -0
- package/src/components/inputs/textarea-input.tsx +47 -0
- package/src/components/inputs/textbox-input.tsx +45 -0
- package/src/components/layouts/global-dialogbox.tsx +433 -0
- package/src/components/layouts/global-layout.tsx +63 -0
- package/src/components/layouts/layout-helpers.tsx +23 -0
- package/src/components/layouts/utility-menu.tsx +71 -0
- package/src/components/panels/theme-panel.tsx +44 -0
- package/src/helpers/bitwise-helpers.tsx +11 -0
- package/src/helpers/browser-helpers.tsx +73 -0
- package/src/helpers/datasource-helpers.tsx +99 -0
- package/src/helpers/element-helpers.tsx +57 -0
- package/src/helpers/input-helpers.tsx +24 -0
- package/src/helpers/string-helpers.tsx +28 -0
- package/src/helpers/utility-helpers.tsx +44 -0
- package/src/index.ts +0 -11
- package/src/interfaces/browser-interfaces.tsx +23 -0
- package/src/interfaces/button-interfaces.tsx +63 -0
- package/src/interfaces/datasource-interfaces.tsx +22 -0
- package/src/interfaces/datatable-interfaces.tsx +25 -0
- package/src/interfaces/dialogbox-interfaces.tsx +5 -0
- package/src/interfaces/http-interfaces.tsx +15 -0
- package/src/interfaces/icon-interfaces.tsx +126 -0
- package/src/interfaces/input-interfaces.tsx +360 -0
- package/src/interfaces/layout-interfaces.tsx +191 -0
- package/src/interfaces/menu-interfaces.tsx +36 -0
- package/src/interfaces/permission-interfaces.tsx +9 -0
- package/src/interfaces/storage-interfaces.tsx +3 -0
- package/src/interfaces/system-interfaces.tsx +22 -0
- package/src/interfaces/theme-interfaces.tsx +209 -0
- package/src/interfaces/type-interfaces.tsx +22 -0
- package/src/nexus-client.tsx +23 -0
- package/src/nexus.environments.tsx +34 -0
- package/src/services/loader-service.tsx +168 -0
- package/src/services/localstorage-service.tsx +45 -0
- package/src/services/theme-service.tsx +149 -0
- package/src/styles/nexus.animation.css +269 -0
- package/src/styles/nexus.core.css +119 -0
- package/src/styles/nexus.dialog.css +141 -0
- package/src/styles/nexus.icon.css +50 -0
- package/src/styles/nexus.input.css +207 -0
- package/src/styles/nexus.loader.css +11 -0
- package/src/styles/nexus.logic.css +18 -0
- package/src/styles/nexus.utility.css +347 -0
- package/src/client/index.ts +0 -1
- package/src/client/nexus-selectable-list.css +0 -131
- package/src/client/nexus-selectable-list.tsx +0 -111
- package/src/client.ts +0 -7
- package/src/interface.ts +0 -5
- package/src/interfaces/index.ts +0 -6
- package/src/interfaces/nexus-base.ts +0 -5
- package/src/interfaces/nexus-list.ts +0 -24
- package/src/server/index.ts +0 -1
- package/src/server/nexus-stat-list.css +0 -92
- package/src/server/nexus-stat-list.tsx +0 -46
- package/src/server.ts +0 -7
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/* scrollbar */
|
|
2
|
+
.sb,
|
|
3
|
+
.sbh,
|
|
4
|
+
textarea {
|
|
5
|
+
overflow: auto;
|
|
6
|
+
scrollbar-width: thin;
|
|
7
|
+
scrollbar-color: var(--B30) var(--B2);
|
|
8
|
+
}
|
|
9
|
+
.sbh {
|
|
10
|
+
scrollbar-width: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.sb::-webkit-scrollbar {
|
|
14
|
+
width: var(--SLBW);
|
|
15
|
+
height: var(--SLBW);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Thinner scrollbar: textareas + .sb.sm (Firefox: thin is the minimum) */
|
|
19
|
+
.sb.sm,
|
|
20
|
+
textarea {
|
|
21
|
+
scrollbar-width: thin;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.sb.sm::-webkit-scrollbar-thumb,
|
|
25
|
+
textarea::-webkit-scrollbar-thumb {
|
|
26
|
+
border-width: 0.08rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sb::-webkit-scrollbar-track,
|
|
30
|
+
textarea::-webkit-scrollbar-track {
|
|
31
|
+
background: var(--B3);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.sb::-webkit-scrollbar-thumb,
|
|
35
|
+
textarea::-webkit-scrollbar-thumb {
|
|
36
|
+
background-color: var(--B30);
|
|
37
|
+
border-radius: var(--BR2);
|
|
38
|
+
border: 0.12rem solid var(--B3);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sb::-webkit-scrollbar-thumb:hover,
|
|
42
|
+
textarea::-webkit-scrollbar-thumb:hover {
|
|
43
|
+
background-color: var(--B40);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sb::-webkit-scrollbar-button,
|
|
47
|
+
textarea::-webkit-scrollbar-button {
|
|
48
|
+
background-color: var(--B3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sb::-webkit-scrollbar-button:hover,
|
|
52
|
+
textarea::-webkit-scrollbar-button:hover {
|
|
53
|
+
background-color: var(--B3);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sb::-webkit-scrollbar-corner,
|
|
57
|
+
textarea::-webkit-scrollbar-corner {
|
|
58
|
+
background: var(--B3);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.sbh::-webkit-scrollbar {
|
|
62
|
+
width: 0;
|
|
63
|
+
height: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.usn,
|
|
67
|
+
body {
|
|
68
|
+
user-select: none !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.usa {
|
|
72
|
+
user-select: all !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.en {
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.no-drag {
|
|
80
|
+
user-select: none;
|
|
81
|
+
/* Prevent text selection */
|
|
82
|
+
-webkit-user-drag: none;
|
|
83
|
+
/* Prevent dragging in WebKit browsers */
|
|
84
|
+
pointer-events: auto;
|
|
85
|
+
/* Still clickable */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Pointer events all */
|
|
89
|
+
.ea {
|
|
90
|
+
pointer-events: all;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Disabled */
|
|
94
|
+
.d {
|
|
95
|
+
pointer-events: none;
|
|
96
|
+
cursor: not-allowed;
|
|
97
|
+
opacity: 0.7;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.db {
|
|
101
|
+
display: block;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.dn {
|
|
105
|
+
display: none !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.vv {
|
|
109
|
+
visibility: visible;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.vh {
|
|
113
|
+
visibility: hidden;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.dif {
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.df {
|
|
121
|
+
display: flex;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.ddc {
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fg {
|
|
129
|
+
flex-grow: 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.fw {
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ac {
|
|
137
|
+
align-items: center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.acc {
|
|
141
|
+
align-content: center;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.jc {
|
|
145
|
+
justify-content: center;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.ae {
|
|
149
|
+
align-items: flex-end;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.jr {
|
|
153
|
+
justify-content: right;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.jl {
|
|
157
|
+
justify-content: left;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.sn {
|
|
161
|
+
outline: none;
|
|
162
|
+
border: none;
|
|
163
|
+
background-color: unset;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.o0 {
|
|
167
|
+
opacity: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.o1 {
|
|
171
|
+
opacity: 1;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.oh {
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.bb {
|
|
179
|
+
box-sizing: border-box;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.w100 {
|
|
183
|
+
width: 100%;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.h100 {
|
|
187
|
+
height: 100%;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ps {
|
|
191
|
+
position: sticky;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.pa {
|
|
195
|
+
position: absolute;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.pf {
|
|
199
|
+
position: fixed;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.pr {
|
|
203
|
+
position: relative;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.ty50 {
|
|
207
|
+
transform: translateY(-50%);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.tx50 {
|
|
211
|
+
transform: translateX(-50%);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.txy50 {
|
|
215
|
+
transform: translate(-50%, -50%);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.t50 {
|
|
219
|
+
top: 50%;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.l50 {
|
|
223
|
+
left: 50%;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.left {
|
|
227
|
+
left: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.right {
|
|
231
|
+
right: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.top {
|
|
235
|
+
top: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.bottom {
|
|
239
|
+
bottom: 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.r {
|
|
243
|
+
border-radius: var(--BR1);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.r2 {
|
|
247
|
+
border-radius: var(--BR2);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.rr {
|
|
251
|
+
border-radius: 50%;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.anim,
|
|
255
|
+
.h {
|
|
256
|
+
transition: var(--ANIM);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.no-anim {
|
|
260
|
+
transition: none !important;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.h,
|
|
264
|
+
.hc {
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.rs {
|
|
269
|
+
resize: both !important;
|
|
270
|
+
position: relative;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.cur-move {
|
|
274
|
+
cursor: move !important;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.nw {
|
|
278
|
+
white-space: nowrap;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.toh {
|
|
282
|
+
white-space: nowrap !important;
|
|
283
|
+
overflow: hidden !important;
|
|
284
|
+
text-overflow: ellipsis !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.tl {
|
|
288
|
+
text-align: left !important;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.tr {
|
|
292
|
+
text-align: right !important;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.tj {
|
|
296
|
+
text-align: justify !important;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.tc {
|
|
300
|
+
text-align: center !important;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
del {
|
|
304
|
+
position: relative;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.l-bb {
|
|
308
|
+
text-decoration: underline;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
del:after {
|
|
312
|
+
content: "";
|
|
313
|
+
width: 100%;
|
|
314
|
+
top: 50%;
|
|
315
|
+
left: 0;
|
|
316
|
+
border-bottom: 0.15rem solid red;
|
|
317
|
+
position: absolute;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.u {
|
|
321
|
+
text-decoration: underline;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.ma {
|
|
325
|
+
margin: auto;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.mw {
|
|
329
|
+
width: var(--MW);
|
|
330
|
+
max-width: var(--MW);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@media (max-width: 1150px) {
|
|
334
|
+
:root {
|
|
335
|
+
--MW: 95vw;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
@media (max-width: 950px) {
|
|
340
|
+
:root {
|
|
341
|
+
--MW: 98vw;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.client-menu .utilities {
|
|
345
|
+
width: 100% !important;
|
|
346
|
+
}
|
|
347
|
+
}
|
package/src/client/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NexusSelectableList } from "./nexus-selectable-list";
|
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
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
DELETED
package/src/interface.ts
DELETED
package/src/interfaces/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
package/src/server/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NexusStatList } from "./nexus-stat-list";
|