@doubao-dev/template 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -296,7 +296,7 @@ import { MapCard } from '@doubao-dev/template';
296
296
 
297
297
  ## ContentCard
298
298
 
299
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/content-card.png" alt="ContentCard 示例" width="400" />
299
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/content-card.png" alt="ContentCard 示例" width="400" />
300
300
 
301
301
  通用列表卡,由标题栏、列表内容和底部操作区组成,适合商品、服务、内容入口等可重复条目。
302
302
 
@@ -338,7 +338,7 @@ import { ContentCard } from '@doubao-dev/template';
338
338
 
339
339
  ## PriceActionCard
340
340
 
341
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/price-action-card.png" alt="PriceActionCard 示例" width="400" />
341
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/price-action-card.png" alt="PriceActionCard 示例" width="400" />
342
342
 
343
343
  价格操作卡,由多条"价格 + 信息 + 右侧按钮"组成,适合报价、权益、服务方案等结果列表。
344
344
 
@@ -371,7 +371,7 @@ import { PriceActionCard } from '@doubao-dev/template';
371
371
 
372
372
  ## CheckoutCard
373
373
 
374
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/checkout-card.png" alt="CheckoutCard 示例" width="400" />
374
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/checkout-card.png" alt="CheckoutCard 示例" width="400" />
375
375
 
376
376
  通用提单卡,由商品摘要、提单信息、费用汇总和底部操作区组成,适合下单确认、支付确认等场景。
377
377
 
@@ -422,7 +422,7 @@ import { CheckoutCard } from '@doubao-dev/template';
422
422
 
423
423
  ## TicketOrderCard
424
424
 
425
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/ticket-checkout-card.png" alt="TicketOrderCard 示例" width="400" />
425
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/ticket-checkout-card.png" alt="TicketOrderCard 示例" width="400" />
426
426
 
427
427
  > **已废弃:** 请使用 `CheckoutCard`。`TicketOrderCard` 仅为兼容现有代码保留。
428
428
 
@@ -469,7 +469,7 @@ import { TicketOrderCard } from '@doubao-dev/template';
469
469
 
470
470
  ## TransitCard
471
471
 
472
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/transit-card.png" alt="TransitCard 示例" width="400" />
472
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/transit-card.png" alt="TransitCard 示例" width="400" />
473
473
 
474
474
  交通票务列表卡,由多条出发、中转、到达和价格信息组成,适合展示机票、火车票、大巴等推荐列表。
475
475
 
@@ -492,9 +492,9 @@ import { TransitCard } from '@doubao-dev/template';
492
492
  prefix: '前缀',
493
493
  tone: 'highlight'
494
494
  },
495
- tag: {
496
- text: '可优惠约¥5',
497
- tone: 'marketing'
495
+ priceAction: {
496
+ text: '订票',
497
+ showIcon: true
498
498
  }
499
499
  }
500
500
  ]}
@@ -511,6 +511,7 @@ import { TransitCard } from '@doubao-dev/template';
511
511
  - `items` 会全量展示,模板不做"最多 4 条"的截断。
512
512
  - `price` 推荐传 `{ value, currency?, prefix?, prefixTone?, tone? }`,由模板使用 `Price` Primitive 渲染;`currency` 默认是 `¥`,不传 `prefixTone` 时前缀与价格值颜色一致。
513
513
  - `price` 传数字时直接作为 `Price.value`,使用默认币种;传字符串时按首个币种符号拆为 `prefix + currency + value`,没有币种符号时整串作为 `value` 并隐藏币种。两种写法均使用 Price 的默认 `tone`。
514
+ - `priceAction` 传 `{ text, tone?, showIcon? }`,展示价格下方的操作文案;`tone` 支持红色强调态 `highlight` 和灰色弱化态 `muted`,默认 `highlight`;`showIcon` 默认是 `true`,箭头样式由模板统一管理。与 `tag` 同时传入时优先展示 `priceAction`。
514
515
  - `tag` 传 `{ text, tone? }`,`tone` 仅支持红色 `marketing` 和灰色 `neutral`,默认 `marketing`;不传 `tag` 时保持原来的单价格布局。
515
516
  - `title`、`transfer` 接收 `ReactNode`,适合需要自定义整块区域的场景。
516
517
  - `departureMain`、`departureSub`、`transferTop`、`transferBottom`、`arrivalMain`、`arrivalDayOffset`、`arrivalSub` 接收字符串或数字。
@@ -518,7 +519,7 @@ import { TransitCard } from '@doubao-dev/template';
518
519
 
519
520
  ## AskHumanCard
520
521
 
521
- <img src="https://unpkg.com/@doubao-dev/template@0.4.1/assets/ask-human-card.png" alt="AskHumanCard 示例" width="400" />
522
+ <img src="https://unpkg.com/@doubao-dev/template@0.4.2/assets/ask-human-card.png" alt="AskHumanCard 示例" width="400" />
522
523
 
523
524
  人工确认选项卡,由一组选项组成,适合让用户在多个候选项中确认选择。
524
525
 
@@ -1,6 +1,7 @@
1
1
  import type { ReactElement } from 'react';
2
2
  export interface TemplateChevronRightIconProps {
3
3
  className?: string;
4
+ color?: string;
4
5
  }
5
6
  export declare function TemplateChevronRightIcon(props: TemplateChevronRightIconProps): ReactElement;
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -5,9 +5,9 @@ function getTemplateChevronRightIconContent(color) {
5
5
  </svg>`;
6
6
  }
7
7
  function TemplateChevronRightIcon(props) {
8
- const { className } = props;
8
+ const { className, color: customColor } = props;
9
9
  const theme = useTheme();
10
- const color = 'dark' === theme ? '#666666' : '#cccccc';
10
+ const color = customColor ?? ('dark' === theme ? '#666666' : '#cccccc');
11
11
  return <svg className={className} content={getTemplateChevronRightIconContent(color)}/>;
12
12
  }
13
13
  export { TemplateChevronRightIcon };
@@ -1,6 +1,7 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
2
  import type { TemplateText } from '../../types.js';
3
3
  import './styles.scss';
4
+ type TemplateTransportSummaryPriceActionTone = 'highlight' | 'muted';
4
5
  export interface TemplateTransportSummaryProps {
5
6
  /** 行程标题块内容。 */
6
7
  title?: ReactNode;
@@ -24,10 +25,17 @@ export interface TemplateTransportSummaryProps {
24
25
  arrivalSub?: TemplateText;
25
26
  /** 价格块内容。 */
26
27
  price?: ReactNode;
28
+ /** 价格下方的操作文案。 */
29
+ priceActionText?: TemplateText;
30
+ /** 价格操作文案色调。 */
31
+ priceActionTone?: TemplateTransportSummaryPriceActionTone;
32
+ /** 是否展示价格操作文案右侧箭头。 */
33
+ showPriceActionIcon?: boolean;
27
34
  /** 价格下方的标签内容。 */
28
35
  tag?: ReactNode;
29
36
  /** 根节点自定义类名。 */
30
37
  className?: string;
31
38
  }
32
39
  export declare function TemplateTransportSummary(props: TemplateTransportSummaryProps): ReactElement | null;
40
+ export {};
33
41
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { useTheme } from "@byted-doubao-apps/components";
2
2
  import { clsx } from "clsx";
3
+ import { TemplateChevronRightIcon } from "../chevron-right-icon/index.js";
3
4
  import "./styles.css";
4
5
  function getTransportSummaryArrowSvgContent(showDot, isDark) {
5
6
  const arrowColor = isDark ? '#303030' : '#E5E5E5';
@@ -33,13 +34,24 @@ function renderTemplateTransportSummaryTextField(content, wrapperClassName, text
33
34
  </text>
34
35
  </view>;
35
36
  }
36
- function renderTemplateTransportSummaryPrice(price, tag) {
37
+ function renderTemplateTransportSummaryPriceAction(actionText, actionTone, showActionIcon, isDark) {
38
+ if (isTemplateTransportSummaryTextEmpty(actionText)) return null;
39
+ return <view className="doubao-template-transport-summary__price-action">
40
+ <text className={clsx('doubao-template-transport-summary__price-action-text', `doubao-template-transport-summary__price-action-text--${actionTone}`)} text-maxline="1">
41
+ {actionText}
42
+ </text>
43
+ {showActionIcon ? <TemplateChevronRightIcon className="doubao-template-transport-summary__price-action-icon" color={'highlight' === actionTone ? '#ff375f' : isDark ? '#bababa' : '#666666'}/> : null}
44
+ </view>;
45
+ }
46
+ function renderTemplateTransportSummaryPrice(price, tag, actionText, actionTone, showActionIcon, isDark) {
37
47
  const hasPrice = !isTemplateTransportSummaryNodeEmpty(price);
38
48
  const hasTag = !isTemplateTransportSummaryNodeEmpty(tag);
39
- if (!hasPrice && !hasTag) return null;
40
- return <view className={clsx('doubao-template-transport-summary__price', hasTag && 'doubao-template-transport-summary__price--with-tag')}>
49
+ const actionNode = renderTemplateTransportSummaryPriceAction(actionText, actionTone, showActionIcon, isDark);
50
+ const hasAction = null != actionNode;
51
+ if (!hasPrice && !hasTag && !hasAction) return null;
52
+ return <view className={clsx('doubao-template-transport-summary__price', hasAction && 'doubao-template-transport-summary__price--with-action', !hasAction && hasTag && 'doubao-template-transport-summary__price--with-tag')}>
41
53
  {hasPrice && price}
42
- {hasTag && tag}
54
+ {hasAction ? actionNode : hasTag && tag}
43
55
  </view>;
44
56
  }
45
57
  function TemplateTransportSummaryArrowIcon({ showDot }) {
@@ -79,7 +91,8 @@ function renderTemplateTransportSummaryTransfer({ content, topText, showDot, bot
79
91
  </view>;
80
92
  }
81
93
  function TemplateTransportSummary(props) {
82
- const { title, departureMain, departureSub, transfer, transferTop, showTransferDot, transferBottom, arrivalMain, arrivalDayOffset, arrivalSub, price, tag, className } = props;
94
+ const theme = useTheme();
95
+ const { title, departureMain, departureSub, transfer, transferTop, showTransferDot, transferBottom, arrivalMain, arrivalDayOffset, arrivalSub, price, priceActionText, priceActionTone = 'highlight', showPriceActionIcon = true, tag, className } = props;
83
96
  const departureNode = renderTemplateTransportSummaryPoint({
84
97
  mainText: departureMain,
85
98
  subText: departureSub
@@ -101,7 +114,7 @@ function TemplateTransportSummary(props) {
101
114
  {arrivalDayOffsetNode}
102
115
  </view>;
103
116
  const titleNode = renderTemplateTransportSummaryNodeField(title, 'doubao-template-transport-summary__title', 'doubao-template-transport-summary__title-text');
104
- const priceNode = renderTemplateTransportSummaryPrice(price, tag);
117
+ const priceNode = renderTemplateTransportSummaryPrice(price, tag, priceActionText, priceActionTone, showPriceActionIcon, 'dark' === theme);
105
118
  const hasRoute = Boolean(departureNode || transferNode || arrivalNode);
106
119
  const hasRouteRow = hasRoute || null != priceNode;
107
120
  if (null == titleNode && !hasRouteRow) return null;
@@ -1 +1 @@
1
- .doubao-template-transport-summary{display:flex;flex-direction:column;justify-content:flex-start;width:100%;min-width:0;box-sizing:border-box;padding:12px 12px 16px}.doubao-template-transport-summary__title,.doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point-sub,.doubao-template-transport-summary__transfer-label,.doubao-template-transport-summary__price{display:flex;flex-direction:row;align-items:center;min-width:0;overflow:hidden;flex-shrink:0}.doubao-template-transport-summary__title{height:20px;max-width:100%;box-sizing:border-box}.doubao-template-transport-summary__title-text,.doubao-template-transport-summary__route-point-main-text,.doubao-template-transport-summary__arrival-day-offset-text,.doubao-template-transport-summary__route-point-sub-text,.doubao-template-transport-summary__transfer-label-text{overflow:hidden;font-family:"PingFang SC",sans-serif;font-style:normal;text-overflow:ellipsis;white-space:nowrap}.doubao-template-transport-summary__title-text{color:var(--neutral-100);font-size:13px;font-weight:400;line-height:20px}.doubao-template-transport-summary__route-row{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:flex-start;justify-content:space-between;width:100%;height:46px;min-width:0;margin-top:2px;overflow:hidden}.doubao-template-transport-summary__route-point{display:flex;flex-shrink:0;flex-direction:column;justify-content:center;width:66px;min-width:0;height:42px}.doubao-template-transport-summary__route-point--arrival{align-items:flex-end}.doubao-template-transport-summary__arrival{position:relative;display:flex;flex-shrink:0;width:66px;min-width:0;height:42px}.doubao-template-transport-summary__arrival .doubao-template-transport-summary__route-point{width:100%;height:42px}.doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point-sub{width:100%}.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub{justify-content:flex-end}.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main-text,.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub-text{text-align:right}.doubao-template-transport-summary__route-point-main{height:22px}.doubao-template-transport-summary__route-point-sub{height:16px;margin-top:2px}.doubao-template-transport-summary__route-point-main-text{min-width:0;color:var(--neutral-100);font-family:"SF Pro",sans-serif;font-size:17px;font-weight:600;line-height:22px}.doubao-template-transport-summary__arrival-day-offset{position:absolute;top:2px;left:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;height:14px}.doubao-template-transport-summary__arrival-day-offset-text{color:var(--neutral-100);font-size:10px;font-weight:400;line-height:normal}.doubao-template-transport-summary__route-point-sub-text{color:var(--neutral-70);font-size:12px;font-weight:400;line-height:16px}.doubao-template-transport-summary__transfer-label-text{color:var(--neutral-50);font-size:10px;font-weight:400;line-height:14px}.doubao-template-transport-summary__transfer{display:flex;flex:none;flex-direction:row;align-items:center;justify-content:center;width:56px;min-width:0;height:42px;box-sizing:border-box}.doubao-template-transport-summary__transfer-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;width:56px;min-width:0;height:38px}.doubao-template-transport-summary__transfer-label{height:14px}.doubao-template-transport-summary__transfer-arrow{display:flex;flex-direction:row;align-items:center;justify-content:center;width:36px;height:6px;flex-shrink:0}.doubao-template-transport-summary__transfer-arrow-icon{width:36px;height:6px;flex-shrink:0}.doubao-template-transport-summary__price{flex:0 0 80px;flex-direction:column;align-items:flex-end;justify-content:center;width:80px;height:42px;box-sizing:border-box}.doubao-template-transport-summary__price>.doubao-price{justify-content:flex-end;width:100%;min-width:0;overflow:hidden}.doubao-template-transport-summary__price .doubao-price__amount,.doubao-template-transport-summary__price .doubao-price__main,.doubao-template-transport-summary__price .doubao-price__integer-group{max-width:100%;min-width:0;overflow:hidden}.doubao-template-transport-summary__price .doubao-price__main,.doubao-template-transport-summary__price .doubao-price__integer-group,.doubao-template-transport-summary__price .doubao-price__integer{flex-shrink:1}.doubao-template-transport-summary__price .doubao-price__integer{min-width:0;overflow:hidden;text-overflow:ellipsis}.doubao-template-transport-summary__price--with-tag{gap:4px;height:46px}
1
+ .doubao-template-transport-summary{display:flex;flex-direction:column;justify-content:flex-start;width:100%;min-width:0;box-sizing:border-box;padding:12px 12px 16px}.doubao-template-transport-summary__title,.doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point-sub,.doubao-template-transport-summary__transfer-label,.doubao-template-transport-summary__price{display:flex;flex-direction:row;align-items:center;min-width:0;overflow:hidden;flex-shrink:0}.doubao-template-transport-summary__title{height:20px;max-width:100%;box-sizing:border-box}.doubao-template-transport-summary__title-text,.doubao-template-transport-summary__route-point-main-text,.doubao-template-transport-summary__arrival-day-offset-text,.doubao-template-transport-summary__route-point-sub-text,.doubao-template-transport-summary__transfer-label-text{overflow:hidden;font-family:"PingFang SC",sans-serif;font-style:normal;text-overflow:ellipsis;white-space:nowrap}.doubao-template-transport-summary__title-text{color:var(--neutral-100);font-size:13px;font-weight:400;line-height:20px}.doubao-template-transport-summary__route-row{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:flex-start;justify-content:space-between;width:100%;height:46px;min-width:0;margin-top:2px;overflow:hidden}.doubao-template-transport-summary__route-point{display:flex;flex-shrink:0;flex-direction:column;justify-content:center;width:66px;min-width:0;height:42px}.doubao-template-transport-summary__route-point--arrival{align-items:flex-end}.doubao-template-transport-summary__arrival{position:relative;display:flex;flex-shrink:0;width:66px;min-width:0;height:42px}.doubao-template-transport-summary__arrival .doubao-template-transport-summary__route-point{width:100%;height:42px}.doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point-sub{width:100%}.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main,.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub{justify-content:flex-end}.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-main-text,.doubao-template-transport-summary__route-point--arrival .doubao-template-transport-summary__route-point-sub-text{text-align:right}.doubao-template-transport-summary__route-point-main{height:22px}.doubao-template-transport-summary__route-point-sub{height:16px;margin-top:2px}.doubao-template-transport-summary__route-point-main-text{min-width:0;color:var(--neutral-100);font-family:"SF Pro",sans-serif;font-size:17px;font-weight:600;line-height:22px}.doubao-template-transport-summary__arrival-day-offset{position:absolute;top:2px;left:100%;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;height:14px}.doubao-template-transport-summary__arrival-day-offset-text{color:var(--neutral-100);font-size:10px;font-weight:400;line-height:normal}.doubao-template-transport-summary__route-point-sub-text{color:var(--neutral-70);font-size:12px;font-weight:400;line-height:16px}.doubao-template-transport-summary__transfer-label-text{color:var(--neutral-50);font-size:10px;font-weight:400;line-height:14px}.doubao-template-transport-summary__transfer{display:flex;flex:none;flex-direction:row;align-items:center;justify-content:center;width:56px;min-width:0;height:42px;box-sizing:border-box}.doubao-template-transport-summary__transfer-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;width:56px;min-width:0;height:38px}.doubao-template-transport-summary__transfer-label{height:14px}.doubao-template-transport-summary__transfer-arrow{display:flex;flex-direction:row;align-items:center;justify-content:center;width:36px;height:6px;flex-shrink:0}.doubao-template-transport-summary__transfer-arrow-icon{width:36px;height:6px;flex-shrink:0}.doubao-template-transport-summary__price{flex:0 0 88px;flex-direction:column;align-items:flex-end;justify-content:center;width:88px;height:42px;box-sizing:border-box}.doubao-template-transport-summary__price>.doubao-price{justify-content:flex-end;width:100%;min-width:0;overflow:hidden}.doubao-template-transport-summary__price .doubao-price__amount,.doubao-template-transport-summary__price .doubao-price__main,.doubao-template-transport-summary__price .doubao-price__integer-group{max-width:100%;min-width:0;overflow:hidden}.doubao-template-transport-summary__price .doubao-price__main,.doubao-template-transport-summary__price .doubao-price__integer-group,.doubao-template-transport-summary__price .doubao-price__integer{flex-shrink:1}.doubao-template-transport-summary__price .doubao-price__integer{min-width:0;overflow:hidden;text-overflow:ellipsis}.doubao-template-transport-summary__price--with-action{gap:1px;height:39px}.doubao-template-transport-summary__price-action{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;width:100%;min-width:0;height:16px;overflow:hidden}.doubao-template-transport-summary__price-action-text{min-width:0;overflow:hidden;font-family:"PingFang SC",sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:16px;text-align:right;text-overflow:ellipsis;white-space:nowrap}.doubao-template-transport-summary__price-action-text--highlight{color:#ff375f}.doubao-template-transport-summary__price-action-text--muted{color:var(--neutral-70)}.doubao-template-transport-summary__price-action-icon{width:10px;height:10px;margin-right:-3px;flex-shrink:0;opacity:.34}.doubao-template-transport-summary__price--with-tag{gap:4px;height:46px}
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { AskHumanCard, type AskHumanCardArrowPosition, type AskHumanCardItem, ty
7
7
  export { CheckoutCard, type CheckoutCardFeeItem, type CheckoutCardInfoItem, type CheckoutCardProductItem, type CheckoutCardProps } from './checkout-card/index.js';
8
8
  export { PriceActionCard, type PriceActionCardInfoRow, type PriceActionCardItem, type PriceActionCardProps } from './price-action-card/index.js';
9
9
  export { MapCard, type MapCardMapProps, type MapCardMetaItem, type MapCardMetaTone, type MapCardProps } from './map-card/index.js';
10
- export { TransitCard, type TransitCardItem, type TransitCardPrice, type TransitCardProps, type TransitCardTag } from './transit-card/index.js';
10
+ export { TransitCard, type TransitCardItem, type TransitCardPrice, type TransitCardPriceAction, type TransitCardPriceActionTone, type TransitCardProps, type TransitCardTag } from './transit-card/index.js';
11
11
  export type { TemplateKey, TemplateTagTone, TemplateText } from './types.js';
12
12
  export { TicketOrderCard, type TicketOrderCardFeeItem, type TicketOrderCardInfoItem, type TicketOrderCardProps, type TicketOrderCardRouteItem } from './ticket-order-card/index.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- .doubao-price{display:flex;flex-direction:row;align-items:flex-end;gap:4px;height:22px;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal;white-space:nowrap}.doubao-price--tone-highlight .doubao-price__prefix,.doubao-price--tone-highlight .doubao-price__currency,.doubao-price--tone-highlight .doubao-price__integer,.doubao-price--tone-highlight .doubao-price__decimal,.doubao-price--tone-highlight .doubao-price__suffix{color:#ff375f}.doubao-price--loading{align-items:center;width:100%}.doubao-price__amount{display:flex;flex-direction:row;align-items:flex-end;gap:2px;height:22px;flex-shrink:0}.doubao-price__affix,.doubao-price__meta{display:flex;flex-direction:row;align-items:center;gap:4px;height:19px;flex-shrink:0}.doubao-price__main{display:flex;flex-direction:row;align-items:flex-end;height:22px;flex-shrink:0}.doubao-price__integer-group{display:flex;flex-direction:row;align-items:center;height:22px;flex-shrink:0}.doubao-price__decimal-group{display:flex;align-items:center;height:21px;flex-shrink:0}.doubao-price__prefix,.doubao-price__currency,.doubao-price__integer,.doubao-price__decimal,.doubao-price__suffix,.doubao-price__description,.doubao-price__original-price{display:block;flex-shrink:0;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal;letter-spacing:0;white-space:nowrap}.doubao-price__prefix{font-size:12px;font-weight:500;line-height:11px}.doubao-price__prefix.doubao-price__prefix--tone-default{color:var(--neutral-100)}.doubao-price__prefix.doubao-price__prefix--tone-highlight{color:#ff375f}.doubao-price__prefix.doubao-price__prefix--tone-muted{color:var(--neutral-70)}.doubao-price__currency{font-size:13px;font-weight:500;line-height:11px}.doubao-price__integer{font-size:17px;font-weight:500;line-height:24px}.doubao-price__decimal{font-size:14px;font-weight:500;line-height:11px}.doubao-price__suffix,.doubao-price__description,.doubao-price__original-price{font-size:13px;font-weight:400;line-height:11px}.doubao-price__description,.doubao-price__original-price{color:var(--neutral-70)}.doubao-price__original-price{text-decoration:line-through}.doubao-price__placeholder{width:100%;max-width:60%;height:16px;border-radius:4px;background-image:linear-gradient(90deg, #f7f7f7 0%, #e6e6e6 30%, #f7f7f7 100%);background-size:200% 100%;animation:doubao-price-placeholder-shimmer 1.4s ease-in-out infinite}@keyframes doubao-price-placeholder-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
1
+ .doubao-price{display:flex;flex-direction:row;align-items:flex-end;gap:4px;height:22px;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal;white-space:nowrap}.doubao-price--tone-highlight .doubao-price__prefix,.doubao-price--tone-highlight .doubao-price__currency,.doubao-price--tone-highlight .doubao-price__integer,.doubao-price--tone-highlight .doubao-price__decimal,.doubao-price--tone-highlight .doubao-price__suffix{color:#ff375f}.doubao-price--loading{align-items:center;width:100%}.doubao-price__amount{display:flex;flex-direction:row;align-items:flex-end;gap:2px;height:22px;flex-shrink:0}.doubao-price__affix,.doubao-price__meta{display:flex;flex-direction:row;align-items:center;gap:4px;height:19px;flex-shrink:0}.doubao-price__main{display:flex;flex-direction:row;align-items:flex-end;height:22px;flex-shrink:0}.doubao-price__integer-group{display:flex;flex-direction:row;align-items:center;height:22px;flex-shrink:0}.doubao-price__decimal-group{display:flex;align-items:center;height:21px;flex-shrink:0}.doubao-price__prefix,.doubao-price__currency,.doubao-price__integer,.doubao-price__decimal,.doubao-price__suffix,.doubao-price__description,.doubao-price__original-price{display:block;flex-shrink:0;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal;letter-spacing:0;white-space:nowrap}.doubao-price__prefix{font-size:12px;font-weight:500;line-height:11px}.doubao-price__prefix.doubao-price__prefix--tone-default{color:var(--neutral-100)}.doubao-price__prefix.doubao-price__prefix--tone-highlight{color:#ff375f}.doubao-price__prefix.doubao-price__prefix--tone-muted{color:var(--neutral-70)}.doubao-price__currency{font-size:13px;font-weight:500;line-height:11px}.doubao-price__integer{font-family:"SF Pro",sans-serif;font-size:17px;font-weight:500;line-height:24px}.doubao-price__decimal{font-family:"SF Pro",sans-serif;font-size:14px;font-weight:500;line-height:11px}.doubao-price__suffix,.doubao-price__description,.doubao-price__original-price{font-size:13px;font-weight:400;line-height:11px}.doubao-price__description,.doubao-price__original-price{color:var(--neutral-70)}.doubao-price__original-price{text-decoration:line-through}.doubao-price__placeholder{width:100%;max-width:60%;height:16px;border-radius:4px;background-image:linear-gradient(90deg, #f7f7f7 0%, #e6e6e6 30%, #f7f7f7 100%);background-size:200% 100%;animation:doubao-price-placeholder-shimmer 1.4s ease-in-out infinite}@keyframes doubao-price-placeholder-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
@@ -27,7 +27,7 @@ function renderTransitCardItem({ item, index, isLast }) {
27
27
  return <view className={clsx('doubao-transit-card__item', isLast && 'doubao-transit-card__item--last', item.className)} style={item.style} key={item.key ?? index} {...null != item.onClick ? {
28
28
  catchtap: item.onClick
29
29
  } : {}}>
30
- <TemplateTransportSummary className="doubao-template-transport-summary--list" title={item.title} departureMain={item.departureMain} departureSub={item.departureSub} transfer={item.transfer} transferTop={item.transferTop} transferBottom={item.transferBottom} arrivalMain={item.arrivalMain} arrivalDayOffset={item.arrivalDayOffset} arrivalSub={item.arrivalSub} price={renderTransitCardPrice(item.price)} tag={renderTransitCardTag(item.tag)}/>
30
+ <TemplateTransportSummary className="doubao-template-transport-summary--list" title={item.title} departureMain={item.departureMain} departureSub={item.departureSub} transfer={item.transfer} transferTop={item.transferTop} transferBottom={item.transferBottom} arrivalMain={item.arrivalMain} arrivalDayOffset={item.arrivalDayOffset} arrivalSub={item.arrivalSub} price={renderTransitCardPrice(item.price)} priceActionText={item.priceAction?.text} priceActionTone={item.priceAction?.tone} showPriceActionIcon={item.priceAction?.showIcon} tag={renderTransitCardTag(item.tag)}/>
31
31
  {!isLast && <view className="doubao-transit-card__item--spread"/>}
32
32
  </view>;
33
33
  }
@@ -42,6 +42,8 @@ export interface TransitCardItem {
42
42
  arrivalSub?: TemplateText;
43
43
  /** 价格配置或价格块内容。 */
44
44
  price?: TransitCardPrice | ReactNode;
45
+ /** 价格下方的操作配置;与 tag 同时传入时优先展示。 */
46
+ priceAction?: TransitCardPriceAction;
45
47
  /** 价格下方的标签配置。 */
46
48
  tag?: TransitCardTag;
47
49
  /** 列表项根节点自定义类名。 */
@@ -63,6 +65,15 @@ export interface TransitCardPrice {
63
65
  /** 价格色调。 */
64
66
  tone?: PriceTone;
65
67
  }
68
+ export interface TransitCardPriceAction {
69
+ /** 操作文案。 */
70
+ text: TemplateText;
71
+ /** 文案色调。@defaultValue highlight */
72
+ tone?: TransitCardPriceActionTone;
73
+ /** 是否展示文案右侧箭头。@defaultValue true */
74
+ showIcon?: boolean;
75
+ }
76
+ export type TransitCardPriceActionTone = 'highlight' | 'muted';
66
77
  export interface TransitCardTag {
67
78
  /** 标签内容。 */
68
79
  text: TagValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/template",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {