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

@synerise/ds-factors

v0.27.3

Published

Factors UI Component for the Synerise Design System

Downloads

781

Readme


id: factors title: Factors

Factors UI Component

Installation

npm i @synerise/ds-factors
or
yarn add @synerise/ds-factors

Usage

import Factors from '@synerise/ds-factors'

<Factors
    selectedFactorType='text'
    setSelectedFactorType={(type) => {} }
    value='Value'
    onChangeValue={(value) => {}}
    textType='default'
    defaultFactorType='text'
    autocompleteText={{
      options: ['First name', 'Last name', 'City', 'Age', 'Points']
    }}
    unavailableFactorTypes={['number', 'formula']}
    parameters={{
      buttonLabel: 'Parameter',
      buttonIcon: <VarTypeStringM />,
      groups: [{
                  name: 'Recent',
                  id: 1,
                  allowEmpty: true,
                  defaultGroup: true,
                },{
                  name: 'All',
                  id: 2,
                  subGroups: [{
                    name: 'Attributes',
                    id: 3,
                    icon: <FolderM />
                  }],
      items: [{
                  id: 0,
                  name: 'First name',
                  groupId: 1,
                  icon: <VarTypeStringM />,
                },
                {
                  id: 1,
                  name: 'Last name',
                  groupId: 1,
                  icon: <VarTypeStringM />,
                },
                {
                  id: 2,
                  name: 'City',
                  groupId: 1,
                  icon: <VarTypeStringM />,
                },]
    }}
    withoutTypeSelector={false}
    formulaEditor={<div>Formula editor</div>}
    texts={{
        datePicker: {
            apply: 'Apply',
            clearTooltip: 'Clear',
            inputPlaceholder: 'Select date',
            now: 'Now',
          },
        dynamicKey: {
            keyPlaceholder: 'Key',
            valuePlaceholder: 'Value',
          },
        formula: {
            buttonPlaceholder: 'Define formula',
            defaultName: 'Formula'
          },
        parameter: {
            searchPlaceholder: 'Search',
            noResults: 'No results',
          },
        valuePlaceholder: 'Value',
        modalApply: 'Apply',
        modalCancel: 'Cancel',
        modalTitle: 'Value'
    }}
/>

Demo

API

| Property | Description | Type | Default | | --- | --- | --- | --- | | autocompleteText | Array of available autocomplete suggestions (only if textType is equal to autocomplete) | {options: string[]} | - | | availableFactorTypes | Array of available factor types | FactorType[] | - | | defaultFactorType | Default factor type | FactorType | - | | formulaEditor | Formula editor render in modal when factory type is equal to formula | React.ReactNode | - | | getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement \ null) => HTMLElement; | - | | onActivate | Callback called when user opens dropdown | (fieldType: string) => void | - | | onChangeValue | Callback called when user change value | (value: FactorValueType) => void | - | | onDeactivate | Callback called when user closes dropdown | () => void | - | | opened | Whether if dropdown should opens from outside of component | boolean | false | | parameters | Options for parameters list | ParameterOptions | - | | selectedFactorType | Selected factor type | FactorType | - | | setSelectedFactorType | Callback called when user selects factor type | (factor: FactorType) => void | - | | texts | Translations object | FactorsTexts | - | | textType | Variant of text type input (autocomplete \ expansible \ default ) | string | default | | unavailableFactorTypes | Array of excluded factor types | FactorType[] | - | | value | Value | FactorValueType | - | | withoutTypeSelector | Whether if hide factor type selector | boolean | - | | inputProps | Array of available props of input | InputProps | - |

FactorType

All available factor types: text, number, parameter, contextParameter, dynamicKey, formula, array, date,

FactorValueType

Type of value depends on current factor type and can contain values: string \ number \ Date \ undefined \ DynamicKeyValueType \ FormulaValueType \ ParameterValueType;

DynamicKeyValueType

{ key: React.ReactText; value: React.ReactText }

FormulaValueType

{ name: string; value: string }

ParameterValueType

{ type: string; icon: string; name: string; id: React.ReactText; }

ParameterOptions

| Property | Description | Type | Default | |-------------------------|------------------------------------------------------------|--------------------------|---------| | buttonIcon | Icon in button | React.ReactNode | - | | buttonLabel | Label of button | string \ React.ReactNode | - | | groups | Array of parameter groups | ParameterGroup[] | - | | items | Array of parameters | ParameterItem[] | - | | selectedButtonColored | Whether to use green custom color if parameter is selected | boolean | - | | maxSearchResultsInGroup | How many search results should be shown per group | number | 4 |