@ai-matrx/content-ir-react 0.23.0 → 0.24.0
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/CHANGELOG.md +20 -0
- package/dist/kind-kit.cjs +183 -63
- package/dist/kind-kit.cjs.map +1 -1
- package/dist/kind-kit.d.cts +43 -2
- package/dist/kind-kit.d.ts +43 -2
- package/dist/kind-kit.js +183 -63
- package/dist/kind-kit.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.24.0 — 2026-10-06
|
|
4
|
+
|
|
5
|
+
`KindActionButton` joins the kind kit: the one-click door from a kind component to a host Action.
|
|
6
|
+
|
|
7
|
+
- `KindActionButton` / `KindActionButtonProps` in `/kind-kit`. Wraps the component's `runAction(key, input)`
|
|
8
|
+
prop: busy state with no double fire, an optional inline `confirm` (one-sentence consequence + confirm
|
|
9
|
+
button, never `window.confirm`), a one-line inline error (<=60 chars, full text in `title`) on
|
|
10
|
+
`{ok:false}`, `onDone(result)` on ok, `compact` icon-only mode.
|
|
11
|
+
|
|
12
|
+
### Consumer action
|
|
13
|
+
|
|
14
|
+
- Stored code imports it as `@/components/kind-kit/KindActionButton`: add that path to the host's stored
|
|
15
|
+
scope (`"@/components/kind-kit/KindActionButton": kindKit`) and to the gate lists (code-runtime >= 0.3.0).
|
|
16
|
+
|
|
17
|
+
## 0.23.1 — 2026-10-06
|
|
18
|
+
|
|
19
|
+
- `KindKitCopyProps` is `MatrxCopyMenuProps` from `@ai-matrx/alchemy/react/workspace` (ALC-16); adds the
|
|
20
|
+
`@ai-matrx/alchemy` dependency.
|
|
21
|
+
- Consumer action: none.
|
|
22
|
+
|
|
3
23
|
## 0.23.0 — 2026-10-06
|
|
4
24
|
|
|
5
25
|
The kind kit moves into the package (Applets AP-5): `@ai-matrx/content-ir-react/kind-kit`.
|
package/dist/kind-kit.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(kind_kit_exports, {
|
|
|
35
35
|
DefaultReadEmpty: () => DefaultReadEmpty,
|
|
36
36
|
DefaultReadStaleNotice: () => DefaultReadStaleNotice,
|
|
37
37
|
KeywordChip: () => KeywordChip,
|
|
38
|
+
KindActionButton: () => KindActionButton,
|
|
38
39
|
KindHeaderBar: () => KindHeaderBar,
|
|
39
40
|
KindPanel: () => KindPanel,
|
|
40
41
|
KindPanelGrid: () => KindPanelGrid,
|
|
@@ -700,10 +701,129 @@ function KindHeaderBar({
|
|
|
700
701
|
);
|
|
701
702
|
}
|
|
702
703
|
|
|
703
|
-
// kind-kit/
|
|
704
|
+
// kind-kit/KindActionButton.tsx
|
|
704
705
|
var React8 = __toESM(require("react"), 1);
|
|
705
706
|
var import_design_system6 = require("@ai-matrx/design-system");
|
|
706
707
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
708
|
+
var ERROR_MAX = 60;
|
|
709
|
+
function KindActionButton({
|
|
710
|
+
runAction,
|
|
711
|
+
action,
|
|
712
|
+
input,
|
|
713
|
+
label,
|
|
714
|
+
icon,
|
|
715
|
+
busyLabel,
|
|
716
|
+
confirm,
|
|
717
|
+
onDone,
|
|
718
|
+
onError,
|
|
719
|
+
variant = "outline",
|
|
720
|
+
compact = false,
|
|
721
|
+
disabled = false,
|
|
722
|
+
className
|
|
723
|
+
}) {
|
|
724
|
+
const [busy, setBusy] = React8.useState(false);
|
|
725
|
+
const [asking, setAsking] = React8.useState(false);
|
|
726
|
+
const [error, setError] = React8.useState(null);
|
|
727
|
+
const inFlight = React8.useRef(false);
|
|
728
|
+
const mounted = React8.useRef(true);
|
|
729
|
+
const errorTimer = React8.useRef(null);
|
|
730
|
+
React8.useEffect(() => {
|
|
731
|
+
mounted.current = true;
|
|
732
|
+
return () => {
|
|
733
|
+
mounted.current = false;
|
|
734
|
+
if (errorTimer.current) clearTimeout(errorTimer.current);
|
|
735
|
+
};
|
|
736
|
+
}, []);
|
|
737
|
+
const run = React8.useCallback(async () => {
|
|
738
|
+
if (inFlight.current) return;
|
|
739
|
+
inFlight.current = true;
|
|
740
|
+
setAsking(false);
|
|
741
|
+
setError(null);
|
|
742
|
+
setBusy(true);
|
|
743
|
+
try {
|
|
744
|
+
const payload = typeof input === "function" ? input() : input;
|
|
745
|
+
const res = await runAction(action, payload);
|
|
746
|
+
if (res && res.ok) {
|
|
747
|
+
onDone?.(res.result);
|
|
748
|
+
} else {
|
|
749
|
+
const message = res && "error" in res && res.error || "Action failed";
|
|
750
|
+
if (mounted.current) {
|
|
751
|
+
setError(message);
|
|
752
|
+
if (errorTimer.current) clearTimeout(errorTimer.current);
|
|
753
|
+
errorTimer.current = setTimeout(() => {
|
|
754
|
+
if (mounted.current) setError(null);
|
|
755
|
+
}, 8e3);
|
|
756
|
+
}
|
|
757
|
+
onError?.(message);
|
|
758
|
+
}
|
|
759
|
+
} catch (e) {
|
|
760
|
+
const message = e instanceof Error ? e.message : "Action failed";
|
|
761
|
+
if (mounted.current) setError(message);
|
|
762
|
+
onError?.(message);
|
|
763
|
+
} finally {
|
|
764
|
+
inFlight.current = false;
|
|
765
|
+
if (mounted.current) setBusy(false);
|
|
766
|
+
}
|
|
767
|
+
}, [action, input, onDone, onError, runAction]);
|
|
768
|
+
const onClick = () => {
|
|
769
|
+
if (busy || disabled || inFlight.current) return;
|
|
770
|
+
if (confirm) setAsking(true);
|
|
771
|
+
else void run();
|
|
772
|
+
};
|
|
773
|
+
if (asking && !busy) {
|
|
774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
775
|
+
"span",
|
|
776
|
+
{
|
|
777
|
+
role: "group",
|
|
778
|
+
"aria-label": label,
|
|
779
|
+
className: (0, import_design_system6.cn)(
|
|
780
|
+
"inline-flex flex-wrap items-center gap-x-2 gap-y-1 rounded-md border border-border bg-card px-2 py-1 text-xs",
|
|
781
|
+
className
|
|
782
|
+
),
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-foreground", children: confirm }),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Button, { type: "button", size: "xs", variant: variant === "outline" ? "default" : variant, onClick: () => void run(), children: label }),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system6.Button, { type: "button", size: "xs", variant: "ghost", onClick: () => setAsking(false), children: "Cancel" })
|
|
787
|
+
]
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
}
|
|
791
|
+
const shownLabel = busy ? busyLabel ?? label : label;
|
|
792
|
+
const glyph = busy ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2, { className: "h-4 w-4 animate-spin" }) : renderKindKitIcon(icon, "h-4 w-4");
|
|
793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: (0, import_design_system6.cn)("inline-flex min-w-0 items-center gap-2", className), children: [
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
795
|
+
import_design_system6.Button,
|
|
796
|
+
{
|
|
797
|
+
type: "button",
|
|
798
|
+
variant,
|
|
799
|
+
size: compact ? "icon-sm" : "sm",
|
|
800
|
+
disabled: disabled || busy,
|
|
801
|
+
"aria-busy": busy || void 0,
|
|
802
|
+
"aria-label": compact ? shownLabel : void 0,
|
|
803
|
+
title: compact ? label : void 0,
|
|
804
|
+
onClick,
|
|
805
|
+
children: [
|
|
806
|
+
glyph,
|
|
807
|
+
!compact && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: shownLabel })
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
812
|
+
"span",
|
|
813
|
+
{
|
|
814
|
+
role: "alert",
|
|
815
|
+
title: error,
|
|
816
|
+
className: "min-w-0 text-xs text-destructive",
|
|
817
|
+
children: error.length > ERROR_MAX ? `${error.slice(0, ERROR_MAX - 1)}\u2026` : error
|
|
818
|
+
}
|
|
819
|
+
)
|
|
820
|
+
] });
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// kind-kit/StreamingSkeleton.tsx
|
|
824
|
+
var React9 = __toESM(require("react"), 1);
|
|
825
|
+
var import_design_system7 = require("@ai-matrx/design-system");
|
|
826
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
707
827
|
function StreamingSkeleton({
|
|
708
828
|
layout = "list",
|
|
709
829
|
rows = 3,
|
|
@@ -714,72 +834,72 @@ function StreamingSkeleton({
|
|
|
714
834
|
}) {
|
|
715
835
|
const n = Math.max(1, rows);
|
|
716
836
|
const cols = Math.max(1, columns ?? (layout === "cards" ? 2 : 3));
|
|
717
|
-
return /* @__PURE__ */ (0,
|
|
837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
718
838
|
"div",
|
|
719
839
|
{
|
|
720
840
|
role: "status",
|
|
721
841
|
"aria-busy": "true",
|
|
722
842
|
"aria-label": label,
|
|
723
|
-
className: (0,
|
|
843
|
+
className: (0, import_design_system7.cn)("space-y-2", className),
|
|
724
844
|
children: [
|
|
725
|
-
header && /* @__PURE__ */ (0,
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
845
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-4 w-4 rounded" }),
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-4 w-40" }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "ml-auto h-6 w-16" })
|
|
729
849
|
] }),
|
|
730
|
-
layout === "list" && Array.from({ length: n }).map((_, i) => /* @__PURE__ */ (0,
|
|
731
|
-
/* @__PURE__ */ (0,
|
|
732
|
-
/* @__PURE__ */ (0,
|
|
850
|
+
layout === "list" && Array.from({ length: n }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2 rounded-md border border-border px-2 py-2", children: [
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-4 w-4 rounded" }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: (0, import_design_system7.cn)("h-3.5", i % 3 === 0 ? "w-2/3" : i % 3 === 1 ? "w-1/2" : "w-3/4") })
|
|
733
853
|
] }, i)),
|
|
734
|
-
layout === "cards" && /* @__PURE__ */ (0,
|
|
854
|
+
layout === "cards" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
735
855
|
"div",
|
|
736
856
|
{
|
|
737
857
|
className: "grid gap-3",
|
|
738
858
|
style: { gridTemplateColumns: `repeat(auto-fit, minmax(min(100%, 240px), 1fr))` },
|
|
739
|
-
children: Array.from({ length: Math.max(n, cols) }).map((_, i) => /* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
745
|
-
/* @__PURE__ */ (0,
|
|
859
|
+
children: Array.from({ length: Math.max(n, cols) }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2 rounded-lg border border-border p-3", children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-3.5 w-1/2" }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-3 w-full" }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-wrap gap-1.5 pt-1", children: [
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-5 w-16 rounded-full" }),
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-5 w-24 rounded-full" }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-5 w-12 rounded-full" })
|
|
746
866
|
] })
|
|
747
867
|
] }, i))
|
|
748
868
|
}
|
|
749
869
|
),
|
|
750
|
-
layout === "table" && /* @__PURE__ */ (0,
|
|
751
|
-
/* @__PURE__ */ (0,
|
|
870
|
+
layout === "table" && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "overflow-hidden rounded-md border border-border", children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
752
872
|
"div",
|
|
753
873
|
{
|
|
754
874
|
className: "grid gap-2 border-b border-border bg-muted/40 px-2 py-1.5",
|
|
755
875
|
style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
|
|
756
|
-
children: Array.from({ length: cols }).map((_, c) => /* @__PURE__ */ (0,
|
|
876
|
+
children: Array.from({ length: cols }).map((_, c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: "h-3 w-2/3" }, c))
|
|
757
877
|
}
|
|
758
878
|
),
|
|
759
|
-
Array.from({ length: n }).map((_, r) => /* @__PURE__ */ (0,
|
|
879
|
+
Array.from({ length: n }).map((_, r) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
760
880
|
"div",
|
|
761
881
|
{
|
|
762
882
|
className: "grid gap-2 px-2 py-2",
|
|
763
883
|
style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
|
|
764
|
-
children: Array.from({ length: cols }).map((_2, c) => /* @__PURE__ */ (0,
|
|
884
|
+
children: Array.from({ length: cols }).map((_2, c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_design_system7.Skeleton, { className: (0, import_design_system7.cn)("h-3", c === 0 ? "w-3/4" : "w-1/2") }, c))
|
|
765
885
|
},
|
|
766
886
|
r
|
|
767
887
|
))
|
|
768
888
|
] }),
|
|
769
|
-
layout === "text" && Array.from({ length: n }).map((_, i) => /* @__PURE__ */ (0,
|
|
770
|
-
|
|
889
|
+
layout === "text" && Array.from({ length: n }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
890
|
+
import_design_system7.Skeleton,
|
|
771
891
|
{
|
|
772
|
-
className: (0,
|
|
892
|
+
className: (0, import_design_system7.cn)("h-3", i === n - 1 ? "w-2/5" : i % 2 === 0 ? "w-full" : "w-11/12")
|
|
773
893
|
},
|
|
774
894
|
i
|
|
775
895
|
)),
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sr-only", children: label })
|
|
777
897
|
]
|
|
778
898
|
}
|
|
779
899
|
);
|
|
780
900
|
}
|
|
781
901
|
function useStreamingValue(value, fallback) {
|
|
782
|
-
const [last, setLast] =
|
|
902
|
+
const [last, setLast] = React9.useState({
|
|
783
903
|
value: fallback,
|
|
784
904
|
arrived: false
|
|
785
905
|
});
|
|
@@ -799,9 +919,9 @@ function streamText(value, fallback = "") {
|
|
|
799
919
|
}
|
|
800
920
|
|
|
801
921
|
// kind-kit/TagList.tsx
|
|
802
|
-
var
|
|
803
|
-
var
|
|
804
|
-
var
|
|
922
|
+
var React10 = __toESM(require("react"), 1);
|
|
923
|
+
var import_design_system8 = require("@ai-matrx/design-system");
|
|
924
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
805
925
|
var TONE = {
|
|
806
926
|
default: "border-border bg-background text-foreground",
|
|
807
927
|
primary: "border-primary/40 bg-primary/5 text-foreground",
|
|
@@ -820,9 +940,9 @@ function KeywordChip({
|
|
|
820
940
|
size = "sm",
|
|
821
941
|
className
|
|
822
942
|
}) {
|
|
823
|
-
const [editing, setEditing] =
|
|
824
|
-
const [draft, setDraft] =
|
|
825
|
-
const inputRef =
|
|
943
|
+
const [editing, setEditing] = React10.useState(false);
|
|
944
|
+
const [draft, setDraft] = React10.useState(label);
|
|
945
|
+
const inputRef = React10.useRef(null);
|
|
826
946
|
const selectable = !!onSelect && !disabled;
|
|
827
947
|
const editable = !!onEdit && !disabled;
|
|
828
948
|
const startEdit = () => {
|
|
@@ -843,10 +963,10 @@ function KeywordChip({
|
|
|
843
963
|
const pad = size === "md" ? "px-2.5 py-1 text-sm" : "px-2 py-0.5 text-xs";
|
|
844
964
|
const inputText = size === "md" ? "text-[16px] sm:text-sm" : "text-[16px] sm:text-xs";
|
|
845
965
|
const ctl = size === "md" ? "h-4 w-4" : "h-3.5 w-3.5";
|
|
846
|
-
return /* @__PURE__ */ (0,
|
|
966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
847
967
|
"span",
|
|
848
968
|
{
|
|
849
|
-
className: (0,
|
|
969
|
+
className: (0, import_design_system8.cn)(
|
|
850
970
|
// max-w-full + min-w-0 + break-words: the text wraps INSIDE the chip.
|
|
851
971
|
"inline-flex max-w-full min-w-0 items-center gap-1 rounded-full border leading-snug",
|
|
852
972
|
pad,
|
|
@@ -855,7 +975,7 @@ function KeywordChip({
|
|
|
855
975
|
className
|
|
856
976
|
),
|
|
857
977
|
children: [
|
|
858
|
-
selectable && /* @__PURE__ */ (0,
|
|
978
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
859
979
|
"button",
|
|
860
980
|
{
|
|
861
981
|
type: "button",
|
|
@@ -863,19 +983,19 @@ function KeywordChip({
|
|
|
863
983
|
"aria-checked": selected,
|
|
864
984
|
"aria-label": `${selected ? "Deselect" : "Select"} ${label}`,
|
|
865
985
|
onClick: () => onSelect?.(!selected),
|
|
866
|
-
className: (0,
|
|
986
|
+
className: (0, import_design_system8.cn)(
|
|
867
987
|
"flex shrink-0 items-center justify-center rounded-sm border",
|
|
868
988
|
size === "md" ? "h-4 w-4" : "h-3.5 w-3.5",
|
|
869
989
|
selected ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground/50 bg-background"
|
|
870
990
|
),
|
|
871
|
-
children: selected && /* @__PURE__ */ (0,
|
|
991
|
+
children: selected && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Check, { className: "h-2.5 w-2.5" })
|
|
872
992
|
}
|
|
873
993
|
),
|
|
874
994
|
renderKindKitIcon(
|
|
875
995
|
icon,
|
|
876
|
-
(0,
|
|
996
|
+
(0, import_design_system8.cn)("shrink-0 text-muted-foreground", ctl)
|
|
877
997
|
),
|
|
878
|
-
editing ? /* @__PURE__ */ (0,
|
|
998
|
+
editing ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
879
999
|
"input",
|
|
880
1000
|
{
|
|
881
1001
|
ref: inputRef,
|
|
@@ -893,9 +1013,9 @@ function KeywordChip({
|
|
|
893
1013
|
},
|
|
894
1014
|
"aria-label": `Edit ${label}`,
|
|
895
1015
|
size: Math.max(4, draft.length + 1),
|
|
896
|
-
className: (0,
|
|
1016
|
+
className: (0, import_design_system8.cn)("min-w-0 bg-transparent outline-none", inputText)
|
|
897
1017
|
}
|
|
898
|
-
) : /* @__PURE__ */ (0,
|
|
1018
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
899
1019
|
"span",
|
|
900
1020
|
{
|
|
901
1021
|
className: "min-w-0 whitespace-normal break-words text-left",
|
|
@@ -903,18 +1023,18 @@ function KeywordChip({
|
|
|
903
1023
|
children: label
|
|
904
1024
|
}
|
|
905
1025
|
),
|
|
906
|
-
meta !== void 0 && meta !== null && /* @__PURE__ */ (0,
|
|
907
|
-
editable && !editing && /* @__PURE__ */ (0,
|
|
1026
|
+
meta !== void 0 && meta !== null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: meta }),
|
|
1027
|
+
editable && !editing && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
908
1028
|
"button",
|
|
909
1029
|
{
|
|
910
1030
|
type: "button",
|
|
911
1031
|
"aria-label": `Edit ${label}`,
|
|
912
1032
|
onClick: startEdit,
|
|
913
1033
|
className: "shrink-0 rounded-full text-muted-foreground hover:text-foreground",
|
|
914
|
-
children: /* @__PURE__ */ (0,
|
|
1034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pencil, { className: (0, import_design_system8.cn)("h-3 w-3", size === "md" && "h-3.5 w-3.5") })
|
|
915
1035
|
}
|
|
916
1036
|
),
|
|
917
|
-
onRemove && /* @__PURE__ */ (0,
|
|
1037
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
918
1038
|
"button",
|
|
919
1039
|
{
|
|
920
1040
|
type: "button",
|
|
@@ -922,7 +1042,7 @@ function KeywordChip({
|
|
|
922
1042
|
disabled,
|
|
923
1043
|
onClick: onRemove,
|
|
924
1044
|
className: "-mr-0.5 shrink-0 rounded-full text-muted-foreground hover:text-destructive disabled:pointer-events-none",
|
|
925
|
-
children: /* @__PURE__ */ (0,
|
|
1045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(X, { className: ctl })
|
|
926
1046
|
}
|
|
927
1047
|
)
|
|
928
1048
|
]
|
|
@@ -948,8 +1068,8 @@ function TagList({
|
|
|
948
1068
|
className
|
|
949
1069
|
}) {
|
|
950
1070
|
const { ReadEmpty, ReadStaleNotice } = getKindKitHost();
|
|
951
|
-
const [adding, setAdding] =
|
|
952
|
-
const [draft, setDraft] =
|
|
1071
|
+
const [adding, setAdding] = React10.useState(false);
|
|
1072
|
+
const [draft, setDraft] = React10.useState("");
|
|
953
1073
|
const inputText = size === "md" ? "text-[16px] sm:text-sm" : "text-[16px] sm:text-xs";
|
|
954
1074
|
const selectedSet = new Set(selected ?? []);
|
|
955
1075
|
const commitAdd = () => {
|
|
@@ -958,16 +1078,16 @@ function TagList({
|
|
|
958
1078
|
setDraft("");
|
|
959
1079
|
setAdding(false);
|
|
960
1080
|
};
|
|
961
|
-
if (items.length === 0 && read && read.status !== "ready") return /* @__PURE__ */ (0,
|
|
1081
|
+
if (items.length === 0 && read && read.status !== "ready") return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ReadEmpty, { read });
|
|
962
1082
|
if (items.length === 0 && !onAdd) {
|
|
963
|
-
return emptyState !== void 0 ? /* @__PURE__ */ (0,
|
|
1083
|
+
return emptyState !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_design_system8.cn)("text-xs text-muted-foreground", className), children: emptyState }) : null;
|
|
964
1084
|
}
|
|
965
|
-
return /* @__PURE__ */ (0,
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_design_system8.cn)("flex flex-wrap items-center gap-1.5", className), children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ReadStaleNotice, { read, className: "w-full" }),
|
|
967
1087
|
items.map((raw, index) => {
|
|
968
1088
|
const item = normalize(raw);
|
|
969
1089
|
const key = item.key ?? item.label;
|
|
970
|
-
return /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
971
1091
|
KeywordChip,
|
|
972
1092
|
{
|
|
973
1093
|
label: item.label,
|
|
@@ -983,15 +1103,15 @@ function TagList({
|
|
|
983
1103
|
`${key}-${index}`
|
|
984
1104
|
);
|
|
985
1105
|
}),
|
|
986
|
-
items.length === 0 && emptyState !== void 0 && /* @__PURE__ */ (0,
|
|
987
|
-
onAdd && !disabled && (adding ? /* @__PURE__ */ (0,
|
|
1106
|
+
items.length === 0 && emptyState !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs text-muted-foreground", children: emptyState }),
|
|
1107
|
+
onAdd && !disabled && (adding ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
988
1108
|
"span",
|
|
989
1109
|
{
|
|
990
|
-
className: (0,
|
|
1110
|
+
className: (0, import_design_system8.cn)(
|
|
991
1111
|
"inline-flex items-center gap-1 rounded-full border border-dashed border-primary/60 bg-background",
|
|
992
1112
|
size === "md" ? "px-2.5 py-1 text-sm" : "px-2 py-0.5 text-xs"
|
|
993
1113
|
),
|
|
994
|
-
children: /* @__PURE__ */ (0,
|
|
1114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
995
1115
|
"input",
|
|
996
1116
|
{
|
|
997
1117
|
autoFocus: true,
|
|
@@ -1011,21 +1131,21 @@ function TagList({
|
|
|
1011
1131
|
},
|
|
1012
1132
|
"aria-label": addPlaceholder,
|
|
1013
1133
|
size: Math.max(6, draft.length + 1),
|
|
1014
|
-
className: (0,
|
|
1134
|
+
className: (0, import_design_system8.cn)("min-w-0 bg-transparent outline-none placeholder:text-muted-foreground", inputText)
|
|
1015
1135
|
}
|
|
1016
1136
|
)
|
|
1017
1137
|
}
|
|
1018
|
-
) : /* @__PURE__ */ (0,
|
|
1138
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1019
1139
|
"button",
|
|
1020
1140
|
{
|
|
1021
1141
|
type: "button",
|
|
1022
1142
|
onClick: () => setAdding(true),
|
|
1023
|
-
className: (0,
|
|
1143
|
+
className: (0, import_design_system8.cn)(
|
|
1024
1144
|
"inline-flex items-center gap-1 rounded-full border border-dashed border-border text-muted-foreground hover:border-primary/60 hover:text-foreground",
|
|
1025
1145
|
size === "md" ? "px-2.5 py-1 text-sm" : "px-2 py-0.5 text-xs"
|
|
1026
1146
|
),
|
|
1027
1147
|
children: [
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Plus, { className: "h-3 w-3" }),
|
|
1029
1149
|
addPlaceholder.replace(/…$/, "")
|
|
1030
1150
|
]
|
|
1031
1151
|
}
|