@douyinfe/semi-ui 2.36.0-alpha.0 → 2.36.0-beta.0

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 (169) hide show
  1. package/dist/css/semi.css +166 -510
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +247 -277
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/anchor/index.d.ts +3 -2
  8. package/lib/cjs/anchor/link.js +13 -6
  9. package/lib/cjs/autoComplete/index.d.ts +1 -1
  10. package/lib/cjs/button/Button.d.ts +1 -1
  11. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  12. package/lib/cjs/button/index.d.ts +1 -1
  13. package/lib/cjs/calendar/dayCalendar.d.ts +2 -1
  14. package/lib/cjs/calendar/dayCalendar.js +7 -2
  15. package/lib/cjs/calendar/index.d.ts +1 -0
  16. package/lib/cjs/calendar/index.js +1 -0
  17. package/lib/cjs/calendar/interface.d.ts +2 -0
  18. package/lib/cjs/calendar/monthCalendar.d.ts +1 -1
  19. package/lib/cjs/calendar/monthCalendar.js +12 -4
  20. package/lib/cjs/calendar/rangeCalendar.d.ts +3 -1
  21. package/lib/cjs/calendar/rangeCalendar.js +23 -9
  22. package/lib/cjs/calendar/weekCalendar.d.ts +3 -1
  23. package/lib/cjs/calendar/weekCalendar.js +23 -9
  24. package/lib/cjs/collapse/item.d.ts +0 -2
  25. package/lib/cjs/collapse/item.js +2 -3
  26. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  27. package/lib/cjs/datePicker/datePicker.d.ts +2 -2
  28. package/lib/cjs/datePicker/datePicker.js +12 -4
  29. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  30. package/lib/cjs/datePicker/monthsGrid.js +6 -2
  31. package/lib/cjs/datePicker/yearAndMonth.d.ts +3 -1
  32. package/lib/cjs/datePicker/yearAndMonth.js +4 -2
  33. package/lib/cjs/form/baseForm.d.ts +1 -1
  34. package/lib/cjs/form/field.d.ts +1 -1
  35. package/lib/cjs/input/index.d.ts +1 -1
  36. package/lib/cjs/input/inputGroup.d.ts +1 -1
  37. package/lib/cjs/input/textarea.d.ts +1 -1
  38. package/lib/cjs/modal/confirm.d.ts +17 -17
  39. package/lib/cjs/navigation/Footer.d.ts +3 -0
  40. package/lib/cjs/navigation/Footer.js +19 -9
  41. package/lib/cjs/navigation/Item.d.ts +0 -4
  42. package/lib/cjs/navigation/Item.js +10 -29
  43. package/lib/cjs/navigation/SubNav.d.ts +1 -18
  44. package/lib/cjs/navigation/SubNav.js +30 -70
  45. package/lib/cjs/navigation/index.d.ts +4 -1
  46. package/lib/cjs/navigation/index.js +7 -1
  47. package/lib/cjs/rating/index.d.ts +1 -1
  48. package/lib/cjs/rating/item.d.ts +1 -1
  49. package/lib/cjs/select/index.d.ts +2 -1
  50. package/lib/cjs/select/index.js +4 -0
  51. package/lib/cjs/skeleton/index.d.ts +0 -1
  52. package/lib/cjs/skeleton/index.js +0 -1
  53. package/lib/cjs/skeleton/item.d.ts +0 -1
  54. package/lib/cjs/skeleton/item.js +1 -6
  55. package/lib/cjs/steps/basicStep.d.ts +0 -3
  56. package/lib/cjs/steps/basicStep.js +2 -8
  57. package/lib/cjs/steps/basicSteps.js +1 -2
  58. package/lib/cjs/steps/fillStep.d.ts +0 -2
  59. package/lib/cjs/steps/fillStep.js +1 -3
  60. package/lib/cjs/steps/fillSteps.js +8 -5
  61. package/lib/cjs/steps/index.d.ts +1 -63
  62. package/lib/cjs/steps/index.js +0 -9
  63. package/lib/cjs/steps/navStep.d.ts +0 -3
  64. package/lib/cjs/steps/navStep.js +2 -6
  65. package/lib/cjs/steps/navSteps.js +1 -2
  66. package/lib/cjs/steps/step.d.ts +1 -4
  67. package/lib/cjs/steps/step.js +0 -1
  68. package/lib/cjs/switch/index.d.ts +1 -1
  69. package/lib/cjs/table/Body/index.d.ts +1 -1
  70. package/lib/cjs/table/ResizableTable.d.ts +1 -1
  71. package/lib/cjs/table/Table.d.ts +2 -2
  72. package/lib/cjs/table/TableHeaderRow.js +22 -14
  73. package/lib/cjs/table/index.d.ts +1 -1
  74. package/lib/cjs/table/interface.d.ts +5 -1
  75. package/lib/cjs/tagInput/index.d.ts +1 -1
  76. package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
  77. package/lib/cjs/timePicker/index.d.ts +1 -1
  78. package/lib/cjs/timeline/index.d.ts +1 -2
  79. package/lib/cjs/timeline/index.js +2 -8
  80. package/lib/cjs/timeline/item.d.ts +0 -10
  81. package/lib/cjs/timeline/item.js +3 -42
  82. package/lib/cjs/typography/base.d.ts +1 -0
  83. package/lib/cjs/typography/base.js +28 -14
  84. package/lib/cjs/typography/title.d.ts +2 -0
  85. package/lib/cjs/typography/title.js +2 -1
  86. package/lib/es/anchor/index.d.ts +3 -2
  87. package/lib/es/anchor/link.js +12 -6
  88. package/lib/es/autoComplete/index.d.ts +1 -1
  89. package/lib/es/button/Button.d.ts +1 -1
  90. package/lib/es/button/buttonGroup.d.ts +1 -1
  91. package/lib/es/button/index.d.ts +1 -1
  92. package/lib/es/calendar/dayCalendar.d.ts +2 -1
  93. package/lib/es/calendar/dayCalendar.js +7 -2
  94. package/lib/es/calendar/index.d.ts +1 -0
  95. package/lib/es/calendar/index.js +1 -0
  96. package/lib/es/calendar/interface.d.ts +2 -0
  97. package/lib/es/calendar/monthCalendar.d.ts +1 -1
  98. package/lib/es/calendar/monthCalendar.js +12 -4
  99. package/lib/es/calendar/rangeCalendar.d.ts +3 -1
  100. package/lib/es/calendar/rangeCalendar.js +19 -9
  101. package/lib/es/calendar/weekCalendar.d.ts +3 -1
  102. package/lib/es/calendar/weekCalendar.js +19 -9
  103. package/lib/es/collapse/item.d.ts +0 -2
  104. package/lib/es/collapse/item.js +2 -3
  105. package/lib/es/datePicker/dateInput.d.ts +1 -1
  106. package/lib/es/datePicker/datePicker.d.ts +2 -2
  107. package/lib/es/datePicker/datePicker.js +12 -4
  108. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  109. package/lib/es/datePicker/monthsGrid.js +6 -2
  110. package/lib/es/datePicker/yearAndMonth.d.ts +3 -1
  111. package/lib/es/datePicker/yearAndMonth.js +4 -2
  112. package/lib/es/form/baseForm.d.ts +1 -1
  113. package/lib/es/form/field.d.ts +1 -1
  114. package/lib/es/input/index.d.ts +1 -1
  115. package/lib/es/input/inputGroup.d.ts +1 -1
  116. package/lib/es/input/textarea.d.ts +1 -1
  117. package/lib/es/modal/confirm.d.ts +17 -17
  118. package/lib/es/navigation/Footer.d.ts +3 -0
  119. package/lib/es/navigation/Footer.js +16 -7
  120. package/lib/es/navigation/Item.d.ts +0 -4
  121. package/lib/es/navigation/Item.js +10 -28
  122. package/lib/es/navigation/SubNav.d.ts +1 -18
  123. package/lib/es/navigation/SubNav.js +31 -72
  124. package/lib/es/navigation/index.d.ts +4 -1
  125. package/lib/es/navigation/index.js +7 -1
  126. package/lib/es/rating/index.d.ts +1 -1
  127. package/lib/es/rating/item.d.ts +1 -1
  128. package/lib/es/select/index.d.ts +2 -1
  129. package/lib/es/select/index.js +4 -0
  130. package/lib/es/skeleton/index.d.ts +0 -1
  131. package/lib/es/skeleton/index.js +0 -1
  132. package/lib/es/skeleton/item.d.ts +0 -1
  133. package/lib/es/skeleton/item.js +1 -6
  134. package/lib/es/steps/basicStep.d.ts +0 -3
  135. package/lib/es/steps/basicStep.js +2 -8
  136. package/lib/es/steps/basicSteps.js +1 -2
  137. package/lib/es/steps/fillStep.d.ts +0 -2
  138. package/lib/es/steps/fillStep.js +1 -3
  139. package/lib/es/steps/fillSteps.js +8 -6
  140. package/lib/es/steps/index.d.ts +1 -63
  141. package/lib/es/steps/index.js +0 -6
  142. package/lib/es/steps/navStep.d.ts +0 -3
  143. package/lib/es/steps/navStep.js +2 -6
  144. package/lib/es/steps/navSteps.js +1 -2
  145. package/lib/es/steps/step.d.ts +1 -4
  146. package/lib/es/steps/step.js +0 -1
  147. package/lib/es/switch/index.d.ts +1 -1
  148. package/lib/es/table/Body/index.d.ts +1 -1
  149. package/lib/es/table/ResizableTable.d.ts +1 -1
  150. package/lib/es/table/Table.d.ts +2 -2
  151. package/lib/es/table/TableHeaderRow.js +22 -14
  152. package/lib/es/table/index.d.ts +1 -1
  153. package/lib/es/table/interface.d.ts +5 -1
  154. package/lib/es/tagInput/index.d.ts +1 -1
  155. package/lib/es/timePicker/TimePicker.d.ts +1 -1
  156. package/lib/es/timePicker/index.d.ts +1 -1
  157. package/lib/es/timeline/index.d.ts +1 -2
  158. package/lib/es/timeline/index.js +2 -7
  159. package/lib/es/timeline/item.d.ts +0 -10
  160. package/lib/es/timeline/item.js +3 -41
  161. package/lib/es/typography/base.d.ts +1 -0
  162. package/lib/es/typography/base.js +28 -14
  163. package/lib/es/typography/title.d.ts +2 -0
  164. package/lib/es/typography/title.js +2 -1
  165. package/package.json +8 -9
  166. package/lib/cjs/timeline/context.d.ts +0 -8
  167. package/lib/cjs/timeline/context.js +0 -15
  168. package/lib/es/timeline/context.d.ts +0 -8
  169. package/lib/es/timeline/context.js +0 -3
@@ -28,5 +28,4 @@ const Step = props => {
28
28
  return renderStep();
29
29
  };
30
30
 
31
- Step.elementType = 'Steps.Step';
32
31
  export default Step;
@@ -45,7 +45,7 @@ declare class Switch extends BaseComponent<SwitchProps, SwitchState> {
45
45
  onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
46
46
  onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
47
47
  style: PropTypes.Requireable<object>;
48
- size: PropTypes.Requireable<"small" | "default" | "large">;
48
+ size: PropTypes.Requireable<"default" | "small" | "large">;
49
49
  uncheckedText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
50
50
  id: PropTypes.Requireable<string>;
51
51
  };
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
2
2
  import { FlattenData, GroupFlattenData } from '@douyinfe/semi-foundation/lib/es/table/bodyFoundation';
3
3
  import Store from '@douyinfe/semi-foundation/lib/es/utils/Store';
4
4
  import { BaseProps } from '../../_base/baseComponent';
5
- import { ExpandedRowRender, Virtualized, GetVirtualizedListRef, ColumnProps, Size, BodyScrollEvent, Scroll, Fixed, TableComponents, RowExpandable, VirtualizedOnScroll, RowKey } from '../interface';
5
+ import type { ExpandedRowRender, Virtualized, GetVirtualizedListRef, ColumnProps, Size, BodyScrollEvent, Scroll, Fixed, TableComponents, RowExpandable, VirtualizedOnScroll, RowKey } from '../interface';
6
6
  export interface BodyProps extends BaseProps {
7
7
  tableLayout?: 'fixed' | 'auto';
8
8
  anyColumnFixed?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import Table from './Table';
3
- import { TableProps } from './interface';
3
+ import type { TableProps } from './interface';
4
4
  declare const _default: React.ForwardRefExoticComponent<TableProps<any> & React.RefAttributes<Table<any>>>;
5
5
  export default _default;
@@ -60,7 +60,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
60
60
  components: PropTypes.Requireable<any>;
61
61
  bordered: PropTypes.Requireable<boolean>;
62
62
  loading: PropTypes.Requireable<boolean>;
63
- size: PropTypes.Requireable<"small" | "default" | "middle">;
63
+ size: PropTypes.Requireable<"default" | "small" | "middle">;
64
64
  tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
65
65
  columns: PropTypes.Requireable<PropTypes.InferProps<{
66
66
  align: PropTypes.Requireable<"left" | "right" | "center">;
@@ -297,7 +297,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
297
297
  showTotal?: boolean;
298
298
  pageSize?: number;
299
299
  pageSizeOpts?: number[];
300
- size?: "small" | "default";
300
+ size?: "default" | "small";
301
301
  currentPage?: number;
302
302
  defaultCurrentPage?: number;
303
303
  onPageChange?: (currentPage: number) => void;
@@ -169,22 +169,30 @@ export default class TableHeaderRow extends BaseComponent {
169
169
  return null;
170
170
  }
171
171
 
172
- return /*#__PURE__*/React.createElement(HeaderCell, Object.assign({
173
- role: "columnheader",
174
- "aria-colindex": cellIndex + 1
175
- }, props, {
176
- style: cellStyle,
177
- key: column.key || column.dataIndex || cellIndex
178
- }));
172
+ return (
173
+ /*#__PURE__*/
174
+ // @ts-ignore no need to do complex ts type checking and qualification
175
+ React.createElement(HeaderCell, Object.assign({
176
+ role: "columnheader",
177
+ "aria-colindex": cellIndex + 1
178
+ }, props, {
179
+ style: cellStyle,
180
+ key: column.key || column.dataIndex || cellIndex
181
+ }))
182
+ );
179
183
  });
180
184
 
181
- return /*#__PURE__*/React.createElement(HeaderRow, Object.assign({
182
- role: "row",
183
- "aria-rowindex": index + 1
184
- }, rowProps, {
185
- style: style,
186
- ref: this.cacheRef
187
- }), cells);
185
+ return (
186
+ /*#__PURE__*/
187
+ // @ts-ignore no need to do complex ts type checking and qualification
188
+ React.createElement(HeaderRow, Object.assign({
189
+ role: "row",
190
+ "aria-rowindex": index + 1
191
+ }, rowProps, {
192
+ style: style,
193
+ ref: this.cacheRef
194
+ }), cells)
195
+ );
188
196
  }
189
197
 
190
198
  }
@@ -16,7 +16,7 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
16
16
  components: PropTypes.Requireable<any>;
17
17
  bordered: PropTypes.Requireable<boolean>;
18
18
  loading: PropTypes.Requireable<boolean>;
19
- size: PropTypes.Requireable<"small" | "default" | "middle">;
19
+ size: PropTypes.Requireable<"default" | "small" | "middle">;
20
20
  tableLayout: PropTypes.Requireable<"" | "fixed" | "auto">;
21
21
  columns: PropTypes.Requireable<PropTypes.InferProps<{
22
22
  align: PropTypes.Requireable<"left" | "right" | "center">;
@@ -262,8 +262,12 @@ export declare type VirtualizedOnScrollArgs = {
262
262
  scrollOffset?: number;
263
263
  scrollUpdateWasRequested?: boolean;
264
264
  };
265
+ export declare type VirtualizeItemSizeRow = {
266
+ sectionRow?: boolean;
267
+ expandedRow?: boolean;
268
+ };
265
269
  export declare type VirtualizedMode = 'list' | 'grid';
266
- export declare type VirtualizedItemSizeFn = (index?: number) => number;
270
+ export declare type VirtualizedItemSizeFn = (index?: number, row?: VirtualizeItemSizeRow) => number;
267
271
  export declare type VirtualizedItemSize = number | VirtualizedItemSizeFn;
268
272
  export declare type VirtualizedOnScroll = (object: VirtualizedOnScrollArgs) => void;
269
273
  export interface VirtualizedProps {
@@ -96,7 +96,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
96
96
  onAdd: PropTypes.Requireable<(...args: any[]) => any>;
97
97
  onRemove: PropTypes.Requireable<(...args: any[]) => any>;
98
98
  onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
99
- size: PropTypes.Requireable<"small" | "default" | "large">;
99
+ size: PropTypes.Requireable<"default" | "small" | "large">;
100
100
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
101
101
  prefix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
102
102
  suffix: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
@@ -132,7 +132,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
132
132
  secondStep: PropTypes.Requireable<number>;
133
133
  focusOnOpen: PropTypes.Requireable<boolean>;
134
134
  autoFocus: PropTypes.Requireable<boolean>;
135
- size: PropTypes.Requireable<"small" | "default" | "large">;
135
+ size: PropTypes.Requireable<"default" | "small" | "large">;
136
136
  panels: PropTypes.Requireable<PropTypes.InferProps<{
137
137
  panelHeader: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
138
138
  panelFooter: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
@@ -49,7 +49,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
49
49
  secondStep: import("prop-types").Requireable<number>;
50
50
  focusOnOpen: import("prop-types").Requireable<boolean>;
51
51
  autoFocus: import("prop-types").Requireable<boolean>;
52
- size: import("prop-types").Requireable<"small" | "default" | "large">;
52
+ size: import("prop-types").Requireable<"default" | "small" | "large">;
53
53
  panels: import("prop-types").Requireable<import("prop-types").InferProps<{
54
54
  panelHeader: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
55
55
  panelFooter: import("prop-types").Requireable<NonNullable<import("prop-types").ReactNodeLike>>;
@@ -2,13 +2,12 @@ import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
4
  import Item, { TimelineItemProps } from './item';
5
- import { ModeType } from './context';
6
5
  export type { TimelineItemProps } from './item';
7
6
  export interface Data extends TimelineItemProps {
8
7
  content: React.ReactNode;
9
8
  }
10
9
  export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'> {
11
- mode?: ModeType;
10
+ mode?: 'left' | 'right' | 'center' | 'alternate';
12
11
  className?: string;
13
12
  style?: React.CSSProperties;
14
13
  dataSource?: Data[];
@@ -5,7 +5,6 @@ import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
6
6
  import ConfigContext from '../configProvider/context';
7
7
  import Item from './item';
8
- import Context from './context';
9
8
  const prefixCls = cssClasses.PREFIX;
10
9
 
11
10
  class Timeline extends PureComponent {
@@ -77,15 +76,11 @@ class Timeline extends PureComponent {
77
76
  }
78
77
 
79
78
  const items = childrenList || this.addClassName(children);
80
- return /*#__PURE__*/React.createElement(Context.Provider, {
81
- value: {
82
- mode
83
- }
84
- }, /*#__PURE__*/React.createElement("ul", {
79
+ return /*#__PURE__*/React.createElement("ul", {
85
80
  "aria-label": this.props['aria-label'],
86
81
  style: style,
87
82
  className: classString
88
- }, items));
83
+ }, items);
89
84
  }
90
85
 
91
86
  }
@@ -1,7 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
- import { ModeType, TimelineContextValue } from './context';
5
4
  export interface TimelineItemProps {
6
5
  color?: string;
7
6
  children?: React.ReactNode;
@@ -13,13 +12,8 @@ export interface TimelineItemProps {
13
12
  className?: string;
14
13
  style?: React.CSSProperties;
15
14
  onClick?: React.MouseEventHandler<HTMLLIElement>;
16
- mode?: ModeType;
17
- odd?: boolean;
18
- usedInC2D?: boolean;
19
15
  }
20
16
  export default class Item extends PureComponent<TimelineItemProps> {
21
- static contextType: React.Context<TimelineContextValue>;
22
- static elementType: string;
23
17
  static propTypes: {
24
18
  color: PropTypes.Requireable<string>;
25
19
  time: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -30,15 +24,11 @@ export default class Item extends PureComponent<TimelineItemProps> {
30
24
  className: PropTypes.Requireable<string>;
31
25
  style: PropTypes.Requireable<object>;
32
26
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
33
- mode: PropTypes.Requireable<string>;
34
- lastChild: PropTypes.Requireable<boolean>;
35
27
  };
36
- context: TimelineContextValue;
37
28
  static defaultProps: {
38
29
  type: string;
39
30
  time: string;
40
31
  onClick: (...args: any[]) => void;
41
32
  };
42
- getC2DCls: () => string;
43
33
  render(): JSX.Element;
44
34
  }
@@ -4,42 +4,8 @@ import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
6
6
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
7
- import Context from './context';
8
7
  const prefixCls = cssClasses.ITEM;
9
8
  export default class Item extends PureComponent {
10
- constructor() {
11
- super(...arguments); // getC2DCls is used in C2D, it does not work in non-C2D scenes
12
-
13
- this.getC2DCls = () => {
14
- let c2dCls = '';
15
- const {
16
- mode,
17
- odd,
18
- usedInC2D
19
- } = this.props;
20
-
21
- if (usedInC2D) {
22
- switch (mode) {
23
- case 'center':
24
- c2dCls = `${prefixCls}-center ${prefixCls}-left`;
25
- break;
26
-
27
- case 'alternate':
28
- c2dCls = `${prefixCls}-alternate ${prefixCls}-${odd ? 'left' : 'right'}`;
29
- break;
30
-
31
- default:
32
- c2dCls = `${prefixCls}-${mode} ${mode === 'right' ? `${prefixCls}-mode-right` : ''}`;
33
- break;
34
- }
35
-
36
- c2dCls += ` ${prefixCls}-not-last-child`;
37
- }
38
-
39
- return c2dCls;
40
- };
41
- }
42
-
43
9
  render() {
44
10
  const {
45
11
  className,
@@ -52,7 +18,7 @@ export default class Item extends PureComponent {
52
18
  extra,
53
19
  onClick
54
20
  } = this.props;
55
- const itemCls = cls(prefixCls, className, this.getC2DCls());
21
+ const itemCls = cls(prefixCls, className);
56
22
  const dotCls = cls({
57
23
  [`${prefixCls}-head`]: true,
58
24
  [`${prefixCls}-head-custom`]: dot,
@@ -83,7 +49,6 @@ export default class Item extends PureComponent {
83
49
  }
84
50
 
85
51
  }
86
- Item.contextType = Context;
87
52
  Item.propTypes = {
88
53
  color: PropTypes.string,
89
54
  time: PropTypes.node,
@@ -93,13 +58,10 @@ Item.propTypes = {
93
58
  position: PropTypes.oneOf(strings.ITEM_POS),
94
59
  className: PropTypes.string,
95
60
  style: PropTypes.object,
96
- onClick: PropTypes.func,
97
- mode: PropTypes.string,
98
- lastChild: PropTypes.bool
61
+ onClick: PropTypes.func
99
62
  };
100
63
  Item.defaultProps = {
101
64
  type: 'default',
102
65
  time: '',
103
66
  onClick: _noop
104
- };
105
- Item.elementType = 'Timeline.Item';
67
+ };
@@ -22,6 +22,7 @@ export interface BaseTypographyProps extends BaseProps {
22
22
  component?: React.ElementType;
23
23
  spacing?: string;
24
24
  heading?: string;
25
+ weight?: string | number;
25
26
  }
26
27
  interface BaseTypographyState {
27
28
  editable: boolean;
@@ -76,7 +76,7 @@ export default class Base extends Component {
76
76
  }
77
77
 
78
78
  this.rafId = window.requestAnimationFrame(this.getEllipsisState.bind(this));
79
- }; // if need to use js overflowed:
79
+ }; // if it needs to use js overflowed:
80
80
  // 1. text is expandable 2. expandText need to be shown 3. has extra operation 4. text need to ellipse from mid
81
81
 
82
82
 
@@ -419,10 +419,7 @@ export default class Base extends Component {
419
419
  const {
420
420
  expanded
421
421
  } = this.state;
422
- const canUseCSSEllipsis = this.canUseCSSEllipsis(); // Currently only text truncation is supported, if there is non-text,
423
- // both css truncation and js truncation should throw a warning
424
-
425
- warning('children' in this.props && typeof children !== 'string', "[Semi Typography] 'Only children with pure text could be used with ellipsis at this moment."); // If children is null, css/js truncated flag isTruncate is false
422
+ const canUseCSSEllipsis = this.canUseCSSEllipsis(); // If children is null, css/js truncated flag isTruncate is false
426
423
 
427
424
  if (_isNull(children)) {
428
425
  this.setState({
@@ -430,7 +427,11 @@ export default class Base extends Component {
430
427
  isOverflowed: false
431
428
  });
432
429
  return undefined;
433
- }
430
+ } // Currently only text truncation is supported, if there is non-text,
431
+ // both css truncation and js truncation should throw a warning
432
+
433
+
434
+ warning('children' in this.props && typeof children !== 'string', "[Semi Typography] Only children with pure text could be used with ellipsis at this moment.");
434
435
 
435
436
  if (!rows || rows < 0 || expanded) {
436
437
  return undefined;
@@ -539,9 +540,10 @@ export default class Base extends Component {
539
540
  icon,
540
541
  size,
541
542
  link,
542
- heading
543
+ heading,
544
+ weight
543
545
  } = _a,
544
- rest = __rest(_a, ["component", "children", "className", "type", "spacing", "disabled", "style", "ellipsis", "icon", "size", "link", "heading"]);
546
+ rest = __rest(_a, ["component", "children", "className", "type", "spacing", "disabled", "style", "ellipsis", "icon", "size", "link", "heading", "weight"]);
545
547
 
546
548
  const textProps = _omit(rest, ['strong', 'editable', 'mark', 'copyable', 'underline', 'code', // 'link',
547
549
  'delete']);
@@ -561,6 +563,7 @@ export default class Base extends Component {
561
563
  className: linkCls
562
564
  }, textNode) : textNode));
563
565
  const hTagReg = /^h[1-6]$/;
566
+ const isHeader = _isString(heading) && hTagReg.test(heading);
564
567
  const wrapperCls = cls(className, ellipsisCls, {
565
568
  // [`${prefixCls}-primary`]: !type || type === 'primary',
566
569
  [`${prefixCls}-${type}`]: type && !link,
@@ -568,11 +571,15 @@ export default class Base extends Component {
568
571
  [`${prefixCls}-link`]: link,
569
572
  [`${prefixCls}-disabled`]: disabled,
570
573
  [`${prefixCls}-${spacing}`]: spacing,
571
- [`${prefixCls}-${heading}`]: _isString(heading) && hTagReg.test(heading)
574
+ [`${prefixCls}-${heading}`]: isHeader,
575
+ [`${prefixCls}-${heading}-weight-${weight}`]: isHeader && isNaN(Number(weight))
572
576
  });
577
+ const textStyle = Object.assign(Object.assign({}, isNaN(Number(weight)) ? {} : {
578
+ fontWeight: weight
579
+ }), style);
573
580
  return /*#__PURE__*/React.createElement(Typography, Object.assign({
574
581
  className: wrapperCls,
575
- style: Object.assign(Object.assign({}, style), ellipsisStyle),
582
+ style: Object.assign(Object.assign({}, textStyle), ellipsisStyle),
576
583
  component: component,
577
584
  forwardRef: this.wrapperRef
578
585
  }, textProps), textNode, this.renderOperations());
@@ -608,15 +615,22 @@ export default class Base extends Component {
608
615
  }
609
616
 
610
617
  render() {
611
- return /*#__PURE__*/React.createElement(ResizeObserver, {
612
- onResize: this.onResize
613
- }, /*#__PURE__*/React.createElement(LocaleConsumer, {
618
+ const content = /*#__PURE__*/React.createElement(LocaleConsumer, {
614
619
  componentName: "Typography"
615
620
  }, locale => {
616
621
  this.expandStr = locale.expand;
617
622
  this.collapseStr = locale.collapse;
618
623
  return this.renderTipWrapper();
619
- }));
624
+ });
625
+
626
+ if (this.props.ellipsis) {
627
+ return /*#__PURE__*/React.createElement(ResizeObserver, {
628
+ onResize: this.onResize,
629
+ observeParent: true
630
+ }, content);
631
+ }
632
+
633
+ return content;
620
634
  }
621
635
 
622
636
  }
@@ -26,6 +26,7 @@ export interface TitleProps extends Omit<React.HTMLAttributes<HTMLHeadingElement
26
26
  style?: React.CSSProperties;
27
27
  type?: TypographyBaseType;
28
28
  underline?: boolean;
29
+ weight?: ArrayElement<typeof strings.WEIGHT> | number;
29
30
  }
30
31
  export default class Title extends PureComponent<TitleProps> {
31
32
  static propTypes: {
@@ -42,6 +43,7 @@ export default class Title extends PureComponent<TitleProps> {
42
43
  style: PropTypes.Requireable<object>;
43
44
  className: PropTypes.Requireable<string>;
44
45
  component: PropTypes.Requireable<string>;
46
+ weight: PropTypes.Requireable<NonNullable<number | "default" | "bold" | "medium" | "light" | "regular" | "semibold">>;
45
47
  };
46
48
  static defaultProps: {
47
49
  copyable: boolean;
@@ -44,7 +44,8 @@ Title.propTypes = {
44
44
  heading: PropTypes.oneOf(strings.HEADING),
45
45
  style: PropTypes.object,
46
46
  className: PropTypes.string,
47
- component: PropTypes.string
47
+ component: PropTypes.string,
48
+ weight: PropTypes.oneOfType([PropTypes.oneOf(strings.WEIGHT), PropTypes.number])
48
49
  };
49
50
  Title.defaultProps = {
50
51
  copyable: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.36.0-alpha.0",
3
+ "version": "2.36.0-beta.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.36.0-alpha.0",
21
- "@douyinfe/semi-animation-react": "2.36.0-alpha.0",
22
- "@douyinfe/semi-foundation": "2.36.0-alpha.0",
23
- "@douyinfe/semi-icons": "2.36.0-alpha.0",
24
- "@douyinfe/semi-illustrations": "2.36.0-alpha.0",
25
- "@douyinfe/semi-theme-default": "2.36.0-alpha.0",
20
+ "@douyinfe/semi-animation": "2.36.0-beta.0",
21
+ "@douyinfe/semi-animation-react": "2.36.0-beta.0",
22
+ "@douyinfe/semi-foundation": "2.36.0-beta.0",
23
+ "@douyinfe/semi-icons": "2.36.0-beta.0",
24
+ "@douyinfe/semi-illustrations": "2.36.0-beta.0",
25
+ "@douyinfe/semi-theme-default": "2.36.0-beta.0",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,14 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "b0ea78a81e9ba459f9f5a06c831235a5d5e9d3a0",
72
+ "gitHead": "e973ed0dc3b8cd37e9c737f1548e386d814f787b",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
78
  "@douyinfe/semi-scss-compile": "2.23.2",
79
- "@storybook/addon-knobs": "^6.3.1",
80
79
  "@types/lodash": "^4.14.176",
81
80
  "@types/react": ">=16.0.0",
82
81
  "@types/react-dom": ">=16.0.0",
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare type ModeType = 'left' | 'right' | 'center' | 'alternate';
3
- export interface TimelineContextValue {
4
- mode?: ModeType;
5
- sum?: number;
6
- }
7
- declare const Context: React.Context<TimelineContextValue>;
8
- export default Context;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const Context = /*#__PURE__*/_react.default.createContext(null);
13
-
14
- var _default = Context;
15
- exports.default = _default;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare type ModeType = 'left' | 'right' | 'center' | 'alternate';
3
- export interface TimelineContextValue {
4
- mode?: ModeType;
5
- sum?: number;
6
- }
7
- declare const Context: React.Context<TimelineContextValue>;
8
- export default Context;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- const Context = /*#__PURE__*/React.createContext(null);
3
- export default Context;