diff --git a/packages/ui/src/radio-input/index.tsx b/packages/ui/src/radio-input/index.tsx deleted file mode 100644 index 99ac1d9b6..000000000 --- a/packages/ui/src/radio-input/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from "./radio-input"; diff --git a/packages/ui/src/radio-input/radio-input.stories.tsx b/packages/ui/src/radio-input/radio-input.stories.tsx deleted file mode 100644 index 544c2feb4..000000000 --- a/packages/ui/src/radio-input/radio-input.stories.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import { fn } from "@storybook/test"; -import { RadioInput } from "./radio-input"; - -const meta: Meta = { - title: "RadioInput", - component: RadioInput, -}; - -export default meta; -type Story = StoryObj; - -const options = [ - { label: "Option 1", value: "option1" }, - { - label: - "A very very long label, lets add some lipsum text and see what happens? May be we don't have to. This is long enough", - value: "option2", - }, - { label: "Option 3", value: "option3" }, -]; - -export const Default: Story = { - args: { - options, - label: "Horizontal Radio Input", - }, -}; - -export const vertical: Story = { - args: { - options, - label: "Vertical Radio Input", - vertical: true, - }, -}; diff --git a/web/components/estimates/create/stage-one.tsx b/web/components/estimates/create/stage-one.tsx index 8f12675e7..caa20e614 100644 --- a/web/components/estimates/create/stage-one.tsx +++ b/web/components/estimates/create/stage-one.tsx @@ -1,7 +1,9 @@ import { FC } from "react"; import { Crown, Info } from "lucide-react"; import { TEstimateSystemKeys } from "@plane/types"; -import { RadioInput, Tooltip } from "@plane/ui"; +import { Tooltip } from "@plane/ui"; +// components +import { RadioInput } from "@/components/estimates"; // constants import { ESTIMATE_SYSTEMS } from "@/constants/estimates"; @@ -45,6 +47,7 @@ export const EstimateCreateStageOne: FC = (props) => { disabled: !ESTIMATE_SYSTEMS[currentSystem]?.is_available || ESTIMATE_SYSTEMS[currentSystem]?.is_ee, }; })} + name="estimate-radio-input" label="Choose an estimate system" labelClassName="text-sm font-medium text-custom-text-200 mb-1.5" wrapperClassName="relative flex flex-wrap gap-14" diff --git a/web/components/estimates/index.ts b/web/components/estimates/index.ts index 45572e7f0..4e090232d 100644 --- a/web/components/estimates/index.ts +++ b/web/components/estimates/index.ts @@ -3,6 +3,7 @@ export * from "./root"; export * from "./empty-screen"; export * from "./loader-screen"; export * from "./ee-banner"; +export * from "./radio-select"; export * from "./estimate-search"; export * from "./estimate-disable-switch"; diff --git a/web/components/estimates/points/index.ts b/web/components/estimates/points/index.ts index a2942d04b..68e300883 100644 --- a/web/components/estimates/points/index.ts +++ b/web/components/estimates/points/index.ts @@ -1,10 +1,10 @@ -export * from "./create-root"; -export * from "./edit-root"; - export * from "./preview"; export * from "./create"; export * from "./update"; export * from "./delete"; export * from "./select-dropdown"; +export * from "./create-root"; + +export * from "./edit-root"; export * from "./switch"; diff --git a/packages/ui/src/radio-input/radio-input.tsx b/web/components/estimates/radio-select.tsx similarity index 57% rename from packages/ui/src/radio-input/radio-input.tsx rename to web/components/estimates/radio-select.tsx index 16e1d5e9c..f8569ea88 100644 --- a/packages/ui/src/radio-input/radio-input.tsx +++ b/web/components/estimates/radio-select.tsx @@ -1,9 +1,9 @@ import React from "react"; -import { Field, Label, Radio, RadioGroup } from "@headlessui/react"; -import { cn } from "../../helpers"; // helpers +import { cn } from "@/helpers/common.helper"; type RadioInputProps = { + name?: string; label: string | React.ReactNode | undefined; wrapperClassName?: string; fieldClassName?: string; @@ -18,6 +18,7 @@ type RadioInputProps = { }; export const RadioInput = ({ + name = "radio-input", label: inputLabel, labelClassName: inputLabelClassName = "", wrapperClassName: inputWrapperClassName = "", @@ -43,29 +44,41 @@ export const RadioInput = ({ aria = "radio-input"; } - // return

Hello

; - return ( - - +
+
{inputLabel}
{options.map(({ value, label, disabled }, index) => ( - - !disabled && setSelected(value)} + className={cn( + "flex items-center gap-2", + disabled ? `bg-custom-background-200 border-custom-border-200 cursor-not-allowed` : ``, + inputFieldClassName + )} + > + - - - - + checked={selected === value} + /> + +
))}
-
+ ); }; diff --git a/web/store/root.store.ts b/web/store/root.store.ts index eaabf8738..9a7f5f244 100644 --- a/web/store/root.store.ts +++ b/web/store/root.store.ts @@ -104,5 +104,6 @@ export class RootStore { this.projectInbox = new ProjectInboxStore(this); this.projectPages = new ProjectPageStore(this); this.multipleSelect = new MultipleSelectStore(); + this.projectEstimate = new ProjectEstimateStore(this); } } diff --git a/yarn.lock b/yarn.lock index dee1ae110..aa98a1750 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9320,6 +9320,11 @@ lucide-react@^0.378.0: resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.378.0.tgz#232acb99c6baedfa90959a2c0dd11327b058bde8" integrity sha512-u6EPU8juLUk9ytRcyapkWI18epAv3RU+6+TC23ivjR0e+glWKBobFeSgRwOIJihzktILQuy6E0E80P2jVTDR5g== +lucide-react@^0.379.0: + version "0.379.0" + resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.379.0.tgz#29e34eeffae7fb241b64b09868cbe3ab888ef7cc" + integrity sha512-KcdeVPqmhRldldAAgptb8FjIunM2x2Zy26ZBh1RsEUcdLIvsEmbcw7KpzFYUy5BbpGeWhPu9Z9J5YXfStiXwhg== + lz-string@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"