antd-solid 0.0.12 → 0.0.13

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 (343) hide show
  1. package/css/index.css +10 -77
  2. package/dist/index.esm.js +7819 -2492
  3. package/dist/index.umd.js +1 -1
  4. package/es/Alert/index.d.ts +10 -0
  5. package/es/Alert/index.js +26 -0
  6. package/es/Button/index.d.ts +16 -4
  7. package/es/Button/index.js +107 -59
  8. package/es/Button/index.scss.js +1 -1
  9. package/es/Checkbox/Group.d.ts +19 -0
  10. package/es/Checkbox/Group.js +49 -0
  11. package/es/Checkbox/index.d.ts +15 -0
  12. package/es/Checkbox/index.js +60 -0
  13. package/es/CodeInput/index.d.ts +18 -0
  14. package/es/CodeInput/index.js +72 -0
  15. package/es/Collapse/Item.d.ts +46 -0
  16. package/es/Collapse/Item.js +130 -0
  17. package/es/Collapse/context.d.ts +5 -0
  18. package/es/Collapse/context.js +8 -0
  19. package/es/Collapse/index.d.ts +25 -10
  20. package/es/Collapse/index.js +95 -74
  21. package/es/Collapse/utils.d.ts +8 -0
  22. package/es/Collapse/utils.js +35 -0
  23. package/es/ColorPicker/ColorPickerInput.d.ts +3 -0
  24. package/es/ColorPicker/ColorPickerInput.js +250 -0
  25. package/es/ColorPicker/ColorPickerSelect.d.ts +3 -0
  26. package/es/ColorPicker/ColorPickerSelect.js +71 -0
  27. package/es/ColorPicker/ColorPickerSlider.d.ts +3 -0
  28. package/es/ColorPicker/ColorPickerSlider.js +115 -0
  29. package/es/ColorPicker/color.d.ts +24 -0
  30. package/es/ColorPicker/color.js +63 -0
  31. package/es/ColorPicker/context.d.ts +9 -0
  32. package/es/ColorPicker/context.js +5 -0
  33. package/es/ColorPicker/index.d.ts +31 -0
  34. package/es/ColorPicker/index.js +139 -0
  35. package/es/Command/context.d.ts +9 -0
  36. package/es/Command/context.js +11 -0
  37. package/es/Command/createCommand.d.ts +17 -0
  38. package/es/Command/createCommand.js +112 -0
  39. package/es/Command/index.d.ts +7 -0
  40. package/es/Command/index.js +9 -0
  41. package/es/Command/useCommandProps.d.ts +13 -0
  42. package/es/Command/useCommandProps.js +28 -0
  43. package/es/Compact/CompactContextIsolator.d.ts +3 -0
  44. package/es/Compact/CompactContextIsolator.js +15 -0
  45. package/es/Compact/context.d.ts +4 -0
  46. package/es/Compact/context.js +7 -0
  47. package/es/Compact/index.d.ts +11 -9
  48. package/es/Compact/index.js +28 -13
  49. package/es/Compact/index.scss.js +6 -0
  50. package/es/ConfigProvider/context.d.ts +11 -0
  51. package/es/ConfigProvider/context.js +15 -0
  52. package/es/ConfigProvider/dark/colorAlgorithm.d.ts +2 -0
  53. package/es/ConfigProvider/dark/colorAlgorithm.js +9 -0
  54. package/es/ConfigProvider/dark/colors.d.ts +3 -0
  55. package/es/ConfigProvider/dark/colors.js +47 -0
  56. package/es/ConfigProvider/dark/index.d.ts +2 -0
  57. package/es/ConfigProvider/dark/index.js +11 -0
  58. package/es/ConfigProvider/index.d.ts +32 -0
  59. package/es/ConfigProvider/index.js +44 -0
  60. package/es/ConfigProvider/light/colorAlgorithm.d.ts +2 -0
  61. package/es/ConfigProvider/light/colorAlgorithm.js +9 -0
  62. package/es/ConfigProvider/light/colors.d.ts +3 -0
  63. package/es/ConfigProvider/light/colors.js +45 -0
  64. package/es/ConfigProvider/light/index.d.ts +2 -0
  65. package/es/ConfigProvider/light/index.js +11 -0
  66. package/es/ConfigProvider/seed.d.ts +3 -0
  67. package/es/ConfigProvider/seed.js +22 -0
  68. package/es/ConfigProvider/types/index.d.ts +594 -0
  69. package/es/ConfigProvider/types/index.js +1 -0
  70. package/es/ConfigProvider/utils/genColorMapToken.d.ts +7 -0
  71. package/es/ConfigProvider/utils/genColorMapToken.js +85 -0
  72. package/es/ConfigProvider/utils/getAlphaColor.d.ts +2 -0
  73. package/es/ConfigProvider/utils/getAlphaColor.js +44 -0
  74. package/es/ConfigProvider/utils/index.d.ts +3 -0
  75. package/es/ConfigProvider/utils/index.js +181 -0
  76. package/es/ContextMenu/index.d.ts +8 -0
  77. package/es/ContextMenu/index.js +99 -0
  78. package/es/Cursor/index.d.ts +6 -0
  79. package/es/Cursor/index.js +71 -0
  80. package/es/DelayShow/index.d.ts +16 -0
  81. package/es/DelayShow/index.js +27 -0
  82. package/es/Divider/index.d.ts +17 -0
  83. package/es/Divider/index.js +71 -0
  84. package/es/Drawer/index.d.ts +20 -16
  85. package/es/Drawer/index.js +162 -111
  86. package/es/Drawer/index.scss.js +1 -1
  87. package/es/Dropdown/index.d.ts +16 -0
  88. package/es/Dropdown/index.js +47 -0
  89. package/es/Element/index.d.ts +10 -0
  90. package/es/Element/index.js +42 -0
  91. package/es/Empty/PRESENTED_IMAGE_SIMPLE.d.ts +2 -1
  92. package/es/Empty/PRESENTED_IMAGE_SIMPLE.js +25 -9
  93. package/es/Empty/assets/EmptySvg.js +1 -1
  94. package/es/Empty/assets/SimpleEmptySvg.js +1 -1
  95. package/es/Empty/index.d.ts +4 -2
  96. package/es/Empty/index.js +23 -13
  97. package/es/Form/Form.d.ts +8 -5
  98. package/es/Form/Form.js +50 -34
  99. package/es/Form/FormItem.d.ts +10 -5
  100. package/es/Form/FormItem.js +121 -104
  101. package/es/Form/context.d.ts +9 -9
  102. package/es/Form/context.js +4 -2
  103. package/es/Fragment/index.d.ts +4 -0
  104. package/es/Fragment/index.js +7 -0
  105. package/es/Image/index.d.ts +10 -0
  106. package/es/Image/index.js +37 -0
  107. package/es/Input/TextArea.d.ts +23 -0
  108. package/es/Input/TextArea.js +84 -0
  109. package/es/Input/index.d.ts +44 -0
  110. package/es/Input/index.js +213 -0
  111. package/es/Input/index.scss.js +6 -0
  112. package/es/InputNumber/index.d.ts +30 -0
  113. package/es/InputNumber/index.js +122 -0
  114. package/es/{InputNumber.test.js → InputNumber/index.test.js} +2 -1
  115. package/es/Menu/InternalMenu.d.ts +22 -0
  116. package/es/Menu/InternalMenu.js +196 -0
  117. package/es/Menu/index.d.ts +75 -0
  118. package/es/Menu/index.js +64 -0
  119. package/es/Message/Message.d.ts +9 -0
  120. package/es/Message/Message.js +34 -0
  121. package/es/Message/index.d.ts +12 -0
  122. package/es/Message/index.js +80 -0
  123. package/es/Message/index.scss.js +6 -0
  124. package/es/Message/useMessage.d.ts +6 -0
  125. package/es/Message/useMessage.js +54 -0
  126. package/es/Modal/index.d.ts +73 -0
  127. package/es/Modal/index.js +237 -0
  128. package/es/Modal/index.scss.js +6 -0
  129. package/es/Modal/useModal.d.ts +5 -0
  130. package/es/Modal/useModal.js +51 -0
  131. package/es/Modal/warning.d.ts +5 -0
  132. package/es/Modal/warning.js +43 -0
  133. package/es/{Popconfirm.d.ts → Popconfirm/index.d.ts} +2 -2
  134. package/es/Popconfirm/index.js +62 -0
  135. package/es/{Popover.d.ts → Popover/index.d.ts} +2 -2
  136. package/es/{Popover.js → Popover/index.js} +7 -12
  137. package/es/Progress/Circle.d.ts +16 -0
  138. package/es/Progress/Circle.js +122 -0
  139. package/es/Progress/index.d.ts +5 -2
  140. package/es/Progress/index.js +70 -65
  141. package/es/Radio/Button.d.ts +7 -0
  142. package/es/Radio/Button.js +72 -0
  143. package/es/Radio/Group.d.ts +18 -0
  144. package/es/Radio/Group.js +57 -0
  145. package/es/Radio/index.d.ts +14 -0
  146. package/es/Radio/index.js +68 -0
  147. package/es/RangeInput/index.d.ts +23 -0
  148. package/es/RangeInput/index.js +208 -0
  149. package/es/Result/index.js +49 -0
  150. package/es/Segmented/index.d.ts +10 -7
  151. package/es/Segmented/index.js +54 -53
  152. package/es/Select/index.d.ts +17 -0
  153. package/es/Select/index.js +75 -0
  154. package/es/SelectInput/index.d.ts +39 -0
  155. package/es/SelectInput/index.js +245 -0
  156. package/es/Slider/index.d.ts +47 -0
  157. package/es/Slider/index.js +177 -0
  158. package/es/Space/index.d.ts +13 -0
  159. package/es/Space/index.js +16 -0
  160. package/es/Spin/index.d.ts +19 -0
  161. package/es/Spin/index.js +82 -0
  162. package/es/{Switch.d.ts → Switch/index.d.ts} +9 -0
  163. package/es/Switch/index.js +41 -0
  164. package/es/{Table.d.ts → Table/index.d.ts} +6 -2
  165. package/es/Table/index.js +71 -0
  166. package/es/Tabs/index.d.ts +49 -0
  167. package/es/Tabs/index.js +256 -0
  168. package/es/Timeline/index.js +31 -0
  169. package/es/Tooltip/context.d.ts +5 -0
  170. package/es/Tooltip/context.js +5 -0
  171. package/es/Tooltip/index.d.ts +64 -0
  172. package/es/Tooltip/index.js +499 -0
  173. package/es/Transformer/index.d.ts +88 -0
  174. package/es/Transformer/index.js +882 -0
  175. package/es/Tree/SingleLevelTree.d.ts +28 -0
  176. package/es/Tree/SingleLevelTree.js +299 -0
  177. package/es/Tree/index.d.ts +83 -0
  178. package/es/Tree/index.js +197 -0
  179. package/es/TreeFor/index.d.ts +31 -0
  180. package/es/TreeFor/index.js +80 -0
  181. package/es/TreeSelect/index.d.ts +26 -0
  182. package/es/TreeSelect/index.js +98 -0
  183. package/es/{Upload.d.ts → Upload/index.d.ts} +8 -1
  184. package/es/Upload/index.js +112 -0
  185. package/es/assets/svg/ColorPickUp.d.ts +4 -0
  186. package/es/assets/svg/ColorPickUp.js +25 -0
  187. package/es/assets/svg/Crosshair.d.ts +7 -0
  188. package/es/assets/svg/Crosshair.js +51 -0
  189. package/es/assets/svg/Resize.d.ts +4 -0
  190. package/es/assets/svg/Resize.js +25 -0
  191. package/es/assets/svg/Rotate.d.ts +4 -0
  192. package/es/assets/svg/Rotate.js +20 -0
  193. package/es/assets/svg/RotateArrow.d.ts +4 -0
  194. package/es/assets/svg/RotateArrow.js +21 -0
  195. package/es/assets/svg/common.d.ts +2 -0
  196. package/es/assets/svg/common.js +9 -0
  197. package/es/hooks/createControllableValue.d.ts +1 -1
  198. package/es/hooks/createControllableValue.js +16 -17
  199. package/es/hooks/createTransition.d.ts +6 -2
  200. package/es/hooks/createTransition.js +12 -8
  201. package/es/hooks/useClickAway.d.ts +1 -1
  202. package/es/hooks/useClickAway.js +4 -3
  203. package/es/hooks/useComponentSize.d.ts +3 -0
  204. package/es/hooks/useComponentSize.js +12 -0
  205. package/es/hooks/useCounter.d.ts +12 -0
  206. package/es/hooks/useCounter.js +30 -0
  207. package/es/hooks/useFocus.d.ts +2 -0
  208. package/es/hooks/useFocus.js +24 -0
  209. package/es/hooks/useHover.d.ts +2 -0
  210. package/es/hooks/useHover.js +33 -0
  211. package/es/hooks/useLocale.d.ts +1 -0
  212. package/es/hooks/useLocale.js +11 -0
  213. package/es/hooks/useMouse.d.ts +1 -0
  214. package/es/hooks/useMouse.js +18 -0
  215. package/es/hooks/useScroll.d.ts +2 -0
  216. package/es/hooks/useScroll.js +29 -0
  217. package/es/hooks/useSize.d.ts +8 -2
  218. package/es/hooks/useSize.js +25 -13
  219. package/es/hooks/useVirtualList.d.ts +14 -0
  220. package/es/hooks/useVirtualList.js +45 -0
  221. package/es/index.d.ts +59 -8
  222. package/es/index.js +51 -21
  223. package/es/locale/en_US.d.ts +3 -0
  224. package/es/locale/en_US.js +9 -0
  225. package/es/locale/index.d.ts +5 -0
  226. package/es/locale/index.js +1 -0
  227. package/es/locale/zh_CN.d.ts +3 -0
  228. package/es/locale/zh_CN.js +9 -0
  229. package/es/types/index.d.ts +11 -2
  230. package/es/utils/animation.d.ts +6 -0
  231. package/es/utils/animation.js +20 -0
  232. package/es/utils/array.d.ts +2 -1
  233. package/es/utils/array.js +5 -1
  234. package/es/utils/domPoint.d.ts +7 -0
  235. package/es/utils/domPoint.js +11 -0
  236. package/es/utils/math.d.ts +17 -0
  237. package/es/utils/math.js +25 -0
  238. package/es/utils/number.d.ts +1 -0
  239. package/es/utils/number.js +14 -0
  240. package/es/utils/setupGlobalDrag.d.ts +10 -0
  241. package/es/utils/setupGlobalDrag.js +38 -0
  242. package/es/utils/solid.d.ts +2 -2
  243. package/es/utils/solid.js +7 -8
  244. package/package.json +10 -11
  245. package/es/ColorPicker.d.ts +0 -8
  246. package/es/ColorPicker.js +0 -6
  247. package/es/DatePicker.d.ts +0 -19
  248. package/es/DatePicker.js +0 -9
  249. package/es/Image.d.ts +0 -9
  250. package/es/Image.js +0 -22
  251. package/es/Input.d.ts +0 -29
  252. package/es/Input.js +0 -144
  253. package/es/InputNumber.d.ts +0 -11
  254. package/es/InputNumber.js +0 -92
  255. package/es/Modal.d.ts +0 -47
  256. package/es/Modal.js +0 -210
  257. package/es/Popconfirm.js +0 -64
  258. package/es/Radio.d.ts +0 -27
  259. package/es/Radio.js +0 -93
  260. package/es/Result.js +0 -29
  261. package/es/Select.d.ts +0 -16
  262. package/es/Select.js +0 -113
  263. package/es/Skeleton.d.ts +0 -9
  264. package/es/Skeleton.js +0 -9
  265. package/es/Spin.d.ts +0 -10
  266. package/es/Spin.js +0 -28
  267. package/es/Switch.js +0 -30
  268. package/es/Table.js +0 -57
  269. package/es/Tabs.d.ts +0 -17
  270. package/es/Tabs.js +0 -117
  271. package/es/Timeline.js +0 -30
  272. package/es/Tooltip.d.ts +0 -34
  273. package/es/Tooltip.js +0 -302
  274. package/es/Tree.d.ts +0 -28
  275. package/es/Tree.js +0 -198
  276. package/es/Upload.js +0 -96
  277. package/es/hooks/createUpdateEffect.d.ts +0 -5
  278. package/es/hooks/createUpdateEffect.js +0 -12
  279. package/es/utils/EventEmitter.d.ts +0 -7
  280. package/es/utils/EventEmitter.js +0 -13
  281. package/es/utils/ReactToSolid.d.ts +0 -8
  282. package/es/utils/ReactToSolid.js +0 -30
  283. package/es/utils/SolidToReact.d.ts +0 -8
  284. package/es/utils/SolidToReact.js +0 -23
  285. package/es/utils/component.d.ts +0 -31
  286. package/es/utils/component.js +0 -68
  287. package/es/utils/zh_CN.d.ts +0 -2
  288. package/es/utils/zh_CN.js +0 -236
  289. package/src/Button/index.scss +0 -9
  290. package/src/Button/index.tsx +0 -137
  291. package/src/Collapse/index.tsx +0 -86
  292. package/src/ColorPicker.tsx +0 -11
  293. package/src/Compact/index.tsx +0 -20
  294. package/src/DatePicker.tsx +0 -30
  295. package/src/Drawer/index.scss +0 -53
  296. package/src/Drawer/index.tsx +0 -211
  297. package/src/Empty/PRESENTED_IMAGE_SIMPLE.tsx +0 -15
  298. package/src/Empty/assets/EmptySvg.tsx +0 -43
  299. package/src/Empty/assets/SimpleEmptySvg.tsx +0 -16
  300. package/src/Empty/index.tsx +0 -25
  301. package/src/Form/Form.tsx +0 -94
  302. package/src/Form/FormItem.tsx +0 -141
  303. package/src/Form/context.ts +0 -16
  304. package/src/Form/index.ts +0 -13
  305. package/src/Image.tsx +0 -29
  306. package/src/Input.tsx +0 -202
  307. package/src/InputNumber.test.tsx +0 -46
  308. package/src/InputNumber.tsx +0 -139
  309. package/src/Modal.tsx +0 -221
  310. package/src/Popconfirm.tsx +0 -75
  311. package/src/Popover.tsx +0 -30
  312. package/src/Progress/index.tsx +0 -81
  313. package/src/Radio.tsx +0 -142
  314. package/src/Result.tsx +0 -38
  315. package/src/Segmented/index.tsx +0 -95
  316. package/src/Select.tsx +0 -138
  317. package/src/Skeleton.tsx +0 -14
  318. package/src/Spin.tsx +0 -34
  319. package/src/Switch.tsx +0 -34
  320. package/src/Table.tsx +0 -53
  321. package/src/Tabs.tsx +0 -131
  322. package/src/Timeline.tsx +0 -33
  323. package/src/Tooltip.tsx +0 -340
  324. package/src/Tree.tsx +0 -247
  325. package/src/Upload.tsx +0 -143
  326. package/src/hooks/createControllableValue.ts +0 -68
  327. package/src/hooks/createTransition.ts +0 -52
  328. package/src/hooks/createUpdateEffect.ts +0 -16
  329. package/src/hooks/index.ts +0 -2
  330. package/src/hooks/useClickAway.ts +0 -18
  331. package/src/hooks/useSize.ts +0 -26
  332. package/src/index.ts +0 -47
  333. package/src/types/index.ts +0 -5
  334. package/src/utils/EventEmitter.ts +0 -15
  335. package/src/utils/ReactToSolid.tsx +0 -38
  336. package/src/utils/SolidToReact.tsx +0 -27
  337. package/src/utils/array.ts +0 -21
  338. package/src/utils/component.tsx +0 -85
  339. package/src/utils/solid.ts +0 -61
  340. package/src/utils/zh_CN.ts +0 -236
  341. /package/es/{InputNumber.test.d.ts → InputNumber/index.test.d.ts} +0 -0
  342. /package/es/{Result.d.ts → Result/index.d.ts} +0 -0
  343. /package/es/{Timeline.d.ts → Timeline/index.d.ts} +0 -0
@@ -0,0 +1,10 @@
1
+ import { type ParentProps, type Component } from 'solid-js';
2
+ export interface AlertProps extends ParentProps {
3
+ /**
4
+ * 指定警告提示的样式,有四种选择 success、info、warning、error
5
+ * 默认 'info'
6
+ */
7
+ type?: 'success' | 'info' | 'warning' | 'error';
8
+ }
9
+ declare const Alert: Component<AlertProps>;
10
+ export default Alert;
@@ -0,0 +1,26 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps } from 'solid-js';
3
+ import cs from 'classnames';
4
+ import Element from '../Element/index.js';
5
+
6
+ const TypeClassDict = {
7
+ success: 'bg-[var(--ant-color-success-bg)] [border:var(--ant-line-width)_var(--ant-line-type)_var(--ant-color-success-border)]',
8
+ info: 'bg-[var(--ant-color-info-bg)] [border:var(--ant-line-width)_var(--ant-line-type)_var(--ant-color-info-border)]',
9
+ warning: 'bg-[var(--ant-color-warning-bg)] [border:var(--ant-line-width)_var(--ant-line-type)_var(--ant-color-warning-border)]',
10
+ error: 'bg-[var(--ant-color-error-bg)] [border:var(--ant-line-width)_var(--ant-line-type)_var(--ant-color-error-border)]'
11
+ };
12
+ const Alert = _props => {
13
+ const props = mergeProps({
14
+ type: 'info'
15
+ }, _props);
16
+ return createComponent(Element, {
17
+ get ["class"]() {
18
+ return cs('p-[var(--ant-alert-default-padding)] rounded-[var(--ant-border-radius-lg)] [font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]', TypeClassDict[props.type]);
19
+ },
20
+ get children() {
21
+ return props.children;
22
+ }
23
+ });
24
+ };
25
+
26
+ export { Alert as default };
@@ -1,20 +1,32 @@
1
1
  import { type Component, type ParentProps, type JSX } from 'solid-js';
2
2
  import './index.scss';
3
- interface ButtonProps extends ParentProps, JSX.CustomAttributes<HTMLButtonElement> {
3
+ import { type StringOrJSXElement } from '../types';
4
+ export interface ButtonProps extends ParentProps, JSX.CustomAttributes<HTMLButtonElement>, JSX.HTMLAttributes<HTMLButtonElement> {
4
5
  type?: 'default' | 'primary' | 'dashed' | 'text' | 'link';
5
6
  onClick?: ((e: MouseEvent) => void) | ((e: MouseEvent) => Promise<unknown>);
6
- 'on:click'?: (e: MouseEvent) => void;
7
7
  /**
8
8
  * 默认: middle
9
9
  */
10
- size?: 'large' | 'middle' | 'small';
10
+ size?: 'small' | 'middle' | 'large';
11
11
  class?: string;
12
12
  style?: JSX.CSSProperties;
13
- loading?: boolean;
13
+ /**
14
+ * 按钮加载中状态
15
+ * 'auto' 代表开启自动 loading,当按钮 click 事件返回 promise 对象时,会自动开启 loading 状态
16
+ */
17
+ loading?: boolean | 'auto';
14
18
  /**
15
19
  * 设置危险按钮
16
20
  */
17
21
  danger?: boolean;
22
+ disabled?: boolean;
23
+ /**
24
+ * 将按钮宽度调整为其父宽度的选项
25
+ */
26
+ block?: boolean;
27
+ contentClass?: string;
28
+ contentStyle?: JSX.CSSProperties;
29
+ icon?: StringOrJSXElement;
18
30
  }
19
31
  declare const Button: Component<ButtonProps>;
20
32
  export default Button;
@@ -1,75 +1,123 @@
1
- import { delegateEvents, use, insert, createComponent, effect, className, style, template } from 'solid-js/web';
2
- import { mergeProps, createSignal, createMemo, untrack, Show } from 'solid-js';
1
+ import { createComponent, mergeProps as mergeProps$1, insert, effect, className, style, template } from 'solid-js/web';
2
+ import { onMount, mergeProps, splitProps, createSignal, createMemo, children, Show } from 'solid-js';
3
3
  import cs from 'classnames';
4
- import Compact from '../Compact/index.js';
5
4
  import './index.scss.js';
5
+ import { wave } from '../utils/animation.js';
6
+ import Element from '../Element/index.js';
7
+ import useComponentSize from '../hooks/useComponentSize.js';
8
+ import { unwrapStringOrJSXElement } from '../utils/solid.js';
6
9
 
7
- const _tmpl$ = /*#__PURE__*/template(`<span class="i-ant-design:loading ant-[vertical-align:-0.125em] keyframes-spin ant-[animation:spin_1s_linear_infinite] ant-mr-8px">`),
8
- _tmpl$2 = /*#__PURE__*/template(`<button><span>`);
10
+ var _tmpl$ = /*#__PURE__*/template(`<span class="i-ant-design:loading [vertical-align:-0.125em] keyframes-spin [animation:spin_1s_linear_infinite]">`),
11
+ _tmpl$2 = /*#__PURE__*/template(`<span>`),
12
+ _tmpl$3 = /*#__PURE__*/template(`<span class="inline-block leading-inherit">`);
9
13
  const sizeClassMap = {
10
- large: 'ant-px-15px ant-py-6px ant-h-40px ant-rounded-8px',
11
- middle: 'ant-px-15px ant-py-4px ant-h-32px ant-rounded-6px',
12
- small: 'ant-px-7px ant-h-24px ant-rounded-4px'
14
+ large: 'px-15px py-7px h-40px leading-24px',
15
+ middle: 'px-15px py-4px h-32px leading-22px',
16
+ small: 'px-7px h-24px leading-22px'
13
17
  };
18
+ // 有边框按钮的 disabled 样式
19
+ const disabledWithBorderClass = '[border:1px_solid_var(--ant-button-border-color-disabled)] bg-[var(--ant-color-bg-container-disabled)] text-[var(--ant-color-text-disabled)]';
20
+ // 无边框按钮的 disabled 样式
21
+ const disabledWithNoBorderClass = 'text-[var(--ant-color-text-disabled)]';
14
22
  const typeClassMap = {
15
- default: danger => cs('ant-bg-white', danger ? 'ant-[border:1px_solid_var(--ant-color-error)] ant-text-[var(--ant-color-error)] hover:ant-[border-color:var(--light-error-color)] hover:ant-text-[var(--light-error-color)] active:ant-[border-color:var(--dark-error-color)] active:ant-text-[var(--dark-error-color)]' : 'ant-[border:1px_solid_var(--ant-color-border)] ant-text-[var(--dark-color)] hover:ant-[border-color:var(--ant-color-primary-hover)] hover:ant-text-[var(--ant-color-primary-hover)] active:ant-[border-color:var(--ant-color-primary-active)] active:ant-text-[var(--ant-color-primary-active)]'),
16
- primary: danger => cs('ant-text-white', danger ? 'ant-[border:1px_solid_var(--ant-color-error)] ant-bg-[var(--ant-color-error)] hover:ant-[border-color:var(--light-error-color)] hover:ant-bg-[var(--light-error-color)] active:ant-[border-color:var(--dark-error-color)] active:ant-bg-[var(--dark-error-color)]' : 'ant-[border:1px_solid_var(--ant-color-primary)] ant-bg-[var(--ant-color-primary)] hover:ant-[border-color:var(--ant-color-primary-hover)] hover:ant-bg-[var(--ant-color-primary-hover)] active:ant-[border-color:var(--ant-color-primary-active)] active:ant-bg-[var(--ant-color-primary-active)]'),
17
- dashed: danger => cs(' ant-bg-white', danger ? 'ant-[border:1px_dashed_var(--ant-color-error)] ant-text-[var(--ant-color-error)] hover:ant-[border-color:var(--light-error-color)] hover:ant-text-[var(--light-error-color)] active:ant-[border-color:var(--dark-error-color)] active:ant-text-[var(--dark-error-color)]' : 'ant-[border:1px_dashed_var(--ant-color-border)] ant-text-[var(--dark-color)] hover:ant-[border-color:var(--ant-color-primary-hover)] hover:ant-text-[var(--ant-color-primary-hover)] active:ant-[border-color:var(--ant-color-primary-active)] active:ant-text-[var(--ant-color-primary-active)]'),
18
- text: danger => cs('ant-border-none ant-bg-transparent', danger ? 'ant-text-[var(--ant-color-error)] hover:ant-bg-[var(--error-bg-color)] active:ant-bg-[var(--error-bg-color)]' : 'ant-text-[var(--dark-color)] hover:ant-bg-[rgba(0,0,0,0.06)] active:ant-bg-[rgba(0,0,0,.15)]'),
19
- link: danger => cs('ant-border-none ant-bg-transparent', danger ? 'ant-text-[var(--ant-color-error)] hover:ant-text-[var(--light-error-color)] active:ant-text-[var(--dark-error-color)]' : 'ant-text-[var(--ant-color-primary)] hover:ant-text-[var(--ant-color-primary-hover)] active:ant-text-[var(--ant-color-primary-active)]')
23
+ default: (danger, disabled) => disabled ? disabledWithBorderClass : cs('bg-[var(--ant-button-default-bg)]', danger ? '[border:1px_solid_var(--ant-color-error)] text-[var(--ant-color-error)] hover:[border-color:var(--ant-color-error-border-hover)] hover:text-[var(--ant-color-error-border-hover)] active:[border-color:var(--ant-color-error-active)] active:text-[var(--ant-color-error-active)]' : '[border:1px_solid_var(--ant-color-border)] text-[var(--ant-button-default-color)] hover:[border-color:var(--ant-color-primary-hover)] hover:text-[var(--ant-color-primary-hover)] active:[border-color:var(--ant-color-primary-active)] active:text-[var(--ant-color-primary-active)]'),
24
+ primary: (danger, disabled) => disabled ? disabledWithBorderClass : cs('text-white', danger ? '[border:1px_solid_var(--ant-color-error)] bg-[var(--ant-color-error)] hover:[border-color:var(--ant-color-error-border-hover)] hover:bg-[var(--ant-color-error-border-hover)] active:[border-color:var(--ant-color-error-active)] active:bg-[var(--ant-color-error-active)]' : '[border:1px_solid_var(--ant-color-primary)] bg-[var(--ant-color-primary)] hover:[border-color:var(--ant-color-primary-hover)] hover:bg-[var(--ant-color-primary-hover)] active:[border-color:var(--ant-color-primary-active)] active:bg-[var(--ant-color-primary-active)]'),
25
+ dashed: (danger, disabled) => disabled ? disabledWithBorderClass : cs(' bg-[var(--ant-button-default-bg)]', danger ? '[border:1px_dashed_var(--ant-color-error)] text-[var(--ant-color-error)] hover:[border-color:var(--ant-color-error-border-hover)] hover:text-[var(--ant-color-error-border-hover)] active:[border-color:var(--ant-color-error-active)] active:text-[var(--ant-color-error-active)]' : '[border:1px_dashed_var(--ant-color-border)] text-[var(--ant-button-default-color)] hover:[border-color:var(--ant-color-primary-hover)] hover:text-[var(--ant-color-primary-hover)] active:[border-color:var(--ant-color-primary-active)] active:text-[var(--ant-color-primary-active)]'),
26
+ text: (danger, disabled) => disabled ? disabledWithNoBorderClass : cs('border-none bg-transparent', danger ? 'text-[var(--ant-color-error)] hover:bg-[var(--ant-color-error-bg)] active:bg-[var(--ant-color-error-bg)]' : 'text-[var(--ant-color-text)] hover:bg-[var(--ant-color-bg-text-hover)] active:bg-[var(--ant-color-bg-text-active)]'),
27
+ link: (danger, disabled) => disabled ? disabledWithNoBorderClass : cs('border-none bg-transparent', danger ? 'text-[var(--ant-color-error)] hover:text-[var(--ant-color-error-border-hover)] active:text-[var(--ant-color-error-active)]' : 'text-[var(--ant-color-primary)] hover:text-[var(--ant-color-primary-hover)] active:text-[var(--ant-color-primary-active)]')
20
28
  };
21
- const Button = props => {
22
- const mergedProps = mergeProps({
29
+ const Button = _props => {
30
+ console.log('onMount button before');
31
+ onMount(() => {
32
+ console.log('onMount button');
33
+ });
34
+ console.log('onMount button after');
35
+ const props = mergeProps({
23
36
  type: 'default',
24
- size: 'middle'
25
- }, props);
37
+ danger: false,
38
+ disabled: false
39
+ }, _props);
40
+ const size = useComponentSize(() => props.size);
41
+ const [, buttonElementProps] = splitProps(props, ['type', 'size', 'loading', 'danger']);
26
42
  const [innerLoading, setLoading] = createSignal(false);
27
- const loading = createMemo(() => props.loading ?? innerLoading());
28
- return (() => {
29
- const _el$ = _tmpl$2(),
30
- _el$3 = _el$.firstChild;
31
- _el$.$$click = e => {
32
- const res = mergedProps.onClick?.(e);
33
- if (res instanceof Promise) {
43
+ const loading = createMemo(() => typeof props.loading === 'boolean' ? props.loading : innerLoading());
44
+ const resolvedChildren = children(() => props.children);
45
+ const resolvedIcon = children(() => unwrapStringOrJSXElement(props.icon));
46
+ return createComponent(Element, mergeProps$1({
47
+ tag: "button"
48
+ }, buttonElementProps, {
49
+ ref(r$) {
50
+ var _ref$ = props.ref;
51
+ typeof _ref$ === "function" ? _ref$(r$) : props.ref = r$;
52
+ },
53
+ get ["class"]() {
54
+ return cs(`ant-btn ant-btn-${props.type}`, 'inline-flex justify-center items-center gap-8px', 'relative cursor-pointer [font-size:var(--ant-font-size)] rounded-[--ant-button-border-radius]', 'focus-visible:[outline:4px_solid_var(--ant-color-primary-border)] focus-visible:[outline-offset:1px]', props.block && 'block w-full', props.class, sizeClassMap[size()], props.disabled && 'cursor-not-allowed', typeClassMap[props.type](props.danger, props.disabled), loading() && 'opacity-65');
55
+ },
56
+ get style() {
57
+ return {
58
+ '--ant-button-border-radius': {
59
+ small: 'var(--ant-border-radius-sm)',
60
+ middle: 'var(--ant-border-radius)',
61
+ large: 'var(--ant-border-radius-lg)'
62
+ }[size()],
63
+ ...props.style
64
+ };
65
+ },
66
+ get disabled() {
67
+ return props.disabled;
68
+ },
69
+ onClick: e => {
70
+ const res = props.onClick?.(e);
71
+ if (props.loading === 'auto' && res instanceof Promise) {
34
72
  setLoading(true);
35
73
  res.finally(() => setLoading(false));
36
74
  }
37
- if (mergedProps.type === 'default' || mergedProps.type === 'primary' || mergedProps.type === 'dashed') {
38
- const div = document.createElement('div');
39
- div.className = cs(props.danger ? 'ant-[--color:var(--light-error-color)]' : 'ant-[--color:var(--ant-color-primary-hover)]', 'ant-absolute ant-inset-0 ant-rounded-inherit ant-[background:radial-gradient(var(--color),rgba(0,0,0,0))] ant-z--1 ant-keyframes-button-border[inset:0px][inset:-6px] ant-[animation:button-border_ease-out_0.3s]');
40
- const onAnimationEnd = () => {
41
- div.remove();
42
- div.removeEventListener('animationend', onAnimationEnd);
43
- };
44
- div.addEventListener('animationend', onAnimationEnd);
45
- e.currentTarget.insertBefore(div, e.currentTarget.childNodes[0]);
75
+ if (props.type === 'default' || props.type === 'primary' || props.type === 'dashed') {
76
+ wave(e.currentTarget, props.danger ? 'var(--ant-color-error-border-hover)' : 'var(--ant-color-primary-hover)');
46
77
  }
47
- };
48
- const _ref$ = mergedProps.ref;
49
- typeof _ref$ === "function" ? use(_ref$, _el$) : mergedProps.ref = _el$;
50
- _el$.addEventListener("click", untrack(() => props['on:click']));
51
- insert(_el$, createComponent(Show, {
52
- get when() {
53
- return loading();
54
- },
55
- get children() {
56
- return _tmpl$();
57
- }
58
- }), _el$3);
59
- insert(_el$3, () => mergedProps.children);
60
- effect(_p$ => {
61
- const _v$ = cs(`ant-btn ant-btn-${mergedProps.type}`, 'ant-relative ant-cursor-pointer', 'focus-visible:ant-[outline:4px_solid_var(--ant-color-primary-border)] focus-visible:ant-[outline-offset:1px]', mergedProps.class, sizeClassMap[mergedProps.size], typeClassMap[mergedProps.type](props.danger ?? false), loading() && 'ant-opacity-65', 'ant-[--color:--ant-color-primary-hover]', Compact.compactItemRounded0Class, Compact.compactItemZIndexClass, Compact.compactItemClass),
62
- _v$2 = mergedProps.style;
63
- _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
64
- _p$._v$2 = style(_el$, _v$2, _p$._v$2);
65
- return _p$;
66
- }, {
67
- _v$: undefined,
68
- _v$2: undefined
69
- });
70
- return _el$;
71
- })();
78
+ },
79
+ get children() {
80
+ return [createComponent(Show, {
81
+ get when() {
82
+ return loading();
83
+ },
84
+ get fallback() {
85
+ return createComponent(Show, {
86
+ get when() {
87
+ return resolvedIcon();
88
+ },
89
+ get children() {
90
+ var _el$3 = _tmpl$3();
91
+ insert(_el$3, resolvedIcon);
92
+ return _el$3;
93
+ }
94
+ });
95
+ },
96
+ get children() {
97
+ return _tmpl$();
98
+ }
99
+ }), createComponent(Show, {
100
+ get when() {
101
+ return resolvedChildren();
102
+ },
103
+ get children() {
104
+ var _el$2 = _tmpl$2();
105
+ insert(_el$2, resolvedChildren);
106
+ effect(_p$ => {
107
+ var _v$ = cs('inline-block leading-inherit', props.contentClass),
108
+ _v$2 = props.contentStyle;
109
+ _v$ !== _p$.e && className(_el$2, _p$.e = _v$);
110
+ _p$.t = style(_el$2, _v$2, _p$.t);
111
+ return _p$;
112
+ }, {
113
+ e: undefined,
114
+ t: undefined
115
+ });
116
+ return _el$2;
117
+ }
118
+ })];
119
+ }
120
+ }));
72
121
  };
73
- delegateEvents(["click"]);
74
122
 
75
123
  export { Button as default };
@@ -1,6 +1,6 @@
1
1
  import styleInject from '../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = ".ant-compact .ant-btn-primary:not(:first-child) {\n border-left: 1px solid white;\n}\n.ant-compact .ant-btn-primary:not(:last-child) {\n border-right: 1px solid white;\n}";
3
+ var css_248z = ".ant-compact-horizontal .ant-btn {\n border-radius: 0;\n}\n.ant-compact-horizontal > :first-child.ant-btn, .ant-compact-horizontal > :first-child .ant-btn {\n border-top-left-radius: var(--ant-button-border-radius);\n border-bottom-left-radius: var(--ant-button-border-radius);\n}\n.ant-compact-horizontal > :last-child.ant-btn, .ant-compact-horizontal > :last-child .ant-btn {\n border-top-right-radius: var(--ant-button-border-radius);\n border-bottom-right-radius: var(--ant-button-border-radius);\n}\n.ant-compact-horizontal > :not(:first-child).ant-btn-primary, .ant-compact-horizontal > :not(:first-child) .ant-btn-primary {\n border-left: 1px solid white;\n}\n.ant-compact-horizontal > :not(:last-child).ant-btn-primary, .ant-compact-horizontal > :not(:last-child) .ant-btn-primary {\n border-right: 1px solid white;\n}\n\n.ant-compact-vertical .ant-btn {\n border-radius: 0;\n}\n.ant-compact-vertical > :first-child.ant-btn, .ant-compact-vertical > :first-child .ant-btn {\n border-top-left-radius: var(--ant-button-border-radius);\n border-top-right-radius: var(--ant-button-border-radius);\n}\n.ant-compact-vertical > :last-child.ant-btn, .ant-compact-vertical > :last-child .ant-btn {\n border-bottom-left-radius: var(--ant-button-border-radius);\n border-bottom-right-radius: var(--ant-button-border-radius);\n}\n.ant-compact-vertical > :not(:first-child).ant-btn-primary, .ant-compact-vertical > :not(:first-child) .ant-btn-primary {\n border-top: 1px solid white;\n}\n.ant-compact-vertical > :not(:last-child).ant-btn-primary, .ant-compact-vertical > :not(:last-child) .ant-btn-primary {\n border-bottom: 1px solid white;\n}";
4
4
  styleInject(css_248z);
5
5
 
6
6
  export { css_248z as default };
@@ -0,0 +1,19 @@
1
+ import type { Component, JSX } from 'solid-js';
2
+ import { type StringOrJSXElement, type Key } from '../types';
3
+ interface CheckboxOption {
4
+ label: StringOrJSXElement;
5
+ value: Key;
6
+ disabled?: boolean;
7
+ }
8
+ export interface CheckboxGroupProps {
9
+ defaultValue?: Key[];
10
+ value?: Key[];
11
+ onChange?: (values: Key[]) => void;
12
+ options: string[] | number[] | CheckboxOption[];
13
+ block?: boolean;
14
+ class?: string;
15
+ style?: JSX.CSSProperties;
16
+ disabled?: boolean;
17
+ }
18
+ declare const Group: Component<CheckboxGroupProps>;
19
+ export default Group;
@@ -0,0 +1,49 @@
1
+ import { createComponent, memo } from 'solid-js/web';
2
+ import { For } from 'solid-js';
3
+ import cs from 'classnames';
4
+ import createControllableValue from '../hooks/createControllableValue.js';
5
+ import Checkbox from './index.js';
6
+ import { unwrapStringOrJSXElement } from '../utils/solid.js';
7
+ import Element from '../Element/index.js';
8
+
9
+ const getOptionValue = option => typeof option === 'object' ? option.value : option;
10
+ const Group = props => {
11
+ const [value, setValue] = createControllableValue(props, {
12
+ defaultValue: []
13
+ });
14
+ return createComponent(Element, {
15
+ get ["class"]() {
16
+ return cs(props.block ? 'flex' : 'inline-flex', props.class);
17
+ },
18
+ get style() {
19
+ return props.style;
20
+ },
21
+ get children() {
22
+ return createComponent(For, {
23
+ get each() {
24
+ return props.options;
25
+ },
26
+ children: option => createComponent(Checkbox, {
27
+ get checked() {
28
+ return value().includes(getOptionValue(option));
29
+ },
30
+ onChange: e => {
31
+ if (e.target.checked) {
32
+ setValue(l => [...l, getOptionValue(option)]);
33
+ } else {
34
+ setValue(l => l.filter(v => getOptionValue(v) !== getOptionValue(option)));
35
+ }
36
+ },
37
+ get disabled() {
38
+ return props.disabled;
39
+ },
40
+ get children() {
41
+ return [memo(() => typeof option === 'object' ? unwrapStringOrJSXElement(option.label) : option), ' '];
42
+ }
43
+ })
44
+ });
45
+ }
46
+ });
47
+ };
48
+
49
+ export { Group as default };
@@ -0,0 +1,15 @@
1
+ import { type ParentProps, type Component, type JSX } from 'solid-js';
2
+ import Group from './Group';
3
+ export interface CheckboxProps extends ParentProps {
4
+ defaultChecked?: boolean;
5
+ indeterminate?: boolean;
6
+ checked?: boolean;
7
+ onChange?: JSX.ChangeEventHandler<HTMLInputElement, Event>;
8
+ class?: string;
9
+ style?: JSX.CSSProperties;
10
+ disabled?: boolean;
11
+ }
12
+ declare const Checkbox: Component<CheckboxProps> & {
13
+ Group: typeof Group;
14
+ };
15
+ export default Checkbox;
@@ -0,0 +1,60 @@
1
+ import { createComponent, effect, className, insert, template } from 'solid-js/web';
2
+ import { Show } from 'solid-js';
3
+ import cs from 'classnames';
4
+ import createControllableValue from '../hooks/createControllableValue.js';
5
+ import Group from './Group.js';
6
+ import Element from '../Element/index.js';
7
+
8
+ var _tmpl$ = /*#__PURE__*/template(`<span><input class="m-0 hidden"type=checkbox>`),
9
+ _tmpl$2 = /*#__PURE__*/template(`<span>`);
10
+ const Checkbox = props => {
11
+ const [checked, setChecked] = createControllableValue(props, {
12
+ defaultValue: false,
13
+ defaultValuePropName: 'defaultChecked',
14
+ valuePropName: 'checked',
15
+ trigger: false
16
+ });
17
+ return createComponent(Element, {
18
+ tag: "label",
19
+ get ["class"]() {
20
+ return cs('inline-flex cursor-pointer inline-flex items-center [font-size:var(--ant-font-size)] text-[var(--ant-color-text)] leading-[var(--ant-line-height)]', props.class, props.disabled && 'cursor-not-allowed');
21
+ },
22
+ get style() {
23
+ return props.style;
24
+ },
25
+ get children() {
26
+ return [(() => {
27
+ var _el$ = _tmpl$(),
28
+ _el$2 = _el$.firstChild;
29
+ _el$2.addEventListener("change", e => {
30
+ if (props.disabled) return;
31
+ e.target.checked = setChecked(v => !v);
32
+ props.onChange?.(e);
33
+ });
34
+ effect(() => className(_el$, cs('w-16px h-16px rounded-[var(--ant-border-radius-sm)] relative', (() => {
35
+ if (checked()) {
36
+ return ['after:content-empty after:block after:absolute after:top-[calc(50%-1px)] after:left-1/2 after:-translate-1/2 after:-rotate-45 after:w-10px after:h-6px', 'after:border-solid after:border-2px after:border-t-0px after:border-r-0px', props.disabled ? 'bg-[var(--ant-color-bg-container-disabled)] [border:1px_solid_var(--ant-color-border)] after:border-[var(--ant-color-text-disabled)]' : 'bg-[var(--ant-color-primary)] after:border-white'];
37
+ }
38
+ if (props.indeterminate) {
39
+ return ['[border:1px_solid_var(--ant-color-border)]', 'after:content-empty after:block after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:w-8px after:h-8px', props.disabled ? 'after:bg-[var(--ant-color-text-disabled)]' : 'after:bg-[var(--ant-color-primary)]'];
40
+ }
41
+ return ['[border:1px_solid_var(--ant-color-border)]', props.disabled ? 'bg-[var(--ant-color-bg-container-disabled)]' : 'bg-[--ant-color-bg-container]'];
42
+ })())));
43
+ return _el$;
44
+ })(), createComponent(Show, {
45
+ get when() {
46
+ return props.children;
47
+ },
48
+ get children() {
49
+ var _el$3 = _tmpl$2();
50
+ insert(_el$3, () => props.children);
51
+ effect(() => className(_el$3, cs('px-8px', props.disabled && 'text-[var(--ant-color-text-disabled)]')));
52
+ return _el$3;
53
+ }
54
+ })];
55
+ }
56
+ });
57
+ };
58
+ Checkbox.Group = Group;
59
+
60
+ export { Checkbox as default };
@@ -0,0 +1,18 @@
1
+ import { type Component } from 'solid-js';
2
+ import { type StyleProps } from '../types';
3
+ export interface CodeInputProps extends StyleProps {
4
+ defaultValue?: string;
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ /**
8
+ * 验证码输入完全触发
9
+ */
10
+ onComplete?: (value: string) => void;
11
+ /**
12
+ * 验证码长度
13
+ * 默认:6
14
+ */
15
+ length?: number;
16
+ }
17
+ declare const CodeInput: Component<CodeInputProps>;
18
+ export default CodeInput;
@@ -0,0 +1,72 @@
1
+ import { createComponent } from 'solid-js/web';
2
+ import { mergeProps, createMemo, createEffect, on, For, onCleanup } from 'solid-js';
3
+ import { unset } from 'lodash-es';
4
+ import cs from 'classnames';
5
+ import Element from '../Element/index.js';
6
+ import Input from '../Input/index.js';
7
+ import createControllableValue from '../hooks/createControllableValue.js';
8
+
9
+ const CodeInput = _props => {
10
+ const props = mergeProps({
11
+ length: 6
12
+ }, _props);
13
+ const [_value, setValue] = createControllableValue(props);
14
+ const value = createMemo(() => _value() ?? '');
15
+ createEffect(on(value, () => {
16
+ onFocus();
17
+ }, {
18
+ defer: true
19
+ }));
20
+ const inputRefDict = {};
21
+ const onFocus = () => {
22
+ const index = Math.min(value().length, props.length - 1);
23
+ inputRefDict[index].focus();
24
+ };
25
+ return createComponent(Element, {
26
+ get ["class"]() {
27
+ return cs(props.class, 'flex gap-[--ant-margin-sm] cursor-text');
28
+ },
29
+ get style() {
30
+ return props.style;
31
+ },
32
+ tabIndex: 0,
33
+ onFocus: onFocus,
34
+ onKeyDown: e => {
35
+ if (e.code !== 'Backspace') return;
36
+ setValue(e.metaKey ? '' : value().slice(0, -1));
37
+ },
38
+ get children() {
39
+ return createComponent(For, {
40
+ get each() {
41
+ return Array(props.length).fill(0).map((_, i) => i);
42
+ },
43
+ children: item => {
44
+ onCleanup(() => {
45
+ unset(inputRefDict, item);
46
+ });
47
+ return createComponent(Input, {
48
+ ref: el => {
49
+ inputRefDict[item] = el;
50
+ },
51
+ "class": "!w-32px !text-center",
52
+ get value() {
53
+ return value()[item];
54
+ },
55
+ onChange: e => {
56
+ const v = e.target.value;
57
+ if (!v || value().length >= props.length) return;
58
+ const newValue = `${value()}${v}`.replace(/\D/g, '');
59
+ if (newValue.length === props.length) {
60
+ props.onComplete?.(newValue);
61
+ }
62
+ setValue(newValue.slice(0, props.length));
63
+ },
64
+ onFocus: onFocus
65
+ });
66
+ }
67
+ });
68
+ }
69
+ });
70
+ };
71
+
72
+ export { CodeInput as default };
@@ -0,0 +1,46 @@
1
+ import { type Accessor, type Component, type JSX, type ParentProps } from 'solid-js';
2
+ import { type StyleProps, type StringOrJSXElement } from '../types';
3
+ export interface CollapseItemProps extends ParentProps, StyleProps {
4
+ defaultOpen?: boolean;
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ label: StringOrJSXElement;
8
+ /**
9
+ * 类型
10
+ * 默认 'line'
11
+ */
12
+ type?: 'line' | 'card';
13
+ bordered?: boolean;
14
+ /**
15
+ * 设置折叠面板大小
16
+ * 默认 'middle'
17
+ */
18
+ size?: 'small' | 'middle' | 'large';
19
+ /**
20
+ * 自定义渲染每个面板右上角的内容
21
+ */
22
+ extra?: StringOrJSXElement;
23
+ /**
24
+ * 是否禁用 children
25
+ */
26
+ disabledChildren?: boolean;
27
+ /**
28
+ * 自定义切换图标
29
+ * 为 false 代表不显示图标
30
+ */
31
+ expandIcon?: boolean | ((options: {
32
+ isActive: Accessor<boolean>;
33
+ }) => JSX.Element);
34
+ /**
35
+ * 设置图标位置
36
+ * 默认 'left'
37
+ */
38
+ expandIconPosition?: 'left' | 'right' | 'end';
39
+ /**
40
+ * collapse header style
41
+ */
42
+ headerStyle?: JSX.CSSProperties;
43
+ bodyStyle?: JSX.CSSProperties;
44
+ }
45
+ declare const CollapseItem: Component<CollapseItemProps>;
46
+ export default CollapseItem;