@rainbow-oh/yee-c 0.8.1 → 0.8.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 (124) hide show
  1. package/dist/cjs/Cascader/cascader.js +38 -30
  2. package/dist/cjs/Cascader/column.js +17 -9
  3. package/dist/cjs/Cascader/search-list.js +30 -22
  4. package/dist/cjs/Cascader/utils/index.js +1 -5
  5. package/dist/cjs/Checkbox/checkbox-group.js +23 -14
  6. package/dist/cjs/Dialog/dialog.js +1 -1
  7. package/dist/cjs/Dialog/interface.d.ts +1 -1
  8. package/dist/cjs/Dialog/style/index.less +2 -1
  9. package/dist/cjs/Drawer/drawer.js +9 -1
  10. package/dist/cjs/Form/Group.js +1 -1
  11. package/dist/cjs/Form/demo/tooltip.js +1 -3
  12. package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
  13. package/dist/cjs/Menu/menu.js +18 -2
  14. package/dist/cjs/Pagination/items.js +54 -26
  15. package/dist/cjs/Pagination/pagination.js +25 -9
  16. package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
  17. package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
  18. package/dist/cjs/Rate/star.js +27 -3
  19. package/dist/cjs/Segmented/demo/variant.js +15 -1
  20. package/dist/cjs/Segmented/index.d.ts +1 -1
  21. package/dist/cjs/Segmented/segmented.js +12 -15
  22. package/dist/cjs/Select/option.js +8 -1
  23. package/dist/cjs/Select/options.js +9 -1
  24. package/dist/cjs/Select/select.js +3 -1
  25. package/dist/cjs/Steps/step.js +14 -2
  26. package/dist/cjs/Steps/steps.js +11 -1
  27. package/dist/cjs/Table/demo/components-override.js +31 -2
  28. package/dist/cjs/Table/demo/grouping.js +7 -1
  29. package/dist/cjs/Table/hooks/useColumns.d.ts +3 -3
  30. package/dist/cjs/Table/hooks/useColumns.js +11 -14
  31. package/dist/cjs/Table/index.d.ts +1 -1
  32. package/dist/cjs/Table/style/index.less +2 -4
  33. package/dist/cjs/Table/tbody/row.js +1 -4
  34. package/dist/cjs/Table/theader/index.js +12 -4
  35. package/dist/cjs/Tour/index.d.ts +1 -1
  36. package/dist/cjs/Tree/style/index.less +1 -5
  37. package/dist/cjs/Tree/tree.js +38 -35
  38. package/dist/cjs/hooks/useEvent.js +1 -4
  39. package/dist/cjs/style/size.css +2 -0
  40. package/dist/cjs/style/themes.css +1 -1
  41. package/dist/cjs/style/variables.css +3 -1
  42. package/dist/cjs/version.d.ts +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/esm/Dialog/dialog.js +2 -2
  45. package/dist/esm/Dialog/interface.d.ts +1 -1
  46. package/dist/esm/Dialog/style/index.less +2 -1
  47. package/dist/esm/Form/Group.js +1 -1
  48. package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
  49. package/dist/esm/Segmented/index.d.ts +1 -1
  50. package/dist/esm/Segmented/segmented.js +1 -1
  51. package/dist/esm/Table/demo/components-override.js +1 -0
  52. package/dist/esm/Table/hooks/useColumns.d.ts +3 -3
  53. package/dist/esm/Table/hooks/useColumns.js +13 -16
  54. package/dist/esm/Table/index.d.ts +1 -1
  55. package/dist/esm/Table/style/index.less +2 -4
  56. package/dist/esm/Tour/index.d.ts +1 -1
  57. package/dist/esm/Tree/style/index.less +1 -5
  58. package/dist/esm/Tree/tree.js +1 -1
  59. package/dist/esm/style/size.css +2 -0
  60. package/dist/esm/style/themes.css +1 -1
  61. package/dist/esm/style/variables.css +3 -1
  62. package/dist/esm/version.d.ts +1 -1
  63. package/dist/esm/version.js +1 -1
  64. package/dist/umd/yee-c.min.css +2 -2
  65. package/dist/umd/yee-c.min.js +1 -1
  66. package/package.json +1 -1
  67. package/src/Anchor/anchor.tsx +2 -2
  68. package/src/Carousel/carousel.tsx +1 -2
  69. package/src/Cascader/cascader.tsx +5 -1
  70. package/src/Cascader/column.tsx +5 -1
  71. package/src/Cascader/search-list.tsx +10 -3
  72. package/src/Cascader/utils/index.ts +3 -6
  73. package/src/Checkbox/checkbox-group.tsx +6 -1
  74. package/src/Dialog/dialog.tsx +7 -3
  75. package/src/Dialog/interface.ts +1 -1
  76. package/src/Dialog/style/index.less +2 -1
  77. package/src/Drawer/drawer.tsx +7 -1
  78. package/src/Form/Group.tsx +2 -4
  79. package/src/Form/demo/tooltip.tsx +2 -11
  80. package/src/Form/utils/validate.ts +1 -4
  81. package/src/List/hooks/useListKeyboard.ts +3 -3
  82. package/src/List/list.tsx +2 -1
  83. package/src/Menu/menu.tsx +14 -3
  84. package/src/Pagination/items.tsx +16 -4
  85. package/src/Pagination/pagination.tsx +18 -4
  86. package/src/PickerPanel/panels/DatePanel/DateBody.tsx +1 -1
  87. package/src/PickerPanel/panels/DateTimePanel/index.tsx +1 -1
  88. package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +7 -2
  89. package/src/PickerPanel/panels/PanelBody.tsx +1 -1
  90. package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +1 -1
  91. package/src/PickerPanel/panels/RangePanel/index.tsx +1 -1
  92. package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +1 -1
  93. package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +1 -1
  94. package/src/PickerPanel/utils/pickerUtils.ts +2 -1
  95. package/src/RangePicker/range-picker-mobile.tsx +1 -3
  96. package/src/Rate/star.tsx +16 -4
  97. package/src/Segmented/demo/variant.tsx +10 -2
  98. package/src/Segmented/index.ts +2 -2
  99. package/src/Segmented/segmented.tsx +4 -11
  100. package/src/Select/interface.ts +0 -1
  101. package/src/Select/option.tsx +8 -2
  102. package/src/Select/options.tsx +11 -4
  103. package/src/Select/select.tsx +4 -4
  104. package/src/Steps/step.tsx +11 -3
  105. package/src/Steps/steps.tsx +8 -1
  106. package/src/Table/demo/components-override.tsx +34 -7
  107. package/src/Table/demo/grouping.tsx +8 -4
  108. package/src/Table/hooks/useColumns.ts +14 -18
  109. package/src/Table/index.ts +3 -3
  110. package/src/Table/style/index.less +2 -4
  111. package/src/Table/table.tsx +2 -4
  112. package/src/Table/tbody/row.tsx +1 -3
  113. package/src/Table/theader/index.tsx +9 -10
  114. package/src/Tour/demo/placement.tsx +2 -1
  115. package/src/Tour/index.ts +1 -1
  116. package/src/Tree/style/index.less +1 -5
  117. package/src/Tree/tree.tsx +16 -11
  118. package/src/Tree/utils/tree-tools.ts +4 -1
  119. package/src/hooks/useEvent.ts +1 -3
  120. package/src/locale/context.tsx +5 -1
  121. package/src/locale/interface.ts +3 -1
  122. package/src/style/size.css +2 -0
  123. package/src/utils/debounce.ts +1 -3
  124. package/src/version.ts +1 -1
@@ -7,8 +7,14 @@ import { OptionsCtx } from './options';
7
7
 
8
8
  const Option = (props: OptionProps) => {
9
9
  const { label, value, disabled, title, dataTestId, style } = props;
10
- const { prefixCls, selectedKeys, focusedKey, multiple, looseMatch, onSelect } =
11
- useContext(OptionsCtx);
10
+ const {
11
+ prefixCls,
12
+ selectedKeys,
13
+ focusedKey,
14
+ multiple,
15
+ looseMatch,
16
+ onSelect,
17
+ } = useContext(OptionsCtx);
12
18
 
13
19
  const handleClick = (e: React.MouseEvent | React.KeyboardEvent) => {
14
20
  if (!disabled) {
@@ -117,13 +117,20 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
117
117
  const containerRect = container.getBoundingClientRect();
118
118
  const targetRect = targetElement.getBoundingClientRect();
119
119
  if (targetRect.bottom > containerRect.bottom) {
120
- container.scrollTop +=
121
- targetRect.bottom - containerRect.bottom;
120
+ container.scrollTop += targetRect.bottom - containerRect.bottom;
122
121
  } else if (targetRect.top < containerRect.top) {
123
122
  container.scrollTop -= containerRect.top - targetRect.top;
124
123
  }
125
124
  }
126
- }, [focusedKey, virtual, options, scrollToIndex, rootRef, multiColumn, columns]);
125
+ }, [
126
+ focusedKey,
127
+ virtual,
128
+ options,
129
+ scrollToIndex,
130
+ rootRef,
131
+ multiColumn,
132
+ columns,
133
+ ]);
127
134
 
128
135
  const isEmpty = options.length === 0;
129
136
  const ctxValue = {
@@ -257,7 +264,7 @@ const Options = forwardRef<HTMLDivElement, OptionsProps>(
257
264
  style={{
258
265
  ...popupStyle,
259
266
  ...(multiColumn
260
- ? { '--yee-select-columns': columns } as React.CSSProperties
267
+ ? ({ '--yee-select-columns': columns } as React.CSSProperties)
261
268
  : undefined),
262
269
  }}
263
270
  ref={rootRef}
@@ -97,9 +97,7 @@ const Select = (baseprops: SelectProps) => {
97
97
  virtualApiRef.current?.scrollToIndex(index);
98
98
  }, []);
99
99
 
100
- const getOptions = (
101
- keys: string | number | Array<string | number>,
102
- ) => {
100
+ const getOptions = (keys: string | number | Array<string | number>) => {
103
101
  if (keys === '' || keys === null) {
104
102
  return undefined;
105
103
  }
@@ -133,7 +131,9 @@ const Select = (baseprops: SelectProps) => {
133
131
  setOpen(false);
134
132
  } else {
135
133
  if (keysIncludes(mergedValue, key, looseMatch)) {
136
- keys = mergedValue.filter((k: string | number) => !matchValue(k, key, looseMatch));
134
+ keys = mergedValue.filter(
135
+ (k: string | number) => !matchValue(k, key, looseMatch),
136
+ );
137
137
  } else {
138
138
  keys = [...mergedValue, key];
139
139
  }
@@ -98,7 +98,10 @@ const Step: React.FC<StepProps> = (props) => {
98
98
  return (
99
99
  <>
100
100
  {type === 'ribbon' && (
101
- <div className={`${prefixCls}-item-ribbon-end ${ribbonStatus}`} aria-hidden="true" />
101
+ <div
102
+ className={`${prefixCls}-item-ribbon-end ${ribbonStatus}`}
103
+ aria-hidden="true"
104
+ />
102
105
  )}
103
106
  <div
104
107
  className={cls}
@@ -111,7 +114,9 @@ const Step: React.FC<StepProps> = (props) => {
111
114
  aria-current={index === current ? 'step' : undefined}
112
115
  aria-label={`Step ${index + 1}${typeof title === 'string' ? `: ${title}` : ''}, ${statusLabel}`}
113
116
  >
114
- <div className={`${prefixCls}-item-icon`} aria-hidden="true">{renderIcon}</div>
117
+ <div className={`${prefixCls}-item-icon`} aria-hidden="true">
118
+ {renderIcon}
119
+ </div>
115
120
  <div className={`${prefixCls}-item-content`}>
116
121
  <div className={`${prefixCls}-item-title`}>
117
122
  <span title={typeof title === 'string' ? title : undefined}>
@@ -132,7 +137,10 @@ const Step: React.FC<StepProps> = (props) => {
132
137
  </div>
133
138
  )}
134
139
  {type === 'ribbon' && (
135
- <div className={`${prefixCls}-item-ribbon-head ${ribbonStatus}`} aria-hidden="true" />
140
+ <div
141
+ className={`${prefixCls}-item-ribbon-head ${ribbonStatus}`}
142
+ aria-hidden="true"
143
+ />
136
144
  )}
137
145
  </>
138
146
  );
@@ -71,7 +71,14 @@ const Steps = forwardRef<HTMLDivElement, StepsProps>((baseprops, ref) => {
71
71
  };
72
72
 
73
73
  return (
74
- <div {...rest} className={cls} style={style} ref={ref} role="list" aria-label="Steps">
74
+ <div
75
+ {...rest}
76
+ className={cls}
77
+ style={style}
78
+ ref={ref}
79
+ role="list"
80
+ aria-label="Steps"
81
+ >
75
82
  <StepsContext.Provider value={contextValue}>
76
83
  {renderSteps()}
77
84
  </StepsContext.Provider>
@@ -7,21 +7,41 @@
7
7
  *
8
8
  * Table 本身不依赖任何拖拽库;本 demo 不引入 dnd,仅证明替换点生效。
9
9
  */
10
- import { Table } from '@rainbow-oh/yee-c';
11
10
  import type { TableComponents, TableRowRendererProps } from '@rainbow-oh/yee-c';
11
+ import { Table } from '@rainbow-oh/yee-c';
12
12
  import React from 'react';
13
13
 
14
14
  // 替换 <tbody>:保持渲染 <tbody>,外部库可在此包 SortableContext。
15
- const CustomTbody = (props: { className?: string; children?: React.ReactNode }) => (
15
+ const CustomTbody = (props: {
16
+ className?: string;
17
+ children?: React.ReactNode;
18
+ }) => (
16
19
  <tbody className={props.className} data-custom-tbody>
17
20
  {props.children}
18
21
  </tbody>
19
22
  );
20
23
 
21
24
  // 整行接管:消费方渲染整 <tr> + 单元格,可在此放拖拽手柄等任意内容。
22
- const CustomRow = ({ record, index, columns, rowKey }: TableRowRendererProps) => (
23
- <tr data-row-key={rowKey} style={{ background: index % 2 === 0 ? '#f8fafc' : undefined }}>
24
- <td style={{ width: 40, textAlign: 'center', color: '#2563eb', fontWeight: 700 }}>{index + 1}</td>
25
+ const CustomRow = ({
26
+ record,
27
+ index,
28
+ columns,
29
+ rowKey,
30
+ }: TableRowRendererProps) => (
31
+ <tr
32
+ data-row-key={rowKey}
33
+ style={{ background: index % 2 === 0 ? '#f8fafc' : undefined }}
34
+ >
35
+ <td
36
+ style={{
37
+ width: 40,
38
+ textAlign: 'center',
39
+ color: '#2563eb',
40
+ fontWeight: 700,
41
+ }}
42
+ >
43
+ {index + 1}
44
+ </td>
25
45
  {columns.map((col) => (
26
46
  <td key={String(col.key)}>{record[col.dataIndex || '']}</td>
27
47
  ))}
@@ -36,7 +56,12 @@ export default () => {
36
56
  ];
37
57
 
38
58
  const dataSource = [
39
- { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park' },
59
+ {
60
+ key: '1',
61
+ name: 'John Brown',
62
+ age: 32,
63
+ address: 'New York No. 1 Lake Park',
64
+ },
40
65
  { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park' },
41
66
  { key: '3', name: 'Joe Black', age: 32, address: 'Sidney No. 1 Lake Park' },
42
67
  ];
@@ -45,5 +70,7 @@ export default () => {
45
70
  body: { tbody: CustomTbody, row: CustomRow },
46
71
  };
47
72
 
48
- return <Table columns={columns} dataSource={dataSource} components={components} />;
73
+ return (
74
+ <Table columns={columns} dataSource={dataSource} components={components} />
75
+ );
49
76
  };
@@ -20,7 +20,13 @@ export default () => {
20
20
  title: 'Info',
21
21
  key: 'info',
22
22
  children: [
23
- { title: 'Age', dataIndex: 'age', key: 'age', width: 100, sorter: true },
23
+ {
24
+ title: 'Age',
25
+ dataIndex: 'age',
26
+ key: 'age',
27
+ width: 100,
28
+ sorter: true,
29
+ },
24
30
  {
25
31
  title: 'Address',
26
32
  dataIndex: 'address',
@@ -52,9 +58,7 @@ export default () => {
52
58
  key: 'action',
53
59
  fixed: 'right',
54
60
  width: 100,
55
- render: (record) => (
56
- <a onClick={() => console.log(record)}>Edit</a>
57
- ),
61
+ render: (record) => <a onClick={() => console.log(record)}>Edit</a>,
58
62
  },
59
63
  ];
60
64
 
@@ -1,5 +1,4 @@
1
1
  import React, { useMemo } from 'react';
2
- import useDeepCompareMemo from '../../hooks/useDeepCompareMemo';
3
2
  import deepClone from '../../utils/deepClone';
4
3
  import { handleColumns } from '../util';
5
4
  import {
@@ -15,6 +14,18 @@ import type {
15
14
  WrapedColumnProps,
16
15
  } from '../interface';
17
16
 
17
+ const getColumnsFromChild = (
18
+ childs: React.ReactElement<ColumnProps>[],
19
+ ): Array<ColumnProps> | null => {
20
+ const cols: ColumnProps[] = [];
21
+ React.Children.forEach(childs, (child) => {
22
+ if (child) {
23
+ cols.push({ ...(child.props as ColumnProps) });
24
+ }
25
+ });
26
+ return cols.length ? cols : null;
27
+ };
28
+
18
29
  export default function useColumns({
19
30
  children,
20
31
  columns,
@@ -28,21 +39,6 @@ export default function useColumns({
28
39
  rowSelection?: RowSelectionType;
29
40
  expandable?: ExpandableType;
30
41
  }) {
31
- const shouldRenderSelection = !!rowSelection;
32
- const shouldRenderExpand = !!expandable;
33
-
34
- const getColumnsFromChild = (
35
- childs: React.ReactElement<ColumnProps>[],
36
- ): Array<ColumnProps> | null => {
37
- const cols: ColumnProps[] = [];
38
- React.Children.forEach(childs, (child) => {
39
- if (child) {
40
- cols.push({ ...(child.props as ColumnProps) });
41
- }
42
- });
43
- return cols.length ? cols : null;
44
- };
45
-
46
42
  const childColumns: Array<ColumnProps> | null = useMemo(() => {
47
43
  return children
48
44
  ? getColumnsFromChild(children as React.ReactElement<ColumnProps>[])
@@ -52,7 +48,7 @@ export default function useColumns({
52
48
  // Build the column tree (with selection/expand injected at the top level),
53
49
  // then derive both the flat leaf columns (body/colgroup/summary/sorter) and
54
50
  // the 2D header rows (thead multi-level rendering).
55
- const { wrapedColumns, headerRows } = useDeepCompareMemo(() => {
51
+ const { wrapedColumns, headerRows } = useMemo(() => {
56
52
  const base = (deepClone(childColumns || columns || []) ||
57
53
  []) as WrapedColumnProps[];
58
54
  const tree = injectSelectionExpand(base, rowSelection, expandable);
@@ -60,7 +56,7 @@ export default function useColumns({
60
56
  const wraped = handleColumns(leaves);
61
57
  const rows = parseHeaderRows(tree, wraped);
62
58
  return { wrapedColumns: wraped, headerRows: rows };
63
- }, [childColumns, columns, shouldRenderSelection, shouldRenderExpand]);
59
+ }, [childColumns, columns, rowSelection, expandable]);
64
60
 
65
61
  return {
66
62
  wrapedColumns,
@@ -5,13 +5,13 @@ import Head from './theader';
5
5
 
6
6
  export type {
7
7
  ColumnProps,
8
+ HeaderCell,
8
9
  PaginationType,
9
10
  RowSelectionType,
10
- TableProps,
11
- TableComponents,
12
11
  TableBodyComponents,
12
+ TableComponents,
13
+ TableProps,
13
14
  TableRowRendererProps,
14
- HeaderCell,
15
15
  onChangeParams,
16
16
  } from './interface';
17
17
 
@@ -92,13 +92,11 @@
92
92
  width: 100%;
93
93
 
94
94
  &-scroll-left @{pls}-cell-fixed-left-last {
95
- box-shadow: 6px 0 6px -4px
96
- var(--yee-table-fixed-left-after-bs-color);
95
+ box-shadow: 6px 0 6px -4px var(--yee-table-fixed-left-after-bs-color);
97
96
  }
98
97
 
99
98
  &-scroll-right @{pls}-cell-fixed-right-first {
100
- box-shadow: -6px 0 6px -4px
101
- var(--yee-table-fixed-right-after-bs-color);
99
+ box-shadow: -6px 0 6px -4px var(--yee-table-fixed-right-after-bs-color);
102
100
  }
103
101
  }
104
102
 
@@ -146,8 +146,7 @@ const Table = React.forwardRef<HTMLDivElement, TableProps>((baseprops, ref) => {
146
146
  const next = {
147
147
  left: hasHorizontalScroll && scrollContainer.scrollLeft > 1,
148
148
  right:
149
- hasHorizontalScroll &&
150
- scrollContainer.scrollLeft < maxScrollLeft - 1,
149
+ hasHorizontalScroll && scrollContainer.scrollLeft < maxScrollLeft - 1,
151
150
  };
152
151
 
153
152
  setHorizontalScroll((current) =>
@@ -312,8 +311,7 @@ const Table = React.forwardRef<HTMLDivElement, TableProps>((baseprops, ref) => {
312
311
  ref={contentWrapperRef}
313
312
  className={clsx(`${prefixCls}-content-wrapper`, {
314
313
  [`${prefixCls}-content-wrapper-scroll-left`]: horizontalScroll.left,
315
- [`${prefixCls}-content-wrapper-scroll-right`]:
316
- horizontalScroll.right,
314
+ [`${prefixCls}-content-wrapper-scroll-right`]: horizontalScroll.right,
317
315
  })}
318
316
  onScroll={updateHorizontalScroll}
319
317
  >
@@ -82,9 +82,7 @@ const TableRow: React.FC<TableRowProps> = (props) => {
82
82
 
83
83
  if (type === 'checkbox') {
84
84
  return (
85
- <Checkbox
86
- {...(commonProps as React.ComponentProps<typeof Checkbox>)}
87
- />
85
+ <Checkbox {...(commonProps as React.ComponentProps<typeof Checkbox>)} />
88
86
  );
89
87
  }
90
88
  return <Radio {...(commonProps as React.ComponentProps<typeof Radio>)} />;
@@ -13,16 +13,17 @@ export interface TableHeadProps {
13
13
  }
14
14
 
15
15
  const TableHead: React.FC<any> = (props) => {
16
- const { headerRows = [], onCheckAll, checkedAll, onHeaderRow, ...rest } =
17
- props;
16
+ const {
17
+ headerRows = [],
18
+ onCheckAll,
19
+ checkedAll,
20
+ onHeaderRow,
21
+ ...rest
22
+ } = props;
18
23
 
19
24
  const { prefixCls } = useContext(TableCtx);
20
25
 
21
- const renderCell = (
22
- cell: HeaderCell,
23
- rowIndex: number,
24
- colIndex: number,
25
- ) => {
26
+ const renderCell = (cell: HeaderCell, rowIndex: number, colIndex: number) => {
26
27
  const { column, colSpan, rowSpan } = cell;
27
28
  const { key, type, visible } = column;
28
29
  const cellKey =
@@ -73,9 +74,7 @@ const TableHead: React.FC<any> = (props) => {
73
74
  const rowProps = onHeaderRow ? onHeaderRow(rowColumns) : {};
74
75
  return (
75
76
  <tr {...rowProps} key={`thead-row-${rowIndex}`}>
76
- {row.map((cell, colIndex) =>
77
- renderCell(cell, rowIndex, colIndex),
78
- )}
77
+ {row.map((cell, colIndex) => renderCell(cell, rowIndex, colIndex))}
79
78
  </tr>
80
79
  );
81
80
  })}
@@ -46,7 +46,8 @@ export default () => {
46
46
  {
47
47
  target: () => targetRef.current,
48
48
  title: `placement: ${p}`,
49
- description: '气泡卡片相对目标元素的位置;靠近视口边缘时会自动翻转。',
49
+ description:
50
+ '气泡卡片相对目标元素的位置;靠近视口边缘时会自动翻转。',
50
51
  },
51
52
  ]}
52
53
  />
package/src/Tour/index.ts CHANGED
@@ -2,9 +2,9 @@ import InternalTour from './tour';
2
2
 
3
3
  export type {
4
4
  TourProps,
5
+ TourSemanticDOM,
5
6
  TourStep,
6
7
  TourTarget,
7
- TourSemanticDOM,
8
8
  } from './interface';
9
9
 
10
10
  export default InternalTour;
@@ -25,11 +25,7 @@
25
25
  }
26
26
 
27
27
  &-drag-over-inside {
28
- background: color-mix(
29
- in srgb,
30
- var(--yee-primary-color) 12%,
31
- transparent
32
- );
28
+ background: color-mix(in srgb, var(--yee-primary-color) 12%, transparent);
33
29
  }
34
30
 
35
31
  &-switcher {
package/src/Tree/tree.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import clsx from 'clsx';
2
+ import { AnimatePresence, motion } from 'motion/react';
2
3
  import React, {
3
4
  ChangeEvent,
4
5
  createContext,
@@ -7,7 +8,6 @@ import React, {
7
8
  useRef,
8
9
  useState,
9
10
  } from 'react';
10
- import { AnimatePresence, motion } from 'motion/react';
11
11
  import { GlobalContext } from '../Config-Provider';
12
12
  import useEvent from '../hooks/useEvent';
13
13
  import useMergedState from '../hooks/useMergedState';
@@ -228,9 +228,15 @@ const Tree = <T extends Record<string, unknown> = any>(
228
228
  // useStableUidArray ensures stable references to prevent infinite re-render loops.
229
229
 
230
230
  const stableExpandedValue = useStableUidArray(expandedKeys, flatItems);
231
- const stableExpandedDefault = useStableUidArray(defaultExpandedKeys, flatItems);
231
+ const stableExpandedDefault = useStableUidArray(
232
+ defaultExpandedKeys,
233
+ flatItems,
234
+ );
232
235
  const stableSelectedValue = useStableUidArray(selectedKeys, flatItems);
233
- const stableSelectedDefault = useStableUidArray(defaultSelectedKeys, flatItems);
236
+ const stableSelectedDefault = useStableUidArray(
237
+ defaultSelectedKeys,
238
+ flatItems,
239
+ );
234
240
  const stableCheckedValue = useStableUidArray(checkedKeys, flatItems);
235
241
  const stableCheckedDefault = useStableUidArray(defaultCheckedKeys, flatItems);
236
242
 
@@ -248,13 +254,10 @@ const Tree = <T extends Record<string, unknown> = any>(
248
254
  );
249
255
 
250
256
  // --- Selected ---
251
- const [selectedUidArray, setSelectedUidArray] = useMergedState<string[]>(
252
- [],
253
- {
254
- value: stableSelectedValue,
255
- defaultValue: stableSelectedDefault,
256
- },
257
- );
257
+ const [selectedUidArray, setSelectedUidArray] = useMergedState<string[]>([], {
258
+ value: stableSelectedValue,
259
+ defaultValue: stableSelectedDefault,
260
+ });
258
261
  const selectedUidSet = useMemo(
259
262
  () => arrayToSet(selectedUidArray),
260
263
  [selectedUidArray],
@@ -678,7 +681,9 @@ const Tree = <T extends Record<string, unknown> = any>(
678
681
  <AnimatePresence initial={false}>
679
682
  {segments.map((segment) => {
680
683
  if (segment.type === 'node') {
681
- return <TreeNodeComp node={segment.node} key={segment.node.uid} />;
684
+ return (
685
+ <TreeNodeComp node={segment.node} key={segment.node.uid} />
686
+ );
682
687
  }
683
688
  // Keep the wrapper mounted throughout native drag operations.
684
689
  // Replacing this tree after dragStart removes the browser's drag
@@ -114,7 +114,10 @@ export function moveTreeNode<T extends Record<string, unknown>>(
114
114
  if (!dragNode) return root;
115
115
 
116
116
  // Phase 2: insert per position.
117
- const insert = (nodes: T[], depth: number): { inserted: boolean; nodes: T[] } => {
117
+ const insert = (
118
+ nodes: T[],
119
+ depth: number,
120
+ ): { inserted: boolean; nodes: T[] } => {
118
121
  const next: T[] = [];
119
122
  let inserted = false;
120
123
  for (const n of nodes) {
@@ -7,9 +7,7 @@ export default function useEvent<T extends Function>(callback?: T): T {
7
7
 
8
8
  const memoFn = React.useCallback(
9
9
  (...args: unknown[]) =>
10
- (ref.current as ((...args: unknown[]) => unknown) | undefined)?.(
11
- ...args,
12
- ),
10
+ (ref.current as ((...args: unknown[]) => unknown) | undefined)?.(...args),
13
11
  [],
14
12
  ) as unknown as T;
15
13
 
@@ -7,7 +7,11 @@ import React, {
7
7
  useMemo,
8
8
  useState,
9
9
  } from 'react';
10
- import { DEFAULT_LOCALE, DEFAULT_LOCALE_CONFIG, LOCALE_CONFIGS } from './constants';
10
+ import {
11
+ DEFAULT_LOCALE,
12
+ DEFAULT_LOCALE_CONFIG,
13
+ LOCALE_CONFIGS,
14
+ } from './constants';
11
15
  import type { Locale, LocaleConfigInput, TFunction } from './interface';
12
16
  import defaultLocaleData from './lang/en_US';
13
17
  import { deepMerge, isValidLocale, translate } from './util';
@@ -220,4 +220,6 @@ export type DeepPartial<T> = T extends (...args: any[]) => any
220
220
  * so the provider knows which built-in pack to merge the overrides onto;
221
221
  * only the keys you specify are overridden, everything else is inherited.
222
222
  */
223
- export type LocaleConfigInput = string | (DeepPartial<Locale> & { locale: string });
223
+ export type LocaleConfigInput =
224
+ | string
225
+ | (DeepPartial<Locale> & { locale: string });
@@ -224,6 +224,8 @@
224
224
  /* --Dialog-- */
225
225
  --yee-dialog-z-index: var(--yee-z-index-overlay);
226
226
  --yee-dialog-mask-z-index: var(--yee-z-index-mask);
227
+ --yee-dialog-title-font-size: 18px;
228
+ --yee-dialog-title-font-weight: 600;
227
229
  --yee-dialog-content-wrapper-z-index: var(--yee-z-index-overlay);
228
230
  --yee-dialog-header-margin-bottom: 12px;
229
231
  --yee-dialog-content-margin-top: 10%;
@@ -1,8 +1,6 @@
1
1
  type AnyFn = (...args: any[]) => any;
2
2
 
3
- export type Debounced<T extends AnyFn> = ((
4
- ...args: Parameters<T>
5
- ) => void) & {
3
+ export type Debounced<T extends AnyFn> = ((...args: Parameters<T>) => void) & {
6
4
  /** Cancel any pending invocation. */
7
5
  cancel: () => void;
8
6
  };
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@ declare global {
4
4
  }
5
5
  }
6
6
 
7
- export const version = "0.8.1";
7
+ export const version = "0.8.2";
8
8
 
9
9
  if (typeof window !== 'undefined') {
10
10
  window.__yee_c_version__ = version;