Skip to content

Commit 542d8ee

Browse files
authored
Merge pull request #51 from buildo/fixes-3
More fixes for HM integration
2 parents 3542ef3 + 8b54cde commit 542d8ee

File tree

8 files changed

+17
-14
lines changed

8 files changed

+17
-14
lines changed

src/List/createInternalList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Inset, Stack } from "../internal";
22
import { Children } from "../";
3-
import { ListConfig, ListProps } from "./createList";
3+
import { ListConfig, ListProps } from "./createListComponents";
44

55
type Props = Omit<ListProps, "items" | "size"> & {
66
children: Children;
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type ListConfig = {
1616
item: ListItemConfig;
1717
};
1818

19-
export function createList(
19+
export function createListComponents(
2020
config: ListConfig = {
2121
paddingY: 8,
2222
item: {
@@ -41,15 +41,17 @@ export function createList(
4141
) {
4242
const InternalList = createInternalList(config);
4343
const ListItem = createListItem(config.item);
44-
return function List({ items, ...props }: Props) {
44+
function List({ items, ...props }: Props) {
4545
return (
4646
<InternalList {...props}>
4747
{items.map((liProps) => (
4848
<ListItem key={liProps.label} {...liProps} size={props.size} />
4949
))}
5050
</InternalList>
5151
);
52-
};
52+
}
53+
54+
return { List, ListItem };
5355
}
5456

5557
export type { Props as ListProps };

src/List/createListItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Box, Columns, Column, Inset, Stack, BentoSprinkles } from "../internal"
55
import { IconProps } from "../Icons/IconProps";
66
import { IllustrationProps } from "../Illustrations/IllustrationProps";
77
import { listItemRecipe } from "./ListItem.css";
8-
import { ListSize } from "./createList";
8+
import { ListSize } from "./createListComponents";
99

1010
type Kind =
1111
| {
@@ -47,7 +47,7 @@ export type Props = Kind &
4747
disabled?: boolean;
4848
size: ListSize;
4949
isFocused?: boolean;
50-
ignoreTabIndex: boolean;
50+
ignoreTabIndex?: boolean;
5151
} & (
5252
| {
5353
onPress?: () => void;

src/SelectField/components.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export function createComponents(inputConfig: InputConfig, dropdownConfig: Dropd
165165
<defaultComponents.Option {...props}>
166166
<ListItem
167167
{...props.data}
168-
size={props.selectProps.size}
168+
size={props.selectProps.menuSize ?? "medium"}
169169
onPress={() => props.selectOption(props.data)}
170170
trailingIcon={props.isSelected ? IconCheck : undefined}
171171
isFocused={props.isFocused}

src/SelectField/createSelectField.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type { Props as SelectFieldProps };
3939

4040
declare module "react-select/dist/declarations/src/Select" {
4141
export interface Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> {
42-
size: ListSize;
42+
menuSize?: ListSize;
4343
validationState: "valid" | "invalid";
4444
multiValueMessage?: (numberOfSelectedOptions: number) => LocalizedString;
4545
}
@@ -162,7 +162,7 @@ export function createSelectField(
162162
}
163163
closeMenuOnSelect={!isMulti}
164164
hideSelectedOptions={false}
165-
size={size}
165+
menuSize={size}
166166
/>
167167
</Field>
168168
);

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ export * from "./Illustrations/svgIllustrationProps";
2323
export * from "./InlineLoader/InlineLoader";
2424
export * from "./Layout/createLayoutComponents";
2525
export * from "./Link/createLink";
26-
export * from "./List/createList";
26+
export * from "./List/createListComponents";
2727
export * from "./Modal/createModal";
28+
export * from "./Modal/useModalContext";
2829
export * from "./NumberInput/createNumberInput";
2930
export * from "./Placeholder/Placeholder";
3031
export * from "./SearchBar/createSearchBar";

stories/Components/SelectField.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Illustration(props: IllustrationProps) {
1313
const { defaultExport, createControlledStory } = createComponentStories({
1414
component: SelectField,
1515
args: {
16-
size: "large",
16+
menuSize: "large",
1717
name: "color",
1818
label: formatMessage("What's your favorite color?"),
1919
placeholder: formatMessage("Select a color"),
@@ -60,7 +60,7 @@ export default defaultExport;
6060

6161
export const LargeMenu = createControlledStory(undefined, {});
6262

63-
export const MediumMenu = createControlledStory(undefined, { size: "medium" });
63+
export const MediumMenu = createControlledStory(undefined, { menuSize: "medium" });
6464

6565
export const Disabled = createControlledStory(undefined, {
6666
disabled: true,

stories/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
createToast,
1414
createModal,
1515
createChip,
16-
createList,
16+
createListComponents,
1717
createDisclosure,
1818
createDisclosureGroup,
1919
createTooltip,
@@ -51,7 +51,7 @@ export const Link = createLink();
5151
export const Breadcrumb = createBreadcrumb(Link);
5252
export const Modal = createModal(Actions);
5353
export const Chip = createChip();
54-
export const List = createList();
54+
export const { List } = createListComponents();
5555
export const Disclosure = createDisclosure();
5656
export const DisclosureGroup = createDisclosureGroup(Disclosure);
5757
export const Tooltip = createTooltip();

0 commit comments

Comments
 (0)