@propeller-commerce/propeller-v2-react-ui 0.13.0 → 0.14.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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,37 @@ once it reaches 1.0. Until then (the `0.x` line) the public API may change
8
8
  between minor versions; breaking changes are called out below and in
9
9
  [MIGRATION.md](./MIGRATION.md).
10
10
 
11
+ ## [0.14.0] - 2026-08-05
12
+
13
+ ### Added
14
+
15
+ - **`hideHeader` and `flat` on `<OrderList>` and
16
+ `<PurchaseAuthorizationRequests>`** — for embedding a list inside a host's
17
+ own card. `hideHeader` drops the table's column-header row, redundant once
18
+ a card names what it contains and shows three columns. `flat` drops the
19
+ component's own background, border, shadow and rounded corners, which
20
+ otherwise nest a box inside the host's box. On `<OrderList>` the empty
21
+ state honours `flat` too, so a card with no results does not draw a stray
22
+ panel.
23
+
24
+ - **`limit`, `columns`, `columnConfig`, `showActions` and `hideTitle` on
25
+ `<PurchaseAuthorizationRequests>`** — the component rendered a fixed
26
+ five-column table (date, quantity, total, requested by, actions) and its
27
+ own heading, so it could not be reduced to a summary. `columns` selects
28
+ which of those render and in what order, `columnConfig` overrides their
29
+ header labels, `showActions` hides the accept/delete buttons, `hideTitle`
30
+ suppresses the component's own `<h2>` when the host already has one, and
31
+ `limit` caps the list to the most recently modified — mirroring the prop
32
+ `<FavoriteLists>` already carries.
33
+
34
+ ### Notes
35
+
36
+ Every prop above is additive and defaults to current behaviour: an existing
37
+ consumer that passes none of them renders exactly as it did in 0.13.0. In
38
+ particular `<PurchaseAuthorizationRequests>` still lists requests in the
39
+ order the API returned them; the most-recent-first sort applies only when
40
+ `limit` is set, so the rows that survive the slice are the newest.
41
+
11
42
  ## [0.13.0] - 2026-08-05
12
43
 
13
44
  ### Added
package/dist/index.cjs CHANGED
@@ -13906,9 +13906,9 @@ function OrderList(rawProps) {
13906
13906
  )
13907
13907
  ] })
13908
13908
  ] }) : null,
13909
- !loading || orders.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: orders.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-order-list__results bg-card rounded-container shadow overflow-hidden", children: [
13909
+ !loading || orders.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: orders.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-order-list__results${props.flat ? "" : " bg-card rounded-container shadow"} overflow-hidden`, children: [
13910
13910
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "propeller-order-list__table min-w-full divide-y divide-border", children: [
13911
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "propeller-order-list__thead bg-surface-hover", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns?.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
13911
+ !props.hideHeader ? /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "propeller-order-list__thead bg-surface-hover", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns?.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
13912
13912
  "th",
13913
13913
  {
13914
13914
  "data-column": col,
@@ -13916,7 +13916,7 @@ function OrderList(rawProps) {
13916
13916
  children: getColumnLabel(col)
13917
13917
  },
13918
13918
  col
13919
- )) }) }),
13919
+ )) }) }) : null,
13920
13920
  /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "propeller-order-list__tbody bg-card divide-y divide-border", children: orders?.map((order) => /* @__PURE__ */ jsxRuntime.jsx(
13921
13921
  "tr",
13922
13922
  {
@@ -14023,7 +14023,7 @@ function OrderList(rawProps) {
14023
14023
  ) })
14024
14024
  ] })
14025
14025
  ] }) : null
14026
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-order-list__empty bg-card rounded-container shadow p-8 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: propellerV2CoreUi.getLabel(props.labels, "noOrders", "No orders found.") }) }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-order-list__loading p-8 text-center text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "loading", "Loading orders...") })
14026
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: `propeller-order-list__empty${props.flat ? "" : " bg-card rounded-container shadow"} p-8 text-center`, children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: propellerV2CoreUi.getLabel(props.labels, "noOrders", "No orders found.") }) }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-order-list__loading p-8 text-center text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "loading", "Loading orders...") })
14027
14027
  ] });
14028
14028
  }
14029
14029
  var OrderList_default = OrderList;
@@ -17190,6 +17190,10 @@ function PurchaseAuthorizationConfigurator(rawProps) {
17190
17190
  var PurchaseAuthorizationConfigurator_default = PurchaseAuthorizationConfigurator;
17191
17191
  function PurchaseAuthorizationRequests(rawProps) {
17192
17192
  const props = useInfraProps(rawProps);
17193
+ const showActions = props.showActions !== false;
17194
+ const columns = (props.columns || ["date", "quantity", "total", "requestedBy", "action"]).filter(
17195
+ (col) => showActions || col !== "action"
17196
+ );
17193
17197
  const {
17194
17198
  carts,
17195
17199
  loading,
@@ -17223,6 +17227,17 @@ function PurchaseAuthorizationRequests(rawProps) {
17223
17227
  await handleDeleteRequest();
17224
17228
  setShowDeleteConfirm(false);
17225
17229
  };
17230
+ const displayedCarts = React6.useMemo(() => {
17231
+ if (props.limit && props.limit > 0) {
17232
+ const sorted = [...carts].sort((a, b) => {
17233
+ const dateA = new Date(a.lastModifiedAt || "").getTime();
17234
+ const dateB = new Date(b.lastModifiedAt || "").getTime();
17235
+ return dateB - dateA;
17236
+ });
17237
+ return sorted.slice(0, props.limit);
17238
+ }
17239
+ return carts;
17240
+ }, [carts, props.limit]);
17226
17241
  function formatDate(dateStr) {
17227
17242
  if (props.formatDate) return props.formatDate(dateStr);
17228
17243
  if (!dateStr) return "-";
@@ -17236,6 +17251,18 @@ function PurchaseAuthorizationRequests(rawProps) {
17236
17251
  if (props.formatPrice) return props.formatPrice(price);
17237
17252
  return propellerV2CoreUi.formatPrice(price, { symbol: props.currency ?? "\u20AC" });
17238
17253
  }
17254
+ const columnLabelKeys = {
17255
+ date: ["colDate", "Date"],
17256
+ quantity: ["colQuantity", "Quantity"],
17257
+ total: ["colTotal", "Total"],
17258
+ requestedBy: ["colRequestedBy", "Requested by"],
17259
+ action: ["colActions", "Actions"]
17260
+ };
17261
+ function getColumnLabel(col) {
17262
+ if (props.columnConfig?.[col]) return props.columnConfig[col];
17263
+ const [key, fallback] = columnLabelKeys[col] || [col, col];
17264
+ return propellerV2CoreUi.getLabel(props.labels, key, fallback);
17265
+ }
17239
17266
  function getProductName5(item) {
17240
17267
  const lang = props.language || "NL";
17241
17268
  const fromNames = propellerV2CoreUi.getLanguageString(item?.product?.names, lang, "");
@@ -17245,27 +17272,21 @@ function PurchaseAuthorizationRequests(rawProps) {
17245
17272
  return item?.product?.sku || "";
17246
17273
  }
17247
17274
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `propeller-purchase-authorization-requests ${props.className || ""}`, children: isAuthManager ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-purchase-authorization-requests__content space-y-4", children: [
17248
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "propeller-purchase-authorization-requests__title text-xl font-semibold", children: propellerV2CoreUi.getLabel(props.labels, "title", "Authorization Requests") }),
17275
+ !props.hideTitle ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "propeller-purchase-authorization-requests__title text-xl font-semibold", children: propellerV2CoreUi.getLabel(props.labels, "title", "Authorization Requests") }) : null,
17249
17276
  loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin" }) }) : null,
17250
17277
  !loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17251
17278
  carts.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-12 text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "empty", "No pending authorization requests") }) : null,
17252
- carts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto rounded-lg border border-border bg-card shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-sm", children: [
17253
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
17254
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "colDate", "Date") }),
17255
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "colQuantity", "Quantity") }),
17256
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "colTotal", "Total") }),
17257
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "colRequestedBy", "Requested by") }),
17258
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: propellerV2CoreUi.getLabel(props.labels, "colActions", "Actions") })
17259
- ] }) }),
17260
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border", children: carts.map((cart, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "hover:bg-muted/30 transition-colors", children: [
17261
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 text-muted-foreground", children: formatDate(cart.lastModifiedAt ?? "") }),
17262
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: getTotalQuantity(cart) }),
17263
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 font-medium", children: formatPrice17(cart.total?.totalNet ?? 0) }),
17264
- /* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-3", children: [
17279
+ carts.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `propeller-purchase-authorization-requests__results overflow-x-auto${props.flat ? "" : " rounded-lg border border-border bg-card shadow-sm"}`, children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-sm", children: [
17280
+ !props.hideHeader ? /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx("th", { className: "text-left px-4 py-3 font-medium text-muted-foreground", children: getColumnLabel(col) }, col)) }) }) : null,
17281
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border", children: displayedCarts.map((cart, index) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "hover:bg-muted/30 transition-colors", children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsxs("td", { className: `px-4 py-3${col === "date" ? " text-muted-foreground" : ""}${col === "total" ? " font-medium" : ""}`, children: [
17282
+ col === "date" ? formatDate(cart.lastModifiedAt ?? "") : null,
17283
+ col === "quantity" ? getTotalQuantity(cart) : null,
17284
+ col === "total" ? formatPrice17(cart.total?.totalNet ?? 0) : null,
17285
+ col === "requestedBy" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17265
17286
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: getContactName(cart.contact) }),
17266
17287
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground mt-0.5", children: cart.contact?.email })
17267
- ] }),
17268
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
17288
+ ] }) : null,
17289
+ col === "action" ? /* @__PURE__ */ jsxRuntime.jsx(
17269
17290
  "button",
17270
17291
  {
17271
17292
  type: "button",
@@ -17273,8 +17294,8 @@ function PurchaseAuthorizationRequests(rawProps) {
17273
17294
  onClick: () => handleViewCart(cart),
17274
17295
  children: propellerV2CoreUi.getLabel(props.labels, "view", "View")
17275
17296
  }
17276
- ) })
17277
- ] }, index)) })
17297
+ ) : null
17298
+ ] }, col)) }, index)) })
17278
17299
  ] }) }) : null
17279
17300
  ] }) : null,
17280
17301
  selectedCart ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-purchase-authorization-requests__modal fixed inset-0 z-50 flex items-center justify-center px-4", children: [