@doubao-dev/template 0.0.38 → 0.0.39

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 (47) hide show
  1. package/README.md +116 -44
  2. package/dist/ask-human-card/index.d.ts +1 -3
  3. package/dist/ask-human-card/index.js +4 -8
  4. package/dist/checkout-card/index.d.ts +3 -5
  5. package/dist/checkout-card/index.js +2 -2
  6. package/dist/components/info-section/index.d.ts +0 -2
  7. package/dist/components/info-section/index.js +4 -7
  8. package/dist/components/info-section/styles.css +28 -18
  9. package/dist/components/product-summary/index.d.ts +5 -1
  10. package/dist/components/product-summary/index.js +9 -7
  11. package/dist/components/product-summary/styles.css +25 -16
  12. package/dist/components/route-section/index.d.ts +5 -1
  13. package/dist/components/route-section/index.js +2 -0
  14. package/dist/components/route-section/styles.css +24 -0
  15. package/dist/content-card/index.d.ts +13 -3
  16. package/dist/content-card/index.js +12 -6
  17. package/dist/content-card/styles.css +9 -5
  18. package/dist/index.d.ts +1 -1
  19. package/dist/price-action-card/index.d.ts +8 -2
  20. package/dist/price-action-card/index.js +2 -8
  21. package/dist/price-action-card/styles.css +15 -29
  22. package/dist/primitives/index.d.ts +4 -0
  23. package/dist/primitives/index.js +3 -0
  24. package/dist/primitives/price/index.d.ts +5 -0
  25. package/dist/primitives/price/index.js +56 -0
  26. package/dist/primitives/price/styles.css +130 -0
  27. package/dist/primitives/price/types.d.ts +26 -0
  28. package/dist/primitives/price/types.js +0 -0
  29. package/dist/primitives/tag/index.d.ts +5 -0
  30. package/dist/primitives/tag/index.js +10 -0
  31. package/dist/primitives/tag/styles.css +70 -0
  32. package/dist/primitives/tag/types.d.ts +14 -0
  33. package/dist/primitives/tag/types.js +0 -0
  34. package/dist/primitives/title/index.d.ts +5 -0
  35. package/dist/primitives/title/index.js +18 -0
  36. package/dist/primitives/title/styles.css +63 -0
  37. package/dist/primitives/title/types.d.ts +18 -0
  38. package/dist/primitives/title/types.js +0 -0
  39. package/dist/ticket-order-card/index.d.ts +20 -1
  40. package/dist/types.d.ts +1 -0
  41. package/package.json +6 -1
  42. package/dist/components/action-bar/index.d.ts +0 -31
  43. package/dist/components/action-bar/index.js +0 -15
  44. package/dist/components/action-bar/styles.css +0 -27
  45. package/dist/components/title-bar/index.d.ts +0 -11
  46. package/dist/components/title-bar/index.js +0 -33
  47. package/dist/components/title-bar/styles.css +0 -66
@@ -0,0 +1,18 @@
1
+ import { useThemeClassName } from "@byted-doubao-apps/components";
2
+ import { clsx } from "clsx";
3
+ import { TemplateChevronRightIcon } from "../../components/chevron-right-icon/index.js";
4
+ import "./styles.css";
5
+ function Title({ text: text1, maxLines = 1, showArrow = true, loading = false, className, style }) {
6
+ const themedClassName = useThemeClassName(className);
7
+ return <view className={clsx('doubao-title', `doubao-title--lines-${maxLines}`, {
8
+ 'doubao-title--loading': loading
9
+ }, themedClassName)} style={style}>
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
+ </>}
16
+ </view>;
17
+ }
18
+ export { Title };
@@ -0,0 +1,63 @@
1
+ .doubao-title {
2
+ min-width: 0;
3
+ max-width: 100%;
4
+ color: var(--neutral-100);
5
+ flex-direction: row;
6
+ align-items: flex-end;
7
+ gap: 2px;
8
+ font-family: PingFang SC, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, sans-serif;
9
+ font-style: normal;
10
+ display: flex;
11
+ }
12
+
13
+ .doubao-title--loading {
14
+ align-items: center;
15
+ width: 100%;
16
+ height: 24px;
17
+ }
18
+
19
+ .doubao-title__text {
20
+ min-width: 0;
21
+ color: var(--neutral-100);
22
+ text-overflow: ellipsis;
23
+ flex: 0 auto;
24
+ font-family: PingFang SC, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, sans-serif;
25
+ font-size: 16px;
26
+ font-style: normal;
27
+ font-weight: 500;
28
+ line-height: 24px;
29
+ display: block;
30
+ overflow: hidden;
31
+ }
32
+
33
+ .doubao-title--lines-1 .doubao-title__text {
34
+ white-space: nowrap;
35
+ }
36
+
37
+ .doubao-title__arrow {
38
+ flex-shrink: 0;
39
+ width: 12px;
40
+ height: 12px;
41
+ margin-bottom: 6px;
42
+ }
43
+
44
+ .doubao-title__placeholder {
45
+ background-image: linear-gradient(90deg, #f7f7f7 0%, #e6e6e6 30%, #f7f7f7 100%);
46
+ background-size: 200% 100%;
47
+ border-radius: 4px;
48
+ width: 100%;
49
+ max-width: 40%;
50
+ height: 16px;
51
+ animation: 1.4s ease-in-out infinite doubao-title-placeholder-shimmer;
52
+ }
53
+
54
+ @keyframes doubao-title-placeholder-shimmer {
55
+ 0% {
56
+ background-position: 100% 0;
57
+ }
58
+
59
+ 100% {
60
+ background-position: -100% 0;
61
+ }
62
+ }
63
+
@@ -0,0 +1,18 @@
1
+ import type { CSSProperties } from '@lynx-js/types';
2
+ export type TitleValue = string | number;
3
+ export type TitleMaxLines = 1 | 2;
4
+ export interface TitleProps {
5
+ /** 标题内容。 */
6
+ text: TitleValue;
7
+ /** 标题最多展示行数。@defaultValue 1 */
8
+ maxLines?: TitleMaxLines;
9
+ /** 是否展示右侧箭头。@defaultValue true */
10
+ showArrow?: boolean;
11
+ /** 是否展示标题占位骨架。@defaultValue false */
12
+ loading?: boolean;
13
+ /** 组件类名。 */
14
+ className?: string;
15
+ /** 组件样式。 */
16
+ style?: CSSProperties;
17
+ }
18
+ //# sourceMappingURL=types.d.ts.map
File without changes
@@ -2,8 +2,11 @@ import type { CSSProperties, TouchEvent } from '@lynx-js/types';
2
2
  import type { ReactElement, ReactNode } from 'react';
3
3
  import { type TemplateCardFooterProps } from '../components/footer/index.js';
4
4
  import { type TemplateCardHeaderProps } from '../components/header/index.js';
5
- import type { TemplateKey, TemplateText } from '../types.js';
5
+ import type { TemplateKey, TemplateTagTone, TemplateText } from '../types.js';
6
6
  import './styles.scss';
7
+ /**
8
+ * @deprecated 请使用 `CheckoutCardProps`。
9
+ */
7
10
  export interface TicketOrderCardProps {
8
11
  /** 标题栏配置。 */
9
12
  header?: TemplateCardHeaderProps;
@@ -28,6 +31,9 @@ export interface TicketOrderCardProps {
28
31
  /** 点击卡片根节点时触发。 */
29
32
  onClick?: (event: TouchEvent) => void;
30
33
  }
34
+ /**
35
+ * @deprecated 请使用 `CheckoutCardProductItem`。
36
+ */
31
37
  export interface TicketOrderCardRouteItem {
32
38
  /** 航程项唯一标识;不传时使用数组下标。 */
33
39
  key?: TemplateKey;
@@ -35,11 +41,18 @@ export interface TicketOrderCardRouteItem {
35
41
  title?: TemplateText;
36
42
  /** 航程描述,例如「6月1日 周六 20:50-23:50 CZ0000 经济舱」。 */
37
43
  description?: TemplateText;
44
+ /** 航程标题前的标签文案。 */
45
+ tagText?: TemplateText;
46
+ /** 航程标题标签的色调。 */
47
+ tagTone?: TemplateTagTone;
38
48
  /** 是否展示标题右侧箭头。 */
39
49
  showChevron?: boolean;
40
50
  /** 点击航程项时触发。 */
41
51
  onClick?: (event: TouchEvent) => void;
42
52
  }
53
+ /**
54
+ * @deprecated 请使用 `CheckoutCardInfoItem`。
55
+ */
43
56
  export interface TicketOrderCardInfoItem {
44
57
  /** 信息项唯一标识;不传时使用数组下标。 */
45
58
  key?: TemplateKey;
@@ -56,6 +69,9 @@ export interface TicketOrderCardInfoItem {
56
69
  /** 信息项补充内容块内容;优先级高于 valueExtra。 */
57
70
  valueExtraContent?: ReactNode;
58
71
  }
72
+ /**
73
+ * @deprecated 请使用 `CheckoutCardFeeItem`。
74
+ */
59
75
  export interface TicketOrderCardFeeItem {
60
76
  /** 费用项唯一标识;不传时使用数组下标。 */
61
77
  key?: TemplateKey;
@@ -66,5 +82,8 @@ export interface TicketOrderCardFeeItem {
66
82
  /** 费用项自定义内容;优先级高于 label 和 value。 */
67
83
  content?: ReactNode;
68
84
  }
85
+ /**
86
+ * @deprecated 请使用 `CheckoutCard`。
87
+ */
69
88
  export declare function TicketOrderCard(props: TicketOrderCardProps): ReactElement;
70
89
  //# sourceMappingURL=index.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export type TemplateKey = string | number;
2
2
  export type TemplateText = string | number;
3
+ export type TemplateTagTone = 'default' | 'highlight';
3
4
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/template",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -8,6 +8,11 @@
8
8
  "import": "./dist/index.js",
9
9
  "require": "./dist/index.js"
10
10
  },
11
+ "./primitives": {
12
+ "types": "./dist/primitives/index.d.ts",
13
+ "import": "./dist/primitives/index.js",
14
+ "require": "./dist/primitives/index.js"
15
+ },
11
16
  "./package.json": "./package.json"
12
17
  },
13
18
  "types": "./dist/index.d.ts",
@@ -1,31 +0,0 @@
1
- import type { CSSProperties, TouchEvent } from '@lynx-js/types';
2
- import type { ReactElement } from 'react';
3
- import './styles.scss';
4
- export interface TemplateActionButtonProps {
5
- /** 是否禁用。 */
6
- disabled?: boolean;
7
- /** 是否显示加载状态。 */
8
- loading?: boolean;
9
- /** onClick 的节流时间,单位为毫秒。 */
10
- throttle?: number;
11
- }
12
- export interface TemplateActionBarProps {
13
- /** 操作区根节点自定义类名。 */
14
- className?: string;
15
- /** 操作区根节点自定义样式。 */
16
- style?: CSSProperties;
17
- /** 主按钮文案。 */
18
- primaryActionText?: string;
19
- /** 主按钮配置,支持禁用、加载和点击节流。 */
20
- primaryActionButtonProps?: TemplateActionButtonProps;
21
- /** 次按钮文案。 */
22
- secondaryActionText?: string;
23
- /** 次按钮配置,支持禁用、加载和点击节流。 */
24
- secondaryActionButtonProps?: TemplateActionButtonProps;
25
- /** 点击主按钮时触发。 */
26
- onPrimaryActionClick?: (event?: TouchEvent) => void;
27
- /** 点击次按钮时触发。 */
28
- onSecondaryActionClick?: (event?: TouchEvent) => void;
29
- }
30
- export declare function TemplateActionBar(props: TemplateActionBarProps): ReactElement | null;
31
- //# sourceMappingURL=index.d.ts.map
@@ -1,15 +0,0 @@
1
- import { Button } from "@byted-doubao-apps/components";
2
- import { clsx } from "clsx";
3
- import "./styles.css";
4
- function TemplateActionBar(props) {
5
- const { className, style, primaryActionText, primaryActionButtonProps, secondaryActionText, secondaryActionButtonProps, onPrimaryActionClick, onSecondaryActionClick } = props;
6
- const hasPrimaryAction = null != primaryActionText && primaryActionText.length > 0;
7
- const hasSecondaryAction = null != secondaryActionText && secondaryActionText.length > 0;
8
- const hasDefaultActions = hasPrimaryAction || hasSecondaryAction;
9
- if (!hasDefaultActions) return null;
10
- return <view className={clsx('doubao-template-action-bar', className)} style={style}>
11
- {hasSecondaryAction ? <Button className="doubao-template-action-bar__action" type="default" text={secondaryActionText} {...secondaryActionButtonProps} onClick={onSecondaryActionClick}/> : null}
12
- {hasPrimaryAction ? <Button className="doubao-template-action-bar__action" type="primary" text={primaryActionText} {...primaryActionButtonProps} onClick={onPrimaryActionClick}/> : null}
13
- </view>;
14
- }
15
- export { TemplateActionBar };
@@ -1,27 +0,0 @@
1
- .doubao-template-action-bar {
2
- box-sizing: border-box;
3
- flex-direction: row;
4
- width: 100%;
5
- padding: 8px 12px 12px;
6
- display: flex;
7
- }
8
-
9
- .doubao-template-action-bar__action {
10
- --doubao-button-border-radius: 8px;
11
- --doubao-button-default-border-radius: 8px;
12
- --doubao-button-default-height: 44px;
13
- --doubao-button-default-padding-x: 12px;
14
- --doubao-button-default-padding-y: 0;
15
- --doubao-button-default-font-size: 16px;
16
- --doubao-button-default-line-height: 22px;
17
- border-radius: 8px;
18
- flex: 1 1 0;
19
- width: auto;
20
- min-width: 0;
21
- height: 44px;
22
- }
23
-
24
- .doubao-template-action-bar__action + .doubao-template-action-bar__action {
25
- margin-left: 10px;
26
- }
27
-
@@ -1,11 +0,0 @@
1
- import type { TouchEvent } from '@lynx-js/types';
2
- import type { ReactElement } from 'react';
3
- import './styles.scss';
4
- export interface TemplateTitleBarProps {
5
- moreText?: string;
6
- showMore?: boolean;
7
- reserveMore?: boolean;
8
- onMoreClick?: (event: TouchEvent) => void;
9
- }
10
- export declare function TemplateTitleBar(props: TemplateTitleBarProps): ReactElement;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1,33 +0,0 @@
1
- import { getAppInfo } from "../../utils/app-info.js";
2
- import { TemplateChevronRightIcon } from "../chevron-right-icon/index.js";
3
- import "./styles.css";
4
- function TemplateTitleBarIcon({ appIconSrc }) {
5
- if (null != appIconSrc && appIconSrc.length > 0) return <image className="doubao-template-title-bar__app-icon" src={appIconSrc} mode="aspectFill"/>;
6
- return <view className="doubao-template-title-bar__app-icon"/>;
7
- }
8
- function TemplateTitleBar(props) {
9
- const { moreText, showMore = true, reserveMore = false, onMoreClick } = props;
10
- const appInfo = getAppInfo();
11
- const hasMore = showMore && null != moreText && moreText.length > 0;
12
- return <view className="doubao-template-title-bar">
13
- <view className="doubao-template-title-bar__app">
14
- <TemplateTitleBarIcon appIconSrc={appInfo.appIconSrc}/>
15
- <text className="doubao-template-title-bar__app-name" text-maxline="1">
16
- {appInfo.appName}
17
- </text>
18
- </view>
19
- {hasMore ? <view className="doubao-template-title-bar__more" catchtap={onMoreClick}>
20
- <text className="doubao-template-title-bar__more-text" text-maxline="1">
21
- {moreText}
22
- </text>
23
- <TemplateChevronRightIcon className="doubao-template-title-bar__more-chevron"/>
24
- </view> : null}
25
- {!hasMore && reserveMore ? <view className="doubao-template-title-bar__more-placeholder">
26
- <text className="doubao-template-title-bar__more-text" text-maxline="1">
27
- 更多
28
- </text>
29
- <TemplateChevronRightIcon className="doubao-template-title-bar__more-chevron"/>
30
- </view> : null}
31
- </view>;
32
- }
33
- export { TemplateTitleBar };
@@ -1,66 +0,0 @@
1
- .doubao-template-title-bar {
2
- box-sizing: border-box;
3
- border-bottom: .5px solid var(--neutral-transparent-1);
4
- flex-direction: row;
5
- justify-content: space-between;
6
- align-items: center;
7
- width: 100%;
8
- height: 40px;
9
- padding: 12px;
10
- display: flex;
11
- }
12
-
13
- .doubao-template-title-bar__app {
14
- flex-direction: row;
15
- align-items: center;
16
- display: flex;
17
- }
18
-
19
- .doubao-template-title-bar__app-icon {
20
- border-radius: 4px;
21
- flex-shrink: 0;
22
- width: 16px;
23
- height: 16px;
24
- overflow: hidden;
25
- }
26
-
27
- .doubao-template-title-bar__app-name, .doubao-template-title-bar__more-text {
28
- color: var(--neutral-50);
29
- text-overflow: ellipsis;
30
- white-space: nowrap;
31
- font-family: PingFang SC, sans-serif;
32
- font-size: 12px;
33
- font-style: normal;
34
- line-height: 18px;
35
- overflow: hidden;
36
- }
37
-
38
- .doubao-template-title-bar__app-name {
39
- margin-left: 6px;
40
- font-weight: 500;
41
- }
42
-
43
- .doubao-template-title-bar__more, .doubao-template-title-bar__more-placeholder {
44
- flex-direction: row;
45
- flex-shrink: 0;
46
- justify-content: flex-end;
47
- align-items: center;
48
- min-width: 62.5px;
49
- display: flex;
50
- }
51
-
52
- .doubao-template-title-bar__more-placeholder {
53
- opacity: 0;
54
- }
55
-
56
- .doubao-template-title-bar__more-text {
57
- font-weight: 400;
58
- }
59
-
60
- .doubao-template-title-bar__more-chevron {
61
- flex-shrink: 0;
62
- width: 12px;
63
- height: 12px;
64
- margin-left: 2px;
65
- }
66
-