@knymbus/voxel-ui 1.0.13 → 1.0.15
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/assets/voxel-ui.css +3 -0
- package/dist/chunks/{search-BCvuXqOX.js → search-COxH7vvi.js} +92 -71
- package/dist/components/search/SearchInput.d.ts +1 -1
- package/dist/components/search/index.js +1 -1
- package/dist/components/search/types.d.ts +6 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/search/SearchInput.stories.tsx +4 -4
- package/src/components/search/SearchInput.tsx +52 -20
- package/src/components/search/types.ts +9 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer theme{:root,:host{--voxel-font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--voxel-font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--voxel-default-font-family:var(--voxel-font-sans);--voxel-default-mono-font-family:var(--voxel-font-mono)}}@layer base{@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--voxel-default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--voxel-default-font-feature-settings,normal);font-variation-settings:var(--voxel-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--voxel-default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--voxel-default-mono-font-feature-settings,normal);font-variation-settings:var(--voxel-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}.dark{--color-vsc-bg:#1e1e1e;--color-vsc-sidebar:#252526;--color-vsc-border:#3c3c3c;--color-vsc-accent:#007acc;--color-vsc-accent-hover:#0062a3;--color-vsc-hover:#2a2d2e;--color-vsc-text:#ccc;--color-vsc-muted:#8b949e;--color-vsc-bg-input:#1f1f1f}}@layer components,utilities;
|
|
3
|
+
/*$vite$:1*/
|
|
@@ -15,6 +15,10 @@ var s = {
|
|
|
15
15
|
hoverBg: "var(--color-vsc-hover, #e8e8e8)",
|
|
16
16
|
accentBgLight: "rgba(0, 122, 204, 0.1)"
|
|
17
17
|
},
|
|
18
|
+
typography: {
|
|
19
|
+
sans: "var(--font-sans, font-sans, ui-sans-serif, system-ui, sans-serif)",
|
|
20
|
+
mono: "var(--font-mono, font-mono, ui-monospace, SFMono-Regular, monospace)"
|
|
21
|
+
},
|
|
18
22
|
transitions: { smooth: "all 200ms cubic-bezier(0.34, 1.56, 0.64, 1)" }
|
|
19
23
|
}, c = e();
|
|
20
24
|
function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreClick: i, onCloseMenu: a }) {
|
|
@@ -139,37 +143,37 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
|
|
|
139
143
|
}
|
|
140
144
|
//#endregion
|
|
141
145
|
//#region src/components/search/SearchInput.tsx
|
|
142
|
-
function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placeholder: p = "Search manifests or tracking codes...", resultsCount: m = 0, menuResults: h = [], onResultClick: g, onViewMoreClick: _, className: v = "", showFloatPeek: y = !1 }) {
|
|
143
|
-
let [
|
|
146
|
+
function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placeholder: p = "Search manifests or tracking codes...", resultsCount: m = 0, menuResults: h = [], onResultClick: g, onViewMoreClick: _, className: v = "", showFloatPeek: y = !1, peekContent: b }) {
|
|
147
|
+
let [x, S] = o(!1), [C, w] = o(!1), [T, E] = o(!1), [D, O] = o(!1), k = a(null), A = a(null);
|
|
144
148
|
i(() => {
|
|
145
149
|
let t = (t) => {
|
|
146
|
-
|
|
150
|
+
k.current && !k.current.contains(t.target) && (w(!1), e === "float" && u === "" && S(!1));
|
|
147
151
|
};
|
|
148
152
|
return window.addEventListener("mousedown", t), () => window.removeEventListener("mousedown", t);
|
|
149
153
|
}, [e, u]);
|
|
150
|
-
let
|
|
151
|
-
e.stopPropagation(), d(""), f && f(),
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
154
|
+
let j = (e) => {
|
|
155
|
+
e.stopPropagation(), d(""), f && f(), A.current && A.current.focus();
|
|
156
|
+
}, M = () => {
|
|
157
|
+
S(!0), setTimeout(() => A.current?.focus(), 50);
|
|
158
|
+
}, N = {
|
|
155
159
|
position: "relative",
|
|
156
160
|
display: "flex",
|
|
157
161
|
flexDirection: "column",
|
|
158
|
-
fontFamily:
|
|
162
|
+
fontFamily: s.typography.sans,
|
|
159
163
|
fontSize: "12px",
|
|
160
164
|
userSelect: "none",
|
|
161
165
|
boxSizing: "border-box"
|
|
162
|
-
},
|
|
166
|
+
}, P = {
|
|
163
167
|
position: "relative",
|
|
164
168
|
display: "flex",
|
|
165
169
|
alignItems: "center",
|
|
166
170
|
backgroundColor: s.colors.bgInput,
|
|
167
|
-
border: `1px solid ${
|
|
168
|
-
borderRadius: "
|
|
171
|
+
border: `1px solid ${D || e === "float" && x ? s.colors.borderAccent : T ? s.colors.borderAccentHover : s.colors.border}`,
|
|
172
|
+
borderRadius: "6px",
|
|
169
173
|
height: "32px",
|
|
170
174
|
transition: s.transitions.smooth,
|
|
171
175
|
boxSizing: "border-box"
|
|
172
|
-
},
|
|
176
|
+
}, F = {
|
|
173
177
|
width: "100%",
|
|
174
178
|
height: "100%",
|
|
175
179
|
backgroundColor: "transparent",
|
|
@@ -178,17 +182,18 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
178
182
|
outline: "none",
|
|
179
183
|
padding: "0 32px",
|
|
180
184
|
fontSize: "12px",
|
|
185
|
+
fontFamily: s.typography.sans,
|
|
181
186
|
boxSizing: "border-box"
|
|
182
187
|
};
|
|
183
188
|
if (e === "simple") {
|
|
184
|
-
let e =
|
|
189
|
+
let e = u.length > 0, i = m > 0;
|
|
185
190
|
return /* @__PURE__ */ (0, c.jsxs)("div", {
|
|
186
|
-
style:
|
|
191
|
+
style: N,
|
|
187
192
|
className: v,
|
|
188
193
|
children: [/* @__PURE__ */ (0, c.jsxs)("div", {
|
|
189
|
-
style:
|
|
190
|
-
onMouseEnter: () =>
|
|
191
|
-
onMouseLeave: () =>
|
|
194
|
+
style: P,
|
|
195
|
+
onMouseEnter: () => E(!0),
|
|
196
|
+
onMouseLeave: () => E(!1),
|
|
192
197
|
children: [
|
|
193
198
|
/* @__PURE__ */ (0, c.jsx)("div", {
|
|
194
199
|
style: {
|
|
@@ -196,19 +201,19 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
196
201
|
left: "10px",
|
|
197
202
|
display: "flex",
|
|
198
203
|
alignItems: "center",
|
|
199
|
-
color:
|
|
204
|
+
color: T ? s.colors.text : s.colors.muted
|
|
200
205
|
},
|
|
201
206
|
children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
|
|
202
207
|
}),
|
|
203
208
|
/* @__PURE__ */ (0, c.jsx)("input", {
|
|
204
|
-
ref:
|
|
209
|
+
ref: A,
|
|
205
210
|
type: "text",
|
|
206
211
|
value: u,
|
|
207
212
|
onChange: (e) => d(e.target.value),
|
|
208
|
-
onFocus: () =>
|
|
209
|
-
onBlur: () =>
|
|
213
|
+
onFocus: () => O(!0),
|
|
214
|
+
onBlur: () => O(!1),
|
|
210
215
|
placeholder: p,
|
|
211
|
-
style:
|
|
216
|
+
style: F
|
|
212
217
|
}),
|
|
213
218
|
u && /* @__PURE__ */ (0, c.jsx)("div", {
|
|
214
219
|
style: {
|
|
@@ -223,7 +228,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
223
228
|
icon: n,
|
|
224
229
|
color: "ghost",
|
|
225
230
|
iconOnly: !0,
|
|
226
|
-
onClick:
|
|
231
|
+
onClick: j,
|
|
227
232
|
size: "xs"
|
|
228
233
|
})
|
|
229
234
|
})
|
|
@@ -235,27 +240,26 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
235
240
|
right: 0,
|
|
236
241
|
top: "32px",
|
|
237
242
|
zIndex: 10,
|
|
238
|
-
overflow: "hidden",
|
|
239
243
|
transition: s.transitions.smooth,
|
|
240
|
-
height: e ? "
|
|
241
|
-
opacity:
|
|
242
|
-
transform: e ? "translateY(0px)" : "translateY(-4px)",
|
|
244
|
+
height: i || e ? "auto" : "0px",
|
|
245
|
+
opacity: i || e ? 1 : 0,
|
|
246
|
+
transform: i || e ? "translateY(0px)" : "translateY(-4px)",
|
|
243
247
|
pointerEvents: "none"
|
|
244
248
|
},
|
|
245
249
|
children: /* @__PURE__ */ (0, c.jsx)("div", {
|
|
246
250
|
style: {
|
|
247
251
|
backgroundColor: s.colors.sidebarBg,
|
|
248
|
-
border: `
|
|
252
|
+
border: `0px solid ${s.colors.border}`,
|
|
249
253
|
borderTop: "none",
|
|
250
254
|
padding: "4px 6px",
|
|
251
|
-
borderRadius: "0 0
|
|
255
|
+
borderRadius: "0 0 6px 6px",
|
|
252
256
|
boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
|
|
253
257
|
},
|
|
254
|
-
children: /* @__PURE__ */ (0, c.jsxs)("p", {
|
|
258
|
+
children: e && b ? b : e && !b && i ? /* @__PURE__ */ (0, c.jsxs)("p", {
|
|
255
259
|
style: {
|
|
256
260
|
margin: 0,
|
|
257
261
|
fontSize: "10px",
|
|
258
|
-
fontFamily:
|
|
262
|
+
fontFamily: s.typography.mono,
|
|
259
263
|
color: s.colors.muted,
|
|
260
264
|
whiteSpace: "nowrap",
|
|
261
265
|
overflow: "hidden",
|
|
@@ -272,22 +276,54 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
272
276
|
}),
|
|
273
277
|
" matching database metrics records"
|
|
274
278
|
]
|
|
275
|
-
})
|
|
279
|
+
}) : e && !b && !i ? /* @__PURE__ */ (0, c.jsxs)("p", {
|
|
280
|
+
style: {
|
|
281
|
+
margin: 0,
|
|
282
|
+
fontSize: "10px",
|
|
283
|
+
fontFamily: s.typography.mono,
|
|
284
|
+
color: s.colors.borderAccent,
|
|
285
|
+
whiteSpace: "nowrap",
|
|
286
|
+
overflow: "hidden",
|
|
287
|
+
textOverflow: "ellipsis"
|
|
288
|
+
},
|
|
289
|
+
children: ["No matching records found for your query: ", /* @__PURE__ */ (0, c.jsx)("span", {
|
|
290
|
+
style: {
|
|
291
|
+
color: s.colors.text,
|
|
292
|
+
fontWeight: "bold"
|
|
293
|
+
},
|
|
294
|
+
children: u
|
|
295
|
+
})]
|
|
296
|
+
}) : null
|
|
276
297
|
})
|
|
277
298
|
})]
|
|
278
299
|
});
|
|
279
300
|
}
|
|
280
301
|
if (e === "float") {
|
|
281
|
-
let e = y && m > 0 && u.length > 0, i =
|
|
302
|
+
let e = y && m > 0 && u.length > 0, i = x || u.length > 0, a = b || /* @__PURE__ */ (0, c.jsxs)("p", {
|
|
303
|
+
style: {
|
|
304
|
+
margin: 0,
|
|
305
|
+
fontSize: "9px",
|
|
306
|
+
fontFamily: s.typography.mono,
|
|
307
|
+
color: s.colors.borderAccent,
|
|
308
|
+
whiteSpace: "nowrap",
|
|
309
|
+
overflow: "hidden",
|
|
310
|
+
textOverflow: "ellipsis"
|
|
311
|
+
},
|
|
312
|
+
children: [
|
|
313
|
+
"Quick Peek: Found ",
|
|
314
|
+
m,
|
|
315
|
+
" rows"
|
|
316
|
+
]
|
|
317
|
+
});
|
|
282
318
|
return /* @__PURE__ */ (0, c.jsxs)("div", {
|
|
283
|
-
ref:
|
|
284
|
-
style:
|
|
319
|
+
ref: k,
|
|
320
|
+
style: N,
|
|
285
321
|
className: v,
|
|
286
322
|
children: [/* @__PURE__ */ (0, c.jsx)("div", {
|
|
287
|
-
onMouseEnter: () =>
|
|
288
|
-
onMouseLeave: () =>
|
|
323
|
+
onMouseEnter: () => E(!0),
|
|
324
|
+
onMouseLeave: () => E(!1),
|
|
289
325
|
style: {
|
|
290
|
-
...
|
|
326
|
+
...P,
|
|
291
327
|
width: i ? "256px" : "32px",
|
|
292
328
|
justifyContent: i ? "flex-start" : "center",
|
|
293
329
|
backgroundColor: i ? s.colors.bgInput : "transparent",
|
|
@@ -311,13 +347,13 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
311
347
|
}
|
|
312
348
|
}),
|
|
313
349
|
/* @__PURE__ */ (0, c.jsx)("input", {
|
|
314
|
-
ref:
|
|
350
|
+
ref: A,
|
|
315
351
|
type: "text",
|
|
316
352
|
value: u,
|
|
317
353
|
onChange: (e) => d(e.target.value),
|
|
318
354
|
placeholder: p,
|
|
319
355
|
style: {
|
|
320
|
-
...
|
|
356
|
+
...F,
|
|
321
357
|
padding: "0 24px 0 8px"
|
|
322
358
|
}
|
|
323
359
|
}),
|
|
@@ -334,7 +370,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
334
370
|
iconOnly: !0,
|
|
335
371
|
color: "ghost",
|
|
336
372
|
icon: n,
|
|
337
|
-
onClick:
|
|
373
|
+
onClick: j,
|
|
338
374
|
size: "xs"
|
|
339
375
|
})
|
|
340
376
|
})
|
|
@@ -343,7 +379,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
343
379
|
iconOnly: !0,
|
|
344
380
|
size: "sm",
|
|
345
381
|
icon: r,
|
|
346
|
-
onClick:
|
|
382
|
+
onClick: M,
|
|
347
383
|
color: "ghost",
|
|
348
384
|
style: { color: s.colors.muted },
|
|
349
385
|
title: "Open Expandable Search"
|
|
@@ -370,34 +406,19 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
370
406
|
borderRadius: "0 0 2px 2px",
|
|
371
407
|
boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
|
|
372
408
|
},
|
|
373
|
-
children:
|
|
374
|
-
style: {
|
|
375
|
-
margin: 0,
|
|
376
|
-
fontSize: "9px",
|
|
377
|
-
fontFamily: "monospace",
|
|
378
|
-
color: s.colors.borderAccent,
|
|
379
|
-
whiteSpace: "nowrap",
|
|
380
|
-
overflow: "hidden",
|
|
381
|
-
textOverflow: "ellipsis"
|
|
382
|
-
},
|
|
383
|
-
children: [
|
|
384
|
-
"Quick Peek: Found ",
|
|
385
|
-
m,
|
|
386
|
-
" rows"
|
|
387
|
-
]
|
|
388
|
-
})
|
|
409
|
+
children: a
|
|
389
410
|
})
|
|
390
411
|
})]
|
|
391
412
|
});
|
|
392
413
|
}
|
|
393
414
|
return /* @__PURE__ */ (0, c.jsxs)("div", {
|
|
394
|
-
ref:
|
|
395
|
-
style:
|
|
415
|
+
ref: k,
|
|
416
|
+
style: N,
|
|
396
417
|
className: v,
|
|
397
418
|
children: [/* @__PURE__ */ (0, c.jsxs)("div", {
|
|
398
|
-
style:
|
|
399
|
-
onMouseEnter: () =>
|
|
400
|
-
onMouseLeave: () =>
|
|
419
|
+
style: P,
|
|
420
|
+
onMouseEnter: () => E(!0),
|
|
421
|
+
onMouseLeave: () => E(!1),
|
|
401
422
|
children: [
|
|
402
423
|
/* @__PURE__ */ (0, c.jsx)("div", {
|
|
403
424
|
style: {
|
|
@@ -410,15 +431,15 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
410
431
|
children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
|
|
411
432
|
}),
|
|
412
433
|
/* @__PURE__ */ (0, c.jsx)("input", {
|
|
413
|
-
ref:
|
|
434
|
+
ref: A,
|
|
414
435
|
type: "text",
|
|
415
436
|
value: u,
|
|
416
437
|
onChange: (e) => {
|
|
417
|
-
d(e.target.value),
|
|
438
|
+
d(e.target.value), w(!0);
|
|
418
439
|
},
|
|
419
|
-
onFocus: () =>
|
|
440
|
+
onFocus: () => w(!0),
|
|
420
441
|
placeholder: p,
|
|
421
|
-
style:
|
|
442
|
+
style: F
|
|
422
443
|
}),
|
|
423
444
|
u && /* @__PURE__ */ (0, c.jsx)("div", {
|
|
424
445
|
style: {
|
|
@@ -433,18 +454,18 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
433
454
|
iconOnly: !0,
|
|
434
455
|
icon: n,
|
|
435
456
|
color: "ghost",
|
|
436
|
-
onClick:
|
|
457
|
+
onClick: j,
|
|
437
458
|
size: "xs"
|
|
438
459
|
})
|
|
439
460
|
})
|
|
440
461
|
]
|
|
441
462
|
}), /* @__PURE__ */ (0, c.jsx)(l, {
|
|
442
|
-
isOpen:
|
|
463
|
+
isOpen: C,
|
|
443
464
|
value: u,
|
|
444
465
|
menuResults: h,
|
|
445
466
|
onResultClick: g,
|
|
446
467
|
onViewMoreClick: _,
|
|
447
|
-
onCloseMenu: () =>
|
|
468
|
+
onCloseMenu: () => w(!1)
|
|
448
469
|
})]
|
|
449
470
|
});
|
|
450
471
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SearchInputProps } from './types';
|
|
3
|
-
export default function SearchInput({ variant, value, onChange, onClear, placeholder, resultsCount, menuResults, onResultClick, onViewMoreClick, className, showFloatPeek }: SearchInputProps): React.JSX.Element;
|
|
3
|
+
export default function SearchInput({ variant, value, onChange, onClear, placeholder, resultsCount, menuResults, onResultClick, onViewMoreClick, className, showFloatPeek, peekContent }: SearchInputProps): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/search-
|
|
1
|
+
import { n as e, t } from "../../chunks/search-COxH7vvi.js";
|
|
2
2
|
export { t as SearchInput, e as searchTokens };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
export type SearchVariant = 'simple' | 'float' | 'menu';
|
|
2
3
|
export interface SearchResultItem {
|
|
3
4
|
id: string;
|
|
@@ -17,6 +18,7 @@ export interface SearchInputProps {
|
|
|
17
18
|
onViewMoreClick?: () => void;
|
|
18
19
|
className?: string;
|
|
19
20
|
showFloatPeek?: boolean;
|
|
21
|
+
peekContent?: React.ReactNode;
|
|
20
22
|
}
|
|
21
23
|
export declare const searchTokens: {
|
|
22
24
|
colors: {
|
|
@@ -30,6 +32,10 @@ export declare const searchTokens: {
|
|
|
30
32
|
hoverBg: string;
|
|
31
33
|
accentBgLight: string;
|
|
32
34
|
};
|
|
35
|
+
typography: {
|
|
36
|
+
sans: string;
|
|
37
|
+
mono: string;
|
|
38
|
+
};
|
|
33
39
|
transitions: {
|
|
34
40
|
smooth: string;
|
|
35
41
|
};
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,5 @@ import { i as t, n, r, t as i } from "./chunks/tabs-MaVN00hJ.js";
|
|
|
3
3
|
import { t as a } from "./chunks/Button-BgQwvn3C.js";
|
|
4
4
|
import { n as o, t as s } from "./chunks/button-dHcpTNIG.js";
|
|
5
5
|
import { C as c, E as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, w as j, x as M, y as N } from "./chunks/icons-BpfDVwCQ.js";
|
|
6
|
-
import { n as P, t as F } from "./chunks/search-
|
|
6
|
+
import { n as P, t as F } from "./chunks/search-COxH7vvi.js";
|
|
7
7
|
export { A as Add, S as BlankDoc, a as Button, o as ButtonGroup, _ as Chat, N as ChevronDown, l as Close, x as Comment, k as DeleteChat, j as Document, v as Expand, c as Folder, C as Group, y as Minimize, f as Minus, w as More, D as OpenFolder, b as Person, g as PlusChat, h as PlusComment, T as PlusDoc, O as PlusDocBadge, E as PlusPerson, M as Refresh, e as ResizablePanel, u as Search, F as SearchInput, s as SplitActionButton, i as TabButton, n as TabPanel, r as TabPanelList, d as Terminal, m as Trash, p as Truck, P as searchTokens, t as useTab };
|
package/package.json
CHANGED
|
@@ -45,10 +45,10 @@ const MultiSearchWorkspace = () => {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<div
|
|
48
|
+
<div style={{ fontFamily: 'var(--font-sans)', minWidth: '450px', backgroundColor: 'var(--color-vsc-sidebar)', border: '1px solid var(--color-vsc-border)', borderRadius: '6px', padding: '32px' }}>
|
|
49
49
|
|
|
50
50
|
{/* 1. Simple Variant Bracket */}
|
|
51
|
-
<div className="space-y-1.5">
|
|
51
|
+
<div className="space-y-1.5" style={{ height: 'auto', width: '350px',}}>
|
|
52
52
|
<p className="text-[10px] font-bold text-vsc-muted uppercase tracking-wider">1. Simple Matrix Variant with Count Log</p>
|
|
53
53
|
<SearchInput
|
|
54
54
|
variant="simple"
|
|
@@ -56,7 +56,7 @@ const MultiSearchWorkspace = () => {
|
|
|
56
56
|
onChange={setSimpleQuery}
|
|
57
57
|
resultsCount={filteredSimpleResults.length}
|
|
58
58
|
placeholder="Type track ID to evaluate records count..."
|
|
59
|
-
|
|
59
|
+
// peekContent={<ResultPanel />}
|
|
60
60
|
/>
|
|
61
61
|
</div>
|
|
62
62
|
|
|
@@ -69,7 +69,7 @@ const MultiSearchWorkspace = () => {
|
|
|
69
69
|
onChange={setSimpleFloatQuery}
|
|
70
70
|
placeholder="Expandable terminal search..."
|
|
71
71
|
showFloatPeek
|
|
72
|
-
|
|
72
|
+
peekContent={<ResultPanel />}
|
|
73
73
|
/>
|
|
74
74
|
</div>
|
|
75
75
|
|
|
@@ -15,7 +15,8 @@ export default function SearchInput({
|
|
|
15
15
|
onResultClick,
|
|
16
16
|
onViewMoreClick,
|
|
17
17
|
className = '',
|
|
18
|
-
showFloatPeek = false
|
|
18
|
+
showFloatPeek = false,
|
|
19
|
+
peekContent
|
|
19
20
|
}: SearchInputProps) {
|
|
20
21
|
const [isExpanded, setIsExpanded] = useState<boolean>(false);
|
|
21
22
|
const [isMenuOpen, setIsMenuOpen] = useState<boolean>(false);
|
|
@@ -54,7 +55,7 @@ export default function SearchInput({
|
|
|
54
55
|
position: 'relative',
|
|
55
56
|
display: 'flex',
|
|
56
57
|
flexDirection: 'column',
|
|
57
|
-
fontFamily:
|
|
58
|
+
fontFamily: searchTokens.typography.sans, // ⚡ Applied global Tailwind fonts variables
|
|
58
59
|
fontSize: '12px',
|
|
59
60
|
userSelect: 'none',
|
|
60
61
|
boxSizing: 'border-box'
|
|
@@ -66,12 +67,12 @@ export default function SearchInput({
|
|
|
66
67
|
alignItems: 'center',
|
|
67
68
|
backgroundColor: searchTokens.colors.bgInput,
|
|
68
69
|
border: `1px solid ${isInputFocused || (variant === 'float' && isExpanded)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
? searchTokens.colors.borderAccent
|
|
71
|
+
: isInputHovered
|
|
72
|
+
? searchTokens.colors.borderAccentHover
|
|
73
|
+
: searchTokens.colors.border
|
|
73
74
|
}`,
|
|
74
|
-
borderRadius: '
|
|
75
|
+
borderRadius: '6px',
|
|
75
76
|
height: '32px',
|
|
76
77
|
transition: searchTokens.transitions.smooth,
|
|
77
78
|
boxSizing: 'border-box'
|
|
@@ -86,12 +87,41 @@ export default function SearchInput({
|
|
|
86
87
|
outline: 'none',
|
|
87
88
|
padding: '0 32px',
|
|
88
89
|
fontSize: '12px',
|
|
90
|
+
fontFamily: searchTokens.typography.sans,
|
|
89
91
|
boxSizing: 'border-box'
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
// --- 1. SIMPLE VARIANT ---
|
|
93
95
|
if (variant === 'simple') {
|
|
94
|
-
const
|
|
96
|
+
const hasQuery = value.length > 0;
|
|
97
|
+
const hasResults = resultsCount > 0;
|
|
98
|
+
|
|
99
|
+
// ⚡ Fallback logic: check if the dev supplied a custom peek content block component
|
|
100
|
+
const renderedPeek = () => {
|
|
101
|
+
|
|
102
|
+
if (hasQuery && peekContent) {
|
|
103
|
+
return peekContent;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (hasQuery && !peekContent && hasResults) {
|
|
107
|
+
return (
|
|
108
|
+
<p style={{ margin: 0, fontSize: '10px', fontFamily: searchTokens.typography.mono, color: searchTokens.colors.muted, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
109
|
+
Showing <span style={{ color: searchTokens.colors.borderAccent, fontWeight: 'bold' }}>{resultsCount}</span> matching database metrics records
|
|
110
|
+
</p>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (hasQuery && !peekContent && !hasResults) {
|
|
115
|
+
return (
|
|
116
|
+
<p style={{ margin: 0, fontSize: '10px', fontFamily: searchTokens.typography.mono, color: searchTokens.colors.borderAccent, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
117
|
+
No matching records found for your query: <span style={{ color: searchTokens.colors.text, fontWeight: 'bold' }}>{value}</span>
|
|
118
|
+
</p>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return null;
|
|
123
|
+
|
|
124
|
+
}
|
|
95
125
|
|
|
96
126
|
return (
|
|
97
127
|
<div style={baseWrapperStyles} className={className}>
|
|
@@ -127,18 +157,16 @@ export default function SearchInput({
|
|
|
127
157
|
right: 0,
|
|
128
158
|
top: '32px',
|
|
129
159
|
zIndex: 10,
|
|
130
|
-
overflow: 'hidden',
|
|
160
|
+
// overflow: 'hidden',
|
|
131
161
|
transition: searchTokens.transitions.smooth,
|
|
132
|
-
height: hasResults ? '
|
|
133
|
-
opacity: hasResults ? 1 : 0,
|
|
134
|
-
transform: hasResults ? 'translateY(0px)' : 'translateY(-4px)',
|
|
162
|
+
height: hasResults || hasQuery ? 'auto' : '0px',
|
|
163
|
+
opacity: hasResults || hasQuery ? 1 : 0,
|
|
164
|
+
transform: hasResults || hasQuery ? 'translateY(0px)' : 'translateY(-4px)',
|
|
135
165
|
pointerEvents: 'none'
|
|
136
166
|
}}
|
|
137
167
|
>
|
|
138
|
-
<div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `
|
|
139
|
-
|
|
140
|
-
Showing <span style={{ color: searchTokens.colors.borderAccent, fontWeight: 'bold' }}>{resultsCount}</span> matching database metrics records
|
|
141
|
-
</p>
|
|
168
|
+
<div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `0px solid ${searchTokens.colors.border}`, borderTop: 'none', padding: '4px 6px', borderRadius: '0 0 6px 6px', boxShadow: '0 4px 6px -1px rgba(0,0,0,0.1)' }}>
|
|
169
|
+
{renderedPeek()}
|
|
142
170
|
</div>
|
|
143
171
|
</div>
|
|
144
172
|
</div>
|
|
@@ -150,6 +178,12 @@ export default function SearchInput({
|
|
|
150
178
|
const showPeekIndicator = showFloatPeek && resultsCount > 0 && value.length > 0;
|
|
151
179
|
const isOpened = isExpanded || value.length > 0;
|
|
152
180
|
|
|
181
|
+
const renderedFloatPeek = peekContent || (
|
|
182
|
+
<p style={{ margin: 0, fontSize: '9px', fontFamily: searchTokens.typography.mono, color: searchTokens.colors.borderAccent, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
183
|
+
Quick Peek: Found {resultsCount} rows
|
|
184
|
+
</p>
|
|
185
|
+
);
|
|
186
|
+
|
|
153
187
|
return (
|
|
154
188
|
<div ref={containerRef} style={baseWrapperStyles} className={className}>
|
|
155
189
|
<div
|
|
@@ -209,9 +243,7 @@ export default function SearchInput({
|
|
|
209
243
|
}}
|
|
210
244
|
>
|
|
211
245
|
<div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `1px solid ${searchTokens.colors.border}`, borderTop: 'none', padding: '4px', borderRadius: '0 0 2px 2px', boxShadow: '0 4px 6px -1px rgba(0,0,0,0.1)' }}>
|
|
212
|
-
|
|
213
|
-
Quick Peek: Found {resultsCount} rows
|
|
214
|
-
</p>
|
|
246
|
+
{renderedFloatPeek}
|
|
215
247
|
</div>
|
|
216
248
|
</div>
|
|
217
249
|
</div>
|
|
@@ -258,4 +290,4 @@ export default function SearchInput({
|
|
|
258
290
|
/>
|
|
259
291
|
</div>
|
|
260
292
|
);
|
|
261
|
-
}
|
|
293
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
1
3
|
export type SearchVariant = 'simple' | 'float' | 'menu';
|
|
2
4
|
|
|
3
5
|
export interface SearchResultItem {
|
|
@@ -19,6 +21,8 @@ export interface SearchInputProps {
|
|
|
19
21
|
onViewMoreClick?: () => void;
|
|
20
22
|
className?: string;
|
|
21
23
|
showFloatPeek?: boolean;
|
|
24
|
+
// ⚡ Accepts either a plain text string label or a fully rendered sub-component node
|
|
25
|
+
peekContent?: React.ReactNode;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
export const searchTokens = {
|
|
@@ -33,6 +37,11 @@ export const searchTokens = {
|
|
|
33
37
|
hoverBg: 'var(--color-vsc-hover, #e8e8e8)',
|
|
34
38
|
accentBgLight: 'rgba(0, 122, 204, 0.1)'
|
|
35
39
|
},
|
|
40
|
+
typography: {
|
|
41
|
+
/* ⚡ Pulls Tailwind's native font configuration maps from your global layout shell App context */
|
|
42
|
+
sans: 'var(--font-sans, font-sans, ui-sans-serif, system-ui, sans-serif)',
|
|
43
|
+
mono: 'var(--font-mono, font-mono, ui-monospace, SFMono-Regular, monospace)'
|
|
44
|
+
},
|
|
36
45
|
transitions: {
|
|
37
46
|
smooth: 'all 200ms cubic-bezier(0.34, 1.56, 0.64, 1)'
|
|
38
47
|
}
|
package/src/index.ts
CHANGED