@bolttech/molecules-input-combo 0.1.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/README.md +223 -0
- package/index.cjs.js +1826 -0
- package/index.d.ts +1 -0
- package/package.json +18 -0
- package/src/index.d.ts +2 -0
- package/src/lib/molecules-input-combo.d.ts +29 -0
- package/src/lib/molecules-input-combo.styles.d.ts +35 -0
- package/src/lib/molecules-input-combo.type.d.ts +71 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bolttech/molecules-input-combo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"react": "19.1.2",
|
|
6
|
+
"react-dom": "19.1.2",
|
|
7
|
+
"styled-components": "6.1.1",
|
|
8
|
+
"@bolttech/atoms-icon": "0.24.8",
|
|
9
|
+
"@bolttech/atoms-select": "0.27.2",
|
|
10
|
+
"@bolttech/atoms-tooltip": "0.24.8",
|
|
11
|
+
"@bolttech/molecules-dropdown": "0.37.2",
|
|
12
|
+
"@bolttech/ui-utils": "0.6.5",
|
|
13
|
+
"@bolttech/default-theme": "0.18.0"
|
|
14
|
+
},
|
|
15
|
+
"main": "./index.cjs.js",
|
|
16
|
+
"type": "commonjs",
|
|
17
|
+
"types": "./index.d.ts"
|
|
18
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const InputCombo: import("react").ForwardRefExoticComponent<import("@bolttech/ui-utils").DefaultProps & {
|
|
2
|
+
id?: string;
|
|
3
|
+
dataTestId?: string;
|
|
4
|
+
variant?: import("./molecules-input-combo.type").InputComboVariants;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
helperMessage?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
dropdownValue?: string;
|
|
13
|
+
dropdownOptions: import("./molecules-input-combo.type").DropdownOption[];
|
|
14
|
+
dropdownLabel?: string;
|
|
15
|
+
dropdownPlaceholder?: string;
|
|
16
|
+
dropdownDisableSearch?: boolean;
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
icon?: string;
|
|
19
|
+
usePortal?: boolean;
|
|
20
|
+
tooltip?: {
|
|
21
|
+
text: import("react").ReactNode;
|
|
22
|
+
variant: "dark" | "grey" | "light";
|
|
23
|
+
size: "short" | "long";
|
|
24
|
+
};
|
|
25
|
+
onChange?: (combo: import("./molecules-input-combo.type").ComboValue) => void;
|
|
26
|
+
onDropdownChange?: (option: import("./molecules-input-combo.type").DropdownOption) => void;
|
|
27
|
+
onBlur?: (evt: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
28
|
+
onFocus?: (evt: import("react").FocusEvent<HTMLInputElement>) => void;
|
|
29
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InputComboVariants } from './molecules-input-combo.type';
|
|
2
|
+
type ContainerStyledProps = {
|
|
3
|
+
$variant: InputComboVariants;
|
|
4
|
+
$hasError?: boolean;
|
|
5
|
+
$hasValue?: boolean;
|
|
6
|
+
$hasHelperText?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const Wrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
$fullWidth?: boolean;
|
|
12
|
+
}>>;
|
|
13
|
+
export declare const Container: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ContainerStyledProps>>;
|
|
14
|
+
export declare const DropdownSection: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
+
$variant: InputComboVariants;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
$hasError: boolean;
|
|
18
|
+
}>>;
|
|
19
|
+
export declare const DividerWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
20
|
+
$variant: InputComboVariants;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const InputSection: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
23
|
+
$variant: InputComboVariants;
|
|
24
|
+
$hasError?: boolean;
|
|
25
|
+
$hasValue?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}>>;
|
|
28
|
+
export declare const ErrorMessage: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
29
|
+
$variant: InputComboVariants;
|
|
30
|
+
}>>;
|
|
31
|
+
export declare const HelperText: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
$variant: InputComboVariants;
|
|
34
|
+
}>>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DefaultProps } from '@bolttech/ui-utils';
|
|
2
|
+
import { OptionType } from '@bolttech/atoms-select';
|
|
3
|
+
import { FocusEvent, ReactNode } from 'react';
|
|
4
|
+
export type InputComboVariants = 'grey' | 'border';
|
|
5
|
+
export type DropdownOption = OptionType;
|
|
6
|
+
export type ComboValue = {
|
|
7
|
+
/** Value provided by the dropdown selected option id */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Unified value from dropdown and input */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Value from typed input */
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
export type InputComboProps = DefaultProps & {
|
|
15
|
+
/** Unique identifier for the component */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Data test id for testing */
|
|
18
|
+
dataTestId?: string;
|
|
19
|
+
/** Visual variant */
|
|
20
|
+
variant?: InputComboVariants;
|
|
21
|
+
/** Field label text for the input */
|
|
22
|
+
label?: string;
|
|
23
|
+
/** Placeholder for the text input */
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** Whether the field is required */
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** Whether the component is disabled */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Error message — triggers error state when set */
|
|
30
|
+
errorMessage?: string;
|
|
31
|
+
/** Helper text displayed below the field */
|
|
32
|
+
helperMessage?: string;
|
|
33
|
+
/** Text input value */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Currently selected dropdown value (option id) */
|
|
36
|
+
dropdownValue?: string;
|
|
37
|
+
/** Options for the dropdown prefix selector */
|
|
38
|
+
dropdownOptions: DropdownOption[];
|
|
39
|
+
/** Label for the dropdown (visually hidden, used for a11y) */
|
|
40
|
+
dropdownLabel?: string;
|
|
41
|
+
/** Placeholder for the dropdown search input */
|
|
42
|
+
dropdownPlaceholder?: string;
|
|
43
|
+
/** Disable search/typing in the dropdown */
|
|
44
|
+
dropdownDisableSearch?: boolean;
|
|
45
|
+
/** Whether the component should take the full width of its container */
|
|
46
|
+
fullWidth?: boolean;
|
|
47
|
+
/** Icon name for the input (Material Symbols Sharp). When set, always shows the icon. Defaults to 'info' when tooltip is provided. */
|
|
48
|
+
icon?: string;
|
|
49
|
+
/** Render dropdown options in a portal, useful when inside overflow containers like modals */
|
|
50
|
+
usePortal?: boolean;
|
|
51
|
+
/** Tooltip configuration for the info icon */
|
|
52
|
+
tooltip?: {
|
|
53
|
+
text: ReactNode;
|
|
54
|
+
variant: 'dark' | 'grey' | 'light';
|
|
55
|
+
size: 'short' | 'long';
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Unified onChange callback.
|
|
59
|
+
* Called on both input typing and dropdown selection.
|
|
60
|
+
* Compatible with the form engine's custom event `(event) => {
|
|
61
|
+
* return { _value: event.value, _metadata: event }
|
|
62
|
+
* }`.
|
|
63
|
+
*/
|
|
64
|
+
onChange?: (combo: ComboValue) => void;
|
|
65
|
+
/** Callback when dropdown selection changes (in addition to onChange) */
|
|
66
|
+
onDropdownChange?: (option: DropdownOption) => void;
|
|
67
|
+
/** Callback when input loses focus */
|
|
68
|
+
onBlur?: (evt: FocusEvent<HTMLInputElement>) => void;
|
|
69
|
+
/** Callback when input gains focus */
|
|
70
|
+
onFocus?: (evt: FocusEvent<HTMLInputElement>) => void;
|
|
71
|
+
};
|