From 1615f6dc83feb73a45eb749c63405f9a71605ba2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-KDOUI1T\\justi" Date: Sun, 2 Jun 2024 10:37:00 -0700 Subject: [PATCH] chore: moving paths for some examples --- .../examples/forms/account/account-form.tsx | 47 ++-- .../playground/components/model-selector.tsx | 2 +- .../examples/forms/account/account-form.tsx | 222 ------------------ .../playground/components/model-selector.tsx | 163 ------------- .../default/example/combobox-form.tsx | 2 +- .../new-york/example/combobox-form.tsx | 2 +- 6 files changed, 28 insertions(+), 410 deletions(-) delete mode 100644 apps/www/app/examples/forms/account/account-form.tsx delete mode 100644 apps/www/app/examples/playground/components/model-selector.tsx diff --git a/apps/www/app/(app)/examples/forms/account/account-form.tsx b/apps/www/app/(app)/examples/forms/account/account-form.tsx index 16f8c856252..4f43a758797 100644 --- a/apps/www/app/(app)/examples/forms/account/account-form.tsx +++ b/apps/www/app/(app)/examples/forms/account/account-form.tsx @@ -12,6 +12,7 @@ import { Calendar } from "@/registry/new-york/ui/calendar" import { Command, CommandEmpty, + CommandList, CommandGroup, CommandInput, CommandItem, @@ -180,28 +181,30 @@ export function AccountForm() { - No language found. - - {languages.map((language) => ( - { - form.setValue("language", language.value) - }} - > - - {language.label} - - ))} - + + No language found. + + {languages.map((language) => ( + { + form.setValue("language", language.value) + }} + > + + {language.label} + + ))} + + diff --git a/apps/www/app/(app)/examples/playground/components/model-selector.tsx b/apps/www/app/(app)/examples/playground/components/model-selector.tsx index 6eefef49459..6e0a75cf686 100644 --- a/apps/www/app/(app)/examples/playground/components/model-selector.tsx +++ b/apps/www/app/(app)/examples/playground/components/model-selector.tsx @@ -149,7 +149,7 @@ function ModelItem({ model, isSelected, onSelect, onPeek }: ModelItemProps) { key={model.id} onSelect={onSelect} ref={ref} - className="aria-selected:bg-primary aria-selected:text-primary-foreground" + className="aria-[selected='true']:bg-primary aria-[selected='true']:text-primary-foreground" > {model.name} - -// This can come from your database or API. -const defaultValues: Partial = { - // name: "Your name", - // dob: new Date("2023-01-23"), -} - -export function AccountForm() { - const form = useForm({ - resolver: zodResolver(accountFormSchema), - defaultValues, - }) - - function onSubmit(data: AccountFormValues) { - toast({ - title: "You submitted the following values:", - description: ( -
-          {JSON.stringify(data, null, 2)}
-        
- ), - }) - } - - return ( -
- - ( - - Name - - - - - This is the name that will be displayed on your profile and in - emails. - - - - )} - /> - ( - - Date of birth - - - - - - - - - date > new Date() || date < new Date("1900-01-01") - } - initialFocus - /> - - - - Your date of birth is used to calculate your age. - - - - )} - /> - ( - - Language - - - - - - - - - - - No language found. - - {languages.map((language) => ( - { - form.setValue("language", language.value) - }} - > - - {language.label} - - ))} - - - - - - - This is the language that will be used in the dashboard. - - - - )} - /> - - - - ) -} diff --git a/apps/www/app/examples/playground/components/model-selector.tsx b/apps/www/app/examples/playground/components/model-selector.tsx deleted file mode 100644 index 6e0a75cf686..00000000000 --- a/apps/www/app/examples/playground/components/model-selector.tsx +++ /dev/null @@ -1,163 +0,0 @@ -"use client" - -import * as React from "react" -import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons" -import { PopoverProps } from "@radix-ui/react-popover" - -import { cn } from "@/lib/utils" -import { useMutationObserver } from "@/hooks/use-mutation-observer" -import { Button } from "@/registry/new-york/ui/button" -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from "@/registry/new-york/ui/command" -import { - HoverCard, - HoverCardContent, - HoverCardTrigger, -} from "@/registry/new-york/ui/hover-card" -import { Label } from "@/registry/new-york/ui/label" -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/registry/new-york/ui/popover" - -import { Model, ModelType } from "../data/models" - -interface ModelSelectorProps extends PopoverProps { - types: readonly ModelType[] - models: Model[] -} - -export function ModelSelector({ models, types, ...props }: ModelSelectorProps) { - const [open, setOpen] = React.useState(false) - const [selectedModel, setSelectedModel] = React.useState(models[0]) - const [peekedModel, setPeekedModel] = React.useState(models[0]) - - return ( -
- - - - - - The model which will generate the completion. Some models are suitable - for natural language tasks, others specialize in code. Learn more. - - - - - - - - - -
-

{peekedModel.name}

-
- {peekedModel.description} -
- {peekedModel.strengths ? ( -
-
- Strengths -
-
    - {peekedModel.strengths} -
-
- ) : null} -
-
- - - - No Models found. - - {types.map((type) => ( - - {models - .filter((model) => model.type === type) - .map((model) => ( - setPeekedModel(model)} - onSelect={() => { - setSelectedModel(model) - setOpen(false) - }} - /> - ))} - - ))} - - -
-
-
-
- ) -} - -interface ModelItemProps { - model: Model - isSelected: boolean - onSelect: () => void - onPeek: (model: Model) => void -} - -function ModelItem({ model, isSelected, onSelect, onPeek }: ModelItemProps) { - const ref = React.useRef(null) - - useMutationObserver(ref, (mutations) => { - for (const mutation of mutations) { - if (mutation.type === "attributes") { - if (mutation.attributeName === "aria-selected") { - onPeek(model) - } - } - } - }) - - return ( - - {model.name} - - - ) -} diff --git a/apps/www/registry/default/example/combobox-form.tsx b/apps/www/registry/default/example/combobox-form.tsx index 8fcb8f109aa..9aa35dc7b88 100644 --- a/apps/www/registry/default/example/combobox-form.tsx +++ b/apps/www/registry/default/example/combobox-form.tsx @@ -10,10 +10,10 @@ import { Button } from "@/registry/default/ui/button" import { Command, CommandEmpty, - CommandList, CommandGroup, CommandInput, CommandItem, + CommandList, } from "@/registry/default/ui/command" import { Form, diff --git a/apps/www/registry/new-york/example/combobox-form.tsx b/apps/www/registry/new-york/example/combobox-form.tsx index 40b862480be..d4cd293e460 100644 --- a/apps/www/registry/new-york/example/combobox-form.tsx +++ b/apps/www/registry/new-york/example/combobox-form.tsx @@ -10,10 +10,10 @@ import { Button } from "@/registry/new-york/ui/button" import { Command, CommandEmpty, - CommandList, CommandGroup, CommandInput, CommandItem, + CommandList, } from "@/registry/new-york/ui/command" import { Form,