huibo-ui 0.3.0 → 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 (668) hide show
  1. package/dist/cjs/{date-helpers-904747ff.js → date-helpers-1ffddc59.js} +7 -3
  2. package/dist/cjs/date-helpers-1ffddc59.js.map +1 -0
  3. package/dist/cjs/hb-affix.cjs.entry.js +1 -1
  4. package/dist/cjs/hb-aside.cjs.entry.js +1 -1
  5. package/dist/cjs/hb-avatar.cjs.entry.js +1 -1
  6. package/dist/cjs/hb-backtop.cjs.entry.js +2 -2
  7. package/dist/cjs/hb-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/hb-breadcrumb-item.cjs.entry.js +1 -1
  9. package/dist/cjs/hb-breadcrumb.cjs.entry.js +1 -1
  10. package/dist/cjs/hb-button.cjs.entry.js +2 -2
  11. package/dist/cjs/hb-calendar.cjs.entry.js +78 -10
  12. package/dist/cjs/hb-calendar.cjs.entry.js.map +1 -1
  13. package/dist/cjs/hb-card.cjs.entry.js +1 -1
  14. package/dist/cjs/hb-cascader.cjs.entry.js +270 -146
  15. package/dist/cjs/hb-cascader.cjs.entry.js.map +1 -1
  16. package/dist/cjs/hb-checkbox-group.cjs.entry.js +2 -2
  17. package/dist/cjs/hb-checkbox.cjs.entry.js +3 -3
  18. package/dist/cjs/hb-collapse-item.cjs.entry.js +1 -1
  19. package/dist/cjs/hb-collapse.cjs.entry.js +1 -1
  20. package/dist/cjs/hb-color-picker-panel.cjs.entry.js +2 -2
  21. package/dist/cjs/hb-color-picker.cjs.entry.js +91 -14
  22. package/dist/cjs/hb-color-picker.cjs.entry.js.map +1 -1
  23. package/dist/cjs/hb-config-provider.cjs.entry.js +1 -1
  24. package/dist/cjs/hb-container.cjs.entry.js +2 -2
  25. package/dist/cjs/hb-date-picker-pane.cjs.entry.js +2 -2
  26. package/dist/cjs/hb-date-picker.cjs.entry.js +85 -7
  27. package/dist/cjs/hb-date-picker.cjs.entry.js.map +1 -1
  28. package/dist/cjs/hb-date-range-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/hb-date-time-picker.cjs.entry.js +3 -3
  30. package/dist/cjs/hb-descriptions.cjs.entry.js +2 -2
  31. package/dist/cjs/hb-descriptions.cjs.entry.js.map +1 -1
  32. package/dist/cjs/hb-divider.cjs.entry.js +2 -2
  33. package/dist/cjs/hb-drawer.cjs.entry.js +1 -1
  34. package/dist/cjs/hb-dropdown.cjs.entry.js +74 -6
  35. package/dist/cjs/hb-dropdown.cjs.entry.js.map +1 -1
  36. package/dist/cjs/hb-empty.cjs.entry.js +1 -1
  37. package/dist/cjs/hb-float-button.cjs.entry.js +2 -2
  38. package/dist/cjs/hb-footer.cjs.entry.js +1 -1
  39. package/dist/cjs/hb-form-item.cjs.entry.js +59 -8
  40. package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
  41. package/dist/cjs/hb-form.cjs.entry.js +3 -3
  42. package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
  43. package/dist/cjs/hb-header.cjs.entry.js +1 -1
  44. package/dist/cjs/hb-image-preview.cjs.entry.js +12 -8
  45. package/dist/cjs/hb-image-preview.cjs.entry.js.map +1 -1
  46. package/dist/cjs/hb-image.cjs.entry.js +1 -1
  47. package/dist/cjs/hb-input-number.cjs.entry.js +5 -5
  48. package/dist/cjs/hb-input-tag.cjs.entry.js +2 -2
  49. package/dist/cjs/hb-input.cjs.entry.js +39 -3
  50. package/dist/cjs/hb-input.cjs.entry.js.map +1 -1
  51. package/dist/cjs/hb-layout.cjs.entry.js +36 -14
  52. package/dist/cjs/hb-layout.cjs.entry.js.map +1 -1
  53. package/dist/cjs/hb-link.cjs.entry.js +2 -2
  54. package/dist/cjs/hb-loading.cjs.entry.js +2 -2
  55. package/dist/cjs/hb-main.cjs.entry.js +1 -1
  56. package/dist/cjs/hb-menu-item.cjs.entry.js +2 -2
  57. package/dist/cjs/hb-menu.cjs.entry.js +3 -3
  58. package/dist/cjs/hb-menu.cjs.entry.js.map +1 -1
  59. package/dist/cjs/hb-message.cjs.entry.js +2 -2
  60. package/dist/cjs/hb-notification.cjs.entry.js +2 -2
  61. package/dist/cjs/hb-page-header.cjs.entry.js +1 -1
  62. package/dist/cjs/hb-pagination.cjs.entry.js +21 -8
  63. package/dist/cjs/hb-pagination.cjs.entry.js.map +1 -1
  64. package/dist/cjs/hb-popconfirm.cjs.entry.js +37 -7
  65. package/dist/cjs/hb-popconfirm.cjs.entry.js.map +1 -1
  66. package/dist/cjs/hb-popover.cjs.entry.js +22 -2
  67. package/dist/cjs/hb-popover.cjs.entry.js.map +1 -1
  68. package/dist/cjs/hb-progress.cjs.entry.js +1 -1
  69. package/dist/cjs/hb-radio.cjs.entry.js +2 -2
  70. package/dist/cjs/hb-rate.cjs.entry.js +45 -3
  71. package/dist/cjs/hb-rate.cjs.entry.js.map +1 -1
  72. package/dist/cjs/hb-result.cjs.entry.js +1 -1
  73. package/dist/cjs/hb-row.cjs.entry.js +2 -2
  74. package/dist/cjs/hb-segmented.cjs.entry.js +39 -5
  75. package/dist/cjs/hb-segmented.cjs.entry.js.map +1 -1
  76. package/dist/cjs/hb-select.cjs.entry.js +47 -8
  77. package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
  78. package/dist/cjs/hb-slider.cjs.entry.js +189 -20
  79. package/dist/cjs/hb-slider.cjs.entry.js.map +1 -1
  80. package/dist/cjs/hb-space.cjs.entry.js +2 -2
  81. package/dist/cjs/hb-statistic.cjs.entry.js +1 -1
  82. package/dist/cjs/hb-step.cjs.entry.js +1 -1
  83. package/dist/cjs/hb-steps.cjs.entry.js +30 -9
  84. package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
  85. package/dist/cjs/hb-sub-menu.cjs.entry.js +4 -4
  86. package/dist/cjs/hb-switch.cjs.entry.js +9 -4
  87. package/dist/cjs/hb-switch.cjs.entry.js.map +1 -1
  88. package/dist/cjs/hb-tab-pane.cjs.entry.js +1 -1
  89. package/dist/cjs/hb-table.cjs.entry.js +1 -1
  90. package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
  91. package/dist/cjs/hb-tabs.cjs.entry.js +2 -2
  92. package/dist/cjs/hb-tag.cjs.entry.js +2 -2
  93. package/dist/cjs/hb-text.cjs.entry.js +2 -2
  94. package/dist/cjs/hb-time-picker.cjs.entry.js +4 -4
  95. package/dist/cjs/hb-time-select.cjs.entry.js +2 -2
  96. package/dist/cjs/hb-timeline.cjs.entry.js +1 -1
  97. package/dist/cjs/hb-tooltip.cjs.entry.js +18 -1
  98. package/dist/cjs/hb-tooltip.cjs.entry.js.map +1 -1
  99. package/dist/cjs/hb-transfer.cjs.entry.js +2 -2
  100. package/dist/cjs/hb-tree-select.cjs.entry.js +95 -18
  101. package/dist/cjs/hb-tree-select.cjs.entry.js.map +1 -1
  102. package/dist/cjs/hb-tree.cjs.entry.js +1 -1
  103. package/dist/cjs/hb-upload.cjs.entry.js +3 -3
  104. package/dist/cjs/hb-watermark.cjs.entry.js +1 -1
  105. package/dist/cjs/huibo-ui.cjs.js +1 -1
  106. package/dist/cjs/loader.cjs.js +1 -1
  107. package/dist/collection/collection-manifest.json +3 -3
  108. package/dist/collection/components/Affix/Affix.js +1 -1
  109. package/dist/collection/components/Avatar/Avatar.js +1 -1
  110. package/dist/collection/components/Backtop/Backtop.js +2 -2
  111. package/dist/collection/components/Badge/Badge.js +1 -1
  112. package/dist/collection/components/Breadcrumb/Breadcrumb.js +1 -1
  113. package/dist/collection/components/Breadcrumb/BreadcrumbItem.js +1 -1
  114. package/dist/collection/components/Button/Button.js +2 -2
  115. package/dist/collection/components/Calendar/Calendar.js +84 -10
  116. package/dist/collection/components/Calendar/Calendar.js.map +1 -1
  117. package/dist/collection/components/Calendar/calendar.css +16 -0
  118. package/dist/collection/components/Card/Card.js +1 -1
  119. package/dist/collection/components/Cascader/Cascader.js +374 -194
  120. package/dist/collection/components/Cascader/Cascader.js.map +1 -1
  121. package/dist/collection/components/Cascader/cascader.css +170 -16
  122. package/dist/collection/components/Checkbox/Checkbox.js +3 -3
  123. package/dist/collection/components/Checkbox/CheckboxGroup.js +2 -2
  124. package/dist/collection/components/Collapse/Collapse.js +1 -1
  125. package/dist/collection/components/Collapse/CollapseItem.js +1 -1
  126. package/dist/collection/components/ColorPicker/ColorPicker.js +92 -14
  127. package/dist/collection/components/ColorPicker/ColorPicker.js.map +1 -1
  128. package/dist/collection/components/ColorPicker/color-picker.css +13 -0
  129. package/dist/collection/components/ColorPickerPanel/ColorPickerPanel.js +2 -2
  130. package/dist/collection/components/ConfigProvider/ConfigProvider.js +1 -1
  131. package/dist/collection/components/Container/Aside.js +1 -1
  132. package/dist/collection/components/Container/Container.js +2 -2
  133. package/dist/collection/components/Container/Footer.js +1 -1
  134. package/dist/collection/components/Container/Header.js +1 -1
  135. package/dist/collection/components/Container/Main.js +1 -1
  136. package/dist/collection/components/DatePicker/DatePicker.js +89 -10
  137. package/dist/collection/components/DatePicker/DatePicker.js.map +1 -1
  138. package/dist/collection/components/DatePicker/date-picker.css +62 -2
  139. package/dist/collection/components/DatePickerPane/DatePickerPane.js +1 -1
  140. package/dist/collection/components/DateRangePicker/DateRangePicker.js +2 -2
  141. package/dist/collection/components/DateTimePicker/DateTimePicker.js +2 -2
  142. package/dist/collection/components/Descriptions/Descriptions.js +1 -1
  143. package/dist/collection/components/Descriptions/descriptions.css +22 -0
  144. package/dist/collection/components/Divider/Divider.js +2 -2
  145. package/dist/collection/components/Drawer/Drawer.js +1 -1
  146. package/dist/collection/components/Dropdown/Dropdown.js +83 -7
  147. package/dist/collection/components/Dropdown/Dropdown.js.map +1 -1
  148. package/dist/collection/components/Dropdown/dropdown.css +2 -1
  149. package/dist/collection/components/Empty/Empty.js +1 -1
  150. package/dist/collection/components/FloatButton/FloatButton.js +2 -2
  151. package/dist/collection/components/Form/Form.js +2 -2
  152. package/dist/collection/components/Form/FormItem.js +60 -9
  153. package/dist/collection/components/Form/FormItem.js.map +1 -1
  154. package/dist/collection/components/Form/form-item.css +49 -4
  155. package/dist/collection/components/Form/form.css +1 -0
  156. package/dist/collection/components/Image/Image.js +1 -1
  157. package/dist/collection/components/ImagePreview/ImagePreview.js +12 -8
  158. package/dist/collection/components/ImagePreview/ImagePreview.js.map +1 -1
  159. package/dist/collection/components/Input/Input.js +38 -2
  160. package/dist/collection/components/Input/Input.js.map +1 -1
  161. package/dist/collection/components/Input/input.css +21 -2
  162. package/dist/collection/components/InputNumber/InputNumber.js +5 -5
  163. package/dist/collection/components/InputTag/InputTag.js +2 -2
  164. package/dist/collection/components/Layout/Layout.js +87 -34
  165. package/dist/collection/components/Layout/Layout.js.map +1 -1
  166. package/dist/collection/components/Layout/Row.js +2 -2
  167. package/dist/collection/components/Layout/layout.css +524 -0
  168. package/dist/collection/components/Link/Link.js +2 -2
  169. package/dist/collection/components/Loading/Loading.js +2 -2
  170. package/dist/collection/components/Menu/Menu.js +2 -2
  171. package/dist/collection/components/Menu/MenuItem.js +2 -2
  172. package/dist/collection/components/Menu/SubMenu.js +4 -4
  173. package/dist/collection/components/Menu/menu.css +25 -0
  174. package/dist/collection/components/Message/Message.js +2 -2
  175. package/dist/collection/components/Notification/Notification.js +2 -2
  176. package/dist/collection/components/PageHeader/PageHeader.js +1 -1
  177. package/dist/collection/components/Pagination/Pagination.js +23 -7
  178. package/dist/collection/components/Pagination/Pagination.js.map +1 -1
  179. package/dist/collection/components/Pagination/pagination.css +23 -0
  180. package/dist/collection/components/Popconfirm/Popconfirm.js +44 -7
  181. package/dist/collection/components/Popconfirm/Popconfirm.js.map +1 -1
  182. package/dist/collection/components/Popover/Popover.js +29 -2
  183. package/dist/collection/components/Popover/Popover.js.map +1 -1
  184. package/dist/collection/components/Progress/Progress.js +1 -1
  185. package/dist/collection/components/Radio/Radio.js +2 -2
  186. package/dist/collection/components/Rate/Rate.js +45 -3
  187. package/dist/collection/components/Rate/Rate.js.map +1 -1
  188. package/dist/collection/components/Result/Result.js +1 -1
  189. package/dist/collection/components/Segmented/Segmented.js +51 -6
  190. package/dist/collection/components/Segmented/Segmented.js.map +1 -1
  191. package/dist/collection/components/Select/Select.js +46 -7
  192. package/dist/collection/components/Select/Select.js.map +1 -1
  193. package/dist/collection/components/Select/select.css +50 -4
  194. package/dist/collection/components/Slider/Slider.js +221 -21
  195. package/dist/collection/components/Slider/Slider.js.map +1 -1
  196. package/dist/collection/components/Slider/slider.css +58 -7
  197. package/dist/collection/components/Space/Space.js +2 -2
  198. package/dist/collection/components/Statistic/Statistic.js +1 -1
  199. package/dist/collection/components/Steps/Step.js +1 -1
  200. package/dist/collection/components/Steps/Steps.js +35 -8
  201. package/dist/collection/components/Steps/Steps.js.map +1 -1
  202. package/dist/collection/components/Switch/Switch.js +8 -3
  203. package/dist/collection/components/Switch/Switch.js.map +1 -1
  204. package/dist/collection/components/Switch/switch.css +45 -0
  205. package/dist/collection/components/Table/table.css +20 -0
  206. package/dist/collection/components/Tabs/TabPane.js +1 -1
  207. package/dist/collection/components/Tabs/Tabs.js +2 -2
  208. package/dist/collection/components/Tag/Tag.js +2 -2
  209. package/dist/collection/components/Text/Text.js +2 -2
  210. package/dist/collection/components/TimePicker/TimePicker.js +4 -4
  211. package/dist/collection/components/TimeSelect/TimeSelect.js +2 -2
  212. package/dist/collection/components/Timeline/Timeline.js +1 -1
  213. package/dist/collection/components/Tooltip/Tooltip.js +25 -2
  214. package/dist/collection/components/Tooltip/Tooltip.js.map +1 -1
  215. package/dist/collection/components/Transfer/Transfer.js +2 -2
  216. package/dist/collection/components/Tree/Tree.js +1 -1
  217. package/dist/collection/components/TreeSelect/TreeSelect.js +94 -17
  218. package/dist/collection/components/TreeSelect/TreeSelect.js.map +1 -1
  219. package/dist/collection/components/TreeSelect/tree-select.css +41 -7
  220. package/dist/collection/components/Upload/Upload.js +3 -3
  221. package/dist/collection/components/Watermark/Watermark.js +1 -1
  222. package/dist/collection/utils/date-helpers.js +6 -2
  223. package/dist/collection/utils/date-helpers.js.map +1 -1
  224. package/dist/components/hb-affix.js +1 -1
  225. package/dist/components/hb-aside.js +1 -1
  226. package/dist/components/hb-avatar.js +1 -1
  227. package/dist/components/hb-backtop.js +2 -2
  228. package/dist/components/hb-badge.js +1 -1
  229. package/dist/components/hb-breadcrumb-item.js +1 -1
  230. package/dist/components/hb-breadcrumb.js +1 -1
  231. package/dist/components/hb-button.js +2 -2
  232. package/dist/components/hb-calendar.js +80 -11
  233. package/dist/components/hb-calendar.js.map +1 -1
  234. package/dist/components/hb-card.js +1 -1
  235. package/dist/components/hb-cascader.js +273 -146
  236. package/dist/components/hb-cascader.js.map +1 -1
  237. package/dist/components/hb-checkbox-group.js +2 -2
  238. package/dist/components/hb-checkbox.js +3 -3
  239. package/dist/components/hb-collapse-item.js +1 -1
  240. package/dist/components/hb-collapse.js +1 -1
  241. package/dist/components/hb-color-picker-panel.js +2 -2
  242. package/dist/components/hb-color-picker.js +93 -15
  243. package/dist/components/hb-color-picker.js.map +1 -1
  244. package/dist/components/hb-config-provider.js +1 -1
  245. package/dist/components/hb-container.js +2 -2
  246. package/dist/components/hb-date-picker-pane.js +2 -2
  247. package/dist/components/hb-date-picker.js +87 -8
  248. package/dist/components/hb-date-picker.js.map +1 -1
  249. package/dist/components/hb-date-range-picker.js +3 -3
  250. package/dist/components/hb-date-time-picker.js +3 -3
  251. package/dist/components/hb-descriptions.js +2 -2
  252. package/dist/components/hb-descriptions.js.map +1 -1
  253. package/dist/components/hb-divider.js +2 -2
  254. package/dist/components/hb-drawer.js +1 -1
  255. package/dist/components/hb-dropdown.js +76 -7
  256. package/dist/components/hb-dropdown.js.map +1 -1
  257. package/dist/components/hb-empty.js +1 -1
  258. package/dist/components/hb-float-button.js +2 -2
  259. package/dist/components/hb-footer.js +1 -1
  260. package/dist/components/hb-form-item.js +59 -8
  261. package/dist/components/hb-form-item.js.map +1 -1
  262. package/dist/components/hb-form.js +3 -3
  263. package/dist/components/hb-form.js.map +1 -1
  264. package/dist/components/hb-header.js +1 -1
  265. package/dist/components/hb-icon.js +1 -89
  266. package/dist/components/hb-icon.js.map +1 -1
  267. package/dist/components/hb-image-preview.js +12 -8
  268. package/dist/components/hb-image-preview.js.map +1 -1
  269. package/dist/components/hb-image.js +1 -1
  270. package/dist/components/hb-input-number.js +5 -5
  271. package/dist/components/hb-input-tag.js +2 -2
  272. package/dist/components/hb-input.js +39 -3
  273. package/dist/components/hb-input.js.map +1 -1
  274. package/dist/components/hb-layout.js +36 -14
  275. package/dist/components/hb-layout.js.map +1 -1
  276. package/dist/components/hb-link.js +2 -2
  277. package/dist/components/hb-loading.js +2 -2
  278. package/dist/components/hb-main.js +1 -1
  279. package/dist/components/hb-menu-item.js +2 -2
  280. package/dist/components/hb-menu.js +3 -3
  281. package/dist/components/hb-menu.js.map +1 -1
  282. package/dist/components/hb-message.js +2 -2
  283. package/dist/components/hb-notification.js +2 -2
  284. package/dist/components/hb-page-header.js +1 -1
  285. package/dist/components/hb-pagination.js +25 -10
  286. package/dist/components/hb-pagination.js.map +1 -1
  287. package/dist/components/hb-popconfirm.js +37 -7
  288. package/dist/components/hb-popconfirm.js.map +1 -1
  289. package/dist/components/hb-popover.js +22 -2
  290. package/dist/components/hb-popover.js.map +1 -1
  291. package/dist/components/hb-progress.js +1 -1
  292. package/dist/components/hb-radio.js +2 -2
  293. package/dist/components/hb-rate.js +45 -3
  294. package/dist/components/hb-rate.js.map +1 -1
  295. package/dist/components/hb-result.js +1 -1
  296. package/dist/components/hb-row.js +2 -2
  297. package/dist/components/hb-segmented.js +41 -6
  298. package/dist/components/hb-segmented.js.map +1 -1
  299. package/dist/components/hb-select.js +47 -8
  300. package/dist/components/hb-select.js.map +1 -1
  301. package/dist/components/hb-slider.js +194 -21
  302. package/dist/components/hb-slider.js.map +1 -1
  303. package/dist/components/hb-space.js +2 -2
  304. package/dist/components/hb-statistic.js +1 -1
  305. package/dist/components/hb-step.js +1 -1
  306. package/dist/components/hb-steps.js +35 -8
  307. package/dist/components/hb-steps.js.map +1 -1
  308. package/dist/components/hb-sub-menu.js +4 -4
  309. package/dist/components/hb-switch.js +9 -4
  310. package/dist/components/hb-switch.js.map +1 -1
  311. package/dist/components/hb-tab-pane.js +1 -1
  312. package/dist/components/hb-table.js +1 -1
  313. package/dist/components/hb-table.js.map +1 -1
  314. package/dist/components/hb-tabs.js +2 -2
  315. package/dist/components/hb-tag.js +2 -2
  316. package/dist/components/hb-text.js +2 -2
  317. package/dist/components/hb-time-picker.js +4 -4
  318. package/dist/components/hb-time-select.js +2 -2
  319. package/dist/components/hb-timeline.js +1 -1
  320. package/dist/components/hb-tooltip.js +18 -1
  321. package/dist/components/hb-tooltip.js.map +1 -1
  322. package/dist/components/hb-transfer.js +2 -2
  323. package/dist/components/hb-tree-select.js +95 -18
  324. package/dist/components/hb-tree-select.js.map +1 -1
  325. package/dist/components/hb-tree.js +1 -1
  326. package/dist/components/hb-upload.js +3 -3
  327. package/dist/components/hb-watermark.js +1 -1
  328. package/dist/components/{p-cf94cbf6.js → p-08b4005c.js} +7 -3
  329. package/dist/components/p-08b4005c.js.map +1 -0
  330. package/dist/components/p-86d92faf.js +93 -0
  331. package/dist/components/p-86d92faf.js.map +1 -0
  332. package/dist/esm/{date-helpers-e4d85a67.js → date-helpers-44507189.js} +7 -3
  333. package/dist/esm/date-helpers-44507189.js.map +1 -0
  334. package/dist/esm/hb-affix.entry.js +1 -1
  335. package/dist/esm/hb-aside.entry.js +1 -1
  336. package/dist/esm/hb-avatar.entry.js +1 -1
  337. package/dist/esm/hb-backtop.entry.js +2 -2
  338. package/dist/esm/hb-badge.entry.js +1 -1
  339. package/dist/esm/hb-breadcrumb-item.entry.js +1 -1
  340. package/dist/esm/hb-breadcrumb.entry.js +1 -1
  341. package/dist/esm/hb-button.entry.js +2 -2
  342. package/dist/esm/hb-calendar.entry.js +78 -10
  343. package/dist/esm/hb-calendar.entry.js.map +1 -1
  344. package/dist/esm/hb-card.entry.js +1 -1
  345. package/dist/esm/hb-cascader.entry.js +270 -146
  346. package/dist/esm/hb-cascader.entry.js.map +1 -1
  347. package/dist/esm/hb-checkbox-group.entry.js +2 -2
  348. package/dist/esm/hb-checkbox.entry.js +3 -3
  349. package/dist/esm/hb-collapse-item.entry.js +1 -1
  350. package/dist/esm/hb-collapse.entry.js +1 -1
  351. package/dist/esm/hb-color-picker-panel.entry.js +2 -2
  352. package/dist/esm/hb-color-picker.entry.js +91 -14
  353. package/dist/esm/hb-color-picker.entry.js.map +1 -1
  354. package/dist/esm/hb-config-provider.entry.js +1 -1
  355. package/dist/esm/hb-container.entry.js +2 -2
  356. package/dist/esm/hb-date-picker-pane.entry.js +2 -2
  357. package/dist/esm/hb-date-picker.entry.js +85 -7
  358. package/dist/esm/hb-date-picker.entry.js.map +1 -1
  359. package/dist/esm/hb-date-range-picker.entry.js +3 -3
  360. package/dist/esm/hb-date-time-picker.entry.js +3 -3
  361. package/dist/esm/hb-descriptions.entry.js +2 -2
  362. package/dist/esm/hb-descriptions.entry.js.map +1 -1
  363. package/dist/esm/hb-divider.entry.js +2 -2
  364. package/dist/esm/hb-drawer.entry.js +1 -1
  365. package/dist/esm/hb-dropdown.entry.js +74 -6
  366. package/dist/esm/hb-dropdown.entry.js.map +1 -1
  367. package/dist/esm/hb-empty.entry.js +1 -1
  368. package/dist/esm/hb-float-button.entry.js +2 -2
  369. package/dist/esm/hb-footer.entry.js +1 -1
  370. package/dist/esm/hb-form-item.entry.js +59 -8
  371. package/dist/esm/hb-form-item.entry.js.map +1 -1
  372. package/dist/esm/hb-form.entry.js +3 -3
  373. package/dist/esm/hb-form.entry.js.map +1 -1
  374. package/dist/esm/hb-header.entry.js +1 -1
  375. package/dist/esm/hb-image-preview.entry.js +12 -8
  376. package/dist/esm/hb-image-preview.entry.js.map +1 -1
  377. package/dist/esm/hb-image.entry.js +1 -1
  378. package/dist/esm/hb-input-number.entry.js +5 -5
  379. package/dist/esm/hb-input-tag.entry.js +2 -2
  380. package/dist/esm/hb-input.entry.js +39 -3
  381. package/dist/esm/hb-input.entry.js.map +1 -1
  382. package/dist/esm/hb-layout.entry.js +36 -14
  383. package/dist/esm/hb-layout.entry.js.map +1 -1
  384. package/dist/esm/hb-link.entry.js +2 -2
  385. package/dist/esm/hb-loading.entry.js +2 -2
  386. package/dist/esm/hb-main.entry.js +1 -1
  387. package/dist/esm/hb-menu-item.entry.js +2 -2
  388. package/dist/esm/hb-menu.entry.js +3 -3
  389. package/dist/esm/hb-menu.entry.js.map +1 -1
  390. package/dist/esm/hb-message.entry.js +2 -2
  391. package/dist/esm/hb-notification.entry.js +2 -2
  392. package/dist/esm/hb-page-header.entry.js +1 -1
  393. package/dist/esm/hb-pagination.entry.js +21 -8
  394. package/dist/esm/hb-pagination.entry.js.map +1 -1
  395. package/dist/esm/hb-popconfirm.entry.js +37 -7
  396. package/dist/esm/hb-popconfirm.entry.js.map +1 -1
  397. package/dist/esm/hb-popover.entry.js +22 -2
  398. package/dist/esm/hb-popover.entry.js.map +1 -1
  399. package/dist/esm/hb-progress.entry.js +1 -1
  400. package/dist/esm/hb-radio.entry.js +2 -2
  401. package/dist/esm/hb-rate.entry.js +45 -3
  402. package/dist/esm/hb-rate.entry.js.map +1 -1
  403. package/dist/esm/hb-result.entry.js +1 -1
  404. package/dist/esm/hb-row.entry.js +2 -2
  405. package/dist/esm/hb-segmented.entry.js +40 -6
  406. package/dist/esm/hb-segmented.entry.js.map +1 -1
  407. package/dist/esm/hb-select.entry.js +47 -8
  408. package/dist/esm/hb-select.entry.js.map +1 -1
  409. package/dist/esm/hb-slider.entry.js +189 -20
  410. package/dist/esm/hb-slider.entry.js.map +1 -1
  411. package/dist/esm/hb-space.entry.js +2 -2
  412. package/dist/esm/hb-statistic.entry.js +1 -1
  413. package/dist/esm/hb-step.entry.js +1 -1
  414. package/dist/esm/hb-steps.entry.js +28 -7
  415. package/dist/esm/hb-steps.entry.js.map +1 -1
  416. package/dist/esm/hb-sub-menu.entry.js +4 -4
  417. package/dist/esm/hb-switch.entry.js +9 -4
  418. package/dist/esm/hb-switch.entry.js.map +1 -1
  419. package/dist/esm/hb-tab-pane.entry.js +1 -1
  420. package/dist/esm/hb-table.entry.js +1 -1
  421. package/dist/esm/hb-table.entry.js.map +1 -1
  422. package/dist/esm/hb-tabs.entry.js +2 -2
  423. package/dist/esm/hb-tag.entry.js +2 -2
  424. package/dist/esm/hb-text.entry.js +2 -2
  425. package/dist/esm/hb-time-picker.entry.js +4 -4
  426. package/dist/esm/hb-time-select.entry.js +2 -2
  427. package/dist/esm/hb-timeline.entry.js +1 -1
  428. package/dist/esm/hb-tooltip.entry.js +18 -1
  429. package/dist/esm/hb-tooltip.entry.js.map +1 -1
  430. package/dist/esm/hb-transfer.entry.js +2 -2
  431. package/dist/esm/hb-tree-select.entry.js +95 -18
  432. package/dist/esm/hb-tree-select.entry.js.map +1 -1
  433. package/dist/esm/hb-tree.entry.js +1 -1
  434. package/dist/esm/hb-upload.entry.js +3 -3
  435. package/dist/esm/hb-watermark.entry.js +1 -1
  436. package/dist/esm/huibo-ui.js +1 -1
  437. package/dist/esm/loader.js +1 -1
  438. package/dist/huibo-ui/huibo-ui.css +1 -1
  439. package/dist/huibo-ui/huibo-ui.esm.js +1 -1
  440. package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
  441. package/dist/huibo-ui/p-02f15843.entry.js +2 -0
  442. package/dist/huibo-ui/p-08b4005c.js +2 -0
  443. package/dist/huibo-ui/p-08b4005c.js.map +1 -0
  444. package/dist/huibo-ui/{p-fd19813c.entry.js → p-0d4b2997.entry.js} +2 -2
  445. package/dist/huibo-ui/{p-672076c3.entry.js → p-10f6c184.entry.js} +2 -2
  446. package/dist/huibo-ui/p-10f6c184.entry.js.map +1 -0
  447. package/dist/huibo-ui/{p-d7815b4f.entry.js → p-13010da2.entry.js} +2 -2
  448. package/dist/huibo-ui/{p-8c80a765.entry.js → p-15db24e9.entry.js} +2 -2
  449. package/dist/huibo-ui/{p-8d925e3d.entry.js → p-1b0fbe69.entry.js} +2 -2
  450. package/dist/huibo-ui/p-1f8db37a.entry.js +2 -0
  451. package/dist/huibo-ui/p-1f8db37a.entry.js.map +1 -0
  452. package/dist/huibo-ui/{p-f374d5a3.entry.js → p-20632186.entry.js} +2 -2
  453. package/dist/huibo-ui/{p-e6f2d71d.entry.js → p-20fc554b.entry.js} +2 -2
  454. package/dist/huibo-ui/{p-315feadf.entry.js → p-213b9de7.entry.js} +2 -2
  455. package/dist/huibo-ui/p-25fd7d5c.entry.js +2 -0
  456. package/dist/huibo-ui/p-25fd7d5c.entry.js.map +1 -0
  457. package/dist/huibo-ui/p-2811e603.entry.js +2 -0
  458. package/dist/huibo-ui/p-2811e603.entry.js.map +1 -0
  459. package/dist/huibo-ui/{p-64ca0980.entry.js → p-2943f5d0.entry.js} +2 -2
  460. package/dist/huibo-ui/p-2943f5d0.entry.js.map +1 -0
  461. package/dist/huibo-ui/{p-710f38de.entry.js → p-2b4556ff.entry.js} +2 -2
  462. package/dist/huibo-ui/{p-e0ab9010.entry.js → p-33de6878.entry.js} +2 -2
  463. package/dist/huibo-ui/{p-ebd04656.entry.js → p-3807da71.entry.js} +2 -2
  464. package/dist/huibo-ui/{p-6a1ec3ff.entry.js → p-3deff48c.entry.js} +2 -2
  465. package/dist/huibo-ui/{p-e2a8a396.entry.js → p-41d9c846.entry.js} +2 -2
  466. package/dist/huibo-ui/{p-0a033738.entry.js → p-47ef7a86.entry.js} +2 -2
  467. package/dist/huibo-ui/p-4d34e43e.entry.js +2 -0
  468. package/dist/huibo-ui/p-4d34e43e.entry.js.map +1 -0
  469. package/dist/huibo-ui/p-54aa2fd8.entry.js +2 -0
  470. package/dist/huibo-ui/p-54aa2fd8.entry.js.map +1 -0
  471. package/dist/huibo-ui/{p-88127de1.entry.js → p-55cd13eb.entry.js} +2 -2
  472. package/dist/huibo-ui/{p-58ebb9b3.entry.js → p-5c839288.entry.js} +2 -2
  473. package/dist/huibo-ui/{p-c1b4eacb.entry.js → p-60532a1f.entry.js} +2 -2
  474. package/dist/huibo-ui/{p-59b2e61c.entry.js → p-626b48f1.entry.js} +2 -2
  475. package/dist/huibo-ui/p-626b48f1.entry.js.map +1 -0
  476. package/dist/huibo-ui/p-639f167d.entry.js +2 -0
  477. package/dist/huibo-ui/p-639f167d.entry.js.map +1 -0
  478. package/dist/huibo-ui/{p-f1c084c5.entry.js → p-678b4212.entry.js} +2 -2
  479. package/dist/huibo-ui/p-6beb5b81.entry.js +2 -0
  480. package/dist/huibo-ui/p-6beb5b81.entry.js.map +1 -0
  481. package/dist/huibo-ui/{p-a0015341.entry.js → p-6bfeab80.entry.js} +2 -2
  482. package/dist/huibo-ui/p-6c8cf248.entry.js +2 -0
  483. package/dist/huibo-ui/p-6c8cf248.entry.js.map +1 -0
  484. package/dist/huibo-ui/{p-85f68526.entry.js → p-735bceef.entry.js} +2 -2
  485. package/dist/huibo-ui/{p-8b1ae77e.entry.js → p-746a11a3.entry.js} +2 -2
  486. package/dist/huibo-ui/p-76519752.entry.js +2 -0
  487. package/dist/huibo-ui/{p-d3939d44.entry.js → p-79af2efa.entry.js} +2 -2
  488. package/dist/huibo-ui/{p-e0768565.entry.js → p-7da14d7c.entry.js} +2 -2
  489. package/dist/huibo-ui/{p-8c987d57.entry.js → p-7f65dc36.entry.js} +2 -2
  490. package/dist/huibo-ui/{p-0e65e1bd.entry.js → p-86bdc48a.entry.js} +2 -2
  491. package/dist/huibo-ui/p-86bdc48a.entry.js.map +1 -0
  492. package/dist/huibo-ui/{p-d87fc21a.entry.js → p-88a6c905.entry.js} +2 -2
  493. package/dist/huibo-ui/{p-d64b91ef.entry.js → p-89ea1141.entry.js} +2 -2
  494. package/dist/huibo-ui/p-89ea1141.entry.js.map +1 -0
  495. package/dist/huibo-ui/p-8a202bc5.entry.js +2 -0
  496. package/dist/huibo-ui/p-8a202bc5.entry.js.map +1 -0
  497. package/dist/huibo-ui/p-8a8443b8.entry.js +2 -0
  498. package/dist/huibo-ui/p-8a8443b8.entry.js.map +1 -0
  499. package/dist/huibo-ui/p-8fd788c9.entry.js +2 -0
  500. package/dist/huibo-ui/p-8fd788c9.entry.js.map +1 -0
  501. package/dist/huibo-ui/{p-9319c650.entry.js → p-8fdbd17c.entry.js} +2 -2
  502. package/dist/huibo-ui/p-92521c31.entry.js +2 -0
  503. package/dist/huibo-ui/p-92521c31.entry.js.map +1 -0
  504. package/dist/huibo-ui/{p-c3e665f6.entry.js → p-9a5406f0.entry.js} +2 -2
  505. package/dist/huibo-ui/p-9a5406f0.entry.js.map +1 -0
  506. package/dist/huibo-ui/{p-c321c4aa.entry.js → p-a084b8e5.entry.js} +2 -2
  507. package/dist/huibo-ui/{p-5df47135.entry.js → p-a190ca89.entry.js} +2 -2
  508. package/dist/huibo-ui/{p-463de26d.entry.js → p-a8996d22.entry.js} +2 -2
  509. package/dist/huibo-ui/p-aa5e5e02.entry.js +2 -0
  510. package/dist/huibo-ui/p-aa5e5e02.entry.js.map +1 -0
  511. package/dist/huibo-ui/{p-6b381d0e.entry.js → p-ab9cf0e4.entry.js} +2 -2
  512. package/dist/huibo-ui/{p-477d8568.entry.js → p-aeae83af.entry.js} +2 -2
  513. package/dist/huibo-ui/{p-77017274.entry.js → p-af74667d.entry.js} +2 -2
  514. package/dist/huibo-ui/{p-b489a526.entry.js → p-b06c8020.entry.js} +2 -2
  515. package/dist/huibo-ui/{p-2e6584ea.entry.js → p-b468858e.entry.js} +2 -2
  516. package/dist/huibo-ui/{p-2b286698.entry.js → p-b7885d4a.entry.js} +2 -2
  517. package/dist/huibo-ui/{p-231a7335.entry.js → p-b8d87f7e.entry.js} +2 -2
  518. package/dist/huibo-ui/{p-8b027491.entry.js → p-c50ad398.entry.js} +2 -2
  519. package/dist/huibo-ui/p-c6c91664.entry.js +2 -0
  520. package/dist/huibo-ui/{p-c3e8893d.entry.js → p-c80f8ace.entry.js} +2 -2
  521. package/dist/huibo-ui/p-c80f8ace.entry.js.map +1 -0
  522. package/dist/huibo-ui/{p-476527c1.entry.js → p-c8e917db.entry.js} +2 -2
  523. package/dist/huibo-ui/p-c8e917db.entry.js.map +1 -0
  524. package/dist/huibo-ui/{p-c922d672.entry.js → p-cad57c2d.entry.js} +2 -2
  525. package/dist/huibo-ui/{p-a042e3d0.entry.js → p-ccd09d5a.entry.js} +2 -2
  526. package/dist/huibo-ui/p-d79a15b1.entry.js +2 -0
  527. package/dist/huibo-ui/p-d79a15b1.entry.js.map +1 -0
  528. package/dist/huibo-ui/{p-10c088f3.entry.js → p-d9c7c378.entry.js} +2 -2
  529. package/dist/huibo-ui/{p-80aca641.entry.js → p-dfccc7aa.entry.js} +2 -2
  530. package/dist/huibo-ui/{p-21682e92.entry.js → p-dfd144d8.entry.js} +2 -2
  531. package/dist/huibo-ui/{p-be48d2aa.entry.js → p-e039155d.entry.js} +2 -2
  532. package/dist/huibo-ui/{p-dfaf7e37.entry.js → p-e10fcfbe.entry.js} +2 -2
  533. package/dist/huibo-ui/{p-079a4130.entry.js → p-e3155cd7.entry.js} +2 -2
  534. package/dist/huibo-ui/{p-4001c08d.entry.js → p-e5cbfa9e.entry.js} +2 -2
  535. package/dist/huibo-ui/p-e5cbfa9e.entry.js.map +1 -0
  536. package/dist/huibo-ui/p-edbda423.entry.js +2 -0
  537. package/dist/huibo-ui/p-edbda423.entry.js.map +1 -0
  538. package/dist/huibo-ui/{p-465dcb4c.entry.js → p-f2c78699.entry.js} +2 -2
  539. package/dist/huibo-ui/{p-6ac242fe.entry.js → p-f4336be9.entry.js} +2 -2
  540. package/dist/huibo-ui/{p-332c8877.entry.js → p-f5969181.entry.js} +2 -2
  541. package/dist/huibo-ui/{p-f81ec512.entry.js → p-f6889710.entry.js} +2 -2
  542. package/dist/huibo-ui/{p-24ad7eec.entry.js → p-f9bb5217.entry.js} +2 -2
  543. package/dist/huibo-ui/{p-4d8b1404.entry.js → p-fd8301c6.entry.js} +2 -2
  544. package/dist/huibo-ui/{p-dd05cb2c.entry.js → p-fea20295.entry.js} +2 -2
  545. package/dist/types/components/Calendar/Calendar.d.ts +13 -1
  546. package/dist/types/components/Cascader/Cascader.d.ts +68 -90
  547. package/dist/types/components/ColorPicker/ColorPicker.d.ts +11 -0
  548. package/dist/types/components/DatePicker/DatePicker.d.ts +14 -3
  549. package/dist/types/components/Dropdown/Dropdown.d.ts +14 -1
  550. package/dist/types/components/Form/FormItem.d.ts +10 -0
  551. package/dist/types/components/ImagePreview/ImagePreview.d.ts +5 -1
  552. package/dist/types/components/Input/Input.d.ts +9 -0
  553. package/dist/types/components/Layout/Layout.d.ts +20 -10
  554. package/dist/types/components/Pagination/Pagination.d.ts +3 -0
  555. package/dist/types/components/Popconfirm/Popconfirm.d.ts +12 -0
  556. package/dist/types/components/Popover/Popover.d.ts +9 -0
  557. package/dist/types/components/Rate/Rate.d.ts +7 -0
  558. package/dist/types/components/Segmented/Segmented.d.ts +12 -1
  559. package/dist/types/components/Select/Select.d.ts +6 -0
  560. package/dist/types/components/Slider/Slider.d.ts +27 -1
  561. package/dist/types/components/Steps/Steps.d.ts +14 -6
  562. package/dist/types/components/Tooltip/Tooltip.d.ts +9 -1
  563. package/dist/types/components/TreeSelect/TreeSelect.d.ts +9 -0
  564. package/dist/types/components.d.ts +250 -94
  565. package/dist/types/utils/date-helpers.d.ts +1 -1
  566. package/package.json +8 -2
  567. package/readme.md +88 -73
  568. package/dist/cjs/date-helpers-904747ff.js.map +0 -1
  569. package/dist/components/p-cf94cbf6.js.map +0 -1
  570. package/dist/esm/date-helpers-e4d85a67.js.map +0 -1
  571. package/dist/huibo-ui/p-003cee87.entry.js +0 -2
  572. package/dist/huibo-ui/p-003cee87.entry.js.map +0 -1
  573. package/dist/huibo-ui/p-0bef78ac.entry.js +0 -2
  574. package/dist/huibo-ui/p-0bef78ac.entry.js.map +0 -1
  575. package/dist/huibo-ui/p-0e65e1bd.entry.js.map +0 -1
  576. package/dist/huibo-ui/p-0f189251.entry.js +0 -2
  577. package/dist/huibo-ui/p-0f189251.entry.js.map +0 -1
  578. package/dist/huibo-ui/p-1b5acd6d.entry.js +0 -2
  579. package/dist/huibo-ui/p-1b5acd6d.entry.js.map +0 -1
  580. package/dist/huibo-ui/p-3c7f73c8.entry.js +0 -2
  581. package/dist/huibo-ui/p-3c7f73c8.entry.js.map +0 -1
  582. package/dist/huibo-ui/p-4001c08d.entry.js.map +0 -1
  583. package/dist/huibo-ui/p-44c48246.entry.js +0 -2
  584. package/dist/huibo-ui/p-44c48246.entry.js.map +0 -1
  585. package/dist/huibo-ui/p-476527c1.entry.js.map +0 -1
  586. package/dist/huibo-ui/p-4d0dff15.entry.js +0 -2
  587. package/dist/huibo-ui/p-58d20809.entry.js +0 -2
  588. package/dist/huibo-ui/p-58d20809.entry.js.map +0 -1
  589. package/dist/huibo-ui/p-59b2e61c.entry.js.map +0 -1
  590. package/dist/huibo-ui/p-64ca0980.entry.js.map +0 -1
  591. package/dist/huibo-ui/p-672076c3.entry.js.map +0 -1
  592. package/dist/huibo-ui/p-756acbdb.entry.js +0 -2
  593. package/dist/huibo-ui/p-756acbdb.entry.js.map +0 -1
  594. package/dist/huibo-ui/p-75a93de3.entry.js +0 -2
  595. package/dist/huibo-ui/p-75a93de3.entry.js.map +0 -1
  596. package/dist/huibo-ui/p-769960f4.entry.js +0 -2
  597. package/dist/huibo-ui/p-8d615521.entry.js +0 -2
  598. package/dist/huibo-ui/p-8d615521.entry.js.map +0 -1
  599. package/dist/huibo-ui/p-953b9514.entry.js +0 -2
  600. package/dist/huibo-ui/p-ad6b0c6e.entry.js +0 -2
  601. package/dist/huibo-ui/p-ad6b0c6e.entry.js.map +0 -1
  602. package/dist/huibo-ui/p-c1a059d9.entry.js +0 -2
  603. package/dist/huibo-ui/p-c1a059d9.entry.js.map +0 -1
  604. package/dist/huibo-ui/p-c3e665f6.entry.js.map +0 -1
  605. package/dist/huibo-ui/p-c3e8893d.entry.js.map +0 -1
  606. package/dist/huibo-ui/p-cf94cbf6.js +0 -2
  607. package/dist/huibo-ui/p-cf94cbf6.js.map +0 -1
  608. package/dist/huibo-ui/p-d64b91ef.entry.js.map +0 -1
  609. package/dist/huibo-ui/p-e9490259.entry.js +0 -2
  610. package/dist/huibo-ui/p-e9490259.entry.js.map +0 -1
  611. package/dist/huibo-ui/p-ed0ff857.entry.js +0 -2
  612. package/dist/huibo-ui/p-ed0ff857.entry.js.map +0 -1
  613. package/dist/huibo-ui/p-f0ac7db5.entry.js +0 -2
  614. package/dist/huibo-ui/p-f0ac7db5.entry.js.map +0 -1
  615. /package/dist/huibo-ui/{p-4d0dff15.entry.js.map → p-02f15843.entry.js.map} +0 -0
  616. /package/dist/huibo-ui/{p-fd19813c.entry.js.map → p-0d4b2997.entry.js.map} +0 -0
  617. /package/dist/huibo-ui/{p-d7815b4f.entry.js.map → p-13010da2.entry.js.map} +0 -0
  618. /package/dist/huibo-ui/{p-8c80a765.entry.js.map → p-15db24e9.entry.js.map} +0 -0
  619. /package/dist/huibo-ui/{p-8d925e3d.entry.js.map → p-1b0fbe69.entry.js.map} +0 -0
  620. /package/dist/huibo-ui/{p-f374d5a3.entry.js.map → p-20632186.entry.js.map} +0 -0
  621. /package/dist/huibo-ui/{p-e6f2d71d.entry.js.map → p-20fc554b.entry.js.map} +0 -0
  622. /package/dist/huibo-ui/{p-315feadf.entry.js.map → p-213b9de7.entry.js.map} +0 -0
  623. /package/dist/huibo-ui/{p-710f38de.entry.js.map → p-2b4556ff.entry.js.map} +0 -0
  624. /package/dist/huibo-ui/{p-e0ab9010.entry.js.map → p-33de6878.entry.js.map} +0 -0
  625. /package/dist/huibo-ui/{p-ebd04656.entry.js.map → p-3807da71.entry.js.map} +0 -0
  626. /package/dist/huibo-ui/{p-6a1ec3ff.entry.js.map → p-3deff48c.entry.js.map} +0 -0
  627. /package/dist/huibo-ui/{p-e2a8a396.entry.js.map → p-41d9c846.entry.js.map} +0 -0
  628. /package/dist/huibo-ui/{p-0a033738.entry.js.map → p-47ef7a86.entry.js.map} +0 -0
  629. /package/dist/huibo-ui/{p-88127de1.entry.js.map → p-55cd13eb.entry.js.map} +0 -0
  630. /package/dist/huibo-ui/{p-58ebb9b3.entry.js.map → p-5c839288.entry.js.map} +0 -0
  631. /package/dist/huibo-ui/{p-c1b4eacb.entry.js.map → p-60532a1f.entry.js.map} +0 -0
  632. /package/dist/huibo-ui/{p-f1c084c5.entry.js.map → p-678b4212.entry.js.map} +0 -0
  633. /package/dist/huibo-ui/{p-a0015341.entry.js.map → p-6bfeab80.entry.js.map} +0 -0
  634. /package/dist/huibo-ui/{p-85f68526.entry.js.map → p-735bceef.entry.js.map} +0 -0
  635. /package/dist/huibo-ui/{p-8b1ae77e.entry.js.map → p-746a11a3.entry.js.map} +0 -0
  636. /package/dist/huibo-ui/{p-953b9514.entry.js.map → p-76519752.entry.js.map} +0 -0
  637. /package/dist/huibo-ui/{p-d3939d44.entry.js.map → p-79af2efa.entry.js.map} +0 -0
  638. /package/dist/huibo-ui/{p-e0768565.entry.js.map → p-7da14d7c.entry.js.map} +0 -0
  639. /package/dist/huibo-ui/{p-8c987d57.entry.js.map → p-7f65dc36.entry.js.map} +0 -0
  640. /package/dist/huibo-ui/{p-d87fc21a.entry.js.map → p-88a6c905.entry.js.map} +0 -0
  641. /package/dist/huibo-ui/{p-9319c650.entry.js.map → p-8fdbd17c.entry.js.map} +0 -0
  642. /package/dist/huibo-ui/{p-c321c4aa.entry.js.map → p-a084b8e5.entry.js.map} +0 -0
  643. /package/dist/huibo-ui/{p-5df47135.entry.js.map → p-a190ca89.entry.js.map} +0 -0
  644. /package/dist/huibo-ui/{p-463de26d.entry.js.map → p-a8996d22.entry.js.map} +0 -0
  645. /package/dist/huibo-ui/{p-6b381d0e.entry.js.map → p-ab9cf0e4.entry.js.map} +0 -0
  646. /package/dist/huibo-ui/{p-477d8568.entry.js.map → p-aeae83af.entry.js.map} +0 -0
  647. /package/dist/huibo-ui/{p-77017274.entry.js.map → p-af74667d.entry.js.map} +0 -0
  648. /package/dist/huibo-ui/{p-b489a526.entry.js.map → p-b06c8020.entry.js.map} +0 -0
  649. /package/dist/huibo-ui/{p-2e6584ea.entry.js.map → p-b468858e.entry.js.map} +0 -0
  650. /package/dist/huibo-ui/{p-2b286698.entry.js.map → p-b7885d4a.entry.js.map} +0 -0
  651. /package/dist/huibo-ui/{p-231a7335.entry.js.map → p-b8d87f7e.entry.js.map} +0 -0
  652. /package/dist/huibo-ui/{p-8b027491.entry.js.map → p-c50ad398.entry.js.map} +0 -0
  653. /package/dist/huibo-ui/{p-769960f4.entry.js.map → p-c6c91664.entry.js.map} +0 -0
  654. /package/dist/huibo-ui/{p-c922d672.entry.js.map → p-cad57c2d.entry.js.map} +0 -0
  655. /package/dist/huibo-ui/{p-a042e3d0.entry.js.map → p-ccd09d5a.entry.js.map} +0 -0
  656. /package/dist/huibo-ui/{p-10c088f3.entry.js.map → p-d9c7c378.entry.js.map} +0 -0
  657. /package/dist/huibo-ui/{p-80aca641.entry.js.map → p-dfccc7aa.entry.js.map} +0 -0
  658. /package/dist/huibo-ui/{p-21682e92.entry.js.map → p-dfd144d8.entry.js.map} +0 -0
  659. /package/dist/huibo-ui/{p-be48d2aa.entry.js.map → p-e039155d.entry.js.map} +0 -0
  660. /package/dist/huibo-ui/{p-dfaf7e37.entry.js.map → p-e10fcfbe.entry.js.map} +0 -0
  661. /package/dist/huibo-ui/{p-079a4130.entry.js.map → p-e3155cd7.entry.js.map} +0 -0
  662. /package/dist/huibo-ui/{p-465dcb4c.entry.js.map → p-f2c78699.entry.js.map} +0 -0
  663. /package/dist/huibo-ui/{p-6ac242fe.entry.js.map → p-f4336be9.entry.js.map} +0 -0
  664. /package/dist/huibo-ui/{p-332c8877.entry.js.map → p-f5969181.entry.js.map} +0 -0
  665. /package/dist/huibo-ui/{p-f81ec512.entry.js.map → p-f6889710.entry.js.map} +0 -0
  666. /package/dist/huibo-ui/{p-24ad7eec.entry.js.map → p-f9bb5217.entry.js.map} +0 -0
  667. /package/dist/huibo-ui/{p-4d8b1404.entry.js.map → p-fd8301c6.entry.js.map} +0 -0
  668. /package/dist/huibo-ui/{p-dd05cb2c.entry.js.map → p-fea20295.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"file":"hb-form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,CACxD,CACG,CACF,EACN;KACH;;;;;;","names":[],"sources":["src/components/Form/form-item.css?tag=hb-form-item&encapsulation=shadow","src/components/Form/FormItem.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form-item {\n display: flex;\n align-items: flex-start;\n gap: var(--hb-spacing-sm);\n}\n\n.hb-form-item__label {\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: var(--hb-size-default);\n font-size: var(--hb-font-size-sm);\n color: var(--hb-color-text);\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.hb-form-item__required {\n color: var(--hb-color-danger);\n margin-right: 4px;\n}\n\n.hb-form-item__content {\n flex: 1;\n position: relative;\n}\n\n.hb-form-item__error {\n font-size: var(--hb-font-size-xs);\n color: var(--hb-color-danger);\n margin-top: 4px;\n line-height: 1;\n animation: hb-form-error-fade-in 0.2s ease-out;\n}\n\n@keyframes hb-form-error-fade-in {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\n/**\n * FormItem 表单项组件\n * 表单中的每一项\n */\n@Component({\n tag: 'hb-form-item',\n styleUrl: 'form-item.css',\n shadow: true,\n})\nexport class FormItem {\n @Element() el: HTMLElement;\n\n /** 字段名 */\n @Prop() prop: string = '';\n\n /** 标签文本 */\n @Prop() label: string = '';\n\n /** 标签宽度 */\n @Prop() labelWidth?: string;\n\n /** 是否必填 */\n @Prop() required: boolean = false;\n\n /** 该表单项的验证规则 */\n @Prop() rules: any[] = [];\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n @State() errors: string[] = [];\n @State() isvalidating: boolean = false;\n\n componentDidLoad() {\n // 向父级 hb-form 注册\n this.el.dispatchEvent(new CustomEvent('hbFormFieldRegister', {\n detail: {\n prop: this.prop,\n validate: this.validate,\n resetValue: this.resetValue,\n getValue: this.getValue,\n },\n bubbles: true,\n }));\n }\n\n private get formRules(): any[] {\n // 合并 prop 对应的 form rules 和自身 rules\n const form = this.el.closest('hb-form');\n const formLevelRules = form ? (form as any).rules?.[this.prop] || [] : [];\n return [...formLevelRules, ...this.rules];\n }\n\n /**\n * 验证此字段\n */\n @Prop() validate = async (): Promise<string[]> => {\n const value = this.getValue();\n const rules = this.formRules;\n\n if (rules.length === 0) {\n this.errors = [];\n return [];\n }\n\n this.isvalidating = true;\n const errors: string[] = [];\n\n for (const rule of rules) {\n if (rule.required && (!value && value !== 0)) {\n errors.push(rule.message || `${this.label || this.prop}不能为空`);\n continue;\n }\n if (rule.pattern && !rule.pattern.test(value)) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n if (rule.min !== undefined && typeof value === 'string' && value.length < rule.min) {\n errors.push(rule.message || `${this.label || this.prop}最少${rule.min}个字符`);\n continue;\n }\n if (rule.max !== undefined && typeof value === 'string' && value.length > rule.max) {\n errors.push(rule.message || `${this.label || this.prop}最多${rule.max}个字符`);\n continue;\n }\n if (rule.validator) {\n try {\n await rule.validator(value, this.formRules);\n } catch (err: any) {\n errors.push(err.message || rule.message || `${this.label || this.prop}验证失败`);\n }\n }\n }\n\n this.errors = errors;\n this.isvalidating = false;\n return errors;\n };\n\n @Prop() resetValue = () => {\n this.errors = [];\n };\n\n @Prop() getValue = (): any => {\n // 尝试从子元素中获取值\n const input = this.el.querySelector('hb-input, hb-select, hb-cascader, hb-date-picker, hb-input-number, hb-textarea, hb-checkbox, hb-radio, hb-switch');\n if (input) {\n return (input as any).modelValue;\n }\n return undefined;\n };\n\n render() {\n return (\n <div\n class={{\n 'hb-form-item': true,\n 'hb-form-item--error': this.errors.length > 0,\n 'hb-form-item--validating': this.isvalidating,\n }}\n >\n {this.label && (\n <label\n class=\"hb-form-item__label\"\n style={this.labelWidth ? { width: this.labelWidth } : undefined}\n >\n {this.required && <span class=\"hb-form-item__required\">*</span>}\n {this.label}\n </label>\n )}\n <div class=\"hb-form-item__content\">\n <slot />\n {this.errors.length > 0 && (\n <div class=\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,EAAE,IAAI,CAAC,qBAAqB,KAAK,MAAM;aAClE,IAEA,IAAI,CAAC,KAAK,KACT,8DACE,KAAK,EAAC,qBAAqB,EAC3B,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,EAC/D,KAAK,EAAE,IAAI,CAAC,KAAK,IAEhB,IAAI,CAAC,UAAU,KACd,6DAAM,KAAK,EAAC,wBAAwB,iBAAa,MAAM,QAAS,CACjE,EACA,IAAI,CAAC,KAAK,CACL,CACT,EACD,4DAAK,KAAK,EAAC,uBAAuB,IAChC,8DAAQ,EACP,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,KACrB,4DAAK,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,OAAO,IAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAO,CACrE,CACG,CACF,EACN;KACH;;;;;;","names":[],"sources":["src/components/Form/form-item.css?tag=hb-form-item&encapsulation=shadow","src/components/Form/FormItem.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form-item {\n display: flex;\n align-items: flex-start;\n gap: var(--hb-spacing-sm);\n}\n\n/* label 位置:顶部(对齐 antd label-position=\"top\")——\n 需要 Form 通过 class 下发,但 FormItem 在独立使用时也支持自身包装。\n 这里用 :host([data-label-position=\"top\"]) 兜底,Form 可通过 setting attribute 生效。 */\n:host([data-label-top]) .hb-form-item,\n.hb-form-item--label-top {\n flex-direction: column;\n align-items: stretch;\n gap: var(--hb-spacing-xs);\n}\n\n.hb-form-item__label {\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n height: var(--hb-size-default, 32px);\n font-size: var(--hb-font-size-sm, 14px);\n color: var(--hb-color-text);\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n/* label-position=top 时标签左对齐 */\n:host([data-label-top]) .hb-form-item__label,\n.hb-form-item--label-top .hb-form-item__label {\n justify-content: flex-start;\n height: auto;\n padding-bottom: var(--hb-spacing-xxs, 2px);\n}\n\n/* label-position=left 时标签左对齐 */\n.hb-form-item--label-left .hb-form-item__label {\n justify-content: flex-start;\n}\n\n.hb-form-item__required {\n color: var(--hb-color-danger);\n margin-right: 4px;\n font-size: var(--hb-font-size-sm, 14px);\n font-family: SimSun, sans-serif;\n}\n\n.hb-form-item__content {\n flex: 1;\n position: relative;\n min-width: 0;\n}\n\n.hb-form-item__error {\n font-size: var(--hb-font-size-xs, 12px);\n color: var(--hb-color-danger);\n margin-top: 4px;\n line-height: 1.5;\n min-height: 0;\n animation: hb-form-error-fade-in 0.2s ease-out;\n}\n\n@keyframes hb-form-error-fade-in {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n}\n\n/* ============================================================\n * 响应式(移动端):小屏强制 label 顶部布局,\n * 避免标签列在窄屏被挤压。覆盖 hb-form-item--label-left/right。\n * ============================================================ */\n@media (max-width: 575.98px) {\n .hb-form-item {\n flex-direction: column !important;\n align-items: stretch !important;\n gap: var(--hb-spacing-xs) !important;\n }\n\n .hb-form-item__label {\n justify-content: flex-start !important;\n height: auto !important;\n padding-bottom: var(--hb-spacing-xxs, 2px) !important;\n }\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\n/**\n * FormItem 表单项组件\n * 表单中的每一项\n */\n@Component({\n tag: 'hb-form-item',\n styleUrl: 'form-item.css',\n shadow: true,\n})\nexport class FormItem {\n @Element() el: HTMLElement;\n\n /** 字段名 */\n @Prop() prop: string = '';\n\n /** 标签文本 */\n @Prop() label: string = '';\n\n /** 标签宽度 */\n @Prop() labelWidth?: string;\n\n /** 是否必填 */\n @Prop() required: boolean = false;\n\n /** 该表单项的验证规则 */\n @Prop() rules: any[] = [];\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n @State() errors: string[] = [];\n @State() isvalidating: boolean = false;\n\n /** hb-form 在 componentWillLoad 注册的事件监听;FormItem 在 componentDidLoad 派发,\n * 但 componentWillLoad 早于子组件的 componentDidLoad,因此注册一定先到。\n * 这里还监听 hbFieldReset,便于 Form.resetFields 主动广播。 */\n\n componentDidLoad() {\n // 向父级 hb-form 注册\n this.el.dispatchEvent(new CustomEvent('hbFormFieldRegister', {\n detail: {\n prop: this.prop,\n validate: this.validate,\n resetValue: this.resetValue,\n getValue: this.getValue,\n },\n bubbles: true,\n composed: true, // 穿越 Shadow DOM 边界(FormItem 自身 shadow -> Form host)\n }));\n\n // 子控件值变化时清错(对齐 antd:合法输入即移除错误提示)\n this.el.addEventListener('hbChange', this.handleChildChange);\n }\n\n disconnectedCallback() {\n this.el.removeEventListener('hbChange', this.handleChildChange);\n }\n\n /** 子控件 hbChange 时,若当前有错误则重新校验以尽早清除错误提示 */\n private handleChildChange = () => {\n if (this.errors.length > 0) {\n void this.validate();\n }\n };\n\n private get formRules(): any[] {\n // 合并 prop 对应的 form rules 和自身 rules\n const form = this.el.closest('hb-form');\n const formLevelRules = form ? (form as any).rules?.[this.prop] || [] : [];\n return [...formLevelRules, ...this.rules];\n }\n\n /** 是否渲染必填星号:显式 required 或任一规则带 required(对齐 antd 自动推断) */\n private get isRequired(): boolean {\n if (this.required) return true;\n return this.formRules.some(r => r && r.required);\n }\n\n /** 继承父 hb-form 的 labelPosition(FormItem 自身无此 prop,避免与 Form 冲突时以 Form 为准) */\n private get resolvedLabelPosition(): 'left' | 'right' | 'top' {\n const form = this.el.closest('hb-form') as any;\n return (form && form.labelPosition) || 'right';\n }\n\n /**\n * 验证此字段\n */\n @Prop() validate = async (): Promise<string[]> => {\n const value = this.getValue();\n const rules = this.formRules;\n\n if (rules.length === 0) {\n this.errors = [];\n return [];\n }\n\n this.isvalidating = true;\n const errors: string[] = [];\n\n for (const rule of rules) {\n // 必填校验:空字符串 / null / undefined / 空数组均视为\"未填\"\n const isEmpty =\n value === undefined ||\n value === null ||\n value === '' ||\n (Array.isArray(value) && value.length === 0);\n if (rule.required && isEmpty) {\n errors.push(rule.message || `${this.label || this.prop}不能为空`);\n continue;\n }\n // 非必填且为空时,跳过后续格式校验(与 antd 行为一致)\n if (isEmpty) continue;\n if (rule.pattern) {\n const ok = typeof rule.pattern === 'string'\n ? new RegExp(rule.pattern).test(String(value))\n : rule.pattern.test(String(value));\n if (!ok) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n }\n if (rule.type === 'email') {\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(String(value))) {\n errors.push(rule.message || `${this.label || this.prop}格式不正确`);\n continue;\n }\n }\n if (rule.min !== undefined && typeof value === 'string' && value.length < rule.min) {\n errors.push(rule.message || `${this.label || this.prop}最少${rule.min}个字符`);\n continue;\n }\n if (rule.max !== undefined && typeof value === 'string' && value.length > rule.max) {\n errors.push(rule.message || `${this.label || this.prop}最多${rule.max}个字符`);\n continue;\n }\n if (rule.validator) {\n try {\n await rule.validator(value, this.formRules);\n } catch (err: any) {\n errors.push(err.message || rule.message || `${this.label || this.prop}验证失败`);\n }\n }\n }\n\n this.errors = errors;\n this.isvalidating = false;\n return errors;\n };\n\n @Prop() resetValue = () => {\n this.errors = [];\n };\n\n @Prop() getValue = (): any => {\n // 覆盖所有表单控件:input/select/cascader/date 系列/数字/checkbox/radio/switch/slider/color-picker/rate/upload\n const input = this.el.querySelector(\n 'hb-input, hb-select, hb-cascader, hb-date-picker, hb-date-time-picker, hb-date-range-picker, ' +\n 'hb-input-number, hb-textarea, hb-checkbox, hb-checkbox-group, hb-radio-group, hb-switch, ' +\n 'hb-slider, hb-color-picker, hb-rate, hb-time-picker, hb-time-select',\n );\n if (input) {\n return (input as any).modelValue;\n }\n return undefined;\n };\n\n render() {\n const labelTop = this.resolvedLabelPosition === 'top';\n return (\n <div\n class={{\n 'hb-form-item': true,\n 'hb-form-item--error': this.errors.length > 0,\n 'hb-form-item--validating': this.isvalidating,\n 'hb-form-item--required': this.isRequired,\n 'hb-form-item--label-top': labelTop,\n 'hb-form-item--label-left': this.resolvedLabelPosition === 'left',\n }}\n >\n {this.label && (\n <label\n class=\"hb-form-item__label\"\n style={this.labelWidth ? { width: this.labelWidth } : undefined}\n title={this.label}\n >\n {this.isRequired && (\n <span class=\"hb-form-item__required\" aria-hidden=\"true\">*</span>\n )}\n {this.label}\n </label>\n )}\n <div class=\"hb-form-item__content\">\n <slot />\n {this.errors.length > 0 && (\n <div class=\"hb-form-item__error\" role=\"alert\">{this.errors[0]}</div>\n )}\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h } from './index-fdf7135e.js';
2
2
 
3
- const formCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form{display:flex;flex-direction:column;gap:var(--hb-spacing-md)}.hb-form--inline{flex-flow:wrap;gap:var(--hb-spacing-sm)var(--hb-spacing-lg)}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
3
+ const formCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.inline{display:inline}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-form{display:flex;flex-direction:column;gap:var(--hb-spacing-md)}.hb-form--inline{align-items:flex-start;flex-flow:wrap;gap:var(--hb-spacing-sm)var(--hb-spacing-lg)}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
4
4
  const HbFormStyle0 = formCss;
5
5
 
6
6
  const Form = class {
@@ -52,11 +52,11 @@ const Form = class {
52
52
  this.fieldRegistry.forEach((field) => field.resetValue());
53
53
  };
54
54
  render() {
55
- return (h("form", { key: '233f774fd2e6a7331ce01d7b729c3a77dd5793a9', class: {
55
+ return (h("form", { key: 'c76a79544096dc06761b506ccc8afdef06fcf68b', class: {
56
56
  'hb-form': true,
57
57
  [`hb-form--label-${this.labelPosition}`]: true,
58
58
  'hb-form--inline': this.inline,
59
- }, onSubmit: (e) => e.preventDefault(), novalidate: true }, h("slot", { key: '99055d1a239483acc153523aeb218ad420bd9610' })));
59
+ }, onSubmit: (e) => e.preventDefault(), novalidate: true }, h("slot", { key: 'be1f2a559248080153cf56607d91fbad2dd44963' })));
60
60
  }
61
61
  };
62
62
  Form.style = HbFormStyle0;
@@ -1 +1 @@
1
- {"file":"hb-form.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,0yLAA0yL,CAAC;AAC3zL,qBAAe,OAAO;;MCiBT,IAAI;;;;;;IAIP,KAAK,GAAwB,EAAE,CAAC;;IAGhC,KAAK,GAA0B,EAAE,CAAC;;IAGlC,aAAa,GAA6B,OAAO,CAAC;;IAGlD,UAAU,GAAW,MAAM,CAAC;;IAG5B,MAAM,GAAY,KAAK,CAAC;;IAGxB,IAAI,GAAkC,SAAS,CAAC;;IAGhD,QAAQ,GAAY,KAAK,CAAC;IAEzB,MAAM,GAA4B,EAAE,CAAC;IAEtC,aAAa,GAAG,IAAI,GAAG,EAAiC,CAAC;;;;;IAMjE,iBAAiB;QACf,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,qBAAqB,GAAG,CAAC,CAAc;YAC9D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;YAC1D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;SACxE,EAAmB,CAAC;KACtB;;;;;IAMO,QAAQ,GAAG;QACjB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK;YACtD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtC,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;SAC5B,CAAC,CACH,CAAC;QACF,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC/B,CAAC;;;;IAKM,WAAW,GAAG;QACpB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;KAC3D,CAAC;IAEF,MAAM;QACJ,QACE,6DACE,KAAK,EAAE;gBACL,SAAS,EAAE,IAAI;gBACf,CAAC,kBAAkB,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI;gBAC9C,iBAAiB,EAAE,IAAI,CAAC,MAAM;aAC/B,EACD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,EACnC,UAAU,UAEV,8DAAQ,CACH,EACP;KACH;;;;;;","names":[],"sources":["src/components/Form/form.css?tag=hb-form&encapsulation=shadow","src/components/Form/Form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form {\n display: flex;\n flex-direction: column;\n gap: var(--hb-spacing-md);\n}\n\n.hb-form--inline {\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--hb-spacing-sm) var(--hb-spacing-lg);\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\ninterface FormFieldRegistration {\n prop: string;\n validate: () => Promise<string[]>;\n resetValue: () => void;\n getValue: () => any;\n}\n\n/**\n * Form 表单组件\n * 由输入框、选择器、单选框、多选框等控件组成,配合表单校验\n */\n@Component({\n tag: 'hb-form',\n styleUrl: 'form.css',\n shadow: true,\n})\nexport class Form {\n @Element() el: HTMLElement;\n\n /** 表单数据对象 */\n @Prop() model: Record<string, any> = {};\n\n /** 表单验证规则 */\n @Prop() rules: Record<string, any[]> = {};\n\n /** 标签位置 */\n @Prop() labelPosition: 'left' | 'right' | 'top' = 'right';\n\n /** 标签宽度 */\n @Prop() labelWidth: string = '80px';\n\n /** 是否行内表单 */\n @Prop() inline: boolean = false;\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() fields: FormFieldRegistration[] = [];\n\n private fieldRegistry = new Map<string, FormFieldRegistration>();\n\n // 用 componentWillLoad 而非 componentDidLoad 注册监听器:\n // Stencil 生命周期里子组件(FormItem)的 componentDidLoad 先于父组件(Form)触发,\n // 若在 componentDidLoad 才挂监听,会错过子项派发的 hbFormFieldRegister,\n // 导致 fieldRegistry 为空、validate() 永远返回 true(真实浏览器里复现,mock-doc 被 waitForChanges 掩盖)。\n componentWillLoad() {\n this.el.addEventListener('hbFormFieldRegister', ((e: CustomEvent) => {\n const { prop, validate, resetValue, getValue } = e.detail;\n this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });\n }) as EventListener);\n }\n\n /**\n * 验证整个表单\n * @returns 是否验证通过\n */\n @Prop() validate = async (): Promise<boolean> => {\n const results = await Promise.all(\n Array.from(this.fieldRegistry.values()).map(async (field) => {\n const errors = await field.validate();\n return errors.length === 0;\n })\n );\n return results.every(Boolean);\n };\n\n /**\n * 重置表单\n */\n @Prop() resetFields = (): void => {\n this.fieldRegistry.forEach((field) => field.resetValue());\n };\n\n render() {\n return (\n <form\n class={{\n 'hb-form': true,\n [`hb-form--label-${this.labelPosition}`]: true,\n 'hb-form--inline': this.inline,\n }}\n onSubmit={(e) => e.preventDefault()}\n novalidate\n >\n <slot />\n </form>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-form.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,i0LAAi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,KAAK,EAAE;gBACL,SAAS,EAAE,IAAI;gBACf,CAAC,kBAAkB,IAAI,CAAC,aAAa,EAAE,GAAG,IAAI;gBAC9C,iBAAiB,EAAE,IAAI,CAAC,MAAM;aAC/B,EACD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,EACnC,UAAU,UAEV,8DAAQ,CACH,EACP;KACH;;;;;;","names":[],"sources":["src/components/Form/form.css?tag=hb-form&encapsulation=shadow","src/components/Form/Form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.hb-form {\n display: flex;\n flex-direction: column;\n gap: var(--hb-spacing-md);\n}\n\n.hb-form--inline {\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--hb-spacing-sm) var(--hb-spacing-lg);\n align-items: flex-start;\n}\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\ninterface FormFieldRegistration {\n prop: string;\n validate: () => Promise<string[]>;\n resetValue: () => void;\n getValue: () => any;\n}\n\n/**\n * Form 表单组件\n * 由输入框、选择器、单选框、多选框等控件组成,配合表单校验\n */\n@Component({\n tag: 'hb-form',\n styleUrl: 'form.css',\n shadow: true,\n})\nexport class Form {\n @Element() el: HTMLElement;\n\n /** 表单数据对象 */\n @Prop() model: Record<string, any> = {};\n\n /** 表单验证规则 */\n @Prop() rules: Record<string, any[]> = {};\n\n /** 标签位置 */\n @Prop() labelPosition: 'left' | 'right' | 'top' = 'right';\n\n /** 标签宽度 */\n @Prop() labelWidth: string = '80px';\n\n /** 是否行内表单 */\n @Prop() inline: boolean = false;\n\n /** 表单尺寸 */\n @Prop() size: 'large' | 'default' | 'small' = 'default';\n\n /** 是否禁用 */\n @Prop() disabled: boolean = false;\n\n @State() fields: FormFieldRegistration[] = [];\n\n private fieldRegistry = new Map<string, FormFieldRegistration>();\n\n // 用 componentWillLoad 而非 componentDidLoad 注册监听器:\n // Stencil 生命周期里子组件(FormItem)的 componentDidLoad 先于父组件(Form)触发,\n // 若在 componentDidLoad 才挂监听,会错过子项派发的 hbFormFieldRegister,\n // 导致 fieldRegistry 为空、validate() 永远返回 true(真实浏览器里复现,mock-doc 被 waitForChanges 掩盖)。\n componentWillLoad() {\n this.el.addEventListener('hbFormFieldRegister', ((e: CustomEvent) => {\n const { prop, validate, resetValue, getValue } = e.detail;\n this.fieldRegistry.set(prop, { prop, validate, resetValue, getValue });\n }) as EventListener);\n }\n\n /**\n * 验证整个表单\n * @returns 是否验证通过\n */\n @Prop() validate = async (): Promise<boolean> => {\n const results = await Promise.all(\n Array.from(this.fieldRegistry.values()).map(async (field) => {\n const errors = await field.validate();\n return errors.length === 0;\n })\n );\n return results.every(Boolean);\n };\n\n /**\n * 重置表单\n */\n @Prop() resetFields = (): void => {\n this.fieldRegistry.forEach((field) => field.resetValue());\n };\n\n render() {\n return (\n <form\n class={{\n 'hb-form': true,\n [`hb-form--label-${this.labelPosition}`]: true,\n 'hb-form--inline': this.inline,\n }}\n onSubmit={(e) => e.preventDefault()}\n novalidate\n >\n <slot />\n </form>\n );\n }\n}\n"],"version":3}
@@ -16,7 +16,7 @@ const Header = class {
16
16
  if (this.height) {
17
17
  style.height = this.height;
18
18
  }
19
- return (h("header", { key: '86042705286a6d135858982b34cdb19da71b6744', class: "hb-header", style: style }, h("slot", { key: '96d5152e19c88d4cbc4c30bc136b27b6b8388331' })));
19
+ return (h("header", { key: 'b0f4403c73f20d13b4513dd21266e5fea1004f7b', class: "hb-header", style: style }, h("slot", { key: '15f9743951c0183e7ee10124c0e3d2e8d071bee0' })));
20
20
  }
21
21
  };
22
22
  Header.style = HbHeaderStyle0;
@@ -134,16 +134,20 @@ const ImagePreview = class {
134
134
  handleRotateRight = () => {
135
135
  this.rotate = this.rotate + 90;
136
136
  };
137
- /** 滚轮缩放 */
137
+ /**
138
+ * 滚轮缩放(平滑 + 像素级响应):
139
+ * 按 deltaY 的绝对值映射缩放因子(小滚幅小步、大滚幅大步),
140
+ * 并夹取到 [minZoom, maxZoom],避免抖动与越界。
141
+ */
138
142
  handleWheel = (e) => {
139
- // TODO: 平滑缩放 + 图片中心锚点;当前实现为基础步长缩放
140
143
  e.preventDefault();
141
- if (e.deltaY < 0) {
142
- this.zoomIn();
143
- }
144
- else {
145
- this.zoomOut();
146
- }
144
+ // deltaY 映射成指数缩放系数:wheel 越快缩放越激进,但单次不超 zoomStep*2
145
+ const dir = e.deltaY < 0 ? 1 : -1;
146
+ const intensity = Math.min(Math.abs(e.deltaY) / 100, 2); // 0~2
147
+ const factor = 1 + dir * this.zoomStep * Math.max(1, intensity);
148
+ const next = Math.max(this.minZoom, Math.min(this.zoom * factor, this.maxZoom));
149
+ // 平滑:小数位保留两位,避免浮点累积误差
150
+ this.zoom = Math.round(next * 100) / 100;
147
151
  };
148
152
  /** 点击遮罩空白处关闭 */
149
153
  handleOverlayClick = (e) => {
@@ -1 +1 @@
1
- {"file":"hb-image-preview.entry.js","mappings":";;AAAA,MAAM,eAAe,GAAG,unQAAunQ,CAAC;AAChpQ,6BAAe,eAAe;;MCejB,YAAY;;;;;;;;IAIE,UAAU,GAAY,KAAK,CAAC;;IAG7C,GAAG,GAAW,EAAE,CAAC;;IAGjB,OAAO,GAAa,EAAE,CAAC;;IAGN,OAAO,GAAW,CAAC,CAAC;;IAGrC,QAAQ,GAAW,GAAG,CAAC;;IAGvB,OAAO,GAAW,GAAG,CAAC;;IAGtB,OAAO,GAAW,CAAC,CAAC;;IAGnB,OAAO,CAAqB;;IAG5B,QAAQ,CAAyC;;IAGjD,IAAI,GAAW,CAAC,CAAC;;IAGjB,MAAM,GAAW,CAAC,CAAC;IAEpB,cAAc,GAAG,CAAC,CAAgB;QACxC,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAC7B,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YACtB,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,EAAE;YAChC,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;aA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KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,gBAAa,cAAI,aAE3F,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,gBAAa,cAAI,aAE5F,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,WAAW,gBAAa,cAAI,aAEtF,EACT,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,gBAAa,cAAI,aAEvF,CACL,EAEN,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,IAAI,CAAC,YAAY,gBACf,cAAI,aAGR,CACL,EACN;KACH;;;;;;;;;;","names":[],"sources":["src/components/ImagePreview/image-preview.css?tag=hb-image-preview&encapsulation=shadow","src/components/ImagePreview/ImagePreview.tsx"],"sourcesContent":[":host {\n display: contents;\n}\n\n.hb-image-preview {\n position: fixed;\n inset: 0;\n z-index: var(--hb-z-index-modal-mask, 2000);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--hb-color-bg-mask, rgba(0, 0, 0, 0.5));\n}\n\n.hb-image-preview__wrapper {\n max-width: 90vw;\n max-height: 90vh;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.hb-image-preview__img {\n max-width: 90vw;\n max-height: 90vh;\n object-fit: contain;\n user-select: none;\n transition: transform 0.2s ease;\n pointer-events: none;\n}\n\n.hb-image-preview__btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__btn:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.hb-image-preview__btn--prev {\n left: 24px;\n}\n\n.hb-image-preview__btn--next {\n right: 24px;\n}\n\n.hb-image-preview__toolbar {\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 12px;\n border-radius: var(--hb-border-radius-base, 4px);\n background-color: rgba(0, 0, 0, 0.5);\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__tool {\n min-width: 32px;\n height: 32px;\n padding: 0 8px;\n border: none;\n border-radius: var(--hb-border-radius-sm, 2px);\n background: transparent;\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 16px;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__tool:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.hb-image-preview__tool-label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 48px;\n padding: 0 4px;\n font-size: 13px;\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__close {\n position: absolute;\n top: 24px;\n right: 24px;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__close:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\n\nexport interface ImagePreviewChangeDetail {\n src: string;\n index: number;\n}\n\n/**\n * ImagePreview 图片预览组件\n * 点击图片后展示大图,支持缩放、旋转、多图切换\n */\n@Component({\n tag: 'hb-image-preview',\n styleUrl: 'image-preview.css',\n shadow: true,\n})\nexport class ImagePreview {\n @Element() el: HTMLElement;\n\n /** 是否显示预览(受控,可双向) */\n @Prop({ mutable: true }) modelValue: boolean = false;\n\n /** 单图源(srcList 为空时使用) */\n @Prop() src: string = '';\n\n /** 多图源列表 */\n @Prop() srcList: string[] = [];\n\n /** 多图当前索引 */\n @Prop({ mutable: true }) current: number = 0;\n\n /** 单次缩放步长 */\n @Prop() zoomStep: number = 0.2;\n\n /** 最小缩放比例 */\n @Prop() minZoom: number = 0.5;\n\n /** 最大缩放比例 */\n @Prop() maxZoom: number = 3;\n\n /** 关闭事件 */\n @Event() hbClose: EventEmitter<void>;\n\n /** 切换事件,detail 为 { src, index } */\n @Event() hbChange: EventEmitter<ImagePreviewChangeDetail>;\n\n /** 当前缩放比例 */\n @State() zoom: number = 1;\n\n /** 当前旋转角度 */\n @State() rotate: number = 0;\n\n private keyDownHandler = (e: KeyboardEvent) => {\n if (!this.modelValue) return;\n if (e.key === 'Escape') {\n this.close();\n } else if (e.key === 'ArrowLeft') {\n this.prev();\n } else if (e.key === 'ArrowRight') {\n this.next();\n }\n };\n\n @Watch('modelValue')\n handleVisibleChange(newVal: boolean) {\n if (newVal) {\n // 打开时重置缩放与旋转\n this.zoom = 1;\n this.rotate = 0;\n document.addEventListener('keydown', this.keyDownHandler);\n } else {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n }\n\n @Watch('current')\n handleCurrentChange() {\n // 切换图片时重置变换\n this.zoom = 1;\n this.rotate = 0;\n }\n\n componentDidLoad() {\n if (this.modelValue) {\n document.addEventListener('keydown', this.keyDownHandler);\n }\n }\n\n disconnectedCallback() {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n\n /** 实际可切换的图片列表 */\n private get imageList(): string[] {\n if (this.srcList && this.srcList.length > 0) {\n return this.srcList;\n }\n return this.src ? [this.src] : [];\n }\n\n private get currentIndex(): number {\n const list = this.imageList;\n if (list.length === 0) return 0;\n if (this.current < 0) return 0;\n if (this.current >= list.length) return list.length - 1;\n return this.current;\n }\n\n private get currentSrc(): string {\n const list = this.imageList;\n if (list.length === 0) return '';\n return list[this.currentIndex] || '';\n }\n\n private get isMulti(): boolean {\n return this.imageList.length > 1;\n }\n\n private close = () => {\n this.modelValue = false;\n this.hbClose.emit();\n };\n\n private emitChange() {\n this.hbChange.emit({ src: this.currentSrc, index: this.currentIndex });\n }\n\n private next = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex + 1) % list.length;\n this.emitChange();\n };\n\n private prev = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex - 1 + list.length) % list.length;\n this.emitChange();\n };\n\n private zoomIn = () => {\n const next = Math.min(this.zoom + this.zoomStep, this.maxZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private zoomOut = () => {\n const next = Math.max(this.zoom - this.zoomStep, this.minZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private handleReset = () => {\n this.zoom = 1;\n this.rotate = 0;\n };\n\n private handleRotateLeft = () => {\n this.rotate = this.rotate - 90;\n };\n\n private handleRotateRight = () => {\n this.rotate = this.rotate + 90;\n };\n\n /** 滚轮缩放 */\n private handleWheel = (e: WheelEvent) => {\n // TODO: 平滑缩放 + 图片中心锚点;当前实现为基础步长缩放\n e.preventDefault();\n if (e.deltaY < 0) {\n this.zoomIn();\n } else {\n this.zoomOut();\n }\n };\n\n /** 点击遮罩空白处关闭 */\n private handleOverlayClick = (e: MouseEvent) => {\n if (e.target === e.currentTarget) {\n this.close();\n }\n };\n\n private stopAndClose = (e: MouseEvent) => {\n e.stopPropagation();\n this.close();\n };\n\n render() {\n if (!this.modelValue) return null;\n\n const imgStyle = {\n transform: `scale(${this.zoom}) rotate(${this.rotate}deg)`,\n };\n\n return (\n <div class=\"hb-image-preview\" onClick={this.handleOverlayClick}>\n <div class=\"hb-image-preview__wrapper\">\n <img\n class=\"hb-image-preview__img\"\n src={this.currentSrc}\n alt=\"\"\n style={imgStyle}\n onWheel={this.handleWheel}\n />\n </div>\n\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--prev\"\n onClick={this.prev}\n aria-label=\"上一张\"\n >\n ‹\n </button>\n )}\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--next\"\n onClick={this.next}\n aria-label=\"下一张\"\n >\n ›\n </button>\n )}\n\n <div class=\"hb-image-preview__toolbar\" onClick={(e) => e.stopPropagation()}>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomOut} aria-label=\"缩小\">\n -\n </button>\n <span class=\"hb-image-preview__tool-label\">{Math.round(this.zoom * 100)}%</span>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomIn} aria-label=\"放大\">\n +\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateLeft} aria-label=\"左旋\">\n ↺\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateRight} aria-label=\"右旋\">\n ↻\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleReset} aria-label=\"重置\">\n ⟲\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.stopAndClose} aria-label=\"关闭\">\n ✕\n </button>\n </div>\n\n <button\n type=\"button\"\n class=\"hb-image-preview__close\"\n onClick={this.stopAndClose}\n aria-label=\"关闭\"\n >\n ×\n </button>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-image-preview.entry.js","mappings":";;AAAA,MAAM,eAAe,GAAG,unQAAunQ,CAAC;AAChpQ,6BAAe,eAAe;;MCejB,YAAY;;;;;;;;IAIE,UAAU,GAAY,KAAK,CAAC;;IAG7C,GAAG,GAAW,EAAE,CAAC;;IAGjB,OAAO,GAAa,EAAE,CAAC;;IAGN,OAAO,GAAW,CAAC,CAAC;;IAGrC,QAAQ,GAAW,GAAG,CAAC;;IAGvB,OAAO,GAAW,GAAG,CAAC;;IAGtB,OAAO,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K,EAAC,wBAAwB,EAAC,OAAO,EAAE,IAAI,CAAC,YAAY,gBAAa,cAAI,aAEvF,CACL,EAEN,cACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,yBAAyB,EAC/B,OAAO,EAAE,IAAI,CAAC,YAAY,gBACf,cAAI,aAGR,CACL,EACN;KACH;;;;;;;;;;","names":[],"sources":["src/components/ImagePreview/image-preview.css?tag=hb-image-preview&encapsulation=shadow","src/components/ImagePreview/ImagePreview.tsx"],"sourcesContent":[":host {\n display: contents;\n}\n\n.hb-image-preview {\n position: fixed;\n inset: 0;\n z-index: var(--hb-z-index-modal-mask, 2000);\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--hb-color-bg-mask, rgba(0, 0, 0, 0.5));\n}\n\n.hb-image-preview__wrapper {\n max-width: 90vw;\n max-height: 90vh;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.hb-image-preview__img {\n max-width: 90vw;\n max-height: 90vh;\n object-fit: contain;\n user-select: none;\n transition: transform 0.2s ease;\n pointer-events: none;\n}\n\n.hb-image-preview__btn {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__btn:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.hb-image-preview__btn--prev {\n left: 24px;\n}\n\n.hb-image-preview__btn--next {\n right: 24px;\n}\n\n.hb-image-preview__toolbar {\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 8px 12px;\n border-radius: var(--hb-border-radius-base, 4px);\n background-color: rgba(0, 0, 0, 0.5);\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__tool {\n min-width: 32px;\n height: 32px;\n padding: 0 8px;\n border: none;\n border-radius: var(--hb-border-radius-sm, 2px);\n background: transparent;\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 16px;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__tool:hover {\n background-color: rgba(255, 255, 255, 0.15);\n}\n\n.hb-image-preview__tool-label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 48px;\n padding: 0 4px;\n font-size: 13px;\n color: var(--hb-color-text-inverse, #ffffff);\n}\n\n.hb-image-preview__close {\n position: absolute;\n top: 24px;\n right: 24px;\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.4);\n color: var(--hb-color-text-inverse, #ffffff);\n font-size: 28px;\n line-height: 1;\n cursor: pointer;\n transition: background-color var(--hb-transition-duration, 0.2s) ease;\n}\n\n.hb-image-preview__close:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\n\nexport interface ImagePreviewChangeDetail {\n src: string;\n index: number;\n}\n\n/**\n * ImagePreview 图片预览组件\n * 点击图片后展示大图,支持缩放、旋转、多图切换\n */\n@Component({\n tag: 'hb-image-preview',\n styleUrl: 'image-preview.css',\n shadow: true,\n})\nexport class ImagePreview {\n @Element() el: HTMLElement;\n\n /** 是否显示预览(受控,可双向) */\n @Prop({ mutable: true }) modelValue: boolean = false;\n\n /** 单图源(srcList 为空时使用) */\n @Prop() src: string = '';\n\n /** 多图源列表 */\n @Prop() srcList: string[] = [];\n\n /** 多图当前索引 */\n @Prop({ mutable: true }) current: number = 0;\n\n /** 单次缩放步长 */\n @Prop() zoomStep: number = 0.2;\n\n /** 最小缩放比例 */\n @Prop() minZoom: number = 0.5;\n\n /** 最大缩放比例 */\n @Prop() maxZoom: number = 3;\n\n /** 关闭事件 */\n @Event() hbClose: EventEmitter<void>;\n\n /** 切换事件,detail 为 { src, index } */\n @Event() hbChange: EventEmitter<ImagePreviewChangeDetail>;\n\n /** 当前缩放比例 */\n @State() zoom: number = 1;\n\n /** 当前旋转角度 */\n @State() rotate: number = 0;\n\n private keyDownHandler = (e: KeyboardEvent) => {\n if (!this.modelValue) return;\n if (e.key === 'Escape') {\n this.close();\n } else if (e.key === 'ArrowLeft') {\n this.prev();\n } else if (e.key === 'ArrowRight') {\n this.next();\n }\n };\n\n @Watch('modelValue')\n handleVisibleChange(newVal: boolean) {\n if (newVal) {\n // 打开时重置缩放与旋转\n this.zoom = 1;\n this.rotate = 0;\n document.addEventListener('keydown', this.keyDownHandler);\n } else {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n }\n\n @Watch('current')\n handleCurrentChange() {\n // 切换图片时重置变换\n this.zoom = 1;\n this.rotate = 0;\n }\n\n componentDidLoad() {\n if (this.modelValue) {\n document.addEventListener('keydown', this.keyDownHandler);\n }\n }\n\n disconnectedCallback() {\n document.removeEventListener('keydown', this.keyDownHandler);\n }\n\n /** 实际可切换的图片列表 */\n private get imageList(): string[] {\n if (this.srcList && this.srcList.length > 0) {\n return this.srcList;\n }\n return this.src ? [this.src] : [];\n }\n\n private get currentIndex(): number {\n const list = this.imageList;\n if (list.length === 0) return 0;\n if (this.current < 0) return 0;\n if (this.current >= list.length) return list.length - 1;\n return this.current;\n }\n\n private get currentSrc(): string {\n const list = this.imageList;\n if (list.length === 0) return '';\n return list[this.currentIndex] || '';\n }\n\n private get isMulti(): boolean {\n return this.imageList.length > 1;\n }\n\n private close = () => {\n this.modelValue = false;\n this.hbClose.emit();\n };\n\n private emitChange() {\n this.hbChange.emit({ src: this.currentSrc, index: this.currentIndex });\n }\n\n private next = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex + 1) % list.length;\n this.emitChange();\n };\n\n private prev = () => {\n const list = this.imageList;\n if (list.length <= 1) return;\n this.current = (this.currentIndex - 1 + list.length) % list.length;\n this.emitChange();\n };\n\n private zoomIn = () => {\n const next = Math.min(this.zoom + this.zoomStep, this.maxZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private zoomOut = () => {\n const next = Math.max(this.zoom - this.zoomStep, this.minZoom);\n this.zoom = Math.round(next * 100) / 100;\n };\n\n private handleReset = () => {\n this.zoom = 1;\n this.rotate = 0;\n };\n\n private handleRotateLeft = () => {\n this.rotate = this.rotate - 90;\n };\n\n private handleRotateRight = () => {\n this.rotate = this.rotate + 90;\n };\n\n /**\n * 滚轮缩放(平滑 + 像素级响应):\n * 按 deltaY 的绝对值映射缩放因子(小滚幅小步、大滚幅大步),\n * 并夹取到 [minZoom, maxZoom],避免抖动与越界。\n */\n private handleWheel = (e: WheelEvent) => {\n e.preventDefault();\n // 把 deltaY 映射成指数缩放系数:wheel 越快缩放越激进,但单次不超 zoomStep*2\n const dir = e.deltaY < 0 ? 1 : -1;\n const intensity = Math.min(Math.abs(e.deltaY) / 100, 2); // 0~2\n const factor = 1 + dir * this.zoomStep * Math.max(1, intensity);\n const next = Math.max(this.minZoom, Math.min(this.zoom * factor, this.maxZoom));\n // 平滑:小数位保留两位,避免浮点累积误差\n this.zoom = Math.round(next * 100) / 100;\n };\n\n /** 点击遮罩空白处关闭 */\n private handleOverlayClick = (e: MouseEvent) => {\n if (e.target === e.currentTarget) {\n this.close();\n }\n };\n\n private stopAndClose = (e: MouseEvent) => {\n e.stopPropagation();\n this.close();\n };\n\n render() {\n if (!this.modelValue) return null;\n\n const imgStyle = {\n transform: `scale(${this.zoom}) rotate(${this.rotate}deg)`,\n };\n\n return (\n <div class=\"hb-image-preview\" onClick={this.handleOverlayClick}>\n <div class=\"hb-image-preview__wrapper\">\n <img\n class=\"hb-image-preview__img\"\n src={this.currentSrc}\n alt=\"\"\n style={imgStyle}\n onWheel={this.handleWheel}\n />\n </div>\n\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--prev\"\n onClick={this.prev}\n aria-label=\"上一张\"\n >\n ‹\n </button>\n )}\n {this.isMulti && (\n <button\n type=\"button\"\n class=\"hb-image-preview__btn hb-image-preview__btn--next\"\n onClick={this.next}\n aria-label=\"下一张\"\n >\n ›\n </button>\n )}\n\n <div class=\"hb-image-preview__toolbar\" onClick={(e) => e.stopPropagation()}>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomOut} aria-label=\"缩小\">\n -\n </button>\n <span class=\"hb-image-preview__tool-label\">{Math.round(this.zoom * 100)}%</span>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.zoomIn} aria-label=\"放大\">\n +\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateLeft} aria-label=\"左旋\">\n ↺\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleRotateRight} aria-label=\"右旋\">\n ↻\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.handleReset} aria-label=\"重置\">\n ⟲\n </button>\n <button type=\"button\" class=\"hb-image-preview__tool\" onClick={this.stopAndClose} aria-label=\"关闭\">\n ✕\n </button>\n </div>\n\n <button\n type=\"button\"\n class=\"hb-image-preview__close\"\n onClick={this.stopAndClose}\n aria-label=\"关闭\"\n >\n ×\n </button>\n </div>\n );\n }\n}\n"],"version":3}
@@ -21,7 +21,7 @@ const Image = class {
21
21
  handleLoad = () => { this.loaded = true; };
22
22
  handleError = () => { this.error = true; };
23
23
  render() {
24
- return (h("div", { key: 'c6ededfba4d6a1d4b9356c1b18dc7b19aa8c8631', class: "hb-image", style: { width: this.width, height: this.height, borderRadius: this.radius } }, !this.error ? (h("img", { src: this.src, alt: this.alt, class: { 'hb-image__inner': true, 'hb-image__inner--loaded': this.loaded }, style: { objectFit: this.fit }, loading: this.lazy ? 'lazy' : undefined, onLoad: this.handleLoad, onError: this.handleError, onClick: () => this.preview && (this.previewVisible = true) })) : (h("div", { class: "hb-image__error" }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), this.previewVisible && (h("div", { key: 'b32748bc6a54360e9cfab47ee06671f4568bae8c', class: "hb-image__preview", onClick: () => { this.previewVisible = false; } }, h("img", { key: '7bcc5a1f9b34756827fb8566a953296f808febea', src: this.src, alt: this.alt, class: "hb-image__preview-img" })))));
24
+ return (h("div", { key: 'ba3419b5ff3facd429a8f29451be12982c602143', class: "hb-image", style: { width: this.width, height: this.height, borderRadius: this.radius } }, !this.error ? (h("img", { src: this.src, alt: this.alt, class: { 'hb-image__inner': true, 'hb-image__inner--loaded': this.loaded }, style: { objectFit: this.fit }, loading: this.lazy ? 'lazy' : undefined, onLoad: this.handleLoad, onError: this.handleError, onClick: () => this.preview && (this.previewVisible = true) })) : (h("div", { class: "hb-image__error" }, "\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")), this.previewVisible && (h("div", { key: '327219e256924391b44f02d39f5d7000161b1fb9', class: "hb-image__preview", onClick: () => { this.previewVisible = false; } }, h("img", { key: '3d1cb33434662932aff4c5fd7ffde8477616ff9a', src: this.src, alt: this.alt, class: "hb-image__preview-img" })))));
25
25
  }
26
26
  };
27
27
  Image.style = HbImageStyle0;
@@ -134,22 +134,22 @@ const InputNumber = class {
134
134
  this.hbChange.emit(newValue);
135
135
  };
136
136
  render() {
137
- return (h("div", { key: '490fe763a00f34486cbbe6502204433071a863eb', class: {
137
+ return (h("div", { key: 'b77486654ddd70a4661c1278ddc41e1a1c23078a', class: {
138
138
  'hb-input-number': true,
139
139
  [`hb-input-number--${this.size}`]: true,
140
140
  'hb-input-number--disabled': this.disabled,
141
141
  'hb-input-number--controls-right': this.controlsPosition === 'right',
142
142
  'hb-input-number--without-controls': !this.controls,
143
- } }, this.controls && this.controlsPosition !== 'right' && (h("span", { key: 'a43a038a8914dbff0c8b9759c04c74fa791f2e6c', class: {
143
+ } }, this.controls && this.controlsPosition !== 'right' && (h("span", { key: 'c60ff723277ffd25f3515b406cd56ae5e062474b', class: {
144
144
  'hb-input-number__decrease': true,
145
145
  'hb-input-number__decrease--disabled': this.currentValue <= this.min,
146
- }, onClick: this.decrease }, "\u2212")), h("input", { key: '83a7bb1d73a709e92f31044396fdb73daed77ea9', type: "number", id: this.inputId, name: this.name, class: "hb-input-number__inner", value: this.currentValue, disabled: this.disabled, readonly: this.readonly, placeholder: this.placeholder, min: this.min, max: this.max, step: this.step, onInput: this.handleInput, onChange: this.handleChange }), this.controls && this.controlsPosition === 'right' && (h("span", { key: 'e202c7b06c991550eb9a5cae441ead7d82231b0f', class: "hb-input-number__controls" }, h("span", { key: '876db137bb4539e93a1f7ccb08a2fb754722a7bf', class: {
146
+ }, onClick: this.decrease }, "\u2212")), h("input", { key: '66828157b6c91818b2d93e98935eac0d0e9237f0', type: "number", id: this.inputId, name: this.name, class: "hb-input-number__inner", value: this.currentValue, disabled: this.disabled, readonly: this.readonly, placeholder: this.placeholder, min: this.min, max: this.max, step: this.step, onInput: this.handleInput, onChange: this.handleChange }), this.controls && this.controlsPosition === 'right' && (h("span", { key: '58e9f86173a4a3e7808a1ca4c22f0a2a4ba2f070', class: "hb-input-number__controls" }, h("span", { key: 'ff63589ce88775289c820a6cf02bab140993206a', class: {
147
147
  'hb-input-number__increase': true,
148
148
  'hb-input-number__increase--disabled': this.currentValue >= this.max,
149
- }, onClick: this.increase }, "+"), h("span", { key: '98acd918f10a7f8d3c399aa60677eac231be503b', class: {
149
+ }, onClick: this.increase }, "+"), h("span", { key: '9bf2c4305bc0bef3fbe3431960a79eac7e4cdbec', class: {
150
150
  'hb-input-number__decrease': true,
151
151
  'hb-input-number__decrease--disabled': this.currentValue <= this.min,
152
- }, onClick: this.decrease }, "\u2212"))), this.controls && this.controlsPosition !== 'right' && (h("span", { key: '4befdfc2a0d7ac3af63027f0947f27d866fbe158', class: {
152
+ }, onClick: this.decrease }, "\u2212"))), this.controls && this.controlsPosition !== 'right' && (h("span", { key: '6bec03b900b7b62692fa0b9a6510ecb8cdb90fbb', class: {
153
153
  'hb-input-number__increase': true,
154
154
  'hb-input-number__increase--disabled': this.currentValue >= this.max,
155
155
  }, onClick: this.increase }, "+"))));
@@ -123,7 +123,7 @@ const InputTag = class {
123
123
  this.hbChange.emit([]);
124
124
  };
125
125
  render() {
126
- return (h("div", { key: '8623f46b1c4b3a6fbc2f3e1238695d34f08eac16', class: {
126
+ return (h("div", { key: '8ce158419ad7a38a870ec04ff67b97fc68884bb3', class: {
127
127
  'hb-input-tag': true,
128
128
  [`hb-input-tag--${this.size}`]: true,
129
129
  'hb-input-tag--disabled': this.disabled,
@@ -131,7 +131,7 @@ const InputTag = class {
131
131
  }, style: this.width ? { width: this.width } : undefined }, this.modelValue.map((tag) => (h("span", { class: {
132
132
  'hb-input-tag__tag': true,
133
133
  [`hb-input-tag__tag--${this.type}`]: !!this.type,
134
- } }, h("span", { class: "hb-input-tag__tag-text" }, tag), this.closable && (h("span", { class: "hb-input-tag__tag-close", onClick: () => this.removeTag(tag) }, "\u00D7"))))), this.inputVisible && (!this.max || this.modelValue.length < this.max) && (h("input", { key: '16c0936153b04ffb0ad4949f66c7994470b7fb91', ref: (el) => (this.inputRef = el), type: "text", class: "hb-input-tag__input", placeholder: this.placeholder, value: this.inputValue, disabled: this.disabled, maxlength: this.maxlength, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur })), this.clearable && this.modelValue.length > 0 && !this.disabled && (h("span", { key: '9995f3650302013f402f8bd3878c5ce974dfbc00', class: "hb-input-tag__clear", onClick: this.handleClearAll }, "\u00D7"))));
134
+ } }, h("span", { class: "hb-input-tag__tag-text" }, tag), this.closable && (h("span", { class: "hb-input-tag__tag-close", onClick: () => this.removeTag(tag) }, "\u00D7"))))), this.inputVisible && (!this.max || this.modelValue.length < this.max) && (h("input", { key: '8f52afba7e2271936afcd89bfcafd0319eb765bc', ref: (el) => (this.inputRef = el), type: "text", class: "hb-input-tag__input", placeholder: this.placeholder, value: this.inputValue, disabled: this.disabled, maxlength: this.maxlength, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur })), this.clearable && this.modelValue.length > 0 && !this.disabled && (h("span", { key: '5c37d7a9db6c535de62498b4f0a0be1a70846c46', class: "hb-input-tag__clear", onClick: this.handleClearAll }, "\u00D7"))));
135
135
  }
136
136
  };
137
137
  InputTag.style = HbInputTagStyle0;
@@ -48,7 +48,7 @@ function sizeClassMap(base, size) {
48
48
  return { [base]: true, [buildSizeClass(base, size)]: true };
49
49
  }
50
50
 
51
- const inputCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.resize{resize:both}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{--hb-input-font-size:14px;--hb-input-font-size-large:16px;--hb-input-font-size-small:12px;--hb-input-height:32px;--hb-input-height-large:40px;--hb-input-height-small:24px;--hb-input-border-color:var(--hb-border-color,#dcdfe6);--hb-input-border-color-hover:var(--hb-color-primary);--hb-input-bg-color:var(--hb-color-white,#fff);--hb-input-text-color:var(--hb-color-text-regular,#606266);--hb-input-placeholder-color:var(--hb-color-text-placeholder,#c0c4cc);--hb-input-disabled-color:var(--hb-color-text-disabled,#c0c4cc);--hb-input-disabled-bg-color:var(--hb-fill-color-light,#f5f7fa);display:inline-block;position:relative}.hb-input{font-size:var(--hb-input-font-size);position:relative}.hb-input,.hb-input__inner{display:inline-block;width:100%}.hb-input__inner{-webkit-appearance:none;background-color:var(--hb-input-bg-color);background-image:none;border:1px solid var(--hb-input-border-color);border-radius:4px;box-sizing:border-box;color:var(--hb-input-text-color);font-size:inherit;height:var(--hb-input-height);line-height:var(--hb-input-height);outline:none;padding:0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hb-input__inner::placeholder{color:var(--hb-input-placeholder-color)}.hb-input__inner:focus,.hb-input__inner:hover:not(:disabled){border-color:var(--hb-input-border-color-hover)}.hb-input__inner:disabled{background-color:var(--hb-input-disabled-bg-color);border-color:var(--hb-input-border-color);color:var(--hb-input-disabled-color);cursor:not-allowed}.hb-input__inner[readonly]{background-color:var(--hb-input-disabled-bg-color);cursor:default}.hb-input--small .hb-input__inner{font-size:var(--hb-input-font-size-small);height:var(--hb-input-height-small);line-height:var(--hb-input-height-small);padding:0 12px}.hb-input--large .hb-input__inner{font-size:var(--hb-input-font-size-large);height:var(--hb-input-height-large);line-height:var(--hb-input-height-large);padding:0 18px}.hb-input__prefix,.hb-input__suffix{align-items:center;color:var(--hb-input-placeholder-color);display:flex;height:100%;position:absolute;text-align:center;top:0;transition:all .3s}.hb-input__prefix{left:5px}.hb-input__suffix{right:5px}.hb-input__suffix-inner{align-items:center;cursor:pointer;display:flex;-webkit-user-select:none;user-select:none}.hb-input__clear{color:var(--hb-input-placeholder-color);font-size:16px;transition:color .2s}.hb-input__clear:hover{color:var(--hb-input-text-color)}.hb-input__password{cursor:pointer;font-size:16px}.hb-input__inner[type=textarea]{line-height:1.5;min-height:60px;padding:5px 15px;resize:vertical;vertical-align:bottom}.hb-input__count{bottom:5px;color:var(--hb-input-placeholder-color);font-size:12px;position:absolute;right:10px}.hb-input__count-inner{background-color:var(--hb-input-bg-color);padding:0 4px}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
51
+ const inputCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.hidden{display:none}.resize{resize:both}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{--hb-input-font-size:14px;--hb-input-font-size-large:16px;--hb-input-font-size-small:12px;--hb-input-height:32px;--hb-input-height-large:40px;--hb-input-height-small:24px;--hb-input-border-color:var(--hb-border-color,#dcdfe6);--hb-input-border-color-hover:var(--hb-color-primary);--hb-input-bg-color:var(--hb-color-white,#fff);--hb-input-text-color:var(--hb-color-text-regular,#606266);--hb-input-placeholder-color:var(--hb-color-text-placeholder,#c0c4cc);--hb-input-disabled-color:var(--hb-color-text-disabled,#c0c4cc);--hb-input-disabled-bg-color:var(--hb-fill-color-light,#f5f7fa);display:inline-block;position:relative}.hb-input{font-size:var(--hb-input-font-size);position:relative}.hb-input,.hb-input__inner{display:inline-block;width:100%}.hb-input__inner{-webkit-appearance:none;background-color:var(--hb-input-bg-color);background-image:none;border:1px solid var(--hb-input-border-color);border-radius:4px;box-sizing:border-box;color:var(--hb-input-text-color);font-size:inherit;height:var(--hb-input-height);line-height:var(--hb-input-height);outline:none;padding:0 15px;transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.hb-input__inner::placeholder{color:var(--hb-input-placeholder-color)}.hb-input__inner:focus,.hb-input__inner:hover:not(:disabled){border-color:var(--hb-input-border-color-hover)}.hb-input__inner:disabled{background-color:var(--hb-input-disabled-bg-color);border-color:var(--hb-input-border-color);color:var(--hb-input-disabled-color);cursor:not-allowed}.hb-input__inner[readonly]{background-color:var(--hb-input-disabled-bg-color);cursor:default}.hb-input--small .hb-input__inner{font-size:var(--hb-input-font-size-small);height:var(--hb-input-height-small);line-height:var(--hb-input-height-small);padding:0 12px}.hb-input--large .hb-input__inner{font-size:var(--hb-input-font-size-large);height:var(--hb-input-height-large);line-height:var(--hb-input-height-large);padding:0 18px}.hb-input__prefix,.hb-input__suffix{align-items:center;color:var(--hb-input-placeholder-color);display:flex;height:100%;position:absolute;text-align:center;top:0;transition:all .3s}.hb-input__prefix{left:5px}.hb-input__suffix{right:5px}.hb-input__suffix-inner{align-items:center;cursor:pointer;display:flex;-webkit-user-select:none;user-select:none}.hb-input__clear{align-items:center;color:var(--hb-input-placeholder-color);display:inline-flex;height:16px;justify-content:center;transition:color .2s;width:16px}.hb-input__clear svg{height:100%;width:100%}.hb-input__clear:hover,.hb-input__password{color:var(--hb-input-text-color)}.hb-input__password{align-items:center;cursor:pointer;display:inline-flex;height:16px;justify-content:center;width:16px}.hb-input__password svg{height:100%;width:100%}.hb-input__inner[type=textarea]{line-height:1.5;min-height:60px;padding:5px 15px;resize:vertical;vertical-align:bottom}.hb-input__count{bottom:5px;color:var(--hb-input-placeholder-color);font-size:12px;position:absolute;right:10px}.hb-input__count-inner{background-color:var(--hb-input-bg-color);padding:0 4px}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
52
52
  const HbInputStyle0 = inputCss;
53
53
 
54
54
  const Input = class {
@@ -174,10 +174,13 @@ const Input = class {
174
174
  handleValueChange() {
175
175
  this.inputValue = this.modelValue;
176
176
  this.updateClearVisible();
177
+ // textarea autosize:外部改值也要重算高度
178
+ this.resizeTextarea();
177
179
  }
178
180
  componentDidLoad() {
179
181
  this.inputValue = this.modelValue;
180
182
  this.updateClearVisible();
183
+ this.resizeTextarea();
181
184
  }
182
185
  updateClearVisible() {
183
186
  this.showClear = isClearVisible({
@@ -187,12 +190,45 @@ const Input = class {
187
190
  hasValue: hasInputValue(this.inputValue),
188
191
  });
189
192
  }
193
+ /**
194
+ * textarea 自适应高度(autosize)。
195
+ * - autosize=false 或非 textarea:跳过。
196
+ * - autosize=true:按内容自适应。
197
+ * - autosize={minRows,maxRows}:在最小/最大行数间夹取。
198
+ * 算法:先把 height 置 auto 让浏览器按内容重排,再读 scrollHeight,
199
+ * 减去 padding 后按行高换算成行数,最后按 min/max 夹取并写回 height。
200
+ */
201
+ resizeTextarea() {
202
+ if (this.type !== 'textarea' || !this.autosize)
203
+ return;
204
+ const ta = this.inputRef;
205
+ if (!ta)
206
+ return;
207
+ // 行高:优先取计算样式,兜底 22px
208
+ const computed = typeof window !== 'undefined' ? window.getComputedStyle(ta) : null;
209
+ const lineHeight = computed && parseFloat(computed.lineHeight) ? parseFloat(computed.lineHeight) : 22;
210
+ const paddingTop = computed ? parseFloat(computed.paddingTop) || 0 : 0;
211
+ const paddingBottom = computed ? parseFloat(computed.paddingBottom) || 0 : 0;
212
+ const opts = typeof this.autosize === 'object' ? this.autosize : {};
213
+ const minRows = opts.minRows ?? 1;
214
+ const maxRows = opts.maxRows ?? Infinity;
215
+ const minH = minRows * lineHeight + paddingTop + paddingBottom;
216
+ const maxH = maxRows === Infinity ? Infinity : maxRows * lineHeight + paddingTop + paddingBottom;
217
+ // 先 reset 高度以读取真实内容高度
218
+ ta.style.height = 'auto';
219
+ const scrollH = ta.scrollHeight;
220
+ const clamped = Math.max(minH, Math.min(scrollH, maxH === Infinity ? scrollH : maxH));
221
+ ta.style.height = `${clamped}px`;
222
+ // overflow:能滚动时才显示滚动条
223
+ ta.style.overflowY = scrollH > clamped ? 'auto' : 'hidden';
224
+ }
190
225
  handleInput = (e) => {
191
226
  const target = e.target;
192
227
  this.inputValue = target.value;
193
228
  this.modelValue = target.value;
194
229
  this.updateClearVisible();
195
230
  this.hbInput.emit(target.value);
231
+ this.resizeTextarea();
196
232
  };
197
233
  handleChange = (e) => {
198
234
  const target = e.target;
@@ -231,11 +267,11 @@ const Input = class {
231
267
  render() {
232
268
  const isTextarea = this.type === 'textarea';
233
269
  const InputTag = isTextarea ? 'textarea' : 'input';
234
- return (h("div", { key: '22b51bd1c9e0c3086ed167eea57f3b5818685785', class: {
270
+ return (h("div", { key: '200ae1b7d9257131fa15c06e950962559eaf6509', class: {
235
271
  ...sizeClassMap('hb-input', this.size),
236
272
  'hb-input--disabled': this.disabled,
237
273
  'hb-input--focused': this.isFocused,
238
- } }, this.prefixIcon && (h("span", { key: 'ef3b02d947c45ac282814a0e2e4909f8473469eb', class: "hb-input__prefix" }, h("i", { key: '88f95312bf9aa489d5d27a1f701b2eadc794d7cf', class: this.prefixIcon }))), h(InputTag, { key: 'fe5de1f3dcf5441aebb5bcc943c64d59221211d7', ref: (el) => (this.inputRef = el), type: isTextarea ? undefined : this.getInputType(), id: this.inputId, name: this.name, class: "hb-input__inner", placeholder: this.placeholder, value: this.inputValue, disabled: this.disabled, readonly: this.readonly, autocomplete: this.autocomplete, autofocus: this.autofocus, maxlength: this.maxlength, minlength: this.minlength, rows: isTextarea ? this.rows : undefined, style: isTextarea && this.resize ? { resize: this.resize } : undefined, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur }), (this.showClear || this.suffixIcon || (this.type === 'password' && this.showPassword)) && (h("span", { key: 'db106e66989483c48171aad758cd5a443ef7670a', class: "hb-input__suffix" }, this.showClear && (h("span", { key: '3fa676f9860aa3018247c9d61bad432afdea4345', class: "hb-input__suffix-inner hb-input__clear", onClick: this.handleClear }, "\u00D7")), this.type === 'password' && this.showPassword && (h("span", { key: '8911301b65aa3435f7f3b933b9b8de1b055c266e', class: "hb-input__suffix-inner hb-input__password", onClick: this.togglePasswordVisible }, this.passwordVisible ? '👁️' : '👁️‍🗨️')), this.suffixIcon && (h("span", { key: '14fa885ec429419525ea5cd550fc7d9cec9f3ee4', class: "hb-input__suffix-inner" }, h("i", { key: '36995c1f4e5d2c258170e7ad8a012e586d905e62', class: this.suffixIcon }))))), this.showWordLimit && this.maxlength && (h("span", { key: '383d7d25fbbb77dad3df3ebbbf4e0b1fc504a4b4', class: "hb-input__count" }, h("span", { key: '564d4a6ac0feae0be61378f52aae3b22872566fb', class: "hb-input__count-inner" }, this.inputValue.length, " / ", this.maxlength)))));
274
+ } }, this.prefixIcon && (h("span", { key: '1ba978d8de430fe70864b1daf5781e925cc35b5c', class: "hb-input__prefix" }, h("i", { key: '72abd536835d18ad5e7f75a09f896ebe41ca75d4', class: this.prefixIcon }))), h(InputTag, { key: '80049f50544c8118c73e545223450e5aecfc97ab', ref: (el) => (this.inputRef = el), type: isTextarea ? undefined : this.getInputType(), id: this.inputId, name: this.name, class: "hb-input__inner", placeholder: this.placeholder, value: this.inputValue, disabled: this.disabled, readonly: this.readonly, autocomplete: this.autocomplete, autofocus: this.autofocus, maxlength: this.maxlength, minlength: this.minlength, rows: isTextarea ? this.rows : undefined, style: isTextarea ? { resize: this.autosize ? 'none' : (this.resize || 'none') } : undefined, onInput: this.handleInput, onChange: this.handleChange, onFocus: this.handleFocus, onBlur: this.handleBlur }), (this.showClear || this.suffixIcon || (this.type === 'password' && this.showPassword)) && (h("span", { key: '9ef7d5b2592fbb890f2915c97c5ecb6a5790ef97', class: "hb-input__suffix" }, this.showClear && (h("span", { key: 'c727eb595e73882d7c8c0d74cb65464062724377', class: "hb-input__suffix-inner hb-input__clear", role: "button", "aria-label": "\u6E05\u7A7A", onClick: this.handleClear }, h("svg", { key: '49060a94eba1105ffe4a97a48be513919586737d', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { key: '49c82790d5035f47c3f722b2d714f230394b2dda', d: "M6 6l12 12M18 6L6 18" })))), this.type === 'password' && this.showPassword && (h("span", { key: '209212e83bc6c4c0939c6ace984648212c320312', class: "hb-input__suffix-inner hb-input__password", role: "button", "aria-label": this.passwordVisible ? '隐藏密码' : '显示密码', onClick: this.togglePasswordVisible }, this.passwordVisible ? (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" }), h("circle", { cx: "12", cy: "12", r: "3" }))) : (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": 2, "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 3l18 18M10.6 10.6a3 3 0 0 0 4.2 4.2M9.9 5.1A10.6 10.6 0 0 1 12 5c6.5 0 10 7 10 7a17.8 17.8 0 0 1-2.2 3.2M6.1 6.1A17.7 17.7 0 0 0 2 12s3.5 7 10 7a10.5 10.5 0 0 0 4-.8" }))))), this.suffixIcon && (h("span", { key: '661c50477f3a7d99feb22d71920493a184d66beb', class: "hb-input__suffix-inner" }, h("i", { key: 'f626ef9a8e095ee15ed0b8d3c903635c66d160c1', class: this.suffixIcon }))))), this.showWordLimit && this.maxlength && (h("span", { key: '47eba0fd638cbf8c510f0a94ee1dac808e3bba78', class: "hb-input__count" }, h("span", { key: '2d73a2813633592d8462b9decb3fb3f81fa3abde', class: "hb-input__count-inner" }, this.inputValue.length, " / ", this.maxlength)))));
239
275
  }
240
276
  static get watchers() { return {
241
277
  "modelValue": ["handleValueChange"]
@@ -1 +1 @@
1
- {"file":"hb-input.entry.js","mappings":";;AAAA;;;;;;;;AAYA;AACO,MAAM,eAAe,GAA6B,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAsBhG;;;;SAIgB,cAAc,CAAC,IAAY,EAAE,IAA+B;IAC1E,MAAM,UAAU,GAAG,IAAI,IAAI,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7E,OAAO,GAAG,IAAI,KAAK,UAAU,EAAE,CAAC;AAClC,CAAC;AAcD;;;;SAIgB,cAAc,CAAC,OAA4B;IACzD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;AAClG,CAAC;AAED;;;;SAIgB,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,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,IACxF,IAAI,CAAC,eAAe,GAAG,KAAK,GAAG,SAAS,CACpC,CACR,EACA,IAAI,CAAC,UAAU,KACd,6DAAM,KAAK,EAAC,wBAAwB,IAClC,0DAAG,KAAK,EAAE,IAAI,CAAC,UAAU,GAAM,CAC1B,CACR,CACI,CACR,EACA,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,SAAS,KACnC,6DAAM,KAAK,EAAC,iBAAiB,IAC3B,6DAAM,KAAK,EAAC,uBAAuB,IAChC,IAAI,CAAC,UAAU,CAAC,MAAM,SAAK,IAAI,CAAC,SAAS,CACrC,CACF,CACR,CACG,EACN;KACH;;;;;;;;;","names":[],"sources":["src/utils/form-input-base.ts","src/components/Input/input.css?tag=hb-input&encapsulation=shadow","src/components/Input/Input.tsx"],"sourcesContent":["/**\n * 表单输入组件共享基础\n * 统一 size / disabled / clearable / modelValue 这一组在 Input / Select / Cascader /\n * DatePicker / InputNumber / TimePicker 等组件中重复出现的包装模式。\n *\n * 设计原则:纯函数 + 类型导出,不引入基类继承,避免 Stencil 装饰器在继承链上的隐式行为。\n * 组件按需 import 对应工具,渲染时调用即可。\n */\n\n/** 组件尺寸(与 Ant Design 对齐,便于迁移) */\nexport type ComponentSize = 'large' | 'default' | 'small';\n\n/** 全部合法尺寸,用于运行期校验 */\nexport const COMPONENT_SIZES: readonly ComponentSize[] = ['large', 'default', 'small'] as const;\n\n/**\n * 表单输入组件共享的 prop 契约。\n * 跨框架消费方(React / Vue / 原生)可据此推断任一表单输入组件的通用能力,\n * 各组件在此基础上扩展自身特有 prop。\n */\nexport interface FormInputProps {\n /** 绑定值(双向,配合 hbChange 事件) */\n modelValue: unknown;\n /** 尺寸 */\n size?: ComponentSize;\n /** 是否禁用 */\n disabled?: boolean;\n /** 是否只读 */\n readonly?: boolean;\n /** 是否可清空 */\n clearable?: boolean;\n /** 占位文本 */\n placeholder?: string;\n}\n\n/**\n * 生成尺寸 class 名:buildSizeClass('hb-input', 'large') -> 'hb-input--large'\n * 用于替代各组件 render 中重复的 `[`hb-input--${this.size}`]: true` 模板字面量。\n */\nexport function buildSizeClass(base: string, size: ComponentSize | undefined): string {\n const normalized = size && COMPONENT_SIZES.includes(size) ? size : 'default';\n return `${base}--${normalized}`;\n}\n\n/** 清空按钮可见性判定参数 */\nexport interface ClearVisibleOptions {\n /** 是否声明了 clearable */\n clearable: boolean;\n /** 是否禁用(禁用时不显示) */\n disabled?: boolean;\n /** 是否只读(只读时不显示) */\n readonly?: boolean;\n /** 当前是否有值(无值时不显示) */\n hasValue: boolean;\n}\n\n/**\n * 判定清空按钮是否应显示。\n * 抽取自 Input/Select/Cascader 中重复的 `clearable && !disabled && !readonly && hasValue`。\n */\nexport function isClearVisible(options: ClearVisibleOptions): boolean {\n return Boolean(options.clearable && !options.disabled && !options.readonly && options.hasValue);\n}\n\n/**\n * 判定一个值是否「非空」(用于清空按钮显隐)。\n * 兼容字符串、数字、数组(多选)。\n */\nexport function hasInputValue(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value === 'string') return value.length > 0;\n if (typeof value === 'number') return !Number.isNaN(value);\n if (Array.isArray(value)) return value.length > 0;\n return true;\n}\n\n/**\n * 尺寸 class 集合生成器:返回包含 base 与 size class 的对象,可直接展开进 JSX class 绑定。\n * 例:sizeClassMap('hb-input', 'large', this.size) -> { 'hb-input': true, 'hb-input--large': true }\n */\nexport function sizeClassMap(base: string, size: ComponentSize | undefined): Record<string, boolean> {\n return { [base]: true, [buildSizeClass(base, size)]: true };\n}\n",":host {\n display: inline-block;\n position: relative;\n --hb-input-font-size: 14px;\n --hb-input-font-size-large: 16px;\n --hb-input-font-size-small: 12px;\n --hb-input-height: 32px;\n --hb-input-height-large: 40px;\n --hb-input-height-small: 24px;\n --hb-input-border-color: var(--hb-border-color, #dcdfe6);\n --hb-input-border-color-hover: var(--hb-color-primary);\n --hb-input-bg-color: var(--hb-color-white, #ffffff);\n --hb-input-text-color: var(--hb-color-text-regular, #606266);\n --hb-input-placeholder-color: var(--hb-color-text-placeholder, #c0c4cc);\n --hb-input-disabled-color: var(--hb-color-text-disabled, #c0c4cc);\n --hb-input-disabled-bg-color: var(--hb-fill-color-light, #f5f7fa);\n}\n\n.hb-input {\n position: relative;\n font-size: var(--hb-input-font-size);\n display: inline-block;\n width: 100%;\n}\n\n.hb-input__inner {\n -webkit-appearance: none;\n background-color: var(--hb-input-bg-color);\n background-image: none;\n border-radius: 4px;\n border: 1px solid var(--hb-input-border-color);\n box-sizing: border-box;\n color: var(--hb-input-text-color);\n display: inline-block;\n font-size: inherit;\n height: var(--hb-input-height);\n line-height: var(--hb-input-height);\n outline: none;\n padding: 0 15px;\n transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n width: 100%;\n}\n\n.hb-input__inner::placeholder {\n color: var(--hb-input-placeholder-color);\n}\n\n.hb-input__inner:hover:not(:disabled) {\n border-color: var(--hb-input-border-color-hover);\n}\n\n.hb-input__inner:focus {\n border-color: var(--hb-input-border-color-hover);\n}\n\n.hb-input__inner:disabled {\n background-color: var(--hb-input-disabled-bg-color);\n border-color: var(--hb-input-border-color);\n color: var(--hb-input-disabled-color);\n cursor: not-allowed;\n}\n\n.hb-input__inner[readonly] {\n background-color: var(--hb-input-disabled-bg-color);\n cursor: default;\n}\n\n.hb-input--small .hb-input__inner {\n height: var(--hb-input-height-small);\n line-height: var(--hb-input-height-small);\n font-size: var(--hb-input-font-size-small);\n padding: 0 12px;\n}\n\n.hb-input--large .hb-input__inner {\n height: var(--hb-input-height-large);\n line-height: var(--hb-input-height-large);\n font-size: var(--hb-input-font-size-large);\n padding: 0 18px;\n}\n\n.hb-input__prefix,\n.hb-input__suffix {\n position: absolute;\n top: 0;\n height: 100%;\n text-align: center;\n color: var(--hb-input-placeholder-color);\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n\n.hb-input__prefix {\n left: 5px;\n}\n\n.hb-input__suffix {\n right: 5px;\n}\n\n.hb-input__suffix-inner {\n display: flex;\n align-items: center;\n cursor: pointer;\n user-select: none;\n}\n\n.hb-input__clear {\n font-size: 16px;\n color: var(--hb-input-placeholder-color);\n transition: color 0.2s;\n}\n\n.hb-input__clear:hover {\n color: var(--hb-input-text-color);\n}\n\n.hb-input__password {\n font-size: 16px;\n cursor: pointer;\n}\n\n.hb-input__inner[type=\"textarea\"] {\n min-height: 60px;\n padding: 5px 15px;\n line-height: 1.5;\n vertical-align: bottom;\n resize: vertical;\n}\n\n.hb-input__count {\n position: absolute;\n bottom: 5px;\n right: 10px;\n font-size: 12px;\n color: var(--hb-input-placeholder-color);\n}\n\n.hb-input__count-inner {\n background-color: var(--hb-input-bg-color);\n padding: 0 4px;\n}\n\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\nimport { ComponentSize, hasInputValue, isClearVisible, sizeClassMap } from '../../utils/form-input-base';\n\n/**\n * Input 输入框组件\n * 通过鼠标或键盘输入字符\n */\n@Component({\n tag: 'hb-input',\n styleUrl: 'input.css',\n shadow: true,\n})\nexport class Input {\n @Element() el: HTMLElement;\n\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: string = '';\n\n /**\n * 输入框类型\n */\n @Prop() type: string = 'text';\n\n /**\n * 输入框尺寸\n */\n @Prop() size: ComponentSize = 'default';\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 输入框占位文本\n */\n @Prop() placeholder?: string;\n\n /**\n * 是否可清空\n * @default false\n */\n @Prop() clearable: boolean = false;\n\n /**\n * 是否显示密码可见性切换\n * @default false\n */\n @Prop() showPassword: boolean = false;\n\n /**\n * 是否显示字数统计\n * @default false\n */\n @Prop() showWordLimit: boolean = false;\n\n /**\n * 最大输入长度\n */\n @Prop() maxlength?: number;\n\n /**\n * 最小输入长度\n */\n @Prop() minlength?: number;\n\n /**\n * 原生 name 属性\n */\n @Prop() name?: string;\n\n /**\n * 原生 id 属性\n */\n @Prop() inputId?: string;\n\n /**\n * 原生 autocomplete 属性\n */\n @Prop() autocomplete?: string;\n\n /**\n * 原生 autofocus 属性\n */\n @Prop() autofocus: boolean = false;\n\n /**\n * 输入框头部图标\n */\n @Prop() prefixIcon?: string;\n\n /**\n * 输入框尾部图标\n */\n @Prop() suffixIcon?: string;\n\n /**\n * 输入框行数,仅 type 为 'textarea' 时有效\n */\n @Prop() rows: number = 2;\n\n /**\n * 是否自适应内容高度,仅 type 为 'textarea' 时有效\n */\n @Prop() autosize: boolean | { minRows?: number; maxRows?: number } = false;\n\n /**\n * 是否调整 textarea 大小\n */\n @Prop() resize?: 'none' | 'both' | 'horizontal' | 'vertical';\n\n @State() isFocused: boolean = false;\n @State() showClear: boolean = false;\n @State() passwordVisible: boolean = false;\n @State() inputValue: string = '';\n\n private inputRef?: HTMLInputElement | HTMLTextAreaElement;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<string>;\n\n /**\n * 输入事件\n */\n @Event() hbInput: EventEmitter<string>;\n\n /**\n * 聚焦事件\n */\n @Event() hbFocus: EventEmitter<FocusEvent>;\n\n /**\n * 失焦事件\n */\n @Event() hbBlur: EventEmitter<FocusEvent>;\n\n /**\n * 清空事件\n */\n @Event() hbClear: EventEmitter<void>;\n\n @Watch('modelValue')\n handleValueChange() {\n this.inputValue = this.modelValue;\n this.updateClearVisible();\n }\n\n componentDidLoad() {\n this.inputValue = this.modelValue;\n this.updateClearVisible();\n }\n\n private updateClearVisible() {\n this.showClear = isClearVisible({\n clearable: this.clearable,\n disabled: this.disabled,\n readonly: this.readonly,\n hasValue: hasInputValue(this.inputValue),\n });\n }\n\n private handleInput = (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n this.inputValue = target.value;\n this.modelValue = target.value;\n this.updateClearVisible();\n this.hbInput.emit(target.value);\n };\n\n private handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n this.hbChange.emit(target.value);\n };\n\n private handleFocus = (e: FocusEvent) => {\n this.isFocused = true;\n this.updateClearVisible();\n this.hbFocus.emit(e);\n };\n\n private handleBlur = (e: FocusEvent) => {\n this.isFocused = false;\n this.updateClearVisible();\n this.hbBlur.emit(e);\n };\n\n private handleClear = (e: Event) => {\n e.stopPropagation();\n this.inputValue = '';\n this.modelValue = '';\n this.updateClearVisible();\n this.hbClear.emit();\n this.hbChange.emit('');\n if (this.inputRef) {\n this.inputRef.focus();\n }\n };\n\n private togglePasswordVisible = () => {\n this.passwordVisible = !this.passwordVisible;\n };\n\n private getInputType(): string {\n if (this.type === 'password' && this.showPassword) {\n return this.passwordVisible ? 'text' : 'password';\n }\n return this.type;\n }\n\n render() {\n const isTextarea = this.type === 'textarea';\n const InputTag = isTextarea ? 'textarea' : 'input';\n\n return (\n <div\n class={{\n ...sizeClassMap('hb-input', this.size),\n 'hb-input--disabled': this.disabled,\n 'hb-input--focused': this.isFocused,\n }}\n >\n {this.prefixIcon && (\n <span class=\"hb-input__prefix\">\n <i class={this.prefixIcon}></i>\n </span>\n )}\n <InputTag\n ref={(el) => (this.inputRef = el)}\n type={isTextarea ? undefined : this.getInputType()}\n id={this.inputId}\n name={this.name}\n class=\"hb-input__inner\"\n placeholder={this.placeholder}\n value={this.inputValue}\n disabled={this.disabled}\n readonly={this.readonly}\n autocomplete={this.autocomplete}\n autofocus={this.autofocus}\n maxlength={this.maxlength}\n minlength={this.minlength}\n rows={isTextarea ? this.rows : undefined}\n style={isTextarea && this.resize ? { resize: this.resize } : undefined}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n {(this.showClear || this.suffixIcon || (this.type === 'password' && this.showPassword)) && (\n <span class=\"hb-input__suffix\">\n {this.showClear && (\n <span class=\"hb-input__suffix-inner hb-input__clear\" onClick={this.handleClear}>\n ×\n </span>\n )}\n {this.type === 'password' && this.showPassword && (\n <span class=\"hb-input__suffix-inner hb-input__password\" onClick={this.togglePasswordVisible}>\n {this.passwordVisible ? '👁️' : '👁️‍🗨️'}\n </span>\n )}\n {this.suffixIcon && (\n <span class=\"hb-input__suffix-inner\">\n <i class={this.suffixIcon}></i>\n </span>\n )}\n </span>\n )}\n {this.showWordLimit && this.maxlength && (\n <span class=\"hb-input__count\">\n <span class=\"hb-input__count-inner\">\n {this.inputValue.length} / {this.maxlength}\n </span>\n </span>\n )}\n </div>\n );\n }\n}\n\n"],"version":3}
1
+ {"file":"hb-input.entry.js","mappings":";;AAAA;;;;;;;;AAYA;AACO,MAAM,eAAe,GAA6B,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAsBhG;;;;SAIgB,cAAc,CAAC,IAAY,EAAE,IAA+B;IAC1E,MAAM,UAAU,GAAG,IAAI,IAAI,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7E,OAAO,GAAG,IAAI,KAAK,UAAU,EAAE,CAAC;AAClC,CAAC;AAcD;;;;SAIgB,cAAc,CAAC,OAA4B;IACzD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;AAClG,CAAC;AAED;;;;SAIgB,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;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,IAAI,IAAI,CAAC,SAAS,KACnC,6DAAM,KAAK,EAAC,iBAAiB,IAC3B,6DAAM,KAAK,EAAC,uBAAuB,IAChC,IAAI,CAAC,UAAU,CAAC,MAAM,SAAK,IAAI,CAAC,SAAS,CACrC,CACF,CACR,CACG,EACN;KACH;;;;;;;;;","names":[],"sources":["src/utils/form-input-base.ts","src/components/Input/input.css?tag=hb-input&encapsulation=shadow","src/components/Input/Input.tsx"],"sourcesContent":["/**\n * 表单输入组件共享基础\n * 统一 size / disabled / clearable / modelValue 这一组在 Input / Select / Cascader /\n * DatePicker / InputNumber / TimePicker 等组件中重复出现的包装模式。\n *\n * 设计原则:纯函数 + 类型导出,不引入基类继承,避免 Stencil 装饰器在继承链上的隐式行为。\n * 组件按需 import 对应工具,渲染时调用即可。\n */\n\n/** 组件尺寸(与 Ant Design 对齐,便于迁移) */\nexport type ComponentSize = 'large' | 'default' | 'small';\n\n/** 全部合法尺寸,用于运行期校验 */\nexport const COMPONENT_SIZES: readonly ComponentSize[] = ['large', 'default', 'small'] as const;\n\n/**\n * 表单输入组件共享的 prop 契约。\n * 跨框架消费方(React / Vue / 原生)可据此推断任一表单输入组件的通用能力,\n * 各组件在此基础上扩展自身特有 prop。\n */\nexport interface FormInputProps {\n /** 绑定值(双向,配合 hbChange 事件) */\n modelValue: unknown;\n /** 尺寸 */\n size?: ComponentSize;\n /** 是否禁用 */\n disabled?: boolean;\n /** 是否只读 */\n readonly?: boolean;\n /** 是否可清空 */\n clearable?: boolean;\n /** 占位文本 */\n placeholder?: string;\n}\n\n/**\n * 生成尺寸 class 名:buildSizeClass('hb-input', 'large') -> 'hb-input--large'\n * 用于替代各组件 render 中重复的 `[`hb-input--${this.size}`]: true` 模板字面量。\n */\nexport function buildSizeClass(base: string, size: ComponentSize | undefined): string {\n const normalized = size && COMPONENT_SIZES.includes(size) ? size : 'default';\n return `${base}--${normalized}`;\n}\n\n/** 清空按钮可见性判定参数 */\nexport interface ClearVisibleOptions {\n /** 是否声明了 clearable */\n clearable: boolean;\n /** 是否禁用(禁用时不显示) */\n disabled?: boolean;\n /** 是否只读(只读时不显示) */\n readonly?: boolean;\n /** 当前是否有值(无值时不显示) */\n hasValue: boolean;\n}\n\n/**\n * 判定清空按钮是否应显示。\n * 抽取自 Input/Select/Cascader 中重复的 `clearable && !disabled && !readonly && hasValue`。\n */\nexport function isClearVisible(options: ClearVisibleOptions): boolean {\n return Boolean(options.clearable && !options.disabled && !options.readonly && options.hasValue);\n}\n\n/**\n * 判定一个值是否「非空」(用于清空按钮显隐)。\n * 兼容字符串、数字、数组(多选)。\n */\nexport function hasInputValue(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value === 'string') return value.length > 0;\n if (typeof value === 'number') return !Number.isNaN(value);\n if (Array.isArray(value)) return value.length > 0;\n return true;\n}\n\n/**\n * 尺寸 class 集合生成器:返回包含 base 与 size class 的对象,可直接展开进 JSX class 绑定。\n * 例:sizeClassMap('hb-input', 'large', this.size) -> { 'hb-input': true, 'hb-input--large': true }\n */\nexport function sizeClassMap(base: string, size: ComponentSize | undefined): Record<string, boolean> {\n return { [base]: true, [buildSizeClass(base, size)]: true };\n}\n",":host {\n display: inline-block;\n position: relative;\n --hb-input-font-size: 14px;\n --hb-input-font-size-large: 16px;\n --hb-input-font-size-small: 12px;\n --hb-input-height: 32px;\n --hb-input-height-large: 40px;\n --hb-input-height-small: 24px;\n --hb-input-border-color: var(--hb-border-color, #dcdfe6);\n --hb-input-border-color-hover: var(--hb-color-primary);\n --hb-input-bg-color: var(--hb-color-white, #ffffff);\n --hb-input-text-color: var(--hb-color-text-regular, #606266);\n --hb-input-placeholder-color: var(--hb-color-text-placeholder, #c0c4cc);\n --hb-input-disabled-color: var(--hb-color-text-disabled, #c0c4cc);\n --hb-input-disabled-bg-color: var(--hb-fill-color-light, #f5f7fa);\n}\n\n.hb-input {\n position: relative;\n font-size: var(--hb-input-font-size);\n display: inline-block;\n width: 100%;\n}\n\n.hb-input__inner {\n -webkit-appearance: none;\n background-color: var(--hb-input-bg-color);\n background-image: none;\n border-radius: 4px;\n border: 1px solid var(--hb-input-border-color);\n box-sizing: border-box;\n color: var(--hb-input-text-color);\n display: inline-block;\n font-size: inherit;\n height: var(--hb-input-height);\n line-height: var(--hb-input-height);\n outline: none;\n padding: 0 15px;\n transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n width: 100%;\n}\n\n.hb-input__inner::placeholder {\n color: var(--hb-input-placeholder-color);\n}\n\n.hb-input__inner:hover:not(:disabled) {\n border-color: var(--hb-input-border-color-hover);\n}\n\n.hb-input__inner:focus {\n border-color: var(--hb-input-border-color-hover);\n}\n\n.hb-input__inner:disabled {\n background-color: var(--hb-input-disabled-bg-color);\n border-color: var(--hb-input-border-color);\n color: var(--hb-input-disabled-color);\n cursor: not-allowed;\n}\n\n.hb-input__inner[readonly] {\n background-color: var(--hb-input-disabled-bg-color);\n cursor: default;\n}\n\n.hb-input--small .hb-input__inner {\n height: var(--hb-input-height-small);\n line-height: var(--hb-input-height-small);\n font-size: var(--hb-input-font-size-small);\n padding: 0 12px;\n}\n\n.hb-input--large .hb-input__inner {\n height: var(--hb-input-height-large);\n line-height: var(--hb-input-height-large);\n font-size: var(--hb-input-font-size-large);\n padding: 0 18px;\n}\n\n.hb-input__prefix,\n.hb-input__suffix {\n position: absolute;\n top: 0;\n height: 100%;\n text-align: center;\n color: var(--hb-input-placeholder-color);\n transition: all 0.3s;\n display: flex;\n align-items: center;\n}\n\n.hb-input__prefix {\n left: 5px;\n}\n\n.hb-input__suffix {\n right: 5px;\n}\n\n.hb-input__suffix-inner {\n display: flex;\n align-items: center;\n cursor: pointer;\n user-select: none;\n}\n\n.hb-input__clear {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n color: var(--hb-input-placeholder-color);\n transition: color 0.2s;\n}\n\n.hb-input__clear svg {\n width: 100%;\n height: 100%;\n}\n\n.hb-input__clear:hover {\n color: var(--hb-input-text-color);\n}\n\n.hb-input__password {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n color: var(--hb-input-text-color);\n cursor: pointer;\n}\n\n.hb-input__password svg {\n width: 100%;\n height: 100%;\n}\n\n.hb-input__inner[type=\"textarea\"] {\n min-height: 60px;\n padding: 5px 15px;\n line-height: 1.5;\n vertical-align: bottom;\n resize: vertical;\n}\n\n.hb-input__count {\n position: absolute;\n bottom: 5px;\n right: 10px;\n font-size: 12px;\n color: var(--hb-input-placeholder-color);\n}\n\n.hb-input__count-inner {\n background-color: var(--hb-input-bg-color);\n padding: 0 4px;\n}\n\n","import { Component, h, Prop, Event, EventEmitter, State, Watch, Element } from '@stencil/core';\nimport { ComponentSize, hasInputValue, isClearVisible, sizeClassMap } from '../../utils/form-input-base';\n\n/**\n * Input 输入框组件\n * 通过鼠标或键盘输入字符\n */\n@Component({\n tag: 'hb-input',\n styleUrl: 'input.css',\n shadow: true,\n})\nexport class Input {\n @Element() el: HTMLElement;\n\n /**\n * 绑定值\n */\n @Prop({ mutable: true }) modelValue: string = '';\n\n /**\n * 输入框类型\n */\n @Prop() type: string = 'text';\n\n /**\n * 输入框尺寸\n */\n @Prop() size: ComponentSize = 'default';\n\n /**\n * 是否禁用\n * @default false\n */\n @Prop() disabled: boolean = false;\n\n /**\n * 是否只读\n * @default false\n */\n @Prop() readonly: boolean = false;\n\n /**\n * 输入框占位文本\n */\n @Prop() placeholder?: string;\n\n /**\n * 是否可清空\n * @default false\n */\n @Prop() clearable: boolean = false;\n\n /**\n * 是否显示密码可见性切换\n * @default false\n */\n @Prop() showPassword: boolean = false;\n\n /**\n * 是否显示字数统计\n * @default false\n */\n @Prop() showWordLimit: boolean = false;\n\n /**\n * 最大输入长度\n */\n @Prop() maxlength?: number;\n\n /**\n * 最小输入长度\n */\n @Prop() minlength?: number;\n\n /**\n * 原生 name 属性\n */\n @Prop() name?: string;\n\n /**\n * 原生 id 属性\n */\n @Prop() inputId?: string;\n\n /**\n * 原生 autocomplete 属性\n */\n @Prop() autocomplete?: string;\n\n /**\n * 原生 autofocus 属性\n */\n @Prop() autofocus: boolean = false;\n\n /**\n * 输入框头部图标\n */\n @Prop() prefixIcon?: string;\n\n /**\n * 输入框尾部图标\n */\n @Prop() suffixIcon?: string;\n\n /**\n * 输入框行数,仅 type 为 'textarea' 时有效\n */\n @Prop() rows: number = 2;\n\n /**\n * 是否自适应内容高度,仅 type 为 'textarea' 时有效\n */\n @Prop() autosize: boolean | { minRows?: number; maxRows?: number } = false;\n\n /**\n * 是否调整 textarea 大小\n */\n @Prop() resize?: 'none' | 'both' | 'horizontal' | 'vertical';\n\n @State() isFocused: boolean = false;\n @State() showClear: boolean = false;\n @State() passwordVisible: boolean = false;\n @State() inputValue: string = '';\n\n private inputRef?: HTMLInputElement | HTMLTextAreaElement;\n\n /**\n * 值改变事件\n */\n @Event() hbChange: EventEmitter<string>;\n\n /**\n * 输入事件\n */\n @Event() hbInput: EventEmitter<string>;\n\n /**\n * 聚焦事件\n */\n @Event() hbFocus: EventEmitter<FocusEvent>;\n\n /**\n * 失焦事件\n */\n @Event() hbBlur: EventEmitter<FocusEvent>;\n\n /**\n * 清空事件\n */\n @Event() hbClear: EventEmitter<void>;\n\n @Watch('modelValue')\n handleValueChange() {\n this.inputValue = this.modelValue;\n this.updateClearVisible();\n // textarea autosize:外部改值也要重算高度\n this.resizeTextarea();\n }\n\n componentDidLoad() {\n this.inputValue = this.modelValue;\n this.updateClearVisible();\n this.resizeTextarea();\n }\n\n private updateClearVisible() {\n this.showClear = isClearVisible({\n clearable: this.clearable,\n disabled: this.disabled,\n readonly: this.readonly,\n hasValue: hasInputValue(this.inputValue),\n });\n }\n\n /**\n * textarea 自适应高度(autosize)。\n * - autosize=false 或非 textarea:跳过。\n * - autosize=true:按内容自适应。\n * - autosize={minRows,maxRows}:在最小/最大行数间夹取。\n * 算法:先把 height 置 auto 让浏览器按内容重排,再读 scrollHeight,\n * 减去 padding 后按行高换算成行数,最后按 min/max 夹取并写回 height。\n */\n private resizeTextarea() {\n if (this.type !== 'textarea' || !this.autosize) return;\n const ta = this.inputRef as HTMLTextAreaElement | undefined;\n if (!ta) return;\n\n // 行高:优先取计算样式,兜底 22px\n const computed = typeof window !== 'undefined' ? window.getComputedStyle(ta) : null;\n const lineHeight = computed && parseFloat(computed.lineHeight) ? parseFloat(computed.lineHeight) : 22;\n const paddingTop = computed ? parseFloat(computed.paddingTop) || 0 : 0;\n const paddingBottom = computed ? parseFloat(computed.paddingBottom) || 0 : 0;\n\n const opts = typeof this.autosize === 'object' ? this.autosize : {};\n const minRows = opts.minRows ?? 1;\n const maxRows = opts.maxRows ?? Infinity;\n\n const minH = minRows * lineHeight + paddingTop + paddingBottom;\n const maxH = maxRows === Infinity ? Infinity : maxRows * lineHeight + paddingTop + paddingBottom;\n\n // 先 reset 高度以读取真实内容高度\n ta.style.height = 'auto';\n const scrollH = ta.scrollHeight;\n const clamped = Math.max(minH, Math.min(scrollH, maxH === Infinity ? scrollH : maxH));\n ta.style.height = `${clamped}px`;\n // overflow:能滚动时才显示滚动条\n ta.style.overflowY = scrollH > clamped ? 'auto' : 'hidden';\n }\n\n private handleInput = (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n this.inputValue = target.value;\n this.modelValue = target.value;\n this.updateClearVisible();\n this.hbInput.emit(target.value);\n this.resizeTextarea();\n };\n\n private handleChange = (e: Event) => {\n const target = e.target as HTMLInputElement | HTMLTextAreaElement;\n this.hbChange.emit(target.value);\n };\n\n private handleFocus = (e: FocusEvent) => {\n this.isFocused = true;\n this.updateClearVisible();\n this.hbFocus.emit(e);\n };\n\n private handleBlur = (e: FocusEvent) => {\n this.isFocused = false;\n this.updateClearVisible();\n this.hbBlur.emit(e);\n };\n\n private handleClear = (e: Event) => {\n e.stopPropagation();\n this.inputValue = '';\n this.modelValue = '';\n this.updateClearVisible();\n this.hbClear.emit();\n this.hbChange.emit('');\n if (this.inputRef) {\n this.inputRef.focus();\n }\n };\n\n private togglePasswordVisible = () => {\n this.passwordVisible = !this.passwordVisible;\n };\n\n private getInputType(): string {\n if (this.type === 'password' && this.showPassword) {\n return this.passwordVisible ? 'text' : 'password';\n }\n return this.type;\n }\n\n render() {\n const isTextarea = this.type === 'textarea';\n const InputTag = isTextarea ? 'textarea' : 'input';\n\n return (\n <div\n class={{\n ...sizeClassMap('hb-input', this.size),\n 'hb-input--disabled': this.disabled,\n 'hb-input--focused': this.isFocused,\n }}\n >\n {this.prefixIcon && (\n <span class=\"hb-input__prefix\">\n <i class={this.prefixIcon}></i>\n </span>\n )}\n <InputTag\n ref={(el) => (this.inputRef = el)}\n type={isTextarea ? undefined : this.getInputType()}\n id={this.inputId}\n name={this.name}\n class=\"hb-input__inner\"\n placeholder={this.placeholder}\n value={this.inputValue}\n disabled={this.disabled}\n readonly={this.readonly}\n autocomplete={this.autocomplete}\n autofocus={this.autofocus}\n maxlength={this.maxlength}\n minlength={this.minlength}\n rows={isTextarea ? this.rows : undefined}\n style={isTextarea ? { resize: this.autosize ? 'none' : (this.resize || 'none') } : undefined}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n {(this.showClear || this.suffixIcon || (this.type === 'password' && this.showPassword)) && (\n <span class=\"hb-input__suffix\">\n {this.showClear && (\n <span class=\"hb-input__suffix-inner hb-input__clear\" role=\"button\" aria-label=\"清空\" onClick={this.handleClear}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width={2} stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M6 6l12 12M18 6L6 18\" />\n </svg>\n </span>\n )}\n {this.type === 'password' && this.showPassword && (\n <span\n class=\"hb-input__suffix-inner hb-input__password\"\n role=\"button\"\n aria-label={this.passwordVisible ? '隐藏密码' : '显示密码'}\n onClick={this.togglePasswordVisible}\n >\n {this.passwordVisible ? (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width={2} stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ) : (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width={2} stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M3 3l18 18M10.6 10.6a3 3 0 0 0 4.2 4.2M9.9 5.1A10.6 10.6 0 0 1 12 5c6.5 0 10 7 10 7a17.8 17.8 0 0 1-2.2 3.2M6.1 6.1A17.7 17.7 0 0 0 2 12s3.5 7 10 7a10.5 10.5 0 0 0 4-.8\" />\n </svg>\n )}\n </span>\n )}\n {this.suffixIcon && (\n <span class=\"hb-input__suffix-inner\">\n <i class={this.suffixIcon}></i>\n </span>\n )}\n </span>\n )}\n {this.showWordLimit && this.maxlength && (\n <span class=\"hb-input__count\">\n <span class=\"hb-input__count-inner\">\n {this.inputValue.length} / {this.maxlength}\n </span>\n </span>\n )}\n </div>\n );\n }\n}\n\n"],"version":3}