@waveso/ui 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -68
- package/dist/accordion.js +3 -3
- package/dist/accordion.js.map +1 -1
- package/dist/action-bar.js +2 -2
- package/dist/action-bar.js.map +1 -1
- package/dist/alert-dialog.js +4 -4
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.js +5 -5
- package/dist/alert.js.map +1 -1
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +1 -2
- package/dist/animate.js.map +1 -1
- package/dist/autocomplete.js +8 -8
- package/dist/autocomplete.js.map +1 -1
- package/dist/avatar.js +5 -5
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +5 -6
- package/dist/badge.js.map +1 -1
- package/dist/breadcrumb.js +3 -3
- package/dist/breadcrumb.js.map +1 -1
- package/dist/button-group.js +5 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +9 -10
- package/dist/button.js.map +1 -1
- package/dist/card.js +4 -4
- package/dist/card.js.map +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +10 -10
- package/dist/combobox.js.map +1 -1
- package/dist/context-menu.js +9 -9
- package/dist/context-menu.js.map +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +4 -4
- package/dist/dialog.js.map +1 -1
- package/dist/drawer.js +4 -4
- package/dist/drawer.js.map +1 -1
- package/dist/field.js +2 -2
- package/dist/field.js.map +1 -1
- package/dist/form.js +2 -2
- package/dist/form.js.map +1 -1
- package/dist/infinite-scroll.js +2 -2
- package/dist/infinite-scroll.js.map +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-group.js +5 -5
- package/dist/input-group.js.map +1 -1
- package/dist/input-otp.js +3 -3
- package/dist/input-otp.js.map +1 -1
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/item.d.ts +1 -1
- package/dist/item.js +4 -4
- package/dist/item.js.map +1 -1
- package/dist/kbd.js +1 -1
- package/dist/kbd.js.map +1 -1
- package/dist/menu.js +9 -9
- package/dist/menu.js.map +1 -1
- package/dist/menubar.js +1 -1
- package/dist/menubar.js.map +1 -1
- package/dist/popover.js +2 -2
- package/dist/popover.js.map +1 -1
- package/dist/preview-card.js +1 -1
- package/dist/preview-card.js.map +1 -1
- package/dist/progress.js +2 -2
- package/dist/progress.js.map +1 -1
- package/dist/radio.js +2 -2
- package/dist/radio.js.map +1 -1
- package/dist/scroll-area.js +2 -2
- package/dist/scroll-area.js.map +1 -1
- package/dist/select.js +8 -8
- package/dist/select.js.map +1 -1
- package/dist/separator.js +1 -1
- package/dist/separator.js.map +1 -1
- package/dist/sidebar.js +19 -19
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.js +2 -2
- package/dist/slider.js.map +1 -1
- package/dist/styles.css +493 -202
- package/dist/switch.js +2 -2
- package/dist/switch.js.map +1 -1
- package/dist/table.js +5 -5
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +3 -3
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.js +1 -1
- package/dist/textarea.js.map +1 -1
- package/dist/toast.d.ts +3 -3
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +37 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-group.js +2 -2
- package/dist/toggle-group.js.map +1 -1
- package/dist/toggle.js +3 -3
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/package.json +9 -20
package/dist/animate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.js","names":[],"sources":["../src/animate.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n Children,\n type CSSProperties,\n type ReactElement,\n type Ref,\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\"\nimport { useInView, type Transition } from \"motion/react\"\n\n// ── Types ────────────────────────────────────────────────────────────\n\ntype Direction = \"up\" | \"down\" | \"left\" | \"right\"\n\ninterface AnimateOnViewProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 16 (scroll reveals need more travel than `AnimateIn`) */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Trigger once or every time it enters view. Default: true */\n once?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface AnimateInProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 4 */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface StaggerProps {\n children: ReactElement[]\n /** Delay increment between each child in seconds. Default: 0.08 */\n interval?: number\n /** Base delay before the first child animates in seconds. Default: 0 */\n baseDelay?: number\n}\n\ninterface PulseProps {\n children: ReactElement\n /** Min scale factor. Default: 0.97 */\n min?: number\n /** Max scale factor. Default: 1.03 */\n max?: number\n /** Animation duration in seconds. Default: 2 */\n duration?: number\n /** Also pulse opacity between these bounds [min, max]. Off by default. */\n opacity?: [number, number]\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\ninterface FloatProps {\n children: ReactElement\n /** Vertical float distance in px. Default: 6 */\n distance?: number\n /** Animation duration in seconds. Default: 3 */\n duration?: number\n /** Also rotate slightly while floating (degrees). Default: 0 */\n rotate?: number\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\n/**\n * Direction map: `from` means where the element COMES FROM.\n * `from=\"left\"` = starts to the left, slides right into place.\n */\nconst DIRECTION_MAP = {\n up: { prop: \"translateY\", value: -1 },\n down: { prop: \"translateY\", value: 1 },\n left: { prop: \"translateX\", value: -1 },\n right: { prop: \"translateX\", value: 1 },\n} as const\n\n/** Flip axis: vertical directions flip around X, horizontal around Y */\nconst FLIP_MAP = {\n up: \"rotateX(90deg)\",\n down: \"rotateX(-90deg)\",\n left: \"rotateY(-90deg)\",\n right: \"rotateY(90deg)\",\n} as const\n\n/** Overshoot (\"spring\") easing for the opt-in `spring` prop on\n * `AnimateIn` / `AnimateOnView`. This is `animate.tsx`'s own page-entrance\n * bounce — the CSS recipe system intentionally has no spring (one circ-out\n * curve), so this is a standalone constant, not a shared token. */\nconst SPRING_EASE = \"cubic-bezier(0.34, 1.45, 0.64, 1)\"\n\ninterface BuildStylesOptions {\n from: Direction\n distance: number\n doScale: boolean\n blur: boolean | number\n rotate: number\n flip: boolean\n}\n\nfunction buildStyles(opts: BuildStylesOptions) {\n const { from, distance, doScale, blur, rotate, flip } = opts\n const dir = DIRECTION_MAP[from]\n\n const hiddenParts: string[] = []\n if (flip) hiddenParts.push(\"perspective(800px)\")\n hiddenParts.push(`${dir.prop}(${dir.value * distance}px)`)\n if (doScale) hiddenParts.push(\"scale(0.85)\")\n if (rotate) hiddenParts.push(`rotate(${rotate}deg)`)\n if (flip) hiddenParts.push(FLIP_MAP[from])\n\n const visibleParts: string[] = []\n if (flip) visibleParts.push(\"perspective(800px)\")\n visibleParts.push(\"translateX(0) translateY(0)\")\n if (doScale) visibleParts.push(\"scale(1)\")\n if (rotate) visibleParts.push(\"rotate(0deg)\")\n if (flip) visibleParts.push(from === \"up\" || from === \"down\" ? \"rotateX(0deg)\" : \"rotateY(0deg)\")\n\n const blurPx = blur === true ? 8 : typeof blur === \"number\" ? blur : 0\n\n const hidden: CSSProperties = {\n opacity: \"0\",\n transform: hiddenParts.join(\" \"),\n }\n\n const visible: CSSProperties = {\n opacity: \"1\",\n transform: visibleParts.join(\" \"),\n }\n\n if (blurPx > 0) {\n hidden.filter = `blur(${blurPx}px)`\n visible.filter = \"blur(0px)\"\n }\n\n return { hidden, visible, hasFilter: blurPx > 0 }\n}\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]) {\n return (el: T | null) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") ref(el)\n else if (ref && typeof ref === \"object\") {\n ;(ref as { current: T | null }).current = el\n }\n })\n }\n}\n\nfunction getTransitionParams(transition?: Transition, useSpring?: boolean, fallbackDuration = 0.15) {\n const duration =\n (transition as Record<string, number>)?.duration ?? fallbackDuration\n const ease =\n useSpring ? SPRING_EASE : ((transition as Record<string, string>)?.ease ?? \"ease-out\")\n return { duration, ease }\n}\n\nfunction buildTransitionStr(\n duration: number,\n ease: string,\n delay: number,\n hasFilter: boolean,\n) {\n const parts = [\n `opacity ${duration}s ${ease} ${delay}s`,\n `transform ${duration}s ${ease} ${delay}s`,\n ]\n if (hasFilter) parts.push(`filter ${duration}s ${ease} ${delay}s`)\n return parts.join(\", \")\n}\n\n// ── AnimateOnView ────────────────────────────────────────────────────\n\n/**\n * Animates a child element when it scrolls into view.\n *\n * Defaults are tuned for scroll reveals — larger travel and a slower duration\n * than `AnimateIn` — so the motion reads as the content enters the viewport.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Renders children unchanged on server to avoid hydration mismatch.\n *\n * @example\n * ```tsx\n * <AnimateOnView from=\"up\" blur scale>\n * <Card>Hello</Card>\n * </AnimateOnView>\n * ```\n */\nfunction AnimateOnView({\n children,\n delay = 0,\n from = \"down\",\n distance = 16,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n once = true,\n transition,\n}: AnimateOnViewProps) {\n const ref = useRef<HTMLElement>(null)\n const [hydrated, setHydrated] = useState(false)\n const isInView = useInView(ref, { once, margin: \"-50px\" })\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n if (!hydrated) {\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n } as Record<string, unknown>)\n }\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring, 0.4)\n const currentStyle = isInView ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(isInView ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── AnimateIn ────────────────────────────────────────────────────────\n\n/**\n * Animates a child element immediately on mount.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Uses a two-phase approach: hidden → visible with requestAnimationFrame.\n *\n * @example\n * ```tsx\n * <AnimateIn from=\"up\" blur spring>\n * <h1>Welcome</h1>\n * </AnimateIn>\n * ```\n */\nfunction AnimateIn({\n children,\n delay = 0,\n from = \"down\",\n distance = 4,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n transition,\n}: AnimateInProps) {\n const ref = useRef<HTMLElement>(null)\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => setVisible(true))\n })\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring)\n const currentStyle = visible ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(visible ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── Stagger ──────────────────────────────────────────────────────────\n\n/**\n * Auto-staggers delay on child AnimateIn/AnimateOnView elements.\n * Eliminates manual `delay={i * 0.08}` math.\n *\n * @example\n * ```tsx\n * <Stagger interval={0.1}>\n * <AnimateIn from=\"up\"><Card>One</Card></AnimateIn>\n * <AnimateIn from=\"up\"><Card>Two</Card></AnimateIn>\n * </Stagger>\n * ```\n */\nfunction Stagger({\n children,\n interval = 0.08,\n baseDelay = 0,\n}: StaggerProps) {\n return (\n <>\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child\n return cloneElement(child as ReactElement<{ delay?: number }>, {\n delay: baseDelay + index * interval,\n })\n })}\n </>\n )\n}\n\n// ── Pulse ────────────────────────────────────────────────────────────\n\n/**\n * Continuous, subtle scale pulse. Great for live indicators and CTAs.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Pulse>\n * <span className=\"size-3 rounded-full bg-green-500\" />\n * </Pulse>\n * ```\n */\nfunction Pulse({\n children,\n min = 0.97,\n max = 1.03,\n duration = 2,\n opacity,\n paused = false,\n}: PulseProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `pulse-${id}`\n const opacityFrom = opacity?.[0] ?? 1\n const opacityTo = opacity?.[1] ?? 1\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: scale(${min}); opacity: ${opacityFrom}; }\n 50% { transform: scale(${max}); opacity: ${opacityTo}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ref: existingRef ? mergeRefs(existingRef) : undefined,\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Float ────────────────────────────────────────────────────────────\n\n/**\n * Gentle continuous up/down float. Perfect for decorative elements.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Float distance={10} duration={4}>\n * <Card>Floating</Card>\n * </Float>\n * ```\n */\nfunction Float({\n children,\n distance = 6,\n duration = 3,\n rotate = 0,\n paused = false,\n}: FloatProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `float-${id}`\n const rotA = rotate ? ` rotate(${-rotate}deg)` : \"\"\n const rotB = rotate ? ` rotate(${rotate}deg)` : \"\"\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: translateY(0px)${rotA}; }\n 50% { transform: translateY(${-distance}px)${rotB}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ...(existingRef ? { ref: existingRef } : {}),\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Exports ──────────────────────────────────────────────────────────\n\nexport { AnimateOnView, AnimateIn, Stagger, Pulse, Float }\nexport type {\n AnimateOnViewProps,\n AnimateInProps,\n StaggerProps,\n PulseProps,\n FloatProps,\n Direction,\n}\n"],"mappings":";;;;;;;;;AA0GA,MAAM,gBAAgB;CACpB,IAAI;EAAE,MAAM;EAAc,OAAO;EAAI;CACrC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAG;CACtC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAI;CACvC,OAAO;EAAE,MAAM;EAAc,OAAO;EAAG;CACxC;;AAGD,MAAM,WAAW;CACf,IAAI;CACJ,MAAM;CACN,MAAM;CACN,OAAO;CACR;;;;;AAMD,MAAM,cAAc;AAWpB,SAAS,YAAY,MAA0B;CAC7C,MAAM,EAAE,MAAM,UAAU,SAAS,MAAM,QAAQ,SAAS;CACxD,MAAM,MAAM,cAAc;CAE1B,MAAM,cAAwB,EAAE;AAChC,KAAI,KAAM,aAAY,KAAK,qBAAqB;AAChD,aAAY,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,QAAQ,SAAS,KAAK;AAC1D,KAAI,QAAS,aAAY,KAAK,cAAc;AAC5C,KAAI,OAAQ,aAAY,KAAK,UAAU,OAAO,MAAM;AACpD,KAAI,KAAM,aAAY,KAAK,SAAS,MAAM;CAE1C,MAAM,eAAyB,EAAE;AACjC,KAAI,KAAM,cAAa,KAAK,qBAAqB;AACjD,cAAa,KAAK,8BAA8B;AAChD,KAAI,QAAS,cAAa,KAAK,WAAW;AAC1C,KAAI,OAAQ,cAAa,KAAK,eAAe;AAC7C,KAAI,KAAM,cAAa,KAAK,SAAS,QAAQ,SAAS,SAAS,kBAAkB,gBAAgB;CAEjG,MAAM,SAAS,SAAS,OAAO,IAAI,OAAO,SAAS,WAAW,OAAO;CAErE,MAAM,SAAwB;EAC5B,SAAS;EACT,WAAW,Y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AAS,GACT,SAAS,SACI;CACb,MAAM,KAAK,OAAO,CAAC,QAAQ,MAAM,GAAG;CACpC,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM;AAE/C,iBAAgB;AACd,cAAY,KAAK;IAChB,EAAE,CAAC;AAEN,KAAI,CAAC,eAAe,SAAS,CAAE,QAAO;AACtC,KAAI,CAAC,SAAU,QAAO;CAEtB,MAAM,OAAO,SAAS;CACtB,MAAM,OAAO,SAAS,WAAW,CAAC,OAAO,QAAQ;CACjD,MAAM,OAAO,SAAS,WAAW,OAAO,QAAQ;CAEhD,MAAM,YAAY,cAAc,KAAK;yCACE,KAAK;gCACd,CAAC,SAAS,KAAK,KAAK;;CAGlD,MAAM,aAAa,SAAS;CAC5B,MAAM,gBAAiB,WAAW,SAAS,EAAE;CAC7C,MAAM,cAAe,WAA0C;AAE/D,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UAAQ,WAAkB,CAAA,EACzB,aAAa,UAAU;EACtB,GAAI,cAAc,EAAE,KAAK,aAAa,GAAG,EAAE;EAC3C,OAAO;GACL,GAAG;GACH,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,oBAAoB,SAAS,WAAW;GACzC;EACF,CAA4B,CAC5B,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"animate.js","names":[],"sources":["../src/animate.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n Children,\n type CSSProperties,\n type ReactElement,\n type Ref,\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\"\nimport { useInView, type Transition } from \"motion/react\"\n\n// ── Types ────────────────────────────────────────────────────────────\n\ntype Direction = \"up\" | \"down\" | \"left\" | \"right\"\n\ninterface AnimateOnViewProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 16 (scroll reveals need more travel than `AnimateIn`) */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Trigger once or every time it enters view. Default: true */\n once?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface AnimateInProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 4 */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface StaggerProps {\n children: ReactElement[]\n /** Delay increment between each child in seconds. Default: 0.08 */\n interval?: number\n /** Base delay before the first child animates in seconds. Default: 0 */\n baseDelay?: number\n}\n\ninterface PulseProps {\n children: ReactElement\n /** Min scale factor. Default: 0.97 */\n min?: number\n /** Max scale factor. Default: 1.03 */\n max?: number\n /** Animation duration in seconds. Default: 2 */\n duration?: number\n /** Also pulse opacity between these bounds [min, max]. Off by default. */\n opacity?: [number, number]\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\ninterface FloatProps {\n children: ReactElement\n /** Vertical float distance in px. Default: 6 */\n distance?: number\n /** Animation duration in seconds. Default: 3 */\n duration?: number\n /** Also rotate slightly while floating (degrees). Default: 0 */\n rotate?: number\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\n/**\n * Direction map: `from` means where the element COMES FROM.\n * `from=\"left\"` = starts to the left, slides right into place.\n */\nconst DIRECTION_MAP = {\n up: { prop: \"translateY\", value: -1 },\n down: { prop: \"translateY\", value: 1 },\n left: { prop: \"translateX\", value: -1 },\n right: { prop: \"translateX\", value: 1 },\n} as const\n\n/** Flip axis: vertical directions flip around X, horizontal around Y */\nconst FLIP_MAP = {\n up: \"rotateX(90deg)\",\n down: \"rotateX(-90deg)\",\n left: \"rotateY(-90deg)\",\n right: \"rotateY(90deg)\",\n} as const\n\n/** Overshoot (\"spring\") easing for the opt-in `spring` prop on\n * `AnimateIn` / `AnimateOnView`. This is `animate.tsx`'s own page-entrance\n * bounce — the CSS recipe system intentionally has no spring, so this is a standalone constant, not a shared token. */\nconst SPRING_EASE = \"cubic-bezier(0.34, 1.45, 0.64, 1)\"\n\ninterface BuildStylesOptions {\n from: Direction\n distance: number\n doScale: boolean\n blur: boolean | number\n rotate: number\n flip: boolean\n}\n\nfunction buildStyles(opts: BuildStylesOptions) {\n const { from, distance, doScale, blur, rotate, flip } = opts\n const dir = DIRECTION_MAP[from]\n\n const hiddenParts: string[] = []\n if (flip) hiddenParts.push(\"perspective(800px)\")\n hiddenParts.push(`${dir.prop}(${dir.value * distance}px)`)\n if (doScale) hiddenParts.push(\"scale(0.85)\")\n if (rotate) hiddenParts.push(`rotate(${rotate}deg)`)\n if (flip) hiddenParts.push(FLIP_MAP[from])\n\n const visibleParts: string[] = []\n if (flip) visibleParts.push(\"perspective(800px)\")\n visibleParts.push(\"translateX(0) translateY(0)\")\n if (doScale) visibleParts.push(\"scale(1)\")\n if (rotate) visibleParts.push(\"rotate(0deg)\")\n if (flip) visibleParts.push(from === \"up\" || from === \"down\" ? \"rotateX(0deg)\" : \"rotateY(0deg)\")\n\n const blurPx = blur === true ? 8 : typeof blur === \"number\" ? blur : 0\n\n const hidden: CSSProperties = {\n opacity: \"0\",\n transform: hiddenParts.join(\" \"),\n }\n\n const visible: CSSProperties = {\n opacity: \"1\",\n transform: visibleParts.join(\" \"),\n }\n\n if (blurPx > 0) {\n hidden.filter = `blur(${blurPx}px)`\n visible.filter = \"blur(0px)\"\n }\n\n return { hidden, visible, hasFilter: blurPx > 0 }\n}\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]) {\n return (el: T | null) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") ref(el)\n else if (ref && typeof ref === \"object\") {\n ;(ref as { current: T | null }).current = el\n }\n })\n }\n}\n\nfunction getTransitionParams(transition?: Transition, useSpring?: boolean, fallbackDuration = 0.15) {\n const duration =\n (transition as Record<string, number>)?.duration ?? fallbackDuration\n const ease =\n useSpring ? SPRING_EASE : ((transition as Record<string, string>)?.ease ?? \"ease-out\")\n return { duration, ease }\n}\n\nfunction buildTransitionStr(\n duration: number,\n ease: string,\n delay: number,\n hasFilter: boolean,\n) {\n const parts = [\n `opacity ${duration}s ${ease} ${delay}s`,\n `transform ${duration}s ${ease} ${delay}s`,\n ]\n if (hasFilter) parts.push(`filter ${duration}s ${ease} ${delay}s`)\n return parts.join(\", \")\n}\n\n// ── AnimateOnView ────────────────────────────────────────────────────\n\n/**\n * Animates a child element when it scrolls into view.\n *\n * Defaults are tuned for scroll reveals — larger travel and a slower duration\n * than `AnimateIn` — so the motion reads as the content enters the viewport.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Renders children unchanged on server to avoid hydration mismatch.\n *\n * @example\n * ```tsx\n * <AnimateOnView from=\"up\" blur scale>\n * <Card>Hello</Card>\n * </AnimateOnView>\n * ```\n */\nfunction AnimateOnView({\n children,\n delay = 0,\n from = \"down\",\n distance = 16,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n once = true,\n transition,\n}: AnimateOnViewProps) {\n const ref = useRef<HTMLElement>(null)\n const [hydrated, setHydrated] = useState(false)\n const isInView = useInView(ref, { once, margin: \"-50px\" })\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n if (!hydrated) {\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n } as Record<string, unknown>)\n }\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring, 0.4)\n const currentStyle = isInView ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(isInView ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── AnimateIn ────────────────────────────────────────────────────────\n\n/**\n * Animates a child element immediately on mount.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Uses a two-phase approach: hidden → visible with requestAnimationFrame.\n *\n * @example\n * ```tsx\n * <AnimateIn from=\"up\" blur spring>\n * <h1>Welcome</h1>\n * </AnimateIn>\n * ```\n */\nfunction AnimateIn({\n children,\n delay = 0,\n from = \"down\",\n distance = 4,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n transition,\n}: AnimateInProps) {\n const ref = useRef<HTMLElement>(null)\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => setVisible(true))\n })\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring)\n const currentStyle = visible ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(visible ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── Stagger ──────────────────────────────────────────────────────────\n\n/**\n * Auto-staggers delay on child AnimateIn/AnimateOnView elements.\n * Eliminates manual `delay={i * 0.08}` math.\n *\n * @example\n * ```tsx\n * <Stagger interval={0.1}>\n * <AnimateIn from=\"up\"><Card>One</Card></AnimateIn>\n * <AnimateIn from=\"up\"><Card>Two</Card></AnimateIn>\n * </Stagger>\n * ```\n */\nfunction Stagger({\n children,\n interval = 0.08,\n baseDelay = 0,\n}: StaggerProps) {\n return (\n <>\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child\n return cloneElement(child as ReactElement<{ delay?: number }>, {\n delay: baseDelay + index * interval,\n })\n })}\n </>\n )\n}\n\n// ── Pulse ────────────────────────────────────────────────────────────\n\n/**\n * Continuous, subtle scale pulse. Great for live indicators and CTAs.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Pulse>\n * <span className=\"size-3 rounded-full bg-green-500\" />\n * </Pulse>\n * ```\n */\nfunction Pulse({\n children,\n min = 0.97,\n max = 1.03,\n duration = 2,\n opacity,\n paused = false,\n}: PulseProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `pulse-${id}`\n const opacityFrom = opacity?.[0] ?? 1\n const opacityTo = opacity?.[1] ?? 1\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: scale(${min}); opacity: ${opacityFrom}; }\n 50% { transform: scale(${max}); opacity: ${opacityTo}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ref: existingRef ? mergeRefs(existingRef) : undefined,\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Float ────────────────────────────────────────────────────────────\n\n/**\n * Gentle continuous up/down float. Perfect for decorative elements.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Float distance={10} duration={4}>\n * <Card>Floating</Card>\n * </Float>\n * ```\n */\nfunction Float({\n children,\n distance = 6,\n duration = 3,\n rotate = 0,\n paused = false,\n}: FloatProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `float-${id}`\n const rotA = rotate ? ` rotate(${-rotate}deg)` : \"\"\n const rotB = rotate ? ` rotate(${rotate}deg)` : \"\"\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: translateY(0px)${rotA}; }\n 50% { transform: translateY(${-distance}px)${rotB}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ...(existingRef ? { ref: existingRef } : {}),\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Exports ──────────────────────────────────────────────────────────\n\nexport { AnimateOnView, AnimateIn, Stagger, Pulse, Float }\nexport type {\n AnimateOnViewProps,\n AnimateInProps,\n StaggerProps,\n PulseProps,\n FloatProps,\n Direction,\n}\n"],"mappings":";;;;;;;;;AA0GA,MAAM,gBAAgB;CACpB,IAAI;EAAE,MAAM;EAAc,OAAO;EAAI;CACrC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAG;CACtC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAI;CACvC,OAAO;EAAE,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ACd,CAAC,SAAS,KAAK,KAAK;;CAGlD,MAAM,aAAa,SAAS;CAC5B,MAAM,gBAAiB,WAAW,SAAS,EAAE;CAC7C,MAAM,cAAe,WAA0C;AAE/D,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UAAQ,WAAkB,CAAA,EACzB,aAAa,UAAU;EACtB,GAAI,cAAc,EAAE,KAAK,aAAa,GAAG,EAAE;EAC3C,OAAO;GACL,GAAG;GACH,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,oBAAoB,SAAS,WAAW;GACzC;EACF,CAA4B,CAC5B,EAAA,CAAA"}
|
package/dist/autocomplete.js
CHANGED
|
@@ -13,7 +13,7 @@ function Autocomplete({ ...props }) {
|
|
|
13
13
|
function AutocompleteInput({ className, ...props }) {
|
|
14
14
|
return /* @__PURE__ */ jsx(Autocomplete$1.Input, {
|
|
15
15
|
"data-slot": "autocomplete-input",
|
|
16
|
-
className: cn("dark:bg-
|
|
16
|
+
className: cn("dark:bg-edge/30 border-edge focus-visible:border-focus focus-visible:ring-focus/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-edge/50 dark:disabled:bg-edge/80 placeholder:text-soft h-8 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm", className),
|
|
17
17
|
...props
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -68,28 +68,28 @@ function AutocompletePositioner({ className, ...props }) {
|
|
|
68
68
|
function AutocompletePopup({ className, ...props }) {
|
|
69
69
|
return /* @__PURE__ */ jsx(Autocomplete$1.Popup, {
|
|
70
70
|
"data-slot": "autocomplete-popup",
|
|
71
|
-
className: cn("motion-
|
|
71
|
+
className: cn("motion-pop-md bg-elevated text-contrast ring-contrast/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1", className),
|
|
72
72
|
...props
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function AutocompleteArrow({ className, ...props }) {
|
|
76
76
|
return /* @__PURE__ */ jsx(Autocomplete$1.Arrow, {
|
|
77
77
|
"data-slot": "autocomplete-arrow",
|
|
78
|
-
className: cn("fill-
|
|
78
|
+
className: cn("fill-elevated", className),
|
|
79
79
|
...props
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
function AutocompleteStatus({ className, ...props }) {
|
|
83
83
|
return /* @__PURE__ */ jsx(Autocomplete$1.Status, {
|
|
84
84
|
"data-slot": "autocomplete-status",
|
|
85
|
-
className: cn("text-muted
|
|
85
|
+
className: cn("text-muted flex w-full justify-center py-2 text-center text-sm", className),
|
|
86
86
|
...props
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function AutocompleteEmpty({ className, ...props }) {
|
|
90
90
|
return /* @__PURE__ */ jsx(Autocomplete$1.Empty, {
|
|
91
91
|
"data-slot": "autocomplete-empty",
|
|
92
|
-
className: cn("text-muted
|
|
92
|
+
className: cn("text-muted hidden w-full justify-center py-2 text-center text-sm group-data-empty/autocomplete-content:flex", className),
|
|
93
93
|
...props
|
|
94
94
|
});
|
|
95
95
|
}
|
|
@@ -110,14 +110,14 @@ function AutocompleteRow({ className, ...props }) {
|
|
|
110
110
|
function AutocompleteItem({ className, ...props }) {
|
|
111
111
|
return /* @__PURE__ */ jsx(Autocomplete$1.Item, {
|
|
112
112
|
"data-slot": "autocomplete-item",
|
|
113
|
-
className: cn("data-highlighted:bg-
|
|
113
|
+
className: cn("data-highlighted:bg-primary data-highlighted:text-white relative flex w-full cursor-clickable items-center gap-2 rounded-sm py-1 pl-1.5 pr-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
114
114
|
...props
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
function AutocompleteSeparator({ className, ...props }) {
|
|
118
118
|
return /* @__PURE__ */ jsx(Autocomplete$1.Separator, {
|
|
119
119
|
"data-slot": "autocomplete-separator",
|
|
120
|
-
className: cn("bg-
|
|
120
|
+
className: cn("bg-line -mx-1 my-1 h-px", className),
|
|
121
121
|
...props
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -131,7 +131,7 @@ function AutocompleteGroup({ className, ...props }) {
|
|
|
131
131
|
function AutocompleteGroupLabel({ className, ...props }) {
|
|
132
132
|
return /* @__PURE__ */ jsx(Autocomplete$1.GroupLabel, {
|
|
133
133
|
"data-slot": "autocomplete-group-label",
|
|
134
|
-
className: cn("text-muted
|
|
134
|
+
className: cn("text-muted px-2 py-1.5 text-xs", className),
|
|
135
135
|
...props
|
|
136
136
|
});
|
|
137
137
|
}
|
package/dist/autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../src/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AutocompleteProps = React.ComponentProps<typeof AutocompletePrimitive.Root>\ntype AutocompleteInputProps = React.ComponentProps<typeof AutocompletePrimitive.Input>\ntype AutocompleteTriggerProps = React.ComponentProps<typeof AutocompletePrimitive.Trigger>\ntype AutocompleteIconProps = React.ComponentProps<typeof AutocompletePrimitive.Icon>\ntype AutocompleteClearProps = React.ComponentProps<typeof AutocompletePrimitive.Clear>\ntype AutocompleteValueProps = React.ComponentProps<typeof AutocompletePrimitive.Value>\n\ntype AutocompletePortalProps = React.ComponentProps<typeof AutocompletePrimitive.Portal>\ntype AutocompleteBackdropProps = React.ComponentProps<typeof AutocompletePrimitive.Backdrop>\ntype AutocompletePositionerProps = React.ComponentProps<typeof AutocompletePrimitive.Positioner>\ntype AutocompletePopupProps = React.ComponentProps<typeof AutocompletePrimitive.Popup>\ntype AutocompleteArrowProps = React.ComponentProps<typeof AutocompletePrimitive.Arrow>\ntype AutocompleteStatusProps = React.ComponentProps<typeof AutocompletePrimitive.Status>\ntype AutocompleteEmptyProps = React.ComponentProps<typeof AutocompletePrimitive.Empty>\n\ntype AutocompleteListProps = React.ComponentProps<typeof AutocompletePrimitive.List>\ntype AutocompleteRowProps = React.ComponentProps<typeof AutocompletePrimitive.Row>\ntype AutocompleteItemProps = React.ComponentProps<typeof AutocompletePrimitive.Item>\ntype AutocompleteSeparatorProps = React.ComponentProps<typeof AutocompletePrimitive.Separator>\ntype AutocompleteGroupProps = React.ComponentProps<typeof AutocompletePrimitive.Group>\ntype AutocompleteGroupLabelProps = React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>\ntype AutocompleteCollectionProps = React.ComponentProps<typeof AutocompletePrimitive.Collection>\n\ntype AutocompleteContentProps = AutocompletePopupProps &\n Pick<\n AutocompletePositionerProps,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >\n\nfunction Autocomplete({ ...props }: AutocompleteProps) {\n return <AutocompletePrimitive.Root data-slot=\"autocomplete\" {...props} />\n}\n\nfunction AutocompleteInput({ className, ...props }: AutocompleteInputProps) {\n return (\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n className={cn(\n \"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 placeholder:text-muted-foreground h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteTrigger({ className, ...props }: AutocompleteTriggerProps) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteIcon({ className, ...props }: AutocompleteIconProps) {\n return (\n <AutocompletePrimitive.Icon\n data-slot=\"autocomplete-icon\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteClear({ className, ...props }: AutocompleteClearProps) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteValue({ ...props }: AutocompleteValueProps) {\n return (\n <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />\n )\n}\n\nfunction AutocompletePortal({ className, ...props }: AutocompletePortalProps) {\n return (\n <AutocompletePrimitive.Portal\n data-slot=\"autocomplete-portal\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteBackdrop({ className, ...props }: AutocompleteBackdropProps) {\n return (\n <AutocompletePrimitive.Backdrop\n data-slot=\"autocomplete-backdrop\"\n className={cn(\"fixed inset-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePositionerProps) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePopup({ className, ...props }: AutocompletePopupProps) {\n return (\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"motion-slide bg-popover text-popover-foreground ring-foreground/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteArrow({ className, ...props }: AutocompleteArrowProps) {\n return (\n <AutocompletePrimitive.Arrow\n data-slot=\"autocomplete-arrow\"\n className={cn(\"fill-popover\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompleteStatusProps) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"text-muted-foreground flex w-full justify-center py-2 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteEmpty({ className, ...props }: AutocompleteEmptyProps) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/autocomplete-content:flex\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteList({ className, ...props }: AutocompleteListProps) {\n return (\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\"scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteRow({ className, ...props }: AutocompleteRowProps) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteItem({ className, ...props }: AutocompleteItemProps) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex w-full cursor-clickable items-center gap-2 rounded-md py-1 pl-1.5 pr-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteSeparator({ className, ...props }: AutocompleteSeparatorProps) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroup({ className, ...props }: AutocompleteGroupProps) {\n return (\n <AutocompletePrimitive.Group\n data-slot=\"autocomplete-group\"\n className={cn(\"pt-1\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroupLabel({ className, ...props }: AutocompleteGroupLabelProps) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteCollection({ ...props }: AutocompleteCollectionProps) {\n return (\n <AutocompletePrimitive.Collection\n data-slot=\"autocomplete-collection\"\n {...props}\n />\n )\n}\n\nfunction AutocompleteContent({\n className,\n align = \"start\",\n alignOffset = 0,\n side = \"bottom\",\n sideOffset = 6,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n <AutocompletePositioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <AutocompletePopup className={className} {...props} />\n </AutocompletePositioner>\n </AutocompletePortal>\n )\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteIcon,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePopup,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n}"],"mappings":";;;;;;AAqCA,SAAS,aAAa,EAAE,GAAG,SAA4B;AACrD,QAAO,oBAACA,eAAsB,MAAvB;EAA4B,aAAU;EAAe,GAAI;EAAS,CAAA;;AAG3E,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GACT,giBACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAmC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,CAAA;;AAIN,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,cAAc,GACd,OAAO,UACP,aAAa,GACb,GAAG,SACwB;AAC3B,QACE,oBAAC,oBAAD,EAAA,UACE,oBAAC,wBAAD;EACS;EACM;EACP;EACM;EACZ,WAAU;YAEV,oBAAC,mBAAD;GAA8B;GAAW,GAAI;GAAS,CAAA;EAC/B,CAAA,EACN,CAAA"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../src/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AutocompleteProps = React.ComponentProps<typeof AutocompletePrimitive.Root>\ntype AutocompleteInputProps = React.ComponentProps<typeof AutocompletePrimitive.Input>\ntype AutocompleteTriggerProps = React.ComponentProps<typeof AutocompletePrimitive.Trigger>\ntype AutocompleteIconProps = React.ComponentProps<typeof AutocompletePrimitive.Icon>\ntype AutocompleteClearProps = React.ComponentProps<typeof AutocompletePrimitive.Clear>\ntype AutocompleteValueProps = React.ComponentProps<typeof AutocompletePrimitive.Value>\n\ntype AutocompletePortalProps = React.ComponentProps<typeof AutocompletePrimitive.Portal>\ntype AutocompleteBackdropProps = React.ComponentProps<typeof AutocompletePrimitive.Backdrop>\ntype AutocompletePositionerProps = React.ComponentProps<typeof AutocompletePrimitive.Positioner>\ntype AutocompletePopupProps = React.ComponentProps<typeof AutocompletePrimitive.Popup>\ntype AutocompleteArrowProps = React.ComponentProps<typeof AutocompletePrimitive.Arrow>\ntype AutocompleteStatusProps = React.ComponentProps<typeof AutocompletePrimitive.Status>\ntype AutocompleteEmptyProps = React.ComponentProps<typeof AutocompletePrimitive.Empty>\n\ntype AutocompleteListProps = React.ComponentProps<typeof AutocompletePrimitive.List>\ntype AutocompleteRowProps = React.ComponentProps<typeof AutocompletePrimitive.Row>\ntype AutocompleteItemProps = React.ComponentProps<typeof AutocompletePrimitive.Item>\ntype AutocompleteSeparatorProps = React.ComponentProps<typeof AutocompletePrimitive.Separator>\ntype AutocompleteGroupProps = React.ComponentProps<typeof AutocompletePrimitive.Group>\ntype AutocompleteGroupLabelProps = React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>\ntype AutocompleteCollectionProps = React.ComponentProps<typeof AutocompletePrimitive.Collection>\n\ntype AutocompleteContentProps = AutocompletePopupProps &\n Pick<\n AutocompletePositionerProps,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >\n\nfunction Autocomplete({ ...props }: AutocompleteProps) {\n return <AutocompletePrimitive.Root data-slot=\"autocomplete\" {...props} />\n}\n\nfunction AutocompleteInput({ className, ...props }: AutocompleteInputProps) {\n return (\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n className={cn(\n \"dark:bg-edge/30 border-edge focus-visible:border-focus focus-visible:ring-focus/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-edge/50 dark:disabled:bg-edge/80 placeholder:text-soft h-8 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteTrigger({ className, ...props }: AutocompleteTriggerProps) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteIcon({ className, ...props }: AutocompleteIconProps) {\n return (\n <AutocompletePrimitive.Icon\n data-slot=\"autocomplete-icon\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteClear({ className, ...props }: AutocompleteClearProps) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteValue({ ...props }: AutocompleteValueProps) {\n return (\n <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />\n )\n}\n\nfunction AutocompletePortal({ className, ...props }: AutocompletePortalProps) {\n return (\n <AutocompletePrimitive.Portal\n data-slot=\"autocomplete-portal\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteBackdrop({ className, ...props }: AutocompleteBackdropProps) {\n return (\n <AutocompletePrimitive.Backdrop\n data-slot=\"autocomplete-backdrop\"\n className={cn(\"fixed inset-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePositionerProps) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePopup({ className, ...props }: AutocompletePopupProps) {\n return (\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"motion-pop-md bg-elevated text-contrast ring-contrast/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md shadow-md ring-1\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteArrow({ className, ...props }: AutocompleteArrowProps) {\n return (\n <AutocompletePrimitive.Arrow\n data-slot=\"autocomplete-arrow\"\n className={cn(\"fill-elevated\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompleteStatusProps) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"text-muted flex w-full justify-center py-2 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteEmpty({ className, ...props }: AutocompleteEmptyProps) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\"text-muted hidden w-full justify-center py-2 text-center text-sm group-data-empty/autocomplete-content:flex\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteList({ className, ...props }: AutocompleteListProps) {\n return (\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\"scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteRow({ className, ...props }: AutocompleteRowProps) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteItem({ className, ...props }: AutocompleteItemProps) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"data-highlighted:bg-primary data-highlighted:text-white relative flex w-full cursor-clickable items-center gap-2 rounded-sm py-1 pl-1.5 pr-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteSeparator({ className, ...props }: AutocompleteSeparatorProps) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"bg-line -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroup({ className, ...props }: AutocompleteGroupProps) {\n return (\n <AutocompletePrimitive.Group\n data-slot=\"autocomplete-group\"\n className={cn(\"pt-1\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroupLabel({ className, ...props }: AutocompleteGroupLabelProps) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"text-muted px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteCollection({ ...props }: AutocompleteCollectionProps) {\n return (\n <AutocompletePrimitive.Collection\n data-slot=\"autocomplete-collection\"\n {...props}\n />\n )\n}\n\nfunction AutocompleteContent({\n className,\n align = \"start\",\n alignOffset = 0,\n side = \"bottom\",\n sideOffset = 6,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n <AutocompletePositioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <AutocompletePopup className={className} {...props} />\n </AutocompletePositioner>\n </AutocompletePortal>\n )\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteIcon,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePopup,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n}"],"mappings":";;;;;;AAqCA,SAAS,aAAa,EAAE,GAAG,SAA4B;AACrD,QAAO,oBAACA,eAAsB,MAAvB;EAA4B,aAAU;EAAe,GAAI;EAAS,CAAA;;AAG3E,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GACT,khBACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAmC;AAC9E,QACE,oBAACA,eAAsB,SAAvB;EACE,aAAU;EACV,WAAW,GAAG,YAAY,UAAU;EACpC,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAACA,eAAsB,MAAvB;EACE,aAAU;EACV,WAAW,GAAG,YAAY,UAAU;EACpC,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GAAG,YAAY,UAAU;EACpC,GAAI;EACJ,CAAA;;AAI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U;EAC7F,GAAI;EACJ,CAAA;;AAIN,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAA+B;AACtE,QACE,oBAACA,eAAsB,KAAvB;EACE,aAAU;EACV,WAAW,GAAG,UAAU;EACxB,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAACA,eAAsB,MAAvB;EACE,aAAU;EACV,WAAW,GACT,kUACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,sBAAsB,EAAE,WAAW,GAAG,SAAqC;AAClF,QACE,oBAACA,eAAsB,WAAvB;EACE,aAAU;EACV,WAAW,GAAG,2BAA2B,UAAU;EACnD,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GAAG,QAAQ,UAAU;EAChC,GAAI;EACJ,CAAA;;AAIN,SAAS,uBAAuB,EAAE,WAAW,GAAG,SAAsC;AACpF,QACE,oBAACA,eAAsB,YAAvB;EACE,aAAU;EACV,WAAW,GAAG,kCAAkC,UAAU;EAC1D,GAAI;EACJ,CAAA;;AAIN,SAAS,uBAAuB,EAAE,GAAG,SAAsC;AACzE,QACE,oBAACA,eAAsB,YAAvB;EACE,aAAU;EACV,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,cAAc,GACd,OAAO,UACP,aAAa,GACb,GAAG,SACwB;AAC3B,QACE,oBAAC,oBAAD,EAAA,UACE,oBAAC,wBAAD;EACS;EACM;EACP;EACM;EACZ,WAAU;YAEV,oBAAC,mBAAD;GAA8B;GAAW,GAAI;GAAS,CAAA;EAC/B,CAAA,EACN,CAAA"}
|
package/dist/avatar.js
CHANGED
|
@@ -8,7 +8,7 @@ function Avatar({ className, size = "default", ...props }) {
|
|
|
8
8
|
return /* @__PURE__ */ jsx(Avatar$1.Root, {
|
|
9
9
|
"data-slot": "avatar",
|
|
10
10
|
"data-size": size,
|
|
11
|
-
className: cn("after:border-
|
|
11
|
+
className: cn("after:border-line group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten", className),
|
|
12
12
|
...props
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -22,28 +22,28 @@ function AvatarImage({ className, ...props }) {
|
|
|
22
22
|
function AvatarFallback({ className, ...props }) {
|
|
23
23
|
return /* @__PURE__ */ jsx(Avatar$1.Fallback, {
|
|
24
24
|
"data-slot": "avatar-fallback",
|
|
25
|
-
className: cn("bg-
|
|
25
|
+
className: cn("bg-secondary text-muted flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs", className),
|
|
26
26
|
...props
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function AvatarBadge({ className, ...props }) {
|
|
30
30
|
return /* @__PURE__ */ jsx("span", {
|
|
31
31
|
"data-slot": "avatar-badge",
|
|
32
|
-
className: cn("bg-primary text-
|
|
32
|
+
className: cn("bg-primary text-white ring-foundation absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-blend-color ring-2 select-none", "group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden", "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", className),
|
|
33
33
|
...props
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function AvatarGroup({ className, ...props }) {
|
|
37
37
|
return /* @__PURE__ */ jsx("div", {
|
|
38
38
|
"data-slot": "avatar-group",
|
|
39
|
-
className: cn("*:data-[slot=avatar]:ring-
|
|
39
|
+
className: cn("*:data-[slot=avatar]:ring-foundation group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2", className),
|
|
40
40
|
...props
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function AvatarGroupCount({ className, ...props }) {
|
|
44
44
|
return /* @__PURE__ */ jsx("div", {
|
|
45
45
|
"data-slot": "avatar-group-count",
|
|
46
|
-
className: cn("bg-
|
|
46
|
+
className: cn("bg-secondary text-muted ring-foundation relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", className),
|
|
47
47
|
...props
|
|
48
48
|
});
|
|
49
49
|
}
|
package/dist/avatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":["AvatarPrimitive"],"sources":["../src/avatar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AvatarProps = AvatarPrimitive.Root.Props & {\n size?: \"default\" | \"sm\" | \"lg\"\n}\ntype AvatarImageProps = AvatarPrimitive.Image.Props\ntype AvatarFallbackProps = AvatarPrimitive.Fallback.Props\ntype AvatarBadgeProps = React.ComponentProps<\"span\">\ntype AvatarGroupProps = React.ComponentProps<\"div\">\ntype AvatarGroupCountProps = React.ComponentProps<\"div\">\n\nfunction Avatar({\n className,\n size = \"default\",\n ...props\n}: AvatarProps) {\n return (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n data-size={size}\n className={cn(\n \"after:border-
|
|
1
|
+
{"version":3,"file":"avatar.js","names":["AvatarPrimitive"],"sources":["../src/avatar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AvatarProps = AvatarPrimitive.Root.Props & {\n size?: \"default\" | \"sm\" | \"lg\"\n}\ntype AvatarImageProps = AvatarPrimitive.Image.Props\ntype AvatarFallbackProps = AvatarPrimitive.Fallback.Props\ntype AvatarBadgeProps = React.ComponentProps<\"span\">\ntype AvatarGroupProps = React.ComponentProps<\"div\">\ntype AvatarGroupCountProps = React.ComponentProps<\"div\">\n\nfunction Avatar({\n className,\n size = \"default\",\n ...props\n}: AvatarProps) {\n return (\n <AvatarPrimitive.Root\n data-slot=\"avatar\"\n data-size={size}\n className={cn(\n \"after:border-line group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AvatarImage({ className, ...props }: AvatarImageProps) {\n return (\n <AvatarPrimitive.Image\n data-slot=\"avatar-image\"\n className={cn(\n \"aspect-square size-full rounded-full object-cover\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AvatarFallback({\n className,\n ...props\n}: AvatarFallbackProps) {\n return (\n <AvatarPrimitive.Fallback\n data-slot=\"avatar-fallback\"\n className={cn(\n \"bg-secondary text-muted flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AvatarBadge({ className, ...props }: AvatarBadgeProps) {\n return (\n <span\n data-slot=\"avatar-badge\"\n className={cn(\n \"bg-primary text-white ring-foundation absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-blend-color ring-2 select-none\",\n \"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden\",\n \"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2\",\n \"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AvatarGroup({ className, ...props }: AvatarGroupProps) {\n return (\n <div\n data-slot=\"avatar-group\"\n className={cn(\n \"*:data-[slot=avatar]:ring-foundation group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AvatarGroupCount({\n className,\n ...props\n}: AvatarGroupCountProps) {\n return (\n <div\n data-slot=\"avatar-group-count\"\n className={cn(\n \"bg-secondary text-muted ring-foundation relative flex size-8 shrink-0 items-center justify-center rounded-full text-sm ring-2 group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Avatar,\n AvatarImage,\n AvatarFallback,\n AvatarGroup,\n AvatarGroupCount,\n AvatarBadge,\n}\n"],"mappings":";;;;;;AAgBA,SAAS,OAAO,EACd,WACA,OAAO,WACP,GAAG,SACW;AACd,QACE,oBAACA,SAAgB,MAAjB;EACE,aAAU;EACV,aAAW;EACX,WAAW,GACT,uPACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;AAC9D,QACE,oBAACA,SAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GACT,qDACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,eAAe,EACtB,WACA,GAAG,SACmB;AACtB,QACE,oBAACA,SAAgB,UAAjB;EACE,aAAU;EACV,WAAW,GACT,+HACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;AAC9D,QACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,+JACA,iFACA,6FACA,iFACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;AAC9D,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,uGACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EACxB,WACA,GAAG,SACqB;AACxB,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,qVACA,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/badge.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
5
5
|
|
|
6
6
|
//#region src/badge.d.ts
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
|
-
variant?: "default" | "
|
|
8
|
+
variant?: "default" | "destructive" | "link" | "outline" | "success" | "warning" | "secondary" | "ghost" | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
type BadgeProps = useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>;
|
|
11
11
|
declare function Badge({
|
package/dist/badge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","names":[],"sources":["../src/badge.tsx"],"mappings":";;;;;;cAQM,aAAA,GAAa,KAAA;;
|
|
1
|
+
{"version":3,"file":"badge.d.ts","names":[],"sources":["../src/badge.tsx"],"mappings":";;;;;;cAQM,aAAA,GAAa,KAAA;;IA0BlB,iCAAA,CAAA,SAAA;AAAA,KAEI,UAAA,GAAa,SAAA,CAAU,cAAA,WAAyB,YAAA,QAAoB,aAAA;AAAA,iBAEhE,KAAA,CAAA;EACP,SAAA;EACA,OAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,UAAA,GAAU,OAAA,CAAA,YAAA,mBAAA,OAAA,CAAA,qBAAA"}
|
package/dist/badge.js
CHANGED
|
@@ -4,16 +4,15 @@ import { cva } from "class-variance-authority";
|
|
|
4
4
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
5
|
import { useRender } from "@base-ui/react/use-render";
|
|
6
6
|
//#region src/badge.tsx
|
|
7
|
-
const badgeVariants = cva("h-5 gap-1 rounded-
|
|
7
|
+
const badgeVariants = cva("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-xs font-medium motion-color has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-focus focus-visible:ring-focus/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge", {
|
|
8
8
|
variants: { variant: {
|
|
9
|
-
default: "bg-
|
|
10
|
-
solid: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
9
|
+
default: "bg-primary text-white [a]:hover:bg-primary/80",
|
|
11
10
|
success: "bg-success/10 [a]:hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 text-success dark:bg-success/20",
|
|
12
11
|
destructive: "bg-destructive/10 text-destructive [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20",
|
|
13
12
|
warning: "bg-warning/10 text-warning [a]:hover:bg-warning/20 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/20",
|
|
14
|
-
secondary: "bg-secondary text-
|
|
15
|
-
outline: "border-
|
|
16
|
-
ghost: "hover:bg-
|
|
13
|
+
secondary: "bg-secondary text-contrast [a]:hover:bg-secondary/80",
|
|
14
|
+
outline: "border-line text-contrast [a]:hover:bg-secondary [a]:hover:text-muted",
|
|
15
|
+
ghost: "hover:bg-secondary hover:text-muted dark:hover:bg-secondary/50",
|
|
17
16
|
link: "text-primary underline-offset-4 hover:underline"
|
|
18
17
|
} },
|
|
19
18
|
defaultVariants: { variant: "default" }
|
package/dist/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","names":[],"sources":["../src/badge.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst badgeVariants = cva(\n \"h-5 gap-1 rounded-
|
|
1
|
+
{"version":3,"file":"badge.js","names":[],"sources":["../src/badge.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst badgeVariants = cva(\n \"h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-xs font-medium motion-color has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-focus focus-visible:ring-focus/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-white [a]:hover:bg-primary/80\",\n success:\n \"bg-success/10 [a]:hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 text-success dark:bg-success/20\",\n destructive:\n \"bg-destructive/10 text-destructive [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20\",\n warning:\n \"bg-warning/10 text-warning [a]:hover:bg-warning/20 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/20\",\n secondary:\n \"bg-secondary text-contrast [a]:hover:bg-secondary/80\",\n outline:\n \"border-line text-contrast [a]:hover:bg-secondary [a]:hover:text-muted\",\n ghost:\n \"hover:bg-secondary hover:text-muted dark:hover:bg-secondary/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\ntype BadgeProps = useRender.ComponentProps<\"span\"> & VariantProps<typeof badgeVariants>\n\nfunction Badge({\n className,\n variant = \"default\",\n render,\n ...props\n}: BadgeProps) {\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(\n {\n className: cn(badgeVariants({ className, variant })),\n },\n props\n ),\n render,\n state: {\n slot: \"badge\",\n variant,\n },\n })\n}\n\nexport { Badge, badgeVariants }\n"],"mappings":";;;;;;AAQA,MAAM,gBAAgB,IACpB,2eACA;CACE,UAAU,EACR,SAAS;EACP,SACE;EACF,SACE;EACF,aACE;EACF,SACE;EACF,WACE;EACF,SACE;EACF,OACE;EACF,MAAM;EACP,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF;AAID,SAAS,MAAM,EACb,WACA,UAAU,WACV,QACA,GAAG,SACU;AACb,QAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GAAG,cAAc;GAAE;GAAW;GAAS,CAAC,CAAC,EACrD,EACD,MACD;EACD;EACA,OAAO;GACL,MAAM;GACN;GACD;EACF,CAAC"}
|
package/dist/breadcrumb.js
CHANGED
|
@@ -16,7 +16,7 @@ function Breadcrumb({ ...props }) {
|
|
|
16
16
|
function BreadcrumbList({ className, ...props }) {
|
|
17
17
|
return /* @__PURE__ */ jsx("ol", {
|
|
18
18
|
"data-slot": "breadcrumb-list",
|
|
19
|
-
className: cn("text-muted
|
|
19
|
+
className: cn("text-muted flex flex-wrap items-center gap-1.5 text-sm wrap-break-word", className),
|
|
20
20
|
...props
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -30,7 +30,7 @@ function BreadcrumbItem({ className, ...props }) {
|
|
|
30
30
|
function BreadcrumbLink({ className, render, ...props }) {
|
|
31
31
|
return useRender({
|
|
32
32
|
defaultTagName: "a",
|
|
33
|
-
props: mergeProps({ className: cn("hover:text-
|
|
33
|
+
props: mergeProps({ className: cn("hover:text-contrast transition-colors", className) }, props),
|
|
34
34
|
render,
|
|
35
35
|
state: { slot: "breadcrumb-link" }
|
|
36
36
|
});
|
|
@@ -41,7 +41,7 @@ function BreadcrumbPage({ className, ...props }) {
|
|
|
41
41
|
role: "link",
|
|
42
42
|
"aria-disabled": "true",
|
|
43
43
|
"aria-current": "page",
|
|
44
|
-
className: cn("text-
|
|
44
|
+
className: cn("text-contrast font-normal", className),
|
|
45
45
|
...props
|
|
46
46
|
});
|
|
47
47
|
}
|
package/dist/breadcrumb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","names":[],"sources":["../src/breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\n\nimport { cn } from \"./lib/utils\"\nimport { ChevronRightIcon, EllipsisIcon } from \"./lib/internal-icons\"\n\ntype BreadcrumbProps = React.ComponentProps<\"nav\">\ntype BreadcrumbListProps = React.ComponentProps<\"ol\">\ntype BreadcrumbItemProps = React.ComponentProps<\"li\">\ntype BreadcrumbLinkProps = useRender.ComponentProps<\"a\">\ntype BreadcrumbPageProps = React.ComponentProps<\"span\">\ntype BreadcrumbSeparatorProps = React.ComponentProps<\"li\">\ntype BreadcrumbEllipsisProps = React.ComponentProps<\"span\">\n\nfunction Breadcrumb({ ...props }: BreadcrumbProps) {\n return (\n <nav\n aria-label=\"breadcrumb\"\n data-slot=\"breadcrumb\"\n {...props}\n />\n )\n}\n\nfunction BreadcrumbList({ className, ...props }: BreadcrumbListProps) {\n return (\n <ol\n data-slot=\"breadcrumb-list\"\n className={cn(\n \"text-muted
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":[],"sources":["../src/breadcrumb.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\n\nimport { cn } from \"./lib/utils\"\nimport { ChevronRightIcon, EllipsisIcon } from \"./lib/internal-icons\"\n\ntype BreadcrumbProps = React.ComponentProps<\"nav\">\ntype BreadcrumbListProps = React.ComponentProps<\"ol\">\ntype BreadcrumbItemProps = React.ComponentProps<\"li\">\ntype BreadcrumbLinkProps = useRender.ComponentProps<\"a\">\ntype BreadcrumbPageProps = React.ComponentProps<\"span\">\ntype BreadcrumbSeparatorProps = React.ComponentProps<\"li\">\ntype BreadcrumbEllipsisProps = React.ComponentProps<\"span\">\n\nfunction Breadcrumb({ ...props }: BreadcrumbProps) {\n return (\n <nav\n aria-label=\"breadcrumb\"\n data-slot=\"breadcrumb\"\n {...props}\n />\n )\n}\n\nfunction BreadcrumbList({ className, ...props }: BreadcrumbListProps) {\n return (\n <ol\n data-slot=\"breadcrumb-list\"\n className={cn(\n \"text-muted flex flex-wrap items-center gap-1.5 text-sm wrap-break-word\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction BreadcrumbItem({ className, ...props }: BreadcrumbItemProps) {\n return (\n <li\n data-slot=\"breadcrumb-item\"\n className={cn(\n \"inline-flex items-center gap-1\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction BreadcrumbLink({\n className,\n render,\n ...props\n}: BreadcrumbLinkProps) {\n return useRender({\n defaultTagName: \"a\",\n props: mergeProps<\"a\">(\n {\n className: cn(\n \"hover:text-contrast transition-colors\",\n className\n ),\n },\n props,\n ),\n render,\n state: {\n slot: \"breadcrumb-link\",\n },\n })\n}\n\nfunction BreadcrumbPage({ className, ...props }: BreadcrumbPageProps) {\n return (\n <span\n data-slot=\"breadcrumb-page\"\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn(\n \"text-contrast font-normal\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction BreadcrumbSeparator({\n children,\n className,\n ...props\n}: BreadcrumbSeparatorProps) {\n return (\n <li\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:size-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRightIcon />}\n </li>\n )\n}\n\nfunction BreadcrumbEllipsis({\n className,\n ...props\n}: BreadcrumbEllipsisProps) {\n return (\n <span\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\n \"flex size-5 items-center justify-center [&>svg]:size-4\",\n className,\n )}\n {...props}\n >\n <EllipsisIcon />\n <span className=\"sr-only\">More</span>\n </span>\n )\n}\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n}\n"],"mappings":";;;;;;;;AAiBA,SAAS,WAAW,EAAE,GAAG,SAA0B;AACjD,QACE,oBAAC,OAAD;EACE,cAAW;EACX,aAAU;EACV,GAAI;EACJ,CAAA;;AAIN,SAAS,eAAe,EAAE,WAAW,GAAG,SAA8B;AACpE,QACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GACT,0EACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,eAAe,EAAE,WAAW,GAAG,SAA8B;AACpE,QACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GACT,kCACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,eAAe,EACtB,WACA,QACA,GAAG,SACmB;AACtB,QAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GACT,yCACA,UACD,EACF,EACD,MACD;EACD;EACA,OAAO,EACL,MAAM,mBACP;EACF,CAAC;;AAGJ,SAAS,eAAe,EAAE,WAAW,GAAG,SAA8B;AACpE,QACE,oBAAC,QAAD;EACE,aAAU;EACV,MAAK;EACL,iBAAc;EACd,gBAAa;EACb,WAAW,GACT,6BACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAC3B,UACA,WACA,GAAG,SACwB;AAC3B,QACE,oBAAC,MAAD;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAW,GAAG,oBAAoB,UAAU;EAC5C,GAAI;YAEH,YAAY,oBAAC,kBAAD,EAAoB,CAAA;EAC9B,CAAA;;AAIT,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACuB;AAC1B,QACE,qBAAC,QAAD;EACE,aAAU;EACV,MAAK;EACL,eAAY;EACZ,WAAW,GACT,0DACA,UACD;EACD,GAAI;YARN,CAUE,oBAAC,cAAD,EAAgB,CAAA,EAChB,oBAAC,QAAD;GAAM,WAAU;aAAU;GAAW,CAAA,CAChC"}
|
package/dist/button-group.js
CHANGED
|
@@ -6,10 +6,10 @@ import { cva } from "class-variance-authority";
|
|
|
6
6
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
7
|
import { useRender } from "@base-ui/react/use-render";
|
|
8
8
|
//#region src/button-group.tsx
|
|
9
|
-
const buttonGroupVariants = cva("has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-
|
|
9
|
+
const buttonGroupVariants = cva("has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md flex w-fit items-stretch *:focus-visible:z-10 *:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
10
10
|
variants: { orientation: {
|
|
11
|
-
horizontal: "[&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-
|
|
12
|
-
vertical: "[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-
|
|
11
|
+
horizontal: "[&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0 *:data-slot:rounded-r-none",
|
|
12
|
+
vertical: "[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! flex-col [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0 *:data-slot:rounded-b-none"
|
|
13
13
|
} },
|
|
14
14
|
defaultVariants: { orientation: "horizontal" }
|
|
15
15
|
});
|
|
@@ -25,7 +25,7 @@ function ButtonGroup({ className, orientation, ...props }) {
|
|
|
25
25
|
function ButtonGroupText({ className, render, ...props }) {
|
|
26
26
|
return useRender({
|
|
27
27
|
defaultTagName: "div",
|
|
28
|
-
props: mergeProps({ className: cn("bg-
|
|
28
|
+
props: mergeProps({ className: cn("bg-secondary gap-2 rounded-md border border-edge px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none", className) }, props),
|
|
29
29
|
render,
|
|
30
30
|
state: { slot: "button-group-text" }
|
|
31
31
|
});
|
|
@@ -34,7 +34,7 @@ function ButtonGroupSeparator({ className, orientation = "vertical", ...props })
|
|
|
34
34
|
return /* @__PURE__ */ jsx(Separator, {
|
|
35
35
|
"data-slot": "button-group-separator",
|
|
36
36
|
orientation,
|
|
37
|
-
className: cn("bg-
|
|
37
|
+
className: cn("bg-edge relative self-stretch data-[orientation=horizontal]:mx-px data-[orientation=horizontal]:w-auto data-[orientation=vertical]:my-px data-[orientation=vertical]:h-auto", className),
|
|
38
38
|
...props
|
|
39
39
|
});
|
|
40
40
|
}
|
package/dist/button-group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","names":[],"sources":["../src/button-group.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\nimport { Separator } from \"./separator\"\n\nconst buttonGroupVariants = cva(\n \"has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-
|
|
1
|
+
{"version":3,"file":"button-group.js","names":[],"sources":["../src/button-group.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\nimport { Separator } from \"./separator\"\n\nconst buttonGroupVariants = cva(\n \"has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md flex w-fit items-stretch *:focus-visible:z-10 *:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1\",\n {\n variants: {\n orientation: {\n horizontal:\n \"[&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0 *:data-slot:rounded-r-none\",\n vertical:\n \"[&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! flex-col [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0 *:data-slot:rounded-b-none\",\n },\n },\n defaultVariants: {\n orientation: \"horizontal\",\n },\n }\n)\n\ntype ButtonGroupProps = React.ComponentProps<\"div\"> & VariantProps<typeof buttonGroupVariants>\ntype ButtonGroupTextProps = useRender.ComponentProps<\"div\">\ntype ButtonGroupSeparatorProps = React.ComponentProps<typeof Separator>\n\nfunction ButtonGroup({\n className,\n orientation,\n ...props\n}: ButtonGroupProps) {\n return (\n <div\n role=\"group\"\n data-slot=\"button-group\"\n data-orientation={orientation}\n className={cn(buttonGroupVariants({ orientation }), className)}\n {...props}\n />\n )\n}\n\nfunction ButtonGroupText({\n className,\n render,\n ...props\n}: ButtonGroupTextProps) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"bg-secondary gap-2 rounded-md border border-edge px-2.5 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"button-group-text\",\n },\n })\n}\n\nfunction ButtonGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: ButtonGroupSeparatorProps) {\n return (\n <Separator\n data-slot=\"button-group-separator\"\n orientation={orientation}\n className={cn(\n \"bg-edge relative self-stretch data-[orientation=horizontal]:mx-px data-[orientation=horizontal]:w-auto data-[orientation=vertical]:my-px data-[orientation=vertical]:h-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n buttonGroupVariants,\n}\n"],"mappings":";;;;;;;;AASA,MAAM,sBAAsB,IAC1B,4RACA;CACE,UAAU,EACR,aAAa;EACX,YACE;EACF,UACE;EACH,EACF;CACD,iBAAiB,EACf,aAAa,cACd;CACF,CACF;AAMD,SAAS,YAAY,EACnB,WACA,aACA,GAAG,SACgB;AACnB,QACE,oBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,oBAAkB;EAClB,WAAW,GAAG,oBAAoB,EAAE,aAAa,CAAC,EAAE,UAAU;EAC9D,GAAI;EACJ,CAAA;;AAIN,SAAS,gBAAgB,EACvB,WACA,QACA,GAAG,SACoB;AACvB,QAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GACT,kKACA,UACD,EACF,EACD,MACD;EACD;EACA,OAAO,EACL,MAAM,qBACP;EACF,CAAC;;AAGJ,SAAS,qBAAqB,EAC5B,WACA,cAAc,YACd,GAAG,SACyB;AAC5B,QACE,oBAAC,WAAD;EACE,aAAU;EACG;EACb,WAAW,GACT,+KACA,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/button.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
6
6
|
|
|
7
7
|
//#region src/button.d.ts
|
|
8
8
|
declare const buttonVariants: (props?: ({
|
|
9
|
-
variant?: "default" | "
|
|
10
|
-
size?: "default" | "
|
|
9
|
+
variant?: "default" | "destructive" | "link" | "outline" | "success" | "secondary" | "ghost" | null | undefined;
|
|
10
|
+
size?: "default" | "sm" | "lg" | "icon" | "xs" | "xl" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
11
11
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
12
12
|
type ButtonProps = React.ComponentProps<typeof Button$1> & VariantProps<typeof buttonVariants>;
|
|
13
13
|
declare function Button({
|
package/dist/button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","names":[],"sources":["../src/button.tsx"],"mappings":";;;;;;;cAQM,cAAA,GAAc,KAAA;;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","names":[],"sources":["../src/button.tsx"],"mappings":";;;;;;;cAQM,cAAA,GAAc,KAAA;;;IAgCnB,iCAAA,CAAA,SAAA;AAAA,KAEI,WAAA,GAAc,KAAA,CAAM,cAAA,QAAsB,QAAA,IAAmB,YAAA,QAAoB,cAAA;AAAA,iBAE7E,MAAA,CAAA;EACP,SAAA;EACA,OAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,WAAA,GAAW,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/button.js
CHANGED
|
@@ -5,27 +5,26 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
//#region src/button.tsx
|
|
8
|
-
const buttonVariants = cva("cursor-clickable focus-visible:border-
|
|
8
|
+
const buttonVariants = cva("cursor-clickable focus-visible:border-focus focus-visible:ring-focus/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap motion-color disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default: "bg-primary
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ghost: "hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
11
|
+
default: "bg-primary text-white hover:bg-primary/80",
|
|
12
|
+
outline: "border-line bg-foundation hover:bg-secondary hover:text-contrast dark:bg-edge/30 dark:border-edge dark:hover:bg-edge/50 aria-expanded:bg-secondary aria-expanded:text-contrast",
|
|
13
|
+
secondary: "bg-secondary text-contrast hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-contrast",
|
|
14
|
+
ghost: "hover:bg-secondary/80 hover:text-contrast aria-expanded:bg-secondary aria-expanded:text-contrast",
|
|
16
15
|
success: "bg-success/10 hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/20 text-success focus-visible:border-success/40 dark:hover:bg-success/30",
|
|
17
16
|
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
|
18
17
|
link: "text-primary underline-offset-4 hover:underline"
|
|
19
18
|
},
|
|
20
19
|
size: {
|
|
21
20
|
default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
22
|
-
xs: "h-6 gap-1 rounded-
|
|
23
|
-
sm: "h-7 gap-1 rounded-
|
|
21
|
+
xs: "h-6 gap-1 rounded-sm px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
22
|
+
sm: "h-7 gap-1 rounded-sm px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
24
23
|
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
25
24
|
xl: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
26
25
|
icon: "size-8",
|
|
27
|
-
"icon-xs": "size-6 rounded-
|
|
28
|
-
"icon-sm": "size-7 rounded-
|
|
26
|
+
"icon-xs": "size-6 rounded-sm in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
27
|
+
"icon-sm": "size-7 rounded-sm in-data-[slot=button-group]:rounded-md",
|
|
29
28
|
"icon-lg": "size-9"
|
|
30
29
|
}
|
|
31
30
|
},
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"sources":["../src/button.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst buttonVariants = cva(\n \"cursor-clickable focus-visible:border-
|
|
1
|
+
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"sources":["../src/button.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst buttonVariants = cva(\n \"cursor-clickable focus-visible:border-focus focus-visible:ring-focus/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap motion-color disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-white hover:bg-primary/80\",\n outline: \"border-line bg-foundation hover:bg-secondary hover:text-contrast dark:bg-edge/30 dark:border-edge dark:hover:bg-edge/50 aria-expanded:bg-secondary aria-expanded:text-contrast\",\n secondary: \"bg-secondary text-contrast hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-contrast\",\n ghost: \"hover:bg-secondary/80 hover:text-contrast aria-expanded:bg-secondary aria-expanded:text-contrast\",\n success: \"bg-success/10 hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/20 text-success focus-visible:border-success/40 dark:hover:bg-success/30\",\n destructive: \"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n xs: \"h-6 gap-1 rounded-sm px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-7 gap-1 rounded-sm px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n xl: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n icon: \"size-8\",\n \"icon-xs\":\n \"size-6 rounded-sm in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-7 rounded-sm in-data-[slot=button-group]:rounded-md\",\n \"icon-lg\": \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\ntype ButtonProps = React.ComponentProps<typeof ButtonPrimitive> & VariantProps<typeof buttonVariants>\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ButtonProps) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n nativeButton={props.render ? false : undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;AAQA,MAAM,iBAAiB,IACrB,qkBACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SAAS;GACT,WAAW;GACX,OAAO;GACP,SAAS;GACT,aAAa;GACb,MAAM;GACP;EACD,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WACE;GACF,WACE;GACF,WAAW;GACZ;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAID,SAAS,OAAO,EACd,WACA,UAAU,WACV,OAAO,WACP,GAAG,SACW;AACd,QACE,oBAACA,UAAD;EACE,aAAU;EACV,cAAc,MAAM,SAAS,QAAQ,KAAA;EACrC,WAAW,GAAG,eAAe;GAAE;GAAS;GAAM,CAAC,EAAE,UAAU;EAC3D,GAAI;EACJ,CAAA"}
|