@navinc/base-react-components
Version:
Nav's Pattern Library
73 lines (72 loc) • 2.5 kB
TypeScript
type AddressType = {
street1: string;
street2?: string;
city: string;
state: string;
zip: string;
country?: string;
};
type InputOptionType = {
name: string;
label: string;
placeholder: string;
};
type AddressInputs = Record<keyof AddressType, InputOptionType>;
export type AddressAutocompleteProps = {
/** Required accessibility legend for the fieldset. Use `hideLegend` prop if you don't want this shown. */
groupLabel?: string;
/** Lists territories in the state select dropdown */
withTerritories?: boolean;
/** Shows a disabled "Country" input */
withCountry?: boolean;
/** Changes the spelling of the state options */
stateFormat?: 'long' | 'short';
className?: string;
/** Object to override input name, label, and placeholder. Input `name` is associated to the key in the parent form values. */
addressInputs?: AddressInputs;
/** Visually hides the fieldset legend. */
hideLegend?: boolean;
/** adds classname and data attribute to redact PII data */
isPrivate?: boolean;
};
export declare const defaultInputOptions: {
street1: {
name: string;
label: string;
placeholder: string;
};
street2: {
name: string;
label: string;
placeholder: string;
};
city: {
name: string;
label: string;
placeholder: string;
};
state: {
name: string;
label: string;
placeholder: string;
};
zip: {
name: string;
label: string;
placeholder: string;
};
country: {
name: string;
label: string;
placeholder: string;
};
};
/**
* This takes the `AddressInput` and spreads it out to an expanded address form with individual inputs for "city", "state", "zip", etc.
*
* Some inputs have default validation that you will need to override if you do not want it.
*
* @deprecated This component is deprecated and will be removed in a future release. Avoid using it in new code.
*/
export declare const AddressAutocomplete: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<AddressAutocompleteProps, never>> & string & Omit<({ groupLabel, withTerritories, withCountry, stateFormat, className, addressInputs, hideLegend, isPrivate, ...rest }: AddressAutocompleteProps) => import("react/jsx-runtime").JSX.Element, keyof import("react").Component<any, {}, any>>;
export {};