Skip to content

Commit

Permalink
docs: drop primtive-hooks docs (#1206)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Nov 22, 2024
1 parent 379a553 commit 90f1c0c
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 337 deletions.
134 changes: 1 addition & 133 deletions apps/docs/content/docs/ui/primitives/ActionBar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useActionBarEdit`

Provides the `Edit` functionality as a hook.

```tsx
import { useActionBarEdit } from "@assistant-ui/react";

const Edit = () => {
const edit = useActionBarEdit();

// edit action is not available
if (!edit) return null;

return <button onClick={edit}>Edit</button>;
};
```

### Reload

Regenerates the assistant message.
Expand All @@ -145,24 +128,7 @@ This primitive renders a `<button>` element unless `asChild` is set.
name: "asChild",
},
]}
/>

#### `useActionBarReload`

Provides the `Reload` functionality as a hook.

```tsx
import { useActionBarReload } from "@assistant-ui/react";

const Reload = () => {
const reload = useActionBarReload();

// reload action is not available
if (!reload) return null;

return <button onClick={reload}>Reload</button>;
};
```
/>{" "}

### Copy

Expand Down Expand Up @@ -219,36 +185,6 @@ or using the `data-copied` attribute:
</ActionBarPrimitive.Copy>
```

#### `useActionBarCopy`

Provides the `Copy` functionality as a hook.

```tsx
import { useActionBarCopy } from "@assistant-ui/react";

const Copy = () => {
const copy = useActionBarCopy({ copiedDuration: 3000 });

// copy action is not available
if (!copy) return null;

return <button onClick={copy}>Copy</button>;
};
```

<ParametersTable
type="UseActionBarCopyProps"
parameters={[
{
name: "copiedDuration",
type: "number",
description:
"The duration in milliseconds in which the message status is set to 'copied'.",
default: "3000",
},
]}
/>

### Speak

Plays the message text as speech.
Expand All @@ -264,23 +200,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useActionBarSpeak`

Provides the `Speak` functionality as a hook.

```tsx
import { useActionBarSpeak } from "@assistant-ui/react";

const Speak = () => {
const speak = useActionBarSpeak();

// speak action is not available
if (!speak) return null;

return <button onClick={speak}>Speak</button>;
};
```

### StopSpeaking

Stops the message text from being played as speech.
Expand All @@ -296,23 +215,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useActionBarStopSpeaking`

Provides the `StopSpeaking` functionality as a hook.

```tsx
import { useActionBarStopSpeaking } from "@assistant-ui/react";

const StopSpeaking = () => {
const stopSpeaking = useActionBarStopSpeaking();

// stopSpeaking action is not available
if (!stopSpeaking) return null;

return <button onClick={stopSpeaking}>Stop speaking</button>;
};
```

### Feedback Positive

Shows a positive feedback submission button.
Expand All @@ -337,23 +239,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useActionBarFeedbackPositive`

Provides the `FeedbackPositive` functionality as a hook.

```tsx
import { useActionBarFeedbackPositive } from "@assistant-ui/react";

const FeedbackPositive = () => {
const feedbackPositive = useActionBarFeedbackPositive();

// feedbackPositive action is not available
if (!feedbackPositive) return null;

return <button onClick={feedbackPositive}>Feedback Positive</button>;
};
```

### Feedback Negative

Shows a negative feedback submission button.
Expand All @@ -377,20 +262,3 @@ This primitive renders a `<button>` element unless `asChild` is set.
},
]}
/>

#### `useActionBarFeedbackNegative`

Provides the `FeedbackNegative` functionality as a hook.

```tsx
import { useActionBarFeedbackNegative } from "@assistant-ui/react";

const FeedbackNegative = () => {
const feedbackNegative = useActionBarFeedbackNegative();

// feedbackNegative action is not available
if (!feedbackNegative) return null;

return <button onClick={feedbackNegative}>Feedback Negative</button>;
};
```
17 changes: 0 additions & 17 deletions apps/docs/content/docs/ui/primitives/Attachment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,3 @@ This primitive renders a `<button>` element unless `asChild` is set.
},
]}
/>

#### `useAttachmentRemove`

Provides the `Remove` functionality as a hook.

```tsx
import { useAttachmentRemove } from "@assistant-ui/react";

const Remove = () => {
const remove = useAttachmentRemove();

// remove action is not available
if (!remove) return null;

return <button onClick={remove}>Remove</button>;
};
```
54 changes: 0 additions & 54 deletions apps/docs/content/docs/ui/primitives/BranchPicker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,12 @@ The current branch number.

This primitive renders the raw number as a string.

#### `useBranchPickerNumber`

```tsx
import { useBranchPickerNumber } from "@assistant-ui/react";

const Number = () => {
const number = useBranchPickerNumber();

return <span>{number}</span>;
};
```

### Count

The total number of branches.

This primitive renders the raw number as a string.

#### `useBranchPickerCount`

```tsx
import { useBranchPickerCount } from "@assistant-ui/react";

const Count = () => {
const count = useBranchPickerCount();

return <span>{count}</span>;
};
```

### Previous

Navigates to the previous branch.
Expand All @@ -95,21 +71,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useBranchPickerPrevious`

```tsx
import { useBranchPickerPrevious } from "@assistant-ui/react";

const Previous = () => {
const previous = useBranchPickerPrevious();

// previous action is not available
if (!previous) return null;

return <button onClick={previous}>Previous</button>;
};
```

### Next

Navigates to the next branch.
Expand All @@ -124,18 +85,3 @@ This primitive renders a `<button>` element unless `asChild` is set.
},
]}
/>

#### `useBranchPickerNext`

```tsx
import { useBranchPickerNext } from "@assistant-ui/react";

const Next = () => {
const next = useBranchPickerNext();

// next action is not available
if (!next) return null;

return <button onClick={next}>Next</button>;
};
```
47 changes: 0 additions & 47 deletions apps/docs/content/docs/ui/primitives/Composer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,6 @@ This primitive renders a `<form>` element unless `asChild` is set.
]}
/>

#### `useComposerSend`

```tsx
import { useComposerSend } from "@assistant-ui/react";

const Send = () => {
const send = useComposerSend();

const handleSubmit = (e: FormEvent) => {
// send action is not available
if (!send) return;

e.preventDefault();
send();
};

return <form onSubmit={handleSubmit}>...</form>;
};
```

### Input

The text input field for the user to type a new message.
Expand Down Expand Up @@ -139,21 +119,6 @@ This primitive renders a `<button>` element unless `asChild` is set.
]}
/>

#### `useComposerCancel`

```tsx
import { useComposerCancel } from "@assistant-ui/react";

const Cancel = () => {
const cancel = useComposerCancel();

// cancel action is not available
if (!cancel) return null;

return <button onClick={cancel}>Cancel</button>;
};
```

### Attachments

Renders attachments. This primitive renders a separate component for each attachment.
Expand Down Expand Up @@ -231,15 +196,3 @@ Renders children if a condition is met.
```tsx
<Composer.If editing>{/* rendered if message is being edited */}</Composer.If>
```

#### `useComposerIf`

```tsx
import { useComposerIf } from "@assistant-ui/react";

const Composer = () => {
const isEditing = useComposerIf((c) => c.isEditing);

return isEditing ? <Editing /> : <NotEditing />;
};
```
14 changes: 0 additions & 14 deletions apps/docs/content/docs/ui/primitives/Message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { MessagePrimitive } from "@assistant-ui/react";
const UserMessage = () => (
<MessagePrimitive.Root>
User: <MessagePrimitive.Content />

<BranchPicker />
<ActionBar />
</MessagePrimitive.Root>
Expand All @@ -23,7 +22,6 @@ const UserMessage = () => (
const AssistantMessage = () => (
<MessagePrimitive.Root>
Assistant: <MessagePrimitive.Content />

<BranchPicker />
<ActionBar />
</MessagePrimitive.Root>
Expand Down Expand Up @@ -161,15 +159,3 @@ Renders children if a condition is met.
{/* rendered if message is from the assistant */}
</Message.If>
```

#### `useMessageIf`

```tsx
import { useMessageIf } from "@assistant-ui/react";

const Message = () => {
const isUser = useMessageIf({ user: true });

return isUser ? <UserMessage /> : <AssistantMessage />;
};
```
Loading

0 comments on commit 90f1c0c

Please sign in to comment.