npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wix/react-component-utils

v1.9.0

Published

Utilities for Wix React components: defaults for manifests and runtime props.

Readme

@wix/react-component-utils

Runtime helpers and small utilities for Wix React components: merging manifests defaults into props at runtime, applying defaults onto extracted editor manifest payloads, accessibility field normalization, and a generic recursive merge.

Install

Peers: react ^18 or ^19.

yarn add @wix/react-component-utils

Public API

| Export | Role | |--------|------| | withDefaults | Higher-order component: merges default props into runtime props (fills missing values). | | withEditorElementDefaults | Copies an editor manifest element and injects default structure (data, nested elements with props). Manifest-specific rules, not a generic deep merge. | | withFallbackPlaceholder | Higher-order component: renders a placeholder when required data fields are missing, and an error placeholder when the wrapped component throws. | | merge | Recursive merge into the first argument (mutates target, returns it). Plain objects ({}, Object.create(null) lineage) and arrays merge by index; undefined in sources does not clear existing keys on target. | | convertA11yKeysToHtmlFormat | Maps accessibility shapes into HTML-oriented records (see a11y implementation). | | useStableId | Returns a stable id for ARIA wiring and form labels. Uses React.useId on React 18+; falls back to a post-mount counter on React 17. | | DefaultsError / DefaultsErrorPhase | Typed errors when default merging fails; callers fall back to the original props or manifest fragment. |

useStableId

import { useStableId } from '@wix/react-component-utils'

export function FormField({ id, label, value, onChange }: Props) {
  const inputId = useStableId(id)
  return (
    <>
      <label htmlFor={inputId}>{label}</label>
      <input id={inputId} value={value} onChange={onChange} />
    </>
  )
}

Pass id from props when the caller supplies one (it wins verbatim); the hook generates one otherwise.

SSR caveat (React 17 only): React 17 has no useId, so the fallback generates the id in a post-mount effect — useStableId() returns '' during SSR and a real id after hydration. If the id must be present in the server-rendered HTML (e.g. ARIA wiring on a statically rendered page), pass an overrideId from the caller. On React 18+ the hook delegates to React.useId and is fully SSR-stable.

merge vs withEditorElementDefaults

Use merge when you want ordinary recursive merging of plain data structures into an existing object.

Use withEditorElementDefaults only for editor manifest payloads: it skips keys such as elements.props when applying data, only fills defaultValue where appropriate, and only walks nested inlineElement / refElement branches.

Layout

  • src/defaults/ — manifest + runtime default helpers
  • src/merge/merge implementation
  • src/utils/ — internal helpers shared by merge and defaults
  • src/a11y/ — accessibility helpers
  • src/fallback-placeholder/withFallbackPlaceholder HOC and placeholder UI

Development

From repo root (see AGENTS.md):

yarn workspace @wix/react-component-utils build
yarn workspace @wix/react-component-utils test
yarn workspace @wix/react-component-utils lint