@doubao-apps/template 0.0.32 → 0.0.33
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 +170 -37
- package/assets/ask_human.png +0 -0
- package/assets/price-action-list-card.png +0 -0
- package/assets/single-item-card.png +0 -0
- package/assets/task-action-card.png +0 -0
- package/dist/ask-human-card/index.d.ts +38 -0
- package/dist/ask-human-card/index.js +39 -0
- package/dist/ask-human-card/styles.css +60 -0
- package/dist/components/action-bar/styles.css +10 -10
- package/dist/components/title-bar/index.js +3 -2
- package/dist/components/title-bar/styles.css +3 -6
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/price-action-list-card/index.d.ts +56 -0
- package/dist/price-action-list-card/index.js +55 -0
- package/dist/price-action-list-card/styles.css +166 -0
- package/dist/single-item-card/index.d.ts +62 -0
- package/dist/single-item-card/index.js +115 -0
- package/dist/single-item-card/styles.css +209 -0
- package/dist/task-action-card/index.d.ts +16 -0
- package/dist/task-action-card/index.js +24 -0
- package/dist/task-action-card/styles.css +45 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/icons.d.ts +2 -0
- package/dist/utils/icons.js +4 -0
- package/package.json +1 -1
- package/assets/product-action-card.png +0 -0
- package/dist/product-action-card/index.d.ts +0 -40
- package/dist/product-action-card/index.js +0 -17
- package/dist/product-action-card/styles.css +0 -20
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
.doubao-price-action-list-card {
|
|
2
|
+
--doubao-price-action-list-card-bg: var(--bg-base-1);
|
|
3
|
+
--doubao-price-action-list-card-border: var(--bg-base-2-overlay);
|
|
4
|
+
--doubao-price-action-list-card-divider: var(--neutral-transparent-1);
|
|
5
|
+
--doubao-price-action-list-card-price-text: var(--primary-50);
|
|
6
|
+
--doubao-price-action-list-card-badge-bg: var(--primary-transparent-1);
|
|
7
|
+
--doubao-price-action-list-card-badge-text: var(--primary-50);
|
|
8
|
+
--doubao-price-action-list-card-info-text: var(--neutral-50);
|
|
9
|
+
--doubao-price-action-list-card-action-bg: var(--bg-base-1-overlay);
|
|
10
|
+
--doubao-price-action-list-card-action-text: var(--neutral-100);
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
background-color: var(--doubao-price-action-list-card-bg);
|
|
13
|
+
border: 1px solid var(--doubao-price-action-list-card-border);
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
width: 100%;
|
|
18
|
+
display: flex;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.doubao-price-action-list-card__body {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
background-color: var(--doubao-price-action-list-card-bg);
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.doubao-price-action-list-card__default {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.doubao-price-action-list-card__item {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
background-color: var(--doubao-price-action-list-card-bg);
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
align-items: center;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 82px;
|
|
40
|
+
padding: 14px 12px;
|
|
41
|
+
display: flex;
|
|
42
|
+
position: relative;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.doubao-price-action-list-card__item:after {
|
|
46
|
+
content: "";
|
|
47
|
+
background-color: var(--doubao-price-action-list-card-divider);
|
|
48
|
+
height: .5px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
left: 95px;
|
|
52
|
+
right: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.doubao-price-action-list-card__item--last:after {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.doubao-price-action-list-card__item-content {
|
|
60
|
+
flex-direction: row;
|
|
61
|
+
align-items: center;
|
|
62
|
+
width: 100%;
|
|
63
|
+
padding-left: 4px;
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.doubao-price-action-list-card__value {
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
flex-shrink: 0;
|
|
70
|
+
align-items: flex-start;
|
|
71
|
+
width: 86px;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.doubao-price-action-list-card__price {
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
color: var(--doubao-price-action-list-card-price-text);
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
font-family: PingFang SC, sans-serif;
|
|
82
|
+
font-size: 22px;
|
|
83
|
+
font-style: normal;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
line-height: 26px;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.doubao-price-action-list-card__badge {
|
|
90
|
+
max-width: 100%;
|
|
91
|
+
color: var(--doubao-price-action-list-card-badge-text);
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
background-color: var(--doubao-price-action-list-card-badge-bg);
|
|
95
|
+
border-radius: 4px;
|
|
96
|
+
margin-top: 4px;
|
|
97
|
+
padding: 1px 4px;
|
|
98
|
+
font-family: PingFang SC, sans-serif;
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
font-style: normal;
|
|
101
|
+
font-weight: 400;
|
|
102
|
+
line-height: 18px;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.doubao-price-action-list-card__info {
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
flex: 1 1 0;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
min-width: 0;
|
|
111
|
+
margin-left: 14px;
|
|
112
|
+
display: flex;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.doubao-price-action-list-card__info-row {
|
|
116
|
+
width: 100%;
|
|
117
|
+
color: var(--doubao-price-action-list-card-info-text);
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
font-family: PingFang SC, sans-serif;
|
|
121
|
+
font-size: 14px;
|
|
122
|
+
font-style: normal;
|
|
123
|
+
font-weight: 400;
|
|
124
|
+
line-height: 22px;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.doubao-price-action-list-card__info-row + .doubao-price-action-list-card__info-row {
|
|
129
|
+
margin-top: 2px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.doubao-price-action-list-card__item-action {
|
|
133
|
+
--doubao-button-border-radius: 8px;
|
|
134
|
+
--doubao-button-default-height: 38px;
|
|
135
|
+
--doubao-button-default-padding-x: 12px;
|
|
136
|
+
--doubao-button-default-padding-y: 0;
|
|
137
|
+
--doubao-button-default-font-size: 14px;
|
|
138
|
+
--doubao-button-default-line-height: 20px;
|
|
139
|
+
--doubao-button-default-bg: var(--doubao-price-action-list-card-action-bg);
|
|
140
|
+
--doubao-button-default-text: var(--doubao-price-action-list-card-action-text);
|
|
141
|
+
flex-shrink: 0;
|
|
142
|
+
width: 80px;
|
|
143
|
+
height: 38px;
|
|
144
|
+
margin-left: 12px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.doubao-price-action-list-card__footer {
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
background-color: var(--doubao-price-action-list-card-bg);
|
|
150
|
+
width: 100%;
|
|
151
|
+
padding: 8px 12px 12px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.doubao-price-action-list-card__footer-action {
|
|
155
|
+
--doubao-button-border-radius: 8px;
|
|
156
|
+
--doubao-button-default-height: 44px;
|
|
157
|
+
--doubao-button-default-padding-x: 12px;
|
|
158
|
+
--doubao-button-default-padding-y: 0;
|
|
159
|
+
--doubao-button-default-font-size: 16px;
|
|
160
|
+
--doubao-button-default-line-height: 22px;
|
|
161
|
+
--doubao-button-default-bg: var(--doubao-price-action-list-card-action-bg);
|
|
162
|
+
--doubao-button-default-text: var(--doubao-price-action-list-card-action-text);
|
|
163
|
+
width: 100%;
|
|
164
|
+
height: 44px;
|
|
165
|
+
}
|
|
166
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { CSSProperties, TouchEvent } from '@lynx-js/types';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import type { TemplateKey, TemplateText } from '../types.js';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
export interface SingleItemCardProps {
|
|
6
|
+
/** 标题栏右侧「更多」入口的文案。 */
|
|
7
|
+
moreText?: string;
|
|
8
|
+
/** 是否展示标题栏右侧「更多」入口。 */
|
|
9
|
+
showMore?: boolean;
|
|
10
|
+
/** 内容主标题。字符串和数字会按默认单行标题样式渲染,传入节点时直接渲染自定义内容。 */
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** 是否展示主标题右侧箭头。 */
|
|
13
|
+
showChevron?: boolean;
|
|
14
|
+
/** 内容图片地址。 */
|
|
15
|
+
imageSrc?: string;
|
|
16
|
+
/** 内容自定义图片节点;优先级高于 imageSrc。 */
|
|
17
|
+
image?: ReactNode;
|
|
18
|
+
/** 内容信息行。最多展示前 2 行,每行内多字段会以圆点分隔。 */
|
|
19
|
+
infoRows?: SingleItemCardInfoRow[];
|
|
20
|
+
/** 右侧价格前缀文案。 */
|
|
21
|
+
pricePrefix?: TemplateText;
|
|
22
|
+
/** 右侧价格或摘要文案。 */
|
|
23
|
+
price?: TemplateText;
|
|
24
|
+
/** 信息行右侧数量。 */
|
|
25
|
+
quantity?: TemplateText;
|
|
26
|
+
/** 主按钮文案。 */
|
|
27
|
+
primaryActionText?: string;
|
|
28
|
+
/** 次按钮文案。 */
|
|
29
|
+
secondaryActionText?: string;
|
|
30
|
+
/** 自定义内容区;传入后不再渲染默认图文结构。 */
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
/** 卡片根节点自定义类名。 */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** 卡片根节点自定义样式。 */
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
/** 点击卡片根节点时触发。 */
|
|
37
|
+
onClick?: (event: TouchEvent) => void;
|
|
38
|
+
/** 点击标题栏右侧「更多」入口时触发。 */
|
|
39
|
+
onMoreClick?: (event: TouchEvent) => void;
|
|
40
|
+
/** 点击内容区时触发。 */
|
|
41
|
+
onContentClick?: (event: TouchEvent) => void;
|
|
42
|
+
/** 点击主按钮时触发。 */
|
|
43
|
+
onPrimaryActionClick?: (event?: TouchEvent) => void;
|
|
44
|
+
/** 点击次按钮时触发。 */
|
|
45
|
+
onSecondaryActionClick?: (event?: TouchEvent) => void;
|
|
46
|
+
}
|
|
47
|
+
export interface SingleItemCardInfoRow {
|
|
48
|
+
/** 信息行唯一标识;不传时使用数组下标。 */
|
|
49
|
+
key?: TemplateKey;
|
|
50
|
+
/** 信息行单字段文案;优先级高于 items。 */
|
|
51
|
+
text?: TemplateText;
|
|
52
|
+
/** 信息行字段列表。 */
|
|
53
|
+
items?: SingleItemCardInfoItem[];
|
|
54
|
+
}
|
|
55
|
+
export interface SingleItemCardInfoItem {
|
|
56
|
+
/** 信息字段唯一标识;不传时使用数组下标。 */
|
|
57
|
+
key?: TemplateKey;
|
|
58
|
+
/** 信息字段文案。 */
|
|
59
|
+
text: TemplateText;
|
|
60
|
+
}
|
|
61
|
+
export declare function SingleItemCard(props: SingleItemCardProps): ReactElement;
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useThemeClassName } from "@byted-doubao-apps/components";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { TemplateActionBar } from "../components/action-bar/index.js";
|
|
4
|
+
import { TemplateTitleBar } from "../components/title-bar/index.js";
|
|
5
|
+
import { TEMPLATE_CHEVRON_RIGHT_ICON_CONTENT } from "../utils/icons.js";
|
|
6
|
+
import "./styles.css";
|
|
7
|
+
const SINGLE_ITEM_CARD_INFO_ROW_LIMIT = 2;
|
|
8
|
+
function isSingleItemCardTextEmpty(content) {
|
|
9
|
+
return null == content || '' === content;
|
|
10
|
+
}
|
|
11
|
+
function isSingleItemCardNodeEmpty(content) {
|
|
12
|
+
return null == content || 'boolean' == typeof content || '' === content;
|
|
13
|
+
}
|
|
14
|
+
function renderSingleItemCardTitle(content) {
|
|
15
|
+
if (isSingleItemCardNodeEmpty(content)) return null;
|
|
16
|
+
if ('string' == typeof content || 'number' == typeof content) return <text className="doubao-single-item-card__title" text-maxline="1">
|
|
17
|
+
{content}
|
|
18
|
+
</text>;
|
|
19
|
+
return <view className="doubao-single-item-card__title-custom">{content}</view>;
|
|
20
|
+
}
|
|
21
|
+
function renderSingleItemCardPrice(props) {
|
|
22
|
+
const { pricePrefix, price } = props;
|
|
23
|
+
const hasPricePrefix = !isSingleItemCardTextEmpty(pricePrefix);
|
|
24
|
+
const hasPrice = !isSingleItemCardTextEmpty(price);
|
|
25
|
+
if (!hasPricePrefix && !hasPrice) return null;
|
|
26
|
+
return <view className="doubao-single-item-card__price">
|
|
27
|
+
{hasPricePrefix ? <text className="doubao-single-item-card__price-prefix" text-maxline="1">
|
|
28
|
+
{pricePrefix}
|
|
29
|
+
</text> : null}
|
|
30
|
+
{hasPrice ? <text className="doubao-single-item-card__price-value" text-maxline="1">
|
|
31
|
+
{price}
|
|
32
|
+
</text> : null}
|
|
33
|
+
</view>;
|
|
34
|
+
}
|
|
35
|
+
function SingleItemCardImage(props) {
|
|
36
|
+
const { image: image1, imageSrc } = props;
|
|
37
|
+
if (!isSingleItemCardNodeEmpty(image1)) return <view className="doubao-single-item-card__image">{image1}</view>;
|
|
38
|
+
if (null != imageSrc && imageSrc.length > 0) return <image className="doubao-single-item-card__image" src={imageSrc} mode="aspectFill"/>;
|
|
39
|
+
return <view className="doubao-single-item-card__image"/>;
|
|
40
|
+
}
|
|
41
|
+
function getSingleItemCardInfoItems(row) {
|
|
42
|
+
const { text: text1 } = row;
|
|
43
|
+
if (null != text1 && '' !== text1) return [
|
|
44
|
+
{
|
|
45
|
+
key: 'text',
|
|
46
|
+
text: text1
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
return (row.items ?? []).filter((item)=>!isSingleItemCardTextEmpty(item.text));
|
|
50
|
+
}
|
|
51
|
+
function renderSingleItemCardInfoRow(row, rowIndex, quantity) {
|
|
52
|
+
const items = getSingleItemCardInfoItems(row);
|
|
53
|
+
const hasQuantity = 0 === rowIndex && !isSingleItemCardTextEmpty(quantity);
|
|
54
|
+
if (0 === items.length && !hasQuantity) return null;
|
|
55
|
+
return <view className="doubao-single-item-card__info-row" key={row.key ?? rowIndex}>
|
|
56
|
+
<view className="doubao-single-item-card__info-content">
|
|
57
|
+
{items.map((item, itemIndex)=><view className="doubao-single-item-card__info-item" key={item.key ?? itemIndex}>
|
|
58
|
+
{itemIndex > 0 ? <view className="doubao-single-item-card__info-dot"/> : null}
|
|
59
|
+
<text className="doubao-single-item-card__info-text" text-maxline="1">
|
|
60
|
+
{item.text}
|
|
61
|
+
</text>
|
|
62
|
+
</view>)}
|
|
63
|
+
</view>
|
|
64
|
+
{hasQuantity ? <text className="doubao-single-item-card__quantity" text-maxline="1">
|
|
65
|
+
×{quantity}
|
|
66
|
+
</text> : null}
|
|
67
|
+
</view>;
|
|
68
|
+
}
|
|
69
|
+
function getSingleItemCardInfoRows(infoRows, quantity) {
|
|
70
|
+
if (infoRows.length > 0 || isSingleItemCardTextEmpty(quantity)) return infoRows;
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
key: 'quantity'
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
function renderSingleItemCardTitleRow(props) {
|
|
78
|
+
const { title, showChevron = true, pricePrefix, price } = props;
|
|
79
|
+
const titleNode = renderSingleItemCardTitle(title);
|
|
80
|
+
const priceNode = renderSingleItemCardPrice({
|
|
81
|
+
pricePrefix,
|
|
82
|
+
price
|
|
83
|
+
});
|
|
84
|
+
const hasTitleMain = null != titleNode;
|
|
85
|
+
if (!hasTitleMain && null == priceNode) return null;
|
|
86
|
+
return <view className="doubao-single-item-card__title-row">
|
|
87
|
+
{hasTitleMain ? <view className="doubao-single-item-card__title-main">
|
|
88
|
+
{titleNode}
|
|
89
|
+
{null != titleNode && showChevron ? <svg className="doubao-single-item-card__chevron" content={TEMPLATE_CHEVRON_RIGHT_ICON_CONTENT}/> : null}
|
|
90
|
+
</view> : null}
|
|
91
|
+
{priceNode}
|
|
92
|
+
</view>;
|
|
93
|
+
}
|
|
94
|
+
function SingleItemCard(props) {
|
|
95
|
+
const { moreText, showMore = true, imageSrc, image: image1, infoRows = [], quantity, primaryActionText, secondaryActionText, children, className, style, onClick, onMoreClick, onContentClick, onPrimaryActionClick, onSecondaryActionClick } = props;
|
|
96
|
+
const hasCustomContent = !isSingleItemCardNodeEmpty(children);
|
|
97
|
+
const titleRowNode = renderSingleItemCardTitleRow(props);
|
|
98
|
+
const infoRowNodes = getSingleItemCardInfoRows(infoRows, quantity).map((row, rowIndex)=>renderSingleItemCardInfoRow(row, rowIndex, quantity)).filter((node)=>null != node).slice(0, SINGLE_ITEM_CARD_INFO_ROW_LIMIT);
|
|
99
|
+
return <view className={useThemeClassName(clsx('doubao-single-item-card', className))} style={style} bindtap={onClick} clip-radius="true">
|
|
100
|
+
<TemplateTitleBar moreText={moreText} showMore={showMore} onMoreClick={onMoreClick}/>
|
|
101
|
+
<view className="doubao-single-item-card__body" {...null != onContentClick ? {
|
|
102
|
+
catchtap: onContentClick
|
|
103
|
+
} : {}}>
|
|
104
|
+
{hasCustomContent ? children : <view className="doubao-single-item-card__content">
|
|
105
|
+
<SingleItemCardImage image={image1} imageSrc={imageSrc}/>
|
|
106
|
+
<view className="doubao-single-item-card__text">
|
|
107
|
+
{titleRowNode}
|
|
108
|
+
{infoRowNodes}
|
|
109
|
+
</view>
|
|
110
|
+
</view>}
|
|
111
|
+
</view>
|
|
112
|
+
<TemplateActionBar className="doubao-single-item-card__action-bar" secondaryActionText={secondaryActionText} primaryActionText={primaryActionText} onSecondaryActionClick={onSecondaryActionClick} onPrimaryActionClick={onPrimaryActionClick}/>
|
|
113
|
+
</view>;
|
|
114
|
+
}
|
|
115
|
+
export { SingleItemCard };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
.doubao-single-item-card {
|
|
2
|
+
--doubao-single-item-card-bg: var(--bg-base-1);
|
|
3
|
+
--doubao-single-item-card-border: var(--bg-base-2-overlay);
|
|
4
|
+
--doubao-single-item-card-image-bg: var(--bg-base-1-overlay);
|
|
5
|
+
--doubao-single-item-card-title-text: var(--neutral-100);
|
|
6
|
+
--doubao-single-item-card-secondary-text: var(--neutral-50);
|
|
7
|
+
--doubao-single-item-card-price-text: var(--neutral-100);
|
|
8
|
+
--doubao-single-item-card-dot: var(--neutral-50);
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
background-color: var(--doubao-single-item-card-bg);
|
|
11
|
+
border: 1px solid var(--doubao-single-item-card-border);
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
width: 100%;
|
|
16
|
+
display: flex;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.doubao-single-item-card__body {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
background-color: var(--doubao-single-item-card-bg);
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding: 12px;
|
|
28
|
+
display: flex;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.doubao-single-item-card__content {
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
flex: 1 1 0;
|
|
34
|
+
align-items: center;
|
|
35
|
+
min-width: 0;
|
|
36
|
+
display: flex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.doubao-single-item-card__image {
|
|
40
|
+
width: var(--doubao-single-item-card-image-size, 80px);
|
|
41
|
+
height: var(--doubao-single-item-card-image-size, 80px);
|
|
42
|
+
background-color: var(--doubao-single-item-card-image-bg);
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.doubao-single-item-card__text {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
flex: 1 1 0;
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
min-width: 0;
|
|
53
|
+
margin-left: 12px;
|
|
54
|
+
display: flex;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.doubao-single-item-card__title-row {
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
align-items: center;
|
|
60
|
+
width: 100%;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
height: 24px;
|
|
63
|
+
display: flex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.doubao-single-item-card__title-main {
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
flex: 1 1 0;
|
|
69
|
+
align-items: center;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
display: flex;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.doubao-single-item-card__title, .doubao-single-item-card__title-custom {
|
|
75
|
+
flex-shrink: 1;
|
|
76
|
+
min-width: 0;
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.doubao-single-item-card__title-custom {
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
align-items: center;
|
|
83
|
+
display: flex;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.doubao-single-item-card__title {
|
|
87
|
+
color: var(--doubao-single-item-card-title-text);
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
font-family: PingFang SC, sans-serif;
|
|
91
|
+
font-size: 16px;
|
|
92
|
+
font-style: normal;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
line-height: 24px;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.doubao-single-item-card__chevron {
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
width: 12px;
|
|
101
|
+
height: 12px;
|
|
102
|
+
margin-left: 4px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.doubao-single-item-card__price {
|
|
106
|
+
color: var(--doubao-single-item-card-price-text);
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
flex-direction: row;
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
align-items: flex-end;
|
|
111
|
+
margin-left: 8px;
|
|
112
|
+
font-family: PingFang SC, sans-serif;
|
|
113
|
+
font-style: normal;
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
display: flex;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.doubao-single-item-card__price-prefix {
|
|
119
|
+
text-overflow: ellipsis;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
font-size: 11px;
|
|
122
|
+
line-height: 17px;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.doubao-single-item-card__price-value {
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
font-size: 17px;
|
|
130
|
+
line-height: 24px;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.doubao-single-item-card__price-prefix + .doubao-single-item-card__price-value {
|
|
135
|
+
margin-left: 2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.doubao-single-item-card__info-row {
|
|
139
|
+
flex-direction: row;
|
|
140
|
+
align-items: center;
|
|
141
|
+
width: 100%;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
height: 20px;
|
|
144
|
+
display: flex;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.doubao-single-item-card__info-content {
|
|
149
|
+
flex-direction: row;
|
|
150
|
+
flex: 1 1 0;
|
|
151
|
+
align-items: center;
|
|
152
|
+
min-width: 0;
|
|
153
|
+
display: flex;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.doubao-single-item-card__title-row + .doubao-single-item-card__info-row, .doubao-single-item-card__info-row + .doubao-single-item-card__info-row {
|
|
158
|
+
margin-top: 1px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.doubao-single-item-card__info-item {
|
|
162
|
+
flex-direction: row;
|
|
163
|
+
flex-shrink: 1;
|
|
164
|
+
align-items: center;
|
|
165
|
+
min-width: 0;
|
|
166
|
+
display: flex;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.doubao-single-item-card__info-text {
|
|
170
|
+
min-width: 0;
|
|
171
|
+
color: var(--doubao-single-item-card-secondary-text);
|
|
172
|
+
text-overflow: ellipsis;
|
|
173
|
+
white-space: nowrap;
|
|
174
|
+
font-family: PingFang SC, sans-serif;
|
|
175
|
+
font-size: 13px;
|
|
176
|
+
font-style: normal;
|
|
177
|
+
font-weight: 400;
|
|
178
|
+
line-height: 20px;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.doubao-single-item-card__info-dot {
|
|
183
|
+
background-color: var(--doubao-single-item-card-dot);
|
|
184
|
+
border-radius: 50%;
|
|
185
|
+
flex-shrink: 0;
|
|
186
|
+
width: 2px;
|
|
187
|
+
height: 2px;
|
|
188
|
+
margin: 0 6px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.doubao-single-item-card__quantity {
|
|
192
|
+
color: var(--doubao-single-item-card-secondary-text);
|
|
193
|
+
text-overflow: ellipsis;
|
|
194
|
+
white-space: nowrap;
|
|
195
|
+
flex-shrink: 0;
|
|
196
|
+
margin-left: 8px;
|
|
197
|
+
font-family: PingFang SC, sans-serif;
|
|
198
|
+
font-size: 13px;
|
|
199
|
+
font-style: normal;
|
|
200
|
+
font-weight: 400;
|
|
201
|
+
line-height: 20px;
|
|
202
|
+
overflow: hidden;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.doubao-single-item-card__action-bar {
|
|
206
|
+
--doubao-template-action-bar-secondary-bg: var(--bg-base-2-overlay);
|
|
207
|
+
--doubao-template-action-bar-secondary-text: var(--neutral-100);
|
|
208
|
+
}
|
|
209
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSProperties, TouchEvent } from '@lynx-js/types';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { TemplateText } from '../types.js';
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
export interface TaskActionCardProps {
|
|
6
|
+
/** 按钮文案。 */
|
|
7
|
+
text: TemplateText;
|
|
8
|
+
/** 按钮根节点自定义类名。 */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** 按钮根节点自定义样式。 */
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
/** 点击按钮时触发。 */
|
|
13
|
+
onClick?: (event?: TouchEvent) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function TaskActionCard(props: TaskActionCardProps): ReactElement | null;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from "@byted-doubao-apps/components";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
const TASK_ACTION_CARD_ARROW_ICON_CONTENT = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<path d="M3.75 10H15.25" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
6
|
+
<path d="M10.75 5.5L15.25 10L10.75 14.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path d="M17 5V15" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
8
|
+
</svg>`;
|
|
9
|
+
function isTaskActionCardTextEmpty(content) {
|
|
10
|
+
return null == content || '' === content;
|
|
11
|
+
}
|
|
12
|
+
function TaskActionCard(props) {
|
|
13
|
+
const { text: text1, className, style, onClick } = props;
|
|
14
|
+
if (isTaskActionCardTextEmpty(text1)) return null;
|
|
15
|
+
return <Button className={clsx('doubao-task-action-card', className)} style={style} type="default" onClick={onClick}>
|
|
16
|
+
<view className="doubao-task-action-card__content">
|
|
17
|
+
<text className="doubao-task-action-card__text" text-maxline="1">
|
|
18
|
+
{text1}
|
|
19
|
+
</text>
|
|
20
|
+
<svg className="doubao-task-action-card__icon" content={TASK_ACTION_CARD_ARROW_ICON_CONTENT}/>
|
|
21
|
+
</view>
|
|
22
|
+
</Button>;
|
|
23
|
+
}
|
|
24
|
+
export { TaskActionCard };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.doubao-task-action-card {
|
|
2
|
+
--doubao-task-action-card-bg: var(--bg-base-1);
|
|
3
|
+
--doubao-task-action-card-text: var(--neutral-100);
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
--doubao-button-border-radius: 8px;
|
|
6
|
+
--doubao-button-default-height: 44px;
|
|
7
|
+
--doubao-button-default-padding-x: 16px;
|
|
8
|
+
--doubao-button-default-padding-y: 0;
|
|
9
|
+
--doubao-button-default-font-size: 16px;
|
|
10
|
+
--doubao-button-default-line-height: 22px;
|
|
11
|
+
--doubao-button-default-bg: var(--doubao-task-action-card-bg);
|
|
12
|
+
--doubao-button-default-text: var(--doubao-task-action-card-text);
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 44px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.doubao-task-action-card__content {
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.doubao-task-action-card__text {
|
|
26
|
+
min-width: 0;
|
|
27
|
+
color: var(--doubao-task-action-card-text);
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
font-family: PingFang SC, sans-serif;
|
|
31
|
+
font-size: 16px;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
line-height: 22px;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.doubao-task-action-card__icon {
|
|
39
|
+
width: 20px;
|
|
40
|
+
height: 20px;
|
|
41
|
+
color: var(--doubao-task-action-card-text);
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
margin-left: 4px;
|
|
44
|
+
}
|
|
45
|
+
|