@morphika/andami 0.5.1 → 0.5.3
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/README.md +27 -2
- package/app/admin/assets/page.tsx +6 -6
- package/app/admin/database/page.tsx +302 -302
- package/app/admin/error.tsx +53 -53
- package/app/admin/layout.tsx +332 -320
- package/app/admin/navigation/page.tsx +255 -255
- package/app/admin/pages/[slug]/page.tsx +44 -27
- package/app/admin/pages/page.tsx +24 -19
- package/app/admin/projects/page.tsx +30 -21
- package/app/admin/setup/page.tsx +1 -1
- package/app/admin/styles/page.tsx +1 -1
- package/app/api/admin/assets/register/route.ts +51 -14
- package/app/api/admin/assets/registry/route.ts +4 -1
- package/app/api/admin/assets/relink/confirm/route.ts +4 -1
- package/app/api/admin/assets/relink/route.ts +4 -1
- package/app/api/admin/assets/scan/route.ts +4 -1
- package/app/api/admin/backups/restore-data/route.ts +4 -1
- package/app/api/admin/r2/connect/route.ts +4 -1
- package/app/api/admin/r2/delete/route.ts +4 -1
- package/app/api/admin/r2/rename/route.ts +4 -1
- package/app/api/admin/r2/upload-url/route.ts +4 -1
- package/app/api/admin/revalidate/route.ts +4 -1
- package/app/api/admin/storage/switch/route.ts +4 -1
- package/app/api/custom-sections/[id]/route.ts +5 -6
- package/components/admin/MetadataEditor.tsx +6 -6
- package/components/admin/PublishToggle.tsx +2 -2
- package/components/admin/nav-builder/NavBuilder.tsx +1 -1
- package/components/admin/nav-builder/NavBuilderGrid.tsx +3 -3
- package/components/admin/nav-builder/NavGridCell.tsx +48 -48
- package/components/admin/nav-builder/NavGridItem.tsx +8 -6
- package/components/admin/nav-builder/NavItemSettings.tsx +331 -331
- package/components/admin/nav-builder/NavItemTypePicker.tsx +102 -102
- package/components/admin/nav-builder/NavLivePreview.tsx +1 -1
- package/components/admin/nav-builder/NavMobileLivePreview.tsx +226 -226
- package/components/admin/nav-builder/NavMobileSettings.tsx +242 -242
- package/components/admin/nav-builder/NavSettingsFields.tsx +518 -514
- package/components/admin/setup-wizard/BrandingStep.tsx +3 -3
- package/components/admin/setup-wizard/DatabaseStep.tsx +2 -2
- package/components/admin/setup-wizard/DoneStep.tsx +1 -1
- package/components/admin/setup-wizard/SetupWizard.tsx +4 -4
- package/components/admin/setup-wizard/StorageStep.tsx +2 -2
- package/components/admin/setup-wizard/WelcomeStep.tsx +2 -2
- package/components/admin/styles/ColorsEditor.tsx +9 -8
- package/components/admin/styles/FontsEditor.tsx +9 -7
- package/components/admin/styles/GridLayoutEditor.tsx +9 -9
- package/components/admin/styles/LinksButtonsEditor.tsx +5 -5
- package/components/admin/styles/TypographyEditor.tsx +6 -6
- package/components/admin/styles/shared.tsx +68 -68
- package/components/blocks/AudioBlockRenderer.tsx +286 -286
- package/components/blocks/CoverSectionRenderer.tsx +7 -1
- package/components/blocks/MarqueeBlockRenderer.tsx +316 -0
- package/components/blocks/ProjectCarouselBlockRenderer.tsx +1 -1
- package/components/blocks/SectionV2Renderer.tsx +8 -1
- package/components/builder/BlockCardIcons.tsx +316 -316
- package/components/builder/BlockTypePicker.tsx +1 -1
- package/components/builder/BubbleIcons.tsx +104 -0
- package/components/builder/BuilderCanvas.tsx +2 -0
- package/components/builder/CanvasMinimap.tsx +66 -49
- package/components/builder/CanvasToolbar.tsx +31 -41
- package/components/builder/CoverSectionCanvas.tsx +363 -363
- package/components/builder/DeviceFrame.tsx +1 -1
- package/components/builder/DndWrapper.tsx +3 -3
- package/components/builder/InsertionLines.tsx +1 -1
- package/components/builder/SectionCardIcons.tsx +421 -320
- package/components/builder/SectionEditorBar.tsx +5 -3
- package/components/builder/SectionTypePicker.tsx +7 -5
- package/components/builder/SectionV2Canvas.tsx +1 -1
- package/components/builder/SectionV2Column.tsx +82 -68
- package/components/builder/SettingsPanel.tsx +21 -17
- package/components/builder/SortableBlock.tsx +93 -73
- package/components/builder/SortableRow.tsx +33 -35
- package/components/builder/VirtualAssetGrid.tsx +10 -4
- package/components/builder/asset-browser/R2BrowserContent.tsx +18 -14
- package/components/builder/blockStyles.tsx +192 -185
- package/components/builder/color-picker/AlphaSlider.tsx +141 -141
- package/components/builder/color-picker/ColorInputs.tsx +105 -105
- package/components/builder/color-picker/EyedropperButton.tsx +75 -74
- package/components/builder/color-picker/HueSlider.tsx +124 -124
- package/components/builder/color-picker/SaturationCanvas.tsx +142 -142
- package/components/builder/color-picker/SwatchBar.tsx +98 -93
- package/components/builder/color-picker/UnifiedColorPicker.tsx +11 -6
- package/components/builder/editors/AudioBlockEditor.tsx +242 -242
- package/components/builder/editors/BeforeAfterBlockEditor.tsx +360 -360
- package/components/builder/editors/ButtonBlockEditor.tsx +4 -4
- package/components/builder/editors/EnterAnimationPicker.tsx +2 -2
- package/components/builder/editors/HoverEffectPicker.tsx +2 -2
- package/components/builder/editors/ImageBlockEditor.tsx +2 -2
- package/components/builder/editors/ImageGridBlockEditor.tsx +8 -6
- package/components/builder/editors/MarqueeBlockEditor.tsx +622 -0
- package/components/builder/editors/ProjectCarouselBlockEditor.tsx +443 -443
- package/components/builder/editors/ProjectGridEditor.tsx +21 -16
- package/components/builder/editors/SpacerBlockEditor.tsx +29 -27
- package/components/builder/editors/StaggerSettings.tsx +109 -109
- package/components/builder/editors/TextBlockEditor.tsx +22 -17
- package/components/builder/editors/TextStylePicker.tsx +1 -1
- package/components/builder/editors/VideoBlockEditor.tsx +2 -2
- package/components/builder/editors/index.ts +11 -10
- package/components/builder/editors/shared.tsx +10 -8
- package/components/builder/live-preview/LiveAudioPreview.tsx +120 -120
- package/components/builder/live-preview/LiveBeforeAfterPreview.tsx +1 -1
- package/components/builder/live-preview/LiveImageGridPreview.tsx +10 -2
- package/components/builder/live-preview/LiveImagePreview.tsx +4 -2
- package/components/builder/live-preview/LiveMarqueePreview.tsx +39 -0
- package/components/builder/live-preview/LiveProjectCarouselPreview.tsx +1 -1
- package/components/builder/live-preview/LiveVideoPreview.tsx +1 -1
- package/components/builder/live-preview/ProjectCardWrapper.tsx +293 -291
- package/components/builder/live-preview/RichTextBubbleMenu.tsx +10 -6
- package/components/builder/live-preview/shared.tsx +5 -2
- package/components/builder/settings-panel/AnimationTab.tsx +138 -138
- package/components/builder/settings-panel/BlockLayoutTab.tsx +11 -9
- package/components/builder/settings-panel/CardEntranceSection.tsx +114 -114
- package/components/builder/settings-panel/ColumnV2LayoutTab.tsx +242 -0
- package/components/builder/settings-panel/ColumnV2Settings.tsx +5 -5
- package/components/builder/settings-panel/CoverSectionLayoutTab.tsx +71 -71
- package/components/builder/settings-panel/CoverSectionSettings.tsx +337 -335
- package/components/builder/settings-panel/PageSettings.tsx +3 -3
- package/components/builder/settings-panel/ParallaxSlideSettings.tsx +2 -2
- package/components/builder/settings-panel/SectionV2AnimationTab.tsx +4 -4
- package/components/builder/settings-panel/SectionV2LayoutTab.tsx +356 -356
- package/components/builder/settings-panel/SectionV2Settings.tsx +25 -20
- package/components/builder/settings-panel/TRBLInputs.tsx +1 -1
- package/components/builder/settings-panel/index.ts +1 -0
- package/lib/animation/enter-types.ts +1 -0
- package/lib/animation/hover-effect-presets.ts +210 -210
- package/lib/animation/hover-effect-types.ts +1 -0
- package/lib/builder/block-registrations.ts +468 -417
- package/lib/builder/constants.ts +111 -111
- package/lib/builder/serializer/normalizers.ts +14 -0
- package/lib/builder/serializer/serializers.ts +27 -0
- package/lib/builder/store-sections.ts +23 -2
- package/lib/builder/types-slices.ts +428 -414
- package/lib/builder/types.ts +4 -1
- package/lib/config/index.ts +27 -27
- package/lib/sanity/queries.ts +48 -0
- package/lib/sanity/types.ts +112 -1
- package/lib/version.ts +1 -1
- package/package.json +7 -5
- package/sanity/schemas/blocks/audioBlock.ts +69 -69
- package/sanity/schemas/blocks/index.ts +12 -11
- package/sanity/schemas/blocks/marqueeBlock.ts +292 -0
- package/sanity/schemas/index.ts +120 -117
- package/sanity/schemas/objects/coverSection.ts +32 -0
- package/sanity/schemas/objects/parallaxSlide.ts +32 -0
- package/sanity/schemas/pageSectionV2.ts +32 -0
- package/styles/admin.css +85 -85
- package/styles/animations.css +237 -237
- package/styles/base.css +114 -114
|
@@ -1,514 +1,518 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useState, type ReactNode } from "react";
|
|
4
|
-
import {
|
|
5
|
-
PositionIcon,
|
|
6
|
-
TypographyIcon,
|
|
7
|
-
AnimationIcon,
|
|
8
|
-
SpacingIcon,
|
|
9
|
-
ContentIcon,
|
|
10
|
-
LinkIcon,
|
|
11
|
-
GridIcon,
|
|
12
|
-
StyleIcon,
|
|
13
|
-
BackgroundIcon,
|
|
14
|
-
} from "../../builder/editors/section-icons";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
{value
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
// ============================================
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
<
|
|
447
|
-
|
|
448
|
-
</
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState, type ReactNode } from "react";
|
|
4
|
+
import {
|
|
5
|
+
PositionIcon,
|
|
6
|
+
TypographyIcon,
|
|
7
|
+
AnimationIcon,
|
|
8
|
+
SpacingIcon,
|
|
9
|
+
ContentIcon,
|
|
10
|
+
LinkIcon,
|
|
11
|
+
GridIcon,
|
|
12
|
+
StyleIcon,
|
|
13
|
+
BackgroundIcon,
|
|
14
|
+
} from "../../builder/editors/section-icons";
|
|
15
|
+
import { BubbleTooltip } from "../../builder/BubbleIcons";
|
|
16
|
+
|
|
17
|
+
// ── Nav viewport type for responsive overrides ──
|
|
18
|
+
export type NavViewport = "desktop" | "tablet" | "phone";
|
|
19
|
+
|
|
20
|
+
// ── Shared field components for NavBuilder settings panel ──
|
|
21
|
+
// v2: Card-based sections, colored icons, builder-aligned styling
|
|
22
|
+
|
|
23
|
+
// ============================================
|
|
24
|
+
// Field wrapper
|
|
25
|
+
// ============================================
|
|
26
|
+
|
|
27
|
+
export function Field({ label, children }: { label: string; children: ReactNode }) {
|
|
28
|
+
return (
|
|
29
|
+
<div className="flex items-center gap-2.5 py-[5px]">
|
|
30
|
+
<label className="text-[11px] text-neutral-400 w-[56px] min-w-[56px] shrink-0">
|
|
31
|
+
{label}
|
|
32
|
+
</label>
|
|
33
|
+
<div className="flex-1 min-w-0">{children}</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ============================================
|
|
39
|
+
// Text input
|
|
40
|
+
// ============================================
|
|
41
|
+
|
|
42
|
+
export function TextInput({
|
|
43
|
+
value,
|
|
44
|
+
onChange,
|
|
45
|
+
placeholder,
|
|
46
|
+
type = "text",
|
|
47
|
+
}: {
|
|
48
|
+
value: string | number;
|
|
49
|
+
onChange: (value: string) => void;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
type?: "text" | "number";
|
|
52
|
+
}) {
|
|
53
|
+
return (
|
|
54
|
+
<input
|
|
55
|
+
type={type}
|
|
56
|
+
value={value}
|
|
57
|
+
onChange={(e) => onChange(e.target.value)}
|
|
58
|
+
placeholder={placeholder}
|
|
59
|
+
className="w-full rounded-lg border border-transparent bg-white px-2.5 py-[7px] text-xs text-neutral-900 font-normal outline-none transition-all hover:bg-neutral-50 focus:bg-white focus:border-[#3580f9] focus:shadow-[0_0_0_3px_rgba(53, 128, 249,0.06)] font-[inherit] placeholder:text-neutral-400"
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ============================================
|
|
65
|
+
// Select input
|
|
66
|
+
// ============================================
|
|
67
|
+
|
|
68
|
+
export function SelectInput({
|
|
69
|
+
value,
|
|
70
|
+
onChange,
|
|
71
|
+
options,
|
|
72
|
+
}: {
|
|
73
|
+
value: string;
|
|
74
|
+
onChange: (value: string) => void;
|
|
75
|
+
options: { value: string; label: string }[];
|
|
76
|
+
}) {
|
|
77
|
+
return (
|
|
78
|
+
<div className="relative">
|
|
79
|
+
<select
|
|
80
|
+
value={value}
|
|
81
|
+
onChange={(e) => onChange(e.target.value)}
|
|
82
|
+
className="w-full rounded-lg border border-transparent bg-white px-2.5 py-[7px] text-xs text-neutral-900 font-normal outline-none appearance-none cursor-pointer pr-7 transition-all hover:bg-neutral-50 focus:bg-white focus:border-[#3580f9] focus:shadow-[0_0_0_3px_rgba(53, 128, 249,0.06)] font-[inherit]"
|
|
83
|
+
>
|
|
84
|
+
{options.map((opt) => (
|
|
85
|
+
<option key={opt.value} value={opt.value}>
|
|
86
|
+
{opt.label}
|
|
87
|
+
</option>
|
|
88
|
+
))}
|
|
89
|
+
</select>
|
|
90
|
+
<div className="absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-neutral-400">
|
|
91
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
92
|
+
<path
|
|
93
|
+
d="M3 4.5l3 3 3-3"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
strokeWidth="1.5"
|
|
96
|
+
strokeLinecap="round"
|
|
97
|
+
strokeLinejoin="round"
|
|
98
|
+
/>
|
|
99
|
+
</svg>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// ============================================
|
|
106
|
+
// Segmented control
|
|
107
|
+
// ============================================
|
|
108
|
+
|
|
109
|
+
export function SegmentedControl({
|
|
110
|
+
value,
|
|
111
|
+
onChange,
|
|
112
|
+
options,
|
|
113
|
+
}: {
|
|
114
|
+
value: string;
|
|
115
|
+
onChange: (value: string) => void;
|
|
116
|
+
options: { value: string; label: string | ReactNode }[];
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<div className="flex bg-white rounded-lg p-0.5 border border-[#f0f0f0]">
|
|
120
|
+
{options.map((opt) => (
|
|
121
|
+
<button
|
|
122
|
+
key={String(opt.value)}
|
|
123
|
+
onClick={() => onChange(opt.value)}
|
|
124
|
+
className={`flex-1 px-2 py-[5px] text-[10px] font-medium rounded-md transition-all flex items-center justify-center ${
|
|
125
|
+
value === opt.value
|
|
126
|
+
? "text-neutral-900 bg-neutral-100 shadow-[0_1px_2px_rgba(0,0,0,0.04)]"
|
|
127
|
+
: "text-neutral-400 hover:text-neutral-600"
|
|
128
|
+
}`}
|
|
129
|
+
>
|
|
130
|
+
{opt.label}
|
|
131
|
+
</button>
|
|
132
|
+
))}
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ============================================
|
|
138
|
+
// Toggle switch
|
|
139
|
+
// ============================================
|
|
140
|
+
|
|
141
|
+
export function Toggle({
|
|
142
|
+
value,
|
|
143
|
+
onChange,
|
|
144
|
+
}: {
|
|
145
|
+
value: boolean;
|
|
146
|
+
onChange: (value: boolean) => void;
|
|
147
|
+
}) {
|
|
148
|
+
return (
|
|
149
|
+
<button
|
|
150
|
+
onClick={() => onChange(!value)}
|
|
151
|
+
className="w-9 h-5 rounded-full relative transition-all cursor-pointer"
|
|
152
|
+
style={{
|
|
153
|
+
background: value ? "#3580f9" : "#d4d4d4",
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<div
|
|
157
|
+
className="w-3.5 h-3.5 rounded-full bg-white absolute top-[2.5px] transition-all shadow-sm"
|
|
158
|
+
style={{ left: value ? 19 : 2 }}
|
|
159
|
+
/>
|
|
160
|
+
</button>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ============================================
|
|
165
|
+
// Range slider
|
|
166
|
+
// ============================================
|
|
167
|
+
|
|
168
|
+
export function RangeSlider({
|
|
169
|
+
value,
|
|
170
|
+
onChange,
|
|
171
|
+
min = 0,
|
|
172
|
+
max = 100,
|
|
173
|
+
suffix,
|
|
174
|
+
}: {
|
|
175
|
+
value: number;
|
|
176
|
+
onChange: (value: number) => void;
|
|
177
|
+
min?: number;
|
|
178
|
+
max?: number;
|
|
179
|
+
suffix?: string;
|
|
180
|
+
}) {
|
|
181
|
+
return (
|
|
182
|
+
<div className="flex items-center gap-2">
|
|
183
|
+
<input
|
|
184
|
+
type="range"
|
|
185
|
+
min={min}
|
|
186
|
+
max={max}
|
|
187
|
+
value={value}
|
|
188
|
+
onChange={(e) => onChange(Number(e.target.value))}
|
|
189
|
+
className="flex-1"
|
|
190
|
+
style={{ accentColor: "#3580f9" }}
|
|
191
|
+
/>
|
|
192
|
+
<span className="text-[10px] text-neutral-400 w-9 text-right tabular-nums">
|
|
193
|
+
{value}{suffix || ""}
|
|
194
|
+
</span>
|
|
195
|
+
</div>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ============================================
|
|
200
|
+
// Card section — collapsible with colored icon
|
|
201
|
+
// ============================================
|
|
202
|
+
|
|
203
|
+
export function CardSection({
|
|
204
|
+
title,
|
|
205
|
+
icon,
|
|
206
|
+
iconBg,
|
|
207
|
+
defaultOpen = true,
|
|
208
|
+
children,
|
|
209
|
+
}: {
|
|
210
|
+
title: string;
|
|
211
|
+
icon: ReactNode;
|
|
212
|
+
iconBg: string;
|
|
213
|
+
defaultOpen?: boolean;
|
|
214
|
+
children: ReactNode;
|
|
215
|
+
}) {
|
|
216
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<div
|
|
220
|
+
className="mx-2.5 my-1 rounded-[10px] bg-[#fafafa] border border-transparent transition-colors hover:border-[#f0f0f0]"
|
|
221
|
+
>
|
|
222
|
+
<button
|
|
223
|
+
onClick={() => setOpen(!open)}
|
|
224
|
+
className="flex items-center gap-2 w-full px-3 py-2.5 cursor-pointer select-none hover:bg-black/[0.01] rounded-[10px] transition-colors"
|
|
225
|
+
>
|
|
226
|
+
<div
|
|
227
|
+
className="w-[26px] h-[26px] rounded-[7px] flex items-center justify-center shrink-0"
|
|
228
|
+
style={{ background: iconBg }}
|
|
229
|
+
>
|
|
230
|
+
{icon}
|
|
231
|
+
</div>
|
|
232
|
+
<span className="text-[11px] font-semibold text-neutral-600 tracking-[0.2px]">
|
|
233
|
+
{title}
|
|
234
|
+
</span>
|
|
235
|
+
<span
|
|
236
|
+
className="ml-auto text-neutral-400 transition-transform"
|
|
237
|
+
style={{ transform: open ? "rotate(180deg)" : "rotate(0)" }}
|
|
238
|
+
>
|
|
239
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
240
|
+
<path
|
|
241
|
+
d="M3 4.5l3 3 3-3"
|
|
242
|
+
stroke="currentColor"
|
|
243
|
+
strokeWidth="1.5"
|
|
244
|
+
strokeLinecap="round"
|
|
245
|
+
strokeLinejoin="round"
|
|
246
|
+
/>
|
|
247
|
+
</svg>
|
|
248
|
+
</span>
|
|
249
|
+
</button>
|
|
250
|
+
{open && <div className="px-3 pb-3 pt-0.5">{children}</div>}
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ============================================
|
|
256
|
+
// Legacy Section — kept for NavItemSettings compatibility
|
|
257
|
+
// ============================================
|
|
258
|
+
|
|
259
|
+
export function Section({
|
|
260
|
+
title,
|
|
261
|
+
defaultOpen = true,
|
|
262
|
+
children,
|
|
263
|
+
}: {
|
|
264
|
+
title: string;
|
|
265
|
+
defaultOpen?: boolean;
|
|
266
|
+
children: ReactNode;
|
|
267
|
+
}) {
|
|
268
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div>
|
|
272
|
+
<button
|
|
273
|
+
onClick={() => setOpen(!open)}
|
|
274
|
+
className="flex items-center justify-between w-full py-2 border-t border-neutral-200 mt-1 text-[11px] font-semibold text-neutral-900 tracking-wide cursor-pointer uppercase"
|
|
275
|
+
>
|
|
276
|
+
{title}
|
|
277
|
+
<span
|
|
278
|
+
className="text-neutral-400 transition-transform"
|
|
279
|
+
style={{ transform: open ? "rotate(180deg)" : "rotate(0)" }}
|
|
280
|
+
>
|
|
281
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
282
|
+
<path
|
|
283
|
+
d="M3 4.5l3 3 3-3"
|
|
284
|
+
stroke="currentColor"
|
|
285
|
+
strokeWidth="1.5"
|
|
286
|
+
strokeLinecap="round"
|
|
287
|
+
strokeLinejoin="round"
|
|
288
|
+
/>
|
|
289
|
+
</svg>
|
|
290
|
+
</span>
|
|
291
|
+
</button>
|
|
292
|
+
{open && <div className="pb-2">{children}</div>}
|
|
293
|
+
</div>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ============================================
|
|
298
|
+
// Thin divider line
|
|
299
|
+
// ============================================
|
|
300
|
+
|
|
301
|
+
export function Divider() {
|
|
302
|
+
return <div className="h-px bg-[#f0f0f0] my-1.5" />;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// ============================================
|
|
306
|
+
// Color input (hex) with swatch preview
|
|
307
|
+
// ============================================
|
|
308
|
+
|
|
309
|
+
export function ColorInput({
|
|
310
|
+
value,
|
|
311
|
+
onChange,
|
|
312
|
+
placeholder = "Transparent",
|
|
313
|
+
}: {
|
|
314
|
+
value: string;
|
|
315
|
+
onChange: (value: string) => void;
|
|
316
|
+
placeholder?: string;
|
|
317
|
+
}) {
|
|
318
|
+
return (
|
|
319
|
+
<div className="flex gap-1.5 items-center">
|
|
320
|
+
<div
|
|
321
|
+
className="w-7 h-7 rounded-lg border border-neutral-200 shrink-0 cursor-pointer"
|
|
322
|
+
style={{
|
|
323
|
+
background: value || "transparent",
|
|
324
|
+
backgroundImage: !value
|
|
325
|
+
? "repeating-conic-gradient(#e5e5e5 0% 25%, transparent 0% 50%) 0 0 / 8px 8px"
|
|
326
|
+
: "none",
|
|
327
|
+
}}
|
|
328
|
+
/>
|
|
329
|
+
<TextInput value={value} onChange={onChange} placeholder={placeholder} />
|
|
330
|
+
{value && (
|
|
331
|
+
<button
|
|
332
|
+
onClick={() => onChange("")}
|
|
333
|
+
className="group/bb relative text-neutral-400 hover:text-neutral-600 shrink-0"
|
|
334
|
+
aria-label="Clear"
|
|
335
|
+
>
|
|
336
|
+
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
337
|
+
<path d="M3 3l6 6M9 3l-6 6" stroke="currentColor" strokeWidth="1.2" strokeLinecap="round" />
|
|
338
|
+
</svg>
|
|
339
|
+
<BubbleTooltip>Clear</BubbleTooltip>
|
|
340
|
+
</button>
|
|
341
|
+
)}
|
|
342
|
+
</div>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// ============================================
|
|
347
|
+
// Card section icon presets — re-exported from centralized section-icons.tsx
|
|
348
|
+
// Session 163: Unified icon system. All icons now live in section-icons.tsx.
|
|
349
|
+
// ============================================
|
|
350
|
+
export {
|
|
351
|
+
PositionIcon,
|
|
352
|
+
TypographyIcon,
|
|
353
|
+
AnimationIcon,
|
|
354
|
+
SpacingIcon,
|
|
355
|
+
ContentIcon,
|
|
356
|
+
LinkIcon,
|
|
357
|
+
GridIcon,
|
|
358
|
+
StyleIcon,
|
|
359
|
+
BackgroundIcon,
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// ============================================
|
|
363
|
+
// Viewport Switcher — segmented control for Desktop / Tablet / Phone
|
|
364
|
+
// ============================================
|
|
365
|
+
|
|
366
|
+
const viewportOptions: { value: NavViewport; icon: ReactNode; label: string }[] = [
|
|
367
|
+
{
|
|
368
|
+
value: "desktop",
|
|
369
|
+
label: "Desktop",
|
|
370
|
+
icon: (
|
|
371
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
372
|
+
<rect x="2" y="3" width="20" height="14" rx="2" /><line x1="8" y1="21" x2="16" y2="21" /><line x1="12" y1="17" x2="12" y2="21" />
|
|
373
|
+
</svg>
|
|
374
|
+
),
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
value: "tablet",
|
|
378
|
+
label: "Tablet",
|
|
379
|
+
icon: (
|
|
380
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
381
|
+
<rect x="4" y="2" width="16" height="20" rx="2" /><line x1="12" y1="18" x2="12" y2="18" />
|
|
382
|
+
</svg>
|
|
383
|
+
),
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
value: "phone",
|
|
387
|
+
label: "Phone",
|
|
388
|
+
icon: (
|
|
389
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
390
|
+
<rect x="5" y="2" width="14" height="20" rx="2" /><line x1="12" y1="18" x2="12" y2="18" />
|
|
391
|
+
</svg>
|
|
392
|
+
),
|
|
393
|
+
},
|
|
394
|
+
];
|
|
395
|
+
|
|
396
|
+
export function ViewportSwitcher({
|
|
397
|
+
value,
|
|
398
|
+
onChange,
|
|
399
|
+
}: {
|
|
400
|
+
value: NavViewport;
|
|
401
|
+
onChange: (v: NavViewport) => void;
|
|
402
|
+
}) {
|
|
403
|
+
return (
|
|
404
|
+
<div className="flex bg-white rounded-lg p-0.5 border border-[#f0f0f0] mb-2">
|
|
405
|
+
{viewportOptions.map((opt) => {
|
|
406
|
+
const isActive = value === opt.value;
|
|
407
|
+
const isNonDesktop = opt.value !== "desktop";
|
|
408
|
+
return (
|
|
409
|
+
<button
|
|
410
|
+
key={opt.value}
|
|
411
|
+
onClick={() => onChange(opt.value)}
|
|
412
|
+
aria-label={opt.label}
|
|
413
|
+
className={`group/bb relative flex-1 px-2 py-[5px] text-[10px] font-medium rounded-md transition-all flex items-center justify-center gap-1 ${
|
|
414
|
+
isActive
|
|
415
|
+
? isNonDesktop
|
|
416
|
+
? "text-[#3580f9] bg-blue-50 shadow-[0_1px_2px_rgba(53, 128, 249,0.08)]"
|
|
417
|
+
: "text-neutral-900 bg-neutral-100 shadow-[0_1px_2px_rgba(0,0,0,0.04)]"
|
|
418
|
+
: "text-neutral-400 hover:text-neutral-600"
|
|
419
|
+
}`}
|
|
420
|
+
>
|
|
421
|
+
{opt.icon}
|
|
422
|
+
<BubbleTooltip>{opt.label}</BubbleTooltip>
|
|
423
|
+
</button>
|
|
424
|
+
);
|
|
425
|
+
})}
|
|
426
|
+
</div>
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// ============================================
|
|
431
|
+
// Viewport Badge — shows which viewport is being edited
|
|
432
|
+
// ============================================
|
|
433
|
+
|
|
434
|
+
export function NavViewportBadge({ viewport }: { viewport: NavViewport }) {
|
|
435
|
+
if (viewport === "desktop") return null;
|
|
436
|
+
|
|
437
|
+
const color = viewport === "tablet" ? "#3580f9" : "#7c3aed";
|
|
438
|
+
const bgColor = viewport === "tablet" ? "rgba(53, 128, 249, 0.06)" : "rgba(124, 58, 237, 0.06)";
|
|
439
|
+
const label = viewport === "tablet" ? "Tablet" : "Phone";
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<div
|
|
443
|
+
className="flex items-center gap-1.5 px-2.5 py-1.5 rounded-md mb-2 text-[10px]"
|
|
444
|
+
style={{ background: bgColor, color }}
|
|
445
|
+
>
|
|
446
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
|
|
447
|
+
<circle cx="12" cy="12" r="10" /><line x1="12" y1="8" x2="12" y2="12" /><line x1="12" y1="16" x2="12.01" y2="16" />
|
|
448
|
+
</svg>
|
|
449
|
+
<span>
|
|
450
|
+
Editing <strong>{label}</strong> overrides · empty fields inherit desktop
|
|
451
|
+
</span>
|
|
452
|
+
</div>
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// ============================================
|
|
457
|
+
// Responsive Field — wraps a field with inherited/overridden state
|
|
458
|
+
// ============================================
|
|
459
|
+
|
|
460
|
+
export function ResponsiveField({
|
|
461
|
+
label,
|
|
462
|
+
viewport,
|
|
463
|
+
isOverridden,
|
|
464
|
+
onReset,
|
|
465
|
+
children,
|
|
466
|
+
}: {
|
|
467
|
+
label: string;
|
|
468
|
+
viewport: NavViewport;
|
|
469
|
+
isOverridden: boolean;
|
|
470
|
+
onReset?: () => void;
|
|
471
|
+
children: ReactNode;
|
|
472
|
+
}) {
|
|
473
|
+
// Desktop mode — render as a normal field
|
|
474
|
+
if (viewport === "desktop") {
|
|
475
|
+
return <Field label={label}>{children}</Field>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return (
|
|
479
|
+
<div className="flex items-center gap-2.5 py-[5px]">
|
|
480
|
+
<div className="w-[56px] min-w-[56px] shrink-0">
|
|
481
|
+
<label
|
|
482
|
+
className={`text-[11px] block ${
|
|
483
|
+
isOverridden ? "text-[#3580f9] font-medium" : "text-neutral-400"
|
|
484
|
+
}`}
|
|
485
|
+
>
|
|
486
|
+
{label}
|
|
487
|
+
</label>
|
|
488
|
+
{isOverridden ? (
|
|
489
|
+
<span className="text-[8px] text-[#3580f9]/60 uppercase tracking-[0.5px]">
|
|
490
|
+
override
|
|
491
|
+
</span>
|
|
492
|
+
) : (
|
|
493
|
+
<span className="text-[8px] text-neutral-300 uppercase tracking-[0.5px]">
|
|
494
|
+
inherited
|
|
495
|
+
</span>
|
|
496
|
+
)}
|
|
497
|
+
</div>
|
|
498
|
+
<div
|
|
499
|
+
className="flex-1 min-w-0 transition-opacity"
|
|
500
|
+
style={{ opacity: isOverridden ? 1 : 0.5 }}
|
|
501
|
+
>
|
|
502
|
+
{children}
|
|
503
|
+
</div>
|
|
504
|
+
{isOverridden && onReset && (
|
|
505
|
+
<button
|
|
506
|
+
onClick={onReset}
|
|
507
|
+
className="group/bb relative shrink-0 text-[#3580f9]/60 hover:text-[#3580f9] transition-colors"
|
|
508
|
+
aria-label="Reset to desktop value"
|
|
509
|
+
>
|
|
510
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
511
|
+
<polyline points="1 4 1 10 7 10" /><path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
|
|
512
|
+
</svg>
|
|
513
|
+
<BubbleTooltip>Reset to desktop value</BubbleTooltip>
|
|
514
|
+
</button>
|
|
515
|
+
)}
|
|
516
|
+
</div>
|
|
517
|
+
);
|
|
518
|
+
}
|