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

@8x8/oxygen-utils

v3.0.0

Published

Oxygen - Utils

Readme

8x8 Oxygen - Utilities

Map

Components

OutsideEventBehavior

Component wich will attach an onClick event listener to the window object. The function will be triggered everytime a click event target doesn't contain the children of OutsideEventBehavior.

import { OutsideEventBehavior } from '@8x8/oxygen-utils';

<OutsideEventBehavior onClick={this.handleClickOutside}>
  <div>Some random children</div>
</OutsideEventBehavior>;

In the example above, the function this.handleClickOutside will be triggered every time one executes a click outside <div>Some random children</div>.

Functions

Media

An object with media breakpoints helpers for styled-components. You can use media for max-width breakpoints or mediaMin for min-width rules.

// max-width breakpoint rule

import { media } from '@8x8/oxygen-utils';

const StyledDiv = styled.div`
  color: red;

  ${media.desktop`color: yellow;`}
  ${media.tablet`color: green;`}
  ${media.phone`color: blue;`}
`;

export default StyledDiv;
// min-width breakpoint rule

import { mediaMin } from '@8x8/oxygen-utils';

const StyledDiv = styled.div`
  color: red;

  ${mediaMin.desktop`color: yellow;`}
  ${mediaMin.tablet`color: green;`}
  ${mediaMin.phone`color: blue;`}
`;

export default StyledDiv;

Hooks

useFontSize

Transforms a rem into a px value based on the root html font-size property. This allows access to the actual value in JS.

If you need a dimension in px that relates to font-size values, use this hook which takes the user's font-size preferences into account.

import { useFontSize } from '@8x8/oxygen-utils';

const Component = () => {
  const height = useFontSize(1.5); // 1.5rem => 24px with default font-size
  return (
    <div style={{ ${height}px }}>I have 1.5rem as height set from JS</div>
  );
}

useHasOverflow

Detects whether the given element has overflowed its content. Useful for detentcting whether a container has truncated its text with an ellipsis.

useId

Generates a stable id via uuid. Once React 18 is used, this can be replaced with the official react useId hook https://react.dev/reference/react/useId

Useful to generate unique id's for form & accesibility purposes (to link elements together).

import { useId } from '@8x8/oxygen-utils';

const Component = () => {
  const id = useId();
  return (
    <label htmlFor={id}>Label</label>
    <input id={id} />
  );
}

useAriaLive

Manages screen reader announcements with automatic DOM injection. Messages are announced to screen readers without requiring any JSX components to be rendered.

Creates aria-live containers on-demand when messages are announced, ensuring screen readers can properly register them. Messages are announced via direct DOM manipulation for reliable screen reader detection.

import { useAriaLive } from '@8x8/oxygen-utils';

const Component = () => {
  const { announce } = useAriaLive();

  const handleSave = () => {
    // ... save logic
    announce('Item saved successfully');
  };

  const handleError = () => {
    // ... error handling
    announce('Connection failed!', { assertive: true });
  };

  return (
    <div>
      <button onClick={handleSave}>Save</button>
      <button onClick={handleError}>Trigger Error</button>
    </div>
  );
};

API

useAriaLive(): { announce: (message: string, options?: { assertive?: boolean }) => void }

  • announce(message, options?): Announces a message to screen readers
    • message (string): The message to announce
    • options.assertive (boolean, optional): Use assertive priority for urgent announcements that interrupt current speech. Defaults to false (polite)