@nqminds/mcp-client 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA0ahF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBAyhBd"}
1
+ {"version":3,"file":"MCPChat.d.ts","sourceRoot":"","sources":["../src/MCPChat.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,KAAK,EAAyB,YAAY,EAAe,MAAM,SAAS,CAAC;AA+bhF,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,WAA6B,EAC7B,YAAiB,EACjB,SAAc,GACf,EAAE,YAAY,qBAyhBd"}
package/dist/MCPChat.js CHANGED
@@ -16,13 +16,23 @@ function stripUtmSource(url) {
16
16
  *
17
17
  * Expected JSON shape:
18
18
  * { "columns": ["Col A", "Col B"], "rows": [["val1", "val2"], ...] }
19
+ *
20
+ * On mobile the table switches to a card layout using data-label attributes.
21
+ * Rows beyond INITIAL_ROWS are hidden behind an expand button.
19
22
  */
23
+ const INITIAL_ROWS = 5;
20
24
  function JsonDataTable({ columns, rows }) {
25
+ const [showAll, setShowAll] = useState(false);
26
+ const visibleRows = showAll ? rows : rows.slice(0, INITIAL_ROWS);
27
+ const hiddenCount = rows.length - INITIAL_ROWS;
21
28
  return (React.createElement("div", { className: "mcp-data-table-wrapper" },
22
29
  React.createElement("table", { className: "mcp-data-table" },
23
30
  React.createElement("thead", null,
24
31
  React.createElement("tr", null, columns.map((col, i) => React.createElement("th", { key: i }, col)))),
25
- React.createElement("tbody", null, rows.map((row, ri) => (React.createElement("tr", { key: ri }, row.map((cell, ci) => React.createElement("td", { key: ci }, String(cell ?? ""))))))))));
32
+ React.createElement("tbody", null, visibleRows.map((row, ri) => (React.createElement("tr", { key: ri }, row.map((cell, ci) => (React.createElement("td", { key: ci, "data-label": columns[ci] }, String(cell ?? ""))))))))),
33
+ rows.length > INITIAL_ROWS && (React.createElement("button", { className: "mcp-table-expand-btn", onClick: () => setShowAll((s) => !s) }, showAll
34
+ ? "▲ Show less"
35
+ : `▼ Show ${hiddenCount} more row${hiddenCount !== 1 ? "s" : ""}`))));
26
36
  }
27
37
  /**
28
38
  * Returns the ReactMarkdown `components` map.
@@ -963,3 +963,205 @@
963
963
  display: flex;
964
964
  gap: 8px;
965
965
  }
966
+
967
+ /* ───────────────────────────────────────────────
968
+ Table: expand / collapse button
969
+ ─────────────────────────────────────────────── */
970
+ .mcp-table-expand-btn {
971
+ display: block;
972
+ width: 100%;
973
+ padding: 10px 16px;
974
+ min-height: 44px;
975
+ font-size: 13px;
976
+ font-weight: 600;
977
+ font-family: inherit;
978
+ color: var(--mcp-primary-color);
979
+ background: transparent;
980
+ border: 1px solid var(--mcp-border);
981
+ border-top: none;
982
+ border-radius: 0 0 6px 6px;
983
+ cursor: pointer;
984
+ text-align: center;
985
+ transition: background 0.15s;
986
+ }
987
+
988
+ .mcp-table-expand-btn:hover {
989
+ background: rgba(78, 161, 255, 0.06);
990
+ }
991
+
992
+ /* ───────────────────────────────────────────────
993
+ Mobile: full-screen panel + compact layout
994
+ ─────────────────────────────────────────────── */
995
+ @media (max-width: 640px) {
996
+ /* Panel takes the full viewport */
997
+ .mcp-overlay {
998
+ padding: 0;
999
+ align-items: stretch;
1000
+ }
1001
+
1002
+ .mcp-panel {
1003
+ width: 100vw;
1004
+ height: 100dvh;
1005
+ max-height: 100dvh;
1006
+ margin-top: 0;
1007
+ border-radius: 0;
1008
+ border: none;
1009
+ }
1010
+
1011
+ /* Tighter header */
1012
+ .mcp-chat-header {
1013
+ padding: 10px 14px;
1014
+ }
1015
+
1016
+ .mcp-chat-title {
1017
+ font-size: 17px;
1018
+ }
1019
+
1020
+ /* Ensure all interactive elements in header meet 44px tap target */
1021
+ .mcp-chat-button,
1022
+ .mcp-btn-theme,
1023
+ .mcp-btn-icon {
1024
+ min-height: 44px;
1025
+ min-width: 44px;
1026
+ display: inline-flex;
1027
+ align-items: center;
1028
+ justify-content: center;
1029
+ }
1030
+
1031
+ /* Hide dev-tool button on mobile — not relevant to end users */
1032
+ .mcp-btn-dev {
1033
+ display: none;
1034
+ }
1035
+
1036
+ /* Messages: less padding */
1037
+ .mcp-chat-messages {
1038
+ padding: 10px 12px;
1039
+ gap: 12px;
1040
+ }
1041
+
1042
+ /* Message bubbles: use full available width */
1043
+ .mcp-chat-message,
1044
+ .mcp-chat-message-assistant {
1045
+ max-width: 100%;
1046
+ }
1047
+
1048
+ /* Tighter bubble padding */
1049
+ .mcp-chat-message-bubble {
1050
+ padding: 10px 14px;
1051
+ }
1052
+
1053
+ /* Input bar */
1054
+ .mcp-chat-input-form {
1055
+ padding: 10px 12px;
1056
+ gap: 8px;
1057
+ }
1058
+
1059
+ .mcp-chat-input {
1060
+ font-size: 16px; /* Prevent iOS auto-zoom on focus */
1061
+ }
1062
+
1063
+ /* Home screen: 2-column grid */
1064
+ .mcp-action-grid {
1065
+ grid-template-columns: repeat(2, 1fr);
1066
+ gap: 10px;
1067
+ }
1068
+
1069
+ .mcp-action-card {
1070
+ padding: 14px 10px;
1071
+ min-height: 72px;
1072
+ }
1073
+
1074
+ .mcp-action-card-icon {
1075
+ font-size: 24px;
1076
+ }
1077
+
1078
+ .mcp-action-card-label {
1079
+ font-size: 13px;
1080
+ }
1081
+
1082
+ .mcp-chat-now-button {
1083
+ min-height: 44px;
1084
+ padding: 10px 28px;
1085
+ }
1086
+
1087
+ /* Thinking panel */
1088
+ .mcp-chat-thinking {
1089
+ padding: 14px 16px;
1090
+ min-height: unset;
1091
+ }
1092
+ }
1093
+
1094
+ /* ───────────────────────────────────────────────
1095
+ Mobile: json-table card layout
1096
+ Each row becomes a labelled card; column headers
1097
+ are hidden and surfaced via data-label pseudo-elements.
1098
+ ─────────────────────────────────────────────── */
1099
+ @media (max-width: 640px) {
1100
+ .mcp-data-table-wrapper {
1101
+ overflow-x: visible;
1102
+ }
1103
+
1104
+ .mcp-data-table {
1105
+ min-width: unset;
1106
+ display: block;
1107
+ }
1108
+
1109
+ .mcp-data-table thead {
1110
+ display: none; /* labels come from data-label on each td */
1111
+ }
1112
+
1113
+ .mcp-data-table tbody {
1114
+ display: block;
1115
+ }
1116
+
1117
+ .mcp-data-table tr {
1118
+ display: block;
1119
+ border: 1px solid var(--mcp-border);
1120
+ border-radius: 8px;
1121
+ margin-bottom: 10px;
1122
+ overflow: hidden;
1123
+ }
1124
+
1125
+ .mcp-data-table td {
1126
+ display: grid;
1127
+ grid-template-columns: minmax(80px, 36%) 1fr;
1128
+ gap: 8px;
1129
+ padding: 8px 12px;
1130
+ border: none;
1131
+ border-bottom: 1px solid var(--mcp-border);
1132
+ font-size: 14px;
1133
+ line-height: 1.45;
1134
+ word-break: break-word;
1135
+ }
1136
+
1137
+ .mcp-data-table td:last-child {
1138
+ border-bottom: none;
1139
+ }
1140
+
1141
+ /* Column label shown from the data-label attribute */
1142
+ .mcp-data-table td::before {
1143
+ content: attr(data-label);
1144
+ font-weight: 700;
1145
+ font-size: 11px;
1146
+ text-transform: uppercase;
1147
+ letter-spacing: 0.06em;
1148
+ color: var(--mcp-text-secondary);
1149
+ align-self: center;
1150
+ line-height: 1.3;
1151
+ }
1152
+
1153
+ /* Strip alternating row tints — card borders provide separation */
1154
+ .mcp-data-table tbody tr:nth-child(even) {
1155
+ background: transparent;
1156
+ }
1157
+
1158
+ .mcp-data-table tbody tr:hover {
1159
+ background: transparent;
1160
+ }
1161
+
1162
+ /* Expand button full-width on mobile */
1163
+ .mcp-table-expand-btn {
1164
+ border-radius: 0 0 8px 8px;
1165
+ font-size: 14px;
1166
+ }
1167
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nqminds/mcp-client",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "Reusable MCP client component with AI chat interface",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",