@trionesdev/antd-mobile-base-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 (99) hide show
  1. package/dist/ActionSheet/style.scss +6 -5
  2. package/dist/Alert/style.scss +17 -17
  3. package/dist/Avatar/avatar.d.ts +2 -1
  4. package/dist/Avatar/avatar.js +14 -4
  5. package/dist/Avatar/style.scss +3 -2
  6. package/dist/Card/style.scss +11 -11
  7. package/dist/CascaderPicker/style.scss +3 -3
  8. package/dist/CascaderView/style.scss +2 -2
  9. package/dist/Cell/CellGroup.js +22 -14
  10. package/dist/Cell/cell.js +54 -16
  11. package/dist/Cell/context.d.ts +11 -0
  12. package/dist/Cell/context.js +2 -0
  13. package/dist/Cell/styles.scss +10 -14
  14. package/dist/Cell/types.d.ts +15 -7
  15. package/dist/Checkbox/checkbox-button.d.ts +6 -2
  16. package/dist/Checkbox/checkbox-button.js +5 -17
  17. package/dist/Checkbox/checkbox-group.js +19 -3
  18. package/dist/Checkbox/checkbox-round.d.ts +8 -0
  19. package/dist/Checkbox/checkbox-round.js +35 -0
  20. package/dist/Checkbox/checkbox.js +49 -34
  21. package/dist/Checkbox/index.d.ts +0 -2
  22. package/dist/Checkbox/index.js +0 -2
  23. package/dist/Checkbox/index.scss +48 -34
  24. package/dist/Checkbox/types.d.ts +11 -1
  25. package/dist/Descriptions/style.scss +4 -4
  26. package/dist/Divider/style.scss +5 -5
  27. package/dist/Form/context.d.ts +2 -1
  28. package/dist/Form/form.d.ts +2 -7
  29. package/dist/Form/form.js +4 -3
  30. package/dist/Form/index.d.ts +5 -3
  31. package/dist/Form/index.js +4 -2
  32. package/dist/Form/types.d.ts +7 -0
  33. package/dist/Form/types.js +1 -0
  34. package/dist/InputNumber/input-number.d.ts +3 -0
  35. package/dist/InputNumber/input-number.js +7 -3
  36. package/dist/InputNumber/style.scss +32 -12
  37. package/dist/NavBar/nav-bar.d.ts +1 -0
  38. package/dist/NavBar/nav-bar.js +2 -1
  39. package/dist/NavBar/style.scss +6 -3
  40. package/dist/Picker/style.scss +2 -2
  41. package/dist/Popup/index.d.ts +2 -0
  42. package/dist/Popup/index.js +2 -0
  43. package/dist/Popup/style.scss +3 -3
  44. package/dist/Radio/RadioGroup.js +3 -3
  45. package/dist/Radio/style.scss +24 -21
  46. package/dist/Radio/types.d.ts +6 -4
  47. package/dist/SafeArea/style.scss +5 -3
  48. package/dist/Scaffold/style.scss +2 -1
  49. package/dist/SideBar/style.scss +6 -6
  50. package/dist/Space/space.d.ts +1 -0
  51. package/dist/Space/space.js +17 -6
  52. package/dist/Space/style.scss +3 -0
  53. package/dist/Steps/HorizontalSteps.js +5 -1
  54. package/dist/Steps/style.scss +7 -0
  55. package/dist/Switch/style.scss +6 -6
  56. package/dist/TabBar/index.js +2 -1
  57. package/dist/TabBar/index.scss +3 -2
  58. package/dist/Tabs/style.scss +4 -4
  59. package/dist/Tag/style.scss +14 -14
  60. package/dist/index.d.ts +3 -7
  61. package/dist/index.js +2 -4
  62. package/dist/style/css-variable.scss +6 -0
  63. package/dist/style/style.scss +2 -2
  64. package/dist/style/variable.scss +169 -164
  65. package/dist/types.d.ts +5 -1
  66. package/package.json +4 -4
  67. package/dist/Form/FormItem/form-item-input.d.ts +0 -15
  68. package/dist/Form/FormItem/form-item-input.js +0 -39
  69. package/dist/Form/FormItem/form-item-label.d.ts +0 -13
  70. package/dist/Form/FormItem/form-item-label.js +0 -25
  71. package/dist/Form/FormItem/form-item.d.ts +0 -21
  72. package/dist/Form/FormItem/form-item.js +0 -70
  73. package/dist/Form/FormItem/index.d.ts +0 -5
  74. package/dist/Form/FormItem/index.js +0 -3
  75. package/dist/Form/style.scss +0 -45
  76. package/dist/Input/base-input.d.ts +0 -14
  77. package/dist/Input/base-input.js +0 -63
  78. package/dist/Input/index.d.ts +0 -12
  79. package/dist/Input/index.js +0 -9
  80. package/dist/Input/index.scss +0 -173
  81. package/dist/Input/input-affix-wrapper.d.ts +0 -8
  82. package/dist/Input/input-affix-wrapper.js +0 -50
  83. package/dist/Input/input-opt.d.ts +0 -16
  84. package/dist/Input/input-opt.js +0 -93
  85. package/dist/Input/input-password.d.ts +0 -7
  86. package/dist/Input/input-password.js +0 -47
  87. package/dist/Input/input.d.ts +0 -15
  88. package/dist/Input/input.js +0 -47
  89. package/dist/Input/textarea.d.ts +0 -13
  90. package/dist/Input/textarea.js +0 -45
  91. package/dist/Input/types.d.ts +0 -1
  92. package/dist/Input/types.js +0 -1
  93. package/dist/VerificationCodeInput/demo/base.d.ts +0 -3
  94. package/dist/VerificationCodeInput/demo/base.js +0 -11
  95. package/dist/VerificationCodeInput/index.d.ts +0 -3
  96. package/dist/VerificationCodeInput/index.js +0 -2
  97. package/dist/VerificationCodeInput/style.scss +0 -20
  98. package/dist/VerificationCodeInput/verification-code-input.d.ts +0 -24
  99. package/dist/VerificationCodeInput/verification-code-input.js +0 -99
@@ -0,0 +1,35 @@
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
+ import { CheckOutline } from "../../../antd-mobile-icons-react";
6
+ import classNames from 'classnames';
7
+ import React from 'react';
8
+ import "./index.scss";
9
+ import { cls } from "./types";
10
+ export var CheckboxRound = function CheckboxRound(_ref) {
11
+ var children = _ref.children,
12
+ checked = _ref.checked,
13
+ disabled = _ref.disabled,
14
+ _onClick = _ref.onClick;
15
+ var prefixCls = "".concat(cls, "-round");
16
+ return /*#__PURE__*/React.createElement("label", {
17
+ className: classNames("".concat(prefixCls), _defineProperty({}, "".concat(cls, "-disabled"), disabled)),
18
+ onClick: function onClick() {
19
+ if (disabled) {
20
+ return;
21
+ }
22
+ _onClick === null || _onClick === void 0 || _onClick();
23
+ }
24
+ }, /*#__PURE__*/React.createElement("div", {
25
+ className: classNames("".concat(prefixCls))
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: classNames("".concat(prefixCls, "-fake"))
28
+ }, checked ? /*#__PURE__*/React.createElement("div", {
29
+ className: classNames("".concat(prefixCls, "-fake-checked"))
30
+ }, /*#__PURE__*/React.createElement(CheckOutline, null)) : /*#__PURE__*/React.createElement("div", {
31
+ className: classNames("".concat(prefixCls, "-fake-unchecked"))
32
+ }))), children && /*#__PURE__*/React.createElement("div", {
33
+ className: classNames("".concat(prefixCls, "-content"))
34
+ }, children));
35
+ };
@@ -1,47 +1,62 @@
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); }
1
+ var _excluded = ["shape"];
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
8
  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
9
  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
10
  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
11
  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
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { CheckOutline } from "../../../antd-mobile-icons-react";
12
- import classNames from 'classnames';
13
- import React, { useEffect, useState } from 'react';
13
+ 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; }
14
+ 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; }
15
+ import React, { useContext, useState } from 'react';
14
16
  import "./index.scss";
15
- import { cls } from "./types";
17
+ import { CheckboxRound } from "./checkbox-round";
18
+ import { CheckboxButton } from "./checkbox-button";
19
+ import { CheckboxGroupContext } from "./group-context";
20
+ import { includes } from "lodash-es";
16
21
  export var Checkbox = function Checkbox(_ref) {
17
- var _ref2;
18
- var children = _ref.children,
19
- checked = _ref.checked,
20
- defaultChecked = _ref.defaultChecked,
21
- disabled = _ref.disabled,
22
- onChange = _ref.onChange;
23
- var _useState = useState((_ref2 = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
22
+ var _ref2, _ref3, _rest$checked;
23
+ var _ref$shape = _ref.shape,
24
+ shape = _ref$shape === void 0 ? 'round' : _ref$shape,
25
+ rest = _objectWithoutProperties(_ref, _excluded);
26
+ var ctx = useContext(CheckboxGroupContext);
27
+ var _useState = useState((_ref2 = (_ref3 = (_rest$checked = rest.checked) !== null && _rest$checked !== void 0 ? _rest$checked : rest.defaultChecked) !== null && _ref3 !== void 0 ? _ref3 : ctx.group ? includes(ctx.value || [], rest.value) : false) !== null && _ref2 !== void 0 ? _ref2 : false),
24
28
  _useState2 = _slicedToArray(_useState, 2),
25
29
  innerChecked = _useState2[0],
26
30
  setInnerChecked = _useState2[1];
27
- useEffect(function () {
28
- onChange === null || onChange === void 0 || onChange(innerChecked);
29
- }, [innerChecked]);
30
- var prefixCls = "".concat(cls);
31
- return /*#__PURE__*/React.createElement("label", {
32
- className: classNames("".concat(prefixCls, "-wrapper"), _defineProperty({}, "".concat(prefixCls, "-disabled"), disabled)),
33
- onClick: function onClick() {
34
- setInnerChecked(!innerChecked);
31
+ var handleClick = function handleClick() {
32
+ var _rest$onChange;
33
+ var newValue = !innerChecked;
34
+ setInnerChecked(newValue);
35
+ (_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 || _rest$onChange.call(rest, newValue);
36
+ if (ctx.group) {
37
+ var _onValueChange, _ref4;
38
+ var ctxValue = _toConsumableArray(ctx.value || []);
39
+ if (newValue) {
40
+ ctxValue.push(rest.value);
41
+ } else {
42
+ ctxValue = ctxValue.filter(function (v) {
43
+ return v !== rest.value;
44
+ });
45
+ }
46
+ (_onValueChange = (_ref4 = ctx).onValueChange) === null || _onValueChange === void 0 || _onValueChange.call(_ref4, ctxValue);
35
47
  }
36
- }, /*#__PURE__*/React.createElement("div", {
37
- className: classNames("".concat(prefixCls))
38
- }, /*#__PURE__*/React.createElement("div", {
39
- className: classNames("".concat(prefixCls, "-fake"))
40
- }, innerChecked ? /*#__PURE__*/React.createElement("div", {
41
- className: classNames("".concat(prefixCls, "-fake-checked"))
42
- }, /*#__PURE__*/React.createElement(CheckOutline, null)) : /*#__PURE__*/React.createElement("div", {
43
- className: classNames("".concat(prefixCls, "-fake-unchecked"))
44
- }))), /*#__PURE__*/React.createElement("div", {
45
- className: classNames("".concat(prefixCls, "-content"))
46
- }, children));
48
+ };
49
+ if (shape === 'round') {
50
+ return /*#__PURE__*/React.createElement(CheckboxRound, _extends({}, rest, {
51
+ checked: innerChecked,
52
+ onClick: handleClick
53
+ }));
54
+ }
55
+ if (shape === 'button') {
56
+ return /*#__PURE__*/React.createElement(CheckboxButton, _extends({}, rest, {
57
+ checked: innerChecked,
58
+ onClick: handleClick
59
+ }));
60
+ }
61
+ return null;
47
62
  };
@@ -1,10 +1,8 @@
1
1
  import { Checkbox as InternalCheckbox } from "./checkbox";
2
2
  import { CheckboxGroup } from './checkbox-group';
3
- import { CheckboxButton } from './checkbox-button';
4
3
  import { CheckboxProps } from "./types";
5
4
  type CompoundedComponent = typeof InternalCheckbox & {
6
5
  Group: typeof CheckboxGroup;
7
- Button: typeof CheckboxButton;
8
6
  };
9
7
  declare const Checkbox: CompoundedComponent;
10
8
  export type { CheckboxProps };
@@ -1,7 +1,5 @@
1
1
  import { Checkbox as InternalCheckbox } from "./checkbox";
2
2
  import { CheckboxGroup } from "./checkbox-group";
3
- import { CheckboxButton } from "./checkbox-button";
4
3
  var Checkbox = InternalCheckbox;
5
4
  Checkbox.Group = CheckboxGroup;
6
- Checkbox.Button = CheckboxButton;
7
5
  export default Checkbox;
@@ -1,16 +1,23 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
+
2
3
  $checkboxCls: 'triones-antm-checkbox';
3
4
 
4
- $checkboxDisabledColor:rgba(0,0,0,0.25) !default;
5
+ $checkboxDisabledColor: rgba(0, 0, 0, 0.25) !default;
5
6
 
6
- .#{$checkboxCls}-wrapper{
7
+ .#{$checkboxCls}-group {
8
+ display: flex;
9
+ }
10
+
11
+ .#{$checkboxCls}-round {
7
12
  display: flex;
8
13
  align-items: center;
9
14
  box-sizing: border-box;
10
15
  gap: 8Px;
11
- .#{$checkboxCls}{
16
+
17
+ .#{$checkboxCls}-round {
12
18
  position: relative;
13
- &-input{
19
+
20
+ &-input {
14
21
  cursor: inherit;
15
22
  position: absolute;
16
23
  opacity: 0;
@@ -22,23 +29,29 @@ $checkboxDisabledColor:rgba(0,0,0,0.25) !default;
22
29
  padding: 0;
23
30
  z-index: 1;
24
31
  }
25
- &-fake{
26
- width: 22PX;
27
- height: 22PX;
28
- .triones-antm-icon{
32
+
33
+ &-fake {
34
+ width: 20PX;
35
+ height: 20PX;
36
+
37
+ .triones-antm-icon {
29
38
  //position: absolute;
30
39
  }
31
- &-checked{
40
+
41
+ &-checked {
32
42
  height: 100%;
33
43
  width: 100%;
34
44
  display: inline-flex;
35
45
  justify-content: center;
36
46
  align-items: center;
37
- background-color: $trionesColorPrimary;
47
+ background-color: variable.$trionesColorPrimary;
38
48
  color: white;
39
49
  border-radius: 50vh;
40
50
  box-sizing: border-box;
41
51
  overflow: hidden;
52
+ .triones-antm-icon{
53
+ font-size: 14Px;
54
+ }
42
55
  //i{
43
56
  // width: 100%;
44
57
  // height: 100%;
@@ -47,24 +60,26 @@ $checkboxDisabledColor:rgba(0,0,0,0.25) !default;
47
60
  // justify-content: center;
48
61
  //}
49
62
  }
50
- &-unchecked{
63
+
64
+ &-unchecked {
51
65
  height: 100%;
52
66
  width: 100%;
53
67
  display: inline-flex;
54
68
  justify-content: center;
55
69
  align-items: center;
56
70
  border-radius: 50vh;
57
- border: 1PX solid $trionesBorderColor;
71
+ border: 1PX solid variable.$trionesBorderColor;
58
72
  box-sizing: border-box;
59
73
  }
60
74
  }
61
75
  }
62
76
 
63
77
 
64
- &.#{$checkboxCls}-disabled{
78
+ &.#{$checkboxCls}-disabled {
65
79
  color: $checkboxDisabledColor;
66
80
  pointer-events: none;
67
- .#{$checkboxCls}-fake-checked{
81
+
82
+ .#{$checkboxCls}-fake-checked {
68
83
  background-color: $checkboxDisabledColor;
69
84
  }
70
85
  }
@@ -75,41 +90,40 @@ $checkboxDisabledColor:rgba(0,0,0,0.25) !default;
75
90
  }
76
91
 
77
92
 
78
-
79
- .#{$checkboxCls}-group{
80
- display: flex;
81
- }
82
-
83
- .#{$checkboxCls}-button{
93
+ .#{$checkboxCls}-button {
84
94
  cursor: pointer;
85
95
  display: inline-flex;
86
96
  padding: 4Px 12Px;
87
- border-radius: 8Px;
97
+ border-radius: variable.$trionesBorderRadius;
88
98
  position: relative;
89
99
  overflow: hidden;
90
- background-color: #f6f6f6;
100
+ background-color: variable.$trionesColorFillSecondary;
91
101
  box-sizing: border-box;
102
+ border: 1Px solid variable.$trionesColorFillSecondary;
92
103
 
93
104
  &-checked {
94
105
  background-color: #ffffff;
95
- border: 1Px solid #1677ff;
106
+ border: 1Px solid variable.$trionesColorPrimary;
96
107
 
97
108
  .#{$checkboxCls}-button-content {
98
- color: #1677ff;
109
+ color: variable.$trionesColorPrimary;
99
110
  }
100
111
  }
101
112
 
102
113
  &-disabled {
103
114
  pointer-events: none;
104
115
  color: $checkboxDisabledColor;
105
- &.#{$checkboxCls}-button {
106
- &-checked{
107
- border: 1Px solid $checkboxDisabledColor;
108
- .#{$checkboxCls}-button-content {
109
- color: $checkboxDisabledColor;
110
- }
116
+
117
+ &.#{$checkboxCls}-button {
118
+ &-checked {
119
+ border: 1Px solid $checkboxDisabledColor;
120
+
121
+ .#{$checkboxCls}-button-content {
122
+ color: $checkboxDisabledColor;
111
123
  }
112
- .#{$checkboxCls}-button-icon{
124
+ }
125
+
126
+ .#{$checkboxCls}-button-icon {
113
127
  border-bottom: 10Px solid $checkboxDisabledColor;
114
128
  border-right: 10Px solid $checkboxDisabledColor;
115
129
  }
@@ -120,9 +134,9 @@ $checkboxDisabledColor:rgba(0,0,0,0.25) !default;
120
134
 
121
135
  &-icon {
122
136
  align-items: flex-end;
123
- border-bottom: 10Px solid $trionesColorPrimary;
137
+ border-bottom: 10Px solid variable.$trionesColorPrimary;
124
138
  border-left: 10Px solid transparent;
125
- border-right: 10Px solid $trionesColorPrimary;
139
+ border-right: 10Px solid variable.$trionesColorPrimary;
126
140
  border-top: 10Px solid transparent;
127
141
  bottom: 0;
128
142
  display: flex;
@@ -1,14 +1,23 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  export declare const cls = "triones-antm-checkbox";
3
3
  export type CheckboxGroupContextType = {
4
+ group?: boolean;
5
+ value?: any;
6
+ onValueChange?: (v: any) => void;
7
+ };
8
+ export type Shape = 'button' | 'round';
9
+ export type CheckboxOptionProps = {
10
+ label?: ReactNode;
4
11
  value?: any;
5
- handleCheck?: (v: any) => void;
6
12
  };
7
13
  export type CheckboxGroupProps = {
8
14
  value?: any[];
9
15
  defaultValue?: any[];
10
16
  onChange?: (v: any[]) => void;
11
17
  children?: ReactNode;
18
+ shape?: Shape;
19
+ options?: CheckboxOptionProps[];
20
+ direction?: 'horizontal' | 'vertical';
12
21
  };
13
22
  export type CheckboxProps = {
14
23
  children?: React.ReactNode;
@@ -17,4 +26,5 @@ export type CheckboxProps = {
17
26
  value?: any;
18
27
  disabled?: boolean;
19
28
  onChange?: (e: any) => void;
29
+ shape?: Shape;
20
30
  };
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $descriptionsCls: 'triones-antm-descriptions';
4
4
  .#{$descriptionsCls} {
@@ -19,7 +19,7 @@ $descriptionsCls: 'triones-antm-descriptions';
19
19
  padding: 4Px 4Px;
20
20
  overflow: hidden;
21
21
  &-label {
22
- color: $trionesColorTextSecondary;
22
+ color: variable.$trionesColorTextSecondary;
23
23
  word-wrap: break-word; /* 允许长单词或URL换行 */
24
24
  overflow-wrap: break-word; /* 更标准的属性名 */
25
25
  white-space: normal; /* 默认换行行为 */
@@ -38,8 +38,8 @@ $descriptionsCls: 'triones-antm-descriptions';
38
38
  }
39
39
 
40
40
  &-bordered {
41
- border: 1Px solid $trionesBorderColor;
42
- border-radius: $trionesBorderRadius;
41
+ border: 1Px solid variable.$trionesBorderColor;
42
+ border-radius: variable.$trionesBorderRadius;
43
43
  overflow: hidden;
44
44
 
45
45
  .#{$descriptionsCls} {
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $dividerCls: 'triones-antm-divider';
4
4
  /* prettier-ignore */
@@ -6,8 +6,8 @@ $dividerCls: 'triones-antm-divider';
6
6
  display: flex;
7
7
  align-items: center;
8
8
  font-size: 14PX;
9
- color: $trionesBorderColor;
10
- border: 0 solid $trionesBorderColor ;
9
+ color: variable.$trionesBorderColor;
10
+ border: 0 solid variable.$trionesBorderColor ;
11
11
  width: 100%;
12
12
 
13
13
  &::before,
@@ -15,8 +15,8 @@ $dividerCls: 'triones-antm-divider';
15
15
  content: '';
16
16
  border-style: inherit;
17
17
  border-color: inherit;
18
- border-width: 2PX 0 0;
19
- height: 2PX;
18
+ border-width: 1PX 0 0;
19
+ height: 1PX;
20
20
  flex: 1;
21
21
  }
22
22
 
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { FormLayout, FormLayoutAlign, RequiredMark } from "./form";
2
+ import { FormLayout, FormLayoutAlign, RequiredMark } from "./types";
3
3
  export interface FormContextProps {
4
4
  colon?: boolean;
5
5
  layout?: FormLayout;
@@ -8,5 +8,6 @@ export interface FormContextProps {
8
8
  requiredMark?: RequiredMark;
9
9
  form?: any;
10
10
  hiddenError?: boolean;
11
+ extra?: React.ReactNode;
11
12
  }
12
13
  export declare const FormContext: React.Context<FormContextProps>;
@@ -3,13 +3,7 @@ import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
3
3
  import type { FormRef } from 'rc-field-form/lib/interface';
4
4
  import React from 'react';
5
5
  import { FormInstance } from './interface';
6
- import './style.scss';
7
- export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
8
- required: boolean;
9
- }) => React.ReactNode);
10
- export type FormLayout = 'horizontal' | 'inline' | 'vertical';
11
- export type FormItemLayout = 'horizontal' | 'vertical';
12
- export type FormLayoutAlign = 'left' | 'right';
6
+ import { FormLayout, FormLayoutAlign, RequiredMark } from "./types";
13
7
  export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form' | 'component'> {
14
8
  /**
15
9
  * @description 配置 Form.Item 的 colon 的默认值。表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效)
@@ -38,6 +32,7 @@ export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form
38
32
  * @default false
39
33
  */
40
34
  hiddenError?: boolean;
35
+ extra?: React.ReactNode;
41
36
  }
42
37
  export declare const InternalForm: React.ForwardRefRenderFunction<FormRef, FormProps>;
43
38
  export { useWatch };
package/dist/Form/form.js CHANGED
@@ -1,11 +1,10 @@
1
- var _excluded = ["children", "layout", "labelAlign", "labelWidth", "requiredMark", "hiddenError"];
1
+ var _excluded = ["children", "layout", "labelAlign", "labelWidth", "requiredMark", "hiddenError", "extra"];
2
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
3
  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; }
4
4
  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; }
5
5
  import FieldForm, { useWatch } from 'rc-field-form';
6
6
  import React from 'react';
7
7
  import { FormContext } from "./context";
8
- import "./style.scss";
9
8
  export var InternalForm = function InternalForm(_ref, ref) {
10
9
  var children = _ref.children,
11
10
  layout = _ref.layout,
@@ -14,6 +13,7 @@ export var InternalForm = function InternalForm(_ref, ref) {
14
13
  requiredMark = _ref.requiredMark,
15
14
  _ref$hiddenError = _ref.hiddenError,
16
15
  hiddenError = _ref$hiddenError === void 0 ? false : _ref$hiddenError,
16
+ extra = _ref.extra,
17
17
  props = _objectWithoutProperties(_ref, _excluded);
18
18
  return /*#__PURE__*/React.createElement(FormContext.Provider, {
19
19
  value: {
@@ -21,7 +21,8 @@ export var InternalForm = function InternalForm(_ref, ref) {
21
21
  labelAlign: labelAlign || 'left',
22
22
  labelWidth: labelWidth,
23
23
  requiredMark: requiredMark || true,
24
- hiddenError: hiddenError
24
+ hiddenError: hiddenError,
25
+ extra: extra
25
26
  }
26
27
  }, /*#__PURE__*/React.createElement(FieldForm, _extends({}, props, {
27
28
  component: false
@@ -1,12 +1,14 @@
1
+ import FieldForm from 'rc-field-form';
1
2
  import InternalForm, { FormProps, useWatch } from "./form";
2
- import FormItem, { FormItemProps } from "./FormItem";
3
3
  import useForm from "./hooks/useForm";
4
+ import { FormItemLayout, FormLayout, FormLayoutAlign } from "./types";
5
+ export { useFormContext } from "./hooks/useFormContext";
4
6
  type InternalFormType = typeof InternalForm;
5
7
  type CompoundedComponent = InternalFormType & {
6
8
  useForm: typeof useForm;
7
- Item: typeof FormItem;
9
+ List: typeof FieldForm.List;
8
10
  useWatch: typeof useWatch;
9
11
  };
10
12
  declare const Form: CompoundedComponent;
11
- export type { FormProps, FormItemProps };
13
+ export type { FormProps, FormLayout, FormLayoutAlign, FormItemLayout };
12
14
  export default Form;
@@ -1,8 +1,10 @@
1
+ import FieldForm from 'rc-field-form';
1
2
  import InternalForm, { useWatch } from "./form";
2
- import FormItem from "./FormItem";
3
3
  import useForm from "./hooks/useForm";
4
+ export { useFormContext } from "./hooks/useFormContext";
4
5
  var Form = InternalForm;
6
+ Form.List = FieldForm.List;
5
7
  Form.useForm = useForm;
6
- Form.Item = FormItem;
8
+ // Form.Item = FormItem;
7
9
  Form.useWatch = useWatch;
8
10
  export default Form;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
3
+ required: boolean;
4
+ }) => React.ReactNode);
5
+ export type FormLayout = 'horizontal' | 'inline' | 'vertical';
6
+ export type FormItemLayout = 'horizontal' | 'vertical';
7
+ export type FormLayoutAlign = 'left' | 'right';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,12 +1,15 @@
1
1
  import React from "react";
2
2
  import { FC } from "react";
3
3
  import "./style.scss";
4
+ import { SizeType } from "../types";
4
5
  export type InputNumberProps = {
6
+ size?: SizeType;
5
7
  value?: number;
6
8
  onChange?: (value: number) => void;
7
9
  step?: number;
8
10
  min?: number;
9
11
  max?: number;
12
+ disabled?: boolean;
10
13
  className?: string;
11
14
  style?: React.CSSProperties;
12
15
  };
@@ -13,11 +13,14 @@ import classNames from "classnames";
13
13
  import { AddOutline, MinusOutline } from "../../../antd-mobile-icons-react";
14
14
  import "./style.scss";
15
15
  export var InputNumber = function InputNumber(_ref) {
16
- var value = _ref.value,
16
+ var size = _ref.size,
17
+ value = _ref.value,
17
18
  _onChange = _ref.onChange,
18
19
  step = _ref.step,
19
20
  min = _ref.min,
20
21
  max = _ref.max,
22
+ _ref$disabled = _ref.disabled,
23
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
21
24
  className = _ref.className,
22
25
  style = _ref.style;
23
26
  var _React$useState = React.useState(value || 0),
@@ -38,7 +41,7 @@ export var InputNumber = function InputNumber(_ref) {
38
41
  className: classNames(trionesInputNumberCls, className),
39
42
  style: style
40
43
  }, /*#__PURE__*/React.createElement("div", {
41
- className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), minMatch)),
44
+ className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(trionesInputNumberCls, "-button-sm"), size == 'small'), "".concat(trionesInputNumberCls, "-button-lg"), size == 'large'), "".concat(trionesInputNumberCls, "-button-disabled"), minMatch || disabled)),
42
45
  onClick: function onClick() {
43
46
  if (minMatch) {
44
47
  return;
@@ -49,6 +52,7 @@ export var InputNumber = function InputNumber(_ref) {
49
52
  }
50
53
  }, /*#__PURE__*/React.createElement(MinusOutline, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
51
54
  type: "number",
55
+ disabled: disabled,
52
56
  value: internalValue,
53
57
  onChange: function onChange(e) {
54
58
  var newVal = Number(e.target.value);
@@ -56,7 +60,7 @@ export var InputNumber = function InputNumber(_ref) {
56
60
  _onChange === null || _onChange === void 0 || _onChange(newVal);
57
61
  }
58
62
  })), /*#__PURE__*/React.createElement("div", {
59
- className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), maxMatch)),
63
+ className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(trionesInputNumberCls, "-button-sm"), size == 'small'), "".concat(trionesInputNumberCls, "-button-lg"), size == 'large'), "".concat(trionesInputNumberCls, "-button-disabled"), maxMatch || disabled)),
60
64
  onClick: function onClick() {
61
65
  if (maxMatch) {
62
66
  return;