@teton/smith-ui 0.2.185 → 0.2.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +75 -54
- package/dist/select.d.ts +12 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { BackLink, InfoRow, SideNav, type SideNavItem, type TabItem, TabNav, } f
|
|
|
7
7
|
export { type DropdownItem, DropdownMenu } from './dropdown';
|
|
8
8
|
export { PageContainer } from './page-container';
|
|
9
9
|
export { SearchInput } from './search-input';
|
|
10
|
+
export { Select } from './select';
|
|
10
11
|
export { StatCard } from './stat-card';
|
|
11
12
|
export { StateTimeline, type TimelineLane, type TimelineSpan, type TimelineTone, UptimeBars, type UptimeBucket, } from './state-timeline';
|
|
12
13
|
export { type IconComponent, SECTION_THEMES, type SectionTheme, type SectionThemeName, } from './theme';
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ function ee({
|
|
|
31
31
|
onClick: n,
|
|
32
32
|
onRemove: a,
|
|
33
33
|
active: o = !1,
|
|
34
|
-
title:
|
|
34
|
+
title: u
|
|
35
35
|
}) {
|
|
36
36
|
const s = /* @__PURE__ */ l(v, { children: [
|
|
37
37
|
/* @__PURE__ */ e(
|
|
@@ -56,7 +56,7 @@ function ee({
|
|
|
56
56
|
{
|
|
57
57
|
type: "button",
|
|
58
58
|
onClick: a,
|
|
59
|
-
title:
|
|
59
|
+
title: u,
|
|
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
62
|
children: /* @__PURE__ */ e($, { className: "w-3 h-3" })
|
|
@@ -67,7 +67,7 @@ function ee({
|
|
|
67
67
|
{
|
|
68
68
|
type: "button",
|
|
69
69
|
onClick: n,
|
|
70
|
-
title:
|
|
70
|
+
title: u,
|
|
71
71
|
className: `${b} cursor-pointer transition-colors ${o ? "" : "hover:border-gray-300"}`,
|
|
72
72
|
children: s
|
|
73
73
|
}
|
|
@@ -79,7 +79,7 @@ function re({
|
|
|
79
79
|
maxVisible: n = 5,
|
|
80
80
|
className: a = ""
|
|
81
81
|
}) {
|
|
82
|
-
const [o,
|
|
82
|
+
const [o, u] = k(!1), s = !o && r.length > n, b = s ? r.slice(0, 1) : [], p = s ? r.length - n : 0, m = s ? r.slice(1 + p) : r, h = s ? 1 + p : 0, d = (i, c) => c === r.length - 1 ? /* @__PURE__ */ e(
|
|
83
83
|
"span",
|
|
84
84
|
{
|
|
85
85
|
"aria-current": "page",
|
|
@@ -112,7 +112,7 @@ function re({
|
|
|
112
112
|
"button",
|
|
113
113
|
{
|
|
114
114
|
type: "button",
|
|
115
|
-
onClick: () =>
|
|
115
|
+
onClick: () => u(!0),
|
|
116
116
|
title: `Show ${p} hidden ${p === 1 ? "folder" : "folders"}`,
|
|
117
117
|
className: "px-1 py-0.5 rounded text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors cursor-pointer",
|
|
118
118
|
children: /* @__PURE__ */ e(R, { className: "w-4 h-4" })
|
|
@@ -120,7 +120,7 @@ function re({
|
|
|
120
120
|
),
|
|
121
121
|
/* @__PURE__ */ e(w, { className: "w-3.5 h-3.5 text-gray-300" })
|
|
122
122
|
] }),
|
|
123
|
-
|
|
123
|
+
m.map((i, c) => {
|
|
124
124
|
const g = h + c;
|
|
125
125
|
return /* @__PURE__ */ l("span", { className: "flex items-center gap-0.5 min-w-0", children: [
|
|
126
126
|
d(i, g),
|
|
@@ -170,11 +170,11 @@ function F({
|
|
|
170
170
|
size: n = "md",
|
|
171
171
|
icon: a,
|
|
172
172
|
loading: o = !1,
|
|
173
|
-
disabled:
|
|
173
|
+
disabled: u = !1,
|
|
174
174
|
type: s = "button",
|
|
175
175
|
title: b,
|
|
176
176
|
onClick: p,
|
|
177
|
-
to:
|
|
177
|
+
to: m,
|
|
178
178
|
href: h,
|
|
179
179
|
target: d,
|
|
180
180
|
className: i = "",
|
|
@@ -184,7 +184,7 @@ function F({
|
|
|
184
184
|
o ? /* @__PURE__ */ e(j, { className: "w-4 h-4 animate-spin" }) : a,
|
|
185
185
|
c
|
|
186
186
|
] });
|
|
187
|
-
return
|
|
187
|
+
return m ? /* @__PURE__ */ e(f, { to: m, className: g, title: b, children: x }) : h ? /* @__PURE__ */ e(
|
|
188
188
|
"a",
|
|
189
189
|
{
|
|
190
190
|
href: h,
|
|
@@ -199,7 +199,7 @@ function F({
|
|
|
199
199
|
{
|
|
200
200
|
type: s,
|
|
201
201
|
onClick: p,
|
|
202
|
-
disabled:
|
|
202
|
+
disabled: u || o,
|
|
203
203
|
title: b,
|
|
204
204
|
className: `${g} disabled:opacity-50 disabled:cursor-not-allowed`,
|
|
205
205
|
children: x
|
|
@@ -224,7 +224,7 @@ function te({
|
|
|
224
224
|
theme: n,
|
|
225
225
|
count: a,
|
|
226
226
|
actions: o,
|
|
227
|
-
bodyClassName:
|
|
227
|
+
bodyClassName: u = "p-5",
|
|
228
228
|
className: s = "",
|
|
229
229
|
children: b
|
|
230
230
|
}) {
|
|
@@ -251,7 +251,7 @@ function te({
|
|
|
251
251
|
]
|
|
252
252
|
}
|
|
253
253
|
),
|
|
254
|
-
/* @__PURE__ */ e("div", { className:
|
|
254
|
+
/* @__PURE__ */ e("div", { className: u, children: b })
|
|
255
255
|
] });
|
|
256
256
|
}
|
|
257
257
|
const H = {
|
|
@@ -265,8 +265,8 @@ function ne({
|
|
|
265
265
|
action: a,
|
|
266
266
|
children: o
|
|
267
267
|
}) {
|
|
268
|
-
const { accent:
|
|
269
|
-
return /* @__PURE__ */ e(T, { className: `border-l-4 ${
|
|
268
|
+
const { accent: u, chip: s } = H[r];
|
|
269
|
+
return /* @__PURE__ */ e(T, { className: `border-l-4 ${u} px-5 py-4`, children: /* @__PURE__ */ l("div", { className: "flex items-start justify-between gap-4", children: [
|
|
270
270
|
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
|
|
271
271
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2.5 flex-wrap", children: [
|
|
272
272
|
/* @__PURE__ */ e("h4", { className: "text-base font-semibold text-gray-900", children: t }),
|
|
@@ -289,7 +289,7 @@ function ae({
|
|
|
289
289
|
count: n,
|
|
290
290
|
theme: a,
|
|
291
291
|
actions: o,
|
|
292
|
-
footer:
|
|
292
|
+
footer: u,
|
|
293
293
|
children: s
|
|
294
294
|
}) {
|
|
295
295
|
return /* @__PURE__ */ l(T, { className: "overflow-hidden flex flex-col", children: [
|
|
@@ -316,7 +316,7 @@ function ae({
|
|
|
316
316
|
}
|
|
317
317
|
),
|
|
318
318
|
/* @__PURE__ */ e("div", { className: "divide-y divide-gray-100", children: s }),
|
|
319
|
-
|
|
319
|
+
u
|
|
320
320
|
] });
|
|
321
321
|
}
|
|
322
322
|
function oe({
|
|
@@ -443,24 +443,24 @@ const Y = {
|
|
|
443
443
|
orange: "text-orange-600",
|
|
444
444
|
gray: "text-gray-500"
|
|
445
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
|
|
446
|
+
function ue({
|
|
447
447
|
label: r,
|
|
448
448
|
items: t,
|
|
449
449
|
icon: n,
|
|
450
450
|
variant: a = "soft",
|
|
451
451
|
tone: o = "gray",
|
|
452
|
-
size:
|
|
452
|
+
size: u = "md",
|
|
453
453
|
align: s = "right",
|
|
454
454
|
className: b = ""
|
|
455
455
|
}) {
|
|
456
|
-
const [p,
|
|
456
|
+
const [p, m] = k(!1), h = A(null);
|
|
457
457
|
return O(() => {
|
|
458
458
|
if (!p) return;
|
|
459
459
|
const d = (c) => {
|
|
460
460
|
var g;
|
|
461
|
-
(g = h.current) != null && g.contains(c.target) ||
|
|
461
|
+
(g = h.current) != null && g.contains(c.target) || m(!1);
|
|
462
462
|
}, i = (c) => {
|
|
463
|
-
c.key === "Escape" &&
|
|
463
|
+
c.key === "Escape" && m(!1);
|
|
464
464
|
};
|
|
465
465
|
return document.addEventListener("mousedown", d), document.addEventListener("keydown", i), () => {
|
|
466
466
|
document.removeEventListener("mousedown", d), document.removeEventListener("keydown", i);
|
|
@@ -471,9 +471,9 @@ function be({
|
|
|
471
471
|
{
|
|
472
472
|
variant: a,
|
|
473
473
|
tone: o,
|
|
474
|
-
size:
|
|
474
|
+
size: u,
|
|
475
475
|
icon: n,
|
|
476
|
-
onClick: () =>
|
|
476
|
+
onClick: () => m((d) => !d),
|
|
477
477
|
children: [
|
|
478
478
|
r,
|
|
479
479
|
/* @__PURE__ */ e(
|
|
@@ -510,7 +510,7 @@ function be({
|
|
|
510
510
|
target: d.target,
|
|
511
511
|
rel: d.target === "_blank" ? "noopener noreferrer" : void 0,
|
|
512
512
|
className: S,
|
|
513
|
-
onClick: () =>
|
|
513
|
+
onClick: () => m(!1),
|
|
514
514
|
children: g
|
|
515
515
|
},
|
|
516
516
|
i
|
|
@@ -521,7 +521,7 @@ function be({
|
|
|
521
521
|
disabled: d.disabled,
|
|
522
522
|
onClick: () => {
|
|
523
523
|
var x;
|
|
524
|
-
d.keepOpen ||
|
|
524
|
+
d.keepOpen || m(!1), (x = d.onClick) == null || x.call(d);
|
|
525
525
|
},
|
|
526
526
|
className: `${S} disabled:opacity-50 disabled:cursor-not-allowed`,
|
|
527
527
|
children: g
|
|
@@ -533,7 +533,7 @@ function be({
|
|
|
533
533
|
)
|
|
534
534
|
] });
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function be({
|
|
537
537
|
className: r = "space-y-6",
|
|
538
538
|
children: t
|
|
539
539
|
}) {
|
|
@@ -552,14 +552,14 @@ function me({
|
|
|
552
552
|
className: a = "w-full",
|
|
553
553
|
slashToFocus: o = !1
|
|
554
554
|
}) {
|
|
555
|
-
const
|
|
555
|
+
const u = A(null);
|
|
556
556
|
return O(() => {
|
|
557
557
|
if (!o) return;
|
|
558
558
|
function s(b) {
|
|
559
|
-
var
|
|
559
|
+
var m;
|
|
560
560
|
if (b.key !== "/" || b.ctrlKey || b.metaKey || b.altKey) return;
|
|
561
561
|
const p = b.target;
|
|
562
|
-
p.tagName === "INPUT" || p.tagName === "TEXTAREA" || p.tagName === "SELECT" || p.isContentEditable || (b.preventDefault(), (
|
|
562
|
+
p.tagName === "INPUT" || p.tagName === "TEXTAREA" || p.tagName === "SELECT" || p.isContentEditable || (b.preventDefault(), (m = u.current) == null || m.focus());
|
|
563
563
|
}
|
|
564
564
|
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
565
565
|
}, [o]), /* @__PURE__ */ l("div", { className: `relative ${a}`, children: [
|
|
@@ -567,7 +567,7 @@ function me({
|
|
|
567
567
|
/* @__PURE__ */ e(
|
|
568
568
|
"input",
|
|
569
569
|
{
|
|
570
|
-
ref:
|
|
570
|
+
ref: u,
|
|
571
571
|
type: "text",
|
|
572
572
|
value: r,
|
|
573
573
|
onChange: (s) => t(s.target.value),
|
|
@@ -578,6 +578,26 @@ function me({
|
|
|
578
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: "/" })
|
|
579
579
|
] });
|
|
580
580
|
}
|
|
581
|
+
function pe({
|
|
582
|
+
value: r,
|
|
583
|
+
onChange: t,
|
|
584
|
+
children: n,
|
|
585
|
+
id: a,
|
|
586
|
+
className: o = "w-auto",
|
|
587
|
+
disabled: u = !1
|
|
588
|
+
}) {
|
|
589
|
+
return /* @__PURE__ */ e(
|
|
590
|
+
"select",
|
|
591
|
+
{
|
|
592
|
+
id: a,
|
|
593
|
+
value: r,
|
|
594
|
+
onChange: (s) => t(s.target.value),
|
|
595
|
+
disabled: u,
|
|
596
|
+
className: `px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 text-sm disabled:opacity-50 ${o}`,
|
|
597
|
+
children: n
|
|
598
|
+
}
|
|
599
|
+
);
|
|
600
|
+
}
|
|
581
601
|
const G = {
|
|
582
602
|
neutral: { badge: "bg-gray-100", icon: "text-gray-400" },
|
|
583
603
|
green: { badge: "bg-green-100", icon: "text-green-600" },
|
|
@@ -586,7 +606,7 @@ const G = {
|
|
|
586
606
|
red: { badge: "bg-red-100", icon: "text-red-600" },
|
|
587
607
|
purple: { badge: "bg-purple-100", icon: "text-purple-600" }
|
|
588
608
|
};
|
|
589
|
-
function
|
|
609
|
+
function he({
|
|
590
610
|
icon: r,
|
|
591
611
|
label: t,
|
|
592
612
|
value: n,
|
|
@@ -612,17 +632,17 @@ const M = {
|
|
|
612
632
|
down: "bg-red-500",
|
|
613
633
|
unknown: "bg-gray-300"
|
|
614
634
|
}, _ = (r) => `${(r * 100).toFixed(4)}%`;
|
|
615
|
-
function
|
|
635
|
+
function xe({
|
|
616
636
|
from: r,
|
|
617
637
|
to: t,
|
|
618
638
|
spans: n,
|
|
619
639
|
buckets: a = 48,
|
|
620
640
|
height: o = "1.75rem",
|
|
621
|
-
renderTooltip:
|
|
641
|
+
renderTooltip: u
|
|
622
642
|
}) {
|
|
623
|
-
const [s, b] = k(null), p = r.getTime(),
|
|
624
|
-
if (!(
|
|
625
|
-
const h =
|
|
643
|
+
const [s, b] = k(null), p = r.getTime(), m = t.getTime() - p;
|
|
644
|
+
if (!(m > 0)) return null;
|
|
645
|
+
const h = m / a, d = Array.from({ length: a }, (c, g) => {
|
|
626
646
|
const x = p + g * h, N = x + h;
|
|
627
647
|
let y = 0;
|
|
628
648
|
for (const E of n) {
|
|
@@ -637,7 +657,7 @@ function he({
|
|
|
637
657
|
};
|
|
638
658
|
});
|
|
639
659
|
return /* @__PURE__ */ l("div", { className: "relative", children: [
|
|
640
|
-
s !== null &&
|
|
660
|
+
s !== null && u && /* @__PURE__ */ e(
|
|
641
661
|
"div",
|
|
642
662
|
{
|
|
643
663
|
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",
|
|
@@ -645,7 +665,7 @@ function he({
|
|
|
645
665
|
const g = (c + 0.5) / a;
|
|
646
666
|
return g < 0.15 ? { left: 0 } : g > 0.85 ? { right: 0 } : { left: `${g * 100}%`, transform: "translateX(-50%)" };
|
|
647
667
|
})(s),
|
|
648
|
-
children:
|
|
668
|
+
children: u(d[s])
|
|
649
669
|
}
|
|
650
670
|
),
|
|
651
671
|
/* @__PURE__ */ e(
|
|
@@ -673,23 +693,23 @@ function he({
|
|
|
673
693
|
)
|
|
674
694
|
] });
|
|
675
695
|
}
|
|
676
|
-
function
|
|
696
|
+
function fe({
|
|
677
697
|
from: r,
|
|
678
698
|
to: t,
|
|
679
699
|
lanes: n,
|
|
680
700
|
baseline: a = "ok",
|
|
681
701
|
ticks: o = 5,
|
|
682
|
-
formatTick:
|
|
702
|
+
formatTick: u = (m) => m.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
|
|
683
703
|
labelWidth: s = "8rem",
|
|
684
704
|
rowHeight: b = "1.25rem",
|
|
685
705
|
emptyLabel: p = "No data"
|
|
686
706
|
}) {
|
|
687
|
-
const
|
|
707
|
+
const m = r.getTime(), h = t.getTime() - m;
|
|
688
708
|
if (!(h > 0) || n.length === 0)
|
|
689
709
|
return /* @__PURE__ */ e("div", { className: "py-8 text-center text-sm text-gray-500", children: p });
|
|
690
710
|
const d = Array.from(
|
|
691
711
|
{ length: Math.max(2, o) },
|
|
692
|
-
(i, c) => new Date(
|
|
712
|
+
(i, c) => new Date(m + h * c / (Math.max(2, o) - 1))
|
|
693
713
|
);
|
|
694
714
|
return /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
695
715
|
n.map((i) => /* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
@@ -708,9 +728,9 @@ function xe({
|
|
|
708
728
|
className: `relative flex-1 overflow-hidden rounded-sm ${M[a]}`,
|
|
709
729
|
style: { height: b },
|
|
710
730
|
children: i.spans.map((c) => {
|
|
711
|
-
const g = Math.max(c.start.getTime(),
|
|
731
|
+
const g = Math.max(c.start.getTime(), m), x = Math.min(c.end.getTime(), m + h);
|
|
712
732
|
if (x <= g) return null;
|
|
713
|
-
const N = (g -
|
|
733
|
+
const N = (g - m) / h, y = (x - g) / h;
|
|
714
734
|
return /* @__PURE__ */ e(
|
|
715
735
|
"div",
|
|
716
736
|
{
|
|
@@ -737,12 +757,12 @@ function xe({
|
|
|
737
757
|
paddingLeft: "0.75rem",
|
|
738
758
|
marginRight: n.some((i) => i.trailing !== void 0) ? "4rem" : void 0
|
|
739
759
|
},
|
|
740
|
-
children: d.map((i) => /* @__PURE__ */ e("span", { children:
|
|
760
|
+
children: d.map((i) => /* @__PURE__ */ e("span", { children: u(i) }, i.getTime()))
|
|
741
761
|
}
|
|
742
762
|
)
|
|
743
763
|
] });
|
|
744
764
|
}
|
|
745
|
-
const
|
|
765
|
+
const ye = {
|
|
746
766
|
blue: {
|
|
747
767
|
header: "bg-blue-50 text-blue-800",
|
|
748
768
|
hover: "hover:bg-blue-50",
|
|
@@ -784,7 +804,7 @@ const fe = {
|
|
|
784
804
|
badge: "bg-gray-200 text-gray-700"
|
|
785
805
|
}
|
|
786
806
|
};
|
|
787
|
-
function
|
|
807
|
+
function ve({
|
|
788
808
|
toast: r,
|
|
789
809
|
onClose: t
|
|
790
810
|
}) {
|
|
@@ -817,20 +837,21 @@ export {
|
|
|
817
837
|
F as Button,
|
|
818
838
|
T as Card,
|
|
819
839
|
le as CountryFlag,
|
|
820
|
-
|
|
840
|
+
ue as DropdownMenu,
|
|
821
841
|
ge as InfoRow,
|
|
822
842
|
ee as LabelChip,
|
|
823
843
|
oe as ListRow,
|
|
824
|
-
|
|
844
|
+
be as PageContainer,
|
|
825
845
|
te as Panel,
|
|
826
|
-
|
|
846
|
+
ye as SECTION_THEMES,
|
|
827
847
|
me as SearchInput,
|
|
828
848
|
ae as SectionCard,
|
|
849
|
+
pe as Select,
|
|
829
850
|
ce as SideNav,
|
|
830
|
-
|
|
831
|
-
|
|
851
|
+
he as StatCard,
|
|
852
|
+
fe as StateTimeline,
|
|
832
853
|
de as TabNav,
|
|
833
|
-
|
|
834
|
-
|
|
854
|
+
ve as Toast,
|
|
855
|
+
xe as UptimeBars,
|
|
835
856
|
se as ViewAllFooter
|
|
836
857
|
};
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Native single-select styled to match the form fields elsewhere. Children are
|
|
3
|
+
* the `<option>` / `<optgroup>` elements. Size via `className` (defaults to
|
|
4
|
+
* auto width so it can sit inline next to a label). */
|
|
5
|
+
export declare function Select({ value, onChange, children, id, className, disabled, }: {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
id?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|