diff --git a/packages/ui/src/button/index.ts b/packages/ui/src/button/index.ts deleted file mode 100644 index f1330143ef..0000000000 --- a/packages/ui/src/button/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -export * from "./toggle-switch"; diff --git a/packages/ui/src/button/toggle-switch.tsx b/packages/ui/src/button/toggle-switch.tsx deleted file mode 100644 index 1252b63232..0000000000 --- a/packages/ui/src/button/toggle-switch.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import { Switch } from "@headlessui/react"; -// helpers -import { cn } from "../utils"; - -interface IToggleSwitchProps { - value: boolean; - onChange: (value: boolean) => void; - label?: string; - size?: "sm" | "md" | "lg"; - disabled?: boolean; - className?: string; -} - -function ToggleSwitch(props: IToggleSwitchProps) { - const { value, onChange, label, size = "sm", disabled, className } = props; - - return ( - - {label} - - ); -} - -ToggleSwitch.displayName = "plane-ui-toggle-switch"; - -export { ToggleSwitch }; diff --git a/packages/ui/src/form-fields/checkbox.tsx b/packages/ui/src/form-fields/checkbox.tsx deleted file mode 100644 index 0b44f2ea46..0000000000 --- a/packages/ui/src/form-fields/checkbox.tsx +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import * as React from "react"; -// helpers -import { cn } from "../utils"; - -export interface CheckboxProps extends React.InputHTMLAttributes { - containerClassName?: string; - iconClassName?: string; - indeterminate?: boolean; -} - -const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.ForwardedRef) { - const { - id, - name, - checked, - indeterminate = false, - disabled, - containerClassName, - iconClassName, - className, - ...rest - } = props; - - return ( -
- - - -
- ); -}); -Checkbox.displayName = "form-checkbox-field"; - -export { Checkbox }; diff --git a/packages/ui/src/form-fields/index.ts b/packages/ui/src/form-fields/index.ts index 3ba3ac3ccf..1ffa30fdbc 100644 --- a/packages/ui/src/form-fields/index.ts +++ b/packages/ui/src/form-fields/index.ts @@ -7,5 +7,4 @@ export * from "./input"; export * from "./textarea"; export * from "./input-color-picker"; -export * from "./checkbox"; export * from "./password"; diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 3d4b7ce430..5045d520d8 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -6,7 +6,6 @@ export * from "./avatar"; export * from "./breadcrumbs"; -export * from "./button"; export * from "./card"; export * from "./collapsible"; export * from "./content-wrapper"; @@ -22,12 +21,10 @@ export * from "./link"; export * from "./loader"; export * from "./modals"; export * from "./popovers"; -export * from "./progress"; export * from "./row"; export * from "./sortable"; export * from "./spinners"; export * from "./tables"; export * from "./tag"; -export * from "./tooltip"; export * from "./utils"; export * from "./oauth"; diff --git a/packages/ui/src/progress/circular-progress-indicator.tsx b/packages/ui/src/progress/circular-progress-indicator.tsx deleted file mode 100644 index b679522322..0000000000 --- a/packages/ui/src/progress/circular-progress-indicator.tsx +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import React from "react"; - -interface ICircularProgressIndicator { - size: number; - percentage: number; - strokeWidth?: number; - strokeColor?: string; - children?: React.ReactNode; -} - -export function CircularProgressIndicator(props: ICircularProgressIndicator) { - const { size = 40, percentage = 25, strokeWidth = 6, strokeColor = "stroke-success-secondary", children } = props; - - const sqSize = size; - const radius = (size - strokeWidth) / 2; - const viewBox = `0 0 ${sqSize} ${sqSize}`; - const dashArray = radius * Math.PI * 2; - const dashOffset = dashArray - (dashArray * percentage) / 100; - return ( -
- - - {/* - - - - - - - - - - - - - */} - - -
- {children} -
-
- ); -} diff --git a/packages/ui/src/progress/index.ts b/packages/ui/src/progress/index.ts deleted file mode 100644 index 70d29c6b8e..0000000000 --- a/packages/ui/src/progress/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -export * from "./linear-progress-indicator"; -export * from "./circular-progress-indicator"; diff --git a/packages/ui/src/progress/linear-progress-indicator.tsx b/packages/ui/src/progress/linear-progress-indicator.tsx deleted file mode 100644 index ac98b6e8f5..0000000000 --- a/packages/ui/src/progress/linear-progress-indicator.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import React from "react"; -import { Tooltip } from "@plane/propel/tooltip"; -import { cn } from "../utils"; - -type Props = { - data: any; - noTooltip?: boolean; - inPercentage?: boolean; - size?: "sm" | "md" | "lg" | "xl"; - className?: string; - barClassName?: string; -}; - -export function LinearProgressIndicator({ - data, - noTooltip = false, - inPercentage = false, - size = "sm", - className = "", - barClassName = "", -}: Props) { - const total = data.reduce((acc: any, cur: any) => acc + cur.value, 0); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - let progress = 0; - - const bars = data.map((item: any) => { - const width = `${(item.value / total) * 100}%`; - if (width === "0%") return <>; - const style = { - width, - backgroundColor: item.color, - }; - progress += item.value; - if (noTooltip) return
; - else - return ( - -
- - ); - }); - - return ( -
-
{bars}
-
- ); -} diff --git a/packages/ui/src/tooltip/index.ts b/packages/ui/src/tooltip/index.ts deleted file mode 100644 index 301cbae308..0000000000 --- a/packages/ui/src/tooltip/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -export * from "./tooltip"; diff --git a/packages/ui/src/tooltip/tooltip.tsx b/packages/ui/src/tooltip/tooltip.tsx deleted file mode 100644 index e06a71b172..0000000000 --- a/packages/ui/src/tooltip/tooltip.tsx +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2023-present Plane Software, Inc. and contributors - * SPDX-License-Identifier: AGPL-3.0-only - * See the LICENSE file for details. - */ - -import React, { useEffect, useRef, useState } from "react"; -import { Tooltip as PropelTooltip } from "@plane/propel/tooltip"; -import type { TPlacement } from "@plane/propel/utils"; - -/** - * Kept as an alias so existing `TPosition` consumers keep compiling. - * - * The previous Blueprint-backed implementation also accepted `bottom-left`, - * `left-top`, `top-right` and friends. Those have no equivalent in the design - * system's placement vocabulary (which spells them `bottom-start`, `top-end`, ...) - * and no call site in the repo used them. - */ -export type TPosition = TPlacement; - -interface ITooltipProps { - tooltipHeading?: string; - tooltipContent: string | React.ReactNode; - position?: TPosition; - // React 19 defaults ReactElement's props to `unknown`; propel's Tooltip needs a - // named props shape, so mirror it here rather than casting at the call site. - children: React.ReactElement>; - disabled?: boolean; - className?: string; - openDelay?: number; - closeDelay?: number; - isMobile?: boolean; - renderByDefault?: boolean; -} - -export function Tooltip({ - tooltipHeading, - tooltipContent, - position = "top", - children, - disabled = false, - className = "", - openDelay = 200, - closeDelay, - isMobile = false, - - //FIXME: tooltip should always render on hover and not by default, this is a temporary fix - renderByDefault = true, -}: ITooltipProps) { - const toolTipRef = useRef(null); - - const [shouldRender, setShouldRender] = useState(renderByDefault); - - const onHover = () => { - setShouldRender(true); - }; - - useEffect(() => { - const element = toolTipRef.current as any; - - if (!element) return; - - element.addEventListener("mouseenter", onHover); - - return () => { - element?.removeEventListener("mouseenter", onHover); - }; - }, [toolTipRef, shouldRender]); - - if (!shouldRender) { - return ( -
- {children} -
- ); - } - - return ( - - {children} - - ); -}