@trionesdev/antd-mobile-base-react 0.0.2-beta.16 → 0.0.2-beta.18

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 (118) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -23
  3. package/dist/Alert/alert.js +1 -1
  4. package/dist/Alert/style.scss +69 -69
  5. package/dist/Avatar/avatar.d.ts +2 -2
  6. package/dist/Avatar/avatar.js +1 -1
  7. package/dist/Avatar/style.scss +17 -17
  8. package/dist/Badge/style.scss +100 -100
  9. package/dist/Card/style.scss +35 -35
  10. package/dist/CascaderView/cascader-column-item.js +1 -1
  11. package/dist/CascaderView/style.scss +22 -22
  12. package/dist/Cell/CellGroup.js +25 -8
  13. package/dist/Cell/cell.js +20 -37
  14. package/dist/Cell/context.d.ts +4 -2
  15. package/dist/Cell/styles.scss +81 -52
  16. package/dist/Cell/types.d.ts +6 -4
  17. package/dist/Checkbox/checkbox-button.js +1 -1
  18. package/dist/Checkbox/checkbox-group.js +1 -2
  19. package/dist/Checkbox/checkbox-round.js +1 -1
  20. package/dist/Checkbox/index.scss +165 -165
  21. package/dist/ConfigProvider/config-provider.d.ts +1 -0
  22. package/dist/DemoBlock/index.scss +20 -20
  23. package/dist/DemoDescription/index.scss +3 -3
  24. package/dist/Descriptions/style.scss +65 -65
  25. package/dist/Divider/divider.d.ts +1 -1
  26. package/dist/Divider/divider.js +5 -3
  27. package/dist/Divider/style.scss +62 -62
  28. package/dist/Ellipsis/style.scss +13 -13
  29. package/dist/Empty/style.scss +29 -29
  30. package/dist/ErrorBlock/demo/base.js +2 -2
  31. package/dist/ErrorBlock/style.scss +62 -62
  32. package/dist/Footer/style.scss +55 -55
  33. package/dist/Form/ErrorList.d.ts +4 -0
  34. package/dist/Form/ErrorList.js +9 -0
  35. package/dist/Form/context.d.ts +4 -2
  36. package/dist/Form/context.js +2 -1
  37. package/dist/Form/form.d.ts +24 -6
  38. package/dist/Form/form.js +22 -11
  39. package/dist/Form/hooks/useForm.js +1 -8
  40. package/dist/Form/hooks/useFormContext.js +1 -2
  41. package/dist/Form/index.d.ts +6 -3
  42. package/dist/Form/index.js +4 -1
  43. package/dist/Form/styles.scss +11 -0
  44. package/dist/Form/types.d.ts +2 -1
  45. package/dist/FormCell/FormCell.d.ts +21 -0
  46. package/dist/FormCell/FormCell.js +56 -0
  47. package/dist/FormCell/index.d.ts +4 -0
  48. package/dist/FormCell/index.js +3 -0
  49. package/dist/FormCell/styles.scss +103 -0
  50. package/dist/Grid/style.scss +17 -17
  51. package/dist/Icon/demo/base.js +2 -2
  52. package/dist/InputNumber/style.scss +100 -100
  53. package/dist/Loading/DotLoading.d.ts +8 -0
  54. package/dist/Loading/DotLoading.js +33 -0
  55. package/dist/Loading/SpinLoading.js +70 -0
  56. package/dist/Loading/dot-loading.scss +72 -0
  57. package/dist/Loading/index.d.ts +5 -0
  58. package/dist/Loading/index.js +3 -0
  59. package/dist/{SpinLoading → Loading}/spin-loading.scss +39 -40
  60. package/dist/NavBar/nav-bar.js +1 -1
  61. package/dist/NavBar/style.scss +64 -64
  62. package/dist/NoticeBar/style.scss +130 -130
  63. package/dist/PageIndicator/style.scss +59 -59
  64. package/dist/Progress/Progress.js +1 -1
  65. package/dist/Progress/ProgressCircle.js +5 -2
  66. package/dist/Progress/ProgressLine.js +2 -2
  67. package/dist/Progress/style.scss +33 -33
  68. package/dist/Progress/types.d.ts +2 -2
  69. package/dist/Radio/radio.js +1 -1
  70. package/dist/Radio/style.scss +154 -141
  71. package/dist/Rate/rate.js +1 -1
  72. package/dist/Rate/style.scss +37 -37
  73. package/dist/Result/demo/base.js +2 -2
  74. package/dist/Result/style.scss +73 -73
  75. package/dist/Result/use-result-icon.js +1 -1
  76. package/dist/SafeArea/style.scss +20 -20
  77. package/dist/Scaffold/style.scss +17 -17
  78. package/dist/Segmented/style.scss +75 -75
  79. package/dist/Skeleton/Skeleton.d.ts +80 -21
  80. package/dist/Skeleton/Skeleton.js +248 -57
  81. package/dist/Skeleton/index.d.ts +3 -1
  82. package/dist/Skeleton/index.js +2 -1
  83. package/dist/Skeleton/style.scss +215 -48
  84. package/dist/Space/space.js +12 -9
  85. package/dist/Space/style.scss +101 -80
  86. package/dist/Stepper/stepper.js +2 -1
  87. package/dist/Stepper/style.scss +100 -100
  88. package/dist/Steps/HorizontalSteps.js +5 -2
  89. package/dist/Steps/VerticalSteps.js +5 -2
  90. package/dist/Steps/style.scss +153 -153
  91. package/dist/Steps/types.d.ts +2 -0
  92. package/dist/Switch/style.scss +127 -128
  93. package/dist/Switch/switch.d.ts +2 -0
  94. package/dist/Switch/switch.js +6 -5
  95. package/dist/TabBar/demo/base.js +2 -2
  96. package/dist/TabBar/index.scss +37 -37
  97. package/dist/Tabs/style.scss +108 -108
  98. package/dist/Tag/style.scss +110 -109
  99. package/dist/Tag/tag.d.ts +1 -1
  100. package/dist/Tag/tag.js +1 -1
  101. package/dist/WaterMark/style.scss +17 -17
  102. package/dist/index.d.ts +9 -4
  103. package/dist/index.js +4 -2
  104. package/dist/style/css-variable.scss +6 -6
  105. package/dist/style/style.scss +52 -52
  106. package/dist/style/theme-dark.scss +24 -24
  107. package/dist/style/theme-default.scss +54 -54
  108. package/dist/style/variable.scss +180 -173
  109. package/dist/types.d.ts +6 -1
  110. package/dist/utils/type.js +36 -36
  111. package/dist/utils/with-default-props.js +4 -4
  112. package/package.json +4 -7
  113. package/dist/SpinLoading/index.d.ts +0 -3
  114. package/dist/SpinLoading/index.js +0 -2
  115. package/dist/SpinLoading/spin-loading.js +0 -59
  116. package/dist/Tabs/demo/base.d.ts +0 -3
  117. package/dist/Tabs/demo/base.js +0 -59
  118. /package/dist/{SpinLoading/spin-loading.d.ts → Loading/SpinLoading.d.ts} +0 -0
@@ -16,21 +16,36 @@ export var CellGroup = function CellGroup(_ref) {
16
16
  children = _ref.children,
17
17
  title = _ref.title,
18
18
  extra = _ref.extra,
19
+ arrow = _ref.arrow,
19
20
  labelCol = _ref.labelCol,
20
21
  labelAlign = _ref.labelAlign,
21
- wrapperAlign = _ref.wrapperAlign,
22
+ contentAlign = _ref.contentAlign,
22
23
  divider = _ref.divider,
24
+ size = _ref.size,
23
25
  styles = _ref.styles;
24
26
  var handleRender = function handleRender() {
25
27
  if (children) {
26
28
  if (Array.isArray(children)) {
27
- var childrenArray = [];
28
- children.filter(function (child) {
29
+ var validChildren = React.Children.toArray(children).filter(function (child) {
29
30
  return /*#__PURE__*/React.isValidElement(child) && (child.type == Cell || child.type == InternalCell);
30
- }).forEach(function (child, index) {
31
- childrenArray.push(child);
32
- if (divider && index < React.Children.count(children) - 1) {
33
- childrenArray.push(divider);
31
+ });
32
+ var childrenArray = [];
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) {
39
+ if ( /*#__PURE__*/React.isValidElement(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
+ }));
44
+ } else {
45
+ childrenArray.push( /*#__PURE__*/React.createElement(React.Fragment, {
46
+ key: "divider-".concat(index)
47
+ }, divider));
48
+ }
34
49
  }
35
50
  });
36
51
  return childrenArray;
@@ -44,8 +59,10 @@ export var CellGroup = function CellGroup(_ref) {
44
59
  value: {
45
60
  labelCol: labelCol,
46
61
  labelAlign: labelAlign,
47
- wrapperAlign: wrapperAlign,
62
+ contentAlign: contentAlign,
48
63
  extra: extra,
64
+ arrow: arrow,
65
+ size: size,
49
66
  styles: {
50
67
  cell: styles === null || styles === void 0 ? void 0 : styles.cell,
51
68
  label: styles === null || styles === void 0 ? void 0 : styles.label,
package/dist/Cell/cell.js CHANGED
@@ -9,77 +9,60 @@ import React, { useContext, useMemo } from 'react';
9
9
  import "./styles.scss";
10
10
  import { CellGroupContext } from "./context";
11
11
  import { assign } from "lodash-es";
12
+ import { RightOutline } from "@trionesdev/antd-mobile-icons-react";
12
13
  var cls = 'triones-antm-cell';
13
14
  export var Cell = function Cell(_ref) {
15
+ var _ref2, _ref3, _ref4;
14
16
  var className = _ref.className,
15
17
  style = _ref.style,
16
18
  placeholder = _ref.placeholder,
17
19
  children = _ref.children,
18
20
  label = _ref.label,
19
21
  extra = _ref.extra,
22
+ arrow = _ref.arrow,
20
23
  labelCol = _ref.labelCol,
21
24
  labelAlign = _ref.labelAlign,
22
- wrapperAlign = _ref.wrapperAlign,
25
+ contentAlign = _ref.contentAlign,
23
26
  onClick = _ref.onClick,
24
27
  styles = _ref.styles;
25
28
  var _useContext = useContext(CellGroupContext),
26
29
  ctxLabelCol = _useContext.labelCol,
27
30
  ctxLabelAlign = _useContext.labelAlign,
28
- ctxWrapperAlign = _useContext.wrapperAlign,
31
+ ctxContentAlign = _useContext.contentAlign,
32
+ ctxSize = _useContext.size,
33
+ ctxArrow = _useContext.arrow,
29
34
  ctxExtra = _useContext.extra,
30
35
  ctxStyles = _useContext.styles;
31
36
  var labelWidth = useMemo(function () {
32
37
  return (labelCol === null || labelCol === void 0 ? void 0 : labelCol.flex) || (ctxLabelCol === null || ctxLabelCol === void 0 ? void 0 : ctxLabelCol.flex) || 'auto';
33
38
  }, [labelCol, ctxLabelCol]);
34
- var labelAlignStyle = useMemo(function () {
35
- var align = labelAlign || ctxLabelAlign;
36
- switch (align) {
37
- case 'left':
38
- return 'start';
39
- case 'center':
40
- return 'center';
41
- case 'right':
42
- return 'end';
43
- default:
44
- return 'start';
45
- }
46
- }, [labelAlign, ctxLabelAlign]);
47
- var wrapperAlignStyle = useMemo(function () {
48
- var align = wrapperAlign || ctxWrapperAlign;
49
- switch (align) {
50
- case 'left':
51
- return 'start';
52
- case 'center':
53
- return 'center';
54
- case 'right':
55
- return 'end';
56
- default:
57
- return 'start';
58
- }
59
- }, [wrapperAlign, ctxWrapperAlign]);
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;
60
43
  var mergedStyles = assign({}, ctxStyles, styles);
61
44
  if (style) {
62
45
  mergedStyles.cell = assign(mergedStyles.cell, style);
63
46
  }
47
+ var sizePossible = ['small', 'medium', 'large'].includes(finalSize);
64
48
  return /*#__PURE__*/React.createElement("div", {
65
- className: classNames(cls, className),
49
+ className: classNames(cls, _defineProperty({}, "".concat(cls, "-").concat(finalSize), sizePossible), className),
66
50
  style: _objectSpread({}, mergedStyles.cell),
67
51
  onClick: onClick
68
52
  }, label && /*#__PURE__*/React.createElement("div", {
69
- className: classNames("".concat(cls, "-label")),
53
+ className: classNames("".concat(cls, "-label"), "".concat(cls, "-label-").concat(finalLabelAlign)),
70
54
  style: _objectSpread({
71
- width: labelWidth,
72
- justifyContent: labelAlignStyle
55
+ width: labelWidth
73
56
  }, mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.label)
74
57
  }, label), /*#__PURE__*/React.createElement("div", {
75
- className: classNames("".concat(cls, "-content")),
76
- style: _objectSpread({
77
- justifyContent: wrapperAlignStyle
78
- }, mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.content)
58
+ className: classNames("".concat(cls, "-content"), "".concat(cls, "-content-").concat(finalContentAlign)),
59
+ style: _objectSpread({}, mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.content)
79
60
  }, children || placeholder && /*#__PURE__*/React.createElement("div", {
80
61
  className: classNames("".concat(cls, "-placeholder"))
81
62
  }, placeholder)), (extra || ctxExtra) && /*#__PURE__*/React.createElement("div", {
82
63
  className: classNames("".concat(cls, "-extra")),
83
64
  style: mergedStyles === null || mergedStyles === void 0 ? void 0 : mergedStyles.extra
84
- }, extra || ctxExtra));
65
+ }, extra || ctxExtra), finalArrow && /*#__PURE__*/React.createElement("div", {
66
+ className: classNames("".concat(cls, "-arrow"))
67
+ }, /*#__PURE__*/React.createElement(RightOutline, null)));
85
68
  };
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
- import { Col } from "../types";
2
+ import { AntSize, Col } from "../types";
3
3
  import { align } from "./types";
4
4
  type CellGroupContextType = {
5
5
  labelCol?: Col;
6
6
  labelAlign?: align;
7
- wrapperAlign?: align;
7
+ contentAlign?: align;
8
+ arrow?: boolean;
8
9
  extra?: React.ReactNode;
10
+ size?: AntSize;
9
11
  styles?: {
10
12
  cell?: React.CSSProperties;
11
13
  label?: React.CSSProperties;
@@ -1,52 +1,81 @@
1
- @use "../style/variable" as variable;
2
-
3
- $cellCls: 'triones-antm-cell';
4
-
5
- .#{$cellCls} {
6
- padding-block: 4Px;
7
- display: flex;
8
- gap: 4Px;
9
- align-items: center;
10
-
11
-
12
- &-label {
13
- display: flex;
14
- align-items: center;
15
- }
16
-
17
- &-content {
18
- flex: 1 auto;
19
- display: flex;
20
- align-items: center;
21
- min-height: 20Px;
22
- }
23
-
24
- &-extra {
25
- display: flex;
26
- align-items: center;
27
- }
28
-
29
-
30
- &-placeholder {
31
- font-size: variable.$trionesFontSize;
32
- color: variable.$trionesColorTextPlaceholder;
33
- }
34
- }
35
-
36
- .#{$cellCls}-group {
37
- display: flex;
38
- flex-direction: column;
39
- border-radius: variable.$trionesBorderRadius;
40
-
41
- &-title {
42
- padding: 4Px 4Px;
43
- display: flex;
44
- justify-content: space-between;
45
-
46
- &-text {
47
- }
48
-
49
- &-extra {
50
- }
51
- }
52
- }
1
+ @use "../style/variable" as variable;
2
+
3
+ $cellCls: 'triones-antm-cell';
4
+
5
+ .#{$cellCls} {
6
+ display: flex;
7
+ gap: 4Px;
8
+ align-items: center;
9
+
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 {
21
+ display: flex;
22
+ align-items: center;
23
+ &-start{
24
+ justify-content: flex-start;
25
+ }
26
+ &-end{
27
+ justify-content: flex-end;
28
+ }
29
+ }
30
+
31
+ &-content {
32
+ flex: 1 auto;
33
+ display: flex;
34
+ align-items: center;
35
+ min-height: 20Px;
36
+ &-start{
37
+ justify-content: flex-start;
38
+ }
39
+ &-end{
40
+ justify-content: flex-end;
41
+ }
42
+ }
43
+
44
+ &-extra {
45
+ display: flex;
46
+ align-items: center;
47
+ }
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;
61
+ }
62
+ }
63
+
64
+ .#{$cellCls}-group {
65
+ display: flex;
66
+ flex-direction: column;
67
+ border-radius: variable.$trionesBorderRadius;
68
+
69
+ &-title {
70
+ padding: 4Px 4Px;
71
+ display: flex;
72
+ justify-content: space-between;
73
+
74
+ &-text {
75
+ }
76
+
77
+ &-extra {
78
+ }
79
+
80
+ }
81
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { Col } from "../types";
2
+ import { AntSize, Col } from "../types";
3
3
  export declare const cls = "triones-antm-cell";
4
- export type align = 'left' | 'center' | 'right';
4
+ export type align = 'start' | 'center' | 'end';
5
5
  export type CellProps = {
6
6
  className?: string;
7
7
  style?: React.CSSProperties;
@@ -27,7 +27,8 @@ export type CellProps = {
27
27
  onClick?: () => void;
28
28
  labelCol?: Col;
29
29
  labelAlign?: align;
30
- wrapperAlign?: align;
30
+ contentAlign?: align;
31
+ size?: AntSize;
31
32
  styles?: {
32
33
  label?: React.CSSProperties;
33
34
  content?: React.CSSProperties;
@@ -49,8 +50,9 @@ export type CellGroupProps = {
49
50
  arrow?: boolean;
50
51
  labelCol?: Col;
51
52
  labelAlign?: align;
52
- wrapperAlign?: align;
53
+ contentAlign?: align;
53
54
  divider?: ReactNode;
55
+ size?: AntSize;
54
56
  styles?: {
55
57
  container?: React.CSSProperties;
56
58
  title?: React.CSSProperties;
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
5
5
  import React from 'react';
6
6
  import { cls } from "./types";
7
7
  import classNames from 'classnames';
8
- import { CheckOutline } from "../../../antd-mobile-icons-react";
8
+ import { CheckOutline } from '@trionesdev/antd-mobile-icons-react';
9
9
  export var CheckboxButton = function CheckboxButton(_ref) {
10
10
  var children = _ref.children,
11
11
  checked = _ref.checked,
@@ -30,12 +30,11 @@ export var CheckboxGroup = function CheckboxGroup(_ref) {
30
30
  value: innerValue,
31
31
  onValueChange: function onValueChange(v) {
32
32
  setInnerValue(v);
33
- console.log('value', v);
34
33
  onChange === null || onChange === void 0 || onChange(v);
35
34
  }
36
35
  }
37
36
  }, /*#__PURE__*/React.createElement("div", {
38
- className: classNames("".concat(cls, "-group}"))
37
+ className: classNames("".concat(cls, "-group"))
39
38
  }, !isEmpty(options) && /*#__PURE__*/React.createElement(Space, {
40
39
  direction: direction
41
40
  }, options === null || options === void 0 ? void 0 : options.map(function (item, index) {
@@ -2,7 +2,7 @@ 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
- import { CheckOutline } from "../../../antd-mobile-icons-react";
5
+ import { CheckOutline } from '@trionesdev/antd-mobile-icons-react';
6
6
  import classNames from 'classnames';
7
7
  import React from 'react';
8
8
  import "./index.scss";