@bioturing/components 0.30.0 → 0.31.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 (31) hide show
  1. package/dist/components/choice-list/component.js +26 -28
  2. package/dist/components/choice-list/component.js.map +1 -1
  3. package/dist/components/code-block/component.js +10 -10
  4. package/dist/components/combobox/component.js +113 -112
  5. package/dist/components/combobox/component.js.map +1 -1
  6. package/dist/components/command-palette/component.js +79 -0
  7. package/dist/components/command-palette/component.js.map +1 -0
  8. package/dist/components/command-palette/style.css +1 -0
  9. package/dist/components/dropdown-menu/component.js +117 -189
  10. package/dist/components/dropdown-menu/component.js.map +1 -1
  11. package/dist/components/dropdown-menu/item.css +1 -1
  12. package/dist/components/dropdown-menu/item.js +50 -37
  13. package/dist/components/dropdown-menu/item.js.map +1 -1
  14. package/dist/components/dropdown-menu/style.css +1 -1
  15. package/dist/components/dropdown-menu/useDropdownMenu.js +124 -0
  16. package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -0
  17. package/dist/components/keyboard-shortcut/component.js +72 -0
  18. package/dist/components/keyboard-shortcut/component.js.map +1 -0
  19. package/dist/components/keyboard-shortcut/style.css +1 -0
  20. package/dist/components/loader/component.js +15 -0
  21. package/dist/components/loader/component.js.map +1 -0
  22. package/dist/components/loader/style.css +1 -0
  23. package/dist/components/popup-panel/style.css +1 -1
  24. package/dist/components/theme-provider/style.css +1 -1
  25. package/dist/components/toast/style.css +1 -1
  26. package/dist/index.d.ts +180 -51
  27. package/dist/index.js +203 -197
  28. package/dist/index.js.map +1 -1
  29. package/dist/metadata.js +47 -2
  30. package/dist/metadata.js.map +1 -1
  31. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -465,15 +465,15 @@ declare type Children = {
465
465
  children?: default_2.ReactNode;
466
466
  };
467
467
 
468
- export declare const ChoiceList: <M extends boolean = false>({ items, multiple, value, defaultValue, onChange, searchProps, showSelectAll, className, placeholder, disabled: disabledProp, status: statusProp, getItemKeywords, ...rest }: ChoiceListProps<M>) => JSX.Element;
468
+ export declare const ChoiceList: <M extends boolean = false>({ options, multiple, value, defaultValue, onChange, searchProps, showSelectAll, className, placeholder, disabled: disabledProp, status: statusProp, getItemKeywords, ...rest }: ChoiceListProps<M>) => JSX.Element;
469
469
 
470
- export declare type ChoiceListItem = {
470
+ export declare type ChoiceListOption = {
471
471
  label: React.ReactNode;
472
472
  value?: string;
473
473
  };
474
474
 
475
475
  export declare interface ChoiceListProps<M extends boolean = false> extends Omit<CommandProps, "value" | "onChange" | "defaultValue"> {
476
- items: ChoiceListItem[];
476
+ options: ChoiceListOption[];
477
477
  multiple?: M;
478
478
  value?: M extends true ? string[] : string;
479
479
  defaultValue?: M extends true ? string[] : string;
@@ -498,7 +498,7 @@ export declare interface ChoiceListProps<M extends boolean = false> extends Omit
498
498
  * Function to extract keywords from the item for search filtering
499
499
  * @default (item) => [item.value, reactNodeToString(item.label)]
500
500
  */
501
- getItemKeywords?: (item: ChoiceListItem) => string[];
501
+ getItemKeywords?: (item: ChoiceListOption) => string[];
502
502
  }
503
503
 
504
504
  export declare interface ClassArray extends Array<ClassValue> {
@@ -1085,10 +1085,58 @@ export declare interface ComboboxProps {
1085
1085
  checked: boolean;
1086
1086
  indeterminate: boolean;
1087
1087
  }) => default_2.ReactNode;
1088
+ /**
1089
+ * Function to extract keywords from the item for search filtering
1090
+ * @default (option) => [String(option.key), reactNodeToString(option.label)]
1091
+ */
1092
+ getOptionKeywords?: (option: DropdownMenuItemType & {
1093
+ type: "item";
1094
+ }) => string[];
1088
1095
  }
1089
1096
 
1090
1097
  declare type CommandFilter = (value: string, search: string, keywords?: string[]) => number;
1091
1098
 
1099
+ export declare const CommandPalette: default_2.FC<CommandPaletteProps>;
1100
+
1101
+ export declare interface CommandPaletteProps {
1102
+ /** Whether the command palette is open */
1103
+ open?: boolean;
1104
+ /** Callback fired when the open state changes */
1105
+ onOpenChange?: (open: boolean) => void;
1106
+ /**
1107
+ * Default open state
1108
+ */
1109
+ defaultOpen?: boolean;
1110
+ /** Items to display in the command palette */
1111
+ items?: DropdownMenuItemType[];
1112
+ /** Keyboard shortcuts to open the palette */
1113
+ shortcuts?: CommandPaletteShortcut[];
1114
+ /** Placeholder text for the search input */
1115
+ placeholder?: string;
1116
+ /** Text to show when no results are found */
1117
+ emptyText?: string;
1118
+ /** Accessible label for the command palette */
1119
+ label?: string;
1120
+ /** Additional CSS class names */
1121
+ className?: string;
1122
+ classNames?: {
1123
+ root?: string;
1124
+ mask?: string;
1125
+ content?: string;
1126
+ group?: string;
1127
+ item?: string;
1128
+ groupLabel?: string;
1129
+ };
1130
+ }
1131
+
1132
+ export declare type CommandPaletteShortcut = {
1133
+ key: string;
1134
+ metaKey?: boolean;
1135
+ ctrlKey?: boolean;
1136
+ altKey?: boolean;
1137
+ shiftKey?: boolean;
1138
+ };
1139
+
1092
1140
  declare type CommandProps = Children & DivProps & {
1093
1141
  /**
1094
1142
  * Accessible label for this command menu. Not shown visibly.
@@ -1379,6 +1427,14 @@ export declare const componentMetadata: {
1379
1427
  originalDocUrl: string;
1380
1428
  description: string;
1381
1429
  };
1430
+ Loader: {
1431
+ name: string;
1432
+ link: string;
1433
+ base: "custom";
1434
+ refinements: string[];
1435
+ category: "Feedback";
1436
+ description: string;
1437
+ };
1382
1438
  Spin: {
1383
1439
  name: string;
1384
1440
  link: string;
@@ -1538,6 +1594,23 @@ export declare const componentMetadata: {
1538
1594
  category: "Feedback";
1539
1595
  description: string;
1540
1596
  };
1597
+ CommandPalette: {
1598
+ name: string;
1599
+ link: string;
1600
+ base: "custom";
1601
+ refinements: string[];
1602
+ category: "Navigation";
1603
+ packages: string[];
1604
+ description: string;
1605
+ };
1606
+ KeyboardShortcut: {
1607
+ name: string;
1608
+ link: string;
1609
+ base: "custom";
1610
+ refinements: string[];
1611
+ category: "Data Display";
1612
+ description: string;
1613
+ };
1541
1614
  VerticalCollapsiblePanel: {
1542
1615
  name: string;
1543
1616
  link: string;
@@ -1810,7 +1883,12 @@ export declare const DROPDOWN_COLLISION_AVOIDANCE: {
1810
1883
  readonly fallbackAxisSide: "none";
1811
1884
  };
1812
1885
 
1813
- export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, className, itemRender, classNames, size, showSearch, searchProps, popupMatchTriggerWidth, beforeList, afterList, keepOpenOnSelect, highlightedItemKey, selectedItemKeys, showCheckbox, getItemKeywords, }: DropdownMenuProps) => JSX.Element;
1886
+ export declare const DropdownMenu: ({ children, items, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, defaultOpen, className, itemRender, classNames, size, showSearch, inCombobox: inComboboxProp, searchProps, popupMatchTriggerWidth, beforeList, afterList, keepOpenOnSelect, highlightedItemKey, selectedItemKeys, getItemKeywords, showCheckbox, }: DropdownMenuProps) => JSX.Element;
1887
+
1888
+ export declare interface DropdownMenuGroup {
1889
+ label: default_2.ReactNode | null;
1890
+ items: DropdownMenuItemType[];
1891
+ }
1814
1892
 
1815
1893
  export declare const DropdownMenuItem: default_2.FC<DropdownMenuItemProps>;
1816
1894
 
@@ -1828,8 +1906,11 @@ export declare interface DropdownMenuItemProps {
1828
1906
  item?: string;
1829
1907
  itemIcon?: string;
1830
1908
  itemText?: string;
1909
+ itemSuffix?: string;
1831
1910
  };
1832
- onSelect?: () => void;
1911
+ onSelect?: (item: DropdownMenuItemType & {
1912
+ type: "item";
1913
+ }) => void;
1833
1914
  /**
1834
1915
  * Whether the menu item is in a combobox
1835
1916
  */
@@ -1869,7 +1950,7 @@ export declare type DropdownMenuItemType = {
1869
1950
  /**
1870
1951
  * The label of the menu item
1871
1952
  */
1872
- label?: React.ReactNode;
1953
+ label?: default_2.ReactNode;
1873
1954
  /**
1874
1955
  * Whether the menu item is disabled
1875
1956
  */
@@ -1877,31 +1958,41 @@ export declare type DropdownMenuItemType = {
1877
1958
  /**
1878
1959
  * The icon of the menu item
1879
1960
  */
1880
- icon?: React.ReactNode;
1961
+ icon?: default_2.ReactNode;
1962
+ /**
1963
+ * The suffix of the menu item
1964
+ */
1965
+ suffix?: default_2.ReactNode;
1881
1966
  /**
1882
1967
  * The key of the menu item
1883
1968
  */
1884
- key: React.Key;
1969
+ key: default_2.Key;
1970
+ /**
1971
+ * The onSelect event handler of the menu item
1972
+ */
1973
+ onSelect?: (item: DropdownMenuItemType & {
1974
+ type: "item";
1975
+ }) => void;
1885
1976
  /**
1886
1977
  * The onClick event handler of the menu item
1887
1978
  */
1888
- onClick?: React.HTMLAttributes<HTMLElement>["onClick"];
1979
+ onClick?: default_2.HTMLAttributes<HTMLElement>["onClick"];
1889
1980
  /**
1890
1981
  * The onMouseEnter event handler of the menu item
1891
1982
  */
1892
- onMouseEnter?: React.HTMLAttributes<HTMLElement>["onMouseEnter"];
1983
+ onMouseEnter?: default_2.HTMLAttributes<HTMLElement>["onMouseEnter"];
1893
1984
  /**
1894
1985
  * The onMouseLeave event handler of the menu item
1895
1986
  */
1896
- onMouseLeave?: React.HTMLAttributes<HTMLElement>["onMouseLeave"];
1987
+ onMouseLeave?: default_2.HTMLAttributes<HTMLElement>["onMouseLeave"];
1897
1988
  /**
1898
1989
  * The onMouseOver event handler of the menu item
1899
1990
  */
1900
- onMouseOver?: React.HTMLAttributes<HTMLElement>["onMouseOver"];
1991
+ onMouseOver?: default_2.HTMLAttributes<HTMLElement>["onMouseOver"];
1901
1992
  /**
1902
1993
  * The onMouseOut event handler of the menu item
1903
1994
  */
1904
- onMouseOut?: React.HTMLAttributes<HTMLElement>["onMouseOut"];
1995
+ onMouseOut?: default_2.HTMLAttributes<HTMLElement>["onMouseOut"];
1905
1996
  /**
1906
1997
  * The className of the menu item
1907
1998
  */
@@ -1913,7 +2004,7 @@ export declare type DropdownMenuItemType = {
1913
2004
  /**
1914
2005
  * The ref of the menu item
1915
2006
  */
1916
- ref?: React.Ref<HTMLElement>;
2007
+ ref?: default_2.Ref<HTMLElement>;
1917
2008
  } | {
1918
2009
  /**
1919
2010
  * The type of the menu item
@@ -1927,14 +2018,14 @@ export declare type DropdownMenuItemType = {
1927
2018
  /**
1928
2019
  * The title of the menu item
1929
2020
  */
1930
- title?: React.ReactNode;
2021
+ title?: default_2.ReactNode;
1931
2022
  /**
1932
2023
  * The className of the menu item
1933
2024
  */
1934
2025
  className?: string;
1935
2026
  };
1936
2027
 
1937
- export declare interface DropdownMenuProps {
2028
+ export declare interface DropdownMenuProps extends Omit<UseDropdownMenuProps, "classNames"> {
1938
2029
  /** Array of menu items to be displayed in the dropdown */
1939
2030
  items: DropdownMenuItemType[];
1940
2031
  /** Custom render function for the trigger element */
@@ -1957,6 +2048,10 @@ export declare interface DropdownMenuProps {
1957
2048
  * Callback fired when the dropdown open state changes
1958
2049
  */
1959
2050
  onOpenChange?: (open: boolean) => void;
2051
+ /**
2052
+ * Default open state of the dropdown
2053
+ */
2054
+ defaultOpen?: boolean;
1960
2055
  /**
1961
2056
  * Additional CSS class for the dropdown component
1962
2057
  */
@@ -1969,18 +2064,10 @@ export declare interface DropdownMenuProps {
1969
2064
  root?: string;
1970
2065
  trigger?: string;
1971
2066
  popup?: string;
1972
- group?: string;
1973
- groupLabel?: string;
1974
- item?: string;
1975
2067
  itemIcon?: string;
1976
2068
  itemText?: string;
1977
- separator?: string;
1978
2069
  positioner?: string;
1979
- };
1980
- /**
1981
- * Custom render function for menu items
1982
- */
1983
- itemRender?: (item: DropdownMenuItemType, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
2070
+ } & UseDropdownMenuProps["classNames"];
1984
2071
  /**
1985
2072
  * Whether to show search input
1986
2073
  * @default false
@@ -2008,31 +2095,6 @@ export declare interface DropdownMenuProps {
2008
2095
  * Content to display after the list
2009
2096
  */
2010
2097
  afterList?: React.ReactNode;
2011
- /**
2012
- * Whether to keep the dropdown open when an item is selected
2013
- * @default false
2014
- */
2015
- keepOpenOnSelect?: boolean;
2016
- /**
2017
- * Control the highlighted state of the menu item
2018
- */
2019
- highlightedItemKey?: React.Key;
2020
- /**
2021
- * Control the selected state of the menu item
2022
- */
2023
- selectedItemKeys?: React.Key[];
2024
- /**
2025
- * Whether to show checkbox
2026
- * @default false
2027
- */
2028
- showCheckbox?: boolean;
2029
- /**
2030
- * Function to extract keywords from the item for search filtering
2031
- * @default (item) => [String(item.key), reactNodeToString(item.label)]
2032
- */
2033
- getItemKeywords?: (item: DropdownMenuItemType & {
2034
- type: "item";
2035
- }) => string[];
2036
2098
  }
2037
2099
 
2038
2100
  export { DropDownProps }
@@ -2276,6 +2338,21 @@ export declare function isTracebackError(error: unknown): boolean;
2276
2338
 
2277
2339
  export declare const isValidHexColor: (hex: string, acceptWithoutPrefix?: boolean) => boolean;
2278
2340
 
2341
+ export declare const KeyboardShortcut: default_2.FC<KeyboardShortcutProps>;
2342
+
2343
+ export declare interface KeyboardShortcutProps {
2344
+ /** The keyboard shortcut keys to display (optional if using children) */
2345
+ keys?: string[];
2346
+ /** Custom className */
2347
+ className?: string;
2348
+ /** Custom style */
2349
+ style?: default_2.CSSProperties;
2350
+ /** Size variant */
2351
+ size?: "small" | "medium" | "large";
2352
+ /** Children to display as keyboard shortcuts */
2353
+ children?: default_2.ReactNode;
2354
+ }
2355
+
2279
2356
  export { Layout }
2280
2357
 
2281
2358
  export { LayoutProps }
@@ -2286,6 +2363,12 @@ export { List }
2286
2363
 
2287
2364
  export { ListProps }
2288
2365
 
2366
+ export declare const Loader: ForwardRefExoticComponent<LoaderProps & RefAttributes<HTMLSpanElement>>;
2367
+
2368
+ export declare interface LoaderProps extends React.ComponentPropsWithoutRef<"span"> {
2369
+ text?: string;
2370
+ }
2371
+
2289
2372
  declare const MainCheckboxInner: ({ variant, className, ...props }: CheckboxProps, ref: React.Ref<React.ComponentRef<typeof Checkbox_2>>) => JSX.Element;
2290
2373
 
2291
2374
  declare const MainInputInner: (props: InputProps, ref: React.Ref<InputRef>) => JSX.Element;
@@ -4086,6 +4169,52 @@ export declare function useDraggable(enabled?: boolean): {
4086
4169
  ref: (element: HTMLElement | null) => () => void;
4087
4170
  };
4088
4171
 
4172
+ declare interface UseDropdownMenuProps {
4173
+ /**
4174
+ * Callback function to handle the open state change of the dropdown menu.
4175
+ */
4176
+ onOpenChange?: (open: boolean) => void;
4177
+ items: DropdownMenuItemType[];
4178
+ inCombobox?: boolean;
4179
+ classNames?: {
4180
+ item?: string;
4181
+ itemIcon?: string;
4182
+ itemSuffix?: string;
4183
+ group?: string;
4184
+ groupLabel?: string;
4185
+ divider?: string;
4186
+ };
4187
+ /**
4188
+ * Custom render function for menu items
4189
+ */
4190
+ itemRender?: (item: DropdownMenuItemType, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
4191
+ /**
4192
+ * Whether to keep the dropdown open when an item is selected
4193
+ * @default false
4194
+ */
4195
+ keepOpenOnSelect?: boolean;
4196
+ /**
4197
+ * Control the highlighted state of the menu item
4198
+ */
4199
+ highlightedItemKey?: React.Key;
4200
+ /**
4201
+ * Control the selected state of the menu item
4202
+ */
4203
+ selectedItemKeys?: React.Key[];
4204
+ /**
4205
+ * Whether to show checkbox
4206
+ * @default false
4207
+ */
4208
+ showCheckbox?: boolean;
4209
+ /**
4210
+ * Function to extract keywords from the item for search filtering
4211
+ * @default (item) => [String(item.key), reactNodeToString(item.label)]
4212
+ */
4213
+ getItemKeywords?: (item: DropdownMenuItemType & {
4214
+ type: "item";
4215
+ }) => string[];
4216
+ }
4217
+
4089
4218
  export declare const useDS: () => {
4090
4219
  theme: "light" | "dark";
4091
4220
  };