Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
KryptXBSA committed Jan 11, 2025
1 parent 2f3b1b1 commit 54d692b
Show file tree
Hide file tree
Showing 64 changed files with 2,280 additions and 2,022 deletions.
2 changes: 1 addition & 1 deletion .changeset/cuddly-mails-stare.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"formbuilder-core": minor
"formbuilder-core": patch
---

Refactor Core Type Definitions
6 changes: 6 additions & 0 deletions .changeset/wet-dancers-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"formbuilder-core": minor
"web": patch
---

Refactor codegen for new variants
4 changes: 1 addition & 3 deletions apps/web/src/app/builder/_components/AddField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"use client";
import * as React from "react";
import {
Accordion,
} from "@/components/ui/accordion";
import { Accordion } from "@/components/ui/accordion";
import type { FormFramework, FrameworkFieldKinds } from "formbuilder-core";
import { AddFieldAccordion } from "./AddFieldAccordion";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/builder/_components/Code/Code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function Code() {
Prerequisites
</h3>
<p>First make sure you have </p>
<CodeSteppers/>
<CodeSteppers />
</div>
);
}
42 changes: 21 additions & 21 deletions apps/web/src/app/builder/_components/CustomSensor.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { MouseEvent, KeyboardEvent } from 'react'
import type { MouseEvent, KeyboardEvent } from "react";
import {
MouseSensor as LibMouseSensor,
KeyboardSensor as LibKeyboardSensor
} from '@dnd-kit/core'
MouseSensor as LibMouseSensor,
KeyboardSensor as LibKeyboardSensor,
} from "@dnd-kit/core";

export class MouseSensor extends LibMouseSensor {
static activators = [
{
eventName: 'onMouseDown' as const,
handler: ({ nativeEvent: event }: MouseEvent) => {
return shouldHandleEvent(event.target as HTMLElement)
}
}
]
static activators = [
{
eventName: "onMouseDown" as const,
handler: ({ nativeEvent: event }: MouseEvent) => {
return shouldHandleEvent(event.target as HTMLElement);
},
},
];
}

// export class KeyboardSensor extends LibKeyboardSensor {
Expand All @@ -27,14 +27,14 @@ export class MouseSensor extends LibMouseSensor {
// }

function shouldHandleEvent(element: HTMLElement | null) {
let cur = element
let cur = element;

while (cur) {
if (cur.dataset?.noDnd) {
return false
}
cur = cur.parentElement
}
while (cur) {
if (cur.dataset?.noDnd) {
return false;
}
cur = cur.parentElement;
}

return true
}
return true;
}
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
"use client"
"use client";

import * as React from "react"
import { Check, ChevronsUpDown } from "lucide-react"
import * as React from "react";
import { Check, ChevronsUpDown } from "lucide-react";

import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
import type { FormFramework } from "formbuilder-core"
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import type { FormFramework } from "formbuilder-core";
import { useAppState } from "@/state/state";

const frameworks: { value: FormFramework; label: string }[] = [
{
value: "next",
label: "Next.js",
},
{
value: "react",
label: "React",
},
{
value: "svelte",
label: "Svelte",
},
{
value: "vue",
label: "Vue",
},
{
value: "solid",
label: "Solid",
},
{
value: "astro",
label: "Astro",
},
]
{
value: "next",
label: "Next.js",
},
{
value: "react",
label: "React",
},
{
value: "svelte",
label: "Svelte",
},
{
value: "vue",
label: "Vue",
},
{
value: "solid",
label: "Solid",
},
{
value: "astro",
label: "Astro",
},
];

export function FrameworkCombobox() {
const { currentForm, updateFormFramework } = useAppState();
const [open, setOpen] = React.useState(false)
const [value, setValue] = React.useState(currentForm.framework)
const { currentForm, updateFormFramework } = useAppState();
const [open, setOpen] = React.useState(false);
const [value, setValue] = React.useState(currentForm.framework);

// React.useEffect(() => {
// setValue(currentForm.framework);
// }, [currentForm]);
// React.useEffect(() => {
// setValue(currentForm.framework);
// }, [currentForm]);

return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<ChevronsUpDown className="opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[200px] p-0">
<Command>
<CommandInput placeholder="Search framework..." className="h-9" />
<CommandList>
<CommandEmpty>No framework found.</CommandEmpty>
<CommandGroup>
{frameworks.map((framework) => (
<CommandItem
key={framework.value}
value={framework.value}
onSelect={(currentValue) => {
setValue(currentValue === value ? "" : currentValue)
updateFormFramework(currentValue)
setOpen(false)
}}
>
{framework.label}
<Check
className={cn(
"ml-auto",
value === framework.value ? "opacity-100" : "opacity-0"
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
)
return (
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
className="w-[200px] justify-between"
>
{value
? frameworks.find((framework) => framework.value === value)?.label
: "Select framework..."}
<ChevronsUpDown className="opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[200px] p-0">
<Command>
<CommandInput placeholder="Search framework..." className="h-9" />
<CommandList>
<CommandEmpty>No framework found.</CommandEmpty>
<CommandGroup>
{frameworks.map((framework) => (
<CommandItem
key={framework.value}
value={framework.value}
onSelect={(currentValue) => {
setValue(currentValue === value ? "" : currentValue);
updateFormFramework(currentValue);
setOpen(false);
}}
>
{framework.label}
<Check
className={cn(
"ml-auto",
value === framework.value ? "opacity-100" : "opacity-0",
)}
/>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</PopoverContent>
</Popover>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function FieldSettings() {
/>
</div>

<div className="flex mt-6 w-full flex-col gap-8 ">
<div className="mt-6 flex w-full flex-col gap-8 ">
<div className="flex max-w-sm flex-row items-center justify-between rounded-lg border p-4">
<div className="space-y-0.5">
<div className="text-base">Required</div>
Expand Down
Loading

0 comments on commit 54d692b

Please sign in to comment.