{"_id":"@ambilight-taro/picker","name":"@ambilight-taro/picker","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ambilight-taro/picker","version":"1.0.0","description":"![NPM Version](https://img.shields.io/npm/v/%40ambilight-taro%2Fpicker) ![NPM Downloads](https://img.shields.io/npm/dm/%40ambilight-taro%2Fpicker)","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"rollup -c","build:watch":"rollup -cw"},"repository":{"type":"git","url":"git+https://github.com/pesce-salato/ambilight-taro-ui.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/pesce-salato/ambilight-taro-ui/issues"},"homepage":"https://github.com/pesce-salato/ambilight-taro-ui#readme","devDependencies":{"@ambilight-taro/rollup-config":"*","@ambilight-taro/tsconfig":"*","@tarojs/components":"3.6.19","@tarojs/taro":"3.6.19","@types/react":"^18.2.38","react":"^18.0.0","rollup":"^4.5.1","typescript":"^5.3.2"},"dependencies":{"@ambilight-taro/basic-view":"^1.0.0","@ambilight-taro/core":"^1.0.0","@ambilight-taro/use-compatible-uncontrolled-value":"^1.0.0"},"gitHead":"9ab8a57d0a8fda45ebfa6bd4e46e8ab04a420935","_id":"@ambilight-taro/picker@1.0.0","_nodeVersion":"20.18.2","_npmVersion":"lerna/7.4.2/node@v20.18.2+arm64 (darwin)","dist":{"integrity":"sha512-RJtIzQHKX3aqUqHC9/qW4ohuCuS9N4t5C9D92rCVAA1vTD8wYgdjUgjdShuEnUpPhaCXG+zcOMNsrMVe1tRyig==","shasum":"3d6f525d2ceb909018c73f2f249894177ecc6acb","tarball":"https://registry.npmjs.org/@ambilight-taro/picker/-/picker-1.0.0.tgz","fileCount":12,"unpackedSize":13775,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGZXdHT5pTm7WCpvDUUsr0aKHPpEmVX2tg547E0iM6v3AiEAnyMVx5BZAtiaU7MmgR0SL3KS5txUaM7IRakyHJUGRJE="}]},"_npmUser":{"name":"chicken_bro","email":"ordinary_person@outlook.com"},"directories":{},"maintainers":[{"name":"chicken_bro","email":"ordinary_person@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/picker_1.0.0_1742741474540_0.27899640774196666"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-23T14:51:14.447Z","1.0.0":"2025-03-23T14:51:14.728Z","modified":"2025-03-23T14:51:14.978Z"},"maintainers":[{"name":"chicken_bro","email":"ordinary_person@outlook.com"}],"description":"![NPM Version](https://img.shields.io/npm/v/%40ambilight-taro%2Fpicker) ![NPM Downloads](https://img.shields.io/npm/dm/%40ambilight-taro%2Fpicker)","homepage":"https://github.com/pesce-salato/ambilight-taro-ui#readme","repository":{"type":"git","url":"git+https://github.com/pesce-salato/ambilight-taro-ui.git"},"bugs":{"url":"https://github.com/pesce-salato/ambilight-taro-ui/issues"},"license":"MIT","readme":"# @ambilight-taro/picker\n\n![NPM Version](https://img.shields.io/npm/v/%40ambilight-taro%2Fpicker)\n![NPM Downloads](https://img.shields.io/npm/dm/%40ambilight-taro%2Fpicker)\n\n## Installation\n\n```shell\nnpm install @ambilight-taro/picker\n```\n\n## Usage\n\n选择器组件，主要用作在多个选项中快速选择某一项\n\n> 组件会在初始化的时候自动查询组件本身的高度和选项的高度，故而需注意：\n> - 在初次渲染的时候就保证**组件、选项高度是预期**的，且**后续不改变**（组件默认会和父容器高度一致，可通过样式来设定**组件、选项**高度）\n> - 请保证所有的选项**高度保持一致**（出于性能考虑，组件会讲将有选项高度视作一致）\n\n### 受控\n```tsx\nconst [value, setValue] = useState('0')\n\n<AlPicker \n  value={value} \n  onChange={setValue}\n  options={[\n    {\n      id: '0',\n      content: '0'\n    },\n    {\n      id: '1',\n      content: <Text>1</Text>\n    },\n  ]}\n/>\n```\n\n### 非受控\n```tsx\n<AlPicker \n  defaultValue={'0'} \n  onChange={setValue}\n  options={[\n    {\n      id: '0',\n      content: '0'\n    },\n    {\n      id: '1',\n      content: <Text>1</Text>\n    },\n  ]}\n/>\n```\n\n## Props\n\n```tsx\ninterface AlPickerOption {\n  /**\n   * 选项渲染内容\n   */\n  content: React.ReactNode\n  /**\n   * 选项 id\n   */\n  id: string\n}\n\ninterface AlPickerProps {\n  /**\n   * 选项信息\n   */\n  options: AlPickerOption[]\n  /**\n   * 选中值 id\n   */\n  value?: string\n  /**\n   * 默认选中值 id\n   */\n  defaultValue?: string\n  /**\n   * 选中值改变事件\n   */\n  onChange?: (value: string) => void\n  className?: string\n  style?: React.CSSProperties | string\n}\n```\n\n\n\n","readmeFilename":"README.md","_rev":"1-49866f9fc9083fd9e4b9580861ec7414"}