Skip to content

Commit

Permalink
[DS-487] Renamed Sections (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicky-comeau authored Nov 28, 2024
2 parents 709b356 + 6aeb750 commit 478f081
Show file tree
Hide file tree
Showing 33 changed files with 169 additions and 211 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-islands-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hopper-ui/components": patch
---

There is no longer a generic Section component. We now have ListBoxSection, SelectSection and ComboBoxSection.
6 changes: 5 additions & 1 deletion apps/docs/content/components/collections/Listbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ links:

A `ListBox` uses the following components.

<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Section", "Text"]}/>
<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Text"]}/>

## Usage

Expand Down Expand Up @@ -170,6 +170,10 @@ List box items can vary in sizes.

<PropTable component="ListBox" />

### ListBoxSection

<PropTable component="ListBoxSection" />

### ListBoxItem

<PropTable component="ListBoxItem" />
Expand Down
57 changes: 0 additions & 57 deletions apps/docs/content/components/collections/Section.mdx

This file was deleted.

12 changes: 11 additions & 1 deletion apps/docs/content/components/pickers/ComboBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The Section component represents a `section` within a Hopper container.

A `ComboBox` uses the following components.

<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Section", "Text"]}/>
<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Text"]}/>

## Usage

Expand Down Expand Up @@ -197,5 +197,15 @@ A combo box item can have a description.

## Props

### ComboBox

<PropTable component="ComboBox" />

### ComboBoxSection

<PropTable component="ListBoxSection" />

### ComboBoxItem

<PropTable component="ListBoxItem" />

12 changes: 11 additions & 1 deletion apps/docs/content/components/pickers/Select.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The Section component represents a `section` within a Hopper container.

A `Select` uses the following components.

<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Section", "Text"]}/>
<ComposedComponents components={["Avatar", "Badge", "Header", "Icon", "Text"]}/>

## Usage

Expand Down Expand Up @@ -198,8 +198,18 @@ A select item can have a description.

## Props

### Select

<PropTable component="Select" />

### SelectSection

<PropTable component="ListBoxSection" />

### SelectItem

<PropTable component="ListBoxItem" />

## Migration Notes

<MigrateGuide src="Select/docs/migration-notes" />
3 changes: 0 additions & 3 deletions apps/docs/examples/Preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ export const Previews: Record<string, Preview> = {
"ListBox/docs/multipleSizes": {
component: lazy(() => import("@/../../packages/components/src/ListBox/docs/multipleSizes.tsx"))
},
"Section/docs/preview": {
component: lazy(() => import("@/../../packages/components/src/Section/docs/preview.tsx"))
},
"tag/docs/preview": {
component: lazy(() => import("@/../../packages/components/src/tag/docs/preview.tsx"))
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Collection, ComboBox, ComboBoxItem, Header, Inline, Section } from "@hopper-ui/components";
import { Collection, ComboBox, ComboBoxItem, ComboBoxSection, Header, Inline } from "@hopper-ui/components";

interface ListItemProps {
id: number | string;
Expand Down Expand Up @@ -57,12 +57,12 @@ export default function Example() {
const { role: sectionName, children } = section;

return (
<Section id={sectionName}>
<ComboBoxSection id={sectionName}>
<Header>{sectionName}</Header>
<Collection items={children}>
{item => <ComboBoxItem id={item.id}>{item.role}</ComboBoxItem>}
</Collection>
</Section>
</ComboBoxSection>
);
}}
</ComboBox>
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/ComboBox/docs/ComboBoxOption/section.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { ComboBox, ComboBoxItem, Header, Section } from "@hopper-ui/components";
import { ComboBox, ComboBoxItem, ComboBoxSection, Header } from "@hopper-ui/components";

export default function Example() {
return (
<ComboBox label="Roles">
<ComboBoxItem id="developer">Developer</ComboBoxItem>
<ComboBoxItem id="manager">Manager</ComboBoxItem>
<Section>
<ComboBoxSection>
<Header>Operations</Header>
<ComboBoxItem id="project-coordinator">Project Coordinator</ComboBoxItem>
<ComboBoxItem id="qa-specialist">QA Specialist</ComboBoxItem>
</Section>
<Section>
</ComboBoxSection>
<ComboBoxSection>
<Header>Creative Department</Header>
<ComboBoxItem id="designer">Designer</ComboBoxItem>
<ComboBoxItem id="copywriter">Copywriter</ComboBoxItem>
<ComboBoxItem id="ux-researcher">UX Researcher</ComboBoxItem>
</Section>
</ComboBoxSection>
</ComboBox>
);
}
6 changes: 3 additions & 3 deletions packages/components/src/ComboBox/docs/allowCustomValue.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ComboBox, ComboBoxItem, Header, Section } from "@hopper-ui/components";
import { ComboBox, ComboBoxItem, ComboBoxSection, Header } from "@hopper-ui/components";

export default function Example() {
return (
<ComboBox allowsCustomValue label="Roles">
<Section key="1">
<ComboBoxSection key="1">
<Header>Creative Department</Header>
<ComboBoxItem id="1">Designer</ComboBoxItem>
<ComboBoxItem id="2">Content creator</ComboBoxItem>
</Section>
</ComboBoxSection>
<ComboBoxItem key="2" id="3">Manager</ComboBoxItem>
</ComboBox>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/ComboBox/docs/controlled.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComboBox, ComboBoxItem, Header, type Key, Section } from "@hopper-ui/components";
import { ComboBox, ComboBoxItem, ComboBoxSection, Header, type Key } from "@hopper-ui/components";
import { useState } from "react";

export default function Example() {
Expand All @@ -14,11 +14,11 @@ export default function Example() {

return (
<ComboBox selectedKey={selectedKey} onSelectionChange={handleSelectionChange} label="Roles">
<Section key="1">
<ComboBoxSection key="1">
<Header>Operations</Header>
<ComboBoxItem id="1">Project Coordinator</ComboBoxItem>
<ComboBoxItem id="2">QA Specialist</ComboBoxItem>
</Section>
</ComboBoxSection>
<ComboBoxItem key="2" id="3">Manager</ComboBoxItem>
</ComboBox>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/ComboBox/src/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useFormProps } from "../../Form/index.ts";
import { HelperMessage } from "../../HelperMessage/index.ts";
import { Footer } from "../../layout/index.ts";
import { ListBox, ListBoxItem, type ListBoxProps, type SelectionIndicator } from "../../ListBox/index.ts";
import { ListBoxSection } from "../../ListBoxSection/index.ts";
import { Popover, type PopoverProps } from "../../overlays/index.ts";
import { ToggleArrow } from "../../ToggleArrow/index.ts";
import { Label, TextContext } from "../../typography/index.ts";
Expand Down Expand Up @@ -383,4 +384,4 @@ const _ComboBox = forwardRef(ComboBox) as <T extends object>(
) => ReturnType<typeof ComboBox>;
(_ComboBox as NamedExoticComponent).displayName = "ComboBox";

export { _ComboBox as ComboBox, ListBoxItem as ComboBoxItem };
export { _ComboBox as ComboBox, ListBoxItem as ComboBoxItem, ListBoxSection as ComboBoxSection };
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, ComboBox, ComboBoxItem, type ComboBoxProps, Header, Inline, Section, Stack, Text } from "@hopper-ui/components";
import { Button, ComboBox, ComboBoxItem, type ComboBoxProps, ComboBoxSection, Header, Inline, Stack, Text } from "@hopper-ui/components";
import { AddIcon, SparklesIcon } from "@hopper-ui/icons";
import { Div } from "@hopper-ui/styled-system";
import type { Meta, StoryFn, StoryObj } from "@storybook/react";
Expand Down Expand Up @@ -62,19 +62,19 @@ export const OnlyItems = {
export const Sections = {
render: args => (
<ComboBox {...args}>
<Section>
<ComboBoxSection>
<Header>Cats</Header>
<ComboBoxItem id="1">Zoomy</ComboBoxItem>
<ComboBoxItem id="2">Voodoo</ComboBoxItem>
<ComboBoxItem id="3">Dusty</ComboBoxItem>
<ComboBoxItem id="4">Rengar</ComboBoxItem>
</Section>
<Section>
</ComboBoxSection>
<ComboBoxSection>
<Header>Dogs</Header>
<ComboBoxItem id="5">Teemo</ComboBoxItem>
<ComboBoxItem id="6">Scooter</ComboBoxItem>
<ComboBoxItem id="7">Prince</ComboBoxItem>
</Section>
</ComboBoxSection>
</ComboBox>
),
play: playFn,
Expand Down Expand Up @@ -112,19 +112,19 @@ export const FieldHelperMessage = {
export const Footer = {
render: args => (
<ComboBox {...args}>
<Section>
<ComboBoxSection>
<Header>Cats</Header>
<ComboBoxItem id="1">Zoomy</ComboBoxItem>
<ComboBoxItem id="2">Voodoo</ComboBoxItem>
<ComboBoxItem id="3">Dusty</ComboBoxItem>
<ComboBoxItem id="4">Rengar</ComboBoxItem>
</Section>
<Section>
</ComboBoxSection>
<ComboBoxSection>
<Header>Dogs</Header>
<ComboBoxItem id="5">Teemo</ComboBoxItem>
<ComboBoxItem id="6">Scooter</ComboBoxItem>
<ComboBoxItem id="7">Prince</ComboBoxItem>
</Section>
</ComboBoxSection>
</ComboBox>
),
play: playFn,
Expand All @@ -138,19 +138,19 @@ export const Small = {
play: playFn,
render: args => (
<ComboBox {...args}>
<Section>
<ComboBoxSection>
<Header>Cats</Header>
<ComboBoxItem id="1">Zoomy</ComboBoxItem>
<ComboBoxItem id="2">Voodoo</ComboBoxItem>
<ComboBoxItem id="3">Dusty</ComboBoxItem>
<ComboBoxItem id="4">Rengar</ComboBoxItem>
</Section>
<Section>
</ComboBoxSection>
<ComboBoxSection>
<Header>Dogs</Header>
<ComboBoxItem id="5">Teemo</ComboBoxItem>
<ComboBoxItem id="6">Scooter</ComboBoxItem>
<ComboBoxItem id="7">Prince</ComboBoxItem>
</Section>
</ComboBoxSection>
</ComboBox>
),
args: {
Expand All @@ -165,19 +165,19 @@ export const Medium = {
play: playFn,
render: args => (
<ComboBox {...args}>
<Section>
<ComboBoxSection>
<Header>Cats</Header>
<ComboBoxItem id="1">Zoomy</ComboBoxItem>
<ComboBoxItem id="2">Voodoo</ComboBoxItem>
<ComboBoxItem id="3">Dusty</ComboBoxItem>
<ComboBoxItem id="4">Rengar</ComboBoxItem>
</Section>
<Section>
</ComboBoxSection>
<ComboBoxSection>
<Header>Dogs</Header>
<ComboBoxItem id="5">Teemo</ComboBoxItem>
<ComboBoxItem id="6">Scooter</ComboBoxItem>
<ComboBoxItem id="7">Prince</ComboBoxItem>
</Section>
</ComboBoxSection>
</ComboBox>
),
args: {
Expand Down
Loading

0 comments on commit 478f081

Please sign in to comment.