@trionesdev/antd-mobile-react 0.0.2-beta.2 → 0.0.2-beta.4

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 (56) hide show
  1. package/dist/Button/style.scss +40 -38
  2. package/dist/Calendar/style.scss +4 -4
  3. package/dist/CalendarDatetimePicker/style.scss +7 -7
  4. package/dist/CalendarPicker/style.scss +5 -5
  5. package/dist/Cell/demo/base.js +16 -2
  6. package/dist/Checkbox/demo/base.js +9 -4
  7. package/dist/Checkbox/demo/disabled.js +2 -1
  8. package/dist/DemoBlock/index.d.ts +6 -0
  9. package/dist/DemoBlock/index.js +9 -2
  10. package/dist/Form/FormItem/form-item-input.d.ts +15 -0
  11. package/dist/Form/FormItem/form-item-input.js +39 -0
  12. package/dist/Form/FormItem/form-item-label.d.ts +13 -0
  13. package/dist/Form/FormItem/form-item-label.js +27 -0
  14. package/dist/Form/FormItem/form-item.d.ts +22 -0
  15. package/dist/Form/FormItem/form-item.js +73 -0
  16. package/dist/Form/FormItem/index.d.ts +5 -0
  17. package/dist/Form/FormItem/index.js +3 -0
  18. package/dist/Form/demo/input.js +1 -1
  19. package/dist/Form/index.d.ts +8 -1
  20. package/dist/Form/index.js +5 -1
  21. package/dist/Form/style.scss +67 -0
  22. package/dist/ImagesWall/style.scss +4 -4
  23. package/dist/Input/base-input.d.ts +13 -0
  24. package/dist/Input/base-input.js +41 -0
  25. package/dist/Input/demo/base.js +87 -11
  26. package/dist/Input/index.d.ts +14 -2
  27. package/dist/Input/index.js +11 -1
  28. package/dist/Input/index.scss +223 -0
  29. package/dist/Input/input-affix-wrapper.d.ts +11 -0
  30. package/dist/Input/input-affix-wrapper.js +37 -0
  31. package/dist/Input/input-opt.d.ts +16 -0
  32. package/dist/Input/input-opt.js +87 -0
  33. package/dist/Input/input-password.d.ts +7 -0
  34. package/dist/Input/input-password.js +48 -0
  35. package/dist/Input/input.d.ts +18 -0
  36. package/dist/Input/input.js +63 -0
  37. package/dist/Input/textarea.d.ts +15 -0
  38. package/dist/Input/textarea.js +51 -0
  39. package/dist/Input/types.d.ts +3 -0
  40. package/dist/Input/types.js +2 -0
  41. package/dist/Progress/Progress.d.ts +2 -2
  42. package/dist/Progress/ProgressCircle.d.ts +2 -2
  43. package/dist/Progress/ProgressLine.d.ts +2 -2
  44. package/dist/Radio/demo/base.js +2 -2
  45. package/dist/SideBar/style.scss +6 -6
  46. package/dist/Swiper/style.scss +1 -1
  47. package/dist/VerificationCodeInput/demo/base.js +2 -2
  48. package/dist/VerificationCodeInput/index.d.ts +2 -2
  49. package/dist/VerificationCodeInput/index.js +1 -1
  50. package/dist/VerificationCodeInput/style.scss +20 -0
  51. package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
  52. package/dist/VerificationCodeInput/verification-code-input.js +99 -0
  53. package/dist/index.d.ts +1 -1
  54. package/dist/types.d.ts +0 -8
  55. package/dist/types.js +0 -1
  56. package/package.json +7 -7
@@ -0,0 +1,67 @@
1
+ @use "../style/variable" as variable;
2
+ $cls-prefix-form: 'triones-antm-form';
3
+ $cls-prefix-form-item: 'triones-antm-form-item';
4
+
5
+ .#{$cls-prefix-form} {}
6
+
7
+ .#{$cls-prefix-form-item} {
8
+
9
+ &-label {
10
+ font-size: variable.$trionesFontSize;
11
+ padding-block: 4Px;
12
+ color: #6F6F6F;
13
+
14
+
15
+ &-wrapper {
16
+ // height: 1.47059em;
17
+ line-height: 1.47059;
18
+ display: flex;
19
+ align-items: center;
20
+ }
21
+
22
+ &-left {}
23
+
24
+ &-right {
25
+ text-align: right;
26
+ }
27
+
28
+ &-required-mark {
29
+ display: inline-block;
30
+ color: red;
31
+ margin-right: 4Px;
32
+ }
33
+
34
+ }
35
+
36
+ &-input {
37
+
38
+ .#{$cls-prefix-form-item} {
39
+ &-error {
40
+ font-size: variable.$trionesFontSizeSm;
41
+ color: red;
42
+ }
43
+ }
44
+ }
45
+
46
+ &-horizontal {
47
+ display: flex;
48
+ flex-direction: row;
49
+
50
+ .#{$cls-prefix-form-item} {
51
+ &-label {
52
+ flex-shrink: 1;
53
+ min-width: 0;
54
+ }
55
+
56
+ &-input {
57
+ flex: auto 1;
58
+ flex-shrink: 1;
59
+ min-width: 0;
60
+ }
61
+ }
62
+ }
63
+
64
+ &-hidden {
65
+ display: none;
66
+ }
67
+ }
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $imagesWallCls: 'triones-antm-images-wall';
4
4
 
@@ -9,7 +9,7 @@ $imagesWallCls: 'triones-antm-images-wall';
9
9
 
10
10
  &-item {
11
11
  aspect-ratio: 1;
12
- border-radius: $trionesBorderRadius;
12
+ border-radius: variable.$trionesBorderRadius;
13
13
  overflow: hidden;
14
14
  position: relative;
15
15
 
@@ -25,7 +25,7 @@ $imagesWallCls: 'triones-antm-images-wall';
25
25
  background-color: rgb(0 0 0 / 63%);
26
26
  width: 20Px;
27
27
  height: 20Px;
28
- border-bottom-left-radius: $trionesBorderRadius;
28
+ border-bottom-left-radius: variable.$trionesBorderRadius;
29
29
  display: flex;
30
30
  justify-content: center;
31
31
  align-items: center;
@@ -59,7 +59,7 @@ $imagesWallCls: 'triones-antm-images-wall';
59
59
  display: flex;
60
60
  justify-content: center;
61
61
  align-items: center;
62
- background-color: $trionesColorBgTextActive;
62
+ background-color: variable.$trionesColorBgTextActive;
63
63
  }
64
64
 
65
65
  &-action-sheet {
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type BaseInputProps = {
3
+ className?: string;
4
+ style?: React.CSSProperties;
5
+ placeholder?: string;
6
+ type?: 'text' | 'password' | 'textarea';
7
+ disabled?: boolean;
8
+ value?: any;
9
+ onChange?: (e: any) => void;
10
+ };
11
+ export interface BaseInputHandle {
12
+ }
13
+ export declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<BaseInputHandle>>;
@@ -0,0 +1,41 @@
1
+ var _excluded = ["className", "style", "placeholder", "type", "value", "onChange"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ 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."); }
5
+ 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); }
6
+ 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; }
7
+ 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; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
+ import classNames from 'classnames';
12
+ import React, { forwardRef, useEffect, useState } from 'react';
13
+ import { inputCls } from "./types";
14
+ export var BaseInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
15
+ var className = _ref.className,
16
+ style = _ref.style,
17
+ placeholder = _ref.placeholder,
18
+ type = _ref.type,
19
+ value = _ref.value,
20
+ _onChange = _ref.onChange,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+ var _useState = useState(0),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ keySequence = _useState2[0],
25
+ setKeySequence = _useState2[1];
26
+ useEffect(function () {
27
+ setKeySequence(keySequence + 1);
28
+ }, [type]);
29
+ return /*#__PURE__*/React.createElement("input", _extends({
30
+ key: keySequence
31
+ }, props, {
32
+ className: classNames(["".concat(inputCls), className]),
33
+ style: style,
34
+ placeholder: placeholder,
35
+ type: type,
36
+ value: value,
37
+ onChange: function onChange(e) {
38
+ _onChange === null || _onChange === void 0 || _onChange(e.target.value);
39
+ }
40
+ }));
41
+ });
@@ -4,26 +4,102 @@
4
4
  import { DemoBlock } from "../../DemoBlock";
5
5
  import React from 'react';
6
6
  import Input from "../index";
7
+ import Space from "../../Space";
7
8
  export default (function () {
8
9
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
9
- title: "\u57FA\u7840\u7528\u6CD5"
10
+ title: "\u57FA\u7840\u7528\u6CD5",
11
+ styles: {
12
+ body: {
13
+ backgroundColor: '#D5D5D5'
14
+ }
15
+ }
16
+ }, /*#__PURE__*/React.createElement("div", {
17
+ style: {
18
+ backgroundColor: '#FFFFFF'
19
+ }
10
20
  }, /*#__PURE__*/React.createElement(Input, {
11
21
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9"
12
- })), /*#__PURE__*/React.createElement(DemoBlock, {
13
- title: "\u5E26\u6E05\u9664\u6309\u94AE"
22
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
23
+ title: "\u5E26\u6E05\u9664\u6309\u94AE",
24
+ styles: {
25
+ body: {
26
+ backgroundColor: '#D5D5D5'
27
+ }
28
+ }
29
+ }, /*#__PURE__*/React.createElement("div", {
30
+ style: {
31
+ backgroundColor: '#FFFFFF'
32
+ }
14
33
  }, /*#__PURE__*/React.createElement(Input, {
15
34
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
16
35
  allowClear: true
17
- })), /*#__PURE__*/React.createElement(DemoBlock, {
18
- title: "\u5BC6\u7801\u6A21\u5F0F"
36
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
37
+ title: "\u5BC6\u7801\u6A21\u5F0F",
38
+ styles: {
39
+ body: {
40
+ backgroundColor: '#D5D5D5'
41
+ }
42
+ }
43
+ }, /*#__PURE__*/React.createElement("div", {
44
+ style: {
45
+ backgroundColor: '#FFFFFF'
46
+ }
19
47
  }, /*#__PURE__*/React.createElement(Input.Password, {
20
48
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
21
49
  allowClear: true
22
- })), /*#__PURE__*/React.createElement(DemoBlock, {
23
- title: "OPT\u6A21\u5F0F"
24
- }, /*#__PURE__*/React.createElement(Input.OPT, null)), /*#__PURE__*/React.createElement(DemoBlock, {
25
- title: "Textarea"
26
- }, /*#__PURE__*/React.createElement(Input.TextArea, {
50
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
51
+ title: "OPT\u6A21\u5F0F",
52
+ styles: {
53
+ body: {
54
+ backgroundColor: '#D5D5D5'
55
+ }
56
+ }
57
+ }, /*#__PURE__*/React.createElement("div", {
58
+ style: {
59
+ backgroundColor: '#FFFFFF'
60
+ }
61
+ }, /*#__PURE__*/React.createElement(Input.OPT, null))), /*#__PURE__*/React.createElement(DemoBlock, {
62
+ title: "Textarea",
63
+ styles: {
64
+ body: {
65
+ backgroundColor: '#D5D5D5'
66
+ }
67
+ }
68
+ }, /*#__PURE__*/React.createElement(Input.Textarea, {
27
69
  placeholder: '请输入内容'
28
- })));
70
+ })), /*#__PURE__*/React.createElement(DemoBlock, {
71
+ title: "\u53D8\u4F53"
72
+ }, /*#__PURE__*/React.createElement(Space, {
73
+ direction: "vertical",
74
+ block: true
75
+ }, /*#__PURE__*/React.createElement(Input, {
76
+ variant: "outlined",
77
+ placeholder: "outlined"
78
+ }), /*#__PURE__*/React.createElement(Input, {
79
+ variant: "filled",
80
+ placeholder: "filled"
81
+ }), /*#__PURE__*/React.createElement(Input, {
82
+ variant: "borderless",
83
+ placeholder: "borderless"
84
+ }), /*#__PURE__*/React.createElement(Input, {
85
+ variant: "underlined",
86
+ placeholder: "underlined"
87
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
88
+ title: "\u5C3A\u5BF8"
89
+ }, /*#__PURE__*/React.createElement(Space, {
90
+ direction: "vertical",
91
+ block: true
92
+ }, /*#__PURE__*/React.createElement(Input.Textarea, {
93
+ variant: "outlined",
94
+ placeholder: "outlined"
95
+ }), /*#__PURE__*/React.createElement(Input.Textarea, {
96
+ variant: "filled",
97
+ placeholder: "filled"
98
+ }), /*#__PURE__*/React.createElement(Input.Textarea, {
99
+ variant: "borderless",
100
+ placeholder: "borderless"
101
+ }), /*#__PURE__*/React.createElement(Input.Textarea, {
102
+ variant: "underlined",
103
+ placeholder: "underlined"
104
+ }))));
29
105
  });
@@ -1,3 +1,15 @@
1
- import { InputProps, Input, InputOPTProps, InputPasswordProps, InputTextareaProps } from '@trionesdev/antd-mobile-base-react';
2
- export type { InputOPTProps, InputPasswordProps, InputProps, InputTextareaProps, };
1
+ import { InputAffixWrapperProps, InputAffixWrapper } from "./input-affix-wrapper";
2
+ import { InputProps, Input as InternalInput } from './input';
3
+ import { InputOPT, InputOPTProps } from './input-opt';
4
+ import { InputPassword, InputPasswordProps } from './input-password';
5
+ import { InputTextareaProps, Textarea } from './textarea';
6
+ type CompoundedComponent = typeof InternalInput & {
7
+ Password: typeof InputPassword;
8
+ Textarea: typeof Textarea;
9
+ OPT: typeof InputOPT;
10
+ };
11
+ declare const Input: CompoundedComponent;
12
+ export type { InputAffixWrapperProps, InputOPTProps, InputPasswordProps, InputProps, InputTextareaProps, };
13
+ export * from './types';
14
+ export { InputAffixWrapper };
3
15
  export default Input;
@@ -1,2 +1,12 @@
1
- import { Input } from '@trionesdev/antd-mobile-base-react';
1
+ import { InputAffixWrapper } from "./input-affix-wrapper";
2
+ import { Input as InternalInput } from "./input";
3
+ import { InputOPT } from "./input-opt";
4
+ import { InputPassword } from "./input-password";
5
+ import { Textarea } from "./textarea";
6
+ var Input = InternalInput;
7
+ Input.Password = InputPassword;
8
+ Input.OPT = InputOPT;
9
+ Input.Textarea = Textarea;
10
+ export * from "./types";
11
+ export { InputAffixWrapper };
2
12
  export default Input;
@@ -0,0 +1,223 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $inputCls: 'triones-antm-input';
4
+ $inputAffixWrapperCls: 'triones-antm-input-affix-wrapper';
5
+ $inputGroupWrapperCls: 'triones-antm-input-group-wrapper';
6
+ $inputPotCls: 'triones-antm-pot';
7
+
8
+ $inputSm: 24Px;
9
+ $inputMd: 32Px;
10
+ $inputLg: 40Px;
11
+
12
+ $placeholderColor: #808080;
13
+
14
+ .#{$inputCls} {
15
+ box-sizing: border-box;
16
+ display: inline-block;
17
+ position: relative;
18
+ width: 100%;
19
+ min-width: 0;
20
+ transition: all .2s;
21
+ outline: none;
22
+ box-shadow: none;
23
+ border: none;
24
+ border-radius: variable.$trionesBorderRadius;
25
+ font-size: variable.$trionesInputInputFontSize;
26
+ padding: variable.$trionesInputPaddingBlock 0;
27
+
28
+ &-sm {
29
+ max-height: $inputSm;
30
+ }
31
+
32
+ &-lg {
33
+ max-height: $inputLg;
34
+ }
35
+
36
+ &::placeholder {
37
+ font-size: variable.$trionesInputInputFontSize;
38
+ color: $placeholderColor
39
+ }
40
+
41
+
42
+ }
43
+
44
+
45
+ .#{$inputAffixWrapperCls} {
46
+ box-sizing: border-box;
47
+ position: relative;
48
+ display: inline-flex;
49
+ align-items: center;
50
+ width: 100%;
51
+ min-width: 0;
52
+ //line-height: variable.$trionesLineHeight;
53
+ padding: variable.$trionesInputPaddingBlock 0;
54
+ gap: 4Px;
55
+
56
+ .#{$inputCls} {
57
+ padding: 0;
58
+ background-color: transparent;
59
+
60
+ &-prifix {
61
+ }
62
+
63
+ &-suffix {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ flex-shrink: 0;
67
+ gap: 4Px;
68
+
69
+ .clear-icon {
70
+ color: rgba(0, 0, 0, 0.25);
71
+
72
+
73
+ &:hover {
74
+ color: rgba(0, 0, 0, 0.45);
75
+ }
76
+ }
77
+
78
+ .triones-antm-icon {
79
+ cursor: pointer;
80
+ }
81
+ }
82
+ }
83
+
84
+ input {
85
+ // height: 1.47059em;
86
+ line-height: 1.47059;
87
+
88
+ &::placeholder {
89
+ font-size: variable.$trionesInputInputFontSize;
90
+ color: $placeholderColor
91
+ }
92
+ }
93
+ }
94
+
95
+ .#{$inputCls} {
96
+ &-outlined {
97
+ border-radius: variable.$trionesBorderRadius;
98
+ border: 1Px solid variable.$trionesBorderColor;
99
+ padding-inline: 4Px;
100
+ }
101
+
102
+ &-filled {
103
+ border-radius: variable.$trionesBorderRadius;
104
+ background-color: variable.$trionesColorFillTertiary;
105
+ padding-inline: 4Px;
106
+ border: 0;
107
+ }
108
+ &-borderless {
109
+ border: 0;
110
+ }
111
+
112
+ &-underlined {
113
+ border-top: 0;
114
+ border-left: 0;
115
+ border-right: 0;
116
+ border-bottom: 1Px solid variable.$trionesBorderColor;
117
+ }
118
+ }
119
+
120
+ .#{$inputGroupWrapperCls} {
121
+ }
122
+
123
+
124
+ .#{$inputPotCls} {
125
+ position: relative;
126
+ display: inline-flex;
127
+ vertical-align: middle;
128
+
129
+ &-wrapper {
130
+ position: relative;
131
+ display: inline-flex;
132
+ align-items: center;
133
+ flex-wrap: nowrap;
134
+ column-gap: 8Px;
135
+ }
136
+
137
+ &-input {
138
+ position: absolute;
139
+ background-color: transparent;
140
+ z-index: -1;
141
+ left: 0;
142
+ top: 0;
143
+ right: 0;
144
+ bottom: 0;
145
+ opacity: 0;
146
+ -moz-appearance: textfield;
147
+
148
+ &::-webkit-outer-spin-button,
149
+ &::-webkit-inner-spin-button {
150
+ -webkit-appearance: none;
151
+ margin: 0;
152
+ }
153
+ }
154
+
155
+ &-item {
156
+ text-align: center;
157
+ font-size: variable.$trionesInputInputFontSize;
158
+ height: 32Px;
159
+ width: 32Px;
160
+ display: inline-flex;
161
+ align-items: center;
162
+ justify-content: center;
163
+
164
+ &-sm {
165
+ width: $inputSm;
166
+ height: $inputSm;
167
+ }
168
+
169
+ &-lg {
170
+ width: $inputLg;
171
+ height: $inputLg;
172
+ }
173
+
174
+ &::placeholder {
175
+ font-size: variable.$trionesInputInputFontSize;
176
+ color: $placeholderColor
177
+ }
178
+
179
+ &-focus {
180
+ &::after {
181
+ content: ' ';
182
+ height: 100%;
183
+ width: 0.5Px;
184
+ background-color: #0a0a0a;
185
+ transition: transform 0.1s ease;
186
+ animation: blink 1s step-end infinite;
187
+ }
188
+ }
189
+
190
+ }
191
+
192
+ .#{$inputCls}-outlined {
193
+ font-size: variable.$trionesInputInputFontSize;
194
+ color: rgba(0, 0, 0, 0.88);
195
+ background: #ffffff;
196
+ border-width: 1Px;
197
+ border-style: solid;
198
+ border-color: #d9d9d9;
199
+ -webkit-appearance: none;
200
+ -moz-appearance: none;
201
+ appearance: none;
202
+ }
203
+ }
204
+
205
+
206
+ .#{$inputCls}-textarea {
207
+ box-sizing: border-box;
208
+ width: 100%;
209
+ outline: 0;
210
+ padding-block: variable.$trionesInputPaddingBlock;
211
+ font-size: variable.$trionesInputInputFontSize;
212
+
213
+ &::placeholder {
214
+ font-size: variable.$trionesInputInputFontSize;
215
+ color: $placeholderColor
216
+ }
217
+ }
218
+
219
+ @keyframes blink {
220
+ 50% {
221
+ background-color: transparent;
222
+ }
223
+ }
@@ -0,0 +1,11 @@
1
+ import React, { FC, PropsWithChildren } from 'react';
2
+ import { BaseInputProps } from './base-input';
3
+ import { variantType } from "./types";
4
+ export type InputAffixWrapperProps = BaseInputProps & {
5
+ prefix?: React.ReactNode;
6
+ suffix?: React.ReactNode;
7
+ variant?: variantType;
8
+ allowClear?: boolean;
9
+ onClear?: () => void;
10
+ };
11
+ export declare const InputAffixWrapper: FC<PropsWithChildren<InputAffixWrapperProps>>;
@@ -0,0 +1,37 @@
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
+ var _excluded = ["children", "prefix", "suffix", "variant", "allowClear", "value", "onChange", "onClear"];
3
+ 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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
+ 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); }
6
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ import { CloseCircleFill } from "../../../antd-mobile-icons-react";
9
+ import classNames from 'classnames';
10
+ import React from 'react';
11
+ import { inputAffixWrapperCls, inputCls } from "./types";
12
+ export var InputAffixWrapper = function InputAffixWrapper(_ref) {
13
+ var children = _ref.children,
14
+ prefix = _ref.prefix,
15
+ suffix = _ref.suffix,
16
+ _ref$variant = _ref.variant,
17
+ variant = _ref$variant === void 0 ? 'borderless' : _ref$variant,
18
+ allowClear = _ref.allowClear,
19
+ value = _ref.value,
20
+ onChange = _ref.onChange,
21
+ onClear = _ref.onClear,
22
+ rest = _objectWithoutProperties(_ref, _excluded);
23
+ var innerStyle = rest.style || {};
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ className: classNames([inputAffixWrapperCls, _defineProperty({}, "".concat(inputCls, "-").concat(variant), variant), rest.className]),
26
+ style: innerStyle
27
+ }, prefix && /*#__PURE__*/React.createElement("div", {
28
+ className: classNames(["".concat(inputCls, "-prefix")])
29
+ }, prefix), children, (suffix || allowClear) && /*#__PURE__*/React.createElement("div", {
30
+ className: classNames(["".concat(inputCls, "-suffix")])
31
+ }, allowClear && value && /*#__PURE__*/React.createElement(CloseCircleFill, {
32
+ className: "clear-icon",
33
+ onClick: function onClick() {
34
+ onClear === null || onClear === void 0 || onClear();
35
+ }
36
+ }), suffix));
37
+ };
@@ -0,0 +1,16 @@
1
+ import React, { FC } from 'react';
2
+ import './index.scss';
3
+ export type InputOPTProps = {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ length?: number;
7
+ value?: string;
8
+ onChange?: (value: string) => void;
9
+ };
10
+ export type InputOPTItemProps = {
11
+ index: number;
12
+ focusIndex?: number;
13
+ value?: string;
14
+ onFocus?: (index: number) => void;
15
+ };
16
+ export declare const InputOPT: FC<InputOPTProps>;
@@ -0,0 +1,87 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import classNames from 'classnames';
8
+ import React, { useEffect, useRef, useState } from 'react';
9
+ import "./index.scss";
10
+ var cls = 'triones-antm-pot';
11
+ var inputCls = 'triones-antm-input';
12
+ var InputOPTItem = function InputOPTItem(_ref) {
13
+ var index = _ref.index,
14
+ focusIndex = _ref.focusIndex,
15
+ value = _ref.value,
16
+ onFocus = _ref.onFocus;
17
+ var ref = React.useRef(null);
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ ref: ref,
20
+ className: classNames("".concat(inputCls), "".concat(cls, "-item"), "".concat(inputCls, "-outlined")),
21
+ onClick: function onClick() {
22
+ onFocus === null || onFocus === void 0 || onFocus(index);
23
+ }
24
+ }, value);
25
+ };
26
+ export var InputOPT = function InputOPT(_ref2) {
27
+ var className = _ref2.className,
28
+ style = _ref2.style,
29
+ _ref2$length = _ref2.length,
30
+ length = _ref2$length === void 0 ? 6 : _ref2$length,
31
+ value = _ref2.value,
32
+ _onChange = _ref2.onChange;
33
+ var inputRef = useRef();
34
+ var _useState = useState(value || ''),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ inputValue = _useState2[0],
37
+ setInputValue = _useState2[1];
38
+ var _React$useState = React.useState(Array.from({
39
+ length: length
40
+ }).map(function () {
41
+ return '';
42
+ })),
43
+ _React$useState2 = _slicedToArray(_React$useState, 2),
44
+ optValue = _React$useState2[0],
45
+ setOptValue = _React$useState2[1];
46
+ var _useState3 = useState(0),
47
+ _useState4 = _slicedToArray(_useState3, 2),
48
+ focusIndex = _useState4[0],
49
+ setFocusIndex = _useState4[1];
50
+ useEffect(function () {
51
+ setOptValue(Array.from(inputValue !== null && inputValue !== void 0 ? inputValue : ''));
52
+ }, [inputValue]);
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: classNames(cls, className),
55
+ style: style
56
+ }, /*#__PURE__*/React.createElement("div", {
57
+ className: classNames("".concat(cls, "-wrapper")),
58
+ onClick: function onClick() {
59
+ var _inputRef$current;
60
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
61
+ }
62
+ }, Array.from({
63
+ length: length
64
+ }).map(function (_, index) {
65
+ return /*#__PURE__*/React.createElement(InputOPTItem, {
66
+ key: index,
67
+ index: index,
68
+ focusIndex: focusIndex,
69
+ value: (optValue === null || optValue === void 0 ? void 0 : optValue[index]) || '',
70
+ onFocus: function onFocus(index) {
71
+ setFocusIndex(index);
72
+ }
73
+ });
74
+ })), /*#__PURE__*/React.createElement("input", {
75
+ ref: inputRef,
76
+ className: "".concat(cls, "-input"),
77
+ type: "number",
78
+ value: inputValue,
79
+ onChange: function onChange(e) {
80
+ if (e.target.value.length > length) {
81
+ return;
82
+ }
83
+ setInputValue(e.target.value);
84
+ _onChange === null || _onChange === void 0 || _onChange(e.target.value);
85
+ }
86
+ }));
87
+ };