File size: 763 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as React from 'react';

import { ConfigContext } from '../../config-provider';
import type { DirectionType, RenderEmptyHandler } from '../../config-provider';

function useBase(
  customizePrefixCls?: string,
  direction?: DirectionType,
): [
  prefixCls: string,
  cascaderPrefixCls: string,
  direction?: DirectionType,
  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];
}

export default useBase;