ant-design/components/cascader/hooks/useBase.ts
二货爱吃白萝卜 7e692ad585
feat: Cascader.Panel support (#45089)
* chore: init

* chore: panel style

* docs: update demo

* chore: fill style

* test: update snapshot

* docs: update demo

* chore: push

* docs: update desc

* chore: fix icons

* chore: use shared hooks

* test: update snapshot

* chore: fix lint
2023-09-26 17:34:49 +08:00

23 lines
698 B
TypeScript

import * as React from 'react';
import { ConfigContext, type RenderEmptyHandler } from '../../config-provider';
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];
}