{"_id":"@algolia/instantsearch-widget-sortby-ul","_rev":"36-feea8026b49469f9e22babde2fc7c087","name":"@algolia/instantsearch-widget-sortby-ul","dist-tags":{"latest":"1.1.0"},"versions":{"1.1.0":{"name":"@algolia/instantsearch-widget-sortby-ul","version":"1.1.0","keywords":["instantsearch-widget","instantsearch","instantsearch-widget-sortby-ul","widget","connector","algolia"],"license":"MIT","_id":"@algolia/instantsearch-widget-sortby-ul@1.1.0","maintainers":[{"name":"fabienmotte","email":"contact@fabienmotte.com"},{"name":"leodau","email":"bluedraggy@gmail.com"},{"name":"alphonseb","email":"alphonse.bouy@gmail.com"},{"name":"svensoldin","email":"soldinsven@gmail.com"},{"name":"loicsay","email":"loic.say@algolia.com"},{"name":"tomklotz","email":"tomklotz.pro@gmail.com"},{"name":"praagyajoshi","email":"praagya.joshi@gmail.com"},{"name":"shortcuts","email":"clement.vannicatte@algolia.com"},{"name":"plnech","email":"dev@plnech.fr"},{"name":"rasemotte","email":"claire.helme-guizon@algolia.com"},{"name":"thomaslef","email":"thomas.lefevre@algolia.com"},{"name":"lukyvj","email":"lucas.bonomi@gmail.com"},{"name":"sepehrf","email":"sepehr9f@gmail.com"},{"name":"kosai106","email":"kevin@oesterkilde.dk"},{"name":"marielaure","email":"marie-laure.sin@algolia.com"},{"name":"redox","email":"sylvain.utard@gmail.com"},{"name":"mthuret","email":"mlthutrix@gmail.com"},{"name":"haroenv","email":"hello@haroen.me"},{"name":"rayrutjes","email":"raymond.rutjes@gmail.com"},{"name":"speedblue","email":"support@algolia.com"},{"name":"jerska","email":"matthieu.dumont@algolia.com"},{"name":"raphi","email":"raphael.daguenet@algolia.com"},{"name":"cbaptiste","email":"coquellebaptiste@gmail.com"},{"name":"ronanlevesque","email":"ronan.levesque@gmail.com"},{"name":"samouss","email":"samuel.vllnt@gmail.com"},{"name":"therealwebby","email":"alex@alexjwebb.com"},{"name":"francoischalifour","email":"francois.chalifour@gmail.com"},{"name":"jonmontane","email":"jon@stratus.one"},{"name":"mikaa123","email":"misokol123@gmail.com"},{"name":"valentindotxyz","email":"valentin@hey.com"},{"name":"shipow","email":"shipowlata@gmail.com"},{"name":"tkrugg","email":"contact@ymammar.com"},{"name":"seafoox","email":"seafoox@gmail.com"},{"name":"sylvainh","email":"sylvain.huprelle@algolia.com"},{"name":"clemfromspace","email":"clement.denoix@algolia.com"},{"name":"lorrissaintgenez","email":"lorris.saint-genez@algolia.com"},{"name":"broujo","email":"johann.broudin@gmail.com"},{"name":"marieglr","email":"marie.gillier@algolia.com"},{"name":"e-krebs","email":"emmanuel.krebs@algolia.com"},{"name":"eunjae-lee","email":"karis612@gmail.com"},{"name":"kombucha","email":"vincentlemeunier+npm@gmail.com"},{"name":"h1fra","email":"bodin.samuel@gmail.com"},{"name":"sylvain","email":"sylvain.bellone@gmail.com"},{"name":"crawler-team","email":"support+crawler@algolia.com"},{"name":"amcdaid106","email":"aoife.mcdaid@gmail.com"},{"name":"devinalgolia","email":"devin@algolia.com"},{"name":"dispix","email":"me@dispix.net"},{"name":"jvenezia","email":"veneziajeremy@gmail.com"},{"name":"otomatik","email":"thomas.dalous@gmail.com"},{"name":"julienbourdeau","email":"julien@sigerr.ch"},{"name":"sophiem03","email":"manley.sophie@gmail.com"},{"name":"mschreiber","email":"meschreiber3@gmail.com"},{"name":"sarahdayan","email":"hello@sarahdayan.com"},{"name":"alexandremeunier","email":"alexandre.meunier@gmail.com"},{"name":"dcoates","email":"dustin@dcoates.com"},{"name":"maximehuang","email":"maxime.huang@algolia.com"},{"name":"netgusto","email":"mail@jeromeschneider.fr"},{"name":"guitek","email":"guillaume.truchot@algolia.com"},{"name":"matthewbond","email":"matthew.bond@algolia.com"},{"name":"cyril.descossy","email":"cyril.descossy@algolia.com"},{"name":"tatsuro","email":"tatsuro.handa@algolia.com"},{"name":"danajeremy","email":"jeremy.dana@orange.fr"},{"name":"mathougui","email":"guillaume.dessain@algolia.com"},{"name":"xavdh","email":"xav.dhalluin@gmail.com"},{"name":"agdavid","email":"antonio.g.david@gmail.com"},{"name":"charbell","email":"charlesbellorini@gmail.com"}],"dist":{"shasum":"24a4603ceb19c8b0de7fd625032de03b9a442fb7","tarball":"https://registry.npmjs.org/@algolia/instantsearch-widget-sortby-ul/-/instantsearch-widget-sortby-ul-1.1.0.tgz","fileCount":25,"integrity":"sha512-wgd2Dz3Ca3a+/vFHhbV9grgIoCGYhVGJzl+OMmlOVQPh0V6UiARBspDPyjb5rS1Uq30HeB6dCdVvelOuggKhrQ==","signatures":[{"sig":"MEYCIQCRFZVyViPSrbSWK0YOL/K71zdwd6zuOYahzS/1cbLLvQIhAJgwkvqx4BAYeG5wrV0ssdD0vnCInaLweKo/8g7MtNDS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":112281,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3tnlCRA9TVsSAnZWagAAxR4P/RXRperVRBA7p1+WUJVt\ndmB3abphcrFjoJpiveG0rJkjiVsI4jlhHYTyIbt8PPmtczaYA0w6pjNry18A\nLZr30Q/QhlNDvm1yeTsu+pQnlXM7f2TLSZ3bNOwqd4CaudIqRX1/xaPmgz+d\n1HMsN1iF1TbcjlSXKnYQIBtnI0kUu1+7Cr48BmfQqonEJ1CgdKCtBvmQ54Xt\nI4GStGkxFX94nTlF+16Kt4tAHO+XFj9wMLPUWzdkfq7B7r4WWRz4qbDExs9i\nJ8evzyY+zXakK5nVWfohC0JE8monk7WsrLu1AhDzuE5AQcDwN32gpwdZEhkV\nluAv41XBm3ajoohzYydp+oR7WK03eFCWsrZYlosiup7UXT06lNLCLaFJ91RT\n5q5JbcmW70YEr9//IMYn9YjUUi4s5WuBvWI/2Rbkf6nZYOIgynsQdeoK4cpw\ndnEc/a/IzPcyOcwptJBhp4sqzE2SLv2UsqEJKQYMFp+8rJzNANg9znjA1s2K\nf5+aNTgj+Bk+EjCALtPSCNnJ4UEPuFSthK6a0y+UACtIsAAeAn9v+hovzBU5\nZ1UxzANLdSFq6D9/i4p/OGCtZqQ/2TYL+YzAK69KzsQIjyQW3JOCG3N2BAF3\nP5NgMYmFEO9gL4uQJHCIi446XwLvQBNhlAnYTY/DX17tXiC9m7cyaJx9di8q\nnMa2\r\n=h+YF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/cjs/index.js","type":"module","types":"./dist/esm/index.d.ts","unpkg":"./dist/umd/index.js","module":"./dist/esm/index.js","exports":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"},"gitHead":"ba28f837e6fed22d30d6e067e1edbc55f1c55bec","scripts":{"lint":"eslint --ext .js,.ts .","test":"npm run lint && npm run test:types && npm run test:unit","build":"npm run build:umd && npm run build:cjs && npm run build:esm && npm run build:types","start":"parcel example/index.html","release":"standard-version","prebuild":"rm -rf dist","build:cjs":"BABEL_ENV=cjs babel src --extensions '.js,.ts' --out-dir dist/cjs --ignore '**/__tests__' --source-maps && BABEL_ENV=cjs babel src/index.ts --out-file dist/cjs/index.js --source-maps","build:esm":"BABEL_ENV=esm babel src --extensions '.js,.ts' --out-dir dist/esm --ignore '**/__tests__' --source-maps","build:umd":"parcel build src/index.ts --global sortBy --out-dir dist/umd --out-file index.js --experimental-scope-hoisting","test:unit":"jest","prerelease":"npm run build","test:types":"tsc","build:types":"tsc --build tsconfig.declaration.json"},"_npmUser":{"name":"eunjae-lee","email":"karis612@gmail.com"},"jsdelivr":"./dist/umd/index.js","_npmVersion":"6.14.8","description":"InstantSearch widget that makes a sort-by","directories":{},"_nodeVersion":"12.19.0","browserslist":["last 2 chrome versions","last 2 firefox versions","last 2 edge versions","last 2 safari versions","IE 11"],"_hasShrinkwrap":false,"devDependencies":{"jest":"26.6.3","eslint":"7.21.0","ts-node":"9.1.1","prettier":"2.2.1","@babel/cli":"7.13.10","babel-jest":"26.6.3","typescript":"4.2.2","@babel/core":"7.13.10","@types/node":"14.14.31","@types/react":"17.0.2","algoliasearch":"4.9.3","parcel-bundler":"1.12.5","@types/react-dom":"17.0.1","instantsearch.js":"4.24.0-experimental-typescript.0","standard-version":"9.3.0","@babel/preset-env":"7.13.8","eslint-plugin-jest":"24.1.5","eslint-plugin-jsdoc":"32.2.0","@babel/eslint-parser":"7.13.8","@testing-library/dom":"7.30.0","algoliasearch-helper":"3.4.4","eslint-plugin-import":"2.22.1","eslint-config-algolia":"18.0.0","eslint-config-prettier":"8.1.0","eslint-plugin-prettier":"3.3.1","@babel/preset-typescript":"7.13.0","@testing-library/jest-dom":"5.11.9","@typescript-eslint/parser":"4.16.1","eslint-plugin-eslint-comments":"3.2.0","@typescript-eslint/eslint-plugin":"4.16.1","babel-plugin-add-import-extension":"1.5.0"},"peerDependencies":{"instantsearch.js":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/instantsearch-widget-sortby-ul_1.1.0_1625217508956_0.26675960355170636","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-07-02T09:18:28.739Z","modified":"2026-09-29T12:25:16.081Z","1.1.0":"2021-07-02T09:18:29.121Z"},"license":"MIT","keywords":["instantsearch-widget","instantsearch","instantsearch-widget-sortby-ul","widget","connector","algolia"],"description":"InstantSearch widget that makes a sort-by","maintainers":[{"email":"hello@haroen.me","name":"haroenv"},{"email":"jason@thevagabond.net","name":"jasonberry"},{"email":"instantsearch-bot@algolia.com","name":"instantsearch-bot"},{"email":"dhaya.benmessaoud@algolia.com","name":"dhaya.b"},{"email":"contact@fabienmotte.com","name":"fabienmotte"},{"email":"anjola.adeuyi@algolia.com","name":"anjola-algolia"}],"readme":"<p align=\"left\">\n  <a href=\"https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/\">\n    <img alt=\"InstantSearch.js\" src=\"https://i.ibb.co/60fJjFy/Widget-banner-tmp.png\">\n  </a>\n</p>\n\n[InstantSearch.js widget](https://www.algolia.com/?utm_source=instantsearch.js&utm_campaign=repository) displaying a list of indices, allowing a user to change the way hits are sorted. Equivalent of the offcial [sortby widget](https://www.algolia.com/doc/api-reference/widgets/sort-by/js/) using `<ul><li>` markups instead of `<select>`.\n\n---\n\n[![MIT](https://img.shields.io/npm/l/@algolia/instantsearch-widget-sortby-ul)](./LICENSE) [![NPM version](http://img.shields.io/npm/v/@algolia/instantsearch-widget-sortby-ul.svg)](https://npmjs.org/package/@algolia/instantsearch-widget-sortby-ul)\n\n## Summary\n\n- [Demo](#demo)\n- [Installation](#install)\n- [Usage](#usage)\n- [Options](#options)\n- [Browser Support](#browser-support)\n- [Troubleshooting](#Troubleshooting)\n- [Contributing & Licence](#contributing--licence)\n\n# Get started\n\n## Demo\n\n[Demo](https://codesandbox.io/s/quizzical-lalande-fhjgw) on CodeSandbox.\n\n## Install\n\n```bash\nnpm install @algolia/instantsearch-widget-sortby-ul\n# or\nyarn add @algolia/instantsearch-widget-sortby-ul\n```\n\n## Usage\n\n```js\nimport instantsearch from 'instantsearch.js';\nimport algoliasearch from 'algoliasearch/lite';\nimport { sortBy } from '@algolia/instantsearch-widget-sortby-ul';\n\nconst searchClient = algoliasearch('appId', 'apiKey');\n\nconst search = instantsearch({\n  indexName: 'indexName',\n  searchClient,\n});\n\nsearch.addWidgets([\n  sortBy({\n    container: '#sort-by' // or document.querySelector('#sort-by')\n    items: [\n      { value: 'instant_search', label: 'Most relevant' },\n      { value: 'instant_search_price_asc', label: 'Lowest price' },\n      { value: 'instant_search_price_desc', label: 'Highest price' },\n    ],\n  }),\n]);\n\nsearch.start();\n```\n\n### Options\n\n| Option | Type | Required | Default | Description |\n| :-- | :-- | :-- | :-- | --- |\n| [`container`](#container) | `string` or `HTMLElement` | true | - | The element to insert the widget into. |\n| [`items`](#items) | `object[]` | true | - | The list of indices to search in. |\n| [` cssClasses`](#cssclasses) | `object` | false | {} | The CSS classes to override. |\n| [` transformItems`](#transformitems) | `function` | false | items => items | Receives the items, and is called before displaying them. |\n\n#### container\n\n> `string | HTMLElement` | **required**\n\nThe element to insert the widget into.\n\nThis can be either a valid CSS Selector:\n\n```js\nsortBy({\n  container: '#sort-by',\n  // ...\n});\n```\n\nor an `HTMLElement`:\n\n```js\nsortBy({\n  container: document.querySelector('#sort-by'),\n  // ...\n});\n```\n\n#### items\n\n> `object[]` | **required**\n\nThe list of indices to search in, with each item:\n\n- `label: string`: the label of the index to display.\n- `value: string`: the name of the index to target.\n\n```js\nsortBy({\n  items: [\n    { label: 'Featured', value: 'instant_search' },\n    { label: 'Price (asc)', value: 'instant_search_price_asc' },\n    { label: 'Price (desc)', value: 'instant_search_price_desc' },\n  ],\n  // ...\n});\n```\n\n#### cssClasses\n\n> `object` | **optional**\n\nThe CSS classes to override.\n\n- `root`: the root element of the widget.\n- `list`: the `<ul>` element.\n- `item`: each `<li>` element.\n\n```js\nsortBy({\n  // ...\n  cssClasses: {\n    root: 'MyCustomSortByUL',\n    list: 'MyCustomSortByUL MyCustomSortByUL--subclass',\n  },\n});\n```\n\n#### transformItems\n\n> `function` | **optional**\n\nReceives the items, and is called before displaying them. Should return a new array with the same shape as the original array. Useful for mapping over the items to transform, and remove or reorder them.\n\n```js\nsortBy({\n  // ...\n  transformItems(items) {\n    return items.map(item => ({\n      ...item,\n      label: item.label.toUpperCase(),\n    }));\n  },\n});\n```\n\n## Browser support\n\nSame as InstantSearch.js it supports the **last two versions of major browsers** (Chrome, Edge, Firefox, Safari).\n\nPlease refer to the [browser support](https://www.algolia.com/doc/guides/building-search-ui/installation/js/#browser-support) section in the documentation to use InstantSearch.js and this widget on other browsers.\n\n## Troubleshooting\n\nEncountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/guides/building-search-ui/troubleshooting/faq/js/) where you will find answers for the most common issues and gotchas with the library.\n\n## Contributing & Licence\n\n### How to contribute\n\nWe welcome all contributors, from casual to regular 💙\n\n- **Bug report**. Is something not working as expected? [Send a bug report](https://github.com/algolia/js-sort-by/issues/new?template=Bug_report.md).\n- **Feature request**. Would you like to add something to the library? [Send a feature request](https://github.com/algolia/js-sort-by/issues/new?template=Feature_request.md).\n- **Documentation**. Did you find a typo in the doc? [Open an issue](https://github.com/algolia/js-sort-by/issues/new) and we'll take care of it.\n- **Development**. If you don't know where to start, you can check the open issues that are [tagged easy](https://github.com/algolia/js-sort-by/issues?q=is%3Aopen+is%3Aissue+label%3A%22Difficulty%3A++++++%E2%9D%84%EF%B8%8F+easy%22), the [bugs](https://github.com/algolia/js-sort-by/issues?q=is%3Aissue+is%3Aopen+label%3A%22%E2%9D%A4+Bug%22) or [chores](https://github.com/algolia/js-sort-by/issues?q=is%3Aissue+is%3Aopen+label%3A%22%E2%9C%A8+Chore%22).\n\nTo start contributing to code, you need to:\n\n1.  [Fork the project](https://help.github.com/articles/fork-a-repo/)\n1.  [Clone the repository](https://help.github.com/articles/cloning-a-repository/)\n1.  Install the dependencies: `yarn`\n1.  Run the development mode: `yarn start`\n1.  [Open the stories](http://localhost:3000)\n\nPlease read [our contribution process](CONTRIBUTING.md) to learn more.\n\n### Licence\nLicensed under the MIT license.\n\n---\n\n**About InstantSearch.js**\n\nInstantSearch.js is a vanilla JavaScript library that lets you create an instant-search result experience using [Algolia][algolia-website]’s search API. It is part of the InstantSearch family:\n\n**InstantSearch.js** | [React InstantSearch][react-instantsearch-github] | [Vue InstantSearch][vue-instantsearch-github] | [Angular InstantSearch][instantsearch-angular-github] | [React InstantSearch Native][react-instantsearch-github] | [InstantSearch Android][instantsearch-android-github] | [InstantSearch iOS][instantsearch-ios-github]\n\nThis project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com).\n\n<!-- Links -->\n\n[algolia-website]: https://www.algolia.com/?utm_source=instantsearch.js-widget&utm_campaign=repository\n[react-instantsearch-github]: https://github.com/algolia/react-instantsearch/\n[vue-instantsearch-github]: https://github.com/algolia/vue-instantsearch\n[instantsearch-android-github]: https://github.com/algolia/instantsearch-android\n[instantsearch-ios-github]: https://github.com/algolia/instantsearch-ios\n[instantsearch-angular-github]: https://github.com/algolia/angular-instantsearch\n","readmeFilename":"README.md"}