centui 0.0.0-stage → 3.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 (301) hide show
  1. package/LICENSE +433 -0
  2. package/README.md +54 -2
  3. package/dist/Agree-DT46e5q5.cjs +1 -0
  4. package/dist/Agree-yTGTi4e6.js +44 -0
  5. package/dist/Amount-De-oObat.cjs +1 -0
  6. package/dist/Amount-wOtRYOdx.js +62 -0
  7. package/dist/Button-BIi6CrwM.js +61 -0
  8. package/dist/Button-Blpwwbnw.cjs +1 -0
  9. package/dist/CellItem-T78DHako.cjs +1 -0
  10. package/dist/CellItem-YZD-BxKt.js +72 -0
  11. package/dist/CheckBoxBase-BDsytL_r.cjs +1 -0
  12. package/dist/CheckBoxBase-BjyVzGqj.js +40 -0
  13. package/dist/CheckList-Bfy3B-eN.js +239 -0
  14. package/dist/CheckList-DEmLmccw.cjs +1 -0
  15. package/dist/Codebox-Cgj7wyzd.cjs +1 -0
  16. package/dist/Codebox-D0UtCj11.js +189 -0
  17. package/dist/DatePicker-B1AVbKhK.cjs +1 -0
  18. package/dist/DatePicker-TAHuve5t.js +177 -0
  19. package/dist/Field-CseJzTZz.js +51 -0
  20. package/dist/Field-DDmHa4zB.cjs +1 -0
  21. package/dist/FieldItem-Cc7bw5vU.js +88 -0
  22. package/dist/FieldItem-Dkpx5Kxk.cjs +1 -0
  23. package/dist/Icon-dWGSK6Ou.js +119 -0
  24. package/dist/Icon-jaEPn7d7.cjs +31 -0
  25. package/dist/InputItem-EJ4Y3tpU.cjs +1 -0
  26. package/dist/InputItem-bhFtp97z.js +322 -0
  27. package/dist/NoticeBar-DSf_EjTL.cjs +1 -0
  28. package/dist/NoticeBar-PEYcjXwD.js +84 -0
  29. package/dist/NumberKeyboard-BX0c0l2r.cjs +1 -0
  30. package/dist/NumberKeyboard-C7TRF5iC.js +320 -0
  31. package/dist/Picker-D-TPtSxf.cjs +1 -0
  32. package/dist/Picker-Dam0LEcc.js +476 -0
  33. package/dist/Popup-Cm4BuaOo.cjs +1 -0
  34. package/dist/Popup-DPYBBL95.js +116 -0
  35. package/dist/PopupTitleBar-B4vwxKC7.cjs +1 -0
  36. package/dist/PopupTitleBar-nVurLaOe.js +85 -0
  37. package/dist/Progress-CwIC6scr.js +67 -0
  38. package/dist/Progress-DukssNvl.cjs +1 -0
  39. package/dist/Radio-ZHivLdvi.cjs +1 -0
  40. package/dist/Radio-fsc7_N5K.js +65 -0
  41. package/dist/RadioGroup-BR_jSDR4.cjs +1 -0
  42. package/dist/RadioGroup-CMPmk8X_.js +82 -0
  43. package/dist/RadioList-CkerkQEY.js +127 -0
  44. package/dist/RadioList-upQgua8Z.cjs +1 -0
  45. package/dist/Roller-DALhjhfg.cjs +1 -0
  46. package/dist/Roller-DFJ7jMV0.js +92 -0
  47. package/dist/RollerSuccess--JecJ7bz.cjs +1 -0
  48. package/dist/RollerSuccess-CVEmS9gU.js +224 -0
  49. package/dist/ScrollViewMore-BWph-i1-.cjs +1 -0
  50. package/dist/ScrollViewMore-BgYJx-TP.js +278 -0
  51. package/dist/Skeleton--SCiydNl.cjs +1 -0
  52. package/dist/Skeleton-BG_j23KI.js +55 -0
  53. package/dist/Slider-D3wrE8hn.cjs +1 -0
  54. package/dist/Slider-DteN8p-L.js +95 -0
  55. package/dist/Stepper-1EOk4pCY.js +127 -0
  56. package/dist/Stepper-BJr4I6_8.cjs +1 -0
  57. package/dist/SwiperItem-B6TgjCsM.cjs +1 -0
  58. package/dist/SwiperItem-CKd-XKT7.js +337 -0
  59. package/dist/Switch-B6DvVj2p.js +30 -0
  60. package/dist/Switch-BVPjF8CM.cjs +1 -0
  61. package/dist/Tag-CPv77lC8.cjs +1 -0
  62. package/dist/Tag-bs5j40pF.js +66 -0
  63. package/dist/Tip-BFZSiRc1.js +166 -0
  64. package/dist/Tip-C3brAF9N.cjs +1 -0
  65. package/dist/action-sheet-DKpi2GLQ.js +118 -0
  66. package/dist/action-sheet-LJilF3EQ.cjs +1 -0
  67. package/dist/action-sheet.cjs +1 -0
  68. package/dist/action-sheet.d.ts +2 -0
  69. package/dist/action-sheet.js +2 -0
  70. package/dist/activity-indicator.cjs +1 -0
  71. package/dist/activity-indicator.d.ts +1 -0
  72. package/dist/activity-indicator.js +3 -0
  73. package/dist/agree.cjs +1 -0
  74. package/dist/agree.d.ts +1 -0
  75. package/dist/agree.js +2 -0
  76. package/dist/amount.cjs +1 -0
  77. package/dist/amount.d.ts +1 -0
  78. package/dist/amount.js +2 -0
  79. package/dist/button.cjs +1 -0
  80. package/dist/button.d.ts +1 -0
  81. package/dist/button.js +2 -0
  82. package/dist/cell-item.cjs +1 -0
  83. package/dist/cell-item.d.ts +1 -0
  84. package/dist/cell-item.js +2 -0
  85. package/dist/check-base.cjs +1 -0
  86. package/dist/check-base.d.ts +1 -0
  87. package/dist/check-base.js +2 -0
  88. package/dist/check.cjs +1 -0
  89. package/dist/check.d.ts +1 -0
  90. package/dist/check.js +2 -0
  91. package/dist/codebox.cjs +1 -0
  92. package/dist/codebox.d.ts +1 -0
  93. package/dist/codebox.js +2 -0
  94. package/dist/components/action-bar/ActionBar.vue.d.ts +34 -0
  95. package/dist/components/action-bar/index.d.ts +2 -0
  96. package/dist/components/action-sheet/ActionSheet.vue.d.ts +44 -0
  97. package/dist/components/action-sheet/index.d.ts +25 -0
  98. package/dist/components/activity-indicator/ActivityIndicator.vue.d.ts +31 -0
  99. package/dist/components/activity-indicator/Carousel.vue.d.ts +10 -0
  100. package/dist/components/activity-indicator/CarouselCircle.vue.d.ts +12 -0
  101. package/dist/components/activity-indicator/Roller.vue.d.ts +37 -0
  102. package/dist/components/activity-indicator/RollerSuccess.vue.d.ts +14 -0
  103. package/dist/components/activity-indicator/Spinning.vue.d.ts +10 -0
  104. package/dist/components/activity-indicator/index.d.ts +5 -0
  105. package/dist/components/agree/Agree.vue.d.ts +35 -0
  106. package/dist/components/agree/index.d.ts +1 -0
  107. package/dist/components/amount/Amount.vue.d.ts +25 -0
  108. package/dist/components/amount/index.d.ts +1 -0
  109. package/dist/components/bill/Bill.vue.d.ts +33 -0
  110. package/dist/components/bill/index.d.ts +1 -0
  111. package/dist/components/button/Button.vue.d.ts +38 -0
  112. package/dist/components/button/index.d.ts +1 -0
  113. package/dist/components/captcha/Captcha.vue.d.ts +76 -0
  114. package/dist/components/captcha/index.d.ts +1 -0
  115. package/dist/components/cashier/Cashier.vue.d.ts +101 -0
  116. package/dist/components/cashier/CashierChannel.vue.d.ts +54 -0
  117. package/dist/components/cashier/CashierChannelButton.vue.d.ts +14 -0
  118. package/dist/components/cashier/CashierChannelItem.vue.d.ts +30 -0
  119. package/dist/components/cashier/index.d.ts +4 -0
  120. package/dist/components/cell-item/CellItem.vue.d.ts +38 -0
  121. package/dist/components/cell-item/index.d.ts +1 -0
  122. package/dist/components/chart/Chart.vue.d.ts +30 -0
  123. package/dist/components/chart/index.d.ts +2 -0
  124. package/dist/components/check/Check.vue.d.ts +38 -0
  125. package/dist/components/check/CheckBox.vue.d.ts +31 -0
  126. package/dist/components/check/CheckGroup.vue.d.ts +27 -0
  127. package/dist/components/check/CheckList.vue.d.ts +58 -0
  128. package/dist/components/check/index.d.ts +6 -0
  129. package/dist/components/check/shared.d.ts +52 -0
  130. package/dist/components/check-base/CheckBoxBase.vue.d.ts +25 -0
  131. package/dist/components/check-base/index.d.ts +1 -0
  132. package/dist/components/codebox/Codebox.vue.d.ts +58 -0
  133. package/dist/components/codebox/index.d.ts +1 -0
  134. package/dist/components/date-picker/DatePicker.vue.d.ts +70 -0
  135. package/dist/components/date-picker/index.d.ts +1 -0
  136. package/dist/components/detail-item/DetailItem.vue.d.ts +22 -0
  137. package/dist/components/detail-item/index.d.ts +1 -0
  138. package/dist/components/dialog/Dialog.vue.d.ts +78 -0
  139. package/dist/components/dialog/index.d.ts +40 -0
  140. package/dist/components/drop-menu/DropMenu.vue.d.ts +55 -0
  141. package/dist/components/drop-menu/index.d.ts +1 -0
  142. package/dist/components/field/Field.vue.d.ts +30 -0
  143. package/dist/components/field/index.d.ts +1 -0
  144. package/dist/components/field-item/FieldItem.vue.d.ts +42 -0
  145. package/dist/components/field-item/index.d.ts +1 -0
  146. package/dist/components/icon/Icon.vue.d.ts +20 -0
  147. package/dist/components/icon/default-svg-list.d.ts +2 -0
  148. package/dist/components/icon/index.d.ts +1 -0
  149. package/dist/components/icon/load-sprite.d.ts +6 -0
  150. package/dist/components/image-reader/ImageReader.vue.d.ts +46 -0
  151. package/dist/components/image-reader/index.d.ts +1 -0
  152. package/dist/components/image-viewer/ImageViewer.vue.d.ts +25 -0
  153. package/dist/components/image-viewer/index.d.ts +1 -0
  154. package/dist/components/index.d.ts +3 -0
  155. package/dist/components/input-item/InputItem.vue.d.ts +97 -0
  156. package/dist/components/input-item/cursor.d.ts +7 -0
  157. package/dist/components/input-item/index.d.ts +1 -0
  158. package/dist/components/landscape/Landscape.vue.d.ts +38 -0
  159. package/dist/components/landscape/index.d.ts +1 -0
  160. package/dist/components/license-plate/LicensePlate.vue.d.ts +32 -0
  161. package/dist/components/license-plate/LicensePlateInput.vue.d.ts +14 -0
  162. package/dist/components/license-plate/LicensePlateKeyboard.vue.d.ts +30 -0
  163. package/dist/components/license-plate/index.d.ts +3 -0
  164. package/dist/components/notice-bar/NoticeBar.vue.d.ts +44 -0
  165. package/dist/components/notice-bar/index.d.ts +1 -0
  166. package/dist/components/number-keyboard/KeyboardBoard.vue.d.ts +33 -0
  167. package/dist/components/number-keyboard/KeyboardKey.vue.d.ts +16 -0
  168. package/dist/components/number-keyboard/NumberKeyboard.vue.d.ts +59 -0
  169. package/dist/components/number-keyboard/index.d.ts +3 -0
  170. package/dist/components/picker/Picker.vue.d.ts +64 -0
  171. package/dist/components/picker/PickerColumn.vue.d.ts +64 -0
  172. package/dist/components/picker/index.d.ts +3 -0
  173. package/dist/components/popup/Popup.vue.d.ts +50 -0
  174. package/dist/components/popup/PopupTitleBar.vue.d.ts +41 -0
  175. package/dist/components/popup/index.d.ts +2 -0
  176. package/dist/components/progress/Progress.vue.d.ts +39 -0
  177. package/dist/components/progress/index.d.ts +1 -0
  178. package/dist/components/radio/Radio.vue.d.ts +39 -0
  179. package/dist/components/radio/RadioBox.vue.d.ts +31 -0
  180. package/dist/components/radio/RadioGroup.vue.d.ts +24 -0
  181. package/dist/components/radio/index.d.ts +3 -0
  182. package/dist/components/radio-list/RadioList.vue.d.ts +72 -0
  183. package/dist/components/radio-list/index.d.ts +2 -0
  184. package/dist/components/result-page/ResultPage.vue.d.ts +28 -0
  185. package/dist/components/result-page/index.d.ts +1 -0
  186. package/dist/components/ruler/Ruler.vue.d.ts +34 -0
  187. package/dist/components/ruler/index.d.ts +1 -0
  188. package/dist/components/scroll-view/ScrollView.vue.d.ts +84 -0
  189. package/dist/components/scroll-view/ScrollViewMore.vue.d.ts +12 -0
  190. package/dist/components/scroll-view/ScrollViewRefresh.vue.d.ts +20 -0
  191. package/dist/components/scroll-view/index.d.ts +3 -0
  192. package/dist/components/selector/Selector.vue.d.ts +88 -0
  193. package/dist/components/selector/index.d.ts +2 -0
  194. package/dist/components/skeleton/Skeleton.vue.d.ts +30 -0
  195. package/dist/components/skeleton/index.d.ts +1 -0
  196. package/dist/components/slider/Slider.vue.d.ts +24 -0
  197. package/dist/components/slider/index.d.ts +1 -0
  198. package/dist/components/stepper/Stepper.vue.d.ts +32 -0
  199. package/dist/components/stepper/index.d.ts +1 -0
  200. package/dist/components/steps/Steps.vue.d.ts +56 -0
  201. package/dist/components/steps/index.d.ts +2 -0
  202. package/dist/components/swiper/Swiper.vue.d.ts +57 -0
  203. package/dist/components/swiper/SwiperItem.vue.d.ts +26 -0
  204. package/dist/components/swiper/index.d.ts +2 -0
  205. package/dist/components/switch/Switch.vue.d.ts +16 -0
  206. package/dist/components/switch/index.d.ts +1 -0
  207. package/dist/components/tab-picker/TabPicker.vue.d.ts +78 -0
  208. package/dist/components/tab-picker/index.d.ts +1 -0
  209. package/dist/components/tabs/TabBar.vue.d.ts +50 -0
  210. package/dist/components/tabs/TabPane.vue.d.ts +31 -0
  211. package/dist/components/tabs/Tabs.vue.d.ts +34 -0
  212. package/dist/components/tabs/index.d.ts +3 -0
  213. package/dist/components/tag/Tag.vue.d.ts +39 -0
  214. package/dist/components/tag/index.d.ts +1 -0
  215. package/dist/components/textarea-item/TextareaItem.vue.d.ts +80 -0
  216. package/dist/components/textarea-item/index.d.ts +1 -0
  217. package/dist/components/tip/Tip.vue.d.ts +98 -0
  218. package/dist/components/tip/TipContent.vue.d.ts +33 -0
  219. package/dist/components/tip/index.d.ts +2 -0
  220. package/dist/components/toast/Toast.vue.d.ts +45 -0
  221. package/dist/components/toast/index.d.ts +129 -0
  222. package/dist/components/transition/Transition.vue.d.ts +13 -0
  223. package/dist/components/transition/index.d.ts +1 -0
  224. package/dist/components/water-mark/WaterMark.vue.d.ts +35 -0
  225. package/dist/components/water-mark/index.d.ts +1 -0
  226. package/dist/date-picker.cjs +1 -0
  227. package/dist/date-picker.d.ts +1 -0
  228. package/dist/date-picker.js +2 -0
  229. package/dist/dialog-0-E4Vyc-.cjs +1 -0
  230. package/dist/dialog-DHIZ2SMK.js +227 -0
  231. package/dist/dialog.cjs +1 -0
  232. package/dist/dialog.d.ts +2 -0
  233. package/dist/dialog.js +2 -0
  234. package/dist/field-item.cjs +1 -0
  235. package/dist/field-item.d.ts +1 -0
  236. package/dist/field-item.js +2 -0
  237. package/dist/field.cjs +1 -0
  238. package/dist/field.d.ts +1 -0
  239. package/dist/field.js +2 -0
  240. package/dist/icon.cjs +1 -0
  241. package/dist/icon.d.ts +1 -0
  242. package/dist/icon.js +2 -0
  243. package/dist/index.cjs +1 -0
  244. package/dist/index.d.ts +63 -0
  245. package/dist/index.js +2669 -0
  246. package/dist/input-item.cjs +1 -0
  247. package/dist/input-item.d.ts +1 -0
  248. package/dist/input-item.js +2 -0
  249. package/dist/notice-bar.cjs +1 -0
  250. package/dist/notice-bar.d.ts +1 -0
  251. package/dist/notice-bar.js +2 -0
  252. package/dist/number-keyboard.cjs +1 -0
  253. package/dist/number-keyboard.d.ts +1 -0
  254. package/dist/number-keyboard.js +2 -0
  255. package/dist/picker.cjs +1 -0
  256. package/dist/picker.d.ts +1 -0
  257. package/dist/picker.js +2 -0
  258. package/dist/popup.cjs +1 -0
  259. package/dist/popup.d.ts +1 -0
  260. package/dist/popup.js +3 -0
  261. package/dist/progress.cjs +1 -0
  262. package/dist/progress.d.ts +1 -0
  263. package/dist/progress.js +2 -0
  264. package/dist/radio-list.cjs +1 -0
  265. package/dist/radio-list.d.ts +1 -0
  266. package/dist/radio-list.js +2 -0
  267. package/dist/radio.cjs +1 -0
  268. package/dist/radio.d.ts +1 -0
  269. package/dist/radio.js +3 -0
  270. package/dist/scroll-view.cjs +1 -0
  271. package/dist/scroll-view.d.ts +1 -0
  272. package/dist/scroll-view.js +2 -0
  273. package/dist/shared-BtSkmaWC.js +37 -0
  274. package/dist/shared-k9cbQbvK.cjs +1 -0
  275. package/dist/skeleton.cjs +1 -0
  276. package/dist/skeleton.d.ts +1 -0
  277. package/dist/skeleton.js +2 -0
  278. package/dist/slider.cjs +1 -0
  279. package/dist/slider.d.ts +1 -0
  280. package/dist/slider.js +2 -0
  281. package/dist/stepper.cjs +1 -0
  282. package/dist/stepper.d.ts +1 -0
  283. package/dist/stepper.js +2 -0
  284. package/dist/swiper.cjs +1 -0
  285. package/dist/swiper.d.ts +1 -0
  286. package/dist/swiper.js +2 -0
  287. package/dist/switch.cjs +1 -0
  288. package/dist/switch.d.ts +1 -0
  289. package/dist/switch.js +2 -0
  290. package/dist/tag.cjs +1 -0
  291. package/dist/tag.d.ts +1 -0
  292. package/dist/tag.js +2 -0
  293. package/dist/tip.cjs +1 -0
  294. package/dist/tip.d.ts +1 -0
  295. package/dist/tip.js +2 -0
  296. package/dist/toast-CAeyMc5r.cjs +1 -0
  297. package/dist/toast-DX-RoB7Q.js +146 -0
  298. package/dist/toast.cjs +1 -0
  299. package/dist/toast.d.ts +2 -0
  300. package/dist/toast.js +2 -0
  301. package/package.json +195 -3
@@ -0,0 +1,127 @@
1
+ import { computed as e, createElementBlock as t, createElementVNode as n, defineComponent as r, normalizeClass as i, onMounted as a, openBlock as o, ref as s, watch as c } from "vue";
2
+ import { warn as l } from "@centui/core";
3
+ //#region src/components/stepper/Stepper.vue?vue&type=script&setup=true&lang.ts
4
+ var u = { class: "cu-stepper-number" }, d = [
5
+ "type",
6
+ "size",
7
+ "value",
8
+ "readonly"
9
+ ], f = /* @__PURE__ */ r({
10
+ name: "cu-stepper",
11
+ __name: "Stepper",
12
+ props: {
13
+ defaultValue: { default: 0 },
14
+ modelValue: { default: 0 },
15
+ step: { default: 1 },
16
+ min: { default: -Number.MAX_VALUE },
17
+ max: { default: Number.MAX_VALUE },
18
+ disabled: {
19
+ type: Boolean,
20
+ default: !1
21
+ },
22
+ readOnly: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ isInteger: {
27
+ type: Boolean,
28
+ default: !1
29
+ }
30
+ },
31
+ emits: [
32
+ "update:modelValue",
33
+ "change",
34
+ "increase",
35
+ "decrease"
36
+ ],
37
+ setup(r, { emit: f }) {
38
+ let p = r, m = f;
39
+ function h(e) {
40
+ try {
41
+ return e.toString().split(".")[1].length;
42
+ } catch {
43
+ return 0;
44
+ }
45
+ }
46
+ function g(e, t) {
47
+ let n = Number(e), r = Number(t), i = h(e), a = h(t), o = 10 ** Math.max(i, a);
48
+ return +((n * o + r * o) / o);
49
+ }
50
+ function _(e, t) {
51
+ let n = Number(e), r = Number(t), i = h(e), a = h(t), o = 10 ** Math.max(i, a), s = i >= a ? i : a;
52
+ return +((n * o - r * o) / o).toFixed(s);
53
+ }
54
+ let v = s(!1), y = s(!1), b = s(!1), x = s(0), S = e(() => {
55
+ if (!p.modelValue) return 2;
56
+ let e = p.modelValue.toString().length;
57
+ return e > 2 ? e : 2;
58
+ });
59
+ c(() => p.defaultValue, (e) => {
60
+ x.value = E(e);
61
+ }), c(() => p.modelValue, (e) => {
62
+ b.value || (x.value = E(e));
63
+ }), c(() => p.min, (e) => {
64
+ let t = Number(e);
65
+ x.value < t && (x.value = t), D();
66
+ }), c(() => p.max, (e) => {
67
+ let t = Number(e);
68
+ x.value > t && (x.value = t), D();
69
+ }), c(x, (e, t) => {
70
+ D(), e !== p.modelValue && (m("update:modelValue", e), m("change", e));
71
+ let n = e - t;
72
+ n > 0 ? m("increase", n) : n < 0 && m("decrease", Math.abs(n));
73
+ }), a(() => {
74
+ O(), x.value = E(p.modelValue || p.defaultValue), D();
75
+ });
76
+ function C() {
77
+ p.disabled || v.value || (x.value = _(x.value, p.step), j());
78
+ }
79
+ function w() {
80
+ p.disabled || y.value || (x.value = g(x.value, p.step), j());
81
+ }
82
+ function T(e) {
83
+ let t = String(e).replace(/[^0-9.-]|^-|^\./g, "");
84
+ return t === "" ? 0 : p.isInteger ? Math.floor(Number(t)) : +t;
85
+ }
86
+ function E(e) {
87
+ return Math.max(Math.min(Number(p.max), T(e)), Number(p.min));
88
+ }
89
+ function D() {
90
+ v.value = x.value <= Number(p.min), y.value = x.value >= Number(p.max);
91
+ }
92
+ function O() {
93
+ return Number(p.min) > Number(p.max) && l("[cu-vue-stepper] minNum is larger than maxNum"), Number(p.max) > Number(p.min);
94
+ }
95
+ function k(e) {
96
+ let t = e.target, { value: n } = t, r = T(n);
97
+ +n !== r && (t.value = String(r)), x.value = r;
98
+ }
99
+ function A() {
100
+ b.value = !0;
101
+ }
102
+ function j() {
103
+ b.value = !1, x.value = E(x.value);
104
+ }
105
+ return (e, a) => (o(), t("div", { class: i(["cu-stepper", { disabled: r.disabled }]) }, [
106
+ n("div", {
107
+ class: i(["cu-stepper-button cu-stepper-button-reduce", { disabled: v.value }]),
108
+ onClick: C
109
+ }, null, 2),
110
+ n("div", u, [n("input", {
111
+ type: r.isInteger ? "tel" : "number",
112
+ size: S.value,
113
+ value: x.value,
114
+ readonly: r.readOnly,
115
+ onInput: k,
116
+ onFocus: A,
117
+ onBlur: j
118
+ }, null, 40, d)]),
119
+ n("div", {
120
+ class: i(["cu-stepper-button cu-stepper-button-add", { disabled: y.value }]),
121
+ onClick: w
122
+ }, null, 2)
123
+ ], 2));
124
+ }
125
+ });
126
+ //#endregion
127
+ export { f as t };
@@ -0,0 +1 @@
1
+ let e=require("vue"),t=require("@centui/core");var n={class:`cu-stepper-number`},r=[`type`,`size`,`value`,`readonly`],i=(0,e.defineComponent)({name:`cu-stepper`,__name:`Stepper`,props:{defaultValue:{default:0},modelValue:{default:0},step:{default:1},min:{default:-Number.MAX_VALUE},max:{default:Number.MAX_VALUE},disabled:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},isInteger:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`,`increase`,`decrease`],setup(i,{emit:a}){let o=i,s=a;function c(e){try{return e.toString().split(`.`)[1].length}catch{return 0}}function l(e,t){let n=Number(e),r=Number(t),i=c(e),a=c(t),o=10**Math.max(i,a);return+((n*o+r*o)/o)}function u(e,t){let n=Number(e),r=Number(t),i=c(e),a=c(t),o=10**Math.max(i,a),s=i>=a?i:a;return+((n*o-r*o)/o).toFixed(s)}let d=(0,e.ref)(!1),f=(0,e.ref)(!1),p=(0,e.ref)(!1),m=(0,e.ref)(0),h=(0,e.computed)(()=>{if(!o.modelValue)return 2;let e=o.modelValue.toString().length;return e>2?e:2});(0,e.watch)(()=>o.defaultValue,e=>{m.value=y(e)}),(0,e.watch)(()=>o.modelValue,e=>{p.value||(m.value=y(e))}),(0,e.watch)(()=>o.min,e=>{let t=Number(e);m.value<t&&(m.value=t),b()}),(0,e.watch)(()=>o.max,e=>{let t=Number(e);m.value>t&&(m.value=t),b()}),(0,e.watch)(m,(e,t)=>{b(),e!==o.modelValue&&(s(`update:modelValue`,e),s(`change`,e));let n=e-t;n>0?s(`increase`,n):n<0&&s(`decrease`,Math.abs(n))}),(0,e.onMounted)(()=>{x(),m.value=y(o.modelValue||o.defaultValue),b()});function g(){o.disabled||d.value||(m.value=u(m.value,o.step),w())}function _(){o.disabled||f.value||(m.value=l(m.value,o.step),w())}function v(e){let t=String(e).replace(/[^0-9.-]|^-|^\./g,``);return t===``?0:o.isInteger?Math.floor(Number(t)):+t}function y(e){return Math.max(Math.min(Number(o.max),v(e)),Number(o.min))}function b(){d.value=m.value<=Number(o.min),f.value=m.value>=Number(o.max)}function x(){return Number(o.min)>Number(o.max)&&(0,t.warn)(`[cu-vue-stepper] minNum is larger than maxNum`),Number(o.max)>Number(o.min)}function S(e){let t=e.target,{value:n}=t,r=v(n);+n!==r&&(t.value=String(r)),m.value=r}function C(){p.value=!0}function w(){p.value=!1,m.value=y(m.value)}return(t,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`cu-stepper`,{disabled:i.disabled}])},[(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`cu-stepper-button cu-stepper-button-reduce`,{disabled:d.value}]),onClick:g},null,2),(0,e.createElementVNode)(`div`,n,[(0,e.createElementVNode)(`input`,{type:i.isInteger?`tel`:`number`,size:h.value,value:m.value,readonly:i.readOnly,onInput:S,onFocus:C,onBlur:w},null,40,r)]),(0,e.createElementVNode)(`div`,{class:(0,e.normalizeClass)([`cu-stepper-button cu-stepper-button-add`,{disabled:f.value}]),onClick:_},null,2)],2))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
@@ -0,0 +1 @@
1
+ let e=require("vue"),t=require("@centui/core"),n=require("@centui/core/web");var r=.5,i=300,a=(0,e.defineComponent)({name:`cu-swiper`,__name:`Swiper`,props:{autoplay:{default:3e3},transition:{default:`slide`},transitionDuration:{default:250},defaultIndex:{default:0},hasDots:{type:Boolean,default:!0},isPrevent:{type:Boolean,default:!0},isLoop:{type:Boolean,default:!0},dragable:{type:Boolean,default:!0},useNativeDriver:{type:Boolean,default:!0}},emits:[`beforeChange`,`after-change`],setup(a,{expose:o,emit:s}){let c=typeof process<`u`&&process.env.MAND_ENV===`test`,l=a,u=s,d=(0,e.useSlots)(),f=(0,e.ref)(),p=(0,e.ref)(),m=(0,e.ref)(),h=(0,e.ref)(!1),g=(0,e.ref)(!1),_=(0,e.ref)(!1),v=(0,e.ref)(0),y=(0,e.ref)(0),b=(0,e.ref)(0),x=(0,e.ref)(0),S=(0,e.ref)(0),C=(0,e.ref)(0),w=(0,e.ref)(0),T=(0,e.ref)(0),E=(0,e.ref)(0),D=(0,e.ref)(!1),O=(0,e.ref)(!0),k=(0,e.ref)(null),A=(0,e.ref)(!1),j={},M=null,N=null,P=null,F=null,I=[];function ee(e){I.push(e),h.value&&L()}function te(e){let t=I.indexOf(e);t>=0&&I.splice(t,1),h.value&&L()}let L=(0,t.debounce)(()=>{(0,e.nextTick)(()=>{Y(),J(),O.value||$(v.value)})},50);(0,e.provide)(`mdSwiper`,{dimension:()=>E.value,isVertical:()=>z.value,register:ee,unregister:te}),(0,e.watch)(()=>l.autoplay,e=>{v.value=e},{immediate:!0});let ne=(0,e.computed)(()=>y.value===T.value-1),re=(0,e.computed)(()=>y.value===0),ie=(0,e.computed)(()=>Se()),R=(0,e.computed)(()=>l.transition.toLowerCase().includes(`slide`)),z=(0,e.computed)(()=>l.transition===`slideY`),ae=(0,e.computed)(()=>{let t=(d.default?.()??[]).filter(e=>e.type!==Symbol.for(`v-cmt`));return!B.value||t.length<2?null:(0,e.cloneVNode)(t[0],{class:`cu-swiper-item-first-copy`,style:H.value,isCopy:!0})}),oe=(0,e.computed)(()=>{let t=(d.default?.()??[]).filter(e=>e.type!==Symbol.for(`v-cmt`));return!B.value||t.length<2?null:(0,e.cloneVNode)(t[t.length-1],{class:`cu-swiper-item-last-copy`,style:H.value,isCopy:!0})}),B=(0,e.computed)(()=>R.value&&_.value),V=e=>e.vnode;V.props=[`vnode`];let H=(0,e.computed)(()=>z.value?{height:`${E.value}px`}:{width:`${E.value}px`});(0,e.onMounted)(()=>{W()}),(0,e.onActivated)(()=>{W()}),(0,e.onDeactivated)(()=>{G()}),(0,e.onBeforeUnmount)(()=>{G()});function U(){F&&clearTimeout(F);let e=y.value;F=setTimeout(()=>{J(e)},300)}function W(){h.value=!0,(0,e.nextTick)(()=>{J(),$(v.value),window.addEventListener(`resize`,U)})}function G(){h.value=!1,Y(),window.removeEventListener(`resize`,U),F&&clearTimeout(F)}function se(){E.value=z.value?f.value?.clientHeight??0:f.value?.clientWidth??0}function ce(){let e=new n.Scroller((e,t)=>{(0,n.render)(m.value,e,t,1,l.useNativeDriver)},{scrollingY:z.value,scrollingX:!z.value,snapping:!1,bouncing:!1,animationDuration:l.transitionDuration,scrollingComplete:()=>{P&&P()}}),t=p.value;if(!t)return;let r=z.value?t.clientWidth:t.clientWidth*T.value,i=z.value?t.clientHeight*T.value:t.clientHeight;e.setPosition(t.clientLeft,t.clientTop),e.setDimensions(t.clientWidth,t.clientHeight,r,i),k.value=e}function le(){I.length>1&&l.isLoop&&(S.value++,C.value++,y.value++,A.value=!0)}function K(e,n,r=!0){if(!e){(0,t.warn)(`[cu-swiper] no element for translate`);return}let i=z.value?0:-n,a=z.value?-n:0;k.value?.scrollTo(i,a,r)}function q(e=!0,t){let n=I;if(!n||!n.length)return;if(t!==void 0){let r=0,i=x.value,a=T.value;t>0?i>0?r=i-1:i===0&&(r=a-1):i<a-1?r=i+1:i===a-1&&(r=0);let o=n[i]?.$el,s=n[r]?.$el;if(!o||!s)return;o.style.opacity=String(1-Math.abs(t)),o.style.transition=e?`opacity 300ms ease`:``,s.style.opacity=String(Math.abs(t));return}let r=n[b.value]?.$el,i=n[x.value]?.$el;r&&i&&(r.style.opacity=`0`,r.style.transition=e?`opacity 500ms ease`:``,i.style.opacity=`1`,e&&setTimeout(()=>{u(`after-change`,b.value,x.value)},500))}function ue(e,t){w.value=e,T.value=e+(l.isLoop&&R.value&&e>1?2:0),A.value=!1,D.value=e===1||!l.dragable,y.value=t===void 0?l.defaultIndex>=0&&l.defaultIndex<e?parseInt(String(l.defaultIndex)):0:X(t),S.value=0,C.value=e-1,b.value=y.value===S.value?C.value:y.value===C.value?S.value:y.value+1,x.value=y.value}function J(e){let t=I.length;t&&(se(),ue(t,e),R.value?(le(),ce(),K(m.value,-E.value*y.value,!1)):q(!1),_.value=!0)}function de(){v.value>0&&w.value>1&&(Y(),N=setInterval(()=>{if(!l.isLoop&&y.value>=T.value-1)return Y();g.value||ye()},v.value))}function Y(){N&&=(clearInterval(N),null)}function fe(e,t){let n=z.value,{currentLeft:r,currentTop:i,startLeft:a,startTop:o}=j;if(M===null){if(!n&&i===o||n&&r===a)return!1;if(e*e+t*t>=25){let r=Math.atan2(Math.abs(t),Math.abs(e))*180/Math.PI;return n?90-r>45:r>45}return!1}return M}function X(e){return l.isLoop&&R.value&&w.value>0?e-1<0?w.value-1:e-1>w.value-1?0:e-1:e}function pe(e){return e<0?e=0:w.value>0&&e>w.value-1&&(e=w.value-1),l.isLoop&&R.value?e+1:e}function Z(e,t){if(w.value===0||!t&&w.value<2)return;let n=y.value,r=T.value,i=y.value;if(e){if(t&&t.index!==void 0?y.value=t.index:e===`prev`?n>0?y.value=n-1:(!R.value&&n===0||l.isLoop&&n===0)&&(y.value=r-1):e===`next`&&(n<r-1?y.value=n+1:!R.value&&n===r-1?y.value=0:l.isLoop&&n===r-1&&(y.value=1)),l.isLoop&&R.value?(b.value=X(i),x.value=X(y.value)):(b.value=x.value,x.value=y.value),u(`beforeChange`,b.value,x.value),!R.value){q();return}setTimeout(()=>{let e=re.value&&l.isLoop,t=ne.value&&l.isLoop;P=()=>{if(t){let e=z.value?0:S.value*E.value,t=z.value?S.value*E.value:0;k.value?.scrollTo(e,t,!1)}if(e){let e=z.value?0:C.value*E.value,t=z.value?C.value*E.value:0;k.value?.scrollTo(e,t,!1)}u(`after-change`,b.value,x.value),P=null},K(m.value,-E.value*y.value),e?y.value=C.value:t&&(y.value=S.value)},10)}}function me(e){if(D.value)return;Ce();let t=e,n=t.changedTouches?.[0]??t.touches?.[0]??t.targetTouches?.[0]??t;j={},j.startTime=new Date,j.startLeft=n.pageX,j.startTop=n.pageY,j.itemWidth=c?100:f.value?.offsetWidth??0,j.itemHeight=c?100:f.value?.offsetHeight??0}function he(e){if(D.value)return;let t=e,n=t.changedTouches?.[0]??t.touches?.[0]??t.targetTouches?.[0]??t;j.currentLeft=n.pageX,j.currentTop=n.pageY;let r=Number(j.currentLeft)-Number(j.startLeft),i=Number(j.currentTop)-Number(j.startTop);if(M=fe(Math.abs(r),Math.abs(i)),M)return;e.preventDefault();let a=Number(j.itemWidth),o=Number(j.itemHeight),s=Math.min(Math.max(-a+1,r),a-1),c=Math.min(Math.max(-o+1,i),o-1),l=z.value?c-o*y.value:s-a*y.value;R.value?K(m.value,l,!1):q(!1,r/a)}function ge(){if(D.value)return;let e=Number(new Date)-Number(j.startTime),t=Number(j.currentLeft)-Number(j.startLeft),n=Number(j.currentTop)-Number(j.startTop),a=Number(j.itemWidth),o=Number(j.itemHeight),s=y.value,c=T.value,u=e<i,d=null;if(u&&j.currentLeft===void 0){$(v.value);return}z.value?Math.abs(n)>o*r||u?d=n<0?`next`:`prev`:K(m.value,-E.value*s,!0):Math.abs(t)>a*r||u?d=t<0?`next`:`prev`:R.value?K(m.value,-E.value*s,!0):q(!0,0),l.isLoop||(s===0&&d===`prev`||s===c-1&&d===`next`)&&(d=null),Z(d),j={},$(v.value)}function _e(e){P&&P(),l.isPrevent&&e.preventDefault(),g.value=!0,M=null,me(e)}function ve(e){l.isPrevent&&e.preventDefault(),g.value&&he(e)}function Q(e){if(l.isPrevent&&e.preventDefault(),M){$(v.value),g.value=!1,j={};return}g.value&&=(ge(),!1)}function ye(){Z(`next`)}function be(){Z(`prev`)}function xe(e){if(isNaN(e))return;e=parseInt(String(e));let t=pe(e);Z(t>y.value?`next`:`prev`,{index:t}),$(v.value)}function Se(){return X(y.value)}function $(e=3e3){Y(),!(e<500)&&(v.value=e||l.autoplay,de(),O.value=!1)}function Ce(){Y(),O.value=!0}return o({next:ye,prev:be,goto:xe,getIndex:Se,play:$,stop:Ce,index:y,rItemCount:T,oItemCount:w}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{ref_key:`root`,ref:f,class:(0,e.normalizeClass)([`cu-swiper`,{"cu-swiper-vertical":z.value,"cu-swiper-fade":!R.value,disabled:!_.value}]),onMousedown:_e,onMousemove:ve,onMouseup:Q,onMouseleave:Q,onTouchstart:_e,onTouchmove:ve,onTouchend:Q,onTouchcancel:Q},[(0,e.createElementVNode)(`div`,{ref_key:`swiperBox`,ref:p,class:`cu-swiper-box`},[(0,e.createElementVNode)(`div`,{ref_key:`swiper`,ref:m,class:`cu-swiper-container`},[B.value&&t.$slots.default?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:0},[oe.value?((0,e.openBlock)(),(0,e.createBlock)(V,{key:0,vnode:oe.value},null,8,[`vnode`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`default`),B.value&&t.$slots.default?((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,{key:1},[ae.value?((0,e.openBlock)(),(0,e.createBlock)(V,{key:0,vnode:ae.value},null,8,[`vnode`])):(0,e.createCommentVNode)(``,!0)],64)):(0,e.createCommentVNode)(``,!0)],512)],512),w.value>1&&a.hasDots?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)([`cu-swiper-indicators`,{disabled:!a.hasDots}])},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(w.value,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:t,class:(0,e.normalizeClass)([`cu-swiper-indicator`,{"cu-swiper-indicator-active":t-1===ie.value}])},null,2))),128))],2)):(0,e.createCommentVNode)(``,!0)],34))}}),o=(0,e.defineComponent)({name:`cu-swiper-item`,__name:`SwiperItem`,props:{isCopy:{type:Boolean,default:!1}},setup(t){let n=t,r=(0,e.inject)(`mdSwiper`,null),i=(0,e.computed)(()=>!r||r.isVertical()?`auto`:`${r.dimension()}px`),a=(0,e.computed)(()=>!r||!r.isVertical()?`auto`:`${r.dimension()}px`),o=(0,e.getCurrentInstance)()?.proxy;return(0,e.onMounted)(()=>{n.isCopy||r&&o&&r.register(o)}),(0,e.onBeforeUnmount)(()=>{n.isCopy||r&&o&&r.unregister(o)}),(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:`cu-swiper-item`,style:(0,e.normalizeStyle)({width:i.value,height:a.value})},[(0,e.renderSlot)(t.$slots,`default`)],4))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -0,0 +1,337 @@
1
+ import { Fragment as e, cloneVNode as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, getCurrentInstance as c, inject as l, nextTick as ee, normalizeClass as u, normalizeStyle as d, onActivated as te, onBeforeUnmount as f, onDeactivated as ne, onMounted as p, openBlock as m, provide as re, ref as h, renderList as ie, renderSlot as ae, useSlots as oe, watch as se } from "vue";
2
+ import { debounce as ce, warn as le } from "@centui/core";
3
+ import { Scroller as ue, render as de } from "@centui/core/web";
4
+ //#region src/components/swiper/Swiper.vue?vue&type=script&setup=true&lang.ts
5
+ var fe = .5, pe = 300, g = /* @__PURE__ */ s({
6
+ name: "cu-swiper",
7
+ __name: "Swiper",
8
+ props: {
9
+ autoplay: { default: 3e3 },
10
+ transition: { default: "slide" },
11
+ transitionDuration: { default: 250 },
12
+ defaultIndex: { default: 0 },
13
+ hasDots: {
14
+ type: Boolean,
15
+ default: !0
16
+ },
17
+ isPrevent: {
18
+ type: Boolean,
19
+ default: !0
20
+ },
21
+ isLoop: {
22
+ type: Boolean,
23
+ default: !0
24
+ },
25
+ dragable: {
26
+ type: Boolean,
27
+ default: !0
28
+ },
29
+ useNativeDriver: {
30
+ type: Boolean,
31
+ default: !0
32
+ }
33
+ },
34
+ emits: ["beforeChange", "after-change"],
35
+ setup(s, { expose: c, emit: l }) {
36
+ let d = typeof process < "u" && process.env.MAND_ENV === "test", g = s, _ = l, me = oe(), v = h(), y = h(), b = h(), x = h(!1), S = h(!1), C = h(!1), w = h(0), T = h(0), E = h(0), D = h(0), O = h(0), k = h(0), A = h(0), j = h(0), M = h(0), N = h(!1), P = h(!0), F = h(null), he = h(!1), I = {}, L = null, R = null, z = null, B = null, V = [];
37
+ function ge(e) {
38
+ V.push(e), x.value && ve();
39
+ }
40
+ function _e(e) {
41
+ let t = V.indexOf(e);
42
+ t >= 0 && V.splice(t, 1), x.value && ve();
43
+ }
44
+ let ve = ce(() => {
45
+ ee(() => {
46
+ Y(), J(), P.value || $(w.value);
47
+ });
48
+ }, 50);
49
+ re("mdSwiper", {
50
+ dimension: () => M.value,
51
+ isVertical: () => U.value,
52
+ register: ge,
53
+ unregister: _e
54
+ }), se(() => g.autoplay, (e) => {
55
+ w.value = e;
56
+ }, { immediate: !0 });
57
+ let ye = n(() => T.value === j.value - 1), be = n(() => T.value === 0), xe = n(() => Ue()), H = n(() => g.transition.toLowerCase().includes("slide")), U = n(() => g.transition === "slideY"), Se = n(() => {
58
+ let e = (me.default?.() ?? []).filter((e) => e.type !== Symbol.for("v-cmt"));
59
+ return !W.value || e.length < 2 ? null : t(e[0], {
60
+ class: "cu-swiper-item-first-copy",
61
+ style: we.value,
62
+ isCopy: !0
63
+ });
64
+ }), Ce = n(() => {
65
+ let e = (me.default?.() ?? []).filter((e) => e.type !== Symbol.for("v-cmt"));
66
+ return !W.value || e.length < 2 ? null : t(e[e.length - 1], {
67
+ class: "cu-swiper-item-last-copy",
68
+ style: we.value,
69
+ isCopy: !0
70
+ });
71
+ }), W = n(() => H.value && C.value), G = (e) => e.vnode;
72
+ G.props = ["vnode"];
73
+ let we = n(() => U.value ? { height: `${M.value}px` } : { width: `${M.value}px` });
74
+ p(() => {
75
+ Ee();
76
+ }), te(() => {
77
+ Ee();
78
+ }), ne(() => {
79
+ De();
80
+ }), f(() => {
81
+ De();
82
+ });
83
+ function Te() {
84
+ B && clearTimeout(B);
85
+ let e = T.value;
86
+ B = setTimeout(() => {
87
+ J(e);
88
+ }, 300);
89
+ }
90
+ function Ee() {
91
+ x.value = !0, ee(() => {
92
+ J(), $(w.value), window.addEventListener("resize", Te);
93
+ });
94
+ }
95
+ function De() {
96
+ x.value = !1, Y(), window.removeEventListener("resize", Te), B && clearTimeout(B);
97
+ }
98
+ function Oe() {
99
+ M.value = U.value ? v.value?.clientHeight ?? 0 : v.value?.clientWidth ?? 0;
100
+ }
101
+ function ke() {
102
+ let e = new ue((e, t) => {
103
+ de(b.value, e, t, 1, g.useNativeDriver);
104
+ }, {
105
+ scrollingY: U.value,
106
+ scrollingX: !U.value,
107
+ snapping: !1,
108
+ bouncing: !1,
109
+ animationDuration: g.transitionDuration,
110
+ scrollingComplete: () => {
111
+ z && z();
112
+ }
113
+ }), t = y.value;
114
+ if (!t) return;
115
+ let n = U.value ? t.clientWidth : t.clientWidth * j.value, r = U.value ? t.clientHeight * j.value : t.clientHeight;
116
+ e.setPosition(t.clientLeft, t.clientTop), e.setDimensions(t.clientWidth, t.clientHeight, n, r), F.value = e;
117
+ }
118
+ function Ae() {
119
+ V.length > 1 && g.isLoop && (O.value++, k.value++, T.value++, he.value = !0);
120
+ }
121
+ function K(e, t, n = !0) {
122
+ if (!e) {
123
+ le("[cu-swiper] no element for translate");
124
+ return;
125
+ }
126
+ let r = U.value ? 0 : -t, i = U.value ? -t : 0;
127
+ F.value?.scrollTo(r, i, n);
128
+ }
129
+ function q(e = !0, t) {
130
+ let n = V;
131
+ if (!n || !n.length) return;
132
+ if (t !== void 0) {
133
+ let r = 0, i = D.value, a = j.value;
134
+ t > 0 ? i > 0 ? r = i - 1 : i === 0 && (r = a - 1) : i < a - 1 ? r = i + 1 : i === a - 1 && (r = 0);
135
+ let o = n[i]?.$el, s = n[r]?.$el;
136
+ if (!o || !s) return;
137
+ o.style.opacity = String(1 - Math.abs(t)), o.style.transition = e ? "opacity 300ms ease" : "", s.style.opacity = String(Math.abs(t));
138
+ return;
139
+ }
140
+ let r = n[E.value]?.$el, i = n[D.value]?.$el;
141
+ r && i && (r.style.opacity = "0", r.style.transition = e ? "opacity 500ms ease" : "", i.style.opacity = "1", e && setTimeout(() => {
142
+ _("after-change", E.value, D.value);
143
+ }, 500));
144
+ }
145
+ function je(e, t) {
146
+ A.value = e, j.value = e + (g.isLoop && H.value && e > 1 ? 2 : 0), he.value = !1, N.value = e === 1 || !g.dragable, T.value = t === void 0 ? g.defaultIndex >= 0 && g.defaultIndex < e ? parseInt(String(g.defaultIndex)) : 0 : X(t), O.value = 0, k.value = e - 1, E.value = T.value === O.value ? k.value : T.value === k.value ? O.value : T.value + 1, D.value = T.value;
147
+ }
148
+ function J(e) {
149
+ let t = V.length;
150
+ t && (Oe(), je(t, e), H.value ? (Ae(), ke(), K(b.value, -M.value * T.value, !1)) : q(!1), C.value = !0);
151
+ }
152
+ function Me() {
153
+ w.value > 0 && A.value > 1 && (Y(), R = setInterval(() => {
154
+ if (!g.isLoop && T.value >= j.value - 1) return Y();
155
+ S.value || Be();
156
+ }, w.value));
157
+ }
158
+ function Y() {
159
+ R &&= (clearInterval(R), null);
160
+ }
161
+ function Ne(e, t) {
162
+ let n = U.value, { currentLeft: r, currentTop: i, startLeft: a, startTop: o } = I;
163
+ if (L === null) {
164
+ if (!n && i === o || n && r === a) return !1;
165
+ if (e * e + t * t >= 25) {
166
+ let r = Math.atan2(Math.abs(t), Math.abs(e)) * 180 / Math.PI;
167
+ return n ? 90 - r > 45 : r > 45;
168
+ }
169
+ return !1;
170
+ }
171
+ return L;
172
+ }
173
+ function X(e) {
174
+ return g.isLoop && H.value && A.value > 0 ? e - 1 < 0 ? A.value - 1 : e - 1 > A.value - 1 ? 0 : e - 1 : e;
175
+ }
176
+ function Pe(e) {
177
+ return e < 0 ? e = 0 : A.value > 0 && e > A.value - 1 && (e = A.value - 1), g.isLoop && H.value ? e + 1 : e;
178
+ }
179
+ function Z(e, t) {
180
+ if (A.value === 0 || !t && A.value < 2) return;
181
+ let n = T.value, r = j.value, i = T.value;
182
+ if (e) {
183
+ if (t && t.index !== void 0 ? T.value = t.index : e === "prev" ? n > 0 ? T.value = n - 1 : (!H.value && n === 0 || g.isLoop && n === 0) && (T.value = r - 1) : e === "next" && (n < r - 1 ? T.value = n + 1 : !H.value && n === r - 1 ? T.value = 0 : g.isLoop && n === r - 1 && (T.value = 1)), g.isLoop && H.value ? (E.value = X(i), D.value = X(T.value)) : (E.value = D.value, D.value = T.value), _("beforeChange", E.value, D.value), !H.value) {
184
+ q();
185
+ return;
186
+ }
187
+ setTimeout(() => {
188
+ let e = be.value && g.isLoop, t = ye.value && g.isLoop;
189
+ z = () => {
190
+ if (t) {
191
+ let e = U.value ? 0 : O.value * M.value, t = U.value ? O.value * M.value : 0;
192
+ F.value?.scrollTo(e, t, !1);
193
+ }
194
+ if (e) {
195
+ let e = U.value ? 0 : k.value * M.value, t = U.value ? k.value * M.value : 0;
196
+ F.value?.scrollTo(e, t, !1);
197
+ }
198
+ _("after-change", E.value, D.value), z = null;
199
+ }, K(b.value, -M.value * T.value), e ? T.value = k.value : t && (T.value = O.value);
200
+ }, 10);
201
+ }
202
+ }
203
+ function Fe(e) {
204
+ if (N.value) return;
205
+ We();
206
+ let t = e, n = t.changedTouches?.[0] ?? t.touches?.[0] ?? t.targetTouches?.[0] ?? t;
207
+ I = {}, I.startTime = /* @__PURE__ */ new Date(), I.startLeft = n.pageX, I.startTop = n.pageY, I.itemWidth = d ? 100 : v.value?.offsetWidth ?? 0, I.itemHeight = d ? 100 : v.value?.offsetHeight ?? 0;
208
+ }
209
+ function Ie(e) {
210
+ if (N.value) return;
211
+ let t = e, n = t.changedTouches?.[0] ?? t.touches?.[0] ?? t.targetTouches?.[0] ?? t;
212
+ I.currentLeft = n.pageX, I.currentTop = n.pageY;
213
+ let r = Number(I.currentLeft) - Number(I.startLeft), i = Number(I.currentTop) - Number(I.startTop);
214
+ if (L = Ne(Math.abs(r), Math.abs(i)), L) return;
215
+ e.preventDefault();
216
+ let a = Number(I.itemWidth), o = Number(I.itemHeight), s = Math.min(Math.max(-a + 1, r), a - 1), c = Math.min(Math.max(-o + 1, i), o - 1), l = U.value ? c - o * T.value : s - a * T.value;
217
+ H.value ? K(b.value, l, !1) : q(!1, r / a);
218
+ }
219
+ function Le() {
220
+ if (N.value) return;
221
+ let e = Number(/* @__PURE__ */ new Date()) - Number(I.startTime), t = Number(I.currentLeft) - Number(I.startLeft), n = Number(I.currentTop) - Number(I.startTop), r = Number(I.itemWidth), i = Number(I.itemHeight), a = T.value, o = j.value, s = e < pe, c = null;
222
+ if (s && I.currentLeft === void 0) {
223
+ $(w.value);
224
+ return;
225
+ }
226
+ U.value ? Math.abs(n) > i * fe || s ? c = n < 0 ? "next" : "prev" : K(b.value, -M.value * a, !0) : Math.abs(t) > r * fe || s ? c = t < 0 ? "next" : "prev" : H.value ? K(b.value, -M.value * a, !0) : q(!0, 0), g.isLoop || (a === 0 && c === "prev" || a === o - 1 && c === "next") && (c = null), Z(c), I = {}, $(w.value);
227
+ }
228
+ function Re(e) {
229
+ z && z(), g.isPrevent && e.preventDefault(), S.value = !0, L = null, Fe(e);
230
+ }
231
+ function ze(e) {
232
+ g.isPrevent && e.preventDefault(), S.value && Ie(e);
233
+ }
234
+ function Q(e) {
235
+ if (g.isPrevent && e.preventDefault(), L) {
236
+ $(w.value), S.value = !1, I = {};
237
+ return;
238
+ }
239
+ S.value &&= (Le(), !1);
240
+ }
241
+ function Be() {
242
+ Z("next");
243
+ }
244
+ function Ve() {
245
+ Z("prev");
246
+ }
247
+ function He(e) {
248
+ if (isNaN(e)) return;
249
+ e = parseInt(String(e));
250
+ let t = Pe(e);
251
+ Z(t > T.value ? "next" : "prev", { index: t }), $(w.value);
252
+ }
253
+ function Ue() {
254
+ return X(T.value);
255
+ }
256
+ function $(e = 3e3) {
257
+ Y(), !(e < 500) && (w.value = e || g.autoplay, Me(), P.value = !1);
258
+ }
259
+ function We() {
260
+ Y(), P.value = !0;
261
+ }
262
+ return c({
263
+ next: Be,
264
+ prev: Ve,
265
+ goto: He,
266
+ getIndex: Ue,
267
+ play: $,
268
+ stop: We,
269
+ index: T,
270
+ rItemCount: j,
271
+ oItemCount: A
272
+ }), (t, n) => (m(), a("div", {
273
+ ref_key: "root",
274
+ ref: v,
275
+ class: u(["cu-swiper", {
276
+ "cu-swiper-vertical": U.value,
277
+ "cu-swiper-fade": !H.value,
278
+ disabled: !C.value
279
+ }]),
280
+ onMousedown: Re,
281
+ onMousemove: ze,
282
+ onMouseup: Q,
283
+ onMouseleave: Q,
284
+ onTouchstart: Re,
285
+ onTouchmove: ze,
286
+ onTouchend: Q,
287
+ onTouchcancel: Q
288
+ }, [o("div", {
289
+ ref_key: "swiperBox",
290
+ ref: y,
291
+ class: "cu-swiper-box"
292
+ }, [o("div", {
293
+ ref_key: "swiper",
294
+ ref: b,
295
+ class: "cu-swiper-container"
296
+ }, [
297
+ W.value && t.$slots.default ? (m(), a(e, { key: 0 }, [Ce.value ? (m(), r(G, {
298
+ key: 0,
299
+ vnode: Ce.value
300
+ }, null, 8, ["vnode"])) : i("", !0)], 64)) : i("", !0),
301
+ ae(t.$slots, "default"),
302
+ W.value && t.$slots.default ? (m(), a(e, { key: 1 }, [Se.value ? (m(), r(G, {
303
+ key: 0,
304
+ vnode: Se.value
305
+ }, null, 8, ["vnode"])) : i("", !0)], 64)) : i("", !0)
306
+ ], 512)], 512), A.value > 1 && s.hasDots ? (m(), a("div", {
307
+ key: 0,
308
+ class: u(["cu-swiper-indicators", { disabled: !s.hasDots }])
309
+ }, [(m(!0), a(e, null, ie(A.value, (e) => (m(), a("div", {
310
+ key: e,
311
+ class: u(["cu-swiper-indicator", { "cu-swiper-indicator-active": e - 1 === xe.value }])
312
+ }, null, 2))), 128))], 2)) : i("", !0)], 34));
313
+ }
314
+ }), _ = /* @__PURE__ */ s({
315
+ name: "cu-swiper-item",
316
+ __name: "SwiperItem",
317
+ props: { isCopy: {
318
+ type: Boolean,
319
+ default: !1
320
+ } },
321
+ setup(e) {
322
+ let t = e, r = l("mdSwiper", null), i = n(() => !r || r.isVertical() ? "auto" : `${r.dimension()}px`), o = n(() => !r || !r.isVertical() ? "auto" : `${r.dimension()}px`), s = c()?.proxy;
323
+ return p(() => {
324
+ t.isCopy || r && s && r.register(s);
325
+ }), f(() => {
326
+ t.isCopy || r && s && r.unregister(s);
327
+ }), (e, t) => (m(), a("div", {
328
+ class: "cu-swiper-item",
329
+ style: d({
330
+ width: i.value,
331
+ height: o.value
332
+ })
333
+ }, [ae(e.$slots, "default")], 4));
334
+ }
335
+ });
336
+ //#endregion
337
+ export { g as n, _ as t };
@@ -0,0 +1,30 @@
1
+ import { createElementBlock as e, defineComponent as t, normalizeClass as n, openBlock as r } from "vue";
2
+ //#endregion
3
+ //#region src/components/switch/Switch.vue
4
+ var i = /* @__PURE__ */ t({
5
+ name: "cu-switch",
6
+ __name: "Switch",
7
+ props: {
8
+ modelValue: {
9
+ type: Boolean,
10
+ default: !1
11
+ },
12
+ disabled: {
13
+ type: Boolean,
14
+ default: !1
15
+ }
16
+ },
17
+ emits: ["update:modelValue", "change"],
18
+ setup(t, { emit: i }) {
19
+ let a = t, o = i;
20
+ function s(e) {
21
+ a.disabled || (o("update:modelValue", !a.modelValue), o("change", e));
22
+ }
23
+ return (i, a) => (r(), e("div", {
24
+ class: n(["cu-switch", [t.disabled ? "disabled" : "", t.modelValue ? "active" : ""]]),
25
+ onClick: a[0] ||= (e) => s(e)
26
+ }, null, 2));
27
+ }
28
+ });
29
+ //#endregion
30
+ export { i as t };
@@ -0,0 +1 @@
1
+ let e=require("vue");var t=(0,e.defineComponent)({name:`cu-switch`,__name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(t,{emit:n}){let r=t,i=n;function a(e){r.disabled||(i(`update:modelValue`,!r.modelValue),i(`change`,e))}return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`cu-switch`,[t.disabled?`disabled`:``,t.modelValue?`active`:``]]),onClick:r[0]||=e=>a(e)},null,2))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -0,0 +1 @@
1
+ let e=require("vue"),t=require("@centui/core");var n={class:`cu-tag`},r={class:`quarter-content`},i=(0,e.defineComponent)({name:`cu-tag`,__name:`Tag`,props:{size:{default:`large`},shape:{default:`square`},sharp:{default:``},type:{default:`ghost`},fillColor:{default:``},fontWeight:{default:`normal`},fontColor:{default:``}},setup(i){let a=i,o=(0,e.ref)(),s=(0,e.reactive)({}),c=(0,e.computed)(()=>[`default`,`size-${a.size}`,`shape-${a.shape}`,`type-${a.type}`,`font-weight-${a.fontWeight}`]),l=(0,e.computed)(()=>{let e={};return a.type===`fill`&&a.fillColor&&(e.background=a.fillColor),a.fontColor&&(a.type===`ghost`&&(e.borderColor=a.fontColor),e.color=a.fontColor),e});return(0,e.onMounted)(async()=>{if(await(0,e.nextTick)(),a.shape===`circle`&&o.value){let e=o.value.offsetHeight/2;s.paddingLeft=e+`px`,s.paddingRight=e+`px`,s.borderRadius=e+`px`,a.sharp&&(s[(0,t.transformCamelCase)(`border-${a.sharp}-radius`)]=`0`)}}),(t,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,n,[i.shape===`quarter`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:(0,e.normalizeClass)(c.value)},[(0,e.createElementVNode)(`div`,r,[(0,e.renderSlot)(t.$slots,`default`)]),(0,e.createElementVNode)(`div`,{class:`quarter-bg`,style:(0,e.normalizeStyle)(l.value)},null,4)],2)):i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:(0,e.normalizeClass)(c.value)},[(0,e.createElementVNode)(`div`,{class:`coupon-container`,style:(0,e.normalizeStyle)(l.value)},[i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`left-coupon`,style:(0,e.normalizeStyle)({background:i.fillColor?`radial-gradient(circle at left, transparent 33%, `+i.fillColor+` 33%)`:``})},null,4)):(0,e.createCommentVNode)(``,!0),(0,e.renderSlot)(t.$slots,`default`),i.shape===`coupon`?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`right-coupon`,style:(0,e.normalizeStyle)({background:i.fillColor?`radial-gradient(circle at right, transparent 33%, `+i.fillColor+` 33%)`:``})},null,4)):(0,e.createCommentVNode)(``,!0)],4)],2)):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,ref_key:`el`,ref:o,class:(0,e.normalizeClass)(c.value),style:(0,e.normalizeStyle)([l.value,s])},[(0,e.renderSlot)(t.$slots,`default`)],6))]))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
@@ -0,0 +1,66 @@
1
+ import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, nextTick as a, normalizeClass as o, normalizeStyle as s, onMounted as c, openBlock as l, reactive as u, ref as d, renderSlot as f } from "vue";
2
+ import { transformCamelCase as p } from "@centui/core";
3
+ //#region src/components/tag/Tag.vue?vue&type=script&setup=true&lang.ts
4
+ var m = { class: "cu-tag" }, h = { class: "quarter-content" }, g = /* @__PURE__ */ i({
5
+ name: "cu-tag",
6
+ __name: "Tag",
7
+ props: {
8
+ size: { default: "large" },
9
+ shape: { default: "square" },
10
+ sharp: { default: "" },
11
+ type: { default: "ghost" },
12
+ fillColor: { default: "" },
13
+ fontWeight: { default: "normal" },
14
+ fontColor: { default: "" }
15
+ },
16
+ setup(i) {
17
+ let g = i, _ = d(), v = u({}), y = e(() => [
18
+ "default",
19
+ `size-${g.size}`,
20
+ `shape-${g.shape}`,
21
+ `type-${g.type}`,
22
+ `font-weight-${g.fontWeight}`
23
+ ]), b = e(() => {
24
+ let e = {};
25
+ return g.type === "fill" && g.fillColor && (e.background = g.fillColor), g.fontColor && (g.type === "ghost" && (e.borderColor = g.fontColor), e.color = g.fontColor), e;
26
+ });
27
+ return c(async () => {
28
+ if (await a(), g.shape === "circle" && _.value) {
29
+ let e = _.value.offsetHeight / 2;
30
+ v.paddingLeft = e + "px", v.paddingRight = e + "px", v.borderRadius = e + "px", g.sharp && (v[p(`border-${g.sharp}-radius`)] = "0");
31
+ }
32
+ }), (e, a) => (l(), n("div", m, [i.shape === "quarter" ? (l(), n("div", {
33
+ key: 0,
34
+ class: o(y.value)
35
+ }, [r("div", h, [f(e.$slots, "default")]), r("div", {
36
+ class: "quarter-bg",
37
+ style: s(b.value)
38
+ }, null, 4)], 2)) : i.shape === "coupon" ? (l(), n("div", {
39
+ key: 1,
40
+ class: o(y.value)
41
+ }, [r("div", {
42
+ class: "coupon-container",
43
+ style: s(b.value)
44
+ }, [
45
+ i.shape === "coupon" ? (l(), n("div", {
46
+ key: 0,
47
+ class: "left-coupon",
48
+ style: s({ background: i.fillColor ? "radial-gradient(circle at left, transparent 33%, " + i.fillColor + " 33%)" : "" })
49
+ }, null, 4)) : t("", !0),
50
+ f(e.$slots, "default"),
51
+ i.shape === "coupon" ? (l(), n("div", {
52
+ key: 1,
53
+ class: "right-coupon",
54
+ style: s({ background: i.fillColor ? "radial-gradient(circle at right, transparent 33%, " + i.fillColor + " 33%)" : "" })
55
+ }, null, 4)) : t("", !0)
56
+ ], 4)], 2)) : (l(), n("div", {
57
+ key: 2,
58
+ ref_key: "el",
59
+ ref: _,
60
+ class: o(y.value),
61
+ style: s([b.value, v])
62
+ }, [f(e.$slots, "default")], 6))]));
63
+ }
64
+ });
65
+ //#endregion
66
+ export { g as t };