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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +51 -10
  26. package/dist/Input/index.d.ts +14 -2
  27. package/dist/Input/index.js +11 -1
  28. package/dist/Input/index.scss +199 -0
  29. package/dist/Input/input-affix-wrapper.d.ts +9 -0
  30. package/dist/Input/input-affix-wrapper.js +31 -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 +16 -0
  36. package/dist/Input/input.js +63 -0
  37. package/dist/Input/textarea.d.ts +13 -0
  38. package/dist/Input/textarea.js +45 -0
  39. package/dist/Input/types.d.ts +2 -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 +6 -6
@@ -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
+ });
@@ -6,24 +6,65 @@ import React from 'react';
6
6
  import Input from "../index";
7
7
  export default (function () {
8
8
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
9
- title: "\u57FA\u7840\u7528\u6CD5"
9
+ title: "\u57FA\u7840\u7528\u6CD5",
10
+ styles: {
11
+ body: {
12
+ backgroundColor: '#D5D5D5'
13
+ }
14
+ }
15
+ }, /*#__PURE__*/React.createElement("div", {
16
+ style: {
17
+ backgroundColor: '#FFFFFF'
18
+ }
10
19
  }, /*#__PURE__*/React.createElement(Input, {
11
20
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9"
12
- })), /*#__PURE__*/React.createElement(DemoBlock, {
13
- title: "\u5E26\u6E05\u9664\u6309\u94AE"
21
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
22
+ title: "\u5E26\u6E05\u9664\u6309\u94AE",
23
+ styles: {
24
+ body: {
25
+ backgroundColor: '#D5D5D5'
26
+ }
27
+ }
28
+ }, /*#__PURE__*/React.createElement("div", {
29
+ style: {
30
+ backgroundColor: '#FFFFFF'
31
+ }
14
32
  }, /*#__PURE__*/React.createElement(Input, {
15
33
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
16
34
  allowClear: true
17
- })), /*#__PURE__*/React.createElement(DemoBlock, {
18
- title: "\u5BC6\u7801\u6A21\u5F0F"
35
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
36
+ title: "\u5BC6\u7801\u6A21\u5F0F",
37
+ styles: {
38
+ body: {
39
+ backgroundColor: '#D5D5D5'
40
+ }
41
+ }
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ style: {
44
+ backgroundColor: '#FFFFFF'
45
+ }
19
46
  }, /*#__PURE__*/React.createElement(Input.Password, {
20
47
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
21
48
  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, {
49
+ }))), /*#__PURE__*/React.createElement(DemoBlock, {
50
+ title: "OPT\u6A21\u5F0F",
51
+ styles: {
52
+ body: {
53
+ backgroundColor: '#D5D5D5'
54
+ }
55
+ }
56
+ }, /*#__PURE__*/React.createElement("div", {
57
+ style: {
58
+ backgroundColor: '#FFFFFF'
59
+ }
60
+ }, /*#__PURE__*/React.createElement(Input.OPT, null))), /*#__PURE__*/React.createElement(DemoBlock, {
61
+ title: "Textarea",
62
+ styles: {
63
+ body: {
64
+ backgroundColor: '#D5D5D5'
65
+ }
66
+ }
67
+ }, /*#__PURE__*/React.createElement(Input.Textarea, {
27
68
  placeholder: '请输入内容'
28
69
  })));
29
70
  });
@@ -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,199 @@
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
+
57
+
58
+ .#{$inputCls} {
59
+ padding: 0;
60
+ background-color: transparent;
61
+
62
+ &-prifix {}
63
+
64
+ &-suffix {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ flex-shrink: 0;
68
+ gap: 4Px;
69
+
70
+ .clear-icon {
71
+ color: rgba(0, 0, 0, 0.25);
72
+
73
+
74
+ &:hover {
75
+ color: rgba(0, 0, 0, 0.45);
76
+ }
77
+ }
78
+
79
+ .triones-antm-icon {
80
+ cursor: pointer;
81
+ }
82
+ }
83
+ }
84
+
85
+ input {
86
+ // height: 1.47059em;
87
+ line-height: 1.47059;
88
+
89
+ &::placeholder {
90
+ font-size: variable.$trionesInputInputFontSize;
91
+ color: $placeholderColor
92
+ }
93
+ }
94
+ }
95
+
96
+ .#{$inputGroupWrapperCls} {}
97
+
98
+
99
+ .#{$inputPotCls} {
100
+ position: relative;
101
+ display: inline-flex;
102
+ vertical-align: middle;
103
+
104
+ &-wrapper {
105
+ position: relative;
106
+ display: inline-flex;
107
+ align-items: center;
108
+ flex-wrap: nowrap;
109
+ column-gap: 8Px;
110
+ }
111
+
112
+ &-input {
113
+ position: absolute;
114
+ background-color: transparent;
115
+ z-index: -1;
116
+ left: 0;
117
+ top: 0;
118
+ right: 0;
119
+ bottom: 0;
120
+ opacity: 0;
121
+ -moz-appearance: textfield;
122
+
123
+ &::-webkit-outer-spin-button,
124
+ &::-webkit-inner-spin-button {
125
+ -webkit-appearance: none;
126
+ margin: 0;
127
+ }
128
+ }
129
+
130
+ &-item {
131
+ text-align: center;
132
+ font-size: variable.$trionesInputInputFontSize;
133
+ height: 32Px;
134
+ width: 32Px;
135
+ display: inline-flex;
136
+ align-items: center;
137
+ justify-content: center;
138
+
139
+ &-sm {
140
+ width: $inputSm;
141
+ height: $inputSm;
142
+ }
143
+
144
+ &-lg {
145
+ width: $inputLg;
146
+ height: $inputLg;
147
+ }
148
+
149
+ &::placeholder {
150
+ font-size: variable.$trionesInputInputFontSize;
151
+ color: $placeholderColor
152
+ }
153
+
154
+ &-focus {
155
+ &::after {
156
+ content: ' ';
157
+ height: 100%;
158
+ width: 0.5Px;
159
+ background-color: #0a0a0a;
160
+ transition: transform 0.1s ease;
161
+ animation: blink 1s step-end infinite;
162
+ }
163
+ }
164
+
165
+ }
166
+
167
+ .#{$inputCls}-outlined {
168
+ font-size: variable.$trionesInputInputFontSize;
169
+ color: rgba(0, 0, 0, 0.88);
170
+ background: #ffffff;
171
+ border-width: 1Px;
172
+ border-style: solid;
173
+ border-color: #d9d9d9;
174
+ -webkit-appearance: none;
175
+ -moz-appearance: none;
176
+ appearance: none;
177
+ }
178
+ }
179
+
180
+
181
+ .#{$inputCls}-textarea {
182
+ box-sizing: border-box;
183
+ width: 100%;
184
+ border: 0;
185
+ outline: 0;
186
+ padding: variable.$trionesInputPaddingBlock 0;
187
+ font-size: variable.$trionesInputInputFontSize;
188
+
189
+ &::placeholder {
190
+ font-size: variable.$trionesInputInputFontSize;
191
+ color: $placeholderColor
192
+ }
193
+ }
194
+
195
+ @keyframes blink {
196
+ 50% {
197
+ background-color: transparent;
198
+ }
199
+ }
@@ -0,0 +1,9 @@
1
+ import React, { FC, PropsWithChildren } from 'react';
2
+ import { BaseInputProps } from './base-input';
3
+ export type InputAffixWrapperProps = BaseInputProps & {
4
+ prefix?: React.ReactNode;
5
+ suffix?: React.ReactNode;
6
+ allowClear?: boolean;
7
+ onClear?: () => void;
8
+ };
9
+ export declare const InputAffixWrapper: FC<PropsWithChildren<InputAffixWrapperProps>>;
@@ -0,0 +1,31 @@
1
+ var _excluded = ["children", "prefix", "suffix", "allowClear", "value", "onChange", "onClear"];
2
+ 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; }
3
+ 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; }
4
+ import { CloseCircleFill } from "../../../antd-mobile-icons-react";
5
+ import classNames from 'classnames';
6
+ import React from 'react';
7
+ import { inputAffixWrapperCls, inputCls } from "./types";
8
+ export var InputAffixWrapper = function InputAffixWrapper(_ref) {
9
+ var children = _ref.children,
10
+ prefix = _ref.prefix,
11
+ suffix = _ref.suffix,
12
+ allowClear = _ref.allowClear,
13
+ value = _ref.value,
14
+ onChange = _ref.onChange,
15
+ onClear = _ref.onClear,
16
+ rest = _objectWithoutProperties(_ref, _excluded);
17
+ var innerStyle = rest.style || {};
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: classNames([inputAffixWrapperCls]),
20
+ style: innerStyle
21
+ }, prefix && /*#__PURE__*/React.createElement("div", {
22
+ className: classNames(["".concat(inputCls, "-prefix")])
23
+ }, prefix), children, (suffix || allowClear) && /*#__PURE__*/React.createElement("div", {
24
+ className: classNames(["".concat(inputCls, "-suffix")])
25
+ }, allowClear && value && /*#__PURE__*/React.createElement(CloseCircleFill, {
26
+ className: "clear-icon",
27
+ onClick: function onClick() {
28
+ onClear === null || onClear === void 0 || onClear();
29
+ }
30
+ }), suffix));
31
+ };
@@ -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
+ };
@@ -0,0 +1,7 @@
1
+ import React, { FC } from 'react';
2
+ import { InputProps } from './input';
3
+ export type InputPasswordProps = Omit<InputProps, 'type'> & {
4
+ iconRender?: (visible: boolean) => React.ReactNode;
5
+ visibilityToggle?: boolean;
6
+ };
7
+ export declare const InputPassword: FC<InputPasswordProps>;
@@ -0,0 +1,48 @@
1
+ var _excluded = ["iconRender", "visibilityToggle", "suffix"];
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 { EyeInvisibleOutline, EyeOutline } from "../../../antd-mobile-icons-react";
12
+ import React, { useState } from 'react';
13
+ import { Input } from "./input";
14
+ export var InputPassword = function InputPassword(_ref) {
15
+ var iconRender = _ref.iconRender,
16
+ _ref$visibilityToggle = _ref.visibilityToggle,
17
+ visibilityToggle = _ref$visibilityToggle === void 0 ? true : _ref$visibilityToggle,
18
+ suffix = _ref.suffix,
19
+ rest = _objectWithoutProperties(_ref, _excluded);
20
+ var _useState = useState(false),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ visible = _useState2[0],
23
+ setVisible = _useState2[1];
24
+ var toggleRender = function toggleRender() {
25
+ if (iconRender) {
26
+ return iconRender(visible);
27
+ } else {
28
+ return /*#__PURE__*/React.createElement(React.Fragment, null, visible ? /*#__PURE__*/React.createElement(EyeOutline, {
29
+ onClick: function onClick() {
30
+ return setVisible(false);
31
+ }
32
+ }) : /*#__PURE__*/React.createElement(EyeInvisibleOutline, {
33
+ onClick: function onClick() {
34
+ return setVisible(true);
35
+ }
36
+ }));
37
+ }
38
+ };
39
+ return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
40
+ type: visible ? 'text' : 'password',
41
+ suffix: /*#__PURE__*/React.createElement(React.Fragment, null, ' ', visibilityToggle && /*#__PURE__*/React.createElement("div", {
42
+ style: {
43
+ paddingLeft: 4,
44
+ paddingRight: 4
45
+ }
46
+ }, toggleRender()), " ", suffix, ' ')
47
+ }));
48
+ };