diff --git a/apps/sim/components/emcn/components/callout/callout.tsx b/apps/sim/components/emcn/components/callout/callout.tsx new file mode 100644 index 00000000000..f22473541e9 --- /dev/null +++ b/apps/sim/components/emcn/components/callout/callout.tsx @@ -0,0 +1,60 @@ +import type * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' +import { AlertTriangle, CheckCircle2, Info } from 'lucide-react' +import { cn } from '@/lib/core/utils/cn' + +const calloutVariants = cva('flex items-center gap-2 rounded-lg border p-2.5 text-[12px]', { + variants: { + variant: { + default: 'border-[var(--border)] bg-[var(--surface-2)] text-[var(--text-muted)]', + info: 'border-[var(--border)] bg-[var(--surface-2)] text-[var(--text-muted)]', + success: + 'border-[color-mix(in_srgb,var(--badge-success-text)_30%,transparent)] bg-[var(--badge-success-bg)] text-[var(--badge-success-text)]', + warning: + 'border-[color-mix(in_srgb,var(--badge-amber-text)_30%,transparent)] bg-[var(--badge-amber-bg)] text-[var(--badge-amber-text)]', + destructive: + 'border-[color-mix(in_srgb,var(--text-error)_40%,transparent)] bg-[color-mix(in_srgb,var(--text-error)_10%,transparent)] text-[var(--text-error)]', + }, + }, + defaultVariants: { + variant: 'default', + }, +}) + +const DEFAULT_ICONS = { + default: Info, + info: Info, + success: CheckCircle2, + warning: AlertTriangle, + destructive: AlertTriangle, +} as const + +export interface CalloutProps + extends React.HTMLAttributes, + VariantProps { + /** Icon component shown before the content. Pass `null` to hide. Defaults per variant. */ + icon?: React.ComponentType<{ className?: string }> | null +} + +/** + * Inline note used to highlight short pieces of context inside a page or section. + * + * @example + * ```tsx + * Applies organization-wide + * This action is irreversible + * ``` + */ +function Callout({ className, variant, icon, children, role = 'note', ...props }: CalloutProps) { + const variantKey = (variant ?? 'default') as keyof typeof DEFAULT_ICONS + const Icon = icon === null ? null : (icon ?? DEFAULT_ICONS[variantKey]) + + return ( +
+ {Icon && } + {children} +
+ ) +} + +export { Callout, calloutVariants } diff --git a/apps/sim/components/emcn/components/index.ts b/apps/sim/components/emcn/components/index.ts index 70c7a6b383c..15b6cefd77f 100644 --- a/apps/sim/components/emcn/components/index.ts +++ b/apps/sim/components/emcn/components/index.ts @@ -18,6 +18,7 @@ export { buttonGroupItemVariants, buttonGroupVariants, } from './button-group/button-group' +export { Callout, type CalloutProps, calloutVariants } from './callout/callout' export { Checkbox, type CheckboxProps, diff --git a/apps/sim/ee/data-retention/components/data-retention-settings.tsx b/apps/sim/ee/data-retention/components/data-retention-settings.tsx index 0f257f3e469..e04bb0caca6 100644 --- a/apps/sim/ee/data-retention/components/data-retention-settings.tsx +++ b/apps/sim/ee/data-retention/components/data-retention-settings.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react' import { createLogger } from '@sim/logger' import { toError } from '@sim/utils/errors' -import { Button, Combobox, toast } from '@/components/emcn' +import { Button, Callout, Combobox, toast } from '@/components/emcn' import { useSession } from '@/lib/auth/auth-client' import { isBillingEnabled } from '@/lib/core/config/feature-flags' import { getUserRole } from '@/lib/workspaces/organization/utils' @@ -169,10 +169,8 @@ export function DataRetentionSettings() { return (
+ Applies organization-wide
-

- Retention Periods -

+ Applies organization-wide
Brand Identity