@propeller-commerce/propeller-v2-react-ui 0.4.24 → 0.4.26
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 +58 -0
- package/dist/index.cjs +152 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +152 -82
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +4 -2
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +13 -0
- package/dist/pure.d.ts +13 -0
- package/dist/pure.js +4 -2
- package/dist/pure.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,64 @@ 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.4.26] - 2026-07-21
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`SearchBar`: real anchor links for navigation.** New optional
|
|
16
|
+
`getResultHref(result)` and `getViewAllHref(term)` props. When provided, the
|
|
17
|
+
autosuggest result rows and the "View all results" CTA render as real
|
|
18
|
+
`<a href>` elements — middle-clickable, open-in-new-tab, hover-preview,
|
|
19
|
+
crawlable — while the existing `onResultClick`/`onViewAllClick` callbacks
|
|
20
|
+
still fire for SPA navigation (modified clicks fall through to the browser).
|
|
21
|
+
Omit the props to keep the previous behaviour.
|
|
22
|
+
- **`OrderList`: URL-persistable filters.** New optional `initialSearchForm`
|
|
23
|
+
(seed the filter form on mount, e.g. rehydrated from the URL) and
|
|
24
|
+
`onSearchApply(form)` (fires when the user applies/clears filters) props, so
|
|
25
|
+
the consuming page can keep the filter state in the URL — bookmarkable,
|
|
26
|
+
shareable, back-button-friendly. `useOrders` gained the matching
|
|
27
|
+
`initialSearchForm` option.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **`AccountIconAndMenu`: account-menu items are now `<a href>` instead of
|
|
32
|
+
`<button>`** (both the sidebar and dropdown variants). They use each link's
|
|
33
|
+
existing `href`, so they are middle-clickable / new-tab-able / crawlable;
|
|
34
|
+
`onMenuItemClick` still handles plain-click SPA navigation.
|
|
35
|
+
- **`SearchBar`: the "View all results" fallback is now a `<button>`** (was a
|
|
36
|
+
non-focusable `<div>`), so it is keyboard-accessible even without the new
|
|
37
|
+
`getViewAllHref` prop.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **`OrderList`: clickable rows now show `cursor: pointer`.** When
|
|
42
|
+
`rowsClickable` is set, the row cursor matches its behaviour (was `auto`,
|
|
43
|
+
inconsistent with the favourites cards).
|
|
44
|
+
|
|
45
|
+
## [0.4.25] - 2026-07-20
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **Raw enums no longer leak to the UI.** `OrderList` + `OrderSummary` gained a
|
|
50
|
+
`statusLabels` prop (raw status → localized, e.g. `NEW`→"Nieuw"), and
|
|
51
|
+
`OrderSummary` a `paymethodLabels` prop (raw method → localized, mapping both
|
|
52
|
+
the order-path `REKENING` and quote-path `ACCOUNT` variants to one label).
|
|
53
|
+
Unknown keys fall back to the raw value.
|
|
54
|
+
- `AddressCard`: new `showTypeBadge` prop (@default true) — set `false` to hide
|
|
55
|
+
the invoice/delivery chip where a heading already names the type.
|
|
56
|
+
- **Concatenated sentences → placeholder interpolation** (fixes broken Dutch
|
|
57
|
+
word order + missing spaces):
|
|
58
|
+
- `FavoriteLists` delete confirm: full-sentence `deleteConfirm` with a
|
|
59
|
+
`{name}` placeholder (the verb was stranded before the object, no space
|
|
60
|
+
before the quote).
|
|
61
|
+
- `CartOverview` / `QuoteActions` terms consent: `termsConsent` with a `{link}`
|
|
62
|
+
placeholder (was "de<a>…", no space, English order).
|
|
63
|
+
- `LoginForm` account-header prompt: `noAccount` with a `{link}` placeholder
|
|
64
|
+
(was "account?Create an Account", no space).
|
|
65
|
+
- **Pluralization**: `FavoriteLists` item count uses `itemSingular`/`itemPlural`
|
|
66
|
+
by count ("1 artikel" not "1 artikelen"); `GridToolbar` product count uses
|
|
67
|
+
`productSingular`/`productPlural` (+ a space).
|
|
68
|
+
|
|
11
69
|
## [0.4.24] - 2026-07-20
|
|
12
70
|
|
|
13
71
|
### Fixed
|
package/dist/index.cjs
CHANGED
|
@@ -1718,7 +1718,9 @@ function useOrders(options) {
|
|
|
1718
1718
|
const [orders, setOrders] = React6.useState([]);
|
|
1719
1719
|
const [loading, setLoading] = React6.useState(false);
|
|
1720
1720
|
const [error, setError] = React6.useState(null);
|
|
1721
|
-
const [searchForm, setSearchForm] = React6.useState(
|
|
1721
|
+
const [searchForm, setSearchForm] = React6.useState(
|
|
1722
|
+
options.initialSearchForm ?? {}
|
|
1723
|
+
);
|
|
1722
1724
|
const pagination = usePagination(options.itemsPerPage ?? 10);
|
|
1723
1725
|
const fetchOrders = React6.useCallback(
|
|
1724
1726
|
async (page = 1) => {
|
|
@@ -3278,10 +3280,15 @@ function LoginForm(rawProps) {
|
|
|
3278
3280
|
] }) : null,
|
|
3279
3281
|
props.accountHeaderLoginForm ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-login-form__footer flex flex-col gap-2 text-sm pt-3 text-center", children: [
|
|
3280
3282
|
/* @__PURE__ */ jsxRuntime.jsx(LoginFormForgotPasswordLink, {}),
|
|
3281
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3282
|
-
propellerV2CoreUi.getLabel(props.labels, "noAccount", "Don't have an account?")
|
|
3283
|
-
|
|
3284
|
-
|
|
3283
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-login-form__register text-xs text-muted-foreground", children: (() => {
|
|
3284
|
+
const tpl = propellerV2CoreUi.getLabel(props.labels, "noAccount", "Don't have an account? {link}");
|
|
3285
|
+
const [before, after = ""] = tpl.split("{link}");
|
|
3286
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3287
|
+
before,
|
|
3288
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoginFormRegisterLink, {}),
|
|
3289
|
+
after
|
|
3290
|
+
] });
|
|
3291
|
+
})() })
|
|
3285
3292
|
] }) : null
|
|
3286
3293
|
]
|
|
3287
3294
|
}
|
|
@@ -3570,6 +3577,13 @@ function AccountIconAndMenu(rawProps) {
|
|
|
3570
3577
|
setMenuOpen(false);
|
|
3571
3578
|
if (props.onMenuItemClick) props.onMenuItemClick(href);
|
|
3572
3579
|
}
|
|
3580
|
+
function handleMenuLinkClick(event, href) {
|
|
3581
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
3582
|
+
return;
|
|
3583
|
+
}
|
|
3584
|
+
event.preventDefault();
|
|
3585
|
+
handleMenuItemClick(href);
|
|
3586
|
+
}
|
|
3573
3587
|
function handleLogoutClick() {
|
|
3574
3588
|
setMenuOpen(false);
|
|
3575
3589
|
if (props.onLogoutClick) props.onLogoutClick();
|
|
@@ -3618,10 +3632,10 @@ function AccountIconAndMenu(rawProps) {
|
|
|
3618
3632
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-account-menu__user-name font-medium text-foreground truncate", children: getUserName() })
|
|
3619
3633
|
] }),
|
|
3620
3634
|
/* @__PURE__ */ jsxRuntime.jsx("nav", { className: "propeller-account-menu__nav py-2", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "propeller-account-menu__list space-y-0.5", children: getMenuLinks()?.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "propeller-account-menu__item", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3621
|
-
"
|
|
3635
|
+
"a",
|
|
3622
3636
|
{
|
|
3623
|
-
|
|
3624
|
-
onClick: (event) =>
|
|
3637
|
+
href: link.href,
|
|
3638
|
+
onClick: (event) => handleMenuLinkClick(event, link.href),
|
|
3625
3639
|
"data-active": isActiveLink(link.href) ? "true" : "false",
|
|
3626
3640
|
className: `propeller-account-menu__link flex w-full items-center gap-3 px-4 py-2.5 text-sm font-medium transition-colors ${isActiveLink(link.href) ? "bg-secondary/5 text-secondary border-l-2 border-secondary" : "text-muted-foreground hover:bg-surface-hover hover:text-foreground"}`,
|
|
3627
3641
|
children: link.label
|
|
@@ -3684,11 +3698,11 @@ function AccountIconAndMenu(rawProps) {
|
|
|
3684
3698
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-account-menu__user-name font-medium text-foreground truncate", children: getUserName() })
|
|
3685
3699
|
] }),
|
|
3686
3700
|
/* @__PURE__ */ jsxRuntime.jsx("nav", { className: "propeller-account-menu__nav", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "propeller-account-menu__list space-y-0.5", children: getMenuLinks()?.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "propeller-account-menu__item", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3687
|
-
"
|
|
3701
|
+
"a",
|
|
3688
3702
|
{
|
|
3689
|
-
|
|
3703
|
+
href: link.href,
|
|
3690
3704
|
className: "propeller-account-menu__link flex w-full items-center gap-3 px-3 py-2 text-sm font-medium rounded-control text-muted-foreground hover:bg-surface-hover hover:text-foreground transition-colors",
|
|
3691
|
-
onClick: (event) =>
|
|
3705
|
+
onClick: (event) => handleMenuLinkClick(event, link.href),
|
|
3692
3706
|
children: link.label
|
|
3693
3707
|
}
|
|
3694
3708
|
) }, link.href)) }) }),
|
|
@@ -5450,7 +5464,8 @@ function AddressCard(rawProps) {
|
|
|
5450
5464
|
] });
|
|
5451
5465
|
}
|
|
5452
5466
|
function AddressCardTypeBadge(props) {
|
|
5453
|
-
const { derived } = useAddressCardContext();
|
|
5467
|
+
const { derived, resolved } = useAddressCardContext();
|
|
5468
|
+
if (resolved.showTypeBadge === false) return null;
|
|
5454
5469
|
if (!derived.addressType) return null;
|
|
5455
5470
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5456
5471
|
"span",
|
|
@@ -7149,18 +7164,23 @@ function CartOverview(props) {
|
|
|
7149
7164
|
onChange: (event) => setTermsAccepted(event.target.checked)
|
|
7150
7165
|
}
|
|
7151
7166
|
),
|
|
7152
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7153
|
-
propellerV2CoreUi.getLabel(props.labels, "
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7167
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "cart-overview-terms", className: "text-sm leading-none", children: (() => {
|
|
7168
|
+
const tpl = propellerV2CoreUi.getLabel(props.labels, "termsConsent", "I agree to the {link}");
|
|
7169
|
+
const [before, after = ""] = tpl.split("{link}");
|
|
7170
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7171
|
+
before,
|
|
7172
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7173
|
+
"a",
|
|
7174
|
+
{
|
|
7175
|
+
href: "#",
|
|
7176
|
+
className: "text-primary hover:underline font-medium",
|
|
7177
|
+
onClick: handleTermsLinkClick,
|
|
7178
|
+
children: propellerV2CoreUi.getLabel(props.labels, "termsLink", "Terms and Conditions")
|
|
7179
|
+
}
|
|
7180
|
+
),
|
|
7181
|
+
after
|
|
7182
|
+
] });
|
|
7183
|
+
})() })
|
|
7164
7184
|
] }) : null,
|
|
7165
7185
|
showPurchaseButton ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7166
7186
|
"button",
|
|
@@ -9925,7 +9945,7 @@ function FavoriteLists(rawProps) {
|
|
|
9925
9945
|
),
|
|
9926
9946
|
getTotalCount(list),
|
|
9927
9947
|
"\xA0",
|
|
9928
|
-
propellerV2CoreUi.getLabel(props.labels, "
|
|
9948
|
+
getTotalCount(list) === 1 ? propellerV2CoreUi.getLabel(props.labels, "itemSingular", "item") : propellerV2CoreUi.getLabel(props.labels, "itemPlural", "items")
|
|
9929
9949
|
] }) : null
|
|
9930
9950
|
] })
|
|
9931
9951
|
] }) : null
|
|
@@ -10109,15 +10129,15 @@ function FavoriteLists(rawProps) {
|
|
|
10109
10129
|
)
|
|
10110
10130
|
] }),
|
|
10111
10131
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
10112
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10113
|
-
propellerV2CoreUi.getLabel(props.labels, "deleteConfirm",
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10132
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-favorite-lists__delete-prompt", children: (() => {
|
|
10133
|
+
const tpl = propellerV2CoreUi.getLabel(props.labels, "deleteConfirm", 'Are you sure you want to delete "{name}"?');
|
|
10134
|
+
const [before, after = ""] = tpl.split("{name}");
|
|
10135
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10136
|
+
before,
|
|
10137
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: listToDelete?.name }),
|
|
10138
|
+
after
|
|
10139
|
+
] });
|
|
10140
|
+
})() }),
|
|
10121
10141
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-favorite-lists__delete-warning text-sm text-destructive", children: propellerV2CoreUi.getLabel(props.labels, "deleteWarning", "This action cannot be undone.") })
|
|
10122
10142
|
] }),
|
|
10123
10143
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-3 pt-6", children: [
|
|
@@ -10701,6 +10721,8 @@ var DEFAULT_LABELS2 = {
|
|
|
10701
10721
|
[propellerSdkV2.SortOrder.DESC]: "High to Low",
|
|
10702
10722
|
clearAll: "Clear All",
|
|
10703
10723
|
products: " Products",
|
|
10724
|
+
productSingular: "Product",
|
|
10725
|
+
productPlural: "Products",
|
|
10704
10726
|
from: "from",
|
|
10705
10727
|
results: "results",
|
|
10706
10728
|
perPage: " per page",
|
|
@@ -10794,7 +10816,8 @@ function GridToolbar(rawProps) {
|
|
|
10794
10816
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-grid-toolbar__bar flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-4", children: [
|
|
10795
10817
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-grid-toolbar__count text-sm text-muted-foreground font-medium", children: props.itemsFound > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10796
10818
|
props.itemsFound,
|
|
10797
|
-
|
|
10819
|
+
"\xA0",
|
|
10820
|
+
props.itemsFound === 1 ? getLabel53("productSingular") : getLabel53("productPlural")
|
|
10798
10821
|
] }) : null }),
|
|
10799
10822
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-grid-toolbar__controls flex flex-wrap items-center gap-3", children: [
|
|
10800
10823
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11836,7 +11859,8 @@ function OrderList(rawProps) {
|
|
|
11836
11859
|
orderStatuses: props.orderStatus,
|
|
11837
11860
|
termFields: props.termFields,
|
|
11838
11861
|
itemsPerPage: props.initialItemsPerPage || 10,
|
|
11839
|
-
channelIds: props.channelIds
|
|
11862
|
+
channelIds: props.channelIds,
|
|
11863
|
+
initialSearchForm: props.initialSearchForm
|
|
11840
11864
|
});
|
|
11841
11865
|
function handlePageChange(newPage) {
|
|
11842
11866
|
if (newPage >= 1 && newPage <= totalPages) {
|
|
@@ -11870,6 +11894,9 @@ function OrderList(rawProps) {
|
|
|
11870
11894
|
return "bg-warning/10 text-warning";
|
|
11871
11895
|
}
|
|
11872
11896
|
}
|
|
11897
|
+
function statusLabel(status) {
|
|
11898
|
+
return props.statusLabels?.[status] || status;
|
|
11899
|
+
}
|
|
11873
11900
|
function getColumnLabel(col) {
|
|
11874
11901
|
if (props.columnConfig && props.columnConfig[col]) {
|
|
11875
11902
|
return props.columnConfig[col];
|
|
@@ -12146,6 +12173,7 @@ function OrderList(rawProps) {
|
|
|
12146
12173
|
onClick: (event) => {
|
|
12147
12174
|
setSearchForm({});
|
|
12148
12175
|
fetchOrders(1);
|
|
12176
|
+
props.onSearchApply?.({});
|
|
12149
12177
|
},
|
|
12150
12178
|
children: propellerV2CoreUi.getLabel(props.labels, "clearButton", "Clear")
|
|
12151
12179
|
}
|
|
@@ -12154,7 +12182,10 @@ function OrderList(rawProps) {
|
|
|
12154
12182
|
"button",
|
|
12155
12183
|
{
|
|
12156
12184
|
className: "propeller-order-list__search-btn inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-control shadow-sm text-primary-foreground bg-primary hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary",
|
|
12157
|
-
onClick: (event) =>
|
|
12185
|
+
onClick: (event) => {
|
|
12186
|
+
fetchOrders(1);
|
|
12187
|
+
props.onSearchApply?.(searchForm);
|
|
12188
|
+
},
|
|
12158
12189
|
children: propellerV2CoreUi.getLabel(props.labels, "searchButton", "Search")
|
|
12159
12190
|
}
|
|
12160
12191
|
)
|
|
@@ -12174,7 +12205,7 @@ function OrderList(rawProps) {
|
|
|
12174
12205
|
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "propeller-order-list__tbody bg-card divide-y divide-border", children: orders?.map((order) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12175
12206
|
"tr",
|
|
12176
12207
|
{
|
|
12177
|
-
className:
|
|
12208
|
+
className: `propeller-order-list__row hover:bg-surface-hover ${rowsClickable ? "cursor-pointer" : ""}`,
|
|
12178
12209
|
"data-clickable": rowsClickable ? "true" : "false",
|
|
12179
12210
|
onClick: (event) => rowsClickable && props.onOrderClick(order.id),
|
|
12180
12211
|
children: columns?.map((col) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -12190,7 +12221,7 @@ function OrderList(rawProps) {
|
|
|
12190
12221
|
{
|
|
12191
12222
|
className: `propeller-order-list__status px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusColor(order.status)}`,
|
|
12192
12223
|
"data-status": order.status,
|
|
12193
|
-
children: order.status
|
|
12224
|
+
children: statusLabel(order.status)
|
|
12194
12225
|
}
|
|
12195
12226
|
) : null,
|
|
12196
12227
|
col === "total" ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: formatPrice17(order.total?.net) }) : null,
|
|
@@ -12492,11 +12523,13 @@ function OrderSummary(props) {
|
|
|
12492
12523
|
const showRemarks = props.showRemarks !== void 0 ? props.showRemarks : true;
|
|
12493
12524
|
const orderNumber = order?.id || "";
|
|
12494
12525
|
const orderDate = order?.createdAt || "";
|
|
12495
|
-
const
|
|
12526
|
+
const rawStatus = order?.status || "";
|
|
12527
|
+
const orderStatus = rawStatus ? props.statusLabels?.[rawStatus] || rawStatus : "";
|
|
12496
12528
|
const orderTotal = Number(order?.total?.net || 0);
|
|
12497
12529
|
const orderReference = order?.reference || "";
|
|
12498
12530
|
const orderRemarks = order?.remarks || "";
|
|
12499
|
-
const
|
|
12531
|
+
const rawPaymentMethod = order?.paymentData?.method || "";
|
|
12532
|
+
const paymentMethod = rawPaymentMethod ? props.paymethodLabels?.[rawPaymentMethod.toLowerCase()] || rawPaymentMethod : "";
|
|
12500
12533
|
const carrierName = order?.postageData?.carrier || "";
|
|
12501
12534
|
const addresses = order?.addresses || [];
|
|
12502
12535
|
const invoiceAddress = addresses.find((a) => a.type === "invoice") || null;
|
|
@@ -16184,18 +16217,23 @@ function QuoteActions(rawProps) {
|
|
|
16184
16217
|
onChange: (event) => handleTermsChange(event.target.checked)
|
|
16185
16218
|
}
|
|
16186
16219
|
),
|
|
16187
|
-
/* @__PURE__ */ jsxRuntime.
|
|
16188
|
-
propellerV2CoreUi.getLabel(props.labels, "
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16220
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "quote-actions-terms", className: "text-sm leading-none", children: (() => {
|
|
16221
|
+
const tpl = propellerV2CoreUi.getLabel(props.labels, "termsConsent", "I agree to the {link}");
|
|
16222
|
+
const [before, after = ""] = tpl.split("{link}");
|
|
16223
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16224
|
+
before,
|
|
16225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16226
|
+
"a",
|
|
16227
|
+
{
|
|
16228
|
+
href: "#",
|
|
16229
|
+
className: "text-primary hover:underline font-medium",
|
|
16230
|
+
onClick: (event) => handleTermsLinkClick(event),
|
|
16231
|
+
children: propellerV2CoreUi.getLabel(props.labels, "termsLink", "Terms and Conditions")
|
|
16232
|
+
}
|
|
16233
|
+
),
|
|
16234
|
+
after
|
|
16235
|
+
] });
|
|
16236
|
+
})() })
|
|
16199
16237
|
] }) : null,
|
|
16200
16238
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16201
16239
|
"button",
|
|
@@ -17257,6 +17295,9 @@ function SearchBar(rawProps) {
|
|
|
17257
17295
|
}
|
|
17258
17296
|
setShowDropdown(false);
|
|
17259
17297
|
}
|
|
17298
|
+
function isModifiedClick(event) {
|
|
17299
|
+
return event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
|
17300
|
+
}
|
|
17260
17301
|
React6.useEffect(() => {
|
|
17261
17302
|
const listener = (e) => {
|
|
17262
17303
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -17310,39 +17351,68 @@ function SearchBar(rawProps) {
|
|
|
17310
17351
|
] }) }),
|
|
17311
17352
|
showDropdown ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card rounded-container shadow-xl border border-border z-50 flex flex-col max-h-96", children: [
|
|
17312
17353
|
results.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17313
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__results flex-1 overflow-y-auto", children: results?.map((result, index) =>
|
|
17314
|
-
"div"
|
|
17354
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__results flex-1 overflow-y-auto", children: results?.map((result, index) => {
|
|
17355
|
+
const ResultTag = props.getResultHref ? "a" : "div";
|
|
17356
|
+
const resultProps = props.getResultHref ? {
|
|
17357
|
+
href: props.getResultHref(result),
|
|
17358
|
+
onClick: (event) => {
|
|
17359
|
+
if (isModifiedClick(event)) return;
|
|
17360
|
+
event.preventDefault();
|
|
17361
|
+
handleResultClick(result);
|
|
17362
|
+
}
|
|
17363
|
+
} : { onClick: (_event) => handleResultClick(result) };
|
|
17364
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17365
|
+
ResultTag,
|
|
17366
|
+
{
|
|
17367
|
+
className: "propeller-search-bar__result flex items-center gap-4 p-3 hover:bg-surface-hover cursor-pointer border-b border-border-subtle last:border-b-0",
|
|
17368
|
+
...resultProps,
|
|
17369
|
+
children: [
|
|
17370
|
+
result.imageUrl || noImageUrl() ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__result-media relative w-16 h-16 flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17371
|
+
"img",
|
|
17372
|
+
{
|
|
17373
|
+
className: "propeller-search-bar__result-image w-full h-full object-contain",
|
|
17374
|
+
src: result.imageUrl || noImageUrl(),
|
|
17375
|
+
alt: result.name
|
|
17376
|
+
}
|
|
17377
|
+
) }) : null,
|
|
17378
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17379
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__result-name font-semibold truncate", children: result.name }),
|
|
17380
|
+
result.sku ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-sku text-sm text-muted-foreground", children: [
|
|
17381
|
+
"SKU: ",
|
|
17382
|
+
result.sku
|
|
17383
|
+
] }) : null
|
|
17384
|
+
] }),
|
|
17385
|
+
result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
17386
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
17387
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
17388
|
+
] }) : null
|
|
17389
|
+
]
|
|
17390
|
+
},
|
|
17391
|
+
result.id + "-" + index
|
|
17392
|
+
);
|
|
17393
|
+
}) }),
|
|
17394
|
+
itemsFound > results.length ? props.getViewAllHref ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17395
|
+
"a",
|
|
17315
17396
|
{
|
|
17316
|
-
|
|
17317
|
-
|
|
17397
|
+
href: props.getViewAllHref(localTerm),
|
|
17398
|
+
className: "propeller-search-bar__view-all block flex-shrink-0 p-3 text-center text-primary hover:bg-primary/5 cursor-pointer font-semibold border-t border-border bg-card rounded-b-container",
|
|
17399
|
+
onClick: (event) => {
|
|
17400
|
+
if (isModifiedClick(event)) return;
|
|
17401
|
+
event.preventDefault();
|
|
17402
|
+
handleViewAllClick();
|
|
17403
|
+
},
|
|
17318
17404
|
children: [
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
src: result.imageUrl || noImageUrl(),
|
|
17324
|
-
alt: result.name
|
|
17325
|
-
}
|
|
17326
|
-
) }) : null,
|
|
17327
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
17328
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__result-name font-semibold truncate", children: result.name }),
|
|
17329
|
-
result.sku ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-sku text-sm text-muted-foreground", children: [
|
|
17330
|
-
"SKU: ",
|
|
17331
|
-
result.sku
|
|
17332
|
-
] }) : null
|
|
17333
|
-
] }),
|
|
17334
|
-
result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
17335
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
17336
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
17337
|
-
] }) : null
|
|
17405
|
+
propellerV2CoreUi.getLabel(props.labels, "viewAll", "View all results"),
|
|
17406
|
+
" (",
|
|
17407
|
+
itemsFound,
|
|
17408
|
+
")"
|
|
17338
17409
|
]
|
|
17339
|
-
}
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
itemsFound > results.length ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17343
|
-
"div",
|
|
17410
|
+
}
|
|
17411
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17412
|
+
"button",
|
|
17344
17413
|
{
|
|
17345
|
-
|
|
17414
|
+
type: "button",
|
|
17415
|
+
className: "propeller-search-bar__view-all block w-full flex-shrink-0 p-3 text-center text-primary hover:bg-primary/5 cursor-pointer font-semibold border-t border-border bg-card rounded-b-container",
|
|
17346
17416
|
onClick: (event) => handleViewAllClick(),
|
|
17347
17417
|
children: [
|
|
17348
17418
|
propellerV2CoreUi.getLabel(props.labels, "viewAll", "View all results"),
|