@trionesdev/antd-mobile-base-react 0.0.2-beta.15 → 0.0.2-beta.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.
Files changed (115) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -23
  3. package/dist/Alert/style.scss +69 -69
  4. package/dist/Avatar/avatar.d.ts +2 -2
  5. package/dist/Avatar/avatar.js +1 -1
  6. package/dist/Avatar/style.scss +17 -17
  7. package/dist/Badge/style.scss +100 -100
  8. package/dist/Card/style.scss +35 -35
  9. package/dist/CascaderView/style.scss +22 -22
  10. package/dist/Cell/CellGroup.js +25 -8
  11. package/dist/Cell/cell.js +20 -37
  12. package/dist/Cell/context.d.ts +4 -2
  13. package/dist/Cell/styles.scss +81 -52
  14. package/dist/Cell/types.d.ts +6 -4
  15. package/dist/Checkbox/checkbox-group.js +1 -2
  16. package/dist/Checkbox/index.scss +165 -165
  17. package/dist/ConfigProvider/config-provider.d.ts +1 -0
  18. package/dist/DemoBlock/index.scss +20 -20
  19. package/dist/DemoDescription/index.scss +3 -3
  20. package/dist/Descriptions/style.scss +65 -65
  21. package/dist/Divider/divider.d.ts +1 -1
  22. package/dist/Divider/divider.js +5 -3
  23. package/dist/Divider/style.scss +62 -62
  24. package/dist/Ellipsis/style.scss +13 -13
  25. package/dist/Empty/style.scss +29 -29
  26. package/dist/ErrorBlock/demo/base.js +2 -2
  27. package/dist/ErrorBlock/style.scss +62 -62
  28. package/dist/Footer/style.scss +55 -55
  29. package/dist/Form/ErrorList.d.ts +4 -0
  30. package/dist/Form/ErrorList.js +9 -0
  31. package/dist/Form/context.d.ts +4 -2
  32. package/dist/Form/context.js +2 -1
  33. package/dist/Form/form.d.ts +24 -6
  34. package/dist/Form/form.js +22 -11
  35. package/dist/Form/hooks/useForm.js +1 -8
  36. package/dist/Form/hooks/useFormContext.js +1 -2
  37. package/dist/Form/index.d.ts +6 -3
  38. package/dist/Form/index.js +4 -1
  39. package/dist/Form/styles.scss +11 -0
  40. package/dist/Form/types.d.ts +2 -1
  41. package/dist/FormCell/FormCell.d.ts +21 -0
  42. package/dist/FormCell/FormCell.js +56 -0
  43. package/dist/FormCell/index.d.ts +4 -0
  44. package/dist/FormCell/index.js +3 -0
  45. package/dist/FormCell/styles.scss +103 -0
  46. package/dist/Grid/style.scss +17 -17
  47. package/dist/Icon/demo/base.js +2 -2
  48. package/dist/InputNumber/input-number.d.ts +2 -4
  49. package/dist/InputNumber/input-number.js +46 -28
  50. package/dist/InputNumber/style.scss +100 -63
  51. package/dist/Loading/DotLoading.d.ts +8 -0
  52. package/dist/Loading/DotLoading.js +33 -0
  53. package/dist/Loading/SpinLoading.js +70 -0
  54. package/dist/Loading/dot-loading.scss +72 -0
  55. package/dist/Loading/index.d.ts +5 -0
  56. package/dist/Loading/index.js +3 -0
  57. package/dist/{SpinLoading → Loading}/spin-loading.scss +39 -40
  58. package/dist/NavBar/style.scss +64 -64
  59. package/dist/NoticeBar/style.scss +130 -130
  60. package/dist/PageIndicator/style.scss +59 -59
  61. package/dist/Progress/Progress.js +1 -1
  62. package/dist/Progress/ProgressCircle.js +5 -2
  63. package/dist/Progress/ProgressLine.js +2 -2
  64. package/dist/Progress/style.scss +33 -33
  65. package/dist/Progress/types.d.ts +2 -2
  66. package/dist/Radio/style.scss +154 -141
  67. package/dist/Rate/style.scss +37 -37
  68. package/dist/Result/demo/base.js +2 -2
  69. package/dist/Result/style.scss +73 -73
  70. package/dist/SafeArea/style.scss +20 -20
  71. package/dist/Scaffold/style.scss +17 -17
  72. package/dist/Segmented/style.scss +75 -75
  73. package/dist/Skeleton/Skeleton.d.ts +80 -21
  74. package/dist/Skeleton/Skeleton.js +248 -57
  75. package/dist/Skeleton/index.d.ts +3 -1
  76. package/dist/Skeleton/index.js +2 -1
  77. package/dist/Skeleton/style.scss +215 -48
  78. package/dist/Space/space.js +12 -9
  79. package/dist/Space/style.scss +101 -80
  80. package/dist/Stepper/index.d.ts +3 -0
  81. package/dist/Stepper/index.js +2 -0
  82. package/dist/Stepper/stepper.d.ts +14 -0
  83. package/dist/Stepper/stepper.js +92 -0
  84. package/dist/Stepper/style.scss +100 -0
  85. package/dist/Steps/HorizontalSteps.js +5 -2
  86. package/dist/Steps/VerticalSteps.js +5 -2
  87. package/dist/Steps/style.scss +153 -153
  88. package/dist/Steps/types.d.ts +2 -0
  89. package/dist/Switch/style.scss +127 -128
  90. package/dist/Switch/switch.d.ts +2 -0
  91. package/dist/Switch/switch.js +6 -5
  92. package/dist/TabBar/demo/base.js +2 -2
  93. package/dist/TabBar/index.scss +37 -37
  94. package/dist/Tabs/style.scss +108 -108
  95. package/dist/Tag/style.scss +110 -109
  96. package/dist/Tag/tag.d.ts +1 -1
  97. package/dist/Tag/tag.js +1 -1
  98. package/dist/WaterMark/style.scss +17 -17
  99. package/dist/index.d.ts +11 -4
  100. package/dist/index.js +5 -2
  101. package/dist/style/css-variable.scss +6 -6
  102. package/dist/style/style.scss +52 -52
  103. package/dist/style/theme-dark.scss +24 -24
  104. package/dist/style/theme-default.scss +54 -54
  105. package/dist/style/variable.scss +180 -173
  106. package/dist/types.d.ts +6 -1
  107. package/dist/utils/type.js +36 -36
  108. package/dist/utils/with-default-props.js +4 -4
  109. package/package.json +4 -7
  110. package/dist/SpinLoading/index.d.ts +0 -3
  111. package/dist/SpinLoading/index.js +0 -2
  112. package/dist/SpinLoading/spin-loading.js +0 -59
  113. package/dist/Tabs/demo/base.d.ts +0 -3
  114. package/dist/Tabs/demo/base.js +0 -59
  115. /package/dist/{SpinLoading/spin-loading.d.ts → Loading/SpinLoading.d.ts} +0 -0
@@ -1,48 +1,215 @@
1
- .skeleton-container {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 12rpx;
5
-
6
- .skeleton-item {
7
- background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
8
- background-size: 200% 100%;
9
- background-position: 100% 0;
10
- animation: skeleton-loading 1.5s infinite linear;
11
-
12
- &.skeleton-animated {
13
- animation: skeleton-loading 1.5s infinite linear;
14
- }
15
- }
16
-
17
- .skeleton-text {
18
- width: 100%;
19
- height: 32rpx;
20
- border-radius: 8rpx;
21
- margin-bottom: 12rpx;
22
- &:last-child {
23
- margin-bottom: 0;
24
- width: 70%;
25
- }
26
- }
27
-
28
- .skeleton-circle {
29
- width: 64rpx;
30
- height: 64rpx;
31
- border-radius: 50%;
32
- }
33
-
34
- .skeleton-rect {
35
- width: 100%;
36
- height: 128rpx;
37
- border-radius: 16rpx;
38
- }
39
- }
40
-
41
- @keyframes skeleton-loading {
42
- 0% {
43
- background-position: 100% 0;
44
- }
45
- 100% {
46
- background-position: -100% 0;
47
- }
48
- }
1
+ $prefix: triones-antm-skeleton;
2
+
3
+ @mixin skeleton-fill {
4
+ background: rgba(0, 0, 0, 0.06);
5
+ }
6
+
7
+ .#{$prefix} {
8
+ width: 100%;
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .#{$prefix}-element-active {
13
+ background: linear-gradient(
14
+ 90deg,
15
+ rgba(0, 0, 0, 0.06) 25%,
16
+ rgba(0, 0, 0, 0.12) 50%,
17
+ rgba(0, 0, 0, 0.06) 75%
18
+ );
19
+ background-size: 200% 100%;
20
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
21
+ }
22
+
23
+ .#{$prefix}-with-avatar {
24
+ display: flex;
25
+ align-items: flex-start;
26
+ gap: 12px;
27
+ }
28
+
29
+ .#{$prefix}-header {
30
+ flex-shrink: 0;
31
+ }
32
+
33
+ .#{$prefix}-section {
34
+ flex: 1;
35
+ min-width: 0;
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 12px;
39
+ padding-top: 4px;
40
+ }
41
+
42
+ .#{$prefix}-avatar {
43
+ @include skeleton-fill;
44
+ flex-shrink: 0;
45
+
46
+ &.#{$prefix}-element-active {
47
+ @include skeleton-fill;
48
+ background: linear-gradient(
49
+ 90deg,
50
+ rgba(0, 0, 0, 0.06) 25%,
51
+ rgba(0, 0, 0, 0.12) 50%,
52
+ rgba(0, 0, 0, 0.06) 75%
53
+ );
54
+ background-size: 200% 100%;
55
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
56
+ }
57
+ }
58
+
59
+ .#{$prefix}-avatar-circle {
60
+ border-radius: 50%;
61
+ }
62
+
63
+ .#{$prefix}-avatar-square {
64
+ border-radius: 8px;
65
+ }
66
+
67
+ .#{$prefix}-title {
68
+ height: 16px;
69
+ max-width: 100%;
70
+ border-radius: 4px;
71
+ @include skeleton-fill;
72
+
73
+ &.#{$prefix}-element-active {
74
+ background: linear-gradient(
75
+ 90deg,
76
+ rgba(0, 0, 0, 0.06) 25%,
77
+ rgba(0, 0, 0, 0.12) 50%,
78
+ rgba(0, 0, 0, 0.06) 75%
79
+ );
80
+ background-size: 200% 100%;
81
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
82
+ }
83
+ }
84
+
85
+ .#{$prefix}-round .#{$prefix}-title,
86
+ .#{$prefix}-round .#{$prefix}-paragraph-line {
87
+ border-radius: 9999px;
88
+ }
89
+
90
+ .#{$prefix}-paragraph {
91
+ display: flex;
92
+ flex-direction: column;
93
+ gap: 8px;
94
+ }
95
+
96
+ .#{$prefix}-paragraph-line {
97
+ height: 14px;
98
+ max-width: 100%;
99
+ border-radius: 4px;
100
+ @include skeleton-fill;
101
+
102
+ &.#{$prefix}-element-active {
103
+ background: linear-gradient(
104
+ 90deg,
105
+ rgba(0, 0, 0, 0.06) 25%,
106
+ rgba(0, 0, 0, 0.12) 50%,
107
+ rgba(0, 0, 0, 0.06) 75%
108
+ );
109
+ background-size: 200% 100%;
110
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
111
+ }
112
+ }
113
+
114
+ .#{$prefix}-input {
115
+ width: 100%;
116
+ border-radius: 6px;
117
+ @include skeleton-fill;
118
+
119
+ &.#{$prefix}-element-active {
120
+ background: linear-gradient(
121
+ 90deg,
122
+ rgba(0, 0, 0, 0.06) 25%,
123
+ rgba(0, 0, 0, 0.12) 50%,
124
+ rgba(0, 0, 0, 0.06) 75%
125
+ );
126
+ background-size: 200% 100%;
127
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
128
+ }
129
+ }
130
+
131
+ .#{$prefix}-button {
132
+ display: inline-block;
133
+ min-width: 60px;
134
+ border-radius: 6px;
135
+ @include skeleton-fill;
136
+
137
+ &.#{$prefix}-element-active {
138
+ background: linear-gradient(
139
+ 90deg,
140
+ rgba(0, 0, 0, 0.06) 25%,
141
+ rgba(0, 0, 0, 0.12) 50%,
142
+ rgba(0, 0, 0, 0.06) 75%
143
+ );
144
+ background-size: 200% 100%;
145
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
146
+ }
147
+ }
148
+
149
+ .#{$prefix}-button-block {
150
+ display: block;
151
+ width: 100%;
152
+ }
153
+
154
+ .#{$prefix}-button-square {
155
+ border-radius: 4px;
156
+ }
157
+
158
+ .#{$prefix}-button-round {
159
+ border-radius: 9999px;
160
+ }
161
+
162
+ .#{$prefix}-button-circle {
163
+ min-width: unset;
164
+ border-radius: 50%;
165
+ }
166
+
167
+ .#{$prefix}-block-root {
168
+ display: flex;
169
+ flex-direction: column;
170
+ gap: 8px;
171
+ width: 100%;
172
+ }
173
+
174
+ .#{$prefix}-block {
175
+ @include skeleton-fill;
176
+ box-sizing: border-box;
177
+
178
+ &.#{$prefix}-element-active {
179
+ background: linear-gradient(
180
+ 90deg,
181
+ rgba(0, 0, 0, 0.06) 25%,
182
+ rgba(0, 0, 0, 0.12) 50%,
183
+ rgba(0, 0, 0, 0.06) 75%
184
+ );
185
+ background-size: 200% 100%;
186
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
187
+ }
188
+ }
189
+
190
+ .#{$prefix}-block-text {
191
+ width: 100%;
192
+ height: 16px;
193
+ border-radius: 4px;
194
+ }
195
+
196
+ .#{$prefix}-block-rect {
197
+ width: 100%;
198
+ height: 64px;
199
+ border-radius: 8px;
200
+ }
201
+
202
+ .#{$prefix}-block-circle {
203
+ width: 32px;
204
+ height: 32px;
205
+ border-radius: 50%;
206
+ }
207
+
208
+ @keyframes #{$prefix}-shimmer {
209
+ 0% {
210
+ background-position: 100% 0;
211
+ }
212
+ 100% {
213
+ background-position: -100% 0;
214
+ }
215
+ }
@@ -55,16 +55,19 @@ export var Space = function Space(_ref) {
55
55
  }),
56
56
  onClick: onClick
57
57
  }, function () {
58
+ var validChildren = React.Children.toArray(children).filter(function (child) {
59
+ return child !== null && child !== undefined;
60
+ });
58
61
  var items = [];
59
- React.Children.map(children, function (child, index) {
60
- if (child !== null && child !== undefined) {
61
- items.push( /*#__PURE__*/React.createElement("div", {
62
- key: "space-item-".concat(index),
63
- className: "".concat(classPrefix, "-item")
64
- }, child));
65
- if (separator && index < React.Children.count(children) - 1) {
66
- items.push(separator);
67
- }
62
+ validChildren.forEach(function (child, index) {
63
+ items.push( /*#__PURE__*/React.createElement("div", {
64
+ key: "space-item-".concat(index),
65
+ className: "".concat(classPrefix, "-item")
66
+ }, child));
67
+ if (separator && index < validChildren.length - 1) {
68
+ items.push( /*#__PURE__*/React.createElement(React.Fragment, {
69
+ key: "space-separator-".concat(index)
70
+ }, separator));
68
71
  }
69
72
  });
70
73
  return items;
@@ -1,80 +1,101 @@
1
- $class-prefix-space: 'triones-antm-space';
2
-
3
- .#{$class-prefix-space}-item {
4
- flex: none;
5
- display: inline-flex;
6
- flex-shrink: 1;
7
- min-width: 0;
8
- }
9
- /* prettier-ignore */
10
- .#{$class-prefix-space} {
11
- display: inline-flex;
12
- vertical-align: middle;
13
- &-vertical {
14
- flex-direction: column;
15
- > .#{$class-prefix-space}-item {
16
- &:last-child {
17
- margin-bottom: 0;
18
- }
19
- }
20
- }
21
- &-horizontal {
22
- flex-direction: row;
23
- > .#{$class-prefix-space}-item {
24
- &:last-child {
25
-
26
- }
27
- }
28
- &.#{$class-prefix-space}-wrap {
29
- flex-wrap: wrap;
30
- > .#{$class-prefix-space}-item {
31
-
32
- }
33
- }
34
- }
35
- &.#{$class-prefix-space}-block {
36
- display: flex;
37
- width: 100%;
38
- .#{$class-prefix-space}-item{
39
- display: flex;
40
- }
41
-
42
- }
43
- &-align {
44
- &-center {
45
- align-items: center;
46
- }
47
- &-start {
48
- align-items: flex-start;
49
- }
50
- &-end {
51
- align-items: flex-end;
52
- }
53
- &-baseline {
54
- align-items: baseline;
55
- }
56
- }
57
- &-justify {
58
- &-center {
59
- justify-content: center;
60
- }
61
- &-start {
62
- justify-content: flex-start;
63
- }
64
- &-end {
65
- justify-content: flex-end;
66
- }
67
- &-between {
68
- justify-content: space-between;
69
- }
70
- &-around {
71
- justify-content: space-around;
72
- }
73
- &-evenly {
74
- justify-content: space-evenly;
75
- }
76
- &-stretch {
77
- justify-content: stretch;
78
- }
79
- }
80
- }
1
+ $class-prefix-space: 'triones-antm-space';
2
+
3
+ .#{$class-prefix-space}-item {
4
+ flex: none;
5
+ //display: inline-flex;
6
+ display: flex;
7
+ flex-shrink: 1;
8
+ min-width: 0;
9
+ }
10
+
11
+ /* prettier-ignore */
12
+ .#{$class-prefix-space} {
13
+ display: inline-flex;
14
+ vertical-align: middle;
15
+
16
+ &-vertical {
17
+ flex-direction: column;
18
+
19
+ > .#{$class-prefix-space}-item {
20
+ &:last-child {
21
+ margin-bottom: 0;
22
+ }
23
+ }
24
+ }
25
+
26
+ &-horizontal {
27
+ flex-direction: row;
28
+
29
+ > .#{$class-prefix-space}-item {
30
+ &:last-child {
31
+
32
+ }
33
+ }
34
+
35
+ &.#{$class-prefix-space}-wrap {
36
+ flex-wrap: wrap;
37
+
38
+ > .#{$class-prefix-space}-item {
39
+
40
+ }
41
+ }
42
+ }
43
+
44
+ &.#{$class-prefix-space}-block {
45
+ display: flex;
46
+ width: 100%;
47
+
48
+ .#{$class-prefix-space}-item {
49
+ //display: flex;
50
+ }
51
+
52
+ }
53
+
54
+ &-align {
55
+ &-center {
56
+ align-items: center;
57
+ }
58
+
59
+ &-start {
60
+ align-items: flex-start;
61
+ }
62
+
63
+ &-end {
64
+ align-items: flex-end;
65
+ }
66
+
67
+ &-baseline {
68
+ align-items: baseline;
69
+ }
70
+ }
71
+
72
+ &-justify {
73
+ &-center {
74
+ justify-content: center;
75
+ }
76
+
77
+ &-start {
78
+ justify-content: flex-start;
79
+ }
80
+
81
+ &-end {
82
+ justify-content: flex-end;
83
+ }
84
+
85
+ &-between {
86
+ justify-content: space-between;
87
+ }
88
+
89
+ &-around {
90
+ justify-content: space-around;
91
+ }
92
+
93
+ &-evenly {
94
+ justify-content: space-evenly;
95
+ }
96
+
97
+ &-stretch {
98
+ justify-content: stretch;
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,3 @@
1
+ import { Stepper, StepperProps } from "./stepper";
2
+ export type { StepperProps };
3
+ export default Stepper;
@@ -0,0 +1,2 @@
1
+ import { Stepper } from "./stepper";
2
+ export default Stepper;
@@ -0,0 +1,14 @@
1
+ import React, { FC } from "react";
2
+ import "./style.scss";
3
+ export type StepperProps = {
4
+ value?: number;
5
+ onChange?: (value: number) => void;
6
+ step?: number;
7
+ min?: number;
8
+ max?: number;
9
+ disabled?: boolean;
10
+ block?: boolean;
11
+ className?: string;
12
+ style?: React.CSSProperties;
13
+ };
14
+ export declare const Stepper: FC<StepperProps>;
@@ -0,0 +1,92 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React, { useEffect, useState } from "react";
12
+ import classNames from "classnames";
13
+ import { AddOutline, MinusOutline } from "@trionesdev/antd-mobile-icons-react";
14
+ import "./style.scss";
15
+ function clampValue(n, min, max) {
16
+ var v = n;
17
+ if (min !== undefined) v = Math.max(min, v);
18
+ if (max !== undefined) v = Math.min(max, v);
19
+ return v;
20
+ }
21
+ export var Stepper = function Stepper(_ref) {
22
+ var value = _ref.value,
23
+ onChange = _ref.onChange,
24
+ step = _ref.step,
25
+ min = _ref.min,
26
+ max = _ref.max,
27
+ _ref$disabled = _ref.disabled,
28
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
29
+ _ref$block = _ref.block,
30
+ block = _ref$block === void 0 ? false : _ref$block,
31
+ className = _ref.className,
32
+ style = _ref.style;
33
+ var _useState = useState(value !== null && value !== void 0 ? value : 0),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ internalValue = _useState2[0],
36
+ setInternalValue = _useState2[1];
37
+ var stepSize = step !== null && step !== void 0 ? step : 1;
38
+ useEffect(function () {
39
+ if (value !== undefined) {
40
+ setInternalValue(clampValue(value, min, max));
41
+ }
42
+ }, [value, min, max]);
43
+ var minMatch = min !== undefined && internalValue <= min;
44
+ var maxMatch = max !== undefined && internalValue >= max;
45
+ var trionesStepperCls = 'triones-antm-stepper';
46
+ var setValue = function setValue(next) {
47
+ var clamped = clampValue(next, min, max);
48
+ setInternalValue(clamped);
49
+ onChange === null || onChange === void 0 || onChange(clamped);
50
+ };
51
+ return /*#__PURE__*/React.createElement("div", {
52
+ className: classNames(trionesStepperCls, _defineProperty({}, "".concat(trionesStepperCls, "--block"), block), className),
53
+ style: style
54
+ }, /*#__PURE__*/React.createElement("div", {
55
+ className: classNames("".concat(trionesStepperCls, "-button"), _defineProperty({}, "".concat(trionesStepperCls, "-button-disabled"), minMatch || disabled)),
56
+ role: "button",
57
+ tabIndex: disabled || minMatch ? -1 : 0,
58
+ onClick: function onClick() {
59
+ if (minMatch || disabled) {
60
+ return;
61
+ }
62
+ setValue(internalValue - stepSize);
63
+ }
64
+ }, /*#__PURE__*/React.createElement(MinusOutline, null)), /*#__PURE__*/React.createElement("div", {
65
+ className: "".concat(trionesStepperCls, "-input-wrapper")
66
+ }, /*#__PURE__*/React.createElement("input", {
67
+ className: "".concat(trionesStepperCls, "-input"),
68
+ type: "number",
69
+ disabled: disabled,
70
+ min: min,
71
+ max: max,
72
+ step: stepSize,
73
+ value: internalValue,
74
+ onChange: function onChange(e) {
75
+ var num = Number(e.target.value);
76
+ if (!Number.isFinite(num)) {
77
+ return;
78
+ }
79
+ setValue(num);
80
+ }
81
+ })), /*#__PURE__*/React.createElement("div", {
82
+ className: classNames("".concat(trionesStepperCls, "-button"), _defineProperty({}, "".concat(trionesStepperCls, "-button-disabled"), maxMatch || disabled)),
83
+ role: "button",
84
+ tabIndex: disabled || maxMatch ? -1 : 0,
85
+ onClick: function onClick() {
86
+ if (maxMatch || disabled) {
87
+ return;
88
+ }
89
+ setValue(internalValue + stepSize);
90
+ }
91
+ }, /*#__PURE__*/React.createElement(AddOutline, null)));
92
+ };
@@ -0,0 +1,100 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $trionesStepperCls: 'triones-antm-stepper';
4
+
5
+ $inputNumberBg: #F5F5F5;
6
+ $inputSm: 24Px;
7
+ $inputLg: 40Px;
8
+ $stepperControlHeight: 28Px;
9
+
10
+ .#{$trionesStepperCls} {
11
+ display: inline-flex;
12
+ align-items: stretch;
13
+ gap: 2Px;
14
+ border-radius: variable.$trionesBorderRadiusXs;
15
+ overflow: hidden;
16
+ width: 110Px;
17
+
18
+ &--block {
19
+ display: flex;
20
+ box-sizing: border-box;
21
+ width: 100%;
22
+ max-width: 100%;
23
+ min-width: 0;
24
+ flex: 1 1 auto;
25
+
26
+ .#{$trionesStepperCls}-input {
27
+ flex: 1 1 auto;
28
+ min-width: 0;
29
+
30
+ input {
31
+ width: 100%;
32
+ }
33
+ }
34
+ }
35
+
36
+ &-input-wrapper {
37
+ display: flex;
38
+ align-items: stretch;
39
+ //flex: 0 1 auto;
40
+ min-width: 36Px;
41
+ min-height: $stepperControlHeight;
42
+ }
43
+
44
+ &-input {
45
+ width: 100%;
46
+ min-width: 0;
47
+ height: 100%;
48
+ min-height: $stepperControlHeight;
49
+ box-sizing: border-box;
50
+ margin: 0;
51
+ padding: 0 8Px;
52
+ border: 0;
53
+ border-radius: variable.$trionesBorderRadiusXs;
54
+ background-color: $inputNumberBg;
55
+ color: variable.$trionesColorText;
56
+ font-size: 14Px;
57
+ line-height: $stepperControlHeight;
58
+ text-align: center;
59
+ appearance: textfield;
60
+
61
+ &::-webkit-outer-spin-button,
62
+ &::-webkit-inner-spin-button {
63
+ -webkit-appearance: none;
64
+ margin: 0;
65
+ }
66
+
67
+ &:focus {
68
+ outline: none;
69
+ }
70
+
71
+ &:disabled {
72
+ color: variable.$trionesColorTextDisabled;
73
+ cursor: not-allowed;
74
+ }
75
+ }
76
+
77
+ &-button {
78
+ cursor: pointer;
79
+ display: flex;
80
+ flex-shrink: 0;
81
+ font-size: 10Px;
82
+ height: $stepperControlHeight;
83
+ width: $stepperControlHeight;
84
+ justify-content: center;
85
+ align-items: center;
86
+ background-color: $inputNumberBg;
87
+ border-radius: variable.$trionesBorderRadiusXs;
88
+ color: variable.$trionesColorPrimary;
89
+
90
+
91
+ &-disabled {
92
+ cursor: not-allowed;
93
+ color: variable.$trionesColorTextDisabled;
94
+ }
95
+
96
+ .triones-antm-icon {
97
+ font-size: 12Px !important;
98
+ }
99
+ }
100
+ }