@knymbus/voxel-ui 1.0.15 → 1.0.19

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.
@@ -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;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="vite/client" />
2
2
  import type { Preview } from '@storybook/react-vite'
3
- import '../src/index.css';
3
+ import './tailwind.css';
4
4
 
5
5
  const preview: Preview = {
6
6
  parameters: {
@@ -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
+ }
@@ -1,36 +1,20 @@
1
1
  import { t as e } from "./jsx-runtime-Boo2vksn.js";
2
- import { t } from "./Button-BgQwvn3C.js";
3
- import { E as n, S as r } from "./icons-BpfDVwCQ.js";
4
- import { useEffect as i, useRef as a, useState as o } from "react";
5
- //#region src/components/search/types.ts
6
- var s = {
7
- colors: {
8
- bgInput: "var(--color-vsc-bg-input, #f6f8fa)",
9
- border: "var(--color-vsc-border, #e4e4e7)",
10
- borderAccent: "var(--color-vsc-accent, #007acc)",
11
- borderAccentHover: "var(--color-vsc-accent-hover, #0062a3)",
12
- text: "var(--color-vsc-text, #333333)",
13
- muted: "var(--color-vsc-muted, #6a737d)",
14
- sidebarBg: "var(--color-vsc-sidebar, #f3f3f3)",
15
- hoverBg: "var(--color-vsc-hover, #e8e8e8)",
16
- accentBgLight: "rgba(0, 122, 204, 0.1)"
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
- },
22
- transitions: { smooth: "all 200ms cubic-bezier(0.34, 1.56, 0.64, 1)" }
23
- }, c = e();
24
- function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreClick: i, onCloseMenu: a }) {
25
- let [l, u] = o(null), [d, f] = o(!1);
26
- return !e || !t ? null : /* @__PURE__ */ (0, c.jsxs)("div", {
2
+ import { t } from "./types-DmQVfNPh.js";
3
+ import { t as n } from "./Button-BgQwvn3C.js";
4
+ import { E as r, S as i } from "./icons-BpfDVwCQ.js";
5
+ import { useEffect as a, useRef as o, useState as s } from "react";
6
+ //#region src/components/search/SearchMenu.tsx
7
+ var c = e();
8
+ function l({ isOpen: e, value: n, menuResults: r, onResultClick: i, onViewMoreClick: a, onCloseMenu: o }) {
9
+ let [l, u] = s(null), [d, f] = s(!1);
10
+ return !e || !n ? null : /* @__PURE__ */ (0, c.jsxs)("div", {
27
11
  style: {
28
12
  position: "absolute",
29
13
  top: "36px",
30
14
  left: 0,
31
15
  width: "100%",
32
- backgroundColor: s.colors.sidebarBg,
33
- border: `1px solid ${s.colors.border}`,
16
+ backgroundColor: t.colors.sidebarBg,
17
+ border: `1px solid ${t.colors.border}`,
34
18
  borderRadius: "4px",
35
19
  boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.2)",
36
20
  zIndex: 50,
@@ -44,25 +28,25 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
44
28
  overflowY: "auto",
45
29
  flex: 1
46
30
  },
47
- children: n.length === 0 ? /* @__PURE__ */ (0, c.jsx)("div", {
31
+ children: r.length === 0 ? /* @__PURE__ */ (0, c.jsx)("div", {
48
32
  style: {
49
33
  padding: "16px",
50
34
  textAlign: "center",
51
35
  fontSize: "11px",
52
- color: s.colors.muted,
36
+ color: t.colors.muted,
53
37
  fontStyle: "italic"
54
38
  },
55
39
  children: "No indexed record entities match your text query constraints."
56
- }) : n.map((e) => /* @__PURE__ */ (0, c.jsxs)("div", {
40
+ }) : r.map((e) => /* @__PURE__ */ (0, c.jsxs)("div", {
57
41
  onMouseEnter: () => u(e.id),
58
42
  onMouseLeave: () => u(null),
59
43
  onClick: () => {
60
- r && r(e), a();
44
+ i && i(e), o();
61
45
  },
62
46
  style: {
63
47
  width: "100%",
64
48
  padding: "8px",
65
- backgroundColor: l === e.id ? s.colors.hoverBg : "transparent",
49
+ backgroundColor: l === e.id ? t.colors.hoverBg : "transparent",
66
50
  borderRadius: "2px",
67
51
  cursor: "pointer",
68
52
  display: "flex",
@@ -74,7 +58,7 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
74
58
  children: [/* @__PURE__ */ (0, c.jsxs)("div", {
75
59
  style: {
76
60
  fontWeight: 600,
77
- color: s.colors.text,
61
+ color: t.colors.text,
78
62
  display: "flex",
79
63
  justifyContent: "space-between",
80
64
  alignItems: "center",
@@ -93,9 +77,9 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
93
77
  fontSize: "9px",
94
78
  fontFamily: "monospace",
95
79
  fontWeight: "bold",
96
- backgroundColor: s.colors.accentBgLight,
80
+ backgroundColor: t.colors.accentBgLight,
97
81
  border: "1px solid rgba(0, 122, 204, 0.2)",
98
- color: s.colors.borderAccent,
82
+ color: t.colors.borderAccent,
99
83
  padding: "2px 4px",
100
84
  borderRadius: "2px",
101
85
  textTransform: "uppercase",
@@ -107,7 +91,7 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
107
91
  }), e.subtitle && /* @__PURE__ */ (0, c.jsx)("div", {
108
92
  style: {
109
93
  fontSize: "10px",
110
- color: s.colors.muted,
94
+ color: t.colors.muted,
111
95
  whiteSpace: "nowrap",
112
96
  overflow: "hidden",
113
97
  textOverflow: "ellipsis"
@@ -115,22 +99,22 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
115
99
  children: e.subtitle
116
100
  })]
117
101
  }, e.id))
118
- }), n.length > 0 && i && /* @__PURE__ */ (0, c.jsx)("button", {
102
+ }), r.length > 0 && a && /* @__PURE__ */ (0, c.jsx)("button", {
119
103
  onMouseEnter: () => f(!0),
120
104
  onMouseLeave: () => f(!1),
121
105
  onClick: () => {
122
- i(), a();
106
+ a(), o();
123
107
  },
124
108
  style: {
125
109
  width: "100%",
126
110
  border: "none",
127
- borderTop: `1px solid ${s.colors.border}`,
128
- backgroundColor: d ? s.colors.hoverBg : "transparent",
111
+ borderTop: `1px solid ${t.colors.border}`,
112
+ backgroundColor: d ? t.colors.hoverBg : "transparent",
129
113
  padding: "8px",
130
114
  textAlign: "center",
131
115
  fontSize: "10px",
132
116
  fontWeight: "bold",
133
- color: s.colors.borderAccent,
117
+ color: t.colors.borderAccent,
134
118
  letterSpacing: "0.5px",
135
119
  textTransform: "uppercase",
136
120
  transition: "background-color 150ms",
@@ -144,8 +128,8 @@ function l({ isOpen: e, value: t, menuResults: n, onResultClick: r, onViewMoreCl
144
128
  //#endregion
145
129
  //#region src/components/search/SearchInput.tsx
146
130
  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);
148
- i(() => {
131
+ let [x, S] = s(!1), [C, w] = s(!1), [T, E] = s(!1), [D, O] = s(!1), k = o(null), A = o(null);
132
+ a(() => {
149
133
  let t = (t) => {
150
134
  k.current && !k.current.contains(t.target) && (w(!1), e === "float" && u === "" && S(!1));
151
135
  };
@@ -159,7 +143,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
159
143
  position: "relative",
160
144
  display: "flex",
161
145
  flexDirection: "column",
162
- fontFamily: s.typography.sans,
146
+ fontFamily: t.typography.sans,
163
147
  fontSize: "12px",
164
148
  userSelect: "none",
165
149
  boxSizing: "border-box"
@@ -167,26 +151,26 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
167
151
  position: "relative",
168
152
  display: "flex",
169
153
  alignItems: "center",
170
- backgroundColor: s.colors.bgInput,
171
- border: `1px solid ${D || e === "float" && x ? s.colors.borderAccent : T ? s.colors.borderAccentHover : s.colors.border}`,
154
+ backgroundColor: t.colors.bgInput,
155
+ border: `1px solid ${D || e === "float" && x ? t.colors.borderAccent : T ? t.colors.borderAccentHover : t.colors.border}`,
172
156
  borderRadius: "6px",
173
157
  height: "32px",
174
- transition: s.transitions.smooth,
158
+ transition: t.transitions.smooth,
175
159
  boxSizing: "border-box"
176
160
  }, F = {
177
161
  width: "100%",
178
162
  height: "100%",
179
163
  backgroundColor: "transparent",
180
- color: s.colors.text,
164
+ color: t.colors.text,
181
165
  border: "none",
182
166
  outline: "none",
183
167
  padding: "0 32px",
184
168
  fontSize: "12px",
185
- fontFamily: s.typography.sans,
169
+ fontFamily: t.typography.sans,
186
170
  boxSizing: "border-box"
187
171
  };
188
172
  if (e === "simple") {
189
- let e = u.length > 0, i = m > 0;
173
+ let e = u.length > 0, a = m > 0;
190
174
  return /* @__PURE__ */ (0, c.jsxs)("div", {
191
175
  style: N,
192
176
  className: v,
@@ -201,9 +185,9 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
201
185
  left: "10px",
202
186
  display: "flex",
203
187
  alignItems: "center",
204
- color: T ? s.colors.text : s.colors.muted
188
+ color: T ? t.colors.text : t.colors.muted
205
189
  },
206
- children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
190
+ children: /* @__PURE__ */ (0, c.jsx)(i, { size: 14 })
207
191
  }),
208
192
  /* @__PURE__ */ (0, c.jsx)("input", {
209
193
  ref: A,
@@ -224,8 +208,8 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
224
208
  display: "flex",
225
209
  alignItems: "center"
226
210
  },
227
- children: /* @__PURE__ */ (0, c.jsx)(t, {
228
- icon: n,
211
+ children: /* @__PURE__ */ (0, c.jsx)(n, {
212
+ icon: r,
229
213
  color: "ghost",
230
214
  iconOnly: !0,
231
215
  onClick: j,
@@ -240,27 +224,27 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
240
224
  right: 0,
241
225
  top: "32px",
242
226
  zIndex: 10,
243
- transition: s.transitions.smooth,
244
- height: i || e ? "auto" : "0px",
245
- opacity: i || e ? 1 : 0,
246
- transform: i || e ? "translateY(0px)" : "translateY(-4px)",
227
+ transition: t.transitions.smooth,
228
+ height: e ? "auto" : "0px",
229
+ opacity: +!!e,
230
+ transform: e ? "translateY(4px)" : "translateY(-4px)",
247
231
  pointerEvents: "none"
248
232
  },
249
233
  children: /* @__PURE__ */ (0, c.jsx)("div", {
250
234
  style: {
251
- backgroundColor: s.colors.sidebarBg,
252
- border: `0px solid ${s.colors.border}`,
235
+ backgroundColor: t.colors.sidebarBg,
236
+ border: `0px solid ${t.colors.border}`,
253
237
  borderTop: "none",
254
238
  padding: "4px 6px",
255
- borderRadius: "0 0 6px 6px",
239
+ borderRadius: "6px",
256
240
  boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
257
241
  },
258
- children: e && b ? b : e && !b && i ? /* @__PURE__ */ (0, c.jsxs)("p", {
242
+ children: e && b ? b : e && !b && a ? /* @__PURE__ */ (0, c.jsxs)("p", {
259
243
  style: {
260
244
  margin: 0,
261
245
  fontSize: "10px",
262
- fontFamily: s.typography.mono,
263
- color: s.colors.muted,
246
+ fontFamily: t.typography.mono,
247
+ color: t.colors.muted,
264
248
  whiteSpace: "nowrap",
265
249
  overflow: "hidden",
266
250
  textOverflow: "ellipsis"
@@ -269,26 +253,26 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
269
253
  "Showing ",
270
254
  /* @__PURE__ */ (0, c.jsx)("span", {
271
255
  style: {
272
- color: s.colors.borderAccent,
256
+ color: t.colors.borderAccent,
273
257
  fontWeight: "bold"
274
258
  },
275
259
  children: m
276
260
  }),
277
261
  " matching database metrics records"
278
262
  ]
279
- }) : e && !b && !i ? /* @__PURE__ */ (0, c.jsxs)("p", {
263
+ }) : e && !b && !a ? /* @__PURE__ */ (0, c.jsxs)("p", {
280
264
  style: {
281
265
  margin: 0,
282
266
  fontSize: "10px",
283
- fontFamily: s.typography.mono,
284
- color: s.colors.borderAccent,
267
+ fontFamily: t.typography.mono,
268
+ color: t.colors.borderAccent,
285
269
  whiteSpace: "nowrap",
286
270
  overflow: "hidden",
287
271
  textOverflow: "ellipsis"
288
272
  },
289
273
  children: ["No matching records found for your query: ", /* @__PURE__ */ (0, c.jsx)("span", {
290
274
  style: {
291
- color: s.colors.text,
275
+ color: t.colors.text,
292
276
  fontWeight: "bold"
293
277
  },
294
278
  children: u
@@ -299,12 +283,12 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
299
283
  });
300
284
  }
301
285
  if (e === "float") {
302
- let e = y && m > 0 && u.length > 0, i = x || u.length > 0, a = b || /* @__PURE__ */ (0, c.jsxs)("p", {
286
+ let e = y && m > 0 && u.length > 0, a = x || u.length > 0, o = b || /* @__PURE__ */ (0, c.jsxs)("p", {
303
287
  style: {
304
288
  margin: 0,
305
289
  fontSize: "9px",
306
- fontFamily: s.typography.mono,
307
- color: s.colors.borderAccent,
290
+ fontFamily: t.typography.mono,
291
+ color: t.colors.borderAccent,
308
292
  whiteSpace: "nowrap",
309
293
  overflow: "hidden",
310
294
  textOverflow: "ellipsis"
@@ -324,13 +308,13 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
324
308
  onMouseLeave: () => E(!1),
325
309
  style: {
326
310
  ...P,
327
- width: i ? "256px" : "32px",
328
- justifyContent: i ? "flex-start" : "center",
329
- backgroundColor: i ? s.colors.bgInput : "transparent",
330
- borderColor: i ? s.colors.borderAccent : "transparent",
331
- padding: i ? "0 8px" : "0"
311
+ width: a ? "256px" : "32px",
312
+ justifyContent: a ? "flex-start" : "center",
313
+ backgroundColor: a ? t.colors.bgInput : "transparent",
314
+ borderColor: a ? t.colors.borderAccent : "transparent",
315
+ padding: a ? "0 8px" : "0"
332
316
  },
333
- children: i ? /* @__PURE__ */ (0, c.jsxs)("div", {
317
+ children: a ? /* @__PURE__ */ (0, c.jsxs)("div", {
334
318
  style: {
335
319
  position: "relative",
336
320
  display: "flex",
@@ -339,10 +323,10 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
339
323
  height: "100%"
340
324
  },
341
325
  children: [
342
- /* @__PURE__ */ (0, c.jsx)(r, {
326
+ /* @__PURE__ */ (0, c.jsx)(i, {
343
327
  size: 14,
344
328
  style: {
345
- color: s.colors.text,
329
+ color: t.colors.text,
346
330
  flexShrink: 0
347
331
  }
348
332
  }),
@@ -366,22 +350,22 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
366
350
  display: "flex",
367
351
  alignItems: "center"
368
352
  },
369
- children: /* @__PURE__ */ (0, c.jsx)(t, {
353
+ children: /* @__PURE__ */ (0, c.jsx)(n, {
370
354
  iconOnly: !0,
371
355
  color: "ghost",
372
- icon: n,
356
+ icon: r,
373
357
  onClick: j,
374
358
  size: "xs"
375
359
  })
376
360
  })
377
361
  ]
378
- }) : /* @__PURE__ */ (0, c.jsx)(t, {
362
+ }) : /* @__PURE__ */ (0, c.jsx)(n, {
379
363
  iconOnly: !0,
380
364
  size: "sm",
381
- icon: r,
365
+ icon: i,
382
366
  onClick: M,
383
367
  color: "ghost",
384
- style: { color: s.colors.muted },
368
+ style: { color: t.colors.muted },
385
369
  title: "Open Expandable Search"
386
370
  })
387
371
  }), /* @__PURE__ */ (0, c.jsx)("div", {
@@ -391,7 +375,7 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
391
375
  width: "256px",
392
376
  zIndex: 10,
393
377
  overflow: "hidden",
394
- transition: s.transitions.smooth,
378
+ transition: t.transitions.smooth,
395
379
  height: e ? "24px" : "0px",
396
380
  opacity: +!!e,
397
381
  transform: e ? "translateY(0px)" : "translateY(-4px)",
@@ -399,14 +383,14 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
399
383
  },
400
384
  children: /* @__PURE__ */ (0, c.jsx)("div", {
401
385
  style: {
402
- backgroundColor: s.colors.sidebarBg,
403
- border: `1px solid ${s.colors.border}`,
386
+ backgroundColor: t.colors.sidebarBg,
387
+ border: `1px solid ${t.colors.border}`,
404
388
  borderTop: "none",
405
389
  padding: "4px",
406
390
  borderRadius: "0 0 2px 2px",
407
391
  boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1)"
408
392
  },
409
- children: a
393
+ children: o
410
394
  })
411
395
  })]
412
396
  });
@@ -426,9 +410,9 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
426
410
  left: "10px",
427
411
  display: "flex",
428
412
  alignItems: "center",
429
- color: s.colors.muted
413
+ color: t.colors.muted
430
414
  },
431
- children: /* @__PURE__ */ (0, c.jsx)(r, { size: 14 })
415
+ children: /* @__PURE__ */ (0, c.jsx)(i, { size: 14 })
432
416
  }),
433
417
  /* @__PURE__ */ (0, c.jsx)("input", {
434
418
  ref: A,
@@ -450,9 +434,9 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
450
434
  display: "flex",
451
435
  alignItems: "center"
452
436
  },
453
- children: /* @__PURE__ */ (0, c.jsx)(t, {
437
+ children: /* @__PURE__ */ (0, c.jsx)(n, {
454
438
  iconOnly: !0,
455
- icon: n,
439
+ icon: r,
456
440
  color: "ghost",
457
441
  onClick: j,
458
442
  size: "xs"
@@ -470,4 +454,4 @@ function u({ variant: e = "simple", value: u, onChange: d, onClear: f, placehold
470
454
  });
471
455
  }
472
456
  //#endregion
473
- export { s as n, u as t };
457
+ export { u as t };
@@ -0,0 +1,182 @@
1
+ import { t as e } from "./jsx-runtime-Boo2vksn.js";
2
+ import { t } from "./types-DmQVfNPh.js";
3
+ import { createContext as n, useContext as r, useEffect as i, useState as a } from "react";
4
+ import { create as o } from "zustand";
5
+ //#region src/components/tabs/useTab.ts
6
+ var s = o((e) => ({
7
+ activeTabs: {},
8
+ setActiveTab: (t, n) => e((e) => ({ activeTabs: {
9
+ ...e.activeTabs,
10
+ [t]: n
11
+ } })),
12
+ initializeTab: (t, n) => e((e) => e.activeTabs[t] ? {} : { activeTabs: {
13
+ ...e.activeTabs,
14
+ [t]: n
15
+ } })
16
+ }));
17
+ function c(e) {
18
+ let t = s((t) => t.activeTabs[e]), n = s((e) => e.setActiveTab), r = s((e) => e.initializeTab);
19
+ return {
20
+ activeTab: t,
21
+ changeTab: (t) => n(e, t),
22
+ registerDefault: (t) => r(e, t)
23
+ };
24
+ }
25
+ //#endregion
26
+ //#region src/components/tabs/TabPanelList.tsx
27
+ var l = e(), u = n({ activeTabId: void 0 }), d = () => r(u);
28
+ function f({ children: e, targetScopeName: n, defaultValue: r }) {
29
+ let { activeTab: a, registerDefault: o } = c(n);
30
+ i(() => {
31
+ o(r);
32
+ }, [r, o]);
33
+ let s = a || r, d = {
34
+ position: "relative",
35
+ width: "100%",
36
+ height: "100%",
37
+ minHeight: 0,
38
+ flex: "1 1 0%",
39
+ overflow: "hidden",
40
+ backgroundColor: t.colors.bgInput,
41
+ fontFamily: t.typography.sans,
42
+ boxSizing: "border-box"
43
+ };
44
+ return /* @__PURE__ */ (0, l.jsx)(u.Provider, {
45
+ value: { activeTabId: s },
46
+ children: /* @__PURE__ */ (0, l.jsx)("div", {
47
+ style: d,
48
+ children: e
49
+ })
50
+ });
51
+ }
52
+ //#endregion
53
+ //#region src/components/tabs/TabPanel.tsx
54
+ function p({ children: e, id: t, persist: n = !1 }) {
55
+ let { activeTabId: r } = d(), o = r === t, [s, c] = a(!1);
56
+ return i(() => {
57
+ o && !s && c(!0);
58
+ }, [o, s]), !s || !n && !o ? null : /* @__PURE__ */ (0, l.jsx)("div", {
59
+ style: {
60
+ position: "absolute",
61
+ top: 0,
62
+ left: 0,
63
+ right: 0,
64
+ bottom: 0,
65
+ width: "100%",
66
+ height: "100%",
67
+ backgroundColor: "transparent",
68
+ transition: "opacity 250ms ease-out, transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1)",
69
+ boxSizing: "border-box",
70
+ opacity: +!!o,
71
+ transform: o ? "scale(1)" : "scale(0.995)",
72
+ zIndex: o ? 10 : 0,
73
+ pointerEvents: o ? "auto" : "none",
74
+ visibility: o ? "visible" : "hidden"
75
+ },
76
+ children: /* @__PURE__ */ (0, l.jsx)("div", {
77
+ style: {
78
+ width: "100%",
79
+ height: "100%",
80
+ boxSizing: "border-box"
81
+ },
82
+ children: e
83
+ })
84
+ });
85
+ }
86
+ //#endregion
87
+ //#region src/components/tabs/TabButton.tsx
88
+ function m({ id: e, scopeName: n, children: r, variant: i = "underline", startIcon: o, endIcon: s }) {
89
+ let { activeTab: u, changeTab: d } = c(n), [f, p] = a(!1), m = u === e, h = {
90
+ display: "inline-flex",
91
+ alignItems: "center",
92
+ justifyContent: "center",
93
+ gap: "6px",
94
+ backgroundColor: "transparent",
95
+ border: "none",
96
+ outline: "none",
97
+ fontFamily: t.typography.sans,
98
+ fontSize: "12px",
99
+ userSelect: "none",
100
+ cursor: "pointer",
101
+ height: "100%",
102
+ transition: "all 150ms ease",
103
+ boxSizing: "border-box",
104
+ position: "relative",
105
+ zIndex: 10
106
+ }, g = {
107
+ underline: {
108
+ padding: "4px 12px 8px 12px",
109
+ fontWeight: m ? 600 : 500,
110
+ color: m || f ? t.colors.text : t.colors.muted,
111
+ borderBottom: `2px solid ${m ? t.colors.borderAccent : "transparent"}`
112
+ },
113
+ "sliding-underline": {
114
+ padding: "8px 16px",
115
+ fontWeight: m ? 700 : 500,
116
+ color: m || f ? t.colors.text : t.colors.muted
117
+ },
118
+ pill: {
119
+ padding: "6px 14px",
120
+ fontWeight: 700,
121
+ borderRadius: "9999px",
122
+ backgroundColor: m ? t.colors.borderAccent : f ? t.colors.hoverBg : "transparent",
123
+ color: m ? "#ffffff" : f ? t.colors.text : t.colors.muted,
124
+ transform: m ? "scale(1.02)" : "scale(1)",
125
+ boxShadow: m ? "0 1px 3px rgba(0,0,0,0.1)" : "none"
126
+ },
127
+ vscode: {
128
+ padding: "0 16px",
129
+ fontWeight: 500,
130
+ color: m || f ? t.colors.text : t.colors.muted,
131
+ backgroundColor: m ? t.colors.bgInput : f ? "rgba(0,0,0,0.02)" : t.colors.sidebarBg,
132
+ borderRight: `1px solid ${t.colors.border}`,
133
+ borderTop: m ? `2px solid ${t.colors.borderAccent}` : "2px solid transparent",
134
+ marginTop: m ? "-1px" : "0"
135
+ },
136
+ ghost: {
137
+ padding: "6px 12px",
138
+ fontWeight: m ? 700 : 500,
139
+ borderRadius: "2px",
140
+ backgroundColor: m ? t.colors.hoverBg : f ? "rgba(0,0,0,0.04)" : "transparent",
141
+ color: m || f ? t.colors.text : t.colors.muted
142
+ }
143
+ };
144
+ return /* @__PURE__ */ (0, l.jsxs)("button", {
145
+ "data-id": e,
146
+ onClick: () => d(e),
147
+ onMouseEnter: () => p(!0),
148
+ onMouseLeave: () => p(!1),
149
+ style: {
150
+ ...h,
151
+ ...g[i]
152
+ },
153
+ children: [
154
+ o && /* @__PURE__ */ (0, l.jsx)("span", {
155
+ style: {
156
+ display: "inline-flex",
157
+ flexShrink: 0,
158
+ opacity: m || f ? 1 : .7
159
+ },
160
+ children: o
161
+ }),
162
+ /* @__PURE__ */ (0, l.jsx)("span", {
163
+ style: {
164
+ overflow: "hidden",
165
+ textOverflow: "ellipsis",
166
+ whiteSpace: "nowrap"
167
+ },
168
+ children: r
169
+ }),
170
+ s && /* @__PURE__ */ (0, l.jsx)("span", {
171
+ style: {
172
+ display: "inline-flex",
173
+ flexShrink: 0,
174
+ opacity: m || f ? 1 : .6
175
+ },
176
+ children: s
177
+ })
178
+ ]
179
+ });
180
+ }
181
+ //#endregion
182
+ export { c as i, p as n, f as r, m as t };
@@ -0,0 +1,21 @@
1
+ //#region src/components/types.ts
2
+ var e = {
3
+ colors: {
4
+ bgInput: "var(--color-vsc-bg-input, #f6f8fa)",
5
+ border: "var(--color-vsc-border, #e4e4e7)",
6
+ borderAccent: "var(--color-vsc-accent, #007acc)",
7
+ borderAccentHover: "var(--color-vsc-accent-hover, #0062a3)",
8
+ text: "var(--color-vsc-text, #333333)",
9
+ muted: "var(--color-vsc-muted, #6a737d)",
10
+ sidebarBg: "var(--color-vsc-sidebar, #f3f3f3)",
11
+ hoverBg: "var(--color-vsc-hover, #e8e8e8)",
12
+ accentBgLight: "rgba(0, 122, 204, 0.1)"
13
+ },
14
+ typography: {
15
+ sans: "var(--font-sans, font-sans, ui-sans-serif, system-ui, sans-serif)",
16
+ mono: "var(--font-mono, font-mono, ui-monospace, SFMono-Regular, monospace)"
17
+ },
18
+ transitions: { smooth: "all 200ms cubic-bezier(0.34, 1.56, 0.64, 1)" }
19
+ };
20
+ //#endregion
21
+ export { e as t };