@cyberpunk-vue/components 1.13.16 → 1.13.17

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.
package/dist/index.mjs CHANGED
@@ -829,6 +829,18 @@ var xe = [], Se = 0, Ce = 0, we = () => [...xe].sort((e, t) => e.stackPriority =
829
829
  type: Number,
830
830
  default: 1
831
831
  },
832
+ wheel: {
833
+ type: Boolean,
834
+ default: !0
835
+ },
836
+ wheelReverse: {
837
+ type: Boolean,
838
+ default: !1
839
+ },
840
+ wheelStep: {
841
+ type: Number,
842
+ default: void 0
843
+ },
832
844
  precision: {
833
845
  type: Number,
834
846
  default: void 0
@@ -881,7 +893,7 @@ var xe = [], Se = 0, Ce = 0, we = () => [...xe].sort((e, t) => e.stackPriority =
881
893
  sm: 28,
882
894
  md: 36,
883
895
  lg: 44
884
- }, p = A(), m = A(!1), h = A(null), g = a(() => h.value === null ? r.modelValue === void 0 || r.modelValue === null ? "" : r.precision === void 0 ? String(r.modelValue) : r.modelValue.toFixed(r.precision) : h.value), _ = a(() => [
896
+ }, p = A(), m = A(!1), h = A(!1), g = A(null), _ = a(() => g.value === null ? r.modelValue === void 0 || r.modelValue === null ? "" : r.precision === void 0 ? String(r.modelValue) : r.modelValue.toFixed(r.precision) : g.value), y = a(() => [
885
897
  o.b(),
886
898
  Y(r.size) && o.m(r.size),
887
899
  o.m(`controls-${r.controlsPosition}`),
@@ -891,45 +903,70 @@ var xe = [], Se = 0, Ce = 0, we = () => [...xe].sort((e, t) => e.stackPriority =
891
903
  o.is("custom-color", !!r.color),
892
904
  o.is("without-controls", !r.controls),
893
905
  o.is("custom-size", !Y(r.size))
894
- ]), y = a(() => {
906
+ ]), b = a(() => {
895
907
  let e = {};
896
908
  return r.color && (e["--cp-input-number-custom-color"] = r.color, e["--cp-input-number-custom-color-light"] = `color-mix(in srgb, ${r.color} 20%, transparent)`), Y(r.size) || (e["--cp-input-number-height"] = ne(r.size, f)), e;
897
- }), b = a(() => r.modelValue <= r.min), x = a(() => r.modelValue >= r.max), C = (e) => r.precision === void 0 ? e : parseFloat(e.toFixed(r.precision)), T = (e) => {
909
+ }), x = a(() => r.modelValue <= r.min), C = a(() => r.modelValue >= r.max), T = a(() => r.wheelStep ?? r.step), E = (e) => r.precision === void 0 ? e : parseFloat(e.toFixed(r.precision)), O = (e) => {
898
910
  let t = r.modelValue, n = e;
899
- n < r.min && (n = r.min), n > r.max && (n = r.max), n = C(n), t !== n && (i("update:modelValue", n), i("change", n, t));
900
- }, E = () => {
901
- d.value || r.readonly || x.value || T(r.modelValue + r.step);
902
- }, O = () => {
903
- d.value || r.readonly || b.value || T(r.modelValue - r.step);
911
+ n < r.min && (n = r.min), n > r.max && (n = r.max), n = E(n), t !== n && (i("update:modelValue", n), i("change", n, t));
904
912
  }, k = (e) => {
905
- h.value = e.target.value;
906
- }, j = (e) => {
913
+ let t = Math.abs(e);
914
+ return Number.isFinite(t) ? t : 0;
915
+ }, j = (e, t) => {
916
+ if (d.value || r.readonly) return;
917
+ let n = k(t);
918
+ if (n !== 0) {
919
+ if (e > 0) {
920
+ if (C.value) return;
921
+ g.value = null, O(r.modelValue + n);
922
+ return;
923
+ }
924
+ x.value || (g.value = null, O(r.modelValue - n));
925
+ }
926
+ }, M = () => {
927
+ j(1, r.step);
928
+ }, N = () => {
929
+ j(-1, r.step);
930
+ }, P = (e) => {
931
+ g.value = e.target.value;
932
+ }, F = (e) => {
907
933
  let t = e.target.value;
908
- if (h.value = null, t === "" || t === "-") {
909
- T(r.min > -Infinity ? r.min : 0);
934
+ if (g.value = null, t === "" || t === "-") {
935
+ O(r.min > -Infinity ? r.min : 0);
910
936
  return;
911
937
  }
912
938
  let n = parseFloat(t);
913
- isNaN(n) || T(n);
914
- }, M = (e) => {
939
+ isNaN(n) || O(n);
940
+ }, I = (e) => {
915
941
  m.value = !0, i("focus", e);
916
- }, N = (e) => {
917
- m.value = !1, h.value = null, i("blur", e);
942
+ }, L = (e) => {
943
+ m.value = !1, g.value = null, i("blur", e);
944
+ }, R = () => {
945
+ h.value = !0;
946
+ }, z = () => {
947
+ h.value = !1;
948
+ }, V = (e) => {
949
+ if (!r.wheel || !h.value && !m.value || d.value || r.readonly || e.deltaY === 0) return;
950
+ let t = r.wheelReverse ? e.deltaY > 0 : e.deltaY < 0;
951
+ k(T.value) !== 0 && (t && C.value || !t && x.value || (e.preventDefault(), j(t ? 1 : -1, T.value)));
918
952
  };
919
953
  return t({
920
954
  focus: () => p.value?.focus(),
921
955
  blur: () => p.value?.blur(),
922
956
  inputRef: p
923
957
  }), (e, t) => (D(), c("div", {
924
- class: S(_.value),
925
- style: w(y.value)
958
+ class: S(y.value),
959
+ style: w(b.value),
960
+ onMouseenter: R,
961
+ onMouseleave: z,
962
+ onWheel: V
926
963
  }, [
927
964
  e.controls && e.controlsPosition === "both" ? (D(), c("button", {
928
965
  key: 0,
929
966
  type: "button",
930
- class: S([B(o).e("decrease"), { "is-disabled": b.value || d.value }]),
931
- disabled: b.value || d.value,
932
- onClick: O
967
+ class: S([B(o).e("decrease"), { "is-disabled": x.value || d.value }]),
968
+ disabled: x.value || d.value,
969
+ onClick: N
933
970
  }, [...t[0] ||= [l("svg", {
934
971
  viewBox: "0 0 24 24",
935
972
  fill: "currentColor"
@@ -940,21 +977,21 @@ var xe = [], Se = 0, Ce = 0, we = () => [...xe].sort((e, t) => e.stackPriority =
940
977
  class: S(B(o).e("inner")),
941
978
  type: "text",
942
979
  inputmode: "decimal",
943
- value: g.value,
980
+ value: _.value,
944
981
  placeholder: e.placeholder,
945
982
  disabled: d.value,
946
983
  readonly: e.readonly,
947
- onInput: k,
948
- onChange: j,
949
- onFocus: M,
950
- onBlur: N
984
+ onInput: P,
985
+ onChange: F,
986
+ onFocus: I,
987
+ onBlur: L
951
988
  }, null, 42, dt),
952
989
  e.controls && e.controlsPosition === "both" ? (D(), c("button", {
953
990
  key: 1,
954
991
  type: "button",
955
- class: S([B(o).e("increase"), { "is-disabled": x.value || d.value }]),
956
- disabled: x.value || d.value,
957
- onClick: E
992
+ class: S([B(o).e("increase"), { "is-disabled": C.value || d.value }]),
993
+ disabled: C.value || d.value,
994
+ onClick: M
958
995
  }, [...t[1] ||= [l("svg", {
959
996
  viewBox: "0 0 24 24",
960
997
  fill: "currentColor"
@@ -964,22 +1001,22 @@ var xe = [], Se = 0, Ce = 0, we = () => [...xe].sort((e, t) => e.stackPriority =
964
1001
  class: S(B(o).e("controls"))
965
1002
  }, [l("button", {
966
1003
  type: "button",
967
- class: S([B(o).e("increase"), { "is-disabled": x.value || d.value }]),
968
- disabled: x.value || d.value,
969
- onClick: E
1004
+ class: S([B(o).e("increase"), { "is-disabled": C.value || d.value }]),
1005
+ disabled: C.value || d.value,
1006
+ onClick: M
970
1007
  }, [...t[2] ||= [l("svg", {
971
1008
  viewBox: "0 0 24 24",
972
1009
  fill: "currentColor"
973
1010
  }, [l("path", { d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" })], -1)]], 10, pt), l("button", {
974
1011
  type: "button",
975
- class: S([B(o).e("decrease"), { "is-disabled": b.value || d.value }]),
976
- disabled: b.value || d.value,
977
- onClick: O
1012
+ class: S([B(o).e("decrease"), { "is-disabled": x.value || d.value }]),
1013
+ disabled: x.value || d.value,
1014
+ onClick: N
978
1015
  }, [...t[3] ||= [l("svg", {
979
1016
  viewBox: "0 0 24 24",
980
1017
  fill: "currentColor"
981
1018
  }, [l("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z" })], -1)]], 10, mt)], 2)) : s("", !0)
982
- ], 6));
1019
+ ], 38));
983
1020
  }
984
1021
  })), gt = {
985
1022
  modelValue: {
@@ -15,6 +15,18 @@ export declare const CpInputNumber: import('../utils').SFCWithInstall<import('vu
15
15
  readonly type: NumberConstructor;
16
16
  readonly default: 1;
17
17
  };
18
+ readonly wheel: {
19
+ readonly type: BooleanConstructor;
20
+ readonly default: true;
21
+ };
22
+ readonly wheelReverse: {
23
+ readonly type: BooleanConstructor;
24
+ readonly default: false;
25
+ };
26
+ readonly wheelStep: {
27
+ readonly type: NumberConstructor;
28
+ readonly default: undefined;
29
+ };
18
30
  readonly precision: {
19
31
  readonly type: NumberConstructor;
20
32
  readonly default: undefined;
@@ -73,6 +85,18 @@ export declare const CpInputNumber: import('../utils').SFCWithInstall<import('vu
73
85
  readonly type: NumberConstructor;
74
86
  readonly default: 1;
75
87
  };
88
+ readonly wheel: {
89
+ readonly type: BooleanConstructor;
90
+ readonly default: true;
91
+ };
92
+ readonly wheelReverse: {
93
+ readonly type: BooleanConstructor;
94
+ readonly default: false;
95
+ };
96
+ readonly wheelStep: {
97
+ readonly type: NumberConstructor;
98
+ readonly default: undefined;
99
+ };
76
100
  readonly precision: {
77
101
  readonly type: NumberConstructor;
78
102
  readonly default: undefined;
@@ -112,6 +136,7 @@ export declare const CpInputNumber: import('../utils').SFCWithInstall<import('vu
112
136
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
113
137
  }>, {
114
138
  readonly size: import('@cyberpunk-vue/hooks').Size;
139
+ readonly wheel: boolean;
115
140
  readonly color: string;
116
141
  readonly disabled: boolean;
117
142
  readonly placeholder: string;
@@ -120,6 +145,8 @@ export declare const CpInputNumber: import('../utils').SFCWithInstall<import('vu
120
145
  readonly min: number;
121
146
  readonly max: number;
122
147
  readonly step: number;
148
+ readonly wheelReverse: boolean;
149
+ readonly wheelStep: number;
123
150
  readonly precision: number;
124
151
  readonly controls: boolean;
125
152
  readonly controlsPosition: "right" | "both";
@@ -36,6 +36,33 @@ export declare const inputNumberProps: {
36
36
  readonly type: NumberConstructor;
37
37
  readonly default: 1;
38
38
  };
39
+ /**
40
+ * 是否启用滚轮增减
41
+ * @default true
42
+ * @description hover 或 focus 状态下,上滚动增加、下滚动减少
43
+ */
44
+ readonly wheel: {
45
+ readonly type: BooleanConstructor;
46
+ readonly default: true;
47
+ };
48
+ /**
49
+ * 是否反转滚轮增减方向
50
+ * @default false
51
+ * @description true 时上滚动减少、下滚动增加
52
+ */
53
+ readonly wheelReverse: {
54
+ readonly type: BooleanConstructor;
55
+ readonly default: false;
56
+ };
57
+ /**
58
+ * 滚轮独立步长
59
+ * @default undefined (默认使用 step)
60
+ * @description 未设置时沿用左右加减按钮的 step
61
+ */
62
+ readonly wheelStep: {
63
+ readonly type: NumberConstructor;
64
+ readonly default: undefined;
65
+ };
39
66
  /** 精度 (小数位数) */
40
67
  readonly precision: {
41
68
  readonly type: NumberConstructor;
@@ -15,6 +15,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
15
15
  readonly type: NumberConstructor;
16
16
  readonly default: 1;
17
17
  };
18
+ readonly wheel: {
19
+ readonly type: BooleanConstructor;
20
+ readonly default: true;
21
+ };
22
+ readonly wheelReverse: {
23
+ readonly type: BooleanConstructor;
24
+ readonly default: false;
25
+ };
26
+ readonly wheelStep: {
27
+ readonly type: NumberConstructor;
28
+ readonly default: undefined;
29
+ };
18
30
  readonly precision: {
19
31
  readonly type: NumberConstructor;
20
32
  readonly default: undefined;
@@ -73,6 +85,18 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
73
85
  readonly type: NumberConstructor;
74
86
  readonly default: 1;
75
87
  };
88
+ readonly wheel: {
89
+ readonly type: BooleanConstructor;
90
+ readonly default: true;
91
+ };
92
+ readonly wheelReverse: {
93
+ readonly type: BooleanConstructor;
94
+ readonly default: false;
95
+ };
96
+ readonly wheelStep: {
97
+ readonly type: NumberConstructor;
98
+ readonly default: undefined;
99
+ };
76
100
  readonly precision: {
77
101
  readonly type: NumberConstructor;
78
102
  readonly default: undefined;
@@ -112,6 +136,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
112
136
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
113
137
  }>, {
114
138
  readonly size: import('@cyberpunk-vue/hooks').Size;
139
+ readonly wheel: boolean;
115
140
  readonly color: string;
116
141
  readonly disabled: boolean;
117
142
  readonly placeholder: string;
@@ -120,6 +145,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
120
145
  readonly min: number;
121
146
  readonly max: number;
122
147
  readonly step: number;
148
+ readonly wheelReverse: boolean;
149
+ readonly wheelStep: number;
123
150
  readonly precision: number;
124
151
  readonly controls: boolean;
125
152
  readonly controlsPosition: "right" | "both";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyberpunk-vue/components",
3
- "version": "1.13.16",
3
+ "version": "1.13.17",
4
4
  "description": "Cyberpunk Vue components - A futuristic Vue 3 component library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -25,9 +25,9 @@
25
25
  "dependencies": {
26
26
  "@floating-ui/dom": "^1.7.6",
27
27
  "dayjs": "^1.11.20",
28
- "@cyberpunk-vue/constants": "1.13.16",
29
- "@cyberpunk-vue/theme-chalk": "1.13.16",
30
- "@cyberpunk-vue/hooks": "1.13.16"
28
+ "@cyberpunk-vue/theme-chalk": "1.13.17",
29
+ "@cyberpunk-vue/constants": "1.13.17",
30
+ "@cyberpunk-vue/hooks": "1.13.17"
31
31
  },
32
32
  "author": "Juxest",
33
33
  "license": "MIT",