{"_id":"@solid-aria/menu","_rev":"6-45ed977f32004a6a4f67eaa52b04dcd0","name":"@solid-aria/menu","dist-tags":{"latest":"0.2.0","snapshot":"0.0.0-snapshot-20220617074250"},"versions":{"0.1.0":{"name":"@solid-aria/menu","version":"0.1.0","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"dependencies":{"@solid-aria/button":"workspace:^","@solid-aria/collection":"workspace:^","@solid-aria/interactions":"workspace:^","@solid-aria/overlays":"workspace:^","@solid-aria/selection":"workspace:^","@solid-aria/tree":"workspace:^","@solid-aria/types":"workspace:^","@solid-aria/utils":"workspace:^"},"peerDependencies":{"@solid-primitives/utils":"^2.0.1","solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"gitHead":"0f11304d53975a50ef365f99b67821e425f01824","_id":"@solid-aria/menu@0.1.0","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-zfGTuwqAQ7Bu2xQvKHJNaPW4NWNyM+frdzCcT2bALZbfGsKg0xPFjMOGpYxvs1y/8kX9YBIHzw8KlzvI3L3TpA==","shasum":"0bd5ca22f5e948dcdc3a904ae2b3e34029792eb6","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.1.0.tgz","fileCount":4,"unpackedSize":31787,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCS6ymXlgVkHW2YMl0CTiYSQryFHaJ5DEXUeEtsHW+Z9gIgQq5QZcwKPj6z5IJKEbTg1oK2BKrx+RpS59hiydaE73s="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJipxnhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmroZw/9F1Y5OG+J9qnf3z5x89ju+nlUqXH2T6vne84QziPRylHUbqbF\r\n1aKgFU8wMo0WINaN+i01IDlqp0LezVUuapGAXFxyPvQalAf2ktCiWjxf4Tnf\r\noqPXv2npLx+MuZ/Qj6Shp2SqNrlSkLdySyA4tuvc2Z4DA1meSk2zDM8T/Sez\r\nYFzWeQFNeL4Zs2Ny1Zwd5/l3WvFZVQO1LB4yKBKo3jYTiaKJHJ9jF/nNALN8\r\nf8SvUYWkRHTNSxIOe/oqFtnqfokN/Z5dSdKIo5NCdG3S6Elm34A3VNTHQKiO\r\n8Z4RQv1MXipnytXtKjL2TDZb4vlFXtEh+L62apwoq2EqUdRRBufOBAJT0owt\r\nC6Xeefq21LMNexV06B8ockG28iLKV/cI5CRoR0pgUZUbZlTUMIPECdjHsMJC\r\n5SiHg7YSLVUbjLpfCjsNhwZCqSINs1LM3gh45fDuZeoKvsIE+5Enutuw9O5n\r\nSne1ppZzG6f0lBAMRFGz1KSpHOumMcCgVrzvWXOxyls8PlbzkWDWW1U7I5AA\r\nKI8AMPE0gL9Ge/EI+JtprNzl2KeX/IOaLCVIurKQfERFL+ff++rh4Ax0YERw\r\nmbMn76E2JQixlQThb4R3+W8ftc0piewpYfM1nw602KTnX5JyGXle+JUVLs4b\r\niHfgzfavxZpkzcZcxgEN+V1DB8E5FP0pN8M=\r\n=2c6O\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.1.0_1655118305684_0.6547995758080722"},"_hasShrinkwrap":false},"0.1.1":{"name":"@solid-aria/menu","version":"0.1.1","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"dependencies":{"@solid-aria/button":"^0.1.1","@solid-aria/collection":"^0.1.1","@solid-aria/interactions":"^0.1.1","@solid-aria/overlays":"^0.1.1","@solid-aria/selection":"^0.1.1","@solid-aria/tree":"^0.1.1","@solid-aria/types":"^0.1.1","@solid-aria/utils":"^0.1.1","@solid-primitives/utils":"^2.1.0"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"gitHead":"b353437a1e59a42f2d400c48fe2dd83802bc373b","_id":"@solid-aria/menu@0.1.1","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-l28Bvxh9BfBKf4Yrk0IqZNwgnqxnzSx6ExYe/EnXvRG8/wosq1/Midr3xgASzSbEhfcuCgAM0m9O+OzXnRlKbA==","shasum":"189875abb71acf6730f8ec5dc4e0b75374745a99","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.1.1.tgz","fileCount":4,"unpackedSize":31761,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICt4Dm2xX9Jm0bJry918U/2LEe+ItmPC5tU/nwsiu7g0AiBBp3cnkivw0vYM6sUzsrkT5q9BH+P7bsYhdOWrnPi6Mg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiq6VfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqgPRAAj8UWmWZXSGQGzOUv6Fv5EqCXHbUvxFROCihelEETW/h6wMta\r\nsyHgypnYs/oAn5oeAZP0CJfym3W+OOtFF7SCL+9coIE9EDwxuHw8iONqOWbs\r\nIrT2DcBqr14kdPVs/nNsYd+uf/7WCkivh51m3gGr8VU3RbNZFUgIzV2DqK0N\r\nn5Jl+38c6KuiYPHd+dYdkkpFJLcyeQQI0Remy4QE8+32bevrsz+QEbVrl+eY\r\nAWNmzjcXEJDYkkgnAzoM++PKcuTkgbVMbkpRwIv8WHiAEGkXSJqkCloIGMEB\r\nld028J1YOy9FDHpc2ukddjB/frSwr8CHGcANhFQXRxEI3FMKO7swmChn1ZRt\r\neyvLu1de8AlBUYFZ2pF/jE58khdooRMOPbdN/Qa50QtgPQnrVaEKpBXXFKN+\r\nJl/miBb+g1K+FOH4hM5ix4h/l5906UEJPt7/Dq039Ne7l51XpTvvW/4yNpRm\r\nYGVwekNiUP9gwVoM/fDMXkwmVi2CZtbRwyVfD5GCylrF5I4GTuW4tz9YpS36\r\nz2aFcbQmkehpbb2+OLYq3yQ/jmU1vdb9RCIntnZB59SN8t+2J2LNjWSyxRw5\r\nqM6yxi7JfzRBb8gwVeYpCrbowhAvy3UlJlqVoMeEmxsSzggY87YCRJk0DJHj\r\n240u/lwXfMQON0GfGSvj8lYBIGMNBBlz/dY=\r\n=yUZc\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.1.1_1655416159127_0.9418964297048471"},"_hasShrinkwrap":false},"0.1.2":{"name":"@solid-aria/menu","version":"0.1.2","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@solid-aria/button":"^0.1.2","@solid-aria/collection":"^0.1.2","@solid-aria/interactions":"^0.1.2","@solid-aria/overlays":"^0.1.2","@solid-aria/selection":"^0.1.2","@solid-aria/tree":"^0.1.2","@solid-aria/types":"^0.1.2","@solid-aria/utils":"^0.1.2","@solid-primitives/utils":"^2.1.0"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"_id":"@solid-aria/menu@0.1.2","_integrity":"sha512-6hunPaN4+9YSGX/LVzyw8eZhhHVIjX6z5iMntqrFbz0vOvGbSyTqbs82RB8kjbc5wom8qzpyqSw2Vaahr7IsTQ==","_resolved":"/private/var/folders/s0/vwpkg8b954n8058jcrwst0yr0000gn/T/cf2cbbc64acac449091c54850bf7d9e9/solid-aria-menu-0.1.2.tgz","_from":"file:solid-aria-menu-0.1.2.tgz","_nodeVersion":"17.9.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-6hunPaN4+9YSGX/LVzyw8eZhhHVIjX6z5iMntqrFbz0vOvGbSyTqbs82RB8kjbc5wom8qzpyqSw2Vaahr7IsTQ==","shasum":"822eb674a3124be9636dd41d3965184821e28980","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.1.2.tgz","fileCount":6,"unpackedSize":52884,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGsQJemfXhpcxiuC/3PJLw2Cnts6yYIGvunb2WmoUzsOAiAY7PqwKXJFhLGxm7W6CpHO2in9JA01pOfman2du5zqHg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirB/AACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmPw/9EHNsi/FFXUaKfRTQqV5jm4aDts+TRt1qvfIvUpUO/xFO4Zn/\r\nIl2NFQcqUCNnAkGYxGVCdqXvKQFFNOy/w0ZXNuEigELn63LZPK+seo/KDXW9\r\nCTm//bipC0U51TSFU3QZG2PJzZrKv1+QWZknvqgjmPiy7vPCvkAFY2ucVXqY\r\nmBeWgFb7R2oyBAz+/LAX03HvfwMJkdk2v19jrUCfKzP/5AJg7KOhGhALPV7V\r\nDygs/QheNURgk/+V/OaDT/VLp18QzAhup0/mxHBkYxX/zKZH94HWDgwFy3S9\r\nYoXRiDMuQQpfoMzH/+rHv781UWE+uRMA9BMztfZsJvNuYdIwGgOMBbjrsG9f\r\nUi8aoAf7Oy3ECEn9eFL9rsko9kqy5napR8JIpd9tZIp0UwwlddSN2Fa6Pbln\r\nkRPzHPi/RT8gZKGYsEFIcKEAcUHgq2bHwIGUe6b0zNAlNpjS9C64Y1XLWh5s\r\nde98YyqW8HHr32nj+uNBDmpjriTjJXantbuInbxLyQbGBRw8L+IDWtqQK9DA\r\nZ4dnaSYSva8y6Ppb9Hm8liWh1YACu+7KYP/B6CE0by1sQgj+H38QQvW+RF6Y\r\nAaG09TtVeCA2do/4QjBMhbSSI7WMgQv58RSWHpgTLIaYlrM7CS1tWBfWKIDy\r\nqaz6+4pIoYIWu2PQMHcJc2TPUXQxOcpXVUY=\r\n=cSm3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.1.2_1655447488155_0.8681936439606981"},"_hasShrinkwrap":false},"0.0.0-snapshot-20220617074250":{"name":"@solid-aria/menu","version":"0.0.0-snapshot-20220617074250","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"dependencies":{"@solid-aria/button":"^0.0.0-snapshot-20220617074250","@solid-aria/collection":"^0.0.0-snapshot-20220617074250","@solid-aria/interactions":"^0.0.0-snapshot-20220617074250","@solid-aria/overlays":"^0.0.0-snapshot-20220617074250","@solid-aria/selection":"^0.0.0-snapshot-20220617074250","@solid-aria/tree":"^0.0.0-snapshot-20220617074250","@solid-aria/types":"^0.0.0-snapshot-20220617074250","@solid-aria/utils":"^0.0.0-snapshot-20220617074250","@solid-primitives/utils":"^2.1.0"},"devDependencies":{"solid-js":"^1.4.4"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"readme":"<p>\n  <img width=\"100%\" src=\"https://assets.solidjs.com/banner?type=Aria&background=tiles&project=Menu\" alt=\"Solid Aria - Menu\">\n</p>\n\n# @solid-aria/menu\n\n[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/)\n[![turborepo](https://img.shields.io/badge/built%20with-turborepo-cc00ff.svg?style=for-the-badge&logo=turborepo)](https://turborepo.org/)\n[![size](https://img.shields.io/bundlephobia/minzip/@solid-aria/menu?style=for-the-badge&label=size)](https://bundlephobia.com/package/@solid-aria/menu)\n[![version](https://img.shields.io/npm/v/@solid-aria/menu?style=for-the-badge)](https://www.npmjs.com/package/@solid-aria/menu)\n[![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-0.json)](https://github.com/solidjs-community/solid-aria#contribution-process)\n\nMenu displays a list of actions or options that a user can choose.\n\n- [`createMenu`](#createmenu) - Provides the behavior and accessibility implementation for a menu component.\n- [`createMenuTrigger`](#createmenutrigger) - Provides the behavior and accessibility implementation for a menu trigger.\n\n## Installation\n\n```bash\nnpm install @solid-aria/menu\n# or\nyarn add @solid-aria/menu\n# or\npnpm add @solid-aria/menu\n```\n\n## `createMenu`\n\nProvides the behavior and accessibility implementation for a menu component.\n\n### Features\n\nThere is no native element to implement a menu in HTML that is widely supported. `createMenu` helps achieve accessible menu components that can be styled as needed.\n\nℹ️ **Note:** `createMenu` only handles the menu itself. For a dropdown menu, combine with `createMenuTrigger`.\n\n- Exposed to assistive technology as a `menu` with `menuitem` children using ARIA\n- Support for single, multiple, or no selection\n- Support for disabled items\n- Support for sections\n- Complex item labeling support for accessibility\n- Support for mouse, touch, and keyboard interactions\n- Tab stop focus management\n- Keyboard navigation support including arrow keys, home/end, page up/down\n- Automatic scrolling support during keyboard navigation\n- Typeahead to allow focusing items by typing text\n\n### How to use it\n\nThis example uses HTML `<ul>` and `<li>` elements to represent the menu with the first item disabled, and applies props from `createMenu` and `createMenuItem`.\n\n```tsx\nimport { ForItems, Item } from \"@solid-aria/collection\";\nimport { AriaMenuItemProps, AriaMenuProps, createMenu, createMenuItem } from \"@solid-aria/menu\";\nimport { ParentProps } from \"solid-js\";\n\nfunction Menu(props: AriaMenuProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  return (\n    <MenuProvider>\n      <ul\n        {...menuProps}\n        ref={ref}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\",\n          border: \"1px solid gray\",\n          \"max-width\": \"250px\"\n        }}\n      >\n        <ForItems in={state.collection()}>\n          {item => (\n            <MenuItem key={item().key} onAction={props.onAction}>\n              {item().rendered()}\n            </MenuItem>\n          )}\n        </ForItems>\n      </ul>\n    </MenuProvider>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps, isFocused, isDisabled } = createMenuItem(props, () => ref);\n\n  return (\n    <li\n      {...menuItemProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : null,\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: isDisabled() ? \"default\" : \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <Menu onAction={key => alert(key)} aria-label=\"Actions\" disabledKeys={[\"one\"]}>\n      <Item key=\"one\">One</Item>\n      <Item key=\"two\">Two</Item>\n      <Item key=\"three\">Three</Item>\n    </Menu>\n  );\n}\n```\n\n### Menu sections\n\nThis example shows how a menu can support sections with separators and headings using props from `createMenuSection`. This is accomplished using three extra elements: an `<li>` to contain the heading `<span>` element, and a `<ul>` to contain the child items. This structure is necessary to ensure HTML semantics are correct.\n\n```tsx\nimport { ForItems, Item, Section } from \"@solid-aria/collection\";\nimport {\n  AriaMenuItemProps,\n  AriaMenuProps,\n  AriaMenuSectionProps,\n  createMenu,\n  createMenuItem,\n  createMenuSection\n} from \"@solid-aria/menu\";\nimport { ParentProps, Show } from \"solid-js\";\n\nfunction Menu(props: AriaMenuProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  return (\n    <MenuProvider>\n      <ul\n        {...menuProps}\n        ref={ref}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\",\n          border: \"1px solid gray\",\n          \"max-width\": \"250px\"\n        }}\n      >\n        <ForItems in={state.collection()}>\n          {section => (\n            <MenuSection heading={section().rendered()}>\n              <ForItems in={section().childNodes}>\n                {item => (\n                  <MenuItem key={item().key} onAction={props.onAction}>\n                    {item().rendered()}\n                  </MenuItem>\n                )}\n              </ForItems>\n            </MenuSection>\n          )}\n        </ForItems>\n      </ul>\n    </MenuProvider>\n  );\n}\n\nfunction MenuSection(props: ParentProps<AriaMenuSectionProps>) {\n  const { itemProps, headingProps, groupProps } = createMenuSection(props);\n\n  return (\n    <li {...itemProps}>\n      <Show when={props.heading}>\n        <span\n          {...headingProps}\n          style={{\n            \"font-weight\": \"bold\",\n            \"font-size\": \"1.1em\",\n            padding: \"2px 5px\"\n          }}\n        >\n          {props.heading}\n        </span>\n      </Show>\n      <ul\n        {...groupProps}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\"\n        }}\n      >\n        {props.children}\n      </ul>\n    </li>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps, isFocused, isDisabled } = createMenuItem(props, () => ref);\n\n  return (\n    <li\n      {...menuItemProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : null,\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: isDisabled() ? \"default\" : \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <Menu onAction={key => alert(key)} aria-label=\"Actions\">\n      <Section key=\"section1\" title=\"Section 1\">\n        <Item key=\"section1-item1\">One</Item>\n        <Item key=\"section1-item2\">Two</Item>\n        <Item key=\"section1-item3\">Three</Item>\n      </Section>\n      <Section key=\"section2\" title=\"Section 2\">\n        <Item key=\"section2-item1\">One</Item>\n        <Item key=\"section2-item2\">Two</Item>\n        <Item key=\"section2-item3\">Three</Item>\n      </Section>\n    </Menu>\n  );\n}\n```\n\n## `createMenuTrigger`\n\nProvides the behavior and accessibility implementation for a menu trigger.\n\n### Features\n\nThere is no native element to implement a menu in HTML that is widely supported. `createMenuTrigger` combined with `createMenu` helps achieve accessible menu components that can be styled as needed.\n\n- Exposed to assistive technology as a button with a `menu` popup using ARIA (combined with `createMenu`)\n- Support for mouse, touch, and keyboard interactions\n- Keyboard support for opening the menu using the arrow keys, including automatically focusing the first or last item accordingly\n\n### How to use it\n\nThis example shows how to build a menu button using `createMenuTrigger`, `createButton`, and `createMenu`.\n\nThe menu popup uses `createMenu` and `createMenuItem` to render the menu and its items. In addition, a `<FocusScope>` is used to automatically restore focus to the trigger when the menu closes. A hidden `<DismissButton>` is added at the start and end of the menu to allow screen reader users to dismiss it easily.\n\nThis example does not do any advanced popover positioning or portaling to escape its visual container.\n\n```tsx\nimport { createButton } from \"@solid-aria/button\";\nimport { ForItems, Item } from \"@solid-aria/collection\";\nimport { FocusScope } from \"@solid-aria/focus\";\nimport { createFocus } from \"@solid-aria/interactions\";\nimport {\n  AriaMenuItemProps,\n  AriaMenuProps,\n  AriaMenuTriggerProps,\n  createMenu,\n  createMenuItem,\n  createMenuTrigger\n} from \"@solid-aria/menu\";\nimport { AriaOverlayProps, createOverlay, DismissButton } from \"@solid-aria/overlays\";\nimport { combineProps } from \"@solid-primitives/props\";\nimport { createSignal, FlowProps, JSX, ParentProps, Show } from \"solid-js\";\n\ntype MenuButtonProps = FlowProps<AriaMenuTriggerProps & AriaMenuProps & { label: JSX.Element }>;\n\nfunction MenuButton(props: MenuButtonProps) {\n  let ref: HTMLButtonElement | undefined;\n\n  // Get props for the menu trigger and menu elements\n  const { menuTriggerProps, menuProps, state } = createMenuTrigger({}, () => ref);\n\n  // Get props for the button based on the trigger props from createMenuTrigger\n  const { buttonProps } = createButton(menuTriggerProps, () => ref);\n\n  return (\n    <div style={{ position: \"relative\", display: \"inline-block\" }}>\n      <button {...buttonProps} ref={ref} style={{ height: \"30px\", \"font-size\": \"14px\" }}>\n        {props.label}\n        <span aria-hidden=\"true\" style={{ \"padding-left\": \"5px\" }}>\n          ▼\n        </span>\n      </button>\n      <Show when={state.isOpen()}>\n        <MenuPopup\n          {...props}\n          {...menuProps}\n          autoFocus={state.focusStrategy()}\n          onClose={() => state.close()}\n        />\n      </Show>\n    </div>\n  );\n}\n\nfunction MenuPopup(props: AriaMenuProps & AriaOverlayProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  // Handle events that should cause the menu to close,\n  // e.g. blur, clicking outside, or pressing the escape key.\n  let overlayRef: HTMLDivElement | undefined;\n  const { overlayProps } = createOverlay(\n    {\n      onClose: props.onClose,\n      shouldCloseOnBlur: true,\n      isOpen: true,\n      isDismissable: true\n    },\n    () => overlayRef\n  );\n\n  // Wrap in <FocusScope> so that focus is restored back to the\n  // trigger when the menu is closed. In addition, add hidden\n  // <DismissButton> components at the start and end of the list\n  // to allow screen reader users to dismiss the popup easily.\n  return (\n    <MenuProvider>\n      <FocusScope restoreFocus>\n        <div {...overlayProps} ref={overlayRef}>\n          <DismissButton onDismiss={props.onClose} />\n          <ul\n            {...menuProps}\n            ref={ref}\n            style={{\n              position: \"absolute\",\n              width: \"100%\",\n              margin: \"4px 0 0 0\",\n              padding: 0,\n              \"list-style\": \"none\",\n              border: \"1px solid gray\",\n              background: \"lightgray\"\n            }}\n          >\n            <ForItems in={state.collection()}>\n              {item => (\n                <MenuItem key={item().key} onAction={props.onAction} onClose={props.onClose}>\n                  {item().rendered()}\n                </MenuItem>\n              )}\n            </ForItems>\n          </ul>\n          <DismissButton onDismiss={props.onClose} />\n        </div>\n      </FocusScope>\n    </MenuProvider>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps } = createMenuItem(props, () => ref);\n\n  // Handle focus events so we can apply highlighted\n  // style to the focused menu item\n  const [isFocused, setIsFocused] = createSignal(false);\n  const { focusProps } = createFocus({ onFocusChange: setIsFocused });\n\n  const rootProps = combineProps(menuItemProps, focusProps);\n\n  return (\n    <li\n      {...rootProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : \"black\",\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <MenuButton label=\"Actions\" onAction={key => alert(key)}>\n      <Item key=\"copy\">Copy</Item>\n      <Item key=\"cut\">Cut</Item>\n      <Item key=\"paste\">Paste</Item>\n    </MenuButton>\n  );\n}\n```\n\n### Internationalization\n\n`createMenu` handles some aspects of internationalization automatically. For example, type to select is implemented with an `Intl.Collator` for internationalized string matching. You are responsible for localizing all menu item labels for content that is passed into the menu.\n\n#### RTL\n\nIn right-to-left languages, the menu items should be mirrored. Ensure that your CSS accounts for this.\n\n## Changelog\n\nAll notable changes are described in the [CHANGELOG.md](./CHANGELOG.md) file.\n","readmeFilename":"README.md","gitHead":"53580c26c8f278fd52d4258d2753297c7dd24d92","_id":"@solid-aria/menu@0.0.0-snapshot-20220617074250","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-OAYxahmyVSz5q6PIeL05bhQ+f8cZBHPF6PpOzv4/nCw+u1T3hm2yEo0q6Me7AFnycyaFPLvE0UN6PuZQxv8RPw==","shasum":"4aa1efc2a82dce59e77a701a835d83e43e5d5c3f","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.0.0-snapshot-20220617074250.tgz","fileCount":4,"unpackedSize":32030,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcOTZ38Loz9nUvEAk/BqBbW0xWT1EjaK5Mlt5t+RBHbAiEAyQezxN6geOltIVtFZH1ITVNL0kux5CZ6cCSVS8gqLPQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirDHBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrB1g/+If1/55RQJiMkM48k8v8zZC95SErLLt9vlqaDQtGh8X04RIi+\r\nGNKQAr4WJdhSlOWz3998Nla8gg8Ihu11vdxansXCJj3QEwh1ZUh5+NAS7eZD\r\newhm9lXpo1aHOH2v65AYLFSA8lEPYq/VYOAYxfSlI/89PZvXHyleYpvmJ7WP\r\nxBJ18pcz/Tw46R9sEAfncUI0DHg+FW9i5yio/T5kn052rdrUcxpGiEcSO69h\r\nRAUgCHFGoVOpuGJ0t/v9jx0n1vW/70g8aK1o8ZBmGlNYBJOdwW/S5zTfVuPC\r\nZ63nuPnCY/xoa3/lxTGbCYYWwpyzG8susezPH/I4RRFwGC3qtboLArEIa14p\r\n+1PUgTjNpoDO3SLYFq9U/tUJPTLsXY34iGxBrWCjlcM4zfNstXm2RM2s6CsQ\r\nUr0HPX5E2nQux9M6Mga/VM4cgHQAnyqhuPwDeKlZ0CbJGsy9TN3/+0Ano1/5\r\nIo8fXzNMgJuVFWBaz2FdE0g+HdCOxpxHS/89F7YxAlN96wvAIzCTPz47yA1b\r\nOoKNGv/r+mfUCM9jxR8aCZK3tDSkybX5SBhVAJNtbM+BqHyj/httqZHd0whv\r\nqqb8RxqTidOWxqX+IESYTLcrCScZx7uZ1LjQXcNfXbjkGamf7+T2759SWesc\r\nZut5eYyIlYxDZqFFBeZ40KhRrBLDd6pgYsI=\r\n=jUoj\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.0.0-snapshot-20220617074250_1655452097702_0.4732939503876412"},"_hasShrinkwrap":false},"0.1.3":{"name":"@solid-aria/menu","version":"0.1.3","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@solid-aria/button":"^0.1.2","@solid-aria/collection":"^0.1.3","@solid-aria/interactions":"^0.1.3","@solid-aria/overlays":"^0.1.2","@solid-aria/selection":"^0.1.3","@solid-aria/tree":"^0.1.2","@solid-aria/types":"^0.1.3","@solid-aria/utils":"^0.1.3","@solid-primitives/utils":"^2.1.0"},"devDependencies":{"solid-js":"^1.4.4"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"_id":"@solid-aria/menu@0.1.3","_integrity":"sha512-L12rbEmtNi/SvkZFqphut8bwj8uCYBvhUo8hNgNdJEPM/rOkeCwaM6TiYH0R+RksQAOq5ORL6Smt7SpbrD6gYQ==","_resolved":"/tmp/cd7a54f33c0feeca5975f972c1ce5ef6/solid-aria-menu-0.1.3.tgz","_from":"file:solid-aria-menu-0.1.3.tgz","_nodeVersion":"17.9.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-L12rbEmtNi/SvkZFqphut8bwj8uCYBvhUo8hNgNdJEPM/rOkeCwaM6TiYH0R+RksQAOq5ORL6Smt7SpbrD6gYQ==","shasum":"71e672e5afa01c1d177ac9ad134c8693e4e17996","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.1.3.tgz","fileCount":6,"unpackedSize":52112,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDi6YDi1QGOR2FKae91cN002eQvgTQAj8jQrlBzypuTEwIgbfqXNqyYxCB/MgEoEDVYtghHfcUq/3Ft3BzFDJYKais="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiraUSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDyw//aIvpdN9CgRs7Tk3h3yDMs0pXyAIVBB0x6fu/VKfmyFV3FT1H\r\ncNhaB38NdlHNIh6SrT8szxORwTmYvYslb66XZUCzEUG53BX0zCK5rksX0LYC\r\nlAUah5Mv1DV/lAa/DkkuK2/g2mzSshqxpa7yqyk8dwLXseXm35esJR6KPslN\r\nIIppttNH33olA6KcpjWdjjqqYlqfK/hnpaiFOg8Gx40aQHYeHZWlySYzVP1V\r\nkI5TMOBzwgAYltXhTlD9H2GQLl9tp/y4aEHvTxQ9uvhJSFpjw78YXcgyS3T8\r\n7yDE/O2VGwTFoJV0RwLZ+KL2+Ss7SCapoJCRBaeoXHhcBiASCrneGyLXzI2t\r\nSLw7PWYSXaUa9pKBaWAvosJXStb6HxQL0fNfjaAqGXuRhBi0uqY8lepYaZo+\r\n+Cpzq3tNbFNRW7f80kiQGtKX29hEWfGU6kgZnqcIxycsOq1neCXGG2Iwr22H\r\nwWwbId0FRFwMyoyCYXrQ2yXmfZl0yh4Ikon2BVVVHy+MbheQrePp2evo+Pnb\r\nN04AFf2o4hvv2iwyA+oKcOphgMRW+1P2vZZeJ5sHQjHqlsxf+SREwFgNDiU4\r\nypKQmCmYz7EY6meRCoMECnESnZ8B+p4SortOFI+ooyu4bKvXzGmaCet4a9Q2\r\nnMlRsOja8QVJmF9FJj04KfHAjKOJ0X9AE34=\r\n=GW7R\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.1.3_1655547154497_0.46156210101445705"},"_hasShrinkwrap":false},"0.1.4":{"name":"@solid-aria/menu","version":"0.1.4","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@solid-aria/button":"^0.1.3","@solid-aria/collection":"^0.1.4","@solid-aria/interactions":"^0.1.4","@solid-aria/overlays":"^0.1.3","@solid-aria/selection":"^0.1.4","@solid-aria/tree":"^0.1.3","@solid-aria/types":"^0.1.3","@solid-aria/utils":"^0.2.0","@solid-primitives/utils":"^2.1.0"},"devDependencies":{"solid-js":"^1.4.4"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"_id":"@solid-aria/menu@0.1.4","_integrity":"sha512-qNogfYJzHrmJH5jHoJP1pAvdf6URhk5CvaJkWq6VAuvaYy7OhKqDBftaKxlBwGxx0SJb31XtfunuAd5qmDr55g==","_resolved":"/tmp/750a1e3e100492c71af2f207c4dee417/solid-aria-menu-0.1.4.tgz","_from":"file:solid-aria-menu-0.1.4.tgz","_nodeVersion":"17.9.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-qNogfYJzHrmJH5jHoJP1pAvdf6URhk5CvaJkWq6VAuvaYy7OhKqDBftaKxlBwGxx0SJb31XtfunuAd5qmDr55g==","shasum":"6ad8a7006460be7541b620557196df1340d3c4d9","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.1.4.tgz","fileCount":6,"unpackedSize":52112,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDdS+T9b5GplkBAjcAK0I3mIR+1BQNBFckke/jkQBJ5wIgR28qTLZxoCjGFmbWGQ/kIgy8AwZ8POlGarecEYl5BwQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJirtDmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6Gg/+L7ejjiF943BUPrKPPllpPEXSfYGRqvIXzfrtXIHVNlLcC+gr\r\no80YQN+wpk6Gf8QZ61cJhsoxdAuUu1S5xRNXjUenyNiK/vk3rtSDK9tGAynf\r\nxNQ+v70bNc3OXrOIZ0wQxkNyi3Deav7njht5YSsLG1Yh/kF3MfB5ruWeQCTv\r\nILkWVQere0QCGIw/XZnRzPBGysTbTTWgrrV6FWYNxGnWrlVrpuLRk1I5ZE88\r\nQpsFKacw93/lxxLOqt93Dlll16o9nx83UX2iTojh0Hw1tzXB8Bpoik+U482z\r\nnEMx4dm97MwZf6rAEE4I9mrze4/G+SDN6cXQNgBmAxPkyMPag0B+2VyYgONY\r\nUwCGuiOF3Ie2/bE2omUhnpFCahuGfR9cFW6rC5wbzMB3dldy07TS7dcHBJS8\r\nouemTiIFgTBFKs0LUDE5LGTwyzyaLN/+bBRr2//PjDuTUpxv1K/ctFHgG5iw\r\nG8cO3/IQ+vWF4tmdReZyqd5Me1FSDFDOKJ0PzrZFwSJl2w/YM9kwwU/53pHD\r\nHw67VHu7dEnkccYq5V1Rib0JM+Zg7yuyxWSStpR3wwGtb7NQtRCxmFRDV4wc\r\niWCAwBVpcF8zm8ZQ3x+Cp/7UBcwtAKKKto5EOVyhl8g/1vUrzZ2IeMCHPoXj\r\nEd4moECjX1DEi/1omumPqskGPvTW/QCTmZg=\r\n=0NJA\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.1.4_1655623910623_0.4906631579509675"},"_hasShrinkwrap":false},"0.2.0":{"name":"@solid-aria/menu","version":"0.2.0","private":false,"description":"Primitives for building accessible menu component.","keywords":["solid","aria","headless","design","system","components"],"homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"license":"MIT","author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"contributors":[],"sideEffects":false,"type":"module","main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@solid-aria/button":"^0.1.3","@solid-aria/collection":"^0.2.0","@solid-aria/interactions":"^0.1.4","@solid-aria/overlays":"^0.1.3","@solid-aria/selection":"^0.1.5","@solid-aria/tree":"^0.1.4","@solid-aria/types":"^0.1.4","@solid-aria/utils":"^0.2.1","@solid-primitives/utils":"^2.1.0"},"devDependencies":{"solid-js":"^1.4.4"},"peerDependencies":{"solid-js":"^1.4.4"},"publishConfig":{"access":"public"},"primitive":{"name":"menu","stage":0,"list":[],"category":""},"scripts":{"build":"tsup","clean":"rm -rf .turbo && rm -rf node_modules && rm -rf dist","dev":"vite serve dev --host","test":"jest --passWithNoTests","test:watch":"jest --watch --passWithNoTests","typecheck":"tsc --noEmit"},"_id":"@solid-aria/menu@0.2.0","_integrity":"sha512-UzRhTxyp8deWoidP1phHQD6YSGyJ2hiKxPNQ578CtRIt3QYTh6kHMgbA7QDGtlqLs86utgoYlYyUiWz0sttmTw==","_resolved":"/tmp/d7e0b39f4b9f8c9f6967d3f29e441117/solid-aria-menu-0.2.0.tgz","_from":"file:solid-aria-menu-0.2.0.tgz","_nodeVersion":"17.9.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-UzRhTxyp8deWoidP1phHQD6YSGyJ2hiKxPNQ578CtRIt3QYTh6kHMgbA7QDGtlqLs86utgoYlYyUiWz0sttmTw==","shasum":"31accd9eba6b5fad094d8667ba4d1fb47d2ad214","tarball":"https://registry.npmjs.org/@solid-aria/menu/-/menu-0.2.0.tgz","fileCount":6,"unpackedSize":50761,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICwCESXw5zoo6idW0AeQpYy7F97or5zOJ5woLRhleCCZAiEA/vhdI4tliDAVUS2nQnL72W5kbFHydCapLE89bRmEUgM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0Sb5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopLg/+OeTL+dh66nzLEP6ngp3BUhdBbJuKydM6Udq3chOi56N5Wmeg\r\n9YnPQMPp8/L64Y5+tjsDw/++hbfclqhLcEHN1GUsYLUnMUXbQSDxrUmf4nLk\r\nIY2tl0XNSayEuYg06h6X6josVnPG13CjpP3dA34WWVcRwaBqTlSSpfP7UePz\r\nVDsGmcoKf7DD0igoJsnrBjcj3QNCg8WqmlyM4fJvLQnestitkxiorLu11L7y\r\n43dqpEGmxJQch8fd1WfrrN3dI3D7yZPRqR3XCc/A/Hcc8WDHQy31e6kqOqmx\r\n5I0cqQRvut8mrbKhxAzlJrTEMIlCihOHjLkqYHEhjwwS1rHlx1hh9hEmiBQv\r\nh+J7bJHh5UQ+5zQcSrEeG8ImZi3A8kH/P8vhTqDqCMj1JYhX584bBxP+E0NV\r\nFlNjxbQ2n5FkaGSwDwbIqUwviTPvXzPS0TlnD6PUyihXsuNsj5o1xgAsbn/z\r\nuL1PxbtcHwYjMpIRcf9EIoEx5iQgzTRXLDBQLJZbmPRlTBfZlR9u7/284BLe\r\nYDx5iR2id1HgeoxopE3Tc5Esd9oqC/T+OKjk8ynYwuX9qkwPOvyubqcWZDvz\r\nZ3KiBR8vyJgL7+tlcRBZtpsD9ucxKF8mRInyEdgkXdJXrwYWEAgPwGRNwT/Y\r\nQmfI13+tYmAGdi0o6viKAn4kBOcuGRHk2Ak=\r\n=bY5X\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fabienml","email":"fabienml.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/menu_0.2.0_1657874168930_0.2576964917550326"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-13T11:05:05.620Z","0.1.0":"2022-06-13T11:05:05.804Z","modified":"2022-07-15T08:36:09.165Z","0.1.1":"2022-06-16T21:49:19.317Z","0.1.2":"2022-06-17T06:31:28.307Z","0.0.0-snapshot-20220617074250":"2022-06-17T07:48:17.868Z","0.1.3":"2022-06-18T10:12:34.701Z","0.1.4":"2022-06-19T07:31:50.799Z","0.2.0":"2022-07-15T08:36:09.082Z"},"maintainers":[{"name":"fabienml","email":"fabienml.dev@gmail.com"},{"name":"davedbase","email":"dave.dibiase@gmail.com"}],"description":"Primitives for building accessible menu component.","homepage":"https://github.com/solidjs-community/solid-aria/tree/main/packages/menu#readme","keywords":["solid","aria","headless","design","system","components"],"repository":{"type":"git","url":"git+https://github.com/solidjs-community/solid-aria.git"},"contributors":[],"author":{"name":"Fabien Marie-Louise","email":"fabienml.dev@gmail.com"},"bugs":{"url":"https://github.com/solidjs-community/solid-aria/issues"},"license":"MIT","readme":"<p>\n  <img width=\"100%\" src=\"https://assets.solidjs.com/banner?type=Aria&background=tiles&project=Menu\" alt=\"Solid Aria - Menu\">\n</p>\n\n# @solid-aria/menu\n\n[![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=for-the-badge&logo=pnpm)](https://pnpm.io/)\n[![turborepo](https://img.shields.io/badge/built%20with-turborepo-cc00ff.svg?style=for-the-badge&logo=turborepo)](https://turborepo.org/)\n[![size](https://img.shields.io/bundlephobia/minzip/@solid-aria/menu?style=for-the-badge&label=size)](https://bundlephobia.com/package/@solid-aria/menu)\n[![version](https://img.shields.io/npm/v/@solid-aria/menu?style=for-the-badge)](https://www.npmjs.com/package/@solid-aria/menu)\n[![stage](https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fraw.githubusercontent.com%2Fsolidjs-community%2Fsolid-primitives%2Fmain%2Fassets%2Fbadges%2Fstage-0.json)](https://github.com/solidjs-community/solid-aria#contribution-process)\n\nMenu displays a list of actions or options that a user can choose.\n\n- [`createMenu`](#createmenu) - Provides the behavior and accessibility implementation for a menu component.\n- [`createMenuTrigger`](#createmenutrigger) - Provides the behavior and accessibility implementation for a menu trigger.\n\n## Installation\n\n```bash\nnpm install @solid-aria/menu\n# or\nyarn add @solid-aria/menu\n# or\npnpm add @solid-aria/menu\n```\n\n## `createMenu`\n\nProvides the behavior and accessibility implementation for a menu component.\n\n### Features\n\nThere is no native element to implement a menu in HTML that is widely supported. `createMenu` helps achieve accessible menu components that can be styled as needed.\n\nℹ️ **Note:** `createMenu` only handles the menu itself. For a dropdown menu, combine with `createMenuTrigger`.\n\n- Exposed to assistive technology as a `menu` with `menuitem` children using ARIA\n- Support for single, multiple, or no selection\n- Support for disabled items\n- Support for sections\n- Complex item labeling support for accessibility\n- Support for mouse, touch, and keyboard interactions\n- Tab stop focus management\n- Keyboard navigation support including arrow keys, home/end, page up/down\n- Automatic scrolling support during keyboard navigation\n- Typeahead to allow focusing items by typing text\n\n### How to use it\n\nThis example uses HTML `<ul>` and `<li>` elements to represent the menu with the first item disabled, and applies props from `createMenu` and `createMenuItem`.\n\n```tsx\nimport { ForItems, Item } from \"@solid-aria/collection\";\nimport { AriaMenuItemProps, AriaMenuProps, createMenu, createMenuItem } from \"@solid-aria/menu\";\nimport { ParentProps } from \"solid-js\";\n\nfunction Menu(props: AriaMenuProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  return (\n    <MenuProvider>\n      <ul\n        {...menuProps}\n        ref={ref}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\",\n          border: \"1px solid gray\",\n          \"max-width\": \"250px\"\n        }}\n      >\n        <ForItems in={state.collection()}>\n          {item => (\n            <MenuItem key={item().key} onAction={props.onAction}>\n              {item().children}\n            </MenuItem>\n          )}\n        </ForItems>\n      </ul>\n    </MenuProvider>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps, isFocused, isDisabled } = createMenuItem(props, () => ref);\n\n  return (\n    <li\n      {...menuItemProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : null,\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: isDisabled() ? \"default\" : \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <Menu onAction={key => alert(key)} aria-label=\"Actions\" disabledKeys={[\"one\"]}>\n      <Item key=\"one\">One</Item>\n      <Item key=\"two\">Two</Item>\n      <Item key=\"three\">Three</Item>\n    </Menu>\n  );\n}\n```\n\n### Menu sections\n\nThis example shows how a menu can support sections with separators and headings using props from `createMenuSection`. This is accomplished using three extra elements: an `<li>` to contain the heading `<span>` element, and a `<ul>` to contain the child items. This structure is necessary to ensure HTML semantics are correct.\n\n```tsx\nimport { ForItems, Item, Section } from \"@solid-aria/collection\";\nimport {\n  AriaMenuItemProps,\n  AriaMenuProps,\n  AriaMenuSectionProps,\n  createMenu,\n  createMenuItem,\n  createMenuSection\n} from \"@solid-aria/menu\";\nimport { ParentProps, Show } from \"solid-js\";\n\nfunction Menu(props: AriaMenuProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  return (\n    <MenuProvider>\n      <ul\n        {...menuProps}\n        ref={ref}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\",\n          border: \"1px solid gray\",\n          \"max-width\": \"250px\"\n        }}\n      >\n        <ForItems in={state.collection()}>\n          {section => (\n            <MenuSection heading={section().title}>\n              <ForItems in={section().childNodes}>\n                {item => (\n                  <MenuItem key={item().key} onAction={props.onAction}>\n                    {item().children}\n                  </MenuItem>\n                )}\n              </ForItems>\n            </MenuSection>\n          )}\n        </ForItems>\n      </ul>\n    </MenuProvider>\n  );\n}\n\nfunction MenuSection(props: ParentProps<AriaMenuSectionProps>) {\n  const { itemProps, headingProps, groupProps } = createMenuSection(props);\n\n  return (\n    <li {...itemProps}>\n      <Show when={props.heading}>\n        <span\n          {...headingProps}\n          style={{\n            \"font-weight\": \"bold\",\n            \"font-size\": \"1.1em\",\n            padding: \"2px 5px\"\n          }}\n        >\n          {props.heading}\n        </span>\n      </Show>\n      <ul\n        {...groupProps}\n        style={{\n          padding: 0,\n          \"list-style\": \"none\"\n        }}\n      >\n        {props.children}\n      </ul>\n    </li>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps, isFocused, isDisabled } = createMenuItem(props, () => ref);\n\n  return (\n    <li\n      {...menuItemProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : null,\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: isDisabled() ? \"default\" : \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <Menu onAction={key => alert(key)} aria-label=\"Actions\">\n      <Section key=\"section1\" title=\"Section 1\">\n        <Item key=\"section1-item1\">One</Item>\n        <Item key=\"section1-item2\">Two</Item>\n        <Item key=\"section1-item3\">Three</Item>\n      </Section>\n      <Section key=\"section2\" title=\"Section 2\">\n        <Item key=\"section2-item1\">One</Item>\n        <Item key=\"section2-item2\">Two</Item>\n        <Item key=\"section2-item3\">Three</Item>\n      </Section>\n    </Menu>\n  );\n}\n```\n\n## `createMenuTrigger`\n\nProvides the behavior and accessibility implementation for a menu trigger.\n\n### Features\n\nThere is no native element to implement a menu in HTML that is widely supported. `createMenuTrigger` combined with `createMenu` helps achieve accessible menu components that can be styled as needed.\n\n- Exposed to assistive technology as a button with a `menu` popup using ARIA (combined with `createMenu`)\n- Support for mouse, touch, and keyboard interactions\n- Keyboard support for opening the menu using the arrow keys, including automatically focusing the first or last item accordingly\n\n### How to use it\n\nThis example shows how to build a menu button using `createMenuTrigger`, `createButton`, and `createMenu`.\n\nThe menu popup uses `createMenu` and `createMenuItem` to render the menu and its items. In addition, a `<FocusScope>` is used to automatically restore focus to the trigger when the menu closes. A hidden `<DismissButton>` is added at the start and end of the menu to allow screen reader users to dismiss it easily.\n\nThis example does not do any advanced popover positioning or portaling to escape its visual container.\n\n```tsx\nimport { createButton } from \"@solid-aria/button\";\nimport { ForItems, Item } from \"@solid-aria/collection\";\nimport { FocusScope } from \"@solid-aria/focus\";\nimport { createFocus } from \"@solid-aria/interactions\";\nimport {\n  AriaMenuItemProps,\n  AriaMenuProps,\n  AriaMenuTriggerProps,\n  createMenu,\n  createMenuItem,\n  createMenuTrigger\n} from \"@solid-aria/menu\";\nimport { AriaOverlayProps, createOverlay, DismissButton } from \"@solid-aria/overlays\";\nimport { combineProps } from \"@solid-primitives/props\";\nimport { createSignal, FlowProps, JSX, ParentProps, Show } from \"solid-js\";\n\ntype MenuButtonProps = FlowProps<AriaMenuTriggerProps & AriaMenuProps & { label: JSX.Element }>;\n\nfunction MenuButton(props: MenuButtonProps) {\n  let ref: HTMLButtonElement | undefined;\n\n  // Get props for the menu trigger and menu elements\n  const { menuTriggerProps, menuProps, state } = createMenuTrigger({}, () => ref);\n\n  // Get props for the button based on the trigger props from createMenuTrigger\n  const { buttonProps } = createButton(menuTriggerProps, () => ref);\n\n  return (\n    <div style={{ position: \"relative\", display: \"inline-block\" }}>\n      <button {...buttonProps} ref={ref} style={{ height: \"30px\", \"font-size\": \"14px\" }}>\n        {props.label}\n        <span aria-hidden=\"true\" style={{ \"padding-left\": \"5px\" }}>\n          ▼\n        </span>\n      </button>\n      <Show when={state.isOpen()}>\n        <MenuPopup\n          {...props}\n          {...menuProps}\n          autofocus={state.focusStrategy()}\n          onClose={() => state.close()}\n        />\n      </Show>\n    </div>\n  );\n}\n\nfunction MenuPopup(props: AriaMenuProps & AriaOverlayProps) {\n  let ref: HTMLUListElement | undefined;\n\n  // Get props for the menu element\n  const { MenuProvider, menuProps, state } = createMenu(props, () => ref);\n\n  // Handle events that should cause the menu to close,\n  // e.g. blur, clicking outside, or pressing the escape key.\n  let overlayRef: HTMLDivElement | undefined;\n  const { overlayProps } = createOverlay(\n    {\n      onClose: props.onClose,\n      shouldCloseOnBlur: true,\n      isOpen: true,\n      isDismissable: true\n    },\n    () => overlayRef\n  );\n\n  // Wrap in <FocusScope> so that focus is restored back to the\n  // trigger when the menu is closed. In addition, add hidden\n  // <DismissButton> components at the start and end of the list\n  // to allow screen reader users to dismiss the popup easily.\n  return (\n    <MenuProvider>\n      <FocusScope restoreFocus>\n        <div {...overlayProps} ref={overlayRef}>\n          <DismissButton onDismiss={props.onClose} />\n          <ul\n            {...menuProps}\n            ref={ref}\n            style={{\n              position: \"absolute\",\n              width: \"100%\",\n              margin: \"4px 0 0 0\",\n              padding: 0,\n              \"list-style\": \"none\",\n              border: \"1px solid gray\",\n              background: \"lightgray\"\n            }}\n          >\n            <ForItems in={state.collection()}>\n              {item => (\n                <MenuItem key={item().key} onAction={props.onAction} onClose={props.onClose}>\n                  {item().children}\n                </MenuItem>\n              )}\n            </ForItems>\n          </ul>\n          <DismissButton onDismiss={props.onClose} />\n        </div>\n      </FocusScope>\n    </MenuProvider>\n  );\n}\n\nfunction MenuItem(props: ParentProps<AriaMenuItemProps>) {\n  let ref: HTMLLIElement | undefined;\n\n  // Get props for the menu item element\n  const { menuItemProps } = createMenuItem(props, () => ref);\n\n  // Handle focus events so we can apply highlighted\n  // style to the focused menu item\n  const [isFocused, setIsFocused] = createSignal(false);\n  const { focusProps } = createFocus({ onFocusChange: setIsFocused });\n\n  const rootProps = combineProps(menuItemProps, focusProps);\n\n  return (\n    <li\n      {...rootProps}\n      ref={ref}\n      style={{\n        background: isFocused() ? \"gray\" : \"transparent\",\n        color: isFocused() ? \"white\" : \"black\",\n        padding: \"2px 5px\",\n        outline: \"none\",\n        cursor: \"pointer\"\n      }}\n    >\n      {props.children}\n    </li>\n  );\n}\n\nfunction App() {\n  return (\n    <MenuButton label=\"Actions\" onAction={key => alert(key)}>\n      <Item key=\"copy\">Copy</Item>\n      <Item key=\"cut\">Cut</Item>\n      <Item key=\"paste\">Paste</Item>\n    </MenuButton>\n  );\n}\n```\n\n### Internationalization\n\n`createMenu` handles some aspects of internationalization automatically. For example, type to select is implemented with an `Intl.Collator` for internationalized string matching. You are responsible for localizing all menu item labels for content that is passed into the menu.\n\n#### RTL\n\nIn right-to-left languages, the menu items should be mirrored. Ensure that your CSS accounts for this.\n\n## Changelog\n\nAll notable changes are described in the [CHANGELOG.md](./CHANGELOG.md) file.\n","readmeFilename":"README.md"}