UNPKG

@heroui-vue/core

Version:

This is a headless Vue3 component designed with HeroUI in mind.

935 lines (927 loc) 21.6 kB
import * as vue0 from "vue"; import { Component as Component$1 } from "vue"; //#region ../../node_modules/.pnpm/tailwind-merge@3.3.1/node_modules/tailwind-merge/dist/types.d.ts /** * The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better. * * Specifically: * - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js * - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts * * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com) */ type ClassNameValue = ClassNameArray | string | null | undefined | 0 | 0n | false; type ClassNameArray = ClassNameValue[]; //#endregion //#region ../../node_modules/.pnpm/tailwind-variants@2.0.1_tailwind-merge@3.3.1_tailwindcss@4.1.12/node_modules/tailwind-variants/dist/index.d.ts type ClassProp<V extends unknown = ClassNameValue> = { class?: V; className?: never; } | { class?: never; className?: V; }; type TVBaseName = "base"; type TVSlots = Record<string, ClassNameValue> | undefined; /** * ---------------------------------------------------------------------- * Utils * ---------------------------------------------------------------------- */ type OmitUndefined<T> = T extends undefined ? never : T; type StringToBoolean<T> = T extends "true" | "false" ? boolean : T; /** * ---------------------------------------------------------------------- * TV Types * ---------------------------------------------------------------------- */ type TVSlotsWithBase<S extends TVSlots, B extends ClassNameValue> = B extends undefined ? keyof S : keyof S | TVBaseName; type SlotsClassValue<S extends TVSlots, B extends ClassNameValue> = { [K in TVSlotsWithBase<S, B>]?: ClassNameValue }; type TVVariantsDefault<S extends TVSlots, B extends ClassNameValue> = S extends undefined ? {} : { [key: string]: { [key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue; }; }; type TVVariants<S extends TVSlots | undefined, B extends ClassNameValue | undefined = undefined, EV extends TVVariants<ES> | undefined = undefined, ES extends TVSlots | undefined = undefined> = EV extends undefined ? TVVariantsDefault<S, B> : { [K in keyof EV]: { [K2 in keyof EV[K]]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue } } | TVVariantsDefault<S, B>; type TVCompoundVariants<V extends TVVariants<S>, S extends TVSlots, B extends ClassNameValue, EV extends TVVariants<ES>, ES extends TVSlots> = Array<{ [K in keyof V | keyof EV]?: (K extends keyof V ? StringToBoolean<keyof V[K]> : never) | (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never) | (K extends keyof V ? StringToBoolean<keyof V[K]>[] : never) } & ClassProp<SlotsClassValue<S, B> | ClassNameValue>>; type TVCompoundSlots<V extends TVVariants<S>, S extends TVSlots, B extends ClassNameValue> = Array<V extends undefined ? { slots: Array<TVSlotsWithBase<S, B>>; } & ClassProp : { slots: Array<TVSlotsWithBase<S, B>>; } & { [K in keyof V]?: StringToBoolean<keyof V[K]> | StringToBoolean<keyof V[K]>[] } & ClassProp>; type TVDefaultVariants<V extends TVVariants<S>, S extends TVSlots, EV extends TVVariants<ES>, ES extends TVSlots> = { [K in keyof V | keyof EV]?: (K extends keyof V ? StringToBoolean<keyof V[K]> : never) | (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never) }; type TVProps<V extends TVVariants<S>, S extends TVSlots, EV extends TVVariants<ES>, ES extends TVSlots> = EV extends undefined ? V extends undefined ? ClassProp<ClassNameValue> : { [K in keyof V]?: StringToBoolean<keyof V[K]> | undefined } & ClassProp<ClassNameValue> : V extends undefined ? { [K in keyof EV]?: StringToBoolean<keyof EV[K]> | undefined } & ClassProp<ClassNameValue> : { [K in keyof V | keyof EV]?: (K extends keyof V ? StringToBoolean<keyof V[K]> : never) | (K extends keyof EV ? StringToBoolean<keyof EV[K]> : never) | undefined } & ClassProp<ClassNameValue>; type TVVariantKeys<V extends TVVariants<S>, S extends TVSlots> = V extends Object ? Array<keyof V> : undefined; type TVReturnProps<V extends TVVariants<S>, S extends TVSlots, B extends ClassNameValue, EV extends TVVariants<ES>, ES extends TVSlots, // @ts-expect-error E extends TVReturnType = undefined> = { extend: E; base: B; slots: S; variants: V; defaultVariants: TVDefaultVariants<V, S, EV, ES>; compoundVariants: TVCompoundVariants<V, S, B, EV, ES>; compoundSlots: TVCompoundSlots<V, S, B>; variantKeys: TVVariantKeys<V, S>; }; type HasSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES extends undefined ? false : true : true; type TVReturnType<V extends TVVariants<S>, S extends TVSlots, B extends ClassNameValue, EV extends TVVariants<ES>, ES extends TVSlots, // @ts-expect-error E extends TVReturnType = undefined> = { (props?: TVProps<V, S, EV, ES>): HasSlots<S, ES> extends true ? { [K in keyof (ES extends undefined ? {} : ES)]: (slotProps?: TVProps<V, S, EV, ES>) => string } & { [K in keyof (S extends undefined ? {} : S)]: (slotProps?: TVProps<V, S, EV, ES>) => string } & { [K in TVSlotsWithBase<{}, B>]: (slotProps?: TVProps<V, S, EV, ES>) => string } : string; } & TVReturnProps<V, S, B, EV, ES, E>; type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">; //#endregion //#region ../../node_modules/.pnpm/@heroui+theme@2.4.20_tailwindcss@4.1.12/node_modules/@heroui/theme/dist/components/button.d.ts /** * Button wrapper **Tailwind Variants** component * * const classNames = button({...}) * * @example * <button * className={classNames())} * data-pressed={true/false} * data-hover={true/false} * data-focus={true/false} * data-focus-visible={true/false} * > * Button * </button> */ declare const button: TVReturnType<{ variant: { solid: string; bordered: string; light: string; flat: string; faded: string; shadow: string; ghost: string; }; size: { sm: string; md: string; lg: string; }; color: { default: string; primary: string; secondary: string; success: string; warning: string; danger: string; }; radius: { none: string; sm: string; md: string; lg: string; full: string; }; fullWidth: { true: string; }; isDisabled: { true: string; }; isInGroup: { true: string; }; isIconOnly: { true: string; false: string; }; disableAnimation: { true: string; false: string; }; }, undefined, string[], { variant: { solid: string; bordered: string; light: string; flat: string; faded: string; shadow: string; ghost: string; }; size: { sm: string; md: string; lg: string; }; color: { default: string; primary: string; secondary: string; success: string; warning: string; danger: string; }; radius: { none: string; sm: string; md: string; lg: string; full: string; }; fullWidth: { true: string; }; isDisabled: { true: string; }; isInGroup: { true: string; }; isIconOnly: { true: string; false: string; }; disableAnimation: { true: string; false: string; }; }, undefined, TVReturnType<{ variant: { solid: string; bordered: string; light: string; flat: string; faded: string; shadow: string; ghost: string; }; size: { sm: string; md: string; lg: string; }; color: { default: string; primary: string; secondary: string; success: string; warning: string; danger: string; }; radius: { none: string; sm: string; md: string; lg: string; full: string; }; fullWidth: { true: string; }; isDisabled: { true: string; }; isInGroup: { true: string; }; isIconOnly: { true: string; false: string; }; disableAnimation: { true: string; false: string; }; }, undefined, string[], unknown, unknown, undefined>>; /** * ButtonGroup wrapper **Tailwind Variants** component * * const classNames = buttonGroup({...}) * * @example * <div role="group" className={classNames())}> * // button elements * </div> */ type ButtonVariantProps = VariantProps<typeof button>; //#endregion //#region ../../node_modules/.pnpm/@heroui+theme@2.4.20_tailwindcss@4.1.12/node_modules/@heroui/theme/dist/components/chip.d.ts /** * Chip wrapper **Tailwind Variants** component * * @example * ```js * const {base, content, dot, avatar, closeButton} = chip({...}) * * <div className={base())}> * // left content * <span className={avatar()}/> * <svg className={dot()}/> * <span className={content()}>Default</span> * <svg className={closeButton()}>close button</svg> * // right content * </div> * ``` */ declare const chip: TVReturnType<{ variant: { solid: {}; bordered: { base: string; }; light: { base: string; }; flat: {}; faded: { base: string; }; shadow: {}; dot: { base: string; }; }; color: { default: { dot: string; }; primary: { dot: string; }; secondary: { dot: string; }; success: { dot: string; }; warning: { dot: string; }; danger: { dot: string; }; }; size: { sm: { base: string; content: string; closeButton: string; avatar: string; }; md: { base: string; content: string; closeButton: string; avatar: string; }; lg: { base: string; content: string; closeButton: string; avatar: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; isOneChar: { true: {}; false: {}; }; isCloseable: { true: {}; false: {}; }; hasStartContent: { true: {}; }; hasEndContent: { true: {}; }; isDisabled: { true: { base: string; }; }; isCloseButtonFocusVisible: { true: { closeButton: string[]; }; }; }, { base: string[]; content: string; dot: string[]; avatar: string; closeButton: string[]; }, undefined, { variant: { solid: {}; bordered: { base: string; }; light: { base: string; }; flat: {}; faded: { base: string; }; shadow: {}; dot: { base: string; }; }; color: { default: { dot: string; }; primary: { dot: string; }; secondary: { dot: string; }; success: { dot: string; }; warning: { dot: string; }; danger: { dot: string; }; }; size: { sm: { base: string; content: string; closeButton: string; avatar: string; }; md: { base: string; content: string; closeButton: string; avatar: string; }; lg: { base: string; content: string; closeButton: string; avatar: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; isOneChar: { true: {}; false: {}; }; isCloseable: { true: {}; false: {}; }; hasStartContent: { true: {}; }; hasEndContent: { true: {}; }; isDisabled: { true: { base: string; }; }; isCloseButtonFocusVisible: { true: { closeButton: string[]; }; }; }, { base: string[]; content: string; dot: string[]; avatar: string; closeButton: string[]; }, TVReturnType<{ variant: { solid: {}; bordered: { base: string; }; light: { base: string; }; flat: {}; faded: { base: string; }; shadow: {}; dot: { base: string; }; }; color: { default: { dot: string; }; primary: { dot: string; }; secondary: { dot: string; }; success: { dot: string; }; warning: { dot: string; }; danger: { dot: string; }; }; size: { sm: { base: string; content: string; closeButton: string; avatar: string; }; md: { base: string; content: string; closeButton: string; avatar: string; }; lg: { base: string; content: string; closeButton: string; avatar: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; isOneChar: { true: {}; false: {}; }; isCloseable: { true: {}; false: {}; }; hasStartContent: { true: {}; }; hasEndContent: { true: {}; }; isDisabled: { true: { base: string; }; }; isCloseButtonFocusVisible: { true: { closeButton: string[]; }; }; }, { base: string[]; content: string; dot: string[]; avatar: string; closeButton: string[]; }, undefined, unknown, unknown, undefined>>; type ChipVariantProps = VariantProps<typeof chip>; type ChipSlots = keyof ReturnType<typeof chip>; //#endregion //#region ../../node_modules/.pnpm/@heroui+theme@2.4.20_tailwindcss@4.1.12/node_modules/@heroui/theme/dist/components/alert.d.ts /** * Alert wrapper **Tailwind Variants** component * * @example * ```js * const {base, mainWrapper, title, description, closeButton, alertIcon} = alert({...}) * * * <div className={base()}> * {alertIcon} * <div className={mainWrapper()}> * <div className={title()}>Title</div> * <div className={description()}>Description</div> * </div> * <button> * // close button * </button> * </div> * ``` */ declare const alert: TVReturnType<{ color: { default: {}; primary: {}; secondary: {}; success: {}; warning: {}; danger: {}; }; variant: { solid: {}; flat: {}; faded: { base: string; }; bordered: { base: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; hideIcon: { true: { iconWrapper: string; }; }; hideIconWrapper: { true: { base: string; iconWrapper: string; }; }; hasContent: { false: { base: string; mainWrapper: string; }; }; }, { base: string; mainWrapper: string; title: string; description: string; closeButton: string; iconWrapper: string; alertIcon: string; }, undefined, { color: { default: {}; primary: {}; secondary: {}; success: {}; warning: {}; danger: {}; }; variant: { solid: {}; flat: {}; faded: { base: string; }; bordered: { base: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; hideIcon: { true: { iconWrapper: string; }; }; hideIconWrapper: { true: { base: string; iconWrapper: string; }; }; hasContent: { false: { base: string; mainWrapper: string; }; }; }, { base: string; mainWrapper: string; title: string; description: string; closeButton: string; iconWrapper: string; alertIcon: string; }, TVReturnType<{ color: { default: {}; primary: {}; secondary: {}; success: {}; warning: {}; danger: {}; }; variant: { solid: {}; flat: {}; faded: { base: string; }; bordered: { base: string; }; }; radius: { none: { base: string; }; sm: { base: string; }; md: { base: string; }; lg: { base: string; }; full: { base: string; }; }; hideIcon: { true: { iconWrapper: string; }; }; hideIconWrapper: { true: { base: string; iconWrapper: string; }; }; hasContent: { false: { base: string; mainWrapper: string; }; }; }, { base: string; mainWrapper: string; title: string; description: string; closeButton: string; iconWrapper: string; alertIcon: string; }, undefined, unknown, unknown, undefined>>; type AlertVariantProps = VariantProps<typeof alert>; type AlertSlots = keyof ReturnType<typeof alert>; //#endregion //#region ../../node_modules/.pnpm/@heroui+theme@2.4.20_tailwindcss@4.1.12/node_modules/@heroui/theme/dist/utils/types.d.ts /** * This Typescript utility transform a list of slots into a list of {slot: classes} */ type SlotsToClasses<S extends string> = { [key in S]?: Exclude<ClassNameValue, 0n> }; //#endregion //#region ../components/button/dist/index.d.ts //#region src/use-button.d.ts interface ButtonDefineProps extends HTMLHeroVueUIProps$1<"button"> { isLoading?: boolean; disableRipple?: boolean; spinnerPlacement?: "start" | "end"; } interface ButtonVariantProps$1 { variant?: ButtonVariantProps["variant"]; size?: ButtonVariantProps["size"]; color?: ButtonVariantProps["color"]; radius?: ButtonVariantProps["radius"]; fullWidth?: boolean; isDisabled?: boolean; isIconOnly?: boolean; disableAnimation?: boolean; } interface ButtonAriaProps {} type ButtonProps = ButtonDefineProps & ButtonVariantProps$1 & ButtonAriaProps; //#endregion //#region src/Button.vue.d.ts type __VLS_Slots$2 = { default(): Component$1; startContent(): Component$1; endContent(): Component$1; spinner(): Component$1; }; declare const __VLS_component$2: vue0.DefineComponent<ButtonProps, void, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<ButtonProps> & Readonly<{}>, { isLoading: boolean; spinnerPlacement: "start" | "end"; }, {}, {}, {}, string, vue0.ComponentProvideOptions, false, {}, any>; declare const _default$1: __VLS_WithSlots$2<typeof __VLS_component$2, __VLS_Slots$2>; type __VLS_WithSlots$2<T, S> = T & { new (): { $slots: S; }; }; //#endregion //#endregion //#region ../components/alert/dist/index.d.ts //#region src/use-alert.d.ts interface AlertDefineProps extends /* @vue-ignore */HTMLHeroVueUIProps { title?: string; description?: string; isVisible?: boolean; isDefaultVisible?: boolean; isClosable?: boolean; /** * Classname or List of classes to change the classNames of the element. * if `className` is passed, it will be added to the base slot. * * @example * ```ts * <Alert :classNames="{ * base:"base-classes", * mainWrapper: "mainWrapper-classes" * description: "description-classes" * title: "title-classes" * closeButton: "closeButton-classes" * closeIcon: "closeIcon-classes" * }" /> * ``` */ classNames?: SlotsToClasses<AlertSlots>; } /** * Alert variants */ interface AlertVariantProps$1 { variant?: AlertVariantProps["variant"]; color?: AlertVariantProps["color"]; radius?: AlertVariantProps["radius"]; hideIcon?: AlertVariantProps["hideIcon"]; hideIconWrapper?: AlertVariantProps["hideIconWrapper"]; hasContent?: AlertVariantProps["hasContent"]; } type AlertProps = AlertDefineProps & AlertVariantProps$1; //#endregion //#region src/Alert.vue.d.ts declare const __VLS_component$1: vue0.DefineComponent<AlertProps, void, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {} & { close: () => any; visibleChange: (isVisible: boolean) => any; }, string, vue0.PublicProps, Readonly<AlertProps> & Readonly<{ onClose?: () => any; onVisibleChange?: (isVisible: boolean) => any; }>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>; declare const _default: __VLS_WithSlots$1<typeof __VLS_component$1, __VLS_Slots>; type __VLS_WithSlots$1<T, S> = T & { new (): { $slots: S; }; }; //#endregion //#endregion //#region ../components/chip/dist/index.d.ts //#region src/use-chip.d.ts interface ChipDefineProps { classNames?: SlotsToClasses<ChipSlots>; } interface ChipVariantProps$1 { variant?: ChipVariantProps["variant"]; size?: ChipVariantProps["size"]; color?: ChipVariantProps["color"]; radius?: ChipVariantProps["radius"]; isOneChar?: boolean; isCloseable?: boolean; hasStartContent?: boolean; hasEndContent?: boolean; isDisabled?: boolean; isCloseButtonFocusVisible?: boolean; } type ChipProps = ChipDefineProps & ChipVariantProps$1; type ChipSlots$1 = "avatar" | "startContent" | "endContent"; //#endregion //#region src/Chip.vue.d.ts type __VLS_Slots$1 = Record<ChipSlots$1, any>; declare const __VLS_component: vue0.DefineComponent<ChipProps, void, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, { close: (...args: any[]) => void; }, string, vue0.PublicProps, Readonly<ChipProps> & Readonly<{ onClose?: (...args: any[]) => any; }>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>; declare const _default$2: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots$1>; type __VLS_WithSlots<T, S> = T & { new (): { $slots: S; }; }; //#endregion //#endregion export { _default as Alert, _default$1 as Button, _default$2 as Chip }; //# sourceMappingURL=index.d.ts.map