@djangocfg/ui-tools 2.1.382 → 2.1.384
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/dist/ChatRoot-JVR3M3H2.mjs +5 -0
- package/dist/{ChatRoot-6IZFM5HM.mjs.map → ChatRoot-JVR3M3H2.mjs.map} +1 -1
- package/dist/ChatRoot-LXIUBOXF.cjs +14 -0
- package/dist/{ChatRoot-LW4XNIKP.cjs.map → ChatRoot-LXIUBOXF.cjs.map} +1 -1
- package/dist/DictationField-U25MEYAL.mjs +4 -0
- package/dist/{DictationField-2ZLQWLYV.mjs.map → DictationField-U25MEYAL.mjs.map} +1 -1
- package/dist/DictationField-XWR5VOID.cjs +13 -0
- package/dist/{DictationField-IPPJ54CU.cjs.map → DictationField-XWR5VOID.cjs.map} +1 -1
- package/dist/{chunk-KMSBGNVC.cjs → chunk-4PFW7MIJ.cjs} +4 -2
- package/dist/chunk-4PFW7MIJ.cjs.map +1 -0
- package/dist/{chunk-4LXG3NBV.mjs → chunk-C2YN6WEO.mjs} +3 -3
- package/dist/chunk-C2YN6WEO.mjs.map +1 -0
- package/dist/{chunk-OZAU3QWD.cjs → chunk-HPK3EWBF.cjs} +8 -8
- package/dist/chunk-HPK3EWBF.cjs.map +1 -0
- package/dist/{chunk-UWVP6LCW.mjs → chunk-PEKBT75W.mjs} +8 -8
- package/dist/chunk-PEKBT75W.mjs.map +1 -0
- package/dist/index.cjs +192 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -6
- package/dist/index.d.ts +78 -6
- package/dist/index.mjs +143 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -13
- package/src/tools/Chat/core/audio/defaults.ts +16 -11
- package/src/tools/Chat/core/audio/sounds/error.ts +3 -0
- package/src/tools/Chat/core/audio/sounds/mention.ts +3 -0
- package/src/tools/Chat/core/audio/sounds/notification.ts +3 -0
- package/src/tools/Chat/core/audio/sounds/received.ts +3 -0
- package/src/tools/Chat/core/audio/sounds/sent.ts +3 -0
- package/src/tools/Chat/core/audio/sounds/start.ts +3 -0
- package/src/tools/Chat/index.ts +15 -0
- package/src/tools/SpeechRecognition/core/audio/defaults.ts +4 -4
- package/dist/ChatRoot-6IZFM5HM.mjs +0 -5
- package/dist/ChatRoot-LW4XNIKP.cjs +0 -14
- package/dist/DictationField-2ZLQWLYV.mjs +0 -4
- package/dist/DictationField-IPPJ54CU.cjs +0 -13
- package/dist/chunk-4LXG3NBV.mjs.map +0 -1
- package/dist/chunk-KMSBGNVC.cjs.map +0 -1
- package/dist/chunk-OZAU3QWD.cjs.map +0 -1
- package/dist/chunk-UWVP6LCW.mjs.map +0 -1
- package/src/audio-assets.d.ts +0 -8
- package/src/components/markdown/MarkdownMessage/MarkdownMessage.story.tsx +0 -771
- package/src/stories/index.ts +0 -63
- package/src/tools/AudioPlayer/AudioPlayer.story.tsx +0 -481
- package/src/tools/Chat/core/audio/sounds/error.mp3 +0 -0
- package/src/tools/Chat/core/audio/sounds/mention.mp3 +0 -0
- package/src/tools/Chat/core/audio/sounds/notification.mp3 +0 -0
- package/src/tools/Chat/core/audio/sounds/received.mp3 +0 -0
- package/src/tools/Chat/core/audio/sounds/sent.mp3 +0 -0
- package/src/tools/Chat/core/audio/sounds/start.mp3 +0 -0
- package/src/tools/Chat/stories/01-basic.story.tsx +0 -64
- package/src/tools/Chat/stories/02-bubbles.story.tsx +0 -21
- package/src/tools/Chat/stories/03-tool-calls.story.tsx +0 -59
- package/src/tools/Chat/stories/04-personas.story.tsx +0 -78
- package/src/tools/Chat/stories/05-launcher.story.tsx +0 -321
- package/src/tools/Chat/stories/06-header.story.tsx +0 -147
- package/src/tools/Chat/stories/07-audio-actions.story.tsx +0 -112
- package/src/tools/Chat/stories/shared/Frame.tsx +0 -21
- package/src/tools/Chat/stories/shared/index.ts +0 -5
- package/src/tools/Chat/stories/shared/messages.ts +0 -39
- package/src/tools/Chat/stories/shared/personas.ts +0 -13
- package/src/tools/Chat/stories/shared/seeds.ts +0 -92
- package/src/tools/Chat/stories/shared/transports.ts +0 -36
- package/src/tools/CodeEditor/CodeEditor.story.tsx +0 -202
- package/src/tools/CronScheduler/CronScheduler.story.tsx +0 -300
- package/src/tools/Gallery/Gallery.story.tsx +0 -237
- package/src/tools/ImageViewer/ImageViewer.story.tsx +0 -85
- package/src/tools/JsonForm/JsonForm.story.tsx +0 -350
- package/src/tools/JsonTree/JsonTree.story.tsx +0 -141
- package/src/tools/LottiePlayer/LottiePlayer.story.tsx +0 -95
- package/src/tools/Map/Map.story.tsx +0 -458
- package/src/tools/MarkdownEditor/MarkdownEditor.story.tsx +0 -225
- package/src/tools/Mermaid/Mermaid.story.tsx +0 -251
- package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +0 -230
- package/src/tools/PrettyCode/PrettyCode.story.tsx +0 -304
- package/src/tools/SpeechRecognition/stories/01-basic.story.tsx +0 -32
- package/src/tools/SpeechRecognition/stories/02-dictation-field.story.tsx +0 -32
- package/src/tools/SpeechRecognition/stories/03-push-to-talk.story.tsx +0 -27
- package/src/tools/SpeechRecognition/stories/04-mic-meter.story.tsx +0 -35
- package/src/tools/SpeechRecognition/stories/05-custom-engine-http.story.tsx +0 -40
- package/src/tools/SpeechRecognition/stories/06-custom-engine-ws.story.tsx +0 -48
- package/src/tools/SpeechRecognition/stories/07-language-device.story.tsx +0 -57
- package/src/tools/SpeechRecognition/stories/08-errors-permissions.story.tsx +0 -25
- package/src/tools/SpeechRecognition/stories/09-chat-voice.story.tsx +0 -90
- package/src/tools/SpeechRecognition/stories/shared.tsx +0 -123
- package/src/tools/Tour/Tour.story.tsx +0 -279
- package/src/tools/Tree/Tree.story.tsx +0 -620
- package/src/tools/Uploader/Uploader.story.tsx +0 -415
- package/src/tools/VideoPlayer/VideoPlayer.story.tsx +0 -87
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { defineStory, useSelect, useBoolean } from '@djangocfg/playground';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { JsonSchemaForm } from './index';
|
|
4
|
-
|
|
5
|
-
export default defineStory({
|
|
6
|
-
title: 'Tools/Json Schema Form',
|
|
7
|
-
component: JsonSchemaForm,
|
|
8
|
-
description:
|
|
9
|
-
'Dynamic form generator from JSON Schema using react-jsonschema-form. Supports density (compact), conditional disable via `ui:disabledWhen`, and collapsible sub-sections via `ui:groups`.',
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const SCHEMAS = {
|
|
13
|
-
simple: {
|
|
14
|
-
schema: {
|
|
15
|
-
type: 'object' as const,
|
|
16
|
-
required: ['name', 'email'],
|
|
17
|
-
properties: {
|
|
18
|
-
name: { type: 'string' as const, title: 'Name' },
|
|
19
|
-
email: { type: 'string' as const, title: 'Email', format: 'email' },
|
|
20
|
-
age: { type: 'integer' as const, title: 'Age', minimum: 0, maximum: 120 },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
uiSchema: {},
|
|
24
|
-
},
|
|
25
|
-
vehicle: {
|
|
26
|
-
schema: {
|
|
27
|
-
type: 'object' as const,
|
|
28
|
-
required: ['make', 'model', 'year'],
|
|
29
|
-
properties: {
|
|
30
|
-
make: {
|
|
31
|
-
type: 'string' as const,
|
|
32
|
-
title: 'Make',
|
|
33
|
-
enum: ['BMW', 'Mercedes', 'Audi', 'Porsche', 'Tesla'],
|
|
34
|
-
},
|
|
35
|
-
model: { type: 'string' as const, title: 'Model' },
|
|
36
|
-
year: { type: 'integer' as const, title: 'Year', minimum: 1990, maximum: 2025 },
|
|
37
|
-
price: { type: 'number' as const, title: 'Price ($)' },
|
|
38
|
-
features: {
|
|
39
|
-
type: 'array' as const,
|
|
40
|
-
title: 'Features',
|
|
41
|
-
items: {
|
|
42
|
-
type: 'string' as const,
|
|
43
|
-
enum: ['Leather', 'Navigation', 'Sunroof', 'Heated Seats', 'Parking Sensors'],
|
|
44
|
-
},
|
|
45
|
-
uniqueItems: true,
|
|
46
|
-
},
|
|
47
|
-
description: { type: 'string' as const, title: 'Description' },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
uiSchema: {
|
|
51
|
-
description: { 'ui:widget': 'textarea' },
|
|
52
|
-
features: { 'ui:widget': 'checkboxes' },
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
contact: {
|
|
56
|
-
schema: {
|
|
57
|
-
type: 'object' as const,
|
|
58
|
-
required: ['firstName', 'lastName', 'email'],
|
|
59
|
-
properties: {
|
|
60
|
-
firstName: { type: 'string' as const, title: 'First Name' },
|
|
61
|
-
lastName: { type: 'string' as const, title: 'Last Name' },
|
|
62
|
-
email: { type: 'string' as const, title: 'Email', format: 'email' },
|
|
63
|
-
phone: { type: 'string' as const, title: 'Phone' },
|
|
64
|
-
message: { type: 'string' as const, title: 'Message' },
|
|
65
|
-
subscribe: { type: 'boolean' as const, title: 'Subscribe to newsletter' },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
uiSchema: {
|
|
69
|
-
message: { 'ui:widget': 'textarea' },
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const Interactive = () => {
|
|
75
|
-
const [schemaType] = useSelect('schemaType', {
|
|
76
|
-
options: ['simple', 'vehicle', 'contact'] as const,
|
|
77
|
-
defaultValue: 'vehicle',
|
|
78
|
-
label: 'Schema Type',
|
|
79
|
-
description: 'Select form schema',
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const [density] = useSelect('density', {
|
|
83
|
-
options: ['comfortable', 'compact'] as const,
|
|
84
|
-
defaultValue: 'comfortable',
|
|
85
|
-
label: 'Density',
|
|
86
|
-
description: '`compact` shrinks rows and moves description into label tooltip.',
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const [liveValidate] = useBoolean('liveValidate', {
|
|
90
|
-
defaultValue: false,
|
|
91
|
-
label: 'Live Validate',
|
|
92
|
-
description: 'Validate on every change',
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const config = SCHEMAS[schemaType];
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<div className="max-w-lg">
|
|
99
|
-
<JsonSchemaForm
|
|
100
|
-
schema={config.schema}
|
|
101
|
-
uiSchema={config.uiSchema}
|
|
102
|
-
liveValidate={liveValidate}
|
|
103
|
-
density={density}
|
|
104
|
-
onSubmit={(data) => console.log('Submitted:', data.formData)}
|
|
105
|
-
/>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const SimpleForm = () => (
|
|
111
|
-
<div className="max-w-md">
|
|
112
|
-
<JsonSchemaForm
|
|
113
|
-
schema={SCHEMAS.simple.schema}
|
|
114
|
-
onSubmit={(data) => console.log('Submitted:', data.formData)}
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
export const VehicleForm = () => (
|
|
120
|
-
<div className="max-w-lg">
|
|
121
|
-
<JsonSchemaForm
|
|
122
|
-
schema={SCHEMAS.vehicle.schema}
|
|
123
|
-
uiSchema={SCHEMAS.vehicle.uiSchema}
|
|
124
|
-
onSubmit={(data) => console.log('Submitted:', data.formData)}
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
export const WithDefaultValues = () => (
|
|
130
|
-
<div className="max-w-lg">
|
|
131
|
-
<JsonSchemaForm
|
|
132
|
-
schema={SCHEMAS.vehicle.schema}
|
|
133
|
-
uiSchema={SCHEMAS.vehicle.uiSchema}
|
|
134
|
-
formData={{
|
|
135
|
-
make: 'BMW',
|
|
136
|
-
model: 'X5',
|
|
137
|
-
year: 2023,
|
|
138
|
-
price: 65000,
|
|
139
|
-
features: ['Leather', 'Navigation'],
|
|
140
|
-
}}
|
|
141
|
-
onSubmit={(data) => console.log('Submitted:', data.formData)}
|
|
142
|
-
/>
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Compact density — shrinks rows, moves description into a tooltip on the
|
|
148
|
-
* label. Pair with `ui:groups` for dense sidebar / playground configurators.
|
|
149
|
-
*/
|
|
150
|
-
export const Compact = () => (
|
|
151
|
-
<div className="max-w-md">
|
|
152
|
-
<JsonSchemaForm
|
|
153
|
-
schema={SCHEMAS.simple.schema}
|
|
154
|
-
density="compact"
|
|
155
|
-
showSubmitButton={false}
|
|
156
|
-
onSubmit={(data) => console.log('Submitted:', data.formData)}
|
|
157
|
-
/>
|
|
158
|
-
</div>
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* `ui:disabledWhen` greys out a field based on another field's value.
|
|
163
|
-
* Here `phone` is disabled until `subscribe` is checked, and `email` is
|
|
164
|
-
* disabled when `firstName` is empty.
|
|
165
|
-
*/
|
|
166
|
-
export const ConditionalDisable = () => {
|
|
167
|
-
const [data, setData] = useState<Record<string, unknown>>({
|
|
168
|
-
firstName: '',
|
|
169
|
-
subscribe: false,
|
|
170
|
-
});
|
|
171
|
-
return (
|
|
172
|
-
<div className="max-w-lg">
|
|
173
|
-
<JsonSchemaForm
|
|
174
|
-
schema={SCHEMAS.contact.schema}
|
|
175
|
-
uiSchema={{
|
|
176
|
-
...SCHEMAS.contact.uiSchema,
|
|
177
|
-
email: {
|
|
178
|
-
'ui:disabledWhen': { path: 'firstName', falsy: true },
|
|
179
|
-
},
|
|
180
|
-
phone: {
|
|
181
|
-
'ui:disabledWhen': { path: 'subscribe', falsy: true },
|
|
182
|
-
},
|
|
183
|
-
subscribe: { 'ui:widget': 'switch' },
|
|
184
|
-
}}
|
|
185
|
-
formData={data}
|
|
186
|
-
onChange={(e) => setData(e.formData ?? {})}
|
|
187
|
-
showSubmitButton={false}
|
|
188
|
-
/>
|
|
189
|
-
<pre className="mt-3 text-[11px] text-muted-foreground">
|
|
190
|
-
{JSON.stringify(data, null, 2)}
|
|
191
|
-
</pre>
|
|
192
|
-
</div>
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* `ui:groups` splits a flat object into collapsible sub-sections without
|
|
198
|
-
* restructuring the schema. Fields not listed in any group render flat above
|
|
199
|
-
* the groups.
|
|
200
|
-
*/
|
|
201
|
-
export const CollapsibleGroups = () => (
|
|
202
|
-
<div className="max-w-lg">
|
|
203
|
-
<JsonSchemaForm
|
|
204
|
-
schema={{
|
|
205
|
-
type: 'object',
|
|
206
|
-
properties: {
|
|
207
|
-
identity: { type: 'string', title: 'Display name' },
|
|
208
|
-
firstName: { type: 'string', title: 'First name' },
|
|
209
|
-
lastName: { type: 'string', title: 'Last name' },
|
|
210
|
-
email: { type: 'string', title: 'Email', format: 'email' },
|
|
211
|
-
phone: { type: 'string', title: 'Phone' },
|
|
212
|
-
newsletter: { type: 'boolean', title: 'Newsletter' },
|
|
213
|
-
marketing: { type: 'boolean', title: 'Marketing emails' },
|
|
214
|
-
tracking: { type: 'boolean', title: 'Usage analytics' },
|
|
215
|
-
},
|
|
216
|
-
}}
|
|
217
|
-
uiSchema={{
|
|
218
|
-
'ui:groups': [
|
|
219
|
-
{
|
|
220
|
-
title: 'Personal',
|
|
221
|
-
fields: ['firstName', 'lastName'],
|
|
222
|
-
defaultOpen: true,
|
|
223
|
-
},
|
|
224
|
-
{ title: 'Contact', fields: ['email', 'phone'], defaultOpen: false },
|
|
225
|
-
{
|
|
226
|
-
title: 'Preferences',
|
|
227
|
-
fields: ['newsletter', 'marketing', 'tracking'],
|
|
228
|
-
defaultOpen: false,
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
newsletter: { 'ui:widget': 'switch' },
|
|
232
|
-
marketing: { 'ui:widget': 'switch' },
|
|
233
|
-
tracking: { 'ui:widget': 'switch' },
|
|
234
|
-
}}
|
|
235
|
-
density="compact"
|
|
236
|
-
showSubmitButton={false}
|
|
237
|
-
onChange={(e) => console.log('changed:', e.formData)}
|
|
238
|
-
/>
|
|
239
|
-
</div>
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Empty-string enum values are now allowed — Radix `<Select.Item value="" />`
|
|
244
|
-
* is reserved, so the ui-core `Select` wrapper substitutes a sentinel
|
|
245
|
-
* internally. From the schema's perspective `''` is just another option.
|
|
246
|
-
*/
|
|
247
|
-
export const EmptyStringSelect = () => {
|
|
248
|
-
const [data, setData] = useState<Record<string, unknown>>({ plan: '' });
|
|
249
|
-
return (
|
|
250
|
-
<div className="max-w-md">
|
|
251
|
-
<JsonSchemaForm
|
|
252
|
-
schema={{
|
|
253
|
-
type: 'object',
|
|
254
|
-
properties: {
|
|
255
|
-
plan: {
|
|
256
|
-
type: 'string',
|
|
257
|
-
title: 'Plan',
|
|
258
|
-
enum: ['', 'Free', 'Pro', 'Max', 'Enterprise'],
|
|
259
|
-
description: 'An empty string is a valid enum value here.',
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
}}
|
|
263
|
-
uiSchema={{
|
|
264
|
-
plan: {
|
|
265
|
-
'ui:enumNames': ['— none —', 'Free', 'Pro', 'Max', 'Enterprise'],
|
|
266
|
-
},
|
|
267
|
-
}}
|
|
268
|
-
formData={data}
|
|
269
|
-
onChange={(e) => setData(e.formData ?? {})}
|
|
270
|
-
showSubmitButton={false}
|
|
271
|
-
/>
|
|
272
|
-
<pre className="mt-3 text-[11px] text-muted-foreground">
|
|
273
|
-
{JSON.stringify(data, null, 2)}
|
|
274
|
-
</pre>
|
|
275
|
-
</div>
|
|
276
|
-
);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Live demo of all extensions wired together — compact density, collapsible
|
|
281
|
-
* groups, conditional disable, slider with unit. Mirrors what the layouts
|
|
282
|
-
* playground sidebar uses.
|
|
283
|
-
*/
|
|
284
|
-
export const PlaygroundStyle = () => {
|
|
285
|
-
const [data, setData] = useState<Record<string, unknown>>({
|
|
286
|
-
shell: { variant: 'boxed', inset: 12, radius: '2xl', border: true },
|
|
287
|
-
sidebar: {
|
|
288
|
-
density: 'default',
|
|
289
|
-
activeIndicator: 'background',
|
|
290
|
-
collapsibleGroups: false,
|
|
291
|
-
},
|
|
292
|
-
});
|
|
293
|
-
return (
|
|
294
|
-
<div className="max-w-md">
|
|
295
|
-
<JsonSchemaForm
|
|
296
|
-
schema={{
|
|
297
|
-
type: 'object',
|
|
298
|
-
properties: {
|
|
299
|
-
shell: {
|
|
300
|
-
type: 'object',
|
|
301
|
-
title: 'Shell',
|
|
302
|
-
properties: {
|
|
303
|
-
variant: { type: 'string', title: 'Variant', enum: ['full-bleed', 'boxed'] },
|
|
304
|
-
inset: { type: 'integer', title: 'Inset', minimum: 0, maximum: 32 },
|
|
305
|
-
radius: { type: 'string', title: 'Radius', enum: ['sm', 'md', 'lg', 'xl', '2xl', '3xl'] },
|
|
306
|
-
border: { type: 'boolean', title: 'Border' },
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
sidebar: {
|
|
310
|
-
type: 'object',
|
|
311
|
-
title: 'Sidebar',
|
|
312
|
-
properties: {
|
|
313
|
-
density: { type: 'string', title: 'Density', enum: ['sparse', 'default', 'dense'] },
|
|
314
|
-
activeIndicator: {
|
|
315
|
-
type: 'string',
|
|
316
|
-
title: 'Active indicator',
|
|
317
|
-
enum: ['background', 'rail', 'both'],
|
|
318
|
-
},
|
|
319
|
-
collapsibleGroups: { type: 'boolean', title: 'Collapsible groups' },
|
|
320
|
-
},
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
}}
|
|
324
|
-
uiSchema={{
|
|
325
|
-
shell: {
|
|
326
|
-
'ui:collapsible': true,
|
|
327
|
-
inset: {
|
|
328
|
-
'ui:widget': 'slider',
|
|
329
|
-
'ui:options': { unit: 'px', step: 2, showInput: false },
|
|
330
|
-
'ui:disabledWhen': { path: 'shell.variant', notEq: 'boxed' },
|
|
331
|
-
},
|
|
332
|
-
radius: { 'ui:disabledWhen': { path: 'shell.variant', notEq: 'boxed' } },
|
|
333
|
-
border: {
|
|
334
|
-
'ui:widget': 'switch',
|
|
335
|
-
'ui:disabledWhen': { path: 'shell.variant', notEq: 'boxed' },
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
sidebar: {
|
|
339
|
-
'ui:collapsible': true,
|
|
340
|
-
collapsibleGroups: { 'ui:widget': 'switch' },
|
|
341
|
-
},
|
|
342
|
-
}}
|
|
343
|
-
formData={data}
|
|
344
|
-
onChange={(e) => setData(e.formData ?? {})}
|
|
345
|
-
density="compact"
|
|
346
|
-
showSubmitButton={false}
|
|
347
|
-
/>
|
|
348
|
-
</div>
|
|
349
|
-
);
|
|
350
|
-
};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { defineStory, useBoolean, useSelect, useNumber } from '@djangocfg/playground';
|
|
2
|
-
import JsonTree from './index';
|
|
3
|
-
|
|
4
|
-
export default defineStory({
|
|
5
|
-
title: 'Tools/Json Tree',
|
|
6
|
-
component: JsonTree,
|
|
7
|
-
description: 'Interactive JSON tree viewer with expand/collapse.',
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const sampleData = {
|
|
11
|
-
user: {
|
|
12
|
-
id: 'usr_123',
|
|
13
|
-
name: 'John Doe',
|
|
14
|
-
email: 'john@example.com',
|
|
15
|
-
roles: ['admin', 'user'],
|
|
16
|
-
settings: {
|
|
17
|
-
theme: 'dark',
|
|
18
|
-
notifications: true,
|
|
19
|
-
language: 'en',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
metadata: {
|
|
23
|
-
createdAt: '2024-01-15T10:30:00Z',
|
|
24
|
-
updatedAt: '2024-01-20T14:45:00Z',
|
|
25
|
-
version: 2,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const apiResponse = {
|
|
30
|
-
status: 200,
|
|
31
|
-
data: {
|
|
32
|
-
vehicles: [
|
|
33
|
-
{ id: 1, make: 'BMW', model: 'X5', year: 2023, price: 65000 },
|
|
34
|
-
{ id: 2, make: 'Mercedes', model: 'GLE', year: 2022, price: 72000 },
|
|
35
|
-
{ id: 3, make: 'Audi', model: 'Q7', year: 2023, price: 68000 },
|
|
36
|
-
],
|
|
37
|
-
pagination: {
|
|
38
|
-
page: 1,
|
|
39
|
-
perPage: 10,
|
|
40
|
-
total: 156,
|
|
41
|
-
hasMore: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
meta: {
|
|
45
|
-
requestId: 'req_abc123',
|
|
46
|
-
duration: 45,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const nestedData = {
|
|
51
|
-
level1: {
|
|
52
|
-
level2: {
|
|
53
|
-
level3: {
|
|
54
|
-
level4: {
|
|
55
|
-
level5: {
|
|
56
|
-
value: 'deeply nested',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const DATA_SAMPLES = {
|
|
65
|
-
user: sampleData,
|
|
66
|
-
api: apiResponse,
|
|
67
|
-
nested: nestedData,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const Interactive = () => {
|
|
71
|
-
const [dataSource] = useSelect('dataSource', {
|
|
72
|
-
options: ['user', 'api', 'nested'] as const,
|
|
73
|
-
defaultValue: 'api',
|
|
74
|
-
label: 'Data Source',
|
|
75
|
-
description: 'Select JSON data to display',
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const [showExpandControls] = useBoolean('showExpandControls', {
|
|
79
|
-
defaultValue: true,
|
|
80
|
-
label: 'Expand Controls',
|
|
81
|
-
description: 'Show expand/collapse all buttons',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const [showActionButtons] = useBoolean('showActionButtons', {
|
|
85
|
-
defaultValue: true,
|
|
86
|
-
label: 'Action Buttons',
|
|
87
|
-
description: 'Show copy/download buttons',
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const [maxAutoExpandDepth] = useNumber('maxAutoExpandDepth', {
|
|
91
|
-
defaultValue: 2,
|
|
92
|
-
min: 0,
|
|
93
|
-
max: 10,
|
|
94
|
-
label: 'Auto Expand Depth',
|
|
95
|
-
description: 'Maximum depth to expand automatically',
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div className="max-w-2xl h-96">
|
|
100
|
-
<JsonTree
|
|
101
|
-
data={DATA_SAMPLES[dataSource]}
|
|
102
|
-
config={{
|
|
103
|
-
maxAutoExpandDepth,
|
|
104
|
-
showExpandControls,
|
|
105
|
-
showActionButtons,
|
|
106
|
-
className: 'h-full',
|
|
107
|
-
}}
|
|
108
|
-
/>
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const Default = () => (
|
|
114
|
-
<div className="max-w-2xl">
|
|
115
|
-
<JsonTree data={sampleData} />
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
export const APIResponse = () => (
|
|
120
|
-
<div className="max-w-2xl">
|
|
121
|
-
<JsonTree data={apiResponse} />
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
export const DeepNesting = () => (
|
|
126
|
-
<div className="max-w-2xl">
|
|
127
|
-
<JsonTree data={nestedData} />
|
|
128
|
-
</div>
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
export const CollapsedByDefault = () => (
|
|
132
|
-
<div className="max-w-2xl h-96">
|
|
133
|
-
<JsonTree data={apiResponse} config={{ maxAutoExpandDepth: 0, className: 'h-full' }} />
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
export const WithMaxDepth = () => (
|
|
138
|
-
<div className="max-w-2xl h-96">
|
|
139
|
-
<JsonTree data={apiResponse} config={{ maxAutoExpandDepth: 2, className: 'h-full' }} />
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { defineStory, useSelect, useBoolean } from '@djangocfg/playground';
|
|
2
|
-
import { LottiePlayer } from './index';
|
|
3
|
-
|
|
4
|
-
export default defineStory({
|
|
5
|
-
title: 'Tools/Lottie Player',
|
|
6
|
-
component: LottiePlayer,
|
|
7
|
-
description: 'Lottie animation player for JSON animations.',
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
// Public Lottie animation URLs
|
|
11
|
-
const ANIMATIONS = {
|
|
12
|
-
loading: 'https://assets2.lottiefiles.com/packages/lf20_usmfx6bp.json',
|
|
13
|
-
success: 'https://assets4.lottiefiles.com/packages/lf20_jbrw3hcz.json',
|
|
14
|
-
rocket: 'https://assets3.lottiefiles.com/packages/lf20_l3qxn9jy.json',
|
|
15
|
-
heart: 'https://assets7.lottiefiles.com/packages/lf20_3vbOcw.json',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const Interactive = () => {
|
|
19
|
-
const [animation] = useSelect('animation', {
|
|
20
|
-
options: ['loading', 'success', 'rocket', 'heart'] as const,
|
|
21
|
-
defaultValue: 'rocket',
|
|
22
|
-
label: 'Animation',
|
|
23
|
-
description: 'Select Lottie animation',
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const [loop] = useBoolean('loop', {
|
|
27
|
-
defaultValue: true,
|
|
28
|
-
label: 'Loop',
|
|
29
|
-
description: 'Loop animation playback',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const [autoplay] = useBoolean('autoplay', {
|
|
33
|
-
defaultValue: true,
|
|
34
|
-
label: 'Autoplay',
|
|
35
|
-
description: 'Auto-start animation',
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const [controls] = useBoolean('controls', {
|
|
39
|
-
defaultValue: false,
|
|
40
|
-
label: 'Show Controls',
|
|
41
|
-
description: 'Display playback controls',
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div className="w-64 h-64">
|
|
46
|
-
<LottiePlayer
|
|
47
|
-
src={ANIMATIONS[animation]}
|
|
48
|
-
loop={loop}
|
|
49
|
-
autoplay={autoplay}
|
|
50
|
-
controls={controls}
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const Loading = () => (
|
|
57
|
-
<div className="w-48 h-48">
|
|
58
|
-
<LottiePlayer src={ANIMATIONS.loading} loop autoplay />
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
export const Success = () => (
|
|
63
|
-
<div className="w-48 h-48">
|
|
64
|
-
<LottiePlayer src={ANIMATIONS.success} autoplay />
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
export const Rocket = () => (
|
|
69
|
-
<div className="w-64 h-64">
|
|
70
|
-
<LottiePlayer src={ANIMATIONS.rocket} loop autoplay />
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
export const Heart = () => (
|
|
75
|
-
<div className="w-32 h-32">
|
|
76
|
-
<LottiePlayer src={ANIMATIONS.heart} loop autoplay />
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
export const WithControls = () => (
|
|
81
|
-
<div className="w-64 h-64">
|
|
82
|
-
<LottiePlayer
|
|
83
|
-
src={ANIMATIONS.rocket}
|
|
84
|
-
loop
|
|
85
|
-
autoplay
|
|
86
|
-
controls
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
export const Paused = () => (
|
|
92
|
-
<div className="w-48 h-48">
|
|
93
|
-
<LottiePlayer src={ANIMATIONS.loading} loop />
|
|
94
|
-
</div>
|
|
95
|
-
);
|