@indico-data/design-system 3.10.0 → 3.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -34,30 +34,38 @@ const OptionComponent = <OptionType extends SelectOption>({
34
34
  );
35
35
  };
36
36
 
37
- const Select = <OptionType extends SelectOption>({
38
- classNamePrefix = 'select',
39
- className,
40
- components: customComponents,
41
- label,
42
- hasHiddenLabel,
43
- name,
44
- ...props
45
- }: SelectProps<OptionType>) => {
46
- const defaultComponents = {
47
- Option: OptionComponent as React.ComponentType<OptionProps<OptionType>>,
48
- };
37
+ const Select = React.forwardRef(
38
+ <OptionType extends SelectOption>(
39
+ {
40
+ classNamePrefix = 'select',
41
+ className,
42
+ components: customComponents,
43
+ label,
44
+ hasHiddenLabel,
45
+ name,
46
+ ...props
47
+ }: SelectProps<OptionType>,
48
+ ref: React.Ref<any>,
49
+ ) => {
50
+ const defaultComponents = {
51
+ Option: OptionComponent as React.ComponentType<OptionProps<OptionType>>,
52
+ };
49
53
 
50
- const mergedComponents = { ...defaultComponents, ...customComponents };
54
+ const mergedComponents = { ...defaultComponents, ...customComponents };
51
55
 
52
- return (
53
- <ReactSelect
54
- classNamePrefix={classNamePrefix}
55
- className={classNames('select-wrapper', className)}
56
- components={mergedComponents}
57
- {...props}
58
- />
59
- );
60
- };
56
+ return (
57
+ <ReactSelect
58
+ ref={ref}
59
+ classNamePrefix={classNamePrefix}
60
+ className={classNames('select-wrapper', className)}
61
+ components={mergedComponents}
62
+ {...props}
63
+ />
64
+ );
65
+ },
66
+ ) as <OptionType extends SelectOption>(
67
+ props: SelectProps<OptionType> & { ref?: React.Ref<any> },
68
+ ) => React.ReactElement;
61
69
 
62
70
  const LabeledSelect = withLabel(Select);
63
71
 
@@ -1,6 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+
1
3
  export type SelectOption = {
2
4
  label: string;
3
5
  value: string;
4
- detail?: string;
6
+ detail?: ReactNode;
5
7
  [key: string]: any; // Allow for additional properties
6
8
  };