@doubao-dev/template 0.6.1 → 0.6.3

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.
@@ -8,8 +8,7 @@ function stopTemplateExtraActionTap() {}
8
8
  function TemplateAddAction({ disabled = false, loading = false, onClick }) {
9
9
  const theme = useTheme();
10
10
  const [pressed, setPressed] = useState(false);
11
- const iconColor = 'dark' === theme ? '#ffffff' : '#000000';
12
- const loadingColor = 'dark' === theme ? '#cccccc' : '#666666';
11
+ const iconColor = 'dark' === theme ? '#cccccc' : '#666666';
13
12
  const handleTap = (event)=>{
14
13
  setPressed(false);
15
14
  if (!disabled && !loading) onClick?.(event);
@@ -20,8 +19,8 @@ function TemplateAddAction({ disabled = false, loading = false, onClick }) {
20
19
  const handleTouchEnd = ()=>setPressed(false);
21
20
  return <view className={clsx('doubao-template-extra-action-add', 'dark' === theme ? 'doubao-theme-dark' : 'doubao-theme-light', pressed && !disabled && !loading && 'doubao-template-extra-action-add--pressed', disabled && 'doubao-template-extra-action-add--disabled', loading && 'doubao-template-extra-action-add--loading')} catchtap={handleTap} bindtouchstart={handleTouchStart} bindtouchend={handleTouchEnd} bindtouchmove={handleTouchEnd}>
22
21
  {loading ? <view className="doubao-template-extra-action-add__spinner">
23
- <svg className="doubao-template-extra-action-add__icon" content={getTemplateAddLoadingIconContent(loadingColor)}/>
24
- </view> : <svg className="doubao-template-extra-action-add__icon" content={getTemplateAddIconContent(iconColor)}/>}
22
+ <svg className="doubao-template-extra-action-add__loading-icon" content={getTemplateAddLoadingIconContent(iconColor)}/>
23
+ </view> : <svg className="doubao-template-extra-action-add__icon" content={getTemplateAddIconContent(iconColor, 12)}/>}
25
24
  </view>;
26
25
  }
27
26
  function TemplatePlaybackButton(props) {
@@ -38,13 +37,12 @@ function TemplatePlaybackButton(props) {
38
37
  </view>;
39
38
  }
40
39
  function renderTemplateExtraAction(action, classNames = {}) {
40
+ if ('add' === action.type || 'stepper' === action.type) return <view className={clsx('doubao-template-extra-action-quantity', 'stepper' === action.type && 'doubao-template-extra-action-quantity--expanded')}>
41
+ {'add' === action.type ? <TemplateAddAction {...action}/> : <Stepper value={action.value} min={action.min} max={action.max} onChange={action.onChange}/>}
42
+ </view>;
41
43
  switch(action.type){
42
44
  case 'button':
43
45
  return <Button className={clsx('doubao-template-extra-action-button', classNames.button)} type="default" text={action.text} disabled={action.disabled} loading={action.loading} onClick={action.onClick}/>;
44
- case 'add':
45
- return <TemplateAddAction {...action}/>;
46
- case 'stepper':
47
- return <Stepper value={action.value} min={action.min} max={action.max} onChange={action.onChange}/>;
48
46
  case 'switch':
49
47
  return <Switch className={classNames.switch} checked={action.checked} disabled={action.disabled} onChange={action.onChange}/>;
50
48
  case 'playback':
@@ -1 +1 @@
1
- .doubao-template-extra-action-button{--doubao-button-border-radius: 8px;--doubao-button-default-border-radius: 8px;--doubao-button-default-height: 36px;--doubao-button-default-padding-x: 12px;--doubao-button-default-padding-y: 8px;--doubao-button-default-font-size: 14px;--doubao-button-default-line-height: 20px}.doubao-template-extra-action-add{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;box-sizing:border-box;overflow:hidden;background-color:var(--static-black-transparent-4);border-radius:50%}.doubao-template-extra-action-add:hover:not(.doubao-template-extra-action-add--disabled):not(.doubao-template-extra-action-add--loading):not(.doubao-template-extra-action-add--pressed){background-color:var(--static-black-transparent-6)}.doubao-template-extra-action-add--pressed,.doubao-template-extra-action-add--pressed:hover{background-color:var(--static-black-transparent-10)}.doubao-template-extra-action-add.doubao-theme-dark{background-color:hsla(0,0%,100%,.04)}.doubao-template-extra-action-add.doubao-theme-dark:hover:not(.doubao-template-extra-action-add--disabled):not(.doubao-template-extra-action-add--loading):not(.doubao-template-extra-action-add--pressed){background-color:hsla(0,0%,100%,.06)}.doubao-template-extra-action-add.doubao-theme-dark.doubao-template-extra-action-add--pressed,.doubao-template-extra-action-add.doubao-theme-dark.doubao-template-extra-action-add--pressed:hover{background-color:hsla(0,0%,100%,.1)}.doubao-template-extra-action-add--disabled{opacity:.3}.doubao-template-extra-action-add__icon,.doubao-template-extra-action-add__spinner{width:14px;height:14px;flex-shrink:0}.doubao-template-extra-action-add__spinner{animation:doubao-template-extra-action-add-spin 1s linear infinite}@keyframes doubao-template-extra-action-add-spin{to{transform:rotate(360deg)}}
1
+ .doubao-template-extra-action-button{--doubao-button-border-radius: 8px;--doubao-button-default-border-radius: 8px;--doubao-button-default-height: 36px;--doubao-button-default-padding-x: 12px;--doubao-button-default-padding-y: 8px;--doubao-button-default-font-size: 14px;--doubao-button-default-line-height: 20px}.doubao-template-extra-action-quantity{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;width:24px;height:24px;flex-shrink:0;overflow:hidden;transition:width 200ms ease-out}.doubao-template-extra-action-quantity--expanded{width:86px}.doubao-template-extra-action-add{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;box-sizing:border-box;overflow:hidden;background-color:var(--bg-base-4-overlay);border-radius:50%}.doubao-template-extra-action-add:hover:not(.doubao-template-extra-action-add--disabled):not(.doubao-template-extra-action-add--loading):not(.doubao-template-extra-action-add--pressed){background-color:var(--static-black-transparent-6)}.doubao-template-extra-action-add--pressed,.doubao-template-extra-action-add--pressed:hover{background-color:var(--static-black-transparent-10)}.doubao-template-extra-action-add.doubao-theme-dark:hover:not(.doubao-template-extra-action-add--disabled):not(.doubao-template-extra-action-add--loading):not(.doubao-template-extra-action-add--pressed){background-color:hsla(0,0%,100%,.06)}.doubao-template-extra-action-add.doubao-theme-dark.doubao-template-extra-action-add--pressed,.doubao-template-extra-action-add.doubao-theme-dark.doubao-template-extra-action-add--pressed:hover{background-color:hsla(0,0%,100%,.1)}.doubao-template-extra-action-add--disabled .doubao-template-extra-action-add__icon{opacity:.3}.doubao-template-extra-action-add__icon{width:12px;height:12px;flex-shrink:0}.doubao-template-extra-action-add__loading-icon,.doubao-template-extra-action-add__spinner{width:14px;height:14px;flex-shrink:0}.doubao-template-extra-action-add__spinner{animation:doubao-template-extra-action-add-spin 1s linear infinite}@keyframes doubao-template-extra-action-add-spin{to{transform:rotate(360deg)}}
@@ -1,3 +1,4 @@
1
+ import type { TouchEvent } from '@lynx-js/types';
1
2
  import { type ReactElement, type ReactNode } from 'react';
2
3
  import type { TemplateText } from '../../types.js';
3
4
  import './styles.scss';
@@ -35,6 +36,10 @@ export interface TemplateTransportSummaryProps {
35
36
  tag?: ReactNode;
36
37
  /** 根节点自定义类名。 */
37
38
  className?: string;
39
+ /** 点击左侧行程区域时触发。 */
40
+ onRouteClick?: (event: TouchEvent) => void;
41
+ /** 点击右侧价格区域时触发。 */
42
+ onPriceClick?: (event: TouchEvent) => void;
38
43
  }
39
44
  export declare function TemplateTransportSummary(props: TemplateTransportSummaryProps): ReactElement | null;
40
45
  export {};
@@ -43,13 +43,15 @@ function renderTemplateTransportSummaryPriceAction(actionText, actionTone, showA
43
43
  {showActionIcon ? <TemplateChevronRightIcon className="doubao-template-transport-summary__price-action-icon" color={'highlight' === actionTone ? '#ff375f' : isDark ? '#bababa' : '#666666'}/> : null}
44
44
  </view>;
45
45
  }
46
- function renderTemplateTransportSummaryPrice(price, tag, actionText, actionTone, showActionIcon, isDark) {
46
+ function renderTemplateTransportSummaryPrice(price, tag, actionText, actionTone, showActionIcon, isDark, onPriceClick) {
47
47
  const hasPrice = !isTemplateTransportSummaryNodeEmpty(price);
48
48
  const hasTag = !isTemplateTransportSummaryNodeEmpty(tag);
49
49
  const actionNode = renderTemplateTransportSummaryPriceAction(actionText, actionTone, showActionIcon, isDark);
50
50
  const hasAction = null != actionNode;
51
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')}>
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')} {...null != onPriceClick ? {
53
+ catchtap: onPriceClick
54
+ } : {}}>
53
55
  {hasPrice && price}
54
56
  {hasAction ? actionNode : hasTag && tag}
55
57
  </view>;
@@ -92,7 +94,7 @@ function renderTemplateTransportSummaryTransfer({ content, topText, showDot, bot
92
94
  }
93
95
  function TemplateTransportSummary(props) {
94
96
  const theme = useTheme();
95
- const { title, departureMain, departureSub, transfer, transferTop, showTransferDot, transferBottom, arrivalMain, arrivalDayOffset, arrivalSub, price, priceActionText, priceActionTone = 'highlight', showPriceActionIcon = true, tag, className } = props;
97
+ const { title, departureMain, departureSub, transfer, transferTop, showTransferDot, transferBottom, arrivalMain, arrivalDayOffset, arrivalSub, price, priceActionText, priceActionTone = 'highlight', showPriceActionIcon = true, tag, className, onRouteClick, onPriceClick } = props;
96
98
  const departureNode = renderTemplateTransportSummaryPoint({
97
99
  mainText: departureMain,
98
100
  subText: departureSub
@@ -114,7 +116,7 @@ function TemplateTransportSummary(props) {
114
116
  {arrivalDayOffsetNode}
115
117
  </view>;
116
118
  const titleNode = renderTemplateTransportSummaryNodeField(title, 'doubao-template-transport-summary__title', 'doubao-template-transport-summary__title-text');
117
- const priceNode = renderTemplateTransportSummaryPrice(price, tag, priceActionText, priceActionTone, showPriceActionIcon, 'dark' === theme);
119
+ const priceNode = renderTemplateTransportSummaryPrice(price, tag, priceActionText, priceActionTone, showPriceActionIcon, 'dark' === theme, onPriceClick);
118
120
  const hasRoute = Boolean(departureNode || transferNode || arrivalNode);
119
121
  const hasRouteRow = hasRoute || null != priceNode;
120
122
  if (null == titleNode && !hasRouteRow) return null;
@@ -126,6 +128,7 @@ function TemplateTransportSummary(props) {
126
128
  {arrivalNode}
127
129
  {priceNode}
128
130
  </view>}
131
+ {null != onRouteClick && (null != titleNode || hasRoute) ? <view className="doubao-template-transport-summary__route-hit-area" catchtap={onRouteClick}/> : null}
129
132
  </view>;
130
133
  }
131
134
  export { TemplateTransportSummary };
@@ -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 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}
1
+ .doubao-template-transport-summary{position:relative;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__route-hit-area{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1}.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{position:relative;z-index:2;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}
@@ -1 +1 @@
1
- .doubao-content-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-content-card__body{width:100%;box-sizing:border-box}.doubao-content-card__item{position:relative;width:100%;padding:12px;box-sizing:border-box}.doubao-content-card__item--without-thumbnail{padding-top:16px;padding-bottom:16px}.doubao-content-card__item::after{position:absolute;right:0;bottom:0;left:104px;height:.5px;content:"";background-color:var(--neutral-transparent-1)}.doubao-content-card__item--last::after{display:none}.doubao-content-card__content{display:flex;flex-direction:row;align-items:center;gap:12px;width:100%;min-width:0}.doubao-content-card__main{display:flex;flex:1 1 0;flex-direction:row;align-items:center;gap:12px;min-width:0}.doubao-content-card__thumbnail{width:80px;height:80px;flex-shrink:0;overflow:hidden;background-color:var(--bg-base-1-overlay);border-radius:5px}.doubao-content-card__thumbnail-image{width:100%;height:100%}.doubao-content-card__text{display:flex;flex:1 1 0;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}.doubao-content-card__title{width:100%;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-overflow:ellipsis;white-space:nowrap}.doubao-content-card__title-custom,.doubao-content-card__subtitle-custom,.doubao-content-card__description-custom{display:flex;flex-direction:row;align-items:center;width:100%;max-width:100%;overflow:hidden}.doubao-content-card__secondary,.doubao-content-card__tertiary{display:flex;flex-direction:row;align-items:center;width:100%;min-width:0;overflow:hidden}.doubao-content-card__subtitle,.doubao-content-card__description{width:100%;overflow:hidden;color:var(--neutral-70);font-family:"PingFang SC",sans-serif;font-size:13px;font-style:normal;font-weight:400;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.doubao-content-card__item-action{display:flex;flex-shrink:0;flex-direction:row;align-items:center;justify-content:center}.doubao-content-card__item-action-button{width:auto;min-width:60px;max-width:100px}.doubao-content-card__item-action-switch{flex-shrink:0}.doubao-content-card__item-action-playback{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px}.doubao-content-card__item-action-playback--disabled{opacity:.4}.doubao-content-card__item-action-playback-icon{width:32px;height:32px}
1
+ .doubao-content-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-content-card__body{width:100%;box-sizing:border-box}.doubao-content-card__item{position:relative;width:100%;padding:12px;box-sizing:border-box}.doubao-content-card__item--without-thumbnail{padding-top:16px;padding-bottom:16px}.doubao-content-card__item::after{position:absolute;right:0;bottom:0;left:104px;height:.5px;content:"";background-color:var(--neutral-transparent-1)}.doubao-content-card__item--without-thumbnail::after{left:12px}.doubao-content-card__item--last::after{display:none}.doubao-content-card__content{display:flex;flex-direction:row;align-items:center;gap:12px;width:100%;min-width:0}.doubao-content-card__main{display:flex;flex:1 1 0;flex-direction:row;align-items:center;gap:12px;min-width:0}.doubao-content-card__thumbnail{align-self:flex-start;width:80px;height:80px;flex-shrink:0;overflow:hidden;background-color:var(--bg-base-1-overlay);border-radius:5px}.doubao-content-card__thumbnail-image{width:100%;height:100%}.doubao-content-card__text{display:flex;flex:1 1 0;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}.doubao-content-card__title{width:100%;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-overflow:ellipsis;white-space:nowrap}.doubao-content-card__title-custom,.doubao-content-card__subtitle-custom,.doubao-content-card__description-custom{display:flex;flex-direction:row;align-items:center;width:100%;max-width:100%;overflow:hidden}.doubao-content-card__secondary,.doubao-content-card__tertiary{display:flex;flex-direction:row;align-items:center;width:100%;min-width:0;overflow:hidden}.doubao-content-card__subtitle,.doubao-content-card__description{width:100%;overflow:hidden;color:var(--neutral-70);font-family:"PingFang SC",sans-serif;font-size:13px;font-style:normal;font-weight:400;line-height:20px;text-overflow:ellipsis;white-space:nowrap}.doubao-content-card__item-action{display:flex;flex-shrink:0;flex-direction:row;align-items:center;justify-content:center}.doubao-content-card__item:not(.doubao-content-card__item--without-thumbnail) .doubao-content-card__content{align-items:flex-start}.doubao-content-card__item:not(.doubao-content-card__item--without-thumbnail) .doubao-content-card__item-action{height:80px}.doubao-content-card__item-action-button{width:auto;min-width:60px;max-width:100px}.doubao-content-card__item-action-switch{flex-shrink:0}.doubao-content-card__item-action-playback{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:32px;height:32px}.doubao-content-card__item-action-playback--disabled{opacity:.4}.doubao-content-card__item-action-playback-icon{width:32px;height:32px}
@@ -1 +1 @@
1
- .doubao-stepper{display:flex;flex-direction:row;align-items:center;width:92px;height:24px;flex-shrink:0}.doubao-stepper__button{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;background-color:var(--bg-base-4-overlay);border-radius:100px}.doubao-stepper__icon{width:12px;height:12px;flex-shrink:0}.doubao-stepper__icon--disabled{opacity:.3}.doubao-stepper__value{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:24px;padding:0 4px;flex-shrink:0;overflow:hidden}.doubao-stepper__value-text{display:block;width:100%;min-width:0;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-align:center;text-overflow:ellipsis;white-space:nowrap}
1
+ .doubao-stepper{display:flex;flex-direction:row;align-items:center;width:86px;height:24px;flex-shrink:0}.doubao-stepper__button{display:flex;align-items:center;justify-content:center;width:24px;height:24px;flex-shrink:0;background-color:var(--bg-base-4-overlay);border-radius:100px}.doubao-stepper__icon{width:12px;height:12px;flex-shrink:0}.doubao-stepper__icon--disabled{opacity:.3}.doubao-stepper__value{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:38px;height:24px;padding:0 4px;flex-shrink:0;overflow:hidden}.doubao-stepper__value-text{display:block;width:100%;min-width:0;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-align:center;text-overflow:ellipsis;white-space:nowrap}
@@ -7,12 +7,18 @@ function Title({ text: text1, maxLines = 1, showArrow = true, loading = false })
7
7
  return <view className={clsx('doubao-title', `doubao-title--lines-${maxLines}`, {
8
8
  'doubao-title--loading': loading
9
9
  }, themedClassName)}>
10
- {loading ? <view className="doubao-title__placeholder"/> : <>
11
- <text className="doubao-title__text" text-maxline={maxLines}>
12
- {text1}
13
- </text>
14
- {showArrow ? <TemplateChevronRightIcon className="doubao-title__arrow"/> : null}
15
- </>}
10
+ {loading ? <view className="doubao-title__placeholder"/> : <text className="doubao-title__text" text-maxline={maxLines}>
11
+ <inline-truncation>
12
+ <view className={clsx('doubao-title__truncation', showArrow && 'doubao-title__inline-arrow')}>
13
+ <view className="doubao-title__fade"/>
14
+ {showArrow ? <TemplateChevronRightIcon className="doubao-title__arrow"/> : null}
15
+ </view>
16
+ </inline-truncation>
17
+ {text1}
18
+ {showArrow ? <view className="doubao-title__inline-arrow">
19
+ <TemplateChevronRightIcon className="doubao-title__arrow"/>
20
+ </view> : null}
21
+ </text>}
16
22
  </view>;
17
23
  }
18
24
  export { Title };
@@ -1 +1 @@
1
- .doubao-title{display:flex;flex-direction:row;align-items:flex-end;gap:2px;max-width:100%;min-width:0;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal}.doubao-title--loading{align-items:center;width:100%;height:24px}.doubao-title__text{display:block;flex:0 1 auto;min-width:0;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-overflow:ellipsis}.doubao-title--lines-1 .doubao-title__text{white-space:nowrap}.doubao-title__arrow{width:12px;height:12px;margin-bottom:6px;flex-shrink:0}.doubao-title__placeholder{width:100%;max-width:40%;height:16px;border-radius:4px;background-image:linear-gradient(90deg, #f7f7f7 0%, #e6e6e6 30%, #f7f7f7 100%);background-size:200% 100%;animation:doubao-title-placeholder-shimmer 1.4s ease-in-out infinite}@keyframes doubao-title-placeholder-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
1
+ .doubao-title{display:flex;flex-direction:row;align-items:flex-start;width:100%;max-width:100%;min-width:0;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-style:normal}.doubao-title--loading{align-items:center;width:100%;height:24px}.doubao-title__text{display:block;flex:0 1 auto;width:100%;min-width:0;overflow:hidden;color:var(--neutral-100);font-family:"PingFang SC",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue",sans-serif;font-size:16px;font-style:normal;font-weight:500;line-height:24px;text-overflow:clip}.doubao-title__text>inline-truncation{vertical-align:top}.doubao-title__inline-arrow{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;width:14px;height:24px;box-sizing:border-box;vertical-align:top}.doubao-title__truncation{position:relative;width:0;height:24px;overflow:visible;vertical-align:top}.doubao-title__truncation.doubao-title__inline-arrow{width:14px}.doubao-title__fade{position:absolute;top:2px;left:-22px;width:22px;height:19px;background-image:linear-gradient(90deg, transparent, var(--bg-base-1))}.doubao-title__arrow{width:12px;height:12px;flex-shrink:0}.doubao-title__placeholder{width:100%;max-width:40%;height:16px;border-radius:4px;background-image:linear-gradient(90deg, #f7f7f7 0%, #e6e6e6 30%, #f7f7f7 100%);background-size:200% 100%;animation:doubao-title-placeholder-shimmer 1.4s ease-in-out infinite}@keyframes doubao-title-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')} 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} 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)} onRouteClick={item.onRouteClick} onPriceClick={item.onPriceClick}/>
31
31
  {!isLast && <view className="doubao-transit-card__item--spread"/>}
32
32
  </view>;
33
33
  }
@@ -42,6 +42,10 @@ export interface TransitCardItem {
42
42
  tag?: TransitCardTag;
43
43
  /** 点击列表项时触发。 */
44
44
  onClick?: (event: TouchEvent) => void;
45
+ /** 点击左侧行程区域时触发。 */
46
+ onRouteClick?: (event: TouchEvent) => void;
47
+ /** 点击右侧价格区域时触发。 */
48
+ onPriceClick?: (event: TouchEvent) => void;
45
49
  }
46
50
  export interface TransitCardPrice {
47
51
  /** 价格值。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/template",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {