@rc-component/select 1.0.2 → 1.0.3
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.
- package/es/OptionList.js +4 -4
- package/es/Select.d.ts +3 -2
- package/es/SelectContext.d.ts +7 -3
- package/lib/OptionList.js +4 -4
- package/lib/Select.d.ts +3 -2
- package/lib/SelectContext.d.ts +7 -3
- package/package.json +1 -1
package/es/OptionList.js
CHANGED
|
@@ -293,8 +293,8 @@ const OptionList = (_, ref) => {
|
|
|
293
293
|
direction: direction,
|
|
294
294
|
innerProps: virtual ? null : a11yProps,
|
|
295
295
|
showScrollBar: showScrollBar,
|
|
296
|
-
className: contextClassNames?.list,
|
|
297
|
-
style: contextStyles?.list
|
|
296
|
+
className: contextClassNames?.popup?.list,
|
|
297
|
+
style: contextStyles?.popup?.list
|
|
298
298
|
}, (item, itemIndex) => {
|
|
299
299
|
const {
|
|
300
300
|
group,
|
|
@@ -329,7 +329,7 @@ const OptionList = (_, ref) => {
|
|
|
329
329
|
const selected = isSelected(value);
|
|
330
330
|
const mergedDisabled = disabled || !selected && overMaxCount;
|
|
331
331
|
const optionPrefixCls = `${itemPrefixCls}-option`;
|
|
332
|
-
const optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, contextClassNames?.listItem, {
|
|
332
|
+
const optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, contextClassNames?.popup?.listItem, {
|
|
333
333
|
[`${optionPrefixCls}-grouped`]: groupOption,
|
|
334
334
|
[`${optionPrefixCls}-active`]: activeIndex === itemIndex && !mergedDisabled,
|
|
335
335
|
[`${optionPrefixCls}-disabled`]: mergedDisabled,
|
|
@@ -361,7 +361,7 @@ const OptionList = (_, ref) => {
|
|
|
361
361
|
}
|
|
362
362
|
},
|
|
363
363
|
style: {
|
|
364
|
-
...contextStyles?.listItem,
|
|
364
|
+
...contextStyles?.popup?.listItem,
|
|
365
365
|
...style
|
|
366
366
|
}
|
|
367
367
|
}), /*#__PURE__*/React.createElement("div", {
|
package/es/Select.d.ts
CHANGED
|
@@ -65,7 +65,8 @@ export interface DefaultOptionType extends BaseOptionType {
|
|
|
65
65
|
}
|
|
66
66
|
export type SelectHandler<ValueType, OptionType extends BaseOptionType = DefaultOptionType> = (value: ValueType, option: OptionType) => void;
|
|
67
67
|
type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
68
|
-
export type SemanticName = BaseSelectSemanticName
|
|
68
|
+
export type SemanticName = BaseSelectSemanticName;
|
|
69
|
+
export type PopupSemantic = 'listItem' | 'list';
|
|
69
70
|
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> extends BaseSelectPropsWithoutPrivate {
|
|
70
71
|
prefixCls?: string;
|
|
71
72
|
id?: string;
|
|
@@ -108,7 +109,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
108
109
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
109
110
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
110
111
|
}
|
|
111
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
112
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
112
113
|
children?: React.ReactNode;
|
|
113
114
|
} & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
115
|
Option: typeof Option;
|
package/es/SelectContext.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { RawValueType, RenderNode } from './BaseSelect';
|
|
3
|
-
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName } from './Select';
|
|
3
|
+
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName, PopupSemantic } from './Select';
|
|
4
4
|
import type { FlattenOptionData } from './interface';
|
|
5
5
|
/**
|
|
6
6
|
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
7
7
|
*/
|
|
8
8
|
export interface SelectContextProps {
|
|
9
|
-
classNames?: Partial<Record<SemanticName, string
|
|
10
|
-
|
|
9
|
+
classNames?: Partial<Record<SemanticName, string>> & {
|
|
10
|
+
popup?: Partial<Record<PopupSemantic, string>>;
|
|
11
|
+
};
|
|
12
|
+
styles?: Partial<Record<SemanticName, React.CSSProperties>> & {
|
|
13
|
+
popup?: Partial<Record<PopupSemantic, React.CSSProperties>>;
|
|
14
|
+
};
|
|
11
15
|
options: BaseOptionType[];
|
|
12
16
|
optionRender?: SelectProps['optionRender'];
|
|
13
17
|
flattenOptions: FlattenOptionData<BaseOptionType>[];
|
package/lib/OptionList.js
CHANGED
|
@@ -301,8 +301,8 @@ const OptionList = (_, ref) => {
|
|
|
301
301
|
direction: direction,
|
|
302
302
|
innerProps: virtual ? null : a11yProps,
|
|
303
303
|
showScrollBar: showScrollBar,
|
|
304
|
-
className: contextClassNames?.list,
|
|
305
|
-
style: contextStyles?.list
|
|
304
|
+
className: contextClassNames?.popup?.list,
|
|
305
|
+
style: contextStyles?.popup?.list
|
|
306
306
|
}, (item, itemIndex) => {
|
|
307
307
|
const {
|
|
308
308
|
group,
|
|
@@ -337,7 +337,7 @@ const OptionList = (_, ref) => {
|
|
|
337
337
|
const selected = isSelected(value);
|
|
338
338
|
const mergedDisabled = disabled || !selected && overMaxCount;
|
|
339
339
|
const optionPrefixCls = `${itemPrefixCls}-option`;
|
|
340
|
-
const optionClassName = (0, _classnames.default)(itemPrefixCls, optionPrefixCls, className, contextClassNames?.listItem, {
|
|
340
|
+
const optionClassName = (0, _classnames.default)(itemPrefixCls, optionPrefixCls, className, contextClassNames?.popup?.listItem, {
|
|
341
341
|
[`${optionPrefixCls}-grouped`]: groupOption,
|
|
342
342
|
[`${optionPrefixCls}-active`]: activeIndex === itemIndex && !mergedDisabled,
|
|
343
343
|
[`${optionPrefixCls}-disabled`]: mergedDisabled,
|
|
@@ -369,7 +369,7 @@ const OptionList = (_, ref) => {
|
|
|
369
369
|
}
|
|
370
370
|
},
|
|
371
371
|
style: {
|
|
372
|
-
...contextStyles?.listItem,
|
|
372
|
+
...contextStyles?.popup?.listItem,
|
|
373
373
|
...style
|
|
374
374
|
}
|
|
375
375
|
}), /*#__PURE__*/React.createElement("div", {
|
package/lib/Select.d.ts
CHANGED
|
@@ -65,7 +65,8 @@ export interface DefaultOptionType extends BaseOptionType {
|
|
|
65
65
|
}
|
|
66
66
|
export type SelectHandler<ValueType, OptionType extends BaseOptionType = DefaultOptionType> = (value: ValueType, option: OptionType) => void;
|
|
67
67
|
type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
68
|
-
export type SemanticName = BaseSelectSemanticName
|
|
68
|
+
export type SemanticName = BaseSelectSemanticName;
|
|
69
|
+
export type PopupSemantic = 'listItem' | 'list';
|
|
69
70
|
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> extends BaseSelectPropsWithoutPrivate {
|
|
70
71
|
prefixCls?: string;
|
|
71
72
|
id?: string;
|
|
@@ -108,7 +109,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
108
109
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
109
110
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
110
111
|
}
|
|
111
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
112
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
112
113
|
children?: React.ReactNode;
|
|
113
114
|
} & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
115
|
Option: typeof Option;
|
package/lib/SelectContext.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { RawValueType, RenderNode } from './BaseSelect';
|
|
3
|
-
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName } from './Select';
|
|
3
|
+
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName, PopupSemantic } from './Select';
|
|
4
4
|
import type { FlattenOptionData } from './interface';
|
|
5
5
|
/**
|
|
6
6
|
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
7
7
|
*/
|
|
8
8
|
export interface SelectContextProps {
|
|
9
|
-
classNames?: Partial<Record<SemanticName, string
|
|
10
|
-
|
|
9
|
+
classNames?: Partial<Record<SemanticName, string>> & {
|
|
10
|
+
popup?: Partial<Record<PopupSemantic, string>>;
|
|
11
|
+
};
|
|
12
|
+
styles?: Partial<Record<SemanticName, React.CSSProperties>> & {
|
|
13
|
+
popup?: Partial<Record<PopupSemantic, React.CSSProperties>>;
|
|
14
|
+
};
|
|
11
15
|
options: BaseOptionType[];
|
|
12
16
|
optionRender?: SelectProps['optionRender'];
|
|
13
17
|
flattenOptions: FlattenOptionData<BaseOptionType>[];
|