Skip to content

Commit

Permalink
Export base input components
Browse files Browse the repository at this point in the history
  • Loading branch information
federico-ercoles committed Nov 29, 2023
1 parent e6a05c2 commit fa3ddc8
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = BaseNumberProps & {
disabled?: boolean;
} & FormatProps;

export function InternalNumberInput(props: Props) {
export function BaseNumberInput(props: Props) {
const config = useBentoConfig().input;
const { locale } = useLocale();

Expand Down
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/NumberField/NumberField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FieldProps } from "../Field/FieldProps";
import { BaseNumberProps, FormatProps } from "./types";
import { useFormatOptions } from "./formatOptions";
import { Field } from "../Field/Field";
import { InternalNumberInput } from "./InternalNumberInput";
import { BaseNumberInput } from "./BaseNumberInput";

type Props = FieldProps<number | undefined, number> &
BaseNumberProps &
Expand Down Expand Up @@ -42,7 +42,7 @@ export function NumberField(props: Props) {
assistiveTextProps={descriptionProps}
errorMessageProps={errorMessageProps}
>
<InternalNumberInput
<BaseNumberInput
inputProps={inputProps}
inputRef={inputRef}
validationState={validationState}
Expand Down
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/NumberField/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLocale } from "@react-aria/i18n";
import { useFormatOptions } from "./formatOptions";
import { HTMLAttributes, useRef } from "react";
import { useNumberField } from "@react-aria/numberfield";
import { InternalNumberInput } from "./InternalNumberInput";
import { BaseNumberInput } from "./BaseNumberInput";
import { AtLeast } from "../util/AtLeast";

type Props = AtLeast<Pick<HTMLAttributes<HTMLInputElement>, "aria-label" | "aria-labelledby">> &
Expand Down Expand Up @@ -34,7 +34,7 @@ export function NumberInput(props: Props) {
inputRef
);

return <InternalNumberInput inputProps={inputProps} inputRef={inputRef} {...props} />;
return <BaseNumberInput inputProps={inputProps} inputRef={inputRef} {...props} />;
}

export type { Props as NumberInputProps };
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props<A> = BaseSelectProps<A> & {
validationState: "valid" | "invalid";
} & (SingleProps<A> | MultiProps<A>);

export function InternalSelect<A>(props: Props<A>) {
export function BaseSelect<A>(props: Props<A>) {
const dropdownConfig = useBentoConfig().dropdown;
const { defaultMessages } = useDefaultMessages();

Expand Down
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/SelectField/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ListSize, LocalizedString } from "..";
import { useField } from "@react-aria/label";
import { FieldProps } from "../Field/FieldProps";
import { Field } from "../Field/Field";
import { InternalSelect } from "./InternalSelect";
import { BaseSelect } from "./BaseSelect";
import { BaseMultiProps, BaseSelectProps, BaseSingleProps } from "./types";

type MultiProps<A> = BaseMultiProps & FieldProps<A[]>;
Expand Down Expand Up @@ -51,7 +51,7 @@ export function SelectField<A>(props: Props<A>) {
disabled={disabled}
{...hintProps}
>
<InternalSelect fieldProps={fieldProps} validationState={validationState} {...props} />
<BaseSelect fieldProps={fieldProps} validationState={validationState} {...props} />
</Field>
);
}
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/SelectField/SelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FieldProps } from "../Field/FieldProps";
import { BaseMultiProps, BaseSelectProps, BaseSingleProps } from "./types";
import { AtLeast } from "../util/AtLeast";
import { HTMLAttributes } from "react";
import { InternalSelect } from "./InternalSelect";
import { BaseSelect } from "./BaseSelect";

type MultiProps<A> = BaseMultiProps &
Pick<FieldProps<A[]>, "autoFocus" | "disabled" | "name" | "onBlur" | "onChange" | "value">;
Expand All @@ -24,7 +24,7 @@ export function SelectInput<A>(props: Props<A>) {
...props,
});

return <InternalSelect fieldProps={fieldProps} {...props} />;
return <BaseSelect fieldProps={fieldProps} {...props} />;
}

export type { Props as SelectInputProps };
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Props = {
hidePasswordLabel?: never;
};

export function InternalTextInput(props: Props) {
export function BaseTextInput(props: Props) {
const config = useBentoConfig().input;
const { defaultMessages } = useDefaultMessages();

Expand Down
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRef } from "react";
import { Field, Children } from "..";
import { LocalizedString } from "../util/LocalizedString";
import { FieldProps } from "../Field/FieldProps";
import { InternalTextInput } from "./InternalTextInput";
import { BaseTextInput } from "./BaseTextInput";

type Props = FieldProps<string> & {
placeholder?: LocalizedString;
Expand Down Expand Up @@ -37,7 +37,7 @@ export function TextField(props: Props) {
assistiveTextProps={descriptionProps}
errorMessageProps={errorMessageProps}
>
<InternalTextInput
<BaseTextInput
inputProps={inputProps}
inputRef={inputRef}
validationState={validationState}
Expand Down
4 changes: 2 additions & 2 deletions packages/bento-design-system/src/TextField/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HTMLAttributes, useRef } from "react";
import { AtLeast } from "../util/AtLeast";
import { FieldProps } from "../Field/FieldProps";
import { InternalTextInput } from "./InternalTextInput";
import { BaseTextInput } from "./BaseTextInput";
import { useTextField } from "@react-aria/textfield";
import { LocalizedString } from "../util/LocalizedString";
import { Children } from "../util/Children";
Expand Down Expand Up @@ -34,7 +34,7 @@ export function TextInput(props: Props) {
inputRef
);

return <InternalTextInput inputProps={inputProps} inputRef={inputRef} {...props} />;
return <BaseTextInput inputProps={inputProps} inputRef={inputRef} {...props} />;
}

export type { Props as TextInputProps };
3 changes: 3 additions & 0 deletions packages/bento-design-system/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export * from "./List/ListItem";
export * from "./Menu/Menu";
export * from "./Modal/Modal";
export * from "./Navigation/Navigation";
export * from "./NumberField/BaseNumberInput";
export * from "./NumberField/NumberField";
export * from "./NumberField/NumberInput";
export * from "./Pagination/Pagination";
Expand All @@ -61,6 +62,7 @@ export * from "./ProgressBar/ProgressBar";
export * from "./RadioGroupField/RadioGroupField";
export * from "./ReadOnlyField/ReadOnlyField";
export * from "./SearchBar/SearchBar";
export * from "./SelectField/BaseSelect";
export * from "./SelectField/SelectField";
export * from "./SelectField/SelectInput";
export * from "./Slider/Slider";
Expand All @@ -71,6 +73,7 @@ export * from "./Table/Table";
export * from "./Tabs/Tabs";
export { bentoSprinkles } from "./internal/sprinkles.css";
export * from "./TextArea/TextArea";
export * from "./TextField/BaseTextInput";
export * from "./TextField/TextField";
export * from "./TextField/TextInput";
export * from "./TimeField/TimeField";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IconMinus,
IconPlus,
NumberFieldProps,
NumberInput,
BaseNumberInput,
} from "@buildo/bento-design-system";
import { useRef } from "react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -61,7 +61,7 @@ export function CounterField(props: Omit<NumberFieldProps, "kind" | "currency">)
}}
/>
</Column>
<NumberInput
<BaseNumberInput
inputProps={inputProps}
inputRef={inputRef}
validationState={validationState}
Expand Down

0 comments on commit fa3ddc8

Please sign in to comment.