{"name":"svelte-select","version":"5.3.0-beta.7","repository":{"type":"git","url":"git+https://rob-balfre@github.com/rob-balfre/svelte-select.git"},"description":"A <Select> component for Svelte apps","scripts":{"dev":"vite dev","build":"vite build","preview":"vite preview","test":"npm run test:dev & npm run test:browser","test:dev":"rollup -cw","test:browser":"sirv test/public -p 3000 --dev --open","gen:docs":"node docs/generate_theming_variables_md.cjs","preprepare":"node src/remove-styles.cjs && npm run gen:docs","prepare":"svelte-package","clean":"node src/post-prepare.cjs","release":"release-it --preRelease=beta"},"devDependencies":{"@rollup/plugin-alias":"^4.0.3","@sveltejs/adapter-auto":"2.0.0","@sveltejs/adapter-static":"2.0.1","@sveltejs/kit":"1.7.2","@sveltejs/package":"^2.0.1","autoprefixer":"^10.4.13","cross-env":"^7.0.3","find-in-files":"^0.5.0","fuse.js":"^6.6.2","prettier":"~2.8.4","prettier-plugin-svelte":"^2.9.0","release-it":"^15.6.0","rollup":"^3.17.1","rollup-plugin-cleaner":"^1.0.0","rollup-plugin-css-only":"^4.3.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-postcss":"^4.0.2","rollup-plugin-replace":"^2.2.0","rollup-plugin-svelte":"^7.1.3","sirv-cli":"^2.0.2","svelte-highlight":"^7.2.0","svelte-preprocess":"^5.0.1","svelte-tiny-virtual-list":"^2.0.5","svelte2tsx":"^0.6.1","tape-modern":"^1.1.2","typescript":"^4.9.5","vite":"^4.1.2"},"author":{"name":"Robert Balfré","email":"rob.balfre@gmail.com","url":"https://github.com/rob-balfre"},"license":"ISC","keywords":["svelte"],"release-it":{"hooks":{"after:bump":"npm run prepare","after:git:release":"npm run clean"},"github":{"release":false}},"type":"module","dependencies":{"@floating-ui/dom":"^1.2.1","svelte":"^3.55.1","svelte-floating-ui":"1.2.8"},"exports":{"./ChevronIcon.svelte":{"types":"./dist/ChevronIcon.svelte.d.ts","svelte":"./dist/ChevronIcon.svelte","default":"./dist/ChevronIcon.svelte"},"./ClearIcon.svelte":{"types":"./dist/ClearIcon.svelte.d.ts","svelte":"./dist/ClearIcon.svelte","default":"./dist/ClearIcon.svelte"},"./LoadingIcon.svelte":{"types":"./dist/LoadingIcon.svelte.d.ts","svelte":"./dist/LoadingIcon.svelte","default":"./dist/LoadingIcon.svelte"},"./Select.svelte":{"types":"./dist/Select.svelte.d.ts","svelte":"./dist/Select.svelte","default":"./dist/Select.svelte"},"./filter":{"types":"./dist/filter.d.ts","default":"./dist/filter.js"},"./get-items":{"types":"./dist/get-items.d.ts","default":"./dist/get-items.js"},".":{"types":"./dist/index.d.ts","svelte":"./dist/index.js","default":"./dist/index.js"},"./tailwind.css":"./dist/tailwind.css","./no-styles/ChevronIcon.svelte":{"types":"./dist/no-styles/ChevronIcon.svelte.d.ts","svelte":"./dist/no-styles/ChevronIcon.svelte","default":"./dist/no-styles/ChevronIcon.svelte"},"./no-styles/ClearIcon.svelte":{"types":"./dist/no-styles/ClearIcon.svelte.d.ts","svelte":"./dist/no-styles/ClearIcon.svelte","default":"./dist/no-styles/ClearIcon.svelte"},"./no-styles/LoadingIcon.svelte":{"types":"./dist/no-styles/LoadingIcon.svelte.d.ts","svelte":"./dist/no-styles/LoadingIcon.svelte","default":"./dist/no-styles/LoadingIcon.svelte"},"./no-styles/Select.svelte":{"types":"./dist/no-styles/Select.svelte.d.ts","svelte":"./dist/no-styles/Select.svelte","default":"./dist/no-styles/Select.svelte"}},"svelte":"./dist/index.js","readme":"<div align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/rob-balfre/svelte-select/master/svelte-select.png\" alt=\"Svelte Select\" width=\"150\" />\n  <h1>Svelte Select</h1>\n</div>\n\n<div align=\"center\">\n  <a href=\"https://npmjs.org/package/svelte-select\">\n    <img src=\"https://badgen.now.sh/npm/v/svelte-select\" alt=\"version\" />\n  </a>\n  <a href=\"https://npmjs.org/package/svelte-select\">\n    <img src=\"https://badgen.now.sh/npm/dm/svelte-select\" alt=\"downloads\" />\n  </a>\n</div>\n<div align=\"center\">A select/autocomplete/typeahead Svelte component.</div>\n\n## Demos\n\n[💥 Examples of every prop, event, slot and more 💥](https://svelte-select-examples.vercel.app)\n\n[✨ REPL: Simple ✨](https://svelte.dev/repl/c3bbe052fdfc4e87a46ccd9091ee002b)\n\n[💃 REPL: Show me everything 🕺](https://svelte.dev/repl/3df87e32340e4e9e85bf371becae2af0)\n\n## Installation\n\n```bash\nnpm install svelte-select\n```\n\n## Upgrading to v5\nSee [migration guide](/MIGRATION_GUIDE.md) if upgrading from v4 to v5.\n\n\n## Rollup and low/no-build setups\n\nList position and floating is powered by `floating-ui`, see their [package-entry-points](https://github.com/floating-ui/floating-ui#package-entry-points) docs if you encounter build errors.\n\n\n\n## Props\n\n| Prop                   | Type      | Default         | Description                                                    |\n| ---------------------- | --------- | --------------- | -------------------------------------------------------------- |\n| items                  | `any[]`   | `[]`            | Array of items available to display / filter                   |\n| value                  | `any`     | `null`          | Selected value(s)                                              |\n| justValue              | `any`     | `null`          | **READ-ONLY** Selected value(s) excluding container object     |\n| itemId                 | `string`  | `value`         | Override default identifier                                    |\n| label                  | `string`  | `label`         | Override default label                                         |\n| id                     | `string`  | `null`          | id attr for input field                                        |\n| filterText             | `string`  | `''`            | Text to filter `items` by                                      |\n| placeholder            | `string`  | `Please select` | Placeholder text                                               |\n| hideEmptyState         | `boolean` | `false`         | When no items hide list                                        |\n| listOpen               | `boolean` | `false`         | Open/close list                                                |\n| class                  | `string`  | `''`            | container classes                                              |\n| containerStyles        | `string`  | `''`            | Add inline styles to container                                 |\n| clearable              | `boolean` | `true`          | Enable clearing of value(s)                                    |\n| disabled               | `boolean` | `false`         | Disable select                                                 |\n| multiple               | `boolean` | `false`         | Enable multi-select                                            |\n| searchable             | `boolean` | `true`          | If `false` search/filtering is disabled                        |\n| groupHeaderSelectable  | `boolean` | `false`         | Enable selectable group headers                                |\n| focused                | `boolean` | `false`         | Controls input focus                                           |\n| listAutoWidth          | `boolean` | `true`          | If `false` will ignore width of select                         |\n| showChevron            | `boolean` | `false`         | Show chevron                                                   |\n| inputAttributes        | `object`  | `{}`            | Pass in HTML attributes to Select's input                      |\n| placeholderAlwaysShow  | `boolean` | `false`         | When `multiple` placeholder text will always show              |\n| loading                | `boolean` | `false`         | Shows `loading-icon`. `loadOptions` will override this         |\n| listOffset             | `number`  | `5`             | `px` space between select and list                             |\n| debounceWait           | `number`  | `300`           | `milliseconds` debounce wait                                   |\n| floatingConfig         | `object`  | `{}`            | [Floating UI Config](https://floating-ui.com/)                 |\n| hasError               | `boolean` | `false`         | If `true` sets error class and styles                          |\n| name                   | `string`  | `null`          | Name attribute of hidden input, helpful for form actions       |\n| required               | `boolean` | `false`         | If `Select` is within a `<form>` will restrict form submission |\n| multiFullItemClearable | `boolean` | `false`         | When `multiple` selected items will clear on click             |\n| closeListOnChange      | `boolean` | `true`          | After `on:change` list will close                              |\n\n\n## Named slots\n\n```svelte\n<Select>\n  <div slot=\"prepend\" />\n  <div slot=\"selection\" let:selection let:index /> <!-- index only available when multiple -->\n  <div slot=\"clear-icon\" />  \n  <div slot=\"multi-clear-icon\" />  \n  <div slot=\"loading-icon\" />  \n  <div slot=\"chevron-icon\" /> \n  <div slot=\"list\" let:filteredItems />  \n  <div slot=\"item\" let:item let:index />  \n  <div slot=\"required\" let:value />\n  <!-- Remember you can also use `svelte:fragment` to avoid a container DOM element. -->\n  <svelte:fragment slot=\"empty\" />  \n</Select>\n```\n\n\n## Events\n\n| Event Name | Callback          | Description                                                                |\n| ---------- | ----------------- | -------------------------------------------------------------------------- |\n| change     | { detail }        | fires when the user selects an option                                      |\n| input      | { detail }        | fires when the value has been changed                                      |\n| focus      | { detail }        | fires when select > input on:focus                                         |\n| blur       | { detail }        | fires when select > input on:blur                                          |\n| clear      | { detail }        | fires when clear is invoked or item is removed (by user) from multi select |\n| loaded     | { options }       | fires when `loadOptions` resolves                                          |\n| error      | { type, details } | fires when error is caught                                                 |\n| filter     | { detail }        | fires when `listOpen: true` and items are filtered                         |\n| hoverItem  | { detail }        | fires when hoverItemIndex changes                                          |\n\n\n### Items\n\n`items` can be simple arrays or collections.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  let simple = ['one', 'two', 'three'];\n\n  let collection = [\n    { value: 1, label: 'one' },\n    { value: 2, label: 'two' },\n    { value: 3, label: 'three' },\n  ];\n</script>\n\n<Select items={simple} />\n\n<Select items={collection} />\n```\n\nThey can also be grouped and include non-selectable items.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  const items = [\n    {value: 'chocolate', label: 'Chocolate', group: 'Sweet'},\n    {value: 'pizza', label: 'Pizza', group: 'Savory'},\n    {value: 'cake', label: 'Cake', group: 'Sweet', selectable: false},\n    {value: 'chips', label: 'Chips', group: 'Savory'},\n    {value: 'ice-cream', label: 'Ice Cream', group: 'Sweet'}\n  ];\n\n  const groupBy = (item) => item.group;\n</script>\n\n<Select {items} {groupBy} />\n```\n\nYou can also use custom collections.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  const itemId = 'id';\n  const label = 'title';\n\n  const items = [\n    {id: 0, title: 'Foo'},\n    {id: 1, title: 'Bar'},\n  ];\n</script>\n\n<Select {itemId} {label} {items} />\n```\n\n### Async Items\n\nTo load items asynchronously then `loadOptions` is the simplest solution. Supply a function that returns a `Promise` that resolves with a list of items. `loadOptions` has debounce baked in and fires each time `filterText` is updated.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  import { someApiCall } from './services';\n\n  async function examplePromise(filterText) {\n    // Put your async code here...\n    // For example call an API using filterText as your search params\n    // When your API responds resolve your Promise\n    let res = await someApiCall(filterText);\n    return res;\n  }\n</script>\n\n<Select loadOptions={examplePromise} />\n```\n\n\n### Advanced List Positioning / Floating \n\n`svelte-select` uses [floating-ui](https://floating-ui.com/) to control the list floating. See their docs and pass in your config via the `floatingConfig` prop.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  let floatingConfig = {\n    strategy: 'fixed'\n  }\n</script>\n\n<Select {floatingConfig} />\n```\n\n### Exposed methods\nThese internal functions are exposed to override if needed. Look through the test file (test/src/index.js) for examples.\n\n```js\nexport let itemFilter = (label, filterText, option) => label.toLowerCase().includes(filterText.toLowerCase());\n```\n\n```js\nexport let groupBy = undefined;\n```\n\n```js\nexport let groupFilter = groups => groups;\n```\n\n```js\nexport let createGroupHeaderItem = groupValue => {\n  return {\n    value: groupValue,\n    label: groupValue\n  };\n};\n```\n\n```js\nexport function handleClear() {\n  value = undefined;\n  listOpen = false;\n  dispatch(\"clear\", value);\n  handleFocus();\n}\n```\n\n```js\nexport let loadOptions = undefined; // if used must return a Promise that updates 'items'\n/* Return an object with { cancelled: true } to keep the loading state as active. */\n```\n\n```js\nexport const getFilteredItems = () => {\n  return filteredItems;\n};\n```\n\n```js\nexport let debounce = (fn, wait = 1) => {\n  clearTimeout(timeout);\n  timeout = setTimeout(fn, wait);\n};\n```\n\nOverride core functionality at your own risk! See ([get-items.js](/src/lib/get-items.js) & [filter.js](/src/lib/filter.js))\n\n```js\n    // core replaceable methods...\n    <Select \n      filter={...}\n      getItems={...}\n    />\n```\n\n## A11y (Accessibility)\n\nOverride these methods to change the `aria-context` and `aria-selection` text.\n\n```js\nexport let ariaValues = (values) => {\n  return `Option ${values}, selected.`;\n}\n\nexport let ariaListOpen = (label, count) => {\n  return `You are currently focused on option ${label}. There are ${count} results available.`;\n}\n\nexport let ariaFocused = () => {\n  return `Select is focused, type to refine list, press down to open the menu.`;\n}\n```\n\n## CSS custom properties (variables)\n\nYou can style a component by overriding [the available CSS custom properties](/docs/theming_variables.md).\n\n```html\n<script>\n  import Select from 'svelte-select';\n</script>\n\n<Select --border-radius= \"10px\" --placeholder-color=\"blue\" />\n```\n\nYou can also use the `inputStyles` prop to write in any override styles needed for the input.\n\n```html\n<script>\n  import Select from 'svelte-select';\n\n  const items = ['One', 'Two', 'Three'];\n</script>\n\n<Select {items} inputStyles=\"box-sizing: border-box;\"></Select>\n```\n\n### 🧪 Experimental: Replace styles (Tailwind, Bootstrap, Bulma etc)\nIf you'd like to supply your own styles use: `import Select from 'svelte-select/no-styles/Select.svelte'`. Then somewhere in your code or build pipeline add your own. There is a tailwind stylesheet via `import 'svelte-select/tailwind.css'`. It uses `@extend` so PostCSS is required.\n\n\n## License\n\n[LIL](LICENSE)\n","readmeFilename":"README.md","gitHead":"8ad681351f91709f763fd6a591e1195f03d4113e","bugs":{"url":"https://github.com/rob-balfre/svelte-select/issues"},"homepage":"https://github.com/rob-balfre/svelte-select#readme","_id":"svelte-select@5.3.0-beta.7","_nodeVersion":"18.10.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-qrJGCKv9RoD/gywTJ4hU8H0QJK4xiaCoPMcHz6Y76pTALSoJVUB2D5Q9/GyG6bj0S99xlXyF9uTwGMvWaKXpNA==","shasum":"d36b674538d833d1cfe3534b30a1a747e2337e9a","tarball":"http://registry-npm.ywwl.com/svelte-select/download/svelte-select-5.3.0-beta.7.tgz","fileCount":28,"unpackedSize":110063,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE7vmw1Kyc6mKGqWjCHmxG8BFy6eFOLqDa9tBIZ4aQTfAiA0SDdGW2oEO0gwlnTsdoy8RlMSsnSTZqw18bEwlcmf5g=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj8pVdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrF1A//eDGTzSoYXHx/ZdGCv/LZmmDUGsl1vAQgacOpY0ByClKe01EE\r\n5CtTEpPa58SwPAFPdMYziErYDszNct6cd/95RyruNb83dkcTqzmSuPh6gN5y\r\ncA9ZTQi6WycLrwSSYexFHvbED509j86TwY7hulVCmWJvS7xA/nS5hBJ8k6L4\r\n+/a1Ci1oewvmP8uvV/4M3jrpSPu8J6URyYSLszx/yYRN38y8Ly8qZjC6U3en\r\ndntpIQeKv6502xREeBZ8FfwLaRzkgneySHLxAgT0ct3EII8WAH5KTGgzxdnp\r\nG3Rpw+KYl+KNTFqGCnlxSYcr+Ngw84LwlBVpGFjn8Ob//pGZTPlBcAJenFdL\r\nKtDdMo9tzTR/RHn2ib8TCL69u7UjFrFCFOfW6pO8uez4z13pJN2StKrkZOKX\r\nok6c77fszumwzN82uHCDoC27XzhhEV7KoxIg998xC19jLAncKtO+4NBFqHKr\r\nWFHAFLQxEGwpcYV3i/sxckS1APVU9ITao6jVuCNEEqs4amOfHbogMsXk7yDd\r\nsVC16W5WjJWfYlJXIaqrR6R/2lgjyqqjgY6hqjM1H+ZQgH1vzX2C5c9NE0E6\r\njBns2WO2Id9YuvXuXGkhnjq3zaGop7isJsMGPaHlFGO3kwmKU5c8TldtXkpE\r\n0u6Bn3oJR7m7VDq3fLIlkdHDr06kCJ0BMmA=\r\n=sYjo\r\n-----END PGP SIGNATURE-----\r\n","size":18811,"noattachment":false,"key":"/svelte-select/-/svelte-select-5.3.0-beta.7.tgz"},"_npmUser":{"name":"rob-balfre","email":"rob.balfre@gmail.com"},"directories":{},"maintainers":[{"name":"rob-balfre","email":"rob.balfre@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/svelte-select_5.3.0-beta.7_1676842333459_0.36459524407812616"},"_hasShrinkwrap":false,"publish_time":1676842333673,"_cnpm_publish_time":1676842333673,"dist-tags":{"alpha":"5.0.0-alpha.10","beta":"5.3.0-beta.7","latest":"6.0.0"}}