@doubao-dev/template 0.11.0-rc.10 → 0.11.0

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
@@ -52,6 +52,14 @@ export default function ProductCard() {
52
52
 
53
53
  ## 使用约定
54
54
 
55
+ `ContentCard.topBar` 配置内容列表上方的业务信息栏,例如
56
+ `topBar={{ title: '外卖 · 瑞幸咖啡 (上海尚浦店)', extra: '距你 360m' }}`;两侧只接受文字或数字,单行超出省略,不传时不占空间。
57
+ 在组合卡中,通过 `content` section 的 `props.topBar` 配置同一信息栏。
58
+ `CompositeCard` 支持 `product` section:`props.items` 配置商品标题、图片、价格和点击回调,
59
+ 最多展示前三项,始终按卡片可用宽度三等分,间距 8px。价格复用 `Price size="sm"`,不接受自定义 JSX。
60
+ `Tag.text` 支持 `{ text, tone? }[]`,自行管理 4px 标签间距和 26px 单行容器;单值用法保持不变。
61
+ `Price.size` 默认 `md` 保持原样,`sm` 提供 13px 现价与灰色删除线原价的紧凑排版。
62
+
55
63
  - 对话流 Widget 必须使用平台模板。组合多个已知模块或定制内容区时使用 `CompositeCard` 的 `sections`,卡片外壳、header 和 footer 仍由模板管理;不通过 `children` 自定义整张卡片布局。
56
64
  - `header`、内容区和 `footer` 独立配置;`onClick` 作用于卡片根节点。
57
65
  - 模板和 Primitives 不声明或暴露组件级 CSS 变量,可以直接使用已有的全局主题 token。
@@ -0,0 +1,21 @@
1
+ import type { TouchEvent } from '@lynx-js/types';
2
+ import { type PriceProps } from '../../primitives/price/index.js';
3
+ import type { TemplateKey, TemplateText } from '../../types.js';
4
+ import './styles.scss';
5
+ export interface CompositeCardProductItem {
6
+ key?: TemplateKey;
7
+ /** 商品标题,最多一行。 */
8
+ title: TemplateText;
9
+ /** 商品图片;不传时保留正方形占位。 */
10
+ imageSrc?: string;
11
+ /** 小号价格配置。 */
12
+ price?: Pick<PriceProps, 'value' | 'currency' | 'originalPrice' | 'tone'>;
13
+ /** 点击该商品时触发,不冒泡到卡片根节点。 */
14
+ onClick?: (event: TouchEvent) => void;
15
+ }
16
+ export interface CompositeCardProductProps {
17
+ /** 最多展示前三个商品,始终使用三等分列宽。 */
18
+ items: CompositeCardProductItem[];
19
+ }
20
+ export declare function ProductSection({ items }: CompositeCardProductProps): any;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { Price } from "../../primitives/price/index.js";
2
+ import { useTemplateClickHandler } from "../../utils/report.js";
3
+ import "./styles.css";
4
+ function ProductItemView({ item, index }) {
5
+ const handleClick = useTemplateClickHandler('item', item.onClick, {
6
+ itemIndex: index,
7
+ clickText: item.title
8
+ });
9
+ return <view className="doubao-template-product-section__item" {...null != handleClick ? {
10
+ catchtap: handleClick
11
+ } : {}}>
12
+ <view className="doubao-template-product-section__image">
13
+ {item.imageSrc ? <image className="doubao-template-product-section__image-content" src={item.imageSrc} mode="aspectFill"/> : null}
14
+ </view>
15
+ <view className="doubao-template-product-section__text">
16
+ <text className="doubao-template-product-section__title" text-maxline="1">
17
+ {item.title}
18
+ </text>
19
+ {item.price ? <Price {...item.price} size="sm"/> : null}
20
+ </view>
21
+ </view>;
22
+ }
23
+ function ProductSection({ items }) {
24
+ return <view className="doubao-template-product-section">
25
+ {items.slice(0, 3).map((item, index)=><ProductItemView key={item.key ?? index} item={item} index={index}/>)}
26
+ </view>;
27
+ }
28
+ export { ProductSection };
@@ -0,0 +1 @@
1
+ .doubao-template-product-section{display:flex;flex-direction:row;gap:8px;width:100%;padding:0 12px 12px;box-sizing:border-box}.doubao-template-product-section__item{display:flex;flex-direction:column;flex-shrink:0;width:calc((100% - 16px)/3);min-width:0;overflow:hidden}.doubao-template-product-section__image{position:relative;width:100%;aspect-ratio:1;overflow:hidden;border-radius:8px;background-color:var(--bg-base-2-overlay)}.doubao-template-product-section__image-content{position:absolute;top:0;left:0;width:100%;height:100%}.doubao-template-product-section__text{display:flex;flex-direction:column;align-items:flex-start;min-width:0;padding-top:4px}.doubao-template-product-section__title{width:100%;overflow:hidden;font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto",sans-serif;font-size:13px;font-weight:500;line-height:19.5px;color:var(--neutral-100);white-space:nowrap;text-overflow:ellipsis}
@@ -0,0 +1,10 @@
1
+ import type { TemplateText } from '../../types.js';
2
+ import './styles.scss';
3
+ export interface ContentCardTopBarProps {
4
+ /** 左侧业务信息,最多一行,超出省略。 */
5
+ title: TemplateText;
6
+ /** 右侧补充信息,最多一行,超出省略。 */
7
+ extra?: TemplateText;
8
+ }
9
+ export declare function TemplateTopBar({ title, extra }: ContentCardTopBarProps): any;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,15 @@
1
+ import "./styles.css";
2
+ function TemplateTopBar({ title, extra }) {
3
+ const hasTitle = null != title && '' !== title;
4
+ const hasExtra = null != extra && '' !== extra;
5
+ if (!hasTitle && !hasExtra) return null;
6
+ return <view className="doubao-template-top-bar">
7
+ <text className="doubao-template-top-bar__title" text-maxline="1">
8
+ {title}
9
+ </text>
10
+ {hasExtra ? <text className="doubao-template-top-bar__extra" text-maxline="1">
11
+ {extra}
12
+ </text> : null}
13
+ </view>;
14
+ }
15
+ export { TemplateTopBar };
@@ -0,0 +1 @@
1
+ .doubao-template-top-bar{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-width:0;padding:12px 12px 0;box-sizing:border-box}.doubao-template-top-bar__title,.doubao-template-top-bar__extra{min-width:0;overflow:hidden;font-family:"PingFang SC",sans-serif;font-size:13px;font-style:normal;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.doubao-template-top-bar__title{flex:1;color:var(--neutral-100);font-weight:500}.doubao-template-top-bar__extra{flex-shrink:1;max-width:50%;margin-left:8px;color:var(--neutral-70);font-weight:400;text-align:right}
@@ -2,6 +2,7 @@ import type { TouchEvent } from '@lynx-js/types';
2
2
  import type { ReactElement } from 'react';
3
3
  import { type TemplateCardFooterProps } from '../components/footer/index.js';
4
4
  import { type TemplateCardHeaderProps } from '../components/header/index.js';
5
+ import { type CompositeCardProductProps } from '../components/product-section/index.js';
5
6
  import { type ContentCardProps } from '../content-card/index.js';
6
7
  import { type OptionGroupProps } from '../primitives/option-group/index.js';
7
8
  import type { TransitCardProps } from '../transit-card/index.js';
@@ -16,7 +17,7 @@ export interface CompositeCardContentSection {
16
17
  /** 内容列表模块。 */
17
18
  type: 'content';
18
19
  /** 内容列表模块配置。 */
19
- props: Pick<ContentCardProps, 'items'>;
20
+ props: Pick<ContentCardProps, 'items' | 'topBar'>;
20
21
  }
21
22
  export interface CompositeCardOptionGroupSection {
22
23
  /** 选项组模块。 */
@@ -24,6 +25,12 @@ export interface CompositeCardOptionGroupSection {
24
25
  /** 选项组模块配置。 */
25
26
  props: OptionGroupProps;
26
27
  }
28
+ export type { CompositeCardProductItem, CompositeCardProductProps } from '../components/product-section/index.js';
29
+ export interface CompositeCardProductSection {
30
+ /** 三列商品展示模块。 */
31
+ type: 'product';
32
+ props: CompositeCardProductProps;
33
+ }
27
34
  export interface CompositeCardCustomSection {
28
35
  /** 由业务维护的内容区,仍由组合卡管理外壳与标准操作区。 */
29
36
  type: 'custom';
@@ -37,7 +44,7 @@ export interface CompositeCardHeaderProps extends TemplateCardHeaderProps {
37
44
  /** 浮层品牌图标,不传时使用应用插件图标。 */
38
45
  iconSrc?: string;
39
46
  }
40
- export type CompositeCardSection = CompositeCardTransitSection | CompositeCardContentSection | CompositeCardOptionGroupSection | CompositeCardCustomSection;
47
+ export type CompositeCardSection = CompositeCardTransitSection | CompositeCardContentSection | CompositeCardOptionGroupSection | CompositeCardProductSection | CompositeCardCustomSection;
41
48
  export interface CompositeCardProps {
42
49
  /** 标题栏配置。 */
43
50
  header?: CompositeCardHeaderProps;
@@ -1,6 +1,7 @@
1
1
  import { useThemeClassName } from "@byted-doubao-apps/components";
2
2
  import { TemplateCardFooter } from "../components/footer/index.js";
3
3
  import { TemplateCardHeader } from "../components/header/index.js";
4
+ import { ProductSection } from "../components/product-section/index.js";
4
5
  import { ContentCardContent } from "../content-card/index.js";
5
6
  import { OptionGroup } from "../primitives/option-group/index.js";
6
7
  import { TransitCardContent } from "../transit-card/content.js";
@@ -12,9 +13,11 @@ function isCompositeCardSectionVisible(section) {
12
13
  case 'transit':
13
14
  return (section.props.items?.length ?? 0) > 0;
14
15
  case 'content':
15
- return (section.props.items?.length ?? 0) > 0;
16
+ return (section.props.items?.length ?? 0) > 0 || null != section.props.topBar;
16
17
  case 'option-group':
17
18
  return section.props.items.length > 0;
19
+ case 'product':
20
+ return section.props.items.length > 0;
18
21
  case 'custom':
19
22
  return null != section.content;
20
23
  default:
@@ -26,13 +29,15 @@ function renderCompositeCardSectionContent(section) {
26
29
  case 'transit':
27
30
  return <TransitCardContent items={section.props.items}/>;
28
31
  case 'content':
29
- return <ContentCardContent items={section.props.items}/>;
32
+ return <ContentCardContent items={section.props.items} topBar={section.props.topBar}/>;
30
33
  case 'option-group':
31
34
  return <view className="doubao-composite-card__option-group">
32
35
  <OptionGroup {...section.props}/>
33
36
  </view>;
34
37
  case 'custom':
35
38
  return section.content;
39
+ case 'product':
40
+ return <ProductSection {...section.props}/>;
36
41
  default:
37
42
  return null;
38
43
  }
@@ -3,11 +3,15 @@ import type { ReactElement } from 'react';
3
3
  import { type TemplateExtraAction } from '../components/extra-action/index.js';
4
4
  import { type TemplateCardFooterProps } from '../components/footer/index.js';
5
5
  import { type TemplateCardHeaderProps } from '../components/header/index.js';
6
+ import { type ContentCardTopBarProps } from '../components/top-bar/index.js';
6
7
  import type { TemplateKey } from '../types.js';
7
8
  import './styles.scss';
9
+ export type { ContentCardTopBarProps } from '../components/top-bar/index.js';
8
10
  export interface ContentCardProps {
9
11
  /** 标题栏配置。 */
10
12
  header?: TemplateCardHeaderProps;
13
+ /** 内容列表上方的业务信息栏,不传时不占空间。 */
14
+ topBar?: ContentCardTopBarProps;
11
15
  /** 列表内容数据。 */
12
16
  items?: ContentCardItem[];
13
17
  /** 底部操作区配置。 */
@@ -33,6 +37,6 @@ export interface ContentCardItem {
33
37
  /** 点击列表项时触发。 */
34
38
  onClick?: (event: TouchEvent) => void;
35
39
  }
36
- export declare function ContentCardContent({ items }: Pick<ContentCardProps, 'items'>): ReactElement;
40
+ export declare function ContentCardContent({ items, topBar }: Pick<ContentCardProps, 'items' | 'topBar'>): ReactElement;
37
41
  export declare function ContentCard(props: ContentCardProps): ReactElement;
38
42
  //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,7 @@ import { clsx } from "clsx";
3
3
  import { renderTemplateExtraAction, stopTemplateExtraActionTap } from "../components/extra-action/index.js";
4
4
  import { TemplateCardFooter } from "../components/footer/index.js";
5
5
  import { TemplateCardHeader } from "../components/header/index.js";
6
+ import { TemplateTopBar } from "../components/top-bar/index.js";
6
7
  import { TemplateTelemetryProvider, useTemplateClickHandler } from "../utils/report.js";
7
8
  import { useHostCardStyle } from "../utils/use-host-card-style.js";
8
9
  import "./styles.css";
@@ -72,21 +73,22 @@ function ContentCardItemView({ item, index, isLast }) {
72
73
  {!isLast && <view className={clsx('doubao-content-card__divider', !hasThumbnail && 'doubao-content-card__divider--without-thumbnail')}/>}
73
74
  </view>;
74
75
  }
75
- function ContentCardContent({ items }) {
76
+ function ContentCardContent({ items, topBar }) {
76
77
  const contentItems = items ?? [];
77
78
  return <view className="doubao-content-card__body">
79
+ {topBar ? <TemplateTopBar {...topBar}/> : null}
78
80
  {contentItems.map((item, index)=><ContentCardItemView key={item.key ?? index} item={item} index={index} isLast={index === contentItems.length - 1}/>)}
79
81
  </view>;
80
82
  }
81
83
  function ContentCard(props) {
82
- const { header, items, footer, onClick } = props;
84
+ const { header, topBar, items, footer, onClick } = props;
83
85
  const cardStyle = useHostCardStyle();
84
86
  return <TemplateTelemetryProvider value={{
85
87
  templateName: 'ContentCard'
86
88
  }}>
87
89
  <view className={useThemeClassName('doubao-content-card')} style={cardStyle} bindtap={onClick} clip-radius="true">
88
90
  <TemplateCardHeader actionText={header?.actionText} statusText={header?.statusText} showAction={header?.showAction} onActionClick={header?.onActionClick}/>
89
- <ContentCardContent items={items}/>
91
+ <ContentCardContent items={items} topBar={topBar}/>
90
92
  <TemplateCardFooter primaryActionButton={footer?.primaryActionButton} secondaryActionButton={footer?.secondaryActionButton} agreement={footer?.agreement}/>
91
93
  </view>
92
94
  </TemplateTelemetryProvider>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { ContentCard, type ContentCardItem, type ContentCardProps } from './content-card/index.js';
1
+ export { ContentCard, type ContentCardItem, type ContentCardProps, type ContentCardTopBarProps } from './content-card/index.js';
2
2
  export { CouponCard, type CouponCardItem, type CouponCardProps } from './coupon-card/index.js';
3
- export { CompositeCard, type CompositeCardContentSection, type CompositeCardOptionGroupSection, type CompositeCardCustomSection, type CompositeCardHeaderProps, type CompositeCardProps, type CompositeCardSection, type CompositeCardTransitSection } from './composite-card/index.js';
3
+ export { CompositeCard, type CompositeCardContentSection, type CompositeCardOptionGroupSection, type CompositeCardProductItem, type CompositeCardProductProps, type CompositeCardProductSection, type CompositeCardCustomSection, type CompositeCardHeaderProps, type CompositeCardProps, type CompositeCardSection, type CompositeCardTransitSection } from './composite-card/index.js';
4
4
  export type { TemplateCardHeaderProps } from './components/header/index.js';
5
5
  export type { TemplateCardFooterActionButton, TemplateCardFooterProps } from './components/footer/index.js';
6
6
  export type { TemplateExtraAction, TemplateExtraActionAdd, TemplateExtraActionButton, TemplateExtraActionPlayback, TemplateExtraActionStepper, TemplateExtraActionSwitch } from './components/extra-action/index.js';
@@ -2,8 +2,8 @@ export { Agreement, type AgreementLink, type AgreementProps } from './agreement/
2
2
  export { Checkbox, type CheckboxProps } from './checkbox/index.js';
3
3
  export { Icon, type IconName, type IconProps } from './icon/index.js';
4
4
  export { OptionGroup, type OptionGroupItem, type OptionGroupLargeItem, type OptionGroupMediumItem, type OptionGroupProps, type OptionGroupSize, type OptionGroupText, type OptionGroupValue } from './option-group/index.js';
5
- export { Price, type PricePrefixTone, type PriceProps, type PriceTone, type PriceValue } from './price/index.js';
5
+ export { Price, type PricePrefixTone, type PriceProps, type PriceSize, type PriceTone, type PriceValue } from './price/index.js';
6
6
  export { Stepper, type StepperProps } from './stepper/index.js';
7
- export { Tag, type TagProps, type TagTone, type TagValue } from './tag/index.js';
7
+ export { Tag, type TagItem, type TagProps, type TagTone, type TagValue } from './tag/index.js';
8
8
  export { Title, type TitleMaxLines, type TitleProps, type TitleSegment, type TitleTone, type TitleValue } from './title/index.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { PriceProps } from './types.js';
2
2
  import './styles.scss';
3
- export type { PricePrefixTone, PriceProps, PriceTone, PriceValue } from './types.js';
4
- export declare function Price({ value, currency, prefix, prefixTone, suffix, description, originalPrice, tone, loading }: PriceProps): any;
3
+ export type { PricePrefixTone, PriceProps, PriceSize, PriceTone, PriceValue } from './types.js';
4
+ export declare function Price({ value, size, currency, prefix, prefixTone, suffix, description, originalPrice, tone, loading }: PriceProps): any;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -17,10 +17,10 @@ function formatOriginalPrice(value, currency) {
17
17
  const originalPrice = String(value);
18
18
  return currency && originalPrice.startsWith(currency) ? originalPrice : `${currency}${originalPrice}`;
19
19
  }
20
- function Price({ value, currency = '¥', prefix, prefixTone, suffix, description, originalPrice, tone = 'default', loading = false }) {
20
+ function Price({ value, size = 'md', currency = '¥', prefix, prefixTone, suffix, description, originalPrice, tone = 'default', loading = false }) {
21
21
  const themedClassName = useThemeClassName();
22
22
  const { integer, decimal } = splitPriceValue(value);
23
- return <view className={clsx('doubao-price', `doubao-price--tone-${tone}`, {
23
+ return <view className={clsx('doubao-price', 'sm' === size && 'doubao-price--size-sm', `doubao-price--tone-${tone}`, {
24
24
  'doubao-price--loading': loading
25
25
  }, themedClassName)}>
26
26
  {loading ? <view className="doubao-price__placeholder"/> : <>
@@ -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:var(--theme-default-link)}.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:var(--theme-default-link)}.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}}
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:var(--theme-default-link)}.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:var(--theme-default-link)}.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}.doubao-price--size-sm{align-items:center;height:20px}.doubao-price--size-sm .doubao-price__amount,.doubao-price--size-sm .doubao-price__affix,.doubao-price--size-sm .doubao-price__main,.doubao-price--size-sm .doubao-price__integer-group,.doubao-price--size-sm .doubao-price__decimal-group,.doubao-price--size-sm .doubao-price__meta{align-items:center;height:20px}.doubao-price--size-sm .doubao-price__prefix,.doubao-price--size-sm .doubao-price__currency,.doubao-price--size-sm .doubao-price__integer,.doubao-price--size-sm .doubao-price__decimal,.doubao-price--size-sm .doubao-price__suffix,.doubao-price--size-sm .doubao-price__description,.doubao-price--size-sm .doubao-price__original-price{font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto",sans-serif;font-size:13px;line-height:19.5px}@keyframes doubao-price-placeholder-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
@@ -1,9 +1,12 @@
1
1
  export type PriceValue = string | number;
2
+ export type PriceSize = 'md' | 'sm';
2
3
  export type PriceTone = 'default' | 'highlight';
3
4
  export type PricePrefixTone = 'default' | 'highlight' | 'muted';
4
5
  export interface PriceProps {
5
6
  /** 价格值。传入字符串时会保留前导零和末尾小数位。 */
6
7
  value: PriceValue;
8
+ /** 价格尺寸。sm 使用 13px 同字号排版;md 保留标准价格样式。@defaultValue 'md' */
9
+ size?: PriceSize;
7
10
  /** 币种符号。@defaultValue '¥' */
8
11
  currency?: string;
9
12
  /** 价格前缀,例如“均”“起”。 */
@@ -1,5 +1,5 @@
1
1
  import type { TagProps } from './types.js';
2
2
  import './styles.scss';
3
- export type { TagProps, TagTone, TagValue } from './types.js';
3
+ export type { TagItem, TagProps, TagTone, TagValue } from './types.js';
4
4
  export declare function Tag({ text, tone }: TagProps): any;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,24 @@
1
1
  import { useThemeClassName } from "@byted-doubao-apps/components";
2
2
  import { clsx } from "clsx";
3
3
  import "./styles.css";
4
+ function isTagItems(text1) {
5
+ return Array.isArray(text1);
6
+ }
7
+ function TagItemView({ text: text1, tone }) {
8
+ const visualTone = 'authority' === tone ? 'neutral' : tone;
9
+ return <view className={clsx('doubao-tag', `doubao-tag--tone-${visualTone}`)}>
10
+ <text className="doubao-tag__text">{text1}</text>
11
+ </view>;
12
+ }
4
13
  function Tag({ text: text1, tone = 'neutral' }) {
5
14
  const themedClassName = useThemeClassName();
15
+ if (isTagItems(text1)) {
16
+ const items = text1.filter((item)=>'' !== item.text);
17
+ if (0 === items.length) return null;
18
+ return <view className={clsx('doubao-tag-list', themedClassName)}>
19
+ {items.map((item, index)=><TagItemView key={index} text={item.text} tone={item.tone ?? tone}/>)}
20
+ </view>;
21
+ }
6
22
  const visualTone = 'authority' === tone ? 'neutral' : tone;
7
23
  return <view className={clsx('doubao-tag', `doubao-tag--tone-${visualTone}`, themedClassName)}>
8
24
  <text className="doubao-tag__text">{text1}</text>
@@ -1 +1 @@
1
- .doubao-tag{display:flex;align-items:center;height:20px;padding:2px 3px;box-sizing:border-box;flex-shrink:0;overflow:hidden;border-radius:4px}.doubao-tag__text{display:block;flex-shrink:0;font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:14px;white-space:nowrap}.doubao-tag--tone-marketing{background-color:#fff3e6}.doubao-tag--tone-marketing .doubao-tag__text{color:#e66805}.doubao-tag--tone-neutral{background-color:#f7f7f7}.doubao-tag--tone-neutral .doubao-tag__text{color:#666}.doubao-tag.doubao-theme-dark.doubao-tag--tone-marketing{background-color:#523e23}.doubao-tag.doubao-theme-dark.doubao-tag--tone-marketing .doubao-tag__text{color:var(--warning-500)}.doubao-tag.doubao-theme-dark.doubao-tag--tone-neutral{background-color:#252525}.doubao-tag.doubao-theme-dark.doubao-tag--tone-neutral .doubao-tag__text{color:#bababa}
1
+ .doubao-tag-list{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:flex-start;column-gap:4px;row-gap:6px;max-width:100%;height:26px;padding:3px 0;box-sizing:border-box;overflow:hidden}.doubao-tag{display:flex;align-items:center;height:20px;padding:2px 3px;box-sizing:border-box;flex-shrink:0;overflow:hidden;border-radius:4px}.doubao-tag__text{display:block;flex-shrink:0;font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:14px;white-space:nowrap}.doubao-tag--tone-marketing{background-color:#fff3e6}.doubao-tag--tone-marketing .doubao-tag__text{color:#e66805}.doubao-tag--tone-neutral{background-color:#f7f7f7}.doubao-tag--tone-neutral .doubao-tag__text{color:#666}.doubao-tag.doubao-theme-dark.doubao-tag--tone-marketing,.doubao-tag-list.doubao-theme-dark .doubao-tag.doubao-tag--tone-marketing{background-color:#523e23}.doubao-tag.doubao-theme-dark.doubao-tag--tone-marketing .doubao-tag__text,.doubao-tag-list.doubao-theme-dark .doubao-tag.doubao-tag--tone-marketing .doubao-tag__text{color:var(--warning-500)}.doubao-tag.doubao-theme-dark.doubao-tag--tone-neutral,.doubao-tag-list.doubao-theme-dark .doubao-tag.doubao-tag--tone-neutral{background-color:#252525}.doubao-tag.doubao-theme-dark.doubao-tag--tone-neutral .doubao-tag__text,.doubao-tag-list.doubao-theme-dark .doubao-tag.doubao-tag--tone-neutral .doubao-tag__text{color:#bababa}
@@ -1,9 +1,15 @@
1
- export type TagValue = string | number;
1
+ export interface TagItem {
2
+ /** 标签内容。 */
3
+ text: string | number;
4
+ /** 不传时继承 Tag 的 tone。 */
5
+ tone?: TagTone;
6
+ }
7
+ export type TagValue = string | number | readonly TagItem[];
2
8
  /** @deprecated 使用 neutral;authority 仅保留兼容,视觉与 neutral 相同。 */
3
9
  type DeprecatedAuthorityTone = 'authority';
4
10
  export type TagTone = 'marketing' | 'neutral' | DeprecatedAuthorityTone;
5
11
  export interface TagProps {
6
- /** 标签内容。 */
12
+ /** 单枚标签内容,或由组件管理排列的标签数组。 */
7
13
  text: TagValue;
8
14
  /** 标签色调。authority 已废弃,视觉与 neutral 相同。@defaultValue 'neutral' */
9
15
  tone?: TagTone;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/template",
3
- "version": "0.11.0-rc.10",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {