@workbench-kit/react 0.0.1-prototype.0 → 0.0.2-prototype.0.1.2
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/package.json +33 -9
- package/src/index.ts +545 -43
- package/src/jdw/JdwPreview.tsx +38 -0
- package/src/jdw/JsonCodeEditorPane.tsx +274 -0
- package/src/jdw/builtins/renderBuiltinWidgetLeaf.tsx +29 -0
- package/src/jdw/builtins/renderBuiltinWidgetNode.tsx +126 -0
- package/src/jdw/createBuiltinJdwRegistry.ts +111 -0
- package/src/jdw/cssRenderBackend.tsx +134 -0
- package/src/jdw/document.ts +38 -0
- package/src/jdw/fixtures/jdw-fixtures.ts +52 -0
- package/src/jdw/fixtures/jdw-sample-screens.ts +522 -0
- package/src/jdw/index.ts +45 -0
- package/src/jdw/parse.ts +1 -0
- package/src/jdw/renderJdw.tsx +32 -0
- package/src/json-config/JsonConfigWorkbench.tsx +316 -0
- package/src/json-config/index.ts +6 -0
- package/src/json-config/json-config-editor-state.ts +42 -0
- package/src/layout/Panel.tsx +146 -1
- package/src/layout/SideBarViewFrame.tsx +367 -328
- package/src/layout/WorkbenchCanvas.tsx +849 -0
- package/src/layout/WorkbenchFullscreen.tsx +368 -0
- package/src/layout/WorkbenchLayout.tsx +5 -0
- package/src/layout/WorkbenchLayoutBase.tsx +294 -0
- package/src/layout/WorkbenchPropertyPanel.tsx +497 -0
- package/src/layout/WorkbenchSidebarActions.tsx +274 -0
- package/src/layout/WorkbenchTree.tsx +351 -0
- package/src/layout/layoutHelpers.ts +25 -0
- package/src/modal/ConfirmDialog.tsx +61 -53
- package/src/modal/Modal.tsx +295 -35
- package/src/overlay/ContextMenu.tsx +146 -145
- package/src/primitives/AbsoluteBox.tsx +46 -0
- package/src/primitives/Badge.tsx +12 -12
- package/src/primitives/Button.tsx +44 -14
- package/src/primitives/Checkbox.tsx +11 -5
- package/src/primitives/EmptyState.tsx +27 -26
- package/src/primitives/Field.tsx +38 -38
- package/src/primitives/IconButton.tsx +5 -2
- package/src/primitives/List.tsx +111 -0
- package/src/primitives/NumberInput.tsx +38 -0
- package/src/primitives/ScrollArea.tsx +42 -0
- package/src/primitives/Select.tsx +1 -12
- package/src/primitives/StatusBar.tsx +46 -0
- package/src/primitives/TextArea.tsx +36 -0
- package/src/primitives/TextInput.tsx +11 -2
- package/src/primitives/WorkbenchChrome.tsx +424 -0
- package/src/primitives/WorkbenchEditor.tsx +394 -0
- package/src/primitives/index.ts +105 -0
- package/src/primitives/select/Select.tsx +266 -0
- package/src/primitives/select/index.ts +2 -0
- package/src/primitives/select/options.ts +38 -0
- package/src/primitives/select/overlay.ts +63 -0
- package/src/primitives/select/select.app.css +9 -0
- package/src/primitives/select/select.css +140 -0
- package/src/primitives/select/types.ts +18 -0
- package/src/primitives/styles.css +955 -0
- package/src/scrollbars.css +69 -0
- package/src/styles.css +7738 -1762
- package/src/utils/codicon.ts +17 -0
- package/src/widget-asset/WidgetAssetEditor.tsx +140 -0
- package/src/widget-asset/WidgetAssetMetadataForm.tsx +82 -0
- package/src/widget-asset/WidgetAssetModeControls.tsx +42 -0
- package/src/widget-asset/WidgetAssetSourceEditor.tsx +50 -0
- package/src/widget-asset/WidgetAssetWorkbench.tsx +112 -0
- package/src/widget-asset/index.ts +17 -0
- package/src/widget-asset/widget-asset-document.ts +37 -0
- package/src/widget-asset/widget-asset-mode.ts +3 -0
- package/src/widget-studio/builtin-widget-asset-catalog.ts +12 -0
- package/src/widget-studio/create-widget-studio-workspace-editor.tsx +79 -0
- package/src/widget-studio/index.ts +7 -0
- package/src/widget-studio/resolve-widget-studio-asset-catalog.ts +26 -0
- package/src/widget-tree/WidgetAssetPalette.tsx +77 -0
- package/src/widget-tree/WidgetInspectorPanel.tsx +266 -0
- package/src/widget-tree/WidgetSourceEditor.tsx +56 -0
- package/src/widget-tree/WidgetTreeLab.tsx +272 -0
- package/src/widget-tree/WidgetTreeModeControls.tsx +44 -0
- package/src/widget-tree/WidgetTreeSidePanel.tsx +49 -0
- package/src/widget-tree/WidgetTreeView.tsx +97 -0
- package/src/widget-tree/WidgetTreeWorkbench.tsx +111 -0
- package/src/widget-tree/WidgetTreeWorkspaceShell.tsx +154 -0
- package/src/widget-tree/demo-registry.ts +32 -0
- package/src/widget-tree/demo-widget-assets.ts +4 -0
- package/src/widget-tree/index.ts +27 -0
- package/src/widget-tree/widget-tree-document.ts +20 -0
- package/src/widget-tree/widget-tree-layout.ts +31 -0
- package/src/widget-tree/widget-tree-mode.ts +7 -0
- package/src/widget-tree/widget-tree-play-helpers.ts +74 -0
- package/src/workbench/ActivityBar.tsx +52 -52
- package/src/workbench/ArtifactShell.tsx +397 -0
- package/src/workbench/CommandPalette.tsx +819 -0
- package/src/workbench/ConfirmationFlow.tsx +245 -0
- package/src/workbench/MarkdownPreview.tsx +151 -0
- package/src/workbench/ShortcutCommandBridge.tsx +368 -0
- package/src/workbench/SplitView.tsx +136 -136
- package/src/workbench/StatusBar.tsx +178 -123
- package/src/workbench/StructuredArtifactEditor.tsx +205 -0
- package/src/workbench/Timeline.tsx +302 -0
- package/src/workbench/WorkbenchCanvasShell.tsx +941 -0
- package/src/workbench/WorkbenchShell.tsx +74 -70
- package/src/workbench/WorkbenchStandaloneShell.tsx +318 -291
- package/src/workbench/auth/WorkbenchAuthGate.tsx +61 -0
- package/src/workbench/auth/WorkbenchLoginView.tsx +635 -0
- package/src/workbench/auth/index.ts +19 -0
- package/src/workbench/chat/ChatComposer.tsx +165 -148
- package/src/workbench/chat/ChatMessageItem.tsx +10 -1
- package/src/workbench/chat/index.ts +9 -0
- package/src/workbench/chat/slashCommand.ts +28 -0
- package/src/workbench/chat/useChatRuntimeState.ts +76 -0
- package/src/workbench/chat/useSlashCommandSuggest.ts +101 -0
- package/src/workbench/commands.ts +520 -490
- package/src/workbench/index.ts +443 -98
- package/src/workbench/keyboard.ts +53 -0
- package/src/workbench/schema/index.ts +48 -0
- package/src/workbench/schema/workbenchDocument.ts +31 -0
- package/src/workbench/schema/workbenchDocumentActions.ts +6 -0
- package/src/workbench/schema/workbenchDocumentAdapter.ts +9 -0
- package/src/workbench/schema/workbenchDocumentPatch.ts +13 -0
- package/src/workbench/schema/workbenchDocumentRenderer.tsx +702 -0
- package/src/workbench/settings/NavigationPanel.tsx +47 -0
- package/src/workbench/settings/SchemaForm.tsx +420 -0
- package/src/workbench/settings/SectionedPanel.tsx +415 -0
- package/src/workbench/settings/StructuredDataForm.tsx +539 -0
- package/src/workbench/settings/StructuredDataSchemaPanel.tsx +559 -0
- package/src/workbench/settings/StructuredDataSchemaPanelEmbed.tsx +21 -0
- package/src/workbench/settings/StructuredDataSchemaPanelFrame.tsx +76 -0
- package/src/workbench/settings/StructuredDataTableView.tsx +127 -0
- package/src/workbench/settings/WorkbenchPanelRegion.tsx +46 -0
- package/src/workbench/settings/WorkbenchSettingsModal.tsx +21 -12
- package/src/workbench/settings/WorkbenchSettingsNav.tsx +38 -22
- package/src/workbench/settings/index.ts +135 -0
- package/src/workbench/settings/panel-region.css +21 -0
- package/src/workbench/settings/sectionedPanelScrollSpy.ts +143 -0
- package/src/workbench/settings/structured-data-schema-panel.css +330 -0
- package/src/workbench/settings/structured-data-table-view.css +85 -0
- package/src/workbench/settings/structuredDataSchema.ts +886 -0
- package/src/workbench/shell.ts +15 -0
- package/src/workbench/shellState.ts +203 -203
- package/src/workbench/standalone.ts +101 -94
- package/src/workbench/status.ts +129 -0
- package/src/workbench/theme.ts +44 -0
- package/src/workbench/workspace/MultiProviderExplorer.tsx +625 -0
- package/src/workbench/workspace/WorkspaceDraftsContext.tsx +111 -0
- package/src/workbench/workspace/WorkspaceEditor.tsx +47 -12
- package/src/workbench/workspace/WorkspaceEditorPanel.tsx +334 -353
- package/src/workbench/workspace/WorkspaceExplorer.tsx +532 -524
- package/src/workbench/workspace/WorkspaceFileIcon.tsx +32 -2
- package/src/workbench/workspace/WorkspaceSearchPanel.tsx +113 -113
- package/src/workbench/workspace/WorkspaceSearchResults.tsx +47 -47
- package/src/workbench/workspace/index.ts +156 -98
- package/src/workbench/workspace/mimeType.ts +45 -0
- package/src/workbench/workspace/path.ts +10 -10
- package/src/workbench/workspace/search.ts +6 -6
- package/src/workbench/workspace/tree.ts +1 -1
- package/src/workbench/workspace/types.ts +10 -10
- package/src/workbench/workspace/useVirtualWorkspace.ts +111 -98
- package/src/workbench/workspace/workspaceJsonDiagnostics.ts +83 -0
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { Button } from '../primitives/Button';
|
|
3
|
+
import type { ButtonProps } from '../primitives/Button';
|
|
4
|
+
import { Checkbox } from '../primitives/Checkbox';
|
|
5
|
+
import { Field } from '../primitives/Field';
|
|
6
|
+
import type { FieldProps } from '../primitives/Field';
|
|
7
|
+
import { NumberInput } from '../primitives/NumberInput';
|
|
8
|
+
import { Select } from '../primitives/Select';
|
|
9
|
+
import { TextInput } from '../primitives/TextInput';
|
|
10
|
+
import type { ControlWidth } from '../primitives/TextInput';
|
|
11
|
+
import { cx } from '../utils/cx';
|
|
12
|
+
|
|
13
|
+
export type WorkbenchPropertyRowProps = FieldProps;
|
|
14
|
+
|
|
15
|
+
export function WorkbenchPropertyRow({ className, ...props }: WorkbenchPropertyRowProps) {
|
|
16
|
+
return <Field className={cx('ui-workbench-property-row', className)} {...props} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface WorkbenchPropertyTextRowProps extends Omit<WorkbenchPropertyRowProps, 'children'> {
|
|
20
|
+
controlWidth?: ControlWidth;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
onValueChange?: (value: string) => void;
|
|
23
|
+
placeholder?: string | undefined;
|
|
24
|
+
readOnly?: boolean | undefined;
|
|
25
|
+
value: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function WorkbenchPropertyTextRow({
|
|
29
|
+
controlWidth = 'full',
|
|
30
|
+
disabled,
|
|
31
|
+
onValueChange,
|
|
32
|
+
placeholder,
|
|
33
|
+
readOnly,
|
|
34
|
+
value,
|
|
35
|
+
...props
|
|
36
|
+
}: WorkbenchPropertyTextRowProps) {
|
|
37
|
+
return (
|
|
38
|
+
<WorkbenchPropertyRow {...props}>
|
|
39
|
+
<TextInput
|
|
40
|
+
controlWidth={controlWidth}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
placeholder={placeholder}
|
|
43
|
+
readOnly={readOnly}
|
|
44
|
+
value={value}
|
|
45
|
+
onValueChange={onValueChange}
|
|
46
|
+
/>
|
|
47
|
+
</WorkbenchPropertyRow>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface WorkbenchPropertyNumberRowProps extends Omit<
|
|
52
|
+
WorkbenchPropertyRowProps,
|
|
53
|
+
'children'
|
|
54
|
+
> {
|
|
55
|
+
controlWidth?: ControlWidth;
|
|
56
|
+
disabled?: boolean | undefined;
|
|
57
|
+
max?: number | undefined;
|
|
58
|
+
min?: number | undefined;
|
|
59
|
+
onValueChange: (value: number) => void;
|
|
60
|
+
step?: number | string | undefined;
|
|
61
|
+
value?: number | undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function WorkbenchPropertyNumberRow({
|
|
65
|
+
controlWidth = 'full',
|
|
66
|
+
disabled,
|
|
67
|
+
max,
|
|
68
|
+
min,
|
|
69
|
+
onValueChange,
|
|
70
|
+
step,
|
|
71
|
+
value,
|
|
72
|
+
...props
|
|
73
|
+
}: WorkbenchPropertyNumberRowProps) {
|
|
74
|
+
return (
|
|
75
|
+
<WorkbenchPropertyRow {...props}>
|
|
76
|
+
<NumberInput
|
|
77
|
+
controlWidth={controlWidth}
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
max={max}
|
|
80
|
+
min={min}
|
|
81
|
+
step={step}
|
|
82
|
+
value={value}
|
|
83
|
+
onValueChange={onValueChange}
|
|
84
|
+
/>
|
|
85
|
+
</WorkbenchPropertyRow>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface WorkbenchPropertyRangeRowProps extends Omit<
|
|
90
|
+
WorkbenchPropertyRowProps,
|
|
91
|
+
'children'
|
|
92
|
+
> {
|
|
93
|
+
controlWidth?: ControlWidth;
|
|
94
|
+
disabled?: boolean | undefined;
|
|
95
|
+
max?: number | undefined;
|
|
96
|
+
min?: number | undefined;
|
|
97
|
+
onValueChange: (value: number) => void;
|
|
98
|
+
step?: number | string | undefined;
|
|
99
|
+
value?: number | undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function WorkbenchPropertyRangeRow({
|
|
103
|
+
controlWidth = 'full',
|
|
104
|
+
disabled,
|
|
105
|
+
max,
|
|
106
|
+
min,
|
|
107
|
+
onValueChange,
|
|
108
|
+
step,
|
|
109
|
+
value,
|
|
110
|
+
...props
|
|
111
|
+
}: WorkbenchPropertyRangeRowProps) {
|
|
112
|
+
return (
|
|
113
|
+
<WorkbenchPropertyRow {...props}>
|
|
114
|
+
<TextInput
|
|
115
|
+
controlWidth={controlWidth}
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
max={max}
|
|
118
|
+
min={min}
|
|
119
|
+
step={step}
|
|
120
|
+
type="range"
|
|
121
|
+
value={value}
|
|
122
|
+
onValueChange={(next) => {
|
|
123
|
+
const parsed = Number.parseFloat(next);
|
|
124
|
+
if (!Number.isNaN(parsed)) {
|
|
125
|
+
onValueChange(parsed);
|
|
126
|
+
}
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
</WorkbenchPropertyRow>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface WorkbenchPropertyColorRowProps extends Omit<
|
|
134
|
+
WorkbenchPropertyRowProps,
|
|
135
|
+
'children'
|
|
136
|
+
> {
|
|
137
|
+
disabled?: boolean | undefined;
|
|
138
|
+
fallbackValue?: string;
|
|
139
|
+
onValueChange: (value: string) => void;
|
|
140
|
+
value?: string | undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function WorkbenchPropertyColorRow({
|
|
144
|
+
disabled,
|
|
145
|
+
fallbackValue,
|
|
146
|
+
onValueChange,
|
|
147
|
+
value,
|
|
148
|
+
...props
|
|
149
|
+
}: WorkbenchPropertyColorRowProps) {
|
|
150
|
+
return (
|
|
151
|
+
<WorkbenchPropertyRow {...props}>
|
|
152
|
+
<WorkbenchColorInput
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
fallbackValue={fallbackValue ?? '#000000'}
|
|
155
|
+
value={value}
|
|
156
|
+
onValueChange={onValueChange}
|
|
157
|
+
/>
|
|
158
|
+
</WorkbenchPropertyRow>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface WorkbenchPropertySelectOption<TValue extends string = string> {
|
|
163
|
+
disabled?: boolean | undefined;
|
|
164
|
+
label: ReactNode;
|
|
165
|
+
value: TValue;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface WorkbenchPropertySelectRowProps<TValue extends string = string> extends Omit<
|
|
169
|
+
WorkbenchPropertyRowProps,
|
|
170
|
+
'children'
|
|
171
|
+
> {
|
|
172
|
+
controlWidth?: ControlWidth;
|
|
173
|
+
disabled?: boolean | undefined;
|
|
174
|
+
onValueChange: (value: TValue) => void;
|
|
175
|
+
options: readonly WorkbenchPropertySelectOption<TValue>[];
|
|
176
|
+
value?: TValue | undefined;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function WorkbenchPropertySelectRow<TValue extends string = string>({
|
|
180
|
+
controlWidth = 'full',
|
|
181
|
+
disabled,
|
|
182
|
+
onValueChange,
|
|
183
|
+
options,
|
|
184
|
+
value,
|
|
185
|
+
...props
|
|
186
|
+
}: WorkbenchPropertySelectRowProps<TValue>) {
|
|
187
|
+
return (
|
|
188
|
+
<WorkbenchPropertyRow {...props}>
|
|
189
|
+
<Select
|
|
190
|
+
controlWidth={controlWidth}
|
|
191
|
+
disabled={disabled}
|
|
192
|
+
value={value ?? options[0]?.value ?? ''}
|
|
193
|
+
onValueChange={(next) => onValueChange(next as TValue)}
|
|
194
|
+
>
|
|
195
|
+
{options.map((option) => (
|
|
196
|
+
<option key={option.value} disabled={option.disabled} value={option.value}>
|
|
197
|
+
{option.label}
|
|
198
|
+
</option>
|
|
199
|
+
))}
|
|
200
|
+
</Select>
|
|
201
|
+
</WorkbenchPropertyRow>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface WorkbenchPropertySelectActionRowProps<TValue extends string = string> extends Omit<
|
|
206
|
+
WorkbenchPropertyRowProps,
|
|
207
|
+
'children'
|
|
208
|
+
> {
|
|
209
|
+
actionDisabled?: boolean | undefined;
|
|
210
|
+
actionLabel: ReactNode;
|
|
211
|
+
actionTitle?: string | undefined;
|
|
212
|
+
controlWidth?: ControlWidth;
|
|
213
|
+
disabled?: boolean | undefined;
|
|
214
|
+
onAction: () => void;
|
|
215
|
+
onValueChange: (value: TValue) => void;
|
|
216
|
+
options: readonly WorkbenchPropertySelectOption<TValue>[];
|
|
217
|
+
value?: TValue | undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function WorkbenchPropertySelectActionRow<TValue extends string = string>({
|
|
221
|
+
actionDisabled,
|
|
222
|
+
actionLabel,
|
|
223
|
+
actionTitle,
|
|
224
|
+
controlWidth = 'full',
|
|
225
|
+
disabled,
|
|
226
|
+
onAction,
|
|
227
|
+
onValueChange,
|
|
228
|
+
options,
|
|
229
|
+
value,
|
|
230
|
+
...props
|
|
231
|
+
}: WorkbenchPropertySelectActionRowProps<TValue>) {
|
|
232
|
+
return (
|
|
233
|
+
<WorkbenchPropertyRow {...props}>
|
|
234
|
+
<WorkbenchPropertyInline>
|
|
235
|
+
<Select
|
|
236
|
+
controlWidth={controlWidth}
|
|
237
|
+
disabled={disabled}
|
|
238
|
+
value={value ?? options[0]?.value ?? ''}
|
|
239
|
+
onValueChange={(next) => onValueChange(next as TValue)}
|
|
240
|
+
>
|
|
241
|
+
{options.map((option) => (
|
|
242
|
+
<option key={option.value} disabled={option.disabled} value={option.value}>
|
|
243
|
+
{option.label}
|
|
244
|
+
</option>
|
|
245
|
+
))}
|
|
246
|
+
</Select>
|
|
247
|
+
<WorkbenchPropertyToggleButton
|
|
248
|
+
disabled={actionDisabled}
|
|
249
|
+
title={actionTitle}
|
|
250
|
+
type="button"
|
|
251
|
+
onClick={onAction}
|
|
252
|
+
>
|
|
253
|
+
{actionLabel}
|
|
254
|
+
</WorkbenchPropertyToggleButton>
|
|
255
|
+
</WorkbenchPropertyInline>
|
|
256
|
+
</WorkbenchPropertyRow>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface WorkbenchPropertyCheckboxRowProps extends Omit<
|
|
261
|
+
WorkbenchPropertyRowProps,
|
|
262
|
+
'children'
|
|
263
|
+
> {
|
|
264
|
+
checked?: boolean | undefined;
|
|
265
|
+
checkboxLabel?: ReactNode;
|
|
266
|
+
disabled?: boolean | undefined;
|
|
267
|
+
onCheckedChange: (checked: boolean) => void;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function WorkbenchPropertyCheckboxRow({
|
|
271
|
+
checked,
|
|
272
|
+
checkboxLabel,
|
|
273
|
+
disabled,
|
|
274
|
+
onCheckedChange,
|
|
275
|
+
...props
|
|
276
|
+
}: WorkbenchPropertyCheckboxRowProps) {
|
|
277
|
+
return (
|
|
278
|
+
<WorkbenchPropertyRow {...props}>
|
|
279
|
+
<Checkbox
|
|
280
|
+
checked={Boolean(checked)}
|
|
281
|
+
disabled={disabled}
|
|
282
|
+
label={checkboxLabel}
|
|
283
|
+
onCheckedChange={onCheckedChange}
|
|
284
|
+
/>
|
|
285
|
+
</WorkbenchPropertyRow>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface WorkbenchPropertyPanelProps extends ComponentPropsWithRef<'div'> {
|
|
290
|
+
empty?: boolean;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function WorkbenchPropertyPanel({
|
|
294
|
+
className,
|
|
295
|
+
empty = false,
|
|
296
|
+
...props
|
|
297
|
+
}: WorkbenchPropertyPanelProps) {
|
|
298
|
+
return (
|
|
299
|
+
<div
|
|
300
|
+
className={cx(
|
|
301
|
+
'ui-workbench-property-panel',
|
|
302
|
+
empty && 'ui-workbench-property-panel--empty',
|
|
303
|
+
className,
|
|
304
|
+
)}
|
|
305
|
+
{...props}
|
|
306
|
+
/>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export type WorkbenchSectionTitleProps = ComponentPropsWithRef<'div'>;
|
|
311
|
+
|
|
312
|
+
export function WorkbenchSectionTitle({ className, ...props }: WorkbenchSectionTitleProps) {
|
|
313
|
+
return <div className={cx('ui-workbench-section-title', className)} {...props} />;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export interface WorkbenchPropertySectionProps extends Omit<
|
|
317
|
+
ComponentPropsWithRef<'section'>,
|
|
318
|
+
'title'
|
|
319
|
+
> {
|
|
320
|
+
actions?: ReactNode;
|
|
321
|
+
bodyClassName?: string;
|
|
322
|
+
title?: ReactNode;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function WorkbenchPropertySection({
|
|
326
|
+
actions,
|
|
327
|
+
bodyClassName,
|
|
328
|
+
children,
|
|
329
|
+
className,
|
|
330
|
+
title,
|
|
331
|
+
...props
|
|
332
|
+
}: WorkbenchPropertySectionProps) {
|
|
333
|
+
return (
|
|
334
|
+
<section className={cx('ui-workbench-property-section', className)} {...props}>
|
|
335
|
+
{title || actions ? (
|
|
336
|
+
<div className="ui-workbench-property-section__header">
|
|
337
|
+
{title ? <WorkbenchSectionTitle>{title}</WorkbenchSectionTitle> : null}
|
|
338
|
+
{actions ? <div className="ui-workbench-property-section__actions">{actions}</div> : null}
|
|
339
|
+
</div>
|
|
340
|
+
) : null}
|
|
341
|
+
<div className={cx('ui-workbench-property-section__body', bodyClassName)}>{children}</div>
|
|
342
|
+
</section>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface WorkbenchPropertyStackProps extends ComponentPropsWithRef<'div'> {
|
|
347
|
+
gap?: 'xs' | 'sm' | 'md' | 'lg';
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function WorkbenchPropertyStack({
|
|
351
|
+
className,
|
|
352
|
+
gap = 'md',
|
|
353
|
+
...props
|
|
354
|
+
}: WorkbenchPropertyStackProps) {
|
|
355
|
+
return <div className={cx('ui-workbench-property-stack', className)} data-gap={gap} {...props} />;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface WorkbenchPropertyGridProps extends ComponentPropsWithRef<'div'> {
|
|
359
|
+
columns?: 2 | 3;
|
|
360
|
+
gap?: 'xs' | 'sm' | 'md';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function WorkbenchPropertyGrid({
|
|
364
|
+
className,
|
|
365
|
+
columns = 2,
|
|
366
|
+
gap = 'sm',
|
|
367
|
+
...props
|
|
368
|
+
}: WorkbenchPropertyGridProps) {
|
|
369
|
+
return (
|
|
370
|
+
<div
|
|
371
|
+
className={cx('ui-workbench-property-grid', className)}
|
|
372
|
+
data-columns={columns}
|
|
373
|
+
data-gap={gap}
|
|
374
|
+
{...props}
|
|
375
|
+
/>
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface WorkbenchPropertyInlineProps extends ComponentPropsWithRef<'div'> {
|
|
380
|
+
justify?: 'start' | 'between';
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function WorkbenchPropertyInline({
|
|
384
|
+
className,
|
|
385
|
+
justify = 'start',
|
|
386
|
+
...props
|
|
387
|
+
}: WorkbenchPropertyInlineProps) {
|
|
388
|
+
return (
|
|
389
|
+
<div
|
|
390
|
+
className={cx('ui-workbench-property-inline', className)}
|
|
391
|
+
data-justify={justify}
|
|
392
|
+
{...props}
|
|
393
|
+
/>
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type WorkbenchPropertyHintProps = ComponentPropsWithRef<'span'>;
|
|
398
|
+
|
|
399
|
+
export function WorkbenchPropertyHint({ className, ...props }: WorkbenchPropertyHintProps) {
|
|
400
|
+
return <span className={cx('ui-workbench-property-hint', className)} {...props} />;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export type WorkbenchPropertyCardProps = ComponentPropsWithRef<'div'>;
|
|
404
|
+
|
|
405
|
+
export function WorkbenchPropertyCard({ className, ...props }: WorkbenchPropertyCardProps) {
|
|
406
|
+
return <div className={cx('ui-workbench-property-card', className)} {...props} />;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface WorkbenchPropertyKeyValueProps extends ComponentPropsWithRef<'div'> {
|
|
410
|
+
name: ReactNode;
|
|
411
|
+
value: ReactNode;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export function WorkbenchPropertyKeyValue({
|
|
415
|
+
className,
|
|
416
|
+
name,
|
|
417
|
+
value,
|
|
418
|
+
...props
|
|
419
|
+
}: WorkbenchPropertyKeyValueProps) {
|
|
420
|
+
return (
|
|
421
|
+
<div className={cx('ui-workbench-property-key-value', className)} {...props}>
|
|
422
|
+
<span className="ui-workbench-property-key-value__name">{name}</span>
|
|
423
|
+
<span className="ui-workbench-property-key-value__value">{value}</span>
|
|
424
|
+
</div>
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface WorkbenchPropertyToggleButtonProps extends ButtonProps {
|
|
429
|
+
active?: boolean;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export function WorkbenchPropertyToggleButton({
|
|
433
|
+
active = false,
|
|
434
|
+
className,
|
|
435
|
+
compact = true,
|
|
436
|
+
...props
|
|
437
|
+
}: WorkbenchPropertyToggleButtonProps) {
|
|
438
|
+
return (
|
|
439
|
+
<Button
|
|
440
|
+
className={cx('ui-workbench-property-toggle', className)}
|
|
441
|
+
compact={compact}
|
|
442
|
+
data-active={active ? 'true' : 'false'}
|
|
443
|
+
{...props}
|
|
444
|
+
/>
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export type WorkbenchColorRowProps = ComponentPropsWithRef<'div'>;
|
|
449
|
+
|
|
450
|
+
export function WorkbenchColorRow({ className, ...props }: WorkbenchColorRowProps) {
|
|
451
|
+
return <div className={cx('ui-workbench-color-row', className)} {...props} />;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export interface WorkbenchColorInputProps extends Omit<
|
|
455
|
+
ComponentPropsWithRef<'div'>,
|
|
456
|
+
'children' | 'onChange'
|
|
457
|
+
> {
|
|
458
|
+
disabled?: boolean | undefined;
|
|
459
|
+
fallbackValue?: string;
|
|
460
|
+
onValueChange: (value: string) => void;
|
|
461
|
+
value?: string | undefined;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function WorkbenchColorInput({
|
|
465
|
+
disabled = false,
|
|
466
|
+
fallbackValue = '#000000',
|
|
467
|
+
onValueChange,
|
|
468
|
+
value,
|
|
469
|
+
...props
|
|
470
|
+
}: WorkbenchColorInputProps) {
|
|
471
|
+
const currentValue = value ?? fallbackValue;
|
|
472
|
+
|
|
473
|
+
return (
|
|
474
|
+
<WorkbenchColorRow {...props}>
|
|
475
|
+
<TextInput
|
|
476
|
+
className="ui-workbench-color-input"
|
|
477
|
+
disabled={disabled}
|
|
478
|
+
type="color"
|
|
479
|
+
value={currentValue}
|
|
480
|
+
onChange={(event) => onValueChange(event.target.value)}
|
|
481
|
+
/>
|
|
482
|
+
<TextInput
|
|
483
|
+
controlWidth="full"
|
|
484
|
+
disabled={disabled}
|
|
485
|
+
type="text"
|
|
486
|
+
value={currentValue}
|
|
487
|
+
onChange={(event) => onValueChange(event.target.value)}
|
|
488
|
+
/>
|
|
489
|
+
</WorkbenchColorRow>
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export type WorkbenchParseErrorProps = ComponentPropsWithRef<'div'>;
|
|
494
|
+
|
|
495
|
+
export function WorkbenchParseError({ className, ...props }: WorkbenchParseErrorProps) {
|
|
496
|
+
return <div className={cx('ui-workbench-parse-error', className)} {...props} />;
|
|
497
|
+
}
|