@knymbus/voxel-ui 1.0.14 → 1.0.17
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/.storybook/main.ts +10 -1
- package/.storybook/preview.ts +1 -1
- package/.storybook/tailwind.css +34 -0
- package/dist/chunks/{search-CIhA-ti4.js → search-WFmasN49.js} +44 -28
- package/dist/components/search/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/search/SearchInput.stories.tsx +5 -5
- package/src/components/search/SearchInput.tsx +33 -12
- package/src/index.css +8 -0
- package/vite.config.mts +1 -2
package/.storybook/main.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
+
import { mergeConfig } from 'vite';
|
|
2
3
|
|
|
3
4
|
const config: StorybookConfig = {
|
|
4
5
|
"stories": [
|
|
@@ -12,6 +13,14 @@ const config: StorybookConfig = {
|
|
|
12
13
|
"@storybook/addon-docs",
|
|
13
14
|
"@storybook/addon-mcp"
|
|
14
15
|
],
|
|
15
|
-
"framework": "@storybook/react-vite"
|
|
16
|
+
"framework": "@storybook/react-vite",
|
|
17
|
+
async viteFinal(config) {
|
|
18
|
+
// Dynamically import Tailwind to avoid any execution in the main app
|
|
19
|
+
const { default: tailwindcss } = await import('@tailwindcss/vite');
|
|
20
|
+
|
|
21
|
+
return mergeConfig(config, {
|
|
22
|
+
plugins: [tailwindcss()],
|
|
23
|
+
});
|
|
24
|
+
},
|
|
16
25
|
};
|
|
17
26
|
export default config;
|
package/.storybook/preview.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
/* 🎛️ Tailwind v4 Theme Extension Configuration Panel */
|
|
4
|
+
@theme {
|
|
5
|
+
--color-vsc-bg: #ffffff;
|
|
6
|
+
--color-vsc-sidebar: #f3f3f3;
|
|
7
|
+
--color-vsc-border: #e4e4e7;
|
|
8
|
+
--color-vsc-accent: #007acc;
|
|
9
|
+
--color-vsc-accent-hover: #0062a3;
|
|
10
|
+
--color-vsc-hover: #e8e8e8;
|
|
11
|
+
--color-vsc-text: #333333;
|
|
12
|
+
|
|
13
|
+
--color-vsc-button-text: #ffffff;
|
|
14
|
+
--color-vsc-muted: #6a737d;
|
|
15
|
+
--color-vsc-bg-input: #f6f8fa;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ==========================================================================
|
|
19
|
+
DARK MODE OVERRIDES (Triggers when parent layout has the ".dark" class)
|
|
20
|
+
========================================================================== */
|
|
21
|
+
@layer base {
|
|
22
|
+
.dark {
|
|
23
|
+
--color-vsc-bg: #1e1e1e;
|
|
24
|
+
--color-vsc-sidebar: #252526;
|
|
25
|
+
--color-vsc-border: #3c3c3c;
|
|
26
|
+
--color-vsc-accent: #007acc;
|
|
27
|
+
--color-vsc-accent-hover: #0062a3;
|
|
28
|
+
--color-vsc-hover: #2a2d2e;
|
|
29
|
+
--color-vsc-text: #cccccc;
|
|
30
|
+
|
|
31
|
+
--color-vsc-muted: #8b949e;
|
|
32
|
+
--color-vsc-bg-input: #1f1f1f;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -186,28 +186,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
186
186
|
boxSizing: "border-box"
|
|
187
187
|
};
|
|
188
188
|
if (e === "simple") {
|
|
189
|
-
let e =
|
|
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
|
-
});
|
|
189
|
+
let e = u.length > 0, i = m > 0;
|
|
211
190
|
return /* @__PURE__ */ (0, c.jsxs)("div", {
|
|
212
191
|
style: N,
|
|
213
192
|
className: v,
|
|
@@ -261,23 +240,60 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
|
|
|
261
240
|
right: 0,
|
|
262
241
|
top: "32px",
|
|
263
242
|
zIndex: 10,
|
|
264
|
-
overflow: "hidden",
|
|
265
243
|
transition: s.transitions.smooth,
|
|
266
|
-
height: e ? "
|
|
244
|
+
height: e ? "auto" : "0px",
|
|
267
245
|
opacity: +!!e,
|
|
268
|
-
transform: e ? "translateY(
|
|
246
|
+
transform: e ? "translateY(4px)" : "translateY(-4px)",
|
|
269
247
|
pointerEvents: "none"
|
|
270
248
|
},
|
|
271
249
|
children: /* @__PURE__ */ (0, c.jsx)("div", {
|
|
272
250
|
style: {
|
|
273
251
|
backgroundColor: s.colors.sidebarBg,
|
|
274
|
-
border: `
|
|
252
|
+
border: `0px solid ${s.colors.border}`,
|
|
275
253
|
borderTop: "none",
|
|
276
254
|
padding: "4px 6px",
|
|
277
|
-
borderRadius: "
|
|
255
|
+
borderRadius: "6px",
|
|
278
256
|
boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
|
|
279
257
|
},
|
|
280
|
-
children: i
|
|
258
|
+
children: e && b ? b : e && !b && i ? /* @__PURE__ */ (0, c.jsxs)("p", {
|
|
259
|
+
style: {
|
|
260
|
+
margin: 0,
|
|
261
|
+
fontSize: "10px",
|
|
262
|
+
fontFamily: s.typography.mono,
|
|
263
|
+
color: s.colors.muted,
|
|
264
|
+
whiteSpace: "nowrap",
|
|
265
|
+
overflow: "hidden",
|
|
266
|
+
textOverflow: "ellipsis"
|
|
267
|
+
},
|
|
268
|
+
children: [
|
|
269
|
+
"Showing ",
|
|
270
|
+
/* @__PURE__ */ (0, c.jsx)("span", {
|
|
271
|
+
style: {
|
|
272
|
+
color: s.colors.borderAccent,
|
|
273
|
+
fontWeight: "bold"
|
|
274
|
+
},
|
|
275
|
+
children: m
|
|
276
|
+
}),
|
|
277
|
+
" matching database metrics records"
|
|
278
|
+
]
|
|
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
|
|
281
297
|
})
|
|
282
298
|
})]
|
|
283
299
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/search-
|
|
1
|
+
import { n as e, t } from "../../chunks/search-WFmasN49.js";
|
|
2
2
|
export { t as SearchInput, e as searchTokens };
|
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-WFmasN49.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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import SearchInput from './SearchInput';
|
|
4
4
|
import { SearchResultItem } from './types';
|
|
@@ -45,10 +45,10 @@ const MultiSearchWorkspace = () => {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<div className="p-8 bg-vsc-sidebar border border-vsc-border rounded-md space-y-8 min-w-112.5 text-vsc-text">
|
|
48
|
+
<div className="p-8 bg-vsc-sidebar border border-vsc-border rounded-md space-y-8 min-w-112.5 text-vsc-text" >
|
|
49
49
|
|
|
50
50
|
{/* 1. Simple Variant Bracket */}
|
|
51
|
-
<div className="space-y-1.5">
|
|
51
|
+
<div className="space-y-1.5" >
|
|
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
|
|
|
@@ -93,14 +93,35 @@ export default function SearchInput({
|
|
|
93
93
|
|
|
94
94
|
// --- 1. SIMPLE VARIANT ---
|
|
95
95
|
if (variant === 'simple') {
|
|
96
|
-
const
|
|
96
|
+
const hasQuery = value.length > 0;
|
|
97
|
+
const hasResults = resultsCount > 0;
|
|
97
98
|
|
|
98
99
|
// ⚡ Fallback logic: check if the dev supplied a custom peek content block component
|
|
99
|
-
const renderedPeek =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
+
}
|
|
104
125
|
|
|
105
126
|
return (
|
|
106
127
|
<div style={baseWrapperStyles} className={className}>
|
|
@@ -136,16 +157,16 @@ export default function SearchInput({
|
|
|
136
157
|
right: 0,
|
|
137
158
|
top: '32px',
|
|
138
159
|
zIndex: 10,
|
|
139
|
-
overflow: 'hidden',
|
|
160
|
+
// overflow: 'hidden',
|
|
140
161
|
transition: searchTokens.transitions.smooth,
|
|
141
|
-
height:
|
|
142
|
-
opacity:
|
|
143
|
-
transform:
|
|
162
|
+
height: hasQuery ? 'auto' : '0px',
|
|
163
|
+
opacity: hasQuery ? 1 : 0,
|
|
164
|
+
transform: hasQuery ? 'translateY(4px)' : 'translateY(-4px)',
|
|
144
165
|
pointerEvents: 'none'
|
|
145
166
|
}}
|
|
146
167
|
>
|
|
147
|
-
<div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `
|
|
148
|
-
{renderedPeek}
|
|
168
|
+
<div style={{ backgroundColor: searchTokens.colors.sidebarBg, border: `0px solid ${searchTokens.colors.border}`, borderTop: 'none', padding: '4px 6px', borderRadius: '6px', boxShadow: '0 4px 6px -1px rgba(0,0,0,0.1)' }}>
|
|
169
|
+
{renderedPeek()}
|
|
149
170
|
</div>
|
|
150
171
|
</div>
|
|
151
172
|
</div>
|
package/src/index.css
CHANGED
package/vite.config.mts
CHANGED
|
@@ -8,12 +8,11 @@ import { fileURLToPath } from 'node:url';
|
|
|
8
8
|
import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
|
|
9
9
|
import { playwright } from '@vitest/browser-playwright';
|
|
10
10
|
const dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
|
|
13
13
|
// More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
|
|
14
14
|
export default defineConfig({
|
|
15
15
|
plugins: [
|
|
16
|
-
tailwindcss(),
|
|
17
16
|
react(),
|
|
18
17
|
// Auto-generates independent TypeScript type declaration files (.d.ts) matching paths
|
|
19
18
|
dts({
|