tntd 3.0.0-beta → 3.0.0-beta.2

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 (140) hide show
  1. package/es/breadcrumb/style/index.less +2 -1
  2. package/es/cascader/style/index.less +2 -2
  3. package/es/checkbox/checkbox-group.js +5 -0
  4. package/es/checkbox/checkbox-group.js.map +1 -0
  5. package/es/collapse/style/index.less +2 -1
  6. package/es/date-picker/style/Picker.less +2 -1
  7. package/es/drawer/drawer.less +20 -0
  8. package/es/drawer/style/drawer.less +4 -2
  9. package/es/dropdown/style/index.less +2 -1
  10. package/es/grid/RowContext.js +3 -0
  11. package/es/grid/RowContext.js.map +1 -0
  12. package/es/grid/col.js +103 -0
  13. package/es/grid/col.js.map +1 -0
  14. package/es/grid/hooks/useBreakpoint.js +18 -0
  15. package/es/grid/hooks/useBreakpoint.js.map +1 -0
  16. package/es/grid/row.js +154 -0
  17. package/es/grid/row.js.map +1 -0
  18. package/es/grid/style/rtl.less +69 -0
  19. package/es/icon/index.js +2 -3
  20. package/es/icon/index.js.map +1 -1
  21. package/es/icon/style/index.js +2 -1
  22. package/es/icon/style/index.js.map +1 -1
  23. package/es/icon/style/style.less +3 -1
  24. package/es/input/style/mixin.less +1 -1
  25. package/es/modal/modal.less +18 -0
  26. package/es/modal/style/confirm.less +1 -1
  27. package/es/modal/style/modal.less +5 -1
  28. package/es/notification/style/index.less +4 -2
  29. package/es/popconfirm/index.less +10 -4
  30. package/es/popconfirm/popconfirm.js +6 -3
  31. package/es/popconfirm/popconfirm.js.map +1 -1
  32. package/es/popover/index.less +6 -0
  33. package/es/popover/popover.js +4 -3
  34. package/es/popover/popover.js.map +1 -1
  35. package/es/popover/style/index.less +2 -1
  36. package/es/query-form/Field/Composition/Select.js +1 -1
  37. package/es/query-form/Field/Composition/Select.js.map +1 -1
  38. package/es/query-form/Field/Composition/index.js +4 -11
  39. package/es/query-form/Field/Composition/index.js.map +1 -1
  40. package/es/query-form/Field/Composition/index.less +3 -3
  41. package/es/radio/radio-group.js +5 -0
  42. package/es/radio/radio-group.js.map +1 -0
  43. package/es/select/style/index.less +2 -1
  44. package/es/steps/stepStyle/small.less +5 -0
  45. package/es/style/mixins/iconfont.less +3 -2
  46. package/es/style/themes/default.less +4 -3
  47. package/es/table/style/index.less +2 -4
  48. package/es/tag/tag.less +2 -1
  49. package/es/time-picker/style/index.less +2 -1
  50. package/es/timeline/style/index.less +1 -1
  51. package/es/tntd-action/index.less +17 -0
  52. package/es/tooltip/index.less +5 -0
  53. package/es/tooltip/tooltip.js +4 -3
  54. package/es/tooltip/tooltip.js.map +1 -1
  55. package/lib/breadcrumb/style/index.less +2 -1
  56. package/lib/cascader/style/index.less +2 -2
  57. package/lib/checkbox/checkbox-group.d.ts +8 -0
  58. package/lib/checkbox/checkbox-group.d.ts.map +1 -0
  59. package/lib/checkbox/checkbox-group.js +12 -0
  60. package/lib/checkbox/checkbox-group.js.map +1 -0
  61. package/lib/collapse/style/index.less +2 -1
  62. package/lib/date-picker/style/Picker.less +2 -1
  63. package/lib/drawer/drawer.less +20 -0
  64. package/lib/drawer/style/drawer.less +4 -2
  65. package/lib/dropdown/style/index.less +2 -1
  66. package/lib/grid/RowContext.d.ts +9 -0
  67. package/lib/grid/RowContext.d.ts.map +1 -0
  68. package/lib/grid/RowContext.js +9 -0
  69. package/lib/grid/RowContext.js.map +1 -0
  70. package/lib/grid/col.d.ts +29 -0
  71. package/lib/grid/col.d.ts.map +1 -0
  72. package/lib/grid/col.js +100 -0
  73. package/lib/grid/col.js.map +1 -0
  74. package/lib/grid/hooks/useBreakpoint.d.ts +4 -0
  75. package/lib/grid/hooks/useBreakpoint.d.ts.map +1 -0
  76. package/lib/grid/hooks/useBreakpoint.js +28 -0
  77. package/lib/grid/hooks/useBreakpoint.js.map +1 -0
  78. package/lib/grid/row.d.ts +21 -0
  79. package/lib/grid/row.d.ts.map +1 -0
  80. package/lib/grid/row.js +183 -0
  81. package/lib/grid/row.js.map +1 -0
  82. package/lib/grid/style/rtl.less +69 -0
  83. package/lib/icon/index.d.ts +1 -1
  84. package/lib/icon/index.d.ts.map +1 -1
  85. package/lib/icon/index.js +2 -2
  86. package/lib/icon/index.js.map +1 -1
  87. package/lib/icon/style/index.d.ts +1 -0
  88. package/lib/icon/style/index.d.ts.map +1 -1
  89. package/lib/icon/style/index.js +2 -1
  90. package/lib/icon/style/index.js.map +1 -1
  91. package/lib/icon/style/style.less +3 -1
  92. package/lib/input/style/mixin.less +1 -1
  93. package/lib/modal/modal.less +18 -0
  94. package/lib/modal/style/confirm.less +1 -1
  95. package/lib/modal/style/modal.less +5 -1
  96. package/lib/notification/style/index.less +4 -2
  97. package/lib/popconfirm/index.less +10 -4
  98. package/lib/popconfirm/popconfirm.d.ts +3 -1
  99. package/lib/popconfirm/popconfirm.d.ts.map +1 -1
  100. package/lib/popconfirm/popconfirm.js +5 -2
  101. package/lib/popconfirm/popconfirm.js.map +1 -1
  102. package/lib/popover/index.less +6 -0
  103. package/lib/popover/popover.d.ts +1 -0
  104. package/lib/popover/popover.d.ts.map +1 -1
  105. package/lib/popover/popover.js +4 -2
  106. package/lib/popover/popover.js.map +1 -1
  107. package/lib/popover/style/index.less +2 -1
  108. package/lib/query-form/Field/Composition/Select.js +2 -2
  109. package/lib/query-form/Field/Composition/Select.js.map +1 -1
  110. package/lib/query-form/Field/Composition/index.js +4 -11
  111. package/lib/query-form/Field/Composition/index.js.map +1 -1
  112. package/lib/query-form/Field/Composition/index.less +3 -3
  113. package/lib/radio/radio-group.d.ts +8 -0
  114. package/lib/radio/radio-group.d.ts.map +1 -0
  115. package/lib/radio/radio-group.js +12 -0
  116. package/lib/radio/radio-group.js.map +1 -0
  117. package/lib/select/style/index.less +2 -1
  118. package/lib/steps/stepStyle/small.less +5 -0
  119. package/lib/style/mixins/iconfont.less +3 -2
  120. package/lib/style/themes/default.less +4 -3
  121. package/lib/table/style/index.less +2 -4
  122. package/lib/tag/tag.less +2 -1
  123. package/lib/time-picker/style/index.less +2 -1
  124. package/lib/timeline/style/index.less +1 -1
  125. package/lib/tntd-action/index.less +17 -0
  126. package/lib/tooltip/index.less +5 -0
  127. package/lib/tooltip/tooltip.d.ts +1 -0
  128. package/lib/tooltip/tooltip.d.ts.map +1 -1
  129. package/lib/tooltip/tooltip.js +4 -2
  130. package/lib/tooltip/tooltip.js.map +1 -1
  131. package/package.json +1 -2
  132. package/themes/common/css2.x.css +35 -1
  133. package/themes/common/css3.x.css +35 -1
  134. package/themes/default/colors.less +4 -4
  135. package/themes/default/colorsVar.less +3 -3
  136. package/themes/default/lessToCssVar.less +39 -0
  137. package/themes/default/lessVars2.x.less +4 -4
  138. package/themes/default/lessVars3.x.less +4 -4
  139. package/themes/default/variables.less +5 -4
  140. package/themes/default/variablesVar.less +63 -38
@@ -10,7 +10,8 @@
10
10
  font-size: @breadcrumb-font-size;
11
11
 
12
12
  .@{iconfont-css-prefix} {
13
- font-size: @breadcrumb-icon-font-size;
13
+ // font-size: @breadcrumb-icon-font-size;
14
+ font-size: 16px;
14
15
  }
15
16
 
16
17
  a {
@@ -101,9 +101,9 @@
101
101
  z-index: 1;
102
102
  width: 12px;
103
103
  height: 12px;
104
- margin-top: -6px;
104
+ margin-top: -8px;
105
105
  color: @disabled-color;
106
- font-size: 12px;
106
+ font-size: 16px;
107
107
  line-height: 12px;
108
108
  transition: transform 0.2s;
109
109
  &&-expand {
@@ -0,0 +1,5 @@
1
+ import 'react';
2
+ import Checkbox from 'antd/es/checkbox';
3
+ import { connectReadonlyComponent } from '../connect';
4
+ import { PreviewText } from '../preview-text';
5
+ export default connectReadonlyComponent(Checkbox.Group, PreviewText.Select);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-group.js","sourceRoot":"","sources":["../../src/checkbox/checkbox-group.tsx"],"names":[],"mappings":"AAAA,OAAkC,OAAO,CAAA;AACzC,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAM7C,eAAe,wBAAwB,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA","sourcesContent":["import React, { forwardRef } from 'react'\nimport Checkbox from 'antd/es/checkbox'\nimport type { CheckboxGroupProps as AntdCheckboxGroupProps } from 'antd/es/checkbox/Group'\nimport { connectReadonlyComponent } from '../connect'\nimport { PreviewText } from '../preview-text'\n\nexport type CheckboxGroupProps = AntdCheckboxGroupProps & {\n readonly?: boolean\n}\n\nexport default connectReadonlyComponent(Checkbox.Group, PreviewText.Select)\n"]}
@@ -37,7 +37,8 @@
37
37
  top: 50%;
38
38
  left: @padding-md;
39
39
  display: inline-block;
40
- font-size: @font-size-sm;
40
+ // font-size: @font-size-sm;
41
+ font-size: 16px;
41
42
  transform: translateY(-50%);
42
43
 
43
44
  & svg {
@@ -98,8 +98,9 @@
98
98
  &-icon {
99
99
  display: inline-block;
100
100
  color: @disabled-color;
101
- font-size: @font-size-base;
101
+ font-size: calc(@font-size-base + 2px);
102
102
  line-height: 1;
103
+ margin-top: -8px;
103
104
  }
104
105
 
105
106
  .@{ant-prefix}-input-disabled + &-icon {
@@ -0,0 +1,20 @@
1
+ @drawer-prefix-cls: ~'@{ant-prefix}-drawer';
2
+
3
+ .tntd-drawer{
4
+ &.@{drawer-prefix-cls} {
5
+ .@{drawer-prefix-cls}-title {
6
+ font-size: calc(@font-size-lg + 2px);
7
+ }
8
+
9
+ .@{drawer-prefix-cls}-close {
10
+ color: fade(@text-color, 50%);;
11
+ top: -4px;
12
+ }
13
+
14
+ .@{drawer-prefix-cls}-contain-closable{
15
+ .@{drawer-prefix-cls}-header{
16
+ padding: 12px 36px 12px 20px;
17
+ }
18
+ }
19
+ }
20
+ }
@@ -168,7 +168,7 @@
168
168
  padding: 0;
169
169
  color: @text-color-secondary;
170
170
  font-weight: 700;
171
- font-size: @font-size-lg;
171
+ font-size: 20px;
172
172
  font-style: normal;
173
173
  line-height: 56px;
174
174
  text-align: center;
@@ -180,7 +180,9 @@
180
180
  cursor: pointer;
181
181
  transition: color @animation-duration-slow;
182
182
  text-rendering: auto;
183
-
183
+ .tntd-anticon {
184
+ font-size: 20px;
185
+ }
184
186
  &:focus,
185
187
  &:hover {
186
188
  color: @icon-color-hover;
@@ -102,7 +102,8 @@
102
102
  > span > .anticon:first-child {
103
103
  min-width: 12px;
104
104
  margin-right: 8px;
105
- font-size: @font-size-sm;
105
+ // font-size: @font-size-sm;
106
+ font-size: 16px;
106
107
  }
107
108
 
108
109
  > a {
@@ -0,0 +1,3 @@
1
+ import { createContext } from 'react';
2
+ const RowContext = createContext({});
3
+ export default RowContext;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RowContext.js","sourceRoot":"","sources":["../../src/grid/RowContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAQrC,MAAM,UAAU,GAA6B,aAAa,CAAC,EAAE,CAAC,CAAA;AAE9D,eAAe,UAAU,CAAA","sourcesContent":["import type { Context } from 'react'\nimport { createContext } from 'react'\n\nexport interface RowContextState {\n gutter?: [number, number]\n wrap?: boolean\n supportFlexGap?: boolean\n}\n\nconst RowContext: Context<RowContextState> = createContext({})\n\nexport default RowContext\n"]}
package/es/grid/col.js ADDED
@@ -0,0 +1,103 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
+ }
7
+ return t;
8
+ };
9
+ import classNames from 'classnames';
10
+ import * as React from 'react';
11
+ import { ConfigContext } from '../_util/context';
12
+ import RowContext from './RowContext';
13
+ function parseFlex(flex) {
14
+ if (typeof flex === 'number') {
15
+ return `${flex} ${flex} auto`;
16
+ }
17
+ if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
18
+ return `0 0 ${flex}`;
19
+ }
20
+ return flex;
21
+ }
22
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
23
+ const Col = React.forwardRef((props, ref) => {
24
+ const {
25
+ getPrefixCls,
26
+ direction
27
+ } = React.useContext(ConfigContext);
28
+ const {
29
+ gutter,
30
+ wrap,
31
+ supportFlexGap
32
+ } = React.useContext(RowContext);
33
+ const {
34
+ prefixCls: customizePrefixCls = 'tnt-col',
35
+ span,
36
+ order,
37
+ offset,
38
+ push,
39
+ pull,
40
+ className,
41
+ children,
42
+ flex,
43
+ style
44
+ } = props,
45
+ others = __rest(props, ["prefixCls", "span", "order", "offset", "push", "pull", "className", "children", "flex", "style"]);
46
+ const prefixCls = getPrefixCls('col', customizePrefixCls);
47
+ let sizeClassObj = {};
48
+ sizes.forEach(size => {
49
+ let sizeProps = {};
50
+ const propSize = props[size];
51
+ if (typeof propSize === 'number') {
52
+ sizeProps.span = propSize;
53
+ } else if (typeof propSize === 'object') {
54
+ sizeProps = propSize || {};
55
+ }
56
+ delete others[size];
57
+ sizeClassObj = Object.assign(Object.assign({}, sizeClassObj), {
58
+ [`${prefixCls}-${size}-${sizeProps.span}`]: sizeProps.span !== undefined,
59
+ [`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,
60
+ [`${prefixCls}-${size}-offset-${sizeProps.offset}`]: sizeProps.offset || sizeProps.offset === 0,
61
+ [`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,
62
+ [`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,
63
+ [`${prefixCls}-rtl`]: direction === 'rtl'
64
+ });
65
+ });
66
+ const classes = classNames(prefixCls, {
67
+ [`${prefixCls}-${span}`]: span !== undefined,
68
+ [`${prefixCls}-order-${order}`]: order,
69
+ [`${prefixCls}-offset-${offset}`]: offset,
70
+ [`${prefixCls}-push-${push}`]: push,
71
+ [`${prefixCls}-pull-${pull}`]: pull
72
+ }, className, sizeClassObj);
73
+ const mergedStyle = {};
74
+ // Horizontal gutter use padding
75
+ if (gutter && gutter[0] > 0) {
76
+ const horizontalGutter = gutter[0] / 2;
77
+ mergedStyle.paddingLeft = horizontalGutter;
78
+ mergedStyle.paddingRight = horizontalGutter;
79
+ }
80
+ // Vertical gutter use padding when gap not support
81
+ if (gutter && gutter[1] > 0 && !supportFlexGap) {
82
+ const verticalGutter = gutter[1] / 2;
83
+ mergedStyle.paddingTop = verticalGutter;
84
+ mergedStyle.paddingBottom = verticalGutter;
85
+ }
86
+ if (flex) {
87
+ mergedStyle.flex = parseFlex(flex);
88
+ // Hack for Firefox to avoid size issue
89
+ // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
90
+ if (wrap === false && !mergedStyle.minWidth) {
91
+ mergedStyle.minWidth = 0;
92
+ }
93
+ }
94
+ return React.createElement("div", Object.assign({}, others, {
95
+ style: Object.assign(Object.assign({}, mergedStyle), style),
96
+ className: classes,
97
+ ref: ref
98
+ }), children);
99
+ });
100
+ if (process.env.NODE_ENV !== 'production') {
101
+ Col.displayName = 'Col';
102
+ }
103
+ export default Col;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"col.js","sourceRoot":"","sources":["../../src/grid/col.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,UAAU,MAAM,cAAc,CAAA;AAgCrC,SAAS,SAAS,CAAC,IAAc;IAC/B,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,GAAG,IAAI,IAA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AAI,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;QAC3B,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACtC,WAAW,CAAC,WAAW,GAAG,gBAAgB,CAAA;QAC1C,WAAW,CAAC,YAAY,GAAG,gBAAgB,CAAA;KAC5C;IAED,mDAAmD;IACnD,IAAI,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE;QAC9C,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACpC,WAAW,CAAC,UAAU,GAAG,cAAc,CAAA;QACvC,WAAW,CAAC,aAAa,GAAG,cAAc,CAAA;KAC3C;IAED,IAAI,IAAI,EAAE;QACR,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;QAElC,uCAAuC;QACvC,6EAA6E;QAC7E,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC3C,WAAW,CAAC,QAAQ,GAAG,CAAC,CAAA;SACzB;KACF;IAED,OAAO,CACL,6CAAS,MAAM,IAAE,KAAK,kCAAO,WAAW,GAAK,KAAK,GAAI,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAC/E,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAA;CACxB;AAED,eAAe,GAAG,CAAA","sourcesContent":["import classNames from 'classnames'\nimport * as React from 'react'\nimport { ConfigContext } from '../_util/context'\nimport RowContext from './RowContext'\n\n// https://github.com/ant-design/ant-design/issues/14324\ntype ColSpanType = number | string\n\ntype FlexType = number | 'none' | 'auto' | string\n\nexport interface ColSize {\n flex?: FlexType\n span?: ColSpanType\n order?: ColSpanType\n offset?: ColSpanType\n push?: ColSpanType\n pull?: ColSpanType\n}\n\nexport interface ColProps extends React.HTMLAttributes<HTMLDivElement> {\n flex?: FlexType\n span?: ColSpanType\n order?: ColSpanType\n offset?: ColSpanType\n push?: ColSpanType\n pull?: ColSpanType\n xs?: ColSpanType | ColSize\n sm?: ColSpanType | ColSize\n md?: ColSpanType | ColSize\n lg?: ColSpanType | ColSize\n xl?: ColSpanType | ColSize\n xxl?: ColSpanType | ColSize\n prefixCls?: string\n}\n\nfunction parseFlex(flex: FlexType): string {\n if (typeof flex === 'number') {\n return `${flex} ${flex} auto`\n }\n\n if (/^\\d+(\\.\\d+)?(px|em|rem|%)$/.test(flex)) {\n return `0 0 ${flex}`\n }\n\n return flex\n}\nconst sizes = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const\nconst Col = React.forwardRef<HTMLDivElement, ColProps>((props, ref) => {\n const { getPrefixCls, direction } = React.useContext(ConfigContext)\n const { gutter, wrap, supportFlexGap } = React.useContext(RowContext)\n\n const {\n prefixCls: customizePrefixCls = 'tnt-col',\n span,\n order,\n offset,\n push,\n pull,\n className,\n children,\n flex,\n style,\n ...others\n } = props\n\n const prefixCls = getPrefixCls('col', customizePrefixCls)\n\n let sizeClassObj = {}\n sizes.forEach((size) => {\n let sizeProps: ColSize = {}\n const propSize = props[size]\n if (typeof propSize === 'number') {\n sizeProps.span = propSize\n } else if (typeof propSize === 'object') {\n sizeProps = propSize || {}\n }\n\n delete others[size]\n\n sizeClassObj = {\n ...sizeClassObj,\n [`${prefixCls}-${size}-${sizeProps.span}`]: sizeProps.span !== undefined,\n [`${prefixCls}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,\n [`${prefixCls}-${size}-offset-${sizeProps.offset}`]:\n sizeProps.offset || sizeProps.offset === 0,\n [`${prefixCls}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,\n [`${prefixCls}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n }\n })\n\n const classes = classNames(\n prefixCls,\n {\n [`${prefixCls}-${span}`]: span !== undefined,\n [`${prefixCls}-order-${order}`]: order,\n [`${prefixCls}-offset-${offset}`]: offset,\n [`${prefixCls}-push-${push}`]: push,\n [`${prefixCls}-pull-${pull}`]: pull,\n },\n className,\n sizeClassObj\n )\n\n const mergedStyle: React.CSSProperties = {}\n // Horizontal gutter use padding\n if (gutter && gutter[0] > 0) {\n const horizontalGutter = gutter[0] / 2\n mergedStyle.paddingLeft = horizontalGutter\n mergedStyle.paddingRight = horizontalGutter\n }\n\n // Vertical gutter use padding when gap not support\n if (gutter && gutter[1] > 0 && !supportFlexGap) {\n const verticalGutter = gutter[1] / 2\n mergedStyle.paddingTop = verticalGutter\n mergedStyle.paddingBottom = verticalGutter\n }\n\n if (flex) {\n mergedStyle.flex = parseFlex(flex)\n\n // Hack for Firefox to avoid size issue\n // https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553\n if (wrap === false && !mergedStyle.minWidth) {\n mergedStyle.minWidth = 0\n }\n }\n\n return (\n <div {...others} style={{ ...mergedStyle, ...style }} className={classes} ref={ref}>\n {children}\n </div>\n )\n})\n\nif (process.env.NODE_ENV !== 'production') {\n Col.displayName = 'Col'\n}\n\nexport default Col\n"]}
@@ -0,0 +1,18 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import useForceUpdate from '../../_util/hooks/useForceUpdate';
3
+ import ResponsiveObserve from '../../_util/responsiveObserve';
4
+ function useBreakpoint(refreshOnChange = true) {
5
+ const screensRef = useRef({});
6
+ const forceUpdate = useForceUpdate();
7
+ useEffect(() => {
8
+ const token = ResponsiveObserve.subscribe(supportScreens => {
9
+ screensRef.current = supportScreens;
10
+ if (refreshOnChange) {
11
+ forceUpdate();
12
+ }
13
+ });
14
+ return () => ResponsiveObserve.unsubscribe(token);
15
+ }, []);
16
+ return screensRef.current;
17
+ }
18
+ export default useBreakpoint;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../../src/grid/hooks/useBreakpoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,cAAc,MAAM,kCAAkC,CAAA;AAE7D,OAAO,iBAAiB,MAAM,+BAA+B,CAAA;AAE7D,SAAS,aAAa,CAAC,kBAA2B,IAAI;IACpD,MAAM,UAAU,GAAG,MAAM,CAAY,EAAE,CAAC,CAAA;IACxC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,EAAE;YAC3D,UAAU,CAAC,OAAO,GAAG,cAAc,CAAA;YACnC,IAAI,eAAe,EAAE;gBACnB,WAAW,EAAE,CAAA;aACd;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IACnD,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,UAAU,CAAC,OAAO,CAAA;AAC3B,CAAC;AAED,eAAe,aAAa,CAAA","sourcesContent":["import { useEffect, useRef } from 'react'\nimport useForceUpdate from '../../_util/hooks/useForceUpdate'\nimport type { ScreenMap } from '../../_util/responsiveObserve'\nimport ResponsiveObserve from '../../_util/responsiveObserve'\n\nfunction useBreakpoint(refreshOnChange: boolean = true): ScreenMap {\n const screensRef = useRef<ScreenMap>({})\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n const token = ResponsiveObserve.subscribe((supportScreens) => {\n screensRef.current = supportScreens\n if (refreshOnChange) {\n forceUpdate()\n }\n })\n\n return () => ResponsiveObserve.unsubscribe(token)\n }, [])\n\n return screensRef.current\n}\n\nexport default useBreakpoint\n"]}
package/es/grid/row.js ADDED
@@ -0,0 +1,154 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
+ }
7
+ return t;
8
+ };
9
+ import classNames from 'classnames';
10
+ import * as React from 'react';
11
+ import { ConfigContext } from '../_util/context';
12
+ import useFlexGapSupport from '../_util/hooks/useFlexGapSupport';
13
+ import ResponsiveObserve, { responsiveArray } from '../_util/responsiveObserve';
14
+ import { tuple } from '../_util/type';
15
+ import RowContext from './RowContext';
16
+ const RowAligns = tuple('top', 'middle', 'bottom', 'stretch');
17
+ const RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between', 'space-evenly');
18
+ function useMergePropByScreen(oriProp, screen) {
19
+ const [prop, setProp] = React.useState(typeof oriProp === 'string' ? oriProp : '');
20
+ const clacMergeAlignOrJustify = () => {
21
+ if (typeof oriProp === 'string') {
22
+ setProp(oriProp);
23
+ }
24
+ if (typeof oriProp !== 'object') {
25
+ return;
26
+ }
27
+ for (let i = 0; i < responsiveArray.length; i++) {
28
+ const breakpoint = responsiveArray[i];
29
+ // if do not match, do nothing
30
+ if (!screen[breakpoint]) continue;
31
+ const curVal = oriProp[breakpoint];
32
+ if (curVal !== undefined) {
33
+ setProp(curVal);
34
+ return;
35
+ }
36
+ }
37
+ };
38
+ React.useEffect(() => {
39
+ clacMergeAlignOrJustify();
40
+ }, [JSON.stringify(oriProp), screen]);
41
+ return prop;
42
+ }
43
+ const Row = React.forwardRef((props, ref) => {
44
+ const {
45
+ prefixCls: customizePrefixCls = 'tnt-row',
46
+ justify,
47
+ align,
48
+ className,
49
+ style,
50
+ children,
51
+ gutter = 0,
52
+ wrap
53
+ } = props,
54
+ others = __rest(props, ["prefixCls", "justify", "align", "className", "style", "children", "gutter", "wrap"]);
55
+ const {
56
+ getPrefixCls,
57
+ direction
58
+ } = React.useContext(ConfigContext);
59
+ const [screens, setScreens] = React.useState({
60
+ xs: true,
61
+ sm: true,
62
+ md: true,
63
+ lg: true,
64
+ xl: true,
65
+ xxl: true
66
+ });
67
+ // to save screens info when responsiveObserve callback had been call
68
+ const [curScreens, setCurScreens] = React.useState({
69
+ xs: false,
70
+ sm: false,
71
+ md: false,
72
+ lg: false,
73
+ xl: false,
74
+ xxl: false
75
+ });
76
+ // ================================== calc reponsive data ==================================
77
+ const mergeAlign = useMergePropByScreen(align, curScreens);
78
+ const mergeJustify = useMergePropByScreen(justify, curScreens);
79
+ const supportFlexGap = useFlexGapSupport();
80
+ const gutterRef = React.useRef(gutter);
81
+ // ================================== Effect ==================================
82
+ React.useEffect(() => {
83
+ const token = ResponsiveObserve.subscribe(screen => {
84
+ setCurScreens(screen);
85
+ const currentGutter = gutterRef.current || 0;
86
+ if (!Array.isArray(currentGutter) && typeof currentGutter === 'object' || Array.isArray(currentGutter) && (typeof currentGutter[0] === 'object' || typeof currentGutter[1] === 'object')) {
87
+ setScreens(screen);
88
+ }
89
+ });
90
+ return () => ResponsiveObserve.unsubscribe(token);
91
+ }, []);
92
+ // ================================== Render ==================================
93
+ const getGutter = () => {
94
+ const results = [undefined, undefined];
95
+ const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined];
96
+ normalizedGutter.forEach((g, index) => {
97
+ if (typeof g === 'object') {
98
+ for (let i = 0; i < responsiveArray.length; i++) {
99
+ const breakpoint = responsiveArray[i];
100
+ if (screens[breakpoint] && g[breakpoint] !== undefined) {
101
+ results[index] = g[breakpoint];
102
+ break;
103
+ }
104
+ }
105
+ } else {
106
+ results[index] = g;
107
+ }
108
+ });
109
+ return results;
110
+ };
111
+ const prefixCls = getPrefixCls('row', customizePrefixCls);
112
+ const gutters = getGutter();
113
+ const classes = classNames(prefixCls, {
114
+ [`${prefixCls}-no-wrap`]: wrap === false,
115
+ [`${prefixCls}-${mergeJustify}`]: mergeJustify,
116
+ [`${prefixCls}-${mergeAlign}`]: mergeAlign,
117
+ [`${prefixCls}-rtl`]: direction === 'rtl'
118
+ }, className);
119
+ // Add gutter related style
120
+ const rowStyle = {};
121
+ const horizontalGutter = gutters[0] != null && gutters[0] > 0 ? gutters[0] / -2 : undefined;
122
+ const verticalGutter = gutters[1] != null && gutters[1] > 0 ? gutters[1] / -2 : undefined;
123
+ if (horizontalGutter) {
124
+ rowStyle.marginLeft = horizontalGutter;
125
+ rowStyle.marginRight = horizontalGutter;
126
+ }
127
+ if (supportFlexGap) {
128
+ // Set gap direct if flex gap support
129
+ ;
130
+ [, rowStyle.rowGap] = gutters;
131
+ } else if (verticalGutter) {
132
+ rowStyle.marginTop = verticalGutter;
133
+ rowStyle.marginBottom = verticalGutter;
134
+ }
135
+ // "gutters" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.
136
+ // So we deconstruct "gutters" variable here.
137
+ const [gutterH, gutterV] = gutters;
138
+ const rowContext = React.useMemo(() => ({
139
+ gutter: [gutterH, gutterV],
140
+ wrap,
141
+ supportFlexGap
142
+ }), [gutterH, gutterV, wrap, supportFlexGap]);
143
+ return React.createElement(RowContext.Provider, {
144
+ value: rowContext
145
+ }, React.createElement("div", Object.assign({}, others, {
146
+ className: classes,
147
+ style: Object.assign(Object.assign({}, rowStyle), style),
148
+ ref: ref
149
+ }), children));
150
+ });
151
+ if (process.env.NODE_ENV !== 'production') {
152
+ Row.displayName = 'Row';
153
+ }
154
+ export default Row;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row.js","sourceRoot":"","sources":["../../src/grid/row.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,iBAAiB,MAAM,kCAAkC,CAAA;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AAG,gBAAgB,CAAA;KACxC;IAED,IAAI,cAAc,EAAE;QAClB,qCAAqC;QACrC,CAAC;QAAA,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAA;KAC/B;SAAM,IAAI,cAAc,EAAE;QACzB,QAAQ,CAAC,SAAS,GAAG,cAAc,CAAA;QACnC,QAAQ,CAAC,YAAY,GAAG,cAAc,CAAA;KACvC;IAED,2FAA2F;IAC3F,6CAA6C;IAC7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,OAAO,CAAA;IAClC,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,CAAqB,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,EAChF,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,CACzC,CAAA;IAED,OAAO,CACL,oBAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU;QACpC,6CAAS,MAAM,IAAE,SAAS,EAAE,OAAO,EAAE,KAAK,kCAAO,QAAQ,GAAK,KAAK,GAAI,GAAG,EAAE,GAAG,KAC5E,QAAQ,CACL,CACc,CACvB,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,GAAG,CAAC,WAAW,GAAG,KAAK,CAAA;CACxB;AAED,eAAe,GAAG,CAAA","sourcesContent":["import classNames from 'classnames'\nimport * as React from 'react'\nimport { ConfigContext } from '../_util/context'\nimport useFlexGapSupport from '../_util/hooks/useFlexGapSupport'\nimport type { Breakpoint, ScreenMap } from '../_util/responsiveObserve'\nimport ResponsiveObserve, { responsiveArray } from '../_util/responsiveObserve'\nimport { tuple } from '../_util/type'\nimport RowContext from './RowContext'\n\nconst RowAligns = tuple('top', 'middle', 'bottom', 'stretch')\nconst RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between', 'space-evenly')\n\ntype Responsive = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'\ntype ResponsiveLike<T> = {\n [key in Responsive]?: T\n}\n\ntype Gap = number | undefined\nexport type Gutter = number | undefined | Partial<Record<Breakpoint, number>>\n\ntype ResponsiveAligns = ResponsiveLike<typeof RowAligns[number]>\ntype ResponsiveJustify = ResponsiveLike<typeof RowJustify[number]>\nexport interface RowProps extends React.HTMLAttributes<HTMLDivElement> {\n gutter?: Gutter | [Gutter, Gutter]\n align?: typeof RowAligns[number] | ResponsiveAligns\n justify?: typeof RowJustify[number] | ResponsiveJustify\n prefixCls?: string\n wrap?: boolean\n}\n\nfunction useMergePropByScreen(oriProp: RowProps['align'] | RowProps['justify'], screen: ScreenMap) {\n const [prop, setProp] = React.useState(typeof oriProp === 'string' ? oriProp : '')\n\n const clacMergeAlignOrJustify = () => {\n if (typeof oriProp === 'string') {\n setProp(oriProp)\n }\n if (typeof oriProp !== 'object') {\n return\n }\n for (let i = 0; i < responsiveArray.length; i++) {\n const breakpoint: Breakpoint = responsiveArray[i]\n // if do not match, do nothing\n if (!screen[breakpoint]) continue\n const curVal = oriProp[breakpoint]\n if (curVal !== undefined) {\n setProp(curVal)\n return\n }\n }\n }\n\n React.useEffect(() => {\n clacMergeAlignOrJustify()\n }, [JSON.stringify(oriProp), screen])\n\n return prop\n}\n\nconst Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {\n const {\n prefixCls: customizePrefixCls = 'tnt-row',\n justify,\n align,\n className,\n style,\n children,\n gutter = 0,\n wrap,\n ...others\n } = props\n\n const { getPrefixCls, direction } = React.useContext(ConfigContext)\n\n const [screens, setScreens] = React.useState<ScreenMap>({\n xs: true,\n sm: true,\n md: true,\n lg: true,\n xl: true,\n xxl: true,\n })\n // to save screens info when responsiveObserve callback had been call\n const [curScreens, setCurScreens] = React.useState<ScreenMap>({\n xs: false,\n sm: false,\n md: false,\n lg: false,\n xl: false,\n xxl: false,\n })\n\n // ================================== calc reponsive data ==================================\n const mergeAlign = useMergePropByScreen(align, curScreens)\n\n const mergeJustify = useMergePropByScreen(justify, curScreens)\n\n const supportFlexGap = useFlexGapSupport()\n\n const gutterRef = React.useRef<Gutter | [Gutter, Gutter]>(gutter)\n\n // ================================== Effect ==================================\n React.useEffect(() => {\n const token = ResponsiveObserve.subscribe((screen) => {\n setCurScreens(screen)\n const currentGutter = gutterRef.current || 0\n if (\n (!Array.isArray(currentGutter) && typeof currentGutter === 'object') ||\n (Array.isArray(currentGutter) &&\n (typeof currentGutter[0] === 'object' || typeof currentGutter[1] === 'object'))\n ) {\n setScreens(screen)\n }\n })\n return () => ResponsiveObserve.unsubscribe(token)\n }, [])\n\n // ================================== Render ==================================\n const getGutter = (): [Gap, Gap] => {\n const results: [Gap, Gap] = [undefined, undefined]\n const normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, undefined]\n normalizedGutter.forEach((g, index) => {\n if (typeof g === 'object') {\n for (let i = 0; i < responsiveArray.length; i++) {\n const breakpoint: Breakpoint = responsiveArray[i]\n if (screens[breakpoint] && g[breakpoint] !== undefined) {\n results[index] = g[breakpoint] as number\n break\n }\n }\n } else {\n results[index] = g\n }\n })\n return results\n }\n\n const prefixCls = getPrefixCls('row', customizePrefixCls)\n const gutters = getGutter()\n const classes = classNames(\n prefixCls,\n {\n [`${prefixCls}-no-wrap`]: wrap === false,\n [`${prefixCls}-${mergeJustify}`]: mergeJustify,\n [`${prefixCls}-${mergeAlign}`]: mergeAlign,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n },\n className\n )\n\n // Add gutter related style\n const rowStyle: React.CSSProperties = {}\n const horizontalGutter = gutters[0] != null && gutters[0] > 0 ? gutters[0] / -2 : undefined\n const verticalGutter = gutters[1] != null && gutters[1] > 0 ? gutters[1] / -2 : undefined\n\n if (horizontalGutter) {\n rowStyle.marginLeft = horizontalGutter\n rowStyle.marginRight = horizontalGutter\n }\n\n if (supportFlexGap) {\n // Set gap direct if flex gap support\n ;[, rowStyle.rowGap] = gutters\n } else if (verticalGutter) {\n rowStyle.marginTop = verticalGutter\n rowStyle.marginBottom = verticalGutter\n }\n\n // \"gutters\" is a new array in each rendering phase, it'll make 'React.useMemo' effectless.\n // So we deconstruct \"gutters\" variable here.\n const [gutterH, gutterV] = gutters\n const rowContext = React.useMemo(\n () => ({ gutter: [gutterH, gutterV] as [number, number], wrap, supportFlexGap }),\n [gutterH, gutterV, wrap, supportFlexGap]\n )\n\n return (\n <RowContext.Provider value={rowContext}>\n <div {...others} className={classes} style={{ ...rowStyle, ...style }} ref={ref}>\n {children}\n </div>\n </RowContext.Provider>\n )\n})\n\nif (process.env.NODE_ENV !== 'production') {\n Row.displayName = 'Row'\n}\n\nexport default Row\n"]}
@@ -0,0 +1,69 @@
1
+ // @import '../../style/themes/index';
2
+ // @import '../../style/mixins/index';
3
+ @import './mixin';
4
+
5
+ .@{row-prefix-cls} {
6
+ &-rtl {
7
+ direction: rtl;
8
+ }
9
+ }
10
+
11
+ // mixin
12
+ .loop-grid-columns(@index, @class) when (@index > 0) {
13
+ .@{col-prefix-cls}@{class}-push-@{index} {
14
+ // reset property in RTL direction
15
+ &.@{col-prefix-cls}-rtl {
16
+ right: percentage((@index / @grid-columns));
17
+ left: auto;
18
+ }
19
+ }
20
+
21
+ .@{col-prefix-cls}@{class}-pull-@{index} {
22
+ // reset property in RTL direction
23
+ &.@{col-prefix-cls}-rtl {
24
+ right: auto;
25
+ left: percentage((@index / @grid-columns));
26
+ }
27
+ }
28
+
29
+ .@{col-prefix-cls}@{class}-offset-@{index} {
30
+ // reset property in RTL direction
31
+ &.@{col-prefix-cls}-rtl {
32
+ margin-right: percentage((@index / @grid-columns));
33
+ margin-left: 0;
34
+ }
35
+ }
36
+ }
37
+
38
+ .loop-grid-columns(@index, @class) when (@index = 0) {
39
+ .@{col-prefix-cls}-push-@{index} {
40
+ // reset property in RTL direction
41
+ &.@{col-prefix-cls}-rtl {
42
+ right: auto;
43
+ }
44
+ }
45
+
46
+ .@{col-prefix-cls}-pull-@{index} {
47
+ &.@{col-prefix-cls}-rtl {
48
+ left: auto;
49
+ }
50
+ }
51
+
52
+ .@{col-prefix-cls}@{class}-push-@{index} {
53
+ &.@{col-prefix-cls}-rtl {
54
+ right: auto;
55
+ }
56
+ }
57
+
58
+ .@{col-prefix-cls}@{class}-pull-@{index} {
59
+ &.@{col-prefix-cls}-rtl {
60
+ left: auto;
61
+ }
62
+ }
63
+
64
+ .@{col-prefix-cls}@{class}-offset-@{index} {
65
+ &.@{col-prefix-cls}-rtl {
66
+ margin-right: 0;
67
+ }
68
+ }
69
+ }
package/es/icon/index.js CHANGED
@@ -16,7 +16,7 @@ import { svgBaseProps, withThemeSuffix, removeTypeTheme, getThemeFromTypeName, a
16
16
  import warning from '../_util/warning';
17
17
  import LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver';
18
18
  import { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor';
19
- import './style/style.less';
19
+ import './style';
20
20
  // Initial setting
21
21
  ReactIcon.add(...Object.keys(allIcons).map(key => allIcons[key]));
22
22
  setTwoToneColor('#1890ff');
@@ -51,8 +51,7 @@ const Icon = props => {
51
51
  } = props,
52
52
  restProps = __rest(props, ["className", "type", "component", "viewBox", "spin", "rotate", "tabIndex", "onClick", "children", "theme", "twoToneColor"]);
53
53
  warning(Boolean(type || Component || children), 'Icon', 'Should have `type` prop or `component` prop or `children`.');
54
- const classString = classNames({
55
- [`tntd-anticon`]: true,
54
+ const classString = classNames('tntd-anticon', {
56
55
  [`anticon`]: true,
57
56
  [`anticon-${type}`]: Boolean(type)
58
57
  }, className);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/icon/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,8BAA8B;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,QAAQ,M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AAChD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AACtC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AAEtC,eAAe,IAAI,CAAA","sourcesContent":["/* eslint-disable camelcase */\nimport * as React from 'react'\nimport classNames from 'classnames'\nimport * as allIcons from '@tntd/icons/lib/dist'\nimport ReactIcon from './components'\nimport createFromIconfontCN from './IconFont'\nimport {\n svgBaseProps,\n withThemeSuffix,\n removeTypeTheme,\n getThemeFromTypeName,\n alias,\n} from './utils'\nimport warning from '../_util/warning'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor'\nimport './style/style.less'\n// Initial setting\nReactIcon.add(...Object.keys(allIcons).map((key) => (allIcons as any)[key]))\nsetTwoToneColor('#1890ff')\nlet defaultTheme: ThemeType = 'outlined'\nlet dangerousTheme: ThemeType | undefined\n\nfunction unstable_ChangeThemeOfIconsDangerously(theme?: ThemeType) {\n warning(\n false,\n 'Icon',\n `You are using the unstable method 'Icon.unstable_ChangeThemeOfAllIconsDangerously', ` +\n `make sure that all the icons with theme '${theme}' display correctly.`\n )\n dangerousTheme = theme\n}\n\nfunction unstable_ChangeDefaultThemeOfIcons(theme: ThemeType) {\n warning(\n false,\n 'Icon',\n `You are using the unstable method 'Icon.unstable_ChangeDefaultThemeOfIcons', ` +\n `make sure that all the icons with theme '${theme}' display correctly.`\n )\n defaultTheme = theme\n}\n\nexport interface TransferLocale {\n icon: string\n}\n\nexport interface CustomIconComponentProps {\n width: string | number\n height: string | number\n fill: string\n viewBox?: string\n className?: string\n style?: React.CSSProperties\n spin?: boolean\n rotate?: number\n ['aria-hidden']?: React.AriaAttributes['aria-hidden']\n}\n\nexport type ThemeType = 'filled' | 'outlined' | 'twoTone'\n\nexport interface IconProps {\n tabIndex?: number\n type?: string\n className?: string\n theme?: ThemeType\n title?: string\n onKeyUp?: React.KeyboardEventHandler<HTMLElement>\n onClick?: React.MouseEventHandler<HTMLElement>\n component?: React.ComponentType<CustomIconComponentProps | React.SVGProps<SVGSVGElement>>\n twoToneColor?: string\n viewBox?: string\n spin?: boolean\n rotate?: number\n style?: React.CSSProperties\n prefixCls?: string\n role?: string\n}\n\nexport interface IconComponent<P> extends React.SFC<P> {\n createFromIconfontCN: typeof createFromIconfontCN\n getTwoToneColor: typeof getTwoToneColor\n setTwoToneColor: typeof setTwoToneColor\n unstable_ChangeThemeOfIconsDangerously?: typeof unstable_ChangeThemeOfIconsDangerously\n unstable_ChangeDefaultThemeOfIcons?: typeof unstable_ChangeDefaultThemeOfIcons\n}\n\nconst Icon: IconComponent<IconProps> = (props) => {\n const {\n // affect outter <i>...</i>\n className,\n\n // affect inner <svg>...</svg>\n type,\n component: Component,\n viewBox,\n spin,\n rotate,\n\n tabIndex,\n onClick,\n\n // children\n children,\n\n // other\n theme, // default to outlined\n twoToneColor,\n\n ...restProps\n } = props\n\n warning(\n Boolean(type || Component || children),\n 'Icon',\n 'Should have `type` prop or `component` prop or `children`.'\n )\n\n const classString = classNames(\n {\n [`tntd-anticon`]: true,\n [`anticon`]: true,\n [`anticon-${type}`]: Boolean(type),\n },\n className\n )\n\n const svgClassString = classNames({\n [`anticon-spin`]: !!spin || type === 'loading',\n })\n\n const svgStyle = rotate\n ? {\n msTransform: `rotate(${rotate}deg)`,\n transform: `rotate(${rotate}deg)`,\n }\n : undefined\n\n const innerSvgProps: CustomIconComponentProps = {\n ...svgBaseProps,\n className: svgClassString,\n style: svgStyle,\n viewBox,\n }\n\n if (!viewBox) {\n delete innerSvgProps.viewBox\n }\n\n const renderInnerNode = () => {\n // component > children > type\n if (Component) {\n return <Component {...innerSvgProps}>{children}</Component>\n }\n\n if (children) {\n warning(\n Boolean(viewBox) ||\n (React.Children.count(children) === 1 &&\n React.isValidElement(children) &&\n React.Children.only(children).type === 'use'),\n 'Icon',\n 'Make sure that you provide correct `viewBox`' +\n ' prop (default `0 0 1024 1024`) to the icon.'\n )\n return (\n <svg {...innerSvgProps} viewBox={viewBox}>\n {children}\n </svg>\n )\n }\n\n if (typeof type === 'string') {\n let computedType = type\n if (theme) {\n const themeInName = getThemeFromTypeName(type)\n warning(\n !themeInName || theme === themeInName,\n 'Icon',\n `The icon name '${type}' already specify a theme '${themeInName}',` +\n ` the 'theme' prop '${theme}' will be ignored.`\n )\n }\n computedType = withThemeSuffix(\n removeTypeTheme(alias(computedType)),\n dangerousTheme || theme || defaultTheme\n )\n\n return (\n <ReactIcon\n className={svgClassString}\n type={computedType}\n primaryColor={twoToneColor}\n style={svgStyle}\n />\n )\n }\n }\n\n let iconTabIndex = tabIndex\n if (iconTabIndex === undefined && onClick) {\n iconTabIndex = -1\n }\n\n return (\n <LocaleReceiver componentName=\"Icon\">\n {(locale) => (\n <i\n aria-label={type && `${(locale as Record<'icon', object>).icon}: ${type}`}\n {...restProps}\n tabIndex={iconTabIndex}\n onClick={onClick}\n className={classString}\n >\n {renderInnerNode()}\n </i>\n )}\n </LocaleReceiver>\n )\n}\n\nIcon.createFromIconfontCN = createFromIconfontCN\nIcon.getTwoToneColor = getTwoToneColor\nIcon.setTwoToneColor = setTwoToneColor\n\nexport default Icon\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/icon/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,8BAA8B;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAA;AAChD,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,oBAAoB,MAAM,YAAY,CAAA;AAC7C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,KAAK,GACN,MAAM,SAAS,CAAA;AAChB,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,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L,CAAC,WAAW,IAAI,KAAK,KAAK,WAAW,EACrC,MAAM,EACN,kBAAkB,IAAI,8BAA8B,WAAW,IAAI;oBACjE,sBAAsB,KAAK,oBAAoB,CAClD,CAAA;aACF;YACD,YAAY,GAAG,eAAe,CAC5B,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,EACpC,cAAc,IAAI,KAAK,IAAI,YAAY,CACxC,CAAA;YAED,OAAO,CACL,oBAAC,SAAS,IACR,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,QAAQ,GACf,CACH,CAAA;SACF;IACH,CAAC,CAAA;IAED,IAAI,YAAY,GAAG,QAAQ,CAAA;IAC3B,IAAI,YAAY,KAAK,SAAS,IAAI,OAAO,EAAE;QACzC,YAAY,GAAG,CAAC,CAAC,CAAA;KAClB;IAED,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,MAAM,IACjC,CAAC,MAAM,EAAE,EAAE,CAAC,CACX,uDACc,IAAI,IAAI,GAAI,MAAiC,CAAC,IAAI,KAAK,IAAI,EAAE,IACrE,SAAS,IACb,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,KAErB,eAAe,EAAE,CAChB,CACL,CACc,CAClB,CAAA;AACH,CAAC,CAAA;AAED,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;AAChD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AACtC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;AAEtC,eAAe,IAAI,CAAA","sourcesContent":["/* eslint-disable camelcase */\nimport * as React from 'react'\nimport classNames from 'classnames'\nimport * as allIcons from '@tntd/icons/lib/dist'\nimport ReactIcon from './components'\nimport createFromIconfontCN from './IconFont'\nimport {\n svgBaseProps,\n withThemeSuffix,\n removeTypeTheme,\n getThemeFromTypeName,\n alias,\n} from './utils'\nimport warning from '../_util/warning'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport { getTwoToneColor, setTwoToneColor } from './twoTonePrimaryColor'\nimport './style'\n\n// Initial setting\nReactIcon.add(...Object.keys(allIcons).map((key) => (allIcons as any)[key]))\nsetTwoToneColor('#1890ff')\nlet defaultTheme: ThemeType = 'outlined'\nlet dangerousTheme: ThemeType | undefined\n\nfunction unstable_ChangeThemeOfIconsDangerously(theme?: ThemeType) {\n warning(\n false,\n 'Icon',\n `You are using the unstable method 'Icon.unstable_ChangeThemeOfAllIconsDangerously', ` +\n `make sure that all the icons with theme '${theme}' display correctly.`\n )\n dangerousTheme = theme\n}\n\nfunction unstable_ChangeDefaultThemeOfIcons(theme: ThemeType) {\n warning(\n false,\n 'Icon',\n `You are using the unstable method 'Icon.unstable_ChangeDefaultThemeOfIcons', ` +\n `make sure that all the icons with theme '${theme}' display correctly.`\n )\n defaultTheme = theme\n}\n\nexport interface TransferLocale {\n icon: string\n}\n\nexport interface CustomIconComponentProps {\n width: string | number\n height: string | number\n fill: string\n viewBox?: string\n className?: string\n style?: React.CSSProperties\n spin?: boolean\n rotate?: number\n ['aria-hidden']?: React.AriaAttributes['aria-hidden']\n}\n\nexport type ThemeType = 'filled' | 'outlined' | 'twoTone'\n\nexport interface IconProps {\n tabIndex?: number\n type?: string\n className?: string\n theme?: ThemeType\n title?: string\n onKeyUp?: React.KeyboardEventHandler<HTMLElement>\n onClick?: React.MouseEventHandler<HTMLElement>\n component?: React.ComponentType<CustomIconComponentProps | React.SVGProps<SVGSVGElement>>\n twoToneColor?: string\n viewBox?: string\n spin?: boolean\n rotate?: number\n style?: React.CSSProperties\n prefixCls?: string\n role?: string\n}\n\nexport interface IconComponent<P> extends React.SFC<P> {\n createFromIconfontCN: typeof createFromIconfontCN\n getTwoToneColor: typeof getTwoToneColor\n setTwoToneColor: typeof setTwoToneColor\n unstable_ChangeThemeOfIconsDangerously?: typeof unstable_ChangeThemeOfIconsDangerously\n unstable_ChangeDefaultThemeOfIcons?: typeof unstable_ChangeDefaultThemeOfIcons\n}\n\nconst Icon: IconComponent<IconProps> = (props) => {\n const {\n // affect outter <i>...</i>\n className,\n\n // affect inner <svg>...</svg>\n type,\n component: Component,\n viewBox,\n spin,\n rotate,\n\n tabIndex,\n onClick,\n\n // children\n children,\n\n // other\n theme, // default to outlined\n twoToneColor,\n\n ...restProps\n } = props\n\n warning(\n Boolean(type || Component || children),\n 'Icon',\n 'Should have `type` prop or `component` prop or `children`.'\n )\n\n const classString = classNames(\n 'tntd-anticon',\n {\n [`anticon`]: true,\n [`anticon-${type}`]: Boolean(type),\n },\n className\n )\n\n const svgClassString = classNames({\n [`anticon-spin`]: !!spin || type === 'loading',\n })\n\n const svgStyle = rotate\n ? {\n msTransform: `rotate(${rotate}deg)`,\n transform: `rotate(${rotate}deg)`,\n }\n : undefined\n\n const innerSvgProps: CustomIconComponentProps = {\n ...svgBaseProps,\n className: svgClassString,\n style: svgStyle,\n viewBox,\n }\n\n if (!viewBox) {\n delete innerSvgProps.viewBox\n }\n\n const renderInnerNode = () => {\n // component > children > type\n if (Component) {\n return <Component {...innerSvgProps}>{children}</Component>\n }\n\n if (children) {\n warning(\n Boolean(viewBox) ||\n (React.Children.count(children) === 1 &&\n React.isValidElement(children) &&\n React.Children.only(children).type === 'use'),\n 'Icon',\n 'Make sure that you provide correct `viewBox`' +\n ' prop (default `0 0 1024 1024`) to the icon.'\n )\n return (\n <svg {...innerSvgProps} viewBox={viewBox}>\n {children}\n </svg>\n )\n }\n\n if (typeof type === 'string') {\n let computedType = type\n if (theme) {\n const themeInName = getThemeFromTypeName(type)\n warning(\n !themeInName || theme === themeInName,\n 'Icon',\n `The icon name '${type}' already specify a theme '${themeInName}',` +\n ` the 'theme' prop '${theme}' will be ignored.`\n )\n }\n computedType = withThemeSuffix(\n removeTypeTheme(alias(computedType)),\n dangerousTheme || theme || defaultTheme\n )\n\n return (\n <ReactIcon\n className={svgClassString}\n type={computedType}\n primaryColor={twoToneColor}\n style={svgStyle}\n />\n )\n }\n }\n\n let iconTabIndex = tabIndex\n if (iconTabIndex === undefined && onClick) {\n iconTabIndex = -1\n }\n\n return (\n <LocaleReceiver componentName=\"Icon\">\n {(locale) => (\n <i\n aria-label={type && `${(locale as Record<'icon', object>).icon}: ${type}`}\n {...restProps}\n tabIndex={iconTabIndex}\n onClick={onClick}\n className={classString}\n >\n {renderInnerNode()}\n </i>\n )}\n </LocaleReceiver>\n )\n}\n\nIcon.createFromIconfontCN = createFromIconfontCN\nIcon.getTwoToneColor = getTwoToneColor\nIcon.setTwoToneColor = setTwoToneColor\n\nexport default Icon\n"]}
@@ -1,2 +1,3 @@
1
1
  import '../../style/index.less';
2
- import './index.less';
2
+ import './index.less';
3
+ import './style.less';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,cAAc,CAAA","sourcesContent":["import '../../style/index.less'\nimport './index.less'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/icon/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,cAAc,CAAA;AACrB,OAAO,cAAc,CAAA","sourcesContent":["import '../../style/index.less'\nimport './index.less'\nimport './style.less'\n"]}
@@ -1,4 +1,6 @@
1
+ @import '../../style/themes/index';
1
2
 
2
3
  .tntd-anticon {
3
4
  font-size: @font-size-lg;
4
- }
5
+ vertical-align: -0.25em;
6
+ }
@@ -170,7 +170,7 @@
170
170
 
171
171
  // Reset Select's style in addon
172
172
  .@{ant-prefix}-select {
173
- margin: calc(-(@input-padding-vertical-base + 1px)) (-@input-padding-horizontal-base);
173
+ margin: calc(1px - @input-padding-vertical-base) (-@input-padding-horizontal-base);
174
174
 
175
175
  .@{ant-prefix}-select-selection {
176
176
  margin: -1px;
@@ -0,0 +1,18 @@
1
+ @modal-prefix-cls: ~'@{ant-prefix}-modal';
2
+ @modal-footer-padding-vertical: 10px;
3
+ @modal-footer-padding-horizontal: 20px;
4
+
5
+ .@{modal-prefix-cls}-custom-header {
6
+ position: absolute;
7
+ top: 16px;
8
+ left: 16px;
9
+ right: 16px;
10
+ bottom: 0;
11
+ height: 24px;
12
+ text-align: right;
13
+ font-size: @font-size-lg;
14
+ }
15
+
16
+ .@{modal-prefix-cls}-confirm-body-wrapper{
17
+ margin-top: @margin-xxs;
18
+ }
@@ -45,7 +45,7 @@
45
45
  line-height: @line-height-base;
46
46
 
47
47
  .@{ant-prefix}-modal-custom-close {
48
- font-size: @font-size-lg;
48
+ font-size: 20px;
49
49
  font-weight: bold;
50
50
  margin-right: 0;
51
51
  }