@daisu-ui/ui 0.0.0-stage → 0.1.0-beta.3

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 (401) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +93 -2
  4. package/THIRD_PARTY_NOTICES.md +19 -0
  5. package/dist/ActionSheet.d.ts +45 -0
  6. package/dist/ActionSheet.jsx +37 -0
  7. package/dist/AnchoredBubble.d.ts +36 -0
  8. package/dist/AnchoredBubble.jsx +120 -0
  9. package/dist/Avatar.d.ts +35 -0
  10. package/dist/Avatar.jsx +29 -0
  11. package/dist/Backtop.d.ts +22 -0
  12. package/dist/Backtop.jsx +18 -0
  13. package/dist/Badge.d.ts +19 -0
  14. package/dist/Badge.jsx +11 -0
  15. package/dist/BarCode.d.ts +20 -0
  16. package/dist/BarCode.jsx +38 -0
  17. package/dist/Button.d.ts +21 -0
  18. package/dist/Button.jsx +19 -0
  19. package/dist/Calendar.d.ts +90 -0
  20. package/dist/Calendar.jsx +164 -0
  21. package/dist/CalendarView.d.ts +51 -0
  22. package/dist/CalendarView.jsx +136 -0
  23. package/dist/Card.d.ts +21 -0
  24. package/dist/Card.jsx +21 -0
  25. package/dist/Cascader.d.ts +75 -0
  26. package/dist/Cascader.jsx +212 -0
  27. package/dist/Cell.d.ts +34 -0
  28. package/dist/Cell.jsx +37 -0
  29. package/dist/Checkbox.d.ts +50 -0
  30. package/dist/Checkbox.jsx +74 -0
  31. package/dist/Circle.d.ts +19 -0
  32. package/dist/Circle.jsx +35 -0
  33. package/dist/Collapse.d.ts +31 -0
  34. package/dist/Collapse.jsx +61 -0
  35. package/dist/ConfigProvider.d.ts +15 -0
  36. package/dist/ConfigProvider.jsx +20 -0
  37. package/dist/CountDown.d.ts +20 -0
  38. package/dist/CountDown.jsx +15 -0
  39. package/dist/CountTo.d.ts +28 -0
  40. package/dist/CountTo.jsx +27 -0
  41. package/dist/Curtain.d.ts +29 -0
  42. package/dist/Curtain.jsx +51 -0
  43. package/dist/DatetimePicker.d.ts +46 -0
  44. package/dist/DatetimePicker.jsx +138 -0
  45. package/dist/DatetimePickerView.d.ts +38 -0
  46. package/dist/DatetimePickerView.jsx +36 -0
  47. package/dist/Dialog.d.ts +64 -0
  48. package/dist/Dialog.jsx +105 -0
  49. package/dist/Divider.d.ts +16 -0
  50. package/dist/Divider.jsx +9 -0
  51. package/dist/DropMenu.d.ts +55 -0
  52. package/dist/DropMenu.jsx +210 -0
  53. package/dist/Empty.d.ts +14 -0
  54. package/dist/Empty.jsx +14 -0
  55. package/dist/EmptyState.d.ts +6 -0
  56. package/dist/EmptyState.jsx +9 -0
  57. package/dist/Fab.d.ts +30 -0
  58. package/dist/Fab.jsx +127 -0
  59. package/dist/FloatingPanel.d.ts +21 -0
  60. package/dist/FloatingPanel.jsx +102 -0
  61. package/dist/Form.d.ts +63 -0
  62. package/dist/Form.jsx +108 -0
  63. package/dist/FormFieldRow.d.ts +56 -0
  64. package/dist/FormFieldRow.jsx +63 -0
  65. package/dist/Gap.d.ts +10 -0
  66. package/dist/Gap.jsx +14 -0
  67. package/dist/Grid.d.ts +47 -0
  68. package/dist/Grid.jsx +31 -0
  69. package/dist/Icon.d.ts +11 -0
  70. package/dist/Icon.jsx +12 -0
  71. package/dist/ImagePreview.d.ts +62 -0
  72. package/dist/ImagePreview.jsx +78 -0
  73. package/dist/Img.d.ts +28 -0
  74. package/dist/Img.jsx +59 -0
  75. package/dist/ImgCropper.d.ts +74 -0
  76. package/dist/ImgCropper.jsx +114 -0
  77. package/dist/IndexBar.d.ts +36 -0
  78. package/dist/IndexBar.jsx +149 -0
  79. package/dist/Input.d.ts +11 -0
  80. package/dist/Input.jsx +3 -0
  81. package/dist/InputNumber.d.ts +32 -0
  82. package/dist/InputNumber.jsx +165 -0
  83. package/dist/Keyboard.d.ts +37 -0
  84. package/dist/Keyboard.jsx +130 -0
  85. package/dist/Layout.d.ts +31 -0
  86. package/dist/Layout.jsx +14 -0
  87. package/dist/Loading.d.ts +18 -0
  88. package/dist/Loading.jsx +15 -0
  89. package/dist/Loadmore.d.ts +18 -0
  90. package/dist/Loadmore.jsx +16 -0
  91. package/dist/Navbar.d.ts +35 -0
  92. package/dist/Navbar.jsx +50 -0
  93. package/dist/NoticeBar.d.ts +30 -0
  94. package/dist/NoticeBar.jsx +86 -0
  95. package/dist/Notify.d.ts +34 -0
  96. package/dist/Notify.jsx +52 -0
  97. package/dist/NumberStepper.d.ts +11 -0
  98. package/dist/NumberStepper.jsx +41 -0
  99. package/dist/Overlay.d.ts +16 -0
  100. package/dist/Overlay.jsx +12 -0
  101. package/dist/PagedList.d.ts +13 -0
  102. package/dist/PagedList.jsx +36 -0
  103. package/dist/Pagination.d.ts +29 -0
  104. package/dist/Pagination.jsx +33 -0
  105. package/dist/PasswordInput.d.ts +16 -0
  106. package/dist/PasswordInput.jsx +20 -0
  107. package/dist/Picker.d.ts +61 -0
  108. package/dist/Picker.jsx +80 -0
  109. package/dist/PickerView.d.ts +43 -0
  110. package/dist/PickerView.jsx +142 -0
  111. package/dist/Popover.d.ts +23 -0
  112. package/dist/Popover.jsx +35 -0
  113. package/dist/Popup.d.ts +30 -0
  114. package/dist/Popup.jsx +32 -0
  115. package/dist/Progress.d.ts +17 -0
  116. package/dist/Progress.jsx +45 -0
  117. package/dist/QrCode.d.ts +46 -0
  118. package/dist/QrCode.jsx +67 -0
  119. package/dist/Radio.d.ts +21 -0
  120. package/dist/Radio.jsx +34 -0
  121. package/dist/Rate.d.ts +25 -0
  122. package/dist/Rate.jsx +39 -0
  123. package/dist/Resize.d.ts +17 -0
  124. package/dist/Resize.jsx +17 -0
  125. package/dist/RichText.d.ts +133 -0
  126. package/dist/RichText.jsx +288 -0
  127. package/dist/RootPortal.d.ts +11 -0
  128. package/dist/RootPortal.jsx +19 -0
  129. package/dist/Search.d.ts +39 -0
  130. package/dist/Search.jsx +94 -0
  131. package/dist/Segmented.d.ts +18 -0
  132. package/dist/Segmented.jsx +35 -0
  133. package/dist/SelectPicker.d.ts +54 -0
  134. package/dist/SelectPicker.jsx +136 -0
  135. package/dist/Sidebar.d.ts +34 -0
  136. package/dist/Sidebar.jsx +43 -0
  137. package/dist/Signature.d.ts +46 -0
  138. package/dist/Signature.jsx +203 -0
  139. package/dist/Skeleton.d.ts +27 -0
  140. package/dist/Skeleton.jsx +29 -0
  141. package/dist/SlideVerify.d.ts +27 -0
  142. package/dist/SlideVerify.jsx +138 -0
  143. package/dist/Slider.d.ts +21 -0
  144. package/dist/Slider.jsx +131 -0
  145. package/dist/SortButton.d.ts +16 -0
  146. package/dist/SortButton.jsx +19 -0
  147. package/dist/Steps.d.ts +23 -0
  148. package/dist/Steps.jsx +25 -0
  149. package/dist/Sticky.d.ts +17 -0
  150. package/dist/Sticky.jsx +69 -0
  151. package/dist/SwipeAction.d.ts +27 -0
  152. package/dist/SwipeAction.jsx +187 -0
  153. package/dist/Swiper.d.ts +54 -0
  154. package/dist/Swiper.jsx +94 -0
  155. package/dist/SwiperNav.d.ts +18 -0
  156. package/dist/SwiperNav.jsx +10 -0
  157. package/dist/Switch.d.ts +31 -0
  158. package/dist/Switch.jsx +46 -0
  159. package/dist/SyncedInput.d.ts +12 -0
  160. package/dist/SyncedInput.jsx +18 -0
  161. package/dist/SyncedTextarea.d.ts +11 -0
  162. package/dist/SyncedTextarea.jsx +18 -0
  163. package/dist/Tabbar.d.ts +37 -0
  164. package/dist/Tabbar.jsx +46 -0
  165. package/dist/Table.d.ts +51 -0
  166. package/dist/Table.jsx +125 -0
  167. package/dist/Tabs.d.ts +65 -0
  168. package/dist/Tabs.jsx +132 -0
  169. package/dist/Tag.d.ts +33 -0
  170. package/dist/Tag.jsx +63 -0
  171. package/dist/Text.d.ts +19 -0
  172. package/dist/Text.jsx +7 -0
  173. package/dist/TextField.d.ts +89 -0
  174. package/dist/TextField.jsx +149 -0
  175. package/dist/Textarea.d.ts +22 -0
  176. package/dist/Textarea.jsx +3 -0
  177. package/dist/Toast.d.ts +36 -0
  178. package/dist/Toast.jsx +30 -0
  179. package/dist/Tooltip.d.ts +8 -0
  180. package/dist/Tooltip.jsx +5 -0
  181. package/dist/Tour.d.ts +85 -0
  182. package/dist/Tour.jsx +150 -0
  183. package/dist/Transition.d.ts +32 -0
  184. package/dist/Transition.jsx +43 -0
  185. package/dist/Upload.d.ts +64 -0
  186. package/dist/Upload.jsx +163 -0
  187. package/dist/VideoPreview.d.ts +47 -0
  188. package/dist/VideoPreview.jsx +59 -0
  189. package/dist/Watermark.d.ts +36 -0
  190. package/dist/Watermark.jsx +18 -0
  191. package/dist/action-sheet.css +19 -0
  192. package/dist/avatar.css +23 -0
  193. package/dist/avatarModel.d.ts +8 -0
  194. package/dist/avatarModel.js +17 -0
  195. package/dist/backtop.css +6 -0
  196. package/dist/badge.css +15 -0
  197. package/dist/badgeModel.d.ts +2 -0
  198. package/dist/badgeModel.js +18 -0
  199. package/dist/bar-code.css +5 -0
  200. package/dist/barCodeModel.d.ts +80 -0
  201. package/dist/barCodeModel.js +99 -0
  202. package/dist/bubble.css +14 -0
  203. package/dist/bubblePosition.d.ts +19 -0
  204. package/dist/bubblePosition.js +41 -0
  205. package/dist/button.css +56 -0
  206. package/dist/calendar.css +56 -0
  207. package/dist/calendarModel.d.ts +62 -0
  208. package/dist/calendarModel.js +141 -0
  209. package/dist/card.css +8 -0
  210. package/dist/cascader.css +16 -0
  211. package/dist/cascaderModel.d.ts +21 -0
  212. package/dist/cascaderModel.js +32 -0
  213. package/dist/cell.css +41 -0
  214. package/dist/choice.css +27 -0
  215. package/dist/choice.d.ts +28 -0
  216. package/dist/choice.jsx +16 -0
  217. package/dist/circle.css +4 -0
  218. package/dist/circleModel.d.ts +15 -0
  219. package/dist/circleModel.js +31 -0
  220. package/dist/config-provider.css +2 -0
  221. package/dist/configContext.d.ts +23 -0
  222. package/dist/configContext.js +24 -0
  223. package/dist/configTheme.d.ts +3 -0
  224. package/dist/configTheme.js +22 -0
  225. package/dist/count-down.css +2 -0
  226. package/dist/count-to.css +8 -0
  227. package/dist/countDownModel.d.ts +11 -0
  228. package/dist/countDownModel.js +7 -0
  229. package/dist/countToModel.d.ts +3 -0
  230. package/dist/countToModel.js +3 -0
  231. package/dist/curtain.css +10 -0
  232. package/dist/datetime-picker.css +11 -0
  233. package/dist/datetimePickerModel.d.ts +47 -0
  234. package/dist/datetimePickerModel.js +128 -0
  235. package/dist/dialog.css +23 -0
  236. package/dist/divider.css +14 -0
  237. package/dist/drop-menu.css +28 -0
  238. package/dist/empty.css +7 -0
  239. package/dist/fab.css +23 -0
  240. package/dist/fabModel.d.ts +26 -0
  241. package/dist/fabModel.js +16 -0
  242. package/dist/floating-panel.css +6 -0
  243. package/dist/floatingPanelModel.d.ts +3 -0
  244. package/dist/floatingPanelModel.js +10 -0
  245. package/dist/form.css +10 -0
  246. package/dist/formContext.d.ts +7 -0
  247. package/dist/formContext.js +2 -0
  248. package/dist/formModel.d.ts +38 -0
  249. package/dist/formModel.js +16 -0
  250. package/dist/gap.css +1 -0
  251. package/dist/grid.css +17 -0
  252. package/dist/icon.css +8 -0
  253. package/dist/icons/LICENSE.tabler +21 -0
  254. package/dist/icons/paths.d.ts +309 -0
  255. package/dist/icons/paths.js +310 -0
  256. package/dist/icons/render.d.ts +2 -0
  257. package/dist/icons/render.js +5 -0
  258. package/dist/image-preview.css +8 -0
  259. package/dist/img-cropper.css +1 -0
  260. package/dist/img.css +5 -0
  261. package/dist/imgCropperModel.d.ts +55 -0
  262. package/dist/imgCropperModel.js +41 -0
  263. package/dist/imgModel.d.ts +13 -0
  264. package/dist/imgModel.js +22 -0
  265. package/dist/index-bar.css +12 -0
  266. package/dist/index.d.ts +200 -0
  267. package/dist/index.js +99 -0
  268. package/dist/indexBarModel.d.ts +19 -0
  269. package/dist/indexBarModel.js +37 -0
  270. package/dist/input-number.css +24 -0
  271. package/dist/inputNumberModel.d.ts +23 -0
  272. package/dist/inputNumberModel.js +40 -0
  273. package/dist/keyboard.css +26 -0
  274. package/dist/keyboardModel.d.ts +11 -0
  275. package/dist/keyboardModel.js +34 -0
  276. package/dist/layout.css +2 -0
  277. package/dist/legacy/RadioGroup.d.ts +13 -0
  278. package/dist/legacy/RadioGroup.jsx +13 -0
  279. package/dist/legacy-controls.css +87 -0
  280. package/dist/loading.css +31 -0
  281. package/dist/loadingModel.d.ts +2 -0
  282. package/dist/loadingModel.js +21 -0
  283. package/dist/loadmore.css +5 -0
  284. package/dist/navbar.css +16 -0
  285. package/dist/notice-bar.css +19 -0
  286. package/dist/notify.css +14 -0
  287. package/dist/overlay.css +2 -0
  288. package/dist/pagination.css +12 -0
  289. package/dist/paginationModel.d.ts +6 -0
  290. package/dist/paginationModel.js +7 -0
  291. package/dist/password-input.css +14 -0
  292. package/dist/passwordInputModel.d.ts +6 -0
  293. package/dist/passwordInputModel.js +11 -0
  294. package/dist/picker.css +42 -0
  295. package/dist/pickerModel.d.ts +32 -0
  296. package/dist/pickerModel.js +49 -0
  297. package/dist/popover.css +5 -0
  298. package/dist/popup.css +17 -0
  299. package/dist/progress.css +16 -0
  300. package/dist/progressModel.d.ts +12 -0
  301. package/dist/progressModel.js +19 -0
  302. package/dist/qr-code.css +4 -0
  303. package/dist/qrCodeModel.d.ts +36 -0
  304. package/dist/qrCodeModel.js +61 -0
  305. package/dist/rate.css +20 -0
  306. package/dist/rateModel.d.ts +4 -0
  307. package/dist/rateModel.js +38 -0
  308. package/dist/resize.css +2 -0
  309. package/dist/rich-text.css +19 -0
  310. package/dist/richTextMedia.d.ts +28 -0
  311. package/dist/richTextMedia.js +3 -0
  312. package/dist/richTextModel.d.ts +52 -0
  313. package/dist/richTextModel.js +195 -0
  314. package/dist/root-portal.css +1 -0
  315. package/dist/router/RouterView.d.ts +21 -0
  316. package/dist/router/RouterView.jsx +120 -0
  317. package/dist/router/core.d.ts +85 -0
  318. package/dist/router/core.js +255 -0
  319. package/dist/router/hooks.d.ts +17 -0
  320. package/dist/router/hooks.jsx +71 -0
  321. package/dist/router/index.d.ts +5 -0
  322. package/dist/router/index.js +3 -0
  323. package/dist/router/location.d.ts +8 -0
  324. package/dist/router/location.js +46 -0
  325. package/dist/router/router.css +7 -0
  326. package/dist/router/runtime.d.ts +1 -0
  327. package/dist/router/runtime.js +25 -0
  328. package/dist/search.css +23 -0
  329. package/dist/segmented.css +19 -0
  330. package/dist/segmentedModel.d.ts +10 -0
  331. package/dist/segmentedModel.js +8 -0
  332. package/dist/sidebar.css +18 -0
  333. package/dist/sidebarModel.d.ts +8 -0
  334. package/dist/sidebarModel.js +27 -0
  335. package/dist/signature.css +5 -0
  336. package/dist/signatureModel.d.ts +23 -0
  337. package/dist/signatureModel.js +80 -0
  338. package/dist/skeleton.css +16 -0
  339. package/dist/slide-verify.css +7 -0
  340. package/dist/slider.css +49 -0
  341. package/dist/sliderModel.d.ts +10 -0
  342. package/dist/sliderModel.js +27 -0
  343. package/dist/sort-button.css +12 -0
  344. package/dist/steps.css +35 -0
  345. package/dist/sticky.css +7 -0
  346. package/dist/styles.css +136 -0
  347. package/dist/styles.d.ts +1 -0
  348. package/dist/swipe-action.css +6 -0
  349. package/dist/swiper.css +27 -0
  350. package/dist/swiperAnimation.d.ts +3 -0
  351. package/dist/swiperAnimation.js +6 -0
  352. package/dist/swiperModel.d.ts +2 -0
  353. package/dist/swiperModel.js +3 -0
  354. package/dist/switch.css +12 -0
  355. package/dist/tabbar.css +17 -0
  356. package/dist/tabbarModel.d.ts +8 -0
  357. package/dist/tabbarModel.js +27 -0
  358. package/dist/table.css +21 -0
  359. package/dist/tableModel.d.ts +10 -0
  360. package/dist/tableModel.js +17 -0
  361. package/dist/tabs.css +31 -0
  362. package/dist/tabsModel.d.ts +7 -0
  363. package/dist/tabsModel.js +14 -0
  364. package/dist/tag.css +66 -0
  365. package/dist/text-field.css +15 -0
  366. package/dist/text.css +7 -0
  367. package/dist/textModel.d.ts +3 -0
  368. package/dist/textModel.js +24 -0
  369. package/dist/toast.css +13 -0
  370. package/dist/tokens.d.ts +34 -0
  371. package/dist/tokens.js +10 -0
  372. package/dist/tour.css +8 -0
  373. package/dist/transition.css +12 -0
  374. package/dist/upload.css +11 -0
  375. package/dist/useCountDown.d.ts +14 -0
  376. package/dist/useCountDown.js +73 -0
  377. package/dist/useDialog.d.ts +9 -0
  378. package/dist/useDialog.js +33 -0
  379. package/dist/useImagePreview.d.ts +7 -0
  380. package/dist/useImagePreview.js +17 -0
  381. package/dist/useNotify.d.ts +9 -0
  382. package/dist/useNotify.js +26 -0
  383. package/dist/usePressState.d.ts +6 -0
  384. package/dist/usePressState.js +17 -0
  385. package/dist/useToast.d.ts +11 -0
  386. package/dist/useToast.js +23 -0
  387. package/dist/useVideoPreview.d.ts +7 -0
  388. package/dist/useVideoPreview.js +17 -0
  389. package/dist/utils.d.ts +4 -0
  390. package/dist/utils.js +4 -0
  391. package/dist/video-preview.css +7 -0
  392. package/dist/watermark.css +6 -0
  393. package/dist/web/imgCropperElement.d.ts +2 -0
  394. package/dist/web/imgCropperElement.js +309 -0
  395. package/dist/web/index.d.ts +6 -0
  396. package/dist/web/index.js +6 -0
  397. package/dist/web/qrCodeExportElement.d.ts +4 -0
  398. package/dist/web/qrCodeExportElement.js +70 -0
  399. package/dist/web/richTextMediaElement.d.ts +2 -0
  400. package/dist/web/richTextMediaElement.js +276 -0
  401. package/package.json +98 -4
@@ -0,0 +1,14 @@
1
+ .ui-bubble { position: relative; align-self: flex-start; display: flex; flex-direction: column; }
2
+ .ui-bubble-target { display: flex; flex-direction: column; align-self: flex-start; }
3
+ .ui-bubble-viewport { position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
4
+ .ui-bubble-anchor { max-width: 100vw; display: flex; flex-direction: column; pointer-events: none; }
5
+ .ui-bubble-panel { flex-shrink: 0; border-radius: 4px; background-color: var(--cso-ui-surface); box-shadow: 0 12px 48px 16px rgba(39,43,59,.03), 0 9px 28px 8px rgba(39,43,59,.05), 0 5px 12px 4px rgba(39,43,59,.06); pointer-events: auto; }
6
+ .ui-bubble-body { position: relative; display: flex; flex-direction: column; }
7
+ .ui-bubble-text { padding: 12px; color: var(--cso-ui-text-muted); font-size: 14px; line-height: 20px; }
8
+ .ui-bubble-closable { padding-right: 16px; }
9
+ .ui-bubble-close { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; }
10
+ .ui-bubble-arrow { position: absolute; width: 0; height: 0; }
11
+ .ui-bubble-arrow-bottom { top: -8px; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 8px solid var(--cso-ui-surface); }
12
+ .ui-bubble-arrow-top { bottom: -8px; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--cso-ui-surface); }
13
+ .ui-bubble-arrow-right { left: -8px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 8px solid var(--cso-ui-surface); }
14
+ .ui-bubble-arrow-left { right: -8px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 8px solid var(--cso-ui-surface); }
@@ -0,0 +1,19 @@
1
+ export type BubblePlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
2
+ export type BubbleOffset = number | readonly number[] | {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export type BubbleRect = {
7
+ left: number;
8
+ top: number;
9
+ width: number;
10
+ height: number;
11
+ };
12
+ export type BubblePosition = {
13
+ x: number;
14
+ y: number;
15
+ arrow: number;
16
+ side: 'top' | 'bottom' | 'left' | 'right';
17
+ };
18
+ /** Viewport geometry comes from native NodesRef measurements, never the DOM. */
19
+ export declare function bubblePosition(target: BubbleRect, content: BubbleRect, viewport: BubbleRect, placement: BubblePlacement, offset?: BubbleOffset, arrow?: boolean): BubblePosition;
@@ -0,0 +1,41 @@
1
+ const clamp = (n, min, max) => Math.max(min, Math.min(Math.max(min, max), n));
2
+ const finite = (n) => typeof n === 'number' && Number.isFinite(n) ? n : 0;
3
+ /** Viewport geometry comes from native NodesRef measurements, never the DOM. */
4
+ export function bubblePosition(target, content, viewport, placement, offset = 0, arrow = true) {
5
+ let side = placement.split('-')[0];
6
+ const alignment = placement.split('-')[1];
7
+ const gap = (arrow ? 14 : 6) + (typeof offset === 'number' ? finite(offset) : 0);
8
+ const horizontal = side === 'left' || side === 'right';
9
+ const before = horizontal ? target.left - viewport.left : target.top - viewport.top;
10
+ const after = horizontal ? viewport.left + viewport.width - target.left - target.width : viewport.top + viewport.height - target.top - target.height;
11
+ const needed = (horizontal ? content.width : content.height) + gap;
12
+ // Prefer the requested direction, flipping only when the opposite side fits.
13
+ if ((side === 'top' || side === 'left') && before < needed && after >= needed)
14
+ side = side === 'top' ? 'bottom' : 'right';
15
+ else if ((side === 'bottom' || side === 'right') && after < needed && before >= needed)
16
+ side = side === 'bottom' ? 'top' : 'left';
17
+ let x = target.left + (target.width - content.width) / 2;
18
+ let y = target.top + (target.height - content.height) / 2;
19
+ if (horizontal) {
20
+ x = side === 'left' ? target.left - content.width - gap : target.left + target.width + gap;
21
+ if (alignment === 'start')
22
+ y = target.top;
23
+ if (alignment === 'end')
24
+ y = target.top + target.height - content.height;
25
+ }
26
+ else {
27
+ y = side === 'top' ? target.top - content.height - gap : target.top + target.height + gap;
28
+ if (alignment === 'start')
29
+ x = target.left;
30
+ if (alignment === 'end')
31
+ x = target.left + target.width - content.width;
32
+ }
33
+ if (typeof offset !== 'number') {
34
+ const point = offset;
35
+ x += finite(Array.isArray(offset) ? offset[0] : point.x);
36
+ y += finite(Array.isArray(offset) ? offset[1] : point.y);
37
+ }
38
+ x = clamp(x, viewport.left, viewport.left + viewport.width - content.width);
39
+ y = clamp(y, viewport.top, viewport.top + viewport.height - content.height);
40
+ return { x, y, side, arrow: horizontal ? clamp(target.top + target.height / 2 - y, 12, content.height - 12) : clamp(target.left + target.width / 2 - x, 12, content.width - 12) };
41
+ }
@@ -0,0 +1,56 @@
1
+ .ui-button {
2
+ --ui-button-color: var(--cso-ui-primary);
3
+ --ui-button-bg: var(--cso-ui-button-primary-bg, var(--cso-ui-primary));
4
+ --ui-button-soft: var(--cso-ui-primary-soft, #fff3eb);
5
+ --ui-button-outline: var(--ui-button-color);
6
+ --ui-button-pressed: var(--cso-ui-primary-pressed, var(--ui-button-color));
7
+ --ui-button-pressed-bg: var(--ui-button-pressed);
8
+ --ui-button-pressed-outline: var(--ui-button-pressed);
9
+ --ui-button-pressed-soft: var(--cso-ui-primary-soft-pressed, var(--ui-button-soft));
10
+ --ui-button-foreground: var(--cso-ui-button-primary-color, var(--cso-ui-on-primary));
11
+ --ui-button-height: var(--cso-ui-button-height, 40px);
12
+ --ui-button-font-size: var(--cso-ui-button-font-size, 16px);
13
+ position: relative;
14
+ min-width: 0;
15
+ height: var(--ui-button-height);
16
+ padding: 0 16px;
17
+ border-radius: var(--cso-ui-button-radius, 4px);
18
+ display: flex;
19
+ flex-direction: row;
20
+ align-items: center;
21
+ justify-content: center;
22
+ flex-shrink: 0;
23
+ background-color: var(--ui-button-bg);
24
+ }
25
+ .ui-button-success { --ui-button-color: var(--cso-ui-success); --ui-button-bg: var(--cso-ui-success); --ui-button-soft: var(--cso-ui-success-soft, #f3fbf9); --ui-button-pressed: var(--cso-ui-success-pressed, var(--ui-button-color)); --ui-button-pressed-soft: var(--cso-ui-success-soft-pressed, var(--ui-button-soft)); }
26
+ .ui-button-info { --ui-button-color: var(--cso-ui-text); --ui-button-bg: var(--cso-ui-surface-muted); --ui-button-soft: var(--cso-ui-canvas); --ui-button-outline: var(--cso-ui-line); --ui-button-foreground: var(--cso-ui-text); --ui-button-pressed: var(--cso-ui-text-muted); --ui-button-pressed-bg: var(--cso-ui-line); --ui-button-pressed-outline: var(--cso-ui-line-strong, var(--cso-ui-line)); --ui-button-pressed-soft: var(--cso-ui-surface-muted); }
27
+ .ui-button-warning { --ui-button-color: var(--cso-ui-warning); --ui-button-bg: var(--cso-ui-warning); --ui-button-soft: var(--cso-ui-warning-soft, #fff6eb); --ui-button-pressed: var(--cso-ui-warning-pressed, var(--ui-button-color)); --ui-button-pressed-soft: var(--cso-ui-warning-soft-pressed, var(--ui-button-soft)); }
28
+ .ui-button-danger { --ui-button-color: var(--cso-ui-danger); --ui-button-bg: var(--cso-ui-danger); --ui-button-soft: var(--cso-ui-danger-soft, #fff5f5); --ui-button-pressed: var(--cso-ui-danger-pressed, var(--ui-button-color)); --ui-button-pressed-soft: var(--cso-ui-danger-soft-pressed, var(--ui-button-soft)); }
29
+ .ui-button-neutral { --ui-button-color: var(--cso-ui-text-muted); --ui-button-bg: var(--cso-ui-text-muted); --ui-button-soft: var(--cso-ui-surface-muted); --ui-button-pressed: var(--ui-button-color); --ui-button-pressed-soft: var(--ui-button-soft); }
30
+ .ui-button-mini { --ui-button-height: 28px; --ui-button-font-size: 14px; padding: 0 12px; }
31
+ .ui-button-small { --ui-button-height: 32px; --ui-button-font-size: 14px; padding: 0 12px; }
32
+ .ui-button-large { --ui-button-height: 44px; padding: 0 20px; }
33
+ .ui-button-block { width: 100%; }
34
+ .ui-button-round { border-radius: 9999px; }
35
+ .ui-button-label, .ui-button-icon text { color: var(--ui-button-foreground); font-size: var(--ui-button-font-size); line-height: var(--ui-button-height); font-weight: 400; }
36
+ .ui-button-border { position: absolute; left: 0; right: 0; top: 0; bottom: 0; border-radius: var(--cso-ui-button-radius, 4px); border-width: 0; border-style: solid; border-color: var(--ui-button-outline); pointer-events: none; }
37
+ .ui-button-round .ui-button-border { border-radius: 9999px; }
38
+ .ui-button-plain, .ui-button-dashed, .ui-button-text { --ui-button-foreground: var(--ui-button-color); background-color: transparent; }
39
+ .ui-button-soft, .ui-button-subtle { --ui-button-foreground: var(--ui-button-color); background-color: var(--ui-button-soft); }
40
+ .ui-button-plain .ui-button-border, .ui-button-dashed .ui-button-border, .ui-button-subtle .ui-button-border { border-width: 1px; }
41
+ .ui-button-dashed .ui-button-border { border-style: dashed; }
42
+ .ui-button-hairline .ui-button-border { border-width: 0.5px; }
43
+ .ui-button-disabled { opacity: 0.4; }
44
+ .ui-button-interactive.ui-button-pressed { opacity: var(--cso-ui-button-pressed-opacity, 0.85); background-color: var(--ui-button-pressed-bg); }
45
+ .ui-button-plain.ui-button-interactive.ui-button-pressed, .ui-button-dashed.ui-button-interactive.ui-button-pressed, .ui-button-text.ui-button-interactive.ui-button-pressed { --ui-button-foreground: var(--ui-button-pressed); opacity: 1; background-color: var(--ui-button-soft); }
46
+ .ui-button-soft.ui-button-interactive.ui-button-pressed, .ui-button-subtle.ui-button-interactive.ui-button-pressed { --ui-button-foreground: var(--ui-button-pressed); background-color: var(--ui-button-pressed-soft); }
47
+ .ui-button-interactive.ui-button-pressed .ui-button-border { border-color: var(--ui-button-pressed-outline); }
48
+ .ui-button-icon { width: 20px; height: 20px; margin-right: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
49
+ .ui-button-mini .ui-button-icon { width: 14px; height: 14px; margin-right: 4px; }
50
+ .ui-button-small .ui-button-icon { width: 16px; height: 16px; margin-right: 4px; }
51
+ .ui-button-large .ui-button-icon { width: 22px; height: 22px; }
52
+ .ui-button-icon-only { width: var(--ui-button-height); padding: 0; }
53
+ .ui-button-icon-only .ui-button-icon { margin-right: 0; }
54
+ .ui-button-spinner { width: 20px; height: 20px; padding: 2px; margin-right: 6px; box-sizing: border-box; flex-shrink: 0; animation: ui-button-spin 800ms linear infinite; }
55
+ .ui-button-spinner-ring { width: 16px; height: 16px; border-radius: 50%; background-image: conic-gradient(transparent 0deg, transparent 90deg, var(--ui-button-foreground) 330deg, var(--ui-button-foreground) 360deg); mask-image: radial-gradient(closest-side, transparent 85%, #fff 85%, #fff 100%); }
56
+ @keyframes ui-button-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@@ -0,0 +1,56 @@
1
+ .ui-calendar-view{background-color:var(--cso-ui-surface);}
2
+ .ui-calendar-weekdays{display:flex;flex-direction:row;padding:8px 12px;}
3
+ .ui-calendar-weekdays text{flex:1;text-align:center;font-size:14px;line-height:20px;color:var(--cso-ui-text-secondary,var(--cso-ui-text-muted));}
4
+ .ui-calendar-scroll{width:100%;}
5
+ .ui-calendar-panel-title{height:40px;padding:10px 12px;font-size:14px;line-height:20px;font-weight:600;color:var(--cso-ui-text);}
6
+ .ui-calendar-days{padding:0 12px;display:flex;flex-direction:row;flex-wrap:wrap;}
7
+ .ui-calendar-day{position:relative;flex-shrink:0;width:14.285714%;height:60px;}
8
+ .ui-calendar-day-inner{position:relative;z-index:2;height:60px;display:flex;flex-direction:column;align-items:center;justify-content:center;}
9
+ .ui-calendar-day-label{font-family:"San Francisco",Roboto,Arial,"PingFang SC","Microsoft YaHei",sans-serif;font-size:16px;line-height:24px;font-weight:600;color:var(--cso-ui-text);}
10
+ .ui-calendar-day-top,.ui-calendar-day-bottom{position:absolute;left:0;right:0;text-align:center;font-size:10px;line-height:16px;color:var(--cso-ui-text);}
11
+ .ui-calendar-day-top{top:6px;}.ui-calendar-day-bottom{bottom:6px;}
12
+ .ui-calendar-day-selected .ui-calendar-day-inner,.ui-calendar-day-multiple-selected .ui-calendar-day-inner,.ui-calendar-day-multiple-middle .ui-calendar-day-inner,.ui-calendar-day-same .ui-calendar-day-inner{background-color:var(--cso-ui-primary);border-radius:4px;}
13
+ .ui-calendar-day-start .ui-calendar-day-inner{background-color:var(--cso-ui-primary);border-radius:4px 0 0 4px;}
14
+ .ui-calendar-day-end .ui-calendar-day-inner{background-color:var(--cso-ui-primary);border-radius:0 4px 4px 0;}
15
+ .ui-calendar-day-without-end .ui-calendar-day-inner{border-radius:4px;}
16
+ .ui-calendar-day-middle .ui-calendar-day-inner,.ui-calendar-range-half{background-color:var(--cso-ui-calendar-range-bg,#e5edff);}
17
+ .ui-calendar-day-multiple .ui-calendar-range-half{background-color:var(--cso-ui-primary);}
18
+ .ui-calendar-range-half{position:absolute;top:0;bottom:0;}
19
+ .ui-calendar-range-half-start{left:50%;right:0;}.ui-calendar-range-half-end{left:0;right:50%;}
20
+ .ui-calendar-day-selected text,.ui-calendar-day-multiple-selected text,.ui-calendar-day-multiple-middle text,.ui-calendar-day-same text,.ui-calendar-day-start text,.ui-calendar-day-end text{color:var(--cso-ui-on-primary,#fff);}
21
+ .ui-calendar-day-current .ui-calendar-day-label{color:var(--cso-ui-primary);}
22
+ .ui-calendar-day-disabled .ui-calendar-day-label{color:var(--cso-ui-disabled-text,#c9cbd4);}
23
+ .ui-calendar-day-month{width:25%;display:flex;justify-content:center;}
24
+ .ui-calendar-day-month .ui-calendar-day-inner{width:60px;align-self:center;}
25
+ .ui-calendar-controls{height:44px;padding:12px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;}
26
+ .ui-calendar-controls text{font-size:14px;line-height:20px;font-weight:600;color:var(--cso-ui-text);}
27
+ .ui-calendar-control-side{display:flex;flex-direction:row;gap:16px;}
28
+ .ui-calendar-control{width:20px;height:20px;color:var(--cso-ui-text-muted);}
29
+ .ui-calendar-control-disabled{opacity:.35;}
30
+ .ui-calendar-time{display:flex;flex-direction:row;box-shadow:0 -4px 8px rgba(0,0,0,.02);}
31
+ .ui-calendar-time-label{flex:1;display:flex;align-items:center;justify-content:center;}
32
+ .ui-calendar-time-label text{font-size:16px;line-height:24px;color:var(--cso-ui-text);}
33
+ .ui-calendar-time-picker{flex:3;min-width:0;}
34
+ .theme-dark .ui-calendar-view{--cso-ui-calendar-range-bg:#202127;}
35
+ .ui-calendar-close{padding:12px;}
36
+ .ui-calendar-header .ui-action-sheet-title{font-size:18px;line-height:26px;font-weight:600;}
37
+ .ui-calendar-close-light{display:var(--cso-ui-light-display,flex);}
38
+ .ui-calendar-close-dark{display:var(--cso-ui-dark-display,none);}
39
+ .ui-calendar-tabs{padding:0 16px;}
40
+ .ui-calendar-shortcuts{padding:6px 12px;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:16px;}
41
+ .ui-calendar-range{display:flex;flex-direction:row;align-items:center;justify-content:center;padding:0 12px 16px;}
42
+ .ui-calendar-range-item{position:relative;flex:1;min-width:0;padding:12px 0;}
43
+ .ui-calendar-range-item text{white-space:nowrap;font-size:16px;line-height:24px;font-weight:600;color:var(--cso-ui-primary);text-align:center;}
44
+ .ui-calendar-range-line{position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--cso-ui-primary);}
45
+ .ui-calendar-range-placeholder text{color:var(--cso-ui-text-placeholder,var(--cso-ui-text-muted));}
46
+ .ui-calendar-range-placeholder .ui-calendar-range-line{background-color:var(--cso-ui-line);}
47
+ .ui-calendar-range-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
48
+ .ui-calendar-range-separator{width:8px;height:1px;margin:0 8px;background-color:var(--cso-ui-text-auxiliary,var(--cso-ui-text-muted));}
49
+ .ui-calendar-confirm{position:relative;display:flex;flex-direction:row;align-items:center;padding:8px 12px;}
50
+ .ui-calendar-confirm-button{flex-grow:1;flex-shrink:0;}
51
+
52
+ .ui-calendar-confirm-line{position:absolute;left:0;right:0;top:0;height:1px;background-color:var(--cso-ui-surface-muted);}
53
+ .ui-calendar-range-item text{font-family:"San Francisco",Rotobo,Arial,"PingFang SC","Noto SansCJK","Microsoft YaHei",sans-serif;}
54
+
55
+ .ui-calendar-confirm .ui-button{flex-shrink:1;}
56
+ .ui-calendar .ui-action-sheet-close{right:12px;}
@@ -0,0 +1,62 @@
1
+ export type CalendarType = 'date' | 'dates' | 'daterange' | 'datetime' | 'datetimerange' | 'week' | 'weekrange' | 'month' | 'monthrange';
2
+ export type CalendarValue = number | readonly (number | null)[] | null;
3
+ export type CalendarDayType = '' | 'selected' | 'start' | 'end' | 'middle' | 'same' | 'current' | 'multiple-middle' | 'multiple-selected';
4
+ export type CalendarDayItem = {
5
+ date: number;
6
+ text: string;
7
+ disabled: boolean;
8
+ type: CalendarDayType;
9
+ topInfo?: string;
10
+ bottomInfo?: string;
11
+ customClass?: string;
12
+ };
13
+ export type CalendarSwitchMode = 'none' | 'month' | 'year-month';
14
+ export type CalendarModelProps = {
15
+ type?: CalendarType;
16
+ minDate?: number;
17
+ maxDate?: number;
18
+ firstDayOfWeek?: number;
19
+ defaultTime?: string | readonly string[];
20
+ maxRange?: number;
21
+ allowSameDay?: boolean;
22
+ };
23
+ export declare const calendarDefaults: {
24
+ minDate: number;
25
+ maxDate: number;
26
+ };
27
+ export declare const calendarRange: (type?: CalendarType) => boolean;
28
+ export declare const calendarTime: (type?: CalendarType) => type is "datetime" | "datetimerange";
29
+ export declare const calendarMonth: (type?: CalendarType) => type is "month" | "monthrange";
30
+ export declare function calendarMidnight(value: number): number;
31
+ export declare function calendarAddDays(value: number, amount: number): number;
32
+ export declare function calendarDayDistance(a: number, b: number): number;
33
+ export declare function calendarBounds(props: CalendarModelProps): {
34
+ min: number;
35
+ max: number;
36
+ minDay: number;
37
+ maxDay: number;
38
+ };
39
+ export declare function calendarValues(value: CalendarValue | undefined): number[];
40
+ export declare function calendarWeekStart(value: number, first?: number): number;
41
+ export declare function calendarPeriod(value: number, type?: CalendarType, first?: number): number;
42
+ export declare function calendarWeekNumber(value: number): number;
43
+ export declare function calendarNormalize(value: CalendarValue | undefined, props: CalendarModelProps): CalendarValue;
44
+ export declare function calendarComplete(value: CalendarValue, type?: CalendarType): boolean;
45
+ export declare function calendarPick(props: CalendarModelProps, value: CalendarValue, date: number): {
46
+ value: CalendarValue;
47
+ overRange?: boolean;
48
+ timeIndex?: number;
49
+ } | undefined;
50
+ export declare function calendarState(date: number, value: CalendarValue, props: CalendarModelProps): CalendarDayType;
51
+ export type CalendarPanel = {
52
+ date: number;
53
+ offset: number;
54
+ height: number;
55
+ rows: number;
56
+ title: boolean;
57
+ };
58
+ export declare function calendarPanels(props: CalendarModelProps, switching: boolean, display: number): CalendarPanel[];
59
+ export declare function calendarScrollTarget(panels: CalendarPanel[], value: CalendarValue, props: CalendarModelProps): {
60
+ index: number;
61
+ offset: number;
62
+ };
@@ -0,0 +1,141 @@
1
+ const now = new Date();
2
+ export const calendarDefaults = { minDate: new Date(now.getFullYear(), now.getMonth() - 6, now.getDate()).getTime(), maxDate: new Date(now.getFullYear(), now.getMonth() + 6, now.getDate(), 23, 59, 59).getTime() };
3
+ export const calendarRange = (type = 'date') => type.endsWith('range');
4
+ export const calendarTime = (type = 'date') => type === 'datetime' || type === 'datetimerange';
5
+ export const calendarMonth = (type = 'date') => type === 'month' || type === 'monthrange';
6
+ export function calendarMidnight(value) { const d = new Date(value); return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime(); }
7
+ export function calendarAddDays(value, amount) { const d = new Date(value); d.setDate(d.getDate() + amount); return d.getTime(); }
8
+ export function calendarDayDistance(a, b) { const first = new Date(a), last = new Date(b); return Math.round((Date.UTC(last.getFullYear(), last.getMonth(), last.getDate()) - Date.UTC(first.getFullYear(), first.getMonth(), first.getDate())) / 86400000); }
9
+ export function calendarBounds(props) {
10
+ const min = props.minDate ?? calendarDefaults.minDate, max = props.maxDate ?? calendarDefaults.maxDate;
11
+ if (!Number.isFinite(new Date(min).getTime()) || !Number.isFinite(new Date(max).getTime()) || min > max)
12
+ throw new Error('Invalid Calendar bounds');
13
+ return { min, max, minDay: calendarMidnight(min), maxDay: calendarMidnight(max) };
14
+ }
15
+ export function calendarValues(value) { return (Array.isArray(value) ? value : [value]).filter((item) => typeof item === 'number' && Number.isFinite(new Date(item).getTime())); }
16
+ export function calendarWeekStart(value, first = 0) { const date = new Date(calendarMidnight(value)), day = ((Math.trunc(first) % 7) + 7) % 7; date.setDate(date.getDate() - (date.getDay() - day + 7) % 7); return date.getTime(); }
17
+ export function calendarPeriod(value, type = 'date', first = 0) {
18
+ const date = new Date(value);
19
+ return calendarMonth(type) ? new Date(date.getFullYear(), date.getMonth(), 1).getTime() : type.startsWith('week') ? calendarWeekStart(value, first) : calendarMidnight(value);
20
+ }
21
+ export function calendarWeekNumber(value) { const d = new Date(calendarMidnight(value)); d.setDate(d.getDate() + 3 - (d.getDay() + 6) % 7); const first = new Date(d.getFullYear(), 0, 4); return 1 + Math.round((calendarDayDistance(first.getTime(), d.getTime()) - 3 + (first.getDay() + 6) % 7) / 7); }
22
+ function periodEnd(value, type) { const date = new Date(value); return calendarMonth(type) ? new Date(date.getFullYear(), date.getMonth() + 1, 0).getTime() : type.startsWith('week') ? calendarAddDays(value, 6) : value; }
23
+ export function calendarNormalize(value, props) {
24
+ const bounds = calendarBounds(props), type = props.type ?? 'date';
25
+ const values = calendarValues(value).map(value => Math.max(bounds.min, Math.min(bounds.max, calendarTime(type) ? value : calendarMidnight(value))));
26
+ if (type === 'dates')
27
+ return [...new Set(values)].sort((a, b) => a - b);
28
+ if (calendarRange(type))
29
+ return values.length ? values.length === 1 ? [values[0], null] : [Math.min(values[0], values[1]), Math.max(values[0], values[1])] : [];
30
+ return values[0] ?? null;
31
+ }
32
+ export function calendarComplete(value, type = 'date') { const values = calendarValues(value); return type === 'dates' ? values.length > 0 : calendarRange(type) ? values.length === 2 : values.length === 1; }
33
+ function withTime(date, props, end = false) {
34
+ const text = Array.isArray(props.defaultTime) ? props.defaultTime[end ? 1 : 0] ?? '00:00:00' : props.defaultTime ?? '00:00:00';
35
+ if (!/^\d{1,2}:\d{2}(:\d{2})?$/.test(text))
36
+ throw new Error('Invalid Calendar defaultTime');
37
+ const [h = 0, m = 0, s = 0] = text.split(':').map(Number);
38
+ if (h > 23 || m > 59 || s > 59)
39
+ throw new Error('Invalid Calendar defaultTime');
40
+ const result = new Date(date);
41
+ result.setHours(h, m, s, 0);
42
+ const bounds = calendarBounds(props);
43
+ return Math.max(bounds.min, Math.min(bounds.max, result.getTime()));
44
+ }
45
+ export function calendarPick(props, value, date) {
46
+ const type = props.type ?? 'date', bounds = calendarBounds(props), period = calendarPeriod(date, type, props.firstDayOfWeek);
47
+ if (periodEnd(period, type) < bounds.minDay || period > bounds.maxDay)
48
+ return;
49
+ const values = calendarValues(value), picked = withTime(period, props);
50
+ if (type === 'dates') {
51
+ const existing = values.some(item => calendarMidnight(item) === calendarMidnight(picked));
52
+ return { value: existing ? values.filter(item => calendarMidnight(item) !== calendarMidnight(picked)) : [...values, picked].sort((a, b) => a - b) };
53
+ }
54
+ if (!calendarRange(type))
55
+ return { value: picked, timeIndex: 0 };
56
+ const first = values[0], second = values[1], start = first === undefined ? undefined : calendarPeriod(first, type, props.firstDayOfWeek);
57
+ if (type === 'datetimerange' && first !== undefined && second !== undefined) {
58
+ if (calendarMidnight(date) === calendarMidnight(first))
59
+ return { value, timeIndex: 0 };
60
+ if (calendarMidnight(date) === calendarMidnight(second))
61
+ return { value, timeIndex: 1 };
62
+ }
63
+ if (start !== undefined && second === undefined && period >= start) {
64
+ if (period === start && !props.allowSameDay)
65
+ return;
66
+ let last = period, count = type === 'monthrange' ? (new Date(last).getFullYear() - new Date(start).getFullYear()) * 12 + new Date(last).getMonth() - new Date(start).getMonth() + 1 : type === 'weekrange' ? Math.round(calendarDayDistance(start, last) / 7) + 1 : calendarDayDistance(start, last) + 1;
67
+ const limit = props.maxRange && Number.isFinite(props.maxRange) ? Math.max(1, Math.trunc(props.maxRange)) : 0, overRange = !!limit && count > limit;
68
+ if (overRange) {
69
+ if (type === 'monthrange') {
70
+ const d = new Date(start);
71
+ d.setMonth(d.getMonth() + limit - 1);
72
+ last = d.getTime();
73
+ }
74
+ else
75
+ last = calendarAddDays(start, (limit - 1) * (type === 'weekrange' ? 7 : 1));
76
+ }
77
+ return { value: [first, Math.max(first, withTime(last, props, true))], overRange, timeIndex: 1 };
78
+ }
79
+ return { value: [picked, null], timeIndex: 0 };
80
+ }
81
+ export function calendarState(date, value, props) {
82
+ const type = props.type ?? 'date', values = calendarValues(value), key = calendarPeriod(date, type, props.firstDayOfWeek);
83
+ if (type === 'dates') {
84
+ const selected = new Set(values.map(calendarMidnight));
85
+ if (selected.has(date)) {
86
+ const before = selected.has(calendarAddDays(date, -1)), after = selected.has(calendarAddDays(date, 1));
87
+ return before && after ? 'multiple-middle' : before ? 'end' : after ? 'start' : 'multiple-selected';
88
+ }
89
+ }
90
+ else if (type.startsWith('week')) {
91
+ if (values.length) {
92
+ const first = calendarWeekStart(values[0], props.firstDayOfWeek), last = calendarAddDays(calendarWeekStart(values[1] ?? values[0], props.firstDayOfWeek), 6);
93
+ if (date === first)
94
+ return 'start';
95
+ if (date === last)
96
+ return 'end';
97
+ if (date > first && date < last)
98
+ return 'middle';
99
+ }
100
+ }
101
+ else if (calendarRange(type)) {
102
+ const [first, last] = values.map(value => calendarPeriod(value, type, props.firstDayOfWeek));
103
+ if (key === first && last === first)
104
+ return 'same';
105
+ if (key === first)
106
+ return 'start';
107
+ if (key === last)
108
+ return 'end';
109
+ if (first !== undefined && last !== undefined && key > first && key < last)
110
+ return 'middle';
111
+ }
112
+ else if (values[0] !== undefined && calendarPeriod(values[0], type, props.firstDayOfWeek) === key)
113
+ return 'selected';
114
+ return key === calendarPeriod(Date.now(), type, props.firstDayOfWeek) ? 'current' : '';
115
+ }
116
+ export function calendarPanels(props, switching, display) {
117
+ const { min, max } = calendarBounds(props), monthly = calendarMonth(props.type), first = new Date(min), last = new Date(max), count = monthly ? last.getFullYear() - first.getFullYear() + 1 : (last.getFullYear() - first.getFullYear()) * 12 + last.getMonth() - first.getMonth() + 1;
118
+ if (!switching && count > 240)
119
+ throw new Error('Calendar flat mode is limited to 240 panels; use switchMode="month" or "year-month"');
120
+ let offset = 0;
121
+ return Array.from({ length: switching ? 1 : count }, (_, index) => {
122
+ const d = switching ? new Date(display) : new Date(first.getFullYear(), monthly ? 0 : first.getMonth() + index, 1);
123
+ if (monthly && !switching)
124
+ d.setFullYear(first.getFullYear() + index);
125
+ const date = new Date(d.getFullYear(), monthly ? 0 : d.getMonth(), 1).getTime(), start = (new Date(date).getDay() - (props.firstDayOfWeek ?? 0) % 7 + 7) % 7, days = new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
126
+ const rows = monthly ? 3 : Math.ceil((start + days) / 7), title = !switching && index > 0, height = rows * 60 + (rows - 1) * 4 + (title ? 40 : 0), panel = { date, offset, height, rows, title };
127
+ offset += height;
128
+ return panel;
129
+ });
130
+ }
131
+ export function calendarScrollTarget(panels, value, props) {
132
+ const { min, max } = calendarBounds(props), selected = calendarValues(value)[0] ?? Date.now(), target = Math.max(min, Math.min(max, selected)), monthly = calendarMonth(props.type), date = new Date(target);
133
+ let index = panels.findIndex(panel => new Date(panel.date).getFullYear() === date.getFullYear() && (monthly || new Date(panel.date).getMonth() === date.getMonth()));
134
+ if (index < 0)
135
+ index = 0;
136
+ const panel = panels[index];
137
+ if (!panel)
138
+ return { index: 0, offset: 0 };
139
+ const day = ((props.firstDayOfWeek ?? 0) % 7 + 7) % 7, row = monthly ? 0 : Math.floor(((new Date(date.getFullYear(), date.getMonth(), 1).getDay() - day + 7) % 7 + date.getDate() - 1) / 7);
140
+ return { index, offset: panel.offset + (panel.title ? 40 : 0) + row * 64 };
141
+ }
package/dist/card.css ADDED
@@ -0,0 +1,8 @@
1
+ .ui-card.ui-card-standard{position:relative;margin:0 16px 16px;border-width:0;background-color:var(--cso-ui-surface);border-radius:8px;box-shadow:0 2px 8px rgba(0,0,0,.04);overflow:hidden;}
2
+ .ui-card-standard .ui-card-header{width:100%;padding:12px 16px;box-sizing:border-box;}
3
+ .ui-card-standard .ui-card-title{width:100%;font-size:18px;line-height:20px;font-weight:600;color:var(--cso-ui-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
4
+ .ui-card-standard .ui-card-body,.ui-card-standard .ui-card-header + .ui-card-body{position:relative;padding:10px 12px;color:var(--cso-ui-text-muted);font-size:14px;line-height:20px;box-sizing:border-box;}
5
+ .ui-card-standard .ui-card-copy{font-size:14px;line-height:20px;color:inherit;}
6
+ .ui-card-standard .ui-card-footer{position:relative;display:flex;flex-direction:row;align-items:center;justify-content:flex-end;padding:8px 12px;border-top-width:0;}
7
+ .ui-card-footer-line,.ui-card-content-line{position:absolute;top:0;left:12px;right:12px;height:.5px;background-color:var(--cso-ui-line);}
8
+ .ui-card-standard.ui-card-rectangle{margin-left:0;margin-right:0;border-radius:0;box-shadow:none;}
@@ -0,0 +1,16 @@
1
+ .ui-cascader-header .ui-action-sheet-title{font-size:18px;line-height:26px;font-weight:600;}
2
+ .ui-cascader-content{position:relative;}
3
+ .ui-cascader-scroll{height:336px;}
4
+ .ui-cascader-option{padding:16px 12px;display:flex;flex-direction:row;align-items:center;}
5
+ .ui-cascader-option-content{flex:1;min-width:0;}
6
+ .ui-cascader-option-label{font-size:16px;line-height:24px;color:var(--cso-ui-text);}
7
+ .ui-cascader-option-active .ui-cascader-option-label{color:var(--cso-ui-primary);font-weight:600;}
8
+ .ui-cascader-option-disabled .ui-cascader-option-label{color:var(--cso-ui-disabled-text);}
9
+ .ui-cascader-tip{margin-top:2px;font-size:12px;line-height:18px;color:var(--cso-ui-text-muted);}
10
+ .ui-cascader-confirm text{font-size:15px;line-height:22px;color:var(--cso-ui-primary);}
11
+ .ui-cascader-confirm-disabled{opacity:.4;}
12
+ .ui-cascader .ui-action-sheet-close{right:12px;}
13
+ .ui-cascader-loading{position:absolute;top:44px;bottom:0;left:0;right:0;display:flex;align-items:center;justify-content:center;}
14
+ .ui-cascader-is-loading{opacity:.4;}
15
+ .ui-cascader-close-light{display:var(--cso-ui-light-display);}
16
+ .ui-cascader-close-dark{display:var(--cso-ui-dark-display);}
@@ -0,0 +1,21 @@
1
+ export type CascaderScalar = string | number;
2
+ export type CascaderValue = CascaderScalar | readonly CascaderScalar[];
3
+ export type CascaderOption = {
4
+ value: CascaderScalar;
5
+ text: string;
6
+ children?: readonly CascaderOption[];
7
+ disabled?: boolean;
8
+ tip?: string;
9
+ isLeaf?: boolean;
10
+ [key: string]: unknown;
11
+ };
12
+ export type CascaderFields = {
13
+ valueKey?: string;
14
+ textKey?: string;
15
+ childrenKey?: string;
16
+ tipKey?: string;
17
+ isLeafKey?: string;
18
+ };
19
+ export type CascaderInput = CascaderOption | Readonly<Record<string, unknown>>;
20
+ export declare function normalizeCascader(options: readonly CascaderInput[], fields: CascaderFields): CascaderOption[];
21
+ export declare function cascaderPath(options: readonly CascaderOption[], value: CascaderValue | undefined): CascaderOption[];
@@ -0,0 +1,32 @@
1
+ export function normalizeCascader(options, fields) {
2
+ const { valueKey = 'value', textKey = 'text', childrenKey = 'children', tipKey = 'tip', isLeafKey = 'isLeaf' } = fields;
3
+ return options.flatMap(option => {
4
+ const value = option[valueKey];
5
+ if (typeof value !== 'string' && typeof value !== 'number')
6
+ return [];
7
+ const children = option[childrenKey];
8
+ return [{ ...option, value, text: String(option[textKey] ?? value), tip: option[tipKey] === undefined ? undefined : String(option[tipKey]), isLeaf: option[isLeafKey] === undefined ? undefined : !!option[isLeafKey], disabled: !!option.disabled, children: Array.isArray(children) ? normalizeCascader(children, fields) : undefined }];
9
+ });
10
+ }
11
+ export function cascaderPath(options, value) {
12
+ if (Array.isArray(value)) {
13
+ const path = [];
14
+ let level = options;
15
+ for (const key of value) {
16
+ const option = level.find(item => item.value === key);
17
+ if (!option)
18
+ break;
19
+ path.push(option);
20
+ level = option.children ?? [];
21
+ }
22
+ return path;
23
+ }
24
+ for (const option of options) {
25
+ if (option.value === value)
26
+ return [option];
27
+ const children = cascaderPath(option.children ?? [], value);
28
+ if (children.length)
29
+ return [option, ...children];
30
+ }
31
+ return [];
32
+ }
package/dist/cell.css ADDED
@@ -0,0 +1,41 @@
1
+ .ui-cell-group { display: flex; flex-direction: column; }
2
+ .ui-cell-group-title { position: relative; padding: 12px; display: flex; flex-direction: row; background-color: var(--cso-ui-surface); }
3
+ .ui-cell-group-heading { flex: 1; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--cso-ui-text); }
4
+ .ui-cell-group-value { font-size: 14px; line-height: 20px; color: var(--cso-ui-text-muted); }
5
+ .ui-cell-group-body { overflow: hidden; background-color: var(--cso-ui-surface); }
6
+ .ui-cell-group-insert { margin: 0 16px; }
7
+ .ui-cell-group-insert .ui-cell-group-body { border-radius: 8px; }
8
+ .ui-cell { --ui-cell-font-size: 14px; --ui-cell-line-height: 20px; position: relative; width: 100%; padding: 12px; background-color: var(--cso-ui-surface); }
9
+ .ui-cell-wrapper { display: flex; flex-direction: row; align-items: flex-start; width: 100%; }
10
+ .ui-cell-main { flex: 1; min-width: 0; display: flex; flex-direction: row; }
11
+ .ui-cell-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
12
+ .ui-cell-title-row { display: flex; flex-direction: row; align-items: center; min-height: var(--ui-cell-line-height); }
13
+ .ui-cell-title { min-width: 0; font-size: var(--ui-cell-font-size); line-height: var(--ui-cell-line-height); color: var(--cso-ui-cell-title-color,var(--cso-ui-text)); }
14
+ .ui-cell-description { margin-top: 4px; font-size: var(--ui-cell-font-size); line-height: var(--ui-cell-line-height); color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); }
15
+ .ui-cell-right { flex: 1; min-width: 0; display: flex; flex-direction: row; align-items: flex-start; }
16
+ .ui-cell-value-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }
17
+ .ui-cell-value { width: 100%; font-size: var(--ui-cell-font-size); line-height: var(--ui-cell-line-height); color: var(--cso-ui-text-muted); text-align: right; }
18
+ .ui-cell-placeholder { color: var(--cso-ui-text-placeholder, var(--cso-ui-text-muted)); }
19
+ .ui-cell-value-align-left .ui-cell-value { text-align: left; }
20
+ .ui-cell-value-align-left .ui-cell-value-wrap { align-items: flex-start; }
21
+ .ui-cell-value-align-center .ui-cell-value { text-align: center; }
22
+ .ui-cell-value-align-center .ui-cell-value-wrap { align-items: center; }
23
+ .ui-cell-icon { width: 20px; height: 20px; margin-right: 4px; display: flex; flex-shrink: 0; align-items: center; justify-content: center; }
24
+ .ui-cell-icon text { font-size: 20px; line-height: 20px; color: var(--cso-ui-text-muted); }
25
+ .ui-cell-required { margin-left: 4px; font-size: 14px; line-height: 20px; color: var(--cso-ui-danger); }
26
+ .ui-cell-required-before { margin-left: 0; margin-right: 4px; }
27
+ .ui-cell-large { --ui-cell-font-size: 16px; --ui-cell-line-height: 24px; padding: 16px; }
28
+ .ui-cell-large .ui-cell-icon { height: 24px; }
29
+ .ui-cell-center .ui-cell-wrapper, .ui-cell-center .ui-cell-right { align-items: center; }
30
+ .ui-cell-vertical .ui-cell-wrapper { flex-direction: column; }
31
+ .ui-cell-vertical .ui-cell-main, .ui-cell-vertical .ui-cell-right { width: 100%; flex: none; }
32
+ .ui-cell-vertical .ui-cell-right { margin-top: 16px; }
33
+ .ui-cell-clickable.ui-cell-pressed { background-color: var(--cso-ui-canvas); }
34
+ .ui-cell-border, .ui-cell-group-title-line { position: absolute; left: 12px; right: 12px; top: 0; height: 1px; transform: scaleY(.5); background-color: var(--cso-ui-line); display: none; }
35
+ .ui-cell-border-enabled, .ui-cell-group-bordered .ui-cell + .ui-cell .ui-cell-border-inherit { display: flex; }
36
+ .ui-cell-group-bordered .ui-cell-group-title-line { display: flex; top: auto; bottom: 0; }
37
+ .ui-cell-arrow { width: 20px; height: var(--ui-cell-line-height); margin-left: 8px; display: flex; flex-shrink: 0; align-items: center; justify-content: center; }
38
+ .ui-cell-arrow-mark { width: 8px; height: 8px; border-right-width: 1.5px; border-right-style: solid; border-right-color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); border-bottom-width: 1.5px; border-bottom-style: solid; border-bottom-color: var(--cso-ui-text-auxiliary, var(--cso-ui-text-muted)); transform: rotate(-45deg); }
39
+ .ui-cell-arrow-left .ui-cell-arrow-mark { transform: rotate(135deg); }
40
+ .ui-cell-arrow-up .ui-cell-arrow-mark { transform: rotate(-135deg); }
41
+ .ui-cell-arrow-down .ui-cell-arrow-mark { transform: rotate(45deg); }
@@ -0,0 +1,27 @@
1
+ .ui-choice-group{display:flex;flex-direction:column;}
2
+ .ui-choice-group-horizontal{flex-direction:row;flex-wrap:wrap;}
3
+ .ui-choice{--ui-choice-color:var(--cso-ui-primary);position:relative;display:flex;flex-direction:row-reverse;align-items:center;justify-content:flex-end;overflow:hidden;min-width:0;}
4
+ .ui-choice-right{flex-direction:row;justify-content:space-between;}
5
+ .ui-choice-horizontal{flex:none;margin-right:16px;}
6
+ .ui-choice-horizontal:last-child{margin-right:0;}
7
+ .ui-choice-label{margin-left:8px;min-width:0;display:flex;flex-direction:row;flex-wrap:wrap;}
8
+ .ui-choice-label text{font-size:14px;line-height:20px;color:var(--cso-ui-text);}
9
+ .ui-choice-right .ui-choice-label{margin-left:0;margin-right:8px;}
10
+ .ui-choice-shape{position:relative;flex:none;display:flex;align-items:center;justify-content:center;}
11
+
12
+
13
+
14
+ .ui-choice-disabled{opacity:.4;}
15
+ .ui-choice-button{flex:none;min-width:74px;max-width:148px;margin:0 16px 16px 0;border-radius:4px;border:1px solid var(--cso-ui-canvas);background-color:var(--cso-ui-canvas);}
16
+ .ui-choice-button .ui-choice-label{margin:0;padding:6px 16px;}
17
+ .ui-choice-button .ui-choice-label text{white-space:nowrap;text-align:center;}
18
+ .ui-choice-button.ui-choice-checked{border-color:var(--ui-choice-color);background-color:var(--cso-ui-surface);}
19
+ .ui-choice-button .ui-choice-shape{position:absolute;top:-11px;left:-9px;width:26px;height:26px;border-radius:999px;background-color:var(--ui-choice-color);}
20
+ .ui-choice-button .ui-choice-shape .ui-icon{position:absolute;top:13px;right:4px;}
21
+ .ui-choice-button.ui-choice-right .ui-choice-shape{left:auto;right:-9px;}
22
+ .ui-choice-button.ui-choice-right .ui-choice-shape .ui-icon{right:auto;left:4px;}
23
+
24
+ .ui-choice-group-buttons{flex-direction:row;flex-wrap:wrap;}
25
+
26
+ .ui-choice-light{display:var(--cso-ui-light-display,flex);}
27
+ .ui-choice-dark{display:var(--cso-ui-dark-display,none);}
@@ -0,0 +1,28 @@
1
+ import type { ReactNode } from '@lynx-js/react';
2
+ import type { CSSProperties } from '@lynx-js/types';
3
+ export type ChoiceValue = string | number | boolean;
4
+ export type ChoiceType = 'circle' | 'square' | 'dot' | 'button';
5
+ export type ChoiceStyle = {
6
+ type?: ChoiceType;
7
+ checkedColor?: string;
8
+ uncheckedColor?: string;
9
+ disabled?: boolean | null;
10
+ readonly?: boolean | null;
11
+ placement?: 'left' | 'right';
12
+ direction?: 'horizontal' | 'vertical';
13
+ size?: 'large';
14
+ maxWidth?: string;
15
+ labelClassName?: string;
16
+ className?: string;
17
+ style?: CSSProperties;
18
+ renderIcon?: (state: {
19
+ isChecked: boolean;
20
+ }) => ReactNode;
21
+ children?: ReactNode;
22
+ };
23
+ export declare function choiceDefaults(props?: ChoiceStyle): ChoiceStyle;
24
+ export declare function Choice({ checked, indeterminate, type, disabled, readonly, placement, direction, checkedColor, uncheckedColor, size, maxWidth, labelClassName, className, style, renderIcon, children, onTap }: ChoiceStyle & {
25
+ checked: boolean;
26
+ indeterminate?: boolean;
27
+ onTap: () => void;
28
+ }): import("@lynx-js/react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { Icon } from "./Icon.jsx";
2
+ export function choiceDefaults(props) { if (!props)
3
+ return {}; const { type, checkedColor, uncheckedColor, disabled, readonly, placement, direction, size, maxWidth } = props; return { type, checkedColor, uncheckedColor, disabled, readonly, placement, direction, size, maxWidth }; }
4
+ export function Choice({ checked, indeterminate = false, type = 'circle', disabled = false, readonly = false, placement = 'left', direction = 'vertical', checkedColor, uncheckedColor, size, maxWidth, labelClassName = '', className = '', style, renderIcon, children, onTap }) {
5
+ const glyph = indeterminate && type !== 'button' ? 'minus-circle-fill' : type === 'button' ? 'check' : checked ? type === 'dot' ? 'check-circle-radio-fill' : type === 'square' ? 'check-square-fill' : 'check-circle-fill' : type === 'square' ? 'uncheck-square' : 'uncheck-circle';
6
+ const active = checked || indeterminate;
7
+ const color = active ? checkedColor : uncheckedColor, dimension = type === 'button' ? 10 : size === 'large' ? 26 : 22;
8
+ const icon = renderIcon ? renderIcon({ isChecked: checked }) : type !== 'button' || checked ? <view className="ui-choice-shape">{color || type === 'button' ? <Icon name={glyph} size={dimension} color={type === 'button' ? '#fff' : color}/> : <><Icon className="ui-choice-light" name={glyph} size={dimension} color={active ? '#1c64fd' : '#e5e6eb'}/><Icon className="ui-choice-dark" name={glyph} size={dimension} color={active ? '#5b90ff' : '#3b4055'}/></>}</view> : null;
9
+ return <view className={`ui-choice ui-choice-${type} ui-choice-${placement} ui-choice-${direction} ${active ? 'ui-choice-checked' : ''} ${disabled ? 'ui-choice-disabled' : ''} ${size === 'large' ? 'ui-choice-large' : ''} ${className}`} style={{ ...(checkedColor ? { '--ui-choice-color': checkedColor } : {}), ...style }} catchtap={() => {
10
+ 'background only';
11
+ if (!disabled && !readonly)
12
+ onTap();
13
+ }} accessibility-element accessibility-traits="button" accessibility-label={`${typeof children === 'string' ? children : ''}${checked ? ',已选中' : ',未选中'}${disabled ? ',禁用' : ''}`}>
14
+ {children !== undefined ? <view className={`ui-choice-label ${labelClassName}`} style={maxWidth ? { maxWidth } : undefined}>{typeof children === 'string' || typeof children === 'number' ? <text>{children}</text> : children}</view> : null}{icon}
15
+ </view>;
16
+ }
@@ -0,0 +1,4 @@
1
+ .ui-circle{position:relative;flex-shrink:0;}
2
+ .ui-circle-svg{width:100%;height:100%;}
3
+ .ui-circle-content{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;align-items:center;justify-content:center;color:var(--cso-ui-text);}
4
+ .ui-circle-text{font-size:20px;line-height:28px;color:inherit;text-align:center;}
@@ -0,0 +1,15 @@
1
+ export type CircleColor = string | Readonly<Record<string, string>>;
2
+ export declare function circleStops(color: CircleColor): {
3
+ offset: number;
4
+ color: string;
5
+ }[];
6
+ export declare function circleSvg({ value, size, color, layerColor, fill, strokeWidth, strokeLinecap, clockwise }: {
7
+ value: number;
8
+ size: number;
9
+ color: CircleColor;
10
+ layerColor: string;
11
+ fill?: string;
12
+ strokeWidth: number;
13
+ strokeLinecap: 'round' | 'butt' | 'square';
14
+ clockwise: boolean;
15
+ }): string;