@knymbus/voxel-ui 1.0.13 → 1.0.14

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.
@@ -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 [b, x] = o(!1), [S, C] = o(!1), [w, T] = o(!1), [E, D] = o(!1), O = a(null), k = a(null);
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
- O.current && !O.current.contains(t.target) && (C(!1), e === "float" && u === "" && x(!1));
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 A = (e) => {
151
- e.stopPropagation(), d(""), f && f(), k.current && k.current.focus();
152
- }, j = () => {
153
- x(!0), setTimeout(() => k.current?.focus(), 50);
154
- }, M = {
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: "sans-serif",
162
+ fontFamily: s.typography.sans,
159
163
  fontSize: "12px",
160
164
  userSelect: "none",
161
165
  boxSizing: "border-box"
162
- }, N = {
166
+ }, P = {
163
167
  position: "relative",
164
168
  display: "flex",
165
169
  alignItems: "center",
166
170
  backgroundColor: s.colors.bgInput,
167
- border: `1px solid ${E || e === "float" && b ? s.colors.borderAccent : w ? s.colors.borderAccentHover : s.colors.border}`,
168
- borderRadius: "2px",
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
- }, P = {
176
+ }, F = {
173
177
  width: "100%",
174
178
  height: "100%",
175
179
  backgroundColor: "transparent",
@@ -178,17 +182,39 @@ 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 = m > 0 && u.length > 0;
189
+ let e = m > 0 && u.length > 0, i = b || /* @__PURE__ */ (0, c.jsxs)("p", {
190
+ style: {
191
+ margin: 0,
192
+ fontSize: "10px",
193
+ fontFamily: s.typography.mono,
194
+ color: s.colors.muted,
195
+ whiteSpace: "nowrap",
196
+ overflow: "hidden",
197
+ textOverflow: "ellipsis"
198
+ },
199
+ children: [
200
+ "Showing ",
201
+ /* @__PURE__ */ (0, c.jsx)("span", {
202
+ style: {
203
+ color: s.colors.borderAccent,
204
+ fontWeight: "bold"
205
+ },
206
+ children: m
207
+ }),
208
+ " matching database metrics records"
209
+ ]
210
+ });
185
211
  return /* @__PURE__ */ (0, c.jsxs)("div", {
186
- style: M,
212
+ style: N,
187
213
  className: v,
188
214
  children: [/* @__PURE__ */ (0, c.jsxs)("div", {
189
- style: N,
190
- onMouseEnter: () => T(!0),
191
- onMouseLeave: () => T(!1),
215
+ style: P,
216
+ onMouseEnter: () => E(!0),
217
+ onMouseLeave: () => E(!1),
192
218
  children: [
193
219
  /* @__PURE__ */ (0, c.jsx)("div", {
194
220
  style: {
@@ -196,19 +222,19 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
196
222
  left: "10px",
197
223
  display: "flex",
198
224
  alignItems: "center",
199
- color: w ? s.colors.text : s.colors.muted
225
+ color: T ? s.colors.text : s.colors.muted
200
226
  },
201
227
  children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
202
228
  }),
203
229
  /* @__PURE__ */ (0, c.jsx)("input", {
204
- ref: k,
230
+ ref: A,
205
231
  type: "text",
206
232
  value: u,
207
233
  onChange: (e) => d(e.target.value),
208
- onFocus: () => D(!0),
209
- onBlur: () => D(!1),
234
+ onFocus: () => O(!0),
235
+ onBlur: () => O(!1),
210
236
  placeholder: p,
211
- style: P
237
+ style: F
212
238
  }),
213
239
  u && /* @__PURE__ */ (0, c.jsx)("div", {
214
240
  style: {
@@ -223,7 +249,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
223
249
  icon: n,
224
250
  color: "ghost",
225
251
  iconOnly: !0,
226
- onClick: A,
252
+ onClick: j,
227
253
  size: "xs"
228
254
  })
229
255
  })
@@ -248,46 +274,40 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
248
274
  border: `1px solid ${s.colors.border}`,
249
275
  borderTop: "none",
250
276
  padding: "4px 6px",
251
- borderRadius: "0 0 2px 2px",
277
+ borderRadius: "0 0 6px 6px",
252
278
  boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
253
279
  },
254
- children: /* @__PURE__ */ (0, c.jsxs)("p", {
255
- style: {
256
- margin: 0,
257
- fontSize: "10px",
258
- fontFamily: "monospace",
259
- color: s.colors.muted,
260
- whiteSpace: "nowrap",
261
- overflow: "hidden",
262
- textOverflow: "ellipsis"
263
- },
264
- children: [
265
- "Showing ",
266
- /* @__PURE__ */ (0, c.jsx)("span", {
267
- style: {
268
- color: s.colors.borderAccent,
269
- fontWeight: "bold"
270
- },
271
- children: m
272
- }),
273
- " matching database metrics records"
274
- ]
275
- })
280
+ children: i
276
281
  })
277
282
  })]
278
283
  });
279
284
  }
280
285
  if (e === "float") {
281
- let e = y && m > 0 && u.length > 0, i = b || u.length > 0;
286
+ let e = y && m > 0 && u.length > 0, i = x || u.length > 0, a = b || /* @__PURE__ */ (0, c.jsxs)("p", {
287
+ style: {
288
+ margin: 0,
289
+ fontSize: "9px",
290
+ fontFamily: s.typography.mono,
291
+ color: s.colors.borderAccent,
292
+ whiteSpace: "nowrap",
293
+ overflow: "hidden",
294
+ textOverflow: "ellipsis"
295
+ },
296
+ children: [
297
+ "Quick Peek: Found ",
298
+ m,
299
+ " rows"
300
+ ]
301
+ });
282
302
  return /* @__PURE__ */ (0, c.jsxs)("div", {
283
- ref: O,
284
- style: M,
303
+ ref: k,
304
+ style: N,
285
305
  className: v,
286
306
  children: [/* @__PURE__ */ (0, c.jsx)("div", {
287
- onMouseEnter: () => T(!0),
288
- onMouseLeave: () => T(!1),
307
+ onMouseEnter: () => E(!0),
308
+ onMouseLeave: () => E(!1),
289
309
  style: {
290
- ...N,
310
+ ...P,
291
311
  width: i ? "256px" : "32px",
292
312
  justifyContent: i ? "flex-start" : "center",
293
313
  backgroundColor: i ? s.colors.bgInput : "transparent",
@@ -311,13 +331,13 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
311
331
  }
312
332
  }),
313
333
  /* @__PURE__ */ (0, c.jsx)("input", {
314
- ref: k,
334
+ ref: A,
315
335
  type: "text",
316
336
  value: u,
317
337
  onChange: (e) => d(e.target.value),
318
338
  placeholder: p,
319
339
  style: {
320
- ...P,
340
+ ...F,
321
341
  padding: "0 24px 0 8px"
322
342
  }
323
343
  }),
@@ -334,7 +354,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
334
354
  iconOnly: !0,
335
355
  color: "ghost",
336
356
  icon: n,
337
- onClick: A,
357
+ onClick: j,
338
358
  size: "xs"
339
359
  })
340
360
  })
@@ -343,7 +363,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
343
363
  iconOnly: !0,
344
364
  size: "sm",
345
365
  icon: r,
346
- onClick: j,
366
+ onClick: M,
347
367
  color: "ghost",
348
368
  style: { color: s.colors.muted },
349
369
  title: "Open Expandable Search"
@@ -370,34 +390,19 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
370
390
  borderRadius: "0 0 2px 2px",
371
391
  boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
372
392
  },
373
- children: /* @__PURE__ */ (0, c.jsxs)("p", {
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
- })
393
+ children: a
389
394
  })
390
395
  })]
391
396
  });
392
397
  }
393
398
  return /* @__PURE__ */ (0, c.jsxs)("div", {
394
- ref: O,
395
- style: M,
399
+ ref: k,
400
+ style: N,
396
401
  className: v,
397
402
  children: [/* @__PURE__ */ (0, c.jsxs)("div", {
398
- style: N,
399
- onMouseEnter: () => T(!0),
400
- onMouseLeave: () => T(!1),
403
+ style: P,
404
+ onMouseEnter: () => E(!0),
405
+ onMouseLeave: () => E(!1),
401
406
  children: [
402
407
  /* @__PURE__ */ (0, c.jsx)("div", {
403
408
  style: {
@@ -410,15 +415,15 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
410
415
  children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
411
416
  }),
412
417
  /* @__PURE__ */ (0, c.jsx)("input", {
413
- ref: k,
418
+ ref: A,
414
419
  type: "text",
415
420
  value: u,
416
421
  onChange: (e) => {
417
- d(e.target.value), C(!0);
422
+ d(e.target.value), w(!0);
418
423
  },
419
- onFocus: () => C(!0),
424
+ onFocus: () => w(!0),
420
425
  placeholder: p,
421
- style: P
426
+ style: F
422
427
  }),
423
428
  u && /* @__PURE__ */ (0, c.jsx)("div", {
424
429
  style: {
@@ -433,18 +438,18 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
433
438
  iconOnly: !0,
434
439
  icon: n,
435
440
  color: "ghost",
436
- onClick: A,
441
+ onClick: j,
437
442
  size: "xs"
438
443
  })
439
444
  })
440
445
  ]
441
446
  }), /* @__PURE__ */ (0, c.jsx)(l, {
442
- isOpen: S,
447
+ isOpen: C,
443
448
  value: u,
444
449
  menuResults: h,
445
450
  onResultClick: g,
446
451
  onViewMoreClick: _,
447
- onCloseMenu: () => C(!1)
452
+ onCloseMenu: () => w(!1)
448
453
  })]
449
454
  });
450
455
  }
@@ -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-BCvuXqOX.js";
1
+ import { n as e, t } from "../../chunks/search-CIhA-ti4.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-BCvuXqOX.js";
6
+ import { n as P, t as F } from "./chunks/search-CIhA-ti4.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knymbus/voxel-ui",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -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: 'sans-serif',
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
- ? searchTokens.colors.borderAccent
70
- : isInputHovered
71
- ? searchTokens.colors.borderAccentHover
72
- : searchTokens.colors.border
70
+ ? searchTokens.colors.borderAccent
71
+ : isInputHovered
72
+ ? searchTokens.colors.borderAccentHover
73
+ : searchTokens.colors.border
73
74
  }`,
74
- borderRadius: '2px',
75
+ borderRadius: '6px',
75
76
  height: '32px',
76
77
  transition: searchTokens.transitions.smooth,
77
78
  boxSizing: 'border-box'
@@ -86,6 +87,7 @@ 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
 
@@ -93,6 +95,13 @@ export default function SearchInput({
93
95
  if (variant === 'simple') {
94
96
  const hasResults = resultsCount > 0 && value.length > 0;
95
97
 
98
+ // ⚡ Fallback logic: check if the dev supplied a custom peek content block component
99
+ const renderedPeek = peekContent || (
100
+ <p style={{ margin: 0, fontSize: '10px', fontFamily: searchTokens.typography.mono, color: searchTokens.colors.muted, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
101
+ Showing <span style={{ color: searchTokens.colors.borderAccent, fontWeight: 'bold' }}>{resultsCount}</span> matching database metrics records
102
+ </p>
103
+ );
104
+
96
105
  return (
97
106
  <div style={baseWrapperStyles} className={className}>
98
107
  <div
@@ -135,10 +144,8 @@ export default function SearchInput({
135
144
  pointerEvents: 'none'
136
145
  }}
137
146
  >
138
- <div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `1px solid ${searchTokens.colors.border}`, borderTop: 'none', padding: '4px 6px', borderRadius: '0 0 2px 2px', boxShadow: '0 4px 6px -1px rgba(0,0,0,0.1)' }}>
139
- <p style={{ margin: 0, fontSize: '10px', fontFamily: 'monospace', color: searchTokens.colors.muted, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
140
- Showing <span style={{ color: searchTokens.colors.borderAccent, fontWeight: 'bold' }}>{resultsCount}</span> matching database metrics records
141
- </p>
147
+ <div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `1px 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)' }}>
148
+ {renderedPeek}
142
149
  </div>
143
150
  </div>
144
151
  </div>
@@ -150,6 +157,12 @@ export default function SearchInput({
150
157
  const showPeekIndicator = showFloatPeek && resultsCount > 0 && value.length > 0;
151
158
  const isOpened = isExpanded || value.length > 0;
152
159
 
160
+ const renderedFloatPeek = peekContent || (
161
+ <p style={{ margin: 0, fontSize: '9px', fontFamily: searchTokens.typography.mono, color: searchTokens.colors.borderAccent, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
162
+ Quick Peek: Found {resultsCount} rows
163
+ </p>
164
+ );
165
+
153
166
  return (
154
167
  <div ref={containerRef} style={baseWrapperStyles} className={className}>
155
168
  <div
@@ -209,9 +222,7 @@ export default function SearchInput({
209
222
  }}
210
223
  >
211
224
  <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
- <p style={{ margin: 0, fontSize: '9px', fontFamily: 'monospace', color: searchTokens.colors.borderAccent, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
213
- Quick Peek: Found {resultsCount} rows
214
- </p>
225
+ {renderedFloatPeek}
215
226
  </div>
216
227
  </div>
217
228
  </div>
@@ -258,4 +269,4 @@ export default function SearchInput({
258
269
  />
259
270
  </div>
260
271
  );
261
- }
272
+ }
@@ -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
  }