- {colors.map(([name, variants]) => (
-
-
{name}
-
- {variants.map((variant) => (
-
- ))}
-
-
- ))}
+ render() {
+ const colors = [
+ ["Surface", ["level-0", "level-1", "level-2", "level-3"]],
+ [
+ "Text",
+ [
+ "txt-primary",
+ "txt-invert",
+ "txt-secondary",
+ "txt-tertiary",
+ "txt-quaternary",
+ "txt-disabled",
+ "txt-accent",
+ "txt-danger",
+ "txt-success",
+ "txt-info",
+ "txt-warning",
+ ],
+ ],
+ [
+ "Background",
+ [
+ "bg-primary",
+ "bg-invert",
+ "bg-secondary",
+ "bg-tertiary",
+ "bg-subtle",
+ "bg-highlight",
+ "bg-active",
+ "bg-accent",
+ "bg-danger",
+ "bg-success",
+ "bg-info",
+ "bg-warning",
+ ],
+ ],
+ [
+ "Border",
+ [
+ "border-solid",
+ "border-low",
+ "border-mid",
+ "border-strong",
+ "border-active",
+ "border-accent",
+ "border-danger",
+ "border-success",
+ "border-warning",
+ "border-info",
+ ],
+ ],
+ [
+ "Hover",
+ [
+ "bg-primary-hover",
+ "bg-invert-hover",
+ "bg-secondary-hover",
+ "bg-tertiary-hover",
+ "bg-subtle-hover",
+ "bg-highlight-hover",
+ "bg-active-hover",
+ "bg-accent-hover",
+ "bg-danger-hover",
+ "bg-success-hover",
+ "bg-info-hover",
+ "bg-warning-hover",
+ ],
+ ],
+ [
+ "Pressed",
+ [
+ "bg-primary-pressed",
+ "bg-invert-pressed",
+ "bg-secondary-pressed",
+ "bg-tertiary-pressed",
+ "bg-subtle-pressed",
+ "bg-highlight-pressed",
+ "bg-active-pressed",
+ "bg-accent-pressed",
+ "bg-danger-pressed",
+ "bg-success-pressed",
+ "bg-info-pressed",
+ "bg-warning-pressed",
+ ],
+ ],
+ ] as [string, string[]][];
+ return (
+
+ {colors.map(([name, variants]) => (
+
+
{name}
+
+ {variants.map(variant => (
+
+ ))}
- );
- },
+
+ ))}
+
+ );
+ },
};
export const Typography: Story = {
- render() {
- const textVariants = [
- "text-5xl",
- "text-4xl",
- "text-3xl",
- "text-2xl",
- "text-xl",
- "text-xl-medium",
- "text-lg",
- "text-lg-bold",
- "text-base",
- "text-base-link",
- "text-sm",
- "text-xs",
- "text-xxs",
- ];
- return (
-
- {textVariants.map((variant) => (
-
-
- {variant}
-
-
This is a text {variant}
-
- ))}
+ render() {
+ const textVariants = [
+ "text-5xl",
+ "text-4xl",
+ "text-3xl",
+ "text-2xl",
+ "text-xl",
+ "text-xl-medium",
+ "text-lg",
+ "text-lg-bold",
+ "text-base",
+ "text-base-link",
+ "text-sm",
+ "text-xs",
+ "text-xxs",
+ ];
+ return (
+
+ {textVariants.map(variant => (
+
+
+ {variant}
- );
- },
+
+ This is a text
+ {variant}
+
+
+ ))}
+
+ );
+ },
};
export const Icons: Story = {
- render() {
- return (
-
- {objectKeys(icons).map((k) => {
- const IconComponent = icons[k];
- return (
-
-
-
- {k.replace("Icon", "")}
-
-
- );
- })}
-
- );
- },
+ render() {
+ return (
+
+ {objectKeys(icons).map((k) => {
+ const IconComponent = icons[k];
+ return (
+
+
+
+ {k.replace("Icon", "")}
+
+
+ );
+ })}
+
+ );
+ },
};
diff --git a/packages/ui/src/Layouts/AuthLayout.stories.tsx b/packages/ui/src/Layouts/AuthLayout.stories.tsx
deleted file mode 100644
index 01631acc4..000000000
--- a/packages/ui/src/Layouts/AuthLayout.stories.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import { AuthLayout } from "./AuthLayout";
-import type { Meta, StoryObj } from "@storybook/react";
-
-export default {
- title: "Layouts/AuthLayout",
- component: AuthLayout,
- argTypes: {},
- parameters: {
- layout: "full",
- },
-} satisfies Meta
;
-
-type Story = StoryObj;
-
-export const Default: Story = {
- args: {
- children: "Text goes here",
- },
-};
diff --git a/packages/ui/src/Layouts/CenteredLayout.stories.tsx b/packages/ui/src/Layouts/CenteredLayout.stories.tsx
index 54880c75e..045bb81d8 100644
--- a/packages/ui/src/Layouts/CenteredLayout.stories.tsx
+++ b/packages/ui/src/Layouts/CenteredLayout.stories.tsx
@@ -2,15 +2,15 @@ import { CenteredLayout } from "./CenteredLayout";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Layouts/CenteredLayout",
- component: CenteredLayout,
- argTypes: {},
+ title: "Layouts/CenteredLayout",
+ component: CenteredLayout,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- args: {
- children: "lorem ipsum",
- },
+ args: {
+ children: "lorem ipsum",
+ },
};
diff --git a/packages/ui/src/Layouts/ErrorLayout.stories.tsx b/packages/ui/src/Layouts/ErrorLayout.stories.tsx
index 0c75c2acf..a109b971a 100644
--- a/packages/ui/src/Layouts/ErrorLayout.stories.tsx
+++ b/packages/ui/src/Layouts/ErrorLayout.stories.tsx
@@ -2,16 +2,16 @@ import { ErrorLayout } from "./ErrorLayout";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Layouts/ErrorLayout",
- component: ErrorLayout,
- argTypes: {},
+ title: "Layouts/ErrorLayout",
+ component: ErrorLayout,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- args: {
- title: "Something went wrong",
- description: "An unexpected error occurred",
- },
+ args: {
+ title: "Something went wrong",
+ description: "An unexpected error occurred",
+ },
};
diff --git a/packages/ui/src/Layouts/ErrorLayout.tsx b/packages/ui/src/Layouts/ErrorLayout.tsx
index 8e85103d1..ecdde2a8f 100644
--- a/packages/ui/src/Layouts/ErrorLayout.tsx
+++ b/packages/ui/src/Layouts/ErrorLayout.tsx
@@ -2,17 +2,17 @@ import type { PropsWithChildren } from "react";
import { IconCircleInfo } from "../Atoms/Icons";
type Props = PropsWithChildren<{
- title?: string;
- description?: string;
+ title?: string;
+ description?: string;
}>;
export function ErrorLayout({ title, description, children }: Props) {
- return (
-
-
-
{title}
-
{description}
- {children}
-
- );
+ return (
+
+
+
{title}
+
{description}
+ {children}
+
+ );
}
diff --git a/packages/ui/src/Layouts/Layout.stories.tsx b/packages/ui/src/Layouts/Layout.stories.tsx
index 021a21776..30dd1c766 100644
--- a/packages/ui/src/Layouts/Layout.stories.tsx
+++ b/packages/ui/src/Layouts/Layout.stories.tsx
@@ -2,46 +2,46 @@ import { Layout, Drawer } from "./Layout";
import type { Meta, StoryObj } from "@storybook/react";
const meta = {
- title: "Layouts/Base",
- component: Layout,
- parameters: {
- layout: "full",
- },
+ title: "Layouts/Base",
+ component: Layout,
+ parameters: {
+ layout: "full",
+ },
} satisfies Meta;
export default meta;
type Story = StoryObj;
export const Default: Story = {
- args: {
- children: (
-
- Lorem ipsum dolor sit amet consectetur, adipisicing elit.
- Tempora tempore odit at ipsa dignissimos cumque deleniti, illum
- rerum sunt laudantium molestias ducimus vero maiores eligendi
- necessitatibus nemo animi. Ipsam, fugit.
-
- ),
- },
+ args: {
+ children: (
+
+ Lorem ipsum dolor sit amet consectetur, adipisicing elit.
+ Tempora tempore odit at ipsa dignissimos cumque deleniti, illum
+ rerum sunt laudantium molestias ducimus vero maiores eligendi
+ necessitatibus nemo animi. Ipsam, fugit.
+
+ ),
+ },
};
export const WithSidebar: Story = {
- args: {
- children: (
- <>
-
- Lorem ipsum dolor sit amet consectetur, adipisicing elit.
- Tempora tempore odit at ipsa dignissimos cumque deleniti,
- illum rerum sunt laudantium molestias ducimus vero maiores
- eligendi necessitatibus nemo animi. Ipsam, fugit.
-
-
- Lorem ipsum dolor sit amet consectetur adipisicing elit.
- Nostrum reiciendis eveniet possimus illo rerum labore nisi
- voluptatibus sequi consectetur corrupti, a, sunt dicta ut ad
- pariatur. Beatae optio libero pariatur!
-
- >
- ),
- },
+ args: {
+ children: (
+ <>
+
+ Lorem ipsum dolor sit amet consectetur, adipisicing elit.
+ Tempora tempore odit at ipsa dignissimos cumque deleniti,
+ illum rerum sunt laudantium molestias ducimus vero maiores
+ eligendi necessitatibus nemo animi. Ipsam, fugit.
+
+
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.
+ Nostrum reiciendis eveniet possimus illo rerum labore nisi
+ voluptatibus sequi consectetur corrupti, a, sunt dicta ut ad
+ pariatur. Beatae optio libero pariatur!
+
+ >
+ ),
+ },
};
diff --git a/packages/ui/src/Molecules/Badge/DocumentClassificationBadge.tsx b/packages/ui/src/Molecules/Badge/DocumentClassificationBadge.tsx
index 96dac36a9..d50fbc1a6 100644
--- a/packages/ui/src/Molecules/Badge/DocumentClassificationBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/DocumentClassificationBadge.tsx
@@ -3,31 +3,31 @@ import { getDocumentClassificationLabel } from "@probo/helpers";
import { useTranslate } from "@probo/i18n";
type Props = {
- classification: string;
+ classification: string;
};
export function DocumentClassificationBadge({ classification }: Props) {
- const { __ } = useTranslate();
+ const { __ } = useTranslate();
- // Choose badge variant based on classification level
- const variant = (() => {
- switch (classification) {
- case "PUBLIC":
- return "success" as const;
- case "INTERNAL":
- return "neutral" as const;
- case "CONFIDENTIAL":
- return "warning" as const;
- case "SECRET":
- return "danger" as const;
- default:
- return "neutral" as const;
- }
- })();
+ // Choose badge variant based on classification level
+ const variant = (() => {
+ switch (classification) {
+ case "PUBLIC":
+ return "success" as const;
+ case "INTERNAL":
+ return "neutral" as const;
+ case "CONFIDENTIAL":
+ return "warning" as const;
+ case "SECRET":
+ return "danger" as const;
+ default:
+ return "neutral" as const;
+ }
+ })();
- return (
-
- {getDocumentClassificationLabel(__, classification)}
-
- );
+ return (
+
+ {getDocumentClassificationLabel(__, classification)}
+
+ );
}
diff --git a/packages/ui/src/Molecules/Badge/DocumentTypeBadge.stories.tsx b/packages/ui/src/Molecules/Badge/DocumentTypeBadge.stories.tsx
index 40a5aa16e..df2b2f562 100644
--- a/packages/ui/src/Molecules/Badge/DocumentTypeBadge.stories.tsx
+++ b/packages/ui/src/Molecules/Badge/DocumentTypeBadge.stories.tsx
@@ -2,15 +2,15 @@ import { DocumentTypeBadge } from "./DocumentTypeBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Badges/DocumentTypeBadge",
- component: DocumentTypeBadge,
- argTypes: {},
+ title: "Molecules/Badges/DocumentTypeBadge",
+ component: DocumentTypeBadge,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- args: {
- type: "OTHER",
- },
+ args: {
+ type: "OTHER",
+ },
};
diff --git a/packages/ui/src/Molecules/Badge/DocumentTypeBadge.tsx b/packages/ui/src/Molecules/Badge/DocumentTypeBadge.tsx
index ea5f1da36..529d52a23 100644
--- a/packages/ui/src/Molecules/Badge/DocumentTypeBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/DocumentTypeBadge.tsx
@@ -3,10 +3,10 @@ import { getDocumentTypeLabel } from "@probo/helpers";
import { useTranslate } from "@probo/i18n";
type Props = {
- type: string;
+ type: string;
};
export function DocumentTypeBadge({ type }: Props) {
- const { __ } = useTranslate();
- return {getDocumentTypeLabel(__, type)} ;
+ const { __ } = useTranslate();
+ return {getDocumentTypeLabel(__, type)} ;
}
diff --git a/packages/ui/src/Molecules/Badge/DocumentVersionBadge.stories.tsx b/packages/ui/src/Molecules/Badge/DocumentVersionBadge.stories.tsx
index d9458b642..b03edf568 100644
--- a/packages/ui/src/Molecules/Badge/DocumentVersionBadge.stories.tsx
+++ b/packages/ui/src/Molecules/Badge/DocumentVersionBadge.stories.tsx
@@ -2,20 +2,20 @@ import { DocumentVersionBadge } from "./DocumentVersionBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Badges/DocumentVersionBadge",
- component: DocumentVersionBadge,
- argTypes: {},
+ title: "Molecules/Badges/DocumentVersionBadge",
+ component: DocumentVersionBadge,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render() {
- return (
-
-
-
-
- );
- },
+ render() {
+ return (
+
+
+
+
+ );
+ },
};
diff --git a/packages/ui/src/Molecules/Badge/DocumentVersionBadge.tsx b/packages/ui/src/Molecules/Badge/DocumentVersionBadge.tsx
index bd1d74465..1dcd18368 100644
--- a/packages/ui/src/Molecules/Badge/DocumentVersionBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/DocumentVersionBadge.tsx
@@ -2,14 +2,14 @@ import { useTranslate } from "@probo/i18n";
import { Badge } from "../../Atoms/Badge/Badge.tsx";
type Props = {
- state: "DRAFT" | "PUBLISHED";
+ state: "DRAFT" | "PUBLISHED";
};
export function DocumentVersionBadge(props: Props) {
- const { __ } = useTranslate();
- return (
-
- {props.state === "DRAFT" ? __("Draft") : __("Published")}
-
- );
+ const { __ } = useTranslate();
+ return (
+
+ {props.state === "DRAFT" ? __("Draft") : __("Published")}
+
+ );
}
diff --git a/packages/ui/src/Molecules/Badge/MeasureBadge.stories.tsx b/packages/ui/src/Molecules/Badge/MeasureBadge.stories.tsx
index a325903e5..0beb3e335 100644
--- a/packages/ui/src/Molecules/Badge/MeasureBadge.stories.tsx
+++ b/packages/ui/src/Molecules/Badge/MeasureBadge.stories.tsx
@@ -2,9 +2,9 @@ import { MeasureBadge } from "./MeasureBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Badges/MeasureBadge",
- component: MeasureBadge,
- argTypes: {},
+ title: "Molecules/Badges/MeasureBadge",
+ component: MeasureBadge,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
diff --git a/packages/ui/src/Molecules/Badge/MeasureBadge.tsx b/packages/ui/src/Molecules/Badge/MeasureBadge.tsx
index e594dc63e..5b426fb3b 100644
--- a/packages/ui/src/Molecules/Badge/MeasureBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/MeasureBadge.tsx
@@ -5,24 +5,24 @@ import type { ComponentProps } from "react";
import type { measureStates } from "@probo/helpers";
type Props = {
- state: (typeof measureStates)[number];
+ state: (typeof measureStates)[number];
};
const stateToVariant: Record<
- Props["state"],
- ComponentProps["variant"]
+ Props["state"],
+ ComponentProps["variant"]
> = {
- IMPLEMENTED: "success",
- IN_PROGRESS: "info",
- NOT_APPLICABLE: "neutral",
- NOT_STARTED: "neutral",
+ IMPLEMENTED: "success",
+ IN_PROGRESS: "info",
+ NOT_APPLICABLE: "neutral",
+ NOT_STARTED: "neutral",
};
export function MeasureBadge({ state }: Props) {
- const { __ } = useTranslate();
- return (
-
- {getMeasureStateLabel(__, state)}
-
- );
+ const { __ } = useTranslate();
+ return (
+
+ {getMeasureStateLabel(__, state)}
+
+ );
}
diff --git a/packages/ui/src/Molecules/Badge/RiskBadge.stories.tsx b/packages/ui/src/Molecules/Badge/RiskBadge.stories.tsx
index 48f359ff0..8af15fb94 100644
--- a/packages/ui/src/Molecules/Badge/RiskBadge.stories.tsx
+++ b/packages/ui/src/Molecules/Badge/RiskBadge.stories.tsx
@@ -2,19 +2,19 @@ import { RiskBadge } from "./RiskBadge";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Badges/RiskBadge",
- component: RiskBadge,
- argTypes: {},
+ title: "Molecules/Badges/RiskBadge",
+ component: RiskBadge,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render: () => (
-
-
-
-
-
- ),
+ render: () => (
+
+
+
+
+
+ ),
};
diff --git a/packages/ui/src/Molecules/Badge/RiskBadge.tsx b/packages/ui/src/Molecules/Badge/RiskBadge.tsx
index 3478d5d05..1f4ae8d6d 100644
--- a/packages/ui/src/Molecules/Badge/RiskBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/RiskBadge.tsx
@@ -2,59 +2,59 @@ import { useTranslate } from "@probo/i18n";
import { Badge } from "../../Atoms/Badge/Badge";
type Props = {
- level: number | string;
+ level: number | string;
};
const badgeVariant = (level: string | number) => {
- if (typeof level === "number") {
- if (level >= 15) {
- level = "CRITICAL";
- } else if (level >= 8) {
- level = "HIGH";
- } else {
- level = "LOW";
- }
- }
- switch (level) {
- case "CRITICAL":
- return "danger";
- case "HIGH":
- return "warning";
- case "LOW":
- return "success";
- case "MEDIUM":
- return "info";
- default:
- return "neutral";
+ if (typeof level === "number") {
+ if (level >= 15) {
+ level = "CRITICAL";
+ } else if (level >= 8) {
+ level = "HIGH";
+ } else {
+ level = "LOW";
}
+ }
+ switch (level) {
+ case "CRITICAL":
+ return "danger";
+ case "HIGH":
+ return "warning";
+ case "LOW":
+ return "success";
+ case "MEDIUM":
+ return "info";
+ default:
+ return "neutral";
+ }
};
export function RiskBadge({ level }: Props) {
- const { __ } = useTranslate();
- const label = () => {
- if (typeof level === "number") {
- if (level >= 15) {
- return __("High");
- }
- if (level >= 8) {
- return __("Medium");
- }
- return __("Low");
- }
- switch (level) {
- case "CRITICAL":
- return __("Critical");
- case "HIGH":
- return __("High");
- case "LOW":
- return __("Low");
- case "MEDIUM":
- return __("Medium");
- case "NONE":
- return __("None");
- default:
- return __("Low");
- }
- };
- return {label()} ;
+ const { __ } = useTranslate();
+ const label = () => {
+ if (typeof level === "number") {
+ if (level >= 15) {
+ return __("High");
+ }
+ if (level >= 8) {
+ return __("Medium");
+ }
+ return __("Low");
+ }
+ switch (level) {
+ case "CRITICAL":
+ return __("Critical");
+ case "HIGH":
+ return __("High");
+ case "LOW":
+ return __("Low");
+ case "MEDIUM":
+ return __("Medium");
+ case "NONE":
+ return __("None");
+ default:
+ return __("Low");
+ }
+ };
+ return {label()} ;
}
diff --git a/packages/ui/src/Molecules/Badge/SeverityBadge.stories.tsx b/packages/ui/src/Molecules/Badge/SeverityBadge.stories.tsx
index 3a3612e0d..2294a0abf 100644
--- a/packages/ui/src/Molecules/Badge/SeverityBadge.stories.tsx
+++ b/packages/ui/src/Molecules/Badge/SeverityBadge.stories.tsx
@@ -2,20 +2,20 @@ import { SeverityBadge } from "./SeverityBadge.tsx";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Badges/SeverityBadge",
- component: SeverityBadge,
- argTypes: {},
+ title: "Molecules/Badges/SeverityBadge",
+ component: SeverityBadge,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render: () => (
-
-
-
-
-
-
- ),
+ render: () => (
+
+
+
+
+
+
+ ),
};
diff --git a/packages/ui/src/Molecules/Badge/SeverityBadge.tsx b/packages/ui/src/Molecules/Badge/SeverityBadge.tsx
index 490e04fd7..5bc858083 100644
--- a/packages/ui/src/Molecules/Badge/SeverityBadge.tsx
+++ b/packages/ui/src/Molecules/Badge/SeverityBadge.tsx
@@ -2,29 +2,29 @@ import { useTranslate } from "@probo/i18n";
import { Badge } from "../../Atoms/Badge/Badge.tsx";
type Props = {
- score: number;
+ score: number;
};
const badgeVariant = (score: number) => {
- if (score >= 15) {
- return "danger";
- }
- if (score > 6) {
- return "warning";
- }
- return "success";
+ if (score >= 15) {
+ return "danger";
+ }
+ if (score > 6) {
+ return "warning";
+ }
+ return "success";
};
export function SeverityBadge({ score }: Props) {
- const { __ } = useTranslate();
- const label = () => {
- if (score >= 15) {
- return __("High");
- }
- if (score > 6) {
- return __("Medium");
- }
- return __("Low");
- };
- return {label()} ;
+ const { __ } = useTranslate();
+ const label = () => {
+ if (score >= 15) {
+ return __("High");
+ }
+ if (score > 6) {
+ return __("Medium");
+ }
+ return __("Low");
+ };
+ return {label()} ;
}
diff --git a/packages/ui/src/Molecules/Combobox/Combobox.stories.tsx b/packages/ui/src/Molecules/Combobox/Combobox.stories.tsx
index 90687c1cd..05687cf31 100644
--- a/packages/ui/src/Molecules/Combobox/Combobox.stories.tsx
+++ b/packages/ui/src/Molecules/Combobox/Combobox.stories.tsx
@@ -4,27 +4,27 @@ import type { Meta, StoryObj } from "@storybook/react";
import { times } from "@probo/helpers";
export default {
- title: "Atoms/Combobox",
- component: Combobox,
- argTypes: {},
+ title: "Atoms/Combobox",
+ component: Combobox,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render: function Render() {
- const [items, setItems] = useState(["a", "b", "c"] as string[]);
- const onSearch = (query: string) => {
- setItems(times(10, (i) => `${query} ${i}`));
- };
- return (
- <>
-
- {items.map((item) => (
- {item}
- ))}
-
- >
- );
- },
+ render: function Render() {
+ const [items, setItems] = useState(["a", "b", "c"] as string[]);
+ const onSearch = (query: string) => {
+ setItems(times(10, i => `${query} ${i}`));
+ };
+ return (
+ <>
+
+ {items.map(item => (
+ {item}
+ ))}
+
+ >
+ );
+ },
};
diff --git a/packages/ui/src/Molecules/Combobox/Combobox.tsx b/packages/ui/src/Molecules/Combobox/Combobox.tsx
index 062ad81cd..c3b905b90 100644
--- a/packages/ui/src/Molecules/Combobox/Combobox.tsx
+++ b/packages/ui/src/Molecules/Combobox/Combobox.tsx
@@ -1,74 +1,74 @@
import {
- Combobox as AriaKitCombobox,
- ComboboxItem as AriaKitComboboxItem,
- ComboboxPopover,
- ComboboxProvider,
+ Combobox as AriaKitCombobox,
+ ComboboxItem as AriaKitComboboxItem,
+ ComboboxPopover,
+ ComboboxProvider,
} from "@ariakit/react";
import {
- type ComponentProps,
- type PropsWithChildren,
- type ReactNode,
+ type ComponentProps,
+ type PropsWithChildren,
+ type ReactNode,
} from "react";
import { input } from "../../Atoms/Input/Input";
import { dropdown, dropdownItem } from "../../Atoms/Dropdown/Dropdown";
import { isEmpty } from "@probo/helpers";
type Props = {
- children: ReactNode;
- loading?: boolean;
- onSearch: (query: string) => void;
- placeholder?: string;
- autoSelect?: boolean;
- onSelect?: (value: string) => void;
- resetValueOnHide?: boolean;
- value?: string;
+ children: ReactNode;
+ loading?: boolean;
+ onSearch: (query: string) => void;
+ placeholder?: string;
+ autoSelect?: boolean;
+ onSelect?: (value: string) => void;
+ resetValueOnHide?: boolean;
+ value?: string;
} & Omit, "onSelect" | "value">;
export function Combobox({
- children,
- onSearch,
- placeholder,
- autoSelect,
- onSelect,
- resetValueOnHide,
- value,
- ...props
+ children,
+ onSearch,
+ placeholder,
+ autoSelect,
+ onSelect,
+ resetValueOnHide,
+ value,
+ ...props
}: Props) {
- const showDropdown = !isEmpty(children);
- return (
- onSelect?.(v as string)}
- resetValueOnHide={resetValueOnHide}
+ const showDropdown = !isEmpty(children);
+ return (
+ onSelect?.(v as string)}
+ resetValueOnHide={resetValueOnHide}
+ >
+
+ {showDropdown && (
+
-
- {showDropdown && (
-
- {children}
-
- )}
-
- );
+ {children}
+
+ )}
+
+ );
}
export function ComboboxItem({
- children,
- ...props
+ children,
+ ...props
}: PropsWithChildren>) {
- return (
-
- {children}
-
- );
+ return (
+
+ {children}
+
+ );
}
diff --git a/packages/ui/src/Molecules/Dialog/ConfirmDialog.tsx b/packages/ui/src/Molecules/Dialog/ConfirmDialog.tsx
index 752c24099..f6fd51a8d 100644
--- a/packages/ui/src/Molecules/Dialog/ConfirmDialog.tsx
+++ b/packages/ui/src/Molecules/Dialog/ConfirmDialog.tsx
@@ -1,11 +1,11 @@
import { useTranslate } from "@probo/i18n";
import {
- Root,
- Overlay,
- Content,
- Title,
- Description,
- Cancel,
+ Root,
+ Overlay,
+ Content,
+ Title,
+ Description,
+ Cancel,
} from "@radix-ui/react-alert-dialog";
import { useCallback, useState, useMemo, type ComponentProps } from "react";
import { Button } from "../../Atoms/Button/Button";
@@ -15,136 +15,136 @@ import { create } from "zustand";
import { combine } from "zustand/middleware";
type State = {
- title?: string;
- message: string | null;
- variant?: ComponentProps["variant"];
- label?: string;
- onConfirm: () => Promise;
+ title?: string;
+ message: string | null;
+ variant?: ComponentProps["variant"];
+ label?: string;
+ onConfirm: () => Promise;
};
const useConfirmStore = create(
- combine(
- {
- message: null,
- onConfirm: () => Promise.resolve(),
- } as State,
- (set) => ({
- open: (props: State) => {
- set(props);
- },
- close: () => {
- set({
- message: null,
- });
- },
- }),
- ),
+ combine(
+ {
+ message: null,
+ onConfirm: () => Promise.resolve(),
+ } as State,
+ set => ({
+ open: (props: State) => {
+ set(props);
+ },
+ close: () => {
+ set({
+ message: null,
+ });
+ },
+ }),
+ ),
);
/**
* Hook used to open a confirm dialog
*/
export function useConfirm() {
- const open = useConfirmStore((state) => state.open);
- const { __ } = useTranslate();
+ const open = useConfirmStore(state => state.open);
+ const { __ } = useTranslate();
- return useCallback(
- (cb: State["onConfirm"], props: Omit) => {
- open({
- onConfirm: cb,
- ...props,
- message: props.message,
- title: props.title ?? __("Are you sure ?"),
- variant: props.variant ?? "danger",
- label: props.label ?? __("Delete"),
- });
- },
- [open, __],
- );
+ return useCallback(
+ (cb: State["onConfirm"], props: Omit) => {
+ open({
+ onConfirm: cb,
+ ...props,
+ message: props.message,
+ title: props.title ?? __("Are you sure ?"),
+ variant: props.variant ?? "danger",
+ label: props.label ?? __("Delete"),
+ });
+ },
+ [open, __],
+ );
}
/**
* Global component that displays a dialog when confirm() is called
*/
export function ConfirmDialog() {
- const message = useConfirmStore((state) => state.message);
- const isOpen = !!message;
+ const message = useConfirmStore(state => state.message);
+ const isOpen = !!message;
- if (!isOpen) {
- return null;
- }
+ if (!isOpen) {
+ return null;
+ }
- return ;
+ return ;
}
function ConfirmDialogContent() {
- const message = useConfirmStore((state) => state.message);
- const title = useConfirmStore((state) => state.title);
- const variant = useConfirmStore((state) => state.variant);
- const label = useConfirmStore((state) => state.label);
- const onConfirm = useConfirmStore((state) => state.onConfirm);
- const close = useConfirmStore((state) => state.close);
+ const message = useConfirmStore(state => state.message);
+ const title = useConfirmStore(state => state.title);
+ const variant = useConfirmStore(state => state.variant);
+ const label = useConfirmStore(state => state.label);
+ const onConfirm = useConfirmStore(state => state.onConfirm);
+ const close = useConfirmStore(state => state.close);
- const { __ } = useTranslate();
- const isOpen = !!message;
+ const { __ } = useTranslate();
+ const isOpen = !!message;
- const [loading, setLoading] = useState(false);
+ const [loading, setLoading] = useState(false);
- const dialogStyles = useMemo(() => {
- const styles = dialog();
- return {
- overlay: styles.overlay(),
- content: styles.content({ className: "max-w-[500px]" }),
- header: styles.header(),
- title: styles.title(),
- footer: styles.footer(),
- };
- }, []);
-
- const handleConfirm = async () => {
- setLoading(true);
- try {
- await onConfirm();
- } catch (error) {
- console.error('Confirm action failed:', error);
- } finally {
- close();
- setLoading(false);
- }
+ const dialogStyles = useMemo(() => {
+ const styles = dialog();
+ return {
+ overlay: styles.overlay(),
+ content: styles.content({ className: "max-w-[500px]" }),
+ header: styles.header(),
+ title: styles.title(),
+ footer: styles.footer(),
};
+ }, []);
- const handleOpenChange = (open: boolean) => {
- if (!open) {
- setLoading(false);
- close();
- }
- };
+ const handleConfirm = async () => {
+ setLoading(true);
+ try {
+ await onConfirm();
+ } catch (error) {
+ console.error("Confirm action failed:", error);
+ } finally {
+ close();
+ setLoading(false);
+ }
+ };
- return (
-
-
-
-
-
-
-
-
-
- {__("Cancel")}
-
-
-
- {label}
-
-
-
-
-
- );
+ const handleOpenChange = (open: boolean) => {
+ if (!open) {
+ setLoading(false);
+ close();
+ }
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+ {__("Cancel")}
+
+
+ void handleConfirm()}
+ >
+ {label}
+
+
+
+
+
+ );
}
diff --git a/packages/ui/src/Molecules/Dialog/Dialog.stories.tsx b/packages/ui/src/Molecules/Dialog/Dialog.stories.tsx
index 26dbfa677..9931ec405 100644
--- a/packages/ui/src/Molecules/Dialog/Dialog.stories.tsx
+++ b/packages/ui/src/Molecules/Dialog/Dialog.stories.tsx
@@ -3,34 +3,34 @@ import { Dialog, DialogContent, DialogFooter } from "./Dialog";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Atoms/Dialog",
- component: Dialog,
- argTypes: {},
+ title: "Atoms/Dialog",
+ component: Dialog,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render: (args) => {
- return (
- Open dialog}
- title="Edit profile"
- >
-
-
- Lorem ipsum dolor sit amet consectetur adipisicing elit.
- Voluptate, voluptas. Doloribus incidunt cum laboriosam
- nulla magni soluta voluptatum omnis, sapiente minus
- corporis impedit explicabo vero praesentium, fugit
- possimus facilis rem.
-
-
-
- Save
-
-
- );
- },
+ render: (args) => {
+ return (
+ Open dialog}
+ title="Edit profile"
+ >
+
+
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.
+ Voluptate, voluptas. Doloribus incidunt cum laboriosam
+ nulla magni soluta voluptatum omnis, sapiente minus
+ corporis impedit explicabo vero praesentium, fugit
+ possimus facilis rem.
+
+
+
+ Save
+
+
+ );
+ },
};
diff --git a/packages/ui/src/Molecules/Dialog/Dialog.tsx b/packages/ui/src/Molecules/Dialog/Dialog.tsx
index e4262ee37..c5176d39e 100644
--- a/packages/ui/src/Molecules/Dialog/Dialog.tsx
+++ b/packages/ui/src/Molecules/Dialog/Dialog.tsx
@@ -1,24 +1,25 @@
import {
- Root,
- Trigger,
- Portal,
- Overlay,
- Content,
- Title,
- Close,
+ Root,
+ Trigger,
+ Portal,
+ Overlay,
+ Content,
+ Title,
+ Close,
} from "@radix-ui/react-dialog";
import { IconCrossLargeX } from "../../Atoms/Icons";
import {
- Children,
- cloneElement,
- isValidElement,
- useRef,
- useState,
- type ComponentProps,
- type CSSProperties,
- type HTMLAttributes,
- type ReactNode,
- type RefObject,
+ Children,
+ cloneElement,
+ isValidElement,
+ useEffect,
+ useRef,
+ useState,
+ type ComponentProps,
+ type CSSProperties,
+ type HTMLAttributes,
+ type ReactNode,
+ type RefObject,
} from "react";
import { Button } from "../../Atoms/Button/Button";
import { useTranslate } from "@probo/i18n";
@@ -26,190 +27,197 @@ import clsx from "clsx";
import { tv } from "tailwind-variants";
export const dialog = tv({
- slots: {
- overlay:
+ slots: {
+ overlay:
"fixed inset-0 z-50 bg-dialog/40 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
- content:
+ content:
"text-txt-secondary text-sm fixed inset-0 m-auto z-50 w-full h-max bg-level-2 rounded-2xl max-w-5xl w-[95%] duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-5 data-[state=open]:slide-in-from-top-5",
- header: "flex justify-between items-center p-3 border-b border-b-border-low",
- title: "text-sm font-medium text-txt-primary",
- footer: "flex justify-end items-center p-3 border-t border-t-border-low gap-2",
- },
+ header: "flex justify-between items-center p-3 border-b border-b-border-low",
+ title: "text-sm font-medium text-txt-primary",
+ footer: "flex justify-end items-center p-3 border-t border-t-border-low gap-2",
+ },
});
export type DialogRef = RefObject<{
- open: () => void;
- close: () => void;
+ open: () => void;
+ close: () => void;
} | null>;
type Props = {
- trigger?: ReactNode;
- title?: ReactNode;
- children?: ReactNode;
- defaultOpen?: boolean;
- className?: string;
- ref?: DialogRef;
- onClose?: () => void;
- closable?: boolean;
+ trigger?: ReactNode;
+ title?: ReactNode;
+ children?: ReactNode;
+ defaultOpen?: boolean;
+ className?: string;
+ ref?: DialogRef;
+ onClose?: () => void;
+ closable?: boolean;
};
export const useDialogRef = (): DialogRef => {
- return useRef(null);
+ return useRef(null);
};
export function Dialog({
- trigger,
- title,
- children,
- className,
- ref,
- defaultOpen,
- onClose,
- closable = true,
+ trigger,
+ title,
+ children,
+ className,
+ ref,
+ defaultOpen,
+ onClose,
+ closable = true,
}: Props) {
- const { overlay, content, header, title: titleClassname } = dialog();
- const [open, setOpen] = useState(!!defaultOpen);
+ const { overlay, content, header, title: titleClassname } = dialog();
+ const [open, setOpen] = useState(!!defaultOpen);
+ useEffect(() => {
if (ref) {
- ref.current = {
- open() {
- setOpen(true);
- },
- close() {
- setOpen(false);
- },
- };
+ ref.current = {
+ open() {
+ setOpen(true);
+ },
+ close() {
+ setOpen(false);
+ },
+ };
}
+ });
- const onOpenChange = (open: boolean) => {
- if (!open && !closable) {
- return;
- }
- setOpen(open);
- if (!open) {
- onClose?.();
- }
- };
+ const onOpenChange = (open: boolean) => {
+ if (!open && !closable) {
+ return;
+ }
+ setOpen(open);
+ if (!open) {
+ onClose?.();
+ }
+ };
- const contentProps = closable
- ? {}
- : {
- onEscapeKeyDown: (e: Event) => e.preventDefault(),
- onPointerDownOutside: (e: Event) => e.preventDefault(),
- onInteractOutside: (e: Event) => e.preventDefault(),
- };
+ const contentProps = closable
+ ? {}
+ : {
+ onEscapeKeyDown: (e: Event) => e.preventDefault(),
+ onPointerDownOutside: (e: Event) => e.preventDefault(),
+ onInteractOutside: (e: Event) => e.preventDefault(),
+ };
- return (
-
- {trigger && {trigger} }
-
-
-
- {title ? (
-
-
{title}
- {closable && (
-
-
-
- )}
-
- ) : (
- closable && (
-
-
-
- )
- )}
- {children}
-
-
-
- );
+ return (
+
+ {trigger && {trigger} }
+
+
+
+ {title
+ ? (
+
+
+ {" "}
+ {title}
+
+ {closable && (
+
+
+
+ )}
+
+ )
+ : (
+ closable && (
+
+
+
+ )
+ )}
+ {children}
+
+
+
+ );
}
export function DialogFooter({
- children,
- exitLabel,
- className,
+ children,
+ exitLabel,
+ className,
}: {
- children?: ReactNode;
- exitLabel?: string;
- className?: string;
+ children?: ReactNode;
+ exitLabel?: string;
+ className?: string;
}) {
- const { __ } = useTranslate();
- const { footer } = dialog();
- return (
-
-
- {exitLabel ?? __("Cancel")}
-
- {children}
-
- );
+ const { __ } = useTranslate();
+ const { footer } = dialog();
+ return (
+
+
+ {exitLabel ?? __("Cancel")}
+
+ {children}
+
+ );
}
export function DialogContent({
- padded,
- scrollableChildren,
- ...props
+ padded,
+ scrollableChildren,
+ ...props
}: HTMLAttributes & {
- padded?: boolean;
- scrollableChildren?: boolean;
+ padded?: boolean;
+ scrollableChildren?: boolean;
}) {
- let children = props.children;
- if (scrollableChildren) {
- children = Children.map(props.children, (c) => {
- if (
- isValidElement<{
- className?: string;
- style?: CSSProperties;
- }>(c)
- ) {
- return cloneElement(c, {
- ...c.props,
- className: clsx(c.props.className, "overflow-y-auto"),
- style: {
- maxHeight: "var(--maxHeight)",
- ...c.props.style,
- },
- });
- }
- return c;
+ let children = props.children;
+ if (scrollableChildren) {
+ children = Children.map(props.children, (c) => {
+ if (
+ isValidElement<{
+ className?: string;
+ style?: CSSProperties;
+ }>(c)
+ ) {
+ return cloneElement(c, {
+ ...c.props,
+ className: clsx(c.props.className, "overflow-y-auto"),
+ style: {
+ maxHeight: "var(--maxHeight)",
+ ...c.props.style,
+ },
});
- }
- return (
-
- );
+ }
+ return c;
+ });
+ }
+ return (
+
+ );
}
export function DialogTitle(props: ComponentProps) {
- return ;
+ return ;
}
diff --git a/packages/ui/src/Molecules/DurationPicker/DurationPicker.stories.tsx b/packages/ui/src/Molecules/DurationPicker/DurationPicker.stories.tsx
index 17b25faec..05e9a1292 100644
--- a/packages/ui/src/Molecules/DurationPicker/DurationPicker.stories.tsx
+++ b/packages/ui/src/Molecules/DurationPicker/DurationPicker.stories.tsx
@@ -3,16 +3,16 @@ import { DurationPicker } from "./DurationPicker";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/DurationPicker",
- component: DurationPicker,
- argTypes: {},
+ title: "Molecules/DurationPicker",
+ component: DurationPicker,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- render: function Render() {
- const [value, setValue] = useState("PT1H");
- return ;
- },
+ render: function Render() {
+ const [value, setValue] = useState("PT1H");
+ return ;
+ },
};
diff --git a/packages/ui/src/Molecules/DurationPicker/DurationPicker.tsx b/packages/ui/src/Molecules/DurationPicker/DurationPicker.tsx
index 22d2ed7a9..9bb45ccfc 100644
--- a/packages/ui/src/Molecules/DurationPicker/DurationPicker.tsx
+++ b/packages/ui/src/Molecules/DurationPicker/DurationPicker.tsx
@@ -6,78 +6,76 @@ import { Option, Select } from "../../Atoms/Select/Select";
import { useTranslate } from "@probo/i18n";
type Props = {
- value: string | null;
- onValueChange: (value: string | null) => void;
+ value: string | null;
+ onValueChange: (value: string | null) => void;
} & HTMLAttributes;
const stringify = (value: number | null, unit: string): string | null => {
- if (value === null || value <= 0) return null;
+ if (value === null || value <= 0) return null;
- switch (unit) {
- case "M":
- return `PT${value}M`;
- case "H":
- return `PT${value}H`;
- case "D":
- return `P${value}D`;
- case "W":
- return `P${value * 7}D`;
- default:
- return null;
- }
+ switch (unit) {
+ case "M":
+ return `PT${value}M`;
+ case "H":
+ return `PT${value}H`;
+ case "D":
+ return `P${value}D`;
+ case "W":
+ return `P${value * 7}D`;
+ default:
+ return null;
+ }
};
const parse = (value: string): { amount: number; unit: string } | null => {
- const match = value.match(/PT?(\d+)([MDWH])/);
- if (!match) return { amount: 0, unit: "D" };
- const amount = parseInt(match[1], 10) || 0;
- const unit = match[2];
- if (amount % 7 === 0 && unit === "D") {
- return { amount: amount / 7, unit: "W" };
- }
- return { amount, unit };
+ const match = value.match(/PT?(\d+)([MDWH])/);
+ if (!match) return { amount: 0, unit: "D" };
+ const amount = parseInt(match[1], 10) || 0;
+ const unit = match[2];
+ if (amount % 7 === 0 && unit === "D") {
+ return { amount: amount / 7, unit: "W" };
+ }
+ return { amount, unit };
};
export function DurationPicker({ value, onValueChange, ...props }: Props) {
- const { __ } = useTranslate();
- if (!value) {
- return (
-
- onValueChange("PT1H")}
- />
-
- );
- }
-
- const { amount, unit } = parse(value || "") || { amount: 0, unit: "D" };
-
+ const { __ } = useTranslate();
+ if (!value) {
return (
-
-
- onValueChange(stringify(e.target.valueAsNumber, unit))
- }
- />
-
- onValueChange(stringify(amount, v))
- }
- >
- {__("Minutes")}
- {__("Hours")}
- {__("Days")}
- {__("Weeks")}
-
-
+
+ onValueChange("PT1H")}
+ />
+
);
+ }
+
+ const { amount, unit } = parse(value || "") || { amount: 0, unit: "D" };
+
+ return (
+
+
+ onValueChange(stringify(e.target.valueAsNumber, unit))}
+ />
+
+ onValueChange(stringify(amount, v))}
+ >
+ {__("Minutes")}
+ {__("Hours")}
+ {__("Days")}
+ {__("Weeks")}
+
+
+ );
}
diff --git a/packages/ui/src/Molecules/Field/Field.stories.tsx b/packages/ui/src/Molecules/Field/Field.stories.tsx
index 84f860f4f..20a07d183 100644
--- a/packages/ui/src/Molecules/Field/Field.stories.tsx
+++ b/packages/ui/src/Molecules/Field/Field.stories.tsx
@@ -2,24 +2,24 @@ import { Field } from "./Field.tsx";
import type { Meta, StoryObj } from "@storybook/react";
export default {
- title: "Molecules/Field",
- component: Field,
- argTypes: {},
+ title: "Molecules/Field",
+ component: Field,
+ argTypes: {},
} satisfies Meta;
type Story = StoryObj;
export const Default: Story = {
- args: {
- label: "Label",
- name: "id",
- help: "e.g. This is a hint",
- },
+ args: {
+ label: "Label",
+ name: "id",
+ help: "e.g. This is a hint",
+ },
};
export const Invalid: Story = {
- args: {
- ...Default.args,
- error: "This is an error",
- },
+ args: {
+ ...Default.args,
+ error: "This is an error",
+ },
};
diff --git a/packages/ui/src/Molecules/Field/Field.tsx b/packages/ui/src/Molecules/Field/Field.tsx
index 34959088d..21ef65ea6 100644
--- a/packages/ui/src/Molecules/Field/Field.tsx
+++ b/packages/ui/src/Molecules/Field/Field.tsx
@@ -6,18 +6,18 @@ import { type ComponentProps, type ReactNode } from "react";
import { Select } from "../../Atoms/Select/Select";
type BaseProps = {
- label?: string;
- help?: string;
- error?: string;
- onValueChange?: (s: string) => void;
- type?: T;
- children?: ReactNode;
+ label?: string;
+ help?: string;
+ error?: string;
+ onValueChange?: (s: string) => void;
+ type?: T;
+ children?: ReactNode;
} & P;
-type FieldValue = string | readonly string[] | number
+type FieldValue = string | readonly string[] | number;
-type Props =
- | BaseProps>
+type Props
+ = | BaseProps>
| BaseProps<"text", ComponentProps>
| BaseProps<"email", ComponentProps>
| BaseProps<"url", ComponentProps>
@@ -27,72 +27,72 @@ type Props =
| BaseProps<"select", ComponentProps>>;
const field = tv({
- slots: {
- base: "flex flex-col",
- label: "mb-[6px]",
- help: "text-xs text-txt-tertiary mt-1",
- },
+ slots: {
+ base: "flex flex-col",
+ label: "mb-[6px]",
+ help: "text-xs text-txt-tertiary mt-1",
+ },
});
const { base: baseClass, label: labelClass, help: helpClass } = field();
export function Field(props: Props) {
- const showHelp = props.help && !props.error;
- const childrenAsInput = !props.type && props.children;
- return (
-
- {props.label && (
-
- {props.label}
-
- )}
- {childrenAsInput ? props.children : getInput(props)}
- {showHelp && {props.help} }
- {props.error && (
-
- {props.error}
-
- )}
-
- );
+ const showHelp = props.help && !props.error;
+ const childrenAsInput = !props.type && props.children;
+ return (
+
+ {props.label && (
+
+ {props.label}
+
+ )}
+ {childrenAsInput ? props.children : getInput(props)}
+ {showHelp && {props.help} }
+ {props.error && (
+
+ {props.error}
+
+ )}
+
+ );
}
function getInput(props: Props) {
- const { error, onValueChange, type, ...restProps } = props;
- const baseProps = {
- ["aria-invalid"]: !!error,
- name: props.name,
- id: props.name,
- placeholder: props.placeholder,
- };
- switch (type) {
- case "select":
- return (
- // @ts-expect-error Select is too dynamic
-
- {...baseProps}
- {...restProps}
- onValueChange={onValueChange}
- />
- );
- case "textarea":
- return (
-