@faststore/core 2.2.57 → 2.2.59
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +37 -37
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1gneedd +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +2 -2
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/74.js +1593 -166
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +30 -1278
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +3 -3
- package/.next/static/chunks/158-3ad2d91ade721ede.js +1 -0
- package/.next/static/chunks/497-e24ad9b81a2b2cba.js +1 -0
- package/.next/static/chunks/{585.4e673e43d8daf336.js → 585.f056dcd6e8625c41.js} +1 -1
- package/.next/static/chunks/988.a57dac6501fb5184.js +1 -0
- package/.next/static/chunks/pages/{[...slug]-b82b56ce1651ea4f.js → [...slug]-73ed6192e9f16de9.js} +1 -1
- package/.next/static/chunks/pages/[slug]/p-0006885a8666b680.js +1 -0
- package/.next/static/chunks/pages/index-eb26d4cf53e13666.js +1 -0
- package/.next/static/chunks/{webpack-ec84ae4e89cebb1f.js → webpack-3382def1b25b17f8.js} +1 -1
- package/.next/static/css/4729e602d10c1332.css +1 -0
- package/.next/static/css/f2ab72459fcdabcc.css +1 -0
- package/.next/static/{sToiuT4rncwaUIk2owcIX → kWyk6RSC1bsGWTDX1FSk5}/_buildManifest.js +1 -1
- package/.next/trace +81 -81
- package/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-test.log +9 -9
- package/package.json +2 -2
- package/public/icons.svg +3 -1
- package/src/components/sections/ProductDetails/DefaultComponents.ts +34 -0
- package/src/components/sections/ProductDetails/OverriddenDefaultProductDetails.ts +12 -0
- package/src/components/sections/ProductDetails/ProductDetails.tsx +33 -34
- package/src/components/ui/ImageGallery/ImageGallery.tsx +10 -6
- package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +12 -13
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +4 -2
- package/src/components/ui/SkuSelector/Selectors.tsx +3 -1
- package/src/pages/[slug]/p.tsx +1 -1
- package/src/sdk/overrides/sections.tsx +5 -1
- package/src/typings/overrides.ts +1 -1
- package/.next/server/chunks/693.js +0 -58
- package/.next/server/chunks/779.js +0 -58
- package/.next/static/chunks/158-ef35da4842083552.js +0 -1
- package/.next/static/chunks/497-37c1e4e1d862b354.js +0 -1
- package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-39599bd4d6faeeb6.js +0 -1
- package/.next/static/chunks/pages/index-84457d91d9060925.js +0 -1
- package/.next/static/css/0cb5d7afb952bb02.css +0 -1
- package/.next/static/css/cbccabebb36f7f92.css +0 -1
- package/src/components/sections/ProductDetails/Overrides.tsx +0 -73
- /package/.next/static/{sToiuT4rncwaUIk2owcIX → kWyk6RSC1bsGWTDX1FSk5}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ yarn partytown & yarn generate && next build
|
|
2
|
-
$ faststore generate-graphql -c
|
|
3
2
|
$ partytown copylib ./public/~partytown
|
|
3
|
+
$ faststore generate-graphql -c
|
|
4
4
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
5
5
|
success - GraphQL schema, types, and optimizations successfully generated 🎉
|
|
6
6
|
warn - You have enabled experimental feature (scrollRestoration) in next.config.js.
|
|
@@ -38,28 +38,28 @@ info - Generating static pages (7/7)
|
|
|
38
38
|
info - Finalizing page optimization...
|
|
39
39
|
|
|
40
40
|
Route (pages) Size First Load JS
|
|
41
|
-
┌ ● / 6.
|
|
41
|
+
┌ ● / 6.23 kB 133 kB
|
|
42
42
|
├ └ css/cf062feb79245123.css 8.38 kB
|
|
43
43
|
├ /_app 0 B 83.7 kB
|
|
44
|
-
├ ● /[...slug] 7.35 kB
|
|
44
|
+
├ ● /[...slug] 7.35 kB 145 kB
|
|
45
45
|
├ └ css/0dc997f9da3027b7.css 8.8 kB
|
|
46
|
-
├ ● /[slug]/p
|
|
47
|
-
├ └ css/
|
|
48
|
-
├ ○ /404 1.19 kB
|
|
49
|
-
├ ● /500 1.21 kB
|
|
50
|
-
├ ● /account 677 B
|
|
46
|
+
├ ● /[slug]/p 8.02 kB 135 kB
|
|
47
|
+
├ └ css/f2ab72459fcdabcc.css 5.4 kB
|
|
48
|
+
├ ○ /404 1.19 kB 128 kB
|
|
49
|
+
├ ● /500 1.21 kB 128 kB
|
|
50
|
+
├ ● /account 677 B 128 kB
|
|
51
51
|
├ λ /api/graphql 0 B 83.7 kB
|
|
52
52
|
├ λ /api/health/live 0 B 83.7 kB
|
|
53
53
|
├ λ /api/health/ready 0 B 83.7 kB
|
|
54
54
|
├ λ /api/preview 0 B 83.7 kB
|
|
55
|
-
├ ● /checkout 662 B
|
|
56
|
-
├ ● /login 1.14 kB
|
|
57
|
-
└ ● /s 1.38 kB
|
|
55
|
+
├ ● /checkout 662 B 128 kB
|
|
56
|
+
├ ● /login 1.14 kB 128 kB
|
|
57
|
+
└ ● /s 1.38 kB 139 kB
|
|
58
58
|
+ First Load JS shared by all 86.8 kB
|
|
59
59
|
├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
|
|
60
60
|
├ chunks/main-e4e873ee741162eb.js 24.2 kB
|
|
61
61
|
├ chunks/pages/_app-30b9666307e4b3b1.js 12.1 kB
|
|
62
|
-
├ chunks/webpack-
|
|
62
|
+
├ chunks/webpack-3382def1b25b17f8.js 2.23 kB
|
|
63
63
|
└ css/5d1f64b61ea581f4.css 3.05 kB
|
|
64
64
|
|
|
65
65
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
$ jest
|
|
2
|
-
PASS test/server/index.test.ts (21.
|
|
2
|
+
PASS test/server/index.test.ts (21.341 s)
|
|
3
3
|
FastStore GraphQL Layer
|
|
4
4
|
@faststore/api
|
|
5
|
-
✓ should return a valid GraphQL schema (
|
|
6
|
-
✓ should return a valid GraphQL schema contain all expected types (
|
|
5
|
+
✓ should return a valid GraphQL schema (10 ms)
|
|
6
|
+
✓ should return a valid GraphQL schema contain all expected types (7 ms)
|
|
7
7
|
✓ should return a valid GraphQL schema contain all expected queries (1 ms)
|
|
8
|
-
✓ should return a valid GraphQL schema contain all expected mutations (
|
|
8
|
+
✓ should return a valid GraphQL schema contain all expected mutations (2 ms)
|
|
9
9
|
VTEX API Extension
|
|
10
|
-
✓ getTypeDefsFromFolder function should return an Array (
|
|
10
|
+
✓ getTypeDefsFromFolder function should return an Array (5 ms)
|
|
11
11
|
Third Party API Extension
|
|
12
12
|
✓ getTypeDefsFromFolder function should return an Array (6 ms)
|
|
13
13
|
Final Schema after merging
|
|
14
|
-
✓ should return a valid merged GraphQL schema (
|
|
14
|
+
✓ should return a valid merged GraphQL schema (34 ms)
|
|
15
15
|
Envelop
|
|
16
|
-
✓ should exist with its plugins (
|
|
17
|
-
✓ should handle options and execute (
|
|
16
|
+
✓ should exist with its plugins (25 ms)
|
|
17
|
+
✓ should handle options and execute (319 ms)
|
|
18
18
|
|
|
19
19
|
Test Suites: 1 passed, 1 total
|
|
20
20
|
Tests: 9 passed, 9 total
|
|
21
21
|
Snapshots: 0 total
|
|
22
|
-
Time: 21.
|
|
22
|
+
Time: 21.473 s
|
|
23
23
|
Ran all test suites.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.59",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"node": "18.19.0",
|
|
124
124
|
"yarn": "1.19.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "18aea9c02e0ea27af407d6fd2a490a51dcf4f02d"
|
|
127
127
|
}
|
package/public/icons.svg
CHANGED
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
<symbol id="Stripe" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 34 24"> <path d="M0 3C0 1.34315 1.34315 0 3 0H31C32.6569 0 34 1.34315 34 3V21C34 22.6569 32.6569 24 31 24H3C1.34315 24 0 22.6569 0 21V3Z" fill="white" /> <rect x="0.5" y="0.5" width="33" height="23" rx="2.5" stroke="#fff" /> <path fillRule="evenodd" clipRule="evenodd" d="M18.2682 8.14192L16.541 8.52349V7.08202L18.2682 6.70752V8.14192ZM21.8599 8.94038C21.1856 8.94038 20.7521 9.26542 20.5113 9.49153L20.4218 9.05344H18.908V17.2924L20.6282 16.9179L20.6351 14.9183C20.8828 15.102 21.2475 15.3634 21.853 15.3634C23.0847 15.3634 24.2063 14.3459 24.2063 12.106C24.1995 10.0568 23.0641 8.94038 21.8599 8.94038ZM21.4471 13.8089C21.0411 13.8089 20.8002 13.6605 20.6351 13.4768L20.6282 10.8553C20.8071 10.6504 21.0548 10.509 21.4471 10.509C22.0732 10.509 22.5067 11.2298 22.5067 12.1554C22.5067 13.1023 22.0801 13.8089 21.4471 13.8089ZM29.6286 12.1766C29.6286 10.3677 28.7754 8.94038 27.1446 8.94038C25.5069 8.94038 24.5161 10.3677 24.5161 12.1625C24.5161 14.2894 25.6858 15.3634 27.3648 15.3634C28.1836 15.3634 28.8029 15.1726 29.2708 14.9041V13.4909C28.8029 13.7312 28.2662 13.8795 27.585 13.8795C26.9175 13.8795 26.3257 13.6393 26.2501 12.8055H29.6148C29.6148 12.7666 29.6173 12.6782 29.6202 12.5763L29.6202 12.5761C29.624 12.4377 29.6286 12.2743 29.6286 12.1766ZM26.2294 11.5054C26.2294 10.7069 26.7042 10.3748 27.1377 10.3748C27.5574 10.3748 28.0047 10.7069 28.0047 11.5054H26.2294ZM16.5409 9.06052H18.2681V15.2433H16.5409V9.06052ZM14.58 9.06051L14.6901 9.5834C15.0961 8.82026 15.9012 8.97572 16.1214 9.06051V10.6857C15.908 10.608 15.22 10.509 14.814 11.0531V15.2433H13.0937V9.06051H14.58ZM11.2495 7.52717L9.57056 7.8946L9.56368 13.5545C9.56368 14.6003 10.3275 15.3705 11.3459 15.3705C11.9101 15.3705 12.323 15.2645 12.55 15.1373V13.7029C12.3298 13.7947 11.2426 14.1198 11.2426 13.074V10.5656H12.55V9.0605H11.2426L11.2495 7.52717ZM7.18295 10.4737C6.81826 10.4737 6.59807 10.5797 6.59807 10.8553C6.59807 11.1562 6.97702 11.2885 7.44715 11.4527C8.21358 11.7204 9.22234 12.0728 9.2266 13.3779C9.2266 14.6427 8.24262 15.3705 6.81138 15.3705C6.21961 15.3705 5.5728 15.2504 4.93287 14.9677V13.286C5.51087 13.611 6.24026 13.8513 6.81138 13.8513C7.19671 13.8513 7.47195 13.7453 7.47195 13.4203C7.47195 13.087 7.06116 12.9346 6.56522 12.7507C5.80994 12.4706 4.85718 12.1173 4.85718 10.9401C4.85718 9.6894 5.78611 8.9404 7.18295 8.9404C7.75407 8.9404 8.31831 9.03225 8.88944 9.26543V10.926C8.36648 10.6362 7.70591 10.4737 7.18295 10.4737Z" fill="#6461FC" /> </symbol>
|
|
55
55
|
<symbol id="Tag" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 256 256"><path fill="none" d="M0 0h256v256H0z"/><path d="M122.7 25.9 42 42l-16.1 80.7a8 8 0 0 0 2.2 7.2l104.4 104.4a7.9 7.9 0 0 0 11.3 0l90.5-90.5a7.9 7.9 0 0 0 0-11.3L129.9 28.1a8 8 0 0 0-7.2-2.2Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><circle cx="84" cy="84" r="12" fill="currentColor"/></symbol>
|
|
56
56
|
<symbol id="Truck" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect><path d="M240,120H176V80h42.58374a8,8,0,0,1,7.42781,5.02887Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><line x1="16" y1="144" x2="176" y2="144" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><circle cx="188" cy="192" r="24" fill="none" stroke="currentColor" stroke-miterlimit="10"></circle><circle cx="68" cy="192" r="24" fill="none" stroke="currentColor" stroke-miterlimit="10"></circle><line x1="164" y1="192" x2="92" y2="192" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><path d="M44,192H24a8,8,0,0,1-8-8V72a8,8,0,0,1,8-8H176V171.21508" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M176,171.21508V120h64v64a8,8,0,0,1-8,8H212" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></symbol>
|
|
57
|
-
<symbol id="Twitter" xmlns="http://www.w3.org/2000/svg" fill="
|
|
57
|
+
<symbol id="Twitter" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 32 32">
|
|
58
|
+
<path d="M3.97204 3.72754L14.0811 17.2655L3.9082 28.2725H6.19772L15.1041 18.6358L22.3002 28.2725H30.0915L19.4136 13.973L28.8825 3.72754H26.593L18.3907 12.6028L11.7633 3.72754H3.97204ZM7.33894 5.41665H10.9183L26.7241 26.5831H23.1447L7.33894 5.41665Z" fill="currentColor"/>
|
|
59
|
+
</symbol>
|
|
58
60
|
<symbol id="User" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect><circle cx="128" cy="96" r="64" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></circle><path d="M30.989,215.99064a112.03731,112.03731,0,0,1,194.02311.002" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></symbol>
|
|
59
61
|
<symbol id="Visa" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 34 24"> <path d="M0 3C0 1.34315 1.34315 0 3 0H31C32.6569 0 34 1.34315 34 3V21C34 22.6569 32.6569 24 31 24H3C1.34315 24 0 22.6569 0 21V3Z" fill="white" /> <rect x="0.5" y="0.5" width="33" height="23" rx="2.5" stroke="#fff" /> <path fillRule="evenodd" clipRule="evenodd" d="M10.7503 15.8582H8.69056L7.146 9.79237C7.07269 9.51334 6.91703 9.26666 6.68806 9.1504C6.11664 8.85823 5.48696 8.6257 4.80005 8.50843V8.27489H8.11813C8.57607 8.27489 8.91953 8.6257 8.97677 9.03313L9.77817 13.4086L11.8369 8.27489H13.8394L10.7503 15.8582ZM14.9843 15.8582H13.039L14.6408 8.27489H16.5861L14.9843 15.8582ZM19.1028 10.3757C19.16 9.96728 19.5035 9.73374 19.9042 9.73374C20.5338 9.6751 21.2197 9.79238 21.7922 10.0835L22.1356 8.45081C21.5632 8.21727 20.9335 8.1 20.3621 8.1C18.4741 8.1 17.1003 9.15041 17.1003 10.6082C17.1003 11.7173 18.0734 12.2996 18.7603 12.6504C19.5035 13.0002 19.7897 13.2337 19.7324 13.5835C19.7324 14.1082 19.16 14.3418 18.5886 14.3418C17.9017 14.3418 17.2147 14.1669 16.5861 13.8747L16.2426 15.5085C16.9295 15.7996 17.6727 15.9169 18.3596 15.9169C20.4766 15.9745 21.7922 14.9251 21.7922 13.35C21.7922 11.3665 19.1028 11.2502 19.1028 10.3757ZM28.6 15.8582L27.0555 8.27489H25.3965C25.053 8.27489 24.7095 8.50843 24.5951 8.85823L21.7349 15.8582H23.7374L24.1371 14.7502H26.5976L26.8265 15.8582H28.6ZM25.6827 10.3171L26.2541 13.1751H24.6523L25.6827 10.3171Z" fill="#172B85" /> </symbol>
|
|
60
62
|
<symbol id="X" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"></rect><line x1="200" y1="56" x2="56" y2="200" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line><line x1="200" y1="200" x2="56" y2="56" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></line></symbol>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProductTitle as UIProductTitle,
|
|
3
|
+
DiscountBadge as UIDiscountBadge,
|
|
4
|
+
BuyButton as UIBuyButton,
|
|
5
|
+
SkuSelector as UISkuSelector,
|
|
6
|
+
ShippingSimulation as UIShippingSimulation,
|
|
7
|
+
Icon as UIIcon,
|
|
8
|
+
Price as UIPrice,
|
|
9
|
+
QuantitySelector as UIQuantitySelector,
|
|
10
|
+
ImageGalleryViewer as UIImageGalleryViewer,
|
|
11
|
+
ImageGallery as UIImageGallery,
|
|
12
|
+
} from '@faststore/ui'
|
|
13
|
+
|
|
14
|
+
import LocalImageGallery from 'src/components/ui/ImageGallery'
|
|
15
|
+
import LocalShippingSimulation from 'src/components/ui/ShippingSimulation/ShippingSimulation'
|
|
16
|
+
import { Image } from 'src/components/ui/Image'
|
|
17
|
+
import LocalNotAvailableButton from 'src/components/product/NotAvailableButton'
|
|
18
|
+
|
|
19
|
+
export const ProductDetailsDefaultComponents = {
|
|
20
|
+
ProductTitle: UIProductTitle,
|
|
21
|
+
DiscountBadge: UIDiscountBadge,
|
|
22
|
+
BuyButton: UIBuyButton,
|
|
23
|
+
Icon: UIIcon,
|
|
24
|
+
Price: UIPrice,
|
|
25
|
+
QuantitySelector: UIQuantitySelector,
|
|
26
|
+
SkuSelector: UISkuSelector,
|
|
27
|
+
ShippingSimulation: UIShippingSimulation,
|
|
28
|
+
ImageGallery: UIImageGallery,
|
|
29
|
+
ImageGalleryViewer: UIImageGalleryViewer,
|
|
30
|
+
__experimentalImageGalleryImage: Image,
|
|
31
|
+
__experimentalImageGallery: LocalImageGallery,
|
|
32
|
+
__experimentalShippingSimulation: LocalShippingSimulation,
|
|
33
|
+
__experimentalNotAvailableButton: LocalNotAvailableButton,
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { override } from 'src/customizations/src/components/overrides/ProductDetails'
|
|
2
|
+
import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection'
|
|
3
|
+
import type { SectionOverrideDefinition } from 'src/typings/overridesDefinition'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This component exists to support overrides 1.0
|
|
7
|
+
*
|
|
8
|
+
* This allows users to override the default ProductDetails section present in the Headless CMS
|
|
9
|
+
*/
|
|
10
|
+
export const OverriddenDefaultProductDetails = getOverriddenSection(
|
|
11
|
+
override as SectionOverrideDefinition<'ProductDetails'>
|
|
12
|
+
)
|
|
@@ -14,15 +14,8 @@ import { ProductDetailsSettings } from 'src/components/ui/ProductDetails'
|
|
|
14
14
|
|
|
15
15
|
import styles from './section.module.scss'
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
DiscountBadge,
|
|
19
|
-
ProductTitle,
|
|
20
|
-
__experimentalImageGallery as ImageGallery,
|
|
21
|
-
__experimentalShippingSimulation as ShippingSimulation,
|
|
22
|
-
__experimentalNotAvailableButton as NotAvailableButton,
|
|
23
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
24
|
-
|
|
25
17
|
import { usePDP } from 'src/sdk/overrides/PageProvider'
|
|
18
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
26
19
|
|
|
27
20
|
export interface ProductDetailsProps {
|
|
28
21
|
productTitle: {
|
|
@@ -61,35 +54,29 @@ export interface ProductDetailsProps {
|
|
|
61
54
|
function ProductDetails({
|
|
62
55
|
productTitle: {
|
|
63
56
|
refNumber: showRefNumber,
|
|
64
|
-
discountBadge: {
|
|
65
|
-
showDiscountBadge,
|
|
66
|
-
size: discountBadgeSize = DiscountBadge.props.size,
|
|
67
|
-
},
|
|
57
|
+
discountBadge: { showDiscountBadge, size: discountBadgeSize },
|
|
68
58
|
},
|
|
69
59
|
buyButton: { icon: buyButtonIcon, title: buyButtonTitle },
|
|
70
60
|
shippingSimulator: {
|
|
71
|
-
title: shippingSimulatorTitle
|
|
72
|
-
inputLabel: shippingSimulatorInputLabel
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
shippingSimulatorOptionsTableTitle = ShippingSimulation.props
|
|
76
|
-
.optionsLabel,
|
|
77
|
-
link: {
|
|
78
|
-
to: shippingSimulatorLinkUrl = ShippingSimulation.props
|
|
79
|
-
.idkPostalCodeLinkProps?.href,
|
|
80
|
-
text: shippingSimulatorLinkText = ShippingSimulation.props
|
|
81
|
-
.idkPostalCodeLinkProps?.children,
|
|
82
|
-
},
|
|
61
|
+
title: shippingSimulatorTitle,
|
|
62
|
+
inputLabel: shippingSimulatorInputLabel,
|
|
63
|
+
shippingOptionsTableTitle: shippingSimulatorOptionsTableTitle,
|
|
64
|
+
link: { to: shippingSimulatorLinkUrl, text: shippingSimulatorLinkText },
|
|
83
65
|
},
|
|
84
66
|
productDescription: {
|
|
85
67
|
title: productDescriptionDetailsTitle,
|
|
86
68
|
initiallyExpanded: productDescriptionInitiallyExpanded,
|
|
87
69
|
displayDescription: shouldDisplayProductDescription,
|
|
88
70
|
},
|
|
89
|
-
notAvailableButton: {
|
|
90
|
-
title: notAvailableButtonTitle = NotAvailableButton.props.title,
|
|
91
|
-
},
|
|
71
|
+
notAvailableButton: { title: notAvailableButtonTitle },
|
|
92
72
|
}: ProductDetailsProps) {
|
|
73
|
+
const {
|
|
74
|
+
DiscountBadge,
|
|
75
|
+
ProductTitle,
|
|
76
|
+
__experimentalImageGallery: ImageGallery,
|
|
77
|
+
__experimentalShippingSimulation: ShippingSimulation,
|
|
78
|
+
__experimentalNotAvailableButton: NotAvailableButton,
|
|
79
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
93
80
|
const { currency } = useSession()
|
|
94
81
|
const [quantity, setQuantity] = useState(1)
|
|
95
82
|
const context = usePDP()
|
|
@@ -168,7 +155,7 @@ function ProductDetails({
|
|
|
168
155
|
showDiscountBadge && (
|
|
169
156
|
<DiscountBadge.Component
|
|
170
157
|
{...DiscountBadge.props}
|
|
171
|
-
size={discountBadgeSize}
|
|
158
|
+
size={discountBadgeSize ?? DiscountBadge.props.size}
|
|
172
159
|
// Dynamic props shouldn't be overridable
|
|
173
160
|
// This decision can be reviewed later if needed
|
|
174
161
|
listPrice={listPrice}
|
|
@@ -196,7 +183,9 @@ function ProductDetails({
|
|
|
196
183
|
quantity={quantity}
|
|
197
184
|
setQuantity={setQuantity}
|
|
198
185
|
buyButtonIcon={buyButtonIcon}
|
|
199
|
-
notAvailableButtonTitle={
|
|
186
|
+
notAvailableButtonTitle={
|
|
187
|
+
notAvailableButtonTitle ?? NotAvailableButton.props.title
|
|
188
|
+
}
|
|
200
189
|
/>
|
|
201
190
|
</section>
|
|
202
191
|
|
|
@@ -208,17 +197,27 @@ function ProductDetails({
|
|
|
208
197
|
{...ShippingSimulation.props}
|
|
209
198
|
idkPostalCodeLinkProps={{
|
|
210
199
|
...ShippingSimulation.props.idkPostalCodeLinkProps,
|
|
211
|
-
href:
|
|
212
|
-
|
|
200
|
+
href:
|
|
201
|
+
shippingSimulatorLinkUrl ??
|
|
202
|
+
ShippingSimulation.props.idkPostalCodeLinkProps?.href,
|
|
203
|
+
children:
|
|
204
|
+
shippingSimulatorLinkText ??
|
|
205
|
+
ShippingSimulation.props.idkPostalCodeLinkProps?.children,
|
|
213
206
|
}}
|
|
214
207
|
productShippingInfo={{
|
|
215
208
|
id,
|
|
216
209
|
quantity,
|
|
217
210
|
seller: seller.identifier,
|
|
218
211
|
}}
|
|
219
|
-
title={shippingSimulatorTitle}
|
|
220
|
-
inputLabel={
|
|
221
|
-
|
|
212
|
+
title={shippingSimulatorTitle ?? ShippingSimulation.props.title}
|
|
213
|
+
inputLabel={
|
|
214
|
+
shippingSimulatorInputLabel ??
|
|
215
|
+
ShippingSimulation.props.inputLabel
|
|
216
|
+
}
|
|
217
|
+
optionsLabel={
|
|
218
|
+
shippingSimulatorOptionsTableTitle ??
|
|
219
|
+
ShippingSimulation.props.optionsLabel
|
|
220
|
+
}
|
|
222
221
|
/>
|
|
223
222
|
)}
|
|
224
223
|
</section>
|
|
@@ -2,15 +2,13 @@ import { useEffect, useState } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { useRouter } from 'next/router'
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
ImageGallery as ImageGalleryWrapper,
|
|
7
|
-
ImageGalleryViewer,
|
|
8
|
-
__experimentalImageGalleryImage as Image,
|
|
9
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
10
|
-
|
|
11
5
|
import type { ImageGalleryProps as UIImageGalleryProps } from '@faststore/ui'
|
|
6
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
12
7
|
|
|
13
8
|
const ImageComponent = ({ url, alternateName }) => {
|
|
9
|
+
const { __experimentalImageGalleryImage: Image } =
|
|
10
|
+
useOverrideComponents<'ProductDetails'>()
|
|
11
|
+
|
|
14
12
|
return (
|
|
15
13
|
<Image.Component src={url} alt={alternateName} width={68} height={68} />
|
|
16
14
|
)
|
|
@@ -21,6 +19,12 @@ export interface ImageGalleryProps {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
const ImageGallery = ({ images, ...otherProps }: ImageGalleryProps) => {
|
|
22
|
+
const {
|
|
23
|
+
ImageGallery: ImageGalleryWrapper,
|
|
24
|
+
ImageGalleryViewer,
|
|
25
|
+
__experimentalImageGalleryImage: Image,
|
|
26
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
27
|
+
|
|
24
28
|
const [selectedImageIdx, setSelectedImageIdx] = useState(0)
|
|
25
29
|
const currentImage = images[selectedImageIdx] ?? images[0]
|
|
26
30
|
const dynamicRoute = useRouter().asPath
|
|
@@ -9,13 +9,7 @@ import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
|
|
|
9
9
|
import Selectors from 'src/components/ui/SkuSelector'
|
|
10
10
|
import AddToCartLoadingSkeleton from './AddToCartLoadingSkeleton'
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
BuyButton,
|
|
14
|
-
Icon,
|
|
15
|
-
Price,
|
|
16
|
-
QuantitySelector,
|
|
17
|
-
__experimentalNotAvailableButton as NotAvailableButton,
|
|
18
|
-
} from 'src/components/sections/ProductDetails/Overrides'
|
|
12
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
19
13
|
|
|
20
14
|
interface ProductDetailsSettingsProps {
|
|
21
15
|
product: ProductDetailsFragment_ProductFragment
|
|
@@ -36,12 +30,17 @@ function ProductDetailsSettings({
|
|
|
36
30
|
isValidating,
|
|
37
31
|
quantity,
|
|
38
32
|
setQuantity,
|
|
39
|
-
buyButtonIcon: {
|
|
40
|
-
icon: buyButtonIconName = Icon.props.name,
|
|
41
|
-
alt: buyButtonIconAlt = Icon.props['aria-label'],
|
|
42
|
-
},
|
|
33
|
+
buyButtonIcon: { icon: buyButtonIconName, alt: buyButtonIconAlt },
|
|
43
34
|
notAvailableButtonTitle,
|
|
44
35
|
}: ProductDetailsSettingsProps) {
|
|
36
|
+
const {
|
|
37
|
+
BuyButton,
|
|
38
|
+
Icon,
|
|
39
|
+
Price,
|
|
40
|
+
QuantitySelector,
|
|
41
|
+
__experimentalNotAvailableButton: NotAvailableButton,
|
|
42
|
+
} = useOverrideComponents<'ProductDetails'>()
|
|
43
|
+
|
|
45
44
|
const {
|
|
46
45
|
id,
|
|
47
46
|
sku,
|
|
@@ -96,8 +95,8 @@ function ProductDetailsSettings({
|
|
|
96
95
|
icon={
|
|
97
96
|
<Icon.Component
|
|
98
97
|
{...Icon.props}
|
|
99
|
-
name={buyButtonIconName}
|
|
100
|
-
aria-label={buyButtonIconAlt}
|
|
98
|
+
name={buyButtonIconName ?? Icon.props.name}
|
|
99
|
+
aria-label={buyButtonIconAlt ?? Icon.props['aria-label']}
|
|
101
100
|
/>
|
|
102
101
|
}
|
|
103
102
|
{...buyProps}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ShippingSimulationProps as UIShippingSimulationProps } from '@faststore/ui'
|
|
2
2
|
|
|
3
|
-
import { useSession } from 'src/sdk/session'
|
|
4
3
|
import { useShippingSimulation } from 'src/sdk/shipping/useShippingSimulation'
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
7
6
|
|
|
8
7
|
type ShippingSimulationOptionalProps =
|
|
9
8
|
| 'title'
|
|
@@ -31,6 +30,9 @@ export default function ShippingSimulation({
|
|
|
31
30
|
idkPostalCodeLinkProps,
|
|
32
31
|
...otherProps
|
|
33
32
|
}: ShippingSimulationProps) {
|
|
33
|
+
const { ShippingSimulation: ShippingSimulationWrapper } =
|
|
34
|
+
useOverrideComponents<'ProductDetails'>()
|
|
35
|
+
|
|
34
36
|
const {
|
|
35
37
|
input,
|
|
36
38
|
shippingSimulation,
|
|
@@ -4,7 +4,7 @@ import { SkuSelectorProps } from '@faststore/ui'
|
|
|
4
4
|
import NextLink from 'next/link'
|
|
5
5
|
import { Image } from '../Image'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { useOverrideComponents } from 'src/sdk/overrides/OverrideContext'
|
|
8
8
|
|
|
9
9
|
export type SkuVariantsByName = Record<
|
|
10
10
|
string,
|
|
@@ -38,6 +38,8 @@ function Selectors({
|
|
|
38
38
|
availableVariations,
|
|
39
39
|
...otherProps
|
|
40
40
|
}: Props) {
|
|
41
|
+
const { SkuSelector } = useOverrideComponents<'ProductDetails'>()
|
|
42
|
+
|
|
41
43
|
return (
|
|
42
44
|
<section {...otherProps}>
|
|
43
45
|
{availableVariations &&
|
package/src/pages/[slug]/p.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import BannerNewsletter from 'src/components/sections/BannerNewsletter/BannerNew
|
|
|
15
15
|
import { OverriddenDefaultBannerText as BannerText } from 'src/components/sections/BannerText/OverriddenDefaultBannerText'
|
|
16
16
|
import Breadcrumb from 'src/components/sections/Breadcrumb'
|
|
17
17
|
import { OverriddenDefaultCrossSellingShelf as CrossSellingShelf } from 'src/components/sections/CrossSellingShelf/OverriddenDefaultCrossSellingShelf'
|
|
18
|
-
import ProductDetails from 'src/components/sections/ProductDetails'
|
|
18
|
+
import { OverriddenDefaultProductDetails as ProductDetails } from 'src/components/sections/ProductDetails/OverriddenDefaultProductDetails'
|
|
19
19
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
20
20
|
import { useSession } from 'src/sdk/session'
|
|
21
21
|
import { mark } from 'src/sdk/tests/mark'
|
|
@@ -3,6 +3,7 @@ import BannerText from '../../components/sections/BannerText'
|
|
|
3
3
|
import Hero from '../../components/sections/Hero'
|
|
4
4
|
import ProductShelf from '../../components/sections/ProductShelf'
|
|
5
5
|
import CrossSellingShelf from '../../components/sections/CrossSellingShelf'
|
|
6
|
+
import ProductDetails from '../../components/sections/ProductDetails'
|
|
6
7
|
|
|
7
8
|
import type { DefaultSectionComponentsDefinitions } from '../../typings/overridesDefinition'
|
|
8
9
|
import type { SectionsOverrides } from '../../typings/overrides'
|
|
@@ -11,12 +12,14 @@ import { BannerTextDefaultComponents } from '../../components/sections/BannerTex
|
|
|
11
12
|
import { CrossSellingShelfDefaultComponents } from 'src/components/sections/CrossSellingShelf/DefaultComponents'
|
|
12
13
|
import { HeroDefaultComponents } from '../../components/sections/Hero/DefaultComponents'
|
|
13
14
|
import { ProductShelfDefaultComponents } from '../../components/sections/ProductShelf/DefaultComponents'
|
|
15
|
+
import { ProductDetailsDefaultComponents } from '../../components/sections/ProductDetails/DefaultComponents'
|
|
14
16
|
|
|
15
17
|
export const Sections = {
|
|
16
18
|
Alert,
|
|
17
19
|
BannerText,
|
|
18
20
|
CrossSellingShelf,
|
|
19
21
|
Hero,
|
|
22
|
+
ProductDetails,
|
|
20
23
|
ProductShelf,
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -28,7 +31,8 @@ export const DefaultComponents: Partial<
|
|
|
28
31
|
> = {
|
|
29
32
|
Alert: AlertDefaultComponents,
|
|
30
33
|
BannerText: BannerTextDefaultComponents,
|
|
34
|
+
CrossSellingShelf: CrossSellingShelfDefaultComponents,
|
|
31
35
|
Hero: HeroDefaultComponents,
|
|
36
|
+
ProductDetails: ProductDetailsDefaultComponents,
|
|
32
37
|
ProductShelf: ProductShelfDefaultComponents,
|
|
33
|
-
CrossSellingShelf: CrossSellingShelfDefaultComponents,
|
|
34
38
|
}
|
package/src/typings/overrides.ts
CHANGED
|
@@ -49,7 +49,7 @@ export type SectionOverride = {
|
|
|
49
49
|
/** TODO: every use of this type should be replaced by SectionsOverrides after all sections are supported */
|
|
50
50
|
export type SupportedSectionsOverridesV2 = Pick<
|
|
51
51
|
SectionsOverrides,
|
|
52
|
-
'Alert' | 'BannerText' | 'CrossSellingShelf' | 'Hero' | 'ProductShelf'
|
|
52
|
+
'Alert' | 'BannerText' | 'CrossSellingShelf' | 'Hero' | 'ProductShelf' | 'ProductDetails'
|
|
53
53
|
>
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 693;
|
|
3
|
-
exports.ids = [693];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 6693:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7041);
|
|
15
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2614);
|
|
16
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2256);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const QuantitySelector = ({ max, min = 1, initial, disabled = false, onChange, testId = 'fs-quantity-selector', ...otherProps }) => {
|
|
20
|
-
const [quantity, setQuantity] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initial ?? min);
|
|
21
|
-
const isLeftDisabled = quantity === min;
|
|
22
|
-
const isRightDisabled = quantity === max;
|
|
23
|
-
const changeQuantity = (increaseValue) => {
|
|
24
|
-
const quantityValue = validateQuantityBounds(quantity + increaseValue);
|
|
25
|
-
onChange?.(quantityValue);
|
|
26
|
-
setQuantity(quantityValue);
|
|
27
|
-
};
|
|
28
|
-
const increase = () => changeQuantity(1);
|
|
29
|
-
const decrease = () => changeQuantity(-1);
|
|
30
|
-
function validateQuantityBounds(n) {
|
|
31
|
-
const maxValue = min ? Math.max(n, min) : n;
|
|
32
|
-
return max ? Math.min(maxValue, max) : maxValue;
|
|
33
|
-
}
|
|
34
|
-
function validateInput(e) {
|
|
35
|
-
const val = e.currentTarget.value;
|
|
36
|
-
if (!Number.isNaN(Number(val))) {
|
|
37
|
-
setQuantity(() => {
|
|
38
|
-
const quantityValue = validateQuantityBounds(Number(val));
|
|
39
|
-
onChange?.(quantityValue);
|
|
40
|
-
return quantityValue;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
45
|
-
initial && setQuantity(initial);
|
|
46
|
-
}, [initial]);
|
|
47
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-quantity-selector": disabled ? 'disabled' : 'true', "data-testid": testId, ...otherProps },
|
|
48
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "left", icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Minus", width: 16, height: 16, weight: "bold" }), "aria-label": "Decrement Quantity", "aria-controls": "quantity-selector-input", disabled: isLeftDisabled || disabled, onClick: decrease, testId: `${testId}-left-button`, size: "small" }),
|
|
49
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { "data-quantity-selector-input": true, id: "quantity-selector-input", "aria-label": "Quantity", value: quantity, onChange: validateInput, disabled: disabled }),
|
|
50
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { "data-quantity-selector-button": "right", "aria-controls": "quantity-selector-input", "aria-label": "Increment Quantity", disabled: isRightDisabled || disabled, icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { name: "Plus", width: 16, height: 16, weight: "bold" }), onClick: increase, testId: `${testId}-right-button`, size: "small" })));
|
|
51
|
-
};
|
|
52
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (QuantitySelector);
|
|
53
|
-
//# sourceMappingURL=QuantitySelector.js.map
|
|
54
|
-
|
|
55
|
-
/***/ })
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.id = 779;
|
|
3
|
-
exports.ids = [779];
|
|
4
|
-
exports.modules = {
|
|
5
|
-
|
|
6
|
-
/***/ 1953:
|
|
7
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
8
|
-
|
|
9
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
-
/* harmony export */ });
|
|
12
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
13
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
-
|
|
15
|
-
const Label = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function Label({ testId = 'fs-label', children, ...otherProps }, ref) {
|
|
16
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", { ref: ref, "data-fs-label": true, "data-testid": testId, ...otherProps }, children));
|
|
17
|
-
});
|
|
18
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Label);
|
|
19
|
-
//# sourceMappingURL=Label.js.map
|
|
20
|
-
|
|
21
|
-
/***/ }),
|
|
22
|
-
|
|
23
|
-
/***/ 3779:
|
|
24
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
-
|
|
26
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
28
|
-
/* harmony export */ });
|
|
29
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
|
|
30
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
31
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2256);
|
|
32
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1953);
|
|
33
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7041);
|
|
34
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2614);
|
|
35
|
-
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3339);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const InputField = ({ id, label, type = 'text', error, displayClearButton, actionable, buttonActionText = 'Apply', onSubmit, onClear, placeholder = ' ', // initializes with an empty space to style float label using `placeholder-shown`
|
|
39
|
-
inputRef, disabled, value, testId = 'fs-input-field', ...otherProps }) => {
|
|
40
|
-
const shouldDisplayError = !disabled && error && error !== '';
|
|
41
|
-
const shouldDisplayButton = actionable && !disabled && value !== '';
|
|
42
|
-
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { "data-fs-input-field": true, "data-fs-input-field-actionable": actionable, "data-fs-input-field-error": error && error !== '', "data-testid": testId },
|
|
43
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, { id: id, type: type, value: value, ref: inputRef, disabled: disabled, placeholder: placeholder, ...otherProps }),
|
|
44
|
-
react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, { htmlFor: id }, label),
|
|
45
|
-
shouldDisplayButton &&
|
|
46
|
-
(displayClearButton || error ? (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, { size: "small", "aria-label": "Clear Field", icon: react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, { name: "XCircle" }), onClick: () => {
|
|
47
|
-
onClear?.();
|
|
48
|
-
inputRef?.current?.focus();
|
|
49
|
-
} })) : (react__WEBPACK_IMPORTED_MODULE_0___default().createElement(___WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, { variant: "tertiary", size: "small", onClick: onSubmit }, buttonActionText))),
|
|
50
|
-
shouldDisplayError && (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", { "data-fs-input-field-error-message": true }, error))));
|
|
51
|
-
};
|
|
52
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InputField);
|
|
53
|
-
//# sourceMappingURL=InputField.js.map
|
|
54
|
-
|
|
55
|
-
/***/ })
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
;
|