@teton/smith-ui 0.2.181 → 0.2.183

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.
@@ -0,0 +1,20 @@
1
+ export interface BreadcrumbSegment {
2
+ label: string;
3
+ /** Distinguishes segments that repeat (e.g. `/var/lib/var`). */
4
+ key: string;
5
+ }
6
+ /**
7
+ * Path breadcrumb with a clickable trail. The last segment is the current
8
+ * location and renders as static text; the rest call `onNavigate` with their
9
+ * index.
10
+ *
11
+ * Deep paths collapse in the middle rather than wrapping or truncating the
12
+ * end — the first and last few segments are the ones that orient you, and the
13
+ * hidden middle stays reachable through the overflow menu.
14
+ */
15
+ export declare function Breadcrumbs({ segments, onNavigate, maxVisible, className, }: {
16
+ segments: BreadcrumbSegment[];
17
+ onNavigate: (index: number) => void;
18
+ maxVisible?: number;
19
+ className?: string;
20
+ }): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { BADGE_COLORS, Badge, type BadgeVariant, LabelChip } from './badge';
2
+ export { type BreadcrumbSegment, Breadcrumbs } from './breadcrumbs';
2
3
  export { Button, type ButtonSize, type ButtonTone, type ButtonVariant, } from './button';
3
4
  export { AlertBanner, type AlertTone, Card, ListRow, Panel, SectionCard, ViewAllFooter, } from './card';
4
5
  export { CountryFlag } from './country-flag';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { jsx as e, jsxs as s, Fragment as v } from "react/jsx-runtime";
2
- import { X as w, Loader2 as j, ArrowLeft as D, ChevronDown as O, Search as R, Check as B } from "lucide-react";
1
+ import { jsx as e, jsxs as l, Fragment as v } from "react/jsx-runtime";
2
+ import { X as $, ChevronRight as w, MoreHorizontal as R, Loader2 as j, ArrowLeft as D, ChevronDown as B, Search as I, Check as K } from "lucide-react";
3
+ import { useState as k, useRef as A, useEffect as O } from "react";
3
4
  import { Link as f } from "react-router";
4
- import { useState as M, useRef as _, useEffect as A } from "react";
5
- const I = {
5
+ const z = {
6
6
  gray: "bg-gray-100 text-gray-700",
7
7
  blue: "bg-blue-100 text-blue-700",
8
8
  green: "bg-green-100 text-green-700",
@@ -11,7 +11,7 @@ const I = {
11
11
  purple: "bg-purple-100 text-purple-700",
12
12
  orange: "bg-orange-100 text-orange-700"
13
13
  };
14
- function J({
14
+ function W({
15
15
  variant: r = "gray",
16
16
  pill: t = !1,
17
17
  className: n = "",
@@ -20,12 +20,12 @@ function J({
20
20
  return /* @__PURE__ */ e(
21
21
  "span",
22
22
  {
23
- className: `px-1.5 py-0.5 text-xs font-medium ${t ? "rounded-full" : "rounded"} ${I[r]} ${n}`,
23
+ className: `px-1.5 py-0.5 text-xs font-medium ${t ? "rounded-full" : "rounded"} ${z[r]} ${n}`,
24
24
  children: a
25
25
  }
26
26
  );
27
27
  }
28
- function Q({
28
+ function ee({
29
29
  name: r,
30
30
  value: t,
31
31
  onClick: n,
@@ -33,7 +33,7 @@ function Q({
33
33
  active: o = !1,
34
34
  title: m
35
35
  }) {
36
- const l = /* @__PURE__ */ s(v, { children: [
36
+ const s = /* @__PURE__ */ l(v, { children: [
37
37
  /* @__PURE__ */ e(
38
38
  "span",
39
39
  {
@@ -48,9 +48,9 @@ function Q({
48
48
  children: t
49
49
  }
50
50
  )
51
- ] }), d = `inline-flex items-center overflow-hidden rounded-md border text-xs ${o ? "border-blue-300" : "border-gray-200"}`;
52
- return a ? /* @__PURE__ */ s("span", { className: d, children: [
53
- l,
51
+ ] }), b = `inline-flex items-center overflow-hidden rounded-md border text-xs ${o ? "border-blue-300" : "border-gray-200"}`;
52
+ return a ? /* @__PURE__ */ l("span", { className: b, children: [
53
+ s,
54
54
  /* @__PURE__ */ e(
55
55
  "button",
56
56
  {
@@ -59,7 +59,7 @@ function Q({
59
59
  title: m,
60
60
  "aria-label": `Remove ${t !== void 0 ? `${r}=${t}` : r}`,
61
61
  className: `flex items-center px-1.5 py-1 border-l cursor-pointer transition-colors ${o ? "bg-blue-100 border-blue-200 text-blue-500 hover:bg-blue-200 hover:text-blue-700" : "border-gray-200 text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,
62
- children: /* @__PURE__ */ e(w, { className: "w-3 h-3" })
62
+ children: /* @__PURE__ */ e($, { className: "w-3 h-3" })
63
63
  }
64
64
  )
65
65
  ] }) : n ? /* @__PURE__ */ e(
@@ -68,12 +68,70 @@ function Q({
68
68
  type: "button",
69
69
  onClick: n,
70
70
  title: m,
71
- className: `${d} cursor-pointer transition-colors ${o ? "" : "hover:border-gray-300"}`,
72
- children: l
71
+ className: `${b} cursor-pointer transition-colors ${o ? "" : "hover:border-gray-300"}`,
72
+ children: s
73
+ }
74
+ ) : /* @__PURE__ */ e("span", { className: b, children: s });
75
+ }
76
+ function re({
77
+ segments: r,
78
+ onNavigate: t,
79
+ maxVisible: n = 5,
80
+ className: a = ""
81
+ }) {
82
+ const [o, m] = k(!1), s = !o && r.length > n, b = s ? r.slice(0, 1) : [], p = s ? r.length - n : 0, u = s ? r.slice(1 + p) : r, h = s ? 1 + p : 0, d = (i, c) => c === r.length - 1 ? /* @__PURE__ */ e(
83
+ "span",
84
+ {
85
+ "aria-current": "page",
86
+ className: "px-1.5 py-0.5 font-medium text-gray-900 truncate max-w-[16rem]",
87
+ children: i.label
88
+ },
89
+ i.key
90
+ ) : /* @__PURE__ */ e(
91
+ "button",
92
+ {
93
+ type: "button",
94
+ onClick: () => t(c),
95
+ className: "px-1.5 py-0.5 rounded text-gray-500 hover:text-gray-900 hover:bg-gray-100 transition-colors cursor-pointer truncate max-w-[12rem]",
96
+ children: i.label
97
+ },
98
+ i.key
99
+ );
100
+ return /* @__PURE__ */ l(
101
+ "nav",
102
+ {
103
+ "aria-label": "Breadcrumb",
104
+ className: `flex items-center gap-0.5 text-sm min-w-0 overflow-hidden ${a}`,
105
+ children: [
106
+ b.map((i, c) => /* @__PURE__ */ l("span", { className: "flex items-center gap-0.5 min-w-0", children: [
107
+ d(i, c),
108
+ /* @__PURE__ */ e(w, { className: "w-3.5 h-3.5 text-gray-300 flex-shrink-0" })
109
+ ] }, i.key)),
110
+ s && /* @__PURE__ */ l("span", { className: "flex items-center gap-0.5 flex-shrink-0", children: [
111
+ /* @__PURE__ */ e(
112
+ "button",
113
+ {
114
+ type: "button",
115
+ onClick: () => m(!0),
116
+ title: `Show ${p} hidden ${p === 1 ? "folder" : "folders"}`,
117
+ className: "px-1 py-0.5 rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors cursor-pointer",
118
+ children: /* @__PURE__ */ e(R, { className: "w-4 h-4" })
119
+ }
120
+ ),
121
+ /* @__PURE__ */ e(w, { className: "w-3.5 h-3.5 text-gray-300" })
122
+ ] }),
123
+ u.map((i, c) => {
124
+ const g = h + c;
125
+ return /* @__PURE__ */ l("span", { className: "flex items-center gap-0.5 min-w-0", children: [
126
+ d(i, g),
127
+ g < r.length - 1 && /* @__PURE__ */ e(w, { className: "w-3.5 h-3.5 text-gray-300 flex-shrink-0" })
128
+ ] }, i.key);
129
+ })
130
+ ]
73
131
  }
74
- ) : /* @__PURE__ */ e("span", { className: d, children: l });
132
+ );
75
133
  }
76
- const K = {
134
+ const P = {
77
135
  solid: {
78
136
  blue: "bg-blue-600 text-white hover:bg-blue-700",
79
137
  purple: "bg-purple-600 text-white hover:bg-purple-700",
@@ -98,57 +156,57 @@ const K = {
98
156
  orange: "text-orange-600 hover:bg-orange-50",
99
157
  gray: "text-gray-600 hover:bg-gray-100"
100
158
  }
101
- }, P = {
159
+ }, U = {
102
160
  sm: "px-2.5 py-1.5 text-xs gap-1.5",
103
161
  md: "px-3 py-2 text-sm gap-2"
104
- }, U = {
162
+ }, X = {
105
163
  solid: "shadow-sm hover:shadow-md",
106
164
  soft: "shadow-sm hover:shadow",
107
165
  ghost: ""
108
166
  };
109
- function X({
167
+ function F({
110
168
  variant: r = "soft",
111
169
  tone: t = "blue",
112
170
  size: n = "md",
113
171
  icon: a,
114
172
  loading: o = !1,
115
173
  disabled: m = !1,
116
- type: l = "button",
117
- title: d,
174
+ type: s = "button",
175
+ title: b,
118
176
  onClick: p,
119
- to: g,
177
+ to: u,
120
178
  href: h,
121
- target: i,
122
- className: b = "",
179
+ target: d,
180
+ className: i = "",
123
181
  children: c
124
182
  }) {
125
- const u = `inline-flex items-center justify-center font-medium rounded-lg transition-colors duration-100 cursor-pointer active:scale-[.98] ${P[n]} ${U[r]} ${K[r][t]} ${b}`, x = /* @__PURE__ */ s(v, { children: [
183
+ const g = `inline-flex items-center justify-center font-medium rounded-lg transition-colors duration-100 cursor-pointer active:scale-[.98] ${U[n]} ${X[r]} ${P[r][t]} ${i}`, x = /* @__PURE__ */ l(v, { children: [
126
184
  o ? /* @__PURE__ */ e(j, { className: "w-4 h-4 animate-spin" }) : a,
127
185
  c
128
186
  ] });
129
- return g ? /* @__PURE__ */ e(f, { to: g, className: u, title: d, children: x }) : h ? /* @__PURE__ */ e(
187
+ return u ? /* @__PURE__ */ e(f, { to: u, className: g, title: b, children: x }) : h ? /* @__PURE__ */ e(
130
188
  "a",
131
189
  {
132
190
  href: h,
133
- target: i,
134
- rel: i === "_blank" ? "noopener noreferrer" : void 0,
135
- className: u,
136
- title: d,
191
+ target: d,
192
+ rel: d === "_blank" ? "noopener noreferrer" : void 0,
193
+ className: g,
194
+ title: b,
137
195
  children: x
138
196
  }
139
197
  ) : /* @__PURE__ */ e(
140
198
  "button",
141
199
  {
142
- type: l,
200
+ type: s,
143
201
  onClick: p,
144
202
  disabled: m || o,
145
- title: d,
146
- className: `${u} disabled:opacity-50 disabled:cursor-not-allowed`,
203
+ title: b,
204
+ className: `${g} disabled:opacity-50 disabled:cursor-not-allowed`,
147
205
  children: x
148
206
  }
149
207
  );
150
208
  }
151
- function $({
209
+ function T({
152
210
  className: r = "",
153
211
  children: t
154
212
  }) {
@@ -160,27 +218,27 @@ function $({
160
218
  }
161
219
  );
162
220
  }
163
- function W({
221
+ function te({
164
222
  icon: r,
165
223
  title: t,
166
224
  theme: n,
167
225
  count: a,
168
226
  actions: o,
169
227
  bodyClassName: m = "p-5",
170
- className: l = "",
171
- children: d
228
+ className: s = "",
229
+ children: b
172
230
  }) {
173
- return /* @__PURE__ */ s($, { className: `overflow-hidden ${l}`, children: [
174
- /* @__PURE__ */ s(
231
+ return /* @__PURE__ */ l(T, { className: `overflow-hidden ${s}`, children: [
232
+ /* @__PURE__ */ l(
175
233
  "div",
176
234
  {
177
235
  className: `px-4 py-3 flex items-center justify-between border-b border-black/5 ${n.header}`,
178
236
  children: [
179
- /* @__PURE__ */ s("h4", { className: "text-sm font-semibold flex items-center", children: [
237
+ /* @__PURE__ */ l("h4", { className: "text-sm font-semibold flex items-center", children: [
180
238
  r && /* @__PURE__ */ e(r, { className: "w-4 h-4 mr-2" }),
181
239
  t
182
240
  ] }),
183
- (o || a !== void 0) && /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
241
+ (o || a !== void 0) && /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
184
242
  o,
185
243
  a !== void 0 && /* @__PURE__ */ e(
186
244
  "span",
@@ -193,29 +251,29 @@ function W({
193
251
  ]
194
252
  }
195
253
  ),
196
- /* @__PURE__ */ e("div", { className: m, children: d })
254
+ /* @__PURE__ */ e("div", { className: m, children: b })
197
255
  ] });
198
256
  }
199
- const z = {
257
+ const H = {
200
258
  red: { accent: "border-l-red-500", chip: "bg-red-50 text-red-600" },
201
259
  amber: { accent: "border-l-amber-500", chip: "bg-amber-50 text-amber-700" }
202
260
  };
203
- function ee({
261
+ function ne({
204
262
  tone: r = "red",
205
263
  title: t,
206
264
  severity: n,
207
265
  action: a,
208
266
  children: o
209
267
  }) {
210
- const { accent: m, chip: l } = z[r];
211
- return /* @__PURE__ */ e($, { className: `border-l-4 ${m} px-5 py-4`, children: /* @__PURE__ */ s("div", { className: "flex items-start justify-between gap-4", children: [
212
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
213
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2.5 flex-wrap", children: [
268
+ const { accent: m, chip: s } = H[r];
269
+ return /* @__PURE__ */ e(T, { className: `border-l-4 ${m} px-5 py-4`, children: /* @__PURE__ */ l("div", { className: "flex items-start justify-between gap-4", children: [
270
+ /* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
271
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-2.5 flex-wrap", children: [
214
272
  /* @__PURE__ */ e("h4", { className: "text-base font-semibold text-gray-900", children: t }),
215
273
  n && /* @__PURE__ */ e(
216
274
  "span",
217
275
  {
218
- className: `text-[11px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded ${l}`,
276
+ className: `text-[11px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded ${s}`,
219
277
  children: n
220
278
  }
221
279
  )
@@ -225,26 +283,26 @@ function ee({
225
283
  a && /* @__PURE__ */ e("div", { className: "shrink-0 text-sm", children: a })
226
284
  ] }) });
227
285
  }
228
- function re({
286
+ function ae({
229
287
  icon: r,
230
288
  title: t,
231
289
  count: n,
232
290
  theme: a,
233
291
  actions: o,
234
292
  footer: m,
235
- children: l
293
+ children: s
236
294
  }) {
237
- return /* @__PURE__ */ s($, { className: "overflow-hidden flex flex-col", children: [
238
- /* @__PURE__ */ s(
295
+ return /* @__PURE__ */ l(T, { className: "overflow-hidden flex flex-col", children: [
296
+ /* @__PURE__ */ l(
239
297
  "div",
240
298
  {
241
299
  className: `px-4 py-3 flex items-center justify-between border-b border-black/5 ${a.header}`,
242
300
  children: [
243
- /* @__PURE__ */ s("h4", { className: "text-sm font-semibold flex items-center", children: [
301
+ /* @__PURE__ */ l("h4", { className: "text-sm font-semibold flex items-center", children: [
244
302
  r && /* @__PURE__ */ e(r, { className: "w-4 h-4 mr-2" }),
245
303
  t
246
304
  ] }),
247
- /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
305
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
248
306
  o,
249
307
  n !== void 0 && /* @__PURE__ */ e(
250
308
  "span",
@@ -257,34 +315,34 @@ function re({
257
315
  ]
258
316
  }
259
317
  ),
260
- /* @__PURE__ */ e("div", { className: "divide-y divide-gray-100", children: l }),
318
+ /* @__PURE__ */ e("div", { className: "divide-y divide-gray-100", children: s }),
261
319
  m
262
320
  ] });
263
321
  }
264
- function te({
322
+ function oe({
265
323
  to: r,
266
324
  onClick: t,
267
325
  hover: n = "hover:bg-gray-50",
268
326
  className: a = "",
269
327
  children: o
270
328
  }) {
271
- const l = `flex items-center justify-between px-4 py-3 transition-colors ${n} ${!!(r || t) ? "cursor-pointer" : ""} ${a}`;
272
- return r ? /* @__PURE__ */ e(f, { to: r, className: l, children: o }) : t ? /* @__PURE__ */ e(
329
+ const s = `flex items-center justify-between px-4 py-3 transition-colors ${n} ${!!(r || t) ? "cursor-pointer" : ""} ${a}`;
330
+ return r ? /* @__PURE__ */ e(f, { to: r, className: s, children: o }) : t ? /* @__PURE__ */ e(
273
331
  "button",
274
332
  {
275
333
  type: "button",
276
334
  onClick: t,
277
- className: `w-full text-left ${l}`,
335
+ className: `w-full text-left ${s}`,
278
336
  children: o
279
337
  }
280
- ) : /* @__PURE__ */ e("div", { className: l, children: o });
338
+ ) : /* @__PURE__ */ e("div", { className: s, children: o });
281
339
  }
282
- function ne({
340
+ function se({
283
341
  to: r,
284
342
  count: t,
285
343
  noun: n = "items"
286
344
  }) {
287
- return /* @__PURE__ */ s(
345
+ return /* @__PURE__ */ l(
288
346
  f,
289
347
  {
290
348
  to: r,
@@ -299,15 +357,15 @@ function ne({
299
357
  }
300
358
  );
301
359
  }
302
- const F = (r) => `https://flagicons.lipis.dev/flags/4x3/${r.toLowerCase()}.svg`;
303
- function ae({
360
+ const V = (r) => `https://flagicons.lipis.dev/flags/4x3/${r.toLowerCase()}.svg`;
361
+ function le({
304
362
  countryCode: r,
305
363
  country: t
306
364
  }) {
307
365
  return r ? /* @__PURE__ */ e(
308
366
  "img",
309
367
  {
310
- src: F(r),
368
+ src: V(r),
311
369
  alt: t || "Country flag",
312
370
  className: "w-4 h-3 flex-shrink-0 rounded-sm ring-1 ring-black/5",
313
371
  onError: (n) => {
@@ -316,22 +374,22 @@ function ae({
316
374
  }
317
375
  ) : null;
318
376
  }
319
- function oe({
377
+ function ie({
320
378
  to: r,
321
379
  onClick: t,
322
380
  children: n
323
381
  }) {
324
- const a = "inline-flex items-center gap-2 text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors cursor-pointer", o = /* @__PURE__ */ s(v, { children: [
382
+ const a = "inline-flex items-center gap-2 text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors cursor-pointer", o = /* @__PURE__ */ l(v, { children: [
325
383
  /* @__PURE__ */ e(D, { className: "w-4 h-4" }),
326
384
  /* @__PURE__ */ e("span", { children: n })
327
385
  ] });
328
386
  return r ? /* @__PURE__ */ e(f, { to: r, className: a, children: o }) : /* @__PURE__ */ e("button", { type: "button", onClick: t, className: a, children: o });
329
387
  }
330
- function se({
388
+ function de({
331
389
  items: r,
332
390
  actions: t
333
391
  }) {
334
- return /* @__PURE__ */ s("div", { className: "border-b border-gray-200 flex items-end justify-between gap-4", children: [
392
+ return /* @__PURE__ */ l("div", { className: "border-b border-gray-200 flex items-end justify-between gap-4", children: [
335
393
  /* @__PURE__ */ e("nav", { className: "-mb-px flex space-x-8", children: r.map((n) => {
336
394
  const a = n.active ? "py-2 px-1 border-b-2 border-blue-500 text-blue-600 font-medium text-sm" : "py-2 px-1 border-b-2 border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 font-medium text-sm transition-colors cursor-pointer";
337
395
  return n.to && !n.active ? /* @__PURE__ */ e(
@@ -348,9 +406,9 @@ function se({
348
406
  t && /* @__PURE__ */ e("div", { className: "flex items-center gap-2 pb-1.5", children: t })
349
407
  ] });
350
408
  }
351
- function le({ items: r }) {
409
+ function ce({ items: r }) {
352
410
  return /* @__PURE__ */ e("nav", { className: "space-y-1", children: r.map((t) => {
353
- const n = t.icon, a = `group/side relative flex items-center gap-3 h-10 rounded-md px-3 text-sm transition-all duration-200 cursor-pointer ${t.active ? "bg-blue-50 text-blue-700 font-medium" : "text-gray-600 hover:bg-gray-100 hover:text-gray-900"}`, o = /* @__PURE__ */ s(v, { children: [
411
+ const n = t.icon, a = `group/side relative flex items-center gap-3 h-10 rounded-md px-3 text-sm transition-all duration-200 cursor-pointer ${t.active ? "bg-blue-50 text-blue-700 font-medium" : "text-gray-600 hover:bg-gray-100 hover:text-gray-900"}`, o = /* @__PURE__ */ l(v, { children: [
354
412
  /* @__PURE__ */ e(
355
413
  "span",
356
414
  {
@@ -363,63 +421,63 @@ function le({ items: r }) {
363
421
  return t.active ? /* @__PURE__ */ e("span", { className: a, "aria-current": "page", children: o }, t.to) : /* @__PURE__ */ e(f, { to: t.to, className: a, children: o }, t.to);
364
422
  }) });
365
423
  }
366
- function ie({
424
+ function ge({
367
425
  label: r,
368
426
  icon: t,
369
427
  iconClassName: n = "text-gray-400",
370
428
  children: a
371
429
  }) {
372
- return /* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-4", children: [
373
- /* @__PURE__ */ s("span", { className: "text-gray-700 flex items-center flex-shrink-0", children: [
430
+ return /* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-4", children: [
431
+ /* @__PURE__ */ l("span", { className: "text-gray-700 flex items-center flex-shrink-0", children: [
374
432
  t && /* @__PURE__ */ e(t, { className: `w-4 h-4 mr-2 ${n}` }),
375
433
  r
376
434
  ] }),
377
435
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-900 text-right min-w-0", children: a })
378
436
  ] });
379
437
  }
380
- const V = {
438
+ const Y = {
381
439
  blue: "text-blue-600",
382
440
  purple: "text-purple-600",
383
441
  red: "text-red-600",
384
442
  green: "text-green-600",
385
443
  orange: "text-orange-600",
386
444
  gray: "text-gray-500"
387
- }, L = "w-full flex items-start gap-3 px-3 py-2 text-left transition-colors hover:bg-gray-50 cursor-pointer";
388
- function de({
445
+ }, S = "w-full flex items-start gap-3 px-3 py-2 text-left transition-colors hover:bg-gray-50 cursor-pointer";
446
+ function be({
389
447
  label: r,
390
448
  items: t,
391
449
  icon: n,
392
450
  variant: a = "soft",
393
451
  tone: o = "gray",
394
452
  size: m = "md",
395
- align: l = "right",
396
- className: d = ""
453
+ align: s = "right",
454
+ className: b = ""
397
455
  }) {
398
- const [p, g] = M(!1), h = _(null);
399
- return A(() => {
456
+ const [p, u] = k(!1), h = A(null);
457
+ return O(() => {
400
458
  if (!p) return;
401
- const i = (c) => {
402
- var u;
403
- (u = h.current) != null && u.contains(c.target) || g(!1);
404
- }, b = (c) => {
405
- c.key === "Escape" && g(!1);
459
+ const d = (c) => {
460
+ var g;
461
+ (g = h.current) != null && g.contains(c.target) || u(!1);
462
+ }, i = (c) => {
463
+ c.key === "Escape" && u(!1);
406
464
  };
407
- return document.addEventListener("mousedown", i), document.addEventListener("keydown", b), () => {
408
- document.removeEventListener("mousedown", i), document.removeEventListener("keydown", b);
465
+ return document.addEventListener("mousedown", d), document.addEventListener("keydown", i), () => {
466
+ document.removeEventListener("mousedown", d), document.removeEventListener("keydown", i);
409
467
  };
410
- }, [p]), /* @__PURE__ */ s("div", { className: `relative ${d}`, ref: h, children: [
411
- /* @__PURE__ */ s(
412
- X,
468
+ }, [p]), /* @__PURE__ */ l("div", { className: `relative ${b}`, ref: h, children: [
469
+ /* @__PURE__ */ l(
470
+ F,
413
471
  {
414
472
  variant: a,
415
473
  tone: o,
416
474
  size: m,
417
475
  icon: n,
418
- onClick: () => g((i) => !i),
476
+ onClick: () => u((d) => !d),
419
477
  children: [
420
478
  r,
421
479
  /* @__PURE__ */ e(
422
- O,
480
+ B,
423
481
  {
424
482
  className: `w-4 h-4 transition-transform duration-200 ${p ? "rotate-180" : ""}`
425
483
  }
@@ -430,52 +488,52 @@ function de({
430
488
  p && /* @__PURE__ */ e(
431
489
  "div",
432
490
  {
433
- className: `absolute ${l === "right" ? "right-0" : "left-0"} mt-2 w-64 py-1 bg-white rounded-lg shadow-lg border border-gray-200 z-50 animate-dropdown-in`,
434
- children: t.map((i, b) => {
435
- const c = V[i.tone ?? "gray"], u = /* @__PURE__ */ s(v, { children: [
436
- i.icon && /* @__PURE__ */ e(
491
+ className: `absolute ${s === "right" ? "right-0" : "left-0"} mt-2 w-64 py-1 bg-white rounded-lg shadow-lg border border-gray-200 z-50 animate-dropdown-in`,
492
+ children: t.map((d, i) => {
493
+ const c = Y[d.tone ?? "gray"], g = /* @__PURE__ */ l(v, { children: [
494
+ d.icon && /* @__PURE__ */ e(
437
495
  "span",
438
496
  {
439
497
  className: `flex items-center gap-1 mt-0.5 flex-shrink-0 ${c}`,
440
- children: i.icon
498
+ children: d.icon
441
499
  }
442
500
  ),
443
- /* @__PURE__ */ s("span", { className: "min-w-0", children: [
444
- /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-gray-900", children: i.label }),
445
- i.description && /* @__PURE__ */ e("span", { className: "block text-xs text-gray-500 mt-0.5 break-all", children: i.description })
501
+ /* @__PURE__ */ l("span", { className: "min-w-0", children: [
502
+ /* @__PURE__ */ e("span", { className: "block text-sm font-medium text-gray-900", children: d.label }),
503
+ d.description && /* @__PURE__ */ e("span", { className: "block text-xs text-gray-500 mt-0.5 break-all", children: d.description })
446
504
  ] })
447
505
  ] });
448
- return i.href ? /* @__PURE__ */ e(
506
+ return d.href ? /* @__PURE__ */ e(
449
507
  "a",
450
508
  {
451
- href: i.href,
452
- target: i.target,
453
- rel: i.target === "_blank" ? "noopener noreferrer" : void 0,
454
- className: L,
455
- onClick: () => g(!1),
456
- children: u
509
+ href: d.href,
510
+ target: d.target,
511
+ rel: d.target === "_blank" ? "noopener noreferrer" : void 0,
512
+ className: S,
513
+ onClick: () => u(!1),
514
+ children: g
457
515
  },
458
- b
516
+ i
459
517
  ) : /* @__PURE__ */ e(
460
518
  "button",
461
519
  {
462
520
  type: "button",
463
- disabled: i.disabled,
521
+ disabled: d.disabled,
464
522
  onClick: () => {
465
523
  var x;
466
- i.keepOpen || g(!1), (x = i.onClick) == null || x.call(i);
524
+ d.keepOpen || u(!1), (x = d.onClick) == null || x.call(d);
467
525
  },
468
- className: `${L} disabled:opacity-50 disabled:cursor-not-allowed`,
469
- children: u
526
+ className: `${S} disabled:opacity-50 disabled:cursor-not-allowed`,
527
+ children: g
470
528
  },
471
- b
529
+ i
472
530
  );
473
531
  })
474
532
  }
475
533
  )
476
534
  ] });
477
535
  }
478
- function ce({
536
+ function ue({
479
537
  className: r = "space-y-6",
480
538
  children: t
481
539
  }) {
@@ -487,32 +545,32 @@ function ce({
487
545
  }
488
546
  );
489
547
  }
490
- function ge({
548
+ function me({
491
549
  value: r,
492
550
  onChange: t,
493
551
  placeholder: n = "Search...",
494
552
  className: a = "w-full",
495
553
  slashToFocus: o = !1
496
554
  }) {
497
- const m = _(null);
498
- return A(() => {
555
+ const m = A(null);
556
+ return O(() => {
499
557
  if (!o) return;
500
- function l(d) {
501
- var g;
502
- if (d.key !== "/" || d.ctrlKey || d.metaKey || d.altKey) return;
503
- const p = d.target;
504
- p.tagName === "INPUT" || p.tagName === "TEXTAREA" || p.tagName === "SELECT" || p.isContentEditable || (d.preventDefault(), (g = m.current) == null || g.focus());
558
+ function s(b) {
559
+ var u;
560
+ if (b.key !== "/" || b.ctrlKey || b.metaKey || b.altKey) return;
561
+ const p = b.target;
562
+ p.tagName === "INPUT" || p.tagName === "TEXTAREA" || p.tagName === "SELECT" || p.isContentEditable || (b.preventDefault(), (u = m.current) == null || u.focus());
505
563
  }
506
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
507
- }, [o]), /* @__PURE__ */ s("div", { className: `relative ${a}`, children: [
508
- /* @__PURE__ */ e(R, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 w-4 h-4 pointer-events-none" }),
564
+ return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
565
+ }, [o]), /* @__PURE__ */ l("div", { className: `relative ${a}`, children: [
566
+ /* @__PURE__ */ e(I, { className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 w-4 h-4 pointer-events-none" }),
509
567
  /* @__PURE__ */ e(
510
568
  "input",
511
569
  {
512
570
  ref: m,
513
571
  type: "text",
514
572
  value: r,
515
- onChange: (l) => t(l.target.value),
573
+ onChange: (s) => t(s.target.value),
516
574
  placeholder: n,
517
575
  className: "w-full pl-10 pr-10 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm text-gray-900 placeholder-gray-400"
518
576
  }
@@ -520,7 +578,7 @@ function ge({
520
578
  o && !r && /* @__PURE__ */ e("kbd", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 text-xs border border-gray-300 rounded px-1 py-0.5 font-mono leading-none pointer-events-none", children: "/" })
521
579
  ] });
522
580
  }
523
- const H = {
581
+ const G = {
524
582
  neutral: { badge: "bg-gray-100", icon: "text-gray-400" },
525
583
  green: { badge: "bg-green-100", icon: "text-green-600" },
526
584
  blue: { badge: "bg-blue-100", icon: "text-blue-600" },
@@ -528,14 +586,14 @@ const H = {
528
586
  red: { badge: "bg-red-100", icon: "text-red-600" },
529
587
  purple: { badge: "bg-purple-100", icon: "text-purple-600" }
530
588
  };
531
- function be({
589
+ function pe({
532
590
  icon: r,
533
591
  label: t,
534
592
  value: n,
535
593
  tone: a = "neutral"
536
594
  }) {
537
- const o = H[a];
538
- return /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
595
+ const o = G[a];
596
+ return /* @__PURE__ */ l("div", { className: "flex items-center gap-4", children: [
539
597
  /* @__PURE__ */ e(
540
598
  "div",
541
599
  {
@@ -543,18 +601,18 @@ function be({
543
601
  children: /* @__PURE__ */ e(r, { className: `w-6 h-6 ${o.icon}` })
544
602
  }
545
603
  ),
546
- /* @__PURE__ */ s("div", { children: [
604
+ /* @__PURE__ */ l("div", { children: [
547
605
  /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500", children: t }),
548
606
  /* @__PURE__ */ e("p", { className: "text-3xl font-bold text-gray-900 tabular-nums", children: n })
549
607
  ] })
550
608
  ] });
551
609
  }
552
- const S = {
610
+ const M = {
553
611
  ok: "bg-green-500",
554
612
  down: "bg-red-500",
555
613
  unknown: "bg-gray-300"
556
- }, C = (r) => `${(r * 100).toFixed(4)}%`;
557
- function ue({
614
+ }, _ = (r) => `${(r * 100).toFixed(4)}%`;
615
+ function he({
558
616
  from: r,
559
617
  to: t,
560
618
  spans: n,
@@ -562,14 +620,14 @@ function ue({
562
620
  height: o = "1.75rem",
563
621
  renderTooltip: m
564
622
  }) {
565
- const [l, d] = M(null), p = r.getTime(), g = t.getTime() - p;
566
- if (!(g > 0)) return null;
567
- const h = g / a, i = Array.from({ length: a }, (c, u) => {
568
- const x = p + u * h, N = x + h;
623
+ const [s, b] = k(null), p = r.getTime(), u = t.getTime() - p;
624
+ if (!(u > 0)) return null;
625
+ const h = u / a, d = Array.from({ length: a }, (c, g) => {
626
+ const x = p + g * h, N = x + h;
569
627
  let y = 0;
570
- for (const T of n) {
571
- const k = Math.max(T.start.getTime(), x), E = Math.min(T.end.getTime(), N);
572
- E > k && (y += E - k);
628
+ for (const E of n) {
629
+ const L = Math.max(E.start.getTime(), x), C = Math.min(E.end.getTime(), N);
630
+ C > L && (y += C - L);
573
631
  }
574
632
  return {
575
633
  start: new Date(x),
@@ -578,16 +636,16 @@ function ue({
578
636
  ratio: 1 - y / h
579
637
  };
580
638
  });
581
- return /* @__PURE__ */ s("div", { className: "relative", children: [
582
- l !== null && m && /* @__PURE__ */ e(
639
+ return /* @__PURE__ */ l("div", { className: "relative", children: [
640
+ s !== null && m && /* @__PURE__ */ e(
583
641
  "div",
584
642
  {
585
643
  className: "pointer-events-none absolute bottom-full z-10 mb-2 whitespace-nowrap rounded-md bg-gray-900 px-2 py-1.5 text-[11px] leading-tight text-white shadow-lg",
586
644
  style: ((c) => {
587
- const u = (c + 0.5) / a;
588
- return u < 0.15 ? { left: 0 } : u > 0.85 ? { right: 0 } : { left: `${u * 100}%`, transform: "translateX(-50%)" };
589
- })(l),
590
- children: m(i[l])
645
+ const g = (c + 0.5) / a;
646
+ return g < 0.15 ? { left: 0 } : g > 0.85 ? { right: 0 } : { left: `${g * 100}%`, transform: "translateX(-50%)" };
647
+ })(s),
648
+ children: m(d[s])
591
649
  }
592
650
  ),
593
651
  /* @__PURE__ */ e(
@@ -595,12 +653,12 @@ function ue({
595
653
  {
596
654
  className: "flex items-stretch gap-[2px]",
597
655
  style: { height: o },
598
- onMouseLeave: () => d(null),
599
- children: i.map((c, u) => /* @__PURE__ */ e(
656
+ onMouseLeave: () => b(null),
657
+ children: d.map((c, g) => /* @__PURE__ */ e(
600
658
  "div",
601
659
  {
602
- onMouseEnter: () => d(u),
603
- className: `relative min-w-[2px] flex-1 cursor-pointer overflow-hidden rounded-[2px] bg-emerald-500 transition-opacity ${l === u ? "opacity-60" : ""}`,
660
+ onMouseEnter: () => b(g),
661
+ className: `relative min-w-[2px] flex-1 cursor-pointer overflow-hidden rounded-[2px] bg-emerald-500 transition-opacity ${s === g ? "opacity-60" : ""}`,
604
662
  children: c.downMs > 0 && /* @__PURE__ */ e(
605
663
  "div",
606
664
  {
@@ -615,51 +673,51 @@ function ue({
615
673
  )
616
674
  ] });
617
675
  }
618
- function me({
676
+ function xe({
619
677
  from: r,
620
678
  to: t,
621
679
  lanes: n,
622
680
  baseline: a = "ok",
623
681
  ticks: o = 5,
624
- formatTick: m = (g) => g.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
625
- labelWidth: l = "8rem",
626
- rowHeight: d = "1.25rem",
682
+ formatTick: m = (u) => u.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
683
+ labelWidth: s = "8rem",
684
+ rowHeight: b = "1.25rem",
627
685
  emptyLabel: p = "No data"
628
686
  }) {
629
- const g = r.getTime(), h = t.getTime() - g;
687
+ const u = r.getTime(), h = t.getTime() - u;
630
688
  if (!(h > 0) || n.length === 0)
631
689
  return /* @__PURE__ */ e("div", { className: "py-8 text-center text-sm text-gray-500", children: p });
632
- const i = Array.from(
690
+ const d = Array.from(
633
691
  { length: Math.max(2, o) },
634
- (b, c) => new Date(g + h * c / (Math.max(2, o) - 1))
692
+ (i, c) => new Date(u + h * c / (Math.max(2, o) - 1))
635
693
  );
636
- return /* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
637
- n.map((b) => /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
694
+ return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
695
+ n.map((i) => /* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
638
696
  /* @__PURE__ */ e(
639
697
  "div",
640
698
  {
641
699
  className: "shrink-0 truncate font-mono text-xs text-gray-600",
642
- style: { width: l },
643
- title: b.name,
644
- children: b.label ?? b.name
700
+ style: { width: s },
701
+ title: i.name,
702
+ children: i.label ?? i.name
645
703
  }
646
704
  ),
647
705
  /* @__PURE__ */ e(
648
706
  "div",
649
707
  {
650
- className: `relative flex-1 overflow-hidden rounded-sm ${S[a]}`,
651
- style: { height: d },
652
- children: b.spans.map((c) => {
653
- const u = Math.max(c.start.getTime(), g), x = Math.min(c.end.getTime(), g + h);
654
- if (x <= u) return null;
655
- const N = (u - g) / h, y = (x - u) / h;
708
+ className: `relative flex-1 overflow-hidden rounded-sm ${M[a]}`,
709
+ style: { height: b },
710
+ children: i.spans.map((c) => {
711
+ const g = Math.max(c.start.getTime(), u), x = Math.min(c.end.getTime(), u + h);
712
+ if (x <= g) return null;
713
+ const N = (g - u) / h, y = (x - g) / h;
656
714
  return /* @__PURE__ */ e(
657
715
  "div",
658
716
  {
659
- className: `absolute inset-y-0 ${S[c.tone]}`,
717
+ className: `absolute inset-y-0 ${M[c.tone]}`,
660
718
  style: {
661
- left: C(N),
662
- width: `max(2px, ${C(y)})`
719
+ left: _(N),
720
+ width: `max(2px, ${_(y)})`
663
721
  },
664
722
  title: c.label
665
723
  },
@@ -668,23 +726,23 @@ function me({
668
726
  })
669
727
  }
670
728
  ),
671
- b.trailing !== void 0 && /* @__PURE__ */ e("div", { className: "w-16 shrink-0 text-right font-mono text-xs tabular-nums text-gray-600", children: b.trailing })
672
- ] }, b.name)),
729
+ i.trailing !== void 0 && /* @__PURE__ */ e("div", { className: "w-16 shrink-0 text-right font-mono text-xs tabular-nums text-gray-600", children: i.trailing })
730
+ ] }, i.name)),
673
731
  /* @__PURE__ */ e(
674
732
  "div",
675
733
  {
676
734
  className: "flex justify-between pt-1 text-[11px] tabular-nums text-gray-400",
677
735
  style: {
678
- marginLeft: l,
736
+ marginLeft: s,
679
737
  paddingLeft: "0.75rem",
680
- marginRight: n.some((b) => b.trailing !== void 0) ? "4rem" : void 0
738
+ marginRight: n.some((i) => i.trailing !== void 0) ? "4rem" : void 0
681
739
  },
682
- children: i.map((b) => /* @__PURE__ */ e("span", { children: m(b) }, b.getTime()))
740
+ children: d.map((i) => /* @__PURE__ */ e("span", { children: m(i) }, i.getTime()))
683
741
  }
684
742
  )
685
743
  ] });
686
744
  }
687
- const pe = {
745
+ const fe = {
688
746
  blue: {
689
747
  header: "bg-blue-50 text-blue-800",
690
748
  hover: "hover:bg-blue-50",
@@ -726,7 +784,7 @@ const pe = {
726
784
  badge: "bg-gray-200 text-gray-700"
727
785
  }
728
786
  };
729
- function he({
787
+ function ye({
730
788
  toast: r,
731
789
  onClose: t
732
790
  }) {
@@ -734,8 +792,8 @@ function he({
734
792
  "div",
735
793
  {
736
794
  className: `fixed top-4 right-4 z-50 p-4 rounded-lg shadow-lg border transition-all duration-300 ease-in-out ${r.type === "success" ? "bg-green-50 text-green-800 border-green-200" : "bg-red-50 text-red-800 border-red-200"}`,
737
- children: /* @__PURE__ */ s("div", { className: "flex items-center space-x-2", children: [
738
- r.type === "success" ? /* @__PURE__ */ e(B, { className: "w-5 h-5 text-green-600" }) : /* @__PURE__ */ e(w, { className: "w-5 h-5 text-red-600" }),
795
+ children: /* @__PURE__ */ l("div", { className: "flex items-center space-x-2", children: [
796
+ r.type === "success" ? /* @__PURE__ */ e(K, { className: "w-5 h-5 text-green-600" }) : /* @__PURE__ */ e($, { className: "w-5 h-5 text-red-600" }),
739
797
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: r.message }),
740
798
  /* @__PURE__ */ e(
741
799
  "button",
@@ -743,7 +801,7 @@ function he({
743
801
  type: "button",
744
802
  onClick: t,
745
803
  className: "ml-2 text-gray-400 hover:text-gray-600 cursor-pointer",
746
- children: /* @__PURE__ */ e(w, { className: "w-4 h-4" })
804
+ children: /* @__PURE__ */ e($, { className: "w-4 h-4" })
747
805
  }
748
806
  )
749
807
  ] })
@@ -751,27 +809,28 @@ function he({
751
809
  ) : null;
752
810
  }
753
811
  export {
754
- ee as AlertBanner,
755
- I as BADGE_COLORS,
756
- oe as BackLink,
757
- J as Badge,
758
- X as Button,
759
- $ as Card,
760
- ae as CountryFlag,
761
- de as DropdownMenu,
762
- ie as InfoRow,
763
- Q as LabelChip,
764
- te as ListRow,
765
- ce as PageContainer,
766
- W as Panel,
767
- pe as SECTION_THEMES,
768
- ge as SearchInput,
769
- re as SectionCard,
770
- le as SideNav,
771
- be as StatCard,
772
- me as StateTimeline,
773
- se as TabNav,
774
- he as Toast,
775
- ue as UptimeBars,
776
- ne as ViewAllFooter
812
+ ne as AlertBanner,
813
+ z as BADGE_COLORS,
814
+ ie as BackLink,
815
+ W as Badge,
816
+ re as Breadcrumbs,
817
+ F as Button,
818
+ T as Card,
819
+ le as CountryFlag,
820
+ be as DropdownMenu,
821
+ ge as InfoRow,
822
+ ee as LabelChip,
823
+ oe as ListRow,
824
+ ue as PageContainer,
825
+ te as Panel,
826
+ fe as SECTION_THEMES,
827
+ me as SearchInput,
828
+ ae as SectionCard,
829
+ ce as SideNav,
830
+ pe as StatCard,
831
+ xe as StateTimeline,
832
+ de as TabNav,
833
+ ye as Toast,
834
+ he as UptimeBars,
835
+ se as ViewAllFooter
777
836
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teton/smith-ui",
3
- "version": "0.2.181",
3
+ "version": "0.2.183",
4
4
  "description": "Smith dashboard design-system primitives (React + Tailwind CSS v4).",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {