@bonprix-ds/react-select 1.0.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/dist/index.d.ts +70 -0
- package/dist/index.js +8108 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { RefObject } from 'react';
|
|
5
|
+
|
|
6
|
+
declare interface BaseProps {
|
|
7
|
+
/** The id of the input field. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** The visible label for the input field. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** This is where Select.Item subcomponents should be placed. */
|
|
12
|
+
children: default_2.ReactNode;
|
|
13
|
+
/** The name of the input field. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** If `true`, disables the input. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** If `true`, the input field is in an error state. Required for `errorText` to be shown. */
|
|
18
|
+
error?: boolean;
|
|
19
|
+
/** If `true`, marks the input as required. */
|
|
20
|
+
required?: boolean;
|
|
21
|
+
/** A text that further describes the field and helps with filling out the form correctly. */
|
|
22
|
+
helperText?: string;
|
|
23
|
+
/** A text message that appears when the field is invalid. Only visible when `error` is set to `true`. */
|
|
24
|
+
errorText?: string;
|
|
25
|
+
/** <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-describedby" target="_blank">ARIA: aria-describedby attribute.</a> */
|
|
26
|
+
describedBy?: string;
|
|
27
|
+
/** Reference to the root element of the select. */
|
|
28
|
+
ref?: RefObject<HTMLButtonElement>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare interface ControlledSelectProps extends BaseProps {
|
|
32
|
+
/** The current value of the select. Should be used in conjunction with `onValueChange`. */
|
|
33
|
+
value: string;
|
|
34
|
+
/** The default value of the select. Should be used when select is uncontrolled. */
|
|
35
|
+
defaultValue?: never;
|
|
36
|
+
/** Callback that is triggered when the value changes. */
|
|
37
|
+
onValueChange: (value: string) => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare interface Props {
|
|
41
|
+
/** The value of the select item. This will be used as the value when the select is submitted. */
|
|
42
|
+
value: string;
|
|
43
|
+
/** The content text of the select item. */
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
/** If `true`, the select item will be disabled and not selectable. */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** If `true`, the select item will be hidden from the dropdown menu. */
|
|
48
|
+
hidden?: boolean;
|
|
49
|
+
/** A reference to the root element of the select item. */
|
|
50
|
+
ref?: RefObject<HTMLDivElement>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare const Select: FC<SelectProps> & Subcomponents;
|
|
54
|
+
export default Select;
|
|
55
|
+
|
|
56
|
+
declare const SelectItem: FC<Props>;
|
|
57
|
+
|
|
58
|
+
export declare type SelectProps = ControlledSelectProps | UncontrolledSelectProps;
|
|
59
|
+
|
|
60
|
+
declare interface Subcomponents {
|
|
61
|
+
Item: typeof SelectItem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare interface UncontrolledSelectProps extends BaseProps {
|
|
65
|
+
value?: never;
|
|
66
|
+
defaultValue: string;
|
|
67
|
+
onValueChange?: (value: string) => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { }
|