@anker-in/headless-ui 1.1.89 → 1.1.91

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 (53) hide show
  1. package/dist/cjs/biz-components/LotteryShared/BaseModal.js +1 -1
  2. package/dist/cjs/biz-components/LotteryShared/BaseModal.js.map +2 -2
  3. package/dist/cjs/biz-components/LotteryShared/ChanceMethods.js +1 -1
  4. package/dist/cjs/biz-components/LotteryShared/ChanceMethods.js.map +2 -2
  5. package/dist/cjs/biz-components/LotteryShared/ErrorModal.d.ts +15 -0
  6. package/dist/cjs/biz-components/LotteryShared/ErrorModal.js +1 -1
  7. package/dist/cjs/biz-components/LotteryShared/ErrorModal.js.map +3 -3
  8. package/dist/cjs/biz-components/LotteryShared/MyRewardsModal.js +1 -1
  9. package/dist/cjs/biz-components/LotteryShared/MyRewardsModal.js.map +3 -3
  10. package/dist/cjs/biz-components/LotteryShared/WinnerModal.d.ts +1 -1
  11. package/dist/cjs/biz-components/LotteryShared/WinnerModal.js +1 -1
  12. package/dist/cjs/biz-components/LotteryShared/WinnerModal.js.map +3 -3
  13. package/dist/cjs/biz-components/LotteryShared/types.d.ts +42 -0
  14. package/dist/cjs/biz-components/LotteryShared/types.js +1 -1
  15. package/dist/cjs/biz-components/LotteryShared/types.js.map +2 -2
  16. package/dist/cjs/biz-components/ProductLottery/index.js +1 -1
  17. package/dist/cjs/biz-components/ProductLottery/index.js.map +3 -3
  18. package/dist/cjs/biz-components/ProductLottery/types.d.ts +113 -4
  19. package/dist/cjs/biz-components/ProductLottery/types.js +1 -1
  20. package/dist/cjs/biz-components/ProductLottery/types.js.map +2 -2
  21. package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
  22. package/dist/cjs/biz-components/ProductNav/ProductNav.js.map +3 -3
  23. package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
  24. package/dist/cjs/biz-components/Tabs/Tabs.js.map +3 -3
  25. package/dist/cjs/biz-components/Tabs/types.d.ts +3 -0
  26. package/dist/cjs/biz-components/Tabs/types.js +1 -1
  27. package/dist/cjs/biz-components/Tabs/types.js.map +1 -1
  28. package/dist/esm/biz-components/LotteryShared/BaseModal.js +1 -1
  29. package/dist/esm/biz-components/LotteryShared/BaseModal.js.map +2 -2
  30. package/dist/esm/biz-components/LotteryShared/ChanceMethods.js +1 -1
  31. package/dist/esm/biz-components/LotteryShared/ChanceMethods.js.map +2 -2
  32. package/dist/esm/biz-components/LotteryShared/ErrorModal.d.ts +15 -0
  33. package/dist/esm/biz-components/LotteryShared/ErrorModal.js +1 -1
  34. package/dist/esm/biz-components/LotteryShared/ErrorModal.js.map +3 -3
  35. package/dist/esm/biz-components/LotteryShared/MyRewardsModal.js +1 -1
  36. package/dist/esm/biz-components/LotteryShared/MyRewardsModal.js.map +3 -3
  37. package/dist/esm/biz-components/LotteryShared/WinnerModal.d.ts +1 -1
  38. package/dist/esm/biz-components/LotteryShared/WinnerModal.js +1 -1
  39. package/dist/esm/biz-components/LotteryShared/WinnerModal.js.map +3 -3
  40. package/dist/esm/biz-components/LotteryShared/types.d.ts +42 -0
  41. package/dist/esm/biz-components/LotteryShared/types.js.map +2 -2
  42. package/dist/esm/biz-components/ProductLottery/index.js +1 -1
  43. package/dist/esm/biz-components/ProductLottery/index.js.map +3 -3
  44. package/dist/esm/biz-components/ProductLottery/types.d.ts +113 -4
  45. package/dist/esm/biz-components/ProductLottery/types.js +1 -1
  46. package/dist/esm/biz-components/ProductLottery/types.js.map +2 -2
  47. package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
  48. package/dist/esm/biz-components/ProductNav/ProductNav.js.map +3 -3
  49. package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
  50. package/dist/esm/biz-components/Tabs/Tabs.js.map +3 -3
  51. package/dist/esm/biz-components/Tabs/types.d.ts +3 -0
  52. package/package.json +1 -1
  53. package/style.css +30 -0
@@ -82,6 +82,40 @@ export interface CtaButtonConfig {
82
82
  */
83
83
  style?: 'primary' | 'secondary' | 'outline';
84
84
  }
85
+ /**
86
+ * 错误弹窗配置(ErrorConfig)
87
+ *
88
+ * 对齐 CMS `error` group 字段结构。
89
+ *
90
+ * CMS 字段映射:
91
+ * - `title` → 弹窗标题
92
+ * - `defaultMessage` → 默认错误内容文案
93
+ * - `confirmButton` → 确认按钮文案
94
+ * - `exchangeFailedTitle` → 兑换失败弹窗标题
95
+ * - `exchangeFailedMessage` → 兑换失败弹窗内容
96
+ */
97
+ export interface ErrorConfig {
98
+ title?: string;
99
+ defaultMessage?: string;
100
+ confirmButton?: string;
101
+ exchangeFailedTitle?: string;
102
+ exchangeFailedMessage?: string;
103
+ }
104
+ /**
105
+ * 未中奖弹窗配置(TryAgainConfig)
106
+ *
107
+ * 对齐 CMS `tryAgain` group 字段结构。
108
+ *
109
+ * CMS 字段映射:
110
+ * - `title` → 弹窗标题
111
+ * - `message` → 内容文案
112
+ * - `confirmText` → 确认按钮文案
113
+ */
114
+ export interface TryAgainConfig {
115
+ title?: string;
116
+ message?: string;
117
+ confirmText?: string;
118
+ }
85
119
  /**
86
120
  * ProductLottery 组件命令式控制接口
87
121
  *
@@ -239,6 +273,12 @@ export interface ProductLotteryProps {
239
273
  theme?: Theme;
240
274
  /** CTA 按钮配置 */
241
275
  ctaButton?: CtaButtonConfig;
276
+ /**
277
+ * 抽奖活动类型(CMS: `dealsType`)
278
+ * 用于标识抽奖活动的唯一类型,如:`ipc-2614`
279
+ * @optional
280
+ */
281
+ dealsType?: string;
242
282
  /**
243
283
  * 获取机会方式数组
244
284
  * @optional
@@ -250,8 +290,32 @@ export interface ProductLotteryProps {
250
290
  * @optional
251
291
  */
252
292
  mechanismType?: ChanceMechanismType;
293
+ /**
294
+ * 输入框占位文本(CMS: `inputPlaceholder`)
295
+ * @default "Enter your order number"
296
+ * @optional
297
+ */
298
+ inputPlaceholder?: string;
299
+ /**
300
+ * 提交按钮文案(CMS: `inputSubmitText`)
301
+ * @default "Spin and Win"
302
+ * @optional
303
+ */
304
+ inputSubmitText?: string;
305
+ /**
306
+ * 输入框类型(CMS: `inputType`)
307
+ * @default "text"
308
+ * @optional
309
+ */
310
+ inputType?: 'text' | 'email' | 'number';
311
+ /**
312
+ * 输入格式错误提示文案(CMS: `inputValidationErrorText`)
313
+ * @optional
314
+ */
315
+ inputValidationErrorText?: string;
253
316
  /**
254
317
  * 输入框配置(当 mechanismType 为 'input' 时使用)
318
+ * @deprecated Use flat input fields (`inputPlaceholder`, `inputSubmitText`, `inputType`, `inputValidationErrorText`) instead (CMS field names)
255
319
  * @optional
256
320
  */
257
321
  inputConfig?: ChanceInputConfig;
@@ -273,10 +337,21 @@ export interface ProductLotteryProps {
273
337
  loadingText?: string;
274
338
  };
275
339
  /**
276
- * 中奖信息数组,用于底部滚动条展示
340
+ * 中奖弹窗配置(CMS: `winningInfos` group — 主名称)
341
+ *
342
+ * CMS 中 `winningInfos` 是中奖弹窗配置 group,字段:
343
+ * `title`、`confirmButton`、`confirmUrl`、`learnMoreUrl`、`learnMoreText`。
344
+ */
345
+ winningInfos?: WinnerModalConfig;
346
+ /**
347
+ * 底部滚动条中奖人名单数据
348
+ *
349
+ * 原 `winningInfos: WinningInfo[]` 重命名为 `winnerTickerData` 以避免
350
+ * 与 CMS `winningInfos` group 命名冲突。
351
+ *
277
352
  * @default []
278
353
  */
279
- winningInfos?: WinningInfo[];
354
+ winnerTickerData?: WinningInfo[];
280
355
  /**
281
356
  * 中奖滚动 Ticker 文案模板,支持 {{name}} 和 {{prize}} 变量
282
357
  * @default "{{name}} just won {{prize}}!"
@@ -308,14 +383,46 @@ export interface ProductLotteryProps {
308
383
  actionButtonConfig?: ActionButtonConfig;
309
384
  /** 我的奖励弹窗配置 */
310
385
  myRewardsModalConfig?: MyRewardsModalConfig;
311
- /** 错误弹窗配置 */
386
+ /**
387
+ * 错误弹窗配置(CMS: `error` group — 主名称)
388
+ *
389
+ * 字段:`title`、`defaultMessage`、`confirmButton`、
390
+ * `exchangeFailedTitle`、`exchangeFailedMessage`。
391
+ */
392
+ error?: ErrorConfig;
393
+ /**
394
+ * 未中奖弹窗配置(CMS: `tryAgain` group)
395
+ *
396
+ * 字段:`title`、`message`、`confirmText`。
397
+ */
398
+ tryAgain?: TryAgainConfig;
399
+ /**
400
+ * 错误弹窗配置(旧版)
401
+ * @deprecated Use `error` instead (CMS field name)
402
+ */
312
403
  errorModalConfig?: ErrorModalConfig;
313
404
  /** 分享弹窗配置 */
314
405
  shareModalConfig?: ShareModalConfig;
406
+ /**
407
+ * 未登录时的提示文案(CMS: `loginPrompt`)
408
+ * @default "Please log in to participate in the lottery"
409
+ */
410
+ loginPrompt?: string;
411
+ /**
412
+ * 次数不足时的提示文案(CMS: `noChances`)
413
+ * @default "You have no chances left. Get more chances below!"
414
+ */
415
+ noChances?: string;
416
+ /**
417
+ * 机会进度前缀文案(CMS: `opportunitiesPrefix`)
418
+ * @default "Number of draws remaining today: "
419
+ */
420
+ opportunitiesPrefix?: string;
315
421
  /** 用户数据 */
316
422
  userData?: UserData;
317
423
  /**
318
424
  * 未登录时的提示文案
425
+ * @deprecated Use `loginPrompt` instead (CMS field name)
319
426
  * @default "Please log in to participate"
320
427
  */
321
428
  loginPromptText?: string;
@@ -326,6 +433,7 @@ export interface ProductLotteryProps {
326
433
  loginButtonText?: string;
327
434
  /**
328
435
  * 次数不足时的提示文案
436
+ * @deprecated Use `noChances` instead (CMS field name)
329
437
  * @default "You have no chances left"
330
438
  */
331
439
  noChancesText?: string;
@@ -336,7 +444,8 @@ export interface ProductLotteryProps {
336
444
  /** 复制优惠码回调 */
337
445
  onCopyCode?: (code: string) => void;
338
446
  /**
339
- * 机会进度文案
447
+ * 机会进度文案数组(旧版,首元素为前缀,次元素为后缀)
448
+ * @deprecated Use `opportunitiesPrefix` instead (CMS field name)
340
449
  * @default ["Number of draws remaining today:"]
341
450
  */
342
451
  opportunitiesText?: string[];
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var n in e)t(o,n,{get:e[n],enumerable:!0})},l=(o,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!s.call(o,i)&&i!==n&&t(o,i,{get:()=>e[i],enumerable:!(r=a(e,i))||r.enumerable});return o};var c=o=>l(t({},"__esModule",{value:!0}),o);var f={};g(f,{DEFAULT_CHANCE_TITLE:()=>C,DEFAULT_CTA_BUTTON:()=>h});module.exports=c(f);const h={text:"",style:"primary"},C="Want more chances to win?";
1
+ "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var d=(i,e)=>{for(var n in e)t(i,n,{get:e[n],enumerable:!0})},l=(i,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of s(e))!g.call(i,o)&&o!==n&&t(i,o,{get:()=>e[o],enumerable:!(r=a(e,o))||r.enumerable});return i};var c=i=>l(t({},"__esModule",{value:!0}),i);var C={};d(C,{DEFAULT_CHANCE_TITLE:()=>p,DEFAULT_CTA_BUTTON:()=>f});module.exports=c(C);const f={text:"",style:"primary"},p="Want more chances to win?";
2
2
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/ProductLottery/types.ts"],
4
- "sourcesContent": ["/**\n * ProductLottery - \u4EA7\u54C1\u62BD\u5956\u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49\n *\n * \u57FA\u4E8E\u5A92\u4F53\u5C55\u793A\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\u7684\u62BD\u5956\u7EC4\u4EF6\uFF0C\u70B9\u51FB CTA \u6309\u94AE\u89E6\u53D1\u62BD\u5956\u3002\n * \u5171\u4EAB\u7C7B\u578B\u6765\u81EA LotteryShared/types.ts\u3002\n *\n * @module ProductLotteryTypes\n * @date 2026-04-07\n */\n\nimport type {\n Prize,\n WinnerModalConfig,\n ShareModalConfig,\n ChanceMethod,\n WinningInfo,\n RulesModalConfig,\n ActionButtonConfig,\n MyRewardsModalConfig,\n ErrorModalConfig,\n UserData,\n ChanceMechanismType,\n ChanceInputConfig,\n} from '../LotteryShared/types.js'\n\nimport type { Theme, Media } from '../../types/props.js'\n\n// Re-export shared types for convenience\nexport type { Theme, Media }\n\n// ============================================================================\n// \u5A92\u4F53\u914D\u7F6E\u7C7B\u578B\n// ============================================================================\n\n/**\n * \u5A92\u4F53\u914D\u7F6E\uFF08MediaConfig\uFF09\n *\n * \u7CBE\u786E\u5BF9\u9F50 CMS block \u5B57\u6BB5\u7ED3\u6784\uFF0C\u76F4\u63A5\u6620\u5C04\u65E0\u9700\u989D\u5916\u8F6C\u6362\u3002\n *\n * @example\n * ```tsx\n * // \u56FE\u7247\u6A21\u5F0F\uFF08\u54CD\u5E94\u5F0F\uFF09\n * const imageMedia: MediaConfig = {\n * type: 'image',\n * image: { url: '/img/banner-sm.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageTablet: { url: '/img/banner-md.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageLaptop: { url: '/img/banner-lg.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageDesktop: { url: '/img/banner-xl.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageLgDesktop: { url: '/img/banner-xxl.jpg', alt: 'Banner', thumbnailURL: '' },\n * }\n *\n * // \u89C6\u9891\u6A21\u5F0F\n * const videoMedia: MediaConfig = {\n * type: 'video',\n * video: {\n * url: 'https://cdn.example.com/promo.mp4',\n * alt: 'Product Lottery Video',\n * thumbnailURL: 'https://cdn.example.com/poster.jpg',\n * mimeType: 'video/mp4',\n * },\n * }\n * ```\n */\nexport interface MediaConfig {\n /** \u5A92\u4F53\u7C7B\u578B */\n type: 'image' | 'video'\n\n // \u2014\u2014 \u56FE\u7247\u5B57\u6BB5\uFF08type === 'image' \u65F6\u4F7F\u7528\uFF09\u2014\u2014\n\n /** \u9ED8\u8BA4/\u79FB\u52A8\u7AEF\u56FE\u7247\uFF08<768px\uFF09 */\n image?: Media\n /** \u5E73\u677F\u7AEF\u56FE\u7247\uFF08\u2265768px\uFF09 */\n imageTablet?: Media\n /** \u5C0F\u684C\u9762\u56FE\u7247\uFF08\u22651025px\uFF09 */\n imageLaptop?: Media\n /** \u5927\u684C\u9762\u56FE\u7247\uFF08\u22651440px\uFF09 */\n imageDesktop?: Media\n /** \u8D85\u5927\u5C4F\u56FE\u7247\uFF08\u22651920px\uFF09 */\n imageLgDesktop?: Media\n\n // \u2014\u2014 \u89C6\u9891\u5B57\u6BB5\uFF08type === 'video' \u65F6\u4F7F\u7528\uFF09\u2014\u2014\n\n /** \u89C6\u9891\u5A92\u4F53\uFF08mimeType: 'video/mp4'\uFF0CthumbnailURL \u4F5C\u5C01\u9762\u56FE\uFF09 */\n video?: Media\n}\n\n// ============================================================================\n// CTA \u6309\u94AE\u914D\u7F6E\n// ============================================================================\n\n/**\n * CTA \u6309\u94AE\u914D\u7F6E\uFF08CtaButtonConfig\uFF09\n *\n * \u914D\u7F6E\u8986\u76D6\u5728\u5A92\u4F53\u533A\u57DF\u4E0A\u7684\u884C\u52A8\u53F7\u53EC\u6309\u94AE\u3002\n *\n * @example\n * ```tsx\n * const ctaButton: CtaButtonConfig = {\n * text: 'Join the Draw',\n * style: 'primary',\n * }\n * ```\n */\nexport interface CtaButtonConfig {\n /**\n * \u6309\u94AE\u6587\u6848\n * @default \"Join the Draw\"\n * @optional\n */\n text?: string\n\n /**\n * \u6309\u94AE\u6837\u5F0F\n * @default \"primary\"\n * @optional\n */\n style?: 'primary' | 'secondary' | 'outline'\n}\n\n// ============================================================================\n// Imperative Handle \u63A5\u53E3\n// ============================================================================\n\n/**\n * ProductLottery \u7EC4\u4EF6\u547D\u4EE4\u5F0F\u63A7\u5236\u63A5\u53E3\n *\n * \u901A\u8FC7 ref \u66B4\u9732\u7ED9\u7236\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u5916\u90E8\u63A7\u5236\u5F39\u7A97\u7B49\u72B6\u6001\u3002\n * \u4E0E WheelLotteryHandle \u4FDD\u6301\u4E00\u81F4\u7684\u5F39\u7A97\u63A7\u5236\u65B9\u6CD5\u3002\n *\n * @example\n * ```tsx\n * const lotteryRef = useRef<ProductLotteryHandle>(null)\n *\n * <ProductLottery ref={lotteryRef} prizes={prizes} media={media} />\n *\n * // \u5916\u90E8\u89E6\u53D1\u9519\u8BEF\u5F39\u7A97\n * lotteryRef.current?.showError({\n * title: 'Network Error',\n * message: 'Failed to connect to server',\n * confirmText: 'Retry'\n * })\n *\n * // \u663E\u793A\u89C4\u5219\u5F39\u7A97\n * lotteryRef.current?.showRules()\n *\n * // \u5173\u95ED\u6240\u6709\u5F39\u7A97\n * lotteryRef.current?.hideAllModals()\n * ```\n */\nexport interface ProductLotteryHandle {\n /** \u663E\u793A\u9519\u8BEF\u5F39\u7A97 */\n showError: (config: { message: string; title?: string; confirmText?: string }) => void\n\n /** \u9690\u85CF\u9519\u8BEF\u5F39\u7A97 */\n hideError: () => void\n\n /** \u663E\u793A\u672A\u4E2D\u5956\u5F39\u7A97 */\n showNoWin: (config?: { title?: string; message?: string; confirmText?: string }) => void\n\n /** \u9690\u85CF\u672A\u4E2D\u5956\u5F39\u7A97 */\n hideNoWin: () => void\n\n /** \u663E\u793A\u4E2D\u5956\u5F39\u7A97 */\n showWinner: (prize: Prize, config?: Partial<WinnerModalConfig>) => void\n\n /** \u9690\u85CF\u4E2D\u5956\u5F39\u7A97 */\n hideWinner: () => void\n\n /** \u663E\u793A\u89C4\u5219\u5F39\u7A97 */\n showRules: () => void\n\n /** \u9690\u85CF\u89C4\u5219\u5F39\u7A97 */\n hideRules: () => void\n\n /** \u663E\u793A\u6211\u7684\u5956\u52B1\u5F39\u7A97 */\n showRewards: () => void\n\n /** \u9690\u85CF\u6211\u7684\u5956\u52B1\u5F39\u7A97 */\n hideRewards: () => void\n\n /** \u663E\u793A\u5206\u4EAB\u5F39\u7A97 */\n showShare: (config?: Partial<ShareModalConfig>) => void\n\n /** \u9690\u85CF\u5206\u4EAB\u5F39\u7A97 */\n hideShare: () => void\n\n /** \u5173\u95ED\u6240\u6709\u5F39\u7A97 */\n hideAllModals: () => void\n}\n\n// ============================================================================\n// MediaDrawArea \u5B50\u7EC4\u4EF6 Props\n// ============================================================================\n\n/**\n * MediaDrawArea \u5B50\u7EC4\u4EF6 Props\n *\n * \u5A92\u4F53\u62BD\u5956\u533A\u57DF\uFF0C\u5C55\u793A\u56FE\u7247/\u89C6\u9891\u5E76\u53E0\u52A0 CTA \u6309\u94AE\u3002\n */\nexport interface MediaDrawAreaProps {\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: Theme\n\n /** \u5A92\u4F53\u914D\u7F6E\uFF08\u5FC5\u9700\uFF09 */\n media: MediaConfig\n\n /** CTA \u6309\u9492\u914D\u7F6E */\n ctaButton?: CtaButtonConfig\n\n /**\n * \u89C6\u9891\u81EA\u52A8\u64AD\u653E\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoAutoPlay?: boolean\n\n /**\n * \u89C6\u9891\u9759\u97F3\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoMuted?: boolean\n\n /**\n * \u89C6\u9891\u5FAA\u73AF\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoLoop?: boolean\n\n /** \u662F\u5426\u6B63\u5728\u62BD\u5956\u4E2D */\n isDrawing?: boolean\n\n /** \u662F\u5426\u7981\u7528\uFF08\u672A\u767B\u5F55\u6216\u65E0\u6B21\u6570\uFF09 */\n isDisabled?: boolean\n\n /** \u70B9\u51FB\u62BD\u5956\u56DE\u8C03 */\n onClick: () => void\n\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n\n /** \u70B9\u51FB\u8FFD\u8E2A\uFF1Adata-headless-type-name \u5C5E\u6027\u503C\uFF0C\u683C\u5F0F `{clickType}#{componentName}` */\n ctaTrackTypeName?: string\n\n /** \u70B9\u51FB\u8FFD\u8E2A\uFF1Adata-headless-title-desc-button \u5C5E\u6027\u503C\uFF0C\u683C\u5F0F `{title}#{desc}#{buttonName}` */\n ctaTrackTitleDescButton?: string\n}\n\n// ============================================================================\n// \u4E3B\u7EC4\u4EF6 Props\n// ============================================================================\n\n/**\n * ProductLottery \u7EC4\u4EF6 Props\n *\n * \u57FA\u4E8E\u5A92\u4F53\u5C55\u793A\u7684\u4EA7\u54C1\u62BD\u5956\u7EC4\u4EF6\u3002\u5DE6\u4FA7\u4E3A\u53EF\u70B9\u51FB\u7684\u5A92\u4F53\u533A\u57DF\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\n * \u53F3\u4FA7\u4E3A\u83B7\u53D6\u673A\u4F1A\u533A\u57DF\uFF0C\u5E95\u90E8\u4E3A\u5956\u54C1\u6C60\u3002\n *\n * @example\n * ```tsx\n * <ProductLottery\n * prizes={prizes}\n * media={{ type: 'image', src: '/banner.jpg', alt: 'Lottery' }}\n * ctaButton={{ text: 'Draw Now' }}\n * onDrawStart={async () => {\n * const result = await fetch('/api/lottery')\n * const data = await result.json()\n * return data.prizeId\n * }}\n * onDrawEnd={(prize) => console.log('Won:', prize.name)}\n * />\n * ```\n */\nexport interface ProductLotteryProps {\n // ========== \u5FC5\u9700 Props ==========\n\n /**\n * 8 \u4E2A\u5956\u54C1\u6570\u7EC4\uFF08\u5FC5\u9700\uFF09\n * @minLength 8\n * @maxLength 8\n */\n prizes: Prize[]\n\n /**\n * \u5A92\u4F53\u914D\u7F6E\uFF08\u5FC5\u9700\uFF09\n * \u914D\u7F6E\u5DE6\u4FA7\u62BD\u5956\u533A\u57DF\u5C55\u793A\u7684\u56FE\u7247\u6216\u89C6\u9891\uFF0C\u65E0\u9700 type/src \u5305\u88C5\u5C42\n */\n media: MediaConfig\n\n /**\n * \u89C6\u9891\u81EA\u52A8\u64AD\u653E\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoAutoPlay?: boolean\n\n /**\n * \u89C6\u9891\u9759\u97F3\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoMuted?: boolean\n\n /**\n * \u89C6\u9891\u5FAA\u73AF\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoLoop?: boolean\n\n // ========== \u4E3B\u9898\u548C\u6837\u5F0F ==========\n\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: Theme\n\n /** CTA \u6309\u94AE\u914D\u7F6E */\n ctaButton?: CtaButtonConfig\n\n // ========== \u83B7\u53D6\u673A\u4F1A\u533A\u57DF Props ==========\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u65B9\u5F0F\u6570\u7EC4\n * @optional\n */\n chanceMethods?: ChanceMethod[]\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u673A\u5236\u7C7B\u578B\n * @default \"methods\"\n * @optional\n */\n mechanismType?: ChanceMechanismType\n\n /**\n * \u8F93\u5165\u6846\u914D\u7F6E\uFF08\u5F53 mechanismType \u4E3A 'input' \u65F6\u4F7F\u7528\uFF09\n * @optional\n */\n inputConfig?: ChanceInputConfig\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u6807\u9898\n * @default \"Want more chances to win?\"\n * @optional\n */\n chanceTitle?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u526F\u6807\u9898 */\n chanceSubtitle?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u5E95\u90E8\u63D0\u793A */\n chanceFooterNote?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u65B9\u5F0F\u6587\u6848\u914D\u7F6E */\n chanceMethodsText?: {\n chanceBadgeText?: string\n completedText?: string\n usedText?: string\n loadingText?: string\n }\n\n // ========== \u4E2D\u5956\u4FE1\u606F Props ==========\n\n /**\n * \u4E2D\u5956\u4FE1\u606F\u6570\u7EC4\uFF0C\u7528\u4E8E\u5E95\u90E8\u6EDA\u52A8\u6761\u5C55\u793A\n * @default []\n */\n winningInfos?: WinningInfo[]\n\n /**\n * \u4E2D\u5956\u6EDA\u52A8 Ticker \u6587\u6848\u6A21\u677F\uFF0C\u652F\u6301 {{name}} \u548C {{prize}} \u53D8\u91CF\n * @default \"{{name}} just won {{prize}}!\"\n * @optional\n */\n winnerNameTemplate?: string\n\n /** \u5956\u54C1\u6C60\u5C55\u793A\u533A\u57DF\u6807\u9898 */\n prizesTitle?: string\n\n // ========== \u56DE\u8C03\u51FD\u6570 Props ==========\n\n /**\n * \u62BD\u5956\u5F00\u59CB\u65F6\u7684\u56DE\u8C03\uFF0C\u8FD4\u56DE Promise \u4EE5\u652F\u6301\u5F02\u6B65\u63A5\u53E3\u8C03\u7528\n * @returns Promise<string> - \u4E2D\u5956\u5956\u54C1\u7684 prizeKey\n */\n onDrawStart?: () => Promise<string>\n\n /**\n * \u62BD\u5956\u7ED3\u675F\u65F6\u7684\u56DE\u8C03\uFF0C\u4F20\u9012\u4E2D\u5956\u5956\u54C1\n * @param prize \u4E2D\u5956\u5956\u54C1\u5BF9\u8C61\n */\n onDrawEnd?: (prize: Prize) => void\n\n /**\n * \u62BD\u5956\u9519\u8BEF\u65F6\u7684\u56DE\u8C03\n * @param error \u9519\u8BEF\u4FE1\u606F\n */\n onDrawError?: (error: Error) => void\n\n // ========== \u5F39\u7A97\u914D\u7F6E Props ==========\n\n /** \u4E2D\u5956\u5F39\u7A97\u914D\u7F6E */\n winnerModalConfig?: WinnerModalConfig\n\n /** \u89C4\u5219\u5F39\u7A97\u914D\u7F6E */\n rulesModalConfig?: RulesModalConfig\n\n /** \u9876\u680F\u53F3\u4FA7\u8DF3\u8F6C\u6309\u94AE\u914D\u7F6E\uFF1B\u672A\u914D\u7F6E text \u6216 url \u65F6\u4E0D\u5C55\u793A */\n actionButtonConfig?: ActionButtonConfig\n\n /** \u6211\u7684\u5956\u52B1\u5F39\u7A97\u914D\u7F6E */\n myRewardsModalConfig?: MyRewardsModalConfig\n\n /** \u9519\u8BEF\u5F39\u7A97\u914D\u7F6E */\n errorModalConfig?: ErrorModalConfig\n\n /** \u5206\u4EAB\u5F39\u7A97\u914D\u7F6E */\n shareModalConfig?: ShareModalConfig\n\n // ========== \u7528\u6237\u76F8\u5173 Props ==========\n\n /** \u7528\u6237\u6570\u636E */\n userData?: UserData\n\n /**\n * \u672A\u767B\u5F55\u65F6\u7684\u63D0\u793A\u6587\u6848\n * @default \"Please log in to participate\"\n */\n loginPromptText?: string\n\n /**\n * \u767B\u5F55\u6309\u94AE\u6587\u6848\n * @default \"Log In\"\n */\n loginButtonText?: string\n\n /**\n * \u6B21\u6570\u4E0D\u8DB3\u65F6\u7684\u63D0\u793A\u6587\u6848\n * @default \"You have no chances left\"\n */\n noChancesText?: string\n\n /**\n * \u672A\u767B\u5F55\u65F6\u70B9\u51FB\u62BD\u5956\u7684\u56DE\u8C03\n */\n onLoginRequired?: () => void\n\n // ========== \u5176\u4ED6\u914D\u7F6E ==========\n\n /** \u590D\u5236\u4F18\u60E0\u7801\u56DE\u8C03 */\n onCopyCode?: (code: string) => void\n\n /**\n * \u673A\u4F1A\u8FDB\u5EA6\u6587\u6848\n * @default [\"Number of draws remaining today:\"]\n */\n opportunitiesText?: string[]\n\n /** \u81EA\u5B9A\u4E49 CSS \u7C7B\u540D */\n className?: string\n}\n\n// ============================================================================\n// \u9ED8\u8BA4\u914D\u7F6E\n// ============================================================================\n\n/** \u9ED8\u8BA4 CTA \u6309\u94AE\u914D\u7F6E */\nexport const DEFAULT_CTA_BUTTON: CtaButtonConfig = {\n text: '',\n style: 'primary',\n}\n\n/** \u9ED8\u8BA4\u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u6807\u9898 */\nexport const DEFAULT_CHANCE_TITLE = 'Want more chances to win?'\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAgdO,MAAMG,EAAsC,CACjD,KAAM,GACN,MAAO,SACT,EAGaD,EAAuB",
4
+ "sourcesContent": ["/**\n * ProductLottery - \u4EA7\u54C1\u62BD\u5956\u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49\n *\n * \u57FA\u4E8E\u5A92\u4F53\u5C55\u793A\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\u7684\u62BD\u5956\u7EC4\u4EF6\uFF0C\u70B9\u51FB CTA \u6309\u94AE\u89E6\u53D1\u62BD\u5956\u3002\n * \u5171\u4EAB\u7C7B\u578B\u6765\u81EA LotteryShared/types.ts\u3002\n *\n * @module ProductLotteryTypes\n * @date 2026-04-07\n */\n\nimport type {\n Prize,\n WinnerModalConfig,\n ShareModalConfig,\n ChanceMethod,\n WinningInfo,\n RulesModalConfig,\n ActionButtonConfig,\n MyRewardsModalConfig,\n ErrorModalConfig,\n UserData,\n ChanceMechanismType,\n ChanceInputConfig,\n} from '../LotteryShared/types.js'\n\nimport type { Theme, Media } from '../../types/props.js'\n\n// Re-export shared types for convenience\nexport type { Theme, Media }\n\n// ============================================================================\n// \u5A92\u4F53\u914D\u7F6E\u7C7B\u578B\n// ============================================================================\n\n/**\n * \u5A92\u4F53\u914D\u7F6E\uFF08MediaConfig\uFF09\n *\n * \u7CBE\u786E\u5BF9\u9F50 CMS block \u5B57\u6BB5\u7ED3\u6784\uFF0C\u76F4\u63A5\u6620\u5C04\u65E0\u9700\u989D\u5916\u8F6C\u6362\u3002\n *\n * @example\n * ```tsx\n * // \u56FE\u7247\u6A21\u5F0F\uFF08\u54CD\u5E94\u5F0F\uFF09\n * const imageMedia: MediaConfig = {\n * type: 'image',\n * image: { url: '/img/banner-sm.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageTablet: { url: '/img/banner-md.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageLaptop: { url: '/img/banner-lg.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageDesktop: { url: '/img/banner-xl.jpg', alt: 'Banner', thumbnailURL: '' },\n * imageLgDesktop: { url: '/img/banner-xxl.jpg', alt: 'Banner', thumbnailURL: '' },\n * }\n *\n * // \u89C6\u9891\u6A21\u5F0F\n * const videoMedia: MediaConfig = {\n * type: 'video',\n * video: {\n * url: 'https://cdn.example.com/promo.mp4',\n * alt: 'Product Lottery Video',\n * thumbnailURL: 'https://cdn.example.com/poster.jpg',\n * mimeType: 'video/mp4',\n * },\n * }\n * ```\n */\nexport interface MediaConfig {\n /** \u5A92\u4F53\u7C7B\u578B */\n type: 'image' | 'video'\n\n // \u2014\u2014 \u56FE\u7247\u5B57\u6BB5\uFF08type === 'image' \u65F6\u4F7F\u7528\uFF09\u2014\u2014\n\n /** \u9ED8\u8BA4/\u79FB\u52A8\u7AEF\u56FE\u7247\uFF08<768px\uFF09 */\n image?: Media\n /** \u5E73\u677F\u7AEF\u56FE\u7247\uFF08\u2265768px\uFF09 */\n imageTablet?: Media\n /** \u5C0F\u684C\u9762\u56FE\u7247\uFF08\u22651025px\uFF09 */\n imageLaptop?: Media\n /** \u5927\u684C\u9762\u56FE\u7247\uFF08\u22651440px\uFF09 */\n imageDesktop?: Media\n /** \u8D85\u5927\u5C4F\u56FE\u7247\uFF08\u22651920px\uFF09 */\n imageLgDesktop?: Media\n\n // \u2014\u2014 \u89C6\u9891\u5B57\u6BB5\uFF08type === 'video' \u65F6\u4F7F\u7528\uFF09\u2014\u2014\n\n /** \u89C6\u9891\u5A92\u4F53\uFF08mimeType: 'video/mp4'\uFF0CthumbnailURL \u4F5C\u5C01\u9762\u56FE\uFF09 */\n video?: Media\n}\n\n// ============================================================================\n// CTA \u6309\u94AE\u914D\u7F6E\n// ============================================================================\n\n/**\n * CTA \u6309\u94AE\u914D\u7F6E\uFF08CtaButtonConfig\uFF09\n *\n * \u914D\u7F6E\u8986\u76D6\u5728\u5A92\u4F53\u533A\u57DF\u4E0A\u7684\u884C\u52A8\u53F7\u53EC\u6309\u94AE\u3002\n *\n * @example\n * ```tsx\n * const ctaButton: CtaButtonConfig = {\n * text: 'Join the Draw',\n * style: 'primary',\n * }\n * ```\n */\nexport interface CtaButtonConfig {\n /**\n * \u6309\u94AE\u6587\u6848\n * @default \"Join the Draw\"\n * @optional\n */\n text?: string\n\n /**\n * \u6309\u94AE\u6837\u5F0F\n * @default \"primary\"\n * @optional\n */\n style?: 'primary' | 'secondary' | 'outline'\n}\n\n// ============================================================================\n// \u9519\u8BEF\u5F39\u7A97\u914D\u7F6E\uFF08CMS error group\uFF09\n// ============================================================================\n\n/**\n * \u9519\u8BEF\u5F39\u7A97\u914D\u7F6E\uFF08ErrorConfig\uFF09\n *\n * \u5BF9\u9F50 CMS `error` group \u5B57\u6BB5\u7ED3\u6784\u3002\n *\n * CMS \u5B57\u6BB5\u6620\u5C04:\n * - `title` \u2192 \u5F39\u7A97\u6807\u9898\n * - `defaultMessage` \u2192 \u9ED8\u8BA4\u9519\u8BEF\u5185\u5BB9\u6587\u6848\n * - `confirmButton` \u2192 \u786E\u8BA4\u6309\u94AE\u6587\u6848\n * - `exchangeFailedTitle` \u2192 \u5151\u6362\u5931\u8D25\u5F39\u7A97\u6807\u9898\n * - `exchangeFailedMessage` \u2192 \u5151\u6362\u5931\u8D25\u5F39\u7A97\u5185\u5BB9\n */\nexport interface ErrorConfig {\n title?: string\n defaultMessage?: string\n confirmButton?: string\n exchangeFailedTitle?: string\n exchangeFailedMessage?: string\n}\n\n// ============================================================================\n// \u672A\u4E2D\u5956\u5F39\u7A97\u914D\u7F6E\uFF08CMS tryAgain group\uFF09\n// ============================================================================\n\n/**\n * \u672A\u4E2D\u5956\u5F39\u7A97\u914D\u7F6E\uFF08TryAgainConfig\uFF09\n *\n * \u5BF9\u9F50 CMS `tryAgain` group \u5B57\u6BB5\u7ED3\u6784\u3002\n *\n * CMS \u5B57\u6BB5\u6620\u5C04:\n * - `title` \u2192 \u5F39\u7A97\u6807\u9898\n * - `message` \u2192 \u5185\u5BB9\u6587\u6848\n * - `confirmText` \u2192 \u786E\u8BA4\u6309\u94AE\u6587\u6848\n */\nexport interface TryAgainConfig {\n title?: string\n message?: string\n confirmText?: string\n}\n\n// ============================================================================\n// Imperative Handle \u63A5\u53E3\n// ============================================================================\n\n/**\n * ProductLottery \u7EC4\u4EF6\u547D\u4EE4\u5F0F\u63A7\u5236\u63A5\u53E3\n *\n * \u901A\u8FC7 ref \u66B4\u9732\u7ED9\u7236\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u5916\u90E8\u63A7\u5236\u5F39\u7A97\u7B49\u72B6\u6001\u3002\n * \u4E0E WheelLotteryHandle \u4FDD\u6301\u4E00\u81F4\u7684\u5F39\u7A97\u63A7\u5236\u65B9\u6CD5\u3002\n *\n * @example\n * ```tsx\n * const lotteryRef = useRef<ProductLotteryHandle>(null)\n *\n * <ProductLottery ref={lotteryRef} prizes={prizes} media={media} />\n *\n * // \u5916\u90E8\u89E6\u53D1\u9519\u8BEF\u5F39\u7A97\n * lotteryRef.current?.showError({\n * title: 'Network Error',\n * message: 'Failed to connect to server',\n * confirmText: 'Retry'\n * })\n *\n * // \u663E\u793A\u89C4\u5219\u5F39\u7A97\n * lotteryRef.current?.showRules()\n *\n * // \u5173\u95ED\u6240\u6709\u5F39\u7A97\n * lotteryRef.current?.hideAllModals()\n * ```\n */\nexport interface ProductLotteryHandle {\n /** \u663E\u793A\u9519\u8BEF\u5F39\u7A97 */\n showError: (config: { message: string; title?: string; confirmText?: string }) => void\n\n /** \u9690\u85CF\u9519\u8BEF\u5F39\u7A97 */\n hideError: () => void\n\n /** \u663E\u793A\u672A\u4E2D\u5956\u5F39\u7A97 */\n showNoWin: (config?: { title?: string; message?: string; confirmText?: string }) => void\n\n /** \u9690\u85CF\u672A\u4E2D\u5956\u5F39\u7A97 */\n hideNoWin: () => void\n\n /** \u663E\u793A\u4E2D\u5956\u5F39\u7A97 */\n showWinner: (prize: Prize, config?: Partial<WinnerModalConfig>) => void\n\n /** \u9690\u85CF\u4E2D\u5956\u5F39\u7A97 */\n hideWinner: () => void\n\n /** \u663E\u793A\u89C4\u5219\u5F39\u7A97 */\n showRules: () => void\n\n /** \u9690\u85CF\u89C4\u5219\u5F39\u7A97 */\n hideRules: () => void\n\n /** \u663E\u793A\u6211\u7684\u5956\u52B1\u5F39\u7A97 */\n showRewards: () => void\n\n /** \u9690\u85CF\u6211\u7684\u5956\u52B1\u5F39\u7A97 */\n hideRewards: () => void\n\n /** \u663E\u793A\u5206\u4EAB\u5F39\u7A97 */\n showShare: (config?: Partial<ShareModalConfig>) => void\n\n /** \u9690\u85CF\u5206\u4EAB\u5F39\u7A97 */\n hideShare: () => void\n\n /** \u5173\u95ED\u6240\u6709\u5F39\u7A97 */\n hideAllModals: () => void\n}\n\n// ============================================================================\n// MediaDrawArea \u5B50\u7EC4\u4EF6 Props\n// ============================================================================\n\n/**\n * MediaDrawArea \u5B50\u7EC4\u4EF6 Props\n *\n * \u5A92\u4F53\u62BD\u5956\u533A\u57DF\uFF0C\u5C55\u793A\u56FE\u7247/\u89C6\u9891\u5E76\u53E0\u52A0 CTA \u6309\u94AE\u3002\n */\nexport interface MediaDrawAreaProps {\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: Theme\n\n /** \u5A92\u4F53\u914D\u7F6E\uFF08\u5FC5\u9700\uFF09 */\n media: MediaConfig\n\n /** CTA \u6309\u9492\u914D\u7F6E */\n ctaButton?: CtaButtonConfig\n\n /**\n * \u89C6\u9891\u81EA\u52A8\u64AD\u653E\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoAutoPlay?: boolean\n\n /**\n * \u89C6\u9891\u9759\u97F3\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoMuted?: boolean\n\n /**\n * \u89C6\u9891\u5FAA\u73AF\uFF08\u4EC5 mimeType='video/mp4' \u65F6\u6709\u6548\uFF09\n * @default true\n */\n videoLoop?: boolean\n\n /** \u662F\u5426\u6B63\u5728\u62BD\u5956\u4E2D */\n isDrawing?: boolean\n\n /** \u662F\u5426\u7981\u7528\uFF08\u672A\u767B\u5F55\u6216\u65E0\u6B21\u6570\uFF09 */\n isDisabled?: boolean\n\n /** \u70B9\u51FB\u62BD\u5956\u56DE\u8C03 */\n onClick: () => void\n\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n\n /** \u70B9\u51FB\u8FFD\u8E2A\uFF1Adata-headless-type-name \u5C5E\u6027\u503C\uFF0C\u683C\u5F0F `{clickType}#{componentName}` */\n ctaTrackTypeName?: string\n\n /** \u70B9\u51FB\u8FFD\u8E2A\uFF1Adata-headless-title-desc-button \u5C5E\u6027\u503C\uFF0C\u683C\u5F0F `{title}#{desc}#{buttonName}` */\n ctaTrackTitleDescButton?: string\n}\n\n// ============================================================================\n// \u4E3B\u7EC4\u4EF6 Props\n// ============================================================================\n\n/**\n * ProductLottery \u7EC4\u4EF6 Props\n *\n * \u57FA\u4E8E\u5A92\u4F53\u5C55\u793A\u7684\u4EA7\u54C1\u62BD\u5956\u7EC4\u4EF6\u3002\u5DE6\u4FA7\u4E3A\u53EF\u70B9\u51FB\u7684\u5A92\u4F53\u533A\u57DF\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\n * \u53F3\u4FA7\u4E3A\u83B7\u53D6\u673A\u4F1A\u533A\u57DF\uFF0C\u5E95\u90E8\u4E3A\u5956\u54C1\u6C60\u3002\n *\n * @example\n * ```tsx\n * <ProductLottery\n * prizes={prizes}\n * media={{ type: 'image', src: '/banner.jpg', alt: 'Lottery' }}\n * ctaButton={{ text: 'Draw Now' }}\n * onDrawStart={async () => {\n * const result = await fetch('/api/lottery')\n * const data = await result.json()\n * return data.prizeId\n * }}\n * onDrawEnd={(prize) => console.log('Won:', prize.name)}\n * />\n * ```\n */\nexport interface ProductLotteryProps {\n // ========== \u5FC5\u9700 Props ==========\n\n /**\n * 8 \u4E2A\u5956\u54C1\u6570\u7EC4\uFF08\u5FC5\u9700\uFF09\n * @minLength 8\n * @maxLength 8\n */\n prizes: Prize[]\n\n /**\n * \u5A92\u4F53\u914D\u7F6E\uFF08\u5FC5\u9700\uFF09\n * \u914D\u7F6E\u5DE6\u4FA7\u62BD\u5956\u533A\u57DF\u5C55\u793A\u7684\u56FE\u7247\u6216\u89C6\u9891\uFF0C\u65E0\u9700 type/src \u5305\u88C5\u5C42\n */\n media: MediaConfig\n\n /**\n * \u89C6\u9891\u81EA\u52A8\u64AD\u653E\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoAutoPlay?: boolean\n\n /**\n * \u89C6\u9891\u9759\u97F3\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoMuted?: boolean\n\n /**\n * \u89C6\u9891\u5FAA\u73AF\uFF08\u5F53 media.mimeType === 'video/mp4' \u65F6\u751F\u6548\uFF09\n * @default true\n * @optional\n */\n videoLoop?: boolean\n\n // ========== \u4E3B\u9898\u548C\u6837\u5F0F ==========\n\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: Theme\n\n /** CTA \u6309\u94AE\u914D\u7F6E */\n ctaButton?: CtaButtonConfig\n\n // ========== CMS \u9876\u5C42\u5B57\u6BB5 ==========\n\n /**\n * \u62BD\u5956\u6D3B\u52A8\u7C7B\u578B\uFF08CMS: `dealsType`\uFF09\n * \u7528\u4E8E\u6807\u8BC6\u62BD\u5956\u6D3B\u52A8\u7684\u552F\u4E00\u7C7B\u578B\uFF0C\u5982\uFF1A`ipc-2614`\n * @optional\n */\n dealsType?: string\n\n // ========== \u83B7\u53D6\u673A\u4F1A\u533A\u57DF Props ==========\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u65B9\u5F0F\u6570\u7EC4\n * @optional\n */\n chanceMethods?: ChanceMethod[]\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u673A\u5236\u7C7B\u578B\n * @default \"methods\"\n * @optional\n */\n mechanismType?: ChanceMechanismType\n\n // \u2500\u2500 CMS flat input fields\uFF08mechanismType='input' \u65F6\u4F7F\u7528\uFF09\u2500\u2500\n\n /**\n * \u8F93\u5165\u6846\u5360\u4F4D\u6587\u672C\uFF08CMS: `inputPlaceholder`\uFF09\n * @default \"Enter your order number\"\n * @optional\n */\n inputPlaceholder?: string\n\n /**\n * \u63D0\u4EA4\u6309\u94AE\u6587\u6848\uFF08CMS: `inputSubmitText`\uFF09\n * @default \"Spin and Win\"\n * @optional\n */\n inputSubmitText?: string\n\n /**\n * \u8F93\u5165\u6846\u7C7B\u578B\uFF08CMS: `inputType`\uFF09\n * @default \"text\"\n * @optional\n */\n inputType?: 'text' | 'email' | 'number'\n\n /**\n * \u8F93\u5165\u683C\u5F0F\u9519\u8BEF\u63D0\u793A\u6587\u6848\uFF08CMS: `inputValidationErrorText`\uFF09\n * @optional\n */\n inputValidationErrorText?: string\n\n /**\n * \u8F93\u5165\u6846\u914D\u7F6E\uFF08\u5F53 mechanismType \u4E3A 'input' \u65F6\u4F7F\u7528\uFF09\n * @deprecated Use flat input fields (`inputPlaceholder`, `inputSubmitText`, `inputType`, `inputValidationErrorText`) instead (CMS field names)\n * @optional\n */\n inputConfig?: ChanceInputConfig\n\n /**\n * \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u6807\u9898\n * @default \"Want more chances to win?\"\n * @optional\n */\n chanceTitle?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u526F\u6807\u9898 */\n chanceSubtitle?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u5E95\u90E8\u63D0\u793A */\n chanceFooterNote?: string\n\n /** \u83B7\u53D6\u673A\u4F1A\u65B9\u5F0F\u6587\u6848\u914D\u7F6E */\n chanceMethodsText?: {\n chanceBadgeText?: string\n completedText?: string\n usedText?: string\n loadingText?: string\n }\n\n // ========== \u4E2D\u5956\u4FE1\u606F Props ==========\n\n /**\n * \u4E2D\u5956\u5F39\u7A97\u914D\u7F6E\uFF08CMS: `winningInfos` group \u2014 \u4E3B\u540D\u79F0\uFF09\n *\n * CMS \u4E2D `winningInfos` \u662F\u4E2D\u5956\u5F39\u7A97\u914D\u7F6E group\uFF0C\u5B57\u6BB5\uFF1A\n * `title`\u3001`confirmButton`\u3001`confirmUrl`\u3001`learnMoreUrl`\u3001`learnMoreText`\u3002\n */\n winningInfos?: WinnerModalConfig\n\n /**\n * \u5E95\u90E8\u6EDA\u52A8\u6761\u4E2D\u5956\u4EBA\u540D\u5355\u6570\u636E\n *\n * \u539F `winningInfos: WinningInfo[]` \u91CD\u547D\u540D\u4E3A `winnerTickerData` \u4EE5\u907F\u514D\n * \u4E0E CMS `winningInfos` group \u547D\u540D\u51B2\u7A81\u3002\n *\n * @default []\n */\n winnerTickerData?: WinningInfo[]\n\n /**\n * \u4E2D\u5956\u6EDA\u52A8 Ticker \u6587\u6848\u6A21\u677F\uFF0C\u652F\u6301 {{name}} \u548C {{prize}} \u53D8\u91CF\n * @default \"{{name}} just won {{prize}}!\"\n * @optional\n */\n winnerNameTemplate?: string\n\n /** \u5956\u54C1\u6C60\u5C55\u793A\u533A\u57DF\u6807\u9898 */\n prizesTitle?: string\n\n // ========== \u56DE\u8C03\u51FD\u6570 Props ==========\n\n /**\n * \u62BD\u5956\u5F00\u59CB\u65F6\u7684\u56DE\u8C03\uFF0C\u8FD4\u56DE Promise \u4EE5\u652F\u6301\u5F02\u6B65\u63A5\u53E3\u8C03\u7528\n * @returns Promise<string> - \u4E2D\u5956\u5956\u54C1\u7684 prizeKey\n */\n onDrawStart?: () => Promise<string>\n\n /**\n * \u62BD\u5956\u7ED3\u675F\u65F6\u7684\u56DE\u8C03\uFF0C\u4F20\u9012\u4E2D\u5956\u5956\u54C1\n * @param prize \u4E2D\u5956\u5956\u54C1\u5BF9\u8C61\n */\n onDrawEnd?: (prize: Prize) => void\n\n /**\n * \u62BD\u5956\u9519\u8BEF\u65F6\u7684\u56DE\u8C03\n * @param error \u9519\u8BEF\u4FE1\u606F\n */\n onDrawError?: (error: Error) => void\n\n // ========== \u5F39\u7A97\u914D\u7F6E Props ==========\n\n /** \u4E2D\u5956\u5F39\u7A97\u914D\u7F6E */\n winnerModalConfig?: WinnerModalConfig\n\n /** \u89C4\u5219\u5F39\u7A97\u914D\u7F6E */\n rulesModalConfig?: RulesModalConfig\n\n /** \u9876\u680F\u53F3\u4FA7\u8DF3\u8F6C\u6309\u94AE\u914D\u7F6E\uFF1B\u672A\u914D\u7F6E text \u6216 url \u65F6\u4E0D\u5C55\u793A */\n actionButtonConfig?: ActionButtonConfig\n\n /** \u6211\u7684\u5956\u52B1\u5F39\u7A97\u914D\u7F6E */\n myRewardsModalConfig?: MyRewardsModalConfig\n\n /**\n * \u9519\u8BEF\u5F39\u7A97\u914D\u7F6E\uFF08CMS: `error` group \u2014 \u4E3B\u540D\u79F0\uFF09\n *\n * \u5B57\u6BB5\uFF1A`title`\u3001`defaultMessage`\u3001`confirmButton`\u3001\n * `exchangeFailedTitle`\u3001`exchangeFailedMessage`\u3002\n */\n error?: ErrorConfig\n\n /**\n * \u672A\u4E2D\u5956\u5F39\u7A97\u914D\u7F6E\uFF08CMS: `tryAgain` group\uFF09\n *\n * \u5B57\u6BB5\uFF1A`title`\u3001`message`\u3001`confirmText`\u3002\n */\n tryAgain?: TryAgainConfig\n\n /**\n * \u9519\u8BEF\u5F39\u7A97\u914D\u7F6E\uFF08\u65E7\u7248\uFF09\n * @deprecated Use `error` instead (CMS field name)\n */\n errorModalConfig?: ErrorModalConfig\n\n /** \u5206\u4EAB\u5F39\u7A97\u914D\u7F6E */\n shareModalConfig?: ShareModalConfig\n\n // ========== CMS \u5E73\u94FA\u6587\u6848\u5B57\u6BB5\uFF08\u4E3B\u540D\u79F0\uFF09==========\n\n /**\n * \u672A\u767B\u5F55\u65F6\u7684\u63D0\u793A\u6587\u6848\uFF08CMS: `loginPrompt`\uFF09\n * @default \"Please log in to participate in the lottery\"\n */\n loginPrompt?: string\n\n /**\n * \u6B21\u6570\u4E0D\u8DB3\u65F6\u7684\u63D0\u793A\u6587\u6848\uFF08CMS: `noChances`\uFF09\n * @default \"You have no chances left. Get more chances below!\"\n */\n noChances?: string\n\n /**\n * \u673A\u4F1A\u8FDB\u5EA6\u524D\u7F00\u6587\u6848\uFF08CMS: `opportunitiesPrefix`\uFF09\n * @default \"Number of draws remaining today: \"\n */\n opportunitiesPrefix?: string\n\n // ========== \u7528\u6237\u76F8\u5173 Props ==========\n\n /** \u7528\u6237\u6570\u636E */\n userData?: UserData\n\n /**\n * \u672A\u767B\u5F55\u65F6\u7684\u63D0\u793A\u6587\u6848\n * @deprecated Use `loginPrompt` instead (CMS field name)\n * @default \"Please log in to participate\"\n */\n loginPromptText?: string\n\n /**\n * \u767B\u5F55\u6309\u94AE\u6587\u6848\n * @default \"Log In\"\n */\n loginButtonText?: string\n\n /**\n * \u6B21\u6570\u4E0D\u8DB3\u65F6\u7684\u63D0\u793A\u6587\u6848\n * @deprecated Use `noChances` instead (CMS field name)\n * @default \"You have no chances left\"\n */\n noChancesText?: string\n\n /**\n * \u672A\u767B\u5F55\u65F6\u70B9\u51FB\u62BD\u5956\u7684\u56DE\u8C03\n */\n onLoginRequired?: () => void\n\n // ========== \u5176\u4ED6\u914D\u7F6E ==========\n\n /** \u590D\u5236\u4F18\u60E0\u7801\u56DE\u8C03 */\n onCopyCode?: (code: string) => void\n\n /**\n * \u673A\u4F1A\u8FDB\u5EA6\u6587\u6848\u6570\u7EC4\uFF08\u65E7\u7248\uFF0C\u9996\u5143\u7D20\u4E3A\u524D\u7F00\uFF0C\u6B21\u5143\u7D20\u4E3A\u540E\u7F00\uFF09\n * @deprecated Use `opportunitiesPrefix` instead (CMS field name)\n * @default [\"Number of draws remaining today:\"]\n */\n opportunitiesText?: string[]\n\n /** \u81EA\u5B9A\u4E49 CSS \u7C7B\u540D */\n className?: string\n}\n\n// ============================================================================\n// \u9ED8\u8BA4\u914D\u7F6E\n// ============================================================================\n\n/** \u9ED8\u8BA4 CTA \u6309\u94AE\u914D\u7F6E */\nexport const DEFAULT_CTA_BUTTON: CtaButtonConfig = {\n text: '',\n style: 'primary',\n}\n\n/** \u9ED8\u8BA4\u83B7\u53D6\u673A\u4F1A\u533A\u57DF\u6807\u9898 */\nexport const DEFAULT_CHANCE_TITLE = 'Want more chances to win?'\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAwlBO,MAAMG,EAAsC,CACjD,KAAM,GACN,MAAO,SACT,EAGaD,EAAuB",
6
6
  "names": ["types_exports", "__export", "DEFAULT_CHANCE_TITLE", "DEFAULT_CTA_BUTTON", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var Y=Object.create;var T=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var _=(n,a)=>{for(var l in a)T(n,l,{get:a[l],enumerable:!0})},M=(n,a,l,x)=>{if(a&&typeof a=="object"||typeof a=="function")for(let c of G(a))!V.call(n,c)&&c!==l&&T(n,c,{get:()=>a[c],enumerable:!(x=F(a,c))||x.enumerable});return n};var $=(n,a,l)=>(l=n!=null?Y(I(n)):{},M(a||!n||!n.__esModule?T(l,"default",{value:n,enumerable:!0}):l,n)),q=n=>M(T({},"__esModule",{value:!0}),n);var Q={};_(Q,{default:()=>O});module.exports=q(Q);var e=require("react/jsx-runtime"),r=require("react"),E=require("../../helpers/utils.js"),D=require("../../shared/Styles.js"),m=require("../../components/index.js"),H=require("../../hooks/useExposure.js"),P=$(require("@radix-ui/react-popover"));const W="navigation",J="product_nav",K=n=>(0,e.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:(0,e.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),C=(0,r.forwardRef)(({className:n="",data:a,id:l,onAnchorClick:x,scrollOffsetExtra:c=0},B)=>{const{tabLinks:k=[],anchorList:p=[],textLink:u,buyBtn:f,theme:A="light"}=a||{},[z,b]=(0,r.useState)(""),g=(0,r.useRef)(null),y=(0,r.useRef)(!1),h=(0,r.useRef)(""),w=(0,r.useRef)(null),S=(0,r.useRef)(new Map);(0,r.useImperativeHandle)(B,()=>g.current),(0,H.useExposure)(g,{componentType:W,componentName:J}),(0,r.useEffect)(()=>{if(p.length===0)return;const t=setTimeout(()=>{const o=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const i=new Map;p.forEach(s=>{const d=document.getElementById(s.id);if(d){const N=d.getBoundingClientRect();i.set(s.id,N.top+window.scrollY)}}),S.current=i,window.scrollTo({top:o,behavior:"instant"})})},100);return()=>clearTimeout(t)},[p]),(0,r.useEffect)(()=>{if(p.length===0)return;const t=()=>{if(y.current){w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{y.current=!1,h.current&&(b(h.current),h.current="")},100);return}const i=g.current?.offsetHeight||0,s=window.scrollY+i+c+10;let d="";const N=S.current;for(let v=p.length-1;v>=0;v--){const R=p[v],L=N.get(R.id);if(L!==void 0&&s>=L){d=R.id;break}}if(!d&&p.length>0){const v=N.get(p[0].id);v!==void 0&&s<v&&(d="")}b(d)},o=setTimeout(()=>{t()},200);return window.addEventListener("scroll",t,{passive:!0}),()=>{clearTimeout(o),window.removeEventListener("scroll",t),w.current&&clearTimeout(w.current)}},[p,c]),(0,r.useEffect)(()=>{const t=document.querySelectorAll(".header"),o=[];return t.forEach(i=>{const s=i;o.push({element:s,originalPosition:s.style.position||getComputedStyle(s).position}),s.style.position="relative"}),()=>{o.forEach(({element:i,originalPosition:s})=>{i.style.position=s==="static"?"":s})}},[]);const j=(t,o)=>{t.preventDefault();const i=S.current.get(o);if(i===void 0){console.warn(`Cached position for "${o}" not found`);return}b(o),h.current=o,y.current=!0;const s=g.current?.offsetHeight||0,d=i-s-c;window.scrollTo({top:d,behavior:"smooth"}),window.history.pushState(null,"",`#${o}`)};return(0,e.jsxs)("div",{id:l,ref:g,className:(0,E.cn)("product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0",{"aiui-dark":A==="dark"},n),children:[(0,e.jsxs)("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[(0,e.jsxs)("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[(0,e.jsxs)("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[k.map((t,o)=>(0,e.jsxs)("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[(0,e.jsx)("a",{href:t.link,className:(0,E.cn)("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":o!==0,"hidden desktop:block":o===1}),children:(0,e.jsx)("span",{children:t.label})}),o!==k.length-1&&(0,e.jsx)("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},t.link||o)),k.length>1&&(0,e.jsxs)(P.Root,{children:[(0,e.jsx)(P.Trigger,{asChild:!0,children:(0,e.jsx)("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:(0,e.jsx)(K,{className:"text-[#1D1D1F]"})})}),(0,e.jsx)(P.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:k.slice(1).map(t=>(0,e.jsx)("a",{href:t.link,className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:(0,e.jsx)("span",{children:t.label})},t.link))})]})]}),(0,e.jsxs)("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[u?.link&&(0,e.jsx)("a",{href:u.link,target:u.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:(0,e.jsx)(m.Text,{size:2,className:"text-nowrap",children:u.text})}),f?.link&&(0,e.jsx)(m.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]}),(0,e.jsx)("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:p.map((t,o)=>(0,e.jsxs)("a",{href:`#${t.id}`,className:"product-nav-anchor-link",onClick:i=>{x?(i.preventDefault(),b(t.id),h.current=t.id,y.current=!0,x(t,o)):j(i,t.id)},children:[(0,e.jsx)(m.Text,{size:2,className:"product-nav-anchor-text text-nowrap",children:t.label}),(0,e.jsx)("div",{className:(0,E.cn)("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":z===t.id})})]},t.id))})]}),(0,e.jsxs)("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[u?.link&&(0,e.jsx)("a",{href:u.link,target:u.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer text-black",children:(0,e.jsx)(m.Text,{size:2,className:"text-nowrap",children:u.text})}),f?.link&&(0,e.jsx)(m.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]})});C.displayName="ProductNav";var O=(0,D.withLayout)(C);
1
+ "use strict";"use client";var F=Object.create;var N=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var $=(r,l)=>{for(var p in l)N(r,p,{get:l[p],enumerable:!0})},M=(r,l,p,x)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of I(l))!_.call(r,c)&&c!==p&&N(r,c,{get:()=>l[c],enumerable:!(x=G(l,c))||x.enumerable});return r};var q=(r,l,p)=>(p=r!=null?F(V(r)):{},M(l||!r||!r.__esModule?N(p,"default",{value:r,enumerable:!0}):p,r)),O=r=>M(N({},"__esModule",{value:!0}),r);var U={};$(U,{default:()=>Q});module.exports=O(U);var t=require("react/jsx-runtime"),n=require("react"),E=require("../../helpers/utils.js"),H=require("../../shared/Styles.js"),m=require("../../components/index.js"),A=require("../../hooks/useExposure.js"),S=q(require("@radix-ui/react-popover"));const W="navigation",J="product_nav",K=r=>(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:(0,t.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),D=(0,n.forwardRef)(({className:r="",data:l,id:p,onAnchorClick:x,scrollOffsetExtra:c=0},B)=>{const{tabLinks:k=[],anchorList:i=[],textLink:d,buyBtn:f,theme:z="light"}=l||{},[j,b]=(0,n.useState)(""),g=(0,n.useRef)(null),y=(0,n.useRef)(!1),h=(0,n.useRef)(""),w=(0,n.useRef)(null),P=(0,n.useRef)(new Map);(0,n.useImperativeHandle)(B,()=>g.current),(0,A.useExposure)(g,{componentType:W,componentName:J});const T=(0,n.useCallback)(()=>{if(i.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const o=new Map;i.forEach(a=>{const s=document.getElementById(a.id);if(s){const u=s.getBoundingClientRect();o.set(a.id,u.top+window.scrollY)}}),P.current=o,window.scrollTo({top:e,behavior:"instant"})})},[i]);(0,n.useEffect)(()=>{if(i.length===0)return;const e=setTimeout(T,100);return()=>clearTimeout(e)},[i,T]),(0,n.useEffect)(()=>{if(i.length===0)return;let e=null;const o=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(T,150)});return o.observe(document.body),()=>{o.disconnect(),e&&clearTimeout(e)}},[i,T]),(0,n.useEffect)(()=>{if(i.length===0)return;const e=()=>{if(y.current){w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{y.current=!1,h.current&&(b(h.current),h.current="")},100);return}const a=g.current?.offsetHeight||0,s=window.scrollY+a+c+10;let u="";const R=P.current;for(let v=i.length-1;v>=0;v--){const C=i[v],L=R.get(C.id);if(L!==void 0&&s>=L){u=C.id;break}}if(!u&&i.length>0){const v=R.get(i[0].id);v!==void 0&&s<v&&(u="")}b(u)},o=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(o),window.removeEventListener("scroll",e),w.current&&clearTimeout(w.current)}},[i,c]),(0,n.useEffect)(()=>{const e=document.querySelectorAll(".header"),o=[];return e.forEach(a=>{const s=a;o.push({element:s,originalPosition:s.style.position||getComputedStyle(s).position}),s.style.position="relative"}),()=>{o.forEach(({element:a,originalPosition:s})=>{a.style.position=s==="static"?"":s})}},[]);const Y=(e,o)=>{e.preventDefault();const a=P.current.get(o);if(a===void 0){console.warn(`Cached position for "${o}" not found`);return}b(o),h.current=o,y.current=!0;const s=g.current?.offsetHeight||0,u=a-s-c;window.scrollTo({top:u,behavior:"smooth"}),window.history.pushState(null,"",`#${o}`)};return(0,t.jsxs)("div",{id:p,ref:g,className:(0,E.cn)("product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0",{"aiui-dark":z==="dark"},r),children:[(0,t.jsxs)("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[(0,t.jsxs)("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[(0,t.jsxs)("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[k.map((e,o)=>(0,t.jsxs)("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[(0,t.jsx)("a",{href:e.link,className:(0,E.cn)("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":o!==0,"hidden desktop:block":o===1}),children:(0,t.jsx)("span",{children:e.label})}),o!==k.length-1&&(0,t.jsx)("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||o)),k.length>1&&(0,t.jsxs)(S.Root,{children:[(0,t.jsx)(S.Trigger,{asChild:!0,children:(0,t.jsx)("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:(0,t.jsx)(K,{className:"text-[#1D1D1F]"})})}),(0,t.jsx)(S.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:k.slice(1).map(e=>(0,t.jsx)("a",{href:e.link,className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:(0,t.jsx)("span",{children:e.label})},e.link))})]})]}),(0,t.jsxs)("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[d?.link&&(0,t.jsx)("a",{href:d.link,target:d.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:(0,t.jsx)(m.Text,{size:2,className:"text-nowrap",children:d.text})}),f?.link&&(0,t.jsx)(m.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]}),(0,t.jsx)("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:i.map((e,o)=>(0,t.jsxs)("a",{href:`#${e.id}`,className:"product-nav-anchor-link",onClick:a=>{x?(a.preventDefault(),b(e.id),h.current=e.id,y.current=!0,x(e,o)):Y(a,e.id)},children:[(0,t.jsx)(m.Text,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),(0,t.jsx)("div",{className:(0,E.cn)("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":j===e.id})})]},e.id))})]}),(0,t.jsxs)("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[d?.link&&(0,t.jsx)("a",{href:d.link,target:d.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer text-black",children:(0,t.jsx)(m.Text,{size:2,className:"text-nowrap",children:d.text})}),f?.link&&(0,t.jsx)(m.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]})});D.displayName="ProductNav";var Q=(0,H.withLayout)(D);
2
2
  //# sourceMappingURL=ProductNav.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/ProductNav/ProductNav.tsx"],
4
- "sourcesContent": ["'use client'\nimport { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Button, Text } from '../../components/index.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport type { ProductNavProps } from './types.js'\nimport * as Popover from '@radix-ui/react-popover'\n\nconst componentType = 'navigation'\nconst componentName = 'product_nav'\n\nconst ChevronDownIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n d=\"M5 7.5L10 12.5L15 7.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\nconst ProductNav = forwardRef<HTMLDivElement, ProductNavProps>(\n ({ className = '', data, id, onAnchorClick, scrollOffsetExtra = 0 }, ref) => {\n const { tabLinks = [], anchorList = [], textLink, buyBtn, theme = 'light' } = data || {}\n const [activeAnchorId, setActiveAnchorId] = useState('')\n const innerRef = useRef<HTMLDivElement>(null)\n const isScrollingRef = useRef(false) // \u6807\u8BB0\u662F\u5426\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\u4E2D\n const targetAnchorIdRef = useRef<string>('') // \u8BB0\u5F55\u70B9\u51FB\u76EE\u6807\u951A\u70B9\n const scrollEndTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null) // \u6EDA\u52A8\u7ED3\u675F\u68C0\u6D4B\u5B9A\u65F6\u5668\n const anchorPositionsRef = useRef<Map<string, number>>(new Map()) // \u7F13\u5B58\u951A\u70B9\u539F\u59CB\u4F4D\u7F6E\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n })\n\n // \u521D\u59CB\u5316\u65F6\u7F13\u5B58\u6240\u6709\u951A\u70B9\u7684\u539F\u59CB\u4F4D\u7F6E\uFF08\u5728\u6EDA\u52A8\u524D\u8BA1\u7B97\uFF0C\u907F\u514D sticky \u5F71\u54CD\uFF09\n useEffect(() => {\n if (anchorList.length === 0) return\n\n // \u9875\u9762\u52A0\u8F7D\u540E\u5EF6\u8FDF\u8BA1\u7B97\uFF0C\u786E\u4FDD\u5E03\u5C40\u5B8C\u6210\n const timer = setTimeout(() => {\n // \u5148\u6EDA\u52A8\u5230\u9876\u90E8\u8BA1\u7B97\u771F\u5B9E\u4F4D\u7F6E\n const originalScrollY = window.scrollY\n window.scrollTo({ top: 0, behavior: 'instant' as ScrollBehavior })\n\n // \u7B49\u5F85\u4E00\u5E27\u8BA9\u5E03\u5C40\u7A33\u5B9A\n requestAnimationFrame(() => {\n const positions = new Map<string, number>()\n anchorList.forEach(anchor => {\n const element = document.getElementById(anchor.id)\n if (element) {\n const rect = element.getBoundingClientRect()\n positions.set(anchor.id, rect.top + window.scrollY)\n }\n })\n anchorPositionsRef.current = positions\n\n // \u6062\u590D\u539F\u6765\u7684\u6EDA\u52A8\u4F4D\u7F6E\n window.scrollTo({ top: originalScrollY, behavior: 'instant' as ScrollBehavior })\n })\n }, 100)\n\n return () => clearTimeout(timer)\n }, [anchorList])\n\n // \u6EDA\u52A8\u76D1\u542C\uFF1A\u68C0\u6D4B\u5F53\u524D\u6EDA\u52A8\u4F4D\u7F6E\u5BF9\u5E94\u7684\u951A\u70B9\n useEffect(() => {\n if (anchorList.length === 0) return\n\n const handleScroll = () => {\n // \u5982\u679C\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\u4E2D\uFF0C\u4F7F\u7528 debounce \u68C0\u6D4B\u6EDA\u52A8\u7ED3\u675F\n if (isScrollingRef.current) {\n // \u6E05\u9664\u4E4B\u524D\u7684\u5B9A\u65F6\u5668\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n }\n // \u8BBE\u7F6E\u65B0\u7684\u5B9A\u65F6\u5668\uFF0C100ms \u6CA1\u6709\u65B0\u6EDA\u52A8\u4E8B\u4EF6\u5219\u8BA4\u4E3A\u6EDA\u52A8\u7ED3\u675F\n scrollEndTimerRef.current = setTimeout(() => {\n isScrollingRef.current = false\n // \u6EDA\u52A8\u7ED3\u675F\u540E\uFF0C\u786E\u4FDD\u9AD8\u4EAE\u505C\u7559\u5728\u76EE\u6807\u951A\u70B9\n if (targetAnchorIdRef.current) {\n setActiveAnchorId(targetAnchorIdRef.current)\n targetAnchorIdRef.current = ''\n }\n }, 100)\n return\n }\n\n const navHeight = innerRef.current?.offsetHeight || 0\n const scrollPosition = window.scrollY + navHeight + scrollOffsetExtra + 10 // 10px \u7F13\u51B2\n\n let currentAnchorId = ''\n\n // \u4F7F\u7528\u7F13\u5B58\u7684\u951A\u70B9\u4F4D\u7F6E\n const positions = anchorPositionsRef.current\n\n // \u904D\u5386\u6240\u6709\u951A\u70B9\uFF0C\u627E\u5230\u5F53\u524D\u6EDA\u52A8\u4F4D\u7F6E\u5BF9\u5E94\u7684\u951A\u70B9\n for (let i = anchorList.length - 1; i >= 0; i--) {\n const anchor = anchorList[i]\n const elementTop = positions.get(anchor.id)\n if (elementTop !== undefined && scrollPosition >= elementTop) {\n currentAnchorId = anchor.id\n break\n }\n }\n\n // \u5982\u679C\u6CA1\u6709\u627E\u5230\u4E14\u7F13\u5B58\u4E2D\u6709\u7B2C\u4E00\u4E2A\u951A\u70B9\u7684\u4F4D\u7F6E\n if (!currentAnchorId && anchorList.length > 0) {\n const firstElementTop = positions.get(anchorList[0].id)\n if (firstElementTop !== undefined && scrollPosition < firstElementTop) {\n currentAnchorId = ''\n }\n }\n\n setActiveAnchorId(currentAnchorId)\n }\n\n // \u5EF6\u8FDF\u521D\u59CB\u5316\uFF0C\u7B49\u5F85\u4F4D\u7F6E\u7F13\u5B58\u5B8C\u6210\n const timer = setTimeout(() => {\n handleScroll()\n }, 200)\n\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => {\n clearTimeout(timer)\n window.removeEventListener('scroll', handleScroll)\n // \u6E05\u7406\u5B9A\u65F6\u5668\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n }\n }\n }, [anchorList, scrollOffsetExtra])\n\n // \u8BBE\u7F6E\u9875\u9762\u4E2Dheader\u5143\u7D20\u7684position\u4E3Arelative\n useEffect(() => {\n const headerElements = document.querySelectorAll('.header')\n const originalStyles: { element: HTMLElement; originalPosition: string }[] = []\n\n headerElements.forEach(element => {\n const htmlElement = element as HTMLElement\n // \u4FDD\u5B58\u539F\u59CB\u6837\u5F0F\n originalStyles.push({\n element: htmlElement,\n originalPosition: htmlElement.style.position || getComputedStyle(htmlElement).position,\n })\n // \u8BBE\u7F6E\u4E3Arelative\n htmlElement.style.position = 'relative'\n })\n\n // \u6E05\u7406\u51FD\u6570\uFF1A\u6062\u590D\u539F\u59CB\u6837\u5F0F\n return () => {\n originalStyles.forEach(({ element, originalPosition }) => {\n element.style.position = originalPosition === 'static' ? '' : originalPosition\n })\n }\n }, [])\n\n // \u5904\u7406\u951A\u70B9\u70B9\u51FB\u6EDA\u52A8\n const handleAnchorClick = (e: React.MouseEvent, anchorId: string) => {\n e.preventDefault()\n\n // \u4F7F\u7528\u7F13\u5B58\u7684\u4F4D\u7F6E\n const elementAbsoluteTop = anchorPositionsRef.current.get(anchorId)\n if (elementAbsoluteTop === undefined) {\n console.warn(`Cached position for \"${anchorId}\" not found`)\n return\n }\n\n // \u7ACB\u5373\u66F4\u65B0\u9AD8\u4EAE\u72B6\u6001\uFF0C\u907F\u514D\u6EDA\u52A8\u8FC7\u7A0B\u4E2D\u95EA\u70C1\n setActiveAnchorId(anchorId)\n\n // \u8BB0\u5F55\u76EE\u6807\u951A\u70B9\uFF0C\u7528\u4E8E\u6EDA\u52A8\u7ED3\u675F\u540E\u786E\u4FDD\u9AD8\u4EAE\u6B63\u786E\n targetAnchorIdRef.current = anchorId\n\n // \u6807\u8BB0\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\uFF0C\u6682\u505C\u6EDA\u52A8\u76D1\u542C\n isScrollingRef.current = true\n\n // \u83B7\u53D6\u5BFC\u822A\u680F\u9AD8\u5EA6\n const navHeight = innerRef.current?.offsetHeight || 0\n\n // \u76EE\u6807\u6EDA\u52A8\u4F4D\u7F6E = \u7F13\u5B58\u7684\u5143\u7D20\u7EDD\u5BF9\u4F4D\u7F6E - \u5BFC\u822A\u680F\u9AD8\u5EA6 - \u989D\u5916\u504F\u79FB\n const targetPosition = elementAbsoluteTop - navHeight - scrollOffsetExtra\n\n // \u5E73\u6ED1\u6EDA\u52A8\u5230\u76EE\u6807\u4F4D\u7F6E\n window.scrollTo({\n top: targetPosition,\n behavior: 'smooth',\n })\n\n // \u66F4\u65B0 URL hash\uFF08\u4E0D\u89E6\u53D1\u9875\u9762\u8DF3\u8F6C\uFF09\n window.history.pushState(null, '', `#${anchorId}`)\n\n // \u6CE8\u610F\uFF1A\u6EDA\u52A8\u7ED3\u675F\u68C0\u6D4B\u7531 handleScroll \u4E2D\u7684 debounce \u903B\u8F91\u5904\u7406\n // \u4E0D\u518D\u4F7F\u7528\u56FA\u5B9A 800ms \u8D85\u65F6\uFF0C\u800C\u662F\u68C0\u6D4B\u5B9E\u9645\u6EDA\u52A8\u7ED3\u675F\n }\n\n return (\n <div\n id={id}\n ref={innerRef}\n className={cn(\n 'product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0',\n {\n 'aiui-dark': theme === 'dark',\n },\n className\n )}\n >\n <div className=\"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start\">\n {/* Tab Links Section */}\n <div className=\"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]\">\n <div className=\"product-nav-tabs flex flex-row items-center gap-[8px]\">\n {tabLinks.map((tabLink, index) => {\n return (\n <div key={tabLink.link || index} className=\"product-nav-tab-item flex items-center gap-[8px]\">\n <a\n href={tabLink.link}\n className={cn(\n 'product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]',\n {\n 'text-[#6D6D6F]': index !== 0,\n 'hidden desktop:block': index === 1,\n }\n )}\n // onClick={() => onShowSpecs?.(false)}\n >\n <span>{tabLink.label}</span>\n </a>\n {index !== tabLinks.length - 1 && (\n <div className=\"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]\" />\n )}\n </div>\n )\n })}\n\n {/* Mobile Dropdown */}\n {tabLinks.length > 1 && (\n <Popover.Root>\n <Popover.Trigger asChild>\n <button\n className=\"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block\"\n aria-label=\"More products\"\n >\n <ChevronDownIcon className=\"text-[#1D1D1F]\" />\n </button>\n </Popover.Trigger>\n <Popover.Content\n className=\"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]\"\n style={{\n boxShadow: '0px 4px 8px 0px rgba(0,0,0,0.12)',\n }}\n side=\"bottom\"\n align=\"end\"\n alignOffset={10}\n sideOffset={10}\n >\n {tabLinks.slice(1).map(tabLink => (\n <a\n key={tabLink.link}\n href={tabLink.link}\n className=\"product-nav-dropdown-link hover:text-brand-color text-nowrap\"\n >\n <span>{tabLink.label}</span>\n </a>\n ))}\n </Popover.Content>\n </Popover.Root>\n )}\n </div>\n\n {/* Mobile Actions */}\n <div className=\"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]\">\n {/* {specs?.text && (\n <Text\n size={2}\n onClick={handleSpecsClick}\n className=\"product-nav-specs-button cursor-pointer hover:text-brand-color\"\n >\n {specs.text}\n </Text>\n )} */}\n {textLink?.link && (\n <a\n href={textLink.link}\n target={textLink.target || '_self'}\n className=\"product-nav-text-link hover:text-brand-color cursor-pointer\"\n >\n <Text size={2} className=\"text-nowrap\">\n {textLink.text}\n </Text>\n </a>\n )}\n {buyBtn?.link && (\n <Button as=\"a\" href={buyBtn.link} size=\"sm\" className=\"product-nav-buy-button text-nowrap\">\n {buyBtn.text}\n </Button>\n )}\n </div>\n </div>\n\n {/* Anchor Navigation */}\n <div className=\"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\">\n {anchorList.map((anchor, index) => (\n <a\n key={anchor.id}\n href={`#${anchor.id}`}\n className=\"product-nav-anchor-link\"\n onClick={e => {\n // \u5982\u679C\u63D0\u4F9B\u4E86\u81EA\u5B9A\u4E49\u70B9\u51FB\u4E8B\u4EF6,\u4F7F\u7528\u81EA\u5B9A\u4E49\u4E8B\u4EF6\u5E76\u963B\u6B62\u9ED8\u8BA4\u884C\u4E3A\n if (onAnchorClick) {\n e.preventDefault()\n // \u6807\u8BB0\u7A0B\u5E8F\u5316\u6EDA\u52A8\uFF0C\u907F\u514D\u6EDA\u52A8\u8FC7\u7A0B\u4E2D\u9AD8\u4EAE\u95EA\u70C1\n setActiveAnchorId(anchor.id)\n targetAnchorIdRef.current = anchor.id\n isScrollingRef.current = true\n onAnchorClick(anchor, index)\n } else {\n // \u4F7F\u7528\u9ED8\u8BA4\u7684\u951A\u70B9\u6EDA\u52A8\u884C\u4E3A\uFF0C\u5E26\u504F\u79FB\u91CF\n handleAnchorClick(e, anchor.id)\n }\n }}\n >\n <Text size={2} className=\"product-nav-anchor-text text-nowrap\">\n {anchor.label}\n </Text>\n <div\n className={cn(\n 'product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent',\n {\n '!bg-brand-0': activeAnchorId === anchor.id,\n }\n )}\n />\n </a>\n ))}\n </div>\n </div>\n\n {/* Desktop Actions */}\n <div className=\"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]\">\n {/* {specs?.text && (\n <Text\n size={2}\n onClick={handleSpecsClick}\n className=\"product-nav-specs-button cursor-pointer text-black hover:text-brand-color\"\n >\n {specs.text}\n </Text>\n )} */}\n {textLink?.link && (\n <a\n href={textLink.link}\n target={textLink.target || '_self'}\n className=\"product-nav-text-link hover:text-brand-color cursor-pointer text-black\"\n >\n <Text size={2} className=\"text-nowrap\">\n {textLink.text}\n </Text>\n </a>\n )}\n {buyBtn?.link && (\n <Button as=\"a\" href={buyBtn.link} size=\"sm\" className=\"product-nav-buy-button text-nowrap\">\n {buyBtn.text}\n </Button>\n )}\n </div>\n </div>\n )\n }\n)\n\nProductNav.displayName = 'ProductNav'\n\nexport default withLayout(ProductNav)\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAeM,IAAAI,EAAA,6BAdNC,EAA6E,iBAC7EC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA6B,qCAC7BC,EAA4B,sCAE5BC,EAAyB,sCAEzB,MAAMC,EAAgB,aAChBC,EAAgB,cAEhBC,EAAmBC,MAErB,OAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA8B,GAAGA,EACjG,mBAAC,QACC,EAAE,wBACF,OAAO,eACP,YAAY,UACZ,cAAc,QACd,eAAe,QACjB,EACF,EAIEC,KAAa,cACjB,CAAC,CAAE,UAAAC,EAAY,GAAI,KAAAC,EAAM,GAAAC,EAAI,cAAAC,EAAe,kBAAAC,EAAoB,CAAE,EAAGC,IAAQ,CAC3E,KAAM,CAAE,SAAAC,EAAW,CAAC,EAAG,WAAAC,EAAa,CAAC,EAAG,SAAAC,EAAU,OAAAC,EAAQ,MAAAC,EAAQ,OAAQ,EAAIT,GAAQ,CAAC,EACjF,CAACU,EAAgBC,CAAiB,KAAI,YAAS,EAAE,EACjDC,KAAW,UAAuB,IAAI,EACtCC,KAAiB,UAAO,EAAK,EAC7BC,KAAoB,UAAe,EAAE,EACrCC,KAAoB,UAA6C,IAAI,EACrEC,KAAqB,UAA4B,IAAI,GAAK,KAEhE,uBAAoBZ,EAAK,IAAMQ,EAAS,OAAyB,KAEjE,eAAYA,EAAU,CACpB,cAAAlB,EACA,cAAAC,CACF,CAAC,KAGD,aAAU,IAAM,CACd,GAAIW,EAAW,SAAW,EAAG,OAG7B,MAAMW,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,IAAI,KAAMA,EAAO,KAAM,KAAK,KAAK,UAAU,qCACnD,SAAAA,EAAO,KACV,GAEJ,GACF,KAGA,OAAC,OAAI,UAAU,4LACZ,SAAAF,EAAW,IAAI,CAACc,EAAQoB,OACvB,QAAC,KAEC,KAAM,IAAIpB,EAAO,EAAE,GACnB,UAAU,0BACV,QAASe,GAAK,CAERjC,GACFiC,EAAE,eAAe,EAEjBxB,EAAkBS,EAAO,EAAE,EAC3BN,EAAkB,QAAUM,EAAO,GACnCP,EAAe,QAAU,GACzBX,EAAckB,EAAQoB,CAAK,GAG3BN,EAAkBC,EAAGf,EAAO,EAAE,CAElC,EAEA,oBAAC,QAAK,KAAM,EAAG,UAAU,sCACtB,SAAAA,EAAO,MACV,KACA,OAAC,OACC,aAAW,MACT,sHACA,CACE,cAAeV,IAAmBU,EAAO,EAC3C,CACF,EACF,IA5BKA,EAAO,EA6Bd,CACD,EACH,GACF,KAGA,QAAC,OAAI,UAAU,8GAUZ,UAAAb,GAAU,SACT,OAAC,KACC,KAAMA,EAAS,KACf,OAAQA,EAAS,QAAU,QAC3B,UAAU,yEAEV,mBAAC,QAAK,KAAM,EAAG,UAAU,cACtB,SAAAA,EAAS,KACZ,EACF,EAEDC,GAAQ,SACP,OAAC,UAAO,GAAG,IAAI,KAAMA,EAAO,KAAM,KAAK,KAAK,UAAU,qCACnD,SAAAA,EAAO,KACV,GAEJ,GACF,CAEJ,CACF,EAEAV,EAAW,YAAc,aAEzB,IAAOb,KAAQ,cAAWa,CAAU",
6
- "names": ["ProductNav_exports", "__export", "ProductNav_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_Styles", "import_components", "import_useExposure", "Popover", "componentType", "componentName", "ChevronDownIcon", "props", "ProductNav", "className", "data", "id", "onAnchorClick", "scrollOffsetExtra", "ref", "tabLinks", "anchorList", "textLink", "buyBtn", "theme", "activeAnchorId", "setActiveAnchorId", "innerRef", "isScrollingRef", "targetAnchorIdRef", "scrollEndTimerRef", "anchorPositionsRef", "timer", "originalScrollY", "positions", "anchor", "element", "rect", "handleScroll", "navHeight", "scrollPosition", "currentAnchorId", "i", "elementTop", "firstElementTop", "headerElements", "originalStyles", "htmlElement", "originalPosition", "handleAnchorClick", "e", "anchorId", "elementAbsoluteTop", "targetPosition", "tabLink", "index"]
4
+ "sourcesContent": ["'use client'\nimport { useState, useEffect, useCallback, forwardRef, useImperativeHandle, useRef } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Button, Text } from '../../components/index.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport type { ProductNavProps } from './types.js'\nimport * as Popover from '@radix-ui/react-popover'\n\nconst componentType = 'navigation'\nconst componentName = 'product_nav'\n\nconst ChevronDownIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path\n d=\"M5 7.5L10 12.5L15 7.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n\nconst ProductNav = forwardRef<HTMLDivElement, ProductNavProps>(\n ({ className = '', data, id, onAnchorClick, scrollOffsetExtra = 0 }, ref) => {\n const { tabLinks = [], anchorList = [], textLink, buyBtn, theme = 'light' } = data || {}\n const [activeAnchorId, setActiveAnchorId] = useState('')\n const innerRef = useRef<HTMLDivElement>(null)\n const isScrollingRef = useRef(false) // \u6807\u8BB0\u662F\u5426\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\u4E2D\n const targetAnchorIdRef = useRef<string>('') // \u8BB0\u5F55\u70B9\u51FB\u76EE\u6807\u951A\u70B9\n const scrollEndTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null) // \u6EDA\u52A8\u7ED3\u675F\u68C0\u6D4B\u5B9A\u65F6\u5668\n const anchorPositionsRef = useRef<Map<string, number>>(new Map()) // \u7F13\u5B58\u951A\u70B9\u539F\u59CB\u4F4D\u7F6E\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n })\n\n // \u7F13\u5B58\u6240\u6709\u951A\u70B9\u7684\u7EDD\u5BF9\u4F4D\u7F6E\uFF08\u6EDA\u52A8\u5230\u9876\u90E8\u540E\u8BA1\u7B97\uFF0C\u907F\u514D sticky \u5F71\u54CD\uFF09\n const updateAnchorPositions = useCallback(() => {\n if (anchorList.length === 0) return\n\n const originalScrollY = window.scrollY\n window.scrollTo({ top: 0, behavior: 'instant' as ScrollBehavior })\n\n requestAnimationFrame(() => {\n const positions = new Map<string, number>()\n anchorList.forEach(anchor => {\n const element = document.getElementById(anchor.id)\n if (element) {\n const rect = element.getBoundingClientRect()\n positions.set(anchor.id, rect.top + window.scrollY)\n }\n })\n anchorPositionsRef.current = positions\n\n window.scrollTo({ top: originalScrollY, behavior: 'instant' as ScrollBehavior })\n })\n }, [anchorList])\n\n // \u521D\u59CB\u5316\u65F6\u7F13\u5B58\u6240\u6709\u951A\u70B9\u7684\u539F\u59CB\u4F4D\u7F6E\n useEffect(() => {\n if (anchorList.length === 0) return\n\n // \u9875\u9762\u52A0\u8F7D\u540E\u5EF6\u8FDF\u8BA1\u7B97\uFF0C\u786E\u4FDD\u5E03\u5C40\u5B8C\u6210\n const timer = setTimeout(updateAnchorPositions, 100)\n\n return () => clearTimeout(timer)\n }, [anchorList, updateAnchorPositions])\n\n // \u76D1\u542C body \u9AD8\u5EA6\u53D8\u5316\uFF0C\u9AD8\u5EA6\u6539\u53D8\u65F6\u91CD\u65B0\u8BA1\u7B97\u951A\u70B9\u4F4D\u7F6E\n useEffect(() => {\n if (anchorList.length === 0) return\n\n let resizeTimer: ReturnType<typeof setTimeout> | null = null\n\n const observer = new ResizeObserver(() => {\n // debounce\uFF0C\u907F\u514D\u9AD8\u9891\u89E6\u53D1\n if (resizeTimer) clearTimeout(resizeTimer)\n resizeTimer = setTimeout(updateAnchorPositions, 150)\n })\n\n observer.observe(document.body)\n\n return () => {\n observer.disconnect()\n if (resizeTimer) clearTimeout(resizeTimer)\n }\n }, [anchorList, updateAnchorPositions])\n\n // \u6EDA\u52A8\u76D1\u542C\uFF1A\u68C0\u6D4B\u5F53\u524D\u6EDA\u52A8\u4F4D\u7F6E\u5BF9\u5E94\u7684\u951A\u70B9\n useEffect(() => {\n if (anchorList.length === 0) return\n\n const handleScroll = () => {\n // \u5982\u679C\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\u4E2D\uFF0C\u4F7F\u7528 debounce \u68C0\u6D4B\u6EDA\u52A8\u7ED3\u675F\n if (isScrollingRef.current) {\n // \u6E05\u9664\u4E4B\u524D\u7684\u5B9A\u65F6\u5668\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n }\n // \u8BBE\u7F6E\u65B0\u7684\u5B9A\u65F6\u5668\uFF0C100ms \u6CA1\u6709\u65B0\u6EDA\u52A8\u4E8B\u4EF6\u5219\u8BA4\u4E3A\u6EDA\u52A8\u7ED3\u675F\n scrollEndTimerRef.current = setTimeout(() => {\n isScrollingRef.current = false\n // \u6EDA\u52A8\u7ED3\u675F\u540E\uFF0C\u786E\u4FDD\u9AD8\u4EAE\u505C\u7559\u5728\u76EE\u6807\u951A\u70B9\n if (targetAnchorIdRef.current) {\n setActiveAnchorId(targetAnchorIdRef.current)\n targetAnchorIdRef.current = ''\n }\n }, 100)\n return\n }\n\n const navHeight = innerRef.current?.offsetHeight || 0\n const scrollPosition = window.scrollY + navHeight + scrollOffsetExtra + 10 // 10px \u7F13\u51B2\n\n let currentAnchorId = ''\n\n // \u4F7F\u7528\u7F13\u5B58\u7684\u951A\u70B9\u4F4D\u7F6E\n const positions = anchorPositionsRef.current\n\n // \u904D\u5386\u6240\u6709\u951A\u70B9\uFF0C\u627E\u5230\u5F53\u524D\u6EDA\u52A8\u4F4D\u7F6E\u5BF9\u5E94\u7684\u951A\u70B9\n for (let i = anchorList.length - 1; i >= 0; i--) {\n const anchor = anchorList[i]\n const elementTop = positions.get(anchor.id)\n if (elementTop !== undefined && scrollPosition >= elementTop) {\n currentAnchorId = anchor.id\n break\n }\n }\n\n // \u5982\u679C\u6CA1\u6709\u627E\u5230\u4E14\u7F13\u5B58\u4E2D\u6709\u7B2C\u4E00\u4E2A\u951A\u70B9\u7684\u4F4D\u7F6E\n if (!currentAnchorId && anchorList.length > 0) {\n const firstElementTop = positions.get(anchorList[0].id)\n if (firstElementTop !== undefined && scrollPosition < firstElementTop) {\n currentAnchorId = ''\n }\n }\n\n setActiveAnchorId(currentAnchorId)\n }\n\n // \u5EF6\u8FDF\u521D\u59CB\u5316\uFF0C\u7B49\u5F85\u4F4D\u7F6E\u7F13\u5B58\u5B8C\u6210\n const timer = setTimeout(() => {\n handleScroll()\n }, 200)\n\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => {\n clearTimeout(timer)\n window.removeEventListener('scroll', handleScroll)\n // \u6E05\u7406\u5B9A\u65F6\u5668\n if (scrollEndTimerRef.current) {\n clearTimeout(scrollEndTimerRef.current)\n }\n }\n }, [anchorList, scrollOffsetExtra])\n\n // \u8BBE\u7F6E\u9875\u9762\u4E2Dheader\u5143\u7D20\u7684position\u4E3Arelative\n useEffect(() => {\n const headerElements = document.querySelectorAll('.header')\n const originalStyles: { element: HTMLElement; originalPosition: string }[] = []\n\n headerElements.forEach(element => {\n const htmlElement = element as HTMLElement\n // \u4FDD\u5B58\u539F\u59CB\u6837\u5F0F\n originalStyles.push({\n element: htmlElement,\n originalPosition: htmlElement.style.position || getComputedStyle(htmlElement).position,\n })\n // \u8BBE\u7F6E\u4E3Arelative\n htmlElement.style.position = 'relative'\n })\n\n // \u6E05\u7406\u51FD\u6570\uFF1A\u6062\u590D\u539F\u59CB\u6837\u5F0F\n return () => {\n originalStyles.forEach(({ element, originalPosition }) => {\n element.style.position = originalPosition === 'static' ? '' : originalPosition\n })\n }\n }, [])\n\n // \u5904\u7406\u951A\u70B9\u70B9\u51FB\u6EDA\u52A8\n const handleAnchorClick = (e: React.MouseEvent, anchorId: string) => {\n e.preventDefault()\n\n // \u4F7F\u7528\u7F13\u5B58\u7684\u4F4D\u7F6E\n const elementAbsoluteTop = anchorPositionsRef.current.get(anchorId)\n if (elementAbsoluteTop === undefined) {\n console.warn(`Cached position for \"${anchorId}\" not found`)\n return\n }\n\n // \u7ACB\u5373\u66F4\u65B0\u9AD8\u4EAE\u72B6\u6001\uFF0C\u907F\u514D\u6EDA\u52A8\u8FC7\u7A0B\u4E2D\u95EA\u70C1\n setActiveAnchorId(anchorId)\n\n // \u8BB0\u5F55\u76EE\u6807\u951A\u70B9\uFF0C\u7528\u4E8E\u6EDA\u52A8\u7ED3\u675F\u540E\u786E\u4FDD\u9AD8\u4EAE\u6B63\u786E\n targetAnchorIdRef.current = anchorId\n\n // \u6807\u8BB0\u6B63\u5728\u7A0B\u5E8F\u5316\u6EDA\u52A8\uFF0C\u6682\u505C\u6EDA\u52A8\u76D1\u542C\n isScrollingRef.current = true\n\n // \u83B7\u53D6\u5BFC\u822A\u680F\u9AD8\u5EA6\n const navHeight = innerRef.current?.offsetHeight || 0\n\n // \u76EE\u6807\u6EDA\u52A8\u4F4D\u7F6E = \u7F13\u5B58\u7684\u5143\u7D20\u7EDD\u5BF9\u4F4D\u7F6E - \u5BFC\u822A\u680F\u9AD8\u5EA6 - \u989D\u5916\u504F\u79FB\n const targetPosition = elementAbsoluteTop - navHeight - scrollOffsetExtra\n\n // \u5E73\u6ED1\u6EDA\u52A8\u5230\u76EE\u6807\u4F4D\u7F6E\n window.scrollTo({\n top: targetPosition,\n behavior: 'smooth',\n })\n\n // \u66F4\u65B0 URL hash\uFF08\u4E0D\u89E6\u53D1\u9875\u9762\u8DF3\u8F6C\uFF09\n window.history.pushState(null, '', `#${anchorId}`)\n\n // \u6CE8\u610F\uFF1A\u6EDA\u52A8\u7ED3\u675F\u68C0\u6D4B\u7531 handleScroll \u4E2D\u7684 debounce \u903B\u8F91\u5904\u7406\n // \u4E0D\u518D\u4F7F\u7528\u56FA\u5B9A 800ms \u8D85\u65F6\uFF0C\u800C\u662F\u68C0\u6D4B\u5B9E\u9645\u6EDA\u52A8\u7ED3\u675F\n }\n\n return (\n <div\n id={id}\n ref={innerRef}\n className={cn(\n 'product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0',\n {\n 'aiui-dark': theme === 'dark',\n },\n className\n )}\n >\n <div className=\"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start\">\n {/* Tab Links Section */}\n <div className=\"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]\">\n <div className=\"product-nav-tabs flex flex-row items-center gap-[8px]\">\n {tabLinks.map((tabLink, index) => {\n return (\n <div key={tabLink.link || index} className=\"product-nav-tab-item flex items-center gap-[8px]\">\n <a\n href={tabLink.link}\n className={cn(\n 'product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]',\n {\n 'text-[#6D6D6F]': index !== 0,\n 'hidden desktop:block': index === 1,\n }\n )}\n // onClick={() => onShowSpecs?.(false)}\n >\n <span>{tabLink.label}</span>\n </a>\n {index !== tabLinks.length - 1 && (\n <div className=\"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]\" />\n )}\n </div>\n )\n })}\n\n {/* Mobile Dropdown */}\n {tabLinks.length > 1 && (\n <Popover.Root>\n <Popover.Trigger asChild>\n <button\n className=\"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block\"\n aria-label=\"More products\"\n >\n <ChevronDownIcon className=\"text-[#1D1D1F]\" />\n </button>\n </Popover.Trigger>\n <Popover.Content\n className=\"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]\"\n style={{\n boxShadow: '0px 4px 8px 0px rgba(0,0,0,0.12)',\n }}\n side=\"bottom\"\n align=\"end\"\n alignOffset={10}\n sideOffset={10}\n >\n {tabLinks.slice(1).map(tabLink => (\n <a\n key={tabLink.link}\n href={tabLink.link}\n className=\"product-nav-dropdown-link hover:text-brand-color text-nowrap\"\n >\n <span>{tabLink.label}</span>\n </a>\n ))}\n </Popover.Content>\n </Popover.Root>\n )}\n </div>\n\n {/* Mobile Actions */}\n <div className=\"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]\">\n {/* {specs?.text && (\n <Text\n size={2}\n onClick={handleSpecsClick}\n className=\"product-nav-specs-button cursor-pointer hover:text-brand-color\"\n >\n {specs.text}\n </Text>\n )} */}\n {textLink?.link && (\n <a\n href={textLink.link}\n target={textLink.target || '_self'}\n className=\"product-nav-text-link hover:text-brand-color cursor-pointer\"\n >\n <Text size={2} className=\"text-nowrap\">\n {textLink.text}\n </Text>\n </a>\n )}\n {buyBtn?.link && (\n <Button as=\"a\" href={buyBtn.link} size=\"sm\" className=\"product-nav-buy-button text-nowrap\">\n {buyBtn.text}\n </Button>\n )}\n </div>\n </div>\n\n {/* Anchor Navigation */}\n <div className=\"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\">\n {anchorList.map((anchor, index) => (\n <a\n key={anchor.id}\n href={`#${anchor.id}`}\n className=\"product-nav-anchor-link\"\n onClick={e => {\n // \u5982\u679C\u63D0\u4F9B\u4E86\u81EA\u5B9A\u4E49\u70B9\u51FB\u4E8B\u4EF6,\u4F7F\u7528\u81EA\u5B9A\u4E49\u4E8B\u4EF6\u5E76\u963B\u6B62\u9ED8\u8BA4\u884C\u4E3A\n if (onAnchorClick) {\n e.preventDefault()\n // \u6807\u8BB0\u7A0B\u5E8F\u5316\u6EDA\u52A8\uFF0C\u907F\u514D\u6EDA\u52A8\u8FC7\u7A0B\u4E2D\u9AD8\u4EAE\u95EA\u70C1\n setActiveAnchorId(anchor.id)\n targetAnchorIdRef.current = anchor.id\n isScrollingRef.current = true\n onAnchorClick(anchor, index)\n } else {\n // \u4F7F\u7528\u9ED8\u8BA4\u7684\u951A\u70B9\u6EDA\u52A8\u884C\u4E3A\uFF0C\u5E26\u504F\u79FB\u91CF\n handleAnchorClick(e, anchor.id)\n }\n }}\n >\n <Text size={2} className=\"product-nav-anchor-text text-nowrap\">\n {anchor.label}\n </Text>\n <div\n className={cn(\n 'product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent',\n {\n '!bg-brand-0': activeAnchorId === anchor.id,\n }\n )}\n />\n </a>\n ))}\n </div>\n </div>\n\n {/* Desktop Actions */}\n <div className=\"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]\">\n {/* {specs?.text && (\n <Text\n size={2}\n onClick={handleSpecsClick}\n className=\"product-nav-specs-button cursor-pointer text-black hover:text-brand-color\"\n >\n {specs.text}\n </Text>\n )} */}\n {textLink?.link && (\n <a\n href={textLink.link}\n target={textLink.target || '_self'}\n className=\"product-nav-text-link hover:text-brand-color cursor-pointer text-black\"\n >\n <Text size={2} className=\"text-nowrap\">\n {textLink.text}\n </Text>\n </a>\n )}\n {buyBtn?.link && (\n <Button as=\"a\" href={buyBtn.link} size=\"sm\" className=\"product-nav-buy-button text-nowrap\">\n {buyBtn.text}\n </Button>\n )}\n </div>\n </div>\n )\n }\n)\n\nProductNav.displayName = 'ProductNav'\n\nexport default withLayout(ProductNav)\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAeM,IAAAI,EAAA,6BAdNC,EAA0F,iBAC1FC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAA6B,qCAC7BC,EAA4B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AAAA,EAAS,KACZ,EACF,EAEDC,GAAQ,SACP,OAAC,UAAO,GAAG,IAAI,KAAMA,EAAO,KAAM,KAAK,KAAK,UAAU,qCACnD,SAAAA,EAAO,KACV,GAEJ,GACF,KAGA,OAAC,OAAI,UAAU,4LACZ,SAAAF,EAAW,IAAI,CAACc,EAAQsB,OACvB,QAAC,KAEC,KAAM,IAAItB,EAAO,EAAE,GACnB,UAAU,0BACV,QAASuB,GAAK,CAERzC,GACFyC,EAAE,eAAe,EAEjBhC,EAAkBS,EAAO,EAAE,EAC3BN,EAAkB,QAAUM,EAAO,GACnCP,EAAe,QAAU,GACzBX,EAAckB,EAAQsB,CAAK,GAG3BL,EAAkBM,EAAGvB,EAAO,EAAE,CAElC,EAEA,oBAAC,QAAK,KAAM,EAAG,UAAU,sCACtB,SAAAA,EAAO,MACV,KACA,OAAC,OACC,aAAW,MACT,sHACA,CACE,cAAeV,IAAmBU,EAAO,EAC3C,CACF,EACF,IA5BKA,EAAO,EA6Bd,CACD,EACH,GACF,KAGA,QAAC,OAAI,UAAU,8GAUZ,UAAAb,GAAU,SACT,OAAC,KACC,KAAMA,EAAS,KACf,OAAQA,EAAS,QAAU,QAC3B,UAAU,yEAEV,mBAAC,QAAK,KAAM,EAAG,UAAU,cACtB,SAAAA,EAAS,KACZ,EACF,EAEDC,GAAQ,SACP,OAAC,UAAO,GAAG,IAAI,KAAMA,EAAO,KAAM,KAAK,KAAK,UAAU,qCACnD,SAAAA,EAAO,KACV,GAEJ,GACF,CAEJ,CACF,EAEAV,EAAW,YAAc,aAEzB,IAAOb,KAAQ,cAAWa,CAAU",
6
+ "names": ["ProductNav_exports", "__export", "ProductNav_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_Styles", "import_components", "import_useExposure", "Popover", "componentType", "componentName", "ChevronDownIcon", "props", "ProductNav", "className", "data", "id", "onAnchorClick", "scrollOffsetExtra", "ref", "tabLinks", "anchorList", "textLink", "buyBtn", "theme", "activeAnchorId", "setActiveAnchorId", "innerRef", "isScrollingRef", "targetAnchorIdRef", "scrollEndTimerRef", "anchorPositionsRef", "updateAnchorPositions", "originalScrollY", "positions", "anchor", "element", "rect", "timer", "resizeTimer", "observer", "handleScroll", "navHeight", "scrollPosition", "currentAnchorId", "i", "elementTop", "firstElementTop", "headerElements", "originalStyles", "htmlElement", "originalPosition", "handleAnchorClick", "anchorId", "elementAbsoluteTop", "targetPosition", "tabLink", "index", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var w=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var M=(r,e)=>{for(var l in e)c(r,l,{get:e[l],enumerable:!0})},f=(r,e,l,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of G(e))!D.call(r,o)&&o!==l&&c(r,o,{get:()=>e[o],enumerable:!(p=E(e,o))||p.enumerable});return r};var s=(r,e,l)=>(l=r!=null?w(x(r)):{},f(e||!r||!r.__esModule?c(l,"default",{value:r,enumerable:!0}):l,r)),R=r=>f(c({},"__esModule",{value:!0}),r);var H={};M(H,{default:()=>F});module.exports=R(H);var a=require("react/jsx-runtime"),n=require("../../shared/Styles.js"),d=s(require("../../components/tabs.js")),m=require("../../helpers/index.js"),b=s(require("react")),h=s(require("../ShelfDisplay/index.js")),k=s(require("../AccordionCards/index.js")),N=s(require("../Faq/index.js")),g=s(require("../MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js")),T=s(require("../Title/index.js")),v=s(require("../Graphic/index.js")),L=s(require("../WhyChoose/index.js")),P=s(require("../BrandEquity/index.js")),A=s(require("../BrandCardLink/index.js"));const y=b.default.forwardRef(({data:r,className:e},l)=>{const{theme:p,shape:o,align:q,tabs:t=[],sectionTitle:u}=r,B=i=>i?.blockType==="ipc-shelfdisplay"?(0,a.jsx)(h.default,{data:i}):i?.blockType==="ipc-multiLayoutGraphicBlock"?(0,a.jsx)(g.default,{data:i}):i?.blockType==="ipc-accordioncards"?(0,a.jsx)(k.default,{data:i}):i?.blockType==="ipc-faq"?(0,a.jsx)(N.default,{data:i}):i?.blockType==="ipc-graphic"?(0,a.jsx)(v.default,{data:i}):i?.blockType==="ipc-whychoose"?(0,a.jsx)(L.default,{data:i}):i?.blockType==="ipc-brand-equity"?(0,a.jsx)(P.default,{data:i}):i?.blockType==="ipc-brand-card-link"?(0,a.jsx)(A.default,{data:i}):null;return(0,a.jsxs)("section",{ref:l,className:(0,m.cn)(p==="dark"?"aiui-dark":"",e),children:[u&&(0,a.jsx)(T.default,{className:"section-title",data:{title:u}}),(0,a.jsxs)(d.Tabs,{shape:o,align:q,defaultValue:t?.[0]?.id||t?.[0]?.tabName,children:[Array.isArray(t)&&t.length>1&&(0,a.jsx)(d.TabsList,{className:"tabs-list",children:t.map(i=>(0,a.jsx)(d.TabsTrigger,{value:i.id||i.tabName,className:"tabs-trigger",children:i.tabName},i.id||i.tabName))}),(Array.isArray(t)?t:[])?.map(i=>(0,a.jsxs)(d.TabsContent,{value:i.id||i.tabName,className:`tabs-content ${t?.length>1?"mt-[24px]":""}`,children:[!(0,m.isLexicalEmpty)(i.caption)||!(0,m.isLexicalEmpty)(i?.subtitle)?(0,a.jsx)(T.default,{className:"tabs-title",data:{caption:i?.caption,subtitle:i?.subtitle}}):null,i.tabContent?.[0]?B(i.tabContent?.[0]):null]},i.id||i.tabName))]})]})});y.displayName="Tabs";var F=(0,n.withLayout)(y);
1
+ "use strict";"use client";var w=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var I=(r,a)=>{for(var l in a)c(r,l,{get:a[l],enumerable:!0})},u=(r,a,l,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let m of G(a))!D.call(r,m)&&m!==l&&c(r,m,{get:()=>a[m],enumerable:!(p=E(a,m))||p.enumerable});return r};var s=(r,a,l)=>(l=r!=null?w(W(r)):{},u(a||!r||!r.__esModule?c(l,"default",{value:r,enumerable:!0}):l,r)),M=r=>u(c({},"__esModule",{value:!0}),r);var F={};I(F,{default:()=>R});module.exports=M(F);var e=require("react/jsx-runtime"),n=require("../../shared/Styles.js"),d=s(require("../../components/tabs.js")),o=require("../../helpers/index.js"),b=s(require("react")),h=s(require("../ShelfDisplay/index.js")),k=s(require("../AccordionCards/index.js")),g=s(require("../Faq/index.js")),N=s(require("../MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js")),T=s(require("../Title/index.js")),v=s(require("../Graphic/index.js")),L=s(require("../WhyChoose/index.js")),P=s(require("../BrandEquity/index.js")),A=s(require("../BrandCardLink/index.js")),q=s(require("../ImageWithText/index.js"));const y=b.default.forwardRef(({data:r,className:a},l)=>{const{theme:p,shape:m,align:x,tabs:t=[],sectionTitle:f}=r,B=i=>i?.blockType==="ipc-shelfdisplay"?(0,e.jsx)(h.default,{data:i}):i?.blockType==="ipc-multiLayoutGraphicBlock"?(0,e.jsx)(N.default,{data:i}):i?.blockType==="ipc-accordioncards"?(0,e.jsx)(k.default,{data:i}):i?.blockType==="ipc-faq"?(0,e.jsx)(g.default,{data:i}):i?.blockType==="ipc-graphic"?(0,e.jsx)(v.default,{data:i}):i?.blockType==="ipc-whychoose"?(0,e.jsx)(L.default,{data:i}):i?.blockType==="ipc-brand-equity"?(0,e.jsx)(P.default,{data:i}):i?.blockType==="ipc-brand-card-link"?(0,e.jsx)(A.default,{data:i}):i?.blockType==="ImageWithText"?(0,e.jsx)(q.default,{data:i}):null;return(0,e.jsxs)("section",{ref:l,className:(0,o.cn)(p==="dark"?"aiui-dark":"",a),children:[f&&(0,e.jsx)(T.default,{className:"section-title",data:{title:f}}),(0,e.jsxs)(d.Tabs,{shape:m,align:x,defaultValue:t?.[0]?.id||t?.[0]?.tabName,children:[Array.isArray(t)&&t.length>1&&(0,e.jsx)(d.TabsList,{className:"tabs-list",children:t.map(i=>(0,e.jsx)(d.TabsTrigger,{value:i.id||i.tabName,className:"tabs-trigger",children:i.tabName},i.id||i.tabName))}),(Array.isArray(t)?t:[])?.map(i=>(0,e.jsxs)(d.TabsContent,{value:i.id||i.tabName,className:`tabs-content ${t?.length>1?"mt-[24px]":""}`,children:[!(0,o.isLexicalEmpty)(i.caption)||!(0,o.isLexicalEmpty)(i?.subtitle)?(0,e.jsx)(T.default,{className:"tabs-title",data:{caption:i?.caption,subtitle:i?.subtitle}}):null,i.tabContent?.[0]?B(i.tabContent?.[0]):null]},i.id||i.tabName))]})]})});y.displayName="Tabs";var R=(0,n.withLayout)(y);
2
2
  //# sourceMappingURL=Tabs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Tabs/Tabs.tsx"],
4
- "sourcesContent": ["'use client'\nimport { withLayout } from '../../shared/Styles.js'\nimport * as TabsPrimitive from '../../components/tabs.js'\nimport { cn, isLexicalEmpty } from '../../helpers/index.js'\nimport type { TabsProps } from './types.js'\nimport React from 'react'\nimport ShelfDisplay from '../ShelfDisplay/index.js'\nimport AccordionCards from '../AccordionCards/index.js'\nimport Faq from '../Faq/index.js'\nimport MultiLayoutGraphicBlock from '../MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js'\nimport Title from '../Title/index.js'\nimport Graphic from '../Graphic/index.js'\nimport WhyChoose from '../WhyChoose/index.js'\nimport BrandEquity from '../BrandEquity/index.js'\nimport BrandCardLink from '../BrandCardLink/index.js'\n\nconst Tabs = React.forwardRef<HTMLDivElement, TabsProps>(({ data, className }, forwardedRef) => {\n const { theme, shape, align, tabs = [], sectionTitle } = data\n\n const renderTabContent = (tabContent: TabsProps['data']['tabs'][number]['tabContent'][number]) => {\n if (tabContent?.blockType === 'ipc-shelfdisplay') {\n return <ShelfDisplay data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-multiLayoutGraphicBlock') {\n return <MultiLayoutGraphicBlock data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-accordioncards') {\n return <AccordionCards data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-faq') {\n return <Faq data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-graphic') {\n return <Graphic data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-whychoose') {\n return <WhyChoose data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-brand-equity') {\n return <BrandEquity data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-brand-card-link') {\n return <BrandCardLink data={tabContent} />\n } else {\n return null\n }\n }\n\n return (\n <section ref={forwardedRef} className={cn(theme === 'dark' ? 'aiui-dark' : '', className)}>\n {sectionTitle && <Title className=\"section-title\" data={{ title: sectionTitle }} />}\n <TabsPrimitive.Tabs shape={shape} align={align} defaultValue={tabs?.[0]?.id || tabs?.[0]?.tabName}>\n {/* <TabsPrimitive.TabsList className=\"tabs-list\">\n {(Array.isArray(tabs) ? tabs : [])?.map(tab => (\n <TabsPrimitive.TabsTrigger\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className=\"tabs-trigger\"\n >\n {tab.tabName}\n </TabsPrimitive.TabsTrigger>\n ))}\n </TabsPrimitive.TabsList> */}\n {/* Tab\u4E3A1\u65F6\uFF0C\u4E0D\u5C55\u793Atab\u6309\u94AE */}\n {Array.isArray(tabs) && tabs.length > 1 && (\n <TabsPrimitive.TabsList className=\"tabs-list\">\n {tabs.map(tab => (\n <TabsPrimitive.TabsTrigger\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className=\"tabs-trigger\"\n >\n {tab.tabName}\n </TabsPrimitive.TabsTrigger>\n ))}\n </TabsPrimitive.TabsList>\n )}\n {(Array.isArray(tabs) ? tabs : [])?.map((tab: any) => (\n <TabsPrimitive.TabsContent\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className={`tabs-content ${tabs?.length > 1 ? 'mt-[24px]' : ''}`}\n >\n {!isLexicalEmpty(tab.caption) || !isLexicalEmpty(tab?.subtitle) ? (\n <Title className=\"tabs-title\" data={{ caption: tab?.caption, subtitle: tab?.subtitle }} />\n ) : null}\n {tab.tabContent?.[0] ? renderTabContent(tab.tabContent?.[0]) : null}\n </TabsPrimitive.TabsContent>\n ))}\n </TabsPrimitive.Tabs>\n </section>\n )\n})\nTabs.displayName = 'Tabs'\nexport default withLayout(Tabs)\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAqBa,IAAAI,EAAA,6BApBbC,EAA2B,kCAC3BC,EAA+B,uCAC/BC,EAAmC,kCAEnCC,EAAkB,oBAClBC,EAAyB,uCACzBC,EAA2B,yCAC3BC,EAAgB,8BAChBC,EAAoC,oEACpCC,EAAkB,gCAClBC,EAAoB,kCACpBC,EAAsB,oCACtBC,EAAwB,sCACxBC,EAA0B,wCAE1B,MAAMC,EAAO,EAAAC,QAAM,WAAsC,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAGC,IAAiB,CAC9F,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,MAAAC,EAAO,KAAAC,EAAO,CAAC,EAAG,aAAAC,CAAa,EAAIP,EAEnDQ,EAAoBC,GACpBA,GAAY,YAAc,sBACrB,OAAC,EAAAC,QAAA,CAAa,KAAMD,EAAY,EAC9BA,GAAY,YAAc,iCAC5B,OAAC,EAAAE,QAAA,CAAwB,KAAMF,EAAY,EACzCA,GAAY,YAAc,wBAC5B,OAAC,EAAAG,QAAA,CAAe,KAAMH,EAAY,EAChCA,GAAY,YAAc,aAC5B,OAAC,EAAAI,QAAA,CAAI,KAAMJ,EAAY,EACrBA,GAAY,YAAc,iBAC5B,OAAC,EAAAK,QAAA,CAAQ,KAAML,EAAY,EACzBA,GAAY,YAAc,mBAC5B,OAAC,EAAAM,QAAA,CAAU,KAAMN,EAAY,EAC3BA,GAAY,YAAc,sBAC5B,OAAC,EAAAO,QAAA,CAAY,KAAMP,EAAY,EAC7BA,GAAY,YAAc,yBAC5B,OAAC,EAAAQ,QAAA,CAAc,KAAMR,EAAY,EAEjC,KAIX,SACE,QAAC,WAAQ,IAAKP,EAAc,aAAW,MAAGC,IAAU,OAAS,YAAc,GAAIF,CAAS,EACrF,UAAAM,MAAgB,OAAC,EAAAW,QAAA,CAAM,UAAU,gBAAgB,KAAM,CAAE,MAAOX,CAAa,EAAG,KACjF,QAACrB,EAAc,KAAd,CAAmB,MAAOkB,EAAO,MAAOC,EAAO,aAAcC,IAAO,CAAC,GAAG,IAAMA,IAAO,CAAC,GAAG,QAavF,gBAAM,QAAQA,CAAI,GAAKA,EAAK,OAAS,MACpC,OAACpB,EAAc,SAAd,CAAuB,UAAU,YAC/B,SAAAoB,EAAK,IAAIa,MACR,OAACjC,EAAc,YAAd,CAEC,MAAOiC,EAAI,IAAMA,EAAI,QACrB,UAAU,eAET,SAAAA,EAAI,SAJAA,EAAI,IAAMA,EAAI,OAKrB,CACD,EACH,GAEA,MAAM,QAAQb,CAAI,EAAIA,EAAO,CAAC,IAAI,IAAKa,MACvC,QAACjC,EAAc,YAAd,CAEC,MAAOiC,EAAI,IAAMA,EAAI,QACrB,UAAW,gBAAgBb,GAAM,OAAS,EAAI,YAAc,EAAE,GAE7D,cAAC,kBAAea,EAAI,OAAO,GAAK,IAAC,kBAAeA,GAAK,QAAQ,KAC5D,OAAC,EAAAD,QAAA,CAAM,UAAU,aAAa,KAAM,CAAE,QAASC,GAAK,QAAS,SAAUA,GAAK,QAAS,EAAG,EACtF,KACHA,EAAI,aAAa,CAAC,EAAIX,EAAiBW,EAAI,aAAa,CAAC,CAAC,EAAI,OAP1DA,EAAI,IAAMA,EAAI,OAQrB,CACD,GACH,GACF,CAEJ,CAAC,EACDrB,EAAK,YAAc,OACnB,IAAOhB,KAAQ,cAAWgB,CAAI",
6
- "names": ["Tabs_exports", "__export", "Tabs_default", "__toCommonJS", "import_jsx_runtime", "import_Styles", "TabsPrimitive", "import_helpers", "import_react", "import_ShelfDisplay", "import_AccordionCards", "import_Faq", "import_MultiLayoutGraphicBlock", "import_Title", "import_Graphic", "import_WhyChoose", "import_BrandEquity", "import_BrandCardLink", "Tabs", "React", "data", "className", "forwardedRef", "theme", "shape", "align", "tabs", "sectionTitle", "renderTabContent", "tabContent", "ShelfDisplay", "MultiLayoutGraphicBlock", "AccordionCards", "Faq", "Graphic", "WhyChoose", "BrandEquity", "BrandCardLink", "Title", "tab"]
4
+ "sourcesContent": ["'use client'\nimport { withLayout } from '../../shared/Styles.js'\nimport * as TabsPrimitive from '../../components/tabs.js'\nimport { cn, isLexicalEmpty } from '../../helpers/index.js'\nimport type { TabsProps } from './types.js'\nimport React from 'react'\nimport ShelfDisplay from '../ShelfDisplay/index.js'\nimport AccordionCards from '../AccordionCards/index.js'\nimport Faq from '../Faq/index.js'\nimport MultiLayoutGraphicBlock from '../MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js'\nimport Title from '../Title/index.js'\nimport Graphic from '../Graphic/index.js'\nimport WhyChoose from '../WhyChoose/index.js'\nimport BrandEquity from '../BrandEquity/index.js'\nimport BrandCardLink from '../BrandCardLink/index.js'\nimport ImageWithText from '../ImageWithText/index.js'\n\nconst Tabs = React.forwardRef<HTMLDivElement, TabsProps>(({ data, className }, forwardedRef) => {\n const { theme, shape, align, tabs = [], sectionTitle } = data\n\n const renderTabContent = (tabContent: TabsProps['data']['tabs'][number]['tabContent'][number]) => {\n if (tabContent?.blockType === 'ipc-shelfdisplay') {\n return <ShelfDisplay data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-multiLayoutGraphicBlock') {\n return <MultiLayoutGraphicBlock data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-accordioncards') {\n return <AccordionCards data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-faq') {\n return <Faq data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-graphic') {\n return <Graphic data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-whychoose') {\n return <WhyChoose data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-brand-equity') {\n return <BrandEquity data={tabContent} />\n } else if (tabContent?.blockType === 'ipc-brand-card-link') {\n return <BrandCardLink data={tabContent} />\n } else if (tabContent?.blockType === 'ImageWithText') {\n return <ImageWithText data={tabContent} />\n } else {\n return null\n }\n }\n\n return (\n <section ref={forwardedRef} className={cn(theme === 'dark' ? 'aiui-dark' : '', className)}>\n {sectionTitle && <Title className=\"section-title\" data={{ title: sectionTitle }} />}\n <TabsPrimitive.Tabs shape={shape} align={align} defaultValue={tabs?.[0]?.id || tabs?.[0]?.tabName}>\n {/* <TabsPrimitive.TabsList className=\"tabs-list\">\n {(Array.isArray(tabs) ? tabs : [])?.map(tab => (\n <TabsPrimitive.TabsTrigger\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className=\"tabs-trigger\"\n >\n {tab.tabName}\n </TabsPrimitive.TabsTrigger>\n ))}\n </TabsPrimitive.TabsList> */}\n {/* Tab\u4E3A1\u65F6\uFF0C\u4E0D\u5C55\u793Atab\u6309\u94AE */}\n {Array.isArray(tabs) && tabs.length > 1 && (\n <TabsPrimitive.TabsList className=\"tabs-list\">\n {tabs.map(tab => (\n <TabsPrimitive.TabsTrigger\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className=\"tabs-trigger\"\n >\n {tab.tabName}\n </TabsPrimitive.TabsTrigger>\n ))}\n </TabsPrimitive.TabsList>\n )}\n {(Array.isArray(tabs) ? tabs : [])?.map((tab: any) => (\n <TabsPrimitive.TabsContent\n key={tab.id || tab.tabName}\n value={tab.id || tab.tabName}\n className={`tabs-content ${tabs?.length > 1 ? 'mt-[24px]' : ''}`}\n >\n {!isLexicalEmpty(tab.caption) || !isLexicalEmpty(tab?.subtitle) ? (\n <Title className=\"tabs-title\" data={{ caption: tab?.caption, subtitle: tab?.subtitle }} />\n ) : null}\n {tab.tabContent?.[0] ? renderTabContent(tab.tabContent?.[0]) : null}\n </TabsPrimitive.TabsContent>\n ))}\n </TabsPrimitive.Tabs>\n </section>\n )\n})\nTabs.displ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,MAAGC,IAAU,OAAS,YAAc,GAAIF,CAAS,EACrF,UAAAM,MAAgB,OAAC,EAAAY,QAAA,CAAM,UAAU,gBAAgB,KAAM,CAAE,MAAOZ,CAAa,EAAG,KACjF,QAACtB,EAAc,KAAd,CAAmB,MAAOmB,EAAO,MAAOC,EAAO,aAAcC,IAAO,CAAC,GAAG,IAAMA,IAAO,CAAC,GAAG,QAavF,gBAAM,QAAQA,CAAI,GAAKA,EAAK,OAAS,MACpC,OAACrB,EAAc,SAAd,CAAuB,UAAU,YAC/B,SAAAqB,EAAK,IAAIc,MACR,OAACnC,EAAc,YAAd,CAEC,MAAOmC,EAAI,IAAMA,EAAI,QACrB,UAAU,eAET,SAAAA,EAAI,SAJAA,EAAI,IAAMA,EAAI,OAKrB,CACD,EACH,GAEA,MAAM,QAAQd,CAAI,EAAIA,EAAO,CAAC,IAAI,IAAKc,MACvC,QAACnC,EAAc,YAAd,CAEC,MAAOmC,EAAI,IAAMA,EAAI,QACrB,UAAW,gBAAgBd,GAAM,OAAS,EAAI,YAAc,EAAE,GAE7D,cAAC,kBAAec,EAAI,OAAO,GAAK,IAAC,kBAAeA,GAAK,QAAQ,KAC5D,OAAC,EAAAD,QAAA,CAAM,UAAU,aAAa,KAAM,CAAE,QAASC,GAAK,QAAS,SAAUA,GAAK,QAAS,EAAG,EACtF,KACHA,EAAI,aAAa,CAAC,EAAIZ,EAAiBY,EAAI,aAAa,CAAC,CAAC,EAAI,OAP1DA,EAAI,IAAMA,EAAI,OAQrB,CACD,GACH,GACF,CAEJ,CAAC,EACDtB,EAAK,YAAc,OACnB,IAAOjB,KAAQ,cAAWiB,CAAI",
6
+ "names": ["Tabs_exports", "__export", "Tabs_default", "__toCommonJS", "import_jsx_runtime", "import_Styles", "TabsPrimitive", "import_helpers", "import_react", "import_ShelfDisplay", "import_AccordionCards", "import_Faq", "import_MultiLayoutGraphicBlock", "import_Title", "import_Graphic", "import_WhyChoose", "import_BrandEquity", "import_BrandCardLink", "import_ImageWithText", "Tabs", "React", "data", "className", "forwardedRef", "theme", "shape", "align", "tabs", "sectionTitle", "renderTabContent", "tabContent", "ShelfDisplay", "MultiLayoutGraphicBlock", "AccordionCards", "Faq", "Graphic", "WhyChoose", "BrandEquity", "BrandCardLink", "ImageWithText", "Title", "tab"]
7
7
  }
@@ -7,6 +7,7 @@ import type { GraphicProps } from '../Graphic/index.js';
7
7
  import type { WhyChooseProps } from '../WhyChoose/types.js';
8
8
  import type { BrandEquityProps } from '../BrandEquity/types.js';
9
9
  import type { BrandCardLinkProps } from '../BrandCardLink/types.js';
10
+ import type { ImageWithTextProps } from '../ImageWithText/types.js';
10
11
  export type TabsProps = {
11
12
  data: {
12
13
  sectionTitle?: string;
@@ -32,6 +33,8 @@ export type TabsProps = {
32
33
  blockType: 'ipc-brand-equity';
33
34
  })[] | (BrandCardLinkProps['data'] & {
34
35
  blockType: 'ipc-brand-card-link';
36
+ })[] | (ImageWithTextProps['data'] & {
37
+ blockType: 'ImageWithText';
35
38
  })[];
36
39
  }[];
37
40
  };
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var e=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var c=(o,p,i,r)=>{if(p&&typeof p=="object"||typeof p=="function")for(let a of e(p))!y.call(o,a)&&a!==i&&t(o,a,{get:()=>p[a],enumerable:!(r=s(p,a))||r.enumerable});return o};var d=o=>c(t({},"__esModule",{value:!0}),o);var l={};module.exports=d(l);
1
+ "use strict";var t=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var c=(o,p,e,r)=>{if(p&&typeof p=="object"||typeof p=="function")for(let a of s(p))!y.call(o,a)&&a!==e&&t(o,a,{get:()=>p[a],enumerable:!(r=i(p,a))||r.enumerable});return o};var d=o=>c(t({},"__esModule",{value:!0}),o);var l={};module.exports=d(l);
2
2
  //# sourceMappingURL=types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Tabs/types.ts"],
4
- "sourcesContent": ["import type { Align, Shape, Theme } from '../../types/props.js'\nimport type { MultiLayoutGraphicBlockProps } from '../MultiLayoutGraphicBlock/types.js'\nimport type { ShelfDisplayProps } from '../ShelfDisplay/shelfDisplay.js'\nimport type { AccordionCardsType } from '../AccordionCards/index.js'\nimport type { FaqProps } from '../Faq/types.js'\nimport type { GraphicProps } from '../Graphic/index.js'\nimport type { WhyChooseProps } from '../WhyChoose/types.js'\nimport type { BrandEquityProps } from '../BrandEquity/types.js'\nimport type { BrandCardLinkProps } from '../BrandCardLink/types.js'\n\nexport type TabsProps = {\n data: {\n sectionTitle?: string\n theme: Theme\n shape: Shape\n align: Align\n tabs: {\n id: string\n tabName: string\n tabContent:\n | (ShelfDisplayProps['data'] & { blockType: 'ipc-shelfdisplay' })[]\n | (MultiLayoutGraphicBlockProps['data'] & { blockType: 'ipc-multiLayoutGraphicBlock' })[]\n | (AccordionCardsType['data'] & { blockType: 'ipc-accordioncards' })[]\n | (FaqProps['data'] & { blockType: 'ipc-faq' })[]\n | (GraphicProps['data'] & { blockType: 'ipc-graphic' })[]\n | (WhyChooseProps['data'] & { blockType: 'ipc-whychoose' })[]\n | (BrandEquityProps['data'] & { blockType: 'ipc-brand-equity' })[]\n | (BrandCardLinkProps['data'] & { blockType: 'ipc-brand-card-link' })[]\n }[]\n }\n className?: string\n}\n"],
4
+ "sourcesContent": ["import type { Align, Shape, Theme } from '../../types/props.js'\nimport type { MultiLayoutGraphicBlockProps } from '../MultiLayoutGraphicBlock/types.js'\nimport type { ShelfDisplayProps } from '../ShelfDisplay/shelfDisplay.js'\nimport type { AccordionCardsType } from '../AccordionCards/index.js'\nimport type { FaqProps } from '../Faq/types.js'\nimport type { GraphicProps } from '../Graphic/index.js'\nimport type { WhyChooseProps } from '../WhyChoose/types.js'\nimport type { BrandEquityProps } from '../BrandEquity/types.js'\nimport type { BrandCardLinkProps } from '../BrandCardLink/types.js'\nimport type { ImageWithTextProps } from '../ImageWithText/types.js'\n\nexport type TabsProps = {\n data: {\n sectionTitle?: string\n theme: Theme\n shape: Shape\n align: Align\n tabs: {\n id: string\n tabName: string\n tabContent:\n | (ShelfDisplayProps['data'] & { blockType: 'ipc-shelfdisplay' })[]\n | (MultiLayoutGraphicBlockProps['data'] & { blockType: 'ipc-multiLayoutGraphicBlock' })[]\n | (AccordionCardsType['data'] & { blockType: 'ipc-accordioncards' })[]\n | (FaqProps['data'] & { blockType: 'ipc-faq' })[]\n | (GraphicProps['data'] & { blockType: 'ipc-graphic' })[]\n | (WhyChooseProps['data'] & { blockType: 'ipc-whychoose' })[]\n | (BrandEquityProps['data'] & { blockType: 'ipc-brand-equity' })[]\n | (BrandCardLinkProps['data'] & { blockType: 'ipc-brand-card-link' })[]\n | (ImageWithTextProps['data'] & { blockType: 'ImageWithText' })[]\n }[]\n }\n className?: string\n}\n"],
5
5
  "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
6
  "names": ["types_exports", "__toCommonJS"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import"react";import*as t from"@radix-ui/react-dialog";import{Heading as k}from"../../components/index.js";import{cn as o}from"../../helpers/index.js";const y=({isOpen:r,onClose:d,children:c,maxWidth:p="max-w-[358px] laptop:max-w-[480px]",background:m="bg-white",showCloseButton:g=!0,className:u,title:a,description:x,ariaLabelledBy:s,theme:f="light"})=>{const n=s||void 0,l=`${s||"base-modal"}-description`,b=a||"Dialog",v=x||a||"Dialog content";return e(t.Root,{open:r,onOpenChange:h=>!h&&d(),children:i(t.Portal,{children:[e(t.Overlay,{className:o("fixed inset-0 z-[100]","bg-black/40","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",f==="dark"?"aiui-dark":"")}),i(t.Content,{className:o("fixed left-1/2 top-1/2 z-[110]","-translate-x-1/2 -translate-y-1/2","md-tablet:max-w-[90%] w-full shadow-2xl","rounded-box",p,m,"data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","duration-300",u),"aria-labelledby":n,"aria-describedby":l,"aria-modal":"true",children:[e(t.Title,{id:n,className:"sr-only",children:b}),e(t.Description,{id:l,className:"sr-only",children:v}),i("div",{className:o("modal-close","flex items-center justify-between","laptop:p-4 px-2 pb-1 pt-2"),children:[a&&e(k,{size:2,className:"tracking-[-0.32px]",children:a}),g&&e(t.Close,{asChild:!0,children:e("button",{className:o("relative z-10 shrink-0 cursor-pointer","flex items-center justify-center","laptop:size-[24px] size-[20px]","desktop:size-[28px]",!a&&"ml-auto"),"aria-label":"\u5173\u95ED\u5F39\u7A97",children:i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-full",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]}),c]})]})})};var N=y;export{y as BaseModal,N as default};
1
+ "use client";import{jsx as e,jsxs as i}from"react/jsx-runtime";import"react";import*as t from"@radix-ui/react-dialog";import{Heading as k}from"../../components/index.js";import{cn as o}from"../../helpers/index.js";const y=({isOpen:r,onClose:d,children:c,maxWidth:p="max-w-[358px] laptop:max-w-[480px]",background:m="bg-white",showCloseButton:g=!0,className:x,title:a,description:u,ariaLabelledBy:s,theme:f="light"})=>{const n=s||void 0,l=`${s||"base-modal"}-description`,b=a||"Dialog",v=u||a||"Dialog content";return e(t.Root,{open:r,onOpenChange:h=>!h&&d(),children:i(t.Portal,{children:[e(t.Overlay,{className:o("fixed inset-0 z-[200]","bg-black/40","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",f==="dark"?"aiui-dark":"")}),i(t.Content,{className:o("fixed left-1/2 top-1/2 z-[210]","-translate-x-1/2 -translate-y-1/2","md-tablet:max-w-[90%] w-[calc(100%-32px)] shadow-2xl","rounded-box",p,m,"data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","duration-300",x),"aria-labelledby":n,"aria-describedby":l,"aria-modal":"true",children:[e(t.Title,{id:n,className:"sr-only",children:b}),e(t.Description,{id:l,className:"sr-only",children:v}),i("div",{className:o("modal-close","flex items-center justify-between","laptop:p-4 px-2 pb-1 pt-2"),children:[a&&e(k,{size:2,className:"tracking-[-0.32px]",children:a}),g&&e(t.Close,{asChild:!0,children:e("button",{className:o("relative z-10 shrink-0 cursor-pointer","flex items-center justify-center","laptop:size-[24px] size-[20px]","desktop:size-[28px]",!a&&"ml-auto"),"aria-label":"\u5173\u95ED\u5F39\u7A97",children:i("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-full",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})})]}),c]})]})})};var N=y;export{y as BaseModal,N as default};
2
2
  //# sourceMappingURL=BaseModal.js.map