@doubao-apps/template 0.0.31 → 0.0.32

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 (50) hide show
  1. package/README.md +231 -109
  2. package/assets/order-card.png +0 -0
  3. package/assets/product-action-card.png +0 -0
  4. package/assets/ticket-order-card.png +0 -0
  5. package/assets/transport-card.png +0 -0
  6. package/assets/transport-list-card.png +0 -0
  7. package/dist/components/action-bar/index.d.ts +19 -0
  8. package/dist/components/action-bar/index.js +15 -0
  9. package/dist/components/action-bar/styles.css +30 -0
  10. package/dist/components/info-section/index.d.ts +47 -0
  11. package/dist/components/info-section/index.js +93 -0
  12. package/dist/components/info-section/styles.css +140 -0
  13. package/dist/components/product-summary/index.d.ts +24 -0
  14. package/dist/components/product-summary/index.js +51 -0
  15. package/dist/components/product-summary/styles.css +125 -0
  16. package/dist/components/route-section/index.d.ts +23 -0
  17. package/dist/components/route-section/index.js +38 -0
  18. package/dist/components/route-section/styles.css +58 -0
  19. package/dist/components/title-bar/index.d.ts +11 -0
  20. package/dist/components/title-bar/index.js +32 -0
  21. package/dist/components/title-bar/styles.css +69 -0
  22. package/dist/components/transport-summary/index.d.ts +31 -0
  23. package/dist/components/transport-summary/index.js +104 -0
  24. package/dist/components/transport-summary/styles.css +182 -0
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.js +4 -0
  27. package/dist/invalid-card/index.js +2 -20
  28. package/dist/invalid-card/styles.css +1 -65
  29. package/dist/list-card/index.d.ts +3 -2
  30. package/dist/list-card/index.js +2 -20
  31. package/dist/list-card/styles.css +0 -72
  32. package/dist/order-card/index.d.ts +7 -6
  33. package/dist/order-card/index.js +9 -106
  34. package/dist/order-card/styles.css +6 -368
  35. package/dist/product-action-card/index.d.ts +40 -0
  36. package/dist/product-action-card/index.js +17 -0
  37. package/dist/product-action-card/styles.css +20 -0
  38. package/dist/ticket-order-card/index.d.ts +78 -0
  39. package/dist/ticket-order-card/index.js +27 -0
  40. package/dist/ticket-order-card/styles.css +18 -0
  41. package/dist/transport-card/index.d.ts +36 -0
  42. package/dist/transport-card/index.js +15 -0
  43. package/dist/transport-card/styles.css +21 -0
  44. package/dist/transport-list-card/index.d.ts +56 -0
  45. package/dist/transport-list-card/index.js +32 -0
  46. package/dist/transport-list-card/styles.css +60 -0
  47. package/dist/types.d.ts +3 -0
  48. package/dist/types.js +0 -0
  49. package/dist/utils/app-info.js +1 -2
  50. package/package.json +2 -6
@@ -1,117 +1,20 @@
1
- import { Button, useThemeClassName } from "@byted-doubao-apps/components";
1
+ import { useThemeClassName } from "@byted-doubao-apps/components";
2
2
  import { clsx } from "clsx";
3
- import { getAppInfo } from "../utils/app-info.js";
3
+ import { TemplateActionBar } from "../components/action-bar/index.js";
4
+ import { TemplateInfoSection } from "../components/info-section/index.js";
5
+ import { TemplateProductSummary } from "../components/product-summary/index.js";
6
+ import { TemplateTitleBar } from "../components/title-bar/index.js";
4
7
  import "./styles.css";
5
- function OrderCardIcon({ appIconSrc }) {
6
- if (null != appIconSrc && appIconSrc.length > 0) return <image className="doubao-order-card__app-icon" src={appIconSrc} mode="aspectFill"/>;
7
- return <view className="doubao-order-card__app-icon"/>;
8
- }
9
- function OrderCardProductImage(props) {
10
- const { productImage, productImageSrc } = props;
11
- if (null != productImage) return <view className="doubao-order-card__product-image">{productImage}</view>;
12
- if (null != productImageSrc && productImageSrc.length > 0) return <image className="doubao-order-card__product-image" src={productImageSrc} mode="aspectFill"/>;
13
- return <view className="doubao-order-card__product-image"/>;
14
- }
15
8
  function OrderCard(props) {
16
9
  const { moreText, showMore = true, productTitle, productSpec, productPricePrefix, productPrice, productQuantity, infoItems = [], feeItems = [], discountText, totalLabel, totalPrice, primaryActionText, secondaryActionText, className, style, onClick, onMoreClick, onProductClick, onPrimaryActionClick, onSecondaryActionClick } = props;
17
- const appInfo = getAppInfo();
18
- const hasProductImage = null != props.productImage || null != props.productImageSrc && props.productImageSrc.length > 0;
19
- const hasProductMainLine = null != productTitle && productTitle.length > 0 || null != productPricePrefix && productPricePrefix.length > 0 || null != productPrice && '' !== productPrice;
20
- const hasProductSecondaryLine = null != productSpec && productSpec.length > 0 || null != productQuantity && '' !== productQuantity;
21
- const hasProduct = hasProductImage || hasProductMainLine || hasProductSecondaryLine;
22
- const hasInfoItems = infoItems.length > 0;
23
- const hasDiscount = null != discountText && discountText.length > 0;
24
- const hasFeeItems = feeItems.length > 0;
25
- const hasTotal = null != totalLabel && totalLabel.length > 0 || null != totalPrice && '' !== totalPrice;
26
- const hasSummary = hasDiscount || hasFeeItems || hasTotal;
27
- const hasPrimaryAction = null != primaryActionText && primaryActionText.length > 0;
28
- const hasSecondaryAction = null != secondaryActionText && secondaryActionText.length > 0;
29
- const hasActions = hasPrimaryAction || hasSecondaryAction;
30
10
  return <view className={useThemeClassName(clsx('doubao-order-card', className))} style={style} bindtap={onClick} clip-radius="true">
31
- <view className="doubao-order-card__title-bar">
32
- <view className="doubao-order-card__app">
33
- <OrderCardIcon appIconSrc={appInfo.appIconSrc}/>
34
- <text className="doubao-order-card__app-name" text-maxline="1">
35
- {appInfo.appName}
36
- </text>
37
- </view>
38
- {showMore && null != moreText && moreText.length > 0 ? <view className="doubao-order-card__more" catchtap={onMoreClick}>
39
- <text className="doubao-order-card__more-text" text-maxline="1">
40
- {moreText}
41
- </text>
42
- <view className="doubao-order-card__more-chevron"/>
43
- </view> : null}
44
- </view>
11
+ <TemplateTitleBar moreText={moreText} showMore={showMore} onMoreClick={onMoreClick}/>
45
12
 
46
- {hasProduct ? <view className="doubao-order-card__product" catchtap={onProductClick}>
47
- {hasProductImage ? <OrderCardProductImage productImage={props.productImage} productImageSrc={props.productImageSrc}/> : null}
48
- <view className={clsx('doubao-order-card__product-content', hasProductImage && 'doubao-order-card__product-content--with-image')}>
49
- {hasProductMainLine ? <view className="doubao-order-card__product-line-main">
50
- {null != productTitle && productTitle.length > 0 ? <view className="doubao-order-card__product-title-wrap">
51
- <text className="doubao-order-card__product-title" text-maxline="1">
52
- {productTitle}
53
- </text>
54
- <view className="doubao-order-card__product-chevron"/>
55
- </view> : null}
56
- {null != productPricePrefix && productPricePrefix.length > 0 || null != productPrice && '' !== productPrice ? <view className="doubao-order-card__product-price">
57
- {null != productPricePrefix && productPricePrefix.length > 0 ? <text className="doubao-order-card__product-price-prefix" text-maxline="1">
58
- {productPricePrefix}
59
- </text> : null}
60
- {null != productPrice && '' !== productPrice ? <text className="doubao-order-card__product-price-value" text-maxline="1">
61
- {productPrice}
62
- </text> : null}
63
- </view> : null}
64
- </view> : null}
65
- {hasProductSecondaryLine ? <view className="doubao-order-card__product-line-secondary">
66
- {null != productSpec && productSpec.length > 0 ? <text className="doubao-order-card__product-spec" text-maxline="1">
67
- {productSpec}
68
- </text> : null}
69
- {null != productQuantity && '' !== productQuantity ? <text className="doubao-order-card__product-quantity" text-maxline="1">
70
- ×{productQuantity}
71
- </text> : null}
72
- </view> : null}
73
- </view>
74
- </view> : null}
13
+ <TemplateProductSummary title={productTitle} spec={productSpec} image={props.productImage} imageSrc={props.productImageSrc} pricePrefix={productPricePrefix} price={productPrice} quantity={productQuantity} onClick={onProductClick}/>
75
14
 
76
- {hasInfoItems || hasSummary ? <view className="doubao-order-card__info">
77
- {infoItems.map((item, index)=><view className="doubao-order-card__info-row" key={item.key ?? index}>
78
- <text className="doubao-order-card__info-label" text-maxline="1">
79
- {item.label}
80
- </text>
81
- <view className="doubao-order-card__info-value-wrap">
82
- <text className="doubao-order-card__info-value" text-maxline="1">
83
- {item.value}
84
- </text>
85
- {null != item.valueExtra ? <text className="doubao-order-card__info-value" text-maxline="1">
86
- {item.valueExtra}
87
- </text> : null}
88
- </view>
89
- </view>)}
90
- {hasSummary ? <view className="doubao-order-card__summary">
91
- <view className="doubao-order-card__summary-content">
92
- {hasDiscount ? <text className="doubao-order-card__fee-text" text-maxline="1">
93
- {discountText}
94
- </text> : null}
95
- {feeItems.map((item, index)=><text className="doubao-order-card__fee-text" text-maxline="1" key={item.key ?? index}>
96
- {item.label}
97
- {item.value}
98
- </text>)}
99
- {hasTotal ? <view className="doubao-order-card__total">
100
- {null != totalLabel && totalLabel.length > 0 ? <text className="doubao-order-card__total-label" text-maxline="1">
101
- {totalLabel}
102
- </text> : null}
103
- {null != totalPrice && '' !== totalPrice ? <text className="doubao-order-card__total-price" text-maxline="1">
104
- {totalPrice}
105
- </text> : null}
106
- </view> : null}
107
- </view>
108
- </view> : null}
109
- </view> : null}
15
+ <TemplateInfoSection infoItems={infoItems} feeItems={feeItems} discountText={discountText} totalLabel={totalLabel} totalPrice={totalPrice} valueLayout="column"/>
110
16
 
111
- {hasActions ? <view className="doubao-order-card__actions">
112
- {hasSecondaryAction ? <Button className="doubao-order-card__action doubao-order-card__action--secondary" type="default" text={secondaryActionText} onClick={onSecondaryActionClick}/> : null}
113
- {hasPrimaryAction ? <Button className="doubao-order-card__action doubao-order-card__action--primary" type="primary" text={primaryActionText} onClick={onPrimaryActionClick}/> : null}
114
- </view> : null}
17
+ <TemplateActionBar secondaryActionText={secondaryActionText} primaryActionText={primaryActionText} onSecondaryActionClick={onSecondaryActionClick} onPrimaryActionClick={onPrimaryActionClick}/>
115
18
  </view>;
116
19
  }
117
20
  export { OrderCard };
@@ -2,6 +2,12 @@
2
2
  box-sizing: border-box;
3
3
  background-color: var(--bg-base-1);
4
4
  border: 1px solid var(--bg-base-2-overlay);
5
+ --doubao-template-info-section-padding: 12px 16px;
6
+ --doubao-template-info-section-row-align: flex-start;
7
+ --doubao-template-info-section-row-gap: 8px;
8
+ --doubao-template-info-section-label-margin-right: 8px;
9
+ --doubao-template-info-section-summary-margin-top: 8px;
10
+ --doubao-template-info-section-fee-shrink: 0;
5
11
  border-radius: 8px;
6
12
  flex-direction: column;
7
13
  align-items: stretch;
@@ -10,371 +16,3 @@
10
16
  overflow: hidden;
11
17
  }
12
18
 
13
- .doubao-order-card__title-bar {
14
- box-sizing: border-box;
15
- border-bottom: .5px solid var(--neutral-transparent-1);
16
- flex-direction: row;
17
- justify-content: space-between;
18
- align-items: center;
19
- width: 100%;
20
- height: 40px;
21
- padding: 0 16px;
22
- display: flex;
23
- }
24
-
25
- .doubao-order-card__app {
26
- flex-direction: row;
27
- align-items: center;
28
- min-width: 0;
29
- display: flex;
30
- }
31
-
32
- .doubao-order-card__app-icon {
33
- background-color: var(--neutral-30);
34
- border-radius: 4px;
35
- flex-shrink: 0;
36
- width: 16px;
37
- height: 16px;
38
- overflow: hidden;
39
- }
40
-
41
- .doubao-order-card__app-name {
42
- color: var(--neutral-50);
43
- text-overflow: ellipsis;
44
- white-space: nowrap;
45
- margin-left: 6px;
46
- font-family: PingFang SC, sans-serif;
47
- font-size: 12px;
48
- font-style: normal;
49
- font-weight: 500;
50
- line-height: 18px;
51
- overflow: hidden;
52
- }
53
-
54
- .doubao-order-card__more {
55
- flex-direction: row;
56
- flex-shrink: 0;
57
- justify-content: flex-end;
58
- align-items: center;
59
- min-width: 62.5px;
60
- display: flex;
61
- }
62
-
63
- .doubao-order-card__more-text {
64
- color: var(--neutral-50);
65
- text-overflow: ellipsis;
66
- white-space: nowrap;
67
- font-family: PingFang SC, sans-serif;
68
- font-size: 12px;
69
- font-style: normal;
70
- font-weight: 400;
71
- line-height: 18px;
72
- overflow: hidden;
73
- }
74
-
75
- .doubao-order-card__more-chevron {
76
- box-sizing: border-box;
77
- border-top: 1px solid var(--neutral-50);
78
- border-right: 1px solid var(--neutral-50);
79
- width: 7px;
80
- height: 7px;
81
- margin-left: 2px;
82
- transform: rotate(45deg);
83
- }
84
-
85
- .doubao-order-card__product {
86
- box-sizing: border-box;
87
- background-color: var(--bg-base-1);
88
- flex-direction: row;
89
- align-items: center;
90
- width: 100%;
91
- padding: 12px 16px 12px 12px;
92
- display: flex;
93
- }
94
-
95
- .doubao-order-card__product-image {
96
- background-color: var(--bg-base-1-overlay);
97
- border-radius: 5px;
98
- flex-shrink: 0;
99
- width: 80px;
100
- height: 80px;
101
- overflow: hidden;
102
- }
103
-
104
- .doubao-order-card__product-content {
105
- flex-direction: column;
106
- flex: 1 1 0;
107
- min-width: 0;
108
- display: flex;
109
- }
110
-
111
- .doubao-order-card__product-content--with-image {
112
- margin-left: 12px;
113
- }
114
-
115
- .doubao-order-card__product-line-main, .doubao-order-card__product-line-secondary {
116
- flex-direction: row;
117
- align-items: center;
118
- width: 100%;
119
- min-width: 0;
120
- display: flex;
121
- }
122
-
123
- .doubao-order-card__product-line-main {
124
- height: 24px;
125
- }
126
-
127
- .doubao-order-card__product-line-secondary {
128
- height: 20px;
129
- margin-top: 2px;
130
- }
131
-
132
- .doubao-order-card__product-title-wrap {
133
- flex-direction: row;
134
- flex: 1 1 0;
135
- align-items: center;
136
- min-width: 0;
137
- margin-right: 8px;
138
- display: flex;
139
- }
140
-
141
- .doubao-order-card__product-title {
142
- min-width: 0;
143
- color: var(--neutral-100);
144
- text-overflow: ellipsis;
145
- white-space: nowrap;
146
- font-family: PingFang SC, sans-serif;
147
- font-size: 16px;
148
- font-style: normal;
149
- font-weight: 500;
150
- line-height: 24px;
151
- overflow: hidden;
152
- }
153
-
154
- .doubao-order-card__product-chevron {
155
- box-sizing: border-box;
156
- border-top: 1.5px solid var(--neutral-30);
157
- border-right: 1.5px solid var(--neutral-30);
158
- flex-shrink: 0;
159
- width: 7px;
160
- height: 7px;
161
- margin-left: 5px;
162
- transform: rotate(45deg);
163
- }
164
-
165
- .doubao-order-card__product-price {
166
- color: var(--neutral-100);
167
- white-space: nowrap;
168
- flex-direction: row;
169
- flex-shrink: 0;
170
- align-items: flex-end;
171
- font-family: PingFang SC, sans-serif;
172
- font-style: normal;
173
- font-weight: 500;
174
- display: flex;
175
- }
176
-
177
- .doubao-order-card__product-price-prefix {
178
- text-overflow: ellipsis;
179
- white-space: nowrap;
180
- width: 22px;
181
- font-size: 11px;
182
- line-height: 17px;
183
- overflow: hidden;
184
- }
185
-
186
- .doubao-order-card__product-price-value {
187
- text-overflow: ellipsis;
188
- white-space: nowrap;
189
- margin-left: 2px;
190
- font-size: 13px;
191
- line-height: 19px;
192
- overflow: hidden;
193
- }
194
-
195
- .doubao-order-card__product-spec {
196
- min-width: 0;
197
- color: var(--neutral-50);
198
- text-overflow: ellipsis;
199
- white-space: nowrap;
200
- flex: 1 1 0;
201
- font-family: PingFang SC, sans-serif;
202
- font-size: 12px;
203
- font-style: normal;
204
- font-weight: 400;
205
- line-height: 18px;
206
- overflow: hidden;
207
- }
208
-
209
- .doubao-order-card__product-quantity {
210
- color: var(--neutral-50);
211
- text-overflow: ellipsis;
212
- white-space: nowrap;
213
- flex-shrink: 0;
214
- margin-left: 8px;
215
- font-family: PingFang SC, sans-serif;
216
- font-size: 13px;
217
- font-style: normal;
218
- font-weight: 400;
219
- line-height: 20px;
220
- overflow: hidden;
221
- }
222
-
223
- .doubao-order-card__info {
224
- box-sizing: border-box;
225
- border-top: .5px solid var(--neutral-transparent-1);
226
- flex-direction: column;
227
- width: 100%;
228
- padding: 12px 16px;
229
- display: flex;
230
- }
231
-
232
- .doubao-order-card__info-row {
233
- flex-direction: row;
234
- align-items: flex-start;
235
- width: 100%;
236
- min-width: 0;
237
- display: flex;
238
- }
239
-
240
- .doubao-order-card__info-row + .doubao-order-card__info-row {
241
- margin-top: 8px;
242
- }
243
-
244
- .doubao-order-card__info-label {
245
- width: 66px;
246
- color: var(--neutral-100);
247
- text-overflow: ellipsis;
248
- white-space: nowrap;
249
- flex-shrink: 0;
250
- font-family: PingFang SC, sans-serif;
251
- font-size: 13px;
252
- font-style: normal;
253
- font-weight: 400;
254
- line-height: 20px;
255
- overflow: hidden;
256
- }
257
-
258
- .doubao-order-card__info-value-wrap {
259
- flex-direction: column;
260
- flex: 1 1 0;
261
- align-items: flex-end;
262
- min-width: 0;
263
- margin-left: 8px;
264
- display: flex;
265
- }
266
-
267
- .doubao-order-card__info-value {
268
- max-width: 100%;
269
- color: var(--neutral-50);
270
- text-align: right;
271
- text-overflow: ellipsis;
272
- white-space: nowrap;
273
- font-family: PingFang SC, sans-serif;
274
- font-size: 13px;
275
- font-style: normal;
276
- font-weight: 400;
277
- line-height: 20px;
278
- overflow: hidden;
279
- }
280
-
281
- .doubao-order-card__summary {
282
- flex-direction: row;
283
- justify-content: flex-end;
284
- width: 100%;
285
- min-width: 0;
286
- margin-top: 8px;
287
- display: flex;
288
- }
289
-
290
- .doubao-order-card__summary-content {
291
- flex-direction: row;
292
- justify-content: flex-end;
293
- align-items: center;
294
- min-width: 0;
295
- max-width: 100%;
296
- display: flex;
297
- overflow: hidden;
298
- }
299
-
300
- .doubao-order-card__fee-text {
301
- color: var(--neutral-50);
302
- text-overflow: ellipsis;
303
- white-space: nowrap;
304
- flex-shrink: 0;
305
- margin-left: 6px;
306
- font-family: PingFang SC, sans-serif;
307
- font-size: 13px;
308
- font-style: normal;
309
- font-weight: 400;
310
- line-height: 20px;
311
- overflow: hidden;
312
- }
313
-
314
- .doubao-order-card__fee-text:first-child {
315
- margin-left: 0;
316
- }
317
-
318
- .doubao-order-card__total {
319
- flex-direction: row;
320
- flex-shrink: 0;
321
- align-items: center;
322
- margin-left: 6px;
323
- display: flex;
324
- }
325
-
326
- .doubao-order-card__total-label {
327
- color: var(--neutral-100);
328
- text-overflow: ellipsis;
329
- white-space: nowrap;
330
- font-family: PingFang SC, sans-serif;
331
- font-size: 13px;
332
- font-style: normal;
333
- font-weight: 500;
334
- line-height: 20px;
335
- overflow: hidden;
336
- }
337
-
338
- .doubao-order-card__total-price {
339
- color: var(--neutral-100);
340
- text-overflow: ellipsis;
341
- white-space: nowrap;
342
- margin-left: 2px;
343
- font-family: PingFang SC, sans-serif;
344
- font-size: 15px;
345
- font-style: normal;
346
- font-weight: 500;
347
- line-height: 22px;
348
- overflow: hidden;
349
- }
350
-
351
- .doubao-order-card__actions {
352
- box-sizing: border-box;
353
- background-color: var(--bg-base-1);
354
- flex-direction: row;
355
- width: 100%;
356
- padding: 8px 12px 12px;
357
- display: flex;
358
- }
359
-
360
- .doubao-order-card__action {
361
- --doubao-btn-border-radius: 8px;
362
- --doubao-btn-default-height: 44px;
363
- --doubao-btn-default-padding-x: 12px;
364
- --doubao-btn-default-padding-y: 0;
365
- --doubao-btn-default-font-size: 16px;
366
- --doubao-btn-default-line-height: 22px;
367
- --doubao-btn-primary-bg: var(--primary-50);
368
- --doubao-btn-primary-text: var(--static-white);
369
- --doubao-btn-default-bg: var(--bg-base-2-overlay);
370
- --doubao-btn-default-text: var(--neutral-100);
371
- flex: 1 1 0;
372
- width: auto;
373
- min-width: 0;
374
- height: 44px;
375
- }
376
-
377
- .doubao-order-card__action + .doubao-order-card__action {
378
- margin-left: 10px;
379
- }
380
-
@@ -0,0 +1,40 @@
1
+ import type { CSSProperties, TouchEvent } from '@lynx-js/types';
2
+ import type { ReactElement, ReactNode } from 'react';
3
+ import type { TemplateText } from '../types.js';
4
+ import './styles.scss';
5
+ export interface ProductActionCardProps {
6
+ /** 标题栏右侧「更多」入口的文案。 */
7
+ moreText?: string;
8
+ /** 是否展示标题栏右侧「更多」入口。 */
9
+ showMore?: boolean;
10
+ /** 商品标题。 */
11
+ productTitle?: string;
12
+ /** 商品规格说明。 */
13
+ productSpec?: string;
14
+ /** 商品图片地址。 */
15
+ productImageSrc?: string;
16
+ /** 商品自定义图片节点;优先级高于 productImageSrc。 */
17
+ productImage?: ReactNode;
18
+ /** 商品价格前缀文案。 */
19
+ productPricePrefix?: string;
20
+ /** 商品价格或右侧摘要文案。 */
21
+ productPrice?: TemplateText;
22
+ /** 商品数量。 */
23
+ productQuantity?: TemplateText;
24
+ /** 主按钮文案。 */
25
+ primaryActionText?: string;
26
+ /** 卡片根节点自定义类名。 */
27
+ className?: string;
28
+ /** 卡片根节点自定义样式。 */
29
+ style?: CSSProperties;
30
+ /** 点击卡片根节点时触发。 */
31
+ onClick?: (event: TouchEvent) => void;
32
+ /** 点击标题栏右侧「更多」入口时触发。 */
33
+ onMoreClick?: (event: TouchEvent) => void;
34
+ /** 点击商品区域时触发。 */
35
+ onProductClick?: (event: TouchEvent) => void;
36
+ /** 点击主按钮时触发。 */
37
+ onPrimaryActionClick?: (event?: TouchEvent) => void;
38
+ }
39
+ export declare function ProductActionCard(props: ProductActionCardProps): ReactElement;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { useThemeClassName } from "@byted-doubao-apps/components";
2
+ import { clsx } from "clsx";
3
+ import { TemplateActionBar } from "../components/action-bar/index.js";
4
+ import { TemplateProductSummary } from "../components/product-summary/index.js";
5
+ import { TemplateTitleBar } from "../components/title-bar/index.js";
6
+ import "./styles.css";
7
+ function ProductActionCard(props) {
8
+ const { moreText, showMore = true, productTitle, productSpec, productPricePrefix, productPrice, productQuantity, primaryActionText, className, style, onClick, onMoreClick, onProductClick, onPrimaryActionClick } = props;
9
+ return <view className={useThemeClassName(clsx('doubao-product-action-card', className))} style={style} bindtap={onClick}>
10
+ <TemplateTitleBar moreText={moreText} showMore={showMore} onMoreClick={onMoreClick}/>
11
+ <view className="doubao-product-action-card__body">
12
+ <TemplateProductSummary title={productTitle} spec={productSpec} image={props.productImage} imageSrc={props.productImageSrc} pricePrefix={productPricePrefix} price={productPrice} quantity={productQuantity} onClick={onProductClick}/>
13
+ <TemplateActionBar primaryActionText={primaryActionText} onPrimaryActionClick={onPrimaryActionClick}/>
14
+ </view>
15
+ </view>;
16
+ }
17
+ export { ProductActionCard };
@@ -0,0 +1,20 @@
1
+ .doubao-product-action-card {
2
+ box-sizing: border-box;
3
+ background-color: var(--doubao-product-action-card-bg);
4
+ border: 1px solid var(--doubao-product-action-card-border);
5
+ border-radius: 8px;
6
+ flex-direction: column;
7
+ align-items: stretch;
8
+ width: 100%;
9
+ display: flex;
10
+ overflow: hidden;
11
+ }
12
+
13
+ .doubao-product-action-card__body {
14
+ box-sizing: border-box;
15
+ background-color: var(--doubao-product-action-card-bg);
16
+ flex-direction: column;
17
+ width: 100%;
18
+ display: flex;
19
+ }
20
+
@@ -0,0 +1,78 @@
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 TicketOrderCardProps {
6
+ /** 标题栏右侧「更多」入口的文案。 */
7
+ moreText?: string;
8
+ /** 是否展示标题栏右侧「更多」入口。 */
9
+ showMore?: boolean;
10
+ /** 航程信息列表。 */
11
+ routeItems?: TicketOrderCardRouteItem[];
12
+ /** 订单信息列表。 */
13
+ infoItems?: TicketOrderCardInfoItem[];
14
+ /** 费用明细列表。 */
15
+ feeItems?: TicketOrderCardFeeItem[];
16
+ /** 合计价格前的标签文案。 */
17
+ totalLabel?: TemplateText;
18
+ /** 合计价格。 */
19
+ totalPrice?: TemplateText;
20
+ /** 合计区域自定义内容;优先级高于 totalLabel 和 totalPrice。 */
21
+ totalContent?: ReactNode;
22
+ /** 主按钮文案。 */
23
+ primaryActionText?: string;
24
+ /** 次按钮文案。 */
25
+ secondaryActionText?: string;
26
+ /** 卡片根节点自定义类名。 */
27
+ className?: string;
28
+ /** 卡片根节点自定义样式。 */
29
+ style?: CSSProperties;
30
+ /** 点击卡片根节点时触发。 */
31
+ onClick?: (event: TouchEvent) => void;
32
+ /** 点击标题栏右侧「更多」入口时触发。 */
33
+ onMoreClick?: (event: TouchEvent) => void;
34
+ /** 点击主按钮时触发。 */
35
+ onPrimaryActionClick?: (event?: TouchEvent) => void;
36
+ /** 点击次按钮时触发。 */
37
+ onSecondaryActionClick?: (event?: TouchEvent) => void;
38
+ }
39
+ export interface TicketOrderCardRouteItem {
40
+ /** 航程项唯一标识;不传时使用数组下标。 */
41
+ key?: TemplateKey;
42
+ /** 航程标题,例如「出发地 - 到达地」。 */
43
+ title?: TemplateText;
44
+ /** 航程描述,例如「6月1日 周六 20:50-23:50 CZ0000 经济舱」。 */
45
+ description?: TemplateText;
46
+ /** 是否展示标题右侧箭头。 */
47
+ showChevron?: boolean;
48
+ /** 点击航程项时触发。 */
49
+ onClick?: (event: TouchEvent) => void;
50
+ }
51
+ export interface TicketOrderCardInfoItem {
52
+ /** 信息项唯一标识;不传时使用数组下标。 */
53
+ key?: TemplateKey;
54
+ /** 信息项标签。 */
55
+ label?: TemplateText;
56
+ /** 信息项标签块内容;优先级高于 label。 */
57
+ labelContent?: ReactNode;
58
+ /** 信息项主内容。 */
59
+ value?: TemplateText;
60
+ /** 信息项主内容块内容;优先级高于 value。 */
61
+ valueContent?: ReactNode;
62
+ /** 信息项补充内容。 */
63
+ valueExtra?: TemplateText;
64
+ /** 信息项补充内容块内容;优先级高于 valueExtra。 */
65
+ valueExtraContent?: ReactNode;
66
+ }
67
+ export interface TicketOrderCardFeeItem {
68
+ /** 费用项唯一标识;不传时使用数组下标。 */
69
+ key?: TemplateKey;
70
+ /** 费用项标签。 */
71
+ label?: TemplateText;
72
+ /** 费用项金额或数值。 */
73
+ value?: TemplateText;
74
+ /** 费用项自定义内容;优先级高于 label 和 value。 */
75
+ content?: ReactNode;
76
+ }
77
+ export declare function TicketOrderCard(props: TicketOrderCardProps): ReactElement;
78
+ //# sourceMappingURL=index.d.ts.map