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

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 (226) hide show
  1. package/dist/Alert/alert.js +1 -1
  2. package/dist/Alert/style.scss +17 -17
  3. package/dist/Avatar/avatar.d.ts +4 -1
  4. package/dist/Avatar/avatar.js +19 -6
  5. package/dist/Avatar/style.scss +3 -2
  6. package/dist/Card/style.scss +12 -12
  7. package/dist/CascaderView/cascader-column-item.js +1 -1
  8. package/dist/CascaderView/style.scss +2 -2
  9. package/dist/Cell/CellGroup.js +53 -14
  10. package/dist/Cell/cell.js +52 -15
  11. package/dist/Cell/context.d.ts +19 -0
  12. package/dist/Cell/context.js +2 -0
  13. package/dist/Cell/styles.scss +42 -13
  14. package/dist/Cell/types.d.ts +30 -7
  15. package/dist/Checkbox/checkbox-button.d.ts +6 -2
  16. package/dist/Checkbox/checkbox-button.js +6 -18
  17. package/dist/Checkbox/checkbox-group.js +19 -4
  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/ConfigProvider/config-provider.d.ts +1 -0
  26. package/dist/Descriptions/style.scss +4 -4
  27. package/dist/Divider/divider.d.ts +1 -1
  28. package/dist/Divider/divider.js +5 -3
  29. package/dist/Divider/style.scss +7 -7
  30. package/dist/Form/ErrorList.d.ts +4 -0
  31. package/dist/Form/ErrorList.js +9 -0
  32. package/dist/Form/context.d.ts +5 -2
  33. package/dist/Form/context.js +2 -1
  34. package/dist/Form/form.d.ts +25 -12
  35. package/dist/Form/form.js +25 -13
  36. package/dist/Form/hooks/useForm.js +1 -8
  37. package/dist/Form/hooks/useFormContext.js +1 -2
  38. package/dist/Form/index.d.ts +8 -3
  39. package/dist/Form/index.js +7 -2
  40. package/dist/Form/styles.scss +11 -0
  41. package/dist/Form/types.d.ts +8 -0
  42. package/dist/FormCell/FormCell.d.ts +22 -0
  43. package/dist/FormCell/FormCell.js +57 -0
  44. package/dist/FormCell/index.d.ts +4 -0
  45. package/dist/FormCell/index.js +3 -0
  46. package/dist/FormCell/styles.scss +103 -0
  47. package/dist/IndexedStack/IndexedStack.d.ts +9 -0
  48. package/dist/IndexedStack/IndexedStack.js +27 -0
  49. package/dist/IndexedStack/index.d.ts +3 -0
  50. package/dist/IndexedStack/index.js +2 -0
  51. package/dist/InputNumber/input-number.d.ts +3 -2
  52. package/dist/InputNumber/input-number.js +48 -26
  53. package/dist/InputNumber/style.scss +79 -22
  54. package/dist/Loading/DotLoading.d.ts +7 -0
  55. package/dist/{Mask/mask-modal.js → Loading/DotLoading.js} +25 -25
  56. package/dist/{SpinLoading/spin-loading.d.ts → Loading/SpinLoading.d.ts} +0 -1
  57. package/dist/Loading/SpinLoading.js +69 -0
  58. package/dist/Loading/index.d.ts +6 -0
  59. package/dist/Loading/index.js +4 -0
  60. package/dist/Loading/style.scss +113 -0
  61. package/dist/NavBar/nav-bar.d.ts +1 -0
  62. package/dist/NavBar/nav-bar.js +3 -2
  63. package/dist/NavBar/style.scss +7 -3
  64. package/dist/Progress/Progress.d.ts +39 -0
  65. package/dist/Progress/Progress.js +56 -0
  66. package/dist/Progress/ProgressCircle.d.ts +15 -0
  67. package/dist/Progress/ProgressCircle.js +117 -0
  68. package/dist/Progress/ProgressLine.d.ts +15 -0
  69. package/dist/Progress/ProgressLine.js +87 -0
  70. package/dist/Progress/index.d.ts +3 -0
  71. package/dist/Progress/index.js +2 -0
  72. package/dist/Progress/style.scss +33 -0
  73. package/dist/Progress/types.d.ts +6 -0
  74. package/dist/Progress/types.js +2 -0
  75. package/dist/Radio/RadioGroup.js +3 -3
  76. package/dist/Radio/radio.js +1 -1
  77. package/dist/Radio/style.scss +40 -24
  78. package/dist/Radio/types.d.ts +6 -4
  79. package/dist/Rate/rate.js +1 -1
  80. package/dist/Result/use-result-icon.js +1 -1
  81. package/dist/SafeArea/style.scss +5 -3
  82. package/dist/Scaffold/style.scss +2 -1
  83. package/dist/Segmented/Segmented.d.ts +57 -0
  84. package/dist/Segmented/Segmented.js +82 -0
  85. package/dist/Segmented/index.d.ts +2 -0
  86. package/dist/Segmented/index.js +1 -0
  87. package/dist/Segmented/style.scss +75 -0
  88. package/dist/Skeleton/Skeleton.d.ts +86 -0
  89. package/dist/Skeleton/Skeleton.js +263 -0
  90. package/dist/Skeleton/index.d.ts +3 -0
  91. package/dist/Skeleton/index.js +2 -0
  92. package/dist/Skeleton/style.scss +215 -0
  93. package/dist/Space/space.d.ts +1 -0
  94. package/dist/Space/space.js +20 -6
  95. package/dist/Space/style.scss +27 -3
  96. package/dist/Stepper/index.d.ts +3 -0
  97. package/dist/Stepper/index.js +2 -0
  98. package/dist/Stepper/stepper.d.ts +14 -0
  99. package/dist/Stepper/stepper.js +92 -0
  100. package/dist/Stepper/style.scss +100 -0
  101. package/dist/Steps/HorizontalSteps.js +10 -3
  102. package/dist/Steps/VerticalSteps.js +5 -2
  103. package/dist/Steps/style.scss +7 -0
  104. package/dist/Steps/types.d.ts +2 -0
  105. package/dist/Switch/style.scss +6 -7
  106. package/dist/Switch/switch.d.ts +2 -0
  107. package/dist/Switch/switch.js +6 -5
  108. package/dist/TabBar/index.js +2 -1
  109. package/dist/TabBar/index.scss +3 -2
  110. package/dist/Tabs/style.scss +5 -5
  111. package/dist/Tag/style.scss +45 -21
  112. package/dist/Tag/tag.d.ts +4 -1
  113. package/dist/Tag/tag.js +8 -2
  114. package/dist/index.d.ts +17 -26
  115. package/dist/index.js +8 -13
  116. package/dist/style/css-variable.scss +6 -0
  117. package/dist/style/style.scss +2 -2
  118. package/dist/style/variable.scss +176 -164
  119. package/dist/types.d.ts +10 -1
  120. package/package.json +5 -8
  121. package/dist/ActionSheet/ActionSheet.d.ts +0 -25
  122. package/dist/ActionSheet/ActionSheet.js +0 -77
  123. package/dist/ActionSheet/index.d.ts +0 -3
  124. package/dist/ActionSheet/index.js +0 -2
  125. package/dist/ActionSheet/style.scss +0 -51
  126. package/dist/CascaderPicker/cascader-picker.d.ts +0 -27
  127. package/dist/CascaderPicker/cascader-picker.js +0 -88
  128. package/dist/CascaderPicker/index.d.ts +0 -3
  129. package/dist/CascaderPicker/index.js +0 -2
  130. package/dist/CascaderPicker/style.scss +0 -42
  131. package/dist/Form/FormItem/form-item-input.d.ts +0 -15
  132. package/dist/Form/FormItem/form-item-input.js +0 -39
  133. package/dist/Form/FormItem/form-item-label.d.ts +0 -13
  134. package/dist/Form/FormItem/form-item-label.js +0 -25
  135. package/dist/Form/FormItem/form-item.d.ts +0 -21
  136. package/dist/Form/FormItem/form-item.js +0 -70
  137. package/dist/Form/FormItem/index.d.ts +0 -5
  138. package/dist/Form/FormItem/index.js +0 -3
  139. package/dist/Form/style.scss +0 -45
  140. package/dist/Input/base-input.d.ts +0 -14
  141. package/dist/Input/base-input.js +0 -63
  142. package/dist/Input/index.d.ts +0 -12
  143. package/dist/Input/index.js +0 -9
  144. package/dist/Input/index.scss +0 -173
  145. package/dist/Input/input-affix-wrapper.d.ts +0 -8
  146. package/dist/Input/input-affix-wrapper.js +0 -50
  147. package/dist/Input/input-opt.d.ts +0 -16
  148. package/dist/Input/input-opt.js +0 -93
  149. package/dist/Input/input-password.d.ts +0 -7
  150. package/dist/Input/input-password.js +0 -47
  151. package/dist/Input/input.d.ts +0 -15
  152. package/dist/Input/input.js +0 -47
  153. package/dist/Input/textarea.d.ts +0 -13
  154. package/dist/Input/textarea.js +0 -45
  155. package/dist/Input/types.d.ts +0 -1
  156. package/dist/Input/types.js +0 -1
  157. package/dist/Mask/index.d.ts +0 -3
  158. package/dist/Mask/index.js +0 -2
  159. package/dist/Mask/mask-modal.d.ts +0 -45
  160. package/dist/Mask/mask.d.ts +0 -5
  161. package/dist/Mask/mask.js +0 -19
  162. package/dist/Mask/style.scss +0 -20
  163. package/dist/Picker/index.d.ts +0 -3
  164. package/dist/Picker/index.js +0 -2
  165. package/dist/Picker/picker.d.ts +0 -19
  166. package/dist/Picker/picker.js +0 -97
  167. package/dist/Picker/style.scss +0 -41
  168. package/dist/PickerView/index.d.ts +0 -4
  169. package/dist/PickerView/index.js +0 -2
  170. package/dist/PickerView/picker-view-column-item.d.ts +0 -7
  171. package/dist/PickerView/picker-view-column-item.js +0 -11
  172. package/dist/PickerView/picker-view-column.d.ts +0 -10
  173. package/dist/PickerView/picker-view-column.js +0 -117
  174. package/dist/PickerView/picker-view.d.ts +0 -12
  175. package/dist/PickerView/picker-view.js +0 -60
  176. package/dist/PickerView/style.scss +0 -72
  177. package/dist/PickerView/types.d.ts +0 -4
  178. package/dist/Popup/index.d.ts +0 -3
  179. package/dist/Popup/index.js +0 -2
  180. package/dist/Popup/popup-modal.d.ts +0 -52
  181. package/dist/Popup/popup-modal.js +0 -74
  182. package/dist/Popup/popup.d.ts +0 -4
  183. package/dist/Popup/popup.js +0 -56
  184. package/dist/Popup/style.scss +0 -53
  185. package/dist/ScrollView/index.d.ts +0 -4
  186. package/dist/ScrollView/index.js +0 -2
  187. package/dist/ScrollView/scroll-view.d.ts +0 -4
  188. package/dist/ScrollView/scroll-view.js +0 -55
  189. package/dist/ScrollView/style.scss +0 -19
  190. package/dist/ScrollView/types.d.ts +0 -26
  191. package/dist/ScrollView/types.js +0 -1
  192. package/dist/SideBar/SideBarContext.d.ts +0 -18
  193. package/dist/SideBar/SideBarContext.js +0 -2
  194. package/dist/SideBar/index.d.ts +0 -3
  195. package/dist/SideBar/index.js +0 -2
  196. package/dist/SideBar/side-bar.d.ts +0 -25
  197. package/dist/SideBar/side-bar.js +0 -351
  198. package/dist/SideBar/style.scss +0 -85
  199. package/dist/SideBar/types.d.ts +0 -7
  200. package/dist/SideBar/types.js +0 -1
  201. package/dist/SpinLoading/demo/base.d.ts +0 -3
  202. package/dist/SpinLoading/demo/base.js +0 -21
  203. package/dist/SpinLoading/index.d.ts +0 -3
  204. package/dist/SpinLoading/index.js +0 -2
  205. package/dist/SpinLoading/spin-loading.js +0 -59
  206. package/dist/SpinLoading/spin-loading.scss +0 -40
  207. package/dist/Tabs/demo/base.d.ts +0 -3
  208. package/dist/Tabs/demo/base.js +0 -59
  209. package/dist/Tag/demo/base.d.ts +0 -7
  210. package/dist/Tag/demo/base.js +0 -67
  211. package/dist/Tag/demo/style.scss +0 -8
  212. package/dist/Toast/index.d.ts +0 -5
  213. package/dist/Toast/index.js +0 -3
  214. package/dist/Toast/style.scss +0 -63
  215. package/dist/Toast/toast-modal.d.ts +0 -18
  216. package/dist/Toast/toast-modal.js +0 -112
  217. package/dist/Toast/toast.d.ts +0 -7
  218. package/dist/Toast/toast.js +0 -78
  219. package/dist/VerificationCodeInput/demo/base.d.ts +0 -3
  220. package/dist/VerificationCodeInput/demo/base.js +0 -11
  221. package/dist/VerificationCodeInput/index.d.ts +0 -3
  222. package/dist/VerificationCodeInput/index.js +0 -2
  223. package/dist/VerificationCodeInput/style.scss +0 -20
  224. package/dist/VerificationCodeInput/verification-code-input.d.ts +0 -24
  225. package/dist/VerificationCodeInput/verification-code-input.js +0 -99
  226. /package/dist/{PickerView → Form}/types.js +0 -0
@@ -2,39 +2,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
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
3
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
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
5
  import React from 'react';
12
6
  import { cls } from "./types";
13
- import { useState } from 'react';
14
7
  import classNames from 'classnames';
15
- import { CheckOutline } from "../../../antd-mobile-icons-react";
8
+ import { CheckOutline } from '@trionesdev/antd-mobile-icons-react';
16
9
  export var CheckboxButton = function CheckboxButton(_ref) {
17
- var _ref2;
18
10
  var children = _ref.children,
19
11
  checked = _ref.checked,
20
- defaultChecked = _ref.defaultChecked,
21
- disabled = _ref.disabled;
22
- var _useState = useState((_ref2 = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _ref2 !== void 0 ? _ref2 : false),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- innerChecked = _useState2[0],
25
- setInnerChecked = _useState2[1];
12
+ disabled = _ref.disabled,
13
+ _onClick = _ref.onClick;
26
14
  var prefixCls = "".concat(cls, "-button");
27
15
  return /*#__PURE__*/React.createElement("label", {
28
- className: classNames("".concat(prefixCls), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-checked"), innerChecked)),
16
+ className: classNames("".concat(prefixCls), _defineProperty(_defineProperty({}, "".concat(cls, "-disabled"), disabled), "".concat(prefixCls, "-checked"), checked)),
29
17
  onClick: function onClick() {
30
18
  if (disabled) {
31
19
  return;
32
20
  }
33
- setInnerChecked(!innerChecked);
21
+ _onClick === null || _onClick === void 0 || _onClick();
34
22
  }
35
23
  }, /*#__PURE__*/React.createElement("div", {
36
24
  className: classNames("".concat(prefixCls, "-content"))
37
- }, children), innerChecked && /*#__PURE__*/React.createElement("div", {
25
+ }, children), checked && /*#__PURE__*/React.createElement("div", {
38
26
  className: classNames("".concat(prefixCls, "-icon"))
39
27
  }, /*#__PURE__*/React.createElement(CheckOutline, {
40
28
  className: classNames("checkedIcon")
@@ -8,25 +8,40 @@ import classNames from 'classnames';
8
8
  import React, { useState } from 'react';
9
9
  import { CheckboxGroupContext } from "./group-context";
10
10
  import { cls } from "./types";
11
+ import Checkbox from "./index";
12
+ import { isEmpty } from "lodash-es";
13
+ import Space from "../Space";
11
14
  export var CheckboxGroup = function CheckboxGroup(_ref) {
12
15
  var _ref2;
13
16
  var value = _ref.value,
14
17
  defaultValue = _ref.defaultValue,
15
18
  onChange = _ref.onChange,
16
- children = _ref.children;
19
+ children = _ref.children,
20
+ shape = _ref.shape,
21
+ options = _ref.options,
22
+ direction = _ref.direction;
17
23
  var _useState = useState((_ref2 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref2 !== void 0 ? _ref2 : []),
18
24
  _useState2 = _slicedToArray(_useState, 2),
19
25
  innerValue = _useState2[0],
20
26
  setInnerValue = _useState2[1];
21
27
  return /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
22
28
  value: {
29
+ group: true,
23
30
  value: innerValue,
24
- handleCheck: function handleCheck(v) {
31
+ onValueChange: function onValueChange(v) {
25
32
  setInnerValue(v);
26
33
  onChange === null || onChange === void 0 || onChange(v);
27
34
  }
28
35
  }
29
36
  }, /*#__PURE__*/React.createElement("div", {
30
- className: classNames("".concat(cls, "-group}"))
31
- }, children));
37
+ className: classNames("".concat(cls, "-group"))
38
+ }, !isEmpty(options) && /*#__PURE__*/React.createElement(Space, {
39
+ direction: direction
40
+ }, options === null || options === void 0 ? void 0 : options.map(function (item, index) {
41
+ return /*#__PURE__*/React.createElement(Checkbox, {
42
+ key: "".concat(index),
43
+ shape: shape,
44
+ value: item.value
45
+ }, item.label);
46
+ })), isEmpty(options) && children));
32
47
  };
@@ -0,0 +1,8 @@
1
+ import { FC } from 'react';
2
+ import './index.scss';
3
+ import { CheckboxProps } from './types';
4
+ type CheckboxRoundProps = CheckboxProps & {
5
+ onClick: () => void;
6
+ };
7
+ export declare const CheckboxRound: FC<CheckboxRoundProps>;
8
+ export {};
@@ -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 '@trionesdev/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;
6
+
7
+ .#{$checkboxCls}-group {
5
8
 
6
- .#{$checkboxCls}-wrapper{
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
  };
@@ -15,6 +15,7 @@ type Config = {
15
15
  };
16
16
  form?: {
17
17
  helpIcon?: ReactNode;
18
+ arrowIcon?: ReactNode;
18
19
  };
19
20
  input?: {
20
21
  clearIcon?: ReactNode;
@@ -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} {
@@ -10,7 +10,7 @@ interface BasicComponent {
10
10
  export type DividerContentPosition = 'left' | 'center' | 'right';
11
11
  export type DividerDirection = 'horizontal' | 'vertical';
12
12
  export interface DividerProps extends BasicComponent {
13
- contentPosition: DividerContentPosition;
13
+ contentPosition?: DividerContentPosition;
14
14
  direction?: DividerDirection;
15
15
  }
16
16
  export declare const Divider: FC<Partial<DividerProps> & React.HTMLAttributes<HTMLDivElement>>;
@@ -28,9 +28,11 @@ export var Divider = function Divider(props) {
28
28
  className = _defaultProps$props.className,
29
29
  direction = _defaultProps$props.direction,
30
30
  rest = _objectWithoutProperties(_defaultProps$props, _excluded);
31
- var classes = direction === 'horizontal' ? classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix), true), "".concat(classPrefix, "-center"), children), "".concat(classPrefix, "-left"), contentPosition === 'left'), "".concat(classPrefix, "-right"), contentPosition === 'right'), "".concat(classPrefix, "-hairline"), true)) : classNames(_defineProperty(_defineProperty({}, "".concat(classPrefix), true), "".concat(classPrefix, "-vertical"), direction === 'vertical'));
31
+ var classes = classNames(classPrefix, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(classPrefix, "-vertical"), direction === 'vertical'), "".concat(classPrefix, "-hairline"), direction === 'horizontal'), "".concat(classPrefix, "-center"), direction === 'horizontal' && !!children && contentPosition === 'center'), "".concat(classPrefix, "-left"), direction === 'horizontal' && contentPosition === 'left'), "".concat(classPrefix, "-right"), direction === 'horizontal' && contentPosition === 'right'), className);
32
32
  return /*#__PURE__*/React.createElement("div", _extends({
33
- className: "".concat(classes, " ").concat(className || ''),
34
- style: style
33
+ className: classes,
34
+ style: style,
35
+ role: "separator",
36
+ "aria-orientation": direction
35
37
  }, rest), children);
36
38
  };
@@ -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
 
@@ -47,7 +47,7 @@ $dividerCls: 'triones-antm-divider';
47
47
  &-hairline {
48
48
  &::before,
49
49
  &::after {
50
- transform: scaleY(0.5);
50
+ // transform: scaleY(0.5);
51
51
  }
52
52
  }
53
53
 
@@ -55,7 +55,7 @@ $dividerCls: 'triones-antm-divider';
55
55
  display: inline-block;
56
56
  width: auto;
57
57
  height: 12PX;
58
- border-left: 1PX solid #eeeeee;
58
+ border-left: 1PX solid variable.$trionesBorderColor;
59
59
  margin: 0 8PX;
60
60
  vertical-align: middle;
61
61
  }
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ export declare const ErrorList: FC<{
3
+ errors?: string[];
4
+ }>;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ var cls = 'triones-antm-form';
3
+ export var ErrorList = function ErrorList(_ref) {
4
+ var errors = _ref.errors;
5
+ if (!errors || !errors.length) return null;
6
+ return /*#__PURE__*/React.createElement("div", {
7
+ className: "".concat(cls, "-item-explain-error")
8
+ }, errors === null || errors === void 0 ? void 0 : errors.join(','));
9
+ };
@@ -1,12 +1,15 @@
1
1
  import React from "react";
2
- import { FormLayout, FormLayoutAlign, RequiredMark } from "./form";
2
+ import { FormItemVerticalAlign, FormLayout, FormHorizontalAlign, RequiredMark } from "./types";
3
3
  export interface FormContextProps {
4
4
  colon?: boolean;
5
5
  layout?: FormLayout;
6
- labelAlign?: FormLayoutAlign;
6
+ labelAlign?: FormHorizontalAlign;
7
7
  labelWidth?: number;
8
+ contentAlign?: FormHorizontalAlign;
8
9
  requiredMark?: RequiredMark;
9
10
  form?: any;
10
11
  hiddenError?: boolean;
12
+ extra?: React.ReactNode;
13
+ verticalAlign?: FormItemVerticalAlign;
11
14
  }
12
15
  export declare const FormContext: React.Context<FormContextProps>;
@@ -2,5 +2,6 @@ import React from "react";
2
2
  export var FormContext = /*#__PURE__*/React.createContext({
3
3
  colon: true,
4
4
  layout: "horizontal",
5
- labelAlign: "left"
5
+ labelAlign: "start",
6
+ contentAlign: "start"
6
7
  });