@bioturing/components 0.25.0 → 0.27.0

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.
Files changed (48) hide show
  1. package/dist/components/checkbox/component.js +12 -4
  2. package/dist/components/checkbox/component.js.map +1 -1
  3. package/dist/components/checkbox/style.css +1 -1
  4. package/dist/components/choice-list/component.js +24 -21
  5. package/dist/components/choice-list/component.js.map +1 -1
  6. package/dist/components/cmdk/index.js.map +1 -1
  7. package/dist/components/dropdown-menu/component.js +16 -15
  8. package/dist/components/dropdown-menu/component.js.map +1 -1
  9. package/dist/components/form/item.js +31 -28
  10. package/dist/components/form/item.js.map +1 -1
  11. package/dist/components/form/style.css +1 -1
  12. package/dist/components/popup-panel/component.js +142 -164
  13. package/dist/components/popup-panel/component.js.map +1 -1
  14. package/dist/components/popup-panel/style.css +1 -1
  15. package/dist/components/resizable/component.js +171 -0
  16. package/dist/components/resizable/component.js.map +1 -0
  17. package/dist/components/resizable/style.css +1 -0
  18. package/dist/components/segmented/component.js +3 -3
  19. package/dist/components/segmented/component.js.map +1 -1
  20. package/dist/components/spin/component.js +9 -8
  21. package/dist/components/spin/component.js.map +1 -1
  22. package/dist/components/splitter/component.js +7 -36
  23. package/dist/components/splitter/component.js.map +1 -1
  24. package/dist/components/splitter/context.js +6 -0
  25. package/dist/components/splitter/context.js.map +1 -0
  26. package/dist/components/splitter/splitter-panel.js +35 -0
  27. package/dist/components/splitter/splitter-panel.js.map +1 -0
  28. package/dist/components/splitter/splitter.js +158 -0
  29. package/dist/components/splitter/splitter.js.map +1 -0
  30. package/dist/components/splitter/style.css +1 -1
  31. package/dist/components/splitter/useSizes.js +86 -0
  32. package/dist/components/splitter/useSizes.js.map +1 -0
  33. package/dist/components/upload/dragger.js +19 -10
  34. package/dist/components/upload/dragger.js.map +1 -1
  35. package/dist/components/upload/item.js +21 -18
  36. package/dist/components/upload/item.js.map +1 -1
  37. package/dist/components/utils/antdUtils.js +18 -56
  38. package/dist/components/utils/antdUtils.js.map +1 -1
  39. package/dist/components/utils/placement.js +58 -0
  40. package/dist/components/utils/placement.js.map +1 -0
  41. package/dist/components/utils/reactElement.js +5 -0
  42. package/dist/components/utils/reactElement.js.map +1 -0
  43. package/dist/index.d.ts +196 -25
  44. package/dist/index.js +164 -158
  45. package/dist/index.js.map +1 -1
  46. package/dist/metadata.js +22 -2
  47. package/dist/metadata.js.map +1 -1
  48. package/package.json +4 -2
package/dist/index.d.ts CHANGED
@@ -111,6 +111,7 @@ import { InputNumber } from 'antd';
111
111
  import { InputNumberProps } from 'antd';
112
112
  import { InputProps as InputProps_2 } from 'antd';
113
113
  import { InputRef } from 'antd';
114
+ import { InternalPanelProps } from 'antd/es/splitter/interface';
114
115
  import { JSX } from 'react/jsx-runtime';
115
116
  import { JSX as JSX_2 } from 'react';
116
117
  import { JSXElementConstructor } from 'react';
@@ -136,13 +137,13 @@ import { ModalFuncProps } from 'antd';
136
137
  import { ModalProps } from './Modal';
137
138
  import { ModalProps as ModalProps_3 } from 'antd/es/modal';
138
139
  import { ModalRef } from './functions';
140
+ import { MoveValues } from 'react-use-resizable';
139
141
  import { notification } from 'antd';
140
142
  import { NotificationArgsProps } from 'antd';
141
143
  import { OptionFC } from 'rc-select/lib/Option';
142
144
  import { OptionGroupFC } from 'rc-select/lib/OptGroup';
143
145
  import { Pagination } from 'antd';
144
146
  import { PaginationProps } from 'antd';
145
- import { PanelProps } from 'antd/es/splitter/interface';
146
147
  import { PasswordProps as PasswordProps_2 } from 'antd/es/input';
147
148
  import { Popconfirm } from 'antd';
148
149
  import { PopconfirmProps } from 'antd';
@@ -150,6 +151,7 @@ import { Popover as Popover_2 } from '@base-ui-components/react/popover';
150
151
  import { PopoverProps as PopoverProps_2 } from 'antd/es/popover';
151
152
  import { Progress } from 'antd';
152
153
  import { ProgressProps } from 'antd';
154
+ import { PropsWithChildren } from 'react';
153
155
  import { QRCode } from 'antd';
154
156
  import { QRCodeProps } from 'antd';
155
157
  import { QRPropsCanvas } from 'antd';
@@ -268,6 +270,8 @@ export { AnchorProps }
268
270
 
269
271
  export declare const antdColorTokens: ColorTokens;
270
272
 
273
+ export declare type AntdPlacement = PopoverProps_2["placement"];
274
+
271
275
  declare type AnyFunction = (...args: any[]) => any;
272
276
 
273
277
  declare type AnyObject = Record<PropertyKey, any>;
@@ -317,6 +321,15 @@ declare interface BaseFieldProps extends React.HTMLAttributes<HTMLDivElement> {
317
321
  colon?: boolean;
318
322
  }
319
323
 
324
+ export declare type BaseUIAlign = "start" | "end" | "center";
325
+
326
+ export declare interface BaseUIPlacement {
327
+ side: BaseUISide;
328
+ align: BaseUIAlign;
329
+ }
330
+
331
+ export declare type BaseUISide = "top" | "bottom" | "left" | "right";
332
+
320
333
  export declare const Breadcrumb: (({ className, items, noWrap, itemRender: outsideItemRender, ...rest }: BreadcrumbProps) => JSX.Element) & {
321
334
  Item: (props: BreadcrumbItemProps) => JSX.Element;
322
335
  Separator: (props: React.HTMLAttributes<HTMLSpanElement>) => JSX.Element;
@@ -336,6 +349,13 @@ export declare interface BreadcrumbProps<T extends AnyObject = AnyObject> extend
336
349
  itemRender?: (route: BreadcrumbItemType, params: T, routes: BreadcrumbItemType[], paths: string[]) => React.ReactNode;
337
350
  }
338
351
 
352
+ /**
353
+ * Build Antd placement string from BaseUI side and align values
354
+ * @param placement - Object with side and align properties
355
+ * @returns Antd placement string
356
+ */
357
+ export declare function buildAntdPlacement(placement: BaseUIPlacement): AntdPlacement;
358
+
339
359
  export declare const Button: (props: ButtonProps & {
340
360
  ref?: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>;
341
361
  }) => ReturnType<typeof ButtonInner>;
@@ -409,6 +429,11 @@ export { CheckboxChangeEvent }
409
429
  export { CheckboxOptionType }
410
430
 
411
431
  export declare interface CheckboxProps extends CheckboxProps_2 {
432
+ /**
433
+ * Checkbox appearance variant
434
+ * @default 'default'
435
+ */
436
+ variant?: 'default' | 'outlined';
412
437
  }
413
438
 
414
439
  export { CheckboxRef }
@@ -430,14 +455,14 @@ declare type Children = {
430
455
  children?: default_2.ReactNode;
431
456
  };
432
457
 
433
- export declare const ChoiceList: <M extends boolean = false>({ items, multiple, value, onChange, searchProps, }: ChoiceListProps<M>) => JSX.Element;
458
+ export declare const ChoiceList: <M extends boolean = false>({ items, multiple, value, onChange, searchProps, className, ...rest }: ChoiceListProps<M>) => JSX.Element;
434
459
 
435
460
  export declare type ChoiceListItem = {
436
461
  label: React.ReactNode;
437
462
  value?: string;
438
463
  };
439
464
 
440
- export declare interface ChoiceListProps<M extends boolean = false> {
465
+ export declare interface ChoiceListProps<M extends boolean = false> extends Omit<CommandProps, "value" | "onChange"> {
441
466
  items: ChoiceListItem[];
442
467
  multiple?: M;
443
468
  value?: M extends true ? string[] : string;
@@ -930,6 +955,48 @@ export { ColProps }
930
955
 
931
956
  declare type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
932
957
 
958
+ declare type CommandProps = Children & DivProps & {
959
+ /**
960
+ * Accessible label for this command menu. Not shown visibly.
961
+ */
962
+ label?: string;
963
+ /**
964
+ * Optionally set to `false` to turn off the automatic filtering and sorting.
965
+ * If `false`, you must conditionally render valid items based on the search query yourself.
966
+ */
967
+ shouldFilter?: boolean;
968
+ /**
969
+ * Custom filter function for whether each command menu item should matches the given search query.
970
+ * It should return a number between 0 and 1, with 1 being the best match and 0 being hidden entirely.
971
+ * By default, uses the `command-score` library.
972
+ */
973
+ filter?: CommandFilter;
974
+ /**
975
+ * Optional default item value when it is initially rendered.
976
+ */
977
+ defaultValue?: string;
978
+ /**
979
+ * Optional controlled state of the selected command menu item.
980
+ */
981
+ value?: string;
982
+ /**
983
+ * Event handler called when the selected item of the menu changes.
984
+ */
985
+ onValueChange?: (value: string) => void;
986
+ /**
987
+ * Optionally set to `true` to turn on looping around when using the arrow keys.
988
+ */
989
+ loop?: boolean;
990
+ /**
991
+ * Optionally set to `true` to disable selection via pointer events.
992
+ */
993
+ disablePointerSelection?: boolean;
994
+ /**
995
+ * Set to `false` to disable ctrl+n/j/p/k shortcuts. Defaults to `true`.
996
+ */
997
+ vimBindings?: boolean;
998
+ };
999
+
933
1000
  export declare type ComponentCategory = "Actions" | "General" | "Layout" | "Navigation" | "Data Entry" | "Data Display" | "Feedback" | "Overlay" | "Utility";
934
1001
 
935
1002
  /**
@@ -1122,6 +1189,15 @@ export declare const componentMetadata: {
1122
1189
  originalDocUrl: string;
1123
1190
  description: string;
1124
1191
  };
1192
+ Resizable: {
1193
+ name: string;
1194
+ link: string;
1195
+ base: "custom";
1196
+ refinements: string[];
1197
+ category: "Utility";
1198
+ packages: string[];
1199
+ description: string;
1200
+ };
1125
1201
  Radio: {
1126
1202
  name: string;
1127
1203
  link: string;
@@ -1748,7 +1824,7 @@ export declare const Form: (<Values = unknown>({ ...rest }: InternalFormProps<Va
1748
1824
  useForm: typeof useForm;
1749
1825
  useFormInstance: typeof default_9;
1750
1826
  useWatch: typeof useWatch;
1751
- Item: <Values = unknown>({ tooltip, label, optionalMark, requiredMark, required, rules, ...rest }: FormItemProps<Values>) => JSX.Element;
1827
+ Item: <Values = unknown>({ tooltip, label, optionalMark, requiredMark, labelRender, required, rules, children, ...rest }: FormItemProps<Values>) => JSX.Element;
1752
1828
  List: React_2.FC<FormListProps>;
1753
1829
  ErrorList: React_2.FC<ErrorListProps>;
1754
1830
  Provider: React_2.FC<FormProviderProps>;
@@ -1759,17 +1835,25 @@ export declare const Form: (<Values = unknown>({ ...rest }: InternalFormProps<Va
1759
1835
 
1760
1836
  export { FormInstance }
1761
1837
 
1762
- export declare interface FormItemProps<Values = unknown> extends FormItemProps_2<Values> {
1838
+ export declare interface FormItemProps<Values = unknown> extends Omit<FormItemProps_2<Values>, "children"> {
1763
1839
  /**
1764
1840
  * Whether show the optional mark. By default, optional item will not show the optional mark.
1765
1841
  * @default false
1766
1842
  */
1767
- optionalMark?: boolean | React.ReactNode;
1843
+ optionalMark?: boolean | default_2.ReactNode;
1768
1844
  /**
1769
1845
  * Whether show the asterisk when the field is required
1770
1846
  * @default true
1771
1847
  */
1772
- requiredMark?: boolean | React.ReactNode;
1848
+ requiredMark?: boolean | default_2.ReactNode;
1849
+ /**
1850
+ * Custom render function for the label
1851
+ */
1852
+ labelRender?: (label: default_2.ReactElement) => default_2.ReactElement;
1853
+ /**
1854
+ * Form item children - can be React nodes or render functions
1855
+ */
1856
+ children?: FormItemProps_2<Values>["children"];
1773
1857
  }
1774
1858
 
1775
1859
  export { FormListFieldData }
@@ -1804,6 +1888,8 @@ export declare const getColorsByTheme: <T extends ColorTokens>(colorsOrTokens: T
1804
1888
  */
1805
1889
  export declare const getComponentsByCategory: () => Record<ComponentCategory, ComponentMetadata[]>;
1806
1890
 
1891
+ export declare const getReactElementProp: <T>(el: React.ReactElement, propKey: string, defaultValue?: T) => T;
1892
+
1807
1893
  /**
1808
1894
  * Get sequential chart colors for a specific palette and theme
1809
1895
  */
@@ -1917,11 +2003,11 @@ export { List }
1917
2003
 
1918
2004
  export { ListProps }
1919
2005
 
1920
- declare const MainCheckboxInner: (props: CheckboxProps, ref: React.Ref<React.ComponentRef<typeof Checkbox_2>>) => JSX.Element;
2006
+ declare const MainCheckboxInner: ({ variant, className, ...props }: CheckboxProps, ref: React.Ref<React.ComponentRef<typeof Checkbox_2>>) => JSX.Element;
1921
2007
 
1922
2008
  declare const MainInputInner: (props: InputProps, ref: React.Ref<InputRef>) => JSX.Element;
1923
2009
 
1924
- declare const MainSegmentedInner: <T>({ className, ...rest }: SegmentedProps<T>, ref: React.Ref<React.ComponentRef<typeof default_5>>) => JSX.Element;
2010
+ declare const MainSegmentedInner: <T>(props: SegmentedProps<T>, ref: React.Ref<React.ComponentRef<typeof default_5>>) => JSX.Element;
1925
2011
 
1926
2012
  declare const MainSelectInner: <ValueType = unknown, OptionType extends SelectBaseOptionType | SelectDefaultOptionType = SelectDefaultOptionType>({ mode, className, open: openProp, defaultOpen, onOpenChange, popupClassName, onDropdownVisibleChange, enhancePositioner, getPopupContainer, popupSize, popupRender, dropdownRender, classNames, styles, ...rest }: SelectProps<ValueType, OptionType>, ref: default_2.Ref<default_2.ComponentRef<typeof default_3>>) => JSX.Element;
1927
2013
 
@@ -2123,10 +2209,12 @@ export { Pagination }
2123
2209
 
2124
2210
  export { PaginationProps }
2125
2211
 
2126
- export declare const parseAntdPlacement: (placement?: PopoverProps_2["placement"]) => {
2127
- placement: "top" | "bottom" | "left" | "right";
2128
- align: "start" | "end" | "center";
2129
- };
2212
+ /**
2213
+ * Parse Antd placement string into BaseUI side and align values
2214
+ * @param placement - Antd placement string (e.g., "bottomLeft", "top", "rightTop")
2215
+ * @returns Object with side and align properties for BaseUI components
2216
+ */
2217
+ export declare function parseAntdPlacement(placement?: AntdPlacement): BaseUIPlacement;
2130
2218
 
2131
2219
  declare const PasswordInner: (props: PasswordProps, ref: React.Ref<InputRef>) => JSX.Element;
2132
2220
 
@@ -2322,7 +2410,7 @@ export declare const POPUP_COLLISION_AVOIDANCE: {
2322
2410
  readonly fallbackAxisSide: "end";
2323
2411
  };
2324
2412
 
2325
- export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, classNames, modal, closeOnClickOutside, }: PopupPanelProps) => JSX.Element;
2413
+ export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, classNames, modal, closeOnClickOutside, onPlacementChange, }: PopupPanelProps) => JSX.Element;
2326
2414
 
2327
2415
  export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">, "title" | "content" | "children"> {
2328
2416
  /** The trigger element that opens the popup panel */
@@ -2403,6 +2491,10 @@ export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRe
2403
2491
  * @default false
2404
2492
  */
2405
2493
  modal?: Popover_2.Root.Props["modal"];
2494
+ /**
2495
+ * Callback function when the placement changes
2496
+ */
2497
+ onPlacementChange?: (placement: PopoverProps_2["placement"]) => void;
2406
2498
  }
2407
2499
 
2408
2500
  declare enum PopupPanelSize {
@@ -2913,6 +3005,74 @@ export { RefSelectProps }
2913
3005
 
2914
3006
  declare type RefType<T extends FieldType> = T extends "input" ? InputRef : T extends "select" ? RefSelectProps_2 : never;
2915
3007
 
3008
+ export declare const Resizable: ({ children, resizable, handles, absolutePositioning, classNames, className: containerClassName, style: containerStyle, resetKey, maxWidth, maxHeight, minWidth, minHeight, onResize, maintainAspectRatio, ...rest }: ResizableProps) => JSX.Element;
3009
+
3010
+ export declare interface ResizableProps extends WithRenderPropProps {
3011
+ /**
3012
+ * Single React element child that will be enhanced with resize handles
3013
+ */
3014
+ children: default_2.ReactNode;
3015
+ /**
3016
+ * Whether the component should be resizable
3017
+ * @default false
3018
+ */
3019
+ resizable?: boolean;
3020
+ /**
3021
+ * Configure which resize handles to show
3022
+ * @default { bottom: true, right: true, left: true, top: true }
3023
+ */
3024
+ handles?: {
3025
+ bottom?: boolean;
3026
+ right?: boolean;
3027
+ left?: boolean;
3028
+ top?: boolean;
3029
+ };
3030
+ /**
3031
+ * Whether to use absolute positioning for left handle resizing
3032
+ * Set to true when used in absolutely positioned containers like PopupPanel
3033
+ * @default false
3034
+ */
3035
+ absolutePositioning?: boolean;
3036
+ /**
3037
+ * Custom class names for different parts of the resizable component
3038
+ */
3039
+ classNames?: {
3040
+ root?: string;
3041
+ resizeHandle?: string;
3042
+ };
3043
+ /**
3044
+ * Key to reset dimensions to current element size
3045
+ * When this value changes, the component will recalculate its dimensions
3046
+ * Similar to React's key prop pattern for forcing component resets
3047
+ */
3048
+ resetKey?: default_2.Key;
3049
+ /**
3050
+ * Maximum width the component can be resized to
3051
+ */
3052
+ maxWidth?: number;
3053
+ /**
3054
+ * Maximum height the component can be resized to
3055
+ */
3056
+ maxHeight?: number;
3057
+ /**
3058
+ * Minimum width the component can be resized to
3059
+ */
3060
+ minWidth?: number;
3061
+ /**
3062
+ * Minimum height the component can be resized to
3063
+ */
3064
+ minHeight?: number;
3065
+ /**
3066
+ * Callback fired during resize operations
3067
+ */
3068
+ onResize?: (values: MoveValues) => void;
3069
+ /**
3070
+ * Whether to maintain aspect ratio during resize
3071
+ * @default false
3072
+ */
3073
+ maintainAspectRatio?: boolean;
3074
+ }
3075
+
2916
3076
  /**
2917
3077
  * Resolves chart color tokens by replacing reference strings with actual values.
2918
3078
  * @returns Record of token names to resolved light/dark color objects
@@ -3024,25 +3184,36 @@ export { Space }
3024
3184
 
3025
3185
  export { SpaceProps }
3026
3186
 
3027
- export declare const Spin: ({ indicator, size, ...rest }: SpinProps) => JSX.Element;
3187
+ export declare const Spin: ({ indicator, size, className, ...rest }: SpinProps) => JSX.Element;
3028
3188
 
3029
3189
  export declare type SpinProps = Omit<SpinProps_2, "size"> & {
3030
3190
  size?: "small" | "default" | "large" | number;
3031
3191
  };
3032
3192
 
3033
- export declare const Split: default_2.FC<SplitterProps> & {
3034
- Panel: default_2.FC<SplitterPanelProps>;
3193
+ export declare const Split: FC<PropsWithChildren<SplitterProps>> & {
3194
+ Panel: ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & RefAttributes<HTMLElement>>;
3035
3195
  };
3036
3196
 
3037
- export declare const Splitter: default_2.FC<SplitterProps> & {
3038
- Panel: default_2.FC<SplitterPanelProps>;
3197
+ export declare const Splitter: FC<PropsWithChildren<SplitterProps>> & {
3198
+ Panel: ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & RefAttributes<HTMLElement>>;
3039
3199
  };
3040
3200
 
3041
- export declare type SplitterPanelProps = default_2.PropsWithChildren<PanelProps>;
3201
+ export declare type SplitterPanelProps = InternalPanelProps & {
3202
+ children?: default_2.ReactNode;
3203
+ } & default_2.RefAttributes<HTMLElement> & {
3204
+ /**
3205
+ * Default size of the panel. Can be a percentage string, number, or CSS intrinsic sizing values
3206
+ */
3207
+ defaultSize?: string | number | "max-content" | "min-content" | "fit-content";
3208
+ };
3042
3209
 
3043
- export declare type SplitterProps = default_2.PropsWithChildren<SplitterProps_2> & {
3210
+ export declare interface SplitterProps extends SplitterProps_2 {
3211
+ /**
3212
+ * Whether to show the split bars between panels
3213
+ * @default true
3214
+ */
3044
3215
  showSplitBar?: boolean;
3045
- };
3216
+ }
3046
3217
 
3047
3218
  export declare const Stack: ForwardRefExoticComponent<StackProps & RefAttributes<HTMLDivElement>> & {
3048
3219
  Child: ForwardRefExoticComponent<StackChildProps & RefAttributes<HTMLDivElement>>;
@@ -3404,8 +3575,8 @@ declare type UniqueIdentifier = string | number;
3404
3575
  export { unstableSetRender }
3405
3576
 
3406
3577
  export declare const Upload: (({ showRemoveButton, className, fileList, children, ...restProps }: UploadProps) => JSX.Element) & {
3407
- Dragger: ({ children, uploadTitle, uploadDescription, itemRender, ...rest }: DraggerProps) => JSX.Element;
3408
- Item: ({ fileName, fileType, status, percent, removable, onRemove, extraActions, }: UploadItemProps_2) => JSX.Element;
3578
+ Dragger: ({ children, uploadTitle, uploadDescription, itemRender, className, ...rest }: DraggerProps) => JSX.Element;
3579
+ Item: ({ fileName, fileType, status, percent, removable, onRemove, extraActions, className, ...rest }: UploadItemProps_2) => JSX.Element;
3409
3580
  };
3410
3581
 
3411
3582
  export { UploadChangeParam }
@@ -3414,7 +3585,7 @@ export { UploadFile }
3414
3585
 
3415
3586
  export declare type UploadFileStatus = "error" | "done" | "uploading" | "removed" | "pending";
3416
3587
 
3417
- export declare interface UploadItemProps {
3588
+ export declare interface UploadItemProps extends React.HTMLAttributes<HTMLDivElement> {
3418
3589
  fileName: string;
3419
3590
  fileType?: string;
3420
3591
  status?: UploadFileStatus;