@digitalc/dxp-ui 0.0.5-alpha.15 → 0.0.5-alpha.17

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 (238) hide show
  1. package/README.md +81 -47
  2. package/es/assets/token.json +128 -102
  3. package/es/components/Accordion/designTokens.d.ts +3 -3
  4. package/es/components/Accordion/designTokens.js +22 -14
  5. package/es/components/Accordion/index.js +8 -4
  6. package/es/components/Amount/designTokens.d.ts +2 -2
  7. package/es/components/Amount/designTokens.js +12 -8
  8. package/es/components/Amount/index.d.ts +3 -10
  9. package/es/components/Amount/index.js +122 -136
  10. package/es/components/Button/designTokens.d.ts +18 -3
  11. package/es/components/Button/designTokens.js +136 -122
  12. package/es/components/Button/index.d.ts +16 -5
  13. package/es/components/Button/index.js +89 -94
  14. package/es/components/Button/style/index.less +1 -1
  15. package/es/components/Card/designTokens.d.ts +9 -0
  16. package/es/components/Card/designTokens.js +14 -0
  17. package/es/components/Card/index.d.ts +15 -0
  18. package/es/components/Card/index.js +66 -0
  19. package/es/components/Card/style/index.less +45 -0
  20. package/es/components/Card/style/variables.less +4 -0
  21. package/es/components/Chip/designTokens.d.ts +2 -2
  22. package/es/components/Chip/designTokens.js +25 -21
  23. package/es/components/Chip/index.js +9 -8
  24. package/es/components/Divider/designTokens.d.ts +4 -0
  25. package/es/components/Divider/designTokens.js +9 -0
  26. package/es/components/Divider/index.d.ts +3 -8
  27. package/es/components/Divider/index.js +31 -49
  28. package/es/components/Drawer/designTokens.d.ts +2 -2
  29. package/es/components/Drawer/designTokens.js +30 -26
  30. package/es/components/Drawer/index.d.ts +6 -2
  31. package/es/components/Drawer/index.js +71 -68
  32. package/es/components/Drawer/style/index.less +13 -7
  33. package/es/components/GlobalTokenProvider/index.d.ts +11 -0
  34. package/es/components/GlobalTokenProvider/index.js +16 -0
  35. package/es/components/Icon/designTokens.d.ts +3 -3
  36. package/es/components/Icon/designTokens.js +11 -6
  37. package/es/components/Icon/index.js +6 -2
  38. package/es/components/IconButton/designTokens.d.ts +3 -4
  39. package/es/components/IconButton/designTokens.js +38 -32
  40. package/es/components/IconButton/index.d.ts +1 -1
  41. package/es/components/IconButton/index.js +7 -7
  42. package/es/components/Image/index.d.ts +1 -1
  43. package/es/components/Image/index.js +4 -3
  44. package/es/components/ListItem/designTokens.d.ts +4 -2
  45. package/es/components/ListItem/designTokens.js +36 -30
  46. package/es/components/ListItem/index.d.ts +12 -2
  47. package/es/components/ListItem/index.js +95 -30
  48. package/es/components/ListItem/style/index.less +42 -9
  49. package/es/components/Modal/designTokens.d.ts +11 -20
  50. package/es/components/Modal/designTokens.js +39 -30
  51. package/es/components/Modal/index.js +24 -11
  52. package/es/components/Navigation/designTokens.d.ts +9 -8
  53. package/es/components/Navigation/designTokens.js +24 -18
  54. package/es/components/Navigation/index.d.ts +1 -0
  55. package/es/components/Navigation/index.js +14 -10
  56. package/es/components/Notification/designTokens.d.ts +9 -0
  57. package/es/components/Notification/designTokens.js +14 -0
  58. package/es/components/Notification/index.d.ts +12 -0
  59. package/es/components/Notification/index.js +54 -0
  60. package/es/components/Notification/style/index.less +45 -0
  61. package/es/components/Notification/style/variables.less +4 -0
  62. package/es/components/Search/designTokens.d.ts +4 -4
  63. package/es/components/Search/designTokens.js +57 -46
  64. package/es/components/Search/index.js +15 -9
  65. package/es/components/Stepper/designTokens.d.ts +4 -5
  66. package/es/components/Stepper/designTokens.js +48 -40
  67. package/es/components/Stepper/index.d.ts +9 -10
  68. package/es/components/Stepper/index.js +139 -135
  69. package/es/components/Stepper/style/index.less +27 -12
  70. package/es/components/StickyFooter/designTokens.d.ts +2 -2
  71. package/es/components/StickyFooter/designTokens.js +20 -16
  72. package/es/components/StickyFooter/index.d.ts +2 -2
  73. package/es/components/StickyFooter/index.js +68 -39
  74. package/es/components/StickyFooter/style/index.less +5 -3
  75. package/es/components/Tabs/designTokens.d.ts +6 -6
  76. package/es/components/Tabs/designTokens.js +77 -60
  77. package/es/components/Tabs/index.js +11 -6
  78. package/es/components/Tag/designTokens.d.ts +42 -42
  79. package/es/components/Tag/designTokens.js +139 -95
  80. package/es/components/Tag/index.d.ts +1 -1
  81. package/es/components/Tag/index.js +16 -3
  82. package/es/components/Text/designTokens.d.ts +19 -10
  83. package/es/components/Text/designTokens.js +65 -51
  84. package/es/components/Text/index.d.ts +2 -1
  85. package/es/components/Text/index.js +42 -12
  86. package/es/components/TextInputInside/designTokens.d.ts +3 -12
  87. package/es/components/TextInputInside/designTokens.js +59 -57
  88. package/es/components/TextInputInside/index.js +10 -7
  89. package/es/components/TextInputOutside/designTokens.d.ts +5 -5
  90. package/es/components/TextInputOutside/designTokens.js +77 -61
  91. package/es/components/TextInputOutside/index.js +12 -7
  92. package/es/components/TextLink/designTokens.d.ts +2 -2
  93. package/es/components/TextLink/designTokens.js +14 -10
  94. package/es/components/TextLink/index.js +2 -1
  95. package/es/components/Toast/designTokens.d.ts +2 -2
  96. package/es/components/Toast/designTokens.js +20 -19
  97. package/es/components/Toast/index.js +2 -1
  98. package/es/components/Toggle/designTokens.d.ts +2 -2
  99. package/es/components/Toggle/designTokens.js +16 -12
  100. package/es/components/Toggle/index.js +2 -1
  101. package/es/components/index.d.ts +7 -1
  102. package/es/components/index.js +6 -2
  103. package/es/constants/index.d.ts +4 -1
  104. package/es/constants/index.js +5 -1
  105. package/es/index.d.ts +2 -0
  106. package/es/index.js +4 -0
  107. package/es/tokens/DXPGlobal.d.ts +27 -19
  108. package/es/tokens/DXPGlobal.js +3 -2
  109. package/es/utils/TokenContext.d.ts +14 -0
  110. package/es/utils/TokenContext.js +91 -0
  111. package/es/utils/deviceType.d.ts +14 -0
  112. package/es/utils/deviceType.js +65 -0
  113. package/es/utils/index.d.ts +9 -0
  114. package/es/utils/index.js +9 -0
  115. package/es/utils/tokenHelper.js +2 -5
  116. package/es/utils/tokenManager.d.ts +82 -20
  117. package/es/utils/tokenManager.js +857 -779
  118. package/lib/assets/token.json +128 -102
  119. package/lib/components/Accordion/designTokens.d.ts +3 -3
  120. package/lib/components/Accordion/designTokens.js +25 -17
  121. package/lib/components/Accordion/index.js +8 -4
  122. package/lib/components/Amount/designTokens.d.ts +2 -2
  123. package/lib/components/Amount/designTokens.js +13 -9
  124. package/lib/components/Amount/index.d.ts +3 -10
  125. package/lib/components/Amount/index.js +84 -90
  126. package/lib/components/Button/designTokens.d.ts +18 -3
  127. package/lib/components/Button/designTokens.js +120 -114
  128. package/lib/components/Button/index.d.ts +16 -5
  129. package/lib/components/Button/index.js +59 -51
  130. package/lib/components/Button/style/index.less +1 -1
  131. package/lib/components/Card/designTokens.d.ts +9 -0
  132. package/lib/components/Card/designTokens.js +37 -0
  133. package/lib/components/Card/index.d.ts +15 -0
  134. package/lib/components/Card/index.js +156 -0
  135. package/lib/components/Card/style/index.less +45 -0
  136. package/lib/components/Card/style/variables.less +4 -0
  137. package/lib/components/Chip/designTokens.d.ts +2 -2
  138. package/lib/components/Chip/designTokens.js +25 -21
  139. package/lib/components/Chip/index.js +8 -5
  140. package/lib/components/Divider/designTokens.d.ts +4 -0
  141. package/lib/components/Divider/designTokens.js +32 -0
  142. package/lib/components/Divider/index.d.ts +3 -8
  143. package/lib/components/Divider/index.js +41 -43
  144. package/lib/components/Drawer/designTokens.d.ts +2 -2
  145. package/lib/components/Drawer/designTokens.js +31 -38
  146. package/lib/components/Drawer/index.d.ts +6 -2
  147. package/lib/components/Drawer/index.js +80 -53
  148. package/lib/components/Drawer/style/index.less +13 -7
  149. package/lib/components/GlobalTokenProvider/index.d.ts +11 -0
  150. package/lib/components/GlobalTokenProvider/index.js +40 -0
  151. package/lib/components/Icon/designTokens.d.ts +3 -3
  152. package/lib/components/Icon/designTokens.js +11 -17
  153. package/lib/components/Icon/index.js +5 -4
  154. package/lib/components/IconButton/designTokens.d.ts +3 -4
  155. package/lib/components/IconButton/designTokens.js +41 -34
  156. package/lib/components/IconButton/index.d.ts +1 -1
  157. package/lib/components/IconButton/index.js +25 -23
  158. package/lib/components/Image/index.d.ts +1 -1
  159. package/lib/components/Image/index.js +4 -4
  160. package/lib/components/ListItem/designTokens.d.ts +4 -2
  161. package/lib/components/ListItem/designTokens.js +36 -41
  162. package/lib/components/ListItem/index.d.ts +12 -2
  163. package/lib/components/ListItem/index.js +115 -46
  164. package/lib/components/ListItem/style/index.less +42 -9
  165. package/lib/components/Modal/designTokens.d.ts +11 -20
  166. package/lib/components/Modal/designTokens.js +44 -60
  167. package/lib/components/Modal/index.js +63 -16
  168. package/lib/components/Navigation/designTokens.d.ts +9 -8
  169. package/lib/components/Navigation/designTokens.js +24 -29
  170. package/lib/components/Navigation/index.d.ts +1 -0
  171. package/lib/components/Navigation/index.js +13 -12
  172. package/lib/components/Notification/designTokens.d.ts +9 -0
  173. package/lib/components/Notification/designTokens.js +37 -0
  174. package/lib/components/Notification/index.d.ts +12 -0
  175. package/lib/components/Notification/index.js +110 -0
  176. package/lib/components/Notification/style/index.less +45 -0
  177. package/lib/components/Notification/style/variables.less +4 -0
  178. package/lib/components/Search/designTokens.d.ts +4 -4
  179. package/lib/components/Search/designTokens.js +61 -49
  180. package/lib/components/Search/index.js +31 -9
  181. package/lib/components/Stepper/designTokens.d.ts +4 -5
  182. package/lib/components/Stepper/designTokens.js +70 -62
  183. package/lib/components/Stepper/index.d.ts +9 -10
  184. package/lib/components/Stepper/index.js +104 -53
  185. package/lib/components/Stepper/style/index.less +27 -12
  186. package/lib/components/StickyFooter/designTokens.d.ts +2 -2
  187. package/lib/components/StickyFooter/designTokens.js +21 -17
  188. package/lib/components/StickyFooter/index.d.ts +2 -2
  189. package/lib/components/StickyFooter/index.js +50 -18
  190. package/lib/components/StickyFooter/style/index.less +5 -3
  191. package/lib/components/Tabs/designTokens.d.ts +6 -6
  192. package/lib/components/Tabs/designTokens.js +80 -63
  193. package/lib/components/Tabs/index.js +19 -12
  194. package/lib/components/Tag/designTokens.d.ts +42 -42
  195. package/lib/components/Tag/designTokens.js +159 -115
  196. package/lib/components/Tag/index.d.ts +1 -1
  197. package/lib/components/Tag/index.js +27 -14
  198. package/lib/components/Text/designTokens.d.ts +19 -10
  199. package/lib/components/Text/designTokens.js +65 -51
  200. package/lib/components/Text/index.d.ts +2 -1
  201. package/lib/components/Text/index.js +407 -297
  202. package/lib/components/TextInputInside/designTokens.d.ts +3 -12
  203. package/lib/components/TextInputInside/designTokens.js +62 -75
  204. package/lib/components/TextInputInside/index.js +10 -7
  205. package/lib/components/TextInputOutside/designTokens.d.ts +5 -5
  206. package/lib/components/TextInputOutside/designTokens.js +82 -66
  207. package/lib/components/TextInputOutside/index.js +12 -8
  208. package/lib/components/TextLink/designTokens.d.ts +2 -2
  209. package/lib/components/TextLink/designTokens.js +14 -21
  210. package/lib/components/TextLink/index.js +3 -2
  211. package/lib/components/Toast/designTokens.d.ts +2 -2
  212. package/lib/components/Toast/designTokens.js +20 -16
  213. package/lib/components/Toast/index.js +7 -6
  214. package/lib/components/Toggle/designTokens.d.ts +2 -2
  215. package/lib/components/Toggle/designTokens.js +16 -23
  216. package/lib/components/Toggle/index.js +3 -2
  217. package/lib/components/index.d.ts +7 -1
  218. package/lib/components/index.js +10 -2
  219. package/lib/constants/index.d.ts +4 -1
  220. package/lib/constants/index.js +5 -1
  221. package/lib/index.d.ts +2 -0
  222. package/lib/index.js +22 -0
  223. package/lib/tokens/DXPGlobal.d.ts +27 -19
  224. package/lib/tokens/DXPGlobal.js +1 -1
  225. package/lib/utils/TokenContext.d.ts +14 -0
  226. package/lib/utils/TokenContext.js +85 -0
  227. package/lib/utils/deviceType.d.ts +14 -0
  228. package/lib/utils/deviceType.js +56 -0
  229. package/lib/utils/index.d.ts +9 -0
  230. package/lib/utils/index.js +44 -0
  231. package/lib/utils/tokenHelper.js +2 -12
  232. package/lib/utils/tokenManager.d.ts +82 -20
  233. package/lib/utils/tokenManager.js +840 -777
  234. package/package.json +14 -11
  235. package/umd/dxp-ui.min.css +1 -1
  236. package/umd/dxp-ui.min.js +1 -1
  237. package/lib/components/Button/demo/index.d.ts +0 -3
  238. package/lib/components/Button/demo/index.js +0 -138
@@ -0,0 +1,45 @@
1
+
2
+ @import './variables.less';
3
+
4
+ @components: card;
5
+ .@{prefix}-@{components} {
6
+ background: #FFFFFF;
7
+ overflow: unset;
8
+ }
9
+ .@{prefix}-@{components}-whiteDivider,
10
+ .@{prefix}-@{components}-grayDivider {
11
+ padding: 0;
12
+ .@{prefix}-@{components}-list {
13
+ background: #FFFFFF;
14
+ overflow: unset;
15
+ > div {
16
+ position: relative;
17
+ }
18
+ > div + div {
19
+ border-top: 1px dashed #D5D5D5;
20
+ &::before,
21
+ &::after {
22
+ content: '';
23
+ display: block;
24
+ height: 16px;
25
+ width: 8px;
26
+ position: absolute;
27
+ z-index: 99;
28
+ top: -8px;
29
+ border: 1px solid #d5d5d5;
30
+ }
31
+ &::before {
32
+ left: -1px;
33
+ border-top-right-radius: 16px;
34
+ border-bottom-right-radius: 16px;
35
+ border-left: 0;
36
+ }
37
+ &::after {
38
+ right: -1px;
39
+ border-top-left-radius: 16px;
40
+ border-bottom-left-radius: 16px;
41
+ border-right: 0;
42
+ }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,4 @@
1
+
2
+ @import '../../../style/variables.less';
3
+
4
+ @btn-primary-bg-default: var(--base-color-primary);
@@ -1,4 +1,4 @@
1
- declare const designTokens: {
1
+ declare const useDesignTokens: () => {
2
2
  borderRadiusChip: any;
3
3
  colorChipBackgroundStandard: any;
4
4
  colorChipBorderStandard: any;
@@ -12,4 +12,4 @@ declare const designTokens: {
12
12
  colorChipTextActive: any;
13
13
  sizingChipIconClose: any;
14
14
  };
15
- export { designTokens };
15
+ export { useDesignTokens };
@@ -1,22 +1,26 @@
1
- import { getToken } from "../../utils/tokenHelper";
2
- var designTokens = {
3
- borderRadiusChip: getToken('borderRadiusChip'),
4
- // 选中的边框颜色
5
- colorChipBackgroundStandard: getToken('colorChipBackgroundStandard'),
6
- // 选中的label颜色
7
- colorChipBorderStandard: getToken('colorChipBorderStandard'),
8
- // hover label颜色
9
- borderWidthChip: getToken('borderWidthChip'),
10
- // active label颜色
11
- spacingChipPaddingHorizontal: getToken('spacingChipPaddingHorizontal'),
12
- // 默认label颜色
13
- spacingChipPaddingVertical: getToken('spacingChipPaddingVertical'),
14
- // 未选中的边框
15
- colorChipBackgroundHover: getToken('colorChipBackgroundHover'),
16
- colorChipTextInactive: getToken('colorChipTextInactive'),
17
- colorChipBackgroundActive: getToken('colorChipBackgroundActive'),
18
- colorChipBorderActive: getToken('colorChipBorderActive'),
19
- colorChipTextActive: getToken('colorChipTextActive'),
20
- sizingChipIconClose: getToken('sizingChipIconClose')
1
+ import { useDynamicTokens } from "../../utils";
2
+ var useDesignTokens = function useDesignTokens() {
3
+ var getToken = useDynamicTokens();
4
+ var designTokens = {
5
+ borderRadiusChip: getToken('borderRadiusChip'),
6
+ // 选中的边框颜色
7
+ colorChipBackgroundStandard: getToken('colorChipBackgroundStandard'),
8
+ // 选中的label颜色
9
+ colorChipBorderStandard: getToken('colorChipBorderStandard'),
10
+ // hover label颜色
11
+ borderWidthChip: getToken('borderWidthChip'),
12
+ // active label颜色
13
+ spacingChipPaddingHorizontal: getToken('spacingChipPaddingHorizontal'),
14
+ // 默认label颜色
15
+ spacingChipPaddingVertical: getToken('spacingChipPaddingVertical'),
16
+ // 未选中的边框
17
+ colorChipBackgroundHover: getToken('colorChipBackgroundHover'),
18
+ colorChipTextInactive: getToken('colorChipTextInactive'),
19
+ colorChipBackgroundActive: getToken('colorChipBackgroundActive'),
20
+ colorChipBorderActive: getToken('colorChipBorderActive'),
21
+ colorChipTextActive: getToken('colorChipTextActive'),
22
+ sizingChipIconClose: getToken('sizingChipIconClose')
23
+ };
24
+ return designTokens;
21
25
  };
22
- export { designTokens };
26
+ export { useDesignTokens };
@@ -4,11 +4,11 @@ import "antd/es/tag/style";
4
4
  import _Tag from "antd/es/tag";
5
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
- var _excluded = ["types", "children", "prefixCls", "checked", "onChange", "onClose", "style"];
7
+ var _excluded = ["types", "children", "prefixCls", "checked", "onChange", "onClose", "className", "style"];
8
8
  import React from 'react';
9
9
  import { useStyleRegister } from '@ant-design/cssinjs';
10
10
  import { theme } from "../../utils/theme";
11
- import { designTokens } from "./designTokens";
11
+ import { useDesignTokens } from "./designTokens";
12
12
  import { BASE_CLASS_PREFIX } from "../../constants";
13
13
  import Text from "../Text";
14
14
  import "./style/index.less";
@@ -18,14 +18,17 @@ var Chip = function Chip(props) {
18
18
  types = _props$types === void 0 ? 'textOnly' : _props$types,
19
19
  children = props.children,
20
20
  _props$prefixCls = props.prefixCls,
21
- prefixCls = _props$prefixCls === void 0 ? 'tag' : _props$prefixCls,
21
+ prefixCls = _props$prefixCls === void 0 ? "".concat(BASE_CLASS_PREFIX, "-tag") : _props$prefixCls,
22
22
  checked = props.checked,
23
23
  _props$onChange = props.onChange,
24
24
  onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
25
25
  _props$onClose = props.onClose,
26
26
  _onClose = _props$onClose === void 0 ? function () {} : _props$onClose,
27
+ _props$className = props.className,
28
+ className = _props$className === void 0 ? '' : _props$className,
27
29
  style = props.style,
28
30
  attr = _objectWithoutProperties(props, _excluded);
31
+ var designTokens = useDesignTokens();
29
32
  var borderRadiusChip = designTokens.borderRadiusChip,
30
33
  colorChipBackgroundStandard = designTokens.colorChipBackgroundStandard,
31
34
  colorChipBorderStandard = designTokens.colorChipBorderStandard,
@@ -41,9 +44,7 @@ var Chip = function Chip(props) {
41
44
  var useCustomButtonStyle = function useCustomButtonStyle() {
42
45
  var hashId = useStyleRegister({
43
46
  theme: theme,
44
- token: {
45
- baseColor: 'blue'
46
- },
47
+ token: {},
47
48
  path: ['tag-textonly']
48
49
  }, function () {
49
50
  return "\n .tag-textonly {\n color: ".concat(colorChipTextInactive, ";\n border-color: ").concat(colorChipBorderStandard, ";\n border-width: ").concat(borderWidthChip, "px;\n border-radius: ").concat(borderRadiusChip, "px;\n background-color: ").concat(colorChipBackgroundStandard, ";\n padding: ").concat(spacingChipPaddingVertical, "px ").concat(spacingChipPaddingHorizontal, "px;\n }\n .tag-textonly:hover {\n background-color: ").concat(colorChipBackgroundHover, ";\n }\n .tag-textonly:active {\n background-color: ").concat(colorChipBackgroundHover, ";\n }\n .tag-active,\n .tag-active:hover,\n .tag-active:active {\n color: ").concat(colorChipTextActive, ";\n border-color: ").concat(colorChipBorderActive, ";\n background-color: ").concat(colorChipBackgroundActive, ";\n }\n ");
@@ -69,7 +70,7 @@ var Chip = function Chip(props) {
69
70
  }
70
71
  },
71
72
  children: types === 'textOnly' ? /*#__PURE__*/_jsx("span", {
72
- className: "".concat(BASE_CLASS_PREFIX, "-").concat(prefixCls, "-").concat(types, " tag-textonly ").concat(checked ? 'tag-active' : ''),
73
+ className: "".concat(prefixCls, "-").concat(types, " tag-textonly ").concat(checked ? 'tag-active' : '', " ").concat(className),
73
74
  onClick: function onClick() {
74
75
  return onChange();
75
76
  },
@@ -79,7 +80,7 @@ var Chip = function Chip(props) {
79
80
  children: children
80
81
  })
81
82
  }) : /*#__PURE__*/_jsx(_Tag, _objectSpread(_objectSpread({
82
- className: "".concat(BASE_CLASS_PREFIX, "-").concat(prefixCls, "-").concat(types),
83
+ className: "".concat(prefixCls, "-").concat(types, " ").concat(className),
83
84
  style: _objectSpread({
84
85
  padding: "".concat(spacingChipPaddingVertical, "px ").concat(spacingChipPaddingHorizontal, "px")
85
86
  }, style),
@@ -0,0 +1,4 @@
1
+ declare const useDesignTokens: () => {
2
+ borderColor: any;
3
+ };
4
+ export { useDesignTokens };
@@ -0,0 +1,9 @@
1
+ import { useDynamicTokens } from "../../utils";
2
+ var useDesignTokens = function useDesignTokens() {
3
+ var getToken = useDynamicTokens();
4
+ var designTokens = {
5
+ borderColor: getToken('colorDivider10Horizontal')
6
+ };
7
+ return designTokens;
8
+ };
9
+ export { useDesignTokens };
@@ -1,4 +1,4 @@
1
- import React, { PureComponent } from 'react';
1
+ import React from 'react';
2
2
  import './style/index.less';
3
3
  export interface DividerProps {
4
4
  type?: 'solid' | 'dashed' | 'eight' | 'whiteBg' | 'grayBg' | 'vertical';
@@ -7,10 +7,5 @@ export interface DividerProps {
7
7
  style?: React.CSSProperties;
8
8
  [key: string]: any;
9
9
  }
10
- export default class Divider extends PureComponent<DividerProps> {
11
- static defaultProps: {
12
- type: string;
13
- prefixCls: string;
14
- };
15
- render(): React.JSX.Element;
16
- }
10
+ declare const Divider: (props: DividerProps) => React.JSX.Element;
11
+ export default Divider;
@@ -1,55 +1,37 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- var _excluded = ["children", "className", "prefixCls", "type", "style", "height"];
9
- import React, { PureComponent } from 'react';
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ var _excluded = ["children", "className", "type", "prefixCls", "style", "height"];
5
+ import React from 'react';
10
6
  import { default as classNames } from 'classnames';
11
- import TokenManager from "../../utils/tokenManager";
7
+ import { useDesignTokens } from "./designTokens";
12
8
  import { cssClasses } from "../../constants";
13
9
  import "./style/index.less";
14
10
  import { jsx as _jsx } from "react/jsx-runtime";
15
- var Divider = /*#__PURE__*/function (_PureComponent) {
16
- _inherits(Divider, _PureComponent);
17
- var _super = _createSuper(Divider);
18
- function Divider() {
19
- _classCallCheck(this, Divider);
20
- return _super.apply(this, arguments);
21
- }
22
- _createClass(Divider, [{
23
- key: "render",
24
- value: function render() {
25
- var _this$props = this.props,
26
- children = _this$props.children,
27
- className = _this$props.className,
28
- prefixCls = _this$props.prefixCls,
29
- type = _this$props.type,
30
- style = _this$props.style,
31
- height = _this$props.height,
32
- attr = _objectWithoutProperties(_this$props, _excluded);
33
- var baseProps = {
34
- className: classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-type-").concat(type), type), className)
35
- };
36
- return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread(_objectSpread({}, baseProps), attr), {}, {
37
- style: _objectSpread(_objectSpread({
38
- height: height
39
- }, style), {}, {
40
- borderColor: TokenManager.tokenKey('colorDivider10Horizontal')
41
- }),
42
- children: /*#__PURE__*/_jsx("div", {
43
- children: children
44
- })
45
- }));
46
- }
47
- }]);
48
- return Divider;
49
- }(PureComponent);
50
- _defineProperty(Divider, "defaultProps", {
51
- type: 'solid',
52
- prefixCls: cssClasses.PREFIX + '-divider'
53
- });
54
- export { Divider as default };
55
- ;
11
+ var Divider = function Divider(props) {
12
+ var children = props.children,
13
+ _props$className = props.className,
14
+ className = _props$className === void 0 ? '' : _props$className,
15
+ _props$type = props.type,
16
+ type = _props$type === void 0 ? 'solid' : _props$type,
17
+ _props$prefixCls = props.prefixCls,
18
+ prefixCls = _props$prefixCls === void 0 ? "".concat(cssClasses.PREFIX, "-divider") : _props$prefixCls,
19
+ style = props.style,
20
+ height = props.height,
21
+ attr = _objectWithoutProperties(props, _excluded);
22
+ var designTokens = useDesignTokens();
23
+ var borderColor = designTokens.borderColor;
24
+ var baseProps = {
25
+ className: classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-type-").concat(type), type), className)
26
+ };
27
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread(_objectSpread({}, baseProps), attr), {}, {
28
+ style: _objectSpread({
29
+ height: height,
30
+ borderColor: borderColor
31
+ }, style),
32
+ children: /*#__PURE__*/_jsx("div", {
33
+ children: children
34
+ })
35
+ }));
36
+ };
37
+ export default Divider;
@@ -1,4 +1,4 @@
1
- declare const designTokens: {
1
+ declare const useDesignTokens: () => {
2
2
  colorDrawerBackgroundOverlay: any;
3
3
  colorDrawerBackgroundStandard: any;
4
4
  borderTopLeftRadius: any;
@@ -13,4 +13,4 @@ declare const designTokens: {
13
13
  colorDrawerTextHeader: any;
14
14
  spacingDrawerListOptionHorizontalGap: any;
15
15
  };
16
- export default designTokens;
16
+ export { useDesignTokens };
@@ -1,27 +1,31 @@
1
- import TokenManager from "../../utils/tokenManager";
2
- var designTokens = {
3
- colorDrawerBackgroundOverlay: TokenManager.tokenKey('colorDrawerBackgroundOverlay') || 'rgba(0, 0, 0, 0.60)',
4
- // 遮罩层背景色
5
- colorDrawerBackgroundStandard: TokenManager.tokenKey('colorDrawerBackgroundStandard') || '#FFF',
6
- // 内容的底色
7
- borderTopLeftRadius: TokenManager.tokenKey('borderRadiusDrawerTopLeft'),
8
- // 弹出窗上左上圆角
9
- borderTopRightRadius: TokenManager.tokenKey('borderRadiusDrawerTopRight'),
10
- // 弹出窗上右上圆角
11
- spacingDrawerPaddingHorizontal: TokenManager.tokenKey('spacingDrawerPaddingHorizontal'),
12
- // 内部横padding
13
- spacingDrawerPaddingBottom: TokenManager.tokenKey('spacingDrawerPaddingBottom'),
14
- spacingDrawerPaddingTop: TokenManager.tokenKey('spacingDrawerPaddingTop'),
15
- sizingDrawerHandle: TokenManager.tokenKey('sizingDrawerHandle'),
16
- // 上部 小滑块的宽
17
- colorDrawerHandle: TokenManager.tokenKey('colorDrawerHandle'),
18
- // 上部 小滑块的背景色
19
- spacingDrawerHandlePaddingTop: TokenManager.tokenKey('spacingDrawerHandlePaddingTop'),
20
- // 上部 小滑块
21
- spacingDrawerHandlePaddingBottom: TokenManager.tokenKey('spacingDrawerHandlePaddingBottom'),
22
- // 上部 小滑块
23
- colorDrawerTextHeader: TokenManager.tokenKey('colorDrawerTextHeader'),
24
- // title的颜色
25
- spacingDrawerListOptionHorizontalGap: TokenManager.tokenKey('spacingDrawerListOptionHorizontalGap') // 间距
1
+ import { useDynamicTokens } from "../../utils";
2
+ var useDesignTokens = function useDesignTokens() {
3
+ var getToken = useDynamicTokens();
4
+ var designTokens = {
5
+ colorDrawerBackgroundOverlay: getToken('colorDrawerBackgroundOverlay') || 'rgba(0, 0, 0, 0.60)',
6
+ // 遮罩层背景色
7
+ colorDrawerBackgroundStandard: getToken('colorDrawerBackgroundStandard') || '#FFF',
8
+ // 内容的底色
9
+ borderTopLeftRadius: getToken('borderRadiusDrawerTopLeft'),
10
+ // 弹出窗上左上圆角
11
+ borderTopRightRadius: getToken('borderRadiusDrawerTopRight'),
12
+ // 弹出窗上右上圆角
13
+ spacingDrawerPaddingHorizontal: getToken('spacingDrawerPaddingHorizontal'),
14
+ // 内部横padding
15
+ spacingDrawerPaddingBottom: getToken('spacingDrawerPaddingBottom'),
16
+ spacingDrawerPaddingTop: getToken('spacingDrawerPaddingTop'),
17
+ sizingDrawerHandle: getToken('sizingDrawerHandle'),
18
+ // 上部 小滑块的宽
19
+ colorDrawerHandle: getToken('colorDrawerHandle'),
20
+ // 上部 小滑块的背景色
21
+ spacingDrawerHandlePaddingTop: getToken('spacingDrawerHandlePaddingTop'),
22
+ // 上部 小滑块
23
+ spacingDrawerHandlePaddingBottom: getToken('spacingDrawerHandlePaddingBottom'),
24
+ // 上部 小滑块
25
+ colorDrawerTextHeader: getToken('colorDrawerTextHeader'),
26
+ // title的颜色
27
+ spacingDrawerListOptionHorizontalGap: getToken('spacingDrawerListOptionHorizontalGap') // 间距
28
+ };
29
+ return designTokens;
26
30
  };
27
- export default designTokens;
31
+ export { useDesignTokens };
@@ -1,18 +1,22 @@
1
1
  import React from 'react';
2
2
  import './style/index.less';
3
- export type DrawerType = 'DrawerTypeHandler' | 'DrawerTypeCloseBtn';
3
+ export type DrawerType = 'DrawerTypeHandler' | 'DrawerTypeCloseBtn' | 'DrawerTypeDefault';
4
4
  export declare const DrawerTypeEnum: Record<string, DrawerType>;
5
5
  export interface BottomDrawerProps {
6
+ showClose?: boolean;
7
+ prefix?: string;
8
+ className?: string;
6
9
  visible: boolean;
7
10
  onClose: () => void;
8
11
  children: React.ReactNode;
9
12
  height?: number | string;
10
13
  title?: string;
11
- drawerType: DrawerType;
14
+ drawerType?: DrawerType;
12
15
  bottomBtnText?: string;
13
16
  bottomLinkText?: string;
14
17
  showBottomBorder?: boolean;
15
18
  showImage?: boolean;
19
+ showBottomShadow?: boolean;
16
20
  imageSrc?: string;
17
21
  onLinkClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
18
22
  onBottomBtnClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -1,26 +1,37 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import React, { useState, useEffect, useRef } from 'react';
4
- import designTokens from "./designTokens";
4
+ import { useDesignTokens } from "./designTokens";
5
+ import { isEmpty } from 'lodash';
6
+ import { useStyleRegister } from '@ant-design/cssinjs';
5
7
  import { StickyFooter, Text, Image, Icon } from "../index";
6
8
  import { cssClasses } from "../../constants";
9
+ import { theme } from "../../utils/theme";
7
10
  import "./style/index.less";
8
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
12
  export var DrawerTypeEnum = {
10
13
  DrawerTypeHandler: 'DrawerTypeHandler',
11
- DrawerTypeCloseBtn: 'DrawerTypeCloseBtn'
14
+ DrawerTypeCloseBtn: 'DrawerTypeCloseBtn',
15
+ DrawerTypeDefault: 'DrawerTypeDefault'
12
16
  };
13
17
  var BottomDrawer = function BottomDrawer(_ref) {
14
- var visible = _ref.visible,
18
+ var _ref$prefix = _ref.prefix,
19
+ prefix = _ref$prefix === void 0 ? "".concat(cssClasses.PREFIX, "-drawer") : _ref$prefix,
20
+ _ref$showClose = _ref.showClose,
21
+ showClose = _ref$showClose === void 0 ? true : _ref$showClose,
22
+ _ref$className = _ref.className,
23
+ className = _ref$className === void 0 ? '' : _ref$className,
24
+ visible = _ref.visible,
15
25
  onClose = _ref.onClose,
16
26
  children = _ref.children,
17
27
  height = _ref.height,
18
28
  title = _ref.title,
19
29
  _ref$drawerType = _ref.drawerType,
20
- drawerType = _ref$drawerType === void 0 ? DrawerTypeEnum.DrawerTypeHandler : _ref$drawerType,
30
+ drawerType = _ref$drawerType === void 0 ? DrawerTypeEnum.DrawerTypeDefault : _ref$drawerType,
21
31
  bottomBtnText = _ref.bottomBtnText,
22
32
  bottomLinkText = _ref.bottomLinkText,
23
33
  showBottomBorder = _ref.showBottomBorder,
34
+ showBottomShadow = _ref.showBottomShadow,
24
35
  showImage = _ref.showImage,
25
36
  imageSrc = _ref.imageSrc,
26
37
  onLinkClick = _ref.onLinkClick,
@@ -60,7 +71,7 @@ var BottomDrawer = function BottomDrawer(_ref) {
60
71
  return;
61
72
  }
62
73
  var timer = setTimeout(function () {
63
- var footer = document.querySelector(".".concat(cssClasses.PREFIX, "-stickyFooter"));
74
+ var footer = document.querySelector(".drawer-sticky");
64
75
  if (footer) {
65
76
  var observer = new ResizeObserver(function (entries) {
66
77
  var contentHeight = (entries === null || entries === void 0 ? void 0 : entries[0].contentRect.height) + 10;
@@ -79,6 +90,7 @@ var BottomDrawer = function BottomDrawer(_ref) {
79
90
  return clearTimeout(timer);
80
91
  };
81
92
  }, [visible]);
93
+ var designTokens = useDesignTokens();
82
94
  var colorDrawerBackgroundOverlay = designTokens.colorDrawerBackgroundOverlay,
83
95
  colorDrawerBackgroundStandard = designTokens.colorDrawerBackgroundStandard,
84
96
  borderTopLeftRadius = designTokens.borderTopLeftRadius,
@@ -92,95 +104,86 @@ var BottomDrawer = function BottomDrawer(_ref) {
92
104
  spacingDrawerListOptionHorizontalGap = designTokens.spacingDrawerListOptionHorizontalGap,
93
105
  spacingDrawerPaddingBottom = designTokens.spacingDrawerPaddingBottom,
94
106
  spacingDrawerPaddingTop = designTokens.spacingDrawerPaddingTop;
107
+ var useCustomButtonStyle = function useCustomButtonStyle() {
108
+ var hashId = useStyleRegister({
109
+ theme: theme,
110
+ token: {},
111
+ path: ["".concat(prefix)]
112
+ }, function () {
113
+ return "\n .".concat(prefix, "-mask {\n background: ").concat(colorDrawerBackgroundOverlay, ";\n }\n .").concat(prefix, "-content {\n background: ").concat(colorDrawerBackgroundStandard, ";\n border-top-left-radius: ").concat(borderTopLeftRadius, "px;\n border-top-right-radius:").concat(borderTopRightRadius, "px;\n height:").concat(height, "px;\n }\n .").concat(prefix, "-inner {\n padding-left: ").concat(spacingDrawerPaddingHorizontal, "px;\n padding-right: ").concat(spacingDrawerPaddingHorizontal, "px;\n padding-bottom:").concat(spacingDrawerPaddingBottom, "px;\n }\n .").concat(prefix, "-header {\n .").concat(prefix, "-header-text {\n color: ").concat(colorDrawerTextHeader, ";\n margin-bottom: ").concat(spacingDrawerListOptionHorizontalGap, "px;\n display: block;\n }\n &.center{\n width: 100%;\n text-align: center;\n }\n }\n .").concat(prefix, "-handle-bar {\n width:").concat(sizingDrawerHandle || 0, "px;\n background: ").concat(colorDrawerHandle, ";\n margin-top: ").concat(spacingDrawerHandlePaddingTop, "px !important;\n margin-bottom: ").concat(spacingDrawerHandlePaddingBottom, "px !important; \n }\n .").concat(prefix, "-close-warp {\n padding-top: ").concat(spacingDrawerPaddingTop, "px;\n padding-left: ").concat(spacingDrawerPaddingHorizontal, "px;\n padding-right: ").concat(spacingDrawerPaddingHorizontal, "px;\n }\n ");
114
+ });
115
+ return hashId;
116
+ };
117
+ useCustomButtonStyle();
95
118
  if (!isMounted) return null;
96
- var borderStyle = showBottomBorder ? {} : {
119
+ var borderStyle = showBottomBorder ? {} : showBottomShadow ? {
120
+ boxShadow: '0 -2px 10px 0 rgba(0, 0, 0, 0.06)',
121
+ border: 'none'
122
+ } : {
97
123
  border: 'none'
98
124
  };
125
+ var paddingStyle = paddingBottom > 0 ? {
126
+ paddingBottom: "".concat(paddingBottom, "px")
127
+ } : {};
99
128
  var TitleCom = title ? /*#__PURE__*/_jsx("div", {
100
- className: "".concat(cssClasses.PREFIX, "-drawer-header"),
129
+ className: "".concat(prefix, "-header ").concat(drawerType === DrawerTypeEnum.DrawerTypeDefault ? 'center' : ""),
101
130
  children: /*#__PURE__*/_jsx(Text, {
131
+ className: "".concat(prefix, "-header-text"),
102
132
  size: "TitleT21Bold",
103
- style: {
104
- color: colorDrawerTextHeader,
105
- marginBottom: "".concat(spacingDrawerListOptionHorizontalGap, "px"),
106
- display: 'block'
107
- },
108
133
  children: title
109
134
  })
110
- }) : /*#__PURE__*/_jsx(_Fragment, {});
135
+ }) : /*#__PURE__*/_jsx("div", {});
111
136
  return /*#__PURE__*/_jsx("div", {
112
- className: "".concat(cssClasses.PREFIX, "-drawer-mask ").concat(visible ? 'visible' : ''),
113
- style: {
114
- background: colorDrawerBackgroundOverlay
115
- },
137
+ className: "".concat(prefix, "-mask ").concat(visible ? 'visible' : '', " ").concat(className || ''),
116
138
  onClick: onClose,
117
139
  children: /*#__PURE__*/_jsxs("div", {
118
- className: "".concat(cssClasses.PREFIX, "-drawer-content ").concat(visible ? 'active' : ''),
119
- style: {
120
- height: height,
121
- background: colorDrawerBackgroundStandard,
122
- borderTopLeftRadius: "".concat(borderTopLeftRadius, "px"),
123
- borderTopRightRadius: "".concat(borderTopRightRadius, "px")
124
- },
140
+ className: "".concat(prefix, "-content ").concat(visible ? 'active' : ''),
125
141
  onClick: function onClick(e) {
126
142
  return e.stopPropagation();
127
143
  },
128
- children: [/*#__PURE__*/_jsxs("div", {
129
- className: "".concat(cssClasses.PREFIX, "-drawer-inner"),
130
- style: {
131
- paddingLeft: "".concat(spacingDrawerPaddingHorizontal, "px"),
132
- paddingRight: "".concat(spacingDrawerPaddingHorizontal, "px"),
133
- paddingBottom: "".concat(paddingBottom, "px")
134
- },
144
+ children: [drawerType !== DrawerTypeEnum.DrawerTypeHandler && /*#__PURE__*/_jsxs("div", {
145
+ className: "".concat(prefix, "-close-warp"),
146
+ children: [TitleCom, showClose && /*#__PURE__*/_jsx(Icon, {
147
+ className: "".concat(prefix, "-icon-close"),
148
+ name: "icon-Close",
149
+ onClick: onClose
150
+ })]
151
+ }), /*#__PURE__*/_jsxs("div", {
152
+ className: "".concat(prefix, "-inner"),
153
+ style: _objectSpread({}, paddingStyle),
135
154
  children: [drawerType === DrawerTypeEnum.DrawerTypeHandler && /*#__PURE__*/_jsx("div", {
136
- className: "handle-bar",
137
- style: {
138
- width: sizingDrawerHandle ? "".concat(sizingDrawerHandle, "px") : 0,
139
- background: colorDrawerHandle,
140
- marginTop: "".concat(spacingDrawerHandlePaddingTop, "px"),
141
- marginBottom: "".concat(spacingDrawerHandlePaddingBottom, "px")
142
- }
143
- }), drawerType === DrawerTypeEnum.DrawerTypeCloseBtn && /*#__PURE__*/_jsxs("div", {
144
- className: "close-warp",
145
- style: {
146
- paddingTop: "".concat(spacingDrawerPaddingTop, "px")
147
- // paddingBottom: `${spacingDrawerListOptionHorizontalGap}px`,
148
- },
149
- children: [/*#__PURE__*/_jsx("div", {
150
- children: TitleCom
151
- }), /*#__PURE__*/_jsx(Icon, {
152
- name: "icon-Close",
153
- onClick: onClose
154
- })]
155
+ className: "".concat(prefix, "-handle-bar")
155
156
  }), showImage && /*#__PURE__*/_jsx(Image, {
156
- radio: 2
157
- // preview={false}
158
- ,
157
+ radio: 2,
159
158
  src: imageSrc,
160
159
  imageSize: "100%",
161
160
  style: {
162
161
  marginBottom: "".concat(spacingDrawerPaddingBottom, "px")
163
162
  }
164
- }), drawerType !== DrawerTypeEnum.DrawerTypeCloseBtn && title && TitleCom, children]
165
- }), (!!bottomBtnText || !!bottomLinkText) && /*#__PURE__*/_jsx(StickyFooter, {
163
+ }), drawerType === DrawerTypeEnum.DrawerTypeHandler && title && TitleCom, children]
164
+ }), (!isEmpty(bottomBtnText) || !isEmpty(bottomLinkText)) && /*#__PURE__*/_jsx(StickyFooter, {
165
+ className: "drawer-sticky",
166
166
  onClick: onBottomBtnClick,
167
167
  buttonText: bottomBtnText,
168
168
  style: _objectSpread({
169
169
  flexDirection: 'column',
170
170
  flexShrink: 0
171
171
  }, borderStyle),
172
- children: !!bottomLinkText && /*#__PURE__*/_jsx(Text, {
173
- onClick: function onClick(e) {
174
- e === null || e === void 0 || e.stopPropagation();
175
- if (onLinkClick) {
176
- onLinkClick(e);
177
- }
178
- },
179
- size: "ContentC14TextLink",
180
- style: {
181
- marginTop: "".concat(spacingDrawerListOptionHorizontalGap, "px")
182
- },
183
- children: bottomLinkText
172
+ children: !isEmpty(bottomLinkText) && /*#__PURE__*/_jsx("div", {
173
+ className: "drawer-link",
174
+ children: /*#__PURE__*/_jsx(Text, {
175
+ onClick: function onClick(e) {
176
+ e === null || e === void 0 || e.stopPropagation();
177
+ if (onLinkClick) {
178
+ onLinkClick(e);
179
+ }
180
+ },
181
+ size: "ContentC14TextLink",
182
+ style: {
183
+ marginTop: "".concat(spacingDrawerListOptionHorizontalGap, "px")
184
+ },
185
+ children: bottomLinkText
186
+ })
184
187
  })
185
188
  })]
186
189
  })