@bioturing/components 0.26.2 → 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 (37) hide show
  1. package/dist/components/choice-list/component.js +24 -21
  2. package/dist/components/choice-list/component.js.map +1 -1
  3. package/dist/components/cmdk/index.js.map +1 -1
  4. package/dist/components/dropdown-menu/component.js +16 -15
  5. package/dist/components/dropdown-menu/component.js.map +1 -1
  6. package/dist/components/popup-panel/component.js +142 -164
  7. package/dist/components/popup-panel/component.js.map +1 -1
  8. package/dist/components/popup-panel/style.css +1 -1
  9. package/dist/components/resizable/component.js +171 -0
  10. package/dist/components/resizable/component.js.map +1 -0
  11. package/dist/components/resizable/style.css +1 -0
  12. package/dist/components/segmented/component.js +3 -3
  13. package/dist/components/segmented/component.js.map +1 -1
  14. package/dist/components/spin/component.js +9 -8
  15. package/dist/components/spin/component.js.map +1 -1
  16. package/dist/components/splitter/splitter-panel.js +27 -44
  17. package/dist/components/splitter/splitter-panel.js.map +1 -1
  18. package/dist/components/splitter/splitter.js +94 -93
  19. package/dist/components/splitter/splitter.js.map +1 -1
  20. package/dist/components/splitter/useSizes.js +86 -0
  21. package/dist/components/splitter/useSizes.js.map +1 -0
  22. package/dist/components/upload/dragger.js +19 -10
  23. package/dist/components/upload/dragger.js.map +1 -1
  24. package/dist/components/upload/item.js +21 -18
  25. package/dist/components/upload/item.js.map +1 -1
  26. package/dist/components/utils/antdUtils.js +18 -56
  27. package/dist/components/utils/antdUtils.js.map +1 -1
  28. package/dist/components/utils/placement.js +58 -0
  29. package/dist/components/utils/placement.js.map +1 -0
  30. package/dist/components/utils/reactElement.js +5 -0
  31. package/dist/components/utils/reactElement.js.map +1 -0
  32. package/dist/index.d.ts +162 -16
  33. package/dist/index.js +164 -158
  34. package/dist/index.js.map +1 -1
  35. package/dist/metadata.js +22 -2
  36. package/dist/metadata.js.map +1 -1
  37. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -137,6 +137,7 @@ import { ModalFuncProps } from 'antd';
137
137
  import { ModalProps } from './Modal';
138
138
  import { ModalProps as ModalProps_3 } from 'antd/es/modal';
139
139
  import { ModalRef } from './functions';
140
+ import { MoveValues } from 'react-use-resizable';
140
141
  import { notification } from 'antd';
141
142
  import { NotificationArgsProps } from 'antd';
142
143
  import { OptionFC } from 'rc-select/lib/Option';
@@ -269,6 +270,8 @@ export { AnchorProps }
269
270
 
270
271
  export declare const antdColorTokens: ColorTokens;
271
272
 
273
+ export declare type AntdPlacement = PopoverProps_2["placement"];
274
+
272
275
  declare type AnyFunction = (...args: any[]) => any;
273
276
 
274
277
  declare type AnyObject = Record<PropertyKey, any>;
@@ -318,6 +321,15 @@ declare interface BaseFieldProps extends React.HTMLAttributes<HTMLDivElement> {
318
321
  colon?: boolean;
319
322
  }
320
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
+
321
333
  export declare const Breadcrumb: (({ className, items, noWrap, itemRender: outsideItemRender, ...rest }: BreadcrumbProps) => JSX.Element) & {
322
334
  Item: (props: BreadcrumbItemProps) => JSX.Element;
323
335
  Separator: (props: React.HTMLAttributes<HTMLSpanElement>) => JSX.Element;
@@ -337,6 +349,13 @@ export declare interface BreadcrumbProps<T extends AnyObject = AnyObject> extend
337
349
  itemRender?: (route: BreadcrumbItemType, params: T, routes: BreadcrumbItemType[], paths: string[]) => React.ReactNode;
338
350
  }
339
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
+
340
359
  export declare const Button: (props: ButtonProps & {
341
360
  ref?: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>;
342
361
  }) => ReturnType<typeof ButtonInner>;
@@ -436,14 +455,14 @@ declare type Children = {
436
455
  children?: default_2.ReactNode;
437
456
  };
438
457
 
439
- 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;
440
459
 
441
460
  export declare type ChoiceListItem = {
442
461
  label: React.ReactNode;
443
462
  value?: string;
444
463
  };
445
464
 
446
- export declare interface ChoiceListProps<M extends boolean = false> {
465
+ export declare interface ChoiceListProps<M extends boolean = false> extends Omit<CommandProps, "value" | "onChange"> {
447
466
  items: ChoiceListItem[];
448
467
  multiple?: M;
449
468
  value?: M extends true ? string[] : string;
@@ -936,6 +955,48 @@ export { ColProps }
936
955
 
937
956
  declare type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
938
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
+
939
1000
  export declare type ComponentCategory = "Actions" | "General" | "Layout" | "Navigation" | "Data Entry" | "Data Display" | "Feedback" | "Overlay" | "Utility";
940
1001
 
941
1002
  /**
@@ -1128,6 +1189,15 @@ export declare const componentMetadata: {
1128
1189
  originalDocUrl: string;
1129
1190
  description: string;
1130
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
+ };
1131
1201
  Radio: {
1132
1202
  name: string;
1133
1203
  link: string;
@@ -1818,6 +1888,8 @@ export declare const getColorsByTheme: <T extends ColorTokens>(colorsOrTokens: T
1818
1888
  */
1819
1889
  export declare const getComponentsByCategory: () => Record<ComponentCategory, ComponentMetadata[]>;
1820
1890
 
1891
+ export declare const getReactElementProp: <T>(el: React.ReactElement, propKey: string, defaultValue?: T) => T;
1892
+
1821
1893
  /**
1822
1894
  * Get sequential chart colors for a specific palette and theme
1823
1895
  */
@@ -1935,7 +2007,7 @@ declare const MainCheckboxInner: ({ variant, className, ...props }: CheckboxProp
1935
2007
 
1936
2008
  declare const MainInputInner: (props: InputProps, ref: React.Ref<InputRef>) => JSX.Element;
1937
2009
 
1938
- 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;
1939
2011
 
1940
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;
1941
2013
 
@@ -2137,10 +2209,12 @@ export { Pagination }
2137
2209
 
2138
2210
  export { PaginationProps }
2139
2211
 
2140
- export declare const parseAntdPlacement: (placement?: PopoverProps_2["placement"]) => {
2141
- placement: "top" | "bottom" | "left" | "right";
2142
- align: "start" | "end" | "center";
2143
- };
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;
2144
2218
 
2145
2219
  declare const PasswordInner: (props: PasswordProps, ref: React.Ref<InputRef>) => JSX.Element;
2146
2220
 
@@ -2336,7 +2410,7 @@ export declare const POPUP_COLLISION_AVOIDANCE: {
2336
2410
  readonly fallbackAxisSide: "end";
2337
2411
  };
2338
2412
 
2339
- 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;
2340
2414
 
2341
2415
  export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRef<"div">, "title" | "content" | "children"> {
2342
2416
  /** The trigger element that opens the popup panel */
@@ -2417,6 +2491,10 @@ export declare interface PopupPanelProps extends Omit<React.ComponentPropsWithRe
2417
2491
  * @default false
2418
2492
  */
2419
2493
  modal?: Popover_2.Root.Props["modal"];
2494
+ /**
2495
+ * Callback function when the placement changes
2496
+ */
2497
+ onPlacementChange?: (placement: PopoverProps_2["placement"]) => void;
2420
2498
  }
2421
2499
 
2422
2500
  declare enum PopupPanelSize {
@@ -2927,6 +3005,74 @@ export { RefSelectProps }
2927
3005
 
2928
3006
  declare type RefType<T extends FieldType> = T extends "input" ? InputRef : T extends "select" ? RefSelectProps_2 : never;
2929
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
+
2930
3076
  /**
2931
3077
  * Resolves chart color tokens by replacing reference strings with actual values.
2932
3078
  * @returns Record of token names to resolved light/dark color objects
@@ -3038,23 +3184,23 @@ export { Space }
3038
3184
 
3039
3185
  export { SpaceProps }
3040
3186
 
3041
- export declare const Spin: ({ indicator, size, ...rest }: SpinProps) => JSX.Element;
3187
+ export declare const Spin: ({ indicator, size, className, ...rest }: SpinProps) => JSX.Element;
3042
3188
 
3043
3189
  export declare type SpinProps = Omit<SpinProps_2, "size"> & {
3044
3190
  size?: "small" | "default" | "large" | number;
3045
3191
  };
3046
3192
 
3047
3193
  export declare const Split: FC<PropsWithChildren<SplitterProps>> & {
3048
- Panel: FC<SplitterPanelProps>;
3194
+ Panel: ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & RefAttributes<HTMLElement>>;
3049
3195
  };
3050
3196
 
3051
3197
  export declare const Splitter: FC<PropsWithChildren<SplitterProps>> & {
3052
- Panel: FC<SplitterPanelProps>;
3198
+ Panel: ForwardRefExoticComponent<Omit<SplitterPanelProps, "ref"> & RefAttributes<HTMLElement>>;
3053
3199
  };
3054
3200
 
3055
3201
  export declare type SplitterPanelProps = InternalPanelProps & {
3056
- children?: default_2.ReactNode | undefined;
3057
- } & default_2.RefAttributes<HTMLDivElement> & {
3202
+ children?: default_2.ReactNode;
3203
+ } & default_2.RefAttributes<HTMLElement> & {
3058
3204
  /**
3059
3205
  * Default size of the panel. Can be a percentage string, number, or CSS intrinsic sizing values
3060
3206
  */
@@ -3429,8 +3575,8 @@ declare type UniqueIdentifier = string | number;
3429
3575
  export { unstableSetRender }
3430
3576
 
3431
3577
  export declare const Upload: (({ showRemoveButton, className, fileList, children, ...restProps }: UploadProps) => JSX.Element) & {
3432
- Dragger: ({ children, uploadTitle, uploadDescription, itemRender, ...rest }: DraggerProps) => JSX.Element;
3433
- 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;
3434
3580
  };
3435
3581
 
3436
3582
  export { UploadChangeParam }
@@ -3439,7 +3585,7 @@ export { UploadFile }
3439
3585
 
3440
3586
  export declare type UploadFileStatus = "error" | "done" | "uploading" | "removed" | "pending";
3441
3587
 
3442
- export declare interface UploadItemProps {
3588
+ export declare interface UploadItemProps extends React.HTMLAttributes<HTMLDivElement> {
3443
3589
  fileName: string;
3444
3590
  fileType?: string;
3445
3591
  status?: UploadFileStatus;