@akinon/projectzero 2.0.0-beta.20 → 2.0.0-beta.21

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 (138) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/app-template/CHANGELOG.md +138 -0
  3. package/app-template/next.config.mjs +0 -1
  4. package/app-template/package.json +31 -30
  5. package/app-template/src/app/[pz]/[...prettyurl]/page.tsx +2 -2
  6. package/app-template/src/app/[pz]/account/layout.tsx +2 -1
  7. package/app-template/src/app/{[commerce]/[locale]/[currency] → [pz]}/blog/[slug]/page.tsx +4 -2
  8. package/app-template/src/app/[pz]/category/[pk]/page.tsx +11 -1
  9. package/app-template/src/app/[pz]/group-product/[pk]/page.tsx +2 -2
  10. package/app-template/src/app/[pz]/layout.tsx +3 -1
  11. package/app-template/src/app/[pz]/list/page.tsx +11 -1
  12. package/app-template/src/app/[pz]/page.tsx +13 -35
  13. package/app-template/src/app/[pz]/pages/[slug]/page.tsx +19 -0
  14. package/app-template/src/app/[pz]/product/[pk]/page.tsx +2 -2
  15. package/app-template/src/app/api/barcode-search/route.ts +1 -1
  16. package/app-template/src/app/api/cache/route.ts +1 -1
  17. package/app-template/src/app/api/image-proxy/route.ts +1 -1
  18. package/app-template/src/app/api/logout/route.ts +1 -1
  19. package/app-template/src/app/api/product-categories/route.ts +1 -1
  20. package/app-template/src/app/api/similar-product-list/route.ts +1 -1
  21. package/app-template/src/app/api/similar-products/route.ts +1 -1
  22. package/app-template/src/app/api/virtual-try-on/route.ts +1 -1
  23. package/app-template/src/app/api/web-vitals/route.ts +1 -1
  24. package/app-template/src/components/quantity-selector.tsx +16 -4
  25. package/app-template/src/components/widget-content.tsx +3 -3
  26. package/app-template/src/routes/index.ts +6 -6
  27. package/app-template/src/utils/__tests__/theme-page-context.test.ts +145 -0
  28. package/app-template/src/utils/theme-page-context.ts +309 -0
  29. package/app-template/src/views/basket/basket-item.tsx +107 -691
  30. package/app-template/src/views/basket/index.ts +0 -2
  31. package/app-template/src/views/basket/summary.tsx +75 -496
  32. package/app-template/src/views/breadcrumb.tsx +38 -13
  33. package/app-template/src/views/category/category-header.tsx +66 -289
  34. package/app-template/src/views/category/category-info.tsx +24 -173
  35. package/app-template/src/views/category/filters/index.tsx +48 -208
  36. package/app-template/src/views/category/layout.tsx +5 -7
  37. package/app-template/src/views/checkout/index.tsx +0 -5
  38. package/app-template/src/views/checkout/steps/payment/index.tsx +2 -5
  39. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +1 -72
  40. package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +40 -171
  41. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +12 -74
  42. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +45 -128
  43. package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +27 -232
  44. package/app-template/src/views/checkout/summary.tsx +29 -303
  45. package/app-template/src/views/footer.tsx +13 -415
  46. package/app-template/src/views/guest-login/index.tsx +1 -1
  47. package/app-template/src/views/header/action-menu.tsx +45 -277
  48. package/app-template/src/views/header/band.tsx +21 -6
  49. package/app-template/src/views/header/index.tsx +47 -109
  50. package/app-template/src/views/header/mini-basket.tsx +45 -820
  51. package/app-template/src/views/header/navbar.tsx +111 -178
  52. package/app-template/src/views/header/search/index.tsx +32 -71
  53. package/app-template/src/views/header/search/results.tsx +65 -127
  54. package/app-template/src/views/product/accordion-wrapper.tsx +43 -135
  55. package/app-template/src/views/product/index.ts +1 -1
  56. package/app-template/src/views/product/layout.tsx +7 -2
  57. package/app-template/src/views/product/misc-buttons.tsx +25 -339
  58. package/app-template/src/views/product/product-actions.tsx +8 -137
  59. package/app-template/src/views/product/product-info.tsx +31 -69
  60. package/app-template/src/views/product/product-share.tsx +8 -11
  61. package/app-template/src/views/product/slider.tsx +79 -117
  62. package/app-template/src/views/product-item/index.tsx +46 -119
  63. package/app-template/src/widgets/footer-social.tsx +16 -47
  64. package/app-template/src/widgets/footer-subscription/index.tsx +17 -183
  65. package/dist/commands/plugins.js +23 -2
  66. package/package.json +1 -1
  67. package/app-template/src/app/[commerce]/[locale]/[currency]/pages/[slug]/page.tsx +0 -15
  68. package/app-template/src/views/basket/basket-summary-context.tsx +0 -560
  69. package/app-template/src/views/basket/designer-context.tsx +0 -617
  70. package/app-template/src/views/breadcrumb/breadcrumb-client.tsx +0 -190
  71. package/app-template/src/views/breadcrumb/breadcrumb-registrar.tsx +0 -286
  72. package/app-template/src/views/breadcrumb/constants.ts +0 -15
  73. package/app-template/src/views/breadcrumb/index.tsx +0 -127
  74. package/app-template/src/views/category/native-widget-context.tsx +0 -257
  75. package/app-template/src/views/category/product-list-registrar.tsx +0 -665
  76. package/app-template/src/views/checkout/checkout-address-registrar.tsx +0 -254
  77. package/app-template/src/views/checkout/checkout-buttons-registrar.tsx +0 -183
  78. package/app-template/src/views/checkout/checkout-delivery-method-registrar.tsx +0 -259
  79. package/app-template/src/views/checkout/checkout-payment-options-registrar.tsx +0 -253
  80. package/app-template/src/views/checkout/checkout-summary-registrar.tsx +0 -183
  81. package/app-template/src/views/checkout/constants.ts +0 -5
  82. package/app-template/src/views/checkout/steps/payment/options/masterpass-rest.tsx +0 -15
  83. package/app-template/src/views/checkout/steps/payment/options/saved-card.tsx +0 -18
  84. package/app-template/src/views/footer/footer-app-banner-context.tsx +0 -326
  85. package/app-template/src/views/footer/footer-bottom-context.tsx +0 -215
  86. package/app-template/src/views/footer/footer-bottom-wrapper.tsx +0 -74
  87. package/app-template/src/views/footer/footer-layout-constants.ts +0 -35
  88. package/app-template/src/views/footer/footer-layout-registrar.tsx +0 -342
  89. package/app-template/src/views/footer/footer-layout-switcher.tsx +0 -110
  90. package/app-template/src/views/footer/footer-menu-context.tsx +0 -211
  91. package/app-template/src/views/footer/footer-native-widgets.tsx +0 -60
  92. package/app-template/src/views/footer/footer-social-context.tsx +0 -254
  93. package/app-template/src/views/footer/footer-subscription-context.tsx +0 -210
  94. package/app-template/src/views/footer/footer-utils.ts +0 -43
  95. package/app-template/src/views/footer/footer-value-props-context.tsx +0 -326
  96. package/app-template/src/views/footer/logo-settings.ts +0 -183
  97. package/app-template/src/views/footer/native-widget-config.ts +0 -262
  98. package/app-template/src/views/footer/subscription-settings.ts +0 -122
  99. package/app-template/src/views/footer/use-footer-logo.ts +0 -162
  100. package/app-template/src/views/header/designer-context.tsx +0 -261
  101. package/app-template/src/views/header/header-announcement-registrar.tsx +0 -267
  102. package/app-template/src/views/header/header-client-wrapper.tsx +0 -496
  103. package/app-template/src/views/header/header-content.tsx +0 -1026
  104. package/app-template/src/views/header/header-currency-registrar.tsx +0 -348
  105. package/app-template/src/views/header/header-icons-context.tsx +0 -262
  106. package/app-template/src/views/header/header-language-registrar.tsx +0 -348
  107. package/app-template/src/views/header/header-layout-context.tsx +0 -143
  108. package/app-template/src/views/header/header-layout-registrar.tsx +0 -658
  109. package/app-template/src/views/header/header-logo-context.tsx +0 -228
  110. package/app-template/src/views/header/header-logo.tsx +0 -118
  111. package/app-template/src/views/header/header-mini-basket-context.tsx +0 -524
  112. package/app-template/src/views/header/header-search-registrar.tsx +0 -511
  113. package/app-template/src/views/header/header-text-slider-registrar.tsx +0 -382
  114. package/app-template/src/views/header/inline-search.tsx +0 -262
  115. package/app-template/src/views/header/navbar-menu-context.tsx +0 -219
  116. package/app-template/src/views/header/search/search-input.tsx +0 -61
  117. package/app-template/src/views/header/server-settings-parser.ts +0 -1105
  118. package/app-template/src/views/header/use-header-icons.ts +0 -241
  119. package/app-template/src/views/header/use-header-logo.ts +0 -213
  120. package/app-template/src/views/header/use-navbar-menu.ts +0 -179
  121. package/app-template/src/views/product/accordion-section.tsx +0 -61
  122. package/app-template/src/views/product/custom-button-group.tsx +0 -69
  123. package/app-template/src/views/product/favorites-button-section.tsx +0 -69
  124. package/app-template/src/views/product/find-in-store-section.tsx +0 -60
  125. package/app-template/src/views/product/product-info-section.tsx +0 -140
  126. package/app-template/src/views/product/quantity-section.tsx +0 -73
  127. package/app-template/src/views/product/sale-tag.tsx +0 -10
  128. package/app-template/src/views/product/share-section.tsx +0 -357
  129. package/app-template/src/views/product/variants-section.tsx +0 -126
  130. package/app-template/src/views/product-detail/constants.ts +0 -272
  131. package/app-template/src/views/product-detail/index.ts +0 -10
  132. package/app-template/src/views/product-detail/product-detail-registrar.tsx +0 -616
  133. package/app-template/src/widgets/footer-app-banner.tsx +0 -444
  134. package/app-template/src/widgets/footer-bottom.tsx +0 -127
  135. package/app-template/src/widgets/footer-menu-compact.tsx +0 -238
  136. package/app-template/src/widgets/footer-menu-two.tsx +0 -298
  137. package/app-template/src/widgets/footer-social-client.tsx +0 -251
  138. package/app-template/src/widgets/footer-value-props.tsx +0 -201
@@ -1,357 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useState, useEffect } from 'react';
4
- import { Button, Icon } from '@theme/components';
5
- // eslint-disable-next-line @akinon/projectzero/link-import
6
- import Link from 'next/link';
7
- import {
8
- useProductDetail,
9
- SHARE_SECTION_ID,
10
- ShareLayoutType
11
- } from '@theme/views/product-detail';
12
- import clsx from 'clsx';
13
-
14
- interface ShareItem {
15
- href: string;
16
- iconName: 'facebook' | 'twitter' | 'whatsapp';
17
- iconSize?: number;
18
- }
19
-
20
- interface ShareSectionProps {
21
- productName: string;
22
- buttonText?: string;
23
- items: ShareItem[];
24
- className?: string;
25
- }
26
-
27
- export const ShareSection: React.FC<ShareSectionProps> = ({
28
- productName,
29
- buttonText,
30
- items,
31
- className
32
- }) => {
33
- const { isDesigner, selectedSectionId, shareStyles, shareProperties } =
34
- useProductDetail();
35
-
36
- const [open, setOpen] = useState(false);
37
- const isSelected = selectedSectionId === SHARE_SECTION_ID;
38
- const layout = shareProperties.layout || 'floating';
39
- const showLabel = shareProperties.showLabel ?? true;
40
-
41
- // Handle designer click for section selection
42
- const handleDesignerClick = (e: React.MouseEvent) => {
43
- if (isDesigner) {
44
- e.stopPropagation();
45
- window.parent?.postMessage(
46
- {
47
- type: 'SELECT_SECTION',
48
- data: {
49
- placeholderId: 'product-detail',
50
- sectionId: SHARE_SECTION_ID
51
- }
52
- },
53
- '*'
54
- );
55
- }
56
- };
57
-
58
- // Build CSS variables from shareStyles
59
- const shareStyleVars: Record<string, string> = {};
60
-
61
- // Button styles
62
- if (shareStyles['button-font-size'])
63
- shareStyleVars['--share-button-font-size'] =
64
- shareStyles['button-font-size'];
65
- if (shareStyles['button-font-weight'])
66
- shareStyleVars['--share-button-font-weight'] =
67
- shareStyles['button-font-weight'];
68
- if (shareStyles['button-color'])
69
- shareStyleVars['--share-button-color'] = shareStyles['button-color'];
70
- if (shareStyles['button-background-color'])
71
- shareStyleVars['--share-button-background-color'] =
72
- shareStyles['button-background-color'];
73
- if (shareStyles['button-border-color'])
74
- shareStyleVars['--share-button-border-color'] =
75
- shareStyles['button-border-color'];
76
- if (shareStyles['button-border-width'])
77
- shareStyleVars['--share-button-border-width'] =
78
- shareStyles['button-border-width'];
79
- if (shareStyles['button-border-radius'])
80
- shareStyleVars['--share-button-border-radius'] =
81
- shareStyles['button-border-radius'];
82
- if (shareStyles['button-padding-x'])
83
- shareStyleVars['--share-button-padding-x'] =
84
- shareStyles['button-padding-x'];
85
- if (shareStyles['button-padding-y'])
86
- shareStyleVars['--share-button-padding-y'] =
87
- shareStyles['button-padding-y'];
88
-
89
- // Icon styles
90
- if (shareStyles['icon-size'])
91
- shareStyleVars['--share-icon-size'] = shareStyles['icon-size'];
92
- if (shareStyles['icon-color'])
93
- shareStyleVars['--share-icon-color'] = shareStyles['icon-color'];
94
- if (shareStyles['icon-hover-color'])
95
- shareStyleVars['--share-icon-hover-color'] =
96
- shareStyles['icon-hover-color'];
97
- if (shareStyles['icon-background-color'])
98
- shareStyleVars['--share-icon-background-color'] =
99
- shareStyles['icon-background-color'];
100
- if (shareStyles['icon-hover-background-color'])
101
- shareStyleVars['--share-icon-hover-background-color'] =
102
- shareStyles['icon-hover-background-color'];
103
- if (shareStyles['icon-border-radius'])
104
- shareStyleVars['--share-icon-border-radius'] =
105
- shareStyles['icon-border-radius'];
106
- if (shareStyles['icon-spacing'])
107
- shareStyleVars['--share-icon-spacing'] = shareStyles['icon-spacing'];
108
-
109
- // Render different layouts
110
- const renderFloatingLayout = () => (
111
- <div className={clsx('flex items-center gap-4 border-t', className)}>
112
- <Button
113
- onClick={() => setOpen(!open)}
114
- appearance="ghost"
115
- className="text-base p-0 bg-transparent hover:bg-transparent hover:text-primary"
116
- style={{
117
- fontSize: 'var(--share-button-font-size, 16px)',
118
- fontWeight: 'var(--share-button-font-weight, 400)',
119
- color: 'var(--share-button-color, inherit)',
120
- backgroundColor: 'var(--share-button-background-color, transparent)',
121
- borderColor: 'var(--share-button-border-color, transparent)',
122
- borderWidth: 'var(--share-button-border-width, 0)',
123
- borderRadius: 'var(--share-button-border-radius, 0)',
124
- paddingLeft: 'var(--share-button-padding-x, 0)',
125
- paddingRight: 'var(--share-button-padding-x, 0)',
126
- paddingTop: 'var(--share-button-padding-y, 0)',
127
- paddingBottom: 'var(--share-button-padding-y, 0)'
128
- }}
129
- aria-label="Share"
130
- >
131
- <div className="flex items-center gap-2">
132
- <Icon
133
- name="share"
134
- size={Number(shareStyles['icon-size']) || 24}
135
- style={{
136
- color: 'var(--share-icon-color, inherit)'
137
- }}
138
- />
139
- {showLabel && buttonText && <span>{buttonText}</span>}
140
- </div>
141
- </Button>
142
-
143
- <div
144
- className={clsx(
145
- 'share-group flex transition-max-width ease-linear duration-300',
146
- open
147
- ? 'opacity-100 max-w-xs visible pointer-events-auto'
148
- : 'opacity-0 max-w-0 invisible pointer-events-none'
149
- )}
150
- style={{
151
- gap: 'var(--share-icon-spacing, 0)'
152
- }}
153
- >
154
- {items.map((item, index) => (
155
- <Link
156
- key={index}
157
- target="_blank"
158
- href={item.href}
159
- className="p-4 h-auto flex items-center hover:bg-gray-100"
160
- style={{
161
- borderRadius: 'var(--share-icon-border-radius, 0)',
162
- backgroundColor: 'var(--share-icon-background-color, transparent)'
163
- }}
164
- >
165
- <Icon
166
- name={item.iconName}
167
- size={Number(shareStyles['icon-size']) || item.iconSize || 12}
168
- style={{
169
- color: 'var(--share-icon-color, inherit)'
170
- }}
171
- />
172
- </Link>
173
- ))}
174
- </div>
175
- </div>
176
- );
177
-
178
- const renderInlineHorizontalLayout = () => (
179
- <div
180
- className={clsx('flex items-center flex-wrap', className)}
181
- style={{
182
- gap: 'var(--share-icon-spacing, 12px)'
183
- }}
184
- >
185
- {showLabel && buttonText && (
186
- <span
187
- style={{
188
- fontSize: 'var(--share-button-font-size, 16px)',
189
- fontWeight: 'var(--share-button-font-weight, 400)',
190
- color: 'var(--share-button-color, inherit)'
191
- }}
192
- >
193
- {buttonText}:
194
- </span>
195
- )}
196
- {items.map((item, index) => (
197
- <Link
198
- key={index}
199
- target="_blank"
200
- href={item.href}
201
- className="inline-flex items-center justify-center transition-colors"
202
- style={{
203
- padding: 'var(--share-button-padding-y, 8px)',
204
- borderRadius: 'var(--share-icon-border-radius, 4px)',
205
- backgroundColor: 'var(--share-icon-background-color, #f3f4f6)',
206
- color: 'var(--share-icon-color, inherit)'
207
- }}
208
- >
209
- <Icon
210
- name={item.iconName}
211
- size={Number(shareStyles['icon-size']) || item.iconSize || 20}
212
- />
213
- </Link>
214
- ))}
215
- </div>
216
- );
217
-
218
- const renderInlineVerticalLayout = () => (
219
- <div
220
- className={clsx('flex flex-col', className)}
221
- style={{
222
- gap: 'var(--share-icon-spacing, 12px)'
223
- }}
224
- >
225
- {showLabel && buttonText && (
226
- <span
227
- style={{
228
- fontSize: 'var(--share-button-font-size, 16px)',
229
- fontWeight: 'var(--share-button-font-weight, 400)',
230
- color: 'var(--share-button-color, inherit)'
231
- }}
232
- >
233
- {buttonText}
234
- </span>
235
- )}
236
- <div className="flex flex-col gap-2">
237
- {items.map((item, index) => (
238
- <Link
239
- key={index}
240
- target="_blank"
241
- href={item.href}
242
- className="inline-flex items-center justify-center transition-colors"
243
- style={{
244
- padding: 'var(--share-button-padding-y, 8px)',
245
- borderRadius: 'var(--share-icon-border-radius, 4px)',
246
- backgroundColor: 'var(--share-icon-background-color, #f3f4f6)',
247
- color: 'var(--share-icon-color, inherit)',
248
- width: 'fit-content'
249
- }}
250
- >
251
- <Icon
252
- name={item.iconName}
253
- size={Number(shareStyles['icon-size']) || item.iconSize || 20}
254
- />
255
- </Link>
256
- ))}
257
- </div>
258
- </div>
259
- );
260
-
261
- const renderIconOnlyLayout = () => (
262
- <div
263
- className={clsx('flex items-center flex-wrap', className)}
264
- style={{
265
- gap: 'var(--share-icon-spacing, 8px)'
266
- }}
267
- >
268
- {items.map((item, index) => (
269
- <Link
270
- key={index}
271
- target="_blank"
272
- href={item.href}
273
- className="inline-flex items-center justify-center transition-colors"
274
- style={{
275
- padding: 'var(--share-button-padding-y, 8px)',
276
- borderRadius: 'var(--share-icon-border-radius, 50%)',
277
- backgroundColor: 'var(--share-icon-background-color, #f3f4f6)',
278
- color: 'var(--share-icon-color, inherit)'
279
- }}
280
- >
281
- <Icon
282
- name={item.iconName}
283
- size={Number(shareStyles['icon-size']) || item.iconSize || 18}
284
- />
285
- </Link>
286
- ))}
287
- </div>
288
- );
289
-
290
- const renderCompactLayout = () => (
291
- <div
292
- className={clsx('flex items-center', className)}
293
- style={{
294
- gap: 'var(--share-icon-spacing, 6px)'
295
- }}
296
- >
297
- {showLabel && buttonText && (
298
- <span
299
- style={{
300
- fontSize: 'var(--share-button-font-size, 14px)',
301
- fontWeight: 'var(--share-button-font-weight, 400)',
302
- color: 'var(--share-button-color, inherit)'
303
- }}
304
- >
305
- {buttonText}
306
- </span>
307
- )}
308
- {items.map((item, index) => (
309
- <Link
310
- key={index}
311
- target="_blank"
312
- href={item.href}
313
- className="inline-flex items-center justify-center transition-colors"
314
- style={{
315
- padding: 'var(--share-button-padding-y, 4px)',
316
- borderRadius: 'var(--share-icon-border-radius, 4px)',
317
- backgroundColor: 'var(--share-icon-background-color, transparent)',
318
- color: 'var(--share-icon-color, inherit)'
319
- }}
320
- >
321
- <Icon
322
- name={item.iconName}
323
- size={Number(shareStyles['icon-size']) || item.iconSize || 16}
324
- />
325
- </Link>
326
- ))}
327
- </div>
328
- );
329
-
330
- const renderLayout = () => {
331
- switch (layout) {
332
- case 'inline-horizontal':
333
- return renderInlineHorizontalLayout();
334
- case 'inline-vertical':
335
- return renderInlineVerticalLayout();
336
- case 'icon-only':
337
- return renderIconOnlyLayout();
338
- case 'compact':
339
- return renderCompactLayout();
340
- case 'floating':
341
- default:
342
- return renderFloatingLayout();
343
- }
344
- };
345
-
346
- return (
347
- <div
348
- style={shareStyleVars}
349
- className={clsx('relative', {
350
- 'ring-2 ring-blue-500 ring-offset-2': isDesigner && isSelected
351
- })}
352
- onClick={handleDesignerClick}
353
- >
354
- {renderLayout()}
355
- </div>
356
- );
357
- };
@@ -1,126 +0,0 @@
1
- 'use client';
2
-
3
- import React, { useMemo } from 'react';
4
- import { ProductVariants } from './product-variants';
5
- import { VariantType } from '@akinon/next/types';
6
- import {
7
- useProductDetail,
8
- VARIANTS_SECTION_ID
9
- } from '@theme/views/product-detail';
10
- import clsx from 'clsx';
11
-
12
- interface VariantsSectionProps {
13
- variants: VariantType[];
14
- onVariantChange: () => void;
15
- }
16
-
17
- export const VariantsSection: React.FC<VariantsSectionProps> = ({
18
- variants,
19
- onVariantChange
20
- }) => {
21
- const { isDesigner, selectedSectionId, variantsStyles } = useProductDetail();
22
-
23
- const isSelected = selectedSectionId === VARIANTS_SECTION_ID;
24
-
25
- // Handle designer click for section selection
26
- const handleDesignerClick = () => {
27
- if (isDesigner) {
28
- window.parent?.postMessage(
29
- {
30
- type: 'SELECT_SECTION',
31
- data: {
32
- placeholderId: 'product-detail',
33
- sectionId: VARIANTS_SECTION_ID
34
- }
35
- },
36
- '*'
37
- );
38
- }
39
- };
40
-
41
- const variantStyles = useMemo(() => {
42
- const result: Record<string, string> = {};
43
-
44
- // Label styles
45
- if (variantsStyles['label-font-size'])
46
- result['--variant-label-font-size'] = variantsStyles['label-font-size'];
47
- if (variantsStyles['label-font-weight'])
48
- result['--variant-label-font-weight'] =
49
- variantsStyles['label-font-weight'];
50
- if (variantsStyles['label-color'])
51
- result['--variant-label-color'] = variantsStyles['label-color'];
52
-
53
- // Button typography
54
- if (variantsStyles['button-font-size'])
55
- result['--variant-button-font-size'] = variantsStyles['button-font-size'];
56
- if (variantsStyles['button-font-weight'])
57
- result['--variant-button-font-weight'] =
58
- variantsStyles['button-font-weight'];
59
-
60
- // Button sizing
61
- if (variantsStyles['button-height'])
62
- result['--variant-button-height'] = variantsStyles['button-height'];
63
- if (variantsStyles['button-padding-x'])
64
- result['--variant-button-padding-x'] = variantsStyles['button-padding-x'];
65
- if (variantsStyles['button-border-radius'])
66
- result['--variant-button-border-radius'] =
67
- variantsStyles['button-border-radius'];
68
- if (variantsStyles['button-border-width'])
69
- result['--variant-button-border-width'] =
70
- variantsStyles['button-border-width'];
71
-
72
- // Default state
73
- if (variantsStyles['button-color'])
74
- result['--variant-button-color'] = variantsStyles['button-color'];
75
- if (variantsStyles['button-background-color'])
76
- result['--variant-button-background-color'] =
77
- variantsStyles['button-background-color'];
78
- if (variantsStyles['button-border-color'])
79
- result['--variant-button-border-color'] =
80
- variantsStyles['button-border-color'];
81
-
82
- // Selected state
83
- if (variantsStyles['selected-color'])
84
- result['--variant-selected-color'] = variantsStyles['selected-color'];
85
- if (variantsStyles['selected-background-color'])
86
- result['--variant-selected-background-color'] =
87
- variantsStyles['selected-background-color'];
88
- if (variantsStyles['selected-border-color'])
89
- result['--variant-selected-border-color'] =
90
- variantsStyles['selected-border-color'];
91
-
92
- // Hover state
93
- if (variantsStyles['hover-color'])
94
- result['--variant-hover-color'] = variantsStyles['hover-color'];
95
- if (variantsStyles['hover-background-color'])
96
- result['--variant-hover-background-color'] =
97
- variantsStyles['hover-background-color'];
98
- if (variantsStyles['hover-border-color'])
99
- result['--variant-hover-border-color'] =
100
- variantsStyles['hover-border-color'];
101
-
102
- // Disabled state
103
- if (variantsStyles['disabled-color'])
104
- result['--variant-disabled-color'] = variantsStyles['disabled-color'];
105
- if (variantsStyles['disabled-background-color'])
106
- result['--variant-disabled-background-color'] =
107
- variantsStyles['disabled-background-color'];
108
- if (variantsStyles['disabled-border-color'])
109
- result['--variant-disabled-border-color'] =
110
- variantsStyles['disabled-border-color'];
111
-
112
- return result;
113
- }, [variantsStyles]);
114
-
115
- return (
116
- <div
117
- style={variantStyles}
118
- className={clsx('relative', {
119
- 'ring-2 ring-blue-500 ring-offset-2': isDesigner && isSelected
120
- })}
121
- onClick={handleDesignerClick}
122
- >
123
- <ProductVariants variants={variants} onVariantChange={onVariantChange} />
124
- </div>
125
- );
126
- };