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 🙏

© 2024 – Pkg Stats / Ryan Hefner

scrivito-icon-editor

v0.0.2

Published

The `scrivito-icon-editor` is a versatile icon picker designed for seamless integration with [Scrivito](https://www.scrivito.com) and React applications. It supports [Bootstrap Icons](https://icons.getbootstrap.com) out of the box but can work with any ic

Downloads

434

Readme

Scrivito Icon Editor

The scrivito-icon-editor is a versatile icon picker designed for seamless integration with Scrivito and React applications. It supports Bootstrap Icons out of the box but can work with any icon set. Easily integrate it into your projects to add icons with custom styling and functionality.

Installation

npm install scrivito-icon-editor

Usage

Bootstrap Icons in a Scrivito application

// IconWidgetEditingConfig.ts
import { ScrivitoBootstrapIconEditor } from 'scrivito-icon-editor'

provideEditingConfig(IconWidget, {
  propertiesGroups: [
    {
      component: ScrivitoBootstrapIconEditor,
      key: 'icon-group',
      properties: ['icon'],
      title: 'Icon',
    },
  ],
})

Importing styles

The ScrivitoBootstrapIconEditor includes built-in styles for easy integration. To apply these styles, import the following CSS files in your project:

// scrivitoExtensions.scss
@import 'bootstrap-icons/font/bootstrap-icons.css';
@import 'scrivito-icon-editor/ScrivitoIconEditor.css';

Using the icon editor with options

// defaultPageEditingConfig.tsx
import { ScrivitoBootstrapIconEditor } from 'scrivito-icon-editor'

export const defaultPagePropertiesGroups = [
  {
    component: (props: { page: Obj }) => (
      <ScrivitoBootstrapIconEditor
        attribute="linkIcon"
        description="This icon may appear in a vertical navigation widget, for example."
        showClearButton
        {...props}
      />
    ),
    key: 'icon-group',
    properties: ['linkIcon'],
    title: 'Icon',
  },
]

Available options

  • attribute: (string) The attribute where the icon is stored. Default: icon
  • defaultValue: (string) The fallback icon displayed when no icon is set. When this option is enabled, the clear button is disabled. Default: undefined
  • description: (string) A description for the icon picker field.
  • obj: (Obj) The CMS object where the icon attribute is stored.
  • page: (Obj) The page where the icon attribute is stored.
  • previewTitle: (string) Title of the icon preview element. Default: Preview
  • searchLabel: (string) Accessibility label for icon search inputs. Default: Search
  • showClearButton: (boolean) If true, shows a button to clear the selected icon. Default: false
  • widget: (Widget) The widget where the icon attribute is stored.

Standalone Bootstrap icon picker

The Bootstrap icon picker features built-in support for Bootstrap Icons, making it easy to integrate into your React application. To customize its appearance, simply include the necessary CSS in your project. This allows you to quickly enhance your app with the rich selection of Bootstrap Icons available while tailoring the design to fit your app’s aesthetic.

import 'bootstrap-icons/font/bootstrap-icons.css'
import { BootstrapIconPicker } from 'scrivito-icon-editor'

function BoostrapIconPickerDemo() {
  const [icon, setIcon] = useState<string | undefined>('rocket-takeoff')
  return (
    <BootstrapIconPicker
      disabled={false}
      onChange={setIcon}
      showClearButton
      value={icon}
    />
  )
}

Available options

  • defaultValue: (string) The fallback icon displayed when no icon is set. When this option is enabled, the clear button is disabled. Default: undefined
  • disabled: (boolean) Disables the icon picker if set to true. Default: false
  • onChange: (function) A callback function triggered when the selected icon changes. Receives the new icon as an argument.
  • searchLabel: (string) Accessibility label for icon search inputs. Default: Search
  • showClearButton: (boolean) If true, shows a button to clear the selected icon. Default: false
  • value: (string | undefined) The currently selected icon.

Standalone generic icon picker

The generic icon picker is designed to work seamlessly with any React application and any icon set, providing you with the flexibility to choose icons that best suit your project’s needs. For optimal styling, ensure to include the relevant CSS to adjust the picker’s appearance according to your design requirements.

import { IconPicker } from 'scrivito-icon-editor'

function IconPickerDemo() {
  const [icon, setIcon] = useState<string | undefined>('rocket')
  return (
    <IconPicker
      disabled={false}
      icons={['face-laugh', 'heart', 'rocket', 'thumbs-up']}
      onChange={setIcon}
      renderFunc={(icon) => <i className={`fa-solid fa-${icon}`} />}
      showClearButton
      value={icon}
    />
  )
}

Available options

  • defaultValue: (string) The fallback icon displayed when no icon is set. When this option is enabled, the clear button is disabled. Default: undefined
  • disabled: (boolean) Disables the icon picker if set to true. Default: false
  • icons: (string[]) An array of available icons to pick from.
  • onChange: (function) A callback function triggered when the selected icon changes. Receives the new icon as an argument.
  • renderFunc: (function) A custom render function to display an icon.
  • searchLabel: (string) Accessibility label for icon search inputs. Default: Search
  • showClearButton: (boolean) If true, shows a button to clear the selected icon. Default: false
  • value: (string | undefined) The currently selected icon.

License

This project is licensed under the MIT License.