New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

operand-js

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

operand-js

A component library for the Operand API.

  • 0.1.73
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Operand-JS

A component library for the Operand API.

Install Operand-JS

npm i operand-js

Install our npm package that contains our component.

Get SetIDs

Note: Skip this step if you are a ‘managed’ user. We will send you everything you need.

You will need to specify which document sets you want to search over via their setID. You can find this by making an API request as detailed here in our documentation or by getting it from the URL in your dashboard.

You can list any number of document sets to be searched over in a given search component.

Setup an API Key

Note: Skip this step if you are a ‘managed’ user. We will send you everything you need.

Because this API key will be exposed client side we strongly recommend setting very specific scopes. For the Operand-JS to work at its most basic functionality is only requires the “search” scope on the setIDs that are specified in the component. If you want feedback functionality an additional feedback scope is required on those same sets.

Scopes are specified as “’scope’:’setid’” in a comma separated list during API Key creation.

Adding the Component

First you need to import the component into your project.

import { SearchBar } from 'operand-js';

Then you will create the component by providing the necessary properties.

<SearchBar apiKey="Your APIKey" setIDs={['String Array of Document Set IDs']}>
  {'At Least One Child'}
</SearchBar>

Required Properties

NameTypePurpose
apiKeystringAccess to Operand API
setIDSstring[]Sets to search over with Operand API
childrenReact.ReactNodeRendering the search component. It will not render itself without a child.

For your child we recommend rendering a fake search bar or just a search icon. It will be clickable to open the search modal.

Optional Properties

<SearchBar
  apiKey="Your APIKey"
  setIDs={['String Array of Document Set IDs']}
  placeholderText="Text you want shown in modal input"
  feedback={true}
  keyboardShortcut="A keyboard shortcut to open the modal"
>
  {'At Least One Child'}
</SearchBar>
NameTypePurpose
placeholderTextstringCustomize the input bar in the modal
feedbackbooleanSends us anonymous feedback about what results were clicked and helps improve your search.
keyboardShortcutstringUses the react-hotkeys-hook package. See this section for how to define a shortcut.

For the keyboardShortcut an example is “ctrl+k”.

Component Styling

Currently there is no custom styling for the component and we used tailwind to style the component.

Non-Tailwind Projects:

We have provided a minified tailwind.css file that can be imported to style the component for non-tailwind projects.

import 'operand-js/dist/tailwind.css';

Tailwind Projects:

Projects with tailwind must simply include the node-module in the contents section of ‘tailwind.config.js’.

module.exports = {
  content: [
		....
    "./node_modules/operand-js/dist/*.js",
  ],
	....
}

Questions?

Send us a message at support@operand.ai.

Keywords

FAQs

Package last updated on 14 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc