@ikas/code-components-mcp 1.4.0-beta.16 → 1.4.0-beta.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/data/framework.json +103 -16
  2. package/data/migration.json +10 -4
  3. package/data/section-templates/account-info-section/children/AccountFavorites/ikas-config-snippet.json +13 -0
  4. package/data/section-templates/account-info-section/ikas-config-snippet.json +19 -0
  5. package/data/section-templates/add-to-cart/ikas-config-snippet.json +17 -0
  6. package/data/section-templates/add-to-cart/index.tsx +16 -2
  7. package/data/section-templates/add-to-cart/sub-components/QuantitySelector/index.tsx +11 -3
  8. package/data/section-templates/add-to-cart/utils/cartLimits.ts +23 -0
  9. package/data/section-templates/blog-home-section/ikas-config-snippet.json +2 -0
  10. package/data/section-templates/blog-post-section/ikas-config-snippet.json +2 -0
  11. package/data/section-templates/bundle-products/hooks/useBundleProducts.ts +7 -6
  12. package/data/section-templates/bundle-products/ikas-config-snippet.json +20 -0
  13. package/data/section-templates/cart-section/sub-components/CartItem/index.tsx +57 -24
  14. package/data/section-templates/cart-section/sub-components/CartItem/styles.css +14 -0
  15. package/data/section-templates/cart-section/sub-components/QuantitySelector/index.tsx +11 -3
  16. package/data/section-templates/category-images-section/children/CategoryImageItem/ikas-config-snippet.json +4 -0
  17. package/data/section-templates/category-images-section/ikas-config-snippet.json +15 -0
  18. package/data/section-templates/category-list-section/children/CardProductName/ikas-config-snippet.json +2 -1
  19. package/data/section-templates/category-list-section/ikas-config-snippet.json +21 -0
  20. package/data/section-templates/component-renderer/ikas-config-snippet.json +13 -0
  21. package/data/section-templates/favorites/ikas-config-snippet.json +18 -1
  22. package/data/section-templates/features-section/ikas-config-snippet.json +13 -0
  23. package/data/section-templates/footer-section/ikas-config-snippet.json +15 -0
  24. package/data/section-templates/header-section/children/Announcements/ikas-config-snippet.json +7 -0
  25. package/data/section-templates/header-section/children/CookieBar/ikas-config-snippet.json +3 -0
  26. package/data/section-templates/header-section/children/Navbar/ikas-config-snippet.json +27 -0
  27. package/data/section-templates/header-section/ikas-config-snippet.json +13 -0
  28. package/data/section-templates/header-section/sub-components/CartItem/index.tsx +57 -24
  29. package/data/section-templates/header-section/sub-components/CartItem/styles.css +14 -0
  30. package/data/section-templates/header-section/sub-components/QuantitySelector/index.tsx +11 -3
  31. package/data/section-templates/hero-slider-section/children/HeroSliderItem/ikas-config-snippet.json +18 -0
  32. package/data/section-templates/hero-slider-section/ikas-config-snippet.json +13 -0
  33. package/data/section-templates/image-handling/ikas-config-snippet.json +53 -0
  34. package/data/section-templates/login-section/ikas-config-snippet.json +2 -0
  35. package/data/section-templates/navigation/ikas-config-snippet.json +27 -0
  36. package/data/section-templates/navigation/sub-components/CartItem/index.tsx +57 -24
  37. package/data/section-templates/navigation/sub-components/CartItem/styles.css +14 -0
  38. package/data/section-templates/navigation/sub-components/QuantitySelector/index.tsx +11 -3
  39. package/data/section-templates/product-detail-section/children/ProductDetailAddToCart/ikas-config-snippet.json +17 -0
  40. package/data/section-templates/product-detail-section/children/ProductDetailAddToCart/index.tsx +16 -2
  41. package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/components/BackInStockForm/index.tsx +92 -0
  42. package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/ikas-config-snippet.json +175 -0
  43. package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/index.tsx +141 -0
  44. package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/styles.css +47 -0
  45. package/data/section-templates/product-detail-section/children/ProductDetailBackInStock/types.ts +25 -0
  46. package/data/section-templates/product-detail-section/children/ProductDetailBundleFurniture/ikas-config-snippet.json +18 -0
  47. package/data/section-templates/product-detail-section/children/ProductDetailBundleProduct/ikas-config-snippet.json +20 -0
  48. package/data/section-templates/product-detail-section/children/ProductDetailDescription/ikas-config-snippet.json +27 -0
  49. package/data/section-templates/product-detail-section/children/ProductDetailFeatures/ikas-config-snippet.json +29 -0
  50. package/data/section-templates/product-detail-section/children/ProductDetailNameFavorite/ikas-config-snippet.json +18 -1
  51. package/data/section-templates/product-detail-section/children/ProductDetailOffer/ikas-config-snippet.json +20 -0
  52. package/data/section-templates/product-detail-section/children/ProductDetailOptionSet/ikas-config-snippet.json +16 -0
  53. package/data/section-templates/product-detail-section/children/ProductDetailPrices/ikas-config-snippet.json +16 -0
  54. package/data/section-templates/product-detail-section/children/ProductDetailProductGroup/ikas-config-snippet.json +16 -0
  55. package/data/section-templates/product-detail-section/children/ProductDetailSku/ikas-config-snippet.json +16 -0
  56. package/data/section-templates/product-detail-section/children/ProductDetailVariant/ikas-config-snippet.json +17 -0
  57. package/data/section-templates/product-detail-section/hooks/useBundleProducts.ts +7 -6
  58. package/data/section-templates/product-detail-section/ikas-config-snippet.json +53 -0
  59. package/data/section-templates/product-detail-section/sub-components/Modal/index.tsx +120 -0
  60. package/data/section-templates/product-detail-section/sub-components/Modal/styles.css +70 -0
  61. package/data/section-templates/product-detail-section/sub-components/QuantitySelector/index.tsx +11 -3
  62. package/data/section-templates/product-detail-section/utils/cartLimits.ts +23 -0
  63. package/data/section-templates/product-pricing/ikas-config-snippet.json +16 -0
  64. package/data/section-templates/product-slider-section/children/CardProductName/ikas-config-snippet.json +2 -1
  65. package/data/section-templates/product-slider-section/ikas-config-snippet.json +17 -0
  66. package/data/section-templates/register-section/ikas-config-snippet.json +2 -0
  67. package/data/section-templates/variant-selection/ikas-config-snippet.json +17 -0
  68. package/data/storefront-api.json +239 -27
  69. package/data/storefront-types.json +9071 -5740
  70. package/dist/index.js +1242 -28
  71. package/dist/index.js.map +1 -1
  72. package/package.json +1 -1
@@ -10,6 +10,10 @@
10
10
  "displayName": "Top Spacing",
11
11
  "type": "TYPE",
12
12
  "required": false,
13
+ "defaultValue": {
14
+ "value": 0,
15
+ "unit": "px"
16
+ },
13
17
  "groupId": "mobile",
14
18
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
15
19
  },
@@ -18,6 +22,10 @@
18
22
  "displayName": "Bottom Spacing",
19
23
  "type": "TYPE",
20
24
  "required": false,
25
+ "defaultValue": {
26
+ "value": 0,
27
+ "unit": "px"
28
+ },
21
29
  "groupId": "mobile",
22
30
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
23
31
  },
@@ -26,6 +34,10 @@
26
34
  "displayName": "Top Spacing",
27
35
  "type": "TYPE",
28
36
  "required": false,
37
+ "defaultValue": {
38
+ "value": 0,
39
+ "unit": "px"
40
+ },
29
41
  "groupId": "desktop",
30
42
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
31
43
  },
@@ -34,6 +46,10 @@
34
46
  "displayName": "Bottom Spacing",
35
47
  "type": "TYPE",
36
48
  "required": false,
49
+ "defaultValue": {
50
+ "value": 0,
51
+ "unit": "px"
52
+ },
37
53
  "groupId": "desktop",
38
54
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
39
55
  },
@@ -42,6 +58,19 @@
42
58
  "displayName": "Specifications",
43
59
  "type": "COMPONENT_LIST",
44
60
  "required": false,
61
+ "defaultValue": {
62
+ "components": [
63
+ {
64
+ "codeComponentId": "nb34u3yu-product-detail-feature-item"
65
+ },
66
+ {
67
+ "codeComponentId": "nb34u3yu-product-detail-feature-item"
68
+ },
69
+ {
70
+ "codeComponentId": "nb34u3yu-product-detail-feature-item"
71
+ }
72
+ ]
73
+ },
45
74
  "filteredComponentIds": [
46
75
  "<id-of-ProductDetailFeatureItem>"
47
76
  ]
@@ -16,6 +16,10 @@
16
16
  "displayName": "Top Spacing",
17
17
  "type": "TYPE",
18
18
  "required": false,
19
+ "defaultValue": {
20
+ "value": 0,
21
+ "unit": "px"
22
+ },
19
23
  "groupId": "mobile",
20
24
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
21
25
  },
@@ -24,6 +28,10 @@
24
28
  "displayName": "Bottom Spacing",
25
29
  "type": "TYPE",
26
30
  "required": false,
31
+ "defaultValue": {
32
+ "value": 0,
33
+ "unit": "px"
34
+ },
27
35
  "groupId": "mobile",
28
36
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
29
37
  },
@@ -32,6 +40,10 @@
32
40
  "displayName": "Top Spacing",
33
41
  "type": "TYPE",
34
42
  "required": false,
43
+ "defaultValue": {
44
+ "value": 0,
45
+ "unit": "px"
46
+ },
35
47
  "groupId": "desktop",
36
48
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
37
49
  },
@@ -40,6 +52,10 @@
40
52
  "displayName": "Bottom Spacing",
41
53
  "type": "TYPE",
42
54
  "required": false,
55
+ "defaultValue": {
56
+ "value": 0,
57
+ "unit": "px"
58
+ },
43
59
  "groupId": "desktop",
44
60
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
45
61
  },
@@ -47,7 +63,8 @@
47
63
  "name": "hideFavoriteButton",
48
64
  "displayName": "Hide Favorite Button",
49
65
  "type": "BOOLEAN",
50
- "required": false
66
+ "required": false,
67
+ "defaultValue": false
51
68
  }
52
69
  ],
53
70
  "propGroups": [
@@ -16,6 +16,7 @@
16
16
  "displayName": "Auto Select Offers",
17
17
  "type": "BOOLEAN",
18
18
  "required": false,
19
+ "defaultValue": false,
19
20
  "groupId": "layout"
20
21
  },
21
22
  {
@@ -71,6 +72,7 @@
71
72
  "displayName": "Image Aspect Ratio",
72
73
  "type": "ENUM",
73
74
  "required": false,
75
+ "defaultValue": "Square",
74
76
  "groupId": "image",
75
77
  "enumTypeId": "{{ENUM_ID:AspectRatio}}"
76
78
  },
@@ -79,6 +81,7 @@
79
81
  "displayName": "Image Fit",
80
82
  "type": "ENUM",
81
83
  "required": false,
84
+ "defaultValue": "Cover",
82
85
  "groupId": "image",
83
86
  "enumTypeId": "{{ENUM_ID:ObjectFit}}"
84
87
  },
@@ -95,6 +98,7 @@
95
98
  "displayName": "Compact View",
96
99
  "type": "BOOLEAN",
97
100
  "required": false,
101
+ "defaultValue": false,
98
102
  "groupId": "layout"
99
103
  },
100
104
  {
@@ -102,6 +106,10 @@
102
106
  "displayName": "Top Spacing",
103
107
  "type": "TYPE",
104
108
  "required": false,
109
+ "defaultValue": {
110
+ "value": 0,
111
+ "unit": "px"
112
+ },
105
113
  "groupId": "mobile",
106
114
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
107
115
  },
@@ -110,6 +118,10 @@
110
118
  "displayName": "Bottom Spacing",
111
119
  "type": "TYPE",
112
120
  "required": false,
121
+ "defaultValue": {
122
+ "value": 0,
123
+ "unit": "px"
124
+ },
113
125
  "groupId": "mobile",
114
126
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
115
127
  },
@@ -118,6 +130,10 @@
118
130
  "displayName": "Top Spacing",
119
131
  "type": "TYPE",
120
132
  "required": false,
133
+ "defaultValue": {
134
+ "value": 0,
135
+ "unit": "px"
136
+ },
121
137
  "groupId": "desktop",
122
138
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
123
139
  },
@@ -126,6 +142,10 @@
126
142
  "displayName": "Bottom Spacing",
127
143
  "type": "TYPE",
128
144
  "required": false,
145
+ "defaultValue": {
146
+ "value": 0,
147
+ "unit": "px"
148
+ },
129
149
  "groupId": "desktop",
130
150
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
131
151
  },
@@ -80,6 +80,10 @@
80
80
  "displayName": "Top Spacing",
81
81
  "type": "TYPE",
82
82
  "required": false,
83
+ "defaultValue": {
84
+ "value": 0,
85
+ "unit": "px"
86
+ },
83
87
  "groupId": "mobile",
84
88
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
85
89
  },
@@ -88,6 +92,10 @@
88
92
  "displayName": "Bottom Spacing",
89
93
  "type": "TYPE",
90
94
  "required": false,
95
+ "defaultValue": {
96
+ "value": 0,
97
+ "unit": "px"
98
+ },
91
99
  "groupId": "mobile",
92
100
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
93
101
  },
@@ -96,6 +104,10 @@
96
104
  "displayName": "Top Spacing",
97
105
  "type": "TYPE",
98
106
  "required": false,
107
+ "defaultValue": {
108
+ "value": 0,
109
+ "unit": "px"
110
+ },
99
111
  "groupId": "desktop",
100
112
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
101
113
  },
@@ -104,6 +116,10 @@
104
116
  "displayName": "Bottom Spacing",
105
117
  "type": "TYPE",
106
118
  "required": false,
119
+ "defaultValue": {
120
+ "value": 0,
121
+ "unit": "px"
122
+ },
107
123
  "groupId": "desktop",
108
124
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
109
125
  },
@@ -16,6 +16,10 @@
16
16
  "displayName": "Top Spacing",
17
17
  "type": "TYPE",
18
18
  "required": false,
19
+ "defaultValue": {
20
+ "value": 0,
21
+ "unit": "px"
22
+ },
19
23
  "groupId": "mobile",
20
24
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
21
25
  },
@@ -24,6 +28,10 @@
24
28
  "displayName": "Bottom Spacing",
25
29
  "type": "TYPE",
26
30
  "required": false,
31
+ "defaultValue": {
32
+ "value": 0,
33
+ "unit": "px"
34
+ },
27
35
  "groupId": "mobile",
28
36
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
29
37
  },
@@ -32,6 +40,10 @@
32
40
  "displayName": "Top Spacing",
33
41
  "type": "TYPE",
34
42
  "required": false,
43
+ "defaultValue": {
44
+ "value": 0,
45
+ "unit": "px"
46
+ },
35
47
  "groupId": "desktop",
36
48
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
37
49
  },
@@ -40,6 +52,10 @@
40
52
  "displayName": "Bottom Spacing",
41
53
  "type": "TYPE",
42
54
  "required": false,
55
+ "defaultValue": {
56
+ "value": 0,
57
+ "unit": "px"
58
+ },
43
59
  "groupId": "desktop",
44
60
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
45
61
  }
@@ -16,6 +16,10 @@
16
16
  "displayName": "Top Spacing",
17
17
  "type": "TYPE",
18
18
  "required": false,
19
+ "defaultValue": {
20
+ "value": 0,
21
+ "unit": "px"
22
+ },
19
23
  "groupId": "mobile",
20
24
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
21
25
  },
@@ -24,6 +28,10 @@
24
28
  "displayName": "Bottom Spacing",
25
29
  "type": "TYPE",
26
30
  "required": false,
31
+ "defaultValue": {
32
+ "value": 0,
33
+ "unit": "px"
34
+ },
27
35
  "groupId": "mobile",
28
36
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
29
37
  },
@@ -32,6 +40,10 @@
32
40
  "displayName": "Top Spacing",
33
41
  "type": "TYPE",
34
42
  "required": false,
43
+ "defaultValue": {
44
+ "value": 0,
45
+ "unit": "px"
46
+ },
35
47
  "groupId": "desktop",
36
48
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
37
49
  },
@@ -40,6 +52,10 @@
40
52
  "displayName": "Bottom Spacing",
41
53
  "type": "TYPE",
42
54
  "required": false,
55
+ "defaultValue": {
56
+ "value": 0,
57
+ "unit": "px"
58
+ },
43
59
  "groupId": "desktop",
44
60
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
45
61
  }
@@ -24,6 +24,10 @@
24
24
  "displayName": "Top Spacing",
25
25
  "type": "TYPE",
26
26
  "required": false,
27
+ "defaultValue": {
28
+ "value": 0,
29
+ "unit": "px"
30
+ },
27
31
  "groupId": "mobile",
28
32
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
29
33
  },
@@ -32,6 +36,10 @@
32
36
  "displayName": "Bottom Spacing",
33
37
  "type": "TYPE",
34
38
  "required": false,
39
+ "defaultValue": {
40
+ "value": 0,
41
+ "unit": "px"
42
+ },
35
43
  "groupId": "mobile",
36
44
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
37
45
  },
@@ -40,6 +48,10 @@
40
48
  "displayName": "Top Spacing",
41
49
  "type": "TYPE",
42
50
  "required": false,
51
+ "defaultValue": {
52
+ "value": 0,
53
+ "unit": "px"
54
+ },
43
55
  "groupId": "desktop",
44
56
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
45
57
  },
@@ -48,6 +60,10 @@
48
60
  "displayName": "Bottom Spacing",
49
61
  "type": "TYPE",
50
62
  "required": false,
63
+ "defaultValue": {
64
+ "value": 0,
65
+ "unit": "px"
66
+ },
51
67
  "groupId": "desktop",
52
68
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
53
69
  }
@@ -16,6 +16,10 @@
16
16
  "displayName": "Top Spacing",
17
17
  "type": "TYPE",
18
18
  "required": false,
19
+ "defaultValue": {
20
+ "value": 0,
21
+ "unit": "px"
22
+ },
19
23
  "groupId": "mobile",
20
24
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
21
25
  },
@@ -24,6 +28,10 @@
24
28
  "displayName": "Bottom Spacing",
25
29
  "type": "TYPE",
26
30
  "required": false,
31
+ "defaultValue": {
32
+ "value": 0,
33
+ "unit": "px"
34
+ },
27
35
  "groupId": "mobile",
28
36
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
29
37
  },
@@ -32,6 +40,10 @@
32
40
  "displayName": "Top Spacing",
33
41
  "type": "TYPE",
34
42
  "required": false,
43
+ "defaultValue": {
44
+ "value": 0,
45
+ "unit": "px"
46
+ },
35
47
  "groupId": "desktop",
36
48
  "typeId": "@ikas/bp-storefront-models-MarginTopStyleType"
37
49
  },
@@ -40,6 +52,10 @@
40
52
  "displayName": "Bottom Spacing",
41
53
  "type": "TYPE",
42
54
  "required": false,
55
+ "defaultValue": {
56
+ "value": 0,
57
+ "unit": "px"
58
+ },
43
59
  "groupId": "desktop",
44
60
  "typeId": "@ikas/bp-storefront-models-MarginBottomStyleType"
45
61
  },
@@ -48,6 +64,7 @@
48
64
  "displayName": "Image Variant",
49
65
  "type": "BOOLEAN",
50
66
  "required": false,
67
+ "defaultValue": false,
51
68
  "description": "Use product images for color variant."
52
69
  }
53
70
  ],
@@ -9,15 +9,16 @@ import {
9
9
  cartStore,
10
10
  waitForCartStoreInit,
11
11
  } from "@ikas/bp-storefront";
12
- import { runInAction } from "mobx";
13
12
  import { adjustBundleProductQuantity } from "../utils/bundle";
14
13
 
14
+ // No mobx action wrapper needed: adjustments go through the public
15
+ // setBundleProductQuantity API (plain mutation, same as the SDK's own usage
16
+ // examples), and keeping the theme free of direct mobx imports lets the
17
+ // scaffold install cleanly under pnpm's strict node_modules layout.
15
18
  function adjustBundleQuantities(products: IkasBundleProduct[]) {
16
- runInAction(() => {
17
- for (const bp of products) {
18
- adjustBundleProductQuantity(bp);
19
- }
20
- });
19
+ for (const bp of products) {
20
+ adjustBundleProductQuantity(bp);
21
+ }
21
22
  }
22
23
 
23
24
  export function useBundleProducts(product: IkasProduct | null | undefined) {
@@ -16,6 +16,7 @@
16
16
  "displayName": "Aspect Ratio",
17
17
  "type": "ENUM",
18
18
  "required": false,
19
+ "defaultValue": "Square",
19
20
  "groupId": "image-settings",
20
21
  "enumTypeId": "{{ENUM_ID:AspectRatio}}"
21
22
  },
@@ -24,6 +25,7 @@
24
25
  "displayName": "Image Fit",
25
26
  "type": "ENUM",
26
27
  "required": false,
28
+ "defaultValue": "Cover",
27
29
  "groupId": "image-settings",
28
30
  "enumTypeId": "{{ENUM_ID:ObjectFit}}"
29
31
  },
@@ -32,6 +34,46 @@
32
34
  "displayName": "Info Components",
33
35
  "type": "COMPONENT_LIST",
34
36
  "required": false,
37
+ "defaultValue": {
38
+ "components": [
39
+ {
40
+ "codeComponentId": "nb34u3yu-product-detail-name-favorite"
41
+ },
42
+ {
43
+ "codeComponentId": "nb34u3yu-product-detail-sku"
44
+ },
45
+ {
46
+ "codeComponentId": "nb34u3yu-product-detail-prices"
47
+ },
48
+ {
49
+ "codeComponentId": "nb34u3yu-product-detail-product-group"
50
+ },
51
+ {
52
+ "codeComponentId": "nb34u3yu-product-detail-bundle-product"
53
+ },
54
+ {
55
+ "codeComponentId": "nb34u3yu-product-detail-variant"
56
+ },
57
+ {
58
+ "codeComponentId": "nb34u3yu-product-detail-option-set"
59
+ },
60
+ {
61
+ "codeComponentId": "nb34u3yu-product-detail-add-to-cart"
62
+ },
63
+ {
64
+ "codeComponentId": "nb34u3yu-product-detail-back-in-stock"
65
+ },
66
+ {
67
+ "codeComponentId": "nb34u3yu-product-detail-offer"
68
+ },
69
+ {
70
+ "codeComponentId": "nb34u3yu-product-detail-features"
71
+ },
72
+ {
73
+ "codeComponentId": "nb34u3yu-product-detail-description"
74
+ }
75
+ ]
76
+ },
35
77
  "filteredComponentIds": [
36
78
  "<id-of-ProductDetailNameFavorite>",
37
79
  "<id-of-ProductDetailSku>",
@@ -39,6 +81,7 @@
39
81
  "<id-of-ProductDetailProductGroup>",
40
82
  "<id-of-ProductDetailVariant>",
41
83
  "<id-of-ProductDetailAddToCart>",
84
+ "<id-of-ProductDetailBackInStock>",
42
85
  "<id-of-ProductDetailFeatures>",
43
86
  "<id-of-ProductDetailDescription>",
44
87
  "<id-of-ProductDetailBundleProduct>",
@@ -51,6 +94,16 @@
51
94
  "displayName": "Sub Components",
52
95
  "type": "COMPONENT_LIST",
53
96
  "required": false,
97
+ "defaultValue": {
98
+ "components": [
99
+ {
100
+ "codeComponentId": "nb34u3yu-product-detail-bundle-furniture"
101
+ },
102
+ {
103
+ "codeComponentId": "nb34u3yu-product-detail-offer"
104
+ }
105
+ ]
106
+ },
54
107
  "filteredComponentIds": [
55
108
  "<id-of-ProductDetailBundleFurniture>",
56
109
  "<id-of-ProductDetailOffer>"
@@ -0,0 +1,120 @@
1
+ import { useState, useEffect, useRef, useId } from "preact/hooks";
2
+ import { createPortal } from "preact/compat";
3
+ import type { ComponentChildren } from "preact";
4
+ import { useScrollLock } from "../../hooks/useScrollLock";
5
+ import { cx } from "../../utils/cx";
6
+ import { XSVG } from "../icons";
7
+ import Button, { type ButtonProps } from "../Button";
8
+
9
+ interface Props {
10
+ onClose: () => void;
11
+ title: string;
12
+ maxWidth?: string;
13
+ children: ComponentChildren;
14
+ className?: string;
15
+ okText?: string;
16
+ cancelText?: string;
17
+ onOk?: (e: Event) => void;
18
+ okButtonProps?: ButtonProps;
19
+ cancelButtonProps?: ButtonProps;
20
+ footer?: ComponentChildren | null;
21
+ }
22
+
23
+ export default function Modal({
24
+ onClose,
25
+ title,
26
+ maxWidth = "37.5rem",
27
+ children,
28
+ className,
29
+ okText,
30
+ cancelText,
31
+ onOk,
32
+ okButtonProps,
33
+ cancelButtonProps,
34
+ footer,
35
+ }: Props) {
36
+ const titleId = useId();
37
+ const [visible, setVisible] = useState(false);
38
+ const onCloseRef = useRef(onClose);
39
+ onCloseRef.current = onClose;
40
+
41
+ const handleCloseRef = useRef(() => {});
42
+ handleCloseRef.current = () => {
43
+ setVisible(false);
44
+ setTimeout(() => onCloseRef.current(), 300);
45
+ };
46
+
47
+ useScrollLock();
48
+
49
+ useEffect(() => {
50
+ const rafId = requestAnimationFrame(() => setVisible(true));
51
+ return () => cancelAnimationFrame(rafId);
52
+ }, []);
53
+
54
+ useEffect(() => {
55
+ const handleKeyDown = (e: KeyboardEvent) => {
56
+ if (e.key === "Escape") handleCloseRef.current();
57
+ };
58
+ document.addEventListener("keydown", handleKeyDown);
59
+ return () => document.removeEventListener("keydown", handleKeyDown);
60
+ }, []);
61
+
62
+ return createPortal(
63
+ <div
64
+ className={cx("kombos-modal", visible && "kombos-modal--open", className)}
65
+ role="dialog"
66
+ aria-modal="true"
67
+ aria-labelledby={titleId}
68
+ >
69
+ <div className="kombos-modal__panel" style={{ maxWidth }}>
70
+ <div className="kombos-modal__header">
71
+ <h2 id={titleId} className="kombos-modal__title text-md-medium">
72
+ {title}
73
+ </h2>
74
+ <button
75
+ type="button"
76
+ className="kombos-modal__close"
77
+ onClick={() => handleCloseRef.current()}
78
+ aria-label="Close"
79
+ >
80
+ <XSVG />
81
+ </button>
82
+ </div>
83
+
84
+ <div className="kombos-modal__body">{children}</div>
85
+
86
+ {footer !== null &&
87
+ (footer !== undefined ? (
88
+ <div className="kombos-modal__footer">{footer}</div>
89
+ ) : (
90
+ (cancelText || okText) && (
91
+ <div className="kombos-modal__footer">
92
+ {cancelText && (
93
+ <Button
94
+ variant="secondary"
95
+ size="s"
96
+ type="button"
97
+ onClick={() => handleCloseRef.current()}
98
+ {...cancelButtonProps}
99
+ >
100
+ {cancelText}
101
+ </Button>
102
+ )}
103
+ {okText && (
104
+ <Button
105
+ variant="primary"
106
+ size="s"
107
+ onClick={onOk}
108
+ {...okButtonProps}
109
+ >
110
+ {okText}
111
+ </Button>
112
+ )}
113
+ </div>
114
+ )
115
+ ))}
116
+ </div>
117
+ </div>,
118
+ document.body,
119
+ );
120
+ }