From 8e2c7570ad0a9ed9e429cab5cf7f64227cb90db3 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Thu, 27 Mar 2025 16:07:02 -0400 Subject: [PATCH 1/3] chore(clerk-js,types): Remove `` from commerce components --- .../ui/components/PricingTable/PlanCard.tsx | 474 ------------------ .../PricingTable/PricingTableMatrix.tsx | 4 +- .../PricingTable/SubscriptionDetailDrawer.tsx | 320 +++++++++++- .../ui/customizables/elementDescriptors.ts | 46 +- .../clerk-js/src/ui/polishedAppearance.ts | 7 - packages/types/src/appearance.ts | 44 +- 6 files changed, 354 insertions(+), 541 deletions(-) delete mode 100644 packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx diff --git a/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx b/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx deleted file mode 100644 index de5b2fee4f9..00000000000 --- a/packages/clerk-js/src/ui/components/PricingTable/PlanCard.tsx +++ /dev/null @@ -1,474 +0,0 @@ -import type { - __experimental_CommercePlanResource, - __experimental_CommerceSubscriptionPlanPeriod, - __experimental_PricingTableProps, -} from '@clerk/types'; -import * as React from 'react'; - -import { - Badge, - Box, - Button, - descriptors, - Flex, - Heading, - Icon, - localizationKeys, - SimpleButton, - Span, - Text, - useAppearance, -} from '../../customizables'; -import { Avatar, SegmentedControl } from '../../elements'; -import { usePrefersReducedMotion } from '../../hooks'; -import { Check, InformationCircle, Minus, Plus } from '../../icons'; -import type { ThemableCssProp } from '../../styledSystem'; -import { common } from '../../styledSystem'; -import { colors } from '../../utils'; - -/* ------------------------------------------------------------------------------------------------- - * PlanCard - * -----------------------------------------------------------------------------------------------*/ - -interface PlanCardProps { - plan: __experimental_CommercePlanResource; - planPeriod: __experimental_CommerceSubscriptionPlanPeriod; - setPlanPeriod: (p: __experimental_CommerceSubscriptionPlanPeriod) => void; - onSelect: (plan: __experimental_CommercePlanResource) => void; - isCompact?: boolean; - props: __experimental_PricingTableProps; -} - -export function PlanCard(props: PlanCardProps) { - const { plan, planPeriod, setPlanPeriod, onSelect, props: pricingTableProps, isCompact = false } = props; - const isDefaultLayout = pricingTableProps.layout === 'default'; - const ctaPosition = (isDefaultLayout && pricingTableProps.ctaPosition) || 'top'; - const collapseFeatures = (isDefaultLayout && pricingTableProps.collapseFeatures) || false; - const { id, slug, subscriptionIdForCurrentSubscriber, features } = plan; - const totalFeatures = features.length; - const hasFeatures = totalFeatures > 0; - - return ( - ({ - display: 'flex', - flexDirection: 'column', - background: common.mergedColorsBackground( - colors.setAlpha(t.colors.$colorBackground, 1), - t.colors.$neutralAlpha50, - ), - borderWidth: t.borderWidths.$normal, - borderStyle: t.borderStyles.$solid, - borderColor: t.colors.$neutralAlpha100, - boxShadow: !isCompact ? t.shadows.$cardBoxShadow : undefined, - borderRadius: t.radii.$xl, - overflow: 'hidden', - textAlign: 'left', - })} - > - - - {!collapseFeatures && hasFeatures ? ( - ({ - display: 'flex', - flexDirection: 'column', - flex: '1', - padding: isCompact ? t.space.$3 : t.space.$4, - backgroundColor: t.colors.$colorBackground, - borderTopWidth: t.borderWidths.$normal, - borderTopStyle: t.borderStyles.$solid, - borderTopColor: t.colors.$neutralAlpha100, - })} - > - - - ) : null} - ({ - marginTop: 'auto', - padding: isCompact ? t.space.$3 : t.space.$4, - borderTopWidth: t.borderWidths.$normal, - borderTopStyle: t.borderStyles.$solid, - borderTopColor: t.colors.$neutralAlpha100, - background: collapseFeatures || !hasFeatures ? t.colors.$colorBackground : undefined, - })} - > -