@betterstore/react 0.5.11 → 0.5.12
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/compounds/form/address-input/index.tsx"],"names":[],"mappings":"AA+BA,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAc,EACd,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,wBAAwB,GACzB,EAAE,iBAAiB,2CAsOnB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -7395,7 +7395,9 @@ var Client = class {
|
|
|
7395
7395
|
*/
|
|
7396
7396
|
async getExchangeRate(clientSecret, baseCurrency, targetCurrency) {
|
|
7397
7397
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7398
|
-
const
|
|
7398
|
+
const data = await apiClient.get(
|
|
7399
|
+
`/helpers/rates/${baseCurrency}`
|
|
7400
|
+
);
|
|
7399
7401
|
const rate = data.rates[targetCurrency];
|
|
7400
7402
|
if (!rate) {
|
|
7401
7403
|
throw new Error("Could not get exchange rate for target currency");
|
|
@@ -7407,19 +7409,26 @@ var Client = class {
|
|
|
7407
7409
|
*/
|
|
7408
7410
|
async getAutosuggestAddressResults(clientSecret, params) {
|
|
7409
7411
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7410
|
-
const { data } = await apiClient.get(
|
|
7411
|
-
|
|
7412
|
-
|
|
7412
|
+
const { data, ...rest } = await apiClient.get(
|
|
7413
|
+
"/helpers/autosuggest-address",
|
|
7414
|
+
{
|
|
7415
|
+
params
|
|
7416
|
+
}
|
|
7417
|
+
);
|
|
7418
|
+
console.log("autosuggest data", data);
|
|
7419
|
+
console.log("autosuggest rest", rest);
|
|
7413
7420
|
return data;
|
|
7414
7421
|
}
|
|
7415
7422
|
/**
|
|
7416
|
-
* Get
|
|
7423
|
+
* Get geocode address results
|
|
7417
7424
|
*/
|
|
7418
|
-
async
|
|
7425
|
+
async getGeocodeAddressResults(clientSecret, params) {
|
|
7419
7426
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7420
|
-
const { data } = await apiClient.get("/helpers/
|
|
7427
|
+
const { data, ...rest } = await apiClient.get("/helpers/geocode-address", {
|
|
7421
7428
|
params
|
|
7422
7429
|
});
|
|
7430
|
+
console.log("geocode data", data);
|
|
7431
|
+
console.log("geocode rest", rest);
|
|
7423
7432
|
return data;
|
|
7424
7433
|
}
|
|
7425
7434
|
};
|
|
@@ -23575,8 +23584,19 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
23575
23584
|
*/
|
|
23576
23585
|
|
|
23577
23586
|
|
|
23578
|
-
const __iconNode$
|
|
23579
|
-
const Check = createLucideIcon("Check", __iconNode$
|
|
23587
|
+
const __iconNode$8 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
23588
|
+
const Check = createLucideIcon("Check", __iconNode$8);
|
|
23589
|
+
|
|
23590
|
+
/**
|
|
23591
|
+
* @license lucide-react v0.479.0 - ISC
|
|
23592
|
+
*
|
|
23593
|
+
* This source code is licensed under the ISC license.
|
|
23594
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
23595
|
+
*/
|
|
23596
|
+
|
|
23597
|
+
|
|
23598
|
+
const __iconNode$7 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
23599
|
+
const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
|
|
23580
23600
|
|
|
23581
23601
|
/**
|
|
23582
23602
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -23586,8 +23606,8 @@ const Check = createLucideIcon("Check", __iconNode$7);
|
|
|
23586
23606
|
*/
|
|
23587
23607
|
|
|
23588
23608
|
|
|
23589
|
-
const __iconNode$6 = [["path", { d: "
|
|
23590
|
-
const
|
|
23609
|
+
const __iconNode$6 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
23610
|
+
const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$6);
|
|
23591
23611
|
|
|
23592
23612
|
/**
|
|
23593
23613
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -23597,8 +23617,8 @@ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$6);
|
|
|
23597
23617
|
*/
|
|
23598
23618
|
|
|
23599
23619
|
|
|
23600
|
-
const __iconNode$5 = [["path", { d: "
|
|
23601
|
-
const
|
|
23620
|
+
const __iconNode$5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
23621
|
+
const ChevronRight = createLucideIcon("ChevronRight", __iconNode$5);
|
|
23602
23622
|
|
|
23603
23623
|
/**
|
|
23604
23624
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -34403,8 +34423,8 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34403
34423
|
countryCode,
|
|
34404
34424
|
});
|
|
34405
34425
|
console.log(results);
|
|
34406
|
-
setShowSuggestions(results.length > 0);
|
|
34407
34426
|
setSuggestions(results);
|
|
34427
|
+
setShowSuggestions(true);
|
|
34408
34428
|
}
|
|
34409
34429
|
catch (error) {
|
|
34410
34430
|
console.error("Error fetching address suggestions:", error);
|
|
@@ -34426,16 +34446,29 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34426
34446
|
}, [showAllInputs, addressInput]);
|
|
34427
34447
|
const handleSelectAddress = (address) => {
|
|
34428
34448
|
console.log(address);
|
|
34429
|
-
|
|
34430
|
-
|
|
34431
|
-
|
|
34432
|
-
|
|
34433
|
-
|
|
34434
|
-
|
|
34435
|
-
|
|
34436
|
-
|
|
34437
|
-
|
|
34449
|
+
const isLookup = "line1" in address;
|
|
34450
|
+
if (!isLookup) {
|
|
34451
|
+
setIsLoading(true);
|
|
34452
|
+
storeClient
|
|
34453
|
+
.getGeocodeAddressResults(clientSecret, {
|
|
34454
|
+
selectedStreetId: address.id,
|
|
34455
|
+
position: address.position,
|
|
34456
|
+
})
|
|
34457
|
+
.then((results) => {
|
|
34458
|
+
console.log(results);
|
|
34459
|
+
});
|
|
34460
|
+
return;
|
|
34461
|
+
}
|
|
34462
|
+
const geocodeAddress = address;
|
|
34463
|
+
form.setValue("address.line1", geocodeAddress.line1);
|
|
34464
|
+
form.setValue("address.line2", geocodeAddress.line2);
|
|
34465
|
+
form.setValue("address.city", geocodeAddress.city);
|
|
34466
|
+
form.setValue("address.province", geocodeAddress.province);
|
|
34467
|
+
form.setValue("address.provinceCode", geocodeAddress.provinceCode);
|
|
34468
|
+
form.setValue("address.zipCode", geocodeAddress.zipCode);
|
|
34438
34469
|
setShowSuggestions(false);
|
|
34470
|
+
setShowAllInputs(true);
|
|
34471
|
+
setSuggestions([]);
|
|
34439
34472
|
};
|
|
34440
34473
|
const handleManualEntry = () => {
|
|
34441
34474
|
setShowAllInputs(true);
|
|
@@ -34443,7 +34476,10 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34443
34476
|
React.useEffect(() => {
|
|
34444
34477
|
setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
|
|
34445
34478
|
}, [cityInput]);
|
|
34446
|
-
return (jsxRuntime.jsxs("div", { className: cn("space-y-5", className), children: [jsxRuntime.jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsxRuntime.jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs }), !showAllInputs && (showSuggestions || isLoading) && (jsxRuntime.jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", children: isLoading ? (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) =>
|
|
34479
|
+
return (jsxRuntime.jsxs("div", { className: cn("space-y-5", className), children: [jsxRuntime.jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsxRuntime.jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setShowSuggestions(false) }), !showAllInputs && (showSuggestions || isLoading) && (jsxRuntime.jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => {
|
|
34480
|
+
const isLookup = "line1" in address;
|
|
34481
|
+
return (jsxRuntime.jsxs("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: [jsxRuntime.jsx("div", { className: "text-foreground text-sm", children: address.title }), !isLookup && (jsxRuntime.jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-4" }))] }, index));
|
|
34482
|
+
}) })] })) : (jsxRuntime.jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsxRuntime.jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsxRuntime.jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxRuntime.jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsxRuntime.jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxRuntime.jsxs("button", { type: "button", onClick: () => {
|
|
34447
34483
|
setShowApartmentField(true);
|
|
34448
34484
|
form.setFocus("address.line2");
|
|
34449
34485
|
}, className: "text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-2 text-sm transition-colors", children: [jsxRuntime.jsx(Plus, { className: "h-4 w-4" }), "Add Company, C/O, Apt, Suite, Unit"] }) }), jsxRuntime.jsx("div", { className: cn(!showApartmentField && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: jsxRuntime.jsx(InputGroup, { name: "address.line2", label: "Company, C/O, Apt, Suite, Unit" }) }), jsxRuntime.jsxs("div", { className: "grid grid-cols-3 gap-4", children: [jsxRuntime.jsx(InputGroup, { name: "address.city", label: "City", required: true }), jsxRuntime.jsx(SelectGroup, { name: "address.province", label: "State", options: stateOptions, required: true }), jsxRuntime.jsx(InputGroup, { name: "address.zipCode", label: "Postal Code", required: true })] })] })] }));
|
package/dist/index.mjs
CHANGED
|
@@ -7375,7 +7375,9 @@ var Client = class {
|
|
|
7375
7375
|
*/
|
|
7376
7376
|
async getExchangeRate(clientSecret, baseCurrency, targetCurrency) {
|
|
7377
7377
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7378
|
-
const
|
|
7378
|
+
const data = await apiClient.get(
|
|
7379
|
+
`/helpers/rates/${baseCurrency}`
|
|
7380
|
+
);
|
|
7379
7381
|
const rate = data.rates[targetCurrency];
|
|
7380
7382
|
if (!rate) {
|
|
7381
7383
|
throw new Error("Could not get exchange rate for target currency");
|
|
@@ -7387,19 +7389,26 @@ var Client = class {
|
|
|
7387
7389
|
*/
|
|
7388
7390
|
async getAutosuggestAddressResults(clientSecret, params) {
|
|
7389
7391
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7390
|
-
const { data } = await apiClient.get(
|
|
7391
|
-
|
|
7392
|
-
|
|
7392
|
+
const { data, ...rest } = await apiClient.get(
|
|
7393
|
+
"/helpers/autosuggest-address",
|
|
7394
|
+
{
|
|
7395
|
+
params
|
|
7396
|
+
}
|
|
7397
|
+
);
|
|
7398
|
+
console.log("autosuggest data", data);
|
|
7399
|
+
console.log("autosuggest rest", rest);
|
|
7393
7400
|
return data;
|
|
7394
7401
|
}
|
|
7395
7402
|
/**
|
|
7396
|
-
* Get
|
|
7403
|
+
* Get geocode address results
|
|
7397
7404
|
*/
|
|
7398
|
-
async
|
|
7405
|
+
async getGeocodeAddressResults(clientSecret, params) {
|
|
7399
7406
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
7400
|
-
const { data } = await apiClient.get("/helpers/
|
|
7407
|
+
const { data, ...rest } = await apiClient.get("/helpers/geocode-address", {
|
|
7401
7408
|
params
|
|
7402
7409
|
});
|
|
7410
|
+
console.log("geocode data", data);
|
|
7411
|
+
console.log("geocode rest", rest);
|
|
7403
7412
|
return data;
|
|
7404
7413
|
}
|
|
7405
7414
|
};
|
|
@@ -23555,8 +23564,19 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
23555
23564
|
*/
|
|
23556
23565
|
|
|
23557
23566
|
|
|
23558
|
-
const __iconNode$
|
|
23559
|
-
const Check = createLucideIcon("Check", __iconNode$
|
|
23567
|
+
const __iconNode$8 = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
23568
|
+
const Check = createLucideIcon("Check", __iconNode$8);
|
|
23569
|
+
|
|
23570
|
+
/**
|
|
23571
|
+
* @license lucide-react v0.479.0 - ISC
|
|
23572
|
+
*
|
|
23573
|
+
* This source code is licensed under the ISC license.
|
|
23574
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
23575
|
+
*/
|
|
23576
|
+
|
|
23577
|
+
|
|
23578
|
+
const __iconNode$7 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
23579
|
+
const ChevronDown = createLucideIcon("ChevronDown", __iconNode$7);
|
|
23560
23580
|
|
|
23561
23581
|
/**
|
|
23562
23582
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -23566,8 +23586,8 @@ const Check = createLucideIcon("Check", __iconNode$7);
|
|
|
23566
23586
|
*/
|
|
23567
23587
|
|
|
23568
23588
|
|
|
23569
|
-
const __iconNode$6 = [["path", { d: "
|
|
23570
|
-
const
|
|
23589
|
+
const __iconNode$6 = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
23590
|
+
const ChevronLeft = createLucideIcon("ChevronLeft", __iconNode$6);
|
|
23571
23591
|
|
|
23572
23592
|
/**
|
|
23573
23593
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -23577,8 +23597,8 @@ const ChevronDown = createLucideIcon("ChevronDown", __iconNode$6);
|
|
|
23577
23597
|
*/
|
|
23578
23598
|
|
|
23579
23599
|
|
|
23580
|
-
const __iconNode$5 = [["path", { d: "
|
|
23581
|
-
const
|
|
23600
|
+
const __iconNode$5 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
23601
|
+
const ChevronRight = createLucideIcon("ChevronRight", __iconNode$5);
|
|
23582
23602
|
|
|
23583
23603
|
/**
|
|
23584
23604
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -34383,8 +34403,8 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34383
34403
|
countryCode,
|
|
34384
34404
|
});
|
|
34385
34405
|
console.log(results);
|
|
34386
|
-
setShowSuggestions(results.length > 0);
|
|
34387
34406
|
setSuggestions(results);
|
|
34407
|
+
setShowSuggestions(true);
|
|
34388
34408
|
}
|
|
34389
34409
|
catch (error) {
|
|
34390
34410
|
console.error("Error fetching address suggestions:", error);
|
|
@@ -34406,16 +34426,29 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34406
34426
|
}, [showAllInputs, addressInput]);
|
|
34407
34427
|
const handleSelectAddress = (address) => {
|
|
34408
34428
|
console.log(address);
|
|
34409
|
-
|
|
34410
|
-
|
|
34411
|
-
|
|
34412
|
-
|
|
34413
|
-
|
|
34414
|
-
|
|
34415
|
-
|
|
34416
|
-
|
|
34417
|
-
|
|
34429
|
+
const isLookup = "line1" in address;
|
|
34430
|
+
if (!isLookup) {
|
|
34431
|
+
setIsLoading(true);
|
|
34432
|
+
storeClient
|
|
34433
|
+
.getGeocodeAddressResults(clientSecret, {
|
|
34434
|
+
selectedStreetId: address.id,
|
|
34435
|
+
position: address.position,
|
|
34436
|
+
})
|
|
34437
|
+
.then((results) => {
|
|
34438
|
+
console.log(results);
|
|
34439
|
+
});
|
|
34440
|
+
return;
|
|
34441
|
+
}
|
|
34442
|
+
const geocodeAddress = address;
|
|
34443
|
+
form.setValue("address.line1", geocodeAddress.line1);
|
|
34444
|
+
form.setValue("address.line2", geocodeAddress.line2);
|
|
34445
|
+
form.setValue("address.city", geocodeAddress.city);
|
|
34446
|
+
form.setValue("address.province", geocodeAddress.province);
|
|
34447
|
+
form.setValue("address.provinceCode", geocodeAddress.provinceCode);
|
|
34448
|
+
form.setValue("address.zipCode", geocodeAddress.zipCode);
|
|
34418
34449
|
setShowSuggestions(false);
|
|
34450
|
+
setShowAllInputs(true);
|
|
34451
|
+
setSuggestions([]);
|
|
34419
34452
|
};
|
|
34420
34453
|
const handleManualEntry = () => {
|
|
34421
34454
|
setShowAllInputs(true);
|
|
@@ -34423,7 +34456,10 @@ function AddressInput({ className = "", proxy, clientSecret, latitude, longitude
|
|
|
34423
34456
|
useEffect(() => {
|
|
34424
34457
|
setShowAllInputs((cityInput === null || cityInput === void 0 ? void 0 : cityInput.length) > 0);
|
|
34425
34458
|
}, [cityInput]);
|
|
34426
|
-
return (jsxs("div", { className: cn("space-y-5", className), children: [jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxs("div", { className: "relative", children: [jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs }), !showAllInputs && (showSuggestions || isLoading) && (jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", children: isLoading ? (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxs(Fragment, { children: [jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) =>
|
|
34459
|
+
return (jsxs("div", { className: cn("space-y-5", className), children: [jsx(CountryInput, { prefix: "address", label: "Country", form: form }), jsxs("div", { className: "relative", children: [jsx(InputGroup, { name: "address.line1", label: showAllInputs ? "Address" : "Start typing address", required: showAllInputs, icon: jsx(Search, { className: "h-4 w-4" }), showIcon: !showAllInputs, onFocus: () => setShowSuggestions(true), onBlur: () => setShowSuggestions(false) }), !showAllInputs && (showSuggestions || isLoading) && (jsx("div", { className: "bg-background border-border absolute left-0 right-0 top-full z-50 mt-1 rounded-md border shadow-lg", "data-dropdown": "suggestions", children: isLoading ? (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Searching for addresses..." })) : suggestions.length > 0 ? (jsxs(Fragment, { children: [jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "Keep typing address to display results" }), jsx("div", { className: "max-h-60 overflow-y-auto", children: suggestions.map((address, index) => {
|
|
34460
|
+
const isLookup = "line1" in address;
|
|
34461
|
+
return (jsxs("button", { type: "button", onClick: () => handleSelectAddress(address), className: "hover:bg-accent border-border flex w-full cursor-pointer items-center border-b px-3 py-3 text-left transition-colors last:border-b-0", children: [jsx("div", { className: "text-foreground text-sm", children: address.title }), !isLookup && (jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-4" }))] }, index));
|
|
34462
|
+
}) })] })) : (jsx("div", { className: "text-muted-foreground border-border border-b p-3 text-sm", children: "No addresses found" })) }))] }), jsx("div", { className: cn(!showAllInputs ? "-mt-2 mb-4 block" : "hidden"), children: jsx("button", { type: "button", onClick: handleManualEntry, className: "text-foreground hover:text-muted-foreground cursor-pointer text-[13px] underline", children: "Enter address manually" }) }), jsxs("div", { className: cn("space-y-4", !showAllInputs && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: [jsx("div", { className: cn(!showApartmentField ? "block" : "hidden"), children: jsxs("button", { type: "button", onClick: () => {
|
|
34427
34463
|
setShowApartmentField(true);
|
|
34428
34464
|
form.setFocus("address.line2");
|
|
34429
34465
|
}, className: "text-muted-foreground hover:text-foreground flex cursor-pointer items-center gap-2 text-sm transition-colors", children: [jsx(Plus, { className: "h-4 w-4" }), "Add Company, C/O, Apt, Suite, Unit"] }) }), jsx("div", { className: cn(!showApartmentField && "-mt-4 h-0 max-h-0 w-0 max-w-0 opacity-0"), children: jsx(InputGroup, { name: "address.line2", label: "Company, C/O, Apt, Suite, Unit" }) }), jsxs("div", { className: "grid grid-cols-3 gap-4", children: [jsx(InputGroup, { name: "address.city", label: "City", required: true }), jsx(SelectGroup, { name: "address.province", label: "State", options: stateOptions, required: true }), jsx(InputGroup, { name: "address.zipCode", label: "Postal Code", required: true })] })] })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betterstore/react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"tailwindcss": "^4.1.11",
|
|
28
28
|
"typescript": "5.8.2",
|
|
29
29
|
"vite": "^6.3.5",
|
|
30
|
-
"@betterstore/
|
|
31
|
-
"@betterstore/
|
|
30
|
+
"@betterstore/eslint-config": "0.0.0",
|
|
31
|
+
"@betterstore/typescript-config": "0.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"tailwindcss-animate": "^1.0.7",
|
|
78
78
|
"zod": "^3.25.30",
|
|
79
79
|
"zustand": "^5.0.5",
|
|
80
|
-
"@betterstore/sdk": "0.5.
|
|
80
|
+
"@betterstore/sdk": "0.5.12"
|
|
81
81
|
},
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|