UNPKG

@eslamdevui/ui

Version:

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.

99 lines (98 loc) 4.26 kB
import theme from '#build/ui/pricing-table'; import type { AppConfig } from '@nuxt/schema'; import type { ComponentConfig, PricingPlanProps } from '../types'; type PricingTable = ComponentConfig<typeof theme, AppConfig, 'pricingTable'>; type DynamicSlots<T extends { id: string; }, S extends string | undefined = undefined> = { [K in T['id'] as K extends string ? S extends string ? (K | `${K}-${S}`) : K : never]?: (props: { tier: Extract<T, { id: K extends `${infer Base}-${S}` ? Base : K; }>; }) => any; }; type FeatureDynamicSlots<T extends PricingTableSectionFeature, S extends string | undefined = undefined> = { [K in (T['id'] extends string ? T['id'] : string) as K extends string ? S extends string ? (`feature-${K}` | `feature-${K}-${S}`) : `feature-${K}` : never]?: (props: { feature: T; tier: PricingTableTier; section: PricingTableSection; }) => any; }; type SectionDynamicSlots<T extends PricingTableSection, S extends string | undefined = undefined> = { [K in (T['id'] extends string ? T['id'] : string) as K extends string ? S extends string ? (`section-${K}` | `section-${K}-${S}`) : `section-${K}` : never]?: (props: { section: T; }) => any; }; export type PricingTableTier = Pick<PricingPlanProps, 'title' | 'description' | 'badge' | 'billingCycle' | 'billingPeriod' | 'price' | 'discount' | 'button' | 'highlight'> & { id: string; [key: string]: any; }; export type PricingTableSectionFeature<T extends PricingTableTier = PricingTableTier> = { id?: string; title: string; tiers?: { [K in Extract<T['id'], string>]: boolean | number | string; } & Record<string, boolean | number | string>; }; export interface PricingTableSection<T extends PricingTableTier = PricingTableTier> { id?: string; title: string; features: PricingTableSectionFeature<T>[]; } export interface PricingTableProps<T extends PricingTableTier = PricingTableTier> { /** * The element or component this component should render as. * @defaultValue 'div' */ as?: any; /** * The caption to display above the table. * @defeaultValue t('pricingTable.caption') */ caption?: string; /** * The pricing tiers to display in the table. * Each tier represents a pricing plan with its own title, description, price, and features. */ tiers: T[]; /** * The sections of features to display in the table. * Each section contains a title and a list of features with their availability in each tier. */ sections: PricingTableSection<T>[]; class?: any; ui?: PricingTable['slots']; } type SlotProps<T extends PricingTableTier> = (props: { tier: T; }) => any; export type PricingTableSlots<T extends PricingTableTier = PricingTableTier> = { 'caption': (props?: {}) => any; 'tier': SlotProps<T>; 'tier-title': SlotProps<T>; 'tier-description': SlotProps<T>; 'tier-badge': SlotProps<T>; 'tier-button': SlotProps<T>; 'tier-billing': SlotProps<T>; 'tier-discount': SlotProps<T>; 'tier-price': SlotProps<T>; 'section-title': (props: { section: PricingTableSection<T>; }) => any; 'feature-title': (props: { feature: PricingTableSectionFeature<T>; section: PricingTableSection<T>; }) => any; 'feature-value': (props: { feature: PricingTableSectionFeature<T>; tier: T; section: PricingTableSection<T>; }) => any; } & DynamicSlots<T, 'title' | 'description' | 'badge' | 'button' | 'billing' | 'discount' | 'price'> & FeatureDynamicSlots<PricingTableSectionFeature<T>, 'title' | 'value'> & SectionDynamicSlots<PricingTableSection<T>, 'title'>; declare const _default: __VLS_WithSlots<import("vue").DefineComponent<PricingTableProps<PricingTableTier>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PricingTableProps<PricingTableTier>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, PricingTableSlots<PricingTableTier>>; export default _default; type __VLS_WithSlots<T, S> = T & { new (): { $slots: S; }; };