moi-computer 0.11.0 → 0.11.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/AGENTS.md +2 -2
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/chat/ChatPanel.tsx +6 -6
- package/client/features/chat/ChatPopup.tsx +3 -4
- package/client/features/chat/TurnView.tsx +5 -4
- package/client/features/chat/api.ts +5 -14
- package/client/features/chat/chat-frames.ts +5 -2
- package/client/features/chat/composer/ChatComposer.tsx +5 -1
- package/client/features/chat/composer/ModelPicker.tsx +4 -3
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/group-turns.ts +11 -0
- package/client/features/chat/session-view.ts +53 -0
- package/client/features/chat/useChat.ts +5 -1
- package/client/features/dev/ChatStatesPage.tsx +3 -1
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +834 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +4 -1
- package/client/features/views/ViewManager.tsx +14 -9
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +1 -3
- package/client/features/workspace/WorkspaceScreen.tsx +5 -1
- package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
- package/client/features/workspace/api.ts +2 -4
- package/client/index.css +22 -29
- package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
- package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
- package/dist/chunk-6664vxpk.css +1 -0
- package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
- package/dist/chunk-a6jad1a6.js +1 -0
- package/dist/chunk-dghwstd2.js +9 -0
- package/dist/chunk-eg120aca.js +1 -0
- package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
- package/dist/chunk-vwjeezeb.js +1 -0
- package/dist/chunk-w482ew2c.js +546 -0
- package/dist/chunk-yc471zah.js +70 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +49 -1
- package/lib/themes.ts +6 -6
- package/lib/types.ts +5 -7
- package/package.json +17 -7
- package/registry.json +643 -0
- package/server/AGENTS.md +1 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +25 -29
- package/server/applets.ts +30 -29
- package/server/bundler/applet-css.ts +6 -1
- package/server/bundler/build-applet.ts +5 -1
- package/server/bundler/build-worker.ts +178 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +6 -11
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +13 -9
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +18 -6
- package/server/harness/claude-code/NOTES.md +47 -12
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +11 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +408 -299
- package/server/harness/hermes/NOTES.md +18 -0
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +9 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/types.ts +4 -2
- package/server/moi-scaffold.ts +1 -1
- package/server/preview.ts +3 -1
- package/server/registry.ts +63 -41
- package/server/scratchpad-executor.ts +79 -56
- package/server/scratchpad-shape-defaults.ts +82 -0
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/view-builders.ts +2 -1
- package/server/web.ts +9 -5
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +27 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +265 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +37 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +26 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-r5xrenjy.css +0 -1
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Radio Group
|
|
3
|
+
description: A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
|
|
4
|
+
base: base
|
|
5
|
+
component: true
|
|
6
|
+
links:
|
|
7
|
+
doc: https://base-ui.com/react/components/radio-group
|
|
8
|
+
api: https://base-ui.com/react/components/radio-group#api-reference
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Label } from '@/components/ui/label'
|
|
13
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
14
|
+
|
|
15
|
+
export function RadioGroupDemo() {
|
|
16
|
+
return (
|
|
17
|
+
<RadioGroup defaultValue="comfortable" className="w-fit">
|
|
18
|
+
<div className="flex items-center gap-3">
|
|
19
|
+
<RadioGroupItem value="default" id="r1" />
|
|
20
|
+
<Label htmlFor="r1">Default</Label>
|
|
21
|
+
</div>
|
|
22
|
+
<div className="flex items-center gap-3">
|
|
23
|
+
<RadioGroupItem value="comfortable" id="r2" />
|
|
24
|
+
<Label htmlFor="r2">Comfortable</Label>
|
|
25
|
+
</div>
|
|
26
|
+
<div className="flex items-center gap-3">
|
|
27
|
+
<RadioGroupItem value="compact" id="r3" />
|
|
28
|
+
<Label htmlFor="r3">Compact</Label>
|
|
29
|
+
</div>
|
|
30
|
+
</RadioGroup>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
<CodeTabs>
|
|
38
|
+
|
|
39
|
+
<TabsList>
|
|
40
|
+
<TabsTrigger value="cli">Command</TabsTrigger>
|
|
41
|
+
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
42
|
+
</TabsList>
|
|
43
|
+
<TabsContent value="cli">
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
moi ui-components add radio-group
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
</TabsContent>
|
|
50
|
+
|
|
51
|
+
<TabsContent value="manual">
|
|
52
|
+
|
|
53
|
+
<Steps className="mb-0 pt-2">
|
|
54
|
+
|
|
55
|
+
<Step>Install the following dependencies:</Step>
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install @base-ui/react
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
<Step>Copy and paste the following code into your project.</Step>
|
|
62
|
+
|
|
63
|
+
<ComponentSource
|
|
64
|
+
name="radio-group"
|
|
65
|
+
title="components/ui/radio-group.tsx"
|
|
66
|
+
styleName="base-nova"
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<Step>Update the import paths to match your project setup.</Step>
|
|
70
|
+
|
|
71
|
+
</Steps>
|
|
72
|
+
|
|
73
|
+
</TabsContent>
|
|
74
|
+
|
|
75
|
+
</CodeTabs>
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
```tsx showLineNumbers
|
|
80
|
+
import { Label } from '@/components/ui/label'
|
|
81
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```tsx showLineNumbers
|
|
85
|
+
<RadioGroup defaultValue="option-one">
|
|
86
|
+
<div className="flex items-center gap-3">
|
|
87
|
+
<RadioGroupItem value="option-one" id="option-one" />
|
|
88
|
+
<Label htmlFor="option-one">Option One</Label>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="flex items-center gap-3">
|
|
91
|
+
<RadioGroupItem value="option-two" id="option-two" />
|
|
92
|
+
<Label htmlFor="option-two">Option Two</Label>
|
|
93
|
+
</div>
|
|
94
|
+
</RadioGroup>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Composition
|
|
98
|
+
|
|
99
|
+
Use the following composition to build a `RadioGroup`:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
RadioGroup
|
|
103
|
+
├── RadioGroupItem
|
|
104
|
+
└── RadioGroupItem
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Description
|
|
108
|
+
|
|
109
|
+
Radio group items with a description using the `Field` component.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { Field, FieldContent, FieldDescription, FieldLabel } from '@/components/ui/field'
|
|
113
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
114
|
+
|
|
115
|
+
export function RadioGroupDescription() {
|
|
116
|
+
return (
|
|
117
|
+
<RadioGroup defaultValue="comfortable" className="w-fit">
|
|
118
|
+
<Field orientation="horizontal">
|
|
119
|
+
<RadioGroupItem value="default" id="desc-r1" />
|
|
120
|
+
<FieldContent>
|
|
121
|
+
<FieldLabel htmlFor="desc-r1">Default</FieldLabel>
|
|
122
|
+
<FieldDescription>Standard spacing for most use cases.</FieldDescription>
|
|
123
|
+
</FieldContent>
|
|
124
|
+
</Field>
|
|
125
|
+
<Field orientation="horizontal">
|
|
126
|
+
<RadioGroupItem value="comfortable" id="desc-r2" />
|
|
127
|
+
<FieldContent>
|
|
128
|
+
<FieldLabel htmlFor="desc-r2">Comfortable</FieldLabel>
|
|
129
|
+
<FieldDescription>More space between elements.</FieldDescription>
|
|
130
|
+
</FieldContent>
|
|
131
|
+
</Field>
|
|
132
|
+
<Field orientation="horizontal">
|
|
133
|
+
<RadioGroupItem value="compact" id="desc-r3" />
|
|
134
|
+
<FieldContent>
|
|
135
|
+
<FieldLabel htmlFor="desc-r3">Compact</FieldLabel>
|
|
136
|
+
<FieldDescription>Minimal spacing for dense layouts.</FieldDescription>
|
|
137
|
+
</FieldContent>
|
|
138
|
+
</Field>
|
|
139
|
+
</RadioGroup>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Choice Card
|
|
145
|
+
|
|
146
|
+
Use `FieldLabel` to wrap the entire `Field` for a clickable card-style selection.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import {
|
|
150
|
+
Field,
|
|
151
|
+
FieldContent,
|
|
152
|
+
FieldDescription,
|
|
153
|
+
FieldLabel,
|
|
154
|
+
FieldTitle
|
|
155
|
+
} from '@/components/ui/field'
|
|
156
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
157
|
+
|
|
158
|
+
export function RadioGroupChoiceCard() {
|
|
159
|
+
return (
|
|
160
|
+
<RadioGroup defaultValue="plus" className="max-w-sm">
|
|
161
|
+
<FieldLabel htmlFor="plus-plan">
|
|
162
|
+
<Field orientation="horizontal">
|
|
163
|
+
<FieldContent>
|
|
164
|
+
<FieldTitle>Plus</FieldTitle>
|
|
165
|
+
<FieldDescription>For individuals and small teams.</FieldDescription>
|
|
166
|
+
</FieldContent>
|
|
167
|
+
<RadioGroupItem value="plus" id="plus-plan" />
|
|
168
|
+
</Field>
|
|
169
|
+
</FieldLabel>
|
|
170
|
+
<FieldLabel htmlFor="pro-plan">
|
|
171
|
+
<Field orientation="horizontal">
|
|
172
|
+
<FieldContent>
|
|
173
|
+
<FieldTitle>Pro</FieldTitle>
|
|
174
|
+
<FieldDescription>For growing businesses.</FieldDescription>
|
|
175
|
+
</FieldContent>
|
|
176
|
+
<RadioGroupItem value="pro" id="pro-plan" />
|
|
177
|
+
</Field>
|
|
178
|
+
</FieldLabel>
|
|
179
|
+
<FieldLabel htmlFor="enterprise-plan">
|
|
180
|
+
<Field orientation="horizontal">
|
|
181
|
+
<FieldContent>
|
|
182
|
+
<FieldTitle>Enterprise</FieldTitle>
|
|
183
|
+
<FieldDescription>For large teams and enterprises.</FieldDescription>
|
|
184
|
+
</FieldContent>
|
|
185
|
+
<RadioGroupItem value="enterprise" id="enterprise-plan" />
|
|
186
|
+
</Field>
|
|
187
|
+
</FieldLabel>
|
|
188
|
+
</RadioGroup>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Fieldset
|
|
194
|
+
|
|
195
|
+
Use `FieldSet` and `FieldLegend` to group radio items with a label and description.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { Field, FieldDescription, FieldLabel, FieldLegend, FieldSet } from '@/components/ui/field'
|
|
199
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
200
|
+
|
|
201
|
+
export function RadioGroupFieldset() {
|
|
202
|
+
return (
|
|
203
|
+
<FieldSet className="w-full max-w-xs">
|
|
204
|
+
<FieldLegend variant="label">Subscription Plan</FieldLegend>
|
|
205
|
+
<FieldDescription>Yearly and lifetime plans offer significant savings.</FieldDescription>
|
|
206
|
+
<RadioGroup defaultValue="monthly">
|
|
207
|
+
<Field orientation="horizontal">
|
|
208
|
+
<RadioGroupItem value="monthly" id="plan-monthly" />
|
|
209
|
+
<FieldLabel htmlFor="plan-monthly" className="font-normal">
|
|
210
|
+
Monthly ($9.99/month)
|
|
211
|
+
</FieldLabel>
|
|
212
|
+
</Field>
|
|
213
|
+
<Field orientation="horizontal">
|
|
214
|
+
<RadioGroupItem value="yearly" id="plan-yearly" />
|
|
215
|
+
<FieldLabel htmlFor="plan-yearly" className="font-normal">
|
|
216
|
+
Yearly ($99.99/year)
|
|
217
|
+
</FieldLabel>
|
|
218
|
+
</Field>
|
|
219
|
+
<Field orientation="horizontal">
|
|
220
|
+
<RadioGroupItem value="lifetime" id="plan-lifetime" />
|
|
221
|
+
<FieldLabel htmlFor="plan-lifetime" className="font-normal">
|
|
222
|
+
Lifetime ($299.99)
|
|
223
|
+
</FieldLabel>
|
|
224
|
+
</Field>
|
|
225
|
+
</RadioGroup>
|
|
226
|
+
</FieldSet>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Disabled
|
|
232
|
+
|
|
233
|
+
Use the `disabled` prop on `RadioGroup` to disable all items.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { Field, FieldLabel } from '@/components/ui/field'
|
|
237
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
238
|
+
|
|
239
|
+
export function RadioGroupDisabled() {
|
|
240
|
+
return (
|
|
241
|
+
<RadioGroup defaultValue="option2" className="w-fit">
|
|
242
|
+
<Field orientation="horizontal" data-disabled>
|
|
243
|
+
<RadioGroupItem value="option1" id="disabled-1" disabled />
|
|
244
|
+
<FieldLabel htmlFor="disabled-1" className="font-normal">
|
|
245
|
+
Disabled
|
|
246
|
+
</FieldLabel>
|
|
247
|
+
</Field>
|
|
248
|
+
<Field orientation="horizontal">
|
|
249
|
+
<RadioGroupItem value="option2" id="disabled-2" />
|
|
250
|
+
<FieldLabel htmlFor="disabled-2" className="font-normal">
|
|
251
|
+
Option 2
|
|
252
|
+
</FieldLabel>
|
|
253
|
+
</Field>
|
|
254
|
+
<Field orientation="horizontal">
|
|
255
|
+
<RadioGroupItem value="option3" id="disabled-3" />
|
|
256
|
+
<FieldLabel htmlFor="disabled-3" className="font-normal">
|
|
257
|
+
Option 3
|
|
258
|
+
</FieldLabel>
|
|
259
|
+
</Field>
|
|
260
|
+
</RadioGroup>
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Invalid
|
|
266
|
+
|
|
267
|
+
Use `aria-invalid` on `RadioGroupItem` and `data-invalid` on `Field` to show validation errors.
|
|
268
|
+
|
|
269
|
+
```tsx
|
|
270
|
+
import { Field, FieldDescription, FieldLabel, FieldLegend, FieldSet } from '@/components/ui/field'
|
|
271
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
272
|
+
|
|
273
|
+
export function RadioGroupInvalid() {
|
|
274
|
+
return (
|
|
275
|
+
<FieldSet className="w-full max-w-xs">
|
|
276
|
+
<FieldLegend variant="label">Notification Preferences</FieldLegend>
|
|
277
|
+
<FieldDescription>Choose how you want to receive notifications.</FieldDescription>
|
|
278
|
+
<RadioGroup defaultValue="email">
|
|
279
|
+
<Field orientation="horizontal" data-invalid>
|
|
280
|
+
<RadioGroupItem value="email" id="invalid-email" aria-invalid />
|
|
281
|
+
<FieldLabel htmlFor="invalid-email" className="font-normal">
|
|
282
|
+
Email only
|
|
283
|
+
</FieldLabel>
|
|
284
|
+
</Field>
|
|
285
|
+
<Field orientation="horizontal" data-invalid>
|
|
286
|
+
<RadioGroupItem value="sms" id="invalid-sms" aria-invalid />
|
|
287
|
+
<FieldLabel htmlFor="invalid-sms" className="font-normal">
|
|
288
|
+
SMS only
|
|
289
|
+
</FieldLabel>
|
|
290
|
+
</Field>
|
|
291
|
+
<Field orientation="horizontal" data-invalid>
|
|
292
|
+
<RadioGroupItem value="both" id="invalid-both" aria-invalid />
|
|
293
|
+
<FieldLabel htmlFor="invalid-both" className="font-normal">
|
|
294
|
+
Both Email & SMS
|
|
295
|
+
</FieldLabel>
|
|
296
|
+
</Field>
|
|
297
|
+
</RadioGroup>
|
|
298
|
+
</FieldSet>
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## RTL
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
'use client'
|
|
307
|
+
|
|
308
|
+
import * as React from 'react'
|
|
309
|
+
|
|
310
|
+
import { useTranslation, type Translations } from '@/components/language-selector'
|
|
311
|
+
import { Field, FieldContent, FieldDescription, FieldLabel } from '@/components/ui/field'
|
|
312
|
+
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
|
313
|
+
|
|
314
|
+
const translations: Translations = {
|
|
315
|
+
en: {
|
|
316
|
+
dir: 'ltr',
|
|
317
|
+
values: {
|
|
318
|
+
default: 'Default',
|
|
319
|
+
defaultDescription: 'Standard spacing for most use cases.',
|
|
320
|
+
comfortable: 'Comfortable',
|
|
321
|
+
comfortableDescription: 'More space between elements.',
|
|
322
|
+
compact: 'Compact',
|
|
323
|
+
compactDescription: 'Minimal spacing for dense layouts.'
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
ar: {
|
|
327
|
+
dir: 'rtl',
|
|
328
|
+
values: {
|
|
329
|
+
default: 'افتراضي',
|
|
330
|
+
defaultDescription: 'تباعد قياسي لمعظم حالات الاستخدام.',
|
|
331
|
+
comfortable: 'مريح',
|
|
332
|
+
comfortableDescription: 'مساحة أكبر بين العناصر.',
|
|
333
|
+
compact: 'مضغوط',
|
|
334
|
+
compactDescription: 'تباعد أدنى للتخطيطات الكثيفة.'
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
he: {
|
|
338
|
+
dir: 'rtl',
|
|
339
|
+
values: {
|
|
340
|
+
default: 'ברירת מחדל',
|
|
341
|
+
defaultDescription: 'ריווח סטנדרטי לרוב מקרי השימוש.',
|
|
342
|
+
comfortable: 'נוח',
|
|
343
|
+
comfortableDescription: 'יותר מקום בין האלמנטים.',
|
|
344
|
+
compact: 'קומפקטי',
|
|
345
|
+
compactDescription: 'ריווח מינימלי לפריסות צפופות.'
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function RadioGroupRtl() {
|
|
351
|
+
const { dir, t } = useTranslation(translations, 'ar')
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<RadioGroup defaultValue="comfortable" className="w-fit" dir={dir}>
|
|
355
|
+
<Field orientation="horizontal">
|
|
356
|
+
<RadioGroupItem value="default" id="r1-rtl" dir={dir} />
|
|
357
|
+
<FieldContent>
|
|
358
|
+
<FieldLabel htmlFor="r1-rtl" dir={dir}>
|
|
359
|
+
{t.default}
|
|
360
|
+
</FieldLabel>
|
|
361
|
+
<FieldDescription dir={dir}>{t.defaultDescription}</FieldDescription>
|
|
362
|
+
</FieldContent>
|
|
363
|
+
</Field>
|
|
364
|
+
<Field orientation="horizontal">
|
|
365
|
+
<RadioGroupItem value="comfortable" id="r2-rtl" dir={dir} />
|
|
366
|
+
<FieldContent>
|
|
367
|
+
<FieldLabel htmlFor="r2-rtl" dir={dir}>
|
|
368
|
+
{t.comfortable}
|
|
369
|
+
</FieldLabel>
|
|
370
|
+
<FieldDescription dir={dir}>{t.comfortableDescription}</FieldDescription>
|
|
371
|
+
</FieldContent>
|
|
372
|
+
</Field>
|
|
373
|
+
<Field orientation="horizontal">
|
|
374
|
+
<RadioGroupItem value="compact" id="r3-rtl" dir={dir} />
|
|
375
|
+
<FieldContent>
|
|
376
|
+
<FieldLabel htmlFor="r3-rtl" dir={dir}>
|
|
377
|
+
{t.compact}
|
|
378
|
+
</FieldLabel>
|
|
379
|
+
<FieldDescription dir={dir}>{t.compactDescription}</FieldDescription>
|
|
380
|
+
</FieldContent>
|
|
381
|
+
</Field>
|
|
382
|
+
</RadioGroup>
|
|
383
|
+
)
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## API Reference
|
|
388
|
+
|
|
389
|
+
See the [Base UI Radio Group](https://base-ui.com/react/components/radio-group#api-reference) documentation.
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Resizable
|
|
3
|
+
description: Accessible resizable panel groups and layouts with keyboard support.
|
|
4
|
+
base: base
|
|
5
|
+
component: true
|
|
6
|
+
links:
|
|
7
|
+
doc: https://github.com/bvaughn/react-resizable-panels
|
|
8
|
+
api: https://github.com/bvaughn/react-resizable-panels/tree/main/packages/react-resizable-panels
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
|
|
13
|
+
|
|
14
|
+
export function ResizableDemo() {
|
|
15
|
+
return (
|
|
16
|
+
<ResizablePanelGroup orientation="horizontal" className="max-w-sm rounded-lg border">
|
|
17
|
+
<ResizablePanel defaultSize="50%">
|
|
18
|
+
<div className="flex h-[200px] items-center justify-center p-6">
|
|
19
|
+
<span className="font-semibold">One</span>
|
|
20
|
+
</div>
|
|
21
|
+
</ResizablePanel>
|
|
22
|
+
<ResizableHandle />
|
|
23
|
+
<ResizablePanel defaultSize="50%">
|
|
24
|
+
<ResizablePanelGroup orientation="vertical">
|
|
25
|
+
<ResizablePanel defaultSize="25%">
|
|
26
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
27
|
+
<span className="font-semibold">Two</span>
|
|
28
|
+
</div>
|
|
29
|
+
</ResizablePanel>
|
|
30
|
+
<ResizableHandle />
|
|
31
|
+
<ResizablePanel defaultSize="75%">
|
|
32
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
33
|
+
<span className="font-semibold">Three</span>
|
|
34
|
+
</div>
|
|
35
|
+
</ResizablePanel>
|
|
36
|
+
</ResizablePanelGroup>
|
|
37
|
+
</ResizablePanel>
|
|
38
|
+
</ResizablePanelGroup>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## About
|
|
44
|
+
|
|
45
|
+
The `Resizable` component is built on top of [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels) by [bvaughn](https://github.com/bvaughn).
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
<CodeTabs>
|
|
50
|
+
|
|
51
|
+
<TabsList>
|
|
52
|
+
<TabsTrigger value="cli">Command</TabsTrigger>
|
|
53
|
+
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
54
|
+
</TabsList>
|
|
55
|
+
<TabsContent value="cli">
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
moi ui-components add resizable
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</TabsContent>
|
|
62
|
+
|
|
63
|
+
<TabsContent value="manual">
|
|
64
|
+
|
|
65
|
+
<Steps className="mb-0 pt-2">
|
|
66
|
+
|
|
67
|
+
<Step>Install the following dependencies:</Step>
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install react-resizable-panels
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<Step>Copy and paste the following code into your project.</Step>
|
|
74
|
+
|
|
75
|
+
<ComponentSource
|
|
76
|
+
name="resizable"
|
|
77
|
+
title="components/ui/resizable.tsx"
|
|
78
|
+
styleName="base-nova"
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
<Step>Update the import paths to match your project setup.</Step>
|
|
82
|
+
|
|
83
|
+
</Steps>
|
|
84
|
+
|
|
85
|
+
</TabsContent>
|
|
86
|
+
|
|
87
|
+
</CodeTabs>
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
```tsx showLineNumbers
|
|
92
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```tsx showLineNumbers
|
|
96
|
+
<ResizablePanelGroup orientation="horizontal">
|
|
97
|
+
<ResizablePanel>One</ResizablePanel>
|
|
98
|
+
<ResizableHandle />
|
|
99
|
+
<ResizablePanel>Two</ResizablePanel>
|
|
100
|
+
</ResizablePanelGroup>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Composition
|
|
104
|
+
|
|
105
|
+
Use the following composition to build a `ResizablePanelGroup`:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
ResizablePanelGroup
|
|
109
|
+
├── ResizablePanel
|
|
110
|
+
├── ResizableHandle
|
|
111
|
+
└── ResizablePanel
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Vertical
|
|
115
|
+
|
|
116
|
+
Use `orientation="vertical"` for vertical resizing.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
|
|
120
|
+
|
|
121
|
+
export function ResizableVertical() {
|
|
122
|
+
return (
|
|
123
|
+
<ResizablePanelGroup
|
|
124
|
+
orientation="vertical"
|
|
125
|
+
className="min-h-[200px] max-w-sm rounded-lg border"
|
|
126
|
+
>
|
|
127
|
+
<ResizablePanel defaultSize="25%">
|
|
128
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
129
|
+
<span className="font-semibold">Header</span>
|
|
130
|
+
</div>
|
|
131
|
+
</ResizablePanel>
|
|
132
|
+
<ResizableHandle />
|
|
133
|
+
<ResizablePanel defaultSize="75%">
|
|
134
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
135
|
+
<span className="font-semibold">Content</span>
|
|
136
|
+
</div>
|
|
137
|
+
</ResizablePanel>
|
|
138
|
+
</ResizablePanelGroup>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Invisible divider
|
|
144
|
+
|
|
145
|
+
The divider is visible by default. Use `showDivider={false}` to keep the resize target without showing the divider.
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
|
|
149
|
+
|
|
150
|
+
export function ResizableInvisibleDividerDemo() {
|
|
151
|
+
return (
|
|
152
|
+
<ResizablePanelGroup
|
|
153
|
+
orientation="horizontal"
|
|
154
|
+
className="min-h-[200px] max-w-sm rounded-lg border"
|
|
155
|
+
>
|
|
156
|
+
<ResizablePanel defaultSize="25%">
|
|
157
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
158
|
+
<span className="font-semibold">Sidebar</span>
|
|
159
|
+
</div>
|
|
160
|
+
</ResizablePanel>
|
|
161
|
+
<ResizableHandle showDivider={false} />
|
|
162
|
+
<ResizablePanel defaultSize="75%">
|
|
163
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
164
|
+
<span className="font-semibold">Content</span>
|
|
165
|
+
</div>
|
|
166
|
+
</ResizablePanel>
|
|
167
|
+
</ResizablePanelGroup>
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## RTL
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
'use client'
|
|
176
|
+
|
|
177
|
+
import * as React from 'react'
|
|
178
|
+
|
|
179
|
+
import { useTranslation, type Translations } from '@/components/language-selector'
|
|
180
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'
|
|
181
|
+
|
|
182
|
+
const translations: Translations = {
|
|
183
|
+
en: {
|
|
184
|
+
dir: 'ltr',
|
|
185
|
+
values: {
|
|
186
|
+
one: 'One',
|
|
187
|
+
two: 'Two',
|
|
188
|
+
three: 'Three'
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
ar: {
|
|
192
|
+
dir: 'rtl',
|
|
193
|
+
values: {
|
|
194
|
+
one: 'واحد',
|
|
195
|
+
two: 'اثنان',
|
|
196
|
+
three: 'ثلاثة'
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
he: {
|
|
200
|
+
dir: 'rtl',
|
|
201
|
+
values: {
|
|
202
|
+
one: 'אחד',
|
|
203
|
+
two: 'שניים',
|
|
204
|
+
three: 'שלושה'
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function ResizableRtl() {
|
|
210
|
+
const { dir, t } = useTranslation(translations, 'ar')
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<ResizablePanelGroup orientation="horizontal" className="max-w-sm rounded-lg border" dir={dir}>
|
|
214
|
+
<ResizablePanel defaultSize="50%">
|
|
215
|
+
<div className="flex h-[200px] items-center justify-center p-6">
|
|
216
|
+
<span className="font-semibold">{t.one}</span>
|
|
217
|
+
</div>
|
|
218
|
+
</ResizablePanel>
|
|
219
|
+
<ResizableHandle />
|
|
220
|
+
<ResizablePanel defaultSize="50%">
|
|
221
|
+
<ResizablePanelGroup orientation="vertical" dir={dir}>
|
|
222
|
+
<ResizablePanel defaultSize="25%">
|
|
223
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
224
|
+
<span className="font-semibold">{t.two}</span>
|
|
225
|
+
</div>
|
|
226
|
+
</ResizablePanel>
|
|
227
|
+
<ResizableHandle />
|
|
228
|
+
<ResizablePanel defaultSize="75%">
|
|
229
|
+
<div className="flex h-full items-center justify-center p-6">
|
|
230
|
+
<span className="font-semibold">{t.three}</span>
|
|
231
|
+
</div>
|
|
232
|
+
</ResizablePanel>
|
|
233
|
+
</ResizablePanelGroup>
|
|
234
|
+
</ResizablePanel>
|
|
235
|
+
</ResizablePanelGroup>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## API Reference
|
|
241
|
+
|
|
242
|
+
See the [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels/tree/main/packages/react-resizable-panels) documentation.
|
|
243
|
+
|
|
244
|
+
## Changelog
|
|
245
|
+
|
|
246
|
+
### 2025-02-02 `react-resizable-panels` v4
|
|
247
|
+
|
|
248
|
+
Updated to `react-resizable-panels` v4. See the [v4.0.0 release notes](https://github.com/bvaughn/react-resizable-panels/releases/tag/4.0.0) for full details.
|
|
249
|
+
|
|
250
|
+
If you're using `react-resizable-panels` primitives directly, note the following changes:
|
|
251
|
+
|
|
252
|
+
| v3 | v4 |
|
|
253
|
+
| ---------------------------- | ----------------------- |
|
|
254
|
+
| `PanelGroup` | `Group` |
|
|
255
|
+
| `PanelResizeHandle` | `Separator` |
|
|
256
|
+
| `direction` prop | `orientation` prop |
|
|
257
|
+
| `defaultSize={50}` | `defaultSize="50%"` |
|
|
258
|
+
| `onLayout` | `onLayoutChange` |
|
|
259
|
+
| `ImperativePanelHandle` | `PanelImperativeHandle` |
|
|
260
|
+
| `ref` prop on Panel | `panelRef` prop |
|
|
261
|
+
| `data-panel-group-direction` | `aria-orientation` |
|
|
262
|
+
|
|
263
|
+
<Callout>
|
|
264
|
+
This wrapper uses the v4 primitive names and props shown above.
|
|
265
|
+
</Callout>
|