2023-09-26 17:34:49 +08:00
|
|
|
import * as React from 'react';
|
|
|
|
|
2024-04-08 14:04:08 +08:00
|
|
|
import { ConfigContext } from '../../config-provider';
|
|
|
|
import type { RenderEmptyHandler } from '../../config-provider';
|
2023-09-26 17:34:49 +08:00
|
|
|
|
|
|
|
export default function useBase(
|
|
|
|
customizePrefixCls?: string,
|
|
|
|
direction?: 'ltr' | 'rtl',
|
|
|
|
): [
|
|
|
|
prefixCls: string,
|
|
|
|
cascaderPrefixCls: string,
|
|
|
|
direction?: 'ltr' | 'rtl',
|
|
|
|
renderEmpty?: RenderEmptyHandler,
|
|
|
|
] {
|
|
|
|
const { getPrefixCls, direction: rootDirection, renderEmpty } = React.useContext(ConfigContext);
|
|
|
|
|
|
|
|
const mergedDirection = direction || rootDirection;
|
|
|
|
|
|
|
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
|
|
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
|
|
|
|
|
|
return [prefixCls, cascaderPrefixCls, mergedDirection, renderEmpty];
|
|
|
|
}
|