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