Skip to content

v1.1.0

Choose a tag to compare

@sapatmohit sapatmohit released this 07 Sep 10:31
· 50 commits to main since this release

Heads up if you already use this package

NavBar no longer uses next/link. It renders plain <a> elements so the
library works outside Next.js. If you were relying on client-side navigation, pass
your router's link component to restore it:

import Link from "next/link";
<NavBar links={links} linkComponent={Link} />

Without that change your nav links still work, but they do a full page load.

NavBarLocale type is gone. Import Locale instead — NavBar and
LanguageSwitcher now share one type.

@babelize/elements/style.css is gone. That subpath never resolved to a real
file, so importing it always errored.

Everything else is backwards compatible: currentLocale, onLocaleChange,
onChange, and showFlag still work as deprecated aliases.


Fix the published package and unify the component API.

The published package now actually resolves. build:lib used plain tsc, which
does not rewrite tsconfig paths, so every compiled component shipped
import { cn } from "@/lib/utils" — an unresolvable specifier. npm install @babelize/elements followed by import { LanguageSwitcher } failed for every
consumer. The build now uses tsup and emits real ESM (dist/index.js) plus real
CJS (dist/index.cjs) with resolved imports and correct extensions. A packaging
smoke test installs the tarball into a bare project on every CI run.

Breaking changes

  • exports["./style.css"] is removed. It pointed at a file the build never
    produced, so import "@babelize/elements/style.css" was always an error.
  • NavBar no longer imports next/link. It renders plain <a> elements by
    default and accepts linkComponent for client-side routing:
    <NavBar linkComponent={Link} />. next is no longer a dependency of any kind,
    so the library works in any React app.
  • Locale is now a single shared interface exported once from the package root.
    The NavBarLocale alias is gone — NavBar's Locale and LanguageSwitcher's
    Locale were two different shapes hidden behind that alias.
  • NavBar props: currentLocale → value, onLocaleChange → onValueChange.
  • PhoneInput props: onChange → onValueChange, showFlag → showFlags.
    The old names still work for this release and warn as deprecated.

Fixes

  • PhoneInput's value and LanguageSwitcher's defaultValue only seeded
    internal state and never synced, so both components were uncontrolled no matter
    what the parent passed. All three components now support real controlled mode
    via value and uncontrolled mode via defaultValue.
  • LanguageSwitcher fired onValueChange twice per selection.
  • The Gujarati flag emoji used a non-regional-indicator codepoint and rendered as
    garbage.

Additions

  • All three components forward refs and spread unknown props onto their root
    element, so id, name, aria-*, and data-* now pass through. PhoneInput
    forwards its ref to the underlying <input> and accepts name, making it
    usable in plain HTML forms.
  • cn and COUNTRIES are exported from the package root.
  • next-themes is no longer a runtime dependency; it was only used by the docs site.

Also in this release

Add shadcn-compatible component registry (/r/[name].json + /registry.json) and a bundled CLI (npx @babelize/elements add <component> / list). Components are now styled with plain Tailwind classes instead of CSS-variable design tokens, and the theming docs/theme-switcher demos have been removed.