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

@npm-questionpro/global-features

v1.0.0

Published

Reusable global features and components for QuestionPro applications

Downloads

121

Readme

@npm-questionpro/global-features

Reusable global features and components for QuestionPro applications.

Installation

npm install @npm-questionpro/global-features

Peer Dependencies

This package relies on your project's React installation.

  • React: >=18.0.0 <20.0.0
  • React DOM: >=18.0.0 <20.0.0

As peer dependencies, React and React DOM are not bundled with this package; your app's versions are used.

Usage

Import CSS

Important: You must import the CSS file in your application's entry point (e.g., main.tsx or index.tsx):

import '@npm-questionpro/global-features/lib/styles/global-features.css'

Basic Usage

import {GlobalDataSearch} from '@npm-questionpro/global-features'
import type {ISearchItem} from '@npm-questionpro/global-features'

const MyComponent = () => {
  const [items, setItems] = useState<ISearchItem[]>([])
  const [isLoading, setIsLoading] = useState(false)

  useEffect(() => {
    setIsLoading(true)
    fetchSearchData().then(data => {
      setItems(data)
      setIsLoading(false)
    })
  }, [])

  const handleItemClick = (item: ISearchItem) => {
    console.log('Clicked:', item)
  }

  return (
    <GlobalDataSearch
      items={items}
      isLoading={isLoading}
      onItemClick={handleItemClick}
    />
  )
}

Custom Icons

import {GlobalDataSearch} from '@npm-questionpro/global-features'
import {WuIcon} from '@npm-questionpro/wick-ui-lib'
;<GlobalDataSearch
  items={items}
  isLoading={isLoading}
  onItemClick={handleItemClick}
  searchIcon={<WuIcon icon="wm-search" style={{fontSize: '18px'}} />}
/>

Props

GlobalDataSearch

| Prop | Type | Required | Default | Description | | ----------------- | ----------------------------- | -------- | ------------------------------------- | ----------------------------- | | items | ISearchItem[] | Yes | - | Array of search items | | isLoading | boolean | No | false | Loading state | | placeholder | string | No | 'Search surveys, folders, or tools' | Input placeholder | | noResultsText | string | No | 'No results found' | No results message | | topItemsCount | number | No | 3 | Recent items count when empty | | onItemClick | (item: ISearchItem) => void | Yes | - | Item click handler | | onSearch | (query: string) => void | No | - | Query change handler | | onClear | () => void | No | - | Clear handler | | onFocus | () => void | No | - | Focus handler | | onClose | () => void | No | - | Close handler | | onExpand | () => void | No | - | Expand handler | | onCollapse | () => void | No | - | Collapse handler | | defaultExpanded | boolean | No | false | Initially expanded | | searchIcon | React.ReactNode | No | - | Custom search icon |

ISearchItem

interface ISearchItem {
  id: string | number
  label: string
  category: string
  actionURL?: string
  lastEditTimeStamp?: number
  icon?: string
}

Features

  • Collapsible search with toggle icon
  • Expand/collapse animations
  • Live filtering
  • Grouped results by category
  • Click outside to close
  • Customizable icons

Accessibility & Behavior

Keyboard Support

  • Toggle button: Responds to Enter and Space keys to expand/collapse
  • Clear button: Responds to Enter and Space keys to clear the search query
  • Input focus: Automatically focuses the search input when expanded

ARIA Labels

The component includes comprehensive ARIA labels for screen readers:

  • app header search - Main container
  • toggle search - Toggle button to expand/collapse search
  • search input - Search input field
  • search results - Dropdown container with search results
  • clear search - Clear/close icon button
  • search icon - Search icon (decorative)

Roles

  • Toggle button: role="button" with tabIndex={0}
  • Clear button: role="button" with tabIndex={0}
  • Search icon: role="img"

Behavior

  • Dropdown visibility: Shown only when isExpanded && isFocused && !isLoading
  • Expand/Collapse callbacks: onExpand and onCollapse fire after animation transitions (150ms)
  • Top items: When search is empty, shows top topItemsCount items sorted by lastEditTimeStamp (descending)
  • Item filtering: Items without lastEditTimeStamp are excluded from top items display
  • Click outside: Automatically collapses when clicking outside the component

Packaging Notes

Only compiled outputs (lib/**/*), README.md, and package.json are published. Source, tests, and configs are excluded.

License

ISC