@doubao-dev/template 0.4.2 → 0.5.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.
Files changed (52) hide show
  1. package/README.md +42 -525
  2. package/dist/ask-human-card/index.d.ts +1 -9
  3. package/dist/ask-human-card/index.js +6 -5
  4. package/dist/checkout-card/index.d.ts +1 -5
  5. package/dist/checkout-card/index.js +4 -3
  6. package/dist/checkout-card/styles.css +1 -1
  7. package/dist/components/extra-action/index.d.ts +13 -3
  8. package/dist/components/extra-action/index.js +23 -1
  9. package/dist/components/extra-action/styles.css +1 -1
  10. package/dist/components/footer/index.d.ts +1 -5
  11. package/dist/components/footer/index.js +4 -5
  12. package/dist/components/product-summary/index.d.ts +3 -3
  13. package/dist/components/product-summary/styles.css +1 -1
  14. package/dist/composite-card/index.d.ts +1 -5
  15. package/dist/composite-card/index.js +4 -3
  16. package/dist/composite-card/styles.css +1 -1
  17. package/dist/content-card/index.d.ts +12 -30
  18. package/dist/content-card/index.js +20 -25
  19. package/dist/content-card/styles.css +1 -1
  20. package/dist/index.d.ts +1 -2
  21. package/dist/index.js +0 -1
  22. package/dist/map-card/index.d.ts +1 -5
  23. package/dist/map-card/index.js +4 -2
  24. package/dist/map-card/styles.css +1 -1
  25. package/dist/price-action-card/index.d.ts +2 -20
  26. package/dist/price-action-card/index.js +23 -26
  27. package/dist/price-action-card/styles.css +1 -1
  28. package/dist/primitives/icon/index.d.ts +1 -1
  29. package/dist/primitives/icon/index.js +2 -3
  30. package/dist/primitives/icon/types.d.ts +0 -5
  31. package/dist/primitives/option-group/index.js +2 -4
  32. package/dist/primitives/option-group/types.d.ts +3 -9
  33. package/dist/primitives/price/index.d.ts +1 -1
  34. package/dist/primitives/price/index.js +3 -3
  35. package/dist/primitives/price/types.d.ts +0 -5
  36. package/dist/primitives/tag/index.d.ts +1 -1
  37. package/dist/primitives/tag/index.js +3 -3
  38. package/dist/primitives/tag/types.d.ts +0 -5
  39. package/dist/primitives/title/index.d.ts +1 -1
  40. package/dist/primitives/title/index.js +3 -3
  41. package/dist/primitives/title/types.d.ts +0 -5
  42. package/dist/transit-card/content.js +2 -2
  43. package/dist/transit-card/index.d.ts +6 -16
  44. package/dist/transit-card/index.js +4 -3
  45. package/dist/transit-card/styles.css +1 -1
  46. package/dist/utils/icons.d.ts +2 -0
  47. package/dist/utils/icons.js +20 -1
  48. package/package.json +1 -1
  49. package/assets/ticket-order-card.png +0 -0
  50. package/dist/ticket-order-card/index.d.ts +0 -89
  51. package/dist/ticket-order-card/index.js +0 -27
  52. package/dist/ticket-order-card/styles.css +0 -1
@@ -1,5 +1,4 @@
1
1
  import { useTheme } from "@byted-doubao-apps/components";
2
- import { clsx } from "clsx";
3
2
  import "./styles.css";
4
3
  function getAddIconContent(color) {
5
4
  return `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -13,11 +12,11 @@ const ICON_CONTENT_GETTERS = {
13
12
  function isIconSupported(name) {
14
13
  return Object.prototype.hasOwnProperty.call(ICON_CONTENT_GETTERS, name);
15
14
  }
16
- function Icon({ name, className, style }) {
15
+ function Icon({ name }) {
17
16
  const theme = useTheme();
18
17
  const getContent = ICON_CONTENT_GETTERS[name];
19
18
  if (!getContent) return null;
20
19
  const color = 'dark' === theme ? '#777777' : '#999999';
21
- return <svg className={clsx('doubao-icon', className)} style={style} content={getContent(color)}/>;
20
+ return <svg className="doubao-icon" content={getContent(color)}/>;
22
21
  }
23
22
  export { Icon, isIconSupported };
@@ -1,11 +1,6 @@
1
- import type { CSSProperties } from '@lynx-js/types';
2
1
  export type IconName = 'add';
3
2
  export interface IconProps {
4
3
  /** 图标名称。 */
5
4
  name: IconName;
6
- /** 组件类名。 */
7
- className?: string;
8
- /** 组件样式。 */
9
- style?: CSSProperties;
10
5
  }
11
6
  //# sourceMappingURL=types.d.ts.map
@@ -66,14 +66,12 @@ function renderOptionViews(props) {
66
66
  });
67
67
  }
68
68
  function OptionGroup(props) {
69
- const { className, style } = props;
70
69
  const size = props.size ?? 'md';
71
70
  const columns = Math.min(resolveColumns(props.columns), Math.max(props.items.length, 1));
72
71
  const optionGroupStyle = 'lg' === size ? {
73
- ...style,
74
72
  gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
75
- } : style;
76
- const themedClassName = useThemeClassName(clsx('doubao-option-group', `doubao-option-group--size-${size}`, className));
73
+ } : void 0;
74
+ const themedClassName = useThemeClassName(clsx('doubao-option-group', `doubao-option-group--size-${size}`));
77
75
  const optionViews = renderOptionViews(props);
78
76
  return <view className={themedClassName} style={optionGroupStyle}>
79
77
  {optionViews}
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, TouchEvent } from '@lynx-js/types';
1
+ import type { TouchEvent } from '@lynx-js/types';
2
2
  import type { IconName } from '../icon/index.js';
3
3
  export type OptionGroupValue = string | number;
4
4
  export type OptionGroupText = string | number;
@@ -24,20 +24,14 @@ export interface OptionGroupLargeItem extends OptionGroupItemCommon {
24
24
  icon?: never;
25
25
  }
26
26
  export type OptionGroupItem = OptionGroupMediumItem | OptionGroupLargeItem;
27
- interface OptionGroupCommonProps {
28
- /** 组件类名。 */
29
- className?: string;
30
- /** 组件样式。 */
31
- style?: CSSProperties;
32
- }
33
- interface OptionGroupMediumLayoutProps extends OptionGroupCommonProps {
27
+ interface OptionGroupMediumLayoutProps {
34
28
  /** 选项尺寸。@defaultValue 'md' */
35
29
  size?: 'md';
36
30
  /** 中尺寸选项数据。 */
37
31
  items: OptionGroupMediumItem[];
38
32
  columns?: never;
39
33
  }
40
- interface OptionGroupLargeLayoutProps extends OptionGroupCommonProps {
34
+ interface OptionGroupLargeLayoutProps {
41
35
  /** 选项尺寸。 */
42
36
  size: 'lg';
43
37
  /** 大尺寸选项数据。 */
@@ -1,5 +1,5 @@
1
1
  import type { PriceProps } from './types.js';
2
2
  import './styles.scss';
3
3
  export type { PricePrefixTone, PriceProps, PriceTone, PriceValue } from './types.js';
4
- export declare function Price({ value, currency, prefix, prefixTone, suffix, description, originalPrice, tone, loading, className, style }: PriceProps): any;
4
+ export declare function Price({ value, currency, prefix, prefixTone, suffix, description, originalPrice, tone, loading }: PriceProps): any;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -17,12 +17,12 @@ 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, className, style }) {
21
- const themedClassName = useThemeClassName(className);
20
+ function Price({ value, currency = '¥', prefix, prefixTone, suffix, description, originalPrice, tone = 'default', loading = false }) {
21
+ const themedClassName = useThemeClassName();
22
22
  const { integer, decimal } = splitPriceValue(value);
23
23
  return <view className={clsx('doubao-price', `doubao-price--tone-${tone}`, {
24
24
  'doubao-price--loading': loading
25
- }, themedClassName)} style={style}>
25
+ }, themedClassName)}>
26
26
  {loading ? <view className="doubao-price__placeholder"/> : <>
27
27
  <view className="doubao-price__amount">
28
28
  {prefix ? <view className="doubao-price__affix">
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from '@lynx-js/types';
2
1
  export type PriceValue = string | number;
3
2
  export type PriceTone = 'default' | 'highlight';
4
3
  export type PricePrefixTone = 'default' | 'highlight' | 'muted';
@@ -21,9 +20,5 @@ export interface PriceProps {
21
20
  tone?: PriceTone;
22
21
  /** 是否展示价格占位骨架。@defaultValue false */
23
22
  loading?: boolean;
24
- /** 组件类名。 */
25
- className?: string;
26
- /** 组件样式。 */
27
- style?: CSSProperties;
28
23
  }
29
24
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { TagProps } from './types.js';
2
2
  import './styles.scss';
3
3
  export type { TagProps, TagTone, TagValue } from './types.js';
4
- export declare function Tag({ text, tone, className, style }: TagProps): any;
4
+ export declare function Tag({ text, tone }: TagProps): any;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { useThemeClassName } from "@byted-doubao-apps/components";
2
2
  import { clsx } from "clsx";
3
3
  import "./styles.css";
4
- function Tag({ text: text1, tone = 'authority', className, style }) {
5
- const themedClassName = useThemeClassName(className);
6
- return <view className={clsx('doubao-tag', `doubao-tag--tone-${tone}`, themedClassName)} style={style}>
4
+ function Tag({ text: text1, tone = 'authority' }) {
5
+ const themedClassName = useThemeClassName();
6
+ return <view className={clsx('doubao-tag', `doubao-tag--tone-${tone}`, themedClassName)}>
7
7
  <text className="doubao-tag__text">{text1}</text>
8
8
  </view>;
9
9
  }
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from '@lynx-js/types';
2
1
  export type TagValue = string | number;
3
2
  export type TagTone = 'marketing' | 'authority' | 'neutral';
4
3
  export interface TagProps {
@@ -6,9 +5,5 @@ export interface TagProps {
6
5
  text: TagValue;
7
6
  /** 标签色调。@defaultValue 'authority' */
8
7
  tone?: TagTone;
9
- /** 组件类名。 */
10
- className?: string;
11
- /** 组件样式。 */
12
- style?: CSSProperties;
13
8
  }
14
9
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { TitleProps } from './types.js';
2
2
  import './styles.scss';
3
3
  export type { TitleMaxLines, TitleProps, TitleValue } from './types.js';
4
- export declare function Title({ text, maxLines, showArrow, loading, className, style }: TitleProps): any;
4
+ export declare function Title({ text, maxLines, showArrow, loading }: TitleProps): any;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -2,11 +2,11 @@ import { useThemeClassName } from "@byted-doubao-apps/components";
2
2
  import { clsx } from "clsx";
3
3
  import { TemplateChevronRightIcon } from "../../components/chevron-right-icon/index.js";
4
4
  import "./styles.css";
5
- function Title({ text: text1, maxLines = 1, showArrow = true, loading = false, className, style }) {
6
- const themedClassName = useThemeClassName(className);
5
+ function Title({ text: text1, maxLines = 1, showArrow = true, loading = false }) {
6
+ const themedClassName = useThemeClassName();
7
7
  return <view className={clsx('doubao-title', `doubao-title--lines-${maxLines}`, {
8
8
  'doubao-title--loading': loading
9
- }, themedClassName)} style={style}>
9
+ }, themedClassName)}>
10
10
  {loading ? <view className="doubao-title__placeholder"/> : <>
11
11
  <text className="doubao-title__text" text-maxline={maxLines}>
12
12
  {text1}
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from '@lynx-js/types';
2
1
  export type TitleValue = string | number;
3
2
  export type TitleMaxLines = 1 | 2;
4
3
  export interface TitleProps {
@@ -10,9 +9,5 @@ export interface TitleProps {
10
9
  showArrow?: boolean;
11
10
  /** 是否展示标题占位骨架。@defaultValue false */
12
11
  loading?: boolean;
13
- /** 组件类名。 */
14
- className?: string;
15
- /** 组件样式。 */
16
- style?: CSSProperties;
17
12
  }
18
13
  //# sourceMappingURL=types.d.ts.map
@@ -24,10 +24,10 @@ function renderTransitCardTag(tag) {
24
24
  return <Tag text={tag.text} tone={tag.tone ?? 'marketing'}/>;
25
25
  }
26
26
  function renderTransitCardItem({ item, index, isLast }) {
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 ? {
27
+ return <view className={clsx('doubao-transit-card__item', isLast && 'doubao-transit-card__item--last')} 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)} priceActionText={item.priceAction?.text} priceActionTone={item.priceAction?.tone} showPriceActionIcon={item.priceAction?.showIcon} tag={renderTransitCardTag(item.tag)}/>
30
+ <TemplateTransportSummary className="doubao-template-transport-summary--list" title={item.title} departureMain={item.departureMain} departureSub={item.departureSub} 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
  }
@@ -1,5 +1,5 @@
1
- import type { CSSProperties, TouchEvent } from '@lynx-js/types';
2
- import type { ReactElement, ReactNode } from 'react';
1
+ import type { TouchEvent } from '@lynx-js/types';
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
5
  import type { PricePrefixTone, PriceTone, PriceValue } from '../primitives/price/index.js';
@@ -12,24 +12,18 @@ export interface TransitCardProps {
12
12
  items?: TransitCardItem[];
13
13
  /** 底部操作区配置。 */
14
14
  footer?: TemplateCardFooterProps;
15
- /** 卡片根节点自定义类名。 */
16
- className?: string;
17
- /** 卡片根节点自定义样式。 */
18
- style?: CSSProperties;
19
15
  /** 点击卡片根节点时触发。 */
20
16
  onClick?: (event: TouchEvent) => void;
21
17
  }
22
18
  export interface TransitCardItem {
23
19
  /** 列表项唯一标识;不传时使用数组下标。 */
24
20
  key?: TemplateKey;
25
- /** 行程标题块内容。 */
26
- title?: ReactNode;
21
+ /** 行程标题;支持字符串、数字或直接传入的 Tag / Title。 */
22
+ title?: string | number | ReactElement;
27
23
  /** 出发点主信息文案。 */
28
24
  departureMain?: TemplateText;
29
25
  /** 出发点补充信息文案。 */
30
26
  departureSub?: TemplateText;
31
- /** 中转区域整体块内容;优先级高于 transferTop 和 transferBottom。 */
32
- transfer?: ReactNode;
33
27
  /** 中转区域上方文案。 */
34
28
  transferTop?: TemplateText;
35
29
  /** 中转区域下方文案。 */
@@ -40,16 +34,12 @@ export interface TransitCardItem {
40
34
  arrivalDayOffset?: TemplateText;
41
35
  /** 到达点补充信息文案。 */
42
36
  arrivalSub?: TemplateText;
43
- /** 价格配置或价格块内容。 */
44
- price?: TransitCardPrice | ReactNode;
37
+ /** 价格配置或文本价格。 */
38
+ price?: TransitCardPrice | TemplateText;
45
39
  /** 价格下方的操作配置;与 tag 同时传入时优先展示。 */
46
40
  priceAction?: TransitCardPriceAction;
47
41
  /** 价格下方的标签配置。 */
48
42
  tag?: TransitCardTag;
49
- /** 列表项根节点自定义类名。 */
50
- className?: string;
51
- /** 列表项根节点自定义样式。 */
52
- style?: CSSProperties;
53
43
  /** 点击列表项时触发。 */
54
44
  onClick?: (event: TouchEvent) => void;
55
45
  }
@@ -1,11 +1,12 @@
1
1
  import { useThemeClassName } from "@byted-doubao-apps/components";
2
- import { clsx } from "clsx";
2
+ import { useHostCardStyle } from "@byted-doubao-apps/framework";
3
3
  import { TemplateCardFooter } from "../components/footer/index.js";
4
4
  import { TemplateCardHeader } from "../components/header/index.js";
5
5
  import { TransitCardContent } from "./content.js";
6
6
  function TransitCard(props) {
7
- const { header, items = [], footer, className, style, onClick } = props;
8
- return <view className={useThemeClassName(clsx('doubao-transit-card', className))} style={style} bindtap={onClick}>
7
+ const { header, items = [], footer, onClick } = props;
8
+ const cardStyle = useHostCardStyle();
9
+ return <view className={useThemeClassName('doubao-transit-card')} style={cardStyle} bindtap={onClick}>
9
10
  <TemplateCardHeader actionText={header?.actionText} showAction={header?.showAction} onActionClick={header?.onActionClick}/>
10
11
  <TransitCardContent items={items}/>
11
12
  <TemplateCardFooter primaryActionButton={footer?.primaryActionButton} secondaryActionButton={footer?.secondaryActionButton}/>
@@ -1 +1 @@
1
- .doubao-transit-card{--doubao-button-border-radius: 8px;--doubao-button-default-border-radius: 8px;--doubao-button-default-height: 44px;--doubao-button-default-padding-x: 12px;--doubao-button-default-padding-y: 0;--doubao-button-default-font-size: 16px;--doubao-button-default-line-height: 22px;display:flex;flex-direction:column;align-items:stretch;width:100%;box-sizing:border-box;overflow:hidden;background-color:var(--bg-base-1);border:1px solid var(--bg-base-2-overlay);border-radius:8px}.doubao-transit-card__body{width:100%;box-sizing:border-box;background-color:var(--bg-base-1)}.doubao-transit-card__item{width:100%;box-sizing:border-box}.doubao-transit-card__item--spread{height:.5px;margin-left:12px;width:calc(100% - 12px);background:var(--neutral-transparent-1)}.doubao-transit-card__item--last{border-bottom:none}.doubao-transit-card__view-more{width:100%;padding:8px 12px;box-sizing:border-box}.doubao-transit-card__view-more-button{width:100%;border-radius:8px;height:44px}
1
+ .doubao-transit-card{--doubao-button-border-radius: 8px;--doubao-button-default-border-radius: 8px;--doubao-button-default-height: 44px;--doubao-button-default-padding-x: 12px;--doubao-button-default-padding-y: 0;--doubao-button-default-font-size: 16px;--doubao-button-default-line-height: 22px;display:flex;flex-direction:column;align-items:stretch;width:100%;box-sizing:border-box;overflow:hidden;background-color:var(--bg-base-1);border:1px solid var(--bg-base-2-overlay);border-radius:8px}.doubao-transit-card__body{width:100%;box-sizing:border-box}.doubao-transit-card__item{width:100%;box-sizing:border-box}.doubao-transit-card__item--spread{height:.5px;margin-left:12px;width:calc(100% - 12px);background:var(--neutral-transparent-1)}.doubao-transit-card__item--last{border-bottom:none}.doubao-transit-card__view-more{width:100%;padding:8px 12px;box-sizing:border-box}.doubao-transit-card__view-more-button{width:100%;border-radius:8px;height:44px}
@@ -1,2 +1,4 @@
1
+ export declare function getTemplateAddIconContent(color: string): string;
2
+ export declare function getTemplateAddLoadingIconContent(color: string): string;
1
3
  export declare function getTemplatePlaybackIconContent(playing: boolean, progress: number | undefined, color: string): string;
2
4
  //# sourceMappingURL=icons.d.ts.map
@@ -1,3 +1,22 @@
1
+ function getTemplateAddIconContent(color) {
2
+ return `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M7.00065 1.021C7.4839 1.021 7.87565 1.41275 7.87565 1.896V6.12231H12.1048C12.5881 6.12231 12.9798 6.51407 12.9798 6.99731C12.9797 7.48044 12.588 7.87231 12.1048 7.87231H7.87565V12.1043C7.87559 12.5875 7.48386 12.9793 7.00065 12.9793C6.51744 12.9793 6.12571 12.5875 6.12565 12.1043V7.87231H1.89648C1.41338 7.87225 1.02163 7.4804 1.02148 6.99731C1.02148 6.5141 1.41329 6.12238 1.89648 6.12231H6.12565V1.896C6.12565 1.41275 6.5174 1.021 7.00065 1.021Z" fill="${color}"/>
4
+ </svg>`;
5
+ }
6
+ function getTemplateAddLoadingIconContent(color) {
7
+ const opacities = [
8
+ 1,
9
+ 0.86,
10
+ 0.72,
11
+ 0.58,
12
+ 0.44,
13
+ 0.3,
14
+ 0.16,
15
+ 0.06
16
+ ];
17
+ const spokes = opacities.map((opacity, index)=>`<rect x="6.27" y="1.17" width="1.46" height="3.65" rx="0.73" fill="${color}" opacity="${opacity}" transform="rotate(${45 * index} 7 7)"/>`).join('');
18
+ return `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">${spokes}</svg>`;
19
+ }
1
20
  function getTemplatePausedIconContent(color) {
2
21
  return `<svg width="32" height="32" overflow="visible" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
3
22
  <path d="M16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16C0 7.16344 7.16344 0 16 0ZM13.8828 10.4648C12.9165 10.3173 12.0129 10.981 11.8652 11.9473L11.835 12.1592C11.6968 13.1674 11.6279 14.4494 11.6279 16.0039C11.6279 17.6646 11.7066 19.0136 11.8643 20.0508C11.8818 20.1661 11.9104 20.28 11.9502 20.3896C12.284 21.3084 13.3 21.7829 14.2188 21.4492L14.4287 21.3701C15.4197 20.99 16.5599 20.4143 17.8496 19.6436C19.0853 18.9052 20.0807 18.2138 20.835 17.5684C20.9152 17.4997 20.9898 17.4248 21.0586 17.3447C21.8017 16.4796 21.7031 15.1758 20.8379 14.4326L20.6592 14.2822C19.9287 13.6777 18.9918 13.0341 17.8496 12.3516C16.4659 11.5247 15.2547 10.9241 14.2158 10.5498C14.108 10.5109 13.9961 10.4822 13.8828 10.4648Z" fill="${color}"/>
@@ -25,4 +44,4 @@ ${renderTemplatePlaybackProgress(progress, color)}
25
44
  ${getTemplatePauseIconPath(color)}
26
45
  </svg>`;
27
46
  }
28
- export { getTemplatePlaybackIconContent };
47
+ export { getTemplateAddIconContent, getTemplateAddLoadingIconContent, getTemplatePlaybackIconContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/template",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
Binary file
@@ -1,89 +0,0 @@
1
- import type { CSSProperties, TouchEvent } from '@lynx-js/types';
2
- import type { ReactElement, ReactNode } from 'react';
3
- import { type TemplateCardFooterProps } from '../components/footer/index.js';
4
- import { type TemplateCardHeaderProps } from '../components/header/index.js';
5
- import type { TemplateKey, TemplateTagTone, TemplateText } from '../types.js';
6
- import './styles.scss';
7
- /**
8
- * @deprecated 请使用 `CheckoutCardProps`。
9
- */
10
- export interface TicketOrderCardProps {
11
- /** 标题栏配置。 */
12
- header?: TemplateCardHeaderProps;
13
- /** 航程信息列表。 */
14
- routeItems?: TicketOrderCardRouteItem[];
15
- /** 订单信息列表。 */
16
- infoItems?: TicketOrderCardInfoItem[];
17
- /** 费用明细列表。 */
18
- feeItems?: TicketOrderCardFeeItem[];
19
- /** 合计价格前的标签文案。 */
20
- totalLabel?: TemplateText;
21
- /** 合计价格。 */
22
- totalPrice?: TemplateText;
23
- /** 合计区域自定义内容;优先级高于 totalLabel 和 totalPrice。 */
24
- totalContent?: ReactNode;
25
- /** 底部操作区配置。 */
26
- footer?: TemplateCardFooterProps;
27
- /** 卡片根节点自定义类名。 */
28
- className?: string;
29
- /** 卡片根节点自定义样式。 */
30
- style?: CSSProperties;
31
- /** 点击卡片根节点时触发。 */
32
- onClick?: (event: TouchEvent) => void;
33
- }
34
- /**
35
- * @deprecated 请使用 `CheckoutCardProductItem`。
36
- */
37
- export interface TicketOrderCardRouteItem {
38
- /** 航程项唯一标识;不传时使用数组下标。 */
39
- key?: TemplateKey;
40
- /** 航程标题,例如「出发地 - 到达地」。 */
41
- title?: TemplateText;
42
- /** 航程描述,例如「6月1日 周六 20:50-23:50 CZ0000 经济舱」。 */
43
- description?: TemplateText;
44
- /** 航程标题前的标签文案。 */
45
- tagText?: TemplateText;
46
- /** 航程标题标签的色调。 */
47
- tagTone?: TemplateTagTone;
48
- /** 是否展示标题右侧箭头。 */
49
- showChevron?: boolean;
50
- /** 点击航程项时触发。 */
51
- onClick?: (event: TouchEvent) => void;
52
- }
53
- /**
54
- * @deprecated 请使用 `CheckoutCardInfoItem`。
55
- */
56
- export interface TicketOrderCardInfoItem {
57
- /** 信息项唯一标识;不传时使用数组下标。 */
58
- key?: TemplateKey;
59
- /** 信息项标签。 */
60
- label?: TemplateText;
61
- /** 信息项标签块内容;优先级高于 label。 */
62
- labelContent?: ReactNode;
63
- /** 信息项主内容。 */
64
- value?: TemplateText;
65
- /** 信息项主内容块内容;优先级高于 value。 */
66
- valueContent?: ReactNode;
67
- /** 信息项补充内容。 */
68
- valueExtra?: TemplateText;
69
- /** 信息项补充内容块内容;优先级高于 valueExtra。 */
70
- valueExtraContent?: ReactNode;
71
- }
72
- /**
73
- * @deprecated 请使用 `CheckoutCardFeeItem`。
74
- */
75
- export interface TicketOrderCardFeeItem {
76
- /** 费用项唯一标识;不传时使用数组下标。 */
77
- key?: TemplateKey;
78
- /** 费用项标签。 */
79
- label?: TemplateText;
80
- /** 费用项金额或数值。 */
81
- value?: TemplateText;
82
- /** 费用项自定义内容;优先级高于 label 和 value。 */
83
- content?: ReactNode;
84
- }
85
- /**
86
- * @deprecated 请使用 `CheckoutCard`。
87
- */
88
- export declare function TicketOrderCard(props: TicketOrderCardProps): ReactElement;
89
- //# sourceMappingURL=index.d.ts.map
@@ -1,27 +0,0 @@
1
- import { useThemeClassName } from "@byted-doubao-apps/components";
2
- import { clsx } from "clsx";
3
- import { TemplateCardFooter } from "../components/footer/index.js";
4
- import { TemplateCardHeader } from "../components/header/index.js";
5
- import { TemplateInfoSection } from "../components/info-section/index.js";
6
- import { TemplateRouteSection, hasTemplateRouteSectionItems } from "../components/route-section/index.js";
7
- import "./styles.css";
8
- function isTicketOrderTextEmpty(content) {
9
- return null == content || '' === content;
10
- }
11
- function TicketOrderCard(props) {
12
- const { header, routeItems = [], infoItems = [], feeItems = [], totalLabel, totalPrice, totalContent, footer, className, style, onClick } = props;
13
- const hasRouteItems = hasTemplateRouteSectionItems(routeItems);
14
- const hasInfoSection = infoItems.length > 0 || feeItems.length > 0 || void 0 !== totalContent || !isTicketOrderTextEmpty(totalLabel) || !isTicketOrderTextEmpty(totalPrice);
15
- const hasDefaultBody = hasRouteItems || hasInfoSection;
16
- return <view className={useThemeClassName(clsx('doubao-ticket-order-card', className))} style={style} bindtap={onClick}>
17
- <TemplateCardHeader actionText={header?.actionText} showAction={header?.showAction} onActionClick={header?.onActionClick}/>
18
-
19
- {hasDefaultBody && <view className="doubao-ticket-order-card__body">
20
- {hasRouteItems && <TemplateRouteSection items={routeItems}/>}
21
- {hasInfoSection && <TemplateInfoSection infoItems={infoItems} feeItems={feeItems} totalLabel={totalLabel} totalPrice={totalPrice} totalContent={totalContent}/>}
22
- </view>}
23
-
24
- <TemplateCardFooter secondaryActionButton={footer?.secondaryActionButton} primaryActionButton={footer?.primaryActionButton}/>
25
- </view>;
26
- }
27
- export { TicketOrderCard };
@@ -1 +0,0 @@
1
- .doubao-ticket-order-card{display:flex;flex-direction:column;align-items:stretch;width:100%;box-sizing:border-box;overflow:hidden;background-color:var(--bg-base-1);border:1px solid var(--bg-base-2-overlay);border-radius:8px}.doubao-ticket-order-card__body{width:100%;box-sizing:border-box;background-color:var(--bg-base-1)}