@nextblock-cms/ecom 0.20.3 → 0.21.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.
Files changed (317) hide show
  1. package/_virtual/_rolldown/runtime.cjs.js +1 -0
  2. package/index.cjs.js +1 -1
  3. package/index.es.js +38 -146
  4. package/lib/CurrencyProvider.cjs.js +1 -1
  5. package/lib/CurrencyProvider.d.ts +1 -1
  6. package/lib/CurrencyProvider.es.js +85 -95
  7. package/lib/PaymentReadinessProvider.cjs.js +1 -1
  8. package/lib/PaymentReadinessProvider.d.ts +1 -1
  9. package/lib/PaymentReadinessProvider.es.js +24 -27
  10. package/lib/cart-store.cjs.js +1 -1
  11. package/lib/cart-store.es.js +109 -121
  12. package/lib/components/AccountNavigationMenu.cjs.js +1 -1
  13. package/lib/components/AccountNavigationMenu.d.ts +1 -1
  14. package/lib/components/AccountNavigationMenu.es.js +36 -50
  15. package/lib/components/AddToCartButton.cjs.js +1 -1
  16. package/lib/components/AddToCartButton.d.ts +1 -1
  17. package/lib/components/AddToCartButton.es.js +94 -89
  18. package/lib/components/Cart.cjs.js +1 -1
  19. package/lib/components/Cart.d.ts +1 -1
  20. package/lib/components/Cart.es.js +261 -180
  21. package/lib/components/CartDrawer.cjs.js +1 -1
  22. package/lib/components/CartDrawer.d.ts +1 -1
  23. package/lib/components/CartDrawer.es.js +218 -148
  24. package/lib/components/CartIcon.cjs.js +1 -1
  25. package/lib/components/CartIcon.d.ts +1 -1
  26. package/lib/components/CartIcon.es.js +33 -35
  27. package/lib/components/Checkout.cjs.js +1 -1
  28. package/lib/components/Checkout.d.ts +1 -1
  29. package/lib/components/Checkout.es.js +1092 -1108
  30. package/lib/components/CouponForm.cjs.js +1 -1
  31. package/lib/components/CouponForm.d.ts +1 -1
  32. package/lib/components/CouponForm.es.js +136 -148
  33. package/lib/components/CurrencySwitcher.cjs.js +1 -1
  34. package/lib/components/CurrencySwitcher.d.ts +1 -1
  35. package/lib/components/CurrencySwitcher.es.js +22 -18
  36. package/lib/components/CustomerProfileForm.cjs.js +1 -1
  37. package/lib/components/CustomerProfileForm.es.js +454 -313
  38. package/lib/components/FeaturedProduct.cjs.js +1 -1
  39. package/lib/components/FeaturedProduct.d.ts +1 -1
  40. package/lib/components/FeaturedProduct.es.js +98 -83
  41. package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
  42. package/lib/components/FreemiusLicensePanel.d.ts +1 -1
  43. package/lib/components/FreemiusLicensePanel.es.js +70 -65
  44. package/lib/components/InvoiceDocument.cjs.js +1 -1
  45. package/lib/components/InvoiceDocument.es.js +256 -192
  46. package/lib/components/InvoiceViewerShell.cjs.js +2 -2
  47. package/lib/components/InvoiceViewerShell.d.ts +1 -1
  48. package/lib/components/InvoiceViewerShell.es.js +75 -106
  49. package/lib/components/ProductCard.cjs.js +1 -1
  50. package/lib/components/ProductCard.d.ts +1 -1
  51. package/lib/components/ProductCard.es.js +186 -171
  52. package/lib/components/ProductDetailsLayout.cjs.js +1 -1
  53. package/lib/components/ProductDetailsLayout.es.js +405 -404
  54. package/lib/components/ProductGallery.cjs.js +1 -1
  55. package/lib/components/ProductGallery.d.ts +1 -1
  56. package/lib/components/ProductGallery.es.js +51 -54
  57. package/lib/components/ProductGrid.cjs.js +1 -1
  58. package/lib/components/ProductGrid.d.ts +1 -1
  59. package/lib/components/ProductGrid.es.js +23 -25
  60. package/lib/components/ShippingEstimator.cjs.js +1 -1
  61. package/lib/components/ShippingEstimator.d.ts +1 -1
  62. package/lib/components/ShippingEstimator.es.js +158 -153
  63. package/lib/components/ShortDescription.cjs.js +1 -1
  64. package/lib/components/ShortDescription.es.js +17 -17
  65. package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
  66. package/lib/components/SimpleTiptapRenderer.es.js +238 -211
  67. package/lib/components/SubscriptionSelector.cjs.js +1 -1
  68. package/lib/components/SubscriptionSelector.es.js +159 -154
  69. package/lib/countries.cjs.js +1 -1
  70. package/lib/countries.es.js +232 -75
  71. package/lib/coupon-server.cjs.js +1 -1
  72. package/lib/coupon-server.es.js +180 -224
  73. package/lib/coupons.cjs.js +1 -1
  74. package/lib/coupons.es.js +12 -14
  75. package/lib/currency-constants.cjs.js +1 -1
  76. package/lib/currency-constants.es.js +4 -4
  77. package/lib/currency-rest-client.cjs.js +1 -1
  78. package/lib/currency-rest-client.es.js +15 -22
  79. package/lib/currency-store.cjs.js +1 -1
  80. package/lib/currency-store.es.js +20 -27
  81. package/lib/currency-sync.cjs.js +1 -1
  82. package/lib/currency-sync.es.js +124 -170
  83. package/lib/currency.cjs.js +1 -1
  84. package/lib/currency.es.js +242 -310
  85. package/lib/customer-addresses.cjs.js +1 -1
  86. package/lib/customer-addresses.es.js +80 -109
  87. package/lib/customer-orders.cjs.js +1 -1
  88. package/lib/customer-orders.es.js +31 -43
  89. package/lib/customer.cjs.js +1 -1
  90. package/lib/customer.es.js +43 -52
  91. package/lib/export-helpers.cjs.js +1 -1
  92. package/lib/export-helpers.es.js +53 -52
  93. package/lib/factory.cjs.js +1 -1
  94. package/lib/factory.es.js +10 -7
  95. package/lib/freemius-coupons.cjs.js +1 -1
  96. package/lib/freemius-coupons.es.js +245 -262
  97. package/lib/freemius-license-claim.cjs.js +1 -1
  98. package/lib/freemius-license-claim.es.js +87 -71
  99. package/lib/freemius-license.cjs.js +1 -1
  100. package/lib/freemius-license.es.js +32 -39
  101. package/lib/freemius-order-sync.cjs.js +1 -1
  102. package/lib/freemius-order-sync.es.js +226 -290
  103. package/lib/freemius-trial-provision.cjs.js +1 -1
  104. package/lib/freemius-trial-provision.es.js +136 -130
  105. package/lib/inventory-settings.cjs.js +1 -1
  106. package/lib/inventory-settings.es.js +69 -77
  107. package/lib/invoice-server.cjs.js +3 -3
  108. package/lib/invoice-server.es.js +94 -141
  109. package/lib/invoice-ui.cjs.js +1 -1
  110. package/lib/invoice-ui.es.js +50 -66
  111. package/lib/invoice.cjs.js +1 -1
  112. package/lib/invoice.es.js +85 -94
  113. package/lib/order-inventory.cjs.js +25 -25
  114. package/lib/order-inventory.es.js +67 -79
  115. package/lib/order-tax-details.cjs.js +1 -1
  116. package/lib/order-tax-details.es.js +142 -153
  117. package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
  118. package/lib/pages/cms/coupons/CouponEditorForm.d.ts +1 -1
  119. package/lib/pages/cms/coupons/CouponEditorForm.es.js +227 -185
  120. package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
  121. package/lib/pages/cms/coupons/CouponsPage.d.ts +1 -1
  122. package/lib/pages/cms/coupons/CouponsPage.es.js +235 -166
  123. package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
  124. package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +1 -1
  125. package/lib/pages/cms/coupons/CreateCouponDialog.es.js +35 -34
  126. package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
  127. package/lib/pages/cms/coupons/EditCouponPage.d.ts +1 -1
  128. package/lib/pages/cms/coupons/EditCouponPage.es.js +47 -47
  129. package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
  130. package/lib/pages/cms/coupons/ProductScopePicker.d.ts +1 -1
  131. package/lib/pages/cms/coupons/ProductScopePicker.es.js +128 -117
  132. package/lib/pages/cms/coupons/actions.cjs.js +1 -1
  133. package/lib/pages/cms/coupons/actions.es.js +112 -115
  134. package/lib/pages/cms/coupons/index.cjs.js +1 -0
  135. package/lib/pages/cms/coupons/index.es.js +3 -0
  136. package/lib/pages/cms/coupons/product-options.cjs.js +1 -1
  137. package/lib/pages/cms/coupons/product-options.es.js +21 -23
  138. package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
  139. package/lib/pages/cms/orders/ExportReportsDialog.es.js +135 -129
  140. package/lib/pages/cms/orders/MarkPaidButton.d.ts +1 -1
  141. package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
  142. package/lib/pages/cms/orders/OrderDetailPage.d.ts +1 -1
  143. package/lib/pages/cms/orders/OrderDetailPage.es.js +186 -134
  144. package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
  145. package/lib/pages/cms/orders/OrderPrintButton.d.ts +1 -1
  146. package/lib/pages/cms/orders/OrderPrintButton.es.js +15 -21
  147. package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
  148. package/lib/pages/cms/orders/OrderStatusForm.d.ts +1 -1
  149. package/lib/pages/cms/orders/OrderStatusForm.es.js +85 -69
  150. package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
  151. package/lib/pages/cms/orders/OrdersPage.d.ts +1 -1
  152. package/lib/pages/cms/orders/OrdersPage.es.js +170 -102
  153. package/lib/pages/cms/orders/actions.cjs.js +3 -3
  154. package/lib/pages/cms/orders/actions.es.js +53 -69
  155. package/lib/pages/cms/orders/export-actions.cjs.js +1 -1
  156. package/lib/pages/cms/orders/export-actions.es.js +23 -26
  157. package/lib/pages/cms/orders/index.cjs.js +1 -0
  158. package/lib/pages/cms/orders/index.es.js +6 -0
  159. package/lib/pages/cms/orders/server-actions.cjs.js +1 -1
  160. package/lib/pages/cms/orders/server-actions.es.js +60 -51
  161. package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
  162. package/lib/pages/cms/payments/PaymentsClient.d.ts +1 -1
  163. package/lib/pages/cms/payments/PaymentsClient.es.js +316 -346
  164. package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
  165. package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -1
  166. package/lib/pages/cms/payments/PaymentsPage.es.js +29 -32
  167. package/lib/pages/cms/payments/actions.cjs.js +1 -1
  168. package/lib/pages/cms/payments/actions.es.js +38 -48
  169. package/lib/pages/cms/payments/index.cjs.js +1 -0
  170. package/lib/pages/cms/payments/index.es.js +3 -0
  171. package/lib/pages/cms/payments/queries.cjs.js +1 -1
  172. package/lib/pages/cms/payments/queries.es.js +38 -48
  173. package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
  174. package/lib/pages/cms/products/ProductsPage.d.ts +1 -1
  175. package/lib/pages/cms/products/ProductsPage.es.js +63 -66
  176. package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +1 -1
  177. package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
  178. package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +138 -155
  179. package/lib/pages/cms/products/actions.cjs.js +4 -4
  180. package/lib/pages/cms/products/actions.es.js +121 -162
  181. package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
  182. package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -1
  183. package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +55 -47
  184. package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
  185. package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +1 -1
  186. package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +285 -290
  187. package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
  188. package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -1
  189. package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +43 -35
  190. package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
  191. package/lib/pages/cms/products/categories/components/CategoryManager.es.js +315 -262
  192. package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
  193. package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +115 -113
  194. package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
  195. package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +1 -1
  196. package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +136 -145
  197. package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
  198. package/lib/pages/cms/products/components/DeleteProductButton.d.ts +1 -1
  199. package/lib/pages/cms/products/components/DeleteProductButton.es.js +35 -47
  200. package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
  201. package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +1 -1
  202. package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +106 -84
  203. package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
  204. package/lib/pages/cms/products/components/ProductCategorySelector.es.js +156 -159
  205. package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
  206. package/lib/pages/cms/products/components/ProductForm.es.js +872 -693
  207. package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
  208. package/lib/pages/cms/products/components/ProductMediaManager.es.js +106 -103
  209. package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
  210. package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +1 -1
  211. package/lib/pages/cms/products/components/ProductsBulkTable.es.js +303 -294
  212. package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
  213. package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +1 -1
  214. package/lib/pages/cms/products/components/SaleScheduleFields.es.js +111 -134
  215. package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
  216. package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +1 -1
  217. package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +29 -35
  218. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
  219. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +1 -1
  220. package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +36 -48
  221. package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -1
  222. package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
  223. package/lib/pages/cms/products/components/VariationsEditor.d.ts +1 -1
  224. package/lib/pages/cms/products/components/VariationsEditor.es.js +396 -405
  225. package/lib/pages/cms/products/index.cjs.js +1 -0
  226. package/lib/pages/cms/products/index.es.js +8 -0
  227. package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
  228. package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -1
  229. package/lib/pages/cms/products/inventory/InventoryPage.es.js +21 -15
  230. package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
  231. package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +1 -1
  232. package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +230 -209
  233. package/lib/pages/cms/products/inventory/actions.cjs.js +3 -3
  234. package/lib/pages/cms/products/inventory/actions.es.js +83 -91
  235. package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
  236. package/lib/pages/cms/products/new/NewProductPage.d.ts +1 -1
  237. package/lib/pages/cms/products/new/NewProductPage.es.js +58 -74
  238. package/lib/pages/cms/products/product-price-sync.cjs.js +1 -1
  239. package/lib/pages/cms/products/product-price-sync.es.js +74 -89
  240. package/lib/pages/cms/products/server-actions.cjs.js +1 -1
  241. package/lib/pages/cms/products/server-actions.es.js +250 -233
  242. package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
  243. package/lib/pages/cms/shipping/ShippingPage.es.js +287 -209
  244. package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
  245. package/lib/pages/cms/shipping/components/RateForm.d.ts +1 -1
  246. package/lib/pages/cms/shipping/components/RateForm.es.js +439 -436
  247. package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
  248. package/lib/pages/cms/shipping/components/ZoneForm.es.js +245 -224
  249. package/lib/pages/cms/shipping/index.cjs.js +1 -0
  250. package/lib/pages/cms/shipping/index.es.js +3 -0
  251. package/lib/pages/cms/shipping/server-actions.cjs.js +1 -1
  252. package/lib/pages/cms/shipping/server-actions.es.js +131 -149
  253. package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
  254. package/lib/pages/cms/taxes/TaxesPage.d.ts +1 -1
  255. package/lib/pages/cms/taxes/TaxesPage.es.js +211 -169
  256. package/lib/pages/cms/taxes/actions.cjs.js +1 -1
  257. package/lib/pages/cms/taxes/actions.es.js +41 -53
  258. package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
  259. package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +1 -1
  260. package/lib/pages/cms/taxes/components/TaxRateForm.es.js +112 -99
  261. package/lib/pages/cms/taxes/index.cjs.js +1 -0
  262. package/lib/pages/cms/taxes/index.es.js +3 -0
  263. package/lib/payment-config.cjs.js +1 -1
  264. package/lib/payment-config.es.js +110 -126
  265. package/lib/product-actions.cjs.js +4 -4
  266. package/lib/product-actions.es.js +289 -544
  267. package/lib/product-context.cjs.js +1 -1
  268. package/lib/product-context.es.js +13 -15
  269. package/lib/product-schema.cjs.js +1 -1
  270. package/lib/product-schema.es.js +99 -134
  271. package/lib/providers/freemius.cjs.js +1 -5
  272. package/lib/providers/freemius.es.js +446 -530
  273. package/lib/providers/stripe.cjs.js +1 -1
  274. package/lib/providers/stripe.es.js +417 -477
  275. package/lib/server-actions/coupon-actions.cjs.js +1 -1
  276. package/lib/server-actions/coupon-actions.es.js +22 -22
  277. package/lib/server-actions/customer-actions.cjs.js +1 -1
  278. package/lib/server-actions/customer-actions.es.js +26 -28
  279. package/lib/server-actions/product-actions.cjs.js +1 -1
  280. package/lib/server-actions/product-actions.es.js +9 -15
  281. package/lib/server-actions/shipping-actions.cjs.js +1 -1
  282. package/lib/server-actions/shipping-actions.es.js +27 -24
  283. package/lib/server-actions/tax-actions.cjs.js +1 -1
  284. package/lib/server-actions/tax-actions.es.js +33 -39
  285. package/lib/shared-inventory.cjs.js +2 -2
  286. package/lib/shared-inventory.es.js +111 -160
  287. package/lib/shipping/resolver.cjs.js +2 -2
  288. package/lib/shipping/resolver.es.js +44 -61
  289. package/lib/shipping-rate-currency.cjs.js +1 -1
  290. package/lib/shipping-rate-currency.es.js +52 -67
  291. package/lib/states.cjs.js +1 -1
  292. package/lib/states.es.js +333 -154
  293. package/lib/stripe/checkout.cjs.js +1 -1
  294. package/lib/stripe/checkout.es.js +125 -181
  295. package/lib/stripe/client.cjs.js +1 -1
  296. package/lib/stripe/client.es.js +14 -19
  297. package/lib/stripe/order-sync.cjs.js +1 -1
  298. package/lib/stripe/order-sync.es.js +106 -126
  299. package/lib/stripe/webhooks.cjs.js +1 -1
  300. package/lib/stripe/webhooks.es.js +37 -31
  301. package/lib/tax-calculation.cjs.js +1 -1
  302. package/lib/tax-calculation.es.js +84 -98
  303. package/lib/trials.cjs.js +1 -1
  304. package/lib/trials.es.js +24 -30
  305. package/lib/types.cjs.js +1 -1
  306. package/lib/types.es.js +21 -27
  307. package/lib/use-cart.cjs.js +1 -1
  308. package/lib/use-cart.es.js +38 -40
  309. package/lib/use-price-formatter.cjs.js +1 -1
  310. package/lib/use-price-formatter.es.js +10 -11
  311. package/lib/variation-utils.cjs.js +1 -1
  312. package/lib/variation-utils.es.js +199 -261
  313. package/lib/zod-config.cjs.js +1 -1
  314. package/lib/zod-config.es.js +5 -6
  315. package/package.json +16 -16
  316. package/server.cjs.js +1 -1
  317. package/server.es.js +56 -211
@@ -1,263 +1,316 @@
1
- 'use client';
2
- import { jsxs as t, jsx as r, Fragment as R } from "react/jsx-runtime";
3
- import { useState as i, useEffect as G } from "react";
4
- import { FolderPlus as J, Loader2 as Q, FolderKanban as V, HelpCircle as W, Edit2 as X, Trash2 as Y } from "lucide-react";
5
- import { toast as l } from "sonner";
6
- import { useRouter as Z } from "next/navigation";
7
- import { Card as j, Label as c, Input as w, Textarea as I, Button as g } from "@nextblock-cms/ui";
8
- function oe({
9
- initialCategories: h = [],
10
- languages: L = [],
11
- createCategory: M,
12
- updateCategory: P,
13
- deleteCategory: _
14
- }) {
15
- const C = Z(), [k, q] = i(h), [d, m] = i(!1), [o, F] = i(null), [u, b] = i(""), [S, p] = i(""), [T, x] = i(""), [z, f] = i({}), [D, N] = i({}), [A, y] = i(!1), E = (L || []).filter((e) => !e.is_default);
16
- G(() => {
17
- q(h);
18
- }, [h]);
19
- const $ = (e) => e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), U = (e) => {
20
- const a = e.target.value;
21
- b(a), !A && !o && p($(a));
22
- }, B = (e) => {
23
- p($(e.target.value)), y(!0);
24
- }, H = (e) => {
25
- F(e), b(e.name), p(e.slug), x(e.description || ""), f(e.name_translations || {}), N(e.description_translations || {}), y(!0);
26
- }, v = () => {
27
- F(null), b(""), p(""), x(""), f({}), N({}), y(!1);
28
- }, K = async (e) => {
29
- if (e.preventDefault(), !u.trim()) {
30
- l.error("Category name is required.");
31
- return;
32
- }
33
- m(!0);
34
- const a = l.loading(
35
- o ? "Updating category..." : "Creating category..."
36
- );
37
- try {
38
- const s = {
39
- name: u.trim(),
40
- slug: S.trim() || void 0,
41
- description: T.trim() || void 0,
42
- nameTranslations: z,
43
- descriptionTranslations: D
44
- };
45
- let n;
46
- o ? n = await P(o.id, s) : n = await M(s), n.success ? (l.success(
47
- o ? "Category updated successfully!" : "Category created successfully!",
48
- { id: a }
49
- ), v(), C.refresh()) : l.error(n.error || "Failed to save category.", { id: a });
50
- } catch (s) {
51
- l.error(s.message || "An unexpected error occurred.", { id: a });
52
- } finally {
53
- m(!1);
54
- }
55
- }, O = async (e) => {
56
- const a = `Are you sure you want to delete the category "${e.name}"? This will detach it from any assigned products.`;
57
- if (!window.confirm(a))
58
- return;
59
- m(!0);
60
- const s = l.loading("Deleting category...");
61
- try {
62
- const n = await _(e.id);
63
- n.success ? (l.success("Category deleted successfully!", { id: s }), o?.id === e.id && v(), C.refresh()) : l.error(n.error || "Failed to delete category.", { id: s });
64
- } catch (n) {
65
- l.error(n.message || "An unexpected error occurred.", { id: s });
66
- } finally {
67
- m(!1);
68
- }
69
- };
70
- return /* @__PURE__ */ t("div", { className: "grid gap-6 md:grid-cols-12 items-start", children: [
71
- /* @__PURE__ */ r("div", { className: "md:col-span-4 space-y-4", children: /* @__PURE__ */ t(j, { className: "p-5 shadow-lg border-t-4 border-t-amber-500 bg-card/65 backdrop-blur-md transition-all duration-300", children: [
72
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-4", children: [
73
- /* @__PURE__ */ r(J, { className: "h-5 w-5 text-amber-500" }),
74
- /* @__PURE__ */ r("h2", { className: "text-base font-bold tracking-tight", children: o ? "Edit Category" : "Add New Category" })
75
- ] }),
76
- /* @__PURE__ */ t("form", { onSubmit: K, className: "space-y-4", children: [
77
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
78
- /* @__PURE__ */ r(c, { htmlFor: "name", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Name" }),
79
- /* @__PURE__ */ r(
80
- w,
81
- {
82
- id: "name",
83
- placeholder: "e.g. T-Shirts",
84
- value: u,
85
- onChange: U,
86
- disabled: d,
87
- className: "h-8 text-sm",
88
- required: !0
89
- }
90
- )
91
- ] }),
92
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
93
- /* @__PURE__ */ t(c, { htmlFor: "slug", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none flex items-center justify-between w-full", children: [
94
- /* @__PURE__ */ r("span", { children: "Slug" }),
95
- !A && !o && /* @__PURE__ */ r("span", { className: "text-[10px] text-amber-600 dark:text-amber-400 capitalize", children: "Auto-generating" })
96
- ] }),
97
- /* @__PURE__ */ r(
98
- w,
99
- {
100
- id: "slug",
101
- placeholder: "e.g. t-shirts",
102
- value: S,
103
- onChange: B,
104
- disabled: d,
105
- className: "h-8 text-sm font-mono"
106
- }
107
- )
108
- ] }),
109
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
110
- /* @__PURE__ */ r(c, { htmlFor: "description", className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Description" }),
111
- /* @__PURE__ */ r(
112
- I,
113
- {
114
- id: "description",
115
- placeholder: "Optional description of the category...",
116
- value: T,
117
- onChange: (e) => x(e.target.value),
118
- disabled: d,
119
- className: "text-sm min-h-[90px] resize-none"
120
- }
121
- )
122
- ] }),
123
- E.length > 0 && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
124
- /* @__PURE__ */ r("h3", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider", children: "Translations" }),
125
- E.map((e) => /* @__PURE__ */ t("div", { className: "space-y-3 p-3 rounded-md bg-muted/30 border border-border/30", children: [
126
- /* @__PURE__ */ r("span", { className: "text-[11px] font-bold text-amber-600 dark:text-amber-400 uppercase tracking-wider", children: e.name }),
127
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
128
- /* @__PURE__ */ t(c, { htmlFor: `name-${e.code}`, className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none", children: [
129
- "Name (",
130
- e.code,
131
- ")"
132
- ] }),
133
- /* @__PURE__ */ r(
134
- w,
135
- {
136
- id: `name-${e.code}`,
137
- placeholder: `Translation for ${u || "Name"}`,
138
- value: z[e.code] || "",
139
- onChange: (a) => f((s) => ({ ...s, [e.code]: a.target.value })),
140
- disabled: d,
141
- className: "h-8 text-sm"
142
- }
143
- )
144
- ] }),
145
- /* @__PURE__ */ t("div", { className: "space-y-1", children: [
146
- /* @__PURE__ */ t(c, { htmlFor: `desc-${e.code}`, className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none", children: [
147
- "Description (",
148
- e.code,
149
- ")"
150
- ] }),
151
- /* @__PURE__ */ r(
152
- I,
153
- {
154
- id: `desc-${e.code}`,
155
- placeholder: "Translation for Description",
156
- value: D[e.code] || "",
157
- onChange: (a) => N((s) => ({ ...s, [e.code]: a.target.value })),
158
- disabled: d,
159
- className: "text-sm min-h-[60px] resize-none"
160
- }
161
- )
162
- ] })
163
- ] }, e.code))
164
- ] }),
165
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 pt-2", children: [
166
- /* @__PURE__ */ r(
167
- g,
168
- {
169
- type: "submit",
170
- disabled: d,
171
- size: "sm",
172
- className: "flex-1 bg-amber-600 hover:bg-amber-500 text-white font-medium shadow-md shadow-amber-600/10 h-8 text-xs cursor-pointer",
173
- children: d ? /* @__PURE__ */ t(R, { children: [
174
- /* @__PURE__ */ r(Q, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }),
175
- "Saving..."
176
- ] }) : o ? "Update Category" : "Create Category"
177
- }
178
- ),
179
- o && /* @__PURE__ */ r(
180
- g,
181
- {
182
- type: "button",
183
- onClick: v,
184
- disabled: d,
185
- variant: "outline",
186
- size: "sm",
187
- className: "h-8 text-xs border-dashed cursor-pointer",
188
- children: "Cancel"
189
- }
190
- )
191
- ] })
192
- ] })
193
- ] }) }),
194
- /* @__PURE__ */ r("div", { className: "md:col-span-8", children: /* @__PURE__ */ t(j, { className: "p-4 shadow-lg bg-card/65 backdrop-blur-md border border-border/40", children: [
195
- /* @__PURE__ */ t("div", { className: "flex items-center gap-2 mb-4 pb-2 border-b border-border/50", children: [
196
- /* @__PURE__ */ r(V, { className: "h-5 w-5 text-muted-foreground" }),
197
- /* @__PURE__ */ t("div", { children: [
198
- /* @__PURE__ */ r("h2", { className: "text-base font-bold tracking-tight", children: "Active Categories" }),
199
- /* @__PURE__ */ r("p", { className: "text-[11px] text-muted-foreground leading-none mt-0.5", children: "Categories are shared globally across languages." })
200
- ] })
201
- ] }),
202
- k.length === 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-border/60 rounded-lg bg-muted/20 animate-in fade-in duration-300", children: [
203
- /* @__PURE__ */ r(W, { className: "h-10 w-10 text-muted-foreground/50 mb-3" }),
204
- /* @__PURE__ */ r("h3", { className: "text-sm font-bold text-muted-foreground", children: "No Categories Found" }),
205
- /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground/80 max-w-sm mt-1", children: "Add your first category using the form on the left to start organizing your catalog products." })
206
- ] }) : /* @__PURE__ */ r("div", { className: "overflow-x-auto border rounded-lg bg-background/50", children: /* @__PURE__ */ t("table", { className: "w-full text-left border-collapse text-xs", children: [
207
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b bg-muted/40 font-bold uppercase tracking-wider text-muted-foreground/85 select-none", children: [
208
- /* @__PURE__ */ r("th", { className: "p-3 pl-4", children: "Name" }),
209
- /* @__PURE__ */ r("th", { className: "p-3", children: "Slug" }),
210
- /* @__PURE__ */ r("th", { className: "p-3 text-center", children: "Products" }),
211
- /* @__PURE__ */ r("th", { className: "p-3 pr-4 text-right", children: "Actions" })
212
- ] }) }),
213
- /* @__PURE__ */ r("tbody", { className: "divide-y divide-border/60", children: k.map((e) => /* @__PURE__ */ t(
214
- "tr",
215
- {
216
- className: "hover:bg-muted/10 transition-colors group",
217
- children: [
218
- /* @__PURE__ */ t("td", { className: "p-3 pl-4", children: [
219
- /* @__PURE__ */ r("div", { className: "font-semibold text-slate-800 dark:text-slate-100", children: e.name }),
220
- e.description && /* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground mt-0.5 max-w-xs truncate leading-normal", title: e.description, children: e.description })
221
- ] }),
222
- /* @__PURE__ */ r("td", { className: "p-3", children: /* @__PURE__ */ t("code", { className: "px-1.5 py-0.5 rounded bg-muted/65 font-mono text-[10px]", children: [
223
- "/",
224
- e.slug
225
- ] }) }),
226
- /* @__PURE__ */ r("td", { className: "p-3 text-center", children: /* @__PURE__ */ r("span", { className: "inline-flex items-center justify-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/15", children: e.productCount }) }),
227
- /* @__PURE__ */ r("td", { className: "p-3 pr-4 text-right", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-1.5", children: [
228
- /* @__PURE__ */ r(
229
- g,
230
- {
231
- variant: "outline",
232
- size: "icon",
233
- disabled: d,
234
- onClick: () => H(e),
235
- className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-amber-500/30 cursor-pointer",
236
- title: "Edit Category",
237
- children: /* @__PURE__ */ r(X, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-amber-600 dark:group-hover:text-amber-400" })
238
- }
239
- ),
240
- /* @__PURE__ */ r(
241
- g,
242
- {
243
- variant: "outline",
244
- size: "icon",
245
- disabled: d,
246
- onClick: () => O(e),
247
- className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-red-500/30 cursor-pointer",
248
- title: "Delete Category",
249
- children: /* @__PURE__ */ r(Y, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-red-500" })
250
- }
251
- )
252
- ] }) })
253
- ]
254
- },
255
- e.id
256
- )) })
257
- ] }) })
258
- ] }) })
259
- ] });
1
+ "use client";
2
+ import { useEffect as e, useState as t } from "react";
3
+ import { Edit2 as n, FolderKanban as r, FolderPlus as i, HelpCircle as a, Loader2 as o, Trash2 as s } from "lucide-react";
4
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
5
+ import { toast as d } from "sonner";
6
+ import { useRouter as f } from "next/navigation";
7
+ import { Button as p, Card as m, Input as h, Label as g, Textarea as _ } from "@nextblock-cms/ui";
8
+ //#region libs/ecommerce/src/lib/pages/cms/products/categories/components/CategoryManager.tsx
9
+ function v({ initialCategories: v = [], languages: y = [], createCategory: b, updateCategory: x, deleteCategory: S }) {
10
+ let C = f(), [w, T] = t(v), [E, D] = t(!1), [O, k] = t(null), [A, j] = t(""), [M, N] = t(""), [P, F] = t(""), [I, L] = t({}), [R, z] = t({}), [B, V] = t(!1), H = (y || []).filter((e) => !e.is_default);
11
+ e(() => {
12
+ T(v);
13
+ }, [v]);
14
+ let U = (e) => e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, ""), W = (e) => {
15
+ let t = e.target.value;
16
+ j(t), !B && !O && N(U(t));
17
+ }, G = (e) => {
18
+ N(U(e.target.value)), V(!0);
19
+ }, K = (e) => {
20
+ k(e), j(e.name), N(e.slug), F(e.description || ""), L(e.name_translations || {}), z(e.description_translations || {}), V(!0);
21
+ }, q = () => {
22
+ k(null), j(""), N(""), F(""), L({}), z({}), V(!1);
23
+ }, J = async (e) => {
24
+ if (e.preventDefault(), !A.trim()) {
25
+ d.error("Category name is required.");
26
+ return;
27
+ }
28
+ D(!0);
29
+ let t = d.loading(O ? "Updating category..." : "Creating category...");
30
+ try {
31
+ let e = {
32
+ name: A.trim(),
33
+ slug: M.trim() || void 0,
34
+ description: P.trim() || void 0,
35
+ nameTranslations: I,
36
+ descriptionTranslations: R
37
+ }, n;
38
+ n = O ? await x(O.id, e) : await b(e), n.success ? (d.success(O ? "Category updated successfully!" : "Category created successfully!", { id: t }), q(), C.refresh()) : d.error(n.error || "Failed to save category.", { id: t });
39
+ } catch (e) {
40
+ d.error(e.message || "An unexpected error occurred.", { id: t });
41
+ } finally {
42
+ D(!1);
43
+ }
44
+ }, Y = async (e) => {
45
+ let t = `Are you sure you want to delete the category "${e.name}"? This will detach it from any assigned products.`;
46
+ if (!window.confirm(t)) return;
47
+ D(!0);
48
+ let n = d.loading("Deleting category...");
49
+ try {
50
+ let t = await S(e.id);
51
+ t.success ? (d.success("Category deleted successfully!", { id: n }), O?.id === e.id && q(), C.refresh()) : d.error(t.error || "Failed to delete category.", { id: n });
52
+ } catch (e) {
53
+ d.error(e.message || "An unexpected error occurred.", { id: n });
54
+ } finally {
55
+ D(!1);
56
+ }
57
+ };
58
+ return /* @__PURE__ */ u("div", {
59
+ className: "grid gap-6 md:grid-cols-12 items-start",
60
+ children: [/* @__PURE__ */ l("div", {
61
+ className: "md:col-span-4 space-y-4",
62
+ children: /* @__PURE__ */ u(m, {
63
+ className: "p-5 shadow-lg border-t-4 border-t-amber-500 bg-card/65 backdrop-blur-md transition-all duration-300",
64
+ children: [/* @__PURE__ */ u("div", {
65
+ className: "flex items-center gap-2 mb-4",
66
+ children: [/* @__PURE__ */ l(i, { className: "h-5 w-5 text-amber-500" }), /* @__PURE__ */ l("h2", {
67
+ className: "text-base font-bold tracking-tight",
68
+ children: O ? "Edit Category" : "Add New Category"
69
+ })]
70
+ }), /* @__PURE__ */ u("form", {
71
+ onSubmit: J,
72
+ className: "space-y-4",
73
+ children: [
74
+ /* @__PURE__ */ u("div", {
75
+ className: "space-y-1",
76
+ children: [/* @__PURE__ */ l(g, {
77
+ htmlFor: "name",
78
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
79
+ children: "Name"
80
+ }), /* @__PURE__ */ l(h, {
81
+ id: "name",
82
+ placeholder: "e.g. T-Shirts",
83
+ value: A,
84
+ onChange: W,
85
+ disabled: E,
86
+ className: "h-8 text-sm",
87
+ required: !0
88
+ })]
89
+ }),
90
+ /* @__PURE__ */ u("div", {
91
+ className: "space-y-1",
92
+ children: [/* @__PURE__ */ u(g, {
93
+ htmlFor: "slug",
94
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none flex items-center justify-between w-full",
95
+ children: [/* @__PURE__ */ l("span", { children: "Slug" }), !B && !O && /* @__PURE__ */ l("span", {
96
+ className: "text-[10px] text-amber-600 dark:text-amber-400 capitalize",
97
+ children: "Auto-generating"
98
+ })]
99
+ }), /* @__PURE__ */ l(h, {
100
+ id: "slug",
101
+ placeholder: "e.g. t-shirts",
102
+ value: M,
103
+ onChange: G,
104
+ disabled: E,
105
+ className: "h-8 text-sm font-mono"
106
+ })]
107
+ }),
108
+ /* @__PURE__ */ u("div", {
109
+ className: "space-y-1",
110
+ children: [/* @__PURE__ */ l(g, {
111
+ htmlFor: "description",
112
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none",
113
+ children: "Description"
114
+ }), /* @__PURE__ */ l(_, {
115
+ id: "description",
116
+ placeholder: "Optional description of the category...",
117
+ value: P,
118
+ onChange: (e) => F(e.target.value),
119
+ disabled: E,
120
+ className: "text-sm min-h-[90px] resize-none"
121
+ })]
122
+ }),
123
+ H.length > 0 && /* @__PURE__ */ u("div", {
124
+ className: "border-t border-border/50 pt-4 mt-4 space-y-4",
125
+ children: [/* @__PURE__ */ l("h3", {
126
+ className: "text-xs uppercase font-bold text-muted-foreground tracking-wider",
127
+ children: "Translations"
128
+ }), H.map((e) => /* @__PURE__ */ u("div", {
129
+ className: "space-y-3 p-3 rounded-md bg-muted/30 border border-border/30",
130
+ children: [
131
+ /* @__PURE__ */ l("span", {
132
+ className: "text-[11px] font-bold text-amber-600 dark:text-amber-400 uppercase tracking-wider",
133
+ children: e.name
134
+ }),
135
+ /* @__PURE__ */ u("div", {
136
+ className: "space-y-1",
137
+ children: [/* @__PURE__ */ u(g, {
138
+ htmlFor: `name-${e.code}`,
139
+ className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
140
+ children: [
141
+ "Name (",
142
+ e.code,
143
+ ")"
144
+ ]
145
+ }), /* @__PURE__ */ l(h, {
146
+ id: `name-${e.code}`,
147
+ placeholder: `Translation for ${A || "Name"}`,
148
+ value: I[e.code] || "",
149
+ onChange: (t) => L((n) => ({
150
+ ...n,
151
+ [e.code]: t.target.value
152
+ })),
153
+ disabled: E,
154
+ className: "h-8 text-sm"
155
+ })]
156
+ }),
157
+ /* @__PURE__ */ u("div", {
158
+ className: "space-y-1",
159
+ children: [/* @__PURE__ */ u(g, {
160
+ htmlFor: `desc-${e.code}`,
161
+ className: "text-[10px] uppercase font-bold text-muted-foreground tracking-wider leading-none",
162
+ children: [
163
+ "Description (",
164
+ e.code,
165
+ ")"
166
+ ]
167
+ }), /* @__PURE__ */ l(_, {
168
+ id: `desc-${e.code}`,
169
+ placeholder: "Translation for Description",
170
+ value: R[e.code] || "",
171
+ onChange: (t) => z((n) => ({
172
+ ...n,
173
+ [e.code]: t.target.value
174
+ })),
175
+ disabled: E,
176
+ className: "text-sm min-h-[60px] resize-none"
177
+ })]
178
+ })
179
+ ]
180
+ }, e.code))]
181
+ }),
182
+ /* @__PURE__ */ u("div", {
183
+ className: "flex items-center gap-2 pt-2",
184
+ children: [/* @__PURE__ */ l(p, {
185
+ type: "submit",
186
+ disabled: E,
187
+ size: "sm",
188
+ className: "flex-1 bg-amber-600 hover:bg-amber-500 text-white font-medium shadow-md shadow-amber-600/10 h-8 text-xs cursor-pointer",
189
+ children: E ? /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(o, { className: "mr-1.5 h-3.5 w-3.5 animate-spin" }), "Saving..."] }) : O ? "Update Category" : "Create Category"
190
+ }), O && /* @__PURE__ */ l(p, {
191
+ type: "button",
192
+ onClick: q,
193
+ disabled: E,
194
+ variant: "outline",
195
+ size: "sm",
196
+ className: "h-8 text-xs border-dashed cursor-pointer",
197
+ children: "Cancel"
198
+ })]
199
+ })
200
+ ]
201
+ })]
202
+ })
203
+ }), /* @__PURE__ */ l("div", {
204
+ className: "md:col-span-8",
205
+ children: /* @__PURE__ */ u(m, {
206
+ className: "p-4 shadow-lg bg-card/65 backdrop-blur-md border border-border/40",
207
+ children: [/* @__PURE__ */ u("div", {
208
+ className: "flex items-center gap-2 mb-4 pb-2 border-b border-border/50",
209
+ children: [/* @__PURE__ */ l(r, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("h2", {
210
+ className: "text-base font-bold tracking-tight",
211
+ children: "Active Categories"
212
+ }), /* @__PURE__ */ l("p", {
213
+ className: "text-[11px] text-muted-foreground leading-none mt-0.5",
214
+ children: "Categories are shared globally across languages."
215
+ })] })]
216
+ }), w.length === 0 ? /* @__PURE__ */ u("div", {
217
+ className: "flex flex-col items-center justify-center py-12 px-4 text-center border-2 border-dashed border-border/60 rounded-lg bg-muted/20 animate-in fade-in duration-300",
218
+ children: [
219
+ /* @__PURE__ */ l(a, { className: "h-10 w-10 text-muted-foreground/50 mb-3" }),
220
+ /* @__PURE__ */ l("h3", {
221
+ className: "text-sm font-bold text-muted-foreground",
222
+ children: "No Categories Found"
223
+ }),
224
+ /* @__PURE__ */ l("p", {
225
+ className: "text-xs text-muted-foreground/80 max-w-sm mt-1",
226
+ children: "Add your first category using the form on the left to start organizing your catalog products."
227
+ })
228
+ ]
229
+ }) : /* @__PURE__ */ l("div", {
230
+ className: "overflow-x-auto border rounded-lg bg-background/50",
231
+ children: /* @__PURE__ */ u("table", {
232
+ className: "w-full text-left border-collapse text-xs",
233
+ children: [/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ u("tr", {
234
+ className: "border-b bg-muted/40 font-bold uppercase tracking-wider text-muted-foreground/85 select-none",
235
+ children: [
236
+ /* @__PURE__ */ l("th", {
237
+ className: "p-3 pl-4",
238
+ children: "Name"
239
+ }),
240
+ /* @__PURE__ */ l("th", {
241
+ className: "p-3",
242
+ children: "Slug"
243
+ }),
244
+ /* @__PURE__ */ l("th", {
245
+ className: "p-3 text-center",
246
+ children: "Products"
247
+ }),
248
+ /* @__PURE__ */ l("th", {
249
+ className: "p-3 pr-4 text-right",
250
+ children: "Actions"
251
+ })
252
+ ]
253
+ }) }), /* @__PURE__ */ l("tbody", {
254
+ className: "divide-y divide-border/60",
255
+ children: w.map((e) => /* @__PURE__ */ u("tr", {
256
+ className: "hover:bg-muted/10 transition-colors group",
257
+ children: [
258
+ /* @__PURE__ */ u("td", {
259
+ className: "p-3 pl-4",
260
+ children: [/* @__PURE__ */ l("div", {
261
+ className: "font-semibold text-slate-800 dark:text-slate-100",
262
+ children: e.name
263
+ }), e.description && /* @__PURE__ */ l("div", {
264
+ className: "text-[10px] text-muted-foreground mt-0.5 max-w-xs truncate leading-normal",
265
+ title: e.description,
266
+ children: e.description
267
+ })]
268
+ }),
269
+ /* @__PURE__ */ l("td", {
270
+ className: "p-3",
271
+ children: /* @__PURE__ */ u("code", {
272
+ className: "px-1.5 py-0.5 rounded bg-muted/65 font-mono text-[10px]",
273
+ children: ["/", e.slug]
274
+ })
275
+ }),
276
+ /* @__PURE__ */ l("td", {
277
+ className: "p-3 text-center",
278
+ children: /* @__PURE__ */ l("span", {
279
+ className: "inline-flex items-center justify-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-500/10 text-amber-800 dark:text-amber-300 border border-amber-500/15",
280
+ children: e.productCount
281
+ })
282
+ }),
283
+ /* @__PURE__ */ l("td", {
284
+ className: "p-3 pr-4 text-right",
285
+ children: /* @__PURE__ */ u("div", {
286
+ className: "flex items-center justify-end gap-1.5",
287
+ children: [/* @__PURE__ */ l(p, {
288
+ variant: "outline",
289
+ size: "icon",
290
+ disabled: E,
291
+ onClick: () => K(e),
292
+ className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-amber-500/30 cursor-pointer",
293
+ title: "Edit Category",
294
+ children: /* @__PURE__ */ l(n, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-amber-600 dark:group-hover:text-amber-400" })
295
+ }), /* @__PURE__ */ l(p, {
296
+ variant: "outline",
297
+ size: "icon",
298
+ disabled: E,
299
+ onClick: () => Y(e),
300
+ className: "h-7 w-7 opacity-85 hover:opacity-100 group-hover:border-red-500/30 cursor-pointer",
301
+ title: "Delete Category",
302
+ children: /* @__PURE__ */ l(s, { className: "h-3.5 w-3.5 text-muted-foreground group-hover:text-red-500" })
303
+ })]
304
+ })
305
+ })
306
+ ]
307
+ }, e.id))
308
+ })]
309
+ })
310
+ })]
311
+ })
312
+ })]
313
+ });
260
314
  }
261
- export {
262
- oe as CategoryManager
263
- };
315
+ //#endregion
316
+ export { v as CategoryManager };