@zerodep-dev/vue-tsx-pro-mobile 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -2
  3. package/dist/area/data.d.ts +10 -0
  4. package/dist/area/data.js +3899 -0
  5. package/dist/area/data.js.map +1 -0
  6. package/dist/area/index.d.ts +22 -0
  7. package/dist/area/index.js +41 -0
  8. package/dist/area/index.js.map +1 -0
  9. package/dist/base/Button.d.ts +170 -0
  10. package/dist/base/Button.js +537 -0
  11. package/dist/base/Button.js.map +1 -0
  12. package/dist/base/Icon.d.ts +38 -0
  13. package/dist/base/Icon.js +65 -0
  14. package/dist/base/Icon.js.map +1 -0
  15. package/dist/capability/PrivacyPrompt.d.ts +1 -0
  16. package/dist/capability/PrivacyPrompt.js +73 -0
  17. package/dist/capability/PrivacyPrompt.js.map +1 -0
  18. package/dist/capability/types.d.ts +92 -0
  19. package/dist/capability/usePermission.d.ts +23 -0
  20. package/dist/capability/usePermission.js +52 -0
  21. package/dist/capability/usePermission.js.map +1 -0
  22. package/dist/capability/useStorage.d.ts +8 -0
  23. package/dist/capability/useStorage.js +19 -0
  24. package/dist/capability/useStorage.js.map +1 -0
  25. package/dist/capability/web.d.ts +18 -0
  26. package/dist/capability/web.js +109 -0
  27. package/dist/capability/web.js.map +1 -0
  28. package/dist/capacitor/index.d.ts +9 -0
  29. package/dist/capacitor/index.js +143 -0
  30. package/dist/capacitor/index.js.map +1 -0
  31. package/dist/config/ConfigProvider.d.ts +37 -0
  32. package/dist/config/ConfigProvider.js +64 -0
  33. package/dist/config/ConfigProvider.js.map +1 -0
  34. package/dist/config/context.d.ts +16 -0
  35. package/dist/config/context.js +20 -0
  36. package/dist/config/context.js.map +1 -0
  37. package/dist/config/lang.d.ts +85 -0
  38. package/dist/config/lang.js +138 -0
  39. package/dist/config/lang.js.map +1 -0
  40. package/dist/display/Badge.d.ts +39 -0
  41. package/dist/display/Badge.js +108 -0
  42. package/dist/display/Badge.js.map +1 -0
  43. package/dist/display/Cell.d.ts +92 -0
  44. package/dist/display/Cell.js +204 -0
  45. package/dist/display/Cell.js.map +1 -0
  46. package/dist/display/Collapse.d.ts +47 -0
  47. package/dist/display/Collapse.js +173 -0
  48. package/dist/display/Collapse.js.map +1 -0
  49. package/dist/display/Empty.d.ts +42 -0
  50. package/dist/display/Empty.js +79 -0
  51. package/dist/display/Empty.js.map +1 -0
  52. package/dist/display/Grid.d.ts +49 -0
  53. package/dist/display/Grid.js +136 -0
  54. package/dist/display/Grid.js.map +1 -0
  55. package/dist/display/Image.d.ts +70 -0
  56. package/dist/display/Image.js +138 -0
  57. package/dist/display/Image.js.map +1 -0
  58. package/dist/display/IndexBar.d.ts +34 -0
  59. package/dist/display/IndexBar.js +158 -0
  60. package/dist/display/IndexBar.js.map +1 -0
  61. package/dist/display/List.d.ts +34 -0
  62. package/dist/display/List.js +105 -0
  63. package/dist/display/List.js.map +1 -0
  64. package/dist/display/NoticeBar.d.ts +57 -0
  65. package/dist/display/NoticeBar.js +172 -0
  66. package/dist/display/NoticeBar.js.map +1 -0
  67. package/dist/display/Steps.d.ts +59 -0
  68. package/dist/display/Steps.js +158 -0
  69. package/dist/display/Steps.js.map +1 -0
  70. package/dist/display/SwipeCell.d.ts +37 -0
  71. package/dist/display/SwipeCell.js +147 -0
  72. package/dist/display/SwipeCell.js.map +1 -0
  73. package/dist/display/Swiper.d.ts +47 -0
  74. package/dist/display/Swiper.js +173 -0
  75. package/dist/display/Swiper.js.map +1 -0
  76. package/dist/display/Tag.d.ts +99 -0
  77. package/dist/display/Tag.js +320 -0
  78. package/dist/display/Tag.js.map +1 -0
  79. package/dist/feedback/Dialog.d.ts +79 -0
  80. package/dist/feedback/Dialog.js +186 -0
  81. package/dist/feedback/Dialog.js.map +1 -0
  82. package/dist/feedback/FeedbackOutlet.d.ts +2 -0
  83. package/dist/feedback/FeedbackOutlet.js +31 -0
  84. package/dist/feedback/FeedbackOutlet.js.map +1 -0
  85. package/dist/feedback/Loading.d.ts +26 -0
  86. package/dist/feedback/Loading.js +68 -0
  87. package/dist/feedback/Loading.js.map +1 -0
  88. package/dist/feedback/Notify.d.ts +48 -0
  89. package/dist/feedback/Notify.js +116 -0
  90. package/dist/feedback/Notify.js.map +1 -0
  91. package/dist/feedback/PullRefresh.d.ts +58 -0
  92. package/dist/feedback/PullRefresh.js +178 -0
  93. package/dist/feedback/PullRefresh.js.map +1 -0
  94. package/dist/feedback/Skeleton.d.ts +56 -0
  95. package/dist/feedback/Skeleton.js +99 -0
  96. package/dist/feedback/Skeleton.js.map +1 -0
  97. package/dist/feedback/Toast.d.ts +89 -0
  98. package/dist/feedback/Toast.js +186 -0
  99. package/dist/feedback/Toast.js.map +1 -0
  100. package/dist/form/Checkbox.d.ts +52 -0
  101. package/dist/form/Checkbox.js +107 -0
  102. package/dist/form/Checkbox.js.map +1 -0
  103. package/dist/form/Field.d.ts +91 -0
  104. package/dist/form/Field.js +296 -0
  105. package/dist/form/Field.js.map +1 -0
  106. package/dist/form/Form.d.ts +50 -0
  107. package/dist/form/Form.js +96 -0
  108. package/dist/form/Form.js.map +1 -0
  109. package/dist/form/FormItem.d.ts +57 -0
  110. package/dist/form/FormItem.js +142 -0
  111. package/dist/form/FormItem.js.map +1 -0
  112. package/dist/form/Radio.d.ts +41 -0
  113. package/dist/form/Radio.js +85 -0
  114. package/dist/form/Radio.js.map +1 -0
  115. package/dist/form/Rate.d.ts +45 -0
  116. package/dist/form/Rate.js +162 -0
  117. package/dist/form/Rate.js.map +1 -0
  118. package/dist/form/Search.d.ts +50 -0
  119. package/dist/form/Search.js +152 -0
  120. package/dist/form/Search.js.map +1 -0
  121. package/dist/form/Slider.d.ts +43 -0
  122. package/dist/form/Slider.js +213 -0
  123. package/dist/form/Slider.js.map +1 -0
  124. package/dist/form/Stepper.d.ts +61 -0
  125. package/dist/form/Stepper.js +222 -0
  126. package/dist/form/Stepper.js.map +1 -0
  127. package/dist/form/Switch.d.ts +33 -0
  128. package/dist/form/Switch.js +116 -0
  129. package/dist/form/Switch.js.map +1 -0
  130. package/dist/form/Uploader.d.ts +67 -0
  131. package/dist/form/Uploader.js +207 -0
  132. package/dist/form/Uploader.js.map +1 -0
  133. package/dist/form/choice.d.ts +42 -0
  134. package/dist/form/choice.js +109 -0
  135. package/dist/form/choice.js.map +1 -0
  136. package/dist/form/context.d.ts +83 -0
  137. package/dist/form/context.js +89 -0
  138. package/dist/form/context.js.map +1 -0
  139. package/dist/index.d.ts +66 -0
  140. package/dist/index.js +59 -0
  141. package/dist/layout/Divider.d.ts +34 -0
  142. package/dist/layout/Divider.js +55 -0
  143. package/dist/layout/Divider.js.map +1 -0
  144. package/dist/layout/Space.d.ts +66 -0
  145. package/dist/layout/Space.js +65 -0
  146. package/dist/layout/Space.js.map +1 -0
  147. package/dist/navigation/BackTop.d.ts +29 -0
  148. package/dist/navigation/BackTop.js +89 -0
  149. package/dist/navigation/BackTop.js.map +1 -0
  150. package/dist/navigation/NavBar.d.ts +46 -0
  151. package/dist/navigation/NavBar.js +141 -0
  152. package/dist/navigation/NavBar.js.map +1 -0
  153. package/dist/navigation/Sticky.d.ts +19 -0
  154. package/dist/navigation/Sticky.js +28 -0
  155. package/dist/navigation/Sticky.js.map +1 -0
  156. package/dist/navigation/TabBar.d.ts +54 -0
  157. package/dist/navigation/TabBar.js +138 -0
  158. package/dist/navigation/TabBar.js.map +1 -0
  159. package/dist/navigation/Tabs.d.ts +45 -0
  160. package/dist/navigation/Tabs.js +206 -0
  161. package/dist/navigation/Tabs.js.map +1 -0
  162. package/dist/overlay/ActionSheet.d.ts +80 -0
  163. package/dist/overlay/ActionSheet.js +164 -0
  164. package/dist/overlay/ActionSheet.js.map +1 -0
  165. package/dist/overlay/Overlay.d.ts +35 -0
  166. package/dist/overlay/Overlay.js +85 -0
  167. package/dist/overlay/Overlay.js.map +1 -0
  168. package/dist/overlay/Popup.d.ts +76 -0
  169. package/dist/overlay/Popup.js +191 -0
  170. package/dist/overlay/Popup.js.map +1 -0
  171. package/dist/picker/Calendar.d.ts +69 -0
  172. package/dist/picker/Calendar.js +213 -0
  173. package/dist/picker/Calendar.js.map +1 -0
  174. package/dist/picker/Cascader.d.ts +50 -0
  175. package/dist/picker/Cascader.js +199 -0
  176. package/dist/picker/Cascader.js.map +1 -0
  177. package/dist/picker/DatePicker.d.ts +52 -0
  178. package/dist/picker/DatePicker.js +135 -0
  179. package/dist/picker/DatePicker.js.map +1 -0
  180. package/dist/picker/DropdownMenu.d.ts +39 -0
  181. package/dist/picker/DropdownMenu.js +242 -0
  182. package/dist/picker/DropdownMenu.js.map +1 -0
  183. package/dist/picker/Picker.d.ts +67 -0
  184. package/dist/picker/Picker.js +185 -0
  185. package/dist/picker/Picker.js.map +1 -0
  186. package/dist/picker/PickerColumn.d.ts +36 -0
  187. package/dist/picker/PickerColumn.js +175 -0
  188. package/dist/picker/PickerColumn.js.map +1 -0
  189. package/dist/theme/dark.d.ts +121 -0
  190. package/dist/theme/dark.js +77 -0
  191. package/dist/theme/dark.js.map +1 -0
  192. package/dist/theme/divider.d.ts +6 -0
  193. package/dist/theme/divider.js +18 -0
  194. package/dist/theme/divider.js.map +1 -0
  195. package/dist/theme/token-names.d.ts +1389 -0
  196. package/dist/theme/tokens.d.ts +549 -0
  197. package/dist/theme/tokens.js +312 -0
  198. package/dist/theme/tokens.js.map +1 -0
  199. package/dist/utils/host.d.ts +97 -0
  200. package/dist/utils/host.js +98 -0
  201. package/dist/utils/host.js.map +1 -0
  202. package/dist/utils/presence.d.ts +11 -0
  203. package/dist/utils/presence.js +34 -0
  204. package/dist/utils/presence.js.map +1 -0
  205. package/dist/utils/props.d.ts +38 -0
  206. package/dist/utils/props.js +115 -0
  207. package/dist/utils/props.js.map +1 -0
  208. package/dist/utils/scales.d.ts +48 -0
  209. package/package.json +106 -3
@@ -0,0 +1,170 @@
1
+ import { css } from '@zerodep-dev/vue-tsx-pro-tsx/styles';
2
+ import type { VNodeChild } from 'vue';
3
+ import { type LoadingProps } from '../feedback/Loading';
4
+ import { type PartProps } from '../utils/props';
5
+ import type { MobileRadius, MobileSize, MobileTone } from '../utils/scales';
6
+ import { type IconData, type IconProps } from './Icon';
7
+ /** 按钮样式 */
8
+ export interface ButtonVariants {
9
+ /** 实底:一组操作里的主要操作 */
10
+ solid: unknown;
11
+ /** 浅色底:次要但仍需突出的操作 */
12
+ soft: unknown;
13
+ /** 描边:次要操作 */
14
+ outline: unknown;
15
+ /** 无底无边,按下时才有底色:导航栏、列表里的文字按钮 */
16
+ ghost: unknown;
17
+ }
18
+ /** 状态与语义属性由组件管理 */
19
+ export type ButtonManaged = 'disabled' | 'aria-busy' | 'aria-disabled';
20
+ /**
21
+ * 小程序按钮的开放能力(原生 button 的 open-type),H5 里不起作用:
22
+ * getPhoneNumber 手机号、chooseAvatar 选头像、agreePrivacyAuthorization 同意隐私协议、share 转发、contact 客服、
23
+ * openSetting 设置页(以上是微信);getAuthorize 授权(支付宝,配合 authScope)
24
+ */
25
+ export type ButtonOpenType = 'getPhoneNumber' | 'chooseAvatar' | 'agreePrivacyAuthorization' | 'share' | 'contact' | 'openSetting' | 'getAuthorize';
26
+ /** 未声明的属性落到 button 上 */
27
+ export interface ButtonProps extends PartProps<'button', ButtonManaged> {
28
+ /**
29
+ * 样式
30
+ * @default 'solid'
31
+ */
32
+ variant?: keyof ButtonVariants;
33
+ /**
34
+ * 色调
35
+ * @default 'accent'
36
+ */
37
+ tone?: MobileTone;
38
+ /**
39
+ * 尺寸
40
+ * @default 'md'
41
+ */
42
+ size?: MobileSize;
43
+ /**
44
+ * 圆角
45
+ * @default 'md'
46
+ */
47
+ radius?: MobileRadius;
48
+ /** 占满容器宽度 */
49
+ fullWidth?: boolean;
50
+ /** 不可用 */
51
+ disabled?: boolean;
52
+ /** 加载中:图标换成旋转指示,不响应点击 */
53
+ loading?: boolean;
54
+ /** 加载中显示的文字;不给时保留原来的文字 */
55
+ loadingText?: VNodeChild;
56
+ /** 文字前的图标 */
57
+ icon?: IconData;
58
+ /** 文字后的图标 */
59
+ iconEnd?: IconData;
60
+ /** 小程序的开放能力:只能由用户点这个按钮触发的平台能力(手机号、头像、隐私协议同意……) */
61
+ openType?: ButtonOpenType;
62
+ /** 支付宝 getAuthorize 的授权范围:phoneNumber 手机号、userInfo 会员基础信息 */
63
+ authScope?: 'phoneNumber' | 'userInfo';
64
+ /** 开放能力的结果(平台事件的 detail):手机号交给 useHost().phoneNumber 换凭证,头像的 detail.avatarUrl 是临时路径 */
65
+ onOpenType?: (detail: unknown) => void;
66
+ /** 按钮文字 */
67
+ children?: VNodeChild;
68
+ /** 内容层(包着图标与文字的 span)的部件属性 */
69
+ propsContent?: PartProps<'span'>;
70
+ /** 前置图标的部件属性 */
71
+ propsIcon?: Partial<IconProps>;
72
+ /** 后置图标的部件属性 */
73
+ propsIconEnd?: Partial<IconProps>;
74
+ /** 加载指示的部件属性 */
75
+ propsLoading?: Partial<LoadingProps>;
76
+ }
77
+ /** Button 的部件 */
78
+ export type ButtonPart = 'root' | 'content' | 'icon';
79
+ /** Button 的配方:样式 × 色调 × 尺寸 × 圆角 */
80
+ export declare const buttonRecipe: css.Recipe<"content" | "icon" | "root", {
81
+ readonly size: {
82
+ readonly xs: {
83
+ readonly root: {
84
+ readonly fontSize: "_xs";
85
+ readonly minHeight: "2em";
86
+ readonly paddingInline: "_sm";
87
+ };
88
+ };
89
+ readonly sm: {
90
+ readonly root: {
91
+ readonly fontSize: "_md";
92
+ readonly minHeight: "2.3em";
93
+ readonly paddingInline: "_md";
94
+ };
95
+ };
96
+ readonly md: {
97
+ readonly root: {
98
+ readonly fontSize: "_lg";
99
+ readonly minHeight: "_control";
100
+ readonly paddingInline: "_lg";
101
+ };
102
+ };
103
+ readonly lg: {
104
+ readonly root: {
105
+ readonly fontSize: "_lg";
106
+ readonly minHeight: "3.125em";
107
+ readonly paddingInline: "_xl";
108
+ };
109
+ };
110
+ };
111
+ readonly radius: {
112
+ readonly none: {
113
+ readonly root: {
114
+ readonly borderRadius: "_none";
115
+ };
116
+ };
117
+ readonly sm: {
118
+ readonly root: {
119
+ readonly borderRadius: "_sm";
120
+ };
121
+ };
122
+ readonly md: {
123
+ readonly root: {
124
+ readonly borderRadius: "_md";
125
+ };
126
+ };
127
+ readonly lg: {
128
+ readonly root: {
129
+ readonly borderRadius: "_lg";
130
+ };
131
+ };
132
+ readonly full: {
133
+ readonly root: {
134
+ readonly borderRadius: "_full";
135
+ };
136
+ };
137
+ };
138
+ readonly fullWidth: {
139
+ readonly true: {
140
+ readonly root: {
141
+ readonly display: "flex";
142
+ readonly width: "100%";
143
+ };
144
+ };
145
+ };
146
+ readonly variant: {
147
+ readonly solid: {};
148
+ readonly soft: {};
149
+ readonly outline: {
150
+ readonly root: {
151
+ readonly backgroundColor: "_surface";
152
+ };
153
+ };
154
+ readonly ghost: {
155
+ readonly root: {
156
+ readonly backgroundColor: "transparent";
157
+ };
158
+ };
159
+ };
160
+ readonly tone: {
161
+ accent: {};
162
+ neutral: {};
163
+ danger: {};
164
+ success: {};
165
+ warning: {};
166
+ info: {};
167
+ };
168
+ }>;
169
+ /** 按钮(button > span 内容) */
170
+ export declare const Button: import("@zerodep-dev/vue-tsx-pro-tsx").TsxComponent<ButtonProps>;
@@ -0,0 +1,537 @@
1
+ import { dataAttrs, hasContent, mergeAttrs, mergePartProps } from "../utils/props.js";
2
+ import { Icon } from "./Icon.js";
3
+ import { Loading } from "../feedback/Loading.js";
4
+ import { isMiniProgram, useHost } from "../utils/host.js";
5
+ import { css } from "@zerodep-dev/vue-tsx-pro-tsx/styles";
6
+ import { _component, childrenProp, readonlyProp, restProps } from "@zerodep-dev/vue-tsx-pro-tsx";
7
+ import { createVNode } from "vue";
8
+ //#region src/base/Button.tsx
9
+ /** 按钮样式 */
10
+ /** 状态与语义属性由组件管理 */
11
+ /**
12
+ * 小程序按钮的开放能力(原生 button 的 open-type),H5 里不起作用:
13
+ * getPhoneNumber 手机号、chooseAvatar 选头像、agreePrivacyAuthorization 同意隐私协议、share 转发、contact 客服、
14
+ * openSetting 设置页(以上是微信);getAuthorize 授权(支付宝,配合 authScope)
15
+ */
16
+ /** 未声明的属性落到 button 上 */
17
+ /** Button 的部件 */
18
+ /** Button 的配方:样式 × 色调 × 尺寸 × 圆角 */
19
+ var buttonRecipe = css.recipe({
20
+ name: "Button",
21
+ parts: [
22
+ "root",
23
+ "content",
24
+ "icon"
25
+ ],
26
+ base: {
27
+ root: {
28
+ boxSizing: "border-box",
29
+ position: "relative",
30
+ display: "inline-flex",
31
+ alignItems: "center",
32
+ justifyContent: "center",
33
+ margin: 0,
34
+ borderWidth: "_xs",
35
+ borderStyle: "solid",
36
+ borderColor: "transparent",
37
+ fontFamily: "inherit",
38
+ fontWeight: "_medium",
39
+ lineHeight: "_tight",
40
+ whiteSpace: "nowrap",
41
+ textAlign: "center",
42
+ verticalAlign: "middle",
43
+ userSelect: "none",
44
+ cursor: {
45
+ default: "pointer",
46
+ _disabled: "not-allowed"
47
+ },
48
+ touchAction: "manipulation",
49
+ WebkitTapHighlightColor: "transparent",
50
+ opacity: {
51
+ default: 1,
52
+ "[data-disabled]": "_disabled"
53
+ },
54
+ transitionProperty: "background-color, border-color, color, opacity",
55
+ transitionDuration: "_xs",
56
+ transitionTimingFunction: "_standard"
57
+ },
58
+ content: {
59
+ display: "inline-flex",
60
+ alignItems: "center",
61
+ gap: "_xs"
62
+ },
63
+ icon: { fontSize: "1.15em" }
64
+ },
65
+ variants: {
66
+ size: {
67
+ xs: { root: {
68
+ fontSize: "_xs",
69
+ minHeight: "2em",
70
+ paddingInline: "_sm"
71
+ } },
72
+ sm: { root: {
73
+ fontSize: "_md",
74
+ minHeight: "2.3em",
75
+ paddingInline: "_md"
76
+ } },
77
+ md: { root: {
78
+ fontSize: "_lg",
79
+ minHeight: "_control",
80
+ paddingInline: "_lg"
81
+ } },
82
+ lg: { root: {
83
+ fontSize: "_lg",
84
+ minHeight: "3.125em",
85
+ paddingInline: "_xl"
86
+ } }
87
+ },
88
+ radius: {
89
+ none: { root: { borderRadius: "_none" } },
90
+ sm: { root: { borderRadius: "_sm" } },
91
+ md: { root: { borderRadius: "_md" } },
92
+ lg: { root: { borderRadius: "_lg" } },
93
+ full: { root: { borderRadius: "_full" } }
94
+ },
95
+ fullWidth: { true: { root: {
96
+ display: "flex",
97
+ width: "100%"
98
+ } } },
99
+ variant: {
100
+ solid: {},
101
+ soft: {},
102
+ outline: { root: { backgroundColor: "_surface" } },
103
+ ghost: { root: { backgroundColor: "transparent" } }
104
+ },
105
+ tone: {
106
+ accent: {},
107
+ neutral: {},
108
+ danger: {},
109
+ success: {},
110
+ warning: {},
111
+ info: {}
112
+ }
113
+ },
114
+ compound: [
115
+ {
116
+ when: {
117
+ variant: "solid",
118
+ tone: "accent"
119
+ },
120
+ root: {
121
+ color: "_accentContrast",
122
+ backgroundColor: {
123
+ default: "_accent",
124
+ ":active:not([data-disabled])": "_accentActive"
125
+ }
126
+ }
127
+ },
128
+ {
129
+ when: {
130
+ variant: "solid",
131
+ tone: "neutral"
132
+ },
133
+ root: {
134
+ color: "_inverseText",
135
+ backgroundColor: "_inverseSurface",
136
+ opacity: {
137
+ default: 1,
138
+ ":active:not([data-disabled])": .85,
139
+ "[data-disabled]": "_disabled"
140
+ }
141
+ }
142
+ },
143
+ {
144
+ when: {
145
+ variant: "solid",
146
+ tone: "danger"
147
+ },
148
+ root: {
149
+ color: "_dangerContrast",
150
+ backgroundColor: {
151
+ default: "_danger",
152
+ ":active:not([data-disabled])": "_dangerActive"
153
+ }
154
+ }
155
+ },
156
+ {
157
+ when: {
158
+ variant: "solid",
159
+ tone: "success"
160
+ },
161
+ root: {
162
+ color: "_successContrast",
163
+ backgroundColor: {
164
+ default: "_success",
165
+ ":active:not([data-disabled])": "_successActive"
166
+ }
167
+ }
168
+ },
169
+ {
170
+ when: {
171
+ variant: "solid",
172
+ tone: "warning"
173
+ },
174
+ root: {
175
+ color: "_warningContrast",
176
+ backgroundColor: {
177
+ default: "_warning",
178
+ ":active:not([data-disabled])": "_warningActive"
179
+ }
180
+ }
181
+ },
182
+ {
183
+ when: {
184
+ variant: "solid",
185
+ tone: "info"
186
+ },
187
+ root: {
188
+ color: "_infoContrast",
189
+ backgroundColor: {
190
+ default: "_info",
191
+ ":active:not([data-disabled])": "_infoActive"
192
+ }
193
+ }
194
+ },
195
+ {
196
+ when: {
197
+ variant: "soft",
198
+ tone: "accent"
199
+ },
200
+ root: {
201
+ color: "_accentText",
202
+ backgroundColor: {
203
+ default: "_accentSoft",
204
+ ":active:not([data-disabled])": "_accentSoftActive"
205
+ }
206
+ }
207
+ },
208
+ {
209
+ when: {
210
+ variant: "soft",
211
+ tone: "neutral"
212
+ },
213
+ root: {
214
+ color: "_text",
215
+ backgroundColor: {
216
+ default: "_fill",
217
+ ":active:not([data-disabled])": "_fillActive"
218
+ }
219
+ }
220
+ },
221
+ {
222
+ when: {
223
+ variant: "soft",
224
+ tone: "danger"
225
+ },
226
+ root: {
227
+ color: "_dangerText",
228
+ backgroundColor: {
229
+ default: "_dangerSoft",
230
+ ":active:not([data-disabled])": "_dangerSoftActive"
231
+ }
232
+ }
233
+ },
234
+ {
235
+ when: {
236
+ variant: "soft",
237
+ tone: "success"
238
+ },
239
+ root: {
240
+ color: "_successText",
241
+ backgroundColor: {
242
+ default: "_successSoft",
243
+ ":active:not([data-disabled])": "_successSoftActive"
244
+ }
245
+ }
246
+ },
247
+ {
248
+ when: {
249
+ variant: "soft",
250
+ tone: "warning"
251
+ },
252
+ root: {
253
+ color: "_warningText",
254
+ backgroundColor: {
255
+ default: "_warningSoft",
256
+ ":active:not([data-disabled])": "_warningSoftActive"
257
+ }
258
+ }
259
+ },
260
+ {
261
+ when: {
262
+ variant: "soft",
263
+ tone: "info"
264
+ },
265
+ root: {
266
+ color: "_infoText",
267
+ backgroundColor: {
268
+ default: "_infoSoft",
269
+ ":active:not([data-disabled])": "_infoSoftActive"
270
+ }
271
+ }
272
+ },
273
+ {
274
+ when: {
275
+ variant: "outline",
276
+ tone: "accent"
277
+ },
278
+ root: {
279
+ color: "_accentText",
280
+ borderColor: "_accent",
281
+ backgroundColor: {
282
+ default: "_surface",
283
+ ":active:not([data-disabled])": "_accentSoft"
284
+ }
285
+ }
286
+ },
287
+ {
288
+ when: {
289
+ variant: "outline",
290
+ tone: "neutral"
291
+ },
292
+ root: {
293
+ color: "_text",
294
+ borderColor: "_borderStrong",
295
+ backgroundColor: {
296
+ default: "_surface",
297
+ ":active:not([data-disabled])": "_fill"
298
+ }
299
+ }
300
+ },
301
+ {
302
+ when: {
303
+ variant: "outline",
304
+ tone: "danger"
305
+ },
306
+ root: {
307
+ color: "_dangerText",
308
+ borderColor: "_danger",
309
+ backgroundColor: {
310
+ default: "_surface",
311
+ ":active:not([data-disabled])": "_dangerSoft"
312
+ }
313
+ }
314
+ },
315
+ {
316
+ when: {
317
+ variant: "outline",
318
+ tone: "success"
319
+ },
320
+ root: {
321
+ color: "_successText",
322
+ borderColor: "_success",
323
+ backgroundColor: {
324
+ default: "_surface",
325
+ ":active:not([data-disabled])": "_successSoft"
326
+ }
327
+ }
328
+ },
329
+ {
330
+ when: {
331
+ variant: "outline",
332
+ tone: "warning"
333
+ },
334
+ root: {
335
+ color: "_warningText",
336
+ borderColor: "_warning",
337
+ backgroundColor: {
338
+ default: "_surface",
339
+ ":active:not([data-disabled])": "_warningSoft"
340
+ }
341
+ }
342
+ },
343
+ {
344
+ when: {
345
+ variant: "outline",
346
+ tone: "info"
347
+ },
348
+ root: {
349
+ color: "_infoText",
350
+ borderColor: "_info",
351
+ backgroundColor: {
352
+ default: "_surface",
353
+ ":active:not([data-disabled])": "_infoSoft"
354
+ }
355
+ }
356
+ },
357
+ {
358
+ when: {
359
+ variant: "ghost",
360
+ tone: "accent"
361
+ },
362
+ root: {
363
+ color: "_accentText",
364
+ backgroundColor: {
365
+ default: "transparent",
366
+ ":active:not([data-disabled])": "_accentSoft"
367
+ }
368
+ }
369
+ },
370
+ {
371
+ when: {
372
+ variant: "ghost",
373
+ tone: "neutral"
374
+ },
375
+ root: {
376
+ color: "_text",
377
+ backgroundColor: {
378
+ default: "transparent",
379
+ ":active:not([data-disabled])": "_fill"
380
+ }
381
+ }
382
+ },
383
+ {
384
+ when: {
385
+ variant: "ghost",
386
+ tone: "danger"
387
+ },
388
+ root: {
389
+ color: "_dangerText",
390
+ backgroundColor: {
391
+ default: "transparent",
392
+ ":active:not([data-disabled])": "_dangerSoft"
393
+ }
394
+ }
395
+ },
396
+ {
397
+ when: {
398
+ variant: "ghost",
399
+ tone: "success"
400
+ },
401
+ root: {
402
+ color: "_successText",
403
+ backgroundColor: {
404
+ default: "transparent",
405
+ ":active:not([data-disabled])": "_successSoft"
406
+ }
407
+ }
408
+ },
409
+ {
410
+ when: {
411
+ variant: "ghost",
412
+ tone: "warning"
413
+ },
414
+ root: {
415
+ color: "_warningText",
416
+ backgroundColor: {
417
+ default: "transparent",
418
+ ":active:not([data-disabled])": "_warningSoft"
419
+ }
420
+ }
421
+ },
422
+ {
423
+ when: {
424
+ variant: "ghost",
425
+ tone: "info"
426
+ },
427
+ root: {
428
+ color: "_infoText",
429
+ backgroundColor: {
430
+ default: "transparent",
431
+ ":active:not([data-disabled])": "_infoSoft"
432
+ }
433
+ }
434
+ }
435
+ ],
436
+ defaults: {
437
+ variant: "solid",
438
+ tone: "accent",
439
+ size: "md",
440
+ radius: "md"
441
+ }
442
+ });
443
+ /**
444
+ * 开放能力的属性:小程序运行时按 open-type 换成原生 button,平台事件统一成 opentype(mini 的 page.ts)。
445
+ * 这些不是 button 的 DOM 属性,H5 里不写
446
+ */
447
+ function openTypeAttrs(openType, scope, onOpenType) {
448
+ if (!openType) return {};
449
+ return {
450
+ "open-type": openType,
451
+ scope,
452
+ onOpentype: onOpenType && ((event) => onOpenType(event.detail))
453
+ };
454
+ }
455
+ /** 按钮(button > span 内容) */
456
+ var Button = /*#__PURE__*/ _component((_props, _ctx) => {
457
+ const variant = readonlyProp(_props, "variant");
458
+ const tone = readonlyProp(_props, "tone");
459
+ const size = readonlyProp(_props, "size");
460
+ const radius = readonlyProp(_props, "radius");
461
+ const fullWidth = readonlyProp(_props, "fullWidth", false);
462
+ const disabled = readonlyProp(_props, "disabled", false);
463
+ const loading = readonlyProp(_props, "loading", false);
464
+ const loadingText = readonlyProp(_props, "loadingText");
465
+ const icon = readonlyProp(_props, "icon");
466
+ const iconEnd = readonlyProp(_props, "iconEnd");
467
+ const children = childrenProp(_props);
468
+ const propsContent = readonlyProp(_props, "propsContent");
469
+ const propsIcon = readonlyProp(_props, "propsIcon");
470
+ const propsIconEnd = readonlyProp(_props, "propsIconEnd");
471
+ const propsLoading = readonlyProp(_props, "propsLoading");
472
+ const onClick = readonlyProp(_props, "onClick");
473
+ const openType = readonlyProp(_props, "openType");
474
+ const authScope = readonlyProp(_props, "authScope");
475
+ const onOpenType = readonlyProp(_props, "onOpenType");
476
+ const type = readonlyProp(_props, "type", "button");
477
+ const rest = restProps(_props, _ctx, false);
478
+ const mini = isMiniProgram(useHost());
479
+ return () => {
480
+ const s = buttonRecipe({
481
+ variant: variant.value,
482
+ tone: tone.value,
483
+ size: size.value,
484
+ radius: radius.value,
485
+ fullWidth: fullWidth.value
486
+ });
487
+ const busy = disabled.value || loading.value;
488
+ return createVNode("button", mergeAttrs({ sx: s.root }, rest, {
489
+ type: type.value,
490
+ disabled: disabled.value,
491
+ onClick: busy ? void 0 : onClick.value,
492
+ "aria-busy": loading.value || void 0,
493
+ ...mini ? openTypeAttrs(openType.value, authScope.value, onOpenType.value) : {},
494
+ ...dataAttrs({
495
+ "data-disabled": disabled.value || void 0,
496
+ "data-loading": loading.value || void 0
497
+ })
498
+ }), [createVNode("span", mergeAttrs({ sx: s.content }, propsContent.value), [
499
+ loading.value ? createVNode(Loading, mergePartProps({ sx: s.icon }, propsLoading.value), null) : icon.value && createVNode(Icon, mergePartProps({
500
+ icon: icon.value,
501
+ sx: s.icon
502
+ }, propsIcon.value), null),
503
+ loading.value && hasContent(loadingText.value) ? loadingText.value : children.value,
504
+ iconEnd.value && !loading.value && createVNode(Icon, mergePartProps({
505
+ icon: iconEnd.value,
506
+ sx: s.icon
507
+ }, propsIconEnd.value), null)
508
+ ])]);
509
+ };
510
+ }, {
511
+ name: "Button",
512
+ props: [
513
+ "variant",
514
+ "tone",
515
+ "size",
516
+ "radius",
517
+ "fullWidth",
518
+ "disabled",
519
+ "loading",
520
+ "loadingText",
521
+ "icon",
522
+ "iconEnd",
523
+ "propsContent",
524
+ "propsIcon",
525
+ "propsIconEnd",
526
+ "propsLoading",
527
+ "onClick",
528
+ "openType",
529
+ "authScope",
530
+ "onOpenType",
531
+ "type"
532
+ ]
533
+ });
534
+ //#endregion
535
+ export { Button, buttonRecipe };
536
+
537
+ //# sourceMappingURL=Button.js.map