@rainbow-oh/yee-c 0.8.18 → 0.8.20

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 (91) hide show
  1. package/dist/cjs/Anchor/anchor.js +4 -1
  2. package/dist/cjs/Checkbox/checkbox-group.js +1 -1
  3. package/dist/cjs/Checkbox/checkbox.js +2 -1
  4. package/dist/cjs/Checkbox/style/index.less +3 -0
  5. package/dist/cjs/Form/Group.js +1 -3
  6. package/dist/cjs/Form/style/index.less +2 -0
  7. package/dist/cjs/Form/utils/validate.d.ts +1 -0
  8. package/dist/cjs/Form/utils/validate.js +3 -2
  9. package/dist/cjs/Progress/circle.js +46 -35
  10. package/dist/cjs/Progress/line.js +20 -11
  11. package/dist/cjs/Search/demo/basic.js +38 -3
  12. package/dist/cjs/Search/interface.d.ts +2 -2
  13. package/dist/cjs/Search/search.js +52 -32
  14. package/dist/cjs/Search/style/index.less +20 -3
  15. package/dist/cjs/Table/style/index.less +4 -2
  16. package/dist/cjs/Table/tbody/cell.js +2 -2
  17. package/dist/cjs/Transfer/interface.d.ts +0 -1
  18. package/dist/cjs/Transfer/style/index.less +4 -0
  19. package/dist/cjs/Transfer/transfer-list.js +1 -0
  20. package/dist/cjs/message/use-message.js +1 -3
  21. package/dist/cjs/notice/notice.js +1 -1
  22. package/dist/cjs/style/themes.css +1 -1
  23. package/dist/cjs/style/variables.css +1 -1
  24. package/dist/cjs/version.d.ts +1 -1
  25. package/dist/cjs/version.js +1 -1
  26. package/dist/esm/Checkbox/checkbox-group.js +1 -1
  27. package/dist/esm/Checkbox/checkbox.js +2 -1
  28. package/dist/esm/Checkbox/style/index.less +3 -0
  29. package/dist/esm/Form/Group.js +2 -2
  30. package/dist/esm/Form/style/index.less +2 -0
  31. package/dist/esm/Form/utils/validate.d.ts +1 -0
  32. package/dist/esm/Form/utils/validate.js +2 -2
  33. package/dist/esm/Search/demo/basic.js +61 -7
  34. package/dist/esm/Search/interface.d.ts +2 -2
  35. package/dist/esm/Search/search.js +22 -15
  36. package/dist/esm/Search/style/index.less +20 -3
  37. package/dist/esm/Table/style/index.less +4 -2
  38. package/dist/esm/Table/tbody/cell.js +2 -2
  39. package/dist/esm/Transfer/interface.d.ts +0 -1
  40. package/dist/esm/Transfer/style/index.less +4 -0
  41. package/dist/esm/Transfer/transfer-list.js +1 -0
  42. package/dist/esm/notice/notice.js +1 -1
  43. package/dist/esm/style/themes.css +1 -1
  44. package/dist/esm/style/variables.css +1 -1
  45. package/dist/esm/version.d.ts +1 -1
  46. package/dist/esm/version.js +1 -1
  47. package/dist/umd/yee-c.min.css +1 -1
  48. package/dist/umd/yee-c.min.js +1 -1
  49. package/package.json +1 -1
  50. package/src/Anchor/anchor.tsx +9 -5
  51. package/src/Checkbox/checkbox-group.tsx +1 -1
  52. package/src/Checkbox/checkbox.tsx +1 -0
  53. package/src/Checkbox/style/index.less +3 -0
  54. package/src/Form/Group.tsx +2 -4
  55. package/src/Form/style/index.less +2 -0
  56. package/src/Form/utils/validate.ts +7 -2
  57. package/src/Progress/circle.tsx +5 -1
  58. package/src/Progress/line.tsx +5 -1
  59. package/src/Progress/progress.tsx +5 -1
  60. package/src/Search/demo/basic.tsx +43 -7
  61. package/src/Search/index.en-US.md +1 -1
  62. package/src/Search/index.zh-CN.md +1 -1
  63. package/src/Search/interface.ts +2 -2
  64. package/src/Search/search.tsx +40 -23
  65. package/src/Search/style/index.less +20 -3
  66. package/src/Spin/indicator.tsx +1 -1
  67. package/src/Table/style/index.less +4 -2
  68. package/src/Table/tbody/cell.tsx +2 -2
  69. package/src/Transfer/interface.ts +0 -1
  70. package/src/Transfer/style/index.less +4 -0
  71. package/src/Transfer/transfer-list.tsx +1 -0
  72. package/src/Tree/interface.ts +6 -1
  73. package/src/Tree/tree-node.tsx +7 -6
  74. package/src/Tree/utils/tree-tools.ts +4 -1
  75. package/src/Trigger/interface.ts +2 -1
  76. package/src/message/demo/base.tsx +1 -1
  77. package/src/message/interface.ts +1 -5
  78. package/src/message/message.test.tsx +15 -5
  79. package/src/message/message.tsx +10 -4
  80. package/src/message/use-message.tsx +2 -8
  81. package/src/message/wrapper.tsx +1 -2
  82. package/src/notice/interface.ts +1 -5
  83. package/src/notice/notice.test.tsx +14 -6
  84. package/src/notice/notice.tsx +12 -6
  85. package/src/notice/wrapper.tsx +1 -2
  86. package/src/version.ts +1 -1
  87. package/dist/cjs/Search/style/index.d.ts +0 -1
  88. package/dist/cjs/Search/style/index.js +0 -2
  89. package/dist/esm/Search/style/index.d.ts +0 -1
  90. package/dist/esm/Search/style/index.js +0 -1
  91. package/src/Search/style/index.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-oh/yee-c",
3
- "version": "0.8.18",
3
+ "version": "0.8.20",
4
4
  "description": "yee basic components",
5
5
  "keywords": [
6
6
  "react",
@@ -78,9 +78,9 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
78
78
  const navigationTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
79
79
  null,
80
80
  );
81
- const navigationSettleTimeoutRef = useRef<
82
- ReturnType<typeof setTimeout> | null
83
- >(null);
81
+ const navigationSettleTimeoutRef = useRef<ReturnType<
82
+ typeof setTimeout
83
+ > | null>(null);
84
84
 
85
85
  useEffect(() => {
86
86
  activeKeyRef.current = mergedActiveKey;
@@ -361,7 +361,10 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
361
361
  'pointerdown',
362
362
  onUserInterrupt as EventListener,
363
363
  );
364
- container.removeEventListener('keydown', onUserInterrupt as EventListener);
364
+ container.removeEventListener(
365
+ 'keydown',
366
+ onUserInterrupt as EventListener,
367
+ );
365
368
  if (rafId !== null) {
366
369
  cancelAnimationFrame(rafId);
367
370
  }
@@ -419,7 +422,8 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
419
422
 
420
423
  // Handles instant scrolling and targets that are already in position.
421
424
  handleScroll();
422
- }, [
425
+ },
426
+ [
423
427
  startNavigationLock,
424
428
  commitActiveKey,
425
429
  scrollToAnchor,
@@ -76,7 +76,7 @@ const CheckboxGroup = (baseprops: CheckboxGroupProps) => {
76
76
  <Checkbox
77
77
  disabled={disabled}
78
78
  {...option}
79
- checked={mergedValue.includes(option.value)}
79
+ checked={mergedValue?.includes(option.value)}
80
80
  key={option.value || index}
81
81
  >
82
82
  {option.label}
@@ -81,6 +81,7 @@ const Checkbox = (baseprops: CheckboxProps) => {
81
81
  <span
82
82
  className={clsx(`${prefixCls}-label`, classNames?.label)}
83
83
  style={styles?.label}
84
+ title={typeof children === 'string' ? children : undefined}
84
85
  >
85
86
  {children}
86
87
  </span>
@@ -93,6 +93,9 @@
93
93
  &-label {
94
94
  padding: var(--yee-checkbox-label-padding);
95
95
  user-select: none;
96
+ white-space: nowrap;
97
+ text-overflow: ellipsis;
98
+ overflow: hidden;
96
99
  }
97
100
 
98
101
  &-indeterminate {
@@ -12,7 +12,7 @@ import Grid from '../Grid';
12
12
  import FieldContext from './FieldContext';
13
13
  import FormContext from './FormContext';
14
14
  import type { FieldGroupProps, NamePath, ValidateMessage } from './interface';
15
- import { runValidator } from './utils/validate';
15
+ import { isEmpty, runValidator } from './utils/validate';
16
16
 
17
17
  const Group: React.FC<FieldGroupProps> = (props) => {
18
18
  const { label, required, rules, cols, children, style, className } = props;
@@ -54,9 +54,7 @@ const Group: React.FC<FieldGroupProps> = (props) => {
54
54
 
55
55
  // Required validation: error if any child field is empty
56
56
  if (required) {
57
- const hasEmpty = childNames.some(
58
- (name) => !values[name] && values[name] !== 0,
59
- );
57
+ const hasEmpty = childNames.some((name) => isEmpty(values[name]));
60
58
  if (hasEmpty) {
61
59
  errors.push({
62
60
  name: childNames,
@@ -88,12 +88,14 @@
88
88
  --yee-input-border-color: var(--yee-error-color);
89
89
  --yee-input-hover-border-color: var(--yee-error-color-hover);
90
90
  --yee-input-focus-bs-color: var(--yee-error-color-border);
91
+ --yee-checkbox-border-color: var(--yee-error-color);
91
92
  }
92
93
 
93
94
  &&-warning {
94
95
  --yee-input-border-color: var(--yee-warning-color);
95
96
  --yee-input-hover-border-color: var(--yee-warning-color-hover);
96
97
  --yee-input-focus-bs-color: var(--yee-warning-color-border);
98
+ --yee-checkbox-border-color: var(--yee-warning-color);
97
99
  }
98
100
  }
99
101
  }
@@ -1,7 +1,12 @@
1
1
  import type { Rule } from '../interface';
2
2
 
3
- function isEmpty(v: unknown) {
4
- return v === undefined || v === null || v === '' ? true : false;
3
+ export function isEmpty(value: unknown) {
4
+ return (
5
+ value === undefined ||
6
+ value === null ||
7
+ value === '' ||
8
+ (Array.isArray(value) && value.length === 0)
9
+ );
5
10
  }
6
11
 
7
12
  function verifyRuleOfMin(min: number, value: unknown) {
@@ -111,7 +111,11 @@ const Circle = React.forwardRef<HTMLDivElement, CircleProps>((props, ref) => {
111
111
  style={{ width, height: width }}
112
112
  ref={ref}
113
113
  >
114
- <svg className={`${prefixCls}-circle`} viewBox="0 0 120 120" aria-hidden="true">
114
+ <svg
115
+ className={`${prefixCls}-circle`}
116
+ viewBox="0 0 120 120"
117
+ aria-hidden="true"
118
+ >
115
119
  <circle
116
120
  className={`${prefixCls}-circle-trail`}
117
121
  cx="60"
@@ -36,7 +36,11 @@ const Line = React.forwardRef<HTMLDivElement, LineProps>((props, ref) => {
36
36
 
37
37
  return (
38
38
  <div className={`${prefixCls}-outer`} ref={ref}>
39
- <div className={`${prefixCls}-inner`} style={{ height: strokeWidth }} aria-hidden="true">
39
+ <div
40
+ className={`${prefixCls}-inner`}
41
+ style={{ height: strokeWidth }}
42
+ aria-hidden="true"
43
+ >
40
44
  <div
41
45
  className={`${prefixCls}-bg`}
42
46
  style={{ width: percent + '%', ...progressColor }}
@@ -107,7 +107,11 @@ const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(
107
107
  aria-valuemin={0}
108
108
  aria-valuemax={100}
109
109
  aria-valuetext={`${percent}%`}
110
- aria-label={status === 'error' ? `Progress: ${percent}%, error` : `Progress: ${percent}%`}
110
+ aria-label={
111
+ status === 'error'
112
+ ? `Progress: ${percent}%, error`
113
+ : `Progress: ${percent}%`
114
+ }
111
115
  ref={ref}
112
116
  {...dataAttrs}
113
117
  >
@@ -1,14 +1,50 @@
1
- import React from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import Search from '../index';
3
-
3
+ import type { SearchOption } from '../interface';
4
+ const people: SearchOption[] = [
5
+ { key: 'ada', value: 'ada', label: 'Ada Lovelace' },
6
+ { key: 'grace', value: 'grace', label: 'Grace Hopper' },
7
+ { key: 'alan', value: 'alan', label: 'Alan Turing' },
8
+ { key: 'margaret', value: 'margaret', label: 'Margaret Hamilton' },
9
+ ];
4
10
  export default () => {
5
- const onSearch = (value: string) => {
6
- console.log('search value:', value);
11
+ const [keyword, setKeyword] = useState('');
12
+ const [selected, setSelected] = useState<SearchOption | null>(null);
13
+ const results = useMemo(() => {
14
+ const normalizedKeyword = keyword.trim().toLowerCase();
15
+ const matched = people.filter((person) =>
16
+ String(person.label).toLowerCase().includes(normalizedKeyword),
17
+ );
18
+ return matched.length > 0
19
+ ? matched
20
+ : [
21
+ {
22
+ key: 'empty',
23
+ value: 'empty',
24
+ label: 'No results found',
25
+ disabled: true,
26
+ },
27
+ ];
28
+ }, [keyword]);
29
+ const handleSelect = (option: SearchOption | null) => {
30
+ setSelected(option);
31
+ if (option) {
32
+ setKeyword(String(option.label));
33
+ }
7
34
  };
8
-
9
35
  return (
10
- <div style={{ width: 300 }}>
11
- <Search placeholder="input search text" onSearch={onSearch} />
36
+ <div style={{ width: 320 }}>
37
+ <Search
38
+ allowClear
39
+ value={keyword}
40
+ options={results}
41
+ placeholder="Search people"
42
+ onSearch={setKeyword}
43
+ onChange={handleSelect}
44
+ />
45
+ <div style={{ marginTop: 12 }}>
46
+ Selected: {selected ? String(selected.label) : 'None'}
47
+ </div>
12
48
  </div>
13
49
  );
14
50
  };
@@ -14,7 +14,7 @@ A search input component for querying data.
14
14
 
15
15
  ## Code Demo
16
16
 
17
- <code src="./demo/basic.tsx" title="Basic" description="Basic usage of Search"></code>
17
+ <code src="./demo/basic.tsx" title="Basic" description="Filter results as you type and select from the dropdown"></code>
18
18
  <code src="./demo/size.tsx" title="Size" description="Different sizes of Search"></code>
19
19
  <code src="./demo/allowClear.tsx" title="Allow Clear" description="Search with clear icon"></code>
20
20
  <code src="./demo/borderless.tsx" title="Borderless" description="Search without border"></code>
@@ -14,7 +14,7 @@ toc: 'content'
14
14
 
15
15
  ## 代码演示
16
16
 
17
- <code src="./demo/basic.tsx" title="基础用法" description="搜索框的基础用法"></code>
17
+ <code src="./demo/basic.tsx" title="基础用法" description="输入关键词筛选结果,并从下拉列表中选择"></code>
18
18
  <code src="./demo/size.tsx" title="尺寸" description="不同尺寸的搜索框"></code>
19
19
  <code src="./demo/allowClear.tsx" title="可清空" description="带清空图标的搜索框"></code>
20
20
  <code src="./demo/borderless.tsx" title="无边框" description="无边框的搜索框"></code>
@@ -68,7 +68,7 @@ export interface SearchProps
68
68
  /**
69
69
  * @description Suffix content
70
70
  */
71
- suffix?: React.ReactNode;
71
+ suffix?: React.ReactNode | false;
72
72
 
73
73
  /**
74
74
  * @description Whether disabled
@@ -96,7 +96,7 @@ export interface SearchProps
96
96
  * @description trigger search event
97
97
  * @default 'typing'
98
98
  */
99
- searchOnAction?: 'typing' | 'enter';
99
+ searchOnAction?: 'typing' | 'enter' | 'button';
100
100
 
101
101
  /**
102
102
  * @description suggest data
@@ -1,5 +1,5 @@
1
1
  import clsx from 'clsx';
2
- import { X } from 'lucide-react';
2
+ import { Search as SearchIcon, X } from 'lucide-react';
3
3
  import React, {
4
4
  startTransition,
5
5
  useContext,
@@ -86,25 +86,12 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
86
86
  }
87
87
  }, [open]);
88
88
 
89
- const handleSearch = (
90
- e?:
91
- | React.ChangeEvent<HTMLInputElement>
92
- | React.MouseEvent<HTMLSpanElement>
93
- | React.KeyboardEvent<HTMLInputElement>,
94
- ) => {
95
- if (disabled) return;
96
- onSearch?.(searchValue);
97
- if (e?.type === 'click') {
98
- (e.target as HTMLElement).blur?.();
99
- }
100
- };
101
-
102
89
  const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
103
90
  const newValue = e.target.value;
104
91
  setSearchValue(newValue);
105
92
  startTransition(() => {
106
93
  if (searchOnAction === 'typing') {
107
- handleSearch(e);
94
+ onSearch?.(newValue);
108
95
  }
109
96
  });
110
97
  };
@@ -116,10 +103,28 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
116
103
  onSearch?.('');
117
104
  };
118
105
 
106
+ const handleSearchClick = (e: React.MouseEvent<HTMLSpanElement>) => {
107
+ e.stopPropagation();
108
+ if (searchOnAction === 'button') {
109
+ onSearch?.(searchValue);
110
+ }
111
+ };
112
+
113
+ const renderSearchIcon = () => {
114
+ if (suffix === false) return null;
115
+ return (
116
+ <span
117
+ className={`${prefixCls}-search-icon`}
118
+ onClick={handleSearchClick}
119
+ >
120
+ {suffix || <SearchIcon size={14} />}
121
+ </span>
122
+ );
123
+ };
124
+
119
125
  const renderSuffix = () => {
120
- const hasValue = !!searchValue;
121
- const showClearIcon = allowClear && hasValue && !disabled;
122
- const showSuffix = suffix || showClearIcon;
126
+ const showClearIcon = allowClear && !disabled && !rest.readOnly;
127
+ const showSuffix = suffix !== false || suffix !== null || showClearIcon;
123
128
 
124
129
  if (!showSuffix) {
125
130
  return null;
@@ -138,14 +143,16 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
138
143
  onKeyDown={(e) => {
139
144
  if (e.key === 'Enter' || e.key === ' ') {
140
145
  e.preventDefault();
141
- handleClear(e as unknown as React.MouseEvent<HTMLSpanElement>);
146
+ handleClear(
147
+ e as unknown as React.MouseEvent<HTMLSpanElement>,
148
+ );
142
149
  }
143
150
  }}
144
151
  >
145
152
  <X size={14} aria-hidden="true" />
146
153
  </span>
147
154
  )}
148
- {suffix}
155
+ {renderSearchIcon()}
149
156
  </div>
150
157
  );
151
158
  };
@@ -177,6 +184,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
177
184
  prefixCls,
178
185
  {
179
186
  [`${prefixCls}-disabled`]: disabled,
187
+ [`${prefixCls}-with-clear`]: allowClear && searchValue,
180
188
  [`${prefixCls}-borderless`]: !bordered,
181
189
  [`${prefixCls}-small`]: size === 'small',
182
190
  [`${prefixCls}-large`]: size === 'large',
@@ -188,7 +196,12 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
188
196
  const hasPopup = Array.isArray(options) || Array.isArray(suggestions);
189
197
 
190
198
  const popup = (
191
- <div className={`${prefixCls}-popup`} tabIndex={0} id={listboxId} role="listbox">
199
+ <div
200
+ className={`${prefixCls}-popup`}
201
+ tabIndex={0}
202
+ id={listboxId}
203
+ role="listbox"
204
+ >
192
205
  {Array.isArray(options) ? (
193
206
  <List
194
207
  focusedKey={focusedKey}
@@ -208,7 +221,7 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
208
221
  );
209
222
 
210
223
  return (
211
- <Trigger popup={popup} open={open} onOpenChange={setOpen}>
224
+ <Trigger popup={popup} open={open} stretch="width" onOpenChange={setOpen}>
212
225
  <div
213
226
  className={getRootClassName()}
214
227
  style={style}
@@ -238,7 +251,11 @@ const Search = React.forwardRef<HTMLInputElement, SearchProps>(
238
251
  : undefined
239
252
  }
240
253
  />
241
- {loading ? <Spin variant="ring" size="small" aria-label="Loading" /> : renderSuffix()}
254
+ {loading ? (
255
+ <Spin variant="ring" size="small" aria-label="Loading" />
256
+ ) : (
257
+ renderSuffix()
258
+ )}
242
259
  </div>
243
260
  </Trigger>
244
261
  );
@@ -1,8 +1,8 @@
1
1
  // @import '../../style/index.less';
2
2
 
3
- @search-prefix-cls: ~'yee-search';
3
+ @cls: ~'yee-search';
4
4
 
5
- .@{search-prefix-cls} {
5
+ .@{cls} {
6
6
  position: relative;
7
7
  display: inline-flex;
8
8
  align-items: center;
@@ -69,9 +69,10 @@
69
69
  border: none;
70
70
  outline: none;
71
71
  transition: all 0.2s;
72
+ line-height: var(--yee-input-line-height);
72
73
 
73
74
  &::placeholder {
74
- color: var(--yee-text-color-placeholder);
75
+ color: var(--yee-placeholder-color);
75
76
  }
76
77
 
77
78
  &-disabled {
@@ -99,7 +100,17 @@
99
100
  color: var(--yee-input-fix-icon-color);
100
101
  }
101
102
 
103
+ &-search-icon {
104
+ display: inline-flex;
105
+ }
106
+
102
107
  &-clear-icon {
108
+ display: inline-flex;
109
+ padding: var(--yee-input-clear-padding);
110
+ color: var(--yee-input-clear-color);
111
+ background-color: var(--yee-input-clear-bg-color);
112
+ border-radius: 50%;
113
+ visibility: hidden;
103
114
  cursor: pointer;
104
115
  transition: color 0.2s;
105
116
 
@@ -108,6 +119,12 @@
108
119
  }
109
120
  }
110
121
 
122
+ &&-with-clear:not(.@{cls}-disabled):hover {
123
+ .@{cls}-clear-icon {
124
+ visibility: visible;
125
+ }
126
+ }
127
+
111
128
  &-button {
112
129
  display: flex;
113
130
  align-items: center;
@@ -60,7 +60,7 @@ const SpokesSpinner: React.FC<SpinProps> = (props) => {
60
60
  styles,
61
61
  width,
62
62
  height,
63
- color
63
+ color,
64
64
  } = props;
65
65
 
66
66
  const containerSize = sizeMap[size];
@@ -97,7 +97,8 @@
97
97
  width: 15px;
98
98
  right: -15px;
99
99
  top: 0;
100
- box-shadow: inset 4px 0 8px -4px var(--yee-table-fixed-left-after-bs-color);
100
+ box-shadow: inset 4px 0 8px -4px
101
+ var(--yee-table-fixed-left-after-bs-color);
101
102
  }
102
103
  }
103
104
 
@@ -111,7 +112,8 @@
111
112
  width: 15px;
112
113
  left: -15px;
113
114
  top: 0;
114
- box-shadow: inset -4px 0 8px -4px var(--yee-table-fixed-right-after-bs-color);
115
+ box-shadow: inset -4px 0 8px -4px
116
+ var(--yee-table-fixed-right-after-bs-color);
115
117
  }
116
118
  }
117
119
  }
@@ -66,13 +66,13 @@ const TableCell: React.FC<BodyCellProps> = (props) => {
66
66
  className,
67
67
  );
68
68
 
69
- const styles = { ...style, width, maxWidth: width, textAlign: align };
69
+ const _style = { ...style, width, maxWidth: width, textAlign: align };
70
70
  const _title = typeof title === 'string' ? title : undefined;
71
71
 
72
72
  return {
73
73
  ...cellProperty,
74
74
  className: cls,
75
- style: styles,
75
+ style: _style,
76
76
  title: _title,
77
77
  };
78
78
  };
@@ -124,7 +124,6 @@ export interface TransferListProps {
124
124
  oneWay?: boolean;
125
125
  pagination?: Omit<PaginationProps, 'total'> & { total?: number };
126
126
  draggable?: boolean;
127
- targetMinCountLimit?: number;
128
127
  onDrop?: (dropObj: Record<string, any>, dataSource: DataSource[]) => void;
129
128
  onDelete?: (key: string | number) => void;
130
129
  onItemSelect: (keys: Array<string | number>) => void;
@@ -66,6 +66,10 @@
66
66
  line-height: var(--yee-transfer-list-item-height, 32px);
67
67
  padding: var(--yee-transfer-list-item-padding, 0 11px);
68
68
 
69
+ &-checkbox {
70
+ width: 100%;
71
+ }
72
+
69
73
  &:hover:not(.yee-one-way):not(.disabled) {
70
74
  color: var(--yee-transfer-list-content-item-hover-color);
71
75
  background-color: var(--yee-transfer-list-content-item-hover-bg-color);
@@ -199,6 +199,7 @@ const TransferList: React.FC<TransferListProps> = (props) => {
199
199
  {checkboxOptions.map((option, index) => (
200
200
  <li className={`${prefixCls}-list-item`} key={option.value || index}>
201
201
  <Checkbox
202
+ className={`${prefixCls}-list-item-checkbox`}
202
203
  value={option.value}
203
204
  disabled={option.disabled || disabled}
204
205
  checked={checkedKeys.includes(option.value)}
@@ -180,7 +180,12 @@ export interface TreeProps<T> extends DataAttributeProps {
180
180
  /**
181
181
  * Customize node key, title, children field names
182
182
  */
183
- fieldNames?: { key?: keyof T; label?: keyof T; children?: keyof T; extra?: keyof T };
183
+ fieldNames?: {
184
+ key?: keyof T;
185
+ label?: keyof T;
186
+ children?: keyof T;
187
+ extra?: keyof T;
188
+ };
184
189
  /**
185
190
  * Asynchronous data loading
186
191
  */
@@ -111,9 +111,12 @@ const Node = <T extends Record<string, unknown> = any>(
111
111
  const content = labelRender ? labelRender(node) : label;
112
112
 
113
113
  // extra: appended after the label content (only when labelRender is NOT used)
114
- const _extra = !labelRender && extra
115
- ? (typeof extra === 'function' ? extra(original) : extra)
116
- : null;
114
+ const _extra =
115
+ !labelRender && extra
116
+ ? typeof extra === 'function'
117
+ ? extra(original)
118
+ : extra
119
+ : null;
117
120
 
118
121
  return (
119
122
  <Button
@@ -127,9 +130,7 @@ const Node = <T extends Record<string, unknown> = any>(
127
130
  onClick={disabled ? undefined : () => onSelect(uid)}
128
131
  >
129
132
  {content}
130
- {_extra && (
131
- <span className={`${prefixCls}-node-extra`}>{_extra}</span>
132
- )}
133
+ {_extra && <span className={`${prefixCls}-node-extra`}>{_extra}</span>}
133
134
  </Button>
134
135
  );
135
136
  };
@@ -229,7 +229,10 @@ export function tree2array<T extends Record<string, unknown>>(
229
229
  key: rawKey,
230
230
  label: _label as string,
231
231
  title: node.title as string | undefined,
232
- extra: _extra as React.ReactNode | ((node: T) => React.ReactNode) | undefined,
232
+ extra: _extra as
233
+ | React.ReactNode
234
+ | ((node: T) => React.ReactNode)
235
+ | undefined,
233
236
  path,
234
237
  pUid,
235
238
  depth,
@@ -32,7 +32,8 @@ export type Point =
32
32
  | 'cl'
33
33
  | 'cr';
34
34
 
35
- export interface TriggerProps extends Omit<RcTriggerProps, 'children'>, DataAttributeProps {
35
+ export interface TriggerProps
36
+ extends Omit<RcTriggerProps, 'children'>, DataAttributeProps {
36
37
  /**
37
38
  * Custom class name prefix
38
39
  */
@@ -6,7 +6,7 @@ const BaseDemo = () => {
6
6
  const showMessage = (type: string) => {
7
7
  switch (type) {
8
8
  case 'info':
9
- messageApi.open({content: 'This is an info message', duration: 0});
9
+ messageApi.open({ content: 'This is an info message', duration: 0 });
10
10
  break;
11
11
  case 'success':
12
12
  message.success('This is a success message');
@@ -1,9 +1,5 @@
1
1
  export type MessageConfig = {
2
- [dataAttribute: `data-${string}`]:
3
- | string
4
- | number
5
- | boolean
6
- | undefined;
2
+ [dataAttribute: `data-${string}`]: string | number | boolean | undefined;
7
3
  /**
8
4
  * Custom prefix class name
9
5
  */
@@ -1,6 +1,12 @@
1
1
  // @vitest-environment jsdom
2
2
 
3
- import { act, cleanup, render, renderHook, screen } from '@testing-library/react';
3
+ import {
4
+ act,
5
+ cleanup,
6
+ render,
7
+ renderHook,
8
+ screen,
9
+ } from '@testing-library/react';
4
10
  import React from 'react';
5
11
  import { renderToString } from 'react-dom/server';
6
12
  import { afterEach, describe, expect, it, vi } from 'vitest';
@@ -227,7 +233,11 @@ describe('message', () => {
227
233
 
228
234
  act(() => {
229
235
  currentApi.info({ content: 'first', duration: 0, onClose: firstOnClose });
230
- currentApi.info({ content: 'second', duration: 0, onClose: secondOnClose });
236
+ currentApi.info({
237
+ content: 'second',
238
+ duration: 0,
239
+ onClose: secondOnClose,
240
+ });
231
241
  currentApi.clear();
232
242
  });
233
243
 
@@ -276,8 +286,8 @@ describe('message', () => {
276
286
  expect(element?.getAttribute('role')).toBe('alert');
277
287
  expect(element?.getAttribute('aria-live')).toBe('assertive');
278
288
  expect(element?.querySelector('.yee-message-content')?.tagName).toBe('DIV');
279
- expect(element?.querySelector('.yee-message-icon')?.getAttribute('aria-hidden')).toBe(
280
- 'true',
281
- );
289
+ expect(
290
+ element?.querySelector('.yee-message-icon')?.getAttribute('aria-hidden'),
291
+ ).toBe('true');
282
292
  });
283
293
  });