@streamoid/catalogix-chat 0.2.14 → 0.2.15

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.
Files changed (2) hide show
  1. package/dist/index.js +134 -132
  2. package/package.json +6 -4
package/dist/index.js CHANGED
@@ -29,11 +29,7 @@ async function fetchJson(url, options) {
29
29
 
30
30
  // src/SelectProducts/index.tsx
31
31
  import { useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
32
- import { CheckCircle, Loader2 as Loader23, Search as Search2 } from "lucide-react";
33
-
34
- // src/ui/button.tsx
35
- import { Slot } from "@radix-ui/react-slot";
36
- import { cva } from "class-variance-authority";
32
+ import { CheckCircle, Search as Search2 } from "lucide-react";
37
33
 
38
34
  // src/ui/utils.ts
39
35
  import { clsx } from "clsx";
@@ -42,55 +38,10 @@ function cn(...inputs) {
42
38
  return twMerge(clsx(inputs));
43
39
  }
44
40
 
45
- // src/ui/button.tsx
46
- import { jsx } from "react/jsx-runtime";
47
- var buttonVariants = cva(
48
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
49
- {
50
- variants: {
51
- variant: {
52
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
53
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
54
- outline: "border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
55
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
56
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
57
- link: "text-primary underline-offset-4 hover:underline"
58
- },
59
- size: {
60
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
61
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
62
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
63
- icon: "size-9 rounded-md"
64
- }
65
- },
66
- defaultVariants: {
67
- variant: "default",
68
- size: "default"
69
- }
70
- }
71
- );
72
- function Button({
73
- className,
74
- variant,
75
- size,
76
- asChild = false,
77
- ...props
78
- }) {
79
- const Comp = asChild ? Slot : "button";
80
- return /* @__PURE__ */ jsx(
81
- Comp,
82
- {
83
- "data-slot": "button",
84
- className: cn(buttonVariants({ variant, size, className })),
85
- ...props
86
- }
87
- );
88
- }
89
-
90
41
  // src/ui/input.tsx
91
- import { jsx as jsx2 } from "react/jsx-runtime";
42
+ import { jsx } from "react/jsx-runtime";
92
43
  function Input({ className, type, ...props }) {
93
- return /* @__PURE__ */ jsx2(
44
+ return /* @__PURE__ */ jsx(
94
45
  "input",
95
46
  {
96
47
  type,
@@ -107,9 +58,9 @@ function Input({ className, type, ...props }) {
107
58
  }
108
59
 
109
60
  // src/ui/card.tsx
110
- import { jsx as jsx3 } from "react/jsx-runtime";
61
+ import { jsx as jsx2 } from "react/jsx-runtime";
111
62
  function Card({ className, ...props }) {
112
- return /* @__PURE__ */ jsx3(
63
+ return /* @__PURE__ */ jsx2(
113
64
  "div",
114
65
  {
115
66
  "data-slot": "card",
@@ -129,17 +80,17 @@ import {
129
80
  getCoreRowModel,
130
81
  useReactTable
131
82
  } from "@tanstack/react-table";
132
- import { ChevronLeft, ChevronRight, Package, Layers } from "lucide-react";
83
+ import { ChevronLeft, ChevronRight, Loader2 as Loader22, Package, Layers } from "lucide-react";
133
84
 
134
85
  // src/ui/table.tsx
135
- import { jsx as jsx4 } from "react/jsx-runtime";
86
+ import { jsx as jsx3 } from "react/jsx-runtime";
136
87
  function Table({ className, ...props }) {
137
- return /* @__PURE__ */ jsx4(
88
+ return /* @__PURE__ */ jsx3(
138
89
  "div",
139
90
  {
140
91
  "data-slot": "table-container",
141
92
  className: "relative w-full overflow-x-auto",
142
- children: /* @__PURE__ */ jsx4(
93
+ children: /* @__PURE__ */ jsx3(
143
94
  "table",
144
95
  {
145
96
  "data-slot": "table",
@@ -151,7 +102,7 @@ function Table({ className, ...props }) {
151
102
  );
152
103
  }
153
104
  function TableHeader({ className, ...props }) {
154
- return /* @__PURE__ */ jsx4(
105
+ return /* @__PURE__ */ jsx3(
155
106
  "thead",
156
107
  {
157
108
  "data-slot": "table-header",
@@ -161,7 +112,7 @@ function TableHeader({ className, ...props }) {
161
112
  );
162
113
  }
163
114
  function TableBody({ className, ...props }) {
164
- return /* @__PURE__ */ jsx4(
115
+ return /* @__PURE__ */ jsx3(
165
116
  "tbody",
166
117
  {
167
118
  "data-slot": "table-body",
@@ -171,7 +122,7 @@ function TableBody({ className, ...props }) {
171
122
  );
172
123
  }
173
124
  function TableRow({ className, ...props }) {
174
- return /* @__PURE__ */ jsx4(
125
+ return /* @__PURE__ */ jsx3(
175
126
  "tr",
176
127
  {
177
128
  "data-slot": "table-row",
@@ -184,7 +135,7 @@ function TableRow({ className, ...props }) {
184
135
  );
185
136
  }
186
137
  function TableHead({ className, ...props }) {
187
- return /* @__PURE__ */ jsx4(
138
+ return /* @__PURE__ */ jsx3(
188
139
  "th",
189
140
  {
190
141
  "data-slot": "table-head",
@@ -197,7 +148,7 @@ function TableHead({ className, ...props }) {
197
148
  );
198
149
  }
199
150
  function TableCell({ className, ...props }) {
200
- return /* @__PURE__ */ jsx4(
151
+ return /* @__PURE__ */ jsx3(
201
152
  "td",
202
153
  {
203
154
  "data-slot": "table-cell",
@@ -213,12 +164,12 @@ function TableCell({ className, ...props }) {
213
164
  // src/ui/checkbox.tsx
214
165
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
215
166
  import { CheckIcon } from "lucide-react";
216
- import { jsx as jsx5 } from "react/jsx-runtime";
167
+ import { jsx as jsx4 } from "react/jsx-runtime";
217
168
  function Checkbox({
218
169
  className,
219
170
  ...props
220
171
  }) {
221
- return /* @__PURE__ */ jsx5(
172
+ return /* @__PURE__ */ jsx4(
222
173
  CheckboxPrimitive.Root,
223
174
  {
224
175
  "data-slot": "checkbox",
@@ -227,12 +178,12 @@ function Checkbox({
227
178
  className
228
179
  ),
229
180
  ...props,
230
- children: /* @__PURE__ */ jsx5(
181
+ children: /* @__PURE__ */ jsx4(
231
182
  CheckboxPrimitive.Indicator,
232
183
  {
233
184
  "data-slot": "checkbox-indicator",
234
185
  className: "flex items-center justify-center text-current transition-none",
235
- children: /* @__PURE__ */ jsx5(CheckIcon, { className: "size-3.5" })
186
+ children: /* @__PURE__ */ jsx4(CheckIcon, { className: "size-3.5" })
236
187
  }
237
188
  )
238
189
  }
@@ -240,10 +191,10 @@ function Checkbox({
240
191
  }
241
192
 
242
193
  // src/ui/badge.tsx
243
- import { Slot as Slot2 } from "@radix-ui/react-slot";
244
- import { cva as cva2 } from "class-variance-authority";
245
- import { jsx as jsx6 } from "react/jsx-runtime";
246
- var badgeVariants = cva2(
194
+ import { Slot } from "@radix-ui/react-slot";
195
+ import { cva } from "class-variance-authority";
196
+ import { jsx as jsx5 } from "react/jsx-runtime";
197
+ var badgeVariants = cva(
247
198
  "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
248
199
  {
249
200
  variants: {
@@ -265,8 +216,8 @@ function Badge({
265
216
  asChild = false,
266
217
  ...props
267
218
  }) {
268
- const Comp = asChild ? Slot2 : "span";
269
- return /* @__PURE__ */ jsx6(
219
+ const Comp = asChild ? Slot : "span";
220
+ return /* @__PURE__ */ jsx5(
270
221
  Comp,
271
222
  {
272
223
  "data-slot": "badge",
@@ -276,6 +227,53 @@ function Badge({
276
227
  );
277
228
  }
278
229
 
230
+ // src/ui/button.tsx
231
+ import { Slot as Slot2 } from "@radix-ui/react-slot";
232
+ import { cva as cva2 } from "class-variance-authority";
233
+ import { jsx as jsx6 } from "react/jsx-runtime";
234
+ var buttonVariants = cva2(
235
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
236
+ {
237
+ variants: {
238
+ variant: {
239
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
240
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
241
+ outline: "border bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
242
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
243
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
244
+ link: "text-primary underline-offset-4 hover:underline"
245
+ },
246
+ size: {
247
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
248
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
249
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
250
+ icon: "size-9 rounded-md"
251
+ }
252
+ },
253
+ defaultVariants: {
254
+ variant: "default",
255
+ size: "default"
256
+ }
257
+ }
258
+ );
259
+ function Button({
260
+ className,
261
+ variant,
262
+ size,
263
+ asChild = false,
264
+ ...props
265
+ }) {
266
+ const Comp = asChild ? Slot2 : "button";
267
+ return /* @__PURE__ */ jsx6(
268
+ Comp,
269
+ {
270
+ "data-slot": "button",
271
+ className: cn(buttonVariants({ variant, size, className })),
272
+ ...props
273
+ }
274
+ );
275
+ }
276
+
279
277
  // src/ui/skeleton.tsx
280
278
  import { jsx as jsx7 } from "react/jsx-runtime";
281
279
  function Skeleton({ className, ...props }) {
@@ -1023,7 +1021,7 @@ function TextEditor({
1023
1021
  }
1024
1022
 
1025
1023
  // src/SelectProducts/ProductTable.tsx
1026
- import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1024
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
1027
1025
  function ProductTable({
1028
1026
  products,
1029
1027
  columns: appColumns,
@@ -1039,7 +1037,9 @@ function ProductTable({
1039
1037
  totalProducts,
1040
1038
  totalSkus,
1041
1039
  onPageChange,
1042
- globalFilter
1040
+ globalFilter,
1041
+ onConfirmSelection,
1042
+ isSubmitting
1043
1043
  }) {
1044
1044
  const tanstackColumns = useMemo(() => {
1045
1045
  const selectCol = {
@@ -1186,11 +1186,17 @@ function ProductTable({
1186
1186
  TableRow,
1187
1187
  {
1188
1188
  "data-state": row.getIsSelected() ? "selected" : void 0,
1189
+ className: "group cursor-pointer data-[state=selected]:bg-primary/8",
1190
+ onClick: (e) => {
1191
+ const target = e.target;
1192
+ if (target.closest("input, select, textarea, button, [role=checkbox]")) return;
1193
+ row.toggleSelected();
1194
+ },
1189
1195
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx13(
1190
1196
  TableCell,
1191
1197
  {
1192
1198
  style: { width: cell.column.getSize() },
1193
- className: cell.column.id === "_select" ? "sticky left-0 z-10 bg-background" : "",
1199
+ className: cell.column.id === "_select" ? "sticky left-0 z-10 bg-background group-data-[state=selected]:bg-primary/8" : "",
1194
1200
  children: flexRender(
1195
1201
  cell.column.columnDef.cell,
1196
1202
  cell.getContext()
@@ -1250,41 +1256,56 @@ function ProductTable({
1250
1256
  " selected"
1251
1257
  ] })
1252
1258
  ] }),
1253
- totalPages > 0 && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
1254
- /* @__PURE__ */ jsxs5(
1259
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
1260
+ onConfirmSelection && table.getFilteredSelectedRowModel().rows.length > 0 && /* @__PURE__ */ jsx13(
1255
1261
  Button,
1256
1262
  {
1257
- variant: "outline",
1263
+ onClick: onConfirmSelection,
1264
+ disabled: isSubmitting,
1258
1265
  size: "sm",
1259
- onClick: () => onPageChange(currentPage - 1),
1260
- disabled: currentPage <= 1,
1261
- className: "h-7 px-2",
1262
- children: [
1263
- /* @__PURE__ */ jsx13(ChevronLeft, { className: "size-4" }),
1264
- "Prev"
1265
- ]
1266
+ className: "h-7",
1267
+ children: isSubmitting ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
1268
+ /* @__PURE__ */ jsx13(Loader22, { className: "size-3.5 animate-spin" }),
1269
+ "Submitting..."
1270
+ ] }) : "Confirm selection"
1266
1271
  }
1267
1272
  ),
1268
- /* @__PURE__ */ jsxs5("span", { className: "min-w-[5rem] text-center text-xs text-muted-foreground", children: [
1269
- "Page ",
1270
- currentPage,
1271
- " of ",
1272
- totalPages
1273
- ] }),
1274
- /* @__PURE__ */ jsxs5(
1275
- Button,
1276
- {
1277
- variant: "outline",
1278
- size: "sm",
1279
- onClick: () => onPageChange(currentPage + 1),
1280
- disabled: currentPage >= totalPages,
1281
- className: "h-7 px-2",
1282
- children: [
1283
- "Next",
1284
- /* @__PURE__ */ jsx13(ChevronRight, { className: "size-4" })
1285
- ]
1286
- }
1287
- )
1273
+ totalPages > 0 && /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
1274
+ /* @__PURE__ */ jsxs5(
1275
+ Button,
1276
+ {
1277
+ variant: "outline",
1278
+ size: "sm",
1279
+ onClick: () => onPageChange(currentPage - 1),
1280
+ disabled: currentPage <= 1,
1281
+ className: "h-7 px-2",
1282
+ children: [
1283
+ /* @__PURE__ */ jsx13(ChevronLeft, { className: "size-4" }),
1284
+ "Prev"
1285
+ ]
1286
+ }
1287
+ ),
1288
+ /* @__PURE__ */ jsxs5("span", { className: "min-w-[5rem] text-center text-xs text-muted-foreground", children: [
1289
+ "Page ",
1290
+ currentPage,
1291
+ " of ",
1292
+ totalPages
1293
+ ] }),
1294
+ /* @__PURE__ */ jsxs5(
1295
+ Button,
1296
+ {
1297
+ variant: "outline",
1298
+ size: "sm",
1299
+ onClick: () => onPageChange(currentPage + 1),
1300
+ disabled: currentPage >= totalPages,
1301
+ className: "h-7 px-2",
1302
+ children: [
1303
+ "Next",
1304
+ /* @__PURE__ */ jsx13(ChevronRight, { className: "size-4" })
1305
+ ]
1306
+ }
1307
+ )
1308
+ ] })
1288
1309
  ] })
1289
1310
  ] })
1290
1311
  ] });
@@ -1296,7 +1317,7 @@ function isImageColumn(col) {
1296
1317
 
1297
1318
  // src/SelectProducts/ColumnManager.tsx
1298
1319
  import { useMemo as useMemo2, useState as useState4 } from "react";
1299
- import { Columns, Loader2 as Loader22, Search } from "lucide-react";
1320
+ import { Columns, Loader2 as Loader23, Search } from "lucide-react";
1300
1321
 
1301
1322
  // src/ui/switch.tsx
1302
1323
  import * as SwitchPrimitive from "@radix-ui/react-switch";
@@ -1369,7 +1390,7 @@ function ColumnManager({
1369
1390
  children: [
1370
1391
  /* @__PURE__ */ jsx15(Columns, { className: "size-4" }),
1371
1392
  "Columns",
1372
- loading ? /* @__PURE__ */ jsx15(Loader22, { className: "ml-0.5 size-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ jsxs6(Badge, { variant: "secondary", className: "ml-0.5 text-xs font-normal", children: [
1393
+ loading ? /* @__PURE__ */ jsx15(Loader23, { className: "ml-0.5 size-3.5 animate-spin text-muted-foreground" }) : /* @__PURE__ */ jsxs6(Badge, { variant: "secondary", className: "ml-0.5 text-xs font-normal", children: [
1373
1394
  visibleCount,
1374
1395
  "/",
1375
1396
  allColumns.length
@@ -1488,7 +1509,7 @@ async function updateProduct({
1488
1509
  }
1489
1510
 
1490
1511
  // src/SelectProducts/index.tsx
1491
- import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
1512
+ import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
1492
1513
  function SelectProducts({
1493
1514
  workspaceId,
1494
1515
  storeId,
@@ -1644,7 +1665,6 @@ function SelectProducts({
1644
1665
  );
1645
1666
  return products.filter((p) => selectedIds.includes(p.id));
1646
1667
  }, [rowSelection, products]);
1647
- const hasSelection = selectedProducts.length > 0;
1648
1668
  const handleConfirmSelection = useCallback4(async () => {
1649
1669
  if (!onConfirmSelection) return;
1650
1670
  const productUuids = Array.from(
@@ -1755,29 +1775,11 @@ function SelectProducts({
1755
1775
  totalProducts,
1756
1776
  totalSkus,
1757
1777
  onPageChange: handlePageChange,
1758
- globalFilter
1778
+ globalFilter,
1779
+ onConfirmSelection: handleConfirmSelection,
1780
+ isSubmitting
1759
1781
  }
1760
- ) }),
1761
- hasSelection && /* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between rounded-lg border bg-muted/50 px-4 py-2", children: [
1762
- /* @__PURE__ */ jsxs7("span", { className: "text-sm font-medium", children: [
1763
- selectedProducts.length,
1764
- " product",
1765
- selectedProducts.length !== 1 ? "s" : "",
1766
- " selected"
1767
- ] }),
1768
- /* @__PURE__ */ jsx16(
1769
- Button,
1770
- {
1771
- onClick: handleConfirmSelection,
1772
- disabled: isSubmitting,
1773
- size: "sm",
1774
- children: isSubmitting ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
1775
- /* @__PURE__ */ jsx16(Loader23, { className: "size-4 animate-spin" }),
1776
- "Submitting..."
1777
- ] }) : "Confirm selection"
1778
- }
1779
- )
1780
- ] })
1782
+ ) })
1781
1783
  ] });
1782
1784
  }
1783
1785
  function mergeAllowedValues(base, incoming) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/catalogix-chat",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "Catalogix chat components for the Streamoid chat host — store creation, product selection, automations",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,10 +20,10 @@
20
20
  "prepublishOnly": "npm run build"
21
21
  },
22
22
  "peerDependencies": {
23
- "react": "^18.0.0",
24
- "react-dom": "^18.0.0",
25
23
  "@tanstack/react-table": "^8.0.0",
26
- "lucide-react": ">=0.263.0"
24
+ "lucide-react": ">=0.263.0",
25
+ "react": "^18.0.0",
26
+ "react-dom": "^18.0.0"
27
27
  },
28
28
  "dependencies": {
29
29
  "@radix-ui/react-checkbox": "^1.0.4",
@@ -42,8 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@streamoid/chat-component-types": "^0.1.0",
45
+ "@tanstack/react-table": "^8.21.3",
45
46
  "@types/react": "^18.0.0",
46
47
  "@types/react-dom": "^18.0.0",
48
+ "lucide-react": "^0.576.0",
47
49
  "tsup": "^8.0.0",
48
50
  "typescript": "^5.0.0"
49
51
  },