@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
@@ -7,7 +7,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
8
  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; }
9
9
  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; }
10
- import { CheckCircleFill, CloseCircleFill, CloseOutline, ExclamationCircleFill, InformationCircleFill } from "../../../antd-mobile-icons-react";
10
+ import { CheckCircleFill, CloseCircleFill, CloseOutline, ExclamationCircleFill, InformationCircleFill } from '@trionesdev/antd-mobile-icons-react';
11
11
  import classNames from 'classnames';
12
12
  import React, { useState } from 'react';
13
13
  import "./style.scss";
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $trionesAlertCls: 'triones-antm-alert';
4
4
 
@@ -6,7 +6,7 @@ $trionesAlertDefaultPadding: 8Px 12Px;
6
6
 
7
7
  .#{$trionesAlertCls} {
8
8
  padding: $trionesAlertDefaultPadding;
9
- border-radius: $trionesBorderRadius;
9
+ border-radius: variable.$trionesBorderRadius;
10
10
  display: flex;
11
11
  flex: 1 auto;
12
12
  border: 1Px solid;
@@ -15,38 +15,38 @@ $trionesAlertDefaultPadding: 8Px 12Px;
15
15
  gap: 4Px;
16
16
 
17
17
  &-success {
18
- border-color: $trionesColorSuccessBorder;
19
- background-color: $trionesColorSuccessBg;
18
+ border-color: variable.$trionesColorSuccessBorder;
19
+ background-color: variable.$trionesColorSuccessBg;
20
20
 
21
21
  .#{$trionesAlertCls}-icon {
22
- color: $trionesColorSuccess;
22
+ color: variable.$trionesColorSuccess;
23
23
  }
24
24
  }
25
25
 
26
26
  &-info {
27
- border-color: $trionesColorInfoBorder;
28
- background-color: $trionesColorInfoBg;
27
+ border-color: variable.$trionesColorInfoBorder;
28
+ background-color: variable.$trionesColorInfoBg;
29
29
 
30
30
  .#{$trionesAlertCls}-icon {
31
- color: $trionesColorInfo;
31
+ color: variable.$trionesColorInfo;
32
32
  }
33
33
  }
34
34
 
35
35
  &-warning {
36
- border-color: $trionesColorWarningBorder;
37
- background-color: $trionesColorWarningBg;
36
+ border-color: variable.$trionesColorWarningBorder;
37
+ background-color: variable.$trionesColorWarningBg;
38
38
 
39
39
  .#{$trionesAlertCls}-icon {
40
- color: $trionesColorWarning;
40
+ color: variable.$trionesColorWarning;
41
41
  }
42
42
  }
43
43
 
44
44
  &-error {
45
- border-color: $trionesColorErrorBorder;
46
- background-color: $trionesColorErrorBg;
45
+ border-color: variable.$trionesColorErrorBorder;
46
+ background-color: variable.$trionesColorErrorBg;
47
47
 
48
48
  .#{$trionesAlertCls}-icon {
49
- color: $trionesColorError;
49
+ color: variable.$trionesColorError;
50
50
  }
51
51
  }
52
52
 
@@ -58,12 +58,12 @@ $trionesAlertDefaultPadding: 8Px 12Px;
58
58
  }
59
59
 
60
60
  &-close-icon {
61
- color: $trionesColorIcon;
62
- font-size: $trionesFontSizeIcon;
61
+ color: variable.$trionesColorIcon;
62
+ font-size: variable.$trionesFontSizeIcon;
63
63
  cursor: pointer;
64
64
 
65
65
  .triones-antm-icon {
66
- font-size: $trionesFontSizeIcon;
66
+ font-size: variable.$trionesFontSizeIcon;
67
67
  }
68
68
  }
69
69
  }
@@ -1,12 +1,15 @@
1
1
  import React from 'react';
2
2
  import './style.scss';
3
+ import { AntSize } from '../types';
3
4
  export type AvatarProps = {
4
5
  alt?: string;
5
6
  icon?: React.ReactNode;
6
7
  shape?: 'circle' | 'square';
7
- size?: number;
8
+ size?: AntSize | number;
8
9
  src?: string | React.ReactNode;
9
10
  srcSet?: string;
11
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
12
+ className?: string;
10
13
  style?: React.CSSProperties;
11
14
  children?: React.ReactNode;
12
15
  };
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
7
  import classNames from 'classnames';
8
- import React from 'react';
8
+ import React, { useMemo } from 'react';
9
9
  import "./style.scss";
10
10
  export var Avatar = function Avatar(_ref) {
11
11
  var alt = _ref.alt,
@@ -13,19 +13,32 @@ export var Avatar = function Avatar(_ref) {
13
13
  _ref$shape = _ref.shape,
14
14
  shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
15
15
  _ref$size = _ref.size,
16
- size = _ref$size === void 0 ? 40 : _ref$size,
16
+ size = _ref$size === void 0 ? 32 : _ref$size,
17
17
  src = _ref.src,
18
18
  srcSet = _ref.srcSet,
19
+ onClick = _ref.onClick,
20
+ className = _ref.className,
19
21
  style = _ref.style,
20
22
  children = _ref.children;
21
23
  var clsPrefix = 'triones-antm-avatar';
24
+ var avatarSize = useMemo(function () {
25
+ if (typeof size === 'number') {
26
+ return size;
27
+ }
28
+ return {
29
+ small: 24,
30
+ medium: 32,
31
+ large: 40
32
+ }[size];
33
+ }, [size]);
22
34
  return /*#__PURE__*/React.createElement("div", {
23
- className: classNames(clsPrefix, _defineProperty({}, "".concat(clsPrefix, "-").concat(shape !== 'square' ? 'circle' : 'square'), true)),
35
+ className: classNames(clsPrefix, _defineProperty({}, "".concat(clsPrefix, "-").concat(shape !== 'square' ? 'circle' : 'square'), true), className),
24
36
  style: _objectSpread({
25
- width: size,
26
- height: size,
37
+ width: avatarSize,
38
+ height: avatarSize,
27
39
  backgroundColor: src ? undefined : '#ccc'
28
- }, style)
40
+ }, style),
41
+ onClick: onClick
29
42
  }, src ? typeof src === 'string' ? /*#__PURE__*/React.createElement("img", {
30
43
  src: src,
31
44
  srcSet: srcSet,
@@ -1,3 +1,4 @@
1
+ @use "../style/variable" as variable;
1
2
  $avatarCls: 'triones-antm-avatar';
2
3
 
3
4
  .#{$avatarCls} {
@@ -10,7 +11,7 @@ $avatarCls: 'triones-antm-avatar';
10
11
  border-radius: 50%;
11
12
  }
12
13
 
13
- &-shape-square {
14
- border-radius: 6Px;
14
+ &-square {
15
+ border-radius: variable.$trionesBorderRadius;
15
16
  }
16
17
  }
@@ -1,10 +1,10 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
  $class-prefix-card: 'triones-antm-card';
3
3
 
4
4
  .#{$class-prefix-card} {
5
- background: $trionesColorBgBase;
6
- border-radius: $trionesBorderRadius;
7
- //padding: $trionesPadding $trionesPadding;
5
+ background: variable.$trionesColorBgBase;
6
+ border-radius: variable.$trionesBorderRadius;
7
+ //padding: variable.$trionesPadding variable.$trionesPadding;
8
8
  &-header {
9
9
  position: relative;
10
10
  display: flex;
@@ -12,24 +12,24 @@ $class-prefix-card: 'triones-antm-card';
12
12
  align-items: center;
13
13
  gap: 8Px;
14
14
  box-sizing: border-box;
15
- padding: $trionesPaddingXs $trionesPaddingXs;
15
+ padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
16
16
  &:not(:last-child) {
17
- border-bottom: solid 0.5Px $trionesBorderColor;
17
+ border-bottom: solid 0.5Px variable.$trionesBorderColor;
18
18
  }
19
19
  &-title {
20
- font-size: $trionesFontSize;
20
+ font-size: variable.$trionesFontSize;
21
21
  line-height: 1.4;
22
- font-weight: 500;
22
+ font-weight: 600;
23
23
  }
24
24
  }
25
25
  &-body {
26
- padding: $trionesPaddingXs $trionesPaddingXs;
26
+ padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
27
27
  }
28
28
  &-footer {
29
- padding: $trionesPaddingXs $trionesPaddingXs;
29
+ padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
30
30
  }
31
31
  &-footer {
32
- border-top: solid 0.5Px $trionesBorderColor;
33
- padding: $trionesPaddingXs $trionesPaddingXs;
32
+ border-top: solid 0.5Px variable.$trionesBorderColor;
33
+ padding: variable.$trionesPaddingXs variable.$trionesPaddingXs;
34
34
  }
35
35
  }
@@ -4,7 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
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
5
  import React from "react";
6
6
  import classNames from "classnames";
7
- import { CheckOutline } from "../../../antd-mobile-icons-react";
7
+ import { CheckOutline } from "@trionesdev/antd-mobile-icons-react";
8
8
  var cascaderViewCls = 'triones-antm-cascader-view';
9
9
  export var CascaderColumnItem = function CascaderColumnItem(_ref) {
10
10
  var option = _ref.option,
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $cascaderViewCls: 'triones-antm-cascader-view';
4
4
  .#{$cascaderViewCls} {
@@ -15,7 +15,7 @@ $cascaderViewCls: 'triones-antm-cascader-view';
15
15
  padding: 0Px 8Px;
16
16
 
17
17
  &-selected {
18
- color: $trionesColorPrimary;
18
+ color: variable.$trionesColorPrimary;
19
19
  }
20
20
  }
21
21
  }
@@ -1,28 +1,53 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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
7
  import classNames from 'classnames';
2
8
  import React from 'react';
3
- import Divider from "../Divider";
4
9
  import { cls } from "./types";
10
+ import { CellGroupContext } from "./context";
11
+ import Cell from '.';
12
+ import { Cell as InternalCell } from "./cell";
5
13
  export var CellGroup = function CellGroup(_ref) {
6
14
  var className = _ref.className,
7
15
  style = _ref.style,
8
16
  children = _ref.children,
9
17
  title = _ref.title,
10
18
  extra = _ref.extra,
11
- divider = _ref.divider;
19
+ arrow = _ref.arrow,
20
+ labelCol = _ref.labelCol,
21
+ labelAlign = _ref.labelAlign,
22
+ contentAlign = _ref.contentAlign,
23
+ divider = _ref.divider,
24
+ size = _ref.size,
25
+ styles = _ref.styles;
12
26
  var handleRender = function handleRender() {
13
27
  if (children) {
14
28
  if (Array.isArray(children)) {
29
+ var validChildren = React.Children.toArray(children).filter(function (child) {
30
+ return /*#__PURE__*/React.isValidElement(child) && (child.type == Cell || child.type == InternalCell);
31
+ });
15
32
  var childrenArray = [];
16
- for (var i = 0; i < children.length; i++) {
17
- childrenArray.push( /*#__PURE__*/React.cloneElement(children[i]));
18
- if (divider && i !== children.length - 1) {
33
+ validChildren.forEach(function (child, index) {
34
+ var _child$key;
35
+ childrenArray.push( /*#__PURE__*/React.cloneElement(child, {
36
+ key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : "cell-".concat(index)
37
+ }));
38
+ if (divider && index < validChildren.length - 1) {
19
39
  if ( /*#__PURE__*/React.isValidElement(divider)) {
20
- childrenArray.push(divider);
40
+ var _divider$key;
41
+ childrenArray.push( /*#__PURE__*/React.cloneElement(divider, {
42
+ key: (_divider$key = divider.key) !== null && _divider$key !== void 0 ? _divider$key : "divider-".concat(index)
43
+ }));
21
44
  } else {
22
- childrenArray.push( /*#__PURE__*/React.createElement(Divider, null));
45
+ childrenArray.push( /*#__PURE__*/React.createElement(React.Fragment, {
46
+ key: "divider-".concat(index)
47
+ }, divider));
23
48
  }
24
49
  }
25
- }
50
+ });
26
51
  return childrenArray;
27
52
  } else {
28
53
  return children;
@@ -30,12 +55,26 @@ export var CellGroup = function CellGroup(_ref) {
30
55
  }
31
56
  return null;
32
57
  };
33
- return /*#__PURE__*/React.createElement("div", {
58
+ return /*#__PURE__*/React.createElement(CellGroupContext.Provider, {
59
+ value: {
60
+ labelCol: labelCol,
61
+ labelAlign: labelAlign,
62
+ contentAlign: contentAlign,
63
+ extra: extra,
64
+ arrow: arrow,
65
+ size: size,
66
+ styles: {
67
+ cell: styles === null || styles === void 0 ? void 0 : styles.cell,
68
+ label: styles === null || styles === void 0 ? void 0 : styles.label,
69
+ content: styles === null || styles === void 0 ? void 0 : styles.content,
70
+ extra: styles === null || styles === void 0 ? void 0 : styles.extra
71
+ }
72
+ }
73
+ }, /*#__PURE__*/React.createElement("div", {
34
74
  className: classNames("".concat(cls, "-group"), className),
35
- style: style
75
+ style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.container)
36
76
  }, title && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
37
- className: classNames("".concat(cls, "-group-title"))
38
- }, /*#__PURE__*/React.createElement("div", null, title), /*#__PURE__*/React.createElement("div", {
39
- className: classNames("".concat(cls, "-group-extra"))
40
- }, extra)), /*#__PURE__*/React.createElement(Divider, null)), handleRender());
77
+ className: classNames("".concat(cls, "-group-title")),
78
+ style: styles === null || styles === void 0 ? void 0 : styles.title
79
+ }, title)), handleRender()));
41
80
  };
package/dist/Cell/cell.js CHANGED
@@ -1,31 +1,68 @@
1
- import { RightOutline } from "../../../antd-mobile-icons-react";
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
2
7
  import classNames from 'classnames';
3
- import React from 'react';
8
+ import React, { useContext, useMemo } from 'react';
4
9
  import "./styles.scss";
10
+ import { CellGroupContext } from "./context";
11
+ import { assign } from "lodash-es";
12
+ import { RightOutline } from "@trionesdev/antd-mobile-icons-react";
5
13
  var cls = 'triones-antm-cell';
6
14
  export var Cell = function Cell(_ref) {
15
+ var _ref2, _ref3, _ref4;
7
16
  var className = _ref.className,
8
17
  style = _ref.style,
9
18
  placeholder = _ref.placeholder,
10
19
  children = _ref.children,
20
+ label = _ref.label,
11
21
  extra = _ref.extra,
12
- _ref$arrow = _ref.arrow,
13
- arrow = _ref$arrow === void 0 ? true : _ref$arrow,
22
+ arrow = _ref.arrow,
23
+ labelCol = _ref.labelCol,
24
+ labelAlign = _ref.labelAlign,
25
+ contentAlign = _ref.contentAlign,
14
26
  onClick = _ref.onClick,
15
- picker = _ref.picker;
27
+ styles = _ref.styles;
28
+ var _useContext = useContext(CellGroupContext),
29
+ ctxLabelCol = _useContext.labelCol,
30
+ ctxLabelAlign = _useContext.labelAlign,
31
+ ctxContentAlign = _useContext.contentAlign,
32
+ ctxSize = _useContext.size,
33
+ ctxArrow = _useContext.arrow,
34
+ ctxExtra = _useContext.extra,
35
+ ctxStyles = _useContext.styles;
36
+ var labelWidth = useMemo(function () {
37
+ return (labelCol === null || labelCol === void 0 ? void 0 : labelCol.flex) || (ctxLabelCol === null || ctxLabelCol === void 0 ? void 0 : ctxLabelCol.flex) || 'auto';
38
+ }, [labelCol, ctxLabelCol]);
39
+ var finalLabelAlign = (_ref2 = ctxLabelAlign !== null && ctxLabelAlign !== void 0 ? ctxLabelAlign : labelAlign) !== null && _ref2 !== void 0 ? _ref2 : 'start';
40
+ var finalContentAlign = (_ref3 = ctxContentAlign !== null && ctxContentAlign !== void 0 ? ctxContentAlign : contentAlign) !== null && _ref3 !== void 0 ? _ref3 : 'end';
41
+ var finalSize = ctxSize !== null && ctxSize !== void 0 ? ctxSize : 'medium';
42
+ var finalArrow = (_ref4 = ctxArrow !== null && ctxArrow !== void 0 ? ctxArrow : arrow) !== null && _ref4 !== void 0 ? _ref4 : false;
43
+ var mergedStyles = assign({}, ctxStyles, styles);
44
+ if (style) {
45
+ mergedStyles.cell = assign(mergedStyles.cell, style);
46
+ }
47
+ var sizePossible = ['small', 'medium', 'large'].includes(finalSize);
16
48
  return /*#__PURE__*/React.createElement("div", {
17
- className: classNames(cls, className),
18
- style: style,
49
+ className: classNames(cls, _defineProperty({}, "".concat(cls, "-").concat(finalSize), sizePossible), className),
50
+ style: _objectSpread({}, mergedStyles.cell),
19
51
  onClick: onClick
20
- }, /*#__PURE__*/React.createElement("div", {
21
- className: classNames("".concat(cls, "-wrapper"))
22
- }, /*#__PURE__*/React.createElement("div", {
23
- className: classNames("".concat(cls, "-content"))
24
- }, picker, children || placeholder && /*#__PURE__*/React.createElement("div", {
52
+ }, label && /*#__PURE__*/React.createElement("div", {
53
+ className: classNames("".concat(cls, "-label"), "".concat(cls, "-label-").concat(finalLabelAlign)),
54
+ style: _objectSpread({
55
+ width: labelWidth
56
+ }, mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.label)
57
+ }, label), /*#__PURE__*/React.createElement("div", {
58
+ className: classNames("".concat(cls, "-content"), "".concat(cls, "-content-").concat(finalContentAlign)),
59
+ style: _objectSpread({}, mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.content)
60
+ }, children || placeholder && /*#__PURE__*/React.createElement("div", {
25
61
  className: classNames("".concat(cls, "-placeholder"))
26
- }, placeholder)), extra && /*#__PURE__*/React.createElement("div", {
27
- className: classNames("".concat(cls, "-extra"))
28
- }, extra)), arrow && /*#__PURE__*/React.createElement("div", {
62
+ }, placeholder)), (extra || ctxExtra) && /*#__PURE__*/React.createElement("div", {
63
+ className: classNames("".concat(cls, "-extra")),
64
+ style: mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.extra
65
+ }, extra || ctxExtra), finalArrow && /*#__PURE__*/React.createElement("div", {
29
66
  className: classNames("".concat(cls, "-arrow"))
30
67
  }, /*#__PURE__*/React.createElement(RightOutline, null)));
31
68
  };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { AntSize, Col } from "../types";
3
+ import { align } from "./types";
4
+ type CellGroupContextType = {
5
+ labelCol?: Col;
6
+ labelAlign?: align;
7
+ contentAlign?: align;
8
+ arrow?: boolean;
9
+ extra?: React.ReactNode;
10
+ size?: AntSize;
11
+ styles?: {
12
+ cell?: React.CSSProperties;
13
+ label?: React.CSSProperties;
14
+ content?: React.CSSProperties;
15
+ extra?: React.CSSProperties;
16
+ };
17
+ };
18
+ export declare const CellGroupContext: React.Context<CellGroupContextType>;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export var CellGroupContext = /*#__PURE__*/React.createContext({});
@@ -1,42 +1,70 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $cellCls: 'triones-antm-cell';
4
4
 
5
5
  .#{$cellCls} {
6
6
  display: flex;
7
- padding: 4Px 11Px;
8
7
  gap: 4Px;
8
+ align-items: center;
9
9
 
10
- &-wrapper {
10
+ &-small{
11
+ padding-block: variable.$trionesPaddingXxs;
12
+ }
13
+ &-medium{
14
+ padding-block: variable.$trionesPaddingXs;
15
+ }
16
+ &-large{
17
+ padding-block: variable.$trionesPaddingSm;
18
+ }
19
+
20
+ &-label {
11
21
  display: flex;
12
- flex: 1 auto;
22
+ align-items: center;
23
+ &-start{
24
+ justify-content: flex-start;
25
+ }
26
+ &-end{
27
+ justify-content: flex-end;
28
+ }
13
29
  }
14
30
 
15
31
  &-content {
16
32
  flex: 1 auto;
17
33
  display: flex;
18
34
  align-items: center;
35
+ min-height: 20Px;
36
+ &-start{
37
+ justify-content: flex-start;
38
+ }
39
+ &-end{
40
+ justify-content: flex-end;
41
+ }
19
42
  }
20
43
 
21
44
  &-extra {
22
- }
23
-
24
- &-arrow {
25
45
  display: flex;
26
- justify-content: center;
27
46
  align-items: center;
28
47
  }
29
- &-placeholder{
30
- font-size: 14Px;
31
- color: #cccccc;
48
+ &-arrow{
49
+ font-size: variable.$trionesFontSize;
50
+ color: variable.$trionesColorTextPlaceholder;
51
+ .triones-antm-icon{
52
+ &::before{
53
+ font-size: 12Px;
54
+ }
55
+ }
56
+ }
57
+
58
+ &-placeholder {
59
+ font-size: variable.$trionesFontSize;
60
+ color: variable.$trionesColorTextPlaceholder;
32
61
  }
33
62
  }
34
63
 
35
64
  .#{$cellCls}-group {
36
65
  display: flex;
37
66
  flex-direction: column;
38
- border-radius: $trionesBorderRadius;
39
- padding: 4Px 4Px;
67
+ border-radius: variable.$trionesBorderRadius;
40
68
 
41
69
  &-title {
42
70
  padding: 4Px 4Px;
@@ -48,5 +76,6 @@ $cellCls: 'triones-antm-cell';
48
76
 
49
77
  &-extra {
50
78
  }
79
+
51
80
  }
52
81
  }
@@ -1,10 +1,16 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
+ import { AntSize, Col } from "../types";
2
3
  export declare const cls = "triones-antm-cell";
4
+ export type align = 'start' | 'center' | 'end';
3
5
  export type CellProps = {
4
6
  className?: string;
5
7
  style?: React.CSSProperties;
6
8
  placeholder?: string;
7
9
  children?: React.ReactNode;
10
+ /**
11
+ * @description 左侧内容
12
+ */
13
+ label?: React.ReactNode;
8
14
  /**
9
15
  * @description 右侧内容
10
16
  * @default
@@ -19,7 +25,15 @@ export type CellProps = {
19
25
  * @description 点击事件
20
26
  */
21
27
  onClick?: () => void;
22
- picker?: React.ReactNode;
28
+ labelCol?: Col;
29
+ labelAlign?: align;
30
+ contentAlign?: align;
31
+ size?: AntSize;
32
+ styles?: {
33
+ label?: React.CSSProperties;
34
+ content?: React.CSSProperties;
35
+ extra?: React.CSSProperties;
36
+ };
23
37
  };
24
38
  export type CellGroupProps = {
25
39
  className?: string;
@@ -33,9 +47,18 @@ export type CellGroupProps = {
33
47
  * @description 分组右侧内容
34
48
  */
35
49
  extra?: React.ReactNode;
36
- /**
37
- * @description 是否显示分割线
38
- * @default false
39
- */
40
- divider?: boolean | React.ReactNode;
50
+ arrow?: boolean;
51
+ labelCol?: Col;
52
+ labelAlign?: align;
53
+ contentAlign?: align;
54
+ divider?: ReactNode;
55
+ size?: AntSize;
56
+ styles?: {
57
+ container?: React.CSSProperties;
58
+ title?: React.CSSProperties;
59
+ cell?: React.CSSProperties;
60
+ label?: React.CSSProperties;
61
+ content?: React.CSSProperties;
62
+ extra?: React.CSSProperties;
63
+ };
41
64
  };
@@ -1,3 +1,7 @@
1
- import { CheckboxProps } from './types';
2
1
  import { FC } from 'react';
3
- export declare const CheckboxButton: FC<CheckboxProps>;
2
+ import { CheckboxProps } from './types';
3
+ type CheckboxButtonProps = CheckboxProps & {
4
+ onClick: () => void;
5
+ };
6
+ export declare const CheckboxButton: FC<CheckboxButtonProps>;
7
+ export {};