diff --git a/.changeset/proud-turkeys-call.md b/.changeset/proud-turkeys-call.md new file mode 100644 index 000000000..768c3949d --- /dev/null +++ b/.changeset/proud-turkeys-call.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/cascader": minor +--- + +feat: add size api diff --git a/.changeset/spotty-tools-cross.md b/.changeset/spotty-tools-cross.md new file mode 100644 index 000000000..eecd2da55 --- /dev/null +++ b/.changeset/spotty-tools-cross.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +Cascader feat: add size api diff --git a/packages/ui/cascader/src/Cascader.tsx b/packages/ui/cascader/src/Cascader.tsx index 017d5c2ca..50983c4d5 100644 --- a/packages/ui/cascader/src/Cascader.tsx +++ b/packages/ui/cascader/src/Cascader.tsx @@ -1,5 +1,5 @@ import React, { forwardRef, useState, useMemo, useEffect } from 'react' -import type { HiBaseAppearanceEnum } from '@hi-ui/core' +import type { HiBaseAppearanceEnum, HiBaseSizeEnum } from '@hi-ui/core' import { cx, getPrefixCls } from '@hi-ui/classname' import { __DEV__ } from '@hi-ui/env' import { useUncontrolledToggle } from '@hi-ui/use-toggle' @@ -52,6 +52,7 @@ export const Cascader = forwardRef((props, data = NOOP_ARRAY, flattedSearchResult = true, visible, + size = 'md', onOpen, onClose, ...rest @@ -221,6 +222,7 @@ export const Cascader = forwardRef((props, onSearch={callAllFuncs(onSearchProp, onSearch)} trigger={ { + const [data] = React.useState([ + { + id: '手机', + title: '手机t', + children: [ + { + id: '小米', + title: '小米t', + children: [ + { + id: '小米3', + title: '小米3t', + }, + { + id: '小米4', + title: '小米4t', + }, + ], + }, + { + id: '红米', + title: '红米t', + children: [ + { + id: '红米3', + title: '红米3t', + }, + { + id: '红米4', + title: '红米4t', + }, + ], + }, + ], + }, + { + id: '电视', + title: '电视t', + children: [ + { + id: '小米电视4A', + title: '小米电视4At', + }, + { + id: '小米电视4C', + title: '小米电视4Ct', + }, + ], + }, + ]) + + return ( + <> +

Size

+
+

sm

+ { + console.log('onChange', ...args) + }} + > +

md

+ { + console.log('onChange', ...args) + }} + > +

lg

+ { + console.log('onChange', ...args) + }} + > +
+ + ) +}