@kelvininc/ui-components
Version:
Kelvin UI Components
29 lines (28 loc) • 955 B
JavaScript
import { offset, size, flip } from "@floating-ui/dom";
import { EInputFieldType, EValidationState } from "../text-field/text-field.types";
import { EComponentSize } from "../../types";
export const DROPDOWN_DEFAULT_PLACEHOLDER = 'Select an option';
export const DEFAULT_INPUT_CONFIG = {
placeholder: 'Select an option',
type: EInputFieldType.Text,
state: EValidationState.None,
size: EComponentSize.Large
};
const DEFAULT_DROPDOWN_OFFSET = 8;
export const DEFAULT_DROPDOWN_POSITION_CONFIG = {
placement: 'bottom',
middleware: [
offset(DEFAULT_DROPDOWN_OFFSET),
flip({
padding: 16,
fallbackPlacements: ['top-end', 'bottom-end', 'top-start', 'bottom-start']
}),
size({
apply({ rects, elements }) {
Object.assign(elements.floating.style, {
width: `${rects.reference.width}px`
});
}
})
]
};