@vendure/dashboard 3.4.3-master-202509260228 → 3.5.0-minor-202510012036

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 (295) hide show
  1. package/README.md +4 -0
  2. package/dist/plugin/api/api-extensions.js +11 -14
  3. package/dist/plugin/api/metrics.resolver.d.ts +2 -2
  4. package/dist/plugin/api/metrics.resolver.js +2 -2
  5. package/dist/plugin/config/metrics-strategies.d.ts +9 -9
  6. package/dist/plugin/config/metrics-strategies.js +6 -6
  7. package/dist/plugin/constants.d.ts +2 -0
  8. package/dist/plugin/constants.js +3 -1
  9. package/dist/plugin/dashboard.plugin.js +13 -0
  10. package/dist/plugin/service/metrics.service.d.ts +3 -3
  11. package/dist/plugin/service/metrics.service.js +37 -53
  12. package/dist/plugin/types.d.ts +9 -12
  13. package/dist/plugin/types.js +7 -11
  14. package/dist/vite/vite-plugin-config.js +13 -9
  15. package/dist/vite/vite-plugin-translations.d.ts +22 -0
  16. package/dist/vite/vite-plugin-translations.js +66 -0
  17. package/dist/vite/vite-plugin-vendure-dashboard.js +10 -8
  18. package/lingui.config.js +25 -2
  19. package/package.json +159 -156
  20. package/src/app/app-providers.tsx +0 -4
  21. package/src/app/common/delete-bulk-action.tsx +6 -5
  22. package/src/app/common/duplicate-bulk-action.tsx +4 -5
  23. package/src/app/common/duplicate-entity-dialog.tsx +1 -1
  24. package/src/app/common/set-document-direction.ts +7 -0
  25. package/src/app/main.tsx +50 -17
  26. package/src/app/routes/_authenticated/_administrators/administrators.tsx +8 -6
  27. package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +17 -6
  28. package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +2 -2
  29. package/src/app/routes/_authenticated/_assets/assets.tsx +1 -1
  30. package/src/app/routes/_authenticated/_assets/assets_.$id.tsx +4 -4
  31. package/src/app/routes/_authenticated/_assets/components/asset-bulk-actions.tsx +8 -6
  32. package/src/app/routes/_authenticated/_assets/components/asset-tag-filter.tsx +1 -1
  33. package/src/app/routes/_authenticated/_assets/components/asset-tags-editor.tsx +1 -1
  34. package/src/app/routes/_authenticated/_assets/components/manage-tags-dialog.tsx +3 -8
  35. package/src/app/routes/_authenticated/_channels/channels.tsx +3 -6
  36. package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +5 -5
  37. package/src/app/routes/_authenticated/_collections/collections.tsx +10 -6
  38. package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +16 -5
  39. package/src/app/routes/_authenticated/_collections/components/collection-bulk-actions.tsx +1 -1
  40. package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +1 -1
  41. package/src/app/routes/_authenticated/_collections/components/move-collections-dialog.tsx +6 -6
  42. package/src/app/routes/_authenticated/_countries/countries.graphql.ts +2 -0
  43. package/src/app/routes/_authenticated/_countries/countries.tsx +2 -3
  44. package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +4 -4
  45. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +1 -1
  46. package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +4 -4
  47. package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +2 -4
  48. package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +13 -6
  49. package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +8 -8
  50. package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +3 -3
  51. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +1 -1
  52. package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-utils.tsx +1 -1
  53. package/src/app/routes/_authenticated/_customers/components/customer-history/default-customer-history-components.tsx +1 -1
  54. package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +1 -1
  55. package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +1 -1
  56. package/src/app/routes/_authenticated/_customers/customers.graphql.ts +4 -0
  57. package/src/app/routes/_authenticated/_customers/customers.tsx +23 -11
  58. package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +10 -8
  59. package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +1 -1
  60. package/src/app/routes/_authenticated/_facets/components/facet-bulk-actions.tsx +6 -5
  61. package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +1 -1
  62. package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +1 -1
  63. package/src/app/routes/_authenticated/_facets/facets.tsx +5 -5
  64. package/src/app/routes/_authenticated/_facets/facets_.$facetId.values_.$id.tsx +7 -5
  65. package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +18 -6
  66. package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +5 -5
  67. package/src/app/routes/_authenticated/_orders/components/add-manual-payment-dialog.tsx +19 -21
  68. package/src/app/routes/_authenticated/_orders/components/customer-address-selector.tsx +1 -1
  69. package/src/app/routes/_authenticated/_orders/components/edit-order-table.tsx +22 -22
  70. package/src/app/routes/_authenticated/_orders/components/fulfill-order-dialog.tsx +6 -6
  71. package/src/app/routes/_authenticated/_orders/components/fulfillment-details.tsx +15 -9
  72. package/src/app/routes/_authenticated/_orders/components/order-address.tsx +1 -1
  73. package/src/app/routes/_authenticated/_orders/components/order-detail-shared.tsx +11 -9
  74. package/src/app/routes/_authenticated/_orders/components/order-history/default-order-history-components.tsx +1 -1
  75. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +1 -1
  76. package/src/app/routes/_authenticated/_orders/components/order-history/order-history-utils.tsx +1 -1
  77. package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +1 -1
  78. package/src/app/routes/_authenticated/_orders/components/order-line-custom-fields-form.tsx +1 -1
  79. package/src/app/routes/_authenticated/_orders/components/order-modification-preview-dialog.tsx +4 -4
  80. package/src/app/routes/_authenticated/_orders/components/order-modification-summary.tsx +1 -1
  81. package/src/app/routes/_authenticated/_orders/components/order-table-totals.tsx +27 -27
  82. package/src/app/routes/_authenticated/_orders/components/order-table.tsx +2 -2
  83. package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +1 -1
  84. package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +26 -20
  85. package/src/app/routes/_authenticated/_orders/components/seller-orders-card.tsx +3 -1
  86. package/src/app/routes/_authenticated/_orders/components/settle-refund-dialog.tsx +6 -6
  87. package/src/app/routes/_authenticated/_orders/components/shipping-method-selector.tsx +1 -1
  88. package/src/app/routes/_authenticated/_orders/components/state-transition-control.tsx +1 -1
  89. package/src/app/routes/_authenticated/_orders/components/use-transition-order-to-state.tsx +3 -2
  90. package/src/app/routes/_authenticated/_orders/orders.tsx +5 -9
  91. package/src/app/routes/_authenticated/_orders/orders_.$aggregateOrderId_.seller-orders.$sellerOrderId.tsx +1 -1
  92. package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +1 -1
  93. package/src/app/routes/_authenticated/_orders/orders_.$id_.modify.tsx +4 -4
  94. package/src/app/routes/_authenticated/_orders/orders_.draft.$id.tsx +17 -17
  95. package/src/app/routes/_authenticated/_orders/utils/order-detail-loaders.tsx +1 -1
  96. package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +5 -6
  97. package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +13 -6
  98. package/src/app/routes/_authenticated/_product-variants/components/product-variant-bulk-actions.tsx +1 -1
  99. package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +1 -1
  100. package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +10 -0
  101. package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +9 -2
  102. package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +13 -6
  103. package/src/app/routes/_authenticated/_products/components/add-option-group-dialog.tsx +5 -5
  104. package/src/app/routes/_authenticated/_products/components/add-product-variant-dialog.tsx +5 -5
  105. package/src/app/routes/_authenticated/_products/components/assign-facet-values-dialog.tsx +5 -4
  106. package/src/app/routes/_authenticated/_products/components/create-product-options-dialog.tsx +9 -12
  107. package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +1 -1
  108. package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +4 -4
  109. package/src/app/routes/_authenticated/_products/components/option-groups-editor.tsx +1 -1
  110. package/src/app/routes/_authenticated/_products/components/product-bulk-actions.tsx +1 -1
  111. package/src/app/routes/_authenticated/_products/components/product-option-group-badge.tsx +19 -0
  112. package/src/app/routes/_authenticated/_products/components/product-option-select.tsx +3 -3
  113. package/src/app/routes/_authenticated/_products/components/product-options-table.tsx +114 -0
  114. package/src/app/routes/_authenticated/_products/product-option-groups.graphql.ts +103 -0
  115. package/src/app/routes/_authenticated/_products/products.graphql.ts +44 -32
  116. package/src/app/routes/_authenticated/_products/products.tsx +34 -5
  117. package/src/app/routes/_authenticated/_products/products_.$id.tsx +29 -12
  118. package/src/app/routes/_authenticated/_products/products_.$id_.variants.tsx +11 -11
  119. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$id.tsx +177 -0
  120. package/src/app/routes/_authenticated/_products/products_.$productId.option-groups.$productOptionGroupId.options_.$id.tsx +208 -0
  121. package/src/app/routes/_authenticated/_profile/profile.tsx +4 -4
  122. package/src/app/routes/_authenticated/_promotions/promotions.tsx +2 -4
  123. package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +16 -9
  124. package/src/app/routes/_authenticated/_roles/components/permissions-table-grid.tsx +1 -1
  125. package/src/app/routes/_authenticated/_roles/roles.tsx +3 -6
  126. package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +4 -6
  127. package/src/app/routes/_authenticated/_sellers/sellers.tsx +3 -4
  128. package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +4 -4
  129. package/src/app/routes/_authenticated/_shipping-methods/components/price-display.tsx +5 -5
  130. package/src/app/routes/_authenticated/_shipping-methods/components/shipping-method-test-result-wrapper.tsx +1 -1
  131. package/src/app/routes/_authenticated/_shipping-methods/components/test-address-form.tsx +11 -11
  132. package/src/app/routes/_authenticated/_shipping-methods/components/test-order-builder.tsx +1 -1
  133. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-result.tsx +8 -8
  134. package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-methods-sheet.tsx +1 -1
  135. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-method-result.tsx +8 -8
  136. package/src/app/routes/_authenticated/_shipping-methods/components/test-single-shipping-method-sheet.tsx +4 -4
  137. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +2 -3
  138. package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +2 -2
  139. package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +3 -4
  140. package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +13 -6
  141. package/src/app/routes/_authenticated/_system/healthchecks.tsx +10 -4
  142. package/src/app/routes/_authenticated/_system/job-queue.tsx +10 -13
  143. package/src/app/routes/_authenticated/_system/scheduled-tasks.tsx +18 -16
  144. package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +2 -4
  145. package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +13 -6
  146. package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +8 -12
  147. package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +6 -4
  148. package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +4 -1
  149. package/src/app/routes/_authenticated/_zones/zones.tsx +4 -4
  150. package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +8 -5
  151. package/src/app/routes/_authenticated/index.tsx +46 -25
  152. package/src/app/styles.css +4 -0
  153. package/src/i18n/common-strings.ts +111 -0
  154. package/src/i18n/locales/ar.po +4777 -0
  155. package/src/i18n/locales/cs.po +4777 -0
  156. package/src/i18n/locales/de.po +4299 -1101
  157. package/src/i18n/locales/en.po +3857 -659
  158. package/src/i18n/locales/es.po +4777 -0
  159. package/src/i18n/locales/fa.po +4777 -0
  160. package/src/i18n/locales/fr.po +4777 -0
  161. package/src/i18n/locales/he.po +4777 -0
  162. package/src/i18n/locales/hr.po +4777 -0
  163. package/src/i18n/locales/it.po +4777 -0
  164. package/src/i18n/locales/ja.po +4777 -0
  165. package/src/i18n/locales/ko.po +4628 -0
  166. package/src/i18n/locales/nb.po +4777 -0
  167. package/src/i18n/locales/ne.po +4777 -0
  168. package/src/i18n/locales/nl.po +4628 -0
  169. package/src/i18n/locales/pl.po +4777 -0
  170. package/src/i18n/locales/pt_BR.po +4777 -0
  171. package/src/i18n/locales/pt_PT.po +4777 -0
  172. package/src/i18n/locales/ru.po +4777 -0
  173. package/src/i18n/locales/sv.po +4777 -0
  174. package/src/i18n/locales/tr.po +4777 -0
  175. package/src/i18n/locales/uk.po +4777 -0
  176. package/src/i18n/locales/zh_Hans.po +4777 -0
  177. package/src/i18n/locales/zh_Hant.po +4777 -0
  178. package/src/lib/components/data-display/json.tsx +16 -1
  179. package/src/lib/components/data-input/combination-mode-input.tsx +1 -1
  180. package/src/lib/components/data-input/custom-field-list-input.tsx +11 -7
  181. package/src/lib/components/data-input/customer-group-input.tsx +27 -33
  182. package/src/lib/components/data-input/datetime-input.tsx +40 -1
  183. package/src/lib/components/data-input/default-relation-input.tsx +5 -4
  184. package/src/lib/components/data-input/index.ts +3 -0
  185. package/src/lib/components/data-input/product-multi-selector-input.tsx +14 -14
  186. package/src/lib/components/data-input/relation-selector.tsx +1 -1
  187. package/src/lib/components/data-input/select-with-options.tsx +1 -1
  188. package/src/lib/components/data-input/slug-input.tsx +290 -0
  189. package/src/lib/components/data-table/add-filter-menu.tsx +17 -10
  190. package/src/lib/components/data-table/data-table-bulk-action-item.tsx +45 -8
  191. package/src/lib/components/data-table/data-table-bulk-actions.tsx +4 -4
  192. package/src/lib/components/data-table/data-table-column-header.tsx +13 -8
  193. package/src/lib/components/data-table/data-table-context.tsx +91 -0
  194. package/src/lib/components/data-table/data-table-faceted-filter.tsx +2 -1
  195. package/src/lib/components/data-table/data-table-filter-badge.tsx +9 -5
  196. package/src/lib/components/data-table/data-table-filter-dialog.tsx +1 -1
  197. package/src/lib/components/data-table/data-table-utils.ts +21 -4
  198. package/src/lib/components/data-table/data-table-view-options.tsx +21 -10
  199. package/src/lib/components/data-table/data-table.tsx +146 -94
  200. package/src/lib/components/data-table/filters/data-table-boolean-filter.tsx +4 -4
  201. package/src/lib/components/data-table/global-views-bar.tsx +97 -0
  202. package/src/lib/components/data-table/global-views-sheet.tsx +11 -0
  203. package/src/lib/components/data-table/human-readable-operator.tsx +1 -1
  204. package/src/lib/components/data-table/manage-global-views-button.tsx +26 -0
  205. package/src/lib/components/data-table/my-views-button.tsx +47 -0
  206. package/src/lib/components/data-table/refresh-button.tsx +12 -3
  207. package/src/lib/components/data-table/save-view-button.tsx +41 -0
  208. package/src/lib/components/data-table/save-view-dialog.tsx +113 -0
  209. package/src/lib/components/data-table/use-generated-columns.tsx +13 -8
  210. package/src/lib/components/data-table/user-views-sheet.tsx +11 -0
  211. package/src/lib/components/data-table/views-sheet.tsx +305 -0
  212. package/src/lib/components/date-range-picker.tsx +186 -0
  213. package/src/lib/components/layout/app-sidebar.tsx +3 -1
  214. package/src/lib/components/layout/channel-switcher.tsx +8 -10
  215. package/src/lib/components/layout/dev-mode-indicator.tsx +1 -1
  216. package/src/lib/components/layout/generated-breadcrumbs.tsx +10 -8
  217. package/src/lib/components/layout/language-dialog.tsx +34 -13
  218. package/src/lib/components/layout/manage-languages-dialog.tsx +1 -1
  219. package/src/lib/components/layout/nav-main.tsx +23 -13
  220. package/src/lib/components/layout/nav-user.tsx +19 -23
  221. package/src/lib/components/login/login-form.tsx +1 -1
  222. package/src/lib/components/shared/asset/asset-bulk-actions.tsx +4 -4
  223. package/src/lib/components/shared/asset/asset-focal-point-editor.tsx +1 -1
  224. package/src/lib/components/shared/asset/asset-gallery.tsx +15 -14
  225. package/src/lib/components/shared/assign-to-channel-bulk-action.tsx +11 -11
  226. package/src/lib/components/shared/assign-to-channel-dialog.tsx +6 -5
  227. package/src/lib/components/shared/channel-code-label.tsx +1 -1
  228. package/src/lib/components/shared/channel-selector.tsx +4 -4
  229. package/src/lib/components/shared/configurable-operation-multi-selector.tsx +16 -14
  230. package/src/lib/components/shared/configurable-operation-selector.tsx +1 -1
  231. package/src/lib/components/shared/confirmation-dialog.tsx +8 -8
  232. package/src/lib/components/shared/country-selector.tsx +1 -1
  233. package/src/lib/components/shared/currency-selector.tsx +4 -4
  234. package/src/lib/components/shared/custom-fields-form.tsx +8 -24
  235. package/src/lib/components/shared/customer-address-form.tsx +3 -3
  236. package/src/lib/components/shared/customer-group-selector.tsx +1 -1
  237. package/src/lib/components/shared/customer-selector.tsx +1 -1
  238. package/src/lib/components/shared/error-page.tsx +1 -1
  239. package/src/lib/components/shared/facet-value-selector.tsx +10 -10
  240. package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +1 -1
  241. package/src/lib/components/shared/history-timeline/history-note-editor.tsx +1 -1
  242. package/src/lib/components/shared/history-timeline/history-note-entry.tsx +1 -1
  243. package/src/lib/components/shared/language-selector.tsx +4 -4
  244. package/src/lib/components/shared/navigation-confirmation.tsx +1 -1
  245. package/src/lib/components/shared/paginated-list-data-table.tsx +64 -34
  246. package/src/lib/components/shared/remove-from-channel-bulk-action.tsx +6 -5
  247. package/src/lib/components/shared/rich-text-editor/image-dialog.tsx +1 -1
  248. package/src/lib/components/shared/rich-text-editor/link-dialog.tsx +1 -1
  249. package/src/lib/components/shared/rich-text-editor/responsive-toolbar.tsx +1 -1
  250. package/src/lib/components/shared/rich-text-editor/table-edit-icons.tsx +1 -1
  251. package/src/lib/components/shared/role-code-label.tsx +1 -1
  252. package/src/lib/components/shared/role-selector.tsx +4 -4
  253. package/src/lib/components/shared/seller-selector.tsx +1 -1
  254. package/src/lib/components/shared/stock-level-label.tsx +3 -5
  255. package/src/lib/components/shared/table-cell/order-table-cell-components.tsx +3 -1
  256. package/src/lib/components/shared/tax-category-selector.tsx +1 -1
  257. package/src/lib/components/shared/translatable-form-field.tsx +15 -15
  258. package/src/lib/components/shared/zone-selector.tsx +1 -1
  259. package/src/lib/components/ui/button.tsx +1 -1
  260. package/src/lib/framework/dashboard-widget/base-widget.tsx +11 -9
  261. package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +35 -6
  262. package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +18 -12
  263. package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +9 -3
  264. package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +26 -79
  265. package/src/lib/framework/dashboard-widget/widget-filters-context.tsx +35 -0
  266. package/src/lib/framework/defaults.ts +34 -63
  267. package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +319 -9
  268. package/src/lib/framework/document-introspection/add-custom-fields.ts +60 -31
  269. package/src/lib/framework/document-introspection/get-document-structure.spec.ts +1 -159
  270. package/src/lib/framework/document-introspection/include-only-selected-list-fields.spec.ts +1840 -0
  271. package/src/lib/framework/document-introspection/include-only-selected-list-fields.ts +940 -0
  272. package/src/lib/framework/document-introspection/testing-utils.ts +161 -0
  273. package/src/lib/framework/extension-api/display-component-extensions.tsx +2 -0
  274. package/src/lib/framework/extension-api/types/data-table.ts +62 -4
  275. package/src/lib/framework/extension-api/types/navigation.ts +16 -0
  276. package/src/lib/framework/form-engine/utils.ts +34 -0
  277. package/src/lib/framework/layout-engine/page-layout.tsx +36 -36
  278. package/src/lib/framework/page/detail-page.tsx +10 -10
  279. package/src/lib/framework/page/list-page.tsx +289 -4
  280. package/src/lib/framework/page/use-extended-router.tsx +101 -34
  281. package/src/lib/graphql/api.ts +6 -2
  282. package/src/lib/graphql/graphql-env.d.ts +38 -26
  283. package/src/lib/hooks/use-display-locale.ts +40 -0
  284. package/src/lib/hooks/use-dynamic-translations.ts +46 -0
  285. package/src/lib/hooks/use-extended-detail-query.ts +1 -1
  286. package/src/lib/hooks/use-extended-list-query.ts +6 -1
  287. package/src/lib/hooks/use-local-format.ts +15 -1
  288. package/src/lib/hooks/use-saved-views.ts +230 -0
  289. package/src/lib/hooks/use-ui-language-loader.ts +30 -0
  290. package/src/lib/index.ts +15 -0
  291. package/src/lib/lib/load-i18n-messages.ts +17 -0
  292. package/src/lib/lib/trans.tsx +15 -11
  293. package/src/lib/providers/i18n-provider.tsx +7 -14
  294. package/src/lib/types/saved-views.ts +39 -0
  295. package/src/lib/utils/saved-views-utils.ts +40 -0
@@ -10,7 +10,7 @@ import {
10
10
  import { Popover, PopoverContent, PopoverTrigger } from '@/vdb/components/ui/popover.js';
11
11
  import { api } from '@/vdb/graphql/api.js';
12
12
  import { graphql } from '@/vdb/graphql/graphql.js';
13
- import { Trans } from '@/vdb/lib/trans.js';
13
+ import { Trans } from '@lingui/react/macro';
14
14
  import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
15
15
  import { useDebounce } from '@uidotdev/usehooks';
16
16
  import { ChevronRight, Loader2, Plus } from 'lucide-react';
@@ -41,9 +41,9 @@ interface FacetValueSelectorProps {
41
41
  /**
42
42
  * @description
43
43
  * The function to call when a facet value is selected.
44
- *
44
+ *
45
45
  * The `value` will have the following structure:
46
- *
46
+ *
47
47
  * ```ts
48
48
  * {
49
49
  * id: string;
@@ -71,7 +71,7 @@ interface FacetValueSelectorProps {
71
71
  /**
72
72
  * @description
73
73
  * The number of facet values to display per page.
74
- *
74
+ *
75
75
  * @default 4
76
76
  */
77
77
  pageSize?: number;
@@ -129,7 +129,7 @@ const getFacetValuesForFacetDocument = graphql(`
129
129
  /**
130
130
  * @description
131
131
  * A component for selecting facet values.
132
- *
132
+ *
133
133
  * @example
134
134
  * ```tsx
135
135
  * <FacetValueSelector onValueSelect={onValueSelectHandler} disabled={disabled} />
@@ -141,11 +141,11 @@ const getFacetValuesForFacetDocument = graphql(`
141
141
  * @since 3.4.0
142
142
  */
143
143
  export function FacetValueSelector({
144
- onValueSelect,
145
- disabled,
146
- placeholder = 'Search facet values...',
147
- pageSize = 4,
148
- }: FacetValueSelectorProps) {
144
+ onValueSelect,
145
+ disabled,
146
+ placeholder = 'Search facet values...',
147
+ pageSize = 4,
148
+ }: FacetValueSelectorProps) {
149
149
  const [open, setOpen] = useState(false);
150
150
  const [searchTerm, setSearchTerm] = useState('');
151
151
  const [expandedFacetId, setExpandedFacetId] = useState<string | null>(null);
@@ -1,5 +1,5 @@
1
1
  import { Checkbox } from '@/vdb/components/ui/checkbox.js';
2
- import { Trans } from '@/vdb/lib/trans.js';
2
+ import { Trans } from '@lingui/react/macro';
3
3
 
4
4
  interface HistoryNoteCheckboxProps {
5
5
  value: boolean;
@@ -8,7 +8,7 @@ import {
8
8
  DialogTitle,
9
9
  } from '@/vdb/components/ui/dialog.js';
10
10
  import { Textarea } from '@/vdb/components/ui/textarea.js';
11
- import { Trans } from '@/vdb/lib/trans.js';
11
+ import { Trans } from '@lingui/react/macro';
12
12
  import { useState } from 'react';
13
13
  import { HistoryNoteCheckbox } from './history-note-checkbox.js';
14
14
 
@@ -8,7 +8,7 @@ import {
8
8
  } from '@/vdb/components/ui/dropdown-menu.js';
9
9
  import { Separator } from '@/vdb/components/ui/separator.js';
10
10
  import { HistoryEntry, HistoryEntryProps } from '@/vdb/framework/history-entry/history-entry.js';
11
- import { Trans } from '@/vdb/lib/trans.js';
11
+ import { Trans } from '@lingui/react/macro';
12
12
  import { MoreVerticalIcon, PencilIcon, TrashIcon } from 'lucide-react';
13
13
 
14
14
  interface HistoryNoteEntryProps extends Readonly<HistoryEntryProps> {
@@ -1,7 +1,7 @@
1
1
  import { api } from '@/vdb/graphql/api.js';
2
2
  import { graphql } from '@/vdb/graphql/graphql.js';
3
3
  import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
4
- import { useLingui } from '@/vdb/lib/trans.js';
4
+ import { useLingui } from '@lingui/react/macro';
5
5
  import { useQuery } from '@tanstack/react-query';
6
6
  import { MultiSelect } from './multi-select.js';
7
7
 
@@ -28,7 +28,7 @@ export function LanguageSelector<T extends boolean>(props: LanguageSelectorProps
28
28
  });
29
29
  const { formatLanguageName } = useLocalFormat();
30
30
  const { value, onChange, multiple, availableLanguageCodes } = props;
31
- const { i18n } = useLingui();
31
+ const { t } = useLingui();
32
32
 
33
33
  const items = (availableLanguageCodes ?? data?.globalSettings.availableLanguages ?? []).map(language => ({
34
34
  value: language,
@@ -41,8 +41,8 @@ export function LanguageSelector<T extends boolean>(props: LanguageSelectorProps
41
41
  onChange={onChange}
42
42
  multiple={multiple}
43
43
  items={items}
44
- placeholder={i18n.t('Select a language')}
45
- searchPlaceholder={i18n.t('Search languages...')}
44
+ placeholder={t`Select a language`}
45
+ searchPlaceholder={t`Search languages...`}
46
46
  />
47
47
  );
48
48
  }
@@ -1,4 +1,4 @@
1
- import { Trans } from '@/vdb/lib/trans.js';
1
+ import { Trans } from '@lingui/react/macro';
2
2
  import { useBlocker } from '@tanstack/react-router';
3
3
  import { UseFormReturn } from 'react-hook-form';
4
4
 
@@ -1,18 +1,20 @@
1
- import { DataTable, FacetedFilter } from '\@/vdb/components/data-table/data-table.js';
2
- import { getObjectPathToPaginatedList } from '\@/vdb/framework/document-introspection/get-document-structure.js';
3
- import { useListQueryFields } from '\@/vdb/framework/document-introspection/hooks.js';
4
- import { api } from '\@/vdb/graphql/api.js';
1
+ import { DataTable, FacetedFilter } from '@/vdb/components/data-table/data-table.js';
2
+ import { getObjectPathToPaginatedList } from '@/vdb/framework/document-introspection/get-document-structure.js';
3
+ import { useListQueryFields } from '@/vdb/framework/document-introspection/hooks.js';
4
+ import { api } from '@/vdb/graphql/api.js';
5
5
  import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
6
6
  import { useDebounce } from '@uidotdev/usehooks';
7
7
 
8
- import { BulkAction } from '\@/vdb/framework/extension-api/types/index.js';
9
- import { ResultOf } from '\@/vdb/graphql/graphql.js';
10
- import { useExtendedListQuery } from '\@/vdb/hooks/use-extended-list-query.js';
8
+ import { addCustomFields } from '@/vdb/framework/document-introspection/add-custom-fields.js';
9
+ import { includeOnlySelectedListFields } from '@/vdb/framework/document-introspection/include-only-selected-list-fields.js';
10
+ import { BulkAction } from '@/vdb/framework/extension-api/types/index.js';
11
+ import { ResultOf } from '@/vdb/graphql/graphql.js';
12
+ import { useExtendedListQuery } from '@/vdb/hooks/use-extended-list-query.js';
11
13
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
12
14
  import { ColumnFiltersState, ColumnSort, SortingState, Table } from '@tanstack/react-table';
13
15
  import { ColumnDef, Row, TableOptions, VisibilityState } from '@tanstack/table-core';
14
16
  import React from 'react';
15
- import { getColumnVisibility } from '../data-table/data-table-utils.js';
17
+ import { getColumnVisibility, getStandardizedDefaultColumnOrder } from '../data-table/data-table-utils.js';
16
18
  import { useGeneratedColumns } from '../data-table/use-generated-columns.js';
17
19
 
18
20
  // Type that identifies a paginated list structure (has items array and totalItems)
@@ -87,8 +89,23 @@ export type AllItemFieldKeys<T extends TypedDocumentNode<any, any>> =
87
89
  | keyof PaginatedListItemFields<T>
88
90
  | CustomFieldKeysOfItem<PaginatedListItemFields<T>>;
89
91
 
92
+ export type ColumnDefWithMetaDependencies<T extends TypedDocumentNode<any, any>> = Partial<
93
+ ColumnDef<T, any>
94
+ > & {
95
+ meta?: {
96
+ /**
97
+ * @description
98
+ * Columns that rely on _other_ columns in order to correctly render,
99
+ * can declare those other columns as dependencies in order to ensure that
100
+ * those columns are always fetched, even when those columns are not explicitly
101
+ * included in the visible table columns.
102
+ */
103
+ dependencies?: Array<AllItemFieldKeys<T>>;
104
+ };
105
+ };
106
+
90
107
  export type CustomizeColumnConfig<T extends TypedDocumentNode<any, any>> = {
91
- [Key in AllItemFieldKeys<T>]?: Partial<ColumnDef<PaginatedListItemFields<T>, any>>;
108
+ [Key in AllItemFieldKeys<T>]?: ColumnDefWithMetaDependencies<PaginatedListItemFields<T>>;
92
109
  };
93
110
 
94
111
  export type FacetedFilterConfig<T extends TypedDocumentNode<any, any>> = {
@@ -132,7 +149,7 @@ export type ListQueryOptionsShape = {
132
149
  };
133
150
 
134
151
  export type AdditionalColumns<T extends TypedDocumentNode<any, any>> = {
135
- [key: string]: ColumnDef<PaginatedListItemFields<T>>;
152
+ [key: string]: ColumnDefWithMetaDependencies<PaginatedListItemFields<T>>;
136
153
  };
137
154
 
138
155
  export interface PaginatedListContext {
@@ -365,7 +382,7 @@ export function PaginatedListDataTable<
365
382
  const [searchTerm, setSearchTerm] = React.useState<string>('');
366
383
  const debouncedSearchTerm = useDebounce(searchTerm, 500);
367
384
  const queryClient = useQueryClient();
368
- const extendedListQuery = useExtendedListQuery(listQuery);
385
+ const extendedListQuery = useExtendedListQuery(addCustomFields(listQuery));
369
386
 
370
387
  const sort = sorting?.reduce((acc: any, sort: ColumnSort) => {
371
388
  const direction = sort.desc ? 'DESC' : 'ASC';
@@ -388,9 +405,43 @@ export function PaginatedListDataTable<
388
405
  }
389
406
  : undefined;
390
407
 
408
+ function refetchPaginatedList() {
409
+ queryClient.invalidateQueries({ queryKey });
410
+ }
411
+
412
+ registerRefresher?.(refetchPaginatedList);
413
+
414
+ // First we get info on _all_ the fields, including all custom fields, for the
415
+ // purpose of configuring the table columns.
416
+ const fields = useListQueryFields(extendedListQuery);
417
+ const paginatedListObjectPath = getObjectPathToPaginatedList(extendedListQuery);
418
+
419
+ const { columns, customFieldColumnNames } = useGeneratedColumns({
420
+ fields,
421
+ customizeColumns,
422
+ rowActions,
423
+ bulkActions,
424
+ deleteMutation,
425
+ additionalColumns,
426
+ defaultColumnOrder: getStandardizedDefaultColumnOrder(defaultColumnOrder),
427
+ });
428
+ const columnVisibility = getColumnVisibility(columns, defaultVisibility, customFieldColumnNames);
429
+ // Get the actual visible columns and only fetch those
430
+ const visibleColumns = columns
431
+ // Filter out invisible columns, but _always_ select "id"
432
+ // because it is usually needed.
433
+ .filter(c => columnVisibility[c.id as string] !== false || c.id === 'id')
434
+ .map(c => ({
435
+ name: c.id as string,
436
+ isCustomField: (c.meta as any)?.isCustomField ?? false,
437
+ dependencies: (c.meta as any)?.dependencies ?? [],
438
+ }));
439
+ const minimalListQuery = includeOnlySelectedListFields(extendedListQuery, visibleColumns);
440
+
391
441
  const defaultQueryKey = [
392
442
  PaginatedListDataTableKey,
393
- extendedListQuery,
443
+ minimalListQuery,
444
+ visibleColumns,
394
445
  page,
395
446
  itemsPerPage,
396
447
  sorting,
@@ -399,12 +450,6 @@ export function PaginatedListDataTable<
399
450
  ];
400
451
  const queryKey = transformQueryKey ? transformQueryKey(defaultQueryKey) : defaultQueryKey;
401
452
 
402
- function refetchPaginatedList() {
403
- queryClient.invalidateQueries({ queryKey });
404
- }
405
-
406
- registerRefresher?.(refetchPaginatedList);
407
-
408
453
  const { data, isFetching } = useQuery({
409
454
  queryFn: () => {
410
455
  const searchFilter = onSearchTermChange ? onSearchTermChange(debouncedSearchTerm) : {};
@@ -419,31 +464,16 @@ export function PaginatedListDataTable<
419
464
  } as V;
420
465
 
421
466
  const transformedVariables = transformVariables ? transformVariables(variables) : variables;
422
- return api.query(extendedListQuery, transformedVariables);
467
+ return api.query(minimalListQuery, transformedVariables);
423
468
  },
424
469
  queryKey,
425
470
  placeholderData: keepPreviousData,
426
471
  });
427
-
428
- const fields = useListQueryFields(extendedListQuery);
429
- const paginatedListObjectPath = getObjectPathToPaginatedList(extendedListQuery);
430
-
431
472
  let listData = data as any;
432
473
  for (const path of paginatedListObjectPath) {
433
474
  listData = listData?.[path];
434
475
  }
435
476
 
436
- const { columns, customFieldColumnNames } = useGeneratedColumns({
437
- fields,
438
- customizeColumns,
439
- rowActions,
440
- bulkActions,
441
- deleteMutation,
442
- additionalColumns,
443
- defaultColumnOrder,
444
- });
445
-
446
- const columnVisibility = getColumnVisibility(fields, defaultVisibility, customFieldColumnNames);
447
477
  const transformedData =
448
478
  typeof transformData === 'function' ? transformData(listData?.items ?? []) : (listData?.items ?? []);
449
479
  return (
@@ -6,7 +6,7 @@ import { DataTableBulkActionItem } from '@/vdb/components/data-table/data-table-
6
6
  import { usePaginatedList } from '@/vdb/components/shared/paginated-list-data-table.js';
7
7
  import { ResultOf } from '@/vdb/graphql/graphql.js';
8
8
  import { useChannel } from '@/vdb/hooks/use-channel.js';
9
- import { Trans, useLingui } from '@/vdb/lib/trans.js';
9
+ import { Trans, useLingui } from '@lingui/react/macro';
10
10
 
11
11
  interface RemoveFromChannelBulkActionProps {
12
12
  selection: any[];
@@ -43,22 +43,23 @@ export function RemoveFromChannelBulkAction({
43
43
  }: Readonly<RemoveFromChannelBulkActionProps>) {
44
44
  const { refetchPaginatedList } = usePaginatedList();
45
45
  const { activeChannel } = useChannel();
46
- const { i18n } = useLingui();
46
+ const { t } = useLingui();
47
+ const selectionLength = selection.length;
47
48
  const { mutate } = useMutation({
48
49
  mutationFn,
49
50
  onSuccess: result => {
50
51
  const message =
51
- successMessage ||
52
- i18n.t(`Successfully removed ${selection.length} ${entityType} from channel`);
52
+ successMessage || t`Successfully removed ${selectionLength} ${entityType} from channel`;
53
53
  toast.success(message);
54
54
  refetchPaginatedList();
55
55
  table.resetRowSelection();
56
56
  onSuccess?.(result);
57
57
  },
58
58
  onError: error => {
59
+ const onErrorMessage = error.message;
59
60
  const message =
60
61
  errorMessage ||
61
- `Failed to remove ${selection.length} ${entityType} from channel: ${error.message}`;
62
+ `Failed to remove ${selectionLength} ${entityType} from channel: ${onErrorMessage}`;
62
63
  toast.error(message);
63
64
  },
64
65
  });
@@ -1,4 +1,4 @@
1
- import { Trans } from '@/vdb/lib/trans.js';
1
+ import { Trans } from '@lingui/react/macro';
2
2
  import { SetImageOptions } from '@tiptap/extension-image';
3
3
  import { Editor } from '@tiptap/react';
4
4
  import { ImageIcon, PaperclipIcon } from 'lucide-react';
@@ -1,4 +1,4 @@
1
- import { Trans } from '@/vdb/lib/trans.js';
1
+ import { Trans } from '@lingui/react/macro';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { Button } from '../../ui/button.js';
@@ -1,4 +1,4 @@
1
- import { Trans } from '@/vdb/lib/trans.js';
1
+ import { Trans } from '@lingui/react/macro';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import {
4
4
  BoldIcon,
@@ -1,4 +1,4 @@
1
- import { Trans } from '@/vdb/lib/trans.js';
1
+ import { Trans } from '@lingui/react/macro';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { MoreHorizontalIcon, MoreVerticalIcon } from 'lucide-react';
4
4
  import { useEffect, useState } from 'react';
@@ -1,5 +1,5 @@
1
1
  import { CUSTOMER_ROLE_CODE, SUPER_ADMIN_ROLE_CODE } from '@/vdb/constants.js';
2
- import { Trans } from '@/vdb/lib/trans.js';
2
+ import { Trans } from '@lingui/react/macro';
3
3
 
4
4
  export function RoleCodeLabel({ code }: Readonly<{ code: string }> | Readonly<{ code: undefined }>) {
5
5
  return code === SUPER_ADMIN_ROLE_CODE ? (
@@ -1,6 +1,6 @@
1
1
  import { api } from '@/vdb/graphql/api.js';
2
2
  import { graphql } from '@/vdb/graphql/graphql.js';
3
- import { useLingui } from '@/vdb/lib/trans.js';
3
+ import { useLingui } from '@lingui/react/macro';
4
4
  import { useQuery } from '@tanstack/react-query';
5
5
  import { MultiSelect } from './multi-select.js';
6
6
 
@@ -24,7 +24,7 @@ export interface RoleSelectorProps<T extends boolean> {
24
24
 
25
25
  export function RoleSelector<T extends boolean>(props: RoleSelectorProps<T>) {
26
26
  const { value, onChange, multiple } = props;
27
- const { i18n } = useLingui();
27
+ const { t } = useLingui();
28
28
 
29
29
  const { data } = useQuery({
30
30
  queryKey: ['roles'],
@@ -49,8 +49,8 @@ export function RoleSelector<T extends boolean>(props: RoleSelectorProps<T>) {
49
49
  onChange={onChange}
50
50
  multiple={multiple}
51
51
  items={items}
52
- placeholder={i18n.t('Select a role')}
53
- searchPlaceholder={i18n.t('Search roles...')}
52
+ placeholder={t`Select a role`}
53
+ searchPlaceholder={t`Search roles...`}
54
54
  />
55
55
  );
56
56
  }
@@ -9,7 +9,7 @@ import {
9
9
  import { Popover, PopoverContent, PopoverTrigger } from '@/vdb/components/ui/popover.js';
10
10
  import { api } from '@/vdb/graphql/api.js';
11
11
  import { graphql } from '@/vdb/graphql/graphql.js';
12
- import { Trans } from '@/vdb/lib/trans.js';
12
+ import { Trans } from '@lingui/react/macro';
13
13
  import { useQuery } from '@tanstack/react-query';
14
14
  import { Plus } from 'lucide-react';
15
15
  import { useState } from 'react';
@@ -1,4 +1,4 @@
1
- import { useLingui } from '../../lib/trans.js';
1
+ import { useLingui } from '@lingui/react/macro';
2
2
 
3
3
  export type StockLevel = {
4
4
  stockOnHand: number;
@@ -6,7 +6,7 @@ export type StockLevel = {
6
6
  };
7
7
 
8
8
  export function StockLevelLabel({ stockLevels }: Readonly<{ stockLevels: StockLevel[] }>) {
9
- const { i18n } = useLingui();
9
+ const { t } = useLingui();
10
10
 
11
11
  if (!Array.isArray(stockLevels)) {
12
12
  return null;
@@ -15,9 +15,7 @@ export function StockLevelLabel({ stockLevels }: Readonly<{ stockLevels: StockLe
15
15
  const totalAllocated = stockLevels.reduce((acc, curr) => acc + curr.stockAllocated, 0);
16
16
 
17
17
  return (
18
- <span
19
- title={`${i18n.t('Stock on hand')}: ${totalOnHand}, ${i18n.t('Stock allocated')}: ${totalAllocated}`}
20
- >
18
+ <span title={`${t`Stock on hand`}: ${totalOnHand}, ${t`Stock allocated`}: ${totalAllocated}`}>
21
19
  {totalOnHand} <span className="text-muted-foreground">/ {totalAllocated}</span>
22
20
  </span>
23
21
  );
@@ -2,6 +2,7 @@ import { Money } from '@/vdb/components/data-display/money.js';
2
2
  import { DataTableCellComponent } from '@/vdb/components/data-table/types.js';
3
3
  import { Badge } from '@/vdb/components/ui/badge.js';
4
4
  import { Button } from '@/vdb/components/ui/button.js';
5
+ import { useDynamicTranslations } from '@/vdb/hooks/use-dynamic-translations.js';
5
6
  import { Link } from '@tanstack/react-router';
6
7
 
7
8
  type CustomerCellData = {
@@ -27,8 +28,9 @@ export const CustomerCell: DataTableCellComponent<CustomerCellData> = ({ row })
27
28
  };
28
29
 
29
30
  export const OrderStateCell: DataTableCellComponent<{ state: string }> = ({ row }) => {
31
+ const { getTranslatedOrderState } = useDynamicTranslations();
30
32
  const value = row.original.state;
31
- return <Badge variant="outline">{value}</Badge>;
33
+ return <Badge variant="outline">{getTranslatedOrderState(value)}</Badge>;
32
34
  };
33
35
 
34
36
  export const OrderMoneyCell: DataTableCellComponent<{ currencyCode: string }> = ({ cell, row }) => {
@@ -8,7 +8,7 @@ import {
8
8
  } from '@/vdb/components/ui/select.js';
9
9
  import { api } from '@/vdb/graphql/api.js';
10
10
  import { graphql } from '@/vdb/graphql/graphql.js';
11
- import { Trans } from '@/vdb/lib/trans.js';
11
+ import { Trans } from '@lingui/react/macro';
12
12
  import { useQuery } from '@tanstack/react-query';
13
13
  import { Skeleton } from '../ui/skeleton.js';
14
14
 
@@ -2,7 +2,7 @@ import { OverriddenFormComponent } from '@/vdb/framework/form-engine/overridden-
2
2
  import { LocationWrapper } from '@/vdb/framework/layout-engine/location-wrapper.js';
3
3
  import { useLocalFormat } from '@/vdb/hooks/use-local-format.js';
4
4
  import { useUserSettings } from '@/vdb/hooks/use-user-settings.js';
5
- import { Trans } from '@/vdb/lib/trans.js';
5
+ import { Trans } from '@lingui/react/macro';
6
6
  import { Controller, ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
7
7
  import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from '../ui/form.js';
8
8
  import { FormFieldWrapper } from './form-field-wrapper.js';
@@ -35,17 +35,17 @@ export type TranslatableFormFieldProps<TFieldValues extends TranslatableEntity |
35
35
  name: TFieldValues extends TranslatableEntity
36
36
  ? keyof Omit<NonNullable<TFieldValues['translations']>[number], 'languageCode'>
37
37
  : TFieldValues extends TranslatableEntity[]
38
- ? keyof Omit<NonNullable<TFieldValues[number]['translations']>[number], 'languageCode'>
39
- : never;
38
+ ? keyof Omit<NonNullable<TFieldValues[number]['translations']>[number], 'languageCode'>
39
+ : never;
40
40
  };
41
41
 
42
42
  export const TranslatableFormField = <
43
43
  TFieldValues extends TranslatableEntity | TranslatableEntity[] = TranslatableEntity,
44
44
  >({
45
- name,
46
- label,
47
- ...props
48
- }: TranslatableFormFieldProps<TFieldValues>) => {
45
+ name,
46
+ label,
47
+ ...props
48
+ }: TranslatableFormFieldProps<TFieldValues>) => {
49
49
  const { formatLanguageName } = useLocalFormat();
50
50
  const { contentLanguage } = useUserSettings().settings;
51
51
  const formValues = props.control?._formValues;
@@ -76,7 +76,7 @@ export type TranslatableFormFieldWrapperProps<
76
76
  /**
77
77
  * @description
78
78
  * This is the equivalent of the {@link FormFieldWrapper} component, but for translatable fields.
79
- *
79
+ *
80
80
  * @example
81
81
  * ```tsx
82
82
  * <PageBlock column="main" blockId="main-form">
@@ -112,13 +112,13 @@ export type TranslatableFormFieldWrapperProps<
112
112
  export const TranslatableFormFieldWrapper = <
113
113
  TFieldValues extends TranslatableEntity | TranslatableEntity[] = TranslatableEntity,
114
114
  >({
115
- name,
116
- label,
117
- description,
118
- render,
119
- renderFormControl,
120
- ...props
121
- }: TranslatableFormFieldWrapperProps<TFieldValues>) => {
115
+ name,
116
+ label,
117
+ description,
118
+ render,
119
+ renderFormControl,
120
+ ...props
121
+ }: TranslatableFormFieldWrapperProps<TFieldValues>) => {
122
122
  return (
123
123
  <LocationWrapper identifier={name as string}>
124
124
  <TranslatableFormField
@@ -8,7 +8,7 @@ import {
8
8
  } from '@/vdb/components/ui/select.js';
9
9
  import { api } from '@/vdb/graphql/api.js';
10
10
  import { graphql } from '@/vdb/graphql/graphql.js';
11
- import { Trans } from '@/vdb/lib/trans.js';
11
+ import { Trans } from '@lingui/react/macro';
12
12
  import { useQuery } from '@tanstack/react-query';
13
13
  import { Skeleton } from '../ui/skeleton.js';
14
14
 
@@ -23,7 +23,7 @@ const buttonVariants = cva(
23
23
  lg: 'h-10 rounded-md px-8',
24
24
  icon: 'h-9 w-9',
25
25
  xs: 'h-5 rounded-md px-2 text-xs',
26
- 'icon-sm': 'h-7 w-7 text-xs',
26
+ 'icon-sm': 'h-8 w-8 text-xs',
27
27
  'icon-xs': 'h-5 w-5 text-xs',
28
28
  },
29
29
  },
@@ -1,6 +1,7 @@
1
1
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/vdb/components/ui/card.js';
2
2
  import { DashboardBaseWidgetProps } from '@/vdb/framework/extension-api/types/index.js';
3
- import { Trans } from '@/vdb/lib/trans.js';
3
+ import { Trans } from '@lingui/react/macro';
4
+ import { useLingui } from '@lingui/react/macro';
4
5
  import { cn } from '@/vdb/lib/utils.js';
5
6
  import { createContext, useContext, useEffect, useRef, useState } from 'react';
6
7
 
@@ -12,21 +13,22 @@ type WidgetDimensions = {
12
13
  export const WidgetContentContext = createContext<WidgetDimensions>({ width: 0, height: 0 });
13
14
 
14
15
  export const useWidgetDimensions = () => {
16
+ const { t } = useLingui();
15
17
  const context = useContext(WidgetContentContext);
16
18
  if (!context) {
17
- throw new Error('useWidgetDimensions must be used within a DashboardBaseWidget');
19
+ throw new Error(t`useWidgetDimensions must be used within a DashboardBaseWidget`);
18
20
  }
19
21
  return context;
20
22
  };
21
23
 
22
24
  export function DashboardBaseWidget({
23
- id,
24
- config,
25
- children,
26
- title,
27
- description,
28
- actions,
29
- }: DashboardBaseWidgetProps) {
25
+ id,
26
+ config,
27
+ children,
28
+ title,
29
+ description,
30
+ actions,
31
+ }: DashboardBaseWidgetProps) {
30
32
  const headerRef = useRef<HTMLDivElement>(null);
31
33
  const wrapperRef = useRef<HTMLDivElement>(null);
32
34
  const contentRef = useRef<HTMLDivElement>(null);