@ebscn/ui 0.0.10 → 1.0.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 (438) hide show
  1. package/README.md +44 -0
  2. package/cjs/components/alphabet-keyboard/alphabet-keyboard.css +143 -0
  3. package/cjs/components/alphabet-keyboard/alphabet-keyboard.d.ts +11 -0
  4. package/cjs/components/alphabet-keyboard/alphabet-keyboard.js +139 -0
  5. package/cjs/components/alphabet-keyboard/index.d.ts +4 -0
  6. package/cjs/components/alphabet-keyboard/index.js +9 -0
  7. package/cjs/components/button/button.css +152 -0
  8. package/cjs/components/button/button.d.ts +40 -0
  9. package/cjs/components/button/button.js +215 -0
  10. package/cjs/components/button/index.d.ts +4 -0
  11. package/cjs/components/button/index.js +9 -0
  12. package/cjs/components/card/card.css +37 -0
  13. package/cjs/components/card/card.d.ts +17 -0
  14. package/cjs/components/card/card.js +40 -0
  15. package/cjs/components/card/index.d.ts +4 -0
  16. package/cjs/components/card/index.js +10 -0
  17. package/cjs/components/checkbox/checkbox.css +92 -0
  18. package/cjs/components/checkbox/checkbox.d.ts +44 -0
  19. package/cjs/components/checkbox/checkbox.js +106 -0
  20. package/cjs/components/checkbox/group-context.d.ts +8 -0
  21. package/cjs/components/checkbox/group-context.js +8 -0
  22. package/cjs/components/checkbox/group.d.ts +10 -0
  23. package/cjs/components/checkbox/group.js +48 -0
  24. package/cjs/components/checkbox/index.d.ts +26 -0
  25. package/cjs/components/checkbox/index.js +14 -0
  26. package/cjs/components/checkbox/native-input.d.ts +10 -0
  27. package/cjs/components/checkbox/native-input.js +38 -0
  28. package/cjs/components/grid/grid.css +15 -0
  29. package/cjs/components/grid/grid.d.ts +15 -0
  30. package/cjs/components/grid/grid.js +45 -0
  31. package/cjs/components/grid/index.d.ts +7 -0
  32. package/cjs/components/grid/index.js +12 -0
  33. package/cjs/components/icons/check-icon.d.ts +4 -0
  34. package/cjs/components/icons/check-icon.js +30 -0
  35. package/cjs/components/icons/check-only-icon.d.ts +4 -0
  36. package/cjs/components/icons/check-only-icon.js +21 -0
  37. package/cjs/components/icons/clear-icon.d.ts +4 -0
  38. package/cjs/components/icons/clear-icon.js +41 -0
  39. package/cjs/components/icons/indeterminate-icon.d.ts +4 -0
  40. package/cjs/components/icons/indeterminate-icon.js +29 -0
  41. package/cjs/components/icons/index.d.ts +8 -0
  42. package/cjs/components/icons/index.js +62 -0
  43. package/cjs/components/icons/loading-icon.d.ts +4 -0
  44. package/cjs/components/icons/loading-icon.js +89 -0
  45. package/cjs/components/icons/search-icon.d.ts +4 -0
  46. package/cjs/components/icons/search-icon.js +43 -0
  47. package/cjs/components/icons/spin-icon.d.ts +4 -0
  48. package/cjs/components/icons/spin-icon.js +32 -0
  49. package/cjs/components/icons/uncheck-icon.d.ts +4 -0
  50. package/cjs/components/icons/uncheck-icon.js +26 -0
  51. package/cjs/components/imageViewer/imageViewer.d.ts +4 -0
  52. package/cjs/components/imageViewer/imageViewer.js +35 -0
  53. package/cjs/components/imageViewer/index.js +9 -0
  54. package/cjs/components/marketTag/index.d.ts +4 -0
  55. package/cjs/components/marketTag/index.js +9 -0
  56. package/cjs/components/marketTag/marketTag.css +14 -0
  57. package/cjs/components/marketTag/marketTag.d.ts +11 -0
  58. package/cjs/components/marketTag/marketTag.js +27 -0
  59. package/cjs/components/number-keyboard/index.d.ts +4 -0
  60. package/cjs/components/number-keyboard/index.js +9 -0
  61. package/cjs/components/number-keyboard/number-keyboard.css +77 -0
  62. package/cjs/components/number-keyboard/number-keyboard.d.ts +13 -0
  63. package/cjs/components/number-keyboard/number-keyboard.js +93 -0
  64. package/cjs/components/pdfLink/index.d.ts +3 -0
  65. package/cjs/components/pdfLink/index.js +10 -0
  66. package/cjs/components/pdfLink/pdfLink.css +11 -0
  67. package/cjs/components/pdfLink/pdfLink.d.ts +8 -0
  68. package/cjs/components/pdfLink/pdfLink.js +102 -0
  69. package/cjs/components/protocol/index.d.ts +3 -0
  70. package/cjs/components/protocol/index.js +10 -0
  71. package/cjs/components/protocol/protocol.css +46 -0
  72. package/cjs/components/protocol/protocol.d.ts +15 -0
  73. package/cjs/components/protocol/protocol.js +120 -0
  74. package/cjs/components/radio/group-context.d.ts +8 -0
  75. package/cjs/components/radio/group-context.js +8 -0
  76. package/cjs/components/radio/group.d.ts +10 -0
  77. package/cjs/components/radio/group.js +43 -0
  78. package/cjs/components/radio/index.d.ts +8 -0
  79. package/cjs/components/radio/index.js +13 -0
  80. package/cjs/components/radio/radio.css +92 -0
  81. package/cjs/components/radio/radio.d.ts +19 -0
  82. package/cjs/components/radio/radio.js +92 -0
  83. package/cjs/components/search/index.d.ts +3 -0
  84. package/cjs/components/search/index.js +10 -0
  85. package/cjs/components/search/search.css +53 -0
  86. package/cjs/components/search/search.d.ts +15 -0
  87. package/cjs/components/search/search.js +110 -0
  88. package/cjs/components/stock-count-keyboard/index.d.ts +4 -0
  89. package/cjs/components/stock-count-keyboard/index.js +9 -0
  90. package/cjs/components/stock-count-keyboard/stock-count-keyboard.css +74 -0
  91. package/cjs/components/stock-count-keyboard/stock-count-keyboard.d.ts +9 -0
  92. package/cjs/components/stock-count-keyboard/stock-count-keyboard.js +82 -0
  93. package/cjs/components/stock-keyboard/index.d.ts +4 -0
  94. package/cjs/components/stock-keyboard/index.js +9 -0
  95. package/cjs/components/stock-keyboard/stock-keyboard.css +111 -0
  96. package/cjs/components/stock-keyboard/stock-keyboard.d.ts +12 -0
  97. package/cjs/components/stock-keyboard/stock-keyboard.js +107 -0
  98. package/cjs/components/switch/index.d.ts +4 -0
  99. package/cjs/components/switch/index.js +10 -0
  100. package/cjs/components/switch/switch.css +104 -0
  101. package/cjs/components/switch/switch.d.ts +16 -0
  102. package/cjs/components/switch/switch.js +213 -0
  103. package/cjs/components/toastLoading/index.d.ts +4 -0
  104. package/cjs/components/toastLoading/index.js +9 -0
  105. package/cjs/components/toastLoading/toastLoading.css +27 -0
  106. package/cjs/components/toastLoading/toastLoading.d.ts +7 -0
  107. package/cjs/components/toastLoading/toastLoading.js +35 -0
  108. package/cjs/global/global.css +289 -0
  109. package/cjs/global/index.d.ts +1 -0
  110. package/cjs/global/index.js +11 -0
  111. package/cjs/global/theme-dark.css +18 -0
  112. package/cjs/global/theme-default.css +48 -0
  113. package/cjs/index.d.ts +18 -0
  114. package/cjs/index.js +149 -0
  115. package/cjs/utils/attach-properties-to-component.d.ts +1 -0
  116. package/cjs/utils/attach-properties-to-component.js +15 -0
  117. package/cjs/utils/bound.d.ts +1 -0
  118. package/cjs/utils/bound.js +16 -0
  119. package/cjs/utils/can-use-dom.d.ts +1 -0
  120. package/cjs/utils/can-use-dom.js +7 -0
  121. package/cjs/utils/convert-px.d.ts +1 -0
  122. package/cjs/utils/convert-px.js +33 -0
  123. package/cjs/utils/create-icon-component.d.ts +2 -0
  124. package/cjs/utils/create-icon-component.js +12 -0
  125. package/cjs/utils/dev-log.d.ts +3 -0
  126. package/cjs/utils/dev-log.js +45 -0
  127. package/cjs/utils/generate-int-array.d.ts +1 -0
  128. package/cjs/utils/generate-int-array.js +13 -0
  129. package/cjs/utils/get-container.d.ts +2 -0
  130. package/cjs/utils/get-container.js +10 -0
  131. package/cjs/utils/get-scroll-parent.d.ts +3 -0
  132. package/cjs/utils/get-scroll-parent.js +30 -0
  133. package/cjs/utils/is-dev.d.ts +1 -0
  134. package/cjs/utils/is-dev.js +7 -0
  135. package/cjs/utils/is-node-with-content.d.ts +4 -0
  136. package/cjs/utils/is-node-with-content.js +9 -0
  137. package/cjs/utils/matrix.d.ts +10 -0
  138. package/cjs/utils/matrix.js +47 -0
  139. package/cjs/utils/measure-css-length.d.ts +1 -0
  140. package/cjs/utils/measure-css-length.js +29 -0
  141. package/cjs/utils/merge-locale.d.ts +1 -0
  142. package/cjs/utils/merge-locale.js +21 -0
  143. package/cjs/utils/native-props.d.ts +8 -0
  144. package/cjs/utils/native-props.js +38 -0
  145. package/cjs/utils/nearest.d.ts +1 -0
  146. package/cjs/utils/nearest.js +11 -0
  147. package/cjs/utils/noop.d.ts +1 -0
  148. package/cjs/utils/noop.js +8 -0
  149. package/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
  150. package/cjs/utils/reduce-and-restore-motion.js +44 -0
  151. package/cjs/utils/render-imperatively.d.ts +13 -0
  152. package/cjs/utils/render-imperatively.js +207 -0
  153. package/cjs/utils/render-to-body.d.ts +2 -0
  154. package/cjs/utils/render-to-body.js +19 -0
  155. package/cjs/utils/render-to-container.d.ts +3 -0
  156. package/cjs/utils/render-to-container.js +16 -0
  157. package/cjs/utils/render.d.ts +9 -0
  158. package/cjs/utils/render.js +196 -0
  159. package/cjs/utils/replace-message.d.ts +1 -0
  160. package/cjs/utils/replace-message.js +13 -0
  161. package/cjs/utils/rubberband.d.ts +2 -0
  162. package/cjs/utils/rubberband.js +20 -0
  163. package/cjs/utils/should-render.d.ts +10 -0
  164. package/cjs/utils/should-render.js +20 -0
  165. package/cjs/utils/shuffle.d.ts +6 -0
  166. package/cjs/utils/shuffle.js +29 -0
  167. package/cjs/utils/sleep.d.ts +1 -0
  168. package/cjs/utils/sleep.js +12 -0
  169. package/cjs/utils/supports-passive.d.ts +1 -0
  170. package/cjs/utils/supports-passive.js +19 -0
  171. package/cjs/utils/to-css-length.d.ts +1 -0
  172. package/cjs/utils/to-css-length.js +9 -0
  173. package/cjs/utils/traverse-react-node.d.ts +2 -0
  174. package/cjs/utils/traverse-react-node.js +23 -0
  175. package/cjs/utils/tree.d.ts +1 -0
  176. package/cjs/utils/tree.js +24 -0
  177. package/cjs/utils/undefined-fallback.d.ts +3 -0
  178. package/cjs/utils/undefined-fallback.js +17 -0
  179. package/cjs/utils/use-drag-and-pinch.d.ts +1 -0
  180. package/cjs/utils/use-drag-and-pinch.js +8 -0
  181. package/cjs/utils/use-initialized.d.ts +1 -0
  182. package/cjs/utils/use-initialized.js +14 -0
  183. package/cjs/utils/use-inner-visible.d.ts +1 -0
  184. package/cjs/utils/use-inner-visible.js +17 -0
  185. package/cjs/utils/use-isomorphic-update-layout-effect.d.ts +2 -0
  186. package/cjs/utils/use-isomorphic-update-layout-effect.js +8 -0
  187. package/cjs/utils/use-lock-scroll.d.ts +2 -0
  188. package/cjs/utils/use-lock-scroll.js +84 -0
  189. package/cjs/utils/use-mutation-effect.d.ts +2 -0
  190. package/cjs/utils/use-mutation-effect.js +21 -0
  191. package/cjs/utils/use-props-value.d.ts +8 -0
  192. package/cjs/utils/use-props-value.js +30 -0
  193. package/cjs/utils/use-ref-state.d.ts +2 -0
  194. package/cjs/utils/use-ref-state.js +17 -0
  195. package/cjs/utils/use-resize-effect.d.ts +2 -0
  196. package/cjs/utils/use-resize-effect.js +29 -0
  197. package/cjs/utils/use-tab-list-scroll.d.ts +5 -0
  198. package/cjs/utils/use-tab-list-scroll.js +67 -0
  199. package/cjs/utils/use-touch.d.ts +17 -0
  200. package/cjs/utils/use-touch.js +69 -0
  201. package/cjs/utils/validate.d.ts +8 -0
  202. package/cjs/utils/validate.js +39 -0
  203. package/cjs/utils/with-cache.d.ts +1 -0
  204. package/cjs/utils/with-cache.js +15 -0
  205. package/cjs/utils/with-default-props.d.ts +2 -0
  206. package/cjs/utils/with-default-props.js +32 -0
  207. package/cjs/utils/with-func-props.d.ts +5 -0
  208. package/cjs/utils/with-func-props.js +38 -0
  209. package/cjs/utils/with-stop-propagation.d.ts +4 -0
  210. package/cjs/utils/with-stop-propagation.js +37 -0
  211. package/es/components/alphabet-keyboard/alphabet-keyboard.css +143 -0
  212. package/es/components/alphabet-keyboard/alphabet-keyboard.d.ts +11 -0
  213. package/es/components/alphabet-keyboard/alphabet-keyboard.js +132 -0
  214. package/es/components/alphabet-keyboard/index.d.ts +4 -0
  215. package/es/components/alphabet-keyboard/index.js +3 -0
  216. package/es/components/button/button.css +152 -0
  217. package/es/components/button/button.d.ts +40 -0
  218. package/es/components/button/button.js +206 -0
  219. package/es/components/button/index.d.ts +4 -0
  220. package/es/components/button/index.js +3 -0
  221. package/es/components/card/card.css +37 -0
  222. package/es/components/card/card.d.ts +17 -0
  223. package/es/components/card/card.js +33 -0
  224. package/es/components/card/index.d.ts +4 -0
  225. package/es/components/card/index.js +3 -0
  226. package/es/components/checkbox/checkbox.css +92 -0
  227. package/es/components/checkbox/checkbox.d.ts +44 -0
  228. package/es/components/checkbox/checkbox.js +97 -0
  229. package/es/components/checkbox/group-context.d.ts +8 -0
  230. package/es/components/checkbox/group-context.js +2 -0
  231. package/es/components/checkbox/group.d.ts +10 -0
  232. package/es/components/checkbox/group.js +40 -0
  233. package/es/components/checkbox/index.d.ts +26 -0
  234. package/es/components/checkbox/index.js +7 -0
  235. package/es/components/checkbox/native-input.d.ts +10 -0
  236. package/es/components/checkbox/native-input.js +29 -0
  237. package/es/components/grid/grid.css +15 -0
  238. package/es/components/grid/grid.d.ts +15 -0
  239. package/es/components/grid/grid.js +36 -0
  240. package/es/components/grid/index.d.ts +7 -0
  241. package/es/components/grid/index.js +6 -0
  242. package/es/components/icons/check-icon.d.ts +4 -0
  243. package/es/components/icons/check-icon.js +22 -0
  244. package/es/components/icons/check-only-icon.d.ts +4 -0
  245. package/es/components/icons/check-only-icon.js +13 -0
  246. package/es/components/icons/clear-icon.d.ts +4 -0
  247. package/es/components/icons/clear-icon.js +33 -0
  248. package/es/components/icons/indeterminate-icon.d.ts +4 -0
  249. package/es/components/icons/indeterminate-icon.js +21 -0
  250. package/es/components/icons/index.d.ts +8 -0
  251. package/es/components/icons/index.js +8 -0
  252. package/es/components/icons/loading-icon.d.ts +4 -0
  253. package/es/components/icons/loading-icon.js +81 -0
  254. package/es/components/icons/search-icon.d.ts +4 -0
  255. package/es/components/icons/search-icon.js +35 -0
  256. package/es/components/icons/spin-icon.d.ts +4 -0
  257. package/es/components/icons/spin-icon.js +24 -0
  258. package/es/components/icons/uncheck-icon.d.ts +4 -0
  259. package/es/components/icons/uncheck-icon.js +18 -0
  260. package/es/components/imageViewer/imageViewer.d.ts +4 -0
  261. package/es/components/imageViewer/imageViewer.js +28 -0
  262. package/es/components/imageViewer/index.d.ts +7 -0
  263. package/es/components/imageViewer/index.js +2 -0
  264. package/es/components/marketTag/index.d.ts +4 -0
  265. package/es/components/marketTag/index.js +3 -0
  266. package/es/components/marketTag/marketTag.css +14 -0
  267. package/es/components/marketTag/marketTag.d.ts +11 -0
  268. package/es/components/marketTag/marketTag.js +19 -0
  269. package/es/components/number-keyboard/index.d.ts +4 -0
  270. package/es/components/number-keyboard/index.js +3 -0
  271. package/es/components/number-keyboard/number-keyboard.css +77 -0
  272. package/es/components/number-keyboard/number-keyboard.d.ts +13 -0
  273. package/es/components/number-keyboard/number-keyboard.js +85 -0
  274. package/es/components/pdfLink/index.d.ts +3 -0
  275. package/es/components/pdfLink/index.js +3 -0
  276. package/es/components/pdfLink/pdfLink.css +11 -0
  277. package/es/components/pdfLink/pdfLink.d.ts +8 -0
  278. package/es/components/pdfLink/pdfLink.js +94 -0
  279. package/es/components/protocol/index.d.ts +3 -0
  280. package/es/components/protocol/index.js +3 -0
  281. package/es/components/protocol/protocol.css +46 -0
  282. package/es/components/protocol/protocol.d.ts +15 -0
  283. package/es/components/protocol/protocol.js +112 -0
  284. package/es/components/radio/group-context.d.ts +8 -0
  285. package/es/components/radio/group-context.js +2 -0
  286. package/es/components/radio/group.d.ts +10 -0
  287. package/es/components/radio/group.js +35 -0
  288. package/es/components/radio/index.d.ts +8 -0
  289. package/es/components/radio/index.js +7 -0
  290. package/es/components/radio/radio.css +92 -0
  291. package/es/components/radio/radio.d.ts +19 -0
  292. package/es/components/radio/radio.js +82 -0
  293. package/es/components/search/index.d.ts +3 -0
  294. package/es/components/search/index.js +3 -0
  295. package/es/components/search/search.css +53 -0
  296. package/es/components/search/search.d.ts +15 -0
  297. package/es/components/search/search.js +102 -0
  298. package/es/components/stock-count-keyboard/index.d.ts +4 -0
  299. package/es/components/stock-count-keyboard/index.js +3 -0
  300. package/es/components/stock-count-keyboard/stock-count-keyboard.css +74 -0
  301. package/es/components/stock-count-keyboard/stock-count-keyboard.d.ts +9 -0
  302. package/es/components/stock-count-keyboard/stock-count-keyboard.js +74 -0
  303. package/es/components/stock-keyboard/index.d.ts +4 -0
  304. package/es/components/stock-keyboard/index.js +3 -0
  305. package/es/components/stock-keyboard/stock-keyboard.css +111 -0
  306. package/es/components/stock-keyboard/stock-keyboard.d.ts +12 -0
  307. package/es/components/stock-keyboard/stock-keyboard.js +99 -0
  308. package/es/components/switch/index.d.ts +4 -0
  309. package/es/components/switch/index.js +3 -0
  310. package/es/components/switch/switch.css +104 -0
  311. package/es/components/switch/switch.d.ts +16 -0
  312. package/es/components/switch/switch.js +204 -0
  313. package/es/components/toastLoading/index.d.ts +4 -0
  314. package/es/components/toastLoading/index.js +3 -0
  315. package/es/components/toastLoading/toastLoading.css +27 -0
  316. package/es/components/toastLoading/toastLoading.d.ts +7 -0
  317. package/es/components/toastLoading/toastLoading.js +27 -0
  318. package/es/global/global.css +289 -0
  319. package/es/global/index.d.ts +1 -0
  320. package/es/global/index.js +9 -0
  321. package/es/global/theme-dark.css +18 -0
  322. package/es/global/theme-default.css +48 -0
  323. package/es/index.d.ts +18 -0
  324. package/es/index.js +18 -0
  325. package/es/utils/attach-properties-to-component.d.ts +1 -0
  326. package/es/utils/attach-properties-to-component.js +9 -0
  327. package/es/utils/bound.d.ts +1 -0
  328. package/es/utils/bound.js +10 -0
  329. package/es/utils/can-use-dom.d.ts +1 -0
  330. package/es/utils/can-use-dom.js +1 -0
  331. package/es/utils/convert-px.d.ts +1 -0
  332. package/es/utils/convert-px.js +27 -0
  333. package/es/utils/create-icon-component.d.ts +2 -0
  334. package/es/utils/create-icon-component.js +6 -0
  335. package/es/utils/dev-log.d.ts +3 -0
  336. package/es/utils/dev-log.js +37 -0
  337. package/es/utils/generate-int-array.d.ts +1 -0
  338. package/es/utils/generate-int-array.js +7 -0
  339. package/es/utils/get-container.d.ts +2 -0
  340. package/es/utils/get-container.js +4 -0
  341. package/es/utils/get-scroll-parent.d.ts +3 -0
  342. package/es/utils/get-scroll-parent.js +24 -0
  343. package/es/utils/is-dev.d.ts +1 -0
  344. package/es/utils/is-dev.js +1 -0
  345. package/es/utils/is-node-with-content.d.ts +4 -0
  346. package/es/utils/is-node-with-content.js +3 -0
  347. package/es/utils/matrix.d.ts +10 -0
  348. package/es/utils/matrix.js +32 -0
  349. package/es/utils/measure-css-length.d.ts +1 -0
  350. package/es/utils/measure-css-length.js +23 -0
  351. package/es/utils/merge-locale.d.ts +1 -0
  352. package/es/utils/merge-locale.js +15 -0
  353. package/es/utils/native-props.d.ts +8 -0
  354. package/es/utils/native-props.js +31 -0
  355. package/es/utils/nearest.d.ts +1 -0
  356. package/es/utils/nearest.js +5 -0
  357. package/es/utils/noop.d.ts +1 -0
  358. package/es/utils/noop.js +1 -0
  359. package/es/utils/reduce-and-restore-motion.d.ts +4 -0
  360. package/es/utils/reduce-and-restore-motion.js +35 -0
  361. package/es/utils/render-imperatively.d.ts +13 -0
  362. package/es/utils/render-imperatively.js +199 -0
  363. package/es/utils/render-to-body.d.ts +2 -0
  364. package/es/utils/render-to-body.js +13 -0
  365. package/es/utils/render-to-container.d.ts +3 -0
  366. package/es/utils/render-to-container.js +10 -0
  367. package/es/utils/render.d.ts +9 -0
  368. package/es/utils/render.js +187 -0
  369. package/es/utils/replace-message.d.ts +1 -0
  370. package/es/utils/replace-message.js +7 -0
  371. package/es/utils/rubberband.d.ts +2 -0
  372. package/es/utils/rubberband.js +13 -0
  373. package/es/utils/should-render.d.ts +10 -0
  374. package/es/utils/should-render.js +12 -0
  375. package/es/utils/shuffle.d.ts +6 -0
  376. package/es/utils/shuffle.js +23 -0
  377. package/es/utils/sleep.d.ts +1 -0
  378. package/es/utils/sleep.js +5 -0
  379. package/es/utils/supports-passive.d.ts +1 -0
  380. package/es/utils/supports-passive.js +13 -0
  381. package/es/utils/to-css-length.d.ts +1 -0
  382. package/es/utils/to-css-length.js +3 -0
  383. package/es/utils/traverse-react-node.d.ts +2 -0
  384. package/es/utils/traverse-react-node.js +16 -0
  385. package/es/utils/tree.d.ts +1 -0
  386. package/es/utils/tree.js +18 -0
  387. package/es/utils/undefined-fallback.d.ts +3 -0
  388. package/es/utils/undefined-fallback.js +11 -0
  389. package/es/utils/use-drag-and-pinch.d.ts +1 -0
  390. package/es/utils/use-drag-and-pinch.js +2 -0
  391. package/es/utils/use-initialized.d.ts +1 -0
  392. package/es/utils/use-initialized.js +8 -0
  393. package/es/utils/use-inner-visible.d.ts +1 -0
  394. package/es/utils/use-inner-visible.js +11 -0
  395. package/es/utils/use-isomorphic-update-layout-effect.d.ts +2 -0
  396. package/es/utils/use-isomorphic-update-layout-effect.js +2 -0
  397. package/es/utils/use-lock-scroll.d.ts +2 -0
  398. package/es/utils/use-lock-scroll.js +78 -0
  399. package/es/utils/use-mutation-effect.d.ts +2 -0
  400. package/es/utils/use-mutation-effect.js +15 -0
  401. package/es/utils/use-props-value.d.ts +8 -0
  402. package/es/utils/use-props-value.js +24 -0
  403. package/es/utils/use-ref-state.d.ts +2 -0
  404. package/es/utils/use-ref-state.js +11 -0
  405. package/es/utils/use-resize-effect.d.ts +2 -0
  406. package/es/utils/use-resize-effect.js +23 -0
  407. package/es/utils/use-tab-list-scroll.d.ts +5 -0
  408. package/es/utils/use-tab-list-scroll.js +60 -0
  409. package/es/utils/use-touch.d.ts +17 -0
  410. package/es/utils/use-touch.js +63 -0
  411. package/es/utils/validate.d.ts +8 -0
  412. package/es/utils/validate.js +26 -0
  413. package/es/utils/with-cache.d.ts +1 -0
  414. package/es/utils/with-cache.js +9 -0
  415. package/es/utils/with-default-props.d.ts +2 -0
  416. package/es/utils/with-default-props.js +25 -0
  417. package/es/utils/with-func-props.d.ts +5 -0
  418. package/es/utils/with-func-props.js +32 -0
  419. package/es/utils/with-stop-propagation.d.ts +4 -0
  420. package/es/utils/with-stop-propagation.js +30 -0
  421. package/package.json +48 -20
  422. package/__vendor/__vendor.js +0 -1
  423. package/handRead/handRead.d.ts +0 -6
  424. package/handRead/handRead.js +0 -302
  425. package/handRead/index.d.ts +0 -25
  426. package/handRead/index.js +0 -11
  427. package/imageViewer/imageViewer.d.ts +0 -3
  428. package/imageViewer/imageViewer.js +0 -28
  429. package/imageViewer/index.js +0 -8
  430. package/index.d.ts +0 -6
  431. package/index.js +0 -14
  432. package/keyboard/index.d.ts +0 -13
  433. package/keyboard/index.js +0 -7
  434. package/keyboard/keyboard.d.ts +0 -2
  435. package/keyboard/keyboard.js +0 -87
  436. package/style.css +0 -1
  437. package/utils/isEqual.d.ts +0 -5
  438. /package/{imageViewer → cjs/components/imageViewer}/index.d.ts +0 -0
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Button = void 0;
7
+ var _ui = require("@ebscn/ui");
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _nativeProps = require("../../utils/native-props");
11
+ var _validate = require("../../utils/validate");
12
+ var _withDefaultProps = require("../../utils/with-default-props");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) {
18
+ return value instanceof P ? value : new P(function (resolve) {
19
+ resolve(value);
20
+ });
21
+ }
22
+ return new (P || (P = Promise))(function (resolve, reject) {
23
+ function fulfilled(value) {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ }
30
+ function rejected(value) {
31
+ try {
32
+ step(generator["throw"](value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ }
37
+ function step(result) {
38
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
39
+ }
40
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
41
+ });
42
+ };
43
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
44
+ var _ = {
45
+ label: 0,
46
+ sent: function () {
47
+ if (t[0] & 1) throw t[1];
48
+ return t[1];
49
+ },
50
+ trys: [],
51
+ ops: []
52
+ },
53
+ f,
54
+ y,
55
+ t,
56
+ g;
57
+ return g = {
58
+ next: verb(0),
59
+ "throw": verb(1),
60
+ "return": verb(2)
61
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
62
+ return this;
63
+ }), g;
64
+ function verb(n) {
65
+ return function (v) {
66
+ return step([n, v]);
67
+ };
68
+ }
69
+ function step(op) {
70
+ if (f) throw new TypeError("Generator is already executing.");
71
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
72
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
73
+ if (y = 0, t) op = [op[0] & 2, t.value];
74
+ switch (op[0]) {
75
+ case 0:
76
+ case 1:
77
+ t = op;
78
+ break;
79
+ case 4:
80
+ _.label++;
81
+ return {
82
+ value: op[1],
83
+ done: false
84
+ };
85
+ case 5:
86
+ _.label++;
87
+ y = op[1];
88
+ op = [0];
89
+ continue;
90
+ case 7:
91
+ op = _.ops.pop();
92
+ _.trys.pop();
93
+ continue;
94
+ default:
95
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
96
+ _ = 0;
97
+ continue;
98
+ }
99
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
100
+ _.label = op[1];
101
+ break;
102
+ }
103
+ if (op[0] === 6 && _.label < t[1]) {
104
+ _.label = t[1];
105
+ t = op;
106
+ break;
107
+ }
108
+ if (t && _.label < t[2]) {
109
+ _.label = t[2];
110
+ _.ops.push(op);
111
+ break;
112
+ }
113
+ if (t[2]) _.ops.pop();
114
+ _.trys.pop();
115
+ continue;
116
+ }
117
+ op = body.call(thisArg, _);
118
+ } catch (e) {
119
+ op = [6, e];
120
+ y = 0;
121
+ } finally {
122
+ f = t = 0;
123
+ }
124
+ if (op[0] & 5) throw op[1];
125
+ return {
126
+ value: op[0] ? op[1] : void 0,
127
+ done: true
128
+ };
129
+ }
130
+ };
131
+ var classPrefix = "ebscn-button";
132
+ var defaultProps = {
133
+ color: 'primary',
134
+ fill: 'solid',
135
+ block: false,
136
+ loading: false,
137
+ disabled: false,
138
+ size: 'middle',
139
+ loadingIconPos: 'left'
140
+ };
141
+ var Button = exports.Button = (0, _react.forwardRef)(function (p, ref) {
142
+ var _a;
143
+ var _b, _c;
144
+ defaultProps.loadingIcon = _react.default.createElement(_ui.LoadingIcon, {
145
+ className: "".concat(classPrefix, "-loading-icon")
146
+ });
147
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
148
+ var _d = (0, _react.useState)(false),
149
+ innerLoading = _d[0],
150
+ setInnerLoading = _d[1];
151
+ var nativeButtonRef = (0, _react.useRef)(null);
152
+ var loading = props.loading === 'auto' ? innerLoading : props.loading;
153
+ var disabled = props.disabled;
154
+ (0, _react.useImperativeHandle)(ref, function () {
155
+ return {
156
+ get nativeElement() {
157
+ return nativeButtonRef.current;
158
+ }
159
+ };
160
+ });
161
+ var handleClick = function (e) {
162
+ return __awaiter(void 0, void 0, void 0, function () {
163
+ var promise, e_1;
164
+ return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0:
167
+ if (!props.onClick) return [2 /*return*/];
168
+ promise = props.onClick(e);
169
+ if (!(0, _validate.isPromise)(promise)) return [3 /*break*/, 4];
170
+ _a.label = 1;
171
+ case 1:
172
+ _a.trys.push([1, 3,, 4]);
173
+ setInnerLoading(true);
174
+ return [4 /*yield*/, promise];
175
+ case 2:
176
+ _a.sent();
177
+ setInnerLoading(false);
178
+ return [3 /*break*/, 4];
179
+ case 3:
180
+ e_1 = _a.sent();
181
+ setInnerLoading(false);
182
+ throw e_1;
183
+ case 4:
184
+ return [2 /*return*/];
185
+ }
186
+ });
187
+ });
188
+ };
189
+ var colorRecord = {
190
+ primary: 'var(--ebscn-color-primary,#e84225)',
191
+ sell: 'var(--ebscn-color-blue, #4c7cf1)',
192
+ financial: 'var(--ebscn-color-orange, #ff6800)'
193
+ };
194
+ var style = {
195
+ '--color': (_b = colorRecord[props.color || 'primary']) !== null && _b !== void 0 ? _b : props.color
196
+ };
197
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("button", {
198
+ style: style,
199
+ ref: nativeButtonRef,
200
+ type: props.type,
201
+ onClick: handleClick,
202
+ className: (0, _classnames.default)(classPrefix, (_a = {}, _a["".concat(classPrefix, "-").concat((_c = props.color) === null || _c === void 0 ? void 0 : _c.replace('#', ''))] = props.color, _a["".concat(classPrefix, "-block")] = props.block || props.size === 'large', _a["".concat(classPrefix, "-disabled")] = disabled, _a["".concat(classPrefix, "-fill-solid")] = props.fill === 'solid', _a["".concat(classPrefix, "-fill-outline")] = props.fill === 'outline', _a["".concat(classPrefix, "-fill-none-disabled")] = props.fill === 'none' && disabled, _a["".concat(classPrefix, "-fill-solid-disabled")] = props.fill === 'solid' && disabled, _a["".concat(classPrefix, "-fill-outline-disabled")] = props.fill === 'outline' && disabled, _a["".concat(classPrefix, "-fill-none")] = props.fill === 'none', _a["".concat(classPrefix, "-mini")] = props.size === 'mini', _a["".concat(classPrefix, "-small")] = props.size === 'small', _a["".concat(classPrefix, "-halfMiddle")] = props.size === 'halfMiddle', _a["".concat(classPrefix, "-middle")] = props.size === 'middle', _a["".concat(classPrefix, "-large")] = props.size === 'large', _a["".concat(classPrefix, "-loading")] = loading, _a["".concat(classPrefix, "-fill-none-loading")] = props.fill === 'none' && loading, _a["".concat(classPrefix, "-fill-solid-loading")] = props.fill === 'solid' && loading, _a["".concat(classPrefix, "-fill-outline-loading")] = props.fill === 'outline' && loading, _a)),
203
+ disabled: disabled,
204
+ onMouseDown: props.onMouseDown,
205
+ onMouseUp: props.onMouseUp,
206
+ onTouchStart: props.onTouchStart,
207
+ onTouchEnd: props.onTouchEnd
208
+ }, loading ? _react.default.createElement("div", {
209
+ className: "".concat(classPrefix, "-loading-wrapper")
210
+ }, props.loadingIconPos === 'left' ? props.loadingIcon : null, _react.default.createElement("span", {
211
+ className: (0, _classnames.default)("".concat(classPrefix, "-text"), "".concat(classPrefix, "-loading-icon-").concat(props.loadingIconPos))
212
+ }, props.loadingText || props.children), props.loadingIconPos === 'right' ? props.loadingIcon : null) : _react.default.createElement("span", {
213
+ className: "".concat(classPrefix, "-text")
214
+ }, props.children)));
215
+ });
@@ -0,0 +1,4 @@
1
+ import './button.less';
2
+ import { Button } from './button';
3
+ export type { ButtonProps, ButtonRef } from './button';
4
+ export default Button;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("./button.css");
8
+ var _button2 = require("./button");
9
+ var _default = exports.default = _button2.Button;
@@ -0,0 +1,37 @@
1
+ .ebscn-card {
2
+ background: var(--ebscn-color-background);
3
+ }
4
+ .ebscn-card-module {
5
+ border-radius: 16px;
6
+ padding: 16px;
7
+ margin: 0 0 12px 0;
8
+ }
9
+ .ebscn-card-line {
10
+ border-radius: 6px;
11
+ padding: 12px;
12
+ background-color: #f5f5f5;
13
+ }
14
+ .ebscn-card-line:not(:last-child) {
15
+ margin-bottom: 10px;
16
+ }
17
+ .ebscn-card-inline {
18
+ border-radius: 4px;
19
+ padding: 12px;
20
+ margin-top: 10px;
21
+ background-color: #f5f5f5;
22
+ }
23
+ .ebscn-card-inline:not(:last-child) {
24
+ margin-right: 10px;
25
+ }
26
+ .ebscn-card-header {
27
+ position: relative;
28
+ display: flex;
29
+ justify-content: space-between;
30
+ align-items: center;
31
+ box-sizing: border-box;
32
+ }
33
+ .ebscn-card-header-title {
34
+ font-size: var(--ebscn-font-size-7);
35
+ line-height: 1.4;
36
+ font-weight: bold;
37
+ }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { ReactNode, CSSProperties } from 'react';
3
+ import { NativeProps } from '../../utils/native-props';
4
+ export type ICardProps = {
5
+ title?: ReactNode;
6
+ type?: 'module' | 'line' | 'inline';
7
+ extra?: ReactNode;
8
+ headerStyle?: CSSProperties;
9
+ headerClassName?: string;
10
+ bodyStyle?: CSSProperties;
11
+ bodyClassName?: string;
12
+ onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
13
+ onBodyClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
14
+ onHeaderClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
15
+ children?: ReactNode;
16
+ } & NativeProps;
17
+ export default function Card(props: ICardProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Card;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _nativeProps = require("../../utils/native-props");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ var classPrefix = "ebscn-card";
12
+ function Card(props) {
13
+ var typeClassName = "".concat(classPrefix, "-").concat(props.type || 'module');
14
+ var renderHeader = function () {
15
+ if (!(props.title || props.extra)) {
16
+ return null;
17
+ }
18
+ return _react.default.createElement("div", {
19
+ className: (0, _classnames.default)("".concat(classPrefix, "-header"), "".concat(classPrefix, "-").concat(props.type, "-header"), props.headerClassName),
20
+ style: props.headerStyle,
21
+ onClick: props.onHeaderClick
22
+ }, _react.default.createElement("div", {
23
+ className: "".concat(classPrefix, "-header-title")
24
+ }, props.title), props.extra);
25
+ };
26
+ var renderBody = function () {
27
+ if (!props.children) {
28
+ return null;
29
+ }
30
+ return _react.default.createElement("div", {
31
+ className: (0, _classnames.default)("".concat(classPrefix, "-body"), "".concat(classPrefix, "-").concat(props.type, "-body"), props.bodyClassName),
32
+ style: props.bodyStyle,
33
+ onClick: props.onBodyClick
34
+ }, props.children);
35
+ };
36
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
37
+ className: (0, _classnames.default)(classPrefix, typeClassName),
38
+ onClick: props.onClick
39
+ }, renderHeader(), renderBody()));
40
+ }
@@ -0,0 +1,4 @@
1
+ import './card.less';
2
+ import Card from './card';
3
+ export type { ICardProps } from './card';
4
+ export default Card;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("./card.css");
8
+ var _card2 = _interopRequireDefault(require("./card"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var _default = exports.default = _card2.default;
@@ -0,0 +1,92 @@
1
+ .ebscn-checkbox {
2
+ --icon-size: 24px;
3
+ --font-size: var(--ebscn-font-size-8);
4
+ --gap: 12px;
5
+ display: inline-flex;
6
+ vertical-align: text-bottom;
7
+ justify-content: flex-start;
8
+ align-items: center;
9
+ cursor: pointer;
10
+ }
11
+ .ebscn-checkbox input {
12
+ display: none;
13
+ }
14
+ .ebscn-checkbox.ebscn-checkbox-small {
15
+ --icon-size: 16px;
16
+ --font-size: var(--ebscn-font-size-4);
17
+ --gap: 9px;
18
+ }
19
+ .ebscn-checkbox .ebscn-checkbox-icon {
20
+ flex: none;
21
+ border-radius: var(--icon-size);
22
+ border: 1px solid var(--ebscn-color-light);
23
+ box-sizing: border-box;
24
+ width: var(--icon-size);
25
+ height: var(--icon-size);
26
+ color: var(--ebscn-color-text-light-solid);
27
+ }
28
+ .ebscn-checkbox .ebscn-checkbox-icon > svg {
29
+ display: block;
30
+ width: 100%;
31
+ height: 100%;
32
+ }
33
+ .ebscn-checkbox div.ebscn-checkbox-icon.ebscn-checkbox-only-icon {
34
+ color: var(--ebscn-color-primary);
35
+ background-color: var(--ebscn-color-background);
36
+ }
37
+ .ebscn-checkbox.ebscn-checkbox-block {
38
+ display: flex;
39
+ }
40
+ .ebscn-checkbox.ebscn-checkbox-checked .ebscn-checkbox-icon {
41
+ border-color: var(--ebscn-color-primary);
42
+ background-color: var(--ebscn-color-primary);
43
+ }
44
+ .ebscn-checkbox.ebscn-checkbox-disabled {
45
+ cursor: not-allowed;
46
+ }
47
+ .ebscn-checkbox.ebscn-checkbox-disabled .ebscn-checkbox-content {
48
+ opacity: 0.4;
49
+ }
50
+ .ebscn-checkbox.ebscn-checkbox-disabled .ebscn-checkbox-icon {
51
+ background-color: #e4e4e4;
52
+ border-color: #d9d9d9;
53
+ opacity: 0.4;
54
+ }
55
+ .ebscn-checkbox.ebscn-checkbox-disabled.ebscn-checkbox-checked .ebscn-checkbox-icon {
56
+ background-color: var(--ebscn-color-primary);
57
+ }
58
+ .ebscn-checkbox .ebscn-checkbox-custom-icon {
59
+ font-size: var(--icon-size);
60
+ }
61
+ .ebscn-checkbox.ebscn-checkbox-indeterminate .ebscn-checkbox-icon {
62
+ background-color: var(--ebscn-color-background);
63
+ color: var(--ebscn-color-primary);
64
+ }
65
+ .ebscn-checkbox-content {
66
+ flex: 0 1 auto;
67
+ font-size: var(--font-size);
68
+ padding-left: var(--gap);
69
+ }
70
+ .ebscn-checkbox .ebscn-checkbox-icon-right-input {
71
+ display: flex;
72
+ justify-content: space-between;
73
+ flex-direction: row;
74
+ width: 100%;
75
+ height: 100%;
76
+ }
77
+ .ebscn-checkbox .ebscn-checkbox-icon-right-input .ebscn-checkbox-content {
78
+ padding-left: 0;
79
+ height: 100%;
80
+ }
81
+ .ebscn-checkbox .ebscn-checkbox-icon-right-input .ebscn-checkbox-icon.ebscn-checkbox-only-icon {
82
+ margin-right: 16px;
83
+ height: 100%;
84
+ border-color: transparent;
85
+ }
86
+ .ebscn-checkbox .ebscn-checkbox-icon-right-input .ebscn-checkbox-icon.ebscn-checkbox-only-icon svg {
87
+ vertical-align: middle;
88
+ }
89
+ .ebscn-checkbox-icon-right {
90
+ width: 100%;
91
+ height: 100%;
92
+ }
@@ -0,0 +1,44 @@
1
+ import type { ReactNode } from 'react';
2
+ import React from 'react';
3
+ import { NativeProps } from '../../utils/native-props';
4
+ export type CheckboxValue = string | number;
5
+ export type CheckboxProps = {
6
+ checked?: boolean;
7
+ defaultChecked?: boolean;
8
+ disabled?: boolean;
9
+ onChange?: (checked: boolean) => void;
10
+ value?: CheckboxValue;
11
+ indeterminate?: boolean;
12
+ block?: boolean;
13
+ id?: string;
14
+ icon?: (checked: boolean, indeterminate: boolean) => ReactNode;
15
+ children?: ReactNode;
16
+ onClick?: (event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void;
17
+ size?: 'normal' | 'small';
18
+ iconRight?: boolean;
19
+ } & NativeProps<'--icon-size' | '--font-size' | '--gap'>;
20
+ export type CheckboxRef = {
21
+ check: () => void;
22
+ uncheck: () => void;
23
+ toggle: () => void;
24
+ };
25
+ declare const Checkbox: React.ForwardRefExoticComponent<{
26
+ checked?: boolean | undefined;
27
+ defaultChecked?: boolean | undefined;
28
+ disabled?: boolean | undefined;
29
+ onChange?: ((checked: boolean) => void) | undefined;
30
+ value?: CheckboxValue | undefined;
31
+ indeterminate?: boolean | undefined;
32
+ block?: boolean | undefined;
33
+ id?: string | undefined;
34
+ icon?: ((checked: boolean, indeterminate: boolean) => ReactNode) | undefined;
35
+ children?: ReactNode;
36
+ onClick?: ((event: React.MouseEvent<HTMLLabelElement, MouseEvent>) => void) | undefined;
37
+ size?: "small" | "normal" | undefined;
38
+ iconRight?: boolean | undefined;
39
+ } & {
40
+ className?: string | undefined;
41
+ style?: (React.CSSProperties & Partial<Record<"--icon-size" | "--font-size" | "--gap", string>>) | undefined;
42
+ tabIndex?: number | undefined;
43
+ } & React.AriaAttributes & React.RefAttributes<CheckboxRef>>;
44
+ export default Checkbox;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ui = require("@ebscn/ui");
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _devLog = require("../../utils/dev-log");
11
+ var _isDev = require("../../utils/is-dev");
12
+ var _nativeProps = require("../../utils/native-props");
13
+ var _usePropsValue = require("../../utils/use-props-value");
14
+ var _withDefaultProps = require("../../utils/with-default-props");
15
+ var _groupContext = require("./group-context");
16
+ var _nativeInput = require("./native-input");
17
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ var classPrefix = "ebscn-checkbox";
21
+ var defaultProps = {
22
+ defaultChecked: false,
23
+ indeterminate: false,
24
+ size: 'normal',
25
+ iconRight: false
26
+ };
27
+ var Checkbox = (0, _react.forwardRef)(function (p, ref) {
28
+ var _a;
29
+ var groupContext = (0, _react.useContext)(_groupContext.CheckboxGroupContext);
30
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
31
+ var _b = (0, _usePropsValue.usePropsValue)({
32
+ value: props.checked,
33
+ defaultValue: props.defaultChecked,
34
+ onChange: props.onChange
35
+ }),
36
+ checked = _b[0],
37
+ setChecked = _b[1];
38
+ var disabled = props.disabled;
39
+ var value = props.value;
40
+ if (groupContext && value !== undefined) {
41
+ if (_isDev.isDev) {
42
+ if (p.checked !== undefined) {
43
+ (0, _devLog.devWarning)('Checkbox', 'When used within `Checkbox.Group`, the `checked` prop of `Checkbox` will not work.');
44
+ }
45
+ if (p.defaultChecked !== undefined) {
46
+ (0, _devLog.devWarning)('Checkbox', 'When used within `Checkbox.Group`, the `defaultChecked` prop of `Checkbox` will not work.');
47
+ }
48
+ }
49
+ checked = groupContext.value.includes(value);
50
+ setChecked = function (checked) {
51
+ var _a;
52
+ if (checked) {
53
+ groupContext.check(value);
54
+ } else {
55
+ groupContext.uncheck(value);
56
+ }
57
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, checked);
58
+ };
59
+ disabled = disabled || groupContext.disabled;
60
+ }
61
+ (0, _react.useImperativeHandle)(ref, function () {
62
+ return {
63
+ check: function () {
64
+ setChecked(true);
65
+ },
66
+ uncheck: function () {
67
+ setChecked(false);
68
+ },
69
+ toggle: function () {
70
+ setChecked(!checked);
71
+ }
72
+ };
73
+ });
74
+ var renderIcon = function () {
75
+ if (props.icon) {
76
+ return _react.default.createElement("div", {
77
+ className: "".concat(classPrefix, "-custom-icon")
78
+ }, props.icon(checked, props.indeterminate));
79
+ }
80
+ if (props.iconRight) {
81
+ return checked && _react.default.createElement("div", {
82
+ className: "".concat(classPrefix, "-icon ").concat(classPrefix, "-only-icon")
83
+ }, _react.default.createElement(_ui.CheckOnlyIcon, null));
84
+ }
85
+ return _react.default.createElement("div", {
86
+ className: "".concat(classPrefix, "-icon")
87
+ }, props.indeterminate ? _react.default.createElement(_ui.IndeterminateIcon, null) : checked ? _react.default.createElement(_ui.CheckIcon, null) : _react.default.createElement(_ui.UncheckIcon, null));
88
+ };
89
+ return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("label", {
90
+ onClick: props.onClick,
91
+ className: (0, _classnames.default)(classPrefix, (_a = {}, _a["".concat(classPrefix, "-checked")] = checked && !props.indeterminate, _a["".concat(classPrefix, "-indeterminate")] = props.indeterminate, _a["".concat(classPrefix, "-disabled")] = disabled, _a["".concat(classPrefix, "-block")] = props.block, _a["".concat(classPrefix, "-small")] = props.size === 'small', _a["".concat(classPrefix, "-icon-right")] = props.iconRight, _a))
92
+ }, _react.default.createElement(_nativeInput.NativeInput, {
93
+ type: "checkbox",
94
+ checked: checked,
95
+ onChange: setChecked,
96
+ disabled: disabled,
97
+ id: props.id
98
+ }), props.iconRight ? _react.default.createElement("div", {
99
+ className: "".concat(classPrefix, "-icon-right-input")
100
+ }, props.children && _react.default.createElement("div", {
101
+ className: "".concat(classPrefix, "-content")
102
+ }, props.children), renderIcon()) : _react.default.createElement(_react.default.Fragment, null, renderIcon(), props.children && _react.default.createElement("div", {
103
+ className: "".concat(classPrefix, "-content")
104
+ }, props.children))));
105
+ });
106
+ var _default = exports.default = Checkbox;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { CheckboxValue } from '.';
3
+ export declare const CheckboxGroupContext: import("react").Context<{
4
+ value: CheckboxValue[];
5
+ disabled: boolean;
6
+ check: (val: CheckboxValue) => void;
7
+ uncheck: (val: CheckboxValue) => void;
8
+ } | null>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CheckboxGroupContext = void 0;
7
+ var _react = require("react");
8
+ var CheckboxGroupContext = exports.CheckboxGroupContext = (0, _react.createContext)(null);
@@ -0,0 +1,10 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ import { CheckboxValue } from '.';
3
+ export interface CheckboxGroupProps {
4
+ value?: CheckboxValue[];
5
+ onChange?: (val: CheckboxValue[]) => void;
6
+ defaultValue?: CheckboxValue[];
7
+ disabled?: boolean;
8
+ children?: ReactNode;
9
+ }
10
+ export declare const Group: FC<CheckboxGroupProps>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Group = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _withDefaultProps = require("../../utils/with-default-props");
9
+ var _groupContext = require("./group-context");
10
+ var _usePropsValue = require("../../utils/use-props-value");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ var __spreadArray = void 0 && (void 0).__spreadArray || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ var defaultProps = {
22
+ disabled: false,
23
+ defaultValue: []
24
+ };
25
+ var Group = function (p) {
26
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
27
+ var _a = (0, _usePropsValue.usePropsValue)(props),
28
+ value = _a[0],
29
+ setValue = _a[1];
30
+ return _react.default.createElement(_groupContext.CheckboxGroupContext.Provider
31
+ // TODO: 性能优化
32
+ , {
33
+ // TODO: 性能优化
34
+ value: {
35
+ value: value,
36
+ disabled: props.disabled,
37
+ check: function (v) {
38
+ setValue(__spreadArray(__spreadArray([], value, true), [v], false));
39
+ },
40
+ uncheck: function (v) {
41
+ setValue(value.filter(function (item) {
42
+ return item !== v;
43
+ }));
44
+ }
45
+ }
46
+ }, props.children);
47
+ };
48
+ exports.Group = Group;