@betterstart/cli 0.1.52 → 0.1.53
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/cli.js +4 -59
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2605,7 +2605,6 @@ ${fieldsJSX}
|
|
|
2605
2605
|
const textareaImport = resolveUiImport(cwd, "textarea");
|
|
2606
2606
|
const selectImport = resolveUiImport(cwd, "select");
|
|
2607
2607
|
const radioGroupImport = resolveUiImport(cwd, "radio-group");
|
|
2608
|
-
const progressImport = resolveUiImport(cwd, "progress");
|
|
2609
2608
|
const mediaUploadImport = resolveUiImport(cwd, "media-upload-field");
|
|
2610
2609
|
const content = buildComponentSource({
|
|
2611
2610
|
pascal,
|
|
@@ -2619,7 +2618,6 @@ ${fieldsJSX}
|
|
|
2619
2618
|
textareaImport,
|
|
2620
2619
|
selectImport,
|
|
2621
2620
|
radioGroupImport,
|
|
2622
|
-
progressImport,
|
|
2623
2621
|
mediaUploadImport,
|
|
2624
2622
|
zodFields,
|
|
2625
2623
|
defaults,
|
|
@@ -2666,8 +2664,8 @@ export function ${p7.pascal}Form() {
|
|
|
2666
2664
|
return `'use client'
|
|
2667
2665
|
|
|
2668
2666
|
import { zodResolver } from '@hookform/resolvers/zod'
|
|
2669
|
-
import {
|
|
2670
|
-
import { parseAsInteger,
|
|
2667
|
+
import { ChevronLeft, ChevronRight${hasListFields ? ", Trash2" : ""} } from 'lucide-react'
|
|
2668
|
+
import { parseAsInteger, useQueryState } from 'nuqs'
|
|
2671
2669
|
import { useState } from 'react'
|
|
2672
2670
|
${p7.rhfImport}
|
|
2673
2671
|
import { z } from 'zod/v3'${queryClientImport}
|
|
@@ -2684,8 +2682,8 @@ import {
|
|
|
2684
2682
|
} from '${p7.formImport}'
|
|
2685
2683
|
import { Input } from '${p7.inputImport}'${p7.hasFileUpload ? `
|
|
2686
2684
|
import { MediaUploadField } from '${p7.mediaUploadImport}'` : ""}
|
|
2687
|
-
import {
|
|
2688
|
-
|
|
2685
|
+
${p7.hasRadio ? `import { RadioGroup, RadioGroupItem } from '${p7.radioGroupImport}'
|
|
2686
|
+
` : ""}
|
|
2689
2687
|
import { Textarea } from '${p7.textareaImport}'
|
|
2690
2688
|
import {
|
|
2691
2689
|
Select,
|
|
@@ -2705,8 +2703,6 @@ ${p7.stepsConst}
|
|
|
2705
2703
|
|
|
2706
2704
|
${formComponentDecl}() {
|
|
2707
2705
|
const [currentStep, setCurrentStep] = useQueryState('step', parseAsInteger.withDefault(0))
|
|
2708
|
-
const [completedStepsArr, setCompletedStepsArr] = useQueryState('completed', parseAsArrayOf(parseAsInteger).withDefault([]))
|
|
2709
|
-
const completedSteps = new Set(completedStepsArr)
|
|
2710
2706
|
const [submitted, setSubmitted] = useState(false)
|
|
2711
2707
|
const [submitting, setSubmitting] = useState(false)
|
|
2712
2708
|
|
|
@@ -2723,9 +2719,6 @@ ${p7.fieldArraySetup}${p7.watchSetup}
|
|
|
2723
2719
|
STEPS[currentStep].fields as (keyof FormValues)[]
|
|
2724
2720
|
)
|
|
2725
2721
|
if (isValid) {
|
|
2726
|
-
if (!completedSteps.has(currentStep)) {
|
|
2727
|
-
setCompletedStepsArr([...completedStepsArr, currentStep])
|
|
2728
|
-
}
|
|
2729
2722
|
setCurrentStep(currentStep + 1)
|
|
2730
2723
|
}
|
|
2731
2724
|
}
|
|
@@ -2734,12 +2727,6 @@ ${p7.fieldArraySetup}${p7.watchSetup}
|
|
|
2734
2727
|
setCurrentStep(currentStep - 1)
|
|
2735
2728
|
}
|
|
2736
2729
|
|
|
2737
|
-
function handleStepClick(index: number) {
|
|
2738
|
-
if (index < currentStep || completedSteps.has(index)) {
|
|
2739
|
-
setCurrentStep(index)
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
|
|
2743
2730
|
async function onSubmit(values: FormValues) {
|
|
2744
2731
|
setSubmitting(true)
|
|
2745
2732
|
try {
|
|
@@ -2768,48 +2755,6 @@ ${p7.fieldArraySetup}${p7.watchSetup}
|
|
|
2768
2755
|
return (
|
|
2769
2756
|
<Form {...form}>
|
|
2770
2757
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
2771
|
-
{/* Mobile step indicator */}
|
|
2772
|
-
<div className="md:hidden space-y-2">
|
|
2773
|
-
<p className="text-sm text-muted-foreground">
|
|
2774
|
-
Step {currentStep + 1} of {STEPS.length} — {STEPS[currentStep].label}
|
|
2775
|
-
</p>
|
|
2776
|
-
<Progress value={((currentStep + 1) / STEPS.length) * 100} />
|
|
2777
|
-
</div>
|
|
2778
|
-
|
|
2779
|
-
{/* Desktop step indicator */}
|
|
2780
|
-
<nav className="hidden md:flex items-center justify-center" aria-label="Form progress">
|
|
2781
|
-
{STEPS.map((step, index) => (
|
|
2782
|
-
<div key={step.name} className="flex items-center">
|
|
2783
|
-
<button
|
|
2784
|
-
type="button"
|
|
2785
|
-
onClick={() => handleStepClick(index)}
|
|
2786
|
-
disabled={index > currentStep && !completedSteps.has(index)}
|
|
2787
|
-
aria-current={index === currentStep ? 'step' : undefined}
|
|
2788
|
-
className={\`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium transition-colors \${
|
|
2789
|
-
completedSteps.has(index)
|
|
2790
|
-
? 'bg-primary text-primary-foreground cursor-pointer'
|
|
2791
|
-
: index === currentStep
|
|
2792
|
-
? 'border-2 border-primary text-primary'
|
|
2793
|
-
: 'border-2 border-muted text-muted-foreground'
|
|
2794
|
-
}\`}
|
|
2795
|
-
>
|
|
2796
|
-
{completedSteps.has(index) ? (
|
|
2797
|
-
<Check className="h-4 w-4" />
|
|
2798
|
-
) : (
|
|
2799
|
-
index + 1
|
|
2800
|
-
)}
|
|
2801
|
-
</button>
|
|
2802
|
-
{index < STEPS.length - 1 && (
|
|
2803
|
-
<div
|
|
2804
|
-
className={\`h-0.5 w-8 mx-1 \${
|
|
2805
|
-
completedSteps.has(index) ? 'bg-primary' : 'bg-muted'
|
|
2806
|
-
}\`}
|
|
2807
|
-
/>
|
|
2808
|
-
)}
|
|
2809
|
-
</div>
|
|
2810
|
-
))}
|
|
2811
|
-
</nav>
|
|
2812
|
-
|
|
2813
2758
|
{/* Step header */}
|
|
2814
2759
|
<div>
|
|
2815
2760
|
<h3 className="text-lg font-semibold">{STEPS[currentStep].label}</h3>
|